import { r as l, c as s, h as e, H as r } from "./index.e6beb8d9.js";
import { c as p } from "./index-orsBiyT_.fc4357c3.js";
import { d as c } from "./utils-CCck-DTo.e4e43b6a.js";
import "react";
import "react-dom";
const g = () => ":host{display:block;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}:host *{box-sizing:border-box}.pagination{display:block;width:100%}.pagination--variant-simple .pagination__list{gap:0}.pagination__list{display:flex;margin:0;padding:0;justify-content:flex-start;align-items:center;line-height:var(--s-line-height-base);list-style:none}@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px){.pagination__list{font-size:var(--s-font-size-sm);line-height:var(--s-line-height-sm)}}.pagination__page-size-selection{display:flex;padding-right:var(--s-space-24);flex-shrink:0;align-items:center;color:var(--s-interactive-primary-default);white-space:nowrap;gap:var(--s-space-8)}.pagination__page-size-select-container{position:relative}.pagination__page-size-select{padding-right:calc(1rem + var(--s-space-4));border:none;color:var(--s-interactive-primary-default);background-color:transparent;font:inherit;font-weight:var(--s-font-weight-medium);line-height:var(--s-line-height-base);cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none}.pagination__page-size-select:focus:not(:focus-visible){outline:none}.pagination__page-size-select:focus-visible{outline-color:var(--s-focus-default)}@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px){.pagination__page-size-select{font-size:var(--s-font-size-sm);line-height:var(--s-line-height-sm)}}.pagination__page-size-select-icon{position:absolute;top:50%;right:0;transform:translateY(-50%);pointer-events:none}.pagination__page-label{padding-right:var(--s-space-8);padding-left:var(--s-space-8)}.pagination__advanced-label{display:flex;align-items:center;white-space:nowrap;gap:var(--s-space-8)}.pagination__page-input{display:inline-flex;width:3.25rem;padding-top:var(--s-space-8);padding-right:var(--s-space-8);padding-bottom:var(--s-space-8);padding-left:var(--s-space-8);border:none;border-radius:var(--s-border-radius-sm);background-color:transparent;font:inherit;line-height:var(--s-line-height-base);text-align:center;box-shadow:inset 0 0 0 var(--s-border-width-default) var(--s-border-strong)}.pagination__page-input:focus:not(:focus-visible){outline:none}.pagination__page-input:focus-visible{outline-color:var(--s-focus-default)}@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px){.pagination__page-input{font-size:var(--s-font-size-sm);line-height:var(--s-line-height-sm)}}", h = class {
  constructor(n) {
    l(this, n), this.setPage = s(this, "setPage", 7), this.setPageSize = s(this, "setPageSize", 7), this.firstPageButtonLabel = "First page", this.lastPageButtonLabel = "Last page", this.nextButtonLabel = "Next page", this.pageLabel = "out of", this.pageSelectLabel = "Select a page", this.pageSize = 10, this.pageSizeOptions = [10, 25, 50], this.pageSizeSelectLabel = "Items per page:", this.prevButtonLabel = "Previous page", this.variant = "default", this.onFocusPageInput = (a) => {
      a.target.select();
    }, this.onFirstPageButtonClick = () => {
      this.page !== 1 && this.setPage.emit(1);
    }, this.onLastPageButtonClick = () => {
      this.page !== this.pages && this.setPage.emit(this.pages);
    }, this.onPrevButtonClick = () => {
      const a = Math.max(this.page - 1, 1);
      this.page !== a && this.setPage.emit(a);
    }, this.onNextButtonClick = () => {
      const a = Math.min(this.page + 1, this.pages);
      this.page !== a && this.setPage.emit(a);
    }, this.onPageInput = () => {
      let a = +this.pageInput.value;
      isNaN(a) ? (a = this.page, this.pageInput.value = String(a)) : a > this.pages ? (a = this.pages, this.pageInput.value = String(a)) : a < 1 && (a = 1, this.pageInput.value = String(a)), this.page !== a && this.onPageUpdate(a);
    }, this.onPageUpdate = c((a) => {
      this.setPage.emit(a);
    }, 500), this.onPageSizeSelect = (a) => {
      const t = +a.target.value;
      this.pageSize !== t && this.setPageSize.emit(t);
    };
  }
  render() {
    const n = this.variant !== "simple", a = this.variant === "advanced", t = `${this.page.toLocaleString()} ${this.pageLabel} ${this.pages.toLocaleString()}`, o = p("pagination", `pagination--variant-${this.variant}`);
    return e(r, { key: "5cda58b22f704bcb05c0f98f1fc32aa4bdf7d32d" }, e("nav", { key: "1c4bd2362ab41b4d56f1b4794510b1d7a6c16bed", "aria-label": this.label, class: o }, e("ul", { key: "d2ab1cdae6dcc8108d3a49c1d4dd900b94aea2da", class: "pagination__list", part: "pagination__list" }, this.showPageSizeSelect && e("li", { key: "03cd3c234bc30bea1db5b1a69a1ace5575808b7e", class: "pagination__list-item" }, e("label", { key: "35b26ca83eaf6c124af2a8e813d157bcf322489a", class: "pagination__page-size-selection" }, e("swirl-text", { key: "0bb124c38230df2698ac657a30975ba0e85ad312", whiteSpace: "inherit" }, this.pageSizeSelectLabel), e("swirl-stack", { key: "28d1fa4f87c3dfc27389eae074375c3aa3afd228", align: "center", class: "pagination__page-size-select-container", orientation: "horizontal" }, e("select", { key: "a46b453a4d9adb62c05dddc9f577e1e30c627802", class: "pagination__page-size-select", onChange: this.onPageSizeSelect }, this.pageSizeOptions.map((i) => e("option", { key: i, selected: i === this.pageSize, value: i }, i))), e("swirl-icon-expand-more", { key: "4d693f04efe502e5ffd42ba53a873958f28f6685", "aria-hidden": "true", class: "pagination__page-size-select-icon", size: 16 })))), e("li", { key: "988b6feb5508fef6ad1ea40594c75bc62e794adf", class: "pagination__list-item" }, e("swirl-button", { key: "28fc3fc5bfe369656fa2399d4de84f167ab5c2c5", class: "pagination__first-page-button", disabled: this.page <= 1, hideLabel: !0, icon: "<swirl-icon-double-arrow-left></swirl-icon-double-arrow-left>", intent: "primary", label: this.firstPageButtonLabel, onClick: this.onFirstPageButtonClick })), e("li", { key: "760d1f740fd2f1291a49c0ef8b02d3d57c050e10", class: "pagination__list-item" }, e("swirl-button", { key: "cee32b7d734ba1c187765d49bf02c4db259b8a7f", class: "pagination__prev-button", disabled: this.page <= 1, hideLabel: !0, icon: "<swirl-icon-chevron-left></swirl-icon-chevron-left>", intent: "primary", label: this.prevButtonLabel, onClick: this.onPrevButtonClick })), n ? e("li", { class: "pagination__list-item  pagination__page-label" }, e("span", null, a ? e("span", { "aria-current": "page", class: "pagination__advanced-label" }, e("input", { "aria-label": this.pageSelectLabel, class: "pagination__page-input", onFocus: this.onFocusPageInput, onInput: this.onPageInput, ref: (i) => this.pageInput = i, type: "text", value: this.page }), e("span", { "aria-hidden": "true" }, this.pageLabel, " ", this.pages.toLocaleString())) : e("span", { "aria-current": "page" }, t))) : e("li", { class: "pagination__list-item" }, e("swirl-visually-hidden", null, e("span", { "aria-current": "page" }, t))), e("li", { key: "5ef5ae81ff092d361f3ac8d3115796c067747da1", class: "pagination__list-item" }, e("swirl-button", { key: "144e998b66ea14c77077f4eb5855dcce6a10ba75", class: "pagination__next-button", disabled: this.page >= this.pages, hideLabel: !0, icon: "<swirl-icon-chevron-right></swirl-icon-chevron-right>", iconPosition: "end", intent: "primary", label: this.nextButtonLabel, onClick: this.onNextButtonClick })), e("li", { key: "385d446323f7b972711e74c16c567aab1e21ec99", class: "pagination__list-item" }, e("swirl-button", { key: "b5ad4d8f8c5fcbe20ebf3263b2c65fc9ee93a140", class: "pagination__last-page-button", disabled: this.page >= this.pages, hideLabel: !0, icon: "<swirl-icon-double-arrow-right></swirl-icon-double-arrow-right>", intent: "primary", label: this.lastPageButtonLabel, onClick: this.onLastPageButtonClick })))));
  }
};
h.style = g();
export {
  h as swirl_pagination
};
