https://www.robotmesh.com/studio/content/jsx/robotmesh/tsjs/robotmesh.webworker/emscripten_worker.js
1var db;!function(e){e.ProgLanguage=null}(db||(db={}));var Module={};"undefined"==typeof path_worker&&(path_worker="."),importScripts(path_worker+"/nonmodules/msg/messages.js"),importScripts(path_worker+"/nonmodules/util_general.js"),importScripts(path_worker+"/nonmodules/interface_state.js");var emscripten_worker,ist=interface_state;self.Worker=function(e){var t=this;this.id=Math.random().toString(36).substr(2,5),this.eventListeners={message:[]},self.addEventListener("message",(function(e){if(e.data._from===t.id){var s=new MessageEvent("message");s.initMessageEvent("message",!1,!1,e.data.message,t,"",null),t.dispatchEvent(s),t.onmessage&&t.onmessage(s)}})),self.postMessage({_subworker:!0,cmd:"newWorker",id:this.id})},self.Worker.prototype={onerror:null,onmessage:null,postMessage:function(e){self.postMessage({_subworker:!0,id:this.id,cmd:"passMessage",message:e})},terminate:function(){self.postMessage({_subworker:!0,cmd:"terminate",id:this.id})},addEventListener:function(e,t,s){this.eventListeners[e]&&this.eventListeners[e].push(t)},removeEventListener:function(e,t,s){if(e in this.eventListeners){var n=this.eventListeners[e].indexOf(t);-1!==n&&this.eventListeners[e].splice(n,1)}},dispatchEvent:function(e){for(var t=this.eventListeners[e.type],s=0;s<t.length;s++)t[s](e)}},function(e){const t="worker";interface_state.LOG="wwIfcState";var s=new class{constructor(){this._touchArray=null,this._initDone=!1,this._initTimeMs=0,this.init()}init(){if(util.log(t,"init"),this._initTimeMs=Date.now(),this._initDone)throw new Error("Initializing more than once");this._initDone=!0,onmessage=e=>{var s=e.data[0],n=1;switch("run"!==s&&util.log(t,e.data),s){case"start":this.startMsg(e.data[n++],e.data[n++],e.data[n++],e.data[n++],e.data[n++],e.data[n++],e.data[n++],e.data[n++],e.data[n++],e.data[n++]);break;case"run":this.runMsg(e.data[n++],e.data[n++],e.data[n++]);break;case"updateWidgetValue":this.updateWidgetValueMsg(e.data[n++],e.data[n++],e.data[n++]);break;case"updateWidgetType":this.updateWidgetTypeMsg(e.data[n++],e.data[n++]);break;case"serialInput":this.serialInputMsg(e.data[n++]);break;default:if(null==e.data._from)throw new Error("Unknown message: "+s)}}}onStartedMsg(){postMessage(["onStarted"])}onRunDoneMsg(){postMessage(["onRunDone"])}onWidgetValueChangedMsg(e,t,s){postMessage(["onWidgetValueChanged",e,t,s])}onWidgetTypeChangedMsg(e,t){postMessage(["onWidgetTypeChanged",e,t])}onSerialOutputMsg(e){postMessage(["onSerialOutput",e])}onPrintMsg(e){postMessage(["onPrint",e])}onPrintErrMsg(e){postMessage(["onPrintErr",e])}onInvokeMsg(e,t){postMessage(["onInvoke",e,t])}onBulkInvokeMsg(e){postMessage(["onBulkInvoke",e])}subscribeStateEvents(e){this._state.widgetTypeChange((e,t,s)=>{if(e)return;const n=this._state.serializeType(s);this.onWidgetTypeChangedMsg(t.hwId,n)}),this._state.widgetValueChange((e,s,n,o,i)=>{e?util.log(t,"blocking onStateChanged on sync",n,o,i):o?(void 0===i&&(i=null),this.onWidgetValueChangedMsg(s.hwId,o,JSON.stringify(i))):(void 0===n&&(n=null),this.onWidgetValueChangedMsg(s.hwId,null,JSON.stringify(n)))})}start(e,s,o,i,r,a){this._state=r,null!=a&&(this._touchArray=new Int32Array(a)),this.subscribeStateEvents(this._state),(Module={}).robotmesh=!0,Module.mainScriptUrlOrBlob=s,Module.pyUsrImgBytes=o,Module.jsUserProgram=i,Module.state=this._state,Module.touchArray=this._touchArray,Module.stateIndex=0,Module.sendHexOutput=(e,t)=>{this.onSerialOutputMsg(t)},Module.print=(...e)=>{const s=Array.prototype.slice.call(e).join("");if(s.startsWith("Preallocating")&&s.endsWith("workers for a pthread spawn pool."))return;util.log(t,"print",s);const n=util.asciiToHex(s)+"00";Module.sendHexOutput(this._state,n)},Module.printErr=(...e)=>{const t=Array.prototype.slice.call(e).join("");t.startsWith("Exiting runtime.")||t.startsWith("exit(0) ")||this.onPrintErrMsg(t)},Module.invoke=(e,...t)=>this.onModuleInvoke(e,t),Module.invokeBufferFlush=()=>this.onModuleInvokeBufferFlush(),"duktape"==e&&(util.assert(null!=i),Module.onRuntimeInitialized=()=>{Module.callMain()}),"micropython"==e&&n.addModuleCallbacks(),r.onEmscriptenWorkerStart(Module);var l=eval;try{l(s)}catch(e){!function(e,t){if(console.error("Error in eval() of an Emscripten program"),console.log("error",e),console.log("To see the filename, enable L_EMSCRIPTEN logging in project.ts"),console.log("Name:"+e.name+" line:"+e.lineNumber+" column:"+e.columnNumber),e.lineNumber){const s=t.split("\n");console.log("Showing the relevant line "+e.lineNumber+" as ** below:\n "+s[e.lineNumber-2]+"\n**"+s[e.lineNumber-1]+"\n "+s[e.lineNumber])}else console.error("To see line/column number of an error in eval(), use Firefox.")}(e,s)}if("server"==e&&!(null!=o||null!=i)){const e=performance.now();Module.noExitRuntime=!0,Module._main=Module._robotmesh_main_startup,Module.callMain(),util.log("time","main time:",performance.now()-e)}"micropython"==e&&(Module.onRuntimeInitialized=()=>{n.init(),n.run(i)}),this.onStartedMsg()}onModuleInvokeBufferFlush(){Module.invokeBuffer&&(this.onBulkInvokeMsg(Module.invokeBuffer),Module.invokeBuffer=[])}onModuleInvoke(e,t){const s=[];for(const e of t){const t="object"==typeof e;if(t&&e.str_ptr){const t=Module.UTF8ToString(e.str_ptr);
1s.push(t)}else if(t&&e.i32_ptr&&e.size){const t=[];for(let s=0;s<e.size;s++){const n=Module.getValue(e.i32_ptr+4*s,"i32");t.push(n)}s.push(t)}else s.push(e)}if("Module"===e[0])return Module[e[1]].apply(null,s);Module.invokeBuffer?Module.invokeBuffer.push([e,s]):this.onInvokeMsg(e,s)}startMsg(e,t,s,n,o,i,r,a,l,u){const d=this.createState(t,s);d.deserialize(r),d.deserializeValues(JSON.parse(a)),d.receiveBuffers(l);const c=o?JSON.parse(o):null;this.start(e,n,c,i,d,u)}createState(e,t){switch(e){case"vexcortex":return importScripts(path_worker+"/nonmodules/interfaces/vexcortex_state.js"),new vexcortex_state.VexCortexState;case"vexiq":return importScripts(path_worker+"/nonmodules/interfaces/vexiq_state.js"),new vexiq_state.VexIQState(t);case"vexv5":return importScripts(path_worker+"/nonmodules/interfaces/vexv5_state.js"),new vexv5_state.VexV5State;default:throw new Error("unsupported interface type: "+e)}}runMsg(e,t,s,n){if(!Module._repeatUserTask)throw new Error("Compiled code has no _repeatUserTask method");Module.physicsCount=t;for(var o=0;o<e;o++){var i=null==s?Math.floor(Date.now()-this._initTimeMs):s+o*n;Module.milliseconds=i,Module._repeatUserTask()}this.onRunDoneMsg()}updateWidgetValueMsg(e,t,s){const n=this._state.getWidgetByHwid(e),o=JSON.parse(s);t?n.setValueProperty(t,o,!0):n.setValue(o,!0)}updateWidgetTypeMsg(e,t){const s=this._state.getWidgetByHwid(e),n=this._state.deserializeType(t,s.hwId);s.setType(n,!0)}serialInputMsg(e){this._state.serial_appendInput(e)}};let n;e.getState=function(){return s._state},function(e){e.addModuleCallbacks=function(){Module.locateFile=function(e,t){const s="/studio/content/device_scripts/vexv5/micropython/"+e;return util.log("mpy","locateFile",s),s}},e.init=function(){Module.ccall("mp_js_init","null",["int"],[4194304])},e.run=function(e){Module.ccall("mp_js_do_str","null",["string"],[e])}}(n||(n={}))}(emscripten_worker||(emscripten_worker={}));
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.