{"version":3,"file":"Shuffle_CMS_Collection_Code_Override.D37cpgWm.mjs","names":["j","useMemo","Children"],"sources":["https:/framerusercontent.com/modules/RAFlXaAtqNdwEjKvEdVE/Jg52GMncSftdXsQtddM9/Shuffle_CMS_Collection_Code_Override.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useMemo,Children}from\"react\";// @ts-ignore – Framer runtime helpers\nimport{useQueryData}from\"framer\";import{getCollectionData}from\"https://framer.com/m/CMSLibrary-09eo.js\";/* --------------------------------- utils ---------------------------------- */function shuffleArray(array){const copy=[...array]// don’t mutate the original\n;for(let i=copy.length-1;i>0;i--){const j=Math.floor(Math.random()*(i+1));[copy[i],copy[j]]=[copy[j],copy[i]];}return copy;}/* ---------------- HOC: ShuffleCMSCollectionList --------------------------- */export function ShuffleCMSCollectionList(Component){return props=>{const items=getCollectionListItems(props);// build a stable signature for the current dataset\nconst itemsKey=items.map(c=>c?.key??\"\").join(\"|\");// shuffle **once** per unique dataset\nconst shuffled=useMemo(()=>{if(!items.length)return items;return shuffleArray(items);},[itemsKey]);return /*#__PURE__*/_jsx(Component,{...props,children:shuffled});};}/* ---------------------- CMS helpers --------------------------------------- */export function getCollectionListItems(props){const{query,childrenFunction}=getCollectionData({props});if(query&&childrenFunction){const data=useQueryData(query);let children=[];const clChildren=childrenFunction(data);if(Array.isArray(clChildren)){children=clChildren;}else if(Array.isArray(clChildren?.props?.children?.[0])){children=clChildren.props.children[0];}else if(Array.isArray(clChildren?.props?.children)){children=clChildren.props.children;}return Children.toArray(children);}return[];}\nexport const __FramerMetadata__ = {\"exports\":{\"getCollectionListItems\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"ShuffleCMSCollectionList\":{\"type\":\"reactHoc\",\"name\":\"ShuffleCMSCollectionList\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Shuffle_CMS_Collection_Code_Override.map"],"mappings":"8UACwL,SAAS,EAAa,EAAM,CAAC,IAAM,EAAK,CAAC,GAAG,EAAM,CACzO,IAAI,IAAI,EAAE,EAAK,OAAO,EAAE,EAAE,EAAE,IAAI,CAAC,IAAMA,EAAE,KAAK,MAAM,KAAK,QAAQ,EAAE,EAAE,GAAG,CAAC,CAAC,EAAK,GAAG,EAAKA,IAAI,CAAC,EAAKA,GAAG,EAAK,GAAG,CAAE,OAAO,EAAsF,SAAgB,EAAyB,EAAU,CAAC,MAAO,IAAO,CAAC,IAAM,EAAM,EAAuB,EAAM,CAClT,EAAS,EAAM,IAAI,GAAG,GAAG,KAAK,GAAG,CAAC,KAAK,IAAI,CAC3C,EAASC,MAAiB,EAAM,OAA2B,EAAa,EAAM,CAAhC,EAAmC,CAAC,EAAS,CAAC,CAAC,OAAoB,EAAK,EAAU,CAAC,GAAG,EAAM,SAAS,EAAS,CAAC,EAAoF,SAAgB,EAAuB,EAAM,CAAC,GAAK,CAAC,QAAM,oBAAkB,EAAkB,CAAC,QAAM,CAAC,CAAC,GAAG,GAAO,EAAiB,CAAC,IAAM,EAAK,EAAa,EAAM,CAAK,EAAS,EAAE,CAAO,EAAW,EAAiB,EAAK,CAA4O,OAAxO,MAAM,QAAQ,EAAW,CAAE,EAAS,EAAoB,MAAM,QAAQ,GAAY,OAAO,WAAW,GAAG,CAAE,EAAS,EAAW,MAAM,SAAS,GAAY,MAAM,QAAQ,GAAY,OAAO,SAAS,GAAE,EAAS,EAAW,MAAM,UAAiBC,EAAS,QAAQ,EAAS,CAAE,MAAM,EAAE,kBAJ5rB,IAAoC,IAC9C,IAAuE"}