blockly 13.2.0 → 13.2.2-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,43 +11,43 @@
11
11
  }
12
12
  }(this, function(__parent__) {
13
13
  var $=__parent__.__namespace__;
14
- var Jq=function(a){return function(){var b=a.workspace,c=a.getField("VAR").getVariable();$.Rd(b,c)}},Kq=function(a){return function(){var b=a.getField("VAR").getVariable();b&&$.$d(b.getWorkspace(),b,a)}},Lq=function(a){return function(){var b=a.workspace,c=a.getField("VAR").getVariable();$.Rd(b,c)}},Mq=function(a){return function(){var b=a.getField("VAR").getVariable();b&&$.$d(b.getWorkspace(),b,a)}},Nq=$.yb([{type:"variables_get_dynamic",message0:"%1",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_VARIABLES_DEFAULT_NAME}"}],
14
+ var Kq=function(a){return function(){var b=a.workspace,c=a.getField("VAR").getVariable();$.Rd(b,c)}},Lq=function(a){return function(){var b=a.getField("VAR").getVariable();b&&$.$d(b.getWorkspace(),b,a)}},Mq=function(a){return function(){var b=a.workspace,c=a.getField("VAR").getVariable();$.Rd(b,c)}},Nq=function(a){return function(){var b=a.getField("VAR").getVariable();b&&$.$d(b.getWorkspace(),b,a)}},Oq=$.yb([{type:"variables_get_dynamic",message0:"%1",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_VARIABLES_DEFAULT_NAME}"}],
15
15
  output:null,style:"variable_dynamic_blocks",helpUrl:"%{BKY_VARIABLES_GET_HELPURL}",tooltip:"%{BKY_VARIABLES_GET_TOOLTIP}",extensions:["contextMenu_variableDynamicSetterGetter"]},{type:"variables_set_dynamic",message0:"%{BKY_VARIABLES_SET}",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_VARIABLES_DEFAULT_NAME}"},{type:"input_value",name:"VALUE"}],previousStatement:null,nextStatement:null,style:"variable_dynamic_blocks",tooltip:"%{BKY_VARIABLES_SET_TOOLTIP}",helpUrl:"%{BKY_VARIABLES_SET_HELPURL}",
16
16
  extensions:["contextMenu_variableDynamicSetterGetter"]}]);
17
17
  $.ph("contextMenu_variableDynamicSetterGetter",{customContextMenu:function(a){if(!this.isInFlyout){if(this.type==="variables_get_dynamic"){var b="variables_set_dynamic";var c=$.C.VARIABLES_GET_CREATE_SET}else b="variables_get_dynamic",c=$.C.VARIABLES_SET_CREATE_GET;var d=this.getField("VAR");b={type:b,fields:{VAR:d.saveState(!0)}};a.push({enabled:this.workspace.remainingCapacity()>0,text:c.replace("%1",d.getText()),callback:$.Pg(this,b)})}else if(this.type==="variables_get_dynamic"||this.type==="variables_get_reporter_dynamic")d=
18
- this.getField("VAR").getText(),c={text:$.C.RENAME_VARIABLE.replace("%1",d),enabled:!0,callback:Jq(this)},d={text:$.C.DELETE_VARIABLE.replace("%1",d),enabled:!0,callback:Kq(this)},a.unshift(c),a.unshift(d)},onchange:function(){var a=this.getFieldValue("VAR");a=$.Vd(this.workspace,a);this.type==="variables_get_dynamic"?this.outputConnection.setCheck(a.getType()):this.getInput("VALUE").connection.setCheck(a.getType())}});$.Ab(Nq);var Oq={blocks:Nq};var Pq=$.yb([{type:"variables_get",message0:"%1",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_VARIABLES_DEFAULT_NAME}"}],output:null,style:"variable_blocks",helpUrl:"%{BKY_VARIABLES_GET_HELPURL}",tooltip:"%{BKY_VARIABLES_GET_TOOLTIP}",extensions:["contextMenu_variableSetterGetter"]},{type:"variables_set",message0:"%{BKY_VARIABLES_SET}",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_VARIABLES_DEFAULT_NAME}"},{type:"input_value",name:"VALUE",ariaLabelText:"%{BKY_INPUT_LABEL_VARIABLES_SET}"}],
18
+ this.getField("VAR").getText(),c={text:$.C.RENAME_VARIABLE.replace("%1",d),enabled:!0,callback:Kq(this)},d={text:$.C.DELETE_VARIABLE.replace("%1",d),enabled:!0,callback:Lq(this)},a.unshift(c),a.unshift(d)},onchange:function(){var a=this.getFieldValue("VAR");a=$.Vd(this.workspace,a);this.type==="variables_get_dynamic"?this.outputConnection.setCheck(a.getType()):this.getInput("VALUE").connection.setCheck(a.getType())}});$.Ab(Oq);var Pq={blocks:Oq};var Qq=$.yb([{type:"variables_get",message0:"%1",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_VARIABLES_DEFAULT_NAME}"}],output:null,style:"variable_blocks",helpUrl:"%{BKY_VARIABLES_GET_HELPURL}",tooltip:"%{BKY_VARIABLES_GET_TOOLTIP}",extensions:["contextMenu_variableSetterGetter"]},{type:"variables_set",message0:"%{BKY_VARIABLES_SET}",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_VARIABLES_DEFAULT_NAME}"},{type:"input_value",name:"VALUE",ariaLabelText:"%{BKY_INPUT_LABEL_VARIABLES_SET}"}],
19
19
  previousStatement:null,nextStatement:null,style:"variable_blocks",tooltip:"%{BKY_VARIABLES_SET_TOOLTIP}",helpUrl:"%{BKY_VARIABLES_SET_HELPURL}",extensions:["contextMenu_variableSetterGetter"]}]);
20
20
  $.ph("contextMenu_variableSetterGetter",{customContextMenu:function(a){if(!this.isInFlyout){if(this.type==="variables_get"){var b="variables_set";var c=$.C.VARIABLES_GET_CREATE_SET}else b="variables_get",c=$.C.VARIABLES_SET_CREATE_GET;var d=this.getField("VAR");b={type:b,fields:{VAR:d.saveState(!0)}};a.push({enabled:this.workspace.remainingCapacity()>0,text:c.replace("%1",d.getText()),callback:$.Pg(this,b)})}else if(this.type==="variables_get"||this.type==="variables_get_reporter")d=this.getField("VAR").getText(),
21
- c={text:$.C.RENAME_VARIABLE.replace("%1",d),enabled:!0,callback:Lq(this)},d={text:$.C.DELETE_VARIABLE.replace("%1",d),enabled:!0,callback:Mq(this)},a.unshift(c),a.unshift(d)}});$.Ab(Pq);var Qq={blocks:Pq};var Rq=$.yb([{type:"text",message0:"%1",args0:[{type:"field_input",name:"TEXT",text:""}],output:"String",style:"text_blocks",helpUrl:"%{BKY_TEXT_TEXT_HELPURL}",tooltip:"%{BKY_TEXT_TEXT_TOOLTIP}",extensions:["text_quotes","parent_tooltip_when_inline"]},{type:"text_join",message0:"",output:"String",style:"text_blocks",helpUrl:"%{BKY_TEXT_JOIN_HELPURL}",tooltip:"%{BKY_TEXT_JOIN_TOOLTIP}",mutator:"text_join_mutator"},{type:"text_create_join_container",message0:"%{BKY_TEXT_CREATE_JOIN_TITLE_JOIN} %1 %2",
21
+ c={text:$.C.RENAME_VARIABLE.replace("%1",d),enabled:!0,callback:Mq(this)},d={text:$.C.DELETE_VARIABLE.replace("%1",d),enabled:!0,callback:Nq(this)},a.unshift(c),a.unshift(d)}});$.Ab(Qq);var Rq={blocks:Qq};var Sq=$.yb([{type:"text",message0:"%1",args0:[{type:"field_input",name:"TEXT",text:""}],output:"String",style:"text_blocks",helpUrl:"%{BKY_TEXT_TEXT_HELPURL}",tooltip:"%{BKY_TEXT_TEXT_TOOLTIP}",extensions:["text_quotes","parent_tooltip_when_inline"]},{type:"text_join",message0:"",output:"String",style:"text_blocks",helpUrl:"%{BKY_TEXT_JOIN_HELPURL}",tooltip:"%{BKY_TEXT_JOIN_TOOLTIP}",mutator:"text_join_mutator"},{type:"text_create_join_container",message0:"%{BKY_TEXT_CREATE_JOIN_TITLE_JOIN} %1 %2",
22
22
  args0:[{type:"input_dummy"},{type:"input_statement",name:"STACK"}],style:"text_blocks",tooltip:"%{BKY_TEXT_CREATE_JOIN_TOOLTIP}",enableContextMenu:!1},{type:"text_create_join_item",message0:"%{BKY_TEXT_CREATE_JOIN_ITEM_TITLE_ITEM}",previousStatement:null,nextStatement:null,style:"text_blocks",tooltip:"%{BKY_TEXT_CREATE_JOIN_ITEM_TOOLTIP}",enableContextMenu:!1},{type:"text_append",message0:"%{BKY_TEXT_APPEND_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_TEXT_APPEND_VARIABLE}"},{type:"input_value",
23
23
  name:"TEXT",ariaLabelText:"%{BKY_INPUT_LABEL_TEXT_APPEND}"}],previousStatement:null,nextStatement:null,style:"text_blocks",extensions:["text_append_tooltip"]},{type:"text_length",message0:"%{BKY_TEXT_LENGTH_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"],ariaLabelText:"%{BKY_INPUT_LABEL_TEXT_TO_CHECK}"}],output:"Number",style:"text_blocks",tooltip:"%{BKY_TEXT_LENGTH_TOOLTIP}",helpUrl:"%{BKY_TEXT_LENGTH_HELPURL}"},{type:"text_isEmpty",message0:"%{BKY_TEXT_ISEMPTY_TITLE}",args0:[{type:"input_value",
24
24
  name:"VALUE",check:["String","Array"],ariaLabelText:"%{BKY_INPUT_LABEL_TEXT_TO_CHECK}"}],output:"Boolean",style:"text_blocks",tooltip:"%{BKY_TEXT_ISEMPTY_TOOLTIP}",helpUrl:"%{BKY_TEXT_ISEMPTY_HELPURL}"},{type:"text_indexOf",message0:"%{BKY_TEXT_INDEXOF_TITLE}",args0:[{type:"input_value",name:"VALUE",check:"String",ariaLabelText:"%{BKY_INPUT_LABEL_TEXT_TO_CHECK}"},{type:"field_dropdown",name:"END",options:[["%{BKY_TEXT_INDEXOF_OPERATOR_FIRST}","FIRST"],["%{BKY_TEXT_INDEXOF_OPERATOR_LAST}","LAST"]]},
25
25
  {type:"input_value",name:"FIND",check:"String",ariaLabelText:"%{BKY_INPUT_LABEL_TEXT_TO_FIND}"}],output:"Number",style:"text_blocks",helpUrl:"%{BKY_TEXT_INDEXOF_HELPURL}",inputsInline:!0,extensions:["text_indexOf_tooltip"]},{type:"text_charAt",message0:"%{BKY_TEXT_CHARAT_TITLE}",args0:[{type:"input_value",name:"VALUE",check:"String",ariaLabelText:"%{BKY_INPUT_LABEL_TEXT_TO_CHECK}"},{type:"field_dropdown",name:"WHERE",options:[["%{BKY_TEXT_CHARAT_FROM_START}","FROM_START","%{BKY_TEXT_FROM_START_ARIA}"],
26
26
  ["%{BKY_TEXT_CHARAT_FROM_END}","FROM_END","%{BKY_TEXT_FROM_END_ARIA}"],["%{BKY_TEXT_CHARAT_FIRST}","FIRST"],["%{BKY_TEXT_CHARAT_LAST}","LAST"],["%{BKY_TEXT_CHARAT_RANDOM}","RANDOM"]]}],output:"String",style:"text_blocks",helpUrl:"%{BKY_TEXT_CHARAT_HELPURL}",inputsInline:!0,mutator:"text_charAt_mutator"}]);
27
- Rq.text_getSubstring={init:function(){this.WHERE_OPTIONS_1=[[$.C.TEXT_GET_SUBSTRING_START_FROM_START,"FROM_START",$.C.TEXT_FROM_START_ARIA],[$.C.TEXT_GET_SUBSTRING_START_FROM_END,"FROM_END",$.C.TEXT_FROM_END_ARIA],[$.C.TEXT_GET_SUBSTRING_START_FIRST,"FIRST"]];this.WHERE_OPTIONS_2=[[$.C.TEXT_GET_SUBSTRING_END_FROM_START,"FROM_START",$.C.TEXT_FROM_START_ARIA],[$.C.TEXT_GET_SUBSTRING_END_FROM_END,"FROM_END",$.C.TEXT_FROM_END_ARIA],[$.C.TEXT_GET_SUBSTRING_END_LAST,"LAST"]];this.setHelpUrl($.C.TEXT_GET_SUBSTRING_HELPURL);
27
+ Sq.text_getSubstring={init:function(){this.WHERE_OPTIONS_1=[[$.C.TEXT_GET_SUBSTRING_START_FROM_START,"FROM_START",$.C.TEXT_FROM_START_ARIA],[$.C.TEXT_GET_SUBSTRING_START_FROM_END,"FROM_END",$.C.TEXT_FROM_END_ARIA],[$.C.TEXT_GET_SUBSTRING_START_FIRST,"FIRST"]];this.WHERE_OPTIONS_2=[[$.C.TEXT_GET_SUBSTRING_END_FROM_START,"FROM_START",$.C.TEXT_FROM_START_ARIA],[$.C.TEXT_GET_SUBSTRING_END_FROM_END,"FROM_END",$.C.TEXT_FROM_END_ARIA],[$.C.TEXT_GET_SUBSTRING_END_LAST,"LAST"]];this.setHelpUrl($.C.TEXT_GET_SUBSTRING_HELPURL);
28
28
  this.setStyle("text_blocks");this.appendValueInput("STRING").setCheck("String").appendField($.C.TEXT_GET_SUBSTRING_INPUT_IN_TEXT).setAriaLabelProvider($.C.INPUT_LABEL_TEXT_TO_CHECK);var a=b=>{var c=$.lh({type:"field_dropdown",options:this["WHERE_OPTIONS_"+b]});c.setValidator(function(d){var e=this.getValue();d=d==="FROM_START"||d==="FROM_END";d!==(e==="FROM_START"||e==="FROM_END")&&this.getSourceBlock().updateAt_(b,d)});return c};this.appendDummyInput("WHERE1_INPUT").appendField(a(1),"WHERE1");this.appendDummyInput("AT1");
29
- this.appendDummyInput("WHERE2_INPUT").appendField(a(2),"WHERE2");this.appendDummyInput("AT2");$.C.TEXT_GET_SUBSTRING_TAIL&&this.appendDummyInput("TAIL").appendField($.C.TEXT_GET_SUBSTRING_TAIL);this.setInputsInline(!0);this.setOutput(!0,"String");this.updateAt_(1,!0);this.updateAt_(2,!0);this.setTooltip($.C.TEXT_GET_SUBSTRING_TOOLTIP)},mutationToDom:function(){var a=$.rc("mutation"),b=this.getInput("AT1")instanceof $.Nn;a.setAttribute("at1",`${b}`);b=this.getInput("AT2")instanceof $.Nn;a.setAttribute("at2",
29
+ this.appendDummyInput("WHERE2_INPUT").appendField(a(2),"WHERE2");this.appendDummyInput("AT2");$.C.TEXT_GET_SUBSTRING_TAIL&&this.appendDummyInput("TAIL").appendField($.C.TEXT_GET_SUBSTRING_TAIL);this.setInputsInline(!0);this.setOutput(!0,"String");this.updateAt_(1,!0);this.updateAt_(2,!0);this.setTooltip($.C.TEXT_GET_SUBSTRING_TOOLTIP)},mutationToDom:function(){var a=$.rc("mutation"),b=this.getInput("AT1")instanceof $.On;a.setAttribute("at1",`${b}`);b=this.getInput("AT2")instanceof $.On;a.setAttribute("at2",
30
30
  `${b}`);return a},domToMutation:function(a){var b=a.getAttribute("at1")==="true";a=a.getAttribute("at2")==="true";this.updateAt_(1,b);this.updateAt_(2,a)},updateAt_:function(a,b){this.removeInput("AT"+a);this.removeInput("ORDINAL"+a,!0);b?(this.appendValueInput("AT"+a).setCheck("Number").setAriaLabelProvider(a===1?$.C.INPUT_LABEL_TEXT_START_POSITION:$.C.INPUT_LABEL_TEXT_END_POSITION),$.C.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL"+a).appendField($.C.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT"+
31
31
  a);a===2&&$.C.TEXT_GET_SUBSTRING_TAIL&&(this.removeInput("TAIL",!0),this.appendDummyInput("TAIL").appendField($.C.TEXT_GET_SUBSTRING_TAIL));a===1&&(this.moveInputBefore("AT1","WHERE2_INPUT"),this.getInput("ORDINAL1")&&this.moveInputBefore("ORDINAL1","WHERE2_INPUT"))}};
32
- Rq.text_changeCase={init:function(){var a=[[$.C.TEXT_CHANGECASE_OPERATOR_UPPERCASE,"UPPERCASE"],[$.C.TEXT_CHANGECASE_OPERATOR_LOWERCASE,"LOWERCASE"],[$.C.TEXT_CHANGECASE_OPERATOR_TITLECASE,"TITLECASE"]];this.setHelpUrl($.C.TEXT_CHANGECASE_HELPURL);this.setStyle("text_blocks");this.appendValueInput("TEXT").setCheck("String").appendField($.lh({type:"field_dropdown",options:a}),"CASE").setAriaLabelProvider($.C.INPUT_LABEL_TEXT_TO_CHANGE);this.setOutput(!0,"String");this.setTooltip($.C.TEXT_CHANGECASE_TOOLTIP)}};
33
- Rq.text_trim={init:function(){var a=[[$.C.TEXT_TRIM_OPERATOR_BOTH,"BOTH"],[$.C.TEXT_TRIM_OPERATOR_LEFT,"LEFT"],[$.C.TEXT_TRIM_OPERATOR_RIGHT,"RIGHT"]];this.setHelpUrl($.C.TEXT_TRIM_HELPURL);this.setStyle("text_blocks");this.appendValueInput("TEXT").setCheck("String").appendField($.lh({type:"field_dropdown",options:a}),"MODE").setAriaLabelProvider($.C.INPUT_LABEL_TEXT_TO_CHANGE);this.setOutput(!0,"String");this.setTooltip($.C.TEXT_TRIM_TOOLTIP)}};
34
- Rq.text_print={init:function(){this.jsonInit({message0:$.C.TEXT_PRINT_TITLE,args0:[{type:"input_value",name:"TEXT"}],previousStatement:null,nextStatement:null,style:"text_blocks",tooltip:$.C.TEXT_PRINT_TOOLTIP,helpUrl:$.C.TEXT_PRINT_HELPURL})}};var Sq={updateType_:function(a){this.outputConnection.setCheck(a==="NUMBER"?"Number":"String")},mutationToDom:function(){var a=$.rc("mutation");a.setAttribute("type",this.getFieldValue("TYPE"));return a},domToMutation:function(a){this.updateType_(a.getAttribute("type"))}};
35
- Rq.text_prompt_ext=Object.assign({},Sq,{init:function(){var a=[[$.C.TEXT_PROMPT_TYPE_TEXT,"TEXT"],[$.C.TEXT_PROMPT_TYPE_NUMBER,"NUMBER"]];this.setHelpUrl($.C.TEXT_PROMPT_HELPURL);this.setStyle("text_blocks");a=$.lh({type:"field_dropdown",options:a});a.setValidator(b=>{this.updateType_(b)});this.appendValueInput("TEXT").appendField(a,"TYPE").setAriaLabelProvider($.C.INPUT_LABEL_TEXT_PROMPT_MESSAGE);this.setOutput(!0,"String");this.setTooltip(()=>this.getFieldValue("TYPE")==="TEXT"?$.C.TEXT_PROMPT_TOOLTIP_TEXT:
32
+ Sq.text_changeCase={init:function(){var a=[[$.C.TEXT_CHANGECASE_OPERATOR_UPPERCASE,"UPPERCASE"],[$.C.TEXT_CHANGECASE_OPERATOR_LOWERCASE,"LOWERCASE"],[$.C.TEXT_CHANGECASE_OPERATOR_TITLECASE,"TITLECASE"]];this.setHelpUrl($.C.TEXT_CHANGECASE_HELPURL);this.setStyle("text_blocks");this.appendValueInput("TEXT").setCheck("String").appendField($.lh({type:"field_dropdown",options:a}),"CASE").setAriaLabelProvider($.C.INPUT_LABEL_TEXT_TO_CHANGE);this.setOutput(!0,"String");this.setTooltip($.C.TEXT_CHANGECASE_TOOLTIP)}};
33
+ Sq.text_trim={init:function(){var a=[[$.C.TEXT_TRIM_OPERATOR_BOTH,"BOTH"],[$.C.TEXT_TRIM_OPERATOR_LEFT,"LEFT"],[$.C.TEXT_TRIM_OPERATOR_RIGHT,"RIGHT"]];this.setHelpUrl($.C.TEXT_TRIM_HELPURL);this.setStyle("text_blocks");this.appendValueInput("TEXT").setCheck("String").appendField($.lh({type:"field_dropdown",options:a}),"MODE").setAriaLabelProvider($.C.INPUT_LABEL_TEXT_TO_CHANGE);this.setOutput(!0,"String");this.setTooltip($.C.TEXT_TRIM_TOOLTIP)}};
34
+ Sq.text_print={init:function(){this.jsonInit({message0:$.C.TEXT_PRINT_TITLE,args0:[{type:"input_value",name:"TEXT"}],previousStatement:null,nextStatement:null,style:"text_blocks",tooltip:$.C.TEXT_PRINT_TOOLTIP,helpUrl:$.C.TEXT_PRINT_HELPURL})}};var Tq={updateType_:function(a){this.outputConnection.setCheck(a==="NUMBER"?"Number":"String")},mutationToDom:function(){var a=$.rc("mutation");a.setAttribute("type",this.getFieldValue("TYPE"));return a},domToMutation:function(a){this.updateType_(a.getAttribute("type"))}};
35
+ Sq.text_prompt_ext=Object.assign({},Tq,{init:function(){var a=[[$.C.TEXT_PROMPT_TYPE_TEXT,"TEXT"],[$.C.TEXT_PROMPT_TYPE_NUMBER,"NUMBER"]];this.setHelpUrl($.C.TEXT_PROMPT_HELPURL);this.setStyle("text_blocks");a=$.lh({type:"field_dropdown",options:a});a.setValidator(b=>{this.updateType_(b)});this.appendValueInput("TEXT").appendField(a,"TYPE").setAriaLabelProvider($.C.INPUT_LABEL_TEXT_PROMPT_MESSAGE);this.setOutput(!0,"String");this.setTooltip(()=>this.getFieldValue("TYPE")==="TEXT"?$.C.TEXT_PROMPT_TOOLTIP_TEXT:
36
36
  $.C.TEXT_PROMPT_TOOLTIP_NUMBER)}});
37
- Rq.text_prompt=Object.assign({},Sq,{init:function(){this.mixin(Tq);var a=[[$.C.TEXT_PROMPT_TYPE_TEXT,"TEXT"],[$.C.TEXT_PROMPT_TYPE_NUMBER,"NUMBER"]];this.setHelpUrl($.C.TEXT_PROMPT_HELPURL);this.setStyle("text_blocks");a=$.lh({type:"field_dropdown",options:a});a.setValidator(b=>{this.updateType_(b)});this.appendDummyInput().appendField(a,"TYPE").appendField(this.newQuote_(!0)).appendField($.lh({type:"field_input",text:""}),"TEXT").appendField(this.newQuote_(!1));this.setOutput(!0,"String");this.setTooltip(()=>
38
- this.getFieldValue("TYPE")==="TEXT"?$.C.TEXT_PROMPT_TOOLTIP_TEXT:$.C.TEXT_PROMPT_TOOLTIP_NUMBER)}});Rq.text_count={init:function(){this.jsonInit({message0:$.C.TEXT_COUNT_MESSAGE0,args0:[{type:"input_value",name:"SUB",check:"String",ariaLabelText:"%{BKY_INPUT_LABEL_TEXT_TO_FIND}"},{type:"input_value",name:"TEXT",check:"String",ariaLabelText:"%{BKY_INPUT_LABEL_TEXT_TO_CHECK}"}],output:"Number",inputsInline:!0,style:"text_blocks",tooltip:$.C.TEXT_COUNT_TOOLTIP,helpUrl:$.C.TEXT_COUNT_HELPURL})}};
39
- Rq.text_replace={init:function(){this.jsonInit({message0:$.C.TEXT_REPLACE_MESSAGE0,args0:[{type:"input_value",name:"FROM",check:"String",ariaLabelText:"%{BKY_INPUT_LABEL_TEXT_TO_FIND}"},{type:"input_value",name:"TO",check:"String",ariaLabelText:"%{BKY_INPUT_LABEL_TEXT_TO_REPLACE}"},{type:"input_value",name:"TEXT",check:"String",ariaLabelText:"%{BKY_INPUT_LABEL_TEXT_TO_CHECK}"}],output:"String",inputsInline:!0,style:"text_blocks",tooltip:$.C.TEXT_REPLACE_TOOLTIP,helpUrl:$.C.TEXT_REPLACE_HELPURL})}};
40
- Rq.text_reverse={init:function(){this.jsonInit({message0:$.C.TEXT_REVERSE_MESSAGE0,args0:[{type:"input_value",name:"TEXT",check:"String",ariaLabelText:"%{BKY_INPUT_LABEL_TEXT_TO_CHANGE}"}],output:"String",inputsInline:!0,style:"text_blocks",tooltip:$.C.TEXT_REVERSE_TOOLTIP,helpUrl:$.C.TEXT_REVERSE_HELPURL})}};
41
- var Tq={QUOTE_IMAGE_LEFT_DATAURI:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAn0lEQVQI1z3OMa5BURSF4f/cQhAKjUQhuQmFNwGJEUi0RKN5rU7FHKhpjEH3TEMtkdBSCY1EIv8r7nFX9e29V7EBAOvu7RPjwmWGH/VuF8CyN9/OAdvqIXYLvtRaNjx9mMTDyo+NjAN1HNcl9ZQ5oQMM3dgDUqDo1l8DzvwmtZN7mnD+PkmLa+4mhrxVA9fRowBWmVBhFy5gYEjKMfz9AylsaRRgGzvZAAAAAElFTkSuQmCC",QUOTE_IMAGE_RIGHT_DATAURI:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAqUlEQVQI1z3KvUpCcRiA8ef9E4JNHhI0aFEacm1o0BsI0Slx8wa8gLauoDnoBhq7DcfWhggONDmJJgqCPA7neJ7p934EOOKOnM8Q7PDElo/4x4lFb2DmuUjcUzS3URnGib9qaPNbuXvBO3sGPHJDRG6fGVdMSeWDP2q99FQdFrz26Gu5Tq7dFMzUvbXy8KXeAj57cOklgA+u1B5AoslLtGIHQMaCVnwDnADZIFIrXsoXrgAAAABJRU5ErkJggg==",
37
+ Sq.text_prompt=Object.assign({},Tq,{init:function(){this.mixin(Uq);var a=[[$.C.TEXT_PROMPT_TYPE_TEXT,"TEXT"],[$.C.TEXT_PROMPT_TYPE_NUMBER,"NUMBER"]];this.setHelpUrl($.C.TEXT_PROMPT_HELPURL);this.setStyle("text_blocks");a=$.lh({type:"field_dropdown",options:a});a.setValidator(b=>{this.updateType_(b)});this.appendDummyInput().appendField(a,"TYPE").appendField(this.newQuote_(!0)).appendField($.lh({type:"field_input",text:""}),"TEXT").appendField(this.newQuote_(!1));this.setOutput(!0,"String");this.setTooltip(()=>
38
+ this.getFieldValue("TYPE")==="TEXT"?$.C.TEXT_PROMPT_TOOLTIP_TEXT:$.C.TEXT_PROMPT_TOOLTIP_NUMBER)}});Sq.text_count={init:function(){this.jsonInit({message0:$.C.TEXT_COUNT_MESSAGE0,args0:[{type:"input_value",name:"SUB",check:"String",ariaLabelText:"%{BKY_INPUT_LABEL_TEXT_TO_FIND}"},{type:"input_value",name:"TEXT",check:"String",ariaLabelText:"%{BKY_INPUT_LABEL_TEXT_TO_CHECK}"}],output:"Number",inputsInline:!0,style:"text_blocks",tooltip:$.C.TEXT_COUNT_TOOLTIP,helpUrl:$.C.TEXT_COUNT_HELPURL})}};
39
+ Sq.text_replace={init:function(){this.jsonInit({message0:$.C.TEXT_REPLACE_MESSAGE0,args0:[{type:"input_value",name:"FROM",check:"String",ariaLabelText:"%{BKY_INPUT_LABEL_TEXT_TO_FIND}"},{type:"input_value",name:"TO",check:"String",ariaLabelText:"%{BKY_INPUT_LABEL_TEXT_TO_REPLACE}"},{type:"input_value",name:"TEXT",check:"String",ariaLabelText:"%{BKY_INPUT_LABEL_TEXT_TO_CHECK}"}],output:"String",inputsInline:!0,style:"text_blocks",tooltip:$.C.TEXT_REPLACE_TOOLTIP,helpUrl:$.C.TEXT_REPLACE_HELPURL})}};
40
+ Sq.text_reverse={init:function(){this.jsonInit({message0:$.C.TEXT_REVERSE_MESSAGE0,args0:[{type:"input_value",name:"TEXT",check:"String",ariaLabelText:"%{BKY_INPUT_LABEL_TEXT_TO_CHANGE}"}],output:"String",inputsInline:!0,style:"text_blocks",tooltip:$.C.TEXT_REVERSE_TOOLTIP,helpUrl:$.C.TEXT_REVERSE_HELPURL})}};
41
+ var Uq={QUOTE_IMAGE_LEFT_DATAURI:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAn0lEQVQI1z3OMa5BURSF4f/cQhAKjUQhuQmFNwGJEUi0RKN5rU7FHKhpjEH3TEMtkdBSCY1EIv8r7nFX9e29V7EBAOvu7RPjwmWGH/VuF8CyN9/OAdvqIXYLvtRaNjx9mMTDyo+NjAN1HNcl9ZQ5oQMM3dgDUqDo1l8DzvwmtZN7mnD+PkmLa+4mhrxVA9fRowBWmVBhFy5gYEjKMfz9AylsaRRgGzvZAAAAAElFTkSuQmCC",QUOTE_IMAGE_RIGHT_DATAURI:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAqUlEQVQI1z3KvUpCcRiA8ef9E4JNHhI0aFEacm1o0BsI0Slx8wa8gLauoDnoBhq7DcfWhggONDmJJgqCPA7neJ7p934EOOKOnM8Q7PDElo/4x4lFb2DmuUjcUzS3URnGib9qaPNbuXvBO3sGPHJDRG6fGVdMSeWDP2q99FQdFrz26Gu5Tq7dFMzUvbXy8KXeAj57cOklgA+u1B5AoslLtGIHQMaCVnwDnADZIFIrXsoXrgAAAABJRU5ErkJggg==",
42
42
  QUOTE_IMAGE_WIDTH:12,QUOTE_IMAGE_HEIGHT:12,quoteField_:function(a){for(let b=0,c;c=this.inputList[b];b++)for(let d=0,e;e=c.fieldRow[d];d++)if(a===e.name){c.insertFieldAt(d,this.newQuote_(!0));c.insertFieldAt(d+2,this.newQuote_(!1));return}console.warn('field named "'+a+'" not found in '+this.toDevString())},newQuote_:function(a){a=this.RTL?!a:a;return $.lh({type:"field_image",src:a?this.QUOTE_IMAGE_LEFT_DATAURI:this.QUOTE_IMAGE_RIGHT_DATAURI,width:this.QUOTE_IMAGE_WIDTH,height:this.QUOTE_IMAGE_HEIGHT,
43
- alt:a?"\u201c":"\u201d"})}};$.oh("text_append_tooltip",$.Ah("%{BKY_TEXT_APPEND_TOOLTIP}","VAR"));$.oh("text_indexOf_tooltip",function(){this.setTooltip(()=>$.C.TEXT_INDEXOF_TOOLTIP.replace("%1",this.workspace.options.oneBasedIndex?"0":"-1"))});$.oh("text_quotes",function(){this.mixin(Tq);this.quoteField_("TEXT")});$.ph("quote_image_mixin",Tq);
43
+ alt:a?"\u201c":"\u201d"})}};$.oh("text_append_tooltip",$.Ah("%{BKY_TEXT_APPEND_TOOLTIP}","VAR"));$.oh("text_indexOf_tooltip",function(){this.setTooltip(()=>$.C.TEXT_INDEXOF_TOOLTIP.replace("%1",this.workspace.options.oneBasedIndex?"0":"-1"))});$.oh("text_quotes",function(){this.mixin(Uq);this.quoteField_("TEXT")});$.ph("quote_image_mixin",Uq);
44
44
  $.th("text_join_mutator",{itemCount_:0,mutationToDom:function(){var a=$.rc("mutation");a.setAttribute("items",`${this.itemCount_}`);return a},domToMutation:function(a){this.itemCount_=parseInt(a.getAttribute("items"),10);this.updateShape_()},saveExtraState:function(){return{itemCount:this.itemCount_}},loadExtraState:function(a){this.itemCount_=a.itemCount;this.updateShape_()},decompose:function(a){var b=a.newBlock("text_create_join_container");b.initSvg();var c,d=(c=b.getInput("STACK"))==null?void 0:
45
45
  c.connection;for(c=0;c<this.itemCount_;c++){let e=a.newBlock("text_create_join_item");e.initSvg();if(e.previousConnection){let f;(f=d)==null||f.connect(e.previousConnection)}d=e.nextConnection}return b},compose:function(a){var b=a.getInputTargetBlock("STACK");for(a=[];b;)b.isInsertionMarker()||a.push(b.valueConnection_),b=b.getNextBlock();for(b=0;b<this.itemCount_;b++){let c=this.getInput("ADD"+b).connection.targetConnection;c&&!a.includes(c)&&c.disconnect()}this.itemCount_=a.length;this.updateShape_();
46
46
  for(b=0;b<this.itemCount_;b++){let c;(c=a[b])==null||c.reconnect(this,"ADD"+b)}},saveConnections:function(a){a=a.getInputTargetBlock("STACK");for(var b=0;a;){if(a.isInsertionMarker()){a=a.getNextBlock();continue}let c=this.getInput("ADD"+b);a.valueConnection_=c&&c.connection.targetConnection;a=a.getNextBlock();b++}},updateShape_:function(){this.itemCount_&&this.getInput("EMPTY")?this.removeInput("EMPTY"):this.itemCount_||this.getInput("EMPTY")||this.appendDummyInput("EMPTY").appendField(this.newQuote_(!0)).appendField(this.newQuote_(!1));
47
- for(var a=0;a<this.itemCount_;a++)if(!this.getInput("ADD"+a)){let b=this.appendValueInput("ADD"+a).setAlign($.En.RIGHT).setAriaLabelProvider($.C.INPUT_LABEL_TEXT_JOIN_ITEM.replace("%1",(a+1).toString()));a===0&&b.appendField($.C.TEXT_JOIN_TITLE_CREATEWITH)}for(a=this.itemCount_;this.getInput("ADD"+a);a++)this.removeInput("ADD"+a)}},function(){this.mixin(Tq);this.itemCount_=2;this.updateShape_();this.setMutator(new $.sh(["text_create_join_item"],this))});
47
+ for(var a=0;a<this.itemCount_;a++)if(!this.getInput("ADD"+a)){let b=this.appendValueInput("ADD"+a).setAlign($.Fn.RIGHT).setAriaLabelProvider($.C.INPUT_LABEL_TEXT_JOIN_ITEM.replace("%1",(a+1).toString()));a===0&&b.appendField($.C.TEXT_JOIN_TITLE_CREATEWITH)}for(a=this.itemCount_;this.getInput("ADD"+a);a++)this.removeInput("ADD"+a)}},function(){this.mixin(Uq);this.itemCount_=2;this.updateShape_();this.setMutator(new $.sh(["text_create_join_item"],this))});
48
48
  $.th("text_charAt_mutator",{isAt_:!1,mutationToDom:function(){var a=$.rc("mutation");a.setAttribute("at",`${this.isAt_}`);return a},domToMutation:function(a){a=a.getAttribute("at")!=="false";this.updateAt_(a)},updateAt_:function(a){this.removeInput("AT",!0);this.removeInput("ORDINAL",!0);a&&(this.appendValueInput("AT").setCheck("Number").setAriaLabelProvider($.C.INPUT_LABEL_TEXT_POSITION),$.C.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL").appendField($.C.ORDINAL_NUMBER_SUFFIX));$.C.TEXT_CHARAT_TAIL&&
49
49
  (this.removeInput("TAIL",!0),this.appendDummyInput("TAIL").appendField($.C.TEXT_CHARAT_TAIL));this.isAt_=a}},function(){this.getField("WHERE").setValidator(function(a){a=a==="FROM_START"||a==="FROM_END";var b=this.getSourceBlock();a!==b.isAt_&&b.updateAt_(a)});this.updateAt_(!0);this.setTooltip(()=>{var a=this.getFieldValue("WHERE"),b=$.C.TEXT_CHARAT_TOOLTIP;(a==="FROM_START"||a==="FROM_END")&&(a=a==="FROM_START"?$.C.LISTS_INDEX_FROM_START_TOOLTIP:$.C.LISTS_INDEX_FROM_END_TOOLTIP)&&(b+=" "+a.replace("%1",
50
- this.workspace.options.oneBasedIndex?"#1":"#0"));return b})});$.Ab(Rq);var Uq={blocks:Rq};var Vq={},Wq={setStatements_:function(a){this.hasStatements_!==a&&(a?(this.appendStatementInput("STACK").appendField($.C.PROCEDURES_DEFNORETURN_DO),this.getInput("RETURN")&&this.moveInputBefore("STACK","RETURN")):this.removeInput("STACK",!0),this.hasStatements_=a)},updateParams_:function(){var a="";this.arguments_.length&&(a=$.C.PROCEDURES_BEFORE_PARAMS+" "+this.arguments_.join(", "));$.Ub++;try{this.setFieldValue(a,"PARAMS")}finally{$.Ub--}},mutationToDom:function(a){var b=$.rc("mutation");a&&b.setAttribute("name",
50
+ this.workspace.options.oneBasedIndex?"#1":"#0"));return b})});$.Ab(Sq);var Vq={blocks:Sq};var Wq={},Xq={setStatements_:function(a){this.hasStatements_!==a&&(a?(this.appendStatementInput("STACK").appendField($.C.PROCEDURES_DEFNORETURN_DO),this.getInput("RETURN")&&this.moveInputBefore("STACK","RETURN")):this.removeInput("STACK",!0),this.hasStatements_=a)},updateParams_:function(){var a="";this.arguments_.length&&(a=$.C.PROCEDURES_BEFORE_PARAMS+" "+this.arguments_.join(", "));$.Ub++;try{this.setFieldValue(a,"PARAMS")}finally{$.Ub--}},mutationToDom:function(a){var b=$.rc("mutation");a&&b.setAttribute("name",
51
51
  this.getFieldValue("NAME"));for(let c=0;c<this.argumentVarModels_.length;c++){let d=$.rc("arg"),e=this.argumentVarModels_[c];d.setAttribute("name",e.getName());d.setAttribute("varid",e.getId());a&&this.paramIds_&&d.setAttribute("paramId",this.paramIds_[c]);b.appendChild(d)}this.hasStatements_||b.setAttribute("statements","false");return b},domToMutation:function(a){this.arguments_=[];this.argumentVarModels_=[];for(let c=0,d;d=a.childNodes[c];c++)if(d.nodeName.toLowerCase()==="arg"){var b=d;let e=
52
52
  b.getAttribute("name");b=b.getAttribute("varid")||b.getAttribute("varId");this.arguments_.push(e);b=$.Wd(this.workspace,b,e,"");b!==null?this.argumentVarModels_.push(b):console.log(`Failed to create a variable named "${e}", ignoring.`)}this.updateParams_();$.sj(this);this.setStatements_(a.getAttribute("statements")!=="false")},saveExtraState:function(){if(!this.argumentVarModels_.length&&this.hasStatements_)return null;var a=Object.create(null);if(this.argumentVarModels_.length){a.params=[];for(let b=
53
53
  0;b<this.argumentVarModels_.length;b++)a.params.push({name:this.argumentVarModels_[b].getName(),id:this.argumentVarModels_[b].getId()})}this.hasStatements_||(a.hasStatements=!1);return a},loadExtraState:function(a){this.arguments_=[];this.argumentVarModels_=[];if(a.params)for(let c=0;c<a.params.length;c++){var b=a.params[c];b=$.Wd(this.workspace,b.id,b.name,"");this.arguments_.push(b.getName());this.argumentVarModels_.push(b)}this.updateParams_();$.sj(this);this.setStatements_(a.hasStatements===!1?
@@ -57,30 +57,30 @@ null&&(a=a==="TRUE",this.hasStatements_!==a))if(a){this.setStatements_(!0);var d
57
57
  c.getName();b=this.workspace.getVariableMap().getVariableById(b);var d=!1;for(let e=0;e<this.argumentVarModels_.length;e++)this.argumentVarModels_[e].getId()===a&&(this.arguments_[e]=b.getName(),this.argumentVarModels_[e]=b,d=!0);d&&(this.displayRenamedVar_(c,b.getName()),$.sj(this))}},updateVarName:function(a){var b=a.getName(),c=!1;for(let e=0;e<this.argumentVarModels_.length;e++)if(this.argumentVarModels_[e].getId()===a.getId()){var d=this.arguments_[e];this.arguments_[e]=b;c=!0}c&&(this.displayRenamedVar_(d,
58
58
  b),$.sj(this))},displayRenamedVar_:function(a,b){this.updateParams_();var c=this.getIcon($.sh.TYPE);if(c&&c.bubbleIsVisible()){c=c.getWorkspace().getAllBlocks(!1);for(let d=0,e;e=c[d];d++)e.type==="procedures_mutatorarg"&&$.kj.equals(a,e.getFieldValue("NAME"))&&e.setFieldValue(b,"NAME")}},customContextMenu:function(a){if(!this.isInFlyout){var b=this.getFieldValue("NAME"),c={type:this.callType_,extraState:{name:b,params:this.arguments_}};a.push({enabled:!0,text:$.C.PROCEDURES_CREATE_DO.replace("%1",
59
59
  b),callback:$.Pg(this,c)});if(!this.isCollapsed())for(b=0;b<this.argumentVarModels_.length;b++){c=this.argumentVarModels_[b];let d={type:"variables_get",fields:{VAR:{name:c.getName(),id:c.getId(),type:c.getType()}}};a.push({enabled:!0,text:$.C.VARIABLES_SET_CREATE_GET.replace("%1",c.getName()),callback:$.Pg(this,d)})}}}};
60
- Vq.procedures_defnoreturn=Object.assign({},Wq,{init:function(){var a=$.jj("",this);a=$.lh({type:"field_input",text:a,ariaTypeName:$.C.ARIA_TYPE_FIELD_TEXT_INPUT_PROCEDURE});a.setValidator($.mj);a.setSpellcheck(!1);this.appendDummyInput().appendField($.C.PROCEDURES_DEFNORETURN_TITLE).appendField(a,"NAME").appendField("","PARAMS");this.setMutator(new $.sh(["procedures_mutatorarg"],this));(this.workspace.options.comments||this.workspace.options.parentWorkspace&&this.workspace.options.parentWorkspace.options.comments)&&
60
+ Wq.procedures_defnoreturn=Object.assign({},Xq,{init:function(){var a=$.jj("",this);a=$.lh({type:"field_input",text:a,ariaTypeName:$.C.ARIA_TYPE_FIELD_TEXT_INPUT_PROCEDURE});a.setValidator($.mj);a.setSpellcheck(!1);this.appendDummyInput().appendField($.C.PROCEDURES_DEFNORETURN_TITLE).appendField(a,"NAME").appendField("","PARAMS");this.setMutator(new $.sh(["procedures_mutatorarg"],this));(this.workspace.options.comments||this.workspace.options.parentWorkspace&&this.workspace.options.parentWorkspace.options.comments)&&
61
61
  $.C.PROCEDURES_DEFNORETURN_COMMENT&&this.setCommentText($.C.PROCEDURES_DEFNORETURN_COMMENT);this.setStyle("procedure_blocks");this.setTooltip($.C.PROCEDURES_DEFNORETURN_TOOLTIP);this.setHelpUrl($.C.PROCEDURES_DEFNORETURN_HELPURL);this.arguments_=[];this.argumentVarModels_=[];this.setStatements_(!0);this.statementConnection_=null},getProcedureDef:function(){return[this.getFieldValue("NAME"),this.arguments_,!1]},callType_:"procedures_callnoreturn"});
62
- Vq.procedures_defreturn=Object.assign({},Wq,{init:function(){var a=$.jj("",this);a=$.lh({type:"field_input",text:a,ariaTypeName:$.C.ARIA_TYPE_FIELD_TEXT_INPUT_PROCEDURE});a.setValidator($.mj);a.setSpellcheck(!1);this.appendDummyInput().appendField($.C.PROCEDURES_DEFRETURN_TITLE).appendField(a,"NAME").appendField("","PARAMS");this.appendValueInput("RETURN").setAlign($.En.RIGHT).appendField($.C.PROCEDURES_DEFRETURN_RETURN);this.setMutator(new $.sh(["procedures_mutatorarg"],this));(this.workspace.options.comments||
62
+ Wq.procedures_defreturn=Object.assign({},Xq,{init:function(){var a=$.jj("",this);a=$.lh({type:"field_input",text:a,ariaTypeName:$.C.ARIA_TYPE_FIELD_TEXT_INPUT_PROCEDURE});a.setValidator($.mj);a.setSpellcheck(!1);this.appendDummyInput().appendField($.C.PROCEDURES_DEFRETURN_TITLE).appendField(a,"NAME").appendField("","PARAMS");this.appendValueInput("RETURN").setAlign($.Fn.RIGHT).appendField($.C.PROCEDURES_DEFRETURN_RETURN);this.setMutator(new $.sh(["procedures_mutatorarg"],this));(this.workspace.options.comments||
63
63
  this.workspace.options.parentWorkspace&&this.workspace.options.parentWorkspace.options.comments)&&$.C.PROCEDURES_DEFRETURN_COMMENT&&this.setCommentText($.C.PROCEDURES_DEFRETURN_COMMENT);this.setStyle("procedure_blocks");this.setTooltip($.C.PROCEDURES_DEFRETURN_TOOLTIP);this.setHelpUrl($.C.PROCEDURES_DEFRETURN_HELPURL);this.arguments_=[];this.argumentVarModels_=[];this.setStatements_(!0);this.statementConnection_=null},getProcedureDef:function(){return[this.getFieldValue("NAME"),this.arguments_,!0]},
64
- callType_:"procedures_callreturn"});Vq.procedures_mutatorcontainer={init:function(){this.appendDummyInput().appendField($.C.PROCEDURES_MUTATORCONTAINER_TITLE);this.appendStatementInput("STACK");this.appendDummyInput("STATEMENT_INPUT").appendField($.C.PROCEDURES_ALLOW_STATEMENTS).appendField($.lh({type:"field_checkbox",checked:!0}),"STATEMENTS");this.setStyle("procedure_blocks");this.setTooltip($.C.PROCEDURES_MUTATORCONTAINER_TOOLTIP);this.contextMenu=!1}};
65
- var Xq=class extends $.Vp{constructor(){super(...arguments);this.editingInteractively=!1}showEditor_(a){super.showEditor_(a);this.editingInteractively=!0;this.editingVariable=void 0}onFinishEditing_(a){super.onFinishEditing_(a);this.editingInteractively=!1}};
66
- Vq.procedures_mutatorarg={init:function(){var a=new Xq("x",this.validator_,{ariaTypeName:$.C.ARIA_TYPE_FIELD_TEXT_INPUT_ARGUMENT});this.appendDummyInput().appendField($.C.PROCEDURES_MUTATORARG_TITLE).appendField(a,"NAME");this.setPreviousStatement(!0);this.setNextStatement(!0);this.setStyle("procedure_blocks");this.setTooltip($.C.PROCEDURES_MUTATORARG_TOOLTIP);this.contextMenu=!1},validator_:function(a){var b=this.getSourceBlock(),c=b.workspace.getRootWorkspace();a=a.replace(/[\s\xa0]+/g," ").replace(/^ | $/g,
64
+ callType_:"procedures_callreturn"});Wq.procedures_mutatorcontainer={init:function(){this.appendDummyInput().appendField($.C.PROCEDURES_MUTATORCONTAINER_TITLE);this.appendStatementInput("STACK");this.appendDummyInput("STATEMENT_INPUT").appendField($.C.PROCEDURES_ALLOW_STATEMENTS).appendField($.lh({type:"field_checkbox",checked:!0}),"STATEMENTS");this.setStyle("procedure_blocks");this.setTooltip($.C.PROCEDURES_MUTATORCONTAINER_TOOLTIP);this.contextMenu=!1}};
65
+ var Yq=class extends $.hq{constructor(){super(...arguments);this.editingInteractively=!1}showEditor_(a){super.showEditor_(a);this.editingInteractively=!0;this.editingVariable=void 0}onFinishEditing_(a){super.onFinishEditing_(a);this.editingInteractively=!1}};
66
+ Wq.procedures_mutatorarg={init:function(){var a=new Yq("x",this.validator_,{ariaTypeName:$.C.ARIA_TYPE_FIELD_TEXT_INPUT_ARGUMENT});this.appendDummyInput().appendField($.C.PROCEDURES_MUTATORARG_TITLE).appendField(a,"NAME");this.setPreviousStatement(!0);this.setNextStatement(!0);this.setStyle("procedure_blocks");this.setTooltip($.C.PROCEDURES_MUTATORARG_TOOLTIP);this.contextMenu=!1},validator_:function(a){var b=this.getSourceBlock(),c=b.workspace.getRootWorkspace();a=a.replace(/[\s\xa0]+/g," ").replace(/^ | $/g,
67
67
  "");if(!a)return null;var d=(b.workspace.targetWorkspace||b.workspace).getAllBlocks(!1),e=a.toLowerCase();for(let f=0;f<d.length;f++){if(d[f].id===this.getSourceBlock().id)continue;let g=d[f].getFieldValue("NAME");if(g&&g.toLowerCase()===e)return null}if(b.isInFlyout)return a;b=c.getVariableMap();(c=b.getVariable(a,""))&&c.getName()!==a&&b.renameVariable(c,a);c||(this.editingInteractively?this.editingVariable?b.renameVariable(this.editingVariable,a):this.editingVariable=b.createVariable(a,""):b.createVariable(a,
68
68
  ""));return a}};
69
- var Yq={getProcedureCall:function(){return this.getFieldValue("NAME")},renameProcedure:function(a,b){$.kj.equals(a,this.getProcedureCall())&&(this.setFieldValue(b,"NAME"),this.setTooltip((this.outputConnection?$.C.PROCEDURES_CALLRETURN_TOOLTIP:$.C.PROCEDURES_CALLNORETURN_TOOLTIP).replace("%1",b)))},setProcedureParameters_:function(a,b){var c=$.tj(this.getProcedureCall(),this.workspace);(c=(c=c&&c.getIcon($.sh.TYPE))&&c.bubbleIsVisible())?this.setCollapsed(!1):(this.quarkConnections_={},this.quarkIds_=
69
+ var Zq={getProcedureCall:function(){return this.getFieldValue("NAME")},renameProcedure:function(a,b){$.kj.equals(a,this.getProcedureCall())&&(this.setFieldValue(b,"NAME"),this.setTooltip((this.outputConnection?$.C.PROCEDURES_CALLRETURN_TOOLTIP:$.C.PROCEDURES_CALLNORETURN_TOOLTIP).replace("%1",b)))},setProcedureParameters_:function(a,b){var c=$.tj(this.getProcedureCall(),this.workspace);(c=(c=c&&c.getIcon($.sh.TYPE))&&c.bubbleIsVisible())?this.setCollapsed(!1):(this.quarkConnections_={},this.quarkIds_=
70
70
  null);if(a.join("\n")===this.arguments_.join("\n"))this.quarkIds_=b;else{if(b.length!==a.length)throw RangeError("paramNames and paramIds must be the same length.");this.quarkIds_||(this.quarkConnections_={},this.quarkIds_=[]);for(let e=0;e<this.arguments_.length;e++){var d=this.getInput("ARG"+e);d&&(d=d.connection.targetConnection,this.quarkConnections_[this.quarkIds_[e]]=d,c&&d&&!b.includes(this.quarkIds_[e])&&(d.disconnect(),d.getSourceBlock().bumpNeighbours()))}this.arguments_=[].concat(a);this.argumentVarModels_=
71
71
  [];for(a=0;a<this.arguments_.length;a++)c=$.Wd(this.workspace,null,this.arguments_[a],""),this.argumentVarModels_.push(c);this.updateShape_();if(this.quarkIds_=b)for(b=0;b<this.arguments_.length;b++)if(a=this.quarkIds_[b],a in this.quarkConnections_){let e;((e=this.quarkConnections_[a])==null?0:e.reconnect(this,"ARG"+b))||delete this.quarkConnections_[a]}}},updateShape_:function(){for(var a=0;a<this.arguments_.length;a++){var b=this.getField("ARGNAME"+a);if(b){$.Ub++;try{b.setValue(this.arguments_[a])}finally{$.Ub--}}else b=
72
- $.lh({type:"field_label",text:this.arguments_[a]}),this.appendValueInput("ARG"+a).setAlign($.En.RIGHT).appendField(b,"ARGNAME"+a)}for(a=this.arguments_.length;this.getInput("ARG"+a);a++)this.removeInput("ARG"+a);(a=this.getInput("TOPROW"))&&(this.arguments_.length?this.getField("WITH")||a.appendField($.C.PROCEDURES_CALL_BEFORE_PARAMS,"WITH"):this.getField("WITH")&&a.removeField("WITH"))},mutationToDom:function(){var a=$.rc("mutation");a.setAttribute("name",this.getProcedureCall());for(let b=0;b<this.arguments_.length;b++){let c=
72
+ $.lh({type:"field_label",text:this.arguments_[a]}),this.appendValueInput("ARG"+a).setAlign($.Fn.RIGHT).appendField(b,"ARGNAME"+a)}for(a=this.arguments_.length;this.getInput("ARG"+a);a++)this.removeInput("ARG"+a);(a=this.getInput("TOPROW"))&&(this.arguments_.length?this.getField("WITH")||a.appendField($.C.PROCEDURES_CALL_BEFORE_PARAMS,"WITH"):this.getField("WITH")&&a.removeField("WITH"))},mutationToDom:function(){var a=$.rc("mutation");a.setAttribute("name",this.getProcedureCall());for(let b=0;b<this.arguments_.length;b++){let c=
73
73
  $.rc("arg");c.setAttribute("name",this.arguments_[b]);a.appendChild(c)}return a},domToMutation:function(a){var b=a.getAttribute("name");this.renameProcedure(this.getProcedureCall(),b);b=[];var c=[];for(let d=0,e;e=a.childNodes[d];d++)e.nodeName.toLowerCase()==="arg"&&(b.push(e.getAttribute("name")),c.push(e.getAttribute("paramId")));this.setProcedureParameters_(b,c)},saveExtraState:function(){var a=Object.create(null);a.name=this.getProcedureCall();this.arguments_.length&&(a.params=this.arguments_);
74
74
  return a},loadExtraState:function(a){this.renameProcedure(this.getProcedureCall(),a.name);if(a=a.params){let b=[];b.length=a.length;b.fill(null);this.setProcedureParameters_(a,b)}},getVarModels:function(){return this.argumentVarModels_},onchange:function(a){if(this.workspace&&!this.workspace.isFlyout&&a.recordUndo)if(a.type===$.Od&&a.ids.includes(this.id)){var b=this.getProcedureCall(),c=$.tj(b,this.workspace);!c||c.type===this.defType_&&JSON.stringify(c.getVarModels().map(e=>e.getName()))===JSON.stringify(this.arguments_)||
75
75
  (c=null);if(c)c.isEnabled()||(this.setDisabledReason(!0,"DISABLED_PROCEDURE_DEFINITION"),this.setWarningText($.C.PROCEDURES_CALL_DISABLED_DEF_WARNING.replace("%1",b)));else{$.B(a.group);a=$.rc("xml");b=$.rc("block");b.setAttribute("type",this.defType_);c=this.getRelativeToSurfaceXY();var d=c.y+$.Og.snapRadius*2;b.setAttribute("x",`${c.x+$.Og.snapRadius*(this.RTL?-1:1)}`);b.setAttribute("y",`${d}`);c=this.mutationToDom();b.appendChild(c);c=$.rc("field");c.setAttribute("name","NAME");d=this.getProcedureCall();
76
- let e=$.jj(d,this);d!==e&&this.renameProcedure(d,e);c.appendChild($.sc(d));b.appendChild(c);a.appendChild(b);$.ch(a,this.workspace);$.B(!1)}}else a.type===$.lm?(b=this.getProcedureCall(),$.tj(b,this.workspace)||($.B(a.group),this.dispose(!0),$.B(!1))):a.type===$.km&&a.element==="disabled"&&(b=this.getProcedureCall(),(d=$.tj(b,this.workspace))&&d.id===a.blockId&&((c=$.gd)&&console.log("Saw an existing group while responding to a definition change"),$.B(a.group),a=d.isEnabled(),this.setDisabledReason(!a,
76
+ let e=$.jj(d,this);d!==e&&this.renameProcedure(d,e);c.appendChild($.sc(d));b.appendChild(c);a.appendChild(b);$.ch(a,this.workspace);$.B(!1)}}else a.type===$.mm?(b=this.getProcedureCall(),$.tj(b,this.workspace)||($.B(a.group),this.dispose(!0),$.B(!1))):a.type===$.lm&&a.element==="disabled"&&(b=this.getProcedureCall(),(d=$.tj(b,this.workspace))&&d.id===a.blockId&&((c=$.gd)&&console.log("Saw an existing group while responding to a definition change"),$.B(a.group),a=d.isEnabled(),this.setDisabledReason(!a,
77
77
  "DISABLED_PROCEDURE_DEFINITION"),this.setWarningText(a?null:$.C.PROCEDURES_CALL_DISABLED_DEF_WARNING.replace("%1",b)),$.B(c)))},customContextMenu:function(a){if(this.workspace.isMovable()){var b=this.getProcedureCall(),c=this.workspace;a.push({enabled:!0,text:$.C.PROCEDURES_HIGHLIGHT_DEF,callback:function(){var d=$.tj(b,c);d&&(c.centerOnBlock(d.id),$.t().focusNode(d))}})}}};
78
- Vq.procedures_callnoreturn=Object.assign({},Yq,{init:function(){this.appendDummyInput("TOPROW").appendField("","NAME");this.setPreviousStatement(!0);this.setNextStatement(!0);this.setStyle("procedure_blocks");this.setHelpUrl($.C.PROCEDURES_CALLNORETURN_HELPURL);this.arguments_=[];this.argumentVarModels_=[];this.quarkConnections_={};this.quarkIds_=null},defType_:"procedures_defnoreturn"});
79
- Vq.procedures_callreturn=Object.assign({},Yq,{init:function(){this.appendDummyInput("TOPROW").appendField("","NAME");this.setOutput(!0);this.setStyle("procedure_blocks");this.setHelpUrl($.C.PROCEDURES_CALLRETURN_HELPURL);this.arguments_=[];this.argumentVarModels_=[];this.quarkConnections_={};this.quarkIds_=null},defType_:"procedures_defreturn"});
80
- Vq.procedures_ifreturn={init:function(){this.appendValueInput("CONDITION").setCheck("Boolean").appendField($.C.CONTROLS_IF_MSG_IF);this.appendValueInput("VALUE").appendField($.C.PROCEDURES_DEFRETURN_RETURN);this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0);this.setStyle("procedure_blocks");this.setTooltip($.C.PROCEDURES_IFRETURN_TOOLTIP);this.setHelpUrl($.C.PROCEDURES_IFRETURN_HELPURL);this.hasReturnValue_=!0},mutationToDom:function(){var a=$.rc("mutation");a.setAttribute("value",
81
- String(Number(this.hasReturnValue_)));return a},domToMutation:function(a){this.hasReturnValue_=a.getAttribute("value")==="1";this.hasReturnValue_||(this.removeInput("VALUE"),this.appendDummyInput("VALUE").appendField($.C.PROCEDURES_DEFRETURN_RETURN))},onchange:function(a){if(!(this.workspace.isDragging&&this.workspace.isDragging()||a.type!==$.nm&&a.type!==$.Od)){a=!1;var b=this;do{if(this.FUNCTION_TYPES.includes(b.type)){a=!0;break}b=b.getSurroundParent()}while(b);a?(b.type==="procedures_defnoreturn"&&
78
+ Wq.procedures_callnoreturn=Object.assign({},Zq,{init:function(){this.appendDummyInput("TOPROW").appendField("","NAME");this.setPreviousStatement(!0);this.setNextStatement(!0);this.setStyle("procedure_blocks");this.setHelpUrl($.C.PROCEDURES_CALLNORETURN_HELPURL);this.arguments_=[];this.argumentVarModels_=[];this.quarkConnections_={};this.quarkIds_=null},defType_:"procedures_defnoreturn"});
79
+ Wq.procedures_callreturn=Object.assign({},Zq,{init:function(){this.appendDummyInput("TOPROW").appendField("","NAME");this.setOutput(!0);this.setStyle("procedure_blocks");this.setHelpUrl($.C.PROCEDURES_CALLRETURN_HELPURL);this.arguments_=[];this.argumentVarModels_=[];this.quarkConnections_={};this.quarkIds_=null},defType_:"procedures_defreturn"});
80
+ Wq.procedures_ifreturn={init:function(){this.appendValueInput("CONDITION").setCheck("Boolean").appendField($.C.CONTROLS_IF_MSG_IF);this.appendValueInput("VALUE").appendField($.C.PROCEDURES_DEFRETURN_RETURN);this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0);this.setStyle("procedure_blocks");this.setTooltip($.C.PROCEDURES_IFRETURN_TOOLTIP);this.setHelpUrl($.C.PROCEDURES_IFRETURN_HELPURL);this.hasReturnValue_=!0},mutationToDom:function(){var a=$.rc("mutation");a.setAttribute("value",
81
+ String(Number(this.hasReturnValue_)));return a},domToMutation:function(a){this.hasReturnValue_=a.getAttribute("value")==="1";this.hasReturnValue_||(this.removeInput("VALUE"),this.appendDummyInput("VALUE").appendField($.C.PROCEDURES_DEFRETURN_RETURN))},onchange:function(a){if(!(this.workspace.isDragging&&this.workspace.isDragging()||a.type!==$.om&&a.type!==$.Od)){a=!1;var b=this;do{if(this.FUNCTION_TYPES.includes(b.type)){a=!0;break}b=b.getSurroundParent()}while(b);a?(b.type==="procedures_defnoreturn"&&
82
82
  this.hasReturnValue_?(this.removeInput("VALUE"),this.appendDummyInput("VALUE").appendField($.C.PROCEDURES_DEFRETURN_RETURN),this.hasReturnValue_=!1):b.type!=="procedures_defreturn"||this.hasReturnValue_||(this.removeInput("VALUE"),this.appendValueInput("VALUE").appendField($.C.PROCEDURES_DEFRETURN_RETURN),this.hasReturnValue_=!0),this.setWarningText(null)):this.setWarningText($.C.PROCEDURES_IFRETURN_WARNING);if(!this.isInFlyout)try{$.Qc=!1,this.setDisabledReason(!a,"UNPARENTED_IFRETURN")}finally{$.Qc=
83
- !0}}},FUNCTION_TYPES:["procedures_defnoreturn","procedures_defreturn"]};$.Ab(Vq);var Zq={blocks:Vq};var $q=$.yb([{type:"math_number",message0:"%1",args0:[{type:"field_number",name:"NUM",value:0}],output:"Number",helpUrl:"%{BKY_MATH_NUMBER_HELPURL}",style:"math_blocks",tooltip:"%{BKY_MATH_NUMBER_TOOLTIP}",extensions:["parent_tooltip_when_inline"]},{type:"math_arithmetic",message0:"%1 %2 %3",args0:[{type:"input_value",name:"A",check:"Number",ariaLabelText:"%{BKY_INPUT_LABEL_NUMBER_A}"},{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ADDITION_SYMBOL}","ADD","%{BKY_MATH_ADDITION_SYMBOL_ARIA}"],
83
+ !0}}},FUNCTION_TYPES:["procedures_defnoreturn","procedures_defreturn"]};$.Ab(Wq);var $q={blocks:Wq};var ar=$.yb([{type:"math_number",message0:"%1",args0:[{type:"field_number",name:"NUM",value:0}],output:"Number",helpUrl:"%{BKY_MATH_NUMBER_HELPURL}",style:"math_blocks",tooltip:"%{BKY_MATH_NUMBER_TOOLTIP}",extensions:["parent_tooltip_when_inline"]},{type:"math_arithmetic",message0:"%1 %2 %3",args0:[{type:"input_value",name:"A",check:"Number",ariaLabelText:"%{BKY_INPUT_LABEL_NUMBER_A}"},{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ADDITION_SYMBOL}","ADD","%{BKY_MATH_ADDITION_SYMBOL_ARIA}"],
84
84
  ["%{BKY_MATH_SUBTRACTION_SYMBOL}","MINUS","%{BKY_MATH_SUBTRACTION_SYMBOL_ARIA}"],["%{BKY_MATH_MULTIPLICATION_SYMBOL}","MULTIPLY","%{BKY_MATH_MULTIPLICATION_SYMBOL_ARIA}"],["%{BKY_MATH_DIVISION_SYMBOL}","DIVIDE","%{BKY_MATH_DIVISION_SYMBOL_ARIA}"],["%{BKY_MATH_POWER_SYMBOL}","POWER","%{BKY_MATH_POWER_SYMBOL_ARIA}"]]},{type:"input_value",name:"B",check:"Number",ariaLabelText:"%{BKY_INPUT_LABEL_NUMBER_B}"}],inputsInline:!0,output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_ARITHMETIC_HELPURL}",
85
85
  extensions:["math_op_tooltip"]},{type:"math_single",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_SINGLE_OP_ROOT}","ROOT"],["%{BKY_MATH_SINGLE_OP_ABSOLUTE}","ABS","%{BKY_MATH_SINGLE_OP_ABSOLUTE_ARIA}"],["-","NEG","%{BKY_MATH_SINGLE_OP_NEG_ARIA}"],["ln","LN","%{BKY_MATH_SINGLE_OP_LN_ARIA}"],["log10","LOG10","%{BKY_MATH_SINGLE_OP_LOG10_ARIA}"],["e^","EXP","%{BKY_MATH_SINGLE_OP_EXP_ARIA}"],["10^","POW10","%{BKY_MATH_SINGLE_OP_POW10_ARIA}"]]},{type:"input_value",name:"NUM",
86
86
  check:"Number",ariaLabelText:"%{BKY_INPUT_LABEL_NUMBER}"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_SINGLE_HELPURL}",extensions:["math_op_tooltip"]},{type:"math_trig",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_TRIG_SIN}","SIN","%{BKY_MATH_TRIG_SIN_ARIA}"],["%{BKY_MATH_TRIG_COS}","COS","%{BKY_MATH_TRIG_COS_ARIA}"],["%{BKY_MATH_TRIG_TAN}","TAN","%{BKY_MATH_TRIG_TAN_ARIA}"],["%{BKY_MATH_TRIG_ASIN}","ASIN","%{BKY_MATH_TRIG_ASIN_ARIA}"],["%{BKY_MATH_TRIG_ACOS}",
@@ -98,7 +98,7 @@ $.oh("math_op_tooltip",$.yh("OP",{ADD:"%{BKY_MATH_ARITHMETIC_TOOLTIP_ADD}",MINUS
98
98
  SIN:"%{BKY_MATH_TRIG_TOOLTIP_SIN}",COS:"%{BKY_MATH_TRIG_TOOLTIP_COS}",TAN:"%{BKY_MATH_TRIG_TOOLTIP_TAN}",ASIN:"%{BKY_MATH_TRIG_TOOLTIP_ASIN}",ACOS:"%{BKY_MATH_TRIG_TOOLTIP_ACOS}",ATAN:"%{BKY_MATH_TRIG_TOOLTIP_ATAN}",SUM:"%{BKY_MATH_ONLIST_TOOLTIP_SUM}",MIN:"%{BKY_MATH_ONLIST_TOOLTIP_MIN}",MAX:"%{BKY_MATH_ONLIST_TOOLTIP_MAX}",AVERAGE:"%{BKY_MATH_ONLIST_TOOLTIP_AVERAGE}",MEDIAN:"%{BKY_MATH_ONLIST_TOOLTIP_MEDIAN}",MODE:"%{BKY_MATH_ONLIST_TOOLTIP_MODE}",STD_DEV:"%{BKY_MATH_ONLIST_TOOLTIP_STD_DEV}",RANDOM:"%{BKY_MATH_ONLIST_TOOLTIP_RANDOM}"}));
99
99
  $.th("math_is_divisibleby_mutator",{mutationToDom:function(){var a=$.rc("mutation"),b=this.getFieldValue("PROPERTY")==="DIVISIBLE_BY";a.setAttribute("divisor_input",String(b));return a},domToMutation:function(a){a=a.getAttribute("divisor_input")==="true";this.updateShape_(a)},updateShape_:function(a){var b=this.getInput("DIVISOR");a?b||this.appendValueInput("DIVISOR").setCheck("Number"):b&&this.removeInput("DIVISOR")}},function(){this.getField("PROPERTY").setValidator(function(a){a=a==="DIVISIBLE_BY";
100
100
  this.getSourceBlock().updateShape_(a)})});$.oh("math_change_tooltip",$.Ah("%{BKY_MATH_CHANGE_TOOLTIP}","VAR"));
101
- $.th("math_modes_of_list_mutator",{updateType_:function(a){a==="MODE"?this.outputConnection.setCheck("Array"):this.outputConnection.setCheck("Number")},mutationToDom:function(){var a=$.rc("mutation");a.setAttribute("op",this.getFieldValue("OP"));return a},domToMutation:function(a){a=a.getAttribute("op");if(a===null)throw new TypeError("xmlElement had no op attribute");this.updateType_(a)}},function(){this.getField("OP").setValidator(function(a){this.updateType_(a)}.bind(this))});$.Ab($q);var ar={blocks:$q};var br=$.yb([{type:"controls_repeat_ext",message0:"%{BKY_CONTROLS_REPEAT_TITLE}",args0:[{type:"input_value",name:"TIMES",check:"Number",ariaLabelText:"%{BKY_INPUT_LABEL_LOOP_TIMES}"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",tooltip:"%{BKY_CONTROLS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_CONTROLS_REPEAT_HELPURL}"},{type:"controls_repeat",message0:"%{BKY_CONTROLS_REPEAT_TITLE}",args0:[{type:"field_number",
101
+ $.th("math_modes_of_list_mutator",{updateType_:function(a){a==="MODE"?this.outputConnection.setCheck("Array"):this.outputConnection.setCheck("Number")},mutationToDom:function(){var a=$.rc("mutation");a.setAttribute("op",this.getFieldValue("OP"));return a},domToMutation:function(a){a=a.getAttribute("op");if(a===null)throw new TypeError("xmlElement had no op attribute");this.updateType_(a)}},function(){this.getField("OP").setValidator(function(a){this.updateType_(a)}.bind(this))});$.Ab(ar);var br={blocks:ar};var cr=$.yb([{type:"controls_repeat_ext",message0:"%{BKY_CONTROLS_REPEAT_TITLE}",args0:[{type:"input_value",name:"TIMES",check:"Number",ariaLabelText:"%{BKY_INPUT_LABEL_LOOP_TIMES}"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",tooltip:"%{BKY_CONTROLS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_CONTROLS_REPEAT_HELPURL}"},{type:"controls_repeat",message0:"%{BKY_CONTROLS_REPEAT_TITLE}",args0:[{type:"field_number",
102
102
  name:"TIMES",value:10,min:0,precision:1,ariaLabelText:"%{BKY_INPUT_LABEL_LOOP_TIMES}"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",tooltip:"%{BKY_CONTROLS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_CONTROLS_REPEAT_HELPURL}"},{type:"controls_whileUntil",message0:"%1 %2",args0:[{type:"field_dropdown",name:"MODE",options:[["%{BKY_CONTROLS_WHILEUNTIL_OPERATOR_WHILE}","WHILE"],["%{BKY_CONTROLS_WHILEUNTIL_OPERATOR_UNTIL}",
103
103
  "UNTIL"]]},{type:"input_value",name:"BOOL",check:"Boolean",ariaLabelText:"%{BKY_INPUT_LABEL_CONDITION}"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_WHILEUNTIL_HELPURL}",extensions:["controls_whileUntil_tooltip"]},{type:"controls_for",message0:"%{BKY_CONTROLS_FOR_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:null},{type:"input_value",name:"FROM",check:"Number",
104
104
  align:"RIGHT",ariaLabelText:"%{BKY_INPUT_LABEL_LOOP_FROM}"},{type:"input_value",name:"TO",check:"Number",align:"RIGHT",ariaLabelText:"%{BKY_INPUT_LABEL_LOOP_TO}"},{type:"input_value",name:"BY",check:"Number",align:"RIGHT",ariaLabelText:"%{BKY_INPUT_LABEL_LOOP_BY}"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],inputsInline:!0,previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FOR_HELPURL}",extensions:["contextMenu_newGetVariableBlock",
@@ -106,8 +106,8 @@ align:"RIGHT",ariaLabelText:"%{BKY_INPUT_LABEL_LOOP_FROM}"},{type:"input_value",
106
106
  {type:"controls_flow_statements",message0:"%1",args0:[{type:"field_dropdown",name:"FLOW",options:[["%{BKY_CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK}","BREAK"],["%{BKY_CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE}","CONTINUE"]]}],previousStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FLOW_STATEMENTS_HELPURL}",suppressPrefixSuffix:!0,extensions:["controls_flow_tooltip","controls_flow_in_loop_check"]}]);
107
107
  $.oh("controls_whileUntil_tooltip",$.yh("MODE",{WHILE:"%{BKY_CONTROLS_WHILEUNTIL_TOOLTIP_WHILE}",UNTIL:"%{BKY_CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL}"}));$.oh("controls_flow_tooltip",$.yh("FLOW",{BREAK:"%{BKY_CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK}",CONTINUE:"%{BKY_CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE}"}));
108
108
  $.ph("contextMenu_newGetVariableBlock",{customContextMenu:function(a){if(!this.isInFlyout){var b=this.getField("VAR"),c=b.getVariable().getName();this.isCollapsed()||c===null||(b={type:"variables_get",fields:{VAR:b.saveState(!0)}},a.push({enabled:!0,text:$.C.VARIABLES_SET_CREATE_GET.replace("%1",c),callback:$.Pg(this,b)}))}}});$.oh("controls_for_tooltip",$.Ah("%{BKY_CONTROLS_FOR_TOOLTIP}","VAR"));$.oh("controls_forEach_tooltip",$.Ah("%{BKY_CONTROLS_FOREACH_TOOLTIP}","VAR"));
109
- var cr=new Set(["controls_repeat","controls_repeat_ext","controls_forEach","controls_for","controls_whileUntil"]);
110
- $.ph("controls_flow_in_loop_check",{getSurroundLoop:function(){var a=this;do{if(cr.has(a.type))return a;a=a.getSurroundParent()}while(a);return null},onchange:function(a){var b=this.workspace;if(b.isDragging&&!b.isDragging()&&(a.type===$.nm||a.type===$.Od)&&(a=!!this.getSurroundLoop(),this.setWarningText(a?null:$.C.CONTROLS_FLOW_STATEMENTS_WARNING),!this.isInFlyout))try{$.Qc=!1,this.setDisabledReason(!a,"CONTROL_FLOW_NOT_IN_LOOP")}finally{$.Qc=!0}}});$.Ab(br);var dr={blocks:br,loopTypes:cr};var er=$.yb([{type:"logic_boolean",message0:"%1",args0:[{type:"field_dropdown",name:"BOOL",options:[["%{BKY_LOGIC_BOOLEAN_TRUE}","TRUE"],["%{BKY_LOGIC_BOOLEAN_FALSE}","FALSE"]]}],output:"Boolean",style:"logic_blocks",tooltip:"%{BKY_LOGIC_BOOLEAN_TOOLTIP}",helpUrl:"%{BKY_LOGIC_BOOLEAN_HELPURL}"},{type:"controls_if",message0:"%{BKY_CONTROLS_IF_MSG_IF} %1",args0:[{type:"input_value",name:"IF0",check:"Boolean"}],message1:"%{BKY_CONTROLS_IF_MSG_THEN} %1",args1:[{type:"input_statement",name:"DO0"}],previousStatement:null,
109
+ var dr=new Set(["controls_repeat","controls_repeat_ext","controls_forEach","controls_for","controls_whileUntil"]);
110
+ $.ph("controls_flow_in_loop_check",{getSurroundLoop:function(){var a=this;do{if(dr.has(a.type))return a;a=a.getSurroundParent()}while(a);return null},onchange:function(a){var b=this.workspace;if(b.isDragging&&!b.isDragging()&&(a.type===$.om||a.type===$.Od)&&(a=!!this.getSurroundLoop(),this.setWarningText(a?null:$.C.CONTROLS_FLOW_STATEMENTS_WARNING),!this.isInFlyout))try{$.Qc=!1,this.setDisabledReason(!a,"CONTROL_FLOW_NOT_IN_LOOP")}finally{$.Qc=!0}}});$.Ab(cr);var er={blocks:cr,loopTypes:dr};var fr=$.yb([{type:"logic_boolean",message0:"%1",args0:[{type:"field_dropdown",name:"BOOL",options:[["%{BKY_LOGIC_BOOLEAN_TRUE}","TRUE"],["%{BKY_LOGIC_BOOLEAN_FALSE}","FALSE"]]}],output:"Boolean",style:"logic_blocks",tooltip:"%{BKY_LOGIC_BOOLEAN_TOOLTIP}",helpUrl:"%{BKY_LOGIC_BOOLEAN_HELPURL}"},{type:"controls_if",message0:"%{BKY_CONTROLS_IF_MSG_IF} %1",args0:[{type:"input_value",name:"IF0",check:"Boolean"}],message1:"%{BKY_CONTROLS_IF_MSG_THEN} %1",args1:[{type:"input_statement",name:"DO0"}],previousStatement:null,
111
111
  nextStatement:null,style:"logic_blocks",helpUrl:"%{BKY_CONTROLS_IF_HELPURL}",suppressPrefixSuffix:!0,mutator:"controls_if_mutator",extensions:["controls_if_tooltip"]},{type:"controls_ifelse",message0:"%{BKY_CONTROLS_IF_MSG_IF} %1",args0:[{type:"input_value",name:"IF0",check:"Boolean"}],message1:"%{BKY_CONTROLS_IF_MSG_THEN} %1",args1:[{type:"input_statement",name:"DO0"}],message2:"%{BKY_CONTROLS_IF_MSG_ELSE} %1",args2:[{type:"input_statement",name:"ELSE"}],previousStatement:null,nextStatement:null,
112
112
  style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_TOOLTIP_2}",helpUrl:"%{BKY_CONTROLS_IF_HELPURL}",suppressPrefixSuffix:!0},{type:"logic_compare",message0:"%1 %2 %3",args0:[{type:"input_value",name:"A",ariaLabelText:"%{BKY_INPUT_LABEL_VALUE_A}"},{type:"field_dropdown",name:"OP",options:[["=","EQ","%{BKY_LOGIC_COMPARE_EQ_ARIA}"],["\u2260","NEQ","%{BKY_LOGIC_COMPARE_NEQ_ARIA}"],["\u200f<","LT","%{BKY_LOGIC_COMPARE_LT_ARIA}"],["\u200f\u2264","LTE","%{BKY_LOGIC_COMPARE_LTE_ARIA}"],["\u200f>","GT","%{BKY_LOGIC_COMPARE_GT_ARIA}"],
113
113
  ["\u200f\u2265","GTE","%{BKY_LOGIC_COMPARE_GTE_ARIA}"]]},{type:"input_value",name:"B",ariaLabelText:"%{BKY_INPUT_LABEL_VALUE_B}"}],inputsInline:!0,output:"Boolean",style:"logic_blocks",helpUrl:"%{BKY_LOGIC_COMPARE_HELPURL}",extensions:["logic_compare","logic_op_tooltip"]},{type:"logic_operation",message0:"%1 %2 %3",args0:[{type:"input_value",name:"A",check:"Boolean",ariaLabelText:"%{BKY_INPUT_LABEL_CONDITION_A}"},{type:"field_dropdown",name:"OP",options:[["%{BKY_LOGIC_OPERATION_AND}","AND"],["%{BKY_LOGIC_OPERATION_OR}",
@@ -122,44 +122,44 @@ c,d)},saveConnections:function(a){a=a.nextConnection.targetBlock();for(var b=1;a
122
122
  rebuildShape_:function(){var a=[null],b=[null],c=null;this.getInput("ELSE")&&(c=this.getInput("ELSE").connection.targetConnection);for(let d=1;this.getInput("IF"+d);d++){let e=this.getInput("IF"+d),f=this.getInput("DO"+d);a.push(e.connection.targetConnection);b.push(f.connection.targetConnection)}this.updateShape_();this.reconnectChildBlocks_(a,b,c)},updateShape_:function(){this.getInput("ELSE")&&this.removeInput("ELSE");for(var a=1;this.getInput("IF"+a);a++)this.removeInput("IF"+a),this.removeInput("DO"+
123
123
  a);for(a=1;a<=this.elseifCount_;a++)this.appendValueInput("IF"+a).setCheck("Boolean").appendField($.C.CONTROLS_IF_MSG_ELSEIF),this.appendStatementInput("DO"+a).appendField($.C.CONTROLS_IF_MSG_THEN);this.elseCount_&&this.appendStatementInput("ELSE").appendField($.C.CONTROLS_IF_MSG_ELSE)},reconnectChildBlocks_:function(a,b,c){for(let d=1;d<=this.elseifCount_;d++){let e;(e=a[d])==null||e.reconnect(this,"IF"+d);let f;(f=b[d])==null||f.reconnect(this,"DO"+d)}c==null||c.reconnect(this,"ELSE")}},null,["controls_if_elseif",
124
124
  "controls_if_else"]);$.oh("controls_if_tooltip",function(){this.setTooltip(function(){if(this.elseifCount_||this.elseCount_){if(!this.elseifCount_&&this.elseCount_)return $.C.CONTROLS_IF_TOOLTIP_2;if(this.elseifCount_&&!this.elseCount_)return $.C.CONTROLS_IF_TOOLTIP_3;if(this.elseifCount_&&this.elseCount_)return $.C.CONTROLS_IF_TOOLTIP_4}else return $.C.CONTROLS_IF_TOOLTIP_1;return""}.bind(this))});
125
- var fr={onchange:function(a){this.prevBlocks_||(this.prevBlocks_=[null,null]);var b=this.getInputTargetBlock("A"),c=this.getInputTargetBlock("B");b&&c&&!this.workspace.connectionChecker.doTypeChecks(b.outputConnection,c.outputConnection)&&($.B(a.group),a=this.prevBlocks_[0],a!==b&&(b.unplug(),!a||a.isDisposed()||a.isShadow()||this.getInput("A").connection.connect(a.outputConnection)),b=this.prevBlocks_[1],b!==c&&(c.unplug(),!b||b.isDisposed()||b.isShadow()||this.getInput("B").connection.connect(b.outputConnection)),
126
- this.bumpNeighbours(),$.B(!1));this.prevBlocks_[0]=this.getInputTargetBlock("A");this.prevBlocks_[1]=this.getInputTargetBlock("B")}};$.oh("logic_compare",function(){this.mixin(fr)});
127
- $.ph("logic_ternary",{prevParentConnection_:null,onchange:function(a){var b=this.getInputTargetBlock("THEN"),c=this.getInputTargetBlock("ELSE"),d=this.outputConnection.targetConnection;if((b||c)&&d)for(let e=0;e<2;e++){let f=e===1?b:c;f&&!f.workspace.connectionChecker.doTypeChecks(f.outputConnection,d)&&($.B(a.group),d===this.prevParentConnection_?(this.unplug(),d.getSourceBlock().bumpNeighbours()):(f.unplug(),f.bumpNeighbours()),$.B(!1))}this.prevParentConnection_=d}});$.Ab(er);var gr={blocks:er};var hr=$.yb([{type:"lists_create_empty",message0:"%{BKY_LISTS_CREATE_EMPTY_TITLE}",output:"Array",style:"list_blocks",tooltip:"%{BKY_LISTS_CREATE_EMPTY_TOOLTIP}",helpUrl:"%{BKY_LISTS_CREATE_EMPTY_HELPURL}"},{type:"lists_repeat",message0:"%{BKY_LISTS_REPEAT_TITLE}",args0:[{type:"input_value",name:"ITEM",ariaLabelText:"%{BKY_INPUT_LABEL_LISTS_REPEAT_ITEM}"},{type:"input_value",name:"NUM",check:"Number",ariaLabelText:"%{BKY_INPUT_LABEL_LISTS_REPEAT_NUM}"}],output:"Array",style:"list_blocks",tooltip:"%{BKY_LISTS_REPEAT_TOOLTIP}",
125
+ var gr={onchange:function(a){this.prevBlocks_||(this.prevBlocks_=[null,null]);var b=this.getInputTargetBlock("A"),c=this.getInputTargetBlock("B");b&&c&&!this.workspace.connectionChecker.doTypeChecks(b.outputConnection,c.outputConnection)&&($.B(a.group),a=this.prevBlocks_[0],a!==b&&(b.unplug(),!a||a.isDisposed()||a.isShadow()||this.getInput("A").connection.connect(a.outputConnection)),b=this.prevBlocks_[1],b!==c&&(c.unplug(),!b||b.isDisposed()||b.isShadow()||this.getInput("B").connection.connect(b.outputConnection)),
126
+ this.bumpNeighbours(),$.B(!1));this.prevBlocks_[0]=this.getInputTargetBlock("A");this.prevBlocks_[1]=this.getInputTargetBlock("B")}};$.oh("logic_compare",function(){this.mixin(gr)});
127
+ $.ph("logic_ternary",{prevParentConnection_:null,onchange:function(a){var b=this.getInputTargetBlock("THEN"),c=this.getInputTargetBlock("ELSE"),d=this.outputConnection.targetConnection;if((b||c)&&d)for(let e=0;e<2;e++){let f=e===1?b:c;f&&!f.workspace.connectionChecker.doTypeChecks(f.outputConnection,d)&&($.B(a.group),d===this.prevParentConnection_?(this.unplug(),d.getSourceBlock().bumpNeighbours()):(f.unplug(),f.bumpNeighbours()),$.B(!1))}this.prevParentConnection_=d}});$.Ab(fr);var hr={blocks:fr};var ir=$.yb([{type:"lists_create_empty",message0:"%{BKY_LISTS_CREATE_EMPTY_TITLE}",output:"Array",style:"list_blocks",tooltip:"%{BKY_LISTS_CREATE_EMPTY_TOOLTIP}",helpUrl:"%{BKY_LISTS_CREATE_EMPTY_HELPURL}"},{type:"lists_repeat",message0:"%{BKY_LISTS_REPEAT_TITLE}",args0:[{type:"input_value",name:"ITEM",ariaLabelText:"%{BKY_INPUT_LABEL_LISTS_REPEAT_ITEM}"},{type:"input_value",name:"NUM",check:"Number",ariaLabelText:"%{BKY_INPUT_LABEL_LISTS_REPEAT_NUM}"}],output:"Array",style:"list_blocks",tooltip:"%{BKY_LISTS_REPEAT_TOOLTIP}",
128
128
  helpUrl:"%{BKY_LISTS_REPEAT_HELPURL}"},{type:"lists_reverse",message0:"%{BKY_LISTS_REVERSE_MESSAGE0}",args0:[{type:"input_value",name:"LIST",check:"Array",ariaLabelText:"%{BKY_INPUT_LABEL_LISTS_TO_CHANGE}"}],output:"Array",inputsInline:!0,style:"list_blocks",tooltip:"%{BKY_LISTS_REVERSE_TOOLTIP}",helpUrl:"%{BKY_LISTS_REVERSE_HELPURL}"},{type:"lists_isEmpty",message0:"%{BKY_LISTS_ISEMPTY_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"],ariaLabelText:"%{BKY_INPUT_LABEL_LISTS_TO_CHECK}"}],
129
129
  output:"Boolean",style:"list_blocks",tooltip:"%{BKY_LISTS_ISEMPTY_TOOLTIP}",helpUrl:"%{BKY_LISTS_ISEMPTY_HELPURL}"},{type:"lists_length",message0:"%{BKY_LISTS_LENGTH_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"],ariaLabelText:"%{BKY_INPUT_LABEL_LISTS_TO_CHECK}"}],output:"Number",style:"list_blocks",tooltip:"%{BKY_LISTS_LENGTH_TOOLTIP}",helpUrl:"%{BKY_LISTS_LENGTH_HELPURL}"}]);
130
- hr.lists_create_with={init:function(){this.setHelpUrl($.C.LISTS_CREATE_WITH_HELPURL);this.setStyle("list_blocks");this.itemCount_=3;this.updateShape_();this.setOutput(!0,"Array");this.setMutator(new $.sh(["lists_create_with_item"],this));this.setTooltip($.C.LISTS_CREATE_WITH_TOOLTIP)},mutationToDom:function(){var a=$.rc("mutation");a.setAttribute("items",String(this.itemCount_));return a},domToMutation:function(a){a=a.getAttribute("items");if(!a)throw new TypeError("element did not have items");this.itemCount_=
130
+ ir.lists_create_with={init:function(){this.setHelpUrl($.C.LISTS_CREATE_WITH_HELPURL);this.setStyle("list_blocks");this.itemCount_=3;this.updateShape_();this.setOutput(!0,"Array");this.setMutator(new $.sh(["lists_create_with_item"],this));this.setTooltip($.C.LISTS_CREATE_WITH_TOOLTIP)},mutationToDom:function(){var a=$.rc("mutation");a.setAttribute("items",String(this.itemCount_));return a},domToMutation:function(a){a=a.getAttribute("items");if(!a)throw new TypeError("element did not have items");this.itemCount_=
131
131
  parseInt(a,10);this.updateShape_()},saveExtraState:function(){return{itemCount:this.itemCount_}},loadExtraState:function(a){this.itemCount_=a.itemCount;this.updateShape_()},decompose:function(a){var b=a.newBlock("lists_create_with_container");b.initSvg();var c=b.getInput("STACK").connection;for(let d=0;d<this.itemCount_;d++){let e=a.newBlock("lists_create_with_item");e.initSvg();if(!e.previousConnection)throw Error("itemBlock has no previousConnection");c.connect(e.previousConnection);c=e.nextConnection}return b},
132
132
  compose:function(a){var b=a.getInputTargetBlock("STACK");for(a=[];b;)b.isInsertionMarker()||a.push(b.valueConnection_),b=b.getNextBlock();for(b=0;b<this.itemCount_;b++){let c=this.getInput("ADD"+b).connection.targetConnection;c&&!a.includes(c)&&c.disconnect()}this.itemCount_=a.length;this.updateShape_();for(b=0;b<this.itemCount_;b++){let c;(c=a[b])==null||c.reconnect(this,"ADD"+b)}},saveConnections:function(a){a=a.getInputTargetBlock("STACK");for(var b=0;a;){if(a.isInsertionMarker()){a=a.getNextBlock();
133
- continue}let c=this.getInput("ADD"+b);a.valueConnection_=c==null?void 0:c.connection.targetConnection;a=a.getNextBlock();b++}},updateShape_:function(){this.itemCount_&&this.getInput("EMPTY")?this.removeInput("EMPTY"):this.itemCount_||this.getInput("EMPTY")||this.appendDummyInput("EMPTY").appendField($.C.LISTS_CREATE_EMPTY_TITLE);for(var a=0;a<this.itemCount_;a++)if(!this.getInput("ADD"+a)){let b=this.appendValueInput("ADD"+a).setAlign($.En.RIGHT).setAriaLabelProvider($.C.INPUT_LABEL_LISTS_CREATE_WITH_ITEM.replace("%1",
134
- String(a+1)));a===0&&b.appendField($.C.LISTS_CREATE_WITH_INPUT_WITH)}for(a=this.itemCount_;this.getInput("ADD"+a);a++)this.removeInput("ADD"+a)}};hr.lists_create_with_container={init:function(){this.setStyle("list_blocks");this.appendDummyInput().appendField($.C.LISTS_CREATE_WITH_CONTAINER_TITLE_ADD);this.appendStatementInput("STACK");this.setTooltip($.C.LISTS_CREATE_WITH_CONTAINER_TOOLTIP);this.contextMenu=!1}};
135
- hr.lists_create_with_item={init:function(){this.setStyle("list_blocks");this.appendDummyInput().appendField($.C.LISTS_CREATE_WITH_ITEM_TITLE);this.setPreviousStatement(!0);this.setNextStatement(!0);this.setTooltip($.C.LISTS_CREATE_WITH_ITEM_TOOLTIP);this.contextMenu=!1}};
136
- hr.lists_indexOf={init:function(){var a=[[$.C.LISTS_INDEX_OF_FIRST,"FIRST"],[$.C.LISTS_INDEX_OF_LAST,"LAST"]];this.setHelpUrl($.C.LISTS_INDEX_OF_HELPURL);this.setStyle("list_blocks");this.setOutput(!0,"Number");this.appendValueInput("VALUE").setCheck("Array").appendField($.C.LISTS_INDEX_OF_INPUT_IN_LIST).setAriaLabelProvider($.C.INPUT_LABEL_LISTS_TO_CHECK);a=$.lh({type:"field_dropdown",options:a});if(!a)throw Error("field_dropdown not found");this.appendValueInput("FIND").appendField(a,"END");this.setInputsInline(!0);
133
+ continue}let c=this.getInput("ADD"+b);a.valueConnection_=c==null?void 0:c.connection.targetConnection;a=a.getNextBlock();b++}},updateShape_:function(){this.itemCount_&&this.getInput("EMPTY")?this.removeInput("EMPTY"):this.itemCount_||this.getInput("EMPTY")||this.appendDummyInput("EMPTY").appendField($.C.LISTS_CREATE_EMPTY_TITLE);for(var a=0;a<this.itemCount_;a++)if(!this.getInput("ADD"+a)){let b=this.appendValueInput("ADD"+a).setAlign($.Fn.RIGHT).setAriaLabelProvider($.C.INPUT_LABEL_LISTS_CREATE_WITH_ITEM.replace("%1",
134
+ String(a+1)));a===0&&b.appendField($.C.LISTS_CREATE_WITH_INPUT_WITH)}for(a=this.itemCount_;this.getInput("ADD"+a);a++)this.removeInput("ADD"+a)}};ir.lists_create_with_container={init:function(){this.setStyle("list_blocks");this.appendDummyInput().appendField($.C.LISTS_CREATE_WITH_CONTAINER_TITLE_ADD);this.appendStatementInput("STACK");this.setTooltip($.C.LISTS_CREATE_WITH_CONTAINER_TOOLTIP);this.contextMenu=!1}};
135
+ ir.lists_create_with_item={init:function(){this.setStyle("list_blocks");this.appendDummyInput().appendField($.C.LISTS_CREATE_WITH_ITEM_TITLE);this.setPreviousStatement(!0);this.setNextStatement(!0);this.setTooltip($.C.LISTS_CREATE_WITH_ITEM_TOOLTIP);this.contextMenu=!1}};
136
+ ir.lists_indexOf={init:function(){var a=[[$.C.LISTS_INDEX_OF_FIRST,"FIRST"],[$.C.LISTS_INDEX_OF_LAST,"LAST"]];this.setHelpUrl($.C.LISTS_INDEX_OF_HELPURL);this.setStyle("list_blocks");this.setOutput(!0,"Number");this.appendValueInput("VALUE").setCheck("Array").appendField($.C.LISTS_INDEX_OF_INPUT_IN_LIST).setAriaLabelProvider($.C.INPUT_LABEL_LISTS_TO_CHECK);a=$.lh({type:"field_dropdown",options:a});if(!a)throw Error("field_dropdown not found");this.appendValueInput("FIND").appendField(a,"END");this.setInputsInline(!0);
137
137
  this.setTooltip(()=>$.C.LISTS_INDEX_OF_TOOLTIP.replace("%1",this.workspace.options.oneBasedIndex?"0":"-1"))}};
138
- hr.lists_getIndex={init:function(){var a=[[$.C.LISTS_GET_INDEX_GET,"GET"],[$.C.LISTS_GET_INDEX_GET_REMOVE,"GET_REMOVE"],[$.C.LISTS_GET_INDEX_REMOVE,"REMOVE"]];this.WHERE_OPTIONS=[[$.C.LISTS_GET_INDEX_FROM_START,"FROM_START"],[$.C.LISTS_GET_INDEX_FROM_END,"FROM_END"],[$.C.LISTS_GET_INDEX_FIRST,"FIRST"],[$.C.LISTS_GET_INDEX_LAST,"LAST"],[$.C.LISTS_GET_INDEX_RANDOM,"RANDOM"]];this.setHelpUrl($.C.LISTS_GET_INDEX_HELPURL);this.setStyle("list_blocks");a=$.lh({type:"field_dropdown",options:a});a.setValidator(function(b){b=
138
+ ir.lists_getIndex={init:function(){var a=[[$.C.LISTS_GET_INDEX_GET,"GET"],[$.C.LISTS_GET_INDEX_GET_REMOVE,"GET_REMOVE"],[$.C.LISTS_GET_INDEX_REMOVE,"REMOVE"]];this.WHERE_OPTIONS=[[$.C.LISTS_GET_INDEX_FROM_START,"FROM_START"],[$.C.LISTS_GET_INDEX_FROM_END,"FROM_END"],[$.C.LISTS_GET_INDEX_FIRST,"FIRST"],[$.C.LISTS_GET_INDEX_LAST,"LAST"],[$.C.LISTS_GET_INDEX_RANDOM,"RANDOM"]];this.setHelpUrl($.C.LISTS_GET_INDEX_HELPURL);this.setStyle("list_blocks");a=$.lh({type:"field_dropdown",options:a});a.setValidator(function(b){b=
139
139
  b==="REMOVE";this.getSourceBlock().updateStatement_(b)});this.appendValueInput("VALUE").setCheck("Array").appendField($.C.LISTS_GET_INDEX_INPUT_IN_LIST).setAriaLabelProvider($.C.INPUT_LABEL_LISTS_TO_CHECK);this.appendDummyInput().appendField(a,"MODE").appendField("","SPACE");a=$.lh({type:"field_dropdown",options:this.WHERE_OPTIONS});a.setValidator(function(b){var c=this.getValue();b=b==="FROM_START"||b==="FROM_END";b!==(c==="FROM_START"||c==="FROM_END")&&this.getSourceBlock().updateAt_(b)});this.appendDummyInput().appendField(a,
140
140
  "WHERE");this.appendDummyInput("AT");$.C.LISTS_GET_INDEX_TAIL&&this.appendDummyInput("TAIL").appendField($.C.LISTS_GET_INDEX_TAIL);this.setInputsInline(!0);this.setOutput(!0);this.updateAt_(!0);this.setTooltip(()=>{var b=this.getFieldValue("MODE"),c=this.getFieldValue("WHERE"),d="";switch(b+" "+c){case "GET FROM_START":case "GET FROM_END":d=$.C.LISTS_GET_INDEX_TOOLTIP_GET_FROM;break;case "GET FIRST":d=$.C.LISTS_GET_INDEX_TOOLTIP_GET_FIRST;break;case "GET LAST":d=$.C.LISTS_GET_INDEX_TOOLTIP_GET_LAST;
141
141
  break;case "GET RANDOM":d=$.C.LISTS_GET_INDEX_TOOLTIP_GET_RANDOM;break;case "GET_REMOVE FROM_START":case "GET_REMOVE FROM_END":d=$.C.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM;break;case "GET_REMOVE FIRST":d=$.C.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FIRST;break;case "GET_REMOVE LAST":d=$.C.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_LAST;break;case "GET_REMOVE RANDOM":d=$.C.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_RANDOM;break;case "REMOVE FROM_START":case "REMOVE FROM_END":d=$.C.LISTS_GET_INDEX_TOOLTIP_REMOVE_FROM;break;
142
142
  case "REMOVE FIRST":d=$.C.LISTS_GET_INDEX_TOOLTIP_REMOVE_FIRST;break;case "REMOVE LAST":d=$.C.LISTS_GET_INDEX_TOOLTIP_REMOVE_LAST;break;case "REMOVE RANDOM":d=$.C.LISTS_GET_INDEX_TOOLTIP_REMOVE_RANDOM}if(c==="FROM_START"||c==="FROM_END")d+=" "+(c==="FROM_START"?$.C.LISTS_INDEX_FROM_START_TOOLTIP:$.C.LISTS_INDEX_FROM_END_TOOLTIP).replace("%1",this.workspace.options.oneBasedIndex?"#1":"#0");return d})},mutationToDom:function(){var a=$.rc("mutation");a.setAttribute("statement",String(!this.outputConnection));
143
- var b=this.getInput("AT")instanceof $.Nn;a.setAttribute("at",String(b));return a},domToMutation:function(a){var b=a.getAttribute("statement")==="true";this.updateStatement_(b);a=a.getAttribute("at")!=="false";this.updateAt_(a)},saveExtraState:function(){return this.outputConnection?null:{isStatement:!0}},loadExtraState:function(a){a.isStatement?this.updateStatement_(!0):typeof a==="string"&&this.domToMutation($.uc(a))},updateStatement_:function(a){a!==!this.outputConnection&&(this.unplug(!0,!0),a?
143
+ var b=this.getInput("AT")instanceof $.On;a.setAttribute("at",String(b));return a},domToMutation:function(a){var b=a.getAttribute("statement")==="true";this.updateStatement_(b);a=a.getAttribute("at")!=="false";this.updateAt_(a)},saveExtraState:function(){return this.outputConnection?null:{isStatement:!0}},loadExtraState:function(a){a.isStatement?this.updateStatement_(!0):typeof a==="string"&&this.domToMutation($.uc(a))},updateStatement_:function(a){a!==!this.outputConnection&&(this.unplug(!0,!0),a?
144
144
  (this.setOutput(!1),this.setPreviousStatement(!0),this.setNextStatement(!0)):(this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0)))},updateAt_:function(a){this.removeInput("AT");this.removeInput("ORDINAL",!0);a?(this.appendValueInput("AT").setCheck("Number").setAriaLabelProvider($.C.INPUT_LABEL_LISTS_POSITION),$.C.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL").appendField($.C.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT");$.C.LISTS_GET_INDEX_TAIL&&this.moveInputBefore("TAIL",
145
145
  null)}};
146
- hr.lists_setIndex={init:function(){var a=[[$.C.LISTS_SET_INDEX_SET,"SET"],[$.C.LISTS_SET_INDEX_INSERT,"INSERT"]];this.WHERE_OPTIONS=[[$.C.LISTS_GET_INDEX_FROM_START,"FROM_START"],[$.C.LISTS_GET_INDEX_FROM_END,"FROM_END"],[$.C.LISTS_GET_INDEX_FIRST,"FIRST"],[$.C.LISTS_GET_INDEX_LAST,"LAST"],[$.C.LISTS_GET_INDEX_RANDOM,"RANDOM"]];this.setHelpUrl($.C.LISTS_SET_INDEX_HELPURL);this.setStyle("list_blocks");this.appendValueInput("LIST").setCheck("Array").appendField($.C.LISTS_SET_INDEX_INPUT_IN_LIST).setAriaLabelProvider($.C.INPUT_LABEL_LISTS_TO_CHECK);a=
146
+ ir.lists_setIndex={init:function(){var a=[[$.C.LISTS_SET_INDEX_SET,"SET"],[$.C.LISTS_SET_INDEX_INSERT,"INSERT"]];this.WHERE_OPTIONS=[[$.C.LISTS_GET_INDEX_FROM_START,"FROM_START"],[$.C.LISTS_GET_INDEX_FROM_END,"FROM_END"],[$.C.LISTS_GET_INDEX_FIRST,"FIRST"],[$.C.LISTS_GET_INDEX_LAST,"LAST"],[$.C.LISTS_GET_INDEX_RANDOM,"RANDOM"]];this.setHelpUrl($.C.LISTS_SET_INDEX_HELPURL);this.setStyle("list_blocks");this.appendValueInput("LIST").setCheck("Array").appendField($.C.LISTS_SET_INDEX_INPUT_IN_LIST).setAriaLabelProvider($.C.INPUT_LABEL_LISTS_TO_CHECK);a=
147
147
  $.lh({type:"field_dropdown",options:a});this.appendDummyInput().appendField(a,"MODE").appendField("","SPACE");a=$.lh({type:"field_dropdown",options:this.WHERE_OPTIONS});a.setValidator(function(b){var c=this.getValue();b=b==="FROM_START"||b==="FROM_END";b!==(c==="FROM_START"||c==="FROM_END")&&this.getSourceBlock().updateAt_(b)});this.appendDummyInput().appendField(a,"WHERE");this.appendDummyInput("AT");this.appendValueInput("TO").appendField($.C.LISTS_SET_INDEX_INPUT_TO).setAriaLabelProvider($.C.INPUT_LABEL_LISTS_VALUE_TO_SET);
148
148
  this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0);this.setTooltip($.C.LISTS_SET_INDEX_TOOLTIP);this.updateAt_(!0);this.setTooltip(()=>{var b=this.getFieldValue("MODE"),c=this.getFieldValue("WHERE"),d="";switch(b+" "+c){case "SET FROM_START":case "SET FROM_END":d=$.C.LISTS_SET_INDEX_TOOLTIP_SET_FROM;break;case "SET FIRST":d=$.C.LISTS_SET_INDEX_TOOLTIP_SET_FIRST;break;case "SET LAST":d=$.C.LISTS_SET_INDEX_TOOLTIP_SET_LAST;break;case "SET RANDOM":d=$.C.LISTS_SET_INDEX_TOOLTIP_SET_RANDOM;
149
149
  break;case "INSERT FROM_START":case "INSERT FROM_END":d=$.C.LISTS_SET_INDEX_TOOLTIP_INSERT_FROM;break;case "INSERT FIRST":d=$.C.LISTS_SET_INDEX_TOOLTIP_INSERT_FIRST;break;case "INSERT LAST":d=$.C.LISTS_SET_INDEX_TOOLTIP_INSERT_LAST;break;case "INSERT RANDOM":d=$.C.LISTS_SET_INDEX_TOOLTIP_INSERT_RANDOM}if(c==="FROM_START"||c==="FROM_END")d+=" "+$.C.LISTS_INDEX_FROM_START_TOOLTIP.replace("%1",this.workspace.options.oneBasedIndex?"#1":"#0");return d})},mutationToDom:function(){var a=$.rc("mutation"),
150
- b=this.getInput("AT")instanceof $.Nn;a.setAttribute("at",String(b));return a},domToMutation:function(a){a=a.getAttribute("at")!=="false";this.updateAt_(a)},saveExtraState:function(){return null},loadExtraState:function(){},updateAt_:function(a){this.removeInput("AT");this.removeInput("ORDINAL",!0);a?(this.appendValueInput("AT").setCheck("Number").setAriaLabelProvider($.C.INPUT_LABEL_LISTS_POSITION),$.C.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL").appendField($.C.ORDINAL_NUMBER_SUFFIX)):
150
+ b=this.getInput("AT")instanceof $.On;a.setAttribute("at",String(b));return a},domToMutation:function(a){a=a.getAttribute("at")!=="false";this.updateAt_(a)},saveExtraState:function(){return null},loadExtraState:function(){},updateAt_:function(a){this.removeInput("AT");this.removeInput("ORDINAL",!0);a?(this.appendValueInput("AT").setCheck("Number").setAriaLabelProvider($.C.INPUT_LABEL_LISTS_POSITION),$.C.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL").appendField($.C.ORDINAL_NUMBER_SUFFIX)):
151
151
  this.appendDummyInput("AT");this.moveInputBefore("AT","TO");this.getInput("ORDINAL")&&this.moveInputBefore("ORDINAL","TO")}};
152
- hr.lists_getSublist={init:function(){this.WHERE_OPTIONS_1=[[$.C.LISTS_GET_SUBLIST_START_FROM_START,"FROM_START"],[$.C.LISTS_GET_SUBLIST_START_FROM_END,"FROM_END"],[$.C.LISTS_GET_SUBLIST_START_FIRST,"FIRST"]];this.WHERE_OPTIONS_2=[[$.C.LISTS_GET_SUBLIST_END_FROM_START,"FROM_START"],[$.C.LISTS_GET_SUBLIST_END_FROM_END,"FROM_END"],[$.C.LISTS_GET_SUBLIST_END_LAST,"LAST"]];this.setHelpUrl($.C.LISTS_GET_SUBLIST_HELPURL);this.setStyle("list_blocks");this.appendValueInput("LIST").setCheck("Array").appendField($.C.LISTS_GET_SUBLIST_INPUT_IN_LIST).setAriaLabelProvider($.C.INPUT_LABEL_LISTS_TO_CHECK);
152
+ ir.lists_getSublist={init:function(){this.WHERE_OPTIONS_1=[[$.C.LISTS_GET_SUBLIST_START_FROM_START,"FROM_START"],[$.C.LISTS_GET_SUBLIST_START_FROM_END,"FROM_END"],[$.C.LISTS_GET_SUBLIST_START_FIRST,"FIRST"]];this.WHERE_OPTIONS_2=[[$.C.LISTS_GET_SUBLIST_END_FROM_START,"FROM_START"],[$.C.LISTS_GET_SUBLIST_END_FROM_END,"FROM_END"],[$.C.LISTS_GET_SUBLIST_END_LAST,"LAST"]];this.setHelpUrl($.C.LISTS_GET_SUBLIST_HELPURL);this.setStyle("list_blocks");this.appendValueInput("LIST").setCheck("Array").appendField($.C.LISTS_GET_SUBLIST_INPUT_IN_LIST).setAriaLabelProvider($.C.INPUT_LABEL_LISTS_TO_CHECK);
153
153
  var a=b=>{var c=$.lh({type:"field_dropdown",options:this["WHERE_OPTIONS_"+b]});c.setValidator(function(d){var e=this.getValue();d=d==="FROM_START"||d==="FROM_END";d!==(e==="FROM_START"||e==="FROM_END")&&this.getSourceBlock().updateAt_(b,d)});return c};this.appendDummyInput("WHERE1_INPUT").appendField(a(1),"WHERE1");this.appendDummyInput("AT1");this.appendDummyInput("WHERE2_INPUT").appendField(a(2),"WHERE2");this.appendDummyInput("AT2");$.C.LISTS_GET_SUBLIST_TAIL&&this.appendDummyInput("TAIL").appendField($.C.LISTS_GET_SUBLIST_TAIL);
154
- this.setInputsInline(!0);this.setOutput(!0,"Array");this.updateAt_(1,!0);this.updateAt_(2,!0);this.setTooltip($.C.LISTS_GET_SUBLIST_TOOLTIP)},mutationToDom:function(){var a=$.rc("mutation"),b=this.getInput("AT1")instanceof $.Nn;a.setAttribute("at1",String(b));b=this.getInput("AT2")instanceof $.Nn;a.setAttribute("at2",String(b));return a},domToMutation:function(a){var b=a.getAttribute("at1")==="true";a=a.getAttribute("at2")==="true";this.updateAt_(1,b);this.updateAt_(2,a)},saveExtraState:function(){return null},
154
+ this.setInputsInline(!0);this.setOutput(!0,"Array");this.updateAt_(1,!0);this.updateAt_(2,!0);this.setTooltip($.C.LISTS_GET_SUBLIST_TOOLTIP)},mutationToDom:function(){var a=$.rc("mutation"),b=this.getInput("AT1")instanceof $.On;a.setAttribute("at1",String(b));b=this.getInput("AT2")instanceof $.On;a.setAttribute("at2",String(b));return a},domToMutation:function(a){var b=a.getAttribute("at1")==="true";a=a.getAttribute("at2")==="true";this.updateAt_(1,b);this.updateAt_(2,a)},saveExtraState:function(){return null},
155
155
  loadExtraState:function(){},updateAt_:function(a,b){this.removeInput("AT"+a);this.removeInput("ORDINAL"+a,!0);b?(this.appendValueInput("AT"+a).setCheck("Number").setAriaLabelProvider(a===1?$.C.INPUT_LABEL_LISTS_START_POSITION:$.C.INPUT_LABEL_LISTS_END_POSITION),$.C.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL"+a).appendField($.C.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT"+a);a===1&&(this.moveInputBefore("AT1","WHERE2_INPUT"),this.getInput("ORDINAL1")&&this.moveInputBefore("ORDINAL1",
156
156
  "WHERE2_INPUT"));$.C.LISTS_GET_SUBLIST_TAIL&&this.moveInputBefore("TAIL",null)}};
157
- hr.lists_sort={init:function(){this.jsonInit({message0:"%{BKY_LISTS_SORT_TITLE}",args0:[{type:"field_dropdown",name:"TYPE",options:[["%{BKY_LISTS_SORT_TYPE_NUMERIC}","NUMERIC"],["%{BKY_LISTS_SORT_TYPE_TEXT}","TEXT"],["%{BKY_LISTS_SORT_TYPE_IGNORECASE}","IGNORE_CASE"]]},{type:"field_dropdown",name:"DIRECTION",options:[["%{BKY_LISTS_SORT_ORDER_ASCENDING}","1"],["%{BKY_LISTS_SORT_ORDER_DESCENDING}","-1"]]},{type:"input_value",name:"LIST",check:"Array",ariaLabelText:$.C.INPUT_LABEL_LISTS_TO_CHANGE}],
157
+ ir.lists_sort={init:function(){this.jsonInit({message0:"%{BKY_LISTS_SORT_TITLE}",args0:[{type:"field_dropdown",name:"TYPE",options:[["%{BKY_LISTS_SORT_TYPE_NUMERIC}","NUMERIC"],["%{BKY_LISTS_SORT_TYPE_TEXT}","TEXT"],["%{BKY_LISTS_SORT_TYPE_IGNORECASE}","IGNORE_CASE"]]},{type:"field_dropdown",name:"DIRECTION",options:[["%{BKY_LISTS_SORT_ORDER_ASCENDING}","1"],["%{BKY_LISTS_SORT_ORDER_DESCENDING}","-1"]]},{type:"input_value",name:"LIST",check:"Array",ariaLabelText:$.C.INPUT_LABEL_LISTS_TO_CHANGE}],
158
158
  output:"Array",style:"list_blocks",tooltip:"%{BKY_LISTS_SORT_TOOLTIP}",helpUrl:"%{BKY_LISTS_SORT_HELPURL}"})}};
159
- hr.lists_split={init:function(){var a=$.lh({type:"field_dropdown",options:[[$.C.LISTS_SPLIT_LIST_FROM_TEXT,"SPLIT"],[$.C.LISTS_SPLIT_TEXT_FROM_LIST,"JOIN"]]});if(!a)throw Error("field_dropdown not found");a.setValidator(b=>{this.updateType_(b)});this.setHelpUrl($.C.LISTS_SPLIT_HELPURL);this.setStyle("list_blocks");this.appendValueInput("INPUT").setCheck("String").appendField(a,"MODE").setAriaLabelProvider(()=>{var b=this.getFieldValue("MODE");if(b==="SPLIT")return $.C.INPUT_LABEL_LISTS_LIST_FROM_TEXT;
159
+ ir.lists_split={init:function(){var a=$.lh({type:"field_dropdown",options:[[$.C.LISTS_SPLIT_LIST_FROM_TEXT,"SPLIT"],[$.C.LISTS_SPLIT_TEXT_FROM_LIST,"JOIN"]]});if(!a)throw Error("field_dropdown not found");a.setValidator(b=>{this.updateType_(b)});this.setHelpUrl($.C.LISTS_SPLIT_HELPURL);this.setStyle("list_blocks");this.appendValueInput("INPUT").setCheck("String").appendField(a,"MODE").setAriaLabelProvider(()=>{var b=this.getFieldValue("MODE");if(b==="SPLIT")return $.C.INPUT_LABEL_LISTS_LIST_FROM_TEXT;
160
160
  if(b==="JOIN")return $.C.INPUT_LABEL_LISTS_TEXT_FROM_LIST});this.appendValueInput("DELIM").setCheck("String").appendField($.C.INPUT_LABEL_LISTS_DELIMITER).setAriaLabelProvider($.C.INPUT_LABEL_LISTS_SPLIT_WITH_DELIMITER);this.setInputsInline(!0);this.setOutput(!0,"Array");this.setTooltip(()=>{var b=this.getFieldValue("MODE");if(b==="SPLIT")return $.C.LISTS_SPLIT_TOOLTIP_SPLIT;if(b==="JOIN")return $.C.LISTS_SPLIT_TOOLTIP_JOIN;throw Error("Unknown mode: "+b);})},updateType_:function(a){if(this.getFieldValue("MODE")!==
161
161
  a){let b=this.getInput("INPUT").connection;b.setShadowDom(null);let c=b.targetBlock();c&&(b.disconnect(),c.isShadow()?c.dispose(!1):this.bumpNeighbours())}a==="SPLIT"?(this.outputConnection.setCheck("Array"),this.getInput("INPUT").setCheck("String")):(this.outputConnection.setCheck("String"),this.getInput("INPUT").setCheck("Array"))},mutationToDom:function(){var a=$.rc("mutation");a.setAttribute("mode",this.getFieldValue("MODE"));return a},domToMutation:function(a){this.updateType_(a.getAttribute("mode"))},
162
- saveExtraState:function(){return{mode:this.getFieldValue("MODE")}},loadExtraState:function(a){this.updateType_(a.mode)}};$.Ab(hr);var ir={blocks:hr};var jr={blocks:Object.assign({},hr,er,br,$q,Vq,Rq,Pq,Nq),lists:ir,logic:gr,loops:dr,math:ar,procedures:Zq,texts:Uq,variables:Qq,variablesDynamic:Oq};$.__chunk_blocks=jr;
162
+ saveExtraState:function(){return{mode:this.getFieldValue("MODE")}},loadExtraState:function(a){this.updateType_(a.mode)}};$.Ab(ir);var jr={blocks:ir};var kr={blocks:Object.assign({},ir,fr,cr,ar,Wq,Sq,Qq,Oq),lists:jr,logic:hr,loops:er,math:br,procedures:$q,texts:Vq,variables:Rq,variablesDynamic:Pq};$.__chunk_blocks=kr;
163
163
  $.__chunk_blocks.__namespace__=$;
164
164
  return $.__chunk_blocks;
165
165
  }));
@@ -145,6 +145,11 @@ export declare class FocusManager {
145
145
  * focus.
146
146
  */
147
147
  getFocusedNode(): IFocusableNode | null;
148
+ /**
149
+ * Returns the IFocusableNode that held focus immediately before the current
150
+ * focused node, or null if there is no such node.
151
+ */
152
+ getPreviouslyFocusedNode(): IFocusableNode | null;
148
153
  /**
149
154
  * Focuses the specific IFocusableTree. This either means restoring active
150
155
  * focus to the tree's passively focused node, or focusing the tree's root
@@ -13,6 +13,15 @@ import { BottomRow } from './measurables/bottom_row.js';
13
13
  import { RightConnectionShape } from './measurables/row_elements.js';
14
14
  import { TopRow } from './measurables/top_row.js';
15
15
  import type { Renderer } from './renderer.js';
16
+ /**
17
+ * Horizontal inset from a round output-cap tip needed so content at the given
18
+ * vertical distance from the centerline stays inside the circle.
19
+ *
20
+ * @param radius Round cap radius (dynamic connection width).
21
+ * @param distanceFromCenter Vertical distance from the cap centerline.
22
+ * @returns Clearance from the tip to the content edge.
23
+ */
24
+ export declare function roundCapClearance(radius: number, distanceFromCenter: number): number;
16
25
  /**
17
26
  * An object containing all sizing information needed to draw this block.
18
27
  *
@@ -164,6 +164,12 @@ export declare enum State {
164
164
  * Value: one of {polite, assertive, off}.
165
165
  */
166
166
  LIVE = "live",
167
+ /**
168
+ * See https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-pressed.
169
+ *
170
+ * Value: one of {true, false, mixed, undefined}.
171
+ */
172
+ PRESSED = "pressed",
167
173
  /**
168
174
  * See https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-roledescription.
169
175
  *
@@ -12,25 +12,25 @@
12
12
  }
13
13
  }(this, function(__parent__) {
14
14
  var $=__parent__.__namespace__;
15
- var Os=function(a,b){var c=0,d="";b.STATEMENT_PREFIX&&(d+=b.injectId(b.STATEMENT_PREFIX,a));do{var e=b.valueToCode(a,"IF"+c,Z.NONE)||"false";var f=b.statementToCode(a,"DO"+c);b.STATEMENT_SUFFIX&&(f=b.prefixLines(b.injectId(b.STATEMENT_SUFFIX,a),b.INDENT)+f);d+=(c>0?"else ":"")+"if ("+e+") {\n"+f+"}";c++}while(a.getInput("IF"+c));if(a.getInput("ELSE")||b.STATEMENT_SUFFIX)f=a.getInput("ELSE")?b.statementToCode(a,"ELSE"):"",b.STATEMENT_SUFFIX&&(f=b.prefixLines(b.injectId(b.STATEMENT_SUFFIX,a),b.INDENT)+
16
- f),d+=" else {\n"+f+"}";return d+"\n"},Ps=function(a,b){var c=a.getField("TIMES")?String(Number(a.getFieldValue("TIMES"))):b.valueToCode(a,"TIMES",Z.ASSIGNMENT)||"0";var d=b.statementToCode(a,"DO");d=b.addLoopTrap(d,a);a="";var e=b.nameDB_.getDistinctName("count",$.P.VARIABLE),f=c;c.match(/^\w+$/)||$.zf(c)||(f=b.nameDB_.getDistinctName("repeat_end",$.P.VARIABLE),a+="var "+f+" = "+c+";\n");return a+("for (int "+e+" = 0; "+e+" < "+f+"; "+e+"++) {\n"+d+"}\n")},Qs=function(a,b){var c=a.getFieldValue("OP");
15
+ var Ps=function(a,b){var c=0,d="";b.STATEMENT_PREFIX&&(d+=b.injectId(b.STATEMENT_PREFIX,a));do{var e=b.valueToCode(a,"IF"+c,Z.NONE)||"false";var f=b.statementToCode(a,"DO"+c);b.STATEMENT_SUFFIX&&(f=b.prefixLines(b.injectId(b.STATEMENT_SUFFIX,a),b.INDENT)+f);d+=(c>0?"else ":"")+"if ("+e+") {\n"+f+"}";c++}while(a.getInput("IF"+c));if(a.getInput("ELSE")||b.STATEMENT_SUFFIX)f=a.getInput("ELSE")?b.statementToCode(a,"ELSE"):"",b.STATEMENT_SUFFIX&&(f=b.prefixLines(b.injectId(b.STATEMENT_SUFFIX,a),b.INDENT)+
16
+ f),d+=" else {\n"+f+"}";return d+"\n"},Qs=function(a,b){var c=a.getField("TIMES")?String(Number(a.getFieldValue("TIMES"))):b.valueToCode(a,"TIMES",Z.ASSIGNMENT)||"0";var d=b.statementToCode(a,"DO");d=b.addLoopTrap(d,a);a="";var e=b.nameDB_.getDistinctName("count",$.P.VARIABLE),f=c;c.match(/^\w+$/)||$.zf(c)||(f=b.nameDB_.getDistinctName("repeat_end",$.P.VARIABLE),a+="var "+f+" = "+c+";\n");return a+("for (int "+e+" = 0; "+e+" < "+f+"; "+e+"++) {\n"+d+"}\n")},Rs=function(a,b){var c=a.getFieldValue("OP");
17
17
  if(c==="NEG")return a=b.valueToCode(a,"NUM",Z.UNARY_PREFIX)||"0",a[0]==="-"&&(a=" "+a),["-"+a,Z.UNARY_PREFIX];b.definitions_.import_dart_math="import 'dart:math' as Math;";a=c==="ABS"||c.substring(0,5)==="ROUND"?b.valueToCode(a,"NUM",Z.UNARY_POSTFIX)||"0":c==="SIN"||c==="COS"||c==="TAN"?b.valueToCode(a,"NUM",Z.MULTIPLICATIVE)||"0":b.valueToCode(a,"NUM",Z.NONE)||"0";switch(c){case "ABS":var d=a+".abs()";break;case "ROOT":d="Math.sqrt("+a+")";break;case "LN":d="Math.log("+a+")";break;case "EXP":d="Math.exp("+
18
18
  a+")";break;case "POW10":d="Math.pow(10,"+a+")";break;case "ROUND":d=a+".round()";break;case "ROUNDUP":d=a+".ceil()";break;case "ROUNDDOWN":d=a+".floor()";break;case "SIN":d="Math.sin("+a+" / 180 * Math.pi)";break;case "COS":d="Math.cos("+a+" / 180 * Math.pi)";break;case "TAN":d="Math.tan("+a+" / 180 * Math.pi)"}if(d)return[d,Z.UNARY_POSTFIX];switch(c){case "LOG10":d="Math.log("+a+") / Math.log(10)";break;case "ASIN":d="Math.asin("+a+") / Math.pi * 180";break;case "ACOS":d="Math.acos("+a+") / Math.pi * 180";
19
- break;case "ATAN":d="Math.atan("+a+") / Math.pi * 180";break;default:throw Error("Unknown math operator: "+c);}return[d,Z.MULTIPLICATIVE]},Rs=function(a,b){var c=b.getProcedureName(a.getFieldValue("NAME")),d="";b.STATEMENT_PREFIX&&(d+=b.injectId(b.STATEMENT_PREFIX,a));b.STATEMENT_SUFFIX&&(d+=b.injectId(b.STATEMENT_SUFFIX,a));d&&(d=b.prefixLines(d,b.INDENT));var e="";b.INFINITE_LOOP_TRAP&&(e=b.prefixLines(b.injectId(b.INFINITE_LOOP_TRAP,a),b.INDENT));var f="";a.getInput("STACK")&&(f=b.statementToCode(a,
20
- "STACK"));var g="";a.getInput("RETURN")&&(g=b.valueToCode(a,"RETURN",Z.NONE)||"");var h="";f&&g&&(h=d);g&&(g=b.INDENT+"return "+g+";\n");var m=g?"dynamic":"void",z=[],E=a.getVarModels();for(let J=0;J<E.length;J++)z[J]=b.getVariableName(E[J].getId());d=m+" "+c+"("+z.join(", ")+") {\n"+d+e+f+h+g+"}";d=b.scrub_(a,d);b.definitions_["%"+c]=d;return null},Ss=function(a,b){b.definitions_.import_dart_html="import 'dart:html' as Html;";var c="Html.window.prompt("+(a.getField("TEXT")?b.quote_(a.getFieldValue("TEXT")):
21
- b.valueToCode(a,"TEXT",Z.NONE)||"''")+", '')";a.getFieldValue("TYPE")==="NUMBER"&&(b.definitions_.import_dart_math="import 'dart:math' as Math;",c="Math.parseDouble("+c+")");return[c,Z.UNARY_POSTFIX]},Ts=function(a,b){return[b.getVariableName(a.getFieldValue("VAR")),Z.ATOMIC]},Us=function(a,b){var c=b.valueToCode(a,"VALUE",Z.ASSIGNMENT)||"0";return b.getVariableName(a.getFieldValue("VAR"))+" = "+c+";\n"},Z,Vs=Z||(Z={});Vs[Vs.ATOMIC=0]="ATOMIC";Vs[Vs.UNARY_POSTFIX=1]="UNARY_POSTFIX";
22
- Vs[Vs.UNARY_PREFIX=2]="UNARY_PREFIX";Vs[Vs.MULTIPLICATIVE=3]="MULTIPLICATIVE";Vs[Vs.ADDITIVE=4]="ADDITIVE";Vs[Vs.SHIFT=5]="SHIFT";Vs[Vs.BITWISE_AND=6]="BITWISE_AND";Vs[Vs.BITWISE_XOR=7]="BITWISE_XOR";Vs[Vs.BITWISE_OR=8]="BITWISE_OR";Vs[Vs.RELATIONAL=9]="RELATIONAL";Vs[Vs.EQUALITY=10]="EQUALITY";Vs[Vs.LOGICAL_AND=11]="LOGICAL_AND";Vs[Vs.LOGICAL_OR=12]="LOGICAL_OR";Vs[Vs.IF_NULL=13]="IF_NULL";Vs[Vs.CONDITIONAL=14]="CONDITIONAL";Vs[Vs.CASCADE=15]="CASCADE";Vs[Vs.ASSIGNMENT=16]="ASSIGNMENT";
23
- Vs[Vs.NONE=99]="NONE";
24
- var Ws=class extends $.dq{constructor(a="Dart"){super(a);this.isInitialized=!1;for(let b in Z)a=Z[b],typeof a!=="string"&&(this["ORDER_"+b]=a);this.addReservedWords("assert,break,case,catch,class,const,continue,default,do,else,enum,extends,false,final,finally,for,if,in,is,new,null,rethrow,return,super,switch,this,throw,true,try,var,void,while,with,print,identityHashCode,identical,BidirectionalIterator,Comparable,double,Function,int,Invocation,Iterable,Iterator,List,Map,Match,num,Pattern,RegExp,Set,StackTrace,String,StringSink,Type,bool,DateTime,Deprecated,Duration,Expando,Null,Object,RuneIterator,Runes,Stopwatch,StringBuffer,Symbol,Uri,Comparator,AbstractClassInstantiationError,ArgumentError,AssertionError,CastError,ConcurrentModificationError,CyclicInitializationError,Error,Exception,FallThroughError,FormatException,IntegerDivisionByZeroException,NoSuchMethodError,NullThrownError,OutOfMemoryError,RangeError,StackOverflowError,StateError,TypeError,UnimplementedError,UnsupportedError")}init(a){super.init(a);this.nameDB_?
19
+ break;case "ATAN":d="Math.atan("+a+") / Math.pi * 180";break;default:throw Error("Unknown math operator: "+c);}return[d,Z.MULTIPLICATIVE]},Ss=function(a,b){var c=b.getProcedureName(a.getFieldValue("NAME")),d="";b.STATEMENT_PREFIX&&(d+=b.injectId(b.STATEMENT_PREFIX,a));b.STATEMENT_SUFFIX&&(d+=b.injectId(b.STATEMENT_SUFFIX,a));d&&(d=b.prefixLines(d,b.INDENT));var e="";b.INFINITE_LOOP_TRAP&&(e=b.prefixLines(b.injectId(b.INFINITE_LOOP_TRAP,a),b.INDENT));var f="";a.getInput("STACK")&&(f=b.statementToCode(a,
20
+ "STACK"));var g="";a.getInput("RETURN")&&(g=b.valueToCode(a,"RETURN",Z.NONE)||"");var h="";f&&g&&(h=d);g&&(g=b.INDENT+"return "+g+";\n");var m=g?"dynamic":"void",z=[],E=a.getVarModels();for(let J=0;J<E.length;J++)z[J]=b.getVariableName(E[J].getId());d=m+" "+c+"("+z.join(", ")+") {\n"+d+e+f+h+g+"}";d=b.scrub_(a,d);b.definitions_["%"+c]=d;return null},Ts=function(a,b){b.definitions_.import_dart_html="import 'dart:html' as Html;";var c="Html.window.prompt("+(a.getField("TEXT")?b.quote_(a.getFieldValue("TEXT")):
21
+ b.valueToCode(a,"TEXT",Z.NONE)||"''")+", '')";a.getFieldValue("TYPE")==="NUMBER"&&(b.definitions_.import_dart_math="import 'dart:math' as Math;",c="Math.parseDouble("+c+")");return[c,Z.UNARY_POSTFIX]},Us=function(a,b){return[b.getVariableName(a.getFieldValue("VAR")),Z.ATOMIC]},Vs=function(a,b){var c=b.valueToCode(a,"VALUE",Z.ASSIGNMENT)||"0";return b.getVariableName(a.getFieldValue("VAR"))+" = "+c+";\n"},Z,Ws=Z||(Z={});Ws[Ws.ATOMIC=0]="ATOMIC";Ws[Ws.UNARY_POSTFIX=1]="UNARY_POSTFIX";
22
+ Ws[Ws.UNARY_PREFIX=2]="UNARY_PREFIX";Ws[Ws.MULTIPLICATIVE=3]="MULTIPLICATIVE";Ws[Ws.ADDITIVE=4]="ADDITIVE";Ws[Ws.SHIFT=5]="SHIFT";Ws[Ws.BITWISE_AND=6]="BITWISE_AND";Ws[Ws.BITWISE_XOR=7]="BITWISE_XOR";Ws[Ws.BITWISE_OR=8]="BITWISE_OR";Ws[Ws.RELATIONAL=9]="RELATIONAL";Ws[Ws.EQUALITY=10]="EQUALITY";Ws[Ws.LOGICAL_AND=11]="LOGICAL_AND";Ws[Ws.LOGICAL_OR=12]="LOGICAL_OR";Ws[Ws.IF_NULL=13]="IF_NULL";Ws[Ws.CONDITIONAL=14]="CONDITIONAL";Ws[Ws.CASCADE=15]="CASCADE";Ws[Ws.ASSIGNMENT=16]="ASSIGNMENT";
23
+ Ws[Ws.NONE=99]="NONE";
24
+ var Xs=class extends $.dq{constructor(a="Dart"){super(a);this.isInitialized=!1;for(let b in Z)a=Z[b],typeof a!=="string"&&(this["ORDER_"+b]=a);this.addReservedWords("assert,break,case,catch,class,const,continue,default,do,else,enum,extends,false,final,finally,for,if,in,is,new,null,rethrow,return,super,switch,this,throw,true,try,var,void,while,with,print,identityHashCode,identical,BidirectionalIterator,Comparable,double,Function,int,Invocation,Iterable,Iterator,List,Map,Match,num,Pattern,RegExp,Set,StackTrace,String,StringSink,Type,bool,DateTime,Deprecated,Duration,Expando,Null,Object,RuneIterator,Runes,Stopwatch,StringBuffer,Symbol,Uri,Comparator,AbstractClassInstantiationError,ArgumentError,AssertionError,CastError,ConcurrentModificationError,CyclicInitializationError,Error,Exception,FallThroughError,FormatException,IntegerDivisionByZeroException,NoSuchMethodError,NullThrownError,OutOfMemoryError,RangeError,StackOverflowError,StateError,TypeError,UnimplementedError,UnsupportedError")}init(a){super.init(a);this.nameDB_?
25
25
  this.nameDB_.reset():this.nameDB_=new $.kj(this.RESERVED_WORDS_);this.nameDB_.setVariableMap(a.getVariableMap());this.nameDB_.populateVariables(a);this.nameDB_.populateProcedures(a);var b=[],c=$.Cd(a);for(let d=0;d<c.length;d++)b.push(this.nameDB_.getName(c[d],$.P.DEVELOPER_VARIABLE));a=$.Bd(a);for(c=0;c<a.length;c++)b.push(this.nameDB_.getName(a[c].getId(),$.P.VARIABLE));b.length&&(this.definitions_.variables="var "+b.join(", ")+";");this.isInitialized=!0}finish(a){a&&(a=this.prefixLines(a,this.INDENT));
26
26
  a="main() {\n"+a+"}";var b=[],c=[];for(let d in this.definitions_){let e=this.definitions_[d];e.match(/^import\s/)?b.push(e):c.push(e)}a=super.finish(a);this.isInitialized=!1;this.nameDB_.reset();return(b.join("\n")+"\n\n"+c.join("\n\n")).replace(/\n\n+/g,"\n\n").replace(/\n*$/,"\n\n\n")+a}scrubNakedValue(a){return a+";\n"}quote_(a){a=a.replace(/\\/g,"\\\\").replace(/\n/g,"\\\n").replace(/\$/g,"\\$").replace(/'/g,"\\'");return"'"+a+"'"}multiline_quote_(a){return a.split(/\n/g).map(this.quote_).join(" + '\\n' + \n")}scrub_(a,
27
27
  b,c=!1){var d="";if(!a.outputConnection||!a.outputConnection.targetConnection){var e=a.getCommentText();e&&(e=$.yf(e,this.COMMENT_WRAP-3),d="getProcedureDef"in a?d+this.prefixLines(e+"\n","/// "):d+this.prefixLines(e+"\n","// "));for(let f=0;f<a.inputList.length;f++)a.inputList[f].type===$.je.VALUE&&(e=a.inputList[f].connection.targetBlock())&&(e=this.allNestedComments(e))&&(d+=this.prefixLines(e,"// "))}a=a.nextConnection&&a.nextConnection.targetBlock();c=c?"":this.blockToCode(a);return d+b+c}getAdjusted(a,
28
- b,c=0,d=!1,e=Z.NONE){a.workspace.options.oneBasedIndex&&c--;var f=a.workspace.options.oneBasedIndex?"1":"0",g=e;c?g=Z.ADDITIVE:d&&(g=Z.UNARY_PREFIX);a=this.valueToCode(a,b,g)||f;if(c===0&&!d)return a;if($.zf(a))return a=String(Number(a)+c),d&&(a=String(-Number(a))),a;c>0?a=`${a} + ${c}`:c<0&&(a=`${a} - ${-c}`);d&&(a=c?`-(${a})`:`-${a}`);Math.floor(e)>=Math.floor(g)&&(a=`(${a})`);return a}};var Xs={};Xs.controls_if=Os;Xs.controls_ifelse=Os;Xs.logic_boolean=function(a){return[a.getFieldValue("BOOL")==="TRUE"?"true":"false",Z.ATOMIC]};Xs.logic_compare=function(a,b){var c={EQ:"==",NEQ:"!=",LT:"<",LTE:"<=",GT:">",GTE:">="}[a.getFieldValue("OP")],d=c==="=="||c==="!="?Z.EQUALITY:Z.RELATIONAL,e=b.valueToCode(a,"A",d)||"0";a=b.valueToCode(a,"B",d)||"0";return[e+" "+c+" "+a,d]};Xs.logic_negate=function(a,b){var c=Z.UNARY_PREFIX;return["!"+(b.valueToCode(a,"BOOL",c)||"true"),c]};
29
- Xs.logic_null=function(){return["null",Z.ATOMIC]};Xs.logic_operation=function(a,b){var c=a.getFieldValue("OP")==="AND"?"&&":"||",d=c==="&&"?Z.LOGICAL_AND:Z.LOGICAL_OR,e=b.valueToCode(a,"A",d);a=b.valueToCode(a,"B",d);e||a?(b=c==="&&"?"true":"false",e||(e=b),a||(a=b)):a=e="false";return[e+" "+c+" "+a,d]};
30
- Xs.logic_ternary=function(a,b){var c=b.valueToCode(a,"IF",Z.CONDITIONAL)||"false",d=b.valueToCode(a,"THEN",Z.CONDITIONAL)||"null";a=b.valueToCode(a,"ELSE",Z.CONDITIONAL)||"null";return[c+" ? "+d+" : "+a,Z.CONDITIONAL]};var Ys={controls_flow_statements:function(a,b){var c="";b.STATEMENT_PREFIX&&(c+=b.injectId(b.STATEMENT_PREFIX,a));b.STATEMENT_SUFFIX&&(c+=b.injectId(b.STATEMENT_SUFFIX,a));if(b.STATEMENT_PREFIX){let d=a.getSurroundLoop();d&&!d.suppressPrefixSuffix&&(c+=b.injectId(b.STATEMENT_PREFIX,d))}switch(a.getFieldValue("FLOW")){case "BREAK":return c+"break;\n";case "CONTINUE":return c+"continue;\n"}throw Error("Unknown flow statement.");},controls_for:function(a,b){var c=b.getVariableName(a.getFieldValue("VAR")),
28
+ b,c=0,d=!1,e=Z.NONE){a.workspace.options.oneBasedIndex&&c--;var f=a.workspace.options.oneBasedIndex?"1":"0",g=e;c?g=Z.ADDITIVE:d&&(g=Z.UNARY_PREFIX);a=this.valueToCode(a,b,g)||f;if(c===0&&!d)return a;if($.zf(a))return a=String(Number(a)+c),d&&(a=String(-Number(a))),a;c>0?a=`${a} + ${c}`:c<0&&(a=`${a} - ${-c}`);d&&(a=c?`-(${a})`:`-${a}`);Math.floor(e)>=Math.floor(g)&&(a=`(${a})`);return a}};var Ys={};Ys.controls_if=Ps;Ys.controls_ifelse=Ps;Ys.logic_boolean=function(a){return[a.getFieldValue("BOOL")==="TRUE"?"true":"false",Z.ATOMIC]};Ys.logic_compare=function(a,b){var c={EQ:"==",NEQ:"!=",LT:"<",LTE:"<=",GT:">",GTE:">="}[a.getFieldValue("OP")],d=c==="=="||c==="!="?Z.EQUALITY:Z.RELATIONAL,e=b.valueToCode(a,"A",d)||"0";a=b.valueToCode(a,"B",d)||"0";return[e+" "+c+" "+a,d]};Ys.logic_negate=function(a,b){var c=Z.UNARY_PREFIX;return["!"+(b.valueToCode(a,"BOOL",c)||"true"),c]};
29
+ Ys.logic_null=function(){return["null",Z.ATOMIC]};Ys.logic_operation=function(a,b){var c=a.getFieldValue("OP")==="AND"?"&&":"||",d=c==="&&"?Z.LOGICAL_AND:Z.LOGICAL_OR,e=b.valueToCode(a,"A",d);a=b.valueToCode(a,"B",d);e||a?(b=c==="&&"?"true":"false",e||(e=b),a||(a=b)):a=e="false";return[e+" "+c+" "+a,d]};
30
+ Ys.logic_ternary=function(a,b){var c=b.valueToCode(a,"IF",Z.CONDITIONAL)||"false",d=b.valueToCode(a,"THEN",Z.CONDITIONAL)||"null";a=b.valueToCode(a,"ELSE",Z.CONDITIONAL)||"null";return[c+" ? "+d+" : "+a,Z.CONDITIONAL]};var Zs={controls_flow_statements:function(a,b){var c="";b.STATEMENT_PREFIX&&(c+=b.injectId(b.STATEMENT_PREFIX,a));b.STATEMENT_SUFFIX&&(c+=b.injectId(b.STATEMENT_SUFFIX,a));if(b.STATEMENT_PREFIX){let d=a.getSurroundLoop();d&&!d.suppressPrefixSuffix&&(c+=b.injectId(b.STATEMENT_PREFIX,d))}switch(a.getFieldValue("FLOW")){case "BREAK":return c+"break;\n";case "CONTINUE":return c+"continue;\n"}throw Error("Unknown flow statement.");},controls_for:function(a,b){var c=b.getVariableName(a.getFieldValue("VAR")),
31
31
  d=b.valueToCode(a,"FROM",Z.ASSIGNMENT)||"0",e=b.valueToCode(a,"TO",Z.ASSIGNMENT)||"0",f=b.valueToCode(a,"BY",Z.ASSIGNMENT)||"1",g=b.statementToCode(a,"DO");g=b.addLoopTrap(g,a);if($.zf(d)&&$.zf(e)&&$.zf(f))b=Number(d)<=Number(e),a="for ("+c+" = "+d+"; "+c+(b?" <= ":" >= ")+e+"; "+c,c=Math.abs(Number(f)),a=c===1?a+(b?"++":"--"):a+((b?" += ":" -= ")+c),a+=") {\n"+g+"}\n";else{a="";let h=d;d.match(/^\w+$/)||$.zf(d)||(h=b.nameDB_.getDistinctName(c+"_start",$.P.VARIABLE),a+="var "+h+" = "+d+";\n");d=e;
32
32
  e.match(/^\w+$/)||$.zf(e)||(d=b.nameDB_.getDistinctName(c+"_end",$.P.VARIABLE),a+="var "+d+" = "+e+";\n");e=b.nameDB_.getDistinctName(c+"_inc",$.P.VARIABLE);a+="num "+e+" = ";a=$.zf(f)?a+(Math.abs(Number(f))+";\n"):a+("("+f+").abs();\n");a+="if ("+h+" > "+d+") {\n";a+=b.INDENT+e+" = -"+e+";\n";a=a+"}\nfor ("+(c+" = "+h+"; "+e+" >= 0 ? "+c+" <= "+d+" : "+c+" >= "+d+"; "+c+" += "+e+") {\n"+g+"}\n")}return a},controls_forEach:function(a,b){var c=b.getVariableName(a.getFieldValue("VAR")),d=b.valueToCode(a,
33
- "LIST",Z.ASSIGNMENT)||"[]",e=b.statementToCode(a,"DO");e=b.addLoopTrap(e,a);return"for (var "+c+" in "+d+") {\n"+e+"}\n"}};Ys.controls_repeat=Ps;Ys.controls_repeat_ext=Ps;Ys.controls_whileUntil=function(a,b){var c=a.getFieldValue("MODE")==="UNTIL",d=b.valueToCode(a,"BOOL",c?Z.UNARY_PREFIX:Z.NONE)||"false",e=b.statementToCode(a,"DO");e=b.addLoopTrap(e,a);c&&(d="!"+d);return"while ("+d+") {\n"+e+"}\n"};var Zs={math_arithmetic:function(a,b){var c={ADD:[" + ",Z.ADDITIVE],MINUS:[" - ",Z.ADDITIVE],MULTIPLY:[" * ",Z.MULTIPLICATIVE],DIVIDE:[" / ",Z.MULTIPLICATIVE],POWER:[null,Z.NONE]}[a.getFieldValue("OP")],d=c[0];c=c[1];var e=b.valueToCode(a,"A",c)||"0";a=b.valueToCode(a,"B",c)||"0";return d?[e+d+a,c]:(b.definitions_.import_dart_math="import 'dart:math' as Math;",["Math.pow("+e+", "+a+")",Z.UNARY_POSTFIX])},math_atan2:function(a,b){b.definitions_.import_dart_math="import 'dart:math' as Math;";var c=
33
+ "LIST",Z.ASSIGNMENT)||"[]",e=b.statementToCode(a,"DO");e=b.addLoopTrap(e,a);return"for (var "+c+" in "+d+") {\n"+e+"}\n"}};Zs.controls_repeat=Qs;Zs.controls_repeat_ext=Qs;Zs.controls_whileUntil=function(a,b){var c=a.getFieldValue("MODE")==="UNTIL",d=b.valueToCode(a,"BOOL",c?Z.UNARY_PREFIX:Z.NONE)||"false",e=b.statementToCode(a,"DO");e=b.addLoopTrap(e,a);c&&(d="!"+d);return"while ("+d+") {\n"+e+"}\n"};var $s={math_arithmetic:function(a,b){var c={ADD:[" + ",Z.ADDITIVE],MINUS:[" - ",Z.ADDITIVE],MULTIPLY:[" * ",Z.MULTIPLICATIVE],DIVIDE:[" / ",Z.MULTIPLICATIVE],POWER:[null,Z.NONE]}[a.getFieldValue("OP")],d=c[0];c=c[1];var e=b.valueToCode(a,"A",c)||"0";a=b.valueToCode(a,"B",c)||"0";return d?[e+d+a,c]:(b.definitions_.import_dart_math="import 'dart:math' as Math;",["Math.pow("+e+", "+a+")",Z.UNARY_POSTFIX])},math_atan2:function(a,b){b.definitions_.import_dart_math="import 'dart:math' as Math;";var c=
34
34
  b.valueToCode(a,"X",Z.NONE)||"0";return["Math.atan2("+(b.valueToCode(a,"Y",Z.NONE)||"0")+", "+c+") / Math.pi * 180",Z.MULTIPLICATIVE]},math_change:function(a,b){var c=b.valueToCode(a,"DELTA",Z.ADDITIVE)||"0";a=b.getVariableName(a.getFieldValue("VAR"));return a+" = ("+a+" is num ? "+a+" : 0) + "+c+";\n"},math_constant:function(a,b){var c={PI:["Math.pi",Z.UNARY_POSTFIX],E:["Math.e",Z.UNARY_POSTFIX],GOLDEN_RATIO:["(1 + Math.sqrt(5)) / 2",Z.MULTIPLICATIVE],SQRT2:["Math.sqrt2",Z.UNARY_POSTFIX],SQRT1_2:["Math.sqrt1_2",
35
35
  Z.UNARY_POSTFIX],INFINITY:["double.infinity",Z.ATOMIC]};a=a.getFieldValue("CONSTANT");a!=="INFINITY"&&(b.definitions_.import_dart_math="import 'dart:math' as Math;");return c[a]},math_constrain:function(a,b){b.definitions_.import_dart_math="import 'dart:math' as Math;";var c=b.valueToCode(a,"VALUE",Z.NONE)||"0",d=b.valueToCode(a,"LOW",Z.NONE)||"0";a=b.valueToCode(a,"HIGH",Z.NONE)||"double.infinity";return["Math.min(Math.max("+c+", "+d+"), "+a+")",Z.UNARY_POSTFIX]},math_modulo:function(a,b){var c=
36
36
  b.valueToCode(a,"DIVIDEND",Z.MULTIPLICATIVE)||"0";a=b.valueToCode(a,"DIVISOR",Z.MULTIPLICATIVE)||"0";return[c+" % "+a,Z.MULTIPLICATIVE]},math_number:function(a){a=Number(a.getFieldValue("NUM"));return a===Infinity?["double.infinity",Z.UNARY_POSTFIX]:a===-Infinity?["-double.infinity",Z.UNARY_PREFIX]:[String(a),a<0?Z.UNARY_PREFIX:Z.ATOMIC]},math_number_property:function(a,b){var c={EVEN:[" % 2 == 0",Z.MULTIPLICATIVE,Z.EQUALITY],ODD:[" % 2 == 1",Z.MULTIPLICATIVE,Z.EQUALITY],WHOLE:[" % 1 == 0",Z.MULTIPLICATIVE,
@@ -156,8 +156,8 @@ int ${b.FUNCTION_NAME_PLACEHOLDER_}(num a, num b) {
156
156
  }
157
157
  return new Math.Random().nextInt(b - a + 1) + a;
158
158
  }
159
- `)+"("+c+", "+a+")",Z.UNARY_POSTFIX]}};Zs.math_round=Qs;Zs.math_single=Qs;Zs.math_trig=Qs;var $s={procedures_callnoreturn:function(a,b){return b.forBlock.procedures_callreturn(a,b)[0]+";\n"},procedures_callreturn:function(a,b){var c=b.getProcedureName(a.getFieldValue("NAME")),d=[],e=a.getVarModels();for(let f=0;f<e.length;f++)d[f]=b.valueToCode(a,"ARG"+f,Z.NONE)||"null";return[c+"("+d.join(", ")+")",Z.UNARY_POSTFIX]}};$s.procedures_defnoreturn=Rs;$s.procedures_defreturn=Rs;
160
- $s.procedures_ifreturn=function(a,b){var c="if ("+(b.valueToCode(a,"CONDITION",Z.NONE)||"false")+") {\n";b.STATEMENT_SUFFIX&&(c+=b.prefixLines(b.injectId(b.STATEMENT_SUFFIX,a),b.INDENT));a.hasReturnValue_?(a=b.valueToCode(a,"VALUE",Z.NONE)||"null",c+=b.INDENT+"return "+a+";\n"):c+=b.INDENT+"return;\n";return c+"}\n"};var at={text:function(a,b){return[b.quote_(a.getFieldValue("TEXT")),Z.ATOMIC]},text_append:function(a,b){var c=b.getVariableName(a.getFieldValue("VAR"));a=b.valueToCode(a,"TEXT",Z.NONE)||"''";return c+" = ["+c+", "+a+"].join();\n"},text_changeCase:function(a,b){var c={UPPERCASE:".toUpperCase()",LOWERCASE:".toLowerCase()",TITLECASE:null}[a.getFieldValue("CASE")];a=b.valueToCode(a,"TEXT",c?Z.UNARY_POSTFIX:Z.NONE)||"''";return[c?a+c:b.provideFunction_("text_toTitleCase",`
159
+ `)+"("+c+", "+a+")",Z.UNARY_POSTFIX]}};$s.math_round=Rs;$s.math_single=Rs;$s.math_trig=Rs;var at={procedures_callnoreturn:function(a,b){return b.forBlock.procedures_callreturn(a,b)[0]+";\n"},procedures_callreturn:function(a,b){var c=b.getProcedureName(a.getFieldValue("NAME")),d=[],e=a.getVarModels();for(let f=0;f<e.length;f++)d[f]=b.valueToCode(a,"ARG"+f,Z.NONE)||"null";return[c+"("+d.join(", ")+")",Z.UNARY_POSTFIX]}};at.procedures_defnoreturn=Ss;at.procedures_defreturn=Ss;
160
+ at.procedures_ifreturn=function(a,b){var c="if ("+(b.valueToCode(a,"CONDITION",Z.NONE)||"false")+") {\n";b.STATEMENT_SUFFIX&&(c+=b.prefixLines(b.injectId(b.STATEMENT_SUFFIX,a),b.INDENT));a.hasReturnValue_?(a=b.valueToCode(a,"VALUE",Z.NONE)||"null",c+=b.INDENT+"return "+a+";\n"):c+=b.INDENT+"return;\n";return c+"}\n"};var bt={text:function(a,b){return[b.quote_(a.getFieldValue("TEXT")),Z.ATOMIC]},text_append:function(a,b){var c=b.getVariableName(a.getFieldValue("VAR"));a=b.valueToCode(a,"TEXT",Z.NONE)||"''";return c+" = ["+c+", "+a+"].join();\n"},text_changeCase:function(a,b){var c={UPPERCASE:".toUpperCase()",LOWERCASE:".toLowerCase()",TITLECASE:null}[a.getFieldValue("CASE")];a=b.valueToCode(a,"TEXT",c?Z.UNARY_POSTFIX:Z.NONE)||"''";return[c?a+c:b.provideFunction_("text_toTitleCase",`
161
161
  String ${b.FUNCTION_NAME_PLACEHOLDER_}(String str) {
162
162
  RegExp exp = new RegExp(r'\\b');
163
163
  List<String> list = str.split(exp);
@@ -217,10 +217,10 @@ String ${b.FUNCTION_NAME_PLACEHOLDER_}(String text, String where1, num at1, Stri
217
217
  return text.substring(at1, at2);
218
218
  }
219
219
  `)+"("+f+", '"+c+"', "+g+", '"+d+"', "+a+")";return[b,Z.UNARY_POSTFIX]},text_indexOf:function(a,b){var c=a.getFieldValue("END")==="FIRST"?"indexOf":"lastIndexOf",d=b.valueToCode(a,"FIND",Z.NONE)||"''";b=(b.valueToCode(a,"VALUE",Z.UNARY_POSTFIX)||"''")+"."+c+"("+d+")";return a.workspace.options.oneBasedIndex?[b+" + 1",Z.ADDITIVE]:[b,Z.UNARY_POSTFIX]},text_isEmpty:function(a,b){return[(b.valueToCode(a,"VALUE",Z.UNARY_POSTFIX)||"''")+".isEmpty",Z.UNARY_POSTFIX]},text_join:function(a,b){switch(a.itemCount_){case 0:return["''",
220
- Z.ATOMIC];case 1:return[(b.valueToCode(a,"ADD0",Z.UNARY_POSTFIX)||"''")+".toString()",Z.UNARY_POSTFIX];default:let c=Array(a.itemCount_);for(let d=0;d<a.itemCount_;d++)c[d]=b.valueToCode(a,"ADD"+d,Z.NONE)||"''";return["["+c.join(",")+"].join()",Z.UNARY_POSTFIX]}},text_length:function(a,b){return[(b.valueToCode(a,"VALUE",Z.UNARY_POSTFIX)||"''")+".length",Z.UNARY_POSTFIX]},text_print:function(a,b){return"print("+(b.valueToCode(a,"TEXT",Z.NONE)||"''")+");\n"}};at.text_prompt=Ss;at.text_prompt_ext=Ss;
221
- at.text_replace=function(a,b){var c=b.valueToCode(a,"TEXT",Z.UNARY_POSTFIX)||"''",d=b.valueToCode(a,"FROM",Z.NONE)||"''";a=b.valueToCode(a,"TO",Z.NONE)||"''";return[c+".replaceAll("+d+", "+a+")",Z.UNARY_POSTFIX]};at.text_reverse=function(a,b){return["new String.fromCharCodes("+(b.valueToCode(a,"TEXT",Z.UNARY_POSTFIX)||"''")+".runes.toList().reversed)",Z.UNARY_PREFIX]};
222
- at.text_trim=function(a,b){var c={LEFT:".replaceFirst(new RegExp(r'^\\s+'), '')",RIGHT:".replaceFirst(new RegExp(r'\\s+$'), '')",BOTH:".trim()"}[a.getFieldValue("MODE")];return[(b.valueToCode(a,"TEXT",Z.UNARY_POSTFIX)||"''")+c,Z.UNARY_POSTFIX]};var bt={};bt.variables_get=Ts;bt.variables_set=Us;var ct={};ct.variables_get_dynamic=Ts;ct.variables_set_dynamic=Us;var dt=new Ws;dt.addReservedWords("Html,Math");
223
- var et=Object.assign({},{lists_create_empty:function(){return["[]",Z.ATOMIC]},lists_create_with:function(a,b){var c=Array(a.itemCount_);for(let d=0;d<a.itemCount_;d++)c[d]=b.valueToCode(a,"ADD"+d,Z.NONE)||"null";return["["+c.join(", ")+"]",Z.ATOMIC]},lists_getIndex:function(a,b){function c(){var g=b.nameDB_.getDistinctName("tmp_list",$.P.VARIABLE),h="List "+g+" = "+f+";\n";f=g;return h}var d=a.getFieldValue("MODE")||"GET",e=a.getFieldValue("WHERE")||"FROM_START",f=b.valueToCode(a,"VALUE",e==="RANDOM"||
220
+ Z.ATOMIC];case 1:return[(b.valueToCode(a,"ADD0",Z.UNARY_POSTFIX)||"''")+".toString()",Z.UNARY_POSTFIX];default:let c=Array(a.itemCount_);for(let d=0;d<a.itemCount_;d++)c[d]=b.valueToCode(a,"ADD"+d,Z.NONE)||"''";return["["+c.join(",")+"].join()",Z.UNARY_POSTFIX]}},text_length:function(a,b){return[(b.valueToCode(a,"VALUE",Z.UNARY_POSTFIX)||"''")+".length",Z.UNARY_POSTFIX]},text_print:function(a,b){return"print("+(b.valueToCode(a,"TEXT",Z.NONE)||"''")+");\n"}};bt.text_prompt=Ts;bt.text_prompt_ext=Ts;
221
+ bt.text_replace=function(a,b){var c=b.valueToCode(a,"TEXT",Z.UNARY_POSTFIX)||"''",d=b.valueToCode(a,"FROM",Z.NONE)||"''";a=b.valueToCode(a,"TO",Z.NONE)||"''";return[c+".replaceAll("+d+", "+a+")",Z.UNARY_POSTFIX]};bt.text_reverse=function(a,b){return["new String.fromCharCodes("+(b.valueToCode(a,"TEXT",Z.UNARY_POSTFIX)||"''")+".runes.toList().reversed)",Z.UNARY_PREFIX]};
222
+ bt.text_trim=function(a,b){var c={LEFT:".replaceFirst(new RegExp(r'^\\s+'), '')",RIGHT:".replaceFirst(new RegExp(r'\\s+$'), '')",BOTH:".trim()"}[a.getFieldValue("MODE")];return[(b.valueToCode(a,"TEXT",Z.UNARY_POSTFIX)||"''")+c,Z.UNARY_POSTFIX]};var ct={};ct.variables_get=Us;ct.variables_set=Vs;var dt={};dt.variables_get_dynamic=Us;dt.variables_set_dynamic=Vs;var et=new Xs;et.addReservedWords("Html,Math");
223
+ var ft=Object.assign({},{lists_create_empty:function(){return["[]",Z.ATOMIC]},lists_create_with:function(a,b){var c=Array(a.itemCount_);for(let d=0;d<a.itemCount_;d++)c[d]=b.valueToCode(a,"ADD"+d,Z.NONE)||"null";return["["+c.join(", ")+"]",Z.ATOMIC]},lists_getIndex:function(a,b){function c(){var g=b.nameDB_.getDistinctName("tmp_list",$.P.VARIABLE),h="List "+g+" = "+f+";\n";f=g;return h}var d=a.getFieldValue("MODE")||"GET",e=a.getFieldValue("WHERE")||"FROM_START",f=b.valueToCode(a,"VALUE",e==="RANDOM"||
224
224
  e==="FROM_END"?Z.NONE:Z.UNARY_POSTFIX)||"[]";if((e!=="RANDOM"||d!=="REMOVE")&&e!=="FROM_END"||f.match(/^\w+$/))switch(e){case "FIRST":if(d==="GET")return[f+".first",Z.UNARY_POSTFIX];if(d==="GET_REMOVE")return[f+".removeAt(0)",Z.UNARY_POSTFIX];if(d==="REMOVE")return f+".removeAt(0);\n";break;case "LAST":if(d==="GET")return[f+".last",Z.UNARY_POSTFIX];if(d==="GET_REMOVE")return[f+".removeLast()",Z.UNARY_POSTFIX];if(d==="REMOVE")return f+".removeLast();\n";break;case "FROM_START":a=b.getAdjusted(a,"AT");
225
225
  if(d==="GET")return[f+"["+a+"]",Z.UNARY_POSTFIX];if(d==="GET_REMOVE")return[f+".removeAt("+a+")",Z.UNARY_POSTFIX];if(d==="REMOVE")return f+".removeAt("+a+");\n";break;case "FROM_END":a=b.getAdjusted(a,"AT",1,!1,Z.ADDITIVE);if(d==="GET")return[f+"["+f+".length - "+a+"]",Z.UNARY_POSTFIX];if(d==="GET_REMOVE"||d==="REMOVE"){a=f+".removeAt("+f+".length - "+a+")";if(d==="GET_REMOVE")return[a,Z.UNARY_POSTFIX];if(d==="REMOVE")return a+";\n"}break;case "RANDOM":b.definitions_.import_dart_math="import 'dart:math' as Math;";
226
226
  if(d==="REMOVE")return d=b.nameDB_.getDistinctName("tmp_x",$.P.VARIABLE),"int "+d+" = new Math.Random().nextInt("+f+".length);\n"+(f+".removeAt("+d+");\n");if(d==="GET")return[b.provideFunction_("lists_get_random_item",`
@@ -280,7 +280,7 @@ List ${b.FUNCTION_NAME_PLACEHOLDER_}(List list, String type, int direction) {
280
280
  list.sort(compare);
281
281
  return list;
282
282
  }
283
- `)+"("+c+', "'+a+'", '+d+")",Z.UNARY_POSTFIX]},lists_split:function(a,b){var c=b.valueToCode(a,"INPUT",Z.UNARY_POSTFIX);b=b.valueToCode(a,"DELIM",Z.NONE)||"''";a=a.getFieldValue("MODE");if(a==="SPLIT")c||(c="''"),a="split";else if(a==="JOIN")c||(c="[]"),a="join";else throw Error("Unknown mode: "+a);return[c+"."+a+"("+b+")",Z.UNARY_POSTFIX]}},Xs,Ys,Zs,$s,at,bt,ct);for(let a in et)dt.forBlock[a]=et[a];var ft={};ft.DartGenerator=Ws;ft.Order=Z;ft.dartGenerator=dt;$.__chunk_dart=ft;
283
+ `)+"("+c+', "'+a+'", '+d+")",Z.UNARY_POSTFIX]},lists_split:function(a,b){var c=b.valueToCode(a,"INPUT",Z.UNARY_POSTFIX);b=b.valueToCode(a,"DELIM",Z.NONE)||"''";a=a.getFieldValue("MODE");if(a==="SPLIT")c||(c="''"),a="split";else if(a==="JOIN")c||(c="[]"),a="join";else throw Error("Unknown mode: "+a);return[c+"."+a+"("+b+")",Z.UNARY_POSTFIX]}},Ys,Zs,$s,at,bt,ct,dt);for(let a in ft)et.forBlock[a]=ft[a];var gt={};gt.DartGenerator=Xs;gt.Order=Z;gt.dartGenerator=et;$.__chunk_dart=gt;
284
284
  $.__chunk_dart.__namespace__=$;
285
285
  return $.__chunk_dart;
286
286
  }));