1import{ProgLanguage}from"../db_enum.js";import{ide}from"../ide.js";import{interface_monitor}from"../interface_monitor.js";import{joystick_wizard}from"../joystick_wizard.js";import{msg}from"../msg/messages.js";import{prog_language}from"../prog_language/prog_language.js";import{util as utilweb}from"../util.js";import{util}from"../util_general.js";import{editor}from"./editor.js";import{editor_ace}from"./editor_ace.js";export var editor_joywiz;!function(e){e.JoystickWizardEditor=class{constructor(e){this.aceEditor=null,this.generatedCodeAceEditor=null,this.codeModel=null,this.editorTabTitle=msg.JOYSTICK_WIZARD,this.generatesCode=!0,this.generatedCodeLanguage=ProgLanguage.Python,this._contentChangeHandlers=[],this._cleanCode="",this._isReadOnly=e,editor.fillEditorTemplate("editor-joywiz")}getDisplayRowOffset(){return 0}exit(){this.generatedCodeAceEditor.destroy(),utilweb.$("#editor_codegen_tab").remove()}async start(e){this.generatedCodeAceEditor=editor_ace.AceEditor.createAceEditorWithNode("codegen_tab",this.generatedCodeLanguage,!0);const t=ide.project.hwInterface.getInterfaceMonitor(),o=await ide.project.hwInterface.getJoystickWizard();joystick_wizard.start(t,o,ide.project,e),this.setReadOnly(this._isReadOnly),jQuery("#loadingEditor").hide(),jQuery("#joystick_wizard").show(),joystick_wizard.contentChange(()=>{this.raiseContentChange()}),ide.project.getState().configChange(()=>{this.raiseContentChange()}),this.markClean()}show(){}setReadOnly(e){this._isReadOnly=e,utilweb.$("#joystick_wizard input").attr("readonly",e),utilweb.$("#joystick_wizard select").attr("disabled",e),utilweb.$("#joystick_wizard button").toggle(!e),utilweb.$("#joystick_wizard").css("background-color",e?editor.BACKGROUND_READONLY:editor.BACKGROUND_NORMAL)}getReadOnly(){return this._isReadOnly}getCode(e=!1){let t="",o=[];if(!e){const e=prog_language.getConfigDelims(ProgLanguage.Python);t+=e.start+interface_monitor.serializeToJson(ide.project)+e.end,t+='"""__JOYWIZ__\n'+joystick_wizard.getIfcJoywiz().serialize()+'\n"""\n\n'}try{const e=joystick_wizard.getPythonActionsCode();t+=e.code,o=o.concat(e.errors)}catch(e){t+=editor.S_ERROR+e.message,o.push({lineNum:null,blockId:null,message:e.message})}return t+="\n",{code:t,errors:o}}showErrorMarkers(e){if(jQuery(".joywiz_widget").removeClass("joywizError"),jQuery(".joywiz_action").removeClass("joywizError"),e)for(const t of e)if(t.blockId){const e="#joywiz_"+t.blockId;if(util.log("joywiz_ed","widget error",e,t.message),jQuery(e).addClass("joywizError"),t.subId){const o=parseInt(t.subId);util.log("joywiz_ed","action error",e,o,t.message),jQuery(e+" .joywiz_action").eq(o).addClass("joywizError")}}}resize(e){var t=jQuery("#joystick_wizard");t.height(e-t.position().top)}contentChange(e){this._contentChangeHandlers.push(e)}raiseContentChange(){this._contentChangeHandlers.forEach(e=>{e()})}isClean(){return this._cleanCode==this.getCode().code}markClean(){this._cleanCode=this.getCode().code}initializeToolbar(){return!1}getBreakpoints(){return[]}setBreakpoints(e){}onBreakpointsUpdated(e){}highlightLines(e){editor_ace.AceEditor.highlightLines(this.generatedCodeAceEditor,e)}highlightBlocks(e){}getSelectedBlockId(){}lineIsAtBlock(e){return!0}}}(editor_joywiz||(editor_joywiz={}));
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.