"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");

var React = _interopRequireWildcard(require("react"));

var _reactDom = require("react-dom");

var _reactRouterDom = require("react-router-dom");

var _styledComponents = require("styled-components");

var _component = require("@loadable/component");

var Sentry = _interopRequireWildcard(require("@sentry/browser"));

var _urql = require("urql");

var _intl = require("@reactizer/intl");

var _theme = require("@reactizer/theme");

var _client = _interopRequireDefault(require("./services/client"));

var _Root = _interopRequireDefault(require("./Root"));

/* eslint-disable no-underscore-dangle, fp/no-unused-expression */
Sentry.init({
  dsn: process.env.SENTRY_DSN,
  debug: process.env.NODE_ENV !== "production",
  release: process.env.SENTRY_RELEASE,
  environment: process.env.SENTRY_ENVIRONMENT
});
const app = document.getElementById("react");
const palette = window.__THEME__;
const locale = window.__INTL__;
(0, _component.loadableReady)(() => {
  if (app) {
    (0, _reactDom.hydrate)(React.createElement(_urql.Provider, {
      value: _client.default
    }, React.createElement(_styledComponents.ThemeProvider, {
      theme: (0, _theme.makeTheme)(palette)
    }, React.createElement(_intl.IntlProvider, {
      locale: locale,
      onChange: () => Promise.resolve(locale)
    }, React.createElement(_reactRouterDom.BrowserRouter, {
      basename: process.env.BASENAME
    }, React.createElement(_Root.default, null))))), app);
  }
}); // Hot reload
// ---

/* eslint-disable no-undef, @typescript-eslint/ban-ts-ignore */
// @ts-ignore

if (module.hot) {
  // @ts-ignore
  module.hot.accept();
}