"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 testkit_exports = {};
__export(testkit_exports, {
  createDividerTestkit: () => createDividerTestkit
});
module.exports = __toCommonJS(testkit_exports);
var import_ricos_types = require("./../ricos-types/index.js");
var import_data_hooks = require("./../_shared/data-hooks.js");
var import_wix_rich_content_common = require("./../wix-rich-content-common/index.js");
var import_data_hooks2 = require("./data-hooks.js");
var import_get_add_buttons = require("./get-add-buttons.js");
const createDividerTestkit = (getBase) => {
  const getDivider = async (index, options) => {
    const divider = await getBase().getAll((0, import_wix_rich_content_common.dataHook)(import_data_hooks2.ROOT), options);
    return divider.at(index);
  };
  const getDividerByType = async (type = "SINGLE", index) => {
    const dividers = await getBase().getAll((0, import_wix_rich_content_common.dataHook)(`${import_data_hooks2.ROOT}-${type.toLowerCase()}`));
    return dividers.at(index);
  };
  return {
    content: {
      atIndex: (index) => {
        return {
          exists: async (options) => {
            try {
              const divider = await getDivider(index, options);
              return divider.exists();
            } catch {
              return false;
            }
          },
          click: async () => {
            const divider = await getDivider(index);
            await divider.click();
          },
          hover: async () => {
            const divider = await getDivider(index);
            await divider.hover();
          },
          getNativeElement: async () => {
            const divider = await getDivider(index);
            return divider.getNative();
          }
        };
      },
      byType: (type, index = 0) => {
        return {
          exists: async () => {
            try {
              return (await getDividerByType(type, index)).exists();
            } catch {
              return false;
            }
          },
          click: async () => {
            const divider = await getDividerByType(type, index);
            await divider.click();
          }
        };
      }
    },
    toolbars: {
      createAddButtonToolbars: (getAddButtonToolbarBase) => ({
        click: async () => {
          const button = await getAddButtonToolbarBase().get((0, import_wix_rich_content_common.dataHook)(import_data_hooks2.INSERT_DIVIDER_BUTTON));
          await button.click();
        },
        toolbarsToAddIn: import_get_add_buttons.toolbarsToAddIn
      }),
      createPluginToolbar: (getPluginToolbarBase) => {
        const getPluginToolbar = () => getPluginToolbarBase(import_ricos_types.RicosPluginToolbarNames.DIVIDER);
        return {
          clickDelete: async () => {
            const button = await getPluginToolbar().get((0, import_wix_rich_content_common.dataHook)(import_data_hooks.PLUGIN_TOOLBAR_DELETE_BUTTON));
            await button.click();
          },
          clickStyleDropdown: async () => {
            const dropdown = await getPluginToolbar().get(
              (0, import_wix_rich_content_common.dataHook)(import_data_hooks2.PLUGIN_TOOLBAR_DIVIDER_STYLE_BUTTON)
            );
            await dropdown.click();
          },
          style: {
            clickStyle: async (type) => {
              const dataHookMap = {
                SINGLE: import_data_hooks2.STYLE_DROPDOWN_OPTION_SINGLE,
                DOUBLE: import_data_hooks2.STYLE_DROPDOWN_OPTION_DOUBLE,
                DASHED: import_data_hooks2.STYLE_DROPDOWN_OPTION_DASHED,
                DOTTED: import_data_hooks2.STYLE_DROPDOWN_OPTION_DOTTED
              };
              const style = await getBase().get((0, import_wix_rich_content_common.dataHook)(dataHookMap[type]));
              await style.click();
            }
          },
          exists: async () => {
            try {
              return getPluginToolbar().exists();
            } catch {
              return false;
            }
          }
        };
      }
    }
  };
};
//# sourceMappingURL=testkit.js.map
