/g,">").replace(/"/g,""").replace(/'/g,"'")}function sn(o,...n){const s=Object.create(null);for(const l in o)s[l]=o[l];return n.forEach(function(l){for(const a in l)s[a]=l[a]}),s}const FM="
",fb=o=>!!o.scope,UM=(o,{prefix:n})=>{if(o.startsWith("language:"))return o.replace("language:","language-");if(o.includes(".")){const s=o.split(".");return[`${n}${s.shift()}`,...s.map((l,a)=>`${l}${"_".repeat(a+1)}`)].join(" ")}return`${n}${o}`};class HM{constructor(n,s){this.buffer="",this.classPrefix=s.classPrefix,n.walk(this)}addText(n){this.buffer+=PI(n)}openNode(n){if(!fb(n))return;const s=UM(n.scope,{prefix:this.classPrefix});this.span(s)}closeNode(n){fb(n)&&(this.buffer+=FM)}value(){return this.buffer}span(n){this.buffer+=``}}const mb=(o={})=>{const n={children:[]};return Object.assign(n,o),n};class Cg{constructor(){this.rootNode=mb(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(n){this.top.children.push(n)}openNode(n){const s=mb({scope:n});this.add(s),this.stack.push(s)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(n){return this.constructor._walk(n,this.rootNode)}static _walk(n,s){return typeof s=="string"?n.addText(s):s.children&&(n.openNode(s),s.children.forEach(l=>this._walk(n,l)),n.closeNode(s)),n}static _collapse(n){typeof n!="string"&&n.children&&(n.children.every(s=>typeof s=="string")?n.children=[n.children.join("")]:n.children.forEach(s=>{Cg._collapse(s)}))}}class VM extends Cg{constructor(n){super(),this.options=n}addText(n){n!==""&&this.add(n)}startScope(n){this.openNode(n)}endScope(){this.closeNode()}__addSublanguage(n,s){const l=n.root;s&&(l.scope=`language:${s}`),this.add(l)}toHTML(){return new HM(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function Bc(o){return o?typeof o=="string"?o:o.source:null}function xI(o){return rr("(?=",o,")")}function GM(o){return rr("(?:",o,")*")}function WM(o){return rr("(?:",o,")?")}function rr(...o){return o.map(s=>Bc(s)).join("")}function zM(o){const n=o[o.length-1];return typeof n=="object"&&n.constructor===Object?(o.splice(o.length-1,1),n):{}}function yg(...o){return"("+(zM(o).capture?"":"?:")+o.map(l=>Bc(l)).join("|")+")"}function BI(o){return new RegExp(o.toString()+"|").exec("").length-1}function XM(o,n){const s=o&&o.exec(n);return s&&s.index===0}const jM=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function Sg(o,{joinWith:n}){let s=0;return o.map(l=>{s+=1;const a=s;let u=Bc(l),d="";for(;u.length>0;){const h=jM.exec(u);if(!h){d+=u;break}d+=u.substring(0,h.index),u=u.substring(h.index+h[0].length),h[0][0]==="\\"&&h[1]?d+="\\"+String(Number(h[1])+a):(d+=h[0],h[0]==="("&&s++)}return d}).map(l=>`(${l})`).join(n)}const YM=/\b\B/,FI="[a-zA-Z]\\w*",Rg="[a-zA-Z_]\\w*",UI="\\b\\d+(\\.\\d+)?",HI="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",VI="\\b(0b[01]+)",KM="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",QM=(o={})=>{const n=/^#![ ]*\//;return o.binary&&(o.begin=rr(n,/.*\b/,o.binary,/\b.*/)),sn({scope:"meta",begin:n,end:/$/,relevance:0,"on:begin":(s,l)=>{s.index!==0&&l.ignoreMatch()}},o)},Fc={begin:"\\\\[\\s\\S]",relevance:0},qM={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Fc]},JM={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Fc]},ZM={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},pd=function(o,n,s={}){const l=sn({scope:"comment",begin:o,end:n,contains:[]},s);l.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const a=yg("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return l.contains.push({begin:rr(/[ ]+/,"(",a,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),l},e5=pd("//","$"),t5=pd("/\\*","\\*/"),o5=pd("#","$"),s5={scope:"number",begin:UI,relevance:0},i5={scope:"number",begin:HI,relevance:0},n5={scope:"number",begin:VI,relevance:0},r5={begin:/(?=\/[^/\n]*\/)/,contains:[{scope:"regexp",begin:/\//,end:/\/[gimuy]*/,illegal:/\n/,contains:[Fc,{begin:/\[/,end:/\]/,relevance:0,contains:[Fc]}]}]},l5={scope:"title",begin:FI,relevance:0},c5={scope:"title",begin:Rg,relevance:0},a5={begin:"\\.\\s*"+Rg,relevance:0},u5=function(o){return Object.assign(o,{"on:begin":(n,s)=>{s.data._beginMatch=n[1]},"on:end":(n,s)=>{s.data._beginMatch!==n[1]&&s.ignoreMatch()}})};var Cu=Object.freeze({__proto__:null,MATCH_NOTHING_RE:YM,IDENT_RE:FI,UNDERSCORE_IDENT_RE:Rg,NUMBER_RE:UI,C_NUMBER_RE:HI,BINARY_NUMBER_RE:VI,RE_STARTERS_RE:KM,SHEBANG:QM,BACKSLASH_ESCAPE:Fc,APOS_STRING_MODE:qM,QUOTE_STRING_MODE:JM,PHRASAL_WORDS_MODE:ZM,COMMENT:pd,C_LINE_COMMENT_MODE:e5,C_BLOCK_COMMENT_MODE:t5,HASH_COMMENT_MODE:o5,NUMBER_MODE:s5,C_NUMBER_MODE:i5,BINARY_NUMBER_MODE:n5,REGEXP_MODE:r5,TITLE_MODE:l5,UNDERSCORE_TITLE_MODE:c5,METHOD_GUARD:a5,END_SAME_AS_BEGIN:u5});function d5(o,n){o.input[o.index-1]==="."&&n.ignoreMatch()}function h5(o,n){o.className!==void 0&&(o.scope=o.className,delete o.className)}function p5(o,n){n&&o.beginKeywords&&(o.begin="\\b("+o.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",o.__beforeBegin=d5,o.keywords=o.keywords||o.beginKeywords,delete o.beginKeywords,o.relevance===void 0&&(o.relevance=0))}function $5(o,n){Array.isArray(o.illegal)&&(o.illegal=yg(...o.illegal))}function _5(o,n){if(o.match){if(o.begin||o.end)throw new Error("begin & end are not supported with match");o.begin=o.match,delete o.match}}function g5(o,n){o.relevance===void 0&&(o.relevance=1)}const f5=(o,n)=>{if(!o.beforeMatch)return;if(o.starts)throw new Error("beforeMatch cannot be used with starts");const s=Object.assign({},o);Object.keys(o).forEach(l=>{delete o[l]}),o.keywords=s.keywords,o.begin=rr(s.beforeMatch,xI(s.begin)),o.starts={relevance:0,contains:[Object.assign(s,{endsParent:!0})]},o.relevance=0,delete s.beforeMatch},m5=["of","and","for","in","not","or","if","then","parent","list","value"],T5="keyword";function GI(o,n,s=T5){const l=Object.create(null);return typeof o=="string"?a(s,o.split(" ")):Array.isArray(o)?a(s,o):Object.keys(o).forEach(function(u){Object.assign(l,GI(o[u],n,u))}),l;function a(u,d){n&&(d=d.map(h=>h.toLowerCase())),d.forEach(function(h){const p=h.split("|");l[p[0]]=[u,E5(p[0],p[1])]})}}function E5(o,n){return n?Number(n):b5(o)?0:1}function b5(o){return m5.includes(o.toLowerCase())}const Tb={},Zn=o=>{console.error(o)},Eb=(o,...n)=>{console.log(`WARN: ${o}`,...n)},tl=(o,n)=>{Tb[`${o}/${n}`]||(console.log(`Deprecated as of ${o}. ${n}`),Tb[`${o}/${n}`]=!0)},ju=new Error;function WI(o,n,{key:s}){let l=0;const a=o[s],u={},d={};for(let h=1;h<=n.length;h++)d[h+l]=a[h],u[h+l]=!0,l+=BI(n[h-1]);o[s]=d,o[s]._emit=u,o[s]._multi=!0}function v5(o){if(Array.isArray(o.begin)){if(o.skip||o.excludeBegin||o.returnBegin)throw Zn("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),ju;if(typeof o.beginScope!="object"||o.beginScope===null)throw Zn("beginScope must be object"),ju;WI(o,o.begin,{key:"beginScope"}),o.begin=Sg(o.begin,{joinWith:""})}}function I5(o){if(Array.isArray(o.end)){if(o.skip||o.excludeEnd||o.returnEnd)throw Zn("skip, excludeEnd, returnEnd not compatible with endScope: {}"),ju;if(typeof o.endScope!="object"||o.endScope===null)throw Zn("endScope must be object"),ju;WI(o,o.end,{key:"endScope"}),o.end=Sg(o.end,{joinWith:""})}}function O5(o){o.scope&&typeof o.scope=="object"&&o.scope!==null&&(o.beginScope=o.scope,delete o.scope)}function C5(o){O5(o),typeof o.beginScope=="string"&&(o.beginScope={_wrap:o.beginScope}),typeof o.endScope=="string"&&(o.endScope={_wrap:o.endScope}),v5(o),I5(o)}function y5(o){function n(d,h){return new RegExp(Bc(d),"m"+(o.case_insensitive?"i":"")+(o.unicodeRegex?"u":"")+(h?"g":""))}class s{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(h,p){p.position=this.position++,this.matchIndexes[this.matchAt]=p,this.regexes.push([p,h]),this.matchAt+=BI(h)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const h=this.regexes.map(p=>p[1]);this.matcherRe=n(Sg(h,{joinWith:"|"}),!0),this.lastIndex=0}exec(h){this.matcherRe.lastIndex=this.lastIndex;const p=this.matcherRe.exec(h);if(!p)return null;const f=p.findIndex((C,S)=>S>0&&C!==void 0),T=this.matchIndexes[f];return p.splice(0,f),Object.assign(p,T)}}class l{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(h){if(this.multiRegexes[h])return this.multiRegexes[h];const p=new s;return this.rules.slice(h).forEach(([f,T])=>p.addRule(f,T)),p.compile(),this.multiRegexes[h]=p,p}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(h,p){this.rules.push([h,p]),p.type==="begin"&&this.count++}exec(h){const p=this.getMatcher(this.regexIndex);p.lastIndex=this.lastIndex;let f=p.exec(h);if(this.resumingScanAtSamePosition()&&!(f&&f.index===this.lastIndex)){const T=this.getMatcher(0);T.lastIndex=this.lastIndex+1,f=T.exec(h)}return f&&(this.regexIndex+=f.position+1,this.regexIndex===this.count&&this.considerAll()),f}}function a(d){const h=new l;return d.contains.forEach(p=>h.addRule(p.begin,{rule:p,type:"begin"})),d.terminatorEnd&&h.addRule(d.terminatorEnd,{type:"end"}),d.illegal&&h.addRule(d.illegal,{type:"illegal"}),h}function u(d,h){const p=d;if(d.isCompiled)return p;[h5,_5,C5,f5].forEach(T=>T(d,h)),o.compilerExtensions.forEach(T=>T(d,h)),d.__beforeBegin=null,[p5,$5,g5].forEach(T=>T(d,h)),d.isCompiled=!0;let f=null;return typeof d.keywords=="object"&&d.keywords.$pattern&&(d.keywords=Object.assign({},d.keywords),f=d.keywords.$pattern,delete d.keywords.$pattern),f=f||/\w+/,d.keywords&&(d.keywords=GI(d.keywords,o.case_insensitive)),p.keywordPatternRe=n(f,!0),h&&(d.begin||(d.begin=/\B|\b/),p.beginRe=n(p.begin),!d.end&&!d.endsWithParent&&(d.end=/\B|\b/),d.end&&(p.endRe=n(p.end)),p.terminatorEnd=Bc(p.end)||"",d.endsWithParent&&h.terminatorEnd&&(p.terminatorEnd+=(d.end?"|":"")+h.terminatorEnd)),d.illegal&&(p.illegalRe=n(d.illegal)),d.contains||(d.contains=[]),d.contains=[].concat(...d.contains.map(function(T){return S5(T==="self"?d:T)})),d.contains.forEach(function(T){u(T,p)}),d.starts&&u(d.starts,h),p.matcher=a(p),p}if(o.compilerExtensions||(o.compilerExtensions=[]),o.contains&&o.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return o.classNameAliases=sn(o.classNameAliases||{}),u(o)}function zI(o){return o?o.endsWithParent||zI(o.starts):!1}function S5(o){return o.variants&&!o.cachedVariants&&(o.cachedVariants=o.variants.map(function(n){return sn(o,{variants:null},n)})),o.cachedVariants?o.cachedVariants:zI(o)?sn(o,{starts:o.starts?sn(o.starts):null}):Object.isFrozen(o)?sn(o):o}var R5="11.8.0";class k5 extends Error{constructor(n,s){super(n),this.name="HTMLInjectionError",this.html=s}}const o0=PI,bb=sn,vb=Symbol("nomatch"),A5=7,XI=function(o){const n=Object.create(null),s=Object.create(null),l=[];let a=!0;const u="Could not find the language '{}', did you forget to load/include a language module?",d={disableAutodetect:!0,name:"Plain text",contains:[]};let h={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:VM};function p(D){return h.noHighlightRe.test(D)}function f(D){let B=D.className+" ";B+=D.parentNode?D.parentNode.className:"";const ae=h.languageDetectRe.exec(B);if(ae){const _e=X(ae[1]);return _e||(Eb(u.replace("{}",ae[1])),Eb("Falling back to no-highlight mode for this block.",D)),_e?ae[1]:"no-highlight"}return B.split(/\s+/).find(_e=>p(_e)||X(_e))}function T(D,B,ae){let _e="",Me="";typeof B=="object"?(_e=D,ae=B.ignoreIllegals,Me=B.language):(tl("10.7.0","highlight(lang, code, ...args) has been deprecated."),tl("10.7.0",`Please use highlight(code, options) instead.
+https://github.com/highlightjs/highlight.js/issues/2277`),Me=D,_e=B),ae===void 0&&(ae=!0);const Xe={code:_e,language:Me};re("before:highlight",Xe);const Je=Xe.result?Xe.result:C(Xe.language,Xe.code,ae);return Je.code=Xe.code,re("after:highlight",Je),Je}function C(D,B,ae,_e){const Me=Object.create(null);function Xe(ie,ue){return ie.keywords[ue]}function Je(){if(!se.keywords){ce.addText(Se);return}let ie=0;se.keywordPatternRe.lastIndex=0;let ue=se.keywordPatternRe.exec(Se),ye="";for(;ue;){ye+=Se.substring(ie,ue.index);const E=U.case_insensitive?ue[0].toLowerCase():ue[0],g=Xe(se,E);if(g){const[k,W]=g;if(ce.addText(ye),ye="",Me[E]=(Me[E]||0)+1,Me[E]<=A5&&(Ne+=W),k.startsWith("_"))ye+=ue[0];else{const J=U.classNameAliases[k]||k;Ze(ue[0],J)}}else ye+=ue[0];ie=se.keywordPatternRe.lastIndex,ue=se.keywordPatternRe.exec(Se)}ye+=Se.substring(ie),ce.addText(ye)}function we(){if(Se==="")return;let ie=null;if(typeof se.subLanguage=="string"){if(!n[se.subLanguage]){ce.addText(Se);return}ie=C(se.subLanguage,Se,!0,Ce[se.subLanguage]),Ce[se.subLanguage]=ie._top}else ie=P(Se,se.subLanguage.length?se.subLanguage:null);se.relevance>0&&(Ne+=ie.relevance),ce.__addSublanguage(ie._emitter,ie.language)}function We(){se.subLanguage!=null?we():Je(),Se=""}function Ze(ie,ue){ie!==""&&(ce.startScope(ue),ce.addText(ie),ce.endScope())}function nt(ie,ue){let ye=1;const E=ue.length-1;for(;ye<=E;){if(!ie._emit[ye]){ye++;continue}const g=U.classNameAliases[ie[ye]]||ie[ye],k=ue[ye];g?Ze(k,g):(Se=k,Je(),Se=""),ye++}}function ht(ie,ue){return ie.scope&&typeof ie.scope=="string"&&ce.openNode(U.classNameAliases[ie.scope]||ie.scope),ie.beginScope&&(ie.beginScope._wrap?(Ze(Se,U.classNameAliases[ie.beginScope._wrap]||ie.beginScope._wrap),Se=""):ie.beginScope._multi&&(nt(ie.beginScope,ue),Se="")),se=Object.create(ie,{parent:{value:se}}),se}function et(ie,ue,ye){let E=XM(ie.endRe,ye);if(E){if(ie["on:end"]){const g=new gb(ie);ie["on:end"](ue,g),g.isMatchIgnored&&(E=!1)}if(E){for(;ie.endsParent&&ie.parent;)ie=ie.parent;return ie}}if(ie.endsWithParent)return et(ie.parent,ue,ye)}function xe(ie){return se.matcher.regexIndex===0?(Se+=ie[0],1):(ee=!0,0)}function w(ie){const ue=ie[0],ye=ie.rule,E=new gb(ye),g=[ye.__beforeBegin,ye["on:begin"]];for(const k of g)if(k&&(k(ie,E),E.isMatchIgnored))return xe(ue);return ye.skip?Se+=ue:(ye.excludeBegin&&(Se+=ue),We(),!ye.returnBegin&&!ye.excludeBegin&&(Se=ue)),ht(ye,ie),ye.returnBegin?0:ue.length}function I(ie){const ue=ie[0],ye=B.substring(ie.index),E=et(se,ie,ye);if(!E)return vb;const g=se;se.endScope&&se.endScope._wrap?(We(),Ze(ue,se.endScope._wrap)):se.endScope&&se.endScope._multi?(We(),nt(se.endScope,ie)):g.skip?Se+=ue:(g.returnEnd||g.excludeEnd||(Se+=ue),We(),g.excludeEnd&&(Se=ue));do se.scope&&ce.closeNode(),!se.skip&&!se.subLanguage&&(Ne+=se.relevance),se=se.parent;while(se!==E.parent);return E.starts&&ht(E.starts,ie),g.returnEnd?0:ue.length}function N(){const ie=[];for(let ue=se;ue!==U;ue=ue.parent)ue.scope&&ie.unshift(ue.scope);ie.forEach(ue=>ce.openNode(ue))}let A={};function K(ie,ue){const ye=ue&&ue[0];if(Se+=ie,ye==null)return We(),0;if(A.type==="begin"&&ue.type==="end"&&A.index===ue.index&&ye===""){if(Se+=B.slice(ue.index,ue.index+1),!a){const E=new Error(`0 width match regex (${D})`);throw E.languageName=D,E.badRule=A.rule,E}return 1}if(A=ue,ue.type==="begin")return w(ue);if(ue.type==="illegal"&&!ae){const E=new Error('Illegal lexeme "'+ye+'" for mode "'+(se.scope||"")+'"');throw E.mode=se,E}else if(ue.type==="end"){const E=I(ue);if(E!==vb)return E}if(ue.type==="illegal"&&ye==="")return 1;if(be>1e5&&be>ue.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Se+=ye,ye.length}const U=X(D);if(!U)throw Zn(u.replace("{}",D)),new Error('Unknown language: "'+D+'"');const de=y5(U);let Te="",se=_e||de;const Ce={},ce=new h.__emitter(h);N();let Se="",Ne=0,He=0,be=0,ee=!1;try{if(U.__emitTokens)U.__emitTokens(B,ce);else{for(se.matcher.considerAll();;){be++,ee?ee=!1:se.matcher.considerAll(),se.matcher.lastIndex=He;const ie=se.matcher.exec(B);if(!ie)break;const ue=B.substring(He,ie.index),ye=K(ue,ie);He=ie.index+ye}K(B.substring(He))}return ce.finalize(),Te=ce.toHTML(),{language:D,value:Te,relevance:Ne,illegal:!1,_emitter:ce,_top:se}}catch(ie){if(ie.message&&ie.message.includes("Illegal"))return{language:D,value:o0(B),illegal:!0,relevance:0,_illegalBy:{message:ie.message,index:He,context:B.slice(He-100,He+100),mode:ie.mode,resultSoFar:Te},_emitter:ce};if(a)return{language:D,value:o0(B),illegal:!1,relevance:0,errorRaised:ie,_emitter:ce,_top:se};throw ie}}function S(D){const B={value:o0(D),illegal:!1,relevance:0,_top:d,_emitter:new h.__emitter(h)};return B._emitter.addText(D),B}function P(D,B){B=B||h.languages||Object.keys(n);const ae=S(D),_e=B.filter(X).filter($e).map(We=>C(We,D,!1));_e.unshift(ae);const Me=_e.sort((We,Ze)=>{if(We.relevance!==Ze.relevance)return Ze.relevance-We.relevance;if(We.language&&Ze.language){if(X(We.language).supersetOf===Ze.language)return 1;if(X(Ze.language).supersetOf===We.language)return-1}return 0}),[Xe,Je]=Me,we=Xe;return we.secondBest=Je,we}function x(D,B,ae){const _e=B&&s[B]||ae;D.classList.add("hljs"),D.classList.add(`language-${_e}`)}function G(D){let B=null;const ae=f(D);if(p(ae))return;if(re("before:highlightElement",{el:D,language:ae}),D.children.length>0&&(h.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(D)),h.throwUnescapedHTML))throw new k5("One of your code blocks includes unescaped HTML.",D.innerHTML);B=D;const _e=B.textContent,Me=ae?T(_e,{language:ae,ignoreIllegals:!0}):P(_e);D.innerHTML=Me.value,x(D,ae,Me.language),D.result={language:Me.language,re:Me.relevance,relevance:Me.relevance},Me.secondBest&&(D.secondBest={language:Me.secondBest.language,relevance:Me.secondBest.relevance}),re("after:highlightElement",{el:D,result:Me,text:_e})}function oe(D){h=bb(h,D)}const ne=()=>{M(),tl("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function Z(){M(),tl("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let Y=!1;function M(){if(document.readyState==="loading"){Y=!0;return}document.querySelectorAll(h.cssSelector).forEach(G)}function L(){Y&&M()}typeof window<"u"&&window.addEventListener&&window.addEventListener("DOMContentLoaded",L,!1);function R(D,B){let ae=null;try{ae=B(o)}catch(_e){if(Zn("Language definition for '{}' could not be registered.".replace("{}",D)),a)Zn(_e);else throw _e;ae=d}ae.name||(ae.name=D),n[D]=ae,ae.rawDefinition=B.bind(null,o),ae.aliases&&le(ae.aliases,{languageName:D})}function F(D){delete n[D];for(const B of Object.keys(s))s[B]===D&&delete s[B]}function z(){return Object.keys(n)}function X(D){return D=(D||"").toLowerCase(),n[D]||n[s[D]]}function le(D,{languageName:B}){typeof D=="string"&&(D=[D]),D.forEach(ae=>{s[ae.toLowerCase()]=B})}function $e(D){const B=X(D);return B&&!B.disableAutodetect}function he(D){D["before:highlightBlock"]&&!D["before:highlightElement"]&&(D["before:highlightElement"]=B=>{D["before:highlightBlock"](Object.assign({block:B.el},B))}),D["after:highlightBlock"]&&!D["after:highlightElement"]&&(D["after:highlightElement"]=B=>{D["after:highlightBlock"](Object.assign({block:B.el},B))})}function fe(D){he(D),l.push(D)}function ke(D){const B=l.indexOf(D);B!==-1&&l.splice(B,1)}function re(D,B){const ae=D;l.forEach(function(_e){_e[ae]&&_e[ae](B)})}function Ie(D){return tl("10.7.0","highlightBlock will be removed entirely in v12.0"),tl("10.7.0","Please use highlightElement now."),G(D)}Object.assign(o,{highlight:T,highlightAuto:P,highlightAll:M,highlightElement:G,highlightBlock:Ie,configure:oe,initHighlighting:ne,initHighlightingOnLoad:Z,registerLanguage:R,unregisterLanguage:F,listLanguages:z,getLanguage:X,registerAliases:le,autoDetection:$e,inherit:bb,addPlugin:fe,removePlugin:ke}),o.debugMode=function(){a=!1},o.safeMode=function(){a=!0},o.versionString=R5,o.regex={concat:rr,lookahead:xI,either:yg,optional:WM,anyNumberOfTimes:GM};for(const D in Cu)typeof Cu[D]=="object"&&DI(Cu[D]);return Object.assign(o,Cu),o},pl=XI({});pl.newInstance=()=>XI({});var L5=pl;pl.HighlightJS=pl;pl.default=pl;const yc=CI(L5);var Ib=Ke({props:{code:{type:String,required:!0},language:{type:String,default:""},autodetect:{type:Boolean,default:!0},ignoreIllegals:{type:Boolean,default:!0}},setup:function(o){var n=ge(o.language);Et(function(){return o.language},function(a){n.value=a});var s=j(function(){return o.autodetect||!n.value}),l=j(function(){return!s.value&&!yc.getLanguage(n.value)});return{className:j(function(){return l.value?"":"hljs "+n.value}),highlightedCode:j(function(){var a;if(l.value)return console.warn('The language "'+n.value+'" you specified could not be found.'),o.code.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'");if(s.value){var u=yc.highlightAuto(o.code);return n.value=(a=u.language)!==null&&a!==void 0?a:"",u.value}return(u=yc.highlight(o.code,{language:n.value,ignoreIllegals:o.ignoreIllegals})).value})}},render:function(){return Zs("pre",{},[Zs("code",{class:this.className,innerHTML:this.highlightedCode})])}}),N5={install:function(o){o.component("highlightjs",Ib)},component:Ib};const Ob="[A-Za-z$_][0-9A-Za-z$_]*",w5=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends"],M5=["true","false","null","undefined","NaN","Infinity"],jI=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],YI=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],KI=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],D5=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],P5=[].concat(KI,jI,YI);function x5(o){const n=o.regex,s=(B,{after:ae})=>{const _e=""+B[0].slice(1);return B.input.indexOf(_e,ae)!==-1},l=Ob,a={begin:"<>",end:">"},u=/<[A-Za-z0-9\\._:-]+\s*\/>/,d={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(B,ae)=>{const _e=B[0].length+B.index,Me=B.input[_e];if(Me==="<"||Me===","){ae.ignoreMatch();return}Me===">"&&(s(B,{after:_e})||ae.ignoreMatch());let Xe;const Je=B.input.substring(_e);if(Xe=Je.match(/^\s*=/)){ae.ignoreMatch();return}if((Xe=Je.match(/^\s+extends\s+/))&&Xe.index===0){ae.ignoreMatch();return}}},h={$pattern:Ob,keyword:w5,literal:M5,built_in:P5,"variable.language":D5},p="[0-9](_?[0-9])*",f=`\\.(${p})`,T="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",C={className:"number",variants:[{begin:`(\\b(${T})((${f})|\\.)?|(${f}))[eE][+-]?(${p})\\b`},{begin:`\\b(${T})\\b((${f})\\b|\\.)?|(${f})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},S={className:"subst",begin:"\\$\\{",end:"\\}",keywords:h,contains:[]},P={begin:"html`",end:"",starts:{end:"`",returnEnd:!1,contains:[o.BACKSLASH_ESCAPE,S],subLanguage:"xml"}},x={begin:"css`",end:"",starts:{end:"`",returnEnd:!1,contains:[o.BACKSLASH_ESCAPE,S],subLanguage:"css"}},G={begin:"gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[o.BACKSLASH_ESCAPE,S],subLanguage:"graphql"}},oe={className:"string",begin:"`",end:"`",contains:[o.BACKSLASH_ESCAPE,S]},Z={className:"comment",variants:[o.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:l+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),o.C_BLOCK_COMMENT_MODE,o.C_LINE_COMMENT_MODE]},Y=[o.APOS_STRING_MODE,o.QUOTE_STRING_MODE,P,x,G,oe,{match:/\$\d+/},C];S.contains=Y.concat({begin:/\{/,end:/\}/,keywords:h,contains:["self"].concat(Y)});const M=[].concat(Z,S.contains),L=M.concat([{begin:/\(/,end:/\)/,keywords:h,contains:["self"].concat(M)}]),R={className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:h,contains:L},F={variants:[{match:[/class/,/\s+/,l,/\s+/,/extends/,/\s+/,n.concat(l,"(",n.concat(/\./,l),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,l],scope:{1:"keyword",3:"title.class"}}]},z={relevance:0,match:n.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...jI,...YI]}},X={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},le={variants:[{match:[/function/,/\s+/,l,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[R],illegal:/%/},$e={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function he(B){return n.concat("(?!",B.join("|"),")")}const fe={match:n.concat(/\b/,he([...KI,"super","import"]),l,n.lookahead(/\(/)),className:"title.function",relevance:0},ke={begin:n.concat(/\./,n.lookahead(n.concat(l,/(?![0-9A-Za-z$_(])/))),end:l,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},re={match:[/get|set/,/\s+/,l,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},R]},Ie="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+o.UNDERSCORE_IDENT_RE+")\\s*=>",D={match:[/const|var|let/,/\s+/,l,/\s*/,/=\s*/,/(async\s*)?/,n.lookahead(Ie)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[R]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:h,exports:{PARAMS_CONTAINS:L,CLASS_REFERENCE:z},illegal:/#(?![$_A-z])/,contains:[o.SHEBANG({label:"shebang",binary:"node",relevance:5}),X,o.APOS_STRING_MODE,o.QUOTE_STRING_MODE,P,x,G,oe,Z,{match:/\$\d+/},C,z,{className:"attr",begin:l+n.lookahead(":"),relevance:0},D,{begin:"("+o.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[Z,o.REGEXP_MODE,{className:"function",begin:Ie,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:o.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:h,contains:L}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:a.begin,end:a.end},{match:u},{begin:d.begin,"on:begin":d.isTrulyOpeningTag,end:d.end}],subLanguage:"xml",contains:[{begin:d.begin,end:d.end,skip:!0,contains:["self"]}]}]},le,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+o.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[R,o.inherit(o.TITLE_MODE,{begin:l,className:"title.function"})]},{match:/\.\.\./,relevance:0},ke,{match:"\\$"+l,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[R]},fe,$e,F,re,{match:/\$[(.]/}]}}function B5(o){const n=o.regex,s=/[\p{XID_Start}_]\p{XID_Continue}*/u,l=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],h={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:l,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},p={className:"meta",begin:/^(>>>|\.\.\.) /},f={className:"subst",begin:/\{/,end:/\}/,keywords:h,illegal:/#/},T={begin:/\{\{/,relevance:0},C={className:"string",contains:[o.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[o.BACKSLASH_ESCAPE,p],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[o.BACKSLASH_ESCAPE,p],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[o.BACKSLASH_ESCAPE,p,T,f]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[o.BACKSLASH_ESCAPE,p,T,f]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[o.BACKSLASH_ESCAPE,T,f]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[o.BACKSLASH_ESCAPE,T,f]},o.APOS_STRING_MODE,o.QUOTE_STRING_MODE]},S="[0-9](_?[0-9])*",P=`(\\b(${S}))?\\.(${S})|\\b(${S})\\.`,x=`\\b|${l.join("|")}`,G={className:"number",relevance:0,variants:[{begin:`(\\b(${S})|(${P}))[eE][+-]?(${S})[jJ]?(?=${x})`},{begin:`(${P})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${x})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${x})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${x})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${x})`},{begin:`\\b(${S})[jJ](?=${x})`}]},oe={className:"comment",begin:n.lookahead(/# type:/),end:/$/,keywords:h,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},ne={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:h,contains:["self",p,G,C,o.HASH_COMMENT_MODE]}]};return f.contains=[C,G,p],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:h,illegal:/(<\/|\?)|=>/,contains:[p,G,{begin:/\bself\b/},{beginKeywords:"if",relevance:0},C,oe,o.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,s],scope:{1:"keyword",3:"title.function"},contains:[ne]},{variants:[{match:[/\bclass/,/\s+/,s,/\s*/,/\(\s*/,s,/\s*\)/]},{match:[/\bclass/,/\s+/,s]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[G,ne,C]}]}}var F5=!1;/*!
+ * pinia v2.1.6
+ * (c) 2023 Eduardo San Martin Morote
+ * @license MIT
+ */let QI;const $d=o=>QI=o,qI=Symbol();function P0(o){return o&&typeof o=="object"&&Object.prototype.toString.call(o)==="[object Object]"&&typeof o.toJSON!="function"}var Sc;(function(o){o.direct="direct",o.patchObject="patch object",o.patchFunction="patch function"})(Sc||(Sc={}));function U5(){const o=qb(!0),n=o.run(()=>ge({}));let s=[],l=[];const a=Zu({install(u){$d(a),a._a=u,u.provide(qI,a),u.config.globalProperties.$pinia=a,l.forEach(d=>s.push(d)),l=[]},use(u){return!this._a&&!F5?l.push(u):s.push(u),this},_p:s,_a:null,_e:o,_s:new Map,state:n});return a}const JI=()=>{};function Cb(o,n,s,l=JI){o.push(n);const a=()=>{const u=o.indexOf(n);u>-1&&(o.splice(u,1),l())};return!s&&G0()&&Jb(a),a}function ol(o,...n){o.slice().forEach(s=>{s(...n)})}const H5=o=>o();function x0(o,n){o instanceof Map&&n instanceof Map&&n.forEach((s,l)=>o.set(l,s)),o instanceof Set&&n instanceof Set&&n.forEach(o.add,o);for(const s in n){if(!n.hasOwnProperty(s))continue;const l=n[s],a=o[s];P0(a)&&P0(l)&&o.hasOwnProperty(s)&&!eo(l)&&!rn(l)?o[s]=x0(a,l):o[s]=l}return o}const V5=Symbol();function G5(o){return!P0(o)||!o.hasOwnProperty(V5)}const{assign:en}=Object;function W5(o){return!!(eo(o)&&o.effect)}function z5(o,n,s,l){const{state:a,actions:u,getters:d}=n,h=s.state.value[o];let p;function f(){h||(s.state.value[o]=a?a():{});const T=Pt(s.state.value[o]);return en(T,u,Object.keys(d||{}).reduce((C,S)=>(C[S]=Zu(j(()=>{$d(s);const P=s._s.get(o);return d[S].call(P,P)})),C),{}))}return p=ZI(o,f,n,s,l,!0),p}function ZI(o,n,s={},l,a,u){let d;const h=en({actions:{}},s),p={deep:!0};let f,T,C=[],S=[],P;const x=l.state.value[o];!u&&!x&&(l.state.value[o]={}),ge({});let G;function oe(z){let X;f=T=!1,typeof z=="function"?(z(l.state.value[o]),X={type:Sc.patchFunction,storeId:o,events:P}):(x0(l.state.value[o],z),X={type:Sc.patchObject,payload:z,storeId:o,events:P});const le=G=Symbol();Io().then(()=>{G===le&&(f=!0)}),T=!0,ol(C,X,l.state.value[o])}const ne=u?function(){const{state:X}=s,le=X?X():{};this.$patch($e=>{en($e,le)})}:JI;function Z(){d.stop(),C=[],S=[],l._s.delete(o)}function Y(z,X){return function(){$d(l);const le=Array.from(arguments),$e=[],he=[];function fe(Ie){$e.push(Ie)}function ke(Ie){he.push(Ie)}ol(S,{args:le,name:z,store:L,after:fe,onError:ke});let re;try{re=X.apply(this&&this.$id===o?this:L,le)}catch(Ie){throw ol(he,Ie),Ie}return re instanceof Promise?re.then(Ie=>(ol($e,Ie),Ie)).catch(Ie=>(ol(he,Ie),Promise.reject(Ie))):(ol($e,re),re)}}const M={_p:l,$id:o,$onAction:Cb.bind(null,S),$patch:oe,$reset:ne,$subscribe(z,X={}){const le=Cb(C,z,X.detached,()=>$e()),$e=d.run(()=>Et(()=>l.state.value[o],he=>{(X.flush==="sync"?T:f)&&z({storeId:o,type:Sc.direct,events:P},he)},en({},p,X)));return le},$dispose:Z},L=Jt(M);l._s.set(o,L);const R=l._a&&l._a.runWithContext||H5,F=l._e.run(()=>(d=qb(),R(()=>d.run(n))));for(const z in F){const X=F[z];if(eo(X)&&!W5(X)||rn(X))u||(x&&G5(X)&&(eo(X)?X.value=x[z]:x0(X,x[z])),l.state.value[o][z]=X);else if(typeof X=="function"){const le=Y(z,X);F[z]=le,h.actions[z]=X}}return en(L,F),en(Ct(L),F),Object.defineProperty(L,"$state",{get:()=>l.state.value[o],set:z=>{oe(X=>{en(X,z)})}}),l._p.forEach(z=>{en(L,d.run(()=>z({store:L,app:l._a,pinia:l,options:h})))}),x&&u&&s.hydrate&&s.hydrate(L.$state,x),f=!0,T=!0,L}function X5(o,n,s){let l,a;const u=typeof n=="function";typeof o=="string"?(l=o,a=u?s:n):(a=o,l=o.id);function d(h,p){const f=UR();return h=h||(f?ho(qI,null):null),h&&$d(h),h=QI,h._s.has(l)||(u?ZI(l,n,a,h):z5(l,a,h)),h._s.get(l)}return d.$id=l,d}const j5="modulepreload",Y5=function(o){return"/"+o},yb={},K5=function(n,s,l){if(!s||s.length===0)return n();const a=document.getElementsByTagName("link");return Promise.all(s.map(u=>{if(u=Y5(u),u in yb)return;yb[u]=!0;const d=u.endsWith(".css"),h=d?'[rel="stylesheet"]':"";if(!!l)for(let T=a.length-1;T>=0;T--){const C=a[T];if(C.href===u&&(!d||C.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${u}"]${h}`))return;const f=document.createElement("link");if(f.rel=d?"stylesheet":j5,d||(f.as="script",f.crossOrigin=""),f.href=u,document.head.appendChild(f),d)return new Promise((T,C)=>{f.addEventListener("load",T),f.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${u}`)))})})).then(()=>n()).catch(u=>{const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=u,window.dispatchEvent(d),!d.defaultPrevented)throw u})};function Q5(o={}){const{immediate:n=!1,onNeedRefresh:s,onOfflineReady:l,onRegistered:a,onRegisteredSW:u,onRegisterError:d}=o;let h,p,f;const T=async(S=!0)=>{await p,await(f==null?void 0:f())};async function C(){if("serviceWorker"in navigator){const{Workbox:S}=await K5(()=>import("./workbox-window.prod.es5-a7b12eab.js"),[]);h=new S("/sw.js",{scope:"/",type:"classic"}),f=async()=>{await(h==null?void 0:h.messageSkipWaiting())};{let P=!1;const x=()=>{P=!0,h==null||h.addEventListener("controlling",G=>{G.isUpdate&&window.location.reload()}),s==null||s()};h.addEventListener("installed",G=>{typeof G.isUpdate>"u"?typeof G.isExternal<"u"?G.isExternal?x():!P&&(l==null||l()):G.isExternal?window.location.reload():!P&&(l==null||l()):G.isUpdate||l==null||l()}),h.addEventListener("waiting",x),h.addEventListener("externalwaiting",x)}h.register({immediate:n}).then(P=>{u?u("/sw.js",P):a==null||a(P)}).catch(P=>{d==null||d(P)})}}return p=C(),T}(function(){window.__iconpark__=window.__iconpark__||{};var o=JSON.parse('{"991983":{"viewBox":"0 0 24 24","fill":"none","content":""},"991984":{"viewBox":"0 0 24 24","fill":"none","content":""},"991985":{"viewBox":"0 0 24 24","fill":"none","content":""},"991986":{"viewBox":"0 0 24 24","fill":"none","content":""},"991987":{"viewBox":"0 0 24 24","fill":"none","content":""},"991988":{"viewBox":"0 0 24 24","fill":"none","content":""},"991989":{"viewBox":"0 0 24 24","fill":"none","content":""},"991990":{"viewBox":"0 0 24 24","fill":"none","content":""},"991991":{"viewBox":"0 0 24 24","fill":"none","content":""},"991992":{"viewBox":"0 0 24 24","fill":"none","content":""},"991993":{"viewBox":"0 0 24 24","fill":"none","content":""},"991994":{"viewBox":"0 0 24 24","fill":"none","content":""},"991995":{"viewBox":"0 0 24 24","fill":"none","content":""},"991996":{"viewBox":"0 0 24 24","fill":"none","content":""},"992011":{"viewBox":"0 0 24 24","fill":"none","content":""},"995695":{"viewBox":"0 0 24 24","fill":"none","content":""},"995696":{"viewBox":"0 0 24 24","fill":"none","content":""},"995697":{"viewBox":"0 0 24 24","fill":"none","content":""},"995826":{"viewBox":"0 0 48 48","fill":"none","content":""}}');for(var n in o)window.__iconpark__[n]=o[n];var s={variable:991983,color:991984,html:991985,frame:991986,controller:991987,calculation:991988,list:991989,text:991990,css:991991,"php-mysql":991992,"php-basic":991993,echo:991994,cdn:991995,receive:991996,"php-form":992011,"php-file":995695,"php-hash":995696,"php-session":995697,function:995826};for(var l in s)window.__iconpark__[l]=o[s[l]]})();typeof globalThis!="object"&&(Object.prototype.__defineGetter__("__magic__",function(){return this}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__);(()=>{var o={816:(l,a,u)=>{var d,h,p,f;u.d(a,{Vm:()=>et,dy:()=>he,Jb:()=>ke,Ld:()=>re,sY:()=>D,YP:()=>fe});const T=globalThis.trustedTypes,C=T?T.createPolicy("lit-html",{createHTML:xe=>xe}):void 0,S=`lit$${(Math.random()+"").slice(9)}$`,P="?"+S,x=`<${P}>`,G=document,oe=(xe="")=>G.createComment(xe),ne=xe=>xe===null||typeof xe!="object"&&typeof xe!="function",Z=Array.isArray,Y=xe=>{var w;return Z(xe)||typeof((w=xe)===null||w===void 0?void 0:w[Symbol.iterator])=="function"},M=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,L=/-->/g,R=/>/g,F=/>|[ \n\r](?:([^\s"'>=/]+)([ \n\r]*=[ \n\r]*(?:[^ \n\r"'`<>=]|("|')|))|$)/g,z=/'/g,X=/"/g,le=/^(?:script|style|textarea)$/i,$e=xe=>(w,...I)=>({_$litType$:xe,strings:w,values:I}),he=$e(1),fe=$e(2),ke=Symbol.for("lit-noChange"),re=Symbol.for("lit-nothing"),Ie=new WeakMap,D=(xe,w,I)=>{var N,A;const K=(N=I==null?void 0:I.renderBefore)!==null&&N!==void 0?N:w;let U=K._$litPart$;if(U===void 0){const de=(A=I==null?void 0:I.renderBefore)!==null&&A!==void 0?A:null;K._$litPart$=U=new Je(w.insertBefore(oe(),de),de,void 0,I)}return U.I(xe),U},B=G.createTreeWalker(G,129,null,!1),ae=(xe,w)=>{const I=xe.length-1,N=[];let A,K=w===2?"":"");return[C!==void 0?C.createHTML(de):de,N]};class _e{constructor({strings:w,_$litType$:I},N){let A;this.parts=[];let K=0,U=0;const de=w.length-1,Te=this.parts,[se,Ce]=ae(w,I);if(this.el=_e.createElement(se,N),B.currentNode=this.el.content,I===2){const ce=this.el.content,Se=ce.firstChild;Se.remove(),ce.append(...Se.childNodes)}for(;(A=B.nextNode())!==null&&Te.length0){A.textContent=T?T.emptyScript:"";for(let Ne=0;Ne2||N[0]!==""||N[1]!==""?(this.H=Array(N.length-1).fill(re),this.strings=N):this.H=re}get tagName(){return this.element.tagName}I(w,I=this,N,A){const K=this.strings;let U=!1;if(K===void 0)w=Me(this,w,I,0),U=!ne(w)||w!==this.H&&w!==ke,U&&(this.H=w);else{const de=w;let Te,se;for(w=K[0],Te=0;Te{u.r(a),u.d(a,{customElement:()=>d,eventOptions:()=>C,property:()=>p,query:()=>S,queryAll:()=>P,queryAssignedNodes:()=>ne,queryAsync:()=>x,state:()=>f});const d=Z=>Y=>typeof Y=="function"?((M,L)=>(window.customElements.define(M,L),L))(Z,Y):((M,L)=>{const{kind:R,elements:F}=L;return{kind:R,elements:F,finisher(z){window.customElements.define(M,z)}}})(Z,Y),h=(Z,Y)=>Y.kind==="method"&&Y.descriptor&&!("value"in Y.descriptor)?{...Y,finisher(M){M.createProperty(Y.key,Z)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:Y.key,initializer(){typeof Y.initializer=="function"&&(this[Y.key]=Y.initializer.call(this))},finisher(M){M.createProperty(Y.key,Z)}};function p(Z){return(Y,M)=>M!==void 0?((L,R,F)=>{R.constructor.createProperty(F,L)})(Z,Y,M):h(Z,Y)}function f(Z){return p({...Z,state:!0,attribute:!1})}const T=({finisher:Z,descriptor:Y})=>(M,L)=>{var R;if(L===void 0){const F=(R=M.originalKey)!==null&&R!==void 0?R:M.key,z=Y!=null?{kind:"method",placement:"prototype",key:F,descriptor:Y(M.key)}:{...M,key:F};return Z!=null&&(z.finisher=function(X){Z(X,F)}),z}{const F=M.constructor;Y!==void 0&&Object.defineProperty(M,L,Y(L)),Z==null||Z(F,L)}};function C(Z){return T({finisher:(Y,M)=>{Object.assign(Y.prototype[M],Z)}})}function S(Z,Y){return T({descriptor:M=>{const L={get(){var R;return(R=this.renderRoot)===null||R===void 0?void 0:R.querySelector(Z)},enumerable:!0,configurable:!0};if(Y){const R=typeof M=="symbol"?Symbol():"__"+M;L.get=function(){var F;return this[R]===void 0&&(this[R]=(F=this.renderRoot)===null||F===void 0?void 0:F.querySelector(Z)),this[R]}}return L}})}function P(Z){return T({descriptor:Y=>({get(){var M;return(M=this.renderRoot)===null||M===void 0?void 0:M.querySelectorAll(Z)},enumerable:!0,configurable:!0})})}function x(Z){return T({descriptor:Y=>({async get(){var M;return await this.updateComplete,(M=this.renderRoot)===null||M===void 0?void 0:M.querySelector(Z)},enumerable:!0,configurable:!0})})}const G=Element.prototype,oe=G.msMatchesSelector||G.webkitMatchesSelector;function ne(Z="",Y=!1,M=""){return T({descriptor:L=>({get(){var R,F;const z="slot"+(Z?`[name=${Z}]`:":not([name])");let X=(F=(R=this.renderRoot)===null||R===void 0?void 0:R.querySelector(z))===null||F===void 0?void 0:F.assignedNodes({flatten:Y});return X&&M&&(X=X.filter(le=>le.nodeType===Node.ELEMENT_NODE&&(le.matches?le.matches(M):oe.call(le,M)))),X},enumerable:!0,configurable:!0})})}},23:(l,a,u)=>{u.r(a),u.d(a,{unsafeSVG:()=>T});const d=C=>(...S)=>({_$litDirective$:C,values:S});var h=u(816);class p extends class{constructor(S){}T(S,P,x){this.Σdt=S,this.M=P,this.Σct=x}S(S,P){return this.update(S,P)}update(S,P){return this.render(...P)}}{constructor(S){if(super(S),this.vt=h.Ld,S.type!==2)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(S){if(S===h.Ld)return this.Vt=void 0,this.vt=S;if(S===h.Jb)return S;if(typeof S!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(S===this.vt)return this.Vt;this.vt=S;const P=[S];return P.raw=P,this.Vt={_$litType$:this.constructor.resultType,strings:P,values:[]}}}p.directiveName="unsafeHTML",p.resultType=1;class f extends p{}f.directiveName="unsafeSVG",f.resultType=2;const T=d(f)},249:(l,a,u)=>{u.r(a),u.d(a,{CSSResult:()=>f,LitElement:()=>ke,ReactiveElement:()=>R,UpdatingElement:()=>fe,_Σ:()=>d.Vm,_Φ:()=>re,adoptStyles:()=>P,css:()=>S,defaultConverter:()=>Y,getCompatibleStyle:()=>x,html:()=>d.dy,noChange:()=>d.Jb,notEqual:()=>M,nothing:()=>d.Ld,render:()=>d.sY,supportsAdoptingStyleSheets:()=>h,svg:()=>d.YP,unsafeCSS:()=>T});var d=u(816);const h=window.ShadowRoot&&(window.ShadyCSS===void 0||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,p=Symbol();class f{constructor(D,B){if(B!==p)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=D}get styleSheet(){return h&&this.t===void 0&&(this.t=new CSSStyleSheet,this.t.replaceSync(this.cssText)),this.t}toString(){return this.cssText}}const T=Ie=>new f(Ie+"",p),C=new Map,S=(Ie,...D)=>{const B=D.reduce((_e,Me,Xe)=>_e+(Je=>{if(Je instanceof f)return Je.cssText;if(typeof Je=="number")return Je;throw Error(`Value passed to 'css' function must be a 'css' function result: ${Je}. Use 'unsafeCSS' to pass non-literal values, but
+ take care to ensure page security.`)})(Me)+Ie[Xe+1],Ie[0]);let ae=C.get(B);return ae===void 0&&C.set(B,ae=new f(B,p)),ae},P=(Ie,D)=>{h?Ie.adoptedStyleSheets=D.map(B=>B instanceof CSSStyleSheet?B:B.styleSheet):D.forEach(B=>{const ae=document.createElement("style");ae.textContent=B.cssText,Ie.appendChild(ae)})},x=h?Ie=>Ie:Ie=>Ie instanceof CSSStyleSheet?(D=>{let B="";for(const ae of D.cssRules)B+=ae.cssText;return T(B)})(Ie):Ie;var G,oe,ne,Z;const Y={toAttribute(Ie,D){switch(D){case Boolean:Ie=Ie?"":null;break;case Object:case Array:Ie=Ie==null?Ie:JSON.stringify(Ie)}return Ie},fromAttribute(Ie,D){let B=Ie;switch(D){case Boolean:B=Ie!==null;break;case Number:B=Ie===null?null:Number(Ie);break;case Object:case Array:try{B=JSON.parse(Ie)}catch{B=null}}return B}},M=(Ie,D)=>D!==Ie&&(D==D||Ie==Ie),L={attribute:!0,type:String,converter:Y,reflect:!1,hasChanged:M};class R extends HTMLElement{constructor(){super(),this.Πi=new Map,this.Πo=void 0,this.Πl=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this.Πh=null,this.u()}static addInitializer(D){var B;(B=this.v)!==null&&B!==void 0||(this.v=[]),this.v.push(D)}static get observedAttributes(){this.finalize();const D=[];return this.elementProperties.forEach((B,ae)=>{const _e=this.Πp(ae,B);_e!==void 0&&(this.Πm.set(_e,ae),D.push(_e))}),D}static createProperty(D,B=L){if(B.state&&(B.attribute=!1),this.finalize(),this.elementProperties.set(D,B),!B.noAccessor&&!this.prototype.hasOwnProperty(D)){const ae=typeof D=="symbol"?Symbol():"__"+D,_e=this.getPropertyDescriptor(D,ae,B);_e!==void 0&&Object.defineProperty(this.prototype,D,_e)}}static getPropertyDescriptor(D,B,ae){return{get(){return this[B]},set(_e){const Me=this[D];this[B]=_e,this.requestUpdate(D,Me,ae)},configurable:!0,enumerable:!0}}static getPropertyOptions(D){return this.elementProperties.get(D)||L}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const D=Object.getPrototypeOf(this);if(D.finalize(),this.elementProperties=new Map(D.elementProperties),this.Πm=new Map,this.hasOwnProperty("properties")){const B=this.properties,ae=[...Object.getOwnPropertyNames(B),...Object.getOwnPropertySymbols(B)];for(const _e of ae)this.createProperty(_e,B[_e])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(D){const B=[];if(Array.isArray(D)){const ae=new Set(D.flat(1/0).reverse());for(const _e of ae)B.unshift(x(_e))}else D!==void 0&&B.push(x(D));return B}static Πp(D,B){const ae=B.attribute;return ae===!1?void 0:typeof ae=="string"?ae:typeof D=="string"?D.toLowerCase():void 0}u(){var D;this.Πg=new Promise(B=>this.enableUpdating=B),this.L=new Map,this.Π_(),this.requestUpdate(),(D=this.constructor.v)===null||D===void 0||D.forEach(B=>B(this))}addController(D){var B,ae;((B=this.ΠU)!==null&&B!==void 0?B:this.ΠU=[]).push(D),this.renderRoot!==void 0&&this.isConnected&&((ae=D.hostConnected)===null||ae===void 0||ae.call(D))}removeController(D){var B;(B=this.ΠU)===null||B===void 0||B.splice(this.ΠU.indexOf(D)>>>0,1)}Π_(){this.constructor.elementProperties.forEach((D,B)=>{this.hasOwnProperty(B)&&(this.Πi.set(B,this[B]),delete this[B])})}createRenderRoot(){var D;const B=(D=this.shadowRoot)!==null&&D!==void 0?D:this.attachShadow(this.constructor.shadowRootOptions);return P(B,this.constructor.elementStyles),B}connectedCallback(){var D;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(D=this.ΠU)===null||D===void 0||D.forEach(B=>{var ae;return(ae=B.hostConnected)===null||ae===void 0?void 0:ae.call(B)}),this.Πl&&(this.Πl(),this.Πo=this.Πl=void 0)}enableUpdating(D){}disconnectedCallback(){var D;(D=this.ΠU)===null||D===void 0||D.forEach(B=>{var ae;return(ae=B.hostDisconnected)===null||ae===void 0?void 0:ae.call(B)}),this.Πo=new Promise(B=>this.Πl=B)}attributeChangedCallback(D,B,ae){this.K(D,ae)}Πj(D,B,ae=L){var _e,Me;const Xe=this.constructor.Πp(D,ae);if(Xe!==void 0&&ae.reflect===!0){const Je=((Me=(_e=ae.converter)===null||_e===void 0?void 0:_e.toAttribute)!==null&&Me!==void 0?Me:Y.toAttribute)(B,ae.type);this.Πh=D,Je==null?this.removeAttribute(Xe):this.setAttribute(Xe,Je),this.Πh=null}}K(D,B){var ae,_e,Me;const Xe=this.constructor,Je=Xe.Πm.get(D);if(Je!==void 0&&this.Πh!==Je){const we=Xe.getPropertyOptions(Je),We=we.converter,Ze=(Me=(_e=(ae=We)===null||ae===void 0?void 0:ae.fromAttribute)!==null&&_e!==void 0?_e:typeof We=="function"?We:null)!==null&&Me!==void 0?Me:Y.fromAttribute;this.Πh=Je,this[Je]=Ze(B,we.type),this.Πh=null}}requestUpdate(D,B,ae){let _e=!0;D!==void 0&&(((ae=ae||this.constructor.getPropertyOptions(D)).hasChanged||M)(this[D],B)?(this.L.has(D)||this.L.set(D,B),ae.reflect===!0&&this.Πh!==D&&(this.Πk===void 0&&(this.Πk=new Map),this.Πk.set(D,ae))):_e=!1),!this.isUpdatePending&&_e&&(this.Πg=this.Πq())}async Πq(){this.isUpdatePending=!0;try{for(await this.Πg;this.Πo;)await this.Πo}catch(B){Promise.reject(B)}const D=this.performUpdate();return D!=null&&await D,!this.isUpdatePending}performUpdate(){var D;if(!this.isUpdatePending)return;this.hasUpdated,this.Πi&&(this.Πi.forEach((_e,Me)=>this[Me]=_e),this.Πi=void 0);let B=!1;const ae=this.L;try{B=this.shouldUpdate(ae),B?(this.willUpdate(ae),(D=this.ΠU)===null||D===void 0||D.forEach(_e=>{var Me;return(Me=_e.hostUpdate)===null||Me===void 0?void 0:Me.call(_e)}),this.update(ae)):this.Π$()}catch(_e){throw B=!1,this.Π$(),_e}B&&this.E(ae)}willUpdate(D){}E(D){var B;(B=this.ΠU)===null||B===void 0||B.forEach(ae=>{var _e;return(_e=ae.hostUpdated)===null||_e===void 0?void 0:_e.call(ae)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(D)),this.updated(D)}Π$(){this.L=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this.Πg}shouldUpdate(D){return!0}update(D){this.Πk!==void 0&&(this.Πk.forEach((B,ae)=>this.Πj(ae,this[ae],B)),this.Πk=void 0),this.Π$()}updated(D){}firstUpdated(D){}}var F,z,X,le,$e,he;R.finalized=!0,R.shadowRootOptions={mode:"open"},(oe=(G=globalThis).reactiveElementPlatformSupport)===null||oe===void 0||oe.call(G,{ReactiveElement:R}),((ne=(Z=globalThis).reactiveElementVersions)!==null&&ne!==void 0?ne:Z.reactiveElementVersions=[]).push("1.0.0-rc.1");const fe=R;((F=(he=globalThis).litElementVersions)!==null&&F!==void 0?F:he.litElementVersions=[]).push("3.0.0-rc.1");class ke extends R{constructor(){super(...arguments),this.renderOptions={host:this},this.Φt=void 0}createRenderRoot(){var D,B;const ae=super.createRenderRoot();return(D=(B=this.renderOptions).renderBefore)!==null&&D!==void 0||(B.renderBefore=ae.firstChild),ae}update(D){const B=this.render();super.update(D),this.Φt=(0,d.sY)(B,this.renderRoot,this.renderOptions)}connectedCallback(){var D;super.connectedCallback(),(D=this.Φt)===null||D===void 0||D.setConnected(!0)}disconnectedCallback(){var D;super.disconnectedCallback(),(D=this.Φt)===null||D===void 0||D.setConnected(!1)}render(){return d.Jb}}ke.finalized=!0,ke._$litElement$=!0,(X=(z=globalThis).litElementHydrateSupport)===null||X===void 0||X.call(z,{LitElement:ke}),($e=(le=globalThis).litElementPlatformSupport)===null||$e===void 0||$e.call(le,{LitElement:ke});const re={K:(Ie,D,B)=>{Ie.K(D,B)},L:Ie=>Ie.L}},409:function(l,a,u){var d=this&&this.__decorate||function(P,x,G,oe){var ne,Z=arguments.length,Y=Z<3?x:oe===null?oe=Object.getOwnPropertyDescriptor(x,G):oe;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Y=Reflect.decorate(P,x,G,oe);else for(var M=P.length-1;M>=0;M--)(ne=P[M])&&(Y=(Z<3?ne(Y):Z>3?ne(x,G,Y):ne(x,G))||Y);return Z>3&&Y&&Object.defineProperty(x,G,Y),Y};Object.defineProperty(a,"__esModule",{value:!0}),a.IconparkIconElement=void 0;const h=u(249),p=u(26),f=u(23),T={color:1,fill:1,stroke:1},C={STROKE:{trackAttr:"data-follow-stroke",rawAttr:"stroke"},FILL:{trackAttr:"data-follow-fill",rawAttr:"fill"}};class S extends h.LitElement{constructor(){super(...arguments),this.name="",this.identifyer="",this.size="1em"}get _width(){return this.width||this.size}get _height(){return this.height||this.size}get _stroke(){return this.stroke||this.color}get _fill(){return this.fill||this.color}get SVGConfig(){return(window.__iconpark__||{})[this.identifyer]||(window.__iconpark__||{})[this.name]||{viewBox:"0 0 0 0",content:""}}connectedCallback(){super.connectedCallback(),setTimeout(()=>{this.monkeyPatch("STROKE",!0),this.monkeyPatch("FILL",!0)})}monkeyPatch(x,G){switch(x){case"STROKE":this.updateDOMByHand(this.strokeAppliedNodes,"STROKE",this._stroke,!!G);break;case"FILL":this.updateDOMByHand(this.fillAppliedNodes,"FILL",this._fill,!!G)}}updateDOMByHand(x,G,oe,ne){!oe&&ne||x&&x.forEach(Z=>{oe&&oe===Z.getAttribute(C[G].rawAttr)||Z.setAttribute(C[G].rawAttr,oe||Z.getAttribute(C[G].trackAttr))})}attributeChangedCallback(x,G,oe){super.attributeChangedCallback(x,G,oe),x==="name"||x==="identifyer"?setTimeout(()=>{this.monkeyPatch("STROKE"),this.monkeyPatch("FILL")}):T[x]&&(this.monkeyPatch("STROKE"),this.monkeyPatch("FILL"))}render(){return h.svg``}}S.styles=h.css`:host {display: inline-flex; align-items: center; justify-content: center;} :host([spin]) svg {animation: iconpark-spin 1s infinite linear;} :host([spin][rtl]) svg {animation: iconpark-spin-rtl 1s infinite linear;} :host([rtl]) svg {transform: scaleX(-1);} @keyframes iconpark-spin {0% { -webkit-transform: rotate(0); transform: rotate(0);} 100% {-webkit-transform: rotate(360deg); transform: rotate(360deg);}} @keyframes iconpark-spin-rtl {0% {-webkit-transform: scaleX(-1) rotate(0); transform: scaleX(-1) rotate(0);} 100% {-webkit-transform: scaleX(-1) rotate(360deg); transform: scaleX(-1) rotate(360deg);}}`,d([p.property({reflect:!0})],S.prototype,"name",void 0),d([p.property({reflect:!0,attribute:"icon-id"})],S.prototype,"identifyer",void 0),d([p.property({reflect:!0})],S.prototype,"color",void 0),d([p.property({reflect:!0})],S.prototype,"stroke",void 0),d([p.property({reflect:!0})],S.prototype,"fill",void 0),d([p.property({reflect:!0})],S.prototype,"size",void 0),d([p.property({reflect:!0})],S.prototype,"width",void 0),d([p.property({reflect:!0})],S.prototype,"height",void 0),d([p.queryAll(`[${C.STROKE.trackAttr}]`)],S.prototype,"strokeAppliedNodes",void 0),d([p.queryAll(`[${C.FILL.trackAttr}]`)],S.prototype,"fillAppliedNodes",void 0),a.IconparkIconElement=S,customElements.get("iconpark-icon")||customElements.define("iconpark-icon",S)}},n={};function s(l){var a=n[l];if(a!==void 0)return a.exports;var u=n[l]={exports:{}};return o[l].call(u.exports,u,u.exports,s),u.exports}s.d=(l,a)=>{for(var u in a)s.o(a,u)&&!s.o(l,u)&&Object.defineProperty(l,u,{enumerable:!0,get:a[u]})},s.o=(l,a)=>Object.prototype.hasOwnProperty.call(l,a),s.r=l=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(l,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(l,"__esModule",{value:!0})},s(409)})();var e2={exports:{}},s0={exports:{}},i0={exports:{}},n0={exports:{}},r0={exports:{}},Sb;function _d(){return Sb||(Sb=1,function(o,n){(function(s,l){o.exports=l()})(Do,function(){var s={},l,a,u,d,h,p,f,T,C,S,P,x,G,oe,ne,Z,Y,M,L,R,F,z,X,le,$e,he,fe,ke,re,Ie,D,B,ae,_e,Me,Xe,Je,we,We,Ze,nt,ht,et,xe,w,I,N,A,K,U,de,Te,se,Ce,ce,Se,Ne,He,be,ee,ie,ue,ye,E,g,k,W,J,Ee,ze,yt,ls,ii,xt,Qo,Ht,ws,qo,b,O,_,m,y,V,ve,Ge,rt,Mt,po,Be,wt,Dt,bl,Ai,pn,vl,cs,gd,Il,Ag,fd,Ms,Li,md,Td,Wc,Ed,$n,zc,bd,vd,Lg,Ng,Id,cr,Ds,Od,Cd,yd,Sd,Rd,wg,kd,Ol,Mg,Dg,Ni,Ad,Ps,Pg,xg,Bg,wi,Ld,Fg,Ug,Hg,Vg,Gg,Nd,Wg,zg,Xc,Xg,jg,wd,jc,Yg,xs,Kg,Qg,qg,Jg,Zg,ef,tf,Md,_n,Cl,Dd,of,sf,nf,rf,lf,cf,af,uf,Pd,df,Mi,hf,pf,$f,ar,xd,ur,Bd,Fd,Ud,dr,Yc,Kc,_f,yl,Hd,Vd,Gd,Wd,zd,Xd,gf,Sl,jd,hr,Qc,fs,Yd,Kd,ff,Rl,Qd,qd,mf,qc,Jd,Tf,Ef,bf,vf,If,pr,Zd,eh,kl,th,Of,Cf,oh,sh,ni,ih,nh,yf,Sf,Rf,kf,rh,Af,lh,Lf,Di,Al,Jc,Zc,gn,ch,ea,ah,Zt,ta,$r,fn,Nf,uh,oa,as,dh,sa,hh,ph,wf,Mf,Df,$h,Jo,Pf,xf,ms,Xt,Bf,Ff,_h,ri,ia,Uf,Ll,na,Hf,ra,Vf,la,gh,fh,Gf,mh,ca,Wf,zf,Xf,Th,aa,Eh,ua,jf,da,Yf,Kf,Po,tt,xo,To,jt,Bs,_r,je,oo,bh,Qf,vh,Ih,Oh,Ch,yh,gr,fr,Sh,qf,ha,Rh,Nl,Jf,kh,pa,Zf,em,Ah,wl,tm,om,sm,im,Ml,Lh,Nh,wh,nm,Dl,Mh,mr,rm,Dh,Ph,xh,Bh,Fh,Uh,Hh,Vh,$a,Pl,Gh,lm,Wh,zh,Xh,jh,Yh,Kh,Qh,cm,qh,Pi,_a,ga,Jh,am,Zh,fa,ep,tp,um,op,dm,sp,ip,np,ma,rp,Ta,Ea,ba,hm,pm,$m,_m,gm,fm,mm,Tm,lp,cp,ap,up,Em,bm,dp,hp,pp,$p,_p,gp,fp,mp,vm,Im,st;l=function(e,t,i,r){if(!(e instanceof Ae)&&typeof e!="string"||`${e}`.trim()==="")throw Error('Invalid type "'+e+'". The type must be a non-empty string or a Blockly.registry.Type.');if(e=`${e}`.toLowerCase(),typeof t!="string"||t.trim()==="")throw Error('Invalid name "'+t+'". The name must be a non-empty string.');const c=t.toLowerCase();if(!i)throw Error("Can not register a null value");let $=xi[e],v=va[e];if($||($=xi[e]=Object.create(null),v=va[e]=Object.create(null)),a(e,i),!r&&$[c])throw Error('Name "'+c+'" with type "'+e+'" already registered.');$[c]=i,v[c]=t},a=function(e,t){switch(e){case String(Ae.FIELD):if(typeof t.fromJson!="function")throw Error('Type "'+e+'" must have a fromJson function')}},u=function(e,t){e=`${e}`.toLowerCase(),t=t.toLowerCase();const i=xi[e];i&&i[t]?(delete xi[e][t],delete va[e][t]):console.warn("Unable to unregister ["+t+"]["+e+"] from the registry.")},d=function(e,t,i){e=`${e}`.toLowerCase(),t=t.toLowerCase();const r=xi[e];if(!r||!r[t]){if(t="Unable to find ["+t+"]["+e+"] in the registry.",i)throw Error(t+" You must require or register a "+e+" plugin.");return console.warn(t),null}return r[t]},h=function(e,t){return e=`${e}`.toLowerCase(),t=t.toLowerCase(),(e=xi[e])?!!e[t]:!1},p=function(e,t,i){return d(e,t,i)},f=function(e,t,i){return d(e,t,i)},T=function(e,t,i){e=`${e}`.toLowerCase();var r=xi[e];if(!r){if(r=`Unable to find [${e}] in the registry.`,i)throw Error(`${r} You must require or register a ${e} plugin.`);return console.warn(r),null}if(!t)return r;e=va[e],i=Object.create(null);for(const c of Object.keys(r))i[e[c]]=r[c];return i},C=function(e,t,i){return t=t.plugins[String(e)]||li,typeof t=="function"?t:p(e,t,i)},S=function(e){return xl[e]||null},P=function(){const e=[];for(const t in xl)e.push(xl[t]);return e},x=function(e){xl[e.id]=e},G=function(e){delete xl[e.id]},oe=function(){return Om},ne=function(e){Om=e},Z=function(){return Cm},Y=function(e){Cm=e},M=function(){return ym},L=function(e){ym=e},R=function(e){for(;e.options.parentWorkspace;)e=e.options.parentWorkspace;const t=e.getParentSvg(),i=e.getCachedParentSvgSize();var r=t.parentElement;if(r instanceof HTMLElement){var c=r.offsetWidth;r=r.offsetHeight,i.width!==c&&(t.setAttribute("width",c+"px"),e.setCachedParentSvgSize(c,null)),i.height!==r&&(t.setAttribute("height",r+"px"),e.setCachedParentSvgSize(null,r)),e.resize()}},F=function(e,t){const i=Object.create(null),r=e.getDescendants(!0);t&&(e=e.getNextBlock())&&(e=r.indexOf(e),r.splice(e,r.length-e));for(let c=0,$;$=r[c];c++)i[$.type]?i[$.type]++:i[$.type]=1;return i},z=function(e){return function(){this.jsonInit(e)}},X=function(e){Sm.defineBlocksWithJsonArrayInternal(e)},le=function(e){s.defineBlocks$$module$build$src$core$common(s.createBlockDefinitionsFromJsonArray$$module$build$src$core$common(e))},s.createBlockDefinitionsFromJsonArray$$module$build$src$core$common=function(e){const t={};for(let i=0;i{setTimeout(D,0)})}catch{setTimeout(D,0)}vn.push(e)}},D=function(){var e=B(vn,!0);vn.length=0;for(let i=0,r;r=e[i];i++)if(r.workspaceId){var t=S(r.workspaceId);t&&t.fireChangeListener(r)}e=new Set(e.map(i=>i.workspaceId));for(const i of e){if(!i||(e=S(i),!e))continue;e=e.getUndoStack();let r;for(t=e.length;0`${t.charCodeAt(0)};`)},xe=function(e,t,i,r){e=e+" was deprecated in "+t+" and will be deleted in "+i+".",r&&(e+=`
+Use `+r+" instead."),console.warn(e)},w=function(e,t,i){e=document.createElementNS(Aa,`${e}`);for(const r in t)e.setAttribute(r,`${t[r]}`);return i&&i.appendChild(e),e},I=function(e,t){return t=t.split(" "),t.every(i=>e.classList.contains(i))?!1:(e.classList.add(...t),!0)},N=function(e,t){e.classList.remove(...t.split(" "))},A=function(e,t){return t=t.split(" "),t.every(i=>!e.classList.contains(i))?!1:(e.classList.remove(...t),!0)},K=function(e,t){return e.classList.contains(t)},U=function(e){return e&&e.parentNode?e.parentNode.removeChild(e):null},de=function(e,t){const i=t.nextSibling;if(t=t.parentNode,!t)throw Error("Reference node has no parent.");i?t.insertBefore(e,i):t.appendChild(e)},Te=function(e,t){return xe("Blockly.utils.dom.containsNode","version 10","version 11",'Use native "contains" DOM method'),e.contains(t)},se=function(e,t){e.style.transform=t,e.style["-webkit-transform"]=t},Ce=function(){bp++,Es||(Es=Object.create(null))},ce=function(){bp--,bp||(Es=null)},Se=function(e){const t=e.textContent+`
+`+e.className.baseVal;let i;if(Es&&(i=Es[t]))return i;try{i=e.getComputedTextLength()}catch{return 8*e.textContent.length}return Es&&(Es[t]=i),i},Ne=function(e,t,i,r){return He(e,t+"pt",i,r)},He=function(e,t,i,r){const c=e.textContent;e=c+`
+`+e.className.baseVal;var $;return Es&&($=Es[e])||(La||($=document.createElement("canvas"),$.className="blocklyComputeCanvas",document.body.appendChild($),La=$.getContext("2d")),La.font=i+" "+t+" "+r,$=c?La.measureText(c).width:0,Es&&(Es[e]=$)),$},be=function(e,t,i,r){const c=document.createElement("span");c.style.font=i+" "+t+" "+r,c.textContent=e,e=document.createElement("div"),e.style.width="1px",e.style.height="0",t=document.createElement("div"),t.setAttribute("style","position: fixed; top: 0; left: 0; display: flex;"),t.appendChild(c),t.appendChild(e),document.body.appendChild(t),i={height:0,baseline:0};try{t.style.alignItems="baseline",i.baseline=e.offsetTop-c.offsetTop,t.style.alignItems="flex-end",i.height=e.offsetTop-c.offsetTop}finally{document.body.removeChild(t)}return i},ee=function(e,t){Lm(e,t)},ie=function(e){Lm=e},ue=function(e,t){Mm.confirmInternal(e,t)},ye=function(e,t){Nm(e,t)},E=function(e){Nm=e},g=function(e,t,i){wm(e,t,i)},k=function(e){wm=e},W=function(e){return e.getVariableModel!==void 0},J=function(e){return e.getProcedureDef!==void 0},Ee=function(e){return e.getProcedureCall!==void 0&&e.renameProcedure!==void 0},s.allUsedVarModels$$module$build$src$core$variables=function(e){e=e.getAllBlocks(!1);const t=new Set;for(let i=0;i1'),r.appendChild(i),t.push(r)),Fo.variables_get){e.sort(Hl.compareByName);for(let c=0,$;$=e[c];c++)i=s.createElement$$module$build$src$core$utils$xml("block"),i.setAttribute("type","variables_get"),i.setAttribute("gap","8"),i.appendChild(s.generateVariableFieldDom$$module$build$src$core$variables($)),t.push(i)}}return t},ls=function(e){return Dm.generateUniqueNameInternal(e)},ii=function(e){return xt(Cp.charAt(0),e.getAllVariableNames())},xt=function(e,t){if(!t.length)return e;const i=Cp;let r="",c=i.indexOf(e);for(;;){let $=!1;for(let v=0;v$.getVariableModel().name);if(r&&(i=r.some($=>$.toLowerCase()===e),r=r.some($=>$.toLowerCase()===t),i&&r))return c.getName()}return null},_=function(e,t,i){e=e.toLowerCase(),t=t.toLowerCase(),i=i.getAllBlocks(!1);for(const c of i){if(!J(c))continue;i=c.getProcedureDef();var r=i[1];const $=r.some(v=>v.toLowerCase()===e);if(r=r.some(v=>v.toLowerCase()===t),$&&r)return i[0]}return null},s.generateVariableFieldDom$$module$build$src$core$variables=function(e){const t=s.createElement$$module$build$src$core$utils$xml("field");return t.setAttribute("name","VAR"),t.setAttribute("id",e.getId()),t.setAttribute("variabletype",e.type),e=s.createTextNode$$module$build$src$core$utils$xml(e.name),t.appendChild(e),t},s.getOrCreateVariablePackage$$module$build$src$core$variables=function(e,t,i,r){let c=s.getVariable$$module$build$src$core$variables(e,t,i,r);return c||(c=m(e,t,i,r)),c},s.getVariable$$module$build$src$core$variables=function(e,t,i,r){const c=e.getPotentialVariableMap();let $=null;if(t&&($=e.getVariableById(t),!$&&c&&($=c.getVariableById(t)),$))return $;if(i){if(r===void 0)throw Error("Tried to look up a variable by name without a type");$=e.getVariable(i,r),!$&&c&&($=c.getVariable(i,r))}return $},m=function(e,t,i,r){const c=e.getPotentialVariableMap();return i||(i=ls(e.isFlyout?e.targetWorkspace:e)),c?c.createVariable(i,r,t):e.createVariable(i,r,t)},y=function(e,t){e=e.getAllVariables();const i=[];if(t.length!==e.length)for(let r=0;r>>/g,e),wp="",e=document.createElement("style"),e.id="blockly-common-style",t=document.createTextNode(t),e.appendChild(t),document.head.insertBefore(e,document.head.firstChild)))},Il=function(e){return Xm.getSizeInternal(e)},Ag=function(e){if(Ms(e,"display")!=="none")return fd(e);const t=e.style,i=t.display,r=t.visibility,c=t.position;t.visibility="hidden",t.position="absolute",t.display="inline";const $=e.offsetWidth;return e=e.offsetHeight,t.display=i,t.position=c,t.visibility=r,new Vt($,e)},fd=function(e){return new Vt(e.offsetWidth,e.offsetHeight)},Ms=function(e,t){return e=window.getComputedStyle(e),e[t]||e.getPropertyValue(t)},Li=function(e){const t=new Ue(0,0);e=e.getBoundingClientRect();var i=document.documentElement;return i=new Ue(window.pageXOffset||i.scrollLeft,window.pageYOffset||i.scrollTop),t.x=e.left+i.x,t.y=e.top+i.y,t},md=function(){const e=document.body,t=document.documentElement;return new Ue(e.scrollLeft||t.scrollLeft,e.scrollTop||t.scrollTop)},Td=function(e){const t=parseFloat(Ms(e,"borderLeftWidth")),i=parseFloat(Ms(e,"borderRightWidth")),r=parseFloat(Ms(e,"borderTopWidth"));return e=parseFloat(Ms(e,"borderBottomWidth")),new Bt(r,e,t,i)},Wc=function(e,t,i){e=Ed(e,t,i),t.scrollLeft=e.x,t.scrollTop=e.y},Ed=function(e,t,i){var r=Li(e),c=Li(t),$=Td(t);const v=r.x-c.x-$.left;return r=r.y-c.y-$.top,c=fd(e),e=t.clientWidth-c.width,c=t.clientHeight-c.height,$=t.scrollLeft,t=t.scrollTop,i?($+=v-e/2,t+=r-c/2):($+=Math.min(v,Math.max(v-e,0)),t+=Math.min(r,Math.max(r-c,0))),new Ue($,t)},$n=function(e){const t=new Ue(0,0);var i=e.x&&e.getAttribute("x");const r=e.y&&e.getAttribute("y");return i&&(t.x=parseInt(i)),r&&(t.y=parseInt(r)),(i=(i=e.getAttribute("transform"))&&i.match(jm))&&(t.x+=Number(i[1]),i[3]&&(t.y+=Number(i[3]))),(e=e.getAttribute("style"))&&-1{Dp=t,Km=window.requestAnimationFrame(()=>{Cd(),t()})})),Ar},cr=function(){return Ar||Promise.resolve()},Ds=function(){window.cancelAnimationFrame(Km),Cd(),Dp&&Dp()},Od=function(e){Ua.add(e);const t=e.getParent();t?Od(t):Fa.add(e)},Cd=function(){const e=new Set([...Fa].map(t=>t.workspace));for(const t of Fa){if(t.isDisposed()||t.getParent())continue;yd(t);const i=t.getRelativeToSurfaceXY();Sd(t,i),Rd(t,i)}for(const t of e)t.resizeContents();Fa.clear(),Ua=new Set,Ar=null},yd=function(e){if(Ua.has(e)){for(const t of e.getChildren(!1))yd(t);e.renderEfficiently()}},Sd=function(e,t){for(const i of e.getConnections_(!1)){e=i.moveToOffset(t);const r=i.targetBlock();i.isSuperior()&&r&&(e||Ua.has(r))&&Sd(r,Ue.sum(t,r.relativeCoords))}},Rd=function(e,t){if(e.getIcons){for(const i of e.getIcons())i.onLocationChange(t);for(const i of e.getChildren(!1))Rd(i,Ue.sum(t,i.relativeCoords))}},wg=function(e,t){const i=s.createElement$$module$build$src$core$utils$xml("xml");var r=kd(s.allUsedVarModels$$module$build$src$core$variables(e));r.hasChildNodes()&&i.appendChild(r),r=e.getTopComments(!0);for(let c=0;c/g,"<$1$2>$1>")},Pg=function(e){e=Ps(e).split("<");let t="";for(let i=1;i"&&(t+=" ")}return e=e.join(`
+`),e=e.replace(/(<(\w+)\b[^>]*>[^\n]*)\n *<\/\2>/g,"$1$2>"),e.replace(/^\n/,"")},xg=function(e,t){return t.setResizesEnabled(!1),t.clear(),e=s.domToWorkspace$$module$build$src$core$xml(e,t),t.setResizesEnabled(!0),e},s.domToWorkspace$$module$build$src$core$xml=function(e,t){let i=0;t.RTL&&(i=t.getWidth());const r=[];Ce();const c=s.getGroup$$module$build$src$core$events$utils();c||s.setGroup$$module$build$src$core$events$utils(!0),t.setResizesEnabled&&t.setResizesEnabled(!1);let $=!0;try{for(let v=0,H;H=e.childNodes[v];v++){const Oe=H.nodeName.toLowerCase(),Qe=H;if(Oe==="block"||Oe==="shadow"&&!ke()){const qt=wi(Qe,t);r.push(qt.id);let Ft;const Go=parseInt((Ft=Qe.getAttribute("x"))!=null?Ft:"10",10);let Jr;const Zr=parseInt((Jr=Qe.getAttribute("y"))!=null?Jr:"10",10);isNaN(Go)||isNaN(Zr)||qt.moveBy(t.RTL?i-Go:Go,Zr,["create"]),$=!1}else{if(Oe==="shadow")throw TypeError("Shadow block cannot be a top-level block.");if(Oe==="comment")t.rendered?yo.fromXmlRendered(Qe,t,i):Hs.fromXml(Qe,t);else if(Oe==="variables"){if($)Ld(Qe,t);else throw Error("'variables' tag must exist once before block and shadow tag elements in the workspace XML, but it was found in another location.");$=!1}}}}finally{s.setGroup$$module$build$src$core$events$utils(c),t.setResizesEnabled&&t.setResizesEnabled(!0),t.rendered&&Ds(),ce()}return re(new(we(bn))(t)),r},Bg=function(e,t){if(!t.getBlocksBoundingBox)return s.domToWorkspace$$module$build$src$core$xml(e,t);var i=t.getBlocksBoundingBox();if(e=s.domToWorkspace$$module$build$src$core$xml(e,t),i&&i.top!==i.bottom){var r=i.bottom;i=t.RTL?i.right:i.left;var c=1/0;let $=-1/0,v=1/0;for(let H=0;H$&&($=Oe.x)}for(r=r-v+10,i=t.RTL?i-$:i-c,c=0;cQe.setBubbleVisible($),1)}},Vg=function(e,t){for(let i=0;i{v.disposed||v.setConnectionTracking(!0)},1),v},Dd=function(e,t,{parentConnection:i,isShadow:r=!1}={}){if(!e.type)throw new Qm(e);const c=t.newBlock(e.type,e.id);return c.setShadow(r),of(c,e),sf(c,e),nf(c,e),rf(i,c,e),lf(c,e),cf(c,e),af(c,e),uf(c,e),df(c,t.rendered),c},of=function(e,t){let i=t.x===void 0?0:t.x;t=t.y===void 0?0:t.y;const r=e.workspace;i=r.RTL?r.getWidth()-i:i,e.moveBy(i,t)},sf=function(e,t){t.collapsed&&e.setCollapsed(!0),t.deletable===!1&&e.setDeletable(!1),t.movable===!1&&e.setMovable(!1),t.editable===!1&&e.setEditable(!1),t.enabled===!1&&e.setEnabled(!1),t.inline!==void 0&&e.setInputsInline(t.inline),t.data!==void 0&&(e.data=t.data)},nf=function(e,t){t.extraState&&(e.loadExtraState?e.loadExtraState(t.extraState):e.domToMutation&&e.domToMutation(s.textToDom$$module$build$src$core$utils$xml(t.extraState)))},rf=function(e,t,i){if(e){if(e.getSourceBlock().isShadow()&&!t.isShadow())throw new Jm(i);if(e.type===s.inputTypes$$module$build$src$core$inputs$input_types.VALUE){var r=t.outputConnection;if(!r)throw new Vl("output",t,i)}else if(r=t.previousConnection,!r)throw new Vl("previous",t,i);if(!e.connect(r)){const c=t.workspace.connectionChecker;throw new qm(c.getErrorMessage(c.canConnectWithReason(r,e,!1),r,e),e.type===s.inputTypes$$module$build$src$core$inputs$input_types.VALUE?"output connection":"previous connection",t,i)}}},lf=function(e,t){if(t.icons){var i=Object.keys(t.icons);for(const c of i){i=t.icons[c];var r=e.getIcon(c);if(!r){if(r=p(Ae.ICON,c,!1),!r)throw new Zm(c,e,t);r=new r(e),e.addIcon(r)}Ze(r)&&r.loadState(i)}}},cf=function(e,t){if(t.fields){var i=Object.keys(t.fields);for(let r=0;rt&&(t=i[r].length);var c=-1/0;let $,v=1;do{r=c,$=e,e=[],c=i.length/v;let H=1;for(let Oe=0;Oer);return $},qc=function(e,t,i){const r=[0],c=[];for(var $=0;$r&&(r=H,c=v)}return c?Jd(e,c,i):t},Tf=function(e,t){const i=[];for(let r=0;rdT&&ni()}else jl!==ds&&(clearTimeout(Ln),zp=e.pageX,Xp=e.pageY,Ln=setTimeout(kf,hT))},sh=function(){jl=ds=null,ni()},ni=function(){Xl&&(Xl=!1,ro&&(ro.style.display="none")),Ln&&(clearTimeout(Ln),Ln=0)},ih=function(){ni(),Pr=!0},nh=function(){Pr=!1},yf=function(){ro&&ds&&(typeof Xa=="function"?Xa(ro,ds):Sf())},Sf=function(){var e=pr(ds);e=s.wrap$$module$build$src$core$utils$string(e,aT),e=e.split(`
+`);for(let t=0;ti+window.scrollY&&(c-=ro.offsetHeight+2*Yp),e?r=Math.max(ja-window.scrollX,r):r+ro.offsetWidth>t+window.scrollX-2*ja&&(r=t-ro.offsetWidth-2*ja),{x:r,y:c}},kf=function(){if(!Pr&&(jl=ds,ro)){ro.textContent="",yf();var e=ds.RTL;ro.style.direction=e?"rtl":"ltr",ro.style.display="block",Xl=!0;var{x:t,y:i}=Rf(e);ro.style.left=t+"px",ro.style.top=i+"px"}},rh=function(){return Kp},Af=function(e){Kp=e},lh=function(){return Qp},Lf=function(e){Qp=e},Di=function(e){e=`${e}`.toLowerCase().trim();var t=pT[e];if(t||(t=e.substring(0,2)==="0x"?"#"+e.substring(2):e,t=t[0]==="#"?t:"#"+t,/^#[0-9a-f]{6}$/.test(t)))return t;if(/^#[0-9a-f]{3}$/.test(t))return["#",t[1],t[1],t[2],t[2],t[3],t[3]].join("");var i=e.match(/^(?:rgb)?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/);return i&&(e=Number(i[1]),t=Number(i[2]),i=Number(i[3]),0<=e&&256>e&&0<=t&&256>t&&0<=i&&256>i)?Al(e,t,i):null},Al=function(e,t,i){return t=e<<16|t<<8|i,16>e?"#"+(16777216|t).toString(16).substr(1):"#"+t.toString(16)},Jc=function(e){return e=Di(e),e?(e=parseInt(e.substr(1),16),[e>>16,e>>8&255,e&255]):[0,0,0]},Zc=function(e,t,i){let r=0,c=0,$=0;if(t===0)$=c=r=i;else{const v=Math.floor(e/60),H=e/60-v;e=i*(1-t);const Oe=i*(1-t*H);switch(t=i*(1-t*(1-H)),v){case 1:r=Oe,c=i,$=e;break;case 2:r=e,c=i,$=t;break;case 3:r=e,c=Oe,$=i;break;case 4:r=t,c=e,$=i;break;case 5:r=i,c=e,$=Oe;break;case 6:case 0:r=i,c=t,$=e}}return Al(Math.floor(r),Math.floor(c),Math.floor($))},gn=function(e,t,i){return e=Di(e),!e||(t=Di(t),!t)?null:(e=Jc(e),t=Jc(t),Al(Math.round(t[0]+i*(e[0]-t[0])),Math.round(t[1]+i*(e[1]-t[1])),Math.round(t[2]+i*(e[2]-t[2]))))},ch=function(e){return Zc(e,Kp,255*Qp)},ea=function(e,t){const i=[];var r=e.split("");r.push("");var c=0;e=[];let $=null;for(let Oe=0;Oe=v?(c=2,$=v,(v=e.join(""))&&i.push(v),e.length=0):v==="{"?c=3:(e.push("%",v),c=0);else if(c===2)if("0"<=v&&"9">=v)$+=v;else{var H=void 0;i.push(parseInt((H=$)!=null?H:"",10)),Oe--,c=0}else c===3&&(v===""?(e.splice(0,0,"%{"),Oe--,c=0):v!=="}"?e.push(v):(c=e.join(""),/[A-Z]\w*/i.test(c)?(v=c.toUpperCase(),(v=v.startsWith("BKY_")?v.substring(4):null)&&v in s.Msg$$module$build$src$core$msg?(c=s.Msg$$module$build$src$core$msg[v],typeof c=="string"?Array.prototype.push.apply(i,ea(c,t)):t?i.push(`${c}`):i.push(c)):i.push("%{"+c+"}")):i.push("%{"+c+"}"),c=e.length=0))}for((t=e.join(""))&&i.push(t),H=[],e.length=0,r=0;r=i)return{hue:i,hex:Zc(i,rh(),255*lh())};if(i=Di(t))return{hue:null,hex:i};throw i='Invalid colour: "'+t+'"',e!==t&&(i+=' (from "'+e+'")'),Error(i)},fn=function(){return bs},Nf=function(e){bs=e},uh=function(){bs||(bs=document.createElement("div"),bs.className="blocklyWidgetDiv",(M()||document.body).appendChild(bs))},oa=function(e,t,i){as(),xr=e,Ya=i,(e=bs)&&(e.style.direction=t?"rtl":"ltr",e.style.display="block",t=oe(),Br=t.getRenderer().getClassName(),Fr=t.getTheme().getClassName(),Br&&I(e,Br),Fr&&I(e,Fr))},as=function(){if(dh()){xr=null;var e=bs;e&&(e.style.display="none",e.style.left="",e.style.top="",Ya&&Ya(),Ya=null,e.textContent="",Br&&(A(e,Br),Br=""),Fr&&(A(e,Fr),Fr=""),oe().markFocused())}},dh=function(){return!!xr},sa=function(e){xr===e&&as()},hh=function(e,t,i){bs.style.left=e+"px",bs.style.top=t+"px",bs.style.height=i+"px"},ph=function(e,t,i,r){const c=Mf(e,t,i);e=wf(e,t,i,r),0>c?hh(e,0,i.height+c):hh(e,c,i.height)},wf=function(e,t,i,r){return r?Math.min(Math.max(t.right-i.width,e.left),e.right-i.width):Math.max(Math.min(t.left,e.right-i.width),e.left)},Mf=function(e,t,i){return t.bottom+i.height>=e.bottom?t.top-i.height:t.bottom},Df=function(e){return!(e==null||!e.repositionForWindowResize)},$h=function(){Df(xr)&&xr.repositionForWindowResize()||as()},Jo=function(e,t){l(Ae.FIELD,e,t)},Pf=function(e){u(Ae.FIELD,e)},s.fromJson$$module$build$src$core$field_registry=function(e){return $T.fromJsonInternal(e)},xf=function(e){const t=f(Ae.FIELD,e.type);if(t){if(typeof t.fromJson!="function")throw new TypeError("returned Field was not a IRegistrableField");return t.fromJson(e)}return console.warn("Blockly could not create a field of type "+e.type+". The field is probably not being registered. This could be because the file is not loaded, the field does not register itself (Issue #1584), or the registration is not being reached."),null},ms=function(e,t){e.setAttribute(CS,t)},Xt=function(e,t,i){Array.isArray(i)&&(i=i.join(" ")),e.setAttribute(OS+t,`${i}`)},Bf=function(e){let t=!1;const i=e.map(([v,H])=>typeof v=="string"?[Zt(v),H]:(t=!0,[v.alt!==null?Object.assign({},v,{alt:Zt(v.alt)}):Object.assign({},v),H]));if(t||2>e.length)return{options:i};var r=i.map(([v])=>v),c=Rl(r);e=Qd(r,c);const $=qd(r,c);return!e&&!$||c<=e+$?{options:i}:(c=e?r[0].substring(0,e-1):void 0,r=$?r[0].substr(1-$):void 0,{options:Ff(i,e,$),prefix:c,suffix:r})},Ff=function(e,t,i){return e.map(([r,c])=>[r.substring(t,r.length-i),c])},_h=function(e){if(!Array.isArray(e))throw TypeError("FieldDropdown options must be an array.");if(!e.length)throw TypeError("FieldDropdown options must not be an empty array.");let t=!1;for(let i=0;i document.")}else e instanceof Element&&(t=e);return t},s.register$$module$build$src$core$extensions=function(e,t){if(typeof e!="string"||e.trim()==="")throw Error('Error: Invalid extension name "'+e+'"');if(Ur[e])throw Error('Error: Extension "'+e+'" is already registered.');if(typeof t!="function")throw Error('Error: Extension "'+e+'" must be a function');Ur[e]=t},s.registerMixin$$module$build$src$core$extensions=function(e,t){if(!t||typeof t!="object")throw Error('Error: Mixin "'+e+'" must be a object');s.register$$module$build$src$core$extensions(e,function(){this.mixin(t)})},s.registerMutator$$module$build$src$core$extensions=function(e,t,i,r){const c='Error when registering mutator "'+e+'": ';Eh(c,t);const $=Th(t,c);if(i&&typeof i!="function")throw Error(c+'Extension "'+e+'" is not a function');s.register$$module$build$src$core$extensions(e,function(){$&&this.setMutator(new s.MutatorIcon$$module$build$src$core$icons$mutator_icon(r||[],this)),this.mixin(t),i&&i.apply(this)})},Gf=function(e){mh(e)?delete Ur[e]:console.warn('No extension mapping for name "'+e+'" found to unregister')},mh=function(e){return!!Ur[e]},ca=function(e,t,i){const r=Ur[e];if(typeof r!="function")throw Error('Error: Extension "'+e+'" not found.');let c;if(i?Wf(e,t):c=ua(t),r.apply(t),i)Eh('Error after applying mutator "'+e+'": ',t);else if(!jf(c,t))throw Error('Error when applying extension "'+e+'": mutation properties changed when applying a non-mutator extension.')},Wf=function(e,t){if(ua(t).length)throw Error('Error: tried to apply mutation "'+e+'" to a block that already has mutator functions. Block id: '+t.id)},zf=function(e,t){return aa(e.mutationToDom,e.domToMutation,t+" mutationToDom/domToMutation")},Xf=function(e,t){return aa(e.saveExtraState,e.loadExtraState,t+" saveExtraState/loadExtraState")},Th=function(e,t){return aa(e.compose,e.decompose,t+" compose/decompose")},aa=function(e,t,i){if(e&&t){if(typeof e!="function"||typeof t!="function")throw Error(i+" must be a function");return!0}if(!e&&!t)return!1;throw Error(i+"Must have both or neither functions")},Eh=function(e,t){const i=zf(t,e),r=Xf(t,e);if(!i&&!r)throw Error(e+"Mutations must contain either XML hooks, or JSON hooks, or both");Th(t,e)},ua=function(e){const t=[];return e.domToMutation!==void 0&&t.push(e.domToMutation),e.mutationToDom!==void 0&&t.push(e.mutationToDom),e.saveExtraState!==void 0&&t.push(e.saveExtraState),e.loadExtraState!==void 0&&t.push(e.loadExtraState),e.compose!==void 0&&t.push(e.compose),e.decompose!==void 0&&t.push(e.decompose),t},jf=function(e,t){if(t=ua(t),t.length!==e.length)return!1;for(let i=0;ii)){var r=t.getSvgXY(e.getSvgRoot());e.outputConnection?(r.x+=(e.RTL?3:-3)*i,r.y+=13*i):e.previousConnection&&(r.x+=(e.RTL?-23:23)*i,r.y+=3*i);var c=w(te.CIRCLE,{cx:r.x,cy:r.y,r:0,fill:"none",stroke:"#888","stroke-width":10},t.getParentSvg());e=w(te.ANIMATE,{id:"animationCircle",begin:"indefinite",attributeName:"r",dur:"150ms",from:0,to:25*i},c),t=w(te.ANIMATE,{id:"animationOpacity",begin:"indefinite",attributeName:"opacity",dur:"150ms",from:1,to:0},c),e.beginElement(),t.beginElement(),setTimeout(()=>void U(c),150)}},Ch=function(e){if(gr(),e.workspace.getAudioManager().play("disconnect"),!(1>e.workspace.scale)){var t=e.getHeightWidth().height;t=Math.atan(10/t)/Math.PI*180,e.RTL||(t*=-1),ql=e,yh(e,t,new Date)}},yh=function(e,t,i){const r=(new Date().getTime()-i.getTime())/200;let c="";1>=r&&(c=`skewX(${Math.round(Math.sin(r*Math.PI*3)*(1-r)*t)})`,Za=setTimeout(yh,10,e,t,i)),e.getSvgRoot().setAttribute("transform",`${e.getTranslation()} ${c}`)},gr=function(){ql&&(Za&&(clearTimeout(Za),Za=null),ql.getSvgRoot().setAttribute("transform",ql.getTranslation()),ql=null)},fr=function(e,t,i){const r=i.getBoundingRectangle(),c=r.right-r.left,$=ur(t.top,r.top,t.top+t.height-(r.bottom-r.top))-r.top;let v=t.left;return t=t.left+t.width-c,e.RTL?v=Math.min(t,v):t=Math.max(v,t),(e=ur(v,r.left,t)-r.left)||$?(i.moveBy(e,$,["inbounds"]),!0):!1},Sh=function(e){return t=>{var i=e.getMetricsManager();if(i.hasFixedEdges()&&!e.isDragging()){var r;if(ya.indexOf((r=t.type)!=null?r:"")!==-1){r=i.getScrollMetrics(!0);const c=qf(e,t);c&&(i=s.getGroup$$module$build$src$core$events$utils()||!1,s.setGroup$$module$build$src$core$events$utils(t.group),fr(e,r,c)&&!t.group&&console.warn("Moved object in bounds but there was no event group. This may break undo."),s.setGroup$$module$build$src$core$events$utils(i))}else t.type===Ui&&t.scale&&t.oldScale&&t.scale>t.oldScale&&ha(e)}}},qf=function(e,t){let i=null;switch(t.type){case s.CREATE$$module$build$src$core$events$utils:case s.MOVE$$module$build$src$core$events$utils:(i=e.getBlockById(t.blockId))&&(i=i.getRootBlock());break;case Hi:case Us:i=e.getCommentById(t.commentId)}return i},ha=function(e){var t=e.getMetricsManager();if(t.hasFixedEdges()&&!e.isDragging()){t=t.getScrollMetrics(!0);var i=e.getTopBoundedElements();for(let r=0,c;c=i[r];r++)fr(e,t,c)}},Rh=function(e,t){const i=[];for(const r of e.getIcons())(!Mi(r)||r.bubbleIsVisible())&&(i.push({location:t,icon:r}),r.onLocationChange(t));for(const r of e.getChildren(!1))i.push(...Rh(r,Ue.sum(t,r.relativeCoords)));return i},Nl=function(e){l$.copyInternal(e)},Jf=function(e){Ei=e.toCopyData()},kh=function(){if(!Ei)return null;let e=Ei.source;return e.isFlyout&&(e=e.targetWorkspace),Ei.typeCounts&&e.isCapacityAvailable(Ei.typeCounts)?e.paste(Ei.saveInfo):null},pa=function(e){return l$.duplicateInternal(e)},Zf=function(e){const t=Ei;Nl(e);let i,r,c;return e=(c=(i=e.toCopyData())==null||(r=i.source)==null?void 0:r.paste(Ei.saveInfo))!=null?c:null,Ei=t,e},em=function(){return tu},Ah=function(e){tu=e},wl=function(e,t,i){if(oa(yT,i,Lh),t.length){var r=tm(t,i);ou=r,om(r,e,i),setTimeout(function(){r.focus()},1),tu=null}else Ml()},tm=function(e,t){const i=new qp;i.setRole(Vo.MENU);for(let r=0;r{setTimeout(()=>{c.callback(c.scope)},0)})},{})}return i},om=function(e,t,i){const r=bd();t=new Bt(t.clientY+r.top,t.clientY+r.top,t.clientX+r.left,t.clientX+r.left),sm(e);const c=e.getSize();i&&(t.left+=c.width,t.right+=c.width,r.left+=c.width,r.right+=c.width),ph(r,t,c,i),e.focus()},sm=function(e){var t=fn();if(!t)throw Error("Attempting to create a context menu when widget div is null");t=e.render(t),I(t,"blocklyContextMenu"),Be(t,"contextmenu",null,im),e.focus()},im=function(e){e.preventDefault(),e.stopPropagation()},Ml=function(){sa(yT),tu=null},Lh=function(){ou&&(ou.dispose(),ou=null)},s.callbackFactory$$module$build$src$core$contextmenu=function(e,t){return()=>{s.disable$$module$build$src$core$events$utils();let i;try{i=wi(t,e.workspace);const r=e.getRelativeToSurfaceXY();r.x=e.RTL?r.x-s.config$$module$build$src$core$config.snapRadius:r.x+s.config$$module$build$src$core$config.snapRadius,r.y+=2*s.config$$module$build$src$core$config.snapRadius,i.moveBy(r.x,r.y)}finally{s.enable$$module$build$src$core$events$utils()}_e()&&!i.isShadow()&&re(new(we(s.CREATE$$module$build$src$core$events$utils))(i)),i.select()}},Nh=function(e){return{text:s.Msg$$module$build$src$core$msg.REMOVE_COMMENT,enabled:!0,callback:function(){s.setGroup$$module$build$src$core$events$utils(!0),e.dispose(),s.setGroup$$module$build$src$core$events$utils(!1)}}},wh=function(e){return{text:s.Msg$$module$build$src$core$msg.DUPLICATE_COMMENT,enabled:!0,callback:function(){pa(e)}}},nm=function(e,t){const i={enabled:!0};return i.text=s.Msg$$module$build$src$core$msg.ADD_COMMENT,i.callback=function(){const r=new yo(e,s.Msg$$module$build$src$core$msg.WORKSPACE_COMMENT_DEFAULT_TEXT,yo.DEFAULT_SIZE,yo.DEFAULT_SIZE);var c=e.getInjectionDiv().getBoundingClientRect();c=new Ue(t.clientX-c.left,t.clientY-c.top);const $=e.getOriginOffsetInPixels();c=Ue.difference(c,$),c.scale(1/e.scale),r.moveBy(c.x,c.y),e.rendered&&(r.initSvg(),r.render(),r.select())},i},Dl=function(e){let t=e.outputConnection;return(!t||e.previousConnection&&e.previousConnection.isConnected())&&(t=e.previousConnection),t},Mh=function(e){return e.isDynamic},mr=function(e,t){l(Ae.RENDERER,e,t)},rm=function(e){u(Ae.RENDERER,e)},Dh=function(e,t,i){return e=new(p(Ae.RENDERER,e))(e),e.init(t,i),e},Ph=function(){kt.registry.register({displayText(){return s.Msg$$module$build$src$core$msg.UNDO},preconditionFn(e){return 0t.length?Pl(t):ue(s.Msg$$module$build$src$core$msg.DELETE_ALL_BLOCKS.replace("%1",String(t.length)),function(i){i&&Pl(t)})}},scopeType:kt.ScopeType.WORKSPACE,id:"workspaceDelete",weight:6})},lm=function(){Ph(),xh(),Bh(),Uh(),Hh(),Gh()},Wh=function(){kt.registry.register({displayText(){return s.Msg$$module$build$src$core$msg.DUPLICATE_BLOCK},preconditionFn(e){return e=e.block,!e.isInFlyout&&e.isDeletable()&&e.isMovable()?e.isDuplicatable()?"enabled":"disabled":"hidden"},callback(e){e.block&&pa(e.block)},scopeType:kt.ScopeType.BLOCK,id:"blockDuplicate",weight:1})},zh=function(){kt.registry.register({displayText(e){return e.block.hasIcon(Ao.TYPE)?s.Msg$$module$build$src$core$msg.REMOVE_COMMENT:s.Msg$$module$build$src$core$msg.ADD_COMMENT},preconditionFn(e){return e=e.block,!e.isInFlyout&&e.workspace.options.comments&&!e.isCollapsed()&&e.isEditable()?"enabled":"hidden"},callback(e){e=e.block,e.hasIcon(Ao.TYPE)?e.setCommentText(null):e.setCommentText("")},scopeType:kt.ScopeType.BLOCK,id:"blockComment",weight:2})},Xh=function(){kt.registry.register({displayText(e){return e.block.getInputsInline()?s.Msg$$module$build$src$core$msg.EXTERNAL_INPUTS:s.Msg$$module$build$src$core$msg.INLINE_INPUTS},preconditionFn(e){if(e=e.block,!e.isInFlyout&&e.isMovable()&&!e.isCollapsed()){for(let t=1;t!r.getReturnTypes()).map(r=>[r.getName(),r.getParameters().map(c=>c.getName()),!1]);e.getBlocksByType("procedures_defnoreturn",!1).forEach(r=>{!Pi(r)&&J(r)&&t.push(r.getProcedureDef())});const i=e.getProcedureMap().getProcedures().filter(r=>!!r.getReturnTypes()).map(r=>[r.getName(),r.getParameters().map(c=>c.getName()),!0]);return e.getBlocksByType("procedures_defreturn",!1).forEach(r=>{!Pi(r)&&J(r)&&i.push(r.getProcedureDef())}),t.sort(Jh),i.sort(Jh),[t,i]},Jh=function(e,t){return e[0].localeCompare(t[0],void 0,{sensitivity:"base"})},s.findLegalName$$module$build$src$core$procedures=function(e,t){if(t.isInFlyout)return e;for(e=e||s.Msg$$module$build$src$core$msg.UNNAMED_KEY||"unnamed";!am(e,t.workspace,t);){const i=e.match(/^(.*?)(\d+)$/);e=i?i[1]+(parseInt(i[2])+1):e+"2"}return e},am=function(e,t,i){return!Zh(e,t,i)},Zh=function(e,t,i){for(const r of t.getAllBlocks(!1))if(r!==i&&J(r)&&s.Names$$module$build$src$core$names.equals(r.getProcedureDef()[0],e))return!0;i=i&&Pi(i)?i==null?void 0:i.getProcedureModel():void 0;for(const r of t.getProcedureMap().getProcedures())if(r!==i&&s.Names$$module$build$src$core$names.equals(r.getName(),e))return!0;return!1},s.rename$$module$build$src$core$procedures=function(e){var t=this.getSourceBlock();if(!t)throw new io;e=e.trim();const i=s.findLegalName$$module$build$src$core$procedures(e,t);Pi(t)&&!t.isInsertionMarker()&&t.getProcedureModel().setName(i);const r=this.getValue();if(r!==e&&r!==i)for(e=t.workspace.getAllBlocks(!1),t=0;tdm(i,e)||Ee(i)&&s.Names$$module$build$src$core$names.equals(i.getProcedureCall(),e))},dm=function(e,t){return Pi(e)&&!e.isProcedureDef()&&e.getProcedureModel()&&s.Names$$module$build$src$core$names.equals(e.getProcedureModel().getName(),t)},s.mutateCallers$$module$build$src$core$procedures=function(e){const t=ke();var i=e.getProcedureDef()[0];const r=e.mutationToDom(!0);e=op(i,e.workspace);for(let $=0,v;v=e[$];$++){i=(i=v.mutationToDom())&&ht(i),v.domToMutation&&v.domToMutation(r);var c=v.mutationToDom();c=c&&ht(c),i!==c&&(fe(!1),re(new(we(s.CHANGE$$module$build$src$core$events$utils))(v,"mutation",null,i,c)),fe(t))}},s.getDefinition$$module$build$src$core$procedures=function(e,t){for(const i of t.getAllBlocks(!1))if(Pi(i)&&i.isProcedureDef()&&s.Names$$module$build$src$core$names.equals(i.getProcedureModel().getName(),e)||J(i)&&s.Names$$module$build$src$core$names.equals(i.getProcedureDef()[0],e))return i;return null},sp=function(e){Qo(e.getTargetWorkspace(),void 0,"String")},ip=function(e){Qo(e.getTargetWorkspace(),void 0,"Number")},np=function(e){Qo(e.getTargetWorkspace(),void 0,"Colour")},ma=function(e){let t=[],i=document.createElement("button");return i.setAttribute("text",s.Msg$$module$build$src$core$msg.NEW_STRING_VARIABLE),i.setAttribute("callbackKey","CREATE_VARIABLE_STRING"),t.push(i),i=document.createElement("button"),i.setAttribute("text",s.Msg$$module$build$src$core$msg.NEW_NUMBER_VARIABLE),i.setAttribute("callbackKey","CREATE_VARIABLE_NUMBER"),t.push(i),i=document.createElement("button"),i.setAttribute("text",s.Msg$$module$build$src$core$msg.NEW_COLOUR_VARIABLE),i.setAttribute("callbackKey","CREATE_VARIABLE_COLOUR"),t.push(i),e.registerButtonCallback("CREATE_VARIABLE_STRING",sp),e.registerButtonCallback("CREATE_VARIABLE_NUMBER",ip),e.registerButtonCallback("CREATE_VARIABLE_COLOUR",np),e=rp(e),t=t.concat(e)},rp=function(e){e=e.getAllVariables();const t=[];if(0cp(i))),t},cp=function(e){const t={id:e.getId(),name:e.getName()};return e.getTypes().length&&(t.types=e.getTypes()),t},ap=function(e,t,i,r){if(e=new e(r,i.name,i.id).setReturnTypes(i.returnTypes),!i.parameters)return e;for(const[c,$]of i.parameters.entries())e.insertParameter(up(t,$,r),c);return e},up=function(e,t,i){return e=new e(i,t.name,t.id),t.types&&e.setTypes(t.types),e},Em=function(e){const t=Object.create(null),i=T(Ae.SERIALIZER,!0);for(const r in i){let c;const $=(c=i[r])==null?void 0:c.save(e);$&&(t[r]=$)}return t},bm=function(e,t,{recordUndo:i=!1}={}){var r=T(Ae.SERIALIZER,!0);if(r){r=Object.entries(r).sort(($,v)=>v[1].priority-$[1].priority);var c=ke();fe(i),(i=s.getGroup$$module$build$src$core$events$utils())||s.setGroup$$module$build$src$core$events$utils(!0),Ce(),t instanceof Cs&&t.setResizesEnabled(!1);for(const[,$]of r.reverse()){let v;(v=$)==null||v.clear(t)}for(let[$,v]of r.reverse())if(e[$]){let H;(H=v)==null||H.load(e[$],t)}t instanceof Cs&&t.setResizesEnabled(!0),ce(),re(new(we(bn))(t)),s.setGroup$$module$build$src$core$events$utils(i),fe(c)}},dp=function(){At.registry.register({name:Ks.ESCAPE,preconditionFn(e){return!e.options.readOnly},callback(e){return e.hideChaff(),!0},keyCodes:[ft.ESC]})},hp=function(){At.registry.register({name:Ks.DELETE,preconditionFn(e){const t=Z();return!e.options.readOnly&&t!=null&&t.isDeletable()},callback(e,t){return t.preventDefault(),bi.inProgress()?!1:(Z().checkAndDelete(),!0)},keyCodes:[ft.DELETE,ft.BACKSPACE]})},pp=function(){const e=At.registry.createSerializedKey(ft.C,[ft.CTRL]),t=At.registry.createSerializedKey(ft.C,[ft.ALT]),i=At.registry.createSerializedKey(ft.C,[ft.META]);At.registry.register({name:Ks.COPY,preconditionFn(r){const c=Z();return!r.options.readOnly&&!bi.inProgress()&&c!=null&&c.isDeletable()&&c.isMovable()},callback(r,c){return c.preventDefault(),r.hideChaff(),Nl(Z()),!0},keyCodes:[e,t,i]})},$p=function(){const e=At.registry.createSerializedKey(ft.X,[ft.CTRL]),t=At.registry.createSerializedKey(ft.X,[ft.ALT]),i=At.registry.createSerializedKey(ft.X,[ft.META]);At.registry.register({name:Ks.CUT,preconditionFn(r){const c=Z();return!r.options.readOnly&&!bi.inProgress()&&c!=null&&c instanceof ts&&c.isDeletable()&&c.isMovable()&&!c.workspace.isFlyout},callback(){const r=Z();return r?(Nl(r),r.checkAndDelete(),!0):!1},keyCodes:[e,t,i]})},_p=function(){const e=At.registry.createSerializedKey(ft.V,[ft.CTRL]),t=At.registry.createSerializedKey(ft.V,[ft.ALT]),i=At.registry.createSerializedKey(ft.V,[ft.META]);At.registry.register({name:Ks.PASTE,preconditionFn(r){return!r.options.readOnly&&!bi.inProgress()},callback(){return!!kh()},keyCodes:[e,t,i]})},gp=function(){const e=At.registry.createSerializedKey(ft.Z,[ft.CTRL]),t=At.registry.createSerializedKey(ft.Z,[ft.ALT]),i=At.registry.createSerializedKey(ft.Z,[ft.META]);At.registry.register({name:Ks.UNDO,preconditionFn(r){return!r.options.readOnly&&!bi.inProgress()},callback(r){return r.hideChaff(),r.undo(!1),!0},keyCodes:[e,t,i]})},fp=function(){const e=At.registry.createSerializedKey(ft.Z,[ft.SHIFT,ft.CTRL]),t=At.registry.createSerializedKey(ft.Z,[ft.SHIFT,ft.ALT]),i=At.registry.createSerializedKey(ft.Z,[ft.SHIFT,ft.META]),r=At.registry.createSerializedKey(ft.Y,[ft.CTRL]);At.registry.register({name:Ks.REDO,preconditionFn(c){return!bi.inProgress()&&!c.options.readOnly},callback(c){return c.hideChaff(),c.undo(!0),!0},keyCodes:[e,t,i,r]})},mp=function(){dp(),hp(),pp(),$p(),_p(),gp(),fp()},vm=function(e){return e.isSelectable()},Im=function(e){oe().hideChaff(e)},st=st||{},st.scope={},st.ASSUME_ES5=!1,st.ASSUME_NO_NATIVE_MAP=!1,st.ASSUME_NO_NATIVE_SET=!1,st.SIMPLE_FROUND_POLYFILL=!1,st.ISOLATE_POLYFILLS=!1,st.FORCE_POLYFILL_PROMISE=!1,st.FORCE_POLYFILL_PROMISE_WHEN_NO_UNHANDLED_REJECTION=!1,st.defineProperty=st.ASSUME_ES5||typeof Object.defineProperties=="function"?Object.defineProperty:function(e,t,i){return e==Array.prototype||e==Object.prototype||(e[t]=i.value),e},st.getGlobal=function(e){e=[typeof globalThis=="object"&&globalThis,e,typeof window=="object"&&window,typeof self=="object"&&self,typeof Do=="object"&&Do];for(var t=0;t>>0,st.propertyToPolyfillSymbol[c]=st.IS_SYMBOL_NATIVE?st.global.Symbol(c):st.POLYFILL_PREFIX+i+"$"+c),st.defineProperty(r,st.propertyToPolyfillSymbol[c],{configurable:!0,writable:!0,value:t})))},st.polyfill("globalThis",function(e){return e||st.global},"es_2020","es3"),st.arrayIteratorImpl=function(e){var t=0;return function(){return t{const e=Rm.length,t=[];for(let i=0;20>i;i++)t[i]=Rm.charAt(Math.random()*e);return t.join("")}},fS=0,Ia={};Ia.TEST_ONLY=km,Ia.genUid=he,Ia.getNextUniqueId=$e;var Tp,Er,Oa,Bi,Fi,mn,br,Ca,Tn,ci,ai,vr,Fs,Ir,Or,Cr,Ui,Hi,En,yr,Us,bn,ya,vn,Sa,pt;Tp="",Er=!0,Oa=0,s.CREATE$$module$build$src$core$events$utils="create",s.CREATE$$module$build$src$core$events$utils,s.DELETE$$module$build$src$core$events$utils="delete",s.DELETE$$module$build$src$core$events$utils,s.CHANGE$$module$build$src$core$events$utils="change",s.CHANGE$$module$build$src$core$events$utils,Bi="block_field_intermediate_change",s.MOVE$$module$build$src$core$events$utils="move",s.MOVE$$module$build$src$core$events$utils,Fi="var_create",mn="var_delete",br="var_rename",Ca="ui",Tn="drag",ci="selected",ai="click",vr="marker_move",Fs="bubble_open",Ir="trashcan_open",Or="toolbox_item_select",Cr="theme_change",Ui="viewport_change",Hi="comment_create",En="comment_delete",yr="comment_change",Us="comment_move",bn="finished_loading",ya=[s.CREATE$$module$build$src$core$events$utils,s.MOVE$$module$build$src$core$events$utils,Hi,Us],vn=[],Sa={FIRE_QUEUE:vn,fireNow:D,fireInternal:Ie,setGroupInternal:Me},pt={},pt.BLOCK_CHANGE=s.CHANGE$$module$build$src$core$events$utils,pt.BLOCK_CREATE=s.CREATE$$module$build$src$core$events$utils,pt.BLOCK_DELETE=s.DELETE$$module$build$src$core$events$utils,pt.BLOCK_DRAG=Tn,pt.BLOCK_FIELD_INTERMEDIATE_CHANGE=Bi,pt.BLOCK_MOVE=s.MOVE$$module$build$src$core$events$utils,pt.BUBBLE_OPEN=Fs,pt.BUMP_EVENTS=ya,pt.CHANGE=s.CHANGE$$module$build$src$core$events$utils,pt.CLICK=ai,pt.COMMENT_CHANGE=yr,pt.COMMENT_CREATE=Hi,pt.COMMENT_DELETE=En,pt.COMMENT_MOVE=Us,pt.CREATE=s.CREATE$$module$build$src$core$events$utils,pt.DELETE=s.DELETE$$module$build$src$core$events$utils,pt.FINISHED_LOADING=bn,pt.MARKER_MOVE=vr,pt.MOVE=s.MOVE$$module$build$src$core$events$utils,pt.SELECTED=ci,pt.TEST_ONLY=Sa,pt.THEME_CHANGE=Cr,pt.TOOLBOX_ITEM_SELECT=Or,pt.TRASHCAN_OPEN=Ir,pt.UI=Ca,pt.VAR_CREATE=Fi,pt.VAR_DELETE=mn,pt.VAR_RENAME=br,pt.VIEWPORT_CHANGE=Ui,pt.clearPendingUndo=ae,pt.disable=s.disable$$module$build$src$core$events$utils,pt.disableOrphans=We,pt.enable=s.enable$$module$build$src$core$events$utils,pt.filter=B,pt.fire=re,pt.fromJson=Je,pt.get=we,pt.getDescendantIds=Xe,pt.getGroup=s.getGroup$$module$build$src$core$events$utils,pt.getRecordUndo=ke,pt.isEnabled=_e,pt.setGroup=s.setGroup$$module$build$src$core$events$utils,pt.setRecordUndo=fe,function(e){e[e.VALUE=1]="VALUE",e[e.STATEMENT=3]="STATEMENT",e[e.DUMMY=5]="DUMMY",e[e.CUSTOM=6]="CUSTOM"}(s.inputTypes$$module$build$src$core$inputs$input_types||(s.inputTypes$$module$build$src$core$inputs$input_types={})),s.inputTypes$$module$build$src$core$inputs$input_types;var Ra={parseFromString:function(){throw Error("DOMParser was not found in the global scope and was not properly injected using injectDependencies")}},Ep={serializeToString:function(){throw Error("XMLSerializer was not foundin the global scope and was not properly injected using injectDependencies")}},{document:ka,DOMParser:Bl,XMLSerializer:Fl}=globalThis;Bl&&(Ra=new Bl),Fl&&(Ep=new Fl);var Am="https://developers.google.com/blockly/xml",mS=/[\x00-\x09\x0B\x0C\x0E-\x1F]/g,In={};In.NAME_SPACE=Am,In.createElement=s.createElement$$module$build$src$core$utils$xml,In.createTextNode=s.createTextNode$$module$build$src$core$utils$xml,In.domToText=ht,In.injectDependencies=nt,In.textToDom=s.textToDom$$module$build$src$core$utils$xml;var Uo=class{constructor(e){this.name=e}toString(){return this.name}equals(e){return this.name===e.toString()}};Uo.MUTATOR=new Uo("mutator"),Uo.WARNING=new Uo("warning"),Uo.COMMENT=new Uo("comment");var Sr={};Sr.warn=xe;var Aa="http://www.w3.org/2000/svg",ui="http://www.w3.org/1999/xhtml",us="http://www.w3.org/1999/xlink",di;(function(e){e[e.ELEMENT_NODE=1]="ELEMENT_NODE",e[e.TEXT_NODE=3]="TEXT_NODE",e[e.COMMENT_NODE=8]="COMMENT_NODE"})(di||(di={}));var Es=null,bp=0,La=null,co={};co.HTML_NS=ui,co.NodeType=di,co.SVG_NS=Aa,co.XLINK_NS=us,co.addClass=I,co.containsNode=Te,co.createSvgElement=w,co.getFastTextWidth=Ne,co.getFastTextWidthWithSizeString=He,co.getTextWidth=Se,co.hasClass=K,co.insertAfter=de,co.measureFontMetrics=be,co.removeClass=A,co.removeClasses=N,co.removeNode=U,co.setCssTransform=se,co.startTextWidthCache=Ce,co.stopTextWidthCache=ce;var Vt=class{constructor(e,t){this.width=e,this.height=t}static equals(e,t){return e===t?!0:e&&t?e.width===t.width&&e.height===t.height:!1}},Lm=function(e,t){window.alert(e),t&&t()},Nm=function(e,t){t(window.confirm(e))},wm=function(e,t,i){i(window.prompt(e,t))},Mm={confirmInternal:ye},Vi={};Vi.TEST_ONLY=Mm,Vi.alert=ee,Vi.confirm=ue,Vi.prompt=g,Vi.setAlert=ie,Vi.setConfirm=E,Vi.setPrompt=k;var vp,Na;s.Msg$$module$build$src$core$msg=Object.create(null),vp=function(e){Object.keys(e).forEach(function(t){s.Msg$$module$build$src$core$msg[t]=e[t]})},Na={},Na.Msg=s.Msg$$module$build$src$core$msg,Na.setLocale=vp;var Rr=class{constructor(){this.workspaceId=void 0,this.isUiEvent=!1,this.type="",this.group=s.getGroup$$module$build$src$core$events$utils(),this.recordUndo=ke()}toJson(){return{type:this.type,group:this.group}}static fromJson(e,t,i){return i.isBlank=!1,i.group=e.group||"",i.workspaceId=t.id,i}isNull(){return!1}run(e){}getEventWorkspace_(){let e;if(this.workspaceId&&(e=S(this.workspaceId)),!e)throw Error("Workspace is null. Event must have been generated from real Blockly events.");return e}},Ul=class extends Rr{constructor(e){super(),this.isBlank=typeof e>"u",e&&(this.varId=e.getId(),this.workspaceId=e.workspace.id)}toJson(){const e=super.toJson();if(!this.varId)throw Error("The var ID is undefined. Either pass a variable to the constructor, or call fromJson");return e.varId=this.varId,e}static fromJson(e,t,i){return t=super.fromJson(e,t,i??new Ul),t.varId=e.varId,t}},Ip=class extends Ul{constructor(e){super(e),this.type=Fi,e&&(this.varType=e.type,this.varName=e.name)}toJson(){const e=super.toJson();if(this.varType===void 0)throw Error("The var type is undefined. Either pass a variable to the constructor, or call fromJson");if(!this.varName)throw Error("The var name is undefined. Either pass a variable to the constructor, or call fromJson");return e.varType=this.varType,e.varName=this.varName,e}static fromJson(e,t,i){return t=super.fromJson(e,t,i??new Ip),t.varType=e.varType,t.varName=e.varName,t}run(e){const t=this.getEventWorkspace_();if(!this.varId)throw Error("The var ID is undefined. Either pass a variable to the constructor, or call fromJson");if(!this.varName)throw Error("The var name is undefined. Either pass a variable to the constructor, or call fromJson");e?t.createVariable(this.varName,this.varType,this.varId):t.deleteVariableById(this.varId)}};l(Ae.EVENT,Fi,Ip);var Hl=class{constructor(e,t,i,r){this.workspace=e,this.name=t,this.type=i||"",this.id_=r||he()}getId(){return this.id_}static compareByName(e,t){return e.name.localeCompare(t.name,void 0,{sensitivity:"base"})}},Op="VARIABLE",Cp="ijkmnopqrstuvwxyzabcdefgh",Dm={generateUniqueNameInternal:ii},ao={};ao.CATEGORY_NAME=Op,ao.TEST_ONLY=Dm,ao.VAR_LETTER_OPTIONS=Cp,ao.allDeveloperVariables=s.allDeveloperVariables$$module$build$src$core$variables,ao.allUsedVarModels=s.allUsedVarModels$$module$build$src$core$variables,ao.createVariableButtonHandler=Qo,ao.flyoutCategory=ze,ao.flyoutCategoryBlocks=yt,ao.generateUniqueName=ls,ao.generateUniqueNameFromOptions=xt,ao.generateVariableFieldDom=s.generateVariableFieldDom$$module$build$src$core$variables,ao.getAddedVariables=y,ao.getOrCreateVariablePackage=s.getOrCreateVariablePackage$$module$build$src$core$variables,ao.getVariable=s.getVariable$$module$build$src$core$variables,ao.nameUsedWithAnyType=qo,ao.nameUsedWithConflictingParam=b,ao.promptName=Ht,ao.renameVariable=s.renameVariable$$module$build$src$core$variables;var Ue=class{constructor(e,t){this.x=e,this.y=t}clone(){return new Ue(this.x,this.y)}scale(e){return this.x*=e,this.y*=e,this}translate(e,t){return this.x+=e,this.y+=t,this}static equals(e,t){return e===t?!0:e&&t?e.x===t.x&&e.y===t.y:!1}static distance(e,t){const i=e.x-t.x;return e=e.y-t.y,Math.sqrt(i*i+e*e)}static magnitude(e){return Math.sqrt(e.x*e.x+e.y*e.y)}static difference(e,t){return new Ue(e.x-t.x,e.y-t.y)}static sum(e,t){return new Ue(e.x+t.x,e.y+t.y)}},Hs=class{constructor(e,t,i,r,c){this.workspace=e,this.editable=this.movable=this.deletable=!0,this.disposed_=!1,this.isComment=!0,this.id=c&&!e.getCommentById(c)?c:he(),e.addTopComment(this),this.xy_=new Ue(0,0),this.height_=i,this.width_=r,this.RTL=e.RTL,this.content_=t,Hs.fireCreateEvent(this)}dispose(){this.disposed_||(_e()&&re(new(we(En))(this)),this.workspace.removeTopComment(this),this.disposed_=!0)}getHeight(){return this.height_}setHeight(e){this.height_=e}getWidth(){return this.width_}setWidth(e){this.width_=e}getRelativeToSurfaceXY(){return new Ue(this.xy_.x,this.xy_.y)}moveBy(e,t){const i=new(we(Us))(this);this.xy_.translate(e,t),i.recordNew(),re(i)}isDeletable(){return this.deletable&&!(this.workspace&&this.workspace.options.readOnly)}setDeletable(e){this.deletable=e}isMovable(){return this.movable&&!(this.workspace&&this.workspace.options.readOnly)}setMovable(e){this.movable=e}isEditable(){return this.editable&&!(this.workspace&&this.workspace.options.readOnly)}setEditable(e){this.editable=e}getContent(){return this.content_}setContent(e){this.content_!==e&&(re(new(we(yr))(this,this.content_,e)),this.content_=e)}toXmlWithXY(e){return e=this.toXml(e),e.setAttribute("x",String(Math.round(this.xy_.x))),e.setAttribute("y",String(Math.round(this.xy_.y))),e.setAttribute("h",String(this.height_)),e.setAttribute("w",String(this.width_)),e}toXml(e){const t=s.createElement$$module$build$src$core$utils$xml("comment");return e||(t.id=this.id),t.textContent=this.getContent(),t}static fireCreateEvent(e){if(_e()){const t=s.getGroup$$module$build$src$core$events$utils();t||s.setGroup$$module$build$src$core$events$utils(!0);try{re(new(we(Hi))(e))}finally{s.setGroup$$module$build$src$core$events$utils(t)}}}static fromXml(e,t){var i=Hs.parseAttributes(e);return t=new Hs(t,i.content,i.h,i.w,i.id),i=e.getAttribute("x"),e=e.getAttribute("y"),i=i?parseInt(i,10):NaN,e=e?parseInt(e,10):NaN,isNaN(i)||isNaN(e)||t.moveBy(i,e),Hs.fireCreateEvent(t),t}static parseAttributes(e){const t=e.getAttribute("h"),i=e.getAttribute("w"),r=e.getAttribute("x"),c=e.getAttribute("y"),$=e.getAttribute("id");if(!$)throw Error("No ID present in XML comment definition.");let v;return{id:$,h:t?parseInt(t):100,w:i?parseInt(i):100,x:r?parseInt(r):NaN,y:c?parseInt(c):NaN,content:(v=e.textContent)!=null?v:""}}},Vs=class extends Rr{constructor(e){super(),this.recordUndo=!1,this.isUiEvent=!0,this.isBlank=typeof e>"u",this.workspaceId=e||""}},yp=class extends Vs{constructor(e,t,i){super(i),this.type=ci,this.oldElementId=e??void 0,this.newElementId=t??void 0}toJson(){const e=super.toJson();return e.oldElementId=this.oldElementId,e.newElementId=this.newElementId,e}static fromJson(e,t,i){return t=super.fromJson(e,t,i??new yp),t.oldElementId=e.oldElementId,t.newElementId=e.newElementId,t}};l(Ae.EVENT,ci,yp);var TS=750,Pm="ontouchstart"in globalThis||!!(globalThis.document&&document.documentElement&&"ontouchstart"in document.documentElement)||!(!globalThis.navigator||!globalThis.navigator.maxTouchPoints&&!globalThis.navigator.msMaxTouchPoints),wa=null,On={mousedown:["pointerdown"],mouseenter:["pointerenter"],mouseleave:["pointerleave"],mousemove:["pointermove"],mouseout:["pointerout"],mouseover:["pointerover"],mouseup:["pointerup","pointercancel"],touchend:["pointerup"],touchcancel:["pointercancel"]},Ma=0,hi={};hi.TOUCH_ENABLED=Pm,hi.TOUCH_MAP=On,hi.checkTouchIdentifier=po,hi.clearTouchIdentifier=Ge,hi.getTouchIdentifierFromEvent=Mt,hi.longStart=V,hi.longStop=ve,hi.shouldHandleEvent=rt;var Sp,xm,Bm,Fm,Da,Pa,Rp,Um,Hm,Vm;(function(e){function t(r){return i.indexOf(r.toUpperCase())!==-1}Sp=e;const i=Sp.toUpperCase();xm=t("JavaFX"),Bm=t("WebKit"),Fm=t("Gecko")&&!Bm,Da=t("Android"),e=globalThis.navigator&&globalThis.navigator.maxTouchPoints,Pa=t("iPad")||t("Macintosh")&&0.blocklyPathLight {
+ display: none;
+}
+
+.blocklyDraggable {
+ cursor: grab;
+ cursor: -webkit-grab;
+}
+
+.blocklyDragging {
+ cursor: grabbing;
+ cursor: -webkit-grabbing;
+}
+
+ /* Changes cursor on mouse down. Not effective in Firefox because of
+ https://bugzilla.mozilla.org/show_bug.cgi?id=771241 */
+.blocklyDraggable:active {
+ 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;
+}
+
+.blocklyMultilineText {
+ font-family: monospace;
+}
+
+.blocklyNonEditableText>text {
+ pointer-events: none;
+}
+
+.blocklyFlyout {
+ position: absolute;
+ z-index: 20;
+}
+
+.blocklyText text {
+ cursor: default;
+}
+
+/*
+ Don't allow users to select text. It gets annoying when trying to
+ drag a block and selected text moves instead.
+*/
+.blocklySvg 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;
+}
+
+.blocklyHtmlInput {
+ border: none;
+ border-radius: 4px;
+ height: 100%;
+ margin: 0;
+ outline: none;
+ padding: 0;
+ width: 100%;
+ text-align: center;
+ display: block;
+ box-sizing: border-box;
+}
+
+/* Remove the increase and decrease arrows on the field number editor */
+input.blocklyHtmlInput[type=number]::-webkit-inner-spin-button,
+input.blocklyHtmlInput[type=number]::-webkit-outer-spin-button {
+ -webkit-appearance: none;
+ margin: 0;
+}
+
+input[type=number] {
+ -moz-appearance: textfield;
+}
+
+.blocklyMainBackground {
+ stroke-width: 1;
+ stroke: #c6c6c6; /* Equates to #ddd due to border being off-pixel. */
+}
+
+.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;
+}
+
+/* Darken flyout scrollbars due to being on a grey background. */
+/* By contrast, workspace scrollbars are on a white background. */
+.blocklyFlyout .blocklyScrollbarHandle {
+ fill: #bbb;
+}
+
+.blocklyFlyout .blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,
+.blocklyFlyout .blocklyScrollbarHandle:hover {
+ fill: #aaa;
+}
+
+.blocklyInvalidInput {
+ background: #faa;
+}
+
+.blocklyVerticalMarker {
+ stroke-width: 3px;
+ fill: rgba(255,255,255,.5);
+ pointer-events: none;
+}
+
+.blocklyComputeCanvas {
+ position: absolute;
+ width: 0;
+ height: 0;
+}
+
+.blocklyNoPointerEvents {
+ pointer-events: none;
+}
+
+.blocklyContextMenu {
+ border-radius: 4px;
+ max-height: 100%;
+}
+
+.blocklyDropdownMenu {
+ border-radius: 2px;
+ padding: 0 !important;
+}
+
+.blocklyDropdownMenu .blocklyMenuItem {
+ /* 28px on the left for icon or checkbox. */
+ padding-left: 28px;
+}
+
+/* BiDi override for the resting state. */
+.blocklyDropdownMenu .blocklyMenuItemRtl {
+ /* Flip left/right padding for BiDi. */
+ padding-left: 5px;
+ padding-right: 28px;
+}
+
+.blocklyWidgetDiv .blocklyMenu {
+ background: #fff;
+ border: 1px solid transparent;
+ box-shadow: 0 0 3px 1px rgba(0,0,0,.3);
+ 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; /* Arbitrary, but some apps depend on it... */
+}
+
+.blocklyWidgetDiv .blocklyMenu.blocklyFocused {
+ box-shadow: 0 0 6px 1px rgba(0,0,0,.3);
+}
+
+.blocklyDropDownDiv .blocklyMenu {
+ background: inherit; /* Compatibility with gapi, reset from goog-menu */
+ border: inherit; /* Compatibility with gapi, reset from goog-menu */
+ font: normal 13px "Helvetica Neue", Helvetica, sans-serif;
+ outline: none;
+ position: relative; /* Compatibility with gapi, reset from goog-menu */
+ z-index: 20000; /* Arbitrary, but some apps depend on it... */
+}
+
+/* State: resting. */
+.blocklyMenuItem {
+ border: none;
+ color: #000;
+ cursor: pointer;
+ list-style: none;
+ margin: 0;
+ /* 7em on the right for shortcut. */
+ min-width: 7em;
+ padding: 6px 15px;
+ white-space: nowrap;
+}
+
+/* State: disabled. */
+.blocklyMenuItemDisabled {
+ color: #ccc;
+ cursor: inherit;
+}
+
+/* State: hover. */
+.blocklyMenuItemHighlight {
+ background-color: rgba(0,0,0,.1);
+}
+
+/* State: selected/checked. */
+.blocklyMenuItemCheckbox {
+ height: 16px;
+ position: absolute;
+ width: 16px;
+}
+
+.blocklyMenuItemSelected .blocklyMenuItemCheckbox {
+ background: url(<<>>/sprites.png) no-repeat -48px -16px;
+ float: left;
+ margin-left: -24px;
+ position: static; /* Scroll with the menu. */
+}
+
+.blocklyMenuItemRtl .blocklyMenuItemCheckbox {
+ float: right;
+ margin-right: -24px;
+}
+`,Mp={};Mp.inject=gd,Mp.register=cs;var Bt=class{constructor(e,t,i,r){this.top=e,this.bottom=t,this.left=i,this.right=r}getHeight(){return this.bottom-this.top}getWidth(){return this.right-this.left}contains(e,t){return e>=this.left&&e<=this.right&&t>=this.top&&t<=this.bottom}intersects(e){return!(this.left>e.right||this.righte.bottom||this.bottom{this.disposed_||(this.textarea.focus(),this.addFocus(),this.svgRectTarget&&I(this.svgRectTarget,"blocklyCommentTargetFocused"),this.svgHandleTarget&&I(this.svgHandleTarget,"blocklyCommentHandleTargetFocused"))},0)}blurFocus(){this.focused=!1,setTimeout(()=>{this.disposed_||(this.textarea.blur(),this.removeFocus(),this.svgRectTarget&&A(this.svgRectTarget,"blocklyCommentTargetFocused"),this.svgHandleTarget&&A(this.svgHandleTarget,"blocklyCommentHandleTargetFocused"))},0)}static fromXmlRendered(e,t,i){s.disable$$module$build$src$core$events$utils();let r;try{const c=Hs.parseAttributes(e);if(r=new yo(t,c.content,c.h,c.w,c.id),t.rendered&&(r.initSvg(!0),r.render()),!isNaN(c.x)&&!isNaN(c.y))if(t.RTL){const $=i||t.getWidth();r.moveBy($-c.x,c.y)}else r.moveBy(c.x,c.y)}finally{s.enable$$module$build$src$core$events$utils()}return Hs.fireCreateEvent(r),r}};yo.DEFAULT_SIZE=100,yo.TOP_OFFSET=10,cs(`
+.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;
+}
+
+.blocklyCommentDeleteIcon {
+ cursor: pointer;
+ fill: #000;
+ display: none;
+}
+
+.blocklySelected > .blocklyCommentDeleteIcon {
+ display: block;
+}
+
+.blocklyDeleteIconShape {
+ fill: #000;
+ stroke: #000;
+ stroke-width: 1px;
+}
+
+.blocklyDeleteIconShape.blocklyDeleteIconHighlighted {
+ stroke: #fc3;
+}
+`);var Fa=new Set,Ua=new WeakSet,Ar=null,Dp=null,Km=0,Ha={};Ha.finishQueuedRenders=cr,Ha.queueRender=Id,Ha.triggerQueuedRenders=Ds;var Ho={};Ho.appendDomToWorkspace=Bg,Ho.blockToDom=Ni,Ho.blockToDomWithXY=Ol,Ho.clearWorkspaceAndLoadFromXml=xg,Ho.deleteNext=jg,Ho.domToBlock=s.domToBlock$$module$build$src$core$xml,Ho.domToBlockInternal=wi,Ho.domToPrettyText=Pg,Ho.domToText=Ps,Ho.domToVariables=Ld,Ho.domToWorkspace=s.domToWorkspace$$module$build$src$core$xml,Ho.variablesToDom=kd,Ho.workspaceToDom=wg;var Lr=class extends Error{},Qm=class extends Lr{constructor(e){super("Expected to find a 'type' property, defining the block type"),this.state=e}},Vl=class extends Lr{constructor(e,t,i){super(`The block ${t.toDevString()} is missing a(n) ${e}
+connection`),this.block=t,this.state=i}},qm=class extends Lr{constructor(e,t,i,r){super(`The block ${i.toDevString()} could not connect its
+${t} to its parent, because: ${e}`),this.childBlock=i,this.childState=r}},Jm=class extends Lr{constructor(e){super(`Encountered a real block which is defined as a child of a shadow
+block. It is an invariant of Blockly that shadow blocks only have shadow
+children`),this.state=e}},Zm=class extends Lr{constructor(e,t,i){super(`Cannot add an icon of type '${e}' to the block ${t.toDevString()}, because there is no icon registered with type '${e}'. Make sure that all of your icons have been registered.`),this.block=t,this.state=i}},Cn={};Cn.BadConnectionCheck=qm,Cn.DeserializationError=Lr,Cn.MissingBlockType=Qm,Cn.MissingConnection=Vl,Cn.RealChildOfShadow=Jm,Cn.UnregisteredIcon=Zm;var eT=100,tT=75,oT=50,Va={};Va.BLOCKS=oT,Va.PROCEDURES=tT,Va.VARIABLES=eT;var Pp={};Pp.register=jc,Pp.unregister=Yg;var sT=class{constructor(){this.priority=oT}save(e){const t=[];for(const i of e.getTopBlocks(!1))(e=xs(i,{addCoordinates:!0,doFullSerialization:!1}))&&t.push(e);return t.length?{languageVersion:0,blocks:t}:null}load(e,t){e=e.blocks;for(const i of e)_n(i,t,{recordUndo:ke()})}clear(e){for(const t of e.getTopBlocks(!1))t.dispose(!1)}};jc("blocks",new sT);var Gl={};Gl.BlockSerializer=sT,Gl.append=_n,Gl.appendInternal=Cl,Gl.save=xs;var yn=class extends Rr{constructor(e){super(),this.isBlank=!e,e&&(this.blockId=e.id,this.workspaceId=e.workspace.id)}toJson(){const e=super.toJson();if(!this.blockId)throw Error("The block ID is undefined. Either pass a block to the constructor, or call fromJson");return e.blockId=this.blockId,e}static fromJson(e,t,i){return t=super.fromJson(e,t,i??new yn),t.blockId=e.blockId,t}},xp=class extends yn{constructor(e){super(e),this.type=s.CREATE$$module$build$src$core$events$utils,e&&(e.isShadow()&&(this.recordUndo=!1),this.xml=Ol(e),this.ids=Xe(e),this.json=xs(e,{addCoordinates:!0}))}toJson(){const e=super.toJson();if(!this.xml)throw Error("The block XML is undefined. Either pass a block to the constructor, or call fromJson");if(!this.ids)throw Error("The block IDs are undefined. Either pass a block to the constructor, or call fromJson");if(!this.json)throw Error("The block JSON is undefined. Either pass a block to the constructor, or call fromJson");return e.xml=Ps(this.xml),e.ids=this.ids,e.json=this.json,this.recordUndo||(e.recordUndo=this.recordUndo),e}static fromJson(e,t,i){return t=super.fromJson(e,t,i??new xp),t.xml=s.textToDom$$module$build$src$core$utils$xml(e.xml),t.ids=e.ids,t.json=e.json,e.recordUndo!==void 0&&(t.recordUndo=e.recordUndo),t}run(e){const t=this.getEventWorkspace_();if(!this.json)throw Error("The block JSON is undefined. Either pass a block to the constructor, or call fromJson");if(!this.ids)throw Error("The block IDs are undefined. Either pass a block to the constructor, or call fromJson");if(e)_n(this.json,t);else for(e=0;e")),re(new Sn(t,"mutation",null,i,e));break;default:console.warn("Unknown change type: "+this.element)}}static getExtraBlockState_(e){return e.saveExtraState?(e=e.saveExtraState())?JSON.stringify(e):"":e.mutationToDom&&(e=e.mutationToDom())?Ps(e):""}};l(Ae.EVENT,s.CHANGE$$module$build$src$core$events$utils,Sn);var Bp=class extends yn{constructor(e){if(super(e),this.type=s.DELETE$$module$build$src$core$events$utils,e){if(e.getParent())throw Error("Connected blocks cannot be deleted.");e.isShadow()&&(this.recordUndo=!1),this.oldXml=Ol(e),this.ids=Xe(e),this.wasShadow=e.isShadow(),this.oldJson=xs(e,{addCoordinates:!0})}}toJson(){const e=super.toJson();if(!this.oldXml)throw Error("The old block XML is undefined. Either pass a block to the constructor, or call fromJson");if(!this.ids)throw Error("The block IDs are undefined. Either pass a block to the constructor, or call fromJson");if(this.wasShadow===void 0)throw Error("Whether the block was a shadow is undefined. Either pass a block to the constructor, or call fromJson");if(!this.oldJson)throw Error("The old block JSON is undefined. Either pass a block to the constructor, or call fromJson");return e.oldXml=Ps(this.oldXml),e.ids=this.ids,e.wasShadow=this.wasShadow,e.oldJson=this.oldJson,this.recordUndo||(e.recordUndo=this.recordUndo),e}static fromJson(e,t,i){return t=super.fromJson(e,t,i??new Bp),t.oldXml=s.textToDom$$module$build$src$core$utils$xml(e.oldXml),t.ids=e.ids,t.wasShadow=e.wasShadow||t.oldXml.tagName.toLowerCase()==="shadow",t.oldJson=e.oldJson,e.recordUndo!==void 0&&(t.recordUndo=e.recordUndo),t}run(e){const t=this.getEventWorkspace_();if(!this.ids)throw Error("The block IDs are undefined. Either pass a block to the constructor, or call fromJson");if(!this.oldJson)throw Error("The old block JSON is undefined. Either pass a block to the constructor, or call fromJson");if(e)for(e=0;ec.top?Xd(i,r,c,$):t+$.heightdocument.documentElement.clientTop?Xd(i,r,c,$):gf(e,c,$)}},so={};so.ANIMATION_TIME=za,so.ARROW_HORIZONTAL_PADDING=lT,so.ARROW_SIZE=Wl,so.BORDER_SIZE=Up,so.PADDING_Y=Hp,so.TEST_ONLY=Wp,so.clearContent=Yc,so.createDom=Bd,so.getContentDiv=dr,so.getOwner=Ud,so.getPositionX=Sl,so.hide=Qc,so.hideIfOwner=hr,so.hideWithoutAnimation=fs,so.isVisible=jd,so.repositionForWindowResize=Kd,so.setBoundsElement=Fd,so.setColour=Kc,so.show=Wd,so.showPositionedByBlock=_f,so.showPositionedByField=yl;var zl=class{constructor(e){this.workspace=e,this.cursorSvg_=this.cursor_=null,this.markers=new Map,this.markerSvg_=null}registerMarker(e,t){this.markers.has(e)&&this.unregisterMarker(e),t.setDrawer(this.workspace.getRenderer().makeMarkerDrawer(this.workspace,t)),this.setMarkerSvg(t.getDrawer().createDom()),this.markers.set(e,t)}unregisterMarker(e){const t=this.markers.get(e);if(t)t.dispose(),this.markers.delete(e);else throw Error("Marker with ID "+e+" does not exist. Can only unregister markers that exist.")}getCursor(){return this.cursor_}getMarker(e){return this.markers.get(e)||null}setCursor(e){this.cursor_&&this.cursor_.getDrawer()&&this.cursor_.getDrawer().dispose(),(this.cursor_=e)&&(e=this.workspace.getRenderer().makeMarkerDrawer(this.workspace,this.cursor_),this.cursor_.setDrawer(e),this.setCursorSvg(this.cursor_.getDrawer().createDom()))}setCursorSvg(e){e?(this.workspace.getBlockCanvas().appendChild(e),this.cursorSvg_=e):this.cursorSvg_=null}setMarkerSvg(e){e?this.workspace.getBlockCanvas()&&(this.cursorSvg_?this.workspace.getBlockCanvas().insertBefore(e,this.cursorSvg_):this.workspace.getBlockCanvas().appendChild(e)):this.markerSvg_=null}updateMarkers(){this.workspace.keyboardAccessibilityMode&&this.cursorSvg_&&this.workspace.getCursor().draw()}dispose(){const e=Object.keys(this.markers);for(let t=0,i;i=e[t];t++)this.unregisterMarker(i);this.markers.clear(),this.cursor_&&(this.cursor_.dispose(),this.cursor_=null)}};zl.LOCAL_MARKER="local_marker_1";var An={};An.commonWordPrefix=Qd,An.commonWordSuffix=qd,An.isNumber=s.isNumber$$module$build$src$core$utils$string,An.shortestStringLength=Rl,An.startsWith=ff,An.wrap=s.wrap$$module$build$src$core$utils$string;var Xa=void 0,Xl=!1,Pr=!1,aT=50,uT=0,Ln=0,zp=0,Xp=0,ds=null,jl=null,jp=0,Yp=10,dT=10,hT=750,ja=5,ro=null,$o={};$o.HOVER_MS=hT,$o.LIMIT=aT,$o.MARGINS=ja,$o.OFFSET_X=jp,$o.OFFSET_Y=Yp,$o.RADIUS_OK=dT,$o.bindMouseEvents=kl,$o.block=ih,$o.createDom=eh,$o.dispose=sh,$o.getCustomTooltip=bf,$o.getDiv=If,$o.getTooltipOfObject=pr,$o.hide=ni,$o.isVisible=vf,$o.setCustomTooltip=Ef,$o.unbindMouseEvents=th,$o.unblock=nh;var Kp=.45,Qp=.65,pT={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"},So={};So.blend=gn,So.getHsvSaturation=rh,So.getHsvValue=lh,So.hexToRgb=Jc,So.hsvToHex=Zc,So.hueToHex=ch,So.names=pT,So.parse=Di,So.rgbToHex=Al,So.setHsvSaturation=Af,So.setHsvValue=Lf;var Yl={};Yl.checkMessageReferences=ta,Yl.parseBlockColour=$r,Yl.replaceMessageReferences=Zt,Yl.tokenizeInterpolation=ah;var xr=null,Ya=null,Br="",Fr="",bs,Gs={};Gs.createDom=uh,Gs.getDiv=fn,Gs.hide=as,Gs.hideIfOwner=sa,Gs.isVisible=dh,Gs.positionWithAnchor=ph,Gs.repositionForWindowResize=$h,Gs.show=oa,Gs.testOnly_setDiv=Nf;var bt=class{constructor(e,t,i){this.DEFAULT_VALUE=null,this.name=void 0,this.constants_=this.mouseDownWrapper_=this.textContent_=this.textElement_=this.borderRect_=this.fieldGroup_=this.markerSvg_=this.cursorSvg_=this.tooltip_=this.validator_=null,this.disposed=!1,this.maxDisplayLength=50,this.sourceBlock_=null,this.enabled_=this.visible_=this.isDirty_=!0,this.suffixField=this.prefixField=this.clickTarget_=null,this.EDITABLE=!0,this.SERIALIZABLE=!1,this.CURSOR="",this.value_="DEFAULT_VALUE"in new.target.prototype?new.target.prototype.DEFAULT_VALUE:this.DEFAULT_VALUE,this.size_=new Vt(0,0),e!==bt.SKIP_SETUP&&(i&&this.configure_(i),this.setValue(e),t&&this.setValidator(t))}configure_(e){e.tooltip&&this.setTooltip(Zt(e.tooltip))}setSourceBlock(e){if(this.sourceBlock_)throw Error("Field already bound to a block");this.sourceBlock_=e}getConstants(){return!this.constants_&&this.sourceBlock_&&!this.sourceBlock_.isDeadOrDying()&&this.sourceBlock_.workspace.rendered&&(this.constants_=this.sourceBlock_.workspace.getRenderer().getConstants()),this.constants_}getSourceBlock(){return this.sourceBlock_}init(){this.fieldGroup_||(this.fieldGroup_=w(te.G,{}),this.isVisible()||(this.fieldGroup_.style.display="none"),this.sourceBlock_.getSvgRoot().appendChild(this.fieldGroup_),this.initView(),this.updateEditable(),this.setTooltip(this.tooltip_),this.bindEvents_(),this.initModel())}initView(){this.createBorderRect_(),this.createTextElement_()}initModel(){}createBorderRect_(){this.borderRect_=w(te.RECT,{rx:this.getConstants().FIELD_BORDER_RECT_RADIUS,ry:this.getConstants().FIELD_BORDER_RECT_RADIUS,x:0,y:0,height:this.size_.height,width:this.size_.width,class:"blocklyFieldRect"},this.fieldGroup_)}createTextElement_(){this.textElement_=w(te.TEXT,{class:"blocklyText"},this.fieldGroup_),this.getConstants().FIELD_TEXT_BASELINE_CENTER&&this.textElement_.setAttribute("dominant-baseline","central"),this.textContent_=document.createTextNode(""),this.textElement_.appendChild(this.textContent_)}bindEvents_(){const e=this.getClickTarget_();if(!e)throw Error("A click target has not been set.");kl(e),this.mouseDownWrapper_=Be(e,"pointerdown",this,this.onMouseDown_)}fromXml(e){this.setValue(e.textContent)}toXml(e){return e.textContent=this.getValue(),e}saveState(e){return e=this.saveLegacyState(bt),e!==null?e:this.getValue()}loadState(e){this.loadLegacyState(bt,e)||this.setValue(e)}saveLegacyState(e){return e.prototype.saveState===this.saveState&&e.prototype.toXml!==this.toXml?(e=s.createElement$$module$build$src$core$utils$xml("field"),e.setAttribute("name",this.name||""),ht(this.toXml(e)).replace(' xmlns="https://developers.google.com/blockly/xml"',"")):null}loadLegacyState(e,t){return e.prototype.loadState===this.loadState&&e.prototype.fromXml!==this.fromXml?(this.fromXml(s.textToDom$$module$build$src$core$utils$xml(t)),!0):!1}dispose(){hr(this),sa(this);let e;(e=this.getSourceBlock())!=null&&e.isDeadOrDying()||U(this.fieldGroup_),this.disposed=!0}updateEditable(){const e=this.fieldGroup_,t=this.getSourceBlock();this.EDITABLE&&e&&t&&(this.enabled_&&t.isEditable()?(I(e,"blocklyEditableText"),A(e,"blocklyNonEditableText"),e.style.cursor=this.CURSOR):(I(e,"blocklyNonEditableText"),A(e,"blocklyEditableText"),e.style.cursor=""))}setEnabled(e){this.enabled_=e,this.updateEditable()}isEnabled(){return this.enabled_}isClickable(){return this.enabled_&&!!this.sourceBlock_&&this.sourceBlock_.isEditable()&&this.showEditor_!==bt.prototype.showEditor_}isCurrentlyEditable(){return this.enabled_&&this.EDITABLE&&!!this.sourceBlock_&&this.sourceBlock_.isEditable()}isSerializable(){let e=!1;return this.name&&(this.SERIALIZABLE?e=!0:this.EDITABLE&&(console.warn("Detected an editable field that was not serializable. Please define SERIALIZABLE property as true on all editable custom fields. Proceeding with serialization."),e=!0)),e}isVisible(){return this.visible_}setVisible(e){if(this.visible_!==e){this.visible_=e;var t=this.fieldGroup_;t&&(t.style.display=e?"block":"none")}}setValidator(e){this.validator_=e}getValidator(){return this.validator_}getSvgRoot(){return this.fieldGroup_}getBorderRect(){if(!this.borderRect_)throw Error(`The border rectangle is ${this.borderRect_}.`);return this.borderRect_}getTextElement(){if(!this.textElement_)throw Error(`The text element is ${this.textElement_}.`);return this.textElement_}getTextContent(){if(!this.textContent_)throw Error(`The text content is ${this.textContent_}.`);return this.textContent_}applyColour(){}render_(){this.textContent_&&(this.textContent_.nodeValue=this.getDisplayText_()),this.updateSize_()}showEditor(e){this.isClickable()&&this.showEditor_(e)}showEditor_(e){}repositionForWindowResize(){return!1}updateSize_(e){const t=this.getConstants();e=e!==void 0?e:this.borderRect_?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0;let i=2*e,r=t.FIELD_TEXT_HEIGHT,c=0;this.textElement_&&(c=Ne(this.textElement_,t.FIELD_TEXT_FONTSIZE,t.FIELD_TEXT_FONTWEIGHT,t.FIELD_TEXT_FONTFAMILY),i+=c),this.borderRect_&&(r=Math.max(r,t.FIELD_BORDER_RECT_HEIGHT)),this.size_.height=r,this.size_.width=i,this.positionTextElement_(e,c),this.positionBorderRect_()}positionTextElement_(e,t){if(this.textElement_){var i=this.getConstants(),r=this.size_.height/2,c;this.textElement_.setAttribute("x",String((c=this.getSourceBlock())!=null&&c.RTL?this.size_.width-t-e:e)),this.textElement_.setAttribute("y",String(i.FIELD_TEXT_BASELINE_CENTER?r:r-i.FIELD_TEXT_HEIGHT/2+i.FIELD_TEXT_BASELINE))}}positionBorderRect_(){this.borderRect_&&(this.borderRect_.setAttribute("width",String(this.size_.width)),this.borderRect_.setAttribute("height",String(this.size_.height)),this.borderRect_.setAttribute("rx",String(this.getConstants().FIELD_BORDER_RECT_RADIUS)),this.borderRect_.setAttribute("ry",String(this.getConstants().FIELD_BORDER_RECT_RADIUS)))}getSize(){return this.isVisible()?(this.isDirty_?(this.render_(),this.isDirty_=!1):this.visible_&&this.size_.width===0&&(this.render_(),this.size_.width!==0&&console.warn("Deprecated use of setting size_.width to 0 to rerender a field. Set field.isDirty_ to true instead.")),this.size_):new Vt(0,0)}getScaledBBox(){let e;var t=this.getSourceBlock();if(!t)throw new io;if(this.borderRect_){var i=this.borderRect_.getBoundingClientRect();e=Li(this.borderRect_),t=i.width,i=i.height}else{i=this.sourceBlock_.getHeightWidth();const r=t.workspace.scale;e=this.getAbsoluteXY_(),t=(i.width+1)*r,i=(i.height+1)*r,kp?(e.x+=1.5*r,e.y+=1.5*r):(e.x-=.5*r,e.y-=.5*r)}return new Bt(e.y,e.y+i,e.x,e.x+t)}getDisplayText_(){let e=this.getText();return e?(e.length>this.maxDisplayLength&&(e=e.substring(0,this.maxDisplayLength-2)+"…"),e=e.replace(/\s/g,bt.NBSP),this.sourceBlock_&&this.sourceBlock_.RTL&&(e+=""),e):bt.NBSP}getText(){const e=this.getText_();return String(e!==null?e:this.getValue())}getText_(){return null}markDirty(){this.isDirty_=!0,this.constants_=null}forceRerender(){this.isDirty_=!0,this.sourceBlock_&&this.sourceBlock_.rendered&&(this.sourceBlock_.queueRender(),this.sourceBlock_.bumpNeighbours())}setValue(e,t=!0){if(e!==null){var i=this.doClassValidation_(e);if(e=this.processValidation_(e,i),!(e instanceof Error)){var r;i=(r=this.getValidator())==null?void 0:r.call(this,e),r=this.processValidation_(e,i),r instanceof Error||(e=this.sourceBlock_,e&&e.disposed||(i=this.getValue(),i===r?this.doValueUpdate_(r):(this.doValueUpdate_(r),t&&e&&_e()&&re(new(we(s.CHANGE$$module$build$src$core$events$utils))(e,"field",this.name||null,i,r)),this.isDirty_&&this.forceRerender())))}}}processValidation_(e,t){return t===null?(this.doValueInvalid_(e),this.isDirty_&&this.forceRerender(),Error()):t===void 0?e:t}getValue(){return this.value_}doClassValidation_(e){return e??null}doValueUpdate_(e){this.value_=e,this.isDirty_=!0}doValueInvalid_(e){}onMouseDown_(e){this.sourceBlock_&&!this.sourceBlock_.isDeadOrDying()&&(e=this.sourceBlock_.workspace.getGesture(e))&&e.setStartField(this)}setTooltip(e){e||e===""||(e=this.sourceBlock_);const t=this.getClickTarget_();t?t.tooltip=e:this.tooltip_=e}getTooltip(){const e=this.getClickTarget_();return pr(e||{tooltip:this.tooltip_})}getClickTarget_(){return this.clickTarget_||this.getSvgRoot()}getAbsoluteXY_(){return Li(this.getClickTarget_())}referencesVariables(){return!1}refreshVariableName(){}getParentInput(){let e=null;const t=this.getSourceBlock();if(!t)throw new io;const i=t.inputList;for(let r=0;re?this.menuItems.length:e,-1)}highlightFirst(){this.highlightHelper(-1,1)}highlightLast(){this.highlightHelper(this.menuItems.length,-1)}highlightHelper(e,t){e+=t;let i;for(;i=this.menuItems[e];){if(i.isEnabled()){this.setHighlighted(i);break}e+=t}}handleMouseOver(e){(e=this.getMenuItem(e.target))&&(e.isEnabled()?this.highlightedItem!==e&&this.setHighlighted(e):this.setHighlighted(null))}handleClick(e){const t=this.openingCoords;if(this.openingCoords=null,t&&typeof e.clientX=="number"){const i=new Ue(e.clientX,e.clientY);if(1>Ue.distance(t,i))return}(e=this.getMenuItem(e.target))&&e.performAction()}handleMouseEnter(e){this.focus()}handleMouseLeave(e){this.getElement()&&(this.blur(),this.setHighlighted(null))}handleKeyEvent(e){if(this.menuItems.length&&!(e.shiftKey||e.ctrlKey||e.metaKey||e.altKey)){var t=this.highlightedItem;switch(e.key){case"Enter":case" ":t&&t.performAction();break;case"ArrowUp":this.highlightPrevious();break;case"ArrowDown":this.highlightNext();break;case"PageUp":case"Home":this.highlightFirst();break;case"PageDown":case"End":this.highlightLast();break;default:return}e.preventDefault(),e.stopPropagation()}}getSize(){const e=this.getElement(),t=Il(e);return t.height=e.scrollHeight,t}},Jp=class{constructor(e,t){this.content=e,this.opt_value=t,this.enabled=!0,this.element=null,this.rightToLeft=!1,this.roleName=null,this.highlight=this.checked=this.checkable=!1,this.actionHandler=null}createDom(){const e=document.createElement("div");e.id=$e(),this.element=e,e.className="blocklyMenuItem goog-menuitem "+(this.enabled?"":"blocklyMenuItemDisabled goog-menuitem-disabled ")+(this.checked?"blocklyMenuItemSelected goog-option-selected ":"")+(this.highlight?"blocklyMenuItemHighlight goog-menuitem-highlight ":"")+(this.rightToLeft?"blocklyMenuItemRtl goog-menuitem-rtl ":"");const t=document.createElement("div");if(t.className="blocklyMenuItemContent goog-menuitem-content",this.checkable){var i=document.createElement("div");i.className="blocklyMenuItemCheckbox goog-menuitem-checkbox",t.appendChild(i)}return i=this.content,typeof this.content=="string"&&(i=document.createTextNode(this.content)),t.appendChild(i),e.appendChild(t),this.roleName&&ms(e,this.roleName),Xt(e,Gt.SELECTED,this.checkable&&this.checked||!1),Xt(e,Gt.DISABLED,!this.enabled),e}dispose(){this.element=null}getElement(){return this.element}getId(){return this.element.id}getValue(){let e;return(e=this.opt_value)!=null?e:null}setRightToLeft(e){this.rightToLeft=e}setRole(e){this.roleName=e}setCheckable(e){this.checkable=e}setChecked(e){this.checked=e}setHighlighted(e){this.highlight=e;const t=this.getElement();t&&this.isEnabled()&&(e?(I(t,"blocklyMenuItemHighlight"),I(t,"goog-menuitem-highlight")):(A(t,"blocklyMenuItemHighlight"),A(t,"goog-menuitem-highlight")))}isEnabled(){return this.enabled}setEnabled(e){this.enabled=e}performAction(){this.isEnabled()&&this.actionHandler&&this.actionHandler(this)}onAction(e,t){this.actionHandler=e.bind(t)}},Ws=class extends bt{constructor(e,t,i){super(bt.SKIP_SETUP),this.svgArrow=this.arrow=this.imageElement=this.menu_=this.selectedMenuItem=null,this.SERIALIZABLE=!0,this.CURSOR="default",this.clickTarget_=this.suffixField=this.prefixField=this.generatedOptions=null,e!==bt.SKIP_SETUP&&(Array.isArray(e)?(_h(e),e=Bf(e),this.menuGenerator_=e.options,this.prefixField=e.prefix||null,this.suffixField=e.suffix||null):this.menuGenerator_=e,this.selectedOption=this.getOptions(!1)[0],i&&this.configure_(i),this.setValue(this.selectedOption[1]),t&&this.setValidator(t))}fromXml(e){this.isOptionListDynamic()&&this.getOptions(!1),this.setValue(e.textContent)}loadState(e){this.loadLegacyState(Ws,e)||(this.isOptionListDynamic()&&this.getOptions(!1),this.setValue(e))}initView(){this.shouldAddBorderRect_()?this.createBorderRect_():this.clickTarget_=this.sourceBlock_.getSvgRoot(),this.createTextElement_(),this.imageElement=w(te.IMAGE,{},this.fieldGroup_),this.getConstants().FIELD_DROPDOWN_SVG_ARROW?this.createSVGArrow_():this.createTextArrow_(),this.borderRect_&&I(this.borderRect_,"blocklyDropdownRect")}shouldAddBorderRect_(){let e;return!this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW||this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW&&!((e=this.getSourceBlock())!=null&&e.isShadow())}createTextArrow_(){this.arrow=w(te.TSPAN,{},this.textElement_);let e;this.arrow.appendChild(document.createTextNode((e=this.getSourceBlock())!=null&&e.RTL?Ws.ARROW_CHAR+" ":" "+Ws.ARROW_CHAR));let t;(t=this.getSourceBlock())!=null&&t.RTL?this.getTextElement().insertBefore(this.arrow,this.textContent_):this.getTextElement().appendChild(this.arrow)}createSVGArrow_(){this.svgArrow=w(te.IMAGE,{height:this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE+"px",width:this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE+"px"},this.fieldGroup_),this.svgArrow.setAttributeNS(us,"xlink:href",this.getConstants().FIELD_DROPDOWN_SVG_ARROW_DATAURI)}showEditor_(e){var t=this.getSourceBlock();if(!t)throw new io;this.dropdownCreate(),this.menu_.openingCoords=e&&typeof e.clientX=="number"?new Ue(e.clientX,e.clientY):null,Yc(),e=this.menu_.render(dr()),I(e,"blocklyDropdownMenu"),this.getConstants().FIELD_DROPDOWN_COLOURED_DIV&&(e=t.isShadow()?t.getParent().getColour():t.getColour(),t=t.isShadow()?t.getParent().style.colourTertiary:this.sourceBlock_.style.colourTertiary,Kc(e,t)),yl(this,this.dropdownDispose_.bind(this)),this.menu_.focus(),this.selectedMenuItem&&(this.menu_.setHighlighted(this.selectedMenuItem),Wc(this.selectedMenuItem.getElement(),dr(),!0)),this.applyColour()}dropdownCreate(){const e=this.getSourceBlock();if(!e)throw new io;const t=new qp;t.setRole(Vo.LISTBOX),this.menu_=t;const i=this.getOptions(!1);this.selectedMenuItem=null;for(let c=0;ct[1]===e)?e:(this.sourceBlock_&&console.warn("Cannot set the dropdown's value to an unavailable option. Block type: "+this.sourceBlock_.type+", Field name: "+this.name+", Value: "+e),null)}doValueUpdate_(e){super.doValueUpdate_(e),e=this.getOptions(!0);for(let t=0,i;i=e[t];t++)i[1]===this.value_&&(this.selectedOption=i)}applyColour(){const e=this.sourceBlock_.style;this.borderRect_&&(this.borderRect_.setAttribute("stroke",e.colourTertiary),this.menu_?this.borderRect_.setAttribute("fill",e.colourTertiary):this.borderRect_.setAttribute("fill","transparent")),this.sourceBlock_&&this.arrow&&(this.sourceBlock_.isShadow()?this.arrow.style.fill=e.colourSecondary:this.arrow.style.fill=e.colourPrimary)}render_(){this.getTextContent().nodeValue="",this.imageElement.style.display="none";const e=this.selectedOption&&this.selectedOption[0];e&&typeof e=="object"?this.renderSelectedImage(e):this.renderSelectedText(),this.positionBorderRect_()}renderSelectedImage(e){const t=this.getSourceBlock();if(!t)throw new io;this.imageElement.style.display="",this.imageElement.setAttributeNS(us,"xlink:href",e.src),this.imageElement.setAttribute("height",String(e.height)),this.imageElement.setAttribute("width",String(e.width));const i=Number(e.height);e=Number(e.width);var r=!!this.borderRect_;const c=Math.max(r?this.getConstants().FIELD_DROPDOWN_BORDER_RECT_HEIGHT:0,i+SS);r=r?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0;let $;$=this.svgArrow?this.positionSVGArrow(e+r,c/2-this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE/2):Ne(this.arrow,this.getConstants().FIELD_TEXT_FONTSIZE,this.getConstants().FIELD_TEXT_FONTWEIGHT,this.getConstants().FIELD_TEXT_FONTFAMILY),this.size_.width=e+$+2*r,this.size_.height=c;let v=0;t.RTL?this.imageElement.setAttribute("x",`${r+$}`):(v=e+$,this.getTextElement().setAttribute("text-anchor","end"),this.imageElement.setAttribute("x",`${r}`)),this.imageElement.setAttribute("y",String(c/2-i/2)),this.positionTextElement_(v+r,e+$)}renderSelectedText(){this.getTextContent().nodeValue=this.getDisplayText_();var e=this.getTextElement();I(e,"blocklyDropdownText"),e.setAttribute("text-anchor","start");var t=!!this.borderRect_;e=Math.max(t?this.getConstants().FIELD_DROPDOWN_BORDER_RECT_HEIGHT:0,this.getConstants().FIELD_TEXT_HEIGHT);const i=Ne(this.getTextElement(),this.getConstants().FIELD_TEXT_FONTSIZE,this.getConstants().FIELD_TEXT_FONTWEIGHT,this.getConstants().FIELD_TEXT_FONTFAMILY);t=t?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0;let r=0;this.svgArrow&&(r=this.positionSVGArrow(i+t,e/2-this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE/2)),this.size_.width=i+r+2*t,this.size_.height=e,this.positionTextElement_(t,i)}positionSVGArrow(e,t){if(!this.svgArrow)return 0;const i=this.getSourceBlock();if(!i)throw new io;const r=this.borderRect_?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0,c=this.getConstants().FIELD_DROPDOWN_SVG_ARROW_PADDING,$=this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE;return this.svgArrow.setAttribute("transform","translate("+(i.RTL?r:e+c)+","+t+")"),$+c}getText_(){if(!this.selectedOption)return null;const e=this.selectedOption[0];return typeof e=="object"?e.alt:e}static fromJson(e){if(!e.options)throw Error("options are required for the dropdown field. The options property must be assigned an array of [humanReadableValue, languageNeutralValue] tuples.");return new this(e.options,void 0,e)}};Ws.CHECKMARK_OVERHANG=25,Ws.MAX_MENU_HEIGHT_VH=.45,Ws.ARROW_CHAR="▾";var yS=5,SS=2*yS;Jo("field_dropdown",Ws);var Ka=class{constructor(e){this.sourceBlock=e,this.offsetInBlock=new Ue(0,0),this.workspaceLocation=new Ue(0,0),this.svgRoot=null}getType(){throw Error("Icons must implement getType")}initView(e){if(!this.svgRoot){var t=this.sourceBlock;this.svgRoot=w(te.G,{class:"blocklyIconGroup"}),t.getSvgRoot().appendChild(this.svgRoot),this.updateSvgRootOffset(),Be(this.svgRoot,"pointerdown",this,e)}}dispose(){U(this.svgRoot)}getWeight(){return-1}getSize(){return new Vt(0,0)}applyColour(){}updateEditable(){}updateCollapsed(){this.svgRoot&&(this.sourceBlock.isCollapsed()?this.svgRoot.style.display="none":this.svgRoot.style.display="block",Mi(this)&&this.setBubbleVisible(!1))}hideForInsertionMarker(){this.svgRoot&&(this.svgRoot.style.display="none")}isShownWhenCollapsed(){return!1}setOffsetInBlock(e){this.offsetInBlock=e,this.updateSvgRootOffset()}updateSvgRootOffset(){let e;(e=this.svgRoot)==null||e.setAttribute("transform",`translate(${this.offsetInBlock.x}, ${this.offsetInBlock.y})`)}onLocationChange(e){this.workspaceLocation=Ue.sum(e,this.offsetInBlock)}onClick(){}setVisible(e){xe("setVisible","v10","v11","setBubbleVisible"),Mi(this)&&this.setBubbleVisible(e)}},no=class{constructor(e,t,i,r,c){this.workspace=e,this.horizontal=t,this.oldHostMetrics=null,this.ratio=1,this.origin=new Ue(0,0),this.startDragHandle=this.handlePosition=this.handleLength=this.scrollbarLength=this.startDragMouse=0,this.containerVisible=this.isHandleVisible=!0,this.position=new Ue(0,0),this.onMouseMoveWrapper_=this.onMouseUpWrapper_=null,this.pair=i||!1,this.margin=c!==void 0?c:no.DEFAULT_SCROLLBAR_MARGIN,e="blocklyScrollbar"+(this.horizontal?"Horizontal":"Vertical"),r&&(e+=" "+r),this.outerSvg=w(te.SVG,{class:e}),r=w(te.G,{},this.outerSvg),this.svgBackground=w(te.RECT,{class:"blocklyScrollbarBackground"},r),e=Math.floor((no.scrollbarThickness-5)/2),this.svgHandle=w(te.RECT,{class:"blocklyScrollbarHandle",rx:e,ry:e},r),this.workspace.getThemeManager().subscribe(this.svgHandle,"scrollbarColour","fill"),this.workspace.getThemeManager().subscribe(this.svgHandle,"scrollbarOpacity","fill-opacity"),de(this.outerSvg,this.workspace.getParentSvg()),this.setInitialThickness(),t?(this.lengthAttribute_="width",this.positionAttribute_="x"):(this.lengthAttribute_="height",this.positionAttribute_="y"),this.onMouseDownBarWrapper_=Be(this.svgBackground,"pointerdown",this,this.onMouseDownBar),this.onMouseDownHandleWrapper_=Be(this.svgHandle,"pointerdown",this,this.onMouseDownHandle)}setInitialThickness(){const e=no.scrollbarThickness;this.horizontal?(this.svgBackground.setAttribute("height",String(e)),this.outerSvg.setAttribute("height",String(e)),this.svgHandle.setAttribute("height",String(e-5)),this.svgHandle.setAttribute("y","2.5")):(this.svgBackground.setAttribute("width",String(e)),this.outerSvg.setAttribute("width",String(e)),this.svgHandle.setAttribute("width",String(e-5)),this.svgHandle.setAttribute("x","2.5"))}dispose(){this.cleanUp(),Dt(this.onMouseDownBarWrapper_),Dt(this.onMouseDownHandleWrapper_),U(this.outerSvg),this.workspace.getThemeManager().unsubscribe(this.svgHandle)}constrainHandleLength(e){return e=0>=e||isNaN(e)?0:Math.min(e,this.scrollbarLength)}setHandleLength(e){this.handleLength=e,this.svgHandle.setAttribute(this.lengthAttribute_,String(this.handleLength))}constrainHandlePosition(e){return e=0>=e||isNaN(e)?0:Math.min(e,this.scrollbarLength-this.handleLength)}setHandlePosition(e){this.handlePosition=e,this.svgHandle.setAttribute(this.positionAttribute_,String(this.handlePosition))}setScrollbarLength(e){this.scrollbarLength=e,this.outerSvg.setAttribute(this.lengthAttribute_,String(this.scrollbarLength)),this.svgBackground.setAttribute(this.lengthAttribute_,String(this.scrollbarLength))}setPosition(e,t){this.position.x=e,this.position.y=t,se(this.outerSvg,"translate("+(this.position.x+this.origin.x)+"px,"+(this.position.y+this.origin.y)+"px)")}resize(e){!e&&(e=this.workspace.getMetrics(),!e)||this.oldHostMetrics&&no.metricsAreEquivalent(e,this.oldHostMetrics)||(this.horizontal?this.resizeHorizontal(e):this.resizeVertical(e),this.oldHostMetrics=e,this.updateMetrics())}requiresViewResize(e){return this.oldHostMetrics?this.oldHostMetrics.viewWidth!==e.viewWidth||this.oldHostMetrics.viewHeight!==e.viewHeight||this.oldHostMetrics.absoluteLeft!==e.absoluteLeft||this.oldHostMetrics.absoluteTop!==e.absoluteTop:!0}resizeHorizontal(e){this.requiresViewResize(e)?this.resizeViewHorizontal(e):this.resizeContentHorizontal(e)}resizeViewHorizontal(e){var t=e.viewWidth-2*this.margin;this.pair&&(t-=no.scrollbarThickness),this.setScrollbarLength(Math.max(0,t)),t=e.absoluteLeft+this.margin,this.pair&&this.workspace.RTL&&(t+=no.scrollbarThickness),this.setPosition(t,e.absoluteTop+e.viewHeight-no.scrollbarThickness-this.margin),this.resizeContentHorizontal(e)}resizeContentHorizontal(e){if(e.viewWidth>=e.scrollWidth)this.setHandleLength(this.scrollbarLength),this.setHandlePosition(0),this.pair||this.setVisible(!1);else{this.pair||this.setVisible(!0);var t=this.scrollbarLength*e.viewWidth/e.scrollWidth;t=this.constrainHandleLength(t),this.setHandleLength(t),t=e.scrollWidth-e.viewWidth;var i=this.scrollbarLength-this.handleLength;e=(e.viewLeft-e.scrollLeft)/t*i,e=this.constrainHandlePosition(e),this.setHandlePosition(e),this.ratio=i/t}}resizeVertical(e){this.requiresViewResize(e)?this.resizeViewVertical(e):this.resizeContentVertical(e)}resizeViewVertical(e){let t=e.viewHeight-2*this.margin;this.pair&&(t-=no.scrollbarThickness),this.setScrollbarLength(Math.max(0,t)),this.setPosition(this.workspace.RTL?e.absoluteLeft+this.margin:e.absoluteLeft+e.viewWidth-no.scrollbarThickness-this.margin,e.absoluteTop+this.margin),this.resizeContentVertical(e)}resizeContentVertical(e){if(e.viewHeight>=e.scrollHeight)this.setHandleLength(this.scrollbarLength),this.setHandlePosition(0),this.pair||this.setVisible(!1);else{this.pair||this.setVisible(!0);var t=this.scrollbarLength*e.viewHeight/e.scrollHeight;t=this.constrainHandleLength(t),this.setHandleLength(t),t=e.scrollHeight-e.viewHeight;var i=this.scrollbarLength-this.handleLength;e=(e.viewTop-e.scrollTop)/t*i,e=this.constrainHandlePosition(e),this.setHandlePosition(e),this.ratio=i/t}}isVisible(){return this.isHandleVisible}setContainerVisible(e){const t=e!==this.containerVisible;this.containerVisible=e,t&&this.updateDisplay_()}setVisible(e){if(this.pair)throw Error("Unable to toggle visibility of paired scrollbars.");this.setVisibleInternal(e)}setVisibleInternal(e){const t=e!==this.isVisible();this.isHandleVisible=e,t&&this.updateDisplay_()}updateDisplay_(){this.containerVisible&&this.isVisible()?this.outerSvg.setAttribute("display","block"):this.outerSvg.setAttribute("display","none")}onMouseDownBar(e){if(this.workspace.markFocused(),Ge(),this.cleanUp(),Ai(e))e.stopPropagation();else{var t=pn(e,this.workspace.getParentSvg(),this.workspace.getInverseScreenCTM());t=this.horizontal?t.x:t.y;var i=zc(this.svgHandle);i=this.horizontal?i.x:i.y;var r=this.handlePosition,c=.95*this.handleLength;t<=i?r-=c:t>=i+this.handleLength&&(r+=c),this.setHandlePosition(this.constrainHandlePosition(r)),this.updateMetrics(),e.stopPropagation(),e.preventDefault()}}onMouseDownHandle(e){this.workspace.markFocused(),this.cleanUp(),Ai(e)?e.stopPropagation():(this.startDragHandle=this.handlePosition,this.startDragMouse=this.horizontal?e.clientX:e.clientY,this.onMouseUpWrapper_=Be(document,"pointerup",this,this.onMouseUpHandle),this.onMouseMoveWrapper_=Be(document,"pointermove",this,this.onMouseMoveHandle),e.stopPropagation(),e.preventDefault())}onMouseMoveHandle(e){this.setHandlePosition(this.constrainHandlePosition(this.startDragHandle+((this.horizontal?e.clientX:e.clientY)-this.startDragMouse))),this.updateMetrics()}onMouseUpHandle(){Ge(),this.cleanUp()}cleanUp(){this.workspace.hideChaff(!0),this.onMouseUpWrapper_&&(Dt(this.onMouseUpWrapper_),this.onMouseUpWrapper_=null),this.onMouseMoveWrapper_&&(Dt(this.onMouseMoveWrapper_),this.onMouseMoveWrapper_=null)}getRatio_(){let e=this.handlePosition/(this.scrollbarLength-this.handleLength);return isNaN(e)&&(e=0),e}updateMetrics(){const e=this.getRatio_();this.horizontal?this.workspace.setMetrics({x:e}):this.workspace.setMetrics({y:e})}set(e,t){this.setHandlePosition(this.constrainHandlePosition(e*this.ratio)),(t||t===void 0)&&this.updateMetrics()}setOrigin(e,t){this.origin=new Ue(e,t)}static metricsAreEquivalent(e,t){return e.viewWidth===t.viewWidth&&e.viewHeight===t.viewHeight&&e.viewLeft===t.viewLeft&&e.viewTop===t.viewTop&&e.absoluteTop===t.absoluteTop&&e.absoluteLeft===t.absoluteLeft&&e.scrollWidth===t.scrollWidth&&e.scrollHeight===t.scrollHeight&&e.scrollLeft===t.scrollLeft&&e.scrollTop===t.scrollTop}};no.scrollbarThickness=Pm?25:15,no.DEFAULT_SCROLLBAR_MARGIN=.5;var Zp,$t=class{constructor(e,t,i){this.workspace=e,this.anchor=t,this.ownerRect=i,this.size=new Vt(0,0),this.colour="#ffffff",this.disposed=!1,this.relativeLeft=this.relativeTop=0,this.svgRoot=w(te.G,{},e.getBubbleCanvas()),e=w(te.G,{filter:`url(#${this.workspace.getRenderer().getConstants().embossFilterId})`},this.svgRoot),this.tail=w(te.PATH,{},e),this.background=w(te.RECT,{class:"blocklyDraggable",x:0,y:0,rx:$t.BORDER_WIDTH,ry:$t.BORDER_WIDTH},e),this.contentContainer=w(te.G,{},this.svgRoot),Be(this.background,"pointerdown",this,this.onMouseDown)}dispose(){U(this.svgRoot),this.disposed=!0}setAnchorLocation(e,t=!1){this.anchor=e,t?this.positionByRect(this.ownerRect):this.positionRelativeToAnchor(),this.renderTail()}setPositionRelativeToAnchor(e,t){this.relativeLeft=e,this.relativeTop=t,this.positionRelativeToAnchor(),this.renderTail()}getSize(){return this.size}setSize(e,t=!1){e.width=Math.max(e.width,$t.MIN_SIZE),e.height=Math.max(e.height,$t.MIN_SIZE),this.size=e,this.background.setAttribute("width",`${e.width}`),this.background.setAttribute("height",`${e.height}`),t?this.positionByRect(this.ownerRect):this.positionRelativeToAnchor(),this.renderTail()}getColour(){return this.colour}setColour(e){this.colour=e,this.tail.setAttribute("fill",e),this.background.setAttribute("fill",e)}onMouseDown(e){let t;(t=this.workspace.getGesture(e))==null||t.handleBubbleStart(e,this)}positionRelativeToAnchor(){let e=this.anchor.x;e=this.workspace.RTL?e-(this.relativeLeft+this.size.width):e+this.relativeLeft,this.moveTo(e,this.relativeTop+this.anchor.y)}moveTo(e,t){this.svgRoot.setAttribute("transform",`translate(${e}, ${t})`)}positionByRect(e=new Bt(0,0,0,0)){var t=this.workspace.getMetricsManager().getViewMetrics(!0),i=this.getOptimalRelativeLeft(t),r=this.getOptimalRelativeTop(t);const c={x:i,y:-this.size.height-this.workspace.getRenderer().getConstants().MIN_BLOCK_HEIGHT},$={x:-this.size.width-30,y:r};r={x:e.getWidth(),y:r};var v={x:i,y:e.getHeight()};i=e.getWidth()e.width)return t;if(e=this.getWorkspaceViewRect(e),this.workspace.RTL){var i=this.anchor.x-t;i-this.size.widthe.right&&(t=-(e.right-this.anchor.x))}else{i=t+this.anchor.x;const r=i+this.size.width;ie.right&&(t=e.right-this.anchor.x-this.size.width)}return t}getOptimalRelativeTop(e){let t=-this.size.height/4;if(this.size.height>e.height)return t;const i=this.anchor.y+t,r=i+this.size.height;return e=this.getWorkspaceViewRect(e),ie.bottom&&(t=e.bottom-this.anchor.y-this.size.height),t}getWorkspaceViewRect(e){const t=e.top;let i=e.top+e.height,r=e.left;return e=e.left+e.width,i-=this.getScrollbarThickness(),this.workspace.RTL?r-=this.getScrollbarThickness():e-=this.getScrollbarThickness(),new Bt(t,i,r,e)}getScrollbarThickness(){return no.scrollbarThickness/this.workspace.scale}renderTail(){const e=[];var t=this.size.width/2,i=this.size.height/2,r=-this.relativeLeft,c=-this.relativeTop;if(t===r&&i===c)e.push("M "+t+","+i);else{c-=i,r-=t,this.workspace.RTL&&(r*=-1);var $=Math.sqrt(c*c+r*r),v=Math.acos(r/$);0>c&&(v=2*Math.PI-v);var H=v+Math.PI/2;H>2*Math.PI&&(H-=2*Math.PI);var Oe=Math.sin(H);const qt=Math.cos(H);let Ft=(this.size.width+this.size.height)/$t.TAIL_THICKNESS;Ft=Math.min(Ft,this.size.width,this.size.height)/4,H=1-$t.ANCHOR_RADIUS/$,r=t+H*r,c=i+H*c,H=t+Ft*qt;const Go=i+Ft*Oe;t-=Ft*qt,i-=Ft*Oe,Oe=ar(this.workspace.RTL?-$t.TAIL_ANGLE:$t.TAIL_ANGLE),Oe=v+Oe,Oe>2*Math.PI&&(Oe-=2*Math.PI),v=Math.sin(Oe)*$/$t.TAIL_BEND,$=Math.cos(Oe)*$/$t.TAIL_BEND,e.push("M"+H+","+Go),e.push("C"+(H+$)+","+(Go+v)+" "+r+","+c+" "+r+","+c),e.push("C"+r+","+c+" "+(t+$)+","+(i+v)+" "+t+","+i)}e.push("z");let Qe;(Qe=this.tail)==null||Qe.setAttribute("d",e.join(" "))}bringToFront(){let e;const t=(e=this.svgRoot)==null?void 0:e.parentNode;return this.svgRoot&&(t==null?void 0:t.lastChild)!==this.svgRoot?(t==null||t.appendChild(this.svgRoot),!0):!1}getRelativeToSurfaceXY(){return new Ue(this.workspace.RTL?-this.relativeLeft+this.anchor.x-this.size.width:this.anchor.x+this.relativeLeft,this.anchor.y+this.relativeTop)}getSvgRoot(){return this.svgRoot}moveDuringDrag(e){this.moveTo(e.x,e.y),this.relativeLeft=this.workspace.RTL?this.anchor.x-e.x-this.size.width:e.x-this.anchor.x,this.relativeTop=e.y-this.anchor.y,this.renderTail()}setDragging(e){}setDeleteStyle(e){}isDeletable(){return!1}showContextMenu(e){}};Zp=$t,$t.BORDER_WIDTH=6,$t.DOUBLE_BORDER=2*Zp.BORDER_WIDTH,$t.MIN_SIZE=Zp.DOUBLE_BORDER,$t.TAIL_THICKNESS=1,$t.TAIL_ANGLE=20,$t.TAIL_BEND=4,$t.ANCHOR_RADIUS=8;var _T={};_T.deepMerge=ri;var Nn=class{constructor(e,t,i,r){this.name=e,this.startHats=!1,this.blockStyles=t||Object.create(null),this.categoryStyles=i||Object.create(null),this.componentStyles=r||Object.create(null),this.fontStyle=Object.create(null),l(Ae.THEME,e,this,!0)}getClassName(){return this.name+"-theme"}setBlockStyle(e,t){this.blockStyles[e]=t}setCategoryStyle(e,t){this.categoryStyles[e]=t}getComponentStyle(e){if(e=this.componentStyles[e],!e)return null;if(typeof e=="string"){const t=this.getComponentStyle(e);if(t)return t}return`${e}`}setComponentStyle(e,t){this.componentStyles[e]=t}setFontStyle(e){this.fontStyle=e}setStartHats(e){this.startHats=e}static defineTheme(e,t){e=e.toLowerCase();const i=new Nn(e);let r=t.base;if(r){if(typeof r=="string"){let c;r=(c=f(Ae.THEME,r))!=null?c:void 0}r instanceof Nn&&(ri(i,r),i.name=e)}return ri(i.blockStyles,t.blockStyles),ri(i.categoryStyles,t.categoryStyles),ri(i.componentStyles,t.componentStyles),ri(i.fontStyle,t.fontStyle),t.startHats!==null&&(i.startHats=t.startHats),i}},RS={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"}},kS={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"}},Qa=new Nn("classic",RS,kS),e$="categoryToolbox",gT="flyoutToolbox",at;(function(e){e[e.TOP=0]="TOP",e[e.BOTTOM=1]="BOTTOM",e[e.LEFT=2]="LEFT",e[e.RIGHT=3]="RIGHT"})(at||(at={}));var fT={hasCategoriesInternal:Hf},zi={};zi.Position=at,zi.TEST_ONLY=fT,zi.convertFlyoutDefToJsonArray=Ll,zi.convertToolboxDefToJson=ia,zi.hasCategories=na,zi.isCategoryCollapsible=ra,zi.parseToolboxTree=fh;var hs=class{constructor(e){this.gridPattern=null,this.getMetrics=this.setMetrics=void 0;let t=null,i=!1;var r=!1,c=!1,$=!1,v=!1,H=!1;const Oe=!!e.readOnly;if(!Oe){var Qe;t=ia((Qe=e.toolbox)!=null?Qe:null),i=na(t),r=e.trashcan,r=r===void 0?i:r,c=e.collapse,c=c===void 0?i:c,$=e.comments,$=$===void 0?i:$,v=e.disable,v=v===void 0?i:v,H=e.sounds,H=H===void 0?!0:H}Qe=e.maxTrashcanContents,r?Qe===void 0&&(Qe=32):Qe=0;const qt=!!e.rtl;let Ft=e.horizontalLayout;Ft===void 0&&(Ft=!1);var Go=e.toolboxPosition!=="end";Go=Ft?Go?at.TOP:at.BOTTOM:Go===qt?at.RIGHT:at.LEFT;let Jr=e.css;Jr===void 0&&(Jr=!0);let Zr="https://blockly-demo.appspot.com/static/media/";e.media?Zr=e.media.endsWith("/")?e.media:e.media+"/":"path"in e&&(xe("path","Nov 2014","Jul 2023","media"),Zr=e.path+"media/");const yE=e.oneBasedIndex,a9=e.renderer||"geras",u9=e.plugins||{};let q$=e.modalInputs;q$===void 0&&(q$=!0),this.RTL=qt,this.oneBasedIndex=yE===void 0?!0:yE,this.collapse=c,this.comments=$,this.disable=v,this.readOnly=Oe,this.maxBlocks=e.maxBlocks||1/0;let SE;this.maxInstances=(SE=e.maxInstances)!=null?SE:null,this.modalInputs=q$,this.pathToMedia=Zr,this.hasCategories=i,this.moveOptions=hs.parseMoveOptions_(e,i),this.hasScrollbars=!!this.moveOptions.scrollbars,this.hasTrashcan=r,this.maxTrashcanContents=Qe,this.hasSounds=H,this.hasCss=Jr,this.horizontalLayout=Ft,this.languageTree=t,this.gridOptions=hs.parseGridOptions_(e),this.zoomOptions=hs.parseZoomOptions_(e),this.toolboxPosition=Go,this.theme=hs.parseThemeOptions_(e),this.renderer=a9;let RE;this.rendererOverrides=(RE=e.rendererOverrides)!=null?RE:null;let kE;this.parentWorkspace=(kE=e.parentWorkspace)!=null?kE:null,this.plugins=u9}static parseMoveOptions_(e,t){const i=e.move||{},r={};return i.scrollbars===void 0&&e.scrollbars===void 0?r.scrollbars=t:typeof i.scrollbars=="object"?(r.scrollbars={horizontal:!!i.scrollbars.horizontal,vertical:!!i.scrollbars.vertical},r.scrollbars.horizontal&&r.scrollbars.vertical?r.scrollbars=!0:r.scrollbars.horizontal||r.scrollbars.vertical||(r.scrollbars=!1)):r.scrollbars=!!i.scrollbars||!!e.scrollbars,r.wheel=r.scrollbars&&i.wheel!==void 0?!!i.wheel:typeof r.scrollbars=="object",r.drag=r.scrollbars?i.drag===void 0?!0:!!i.drag:!1,r}static parseZoomOptions_(e){e=e.zoom||{};const t={};return t.controls=e.controls===void 0?!1:!!e.controls,t.wheel=e.wheel===void 0?!1:!!e.wheel,t.startScale=e.startScale===void 0?1:Number(e.startScale),t.maxScale=e.maxScale===void 0?3:Number(e.maxScale),t.minScale=e.minScale===void 0?.3:Number(e.minScale),t.scaleSpeed=e.scaleSpeed===void 0?1.2:Number(e.scaleSpeed),t.pinch=e.pinch===void 0?t.wheel||t.controls:!!e.pinch,t}static parseGridOptions_(e){e=e.grid||{};const t={};return t.spacing=Number(e.spacing)||0,t.colour=e.colour||"#888",t.length=e.length===void 0?1:Number(e.length),t.snap=0t.y&&e.moveBy(0,20-t.y),e.RTL){let i=-20;const r=this.miniWorkspace.getFlyout();r&&(i-=r.getWidth()),t.x>i&&e.moveBy(i-t.x,0)}else 20>t.x&&e.moveBy(20-t.x,0)}}updateBubbleSize(){if(!this.miniWorkspace.isDragging()){var e=this.getSize(),t=this.calculateWorkspaceSize();Math.abs(e.width-t.width)({kind:"block",type:i}))}),t}getAnchorLocation(){const e=qa/2;return Ue.sum(this.workspaceLocation,new Ue(e,e))}getBubbleOwnerRect(){const e=this.sourceBlock.getSvgRoot().getBBox();return new Bt(e.y,e.y+e.height,e.x,e.x+e.width)}createRootBlock(){if(!this.sourceBlock.decompose)throw Error("Blocks with mutator icons must include a decompose method");this.rootBlock=this.sourceBlock.decompose(this.miniWorkspaceBubble.getWorkspace());for(var e of this.rootBlock.getDescendants(!1))e.queueRender();this.rootBlock.setMovable(!1),this.rootBlock.setDeletable(!1);let t,i,r,c;e=(c=(t=this.miniWorkspaceBubble)==null||(i=t.getWorkspace())==null||(r=i.getFlyout())==null?void 0:r.getWidth())!=null?c:0,this.rootBlock.moveBy(this.rootBlock.RTL?-(e+Ja):Ja,Ja)}addSaveConnectionsListener(){if(this.sourceBlock.saveConnections&&this.rootBlock){var e=()=>{this.sourceBlock.saveConnections&&this.rootBlock&&this.sourceBlock.saveConnections(this.rootBlock)};e(),this.sourceBlock.workspace.addChangeListener(e)}}createMiniWorkspaceChangeListener(){return e=>{s.MutatorIcon$$module$build$src$core$icons$mutator_icon.isIgnorableMutatorEvent(e)||this.updateWorkspacePid||(this.updateWorkspacePid=setTimeout(()=>{this.updateWorkspacePid=null,this.recomposeSourceBlock()},0))}}static isIgnorableMutatorEvent(e){return e.isUiEvent||e.type===s.CREATE$$module$build$src$core$events$utils||e.type===s.CHANGE$$module$build$src$core$events$utils&&e.element==="disabled"}recomposeSourceBlock(){if(this.rootBlock){if(!this.sourceBlock.compose)throw Error("Blocks with mutator icons must include a compose method");var e=s.getGroup$$module$build$src$core$events$utils();e||s.setGroup$$module$build$src$core$events$utils(!0);var t=Sn.getExtraBlockState_(this.sourceBlock);this.sourceBlock.compose(this.rootBlock);var i=Sn.getExtraBlockState_(this.sourceBlock);t!==i&&re(new(we(s.CHANGE$$module$build$src$core$events$utils))(this.sourceBlock,"mutation",null,t,i)),s.setGroup$$module$build$src$core$events$utils(e)}}getWorkspace(){let e;return(e=this.miniWorkspaceBubble)==null?void 0:e.getWorkspace()}static reconnect(e,t,i){return xe("MutatorIcon.reconnect","v10","v11","connection.reconnect"),e?e.reconnect(t,i):!1}static findParentWs(e){return xe("MutatorIcon.findParentWs","v10","v11","workspace.getRootWorkspace"),e.getRootWorkspace()}},s.MutatorIcon$$module$build$src$core$icons$mutator_icon.TYPE=Uo.MUTATOR,s.MutatorIcon$$module$build$src$core$icons$mutator_icon.WEIGHT=1,s.MutatorIcon$$module$build$src$core$icons$mutator_icon;var Ur=Object.create(null),AS={allExtensions:Ur};s.register$$module$build$src$core$extensions("parent_tooltip_when_inline",Kf);var ps={};ps.TEST_ONLY=AS,ps.apply=ca,ps.buildTooltipForDropdown=s.buildTooltipForDropdown$$module$build$src$core$extensions,ps.buildTooltipWithFieldText=s.buildTooltipWithFieldText$$module$build$src$core$extensions,ps.isRegistered=mh,ps.register=s.register$$module$build$src$core$extensions,ps.registerMixin=s.registerMixin$$module$build$src$core$extensions,ps.registerMutator=s.registerMutator$$module$build$src$core$extensions,ps.runAfterPageLoad=da,ps.unregister=Gf,function(e){e[e.LEFT=-1]="LEFT",e[e.CENTRE=0]="CENTRE",e[e.RIGHT=1]="RIGHT"}(s.Align$$module$build$src$core$inputs$align||(s.Align$$module$build$src$core$inputs$align={})),s.Align$$module$build$src$core$inputs$align;var mT={};mT.removeElem=Po;var ft;(function(e){e[e.WIN_KEY_FF_LINUX=0]="WIN_KEY_FF_LINUX",e[e.MAC_ENTER=3]="MAC_ENTER",e[e.BACKSPACE=8]="BACKSPACE",e[e.TAB=9]="TAB",e[e.NUM_CENTER=12]="NUM_CENTER",e[e.ENTER=13]="ENTER",e[e.SHIFT=16]="SHIFT",e[e.CTRL=17]="CTRL",e[e.ALT=18]="ALT",e[e.PAUSE=19]="PAUSE",e[e.CAPS_LOCK=20]="CAPS_LOCK",e[e.ESC=27]="ESC",e[e.SPACE=32]="SPACE",e[e.PAGE_UP=33]="PAGE_UP",e[e.PAGE_DOWN=34]="PAGE_DOWN",e[e.END=35]="END",e[e.HOME=36]="HOME",e[e.LEFT=37]="LEFT",e[e.UP=38]="UP",e[e.RIGHT=39]="RIGHT",e[e.DOWN=40]="DOWN",e[e.PLUS_SIGN=43]="PLUS_SIGN",e[e.PRINT_SCREEN=44]="PRINT_SCREEN",e[e.INSERT=45]="INSERT",e[e.DELETE=46]="DELETE",e[e.ZERO=48]="ZERO",e[e.ONE=49]="ONE",e[e.TWO=50]="TWO",e[e.THREE=51]="THREE",e[e.FOUR=52]="FOUR",e[e.FIVE=53]="FIVE",e[e.SIX=54]="SIX",e[e.SEVEN=55]="SEVEN",e[e.EIGHT=56]="EIGHT",e[e.NINE=57]="NINE",e[e.FF_SEMICOLON=59]="FF_SEMICOLON",e[e.FF_EQUALS=61]="FF_EQUALS",e[e.FF_DASH=173]="FF_DASH",e[e.FF_HASH=163]="FF_HASH",e[e.QUESTION_MARK=63]="QUESTION_MARK",e[e.AT_SIGN=64]="AT_SIGN",e[e.A=65]="A",e[e.B=66]="B",e[e.C=67]="C",e[e.D=68]="D",e[e.E=69]="E",e[e.F=70]="F",e[e.G=71]="G",e[e.H=72]="H",e[e.I=73]="I",e[e.J=74]="J",e[e.K=75]="K",e[e.L=76]="L",e[e.M=77]="M",e[e.N=78]="N",e[e.O=79]="O",e[e.P=80]="P",e[e.Q=81]="Q",e[e.R=82]="R",e[e.S=83]="S",e[e.T=84]="T",e[e.U=85]="U",e[e.V=86]="V",e[e.W=87]="W",e[e.X=88]="X",e[e.Y=89]="Y",e[e.Z=90]="Z",e[e.META=91]="META",e[e.WIN_KEY_RIGHT=92]="WIN_KEY_RIGHT",e[e.CONTEXT_MENU=93]="CONTEXT_MENU",e[e.NUM_ZERO=96]="NUM_ZERO",e[e.NUM_ONE=97]="NUM_ONE",e[e.NUM_TWO=98]="NUM_TWO",e[e.NUM_THREE=99]="NUM_THREE",e[e.NUM_FOUR=100]="NUM_FOUR",e[e.NUM_FIVE=101]="NUM_FIVE",e[e.NUM_SIX=102]="NUM_SIX",e[e.NUM_SEVEN=103]="NUM_SEVEN",e[e.NUM_EIGHT=104]="NUM_EIGHT",e[e.NUM_NINE=105]="NUM_NINE",e[e.NUM_MULTIPLY=106]="NUM_MULTIPLY",e[e.NUM_PLUS=107]="NUM_PLUS",e[e.NUM_MINUS=109]="NUM_MINUS",e[e.NUM_PERIOD=110]="NUM_PERIOD",e[e.NUM_DIVISION=111]="NUM_DIVISION",e[e.F1=112]="F1",e[e.F2=113]="F2",e[e.F3=114]="F3",e[e.F4=115]="F4",e[e.F5=116]="F5",e[e.F6=117]="F6",e[e.F7=118]="F7",e[e.F8=119]="F8",e[e.F9=120]="F9",e[e.F10=121]="F10",e[e.F11=122]="F11",e[e.F12=123]="F12",e[e.NUMLOCK=144]="NUMLOCK",e[e.SCROLL_LOCK=145]="SCROLL_LOCK",e[e.FIRST_MEDIA_KEY=166]="FIRST_MEDIA_KEY",e[e.LAST_MEDIA_KEY=183]="LAST_MEDIA_KEY",e[e.SEMICOLON=186]="SEMICOLON",e[e.DASH=189]="DASH",e[e.EQUALS=187]="EQUALS",e[e.COMMA=188]="COMMA",e[e.PERIOD=190]="PERIOD",e[e.SLASH=191]="SLASH",e[e.APOSTROPHE=192]="APOSTROPHE",e[e.TILDE=192]="TILDE",e[e.SINGLE_QUOTE=222]="SINGLE_QUOTE",e[e.OPEN_SQUARE_BRACKET=219]="OPEN_SQUARE_BRACKET",e[e.BACKSLASH=220]="BACKSLASH",e[e.CLOSE_SQUARE_BRACKET=221]="CLOSE_SQUARE_BRACKET",e[e.WIN_KEY=224]="WIN_KEY",e[e.MAC_FF_META=224]="MAC_FF_META",e[e.MAC_WK_CMD_LEFT=91]="MAC_WK_CMD_LEFT",e[e.MAC_WK_CMD_RIGHT=93]="MAC_WK_CMD_RIGHT",e[e.WIN_IME=229]="WIN_IME",e[e.VK_NONAME=252]="VK_NONAME",e[e.PHANTOM=255]="PHANTOM"})(ft||(ft={}));var fi={};fi.arc=oo,fi.curve=xo,fi.line=_r,fi.lineOnAxis=je,fi.lineTo=Bs,fi.moveBy=jt,fi.moveTo=To,fi.point=tt;var Qt={};Qt.Coordinate=Ue,Qt.KeyCodes=ft,Qt.Rect=Bt,Qt.Size=Vt,Qt.Svg=te,Qt.aria=Ql,Qt.array=mT,Qt.browserEvents=$i,Qt.colour=So,Qt.deprecation=Sr,Qt.dom=co,Qt.extensions=ps,Qt.idGenerator=Ia,Qt.math=Wa,Qt.object=_T,Qt.parsing=Yl,Qt.string=An,Qt.style=_i,Qt.svgMath=Gi,Qt.svgPaths=fi,Qt.toolbox=zi,Qt.userAgent=pi,Qt.xml=In;var t$={};t$.register=bh,t$.unregister=Qf;var o$=class extends $t{constructor(e,t,i,r){super(t,i,r),this.text=e,this.workspace=t,this.anchor=i,this.ownerRect=r,this.paragraph=this.stringToSvg(e,this.contentContainer),this.updateBubbleSize()}getText(){return this.text}setText(e){this.text=e,U(this.paragraph),this.paragraph=this.stringToSvg(e,this.contentContainer),this.updateBubbleSize()}stringToSvg(e,t){return t=this.createParagraph(t),e=this.createSpans(t,e),this.workspace.RTL&&this.rightAlignSpans(t.getBBox().width,e),t}createParagraph(e){return w(te.TEXT,{class:"blocklyText blocklyBubbleText blocklyNoPointerEvents",y:$t.BORDER_WIDTH},e)}createSpans(e,t){return t.split(`
+`).map(i=>{const r=w(te.TSPAN,{dy:"1em",x:$t.BORDER_WIDTH},e);return i=document.createTextNode(i),r.appendChild(i),r})}rightAlignSpans(e,t){for(const i of t)i.setAttribute("text-anchor","end"),i.setAttribute("x",`${e+$t.BORDER_WIDTH}`)}updateBubbleSize(){const e=this.paragraph.getBBox();this.setSize(new Vt(e.width+2*$t.BORDER_WIDTH,e.height+2*$t.BORDER_WIDTH),!0)}},TT=class extends $t{constructor(e,t,i){super(e,t,i),this.workspace=e,this.anchor=t,this.ownerRect=i,this.resizePointerMoveListener=this.resizePointerUpListener=null,this.textChangeListeners=[],this.sizeChangeListeners=[],this.text="",this.DEFAULT_SIZE=new Vt(160+$t.DOUBLE_BORDER,80+$t.DOUBLE_BORDER),this.MIN_SIZE=new Vt(45+$t.DOUBLE_BORDER,20+$t.DOUBLE_BORDER),{inputRoot:this.inputRoot,textArea:this.textArea}=this.createEditor(this.contentContainer),this.resizeGroup=this.createResizeHandle(this.svgRoot),this.setSize(this.DEFAULT_SIZE,!0)}getText(){return this.text}setText(e){this.text=e,this.textArea.value=e,this.onTextChange()}addTextChangeListener(e){this.textChangeListeners.push(e)}addSizeChangeListener(e){this.sizeChangeListeners.push(e)}createEditor(e){e=w(te.FOREIGNOBJECT,{x:$t.BORDER_WIDTH,y:$t.BORDER_WIDTH},e);const t=document.createElementNS(ui,"body");t.setAttribute("xmlns",ui),t.className="blocklyMinimalBody";const i=document.createElementNS(ui,"textarea");return i.className="blocklyCommentTextarea",i.setAttribute("dir",this.workspace.RTL?"RTL":"LTR"),t.appendChild(i),e.appendChild(t),this.bindTextAreaEvents(i),setTimeout(()=>{i.focus()},0),{inputRoot:e,textArea:i}}bindTextAreaEvents(e){Be(e,"wheel",this,t=>{t.stopPropagation()}),Be(e,"focus",this,this.onStartEdit,!0),Be(e,"change",this,this.onTextChange)}createResizeHandle(e){e=w(te.G,{class:this.workspace.RTL?"blocklyResizeSW":"blocklyResizeSE"},e);const t=2*$t.BORDER_WIDTH;return w(te.POLYGON,{points:`0,${t} ${t},${t} ${t},0`},e),w(te.LINE,{class:"blocklyResizeLine",x1:t/3,y1:t-1,x2:t-1,y2:t/3},e),w(te.LINE,{class:"blocklyResizeLine",x1:2*t/3,y1:t-1,x2:t-1,y2:2*t/3},e),Be(e,"pointerdown",this,this.onResizePointerDown),e}setSize(e,t=!1){e.width=Math.max(e.width,this.MIN_SIZE.width),e.height=Math.max(e.height,this.MIN_SIZE.height);const i=e.width-$t.DOUBLE_BORDER,r=e.height-$t.DOUBLE_BORDER;this.inputRoot.setAttribute("width",`${i}`),this.inputRoot.setAttribute("height",`${r}`),this.textArea.style.width=`${i-4}px`,this.textArea.style.height=`${r-4}px`,this.workspace.RTL?this.resizeGroup.setAttribute("transform",`translate(${$t.DOUBLE_BORDER}, ${r}) scale(-1 1)`):this.resizeGroup.setAttribute("transform",`translate(${i}, ${r})`),super.setSize(e,t),this.onSizeChange()}getSize(){return super.getSize()}onResizePointerDown(e){this.bringToFront(),Ai(e)||(this.workspace.startDrag(e,new Ue(this.workspace.RTL?-this.getSize().width:this.getSize().width,this.getSize().height)),this.resizePointerUpListener=Be(document,"pointerup",this,this.onResizePointerUp),this.resizePointerMoveListener=Be(document,"pointermove",this,this.onResizePointerMove),this.workspace.hideChaff()),e.stopPropagation()}onResizePointerUp(e){Ge(),this.resizePointerUpListener&&(Dt(this.resizePointerUpListener),this.resizePointerUpListener=null),this.resizePointerMoveListener&&(Dt(this.resizePointerMoveListener),this.resizePointerMoveListener=null)}onResizePointerMove(e){e=this.workspace.moveDrag(e),this.setSize(new Vt(this.workspace.RTL?-e.x:e.x,e.y),!1),this.onSizeChange()}onStartEdit(){this.bringToFront()&&this.textArea.focus()}onTextChange(){this.text=this.textArea.value;for(const e of this.textChangeListeners)e()}onSizeChange(){for(const e of this.sizeChangeListeners)e()}};cs(`
+.blocklyCommentTextarea {
+ background-color: #fef49c;
+ border: 0;
+ display: block;
+ margin: 0;
+ outline: 0;
+ padding: 3px;
+ resize: none;
+ text-overflow: hidden;
+}
+`);var s$=17,ET=160,bT=80,Ao=class extends Ka{constructor(e){super(e),this.sourceBlock=e,this.textBubble=this.textInputBubble=null,this.text="",this.bubbleSize=new Vt(ET,bT),this.bubbleVisiblity=!1}getType(){return Ao.TYPE}initView(e){this.svgRoot||(super.initView(e),w(te.CIRCLE,{class:"blocklyIconShape",r:"8",cx:"8",cy:"8"},this.svgRoot),w(te.PATH,{class:"blocklyIconSymbol",d:"m6.8,10h2c0.003,-0.617 0.271,-0.962 0.633,-1.266 2.875,-2.4050.607,-5.534 -3.765,-3.874v1.7c3.12,-1.657 3.698,0.118 2.336,1.25-1.201,0.998 -1.201,1.528 -1.204,2.19z"},this.svgRoot),w(te.RECT,{class:"blocklyIconSymbol",x:"6.8",y:"10.78",height:"2",width:"2"},this.svgRoot))}dispose(){super.dispose();let e;(e=this.textInputBubble)==null||e.dispose();let t;(t=this.textBubble)==null||t.dispose()}getWeight(){return Ao.WEIGHT}getSize(){return new Vt(s$,s$)}applyColour(){super.applyColour();const e=this.sourceBlock.style.colourPrimary;let t;(t=this.textInputBubble)==null||t.setColour(e);let i;(i=this.textBubble)==null||i.setColour(e)}updateEditable(){super.updateEditable(),this.bubbleIsVisible()&&(this.setBubbleVisible(!1),this.setBubbleVisible(!0))}onLocationChange(e){super.onLocationChange(e),e=this.getAnchorLocation();let t;(t=this.textInputBubble)==null||t.setAnchorLocation(e);let i;(i=this.textBubble)==null||i.setAnchorLocation(e)}setText(e){this.text=e;let t;(t=this.textInputBubble)==null||t.setText(this.text);let i;(i=this.textBubble)==null||i.setText(this.text)}getText(){return this.text}setBubbleSize(e){this.bubbleSize=e;let t;(t=this.textInputBubble)==null||t.setSize(this.bubbleSize,!0)}getBubbleSize(){return this.bubbleSize}saveState(){return this.text?{text:this.text,pinned:this.bubbleIsVisible(),height:this.bubbleSize.height,width:this.bubbleSize.width}:null}loadState(e){let t;this.text=(t=e.text)!=null?t:"";let i,r;this.bubbleSize=new Vt((i=e.width)!=null?i:ET,(r=e.height)!=null?r:bT);let c;this.bubbleVisiblity=(c=e.pinned)!=null?c:!1,setTimeout(()=>this.setBubbleVisible(this.bubbleVisiblity),1)}onClick(){super.onClick(),this.setBubbleVisible(!this.bubbleIsVisible())}onTextChange(){this.textInputBubble&&(this.text=this.textInputBubble.getText())}onSizeChange(){this.textInputBubble&&(this.bubbleSize=this.textInputBubble.getSize())}bubbleIsVisible(){return this.bubbleVisiblity}setBubbleVisible(e){(!e||!this.textBubble&&!this.textInputBubble)&&(e||this.textBubble||this.textInputBubble)&&(this.bubbleVisiblity=e,this.sourceBlock.rendered&&!this.sourceBlock.isInFlyout&&(e?(this.sourceBlock.isEditable()?this.showEditableBubble():this.showNonEditableBubble(),this.applyColour()):this.hideBubble(),re(new(we(Fs))(this.sourceBlock,e,"comment"))))}showEditableBubble(){this.textInputBubble=new TT(this.sourceBlock.workspace,this.getAnchorLocation(),this.getBubbleOwnerRect()),this.textInputBubble.setText(this.getText()),this.textInputBubble.setSize(this.bubbleSize,!0),this.textInputBubble.addTextChangeListener(()=>this.onTextChange()),this.textInputBubble.addSizeChangeListener(()=>this.onSizeChange())}showNonEditableBubble(){this.textBubble=new o$(this.getText(),this.sourceBlock.workspace,this.getAnchorLocation(),this.getBubbleOwnerRect())}hideBubble(){let e;(e=this.textInputBubble)==null||e.dispose(),this.textInputBubble=null;let t;(t=this.textBubble)==null||t.dispose(),this.textBubble=null}getAnchorLocation(){const e=s$/2;return Ue.sum(this.workspaceLocation,new Ue(e,e))}getBubbleOwnerRect(){const e=this.sourceBlock.getSvgRoot().getBBox();return new Bt(e.y,e.y+e.height,e.x,e.x+e.width)}};Ao.TYPE=Uo.COMMENT,Ao.WEIGHT=3,bh(Ao.TYPE,Ao);var wn=class extends bt{constructor(e,t,i){super(bt.SKIP_SETUP),this.class=null,this.EDITABLE=!1,this.maxDisplayLength=1/0,e!==bt.SKIP_SETUP&&(i?this.configure_(i):this.class=t||null,this.setValue(e))}configure_(e){super.configure_(e),e.class&&(this.class=e.class)}initView(){this.createTextElement_(),this.class&&I(this.getTextElement(),this.class)}doClassValidation_(e){return e==null?null:`${e}`}setClass(e){this.textElement_&&(this.class&&A(this.textElement_,this.class),e&&I(this.textElement_,e)),this.class=e}static fromJson(e){return new this(Zt(e.text),void 0,e)}};Jo("field_label",wn),wn.prototype.DEFAULT_VALUE="";var mi=class{constructor(e,t){this.name=e,this.sourceBlock=t,this.fieldRow=[],this.align=s.Align$$module$build$src$core$inputs$input.LEFT,this.visible=!0,this.type=s.inputTypes$$module$build$src$core$inputs$input_types.CUSTOM,this.connection=null}getSourceBlock(){return this.sourceBlock}appendField(e,t){return this.insertFieldAt(this.fieldRow.length,e,t),this}insertFieldAt(e,t,i){if(0>e||e>this.fieldRow.length)throw Error("index "+e+" out of bounds.");return(t||t===""&&i)&&(typeof t=="string"&&(t=s.fromJson$$module$build$src$core$field_registry({type:"field_label",text:t})),t.setSourceBlock(this.sourceBlock),this.sourceBlock.rendered&&(t.init(),t.applyColour()),t.name=i,t.setVisible(this.isVisible()),t.prefixField&&(e=this.insertFieldAt(e,t.prefixField)),this.fieldRow.splice(e,0,t),e++,t.suffixField&&(e=this.insertFieldAt(e,t.suffixField)),this.sourceBlock.rendered&&(this.sourceBlock.queueRender(),this.sourceBlock.bumpNeighbours())),e}removeField(e,t){for(let i=0,r;r=this.fieldRow[i];i++)if(r.name===e)return r.dispose(),this.fieldRow.splice(i,1),this.sourceBlock.rendered&&(this.sourceBlock.queueRender(),this.sourceBlock.bumpNeighbours()),!0;if(t)return!1;throw Error('Field "'+e+'" not found.')}isVisible(){return this.visible}setVisible(e){let t=[];if(this.visible===e)return t;this.visible=e;for(let r=0,c;c=this.fieldRow[r];r++)c.setVisible(e);if(this.connection){var i=this.connection;e?t=i.startTrackingAll():i.stopTrackingAll(),(i=i.targetBlock())&&(i.getSvgRoot().style.display=e?"block":"none")}return t}markDirty(){for(let e=0,t;t=this.fieldRow[e];e++)t.markDirty()}setCheck(e){if(!this.connection)throw Error("This input does not have a connection.");return this.connection.setCheck(e),this}setAlign(e){return this.align=e,this.sourceBlock.rendered&&this.sourceBlock.queueRender(),this}setShadowDom(e){if(!this.connection)throw Error("This input does not have a connection.");return this.connection.setShadowDom(e),this}getShadowDom(){if(!this.connection)throw Error("This input does not have a connection.");return this.connection.getShadowDom()}init(){if(this.sourceBlock.workspace.rendered)for(let e=0;ee.disposeInternal()),this.inputList.forEach(e=>e.dispose()),this.inputList.length=0,this.getConnections_(!0).forEach(e=>e.dispose()),this.disposed=!0)}isDeadOrDying(){return this.disposing||this.disposed}initModel(){for(const e of this.inputList)for(const t of e.fieldRow)t.initModel&&t.initModel()}unplug(e){this.outputConnection&&this.unplugFromRow_(e),this.previousConnection&&this.unplugFromStack_(e)}unplugFromRow_(e){let t=null,i;(i=this.outputConnection)!=null&&i.isConnected()&&(t=this.outputConnection.targetConnection,this.outputConnection.disconnect()),t&&e&&(e=this.getOnlyValueConnection_())&&e.isConnected()&&!e.targetBlock().isShadow()&&(e=e.targetConnection,e==null||e.disconnect(),this.workspace.connectionChecker.canConnect(e,t,!1)?t.connect(e):e==null||e.onFailedConnect(t))}getOnlyValueConnection_(){let e=null;for(let t=0;t(r=r+(i==="("||c===")"?"":" ")+c,i=c[c.length-1],r),""),t=t.trim()||"???",e&&t.length>e&&(t=t.substring(0,e-3)+"..."),t}toTokens(e="?"){const t=[];for(const r of this.inputList)if(r.name!=Nr){for(const c of r.fieldRow)t.push(c.getText());if(r.connection){const c=r.connection.targetBlock();if(c){var i=r.connection;let $=i.getCheck();!$&&i.targetConnection&&($=i.targetConnection.getCheck()),(i=!!$&&($.indexOf("Boolean")!==-1||$.indexOf("Number")!==-1))&&t.push("("),t.push(...c.toTokens(e)),i&&t.push(")")}else t.push(e)}}return t}appendValueInput(e){return this.appendInput(new s.ValueInput$$module$build$src$core$inputs$value_input(e,this))}appendStatementInput(e){return this.statementInputCount++,this.appendInput(new Zo(e,this))}appendDummyInput(e=""){return this.appendInput(new zs(e,this))}appendInput(e){return this.inputList.push(e),e}appendInputFromRegistry(e,t){return(e=p(Ae.INPUT,e,!1))?this.appendInput(new e(t,this)):null}jsonInit(e){var t=e.type?'Block "'+e.type+'": ':"";if(e.output&&e.previousStatement)throw Error(t+"Must not have both an output and a previousStatement.");if(e.style&&e.style.hat&&(this.hat=e.style.hat,e.style=null),e.style&&e.colour)throw Error(t+"Must not have both a colour and a style.");e.style?this.jsonInitStyle_(e,t):this.jsonInitColour_(e,t);for(var i=0;e["message"+i]!==void 0;)this.interpolate_(e["message"+i],e["args"+i]||[],e["lastDummyAlign"+i],t),i++;if(e.inputsInline!==void 0&&this.setInputsInline(e.inputsInline),e.output!==void 0&&this.setOutput(!0,e.output),e.outputShape!==void 0&&this.setOutputShape(e.outputShape),e.previousStatement!==void 0&&this.setPreviousStatement(!0,e.previousStatement),e.nextStatement!==void 0&&this.setNextStatement(!0,e.nextStatement),e.tooltip!==void 0&&(i=Zt(e.tooltip),this.setTooltip(i)),e.enableContextMenu!==void 0&&(this.contextMenu=!!e.enableContextMenu),e.suppressPrefixSuffix!==void 0&&(this.suppressPrefixSuffix=!!e.suppressPrefixSuffix),e.helpUrl!==void 0&&(i=Zt(e.helpUrl),this.setHelpUrl(i)),typeof e.extensions=="string"&&(console.warn(t+"JSON attribute 'extensions' should be an array of strings. Found raw string in JSON for '"+e.type+"' block."),e.extensions=[e.extensions]),e.mutator!==void 0&&ca(e.mutator,this,!0),e=e.extensions,Array.isArray(e))for(t=0;t$||$>t)throw Error('Block "'+this.type+'": Message index %'+$+" out of range.");if(i[$])throw Error('Block "'+this.type+'": Message index %'+$+" duplicated.");i[$]=!0,r++}}if(r!==t)throw Error('Block "'+this.type+'": Message does not reference all '+t+" arg(s).")}interpolateArguments_(e,t,i){const r=[];for(let c=0;c=this.inputList.length)throw RangeError("Input index "+e+" out of bounds.");if(t>this.inputList.length)throw RangeError("Reference input "+t+" out of bounds.");const i=this.inputList[e];this.inputList.splice(e,1),et.getWeight()-i.getWeight()),e}removeIcon(e){if(!this.hasIcon(e))return!1;let t;return(t=this.getIcon(e))==null||t.dispose(),this.icons=this.icons.filter(i=>!i.getType().equals(e)),!0}hasIcon(e){return this.icons.some(t=>t.getType().equals(e))}getIcon(e){return e instanceof Uo?this.icons.find(t=>t.getType().equals(e)):this.icons.find(t=>t.getType().toString()===e)}getIcons(){return[...this.icons]}getRelativeToSurfaceXY(){return this.xy_}moveBy(e,t,i){if(this.parentBlock_)throw Error("Block has parent");const r=new(we(s.MOVE$$module$build$src$core$events$utils))(this);i&&r.setReason(i),this.xy_.translate(e,t),r.recordNew(),re(r)}makeConnection_(e){return new St(this,e)}allInputsFilled(e){if(e===void 0&&(e=!0),!e&&this.isShadow())return!1;for(let i=0,r;r=this.inputList[i];i++)if(r.connection){var t=r.connection.targetBlock();if(!t||!t.allInputsFilled(e))return!1}return(t=this.getNextBlock())?t.allInputsFilled(e):!0}toDevString(){let e=this.type?'"'+this.type+'" block':"Block";return this.id&&(e+=' (id="'+this.id+'")'),e}};Hr.COLLAPSED_INPUT_NAME=Nr,Hr.COLLAPSED_FIELD_NAME=Ga;var Za=null,ql=null,Jl={};Jl.connectionUiEffect=Oh,Jl.disconnectUiEffect=Ch,Jl.disconnectUiStop=gr,Jl.disposeUiEffect=vh;var n$=class extends Vs{constructor(e,t,i){super(e?e.workspace.id:void 0),this.type=Tn,e&&(this.blockId=e.id,this.isStart=t,this.blocks=i)}toJson(){const e=super.toJson();if(this.isStart===void 0)throw Error("Whether this event is the start of a drag is undefined. Either pass the value to the constructor, or call fromJson");if(this.blockId===void 0)throw Error("The block ID is undefined. Either pass a block to the constructor, or call fromJson");return e.isStart=this.isStart,e.blockId=this.blockId,e.blocks=this.blocks,e}static fromJson(e,t,i){return t=super.fromJson(e,t,i??new n$),t.isStart=e.isStart,t.blockId=e.blockId,t.blocks=e.blocks,t}};l(Ae.EVENT,Tn,n$);var eu={};eu.bumpIntoBounds=fr,eu.bumpIntoBoundsHandler=Sh,eu.bumpTopObjectsIntoBounds=ha;var Ti=class{constructor(e){this.name_=e}toString(){return this.name_}};Ti.POSITIONABLE=new Ti("positionable"),Ti.DRAG_TARGET=new Ti("drag_target"),Ti.DELETE_AREA=new Ti("delete_area"),Ti.AUTOHIDEABLE=new Ti("autohideable");var fo=class{constructor(){this.componentData=new Map,this.capabilityToComponentIds=new Map}addComponent(e,t){const i=e.component.id;if(!t&&this.componentData.has(i)){var r;throw Error('Plugin "'+i+'" with capabilities "'+((r=this.componentData.get(i))==null?void 0:r.capabilities)+'" already added.')}for(this.componentData.set(i,e),t=[],r=0;r{r.push(this.componentData.get(c))}),r.sort(function(c,$){return c.weight-$.weight}),r.forEach(function(c){i.push(c.component)})}else e.forEach(r=>{i.push(this.componentData.get(r).component)});return i}};fo.Capability=Ti;var r$,IT;r$=28,s.config$$module$build$src$core$config={dragRadius:5,flyoutDragRadius:10,snapRadius:r$,connectingSnapRadius:r$,currentConnectionPreference:8,bumpDelay:250},IT={},IT.config=s.config$$module$build$src$core$config;var OT="The insertion marker manager tried to create a marker but the result is missing %1. If you are using a mutator, make sure your domToMutation method is properly defined.",es=class{constructor(e){this.activeCandidate=this.lastMarker=this.lastOnStack=null,this.wouldDeleteBlock=!1,this.fadedBlock=this.highlightedBlock=this.markerConnection=null,Y(e),this.topBlock=e,this.workspace=e.workspace,this.firstMarker=this.createMarkerBlock(this.topBlock),this.availableConnections=this.initAvailableConnections(),this.lastOnStack&&(this.lastMarker=this.createMarkerBlock(this.lastOnStack.getSourceBlock()))}dispose(){this.availableConnections.length=0,this.disposeInsertionMarker(this.firstMarker),this.disposeInsertionMarker(this.lastMarker)}updateAvailableConnections(){this.availableConnections=this.initAvailableConnections()}wouldConnectBlock(){return!!this.activeCandidate}applyConnections(){if(this.activeCandidate){s.disable$$module$build$src$core$events$utils(),this.hidePreview(),s.enable$$module$build$src$core$events$utils();var{local:e,closest:t}=this.activeCandidate;if(e.connect(t),this.topBlock.rendered){const i=e.isSuperior()?t:e,r=this.topBlock.getRootBlock();cr().then(()=>{Oh(i.getSourceBlock()),setTimeout(()=>{r.bringToFront()},0)})}}}update(e,t){const i=this.getCandidate(e);((this.wouldDeleteBlock=this.shouldDelete(!!i,t))||this.shouldUpdatePreviews(i,e))&&(s.disable$$module$build$src$core$events$utils(),this.maybeHidePreview(i),this.maybeShowPreview(i),s.enable$$module$build$src$core$events$utils())}createMarkerBlock(e){var t=e.type;s.disable$$module$build$src$core$events$utils();let i;try{if(i=this.workspace.newBlock(t),i.setInsertionMarker(!0),e.saveExtraState){var r=e.saveExtraState();r&&i.loadExtraState&&i.loadExtraState(r)}else if(e.mutationToDom){const c=e.mutationToDom();c&&i.domToMutation&&i.domToMutation(c)}for(t=0;t{let $;($=r)==null||$.getSvgRoot().setAttribute("visibility","visible")}),this.markerConnection=c}hideInsertionMarker(){if(this.markerConnection){var e=this.markerConnection,t=e.getSourceBlock(),i=t.outputConnection,r;if((r=t.previousConnection)!=null&&r.targetConnection||i!=null&&i.targetConnection)t.unplug(!0);else{let c;(c=e.targetBlock())==null||c.unplug(!1)}if(e.targetConnection)throw Error("markerConnection still connected at the end of disconnectInsertionMarker");this.markerConnection=null,(e=t.getSvgRoot())&&e.setAttribute("visibility","hidden")}}showInsertionInputOutline(e){e=e.closest,this.highlightedBlock=e.getSourceBlock(),this.highlightedBlock.highlightShapeForInput(e,!0)}hideInsertionInputOutline(){if(this.highlightedBlock){if(!this.activeCandidate)throw Error("Cannot hide the insertion marker outline because there is no active candidate");this.highlightedBlock.highlightShapeForInput(this.activeCandidate.closest,!1),this.highlightedBlock=null}}showReplacementFade(e){if(this.fadedBlock=e.closest.targetBlock(),!this.fadedBlock)throw Error("Cannot show the replacement fade because the closest connection does not have a target block");this.fadedBlock.fadeForReplacement(!0)}hideReplacementFade(){this.fadedBlock&&(this.fadedBlock.fadeForReplacement(!1),this.fadedBlock=null)}getInsertionMarkers(){const e=[];return this.firstMarker&&e.push(this.firstMarker),this.lastMarker&&e.push(this.lastMarker),e}disposeInsertionMarker(e){if(e){s.disable$$module$build$src$core$events$utils();try{e.dispose()}finally{s.enable$$module$build$src$core$events$utils()}}}};(function(e){e=e.PREVIEW_TYPE||(e.PREVIEW_TYPE={}),e[e.INSERTION_MARKER=0]="INSERTION_MARKER",e[e.INPUT_OUTLINE=1]="INPUT_OUTLINE",e[e.REPLACEMENT_FADE=2]="REPLACEMENT_FADE"})(es||(es={})),es.PREVIEW_TYPE;var CT=class{constructor(e,t){this.dragTarget_=null,this.wouldDeleteBlock_=!1,this.draggingBlock_=e,this.draggedConnectionManager_=new es(this.draggingBlock_),this.workspace_=t,this.startXY_=this.draggingBlock_.getRelativeToSurfaceXY(),this.dragIconData_=Rh(e,this.startXY_)}dispose(){this.dragIconData_.length=0,this.draggedConnectionManager_&&this.draggedConnectionManager_.dispose()}startDrag(e,t){s.getGroup$$module$build$src$core$events$utils()||s.setGroup$$module$build$src$core$events$utils(!0),this.fireDragStartEvent_(),this.workspace_.isMutator&&this.draggingBlock_.bringToFront(),Ce(),this.workspace_.setResizesEnabled(!1),gr(),this.shouldDisconnect_(t)&&this.disconnectBlock_(t,e),this.draggingBlock_.setDragging(!0)}shouldDisconnect_(e){return!!(this.draggingBlock_.getParent()||e&&this.draggingBlock_.nextConnection&&this.draggingBlock_.nextConnection.targetBlock())}disconnectBlock_(e,t){this.draggingBlock_.unplug(e),e=this.pixelsToWorkspaceUnits_(t),e=Ue.sum(this.startXY_,e),this.draggingBlock_.translate(e.x,e.y),Ch(this.draggingBlock_),this.draggedConnectionManager_.updateAvailableConnections()}fireDragStartEvent_(){const e=new(we(Tn))(this.draggingBlock_,!0,this.draggingBlock_.getDescendants(!1));re(e)}drag(e,t){t=this.pixelsToWorkspaceUnits_(t);var i=Ue.sum(this.startXY_,t);this.draggingBlock_.moveDuringDrag(i),this.dragIcons_(t),i=this.dragTarget_,this.dragTarget_=this.workspace_.getDragTarget(e),this.draggedConnectionManager_.update(t,this.dragTarget_),e=this.wouldDeleteBlock_,this.wouldDeleteBlock_=this.draggedConnectionManager_.wouldDeleteBlock,e!==this.wouldDeleteBlock_&&this.updateCursorDuringBlockDrag_(),this.dragTarget_!==i&&(i&&i.onDragExit(this.draggingBlock_),this.dragTarget_&&this.dragTarget_.onDragEnter(this.draggingBlock_)),this.dragTarget_&&this.dragTarget_.onDragOver(this.draggingBlock_)}endDrag(e,t){this.drag(e,t),this.dragIconData_=[],this.fireDragEndEvent_(),ce(),gr(),e=null,this.dragTarget_&&this.dragTarget_.shouldPreventMove(this.draggingBlock_)||(e=this.getNewLocationAfterDrag_(t).delta),this.dragTarget_&&this.dragTarget_.onDrop(this.draggingBlock_),this.maybeDeleteBlock_()||(this.draggingBlock_.setDragging(!1),e?this.updateBlockAfterMove_():fr(this.draggingBlock_.workspace,this.workspace_.getMetricsManager().getScrollMetrics(!0),this.draggingBlock_)),this.workspace_.setResizesEnabled(!0),s.setGroup$$module$build$src$core$events$utils(!1)}getNewLocationAfterDrag_(e){e=this.pixelsToWorkspaceUnits_(e);const t=Ue.sum(this.startXY_,e);return{delta:e,newLocation:t}}maybeDeleteBlock_(){return this.wouldDeleteBlock_?(this.fireMoveEvent_(),this.draggingBlock_.dispose(!1,!0),Tr.length=0,!0):!1}updateBlockAfterMove_(){this.fireMoveEvent_(),this.draggedConnectionManager_.wouldConnectBlock()?this.draggedConnectionManager_.applyConnections():this.draggingBlock_.queueRender(),this.draggingBlock_.scheduleSnapAndBump()}fireDragEndEvent_(){const e=new(we(Tn))(this.draggingBlock_,!1,this.draggingBlock_.getDescendants(!1));re(e)}updateToolboxStyle_(e){const t=this.workspace_.getToolbox();if(t){const i=this.draggingBlock_.isDeletable()?"blocklyToolboxDelete":"blocklyToolboxGrab";e&&typeof t.removeStyle=="function"?t.removeStyle(i):e||typeof t.addStyle!="function"||t.addStyle(i)}}fireMoveEvent_(){if(!this.draggingBlock_.isDeadOrDying()){var e=new(we(s.MOVE$$module$build$src$core$events$utils))(this.draggingBlock_);e.setReason(["drag"]),e.oldCoordinate=this.startXY_,e.recordNew(),re(e)}}updateCursorDuringBlockDrag_(){this.draggingBlock_.setDeleteStyle(this.wouldDeleteBlock_)}pixelsToWorkspaceUnits_(e){return e=new Ue(e.x/this.workspace_.scale,e.y/this.workspace_.scale),this.workspace_.isMutator&&e.scale(1/this.workspace_.options.parentWorkspace.scale),e}dragIcons_(e){for(const t of this.dragIconData_)t.icon.onLocationChange(Ue.sum(t.location,e))}getInsertionMarkers(){return this.draggedConnectionManager_&&this.draggedConnectionManager_.getInsertionMarkers?this.draggedConnectionManager_.getInsertionMarkers():[]}};l(Ae.BLOCK_DRAGGER,li,CT);var Ei=null,l$={duplicateInternal:Zf,copyInternal:Jf},Zl={};Zl.TEST_ONLY=l$,Zl.copy=Nl,Zl.duplicate=pa,Zl.paste=kh;var tu=null,yT={},ou=null,Xs={};Xs.callbackFactory=s.callbackFactory$$module$build$src$core$contextmenu,Xs.commentDeleteOption=Nh,Xs.commentDuplicateOption=wh,Xs.dispose=Lh,Xs.getCurrentBlock=em,Xs.hide=Ml,Xs.setCurrentBlock=Ah,Xs.show=wl,Xs.workspaceCommentOption=nm;var kt=class{constructor(){this.registry_=new Map,this.reset()}reset(){this.registry_.clear()}register(e){if(this.registry_.has(e.id))throw Error('Menu item with ID "'+e.id+'" is already registered.');this.registry_.set(e.id,e)}unregister(e){if(!this.registry_.has(e))throw Error('Menu item with ID "'+e+'" not found.');this.registry_.delete(e)}getItem(e){let t;return(t=this.registry_.get(e))!=null?t:null}getContextMenuOptions(e,t){const i=[];for(const c of this.registry_.values())if(e===c.scopeType){var r=c.preconditionFn(t);r!=="hidden"&&(r={text:typeof c.displayText=="function"?c.displayText(t):c.displayText,enabled:r==="enabled",callback:c.callback,scope:t,weight:c.weight},i.push(r))}return i.sort(function(c,$){return c.weight-$.weight}),i}};(function(e){var t=e.ScopeType||(e.ScopeType={});t.BLOCK="block",t.WORKSPACE="workspace",e.registry=new e})(kt||(kt={})),kt.ScopeType;var ST=30,RT=!0,Mn=[];Mn[qe.INPUT_VALUE]=qe.OUTPUT_VALUE,Mn[qe.OUTPUT_VALUE]=qe.INPUT_VALUE,Mn[qe.NEXT_STATEMENT]=qe.PREVIOUS_STATEMENT,Mn[qe.PREVIOUS_STATEMENT]=qe.NEXT_STATEMENT;var c$="RENAME_VARIABLE_ID",a$="DELETE_VARIABLE_ID",Re=class{constructor(e,t,i){if(this.wsCoordinate=null,!t)throw Error("Cannot create a node without a location.");this.type=e,this.isConnectionLocation=Re.isConnectionType(e),this.location=t,this.processParams(i||null)}processParams(e){e&&e.wsCoordinate&&(this.wsCoordinate=e.wsCoordinate)}getLocation(){return this.location}getType(){return this.type}getWsCoordinate(){return this.wsCoordinate}isConnection(){return this.isConnectionLocation}findNextForInput(){var e=this.location.getParentInput();const t=e.getSourceBlock();for(e=t.inputList.indexOf(e),e+=1;eclearTimeout(e)),this.warningTextDb.clear(),this.getIcons().forEach(e=>e.dispose()))}checkAndDelete(){this.workspace.isFlyout||(s.setGroup$$module$build$src$core$events$utils(!0),this.workspace.hideChaff(),this.outputConnection?this.dispose(!1,!0):this.dispose(!0,!0),s.setGroup$$module$build$src$core$events$utils(!1))}toCopyData(){return this.isInsertionMarker_?null:{saveInfo:xs(this,{addCoordinates:!0,addNextBlocks:!1}),source:this.workspace,typeCounts:F(this,!0)}}applyColour(){this.pathObject.applyColour(this);const e=this.getIcons();for(let t=0;t{this.isDeadOrDying()||(this.warningTextDb.delete(i),this.setWarningText(e,i))},100));else if(this.isInFlyout&&(e=null),t=this.getIcon(vs.TYPE),typeof e=="string"){r=this.getSurroundParent();let c=null;for(;r;)r.isCollapsed()&&(c=r),r=r.getSurroundParent();c&&c.setWarningText(s.Msg$$module$build$src$core$msg.COLLAPSED_WARNINGS_WARNING,ts.COLLAPSED_WARNING_ID),t?t.addMessage(e,i):this.addIcon(new vs(this).addMessage(e,i))}else t&&(i?t.getText()||this.removeIcon(vs.TYPE):this.removeIcon(vs.TYPE))}setMutator(e){this.removeIcon(s.MutatorIcon$$module$build$src$core$icons$mutator_icon.TYPE),e&&this.addIcon(e)}addIcon(e){return super.addIcon(e),e instanceof vs&&(this.warning=e),e instanceof s.MutatorIcon$$module$build$src$core$icons$mutator_icon&&(this.mutator=e),this.rendered&&(e.initView(this.createIconPointerDownListener(e)),e.applyColour(),e.updateEditable(),this.queueRender(),Ds(),this.bumpNeighbours()),e}createIconPointerDownListener(e){return t=>{this.isDeadOrDying()||(t=this.workspace.getGesture(t))&&t.setStartIcon(e)}}removeIcon(e){const t=super.removeIcon(e);return e.equals(vs.TYPE)&&(this.warning=null),e.equals(s.MutatorIcon$$module$build$src$core$icons$mutator_icon.TYPE)&&(this.mutator=null),this.rendered&&(this.queueRender(),Ds(),this.bumpNeighbours()),t}setEnabled(e){this.isEnabled()!==e&&(super.setEnabled(e),this.rendered&&!this.getInheritedDisabled()&&this.updateDisabled())}setHighlighted(e){this.rendered&&this.pathObject.updateHighlighted(e)}addSelect(){this.pathObject.updateSelected(!0)}removeSelect(){this.pathObject.updateSelected(!1)}setDeleteStyle(e){this.pathObject.updateDraggingDelete(e)}getColour(){return this.style.colourPrimary}setColour(e){super.setColour(e),e=this.workspace.getRenderer().getConstants().getBlockStyleForColour(this.colour_),this.pathObject.setStyle(e.style),this.style=e.style,this.styleName_=e.name,this.applyColour()}setStyle(e){const t=this.workspace.getRenderer().getConstants().getBlockStyle(e);if(this.styleName_=e,t)this.hat=t.hat,this.pathObject.setStyle(t),this.colour_=t.colourPrimary,this.style=t,this.applyColour();else throw Error("Invalid style name: "+e)}bringToFront(){let e=this;do{const t=e.getSvgRoot(),i=t.parentNode,r=i.childNodes;r[r.length-1]!==t&&i.appendChild(t),e=e.getParent()}while(e)}setPreviousStatement(e,t){super.setPreviousStatement(e,t),this.rendered&&(this.queueRender(),this.bumpNeighbours())}setNextStatement(e,t){super.setNextStatement(e,t),this.rendered&&(this.queueRender(),this.bumpNeighbours())}setOutput(e,t){super.setOutput(e,t),this.rendered&&(this.queueRender(),this.bumpNeighbours())}setInputsInline(e){super.setInputsInline(e),this.rendered&&(this.queueRender(),this.bumpNeighbours())}removeInput(e,t){return e=super.removeInput(e,t),this.rendered&&(this.queueRender(),this.bumpNeighbours()),e}moveNumberedInputBefore(e,t){super.moveNumberedInputBefore(e,t),this.rendered&&(this.queueRender(),this.bumpNeighbours())}appendInput(e){return super.appendInput(e),this.rendered&&(this.queueRender(),this.bumpNeighbours()),e}setConnectionTracking(e){if(this.previousConnection&&this.previousConnection.setTracking(e),this.outputConnection&&this.outputConnection.setTracking(e),this.nextConnection){this.nextConnection.setTracking(e);var t=this.nextConnection.targetBlock();t&&t.setConnectionTracking(e)}if(!this.collapsed_)for(t=0;t{const t=s.getGroup$$module$build$src$core$events$utils();s.setGroup$$module$build$src$core$events$utils(e),this.getRootBlock().bumpNeighboursInternal(),s.setGroup$$module$build$src$core$events$utils(t),this.bumpNeighboursPid=0},s.config$$module$build$src$core$config.bumpDelay)}}bumpNeighboursInternal(){const e=this.getRootBlock();if(!(this.isDeadOrDying()||this.workspace.isDragging()||e.isInFlyout))for(const t of this.getConnections_(!1)){if(t.isSuperior()){let i;(i=t.targetBlock())==null||i.bumpNeighboursInternal()}for(const i of t.neighbours(s.config$$module$build$src$core$config.snapRadius))i.getSourceBlock().getRootBlock()!==e&&(t.isConnected()&&i.isConnected()||(t.isSuperior()?i.bumpAwayFrom(t):t.bumpAwayFrom(i)))}}scheduleSnapAndBump(){const e=s.getGroup$$module$build$src$core$events$utils();setTimeout(()=>{s.setGroup$$module$build$src$core$events$utils(e),this.snapToGrid(),s.setGroup$$module$build$src$core$events$utils(!1)},s.config$$module$build$src$core$config.bumpDelay/2),this.bumpNeighbours()}positionNearConnection(e,t){e.type!==qe.NEXT_STATEMENT&&e.type!==qe.INPUT_VALUE||this.moveBy(t.x-e.x,t.y-e.y)}getChildren(e){return super.getChildren(e)}queueRender(){return Id(this)}render(){this.queueRender(),Ds()}renderEfficiently(){this.rendered=!0,Ce(),this.isCollapsed()&&this.updateCollapsed_(),this.workspace.getRenderer().render(this),this.tightenChildrenEfficiently(),ce(),this.updateMarkers_()}tightenChildrenEfficiently(){for(const e of this.inputList){const t=e.connection;t&&t.tightenEfficiently()}this.nextConnection&&this.nextConnection.tightenEfficiently()}updateMarkers_(){this.workspace.keyboardAccessibilityMode&&this.pathObject.cursorSvg&&this.workspace.getCursor().draw(),this.workspace.keyboardAccessibilityMode&&this.pathObject.markerSvg&&this.workspace.getMarker(zl.LOCAL_MARKER).draw();for(const e of this.inputList)for(const t of e.fieldRow)t.updateMarkers_()}updateConnectionAndIconLocations(){const e=this.getRelativeToSurfaceXY();this.previousConnection&&this.previousConnection.moveToOffset(e),this.outputConnection&&this.outputConnection.moveToOffset(e);for(let t=0;ti||t.getSourceBlock().isInsertionMarker())return!1;switch(t.type){case qe.PREVIOUS_STATEMENT:return this.canConnectToPrevious_(e,t);case qe.OUTPUT_VALUE:if(t.isConnected()&&!t.targetBlock().isInsertionMarker()||e.isConnected())return!1;break;case qe.INPUT_VALUE:if(t.isConnected()&&!t.targetBlock().isMovable()&&!t.targetBlock().isShadow())return!1;break;case qe.NEXT_STATEMENT:if(t.isConnected()&&!e.getSourceBlock().nextConnection&&!t.targetBlock().isShadow()&&t.targetBlock().nextConnection||t.targetBlock()&&!t.targetBlock().isMovable()&&!t.targetBlock().isShadow())return!1;break;default:return!1}return Tr.indexOf(t)===-1}canConnectToPrevious_(e,t){return e.targetConnection||Tr.indexOf(t)!==-1?!1:t.targetConnection?(e=t.targetBlock(),e.isInsertionMarker()?!e.getPreviousBlock():!1):!0}};l(Ae.CONNECTION_CHECKER,li,NT);var Vr=class{constructor(e){this.connectionChecker=e,this.connections=[]}addConnection(e,t){t=this.calculateIndexForYPos(t),this.connections.splice(t,0,e)}findIndexOfConnection(e,t){if(!this.connections.length)return-1;const i=this.calculateIndexForYPos(t);if(i>=this.connections.length)return-1;t=e.y;let r=i;for(;0<=r&&this.connections[r].y===t;){if(this.connections[r]===e)return r;r--}for(r=i;re)i=r;else{t=r;break}}return t}removeConnection(e,t){if(e=this.findIndexOfConnection(e,t),e===-1)throw Error("Unable to find connection in connectionDB.");this.connections.splice(e,1)}getNeighbours(e,t){function i(Qe){const qt=c-r[Qe].x,Ft=$-r[Qe].y;return Math.sqrt(qt*qt+Ft*Ft)<=t&&Oe.push(r[Qe]),Ft"u"?"":t,this.newContents_=typeof i>"u"?"":i)}toJson(){const e=super.toJson();if(!this.oldContents_)throw Error("The old contents is undefined. Either pass a value to the constructor, or call fromJson");if(!this.newContents_)throw Error("The new contents is undefined. Either pass a value to the constructor, or call fromJson");return e.oldContents=this.oldContents_,e.newContents=this.newContents_,e}static fromJson(e,t,i){return t=super.fromJson(e,t,i??new T$),t.oldContents_=e.oldContents,t.newContents_=e.newContents,t}isNull(){return this.oldContents_===this.newContents_}run(e){var t=this.getEventWorkspace_();if(!this.commentId)throw Error("The comment ID is undefined. Either pass a comment to the constructor, or call fromJson");if(t=t.getCommentById(this.commentId)){var i=e?this.newContents_:this.oldContents_;if(!i)throw Error(e?"The new contents is undefined. Either pass a value to the constructor, or call fromJson":"The old contents is undefined. Either pass a value to the constructor, or call fromJson");t.setContent(i)}else console.warn("Can't change non-existent comment: "+this.commentId)}};l(Ae.EVENT,yr,T$);var E$=class extends Xi{constructor(e){super(e),this.type=Hi,e&&(this.xml=e.toXmlWithXY())}toJson(){const e=super.toJson();if(!this.xml)throw Error("The comment XML is undefined. Either pass a comment to the constructor, or call fromJson");return e.xml=Ps(this.xml),e}static fromJson(e,t,i){return t=super.fromJson(e,t,i??new E$),t.xml=s.textToDom$$module$build$src$core$utils$xml(e.xml),t}run(e){Xi.CommentCreateDeleteHelper(this,e)}};l(Ae.EVENT,Hi,E$);var b$=class extends Xi{constructor(e){super(e),this.type=En,e&&(this.xml=e.toXmlWithXY())}run(e){Xi.CommentCreateDeleteHelper(this,!e)}toJson(){const e=super.toJson();if(!this.xml)throw Error("The comment XML is undefined. Either pass a comment to the constructor, or call fromJson");return e.xml=Ps(this.xml),e}static fromJson(e,t,i){return t=super.fromJson(e,t,i??new b$),t.xml=s.textToDom$$module$build$src$core$utils$xml(e.xml),t}};l(Ae.EVENT,En,b$);var v$=class extends Xi{constructor(e){super(e),this.type=Us,e&&(this.comment_=e,this.oldCoordinate_=e.getRelativeToSurfaceXY())}recordNew(){if(this.newCoordinate_)throw Error("Tried to record the new position of a comment on the same event twice.");if(!this.comment_)throw Error("The comment is undefined. Pass a comment to the constructor if you want to use the record functionality");this.newCoordinate_=this.comment_.getRelativeToSurfaceXY()}setOldCoordinate(e){this.oldCoordinate_=e}toJson(){const e=super.toJson();if(!this.oldCoordinate_)throw Error("The old comment position is undefined. Either pass a comment to the constructor, or call fromJson");if(!this.newCoordinate_)throw Error("The new comment position is undefined. Either call recordNew, or call fromJson");return e.oldCoordinate=`${Math.round(this.oldCoordinate_.x)}, ${Math.round(this.oldCoordinate_.y)}`,e.newCoordinate=Math.round(this.newCoordinate_.x)+","+Math.round(this.newCoordinate_.y),e}static fromJson(e,t,i){return t=super.fromJson(e,t,i??new v$),i=e.oldCoordinate.split(","),t.oldCoordinate_=new Ue(Number(i[0]),Number(i[1])),i=e.newCoordinate.split(","),t.newCoordinate_=new Ue(Number(i[0]),Number(i[1])),t}isNull(){return Ue.equals(this.oldCoordinate_,this.newCoordinate_)}run(e){var t=this.getEventWorkspace_();if(!this.commentId)throw Error("The comment ID is undefined. Either pass a comment to the constructor, or call fromJson");if(t=t.getCommentById(this.commentId)){if(e=e?this.newCoordinate_:this.oldCoordinate_,!e)throw Error("Either oldCoordinate_ or newCoordinate_ is undefined. Either pass a comment to the constructor and call recordNew, or call fromJson");var i=t.getRelativeToSurfaceXY();t.moveBy(e.x-i.x,e.y-i.y)}else console.warn("Can't move non-existent comment: "+this.commentId)}};l(Ae.EVENT,Us,v$);var I$=class extends Vs{constructor(e,t,i,r){let c=e?e.workspace.id:void 0;r&&r.getType()===Re.types.WORKSPACE&&(c=r.getLocation().id),super(c),this.type=vr,this.blockId=e==null?void 0:e.id,this.oldNode=i||void 0,this.newNode=r,this.isCursor=t}toJson(){const e=super.toJson();if(this.isCursor===void 0)throw Error("Whether this is a cursor event or not is undefined. Either pass a value to the constructor, or call fromJson");if(!this.newNode)throw Error("The new node is undefined. Either pass a node to the constructor, or call fromJson");return e.isCursor=this.isCursor,e.blockId=this.blockId,e.oldNode=this.oldNode,e.newNode=this.newNode,e}static fromJson(e,t,i){return t=super.fromJson(e,t,i??new I$),t.isCursor=e.isCursor,t.blockId=e.blockId,t.oldNode=e.oldNode,t.newNode=e.newNode,t}};l(Ae.EVENT,vr,I$);var O$=class extends Vs{constructor(e,t){super(t),this.type=Cr,this.themeName=e}toJson(){const e=super.toJson();if(!this.themeName)throw Error("The theme name is undefined. Either pass a theme name to the constructor, or call fromJson");return e.themeName=this.themeName,e}static fromJson(e,t,i){return t=super.fromJson(e,t,i??new O$),t.themeName=e.themeName,t}};l(Ae.EVENT,Cr,O$);var C$=class extends Vs{constructor(e,t,i){super(i),this.type=Or,this.oldItem=e??void 0,this.newItem=t??void 0}toJson(){const e=super.toJson();return e.oldItem=this.oldItem,e.newItem=this.newItem,e}static fromJson(e,t,i){return t=super.fromJson(e,t,i??new C$),t.oldItem=e.oldItem,t.newItem=e.newItem,t}};l(Ae.EVENT,Or,C$);var y$=class extends Vs{constructor(e,t){super(t),this.type=Ir,this.isOpen=e}toJson(){const e=super.toJson();if(this.isOpen===void 0)throw Error("Whether this is already open or not is undefined. Either pass a value to the constructor, or call fromJson");return e.isOpen=this.isOpen,e}static fromJson(e,t,i){return t=super.fromJson(e,t,i??new y$),t.isOpen=e.isOpen,t}};l(Ae.EVENT,Ir,y$);var S$=class extends Ul{constructor(e){super(e),this.type=mn,e&&(this.varType=e.type,this.varName=e.name)}toJson(){const e=super.toJson();if(this.varType===void 0)throw Error("The var type is undefined. Either pass a variable to the constructor, or call fromJson");if(!this.varName)throw Error("The var name is undefined. Either pass a variable to the constructor, or call fromJson");return e.varType=this.varType,e.varName=this.varName,e}static fromJson(e,t,i){return t=super.fromJson(e,t,i??new S$),t.varType=e.varType,t.varName=e.varName,t}run(e){const t=this.getEventWorkspace_();if(!this.varId)throw Error("The var ID is undefined. Either pass a variable to the constructor, or call fromJson");if(!this.varName)throw Error("The var name is undefined. Either pass a variable to the constructor, or call fromJson");e?t.deleteVariableById(this.varId):t.createVariable(this.varName,this.varType,this.varId)}};l(Ae.EVENT,mn,S$);var R$=class extends Ul{constructor(e,t){super(e),this.type=br,e&&(this.oldName=e.name,this.newName=typeof t>"u"?"":t)}toJson(){const e=super.toJson();if(!this.oldName)throw Error("The old var name is undefined. Either pass a variable to the constructor, or call fromJson");if(!this.newName)throw Error("The new var name is undefined. Either pass a value to the constructor, or call fromJson");return e.oldName=this.oldName,e.newName=this.newName,e}static fromJson(e,t,i){return t=super.fromJson(e,t,i??new R$),t.oldName=e.oldName,t.newName=e.newName,t}run(e){const t=this.getEventWorkspace_();if(!this.varId)throw Error("The var ID is undefined. Either pass a variable to the constructor, or call fromJson");if(!this.oldName)throw Error("The old var name is undefined. Either pass a variable to the constructor, or call fromJson");if(!this.newName)throw Error("The new var name is undefined. Either pass a value to the constructor, or call fromJson");e?t.renameVariableById(this.varId,this.newName):t.renameVariableById(this.varId,this.oldName)}};l(Ae.EVENT,br,R$);var k$=class extends Vs{constructor(e,t,i,r,c){super(r),this.type=Ui,this.viewTop=e,this.viewLeft=t,this.scale=i,this.oldScale=c}toJson(){const e=super.toJson();if(this.viewTop===void 0)throw Error("The view top is undefined. Either pass a value to the constructor, or call fromJson");if(this.viewLeft===void 0)throw Error("The view left is undefined. Either pass a value to the constructor, or call fromJson");if(this.scale===void 0)throw Error("The scale is undefined. Either pass a value to the constructor, or call fromJson");if(this.oldScale===void 0)throw Error("The old scale is undefined. Either pass a value to the constructor, or call fromJson");return e.viewTop=this.viewTop,e.viewLeft=this.viewLeft,e.scale=this.scale,e.oldScale=this.oldScale,e}static fromJson(e,t,i){return t=super.fromJson(e,t,i??new k$),t.viewTop=e.viewTop,t.viewLeft=e.viewLeft,t.scale=e.scale,t.oldScale=e.oldScale,t}};l(Ae.EVENT,Ui,k$),s.CHANGE$$module$build$src$core$events$utils,s.CREATE$$module$build$src$core$events$utils,s.DELETE$$module$build$src$core$events$utils,s.MOVE$$module$build$src$core$events$utils,s.CHANGE$$module$build$src$core$events$utils,s.CREATE$$module$build$src$core$events$utils,s.DELETE$$module$build$src$core$events$utils,s.MOVE$$module$build$src$core$events$utils,s.disable$$module$build$src$core$events$utils,s.enable$$module$build$src$core$events$utils,s.getGroup$$module$build$src$core$events$utils,s.setGroup$$module$build$src$core$events$utils;var Ye={};Ye.Abstract=Rr,Ye.BLOCK_CHANGE=s.CHANGE$$module$build$src$core$events$utils,Ye.BLOCK_CREATE=s.CREATE$$module$build$src$core$events$utils,Ye.BLOCK_DELETE=s.DELETE$$module$build$src$core$events$utils,Ye.BLOCK_DRAG=Tn,Ye.BLOCK_FIELD_INTERMEDIATE_CHANGE=Bi,Ye.BLOCK_MOVE=s.MOVE$$module$build$src$core$events$utils,Ye.BUBBLE_OPEN=Fs,Ye.BUMP_EVENTS=ya,Ye.BlockBase=yn,Ye.BlockChange=Sn,Ye.BlockCreate=xp,Ye.BlockDelete=Bp,Ye.BlockDrag=n$,Ye.BlockFieldIntermediateChange=p$,Ye.BlockMove=$$,Ye.BubbleOpen=_$,Ye.BubbleType=g$,Ye.CHANGE=s.CHANGE$$module$build$src$core$events$utils,Ye.CLICK=ai,Ye.COMMENT_CHANGE=yr,Ye.COMMENT_CREATE=Hi,Ye.COMMENT_DELETE=En,Ye.COMMENT_MOVE=Us,Ye.CREATE=s.CREATE$$module$build$src$core$events$utils,Ye.Click=f$,Ye.ClickTarget=m$,Ye.CommentBase=Xi,Ye.CommentChange=T$,Ye.CommentCreate=E$,Ye.CommentDelete=b$,Ye.CommentMove=v$,Ye.DELETE=s.DELETE$$module$build$src$core$events$utils,Ye.FINISHED_LOADING=bn,Ye.FinishedLoading=iT,Ye.MARKER_MOVE=vr,Ye.MOVE=s.MOVE$$module$build$src$core$events$utils,Ye.MarkerMove=I$,Ye.SELECTED=ci,Ye.Selected=yp,Ye.THEME_CHANGE=Cr,Ye.TOOLBOX_ITEM_SELECT=Or,Ye.TRASHCAN_OPEN=Ir,Ye.ThemeChange=O$,Ye.ToolboxItemSelect=C$,Ye.TrashcanOpen=y$,Ye.UI=Ca,Ye.UiBase=Vs,Ye.VAR_CREATE=Fi,Ye.VAR_DELETE=mn,Ye.VAR_RENAME=br,Ye.VIEWPORT_CHANGE=Ui,Ye.VarBase=Ul,Ye.VarCreate=Ip,Ye.VarDelete=S$,Ye.VarRename=R$,Ye.ViewportChange=k$,Ye.clearPendingUndo=ae,Ye.disable=s.disable$$module$build$src$core$events$utils,Ye.disableOrphans=We,Ye.enable=s.enable$$module$build$src$core$events$utils,Ye.filter=B,Ye.fire=re,Ye.fromJson=Je,Ye.get=we,Ye.getDescendantIds=Xe,Ye.getGroup=s.getGroup$$module$build$src$core$events$utils,Ye.getRecordUndo=ke,Ye.isEnabled=_e,Ye.setGroup=s.setGroup$$module$build$src$core$events$utils,Ye.setRecordUndo=fe;var oc=class{constructor(){this.NO_PADDING=0,this.SMALL_PADDING=3,this.MEDIUM_PADDING=5,this.MEDIUM_LARGE_PADDING=8,this.LARGE_PADDING=10,this.TAB_HEIGHT=15,this.TAB_OFFSET_FROM_TOP=5,this.TAB_VERTICAL_OVERLAP=2.5,this.TAB_WIDTH=8,this.NOTCH_WIDTH=15,this.NOTCH_HEIGHT=4,this.MIN_BLOCK_WIDTH=12,this.EMPTY_BLOCK_SPACER_HEIGHT=16,this.CORNER_RADIUS=8,this.NOTCH_OFFSET_LEFT=15,this.STATEMENT_BOTTOM_SPACER=0,this.STATEMENT_INPUT_PADDING_LEFT=20,this.BETWEEN_STATEMENT_PADDING_Y=4,this.ADD_START_HATS=!1,this.START_HAT_HEIGHT=15,this.START_HAT_WIDTH=100,this.SPACER_DEFAULT_HEIGHT=15,this.MIN_BLOCK_HEIGHT=24,this.EMPTY_INLINE_INPUT_PADDING=14.5,this.EXTERNAL_VALUE_INPUT_PADDING=2,this.JAGGED_TEETH_HEIGHT=12,this.JAGGED_TEETH_WIDTH=6,this.FIELD_TEXT_FONTSIZE=11,this.FIELD_TEXT_FONTWEIGHT="normal",this.FIELD_TEXT_FONTFAMILY="sans-serif",this.FIELD_TEXT_BASELINE=this.FIELD_TEXT_HEIGHT=-1,this.FIELD_BORDER_RECT_RADIUS=4,this.FIELD_BORDER_RECT_HEIGHT=16,this.FIELD_BORDER_RECT_X_PADDING=5,this.FIELD_BORDER_RECT_Y_PADDING=3,this.FIELD_BORDER_RECT_COLOUR="#fff",this.FIELD_DROPDOWN_SVG_ARROW=this.FIELD_DROPDOWN_COLOURED_DIV=this.FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW=!1,this.FIELD_DROPDOWN_SVG_ARROW_SIZE=12,this.FIELD_COLOUR_FULL_BLOCK=this.FIELD_TEXTINPUT_BOX_SHADOW=!1,this.FIELD_COLOUR_DEFAULT_WIDTH=26,this.defs=null,this.embossFilterId="",this.embossFilter=null,this.disabledPatternId="",this.disabledPattern=null,this.debugFilterId="",this.cssNode=this.debugFilter=null,this.CURSOR_COLOUR="#cc0a0a",this.MARKER_COLOUR="#4286f4",this.CURSOR_WS_WIDTH=100,this.WS_CURSOR_HEIGHT=5,this.CURSOR_STACK_PADDING=10,this.CURSOR_BLOCK_PADDING=2,this.CURSOR_STROKE_WIDTH=4,this.FULL_BLOCK_FIELDS=!1,this.INSERTION_MARKER_COLOUR="#000000",this.INSERTION_MARKER_OPACITY=.2,this.SHAPES={PUZZLE:1,NOTCH:2},this.TALL_INPUT_FIELD_OFFSET_Y=this.MEDIUM_PADDING,this.DUMMY_INPUT_SHADOW_MIN_HEIGHT=this.DUMMY_INPUT_MIN_HEIGHT=this.TAB_HEIGHT,this.STATEMENT_INPUT_NOTCH_OFFSET=this.NOTCH_OFFSET_LEFT,this.TOP_ROW_MIN_HEIGHT=this.MEDIUM_PADDING,this.TOP_ROW_PRECEDES_STATEMENT_MIN_HEIGHT=this.LARGE_PADDING,this.BOTTOM_ROW_MIN_HEIGHT=this.MEDIUM_PADDING,this.BOTTOM_ROW_AFTER_STATEMENT_MIN_HEIGHT=this.LARGE_PADDING,this.EMPTY_INLINE_INPUT_HEIGHT=this.TAB_HEIGHT+11,this.EMPTY_STATEMENT_INPUT_HEIGHT=this.MIN_BLOCK_HEIGHT,this.START_POINT=jt(0,0),this.FIELD_TEXT_BASELINE_CENTER=!0,this.FIELD_DROPDOWN_BORDER_RECT_HEIGHT=this.FIELD_BORDER_RECT_HEIGHT,this.FIELD_DROPDOWN_SVG_ARROW_PADDING=this.FIELD_BORDER_RECT_X_PADDING,this.FIELD_DROPDOWN_SVG_ARROW_DATAURI="data:image/svg+xml;base64,PHN2ZyBpZD0iTGF5ZXJfMSIgZGF0YS1uYW1lPSJMYXllciAxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMi43MSIgaGVpZ2h0PSI4Ljc5IiB2aWV3Qm94PSIwIDAgMTIuNzEgOC43OSI+PHRpdGxlPmRyb3Bkb3duLWFycm93PC90aXRsZT48ZyBvcGFjaXR5PSIwLjEiPjxwYXRoIGQ9Ik0xMi43MSwyLjQ0QTIuNDEsMi40MSwwLDAsMSwxMiw0LjE2TDguMDgsOC4wOGEyLjQ1LDIuNDUsMCwwLDEtMy40NSwwTDAuNzIsNC4xNkEyLjQyLDIuNDIsMCwwLDEsMCwyLjQ0LDIuNDgsMi40OCwwLDAsMSwuNzEuNzFDMSwwLjQ3LDEuNDMsMCw2LjM2LDBTMTEuNzUsMC40NiwxMiwuNzFBMi40NCwyLjQ0LDAsMCwxLDEyLjcxLDIuNDRaIiBmaWxsPSIjMjMxZjIwIi8+PC9nPjxwYXRoIGQ9Ik02LjM2LDcuNzlhMS40MywxLjQzLDAsMCwxLTEtLjQyTDEuNDIsMy40NWExLjQ0LDEuNDQsMCwwLDEsMC0yYzAuNTYtLjU2LDkuMzEtMC41Niw5Ljg3LDBhMS40NCwxLjQ0LDAsMCwxLDAsMkw3LjM3LDcuMzdBMS40MywxLjQzLDAsMCwxLDYuMzYsNy43OVoiIGZpbGw9IiNmZmYiLz48L3N2Zz4=",this.FIELD_COLOUR_DEFAULT_HEIGHT=this.FIELD_BORDER_RECT_HEIGHT,this.FIELD_CHECKBOX_X_OFFSET=this.FIELD_BORDER_RECT_X_PADDING-3,this.randomIdentifier=String(Math.random()).substring(2)}init(){this.JAGGED_TEETH=this.makeJaggedTeeth(),this.NOTCH=this.makeNotch(),this.START_HAT=this.makeStartHat(),this.PUZZLE_TAB=this.makePuzzleTab(),this.INSIDE_CORNERS=this.makeInsideCorners(),this.OUTSIDE_CORNERS=this.makeOutsideCorners()}setTheme(e){this.blockStyles=Object.create(null);const t=e.blockStyles;for(const i in t)this.blockStyles[i]=this.validatedBlockStyle_(t[i]);this.setDynamicProperties_(e)}setDynamicProperties_(e){this.setFontConstants_(e),this.setComponentConstants_(e),this.ADD_START_HATS=e.startHats!==void 0?e.startHats:this.ADD_START_HATS}setFontConstants_(e){e.fontStyle&&e.fontStyle.family&&(this.FIELD_TEXT_FONTFAMILY=e.fontStyle.family),e.fontStyle&&e.fontStyle.weight&&(this.FIELD_TEXT_FONTWEIGHT=e.fontStyle.weight),e.fontStyle&&e.fontStyle.size&&(this.FIELD_TEXT_FONTSIZE=e.fontStyle.size),e=be("Hg",this.FIELD_TEXT_FONTSIZE+"pt",this.FIELD_TEXT_FONTWEIGHT,this.FIELD_TEXT_FONTFAMILY),this.FIELD_TEXT_HEIGHT=e.height,this.FIELD_TEXT_BASELINE=e.baseline}setComponentConstants_(e){this.CURSOR_COLOUR=e.getComponentStyle("cursorColour")||this.CURSOR_COLOUR,this.MARKER_COLOUR=e.getComponentStyle("markerColour")||this.MARKER_COLOUR,this.INSERTION_MARKER_COLOUR=e.getComponentStyle("insertionMarkerColour")||this.INSERTION_MARKER_COLOUR,this.INSERTION_MARKER_OPACITY=Number(e.getComponentStyle("insertionMarkerOpacity"))||this.INSERTION_MARKER_OPACITY}getBlockStyleForColour(e){const t="auto_"+e;return this.blockStyles[t]||(this.blockStyles[t]=this.createBlockStyle_(e)),{style:this.blockStyles[t],name:t}}getBlockStyle(e){return this.blockStyles[e||""]||(e&&e.indexOf("auto_")===0?this.getBlockStyleForColour(e.substring(5)).style:this.createBlockStyle_("#000000"))}createBlockStyle_(e){return this.validatedBlockStyle_({colourPrimary:e})}validatedBlockStyle_(e){const t={};return e&&Object.assign(t,e),e=$r(t.colourPrimary||"#000"),t.colourPrimary=e.hex,t.colourSecondary=t.colourSecondary?$r(t.colourSecondary).hex:this.generateSecondaryColour_(t.colourPrimary),t.colourTertiary=t.colourTertiary?$r(t.colourTertiary).hex:this.generateTertiaryColour_(t.colourPrimary),t.hat=t.hat||"",t}generateSecondaryColour_(e){return gn("#fff",e,.6)||e}generateTertiaryColour_(e){return gn("#fff",e,.3)||e}dispose(){this.embossFilter&&U(this.embossFilter),this.disabledPattern&&U(this.disabledPattern),this.debugFilter&&U(this.debugFilter),this.cssNode=null}makeJaggedTeeth(){const e=this.JAGGED_TEETH_HEIGHT,t=this.JAGGED_TEETH_WIDTH,i=_r([tt(t,e/4),tt(2*-t,e/2),tt(t,e/4)]);return{height:e,width:t,path:i}}makeStartHat(){const e=this.START_HAT_HEIGHT,t=this.START_HAT_WIDTH,i=xo("c",[tt(30,-e),tt(70,-e),tt(t,0)]);return{height:e,width:t,path:i}}makePuzzleTab(){function e($){$=$?-1:1;const v=-$;var H=i/2;const Oe=H+2.5,Qe=H+.5,qt=tt(-t,$*H);return H=tt(t,$*H),xo("c",[tt(0,$*Oe),tt(-t,v*Qe),qt])+xo("s",[tt(t,2.5*v),H])}const t=this.TAB_WIDTH,i=this.TAB_HEIGHT,r=e(!0),c=e(!1);return{type:this.SHAPES.PUZZLE,width:t,height:i,pathDown:c,pathUp:r}}makeNotch(){function e(v){return _r([tt(v*r,i),tt(3*v,0),tt(v*r,-i)])}const t=this.NOTCH_WIDTH,i=this.NOTCH_HEIGHT,r=(t-3)/2,c=e(1),$=e(-1);return{type:this.SHAPES.NOTCH,width:t,height:i,pathLeft:c,pathRight:$}}makeInsideCorners(){const e=this.CORNER_RADIUS,t=oo("a","0 0,0",e,tt(-e,e)),i=oo("a","0 0,0",e,tt(e,e));return{width:e,height:e,pathTop:t,pathBottom:i}}makeOutsideCorners(){const e=this.CORNER_RADIUS,t=jt(0,e)+oo("a","0 0,1",e,tt(e,-e)),i=oo("a","0 0,1",e,tt(e,e)),r=oo("a","0 0,1",e,tt(-e,-e)),c=oo("a","0 0,1",e,tt(-e,e));return{topLeft:t,topRight:i,bottomRight:c,bottomLeft:r,rightHeight:e}}shapeFor(e){switch(e.type){case qe.INPUT_VALUE:case qe.OUTPUT_VALUE:return this.PUZZLE_TAB;case qe.PREVIOUS_STATEMENT:case qe.NEXT_STATEMENT:return this.NOTCH;default:throw Error("Unknown connection type")}}createDom(e,t,i){this.injectCSS_(t,i),this.defs=w(te.DEFS,{},e),e=w(te.FILTER,{id:"blocklyEmbossFilter"+this.randomIdentifier},this.defs),w(te.FEGAUSSIANBLUR,{in:"SourceAlpha",stdDeviation:1,result:"blur"},e),t=w(te.FESPECULARLIGHTING,{in:"blur",surfaceScale:1,specularConstant:.5,specularExponent:10,"lighting-color":"white",result:"specOut"},e),w(te.FEPOINTLIGHT,{x:-5e3,y:-1e4,z:2e4},t),w(te.FECOMPOSITE,{in:"specOut",in2:"SourceAlpha",operator:"in",result:"specOut"},e),w(te.FECOMPOSITE,{in:"SourceGraphic",in2:"specOut",operator:"arithmetic",k1:0,k2:1,k3:1,k4:0},e),this.embossFilterId=e.id,this.embossFilter=e,e=w(te.PATTERN,{id:"blocklyDisabledPattern"+this.randomIdentifier,patternUnits:"userSpaceOnUse",width:10,height:10},this.defs),w(te.RECT,{width:10,height:10,fill:"#aaa"},e),w(te.PATH,{d:"M 0 0 L 10 10 M 10 0 L 0 10",stroke:"#cc0"},e),this.disabledPatternId=e.id,this.disabledPattern=e,this.createDebugFilter()}createDebugFilter(){if(!this.debugFilter){const e=w(te.FILTER,{id:"blocklyDebugFilter"+this.randomIdentifier,height:"160%",width:"180%",y:"-30%",x:"-40%"},this.defs),t=w(te.FECOMPONENTTRANSFER,{result:"outBlur"},e);w(te.FEFUNCA,{type:"table",tableValues:"0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"},t),w(te.FEFLOOD,{"flood-color":"#ff0000","flood-opacity":.5,result:"outColor"},e),w(te.FECOMPOSITE,{in:"outColor",in2:"outBlur",operator:"in",result:"outGlow"},e),this.debugFilterId=e.id,this.debugFilter=e}}injectCSS_(e,t){t=this.getCSS_(t),e="blockly-renderer-style-"+e,this.cssNode=document.getElementById(e);const i=t.join(`
+`);this.cssNode?this.cssNode.firstChild.textContent=i:(t=document.createElement("style"),t.id=e,e=document.createTextNode(i),t.appendChild(e),document.head.insertBefore(t,document.head.firstChild),this.cssNode=t)}getCSS_(e){return[`${e} .blocklyText, `,`${e} .blocklyFlyoutLabelText {`,`font: ${this.FIELD_TEXT_FONTWEIGHT} ${this.FIELD_TEXT_FONTSIZE}pt ${this.FIELD_TEXT_FONTFAMILY};`,"}",`${e} .blocklyText {`,"fill: #fff;","}",`${e} .blocklyNonEditableText>rect,`,`${e} .blocklyEditableText>rect {`,`fill: ${this.FIELD_BORDER_RECT_COLOUR};`,"fill-opacity: .6;","stroke: none;","}",`${e} .blocklyNonEditableText>text,`,`${e} .blocklyEditableText>text {`,"fill: #000;","}",`${e} .blocklyFlyoutLabelText {`,"fill: #000;","}",`${e} .blocklyText.blocklyBubbleText {`,"fill: #000;","}",`${e} .blocklyEditableText:not(.editing):hover>rect {`,"stroke: #fff;","stroke-width: 2;","}",`${e} .blocklyHtmlInput {`,`font-family: ${this.FIELD_TEXT_FONTFAMILY};`,`font-weight: ${this.FIELD_TEXT_FONTWEIGHT};`,"}",`${e} .blocklySelected>.blocklyPath {`,"stroke: #fc3;","stroke-width: 3px;","}",`${e} .blocklyHighlightedConnectionPath {`,"stroke: #fc3;","}",`${e} .blocklyReplaceable .blocklyPath {`,"fill-opacity: .5;","}",`${e} .blocklyReplaceable .blocklyPathLight,`,`${e} .blocklyReplaceable .blocklyPathDark {`,"display: none;","}",`${e} .blocklyInsertionMarker>.blocklyPath {`,`fill-opacity: ${this.INSERTION_MARKER_OPACITY};`,"stroke: none;","}"]}},wT=class extends oc{constructor(){super(),this.GRID_UNIT=4,this.CURSOR_COLOUR="#ffa200",this.CURSOR_RADIUS=5,this.JAGGED_TEETH_WIDTH=this.JAGGED_TEETH_HEIGHT=0,this.START_HAT_HEIGHT=22,this.START_HAT_WIDTH=96,this.SHAPES={HEXAGONAL:1,ROUND:2,SQUARE:3,PUZZLE:4,NOTCH:5},this.SHAPE_IN_SHAPE_PADDING={1:{0:5*this.GRID_UNIT,1:2*this.GRID_UNIT,2:5*this.GRID_UNIT,3:5*this.GRID_UNIT},2:{0:3*this.GRID_UNIT,1:3*this.GRID_UNIT,2:1*this.GRID_UNIT,3:2*this.GRID_UNIT},3:{0:2*this.GRID_UNIT,1:2*this.GRID_UNIT,2:2*this.GRID_UNIT,3:2*this.GRID_UNIT}},this.FULL_BLOCK_FIELDS=!0,this.FIELD_TEXT_FONTWEIGHT="bold",this.FIELD_TEXT_FONTFAMILY='"Helvetica Neue", "Segoe UI", Helvetica, sans-serif',this.FIELD_COLOUR_FULL_BLOCK=this.FIELD_TEXTINPUT_BOX_SHADOW=this.FIELD_DROPDOWN_SVG_ARROW=this.FIELD_DROPDOWN_COLOURED_DIV=this.FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW=!0,this.SELECTED_GLOW_COLOUR="#fff200",this.SELECTED_GLOW_SIZE=.5,this.REPLACEMENT_GLOW_COLOUR="#fff200",this.REPLACEMENT_GLOW_SIZE=2,this.selectedGlowFilterId="",this.selectedGlowFilter=null,this.replacementGlowFilterId="",this.SQUARED=this.ROUNDED=this.HEXAGONAL=this.replacementGlowFilter=null,this.SMALL_PADDING=this.GRID_UNIT,this.MEDIUM_PADDING=2*this.GRID_UNIT,this.MEDIUM_LARGE_PADDING=3*this.GRID_UNIT,this.LARGE_PADDING=4*this.GRID_UNIT,this.CORNER_RADIUS=1*this.GRID_UNIT,this.NOTCH_WIDTH=9*this.GRID_UNIT,this.NOTCH_HEIGHT=2*this.GRID_UNIT,this.STATEMENT_INPUT_NOTCH_OFFSET=this.NOTCH_OFFSET_LEFT=3*this.GRID_UNIT,this.MIN_BLOCK_WIDTH=2*this.GRID_UNIT,this.MIN_BLOCK_HEIGHT=12*this.GRID_UNIT,this.EMPTY_STATEMENT_INPUT_HEIGHT=6*this.GRID_UNIT,this.TOP_ROW_MIN_HEIGHT=this.CORNER_RADIUS,this.TOP_ROW_PRECEDES_STATEMENT_MIN_HEIGHT=this.LARGE_PADDING,this.BOTTOM_ROW_MIN_HEIGHT=this.CORNER_RADIUS,this.BOTTOM_ROW_AFTER_STATEMENT_MIN_HEIGHT=6*this.GRID_UNIT,this.STATEMENT_BOTTOM_SPACER=-this.NOTCH_HEIGHT,this.STATEMENT_INPUT_SPACER_MIN_WIDTH=40*this.GRID_UNIT,this.STATEMENT_INPUT_PADDING_LEFT=4*this.GRID_UNIT,this.EMPTY_INLINE_INPUT_PADDING=4*this.GRID_UNIT,this.EMPTY_INLINE_INPUT_HEIGHT=8*this.GRID_UNIT,this.DUMMY_INPUT_MIN_HEIGHT=8*this.GRID_UNIT,this.DUMMY_INPUT_SHADOW_MIN_HEIGHT=6*this.GRID_UNIT,this.CURSOR_WS_WIDTH=20*this.GRID_UNIT,this.FIELD_TEXT_FONTSIZE=3*this.GRID_UNIT,this.FIELD_BORDER_RECT_RADIUS=this.CORNER_RADIUS,this.FIELD_BORDER_RECT_X_PADDING=2*this.GRID_UNIT,this.FIELD_BORDER_RECT_Y_PADDING=1.625*this.GRID_UNIT,this.FIELD_BORDER_RECT_HEIGHT=8*this.GRID_UNIT,this.FIELD_DROPDOWN_BORDER_RECT_HEIGHT=8*this.GRID_UNIT,this.FIELD_DROPDOWN_SVG_ARROW_PADDING=this.FIELD_BORDER_RECT_X_PADDING,this.FIELD_COLOUR_DEFAULT_WIDTH=2*this.GRID_UNIT,this.FIELD_COLOUR_DEFAULT_HEIGHT=4*this.GRID_UNIT,this.FIELD_CHECKBOX_X_OFFSET=1*this.GRID_UNIT,this.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH=12*this.GRID_UNIT}setFontConstants_(e){super.setFontConstants_(e),this.FIELD_DROPDOWN_BORDER_RECT_HEIGHT=this.FIELD_BORDER_RECT_HEIGHT=this.FIELD_TEXT_HEIGHT+2*this.FIELD_BORDER_RECT_Y_PADDING}init(){super.init(),this.HEXAGONAL=this.makeHexagonal(),this.ROUNDED=this.makeRounded(),this.SQUARED=this.makeSquared(),this.STATEMENT_INPUT_NOTCH_OFFSET=this.NOTCH_OFFSET_LEFT+this.INSIDE_CORNERS.rightWidth}setDynamicProperties_(e){super.setDynamicProperties_(e),this.SELECTED_GLOW_COLOUR=e.getComponentStyle("selectedGlowColour")||this.SELECTED_GLOW_COLOUR;const t=Number(e.getComponentStyle("selectedGlowSize"));this.SELECTED_GLOW_SIZE=t&&!isNaN(t)?t:this.SELECTED_GLOW_SIZE,this.REPLACEMENT_GLOW_COLOUR=e.getComponentStyle("replacementGlowColour")||this.REPLACEMENT_GLOW_COLOUR,this.REPLACEMENT_GLOW_SIZE=(e=Number(e.getComponentStyle("replacementGlowSize")))&&!isNaN(e)?e:this.REPLACEMENT_GLOW_SIZE}dispose(){super.dispose(),this.selectedGlowFilter&&U(this.selectedGlowFilter),this.replacementGlowFilter&&U(this.replacementGlowFilter)}makeStartHat(){const e=this.START_HAT_HEIGHT,t=this.START_HAT_WIDTH,i=xo("c",[tt(25,-e),tt(71,-e),tt(t,0)]);return{height:e,width:t,path:i}}makeHexagonal(){function e(i,r,c){var $=i/2;return $=$>t?t:$,c=c?-1:1,i=(r?-1:1)*i/2,Bs(-c*$,i)+Bs(c*$,i)}const t=this.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH;return{type:this.SHAPES.HEXAGONAL,isDynamic:!0,width(i){return i/=2,i>t?t:i},height(i){return i},connectionOffsetY(i){return i/2},connectionOffsetX(i){return-i},pathDown(i){return e(i,!1,!1)},pathUp(i){return e(i,!0,!1)},pathRightDown(i){return e(i,!1,!0)},pathRightUp(i){return e(i,!1,!0)}}}makeRounded(){function e(r,c,$){const v=r>i?r-i:0;return r=(r>i?i:r)/2,oo("a","0 0,1",r,tt((c?-1:1)*r,(c?-1:1)*r))+je("v",($?1:-1)*v)+oo("a","0 0,1",r,tt((c?1:-1)*r,(c?-1:1)*r))}const t=this.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH,i=2*t;return{type:this.SHAPES.ROUND,isDynamic:!0,width(r){return r/=2,r>t?t:r},height(r){return r},connectionOffsetY(r){return r/2},connectionOffsetX(r){return-r},pathDown(r){return e(r,!1,!1)},pathUp(r){return e(r,!0,!1)},pathRightDown(r){return e(r,!1,!0)},pathRightUp(r){return e(r,!1,!0)}}}makeSquared(){function e(i,r,c){return i-=2*t,oo("a","0 0,1",t,tt((r?-1:1)*t,(r?-1:1)*t))+je("v",(c?1:-1)*i)+oo("a","0 0,1",t,tt((r?1:-1)*t,(r?-1:1)*t))}const t=this.CORNER_RADIUS;return{type:this.SHAPES.SQUARE,isDynamic:!0,width(i){return t},height(i){return i},connectionOffsetY(i){return i/2},connectionOffsetX(i){return-i},pathDown(i){return e(i,!1,!1)},pathUp(i){return e(i,!0,!1)},pathRightDown(i){return e(i,!1,!0)},pathRightUp(i){return e(i,!1,!0)}}}shapeFor(e){let t=e.getCheck();switch(!t&&e.targetConnection&&(t=e.targetConnection.getCheck()),e.type){case qe.INPUT_VALUE:case qe.OUTPUT_VALUE:if(e=e.getSourceBlock().getOutputShape(),e!==null)switch(e){case this.SHAPES.HEXAGONAL:return this.HEXAGONAL;case this.SHAPES.ROUND:return this.ROUNDED;case this.SHAPES.SQUARE:return this.SQUARED}return t&&t.indexOf("Boolean")!==-1?this.HEXAGONAL:t&&t.indexOf("Number")!==-1?this.ROUNDED:(t&&t.indexOf("String"),this.ROUNDED);case qe.PREVIOUS_STATEMENT:case qe.NEXT_STATEMENT:return this.NOTCH;default:throw Error("Unknown type")}}makeNotch(){function e(Qe){return xo("c",[tt(Qe*c/2,0),tt(Qe*c*3/4,v/2),tt(Qe*c,v)])+_r([tt(Qe*c,$)])+xo("c",[tt(Qe*c/4,v/2),tt(Qe*c/2,v),tt(Qe*c,v)])+je("h",Qe*r)+xo("c",[tt(Qe*c/2,0),tt(Qe*c*3/4,-(v/2)),tt(Qe*c,-v)])+_r([tt(Qe*c,-$)])+xo("c",[tt(Qe*c/4,-(v/2)),tt(Qe*c/2,-v),tt(Qe*c,-v)])}const t=this.NOTCH_WIDTH,i=this.NOTCH_HEIGHT,r=t/3,c=r/3,$=i/2,v=$/2,H=e(1),Oe=e(-1);return{type:this.SHAPES.NOTCH,width:t,height:i,pathLeft:H,pathRight:Oe}}makeInsideCorners(){const e=this.CORNER_RADIUS,t=oo("a","0 0,0",e,tt(-e,e)),i=oo("a","0 0,1",e,tt(-e,e)),r=oo("a","0 0,0",e,tt(e,e)),c=oo("a","0 0,1",e,tt(e,e));return{width:e,height:e,pathTop:t,pathBottom:r,rightWidth:e,rightHeight:e,pathTopRight:i,pathBottomRight:c}}generateSecondaryColour_(e){return gn("#000",e,.15)||e}generateTertiaryColour_(e){return gn("#000",e,.25)||e}createDom(e,t,i){super.createDom(e,t,i),e=w(te.DEFS,{},e),t=w(te.FILTER,{id:"blocklySelectedGlowFilter"+this.randomIdentifier,height:"160%",width:"180%",y:"-30%",x:"-40%"},e),w(te.FEGAUSSIANBLUR,{in:"SourceGraphic",stdDeviation:this.SELECTED_GLOW_SIZE},t),i=w(te.FECOMPONENTTRANSFER,{result:"outBlur"},t),w(te.FEFUNCA,{type:"table",tableValues:"0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"},i),w(te.FEFLOOD,{"flood-color":this.SELECTED_GLOW_COLOUR,"flood-opacity":1,result:"outColor"},t),w(te.FECOMPOSITE,{in:"outColor",in2:"outBlur",operator:"in",result:"outGlow"},t),this.selectedGlowFilterId=t.id,this.selectedGlowFilter=t,e=w(te.FILTER,{id:"blocklyReplacementGlowFilter"+this.randomIdentifier,height:"160%",width:"180%",y:"-30%",x:"-40%"},e),w(te.FEGAUSSIANBLUR,{in:"SourceGraphic",stdDeviation:this.REPLACEMENT_GLOW_SIZE},e),t=w(te.FECOMPONENTTRANSFER,{result:"outBlur"},e),w(te.FEFUNCA,{type:"table",tableValues:"0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"},t),w(te.FEFLOOD,{"flood-color":this.REPLACEMENT_GLOW_COLOUR,"flood-opacity":1,result:"outColor"},e),w(te.FECOMPOSITE,{in:"outColor",in2:"outBlur",operator:"in",result:"outGlow"},e),w(te.FECOMPOSITE,{in:"SourceGraphic",in2:"outGlow",operator:"over"},e),this.replacementGlowFilterId=e.id,this.replacementGlowFilter=e}getCSS_(e){return[`${e} .blocklyText,`,`${e} .blocklyFlyoutLabelText {`,`font: ${this.FIELD_TEXT_FONTWEIGHT} ${this.FIELD_TEXT_FONTSIZE}pt ${this.FIELD_TEXT_FONTFAMILY};`,"}",`${e} .blocklyText {`,"fill: #fff;","}",`${e} .blocklyNonEditableText>rect:not(.blocklyDropdownRect),`,`${e} .blocklyEditableText>rect:not(.blocklyDropdownRect) {`,`fill: ${this.FIELD_BORDER_RECT_COLOUR};`,"}",`${e} .blocklyNonEditableText>text,`,`${e} .blocklyEditableText>text,`,`${e} .blocklyNonEditableText>g>text,`,`${e} .blocklyEditableText>g>text {`,"fill: #575E75;","}",`${e} .blocklyFlyoutLabelText {`,"fill: #575E75;","}",`${e} .blocklyText.blocklyBubbleText {`,"fill: #575E75;","}",`${e} .blocklyDraggable:not(.blocklyDisabled)`," .blocklyEditableText:not(.editing):hover>rect,",`${e} .blocklyDraggable:not(.blocklyDisabled)`," .blocklyEditableText:not(.editing):hover>.blocklyPath {","stroke: #fff;","stroke-width: 2;","}",`${e} .blocklyHtmlInput {`,`font-family: ${this.FIELD_TEXT_FONTFAMILY};`,`font-weight: ${this.FIELD_TEXT_FONTWEIGHT};`,"color: #575E75;","}",`${e} .blocklyDropdownText {`,"fill: #fff !important;","}",`${e}.blocklyWidgetDiv .goog-menuitem,`,`${e}.blocklyDropDownDiv .goog-menuitem {`,`font-family: ${this.FIELD_TEXT_FONTFAMILY};`,"}",`${e}.blocklyDropDownDiv .goog-menuitem-content {`,"color: #fff;","}",`${e} .blocklyHighlightedConnectionPath {`,`stroke: ${this.SELECTED_GLOW_COLOUR};`,"}",`${e} .blocklyDisabled > .blocklyOutlinePath {`,`fill: url(#blocklyDisabledPattern${this.randomIdentifier})`,"}",`${e} .blocklyInsertionMarker>.blocklyPath {`,`fill-opacity: ${this.INSERTION_MARKER_OPACITY};`,"stroke: none;","}"]}},LS=class{constructor(){this.NONE=0,this.FIELD=1,this.HAT=2,this.ICON=4,this.SPACER=8,this.BETWEEN_ROW_SPACER=16,this.IN_ROW_SPACER=32,this.EXTERNAL_VALUE_INPUT=64,this.INPUT=128,this.INLINE_INPUT=256,this.STATEMENT_INPUT=512,this.CONNECTION=1024,this.PREVIOUS_CONNECTION=2048,this.NEXT_CONNECTION=4096,this.OUTPUT_CONNECTION=8192,this.CORNER=16384,this.LEFT_SQUARE_CORNER=32768,this.LEFT_ROUND_CORNER=65536,this.RIGHT_SQUARE_CORNER=131072,this.RIGHT_ROUND_CORNER=262144,this.JAGGED_EDGE=524288,this.ROW=1048576,this.TOP_ROW=2097152,this.BOTTOM_ROW=4194304,this.INPUT_ROW=8388608,this.LEFT_CORNER=this.LEFT_SQUARE_CORNER|this.LEFT_ROUND_CORNER,this.RIGHT_CORNER=this.RIGHT_SQUARE_CORNER|this.RIGHT_ROUND_CORNER,this.nextTypeValue_=16777216}getType(e){return Object.prototype.hasOwnProperty.call(this,e)||(this[e]=this.nextTypeValue_,this.nextTypeValue_<<=1),this[e]}isField(e){return e.type&this.FIELD}isHat(e){return e.type&this.HAT}isIcon(e){return e.type&this.ICON}isSpacer(e){return e.type&this.SPACER}isInRowSpacer(e){return e.type&this.IN_ROW_SPACER}isInput(e){return e.type&this.INPUT}isExternalInput(e){return e.type&this.EXTERNAL_VALUE_INPUT}isInlineInput(e){return e.type&this.INLINE_INPUT}isStatementInput(e){return e.type&this.STATEMENT_INPUT}isPreviousConnection(e){return e.type&this.PREVIOUS_CONNECTION}isNextConnection(e){return e.type&this.NEXT_CONNECTION}isPreviousOrNextConnection(e){return e.type&(this.PREVIOUS_CONNECTION|this.NEXT_CONNECTION)}isLeftRoundedCorner(e){return e.type&this.LEFT_ROUND_CORNER}isRightRoundedCorner(e){return e.type&this.RIGHT_ROUND_CORNER}isLeftSquareCorner(e){return e.type&this.LEFT_SQUARE_CORNER}isRightSquareCorner(e){return e.type&this.RIGHT_SQUARE_CORNER}isCorner(e){return e.type&this.CORNER}isJaggedEdge(e){return e.type&this.JAGGED_EDGE}isRow(e){return e.type&this.ROW}isBetweenRowSpacer(e){return e.type&this.BETWEEN_ROW_SPACER}isTopRow(e){return e.type&this.TOP_ROW}isBottomRow(e){return e.type&this.BOTTOM_ROW}isTopOrBottomRow(e){return e.type&(this.TOP_ROW|this.BOTTOM_ROW)}isInputRow(e){return e.type&this.INPUT_ROW}},q=new LS,js=class{constructor(e){this.centerline=this.xPos=this.height=this.width=0,this.constants_=e,this.type=q.NONE,this.notchOffset=this.constants_.NOTCH_OFFSET_LEFT}},Dn=class extends js{constructor(e,t){super(e),this.connectionModel=t,this.shape=this.constants_.shapeFor(t),this.isDynamicShape="isDynamic"in this.shape&&this.shape.isDynamic,this.type|=q.CONNECTION}},sc=class{constructor(e,t){this.inlinePath_=this.outlinePath_="",this.block_=e,this.info_=t,this.topLeft_=e.getRelativeToSurfaceXY(),this.constants_=t.getRenderer().getConstants()}draw(){this.drawOutline_(),this.drawInternals_(),this.block_.pathObject.setPath(this.outlinePath_+`
+`+this.inlinePath_),this.info_.RTL&&this.block_.pathObject.flipRTL(),this.recordSizeOnBlock_()}hideHiddenIcons_(){xe("hideHiddenIcons_","v10","v11")}recordSizeOnBlock_(){this.block_.height=this.info_.height,this.block_.width=this.info_.widthWithChildren}drawOutline_(){this.drawTop_();for(let e=1;e=e.height)){if(q.isSpacer(e)){const r=e.precedesStatement;var t=e.followsStatement;if(r||t){const c=this.constants_.INSIDE_CORNERS;var i=c.rightHeight;i=e.height-(r?i:0),t=t?c.pathBottomRight:"",e=0=i||0>=t)throw Error("Height and width values of an image field must be greater than 0.");this.size_=new Vt(t,i+Pn.Y_PADDING),this.imageHeight=i,typeof c=="function"&&(this.clickHandler=c),e!==bt.SKIP_SETUP&&(v?this.configure_(v):(this.flipRtl=!!$,this.altText=Zt(r)||""),this.setValue(Zt(e)))}configure_(e){super.configure_(e),e.flipRtl&&(this.flipRtl=e.flipRtl),e.alt&&(this.altText=Zt(e.alt))}initView(){this.imageElement=w(te.IMAGE,{height:this.imageHeight+"px",width:this.size_.width+"px",alt:this.altText},this.fieldGroup_),this.imageElement.setAttributeNS(us,"xlink:href",this.value_),this.clickHandler&&(this.imageElement.style.cursor="pointer")}updateSize_(){}doClassValidation_(e){return typeof e!="string"?null:e}doValueUpdate_(e){this.value_=e,this.imageElement&&this.imageElement.setAttributeNS(us,"xlink:href",this.value_)}getFlipRtl(){return this.flipRtl}setAlt(e){e!==this.altText&&(this.altText=e||"",this.imageElement&&this.imageElement.setAttribute("alt",this.altText))}showEditor_(){this.clickHandler&&this.clickHandler(this)}setOnClickHandler(e){this.clickHandler=e}getText_(){return this.altText}static fromJson(e){if(!e.src||!e.width||!e.height)throw Error("src, width, and height values for an image field arerequired. The width and height must be non-zero.");return new this(e.src,e.width,e.height,void 0,void 0,void 0,e)}};Pn.Y_PADDING=1,Jo("field_image",Pn),Pn.prototype.DEFAULT_VALUE="";var ic=class extends bt{constructor(e,t,i){super(bt.SKIP_SETUP),this.spellcheck_=!0,this.htmlInput_=null,this.isTextValid_=this.isBeingEdited_=!1,this.onKeyInputWrapper_=this.onKeyDownWrapper_=this.valueWhenEditorWasOpened_=null,this.fullBlockClickTarget_=!1,this.workspace_=null,this.SERIALIZABLE=!0,this.CURSOR="text",e!==bt.SKIP_SETUP&&(i&&this.configure_(i),this.setValue(e),t&&this.setValidator(t))}configure_(e){super.configure_(e),e.spellcheck!==void 0&&(this.spellcheck_=e.spellcheck)}initView(){const e=this.getSourceBlock();if(!e)throw new io;if(this.getConstants().FULL_BLOCK_FIELDS){let t=0,i=0;for(let r=0,c;c=e.inputList[r];r++){for(let $=0;c.fieldRow[$];$++)t++;c.connection&&i++}this.fullBlockClickTarget_=1>=t&&e.outputConnection&&!i}else this.fullBlockClickTarget_=!1;this.fullBlockClickTarget_?this.clickTarget_=this.sourceBlock_.getSvgRoot():this.createBorderRect_(),this.createTextElement_()}doValueInvalid_(e){this.isBeingEdited_&&(this.isDirty_=!0,this.isTextValid_=!1,e=this.value_,this.value_=this.htmlInput_.getAttribute("data-untyped-default-value"),this.sourceBlock_&&_e()&&re(new(we(s.CHANGE$$module$build$src$core$events$utils))(this.sourceBlock_,"field",this.name||null,e,this.value_)))}doValueUpdate_(e){this.isTextValid_=this.isDirty_=!0,this.value_=e}applyColour(){if(this.sourceBlock_&&this.getConstants().FULL_BLOCK_FIELDS){var e=this.sourceBlock_;this.borderRect_?this.borderRect_.setAttribute("stroke",e.style.colourTertiary):e.pathObject.svgPath.setAttribute("fill",this.getConstants().FIELD_BORDER_RECT_COLOUR)}}render_(){if(super.render_(),this.isBeingEdited_){this.resizeEditor_();const e=this.htmlInput_;this.isTextValid_?(A(e,"blocklyInvalidInput"),Xt(e,Gt.INVALID,!1)):(I(e,"blocklyInvalidInput"),Xt(e,Gt.INVALID,!0))}}setSpellcheck(e){e!==this.spellcheck_&&(this.spellcheck_=e,this.htmlInput_&&this.htmlInput_.setAttribute("spellcheck",this.spellcheck_))}showEditor_(e,t=!1){this.workspace_=this.sourceBlock_.workspace,!t&&this.workspace_.options.modalInputs&&(Lp||xa||kr)?this.showPromptEditor_():this.showInlineEditor_(t)}showPromptEditor_(){g(s.Msg$$module$build$src$core$msg.CHANGE_VALUE_TITLE,this.getText(),e=>{e!==null&&this.setValue(this.getValueFromEditorText_(e))})}showInlineEditor_(e){const t=this.getSourceBlock();if(!t)throw new io;oa(this,t.RTL,this.widgetDispose_.bind(this)),this.htmlInput_=this.widgetCreate_(),this.isBeingEdited_=!0,this.valueWhenEditorWasOpened_=this.value_,e||(this.htmlInput_.focus({preventScroll:!0}),this.htmlInput_.select())}widgetCreate_(){var e=this.getSourceBlock();if(!e)throw new io;s.setGroup$$module$build$src$core$events$utils(!0);const t=fn();var i=this.getClickTarget_();if(!i)throw Error("A click target has not been set.");I(i,"editing"),i=document.createElement("input"),i.className="blocklyHtmlInput",i.setAttribute("spellcheck",this.spellcheck_);const r=this.workspace_.getScale();var c=this.getConstants().FIELD_TEXT_FONTSIZE*r+"pt";return t.style.fontSize=c,i.style.fontSize=c,c=ic.BORDERRADIUS*r+"px",this.fullBlockClickTarget_&&(c=this.getScaledBBox(),c=(c.bottom-c.top)/2+"px",e=e.getParent()?e.getParent().style.colourTertiary:this.sourceBlock_.style.colourTertiary,i.style.border=1*r+"px solid "+e,t.style.borderRadius=c,t.style.transition="box-shadow 0.25s ease 0s",this.getConstants().FIELD_TEXTINPUT_BOX_SHADOW&&(t.style.boxShadow="rgba(255, 255, 255, 0.3) 0 0 0 "+4*r+"px")),i.style.borderRadius=c,t.appendChild(i),i.value=i.defaultValue=this.getEditorText_(this.value_),i.setAttribute("data-untyped-default-value",String(this.value_)),this.resizeEditor_(),this.bindInputEvents_(i),i}widgetDispose_(){this.isBeingEdited_=!1,this.isTextValid_=!0,this.forceRerender(),this.onFinishEditing_(this.value_),this.sourceBlock_&&_e()&&this.valueWhenEditorWasOpened_!==null&&this.valueWhenEditorWasOpened_!==this.value_&&(re(new(we(s.CHANGE$$module$build$src$core$events$utils))(this.sourceBlock_,"field",this.name||null,this.valueWhenEditorWasOpened_,this.value_)),this.valueWhenEditorWasOpened_=null),s.setGroup$$module$build$src$core$events$utils(!1),this.unbindInputEvents_();var e=fn().style;if(e.width="auto",e.height="auto",e.fontSize="",e.transition="",e.boxShadow="",this.htmlInput_=null,e=this.getClickTarget_(),!e)throw Error("A click target has not been set.");A(e,"editing")}onFinishEditing_(e){}bindInputEvents_(e){this.onKeyDownWrapper_=Be(e,"keydown",this,this.onHtmlInputKeyDown_),this.onKeyInputWrapper_=Be(e,"input",this,this.onHtmlInputChange_)}unbindInputEvents_(){this.onKeyDownWrapper_&&(Dt(this.onKeyDownWrapper_),this.onKeyDownWrapper_=null),this.onKeyInputWrapper_&&(Dt(this.onKeyInputWrapper_),this.onKeyInputWrapper_=null)}onHtmlInputKeyDown_(e){e.key==="Enter"?(as(),fs()):e.key==="Escape"?(this.setValue(this.htmlInput_.getAttribute("data-untyped-default-value")),as(),fs()):e.key==="Tab"&&(as(),fs(),this.sourceBlock_.tab(this,!e.shiftKey),e.preventDefault())}onHtmlInputChange_(e){e=this.value_,this.setValue(this.getValueFromEditorText_(this.htmlInput_.value),!1),this.sourceBlock_&&_e()&&this.value_!==e&&re(new(we(Bi))(this.sourceBlock_,this.name||null,e,this.value_)),cr().then(()=>{this.resizeEditor_()})}setEditorValue_(e,t=!0){this.isDirty_=!0,this.isBeingEdited_&&(this.htmlInput_.value=this.getEditorText_(e)),this.setValue(e,t)}resizeEditor_(){var e=this.getSourceBlock();if(!e)throw new io;const t=fn(),i=this.getScaledBBox();t.style.width=i.right-i.left+"px",t.style.height=i.bottom-i.top+"px",e=new Ue(e.RTL?i.right-t.offsetWidth:i.left,i.top),t.style.left=e.x+"px",t.style.top=e.y+"px"}repositionForWindowResize(){const e=this.getSourceBlock();return e instanceof ts?(fr(this.workspace_,this.workspace_.getMetricsManager().getViewMetrics(!0),e),this.resizeEditor_(),!0):!1}isTabNavigable(){return!0}getText_(){return this.isBeingEdited_&&this.htmlInput_?this.htmlInput_.value:null}getEditorText_(e){return`${e}`}getValueFromEditorText_(e){return e}};ic.BORDERRADIUS=4;var Gr=class extends ic{constructor(e,t,i){super(e,t,i)}doClassValidation_(e){return e===void 0?null:`${e}`}static fromJson(e){return new this(Zt(e.text),void 0,e)}};Jo("field_input",Gr),Gr.prototype.DEFAULT_VALUE="";var nc=class{constructor(e){this.elements=[],this.xPos=this.yPos=this.widthWithConnectedBlocks=this.minWidth=this.minHeight=this.width=this.height=0,this.hasStatement=this.hasExternalInput=!1,this.statementEdge=0,this.hasJaggedEdge=this.hasDummyInput=this.hasInlineInput=!1,this.align=null,this.constants_=e,this.type=q.ROW,this.notchOffset=this.constants_.NOTCH_OFFSET_LEFT}getLastInput(){for(let e=this.elements.length-1;0<=e;e--){const t=this.elements[e];if(q.isInput(t))return t}return null}measure(){throw Error("Unexpected attempt to measure a base Row.")}startsWithElemSpacer(){return!0}endsWithElemSpacer(){return!0}getFirstSpacer(){for(let e=0;e=this.rows.length-1?!!this.bottomRow.hasNextConnection:!!r.precedesStatement,q.isInputRow($)&&$.hasStatement){$.measure();let v,H;t=$.width-((H=(v=$.getLastInput())==null?void 0:v.width)!=null?H:0)+e}else if(i&&(c===2||r)&&q.isInputRow($)&&!$.hasStatement){r=$.xPos,i=null;for(let v=0;v<$.elements.length;v++){const H=$.elements[v];q.isSpacer(H)&&(i=H),i&&(q.isField(H)||q.isInput(H))&&ri?i:this.height/2,t-i*(1-Math.sin(Math.acos((i-this.constants_.SMALL_PADDING)/i)));default:return 0}if(q.isInlineInput(e)&&e instanceof ji){const c=e.connectedBlock;return e=c?c.pathObject.outputShapeType:e.shape.type,e==null||c&&c.outputConnection&&(c.statementInputCount||c.nextConnection)||i===r.SHAPES.HEXAGONAL&&i!==e?0:t-this.constants_.SHAPE_IN_SHAPE_PADDING[i][e]}return q.isField(e)&&e instanceof Wr?i===r.SHAPES.ROUND&&e.field instanceof Gr?t-2.75*r.GRID_UNIT:t-this.constants_.SHAPE_IN_SHAPE_PADDING[i][0]:q.isIcon(e)?this.constants_.SMALL_PADDING:0}finalizeVerticalAlignment_(){if(!this.outputConnection)for(let r=2;r=this.rows.length-1?!!this.bottomRow.hasNextConnection:!!v.precedesStatement;if(e?this.topRow.hasPreviousConnection:c.followsStatement){var i=$.elements[1];if(i=$.elements.length===3&&i instanceof Wr&&(i.field instanceof wn||i.field instanceof Pn),!e&&i)c.height-=this.constants_.SMALL_PADDING,v.height-=this.constants_.SMALL_PADDING,$.height-=this.constants_.MEDIUM_PADDING;else if(!e&&!t)c.height+=this.constants_.SMALL_PADDING;else if(t){for(e=!1,t=0;t<$.elements.length;t++)if(i=$.elements[t],i instanceof ji&&q.isInlineInput(i)&&i.connectedBlock&&!i.connectedBlock.isShadow()&&40<=i.connectedBlock.getHeightWidth().height){e=!0;break}e&&(c.height-=this.constants_.SMALL_PADDING,v.height-=this.constants_.SMALL_PADDING)}}}}finalize_(){this.finalizeOutputConnection_(),this.finalizeHorizontalAlignment_(),this.finalizeVerticalAlignment_(),super.finalize_(),this.rightSide&&(this.widthWithChildren+=this.rightSide.width)}},NS="blocklyCursor",wS="blocklyMarker",MS=.75,P$=class{constructor(e,t,i){this.workspace=e,this.marker=i,this.markerSvgRect_=this.markerSvgLine_=this.markerInput_=this.markerBlock_=this.svgGroup_=this.markerSvg_=this.currentMarkerSvg=this.parent=null,this.constants_=t,e=this.isCursor()?this.constants_.CURSOR_COLOUR:this.constants_.MARKER_COLOUR,this.colour_=i.colour||e}getSvgRoot(){return this.svgGroup_}getMarker(){return this.marker}isCursor(){return this.marker.type==="cursor"}createDom(){const e=this.isCursor()?NS:wS;return this.svgGroup_=w(te.G,{class:e}),this.createDomInternal_(),this.svgGroup_}setParent_(e){this.isCursor()?(this.parent&&this.parent.setCursorSvg(null),e.setCursorSvg(this.getSvgRoot())):(this.parent&&this.parent.setMarkerSvg(null),e.setMarkerSvg(this.getSvgRoot())),this.parent=e}draw(e,t){if(t){this.constants_=this.workspace.getRenderer().getConstants();var i=this.isCursor()?this.constants_.CURSOR_COLOUR:this.constants_.MARKER_COLOUR;this.colour_=this.marker.colour||i,this.applyColour_(t),this.showAtLocation_(t),this.fireMarkerEvent(e,t),e=this.currentMarkerSvg.childNodes[0],e!==void 0&&e.beginElement&&e.beginElement()}else this.hide()}showAtLocation_(e){const t=e.getLocation().type;e.getType()===Re.types.BLOCK?this.showWithBlock_(e):e.getType()===Re.types.OUTPUT?this.showWithOutput_(e):t===qe.INPUT_VALUE?this.showWithInput_(e):t===qe.NEXT_STATEMENT?this.showWithNext_(e):e.getType()===Re.types.PREVIOUS?this.showWithPrevious_(e):e.getType()===Re.types.FIELD?this.showWithField_(e):e.getType()===Re.types.WORKSPACE?this.showWithCoordinates_(e):e.getType()===Re.types.STACK&&this.showWithStack_(e)}showWithBlockPrevOutput(e){e=e.getSourceBlock();const t=e.width;var i=e.height,r=i*MS;const c=this.constants_.CURSOR_BLOCK_PADDING;e.previousConnection?(i=this.constants_.shapeFor(e.previousConnection),this.positionPrevious_(t,c,r,i)):e.outputConnection?(r=this.constants_.shapeFor(e.outputConnection),this.positionOutput_(t,i,r)):this.positionBlock_(t,c,r),this.setParent_(e),this.showCurrent_()}showWithBlock_(e){this.showWithBlockPrevOutput(e)}showWithPrevious_(e){this.showWithBlockPrevOutput(e)}showWithOutput_(e){this.showWithBlockPrevOutput(e)}showWithCoordinates_(e){var t=e.getWsCoordinate();e=t.x,t=t.y,this.workspace.RTL&&(e-=this.constants_.CURSOR_WS_WIDTH),this.positionLine_(e,t,this.constants_.CURSOR_WS_WIDTH),this.setParent_(this.workspace),this.showCurrent_()}showWithField_(e){e=e.getLocation();const t=e.getSize().width,i=e.getSize().height;this.positionRect_(0,0,t,i),this.setParent_(e),this.showCurrent_()}showWithInput_(e){e=e.getLocation();const t=e.getSourceBlock();this.positionInput_(e),this.setParent_(t),this.showCurrent_()}showWithNext_(e){var t=e.getLocation();e=t.getSourceBlock();let i=0;t=t.getOffsetInBlock().y;const r=e.getHeightWidth().width;this.workspace.RTL&&(i=-r),this.positionLine_(i,t,r),this.setParent_(e),this.showCurrent_()}showWithStack_(e){e=e.getLocation();var t=e.getHeightWidth();const i=t.width+this.constants_.CURSOR_STACK_PADDING;t=t.height+this.constants_.CURSOR_STACK_PADDING;const r=-this.constants_.CURSOR_STACK_PADDING/2,c=-this.constants_.CURSOR_STACK_PADDING/2;let $=r;this.workspace.RTL&&($=-(i+r)),this.positionRect_($,c,i,t),this.setParent_(e),this.showCurrent_()}showCurrent_(){this.hide(),this.currentMarkerSvg&&(this.currentMarkerSvg.style.display="")}positionBlock_(e,t,i){if(e=jt(-t,i)+je("V",-t)+je("H",e+2*t)+je("V",i),!this.markerBlock_)throw Error("createDom should be called before positioning the marker");this.markerBlock_.setAttribute("d",e),this.workspace.RTL&&this.flipRtl(this.markerBlock_),this.currentMarkerSvg=this.markerBlock_}positionInput_(e){const t=e.getOffsetInBlock().x,i=e.getOffsetInBlock().y;e=To(0,0)+this.constants_.shapeFor(e).pathDown,this.markerInput_.setAttribute("d",e),this.markerInput_.setAttribute("transform","translate("+t+","+i+")"+(this.workspace.RTL?" scale(-1 1)":"")),this.currentMarkerSvg=this.markerInput_}positionLine_(e,t,i){if(!this.markerSvgLine_)throw Error("createDom should be called before positioning the line");this.markerSvgLine_.setAttribute("x",`${e}`),this.markerSvgLine_.setAttribute("y",`${t}`),this.markerSvgLine_.setAttribute("width",`${i}`),this.currentMarkerSvg=this.markerSvgLine_}positionOutput_(e,t,i){if(!this.markerBlock_)throw Error("createDom should be called before positioning the output");e=jt(e,0)+je("h",-(e-i.width))+je("v",this.constants_.TAB_OFFSET_FROM_TOP)+i.pathDown+je("V",t)+je("H",e),this.markerBlock_.setAttribute("d",e),this.workspace.RTL&&this.flipRtl(this.markerBlock_),this.currentMarkerSvg=this.markerBlock_}positionPrevious_(e,t,i,r){if(!this.markerBlock_)throw Error("createDom should be called before positioning the previous connection marker");e=jt(-t,i)+je("V",-t)+je("H",this.constants_.NOTCH_OFFSET_LEFT)+r.pathLeft+je("H",e+2*t)+je("V",i),this.markerBlock_.setAttribute("d",e),this.workspace.RTL&&this.flipRtl(this.markerBlock_),this.currentMarkerSvg=this.markerBlock_}positionRect_(e,t,i,r){if(!this.markerSvgRect_)throw Error("createDom should be called before positioning the rect");this.markerSvgRect_.setAttribute("x",`${e}`),this.markerSvgRect_.setAttribute("y",`${t}`),this.markerSvgRect_.setAttribute("width",`${i}`),this.markerSvgRect_.setAttribute("height",`${r}`),this.currentMarkerSvg=this.markerSvgRect_}flipRtl(e){e.setAttribute("transform","scale(-1 1)")}hide(){if(!(this.markerSvgLine_&&this.markerSvgRect_&&this.markerInput_&&this.markerBlock_))throw Error("createDom should be called before hiding the marker");this.markerSvgLine_.style.display="none",this.markerSvgRect_.style.display="none",this.markerInput_.style.display="none",this.markerBlock_.style.display="none"}fireMarkerEvent(e,t){const i=t.getSourceBlock();e=new(we(vr))(i,this.isCursor(),e,t),re(e)}getBlinkProperties_(){return{attributeType:"XML",attributeName:"fill",dur:"1s",values:this.colour_+";transparent;transparent;",repeatCount:"indefinite"}}createDomInternal_(){if(this.markerSvg_=w(te.G,{width:this.constants_.CURSOR_WS_WIDTH,height:this.constants_.WS_CURSOR_HEIGHT},this.svgGroup_),this.markerSvgLine_=w(te.RECT,{width:this.constants_.CURSOR_WS_WIDTH,height:this.constants_.WS_CURSOR_HEIGHT,style:"display: none"},this.markerSvg_),this.markerSvgRect_=w(te.RECT,{class:"blocklyVerticalMarker",rx:10,ry:10,style:"display: none"},this.markerSvg_),this.markerInput_=w(te.PATH,{transform:"",style:"display: none"},this.markerSvg_),this.markerBlock_=w(te.PATH,{transform:"",style:"display: none",fill:"none","stroke-width":this.constants_.CURSOR_STROKE_WIDTH},this.markerSvg_),this.isCursor()){const e=this.getBlinkProperties_();w(te.ANIMATE,e,this.markerSvgLine_),w(te.ANIMATE,e,this.markerInput_),w(te.ANIMATE,Object.assign({},e,{attributeName:"stroke"}),this.markerBlock_)}return this.markerSvg_}applyColour_(e){if(!(this.markerSvgLine_&&this.markerSvgRect_&&this.markerInput_&&this.markerBlock_))throw Error("createDom should be called before applying color to the markerj");this.markerSvgLine_.setAttribute("fill",this.colour_),this.markerSvgRect_.setAttribute("stroke",this.colour_),this.markerInput_.setAttribute("fill",this.colour_),this.markerBlock_.setAttribute("stroke",this.colour_),this.isCursor()&&(e=this.colour_+";transparent;transparent;",this.markerSvgLine_.firstElementChild.setAttribute("values",e),this.markerInput_.firstElementChild.setAttribute("values",e),this.markerBlock_.firstElementChild.setAttribute("values",e))}dispose(){this.svgGroup_&&U(this.svgGroup_)}},WT=class extends P${constructor(e,t,i){super(e,t,i),this.markerCircle=null}showWithInputOutput(e){const t=e.getSourceBlock();e=e.getLocation().getOffsetInBlock(),this.positionCircle(e.x,e.y),this.setParent_(t),this.showCurrent_()}showWithOutput_(e){this.showWithInputOutput(e)}showWithInput_(e){this.showWithInputOutput(e)}showWithBlock_(e){e=e.getLocation();const t=e.getHeightWidth();this.positionRect_(0,0,t.width,t.height),this.setParent_(e),this.showCurrent_()}positionCircle(e,t){let i;(i=this.markerCircle)==null||i.setAttribute("cx",`${e}`);let r;(r=this.markerCircle)==null||r.setAttribute("cy",`${t}`),this.currentMarkerSvg=this.markerCircle}hide(){super.hide(),this.markerCircle&&(this.markerCircle.style.display="none")}createDomInternal_(){if(super.createDomInternal_(),this.markerCircle=w(te.CIRCLE,{r:this.constants_.CURSOR_RADIUS,style:"display: none","stroke-width":this.constants_.CURSOR_STROKE_WIDTH},this.markerSvg_),this.isCursor()){const e=this.getBlinkProperties_();w(te.ANIMATE,e,this.markerCircle)}return this.markerSvg_}applyColour_(e){super.applyColour_(e);let t;(t=this.markerCircle)==null||t.setAttribute("fill",this.colour_);let i;if((i=this.markerCircle)==null||i.setAttribute("stroke",this.colour_),this.isCursor()){e=this.colour_+";transparent;transparent;";let r;(r=this.markerCircle)==null||r.firstElementChild.setAttribute("values",e)}}},nu=class{constructor(e,t,i){this.markerSvg=this.cursorSvg=null,this.constants=i,this.style=t,this.svgRoot=e,this.svgPath=w(te.PATH,{class:"blocklyPath"},this.svgRoot)}setPath(e){this.svgPath.setAttribute("d",e)}flipRTL(){this.svgPath.setAttribute("transform","scale(-1 1)")}setCursorSvg(e){e?(this.svgRoot.appendChild(e),this.cursorSvg=e):this.cursorSvg=null}setMarkerSvg(e){e?(this.cursorSvg?this.svgRoot.insertBefore(e,this.cursorSvg):this.svgRoot.appendChild(e),this.markerSvg=e):this.markerSvg=null}applyColour(e){this.svgPath.setAttribute("stroke",this.style.colourTertiary),this.svgPath.setAttribute("fill",this.style.colourPrimary),this.updateShadow_(e.isShadow()),this.updateDisabled_(!e.isEnabled()||e.getInheritedDisabled())}setStyle(e){this.style=e}setClass_(e,t){e&&(t?I(this.svgRoot,e):A(this.svgRoot,e))}updateHighlighted(e){e?this.svgPath.setAttribute("filter","url(#"+this.constants.embossFilterId+")"):this.svgPath.setAttribute("filter","none")}updateShadow_(e){e&&(this.svgPath.setAttribute("stroke","none"),this.svgPath.setAttribute("fill",this.style.colourSecondary))}updateDisabled_(e){this.setClass_("blocklyDisabled",e),e&&this.svgPath.setAttribute("fill","url(#"+this.constants.disabledPatternId+")")}updateSelected(e){this.setClass_("blocklySelected",e)}updateDraggingDelete(e){this.setClass_("blocklyDraggingDelete",e)}updateInsertionMarker(e){this.setClass_("blocklyInsertionMarker",e)}updateMovable(e){this.setClass_("blocklyDraggable",e)}updateReplacementFade(e){this.setClass_("blocklyReplaceable",e)}updateShapeForInputHighlight(e,t){}},zT=class extends nu{constructor(e,t,i){super(e,t,i),this.svgPathSelected=null,this.outlines=new Map,this.remainingOutlines=new Set,this.outputShapeType=null,this.constants=i}setPath(e){super.setPath(e),this.svgPathSelected&&this.svgPathSelected.setAttribute("d",e)}applyColour(e){super.applyColour(e);const t=e.getParent();e.isShadow()&&t&&this.svgPath.setAttribute("stroke",t.style.colourTertiary);for(const i of this.outlines.values())i.setAttribute("fill",this.style.colourTertiary)}flipRTL(){super.flipRTL();for(const e of this.outlines.values())e.setAttribute("transform","scale(-1 1)")}updateSelected(e){this.setClass_("blocklySelected",e),e?this.svgPathSelected||(this.svgPathSelected=this.svgPath.cloneNode(!0),this.svgPathSelected.setAttribute("fill","none"),this.svgPathSelected.setAttribute("filter","url(#"+this.constants.selectedGlowFilterId+")"),this.svgRoot.appendChild(this.svgPathSelected)):this.svgPathSelected&&(this.svgRoot.removeChild(this.svgPathSelected),this.svgPathSelected=null)}updateReplacementFade(e){this.setClass_("blocklyReplaceable",e),e?this.svgPath.setAttribute("filter","url(#"+this.constants.replacementGlowFilterId+")"):this.svgPath.removeAttribute("filter")}updateShapeForInputHighlight(e,t){e=e.getParentInput().name,(e=this.getOutlinePath(e))&&(t?e.setAttribute("filter","url(#"+this.constants.replacementGlowFilterId+")"):e.removeAttribute("filter"))}beginDrawing(){this.remainingOutlines.clear();for(const e of this.outlines.keys())this.remainingOutlines.add(e)}endDrawing(){if(this.remainingOutlines.size)for(const e of this.remainingOutlines)this.removeOutlinePath(e);this.remainingOutlines.clear()}setOutlinePath(e,t){e=this.getOutlinePath(e),e.setAttribute("d",t),e.setAttribute("fill",this.style.colourTertiary)}getOutlinePath(e){return this.outlines.has(e)||this.outlines.set(e,w(te.PATH,{class:"blocklyOutlinePath",d:""},this.svgRoot)),this.remainingOutlines.delete(e),this.outlines.get(e)}removeOutlinePath(e){let t,i;(t=this.outlines.get(e))==null||(i=t.parentNode)==null||i.removeChild(this.outlines.get(e)),this.outlines.delete(e)}},ac=class{constructor(e){this.overrides=null,this.name=e}getClassName(){return this.name+"-renderer"}init(e,t){this.constants_=this.makeConstants_(),t&&(this.overrides=t,Object.assign(this.constants_,t)),this.constants_.setTheme(e),this.constants_.init()}createDom(e,t){this.constants_.createDom(e,this.name+"-"+t.name,"."+this.getClassName()+"."+t.getClassName())}refreshDom(e,t){const i=this.getConstants();i.dispose(),this.constants_=this.makeConstants_(),this.overrides&&Object.assign(this.constants_,this.overrides),this.constants_.randomIdentifier=i.randomIdentifier,this.constants_.setTheme(t),this.constants_.init(),this.createDom(e,t)}dispose(){this.constants_&&this.constants_.dispose()}makeConstants_(){return new oc}makeRenderInfo_(e){return new zr(this,e)}makeDrawer_(e,t){return new sc(e,t)}makeMarkerDrawer(e,t){return new P$(e,this.getConstants(),t)}makePathObject(e,t){return new nu(e,t,this.constants_)}getConstants(){return this.constants_}shouldHighlightConnection(e){return!0}orphanCanConnectAtEnd(e,t,i){return!!St.getConnectionForOrphanedConnection(e,i===qe.OUTPUT_VALUE?t.outputConnection:t.previousConnection)}getConnectionPreviewMethod(e,t,i){return t.type===qe.OUTPUT_VALUE||t.type===qe.PREVIOUS_STATEMENT?!e.isConnected()||this.orphanCanConnectAtEnd(i,e.targetBlock(),t.type)?es.PREVIEW_TYPE.INSERTION_MARKER:es.PREVIEW_TYPE.REPLACEMENT_FADE:es.PREVIEW_TYPE.INSERTION_MARKER}render(e){const t=this.makeRenderInfo_(e);t.measure(),this.makeDrawer_(e,t).draw()}},Nt={};Nt.BottomRow=A$,Nt.Connection=Dn,Nt.ConstantProvider=oc,Nt.Drawer=sc,Nt.ExternalValueInput=su,Nt.Field=Wr,Nt.Hat=L$,Nt.Icon=DT,Nt.InRowSpacer=os,Nt.InlineInput=N$,Nt.InputConnection=ji,Nt.InputRow=w$,Nt.JaggedEdge=PT,Nt.MarkerSvg=P$,Nt.Measurable=js,Nt.NextConnection=xT,Nt.OutputConnection=BT,Nt.PathObject=nu,Nt.PreviousConnection=FT,Nt.RenderInfo=zr,Nt.Renderer=ac,Nt.RoundCorner=lc,Nt.Row=nc,Nt.SpacerRow=M$,Nt.SquareCorner=cc,Nt.StatementInput=rc,Nt.TopRow=D$,Nt.Types=q,Nt.init=Dh,Nt.register=mr,Nt.unregister=rm;var XT=class extends ac{constructor(e){super(e)}makeConstants_(){return new wT}makeRenderInfo_(e){return new GT(this,e)}makeDrawer_(e,t){return new MT(e,t)}makeMarkerDrawer(e,t){return new WT(e,this.getConstants(),t)}makePathObject(e,t){return new zT(e,t,this.getConstants())}getConstants(){return this.constants_}shouldHighlightConnection(e){return e.type!==qe.INPUT_VALUE&&e.type!==qe.OUTPUT_VALUE}getConnectionPreviewMethod(e,t,i){return t.type===qe.OUTPUT_VALUE?e.isConnected()?es.PREVIEW_TYPE.REPLACEMENT_FADE:es.PREVIEW_TYPE.INPUT_OUTLINE:super.getConnectionPreviewMethod(e,t,i)}};mr("zelos",XT);var Is={};Is.BottomRow=UT,Is.ConstantProvider=wT,Is.Drawer=MT,Is.MarkerSvg=WT,Is.PathObject=zT,Is.RenderInfo=GT,Is.Renderer=XT,Is.RightConnectionShape=HT,Is.StatementInput=iu,Is.TopRow=VT,qh();var No={};No.registerCleanup=Bh,No.registerCollapse=Uh,No.registerCollapseExpandBlock=jh,No.registerComment=zh,No.registerDefaultOptions=qh,No.registerDelete=Kh,No.registerDeleteAll=Gh,No.registerDisable=Yh,No.registerDuplicate=Wh,No.registerExpand=Hh,No.registerHelp=Qh,No.registerInline=Xh,No.registerRedo=xh,No.registerUndo=Ph;var jT=class{constructor(){}onDragEnter(e){}onDragOver(e){}onDragExit(e){}onDrop(e){}getClientRect(){return null}shouldPreventMove(e){return!1}},ru=class extends jT{constructor(){super(),this.wouldDelete_=!1}wouldDelete(e,t){return e instanceof ts?(e=!e.getParent()&&e.isDeletable(),this.updateWouldDelete_(e&&!t)):this.updateWouldDelete_(e.isDeletable()),this.wouldDelete_}updateWouldDelete_(e){this.wouldDelete_=e}},mt=class extends ic{constructor(e,t,i){super(bt.SKIP_SETUP),this.clockwise=mt.CLOCKWISE,this.offset=mt.OFFSET,this.wrap=mt.WRAP,this.round=mt.ROUND,this.boundEvents=[],this.symbol_=this.gauge=this.line=null,e!==bt.SKIP_SETUP&&(i&&this.configure_(i),this.setValue(e),t&&this.setValidator(t))}configure_(e){switch(super.configure_(e),e.mode){case lu.COMPASS:this.clockwise=!0,this.offset=90;break;case lu.PROTRACTOR:this.clockwise=!1,this.offset=0}e.clockwise&&(this.clockwise=e.clockwise),e.offset&&(this.offset=e.offset),e.wrap&&(this.wrap=e.wrap),e.round&&(this.round=e.round)}initView(){super.initView(),this.symbol_=w(te.TSPAN,{}),this.symbol_.appendChild(document.createTextNode("°")),this.getTextElement().appendChild(this.symbol_)}render_(){super.render_(),this.updateGraph()}showEditor_(e){super.showEditor_(e,Lp||xa||kr),e=this.dropdownCreate(),dr().appendChild(e),this.sourceBlock_ instanceof ts&&Kc(this.sourceBlock_.style.colourPrimary,this.sourceBlock_.style.colourTertiary),yl(this,this.dropdownDispose.bind(this)),this.updateGraph()}dropdownCreate(){const e=w(te.SVG,{xmlns:Aa,"xmlns:html":ui,"xmlns:xlink":us,version:"1.1",height:2*mt.HALF+"px",width:2*mt.HALF+"px",style:"touch-action: none"}),t=w(te.CIRCLE,{cx:mt.HALF,cy:mt.HALF,r:mt.RADIUS,class:"blocklyAngleCircle"},e);this.gauge=w(te.PATH,{class:"blocklyAngleGauge"},e),this.line=w(te.LINE,{x1:mt.HALF,y1:mt.HALF,class:"blocklyAngleLine"},e);for(let i=0;360>i;i+=15)w(te.LINE,{x1:mt.HALF+mt.RADIUS,y1:mt.HALF,x2:mt.HALF+mt.RADIUS-(i%45===0?10:5),y2:mt.HALF,class:"blocklyAngleMarks",transform:"rotate("+i+","+mt.HALF+","+mt.HALF+")"},e);return this.boundEvents.push(Be(e,"click",this,this.hide)),this.boundEvents.push(Be(t,"pointerdown",this,this.onMouseMove_,!0)),this.boundEvents.push(Be(t,"pointermove",this,this.onMouseMove_,!0)),e}dropdownDispose(){for(const e of this.boundEvents)Dt(e);this.boundEvents.length=0,this.line=this.gauge=null}hide(){hr(this),as()}onMouseMove_(e){var t=this.gauge.ownerSVGElement.getBoundingClientRect();const i=e.clientX-t.left-mt.HALF;e=e.clientY-t.top-mt.HALF,t=Math.atan(-e/i),isNaN(t)||(t=xd(t),0>i?t+=180:0e&&(e+=360),e>this.wrap&&(e-=360),e}static fromJson(e){return new this(e.angle,void 0,e)}};mt.HALF=50,mt.RADIUS=mt.HALF-1,mt.CLOCKWISE=!1,mt.OFFSET=0,mt.WRAP=360,mt.ROUND=15,Jo("field_angle",mt),mt.prototype.DEFAULT_VALUE=0,cs(`
+.blocklyAngleCircle {
+ stroke: #444;
+ stroke-width: 1;
+ fill: #ddd;
+ fill-opacity: 0.8;
+}
+
+.blocklyAngleMarks {
+ stroke: #444;
+ stroke-width: 1;
+}
+
+.blocklyAngleGauge {
+ fill: #f88;
+ fill-opacity: 0.8;
+ pointer-events: none;
+}
+
+.blocklyAngleLine {
+ stroke: #f00;
+ stroke-width: 2;
+ stroke-linecap: round;
+ pointer-events: none;
+}
+`);var lu;(function(e){e.COMPASS="compass",e.PROTRACTOR="protractor"})(lu||(lu={}));var xn=class extends bt{constructor(e,t,i){super(bt.SKIP_SETUP),this.SERIALIZABLE=!0,this.CURSOR="default",this.value_=this.value_,this.checkChar=xn.CHECK_CHAR,e!==bt.SKIP_SETUP&&(i&&this.configure_(i),this.setValue(e),t&&this.setValidator(t))}configure_(e){super.configure_(e),e.checkCharacter&&(this.checkChar=e.checkCharacter)}saveState(){const e=this.saveLegacyState(xn);return e!==null?e:this.getValueBoolean()}initView(){super.initView();const e=this.getTextElement();I(e,"blocklyCheckbox"),e.style.display=this.value_?"block":"none"}render_(){this.textContent_&&(this.textContent_.nodeValue=this.getDisplayText_()),this.updateSize_(this.getConstants().FIELD_CHECKBOX_X_OFFSET)}getDisplayText_(){return this.checkChar}setCheckCharacter(e){this.checkChar=e||xn.CHECK_CHAR,this.forceRerender()}showEditor_(){this.setValue(!this.value_)}doClassValidation_(e){return e===!0||e==="TRUE"?"TRUE":e===!1||e==="FALSE"?"FALSE":null}doValueUpdate_(e){this.value_=this.convertValueToBool_(e),this.textElement_&&(this.textElement_.style.display=this.value_?"block":"none")}getValue(){return this.value_?"TRUE":"FALSE"}getValueBoolean(){return this.value_}getText(){return String(this.convertValueToBool_(this.value_))}convertValueToBool_(e){return typeof e=="string"?e==="TRUE":!!e}static fromJson(e){return new this(e.checked,void 0,e)}};xn.CHECK_CHAR="✓",Jo("field_checkbox",xn),xn.prototype.DEFAULT_VALUE=!1;var ss=class extends bt{constructor(e,t,i){super(bt.SKIP_SETUP),this.highlightedIndex=this.picker=null,this.boundEvents=[],this.SERIALIZABLE=!0,this.CURSOR="default",this.isDirty_=!1,this.titles=this.colours=null,this.columns=0,e!==bt.SKIP_SETUP&&(i&&this.configure_(i),this.setValue(e),t&&this.setValidator(t))}configure_(e){super.configure_(e),e.colourOptions&&(this.colours=e.colourOptions),e.colourTitles&&(this.titles=e.colourTitles),e.columns&&(this.columns=e.columns)}initView(){this.size_=new Vt(this.getConstants().FIELD_COLOUR_DEFAULT_WIDTH,this.getConstants().FIELD_COLOUR_DEFAULT_HEIGHT),this.getConstants().FIELD_COLOUR_FULL_BLOCK?this.sourceBlock_ instanceof ts&&(this.clickTarget_=this.sourceBlock_.getSvgRoot()):(this.createBorderRect_(),this.getBorderRect().style.fillOpacity="1")}applyColour(){this.getConstants().FIELD_COLOUR_FULL_BLOCK?this.sourceBlock_ instanceof ts&&(this.sourceBlock_.pathObject.svgPath.setAttribute("fill",this.getValue()),this.sourceBlock_.pathObject.svgPath.setAttribute("stroke","#fff")):this.borderRect_&&(this.borderRect_.style.fill=this.getValue())}doClassValidation_(e){return typeof e!="string"?null:Di(e)}doValueUpdate_(e){this.value_=e,this.borderRect_?this.borderRect_.style.fill=e:this.sourceBlock_&&this.sourceBlock_.rendered&&this.sourceBlock_ instanceof ts&&(this.sourceBlock_.pathObject.svgPath.setAttribute("fill",e),this.sourceBlock_.pathObject.svgPath.setAttribute("stroke","#fff"))}getText(){let e=this.value_;return/^#(.)\1(.)\2(.)\3$/.test(e)&&(e="#"+e[1]+e[3]+e[5]),e}setColours(e,t){return this.colours=e,t&&(this.titles=t),this}setColumns(e){return this.columns=e,this}showEditor_(){this.dropdownCreate(),dr().appendChild(this.picker),yl(this,this.dropdownDispose.bind(this)),this.picker.focus({preventScroll:!0})}onClick(e){e=(e=e.target)&&e.getAttribute("data-colour"),e!==null&&(this.setValue(e),hr(this))}onKeyDown(e){let t=!0;var i;switch(e.key){case"ArrowUp":this.moveHighlightBy(0,-1);break;case"ArrowDown":this.moveHighlightBy(0,1);break;case"ArrowLeft":this.moveHighlightBy(-1,0);break;case"ArrowRight":this.moveHighlightBy(1,0);break;case"Enter":(i=this.getHighlighted())&&(i=i.getAttribute("data-colour"),i!==null&&this.setValue(i)),fs();break;default:t=!1}t&&e.stopPropagation()}moveHighlightBy(e,t){if(this.highlightedIndex){var i=this.colours||ss.COLOURS,r=this.columns||ss.COLUMNS,c=this.highlightedIndex%r,$=Math.floor(this.highlightedIndex/r);c+=e,$+=t,0>e?0>c&&0<$?(c=r-1,$--):0>c&&(c=0):0r-1&&$r-1&&c--:0>t?0>$&&($=0):0Math.floor(i.length/r)-1&&($=Math.floor(i.length/r)-1),this.setHighlightedCell(this.picker.childNodes[$].childNodes[c],$*r+c)}}onMouseMove(e){const t=(e=e.target)&&Number(e.getAttribute("data-index"));t!==null&&t!==this.highlightedIndex&&this.setHighlightedCell(e,t)}onMouseEnter(){let e;(e=this.picker)==null||e.focus({preventScroll:!0})}onMouseLeave(){var e;(e=this.picker)==null||e.blur(),(e=this.getHighlighted())&&A(e,"blocklyColourHighlighted")}getHighlighted(){if(!this.highlightedIndex)return null;const e=this.columns||ss.COLUMNS,t=this.picker.childNodes[Math.floor(this.highlightedIndex/e)];return t?t.childNodes[this.highlightedIndex%e]:null}setHighlightedCell(e,t){const i=this.getHighlighted();i&&A(i,"blocklyColourHighlighted"),I(e,"blocklyColourHighlighted"),this.highlightedIndex=t,(e=e.getAttribute("id"))&&this.picker&&Xt(this.picker,Gt.ACTIVEDESCENDANT,e)}dropdownCreate(){const e=this.columns||ss.COLUMNS,t=this.colours||ss.COLOURS,i=this.titles||ss.TITLES,r=this.getValue(),c=document.createElement("table");c.className="blocklyColourTable",c.tabIndex=0,c.dir="ltr",ms(c,Vo.GRID),Xt(c,Gt.EXPANDED,!0),Xt(c,Gt.ROWCOUNT,Math.floor(t.length/e)),Xt(c,Gt.COLCOUNT,e);let $;for(let v=0;vtr>td {
+ border: 0.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, 0.3);
+ position: relative;
+}
+
+.blocklyColourSelected, .blocklyColourSelected:hover {
+ border-color: #eee !important;
+ outline: 1px solid #333;
+ position: relative;
+}
+`);var YT=class extends wn{constructor(e,t,i){super(String(e??""),t,i),this.EDITABLE=!1,this.SERIALIZABLE=!0}static fromJson(e){return new this(Zt(e.text),void 0,e)}};Jo("field_label_serializable",YT);var x$=class extends Gr{constructor(e,t,i){super(bt.SKIP_SETUP),this.textGroup=null,this.maxLines_=1/0,this.isOverflowedY_=!1,e!==bt.SKIP_SETUP&&(i&&this.configure_(i),this.setValue(e),t&&this.setValidator(t))}configure_(e){super.configure_(e),e.maxLines&&this.setMaxLines(e.maxLines)}toXml(e){return e.textContent=this.getValue().replace(/\n/g,"
"),e}fromXml(e){this.setValue(e.textContent.replace(/
/g,`
+`))}saveState(){const e=this.saveLegacyState(x$);return e!==null?e:this.getValue()}loadState(e){this.loadLegacyState(bt,e)||this.setValue(e)}initView(){this.createBorderRect_(),this.textGroup=w(te.G,{class:"blocklyEditableText"},this.fieldGroup_)}getDisplayText_(){const e=this.getSourceBlock();if(!e)throw new io;let t=this.getText();if(!t)return bt.NBSP;const i=t.split(`
+`);t="";const r=this.isOverflowedY_?this.maxLines_:i.length;for(let c=0;cthis.maxDisplayLength?$=$.substring(0,this.maxDisplayLength-4)+"...":this.isOverflowedY_&&c===r-1&&($=$.substring(0,$.length-3)+"..."),$=$.replace(/\s/g,bt.NBSP),t+=$,c!==r-1&&(t+=`
+`)}return e.RTL&&(t+=""),t}doValueUpdate_(e){super.doValueUpdate_(e),this.value_!==null&&(this.isOverflowedY_=this.value_.split(`
+`).length>this.maxLines_)}render_(){var e=this.getSourceBlock();if(!e)throw new io;for(var t,i=this.textGroup;t=i.firstChild;)i.removeChild(t);t=this.getDisplayText_().split(`
+`);let r=0;for(let c=0;cc&&(c=H),$+=this.getConstants().FIELD_TEXT_HEIGHT+(0this.maxDisplayLength&&(e[H]=e[H].substring(0,this.maxDisplayLength)),v.textContent=e[H];const Oe=Ne(v,t,i,r);Oe>c&&(c=Oe)}c+=this.htmlInput_.offsetWidth-this.htmlInput_.clientWidth}this.borderRect_&&($+=2*this.getConstants().FIELD_BORDER_RECT_Y_PADDING,c+=2*this.getConstants().FIELD_BORDER_RECT_X_PADDING,this.borderRect_.setAttribute("width",`${c}`),this.borderRect_.setAttribute("height",`${$}`)),this.size_.width=c,this.size_.height=$,this.positionBorderRect_()}showEditor_(e,t){super.showEditor_(e,t),this.forceRerender()}widgetCreate_(){const e=fn(),t=this.workspace_.getScale(),i=document.createElement("textarea");i.className="blocklyHtmlInput blocklyHtmlTextAreaInput",i.setAttribute("spellcheck",String(this.spellcheck_));var r=this.getConstants().FIELD_TEXT_FONTSIZE*t+"pt";e.style.fontSize=r,i.style.fontSize=r,i.style.borderRadius=Gr.BORDERRADIUS*t+"px",r=this.getConstants().FIELD_BORDER_RECT_X_PADDING*t;const c=this.getConstants().FIELD_BORDER_RECT_Y_PADDING*t/2;return i.style.padding=c+"px "+r+"px "+c+"px "+r+"px",r=this.getConstants().FIELD_TEXT_HEIGHT+this.getConstants().FIELD_BORDER_RECT_Y_PADDING,i.style.lineHeight=r*t+"px",e.appendChild(i),i.value=i.defaultValue=this.getEditorText_(this.value_),i.setAttribute("data-untyped-default-value",String(this.value_)),i.setAttribute("data-old-value",""),kp?setTimeout(this.resizeEditor_.bind(this),0):this.resizeEditor_(),this.bindInputEvents_(i),i}setMaxLines(e){typeof e=="number"&&0this.max_&&(e.max=`${this.max_}`,Xt(e,Gt.VALUEMAX,this.max_)),e}static fromJson(e){return new this(e.value,void 0,void 0,void 0,void 0,e)}};Jo("field_number",B$),B$.prototype.DEFAULT_VALUE=0;var uc=class extends Ws{constructor(e,t,i,r,c){super(bt.SKIP_SETUP),this.defaultType="",this.variableTypes=[],this.variable=null,this.SERIALIZABLE=!0,this.menuGenerator_=uc.dropdownCreate,this.defaultVariableName=typeof e=="string"?e:"",this.size_=new Vt(0,0),e!==bt.SKIP_SETUP&&(c?this.configure_(c):this.setTypes(i,r),t&&this.setValidator(t))}configure_(e){super.configure_(e),this.setTypes(e.variableTypes,e.defaultType)}initModel(){var e=this.getSourceBlock();if(!e)throw new io;this.variable||(e=s.getOrCreateVariablePackage$$module$build$src$core$variables(e.workspace,null,this.defaultVariableName,this.defaultType),this.doValueUpdate_(e.getId()))}shouldAddBorderRect_(){const e=this.getSourceBlock();if(!e)throw new io;return super.shouldAddBorderRect_()&&(!this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW||e.type!=="variables_get")}fromXml(e){var t=this.getSourceBlock();if(!t)throw new io;const i=e.getAttribute("id"),r=e.textContent,c=e.getAttribute("variabletype")||e.getAttribute("variableType")||"";if(t=s.getOrCreateVariablePackage$$module$build$src$core$variables(t.workspace,i,r,c),c!==null&&c!==t.type)throw Error("Serialized variable type with id '"+t.getId()+"' had type "+t.type+", and does not match variable field that references it: "+Ps(e)+".");this.setValue(t.getId())}toXml(e){return this.initModel(),e.id=this.variable.getId(),e.textContent=this.variable.name,this.variable.type&&e.setAttribute("variabletype",this.variable.type),e}saveState(e){var t=this.saveLegacyState(uc);return t!==null||(this.initModel(),t={id:this.variable.getId()},e&&(t.name=this.variable.name,t.type=this.variable.type)),t}loadState(e){const t=this.getSourceBlock();if(!t)throw new io;this.loadLegacyState(uc,e)||(e=s.getOrCreateVariablePackage$$module$build$src$core$variables(t.workspace,e.id||null,e.name,e.type||""),this.setValue(e.getId()))}setSourceBlock(e){if(e.isShadow())throw Error("Variable fields are not allowed to exist on shadow blocks.");super.setSourceBlock(e)}getValue(){return this.variable?this.variable.getId():null}getText(){return this.variable?this.variable.name:""}getVariable(){return this.variable}getValidator(){return this.variable?this.validator_:null}doClassValidation_(e){if(e===null)return null;var t=this.getSourceBlock();if(!t)throw new io;return t=s.getVariable$$module$build$src$core$variables(t.workspace,e),t?(t=t.type,this.typeIsAllowed(t)?e:(console.warn("Variable type doesn't match this field! Type was "+t),null)):(console.warn("Variable id doesn't point to a real variable! ID was "+e),null)}doValueUpdate_(e){const t=this.getSourceBlock();if(!t)throw new io;this.variable=s.getVariable$$module$build$src$core$variables(t.workspace,e),super.doValueUpdate_(e)}typeIsAllowed(e){const t=this.getVariableTypes();if(!t)return!0;for(let i=0;i(this.flyout?s.config$$module$build$src$core$config.flyoutDragRadius:s.config$$module$build$src$core$config.dragRadius)}updateIsDraggingFromFlyout(){let e;if(!this.targetBlock||(e=this.flyout)==null||!e.isBlockCreatable(this.targetBlock))return!1;if(!this.flyout.targetWorkspace)throw Error(`Cannot update dragging from the flyout because the ' +
+ 'flyout's target workspace is undefined`);return!this.flyout.isScrollable()||this.flyout.isDragTowardWorkspace(this.currentDragDeltaXY)?(this.startWorkspace_=this.flyout.targetWorkspace,this.startWorkspace_.updateScreenCalculationsIfScrolled(),s.getGroup$$module$build$src$core$events$utils()||s.setGroup$$module$build$src$core$events$utils(!0),this.startBlock=null,this.targetBlock=this.flyout.createBlock(this.targetBlock),this.targetBlock.select(),!0):!1}updateIsDraggingBubble(){return this.startBubble?(this.startDraggingBubble(),!0):!1}updateIsDraggingBlock(){if(!this.targetBlock)return!1;if(this.flyout){if(this.updateIsDraggingFromFlyout())return this.startDraggingBlock(),!0}else if(this.targetBlock.isMovable())return this.startDraggingBlock(),!0;return!1}updateIsDraggingWorkspace(){if(!this.startWorkspace_)throw Error("Cannot update dragging the workspace because the start workspace is undefined");(this.flyout?this.flyout.isScrollable():this.startWorkspace_&&this.startWorkspace_.isDraggable())&&(this.workspaceDragger=new QT(this.startWorkspace_),this.workspaceDragger.startDrag())}updateIsDragging(){if(this.calledUpdateIsDragging)throw Error("updateIsDragging_ should only be called once per gesture.");this.calledUpdateIsDragging=!0,this.updateIsDraggingBubble()||this.updateIsDraggingBlock()||this.updateIsDraggingWorkspace()}startDraggingBlock(){this.blockDragger=new(C(Ae.BLOCK_DRAGGER,this.creatorWorkspace.options,!0))(this.targetBlock,this.startWorkspace_),this.blockDragger.startDrag(this.currentDragDeltaXY,this.healStack),this.blockDragger.drag(this.mostRecentEvent,this.currentDragDeltaXY)}startDraggingBubble(){if(!this.startBubble)throw Error("Cannot update dragging the bubble because the start bubble is undefined");if(!this.startWorkspace_)throw Error("Cannot update dragging the bubble because the start workspace is undefined");this.bubbleDragger=new LT(this.startBubble,this.startWorkspace_),this.bubbleDragger.startBubbleDrag(),this.bubbleDragger.dragBubble(this.mostRecentEvent,this.currentDragDeltaXY)}doStart(e){if(!this.startWorkspace_)throw Error("Cannot start the touch gesture becauase the start workspace is undefined");this.isPinchZoomEnabled=this.startWorkspace_.options.zoomOptions&&this.startWorkspace_.options.zoomOptions.pinch,bl(e)?this.cancel():(this.gestureHasStarted=!0,gr(),this.startWorkspace_.updateScreenCalculationsIfScrolled(),this.startWorkspace_.isMutator&&this.startWorkspace_.resize(),this.currentDropdownOwner=Ud(),this.startWorkspace_.hideChaff(!!this.flyout),this.startWorkspace_.markFocused(),this.mostRecentEvent=e,ih(),this.targetBlock&&this.targetBlock.select(),Ai(e)?this.handleRightClick(e):(e.type.toLowerCase()==="pointerdown"&&e.pointerType!=="mouse"&&V(e,this),this.mouseDownXY=new Ue(e.clientX,e.clientY),this.healStack=e.altKey||e.ctrlKey||e.metaKey,this.bindMouseEvents(e),this.isEnding_||this.handleTouchStart(e)))}bindMouseEvents(e){this.boundEvents.push(Be(document,"pointerdown",null,this.handleStart.bind(this),!0)),this.boundEvents.push(Be(document,"pointermove",null,this.handleMove.bind(this),!0)),this.boundEvents.push(Be(document,"pointerup",null,this.handleUp.bind(this),!0)),e.preventDefault(),e.stopPropagation()}handleStart(e){this.isDragging()||(this.handleTouchStart(e),this.isMultiTouch()&&ve())}handleMove(e){this.isDragging()&&rt(e)||!this.isMultiTouch()?(this.updateFromEvent(e),this.workspaceDragger?this.workspaceDragger.drag(this.currentDragDeltaXY):this.blockDragger?this.blockDragger.drag(this.mostRecentEvent,this.currentDragDeltaXY):this.bubbleDragger&&this.bubbleDragger.dragBubble(this.mostRecentEvent,this.currentDragDeltaXY),e.preventDefault(),e.stopPropagation()):this.isMultiTouch()&&(this.handleTouchMove(e),ve())}handleUp(e){if(this.isDragging()||this.handleTouchEnd(e),!this.isMultiTouch()||this.isDragging()){if(!rt(e))return;if(this.updateFromEvent(e),ve(),this.isEnding_){console.log("Trying to end a gesture recursively.");return}this.isEnding_=!0,this.bubbleDragger?this.bubbleDragger.endBubbleDrag(e,this.currentDragDeltaXY):this.blockDragger?this.blockDragger.endDrag(e,this.currentDragDeltaXY):this.workspaceDragger?this.workspaceDragger.endDrag(this.currentDragDeltaXY):this.isBubbleClick()?this.doBubbleClick():this.isFieldClick()?this.doFieldClick():this.isIconClick()?this.doIconClick():this.isBlockClick()?this.doBlockClick():this.isWorkspaceClick()&&this.doWorkspaceClick(e)}e.preventDefault(),e.stopPropagation(),this.dispose()}handleTouchStart(e){var t=Mt(e);this.cachedPoints.set(t,this.getTouchPoint(e));var i=Array.from(this.cachedPoints.keys());i.length===2&&(t=this.cachedPoints.get(i[0]),i=this.cachedPoints.get(i[1]),this.startDistance=Ue.distance(t,i),this.isMultiTouch_=!0,e.preventDefault())}handleTouchMove(e){const t=Mt(e);this.cachedPoints.set(t,this.getTouchPoint(e)),this.isPinchZoomEnabled&&this.cachedPoints.size===2?this.handlePinch(e):this.handleMove(e)}handlePinch(e){var t=Array.from(this.cachedPoints.keys()),i=this.cachedPoints.get(t[0]);if(t=this.cachedPoints.get(t[1]),i=Ue.distance(i,t)/this.startDistance,0this.previousScale){if(t=i-this.previousScale,t=0this.cachedPoints.size&&(this.cachedPoints.clear(),this.previousScale=0)}getTouchPoint(e){return this.startWorkspace_?new Ue(e.pageX,e.pageY):null}isMultiTouch(){return this.isMultiTouch_}cancel(){this.isEnding_||(ve(),this.bubbleDragger?this.bubbleDragger.endBubbleDrag(this.mostRecentEvent,this.currentDragDeltaXY):this.blockDragger?this.blockDragger.endDrag(this.mostRecentEvent,this.currentDragDeltaXY):this.workspaceDragger&&this.workspaceDragger.endDrag(this.currentDragDeltaXY),this.dispose())}handleRightClick(e){this.targetBlock?(this.bringBlockToFront(),this.targetBlock.workspace.hideChaff(!!this.flyout),this.targetBlock.showContextMenu(e)):this.startBubble?this.startBubble.showContextMenu(e):this.startWorkspace_&&!this.flyout&&(this.startWorkspace_.hideChaff(),this.startWorkspace_.showContextMenu(e)),e.preventDefault(),e.stopPropagation(),this.dispose()}handleWsStart(e,t){if(this.gestureHasStarted)throw Error("Tried to call gesture.handleWsStart, but the gesture had already been started.");this.setStartWorkspace(t),this.mostRecentEvent=e,this.doStart(e)}fireWorkspaceClick(e){re(new(we(ai))(null,e.id,"workspace"))}handleFlyoutStart(e,t){if(this.gestureHasStarted)throw Error("Tried to call gesture.handleFlyoutStart, but the gesture had already been started.");this.setStartFlyout(t),this.handleWsStart(e,t.getWorkspace())}handleBlockStart(e,t){if(this.gestureHasStarted)throw Error("Tried to call gesture.handleBlockStart, but the gesture had already been started.");this.setStartBlock(t),this.mostRecentEvent=e}handleBubbleStart(e,t){if(this.gestureHasStarted)throw Error("Tried to call gesture.handleBubbleStart, but the gesture had already been started.");this.setStartBubble(t),this.mostRecentEvent=e}doBubbleClick(){this.startBubble instanceof yo&&(this.startBubble.setFocus(),this.startBubble.select())}doFieldClick(){if(!this.startField)throw Error("Cannot do a field click because the start field is undefined");this.currentDropdownOwner!==this.startField&&this.startField.showEditor(this.mostRecentEvent),this.bringBlockToFront()}doIconClick(){if(!this.startIcon)throw Error("Cannot do an icon click because the start icon is undefined");this.startIcon.onClick()}doBlockClick(){if(this.flyout&&this.flyout.autoClose){if(!this.targetBlock)throw Error("Cannot do a block click because the target block is undefined");this.targetBlock.isEnabled()&&(s.getGroup$$module$build$src$core$events$utils()||s.setGroup$$module$build$src$core$events$utils(!0),this.flyout.createBlock(this.targetBlock).scheduleSnapAndBump())}else{if(!this.startWorkspace_)throw Error("Cannot do a block click because the start workspace is undefined");const e=new(we(ai))(this.startBlock,this.startWorkspace_.id,"block");re(e)}this.bringBlockToFront(),s.setGroup$$module$build$src$core$events$utils(!1)}doWorkspaceClick(e){e=this.creatorWorkspace,Z()&&Z().unselect(),this.fireWorkspaceClick(this.startWorkspace_||e)}bringBlockToFront(){this.targetBlock&&!this.flyout&&this.targetBlock.bringToFront()}setStartField(e){if(this.gestureHasStarted)throw Error("Tried to call gesture.setStartField, but the gesture had already been started.");this.startField||(this.startField=e)}setStartIcon(e){if(this.gestureHasStarted)throw Error("Tried to call gesture.setStartIcon, but the gesture had already been started.");this.startIcon||(this.startIcon=e)}setStartBubble(e){this.startBubble||(this.startBubble=e)}setStartBlock(e){this.startBlock||this.startBubble||(this.startBlock=e,e.isInFlyout&&e!==e.getRootBlock()?this.setTargetBlock(e.getRootBlock()):this.setTargetBlock(e))}setTargetBlock(e){e.isShadow()?this.setTargetBlock(e.getParent()):this.targetBlock=e}setStartWorkspace(e){this.startWorkspace_||(this.startWorkspace_=e)}setStartFlyout(e){this.flyout||(this.flyout=e)}isBubbleClick(){return!!this.startBubble&&!this.hasExceededDragRadius}isBlockClick(){return!!this.startBlock&&!this.hasExceededDragRadius&&!this.isFieldClick()&&!this.isIconClick()}isFieldClick(){return(this.startField?this.startField.isClickable():!1)&&!this.hasExceededDragRadius&&(!this.flyout||!this.flyout.autoClose)}isIconClick(){return!!this.startIcon&&!this.hasExceededDragRadius}isWorkspaceClick(){return!this.startBlock&&!this.startBubble&&!this.startField&&!this.hasExceededDragRadius}isDragging(){return!!this.workspaceDragger||!!this.blockDragger||!!this.bubbleDragger}hasStarted(){return this.gestureHasStarted}getInsertionMarkers(){return this.blockDragger?this.blockDragger.getInsertionMarkers():[]}getCurrentDragger(){let e,t;return(t=(e=this.blockDragger)!=null?e:this.workspaceDragger)!=null?t:this.bubbleDragger}static inProgress(){const e=P();for(let t=0,i;i=e[t];t++)if(i.currentGesture_)return!0;return!1}},H$=class{constructor(e,t){this.pattern=e;let i;this.spacing=(i=t.spacing)!=null?i:0;let r;this.length=(r=t.length)!=null?r:1,this.line2=(this.line1=e.firstChild)&&this.line1.nextSibling;let c;this.snapToGrid=(c=t.snap)!=null?c:!1}shouldSnap(){return this.snapToGrid}getSpacing(){return this.spacing}getPatternId(){return this.pattern.id}update(e){var t=this.spacing*e;this.pattern.setAttribute("width",`${t}`),this.pattern.setAttribute("height",`${t}`),t=Math.floor(this.spacing/2)+.5;let i=t-this.length/2,r=t+this.length/2;t*=e,i*=e,r*=e,this.setLineAttributes(this.line1,e,i,r,t,t),this.setLineAttributes(this.line2,e,t,t,i,r)}setLineAttributes(e,t,i,r,c,$){e&&(e.setAttribute("stroke-width",`${t}`),e.setAttribute("x1",`${i}`),e.setAttribute("y1",`${c}`),e.setAttribute("x2",`${r}`),e.setAttribute("y2",`${$}`))}moveTo(e,t){this.pattern.setAttribute("x",`${e}`),this.pattern.setAttribute("y",`${t}`)}static createDom(e,t,i){e=w(te.PATTERN,{id:"blocklyGridPattern"+e,patternUnits:"userSpaceOnUse"},i);let r,c;if(0<((r=t.length)!=null?r:1)&&0<((c=t.spacing)!=null?c:0)){w(te.LINE,{stroke:t.colour},e);let $;($=t.length)!=null&&$&&w(te.LINE,{stroke:t.colour},e)}else w(te.LINE,{},e);return e}};s.Names$$module$build$src$core$names=class{constructor(e,t){this.db=new Map,this.dbReverse=new Set,this.variableMap=null,this.variablePrefix=t||"",this.reservedWords=new Set(e?e.split(","):[])}reset(){this.db.clear(),this.dbReverse.clear(),this.variableMap=null}setVariableMap(e){this.variableMap=e}getNameForUserVariable(e){return this.variableMap?(e=this.variableMap.getVariableById(e))?e.name:null:(console.warn(`Deprecated call to Names.prototype.getName without defining a variable map. To fix, add the following code in your generator's init() function:
+Blockly.YourGeneratorName.nameDB_.setVariableMap(workspace.getVariableMap());`),null)}populateVariables(e){e=s.allUsedVarModels$$module$build$src$core$variables(e);for(let t=0;t{c&&t&&this.deleteVariableInternal(t,r)})):this.deleteVariableInternal(t,r)}else console.warn("Can't delete non-existent variable: "+e)}deleteVariableInternal(e,t){const i=s.getGroup$$module$build$src$core$events$utils();i||s.setGroup$$module$build$src$core$events$utils(!0);try{for(let r=0;re.name)}getVariableUsesById(e){const t=[],i=this.workspace.getAllBlocks(!1);for(let r=0;rthis.remainingCapacityOfType(i))return!1;t+=e[i]}return!(t>this.remainingCapacity())}hasBlockLimits(){return this.options.maxBlocks!==1/0||!!this.options.maxInstances}getUndoStack(){return this.undoStack_}getRedoStack(){return this.redoStack_}undo(e){var t=e?this.redoStack_:this.undoStack_,i=e?this.undoStack_:this.redoStack_;const r=t.pop();if(r){for(var c=[r];t.length&&r.group&&r.group===t[t.length-1].group;){const $=t.pop();$&&c.push($)}for(t=0;tthis.MAX_UNDO&&0<=this.MAX_UNDO;)this.undoStack_.shift();for(let t=0;timage, .blocklyZoom>svg>image {
+ opacity: .4;
+}
+
+.blocklyZoom>image:hover, .blocklyZoom>svg>image:hover {
+ opacity: .6;
+}
+
+.blocklyZoom>image:active, .blocklyZoom>svg>image:active {
+ opacity: .8;
+}
+`);var BS=20,Cs=class extends dc{constructor(e){super(e),this.resizeHandlerWrapper=null,this.resizesEnabled=this.isVisible_=this.rendered=!0,this.startScrollY=this.startScrollX=this.scrollY=this.scrollX=0,this.dragDeltaXY=null,this.oldScale=this.scale=1,this.oldLeft=this.oldTop=0,this.inverseScreenCTM=this.targetWorkspace=this.configureContextMenu=this.lastRecordedPageScroll=this.injectionDiv=this.currentGesture_=this.toolbox_=this.flyout=this.scrollbar=this.trashcan=null,this.inverseScreenCTMDirty=!0,this.highlightedBlocks=[],this.toolboxCategoryCallbacks=new Map,this.flyoutButtonCallbacks=new Map,this.cachedParentSvg=null,this.keyboardAccessibilityMode=!1,this.topBoundedElements=[],this.dragTargetAreas=[],this.zoomControls_=null,this.metricsManager=new(C(Ae.METRICS_MANAGER,e,!0))(this),this.getMetrics=e.getMetrics||this.metricsManager.getMetrics.bind(this.metricsManager),this.setMetrics=e.setMetrics||Cs.setTopLevelWorkspaceMetrics_,this.componentManager=new fo,this.connectionDBList=Vr.init(this.connectionChecker),this.audioManager=new ZT(e.parentWorkspace),this.grid=this.options.gridPattern?new H$(this.options.gridPattern,e.gridOptions):null,this.markerManager=new zl(this),ao&&ze&&this.registerToolboxCategoryCallback(Op,ze),Ki&&ma&&this.registerToolboxCategoryCallback(V$,ma),Eo&&fa&&(this.registerToolboxCategoryCallback(cu,fa),this.addChangeListener(tp)),this.themeManager_=this.options.parentWorkspace?this.options.parentWorkspace.getThemeManager():new JT(this,this.options.theme||Qa),this.themeManager_.subscribeWorkspace(this);let t;this.renderer=Dh(this.options.renderer||"geras",this.getTheme(),(t=this.options.rendererOverrides)!=null?t:void 0),this.cachedParentSvgSize=new Vt(0,0)}getMarkerManager(){return this.markerManager}getMetricsManager(){return this.metricsManager}setMetricsManager(e){this.metricsManager=e,this.getMetrics=this.metricsManager.getMetrics.bind(this.metricsManager)}getComponentManager(){return this.componentManager}setCursorSvg(e){this.markerManager.setCursorSvg(e)}setMarkerSvg(e){this.markerManager.setMarkerSvg(e)}getMarker(e){return this.markerManager?this.markerManager.getMarker(e):null}getCursor(){return this.markerManager?this.markerManager.getCursor():null}getRenderer(){return this.renderer}getThemeManager(){return this.themeManager_}getTheme(){return this.themeManager_.getTheme()}setTheme(e){e||(e=Qa),this.themeManager_.setTheme(e)}refreshTheme(){this.svgGroup_&&this.renderer.refreshDom(this.svgGroup_,this.getTheme()),this.updateBlockStyles_(this.getAllBlocks(!1).filter(function(t){return!!t.getStyleName()})),this.refreshToolboxSelection(),this.toolbox_&&this.toolbox_.refreshTheme(),this.isVisible()&&this.setVisible(!0);const e=new(we(Cr))(this.getTheme().name,this.id);re(e)}updateBlockStyles_(e){for(let t=0,i;i=e[t];t++){const r=i.getStyleName();r&&i.setStyle(r)}}getInverseScreenCTM(){if(this.inverseScreenCTMDirty){const e=this.getParentSvg().getScreenCTM();e&&(this.inverseScreenCTM=e.inverse(),this.inverseScreenCTMDirty=!1)}return this.inverseScreenCTM}updateInverseScreenCTM(){this.inverseScreenCTMDirty=!0}isVisible(){return this.isVisible_}getSvgXY(e){let t=0,i=0,r=1;(this.getCanvas().contains(e)||this.getBubbleCanvas().contains(e))&&(r=this.scale);do{const c=$n(e);(e===this.getCanvas()||e===this.getBubbleCanvas())&&(r=1),t+=c.x*r,i+=c.y*r,e=e.parentNode}while(e&&e!==this.getParentSvg());return new Ue(t,i)}getCachedParentSvgSize(){const e=this.cachedParentSvgSize;return new Vt(e.width,e.height)}getOriginOffsetInPixels(){return zc(this.getCanvas())}getInjectionDiv(){if(!this.injectionDiv){let e=this.svgGroup_;for(;e;){if((" "+(e.getAttribute("class")||"")+" ").indexOf(" injectionDiv ")!==-1){this.injectionDiv=e;break}e=e.parentNode}}return this.injectionDiv}getBlockCanvas(){return this.svgBlockCanvas_}setResizeHandlerWrapper(e){this.resizeHandlerWrapper=e}createDom(e){return this.svgGroup_=w(te.G,{class:"blocklyWorkspace"}),e&&(this.svgBackground_=w(te.RECT,{height:"100%",width:"100%",class:e},this.svgGroup_),e==="blocklyMainBackground"&&this.grid?this.svgBackground_.style.fill="url(#"+this.grid.getPatternId()+")":this.themeManager_.subscribe(this.svgBackground_,"workspaceBackgroundColour","fill")),this.svgBlockCanvas_=w(te.G,{class:"blocklyBlockCanvas"},this.svgGroup_),this.svgBubbleCanvas_=w(te.G,{class:"blocklyBubbleCanvas"},this.svgGroup_),this.isFlyout||(Be(this.svgGroup_,"pointerdown",this,this.onMouseDown_,!1),document.body.addEventListener("wheel",function(){}),Be(this.svgGroup_,"wheel",this,this.onMouseWheel_)),this.options.hasCategories&&(this.toolbox_=new(C(Ae.TOOLBOX,this.options,!0))(this)),this.grid&&this.grid.update(this.scale),this.recordDragTargets(),(e=C(Ae.CURSOR,this.options))&&this.markerManager.setCursor(new e),this.renderer.createDom(this.svgGroup_,this.getTheme()),this.svgGroup_}dispose(){if(this.rendered=!1,this.currentGesture_&&this.currentGesture_.cancel(),this.svgGroup_&&U(this.svgGroup_),this.toolbox_&&(this.toolbox_.dispose(),this.toolbox_=null),this.flyout&&(this.flyout.dispose(),this.flyout=null),this.trashcan&&(this.trashcan.dispose(),this.trashcan=null),this.scrollbar&&(this.scrollbar.dispose(),this.scrollbar=null),this.zoomControls_&&this.zoomControls_.dispose(),this.audioManager&&this.audioManager.dispose(),this.grid&&(this.grid=null),this.renderer.dispose(),this.markerManager&&this.markerManager.dispose(),super.dispose(),this.themeManager_&&(this.themeManager_.unsubscribeWorkspace(this),this.themeManager_.unsubscribe(this.svgBackground_),this.options.parentWorkspace||this.themeManager_.dispose()),this.connectionDBList.length=0,this.toolboxCategoryCallbacks.clear(),this.flyoutButtonCallbacks.clear(),!this.options.parentWorkspace){const e=this.getParentSvg();e&&e.parentNode&&U(e.parentNode)}this.resizeHandlerWrapper&&(Dt(this.resizeHandlerWrapper),this.resizeHandlerWrapper=null)}addTrashcan(){this.trashcan=Cs.newTrashcan(this);const e=this.trashcan.createDom();this.svgGroup_.insertBefore(e,this.svgBlockCanvas_)}static newTrashcan(e){throw Error("The implementation of newTrashcan should be monkey-patched in by blockly.ts")}addZoomControls(){this.zoomControls_=new eE(this);const e=this.zoomControls_.createDom();this.svgGroup_.appendChild(e)}addFlyout(e){const t=new hs({parentWorkspace:this,rtl:this.RTL,oneBasedIndex:this.options.oneBasedIndex,horizontalLayout:this.horizontalLayout,renderer:this.options.renderer,rendererOverrides:this.options.rendererOverrides,move:{scrollbars:!0}});return t.toolboxPosition=this.options.toolboxPosition,this.flyout=this.horizontalLayout?new(C(Ae.FLYOUTS_HORIZONTAL_TOOLBOX,this.options,!0))(t):new(C(Ae.FLYOUTS_VERTICAL_TOOLBOX,this.options,!0))(t),this.flyout.autoClose=!1,this.flyout.getWorkspace().setVisible(!0),this.flyout.createDom(e)}getFlyout(e){return this.flyout||e?this.flyout:this.toolbox_?this.toolbox_.getFlyout():null}getToolbox(){return this.toolbox_}updateScreenCalculations_(){this.updateInverseScreenCTM(),this.recordDragTargets()}resizeContents(){this.resizesEnabled&&this.rendered&&(this.scrollbar&&this.scrollbar.resize(),this.updateInverseScreenCTM())}resize(){this.toolbox_&&this.toolbox_.position(),this.flyout&&this.flyout.position();const e=this.componentManager.getComponents(fo.Capability.POSITIONABLE,!0),t=this.getMetricsManager().getUiMetrics(),i=[];for(let r=0,c;c=e[r];r++){c.position(t,i);const $=c.getBoundingRectangle();$&&i.push($)}this.scrollbar&&this.scrollbar.resize(),this.updateScreenCalculations_()}updateScreenCalculationsIfScrolled(){const e=vd();Ue.equals(this.lastRecordedPageScroll,e)||(this.lastRecordedPageScroll=e,this.updateScreenCalculations_())}getCanvas(){return this.svgBlockCanvas_}setCachedParentSvgSize(e,t){const i=this.getParentSvg();e!=null&&(this.cachedParentSvgSize.width=e,i.setAttribute("data-cached-width",`${e}`)),t!=null&&(this.cachedParentSvgSize.height=t,i.setAttribute("data-cached-height",`${t}`))}getBubbleCanvas(){return this.svgBubbleCanvas_}getParentSvg(){if(!this.cachedParentSvg){let e=this.svgGroup_;for(;e;){if(e.tagName==="svg"){this.cachedParentSvg=e;break}e=e.parentNode}}return this.cachedParentSvg}maybeFireViewportChangeEvent(){if(_e()){var e=this.scale,t=-this.scrollY,i=-this.scrollX;if(!(e===this.oldScale&&1>Math.abs(t-this.oldTop)&&1>Math.abs(i-this.oldLeft))){var r=new(we(Ui))(t,i,e,this.id,this.oldScale);this.oldScale=e,this.oldTop=t,this.oldLeft=i,re(r)}}}translate(e,t){const i="translate("+e+","+t+") scale("+this.scale+")";this.svgBlockCanvas_.setAttribute("transform",i),this.svgBubbleCanvas_.setAttribute("transform",i),this.grid&&this.grid.moveTo(e,t),this.maybeFireViewportChangeEvent()}getWidth(){const e=this.getMetrics();return e?e.viewWidth/this.scale:0}setVisible(e){this.isVisible_=e,this.svgGroup_&&(this.scrollbar&&this.scrollbar.setContainerVisible(e),this.getFlyout()&&this.getFlyout().setContainerVisible(e),this.getParentSvg().style.display=e?"block":"none",this.toolbox_&&this.toolbox_.setVisible(e),e||this.hideChaff(!0))}render(){for(var e=this.getAllBlocks(!1),t=e.length-1;0<=t;t--)e[t].queueRender();if(this.currentGesture_)for(e=this.currentGesture_.getInsertionMarkers(),t=0;tvoid this.markerManager.updateMarkers())}highlightBlock(e,t){if(t===void 0){for(let i=0,r;r=this.highlightedBlocks[i];i++)r.setHighlighted(!1);this.highlightedBlocks.length=0}(e=e?this.getBlockById(e):null)&&((t=t===void 0||t)?this.highlightedBlocks.indexOf(e)===-1&&this.highlightedBlocks.push(e):Po(this.highlightedBlocks,e),e.setHighlighted(t))}paste(e){if(!this.rendered||!e.type&&!e.tagName)return null;this.currentGesture_&&this.currentGesture_.cancel();const t=s.getGroup$$module$build$src$core$events$utils();t||s.setGroup$$module$build$src$core$events$utils(!0);let i;try{i=e.type?this.pasteBlock_(null,e):e.tagName.toLowerCase()==="comment"?this.pasteWorkspaceComment_(e):this.pasteBlock_(e,null)}finally{s.setGroup$$module$build$src$core$events$utils(t)}return i}pasteBlock_(e,t){s.disable$$module$build$src$core$events$utils();let i;try{let r=0,c=0;if(e){i=wi(e,this);let $;r=parseInt(($=e.getAttribute("x"))!=null?$:"0"),this.RTL&&(r=-r);let v;c=parseInt((v=e.getAttribute("y"))!=null?v:"0")}else t&&(i=_n(t,this),r=t.x||10,this.RTL&&(r=this.getWidth()-r),c=t.y||10);if(!isNaN(r)&&!isNaN(c)){let $;do{$=!1;const v=this.getAllBlocks(!1);for(let H=0,Oe;Oe=v[H];H++){const Qe=Oe.getRelativeToSurfaceXY();if(1>=Math.abs(r-Qe.x)&&1>=Math.abs(c-Qe.y)){$=!0;break}}if(!$){const H=i.getConnections_(!1);for(let Oe=0,Qe;Qe=H[Oe];Oe++)if(Qe.closest(s.config$$module$build$src$core$config.snapRadius,new Ue(r,c)).connection){$=!0;break}}$&&(r=this.RTL?r-s.config$$module$build$src$core$config.snapRadius:r+s.config$$module$build$src$core$config.snapRadius,c+=2*s.config$$module$build$src$core$config.snapRadius)}while($);i.moveTo(new Ue(r,c))}}finally{s.enable$$module$build$src$core$events$utils()}return _e()&&!i.isShadow()&&re(new(we(s.CREATE$$module$build$src$core$events$utils))(i)),i.select(),i}pasteWorkspaceComment_(e){s.disable$$module$build$src$core$events$utils();let t;try{t=yo.fromXmlRendered(e,this);let i,r=parseInt((i=e.getAttribute("x"))!=null?i:"0"),c,$=parseInt((c=e.getAttribute("y"))!=null?c:"0");isNaN(r)||isNaN($)||(this.RTL&&(r=-r),t.moveBy(r+50,$+50))}finally{s.enable$$module$build$src$core$events$utils()}return _e()&&Hs.fireCreateEvent(t),t.select(),t}refreshToolboxSelection(){const e=this.isFlyout?this.targetWorkspace:this;e&&!e.currentGesture_&&e.toolbox_&&e.toolbox_.getFlyout()&&e.toolbox_.refreshSelection()}renameVariableById(e,t){super.renameVariableById(e,t),this.refreshToolboxSelection()}deleteVariableById(e){super.deleteVariableById(e),this.refreshToolboxSelection()}createVariable(e,t,i){return e=super.createVariable(e,t,i),this.refreshToolboxSelection(),e}recordDragTargets(){const e=this.componentManager.getComponents(fo.Capability.DRAG_TARGET,!0);this.dragTargetAreas=[];for(let t=0,i;i=e[t];t++){const r=i.getClientRect();r&&this.dragTargetAreas.push({component:i,clientRect:r})}}newBlock(e,t){throw Error("The implementation of newBlock should be monkey-patched in by blockly.ts")}getDragTarget(e){for(let t=0,i;i=this.dragTargetAreas[t];t++)if(i.clientRect.contains(e.clientX,e.clientY))return i.component;return null}onMouseDown_(e){const t=this.getGesture(e);t&&t.handleWsStart(e,this)}startDrag(e,t){e=pn(e,this.getParentSvg(),this.getInverseScreenCTM()),e.x/=this.scale,e.y/=this.scale,this.dragDeltaXY=Ue.difference(t,e)}moveDrag(e){return e=pn(e,this.getParentSvg(),this.getInverseScreenCTM()),e.x/=this.scale,e.y/=this.scale,Ue.sum(this.dragDeltaXY,e)}isDragging(){return this.currentGesture_!==null&&this.currentGesture_.isDragging()}isDraggable(){return this.options.moveOptions&&this.options.moveOptions.drag}isMovable(){return this.options.moveOptions&&!!this.options.moveOptions.scrollbars||this.options.moveOptions&&this.options.moveOptions.wheel||this.options.moveOptions&&this.options.moveOptions.drag||this.options.zoomOptions&&this.options.zoomOptions.wheel||this.options.zoomOptions&&this.options.zoomOptions.pinch}isMovableHorizontally(){const e=!!this.scrollbar;return this.isMovable()&&(!e||e&&this.scrollbar.canScrollHorizontally())}isMovableVertically(){const e=!!this.scrollbar;return this.isMovable()&&(!e||e&&this.scrollbar.canScrollVertically())}onMouseWheel_(e){if(bi.inProgress())e.preventDefault(),e.stopPropagation();else{var t=this.options.zoomOptions&&this.options.zoomOptions.wheel,i=this.options.moveOptions&&this.options.moveOptions.wheel;if(t||i){var r=vl(e);if(Ap)var c=e.metaKey;t&&(e.ctrlKey||c||!i)?(r=-r.y/50,t=pn(e,this.getParentSvg(),this.getInverseScreenCTM()),this.zoom(t.x,t.y,r)):(t=this.scrollX-r.x,i=this.scrollY-r.y,e.shiftKey&&!r.x&&(t=this.scrollX-r.y,i=this.scrollY),this.scroll(t,i)),e.preventDefault()}}}getBlocksBoundingBox(){const e=this.getTopBoundedElements();if(!e.length)return new Bt(0,0,0,0);const t=e[0].getBoundingRectangle();for(let r=1;rt.bottom&&(t.bottom=i.bottom),i.leftt.right&&(t.right=i.right))}return t}cleanUp(){this.setResizesEnabled(!1),s.setGroup$$module$build$src$core$events$utils(!0);const e=this.getTopBlocks(!0);let t=0;for(let i=0,r;r=e[i];i++){if(!r.isMovable())continue;const c=r.getRelativeToSurfaceXY();r.moveBy(-c.x,t-c.y,["cleanup"]),r.snapToGrid(),t=r.getRelativeToSurfaceXY().y+r.getHeightWidth().height+this.renderer.getConstants().MIN_BLOCK_HEIGHT}s.setGroup$$module$build$src$core$events$utils(!1),this.setResizesEnabled(!0)}showContextMenu(e){if(!this.options.readOnly&&!this.isFlyout){var t=kt.registry.getContextMenuOptions(kt.ScopeType.WORKSPACE,{workspace:this});this.configureContextMenu&&this.configureContextMenu(t,e),wl(e,t,this.RTL)}}updateToolbox(e){if(e=ia(e)){if(!this.options.languageTree)throw Error("Existing toolbox is null. Can't create new toolbox.");if(na(e)){if(!this.toolbox_)throw Error("Existing toolbox has no categories. Can't change mode.");this.options.languageTree=e,this.toolbox_.render(e)}else{if(!this.flyout)throw Error("Existing toolbox has categories. Can't change mode.");this.options.languageTree=e,this.flyout.show(e)}}else if(this.options.languageTree)throw Error("Can't nullify an existing toolbox.")}markFocused(){this.options.parentWorkspace?this.options.parentWorkspace.markFocused():(ne(this),this.getParentSvg().focus({preventScroll:!0}))}zoom(e,t,i){i=Math.pow(this.options.zoomOptions.scaleSpeed,i);const r=this.scale*i;if(this.scale!==r){r>this.options.zoomOptions.maxScale?i=this.options.zoomOptions.maxScale/this.scale:rthis.options.zoomOptions.maxScale?e=this.options.zoomOptions.maxScale:this.options.zoomOptions.minScale&&et.autoHide(e))}static setTopLevelWorkspaceMetrics_(e){const t=this.getMetrics();typeof e.x=="number"&&(this.scrollX=-(t.scrollLeft+(t.scrollWidth-t.viewWidth)*e.x)),typeof e.y=="number"&&(this.scrollY=-(t.scrollTop+(t.scrollHeight-t.viewHeight)*e.y)),this.translate(this.scrollX+t.absoluteLeft,this.scrollY+t.absoluteTop)}},jr;(function(e){e.BLOCK="block",e.BUTTON="button"})(jr||(jr={}));var au=class extends ru{constructor(e){super(),this.horizontalLayout=!1,this.boundEvents=[],this.filterWrapper=this.reflowWrapper=null,this.mats=[],this.buttons_=[],this.listeners=[],this.permanentlyDisabled=[],this.recycledBlocks=[],this.autoClose=!0,this.isVisible_=!1,this.containerVisible=!0,this.CORNER_RADIUS=8,this.SCROLLBAR_MARGIN=2.5,this.height_=this.width_=0,this.dragAngleRange_=70,this.svgGroup_=this.svgBackground_=null,e.setMetrics=this.setMetrics_.bind(this),this.workspace_=new Cs(e),this.workspace_.setMetricsManager(new KT(this.workspace_,this)),this.workspace_.internalIsFlyout=!0,this.workspace_.setVisible(this.isVisible_),this.id=he(),this.RTL=!!e.RTL,this.toolboxPosition_=e.toolboxPosition,this.tabWidth_=this.workspace_.getRenderer().getConstants().TAB_WIDTH,this.rectMap_=new WeakMap,this.MARGIN=this.CORNER_RADIUS,this.GAP_X=3*this.MARGIN,this.GAP_Y=3*this.MARGIN}createDom(e){return this.svgGroup_=w(e,{class:"blocklyFlyout",style:"display: none"}),this.svgBackground_=w(te.PATH,{class:"blocklyFlyoutBackground"},this.svgGroup_),this.svgGroup_.appendChild(this.workspace_.createDom()),this.workspace_.getThemeManager().subscribe(this.svgBackground_,"flyoutBackgroundColour","fill"),this.workspace_.getThemeManager().subscribe(this.svgBackground_,"flyoutOpacity","fill-opacity"),this.svgGroup_}init(e){this.targetWorkspace=e,this.workspace_.targetWorkspace=e,this.workspace_.scrollbar=new U$(this.workspace_,this.horizontalLayout,!this.horizontalLayout,"blocklyFlyoutScrollbar",this.SCROLLBAR_MARGIN),this.hide(),this.boundEvents.push(Be(this.svgGroup_,"wheel",this,this.wheel_)),this.autoClose||(this.filterWrapper=this.filterForCapacity.bind(this),this.targetWorkspace.addChangeListener(this.filterWrapper)),this.boundEvents.push(Be(this.svgBackground_,"pointerdown",this,this.onMouseDown)),this.workspace_.getGesture=this.targetWorkspace.getGesture.bind(this.targetWorkspace),this.workspace_.setVariableMap(this.targetWorkspace.getVariableMap()),this.workspace_.createPotentialVariableMap(),e.getComponentManager().addComponent({component:this,weight:1,capabilities:[fo.Capability.DELETE_AREA,fo.Capability.DRAG_TARGET]})}dispose(){this.hide(),this.workspace_.getComponentManager().removeComponent(this.id);for(const e of this.boundEvents)Dt(e);this.boundEvents.length=0,this.filterWrapper&&this.targetWorkspace.removeChangeListener(this.filterWrapper),this.workspace_&&(this.workspace_.getThemeManager().unsubscribe(this.svgBackground_),this.workspace_.dispose()),this.svgGroup_&&U(this.svgGroup_)}getWidth(){return this.width_}getHeight(){return this.height_}getFlyoutScale(){return this.targetWorkspace.scale}getWorkspace(){return this.workspace_}isVisible(){return this.isVisible_}setVisible(e){const t=e!==this.isVisible();this.isVisible_=e,t&&(this.autoClose||this.workspace_.recordDragTargets(),this.updateDisplay())}setContainerVisible(e){const t=e!==this.containerVisible;this.containerVisible=e,t&&this.updateDisplay()}updateDisplay(){let e;e=this.containerVisible?this.isVisible():!1,this.svgGroup_&&(this.svgGroup_.style.display=e?"block":"none");let t;(t=this.workspace_.scrollbar)==null||t.setContainerVisible(e)}positionAt_(e,t,i,r){let c;(c=this.svgGroup_)==null||c.setAttribute("width",`${e}`);let $;($=this.svgGroup_)==null||$.setAttribute("height",`${t}`),this.workspace_.setCachedParentSvgSize(e,t),this.svgGroup_&&se(this.svgGroup_,"translate("+i+"px,"+r+"px)"),(e=this.workspace_.scrollbar)&&(e.setOrigin(i,r),e.resize(),e.hScroll&&e.hScroll.setPosition(e.hScroll.position.x,e.hScroll.position.y),e.vScroll&&e.vScroll.setPosition(e.vScroll.position.x,e.vScroll.position.y))}hide(){if(this.isVisible()){this.setVisible(!1);for(const e of this.listeners)Dt(e);this.listeners.length=0,this.reflowWrapper&&(this.workspace_.removeChangeListener(this.reflowWrapper),this.reflowWrapper=null)}}show(e){this.workspace_.setResizesEnabled(!1),this.hide(),this.clearOldBlocks(),typeof e=="string"&&(e=this.getDynamicCategoryContents(e)),this.setVisible(!0),e=Ll(e),e=this.createFlyoutInfo(e),Ds(),this.layout_(e.contents,e.gaps),this.horizontalLayout?this.height_=0:this.width_=0,this.workspace_.setResizesEnabled(!0),this.reflow(),this.filterForCapacity(),this.position(),this.reflowWrapper=this.reflow.bind(this),this.workspace_.addChangeListener(this.reflowWrapper),this.emptyRecycledBlocks()}createFlyoutInfo(e){const t=[],i=[];this.permanentlyDisabled.length=0;const r=this.horizontalLayout?this.GAP_X:this.GAP_Y;for(const c of e){if("custom"in c){e=this.getDynamicCategoryContents(c.custom),e=Ll(e);const{contents:$,gaps:v}=this.createFlyoutInfo(e);t.push(...$),i.push(...v)}switch(c.kind.toUpperCase()){case"BLOCK":e=c;const $=this.createFlyoutBlock(e);t.push({type:jr.BLOCK,block:$}),this.addBlockGap(e,i,r);break;case"SEP":this.addSeparatorGap(c,i,r);break;case"LABEL":e=this.createButton(c,!0),t.push({type:jr.BUTTON,button:e}),i.push(r);break;case"BUTTON":e=this.createButton(c,!1),t.push({type:jr.BUTTON,button:e}),i.push(r)}}return{contents:t,gaps:i}}getDynamicCategoryContents(e){if(e=this.workspace_.targetWorkspace.getToolboxCategoryCallback(e),typeof e!="function")throw TypeError("Couldn't find a callback function when opening a toolbox category.");return e(this.workspace_.targetWorkspace)}createButton(e,t){return new Os(this.workspace_,this.targetWorkspace,e,t)}createFlyoutBlock(e){let t;return e.blockxml?(e=typeof e.blockxml=="string"?s.textToDom$$module$build$src$core$utils$xml(e.blockxml):e.blockxml,(t=this.getRecycledBlock(e.getAttribute("type")))||(t=wi(e,this.workspace_))):(t=this.getRecycledBlock(e.type),t||(e.enabled===void 0&&(e.enabled=e.disabled!=="true"&&e.disabled!==!0),t=Cl(e,this.workspace_))),t.isEnabled()||this.permanentlyDisabled.push(t),t}getRecycledBlock(e){let t=-1;for(let i=0;i{const i=this.targetWorkspace.getGesture(t);i&&(i.setStartBlock(e),i.handleFlyoutStart(t,this))}}onMouseDown(e){const t=this.targetWorkspace.getGesture(e);t&&t.handleFlyoutStart(e,this)}isBlockCreatable(e){return e.isEnabled()}createBlock(e){let t=null;s.disable$$module$build$src$core$events$utils();var i=this.targetWorkspace.getAllVariables();this.targetWorkspace.setResizesEnabled(!1);try{t=this.placeNewBlock(e)}finally{s.enable$$module$build$src$core$events$utils()}if(this.targetWorkspace.hideChaff(),e=y(this.targetWorkspace,i),_e()){for(s.setGroup$$module$build$src$core$events$utils(!0),i=0;i90-t||e>-90-t&&e<-90+t}getClientRect(){if(!this.svgGroup_||this.autoClose||!this.isVisible())return null;const e=this.svgGroup_.getBoundingClientRect(),t=e.top;return this.toolboxPosition_===at.TOP?new Bt(-1e9,t+e.height,-1e9,1e9):new Bt(t,1e9,-1e9,1e9)}reflowInternal_(){this.workspace_.scale=this.getFlyoutScale();let e=0;const t=this.workspace_.getTopBlocks(!1);for(let r=0,c;c=t[r];r++)e=Math.max(e,c.getHeightWidth().height);const i=this.buttons_;for(let r=0,c;c=i[r];r++)e=Math.max(e,c.height);if(e+=1.5*this.MARGIN,e*=this.workspace_.scale,e+=no.scrollbarThickness,this.height_!==e){for(let r=0,c;c=t[r];r++)this.rectMap_.has(c)&&this.moveRectToBlock_(this.rectMap_.get(c),c);this.targetWorkspace.toolboxPosition!==this.toolboxPosition_||this.toolboxPosition_!==at.TOP||this.targetWorkspace.getToolbox()||this.targetWorkspace.translate(this.targetWorkspace.scrollX,this.targetWorkspace.scrollY+e),this.height_=e,this.position(),this.targetWorkspace.recordDragTargets()}}};l(Ae.FLYOUTS_HORIZONTAL_TOOLBOX,li,tE);var W$=class extends au{constructor(e){super(e)}setMetrics_(e){if(this.isVisible()){var t=this.workspace_.getMetricsManager(),i=t.getScrollMetrics(),r=t.getViewMetrics();t=t.getAbsoluteMetrics(),typeof e.y=="number"&&(this.workspace_.scrollY=-(i.top+(i.height-r.height)*e.y)),this.workspace_.translate(this.workspace_.scrollX+t.left,this.workspace_.scrollY+t.top)}}getX(){if(!this.isVisible())return 0;var e=this.targetWorkspace.getMetricsManager();const t=e.getAbsoluteMetrics(),i=e.getViewMetrics();return e=e.getToolboxMetrics(),this.targetWorkspace.toolboxPosition===this.toolboxPosition_?this.targetWorkspace.getToolbox()?this.toolboxPosition_===at.LEFT?e.width:i.width-this.width_:this.toolboxPosition_===at.LEFT?0:i.width:this.toolboxPosition_===at.LEFT?0:i.width+t.left-this.width_}getY(){return 0}position(){if(this.isVisible()&&this.targetWorkspace.isVisible()){var e=this.targetWorkspace.getMetricsManager().getViewMetrics();this.height_=e.height,this.setBackgroundPath(this.width_-this.CORNER_RADIUS,e.height-2*this.CORNER_RADIUS),e=this.getX();var t=this.getY();this.positionAt_(this.width_,this.height_,e,t)}}setBackgroundPath(e,t){const i=this.toolboxPosition_===at.RIGHT;var r=e+this.CORNER_RADIUS;r=["M "+(i?r:0)+",0"],r.push("h",i?-e:e),r.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,i?0:1,i?-this.CORNER_RADIUS:this.CORNER_RADIUS,this.CORNER_RADIUS),r.push("v",Math.max(0,t)),r.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,i?0:1,i?this.CORNER_RADIUS:-this.CORNER_RADIUS,this.CORNER_RADIUS),r.push("h",i?e:-e),r.push("z"),this.svgBackground_.setAttribute("d",r.join(" "))}scrollToStart(){let e;(e=this.workspace_.scrollbar)==null||e.setY(0)}wheel_(e){var t=vl(e);if(t.y){const i=this.workspace_.getMetricsManager(),r=i.getScrollMetrics();t=i.getViewMetrics().top-r.top+t.y;let c;(c=this.workspace_.scrollbar)==null||c.setY(t),as(),fs()}e.preventDefault(),e.stopPropagation()}layout_(e,t){this.workspace_.scale=this.targetWorkspace.scale;var i=this.MARGIN;const r=this.RTL?i:i+this.tabWidth_;for(let H=0,Oe;Oe=e[H];H++)if(Oe.type==="block"){var c=Oe.block,$=c.getDescendants(!1);for(let qt=0,Ft;Ft=$[qt];qt++)Ft.isInFlyout=!0;$=c.getSvgRoot();const Qe=c.getHeightWidth();var v=c.outputConnection?r-this.tabWidth_:r;c.moveBy(v,i),v=this.createRect_(c,this.RTL?v-Qe.width:v,i,Qe,H),this.addBlockListeners_($,c,v),i+=Qe.height+t[H]}else Oe.type==="button"&&(c=Oe.button,this.initFlyoutButton_(c,r,i),i+=c.height+t[H])}isDragTowardWorkspace(e){e=Math.atan2(e.y,e.x)/Math.PI*180;const t=this.dragAngleRange_;return e-t||e<-180+t||e>180-t}getClientRect(){if(!this.svgGroup_||this.autoClose||!this.isVisible())return null;const e=this.svgGroup_.getBoundingClientRect(),t=e.left;return this.toolboxPosition_===at.LEFT?new Bt(-1e9,1e9,-1e9,t+e.width):new Bt(-1e9,1e9,t,1e9)}reflowInternal_(){this.workspace_.scale=this.getFlyoutScale();let e=0;var t=this.workspace_.getTopBlocks(!1);for(let r=0,c;c=t[r];r++){var i=c.getHeightWidth().width;c.outputConnection&&(i-=this.tabWidth_),e=Math.max(e,i)}for(let r=0,c;c=this.buttons_[r];r++)e=Math.max(e,c.width);if(e+=1.5*this.MARGIN+this.tabWidth_,e*=this.workspace_.scale,e+=no.scrollbarThickness,this.width_!==e){for(let r=0,c;c=t[r];r++){if(this.RTL){i=c.getRelativeToSurfaceXY().x;let $=e/this.workspace_.scale-this.MARGIN;c.outputConnection||($-=this.tabWidth_),c.moveBy($-i,0)}this.rectMap_.has(c)&&this.moveRectToBlock_(this.rectMap_.get(c),c)}if(this.RTL)for(let r=0,c;c=this.buttons_[r];r++)t=c.getPosition().y,c.moveTo(e/this.workspace_.scale-c.width-this.MARGIN-this.tabWidth_,t);this.targetWorkspace.toolboxPosition!==this.toolboxPosition_||this.toolboxPosition_!==at.LEFT||this.targetWorkspace.getToolbox()||this.targetWorkspace.translate(this.targetWorkspace.scrollX+e,this.targetWorkspace.scrollY),this.width_=e,this.position(),this.targetWorkspace.recordDragTargets()}}};W$.registryName="verticalFlyout",l(Ae.FLYOUTS_VERTICAL_TOOLBOX,li,W$);var oE;s.CodeGenerator$$module$build$src$core$generator=class{constructor(e){this.forBlock=Object.create(null),this.FUNCTION_NAME_PLACEHOLDER_="{leCUI8hutHZI4480Dc}",this.STATEMENT_SUFFIX=this.STATEMENT_PREFIX=this.INFINITE_LOOP_TRAP=null,this.INDENT=" ",this.COMMENT_WRAP=60,this.ORDER_OVERRIDES=[],this.isInitialized=null,this.RESERVED_WORDS_="",this.definitions_=Object.create(null),this.functionNames_=Object.create(null),this.nameDB_=void 0,this.name_=e,this.FUNCTION_NAME_PLACEHOLDER_REGEXP_=new RegExp(this.FUNCTION_NAME_PLACEHOLDER_,"g")}workspaceToCode(e){e||(console.warn("No workspace specified in workspaceToCode call. Guessing."),e=oe());var t=[];this.init(e),e=e.getTopBlocks(!0);for(let i=0,r;r=e[i];i++){let c=this.blockToCode(r);Array.isArray(c)&&(c=c[0]),c&&(r.outputConnection&&(c=this.scrubNakedValue(c),this.STATEMENT_PREFIX&&!r.suppressPrefixSuffix&&(c=this.injectId(this.STATEMENT_PREFIX,r)+c),this.STATEMENT_SUFFIX&&!r.suppressPrefixSuffix&&(c+=this.injectId(this.STATEMENT_SUFFIX,r))),t.push(c))}return t=t.join(`
+`),t=this.finish(t),t=t.replace(/^\s+\n/,""),t=t.replace(/\n\s+$/,`
+`),t=t.replace(/[ \t]+\n/g,`
+`)}prefixLines(e,t){return t+e.replace(/(?!\n$)\n/g,`
+`+t)}allNestedComments(e){const t=[];e=e.getDescendants(!0);for(let i=0;i.blocklyPathLight,`,`${e} .blocklyInsertionMarker>.blocklyPathDark {`,`fill-opacity: ${this.INSERTION_MARKER_OPACITY};`,"stroke: none;","}"])}},nE=class{constructor(e){this.inlineSteps_=this.steps_="",this.info_=e,this.RTL_=this.info_.RTL,e=e.getRenderer(),this.constants_=e.getConstants(),this.highlightConstants_=e.getHighlightConstants(),this.highlightOffset=this.highlightConstants_.OFFSET,this.outsideCornerPaths_=this.highlightConstants_.OUTSIDE_CORNER,this.insideCornerPaths_=this.highlightConstants_.INSIDE_CORNER,this.puzzleTabPaths_=this.highlightConstants_.PUZZLE_TAB,this.notchPaths_=this.highlightConstants_.NOTCH,this.startPaths_=this.highlightConstants_.START_HAT,this.jaggedTeethPaths_=this.highlightConstants_.JAGGED_TEETH}getPath(){return this.steps_+`
+`+this.inlineSteps_}drawTopCorner(e){this.steps_+=jt(e.xPos,this.info_.startY);for(let t=0,i;i=e.elements[t];t++)q.isLeftSquareCorner(i)?this.steps_+=this.highlightConstants_.START_POINT:q.isLeftRoundedCorner(i)?this.steps_+=this.outsideCornerPaths_.topLeft(this.RTL_):q.isPreviousConnection(i)?this.steps_+=this.notchPaths_.pathLeft:q.isHat(i)?this.steps_+=this.startPaths_.path(this.RTL_):q.isSpacer(i)&&i.width!==0&&(this.steps_+=je("H",i.xPos+i.width-this.highlightOffset));this.steps_+=je("H",e.xPos+e.width-this.highlightOffset)}drawJaggedEdge_(e){this.info_.RTL&&(this.steps_+=this.jaggedTeethPaths_.pathLeft+je("v",e.height-this.jaggedTeethPaths_.height-this.highlightOffset))}drawValueInput(e){const t=e.getLastInput();if(this.RTL_){const i=e.height-t.connectionHeight;this.steps_+=To(t.xPos+t.width-this.highlightOffset,e.yPos)+this.puzzleTabPaths_.pathDown(this.RTL_)+je("v",i)}else this.steps_+=To(t.xPos+t.width,e.yPos)+this.puzzleTabPaths_.pathDown(this.RTL_)}drawStatementInput(e){const t=e.getLastInput();if(t)if(this.RTL_){const i=e.height-2*this.insideCornerPaths_.height;this.steps_+=To(t.xPos,e.yPos)+this.insideCornerPaths_.pathTop(this.RTL_)+je("v",i)+this.insideCornerPaths_.pathBottom(this.RTL_)+Bs(e.width-t.xPos-this.insideCornerPaths_.width,0)}else this.steps_+=To(t.xPos,e.yPos+e.height)+this.insideCornerPaths_.pathBottom(this.RTL_)+Bs(e.width-t.xPos-this.insideCornerPaths_.width,0)}drawRightSideRow(e){const t=e.xPos+e.width-this.highlightOffset;e instanceof M$&&e.followsStatement&&(this.steps_+=je("H",t)),this.RTL_&&(this.steps_+=je("H",t),e.height>this.highlightOffset&&(this.steps_+=je("V",e.yPos+e.height-this.highlightOffset)))}drawBottomRow(e){if(this.RTL_)this.steps_+=je("V",e.baseline-this.highlightOffset);else{const t=this.info_.bottomRow.elements[0];q.isLeftSquareCorner(t)?this.steps_+=To(e.xPos+this.highlightOffset,e.baseline-this.highlightOffset):q.isLeftRoundedCorner(t)&&(this.steps_+=To(e.xPos,e.baseline),this.steps_+=this.outsideCornerPaths_.bottomLeft())}}drawLeft(){var e=this.info_.outputConnection;e&&(e=e.connectionOffsetY+e.height,this.RTL_?this.steps_+=To(this.info_.startX,e):(this.steps_+=To(this.info_.startX+this.highlightOffset,this.info_.bottomRow.baseline-this.highlightOffset),this.steps_+=je("V",e)),this.steps_+=this.puzzleTabPaths_.pathUp(this.RTL_)),this.RTL_||(e=this.info_.topRow,q.isLeftRoundedCorner(e.elements[0])?this.steps_+=je("V",this.outsideCornerPaths_.height):this.steps_+=je("V",e.capline+this.highlightOffset))}drawInlineInput(e){const t=this.highlightOffset,i=e.xPos+e.connectionWidth;var r=e.centerline-e.height/2;const c=e.width-e.connectionWidth,$=r+t;this.RTL_?(r=e.connectionOffsetY-t,e=e.height-(e.connectionOffsetY+e.connectionHeight)+t,this.inlineSteps_+=To(i-t,$)+je("v",r)+this.puzzleTabPaths_.pathDown(this.RTL_)+je("v",e)+je("h",c)):this.inlineSteps_+=To(e.xPos+e.width+t,$)+je("v",e.height)+je("h",-c)+To(i,r+e.connectionOffsetY)+this.puzzleTabPaths_.pathDown(this.RTL_)}},rE=class extends sc{constructor(e,t){super(e,t),this.highlighter_=new nE(t)}draw(){this.drawOutline_(),this.drawInternals_();const e=this.block_.pathObject;e.setPath(this.outlinePath_+`
+`+this.inlinePath_),e.setHighlightPath(this.highlighter_.getPath()),this.info_.RTL&&e.flipRTL(),this.recordSizeOnBlock_()}drawTop_(){this.highlighter_.drawTopCorner(this.info_.topRow),this.highlighter_.drawRightSideRow(this.info_.topRow),super.drawTop_()}drawJaggedEdge_(e){this.highlighter_.drawJaggedEdge_(e),super.drawJaggedEdge_(e)}drawValueInput_(e){this.highlighter_.drawValueInput(e),super.drawValueInput_(e)}drawStatementInput_(e){this.highlighter_.drawStatementInput(e),super.drawStatementInput_(e)}drawRightSideRow_(e){this.highlighter_.drawRightSideRow(e),this.outlinePath_+=je("H",e.xPos+e.width)+je("V",e.yPos+e.height)}drawBottom_(){this.highlighter_.drawBottomRow(this.info_.bottomRow),super.drawBottom_()}drawLeft_(){this.highlighter_.drawLeft(),super.drawLeft_()}drawInlineInput_(e){this.highlighter_.drawInlineInput(e),super.drawInlineInput_(e)}positionInlineInputConnection_(e){const t=e.centerline-e.height/2;if(e.connectionModel){let i=e.xPos+e.connectionWidth+this.constants_.DARK_PATH_OFFSET;this.info_.RTL&&(i*=-1),e.connectionModel.setOffsetInBlock(i,t+e.connectionOffsetY+this.constants_.DARK_PATH_OFFSET)}}positionStatementInputConnection_(e){const t=e.getLastInput();if(t!=null&&t.connectionModel){let i=e.xPos+e.statementEdge+t.notchOffset;i=this.info_.RTL?-1*i:i+this.constants_.DARK_PATH_OFFSET,t.connectionModel.setOffsetInBlock(i,e.yPos+this.constants_.DARK_PATH_OFFSET)}}positionExternalValueConnection_(e){const t=e.getLastInput();if(t&&t.connectionModel){let i=e.xPos+e.width+this.constants_.DARK_PATH_OFFSET;this.info_.RTL&&(i*=-1),t.connectionModel.setOffsetInBlock(i,e.yPos)}}positionNextConnection_(){const e=this.info_.bottomRow;if(e.connection){const t=e.connection,i=t.xPos;t.connectionModel.setOffsetInBlock((this.info_.RTL?-i:i)+this.constants_.DARK_PATH_OFFSET/2,e.baseline+this.constants_.DARK_PATH_OFFSET)}}},lE=class{constructor(e){this.OFFSET=.5,this.constantProvider=e,this.START_POINT=jt(this.OFFSET,this.OFFSET)}init(){this.INSIDE_CORNER=this.makeInsideCorner(),this.OUTSIDE_CORNER=this.makeOutsideCorner(),this.PUZZLE_TAB=this.makePuzzleTab(),this.NOTCH=this.makeNotch(),this.JAGGED_TEETH=this.makeJaggedTeeth(),this.START_HAT=this.makeStartHat()}makeInsideCorner(){const e=this.constantProvider.CORNER_RADIUS,t=this.OFFSET,i=(1-Math.SQRT1_2)*(e+t)-t,r=jt(i,i)+oo("a","0 0,0",e,tt(-i-t,e-i)),c=oo("a","0 0,0",e+t,tt(e+t,e+t)),$=jt(i,-i)+oo("a","0 0,0",e+t,tt(e-i,i+t));return{width:e+t,height:e,pathTop(v){return v?r:""},pathBottom(v){return v?c:$}}}makeOutsideCorner(){const e=this.constantProvider.CORNER_RADIUS,t=this.OFFSET,i=(1-Math.SQRT1_2)*(e-t)+t,r=jt(i,i)+oo("a","0 0,1",e-t,tt(e-i,-i+t)),c=jt(t,e)+oo("a","0 0,1",e-t,tt(e,-e+t)),$=-i,v=jt(i,$)+oo("a","0 0,1",e-t,tt(-i+t,-$-e));return{height:e,topLeft(H){return H?r:c},bottomLeft(){return v}}}makePuzzleTab(){const e=this.constantProvider.TAB_WIDTH,t=this.constantProvider.TAB_HEIGHT,i=jt(-2,-t+3.4)+Bs(-.45*e,-2.1),r=je("v",2.5)+jt(.97*-e,2.5)+xo("q",[tt(.05*-e,10),tt(.3*e,9.5)])+jt(.67*e,-1.9)+je("v",2.5),c=je("v",-1.5)+jt(-.92*e,-.5)+xo("q",[tt(-.19*e,-5.5),tt(0,-11)])+jt(.92*e,1),$=jt(-5,t-.7)+Bs(.46*e,-2.1);return{width:e,height:t,pathUp(v){return v?i:c},pathDown(v){return v?r:$}}}makeNotch(){return{pathLeft:je("h",this.OFFSET)+this.constantProvider.NOTCH.pathLeft}}makeJaggedTeeth(){return{pathLeft:Bs(5.1,2.6)+jt(-10.2,6.8)+Bs(5.1,2.6),height:12,width:10.2}}makeStartHat(){const e=this.constantProvider.START_HAT.height,t=jt(25,-8.7)+xo("c",[tt(29.7,-6.2),tt(57.2,-.5),tt(75,8.7)]),i=xo("c",[tt(17.8,-9.2),tt(45.3,-14.9),tt(75,-8.7)])+To(100.5,e+.5);return{path(r){return r?t:i}}}},cE=class extends N${constructor(e,t){super(e,t),this.constants_=e,this.connectedBlock&&(this.width+=this.constants_.DARK_PATH_OFFSET,this.height+=this.constants_.DARK_PATH_OFFSET)}},aE=class extends rc{constructor(e,t){super(e,t),this.constants_=e,this.connectedBlock&&(this.height+=this.constants_.DARK_PATH_OFFSET)}},uE=class extends zr{constructor(e,t){super(e,t),this.renderer_=e}getRenderer(){return this.renderer_}populateBottomRow_(){super.populateBottomRow_(),this.block_.inputList.length&&this.block_.inputList[this.block_.inputList.length-1]instanceof Zo||(this.bottomRow.minHeight=this.constants_.MEDIUM_PADDING-this.constants_.DARK_PATH_OFFSET)}addInput_(e,t){this.isInline&&e instanceof s.ValueInput$$module$build$src$core$inputs$value_input?(t.elements.push(new cE(this.constants_,e)),t.hasInlineInput=!0):e instanceof Zo?(t.elements.push(new aE(this.constants_,e)),t.hasStatement=!0):e instanceof s.ValueInput$$module$build$src$core$inputs$value_input?(t.elements.push(new su(this.constants_,e)),t.hasExternalInput=!0):e instanceof zs&&(t.minHeight=Math.max(t.minHeight,this.constants_.DUMMY_INPUT_MIN_HEIGHT),t.hasDummyInput=!0),this.isInline||t.align!==null||(t.align=e.align)}addElemSpacing_(){let e=!1;for(let i=0,r;r=this.rows[i];i++)r.hasExternalInput&&(e=!0);for(let i=0,r;r=this.rows[i];i++){var t=r.elements;if(r.elements=[],r.startsWithElemSpacer()&&r.elements.push(new os(this.constants_,this.getInRowSpacing_(null,t[0]))),t.length){for(let c=0;clp(t)),e.length?e:null}load(e,t){const i=t.getProcedureMap();for(const r of e)i.add(ap(this.procedureModelClass,this.parameterModelClass,r,t))}clear(e){e.getProcedureMap().clear()}},Yr={};Yr.ProcedureSerializer=FS,Yr.loadParameter=up,Yr.loadProcedure=ap,Yr.saveParameter=cp,Yr.saveProcedure=lp;var TE=class{constructor(){this.priority=eT}save(e){const t=[];for(const i of e.getAllVariables())e={name:i.name,id:i.getId()},i.type&&(e.type=i.type),t.push(e);return t.length?t:null}load(e,t){for(const i of e)t.createVariable(i.name,i.type,i.id)}clear(e){e.getVariableMap().clear()}};jc("variables",new TE);var EE={};EE.VariableSerializer=TE;var X$={};X$.load=bm,X$.save=Em;var US={blocks:Gl,exceptions:Cn,priorities:Va,procedures:Yr,registry:Pp,variables:EE,workspaces:X$},Ks;(function(e){e.ESCAPE="escape",e.DELETE="delete",e.COPY="copy",e.CUT="cut",e.PASTE="paste",e.UNDO="undo",e.REDO="redo"})(Ks||(Ks={})),mp();var Qs={};Qs.names=Ks,Qs.registerCopy=pp,Qs.registerCut=$p,Qs.registerDefaultShortcuts=mp,Qs.registerDelete=hp,Qs.registerEscape=dp,Qs.registerPaste=_p,Qs.registerRedo=fp,Qs.registerUndo=gp;var HS={colour_blocks:{colourPrimary:"#CF63CF",colourSecondary:"#C94FC9",colourTertiary:"#BD42BD"},list_blocks:{colourPrimary:"#9966FF",colourSecondary:"#855CD6",colourTertiary:"#774DCB"},logic_blocks:{colourPrimary:"#4C97FF",colourSecondary:"#4280D7",colourTertiary:"#3373CC"},loop_blocks:{colourPrimary:"#0fBD8C",colourSecondary:"#0DA57A",colourTertiary:"#0B8E69"},math_blocks:{colourPrimary:"#59C059",colourSecondary:"#46B946",colourTertiary:"#389438"},procedure_blocks:{colourPrimary:"#FF6680",colourSecondary:"#FF4D6A",colourTertiary:"#FF3355"},text_blocks:{colourPrimary:"#FFBF00",colourSecondary:"#E6AC00",colourTertiary:"#CC9900"},variable_blocks:{colourPrimary:"#FF8C1A",colourSecondary:"#FF8000",colourTertiary:"#DB6E00"},variable_dynamic_blocks:{colourPrimary:"#FF8C1A",colourSecondary:"#FF8000",colourTertiary:"#DB6E00"},hat_blocks:{colourPrimary:"#4C97FF",colourSecondary:"#4280D7",colourTertiary:"#3373CC",hat:"cap"}},VS={colour_category:{colour:"#CF63CF"},list_category:{colour:"#9966FF"},logic_category:{colour:"#4C97FF"},loop_category:{colour:"#0fBD8C"},math_category:{colour:"#59C059"},procedure_category:{colour:"#FF6680"},text_category:{colour:"#FFBF00"},variable_category:{colour:"#FF8C1A"},variable_dynamic_category:{colour:"#FF8C1A"}},GS=new Nn("zelos",HS,VS),j$={};j$.Classic=Qa,j$.Zelos=GS;var Y$=class{constructor(e,t,i){this.id_=e.toolboxitemid||$e(),this.level_=(this.parent_=i||null)?this.parent_.getLevel()+1:0,this.toolboxItemDef_=e,this.parentToolbox_=t,this.workspace_=this.parentToolbox_.getWorkspace()}init(){}getDiv(){return null}getClickTarget(){return null}getId(){return this.id_}getParent(){return null}getLevel(){return this.level_}isSelectable(){return!1}isCollapsible(){return!1}dispose(){}setVisible_(e){}},ys=class extends Y${constructor(e,t,i){super(e,t,i),this.colour_=this.name_="",this.labelDom_=this.iconDom_=this.rowContents_=this.rowDiv_=this.htmlDiv_=null,this.isDisabled_=this.isHidden_=!1,this.flyoutItems_=[],this.cssConfig_=this.makeDefaultCssConfig_()}init(){this.parseCategoryDef_(this.toolboxItemDef_),this.parseContents_(this.toolboxItemDef_),this.createDom_(),this.toolboxItemDef_.hidden==="true"&&this.hide()}makeDefaultCssConfig_(){return{container:"blocklyToolboxCategory",row:"blocklyTreeRow",rowcontentcontainer:"blocklyTreeRowContentContainer",icon:"blocklyTreeIcon",label:"blocklyTreeLabel",contents:"blocklyToolboxContents",selected:"blocklyTreeSelected",openicon:"blocklyTreeIconOpen",closedicon:"blocklyTreeIconClosed"}}parseContents_(e){if("custom"in e)this.flyoutItems_=e.custom;else if(e=e.contents)for(let t=0;t>>/sprites.png);
+ height: 16px;
+ vertical-align: middle;
+ visibility: hidden;
+ width: 16px;
+}
+
+.blocklyTreeIconClosed {
+ background-position: -32px -1px;
+}
+
+.blocklyToolboxDiv[dir="RTL"] .blocklyTreeIconClosed {
+ background-position: 0 -1px;
+}
+
+.blocklyTreeSelected>.blocklyTreeIconClosed {
+ background-position: -32px -17px;
+}
+
+.blocklyToolboxDiv[dir="RTL"] .blocklyTreeSelected>.blocklyTreeIconClosed {
+ background-position: 0 -17px;
+}
+
+.blocklyTreeIconOpen {
+ background-position: -16px -1px;
+}
+
+.blocklyTreeSelected>.blocklyTreeIconOpen {
+ background-position: -16px -17px;
+}
+
+.blocklyTreeLabel {
+ cursor: default;
+ font: 16px sans-serif;
+ padding: 0 3px;
+ vertical-align: middle;
+}
+
+.blocklyToolboxDelete .blocklyTreeLabel {
+ cursor: url("<<>>/handdelete.cur"), auto;
+}
+
+.blocklyTreeSelected .blocklyTreeLabel {
+ color: #fff;
+}
+`),l(Ae.TOOLBOX_ITEM,ys.registrationName,ys);var pc=class extends Y${constructor(e,t){super(e,t),this.cssConfig_={container:"blocklyTreeSeparator"},this.htmlDiv_=null,Object.assign(this.cssConfig_,e.cssconfig||e.cssConfig)}init(){this.createDom_()}createDom_(){const e=document.createElement("div"),t=this.cssConfig_.container;return t&&I(e,t),this.htmlDiv_=e}getDiv(){return this.htmlDiv_}dispose(){U(this.htmlDiv_)}};pc.registrationName="sep",cs(`
+.blocklyTreeSeparator {
+ border-bottom: solid #e5e5e5 1px;
+ height: 0;
+ margin: 5px 0;
+}
+
+.blocklyToolboxDiv[layout="h"] .blocklyTreeSeparator {
+ border-right: solid #e5e5e5 1px;
+ border-bottom: none;
+ height: auto;
+ margin: 0 5px 0 5px;
+ padding: 5px 0;
+ width: 0;
+}
+`),l(Ae.TOOLBOX_ITEM,pc.registrationName,pc);var Kr=class extends ys{constructor(e,t,i){super(e,t,i),this.subcategoriesDiv_=null,this.expanded_=!1,this.toolboxItems_=[]}makeDefaultCssConfig_(){const e=super.makeDefaultCssConfig_();return e.contents="blocklyToolboxContents",e}parseContents_(e){if("custom"in e)this.flyoutItems_=e.custom;else{const t=e.contents;if(t){this.flyoutItems_=[],e=!0;for(let i=0;i>>/handdelete.cur"), auto;
+}
+
+.blocklyToolboxGrab {
+ cursor: url("<<>>/handclosed.cur"), auto;
+ cursor: grabbing;
+ cursor: -webkit-grabbing;
+}
+
+/* Category tree in Toolbox. */
+.blocklyToolboxDiv {
+ background-color: #ddd;
+ overflow-x: visible;
+ overflow-y: auto;
+ padding: 4px 0 4px 0;
+ position: absolute;
+ z-index: 70; /* so blocks go under toolbox when dragging */
+ -webkit-tap-highlight-color: transparent; /* issue #1345 */
+}
+
+.blocklyToolboxContents {
+ display: flex;
+ flex-wrap: wrap;
+ flex-direction: column;
+}
+
+.blocklyToolboxContents:focus {
+ outline: none;
+}
+`),l(Ae.TOOLBOX,li,bE);var vE=class extends ru{constructor(e){super(),this.workspace=e,this.id="trashcan",this.contents=[],this.flyout=null,this.isLidOpen=!1,this.minOpenness=0,this.lidTask=this.svgLid=this.svgGroup=null,this.top=this.left=this.lidOpen=0,this.initialized=!1,0>=this.workspace.options.maxTrashcanContents||(e=new hs({scrollbars:!0,parentWorkspace:this.workspace,rtl:this.workspace.RTL,oneBasedIndex:this.workspace.options.oneBasedIndex,renderer:this.workspace.options.renderer,rendererOverrides:this.workspace.options.rendererOverrides,move:{scrollbars:!0}}),this.workspace.horizontalLayout?(e.toolboxPosition=this.workspace.toolboxPosition===at.TOP?at.BOTTOM:at.TOP,this.flyout=new(C(Ae.FLYOUTS_HORIZONTAL_TOOLBOX,this.workspace.options,!0))(e)):(e.toolboxPosition=this.workspace.toolboxPosition===at.RIGHT?at.LEFT:at.RIGHT,this.flyout=new(C(Ae.FLYOUTS_VERTICAL_TOOLBOX,this.workspace.options,!0))(e)),this.workspace.addChangeListener(this.onDelete.bind(this)))}createDom(){this.svgGroup=w(te.G,{class:"blocklyTrash"});let e;const t=String(Math.random()).substring(2);e=w(te.CLIPPATH,{id:"blocklyTrashBodyClipPath"+t},this.svgGroup),w(te.RECT,{width:Qr,height:uu,y:qr},e);const i=w(te.IMAGE,{width:wo.width,x:-K$,height:wo.height,y:-Q$,"clip-path":"url(#blocklyTrashBodyClipPath"+t+")"},this.svgGroup);return i.setAttributeNS(us,"xlink:href",this.workspace.options.pathToMedia+wo.url),e=w(te.CLIPPATH,{id:"blocklyTrashLidClipPath"+t},this.svgGroup),w(te.RECT,{width:Qr,height:qr},e),this.svgLid=w(te.IMAGE,{width:wo.width,x:-K$,height:wo.height,y:-Q$,"clip-path":"url(#blocklyTrashLidClipPath"+t+")"},this.svgGroup),this.svgLid.setAttributeNS(us,"xlink:href",this.workspace.options.pathToMedia+wo.url),wt(this.svgGroup,"pointerdown",this,this.blockMouseDownWhenOpenable),wt(this.svgGroup,"pointerup",this,this.click),wt(i,"pointerover",this,this.mouseOver),wt(i,"pointerout",this,this.mouseOut),this.animateLid(),this.svgGroup}init(){0{let i;(i=this.flyout)==null||i.show(e),t.cursor="";let r;(r=this.workspace.scrollbar)==null||r.setVisible(!1)},10),this.fireUiEvent(!0)}}closeFlyout(){if(this.contentsIsOpen()){var e;(e=this.flyout)==null||e.hide();var t;(t=this.workspace.scrollbar)==null||t.setVisible(!0),this.fireUiEvent(!1),this.workspace.recordDragTargets()}}autoHide(e){!e&&this.flyout&&this.closeFlyout()}emptyContents(){this.hasContents()&&(this.contents.length=0,this.setMinOpenness(0),this.closeFlyout())}position(e,t){if(this.initialized){var i=Ea(this.workspace,e);e=Ta(i,new Vt(Qr,uu+qr),WS,IE,e,this.workspace),t=ba(e,IE,i.vertical===vi.TOP?Qi.DOWN:Qi.UP,t),this.top=t.top,this.left=t.left;var r;(r=this.svgGroup)==null||r.setAttribute("transform","translate("+this.left+","+this.top+")")}}getBoundingRectangle(){return new Bt(this.top,this.top+uu+qr,this.left,this.left+Qr)}getClientRect(){if(!this.svgGroup)return null;var e=this.svgGroup.getBoundingClientRect();const t=e.top+Q$-du;return e=e.left+K$-du,new Bt(t,t+qr+uu+2*du,e,e+Qr+2*du)}onDragOver(e){this.setLidOpen(this.wouldDelete_)}onDragExit(e){this.setLidOpen(!1)}onDrop(e){setTimeout(this.setLidOpen.bind(this,!1),100)}setLidOpen(e){this.isLidOpen!==e&&(this.lidTask&&clearTimeout(this.lidTask),this.isLidOpen=e,this.animateLid())}animateLid(){const e=jS;var t=1/(e+1);this.lidOpen+=this.isLidOpen?t:-t,this.lidOpen=Math.min(Math.max(this.lidOpen,this.minOpenness),1),this.setLidAngle(this.lidOpen*CE),t=OE+this.lidOpen*(YS-OE),this.svgGroup&&(this.svgGroup.style.opacity=`${t}`),this.lidOpen>this.minOpenness&&1>this.lidOpen&&(this.lidTask=setTimeout(this.animateLid.bind(this),XS/e))}setLidAngle(e){const t=this.workspace.toolboxPosition===at.RIGHT||this.workspace.horizontalLayout&&this.workspace.RTL;let i;(i=this.svgLid)==null||i.setAttribute("transform","rotate("+(t?-e:e)+","+(t?4:Qr-4)+","+(qr-2)+")")}setMinOpenness(e){this.minOpenness=e,this.isLidOpen||this.setLidAngle(e*CE)}closeLid(){this.setLidOpen(!1)}click(){this.hasContents()&&this.openFlyout()}fireUiEvent(e){e=new(we(Ir))(e,this.workspace.id),re(e)}blockMouseDownWhenOpenable(e){!this.contentsIsOpen()&&this.hasContents()&&e.stopPropagation()}mouseOver(){this.hasContents()&&this.setLidOpen(!0)}mouseOut(){this.setLidOpen(!1)}onDelete(e){if(!(0>=this.workspace.options.maxTrashcanContents||e.type!==s.DELETE$$module$build$src$core$events$utils||e.type!==s.DELETE$$module$build$src$core$events$utils||e.wasShadow)){if(!e.oldJson)throw Error("Encountered a delete event without proper oldJson");if(e=JSON.stringify(this.cleanBlockJson(e.oldJson)),this.contents.indexOf(e)===-1){for(this.contents.unshift(e);this.contents.length>this.workspace.options.maxTrashcanContents;)this.contents.pop();this.setMinOpenness(zS)}}}cleanBlockJson(e){function t(i){if(i){if(delete i.id,delete i.x,delete i.y,delete i.enabled,i.icons&&i.icons.comment){var r=i.icons.comment;delete r.height,delete r.width,delete r.pinned}r=i.inputs;for(var c in r){var $=r[c];const v=$.block;$=$.shadow,v&&t(v),$&&t($)}i.next&&(c=i.next,i=c.block,c=c.shadow,i&&t(i),c&&t(c))}}return e=JSON.parse(JSON.stringify(e)),t(e),Object.assign({},{kind:"BLOCK"},e)}},Qr=47,uu=44,qr=16,IE=20,WS=20,du=10,K$=0,Q$=32,zS=.1,XS=80,jS=4,OE=.4,YS=.8,CE=45,KS="10.1.3",QS=s.Align$$module$build$src$core$inputs$align.LEFT,qS=s.Align$$module$build$src$core$inputs$align.CENTRE,JS=s.Align$$module$build$src$core$inputs$align.RIGHT,ZS=qe.INPUT_VALUE,e9=qe.OUTPUT_VALUE,t9=qe.NEXT_STATEMENT,o9=qe.PREVIOUS_STATEMENT,s9=s.inputTypes$$module$build$src$core$inputs$input_types.DUMMY,i9=at.TOP,n9=at.BOTTOM,r9=at.LEFT,l9=at.RIGHT;dc.prototype.newBlock=function(e,t){return new Hr(this,e,t)},Cs.prototype.newBlock=function(e,t){return new ts(this,e,t)},Cs.newTrashcan=function(e){return new vE(e)},yo.prototype.showContextMenu=function(e){if(!this.workspace.options.readOnly){var t=[];this.isDeletable()&&this.isMovable()&&(t.push(wh(this)),t.push(Nh(this))),wl(e,t,this.RTL)}},gi.prototype.newWorkspaceSvg=function(e){return new Cs(e)},s.Names$$module$build$src$core$names.prototype.populateProcedures=function(e){e=ga(e),e=e[0].concat(e[1]);for(let t=0;tl.Msg$$module$build$src$core$msg.LISTS_INDEX_OF_TOOLTIP.replace("%1",this.workspace.options.oneBasedIndex?"0":"-1"))}};d.lists_indexOf=T;var C={init:function(){var g=[[l.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_GET,"GET"],[l.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_GET_REMOVE,"GET_REMOVE"],[l.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_REMOVE,"REMOVE"]];this.WHERE_OPTIONS=[[l.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_FROM_START,"FROM_START"],[l.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_FROM_END,"FROM_END"],[l.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_FIRST,"FIRST"],[l.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_LAST,"LAST"],[l.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_RANDOM,"RANDOM"]],this.setHelpUrl(l.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_HELPURL),this.setStyle("list_blocks"),g=l.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:g}),g.setValidator(function(k){k=k==="REMOVE",this.getSourceBlock().updateStatement_(k)}),this.appendValueInput("VALUE").setCheck("Array").appendField(l.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_INPUT_IN_LIST),this.appendDummyInput().appendField(g,"MODE").appendField("","SPACE"),this.appendDummyInput("AT"),l.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TAIL&&this.appendDummyInput("TAIL").appendField(l.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TAIL),this.setInputsInline(!0),this.setOutput(!0),this.updateAt_(!0),this.setTooltip(()=>{const k=this.getFieldValue("MODE"),W=this.getFieldValue("WHERE");let J="";switch(k+" "+W){case"GET FROM_START":case"GET FROM_END":J=l.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_GET_FROM;break;case"GET FIRST":J=l.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_GET_FIRST;break;case"GET LAST":J=l.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_GET_LAST;break;case"GET RANDOM":J=l.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_GET_RANDOM;break;case"GET_REMOVE FROM_START":case"GET_REMOVE FROM_END":J=l.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM;break;case"GET_REMOVE FIRST":J=l.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FIRST;break;case"GET_REMOVE LAST":J=l.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_LAST;break;case"GET_REMOVE RANDOM":J=l.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_RANDOM;break;case"REMOVE FROM_START":case"REMOVE FROM_END":J=l.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_FROM;break;case"REMOVE FIRST":J=l.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_FIRST;break;case"REMOVE LAST":J=l.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_LAST;break;case"REMOVE RANDOM":J=l.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_RANDOM}return(W==="FROM_START"||W==="FROM_END")&&(J+=" "+(W==="FROM_START"?l.Msg$$module$build$src$core$msg.LISTS_INDEX_FROM_START_TOOLTIP:l.Msg$$module$build$src$core$msg.LISTS_INDEX_FROM_END_TOOLTIP).replace("%1",this.workspace.options.oneBasedIndex?"#1":"#0")),J})},mutationToDom:function(){const g=l.createElement$$module$build$src$core$utils$xml("mutation");g.setAttribute("statement",String(!this.outputConnection));const k=this.getInput("AT")instanceof l.ValueInput$$module$build$src$core$inputs$value_input;return g.setAttribute("at",String(k)),g},domToMutation:function(g){const k=g.getAttribute("statement")==="true";this.updateStatement_(k),g=g.getAttribute("at")!=="false",this.updateAt_(g)},saveExtraState:function(){return this.outputConnection?null:{isStatement:!0}},loadExtraState:function(g){g.isStatement?this.updateStatement_(!0):typeof g=="string"&&this.domToMutation(l.textToDom$$module$build$src$core$utils$xml(g))},updateStatement_:function(g){g!==!this.outputConnection&&(this.unplug(!0,!0),g?(this.setOutput(!1),this.setPreviousStatement(!0),this.setNextStatement(!0)):(this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0)))},updateAt_:function(g){this.removeInput("AT"),this.removeInput("ORDINAL",!0),g?(this.appendValueInput("AT").setCheck("Number"),l.Msg$$module$build$src$core$msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL").appendField(l.Msg$$module$build$src$core$msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT");const k=l.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:this.WHERE_OPTIONS});k.setValidator(function(W){const J=W==="FROM_START"||W==="FROM_END";if(J!==g){const Ee=this.getSourceBlock();return Ee.updateAt_(J),Ee.setFieldValue(W,"WHERE"),null}}),this.getInput("AT").appendField(k,"WHERE"),l.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TAIL&&this.moveInputBefore("TAIL",null)}};d.lists_getIndex=C;var S={init:function(){var g=[[l.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_SET,"SET"],[l.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_INSERT,"INSERT"]];this.WHERE_OPTIONS=[[l.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_FROM_START,"FROM_START"],[l.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_FROM_END,"FROM_END"],[l.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_FIRST,"FIRST"],[l.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_LAST,"LAST"],[l.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_RANDOM,"RANDOM"]],this.setHelpUrl(l.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_HELPURL),this.setStyle("list_blocks"),this.appendValueInput("LIST").setCheck("Array").appendField(l.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_INPUT_IN_LIST),g=l.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:g}),this.appendDummyInput().appendField(g,"MODE").appendField("","SPACE"),this.appendDummyInput("AT"),this.appendValueInput("TO").appendField(l.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_INPUT_TO),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(l.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP),this.updateAt_(!0),this.setTooltip(()=>{const k=this.getFieldValue("MODE"),W=this.getFieldValue("WHERE");let J="";switch(k+" "+W){case"SET FROM_START":case"SET FROM_END":J=l.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP_SET_FROM;break;case"SET FIRST":J=l.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP_SET_FIRST;break;case"SET LAST":J=l.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP_SET_LAST;break;case"SET RANDOM":J=l.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP_SET_RANDOM;break;case"INSERT FROM_START":case"INSERT FROM_END":J=l.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FROM;break;case"INSERT FIRST":J=l.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FIRST;break;case"INSERT LAST":J=l.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP_INSERT_LAST;break;case"INSERT RANDOM":J=l.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP_INSERT_RANDOM}return(W==="FROM_START"||W==="FROM_END")&&(J+=" "+l.Msg$$module$build$src$core$msg.LISTS_INDEX_FROM_START_TOOLTIP.replace("%1",this.workspace.options.oneBasedIndex?"#1":"#0")),J})},mutationToDom:function(){const g=l.createElement$$module$build$src$core$utils$xml("mutation"),k=this.getInput("AT")instanceof l.ValueInput$$module$build$src$core$inputs$value_input;return g.setAttribute("at",String(k)),g},domToMutation:function(g){g=g.getAttribute("at")!=="false",this.updateAt_(g)},saveExtraState:function(){return null},loadExtraState:function(){},updateAt_:function(g){this.removeInput("AT"),this.removeInput("ORDINAL",!0),g?(this.appendValueInput("AT").setCheck("Number"),l.Msg$$module$build$src$core$msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL").appendField(l.Msg$$module$build$src$core$msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT");const k=l.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:this.WHERE_OPTIONS});k.setValidator(function(W){const J=W==="FROM_START"||W==="FROM_END";if(J!==g){const Ee=this.getSourceBlock();return Ee.updateAt_(J),Ee.setFieldValue(W,"WHERE"),null}}),this.moveInputBefore("AT","TO"),this.getInput("ORDINAL")&&this.moveInputBefore("ORDINAL","TO"),this.getInput("AT").appendField(k,"WHERE")}};d.lists_setIndex=S;var P={init:function(){this.WHERE_OPTIONS_1=[[l.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_START_FROM_START,"FROM_START"],[l.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_START_FROM_END,"FROM_END"],[l.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_START_FIRST,"FIRST"]],this.WHERE_OPTIONS_2=[[l.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_END_FROM_START,"FROM_START"],[l.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_END_FROM_END,"FROM_END"],[l.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_END_LAST,"LAST"]],this.setHelpUrl(l.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_HELPURL),this.setStyle("list_blocks"),this.appendValueInput("LIST").setCheck("Array").appendField(l.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_INPUT_IN_LIST),this.appendDummyInput("AT1"),this.appendDummyInput("AT2"),l.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_TAIL&&this.appendDummyInput("TAIL").appendField(l.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_TAIL),this.setInputsInline(!0),this.setOutput(!0,"Array"),this.updateAt_(1,!0),this.updateAt_(2,!0),this.setTooltip(l.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_TOOLTIP)},mutationToDom:function(){const g=l.createElement$$module$build$src$core$utils$xml("mutation");var k=this.getInput("AT1")instanceof l.ValueInput$$module$build$src$core$inputs$value_input;return g.setAttribute("at1",String(k)),k=this.getInput("AT2")instanceof l.ValueInput$$module$build$src$core$inputs$value_input,g.setAttribute("at2",String(k)),g},domToMutation:function(g){const k=g.getAttribute("at1")==="true";g=g.getAttribute("at2")==="true",this.updateAt_(1,k),this.updateAt_(2,g)},saveExtraState:function(){return null},loadExtraState:function(){},updateAt_:function(g,k){this.removeInput("AT"+g),this.removeInput("ORDINAL"+g,!0),k?(this.appendValueInput("AT"+g).setCheck("Number"),l.Msg$$module$build$src$core$msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL"+g).appendField(l.Msg$$module$build$src$core$msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT"+g);const W=l.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:this["WHERE_OPTIONS_"+g]});W.setValidator(function(J){const Ee=J==="FROM_START"||J==="FROM_END";if(Ee!==k){const ze=this.getSourceBlock();return ze.updateAt_(g,Ee),ze.setFieldValue(J,"WHERE"+g),null}}),this.getInput("AT"+g).appendField(W,"WHERE"+g),g===1&&(this.moveInputBefore("AT1","AT2"),this.getInput("ORDINAL1")&&this.moveInputBefore("ORDINAL1","AT2")),l.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_TAIL&&this.moveInputBefore("TAIL",null)}};d.lists_getSublist=P,d.lists_sort={init:function(){this.jsonInit({message0:"%{BKY_LISTS_SORT_TITLE}",args0:[{type:"field_dropdown",name:"TYPE",options:[["%{BKY_LISTS_SORT_TYPE_NUMERIC}","NUMERIC"],["%{BKY_LISTS_SORT_TYPE_TEXT}","TEXT"],["%{BKY_LISTS_SORT_TYPE_IGNORECASE}","IGNORE_CASE"]]},{type:"field_dropdown",name:"DIRECTION",options:[["%{BKY_LISTS_SORT_ORDER_ASCENDING}","1"],["%{BKY_LISTS_SORT_ORDER_DESCENDING}","-1"]]},{type:"input_value",name:"LIST",check:"Array"}],output:"Array",style:"list_blocks",tooltip:"%{BKY_LISTS_SORT_TOOLTIP}",helpUrl:"%{BKY_LISTS_SORT_HELPURL}"})}},d.lists_split={init:function(){const g=l.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:[[l.Msg$$module$build$src$core$msg.LISTS_SPLIT_LIST_FROM_TEXT,"SPLIT"],[l.Msg$$module$build$src$core$msg.LISTS_SPLIT_TEXT_FROM_LIST,"JOIN"]]});if(!g)throw Error("field_dropdown not found");g.setValidator(k=>{this.updateType_(k)}),this.setHelpUrl(l.Msg$$module$build$src$core$msg.LISTS_SPLIT_HELPURL),this.setStyle("list_blocks"),this.appendValueInput("INPUT").setCheck("String").appendField(g,"MODE"),this.appendValueInput("DELIM").setCheck("String").appendField(l.Msg$$module$build$src$core$msg.LISTS_SPLIT_WITH_DELIMITER),this.setInputsInline(!0),this.setOutput(!0,"Array"),this.setTooltip(()=>{const k=this.getFieldValue("MODE");if(k==="SPLIT")return l.Msg$$module$build$src$core$msg.LISTS_SPLIT_TOOLTIP_SPLIT;if(k==="JOIN")return l.Msg$$module$build$src$core$msg.LISTS_SPLIT_TOOLTIP_JOIN;throw Error("Unknown mode: "+k)})},updateType_:function(g){if(this.getFieldValue("MODE")!==g){const k=this.getInput("INPUT").connection;k.setShadowDom(null);const W=k.targetBlock();W&&(k.disconnect(),W.isShadow()?W.dispose(!1):this.bumpNeighbours())}g==="SPLIT"?(this.outputConnection.setCheck("Array"),this.getInput("INPUT").setCheck("String")):(this.outputConnection.setCheck("String"),this.getInput("INPUT").setCheck("Array"))},mutationToDom:function(){const g=l.createElement$$module$build$src$core$utils$xml("mutation");return g.setAttribute("mode",this.getFieldValue("MODE")),g},domToMutation:function(g){this.updateType_(g.getAttribute("mode"))},saveExtraState:function(){return null},loadExtraState:function(){}},l.defineBlocks$$module$build$src$core$common(d);var x={};x.blocks=d;var G=l.createBlockDefinitionsFromJsonArray$$module$build$src$core$common([{type:"logic_boolean",message0:"%1",args0:[{type:"field_dropdown",name:"BOOL",options:[["%{BKY_LOGIC_BOOLEAN_TRUE}","TRUE"],["%{BKY_LOGIC_BOOLEAN_FALSE}","FALSE"]]}],output:"Boolean",style:"logic_blocks",tooltip:"%{BKY_LOGIC_BOOLEAN_TOOLTIP}",helpUrl:"%{BKY_LOGIC_BOOLEAN_HELPURL}"},{type:"controls_if",message0:"%{BKY_CONTROLS_IF_MSG_IF} %1",args0:[{type:"input_value",name:"IF0",check:"Boolean"}],message1:"%{BKY_CONTROLS_IF_MSG_THEN} %1",args1:[{type:"input_statement",name:"DO0"}],previousStatement:null,nextStatement:null,style:"logic_blocks",helpUrl:"%{BKY_CONTROLS_IF_HELPURL}",suppressPrefixSuffix:!0,mutator:"controls_if_mutator",extensions:["controls_if_tooltip"]},{type:"controls_ifelse",message0:"%{BKY_CONTROLS_IF_MSG_IF} %1",args0:[{type:"input_value",name:"IF0",check:"Boolean"}],message1:"%{BKY_CONTROLS_IF_MSG_THEN} %1",args1:[{type:"input_statement",name:"DO0"}],message2:"%{BKY_CONTROLS_IF_MSG_ELSE} %1",args2:[{type:"input_statement",name:"ELSE"}],previousStatement:null,nextStatement:null,style:"logic_blocks",tooltip:"%{BKYCONTROLS_IF_TOOLTIP_2}",helpUrl:"%{BKY_CONTROLS_IF_HELPURL}",suppressPrefixSuffix:!0,extensions:["controls_if_tooltip"]},{type:"logic_compare",message0:"%1 %2 %3",args0:[{type:"input_value",name:"A"},{type:"field_dropdown",name:"OP",options:[["=","EQ"],["≠","NEQ"],["<","LT"],["≤","LTE"],[">","GT"],["≥","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"]},{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}"}]),oe={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}"};l.register$$module$build$src$core$extensions("logic_op_tooltip",l.buildTooltipForDropdown$$module$build$src$core$extensions("OP",oe));var ne={elseifCount_:0,elseCount_:0,mutationToDom:function(){if(!this.elseifCount_&&!this.elseCount_)return null;const g=l.createElement$$module$build$src$core$utils$xml("mutation");return this.elseifCount_&&g.setAttribute("elseif",String(this.elseifCount_)),this.elseCount_&&g.setAttribute("else","1"),g},domToMutation:function(g){this.elseifCount_=parseInt(g.getAttribute("elseif"),10)||0,this.elseCount_=parseInt(g.getAttribute("else"),10)||0,this.rebuildShape_()},saveExtraState:function(){if(!this.elseifCount_&&!this.elseCount_)return null;const g=Object.create(null);return this.elseifCount_&&(g.elseIfCount=this.elseifCount_),this.elseCount_&&(g.hasElse=!0),g},loadExtraState:function(g){this.elseifCount_=g.elseIfCount||0,this.elseCount_=g.hasElse?1:0,this.updateShape_()},decompose:function(g){const k=g.newBlock("controls_if_if");k.initSvg();let W=k.nextConnection;for(let J=1;J<=this.elseifCount_;J++){const Ee=g.newBlock("controls_if_elseif");Ee.initSvg(),W.connect(Ee.previousConnection),W=Ee.nextConnection}return this.elseCount_&&(g=g.newBlock("controls_if_else"),g.initSvg(),W.connect(g.previousConnection)),k},compose:function(g){g=g.nextConnection.targetBlock(),this.elseCount_=this.elseifCount_=0;const k=[null],W=[null];let J=null;for(;g;){if(!g.isInsertionMarker())switch(g.type){case"controls_if_elseif":this.elseifCount_++,k.push(g.valueConnection_),W.push(g.statementConnection_);break;case"controls_if_else":this.elseCount_++,J=g.statementConnection_;break;default:throw TypeError("Unknown block type: "+g.type)}g=g.getNextBlock()}this.updateShape_(),this.reconnectChildBlocks_(k,W,J)},saveConnections:function(g){g=g.nextConnection.targetBlock();let k=1;for(;g;){if(!g.isInsertionMarker())switch(g.type){case"controls_if_elseif":var W=this.getInput("IF"+k);const J=this.getInput("DO"+k);g.valueConnection_=W&&W.connection.targetConnection,g.statementConnection_=J&&J.connection.targetConnection,k++;break;case"controls_if_else":W=this.getInput("ELSE"),g.statementConnection_=W&&W.connection.targetConnection;break;default:throw TypeError("Unknown block type: "+g.type)}g=g.getNextBlock()}},rebuildShape_:function(){const g=[null],k=[null];let W=null;this.getInput("ELSE")&&(W=this.getInput("ELSE").connection.targetConnection);for(let J=1;this.getInput("IF"+J);J++){const Ee=this.getInput("IF"+J),ze=this.getInput("DO"+J);g.push(Ee.connection.targetConnection),k.push(ze.connection.targetConnection)}this.updateShape_(),this.reconnectChildBlocks_(g,k,W)},updateShape_:function(){this.getInput("ELSE")&&this.removeInput("ELSE");for(var g=1;this.getInput("IF"+g);g++)this.removeInput("IF"+g),this.removeInput("DO"+g);for(g=1;g<=this.elseifCount_;g++)this.appendValueInput("IF"+g).setCheck("Boolean").appendField(l.Msg$$module$build$src$core$msg.CONTROLS_IF_MSG_ELSEIF),this.appendStatementInput("DO"+g).appendField(l.Msg$$module$build$src$core$msg.CONTROLS_IF_MSG_THEN);this.elseCount_&&this.appendStatementInput("ELSE").appendField(l.Msg$$module$build$src$core$msg.CONTROLS_IF_MSG_ELSE)},reconnectChildBlocks_:function(g,k,W){for(let J=1;J<=this.elseifCount_;J++){let Ee;(Ee=g[J])==null||Ee.reconnect(this,"IF"+J);let ze;(ze=k[J])==null||ze.reconnect(this,"DO"+J)}W==null||W.reconnect(this,"ELSE")}};l.registerMutator$$module$build$src$core$extensions("controls_if_mutator",ne,null,["controls_if_elseif","controls_if_else"]);var Z=function(){this.setTooltip((function(){if(this.elseifCount_||this.elseCount_){if(!this.elseifCount_&&this.elseCount_)return l.Msg$$module$build$src$core$msg.CONTROLS_IF_TOOLTIP_2;if(this.elseifCount_&&!this.elseCount_)return l.Msg$$module$build$src$core$msg.CONTROLS_IF_TOOLTIP_3;if(this.elseifCount_&&this.elseCount_)return l.Msg$$module$build$src$core$msg.CONTROLS_IF_TOOLTIP_4}else return l.Msg$$module$build$src$core$msg.CONTROLS_IF_TOOLTIP_1;return""}).bind(this))};l.register$$module$build$src$core$extensions("controls_if_tooltip",Z);var Y={onchange:function(g){this.prevBlocks_||(this.prevBlocks_=[null,null]);var k=this.getInputTargetBlock("A");const W=this.getInputTargetBlock("B");k&&W&&!this.workspace.connectionChecker.doTypeChecks(k.outputConnection,W.outputConnection)&&(l.setGroup$$module$build$src$core$events$utils(g.group),g=this.prevBlocks_[0],g!==k&&(k.unplug(),!g||g.isDisposed()||g.isShadow()||this.getInput("A").connection.connect(g.outputConnection)),k=this.prevBlocks_[1],k!==W&&(W.unplug(),!k||k.isDisposed()||k.isShadow()||this.getInput("B").connection.connect(k.outputConnection)),this.bumpNeighbours(),l.setGroup$$module$build$src$core$events$utils(!1)),this.prevBlocks_[0]=this.getInputTargetBlock("A"),this.prevBlocks_[1]=this.getInputTargetBlock("B")}},M=function(){this.mixin(Y)};l.register$$module$build$src$core$extensions("logic_compare",M);var L={prevParentConnection_:null,onchange:function(g){const k=this.getInputTargetBlock("THEN"),W=this.getInputTargetBlock("ELSE"),J=this.outputConnection.targetConnection;if((k||W)&&J)for(let Ee=0;2>Ee;Ee++){const ze=Ee===1?k:W;ze&&!ze.workspace.connectionChecker.doTypeChecks(ze.outputConnection,J)&&(l.setGroup$$module$build$src$core$events$utils(g.group),J===this.prevParentConnection_?(this.unplug(),J.getSourceBlock().bumpNeighbours()):(ze.unplug(),ze.bumpNeighbours()),l.setGroup$$module$build$src$core$events$utils(!1))}this.prevParentConnection_=J}};l.registerMixin$$module$build$src$core$extensions("logic_ternary",L),l.defineBlocks$$module$build$src$core$common(G);var R=l.createBlockDefinitionsFromJsonArray$$module$build$src$core$common([{type:"controls_repeat_ext",message0:"%{BKY_CONTROLS_REPEAT_TITLE}",args0:[{type:"input_value",name:"TIMES",check:"Number"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",tooltip:"%{BKY_CONTROLS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_CONTROLS_REPEAT_HELPURL}"},{type:"controls_repeat",message0:"%{BKY_CONTROLS_REPEAT_TITLE}",args0:[{type:"field_number",name:"TIMES",value:10,min:0,precision:1}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",tooltip:"%{BKY_CONTROLS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_CONTROLS_REPEAT_HELPURL}"},{type:"controls_whileUntil",message0:"%1 %2",args0:[{type:"field_dropdown",name:"MODE",options:[["%{BKY_CONTROLS_WHILEUNTIL_OPERATOR_WHILE}","WHILE"],["%{BKY_CONTROLS_WHILEUNTIL_OPERATOR_UNTIL}","UNTIL"]]},{type:"input_value",name:"BOOL",check:"Boolean"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_WHILEUNTIL_HELPURL}",extensions:["controls_whileUntil_tooltip"]},{type:"controls_for",message0:"%{BKY_CONTROLS_FOR_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:null},{type:"input_value",name:"FROM",check:"Number",align:"RIGHT"},{type:"input_value",name:"TO",check:"Number",align:"RIGHT"},{type:"input_value",name:"BY",check:"Number",align:"RIGHT"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],inputsInline:!0,previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FOR_HELPURL}",extensions:["contextMenu_newGetVariableBlock","controls_for_tooltip"]},{type:"controls_forEach",message0:"%{BKY_CONTROLS_FOREACH_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:null},{type:"input_value",name:"LIST",check:"Array"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FOREACH_HELPURL}",extensions:["contextMenu_newGetVariableBlock","controls_forEach_tooltip"]},{type:"controls_flow_statements",message0:"%1",args0:[{type:"field_dropdown",name:"FLOW",options:[["%{BKY_CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK}","BREAK"],["%{BKY_CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE}","CONTINUE"]]}],previousStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FLOW_STATEMENTS_HELPURL}",suppressPrefixSuffix:!0,extensions:["controls_flow_tooltip","controls_flow_in_loop_check"]}]),F={WHILE:"%{BKY_CONTROLS_WHILEUNTIL_TOOLTIP_WHILE}",UNTIL:"%{BKY_CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL}"};l.register$$module$build$src$core$extensions("controls_whileUntil_tooltip",l.buildTooltipForDropdown$$module$build$src$core$extensions("MODE",F));var z={BREAK:"%{BKY_CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK}",CONTINUE:"%{BKY_CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE}"};l.register$$module$build$src$core$extensions("controls_flow_tooltip",l.buildTooltipForDropdown$$module$build$src$core$extensions("FLOW",z));var X={customContextMenu:function(g){if(!this.isInFlyout){var k=this.getField("VAR").getVariable(),W=k.name;if(!this.isCollapsed()&&W!==null){k=l.generateVariableFieldDom$$module$build$src$core$variables(k);const J=l.createElement$$module$build$src$core$utils$xml("block");J.setAttribute("type","variables_get"),J.appendChild(k),g.push({enabled:!0,text:l.Msg$$module$build$src$core$msg.VARIABLES_SET_CREATE_GET.replace("%1",W),callback:l.callbackFactory$$module$build$src$core$contextmenu(this,J)})}}}};l.registerMixin$$module$build$src$core$extensions("contextMenu_newGetVariableBlock",X),l.register$$module$build$src$core$extensions("controls_for_tooltip",l.buildTooltipWithFieldText$$module$build$src$core$extensions("%{BKY_CONTROLS_FOR_TOOLTIP}","VAR")),l.register$$module$build$src$core$extensions("controls_forEach_tooltip",l.buildTooltipWithFieldText$$module$build$src$core$extensions("%{BKY_CONTROLS_FOREACH_TOOLTIP}","VAR"));var le=new Set(["controls_repeat","controls_repeat_ext","controls_forEach","controls_for","controls_whileUntil"]),$e={getSurroundLoop:function(){let g=this;do{if(le.has(g.type))return g;g=g.getSurroundParent()}while(g);return null},onchange:function(g){var k=this.workspace;if(k.isDragging&&!k.isDragging()&&g.type===l.MOVE$$module$build$src$core$events$utils&&(k=!!this.getSurroundLoop(),this.setWarningText(k?null:l.Msg$$module$build$src$core$msg.CONTROLS_FLOW_STATEMENTS_WARNING),!this.isInFlyout)){const W=l.getGroup$$module$build$src$core$events$utils();l.setGroup$$module$build$src$core$events$utils(g.group),this.setEnabled(k),l.setGroup$$module$build$src$core$events$utils(W)}}};l.registerMixin$$module$build$src$core$extensions("controls_flow_in_loop_check",$e),l.defineBlocks$$module$build$src$core$common(R);var he={};he.blocks=R,he.loopTypes=le;var fe=l.createBlockDefinitionsFromJsonArray$$module$build$src$core$common([{type:"math_number",message0:"%1",args0:[{type:"field_number",name:"NUM",value:0}],output:"Number",helpUrl:"%{BKY_MATH_NUMBER_HELPURL}",style:"math_blocks",tooltip:"%{BKY_MATH_NUMBER_TOOLTIP}",extensions:["parent_tooltip_when_inline"]},{type:"math_arithmetic",message0:"%1 %2 %3",args0:[{type:"input_value",name:"A",check:"Number"},{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ADDITION_SYMBOL}","ADD"],["%{BKY_MATH_SUBTRACTION_SYMBOL}","MINUS"],["%{BKY_MATH_MULTIPLICATION_SYMBOL}","MULTIPLY"],["%{BKY_MATH_DIVISION_SYMBOL}","DIVIDE"],["%{BKY_MATH_POWER_SYMBOL}","POWER"]]},{type:"input_value",name:"B",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_ARITHMETIC_HELPURL}",extensions:["math_op_tooltip"]},{type:"math_single",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_SINGLE_OP_ROOT}","ROOT"],["%{BKY_MATH_SINGLE_OP_ABSOLUTE}","ABS"],["-","NEG"],["ln","LN"],["log10","LOG10"],["e^","EXP"],["10^","POW10"]]},{type:"input_value",name:"NUM",check:"Number"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_SINGLE_HELPURL}",extensions:["math_op_tooltip"]},{type:"math_trig",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_TRIG_SIN}","SIN"],["%{BKY_MATH_TRIG_COS}","COS"],["%{BKY_MATH_TRIG_TAN}","TAN"],["%{BKY_MATH_TRIG_ASIN}","ASIN"],["%{BKY_MATH_TRIG_ACOS}","ACOS"],["%{BKY_MATH_TRIG_ATAN}","ATAN"]]},{type:"input_value",name:"NUM",check:"Number"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_TRIG_HELPURL}",extensions:["math_op_tooltip"]},{type:"math_constant",message0:"%1",args0:[{type:"field_dropdown",name:"CONSTANT",options:[["π","PI"],["e","E"],["φ","GOLDEN_RATIO"],["sqrt(2)","SQRT2"],["sqrt(½)","SQRT1_2"],["∞","INFINITY"]]}],output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_CONSTANT_TOOLTIP}",helpUrl:"%{BKY_MATH_CONSTANT_HELPURL}"},{type:"math_number_property",message0:"%1 %2",args0:[{type:"input_value",name:"NUMBER_TO_CHECK",check:"Number"},{type:"field_dropdown",name:"PROPERTY",options:[["%{BKY_MATH_IS_EVEN}","EVEN"],["%{BKY_MATH_IS_ODD}","ODD"],["%{BKY_MATH_IS_PRIME}","PRIME"],["%{BKY_MATH_IS_WHOLE}","WHOLE"],["%{BKY_MATH_IS_POSITIVE}","POSITIVE"],["%{BKY_MATH_IS_NEGATIVE}","NEGATIVE"],["%{BKY_MATH_IS_DIVISIBLE_BY}","DIVISIBLE_BY"]]}],inputsInline:!0,output:"Boolean",style:"math_blocks",tooltip:"%{BKY_MATH_IS_TOOLTIP}",mutator:"math_is_divisibleby_mutator"},{type:"math_change",message0:"%{BKY_MATH_CHANGE_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_MATH_CHANGE_TITLE_ITEM}"},{type:"input_value",name:"DELTA",check:"Number"}],previousStatement:null,nextStatement:null,style:"variable_blocks",helpUrl:"%{BKY_MATH_CHANGE_HELPURL}",extensions:["math_change_tooltip"]},{type:"math_round",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ROUND_OPERATOR_ROUND}","ROUND"],["%{BKY_MATH_ROUND_OPERATOR_ROUNDUP}","ROUNDUP"],["%{BKY_MATH_ROUND_OPERATOR_ROUNDDOWN}","ROUNDDOWN"]]},{type:"input_value",name:"NUM",check:"Number"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_ROUND_HELPURL}",tooltip:"%{BKY_MATH_ROUND_TOOLTIP}"},{type:"math_on_list",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ONLIST_OPERATOR_SUM}","SUM"],["%{BKY_MATH_ONLIST_OPERATOR_MIN}","MIN"],["%{BKY_MATH_ONLIST_OPERATOR_MAX}","MAX"],["%{BKY_MATH_ONLIST_OPERATOR_AVERAGE}","AVERAGE"],["%{BKY_MATH_ONLIST_OPERATOR_MEDIAN}","MEDIAN"],["%{BKY_MATH_ONLIST_OPERATOR_MODE}","MODE"],["%{BKY_MATH_ONLIST_OPERATOR_STD_DEV}","STD_DEV"],["%{BKY_MATH_ONLIST_OPERATOR_RANDOM}","RANDOM"]]},{type:"input_value",name:"LIST",check:"Array"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_ONLIST_HELPURL}",mutator:"math_modes_of_list_mutator",extensions:["math_op_tooltip"]},{type:"math_modulo",message0:"%{BKY_MATH_MODULO_TITLE}",args0:[{type:"input_value",name:"DIVIDEND",check:"Number"},{type:"input_value",name:"DIVISOR",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_MODULO_TOOLTIP}",helpUrl:"%{BKY_MATH_MODULO_HELPURL}"},{type:"math_constrain",message0:"%{BKY_MATH_CONSTRAIN_TITLE}",args0:[{type:"input_value",name:"VALUE",check:"Number"},{type:"input_value",name:"LOW",check:"Number"},{type:"input_value",name:"HIGH",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_CONSTRAIN_TOOLTIP}",helpUrl:"%{BKY_MATH_CONSTRAIN_HELPURL}"},{type:"math_random_int",message0:"%{BKY_MATH_RANDOM_INT_TITLE}",args0:[{type:"input_value",name:"FROM",check:"Number"},{type:"input_value",name:"TO",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_RANDOM_INT_TOOLTIP}",helpUrl:"%{BKY_MATH_RANDOM_INT_HELPURL}"},{type:"math_random_float",message0:"%{BKY_MATH_RANDOM_FLOAT_TITLE_RANDOM}",output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_RANDOM_FLOAT_TOOLTIP}",helpUrl:"%{BKY_MATH_RANDOM_FLOAT_HELPURL}"},{type:"math_atan2",message0:"%{BKY_MATH_ATAN2_TITLE}",args0:[{type:"input_value",name:"X",check:"Number"},{type:"input_value",name:"Y",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_ATAN2_TOOLTIP}",helpUrl:"%{BKY_MATH_ATAN2_HELPURL}"}]),ke={ADD:"%{BKY_MATH_ARITHMETIC_TOOLTIP_ADD}",MINUS:"%{BKY_MATH_ARITHMETIC_TOOLTIP_MINUS}",MULTIPLY:"%{BKY_MATH_ARITHMETIC_TOOLTIP_MULTIPLY}",DIVIDE:"%{BKY_MATH_ARITHMETIC_TOOLTIP_DIVIDE}",POWER:"%{BKY_MATH_ARITHMETIC_TOOLTIP_POWER}",ROOT:"%{BKY_MATH_SINGLE_TOOLTIP_ROOT}",ABS:"%{BKY_MATH_SINGLE_TOOLTIP_ABS}",NEG:"%{BKY_MATH_SINGLE_TOOLTIP_NEG}",LN:"%{BKY_MATH_SINGLE_TOOLTIP_LN}",LOG10:"%{BKY_MATH_SINGLE_TOOLTIP_LOG10}",EXP:"%{BKY_MATH_SINGLE_TOOLTIP_EXP}",POW10:"%{BKY_MATH_SINGLE_TOOLTIP_POW10}",SIN:"%{BKY_MATH_TRIG_TOOLTIP_SIN}",COS:"%{BKY_MATH_TRIG_TOOLTIP_COS}",TAN:"%{BKY_MATH_TRIG_TOOLTIP_TAN}",ASIN:"%{BKY_MATH_TRIG_TOOLTIP_ASIN}",ACOS:"%{BKY_MATH_TRIG_TOOLTIP_ACOS}",ATAN:"%{BKY_MATH_TRIG_TOOLTIP_ATAN}",SUM:"%{BKY_MATH_ONLIST_TOOLTIP_SUM}",MIN:"%{BKY_MATH_ONLIST_TOOLTIP_MIN}",MAX:"%{BKY_MATH_ONLIST_TOOLTIP_MAX}",AVERAGE:"%{BKY_MATH_ONLIST_TOOLTIP_AVERAGE}",MEDIAN:"%{BKY_MATH_ONLIST_TOOLTIP_MEDIAN}",MODE:"%{BKY_MATH_ONLIST_TOOLTIP_MODE}",STD_DEV:"%{BKY_MATH_ONLIST_TOOLTIP_STD_DEV}",RANDOM:"%{BKY_MATH_ONLIST_TOOLTIP_RANDOM}"};l.register$$module$build$src$core$extensions("math_op_tooltip",l.buildTooltipForDropdown$$module$build$src$core$extensions("OP",ke));var re={mutationToDom:function(){const g=l.createElement$$module$build$src$core$utils$xml("mutation"),k=this.getFieldValue("PROPERTY")==="DIVISIBLE_BY";return g.setAttribute("divisor_input",String(k)),g},domToMutation:function(g){g=g.getAttribute("divisor_input")==="true",this.updateShape_(g)},updateShape_:function(g){const k=this.getInput("DIVISOR");g?k||this.appendValueInput("DIVISOR").setCheck("Number"):k&&this.removeInput("DIVISOR")}},Ie=function(){this.getField("PROPERTY").setValidator(function(g){g=g==="DIVISIBLE_BY",this.getSourceBlock().updateShape_(g)})};l.registerMutator$$module$build$src$core$extensions("math_is_divisibleby_mutator",re,Ie),l.register$$module$build$src$core$extensions("math_change_tooltip",l.buildTooltipWithFieldText$$module$build$src$core$extensions("%{BKY_MATH_CHANGE_TOOLTIP}","VAR"));var D={updateType_:function(g){g==="MODE"?this.outputConnection.setCheck("Array"):this.outputConnection.setCheck("Number")},mutationToDom:function(){const g=l.createElement$$module$build$src$core$utils$xml("mutation");return g.setAttribute("op",this.getFieldValue("OP")),g},domToMutation:function(g){if(g=g.getAttribute("op"),g===null)throw new TypeError("xmlElement had no op attribute");this.updateType_(g)}},B=function(){this.getField("OP").setValidator((function(g){this.updateType_(g)}).bind(this))};l.registerMutator$$module$build$src$core$extensions("math_modes_of_list_mutator",D,B),l.defineBlocks$$module$build$src$core$common(fe);var ae={};ae.blocks=fe;var _e={},Me={setStatements_:function(g){this.hasStatements_!==g&&(g?(this.appendStatementInput("STACK").appendField(l.Msg$$module$build$src$core$msg.PROCEDURES_DEFNORETURN_DO),this.getInput("RETURN")&&this.moveInputBefore("STACK","RETURN")):this.removeInput("STACK",!0),this.hasStatements_=g)},updateParams_:function(){let g="";this.arguments_.length&&(g=l.Msg$$module$build$src$core$msg.PROCEDURES_BEFORE_PARAMS+" "+this.arguments_.join(", ")),l.disable$$module$build$src$core$events$utils();try{this.setFieldValue(g,"PARAMS")}finally{l.enable$$module$build$src$core$events$utils()}},mutationToDom:function(g){const k=l.createElement$$module$build$src$core$utils$xml("mutation");g&&k.setAttribute("name",this.getFieldValue("NAME"));for(let W=0;W{this.updateType_(k)}),this.appendValueInput("TEXT").appendField(g,"TYPE"),this.setOutput(!0,"String"),this.setTooltip(()=>this.getFieldValue("TYPE")==="TEXT"?l.Msg$$module$build$src$core$msg.TEXT_PROMPT_TOOLTIP_TEXT:l.Msg$$module$build$src$core$msg.TEXT_PROMPT_TOOLTIP_NUMBER)}});var xe=Object.assign({},et,{init:function(){this.mixin(w);var g=[[l.Msg$$module$build$src$core$msg.TEXT_PROMPT_TYPE_TEXT,"TEXT"],[l.Msg$$module$build$src$core$msg.TEXT_PROMPT_TYPE_NUMBER,"NUMBER"]];this.setHelpUrl(l.Msg$$module$build$src$core$msg.TEXT_PROMPT_HELPURL),this.setStyle("text_blocks"),g=l.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:g}),g.setValidator(k=>{this.updateType_(k)}),this.appendDummyInput().appendField(g,"TYPE").appendField(this.newQuote_(!0)).appendField(l.fromJson$$module$build$src$core$field_registry({type:"field_input",text:""}),"TEXT").appendField(this.newQuote_(!1)),this.setOutput(!0,"String"),this.setTooltip(()=>this.getFieldValue("TYPE")==="TEXT"?l.Msg$$module$build$src$core$msg.TEXT_PROMPT_TOOLTIP_TEXT:l.Msg$$module$build$src$core$msg.TEXT_PROMPT_TOOLTIP_NUMBER)}});nt.text_prompt=xe,nt.text_count={init:function(){this.jsonInit({message0:l.Msg$$module$build$src$core$msg.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:l.Msg$$module$build$src$core$msg.TEXT_COUNT_TOOLTIP,helpUrl:l.Msg$$module$build$src$core$msg.TEXT_COUNT_HELPURL})}},nt.text_replace={init:function(){this.jsonInit({message0:l.Msg$$module$build$src$core$msg.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:l.Msg$$module$build$src$core$msg.TEXT_REPLACE_TOOLTIP,helpUrl:l.Msg$$module$build$src$core$msg.TEXT_REPLACE_HELPURL})}},nt.text_reverse={init:function(){this.jsonInit({message0:l.Msg$$module$build$src$core$msg.TEXT_REVERSE_MESSAGE0,args0:[{type:"input_value",name:"TEXT",check:"String"}],output:"String",inputsInline:!0,style:"text_blocks",tooltip:l.Msg$$module$build$src$core$msg.TEXT_REVERSE_TOOLTIP,helpUrl:l.Msg$$module$build$src$core$msg.TEXT_REVERSE_HELPURL})}};var w={QUOTE_IMAGE_LEFT_DATAURI:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAn0lEQVQI1z3OMa5BURSF4f/cQhAKjUQhuQmFNwGJEUi0RKN5rU7FHKhpjEH3TEMtkdBSCY1EIv8r7nFX9e29V7EBAOvu7RPjwmWGH/VuF8CyN9/OAdvqIXYLvtRaNjx9mMTDyo+NjAN1HNcl9ZQ5oQMM3dgDUqDo1l8DzvwmtZN7mnD+PkmLa+4mhrxVA9fRowBWmVBhFy5gYEjKMfz9AylsaRRgGzvZAAAAAElFTkSuQmCC",QUOTE_IMAGE_RIGHT_DATAURI:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAqUlEQVQI1z3KvUpCcRiA8ef9E4JNHhI0aFEacm1o0BsI0Slx8wa8gLauoDnoBhq7DcfWhggONDmJJgqCPA7neJ7p934EOOKOnM8Q7PDElo/4x4lFb2DmuUjcUzS3URnGib9qaPNbuXvBO3sGPHJDRG6fGVdMSeWDP2q99FQdFrz26Gu5Tq7dFMzUvbXy8KXeAj57cOklgA+u1B5AoslLtGIHQMaCVnwDnADZIFIrXsoXrgAAAABJRU5ErkJggg==",QUOTE_IMAGE_WIDTH:12,QUOTE_IMAGE_HEIGHT:12,quoteField_:function(g){for(let k=0,W;W=this.inputList[k];k++)for(let J=0,Ee;Ee=W.fieldRow[J];J++)if(g===Ee.name){W.insertFieldAt(J,this.newQuote_(!0)),W.insertFieldAt(J+2,this.newQuote_(!1));return}console.warn('field named "'+g+'" not found in '+this.toDevString())},newQuote_:function(g){return g=this.RTL?!g:g,l.fromJson$$module$build$src$core$field_registry({type:"field_image",src:g?this.QUOTE_IMAGE_LEFT_DATAURI:this.QUOTE_IMAGE_RIGHT_DATAURI,width:this.QUOTE_IMAGE_WIDTH,height:this.QUOTE_IMAGE_HEIGHT,alt:g?"“":"”"})}},I=function(){this.mixin(w),this.quoteField_("TEXT")},N={itemCount_:0,mutationToDom:function(){const g=l.createElement$$module$build$src$core$utils$xml("mutation");return g.setAttribute("items",`${this.itemCount_}`),g},domToMutation:function(g){this.itemCount_=parseInt(g.getAttribute("items"),10),this.updateShape_()},saveExtraState:function(){return{itemCount:this.itemCount_}},loadExtraState:function(g){this.itemCount_=g.itemCount,this.updateShape_()},decompose:function(g){const k=g.newBlock("text_create_join_container");k.initSvg();let W=k.getInput("STACK").connection;for(let J=0;Jl.Msg$$module$build$src$core$msg.TEXT_INDEXOF_TOOLTIP.replace("%1",this.workspace.options.oneBasedIndex?"0":"-1"))},U={isAt_:!1,mutationToDom:function(){const g=l.createElement$$module$build$src$core$utils$xml("mutation");return g.setAttribute("at",`${this.isAt_}`),g},domToMutation:function(g){g=g.getAttribute("at")!=="false",this.updateAt_(g)},updateAt_:function(g){this.removeInput("AT",!0),this.removeInput("ORDINAL",!0),g&&(this.appendValueInput("AT").setCheck("Number"),l.Msg$$module$build$src$core$msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL").appendField(l.Msg$$module$build$src$core$msg.ORDINAL_NUMBER_SUFFIX)),l.Msg$$module$build$src$core$msg.TEXT_CHARAT_TAIL&&(this.removeInput("TAIL",!0),this.appendDummyInput("TAIL").appendField(l.Msg$$module$build$src$core$msg.TEXT_CHARAT_TAIL)),this.isAt_=g}},de=function(){this.getField("WHERE").setValidator(function(g){g=g==="FROM_START"||g==="FROM_END";const k=this.getSourceBlock();g!==k.isAt_&&k.updateAt_(g)}),this.updateAt_(!0),this.setTooltip(()=>{var g=this.getFieldValue("WHERE");let k=l.Msg$$module$build$src$core$msg.TEXT_CHARAT_TOOLTIP;return(g==="FROM_START"||g==="FROM_END")&&(g=g==="FROM_START"?l.Msg$$module$build$src$core$msg.LISTS_INDEX_FROM_START_TOOLTIP:l.Msg$$module$build$src$core$msg.LISTS_INDEX_FROM_END_TOOLTIP)&&(k+=" "+g.replace("%1",this.workspace.options.oneBasedIndex?"#1":"#0")),k})};l.register$$module$build$src$core$extensions("text_indexOf_tooltip",K),l.register$$module$build$src$core$extensions("text_quotes",I),l.registerMutator$$module$build$src$core$extensions("text_join_mutator",N,A),l.registerMutator$$module$build$src$core$extensions("text_charAt_mutator",U,de),l.defineBlocks$$module$build$src$core$common(nt);var Te={};Te.blocks=nt;var se=l.createBlockDefinitionsFromJsonArray$$module$build$src$core$common([{type:"variables_get",message0:"%1",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_VARIABLES_DEFAULT_NAME}"}],output:null,style:"variable_blocks",helpUrl:"%{BKY_VARIABLES_GET_HELPURL}",tooltip:"%{BKY_VARIABLES_GET_TOOLTIP}",extensions:["contextMenu_variableSetterGetter"]},{type:"variables_set",message0:"%{BKY_VARIABLES_SET}",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_VARIABLES_DEFAULT_NAME}"},{type:"input_value",name:"VALUE"}],previousStatement:null,nextStatement:null,style:"variable_blocks",tooltip:"%{BKY_VARIABLES_SET_TOOLTIP}",helpUrl:"%{BKY_VARIABLES_SET_HELPURL}",extensions:["contextMenu_variableSetterGetter"]}]),Ce={customContextMenu:function(g){if(this.isInFlyout)(this.type==="variables_get"||this.type==="variables_get_reporter")&&(k={text:l.Msg$$module$build$src$core$msg.RENAME_VARIABLE,enabled:!0,callback:ce(this)},W=this.getField("VAR").getText(),W={text:l.Msg$$module$build$src$core$msg.DELETE_VARIABLE.replace("%1",W),enabled:!0,callback:Se(this)},g.unshift(k),g.unshift(W));else{if(this.type==="variables_get")var k="variables_set",W=l.Msg$$module$build$src$core$msg.VARIABLES_GET_CREATE_SET;else k="variables_get",W=l.Msg$$module$build$src$core$msg.VARIABLES_SET_CREATE_GET;const J=this.getField("VAR").getText(),Ee=l.createElement$$module$build$src$core$utils$xml("field");Ee.setAttribute("name","VAR"),Ee.appendChild(l.createTextNode$$module$build$src$core$utils$xml(J));const ze=l.createElement$$module$build$src$core$utils$xml("block");ze.setAttribute("type",k),ze.appendChild(Ee),g.push({enabled:0 String(b) ? 1 : -1; },
+ 'IGNORE_CASE': function(a, b) {
+ return String(a).toLowerCase() > String(b).toLowerCase() ? 1 : -1; },
+ };
+ var compare = compareFuncs[type];
+ return function(a, b) { return compare(a, b) * direction; };
+}
+ `),[y+".slice().sort("+m+'("'+_+'", '+V+"))",E.FUNCTION_CALL]},Z=function(_,m){let y=m.valueToCode(_,"INPUT",E.MEMBER);if(m=m.valueToCode(_,"DELIM",E.NONE)||"''",_=_.getFieldValue("MODE"),_==="SPLIT")y||(y="''"),_="split";else if(_==="JOIN")y||(y="[]"),_="join";else throw Error("Unknown mode: "+_);return[y+"."+_+"("+m+")",E.FUNCTION_CALL]},Y=function(_,m){return[(m.valueToCode(_,"LIST",E.FUNCTION_CALL)||"[]")+".slice().reverse()",E.FUNCTION_CALL]},M=function(_,m){var y=0;let V="";m.STATEMENT_PREFIX&&(V+=m.injectId(m.STATEMENT_PREFIX,_));do{const ve=m.valueToCode(_,"IF"+y,E.NONE)||"false";let Ge=m.statementToCode(_,"DO"+y);m.STATEMENT_SUFFIX&&(Ge=m.prefixLines(m.injectId(m.STATEMENT_SUFFIX,_),m.INDENT)+Ge),V+=(0",GTE:">="}[_.getFieldValue("OP")],V=y==="=="||y==="!="?E.EQUALITY:E.RELATIONAL,ve=m.valueToCode(_,"A",V)||"0";return _=m.valueToCode(_,"B",V)||"0",[ve+" "+y+" "+_,V]},R=function(_,m){const y=_.getFieldValue("OP")==="AND"?"&&":"||",V=y==="&&"?E.LOGICAL_AND:E.LOGICAL_OR;let ve=m.valueToCode(_,"A",V);return _=m.valueToCode(_,"B",V),ve||_?(m=y==="&&"?"true":"false",ve||(ve=m),_||(_=m)):_=ve="false",[ve+" "+y+" "+_,V]},F=function(_,m){const y=E.LOGICAL_NOT;return["!"+(m.valueToCode(_,"BOOL",y)||"true"),y]},z=function(_,m){return[_.getFieldValue("BOOL")==="TRUE"?"true":"false",E.ATOMIC]},X=function(_,m){return["null",E.ATOMIC]},le=function(_,m){const y=m.valueToCode(_,"IF",E.CONDITIONAL)||"false",V=m.valueToCode(_,"THEN",E.CONDITIONAL)||"null";return _=m.valueToCode(_,"ELSE",E.CONDITIONAL)||"null",[y+" ? "+V+" : "+_,E.CONDITIONAL]},$e=function(_,m){let y;y=_.getField("TIMES")?String(Number(_.getFieldValue("TIMES"))):m.valueToCode(_,"TIMES",E.ASSIGNMENT)||"0";let V=m.statementToCode(_,"DO");V=m.addLoopTrap(V,_),_="";const ve=m.nameDB_.getDistinctName("count",l.NameType$$module$build$src$core$names.VARIABLE);let Ge=y;return y.match(/^\w+$/)||l.isNumber$$module$build$src$core$utils$string(y)||(Ge=m.nameDB_.getDistinctName("repeat_end",l.NameType$$module$build$src$core$names.VARIABLE),_+="var "+Ge+" = "+y+`;
+`),_+("for (var "+ve+" = 0; "+ve+" < "+Ge+"; "+ve+`++) {
+`+V+`}
+`)},he=function(_,m){const y=_.getFieldValue("MODE")==="UNTIL";let V=m.valueToCode(_,"BOOL",y?E.LOGICAL_NOT:E.NONE)||"false",ve=m.statementToCode(_,"DO");return ve=m.addLoopTrap(ve,_),y&&(V="!"+V),"while ("+V+`) {
+`+ve+`}
+`},fe=function(_,m){var y=m.nameDB_.getName(_.getFieldValue("VAR"),l.NameType$$module$build$src$core$names.VARIABLE),V=m.valueToCode(_,"FROM",E.ASSIGNMENT)||"0",ve=m.valueToCode(_,"TO",E.ASSIGNMENT)||"0";const Ge=m.valueToCode(_,"BY",E.ASSIGNMENT)||"1";let rt=m.statementToCode(_,"DO");if(rt=m.addLoopTrap(rt,_),l.isNumber$$module$build$src$core$utils$string(V)&&l.isNumber$$module$build$src$core$utils$string(ve)&&l.isNumber$$module$build$src$core$utils$string(Ge))m=Number(V)<=Number(ve),_="for ("+y+" = "+V+"; "+y+(m?" <= ":" >= ")+ve+"; "+y,y=Math.abs(Number(Ge)),_=y===1?_+(m?"++":"--"):_+((m?" += ":" -= ")+y),_+=`) {
+`+rt+`}
+`;else{_="";let Mt=V;V.match(/^\w+$/)||l.isNumber$$module$build$src$core$utils$string(V)||(Mt=m.nameDB_.getDistinctName(y+"_start",l.NameType$$module$build$src$core$names.VARIABLE),_+="var "+Mt+" = "+V+`;
+`),V=ve,ve.match(/^\w+$/)||l.isNumber$$module$build$src$core$utils$string(ve)||(V=m.nameDB_.getDistinctName(y+"_end",l.NameType$$module$build$src$core$names.VARIABLE),_+="var "+V+" = "+ve+`;
+`),ve=m.nameDB_.getDistinctName(y+"_inc",l.NameType$$module$build$src$core$names.VARIABLE),_+="var "+ve+" = ",_=l.isNumber$$module$build$src$core$utils$string(Ge)?_+(Math.abs(Ge)+`;
+`):_+("Math.abs("+Ge+`);
+`),_+="if ("+Mt+" > "+V+`) {
+`,_+=m.INDENT+ve+" = -"+ve+`;
+`,_=_+`}
+for (`+(y+" = "+Mt+"; "+ve+" >= 0 ? "+y+" <= "+V+" : "+y+" >= "+V+"; "+y+" += "+ve+`) {
+`+rt+`}
+`)}return _},ke=function(_,m){const y=m.nameDB_.getName(_.getFieldValue("VAR"),l.NameType$$module$build$src$core$names.VARIABLE);var V=m.valueToCode(_,"LIST",E.ASSIGNMENT)||"[]";let ve=m.statementToCode(_,"DO");ve=m.addLoopTrap(ve,_),_="";let Ge=V;return V.match(/^\w+$/)||(Ge=m.nameDB_.getDistinctName(y+"_list",l.NameType$$module$build$src$core$names.VARIABLE),_+="var "+Ge+" = "+V+`;
+`),V=m.nameDB_.getDistinctName(y+"_index",l.NameType$$module$build$src$core$names.VARIABLE),ve=m.INDENT+y+" = "+Ge+"["+V+`];
+`+ve,_+("for (var "+V+" in "+Ge+`) {
+`+ve+`}
+`)},re=function(_,m){let y="";if(m.STATEMENT_PREFIX&&(y+=m.injectId(m.STATEMENT_PREFIX,_)),m.STATEMENT_SUFFIX&&(y+=m.injectId(m.STATEMENT_SUFFIX,_)),m.STATEMENT_PREFIX){const V=_.getSurroundLoop();V&&!V.suppressPrefixSuffix&&(y+=m.injectId(m.STATEMENT_PREFIX,V))}switch(_.getFieldValue("FLOW")){case"BREAK":return y+`break;
+`;case"CONTINUE":return y+`continue;
+`}throw Error("Unknown flow statement.")},Ie=function(_,m){return _=Number(_.getFieldValue("NUM")),[_,0<=_?E.ATOMIC:E.UNARY_NEGATION]},D=function(_,m){var y={ADD:[" + ",E.ADDITION],MINUS:[" - ",E.SUBTRACTION],MULTIPLY:[" * ",E.MULTIPLICATION],DIVIDE:[" / ",E.DIVISION],POWER:[null,E.NONE]}[_.getFieldValue("OP")];const V=y[0];y=y[1];const ve=m.valueToCode(_,"A",y)||"0";return _=m.valueToCode(_,"B",y)||"0",V?[ve+V+_,y]:["Math.pow("+ve+", "+_+")",E.FUNCTION_CALL]},B=function(_,m){const y=_.getFieldValue("OP");let V;if(y==="NEG")return _=m.valueToCode(_,"NUM",E.UNARY_NEGATION)||"0",_[0]==="-"&&(_=" "+_),["-"+_,E.UNARY_NEGATION];switch(_=y==="SIN"||y==="COS"||y==="TAN"?m.valueToCode(_,"NUM",E.DIVISION)||"0":m.valueToCode(_,"NUM",E.NONE)||"0",y){case"ABS":V="Math.abs("+_+")";break;case"ROOT":V="Math.sqrt("+_+")";break;case"LN":V="Math.log("+_+")";break;case"EXP":V="Math.exp("+_+")";break;case"POW10":V="Math.pow(10,"+_+")";break;case"ROUND":V="Math.round("+_+")";break;case"ROUNDUP":V="Math.ceil("+_+")";break;case"ROUNDDOWN":V="Math.floor("+_+")";break;case"SIN":V="Math.sin("+_+" / 180 * Math.PI)";break;case"COS":V="Math.cos("+_+" / 180 * Math.PI)";break;case"TAN":V="Math.tan("+_+" / 180 * Math.PI)"}if(V)return[V,E.FUNCTION_CALL];switch(y){case"LOG10":V="Math.log("+_+") / Math.log(10)";break;case"ASIN":V="Math.asin("+_+") / Math.PI * 180";break;case"ACOS":V="Math.acos("+_+") / Math.PI * 180";break;case"ATAN":V="Math.atan("+_+") / Math.PI * 180";break;default:throw Error("Unknown math operator: "+y)}return[V,E.DIVISION]},ae=function(_,m){return{PI:["Math.PI",E.MEMBER],E:["Math.E",E.MEMBER],GOLDEN_RATIO:["(1 + Math.sqrt(5)) / 2",E.DIVISION],SQRT2:["Math.SQRT2",E.MEMBER],SQRT1_2:["Math.SQRT1_2",E.MEMBER],INFINITY:["Infinity",E.ATOMIC]}[_.getFieldValue("CONSTANT")]},_e=function(_,m){var y={EVEN:[" % 2 === 0",E.MODULUS,E.EQUALITY],ODD:[" % 2 === 1",E.MODULUS,E.EQUALITY],WHOLE:[" % 1 === 0",E.MODULUS,E.EQUALITY],POSITIVE:[" > 0",E.RELATIONAL,E.RELATIONAL],NEGATIVE:[" < 0",E.RELATIONAL,E.RELATIONAL],DIVISIBLE_BY:[null,E.MODULUS,E.EQUALITY],PRIME:[null,E.NONE,E.FUNCTION_CALL]};const V=_.getFieldValue("PROPERTY"),[ve,Ge,rt]=y[V];return y=m.valueToCode(_,"NUMBER_TO_CHECK",Ge)||"0",V==="PRIME"?_=m.provideFunction_("mathIsPrime",`
+function ${m.FUNCTION_NAME_PLACEHOLDER_}(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;
+}
+`)+"("+y+")":V==="DIVISIBLE_BY"?(_=m.valueToCode(_,"DIVISOR",E.MODULUS)||"0",_=y+" % "+_+" === 0"):_=y+ve,[_,rt]},Me=function(_,m){const y=m.valueToCode(_,"DELTA",E.ADDITION)||"0";return _=m.nameDB_.getName(_.getFieldValue("VAR"),l.NameType$$module$build$src$core$names.VARIABLE),_+" = (typeof "+_+" === 'number' ? "+_+" : 0) + "+y+`;
+`},Xe=function(_,m){var y=_.getFieldValue("OP");switch(y){case"SUM":_=m.valueToCode(_,"LIST",E.MEMBER)||"[]",_+=".reduce(function(x, y) {return x + y;}, 0)";break;case"MIN":_=m.valueToCode(_,"LIST",E.NONE)||"[]",_="Math.min.apply(null, "+_+")";break;case"MAX":_=m.valueToCode(_,"LIST",E.NONE)||"[]",_="Math.max.apply(null, "+_+")";break;case"AVERAGE":y=m.provideFunction_("mathMean",`
+function ${m.FUNCTION_NAME_PLACEHOLDER_}(myList) {
+ return myList.reduce(function(x, y) {return x + y;}, 0) / myList.length;
+}
+`),_=m.valueToCode(_,"LIST",E.NONE)||"[]",_=y+"("+_+")";break;case"MEDIAN":y=m.provideFunction_("mathMedian",`
+function ${m.FUNCTION_NAME_PLACEHOLDER_}(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];
+ }
+}
+`),_=m.valueToCode(_,"LIST",E.NONE)||"[]",_=y+"("+_+")";break;case"MODE":y=m.provideFunction_("mathModes",`
+function ${m.FUNCTION_NAME_PLACEHOLDER_}(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;
+}
+`),_=m.valueToCode(_,"LIST",E.NONE)||"[]",_=y+"("+_+")";break;case"STD_DEV":y=m.provideFunction_("mathStandardDeviation",`
+function ${m.FUNCTION_NAME_PLACEHOLDER_}(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);
+}
+`),_=m.valueToCode(_,"LIST",E.NONE)||"[]",_=y+"("+_+")";break;case"RANDOM":y=m.provideFunction_("mathRandomList",`
+function ${m.FUNCTION_NAME_PLACEHOLDER_}(list) {
+ var x = Math.floor(Math.random() * list.length);
+ return list[x];
+}
+`),_=m.valueToCode(_,"LIST",E.NONE)||"[]",_=y+"("+_+")";break;default:throw Error("Unknown operator: "+y)}return[_,E.FUNCTION_CALL]},Je=function(_,m){const y=m.valueToCode(_,"DIVIDEND",E.MODULUS)||"0";return _=m.valueToCode(_,"DIVISOR",E.MODULUS)||"0",[y+" % "+_,E.MODULUS]},we=function(_,m){const y=m.valueToCode(_,"VALUE",E.NONE)||"0",V=m.valueToCode(_,"LOW",E.NONE)||"0";return _=m.valueToCode(_,"HIGH",E.NONE)||"Infinity",["Math.min(Math.max("+y+", "+V+"), "+_+")",E.FUNCTION_CALL]},We=function(_,m){const y=m.valueToCode(_,"FROM",E.NONE)||"0";return _=m.valueToCode(_,"TO",E.NONE)||"0",[m.provideFunction_("mathRandomInt",`
+function ${m.FUNCTION_NAME_PLACEHOLDER_}(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);
+}
+`)+"("+y+", "+_+")",E.FUNCTION_CALL]},Ze=function(_,m){return["Math.random()",E.FUNCTION_CALL]},nt=function(_,m){const y=m.valueToCode(_,"X",E.NONE)||"0";return["Math.atan2("+(m.valueToCode(_,"Y",E.NONE)||"0")+", "+y+") / Math.PI * 180",E.DIVISION]},ht=function(_,m){const y=m.nameDB_.getName(_.getFieldValue("NAME"),l.NameType$$module$build$src$core$names.PROCEDURE);var V="";m.STATEMENT_PREFIX&&(V+=m.injectId(m.STATEMENT_PREFIX,_)),m.STATEMENT_SUFFIX&&(V+=m.injectId(m.STATEMENT_SUFFIX,_)),V&&(V=m.prefixLines(V,m.INDENT));let ve="";m.INFINITE_LOOP_TRAP&&(ve=m.prefixLines(m.injectId(m.INFINITE_LOOP_TRAP,_),m.INDENT));const Ge=m.statementToCode(_,"STACK");let rt=m.valueToCode(_,"RETURN",E.NONE)||"",Mt="";Ge&&rt&&(Mt=V),rt&&(rt=m.INDENT+"return "+rt+`;
+`);const po=[],Be=_.getVars();for(let wt=0;wty?rt=Mt=this.ORDER_SUBTRACTION:V&&(rt=Mt=this.ORDER_UNARY_NEGATION),_=this.valueToCode(_,m,Mt)||Ge,l.isNumber$$module$build$src$core$utils$string(_)?(_=Number(_)+y,V&&(_=-_)):(0y&&(_=_+" - "+-y),V&&(_=y?"-("+_+")":"-"+_),rt=Math.floor(rt),ve=Math.floor(ve),rt&&ve>=rt&&(_="("+_+")")),_}},k={};k.colour_blend=h,k.colour_picker=a,k.colour_random=u,k.colour_rgb=d;var W=function(_,m,y){return m==="FIRST"?"0":m==="FROM_END"?_+".length - 1 - "+y:m==="LAST"?_+".length - 1":y},J={};J.lists_create_empty=p,J.lists_create_with=f,J.lists_getIndex=x,J.lists_getSublist=oe,J.lists_indexOf=P,J.lists_isEmpty=S,J.lists_length=C,J.lists_repeat=T,J.lists_reverse=Y,J.lists_setIndex=G,J.lists_sort=ne,J.lists_split=Z;var Ee={};Ee.controls_if=M,Ee.controls_ifelse=M,Ee.logic_boolean=z,Ee.logic_compare=L,Ee.logic_negate=F,Ee.logic_null=X,Ee.logic_operation=R,Ee.logic_ternary=le;var ze={};ze.controls_flow_statements=re,ze.controls_for=fe,ze.controls_forEach=ke,ze.controls_repeat=$e,ze.controls_repeat_ext=$e,ze.controls_whileUntil=he;var yt={};yt.math_arithmetic=D,yt.math_atan2=nt,yt.math_change=Me,yt.math_constant=ae,yt.math_constrain=we,yt.math_modulo=Je,yt.math_number=Ie,yt.math_number_property=_e,yt.math_on_list=Xe,yt.math_random_float=Ze,yt.math_random_int=We,yt.math_round=B,yt.math_single=B,yt.math_trig=B;var ls={};ls.procedures_callnoreturn=xe,ls.procedures_callreturn=et,ls.procedures_defnoreturn=ht,ls.procedures_defreturn=ht,ls.procedures_ifreturn=w;var ii=/^\s*'([^']|\\')*'\s*$/,xt=function(_){return ii.test(_)?[_,E.ATOMIC]:["String("+_+")",E.FUNCTION_CALL]},Qo=function(_,m,y){return m==="FIRST"?"0":m==="FROM_END"?_+".length - 1 - "+y:m==="LAST"?_+".length - 1":y},Ht={};Ht.text=I,Ht.text_append=K,Ht.text_changeCase=ce,Ht.text_charAt=se,Ht.text_count=be,Ht.text_getSubstring=Ce,Ht.text_indexOf=Te,Ht.text_isEmpty=de,Ht.text_join=A,Ht.text_length=U,Ht.text_multiline=N,Ht.text_print=Ne,Ht.text_prompt=He,Ht.text_prompt_ext=He,Ht.text_replace=ee,Ht.text_reverse=ie,Ht.text_trim=Se;var ws={};ws.variables_get=ue,ws.variables_set=ye;var qo={};qo.variables_get_dynamic=ue,qo.variables_set_dynamic=ye;var b=new g;Object.assign(b.forBlock,k,J,Ee,ze,yt,ls,Ht,ws,qo);var O={};return O.JavascriptGenerator=g,O.Order=E,O.javascriptGenerator=b,O.__namespace__=l,O})}(d0)),d0.exports}var Mb;function o8(){return Mb||(Mb=1,function(o,n){(function(s,l){o.exports=l(Gc(),t8())})(Do,function(s,l){/**
+ * @license
+ * Copyright 2020 Google LLC
+ * SPDX-License-Identifier: Apache-2.0
+ */return l})}(u0)),u0.exports}var Db;function s8(){return Db||(Db=1,function(o,n){(function(s,l){o.exports=l(Gc(),J5(),e8(),o8())})(Do,function(s,l,a,u){return s.setLocale(l),s})}(s0)),s0.exports}(function(o,n){(function(s,l){o.exports=l(s8())})(Do,function(s){/**
+ * @license
+ * Copyright 2019 Google LLC
+ * SPDX-License-Identifier: Apache-2.0
+ */return s})})(e2);var i8=e2.exports;const Tt=CI(i8);Tt.defineBlocksWithJsonArray([{type:"controls_forever",message0:"%1",args0:[{type:"field_label",text:"永远 循环"}],message1:"%1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"controller",tooltip:"重复执行。"},{type:"math_evenly_divisible",message0:"%1 能被 %2 整除",args0:[{type:"input_value",name:"DIVIDEND",check:"Number",value:0},{type:"input_value",name:"DIVISOR",check:"Number",value:0}],output:"Boolean",style:"calculation",tooltip:"判断第一个数是否恰好被第二个数整除。"},{type:"lists_split",message0:"把 %1 按 %2 %3",args0:[{type:"input_value",name:"INPUT",check:["String","Array"]},{type:"input_value",name:"DELIM",check:"String"},{type:"field_dropdown",name:"MODE",options:[["分开成列表","SPLIT"],["合并为文本","JOIN"]]}],output:["String","Array"],style:"calculation",tooltip:"将文本分开成列表或将列表合并为文本。"},{type:"text_charAt",message0:"取 %1 %2 第 %3 个字符",args0:[{type:"input_value",name:"VALUE",check:"String"},{type:"field_dropdown",name:"WHERE",options:[["正数","FROM_START"],["倒数","FROM_END"]]},{type:"input_value",name:"INDEX",check:"Number"}],output:"String",style:"calculation",tooltip:"取文本指定位置的字符。"},{type:"text_getSubstring",message0:"取 %1 %2 第 %3 到 %4 第 %5 个字符",args0:[{type:"input_value",name:"VALUE",check:"String"},{type:"field_dropdown",name:"WHERE1",options:[["正数","FROM_START"],["倒数","FROM_END"]]},{type:"input_value",name:"INDEX1",check:"Number"},{type:"field_dropdown",name:"WHERE2",options:[["正数","FROM_START"],["倒数","FROM_END"]]},{type:"input_value",name:"INDEX2",check:"Number"}],output:"String",style:"calculation",tooltip:"取文本指定位置的字符。"},{type:"math_types",message0:"把 %1 转换为 %2 类型",args0:[{type:"input_value",name:"VALUE"},{type:"field_dropdown",name:"TYPE",options:[["字符串","STRING"],["数值","NUMBER"],["布尔","BOOLEAN"]]}],output:"String",style:"calculation",tooltip:"将对象转换为指定类型。"},{type:"lists_push",message0:"添加 %1 到 %2 末尾",args0:[{type:"input_value",name:"VALUE",check:"Number"},{type:"input_value",name:"LIST",check:"Array"}],previousStatement:null,nextStatement:null,style:"lists",tooltip:"添加值到列表的末尾。"},{type:"lists_insert",message0:"插入 %1 到 %2 %3 第 %4 项后面",args0:[{type:"input_value",name:"VALUE"},{type:"input_value",name:"LIST",check:"Array"},{type:"field_dropdown",name:"WHERE",options:[["正数","FROM_START"],["倒数","FROM_END"]]},{type:"input_value",name:"INDEX",check:"Number"}],previousStatement:null,nextStatement:null,style:"lists",tooltip:"添加值到列表的末尾。"},{type:"lists_delete",message0:"删除 %1 %2 第 %3 项",args0:[{type:"input_value",name:"LIST",check:"Array"},{type:"field_dropdown",name:"WHERE",options:[["正数","FROM_START"],["倒数","FROM_END"]]},{type:"input_value",name:"INDEX",check:"Number"}],previousStatement:null,nextStatement:null,style:"lists_delete",tooltip:"删除列表的指定项。"},{type:"lists_set",message0:"替换 %1 %2 第 %3 项为 %4",args0:[{type:"input_value",name:"LIST",check:"Array"},{type:"field_dropdown",name:"WHERE",options:[["正数","FROM_START"],["倒数","FROM_END"]]},{type:"input_value",name:"INDEX",check:"Number"},{type:"input_value",name:"VALUE"}],previousStatement:null,nextStatement:null,style:"lists",tooltip:"替换列表的指定项。"},{type:"lists_get",message0:"%1 %2 第 %3 项",args0:[{type:"input_value",name:"LIST",check:"Array"},{type:"field_dropdown",name:"WHERE",options:[["正数","FROM_START"],["倒数","FROM_END"]]},{type:"input_value",name:"INDEX",check:"Number"}],output:"Any",style:"lists",tooltip:"获取列表的指定项。"},{type:"lists_index",message0:"%1 中 %2 %3 的位置",args0:[{type:"input_value",name:"LIST",check:"Array"},{type:"field_dropdown",name:"WHICH",options:[["第一个","FIRST"],["最后一个","LAST"]]},{type:"input_value",name:"VALUE"}],output:"Number",style:"lists",tooltip:"返回在列表中的第一个/最后一个匹配项的索引值,如果找不到项目则返回列表本身。"},{type:"lists_includes",message0:"%1 中包含 %2",args0:[{type:"input_value",name:"LIST",check:"Array"},{type:"input_value",name:"VALUE"}],output:"Boolean",style:"lists",tooltip:"列表中是否包含指定项。"},{type:"time_current",message0:"当前时间戳",output:"Number",style:"time",tooltip:"获取当前时间戳。"},{type:"time_timestamp_to_date",message0:"时间戳 %1 转换为日期字符串",args0:[{type:"input_value",name:"TIMESTAMP",check:"Number"}],output:"String",style:"time",tooltip:"将时间戳转换为日期字符串。"},{type:"time_import",message0:"引入time库",previousStatement:null,nextStatement:null,style:"time",tooltip:"引入时间库。"},{type:"sqlite_open",message0:"打开数据库 %1",args0:[{type:"input_value",name:"DATABASE",check:"String"}],output:"sqlite3.Connection",style:"sqlite",tooltip:"打开数据库连接。"},{type:"sqlite_query",message0:"执行查询 %1",args0:[{type:"input_value",name:"QUERY",check:"String"}],output:"sqlite3.Cursor",style:"sqlite",tooltip:"执行SQL查询。"},{type:"sqlite_exec",message0:"执行命令 %1",args0:[{type:"input_value",name:"COMMAND",check:"String"}],previousStatement:null,nextStatement:null,style:"sqlite",tooltip:"执行SQL命令。"},{type:"sqlite_close",message0:"关闭数据库连接",previousStatement:null,nextStatement:null,style:"sqlite",tooltip:"关闭数据库连接。"},{type:"http_import",message0:"引入http库",previousStatement:null,nextStatement:null,style:"http",tooltip:"引入HTTP库。"},{type:"http_get",message0:"发送GET请求到 链接:%1 请求头(字典):%2 cookie(字典):%3",args0:[{type:"input_value",name:"URL",check:"String"},{type:"input_value",name:"HEADERS",check:"Array"},{type:"input_value",name:"COOKIES",check:"Array"}],output:"String",style:"http",tooltip:"发送GET请求。"},{type:"http_post",message0:"发送POST请求到 链接:%1 请求体(字典):%2 请求头(字典):%3 cookie(字典):%4",args0:[{type:"input_value",name:"URL",check:"String"},{type:"input_value",name:"BODY",check:"Array"},{type:"input_value",name:"HEADERS",check:"Array"},{type:"input_value",name:"COOKIES",check:"Array"}],output:"String",style:"http",tooltip:"发送POST请求。"},{type:"dict_get",message0:"获取字典 %1 的键 %2 的值",args0:[{type:"input_value",name:"DICT",check:"Array"},{type:"input_value",name:"KEY",check:"String"}],output:"Any",style:"dict",tooltip:"获取字典的指定键的值。"},{type:"dict_create",message0:"创建字典",output:"Array",style:"dict",tooltip:"创建一个空字典。"},{type:"dict_set",message0:"设置字典 %1 的键 %2 的值为 %3",args0:[{type:"input_value",name:"DICT",check:"Array"},{type:"input_value",name:"KEY",check:"String"},{type:"input_value",name:"VALUE"}],previousStatement:null,nextStatement:null,style:"dict",tooltip:"设置字典的指定键的值。"},{type:"set_dict",message0:"创建字典 键 %1 : %2",args0:[{type:"input_value",name:"KEY",check:"String"},{type:"input_value",name:"VALUE"}],output:"Array",style:"dict",tooltip:"创建一个空字典。"}]);const n8="categoryToolbox",r8=[{kind:"category",name:"控制",categorystyle:"controller",contents:[{kind:"block",type:"controls_forever"},{kind:"block",type:"controls_repeat_ext",inputs:{TIMES:{block:{type:"math_number",fields:{NUM:1}}}}},{kind:"block",type:"controls_for",inputs:{FROM:{block:{type:"math_number",fields:{NUM:1}}},TO:{block:{type:"math_number",fields:{NUM:10}}},BY:{block:{type:"math_number",fields:{NUM:1}}}}},{kind:"block",type:"controls_forEach"},{kind:"block",type:"controls_whileUntil"},{kind:"block",type:"controls_flow_statements"},{kind:"sep",gap:"64"},{kind:"block",type:"controls_if"},{kind:"block",type:"controls_if",extraState:{hasElse:!0}},{kind:"sep",gap:"64"},{kind:"block",type:"logic_ternary",inline:"true"}]},{kind:"category",name:"运算",categorystyle:"calculation",contents:[{kind:"block",type:"math_number",fields:{NUM:0}},{kind:"block",type:"math_arithmetic",inputs:{A:{block:{type:"math_number",fields:{NUM:0}}},B:{block:{type:"math_number",fields:{NUM:0}}}}},{kind:"block",type:"math_random_int",inputs:{FROM:{block:{type:"math_number",fields:{NUM:0}}},TO:{block:{type:"math_number",fields:{NUM:5}}}}},{kind:"sep",gap:"64"},{kind:"block",type:"logic_boolean"},{kind:"block",type:"logic_compare"},{kind:"block",type:"logic_operation"},{kind:"block",type:"logic_negate"},{kind:"sep",gap:"64"},{kind:"block",type:"math_round"},{kind:"block",type:"math_modulo"},{kind:"block",type:"math_evenly_divisible",inputs:{DIVIDEND:{block:{type:"math_number",fields:{NUM:9}}},DIVISOR:{block:{type:"math_number",fields:{NUM:3}}}}},{kind:"block",type:"math_number_property"},{kind:"block",type:"math_trig"},{kind:"block",type:"math_single"},{kind:"sep",gap:"64"},{kind:"block",type:"text"},{kind:"block",type:"text_join",inline:"true",extraState:{itemCount:2}},{kind:"block",type:"lists_split"},{kind:"block",type:"text_indexOf"},{kind:"block",type:"text_charAt"},{kind:"block",type:"text_getSubstring"},{kind:"block",type:"text_replace"},{kind:"block",type:"text_count"},{kind:"block",type:"text_length"},{kind:"block",type:"text_changeCase"},{kind:"block",type:"text_trim"},{kind:"block",type:"math_types"}]},{kind:"category",name:"变量",categorystyle:"variable",custom:"VARIABLE",contents:[{kind:"block",type:"variables_set"},{kind:"block",type:"math_change"},{kind:"block",type:"variables_get"}]},{kind:"category",name:"列表",categorystyle:"list",contents:[{kind:"block",type:"lists_create_empty"},{kind:"block",type:"lists_create_with",inline:"true",extraState:{itemCount:1}},{kind:"block",type:"lists_push"},{kind:"block",type:"lists_insert"},{kind:"block",type:"lists_delete"},{kind:"block",type:"lists_set"},{kind:"sep",gap:"64"},{kind:"block",type:"lists_get"},{kind:"block",type:"lists_length"},{kind:"block",type:"lists_index"},{kind:"block",type:"lists_includes"}]},{kind:"category",name:"字典",categorystyle:"dict",contents:[{kind:"block",type:"set_dict",inline:"true",extraState:{itemCount:1}},{kind:"block",type:"dict_get"},{kind:"block",type:"dict_create"},{kind:"block",type:"dict_set"}]},{kind:"category",name:"函数",categorystyle:"function",custom:"PROCEDURE",contents:[{kind:"block",type:"procedures_defnoreturn"},{kind:"block",type:"procedures_defreturn"}]},{kind:"category",name:"时间",categorystyle:"time",contents:[{kind:"block",type:"time_import"},{kind:"block",type:"time_current"},{kind:"block",type:"time_timestamp_to_date"}]},{kind:"category",name:"HTTP",categorystyle:"http",contents:[{kind:"block",type:"http_import"},{kind:"block",type:"http_get"},{kind:"block",type:"http_post"}]},{kind:"category",name:"Sqlite",categorystyle:"sqlite",contents:[{kind:"block",type:"sqlite_open"},{kind:"block",type:"sqlite_query"},{kind:"block",type:"sqlite_exec"},{kind:"block",type:"sqlite_close"}]}],t2={kind:n8,contents:r8};function tn(o,n){const s=Tt.Blocks[o].init;Tt.Blocks[o].init=function(){s.bind(this)(),this.setStyle(n),this.inputsInline=!0}}t2.contents.forEach(function(o){if("contents"in o){let n=o.categorystyle;o.contents.forEach(function(s){s.kind==="block"&&tn(s.type,n)})}else console.warn("This category is empty. ","If you are using a custom approach, ","please list all possible blocks in contents for a unified format.")});Tt.Theme.defineTheme("codemao",{base:Tt.Themes.Zelos,blockStyles:{controller:{colourPrimary:"#68cdff",colourTertiary:"#5db8e5"},calculation:{colourPrimary:"#feae8a",colourTertiary:"#e49c7c"},function:{colourPrimary:"#f88767",colourTertiary:"#df795c"},utility:{colourPrimary:"#00afc3",colourTertiary:"#009daf"},variable:{colourPrimary:"#ffbb55",colourTertiary:"#e5a84c"},list:{colourPrimary:"#f9cc37",colourTertiary:"#e0b731"},time:{colourPrimary:"#f9cc37",colourTertiary:"#e0b731"},dictionary:{colourPrimary:"#a073ff",colourTertiary:"#9067e5"},color:{colourPrimary:"#2bc9a7",colourTertiary:"#19b693"},http:{colourPrimary:"#f9cc37",colourTertiary:"#e0b731"},sqlite:{colourPrimary:"#f9cc37",colourTertiary:"#e0b731"},dict:{colourPrimary:"#a073ff",colourTertiary:"#9067e5"}},categoryStyles:{controller:{colour:"#01adff"},calculation:{colour:"#f0aa8b"},function:{colour:"#f88767"},utility:{colour:"#5ab45b"},variable:{colour:"#ffbb55"},list:{colour:"#ff9c37"},dictionary:{colour:"#2bc9a7"},time:{colour:"#f9cc37"},color:{colour:"#2bc9a7"},http:{colour:"#f9cc37"},sqlite:{colour:"#f9cc37"},dict:{colour:"#a073ff"}}});class l8 extends Tt.zelos.ConstantProvider{constructor(){super(),this.NOTCH_WIDTH=0,this.NOTCH_HEIGHT=8,this.CORNER_RADIUS=4,this.FIELD_TEXT_FONTSIZE=13,this.FIELD_TEXT_FONTWEIGHT="500",this.TOP_ROW_MIN_HEIGHT=2,this.BOTTOM_ROW_MIN_HEIGHT=2,this.SELECTED_GLOW_COLOUR="#4062f6",this.REPLACEMENT_GLOW_COLOUR="#4062f6"}makeNotch(){function l(d){return Tt.utils.svgPaths.line([Tt.utils.svgPaths.point(0,0),Tt.utils.svgPaths.point(d*0,0),Tt.utils.svgPaths.point(0,-0)])}const a=l(1),u=l(-1);return{width:0,height:0+this.NOTCH_HEIGHT,pathLeft:a,pathRight:u}}}class c8 extends Tt.zelos.Renderer{constructor(n){super(n)}makeConstants_(){return new l8}}Tt.blockRendering.register("codemao",c8);var o2={exports:{}},h0={exports:{}},Pb;function a8(){return Pb||(Pb=1,function(o,n){(function(s,l){o.exports=l(_d())})(Do,function(s){var l=s.__namespace__,a=function(b,O){return[O.quote_(b.getFieldValue("COLOUR")),E.ATOMIC]},u=function(b,O){return O.definitions_.import_random="import random",["'#%06x' % random.randint(0, 2**24 - 1)",E.FUNCTION_CALL]},d=function(b,O){const _=O.provideFunction_("colour_rgb",`
+def ${O.FUNCTION_NAME_PLACEHOLDER_}(r, g, b):
+ r = round(min(100, max(0, r)) * 2.55)
+ g = round(min(100, max(0, g)) * 2.55)
+ b = round(min(100, max(0, b)) * 2.55)
+ return '#%02x%02x%02x' % (r, g, b)
+`),m=O.valueToCode(b,"RED",E.NONE)||0,y=O.valueToCode(b,"GREEN",E.NONE)||0;return b=O.valueToCode(b,"BLUE",E.NONE)||0,[_+"("+m+", "+y+", "+b+")",E.FUNCTION_CALL]},h=function(b,O){const _=O.provideFunction_("colour_blend",`
+def ${O.FUNCTION_NAME_PLACEHOLDER_}(colour1, colour2, ratio):
+ r1, r2 = int(colour1[1:3], 16), int(colour2[1:3], 16)
+ g1, g2 = int(colour1[3:5], 16), int(colour2[3:5], 16)
+ b1, b2 = int(colour1[5:7], 16), int(colour2[5:7], 16)
+ ratio = min(1, max(0, ratio))
+ r = round(r1 * (1 - ratio) + r2 * ratio)
+ g = round(g1 * (1 - ratio) + g2 * ratio)
+ b = round(b1 * (1 - ratio) + b2 * ratio)
+ return '#%02x%02x%02x' % (r, g, b)
+`),m=O.valueToCode(b,"COLOUR1",E.NONE)||"'#000000'",y=O.valueToCode(b,"COLOUR2",E.NONE)||"'#000000'";return b=O.valueToCode(b,"RATIO",E.NONE)||0,[_+"("+m+", "+y+", "+b+")",E.FUNCTION_CALL]},p=function(b,O){return["[]",E.ATOMIC]},f=function(b,O){const _=Array(b.itemCount_);for(let m=0;m",GTE:">="}[b.getFieldValue("OP")],m=E.RELATIONAL,y=O.valueToCode(b,"A",m)||"0";return b=O.valueToCode(b,"B",m)||"0",[y+" "+_+" "+b,m]},R=function(b,O){const _=b.getFieldValue("OP")==="AND"?"and":"or",m=_==="and"?E.LOGICAL_AND:E.LOGICAL_OR;let y=O.valueToCode(b,"A",m);return b=O.valueToCode(b,"B",m),y||b?(O=_==="and"?"True":"False",y||(y=O),b||(b=O)):b=y="False",[y+" "+_+" "+b,m]},F=function(b,O){return["not "+(O.valueToCode(b,"BOOL",E.LOGICAL_NOT)||"True"),E.LOGICAL_NOT]},z=function(b,O){return[b.getFieldValue("BOOL")==="TRUE"?"True":"False",E.ATOMIC]},X=function(b,O){return["None",E.ATOMIC]},le=function(b,O){const _=O.valueToCode(b,"IF",E.CONDITIONAL)||"False",m=O.valueToCode(b,"THEN",E.CONDITIONAL)||"None";return b=O.valueToCode(b,"ELSE",E.CONDITIONAL)||"None",[m+" if "+_+" else "+b,E.CONDITIONAL]},$e=function(b,O){let _;_=b.getField("TIMES")?String(parseInt(b.getFieldValue("TIMES"),10)):O.valueToCode(b,"TIMES",E.NONE)||"0",_=l.isNumber$$module$build$src$core$utils$string(_)?parseInt(_,10):"int("+_+")";let m=O.statementToCode(b,"DO");return m=O.addLoopTrap(m,b)||O.PASS,"for "+O.nameDB_.getDistinctName("count",l.NameType$$module$build$src$core$names.VARIABLE)+" in range("+_+`):
+`+m},he=function(b,O){const _=b.getFieldValue("MODE")==="UNTIL";let m=O.valueToCode(b,"BOOL",_?E.LOGICAL_NOT:E.NONE)||"False",y=O.statementToCode(b,"DO");return y=O.addLoopTrap(y,b)||O.PASS,_&&(m="not "+m),"while "+m+`:
+`+y},fe=function(b,O){const _=O.nameDB_.getName(b.getFieldValue("VAR"),l.NameType$$module$build$src$core$names.VARIABLE);var m=O.valueToCode(b,"FROM",E.NONE)||"0",y=O.valueToCode(b,"TO",E.NONE)||"0",V=O.valueToCode(b,"BY",E.NONE)||"1";let ve=O.statementToCode(b,"DO");ve=O.addLoopTrap(ve,b)||O.PASS;let Ge="";const rt=function(){return O.provideFunction_("upRange",`
+def ${O.FUNCTION_NAME_PLACEHOLDER_}(start, stop, step):
+ while start <= stop:
+ yield start
+ start += abs(step)
+`)},Mt=function(){return O.provideFunction_("downRange",`
+def ${O.FUNCTION_NAME_PLACEHOLDER_}(start, stop, step):
+ while start >= stop:
+ yield start
+ start -= abs(step)
+`)};if(b=function(po,Be,wt){return"("+po+" <= "+Be+") and "+rt()+"("+po+", "+Be+", "+wt+") or "+Mt()+"("+po+", "+Be+", "+wt+")"},l.isNumber$$module$build$src$core$utils$string(m)&&l.isNumber$$module$build$src$core$utils$string(y)&&l.isNumber$$module$build$src$core$utils$string(V))m=Number(m),y=Number(y),V=Math.abs(Number(V)),m%1===0&&y%1===0&&V%1===0?(m<=y?(y++,b=m===0&&V===1?y:m+", "+y,V!==1&&(b+=", "+V)):(y--,b=m+", "+y+", -"+V),b="range("+b+")"):(b=mb?E.UNARY_SIGN:E.ATOMIC,[b,O]},D=function(b,O){var _={ADD:[" + ",E.ADDITIVE],MINUS:[" - ",E.ADDITIVE],MULTIPLY:[" * ",E.MULTIPLICATIVE],DIVIDE:[" / ",E.MULTIPLICATIVE],POWER:[" ** ",E.EXPONENTIATION]}[b.getFieldValue("OP")];const m=_[0];_=_[1];const y=O.valueToCode(b,"A",_)||"0";return b=O.valueToCode(b,"B",_)||"0",[y+m+b,_]},B=function(b,O){const _=b.getFieldValue("OP");let m;if(_==="NEG")return m=O.valueToCode(b,"NUM",E.UNARY_SIGN)||"0",["-"+m,E.UNARY_SIGN];switch(O.definitions_.import_math="import math",b=_==="SIN"||_==="COS"||_==="TAN"?O.valueToCode(b,"NUM",E.MULTIPLICATIVE)||"0":O.valueToCode(b,"NUM",E.NONE)||"0",_){case"ABS":m="math.fabs("+b+")";break;case"ROOT":m="math.sqrt("+b+")";break;case"LN":m="math.log("+b+")";break;case"LOG10":m="math.log10("+b+")";break;case"EXP":m="math.exp("+b+")";break;case"POW10":m="math.pow(10,"+b+")";break;case"ROUND":m="round("+b+")";break;case"ROUNDUP":m="math.ceil("+b+")";break;case"ROUNDDOWN":m="math.floor("+b+")";break;case"SIN":m="math.sin("+b+" / 180.0 * math.pi)";break;case"COS":m="math.cos("+b+" / 180.0 * math.pi)";break;case"TAN":m="math.tan("+b+" / 180.0 * math.pi)"}if(m)return[m,E.FUNCTION_CALL];switch(_){case"ASIN":m="math.asin("+b+") / math.pi * 180";break;case"ACOS":m="math.acos("+b+") / math.pi * 180";break;case"ATAN":m="math.atan("+b+") / math.pi * 180";break;default:throw Error("Unknown math operator: "+_)}return[m,E.MULTIPLICATIVE]},ae=function(b,O){const _={PI:["math.pi",E.MEMBER],E:["math.e",E.MEMBER],GOLDEN_RATIO:["(1 + math.sqrt(5)) / 2",E.MULTIPLICATIVE],SQRT2:["math.sqrt(2)",E.MEMBER],SQRT1_2:["math.sqrt(1.0 / 2)",E.MEMBER],INFINITY:["float('inf')",E.ATOMIC]};return b=b.getFieldValue("CONSTANT"),b!=="INFINITY"&&(O.definitions_.import_math="import math"),_[b]},_e=function(b,O){var _={EVEN:[" % 2 == 0",E.MULTIPLICATIVE,E.RELATIONAL],ODD:[" % 2 == 1",E.MULTIPLICATIVE,E.RELATIONAL],WHOLE:[" % 1 == 0",E.MULTIPLICATIVE,E.RELATIONAL],POSITIVE:[" > 0",E.RELATIONAL,E.RELATIONAL],NEGATIVE:[" < 0",E.RELATIONAL,E.RELATIONAL],DIVISIBLE_BY:[null,E.MULTIPLICATIVE,E.RELATIONAL],PRIME:[null,E.NONE,E.FUNCTION_CALL]};const m=b.getFieldValue("PROPERTY"),[y,V,ve]=_[m];if(_=O.valueToCode(b,"NUMBER_TO_CHECK",V)||"0",m==="PRIME")O.definitions_.import_math="import math",O.definitions_.from_numbers_import_Number="from numbers import Number",b=O.provideFunction_("math_isPrime",`
+def ${O.FUNCTION_NAME_PLACEHOLDER_}(n):
+ # https://en.wikipedia.org/wiki/Primality_test#Naive_methods
+ # If n is not a number but a string, try parsing it.
+ if not isinstance(n, Number):
+ try:
+ n = float(n)
+ except:
+ return False
+ if n == 2 or n == 3:
+ return True
+ # False if n is negative, is 1, or not whole, or if n is divisible by 2 or 3.
+ if n <= 1 or n % 1 != 0 or n % 2 == 0 or n % 3 == 0:
+ return False
+ # Check all the numbers of form 6k +/- 1, up to sqrt(n).
+ for x in range(6, int(math.sqrt(n)) + 2, 6):
+ if n % (x - 1) == 0 or n % (x + 1) == 0:
+ return False
+ return True
+`)+"("+_+")";else if(m==="DIVISIBLE_BY"){if(b=O.valueToCode(b,"DIVISOR",E.MULTIPLICATIVE)||"0",b==="0")return["False",E.ATOMIC];b=_+" % "+b+" == 0"}else b=_+y;return[b,ve]},Me=function(b,O){O.definitions_.from_numbers_import_Number="from numbers import Number";const _=O.valueToCode(b,"DELTA",E.ADDITIVE)||"0";return b=O.nameDB_.getName(b.getFieldValue("VAR"),l.NameType$$module$build$src$core$names.VARIABLE),b+" = ("+b+" if isinstance("+b+", Number) else 0) + "+_+`
+`},Xe=function(b,O){const _=b.getFieldValue("OP");switch(b=O.valueToCode(b,"LIST",E.NONE)||"[]",_){case"SUM":O="sum("+b+")";break;case"MIN":O="min("+b+")";break;case"MAX":O="max("+b+")";break;case"AVERAGE":O.definitions_.from_numbers_import_Number="from numbers import Number",O=O.provideFunction_("math_mean",`
+def ${O.FUNCTION_NAME_PLACEHOLDER_}(myList):
+ localList = [e for e in myList if isinstance(e, Number)]
+ if not localList: return
+ return float(sum(localList)) / len(localList)
+`)+"("+b+")";break;case"MEDIAN":O.definitions_.from_numbers_import_Number="from numbers import Number",O=O.provideFunction_("math_median",`
+def ${O.FUNCTION_NAME_PLACEHOLDER_}(myList):
+ localList = sorted([e for e in myList if isinstance(e, Number)])
+ if not localList: return
+ if len(localList) % 2 == 0:
+ return (localList[len(localList) // 2 - 1] + localList[len(localList) // 2]) / 2.0
+ else:
+ return localList[(len(localList) - 1) // 2]
+`)+"("+b+")";break;case"MODE":O=O.provideFunction_("math_modes",`
+def ${O.FUNCTION_NAME_PLACEHOLDER_}(some_list):
+ modes = []
+ # Using a lists of [item, count] to keep count rather than dict
+ # to avoid "unhashable" errors when the counted item is itself a list or dict.
+ counts = []
+ maxCount = 1
+ for item in some_list:
+ found = False
+ for count in counts:
+ if count[0] == item:
+ count[1] += 1
+ maxCount = max(maxCount, count[1])
+ found = True
+ if not found:
+ counts.append([item, 1])
+ for counted_item, item_count in counts:
+ if item_count == maxCount:
+ modes.append(counted_item)
+ return modes
+`)+"("+b+")";break;case"STD_DEV":O.definitions_.import_math="import math",O=O.provideFunction_("math_standard_deviation",`
+def ${O.FUNCTION_NAME_PLACEHOLDER_}(numbers):
+ n = len(numbers)
+ if n == 0: return
+ mean = float(sum(numbers)) / n
+ variance = sum((x - mean) ** 2 for x in numbers) / n
+ return math.sqrt(variance)
+`)+"("+b+")";break;case"RANDOM":O.definitions_.import_random="import random",O="random.choice("+b+")";break;default:throw Error("Unknown operator: "+_)}return[O,E.FUNCTION_CALL]},Je=function(b,O){const _=O.valueToCode(b,"DIVIDEND",E.MULTIPLICATIVE)||"0";return b=O.valueToCode(b,"DIVISOR",E.MULTIPLICATIVE)||"0",[_+" % "+b,E.MULTIPLICATIVE]},we=function(b,O){const _=O.valueToCode(b,"VALUE",E.NONE)||"0",m=O.valueToCode(b,"LOW",E.NONE)||"0";return b=O.valueToCode(b,"HIGH",E.NONE)||"float('inf')",["min(max("+_+", "+m+"), "+b+")",E.FUNCTION_CALL]},We=function(b,O){O.definitions_.import_random="import random";const _=O.valueToCode(b,"FROM",E.NONE)||"0";return b=O.valueToCode(b,"TO",E.NONE)||"0",["random.randint("+_+", "+b+")",E.FUNCTION_CALL]},Ze=function(b,O){return O.definitions_.import_random="import random",["random.random()",E.FUNCTION_CALL]},nt=function(b,O){O.definitions_.import_math="import math";const _=O.valueToCode(b,"X",E.NONE)||"0";return["math.atan2("+(O.valueToCode(b,"Y",E.NONE)||"0")+", "+_+") / math.pi * 180",E.MULTIPLICATIVE]},ht=function(b,O){var _=[],m=b.workspace,y=l.allUsedVarModels$$module$build$src$core$variables(m)||[];for(let Be=0,wt;wt=y[Be];Be++){var V=wt.name;b.getVars().indexOf(V)===-1&&_.push(O.nameDB_.getName(V,l.NameType$$module$build$src$core$names.VARIABLE))}for(m=l.allDeveloperVariables$$module$build$src$core$variables(m),y=0;y_?"int("+b+" - "+-_+")":"int("+b+")",m&&(b="-"+b)),b}},k={};k.colour_blend=h,k.colour_picker=a,k.colour_random=u,k.colour_rgb=d;var W={};W.lists_create_empty=p,W.lists_create_with=f,W.lists_getIndex=x,W.lists_getSublist=oe,W.lists_indexOf=P,W.lists_isEmpty=S,W.lists_length=C,W.lists_repeat=T,W.lists_reverse=Y,W.lists_setIndex=G,W.lists_sort=ne,W.lists_split=Z;var J={};J.controls_if=M,J.controls_ifelse=M,J.logic_boolean=z,J.logic_compare=L,J.logic_negate=F,J.logic_null=X,J.logic_operation=R,J.logic_ternary=le;var Ee={};Ee.controls_flow_statements=re,Ee.controls_for=fe,Ee.controls_forEach=ke,Ee.controls_repeat=$e,Ee.controls_repeat_ext=$e,Ee.controls_whileUntil=he;var ze={};ze.math_arithmetic=D,ze.math_atan2=nt,ze.math_change=Me,ze.math_constant=ae,ze.math_constrain=we,ze.math_modulo=Je,ze.math_number=Ie,ze.math_number_property=_e,ze.math_on_list=Xe,ze.math_random_float=Ze,ze.math_random_int=We,ze.math_round=B,ze.math_single=B,ze.math_trig=B;var yt={};yt.procedures_callnoreturn=xe,yt.procedures_callreturn=et,yt.procedures_defnoreturn=ht,yt.procedures_defreturn=ht,yt.procedures_ifreturn=w;var ls=/^\s*'([^']|\\')*'\s*$/,ii=function(b){return ls.test(b)?[b,E.ATOMIC]:["str("+b+")",E.FUNCTION_CALL]},xt={};xt.text=I,xt.text_append=K,xt.text_changeCase=ce,xt.text_charAt=se,xt.text_count=be,xt.text_getSubstring=Ce,xt.text_indexOf=Te,xt.text_isEmpty=de,xt.text_join=A,xt.text_length=U,xt.text_multiline=N,xt.text_print=Ne,xt.text_prompt=He,xt.text_prompt_ext=He,xt.text_replace=ee,xt.text_reverse=ie,xt.text_trim=Se;var Qo={};Qo.variables_get=ue,Qo.variables_set=ye;var Ht={};Ht.variables_get_dynamic=ue,Ht.variables_set_dynamic=ye;var ws=new g;ws.addReservedWords("math,random,Number"),Object.assign(ws.forBlock,k,W,J,Ee,ze,yt,xt,Qo,Ht);var qo={};return qo.Order=E,qo.PythonGenerator=g,qo.pythonGenerator=ws,qo.__namespace__=l,qo})}(h0)),h0.exports}(function(o,n){(function(s,l){o.exports=l(Gc(),a8())})(Do,function(s,l){/**
+ * @license
+ * Copyright 2020 Google LLC
+ * SPDX-License-Identifier: Apache-2.0
+ */return l})})(o2);var Ve=o2.exports;function tr(o){return/^\d+$/.test(o)}Ve.pythonGenerator.forBlock.controls_forever=function(o,n){return`while True:
+`+n.statementToCode(o,"DO")};Ve.pythonGenerator.forBlock.math_evenly_divisible=function(o,n){const s=n.valueToCode(o,"DIVIDEND",Ve.Order.NONE)||"0",l=n.valueToCode(o,"DIVISOR",Ve.Order.NONE)||"1";return[s+" % "+l+" == 0",Ve.Order.NONE]};Ve.pythonGenerator.forBlock.text_charAt=function(o,n){const s=n.valueToCode(o,"VALUE",Ve.Order.NONE)||"''";let l=n.valueToCode(o,"AT",Ve.Order.NONE)||"1";return o.getFieldValue("WHERE")==="FROM_START"?l=tr(l)?Number(l)-1:l+" - 1":o.getFieldValue("WHERE")==="FROM_END"&&(l=s+".length - "+l),[s+"["+l+"]",Ve.Order.NONE]};Ve.pythonGenerator.forBlock.text_getSubstring=function(o,n){const s=n.valueToCode(o,"STRING",Ve.Order.NONE)||"''";let l=n.valueToCode(o,"WHERE1",Ve.Order.NONE)||"1",a=n.valueToCode(o,"WHERE2",Ve.Order.NONE)||"1";return o.getFieldValue("WHERE1")==="FROM_START"?l=tr(l)?Number(l)-1:l+" - 1":o.getFieldValue("WHERE1")==="FROM_END"&&(l=s+".length - "+l),o.getFieldValue("WHERE2")==="FROM_END"&&(a=tr(a)?Number(a)-1:a+" - 1",a=s+".length - "+a),[s+"["+l+":"+a+"]",Ve.Order.NONE]};Ve.pythonGenerator.forBlock.math_types=function(o,n){const s={STRING:"str",NUMBER:"float",BOOLEAN:"bool"},l=n.valueToCode(o,"VALUE",Ve.Order.NONE)||"";return[s[o.getFieldValue("TYPE")]+"("+l+")",Ve.Order.NONE]};Ve.pythonGenerator.forBlock.lists_push=function(o,n){const s=n.valueToCode(o,"ITEM",Ve.Order.NONE)||"";return(n.valueToCode(o,"LIST",Ve.Order.NONE)||"[]")+".append("+s+")"};Ve.pythonGenerator.forBlock.lists_insert=function(o,n){const s=n.valueToCode(o,"ITEM",Ve.Order.NONE)||"None",l=n.valueToCode(o,"LIST",Ve.Order.NONE)||"[]";let a=n.valueToCode(o,"AT",Ve.Order.NONE)||"1";return o.getFieldValue("WHERE")==="FROM_START"?a=tr(a)?Number(a)-1:a+" - 1":o.getFieldValue("WHERE")==="FROM_END"&&(a=l+".length - "+a),l+".insert("+a+", "+s+")"};Ve.pythonGenerator.forBlock.lists_delete=function(o,n){const s=n.valueToCode(o,"LIST",Ve.Order.NONE)||"[]";let l=n.valueToCode(o,"AT",Ve.Order.NONE)||"1";return o.getFieldValue("WHERE")==="FROM_START"?l=tr(l)?Number(l)-1:l+" - 1":o.getFieldValue("WHERE")==="FROM_END"&&(l=s+".length - "+l),s+".pop("+l+")"};Ve.pythonGenerator.forBlock.lists_set=function(o,n){const s=n.valueToCode(o,"LIST",Ve.Order.NONE)||"[]",l=n.valueToCode(o,"TO",Ve.Order.NONE)||"None";let a=n.valueToCode(o,"AT",Ve.Order.NONE)||"1";return o.getFieldValue("WHERE")==="FROM_START"?a=tr(a)?Number(a)-1:a+" - 1":o.getFieldValue("WHERE")==="FROM_END"&&(a=s+".length - "+a),s+"["+a+"] = "+l};Ve.pythonGenerator.forBlock.lists_get=function(o,n){const s=n.valueToCode(o,"LIST",Ve.Order.NONE)||"[]";let l=n.valueToCode(o,"AT",Ve.Order.NONE)||"1";return o.getFieldValue("WHERE")==="FROM_START"?l=tr(l)?Number(l)-1:l+" - 1":o.getFieldValue("WHERE")==="FROM_END"&&(l=s+".length - "+l),[s+"["+l+"]",Ve.Order.NONE]};Ve.pythonGenerator.forBlock.lists_index=function(o,n){const s=n.valueToCode(o,"LIST",Ve.Order.NONE)||"[]",l=n.valueToCode(o,"VALUE",Ve.Order.NONE)||"''";let a;return o.getFieldValue("WHERE")==="FROM_START"?a=s+".index("+l+") + 1":o.getFieldValue("WHERE")==="FROM_END"&&(a=s+".rindex("+l+") + 1"),[a,Ve.Order.NONE]};Ve.pythonGenerator.forBlock.lists_includes=function(o,n){const s=n.valueToCode(o,"LIST",Ve.Order.NONE)||"[]",l=n.valueToCode(o,"VALUE",Ve.Order.NONE)||"''";return[s+".count("+l+") > 0",Ve.Order.NONE]};Ve.pythonGenerator.forBlock.lists_length=function(o,n){return[(n.valueToCode(o,"LIST",Ve.Order.NONE)||"[]")+".length",Ve.Order.NONE]};Ve.pythonGenerator.forBlock.time_current=function(){return["time.time()",Ve.Order.NONE]};Ve.pythonGenerator.forBlock.time_timestamp_to_date=function(o,n){return["datetime.datetime.fromtimestamp("+(n.valueToCode(o,"TIMESTAMP",Ve.Order.NONE)||"0")+').strftime("%Y-%m-%d %H:%M:%S")',Ve.Order.NONE]};Ve.pythonGenerator.forBlock.time_import=function(){return`import time
+`};Ve.pythonGenerator.forBlock.http_import=function(){return`import requests
+`};Ve.pythonGenerator.forBlock.http_get=function(o,n){const s=n.valueToCode(o,"URL",Ve.Order.NONE)||"''",l=n.valueToCode(o,"HEADERS",Ve.Order.NONE)||"{}",a=n.valueToCode(o,"COOKIES",Ve.Order.NONE)||"{}";return["requests.get("+s+", headers="+l+", cookies="+a+")",Ve.Order.NONE]};Ve.pythonGenerator.forBlock.http_post=function(o,n){const s=n.valueToCode(o,"URL",Ve.Order.NONE)||"''",l=n.valueToCode(o,"HEADERS",Ve.Order.NONE)||"{}",a=n.valueToCode(o,"COOKIES",Ve.Order.NONE)||"{}",u=n.valueToCode(o,"DATA",Ve.Order.NONE)||"{}";return["requests.post("+s+", headers="+l+", cookies="+a+", data="+u+")",Ve.Order.NONE]};Ve.pythonGenerator.forBlock.dict_create=function(){return["dict()",Ve.Order.NONE]};Ve.pythonGenerator.forBlock.dict_set=function(o,n){const s=n.valueToCode(o,"KEY",Ve.Order.NONE)||"''",l=n.valueToCode(o,"VALUE",Ve.Order.NONE)||"''";return(n.valueToCode(o,"DICT",Ve.Order.NONE)||"{}")+"["+s+"] = "+l};Ve.pythonGenerator.forBlock.set_dict=function(o,n){const s=n.valueToCode(o,"KEY",Ve.Order.NONE)||"''",l=n.valueToCode(o,"VALUE",Ve.Order.NONE)||"''";return"{"+s+":"+l+"}"};Ve.pythonGenerator.forBlock.dict_get=function(o,n){const s=n.valueToCode(o,"KEY",Ve.Order.NONE)||"''";return[(n.valueToCode(o,"DICT",Ve.Order.NONE)||"{}")+"["+s+"]",Ve.Order.NONE]};var Ns=(o,n)=>{const s=o.__vccOpts||o;for(const[l,a]of n)s[l]=a;return s};const u8={name:"IconDark",props:{prefix:{type:String,default:"boxy"},useCurrentColor:{type:Boolean,default:!0}}},d8=["fill"],h8=Le("defs",null,[Le("clipPath",{id:"svg_a82fd95db1__a"},[Le("rect",{width:"48",height:"48",rx:"0"})])],-1),p8=Le("g",{"clip-path":"url(#svg_a82fd95db1__a)"},[Le("path",{d:"M28.4559,2.45191Q26.2603,2,24,2Q19.525399999999998,2,15.436,3.72969Q11.48756,5.39973,8.44365,8.44365Q5.39973,11.48757,3.729689,15.436Q2,19.525399999999998,2,24Q2,28.4746,3.72969,32.564Q5.39973,36.5124,8.44365,39.5564Q11.48757,42.6003,15.436,44.2703Q19.525399999999998,46,24,46Q28.4746,46,32.564,44.2703Q36.5124,42.6003,39.5564,39.5564Q42.6003,36.5124,44.2703,32.564Q46,28.4746,46,24Q46,21.7397,45.548,19.544Q45.5199,19.407600000000002,45.4732,19.2763Q45.4265,19.1451,45.362,19.0216Q45.2975,18.8981,45.2165,18.7847Q45.1355,18.6714,45.0396,18.5703Q44.9437,18.4693,44.8347,18.3825Q44.7257,18.2958,44.6057,18.224899999999998Q44.4857,18.1541,44.3571,18.1006Q44.2285,18.0471,44.0936,18.012Q43.9986,17.9872,43.9015,17.971899999999998Q43.8045,17.9565,43.7064,17.950699999999998Q43.6083,17.945,43.5101,17.948900000000002Q43.4119,17.9527,43.3146,17.9662Q43.2173,17.9797,43.1218,18.0027Q43.0262,18.0256,42.9334,18.0578Q42.8406,18.0901,42.7514,18.1312Q42.6621,18.1724,42.5774,18.222099999999998Q42.4926,18.2718,42.4132,18.3295Q42.3337,18.3873,42.2602,18.4526Q42.1868,18.517899999999997,42.1201,18.59Q42.0535,18.6622,41.9942,18.7406Q41.9349,18.8189,41.8836,18.9027Q41.8323,18.9865,41.7894,19.0749Q41.7465,19.1633,41.7126,19.255499999999998Q41.6786,19.3477,41.6538,19.4428Q40.7431,22.9361,37.8816,25.1777Q34.9751,27.4545,31.2727,27.4545Q29.0889,27.4545,27.0978,26.6123Q25.1731,25.7983,23.6874,24.3126Q22.2017,22.8269,21.3877,20.9022Q20.5455,18.911099999999998,20.5455,16.7273Q20.5455,13.02491,22.8223,10.118459999999999Q25.0639,7.2569300000000005,28.5573,6.346159999999999Q28.6921,6.31101,28.8207,6.25751Q28.9494,6.20401,29.0693,6.13319Q29.1893,6.06237,29.2983,5.9756Q29.4073,5.8888300000000005,29.5032,5.78778Q29.5992,5.68674,29.6801,5.57337Q29.7611,5.46,29.8256,5.3365Q29.8901,5.213,29.9368,5.0817499999999995Q29.9836,4.9505040000000005,30.0116,4.814043Q30.0513,4.621105,30.0527,4.424127Q30.054,4.227148,30.0168,4.0336998Q29.9797,3.840251,29.9055,3.6577669999999998Q29.8313,3.475282,29.723,3.310774Q29.6146,3.146266,29.4763,3.006056Q29.3379,2.86585,29.1749,2.75532Q29.0118,2.6448,28.8303,2.56821Q28.6488,2.49162,28.4559,2.45191ZM20.8976,6.26333Q18.894,6.6101399999999995,16.9942,7.41371Q13.76432,8.77983,11.272079999999999,11.272079999999999Q8.77983,13.76432,7.41371,16.9942Q6,20.3366,6,24Q6,27.6634,7.41371,31.0058Q8.77983,34.2357,11.272079999999999,36.7279Q13.76433,39.2202,16.9942,40.5863Q20.3366,42,24,42Q27.6634,42,31.0058,40.5863Q34.2357,39.2202,36.7279,36.7279Q39.2202,34.2357,40.5863,31.0058Q41.3899,29.106,41.7367,27.1024Q41.0902,27.7453,40.3483,28.3265Q36.3553,31.4545,31.2727,31.4545Q28.2778,31.4545,25.5396,30.2964Q22.8963,29.1783,20.859,27.141Q18.8216,25.1037,17.7036,22.4604Q16.5455,19.7222,16.5455,16.7273Q16.5455,11.6447,19.6735,7.65174Q20.2547,6.90977,20.8976,6.26333Z","fill-rule":"evenodd"})],-1),$8=[h8,p8];function _8(o,n,s,l,a,u){return me(),Fe("svg",Ot({xmlns:"http://www.w3.org/2000/svg",fill:s.useCurrentColor?"currentColor":"#000",viewBox:"0 0 48 48",class:[`${s.prefix}-icon`,`${s.prefix}-icon-dark`],width:"1em",height:"1em"},o.$attrs),$8,16,d8)}var g8=Ns(u8,[["render",_8]]);const f8={name:"IconCode",props:{prefix:{type:String,default:"boxy"},useCurrentColor:{type:Boolean,default:!0}}},m8=["fill"],T8=Le("defs",null,[Le("clipPath",{id:"svg_c13367945d__a"},[Le("rect",{width:"48",height:"48",rx:"0"})])],-1),E8=Le("g",{"clip-path":"url(#svg_c13367945d__a)","fill-rule":"evenodd"},[Le("path",{d:"M13.6112 38.4392L13.6119 38.4399Q13.7504 38.5734 13.9118 38.6781 14.0732 38.7827 14.2516 38.8547 14.43 38.9267 14.6188 38.963300000000004 14.8076 39 15 39 15.0183 39 15.0367 38.999700000000004 15.2336 38.9961 15.4261 38.9541 15.6185 38.912099999999995 15.7991 38.8334 15.9797 38.7547 16.1414 38.6423 16.3032 38.5299 16.4399 38.3881 16.5734 38.2496 16.6781 38.0882 16.7827 37.9268 16.8547 37.748400000000004 16.9267 37.57 16.9633 37.3812 17 37.1924 17 37 17 36.981700000000004 16.9997 36.963300000000004 16.9961 36.766400000000004 16.9541 36.573899999999995 16.912100000000002 36.3815 16.833399999999997 36.200900000000004 16.7547 36.0203 16.6423 35.858599999999996 16.529899999999998 35.696799999999996 16.3881 35.5601L16.3873 35.5594 5.8288899999999995 25.3812 16.438200000000002 14.38983 16.439 14.38898Q16.572699999999998 14.25047 16.677500000000002 14.088989999999999 16.782400000000003 13.927508 16.8545 13.748998 16.9266 13.570489 16.9633 13.381504 17 13.19252 17 13.000000000000012 17 12.9823145 16.9997 12.9646317 16.9962 12.76768 16.9544 12.575192 16.9125 12.382703 16.8339 12.202077 16.7553 12.02145 16.643 11.85963 16.5307 11.6978 16.389 11.561 16.250500000000002 11.4273 16.089 11.32247 15.9275 11.217649999999999 15.749 11.14555 15.5705 11.07345 15.3815 11.03672 15.1925 11 15 11L14.9976 11Q14.9811 11.00002 14.9646 11.00031 14.7677 11.0038 14.5752 11.04564 14.3827 11.08748 14.2021 11.16606 14.0215 11.24465 13.8596 11.35697 13.6978 11.46929 13.561 11.61102L13.5602 11.61187 1.561 24.043100000000003 1.5601 24.0441Q1.42339 24.1859 1.31697 24.3517 1.21055 24.517400000000002 1.13852 24.7008 1.06649 24.8841 1.03161 25.078.9967299999999999 25.2718 1.00034 25.4688 1.00395 25.6657 1.04591 25.8582 1.08788 26.0507 1.16658 26.2312 1.24529 26.4118 1.35771 26.5736 1.47013 26.735300000000002 1.61195 26.872L13.6112 38.4392zM31.6128 35.5593L31.61195 35.5601Q31.47013 35.696799999999996 31.35771 35.858599999999996 31.24529 36.0203 31.16658 36.200900000000004 31.08788 36.3815 31.04591 36.573899999999995 31.00395 36.766400000000004 31.00034 36.963300000000004 31 36.981700000000004 31 37 31 37.0297 31.00088 37.0594 31.00638 37.2442 31.04565 37.4249 31.08491 37.6055 31.15663 37.7759 31.22834 37.9463 31.33007 38.1006 31.4318 38.254999999999995 31.5601 38.3881 31.70002 38.5332 31.8661 38.6475 32.032178 38.7618 32.217728 38.8407 32.403278 38.9195 32.600833 38.9598 32.798388 39 33 39 33.03343 39 33.066851 38.9989 33.250672 38.9927 33.430289 38.953199999999995 33.609906 38.9136 33.779294 38.841899999999995 33.948681 38.7703 34.10216 38.6689 34.25563 38.5676 34.38805 38.4399L34.3889 38.439099999999996 46.3881 26.872Q46.5299 26.735300000000002 46.6423 26.5736 46.7547 26.4118 46.8334 26.2312 46.9121 26.0507 46.9541 25.8582 46.9961 25.6657 46.999700000000004 25.4688 47.003299999999996 25.2718 46.9684 25.078 46.9335 24.8841 46.8615 24.7008 46.7894 24.517400000000002 46.683 24.3517 46.5766 24.1859 46.4399 24.0441L46.439 24.043100000000003 34.4391 11.61111 34.439 11.61102Q34.2991 11.46607 34.1331 11.351939999999999 33.9671 11.23781 33.781676 11.15908 33.596251 11.08035 33.398849 11.04017 33.201448 11 32.999999999999986 11 32.9659166 11 32.9318531 11.00116 32.748036 11.00743 32.568444 11.04711 32.388853 11.0868 32.219512 11.15858 32.050171 11.23035 31.89676 11.33181 31.74335 11.43326 31.61102 11.561 31.46607 11.7009 31.35194 11.8669 31.23781 12.0329 31.15908 12.218323999999999 31.08035 12.403749 31.04017 12.601151 31 12.798552 31 13 31 13.0340834 31.00116 13.0681469 31.00743 13.251964 31.04711 13.431556 31.0868 13.611147 31.15858 13.780488 31.23035 13.949829 31.33181 14.10324 31.43326 14.25665 31.561 14.38898L31.56109 14.38908 42.17111 25.3812 31.6128 35.5593zM26.02983 3.655886L19.02994 43.6552Q19 43.8263 19 44L19.00009 44.0195Q19.00094 44.1063 19.0093 44.1926 19.01766 44.279 19.03347 44.3644 19.04929 44.4497 19.07243 44.5334 19.095579999999998 44.617 19.12588 44.6984 19.15619 44.7797 19.19343 44.8581 19.23067 44.9365 19.27455 45.0114 19.31844 45.0862 19.36865 45.157 19.41887 45.2278 19.47502 45.294 19.53118 45.3602 19.59285 45.4212 19.65453 45.4823 19.72126 45.5378 19.788 45.5933 19.85929 45.6428 19.93058 45.6923 20.005894 45.7354 20.081206 45.7786 20.159972 45.815 20.238738 45.8515 20.320366 45.881 20.401994 45.9105 20.48587 45.9328 20.569746 45.9551 20.655239 45.9701 20.82632 46 21 46 21.0211794 46 21.0423827 45.9996 21.339964 45.9932 21.622812 45.9006 21.905661 45.8079 22.149259999999998 45.6368 22.31047 45.5236 22.44651 45.3812 22.58254 45.2387 22.68816 45.0724 22.79379 44.9062 22.86495 44.7225 22.9361 44.5388 22.97006 44.3448L29.97006 4.344761Q30 4.173682 30 4.0000044183 30 3.9788062 29.99955 3.9576172 29.99324 3.660036 29.900550000000003 3.377187 29.807859999999998 3.0943389999999997 29.63683 2.85074 29.52363 2.68953 29.38116 2.55349 29.2387 2.41746 29.07243 2.31184 28.90616 2.20621 28.72248 2.1350499999999997 28.53879 2.0639000000000003 28.34476 2.02994 28.17368 2 28 2L27.98053 2.00009Q27.89374 2.00094 27.80735 2.0093 27.720959999999998 2.0176600000000002 27.63562 2.0334700000000003 27.55028 2.04929 27.466630000000002 2.0724299999999998 27.38298 2.09558 27.301650000000002 2.12588 27.22032 2.15619 27.14192 2.19343 27.06352 2.23067 26.98865 2.27455 26.91377 2.31844 26.84297 2.3686499999999997 26.77218 2.41887 26.706 2.4750199999999998 26.63982 2.53118 26.57876 2.5928500000000003 26.51769 2.6545300000000003 26.4622 2.72126 26.40671 2.7880000000000003 26.3572 2.85929 26.3077 2.93058 26.26456 3.005894 26.221420000000002 3.081206 26.18497 3.159972 26.14851 3.238738 26.11902 3.320366 26.08952 3.401994 26.06721 3.4858700000000002 26.0449 3.569746 26.02994 3.655239L26.02983 3.655886z"})],-1),b8=[T8,E8];function v8(o,n,s,l,a,u){return me(),Fe("svg",Ot({xmlns:"http://www.w3.org/2000/svg",fill:s.useCurrentColor?"currentColor":"#000",viewBox:"0 0 48 48",class:[`${s.prefix}-icon`,`${s.prefix}-icon-code`],width:"1em",height:"1em"},o.$attrs),b8,16,m8)}var I8=Ns(f8,[["render",v8]]);const O8={name:"IconBigger",props:{prefix:{type:String,default:"boxy"},useCurrentColor:{type:Boolean,default:!0}}},C8=["fill"],y8=ld('',2),S8=[y8];function R8(o,n,s,l,a,u){return me(),Fe("svg",Ot({xmlns:"http://www.w3.org/2000/svg",fill:s.useCurrentColor?"currentColor":"#000",viewBox:"0 0 48 48",class:[`${s.prefix}-icon`,`${s.prefix}-icon-bigger`],width:"1em",height:"1em"},o.$attrs),S8,16,C8)}var k8=Ns(O8,[["render",R8]]);const A8={name:"IconSmaller",props:{prefix:{type:String,default:"boxy"},useCurrentColor:{type:Boolean,default:!0}}},L8=["fill"],N8=Le("defs",null,[Le("clipPath",{id:"svg_23394313d7__a"},[Le("rect",{width:"48",height:"48",rx:"0"})])],-1),w8=Le("g",{"clip-path":"url(#svg_23394313d7__a)"},[Le("path",{d:"M6,26L42,26Q42.0983,26,42.196,25.99037Q42.2938,25.98074,42.3902,25.961570000000002Q42.4865,25.9424,42.5806,25.91388Q42.6746,25.88536,42.7654,25.84776Q42.8561,25.81016,42.9428,25.763840000000002Q43.0294,25.71753,43.1111,25.66294Q43.1928,25.60835,43.2688,25.54602Q43.3447,25.48369,43.4142,25.41421Q43.4837,25.34474,43.546,25.26879Q43.6083,25.19284,43.6629,25.11114Q43.7175,25.02945,43.7638,24.942793Q43.8102,24.856141,43.8478,24.765367Q43.8854,24.674592,43.9139,24.580569Q43.9424,24.486546,43.9616,24.390181Q43.9807,24.293815,43.9904,24.196034Q44,24.0982537,44,24Q44,23.9017463,43.9904,23.803966Q43.9807,23.706185,43.9616,23.609819Q43.9424,23.513454,43.9139,23.419431Q43.8854,23.325408,43.8478,23.234633Q43.8102,23.143859,43.7638,23.057207Q43.7175,22.97055,43.6629,22.88886Q43.6083,22.80716,43.546,22.73121Q43.4837,22.65526,43.4142,22.58579Q43.3447,22.51631,43.2688,22.45398Q43.1928,22.39165,43.1111,22.33706Q43.0294,22.28247,42.9428,22.236159999999998Q42.8561,22.18984,42.7654,22.15224Q42.6746,22.11464,42.5806,22.08612Q42.4865,22.0576,42.3902,22.038429999999998Q42.2938,22.01926,42.196,22.00963Q42.0983,22,42,22L6,22Q5.9017463,22,5.803966,22.00963Q5.706185,22.01926,5.609819,22.038429999999998Q5.513454,22.0576,5.419431,22.08612Q5.325408,22.11464,5.234633,22.15224Q5.143859,22.18984,5.057207,22.236159999999998Q4.97055,22.28247,4.88886,22.33706Q4.80716,22.39165,4.73121,22.45398Q4.65526,22.51631,4.58579,22.58579Q4.51631,22.65526,4.45398,22.73121Q4.39165,22.80716,4.33706,22.88886Q4.28247,22.97055,4.23616,23.057207Q4.18984,23.143859,4.15224,23.234633Q4.11464,23.325408,4.08612,23.419431Q4.0576,23.513454,4.03843,23.609819Q4.01926,23.706185,4.00963,23.803966Q4,23.9017463,4,24Q4,24.0982537,4.00963,24.196034Q4.01926,24.293815,4.03843,24.390181Q4.0576,24.486546,4.08612,24.580569Q4.11464,24.674592,4.15224,24.765367Q4.18984,24.856141,4.23616,24.942793Q4.28247,25.02945,4.33706,25.11114Q4.39165,25.19284,4.45398,25.26879Q4.51631,25.34474,4.58579,25.41421Q4.65526,25.48369,4.73121,25.54602Q4.80716,25.60835,4.88886,25.66294Q4.97055,25.71753,5.057207,25.763840000000002Q5.143859,25.81016,5.234633,25.84776Q5.325408,25.88536,5.419431,25.91388Q5.513454,25.9424,5.609819,25.961570000000002Q5.706185,25.98074,5.803966,25.99037Q5.9017463,26,6,26Z","fill-rule":"evenodd"})],-1),M8=[N8,w8];function D8(o,n,s,l,a,u){return me(),Fe("svg",Ot({xmlns:"http://www.w3.org/2000/svg",fill:s.useCurrentColor?"currentColor":"#000",viewBox:"0 0 48 48",class:[`${s.prefix}-icon`,`${s.prefix}-icon-smaller`],width:"1em",height:"1em"},o.$attrs),M8,16,L8)}var P8=Ns(A8,[["render",D8]]);const x8={name:"IconAuto",props:{prefix:{type:String,default:"boxy"},useCurrentColor:{type:Boolean,default:!0}}},B8=["fill"],F8=ld('',2),U8=[F8];function H8(o,n,s,l,a,u){return me(),Fe("svg",Ot({xmlns:"http://www.w3.org/2000/svg",fill:s.useCurrentColor?"currentColor":"#000",viewBox:"0 0 48 48",class:[`${s.prefix}-icon`,`${s.prefix}-icon-auto`],width:"1em",height:"1em"},o.$attrs),U8,16,B8)}var V8=Ns(x8,[["render",H8]]);const G8={name:"IconLight",props:{prefix:{type:String,default:"boxy"},useCurrentColor:{type:Boolean,default:!0}}},W8=["fill"],z8=ld('',2),X8=[z8];function j8(o,n,s,l,a,u){return me(),Fe("svg",Ot({xmlns:"http://www.w3.org/2000/svg",fill:s.useCurrentColor?"currentColor":"#000",viewBox:"0 0 48 48",class:[`${s.prefix}-icon`,`${s.prefix}-icon-light`],width:"1em",height:"1em"},o.$attrs),X8,16,W8)}var Y8=Ns(G8,[["render",j8]]);const K8={name:"IconClose",props:{prefix:{type:String,default:"boxy"},useCurrentColor:{type:Boolean,default:!0}}},Q8=["fill"],q8=ld('',2),J8=[q8];function Z8(o,n,s,l,a,u){return me(),Fe("svg",Ot({xmlns:"http://www.w3.org/2000/svg",fill:s.useCurrentColor?"currentColor":"#000",viewBox:"0 0 48 48",class:[`${s.prefix}-icon`,`${s.prefix}-icon-close`],width:"1em",height:"1em"},o.$attrs),J8,16,Q8)}var s2=Ns(K8,[["render",Z8]]);const eD={name:"IconDownload",props:{prefix:{type:String,default:"boxy"},useCurrentColor:{type:Boolean,default:!0}}},tD=["fill"],oD=Le("defs",null,[Le("clipPath",{id:"svg_fd45640674__a"},[Le("rect",{width:"48",height:"48",rx:"0"})])],-1),sD=Le("g",{"clip-path":"url(#svg_fd45640674__a)"},[Le("path",{d:"M26,26.3152L31.6577,20.6569L34.4863,23.4851L24.0022,33.9704L13.51586,23.4853L16.34414,20.6567L22,26.3119L22,5L26,5L26,26.3152ZM10,39L10,35L6,35L6,43L42,43L42,35L38,35L38,39L10,39Z","fill-rule":"evenodd"})],-1),iD=[oD,sD];function nD(o,n,s,l,a,u){return me(),Fe("svg",Ot({xmlns:"http://www.w3.org/2000/svg",fill:s.useCurrentColor?"currentColor":"#000",viewBox:"0 0 48 48",class:[`${s.prefix}-icon`,`${s.prefix}-icon-download`],width:"1em",height:"1em"},o.$attrs),iD,16,tD)}var rD=Ns(eD,[["render",nD]]);const lD={name:"IconCleanup",props:{prefix:{type:String,default:"boxy"},useCurrentColor:{type:Boolean,default:!0}}},cD=["fill"],aD=Le("defs",null,[Le("clipPath",{id:"svg_9a669f61db__a"},[Le("rect",{width:"48",height:"48",rx:"0"})])],-1),uD=Le("g",{"clip-path":"url(#svg_9a669f61db__a)","fill-rule":"evenodd"},[Le("path",{d:"M14 7L14 19Q14 19.098300000000002 14.00963 19.195999999999998 14.01926 19.293799999999997 14.03843 19.3902 14.0576 19.4865 14.08612 19.5806 14.11464 19.674599999999998 14.152239999999999 19.7654 14.18984 19.856099999999998 14.23616 19.9428 14.28247 20.029400000000003 14.33706 20.1111 14.39165 20.1928 14.45398 20.2688 14.51631 20.3447 14.58579 20.4142 14.65526 20.4837 14.73121 20.546 14.80716 20.6084 14.88886 20.6629 14.97055 20.7175 15.057207 20.7638 15.143858999999999 20.810200000000002 15.234633 20.8478 15.325408 20.8854 15.419431 20.913899999999998 15.513454 20.9424 15.609819 20.9616 15.706185 20.9807 15.803966 20.9904 15.9017463 21 16 21L42 21Q42.098299999999995 21 42.196 20.9904 42.293800000000005 20.9807 42.3902 20.9616 42.4865 20.9424 42.580600000000004 20.913899999999998 42.6746 20.8854 42.7654 20.8478 42.8561 20.810200000000002 42.9428 20.7638 43.029399999999995 20.7175 43.1111 20.6629 43.1928 20.6084 43.2688 20.546 43.3447 20.4837 43.4142 20.4142 43.4837 20.3447 43.546 20.2688 43.6084 20.1928 43.6629 20.1111 43.7175 20.029400000000003 43.7638 19.9428 43.810199999999995 19.856099999999998 43.8478 19.7654 43.885400000000004 19.674599999999998 43.9139 19.5806 43.9424 19.4865 43.961600000000004 19.3902 43.9807 19.293799999999997 43.9904 19.195999999999998 44 19.098300000000002 44 19L44 7Q44 6.9017463 43.9904 6.803966 43.9807 6.706185 43.961600000000004 6.609819 43.9424 6.513454 43.9139 6.419431 43.885400000000004 6.325408 43.8478 6.234633 43.810199999999995 6.143859 43.7638 6.057207 43.7175 5.97055 43.6629 5.88886 43.6084 5.80716 43.546 5.73121 43.4837 5.65526 43.4142 5.58579 43.3447 5.51631 43.2688 5.45398 43.1928 5.39165 43.1111 5.33706 43.029399999999995 5.28247 42.9428 5.23616 42.8561 5.18984 42.7654 5.15224 42.6746 5.11464 42.580600000000004 5.08612 42.4865 5.0576 42.3902 5.03843 42.293800000000005 5.01926 42.196 5.00963 42.098299999999995 5 42 5L16 5Q15.9017463 5 15.803966 5.00963 15.706185 5.01926 15.609819 5.03843 15.513454 5.0576 15.419431 5.08612 15.325408 5.11464 15.234633 5.15224 15.143858999999999 5.18984 15.057207 5.23616 14.97055 5.28247 14.88886 5.33706 14.80716 5.39165 14.73121 5.45398 14.65526 5.51631 14.58579 5.58579 14.51631 5.65526 14.45398 5.73121 14.39165 5.80716 14.33706 5.88886 14.28247 5.97055 14.23616 6.057207 14.18984 6.143859 14.152239999999999 6.234633 14.11464 6.325408 14.08612 6.419431 14.0576 6.513454 14.03843 6.609819 14.01926 6.706185 14.00963 6.803966 14 6.9017463 14 7zM18 17L18 9 40 9 40 17 18 17zM8 42L8 6Q8 5.9017463 7.99037 5.803966 7.98074 5.706185 7.96157 5.609819 7.9424 5.513454 7.91388 5.419431 7.88536 5.325408 7.84776 5.234633 7.81016 5.143859 7.76384 5.057207 7.71753 4.97055 7.66294 4.88886 7.60835 4.80716 7.54602 4.73121 7.48369 4.65526 7.41421 4.58579 7.34474 4.51631 7.26879 4.45398 7.19284 4.39165 7.11114 4.33706 7.02945 4.28247 6.942793 4.23616 6.856141 4.18984 6.765367 4.15224 6.674592 4.11464 6.580569 4.08612 6.486546 4.0576 6.390181 4.03843 6.293815 4.01926 6.196034 4.00963 6.0982537 4 6 4 5.9017463 4 5.803966 4.00963 5.706185 4.01926 5.609819 4.03843 5.513454 4.0576 5.419431 4.08612 5.325408 4.11464 5.234633 4.15224 5.143859 4.18984 5.057207 4.23616 4.97055 4.28247 4.88886 4.33706 4.80716 4.39165 4.73121 4.45398 4.65526 4.51631 4.58579 4.58579 4.51631 4.65526 4.45398 4.73121 4.39165 4.80716 4.33706 4.88886 4.28247 4.97055 4.23616 5.057207 4.18984 5.143859 4.15224 5.234633 4.11464 5.325408 4.08612 5.419431 4.0576 5.513454 4.03843 5.609819 4.01926 5.706185 4.00963 5.803966 4 5.9017463 4 6L4 42Q4 42.0983 4.00963 42.196 4.01926 42.2938 4.03843 42.3902 4.0576 42.4865 4.08612 42.5806 4.11464 42.6746 4.15224 42.7654 4.18984 42.8561 4.23616 42.9428 4.28247 43.0294 4.33706 43.1111 4.39165 43.1928 4.45398 43.2688 4.51631 43.3447 4.58579 43.4142 4.65526 43.4837 4.73121 43.546 4.80716 43.6083 4.88886 43.6629 4.97055 43.7175 5.057207 43.7638 5.143859 43.8102 5.234633 43.8478 5.325408 43.8854 5.419431 43.9139 5.513454 43.9424 5.609819 43.9616 5.706185 43.9807 5.803966 43.9904 5.9017463 44 6 44 6.0982537 44 6.196034 43.9904 6.293815 43.9807 6.390181 43.9616 6.486546 43.9424 6.580569 43.9139 6.674592 43.8854 6.765367 43.8478 6.856141 43.8102 6.942793 43.7638 7.02945 43.7175 7.11114 43.6629 7.19284 43.6083 7.26879 43.546 7.34474 43.4837 7.41421 43.4142 7.48369 43.3447 7.54602 43.2688 7.60835 43.1928 7.66294 43.1111 7.71753 43.0294 7.76384 42.9428 7.81016 42.8561 7.84776 42.7654 7.88536 42.6746 7.91388 42.5806 7.9424 42.4865 7.96157 42.3902 7.98074 42.2938 7.99037 42.196 8 42.0983 8 42zM14 29L14 41Q14 41.0983 14.00963 41.196 14.01926 41.2938 14.03843 41.3902 14.0576 41.4865 14.08612 41.580600000000004 14.11464 41.6746 14.152239999999999 41.7654 14.18984 41.8561 14.23616 41.9428 14.28247 42.0294 14.33706 42.1111 14.39165 42.1928 14.45398 42.2688 14.51631 42.3447 14.58579 42.4142 14.65526 42.4837 14.73121 42.546 14.80716 42.6084 14.88886 42.6629 14.97055 42.7175 15.057207 42.7638 15.143858999999999 42.8102 15.234633 42.8478 15.325408 42.885400000000004 15.419431 42.9139 15.513454 42.9424 15.609819 42.961600000000004 15.706185 42.9807 15.803966 42.9904 15.9017463 43 16 43L38 43Q38.098299999999995 43 38.196 42.9904 38.293800000000005 42.9807 38.3902 42.961600000000004 38.4865 42.9424 38.580600000000004 42.9139 38.6746 42.885400000000004 38.7654 42.8478 38.8561 42.8102 38.9428 42.7638 39.029399999999995 42.7175 39.1111 42.6629 39.1928 42.6084 39.2688 42.546 39.3447 42.4837 39.4142 42.4142 39.4837 42.3447 39.546 42.2688 39.6084 42.1928 39.6629 42.1111 39.7175 42.0294 39.7638 41.9428 39.810199999999995 41.8561 39.8478 41.7654 39.885400000000004 41.6746 39.9139 41.580600000000004 39.9424 41.4865 39.961600000000004 41.3902 39.9807 41.2938 39.9904 41.196 40 41.0983 40 41L40 29Q40 28.9017463 39.9904 28.803966 39.9807 28.706185 39.961600000000004 28.609819 39.9424 28.513454 39.9139 28.419431 39.885400000000004 28.325408 39.8478 28.234633 39.810199999999995 28.143859 39.7638 28.057207 39.7175 27.97055 39.6629 27.88886 39.6084 27.80716 39.546 27.73121 39.4837 27.65526 39.4142 27.58579 39.3447 27.51631 39.2688 27.45398 39.1928 27.39165 39.1111 27.33706 39.029399999999995 27.28247 38.9428 27.236159999999998 38.8561 27.18984 38.7654 27.15224 38.6746 27.11464 38.580600000000004 27.08612 38.4865 27.0576 38.3902 27.038429999999998 38.293800000000005 27.01926 38.196 27.00963 38.098299999999995 27 38 27L16 27Q15.9017463 27 15.803966 27.00963 15.706185 27.01926 15.609819 27.038429999999998 15.513454 27.0576 15.419431 27.08612 15.325408 27.11464 15.234633 27.15224 15.143858999999999 27.18984 15.057207 27.236159999999998 14.97055 27.28247 14.88886 27.33706 14.80716 27.39165 14.73121 27.45398 14.65526 27.51631 14.58579 27.58579 14.51631 27.65526 14.45398 27.73121 14.39165 27.80716 14.33706 27.88886 14.28247 27.97055 14.23616 28.057207 14.18984 28.143859 14.152239999999999 28.234633 14.11464 28.325408 14.08612 28.419431 14.0576 28.513454 14.03843 28.609819 14.01926 28.706185 14.00963 28.803966 14 28.9017463 14 29zM18 39L18 31 36 31 36 39 18 39z"})],-1),dD=[aD,uD];function hD(o,n,s,l,a,u){return me(),Fe("svg",Ot({xmlns:"http://www.w3.org/2000/svg",fill:s.useCurrentColor?"currentColor":"#000",viewBox:"0 0 48 48",class:[`${s.prefix}-icon`,`${s.prefix}-icon-cleanup`],width:"1em",height:"1em"},o.$attrs),dD,16,cD)}var pD=Ns(lD,[["render",hD]]);const $D={name:"IconDown",props:{prefix:{type:String,default:"boxy"},useCurrentColor:{type:Boolean,default:!0}}},_D=["fill"],gD=Le("defs",null,[Le("clipPath",{id:"svg_74e8333ad1__a"},[Le("rect",{width:"48",height:"48",rx:"0"})])],-1),fD=Le("g",{"clip-path":"url(#svg_74e8333ad1__a)"},[Le("path",{d:"M13.41445,16.58602L13.41421,16.58579Q13.27493,16.4465,13.11114,16.33706Q12.947355,16.22762,12.765367,16.15224Q12.583378,16.07686,12.390181,16.038429999999998Q12.196983,16,12,16Q11.803017,16,11.609819,16.038429999999998Q11.416622,16.07686,11.234633,16.15224Q11.052645,16.22762,10.88886,16.33706Q10.72507,16.4465,10.58579,16.58579Q10.4465,16.72507,10.33706,16.88886Q10.22762,17.052645,10.152239999999999,17.234633Q10.07686,17.416622,10.03843,17.609819Q10,17.803017,10,18Q10,18.196983,10.03843,18.390181Q10.07686,18.583378,10.152239999999999,18.765367Q10.22762,18.947355,10.33706,19.11114Q10.4465,19.27493,10.58579,19.41421L10.58602,19.41445L22.5858,31.4142Q22.725099999999998,31.5535,22.8889,31.6629Q23.052599999999998,31.772399999999998,23.2346,31.8478Q23.416600000000003,31.923099999999998,23.6098,31.9616Q23.803,32,24,32Q24.197,32,24.3902,31.9616Q24.583399999999997,31.923099999999998,24.7654,31.8478Q24.947400000000002,31.772399999999998,25.1111,31.6629Q25.274900000000002,31.5535,25.4142,31.4142L37.4135,19.41496L37.4142,19.41421Q37.5535,19.27493,37.6629,19.11114Q37.772400000000005,18.947355,37.8478,18.765367Q37.923100000000005,18.583378,37.961600000000004,18.390181Q38,18.196983,38,18Q38,17.803017,37.961600000000004,17.609819Q37.923100000000005,17.416621,37.8478,17.234633Q37.772400000000005,17.052645,37.6629,16.88886Q37.5535,16.72507,37.4142,16.58579Q37.2749,16.4465,37.1111,16.33706Q36.9474,16.22762,36.7654,16.15224Q36.5834,16.07686,36.3902,16.038429999999998Q36.197,16,36,16Q35.803,16,35.6098,16.038429999999998Q35.4166,16.07686,35.2346,16.15224Q35.0526,16.22762,34.8889,16.33706Q34.7251,16.4465,34.5858,16.58579L34.585,16.58654L24,27.17157L13.41445,16.58602Z","fill-rule":"evenodd"})],-1),mD=[gD,fD];function TD(o,n,s,l,a,u){return me(),Fe("svg",Ot({xmlns:"http://www.w3.org/2000/svg",fill:s.useCurrentColor?"currentColor":"#000",viewBox:"0 0 48 48",class:[`${s.prefix}-icon`,`${s.prefix}-icon-down`],width:"1em",height:"1em"},o.$attrs),mD,16,_D)}var ED=Ns($D,[["render",TD]]);const bD={name:"IconUp",props:{prefix:{type:String,default:"boxy"},useCurrentColor:{type:Boolean,default:!0}}},vD=["fill"],ID=Le("defs",null,[Le("clipPath",{id:"svg_46c48bec0d__a"},[Le("rect",{width:"48",height:"48",rx:"0"})])],-1),OD=Le("g",{"clip-path":"url(#svg_46c48bec0d__a)"},[Le("path",{d:"M34.5848,31.4132L34.5858,31.4142Q34.7251,31.5535,34.8889,31.6629Q35.0526,31.772399999999998,35.2346,31.8478Q35.4166,31.923099999999998,35.6098,31.9616Q35.803,32,36,32Q36.197,32,36.3902,31.9616Q36.5834,31.923099999999998,36.7654,31.8478Q36.9474,31.772399999999998,37.1111,31.6629Q37.2749,31.5535,37.4142,31.4142Q37.5535,31.274900000000002,37.6629,31.1111Q37.772400000000005,30.947400000000002,37.8478,30.7654Q37.923100000000005,30.583399999999997,37.961600000000004,30.3902Q38,30.197,38,30Q38,29.803,37.961600000000004,29.6098Q37.923100000000005,29.416600000000003,37.8478,29.2346Q37.772400000000005,29.052599999999998,37.6629,28.8889Q37.5535,28.725099999999998,37.4142,28.5858L25.4142,16.58579Q25.274900000000002,16.4465,25.1111,16.33706Q24.947400000000002,16.22762,24.7654,16.15224Q24.583399999999997,16.07686,24.3902,16.038429999999998Q24.197,16,24,16Q23.803,16,23.6098,16.038429999999998Q23.416600000000003,16.07686,23.2346,16.15224Q23.052599999999998,16.22762,22.8889,16.33706Q22.725099999999998,16.4465,22.5858,16.58579L10.58654,28.585L10.58579,28.5858Q10.4465,28.725099999999998,10.33706,28.8889Q10.22762,29.052599999999998,10.152239999999999,29.2346Q10.07686,29.416600000000003,10.03843,29.6098Q10,29.803,10,30Q10,30.048099999999998,10.00231,30.0961Q10.01119,30.2807,10.05376,30.4606Q10.09634,30.6405,10.17116,30.8095Q10.245989999999999,30.9786,10.35053,31.131Q10.45507,31.2835,10.58579,31.4142Q10.72507,31.5535,10.88886,31.6629Q11.052645,31.772399999999998,11.234633,31.8478Q11.416621,31.923099999999998,11.609819,31.9616Q11.803017,32,12,32Q12.196983,32,12.390181,31.9616Q12.583378,31.923099999999998,12.765367,31.8478Q12.947355,31.772399999999998,13.11114,31.6629Q13.27493,31.5535,13.41421,31.4142L13.41496,31.4135L24,20.82843L34.5848,31.4132Z","fill-rule":"evenodd"})],-1),CD=[ID,OD];function yD(o,n,s,l,a,u){return me(),Fe("svg",Ot({xmlns:"http://www.w3.org/2000/svg",fill:s.useCurrentColor?"currentColor":"#000",viewBox:"0 0 48 48",class:[`${s.prefix}-icon`,`${s.prefix}-icon-up`],width:"1em",height:"1em"},o.$attrs),CD,16,vD)}var SD=Ns(bD,[["render",yD]]);const lr=X5("main",()=>{const o=BE(null),n=BE(null),s=ge(!1),l=ge(!1);return{workspaceSvg:o,searchPlugin:n,hasLayoutSider:s,searchVisible:l}});const RD={id:"codespace"},xb="未检测到积木块",kD={__name:"Codespace",setup(o){const n=ge(xb),s=lr();zt(()=>{s.workspaceSvg.addChangeListener(()=>{n.value=Ve.pythonGenerator.workspaceToCode(s.workspaceSvg)||xb})});function l(){s.hasLayoutSider=!1}return(a,u)=>{const d=_t("highlightjs"),h=TI;return me(),it(h,{style:{overflow:"auto"}},{default:De(()=>[Le("div",RD,[Le("div",null,[Q(Xo(s2),{onClick:l})]),Le("div",null,[Q(d,{autodetect:"",code:n.value},null,8,["code"])])])]),_:1})}}};Tt.dialog.setAlert(function(o,n){dn.confirm({title:"注意",content:o,okText:"确认",onCancel:n,onOk:n,hideCancel:!0})});Tt.dialog.setConfirm(function(o,n){dn.confirm({title:"注意",content:o,okText:"确认",cancelText:"取消",onCancel:function(){n(!1)},onOk:function(){n(!0)}})});Tt.dialog.setPrompt(function(o,n,s){dn.confirm({title:o.replace(":",""),content:()=>Zs(mg,{defaultValue:n,id:"dialog-input"}),okText:"确认",cancelText:"取消",onCancel:function(){s(null)},onOk:function(){s(document.querySelector("#dialog-input input").value)}})});const AD={};const LD="/assets/boxy-1d58dca5.png";function i2(o){return G0()?(Jb(o),!0):!1}function ND(o){return typeof o=="function"?o():Xo(o)}const wD=typeof window<"u";/*!
+ * cookie
+ * Copyright(c) 2012-2014 Roman Shtylman
+ * Copyright(c) 2015 Douglas Christopher Wilson
+ * MIT Licensed
+ */var n2=DD,Bb=PD,MD=Object.prototype.toString,yu=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function DD(o,n){if(typeof o!="string")throw new TypeError("argument str must be a string");for(var s={},l=n||{},a=l.decode||xD,u=0;u{if(!this.HAS_DOCUMENT_COOKIE)return;const a=this.cookies;this.cookies=n2(document.cookie),this._checkChanges(a)};const l=typeof document>"u"?"":document.cookie;this.cookies=VD(n||l),this.defaultSetOptions=s,this.HAS_DOCUMENT_COOKIE=HD()}_emitChange(n){for(let s=0;s{n[l]!==this.cookies[l]&&this._emitChange({name:l,value:p0(n[l])})})}_startPolling(){this.pollingInterval=setInterval(this.update,300)}_stopPolling(){this.pollingInterval&&clearInterval(this.pollingInterval)}get(n,s={}){return s.doNotUpdate||this.update(),p0(this.cookies[n],s)}getAll(n={}){n.doNotUpdate||this.update();const s={};for(let l in this.cookies)s[l]=p0(this.cookies[l],n);return s}set(n,s,l){l?l=Object.assign(Object.assign({},this.defaultSetOptions),l):l=this.defaultSetOptions;const a=typeof s=="string"?s:JSON.stringify(s);this.cookies=Object.assign(Object.assign({},this.cookies),{[n]:a}),this.HAS_DOCUMENT_COOKIE&&(document.cookie=Bb(n,a,l)),this._emitChange({name:n,value:s,options:l})}remove(n,s){const l=s=Object.assign(Object.assign({},s),{expires:new Date(1970,1,1,0,0,1),maxAge:0});this.cookies=Object.assign({},this.cookies),delete this.cookies[n],this.HAS_DOCUMENT_COOKIE&&(document.cookie=Bb(n,"",l)),this._emitChange({name:n,value:void 0,options:s})}addChangeListener(n){this.changeListeners.push(n),this.changeListeners.length===1&&(typeof window=="object"&&"cookieStore"in window?window.cookieStore.addEventListener("change",this.update):this._startPolling())}removeChangeListener(n){const s=this.changeListeners.indexOf(n);s>=0&&this.changeListeners.splice(s,1),this.changeListeners.length===0&&(typeof window=="object"&&"cookieStore"in window?window.cookieStore.removeEventListener("change",this.update):this._stopPolling())}}var zD=Object.defineProperty,Fb=Object.getOwnPropertySymbols,XD=Object.prototype.hasOwnProperty,jD=Object.prototype.propertyIsEnumerable,Ub=(o,n,s)=>n in o?zD(o,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):o[n]=s,Hb=(o,n)=>{for(var s in n||(n={}))XD.call(n,s)&&Ub(o,s,n[s]);if(Fb)for(var s of Fb(n))jD.call(n,s)&&Ub(o,s,n[s]);return o};function r2(o,{doNotParse:n=!1,autoUpdateDependencies:s=!1}={},l=new WD){const a=s?[...o||[]]:o;let u=l.getAll({doNotParse:!0});const d=ge(0),h=()=>{const p=l.getAll({doNotParse:!0});YD(a||null,p,u)&&d.value++,u=p};return l.addChangeListener(h),i2(()=>{l.removeChangeListener(h)}),{get:(...p)=>(s&&a&&!a.includes(p[0])&&a.push(p[0]),d.value,l.get(p[0],Hb({doNotParse:n},p[1]))),getAll:(...p)=>(d.value,l.getAll(Hb({doNotParse:n},p[0]))),set:(...p)=>l.set(...p),remove:(...p)=>l.remove(...p),addChangeListener:(...p)=>l.addChangeListener(...p),removeChangeListener:(...p)=>l.removeChangeListener(...p)}}function YD(o,n,s){if(!o)return!0;for(const l of o)if(n[l]!==s[l])return!0;return!1}const KD={id:"modal-content"},QD=Le("p",null,"积木盒宽度",-1),qD=Le("p",null,"主题",-1),JD=Le("span",{style:{color:"var(--color-text-4)"}},"Copyright 2023 Coconut Studio",-1),ZD={__name:"Settings",setup(o,{expose:n}){const s=r2(["flyout","theme"]),l=ge(!1),a=ge(s.get("flyout")||"full"),u=ge(s.get("theme")||"auto");function d(){l.value=!0}function h(){const C=document.querySelector("div.injectionDiv > svg.blocklyFlyout");C&&(C.style.width="320px")}function p(C){h(),a.value=C,s.set("flyout",C)}function f(C){let S=C;C==="auto"&&(S=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),document.body.setAttribute("arco-theme",S)}function T(C){f(C),u.value=C,s.set("theme",C)}return window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",function(C){u.value==="auto"&&f(C.matches?"dark":"light")}),zt(()=>{let C=document.createElement("style");C.innerHTML="* { transition: color ease 50ms, background-color ease 200ms, border ease 300ms; }",document.head.appendChild(C)}),f(s.get("theme")||"auto"),n({handleClick:d}),(C,S)=>{const P=uw,x=Mu,G=Og,oe=ll,ne=yI,Z=dn;return me(),it(Z,{visible:l.value,"onUpdate:visible":S[0]||(S[0]=Y=>l.value=Y),width:"auto",footer:"false"},{title:De(()=>[Ut("设置")]),footer:De(()=>[JD]),default:De(()=>[Le("div",KD,[Q(G,null,{default:De(()=>[QD,Q(x,{"model-value":a.value,onChange:p,type:"button"},{default:De(()=>[Q(P,{value:"full"},{default:De(()=>[Ut("适应")]),_:1}),Q(P,{value:"fixed"},{default:De(()=>[Ut("固定")]),_:1})]),_:1},8,["model-value"])]),_:1}),Q(G,null,{default:De(()=>[qD,Q(ne,{"model-value":u.value,onChange:T,style:{"text-align":"justify"}},{default:De(()=>[Q(oe,{value:"light"},{icon:De(()=>[Q(Xo(Y8))]),default:De(()=>[Ut("白天模式")]),_:1}),Q(oe,{value:"dark"},{icon:De(()=>[Q(Xo(g8))]),default:De(()=>[Ut("黑夜模式")]),_:1}),Q(oe,{value:"auto"},{icon:De(()=>[Q(Xo(V8))]),default:De(()=>[Ut("跟随系统")]),_:1})]),_:1},8,["model-value"])]),_:1})])]),_:1},8,["visible"])}}};const e7={id:"modal-content"},t7={style:{"margin-bottom":"16px"}},o7=Le("span",{style:{color:"var(--color-text-4)"}},"Copyright 2023 Coconut Studio",-1),s7={__name:"Pip",setup(o,{expose:n}){const s=ge(!1),l=ge([]),a=ge(""),u=ge("");function d(){s.value=!0,h()}async function h(){try{const T=await(await fetch("./api/pipList")).json();l.value=T.pipList}catch(f){console.error("获取 Pip 列表失败:",f)}}async function p(){try{const f=new URL("/api/pipInstall",window.location.origin);f.searchParams.append("packageName",a.value),f.searchParams.append("installSource",u.value);const T=await fetch(f);if(!T.ok)throw new Error(`HTTP error! status: ${T.status}`);const C=await T.json();console.log(C)}catch(f){console.error("安装失败:",f)}}return n({handlePipClick:d}),(f,T)=>{const C=mg,S=ll,P=yI,x=Vc,G=dn;return me(),it(G,{visible:s.value,"onUpdate:visible":T[2]||(T[2]=oe=>s.value=oe),width:"auto",footer:"false"},{title:De(()=>[Ut("Pip 列表")]),footer:De(()=>[o7]),default:De(()=>[Le("div",e7,[Le("div",t7,[Q(C,{modelValue:a.value,"onUpdate:modelValue":T[0]||(T[0]=oe=>a.value=oe),placeholder:"请输入库名称",style:{width:"200px","margin-right":"8px"}},null,8,["modelValue"]),Q(P,{modelValue:u.value,"onUpdate:modelValue":T[1]||(T[1]=oe=>u.value=oe),placeholder:"请选择安装源",style:{width:"200px","margin-right":"8px"}},{default:De(()=>[Q(S,{value:"https://pypi.org/simple"},{default:De(()=>[Ut("PyPI")]),_:1}),Q(S,{value:"https://pypi.tuna.tsinghua.edu.cn/simple"},{default:De(()=>[Ut("清华大学")]),_:1}),Q(S,{value:"https://pypi.mirrors.ustc.edu.cn/simple"},{default:De(()=>[Ut("中国科学技术大学")]),_:1}),Q(S,{value:"https://pypi.org/simple"},{default:De(()=>[Ut("中国科技大学")]),_:1})]),_:1},8,["modelValue"]),Q(x,{type:"primary",onClick:p},{default:De(()=>[Ut("安装")]),_:1})]),Le("ul",null,[(me(!0),Fe(Wt,null,id(l.value,(oe,ne)=>(me(),Fe("li",{key:ne},Ci(oe[0]),1))),128))])])]),_:1},8,["visible"])}}};const i7=Le("img",{alt:"Logo",src:LD,width:"36",height:"36"},null,-1),n7=[i7],r7={class:"navigatorMenu"},l7={__name:"Navigator",setup(o){const n=ge(),s=ge(),l=ge(),a=lr();function u(){Tt.hideChaff()}function d(){const S=Tt.serialization.workspaces.save(a.workspaceSvg),P=JSON.stringify(S),x=new Blob([P],{type:"text/plain;charset=utf-8"}),G=URL.createObjectURL(x),oe=document.createElement("a");oe.href=G,oe.download="project.boxy",oe.click(),n.value=!1}function h(){const S=document.createElement("input");S.setAttribute("type","file"),S.setAttribute("name","file"),S.setAttribute("visibility","hidden"),S.setAttribute("accept",".boxy"),S.addEventListener("change",function(){const P=this.files[0],x=new FileReader;x.addEventListener("load",function(){const G=JSON.parse(this.result);Tt.serialization.workspaces.load(G,a.workspaceSvg)}),x.readAsText(P)}),S.click(),n.value=!1}function p(){a.searchVisible=!0,n.value=!1}function f(){s.value.handleClick(),n.value=!1}function T(){window.open("https://www.yuque.com/hzsn/boxy"),n.value=!1}function C(){l.value.handlePipClick(),n.value=!1}return(S,P)=>{const x=NN,G=yw,oe=zu;return me(),Fe(Wt,null,[Q(oe,{trigger:["hover","click"],position:"rt","popup-visible":n.value,"onUpdate:popupVisible":P[0]||(P[0]=ne=>n.value=ne)},{content:De(()=>[Le("div",r7,[Q(x,null,{default:De(()=>[Ut("新建")]),_:1}),Q(x,{onClick:C},{default:De(()=>[Ut("PIP库管理")]),_:1}),Q(x,{onClick:d},{default:De(()=>[Ut("保存到电脑")]),_:1}),Q(x,{onClick:h},{default:De(()=>[Ut("打开本地文件")]),_:1}),Q(G,{margin:"1px"}),Q(x,{onClick:p},{default:De(()=>[Ut("查找")]),_:1}),Q(G,{margin:"1px"}),Q(x,{onClick:f},{default:De(()=>[Ut("设置")]),_:1}),Q(x,{onClick:T},{default:De(()=>[Ut("关于")]),_:1})])]),default:De(()=>[Le("div",{id:"logo",onClick:u},n7)]),_:1},8,["popup-visible"]),Q(ZD,{ref_key:"modal",ref:s},null,512),Q(s7,{ref_key:"pipModal",ref:l},null,512)],64)}}};const c7={__name:"Screenshot",setup(o){const n=ge(),s=ge();function l(){const h=document.createElement("a");h.download="block.png",h.href=n.value,h.click()}function a(h){const p=document.createElement("img"),f=document.createElement("canvas"),T=f.getContext("2d"),C=Math.sqrt(40);f.width=h.width*C,f.height=h.height*C,p.onload=function(){T.drawImage(p,0,0,h.width,h.height,0,0,f.width,f.height);try{n.value=f.toDataURL("image/png"),s.value=!0}catch{console.warn("Error converting the workspace svg to a png.")}},p.src=h.data}function u(h,p){const f=document.getElementsByTagName("textarea");for(const R of f)R.innerHTML=R.value;const T=h.getBlocksBoundingBox(),C=T.x||T.left,S=T.y||T.top,P=T.width||T.right-C,x=T.height||T.bottom-S,oe=h.getCanvas().cloneNode(!0);oe.removeAttribute("transform");const ne=document.createElementNS("http://www.w3.org/2000/svg","svg");ne.setAttribute("xmlns","http://www.w3.org/2000/svg"),ne.appendChild(oe),ne.setAttribute("viewBox",C+" "+S+" "+P+" "+x),ne.setAttribute("class","blocklySvg "+(h.options.renderer||"geras")+"-renderer "+(h.getTheme?h.getTheme().name+"-theme":"")),ne.setAttribute("width",P),ne.setAttribute("height",x),ne.setAttribute("style","background-color: transparent");const Z=[].slice.call(document.head.querySelectorAll("style")).filter(R=>/\.blocklySvg/.test(R.innerText)||R.id.indexOf("blockly-")===0).map(R=>R.innerText).join(`
+`),Y=document.createElement("style");Y.innerHTML=Z+`
+`+p,ne.insertBefore(Y,ne.firstChild);let M=new XMLSerializer().serializeToString(ne);return M=M.replace(/ /g," "),{data:"data:image/svg+xml,"+encodeURIComponent(M),width:P,height:x}}function d(h){const p=document.createElement("div"),f={blocks:{languageVersion:0,blocks:[h.block.toCopyData().saveInfo]}},T=Tt.inject(p,{readOnly:!0,theme:"codemao",renderer:"codemao"});return Tt.serialization.workspaces.load(f,T),T}return zt(()=>{Tt.ContextMenuRegistry.registry.register({callback:function(h){a(u(d(h)))},scopeType:Tt.ContextMenuRegistry.ScopeType.BLOCK,displayText:"生成积木图片",preconditionFn:function(){return"enabled"},id:"BlcokImage"}),Tt.ContextMenuRegistry.registry.register({callback:function(h){a(u(h.workspace))},scopeType:Tt.ContextMenuRegistry.ScopeType.WORKSPACE,displayText:"全局预览",preconditionFn:function(h){return h.workspace.blockDB.size?"enabled":"disabled"},id:"WorkspaceImage"})}),(h,p)=>{const f=kI,T=F6;return me(),it(T,{src:n.value,"onUpdate:src":p[0]||(p[0]=C=>n.value=C),visible:s.value,"onUpdate:visible":p[1]||(p[1]=C=>s.value=C)},{actions:De(()=>[Q(f,{name:"下载",onClick:l},{default:De(()=>[Q(Xo(rD))]),_:1})]),_:1},8,["src","visible"])}}};const a7={id:"search"},u7={__name:"Search",setup(o){const n=ge(),s=lr();function l(){n.value=!0}function a(){n.value=!1,s.searchPlugin.close()}function u(T){s.searchPlugin.searchAndHighlight(T)}function d(){s.searchPlugin.next()}function h(){s.searchPlugin.previous()}function p(){s.searchPlugin.next()}function f(){s.searchVisible=!1}return zt(()=>{s.workspaceSvg.injectionDiv.addEventListener("keydown",T=>{(T.ctrlKey||T.metaKey)&&T.key==="f"&&(s.searchVisible=!0,T.preventDefault(),T.stopPropagation())}),Et(s.$state,T=>{T.searchVisible?l():a()}),a()}),(T,C)=>{const S=Vc,P=mg,x=Og;return me(),Fe("div",a7,[Q(x,{style:It({display:n.value?"block":"none"})},{default:De(()=>[Q(P,{placeholder:"搜索作品中的积木",onInput:u,onPressEnter:d},{append:De(()=>[Q(S,{type:"text",onClick:h,"aria-label":"整理"},{icon:De(()=>[Q(Xo(SD))]),_:1}),Q(S,{type:"text",onClick:p,"aria-label":"整理"},{icon:De(()=>[Q(Xo(ED))]),_:1}),Q(S,{type:"text",onClick:f,"aria-label":"关闭"},{icon:De(()=>[Q(Xo(s2))]),_:1})]),_:1})]),_:1},8,["style"])])}}};function d7(o){var n;const s=ND(o);return(n=s==null?void 0:s.$el)!=null?n:s}const h7=wD?window:void 0;function p7(){const o=ge(!1);return ml()&&zt(()=>{o.value=!0}),o}function $7(o){const n=p7();return j(()=>(n.value,!!o()))}var Vb=Object.getOwnPropertySymbols,_7=Object.prototype.hasOwnProperty,g7=Object.prototype.propertyIsEnumerable,f7=(o,n)=>{var s={};for(var l in o)_7.call(o,l)&&n.indexOf(l)<0&&(s[l]=o[l]);if(o!=null&&Vb)for(var l of Vb(o))n.indexOf(l)<0&&g7.call(o,l)&&(s[l]=o[l]);return s};function l2(o,n,s={}){const l=s,{window:a=h7}=l,u=f7(l,["window"]);let d;const h=$7(()=>a&&"MutationObserver"in a),p=()=>{d&&(d.disconnect(),d=void 0)},f=Et(()=>d7(o),C=>{p(),h.value&&a&&C&&(d=new MutationObserver(n),d.observe(C,u))},{immediate:!0}),T=()=>{p(),f()};return i2(T),{isSupported:h,stop:T}}const Gb="/assets/superellipse-abb4b598.svg";const m7={__name:"Toolbox",setup(o){class n extends Tt.ToolboxCategory{constructor(){super(...arguments);J$(this,"setSelected",u=>{let d=this.rowDiv_.getElementsByClassName("blocklyTreeLabel")[0];u?(this.rowDiv_.style.backgroundColor="rgb(var(--primary-5))",d.style.color="var(--color-white)"):(this.rowDiv_.style.backgroundColor="",d.style.color=""),Tt.utils.aria.setState(this.htmlDiv_,Tt.utils.aria.State.SELECTED,u)});J$(this,"createIconDom_",()=>{const u=document.createElement("iconpark-icon");return u.name=this.toolboxItemDef_.categorystyle,u.size="21",u.style=`
+ -webkit-mask-size: 100% 100%;
+ -webkit-mask-image: url(${Gb});
+ mask-size: 100% 100%;
+ mask-image: url(${Gb});
+ color: white;
+ `,u})}addColourBorder_(u){this.rowDiv_.children[0].children[0].style.backgroundColor=u}}Tt.registry.register(Tt.registry.Type.TOOLBOX_ITEM,Tt.ToolboxCategory.registrationName,n,!0),Tt.VerticalFlyout.prototype.reflowInternal_=function(){this.workspace_.scale=.8;let l=0;const a=this.workspace_.getTopBlocks(!1);for(const u of a){let d=u.getHeightWidth().width;u.outputConnection&&(d-=this.tabWidth_),l=Math.max(l,d)}for(const u of this.buttons_)l=Math.max(l,u.width);if(l+=this.MARGIN*1.5+this.tabWidth_,l*=this.workspace_.scale,l+=Tt.Scrollbar.scrollbarThickness,this.width_!==l){for(const u of a){if(this.RTL){const d=u.getRelativeToSurfaceXY().x;let h=l/this.workspace_.scale-this.MARGIN;u.outputConnection||(h-=this.tabWidth_),u.moveBy(h-d,0)}this.rectMap_.has(u)&&this.moveRectToBlock_(this.rectMap_.get(u),u)}if(this.RTL)for(const u of this.buttons_){const d=u.getPosition().y,h=l/this.workspace_.scale-u.width-this.MARGIN-this.tabWidth_;u.moveTo(h,d)}this.targetWorkspace.toolboxPosition===this.toolboxPosition_&&this.toolboxPosition_===Tt.utils.toolbox.Position.LEFT&&!this.targetWorkspace.getToolbox()&&this.targetWorkspace.translate(this.targetWorkspace.scrollX+l,this.targetWorkspace.scrollY),this.width_=l,this.position(),this.targetWorkspace.recordDragTargets()}};const s=r2(["flyout"]);return zt(()=>{const l=document.querySelector("#app > section > main > div.blocklyDiv > div > svg.blocklyFlyout");l2(l,()=>{const a=s.get("flyout"),u=Math.max(parseInt(l.getAttribute("width")),320),d=l.style.display==="block";l.style.width=a==="fixed"||!d?"320px":`${u}px`,l.style.transform=d?"translate(60px, 0px)":`translate(${60-(a==="full"?u:320)}px, 0px)`},{attributeFilter:["style"]}),l.addEventListener("mouseenter",()=>{s.get("flyout")==="fixed"&&(l.style.minWidth=l.getAttribute("width")+"px")}),l.addEventListener("mouseleave",()=>{s.get("flyout")==="fixed"&&(l.style.minWidth="320px")})}),()=>{}}},T7="/assets/trashcan_lid-bf343e64.svg",E7="/assets/trashcan_body-d3f2460a.svg";const b7={__name:"Trashcan",setup(o){const n=lr(),s=ge(),l=ge(),a=ge();function u(){s.value.style.zIndex=6,l.value.style.zIndex=7,a.value.style.zIndex=7,s.value.style.opacity=1,l.value.style.opacity=1,a.value.style.opacity=1}function d(){s.value.style.zIndex=0,l.value.style.zIndex=0,a.value.style.zIndex=0,s.value.style.opacity=0,l.value.style.opacity=0,a.value.style.opacity=0}function h(){l.value.style.transform="translate(-4px,-4px) rotate(-20deg)"}function p(){l.value.style.transform="translate(0px, 0px) rotate(0deg)"}return zt(()=>{l2(document.querySelector("#app > section > main > div.blocklyDiv > div > div"),f=>{f[0].target.classList.contains("blocklyToolboxDelete")?h():p()},{attributeFilter:["class"]}),n.workspaceSvg.addChangeListener(f=>{f.type==="drag"?u():f.type==="move"&&f.oldCoordinate!==void 0&&d()})}),(f,T)=>(me(),Fe("div",{ref_key:"trashcan",ref:s,id:"trashcan",class:"blocklyToolboxDelete",style:{cursor:"grabbing"}},[Le("img",{ref_key:"trashcanLid",ref:l,src:T7,alt:"垃圾桶盖"},null,512),Le("img",{ref_key:"trashcanBody",ref:a,src:E7,alt:"垃圾桶身"},null,512)],512))}};var v7={exports:{}};/*! For license information please see index.js.LICENSE.txt */(function(o,n){(function(s,l){o.exports=l(Gc())})(Do,s=>(()=>{var l={573:h=>{h.exports=s}},a={};function u(h){var p=a[h];if(p!==void 0)return p.exports;var f=a[h]={exports:{}};return l[h](f,f.exports,u),f.exports}u.n=h=>{var p=h&&h.__esModule?()=>h.default:()=>h;return u.d(p,{a:p}),p},u.d=(h,p)=>{for(var f in p)u.o(p,f)&&!u.o(h,f)&&Object.defineProperty(h,f,{enumerable:!0,get:p[f]})},u.o=(h,p)=>Object.prototype.hasOwnProperty.call(h,p),u.r=h=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(h,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(h,"__esModule",{value:!0})};var d={};return(()=>{u.r(d);var h=u(573),p=u.n(h);function f(L){if(L.saveExtraState){const R=L.saveExtraState();return R?JSON.stringify(R):""}if(L.mutationToDom){const R=L.mutationToDom();return R?h.Xml.domToText(R):""}return""}function T(L){const R=new h.FieldImage(S,15,15,void 0,C);return R.args_=L,R}function C(L){const R=L.getSourceBlock();if(R.isInFlyout)return;h.Events.setGroup(!0);const F=f(R);R.minus(L.args_);const z=f(R);F!=z&&h.Events.fire(new h.Events.BlockChange(R,"mutation",null,F,z)),h.Events.setGroup(!1)}const S="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0Ij48cGF0aCBkPSJNMTggMTFoLTEyYy0xLjEwNCAwLTIgLjg5Ni0yIDJzLjg5NiAyIDIgMmgxMmMxLjEwNCAwIDItLjg5NiAyLTJzLS44OTYtMi0yLTJ6IiBmaWxsPSJ3aGl0ZSIgLz48L3N2Zz4K";function P(L){const R=new h.FieldImage(G,15,15,void 0,x);return R.args_=L,R}function x(L){const R=L.getSourceBlock();if(R.isInFlyout)return;h.Events.setGroup(!0);const F=f(R);R.plus(L.args_);const z=f(R);F!=z&&h.Events.fire(new h.Events.BlockChange(R,"mutation",null,F,z)),h.Events.setGroup(!1)}const G="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0Ij48cGF0aCBkPSJNMTggMTBoLTR2LTRjMC0xLjEwNC0uODk2LTItMi0ycy0yIC44OTYtMiAybC4wNzEgNGgtNC4wNzFjLTEuMTA0IDAtMiAuODk2LTIgMnMuODk2IDIgMiAybDQuMDcxLS4wNzEtLjA3MSA0LjA3MWMwIDEuMTA0Ljg5NiAyIDIgMnMyLS44OTYgMi0ydi00LjA3MWw0IC4wNzFjMS4xMDQgMCAyLS44OTYgMi0ycy0uODk2LTItMi0yeiIgZmlsbD0id2hpdGUiIC8+PC9zdmc+Cg==",oe={elseIfCount_:0,hasElse_:!1,mutationToDom:function(){if(!this.elseIfCount_&&!this.hasElse_)return null;const L=p().utils.xml.createElement("mutation");return L.setAttribute("elseif",this.elseIfCount_),this.hasElse_&&L.setAttribute("else",1),L},domToMutation:function(L){const R=parseInt(L.getAttribute("elseif"),10)||0;this.hasElse_=!!parseInt(L.getAttribute("else"),10)||0,this.hasElse_&&!this.getInput("ELSE")&&this.appendStatementInput("ELSE").appendField(p().Msg.CONTROLS_IF_MSG_ELSE),this.updateShape_(R)},saveExtraState:function(){if(!this.elseIfCount_&&!this.hasElse_)return null;const L=Object.create(null);return this.elseIfCount_&&(L.elseIfCount=this.elseIfCount_),this.hasElse_&&(L.hasElse=!0),L},loadExtraState:function(L){const R=L.elseIfCount||0;this.hasElse_=L.hasElse||!1,this.hasElse_&&!this.getInput("ELSE")&&this.appendStatementInput("ELSE").appendField(p().Msg.CONTROLS_IF_MSG_ELSE),this.updateShape_(R)},updateShape_:function(L){for(;this.elseIfCount_L;)this.removeElseIf_()},plus:function(){this.addElseIf_()},minus:function(L){this.elseIfCount_!=0&&this.removeElseIf_(L)},addElseIf_:function(){this.elseIfCount_++,this.appendValueInput("IF"+this.elseIfCount_).setCheck("Boolean").appendField(p().Msg.CONTROLS_IF_MSG_ELSEIF).appendField(T(this.elseIfCount_),"MINUS"+this.elseIfCount_),this.appendStatementInput("DO"+this.elseIfCount_).appendField(p().Msg.CONTROLS_IF_MSG_THEN),this.getInput("ELSE")&&this.moveInputBefore("ELSE",null)},removeElseIf_:function(L){if(L!==void 0&&L!=this.elseIfCount_){const R=2*L,F=this.inputList;let z=F[R].connection;z.isConnected()&&z.disconnect(),z=F[R+1].connection,z.isConnected()&&z.disconnect(),this.bumpNeighbours();for(let X,le=R+2;(X=this.inputList[le])&&X.name!="ELSE";le++){const $e=X.connection.targetConnection;$e&&this.inputList[le-2].connection.connect($e)}}this.removeInput("IF"+this.elseIfCount_),this.removeInput("DO"+this.elseIfCount_),this.elseIfCount_--}};p().Extensions.isRegistered("controls_if_mutator")&&p().Extensions.unregister("controls_if_mutator"),p().Extensions.registerMutator("controls_if_mutator",oe,function(){this.getInput("IF0").insertFieldAt(0,P(),"PLUS")}),delete p().Blocks.lists_create_with,p().defineBlocksWithJsonArray([{type:"lists_create_with",message0:"%{BKY_LISTS_CREATE_EMPTY_TITLE} %1",args0:[{type:"input_dummy",name:"EMPTY"}],output:"Array",style:"list_blocks",helpUrl:"%{BKY_LISTS_CREATE_WITH_HELPURL}",tooltip:"%{BKY_LISTS_CREATE_WITH_TOOLTIP}",mutator:"new_list_create_with_mutator"}]);const ne={itemCount_:0,mutationToDom:function(){const L=p().utils.xml.createElement("mutation");return L.setAttribute("items",this.itemCount_),L},domToMutation:function(L){const R=parseInt(L.getAttribute("items"),10);this.updateShape_(R)},saveExtraState:function(){return{itemCount:this.itemCount_}},loadExtraState:function(L){this.updateShape_(L.itemCount)},updateShape_:function(L){for(;this.itemCount_L;)this.removePart_();this.updateMinus_()},plus:function(){this.addPart_(),this.updateMinus_()},minus:function(){this.itemCount_!=0&&(this.removePart_(),this.updateMinus_())},addPart_:function(){this.itemCount_==0?(this.removeInput("EMPTY"),this.topInput_=this.appendValueInput("ADD"+this.itemCount_).appendField(P(),"PLUS").appendField(p().Msg.LISTS_CREATE_WITH_INPUT_WITH)):this.appendValueInput("ADD"+this.itemCount_),this.itemCount_++},removePart_:function(){this.itemCount_--,this.removeInput("ADD"+this.itemCount_),this.itemCount_==0&&(this.topInput_=this.appendDummyInput("EMPTY").appendField(P(),"PLUS").appendField(p().Msg.LISTS_CREATE_EMPTY_TITLE))},updateMinus_:function(){const L=this.getField("MINUS");!L&&this.itemCount_>0?this.topInput_.insertFieldAt(1,T(),"MINUS"):L&&this.itemCount_<1&&this.topInput_.removeField("MINUS")}};p().Extensions.registerMutator("new_list_create_with_mutator",ne,function(){this.getInput("EMPTY").insertFieldAt(0,P(),"PLUS"),this.updateShape_(3)}),p().Msg.PROCEDURE_VARIABLE="variable:",delete p().Blocks.procedures_defnoreturn,delete p().Blocks.procedures_defreturn,p().defineBlocksWithJsonArray([{type:"procedures_defnoreturn",message0:"%{BKY_PROCEDURES_DEFNORETURN_TITLE} %1 %2",message1:"%{BKY_PROCEDURES_DEFNORETURN_DO} %1",args0:[{type:"field_input",name:"NAME",text:""},{type:"input_dummy",name:"TOP"}],args1:[{type:"input_statement",name:"STACK"}],style:"procedure_blocks",helpUrl:"%{BKY_PROCEDURES_DEFNORETURN_HELPURL}",tooltip:"%{BKY_PROCEDURES_DEFNORETURN_TOOLTIP}",extensions:["get_procedure_def_no_return","procedure_context_menu","procedure_rename","procedure_vars"],mutator:"procedure_def_mutator"},{type:"procedures_defreturn",message0:"%{BKY_PROCEDURES_DEFRETURN_TITLE} %1 %2",message1:"%{BKY_PROCEDURES_DEFRETURN_DO} %1",message2:"%{BKY_PROCEDURES_DEFRETURN_RETURN} %1",args0:[{type:"field_input",name:"NAME",text:""},{type:"input_dummy",name:"TOP"}],args1:[{type:"input_statement",name:"STACK"}],args2:[{type:"input_value",align:"right",name:"RETURN"}],style:"procedure_blocks",helpUrl:"%{BKY_PROCEDURES_DEFRETURN_HELPURL}",tooltip:"%{BKY_PROCEDURES_DEFRETURN_TOOLTIP}",extensions:["get_procedure_def_return","procedure_context_menu","procedure_rename","procedure_vars"],mutator:"procedure_def_mutator"}]),p().Extensions.registerMixin("get_procedure_def_no_return",{getProcedureDef:function(){const L=this.argData_.map(R=>R.model.name);return[this.getFieldValue("NAME"),L,!1]},callType_:"procedures_callnoreturn"}),p().Extensions.registerMixin("get_procedure_def_return",{getProcedureDef:function(){const L=this.argData_.map(R=>R.model.name);return[this.getFieldValue("NAME"),L,!0]},callType_:"procedures_callreturn"});const Z={customContextMenu:function(L){if(this.isInFlyout)return;const R=this.getFieldValue("NAME"),F=p().Msg.PROCEDURES_CREATE_DO.replace("%1",R),z=p().utils.xml.createElement("block");z.setAttribute("type",this.callType_),z.appendChild(this.mutationToDom(!0));const X=p().ContextMenu.callbackFactory(this,z);if(L.push({enabled:!0,text:F,callback:X}),this.isCollapsed())return;const le=this.getVarModels();for(const $e of le){const he=p().Msg.VARIABLES_SET_CREATE_GET.replace("%1",$e.name),fe=p().utils.xml.createElement("block");fe.setAttribute("type","variables_get"),fe.appendChild(p().Variables.generateVariableFieldDom($e));const ke=p().ContextMenu.callbackFactory(this,fe);L.push({enabled:!0,text:he,callback:ke})}}};p().Extensions.registerMixin("procedure_context_menu",Z);const Y={mutationToDom:function(L=!1){const R=p().utils.xml.createElement("mutation");return L&&R.setAttribute("name",this.getFieldValue("NAME")),this.argData_.forEach(F=>{const z=p().utils.xml.createElement("arg"),X=F.model;z.setAttribute("name",X.name),z.setAttribute("varid",X.getId()),z.setAttribute("argid",F.argId),L&&z.setAttribute("paramid",F.argId),R.appendChild(z)}),this.hasStatements_||R.setAttribute("statements","false"),R},domToMutation:function(L){this.hasStatements_=L.getAttribute("statements")!=="false",this.hasStatements_||this.removeInput("STACK");const R=[],F=[],z=[];for(const X of L.childNodes)X.nodeName.toLowerCase()=="arg"&&(R.push(X.getAttribute("name")),F.push(X.getAttribute("varid")||X.getAttribute("varId")),z.push(X.getAttribute("argid")));this.updateShape_(R,F,z)},saveExtraState:function(){if(!this.argData_.length&&this.hasStatements_)return null;const L=Object.create(null);return this.argData_.length&&(L.params=[],this.argData_.forEach(R=>{const F=R.model;L.params.push({name:F.name,id:F.getId(),argId:R.argId})})),this.hasStatements_||(L.hasStatements=!1),L},loadExtraState:function(L){this.hasStatements_=L.hasStatements!==!1,this.hasStatements_||this.removeInput("STACK");const R=[],F=[],z=[];if(L.params)for(let X=0;X=0;X--)this.removeArg_(this.argData_[X].argId);this.argData_=[];const z=R.length;for(let X=0;Xle.model.name);L=L||p().Variables.generateUniqueNameFromOptions(p().Procedures.DEFAULT_ARG,z);const X=p().Variables.getOrCreateVariablePackage(this.workspace,R,L,"");F=F||p().utils.idGenerator.genUid(),this.addVarInput_(L,F),this.getInput("STACK")?this.moveInputBefore(F,"STACK"):this.moveInputBefore(F,"RETURN"),this.argData_.push({model:X,argId:F})},removeArg_:function(L){this.removeInput(L,!0)&&(this.argData_.length==1&&this.getInput("TOP").removeField("WITH"),this.argData_=this.argData_.filter(R=>R.argId!=L))},addVarInput_:function(L,R){const F=new(p()).FieldTextInput(L,this.validator_);F.onFinishEditing_=this.finishEditing_.bind(F),F.varIdsToDelete_=[],F.preEditVarModel_=null,this.appendDummyInput(R).setAlign(p().ALIGN_RIGHT).appendField(T(R)).appendField(p().Msg.PROCEDURE_VARIABLE).appendField(F,R)},validator_:function(L){const R=this.getSourceBlock(),F=R.workspace,z=R.argData_,X=R.argData_.find(fe=>fe.argId==this.name),le=X.model.getId(),$e=(L=L.replace(/[\s\xa0]+/g," ").trim()).toLowerCase();if(!L||!z.every(fe=>fe.argId==this.name||$e!=fe.model.name.toLowerCase()))return this.preEditVarModel_&&(X.model=this.preEditVarModel_,this.preEditVarModel_=null),p().Procedures.mutateCallers(R),null;this.varIdsToDelete_.length||(this.preEditVarModel_=X.model,F.getVariableUsesById(le).every(fe=>fe.id==R.id||fe.getProcedureCall&&fe.getProcedureCall()==R.getProcedureDef()[0])&&this.varIdsToDelete_.push(le));let he=F.getVariable(L,"");return he?he.name!=L&&F.renameVariableById(he.getId(),L):(he=F.createVariable(L,""),this.varIdsToDelete_.push(he.getId())),he.getId()!=le&&(X.model=he),p().Procedures.mutateCallers(R),L},finishEditing_:function(L){const R=this.getSourceBlock(),F=R.argData_.find(z=>z.argId==this.name).model.getId();this.varIdsToDelete_.forEach(z=>{z!=F&&R.workspace.deleteVariableById(z)}),this.varIdsToDelete_.length=0,this.preEditVarModel_=null}};p().Extensions.registerMutator("procedure_def_mutator",Y,function(){this.argData_=[],this.hasStatements_=!0,this.getInput("TOP").insertFieldAt(0,P(),"PLUS")}),p().Extensions.register("procedure_rename",function(){this.getField("NAME").setValidator(p().Procedures.rename)}),p().Extensions.register("procedure_vars",function(){const L={getVars:function(){return this.argData_.map(R=>R.model.name)},getVarModels:function(){return this.argData_.map(R=>R.model)},renameVarById:function(R,F){const z=this.argData_.find($e=>$e.model.getId()==R);if(!z)return;const X=this.workspace.getVariableById(F),le=X.name;this.addVarInput_(le,F),this.moveInputBefore(F,R),this.removeInput(R),z.model=X,p().Procedures.mutateCallers(this)},updateVarName:function(R){const F=R.getId(),z=this.argData_.find(X=>X.model.getId()==F);z&&(this.setFieldValue(R.name,z.argId),z.model=R)}};this.mixin(L,!0)});const M={itemCount_:0,mutationToDom:function(){const L=p().utils.xml.createElement("mutation");return L.setAttribute("items",this.itemCount_),L},domToMutation:function(L){const R=parseInt(L.getAttribute("items"),10);this.updateShape_(R)},saveExtraState:function(){return{itemCount:this.itemCount_}},loadExtraState:function(L){this.updateShape_(L.itemCount)},updateShape_:function(L){for(;this.itemCount_L;)this.removePart_();this.updateMinus_()},plus:function(){this.addPart_(),this.updateMinus_()},minus:function(){this.itemCount_!=0&&(this.removePart_(),this.updateMinus_())},addPart_:function(){this.itemCount_==0?(this.getInput("EMPTY")&&this.removeInput("EMPTY"),this.topInput_=this.appendValueInput("ADD"+this.itemCount_).appendField(P(),"PLUS").appendField(p().Msg.TEXT_JOIN_TITLE_CREATEWITH)):this.appendValueInput("ADD"+this.itemCount_),this.itemCount_++},removePart_:function(){this.itemCount_--,this.removeInput("ADD"+this.itemCount_),this.itemCount_==0&&(this.topInput_=this.appendDummyInput("EMPTY").appendField(P(),"PLUS").appendField(this.newQuote_(!0)).appendField(this.newQuote_(!1)))},updateMinus_:function(){const L=this.getField("MINUS");!L&&this.itemCount_>0?this.topInput_.insertFieldAt(1,T(),"MINUS"):L&&this.itemCount_<1&&this.topInput_.removeField("MINUS")}};p().Extensions.isRegistered("text_join_mutator")&&p().Extensions.unregister("text_join_mutator"),p().Extensions.registerMutator("text_join_mutator",M,function(){p().Extensions.apply("text_quotes",this,!1),this.updateShape_(2)})})(),d})())})(v7);/**
+ * @license
+ * Copyright 2020 Google LLC
+ * SPDX-License-Identifier: Apache-2.0
+ */const I7="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMTQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjE0Ij48cGF0aCBkPSJNMTkgNi40MUwxNy41OSA1IDEyIDEwLjU5IDYuNDEgNSA1IDYuNDEgMTAuNTkgMTIgNSAxNy41OSA2LjQxIDE5IDEyIDEzLjQxIDE3LjU5IDE5IDE5IDE3LjU5IDEzLjQxIDEyeiIvPjxwYXRoIGQ9Ik0wIDBoMjR2MjRIMHoiIGZpbGw9Im5vbmUiLz48L3N2Zz4=",O7="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMTQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjE0Ij48cGF0aCBkPSJNNy40MSA4LjU5TDEyIDEzLjE3bDQuNTktNC41OEwxOCAxMGwtNiA2LTYtNiAxLjQxLTEuNDF6Ii8+PHBhdGggZD0iTTAgMGgyNHYyNEgwVjB6IiBmaWxsPSJub25lIi8+PC9zdmc+",C7="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMTQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjE0Ij48cGF0aCBkPSJNNy40MSAxNS40MUwxMiAxMC44M2w0LjU5IDQuNThMMTggMTRsLTYtNi02IDZ6Ii8+PHBhdGggZD0iTTAgMGgyNHYyNEgweiIgZmlsbD0ibm9uZSIvPjwvc3ZnPg==",y7=["path.blocklyPath.blockly-ws-search-highlight {","fill: #000;","}","path.blocklyPath.blockly-ws-search-highlight.blockly-ws-search-current {","fill: grey;","}",".blockly-ws-search-close-btn {","background: url("+I7+") no-repeat top left;","}",".blockly-ws-search-next-btn {","background: url("+O7+") no-repeat top left;","}",".blockly-ws-search-previous-btn {","background: url("+C7+") no-repeat top left;","}",".blockly-ws-search {","background: #fff;","border: solid lightgrey 0.5px;","box-shadow: 0px 10px 20px grey;","justify-content: center;","padding: 0.25em;","position: absolute;","z-index: 70;","}",".blockly-ws-search-input input {","border: none;","}",".blockly-ws-search button {","border: none;","}",".blockly-ws-search-actions {","display: flex;","}",".blockly-ws-search-container {","display: flex;","}",".blockly-ws-search-content {","display: flex;","}"],S7=function(){let o=!1;return function(){if(o)return;o=!0;const n=y7.join(`
+`),s=document.createElement("style");s.id="blockly-ws-search-style";const l=document.createTextNode(n);s.appendChild(l),document.head.insertBefore(s,document.head.firstChild)}}();var Wo=Gc();/**
+ * @license
+ * Copyright 2020 Google LLC
+ * SPDX-License-Identifier: Apache-2.0
+ */class R7{constructor(n){this.workspace_=n,this.id="workspaceSearch",this.htmlDiv_=null,this.actionDiv_=null,this.inputElement_=null,this.textInputPlaceholder_="Search",this.blocks_=[],this.currentBlockIndex_=-1,this.searchText_="",this.searchOnInput=!0,this.caseSensitive=!1,this.preserveSelected=!0,this.boundEvents_=[]}init(){this.workspace_.getComponentManager().addComponent({component:this,weight:0,capabilities:[Wo.ComponentManager.Capability.POSITIONABLE]}),S7(),this.createDom_(),this.setVisible_(!1),this.workspace_.resize()}dispose(){for(const n of this.boundEvents_)Wo.browserEvents.unbind(n);this.boundEvents_.length=0,this.htmlDiv_&&(this.htmlDiv_.remove(),this.htmlDiv_=null),this.actionDiv_=null,this.inputElement_=null}createDom_(){const n=this.workspace_.getInjectionDiv();this.addEvent_(n,"keydown",this,p=>this.onWorkspaceKeyDown_(p)),this.htmlDiv_=document.createElement("div"),Wo.utils.dom.addClass(this.htmlDiv_,"blockly-ws-search");const s=document.createElement("div");Wo.utils.dom.addClass(s,"blockly-ws-search-container");const l=document.createElement("div");Wo.utils.dom.addClass(l,"blockly-ws-search-content"),s.appendChild(l);const a=document.createElement("div");Wo.utils.dom.addClass(a,"blockly-ws-search-input"),this.inputElement_=this.createTextInput_(),this.addEvent_(this.inputElement_,"keydown",this,p=>this.onKeyDown_(p)),this.addEvent_(this.inputElement_,"input",this,()=>this.onInput_()),this.addEvent_(this.inputElement_,"click",this,()=>{this.searchAndHighlight(this.searchText_,this.preserveSelected),this.inputElement_.select()}),a.appendChild(this.inputElement_),l.appendChild(a),this.actionDiv_=document.createElement("div"),Wo.utils.dom.addClass(this.actionDiv_,"blockly-ws-search-actions"),l.appendChild(this.actionDiv_);const u=this.createNextBtn_();u&&this.addActionBtn(u,()=>this.next());const d=this.createPreviousBtn_();d&&this.addActionBtn(d,()=>this.previous());const h=this.createCloseBtn_();h&&(this.addBtnListener_(h,()=>this.close()),s.appendChild(h)),this.htmlDiv_.appendChild(s),n.insertBefore(this.htmlDiv_,this.workspace_.getParentSvg())}addEvent_(n,s,l,a){const u=Wo.browserEvents.conditionalBind(n,s,l,a);this.boundEvents_.push(u)}addActionBtn(n,s){this.addBtnListener_(n,s),this.actionDiv_.appendChild(n)}createTextInput_(){const n=document.createElement("input");return n.type="text",n.setAttribute("placeholder",this.textInputPlaceholder_),n}createNextBtn_(){return this.createBtn_("blockly-ws-search-next-btn","Find next")}createPreviousBtn_(){return this.createBtn_("blockly-ws-search-previous-btn","Find previous")}createCloseBtn_(){return this.createBtn_("blockly-ws-search-close-btn","Close search bar")}createBtn_(n,s){const l=document.createElement("button");return Wo.utils.dom.addClass(l,n),l.setAttribute("aria-label",s),l}addBtnListener_(n,s){this.addEvent_(n,"click",this,s),this.addEvent_(n,"keydown",this,l=>{l.key==="Enter"?(s(l),l.preventDefault()):l.key==="Escape"&&this.close(),l.stopPropagation()})}getBoundingRectangle(){return null}position(n,s){this.workspace_.RTL?this.htmlDiv_.style.left=n.absoluteMetrics.left+"px":n.toolboxMetrics.position===Wo.TOOLBOX_AT_RIGHT?this.htmlDiv_.style.right=n.toolboxMetrics.width+"px":this.htmlDiv_.style.right="0",this.htmlDiv_.style.top=n.absoluteMetrics.top+"px"}onInput_(){if(this.searchOnInput){const n=this.inputElement_.value.trim();n!==this.searchText_&&this.searchAndHighlight(n,this.preserveSelected)}}onKeyDown_(n){if(n.key==="Escape")this.close();else if(n.key==="Enter")if(this.searchOnInput)this.next();else{const s=this.inputElement_.value.trim();s!==this.searchText_&&this.searchAndHighlight(s,this.preserveSelected)}}onWorkspaceKeyDown_(n){(n.ctrlKey||n.metaKey)&&n.key==="f"&&(this.open(),n.preventDefault(),n.stopPropagation())}previous(){this.setCurrentBlock_(this.currentBlockIndex_-1)}next(){this.setCurrentBlock_(this.currentBlockIndex_+1)}setSearchPlaceholder(n){this.textInputPlaceholder_=n,this.inputElement_&&this.inputElement_.setAttribute("placeholder",this.textInputPlaceholder_)}setCurrentBlock_(n){if(!this.blocks_.length)return;let s=this.blocks_[this.currentBlockIndex_];s&&this.unhighlightCurrentSelection_(s),this.currentBlockIndex_=(n%this.blocks_.length+this.blocks_.length)%this.blocks_.length,s=this.blocks_[this.currentBlockIndex_],this.highlightCurrentSelection_(s),this.workspace_.centerOnBlock(s.id,!1)}open(){this.setVisible_(!0),this.inputElement_.focus(),this.searchText_&&this.searchAndHighlight(this.searchText_)}close(){this.setVisible_(!1),this.workspace_.markFocused(),this.clearBlocks()}setVisible_(n){this.htmlDiv_.style.display=n?"flex":"none"}searchAndHighlight(n,s){const l=this.blocks_[this.currentBlockIndex_];this.searchText_=n.trim(),this.clearBlocks(),this.blocks_=this.getMatchingBlocks_(this.workspace_,this.searchText_,this.caseSensitive),this.highlightSearchGroup_(this.blocks_);let a=0;s&&(a=this.blocks_.indexOf(l),a=a>-1?a:0),this.setCurrentBlock_(a)}getSearchPool_(n){return n.getAllBlocks(!0).filter(l=>{const a=l.getSurroundParent();return!a||!a.isCollapsed()})}isBlockMatch_(n,s,l){let a="";if(n.isCollapsed())a=n.toString();else{const u=[];n.inputList.forEach(d=>{d.fieldRow.forEach(h=>{u.push(h.getText())})}),a=u.join(" ").trim()}return l||(a=a.toLowerCase()),a.indexOf(s)>-1}getMatchingBlocks_(n,s,l){return s?(this.caseSensitive||(s=s.toLowerCase()),this.getSearchPool_(n).filter(u=>this.isBlockMatch_(u,s,l))):[]}clearBlocks(){this.unhighlightSearchGroup_(this.blocks_);const n=this.blocks_[this.currentBlockIndex_];n&&this.unhighlightCurrentSelection_(n),this.currentBlockIndex_=-1,this.blocks_=[]}highlightCurrentSelection_(n){const s=n.pathObject.svgPath;Wo.utils.dom.addClass(s,"blockly-ws-search-current")}unhighlightCurrentSelection_(n){const s=n.pathObject.svgPath;Wo.utils.dom.removeClass(s,"blockly-ws-search-current")}highlightSearchGroup_(n){n.forEach(s=>{const l=s.pathObject.svgPath;Wo.utils.dom.addClass(l,"blockly-ws-search-highlight")})}unhighlightSearchGroup_(n){n.forEach(s=>{const l=s.pathObject.svgPath;Wo.utils.dom.removeClass(l,"blockly-ws-search-highlight")})}}const c2="项目",a2="未命名",u2="今天",d2="复制并粘贴",h2="添加注释",p2="删除注释",$2="复制注释",_2="多行输入",g2="单行输入",f2="删除块",m2="删除 %1 个块",T2="删除所有 %1 个块吗?",E2="整理块",b2="折叠块",v2="折叠块",I2="展开块",O2="展开块",C2="禁用块",y2="启用块",S2="帮助",R2="撤销",k2="重做",A2="更改值",L2="重命名变量...",N2="将所有“%1”变量重命名为",w2="创建变量",M2="创建字符串变量",D2="创建数字变量",P2="创建颜色变量",x2="新变量的类型:",B2="新变量的名称:",F2="名字叫“%1”的变量已经存在了。",U2="名字叫“%1”的变量已经有了另一个类型:“%2”。",H2="要删除对变量“%2”的%1个引用吗?",V2="不能删除变量“%1”,因为它是函数“%2”定义的一部分",G2="删除变量“%1”",W2="https://zh.wikipedia.org/wiki/颜色",z2="从调色板中选择一种颜色。",X2="随机颜色",j2="随机选择一种颜色。",Y2="颜色",K2="红色",Q2="绿色",q2="蓝色",J2="通过指定红色、绿色和蓝色的量创建一种颜色。所有的值必须在0和100之间。",Z2="混合",eO="颜色1",tO="颜色2",oO="比例",sO="把两种颜色以一个给定的比例(0.0-1.0)进行混合。",iO="https://zh.wikipedia.org/wiki/For循环",nO="循环 %1 次",rO="",lO="多次执行一些语句。",cO="循环 当满足",aO="循环 直到",uO="只要值为真,就一直循环执行一些语句。",dO="只要值为假,就一直循环执行一些语句。",hO="用变量%1记录从开始数值到终止数值之间的数值,数值按指定间隔增加,并执行指定的块。",pO="变量 %1 从 %2 数到 %3 步长为 %4",$O="变量 %1 遍历列表 %2",_O="遍历列表中的每一项,将变量“%1”设为所选项,并执行一些语句。",gO="退出循环",fO="直接进入下一轮循环",mO="跳出包含它的循环。",TO="跳过本轮循环的剩余部分,并继进行续下一轮循环。",EO="警告:这个块只能在循环内使用。",bO="如果值为真,执行一些语句。",vO="如果值为真,则执行第一块语句。否则,则执行第二块语句。",IO="如果第一个值为真,则执行第一块的语句。否则,如果第二个值为真,则执行第二块的语句。",OO="如果第一个值为真,则执行第一块对语句。否则,如果第二个值为真,则执行语句的第二块。如果没有值为真,则执行最后一块的语句。",CO="如果",yO="",SO="否则如果",RO="",kO="增加、删除或重新排列各节来重新配置这个if语句块。",AO="在这个if语句块中增加一个条件。",LO="在这个if语句块中添加一个最终的,包括所有其余情况的条件。",NO="https://zh.wikipedia.org/wiki/不等",wO="如果两个输入结果相等,则返回真。",MO="如果两个输入结果不相等,则返回真。",DO="如果第一个输入结果比第二个小,则返回真。",PO="如果第一个输入结果小于或等于第二个输入结果,则返回真。",xO="如果第一个输入结果比第二个大,则返回真。",BO="如果第一个输入结果大于或等于第二个输入结果,则返回真。",FO="如果两个输入结果都为真,则返回真。",UO="且",HO="如果至少有一个输入结果为真,则返回真。",VO="或",GO="%1 不成立",WO="如果输入结果为false,则返回true;如果输入结果为true,则返回false。",zO="成立",XO="不成立",jO="返回 true 或 false。",YO="空",KO="返回空值。",QO="https://zh.wikipedia.org/wiki/条件运算符",qO="条件",JO="成立则为",ZO="不成立则为",eC="检查“断言”里的条件语句。如果条件为真,则返回“如果为真”的值,否则,则返回“如果为假”的值。",tC="https://zh.wikipedia.org/wiki/数",oC="一个数值。",sC="sin",iC="cos",nC="tan",rC="asin",lC="acos",cC="atan",aC="https://zh.wikipedia.org/wiki/算术",uC="返回两个数值的和。",dC="返回两个数值的差。",hC="返回两个数值的乘积。",pC="返回两个数值的商。",$C="返回以第一个数值为底数,以第二个数值为幂的结果。",_C="https://zh.wikipedia.org/wiki/平方根",gC="算术平方根",fC="返回一个数的算术平方根。",mC="绝对值",TC="返回一个数值的绝对值。",EC="返回一个数值的相反数。",bC="返回一个数值的自然对数。",vC="返回一个数值的以10为底的对数。",IC="返回e的n次幂。",OC="返回10的n次幂。",CC="https://zh.wikipedia.org/wiki/三角函数",yC="返回指定角度的正弦值(非弧度)。",SC="返回指定角度的余弦值(非弧度)。",RC="返回指定角度的正切值(非弧度)。",kC="返回一个数值的反正弦值。",AC="返回一个数值的反余弦值。",LC="返回一个数值的反正切值。",NC="https://zh.wikipedia.org/wiki/数学常数",wC="返回一个常见常量:π (3.141…)、e (2.718…)、φ (1.618…)、根号2 (1.414…)、根号二分之一 (0.707…)或∞ (无穷大)。",MC="是偶数",DC="是奇数",PC="是质数",xC="是整数",BC="是正数",FC="是负数",UC="检查一个数值是否是偶数、奇数、质数、自然数、正数、负数或者是否能被某数整除。返回真或假。",HC="https://zh.wikipedia.org/wiki/加法",VC="将 %1 增加 %2",GC="为变量“%1”增加一个数值。",WC="https://zh.wikipedia.org/wiki/数值修约",zC="数字向上或向下舍入。",XC="四舍五入",jC="向上舍入",YC="向下舍入",KC="列表中数值的和",QC="返回列表中的所有数值的和。",qC="列表最小值",JC="返回列表中最小值。",ZC="列表最大值",e4="返回列表中最大值。",t4="列表平均值",o4="返回列表中的数值的平均值。",s4="列表中位数",i4="返回列表中数值的中位数。",n4="列表中的众数",r4="返回列表中的出现次数最多的项的列表。",l4="列表的标准差",c4="返回列表的标准差。",a4="列表中的随机一项",u4="从列表中返回一个随机的元素。",d4="https://zh.wikipedia.org/wiki/模除",h4="%1 ÷ %2 的余数",p4="返回这两个数字相除后的余数。",$4="将 %1 限制在 最低 %2 到最高 %3 之间",_4="将一个数值限制在两个指定的数值范围(含边界)之间。",g4="https://zh.wikipedia.org/wiki/随机数生成器",f4="随机整数 %1 到 %2",m4="返回一个限制在两个指定数值的范围(含边界)之间的随机整数。",T4="https://zh.wikipedia.org/wiki/随机数生成器",E4="随机小数",b4="返回一个从0.0(含)到1.0(不含)之间的随机数。",v4="https://zh.wikipedia.org/wiki/反正切2",I4="点(x:%1,y:%2)的方位角",O4="返回点(X,Y)的反正切值,范围为-180到180度。",C4="https://zh.wikipedia.org/wiki/字符串",y4="一个字、词语或一行文本。",S4="连接",R4="通过串起任意数量的项以建立一段文本。",k4="拼接",A4="添加、移除或重新排列各节来重新配置这个文本块。",L4="将一个项添加到文本中。",N4="在 %1 之后加上文本 %2 ",w4="将一些文本追加到变量“%1”里。",M4="%1 的字符数",D4="返回给定文本的字母数(包括空格)。",P4="%1 是空的",x4="如果给定的文本为空,则返回真。",B4="返回第一个文本段在第二个文本段中的第一/最后一个匹配项的起始位置。如果未找到,则返回%1。",F4="在 %1 中 %2 出现 %3 的位置",U4="首次",H4="最后",V4="用不同的大小写模式复制并返回这段文字。",G4="转为大写",W4="转为小写",z4="转为首字母大写",X4="从某一端或同时从两端删除多余的空白,并返回这段文字的一个副本。",j4="消除其两侧的空白",Y4="消除其左侧的空白",K4="消除其右侧的空白",Q4="输出 %1",q4="输出指定的文字、数字或其他值。",J4="要求输入文本,并显示提示消息",Z4="要求输入数字,并显示提示消息",ey="要求用户输入数字。",ty="要求用户输入一些文本。",oy="%1 在 %2 里出现的次数",sy="计算在一段文本中,某个部分文本重复出现了多少次。",iy="把 %3 中的 %1 替换为 %2",ny="在一段文本中,将出现过的某部分文本都替换掉。",ry="倒转文本%1",ly="将文本中各个字符的顺序倒转。",cy="创建空列表",ay="返回一个列表,长度为 0,不包含任何数据记录",uy="建立一个具有任意数量项目的列表。",dy="创建列表,内容:",hy="列表",py="增加、删除或重新排列各部分以此重新配置这个列表块。",$y="将一个项添加到列表中。",_y="建立包含指定重复次数的值的列表。",gy="建立列表使用项 %1 重复 %2 次",fy="%1 的长度",my="返回列表的长度。",Ty="%1 是空的",Ey="如果改列表为空,则返回真。",by="在列表中",vy="寻找第一次出现的项",Iy="寻找最后一次出现的项",Oy="排序%1 %2 %3",Cy="排序一个列表,返回副本。",yy="升序",Sy="降序",Ry="按数字",ky="按字母",Ay="按字母(忽略大小写)",Ly="倒转%1",Ny="倒转一个列表,返回副本。",wy="返回此变量的值。",My="创建“设定%1”",Dy="设置 %1 的值为 %2",Py="设置此变量,以使它和输入值相等。",xy="创建“获得%1”",By="https://zh.wikipedia.org/wiki/子程序",Fy="定义函数",Uy="定义函数",Hy="做点什么",Vy="做点什么",Gy="",Wy="",zy="形参",Xy="创建一个不带输出值的函数。",jy="描述该功能...",Yy="https://zh.wikipedia.org/wiki/子程序",Ky="返回",Qy="创建一个有输出值的函数。",qy="允许声明",Jy="警告:此函数具有重复参数。",Zy="https://zh.wikipedia.org/wiki/子程序",eS="运行用户定义的函数“%1”。",tS="https://zh.wikipedia.org/wiki/子程序",oS="运行用户定义的函数“%1”,并使用它的输出值。",sS="输入",iS="添加、移除或重新排此函数的输入。",nS="输入名称:",rS="添加函数输入。",lS="突出显示函数定义",cS="创建“%1”",aS="如果值为真,则返回第二个值。",uS="警告:这个块只能在函数内部使用。",dS="说点什么...",hS="Blockly工作区",pS="已收起的信息块内包含警告。",$S="确认",_S="取消",k7={VARIABLES_DEFAULT_NAME:c2,UNNAMED_KEY:a2,TODAY:u2,DUPLICATE_BLOCK:d2,ADD_COMMENT:h2,REMOVE_COMMENT:p2,DUPLICATE_COMMENT:$2,EXTERNAL_INPUTS:_2,INLINE_INPUTS:g2,DELETE_BLOCK:f2,DELETE_X_BLOCKS:m2,DELETE_ALL_BLOCKS:T2,CLEAN_UP:E2,COLLAPSE_BLOCK:b2,COLLAPSE_ALL:v2,EXPAND_BLOCK:I2,EXPAND_ALL:O2,DISABLE_BLOCK:C2,ENABLE_BLOCK:y2,HELP:S2,UNDO:R2,REDO:k2,CHANGE_VALUE_TITLE:A2,RENAME_VARIABLE:L2,RENAME_VARIABLE_TITLE:N2,NEW_VARIABLE:w2,NEW_STRING_VARIABLE:M2,NEW_NUMBER_VARIABLE:D2,NEW_COLOUR_VARIABLE:P2,NEW_VARIABLE_TYPE_TITLE:x2,NEW_VARIABLE_TITLE:B2,VARIABLE_ALREADY_EXISTS:F2,VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE:U2,DELETE_VARIABLE_CONFIRMATION:H2,CANNOT_DELETE_VARIABLE_PROCEDURE:V2,DELETE_VARIABLE:G2,COLOUR_PICKER_HELPURL:W2,COLOUR_PICKER_TOOLTIP:z2,COLOUR_RANDOM_TITLE:X2,COLOUR_RANDOM_TOOLTIP:j2,COLOUR_RGB_TITLE:Y2,COLOUR_RGB_RED:K2,COLOUR_RGB_GREEN:Q2,COLOUR_RGB_BLUE:q2,COLOUR_RGB_TOOLTIP:J2,COLOUR_BLEND_TITLE:Z2,COLOUR_BLEND_COLOUR1:eO,COLOUR_BLEND_COLOUR2:tO,COLOUR_BLEND_RATIO:oO,COLOUR_BLEND_TOOLTIP:sO,CONTROLS_REPEAT_HELPURL:iO,CONTROLS_REPEAT_TITLE:nO,CONTROLS_REPEAT_INPUT_DO:rO,CONTROLS_REPEAT_TOOLTIP:lO,CONTROLS_WHILEUNTIL_OPERATOR_WHILE:cO,CONTROLS_WHILEUNTIL_OPERATOR_UNTIL:aO,CONTROLS_WHILEUNTIL_TOOLTIP_WHILE:uO,CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL:dO,CONTROLS_FOR_TOOLTIP:hO,CONTROLS_FOR_TITLE:pO,CONTROLS_FOREACH_TITLE:$O,CONTROLS_FOREACH_TOOLTIP:_O,CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK:gO,CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE:fO,CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK:mO,CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE:TO,CONTROLS_FLOW_STATEMENTS_WARNING:EO,CONTROLS_IF_TOOLTIP_1:bO,CONTROLS_IF_TOOLTIP_2:vO,CONTROLS_IF_TOOLTIP_3:IO,CONTROLS_IF_TOOLTIP_4:OO,CONTROLS_IF_MSG_IF:CO,CONTROLS_IF_MSG_THEN:yO,CONTROLS_IF_MSG_ELSEIF:SO,CONTROLS_IF_MSG_ELSE:RO,CONTROLS_IF_IF_TOOLTIP:kO,CONTROLS_IF_ELSEIF_TOOLTIP:AO,CONTROLS_IF_ELSE_TOOLTIP:LO,LOGIC_COMPARE_HELPURL:NO,LOGIC_COMPARE_TOOLTIP_EQ:wO,LOGIC_COMPARE_TOOLTIP_NEQ:MO,LOGIC_COMPARE_TOOLTIP_LT:DO,LOGIC_COMPARE_TOOLTIP_LTE:PO,LOGIC_COMPARE_TOOLTIP_GT:xO,LOGIC_COMPARE_TOOLTIP_GTE:BO,LOGIC_OPERATION_TOOLTIP_AND:FO,LOGIC_OPERATION_AND:UO,LOGIC_OPERATION_TOOLTIP_OR:HO,LOGIC_OPERATION_OR:VO,LOGIC_NEGATE_TITLE:GO,LOGIC_NEGATE_TOOLTIP:WO,LOGIC_BOOLEAN_TRUE:zO,LOGIC_BOOLEAN_FALSE:XO,LOGIC_BOOLEAN_TOOLTIP:jO,LOGIC_NULL:YO,LOGIC_NULL_TOOLTIP:KO,LOGIC_TERNARY_HELPURL:QO,LOGIC_TERNARY_CONDITION:qO,LOGIC_TERNARY_IF_TRUE:JO,LOGIC_TERNARY_IF_FALSE:ZO,LOGIC_TERNARY_TOOLTIP:eC,MATH_NUMBER_HELPURL:tC,MATH_NUMBER_TOOLTIP:oC,MATH_TRIG_SIN:sC,MATH_TRIG_COS:iC,MATH_TRIG_TAN:nC,MATH_TRIG_ASIN:rC,MATH_TRIG_ACOS:lC,MATH_TRIG_ATAN:cC,MATH_ARITHMETIC_HELPURL:aC,MATH_ARITHMETIC_TOOLTIP_ADD:uC,MATH_ARITHMETIC_TOOLTIP_MINUS:dC,MATH_ARITHMETIC_TOOLTIP_MULTIPLY:hC,MATH_ARITHMETIC_TOOLTIP_DIVIDE:pC,MATH_ARITHMETIC_TOOLTIP_POWER:$C,MATH_SINGLE_HELPURL:_C,MATH_SINGLE_OP_ROOT:gC,MATH_SINGLE_TOOLTIP_ROOT:fC,MATH_SINGLE_OP_ABSOLUTE:mC,MATH_SINGLE_TOOLTIP_ABS:TC,MATH_SINGLE_TOOLTIP_NEG:EC,MATH_SINGLE_TOOLTIP_LN:bC,MATH_SINGLE_TOOLTIP_LOG10:vC,MATH_SINGLE_TOOLTIP_EXP:IC,MATH_SINGLE_TOOLTIP_POW10:OC,MATH_TRIG_HELPURL:CC,MATH_TRIG_TOOLTIP_SIN:yC,MATH_TRIG_TOOLTIP_COS:SC,MATH_TRIG_TOOLTIP_TAN:RC,MATH_TRIG_TOOLTIP_ASIN:kC,MATH_TRIG_TOOLTIP_ACOS:AC,MATH_TRIG_TOOLTIP_ATAN:LC,MATH_CONSTANT_HELPURL:NC,MATH_CONSTANT_TOOLTIP:wC,MATH_IS_EVEN:MC,MATH_IS_ODD:DC,MATH_IS_PRIME:PC,MATH_IS_WHOLE:xC,MATH_IS_POSITIVE:BC,MATH_IS_NEGATIVE:FC,MATH_IS_TOOLTIP:UC,MATH_CHANGE_HELPURL:HC,MATH_CHANGE_TITLE:VC,MATH_CHANGE_TOOLTIP:GC,MATH_ROUND_HELPURL:WC,MATH_ROUND_TOOLTIP:zC,MATH_ROUND_OPERATOR_ROUND:XC,MATH_ROUND_OPERATOR_ROUNDUP:jC,MATH_ROUND_OPERATOR_ROUNDDOWN:YC,MATH_ONLIST_OPERATOR_SUM:KC,MATH_ONLIST_TOOLTIP_SUM:QC,MATH_ONLIST_OPERATOR_MIN:qC,MATH_ONLIST_TOOLTIP_MIN:JC,MATH_ONLIST_OPERATOR_MAX:ZC,MATH_ONLIST_TOOLTIP_MAX:e4,MATH_ONLIST_OPERATOR_AVERAGE:t4,MATH_ONLIST_TOOLTIP_AVERAGE:o4,MATH_ONLIST_OPERATOR_MEDIAN:s4,MATH_ONLIST_TOOLTIP_MEDIAN:i4,MATH_ONLIST_OPERATOR_MODE:n4,MATH_ONLIST_TOOLTIP_MODE:r4,MATH_ONLIST_OPERATOR_STD_DEV:l4,MATH_ONLIST_TOOLTIP_STD_DEV:c4,MATH_ONLIST_OPERATOR_RANDOM:a4,MATH_ONLIST_TOOLTIP_RANDOM:u4,MATH_MODULO_HELPURL:d4,MATH_MODULO_TITLE:h4,MATH_MODULO_TOOLTIP:p4,MATH_CONSTRAIN_TITLE:$4,MATH_CONSTRAIN_TOOLTIP:_4,MATH_RANDOM_INT_HELPURL:g4,MATH_RANDOM_INT_TITLE:f4,MATH_RANDOM_INT_TOOLTIP:m4,MATH_RANDOM_FLOAT_HELPURL:T4,MATH_RANDOM_FLOAT_TITLE_RANDOM:E4,MATH_RANDOM_FLOAT_TOOLTIP:b4,MATH_ATAN2_HELPURL:v4,MATH_ATAN2_TITLE:I4,MATH_ATAN2_TOOLTIP:O4,TEXT_TEXT_HELPURL:C4,TEXT_TEXT_TOOLTIP:y4,TEXT_JOIN_TITLE_CREATEWITH:S4,TEXT_JOIN_TOOLTIP:R4,TEXT_CREATE_JOIN_TITLE_JOIN:k4,TEXT_CREATE_JOIN_TOOLTIP:A4,TEXT_CREATE_JOIN_ITEM_TOOLTIP:L4,TEXT_APPEND_TITLE:N4,TEXT_APPEND_TOOLTIP:w4,TEXT_LENGTH_TITLE:M4,TEXT_LENGTH_TOOLTIP:D4,TEXT_ISEMPTY_TITLE:P4,TEXT_ISEMPTY_TOOLTIP:x4,TEXT_INDEXOF_TOOLTIP:B4,TEXT_INDEXOF_TITLE:F4,TEXT_INDEXOF_OPERATOR_FIRST:U4,TEXT_INDEXOF_OPERATOR_LAST:H4,TEXT_CHANGECASE_TOOLTIP:V4,TEXT_CHANGECASE_OPERATOR_UPPERCASE:G4,TEXT_CHANGECASE_OPERATOR_LOWERCASE:W4,TEXT_CHANGECASE_OPERATOR_TITLECASE:z4,TEXT_TRIM_TOOLTIP:X4,TEXT_TRIM_OPERATOR_BOTH:j4,TEXT_TRIM_OPERATOR_LEFT:Y4,TEXT_TRIM_OPERATOR_RIGHT:K4,TEXT_PRINT_TITLE:Q4,TEXT_PRINT_TOOLTIP:q4,TEXT_PROMPT_TYPE_TEXT:J4,TEXT_PROMPT_TYPE_NUMBER:Z4,TEXT_PROMPT_TOOLTIP_NUMBER:ey,TEXT_PROMPT_TOOLTIP_TEXT:ty,TEXT_COUNT_MESSAGE0:oy,TEXT_COUNT_TOOLTIP:sy,TEXT_REPLACE_MESSAGE0:iy,TEXT_REPLACE_TOOLTIP:ny,TEXT_REVERSE_MESSAGE0:ry,TEXT_REVERSE_TOOLTIP:ly,LISTS_CREATE_EMPTY_TITLE:cy,LISTS_CREATE_EMPTY_TOOLTIP:ay,LISTS_CREATE_WITH_TOOLTIP:uy,LISTS_CREATE_WITH_INPUT_WITH:dy,LISTS_CREATE_WITH_CONTAINER_TITLE_ADD:hy,LISTS_CREATE_WITH_CONTAINER_TOOLTIP:py,LISTS_CREATE_WITH_ITEM_TOOLTIP:$y,LISTS_REPEAT_TOOLTIP:_y,LISTS_REPEAT_TITLE:gy,LISTS_LENGTH_TITLE:fy,LISTS_LENGTH_TOOLTIP:my,LISTS_ISEMPTY_TITLE:Ty,LISTS_ISEMPTY_TOOLTIP:Ey,LISTS_INLIST:by,LISTS_INDEX_OF_FIRST:vy,LISTS_INDEX_OF_LAST:Iy,LISTS_SORT_TITLE:Oy,LISTS_SORT_TOOLTIP:Cy,LISTS_SORT_ORDER_ASCENDING:yy,LISTS_SORT_ORDER_DESCENDING:Sy,LISTS_SORT_TYPE_NUMERIC:Ry,LISTS_SORT_TYPE_TEXT:ky,LISTS_SORT_TYPE_IGNORECASE:Ay,LISTS_REVERSE_MESSAGE0:Ly,LISTS_REVERSE_TOOLTIP:Ny,VARIABLES_GET_TOOLTIP:wy,VARIABLES_GET_CREATE_SET:My,VARIABLES_SET:Dy,VARIABLES_SET_TOOLTIP:Py,VARIABLES_SET_CREATE_GET:xy,PROCEDURES_DEFNORETURN_HELPURL:By,PROCEDURES_DEFNORETURN_TITLE:Fy,PROCEDURES_DEFRETURN_TITLE:Uy,PROCEDURES_DEFNORETURN_PROCEDURE:Hy,PROCEDURES_DEFRETURN_PROCEDURE:Vy,PROCEDURES_BEFORE_PARAMS:Gy,PROCEDURES_CALL_BEFORE_PARAMS:Wy,PROCEDURE_VARIABLE:zy,PROCEDURES_DEFNORETURN_TOOLTIP:Xy,PROCEDURES_DEFNORETURN_COMMENT:jy,PROCEDURES_DEFRETURN_HELPURL:Yy,PROCEDURES_DEFRETURN_RETURN:Ky,PROCEDURES_DEFRETURN_TOOLTIP:Qy,PROCEDURES_ALLOW_STATEMENTS:qy,PROCEDURES_DEF_DUPLICATE_WARNING:Jy,PROCEDURES_CALLNORETURN_HELPURL:Zy,PROCEDURES_CALLNORETURN_TOOLTIP:eS,PROCEDURES_CALLRETURN_HELPURL:tS,PROCEDURES_CALLRETURN_TOOLTIP:oS,PROCEDURES_MUTATORCONTAINER_TITLE:sS,PROCEDURES_MUTATORCONTAINER_TOOLTIP:iS,PROCEDURES_MUTATORARG_TITLE:nS,PROCEDURES_MUTATORARG_TOOLTIP:rS,PROCEDURES_HIGHLIGHT_DEF:lS,PROCEDURES_CREATE_DO:cS,PROCEDURES_IFRETURN_TOOLTIP:aS,PROCEDURES_IFRETURN_WARNING:uS,WORKSPACE_COMMENT_DEFAULT_TEXT:dS,WORKSPACE_ARIA_LABEL:hS,COLLAPSED_WARNINGS_WARNING:pS,DIALOG_OK:$S,DIALOG_CANCEL:_S},A7=Object.freeze(Object.defineProperty({__proto__:null,ADD_COMMENT:h2,CANNOT_DELETE_VARIABLE_PROCEDURE:V2,CHANGE_VALUE_TITLE:A2,CLEAN_UP:E2,COLLAPSED_WARNINGS_WARNING:pS,COLLAPSE_ALL:v2,COLLAPSE_BLOCK:b2,COLOUR_BLEND_COLOUR1:eO,COLOUR_BLEND_COLOUR2:tO,COLOUR_BLEND_RATIO:oO,COLOUR_BLEND_TITLE:Z2,COLOUR_BLEND_TOOLTIP:sO,COLOUR_PICKER_HELPURL:W2,COLOUR_PICKER_TOOLTIP:z2,COLOUR_RANDOM_TITLE:X2,COLOUR_RANDOM_TOOLTIP:j2,COLOUR_RGB_BLUE:q2,COLOUR_RGB_GREEN:Q2,COLOUR_RGB_RED:K2,COLOUR_RGB_TITLE:Y2,COLOUR_RGB_TOOLTIP:J2,CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK:gO,CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE:fO,CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK:mO,CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE:TO,CONTROLS_FLOW_STATEMENTS_WARNING:EO,CONTROLS_FOREACH_TITLE:$O,CONTROLS_FOREACH_TOOLTIP:_O,CONTROLS_FOR_TITLE:pO,CONTROLS_FOR_TOOLTIP:hO,CONTROLS_IF_ELSEIF_TOOLTIP:AO,CONTROLS_IF_ELSE_TOOLTIP:LO,CONTROLS_IF_IF_TOOLTIP:kO,CONTROLS_IF_MSG_ELSE:RO,CONTROLS_IF_MSG_ELSEIF:SO,CONTROLS_IF_MSG_IF:CO,CONTROLS_IF_MSG_THEN:yO,CONTROLS_IF_TOOLTIP_1:bO,CONTROLS_IF_TOOLTIP_2:vO,CONTROLS_IF_TOOLTIP_3:IO,CONTROLS_IF_TOOLTIP_4:OO,CONTROLS_REPEAT_HELPURL:iO,CONTROLS_REPEAT_INPUT_DO:rO,CONTROLS_REPEAT_TITLE:nO,CONTROLS_REPEAT_TOOLTIP:lO,CONTROLS_WHILEUNTIL_OPERATOR_UNTIL:aO,CONTROLS_WHILEUNTIL_OPERATOR_WHILE:cO,CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL:dO,CONTROLS_WHILEUNTIL_TOOLTIP_WHILE:uO,DELETE_ALL_BLOCKS:T2,DELETE_BLOCK:f2,DELETE_VARIABLE:G2,DELETE_VARIABLE_CONFIRMATION:H2,DELETE_X_BLOCKS:m2,DIALOG_CANCEL:_S,DIALOG_OK:$S,DISABLE_BLOCK:C2,DUPLICATE_BLOCK:d2,DUPLICATE_COMMENT:$2,ENABLE_BLOCK:y2,EXPAND_ALL:O2,EXPAND_BLOCK:I2,EXTERNAL_INPUTS:_2,HELP:S2,INLINE_INPUTS:g2,LISTS_CREATE_EMPTY_TITLE:cy,LISTS_CREATE_EMPTY_TOOLTIP:ay,LISTS_CREATE_WITH_CONTAINER_TITLE_ADD:hy,LISTS_CREATE_WITH_CONTAINER_TOOLTIP:py,LISTS_CREATE_WITH_INPUT_WITH:dy,LISTS_CREATE_WITH_ITEM_TOOLTIP:$y,LISTS_CREATE_WITH_TOOLTIP:uy,LISTS_INDEX_OF_FIRST:vy,LISTS_INDEX_OF_LAST:Iy,LISTS_INLIST:by,LISTS_ISEMPTY_TITLE:Ty,LISTS_ISEMPTY_TOOLTIP:Ey,LISTS_LENGTH_TITLE:fy,LISTS_LENGTH_TOOLTIP:my,LISTS_REPEAT_TITLE:gy,LISTS_REPEAT_TOOLTIP:_y,LISTS_REVERSE_MESSAGE0:Ly,LISTS_REVERSE_TOOLTIP:Ny,LISTS_SORT_ORDER_ASCENDING:yy,LISTS_SORT_ORDER_DESCENDING:Sy,LISTS_SORT_TITLE:Oy,LISTS_SORT_TOOLTIP:Cy,LISTS_SORT_TYPE_IGNORECASE:Ay,LISTS_SORT_TYPE_NUMERIC:Ry,LISTS_SORT_TYPE_TEXT:ky,LOGIC_BOOLEAN_FALSE:XO,LOGIC_BOOLEAN_TOOLTIP:jO,LOGIC_BOOLEAN_TRUE:zO,LOGIC_COMPARE_HELPURL:NO,LOGIC_COMPARE_TOOLTIP_EQ:wO,LOGIC_COMPARE_TOOLTIP_GT:xO,LOGIC_COMPARE_TOOLTIP_GTE:BO,LOGIC_COMPARE_TOOLTIP_LT:DO,LOGIC_COMPARE_TOOLTIP_LTE:PO,LOGIC_COMPARE_TOOLTIP_NEQ:MO,LOGIC_NEGATE_TITLE:GO,LOGIC_NEGATE_TOOLTIP:WO,LOGIC_NULL:YO,LOGIC_NULL_TOOLTIP:KO,LOGIC_OPERATION_AND:UO,LOGIC_OPERATION_OR:VO,LOGIC_OPERATION_TOOLTIP_AND:FO,LOGIC_OPERATION_TOOLTIP_OR:HO,LOGIC_TERNARY_CONDITION:qO,LOGIC_TERNARY_HELPURL:QO,LOGIC_TERNARY_IF_FALSE:ZO,LOGIC_TERNARY_IF_TRUE:JO,LOGIC_TERNARY_TOOLTIP:eC,MATH_ARITHMETIC_HELPURL:aC,MATH_ARITHMETIC_TOOLTIP_ADD:uC,MATH_ARITHMETIC_TOOLTIP_DIVIDE:pC,MATH_ARITHMETIC_TOOLTIP_MINUS:dC,MATH_ARITHMETIC_TOOLTIP_MULTIPLY:hC,MATH_ARITHMETIC_TOOLTIP_POWER:$C,MATH_ATAN2_HELPURL:v4,MATH_ATAN2_TITLE:I4,MATH_ATAN2_TOOLTIP:O4,MATH_CHANGE_HELPURL:HC,MATH_CHANGE_TITLE:VC,MATH_CHANGE_TOOLTIP:GC,MATH_CONSTANT_HELPURL:NC,MATH_CONSTANT_TOOLTIP:wC,MATH_CONSTRAIN_TITLE:$4,MATH_CONSTRAIN_TOOLTIP:_4,MATH_IS_EVEN:MC,MATH_IS_NEGATIVE:FC,MATH_IS_ODD:DC,MATH_IS_POSITIVE:BC,MATH_IS_PRIME:PC,MATH_IS_TOOLTIP:UC,MATH_IS_WHOLE:xC,MATH_MODULO_HELPURL:d4,MATH_MODULO_TITLE:h4,MATH_MODULO_TOOLTIP:p4,MATH_NUMBER_HELPURL:tC,MATH_NUMBER_TOOLTIP:oC,MATH_ONLIST_OPERATOR_AVERAGE:t4,MATH_ONLIST_OPERATOR_MAX:ZC,MATH_ONLIST_OPERATOR_MEDIAN:s4,MATH_ONLIST_OPERATOR_MIN:qC,MATH_ONLIST_OPERATOR_MODE:n4,MATH_ONLIST_OPERATOR_RANDOM:a4,MATH_ONLIST_OPERATOR_STD_DEV:l4,MATH_ONLIST_OPERATOR_SUM:KC,MATH_ONLIST_TOOLTIP_AVERAGE:o4,MATH_ONLIST_TOOLTIP_MAX:e4,MATH_ONLIST_TOOLTIP_MEDIAN:i4,MATH_ONLIST_TOOLTIP_MIN:JC,MATH_ONLIST_TOOLTIP_MODE:r4,MATH_ONLIST_TOOLTIP_RANDOM:u4,MATH_ONLIST_TOOLTIP_STD_DEV:c4,MATH_ONLIST_TOOLTIP_SUM:QC,MATH_RANDOM_FLOAT_HELPURL:T4,MATH_RANDOM_FLOAT_TITLE_RANDOM:E4,MATH_RANDOM_FLOAT_TOOLTIP:b4,MATH_RANDOM_INT_HELPURL:g4,MATH_RANDOM_INT_TITLE:f4,MATH_RANDOM_INT_TOOLTIP:m4,MATH_ROUND_HELPURL:WC,MATH_ROUND_OPERATOR_ROUND:XC,MATH_ROUND_OPERATOR_ROUNDDOWN:YC,MATH_ROUND_OPERATOR_ROUNDUP:jC,MATH_ROUND_TOOLTIP:zC,MATH_SINGLE_HELPURL:_C,MATH_SINGLE_OP_ABSOLUTE:mC,MATH_SINGLE_OP_ROOT:gC,MATH_SINGLE_TOOLTIP_ABS:TC,MATH_SINGLE_TOOLTIP_EXP:IC,MATH_SINGLE_TOOLTIP_LN:bC,MATH_SINGLE_TOOLTIP_LOG10:vC,MATH_SINGLE_TOOLTIP_NEG:EC,MATH_SINGLE_TOOLTIP_POW10:OC,MATH_SINGLE_TOOLTIP_ROOT:fC,MATH_TRIG_ACOS:lC,MATH_TRIG_ASIN:rC,MATH_TRIG_ATAN:cC,MATH_TRIG_COS:iC,MATH_TRIG_HELPURL:CC,MATH_TRIG_SIN:sC,MATH_TRIG_TAN:nC,MATH_TRIG_TOOLTIP_ACOS:AC,MATH_TRIG_TOOLTIP_ASIN:kC,MATH_TRIG_TOOLTIP_ATAN:LC,MATH_TRIG_TOOLTIP_COS:SC,MATH_TRIG_TOOLTIP_SIN:yC,MATH_TRIG_TOOLTIP_TAN:RC,NEW_COLOUR_VARIABLE:P2,NEW_NUMBER_VARIABLE:D2,NEW_STRING_VARIABLE:M2,NEW_VARIABLE:w2,NEW_VARIABLE_TITLE:B2,NEW_VARIABLE_TYPE_TITLE:x2,PROCEDURES_ALLOW_STATEMENTS:qy,PROCEDURES_BEFORE_PARAMS:Gy,PROCEDURES_CALLNORETURN_HELPURL:Zy,PROCEDURES_CALLNORETURN_TOOLTIP:eS,PROCEDURES_CALLRETURN_HELPURL:tS,PROCEDURES_CALLRETURN_TOOLTIP:oS,PROCEDURES_CALL_BEFORE_PARAMS:Wy,PROCEDURES_CREATE_DO:cS,PROCEDURES_DEFNORETURN_COMMENT:jy,PROCEDURES_DEFNORETURN_HELPURL:By,PROCEDURES_DEFNORETURN_PROCEDURE:Hy,PROCEDURES_DEFNORETURN_TITLE:Fy,PROCEDURES_DEFNORETURN_TOOLTIP:Xy,PROCEDURES_DEFRETURN_HELPURL:Yy,PROCEDURES_DEFRETURN_PROCEDURE:Vy,PROCEDURES_DEFRETURN_RETURN:Ky,PROCEDURES_DEFRETURN_TITLE:Uy,PROCEDURES_DEFRETURN_TOOLTIP:Qy,PROCEDURES_DEF_DUPLICATE_WARNING:Jy,PROCEDURES_HIGHLIGHT_DEF:lS,PROCEDURES_IFRETURN_TOOLTIP:aS,PROCEDURES_IFRETURN_WARNING:uS,PROCEDURES_MUTATORARG_TITLE:nS,PROCEDURES_MUTATORARG_TOOLTIP:rS,PROCEDURES_MUTATORCONTAINER_TITLE:sS,PROCEDURES_MUTATORCONTAINER_TOOLTIP:iS,PROCEDURE_VARIABLE:zy,REDO:k2,REMOVE_COMMENT:p2,RENAME_VARIABLE:L2,RENAME_VARIABLE_TITLE:N2,TEXT_APPEND_TITLE:N4,TEXT_APPEND_TOOLTIP:w4,TEXT_CHANGECASE_OPERATOR_LOWERCASE:W4,TEXT_CHANGECASE_OPERATOR_TITLECASE:z4,TEXT_CHANGECASE_OPERATOR_UPPERCASE:G4,TEXT_CHANGECASE_TOOLTIP:V4,TEXT_COUNT_MESSAGE0:oy,TEXT_COUNT_TOOLTIP:sy,TEXT_CREATE_JOIN_ITEM_TOOLTIP:L4,TEXT_CREATE_JOIN_TITLE_JOIN:k4,TEXT_CREATE_JOIN_TOOLTIP:A4,TEXT_INDEXOF_OPERATOR_FIRST:U4,TEXT_INDEXOF_OPERATOR_LAST:H4,TEXT_INDEXOF_TITLE:F4,TEXT_INDEXOF_TOOLTIP:B4,TEXT_ISEMPTY_TITLE:P4,TEXT_ISEMPTY_TOOLTIP:x4,TEXT_JOIN_TITLE_CREATEWITH:S4,TEXT_JOIN_TOOLTIP:R4,TEXT_LENGTH_TITLE:M4,TEXT_LENGTH_TOOLTIP:D4,TEXT_PRINT_TITLE:Q4,TEXT_PRINT_TOOLTIP:q4,TEXT_PROMPT_TOOLTIP_NUMBER:ey,TEXT_PROMPT_TOOLTIP_TEXT:ty,TEXT_PROMPT_TYPE_NUMBER:Z4,TEXT_PROMPT_TYPE_TEXT:J4,TEXT_REPLACE_MESSAGE0:iy,TEXT_REPLACE_TOOLTIP:ny,TEXT_REVERSE_MESSAGE0:ry,TEXT_REVERSE_TOOLTIP:ly,TEXT_TEXT_HELPURL:C4,TEXT_TEXT_TOOLTIP:y4,TEXT_TRIM_OPERATOR_BOTH:j4,TEXT_TRIM_OPERATOR_LEFT:Y4,TEXT_TRIM_OPERATOR_RIGHT:K4,TEXT_TRIM_TOOLTIP:X4,TODAY:u2,UNDO:R2,UNNAMED_KEY:a2,VARIABLES_DEFAULT_NAME:c2,VARIABLES_GET_CREATE_SET:My,VARIABLES_GET_TOOLTIP:wy,VARIABLES_SET:Dy,VARIABLES_SET_CREATE_GET:xy,VARIABLES_SET_TOOLTIP:Py,VARIABLE_ALREADY_EXISTS:F2,VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE:U2,WORKSPACE_ARIA_LABEL:hS,WORKSPACE_COMMENT_DEFAULT_TEXT:dS,default:k7},Symbol.toStringTag,{value:"Module"}));const L7={__name:"Workspace",setup(o){Tt.setLocale(A7),Tt.Scrollbar.scrollbarThickness=15,Tt.FlyoutButton.BORDER_RADIUS=4,Tt.FlyoutButton.TEXT_MARGIN_X=10,Tt.FlyoutButton.TEXT_MARGIN_Y=10,tn("lists_create_with","list"),tn("procedures_defnoreturn","function"),tn("procedures_defreturn","function"),tn("procedures_ifreturn","function"),tn("procedures_callnoreturn","function"),tn("procedures_callreturn","function"),tn("time_current","time");const n=ge(),s=lr(),l={toolbox:t2,media:"/media",trashcan:!1,zoom:{controls:!0,wheel:!0,startScale:.8,maxScale:1.4,minScale:.5},move:{scrollbars:!0,drag:!0,wheel:!0},theme:"codemao",renderer:"codemao"};return zt(()=>{s.$patch(a=>{a.workspaceSvg=Tt.inject(n.value,l),a.searchPlugin=new R7(s.workspaceSvg)}),s.searchPlugin.setSearchPlaceholder("搜索作品中的积木"),s.searchPlugin.init()}),(a,u)=>(me(),Fe("div",{class:"blocklyDiv",ref_key:"blocklyDiv",ref:n},null,512))}};const N7={id:"zoombox"},w7={__name:"Zoombox",setup(o){const n=ge(),s=lr();function l(){s.workspaceSvg.cleanUp()}function a(){s.hasLayoutSider=!s.hasLayoutSider}function u(){let p=s.workspaceSvg.options.zoomOptions.scaleSpeed,f=s.workspaceSvg.scale;s.workspaceSvg.zoom(0,0,Math.log((f-.15)/f)/Math.log(p))}function d(){document.getElementsByClassName("blocklyZoom")[2].dispatchEvent(new PointerEvent("pointerdown"))}function h(){let p=s.workspaceSvg.options.zoomOptions.scaleSpeed,f=s.workspaceSvg.scale;s.workspaceSvg.zoom(0,0,Math.log((f+.15)/f)/Math.log(p))}return zt(()=>{s.workspaceSvg.addChangeListener(()=>{n.value.innerHTML=Math.floor((s.workspaceSvg.scale*(5/3)-1/3)*100)+"%"})}),(p,f)=>{const T=Vc,C=D0,S=Og;return me(),Fe("div",N7,[Q(S,null,{default:De(()=>[Q(C,{content:"整理",position:"top",mini:""},{default:De(()=>[Q(T,{type:"text",onClick:l,"aria-label":"整理"},{icon:De(()=>[Q(Xo(pD))]),_:1})]),_:1})]),_:1}),Q(S,null,{default:De(()=>[Q(C,{content:"代码区",position:"top",mini:""},{default:De(()=>[Q(T,{type:"text",onClick:a,"aria-label":"代码区"},{icon:De(()=>[Q(Xo(I8))]),_:1})]),_:1})]),_:1}),Q(S,null,{default:De(()=>[Q(C,{content:"缩小",position:"top",mini:""},{default:De(()=>[Q(T,{type:"text",onClick:u,"aria-label":"缩小"},{icon:De(()=>[Q(Xo(P8))]),_:1})]),_:1}),Q(C,{content:"恢复为100%",position:"top",mini:""},{default:De(()=>[Q(T,{type:"text",onClick:d,"aria-label":"恢复为100%"},{default:De(()=>[Le("span",{ref_key:"scale",ref:n},"100%",512)]),_:1})]),_:1}),Q(C,{content:"放大",position:"top",mini:""},{default:De(()=>[Q(T,{type:"text",onClick:h,"aria-label":"放大"},{icon:De(()=>[Q(Xo(k8))]),_:1})]),_:1})]),_:1})])}}};const M7={__name:"App",setup(o){let n;const s=ge(),l=lr();function a(){for(let d=0;d<5;d++)setTimeout(()=>{Tt.svgResize(l.workspaceSvg)},100*d)}function u(d=!1){s.value.$el.style.display=d?"block":"none",a()}return zt(()=>{Et(l.$state,d=>{d.hasLayoutSider!==n&&(u(d.hasLayoutSider),n=d.hasLayoutSider)},{deep:!0}),a(),u()}),(d,h)=>{const p=Du,f=Pu,T=CM;return me(),Fe(Wt,null,[Q(T,null,{default:De(()=>[Q(p,null,{default:De(()=>[Q(L7),Q(u7),Q(m7),Q(w7)]),_:1}),Q(f,{ref_key:"layoutSider",ref:s,"resize-directions":["left"],onMoving:a,onMovingEnd:a},{default:De(()=>[Q(kD)]),_:1},512)]),_:1}),Q(l7),Q(b7),Q(c7),Q(AD)],64)}}};yc.registerLanguage("javascript",x5);yc.registerLanguage("python",B5);const kg=V3(M7),D7=U5();kg.use(N5);kg.use(D7);kg.mount("#app");if("serviceWorker"in navigator){const o=Q5({onNeedRefresh(){dn.confirm({title:"注意",content:"当前版本有更新,请问是否立即更新。",okText:"确认",onOk:()=>{o(!0)},onCancel:!1,hideCancel:!1})}})}
diff --git a/dist/assets/index-8f79ef64.js.gz b/dist/assets/index-8f79ef64.js.gz
new file mode 100644
index 0000000000000000000000000000000000000000..c13279a056bed76e69aaa69745a76382ef2e4f2a
Binary files /dev/null and b/dist/assets/index-8f79ef64.js.gz differ
diff --git a/dist/index.html b/dist/index.html
index 32315cdb09973a77b60f3ac1f25b9281772f335f..06acd44badfb085cec63131bad61e37c2e454492 100644
--- a/dist/index.html
+++ b/dist/index.html
@@ -11,7 +11,7 @@
Boxy
-
+
diff --git a/dist/sw.js b/dist/sw.js
index 549ba866a0c4635caf4b5221d045426d9ad2dfe6..d18a71f91180a5552364204ca07469961c345f72 100644
--- a/dist/sw.js
+++ b/dist/sw.js
@@ -1 +1 @@
-if(!self.define){let e,s={};const n=(n,i)=>(n=new URL(n+".js",i).href,s[n]||new Promise((s=>{if("document"in self){const e=document.createElement("script");e.src=n,e.onload=s,document.head.appendChild(e)}else e=n,importScripts(n),s()})).then((()=>{let e=s[n];if(!e)throw new Error(`Module ${n} didn’t register its module`);return e})));self.define=(i,t)=>{const o=e||("document"in self?document.currentScript.src:"")||location.href;if(s[o])return;let r={};const l=e=>n(e,o),c={module:{uri:o},exports:r,require:l};s[o]=Promise.all(i.map((e=>c[e]||l(e)))).then((e=>(t(...e),r)))}}define(["./workbox-bf1ed05b"],(function(e){"use strict";self.addEventListener("message",(e=>{e.data&&"SKIP_WAITING"===e.data.type&&self.skipWaiting()})),e.precacheAndRoute([{url:"assets/index-5971f7e7.js",revision:null},{url:"assets/index-825ada8c.css",revision:null},{url:"assets/workbox-window.prod.es5-a7b12eab.js",revision:null},{url:"index.html",revision:"efee571707edee3c13112fe6435e513e"},{url:"manifest.webmanifest",revision:"4fd5a74a9ab05dcb5196ecee501098a3"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html"))),e.registerRoute(/.*/i,new e.NetworkFirst({cacheName:"boxy-cache",plugins:[new e.ExpirationPlugin({maxEntries:10,maxAgeSeconds:2592e3}),new e.CacheableResponsePlugin({statuses:[0,200]})]}),"GET")}));
+if(!self.define){let e,s={};const n=(n,i)=>(n=new URL(n+".js",i).href,s[n]||new Promise((s=>{if("document"in self){const e=document.createElement("script");e.src=n,e.onload=s,document.head.appendChild(e)}else e=n,importScripts(n),s()})).then((()=>{let e=s[n];if(!e)throw new Error(`Module ${n} didn’t register its module`);return e})));self.define=(i,t)=>{const o=e||("document"in self?document.currentScript.src:"")||location.href;if(s[o])return;let r={};const d=e=>n(e,o),l={module:{uri:o},exports:r,require:d};s[o]=Promise.all(i.map((e=>l[e]||d(e)))).then((e=>(t(...e),r)))}}define(["./workbox-bf1ed05b"],(function(e){"use strict";self.addEventListener("message",(e=>{e.data&&"SKIP_WAITING"===e.data.type&&self.skipWaiting()})),e.precacheAndRoute([{url:"assets/index-825ada8c.css",revision:null},{url:"assets/index-c7dda4ec.js",revision:null},{url:"assets/workbox-window.prod.es5-a7b12eab.js",revision:null},{url:"index.html",revision:"fcba879ad48e951ddbf02309fcba724d"},{url:"manifest.webmanifest",revision:"4fd5a74a9ab05dcb5196ecee501098a3"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html"))),e.registerRoute(/.*/i,new e.NetworkFirst({cacheName:"boxy-cache",plugins:[new e.ExpirationPlugin({maxEntries:10,maxAgeSeconds:2592e3}),new e.CacheableResponsePlugin({statuses:[0,200]})]}),"GET")}));
diff --git a/main.py b/main.py
index 4ea6213a5611883fb2e142c677c1b8282344544e..912d392dcce9713c3b2f5597d7757a7cefc23787 100644
--- a/main.py
+++ b/main.py
@@ -1,8 +1,31 @@
-from flask import Flask, render_template
+"""
+time: 2025
+author: CodeKpy & Coconut Studio
+"""
+
+#from click import command
+from flask import Flask, render_template, request, jsonify
import pipList
+import subprocess
+import os
+#from urllib.parse import unquote
+
+#from pipVersion import package_name
app = Flask(__name__, template_folder='dist', static_folder='dist/assets')
+# 判断是否存在project虚拟环境,不存在则创建
+if not os.path.exists('project'):
+ import os
+ os.system('python -m venv project')
+
+venv_path = "/project"
+# Windows系统
+activate_script = f"{venv_path}\\Scripts\\activate"
+
+# 执行激活虚拟环境的命令
+#subprocess.run(activate_script, shell=True)
+
# 定义一个路由,当访问根目录时,返回editor.html模板
@app.route('/')
def index():
@@ -22,15 +45,66 @@ def api(api):
result = pipList.main()
"""result = subprocess.check_output(['pip', 'freeze']).decode('utf-8')"""
# 将内容按行分割制作JSON
- result = [line.split() for line in result.split('\n')[2:-1]]
+ # 按行分割输出
+ lines = result.split('\n')
+
+ # 解析每一行并存储为字典
+ packages = []
+ i = 0
+ for line in lines:
+ if i >1:
+ if line.strip(): # 跳过空行
+ parts = line.split() # 默认按空格分割
+ if len(parts) >= 2:
+ package = parts[0]
+ version = parts[1]
+ packages.append({"Package": package, "Version": version})
+ else:
+ i += 1
+
# 返回JSON
print(result)
- return {'pipList': result}
+ return {'pipList': packages}
elif api == 'pyVenv':
# 新建Python "project"虚拟环境
- import os
+
os.system('python -m venv project')
return {'pyVenv': 'success'}
+ elif api == 'pipInstall':
+ # 从 GET 请求中读取参数
+ package_name = request.args.get('packageName')
+ install_source = request.args.get('installSource')
+
+ # 检查参数是否为空
+ if not package_name:
+ return jsonify({'error': 'packageName is required'}), 400
+ if not install_source:
+ return jsonify({'error': 'installSource is required'}), 400
+
+ # 打印参数值(实际开发中可以进行相应的处理)
+ print(f"Package Name: {package_name}")
+ print(f"Install Source: {install_source}")
+
+
+ # result = subprocess.run(['pip', 'install', package_name, '-i', install_source],shell=True, capture_output=True, text=True, encoding="utf-8")
+
+ """# 使用 Popen 执行命令并捕获输出
+ process = subprocess.Popen(r'.\project\Scripts\activate && && ' + f'pip install {package_name} -i {install_source}', shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, encoding="cp936")
+ stdout, stderr = process.communicate()"""
+ command = r'.\project\Scripts\activate && pip install '+package_name+' -i ' + install_source
+ print(command)
+ process = subprocess.Popen(
+ command,
+ shell=True,
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, encoding="cp936")
+ stdout, stderr = process.communicate()
+
+ # 检查命令是否成功执行
+ if process.returncode == 0:
+ return jsonify({'success': 'Package installed successfully'})
+ else:
+ return jsonify({'error': 'Failed to install package'}), 500
+
if __name__ == '__main__':
diff --git a/pipList.py b/pipList.py
index d615ac23f805cc21effb9d04479191ce21efd52c..f789d2bebe473be5ad9dbb7edc395b28d792a33b 100644
--- a/pipList.py
+++ b/pipList.py
@@ -1,45 +1,39 @@
import subprocess
+venv_path = r".\project"
-# 进入project虚拟环境
-def activate_virtualenv(venv_path):
- # Windows系统
+# 激活虚拟环境并获取 pip 列表
+def get_pip_list(venv_path):
+ # 构造激活虚拟环境和获取 pip 列表的命令
activate_script = f"{venv_path}\\Scripts\\activate"
+ pip_list_command = "pip list"
- # 执行激活虚拟环境的命令
- subprocess.run(activate_script, shell=True)
+ # 使用 shell 执行命令
+ command = f"{activate_script} && {pip_list_command}"
+ try:
+ # 使用 Popen 执行命令并捕获输出
+ process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, encoding="cp936")
+ stdout, stderr = process.communicate()
-# 获取pip列表
-def get_pip_list():
- # 获取pip列表的命令
- pip_list_command = "pip freeze"
-
- # 执行命令并获取输出
- result = subprocess.run(pip_list_command, shell=True, capture_output=True, text=True, encoding="utf-8")
-
- # 检查命令是否成功执行
- if result.returncode == 0:
- return result.stdout
- else:
- return result.stderr
+ # 检查命令是否成功执行
+ if process.returncode == 0:
+ return stdout.strip()
+ else:
+ return f"Error: {stderr.strip()}"
+ except Exception as e:
+ return f"Exception occurred: {str(e)}"
# 主函数
def main():
- # 虚拟环境路径
- venv_path = "/project"
-
- # 激活虚拟环境
- activate_virtualenv(venv_path)
-
- # 获取pip列表
- pip_list = get_pip_list()
+ # 获取 pip 列表
+ pip_list = get_pip_list(venv_path)
- # 打印pip列表
+ # 打印 pip 列表
print(pip_list)
return pip_list
if __name__ == "__main__":
- main()
+ main()
\ No newline at end of file