{"version":3,"file":"Random_Sort_CMS.CUov7-MA.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/G5575zvqg1wzPwQKG7wf/DZw3UbhCKAiOVC5Cd9Ki/Random_Sort_CMS.js"],"sourcesContent":["// Apply this code override to the \"Collection List\" and it will randomly re-order your \"Post\" containers\n// Modified from the following override:\n// https://gist.github.com/tswic-highdesert/23e82bdc9f1bc7fa5ef48c1cac0656e2\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";export const withShuffledItems=Component=>{const ShuffledComponent=props=>{const componentRef=useRef(null);const shuffleAndDisplayItems=()=>{const container=componentRef.current;if(!container)return;// get child nodes of our collection\nlet items=Array.from(container.children);// Shuffle the array\nfor(let i=items.length-1;i>0;i--){const j=Math.floor(Math.random()*(i+1));[items[i],items[j]]=[items[j],items[i]];}// Re-append items to the container to reflect the new order in the DOM\nitems.forEach(item=>{// Move item to the end of the container, effectively reordering them\ncontainer.appendChild(item);});};useEffect(()=>{shuffleAndDisplayItems()// Shuffle and display items on component mount\n;},[])// Empty dependency array ensures this runs once after the initial render\n;return /*#__PURE__*/_jsx(Component,{ref:componentRef,...props});};return ShuffledComponent;};\nexport const __FramerMetadata__ = {\"exports\":{\"withShuffledItems\":{\"type\":\"reactHoc\",\"name\":\"withShuffledItems\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Random_Sort_CMS.map"],"mappings":"4IAG2C,IAAoC,CAAa,EAAkB,GAAoC,GAAO,CAAC,IAAM,EAAaA,EAAO,KAAK,CAAO,MAA2B,CAAC,IAAM,EAAU,EAAa,QAAQ,GAAG,CAAC,EAAU,OAC/Q,IAAI,EAAM,MAAM,KAAK,EAAU,SAAS,CACxC,IAAI,IAAI,EAAE,EAAM,OAAO,EAAE,EAAE,EAAE,IAAI,CAAC,IAAM,EAAE,KAAK,MAAM,KAAK,QAAQ,EAAE,EAAE,GAAG,CAAC,CAAC,EAAM,GAAG,EAAM,IAAI,CAAC,EAAM,GAAG,EAAM,GAAG,CACjH,EAAM,QAAQ,GAAM,CACpB,EAAU,YAAY,EAAK,EAAG,EAE7B,OAFgC,MAAc,CAAC,GAAwB,EACrE,EAAE,CAAC,CACe,EAAK,EAAU,CAAC,IAAI,EAAa,GAAG,EAAM,CAAC"}