var ErrorBoundary = (function () {
  function EB(props) {
    React.Component.call(this, props);
    this.state = { hasError: false, error: null };
  }

  EB.prototype = Object.create(React.Component.prototype);
  EB.prototype.constructor = EB;

  EB.getDerivedStateFromError = function (error) {
    return { hasError: true, error: error };
  };

  EB.prototype.render = function () {
    if (!this.state.hasError) return this.props.children;

    var self = this;
    var msg = this.state.error ? this.state.error.message || String(this.state.error) : 'Unknown error';

    return React.createElement('div', { className: 'ib-error-boundary' },
      React.createElement('div', { className: 'ib-error-prompt' }, '$ cat /var/log/crash'),
      React.createElement('h2', { className: 'ib-error-title' }, 'Something broke.'),
      React.createElement('pre', { className: 'ib-error-detail' }, msg),
      React.createElement('button', {
        className: 'ib-error-retry',
        onClick: function () { self.setState({ hasError: false, error: null }); },
      }, '$ retry')
    );
  };

  return EB;
})();

window.ErrorBoundary = ErrorBoundary;
