"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 mobile_testkit_exports = {};
__export(mobile_testkit_exports, {
  createMobileToolbarTestkit: () => createMobileToolbarTestkit
});
module.exports = __toCommonJS(mobile_testkit_exports);
var import_wix_rich_content_common = require("./../../../../wix-rich-content-common/index.js");
var import_covert_to_specific_add_button_toolbar = require("../../testkit/covert-to-specific-add-button-toolbar.js");
var import__ = require("../index.js");
const createMobileToolbarTestkit = (getBase, createAddButtonToolbarPluginTestkits) => {
  const getMobileToolbar = () => getBase().$((0, import_wix_rich_content_common.dataHook)(import__.MOBILE_TOOLBAR));
  const createMobileToolbarPluginTestkits = (0, import_covert_to_specific_add_button_toolbar.convertToSpecificAddButtonToolbar)(
    createAddButtonToolbarPluginTestkits
  );
  return {
    waitForElement: async () => {
      const mobileToolbar = getMobileToolbar();
      await mobileToolbar.wait();
      return mobileToolbar;
    },
    getButtonsAmount: async () => {
      const mobileToolbar = getMobileToolbar();
      const buttons = mobileToolbar.$$("button");
      return await buttons.count();
    },
    scrollToElementByIndex: async (index) => {
      const mobileToolbar = getMobileToolbar();
      const button = mobileToolbar.$$("button").get(index);
      if (!button) {
        throw new Error(`Mobile toolbar doesn't have a button at index ${index}`);
      }
      await button.scrollIntoView?.();
    },
    exists: async () => {
      const mobileToolbar = getMobileToolbar();
      return mobileToolbar.exists();
    },
    plugins: createMobileToolbarPluginTestkits(getMobileToolbar)
  };
};
//# sourceMappingURL=mobile.testkit.js.map
