"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 position_select_with_label_unidriver_exports = {};
__export(position_select_with_label_unidriver_exports, {
  createPositionSelectorWithLabelUniDriver: () => createPositionSelectorWithLabelUniDriver
});
module.exports = __toCommonJS(position_select_with_label_unidriver_exports);
var import_unidriver = require("@wix/design-system/dist/testkit/unidriver.js");
var import_wix_rich_content_common = require("./../../wix-rich-content-common/index.js");
var import_data_hooks = require("./data-hooks.js");
const createPositionSelectorWithLabelUniDriver = (getBase) => {
  const getPositionButtonElement = (position) => {
    return getBase().$((0, import_wix_rich_content_common.dataHook)(`${import_data_hooks.POSITION_TOGGLE_BUTTON}-${position}`));
  };
  return {
    exists: async () => {
      return getBase().exists();
    },
    clickPosition: async (position) => {
      const button = (0, import_unidriver.ToggleButtonUniDriver)(getPositionButtonElement(position), getBase());
      await button.click();
    },
    getSelectedPosition: async () => {
      const positions = [
        "TOP_LEFT",
        "TOP",
        "TOP_RIGHT",
        "CENTER_LEFT",
        "CENTER",
        "CENTER_RIGHT",
        "BOTTOM_LEFT",
        "BOTTOM",
        "BOTTOM_RIGHT"
      ];
      for (const position of positions) {
        const button = (0, import_unidriver.ToggleButtonUniDriver)(getPositionButtonElement(position), getBase());
        const isSelected = await button.isButtonSelected();
        if (isSelected) {
          return position;
        }
      }
      return null;
    }
  };
};
//# sourceMappingURL=position-select-with-label-unidriver.js.map
