{"version":3,"file":"Pagination.DbFZc9Wp.mjs","names":["useState","useCallback","_Fragment"],"sources":["https:/framerusercontent.com/modules/hLTcniQUwp0ja4ytX0HG/HmANkc1GZH8XdHYJe1bz/Pagination.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useState,useEffect,useCallback}from\"react\";// Pagination settings\nconst ITEMS_PER_PAGE=12;// Styles\nconst PAGINATION_STYLES={display:\"flex\",justifyContent:\"center\",alignItems:\"center\",marginTop:\"20px\"};const BUTTON_STYLES={padding:\"8px 12px\",margin:\"0 5px\",backgroundColor:\"#fff\",color:\"#333\",border:\"1px solid #ccc\",borderRadius:\"12px\",cursor:\"pointer\",fontSize:\"16px\",fontFamily:\"Arial, sans-serif\",fontWeight:\"normal\",transition:\"background-color 0.3s ease\"};const BUTTON_HOVER_STYLES={backgroundColor:\"#f0f0f0\"};const BUTTON_ACTIVE_STYLES={backgroundColor:\"#000\",color:\"#fff\",border:\"1px solid #000\",cursor:\"default\"};export function cardPaginator(Component){return props=>{const[currentPage,setCurrentPage]=useState(1);const[totalPages,setTotalPages]=useState(1);const updatePagination=useCallback(()=>{const layer=document.querySelector(`.${props.className}`);if(layer){const cards=layer.querySelectorAll(\"[aria-label='cmsitem']\");const totalItems=cards.length;const calculatedTotalPages=Math.ceil(totalItems/ITEMS_PER_PAGE);setTotalPages(calculatedTotalPages);const validPage=Math.min(Math.max(1,currentPage),calculatedTotalPages);setCurrentPage(validPage);cards.forEach((card,index)=>{const startIndex=(validPage-1)*ITEMS_PER_PAGE;const endIndex=startIndex+ITEMS_PER_PAGE;if(index>=startIndex&&index<endIndex){card.classList.remove(\"hidden\");}else{card.classList.add(\"hidden\");}});}},[props.className,currentPage]);useEffect(()=>{updatePagination();},[updatePagination]);const handlePageChange=page=>{const validPage=Math.min(Math.max(1,page),totalPages);setCurrentPage(validPage);};const renderPageButtons=()=>{const buttons=[];if(currentPage>1){buttons.push(/*#__PURE__*/_jsx(\"button\",{className:\"pagination-button\",onClick:()=>handlePageChange(currentPage-1),children:\"Previous\"},\"prev\"));}for(let i=1;i<=totalPages;i++){buttons.push(/*#__PURE__*/_jsx(\"button\",{className:`pagination-button ${i===currentPage?\"active\":\"\"}`,onClick:()=>handlePageChange(i),children:i},i));}if(currentPage<totalPages){buttons.push(/*#__PURE__*/_jsx(\"button\",{className:\"pagination-button\",onClick:()=>handlePageChange(currentPage+1),children:\"Next\"},\"next\"));}return buttons;};return /*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(Component,{...props}),/*#__PURE__*/_jsx(\"div\",{style:PAGINATION_STYLES,children:renderPageButtons()}),/*#__PURE__*/_jsx(\"style\",{children:`\n                    .${props.className} .hidden {\n                        display: none;\n                    }\n                    .pagination-button {\n                        padding: ${BUTTON_STYLES.padding};\n                        margin: ${BUTTON_STYLES.margin};\n                        background-color: ${BUTTON_STYLES.backgroundColor};\n                        color: ${BUTTON_STYLES.color};\n                        border: ${BUTTON_STYLES.border};\n                        border-radius: ${BUTTON_STYLES.borderRadius};\n                        cursor: ${BUTTON_STYLES.cursor};\n                        font-size: ${BUTTON_STYLES.fontSize};\n                        font-family: ${BUTTON_STYLES.fontFamily};\n                        font-weight: ${BUTTON_STYLES.fontWeight};\n                        transition: ${BUTTON_STYLES.transition};\n                    }\n                    .pagination-button:hover:not(.active) {\n                        background-color: ${BUTTON_HOVER_STYLES.backgroundColor};\n                    }\n                    .pagination-button.active {\n                        background-color: ${BUTTON_ACTIVE_STYLES.backgroundColor};\n                        color: ${BUTTON_ACTIVE_STYLES.color};\n                        border: ${BUTTON_ACTIVE_STYLES.border};\n                        cursor: ${BUTTON_ACTIVE_STYLES.cursor};\n                    }\n                `})]});};}\nexport const __FramerMetadata__ = {\"exports\":{\"cardPaginator\":{\"type\":\"reactHoc\",\"name\":\"cardPaginator\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingUR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