"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = exports.DocsUI = void 0;
function _react() {
  const data = _interopRequireDefault(require("react"));
  _react = function () {
    return data;
  };
  return data;
}
function _lodash() {
  const data = require("lodash");
  _lodash = function () {
    return data;
  };
  return data;
}
function _component() {
  const data = require("@teambit/component");
  _component = function () {
    return data;
  };
  return data;
}
function _harmony() {
  const data = require("@teambit/harmony");
  _harmony = function () {
    return data;
  };
  return data;
}
function _ui() {
  const data = require("@teambit/ui");
  _ui = function () {
    return data;
  };
  return data;
}
function _componentCompare() {
  const data = require("@teambit/component-compare");
  _componentCompare = function () {
    return data;
  };
  return data;
}
function _docsUi() {
  const data = require("@teambit/docs.ui.overview-compare");
  _docsUi = function () {
    return data;
  };
  return data;
}
function _docsUi2() {
  const data = require("@teambit/docs.ui.overview-compare-section");
  _docsUi2 = function () {
    return data;
  };
  return data;
}
function _apiReference() {
  const data = require("@teambit/api-reference");
  _apiReference = function () {
    return data;
  };
  return data;
}
function _docs() {
  const data = require("./docs.aspect");
  _docs = function () {
    return data;
  };
  return data;
}
function _overview() {
  const data = require("./overview.section");
  _overview = function () {
    return data;
  };
  return data;
}
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
class DocsUI {
  constructor(titleBadgeSlot, overviewOptionsSlot) {
    this.titleBadgeSlot = titleBadgeSlot;
    this.overviewOptionsSlot = overviewOptionsSlot;
    _defineProperty(this, "_emptyState", void 0);
  }

  /**
   * register a new title badge into the overview section of a component.
   */
  registerTitleBadge(titleBadges) {
    const badges = Array.isArray(titleBadges) ? titleBadges : [titleBadges];
    this.titleBadgeSlot.register(badges);
    return this;
  }

  /**
   * list all title badges registered.
   */
  listTitleBadges() {
    return (0, _lodash().flatten)(this.titleBadgeSlot.values());
  }
  registerEmptyState(emptyState) {
    return this._emptyState = emptyState;
  }
  getEmptyState() {
    return this._emptyState;
  }
  getDocsCompare() {
    return /*#__PURE__*/_react().default.createElement(_docsUi().OverviewCompare, {
      titleBadges: this.titleBadgeSlot,
      overviewOptions: this.overviewOptionsSlot
    });
  }
  registerOverviewOptions(options) {
    this.overviewOptionsSlot.register(options);
  }
  static async provider([component, componentCompare, apiRef], config, [titleBadgeSlot, overviewOptionsSlot]) {
    const docs = new DocsUI(titleBadgeSlot, overviewOptionsSlot);
    const section = new (_overview().OverviewSection)(titleBadgeSlot, overviewOptionsSlot, docs, apiRef);
    const compareSection = new (_docsUi2().OverviewCompareSection)(docs);
    component.registerRoute(section.route);
    component.registerNavigation(section.navigationLink, section.order);
    componentCompare.registerNavigation(compareSection);
    componentCompare.registerRoutes([compareSection.route]);
    return docs;
  }
}
exports.DocsUI = DocsUI;
_defineProperty(DocsUI, "dependencies", [_component().ComponentAspect, _componentCompare().ComponentCompareAspect, _apiReference().APIReferenceAspect]);
_defineProperty(DocsUI, "runtime", _ui().UIRuntime);
_defineProperty(DocsUI, "slots", [_harmony().Slot.withType(), _harmony().Slot.withType()]);
var _default = exports.default = DocsUI;
_docs().DocsAspect.addRuntime(DocsUI);

//# sourceMappingURL=docs.ui.runtime.js.map