import {
  CollapsibleListData_Direction,
  CollapsibleListData_InitialExpandedItems,
  Node_Type
} from "./../../ricos-schema/legacy/wix/rich_content/v1/index.js";
import { isDefined } from "./utils.js";
const collapsibleList = (...args) => {
  const collapsibleListData = args.find((a) => !("type" in a));
  return {
    type: "block_node",
    node: (getId) => ({
      id: getId(),
      type: Node_Type.COLLAPSIBLE_LIST,
      nodes: args.map((arg) => "type" in arg && arg.type === "block_node" ? arg.node(getId) : void 0).filter(isDefined),
      collapsibleListData: collapsibleListData ? collapsibleListData : {
        initialExpandedItems: CollapsibleListData_InitialExpandedItems.FIRST,
        direction: CollapsibleListData_Direction.LTR
      }
    })
  };
};
const collapsibleListItem = (title, body) => {
  return {
    type: "block_node",
    node: (getId) => ({
      id: getId(),
      type: Node_Type.COLLAPSIBLE_ITEM,
      nodes: [title.node(getId), body.node(getId)]
    })
  };
};
const collapsibleListItemTitle = (...args) => {
  return {
    type: "block_node",
    node: (getId) => ({
      id: getId(),
      type: Node_Type.COLLAPSIBLE_ITEM_TITLE,
      nodes: args.map((arg) => arg.node(getId))
    })
  };
};
const collapsibleListItemBody = (...args) => {
  return {
    type: "block_node",
    node: (getId) => ({
      id: getId(),
      type: Node_Type.COLLAPSIBLE_ITEM_BODY,
      nodes: args.map((arg) => arg.node(getId))
    })
  };
};
export {
  collapsibleList,
  collapsibleListItem,
  collapsibleListItemBody,
  collapsibleListItemTitle
};
//# sourceMappingURL=collapsible-list.builder.js.map
