import _regeneratorRuntime from "@babel/runtime/regenerator";
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
import * as materialUICore from '@material-ui/core';
import * as materialUIStyles from '@material-ui/styles';
import * as xDatePickers from '@mui/x-date-pickers';
import * as muiBase from '@mui/base';
import * as muiMaterial from '@mui/material';
import * as emotionCore from '@emotion/core';
import * as emotionStyled from '@emotion/styled';
import * as emotionReact from '@emotion/react';
import * as react from 'react';
import * as reactDom from 'react-dom';
import * as reactIntl from 'react-intl';
import { globalVar, version } from '../dll';
var DLL = {};
export default DLL;
var externals = {
  '@material-ui/core': materialUICore,
  '@material-ui/styles': materialUIStyles,
  react: react,
  'react-dom': reactDom,
  'react-intl': reactIntl,
  '@emotion/react': emotionReact,
  '@emotion/core': emotionCore,
  '@mui/x-date-pickers': xDatePickers,
  '@emotion/styled': emotionStyled,
  '@mui/base': muiBase,
  '@mui/material': muiMaterial
};
export var init = /*#__PURE__*/function () {
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(url) {
    var _i, _Object$entries, _Object$entries$_i, name, module, dllDir, manifestResponse, manifest, linkElement;

    return _regeneratorRuntime.wrap(function _callee$(_context) {
      while (1) {
        switch (_context.prev = _context.next) {
          case 0:
            for (_i = 0, _Object$entries = Object.entries(externals); _i < _Object$entries.length; _i++) {
              _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2), name = _Object$entries$_i[0], module = _Object$entries$_i[1];
              window["".concat(globalVar, "_").concat(name)] = module;
            }

            dllDir = "".concat(url, "/dll/").concat(version, "/");
            _context.next = 4;
            return fetch(dllDir + 'manifest.json');

          case 4:
            manifestResponse = _context.sent;
            _context.next = 7;
            return manifestResponse.json();

          case 7:
            manifest = _context.sent;
            _context.next = 10;
            return import(
            /* webpackIgnore: true */
            dllDir + manifest['main.js']);

          case 10:
            linkElement = document.createElement('link');
            linkElement.rel = 'stylesheet';
            linkElement.href = dllDir + manifest['main.css'];
            document.head.appendChild(linkElement);
            Object.assign(DLL, window.__formula);

          case 15:
          case "end":
            return _context.stop();
        }
      }
    }, _callee);
  }));

  return function init(_x) {
    return _ref.apply(this, arguments);
  };
}();
//# sourceMappingURL=dll.js.map