this.primereact=this.primereact||{},this.primereact.terminal=function(e,t,n,r){"use strict";function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=o(t);function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0){var n=p(t);n[n.length-1].response=e,this.setState({commands:n})}}},{key:"clear",value:function(){this.setState({commands:[],index:0})}},{key:"componentDidMount",value:function(){n.TerminalService.on("response",this.response),n.TerminalService.on("clear",this.clear)}},{key:"componentDidUpdate",value:function(){this.container.scrollTop=this.container.scrollHeight}},{key:"componentWillUnmount",value:function(){n.TerminalService.off("response",this.response),n.TerminalService.off("clear",this.clear)}},{key:"renderWelcomeMessage",value:function(){return this.props.welcomeMessage?a.default.createElement("div",null,this.props.welcomeMessage):null}},{key:"renderCommand",value:function(e,t){var n=e.text,r=e.response;return a.default.createElement("div",{key:"".concat(n).concat(t)},a.default.createElement("span",{className:"p-terminal-prompt"},this.props.prompt," "),a.default.createElement("span",{className:"p-terminal-command"},n),a.default.createElement("div",{className:"p-terminal-response"},r))}},{key:"renderContent",value:function(){var e=this,t=this.state.commands.map((function(t,n){return e.renderCommand(t,n)}));return a.default.createElement("div",{className:"p-terminal-content"},t)}},{key:"renderPromptContainer",value:function(){var e=this;return a.default.createElement("div",{className:"p-terminal-prompt-container"},a.default.createElement("span",{className:"p-terminal-prompt"},this.props.prompt," "),a.default.createElement("input",{ref:function(t){return e.input=t},type:"text",value:this.state.commandText,className:"p-terminal-input",autoComplete:"off",onChange:this.onInputChange,onKeyDown:this.onInputKeyDown}))}},{key:"render",value:function(){var e=this,t=r.classNames("p-terminal p-component",this.props.className),n=this.renderWelcomeMessage(),o=this.renderContent(),i=this.renderPromptContainer();return a.default.createElement("div",{ref:function(t){return e.container=t},id:this.props.id,className:t,style:this.props.style,onClick:this.onClick},n,o,i)}}])&&m(i.prototype,c),s&&m(i,s),Object.defineProperty(i,"prototype",{writable:!1}),u}(t.Component);return S={id:null,style:null,className:null,welcomeMessage:null,prompt:null},(C="defaultProps")in(k=x)?Object.defineProperty(k,C,{value:S,enumerable:!0,configurable:!0,writable:!0}):k[C]=S,e.Terminal=x,Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.terminalservice,primereact.utils);