"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;

var _MiradorViewer = _interopRequireDefault(require("./lib/MiradorViewer"));

var _window = require("./state/actions/window");

var _miradorImageTools = require("mirador-image-tools");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

var tamu = {
  getInstance: function getInstance() {
    var _miradorInstance = null;
    return {
      initialize: function initialize(domId) {
        console.log('initialize', domId);

        if (_miradorInstance == null) {
          _miradorInstance = new _MiradorViewer["default"]({
            id: domId,
            window: {
              allowClose: false,
              allowFullscreen: true,
              hideWindowTitle: true,
              sideBarOpen: false
            },
            windows: [],
            workspaceControlPanel: {
              enabled: false
            },
            workspace: {
              showZoomControls: true
            }
          }, {
            plugins: [_miradorImageTools.miradorImageToolsPlugin]
          });
        }
      },
      addWindow: function addWindow(manifestId) {
        console.log('addWindow', manifestId);

        if (_miradorInstance != null) {
          _miradorInstance.store.dispatch((0, _window.addWindow)({
            manifestId: manifestId,
            imageToolsEnabled: true,
            imageToolsOpen: false
          }));
        }
      },
      destroy: function destroy() {
        console.log('destroy', _miradorInstance);

        if (_miradorInstance != null) {
          _miradorInstance.unmount();

          _miradorInstance = null;
        }
      }
    };
  }
};
var _default = {
  tamu: tamu
};
exports["default"] = _default;