'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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImNvbXBvbmVudHMvY29kZWJsb2Nrcy9Db2RlYmxvY2suanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBNEJrQixBQUd5QixBQVdDLEFBS0UsY0FmSSxDQVd2QixBQUtjLFVBQ1UsVUFoQk4sVUFpQmhCLE1BaEJnQixnQkFDRCxlQUNHLGtCQUNELGlCQUNILGNBQ2hCIiwiZmlsZSI6ImNvbXBvbmVudHMvY29kZWJsb2Nrcy9Db2RlYmxvY2suanMiLCJzb3VyY2VSb290IjoiL1VzZXJzL2hzaG9mZi9jb2RlL3Z4L3BhY2thZ2VzL3Z4LWRlbW8iLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgUmVhY3QgZnJvbSAncmVhY3QnO1xuaW1wb3J0IFJlYWN0RE9NU2VydmVyIGZyb20gJ3JlYWN0LWRvbS9zZXJ2ZXInXG5pbXBvcnQgUHJpc20gZnJvbSAncHJpc21qcyc7XG5pbXBvcnQgJ3ByaXNtanMvY29tcG9uZW50cy9wcmlzbS1qc3gubWluJztcblxuY29uc3QgTGluZXMgPSAoeyBsaW5lcyB9KSA9PiB7XG4gIGNvbnN0IHNpemUgPSBsaW5lcy5sZW5ndGg7XG4gIHJldHVybiAoXG4gICAgPHNwYW4gYXJpYS1oaWRkZW49XCJ0cnVlXCIgY2xhc3NOYW1lPVwibGluZS1udW1iZXJzLXJvd3NcIj5cbiAgICAgIHtsaW5lcy5tYXAoKGwsaSkgPT4ge1xuICAgICAgICByZXR1cm4gPHNwYW4ga2V5PXtgbGluZS1udW1iZXItJHtzaXplfS0ke2l9YH0gLz5cbiAgICAgIH0pfVxuICAgIDwvc3Bhbj5cbiAgKTtcbn1cblxuZXhwb3J0IGRlZmF1bHQgKHsgY2hpbGRyZW4gfSkgPT4ge1xuICBjb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gICAgICAgICAgIGZvbnQtc2l6ZTogMTBweDtcbiAgICAgICAgICAgIHBhZGRpbmc6IDA7XG4gICAgICAgICAgICBwb2ludGVyLWV2ZW50czogbm9uZTtcbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgIGB9PC9zdHlsZT5cbiAgICA8L3ByZT5cbiAgKTtcbn1cbiJdfQ== */\n/*@ sourceURL=components/codeblocks/Codeblock.js */'
  }));
};