"use strict";

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

exports.__esModule = true;
var _exportNames = {};
exports["default"] = _default;

var _lowcodeEngine = require("@alilc/lowcode-engine");

Object.keys(_lowcodeEngine).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  if (key in exports && exports[key] === _lowcodeEngine[key]) return;
  exports[key] = _lowcodeEngine[key];
});

var _preset = _interopRequireDefault(require("./preset"));

var isNewEngineVersion = !!_lowcodeEngine.material;
var initConfig = {
  enableCondition: true,
  enableCanvasLock: true
};
var preference = new Map();
preference.set('alilcDataSourcePlugin', {
  importPlugins: [],
  dataSourceTypes: [{
    type: 'fetch'
  }, {
    type: 'jsonp'
  }]
});

if (isNewEngineVersion) {
  initConfig.simulatorUrl = ['https://unpkg.com/@alilc/lowcode-react-simulator-renderer@beta/dist/css/react-simulator-renderer.css', 'https://unpkg.com/@alilc/lowcode-react-simulator-renderer@beta/dist/js/react-simulator-renderer.js'];
}

function _default(customInit, customPlugins, rootElement, options) {
  (0, _preset["default"])(customInit, customPlugins, options);

  if (isNewEngineVersion) {
    (0, _lowcodeEngine.init)(rootElement, initConfig, preference);
  } else {
    (0, _lowcodeEngine.init)(rootElement, initConfig);
  }
}