/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
"use client";
"use client";
import { computeVisiblePages } from "./computeVisiblePages.js";
import { createContext, useContext, useMemo } from "react";
import { jsx } from "react/jsx-runtime";
//#region src/components/client/Pagination/paginationContext.tsx
const defaultGetItemAriaLabel = (page, isActive) => isActive ? `Page ${page}, current page` : `Go to page ${page}`;
const PaginationContext = createContext(null);
const PaginationProvider = ({ value, children }) => {
	const contextValue = useMemo(() => value, [value]);
	return /* @__PURE__ */ jsx(PaginationContext.Provider, {
		value: contextValue,
		children
	});
};
PaginationProvider.displayName = "PaginationProvider";
function usePaginationContext() {
	const context = useContext(PaginationContext);
	if (!context) throw new Error("Pagination components must be used within a Pagination provider.");
	return context;
}
function useVisiblePages() {
	const { activePage, totalPages, maxVisiblePageNumbers, ellipsisPlacement } = usePaginationContext();
	return useMemo(() => computeVisiblePages({
		activePage,
		totalPages,
		maxVisiblePageNumbers,
		ellipsisPlacement
	}), [
		activePage,
		totalPages,
		maxVisiblePageNumbers,
		ellipsisPlacement
	]);
}
//#endregion
export { PaginationContext, PaginationProvider, defaultGetItemAriaLabel, usePaginationContext, useVisiblePages };
