"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 checkbox_list_converter_exports = {};
__export(checkbox_list_converter_exports, {
  checkboxListConverter: () => checkboxListConverter
});
module.exports = __toCommonJS(checkbox_list_converter_exports);
var import_v1 = require("./../../ricos-schema/legacy/wix/rich_content/v1/index.js");
const checkboxListDataDefaults = { indentation: 0, offset: 0 };
const checkboxListConverter = {
  toPm: {
    types: [import_v1.Node_Type.CHECKBOX_LIST],
    // @ts-expect-error $TSFixMe
    convert: (node, visit) => {
      const dataWithDefaults = {
        indentation: node.checkboxListData?.indentation ?? checkboxListDataDefaults.indentation,
        offset: node.checkboxListData?.offset ?? checkboxListDataDefaults.offset
      };
      return {
        type: import_v1.Node_Type.CHECKBOX_LIST,
        attrs: {
          ...dataWithDefaults,
          id: node.id
        },
        content: visit(node)
      };
    }
  },
  fromPm: {
    types: [import_v1.Node_Type.CHECKBOX_LIST],
    // @ts-expect-error $TSFixMe
    convert: (node, visit) => {
      const { attrs = {} } = node;
      const {
        id,
        indentation = checkboxListDataDefaults.indentation,
        offset = checkboxListDataDefaults.offset
      } = attrs;
      const checkboxListData = {};
      if (indentation !== checkboxListDataDefaults.indentation) {
        checkboxListData.indentation = indentation;
      }
      if (offset !== checkboxListDataDefaults.offset) {
        checkboxListData.offset = offset;
      }
      return {
        type: import_v1.Node_Type.CHECKBOX_LIST,
        id,
        nodes: visit(node),
        checkboxListData
      };
    }
  }
};
//# sourceMappingURL=checkbox-list-converter.js.map
