"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.MDXMain = void 0;
function _cli() {
  const data = require("@teambit/cli");
  _cli = function () {
    return data;
  };
  return data;
}
function _compiler() {
  const data = require("@teambit/compiler");
  _compiler = function () {
    return data;
  };
  return data;
}
function _dependencyResolver() {
  const data = require("@teambit/dependency-resolver");
  _dependencyResolver = function () {
    return data;
  };
  return data;
}
function _docs() {
  const data = require("@teambit/docs");
  _docs = function () {
    return data;
  };
  return data;
}
function _componentId() {
  const data = require("@teambit/component-id");
  _componentId = function () {
    return data;
  };
  return data;
}
function _logger() {
  const data = require("@teambit/logger");
  _logger = function () {
    return data;
  };
  return data;
}
function _worker() {
  const data = require("@teambit/worker");
  _worker = function () {
    return data;
  };
  return data;
}
function _envs() {
  const data = require("@teambit/envs");
  _envs = function () {
    return data;
  };
  return data;
}
function _multiCompiler() {
  const data = require("@teambit/multi-compiler");
  _multiCompiler = function () {
    return data;
  };
  return data;
}
function _react() {
  const data = require("@teambit/react");
  _react = function () {
    return data;
  };
  return data;
}
function _generator() {
  const data = require("@teambit/generator");
  _generator = function () {
    return data;
  };
  return data;
}
function _mdx() {
  const data = require("./mdx.aspect");
  _mdx = function () {
    return data;
  };
  return data;
}
function _mdx2() {
  const data = require("./mdx.detector");
  _mdx2 = function () {
    return data;
  };
  return data;
}
function _mdx3() {
  const data = require("./mdx.doc-reader");
  _mdx3 = function () {
    return data;
  };
  return data;
}
function _mdx4() {
  const data = require("./mdx.templates");
  _mdx4 = function () {
    return data;
  };
  return data;
}
function _mdx5() {
  const data = require("./mdx.env");
  _mdx5 = function () {
    return data;
  };
  return data;
}
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 MDXMain {
  constructor() {
    _defineProperty(this, "_mdxEnv", void 0);
  }
  icon() {
    return 'https://static.bit.dev/extensions-icons/mdx-icon-small.svg';
  }

  /**
   * create an instance of the MDX compiler.
   */
  createCompiler(opts = {}) {
    return this.mdxEnv.createMdxCompiler(opts);
  }
  get mdxEnv() {
    return this._mdxEnv;
  }
  set mdxEnv(value) {
    this._mdxEnv = value;
  }
  static async provider([docs, depResolver, react, envs, multiCompiler, compiler, generator, loggerAspect, workerMain], config, slots, harmony) {
    const mdx = new MDXMain();
    const logger = loggerAspect.createLogger(_mdx().MDXAspect.id);
    const mdxEnv = envs.merge(new (_mdx5().MdxEnv)(react, logger, multiCompiler, compiler, docs), react.reactEnv);
    envs.registerEnv(mdxEnv);
    depResolver.registerDetector(new (_mdx2().MDXDependencyDetector)(config.extensions, logger));
    docs.registerDocReader(new (_mdx3().MDXDocReader)(config.extensions));
    if (generator) {
      const envContext = new (_envs().EnvContext)(_componentId().ComponentID.fromString(_react().ReactAspect.id), loggerAspect, workerMain, harmony);
      generator.registerComponentTemplate(() => (0, _mdx4().getTemplates)(envContext));
    }
    mdx.mdxEnv = mdxEnv;
    return mdx;
  }
}
exports.MDXMain = MDXMain;
_defineProperty(MDXMain, "runtime", _cli().MainRuntime);
_defineProperty(MDXMain, "dependencies", [_docs().DocsAspect, _dependencyResolver().DependencyResolverAspect, _react().ReactAspect, _envs().EnvsAspect, _multiCompiler().MultiCompilerAspect, _compiler().CompilerAspect, _generator().GeneratorAspect, _logger().LoggerAspect, _worker().WorkerAspect]);
_defineProperty(MDXMain, "defaultConfig", {
  extensions: ['.md', '.mdx']
});
_mdx().MDXAspect.addRuntime(MDXMain);

//# sourceMappingURL=mdx.main.runtime.js.map