"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var markers_exports = {};
__export(markers_exports, {
  bulletMarkers: () => bulletMarkers,
  getListTag: () => getListTag,
  getMarker: () => getMarker,
  toAlpha: () => toAlpha,
  toRoman: () => toRoman
});
module.exports = __toCommonJS(markers_exports);
var import_uncreachable = require("./../_shared/uncreachable.js");
const bulletMarkers = ["•", "◦", "▪"];
const toAlpha = (value) => {
  let current = value;
  let result = "";
  while (current > 0) {
    current -= 1;
    result = String.fromCharCode(65 + current % 26) + result;
    current = Math.floor(current / 26);
  }
  return result;
};
const romanNumerals = [
  ["M", 1e3],
  ["CM", 900],
  ["D", 500],
  ["CD", 400],
  ["C", 100],
  ["XC", 90],
  ["L", 50],
  ["XL", 40],
  ["X", 10],
  ["IX", 9],
  ["V", 5],
  ["IV", 4],
  ["I", 1]
];
const toRoman = (value) => {
  let current = value;
  let result = "";
  romanNumerals.forEach(([symbol, amount]) => {
    while (current >= amount) {
      result += symbol;
      current -= amount;
    }
  });
  return result || "I";
};
const getMarker = ({
  data,
  depth,
  indices,
  visibleIndex
}) => {
  switch (data.listStyle) {
    case "PLAIN":
      return null;
    case "BULLETED":
      return bulletMarkers[depth % bulletMarkers.length];
    case "NUMBERED":
      return indices.join(".");
    case "LETTERS":
      return indices.map((i) => toAlpha(i)).join(".");
    case "ROMAN":
      return toRoman(visibleIndex);
    case "ALPHABETICAL_INDEX":
    case "ALPHABETICAL_INDEX_COMPACT":
    case void 0:
      return null;
    default:
      (0, import_uncreachable.unreachable)(data.listStyle);
      return null;
  }
};
const getListTag = (listStyle) => {
  return listStyle === "BULLETED" || listStyle === "PLAIN" ? "ul" : "ol";
};
//# sourceMappingURL=markers.js.map
