import _extends from "@babel/runtime/helpers/extends";
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
import React from 'react';
import { Html, Head, Main, NextScript } from 'next/document';
import Maikati from 'next/document';
import { ServerStyleSheet } from 'styled-components';

class Document extends Maikati {
  static getInitialProps(ctx) {
    return _asyncToGenerator(function* () {
      var sheet = new ServerStyleSheet();
      var originalRenderPage = ctx.renderPage;

      try {
        ctx.renderPage = () => originalRenderPage({
          enhanceApp: App => props => sheet.collectStyles( /*#__PURE__*/React.createElement(App, props))
        });

        var initialProps = yield Maikati.getInitialProps(ctx);
        return _extends({}, initialProps, {
          styles: /*#__PURE__*/React.createElement(React.Fragment, null, initialProps.styles, sheet.getStyleElement())
        });
      } finally {
        sheet.seal();
      }
    })();
  }

  render() {
    return /*#__PURE__*/React.createElement(Html, null, /*#__PURE__*/React.createElement(Head, null), /*#__PURE__*/React.createElement("body", null, /*#__PURE__*/React.createElement(Main, null), /*#__PURE__*/React.createElement(NextScript, null)));
  }

}

export { Document };
//# sourceMappingURL=document.component.js.map