{"version":3,"file":"RandomizeCollectionItems.CfcR76-i.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/RPEaXLmuMUgXqRN1ZweR/zo6wOJPfa5xHIGSd5Zwe/RandomizeCollectionItems.js"],"sourcesContent":["import{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]];}// Force the browser to reflow (repaint) and re-append the shuffled items\nrequestAnimationFrame(()=>{// Re-append items to the container to reflect the new order in the DOM\nitems.forEach(item=>{container.appendChild(item);});// Force a layout reflow for the container to respect the new order\ncontainer.style.display=\"none\"// Temporarily hide\n;container.offsetHeight// Trigger reflow\n;container.style.display=\"\"// Show again\n;});};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=./RandomizeCollectionItems.map"],"mappings":"4IAA2C,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,0BAA0B,CAC1B,EAAM,QAAQ,GAAM,CAAC,EAAU,YAAY,EAAK,EAAG,CACnD,EAAU,MAAM,QAAQ,OACvB,EAAU,aACV,EAAU,MAAM,QAAQ,IACtB,EAEF,OAFK,MAAc,CAAC,GAAwB,EAC1C,EAAE,CAAC,CACe,EAAK,EAAU,CAAC,IAAI,EAAa,GAAG,EAAM,CAAC"}