1window.activeKeys={},window.keyBuffer=[],void 0===window.currentRunId&&(window.currentRunId=0),window.currentLineWidth=1;const SPECIAL_KEY_CODES={Enter:13,Escape:27," ":32};function resetEngineState(){void 0!==window.ctx&&window._realCtx&&(window.ctx=window._realCtx,window._realCtx=null),Object.assign(window,{fastGraphicsMode:!1,_fastGfxCanvas:null,_fastGfxCtx:null,_pixelCanvas:null,_pixelCtx:null,_pixelData:null,_pixelData32:null,_pixelDataDirty:!1,audioScheduleTime:0,currentTextColor:"white",currentBgColor:"black",currentFontFamily:"Courier New",currentFontSize:18,currentLineWidth:1,currentFontWeight:"bold",interpreterPaused:!1,_mouseCursor:null,_mouseWheelUp:0,_mouseWheelDown:0,_padKeys:!0}),document.activeElement?.blur?.(),"function"==typeof window.stopAllAudio&&window.stopAllAudio(),"function"==typeof window.closeAllSockets&&window.closeAllSockets(),void 0!==window.ctx&&(window.ctx.lineWidth=1,window.ctx.__lastLineWidth=1,window.ctx.__lastFill=null,window.ctx.__lastStroke=null,window.ctx.globalCompositeOperation="source-over",window.ctx.globalAlpha=1,window.ctx.setTransform(1,0,0,1,0,0),window._matStack=[],window.ctx.canvas&&(window.ctx.canvas.style.cursor="")),"function"==typeof window.termSetSize&&window.termSetSize(80,25),"function"==typeof clearTerminal&&clearTerminal(),"function"==typeof openPanel&&openPanel(),"function"==typeof clearGfx&&clearGfx(),window.highlightLine=null;const e=document.getElementById("_gotoHighlight");e&&(e.style.display="none"),window.hideErrorBanner?.();try{"function"==typeof getAudioCtxVM&&getAudioCtxVM()}catch(e){window.__bfDebug}if(window._fpsPrev=0,!document.getElementById("_fpsOverlay")){const e=document.createElement("div");e.id="_fpsOverlay",Object.assign(e.style,{position:"absolute",top:"4px",left:"4px",zIndex:"9999",background:"rgba(0,0,0,0.5)",color:"#00ff00",fontFamily:"monospace",fontSize:"14px",fontWeight:"bold",padding:"2px 6px",pointerEvents:"none",display:"none"}),(document.querySelector("#outputPanel .output-content")??document.body).appendChild(e)}}function handleRunError(e,n="runtime"){if(null==e?.rawIndex&&"number"==typeof window.currentVm?.lastDebugLine&&window.currentVm.lastDebugLine>0&&(e.rawIndex=window.currentVm.lastDebugLine),"function"==typeof window.reportError)window.reportError(e,n);else{const n=e?.message??String(e);"function"==typeof printToTerminal&&printToTerminal(`Runtime Error: ${n}`,"error"),window.updateStatusDisplay?.("error")}}document.addEventListener("keydown",e=>{if("TEXTAREA"===e.target?.tagName||"INPUT"===e.target?.tagName)return;if(!e.key)return;const n=e.key.toUpperCase();if(window.activeKeys[n]=!0," "===n&&(window.activeKeys.SPACE=!0),window.keyBuffer.length<256&&(1===e.key.length?window.keyBuffer.push(e.key):void 0!==SPECIAL_KEY_CODES[e.key]&&window.keyBuffer.push(String.fromCharCode(SPECIAL_KEY_CODES[e.key]))),"F12"===e.key&&e.ctrlKey){window._fpsDebug=!window._fpsDebug;const e=document.getElementById("_fpsOverlay");e&&(e.style.display=window._fpsDebug?"block":"none")}}),document.addEventListener("keyup",e=>{if(!e.key)return;const n=e.key.toUpperCase();window.activeKeys[n]=!1," "===n&&(window.activeKeys.SPACE=!1)}),function(){let e=!1;const n=()=>
1{if(e&&"running"===window._vmAudioCtx?.state)return;if("function"!=typeof getAudioCtxVM)return;let n;try{n=getAudioCtxVM()}catch(e){return}if("suspended"===n.state&&n.resume(),!e){e=!0;const t=n.createBufferSource();t.buffer=n.createBuffer(1,1,22050),t.connect(n.destination),t.start(0)}},t={passive:!0,capture:!0};for(const e of["pointerdown","touchend","mousedown","keydown"])document.addEventListener(e,n,t)}(),window.runProgram=async function(){resetEngineState();const e=void 0!==window.codeEditor?window.codeEditor.value:"";let n="compile";try{window.updateStatusDisplay?.("running");let t=e,o=null;if(window.bfGetRunSource){const e=window.bfGetRunSource();null!=e&&(t=e,o=window.bfGetEntryName?.()||null)}window.bfPreprocess&&(t=await window.bfPreprocess(t)),window.__bfLastSource=t;const i=compileProgram(t);window.__bfRun={source:t,root:o},Object.assign(window,{currentSubDefs:i.subDefs,currentTypes:i.types,currentDataList:i.dataList,constantVars:i.constantVars,currentDataPtr:0});const r=new VM(i);window.currentVm=r,window.currentEnv=r.globalEnv,n="runtime",await r.run(),r.runId===window.currentRunId&&window.updateStatusDisplay?.("finished")}catch(e){handleRunError(e,n)}},window.stopProgram=function(){window.currentRunId++,window.currentVm&&(window.currentVm.running=!1);const e=document.getElementById("sb-engine-status");"â ERROR"!==e?.textContent&&window.updateStatusDisplay?.("stopped"),window.stopAllAudio?.()};
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.