'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': 1830748051,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 27
    }
  }, _react2.default.createElement('code', { dangerouslySetInnerHTML: { __html: html }, 'data-jsx': 1830748051,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 28
    }
  }), _react2.default.createElement(_style2.default, {
    styleId: 1830748051,
    css: '.codeblock[data-jsx="1830748051"] code[data-jsx="1830748051"] {display: block;padding: 0 0 0 1.5rem;border-radius: 0;font-weight: 300;font-size: 14px;line-height: 1.4em;background: white;color: #495057;}.codeblock.line-numbers[data-jsx="1830748051"] {padding-left: 0;}@media (max-width: 600px) {.codeblock[data-jsx="1830748051"] code[data-jsx="1830748051"] {font-size: 10px;padding: 0;pointer-events: none;}}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImNvbXBvbmVudHMvY29kZWJsb2Nrcy9Db2RlYmxvY2suanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBNEJrQixBQUNPLCtEQUNBLGVBQ08sc0JBQ0wsaUJBQ0EsaUJBQ0QsZ0JBQ0csbUJBQ0Qsa0JBQ0gsZUFDaEIsQ0FFd0IsZ0RBQ1AsZ0JBQ2pCLENBRTBCLDJCQUNSLCtEQUNDLGdCQUNMLFdBQ1UscUJBQ3RCLENBQ0YiLCJmaWxlIjoiY29tcG9uZW50cy9jb2RlYmxvY2tzL0NvZGVibG9jay5qcyIsInNvdXJjZVJvb3QiOiIvVXNlcnMvaHNob2ZmL2NvZGUvdngvcGFja2FnZXMvdngtZGVtbyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBSZWFjdCBmcm9tICdyZWFjdCc7XG5pbXBvcnQgUmVhY3RET01TZXJ2ZXIgZnJvbSAncmVhY3QtZG9tL3NlcnZlcidcbmltcG9ydCBQcmlzbSBmcm9tICdwcmlzbWpzJztcbmltcG9ydCAncHJpc21qcy9jb21wb25lbnRzL3ByaXNtLWpzeC5taW4nO1xuXG5jb25zdCBMaW5lcyA9ICh7IGxpbmVzIH0pID0+IHtcbiAgY29uc3Qgc2l6ZSA9IGxpbmVzLmxlbmd0aDtcbiAgcmV0dXJuIChcbiAgICA8c3BhbiBhcmlhLWhpZGRlbj1cInRydWVcIiBjbGFzc05hbWU9XCJsaW5lLW51bWJlcnMtcm93c1wiPlxuICAgICAge2xpbmVzLm1hcCgobCxpKSA9PiB7XG4gICAgICAgIHJldHVybiA8c3BhbiBrZXk9e2BsaW5lLW51bWJlci0ke3NpemV9LSR7aX1gfSAvPlxuICAgICAgfSl9XG4gICAgPC9zcGFuPlxuICApO1xufVx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gICBAbWVkaWEgKG1heC13aWR0aDogNjAwcHgpIHtcbiAgICAgICAgICAuY29kZWJsb2NrIGNvZGUge1xuICAgICAgICAgICAgZm9udC1zaXplOiAxMHB4O1xuICAgICAgICAgICAgcGFkZGluZzogMDtcbiAgICAgICAgICAgIHBvaW50ZXItZXZlbnRzOiBub25lO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgYH08L3N0eWxlPlxuICAgIDwvcHJlPlxuICApO1xufVxuIl19 */\n/*@ sourceURL=components/codeblocks/Codeblock.js */'
  }));
};