import{c0 as d,be as u,bm as f,c as a,o as i,h as y,i as s,bL as v,b3 as t,t as m,F as h,y as T,A as g,br as k}from"./B7uMD7bG.js";var l=d(),w={root:"p-terminal p-component",content:"p-terminal-content",prompt:"p-terminal-prompt",command:"p-terminal-command",response:"p-terminal-response",container:"p-terminal-prompt-container",commandText:"p-terminal-input"},b=u.extend({name:"terminal",classes:w}),S={name:"BaseTerminal",extends:f,props:{welcomeMessage:{type:String,default:null},prompt:{type:String,default:null}},style:b,provide:function(){return{$parentInstance:this}}},x={name:"Terminal",extends:S,inheritAttrs:!1,data:function(){return{commandText:null,commands:[]}},mounted:function(){l.on("response",this.responseListener),this.$refs.input.focus()},updated:function(){this.$el.scrollTop=this.$el.scrollHeight},beforeUnmount:function(){l.off("response",this.responseListener)},methods:{onClick:function(){this.$refs.input.focus()},onKeydown:function(n){n.key==="Enter"&&this.commandText&&(this.commands.push({text:this.commandText}),l.emit("command",this.commandText),this.commandText="")},responseListener:function(n){this.commands[this.commands.length-1].response=n}}};function C(e,n,L,B,p,o){return i(),a("div",t({class:e.cx("root"),onClick:n[2]||(n[2]=function(){return o.onClick&&o.onClick.apply(o,arguments)})},e.ptmi("root")),[e.welcomeMessage?(i(),a("div",v(t({key:0},e.ptm("welcomeMessage"))),m(e.welcomeMessage),17)):y("",!0),s("div",t({class:e.cx("content")},e.ptm("content")),[(i(!0),a(h,null,T(p.commands,function(r,c){return i(),a("div",t({key:r.text+c.toString()},e.ptm("commands")),[s("span",t({class:e.cx("prompt")},e.ptm("prompt")),m(e.prompt),17),s("span",t({class:e.cx("command")},e.ptm("command")),m(r.text),17),s("div",t({class:e.cx("response"),"aria-live":"polite"},e.ptm("response")),m(r.response),17)],16)}),128))],16),s("div",t({class:e.cx("container")},e.ptm("container")),[s("span",t({class:e.cx("prompt")},e.ptm("prompt")),m(e.prompt),17),g(s("input",t({ref:"input","onUpdate:modelValue":n[0]||(n[0]=function(r){return p.commandText=r}),type:"text",class:e.cx("commandText"),autocomplete:"off",onKeydown:n[1]||(n[1]=function(){return o.onKeydown&&o.onKeydown.apply(o,arguments)})},e.ptm("commandText")),null,16),[[k,p.commandText]])],16)],16)}x.render=C;export{x as default};