"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);

// packages/block-editor/src/components/block-pattern-setup/setup-toolbar.js
var setup_toolbar_exports = {};
__export(setup_toolbar_exports, {
  default: () => setup_toolbar_default
});
module.exports = __toCommonJS(setup_toolbar_exports);
var import_i18n = require("@wordpress/i18n");
var import_components = require("@wordpress/components");
var import_icons = require("@wordpress/icons");
var import_constants = require("./constants");
var import_jsx_runtime = require("react/jsx-runtime");
var Actions = ({ onBlockPatternSelect }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "block-editor-block-pattern-setup__actions", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
  import_components.Button,
  {
    __next40pxDefaultSize: true,
    variant: "primary",
    onClick: onBlockPatternSelect,
    children: (0, import_i18n.__)("Choose")
  }
) });
var CarouselNavigation = ({
  handlePrevious,
  handleNext,
  activeSlide,
  totalSlides
}) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "block-editor-block-pattern-setup__navigation", children: [
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
    import_components.Button,
    {
      size: "compact",
      icon: (0, import_i18n.isRTL)() ? import_icons.chevronRight : import_icons.chevronLeft,
      label: (0, import_i18n.__)("Previous pattern"),
      onClick: handlePrevious,
      disabled: activeSlide === 0,
      accessibleWhenDisabled: true
    }
  ),
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
    import_components.Button,
    {
      size: "compact",
      icon: (0, import_i18n.isRTL)() ? import_icons.chevronLeft : import_icons.chevronRight,
      label: (0, import_i18n.__)("Next pattern"),
      onClick: handleNext,
      disabled: activeSlide === totalSlides - 1,
      accessibleWhenDisabled: true
    }
  )
] });
var SetupToolbar = ({
  viewMode,
  setViewMode,
  handlePrevious,
  handleNext,
  activeSlide,
  totalSlides,
  onBlockPatternSelect
}) => {
  const isCarouselView = viewMode === import_constants.VIEWMODES.carousel;
  const displayControls = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "block-editor-block-pattern-setup__display-controls", children: [
    /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
      import_components.Button,
      {
        size: "compact",
        icon: import_icons.stretchFullWidth,
        label: (0, import_i18n.__)("Carousel view"),
        onClick: () => setViewMode(import_constants.VIEWMODES.carousel),
        isPressed: isCarouselView
      }
    ),
    /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
      import_components.Button,
      {
        size: "compact",
        icon: import_icons.grid,
        label: (0, import_i18n.__)("Grid view"),
        onClick: () => setViewMode(import_constants.VIEWMODES.grid),
        isPressed: viewMode === import_constants.VIEWMODES.grid
      }
    )
  ] });
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "block-editor-block-pattern-setup__toolbar", children: [
    isCarouselView && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
      CarouselNavigation,
      {
        handlePrevious,
        handleNext,
        activeSlide,
        totalSlides
      }
    ),
    displayControls,
    isCarouselView && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Actions, { onBlockPatternSelect })
  ] });
};
var setup_toolbar_default = SetupToolbar;
//# sourceMappingURL=setup-toolbar.js.map
