import { checkBullet as o } from "../util/check-bullet.es.js";
import { checkBulletOther as b } from "../util/check-bullet-other.es.js";
import { checkBulletOrdered as x } from "../util/check-bullet-ordered.es.js";
import { checkRule as g } from "../util/check-rule.es.js";
function C(l, h, e, u) {
  const d = e.enter("list"), k = e.bulletCurrent;
  let r = l.ordered ? x(e) : o(e);
  const f = l.ordered ? r === "." ? ")" : "." : b(e);
  let n = h && e.bulletLastUsed ? r === e.bulletLastUsed : !1;
  if (!l.ordered) {
    const c = l.children ? l.children[0] : void 0;
    if (
      // Bullet could be used as a thematic break marker:
      (r === "*" || r === "-") && // Empty first list item:
      c && (!c.children || !c.children[0]) && // Directly in two other list items:
      e.stack[e.stack.length - 1] === "list" && e.stack[e.stack.length - 2] === "listItem" && e.stack[e.stack.length - 3] === "list" && e.stack[e.stack.length - 4] === "listItem" && // That are each the first child.
      e.indexStack[e.indexStack.length - 1] === 0 && e.indexStack[e.indexStack.length - 2] === 0 && e.indexStack[e.indexStack.length - 3] === 0 && (n = !0), g(e) === r && c
    ) {
      let t = -1;
      for (; ++t < l.children.length; ) {
        const i = l.children[t];
        if (i && i.type === "listItem" && i.children && i.children[0] && i.children[0].type === "thematicBreak") {
          n = !0;
          break;
        }
      }
    }
  }
  n && (r = f), e.bulletCurrent = r;
  const m = e.containerFlow(l, u);
  return e.bulletLastUsed = r, e.bulletCurrent = k, d(), m;
}
export {
  C as list
};
//# sourceMappingURL=list.es.js.map
