import { Node_Type } from "./../../ricos-schema/legacy/wix/rich_content/v1/index.js";
import { isDefined } from "./utils.js";
const table = (...args) => {
  const tableData = args.find((a) => !("type" in a));
  return {
    type: "block_node",
    node: (getId) => ({
      id: getId(),
      type: Node_Type.TABLE,
      nodes: args.map((arg) => "type" in arg && arg.type === "block_node" ? arg.node(getId) : void 0).filter(isDefined),
      tableData: tableData ?? {
        // these values are from normalized 1x1 table
        dimensions: { rowsHeight: [47], colsWidthRatio: [0], colsMinWidth: [0] }
      }
    })
  };
};
const tableRow = (...args) => {
  return {
    type: "block_node",
    node: (getId) => ({
      id: getId(),
      type: Node_Type.TABLE_ROW,
      nodes: args.map((arg) => arg.node(getId))
    })
  };
};
const tableCell = (...args) => {
  const tableCellData = args.find((a) => !("type" in a)) ?? {};
  return {
    type: "block_node",
    node: (getId) => ({
      id: getId(),
      type: Node_Type.TABLE_CELL,
      nodes: args.map((arg) => "type" in arg && arg.type === "block_node" ? arg.node(getId) : void 0).filter(isDefined),
      tableCellData
    })
  };
};
export {
  table,
  tableCell,
  tableRow
};
//# sourceMappingURL=table.builder.js.map
