"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-library/src/query/edit/inspector-controls/per-page-control.js
var per_page_control_exports = {};
__export(per_page_control_exports, {
  default: () => per_page_control_default
});
module.exports = __toCommonJS(per_page_control_exports);
var import_components = require("@wordpress/components");
var import_i18n = require("@wordpress/i18n");
var import_jsx_runtime = require("react/jsx-runtime");
var MIN_POSTS_PER_PAGE = 1;
var MAX_POSTS_PER_PAGE = 100;
var PerPageControl = ({ perPage, offset = 0, onChange }) => {
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
    import_components.RangeControl,
    {
      __next40pxDefaultSize: true,
      __nextHasNoMarginBottom: true,
      label: (0, import_i18n.__)("Items per page"),
      min: MIN_POSTS_PER_PAGE,
      max: MAX_POSTS_PER_PAGE,
      onChange: (newPerPage) => {
        if (isNaN(newPerPage) || newPerPage < MIN_POSTS_PER_PAGE || newPerPage > MAX_POSTS_PER_PAGE) {
          return;
        }
        onChange({ perPage: newPerPage, offset });
      },
      value: parseInt(perPage, 10)
    }
  );
};
var per_page_control_default = PerPageControl;
//# sourceMappingURL=per-page-control.js.map
