release: v9.0.1

Merge pull request #6573 from cpcallen/blockly-9.0.1
This commit is contained in:
Christopher Allen
2022-10-19 22:31:04 +01:00
committed by GitHub
17 changed files with 390 additions and 179 deletions

View File

@@ -13,7 +13,7 @@
}(this, function() {
var $={};
var longStart$$module$build$src$core$touch=function(a,b){longStop$$module$build$src$core$touch();a.changedTouches&&1!==a.changedTouches.length||(longPid_$$module$build$src$core$touch=setTimeout(function(){a.changedTouches&&(a.button=2,a.clientX=a.changedTouches[0].clientX,a.clientY=a.changedTouches[0].clientY);b&&b.handleRightClick(a)},LONGPRESS$$module$build$src$core$touch))},longStop$$module$build$src$core$touch=function(){longPid_$$module$build$src$core$touch&&(clearTimeout(longPid_$$module$build$src$core$touch),
longPid_$$module$build$src$core$touch=0)},clearTouchIdentifier$$module$build$src$core$touch=function(){touchIdentifier_$$module$build$src$core$touch=null},shouldHandleEvent$$module$build$src$core$touch=function(a){return!isMouseOrTouchEvent$$module$build$src$core$touch(a)||checkTouchIdentifier$$module$build$src$core$touch(a)},getTouchIdentifierFromEvent$$module$build$src$core$touch=function(a){return a instanceof MouseEvent?"mouse":a instanceof PointerEvent?String(a.pointerId):a.changedTouches&&a.changedTouches[0]&&
longPid_$$module$build$src$core$touch=0)},clearTouchIdentifier$$module$build$src$core$touch=function(){touchIdentifier_$$module$build$src$core$touch=null},shouldHandleEvent$$module$build$src$core$touch=function(a){return!isMouseOrTouchEvent$$module$build$src$core$touch(a)||checkTouchIdentifier$$module$build$src$core$touch(a)},getTouchIdentifierFromEvent$$module$build$src$core$touch=function(a){return a instanceof PointerEvent?String(a.pointerId):a instanceof MouseEvent?"mouse":a.changedTouches&&a.changedTouches[0]&&
void 0!==a.changedTouches[0].identifier&&null!==a.changedTouches[0].identifier?String(a.changedTouches[0].identifier):"mouse"},checkTouchIdentifier$$module$build$src$core$touch=function(a){const b=getTouchIdentifierFromEvent$$module$build$src$core$touch(a);return void 0!==touchIdentifier_$$module$build$src$core$touch&&null!==touchIdentifier_$$module$build$src$core$touch?touchIdentifier_$$module$build$src$core$touch===b:"mousedown"===a.type||"touchstart"===a.type||"pointerdown"===a.type?(touchIdentifier_$$module$build$src$core$touch=
b,!0):!1},setClientFromTouch$$module$build$src$core$touch=function(a){if(a.type.startsWith("touch")&&a.changedTouches){const b=a.changedTouches[0];a.clientX=b.clientX;a.clientY=b.clientY}},isMouseOrTouchEvent$$module$build$src$core$touch=function(a){return a.type.startsWith("touch")||a.type.startsWith("mouse")||a.type.startsWith("pointer")},isTouchEvent$$module$build$src$core$touch=function(a){return a.type.startsWith("touch")||a.type.startsWith("pointer")},splitEventByTouches$$module$build$src$core$touch=
function(a){const b=[];if(a.changedTouches)for(let c=0;c<a.changedTouches.length;c++)b[c]={type:a.type,changedTouches:[a.changedTouches[c]],target:a.target,stopPropagation(){a.stopPropagation()},preventDefault(){a.preventDefault()}};else b.push(a);return b},conditionalBind$$module$build$src$core$browser_events=function(a,b,c,d,e,f){function g(n){const p=!e;n=splitEventByTouches$$module$build$src$core$touch(n);for(let r=0;r<n.length;r++){const q=n[r];if(!p||shouldHandleEvent$$module$build$src$core$touch(q))setClientFromTouch$$module$build$src$core$touch(q),
@@ -205,44 +205,45 @@ c=c.cloneNode(!0);c.setAttribute("transform","translate("+d.x+","+d.y+")");b.get
(1-f)*e+")"),setTimeout(disposeUiStep$$module$build$src$core$block_animations,10,a,b,c,d,e))},connectionUiEffect$$module$build$src$core$block_animations=function(a){const b=a.workspace,c=b.scale;b.getAudioManager().play("click");if(!(1>c)){var d=b.getSvgXY(a.getSvgRoot());a.outputConnection?(d.x+=(a.RTL?3:-3)*c,d.y+=13*c):a.previousConnection&&(d.x+=(a.RTL?-23:23)*c,d.y+=3*c);a=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.CIRCLE,{cx:d.x,cy:d.y,r:0,fill:"none",
stroke:"#888","stroke-width":10},b.getParentSvg());connectionUiStep$$module$build$src$core$block_animations(a,new Date,c)}},connectionUiStep$$module$build$src$core$block_animations=function(a,b,c){const d=((new Date).getTime()-b.getTime())/150;1<d?removeNode$$module$build$src$core$utils$dom(a):(a.setAttribute("r",(25*d*c).toString()),a.style.opacity=(1-d).toString(),disconnectPid$$module$build$src$core$block_animations=setTimeout(connectionUiStep$$module$build$src$core$block_animations,10,a,b,c))},
disconnectUiEffect$$module$build$src$core$block_animations=function(a){disconnectUiStop$$module$build$src$core$block_animations();a.workspace.getAudioManager().play("disconnect");if(!(1>a.workspace.scale)){var b=a.getHeightWidth().height;b=Math.atan(10/b)/Math.PI*180;a.RTL||(b*=-1);disconnectGroup$$module$build$src$core$block_animations=a.getSvgRoot();disconnectUiStep$$module$build$src$core$block_animations(disconnectGroup$$module$build$src$core$block_animations,b,new Date)}},disconnectUiStep$$module$build$src$core$block_animations=
function(a,b,c){const d=((new Date).getTime()-c.getTime())/200;let e="";1>=d&&(e=`skewX(${Math.round(Math.sin(d*Math.PI*3)*(1-d)*b)})`,disconnectPid$$module$build$src$core$block_animations=setTimeout(disconnectUiStep$$module$build$src$core$block_animations,10,a,b,c));a.setAttribute("transform",e)},disconnectUiStop$$module$build$src$core$block_animations=function(){disconnectGroup$$module$build$src$core$block_animations&&(disconnectPid$$module$build$src$core$block_animations&&clearTimeout(disconnectPid$$module$build$src$core$block_animations),
disconnectGroup$$module$build$src$core$block_animations.setAttribute("transform",""),disconnectGroup$$module$build$src$core$block_animations=null)},copy$$module$build$src$core$clipboard=function(a){TEST_ONLY$$module$build$src$core$clipboard.copyInternal(a)},copyInternal$$module$build$src$core$clipboard=function(a){copyData$$module$build$src$core$clipboard=a.toCopyData()},paste$$module$build$src$core$clipboard=function(){if(!copyData$$module$build$src$core$clipboard)return null;let a=copyData$$module$build$src$core$clipboard.source;
a.isFlyout&&(a=a.targetWorkspace);return copyData$$module$build$src$core$clipboard.typeCounts&&a.isCapacityAvailable(copyData$$module$build$src$core$clipboard.typeCounts)?a.paste(copyData$$module$build$src$core$clipboard.saveInfo):null},duplicate$$module$build$src$core$clipboard=function(a){return TEST_ONLY$$module$build$src$core$clipboard.duplicateInternal(a)},duplicateInternal$$module$build$src$core$clipboard=function(a){const b=copyData$$module$build$src$core$clipboard;copy$$module$build$src$core$clipboard(a);
let c,d,e;a=null!=(e=null==(c=a.toCopyData())?void 0:null==(d=c.source)?void 0:d.paste(copyData$$module$build$src$core$clipboard.saveInfo))?e:null;copyData$$module$build$src$core$clipboard=b;return a},getCurrentBlock$$module$build$src$core$contextmenu=function(){return currentBlock$$module$build$src$core$contextmenu},setCurrentBlock$$module$build$src$core$contextmenu=function(a){currentBlock$$module$build$src$core$contextmenu=a},show$$module$build$src$core$contextmenu=function(a,b,c){show$$module$build$src$core$widgetdiv(dummyOwner$$module$build$src$core$contextmenu,
c,dispose$$module$build$src$core$contextmenu);if(b.length){var d=populate_$$module$build$src$core$contextmenu(b,c);menu_$$module$build$src$core$contextmenu=d;position_$$module$build$src$core$contextmenu(d,a,c);setTimeout(function(){d.focus()},1);currentBlock$$module$build$src$core$contextmenu=null}else hide$$module$build$src$core$contextmenu()},populate_$$module$build$src$core$contextmenu=function(a,b){const c=new Menu$$module$build$src$core$menu;c.setRole(Role$$module$build$src$core$utils$aria.MENU);
for(let d=0;d<a.length;d++){const e=a[d],f=new MenuItem$$module$build$src$core$menuitem(e.text);f.setRightToLeft(b);f.setRole(Role$$module$build$src$core$utils$aria.MENUITEM);c.addChild(f);f.setEnabled(e.enabled);if(e.enabled)f.onAction(function(){hide$$module$build$src$core$contextmenu();e.callback(e.scope)},{})}return c},position_$$module$build$src$core$contextmenu=function(a,b,c){const d=getViewportBBox$$module$build$src$core$utils$svg_math();b=new Rect$$module$build$src$core$utils$rect(b.clientY+
d.top,b.clientY+d.top,b.clientX+d.left,b.clientX+d.left);createWidget_$$module$build$src$core$contextmenu(a);const e=a.getSize();c&&(b.left+=e.width,b.right+=e.width,d.left+=e.width,d.right+=e.width);positionWithAnchor$$module$build$src$core$widgetdiv(d,b,e,c);a.focus()},createWidget_$$module$build$src$core$contextmenu=function(a){var b=getDiv$$module$build$src$core$widgetdiv();if(!b)throw Error("Attempting to create a context menu when widget div is null");b=a.render(b);addClass$$module$build$src$core$utils$dom(b,
"blocklyContextMenu");conditionalBind$$module$build$src$core$browser_events(b,"contextmenu",null,haltPropagation$$module$build$src$core$contextmenu);a.focus()},haltPropagation$$module$build$src$core$contextmenu=function(a){a.preventDefault();a.stopPropagation()},hide$$module$build$src$core$contextmenu=function(){hideIfOwner$$module$build$src$core$widgetdiv(dummyOwner$$module$build$src$core$contextmenu);currentBlock$$module$build$src$core$contextmenu=null},dispose$$module$build$src$core$contextmenu=
function(){menu_$$module$build$src$core$contextmenu&&(menu_$$module$build$src$core$contextmenu.dispose(),menu_$$module$build$src$core$contextmenu=null)},callbackFactory$$module$build$src$core$contextmenu=function(a,b){return()=>{disable$$module$build$src$core$events$utils();let c;try{c=domToBlock$$module$build$src$core$xml(b,a.workspace);const d=a.getRelativeToSurfaceXY();d.x=a.RTL?d.x-$.config$$module$build$src$core$config.snapRadius:d.x+$.config$$module$build$src$core$config.snapRadius;d.y+=2*$.config$$module$build$src$core$config.snapRadius;
c.moveBy(d.x,d.y)}finally{enable$$module$build$src$core$events$utils()}isEnabled$$module$build$src$core$events$utils()&&!c.isShadow()&&fire$$module$build$src$core$events$utils(new (get$$module$build$src$core$events$utils(CREATE$$module$build$src$core$events$utils))(c));c.select()}},commentDeleteOption$$module$build$src$core$contextmenu=function(a){return{text:Msg$$module$build$src$core$msg.REMOVE_COMMENT,enabled:!0,callback:function(){setGroup$$module$build$src$core$events$utils(!0);a.dispose();setGroup$$module$build$src$core$events$utils(!1)}}},
commentDuplicateOption$$module$build$src$core$contextmenu=function(a){return{text:Msg$$module$build$src$core$msg.DUPLICATE_COMMENT,enabled:!0,callback:function(){duplicate$$module$build$src$core$clipboard(a)}}},workspaceCommentOption$$module$build$src$core$contextmenu=function(a,b){const c={enabled:!0};c.text=Msg$$module$build$src$core$msg.ADD_COMMENT;c.callback=function(){const d=new WorkspaceCommentSvg$$module$build$src$core$workspace_comment_svg(a,Msg$$module$build$src$core$msg.WORKSPACE_COMMENT_DEFAULT_TEXT,
WorkspaceCommentSvg$$module$build$src$core$workspace_comment_svg.DEFAULT_SIZE,WorkspaceCommentSvg$$module$build$src$core$workspace_comment_svg.DEFAULT_SIZE);var e=a.getInjectionDiv().getBoundingClientRect();e=new Coordinate$$module$build$src$core$utils$coordinate(b.clientX-e.left,b.clientY-e.top);const f=a.getOriginOffsetInPixels();e=Coordinate$$module$build$src$core$utils$coordinate.difference(e,f);e.scale(1/a.scale);d.moveBy(e.x,e.y);a.rendered&&(d.initSvg(),d.render(),d.select())};return c},getStartPositionRect$$module$build$src$core$positionable_helpers=
function(a,b,c,d,e,f){const g=f.scrollbar&&f.scrollbar.canScrollVertically();a.horizontal===horizontalPosition$$module$build$src$core$positionable_helpers.LEFT?(c=e.absoluteMetrics.left+c,g&&f.RTL&&(c+=Scrollbar$$module$build$src$core$scrollbar.scrollbarThickness)):(c=e.absoluteMetrics.left+e.viewMetrics.width-b.width-c,g&&!f.RTL&&(c-=Scrollbar$$module$build$src$core$scrollbar.scrollbarThickness));a.vertical===verticalPosition$$module$build$src$core$positionable_helpers.TOP?a=e.absoluteMetrics.top+
d:(a=e.absoluteMetrics.top+e.viewMetrics.height-b.height-d,f.scrollbar&&f.scrollbar.canScrollHorizontally()&&(a-=Scrollbar$$module$build$src$core$scrollbar.scrollbarThickness));return new Rect$$module$build$src$core$utils$rect(a,a+b.height,c,c+b.width)},getCornerOppositeToolbox$$module$build$src$core$positionable_helpers=function(a,b){return{horizontal:b.toolboxMetrics.position===Position$$module$build$src$core$utils$toolbox.LEFT||a.horizontalLayout&&!a.RTL?horizontalPosition$$module$build$src$core$positionable_helpers.RIGHT:
horizontalPosition$$module$build$src$core$positionable_helpers.LEFT,vertical:b.toolboxMetrics.position===Position$$module$build$src$core$utils$toolbox.BOTTOM?verticalPosition$$module$build$src$core$positionable_helpers.TOP:verticalPosition$$module$build$src$core$positionable_helpers.BOTTOM}},bumpPositionRect$$module$build$src$core$positionable_helpers=function(a,b,c,d){const e=a.left,f=a.right-a.left,g=a.bottom-a.top;for(let h=0;h<d.length;h++){const k=d[h];a.intersects(k)&&(a=c===bumpDirection$$module$build$src$core$positionable_helpers.UP?
k.top-g-b:k.bottom+b,a=new Rect$$module$build$src$core$utils$rect(a,a+g,e,e+f),h=-1)}return a},registerEscape$$module$build$src$core$shortcut_items=function(){ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.register({name:names$$module$build$src$core$shortcut_items.ESCAPE,preconditionFn(a){return!a.options.readOnly},callback(a){a.hideChaff();return!0},keyCodes:[KeyCodes$$module$build$src$core$utils$keycodes.ESC]})},registerDelete$$module$build$src$core$shortcut_items=function(){ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.register({name:names$$module$build$src$core$shortcut_items.DELETE,
preconditionFn(a){const b=getSelected$$module$build$src$core$common();return!a.options.readOnly&&null!=b&&b.isDeletable()},callback(a,b){b.preventDefault();if(Gesture$$module$build$src$core$gesture.inProgress())return!1;getSelected$$module$build$src$core$common().checkAndDelete();return!0},keyCodes:[KeyCodes$$module$build$src$core$utils$keycodes.DELETE,KeyCodes$$module$build$src$core$utils$keycodes.BACKSPACE]})},registerCopy$$module$build$src$core$shortcut_items=function(){const a=ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.createSerializedKey(KeyCodes$$module$build$src$core$utils$keycodes.C,
[KeyCodes$$module$build$src$core$utils$keycodes.CTRL]),b=ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.createSerializedKey(KeyCodes$$module$build$src$core$utils$keycodes.C,[KeyCodes$$module$build$src$core$utils$keycodes.ALT]),c=ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.createSerializedKey(KeyCodes$$module$build$src$core$utils$keycodes.C,[KeyCodes$$module$build$src$core$utils$keycodes.META]);ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.register({name:names$$module$build$src$core$shortcut_items.COPY,
preconditionFn(d){const e=getSelected$$module$build$src$core$common();return!d.options.readOnly&&!Gesture$$module$build$src$core$gesture.inProgress()&&null!=e&&e.isDeletable()&&e.isMovable()},callback(d,e){e.preventDefault();d.hideChaff();copy$$module$build$src$core$clipboard(getSelected$$module$build$src$core$common());return!0},keyCodes:[a,b,c]})},registerCut$$module$build$src$core$shortcut_items=function(){const a=ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.createSerializedKey(KeyCodes$$module$build$src$core$utils$keycodes.X,
[KeyCodes$$module$build$src$core$utils$keycodes.CTRL]),b=ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.createSerializedKey(KeyCodes$$module$build$src$core$utils$keycodes.X,[KeyCodes$$module$build$src$core$utils$keycodes.ALT]),c=ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.createSerializedKey(KeyCodes$$module$build$src$core$utils$keycodes.X,[KeyCodes$$module$build$src$core$utils$keycodes.META]);ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.register({name:names$$module$build$src$core$shortcut_items.CUT,
preconditionFn(d){const e=getSelected$$module$build$src$core$common();return!d.options.readOnly&&!Gesture$$module$build$src$core$gesture.inProgress()&&null!=e&&e instanceof BlockSvg$$module$build$src$core$block_svg&&e.isDeletable()&&e.isMovable()&&!e.workspace.isFlyout},callback(){const d=getSelected$$module$build$src$core$common();if(!d)return!1;copy$$module$build$src$core$clipboard(d);d.checkAndDelete();return!0},keyCodes:[a,b,c]})},registerPaste$$module$build$src$core$shortcut_items=function(){const a=
ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.createSerializedKey(KeyCodes$$module$build$src$core$utils$keycodes.V,[KeyCodes$$module$build$src$core$utils$keycodes.CTRL]),b=ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.createSerializedKey(KeyCodes$$module$build$src$core$utils$keycodes.V,[KeyCodes$$module$build$src$core$utils$keycodes.ALT]),c=ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.createSerializedKey(KeyCodes$$module$build$src$core$utils$keycodes.V,
[KeyCodes$$module$build$src$core$utils$keycodes.META]);ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.register({name:names$$module$build$src$core$shortcut_items.PASTE,preconditionFn(d){return!d.options.readOnly&&!Gesture$$module$build$src$core$gesture.inProgress()},callback(){return!!paste$$module$build$src$core$clipboard()},keyCodes:[a,b,c]})},registerUndo$$module$build$src$core$shortcut_items=function(){const a=ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.createSerializedKey(KeyCodes$$module$build$src$core$utils$keycodes.Z,
[KeyCodes$$module$build$src$core$utils$keycodes.CTRL]),b=ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.createSerializedKey(KeyCodes$$module$build$src$core$utils$keycodes.Z,[KeyCodes$$module$build$src$core$utils$keycodes.ALT]),c=ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.createSerializedKey(KeyCodes$$module$build$src$core$utils$keycodes.Z,[KeyCodes$$module$build$src$core$utils$keycodes.META]);ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.register({name:names$$module$build$src$core$shortcut_items.UNDO,
preconditionFn(d){return!d.options.readOnly&&!Gesture$$module$build$src$core$gesture.inProgress()},callback(d){d.hideChaff();d.undo(!1);return!0},keyCodes:[a,b,c]})},registerRedo$$module$build$src$core$shortcut_items=function(){const a=ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.createSerializedKey(KeyCodes$$module$build$src$core$utils$keycodes.Z,[KeyCodes$$module$build$src$core$utils$keycodes.SHIFT,KeyCodes$$module$build$src$core$utils$keycodes.CTRL]),b=ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.createSerializedKey(KeyCodes$$module$build$src$core$utils$keycodes.Z,
[KeyCodes$$module$build$src$core$utils$keycodes.SHIFT,KeyCodes$$module$build$src$core$utils$keycodes.ALT]),c=ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.createSerializedKey(KeyCodes$$module$build$src$core$utils$keycodes.Z,[KeyCodes$$module$build$src$core$utils$keycodes.SHIFT,KeyCodes$$module$build$src$core$utils$keycodes.META]),d=ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.createSerializedKey(KeyCodes$$module$build$src$core$utils$keycodes.Y,[KeyCodes$$module$build$src$core$utils$keycodes.CTRL]);
ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.register({name:names$$module$build$src$core$shortcut_items.REDO,preconditionFn(e){return!Gesture$$module$build$src$core$gesture.inProgress()&&!e.options.readOnly},callback(e){e.hideChaff();e.undo(!0);return!0},keyCodes:[a,b,c,d]})},registerDefaultShortcuts$$module$build$src$core$shortcut_items=function(){registerEscape$$module$build$src$core$shortcut_items();registerDelete$$module$build$src$core$shortcut_items();registerCopy$$module$build$src$core$shortcut_items();
registerCut$$module$build$src$core$shortcut_items();registerPaste$$module$build$src$core$shortcut_items();registerUndo$$module$build$src$core$shortcut_items();registerRedo$$module$build$src$core$shortcut_items()},allProcedures$$module$build$src$core$procedures=function(a){const b=a.getBlocksByType("procedures_defnoreturn",!1).map(function(c){return c.getProcedureDef()});a=a.getBlocksByType("procedures_defreturn",!1).map(function(c){return c.getProcedureDef()});b.sort(procTupleComparator$$module$build$src$core$procedures);
a.sort(procTupleComparator$$module$build$src$core$procedures);return[b,a]},procTupleComparator$$module$build$src$core$procedures=function(a,b){return a[0].localeCompare(b[0],void 0,{sensitivity:"base"})},findLegalName$$module$build$src$core$procedures=function(a,b){if(b.isInFlyout)return a;for(a=a||Msg$$module$build$src$core$msg.UNNAMED_KEY||"unnamed";!isLegalName$$module$build$src$core$procedures(a,b.workspace,b);){const c=a.match(/^(.*?)(\d+)$/);a=c?c[1]+(parseInt(c[2])+1):a+"2"}return a},isLegalName$$module$build$src$core$procedures=
function(a,b,c){return!isNameUsed$$module$build$src$core$procedures(a,b,c)},isNameUsed$$module$build$src$core$procedures=function(a,b,c){b=b.getAllBlocks(!1);for(let e=0;e<b.length;e++)if(b[e]!==c){var d=b[e];if(d.getProcedureDef&&(d=d.getProcedureDef(),Names$$module$build$src$core$names.equals(d[0],a)))return!0}return!1},rename$$module$build$src$core$procedures=function(a){a=a.trim();const b=findLegalName$$module$build$src$core$procedures(a,this.getSourceBlock()),c=this.getValue();if(c!==a&&c!==
b){a=this.getSourceBlock().workspace.getAllBlocks(!1);for(let d=0;d<a.length;d++){const e=a[d];e.renameProcedure&&e.renameProcedure(c,b)}}return b},flyoutCategory$$module$build$src$core$procedures=function(a){function b(f,g){for(let k=0;k<f.length;k++){var h=f[k][0];const l=f[k][1],m=createElement$$module$build$src$core$utils$xml("block");m.setAttribute("type",g);m.setAttribute("gap","16");const n=createElement$$module$build$src$core$utils$xml("mutation");n.setAttribute("name",h);m.appendChild(n);
for(h=0;h<l.length;h++){const p=createElement$$module$build$src$core$utils$xml("arg");p.setAttribute("name",l[h]);n.appendChild(p)}c.push(m)}}const c=[];if(Blocks$$module$build$src$core$blocks.procedures_defnoreturn){var d=createElement$$module$build$src$core$utils$xml("block");d.setAttribute("type","procedures_defnoreturn");d.setAttribute("gap","16");var e=createElement$$module$build$src$core$utils$xml("field");e.setAttribute("name","NAME");e.appendChild(createTextNode$$module$build$src$core$utils$xml(Msg$$module$build$src$core$msg.PROCEDURES_DEFNORETURN_PROCEDURE));
d.appendChild(e);c.push(d)}Blocks$$module$build$src$core$blocks.procedures_defreturn&&(d=createElement$$module$build$src$core$utils$xml("block"),d.setAttribute("type","procedures_defreturn"),d.setAttribute("gap","16"),e=createElement$$module$build$src$core$utils$xml("field"),e.setAttribute("name","NAME"),e.appendChild(createTextNode$$module$build$src$core$utils$xml(Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_PROCEDURE)),d.appendChild(e),c.push(d));Blocks$$module$build$src$core$blocks.procedures_ifreturn&&
(d=createElement$$module$build$src$core$utils$xml("block"),d.setAttribute("type","procedures_ifreturn"),d.setAttribute("gap","16"),c.push(d));c.length&&c[c.length-1].setAttribute("gap","24");a=allProcedures$$module$build$src$core$procedures(a);b(a[0],"procedures_callnoreturn");b(a[1],"procedures_callreturn");return c},updateMutatorFlyout$$module$build$src$core$procedures=function(a){var b=[],c=a.getBlocksByType("procedures_mutatorarg",!1);for(let f=0,g;g=c[f];f++)b.push(g.getFieldValue("NAME"));c=
createElement$$module$build$src$core$utils$xml("xml");const d=createElement$$module$build$src$core$utils$xml("block");d.setAttribute("type","procedures_mutatorarg");const e=createElement$$module$build$src$core$utils$xml("field");e.setAttribute("name","NAME");b=generateUniqueNameFromOptions$$module$build$src$core$variables(DEFAULT_ARG$$module$build$src$core$procedures,b);b=createTextNode$$module$build$src$core$utils$xml(b);e.appendChild(b);d.appendChild(e);c.appendChild(d);a.updateToolbox(c)},mutatorOpenListener$$module$build$src$core$procedures=
function(a){if(a.type===BUBBLE_OPEN$$module$build$src$core$events$utils&&"mutator"===a.bubbleType&&a.isOpen&&a.blockId){a=getWorkspaceById$$module$build$src$core$common(a.workspaceId).getBlockById(a.blockId);var b=a.type;if("procedures_defnoreturn"===b||"procedures_defreturn"===b)a=a.mutator.getWorkspace(),updateMutatorFlyout$$module$build$src$core$procedures(a),a.addChangeListener(mutatorChangeListener$$module$build$src$core$procedures)}},mutatorChangeListener$$module$build$src$core$procedures=function(a){if(a.type===
CREATE$$module$build$src$core$events$utils||a.type===DELETE$$module$build$src$core$events$utils||a.type===CHANGE$$module$build$src$core$events$utils)a=getWorkspaceById$$module$build$src$core$common(a.workspaceId),updateMutatorFlyout$$module$build$src$core$procedures(a)},getCallers$$module$build$src$core$procedures=function(a,b){const c=[];b=b.getAllBlocks(!1);for(let e=0;e<b.length;e++){var d=b[e];d.getProcedureCall&&(d=d.getProcedureCall())&&Names$$module$build$src$core$names.equals(d,a)&&c.push(b[e])}return c},
mutateCallers$$module$build$src$core$procedures=function(a){const b=getRecordUndo$$module$build$src$core$events$utils();var c=a.getProcedureDef()[0];const d=a.mutationToDom(!0);a=getCallers$$module$build$src$core$procedures(c,a.workspace);for(let f=0,g;g=a[f];f++){c=(c=g.mutationToDom())&&domToText$$module$build$src$core$xml(c);g.domToMutation&&g.domToMutation(d);var e=g.mutationToDom();e=e&&domToText$$module$build$src$core$xml(e);c!==e&&(setRecordUndo$$module$build$src$core$events$utils(!1),fire$$module$build$src$core$events$utils(new (get$$module$build$src$core$events$utils(CHANGE$$module$build$src$core$events$utils))(g,
function(a,b,c){const d=((new Date).getTime()-c.getTime())/200;let e="";1>=d&&(e=`skewX(${Math.round(Math.sin(d*Math.PI*3)*(1-d)*b)})`,disconnectPid$$module$build$src$core$block_animations=setTimeout(disconnectUiStep$$module$build$src$core$block_animations,10,a,b,c));a.skew_=e;a.setAttribute("transform",a.translate_+a.skew_)},disconnectUiStop$$module$build$src$core$block_animations=function(){if(disconnectGroup$$module$build$src$core$block_animations){disconnectPid$$module$build$src$core$block_animations&&
clearTimeout(disconnectPid$$module$build$src$core$block_animations);const a=disconnectGroup$$module$build$src$core$block_animations;a.skew_="";a.setAttribute("transform",a.translate_);disconnectGroup$$module$build$src$core$block_animations=null}},copy$$module$build$src$core$clipboard=function(a){TEST_ONLY$$module$build$src$core$clipboard.copyInternal(a)},copyInternal$$module$build$src$core$clipboard=function(a){copyData$$module$build$src$core$clipboard=a.toCopyData()},paste$$module$build$src$core$clipboard=
function(){if(!copyData$$module$build$src$core$clipboard)return null;let a=copyData$$module$build$src$core$clipboard.source;a.isFlyout&&(a=a.targetWorkspace);return copyData$$module$build$src$core$clipboard.typeCounts&&a.isCapacityAvailable(copyData$$module$build$src$core$clipboard.typeCounts)?a.paste(copyData$$module$build$src$core$clipboard.saveInfo):null},duplicate$$module$build$src$core$clipboard=function(a){return TEST_ONLY$$module$build$src$core$clipboard.duplicateInternal(a)},duplicateInternal$$module$build$src$core$clipboard=
function(a){const b=copyData$$module$build$src$core$clipboard;copy$$module$build$src$core$clipboard(a);let c,d,e;a=null!=(e=null==(c=a.toCopyData())?void 0:null==(d=c.source)?void 0:d.paste(copyData$$module$build$src$core$clipboard.saveInfo))?e:null;copyData$$module$build$src$core$clipboard=b;return a},getCurrentBlock$$module$build$src$core$contextmenu=function(){return currentBlock$$module$build$src$core$contextmenu},setCurrentBlock$$module$build$src$core$contextmenu=function(a){currentBlock$$module$build$src$core$contextmenu=
a},show$$module$build$src$core$contextmenu=function(a,b,c){show$$module$build$src$core$widgetdiv(dummyOwner$$module$build$src$core$contextmenu,c,dispose$$module$build$src$core$contextmenu);if(b.length){var d=populate_$$module$build$src$core$contextmenu(b,c);menu_$$module$build$src$core$contextmenu=d;position_$$module$build$src$core$contextmenu(d,a,c);setTimeout(function(){d.focus()},1);currentBlock$$module$build$src$core$contextmenu=null}else hide$$module$build$src$core$contextmenu()},populate_$$module$build$src$core$contextmenu=
function(a,b){const c=new Menu$$module$build$src$core$menu;c.setRole(Role$$module$build$src$core$utils$aria.MENU);for(let d=0;d<a.length;d++){const e=a[d],f=new MenuItem$$module$build$src$core$menuitem(e.text);f.setRightToLeft(b);f.setRole(Role$$module$build$src$core$utils$aria.MENUITEM);c.addChild(f);f.setEnabled(e.enabled);if(e.enabled)f.onAction(function(){hide$$module$build$src$core$contextmenu();e.callback(e.scope)},{})}return c},position_$$module$build$src$core$contextmenu=function(a,b,c){const d=
getViewportBBox$$module$build$src$core$utils$svg_math();b=new Rect$$module$build$src$core$utils$rect(b.clientY+d.top,b.clientY+d.top,b.clientX+d.left,b.clientX+d.left);createWidget_$$module$build$src$core$contextmenu(a);const e=a.getSize();c&&(b.left+=e.width,b.right+=e.width,d.left+=e.width,d.right+=e.width);positionWithAnchor$$module$build$src$core$widgetdiv(d,b,e,c);a.focus()},createWidget_$$module$build$src$core$contextmenu=function(a){var b=getDiv$$module$build$src$core$widgetdiv();if(!b)throw Error("Attempting to create a context menu when widget div is null");
b=a.render(b);addClass$$module$build$src$core$utils$dom(b,"blocklyContextMenu");conditionalBind$$module$build$src$core$browser_events(b,"contextmenu",null,haltPropagation$$module$build$src$core$contextmenu);a.focus()},haltPropagation$$module$build$src$core$contextmenu=function(a){a.preventDefault();a.stopPropagation()},hide$$module$build$src$core$contextmenu=function(){hideIfOwner$$module$build$src$core$widgetdiv(dummyOwner$$module$build$src$core$contextmenu);currentBlock$$module$build$src$core$contextmenu=
null},dispose$$module$build$src$core$contextmenu=function(){menu_$$module$build$src$core$contextmenu&&(menu_$$module$build$src$core$contextmenu.dispose(),menu_$$module$build$src$core$contextmenu=null)},callbackFactory$$module$build$src$core$contextmenu=function(a,b){return()=>{disable$$module$build$src$core$events$utils();let c;try{c=domToBlock$$module$build$src$core$xml(b,a.workspace);const d=a.getRelativeToSurfaceXY();d.x=a.RTL?d.x-$.config$$module$build$src$core$config.snapRadius:d.x+$.config$$module$build$src$core$config.snapRadius;
d.y+=2*$.config$$module$build$src$core$config.snapRadius;c.moveBy(d.x,d.y)}finally{enable$$module$build$src$core$events$utils()}isEnabled$$module$build$src$core$events$utils()&&!c.isShadow()&&fire$$module$build$src$core$events$utils(new (get$$module$build$src$core$events$utils(CREATE$$module$build$src$core$events$utils))(c));c.select()}},commentDeleteOption$$module$build$src$core$contextmenu=function(a){return{text:Msg$$module$build$src$core$msg.REMOVE_COMMENT,enabled:!0,callback:function(){setGroup$$module$build$src$core$events$utils(!0);
a.dispose();setGroup$$module$build$src$core$events$utils(!1)}}},commentDuplicateOption$$module$build$src$core$contextmenu=function(a){return{text:Msg$$module$build$src$core$msg.DUPLICATE_COMMENT,enabled:!0,callback:function(){duplicate$$module$build$src$core$clipboard(a)}}},workspaceCommentOption$$module$build$src$core$contextmenu=function(a,b){const c={enabled:!0};c.text=Msg$$module$build$src$core$msg.ADD_COMMENT;c.callback=function(){const d=new WorkspaceCommentSvg$$module$build$src$core$workspace_comment_svg(a,
Msg$$module$build$src$core$msg.WORKSPACE_COMMENT_DEFAULT_TEXT,WorkspaceCommentSvg$$module$build$src$core$workspace_comment_svg.DEFAULT_SIZE,WorkspaceCommentSvg$$module$build$src$core$workspace_comment_svg.DEFAULT_SIZE);var e=a.getInjectionDiv().getBoundingClientRect();e=new Coordinate$$module$build$src$core$utils$coordinate(b.clientX-e.left,b.clientY-e.top);const f=a.getOriginOffsetInPixels();e=Coordinate$$module$build$src$core$utils$coordinate.difference(e,f);e.scale(1/a.scale);d.moveBy(e.x,e.y);
a.rendered&&(d.initSvg(),d.render(),d.select())};return c},getStartPositionRect$$module$build$src$core$positionable_helpers=function(a,b,c,d,e,f){const g=f.scrollbar&&f.scrollbar.canScrollVertically();a.horizontal===horizontalPosition$$module$build$src$core$positionable_helpers.LEFT?(c=e.absoluteMetrics.left+c,g&&f.RTL&&(c+=Scrollbar$$module$build$src$core$scrollbar.scrollbarThickness)):(c=e.absoluteMetrics.left+e.viewMetrics.width-b.width-c,g&&!f.RTL&&(c-=Scrollbar$$module$build$src$core$scrollbar.scrollbarThickness));
a.vertical===verticalPosition$$module$build$src$core$positionable_helpers.TOP?a=e.absoluteMetrics.top+d:(a=e.absoluteMetrics.top+e.viewMetrics.height-b.height-d,f.scrollbar&&f.scrollbar.canScrollHorizontally()&&(a-=Scrollbar$$module$build$src$core$scrollbar.scrollbarThickness));return new Rect$$module$build$src$core$utils$rect(a,a+b.height,c,c+b.width)},getCornerOppositeToolbox$$module$build$src$core$positionable_helpers=function(a,b){return{horizontal:b.toolboxMetrics.position===Position$$module$build$src$core$utils$toolbox.LEFT||
a.horizontalLayout&&!a.RTL?horizontalPosition$$module$build$src$core$positionable_helpers.RIGHT:horizontalPosition$$module$build$src$core$positionable_helpers.LEFT,vertical:b.toolboxMetrics.position===Position$$module$build$src$core$utils$toolbox.BOTTOM?verticalPosition$$module$build$src$core$positionable_helpers.TOP:verticalPosition$$module$build$src$core$positionable_helpers.BOTTOM}},bumpPositionRect$$module$build$src$core$positionable_helpers=function(a,b,c,d){const e=a.left,f=a.right-a.left,g=
a.bottom-a.top;for(let h=0;h<d.length;h++){const k=d[h];a.intersects(k)&&(a=c===bumpDirection$$module$build$src$core$positionable_helpers.UP?k.top-g-b:k.bottom+b,a=new Rect$$module$build$src$core$utils$rect(a,a+g,e,e+f),h=-1)}return a},registerEscape$$module$build$src$core$shortcut_items=function(){ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.register({name:names$$module$build$src$core$shortcut_items.ESCAPE,preconditionFn(a){return!a.options.readOnly},callback(a){a.hideChaff();
return!0},keyCodes:[KeyCodes$$module$build$src$core$utils$keycodes.ESC]})},registerDelete$$module$build$src$core$shortcut_items=function(){ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.register({name:names$$module$build$src$core$shortcut_items.DELETE,preconditionFn(a){const b=getSelected$$module$build$src$core$common();return!a.options.readOnly&&null!=b&&b.isDeletable()},callback(a,b){b.preventDefault();if(Gesture$$module$build$src$core$gesture.inProgress())return!1;getSelected$$module$build$src$core$common().checkAndDelete();
return!0},keyCodes:[KeyCodes$$module$build$src$core$utils$keycodes.DELETE,KeyCodes$$module$build$src$core$utils$keycodes.BACKSPACE]})},registerCopy$$module$build$src$core$shortcut_items=function(){const a=ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.createSerializedKey(KeyCodes$$module$build$src$core$utils$keycodes.C,[KeyCodes$$module$build$src$core$utils$keycodes.CTRL]),b=ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.createSerializedKey(KeyCodes$$module$build$src$core$utils$keycodes.C,
[KeyCodes$$module$build$src$core$utils$keycodes.ALT]),c=ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.createSerializedKey(KeyCodes$$module$build$src$core$utils$keycodes.C,[KeyCodes$$module$build$src$core$utils$keycodes.META]);ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.register({name:names$$module$build$src$core$shortcut_items.COPY,preconditionFn(d){const e=getSelected$$module$build$src$core$common();return!d.options.readOnly&&!Gesture$$module$build$src$core$gesture.inProgress()&&
null!=e&&e.isDeletable()&&e.isMovable()},callback(d,e){e.preventDefault();d.hideChaff();copy$$module$build$src$core$clipboard(getSelected$$module$build$src$core$common());return!0},keyCodes:[a,b,c]})},registerCut$$module$build$src$core$shortcut_items=function(){const a=ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.createSerializedKey(KeyCodes$$module$build$src$core$utils$keycodes.X,[KeyCodes$$module$build$src$core$utils$keycodes.CTRL]),b=ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.createSerializedKey(KeyCodes$$module$build$src$core$utils$keycodes.X,
[KeyCodes$$module$build$src$core$utils$keycodes.ALT]),c=ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.createSerializedKey(KeyCodes$$module$build$src$core$utils$keycodes.X,[KeyCodes$$module$build$src$core$utils$keycodes.META]);ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.register({name:names$$module$build$src$core$shortcut_items.CUT,preconditionFn(d){const e=getSelected$$module$build$src$core$common();return!d.options.readOnly&&!Gesture$$module$build$src$core$gesture.inProgress()&&
null!=e&&e instanceof BlockSvg$$module$build$src$core$block_svg&&e.isDeletable()&&e.isMovable()&&!e.workspace.isFlyout},callback(){const d=getSelected$$module$build$src$core$common();if(!d)return!1;copy$$module$build$src$core$clipboard(d);d.checkAndDelete();return!0},keyCodes:[a,b,c]})},registerPaste$$module$build$src$core$shortcut_items=function(){const a=ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.createSerializedKey(KeyCodes$$module$build$src$core$utils$keycodes.V,[KeyCodes$$module$build$src$core$utils$keycodes.CTRL]),
b=ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.createSerializedKey(KeyCodes$$module$build$src$core$utils$keycodes.V,[KeyCodes$$module$build$src$core$utils$keycodes.ALT]),c=ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.createSerializedKey(KeyCodes$$module$build$src$core$utils$keycodes.V,[KeyCodes$$module$build$src$core$utils$keycodes.META]);ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.register({name:names$$module$build$src$core$shortcut_items.PASTE,
preconditionFn(d){return!d.options.readOnly&&!Gesture$$module$build$src$core$gesture.inProgress()},callback(){return!!paste$$module$build$src$core$clipboard()},keyCodes:[a,b,c]})},registerUndo$$module$build$src$core$shortcut_items=function(){const a=ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.createSerializedKey(KeyCodes$$module$build$src$core$utils$keycodes.Z,[KeyCodes$$module$build$src$core$utils$keycodes.CTRL]),b=ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.createSerializedKey(KeyCodes$$module$build$src$core$utils$keycodes.Z,
[KeyCodes$$module$build$src$core$utils$keycodes.ALT]),c=ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.createSerializedKey(KeyCodes$$module$build$src$core$utils$keycodes.Z,[KeyCodes$$module$build$src$core$utils$keycodes.META]);ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.register({name:names$$module$build$src$core$shortcut_items.UNDO,preconditionFn(d){return!d.options.readOnly&&!Gesture$$module$build$src$core$gesture.inProgress()},callback(d){d.hideChaff();
d.undo(!1);return!0},keyCodes:[a,b,c]})},registerRedo$$module$build$src$core$shortcut_items=function(){const a=ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.createSerializedKey(KeyCodes$$module$build$src$core$utils$keycodes.Z,[KeyCodes$$module$build$src$core$utils$keycodes.SHIFT,KeyCodes$$module$build$src$core$utils$keycodes.CTRL]),b=ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.createSerializedKey(KeyCodes$$module$build$src$core$utils$keycodes.Z,[KeyCodes$$module$build$src$core$utils$keycodes.SHIFT,
KeyCodes$$module$build$src$core$utils$keycodes.ALT]),c=ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.createSerializedKey(KeyCodes$$module$build$src$core$utils$keycodes.Z,[KeyCodes$$module$build$src$core$utils$keycodes.SHIFT,KeyCodes$$module$build$src$core$utils$keycodes.META]),d=ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.createSerializedKey(KeyCodes$$module$build$src$core$utils$keycodes.Y,[KeyCodes$$module$build$src$core$utils$keycodes.CTRL]);ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.register({name:names$$module$build$src$core$shortcut_items.REDO,
preconditionFn(e){return!Gesture$$module$build$src$core$gesture.inProgress()&&!e.options.readOnly},callback(e){e.hideChaff();e.undo(!0);return!0},keyCodes:[a,b,c,d]})},registerDefaultShortcuts$$module$build$src$core$shortcut_items=function(){registerEscape$$module$build$src$core$shortcut_items();registerDelete$$module$build$src$core$shortcut_items();registerCopy$$module$build$src$core$shortcut_items();registerCut$$module$build$src$core$shortcut_items();registerPaste$$module$build$src$core$shortcut_items();
registerUndo$$module$build$src$core$shortcut_items();registerRedo$$module$build$src$core$shortcut_items()},allProcedures$$module$build$src$core$procedures=function(a){const b=a.getBlocksByType("procedures_defnoreturn",!1).map(function(c){return c.getProcedureDef()});a=a.getBlocksByType("procedures_defreturn",!1).map(function(c){return c.getProcedureDef()});b.sort(procTupleComparator$$module$build$src$core$procedures);a.sort(procTupleComparator$$module$build$src$core$procedures);return[b,a]},procTupleComparator$$module$build$src$core$procedures=
function(a,b){return a[0].localeCompare(b[0],void 0,{sensitivity:"base"})},findLegalName$$module$build$src$core$procedures=function(a,b){if(b.isInFlyout)return a;for(a=a||Msg$$module$build$src$core$msg.UNNAMED_KEY||"unnamed";!isLegalName$$module$build$src$core$procedures(a,b.workspace,b);){const c=a.match(/^(.*?)(\d+)$/);a=c?c[1]+(parseInt(c[2])+1):a+"2"}return a},isLegalName$$module$build$src$core$procedures=function(a,b,c){return!isNameUsed$$module$build$src$core$procedures(a,b,c)},isNameUsed$$module$build$src$core$procedures=
function(a,b,c){b=b.getAllBlocks(!1);for(let e=0;e<b.length;e++)if(b[e]!==c){var d=b[e];if(d.getProcedureDef&&(d=d.getProcedureDef(),Names$$module$build$src$core$names.equals(d[0],a)))return!0}return!1},rename$$module$build$src$core$procedures=function(a){var b=this.getSourceBlock();if(!b)throw new UnattachedFieldError$$module$build$src$core$field;a=a.trim();const c=findLegalName$$module$build$src$core$procedures(a,b),d=this.getValue();if(d!==a&&d!==c)for(a=b.workspace.getAllBlocks(!1),b=0;b<a.length;b++){const e=
a[b];e.renameProcedure&&e.renameProcedure(d,c)}return c},flyoutCategory$$module$build$src$core$procedures=function(a){function b(f,g){for(let k=0;k<f.length;k++){var h=f[k][0];const l=f[k][1],m=createElement$$module$build$src$core$utils$xml("block");m.setAttribute("type",g);m.setAttribute("gap","16");const n=createElement$$module$build$src$core$utils$xml("mutation");n.setAttribute("name",h);m.appendChild(n);for(h=0;h<l.length;h++){const p=createElement$$module$build$src$core$utils$xml("arg");p.setAttribute("name",
l[h]);n.appendChild(p)}c.push(m)}}const c=[];if(Blocks$$module$build$src$core$blocks.procedures_defnoreturn){var d=createElement$$module$build$src$core$utils$xml("block");d.setAttribute("type","procedures_defnoreturn");d.setAttribute("gap","16");var e=createElement$$module$build$src$core$utils$xml("field");e.setAttribute("name","NAME");e.appendChild(createTextNode$$module$build$src$core$utils$xml(Msg$$module$build$src$core$msg.PROCEDURES_DEFNORETURN_PROCEDURE));d.appendChild(e);c.push(d)}Blocks$$module$build$src$core$blocks.procedures_defreturn&&
(d=createElement$$module$build$src$core$utils$xml("block"),d.setAttribute("type","procedures_defreturn"),d.setAttribute("gap","16"),e=createElement$$module$build$src$core$utils$xml("field"),e.setAttribute("name","NAME"),e.appendChild(createTextNode$$module$build$src$core$utils$xml(Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_PROCEDURE)),d.appendChild(e),c.push(d));Blocks$$module$build$src$core$blocks.procedures_ifreturn&&(d=createElement$$module$build$src$core$utils$xml("block"),d.setAttribute("type",
"procedures_ifreturn"),d.setAttribute("gap","16"),c.push(d));c.length&&c[c.length-1].setAttribute("gap","24");a=allProcedures$$module$build$src$core$procedures(a);b(a[0],"procedures_callnoreturn");b(a[1],"procedures_callreturn");return c},updateMutatorFlyout$$module$build$src$core$procedures=function(a){var b=[],c=a.getBlocksByType("procedures_mutatorarg",!1);for(let f=0,g;g=c[f];f++)b.push(g.getFieldValue("NAME"));c=createElement$$module$build$src$core$utils$xml("xml");const d=createElement$$module$build$src$core$utils$xml("block");
d.setAttribute("type","procedures_mutatorarg");const e=createElement$$module$build$src$core$utils$xml("field");e.setAttribute("name","NAME");b=generateUniqueNameFromOptions$$module$build$src$core$variables(DEFAULT_ARG$$module$build$src$core$procedures,b);b=createTextNode$$module$build$src$core$utils$xml(b);e.appendChild(b);d.appendChild(e);c.appendChild(d);a.updateToolbox(c)},mutatorOpenListener$$module$build$src$core$procedures=function(a){if(a.type===BUBBLE_OPEN$$module$build$src$core$events$utils&&
"mutator"===a.bubbleType&&a.isOpen&&a.blockId){a=getWorkspaceById$$module$build$src$core$common(a.workspaceId).getBlockById(a.blockId);var b=a.type;if("procedures_defnoreturn"===b||"procedures_defreturn"===b)a=a.mutator.getWorkspace(),updateMutatorFlyout$$module$build$src$core$procedures(a),a.addChangeListener(mutatorChangeListener$$module$build$src$core$procedures)}},mutatorChangeListener$$module$build$src$core$procedures=function(a){if(a.type===CREATE$$module$build$src$core$events$utils||a.type===
DELETE$$module$build$src$core$events$utils||a.type===CHANGE$$module$build$src$core$events$utils)a=getWorkspaceById$$module$build$src$core$common(a.workspaceId),updateMutatorFlyout$$module$build$src$core$procedures(a)},getCallers$$module$build$src$core$procedures=function(a,b){const c=[];b=b.getAllBlocks(!1);for(let e=0;e<b.length;e++){var d=b[e];d.getProcedureCall&&(d=d.getProcedureCall())&&Names$$module$build$src$core$names.equals(d,a)&&c.push(b[e])}return c},mutateCallers$$module$build$src$core$procedures=
function(a){const b=getRecordUndo$$module$build$src$core$events$utils();var c=a.getProcedureDef()[0];const d=a.mutationToDom(!0);a=getCallers$$module$build$src$core$procedures(c,a.workspace);for(let f=0,g;g=a[f];f++){c=(c=g.mutationToDom())&&domToText$$module$build$src$core$xml(c);g.domToMutation&&g.domToMutation(d);var e=g.mutationToDom();e=e&&domToText$$module$build$src$core$xml(e);c!==e&&(setRecordUndo$$module$build$src$core$events$utils(!1),fire$$module$build$src$core$events$utils(new (get$$module$build$src$core$events$utils(CHANGE$$module$build$src$core$events$utils))(g,
"mutation",null,c,e)),setRecordUndo$$module$build$src$core$events$utils(b))}},getDefinition$$module$build$src$core$procedures=function(a,b){b=b.getAllBlocks(!1);for(let d=0;d<b.length;d++){var c=b[d];if(c.getProcedureDef&&(c=c.getProcedureDef())&&Names$$module$build$src$core$names.equals(c[0],a))return b[d]}return null},isDynamicShape$$module$build$src$core$renderers$common$constants=function(a){return a.isDynamic},isDebuggerEnabled$$module$build$src$core$renderers$common$debug=function(){return useDebugger$$module$build$src$core$renderers$common$debug},
startDebugger$$module$build$src$core$renderers$common$debug=function(){warn$$module$build$src$core$utils$deprecation("Blockly.blockRendering.debug.startDebugger()","version 8","version 10","the debug renderer in @blockly/dev-tools (See https://www.npmjs.com/package/@blockly/dev-tools.)");useDebugger$$module$build$src$core$renderers$common$debug=!0},stopDebugger$$module$build$src$core$renderers$common$debug=function(){warn$$module$build$src$core$utils$deprecation("Blockly.blockRendering.debug.stopDebugger()",
"version 8","version 10","the debug renderer in @blockly/dev-tools (See https://www.npmjs.com/package/@blockly/dev-tools.)");useDebugger$$module$build$src$core$renderers$common$debug=!1},register$$module$build$src$core$renderers$common$block_rendering=function(a,b){register$$module$build$src$core$registry(Type$$module$build$src$core$registry.RENDERER,a,b)},unregister$$module$build$src$core$renderers$common$block_rendering=function(a){unregister$$module$build$src$core$registry(Type$$module$build$src$core$registry.RENDERER,
@@ -428,26 +429,26 @@ module$build$src$core$utils$colour.getHsvSaturation=getHsvSaturation$$module$bui
module$build$src$core$utils$colour.names=names$$module$build$src$core$utils$colour;module$build$src$core$utils$colour.parse=parse$$module$build$src$core$utils$colour;module$build$src$core$utils$colour.rgbToHex=rgbToHex$$module$build$src$core$utils$colour;module$build$src$core$utils$colour.setHsvSaturation=setHsvSaturation$$module$build$src$core$utils$colour;module$build$src$core$utils$colour.setHsvValue=setHsvValue$$module$build$src$core$utils$colour;var module$build$src$core$utils$parsing={};module$build$src$core$utils$parsing.checkMessageReferences=checkMessageReferences$$module$build$src$core$utils$parsing;module$build$src$core$utils$parsing.parseBlockColour=parseBlockColour$$module$build$src$core$utils$parsing;module$build$src$core$utils$parsing.replaceMessageReferences=replaceMessageReferences$$module$build$src$core$utils$parsing;module$build$src$core$utils$parsing.tokenizeInterpolation=tokenizeInterpolation$$module$build$src$core$utils$parsing;var Sentinel$$module$build$src$core$utils$sentinel=class{},module$build$src$core$utils$sentinel={};module$build$src$core$utils$sentinel.Sentinel=Sentinel$$module$build$src$core$utils$sentinel;var owner$$module$build$src$core$widgetdiv=null,dispose$$module$build$src$core$widgetdiv=null,rendererClassName$$module$build$src$core$widgetdiv="",themeClassName$$module$build$src$core$widgetdiv="",containerDiv$$module$build$src$core$widgetdiv,module$build$src$core$widgetdiv={};module$build$src$core$widgetdiv.createDom=createDom$$module$build$src$core$widgetdiv;module$build$src$core$widgetdiv.getDiv=getDiv$$module$build$src$core$widgetdiv;module$build$src$core$widgetdiv.hide=hide$$module$build$src$core$widgetdiv;
module$build$src$core$widgetdiv.hideIfOwner=hideIfOwner$$module$build$src$core$widgetdiv;module$build$src$core$widgetdiv.isVisible=isVisible$$module$build$src$core$widgetdiv;module$build$src$core$widgetdiv.positionWithAnchor=positionWithAnchor$$module$build$src$core$widgetdiv;module$build$src$core$widgetdiv.show=show$$module$build$src$core$widgetdiv;module$build$src$core$widgetdiv.testOnly_setDiv=testOnly_setDiv$$module$build$src$core$widgetdiv;var Field$$module$build$src$core$field=class{constructor(a,b,c){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:null;this.size_=new Size$$module$build$src$core$utils$size(0,0);a!==Field$$module$build$src$core$field.SKIP_SETUP&&(c&&this.configure_(c),this.setValue(a),b&&this.setValidator(b))}configure_(a){a.tooltip&&this.setTooltip(replaceMessageReferences$$module$build$src$core$utils$parsing(a.tooltip))}setSourceBlock(a){if(this.sourceBlock_)throw Error("Field already bound to a block");this.sourceBlock_=a}getConstants(){!this.constants_&&this.sourceBlock_&&
!this.sourceBlock_.isDeadOrDying()&&this.sourceBlock_.workspace.rendered&&(this.constants_=this.sourceBlock_.workspace.getRenderer().getConstants());return this.constants_}getSourceBlock(){if(!this.sourceBlock_)throw Error(`The source block is ${this.sourceBlock_}.`);return this.sourceBlock_}init(){this.fieldGroup_||(this.fieldGroup_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.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_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.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_=
!this.sourceBlock_.isDeadOrDying()&&this.sourceBlock_.workspace.rendered&&(this.constants_=this.sourceBlock_.workspace.getRenderer().getConstants());return this.constants_}getSourceBlock(){return this.sourceBlock_}init(){this.fieldGroup_||(this.fieldGroup_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.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_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.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_=
createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.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 a=this.getClickTarget_();if(!a)throw Error("A click target has not been set.");bindMouseEvents$$module$build$src$core$tooltip(a);this.mouseDownWrapper_=
conditionalBind$$module$build$src$core$browser_events(a,"mousedown",this,this.onMouseDown_)}fromXml(a){this.setValue(a.textContent)}toXml(a){a.textContent=this.getValue();return a}saveState(a){a=this.saveLegacyState(Field$$module$build$src$core$field);return null!==a?a:this.getValue()}loadState(a){this.loadLegacyState(Field$$module$build$src$core$field,a)||this.setValue(a)}saveLegacyState(a){return a.prototype.saveState===this.saveState&&a.prototype.toXml!==this.toXml?(a=createElement$$module$build$src$core$utils$xml("field"),
a.setAttribute("name",this.name||""),domToText$$module$build$src$core$xml(this.toXml(a)).replace(' xmlns="https://developers.google.com/blockly/xml"',"")):null}loadLegacyState(a,b){return a.prototype.loadState===this.loadState&&a.prototype.fromXml!==this.fromXml?(this.fromXml(textToDom$$module$build$src$core$xml(b)),!0):!1}dispose(){hideIfOwner$$module$build$src$core$dropdowndiv(this);hideIfOwner$$module$build$src$core$widgetdiv(this);unbindMouseEvents$$module$build$src$core$tooltip(this.getClickTarget_());
this.mouseDownWrapper_&&unbind$$module$build$src$core$browser_events(this.mouseDownWrapper_);removeNode$$module$build$src$core$utils$dom(this.fieldGroup_);this.disposed=!0}updateEditable(){const a=this.fieldGroup_;this.EDITABLE&&a&&(this.enabled_&&this.getSourceBlock().isEditable()?(addClass$$module$build$src$core$utils$dom(a,"blocklyEditableText"),removeClass$$module$build$src$core$utils$dom(a,"blocklyNonEditableText"),a.style.cursor=this.CURSOR):(addClass$$module$build$src$core$utils$dom(a,"blocklyNonEditableText"),
removeClass$$module$build$src$core$utils$dom(a,"blocklyEditableText"),a.style.cursor=""))}setEnabled(a){this.enabled_=a;this.updateEditable()}isEnabled(){return this.enabled_}isClickable(){return this.enabled_&&!!this.sourceBlock_&&this.sourceBlock_.isEditable()&&this.showEditor_!==Field$$module$build$src$core$field.prototype.showEditor_}isCurrentlyEditable(){return this.enabled_&&this.EDITABLE&&!!this.sourceBlock_&&this.sourceBlock_.isEditable()}isSerializable(){let a=!1;this.name&&(this.SERIALIZABLE?
a=!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."),a=!0));return a}isVisible(){return this.visible_}setVisible(a){if(this.visible_!==a){this.visible_=a;var b=this.fieldGroup_;b&&(b.style.display=a?"block":"none")}}setValidator(a){this.validator_=a}getValidator(){return this.validator_}getSvgRoot(){return this.fieldGroup_}getBorderRect(){if(!this.borderRect_)throw Error(`The border rectangle is ${this.borderRect_}.`);
this.mouseDownWrapper_&&unbind$$module$build$src$core$browser_events(this.mouseDownWrapper_);removeNode$$module$build$src$core$utils$dom(this.fieldGroup_);this.disposed=!0}updateEditable(){const a=this.fieldGroup_,b=this.getSourceBlock();this.EDITABLE&&a&&b&&(this.enabled_&&b.isEditable()?(addClass$$module$build$src$core$utils$dom(a,"blocklyEditableText"),removeClass$$module$build$src$core$utils$dom(a,"blocklyNonEditableText"),a.style.cursor=this.CURSOR):(addClass$$module$build$src$core$utils$dom(a,
"blocklyNonEditableText"),removeClass$$module$build$src$core$utils$dom(a,"blocklyEditableText"),a.style.cursor=""))}setEnabled(a){this.enabled_=a;this.updateEditable()}isEnabled(){return this.enabled_}isClickable(){return this.enabled_&&!!this.sourceBlock_&&this.sourceBlock_.isEditable()&&this.showEditor_!==Field$$module$build$src$core$field.prototype.showEditor_}isCurrentlyEditable(){return this.enabled_&&this.EDITABLE&&!!this.sourceBlock_&&this.sourceBlock_.isEditable()}isSerializable(){let a=!1;
this.name&&(this.SERIALIZABLE?a=!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."),a=!0));return a}isVisible(){return this.visible_}setVisible(a){if(this.visible_!==a){this.visible_=a;var b=this.fieldGroup_;b&&(b.style.display=a?"block":"none")}}setValidator(a){this.validator_=a}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(a){this.isClickable()&&this.showEditor_(a)}showEditor_(a){}updateSize_(a){const b=this.getConstants();a=void 0!==
a?a:this.borderRect_?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0;let c=2*a,d=b.FIELD_TEXT_HEIGHT,e=0;this.textElement_&&(e=getFastTextWidth$$module$build$src$core$utils$dom(this.textElement_,b.FIELD_TEXT_FONTSIZE,b.FIELD_TEXT_FONTWEIGHT,b.FIELD_TEXT_FONTFAMILY),c+=e);this.borderRect_&&(d=Math.max(d,b.FIELD_BORDER_RECT_HEIGHT));this.size_.height=d;this.size_.width=c;this.positionTextElement_(a,e);this.positionBorderRect_()}positionTextElement_(a,b){if(this.textElement_){var c=this.getConstants(),
d=this.size_.height/2;this.textElement_.setAttribute("x",`${this.getSourceBlock().RTL?this.size_.width-b-a:a}`);this.textElement_.setAttribute("y",`${c.FIELD_TEXT_BASELINE_CENTER?d:d-c.FIELD_TEXT_HEIGHT/2+c.FIELD_TEXT_BASELINE}`)}}positionBorderRect_(){this.borderRect_&&(this.borderRect_.setAttribute("width",`${this.size_.width}`),this.borderRect_.setAttribute("height",`${this.size_.height}`),this.borderRect_.setAttribute("rx",`${this.getConstants().FIELD_BORDER_RECT_RADIUS}`),this.borderRect_.setAttribute("ry",
`${this.getConstants().FIELD_BORDER_RECT_RADIUS}`))}getSize(){if(!this.isVisible())return new Size$$module$build$src$core$utils$size(0,0);this.isDirty_?(this.render_(),this.isDirty_=!1):this.visible_&&0===this.size_.width&&(console.warn("Deprecated use of setting size_.width to 0 to rerender a field. Set field.isDirty_ to true instead."),this.render_());return this.size_}getScaledBBox(){let a;let b;if(this.borderRect_){var c=this.borderRect_.getBoundingClientRect();b=getPageOffset$$module$build$src$core$utils$style(this.borderRect_);
a=c.width;var d=c.height}else d=this.sourceBlock_.getHeightWidth(),c=this.getSourceBlock().workspace.scale,b=this.getAbsoluteXY_(),a=(d.width+1)*c,d=(d.height+1)*c,GECKO$$module$build$src$core$utils$useragent?(b.x+=1.5*c,b.y+=1.5*c):(b.x-=.5*c,b.y-=.5*c);return new Rect$$module$build$src$core$utils$rect(b.y,b.y+d,b.x,b.x+a)}getDisplayText_(){let a=this.getText();if(!a)return Field$$module$build$src$core$field.NBSP;a.length>this.maxDisplayLength&&(a=a.substring(0,this.maxDisplayLength-2)+"\u2026");
a=a.replace(/\s/g,Field$$module$build$src$core$field.NBSP);this.sourceBlock_&&this.sourceBlock_.RTL&&(a+="\u200f");return a}getText(){const a=this.getText_();return null!==a?String(a):String(this.getValue())}getText_(){return null}markDirty(){this.isDirty_=!0;this.constants_=null}forceRerender(){this.isDirty_=!0;this.sourceBlock_&&this.sourceBlock_.rendered&&(this.sourceBlock_.render(),this.sourceBlock_.bumpNeighbours(),this.updateMarkers_())}setValue(a){if(null!==a){var b=this.doClassValidation_(a);
a=this.processValidation_(a,b);if(!(a instanceof Error)){if(b=this.getValidator())if(b=b.call(this,a),a=this.processValidation_(a,b),a instanceof Error)return;b=this.sourceBlock_;if(!b||!b.disposed){var c=this.getValue();c===a?this.doValueUpdate_(a):(this.doValueUpdate_(a),b&&isEnabled$$module$build$src$core$events$utils()&&fire$$module$build$src$core$events$utils(new (get$$module$build$src$core$events$utils(CHANGE$$module$build$src$core$events$utils))(b,"field",this.name||null,c,a)),this.isDirty_&&
this.forceRerender())}}}}processValidation_(a,b){if(null===b)return this.doValueInvalid_(a),this.isDirty_&&this.forceRerender(),Error();void 0!==b&&(a=b);return a}getValue(){return this.value_}doClassValidation_(a){return null===a||void 0===a?null:a}doValueUpdate_(a){this.value_=a;this.isDirty_=!0}doValueInvalid_(a){}onMouseDown_(a){this.sourceBlock_&&!this.sourceBlock_.isDeadOrDying()&&(a=this.sourceBlock_.workspace.getGesture(a))&&a.setStartField(this)}setTooltip(a){a||""===a||(a=this.sourceBlock_);
const b=this.getClickTarget_();b?b.tooltip=a:this.tooltip_=a}getTooltip(){const a=this.getClickTarget_();return a?getTooltipOfObject$$module$build$src$core$tooltip(a):getTooltipOfObject$$module$build$src$core$tooltip({tooltip:this.tooltip_})}getClickTarget_(){return this.clickTarget_||this.getSvgRoot()}getAbsoluteXY_(){return getPageOffset$$module$build$src$core$utils$style(this.getClickTarget_())}referencesVariables(){return!1}refreshVariableName(){}getParentInput(){let a=null;const b=this.getSourceBlock(),
c=b.inputList;for(let d=0;d<b.inputList.length;d++){const e=c[d],f=e.fieldRow;for(let g=0;g<f.length;g++)if(f[g]===this){a=e;break}}return a}getFlipRtl(){return!1}isTabNavigable(){return!1}onShortcut(a){return!1}setCursorSvg(a){if(a){if(!this.fieldGroup_)throw Error(`The field group is ${this.fieldGroup_}.`);this.fieldGroup_.appendChild(a);this.cursorSvg_=a}else this.cursorSvg_=null}setMarkerSvg(a){if(a){if(!this.fieldGroup_)throw Error(`The field group is ${this.fieldGroup_}.`);this.fieldGroup_.appendChild(a);
this.markerSvg_=a}else this.markerSvg_=null}updateMarkers_(){const a=this.getSourceBlock().workspace;a.keyboardAccessibilityMode&&this.cursorSvg_&&a.getCursor().draw();a.keyboardAccessibilityMode&&this.markerSvg_&&a.getMarker(MarkerManager$$module$build$src$core$marker_manager.LOCAL_MARKER).draw()}};Field$$module$build$src$core$field.NBSP="\u00a0";Field$$module$build$src$core$field.SKIP_SETUP=new Sentinel$$module$build$src$core$utils$sentinel;var module$build$src$core$field={};
module$build$src$core$field.Field=Field$$module$build$src$core$field;var TEST_ONLY$$module$build$src$core$field_registry={fromJsonInternal:fromJsonInternal$$module$build$src$core$field_registry},module$build$src$core$field_registry={};module$build$src$core$field_registry.TEST_ONLY=TEST_ONLY$$module$build$src$core$field_registry;module$build$src$core$field_registry.fromJson=fromJson$$module$build$src$core$field_registry;module$build$src$core$field_registry.register=register$$module$build$src$core$field_registry;module$build$src$core$field_registry.unregister=unregister$$module$build$src$core$field_registry;var ARIA_PREFIX$$module$build$src$core$utils$aria="aria-",ROLE_ATTRIBUTE$$module$build$src$core$utils$aria="role",Role$$module$build$src$core$utils$aria;(function(a){a.GRID="grid";a.GRIDCELL="gridcell";a.GROUP="group";a.LISTBOX="listbox";a.MENU="menu";a.MENUITEM="menuitem";a.MENUITEMCHECKBOX="menuitemcheckbox";a.OPTION="option";a.PRESENTATION="presentation";a.ROW="row";a.TREE="tree";a.TREEITEM="treeitem"})(Role$$module$build$src$core$utils$aria||(Role$$module$build$src$core$utils$aria={}));var State$$module$build$src$core$utils$aria;
d=this.size_.height/2,e;this.textElement_.setAttribute("x",`${(null==(e=this.getSourceBlock())?0:e.RTL)?this.size_.width-b-a:a}`);this.textElement_.setAttribute("y",`${c.FIELD_TEXT_BASELINE_CENTER?d:d-c.FIELD_TEXT_HEIGHT/2+c.FIELD_TEXT_BASELINE}`)}}positionBorderRect_(){this.borderRect_&&(this.borderRect_.setAttribute("width",`${this.size_.width}`),this.borderRect_.setAttribute("height",`${this.size_.height}`),this.borderRect_.setAttribute("rx",`${this.getConstants().FIELD_BORDER_RECT_RADIUS}`),this.borderRect_.setAttribute("ry",
`${this.getConstants().FIELD_BORDER_RECT_RADIUS}`))}getSize(){if(!this.isVisible())return new Size$$module$build$src$core$utils$size(0,0);this.isDirty_?(this.render_(),this.isDirty_=!1):this.visible_&&0===this.size_.width&&(console.warn("Deprecated use of setting size_.width to 0 to rerender a field. Set field.isDirty_ to true instead."),this.render_());return this.size_}getScaledBBox(){let a;var b=this.getSourceBlock();if(!b)throw new UnattachedFieldError$$module$build$src$core$field;if(this.borderRect_){var c=
this.borderRect_.getBoundingClientRect();a=getPageOffset$$module$build$src$core$utils$style(this.borderRect_);b=c.width;c=c.height}else{c=this.sourceBlock_.getHeightWidth();const d=b.workspace.scale;a=this.getAbsoluteXY_();b=(c.width+1)*d;c=(c.height+1)*d;GECKO$$module$build$src$core$utils$useragent?(a.x+=1.5*d,a.y+=1.5*d):(a.x-=.5*d,a.y-=.5*d)}return new Rect$$module$build$src$core$utils$rect(a.y,a.y+c,a.x,a.x+b)}getDisplayText_(){let a=this.getText();if(!a)return Field$$module$build$src$core$field.NBSP;
a.length>this.maxDisplayLength&&(a=a.substring(0,this.maxDisplayLength-2)+"\u2026");a=a.replace(/\s/g,Field$$module$build$src$core$field.NBSP);this.sourceBlock_&&this.sourceBlock_.RTL&&(a+="\u200f");return a}getText(){const a=this.getText_();return null!==a?String(a):String(this.getValue())}getText_(){return null}markDirty(){this.isDirty_=!0;this.constants_=null}forceRerender(){this.isDirty_=!0;this.sourceBlock_&&this.sourceBlock_.rendered&&(this.sourceBlock_.render(),this.sourceBlock_.bumpNeighbours(),
this.updateMarkers_())}setValue(a){if(null!==a){var b=this.doClassValidation_(a);a=this.processValidation_(a,b);if(!(a instanceof Error)){if(b=this.getValidator())if(b=b.call(this,a),a=this.processValidation_(a,b),a instanceof Error)return;b=this.sourceBlock_;if(!b||!b.disposed){var c=this.getValue();c===a?this.doValueUpdate_(a):(this.doValueUpdate_(a),b&&isEnabled$$module$build$src$core$events$utils()&&fire$$module$build$src$core$events$utils(new (get$$module$build$src$core$events$utils(CHANGE$$module$build$src$core$events$utils))(b,
"field",this.name||null,c,a)),this.isDirty_&&this.forceRerender())}}}}processValidation_(a,b){if(null===b)return this.doValueInvalid_(a),this.isDirty_&&this.forceRerender(),Error();void 0!==b&&(a=b);return a}getValue(){return this.value_}doClassValidation_(a){return null===a||void 0===a?null:a}doValueUpdate_(a){this.value_=a;this.isDirty_=!0}doValueInvalid_(a){}onMouseDown_(a){this.sourceBlock_&&!this.sourceBlock_.isDeadOrDying()&&(a=this.sourceBlock_.workspace.getGesture(a))&&a.setStartField(this)}setTooltip(a){a||
""===a||(a=this.sourceBlock_);const b=this.getClickTarget_();b?b.tooltip=a:this.tooltip_=a}getTooltip(){const a=this.getClickTarget_();return a?getTooltipOfObject$$module$build$src$core$tooltip(a):getTooltipOfObject$$module$build$src$core$tooltip({tooltip:this.tooltip_})}getClickTarget_(){return this.clickTarget_||this.getSvgRoot()}getAbsoluteXY_(){return getPageOffset$$module$build$src$core$utils$style(this.getClickTarget_())}referencesVariables(){return!1}refreshVariableName(){}getParentInput(){let a=
null;const b=this.getSourceBlock();if(!b)throw new UnattachedFieldError$$module$build$src$core$field;const c=b.inputList;for(let d=0;d<b.inputList.length;d++){const e=c[d],f=e.fieldRow;for(let g=0;g<f.length;g++)if(f[g]===this){a=e;break}}return a}getFlipRtl(){return!1}isTabNavigable(){return!1}onShortcut(a){return!1}setCursorSvg(a){if(a){if(!this.fieldGroup_)throw Error(`The field group is ${this.fieldGroup_}.`);this.fieldGroup_.appendChild(a);this.cursorSvg_=a}else this.cursorSvg_=null}setMarkerSvg(a){if(a){if(!this.fieldGroup_)throw Error(`The field group is ${this.fieldGroup_}.`);
this.fieldGroup_.appendChild(a);this.markerSvg_=a}else this.markerSvg_=null}updateMarkers_(){var a=this.getSourceBlock();if(!a)throw new UnattachedFieldError$$module$build$src$core$field;a=a.workspace;a.keyboardAccessibilityMode&&this.cursorSvg_&&a.getCursor().draw();a.keyboardAccessibilityMode&&this.markerSvg_&&a.getMarker(MarkerManager$$module$build$src$core$marker_manager.LOCAL_MARKER).draw()}};Field$$module$build$src$core$field.NBSP="\u00a0";Field$$module$build$src$core$field.SKIP_SETUP=new Sentinel$$module$build$src$core$utils$sentinel;
var UnattachedFieldError$$module$build$src$core$field=class extends Error{constructor(){super("The field has not yet been attached to its input. Call appendField to attach it.")}},module$build$src$core$field={};module$build$src$core$field.Field=Field$$module$build$src$core$field;module$build$src$core$field.UnattachedFieldError=UnattachedFieldError$$module$build$src$core$field;var TEST_ONLY$$module$build$src$core$field_registry={fromJsonInternal:fromJsonInternal$$module$build$src$core$field_registry},module$build$src$core$field_registry={};module$build$src$core$field_registry.TEST_ONLY=TEST_ONLY$$module$build$src$core$field_registry;module$build$src$core$field_registry.fromJson=fromJson$$module$build$src$core$field_registry;module$build$src$core$field_registry.register=register$$module$build$src$core$field_registry;module$build$src$core$field_registry.unregister=unregister$$module$build$src$core$field_registry;var ARIA_PREFIX$$module$build$src$core$utils$aria="aria-",ROLE_ATTRIBUTE$$module$build$src$core$utils$aria="role",Role$$module$build$src$core$utils$aria;(function(a){a.GRID="grid";a.GRIDCELL="gridcell";a.GROUP="group";a.LISTBOX="listbox";a.MENU="menu";a.MENUITEM="menuitem";a.MENUITEMCHECKBOX="menuitemcheckbox";a.OPTION="option";a.PRESENTATION="presentation";a.ROW="row";a.TREE="tree";a.TREEITEM="treeitem"})(Role$$module$build$src$core$utils$aria||(Role$$module$build$src$core$utils$aria={}));var State$$module$build$src$core$utils$aria;
(function(a){a.ACTIVEDESCENDANT="activedescendant";a.COLCOUNT="colcount";a.DISABLED="disabled";a.EXPANDED="expanded";a.INVALID="invalid";a.LABEL="label";a.LABELLEDBY="labelledby";a.LEVEL="level";a.ORIENTATION="orientation";a.POSINSET="posinset";a.ROWCOUNT="rowcount";a.SELECTED="selected";a.SETSIZE="setsize";a.VALUEMAX="valuemax";a.VALUEMIN="valuemin"})(State$$module$build$src$core$utils$aria||(State$$module$build$src$core$utils$aria={}));var module$build$src$core$utils$aria={};
module$build$src$core$utils$aria.Role=Role$$module$build$src$core$utils$aria;module$build$src$core$utils$aria.State=State$$module$build$src$core$utils$aria;module$build$src$core$utils$aria.setRole=setRole$$module$build$src$core$utils$aria;module$build$src$core$utils$aria.setState=setState$$module$build$src$core$utils$aria;var KeyCodes$$module$build$src$core$utils$keycodes;
(function(a){a[a.WIN_KEY_FF_LINUX=0]="WIN_KEY_FF_LINUX";a[a.MAC_ENTER=3]="MAC_ENTER";a[a.BACKSPACE=8]="BACKSPACE";a[a.TAB=9]="TAB";a[a.NUM_CENTER=12]="NUM_CENTER";a[a.ENTER=13]="ENTER";a[a.SHIFT=16]="SHIFT";a[a.CTRL=17]="CTRL";a[a.ALT=18]="ALT";a[a.PAUSE=19]="PAUSE";a[a.CAPS_LOCK=20]="CAPS_LOCK";a[a.ESC=27]="ESC";a[a.SPACE=32]="SPACE";a[a.PAGE_UP=33]="PAGE_UP";a[a.PAGE_DOWN=34]="PAGE_DOWN";a[a.END=35]="END";a[a.HOME=36]="HOME";a[a.LEFT=37]="LEFT";a[a.UP=38]="UP";a[a.RIGHT=39]="RIGHT";a[a.DOWN=40]=
@@ -471,23 +472,24 @@ b.appendChild(c);a.appendChild(b);this.roleName_&&setRole$$module$build$src$core
a:null}setRightToLeft(a){this.rightToLeft_=a}setRole(a){this.roleName_=a}setCheckable(a){this.checkable_=a}setChecked(a){this.checked_=a}setHighlighted(a){this.highlight_=a;const b=this.getElement();b&&this.isEnabled()&&(a?(addClass$$module$build$src$core$utils$dom(b,"blocklyMenuItemHighlight"),addClass$$module$build$src$core$utils$dom(b,"goog-menuitem-highlight")):(removeClass$$module$build$src$core$utils$dom(b,"blocklyMenuItemHighlight"),removeClass$$module$build$src$core$utils$dom(b,"goog-menuitem-highlight")))}isEnabled(){return this.enabled_}setEnabled(a){this.enabled_=
a}performAction(){this.isEnabled()&&this.actionHandler_&&this.actionHandler_(this)}onAction(a,b){this.actionHandler_=a.bind(b)}},module$build$src$core$menuitem={};module$build$src$core$menuitem.MenuItem=MenuItem$$module$build$src$core$menuitem;var FieldDropdown$$module$build$src$core$field_dropdown=class extends Field$$module$build$src$core$field{constructor(a,b,c){super(Field$$module$build$src$core$field.SKIP_SETUP);this.svgArrow_=this.arrow_=this.imageElement_=this.menu_=this.selectedMenuItem_=null;this.SERIALIZABLE=!0;this.CURSOR="default";this.suffixField=this.prefixField=this.generatedOptions_=null;a!==Field$$module$build$src$core$field.SKIP_SETUP&&(Array.isArray(a)&&(validateOptions$$module$build$src$core$field_dropdown(a),a=JSON.parse(JSON.stringify(a))),
this.menuGenerator_=a,this.trimOptions_(),this.selectedOption_=this.getOptions(!1)[0],c&&this.configure_(c),this.setValue(this.selectedOption_[1]),b&&this.setValidator(b))}fromXml(a){this.isOptionListDynamic()&&this.getOptions(!1);this.setValue(a.textContent)}loadState(a){this.loadLegacyState(FieldDropdown$$module$build$src$core$field_dropdown,a)||(this.isOptionListDynamic()&&this.getOptions(!1),this.setValue(a))}initView(){this.shouldAddBorderRect_()?this.createBorderRect_():this.clickTarget_=this.sourceBlock_.getSvgRoot();
this.createTextElement_();this.imageElement_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.IMAGE,{},this.fieldGroup_);this.getConstants().FIELD_DROPDOWN_SVG_ARROW?this.createSVGArrow_():this.createTextArrow_();this.borderRect_&&addClass$$module$build$src$core$utils$dom(this.borderRect_,"blocklyDropdownRect")}shouldAddBorderRect_(){return!this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW||this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW&&!this.getSourceBlock().isShadow()}createTextArrow_(){this.arrow_=
createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.TSPAN,{},this.textElement_);this.arrow_.appendChild(document.createTextNode(this.getSourceBlock().RTL?FieldDropdown$$module$build$src$core$field_dropdown.ARROW_CHAR+" ":" "+FieldDropdown$$module$build$src$core$field_dropdown.ARROW_CHAR));this.getSourceBlock().RTL?this.getTextElement().insertBefore(this.arrow_,this.textContent_):this.getTextElement().appendChild(this.arrow_)}createSVGArrow_(){this.svgArrow_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.IMAGE,
{height:this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE+"px",width:this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE+"px"},this.fieldGroup_);this.svgArrow_.setAttributeNS(XLINK_NS$$module$build$src$core$utils$dom,"xlink:href",this.getConstants().FIELD_DROPDOWN_SVG_ARROW_DATAURI)}showEditor_(a){this.dropdownCreate_();this.menu_.openingCoords=a&&"number"===typeof a.clientX?new Coordinate$$module$build$src$core$utils$coordinate(a.clientX,a.clientY):null;clearContent$$module$build$src$core$dropdowndiv();
a=this.menu_.render(getContentDiv$$module$build$src$core$dropdowndiv());addClass$$module$build$src$core$utils$dom(a,"blocklyDropdownMenu");if(this.getConstants().FIELD_DROPDOWN_COLOURED_DIV){a=this.getSourceBlock().isShadow()?this.getSourceBlock().getParent().getColour():this.getSourceBlock().getColour();const b=this.getSourceBlock().isShadow()?this.getSourceBlock().getParent().style.colourTertiary:this.sourceBlock_.style.colourTertiary;if(!b)throw Error("The renderer did not properly initialize the block style");
setColour$$module$build$src$core$dropdowndiv(a,b)}showPositionedByField$$module$build$src$core$dropdowndiv(this,this.dropdownDispose_.bind(this));this.menu_.focus();this.selectedMenuItem_&&this.menu_.setHighlighted(this.selectedMenuItem_);this.applyColour()}dropdownCreate_(){const a=new Menu$$module$build$src$core$menu;a.setRole(Role$$module$build$src$core$utils$aria.LISTBOX);this.menu_=a;const b=this.getOptions(!1);this.selectedMenuItem_=null;for(let d=0;d<b.length;d++){var c=b[d][0];const e=b[d][1];
if("object"===typeof c){const f=new Image(c.width,c.height);f.src=c.src;f.alt=c.alt||"";c=f}c=new MenuItem$$module$build$src$core$menuitem(c,e);c.setRole(Role$$module$build$src$core$utils$aria.OPTION);c.setRightToLeft(this.getSourceBlock().RTL);c.setCheckable(!0);a.addChild(c);c.setChecked(e===this.value_);e===this.value_&&(this.selectedMenuItem_=c);c.onAction(this.handleMenuActionEvent_,this)}}dropdownDispose_(){this.menu_&&this.menu_.dispose();this.selectedMenuItem_=this.menu_=null;this.applyColour()}handleMenuActionEvent_(a){hideIfOwner$$module$build$src$core$dropdowndiv(this,
!0);this.onItemSelected_(this.menu_,a)}onItemSelected_(a,b){this.setValue(b.getValue())}trimOptions_(){const a=this.menuGenerator_;if(Array.isArray(a)){var b=!1;for(var c=0;c<a.length;c++){var d=a[c][0];"string"===typeof d?a[c][0]=replaceMessageReferences$$module$build$src$core$utils$parsing(d):(null!==d.alt&&(a[c][0].alt=replaceMessageReferences$$module$build$src$core$utils$parsing(d.alt)),b=!0)}if(!(b||2>a.length)){b=[];for(c=0;c<a.length;c++)b.push(a[c][0]);c=shortestStringLength$$module$build$src$core$utils$string(b);
d=commonWordPrefix$$module$build$src$core$utils$string(b,c);var e=commonWordSuffix$$module$build$src$core$utils$string(b,c);!d&&!e||c<=d+e||(d&&(this.prefixField=b[0].substring(0,d-1)),e&&(this.suffixField=b[0].substr(1-e)),this.menuGenerator_=FieldDropdown$$module$build$src$core$field_dropdown.applyTrim_(a,d,e))}}}isOptionListDynamic(){return"function"===typeof this.menuGenerator_}getOptions(a){return this.isOptionListDynamic()?(this.generatedOptions_&&a||(this.generatedOptions_=this.menuGenerator_.call(this),
validateOptions$$module$build$src$core$field_dropdown(this.generatedOptions_)),this.generatedOptions_):this.menuGenerator_}doClassValidation_(a){let b=!1;const c=this.getOptions(!0);for(let d=0,e;e=c[d];d++)if(e[1]===a){b=!0;break}return b?a:(this.sourceBlock_&&console.warn("Cannot set the dropdown's value to an unavailable option. Block type: "+this.sourceBlock_.type+", Field name: "+this.name+", Value: "+a),null)}doValueUpdate_(a){super.doValueUpdate_(a);a=this.getOptions(!0);for(let b=0,c;c=a[b];b++)c[1]===
this.value_&&(this.selectedOption_=c)}applyColour(){const a=this.sourceBlock_.style;if(!a.colourSecondary)throw Error("The renderer did not properly initialize the block style");if(!a.colourTertiary)throw Error("The renderer did not properly initialize the block style");this.borderRect_&&(this.borderRect_.setAttribute("stroke",a.colourTertiary),this.menu_?this.borderRect_.setAttribute("fill",a.colourTertiary):this.borderRect_.setAttribute("fill","transparent"));this.sourceBlock_&&this.arrow_&&(this.sourceBlock_.isShadow()?
this.arrow_.style.fill=a.colourSecondary:this.arrow_.style.fill=a.colourPrimary)}render_(){this.getTextContent().nodeValue="";this.imageElement_.style.display="none";const a=this.selectedOption_&&this.selectedOption_[0];a&&"object"===typeof a?this.renderSelectedImage_(a):this.renderSelectedText_();this.positionBorderRect_()}renderSelectedImage_(a){this.imageElement_.style.display="";this.imageElement_.setAttributeNS(XLINK_NS$$module$build$src$core$utils$dom,"xlink:href",a.src);this.imageElement_.setAttribute("height",
a.height);this.imageElement_.setAttribute("width",a.width);const b=Number(a.height);a=Number(a.width);var c=!!this.borderRect_;const d=Math.max(c?this.getConstants().FIELD_DROPDOWN_BORDER_RECT_HEIGHT:0,b+IMAGE_Y_PADDING$$module$build$src$core$field_dropdown);c=c?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0;let e;e=this.svgArrow_?this.positionSVGArrow_(a+c,d/2-this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE/2):getFastTextWidth$$module$build$src$core$utils$dom(this.arrow_,this.getConstants().FIELD_TEXT_FONTSIZE,
this.getConstants().FIELD_TEXT_FONTWEIGHT,this.getConstants().FIELD_TEXT_FONTFAMILY);this.size_.width=a+e+2*c;this.size_.height=d;let f=0;this.getSourceBlock().RTL?this.imageElement_.setAttribute("x",(c+e).toString()):(f=a+e,this.getTextElement().setAttribute("text-anchor","end"),this.imageElement_.setAttribute("x",c.toString()));this.imageElement_.setAttribute("y",(d/2-b/2).toString());this.positionTextElement_(f+c,a+e)}renderSelectedText_(){this.getTextContent().nodeValue=this.getDisplayText_();
var a=this.getTextElement();addClass$$module$build$src$core$utils$dom(a,"blocklyDropdownText");a.setAttribute("text-anchor","start");var b=!!this.borderRect_;a=Math.max(b?this.getConstants().FIELD_DROPDOWN_BORDER_RECT_HEIGHT:0,this.getConstants().FIELD_TEXT_HEIGHT);const c=getFastTextWidth$$module$build$src$core$utils$dom(this.getTextElement(),this.getConstants().FIELD_TEXT_FONTSIZE,this.getConstants().FIELD_TEXT_FONTWEIGHT,this.getConstants().FIELD_TEXT_FONTFAMILY);b=b?this.getConstants().FIELD_BORDER_RECT_X_PADDING:
0;let d=0;this.svgArrow_&&(d=this.positionSVGArrow_(c+b,a/2-this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE/2));this.size_.width=c+d+2*b;this.size_.height=a;this.positionTextElement_(b,c)}positionSVGArrow_(a,b){if(!this.svgArrow_)return 0;const c=this.borderRect_?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0,d=this.getConstants().FIELD_DROPDOWN_SVG_ARROW_PADDING,e=this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE;a=this.getSourceBlock().RTL?c:a+d;this.svgArrow_.setAttribute("transform","translate("+
a+","+b+")");return e+d}getText_(){if(!this.selectedOption_)return null;const a=this.selectedOption_[0];return"object"===typeof a?a.alt:a}static fromJson(a){if(!a.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(a.options,void 0,a)}static applyTrim_(a,b,c){const d=[];for(let e=0;e<a.length;e++){let f=a[e][0];const g=a[e][1];f=f.substring(b,f.length-c);d[e]=[f,g]}return d}};
FieldDropdown$$module$build$src$core$field_dropdown.CHECKMARK_OVERHANG=25;FieldDropdown$$module$build$src$core$field_dropdown.MAX_MENU_HEIGHT_VH=.45;var IMAGE_Y_OFFSET$$module$build$src$core$field_dropdown=5,IMAGE_Y_PADDING$$module$build$src$core$field_dropdown=2*IMAGE_Y_OFFSET$$module$build$src$core$field_dropdown;FieldDropdown$$module$build$src$core$field_dropdown.ARROW_CHAR=ANDROID$$module$build$src$core$utils$useragent?"\u25bc":"\u25be";
this.createTextElement_();this.imageElement_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.IMAGE,{},this.fieldGroup_);this.getConstants().FIELD_DROPDOWN_SVG_ARROW?this.createSVGArrow_():this.createTextArrow_();this.borderRect_&&addClass$$module$build$src$core$utils$dom(this.borderRect_,"blocklyDropdownRect")}shouldAddBorderRect_(){let a;return!this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW||this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW&&
!(null==(a=this.getSourceBlock())?0:a.isShadow())}createTextArrow_(){this.arrow_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.TSPAN,{},this.textElement_);let a;this.arrow_.appendChild(document.createTextNode((null==(a=this.getSourceBlock())?0:a.RTL)?FieldDropdown$$module$build$src$core$field_dropdown.ARROW_CHAR+" ":" "+FieldDropdown$$module$build$src$core$field_dropdown.ARROW_CHAR));let b;(null==(b=this.getSourceBlock())?0:b.RTL)?this.getTextElement().insertBefore(this.arrow_,
this.textContent_):this.getTextElement().appendChild(this.arrow_)}createSVGArrow_(){this.svgArrow_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.IMAGE,{height:this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE+"px",width:this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE+"px"},this.fieldGroup_);this.svgArrow_.setAttributeNS(XLINK_NS$$module$build$src$core$utils$dom,"xlink:href",this.getConstants().FIELD_DROPDOWN_SVG_ARROW_DATAURI)}showEditor_(a){var b=this.getSourceBlock();
if(!b)throw new UnattachedFieldError$$module$build$src$core$field;this.dropdownCreate_();this.menu_.openingCoords=a&&"number"===typeof a.clientX?new Coordinate$$module$build$src$core$utils$coordinate(a.clientX,a.clientY):null;clearContent$$module$build$src$core$dropdowndiv();a=this.menu_.render(getContentDiv$$module$build$src$core$dropdowndiv());addClass$$module$build$src$core$utils$dom(a,"blocklyDropdownMenu");if(this.getConstants().FIELD_DROPDOWN_COLOURED_DIV){a=b.isShadow()?b.getParent().getColour():
b.getColour();b=b.isShadow()?b.getParent().style.colourTertiary:this.sourceBlock_.style.colourTertiary;if(!b)throw Error("The renderer did not properly initialize the block style");setColour$$module$build$src$core$dropdowndiv(a,b)}showPositionedByField$$module$build$src$core$dropdowndiv(this,this.dropdownDispose_.bind(this));this.menu_.focus();this.selectedMenuItem_&&this.menu_.setHighlighted(this.selectedMenuItem_);this.applyColour()}dropdownCreate_(){const a=this.getSourceBlock();if(!a)throw new UnattachedFieldError$$module$build$src$core$field;
const b=new Menu$$module$build$src$core$menu;b.setRole(Role$$module$build$src$core$utils$aria.LISTBOX);this.menu_=b;const c=this.getOptions(!1);this.selectedMenuItem_=null;for(let e=0;e<c.length;e++){var d=c[e][0];const f=c[e][1];if("object"===typeof d){const g=new Image(d.width,d.height);g.src=d.src;g.alt=d.alt||"";d=g}d=new MenuItem$$module$build$src$core$menuitem(d,f);d.setRole(Role$$module$build$src$core$utils$aria.OPTION);d.setRightToLeft(a.RTL);d.setCheckable(!0);b.addChild(d);d.setChecked(f===
this.value_);f===this.value_&&(this.selectedMenuItem_=d);d.onAction(this.handleMenuActionEvent_,this)}}dropdownDispose_(){this.menu_&&this.menu_.dispose();this.selectedMenuItem_=this.menu_=null;this.applyColour()}handleMenuActionEvent_(a){hideIfOwner$$module$build$src$core$dropdowndiv(this,!0);this.onItemSelected_(this.menu_,a)}onItemSelected_(a,b){this.setValue(b.getValue())}trimOptions_(){const a=this.menuGenerator_;if(Array.isArray(a)){var b=!1;for(var c=0;c<a.length;c++){var d=a[c][0];"string"===
typeof d?a[c][0]=replaceMessageReferences$$module$build$src$core$utils$parsing(d):(null!==d.alt&&(a[c][0].alt=replaceMessageReferences$$module$build$src$core$utils$parsing(d.alt)),b=!0)}if(!(b||2>a.length)){b=[];for(c=0;c<a.length;c++)b.push(a[c][0]);c=shortestStringLength$$module$build$src$core$utils$string(b);d=commonWordPrefix$$module$build$src$core$utils$string(b,c);var e=commonWordSuffix$$module$build$src$core$utils$string(b,c);!d&&!e||c<=d+e||(d&&(this.prefixField=b[0].substring(0,d-1)),e&&
(this.suffixField=b[0].substr(1-e)),this.menuGenerator_=FieldDropdown$$module$build$src$core$field_dropdown.applyTrim_(a,d,e))}}}isOptionListDynamic(){return"function"===typeof this.menuGenerator_}getOptions(a){return this.isOptionListDynamic()?(this.generatedOptions_&&a||(this.generatedOptions_=this.menuGenerator_.call(this),validateOptions$$module$build$src$core$field_dropdown(this.generatedOptions_)),this.generatedOptions_):this.menuGenerator_}doClassValidation_(a){let b=!1;const c=this.getOptions(!0);
for(let d=0,e;e=c[d];d++)if(e[1]===a){b=!0;break}return b?a:(this.sourceBlock_&&console.warn("Cannot set the dropdown's value to an unavailable option. Block type: "+this.sourceBlock_.type+", Field name: "+this.name+", Value: "+a),null)}doValueUpdate_(a){super.doValueUpdate_(a);a=this.getOptions(!0);for(let b=0,c;c=a[b];b++)c[1]===this.value_&&(this.selectedOption_=c)}applyColour(){const a=this.sourceBlock_.style;if(!a.colourSecondary)throw Error("The renderer did not properly initialize the block style");
if(!a.colourTertiary)throw Error("The renderer did not properly initialize the block style");this.borderRect_&&(this.borderRect_.setAttribute("stroke",a.colourTertiary),this.menu_?this.borderRect_.setAttribute("fill",a.colourTertiary):this.borderRect_.setAttribute("fill","transparent"));this.sourceBlock_&&this.arrow_&&(this.sourceBlock_.isShadow()?this.arrow_.style.fill=a.colourSecondary:this.arrow_.style.fill=a.colourPrimary)}render_(){this.getTextContent().nodeValue="";this.imageElement_.style.display=
"none";const a=this.selectedOption_&&this.selectedOption_[0];a&&"object"===typeof a?this.renderSelectedImage_(a):this.renderSelectedText_();this.positionBorderRect_()}renderSelectedImage_(a){const b=this.getSourceBlock();if(!b)throw new UnattachedFieldError$$module$build$src$core$field;this.imageElement_.style.display="";this.imageElement_.setAttributeNS(XLINK_NS$$module$build$src$core$utils$dom,"xlink:href",a.src);this.imageElement_.setAttribute("height",a.height);this.imageElement_.setAttribute("width",
a.width);const c=Number(a.height);a=Number(a.width);var d=!!this.borderRect_;const e=Math.max(d?this.getConstants().FIELD_DROPDOWN_BORDER_RECT_HEIGHT:0,c+IMAGE_Y_PADDING$$module$build$src$core$field_dropdown);d=d?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0;let f;f=this.svgArrow_?this.positionSVGArrow_(a+d,e/2-this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE/2):getFastTextWidth$$module$build$src$core$utils$dom(this.arrow_,this.getConstants().FIELD_TEXT_FONTSIZE,this.getConstants().FIELD_TEXT_FONTWEIGHT,
this.getConstants().FIELD_TEXT_FONTFAMILY);this.size_.width=a+f+2*d;this.size_.height=e;let g=0;b.RTL?this.imageElement_.setAttribute("x",(d+f).toString()):(g=a+f,this.getTextElement().setAttribute("text-anchor","end"),this.imageElement_.setAttribute("x",d.toString()));this.imageElement_.setAttribute("y",(e/2-c/2).toString());this.positionTextElement_(g+d,a+f)}renderSelectedText_(){this.getTextContent().nodeValue=this.getDisplayText_();var a=this.getTextElement();addClass$$module$build$src$core$utils$dom(a,
"blocklyDropdownText");a.setAttribute("text-anchor","start");var b=!!this.borderRect_;a=Math.max(b?this.getConstants().FIELD_DROPDOWN_BORDER_RECT_HEIGHT:0,this.getConstants().FIELD_TEXT_HEIGHT);const c=getFastTextWidth$$module$build$src$core$utils$dom(this.getTextElement(),this.getConstants().FIELD_TEXT_FONTSIZE,this.getConstants().FIELD_TEXT_FONTWEIGHT,this.getConstants().FIELD_TEXT_FONTFAMILY);b=b?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0;let d=0;this.svgArrow_&&(d=this.positionSVGArrow_(c+
b,a/2-this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE/2));this.size_.width=c+d+2*b;this.size_.height=a;this.positionTextElement_(b,c)}positionSVGArrow_(a,b){if(!this.svgArrow_)return 0;const c=this.getSourceBlock();if(!c)throw new UnattachedFieldError$$module$build$src$core$field;const d=this.borderRect_?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0,e=this.getConstants().FIELD_DROPDOWN_SVG_ARROW_PADDING,f=this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE;this.svgArrow_.setAttribute("transform",
"translate("+(c.RTL?d:a+e)+","+b+")");return f+e}getText_(){if(!this.selectedOption_)return null;const a=this.selectedOption_[0];return"object"===typeof a?a.alt:a}static fromJson(a){if(!a.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(a.options,void 0,a)}static applyTrim_(a,b,c){const d=[];for(let e=0;e<a.length;e++){let f=a[e][0];const g=a[e][1];f=f.substring(b,
f.length-c);d[e]=[f,g]}return d}};FieldDropdown$$module$build$src$core$field_dropdown.CHECKMARK_OVERHANG=25;FieldDropdown$$module$build$src$core$field_dropdown.MAX_MENU_HEIGHT_VH=.45;var IMAGE_Y_OFFSET$$module$build$src$core$field_dropdown=5,IMAGE_Y_PADDING$$module$build$src$core$field_dropdown=2*IMAGE_Y_OFFSET$$module$build$src$core$field_dropdown;FieldDropdown$$module$build$src$core$field_dropdown.ARROW_CHAR=ANDROID$$module$build$src$core$utils$useragent?"\u25bc":"\u25be";
register$$module$build$src$core$field_registry("field_dropdown",FieldDropdown$$module$build$src$core$field_dropdown);$.module$build$src$core$field_dropdown={};$.module$build$src$core$field_dropdown.FieldDropdown=FieldDropdown$$module$build$src$core$field_dropdown;var BubbleOpen$$module$build$src$core$events$events_bubble_open=class extends UiBase$$module$build$src$core$events$events_ui_base{constructor(a,b,c){super(a?a.workspace.id:void 0);this.type=BUBBLE_OPEN$$module$build$src$core$events$utils;a&&(this.blockId=a.id,this.isOpen=b,this.bubbleType=c)}toJson(){const a=super.toJson();if(void 0===this.isOpen)throw Error("Whether this event is for opening the bubble is undefined. Either pass the value to the constructor, or call fromJson");if(!this.bubbleType)throw Error("The type of bubble is undefined. Either pass the value to the constructor, or call fromJson");
a.isOpen=this.isOpen;a.bubbleType=this.bubbleType;a.blockId=this.blockId||"";return a}fromJson(a){super.fromJson(a);this.isOpen=a.isOpen;this.bubbleType=a.bubbleType;this.blockId=a.blockId}},BubbleType$$module$build$src$core$events$events_bubble_open;(function(a){a.MUTATOR="mutator";a.COMMENT="comment";a.WARNING="warning"})(BubbleType$$module$build$src$core$events$events_bubble_open||(BubbleType$$module$build$src$core$events$events_bubble_open={}));
register$$module$build$src$core$registry(Type$$module$build$src$core$registry.EVENT,BUBBLE_OPEN$$module$build$src$core$events$utils,BubbleOpen$$module$build$src$core$events$events_bubble_open);var module$build$src$core$events$events_bubble_open={};module$build$src$core$events$events_bubble_open.BubbleOpen=BubbleOpen$$module$build$src$core$events$events_bubble_open;module$build$src$core$events$events_bubble_open.BubbleType=BubbleType$$module$build$src$core$events$events_bubble_open;var Scrollbar$$module$build$src$core$scrollbar=class{constructor(a,b,c,d,e){this.workspace=a;this.horizontal=b;this.oldHostMetrics_=null;this.ratio=1;this.startDragHandle=this.handlePosition_=this.handleLength_=this.scrollbarLength_=this.startDragMouse_=0;this.containerVisible_=this.isVisible_=!0;this.svgGroup_=this.outerSvg_=this.svgHandle_=this.svgBackground_=null;this.lengthAttribute_="width";this.positionAttribute_="x";this.onMouseMoveWrapper_=this.onMouseUpWrapper_=null;this.pair_=c||!1;this.margin_=
@@ -613,20 +615,20 @@ if(c=c.targetBlock())c.getSvgRoot().style.display=a?"block":"none"}return b}mark
return this.connection.getShadowDom()}init(){if(this.sourceBlock_.workspace.rendered)for(let a=0;a<this.fieldRow.length;a++)this.fieldRow[a].init()}dispose(){for(let a=0,b;b=this.fieldRow[a];a++)b.dispose();this.connection&&this.connection.dispose()}},module$build$src$core$input;(function(a){a=a.Align||(a.Align={});a[a.LEFT=-1]="LEFT";a[a.CENTRE=0]="CENTRE";a[a.RIGHT=1]="RIGHT"})(Input$$module$build$src$core$input||(Input$$module$build$src$core$input={}));$.Align$$module$build$src$core$input=Input$$module$build$src$core$input.Align;
module$build$src$core$input={};module$build$src$core$input.Align=$.Align$$module$build$src$core$input;module$build$src$core$input.Input=Input$$module$build$src$core$input;var ASTNode$$module$build$src$core$keyboard_nav$ast_node=class{constructor(a,b,c){this.wsCoordinate_=null;if(!b)throw Error("Cannot create a node without a location.");this.type_=a;this.isConnection_=ASTNode$$module$build$src$core$keyboard_nav$ast_node.isConnectionType_(a);this.location_=b;this.processParams_(c||null)}processParams_(a){a&&a.wsCoordinate&&(this.wsCoordinate_=a.wsCoordinate)}getLocation(){return this.location_}getType(){return this.type_}getWsCoordinate(){return this.wsCoordinate_}isConnection(){return this.isConnection_}findNextForInput_(){var a=
this.location_.getParentInput();const b=a.getSourceBlock();a=b.inputList.indexOf(a);for(a+=1;a<b.inputList.length;a++){const c=b.inputList[a],d=c.fieldRow;for(let e=0;e<d.length;e++){const f=d[e];if(f.isClickable()||ASTNode$$module$build$src$core$keyboard_nav$ast_node.NAVIGATE_ALL_FIELDS)return ASTNode$$module$build$src$core$keyboard_nav$ast_node.createFieldNode(f)}if(c.connection)return ASTNode$$module$build$src$core$keyboard_nav$ast_node.createInputNode(c)}return null}findNextForField_(){var a=
this.location_,b=a.getParentInput();const c=a.getSourceBlock();var d=c.inputList.indexOf(b);for(a=b.fieldRow.indexOf(a)+1;d<c.inputList.length;d++){b=c.inputList[d];const e=b.fieldRow;for(;a<e.length;){if(e[a].isClickable()||ASTNode$$module$build$src$core$keyboard_nav$ast_node.NAVIGATE_ALL_FIELDS)return ASTNode$$module$build$src$core$keyboard_nav$ast_node.createFieldNode(e[a]);a++}a=0;if(b.connection)return ASTNode$$module$build$src$core$keyboard_nav$ast_node.createInputNode(b)}return null}findPrevForInput_(){const a=
this.location_,b=a.getParentInput();const c=a.getSourceBlock();if(!c)throw Error("The current AST location is not associated with a block");var d=c.inputList.indexOf(b);for(a=b.fieldRow.indexOf(a)+1;d<c.inputList.length;d++){b=c.inputList[d];const e=b.fieldRow;for(;a<e.length;){if(e[a].isClickable()||ASTNode$$module$build$src$core$keyboard_nav$ast_node.NAVIGATE_ALL_FIELDS)return ASTNode$$module$build$src$core$keyboard_nav$ast_node.createFieldNode(e[a]);a++}a=0;if(b.connection)return ASTNode$$module$build$src$core$keyboard_nav$ast_node.createInputNode(b)}return null}findPrevForInput_(){const a=
this.location_.getParentInput(),b=a.getSourceBlock();for(var c=b.inputList.indexOf(a);0<=c;c--){var d=b.inputList[c];if(d.connection&&d!==a)return ASTNode$$module$build$src$core$keyboard_nav$ast_node.createInputNode(d);d=d.fieldRow;for(let e=d.length-1;0<=e;e--){const f=d[e];if(f.isClickable()||ASTNode$$module$build$src$core$keyboard_nav$ast_node.NAVIGATE_ALL_FIELDS)return ASTNode$$module$build$src$core$keyboard_nav$ast_node.createFieldNode(f)}}return null}findPrevForField_(){var a=this.location_;
const b=a.getParentInput(),c=a.getSourceBlock();var d=c.inputList.indexOf(b);for(a=b.fieldRow.indexOf(a)-1;0<=d;d--){var e=c.inputList[d];if(e.connection&&e!==b)return ASTNode$$module$build$src$core$keyboard_nav$ast_node.createInputNode(e);for(e=e.fieldRow;-1<a;){if(e[a].isClickable()||ASTNode$$module$build$src$core$keyboard_nav$ast_node.NAVIGATE_ALL_FIELDS)return ASTNode$$module$build$src$core$keyboard_nav$ast_node.createFieldNode(e[a]);a--}0<=d-1&&(a=c.inputList[d-1].fieldRow.length-1)}return null}navigateBetweenStacks_(a){var b=
this.getLocation();b.getSourceBlock&&(b=b.getSourceBlock());if(!b||b.isDeadOrDying())return null;const c=b.getRootBlock();b=c.workspace.getTopBlocks(!0);for(let d=0;d<b.length;d++)if(c.id===b[d].id)return a=d+(a?1:-1),-1===a||a===b.length?null:ASTNode$$module$build$src$core$keyboard_nav$ast_node.createStackNode(b[a]);throw Error("Couldn't find "+(a?"next":"previous")+" stack?!");}findTopASTNodeForBlock_(a){const b=getParentConnection$$module$build$src$core$keyboard_nav$ast_node(a);return b?ASTNode$$module$build$src$core$keyboard_nav$ast_node.createConnectionNode(b):
ASTNode$$module$build$src$core$keyboard_nav$ast_node.createBlockNode(a)}getOutAstNodeForBlock_(a){if(!a)return null;a=a.getTopStackBlock();const b=getParentConnection$$module$build$src$core$keyboard_nav$ast_node(a);return b&&b.targetConnection&&b.targetConnection.getParentInput()?ASTNode$$module$build$src$core$keyboard_nav$ast_node.createInputNode(b.targetConnection.getParentInput()):ASTNode$$module$build$src$core$keyboard_nav$ast_node.createStackNode(a)}findFirstFieldOrInput_(a){a=a.inputList;for(let b=
0;b<a.length;b++){const c=a[b],d=c.fieldRow;for(let e=0;e<d.length;e++){const f=d[e];if(f.isClickable()||ASTNode$$module$build$src$core$keyboard_nav$ast_node.NAVIGATE_ALL_FIELDS)return ASTNode$$module$build$src$core$keyboard_nav$ast_node.createFieldNode(f)}if(c.connection)return ASTNode$$module$build$src$core$keyboard_nav$ast_node.createInputNode(c)}return null}getSourceBlock(){return this.getType()===ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.BLOCK?this.getLocation():this.getType()===
ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.STACK?this.getLocation():this.getType()===ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.WORKSPACE?null:this.getLocation().getSourceBlock()}next(){switch(this.type_){case ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.STACK:return this.navigateBetweenStacks_(!0);case ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.OUTPUT:return ASTNode$$module$build$src$core$keyboard_nav$ast_node.createBlockNode(this.location_.getSourceBlock());
const b=a.getParentInput(),c=a.getSourceBlock();if(!c)throw Error("The current AST location is not associated with a block");var d=c.inputList.indexOf(b);for(a=b.fieldRow.indexOf(a)-1;0<=d;d--){var e=c.inputList[d];if(e.connection&&e!==b)return ASTNode$$module$build$src$core$keyboard_nav$ast_node.createInputNode(e);for(e=e.fieldRow;-1<a;){if(e[a].isClickable()||ASTNode$$module$build$src$core$keyboard_nav$ast_node.NAVIGATE_ALL_FIELDS)return ASTNode$$module$build$src$core$keyboard_nav$ast_node.createFieldNode(e[a]);
a--}0<=d-1&&(a=c.inputList[d-1].fieldRow.length-1)}return null}navigateBetweenStacks_(a){var b=this.getLocation();if(b.getSourceBlock){var c=b.getSourceBlock();c&&(b=c)}if(!b||b.isDeadOrDying())return null;c=b.getRootBlock();b=c.workspace.getTopBlocks(!0);for(let d=0;d<b.length;d++)if(c.id===b[d].id)return a=d+(a?1:-1),-1===a||a===b.length?null:ASTNode$$module$build$src$core$keyboard_nav$ast_node.createStackNode(b[a]);throw Error("Couldn't find "+(a?"next":"previous")+" stack?!");}findTopASTNodeForBlock_(a){const b=
getParentConnection$$module$build$src$core$keyboard_nav$ast_node(a);return b?ASTNode$$module$build$src$core$keyboard_nav$ast_node.createConnectionNode(b):ASTNode$$module$build$src$core$keyboard_nav$ast_node.createBlockNode(a)}getOutAstNodeForBlock_(a){if(!a)return null;a=a.getTopStackBlock();const b=getParentConnection$$module$build$src$core$keyboard_nav$ast_node(a);return b&&b.targetConnection&&b.targetConnection.getParentInput()?ASTNode$$module$build$src$core$keyboard_nav$ast_node.createInputNode(b.targetConnection.getParentInput()):
ASTNode$$module$build$src$core$keyboard_nav$ast_node.createStackNode(a)}findFirstFieldOrInput_(a){a=a.inputList;for(let b=0;b<a.length;b++){const c=a[b],d=c.fieldRow;for(let e=0;e<d.length;e++){const f=d[e];if(f.isClickable()||ASTNode$$module$build$src$core$keyboard_nav$ast_node.NAVIGATE_ALL_FIELDS)return ASTNode$$module$build$src$core$keyboard_nav$ast_node.createFieldNode(f)}if(c.connection)return ASTNode$$module$build$src$core$keyboard_nav$ast_node.createInputNode(c)}return null}getSourceBlock(){return this.getType()===
ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.BLOCK?this.getLocation():this.getType()===ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.STACK?this.getLocation():this.getType()===ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.WORKSPACE?null:this.getLocation().getSourceBlock()}next(){switch(this.type_){case ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.STACK:return this.navigateBetweenStacks_(!0);case ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.OUTPUT:return ASTNode$$module$build$src$core$keyboard_nav$ast_node.createBlockNode(this.location_.getSourceBlock());
case ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.FIELD:return this.findNextForField_();case ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.INPUT:return this.findNextForInput_();case ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.BLOCK:return ASTNode$$module$build$src$core$keyboard_nav$ast_node.createConnectionNode(this.location_.nextConnection);case ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.PREVIOUS:return ASTNode$$module$build$src$core$keyboard_nav$ast_node.createBlockNode(this.location_.getSourceBlock());
case ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.NEXT:return ASTNode$$module$build$src$core$keyboard_nav$ast_node.createConnectionNode(this.location_.targetConnection)}return null}in(){switch(this.type_){case ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.WORKSPACE:const a=this.location_.getTopBlocks(!0);if(0<a.length)return ASTNode$$module$build$src$core$keyboard_nav$ast_node.createStackNode(a[0]);break;case ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.STACK:return this.findTopASTNodeForBlock_(this.location_);
case ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.BLOCK:return this.findFirstFieldOrInput_(this.location_);case ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.INPUT:return ASTNode$$module$build$src$core$keyboard_nav$ast_node.createConnectionNode(this.location_.targetConnection)}return null}prev(){switch(this.type_){case ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.STACK:return this.navigateBetweenStacks_(!1);case ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.FIELD:return this.findPrevForField_();
case ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.INPUT:return this.findPrevForInput_();case ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.BLOCK:var a=getParentConnection$$module$build$src$core$keyboard_nav$ast_node(this.location_);return ASTNode$$module$build$src$core$keyboard_nav$ast_node.createConnectionNode(a);case ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.PREVIOUS:if((a=this.location_.targetConnection)&&!a.getParentInput())return ASTNode$$module$build$src$core$keyboard_nav$ast_node.createConnectionNode(a);
break;case ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.NEXT:return ASTNode$$module$build$src$core$keyboard_nav$ast_node.createBlockNode(this.location_.getSourceBlock())}return null}out(){switch(this.type_){case ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.STACK:var a=this.location_,b=a.getRelativeToSurfaceXY();b=new Coordinate$$module$build$src$core$utils$coordinate(b.x,b.y+ASTNode$$module$build$src$core$keyboard_nav$ast_node.DEFAULT_OFFSET_Y);return ASTNode$$module$build$src$core$keyboard_nav$ast_node.createWorkspaceNode(a.workspace,
b);case ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.OUTPUT:return a=this.location_,(b=a.targetConnection)?ASTNode$$module$build$src$core$keyboard_nav$ast_node.createConnectionNode(b):ASTNode$$module$build$src$core$keyboard_nav$ast_node.createStackNode(a.getSourceBlock());case ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.FIELD:return ASTNode$$module$build$src$core$keyboard_nav$ast_node.createBlockNode(this.location_.getSourceBlock());case ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.INPUT:return ASTNode$$module$build$src$core$keyboard_nav$ast_node.createBlockNode(this.location_.getSourceBlock());
case ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.BLOCK:return this.getOutAstNodeForBlock_(this.location_);case ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.PREVIOUS:return this.getOutAstNodeForBlock_(this.location_.getSourceBlock());case ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.NEXT:return this.getOutAstNodeForBlock_(this.location_.getSourceBlock())}return null}static isConnectionType_(a){switch(a){case ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.PREVIOUS:case ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.NEXT:case ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.INPUT:case ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.OUTPUT:return!0}return!1}static createFieldNode(a){return a?
b);case ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.OUTPUT:return a=this.location_,(b=a.targetConnection)?ASTNode$$module$build$src$core$keyboard_nav$ast_node.createConnectionNode(b):ASTNode$$module$build$src$core$keyboard_nav$ast_node.createStackNode(a.getSourceBlock());case ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.FIELD:a=this.location_.getSourceBlock();if(!a)throw Error("The current AST location is not associated with a block");return ASTNode$$module$build$src$core$keyboard_nav$ast_node.createBlockNode(a);
case ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.INPUT:return ASTNode$$module$build$src$core$keyboard_nav$ast_node.createBlockNode(this.location_.getSourceBlock());case ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.BLOCK:return this.getOutAstNodeForBlock_(this.location_);case ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.PREVIOUS:return this.getOutAstNodeForBlock_(this.location_.getSourceBlock());case ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.NEXT:return this.getOutAstNodeForBlock_(this.location_.getSourceBlock())}return null}static isConnectionType_(a){switch(a){case ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.PREVIOUS:case ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.NEXT:case ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.INPUT:case ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.OUTPUT:return!0}return!1}static createFieldNode(a){return a?
new ASTNode$$module$build$src$core$keyboard_nav$ast_node(ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.FIELD,a):null}static createConnectionNode(a){if(!a)return null;const b=a.type;return b===ConnectionType$$module$build$src$core$connection_type.INPUT_VALUE||b===ConnectionType$$module$build$src$core$connection_type.NEXT_STATEMENT&&a.getParentInput()?ASTNode$$module$build$src$core$keyboard_nav$ast_node.createInputNode(a.getParentInput()):b===ConnectionType$$module$build$src$core$connection_type.NEXT_STATEMENT?
new ASTNode$$module$build$src$core$keyboard_nav$ast_node(ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.NEXT,a):b===ConnectionType$$module$build$src$core$connection_type.OUTPUT_VALUE?new ASTNode$$module$build$src$core$keyboard_nav$ast_node(ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.OUTPUT,a):b===ConnectionType$$module$build$src$core$connection_type.PREVIOUS_STATEMENT?new ASTNode$$module$build$src$core$keyboard_nav$ast_node(ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.PREVIOUS,
a):null}static createInputNode(a){return a&&a.connection?new ASTNode$$module$build$src$core$keyboard_nav$ast_node(ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.INPUT,a.connection):null}static createBlockNode(a){return a?new ASTNode$$module$build$src$core$keyboard_nav$ast_node(ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.BLOCK,a):null}static createStackNode(a){return a?new ASTNode$$module$build$src$core$keyboard_nav$ast_node(ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.STACK,
@@ -1173,20 +1175,20 @@ a.flipRtl&&(this.flipRtl_=a.flipRtl);a.alt&&(this.altText_=replaceMessageReferen
"pointer")}updateSize_(){}doClassValidation_(a){return"string"!==typeof a?null:a}doValueUpdate_(a){this.value_=a;this.imageElement_&&this.imageElement_.setAttributeNS(XLINK_NS$$module$build$src$core$utils$dom,"xlink:href",String(this.value_))}getFlipRtl(){return this.flipRtl_}setAlt(a){a!==this.altText_&&(this.altText_=a||"",this.imageElement_&&this.imageElement_.setAttribute("alt",this.altText_))}showEditor_(){this.clickHandler_&&this.clickHandler_(this)}setOnClickHandler(a){this.clickHandler_=a}getText_(){return this.altText_}static fromJson(a){if(!a.src||
!a.width||!a.height)throw Error("src, width, and height values for an image field arerequired. The width and height must be non-zero.");return new this(a.src,a.width,a.height,void 0,void 0,void 0,a)}};$.FieldImage$$module$build$src$core$field_image.Y_PADDING=1;register$$module$build$src$core$field_registry("field_image",$.FieldImage$$module$build$src$core$field_image);$.FieldImage$$module$build$src$core$field_image.prototype.DEFAULT_VALUE="";var module$build$src$core$field_image={};
module$build$src$core$field_image.FieldImage=$.FieldImage$$module$build$src$core$field_image;$.FieldTextInput$$module$build$src$core$field_textinput=class extends Field$$module$build$src$core$field{constructor(a,b,c){super(Field$$module$build$src$core$field.SKIP_SETUP);this.spellcheck_=!0;this.htmlInput_=null;this.isTextValid_=this.isBeingEdited_=!1;this.onKeyInputWrapper_=this.onKeyDownWrapper_=null;this.fullBlockClickTarget_=!1;this.workspace_=null;this.SERIALIZABLE=!0;this.CURSOR="text";a!==Field$$module$build$src$core$field.SKIP_SETUP&&(c&&this.configure_(c),this.setValue(a),b&&this.setValidator(b))}configure_(a){super.configure_(a);
void 0!==a.spellcheck&&(this.spellcheck_=a.spellcheck)}initView(){if(this.getConstants().FULL_BLOCK_FIELDS){let a=0,b=0;for(let c=0,d;d=this.getSourceBlock().inputList[c];c++){for(let e=0;d.fieldRow[e];e++)a++;d.connection&&b++}this.fullBlockClickTarget_=1>=a&&this.getSourceBlock().outputConnection&&!b}else this.fullBlockClickTarget_=!1;this.fullBlockClickTarget_?this.clickTarget_=this.sourceBlock_.getSvgRoot():this.createBorderRect_();this.createTextElement_()}doClassValidation_(a){return null===
void 0!==a.spellcheck&&(this.spellcheck_=a.spellcheck)}initView(){const a=this.getSourceBlock();if(!a)throw new UnattachedFieldError$$module$build$src$core$field;if(this.getConstants().FULL_BLOCK_FIELDS){let b=0,c=0;for(let d=0,e;e=a.inputList[d];d++){for(let f=0;e.fieldRow[f];f++)b++;e.connection&&c++}this.fullBlockClickTarget_=1>=b&&a.outputConnection&&!c}else this.fullBlockClickTarget_=!1;this.fullBlockClickTarget_?this.clickTarget_=this.sourceBlock_.getSvgRoot():this.createBorderRect_();this.createTextElement_()}doClassValidation_(a){return null===
a||void 0===a?null:String(a)}doValueInvalid_(a){this.isBeingEdited_&&(this.isTextValid_=!1,a=this.value_,this.value_=this.htmlInput_.getAttribute("data-untyped-default-value"),this.sourceBlock_&&isEnabled$$module$build$src$core$events$utils()&&fire$$module$build$src$core$events$utils(new (get$$module$build$src$core$events$utils(CHANGE$$module$build$src$core$events$utils))(this.sourceBlock_,"field",this.name||null,a,this.value_)))}doValueUpdate_(a){this.isTextValid_=!0;this.value_=a;this.isBeingEdited_||
(this.isDirty_=!0)}applyColour(){if(this.sourceBlock_&&this.getConstants().FULL_BLOCK_FIELDS){var a=this.sourceBlock_;if(this.borderRect_){if(!a.style.colourTertiary)throw Error("The renderer did not properly initialize the block style");this.borderRect_.setAttribute("stroke",a.style.colourTertiary)}else a.pathObject.svgPath.setAttribute("fill",this.getConstants().FIELD_BORDER_RECT_COLOUR)}}render_(){super.render_();if(this.isBeingEdited_){this.resizeEditor_();const a=this.htmlInput_;this.isTextValid_?
(removeClass$$module$build$src$core$utils$dom(a,"blocklyInvalidInput"),setState$$module$build$src$core$utils$aria(a,State$$module$build$src$core$utils$aria.INVALID,!1)):(addClass$$module$build$src$core$utils$dom(a,"blocklyInvalidInput"),setState$$module$build$src$core$utils$aria(a,State$$module$build$src$core$utils$aria.INVALID,!0))}}setSpellcheck(a){a!==this.spellcheck_&&(this.spellcheck_=a,this.htmlInput_&&this.htmlInput_.setAttribute("spellcheck",this.spellcheck_))}showEditor_(a,b){this.workspace_=
this.sourceBlock_.workspace;a=b||!1;!a&&(MOBILE$$module$build$src$core$utils$useragent||ANDROID$$module$build$src$core$utils$useragent||IPAD$$module$build$src$core$utils$useragent)?this.showPromptEditor_():this.showInlineEditor_(a)}showPromptEditor_(){prompt$$module$build$src$core$dialog(Msg$$module$build$src$core$msg.CHANGE_VALUE_TITLE,this.getText(),a=>{null!==a&&this.setValue(this.getValueFromEditorText_(a))})}showInlineEditor_(a){show$$module$build$src$core$widgetdiv(this,this.getSourceBlock().RTL,
this.widgetDispose_.bind(this));this.htmlInput_=this.widgetCreate_();this.isBeingEdited_=!0;a||(this.htmlInput_.focus({preventScroll:!0}),this.htmlInput_.select())}widgetCreate_(){setGroup$$module$build$src$core$events$utils(!0);const a=getDiv$$module$build$src$core$widgetdiv();var b=this.getClickTarget_();if(!b)throw Error("A click target has not been set.");addClass$$module$build$src$core$utils$dom(b,"editing");b=document.createElement("input");b.className="blocklyHtmlInput";b.setAttribute("spellcheck",
this.spellcheck_);const c=this.workspace_.getScale();var d=this.getConstants().FIELD_TEXT_FONTSIZE*c+"pt";a.style.fontSize=d;b.style.fontSize=d;d=$.FieldTextInput$$module$build$src$core$field_textinput.BORDERRADIUS*c+"px";if(this.fullBlockClickTarget_){d=this.getScaledBBox();d=(d.bottom-d.top)/2+"px";const e=this.getSourceBlock().getParent()?this.getSourceBlock().getParent().style.colourTertiary:this.sourceBlock_.style.colourTertiary;b.style.border=1*c+"px solid "+e;a.style.borderRadius=d;a.style.transition=
"box-shadow 0.25s ease 0s";this.getConstants().FIELD_TEXTINPUT_BOX_SHADOW&&(a.style.boxShadow="rgba(255, 255, 255, 0.3) 0 0 0 "+4*c+"px")}b.style.borderRadius=d;a.appendChild(b);b.value=b.defaultValue=this.getEditorText_(this.value_);b.setAttribute("data-untyped-default-value",this.value_);b.setAttribute("data-old-value","");this.resizeEditor_();this.bindInputEvents_(b);return b}widgetDispose_(){this.isBeingEdited_=!1;this.isTextValid_=!0;this.forceRerender();this.onFinishEditing_(this.value_);setGroup$$module$build$src$core$events$utils(!1);
this.unbindInputEvents_();var a=getDiv$$module$build$src$core$widgetdiv().style;a.width="auto";a.height="auto";a.fontSize="";a.transition="";a.boxShadow="";this.htmlInput_=null;a=this.getClickTarget_();if(!a)throw Error("A click target has not been set.");removeClass$$module$build$src$core$utils$dom(a,"editing")}onFinishEditing_(a){}bindInputEvents_(a){this.onKeyDownWrapper_=conditionalBind$$module$build$src$core$browser_events(a,"keydown",this,this.onHtmlInputKeyDown_);this.onKeyInputWrapper_=conditionalBind$$module$build$src$core$browser_events(a,
"input",this,this.onHtmlInputChange_)}unbindInputEvents_(){this.onKeyDownWrapper_&&(unbind$$module$build$src$core$browser_events(this.onKeyDownWrapper_),this.onKeyDownWrapper_=null);this.onKeyInputWrapper_&&(unbind$$module$build$src$core$browser_events(this.onKeyInputWrapper_),this.onKeyInputWrapper_=null)}onHtmlInputKeyDown_(a){a.keyCode===KeyCodes$$module$build$src$core$utils$keycodes.ENTER?(hide$$module$build$src$core$widgetdiv(),hideWithoutAnimation$$module$build$src$core$dropdowndiv()):a.keyCode===
KeyCodes$$module$build$src$core$utils$keycodes.ESC?(this.setValue(this.htmlInput_.getAttribute("data-untyped-default-value")),hide$$module$build$src$core$widgetdiv(),hideWithoutAnimation$$module$build$src$core$dropdowndiv()):a.keyCode===KeyCodes$$module$build$src$core$utils$keycodes.TAB&&(hide$$module$build$src$core$widgetdiv(),hideWithoutAnimation$$module$build$src$core$dropdowndiv(),this.sourceBlock_.tab(this,!a.shiftKey),a.preventDefault())}onHtmlInputChange_(a){a=this.htmlInput_.value;a!==this.htmlInput_.getAttribute("data-old-value")&&
(this.htmlInput_.setAttribute("data-old-value",a),a=this.getValueFromEditorText_(a),this.setValue(a),this.forceRerender(),this.resizeEditor_())}setEditorValue_(a){this.isDirty_=!0;this.isBeingEdited_&&(this.htmlInput_.value=this.getEditorText_(a));this.setValue(a)}resizeEditor_(){const a=getDiv$$module$build$src$core$widgetdiv();var b=this.getScaledBBox();a.style.width=b.right-b.left+"px";a.style.height=b.bottom-b.top+"px";const c=this.getSourceBlock().RTL?b.right-a.offsetWidth:b.left;b=new Coordinate$$module$build$src$core$utils$coordinate(c,
b.top);a.style.left=b.x+"px";a.style.top=b.y+"px"}isTabNavigable(){return!0}getText_(){return this.isBeingEdited_&&this.htmlInput_?this.htmlInput_.value:null}getEditorText_(a){return String(a)}getValueFromEditorText_(a){return a}static fromJson(a){return new this(replaceMessageReferences$$module$build$src$core$utils$parsing(a.text),void 0,a)}};$.FieldTextInput$$module$build$src$core$field_textinput.BORDERRADIUS=4;register$$module$build$src$core$field_registry("field_input",$.FieldTextInput$$module$build$src$core$field_textinput);
$.FieldTextInput$$module$build$src$core$field_textinput.prototype.DEFAULT_VALUE="";var module$build$src$core$field_textinput={};module$build$src$core$field_textinput.FieldTextInput=$.FieldTextInput$$module$build$src$core$field_textinput;var BottomRow$$module$build$src$core$renderers$zelos$measurables$bottom_row=class extends BottomRow$$module$build$src$core$renderers$measurables$bottom_row{constructor(a){super(a)}endsWithElemSpacer(){return!1}hasLeftSquareCorner(a){return!!a.outputConnection}hasRightSquareCorner(a){return!!a.outputConnection&&!a.statementInputCount&&!a.nextConnection}},module$build$src$core$renderers$zelos$measurables$bottom_row={};module$build$src$core$renderers$zelos$measurables$bottom_row.BottomRow=BottomRow$$module$build$src$core$renderers$zelos$measurables$bottom_row;var StatementInput$$module$build$src$core$renderers$zelos$measurables$inputs=class extends StatementInput$$module$build$src$core$renderers$measurables$statement_input{constructor(a,b){super(a,b);this.connectedBottomNextConnection=!1;if(this.connectedBlock){for(a=this.connectedBlock;b=a.getNextBlock();)a=b;a.nextConnection||(this.height=this.connectedBlockHeight,this.connectedBottomNextConnection=!0)}}},module$build$src$core$renderers$zelos$measurables$inputs={};
this.sourceBlock_.workspace;a=b||!1;!a&&(MOBILE$$module$build$src$core$utils$useragent||ANDROID$$module$build$src$core$utils$useragent||IPAD$$module$build$src$core$utils$useragent)?this.showPromptEditor_():this.showInlineEditor_(a)}showPromptEditor_(){prompt$$module$build$src$core$dialog(Msg$$module$build$src$core$msg.CHANGE_VALUE_TITLE,this.getText(),a=>{null!==a&&this.setValue(this.getValueFromEditorText_(a))})}showInlineEditor_(a){const b=this.getSourceBlock();if(!b)throw new UnattachedFieldError$$module$build$src$core$field;
show$$module$build$src$core$widgetdiv(this,b.RTL,this.widgetDispose_.bind(this));this.htmlInput_=this.widgetCreate_();this.isBeingEdited_=!0;a||(this.htmlInput_.focus({preventScroll:!0}),this.htmlInput_.select())}widgetCreate_(){var a=this.getSourceBlock();if(!a)throw new UnattachedFieldError$$module$build$src$core$field;setGroup$$module$build$src$core$events$utils(!0);const b=getDiv$$module$build$src$core$widgetdiv();var c=this.getClickTarget_();if(!c)throw Error("A click target has not been set.");
addClass$$module$build$src$core$utils$dom(c,"editing");c=document.createElement("input");c.className="blocklyHtmlInput";c.setAttribute("spellcheck",this.spellcheck_);const d=this.workspace_.getScale();var e=this.getConstants().FIELD_TEXT_FONTSIZE*d+"pt";b.style.fontSize=e;c.style.fontSize=e;e=$.FieldTextInput$$module$build$src$core$field_textinput.BORDERRADIUS*d+"px";this.fullBlockClickTarget_&&(e=this.getScaledBBox(),e=(e.bottom-e.top)/2+"px",a=a.getParent()?a.getParent().style.colourTertiary:this.sourceBlock_.style.colourTertiary,
c.style.border=1*d+"px solid "+a,b.style.borderRadius=e,b.style.transition="box-shadow 0.25s ease 0s",this.getConstants().FIELD_TEXTINPUT_BOX_SHADOW&&(b.style.boxShadow="rgba(255, 255, 255, 0.3) 0 0 0 "+4*d+"px"));c.style.borderRadius=e;b.appendChild(c);c.value=c.defaultValue=this.getEditorText_(this.value_);c.setAttribute("data-untyped-default-value",this.value_);c.setAttribute("data-old-value","");this.resizeEditor_();this.bindInputEvents_(c);return c}widgetDispose_(){this.isBeingEdited_=!1;this.isTextValid_=
!0;this.forceRerender();this.onFinishEditing_(this.value_);setGroup$$module$build$src$core$events$utils(!1);this.unbindInputEvents_();var a=getDiv$$module$build$src$core$widgetdiv().style;a.width="auto";a.height="auto";a.fontSize="";a.transition="";a.boxShadow="";this.htmlInput_=null;a=this.getClickTarget_();if(!a)throw Error("A click target has not been set.");removeClass$$module$build$src$core$utils$dom(a,"editing")}onFinishEditing_(a){}bindInputEvents_(a){this.onKeyDownWrapper_=conditionalBind$$module$build$src$core$browser_events(a,
"keydown",this,this.onHtmlInputKeyDown_);this.onKeyInputWrapper_=conditionalBind$$module$build$src$core$browser_events(a,"input",this,this.onHtmlInputChange_)}unbindInputEvents_(){this.onKeyDownWrapper_&&(unbind$$module$build$src$core$browser_events(this.onKeyDownWrapper_),this.onKeyDownWrapper_=null);this.onKeyInputWrapper_&&(unbind$$module$build$src$core$browser_events(this.onKeyInputWrapper_),this.onKeyInputWrapper_=null)}onHtmlInputKeyDown_(a){a.keyCode===KeyCodes$$module$build$src$core$utils$keycodes.ENTER?
(hide$$module$build$src$core$widgetdiv(),hideWithoutAnimation$$module$build$src$core$dropdowndiv()):a.keyCode===KeyCodes$$module$build$src$core$utils$keycodes.ESC?(this.setValue(this.htmlInput_.getAttribute("data-untyped-default-value")),hide$$module$build$src$core$widgetdiv(),hideWithoutAnimation$$module$build$src$core$dropdowndiv()):a.keyCode===KeyCodes$$module$build$src$core$utils$keycodes.TAB&&(hide$$module$build$src$core$widgetdiv(),hideWithoutAnimation$$module$build$src$core$dropdowndiv(),this.sourceBlock_.tab(this,
!a.shiftKey),a.preventDefault())}onHtmlInputChange_(a){a=this.htmlInput_.value;a!==this.htmlInput_.getAttribute("data-old-value")&&(this.htmlInput_.setAttribute("data-old-value",a),a=this.getValueFromEditorText_(a),this.setValue(a),this.forceRerender(),this.resizeEditor_())}setEditorValue_(a){this.isDirty_=!0;this.isBeingEdited_&&(this.htmlInput_.value=this.getEditorText_(a));this.setValue(a)}resizeEditor_(){var a=this.getSourceBlock();if(!a)throw new UnattachedFieldError$$module$build$src$core$field;
const b=getDiv$$module$build$src$core$widgetdiv(),c=this.getScaledBBox();b.style.width=c.right-c.left+"px";b.style.height=c.bottom-c.top+"px";a=new Coordinate$$module$build$src$core$utils$coordinate(a.RTL?c.right-b.offsetWidth:c.left,c.top);b.style.left=a.x+"px";b.style.top=a.y+"px"}isTabNavigable(){return!0}getText_(){return this.isBeingEdited_&&this.htmlInput_?this.htmlInput_.value:null}getEditorText_(a){return String(a)}getValueFromEditorText_(a){return a}static fromJson(a){return new this(replaceMessageReferences$$module$build$src$core$utils$parsing(a.text),
void 0,a)}};$.FieldTextInput$$module$build$src$core$field_textinput.BORDERRADIUS=4;register$$module$build$src$core$field_registry("field_input",$.FieldTextInput$$module$build$src$core$field_textinput);$.FieldTextInput$$module$build$src$core$field_textinput.prototype.DEFAULT_VALUE="";var module$build$src$core$field_textinput={};module$build$src$core$field_textinput.FieldTextInput=$.FieldTextInput$$module$build$src$core$field_textinput;var BottomRow$$module$build$src$core$renderers$zelos$measurables$bottom_row=class extends BottomRow$$module$build$src$core$renderers$measurables$bottom_row{constructor(a){super(a)}endsWithElemSpacer(){return!1}hasLeftSquareCorner(a){return!!a.outputConnection}hasRightSquareCorner(a){return!!a.outputConnection&&!a.statementInputCount&&!a.nextConnection}},module$build$src$core$renderers$zelos$measurables$bottom_row={};module$build$src$core$renderers$zelos$measurables$bottom_row.BottomRow=BottomRow$$module$build$src$core$renderers$zelos$measurables$bottom_row;var StatementInput$$module$build$src$core$renderers$zelos$measurables$inputs=class extends StatementInput$$module$build$src$core$renderers$measurables$statement_input{constructor(a,b){super(a,b);this.connectedBottomNextConnection=!1;if(this.connectedBlock){for(a=this.connectedBlock;b=a.getNextBlock();)a=b;a.nextConnection||(this.height=this.connectedBlockHeight,this.connectedBottomNextConnection=!0)}}},module$build$src$core$renderers$zelos$measurables$inputs={};
module$build$src$core$renderers$zelos$measurables$inputs.StatementInput=StatementInput$$module$build$src$core$renderers$zelos$measurables$inputs;var RightConnectionShape$$module$build$src$core$renderers$zelos$measurables$row_elements=class extends Measurable$$module$build$src$core$renderers$measurables$base{constructor(a){super(a);this.width=this.height=0;this.type|=Types$$module$build$src$core$renderers$measurables$types.getType("RIGHT_CONNECTION")}},module$build$src$core$renderers$zelos$measurables$row_elements={};module$build$src$core$renderers$zelos$measurables$row_elements.RightConnectionShape=RightConnectionShape$$module$build$src$core$renderers$zelos$measurables$row_elements;var TopRow$$module$build$src$core$renderers$zelos$measurables$top_row=class extends TopRow$$module$build$src$core$renderers$measurables$top_row{constructor(a){super(a)}endsWithElemSpacer(){return!1}hasLeftSquareCorner(a){const b=(a.hat?"cap"===a.hat:this.constants_.ADD_START_HATS)&&!a.outputConnection&&!a.previousConnection;return!!a.outputConnection||b}hasRightSquareCorner(a){return!!a.outputConnection&&!a.statementInputCount&&!a.nextConnection}},module$build$src$core$renderers$zelos$measurables$top_row=
{};module$build$src$core$renderers$zelos$measurables$top_row.TopRow=TopRow$$module$build$src$core$renderers$zelos$measurables$top_row;var RenderInfo$$module$build$src$core$renderers$zelos$info=class extends RenderInfo$$module$build$src$core$renderers$common$info{constructor(a,b){super(a,b);this.isInline=!0;this.renderer_=a;this.constants_=this.renderer_.getConstants();this.topRow=new TopRow$$module$build$src$core$renderers$zelos$measurables$top_row(this.constants_);this.bottomRow=new BottomRow$$module$build$src$core$renderers$zelos$measurables$bottom_row(this.constants_);this.isMultiRow=!b.getInputsInline()||b.isCollapsed();this.hasStatementInput=
0<b.statementInputCount;this.rightSide=this.outputConnection?new RightConnectionShape$$module$build$src$core$renderers$zelos$measurables$row_elements(this.constants_):null;this.rightAlignedDummyInputs_=new WeakMap}getRenderer(){return this.renderer_}measure(){this.createRows_();this.addElemSpacing_();this.addRowSpacing_();this.adjustXPosition_();this.computeBounds_();this.alignRowElements_();this.finalize_()}shouldStartNewRow_(a,b){return b?a.type===inputTypes$$module$build$src$core$input_types.STATEMENT||
@@ -1364,13 +1366,14 @@ getScrollDeltaPixels$$module$build$src$core$browser_events(a);if(b=b.x||b.y){con
90+b&&a>90-b||a>-90-b&&a<-90+b?!0:!1}getClientRect(){if(!this.svgGroup_||this.autoClose||!this.isVisible())return null;const a=this.svgGroup_.getBoundingClientRect(),b=a.top;return this.toolboxPosition_===Position$$module$build$src$core$utils$toolbox.TOP?new Rect$$module$build$src$core$utils$rect(-1E9,b+a.height,-1E9,1E9):new Rect$$module$build$src$core$utils$rect(b,1E9,-1E9,1E9)}reflowInternal_(){this.workspace_.scale=this.getFlyoutScale();let a=0;const b=this.workspace_.getTopBlocks(!1);for(let d=
0,e;e=b[d];d++)a=Math.max(a,e.getHeightWidth().height);const c=this.buttons_;for(let d=0,e;e=c[d];d++)a=Math.max(a,e.height);a+=1.5*this.MARGIN;a*=this.workspace_.scale;a+=Scrollbar$$module$build$src$core$scrollbar.scrollbarThickness;if(this.height_!==a){for(let d=0,e;e=b[d];d++)this.rectMap_.has(e)&&this.moveRectToBlock_(this.rectMap_.get(e),e);this.targetWorkspace.toolboxPosition!==this.toolboxPosition_||this.toolboxPosition_!==Position$$module$build$src$core$utils$toolbox.TOP||this.targetWorkspace.getToolbox()||
this.targetWorkspace.translate(this.targetWorkspace.scrollX,this.targetWorkspace.scrollY+a);this.height_=a;this.position();this.targetWorkspace.recordDragTargets()}}};register$$module$build$src$core$registry(Type$$module$build$src$core$registry.FLYOUTS_HORIZONTAL_TOOLBOX,DEFAULT$$module$build$src$core$registry,HorizontalFlyout$$module$build$src$core$flyout_horizontal);var module$build$src$core$flyout_horizontal={};module$build$src$core$flyout_horizontal.HorizontalFlyout=HorizontalFlyout$$module$build$src$core$flyout_horizontal;var FieldVariable$$module$build$src$core$field_variable=class extends FieldDropdown$$module$build$src$core$field_dropdown{constructor(a,b,c,d,e){super(Field$$module$build$src$core$field.SKIP_SETUP);this.defaultType_="";this.variableTypes=[];this.variable_=null;this.SERIALIZABLE=!0;this.menuGenerator_=FieldVariable$$module$build$src$core$field_variable.dropdownCreate;this.defaultVariableName="string"===typeof a?a:"";this.size_=new Size$$module$build$src$core$utils$size(0,0);a!==Field$$module$build$src$core$field.SKIP_SETUP&&
(e?this.configure_(e):this.setTypes_(c,d),b&&this.setValidator(b))}configure_(a){super.configure_(a);this.setTypes_(a.variableTypes,a.defaultType)}initModel(){if(!this.variable_){var a=getOrCreateVariablePackage$$module$build$src$core$variables(this.getSourceBlock().workspace,null,this.defaultVariableName,this.defaultType_);this.doValueUpdate_(a.getId())}}shouldAddBorderRect_(){return super.shouldAddBorderRect_()&&(!this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW||"variables_get"!==this.getSourceBlock().type)}fromXml(a){var b=
a.getAttribute("id");const c=a.textContent,d=a.getAttribute("variabletype")||a.getAttribute("variableType")||"";b=getOrCreateVariablePackage$$module$build$src$core$variables(this.getSourceBlock().workspace,b,c,d);if(null!==d&&d!==b.type)throw Error("Serialized variable type with id '"+b.getId()+"' had type "+b.type+", and does not match variable field that references it: "+domToText$$module$build$src$core$xml(a)+".");this.setValue(b.getId())}toXml(a){this.initModel();a.id=this.variable_.getId();a.textContent=
this.variable_.name;this.variable_.type&&a.setAttribute("variabletype",this.variable_.type);return a}saveState(a){var b=this.saveLegacyState(FieldVariable$$module$build$src$core$field_variable);if(null!==b)return b;this.initModel();b={id:this.variable_.getId()};a&&(b.name=this.variable_.name,b.type=this.variable_.type);return b}loadState(a){this.loadLegacyState(FieldVariable$$module$build$src$core$field_variable,a)||(a=getOrCreateVariablePackage$$module$build$src$core$variables(this.getSourceBlock().workspace,
a.id||null,a.name,a.type||""),this.setValue(a.getId()))}setSourceBlock(a){if(a.isShadow())throw Error("Variable fields are not allowed to exist on shadow blocks.");super.setSourceBlock(a)}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_(a){if(null===a)return null;var b=getVariable$$module$build$src$core$variables(this.getSourceBlock().workspace,
a);if(!b)return console.warn("Variable id doesn't point to a real variable! ID was "+a),null;b=b.type;return this.typeIsAllowed_(b)?a:(console.warn("Variable type doesn't match this field! Type was "+b),null)}doValueUpdate_(a){this.variable_=getVariable$$module$build$src$core$variables(this.getSourceBlock().workspace,a);super.doValueUpdate_(a)}typeIsAllowed_(a){const b=this.getVariableTypes_();if(!b)return!0;for(let c=0;c<b.length;c++)if(a===b[c])return!0;return!1}getVariableTypes_(){var a=this.variableTypes;
if(null===a&&this.sourceBlock_&&!this.sourceBlock_.isDeadOrDying())return this.sourceBlock_.workspace.getVariableTypes();a=a||[""];if(0===a.length)throw a=this.getText(),Error("'variableTypes' of field variable "+a+" was an empty list");return a}setTypes_(a,b){b=b||"";if(null===a||void 0===a)a=null;else if(Array.isArray(a)){let c=!1;for(let d=0;d<a.length;d++)a[d]===b&&(c=!0);if(!c)throw Error("Invalid default type '"+b+"' in the definition of a FieldVariable");}else throw Error("'variableTypes' was not an array in the definition of a FieldVariable");
this.defaultType_=b;this.variableTypes=a}refreshVariableName(){this.forceRerender()}onItemSelected_(a,b){a=b.getValue();if(this.sourceBlock_&&!this.sourceBlock_.isDeadOrDying()){if(a===RENAME_VARIABLE_ID$$module$build$src$core$internal_constants){renameVariable$$module$build$src$core$variables(this.sourceBlock_.workspace,this.variable_);return}if(a===DELETE_VARIABLE_ID$$module$build$src$core$internal_constants){this.sourceBlock_.workspace.deleteVariableById(this.variable_.getId());return}}this.setValue(a)}referencesVariables(){return!0}static fromJson(a){return new this(replaceMessageReferences$$module$build$src$core$utils$parsing(a.variable),
(e?this.configure_(e):this.setTypes_(c,d),b&&this.setValidator(b))}configure_(a){super.configure_(a);this.setTypes_(a.variableTypes,a.defaultType)}initModel(){var a=this.getSourceBlock();if(!a)throw new UnattachedFieldError$$module$build$src$core$field;this.variable_||(a=getOrCreateVariablePackage$$module$build$src$core$variables(a.workspace,null,this.defaultVariableName,this.defaultType_),this.doValueUpdate_(a.getId()))}shouldAddBorderRect_(){const a=this.getSourceBlock();if(!a)throw new UnattachedFieldError$$module$build$src$core$field;
return super.shouldAddBorderRect_()&&(!this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW||"variables_get"!==a.type)}fromXml(a){var b=this.getSourceBlock();if(!b)throw new UnattachedFieldError$$module$build$src$core$field;const c=a.getAttribute("id"),d=a.textContent,e=a.getAttribute("variabletype")||a.getAttribute("variableType")||"";b=getOrCreateVariablePackage$$module$build$src$core$variables(b.workspace,c,d,e);if(null!==e&&e!==b.type)throw Error("Serialized variable type with id '"+b.getId()+
"' had type "+b.type+", and does not match variable field that references it: "+domToText$$module$build$src$core$xml(a)+".");this.setValue(b.getId())}toXml(a){this.initModel();a.id=this.variable_.getId();a.textContent=this.variable_.name;this.variable_.type&&a.setAttribute("variabletype",this.variable_.type);return a}saveState(a){var b=this.saveLegacyState(FieldVariable$$module$build$src$core$field_variable);if(null!==b)return b;this.initModel();b={id:this.variable_.getId()};a&&(b.name=this.variable_.name,
b.type=this.variable_.type);return b}loadState(a){const b=this.getSourceBlock();if(!b)throw new UnattachedFieldError$$module$build$src$core$field;this.loadLegacyState(FieldVariable$$module$build$src$core$field_variable,a)||(a=getOrCreateVariablePackage$$module$build$src$core$variables(b.workspace,a.id||null,a.name,a.type||""),this.setValue(a.getId()))}setSourceBlock(a){if(a.isShadow())throw Error("Variable fields are not allowed to exist on shadow blocks.");super.setSourceBlock(a)}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_(a){if(null===a)return null;var b=this.getSourceBlock();if(!b)throw new UnattachedFieldError$$module$build$src$core$field;b=getVariable$$module$build$src$core$variables(b.workspace,a);if(!b)return console.warn("Variable id doesn't point to a real variable! ID was "+a),null;b=b.type;return this.typeIsAllowed_(b)?
a:(console.warn("Variable type doesn't match this field! Type was "+b),null)}doValueUpdate_(a){const b=this.getSourceBlock();if(!b)throw new UnattachedFieldError$$module$build$src$core$field;this.variable_=getVariable$$module$build$src$core$variables(b.workspace,a);super.doValueUpdate_(a)}typeIsAllowed_(a){const b=this.getVariableTypes_();if(!b)return!0;for(let c=0;c<b.length;c++)if(a===b[c])return!0;return!1}getVariableTypes_(){var a=this.variableTypes;if(null===a&&this.sourceBlock_&&!this.sourceBlock_.isDeadOrDying())return this.sourceBlock_.workspace.getVariableTypes();
a=a||[""];if(0===a.length)throw a=this.getText(),Error("'variableTypes' of field variable "+a+" was an empty list");return a}setTypes_(a,b){b=b||"";if(null===a||void 0===a)a=null;else if(Array.isArray(a)){let c=!1;for(let d=0;d<a.length;d++)a[d]===b&&(c=!0);if(!c)throw Error("Invalid default type '"+b+"' in the definition of a FieldVariable");}else throw Error("'variableTypes' was not an array in the definition of a FieldVariable");this.defaultType_=b;this.variableTypes=a}refreshVariableName(){this.forceRerender()}onItemSelected_(a,
b){a=b.getValue();if(this.sourceBlock_&&!this.sourceBlock_.isDeadOrDying()){if(a===RENAME_VARIABLE_ID$$module$build$src$core$internal_constants){renameVariable$$module$build$src$core$variables(this.sourceBlock_.workspace,this.variable_);return}if(a===DELETE_VARIABLE_ID$$module$build$src$core$internal_constants){this.sourceBlock_.workspace.deleteVariableById(this.variable_.getId());return}}this.setValue(a)}referencesVariables(){return!0}static fromJson(a){return new this(replaceMessageReferences$$module$build$src$core$utils$parsing(a.variable),
void 0,void 0,void 0,a)}static dropdownCreate(){if(!this.variable_)throw Error("Tried to call dropdownCreate on a variable field with no variable selected.");const a=this.getText();let b=[];if(this.sourceBlock_&&!this.sourceBlock_.isDeadOrDying()){var c=this.getVariableTypes_();for(var d=0;d<c.length;d++){const e=this.sourceBlock_.workspace.getVariablesOfType(c[d]);b=b.concat(e)}}b.sort(VariableModel$$module$build$src$core$variable_model.compareByName);c=[];for(d=0;d<b.length;d++)c[d]=[b[d].name,
b[d].getId()];c.push([Msg$$module$build$src$core$msg.RENAME_VARIABLE,RENAME_VARIABLE_ID$$module$build$src$core$internal_constants]);Msg$$module$build$src$core$msg.DELETE_VARIABLE&&c.push([Msg$$module$build$src$core$msg.DELETE_VARIABLE.replace("%1",a),DELETE_VARIABLE_ID$$module$build$src$core$internal_constants]);return c}};register$$module$build$src$core$field_registry("field_variable",FieldVariable$$module$build$src$core$field_variable);var module$build$src$core$field_variable={};
module$build$src$core$field_variable.FieldVariable=FieldVariable$$module$build$src$core$field_variable;var FieldNumber$$module$build$src$core$field_number=class extends $.FieldTextInput$$module$build$src$core$field_textinput{constructor(a,b,c,d,e,f){super(Field$$module$build$src$core$field.SKIP_SETUP);this.min_=-Infinity;this.max_=Infinity;this.precision_=0;this.decimalPlaces_=null;this.SERIALIZABLE=!0;a!==Field$$module$build$src$core$field.SKIP_SETUP&&(f?this.configure_(f):this.setConstraints(b,c,d),this.setValue(a),e&&this.setValidator(e))}configure_(a){super.configure_(a);this.setMinInternal_(a.min);
@@ -1378,16 +1381,16 @@ this.setMaxInternal_(a.max);this.setPrecisionInternal_(a.precision)}setConstrain
(this.max_=a))}getMax(){return this.max_}setPrecision(a){this.setPrecisionInternal_(a);this.setValue(this.getValue())}setPrecisionInternal_(a){this.precision_=Number(a)||0;let b=String(this.precision_);-1!==b.indexOf("e")&&(b=this.precision_.toLocaleString("en-US",{maximumFractionDigits:20}));const c=b.indexOf(".");this.decimalPlaces_=-1===c?a?0:null:b.length-c-1}getPrecision(){return this.precision_}doClassValidation_(a){if(null===a)return null;a=String(a);a=a.replace(/O/ig,"0");a=a.replace(/,/g,
"");a=a.replace(/infinity/i,"Infinity");a=Number(a||0);if(isNaN(a))return null;a=Math.min(Math.max(a,this.min_),this.max_);this.precision_&&isFinite(a)&&(a=Math.round(a/this.precision_)*this.precision_);null!==this.decimalPlaces_&&(a=Number(a.toFixed(this.decimalPlaces_)));return a}widgetCreate_(){const a=super.widgetCreate_();-Infinity<this.min_&&setState$$module$build$src$core$utils$aria(a,State$$module$build$src$core$utils$aria.VALUEMIN,this.min_);Infinity>this.max_&&setState$$module$build$src$core$utils$aria(a,
State$$module$build$src$core$utils$aria.VALUEMAX,this.max_);return a}static fromJson(a){return new this(a.value,void 0,void 0,void 0,void 0,a)}};register$$module$build$src$core$field_registry("field_number",FieldNumber$$module$build$src$core$field_number);FieldNumber$$module$build$src$core$field_number.prototype.DEFAULT_VALUE=0;var module$build$src$core$field_number={};module$build$src$core$field_number.FieldNumber=FieldNumber$$module$build$src$core$field_number;var FieldMultilineInput$$module$build$src$core$field_multilineinput=class extends $.FieldTextInput$$module$build$src$core$field_textinput{constructor(a,b,c){super(Field$$module$build$src$core$field.SKIP_SETUP);this.textGroup_=null;this.maxLines_=Infinity;this.isOverflowedY_=!1;a!==Field$$module$build$src$core$field.SKIP_SETUP&&(c&&this.configure_(c),this.setValue(a),b&&this.setValidator(b))}configure_(a){super.configure_(a);a.maxLines&&this.setMaxLines(a.maxLines)}toXml(a){a.textContent=this.getValue().replace(/\n/g,
"&#10;");return a}fromXml(a){this.setValue(a.textContent.replace(/&#10;/g,"\n"))}saveState(){const a=this.saveLegacyState(FieldMultilineInput$$module$build$src$core$field_multilineinput);return null!==a?a:this.getValue()}loadState(a){this.loadLegacyState(Field$$module$build$src$core$field,a)||this.setValue(a)}initView(){this.createBorderRect_();this.textGroup_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.G,{"class":"blocklyEditableText"},this.fieldGroup_)}getDisplayText_(){let a=
this.getText();if(!a)return Field$$module$build$src$core$field.NBSP;const b=a.split("\n");a="";const c=this.isOverflowedY_?this.maxLines_:b.length;for(let d=0;d<c;d++){let e=b[d];e.length>this.maxDisplayLength?e=e.substring(0,this.maxDisplayLength-4)+"...":this.isOverflowedY_&&d===c-1&&(e=e.substring(0,e.length-3)+"...");e=e.replace(/\s/g,Field$$module$build$src$core$field.NBSP);a+=e;d!==c-1&&(a+="\n")}this.getSourceBlock().RTL&&(a+="\u200f");return a}doValueUpdate_(a){super.doValueUpdate_(a);this.isOverflowedY_=
this.value_.split("\n").length>this.maxLines_}render_(){for(var a;a=this.textGroup_.firstChild;)this.textGroup_.removeChild(a);a=this.getDisplayText_().split("\n");let b=0;for(let c=0;c<a.length;c++){const d=this.getConstants().FIELD_TEXT_HEIGHT+this.getConstants().FIELD_BORDER_RECT_Y_PADDING;createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.TEXT,{"class":"blocklyText blocklyMultilineText",x:this.getConstants().FIELD_BORDER_RECT_X_PADDING,y:b+this.getConstants().FIELD_BORDER_RECT_Y_PADDING,
dy:this.getConstants().FIELD_TEXT_BASELINE},this.textGroup_).appendChild(document.createTextNode(a[c]));b+=d}this.isBeingEdited_&&(a=this.htmlInput_,this.isOverflowedY_?addClass$$module$build$src$core$utils$dom(a,"blocklyHtmlTextAreaInputOverflowedY"):removeClass$$module$build$src$core$utils$dom(a,"blocklyHtmlTextAreaInputOverflowedY"));this.updateSize_();this.isBeingEdited_&&(this.getSourceBlock().RTL?setTimeout(this.resizeEditor_.bind(this),0):this.resizeEditor_(),a=this.htmlInput_,this.isTextValid_?
(removeClass$$module$build$src$core$utils$dom(a,"blocklyInvalidInput"),setState$$module$build$src$core$utils$aria(a,State$$module$build$src$core$utils$aria.INVALID,!1)):(addClass$$module$build$src$core$utils$dom(a,"blocklyInvalidInput"),setState$$module$build$src$core$utils$aria(a,State$$module$build$src$core$utils$aria.INVALID,!0)))}updateSize_(){var a=this.textGroup_.childNodes;const b=this.getConstants().FIELD_TEXT_FONTSIZE,c=this.getConstants().FIELD_TEXT_FONTWEIGHT,d=this.getConstants().FIELD_TEXT_FONTFAMILY;
let e=0,f=0;for(var g=0;g<a.length;g++){var h=getFastTextWidth$$module$build$src$core$utils$dom(a[g],b,c,d);h>e&&(e=h);f+=this.getConstants().FIELD_TEXT_HEIGHT+(0<g?this.getConstants().FIELD_BORDER_RECT_Y_PADDING:0)}if(this.isBeingEdited_){a=this.value_.split("\n");g=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.TEXT,{"class":"blocklyText blocklyMultilineText"});for(h=0;h<a.length;h++){a[h].length>this.maxDisplayLength&&(a[h]=a[h].substring(0,this.maxDisplayLength));
g.textContent=a[h];const k=getFastTextWidth$$module$build$src$core$utils$dom(g,b,c,d);k>e&&(e=k)}e+=this.htmlInput_.offsetWidth-this.htmlInput_.clientWidth}this.borderRect_&&(f+=2*this.getConstants().FIELD_BORDER_RECT_Y_PADDING,e+=2*this.getConstants().FIELD_BORDER_RECT_X_PADDING,this.borderRect_.setAttribute("width",e),this.borderRect_.setAttribute("height",f));this.size_.width=e;this.size_.height=f;this.positionBorderRect_()}showEditor_(a,b){super.showEditor_(a,b);this.forceRerender()}widgetCreate_(){const a=
getDiv$$module$build$src$core$widgetdiv(),b=this.workspace_.getScale(),c=document.createElement("textarea");c.className="blocklyHtmlInput blocklyHtmlTextAreaInput";c.setAttribute("spellcheck",this.spellcheck_);var d=this.getConstants().FIELD_TEXT_FONTSIZE*b+"pt";a.style.fontSize=d;c.style.fontSize=d;c.style.borderRadius=$.FieldTextInput$$module$build$src$core$field_textinput.BORDERRADIUS*b+"px";d=this.getConstants().FIELD_BORDER_RECT_X_PADDING*b;const e=this.getConstants().FIELD_BORDER_RECT_Y_PADDING*
b/2;c.style.padding=e+"px "+d+"px "+e+"px "+d+"px";d=this.getConstants().FIELD_TEXT_HEIGHT+this.getConstants().FIELD_BORDER_RECT_Y_PADDING;c.style.lineHeight=d*b+"px";a.appendChild(c);c.value=c.defaultValue=this.getEditorText_(this.value_);c.setAttribute("data-untyped-default-value",this.value_);c.setAttribute("data-old-value","");GECKO$$module$build$src$core$utils$useragent?setTimeout(this.resizeEditor_.bind(this),0):this.resizeEditor_();this.bindInputEvents_(c);return c}setMaxLines(a){"number"===
typeof a&&0<a&&a!==this.maxLines_&&(this.maxLines_=a,this.forceRerender())}getMaxLines(){return this.maxLines_}onHtmlInputKeyDown_(a){if(a.keyCode!==KeyCodes$$module$build$src$core$utils$keycodes.ENTER)super.onHtmlInputKeyDown_(a)}static fromJson(a){return new this(replaceMessageReferences$$module$build$src$core$utils$parsing(a.text),void 0,a)}};register$$module$build$src$core$css("\n.blocklyHtmlTextAreaInput {\n font-family: monospace;\n resize: none;\n overflow: hidden;\n height: 100%;\n text-align: left;\n}\n\n.blocklyHtmlTextAreaInputOverflowedY {\n overflow-y: scroll;\n}\n");
"&#10;");return a}fromXml(a){this.setValue(a.textContent.replace(/&#10;/g,"\n"))}saveState(){const a=this.saveLegacyState(FieldMultilineInput$$module$build$src$core$field_multilineinput);return null!==a?a:this.getValue()}loadState(a){this.loadLegacyState(Field$$module$build$src$core$field,a)||this.setValue(a)}initView(){this.createBorderRect_();this.textGroup_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.G,{"class":"blocklyEditableText"},this.fieldGroup_)}getDisplayText_(){const a=
this.getSourceBlock();if(!a)throw new UnattachedFieldError$$module$build$src$core$field;let b=this.getText();if(!b)return Field$$module$build$src$core$field.NBSP;const c=b.split("\n");b="";const d=this.isOverflowedY_?this.maxLines_:c.length;for(let e=0;e<d;e++){let f=c[e];f.length>this.maxDisplayLength?f=f.substring(0,this.maxDisplayLength-4)+"...":this.isOverflowedY_&&e===d-1&&(f=f.substring(0,f.length-3)+"...");f=f.replace(/\s/g,Field$$module$build$src$core$field.NBSP);b+=f;e!==d-1&&(b+="\n")}a.RTL&&
(b+="\u200f");return b}doValueUpdate_(a){super.doValueUpdate_(a);this.isOverflowedY_=this.value_.split("\n").length>this.maxLines_}render_(){var a=this.getSourceBlock();if(!a)throw new UnattachedFieldError$$module$build$src$core$field;for(var b;b=this.textGroup_.firstChild;)this.textGroup_.removeChild(b);b=this.getDisplayText_().split("\n");let c=0;for(let d=0;d<b.length;d++){const e=this.getConstants().FIELD_TEXT_HEIGHT+this.getConstants().FIELD_BORDER_RECT_Y_PADDING;createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.TEXT,
{"class":"blocklyText blocklyMultilineText",x:this.getConstants().FIELD_BORDER_RECT_X_PADDING,y:c+this.getConstants().FIELD_BORDER_RECT_Y_PADDING,dy:this.getConstants().FIELD_TEXT_BASELINE},this.textGroup_).appendChild(document.createTextNode(b[d]));c+=e}this.isBeingEdited_&&(b=this.htmlInput_,this.isOverflowedY_?addClass$$module$build$src$core$utils$dom(b,"blocklyHtmlTextAreaInputOverflowedY"):removeClass$$module$build$src$core$utils$dom(b,"blocklyHtmlTextAreaInputOverflowedY"));this.updateSize_();
this.isBeingEdited_&&(a.RTL?setTimeout(this.resizeEditor_.bind(this),0):this.resizeEditor_(),a=this.htmlInput_,this.isTextValid_?(removeClass$$module$build$src$core$utils$dom(a,"blocklyInvalidInput"),setState$$module$build$src$core$utils$aria(a,State$$module$build$src$core$utils$aria.INVALID,!1)):(addClass$$module$build$src$core$utils$dom(a,"blocklyInvalidInput"),setState$$module$build$src$core$utils$aria(a,State$$module$build$src$core$utils$aria.INVALID,!0)))}updateSize_(){var a=this.textGroup_.childNodes;
const b=this.getConstants().FIELD_TEXT_FONTSIZE,c=this.getConstants().FIELD_TEXT_FONTWEIGHT,d=this.getConstants().FIELD_TEXT_FONTFAMILY;let e=0,f=0;for(var g=0;g<a.length;g++){var h=getFastTextWidth$$module$build$src$core$utils$dom(a[g],b,c,d);h>e&&(e=h);f+=this.getConstants().FIELD_TEXT_HEIGHT+(0<g?this.getConstants().FIELD_BORDER_RECT_Y_PADDING:0)}if(this.isBeingEdited_){a=this.value_.split("\n");g=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.TEXT,{"class":"blocklyText blocklyMultilineText"});
for(h=0;h<a.length;h++){a[h].length>this.maxDisplayLength&&(a[h]=a[h].substring(0,this.maxDisplayLength));g.textContent=a[h];const k=getFastTextWidth$$module$build$src$core$utils$dom(g,b,c,d);k>e&&(e=k)}e+=this.htmlInput_.offsetWidth-this.htmlInput_.clientWidth}this.borderRect_&&(f+=2*this.getConstants().FIELD_BORDER_RECT_Y_PADDING,e+=2*this.getConstants().FIELD_BORDER_RECT_X_PADDING,this.borderRect_.setAttribute("width",e),this.borderRect_.setAttribute("height",f));this.size_.width=e;this.size_.height=
f;this.positionBorderRect_()}showEditor_(a,b){super.showEditor_(a,b);this.forceRerender()}widgetCreate_(){const a=getDiv$$module$build$src$core$widgetdiv(),b=this.workspace_.getScale(),c=document.createElement("textarea");c.className="blocklyHtmlInput blocklyHtmlTextAreaInput";c.setAttribute("spellcheck",this.spellcheck_);var d=this.getConstants().FIELD_TEXT_FONTSIZE*b+"pt";a.style.fontSize=d;c.style.fontSize=d;c.style.borderRadius=$.FieldTextInput$$module$build$src$core$field_textinput.BORDERRADIUS*
b+"px";d=this.getConstants().FIELD_BORDER_RECT_X_PADDING*b;const e=this.getConstants().FIELD_BORDER_RECT_Y_PADDING*b/2;c.style.padding=e+"px "+d+"px "+e+"px "+d+"px";d=this.getConstants().FIELD_TEXT_HEIGHT+this.getConstants().FIELD_BORDER_RECT_Y_PADDING;c.style.lineHeight=d*b+"px";a.appendChild(c);c.value=c.defaultValue=this.getEditorText_(this.value_);c.setAttribute("data-untyped-default-value",this.value_);c.setAttribute("data-old-value","");GECKO$$module$build$src$core$utils$useragent?setTimeout(this.resizeEditor_.bind(this),
0):this.resizeEditor_();this.bindInputEvents_(c);return c}setMaxLines(a){"number"===typeof a&&0<a&&a!==this.maxLines_&&(this.maxLines_=a,this.forceRerender())}getMaxLines(){return this.maxLines_}onHtmlInputKeyDown_(a){if(a.keyCode!==KeyCodes$$module$build$src$core$utils$keycodes.ENTER)super.onHtmlInputKeyDown_(a)}static fromJson(a){return new this(replaceMessageReferences$$module$build$src$core$utils$parsing(a.text),void 0,a)}};register$$module$build$src$core$css("\n.blocklyHtmlTextAreaInput {\n font-family: monospace;\n resize: none;\n overflow: hidden;\n height: 100%;\n text-align: left;\n}\n\n.blocklyHtmlTextAreaInputOverflowedY {\n overflow-y: scroll;\n}\n");
register$$module$build$src$core$field_registry("field_multilinetext",FieldMultilineInput$$module$build$src$core$field_multilineinput);var module$build$src$core$field_multilineinput={};module$build$src$core$field_multilineinput.FieldMultilineInput=FieldMultilineInput$$module$build$src$core$field_multilineinput;var FieldLabelSerializable$$module$build$src$core$field_label_serializable=class extends $.FieldLabel$$module$build$src$core$field_label{constructor(a,b,c){super(String(null!=a?a:""),b,c);this.EDITABLE=!1;this.SERIALIZABLE=!0}static fromJson(a){return new this(replaceMessageReferences$$module$build$src$core$utils$parsing(a.text),void 0,a)}};register$$module$build$src$core$field_registry("field_label_serializable",FieldLabelSerializable$$module$build$src$core$field_label_serializable);
var module$build$src$core$field_label_serializable={};module$build$src$core$field_label_serializable.FieldLabelSerializable=FieldLabelSerializable$$module$build$src$core$field_label_serializable;var FieldColour$$module$build$src$core$field_colour=class extends Field$$module$build$src$core$field{constructor(a,b,c){super(Field$$module$build$src$core$field.SKIP_SETUP);this.onKeyDownWrapper_=this.onMouseLeaveWrapper_=this.onMouseEnterWrapper_=this.onMouseMoveWrapper_=this.onClickWrapper_=this.highlightedIndex_=this.picker_=null;this.SERIALIZABLE=!0;this.CURSOR="default";this.isDirty_=!1;this.titles_=this.colours_=null;this.columns_=0;a!==Field$$module$build$src$core$field.SKIP_SETUP&&(c&&this.configure_(c),
this.setValue(a),b&&this.setValidator(b))}configure_(a){super.configure_(a);a.colourOptions&&(this.colours_=a.colourOptions);a.colourTitles&&(this.titles_=a.colourTitles);a.columns&&(this.columns_=a.columns)}initView(){this.size_=new Size$$module$build$src$core$utils$size(this.getConstants().FIELD_COLOUR_DEFAULT_WIDTH,this.getConstants().FIELD_COLOUR_DEFAULT_HEIGHT);this.getConstants().FIELD_COLOUR_FULL_BLOCK?this.sourceBlock_ instanceof BlockSvg$$module$build$src$core$block_svg&&(this.clickTarget_=
@@ -1420,9 +1423,9 @@ transform:"rotate("+c+","+FieldAngle$$module$build$src$core$field_angle.HALF+","
this.gauge_.ownerSVGElement.getBoundingClientRect();const c=a.clientX-b.left-FieldAngle$$module$build$src$core$field_angle.HALF;a=a.clientY-b.top-FieldAngle$$module$build$src$core$field_angle.HALF;b=Math.atan(-a/c);isNaN(b)||(b=toDegrees$$module$build$src$core$utils$math(b),0>c?b+=180:0<a&&(b+=360),b=this.clockwise_?this.offset_+360-b:360-(this.offset_-b),this.displayMouseOrKeyboardValue_(b))}displayMouseOrKeyboardValue_(a){this.round_&&(a=Math.round(a/this.round_)*this.round_);a=this.wrapValue_(a);
a!==this.value_&&this.setEditorValue_(a)}updateGraph_(){if(this.gauge_){var a=Number(this.getText())+this.offset_,b=toRadians$$module$build$src$core$utils$math(a%360);a=["M ",FieldAngle$$module$build$src$core$field_angle.HALF,",",FieldAngle$$module$build$src$core$field_angle.HALF];var c=FieldAngle$$module$build$src$core$field_angle.HALF,d=FieldAngle$$module$build$src$core$field_angle.HALF;if(!isNaN(b)){const e=Number(this.clockwise_),f=toRadians$$module$build$src$core$utils$math(this.offset_),g=Math.cos(f)*
FieldAngle$$module$build$src$core$field_angle.RADIUS,h=Math.sin(f)*-FieldAngle$$module$build$src$core$field_angle.RADIUS;e&&(b=2*f-b);c+=Math.cos(b)*FieldAngle$$module$build$src$core$field_angle.RADIUS;d-=Math.sin(b)*FieldAngle$$module$build$src$core$field_angle.RADIUS;b=Math.abs(Math.floor((b-f)/Math.PI)%2);e&&(b=1-b);a.push(" l ",g,",",h," A ",FieldAngle$$module$build$src$core$field_angle.RADIUS,",",FieldAngle$$module$build$src$core$field_angle.RADIUS," 0 ",b," ",e," ",c,",",d," z")}this.gauge_.setAttribute("d",
a.join(""));this.line_.setAttribute("x2",c);this.line_.setAttribute("y2",d)}}onHtmlInputKeyDown_(a){super.onHtmlInputKeyDown_(a);let b;a.keyCode===KeyCodes$$module$build$src$core$utils$keycodes.LEFT?b=this.getSourceBlock().RTL?1:-1:a.keyCode===KeyCodes$$module$build$src$core$utils$keycodes.RIGHT?b=this.getSourceBlock().RTL?-1:1:a.keyCode===KeyCodes$$module$build$src$core$utils$keycodes.DOWN?b=-1:a.keyCode===KeyCodes$$module$build$src$core$utils$keycodes.UP&&(b=1);if(b){const c=this.getValue();this.displayMouseOrKeyboardValue_(c+
b*this.round_);a.preventDefault();a.stopPropagation()}}doClassValidation_(a){a=Number(a);return isNaN(a)||!isFinite(a)?null:this.wrapValue_(a)}wrapValue_(a){a%=360;0>a&&(a+=360);a>this.wrap_&&(a-=360);return a}static fromJson(a){return new this(a.angle,void 0,a)}};FieldAngle$$module$build$src$core$field_angle.ROUND=15;FieldAngle$$module$build$src$core$field_angle.HALF=50;FieldAngle$$module$build$src$core$field_angle.CLOCKWISE=!1;FieldAngle$$module$build$src$core$field_angle.OFFSET=0;
FieldAngle$$module$build$src$core$field_angle.WRAP=360;FieldAngle$$module$build$src$core$field_angle.RADIUS=FieldAngle$$module$build$src$core$field_angle.HALF-1;register$$module$build$src$core$css("\n.blocklyAngleCircle {\n stroke: #444;\n stroke-width: 1;\n fill: #ddd;\n fill-opacity: .8;\n}\n\n.blocklyAngleMarks {\n stroke: #444;\n stroke-width: 1;\n}\n\n.blocklyAngleGauge {\n fill: #f88;\n fill-opacity: .8;\n pointer-events: none;\n}\n\n.blocklyAngleLine {\n stroke: #f00;\n stroke-width: 2;\n stroke-linecap: round;\n pointer-events: none;\n}\n");
a.join(""));this.line_.setAttribute("x2",c);this.line_.setAttribute("y2",d)}}onHtmlInputKeyDown_(a){super.onHtmlInputKeyDown_(a);var b=this.getSourceBlock();if(!b)throw new UnattachedFieldError$$module$build$src$core$field;let c;a.keyCode===KeyCodes$$module$build$src$core$utils$keycodes.LEFT?c=b.RTL?1:-1:a.keyCode===KeyCodes$$module$build$src$core$utils$keycodes.RIGHT?c=b.RTL?-1:1:a.keyCode===KeyCodes$$module$build$src$core$utils$keycodes.DOWN?c=-1:a.keyCode===KeyCodes$$module$build$src$core$utils$keycodes.UP&&
(c=1);c&&(b=this.getValue(),this.displayMouseOrKeyboardValue_(b+c*this.round_),a.preventDefault(),a.stopPropagation())}doClassValidation_(a){a=Number(a);return isNaN(a)||!isFinite(a)?null:this.wrapValue_(a)}wrapValue_(a){a%=360;0>a&&(a+=360);a>this.wrap_&&(a-=360);return a}static fromJson(a){return new this(a.angle,void 0,a)}};FieldAngle$$module$build$src$core$field_angle.ROUND=15;FieldAngle$$module$build$src$core$field_angle.HALF=50;FieldAngle$$module$build$src$core$field_angle.CLOCKWISE=!1;
FieldAngle$$module$build$src$core$field_angle.OFFSET=0;FieldAngle$$module$build$src$core$field_angle.WRAP=360;FieldAngle$$module$build$src$core$field_angle.RADIUS=FieldAngle$$module$build$src$core$field_angle.HALF-1;register$$module$build$src$core$css("\n.blocklyAngleCircle {\n stroke: #444;\n stroke-width: 1;\n fill: #ddd;\n fill-opacity: .8;\n}\n\n.blocklyAngleMarks {\n stroke: #444;\n stroke-width: 1;\n}\n\n.blocklyAngleGauge {\n fill: #f88;\n fill-opacity: .8;\n pointer-events: none;\n}\n\n.blocklyAngleLine {\n stroke: #f00;\n stroke-width: 2;\n stroke-linecap: round;\n pointer-events: none;\n}\n");
register$$module$build$src$core$field_registry("field_angle",FieldAngle$$module$build$src$core$field_angle);FieldAngle$$module$build$src$core$field_angle.prototype.DEFAULT_VALUE=0;var Mode$$module$build$src$core$field_angle;(function(a){a.COMPASS="compass";a.PROTRACTOR="protractor"})(Mode$$module$build$src$core$field_angle||(Mode$$module$build$src$core$field_angle={}));var module$build$src$core$field_angle={};module$build$src$core$field_angle.FieldAngle=FieldAngle$$module$build$src$core$field_angle;
module$build$src$core$field_angle.Mode=Mode$$module$build$src$core$field_angle;var BlockMove$$module$build$src$core$events$events_block_move=class extends BlockBase$$module$build$src$core$events$events_block_base{constructor(a){super(a);this.type=MOVE$$module$build$src$core$events$utils;a&&(a.isShadow()&&(this.recordUndo=!1),a=this.currentLocation_(),this.oldParentId=a.parentId,this.oldInputName=a.inputName,this.oldCoordinate=a.coordinate)}toJson(){const a=super.toJson();a.newParentId=this.newParentId;a.newInputName=this.newInputName;this.newCoordinate&&(a.newCoordinate=`${Math.round(this.newCoordinate.x)}, `+
`${Math.round(this.newCoordinate.y)}`);this.recordUndo||(a.recordUndo=this.recordUndo);return a}fromJson(a){super.fromJson(a);this.newParentId=a.newParentId;this.newInputName=a.newInputName;if(a.newCoordinate){const b=a.newCoordinate.split(",");this.newCoordinate=new Coordinate$$module$build$src$core$utils$coordinate(Number(b[0]),Number(b[1]))}void 0!==a.recordUndo&&(this.recordUndo=a.recordUndo)}recordNew(){const a=this.currentLocation_();this.newParentId=a.parentId;this.newInputName=a.inputName;
@@ -1482,7 +1485,7 @@ this.pixelsToWorkspaceUnits_(a);const b=Coordinate$$module$build$src$core$utils$
this.draggingBlock_.render();this.draggingBlock_.scheduleSnapAndBump()}fireDragEndEvent_(){const a=new (get$$module$build$src$core$events$utils(BLOCK_DRAG$$module$build$src$core$events$utils))(this.draggingBlock_,!1,this.draggingBlock_.getDescendants(!1));fire$$module$build$src$core$events$utils(a)}updateToolboxStyle_(a){const b=this.workspace_.getToolbox();if(b){const c=this.draggingBlock_.isDeletable()?"blocklyToolboxDelete":"blocklyToolboxGrab";a&&"function"===typeof b.removeStyle?b.removeStyle(c):
a||"function"!==typeof b.addStyle||b.addStyle(c)}}fireMoveEvent_(){const a=new (get$$module$build$src$core$events$utils(MOVE$$module$build$src$core$events$utils))(this.draggingBlock_);a.oldCoordinate=this.startXY_;a.recordNew();fire$$module$build$src$core$events$utils(a)}updateCursorDuringBlockDrag_(){this.draggingBlock_.setDeleteStyle(this.wouldDeleteBlock_)}pixelsToWorkspaceUnits_(a){a=new Coordinate$$module$build$src$core$utils$coordinate(a.x/this.workspace_.scale,a.y/this.workspace_.scale);this.workspace_.isMutator&&
a.scale(1/this.workspace_.options.parentWorkspace.scale);return a}dragIcons_(a){for(let b=0;b<this.dragIconData_.length;b++){const c=this.dragIconData_[b];c.icon.setIconLocation(Coordinate$$module$build$src$core$utils$coordinate.sum(c.location,a))}}getInsertionMarkers(){return this.draggedConnectionManager_&&this.draggedConnectionManager_.getInsertionMarkers?this.draggedConnectionManager_.getInsertionMarkers():[]}};
register$$module$build$src$core$registry(Type$$module$build$src$core$registry.BLOCK_DRAGGER,DEFAULT$$module$build$src$core$registry,BlockDragger$$module$build$src$core$block_dragger);var module$build$src$core$block_dragger={};module$build$src$core$block_dragger.BlockDragger=BlockDragger$$module$build$src$core$block_dragger;var VERSION$$module$build$src$core$blockly="9.20221004.0",ALIGN_LEFT$$module$build$src$core$blockly=$.Align$$module$build$src$core$input.LEFT,ALIGN_CENTRE$$module$build$src$core$blockly=$.Align$$module$build$src$core$input.CENTRE,ALIGN_RIGHT$$module$build$src$core$blockly=$.Align$$module$build$src$core$input.RIGHT,INPUT_VALUE$$module$build$src$core$blockly=ConnectionType$$module$build$src$core$connection_type.INPUT_VALUE,OUTPUT_VALUE$$module$build$src$core$blockly=ConnectionType$$module$build$src$core$connection_type.OUTPUT_VALUE,
register$$module$build$src$core$registry(Type$$module$build$src$core$registry.BLOCK_DRAGGER,DEFAULT$$module$build$src$core$registry,BlockDragger$$module$build$src$core$block_dragger);var module$build$src$core$block_dragger={};module$build$src$core$block_dragger.BlockDragger=BlockDragger$$module$build$src$core$block_dragger;var VERSION$$module$build$src$core$blockly="9.0.1",ALIGN_LEFT$$module$build$src$core$blockly=$.Align$$module$build$src$core$input.LEFT,ALIGN_CENTRE$$module$build$src$core$blockly=$.Align$$module$build$src$core$input.CENTRE,ALIGN_RIGHT$$module$build$src$core$blockly=$.Align$$module$build$src$core$input.RIGHT,INPUT_VALUE$$module$build$src$core$blockly=ConnectionType$$module$build$src$core$connection_type.INPUT_VALUE,OUTPUT_VALUE$$module$build$src$core$blockly=ConnectionType$$module$build$src$core$connection_type.OUTPUT_VALUE,
NEXT_STATEMENT$$module$build$src$core$blockly=ConnectionType$$module$build$src$core$connection_type.NEXT_STATEMENT,PREVIOUS_STATEMENT$$module$build$src$core$blockly=ConnectionType$$module$build$src$core$connection_type.PREVIOUS_STATEMENT,DUMMY_INPUT$$module$build$src$core$blockly=inputTypes$$module$build$src$core$input_types.DUMMY,TOOLBOX_AT_TOP$$module$build$src$core$blockly=Position$$module$build$src$core$utils$toolbox.TOP,TOOLBOX_AT_BOTTOM$$module$build$src$core$blockly=Position$$module$build$src$core$utils$toolbox.BOTTOM,
TOOLBOX_AT_LEFT$$module$build$src$core$blockly=Position$$module$build$src$core$utils$toolbox.LEFT,TOOLBOX_AT_RIGHT$$module$build$src$core$blockly=Position$$module$build$src$core$utils$toolbox.RIGHT,svgResize$$module$build$src$core$blockly=svgResize$$module$build$src$core$common,getMainWorkspace$$module$build$src$core$blockly=getMainWorkspace$$module$build$src$core$common,getSelected$$module$build$src$core$blockly=getSelected$$module$build$src$core$common,defineBlocksWithJsonArray$$module$build$src$core$blockly=
defineBlocksWithJsonArray$$module$build$src$core$common,setParentContainer$$module$build$src$core$blockly=setParentContainer$$module$build$src$core$common,resizeSvgContents$$module$build$src$core$blockly=resizeSvgContentsLocal$$module$build$src$core$blockly,COLLAPSE_CHARS$$module$build$src$core$blockly=COLLAPSE_CHARS$$module$build$src$core$internal_constants,DRAG_STACK$$module$build$src$core$blockly=DRAG_STACK$$module$build$src$core$internal_constants,OPPOSITE_TYPE$$module$build$src$core$blockly=

File diff suppressed because one or more lines are too long

View File

@@ -188,7 +188,11 @@ function disconnectUiStep(group: SVGElement, magnitude: number, start: Date) {
skew = `skewX(${val})`;
disconnectPid = setTimeout(disconnectUiStep, 10, group, magnitude, start);
}
group.setAttribute('transform', skew);
(group as AnyDuringMigration).skew_ = skew;
group.setAttribute(
'transform',
(group as AnyDuringMigration).translate_ +
(group as AnyDuringMigration).skew_);
}
/**
@@ -202,7 +206,9 @@ export function disconnectUiStop() {
if (disconnectPid) {
clearTimeout(disconnectPid);
}
disconnectGroup.setAttribute('transform', '');
const group = disconnectGroup;
(group as AnyDuringMigration).skew_ = '';
group.setAttribute('transform', (group as AnyDuringMigration).translate_);
disconnectGroup = null;
}
}

View File

@@ -255,10 +255,7 @@ export abstract class Field implements IASTNodeLocationSvg,
* @returns The block containing this field.
* @throws An error if the source block is not defined.
*/
getSourceBlock(): Block {
if (!this.sourceBlock_) {
throw new Error(`The source block is ${this.sourceBlock_}.`);
}
getSourceBlock(): Block|null {
return this.sourceBlock_;
}
@@ -476,10 +473,11 @@ export abstract class Field implements IASTNodeLocationSvg,
/** Add or remove the UI indicating if this field is editable or not. */
updateEditable() {
const group = this.fieldGroup_;
if (!this.EDITABLE || !group) {
const block = this.getSourceBlock();
if (!this.EDITABLE || !group || !block) {
return;
}
if (this.enabled_ && this.getSourceBlock().isEditable()) {
if (this.enabled_ && block.isEditable()) {
dom.addClass(group, 'blocklyEditableText');
dom.removeClass(group, 'blocklyNonEditableText');
group.style.cursor = this.CURSOR;
@@ -756,7 +754,7 @@ export abstract class Field implements IASTNodeLocationSvg,
this.textElement_.setAttribute(
'x',
`${
this.getSourceBlock().RTL ?
this.getSourceBlock()?.RTL ?
this.size_.width - contentWidth - xOffset :
xOffset}`);
this.textElement_.setAttribute(
@@ -819,12 +817,17 @@ export abstract class Field implements IASTNodeLocationSvg,
let scaledWidth;
let scaledHeight;
let xy;
const block = this.getSourceBlock();
if (!block) {
throw new UnattachedFieldError();
}
if (!this.borderRect_) {
// Browsers are inconsistent in what they return for a bounding box.
// - Webkit / Blink: fill-box / object bounding box
// - Gecko: stroke-box
const bBox = (this.sourceBlock_ as BlockSvg).getHeightWidth();
const scale = (this.getSourceBlock().workspace as WorkspaceSvg).scale;
const scale = (block.workspace as WorkspaceSvg).scale;
xy = this.getAbsoluteXY_();
scaledWidth = (bBox.width + 1) * scale;
scaledHeight = (bBox.height + 1) * scale;
@@ -1158,6 +1161,9 @@ export abstract class Field implements IASTNodeLocationSvg,
getParentInput(): Input {
let parentInput = null;
const block = this.getSourceBlock();
if (!block) {
throw new UnattachedFieldError();
}
const inputs = block.inputList;
for (let idx = 0; idx < block.inputList.length; idx++) {
@@ -1241,7 +1247,11 @@ export abstract class Field implements IASTNodeLocationSvg,
/** Redraw any attached marker or cursor svgs if needed. */
protected updateMarkers_() {
const workspace = this.getSourceBlock().workspace as WorkspaceSvg;
const block = this.getSourceBlock();
if (!block) {
throw new UnattachedFieldError();
}
const workspace = block.workspace as WorkspaceSvg;
if (workspace.keyboardAccessibilityMode && this.cursorSvg_) {
workspace.getCursor()!.draw();
}
@@ -1264,3 +1274,17 @@ export interface FieldConfig {
* in descendants, though they should contain all of Field's prototype methods.
*/
export type FieldProto = Pick<typeof Field, 'prototype'>;
/**
* Represents an error where the field is trying to access its block or
* information about its block before it has actually been attached to said
* block.
*/
export class UnattachedFieldError extends Error {
/** @internal */
constructor() {
super(
'The field has not yet been attached to its input. ' +
'Call appendField to attach it.');
}
}

View File

@@ -16,7 +16,7 @@ import {BlockSvg} from './block_svg.js';
import * as browserEvents from './browser_events.js';
import * as Css from './css.js';
import * as dropDownDiv from './dropdowndiv.js';
import {Field} from './field.js';
import {Field, UnattachedFieldError} from './field.js';
import * as fieldRegistry from './field_registry.js';
import {FieldTextInputConfig, FieldTextInput} from './field_textinput.js';
import * as dom from './utils/dom.js';
@@ -430,18 +430,22 @@ export class FieldAngle extends FieldTextInput {
*/
protected override onHtmlInputKeyDown_(e: Event) {
super.onHtmlInputKeyDown_(e);
const block = this.getSourceBlock();
if (!block) {
throw new UnattachedFieldError();
}
let multiplier;
// AnyDuringMigration because: Property 'keyCode' does not exist on type
// 'Event'.
if ((e as AnyDuringMigration).keyCode === KeyCodes.LEFT) {
// decrement (increment in RTL)
multiplier = this.getSourceBlock().RTL ? 1 : -1;
multiplier = block.RTL ? 1 : -1;
// AnyDuringMigration because: Property 'keyCode' does not exist on type
// 'Event'.
} else if ((e as AnyDuringMigration).keyCode === KeyCodes.RIGHT) {
// increment (decrement in RTL)
multiplier = this.getSourceBlock().RTL ? -1 : 1;
multiplier = block.RTL ? -1 : 1;
// AnyDuringMigration because: Property 'keyCode' does not exist on type
// 'Event'.
} else if ((e as AnyDuringMigration).keyCode === KeyCodes.DOWN) {

View File

@@ -16,7 +16,7 @@ goog.declareModuleId('Blockly.FieldDropdown');
import type {BlockSvg} from './block_svg.js';
import * as dropDownDiv from './dropdowndiv.js';
import {FieldConfig, Field} from './field.js';
import {FieldConfig, Field, UnattachedFieldError} from './field.js';
import * as fieldRegistry from './field_registry.js';
import {Menu} from './menu.js';
import {MenuItem} from './menuitem.js';
@@ -217,16 +217,16 @@ export class FieldDropdown extends Field {
protected shouldAddBorderRect_(): boolean {
return !this.getConstants()!.FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW ||
this.getConstants()!.FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW &&
!this.getSourceBlock().isShadow();
!this.getSourceBlock()?.isShadow();
}
/** Create a tspan based arrow. */
protected createTextArrow_() {
this.arrow_ = dom.createSvgElement(Svg.TSPAN, {}, this.textElement_);
this.arrow_!.appendChild(document.createTextNode(
this.getSourceBlock().RTL ? FieldDropdown.ARROW_CHAR + ' ' :
' ' + FieldDropdown.ARROW_CHAR));
if (this.getSourceBlock().RTL) {
this.getSourceBlock()?.RTL ? FieldDropdown.ARROW_CHAR + ' ' :
' ' + FieldDropdown.ARROW_CHAR));
if (this.getSourceBlock()?.RTL) {
// AnyDuringMigration because: Argument of type 'SVGTSpanElement | null'
// is not assignable to parameter of type 'Node'.
this.getTextElement().insertBefore(
@@ -258,6 +258,10 @@ export class FieldDropdown extends Field {
* undefined if triggered programmatically.
*/
protected override showEditor_(opt_e?: Event) {
const block = this.getSourceBlock();
if (!block) {
throw new UnattachedFieldError();
}
this.dropdownCreate_();
// AnyDuringMigration because: Property 'clientX' does not exist on type
// 'Event'.
@@ -279,11 +283,10 @@ export class FieldDropdown extends Field {
dom.addClass(menuElement, 'blocklyDropdownMenu');
if (this.getConstants()!.FIELD_DROPDOWN_COLOURED_DIV) {
const primaryColour = this.getSourceBlock().isShadow() ?
this.getSourceBlock().getParent()!.getColour() :
this.getSourceBlock().getColour();
const borderColour = this.getSourceBlock().isShadow() ?
(this.getSourceBlock().getParent() as BlockSvg).style.colourTertiary :
const primaryColour =
block.isShadow() ? block.getParent()!.getColour() : block.getColour();
const borderColour = block.isShadow() ?
(block.getParent() as BlockSvg).style.colourTertiary :
(this.sourceBlock_ as BlockSvg).style.colourTertiary;
if (!borderColour) {
throw new Error(
@@ -308,6 +311,10 @@ export class FieldDropdown extends Field {
/** Create the dropdown editor. */
private dropdownCreate_() {
const block = this.getSourceBlock();
if (!block) {
throw new UnattachedFieldError();
}
const menu = new Menu();
menu.setRole(aria.Role.LISTBOX);
this.menu_ = menu;
@@ -326,7 +333,7 @@ export class FieldDropdown extends Field {
}
const menuItem = new MenuItem(content, value);
menuItem.setRole(aria.Role.OPTION);
menuItem.setRightToLeft(this.getSourceBlock().RTL);
menuItem.setRightToLeft(block.RTL);
menuItem.setCheckable(true);
menu.addChild(menuItem);
menuItem.setChecked(value === this.value_);
@@ -552,6 +559,10 @@ export class FieldDropdown extends Field {
* @param imageJson Selected option that must be an image.
*/
private renderSelectedImage_(imageJson: ImageProperties) {
const block = this.getSourceBlock();
if (!block) {
throw new UnattachedFieldError();
}
this.imageElement_!.style.display = '';
this.imageElement_!.setAttributeNS(
dom.XLINK_NS, 'xlink:href', imageJson.src);
@@ -590,7 +601,7 @@ export class FieldDropdown extends Field {
this.size_.height = height;
let arrowX = 0;
if (this.getSourceBlock().RTL) {
if (block.RTL) {
const imageX = xPadding + arrowWidth;
this.imageElement_!.setAttribute('x', imageX.toString());
} else {
@@ -646,12 +657,16 @@ export class FieldDropdown extends Field {
if (!this.svgArrow_) {
return 0;
}
const block = this.getSourceBlock();
if (!block) {
throw new UnattachedFieldError();
}
const hasBorder = !!this.borderRect_;
const xPadding =
hasBorder ? this.getConstants()!.FIELD_BORDER_RECT_X_PADDING : 0;
const textPadding = this.getConstants()!.FIELD_DROPDOWN_SVG_ARROW_PADDING;
const svgArrowSize = this.getConstants()!.FIELD_DROPDOWN_SVG_ARROW_SIZE;
const arrowX = this.getSourceBlock().RTL ? xPadding : x + textPadding;
const arrowX = block.RTL ? xPadding : x + textPadding;
this.svgArrow_.setAttribute(
'transform', 'translate(' + arrowX + ',' + y + ')');
return svgArrowSize + textPadding;

View File

@@ -13,7 +13,7 @@ import * as goog from '../closure/goog/goog.js';
goog.declareModuleId('Blockly.FieldMultilineInput');
import * as Css from './css.js';
import {Field} from './field.js';
import {Field, UnattachedFieldError} from './field.js';
import * as fieldRegistry from './field_registry.js';
import {FieldTextInputConfig, FieldTextInput} from './field_textinput.js';
import * as aria from './utils/aria.js';
@@ -163,6 +163,10 @@ export class FieldMultilineInput extends FieldTextInput {
* @returns Currently displayed text.
*/
protected override getDisplayText_(): string {
const block = this.getSourceBlock();
if (!block) {
throw new UnattachedFieldError();
}
let textLines = this.getText();
if (!textLines) {
// Prevent the field from disappearing if empty.
@@ -189,7 +193,7 @@ export class FieldMultilineInput extends FieldTextInput {
textLines += '\n';
}
}
if (this.getSourceBlock().RTL) {
if (block.RTL) {
// The SVG is LTR, force value to be RTL.
textLines += '\u200F';
}
@@ -212,6 +216,10 @@ export class FieldMultilineInput extends FieldTextInput {
/** Updates the text of the textElement. */
protected override render_() {
const block = this.getSourceBlock();
if (!block) {
throw new UnattachedFieldError();
}
// Remove all text group children.
let currentChild;
while (currentChild = this.textGroup_.firstChild) {
@@ -248,7 +256,7 @@ export class FieldMultilineInput extends FieldTextInput {
this.updateSize_();
if (this.isBeingEdited_) {
if (this.getSourceBlock().RTL) {
if (block.RTL) {
// in RTL, we need to let the browser reflow before resizing
// in order to get the correct bounding box of the borderRect
// avoiding issue #2777.

View File

@@ -21,7 +21,7 @@ import * as dialog from './dialog.js';
import * as dom from './utils/dom.js';
import * as dropDownDiv from './dropdowndiv.js';
import * as eventUtils from './events/utils.js';
import {FieldConfig, Field} from './field.js';
import {FieldConfig, Field, UnattachedFieldError} from './field.js';
import * as fieldRegistry from './field_registry.js';
import {Msg} from './msg.js';
import * as aria from './utils/aria.js';
@@ -127,13 +127,17 @@ export class FieldTextInput extends Field {
/** @internal */
override initView() {
const block = this.getSourceBlock();
if (!block) {
throw new UnattachedFieldError();
}
if (this.getConstants()!.FULL_BLOCK_FIELDS) {
// Step one: figure out if this is the only field on this block.
// Rendering is quite different in that case.
let nFields = 0;
let nConnections = 0;
// Count the number of fields, excluding text fields
for (let i = 0, input; input = this.getSourceBlock().inputList[i]; i++) {
for (let i = 0, input; input = block.inputList[i]; i++) {
for (let j = 0; input.fieldRow[j]; j++) {
nFields++;
}
@@ -143,8 +147,8 @@ export class FieldTextInput extends Field {
}
// The special case is when this is the only non-label field on the block
// and it has an output but no inputs.
this.fullBlockClickTarget_ = nFields <= 1 &&
this.getSourceBlock().outputConnection && !nConnections;
this.fullBlockClickTarget_ =
nFields <= 1 && block.outputConnection && !nConnections;
} else {
this.fullBlockClickTarget_ = false;
}
@@ -311,8 +315,11 @@ export class FieldTextInput extends Field {
* @param quietInput True if editor should be created without focus.
*/
private showInlineEditor_(quietInput: boolean) {
WidgetDiv.show(
this, this.getSourceBlock().RTL, this.widgetDispose_.bind(this));
const block = this.getSourceBlock();
if (!block) {
throw new UnattachedFieldError();
}
WidgetDiv.show(this, block.RTL, this.widgetDispose_.bind(this));
this.htmlInput_ = this.widgetCreate_() as HTMLInputElement;
this.isBeingEdited_ = true;
@@ -330,6 +337,10 @@ export class FieldTextInput extends Field {
* @returns The newly created text input editor.
*/
protected widgetCreate_(): HTMLElement {
const block = this.getSourceBlock();
if (!block) {
throw new UnattachedFieldError();
}
eventUtils.setGroup(true);
const div = WidgetDiv.getDiv();
@@ -355,8 +366,8 @@ export class FieldTextInput extends Field {
// Override border radius.
borderRadius = (bBox.bottom - bBox.top) / 2 + 'px';
// Pull stroke colour from the existing shadow block
const strokeColour = this.getSourceBlock().getParent() ?
(this.getSourceBlock().getParent() as BlockSvg).style.colourTertiary :
const strokeColour = block.getParent() ?
(block.getParent() as BlockSvg).style.colourTertiary :
(this.sourceBlock_ as BlockSvg).style.colourTertiary;
htmlInput.style.border = 1 * scale + 'px solid ' + strokeColour;
div!.style.borderRadius = borderRadius;
@@ -514,6 +525,10 @@ export class FieldTextInput extends Field {
/** Resize the editor to fit the text. */
protected resizeEditor_() {
const block = this.getSourceBlock();
if (!block) {
throw new UnattachedFieldError();
}
const div = WidgetDiv.getDiv();
const bBox = this.getScaledBBox();
div!.style.width = bBox.right - bBox.left + 'px';
@@ -521,8 +536,7 @@ export class FieldTextInput extends Field {
// In RTL mode block fields and LTR input fields the left edge moves,
// whereas the right edge is fixed. Reposition the editor.
const x =
this.getSourceBlock().RTL ? bBox.right - div!.offsetWidth : bBox.left;
const x = block.RTL ? bBox.right - div!.offsetWidth : bBox.left;
const xy = new Coordinate(x, bBox.top);
div!.style.left = xy.x + 'px';

View File

@@ -16,7 +16,7 @@ goog.declareModuleId('Blockly.FieldVariable');
import './events/events_block_change.js';
import type {Block} from './block.js';
import {Field, FieldConfig} from './field.js';
import {Field, FieldConfig, UnattachedFieldError} from './field.js';
import {FieldDropdown} from './field_dropdown.js';
import * as fieldRegistry from './field_registry.js';
import * as internalConstants from './internal_constants.js';
@@ -135,20 +135,27 @@ export class FieldVariable extends FieldDropdown {
* @internal
*/
override initModel() {
const block = this.getSourceBlock();
if (!block) {
throw new UnattachedFieldError();
}
if (this.variable_) {
return; // Initialization already happened.
}
const variable = Variables.getOrCreateVariablePackage(
this.getSourceBlock().workspace, null, this.defaultVariableName,
this.defaultType_);
block.workspace, null, this.defaultVariableName, this.defaultType_);
// Don't call setValue because we don't want to cause a rerender.
this.doValueUpdate_(variable.getId());
}
override shouldAddBorderRect_() {
const block = this.getSourceBlock();
if (!block) {
throw new UnattachedFieldError();
}
return super.shouldAddBorderRect_() &&
(!this.getConstants()!.FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW ||
this.getSourceBlock().type !== 'variables_get');
block.type !== 'variables_get');
}
/**
@@ -158,6 +165,10 @@ export class FieldVariable extends FieldDropdown {
* field's state.
*/
override fromXml(fieldElement: Element) {
const block = this.getSourceBlock();
if (!block) {
throw new UnattachedFieldError();
}
const id = fieldElement.getAttribute('id');
const variableName = fieldElement.textContent;
// 'variabletype' should be lowercase, but until July 2019 it was sometimes
@@ -168,8 +179,7 @@ export class FieldVariable extends FieldDropdown {
// AnyDuringMigration because: Argument of type 'string | null' is not
// assignable to parameter of type 'string | undefined'.
const variable = Variables.getOrCreateVariablePackage(
this.getSourceBlock().workspace, id, variableName as AnyDuringMigration,
variableType);
block.workspace, id, variableName as AnyDuringMigration, variableType);
// This should never happen :)
if (variableType !== null && variableType !== variable.type) {
@@ -233,12 +243,16 @@ export class FieldVariable extends FieldDropdown {
* @internal
*/
override loadState(state: AnyDuringMigration) {
const block = this.getSourceBlock();
if (!block) {
throw new UnattachedFieldError();
}
if (this.loadLegacyState(FieldVariable, state)) {
return;
}
// This is necessary so that blocks in the flyout can have custom var names.
const variable = Variables.getOrCreateVariablePackage(
this.getSourceBlock().workspace, state['id'] || null, state['name'],
block.workspace, state['id'] || null, state['name'],
state['type'] || '');
this.setValue(variable.getId());
}
@@ -315,9 +329,12 @@ export class FieldVariable extends FieldDropdown {
if (opt_newValue === null) {
return null;
}
const block = this.getSourceBlock();
if (!block) {
throw new UnattachedFieldError();
}
const newId = opt_newValue as string;
const variable =
Variables.getVariable(this.getSourceBlock().workspace, newId);
const variable = Variables.getVariable(block.workspace, newId);
if (!variable) {
console.warn(
'Variable id doesn\'t point to a real variable! ' +
@@ -343,8 +360,11 @@ export class FieldVariable extends FieldDropdown {
* @param newId The value to be saved.
*/
protected override doValueUpdate_(newId: AnyDuringMigration) {
this.variable_ =
Variables.getVariable(this.getSourceBlock().workspace, newId as string);
const block = this.getSourceBlock();
if (!block) {
throw new UnattachedFieldError();
}
this.variable_ = Variables.getVariable(block.workspace, newId as string);
super.doValueUpdate_(newId);
}

View File

@@ -28,5 +28,5 @@ export interface IASTNodeLocationWithBlock extends IASTNodeLocation {
*
* @returns The source block.
*/
getSourceBlock(): Block;
getSourceBlock(): Block|null;
}

View File

@@ -176,6 +176,10 @@ export class ASTNode {
const location = this.location_ as Field;
const input = location.getParentInput();
const block = location.getSourceBlock();
if (!block) {
throw new Error(
'The current AST location is not associated with a block');
}
const curIdx = block.inputList.indexOf((input));
let fieldIdx = input.fieldRow.indexOf(location) + 1;
for (let i = curIdx; i < block.inputList.length; i++) {
@@ -235,6 +239,10 @@ export class ASTNode {
const location = this.location_ as Field;
const parentInput = location.getParentInput();
const block = location.getSourceBlock();
if (!block) {
throw new Error(
'The current AST location is not associated with a block');
}
const curIdx = block.inputList.indexOf((parentInput));
let fieldIdx = parentInput.fieldRow.indexOf(location) - 1;
for (let i = curIdx; i >= 0; i--) {
@@ -270,7 +278,10 @@ export class ASTNode {
// TODO(#6097): Use instanceof checks to exit early for values of
// curLocation that don't make sense.
if ((curLocation as IASTNodeLocationWithBlock).getSourceBlock) {
curLocation = (curLocation as IASTNodeLocationWithBlock).getSourceBlock();
const block = (curLocation as IASTNodeLocationWithBlock).getSourceBlock();
if (block) {
curLocation = block;
}
}
// TODO(#6097): Use instanceof checks to exit early for values of
// curLocation that don't make sense.
@@ -531,7 +542,12 @@ export class ASTNode {
}
case ASTNode.types.FIELD: {
const field = this.location_ as Field;
return ASTNode.createBlockNode(field.getSourceBlock());
const block = field.getSourceBlock();
if (!block) {
throw new Error(
'The current AST location is not associated with a block');
}
return ASTNode.createBlockNode(block);
}
case ASTNode.types.INPUT: {
const connection = this.location_ as Connection;

View File

@@ -22,7 +22,7 @@ import * as common from './common.js';
import type {Abstract} from './events/events_abstract.js';
import type {BubbleOpen} from './events/events_bubble_open.js';
import * as eventUtils from './events/utils.js';
import type {Field} from './field.js';
import {Field, UnattachedFieldError} from './field.js';
import {Msg} from './msg.js';
import {Names} from './names.js';
import * as utilsXml from './utils/xml.js';
@@ -180,14 +180,19 @@ export function isNameUsed(
* @alias Blockly.Procedures.rename
*/
export function rename(this: Field, name: string): string {
const block = this.getSourceBlock();
if (!block) {
throw new UnattachedFieldError();
}
// Strip leading and trailing whitespace. Beyond this, all names are legal.
name = name.trim();
const legalName = findLegalName(name, (this.getSourceBlock()));
const legalName = findLegalName(name, block);
const oldName = this.getValue();
if (oldName !== name && oldName !== legalName) {
// Rename any callers.
const blocks = this.getSourceBlock().workspace.getAllBlocks(false);
const blocks = block.workspace.getAllBlocks(false);
for (let i = 0; i < blocks.length; i++) {
// Assume it is a procedure so we can check.
const procedureBlock = blocks[i] as unknown as ProcedureBlock;

View File

@@ -158,20 +158,20 @@ export function shouldHandleEvent(e: Event|PseudoEvent): boolean {
* Get the touch identifier from the given event. If it was a mouse event, the
* identifier is the string 'mouse'.
*
* @param e Mouse event or touch event.
* @returns The touch identifier from the first changed touch, if defined.
* Otherwise 'mouse'.
* @param e Pointer event, mouse event, or touch event.
* @returns The pointerId, or touch identifier from the first changed touch, if
* defined. Otherwise 'mouse'.
* @alias Blockly.Touch.getTouchIdentifierFromEvent
*/
export function getTouchIdentifierFromEvent(e: Event|PseudoEvent): string {
if (e instanceof MouseEvent) {
return 'mouse';
}
if (e instanceof PointerEvent) {
return String(e.pointerId);
}
if (e instanceof MouseEvent) {
return 'mouse';
}
/**
* TODO(#6097): Fix types. This is a catch-all for everything but mouse
* and pointer events.

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "blockly",
"version": "9.0.0",
"version": "9.0.1",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "blockly",
"version": "9.0.0",
"version": "9.0.1",
"license": "Apache-2.0",
"dependencies": {
"jsdom": "15.2.1"

View File

@@ -1,6 +1,6 @@
{
"name": "blockly",
"version": "9.0.0",
"version": "9.0.1",
"description": "Blockly is a library for building visual programming editors.",
"keywords": [
"blockly"

View File

@@ -96,6 +96,7 @@
'Blockly.test.registry',
'Blockly.test.serialization',
'Blockly.test.shortcutRegistry',
'Blockly.test.touch',
'Blockly.test.theme',
'Blockly.test.toolbox',
'Blockly.test.tooltip',

95
tests/mocha/touch_test.js Normal file
View File

@@ -0,0 +1,95 @@
/**
* @license
* Copyright 2022 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
goog.declareModuleId('Blockly.test.touch');
import {sharedTestSetup, sharedTestTeardown} from './test_helpers/setup_teardown.js';
suite('Touch', function() {
setup(function() {
sharedTestSetup.call(this);
});
teardown(function() {
Blockly.Touch.clearTouchIdentifier();
sharedTestTeardown.call(this);
});
suite('shouldHandleTouch', function() {
test('handles mousedown event', function() {
const mouseEvent = new MouseEvent('mousedown');
chai.assert.isTrue(Blockly.Touch.shouldHandleEvent(mouseEvent));
});
test('handles multiple mousedown events', function() {
const mouseEvent1 = new MouseEvent('mousedown');
const mouseEvent2 = new MouseEvent('mousedown');
Blockly.Touch.shouldHandleEvent(mouseEvent1);
chai.assert.isTrue(Blockly.Touch.shouldHandleEvent(mouseEvent2));
});
test('does not handle mouseup if not tracking touch', function() {
const mouseEvent = new MouseEvent('mouseup');
chai.assert.isFalse(Blockly.Touch.shouldHandleEvent(mouseEvent));
});
test('handles mouseup if already tracking a touch', function() {
const mousedown = new MouseEvent('mousedown');
const mouseup = new MouseEvent('mouseup');
// Register the mousedown event first
Blockly.Touch.shouldHandleEvent(mousedown);
chai.assert.isTrue(Blockly.Touch.shouldHandleEvent(mouseup));
});
test('handles pointerdown if this is a new touch', function() {
const pointerdown = new PointerEvent('pointerdown', {pointerId: 1, pointerType: 'touch'});
chai.assert.isTrue(Blockly.Touch.shouldHandleEvent(pointerdown));
});
test('does not handle pointerdown if part of a different touch', function() {
const pointerdown1 = new PointerEvent('pointerdown', {pointerId: 1, pointerType: 'touch'});
const pointerdown2 = new PointerEvent('pointerdown', {pointerId: 2, pointerType: 'touch'});
Blockly.Touch.shouldHandleEvent(pointerdown1);
chai.assert.isFalse(Blockly.Touch.shouldHandleEvent(pointerdown2));
});
test('does not handle pointerdown after a mousedown', function() {
const mouseEvent = new MouseEvent('mousedown');
const pointerdown = new PointerEvent('pointerdown', {pointerId: 1, pointerType: 'touch'});
Blockly.Touch.shouldHandleEvent(mouseEvent);
chai.assert.isFalse(Blockly.Touch.shouldHandleEvent(pointerdown));
});
test('does not handle pointerup if not tracking touch', function() {
const pointerup = new PointerEvent('pointerup', {pointerId: 1, pointerType: 'touch'});
chai.assert.isFalse(Blockly.Touch.shouldHandleEvent(pointerup));
});
test('handles pointerup if part of existing touch', function() {
const pointerdown = new PointerEvent('pointerdown', {pointerId: 1, pointerType: 'touch'});
const pointerup = new PointerEvent('pointerdown', {pointerId: 1, pointerType: 'touch'});
Blockly.Touch.shouldHandleEvent(pointerdown);
chai.assert.isTrue(Blockly.Touch.shouldHandleEvent(pointerup));
});
});
suite('getTouchIdentifierFromEvent', function() {
test('is mouse for MouseEvents', function() {
const mousedown = new MouseEvent('mousedown');
chai.assert.equal(Blockly.Touch.getTouchIdentifierFromEvent(mousedown), 'mouse');
});
test('is pointerId for mouse PointerEvents', function() {
const pointerdown = new PointerEvent('pointerdown', {pointerId: 7, pointerType: 'mouse'});
chai.assert.equal(Blockly.Touch.getTouchIdentifierFromEvent(pointerdown), 7);
});
test('is pointerId for touch PointerEvents', function() {
const pointerdown = new PointerEvent('pointerdown', {pointerId: 42, pointerType: 'touch'});
chai.assert.equal(Blockly.Touch.getTouchIdentifierFromEvent(pointerdown), 42);
});
});
});