import { factoryDestination as D } from "../../../../micromark-factory-destination@2.0.1/node_modules/micromark-factory-destination/index.js";
import { factoryLabel as S } from "../../../../micromark-factory-label@2.0.1/node_modules/micromark-factory-label/index.js";
import { factorySpace as s } from "../../../../micromark-factory-space@2.0.1/node_modules/micromark-factory-space/index.js";
import { factoryTitle as g } from "../../../../micromark-factory-title@2.0.1/node_modules/micromark-factory-title/index.js";
import { factoryWhitespace as d } from "../../../../micromark-factory-whitespace@2.0.1/node_modules/micromark-factory-whitespace/index.js";
import { markdownLineEndingOrSpace as k, markdownSpace as h, markdownLineEnding as L } from "../../../../micromark-util-character@2.1.1/node_modules/micromark-util-character/index.js";
import { normalizeIdentifier as w } from "../../../../micromark-util-normalize-identifier@2.0.1/node_modules/micromark-util-normalize-identifier/index.js";
const O = {
  name: "definition",
  tokenize: M
}, z = {
  partial: !0,
  tokenize: y
};
function M(t, f, e) {
  const r = this;
  let o;
  return u;
  function u(i) {
    return t.enter("definition"), a(i);
  }
  function a(i) {
    return S.call(
      r,
      t,
      n,
      // Note: we don’t need to reset the way `markdown-rs` does.
      e,
      "definitionLabel",
      "definitionLabelMarker",
      "definitionLabelString"
    )(i);
  }
  function n(i) {
    return o = w(r.sliceSerialize(r.events[r.events.length - 1][1]).slice(1, -1)), i === 58 ? (t.enter("definitionMarker"), t.consume(i), t.exit("definitionMarker"), b) : e(i);
  }
  function b(i) {
    return k(i) ? d(t, l)(i) : l(i);
  }
  function l(i) {
    return D(
      t,
      c,
      // Note: we don’t need to reset the way `markdown-rs` does.
      e,
      "definitionDestination",
      "definitionDestinationLiteral",
      "definitionDestinationLiteralMarker",
      "definitionDestinationRaw",
      "definitionDestinationString"
    )(i);
  }
  function c(i) {
    return t.attempt(z, m, m)(i);
  }
  function m(i) {
    return h(i) ? s(t, p, "whitespace")(i) : p(i);
  }
  function p(i) {
    return i === null || L(i) ? (t.exit("definition"), r.parser.defined.push(o), f(i)) : e(i);
  }
}
function y(t, f, e) {
  return r;
  function r(n) {
    return k(n) ? d(t, o)(n) : e(n);
  }
  function o(n) {
    return g(t, u, e, "definitionTitle", "definitionTitleMarker", "definitionTitleString")(n);
  }
  function u(n) {
    return h(n) ? s(t, a, "whitespace")(n) : a(n);
  }
  function a(n) {
    return n === null || L(n) ? f(n) : e(n);
  }
}
export {
  O as definition
};
//# sourceMappingURL=definition.js.map
