"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 plugin_toc_exports = {};
__export(plugin_toc_exports, {
  TocData: () => TocData,
  tocData_IndentationFromJSON: () => tocData_IndentationFromJSON,
  tocData_IndentationToJSON: () => tocData_IndentationToJSON,
  tocData_ListStyleFromJSON: () => tocData_ListStyleFromJSON,
  tocData_ListStyleToJSON: () => tocData_ListStyleToJSON
});
module.exports = __toCommonJS(plugin_toc_exports);
var import_plugin_toc_enums = require("./plugin_toc.enums.js");
function tocData_ListStyleFromJSON(object) {
  switch (object) {
    case 0:
    case "PLAIN":
      return import_plugin_toc_enums.TocData_ListStyle.PLAIN;
    case 1:
    case "NUMBERED":
      return import_plugin_toc_enums.TocData_ListStyle.NUMBERED;
    case 2:
    case "LETTERS":
      return import_plugin_toc_enums.TocData_ListStyle.LETTERS;
    case 3:
    case "ROMAN":
      return import_plugin_toc_enums.TocData_ListStyle.ROMAN;
    case 4:
    case "BULLETED":
      return import_plugin_toc_enums.TocData_ListStyle.BULLETED;
    case 5:
    case "ALPHABETICAL_INDEX":
      return import_plugin_toc_enums.TocData_ListStyle.ALPHABETICAL_INDEX;
    case 6:
    case "ALPHABETICAL_INDEX_COMPACT":
      return import_plugin_toc_enums.TocData_ListStyle.ALPHABETICAL_INDEX_COMPACT;
    case -1:
    case "UNRECOGNIZED":
    default:
      return import_plugin_toc_enums.TocData_ListStyle.UNRECOGNIZED;
  }
}
function tocData_ListStyleToJSON(object) {
  switch (object) {
    case import_plugin_toc_enums.TocData_ListStyle.PLAIN:
      return "PLAIN";
    case import_plugin_toc_enums.TocData_ListStyle.NUMBERED:
      return "NUMBERED";
    case import_plugin_toc_enums.TocData_ListStyle.LETTERS:
      return "LETTERS";
    case import_plugin_toc_enums.TocData_ListStyle.ROMAN:
      return "ROMAN";
    case import_plugin_toc_enums.TocData_ListStyle.BULLETED:
      return "BULLETED";
    case import_plugin_toc_enums.TocData_ListStyle.ALPHABETICAL_INDEX:
      return "ALPHABETICAL_INDEX";
    case import_plugin_toc_enums.TocData_ListStyle.ALPHABETICAL_INDEX_COMPACT:
      return "ALPHABETICAL_INDEX_COMPACT";
    default:
      return "UNKNOWN";
  }
}
function tocData_IndentationFromJSON(object) {
  switch (object) {
    case 0:
    case "NESTED":
      return import_plugin_toc_enums.TocData_Indentation.NESTED;
    case 1:
    case "FLAT":
      return import_plugin_toc_enums.TocData_Indentation.FLAT;
    case -1:
    case "UNRECOGNIZED":
    default:
      return import_plugin_toc_enums.TocData_Indentation.UNRECOGNIZED;
  }
}
function tocData_IndentationToJSON(object) {
  switch (object) {
    case import_plugin_toc_enums.TocData_Indentation.NESTED:
      return "NESTED";
    case import_plugin_toc_enums.TocData_Indentation.FLAT:
      return "FLAT";
    default:
      return "UNKNOWN";
  }
}
const baseTocData = {
  includedHeadings: 0,
  listStyle: import_plugin_toc_enums.TocData_ListStyle.PLAIN,
  indentation: import_plugin_toc_enums.TocData_Indentation.NESTED
};
const TocData = {
  fromJSON(object) {
    const message = { ...baseTocData };
    message.includedHeadings = (object.includedHeadings ?? []).map(
      (e) => Number(e)
    );
    message.listStyle = object.listStyle !== void 0 && object.listStyle !== null ? tocData_ListStyleFromJSON(object.listStyle) : import_plugin_toc_enums.TocData_ListStyle.PLAIN;
    message.fontSize = object.fontSize !== void 0 && object.fontSize !== null ? Number(object.fontSize) : void 0;
    message.itemSpacing = object.itemSpacing !== void 0 && object.itemSpacing !== null ? Number(object.itemSpacing) : void 0;
    message.color = object.color !== void 0 && object.color !== null ? String(object.color) : void 0;
    message.indentation = object.indentation !== void 0 && object.indentation !== null ? tocData_IndentationFromJSON(object.indentation) : import_plugin_toc_enums.TocData_Indentation.NESTED;
    return message;
  },
  toJSON(message) {
    const obj = {};
    if (message.includedHeadings) {
      obj.includedHeadings = message.includedHeadings.map((e) => Math.round(e));
    } else {
      obj.includedHeadings = [];
    }
    message.listStyle !== void 0 && (obj.listStyle = tocData_ListStyleToJSON(message.listStyle));
    message.fontSize !== void 0 && (obj.fontSize = message.fontSize);
    message.itemSpacing !== void 0 && (obj.itemSpacing = message.itemSpacing);
    message.color !== void 0 && (obj.color = message.color);
    message.indentation !== void 0 && (obj.indentation = tocData_IndentationToJSON(message.indentation));
    return obj;
  }
};
//# sourceMappingURL=plugin_toc.js.map
