import MiradorViewer from './lib/MiradorViewer';
import { addWindow as _addWindow } from './state/actions/window';
import { miradorImageToolsPlugin } from 'mirador-image-tools';
var tamu = {
  getInstance: function getInstance() {
    var _miradorInstance = null;
    return {
      initialize: function initialize(domId) {
        console.log('initialize', domId);

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

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

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

          _miradorInstance = null;
        }
      }
    };
  }
};
export default {
  tamu: tamu
};