1import{Terminal as k}from"./xterm-Dzs0Xty2.js";import{WebLinksAddon as C}from"./addon-web-links-gdKn4uen.js";/* empty css */import{d as v,x as B,y as x,o as A,e as E,g as f,t as L,b as M,_ as S}from"./600-B6wu_fgg.js";const U={class:"creation-log"},W={class:"creation-log-header"},D={class:"creation-log-title"},F=v({__name:"CreationLog",props:{hostname:{},streaming:{type:Boolean}},emits:["done","fail"],setup(m,{emit:h}){const s=m,u=h,i=M(null);let t=null,c=null;B(async()=>{if(!i.value)return;const e=window.matchMedia("(prefers-color-scheme: dark)").matches;t=new k({fontSize:13,fontFamily:"'JetBrains Mono', Consolas, 'Liberation Mono', Menlo, Courier, monospace",convertEol:!0,disableStdin:!0,cursorBlink:!1,scrollback:5e3,theme:e?{background:"#1e1e1e",foreground:"#d4d4d4",cursor:"#d4d4d4"}:{background:"#ffffff",foreground:"#1e1e1e",cursor:"#1e1e1e"}}),t.loadAddon(new C),t.open(i.value);const o=Math.max(40,Math.floor(i.value.clientWidth/8));t.resize(o,16),s.streaming?await p():await w()});async function p(){if(t){c=new AbortController;try{const e=await fetch("/creating/stream?hostname="+encodeURIComponent(s.hostname),{signal:c.signal});if(!e.ok||!e.body){t.write(`Error connecting to creation stream\r 2`);return}const o=e.body.getReader(),l=new TextDecoder;let r="",n="";for(;;){const{value:y,done:_}=await o.read();if(_)break;r+=l.decode(y,{stream:!0});const g=r.split(` 3`);r=g.pop()||"";for(const a of g){if(a.startsWith("event:")){n=a.slice(6).trim();continue}if(a.startsWith("data:")){const d=a.slice(5).trim();if(n==="done"){u("done"),n="";continue}if(n==="fail"){u("fail",d),n="";continue}if(d)try{t.write(b(d))}catch{}}else a===""&&(n="")}}}catch(e){e.name!=="AbortError"&&t.write(`\r 4Stream ended\r 5`)}}}async function w(){if(t)try{const e=await fetch("/box/creation-log?hostname="+encodeURIComponent(s.hostname));if(!e.ok){t.write(`Failed to load creation log\r 6`);return}const o=await e.text();o&&t.write(o)}catch{t.write(`Failed to load creation log\r 7`)}}function b(e){const o=Uint8Array;
7if(o.fromBase64)return o.fromBase64(e);const l=atob(e);return Uint8Array.from(l,r=>r.charCodeAt(0))}return x(()=>{c?.abort(),t?.dispose()}),(e,o)=>(A(),E("div",U,[f("div",W,[f("span",D,L(m.streaming?"Creating...":"Creation Log"),1)]),f("div",{ref_key:"termEl",ref:i,class:"creation-log-terminal"},null,512)]))}}),V=S(F,[["__scopeId","data-v-d21fae87"]]);export{V as default};
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.