"use strict";

function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "OutlineManager", {
  enumerable: true,
  get: function get() {
    return _manager["default"];
  }
});
exports.UI = void 0;
Object.defineProperty(exports, "byName", {
  enumerable: true,
  get: function get() {
    return _paneRegistry.byName;
  }
});
exports.getOutliner = getOutliner;
Object.defineProperty(exports, "initMainPage", {
  enumerable: true,
  get: function get() {
    return _mainPage["default"];
  }
});
Object.defineProperty(exports, "list", {
  enumerable: true,
  get: function get() {
    return _paneRegistry.list;
  }
});
Object.defineProperty(exports, "paneForIcon", {
  enumerable: true,
  get: function get() {
    return _paneRegistry.paneForIcon;
  }
});
Object.defineProperty(exports, "paneForPredicate", {
  enumerable: true,
  get: function get() {
    return _paneRegistry.paneForPredicate;
  }
});
Object.defineProperty(exports, "register", {
  enumerable: true,
  get: function get() {
    return _paneRegistry.register;
  }
});
Object.defineProperty(exports, "versionInfo", {
  enumerable: true,
  get: function get() {
    return _versionInfo["default"];
  }
});
var _versionInfo = _interopRequireDefault(require("./versionInfo"));
var UI = _interopRequireWildcard(require("solid-ui"));
exports.UI = UI;
var _solidLogic = require("solid-logic");
var _manager = _interopRequireDefault(require("./outline/manager.js"));
var _registerPanes = require("./registerPanes.js");
var _paneRegistry = require("pane-registry");
var _context = require("./outline/context");
var _mainPage = _interopRequireDefault(require("./mainPage"));
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/*                            SOLID PANES
 **
 **     Panes are regions of the outline view in which a particular subject is
 ** displayed in a particular way.
 ** Different panes about the same subject are typically stacked vertically.
 ** Panes may be used naked or with a pane selection header.
 **
 ** The label() method has two functions: it determines whether the pane is
 ** relevant to a given subject, returning null if not.
 ** If it is relevant, then it returns a suitable tooltip for a control which selects the pane
 */

function getOutliner(dom) {
  if (!dom.outlineManager) {
    var context = (0, _context.createContext)(dom, {
      list: _paneRegistry.list,
      paneForIcon: _paneRegistry.paneForIcon,
      paneForPredicate: _paneRegistry.paneForPredicate,
      register: _paneRegistry.register,
      byName: _paneRegistry.byName
    }, _solidLogic.store, _solidLogic.solidLogicSingleton);
    dom.outlineManager = new _manager["default"](context);
  }
  return dom.outlineManager;
}
if (typeof window !== 'undefined') {
  getOutliner(window.document);
}
(0, _registerPanes.registerPanes)(function (cjsOrEsModule) {
  return (0, _paneRegistry.register)(cjsOrEsModule["default"] || cjsOrEsModule);
});

// This has common outline mode functionality for the default and other other panes
// A separate outline manager is required per DOM in cases like a browser extension
// where there are many occurrences of window and of window.document
// But each DOM should have just one outline manager.

// export for simpler access by non-node scripts
if (typeof window !== 'undefined') {
  ;
  window.panes = {
    getOutliner: getOutliner
  };
}
//# sourceMappingURL=index.js.map