text: (function(global,factory){if('function'==typeof define&&define.amd)define(['exports','react','prop-types','whatkey','./styled-elements'],factory);else if('undefined'!=typeof exports)factory(exports,require('react'),require('prop-types'),require('whatkey'),require('./styled-elements'));else{var mod={exports:{}};factory(mod.exports,global.React,global.propTypes,global.whatkey,global.styledElements),global.index=mod.exports}})(this,function(exports,_react,_propTypes,_whatkey2,_styledElements){'use strict';function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError('Cannot call a class as a function')}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');return call&&('object'==typeof call||'function'==typeof call)?call:self}function _inherits(subClass,superClass){if('function'!=typeof superClass&&null!==superClass)throw new TypeError('Super expression must either be null or a function, not '+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}Object.defineProperty(exports,'__esModule',{value:!0});var _class,_temp2,_react2=_interopRequireDefault(_react),_propTypes2=_interopRequireDefault(_propTypes),_whatkey3=_interopRequireDefault(_whatkey2),_extends=Object.assign||function(target){for(var source,i=1;i<arguments.length;i++)for(var key in source=arguments[i],source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key]);return target},_createClass=function(){function defineProperties(target,props){for(var descriptor,i=0;i<props.length;i++)descriptor=props[i],descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,'value'in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),Content=(_temp2=_class=function(_Component){function Content(){var _ref,_temp,_this,_ret;_classCallCheck(this,Content);for(var _len=arguments.length,args=Array(_len),_key=0;_key<_len;_key++)args[_key]=arguments[_key];return _ret=(_temp=(_this=_possibleConstructorReturn(this,(_ref=Content.__proto__||Object.getPrototypeOf(Content)).call.apply(_ref,[this].concat(args))),_this),_this.state={summary:[],promptPrefix:'',prompt:'>',history:[],historyCounter:0,input:[],keyInputs:[],canScroll:!0,controller:null},_this.componentWillMount=function(){var data=_this.context.instances.find(function(i){return i.index===_this.props.id}),state={prompt:_this.props.prompt};data&&(state=_extends({},state,data.oldData)),_this.setState(state)},_this.componentDidMount=function(){_this.focusInput();var data=_this.context.instances.find(function(i){return i.index===_this.props.id});_this.unregister=_this.props.register(_this),data&&0!==Object.keys(data.oldData).length||_this.handleChange({target:{value:'show'},key:'Enter',dontShowCommand:!0})},_this.componentDidUpdate=function(){null!==_this.inputWrapper&&_this.inputWrapper.scrollIntoView(!1)},_this.setScrollPosition=function(pos){setTimeout(function(){null!==_this.contentWrapper&&(_this.contentWrapper.scrollTop=pos)},50)},_this.focusInput=function(){null!==_this.com&&_this.com.focus()},_this.handleChange=function(e){_this.props.handleChange(_this,e)},_this.handleKeyPress=function(e){_this.props.handlerKeyPress(_this,e,_this.com)},_this.handleOuterKeypress=function(e){var _whatkey=(0,_whatkey3.default)(e),key=_whatkey.key;0>_whatkey2.unprintableKeys.indexOf(key)?document.activeElement!==_this.com&&(_this.com.focus(),_this.com.value+=(0,_whatkey3.default)(e).char):-1<['up','down','left','right','enter'].indexOf(key)&&_this.com.focus()},_temp),_possibleConstructorReturn(_this,_ret)}return _inherits(Content,_Component),_createClass(Content,[{key:'componentWillUnmount',value:function(){this.unregister(this.state)}},{key:'render',value:function(){var _this2=this,id=this.props.id,_context=this.context,maximise=_context.maximise,activeTab=_context.activeTab,barShowing=_context.barShowing,tabsShowing=_context.tabsShowing;if(id!==activeTab)return null;var output=this.state.summary.map(function(content,i){return'string'==typeof content&&0===content.length?_react2.default.createElement(_styledElements.OutputLine,{key:i},'\xA0'):_react2.default.createElement(_styledElements.PreOutputLine,{key:i},Array.isArray(content)?content.map(function(cont,key){return _react2.default.createElement('span',{style:{marginRight:5},key:'inner-'+key},cont)}):content)}),toSubtract=30;return barShowing||(toSubtract-=30),tabsShowing&&(toSubtract+=30),_react2.default.createElement(_styledElements.ContainerMain,{style:_extends({},maximise?{maxWidth:'100%',maxHeight:'calc(100% - '+toSubtract+'px)'}:{},this.state.canScroll?{overflowY:'auto'}:{overflowY:'hidden'}),tabIndex:'0',onKeyUp:this.handleOuterKeypress,innerRef:function(ctw){_this2.contentWrapper=ctw}},_react2.default.createElement(_styledElements.Holder,null,_react2.default.createElement(_styledElements.ContainerContent,null,_react2.default.createElement(_styledElements.InputArea,null,output,_react2.default.createElement(_styledElements.Input,{innerRef:function(elm){_this2.inputWrapper=elm}},_react2.default.createElement(_styledElements.Prompt,null,this.state.promptPrefix+this.state.prompt),_react2.default.createElement(_styledElements.MainInput,{type:'text',tabIndex:'-1',innerRef:function(com){_this2.com=com},onKeyPress:this.handleChange,onKeyDown:this.handleKeyPress}))))))}}]),Content}(_react.Component),_class.displayName='Content',_class.propTypes={id:_propTypes2.default.string,oldData:_propTypes2.default.object,prompt:_propTypes2.default.string,register:_propTypes2.default.func,handleChange:_propTypes2.default.func,handlerKeyPress:_propTypes2.default.func.isRequired},_class.defaultProps={prompt:'>',oldData:{}},_class.contextTypes={maximise:_propTypes2.default.bool,instances:_propTypes2.default.array,activeTab:_propTypes2.default.string,barShowing:_propTypes2.default.bool,tabsShowing:_propTypes2.default.bool},_temp2);exports.default=Content});
  //# sourceMappingURL=index.js.map