"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 create_boxes_template_exports = {};
__export(create_boxes_template_exports, {
  createSmartBlockTemplate: () => createSmartBlockTemplate
});
module.exports = __toCommonJS(create_boxes_template_exports);
var import_ricos_content = require("./../../ricos-content/index.js");
var import_uncreachable = require("./../../_shared/uncreachable.js");
var import_consts = require("../consts.js");
const createSmartBlockTemplate = (type, t) => {
  const itemCount = getItemCountForVariant(type);
  return {
    nodes: [
      {
        type: "PARAGRAPH",
        id: (0, import_ricos_content.generateId)()
      },
      {
        type: "SMART_BLOCK",
        id: (0, import_ricos_content.generateId)(),
        smartBlockData: { type },
        nodes: Array.from({ length: itemCount }, () => createDefaultItem(type, t))
      },
      {
        type: "PARAGRAPH",
        id: (0, import_ricos_content.generateId)()
      }
    ]
  };
};
const getItemCountForVariant = (type) => {
  switch (type) {
    case "SOLID_BOXES_ALTERNATING":
    case "TIMELINE":
    case "MINIMAL_TIMELINE":
    case "CIRCLE":
      return 4;
    default:
      return 3;
  }
};
const cellDataForVariant = (type, label) => {
  switch (type) {
    case "CIRCLE_STATS":
    case "BAR_STATS":
    case "STATS":
    case "STAR_RATING":
      return { type, label };
    case "SOLID_BOXES":
    case "SOLID_BOXES_ALTERNATING":
    case "SOLID_JOINED_BOXES":
    case "TOP_LINE_TEXT":
    case "OUTLINE_BOXES_WITH_TOP_CIRCLE":
    case "PROCESS_STEPS":
    case "SIDE_LINE_TEXT":
    case "SMALL_BULLETS":
    case "NUMBERED_BOXES":
    case "BIG_BULLETS":
    case "ARROW_BULLETS":
    case "TIMELINE":
    case "MINIMAL_TIMELINE":
    case "PILLS":
    case "QUOTE_BOXES":
    case "CIRCLE":
    case "PYRAMID":
    case "STAIRCASE":
    case "VERTICAL_FUNNEL":
      return { type };
    default: {
      (0, import_uncreachable.unreachable)(type);
      return { type };
    }
  }
};
const createDefaultItem = (type, t) => {
  const label = type === "STATS" || type === "BAR_STATS" || type === "CIRCLE_STATS" ? import_consts.DEFAULT_LABEL : type === "STAR_RATING" ? import_consts.DEFAULT_STAR_RATING_LABEL : void 0;
  return {
    type: "SMART_BLOCK_CELL",
    id: (0, import_ricos_content.generateId)(),
    smartBlockCellData: cellDataForVariant(type, label),
    nodes: [
      {
        type: "HEADING",
        id: (0, import_ricos_content.generateId)(),
        nodes: [
          {
            type: "TEXT",
            id: "",
            textData: {
              text: t("SmartBlock_Template_Title"),
              decorations: [
                {
                  type: "BOLD",
                  fontWeightValue: 700
                }
              ]
            }
          }
        ],
        headingData: {
          level: 3
        }
      },
      {
        type: "PARAGRAPH",
        id: (0, import_ricos_content.generateId)(),
        nodes: [
          {
            type: "TEXT",
            id: "",
            textData: {
              text: t("SmartBlock_Template_Description")
            }
          }
        ]
      }
    ]
  };
};
//# sourceMappingURL=create-boxes-template.js.map
