PageSourceSearch

https://www.robotmesh.com/studio/content/jsx/robotmesh/tsjs/tutorial/blockly_blocks.js

js robotmesh.com collected 2026-09-24 12:52:53 UTC 39,694 bytes, 1 lines download raw bytes

1import{msg}from"../msg/messages.js";import{getUserCodeManager}from"./tutorial.js";import{util}from"../util_general.js";import{TutorialBlocksBase,code,colors,blocks as cmn_blocks,categories,patch}from"./tutorial_blocks.js";import{S_LAST_ADDED,Toolbox,getNamedFields,getNamedInputs,getBlockClassName,getFieldClassName,getConnectionOptions,getMutatorClassName}from"./blockly_api.js";import{mimic}from"../mimic/Mimic.js";let _fieldChangeHandlers={};export class BlocklyTutorialBlocks extends TutorialBlocksBase{async createCategoryDefs(){return[{uiName:msg.TUTORIAL,blockTypes:[cmn_blocks.tut_chapter_fn,cmn_blocks.tut_comment,cmn_blocks.tut_print,cmn_blocks.tut_sleep]},{uiName:msg.blockly.UI,blockTypes:[cmn_blocks.tut_popup,cmn_blocks.tut_imgtag_wrap,cmn_blocks.tut_complete,cmn_blocks.tut_popup_close,cmn_blocks.tut_closed_by,cmn_blocks.tut_open_category,cmn_blocks.tut_click,cmn_blocks.tut_set_ui_blockly_and_mimic,blocks.tut_scroll_to_block,cmn_blocks.tut_target_common,blocks.tut_target_block,blocks.tut_target_field,blocks.tut_target_mutator,blocks.tut_target_toolbox_category,blocks.tut_target_toolbox_block,blocks.tut_target_editor_toolbar_button,cmn_blocks.tut_method_ui_target,blocks.tut_enable_toolbox_block,blocks.tut_enable_toolbox_block_dynamic,blocks.tut_enable_toolbox_block_category,blocks.tut_enable_toolbox_block_all,blocks.tut_enable_context_menu,blocks.tut_enable_zoom_and_scroll,cmn_blocks.tut_ui_layout_pane,blocks.tut_open_mutator,blocks.tut_select_block,blocks.tut_select_text_field]},{uiName:msg.blockly.ACTIONS,blockTypes:[blocks.tut_test_drive,blocks.tut_create_block,blocks.tut_set_added_block_name,blocks.tut_set_input_block_name,blocks.tut_attach_block,blocks.tut_move_block,blocks.tut_set_field_value,blocks.tut_set_field_value_dropdown,blocks.tut_method_block,blocks.tut_method_block_all,blocks.tut_method_block_terminal,blocks.tut_delete_block,cmn_blocks.tut_managed_save]},{uiName:msg.blockly.WAITING,blockTypes:[cmn_blocks.tut_waitfor,cmn_blocks.tut_waitfor_any,cmn_blocks.tut_promise_sleep,blocks.tut_promise,blocks.tut_was,blocks.tut_promise_fieldChanged,blocks.tut_was_fieldChanged,blocks.tut_promise_with_block,blocks.tut_was_with_block]},{uiName:msg.blockly.INSPECT,blockTypes:[blocks.tut_get_block_type,blocks.tut_enum_block_type,blocks.tut_get_block_parent,blocks.tut_get_block_surround_parent,blocks.tut_get_block_parent_connection,blocks.tut_enum_block_name,blocks.tut_get_field_value,blocks.tut_get_field_count,blocks.tut_get_field_text,blocks.tut_enum_dropdown_value,blocks.tut_get_open_toolbox_category,blocks.tut_enum_toolbox_category,blocks.tut_last_mimic_score,blocks.tut_last_mimic_success,blocks.tut_mimic_brain_position]},{uiName:msg.blockly.MIMIC,blockTypes:[blocks.tut_select_camera,blocks.tut_select_default_camera,cmn_blocks.tut_drivetrain_hud_get_measurement,cmn_blocks.tut_drivetrain_hud_reset_measurement,cmn_blocks.tut_drivetrain_hud_set_units,cmn_blocks.tut_wasd_distance,cmn_blocks.tut_wasd_reached_target,blocks.tut_configure_hud,cmn_blocks.tut_enable_wasd]},categories.logic,categories.loops,categories.math,categories.text,categories.lists,categories.variables,categories.functions,{uiName:msg.blockly.DEPRECATED,blockTypes:[cmn_blocks.deprecated.tut_start,cmn_blocks.deprecated.tut_stop,cmn_blocks.deprecated.tut_waypoint,cmn_blocks.deprecated.tut_clear_user_code,cmn_blocks.deprecated.tut_reset_user_code,blocks.deprecated.tut_create_block_loc]}]}setTutorialWorkspace(e){util.assertNotNullOrUndefined(e),this._workspace=e,patch.makeProceduresCodeAsync(e),this.createRuntimeBlocksTable(),this._workspace.addChangeListener(e=>{this.callFieldChangeHandlers(e),this.handleRuntimeBlockNames(e)})}handleRuntimeBlockNames(e){if(e.type==Blockly.Events.FINISHED_LOADING&&this.createRuntimeBlocksTable(),e.type==Blockly.Events.BLOCK_CHANGE){const t=this._workspace.getBlockById(e.blockId);if(t){const o=getRuntimeBlockInfo(t);if(o){const l=e;l.name===blocks.S_NEW_NAME&&ucm().runtimeBlocks.removeName(l.oldValue,t.id),o.name&&ucm().runtimeBlocks.set(o.name,o.type,o.definedInBlockId)}}}e.type==Blockly.Events.BLOCK_DELETE&&this.createRuntimeBlocksTable()}createRuntimeBlocksTable(){ucm().runtimeBlocks.clearAll();for(const e of this._workspace.getAllBlocks(!1)){const t=getRuntimeBlockInfo(e);t&&t.name&&ucm().runtimeBlocks.set(t.name,t.type,e.id)}}createRuntimeBlocksTableFromXml(e){ucm().runtimeBlocks.clearAll(),function e(t){if("block"===t.tagName||"shadow"===t.tagName){const e=getRuntimeBlockInfoFromXml(t);e&&e.name&&ucm().runtimeBlocks.set(e.name,e.type,e.definedInBlockId)}for(let o=0;o<t.children.length;o++)e(t.children[o])}(e)}processWorkspaceDomXml(e){ucm().createBlockNameTable(),this.createRu
1ntimeBlocksTableFromXml(e)}exit(){_fieldChangeHandlers={}}callFieldChangeHandlers(e){if(e.type==Blockly.Events.BLOCK_CHANGE){const t=e,o=t.name;if(!o)return;const l=Blockly.Workspace.getById(t.workspaceId).getBlockById(t.blockId);if(!l)return;const _=`${l.type}::${o}`,c=_fieldChangeHandlers[_];c&&c(l)}}}function getRuntimeBlockInfo(e){return e.type===blocks.tut_set_added_block_name.type||e.type===blocks.tut_set_input_block_name.type?{name:e.getFieldValue(blocks.S_NEW_NAME),type:e.getFieldValue(blocks.S_EXPECTED_TYPE),definedInBlockId:e.id}:e.type===blocks.tut_create_block.type||e.type===blocks.deprecated.tut_create_block_loc.type?{name:e.getFieldValue(blocks.S_NEW_NAME),type:e.getFieldValue(blocks.S_NEW_TYPE),definedInBlockId:e.id}:null}function getRuntimeBlockInfoFromXml(e){const t=e.getAttribute("type");return t===blocks.tut_set_added_block_name.type||t===blocks.tut_set_input_block_name.type?{name:getFieldValueFromXml(e,blocks.S_NEW_NAME),type:getFieldValueFromXml(e,blocks.S_EXPECTED_TYPE),definedInBlockId:e.getAttribute("id")}:t===blocks.tut_create_block.type||t===blocks.deprecated.tut_create_block_loc.type?{name:getFieldValueFromXml(e,blocks.S_NEW_NAME),type:getFieldValueFromXml(e,blocks.S_NEW_TYPE),definedInBlockId:e.getAttribute("id")}:null}function getFieldValueFromXml(e,t){for(let o=0;o<e.children.length;o++){const l=e.children[o];if("field"===l.tagName&&l.getAttribute("name")==t)return l.textContent}return null}function ucm(){return getUserCodeManager()}var opt,menu,blocks;!function(e){e.LAST_ADDED=[msg.blockly.LAST_ADDED,S_LAST_ADDED],e.CATEGORY=[msg.blockly.CATEGORY_SQB,""],e.BLOCK_TYPE=[msg.blockly.BLOCK_TYPE_SQB,""],e.BLOCK_NAME=[msg.blockly.BLOCK_NAME_SQB,""],e.FIELD=[msg.blockly.FIELD_SQB,""],e.OPTION=[msg.blockly.OPTION_SQB,""],e.INPUT=[msg.blockly.INPUT_SQB,""],e.SELECT=[msg.blockly.SELECT_SQB,""],e.CAMERAS=[msg.blockly.CAMERA_NAME_SQB,""]}(opt||(opt={})),function(e){function t(e,t){if(util.assert(!(e.fnmBlock&&e.fnmBlockType),"BOTH blockFieldName and blockTypeFieldName are set"),e.fnmBlock){const o=e.block.getFieldValue(e.fnmBlock);ucm().executeOnBlock(o,t)}else if(e.fnmBlockType){const o=e.block.getFieldValue(e.fnmBlockType);ucm().executeOnBlockType(o,t)}else util.assert(!0,"Neither blockFieldName nor blockTypeFieldName are set")}function o(){const e=[opt.CATEGORY],t=ucm().toolbox.getCategoryPaths();for(const o of t)e.push([Toolbox.getCategoryUiName(o),o]);return e}function l(){let e=[[msg.blockly.NO_CAMERAS_SQB,""]],t=mimic.workshop.tutorialListCameras();if(t.length>0){e=[opt.CAMERAS];for(let o of t)e.push([o,`"${o}"`])}return e}e.onFieldChange=function(e,t,o){const l=`${e}::${t}`;util.assert(void 0===_fieldChangeHandlers[l],"handler already added"),_fieldChangeHandlers[l]=o},e.clearField=function(e,t){const o=e.getField(t);if(o instanceof Blockly.FieldDropdown){const e=o.getOptions();e.length>0&&(o.setValue(e[0][1]),o.setText(e[0][0]))}else o&&o.setValue("")},e.initBlockName=function(e){const t=e.block.getField(e.fnm);util.assert(!!t),t.menuGenerator_=()=>{const o=e.fnmExcludeBlockName?e.block.getFieldValue(e.fnmExcludeBlockName):null;let l;l=e.optLastAdded?opt.LAST_ADDED:e.shouldInclude?[msg.blockly.NO_MATCHING_BLOCKS_SQB,""]:[msg.blockly.NO_BLOCKS_SQB,""];let _=[l],c=ucm().getAllBlockNames(e.shouldInclude),n=ucm().runtimeBlocks.getAllNames(e.shouldInclude);if(c.length+n.length>0){_=[e.optLastAdded?opt.LAST_ADDED:opt.BLOCK_NAME];const t={};for(const e of c)e!==o&&(_.push([e,e]),t[e]=!0);for(const e of n)t[e]||e===o||_.push(["*"+e,e]);util.sort(_,e=>e[1])}return t.getValue()===_[0][1]&&t.setText(_[0][0]),_}},e.initFieldName=function(e){const o=e.block.getField(e.fnm);util.assert(!!o),o.menuGenerator_=()=>{let o=[[msg.blockly.NO_FIELDS_SQB,""]];return t(e,t=>{if(t){const l=getNamedFields(t,e.shouldInclude).map(e=>e.name);if(l.length>0){o=[opt.FIELD];for(const e of l)o.push([e,e])}}}),o}},e.initBlockInputName=function(e){const t=e.block.getField(e.fnm);util.assert(!!t),t.menuGenerator_=()=>{let t=[[msg.blockly.NO_INPUTS_SQB,""]];const o=e.block.getFieldValue(e.fnmBlock);return ucm().executeOnBlock(o,o=>{if(o){const l=getNamedInputs(o,e.shouldInclude).map(e=>e.name);if(l.length>0){t=[opt.INPUT];for(const e of l)t.push([e,e])}}}),t}},e.fieldIsDropdown=function(e){return e instanceof Blockly.FieldDropdown},e.fieldIsTextInput=function(e){return e instanceof Blockly.FieldTextInput},e.initFieldValue=function(e){const o=e.block.getField(e.fnm);util.assert(!!o),o.menuGenerator_=()=>{let o=[[msg.blockly.NO_OPTIONS_SQB,""]];return t(e,t=>{if(t){const l=e.block.getFieldValue(e.fnmField),_=t.getField(l);if(_ instanceof Blockly.FieldDropdown){o=_.getOptions()}}}),o}},e.initBlockConnection=function(e){const t=e.block.getField(e.fnm);util.assert(!!t),util.assert(!(!e.fnmBlockName&&!e.fnmNewType),"neither fnmBlockName nor fnmNewType specified"),util.assert(!(e.fnmBlockName&&e.fnmNewType),"both fnmBlockName and fnmNewType are specified"),t.menuGenerator_=()=>{let t=[[msg.blockly.NO_CONNECTIONS_SQB,""]];const o=e.block.getFieldValue(e.fnmAtBlockName);return ucm().executeOnBlock(o,o=>{if(o)if(e.fnmNewType){const l=e.block.getFieldValue(e.fnmNewType);ucm().executeOnBlockType(l,e=>{const l=getConnectionOptions(e,o);l.length>0&&(t=l)})}else if(e.fnmAtBlockName){const l=e.block.getFieldValue(e.fnmBlockName);ucm().executeOnBlock(l,e=>{const l=getConnectionOptions(e,o);l.length>0&&(t=l)})}}),t}},e.initToolboxCategory=function(e){const t=e.block.getField(e.fnm);util.assert(!!t),t.menuGenerator_=()=>
1o()},e.initToolboxBlockType=function(e){const t=e.block.getField(e.fnmCategory);util.assert(!!t),t.menuGenerator_=()=>o();const l=e.block.getField(e.fnmBlockType);util.assert(!!l),l.menuGenerator_=()=>function(e,t,o){let l=[[msg.blockly.NO_TYPES_SQB,""]];if(e){const _=ucm().toolbox.getBlockPathList(e,t,o);if(_.length>0){l=[[msg.blockly.BLOCK_TYPE_SQB,""]];for(const e of _)l.push([Toolbox.getBlockUiName(e),e])}}return l}(e.block.getFieldValue(e.fnmCategory),e.cacheAs,e.shouldIncludeType)},e.getCameraOptions=l,e.initCameraName=function(e){const t=e.block.getField(e.fnm);util.assert(!!t),t.menuGenerator_=()=>l()}}(menu||(menu={}));export var codex;!function(e){function t(e,...t){return`tut.${e}(${t?t.join(", "):""})`}e.member=function(e){return`tut.${e}`},e.call=t,e.was=function(e,...o){return(o=o||[]).splice(0,0,"was",`'${e}'`),code.returnValue(t.apply(this,o))},e.promise=function(e,...o){return(o=o||[]).splice(0,0,"promise",`'${e}'`),code.returnValue(t.apply(this,o))}}(codex||(codex={})),function(e){function t(e,t){return{type:"field_dropdown",name:e,options:[t]}}e.tut_target_block={type:"tut_target_block",message0:msg.blockly.TUT_TARGET_BLOCK,rm_init:e=>{menu.initBlockName({block:e,fnm:"BLOCK_NAME",optLastAdded:!0})},args0:[t("BLOCK_NAME",opt.LAST_ADDED)],output:"String",colour:colors.UI_TARGET,rm_genJavaScript:e=>{const t=e.getFieldValue("BLOCK_NAME");return code.returnValue(t?`'.${getBlockClassName(t)}'`:"''")}};e.tut_target_field={type:"tut_target_field",message0:msg.blockly.TUT_TARGET_FIELD,rm_init:e=>{menu.initBlockName({block:e,fnm:"BLOCK_NAME",shouldInclude:e=>_(e)}),menu.initFieldName({block:e,fnm:"FIELD_NAME",fnmBlock:"BLOCK_NAME"})},rm_typeInit:e=>{menu.onFieldChange(e.type,"BLOCK_NAME",e=>menu.clearField(e,"FIELD_NAME"))},args0:[t("BLOCK_NAME",opt.BLOCK_NAME),t("FIELD_NAME",opt.FIELD)],output:"String",colour:colors.UI_TARGET,rm_genJavaScript:e=>{const t=e.getFieldValue("BLOCK_NAME"),o=e.getFieldValue("FIELD_NAME");return code.returnValue(t&&o?`'.${getFieldClassName(t,o)}'`:"''")}};e.tut_target_mutator={type:"tut_target_mutator",message0:msg.blockly.TUT_TARGET_MUTATOR,rm_init:e=>{menu.initBlockName({block:e,fnm:"BLOCK_NAME",shouldInclude:e=>!!e.mutator})},rm_typeInit:e=>{menu.onFieldChange(e.type,"BLOCK_NAME",e=>menu.clearField(e,"FIELD_NAME"))},args0:[t("BLOCK_NAME",opt.BLOCK_NAME),{type:"field_dropdown",name:"PART",options:[[msg.blockly.MUTATOR_ICON,"icon"],[msg.blockly.MUTATOR_DIALOG,"dialog"]]}],output:"String",colour:colors.UI_TARGET,rm_genJavaScript:e=>{const t=e.getFieldValue("BLOCK_NAME"),o=e.getFieldValue("PART");return code.returnValue(t&&o?`'.${getMutatorClassName(t,o)}'`:"''")}};e.tut_target_toolbox_category={type:"tut_target_toolbox_category",message0:msg.blockly.TUT_TARGET_TOOLBOX_CATEGORY,rm_init:e=>{menu.initToolboxCategory({block:e,fnm:"CATEGORY"})},args0:[t("CATEGORY",opt.CATEGORY)],output:"String",colour:colors.UI_TARGET,rm_genJavaScript:e=>{const t=e.getFieldValue("CATEGORY"),o=Toolbox.categoryNameFromPath(t).name;return code.returnValue(`"#blocklyDiv .blocklyTreeRow:contains('${o}')"`)}};e.tut_target_toolbox_block={type:"tut_target_toolbox_block",message0:msg.blockly.TUT_TARGET_TOOLBOX_BLOCK,args0:[{name:"POSITION",type:"field_input",align:"RIGHT",check:"Number",text:"1"}],output:"String",colour:colors.UI_TARGET,rm_genJavaScript:e=>code.returnValue(`"#blocklyDiv .blocklyFlyout rect:nth-of-type(${code.getValueNum(e,"POSITION","1")}):first"`)};e.tut_enable_toolbox_block={type:"tut_enable_toolbox_block",message0:msg.blockly.TUT_ENABLE_TOOLBOX_BLOCK,rm_init:e=>{menu.initToolboxBlockType({block:e,fnmCategory:"CATEGORY",fnmBlockType:"BLOCK_TYPE"})},rm_typeInit:e=>{menu.onFieldChange(e.type,"CATEGORY",e=>menu.clearField(e,"BLOCK_TYPE"))},args0:[t("CATEGORY",opt.CATEGORY),t("BLOCK_TYPE",opt.BLOCK_TYPE),{type:"field_dropdown",name:"IS_VISIBLE",options:[[msg.blockly.HIDE,"false"],[msg.blockly.UNHIDE,"true"]]}],previousStatement:null,nextStatement:null,colour:colors.METHOD,rm_genJavaScript:e=>code.lines(codex.call("enable_toolbox_block",code.getValueStr(e,"BLOCK_TYPE"),e.getFieldValue("IS_VISIBLE")))};e.tut_enable_toolbox_block_dynamic={type:"tut_enable_toolbox_block_dynamic",message0:msg.blockly.TUT_ENABLE_TOOLBOX_BLOCK_DYNAMIC,args0:[{type:"field_dropdown",name:"CATEGORY",options:[[msg.blockly.VARIABLES,"VARIABLE"],[msg.blockly.FUNCTIONS,"PROCEDURE"]]},{type:"input_value",name:"NUM",check:"Number",align:"RIGHT",rm_valueXml:'<shadow type="math_number"><field name="NUM">0</field></shadow>'},{type:"field_dropdown",name:"IS_VISIBLE",options:[[msg.blockly.HIDE,"false"],[msg.blockly.UNHIDE,"true"]]}],previousStatement:null,nextStatement:null,colour:colors.METHOD,rm_genJavaScript:e=>code.lines(codex.call("enable_toolbox_block_dynamic",code.getValueStr(e,"CATEGORY"),code.getCode(e,"NUM"),e.getFieldValue("IS_VISIBLE")))},e.tut_enable_toolbox_block_category={type:"tut_enable_toolbox_block_category",message0:msg.blockly.TUT_ENABLE_TOOLBOX_BLOCK_CATEGORY,rm_init:e=>{menu.initToolboxCategory({block:e,fnm:"CATEGORY"})},args0:[t("CATEGORY",opt.CATEGORY),{type:"field_dropdown",name:"IS_VISIBLE",options:[[msg.blockly.HIDE,"false"],[msg.blockly.UNHIDE,"true"]]}],previousStatement:null,nextStatement:null,colour:colors.METHOD,rm_genJavaScript:e=>code.lines(codex.call("enable_toolbox_block_category",code.getValueStr(e,"CATEGORY"),e.getFieldValue("IS_VISIBLE")))},e.tut_enable_toolbox_block_all={type:"tut_enable_toolbox_block_all",message0:msg.blockly.TUT_ENABLE_TOOLBOX_BLOCK_ALL,args0:[{type:"field_dropdown",name:"IS_VISIBLE",options:[[msg.blockly.HIDE,"false"],[msg.blockly.UNHIDE,"true"]]}],previousStatement:null,nextStatement:null,colour:colors.METHOD,rm_genJavaScript:e=>code.lines(codex.call("enable_toolbox_block_all",e.getFieldValue("IS_VISIBLE")))},e.tut_enable_context_menu={type:"tut_enable_context_menu",message0:msg.blockly.TUT_ENABLE_CONTEXT_MENU,args0:[{type:"field_dropdown",name:"IS_VISIBLE",options:[[msg.blockly.DISABLE,"false"],[msg.blockly.ENABLE,"true"]]}],previousStatement:null,nextStatement:null,colour:colors.METHOD,rm_genJavaScript:e=>code.lines(codex.call("enable_context_menu",e.getFieldValue("IS_VISIBLE")))},e.tut_enable_zoom_and_scroll={type:"tut_enable_zoom_and_scroll",message0:msg.blockly.TUT_ENABLE_ZOOM_AND_SCROLL,args0:[{type:"field_dropdown",name:"IS_VISIBLE",options:[[msg.blockly.DISABLE,"false"],[msg.blockly.ENABLE,"true"]]}],previousStatement:null,nextStatement:null,colour:colors.METHOD,rm_genJavaScript:e=>code.lines(codex.call("enable_zoom_and_scroll",e.getFieldValue("IS_VISIBLE")))},e.tut_get_open_toolbox_category={type:"tut_get_open_toolbox_category",message0:msg.blockly.TUT_GET_OPEN_TOOLBOX_CATEGORY,output:"String",colour:colors.STRING,rm_genJavaScript:e=>code.returnValue(codex.call("get_open_toolbox_category"))},e.tut_enum_toolbox_category={type:"tut_enum_toolbox_category",message0:msg.blockly.TUT_ENUM_TOOLBOX_CATEGORY,rm_init:e=>{menu.initToolboxCategory({block:e,fnm:"CATEGORY"})},args0:[t("CATEGORY",opt.CATEGORY)],output:"String",colour:colors.STRING,rm_genJavaScript:e=>{const t=e.getFieldValue("CATEGORY"),o=Toolbox.categoryNameFromPath(t).name;return code.returnValue(`'${o}'`)}};const o=[[msg.ALL,"#editor_tab button"],[msg.CUT,"#editor_tab #tbCut"],[msg.COPY,"#editor_tab #tbCopy"],[msg.PASTE,"#editor_tab #tbPaste"],[msg.DELETE,"#editor_tab #tbDelete"],[msg.UNDO,"#editor_tab #tbUndo"],[msg.REDO,"#editor_tab #tbRedo"],[msg.ADD_BREAKPOINT,"#editor_tab #tbBreakpoint"],[msg.FIND,"#editor_tab #tbFind"],[msg.REPLACE,"#editor_tab #tbReplace"],[msg.PRINT,"#editor_tab #tbPrint"]];e.tut_target_editor_toolbar_button={type:"tut_target_editor_toolbar_button",message0:msg.blockly.TUT_TARGET_EDITOR_TOOLBAR_BUTTON,args0:[{type:"field_dropdown",name:"TARGET",options:o}],output:"String",colour:colors.UI_TARGET,rm_genJavaScript:e=>{const t=e.getFieldValue("TARGET");return code.returnValue(`'${t}'`)}},e.tut_select_block={type:"tut_select_block",message0:msg.blockly.TUT_SELECT_BLOCK,rm_init:e=>{menu.initBlockName({block:e,fnm:"BLOCK_NAME",optLastAdded:!0})},args0:[t("BLOCK_NAME",opt.LAST_ADDED)],previousStatement:null,nextStatement:null,colour:colors.METHOD,rm_genJavaScript:e=>code.lines(codex.call("select_block",code.getValueStr(e,"BLOCK_NAME")))},e.tut_select_text_field={type:"tut_select_text_field",message0:msg.blockly.TUT_SELECT_TEXT_FIELD,rm_init:e=>{menu.initBlockName({block:e,fnm:"BLOCK_NAME",shouldInclude:e=>_(e,menu.fieldIsTextInput)}),menu.initFieldName({block:e,fnm:"FIELD_NAME",fnmBlock:"BLOCK_NAME",shouldInclude:menu.fieldIsTextInput})},rm_typeInit:e=>{menu.onFieldChange(e.type,"BLOCK_NAME",e=>menu.clearField(e,"FIELD_NAME"))},args0:[t("BLOCK_NAME",opt.BLOCK_NAME),t("FIELD_NAME",opt.FIELD)],previousStatement:null,nextStatement:null,colour:colors.METHOD,rm_genJavaScript:e=>code.lines(codex.call("select_text_field",code.getValueStr(e,"BLOCK_NAME"),code.getValueStr(e,"FIELD_NAME")))};const l=[[msg.blockly.LOCKED,"setEditable(false)|setMovable(false)|setDeletable(false)|rm_disableConnect=true"],[msg.blockly.NOT_LOCKED,"setEditable(true)|setMovable(true)|setDeletable(true)|rm_disableConnect=false"],[msg.blockly.SHADOW,"setShadow(true)"],[msg.blockly.NOT_SHADOW,"setShadow(false)"],[msg.blockly.ENABLED,"setEnabled(true)"],[msg.blockly.NOT_ENABLED,"setEnabled(false)"],[msg.blockly.EDITABLE,"setEditable(true)"],[msg.blockly.NOT_EDITABLE,"setEditable(false)"],[msg.blockly.MOVABLE,"setMovable(true)"],[msg.blockly.NOT_MOVABLE,"setMovable(false)"],[msg.blockly.DELETABLE,"setDeletable(true)"],[msg.blockly.NOT_DELETABLE,"setDeletable(false)"],[msg.blockly.CONNECTABLE,"rm_disableConnect=false"],[msg.blockly.NOT_CONNECTABLE,"rm_disableConnect=true"]];e.tut_method_block={type:"tut_method_block",message0:msg.blockly.TUT_METHOD_BLOCK,rm_init:e=>{menu.initBlockName({block:e,fnm:"BLOCK_NAME",optLastAdded:!0})},args0:[t("BLOCK_NAME",opt.LAST_ADDED),{type:"field_dropdown",name:"METHOD",options:l}],previousStatement:null,nextStatement:null,colour:colors.METHOD,rm_genJavaScript:e=>code.invokeMult(codex.call("get_block",code.getValueStr(e,"BLOCK_NAME")),e.getFieldValue("METHOD").split("|"))},e.tut_method_block_all={type:"tut_method_block_all",message0:msg.blockly.TUT_METHOD_BLOCK_ALL,args0:[{type:"field_dropdown",name:"METHOD",options:l}],previousStatement:null,nextStatement:null,colour:colors.METHOD,rm_genJavaScript:e=>code.forEachItem(codex.call("get_all_blocks"),"_item",code.invokeMult("_item",e.getFieldValue("METHOD").split("|")))},e.tut_method_block_terminal={type:"tut_method_block_terminal",message0:msg.blockly.TUT_METHOD_BLOCK_TERMINAL,args0:[{type:"field_dropdown",name:"METHOD",options:l}],previousStatement:null,nextStatement:null,colour:colors.METHOD,rm_genJavaScript:e=>code.forEachItem(codex.call("get_all_blocks"),"_item","if (!_item.getNextBlock()) {"+code.invokeMult("_item",e.getFieldValue("METHOD").split("|"))+"}")},e.tut_open_mutator={type:"tut_open_mutator",message0:msg.blockly.TUT_OPEN_MUTATOR,rm_init:e=>{menu.initBlockName({block:e,fnm:"BLOCK_NAME",optLastAdded:!0,shouldInclude:e=>!!e.mutator})},args0:[t("BLOCK_NAME",opt.LAST_ADDED),{type:"field_dropdown",name:"METHOD",options:[[msg.blockly.OPEN,"mutator.setVisible(true)"],[msg.blockly.CLOSE,"mutator.setVisible(false)"]]}],previousStatement:null,nextStatement:null,colour:colors.METHOD,rm_genJavaScript:e=>code.invokeMult(codex.call("get_block",code.getValueStr(e,"BLOCK_NAME")),e.getFieldValue("METHOD").split("|"))},e.S_NEW_TYPE="NEW_TYPE",e.S_NEW_NAME="NEW_NAME";e.tut_create_block={type:"tut_create_block",message0:msg.blockly.TUT_CREATE_BLOCK,rm_init:t=>{menu.initToolboxBlockType({block:t,fnmCategory:"CATEGORY",fnmBlockType:e.S_NEW_TYPE}),menu.initBlockName({block:t,fnm:"AT_NAME",fnmExcludeBlockName:e.S_NEW_NAME}),menu.initBlockConnection({block:t,fnm:"CONNECTION",fnmNewType:e.S_NEW_TYPE,fnmAtBlockName:"AT_NAME"})},rm_typeInit:t=>{menu.onFieldChange(t.type,"CATEGORY",t=>menu.clearField(t,e.S_NEW_TYPE)),menu.onFieldChange(t.type,e.S_NEW_TYPE,e=>menu.clearField(e,"CONNECTION")),menu.onFieldChange(t.type,"AT_NAME",e=>menu.clearField(e,"CONNECTION"))},args0:[t("CATEGORY",opt.CATEGORY),t(e.S_NEW_TYPE,opt.BLOCK_TYPE),{type:"field_input",name:e.S_NEW_NAME},t("AT_NAME",opt.BLOCK_NAME),t("CONNECTION",opt.SELECT)],previousStatement:null,nextStatement:null,colour:colors.METHOD_BLOCKLY_SET_NAME,rm_genJavaScript:t=>{const o={blockType:t.getFieldValue(e.S_NEW_TYPE)||"",newBlockName:t.getFieldValue(e.S_NEW_NAME)||"",attachToBlockName:t.getFieldValue("AT_NAME")||"",connectionId:t.getFieldValue("CONNECTION")||""};return code.lines(codex.call("create_block",JSON.stringify(o)))}};function _(e,t){return getNamedFields(e,t).length>0}e.tut_move_block={type:"tut_move_block",message0:msg.blockly.TUT_MOVE_BLOCK,rm_init:e=>{menu.initBlockName({block:e,fnm:"BLOCK_NAME",optLastAdded:!0}),menu.initBlockName({block:e,fnm:"AT_NAME"})},args0:[t("BLOCK_NAME",opt.LAST_ADDED),t("AT_NAME",[msg.blockly.BLOCK_NAME_SQ
1B,""]),{type:"field_input",name:"X",check:"Number",text:"0"},{type:"field_input",name:"Y",check:"Number",text:"0"}],previousStatement:null,nextStatement:null,colour:colors.METHOD,rm_genJavaScript:e=>code.lines(codex.call("move_block",code.getValueStr(e,"BLOCK_NAME"),code.getValueStr(e,"AT_NAME"),code.getValueNum(e,"X"),code.getValueNum(e,"Y")))},e.tut_attach_block={type:"tut_attach_block",message0:msg.blockly.TUT_ATTACH_BLOCK,rm_init:t=>{menu.initBlockName({block:t,fnm:"BLOCK_NAME",optLastAdded:!0}),menu.initBlockName({block:t,fnm:"AT_NAME",fnmExcludeBlockName:e.S_NEW_NAME}),menu.initBlockConnection({block:t,fnm:"CONNECTION",fnmBlockName:"BLOCK_NAME",fnmAtBlockName:"AT_NAME"})},rm_typeInit:e=>{menu.onFieldChange(e.type,"BLOCK_NAME",e=>menu.clearField(e,"CONNECTION")),menu.onFieldChange(e.type,"AT_NAME",e=>menu.clearField(e,"CONNECTION"))},args0:[t("BLOCK_NAME",opt.LAST_ADDED),t("AT_NAME",[msg.blockly.BLOCK_NAME_SQB,""]),t("CONNECTION",opt.SELECT)],previousStatement:null,nextStatement:null,colour:colors.METHOD,rm_genJavaScript:e=>code.lines(codex.call("attach_block",code.getValueStr(e,"BLOCK_NAME"),code.getValueStr(e,"AT_NAME"),code.getValueStr(e,"CONNECTION")))},e.tut_scroll_to_block={type:"tut_scroll_to_block",message0:msg.blockly.TUT_SCROLL_TO_BLOCK,rm_init:e=>{menu.initBlockName({block:e,fnm:"BLOCK_NAME",optLastAdded:!0})},rm_typeInit:e=>{menu.onFieldChange(e.type,"BLOCK_NAME",e=>menu.clearField(e,"CONNECTION"))},previousStatement:null,nextStatement:null,args0:[t("BLOCK_NAME",opt.BLOCK_NAME)],colour:colors.METHOD,rm_genJavaScript:e=>code.lines(codex.call("scroll_to_block_if_needed",code.getValueStr(e,"BLOCK_NAME")))},e.tut_delete_block={type:"tut_delete_block",message0:msg.blockly.TUT_DELETE_BLOCK,rm_init:e=>{menu.initBlockName({block:e,fnm:"BLOCK_NAME",optLastAdded:!0})},args0:[t("BLOCK_NAME",opt.LAST_ADDED)],previousStatement:null,nextStatement:null,colour:colors.METHOD,rm_genJavaScript:e=>code.lines(codex.call("delete_block",code.getValueStr(e,"BLOCK_NAME")))};e.tut_set_field_value={type:"tut_set_field_value",message0:msg.blockly.TUT_SET_FIELD_VALUE,rm_init:e=>{menu.initBlockName({block:e,fnm:"BLOCK_NAME",shouldInclude:e=>_(e,e=>!menu.fieldIsDropdown(e)||e instanceof Blockly.FieldVariable)}),menu.initFieldName({block:e,fnm:"FIELD_NAME",fnmBlock:"BLOCK_NAME",shouldInclude:e=>!menu.fieldIsDropdown(e)||e instanceof Blockly.FieldVariable})},rm_typeInit:e=>{menu.onFieldChange(e.type,"BLOCK_NAME",e=>menu.clearField(e,"FIELD_NAME"))},args0:[t("BLOCK_NAME",opt.BLOCK_NAME),t("FIELD_NAME",opt.FIELD),{type:"field_input",name:"FIELD_VALUE"}],previousStatement:null,nextStatement:null,colour:colors.METHOD,rm_genJavaScript:e=>code.lines(codex.call("set_field_value",code.getValueStr(e,"BLOCK_NAME"),code.getValueStr(e,"FIELD_NAME"),code.getValueStr(e,"FIELD_VALUE")))},e.tut_set_field_value_dropdown={type:"tut_set_field_value_dropdown",message0:msg.blockly.TUT_SET_FIELD_VALUE_DROPDOWN,rm_init:e=>{menu.initBlockName({block:e,fnm:"BLOCK_NAME",shouldInclude:e=>_(e,e=>menu.fieldIsDropdown(e)&&!(e instanceof Blockly.FieldVariable))}),menu.initFieldName({block:e,fnm:"FIELD_NAME",fnmBlock:"BLOCK_NAME",shouldInclude:menu.fieldIsDropdown}),menu.initFieldValue({block:e,fnm:"FIELD_VALUE",fnmBlock:"BLOCK_NAME",fnmField:"FIELD_NAME"})},rm_typeInit:e=>{menu.onFieldChange(e.type,"BLOCK_NAME",e=>menu.clearField(e,"FIELD_NAME")),menu.onFieldChange(e.type,"FIELD_NAME",e=>menu.clearField(e,"FIELD_VALUE"))},args0:[t("BLOCK_NAME",opt.BLOCK_NAME),t("FIELD_NAME",opt.FIELD),t("FIELD_VALUE",opt.OPTION)],previousStatement:null,nextStatement:null,colour:colors.METHOD,rm_genJavaScript:e=>code.lines(codex.call("set_field_value",code.getValueStr(e,"BLOCK_NAME"),code.getValueStr(e,"FIELD_NAME"),code.getValueStr(e,"FIELD_VALUE")))};const c={type:"field_dropdown",name:"EVENT",options:[[msg.blockly.POPUP_CLOSED,"popupClosed"],[msg.blockly.BLOCK_ADDED,"blockAdded"],[msg.blockly.BLOCK_MOVED,"blockMoved"],[msg.blockly.TOOLBOX_OPEN,"toolboxOpen"],[msg.blockly.USER_PROGRAM_RUN,"userProgramRun"],[msg.blockly.USER_PROGRAM_DONE,"userProgramDone"],[msg.blockly.USER_PROGRAM_STOP,"userProgramStop"],[msg.blockly.USER_PROGRAM_ERROR,"userProgramError"],[msg.blockly.MIMIC_CONNECT,"mimicConnect"],[msg.blockly.MIMIC_DISCONNECT,"mimicDisconnect"]]},n={type:"field_dropdown",name:"EVENT",options:[[msg.blockly.MUTATOR_OPENED,"mutatorOpen"],[msg.blockly.MUTATOR_CLOSED,"mutatorClose"]]},a={type:"field_dropdown",name:"STARTSTOPTOGGLE",options:[[msg.blockly.TUT_TEST_START,'"
1start"'],[msg.blockly.TUT_TEST_STOP,'"stop"'],[msg.blockly.TUT_TEST_TOGGLE,'"toggle"']]};e.tut_test_drive={type:"tut_test_drive",message0:msg.blockly.TUT_TEST_DRIVE,args0:[a],colour:colors.METHOD,previousStatement:null,nextStatement:null,rm_genJavaScript:e=>code.lines(codex.call("test_drive",e.getFieldValue("STARTSTOPTOGGLE")))},e.tut_promise={type:"tut_promise",message0:msg.blockly.TUT_PROMISE,args0:[c],output:"rm_Promise",colour:colors.PROMISE,rm_genJavaScript:e=>codex.promise(e.getFieldValue("EVENT"))},e.tut_was={type:"tut_was",message0:msg.blockly.TUT_WAS,args0:[c],output:"Boolean",colour:colors.LOGIC,rm_genJavaScript:e=>codex.was(e.getFieldValue("EVENT"))},e.tut_promise_fieldChanged={type:"tut_promise_fieldChanged",message0:msg.blockly.TUT_PROMISE_FIELD_CHANGED,rm_init:e=>{menu.initBlockName({block:e,fnm:"BLOCK_NAME",shouldInclude:e=>_(e)}),menu.initFieldName({block:e,fnm:"FIELD_NAME",fnmBlock:"BLOCK_NAME"})},rm_typeInit:e=>{menu.onFieldChange(e.type,"BLOCK_NAME",e=>menu.clearField(e,"FIELD_NAME"))},args0:[t("BLOCK_NAME",opt.BLOCK_NAME),t("FIELD_NAME",opt.FIELD)],output:"rm_Promise",colour:colors.PROMISE,rm_genJavaScript:e=>codex.promise("fieldChanged",code.getValueStr(e,"BLOCK_NAME"),code.getValueStr(e,"FIELD_NAME"))},e.tut_was_fieldChanged={type:"tut_was_fieldChanged",message0:msg.blockly.TUT_WAS_FIELD_CHANGED,rm_init:e=>{menu.initBlockName({block:e,fnm:"BLOCK_NAME",shouldInclude:e=>_(e)}),menu.initFieldName({block:e,fnm:"FIELD_NAME",fnmBlock:"BLOCK_NAME"})},rm_typeInit:e=>{menu.onFieldChange(e.type,"BLOCK_NAME",e=>menu.clearField(e,"FIELD_NAME"))},args0:[t("BLOCK_NAME",opt.BLOCK_NAME),t("FIELD_NAME",opt.FIELD)],output:"Boolean",colour:colors.LOGIC,rm_genJavaScript:e=>codex.was("fieldChanged",code.getValueStr(e,"BLOCK_NAME"),code.getValueStr(e,"FIELD_NAME"))},e.tut_promise_with_block={type:"tut_promise_with_block",message0:msg.blockly.TUT_PROMISE_WITH_BLOCK,rm_init:e=>{menu.initBlockName({block:e,fnm:"BLOCK_NAME",shouldInclude:e=>!!e.mutator})},args0:[n,t("BLOCK_NAME",opt.BLOCK_NAME)],output:"rm_Promise",colour:colors.PROMISE,rm_genJavaScript:e=>codex.promise(e.getFieldValue("EVENT"),code.getValueStr(e,"BLOCK_NAME"))},e.tut_was_with_block={type:"tut_was_with_block",message0:msg.blockly.TUT_WAS_WITH_BLOCK,rm_init:e=>{menu.initBlockName({block:e,fnm:"BLOCK_NAME",shouldInclude:e=>!!e.mutator})},args0:[n,t("BLOCK_NAME",opt.BLOCK_NAME)],output:"Boolean",colour:colors.LOGIC,rm_genJavaScript:e=>codex.was(e.getFieldValue("EVENT"),code.getValueStr(e,"BLOCK_NAME"))},e.S_EXPECTED_TYPE="EXPECTED_TYPE",e.tut_set_added_block_name={type:"tut_set_added_block_name",message0:msg.blockly.TUT_SET_ADDED_BLOCK_NAME,rm_init:t=>{menu.initToolboxBlockType({block:t,fnmCategory:"CATEGORY",fnmBlockType:e.S_EXPECTED_TYPE})},rm_typeInit:t=>{menu.onFieldChange(t.type,"CATEGORY",t=>menu.clearField(t,e.S_EXPECTED_TYPE))},args0:[{type:"field_input",name:e.S_NEW_NAME},t("CATEGORY",opt.CATEGORY),t(e.S_EXPECTED_TYPE,opt.BLOCK_TYPE)],previousStatement:null,nextStatement:null,colour:colors.METHOD_BLOCKLY_SET_NAME,rm_genJavaScript:t=>code.lines(codex.call("set_added_block_name",code.getValueStr(t,e.S_NEW_NAME),code.getValueStr(t,e.S_EXPECTED_TYPE)))};e.tut_set_input_block_name={type:"tut_set_input_block_name",message0:msg.blockly.TUT_SET_INPUT_BLOCK_NAME,rm_init:t=>{menu.initBlockName({block:t,fnm:"AT_NAME"}),menu.initBlockInputName({block:t,fnm:"INPUT",fnmBlock:"AT_NAME"}),menu.initToolboxBlockType({block:t,fnmCategory:"CATEGORY",fnmBlockType:e.S_EXPECTED_TYPE})},rm_typeInit:t=>{menu.onFieldChange(t.type,"CATEGORY",t=>menu.clearField(t,e.S_EXPECTED_TYPE))},args0:[t("AT_NAME",opt.BLOCK_NAME),t("INPUT",opt.INPUT),{type:"field_input",name:e.S_NEW_NAME},t("CATEGORY",opt.CATEGORY),t(e.S_EXPECTED_TYPE,opt.BLOCK_TYPE)],previousStatement:null,nextStatement:null,colour:colors.METHOD_BLOCKLY_SET_NAME,rm_genJavaScript:t=>code.lines(codex.call("set_input_block_name",code.getValueStr(t,"AT_NAME"),code.getValueStr(t,"INPUT"),code.getValueStr(t,e.S_NEW_NAME),code.getValueStr(t,e.S_EXPECTED_TYPE)))},e.tut_get_block_type={type:"tut_get_block_type",message0:msg.blockly.TUT_GET_BLOCK_TYPE,rm_init:e=>{menu.initBlockName({block:e,fnm:"BLOCK_NAME",optLastAdded:!0})},args0:[t("BLOCK_NAME",opt.LAST_ADDED)],output:"String",colour:colors.STRING,rm_genJavaScript:e=>code.returnValue(codex.call("get_block_type",code.getValueStr(e,"BLOCK_NAME")))},e.tut_enum_block_type={type:"tut_enum_block_type",message0:"%1%2",rm_init:e=>{menu.initToolboxBlockType({block:e,fnmCategory:"CATEGORY",fnmBlockType:"BLOCK_TYPE"})},rm_typeInit:e=>{menu.onFieldChange(e.type,"CATEGORY",e=>menu.clearField(e,"BLOCK_TYPE"))}
1,args0:[t("CATEGORY",opt.CATEGORY),t("BLOCK_TYPE",opt.BLOCK_TYPE)],output:"String",colour:colors.ENUM,rm_genJavaScript:e=>{const t=e.getFieldValue("BLOCK_TYPE");return code.returnValue(t?`'${Toolbox.typeNameFromPath(t)}'`:"''")}},e.tut_get_block_parent={type:"tut_get_block_parent",message0:msg.blockly.TUT_GET_BLOCK_PARENT,rm_init:e=>{menu.initBlockName({block:e,fnm:"BLOCK_NAME",optLastAdded:!0})},args0:[t("BLOCK_NAME",opt.LAST_ADDED)],output:"String",colour:colors.STRING,rm_genJavaScript:e=>code.returnValue(codex.call("get_block_parent",code.getValueStr(e,"BLOCK_NAME")))},e.tut_get_block_surround_parent={type:"tut_get_block_surround_parent",message0:msg.blockly.TUT_GET_BLOCK_SURROUND_PARENT,rm_init:e=>{menu.initBlockName({block:e,fnm:"BLOCK_NAME",optLastAdded:!0})},args0:[t("BLOCK_NAME",opt.LAST_ADDED)],output:"String",colour:colors.STRING,rm_genJavaScript:e=>code.returnValue(codex.call("get_block_surround_parent",code.getValueStr(e,"BLOCK_NAME")))},e.tut_get_block_parent_connection={type:"tut_get_block_parent_connection",message0:msg.blockly.TUT_GET_BLOCK_PARENT_CONNECTION,rm_init:e=>{menu.initBlockName({block:e,fnm:"BLOCK_NAME",optLastAdded:!0})},args0:[t("BLOCK_NAME",opt.LAST_ADDED)],output:"String",colour:colors.STRING,rm_genJavaScript:e=>code.returnValue(codex.call("get_block_parent_connection",code.getValueStr(e,"BLOCK_NAME")))},e.tut_enum_block_name={type:"tut_enum_block_name",message0:"%1",rm_init:e=>{menu.initBlockName({block:e,fnm:"BLOCK_NAME",optLastAdded:!0})},args0:[t("BLOCK_NAME",opt.BLOCK_NAME)],output:"String",colour:colors.ENUM,rm_genJavaScript:e=>code.returnValue(code.getValueStr(e,"BLOCK_NAME"))},e.tut_get_field_value={type:"tut_get_field_value",message0:msg.blockly.TUT_GET_FIELD_VALUE,rm_init:e=>{menu.initBlockName({block:e,fnm:"BLOCK_NAME",shouldInclude:e=>_(e)}),menu.initFieldName({block:e,fnm:"FIELD_NAME",fnmBlock:"BLOCK_NAME"})},rm_typeInit:e=>{menu.onFieldChange(e.type,"BLOCK_NAME",e=>menu.clearField(e,"FIELD_NAME"))},args0:[t("BLOCK_NAME",opt.BLOCK_NAME),t("FIELD_NAME",opt.FIELD)],output:"String",colour:colors.STRING,rm_genJavaScript:e=>code.returnValue(codex.call("get_field_value",code.getValueStr(e,"BLOCK_NAME"),code.getValueStr(e,"FIELD_NAME")))},e.tut_get_field_text={type:"tut_get_field_text",message0:msg.blockly.TUT_GET_FIELD_TEXT,rm_init:e=>{menu.initBlockName({block:e,fnm:"BLOCK_NAME",optLastAdded:!0})},args0:[t("BLOCK_NAME",opt.BLOCK_NAME),{type:"input_value",name:"NUM",check:"Number",align:"RIGHT",rm_valueXml:'<shadow type="math_number"><field name="NUM">0</field></shadow>'}],output:"String",colour:colors.STRING,rm_genJavaScript:e=>code.returnValue(codex.call("get_field_text",code.getValueStr(e,"BLOCK_NAME"),code.getCode(e,"NUM")))},e.tut_get_field_count={type:"tut_get_field_count",message0:msg.blockly.TUT_GET_FIELD_COUNT,rm_init:e=>{menu.initBlockName({block:e,fnm:"BLOCK_NAME",optLastAdded:!0})},args0:[t("BLOCK_NAME",opt.BLOCK_NAME)],output:"Number",colour:colors.STRING,rm_genJavaScript:e=>code.returnValue(codex.call("get_field_count",code.getValueStr(e,"BLOCK_NAME")))};e.tut_enum_dropdown_value={type:"tut_enum_dropdown_value",message0:msg.blockly.TUT_ENUM_DROPDOWN_VALUE,rm_init:e=>{menu.initToolboxBlockType({block:e,fnmCategory:"CATEGORY",fnmBlockType:"BLOCK_TYPE",shouldIncludeType:e=>function(e,t){return ucm().executeOnBlockType(e,e=>!!e&&_(e,t))}(e,menu.fieldIsDropdown),cacheAs:"with_dropdowns"}),menu.initFieldName({block:e,fnm:"FIELD_NAME",fnmBlockType:"BLOCK_TYPE",shouldInclude:menu.fieldIsDropdown}),menu.initFieldValue({block:e,fnm:"OPTION",fnmBlockType:"BLOCK_TYPE",fnmField:"FIELD_NAME"})},rm_typeInit:e=>{menu.onFieldChange(e.type,"BLOCK_TYPE",e=>menu.clearField(e,"FIELD_NAME")),menu.onFieldChange(e.type,"FIELD_NAME",e=>menu.clearField(e,"OPTION"))},args0:[t("CATEGORY",opt.CATEGORY),t("BLOCK_TYPE",opt.BLOCK_TYPE),t("FIELD_NAME",opt.FIELD),t("OPTION",opt.OPTION)],output:"String",colour:colors.ENUM,rm_genJavaScript:e=>code.returnValue(code.getValueStr(e,"OPTION"))};const u={type:"field_dropdown",name:"SCOREMODE",options:[[msg.blockly.TUT_LAST_MIMIC_PROGRAMMED,"false"],[msg.blockly.TUT_LAST_MIMIC_CONNECTED,"true"]]};e.tut_last_mimic_score={type:"tut_last_mimic_score",message0:msg.blockly.TUT_LAST_MIMIC_SCORE,args0:[u],output:"Number",colour:colors.LOGIC,rm_genJavaScript:e=>code.returnValue(codex.call("last_mimic_score",e.getFieldValue("SCOREMODE")))},e.tut_last_mimic_success={type:"tut_last_mimic_success",message0:msg.blockly.TUT_LAST_MIMIC_SUCCESS,args0:[u],output:"Boolean",colour:colors.LOGIC,rm_genJavaScript:e=>code.returnValue(codex.call("last_mimic_success",e.getFieldValue("SCOREMODE")))},e.tut_mimic_brain_position={type:"tut_mimic_brain_position",message0:msg.blockly.TUT_MIMIC_BRAIN_POSITION,args0:[{type:"field_dropdown",name:"AXIS",options:[[msg.blockly.Y,'"y"'],[msg.blockly.X,'"x"'],[msg.blockly.Z,'"z"']]}],output:"Number",colour:colors.MATH,rm_genJavaScript:e=>code.returnValue(codex.call("mimic_brain_position",e.getFieldValue("AXIS")))},e.S_CAMERA="CAMERA",e.tut_select_camera={type:"tut_select_camera",message0:msg.blockly.TUT_SELECT_CAMERA,colour:colors.METHOD,previousStatement:null,nextStatement:null,rm_init:t=>{menu.initCameraName({block:t,fnm:e.S_CAMERA})},args0:[t(e.S_CAMERA,opt.CAMERAS)],rm_genJavaScript:t=>code.lines(code.call("select_camera",t.getFieldValue(e.S_CAMERA)))},e.tut_select_default_camera={type:"tut_select_default_camera",message0:msg.blockly.TUT_SELECT_DEFAULT_CAMERA,colour:colors.METHOD,previousStatement:null,nextStatement:null,rm_genJavaScript:e=>code.lines(code.call("select_camera",'"default"'))};let m;e.tut_configure_hud={type:"tut_configure_hud",message0:msg.blockly.TUT_CONFIGURE_HUD,colour:colors.METHOD,previousStatement:null,nextStatement:null,args0:[{type:"input_value",name:"INDEX",check:"Number"},{type:"field_dropdown",name:"PORT",options:[["1","h1"],["2","h2"],["3","h3"],["4","h4"],["5","h5"],["6","h6"],["7","h7"],["8","h8"],["9","h9"],["10","h10"],["11","h11"],["12","h12"],["13","h13"],["14","h14"],["15","h15"],["16","h16"],["17","h17"],["18","h18"],["19","h19"],["20","h20"],["21","h21"],["A","hadi_22_1"],["B","hadi_22_2"],["C","hadi_22_3"],["D","hadi_22_4"],["E","hadi_22_5"],["F","hadi_22_6"],["G","hadi_22_7"],["H","hadi_22_8"]]},{type:"input_value",name:"STYLE",check:"String",rm_valueXml:'<shadow type="text"><field name="TEXT">rgba(44, 170, 226, 0.5)</field></shadow>'}],rm_genJavaScript:e=>{let t=e.getFieldValue("PORT");return t=t.startsWith("hadi_22_")?(21+parseInt(t[8])).toString():t.substring(1),code.lines(codex.call("configure_hud",code.getCode(e,"INDEX",t),"'"+e.getFieldValue("PORT")+"'",code.getCode(e,"STYLE")))}},function(o){o.tut_create_block_loc={type:"tut_create_block_loc",message0:msg.blockly.TUT_CREATE_BLOCK_LOC,rm_init:t=>{menu.initToolboxBlockType({block:t,fnmCategory:"CATEGORY",fnmBlockType:e.S_NEW_TYPE})},rm_typeInit:t=>{menu.onFieldChange(t.type,"CATEGORY",t=>menu.clearField(t,e.S_NEW_TYPE))},args0:[t("CATEGORY",opt.CATEGORY),t(e.S_NEW_TYPE,opt.BLOCK_TYPE),{type:"field_input",name:e.S_NEW_NAME},{type:"field_input",name:"X",check:"Number",text:"0"},{type:"field_input",name:"Y",check:"Number",text:"0"}],previousStatement:null,nextStatement:null,colour:colors.METHOD_BLOCKLY_SET_NAME,rm_genJavaScript:t=>{const o={blockType:t.getFieldValue(e.S_NEW_TYPE)||"",newBlockName:t.getFieldValue(e.S_NEW_NAME)||"",dx:parseInt(t.getFieldValue("X"))||0,dy:
1parseInt(t.getFieldValue("Y"))||0};return code.lines(codex.call("create_block",JSON.stringify(o)))}}}(m=e.deprecated||(e.deprecated={}))}(blocks||(blocks={}));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.