'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _style = require('styled-jsx/style.js');

var _style2 = _interopRequireDefault(_style);

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _server = require('react-dom/server');

var _server2 = _interopRequireDefault(_server);

var _prismjs = require('prismjs');

var _prismjs2 = _interopRequireDefault(_prismjs);

require('prismjs/components/prism-jsx.min');

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var _jsxFileName = '/Users/hshoff/code/vx/packages/vx-demo/components/codeblocks/Codeblock.js';


var Lines = function Lines(_ref) {
  var lines = _ref.lines;

  var size = lines.length;
  return _react2.default.createElement('span', { 'aria-hidden': 'true', className: 'line-numbers-rows', __source: {
      fileName: _jsxFileName,
      lineNumber: 9
    }
  }, lines.map(function (l, i) {
    return _react2.default.createElement('span', { key: 'line-number-' + size + '-' + i, __source: {
        fileName: _jsxFileName,
        lineNumber: 11
      }
    });
  }));
};

exports.default = function (_ref2) {
  var children = _ref2.children;

  var match = children.match(/\n(?!$)/g);
  var linesNum = match ? match.length + 1 : 1;
  var lines = new Array(linesNum + 1).fill(1);
  var html = [_server2.default.renderToString(_react2.default.createElement(Lines, { lines: lines, __source: {
      fileName: _jsxFileName,
      lineNumber: 22
    }
  })), _prismjs2.default.highlight(children, _prismjs2.default.languages.jsx)].join('');

  return _react2.default.createElement('pre', { className: 'codeblock line-numbers', 'data-jsx': 3832342985,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 27
    }
  }, _react2.default.createElement('code', { dangerouslySetInnerHTML: { __html: html }, 'data-jsx': 3832342985,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 28
    }
  }), _react2.default.createElement(_style2.default, {
    styleId: 3832342985,
    css: '.codeblock[data-jsx="3832342985"] code[data-jsx="3832342985"] {background: #090910;max-height: 600px;overflow-y: scroll;display: block;padding: 0 0 2rem 3rem;border-radius: 0;border-bottom-right-radius: 3px;border-bottom-left-radius: 3px;}.codeblock.line-numbers[data-jsx="3832342985"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4gIGNvbnN0IGxpbmVzTnVtID0gbWF0Y2ggPyBtYXRjaC5sZW5ndGggKyAxIDogMTtcbiAgbGV0IGxpbmVzID0gbmV3IEFycmF5KGxpbmVzTnVtICsgMSkuZmlsbCgxKTtcbiAgY29uc3QgaHRtbCA9IFtcbiAgICBSZWFjdERPTVNlcnZlci5yZW5kZXJUb1N0cmluZyg8TGluZXMgbGluZXM9e2xpbmVzfSAvPiksXG4gICAgUHJpc20uaGlnaGxpZ2h0KGNoaWxkcmVuLCBQcmlzbS5sYW5ndWFnZXMuanN4KVxuICBdLmpvaW4oJycpO1xuXG4gIHJldHVybiAoXG4gICAgPHByZSBjbGFzc05hbWU9XCJjb2RlYmxvY2sgbGluZS1udW1iZXJzXCI+XG4gICAgICA8Y29kZSBkYW5nZXJvdXNseVNldElubmVySFRNTD17e19faHRtbDogaHRtbH19IC8+XG4gICAgICA8c3R5bGUganN4PntgXG4gICAgICAgIC5jb2RlYmxvY2sgY29kZSB7XG4gICAgICAgICAgYmFja2dyb3VuZDogIzA5MDkxMDtcbiAgICAgICAgICBtYXgtaGVpZ2h0OiA2MDBweDtcbiAgICAgICAgICBvdmVyZmxvdy15OiBzY3JvbGw7XG4gICAgICAgICAgZGlzcGxheTogYmxvY2s7XG4gICAgICAgICAgcGFkZGluZzogMCAwIDJyZW0gM3JlbTtcbiAgICAgICAgICBib3JkZXItcmFkaXVzOiAwO1xuICAgICAgICAgIGJvcmRlci1ib3R0b20tcmlnaHQtcmFkaXVzOiAzcHg7XG4gICAgICAgICAgYm9yZGVyLWJvdHRvbS1sZWZ0LXJhZGl1czogM3B4O1xuICAgICAgICB9XG5cbiAgICAgICAgLmNvZGVibG9jay5saW5lLW51bWJlcnMge1xuICAgICAgICAgIHBhZGRpbmctbGVmdDogMDtcbiAgICAgICAgfVxuICAgICAgYH08L3N0eWxlPlxuICAgIDwvcHJlPlxuICApO1xufVxuIl19 */\n/*@ sourceURL=components/codeblocks/Codeblock.js */'
  }));
};