{"version":3,"file":"Shuffle_CMS_Collection_Code_Override.ChZ5vyEo.mjs","names":["useMemo","Children","__esmMin","j","pe","init_npm_react_18_3_1","init_jsx_runtime","c","init_framer_BWFVvmND","useQueryData","getCollectionData","_collectionList_props_children","_collectionList_props1","_collectionList_props_children_props_children","_collectionList_props_children_props1","_collectionList_props_children1","_collectionList_props2","queryParent","collectionList","query","queryData","left","i","propertyControlsById","propertyControlsByName","id","control","childrenFunction","_clpc_props_children","_clpc_props1","clpc","init_CMSLibrary","shuffleArray","copy","array","ShuffleCMSCollectionList","items","getCollectionListItems","props","itemsKey","shuffled","Component","data","children","clChildren","init_Shuffle_CMS_Collection_Code_Override"],"sources":["https:/framerusercontent.com/modules/OPJlnSDokJ2eD9lIXljn/mr2QJ5zw4xvkJ1Vbvzgr/CMSLibrary.js","https:/framerusercontent.com/modules/RAFlXaAtqNdwEjKvEdVE/Jg52GMncSftdXsQtddM9/Shuffle_CMS_Collection_Code_Override.js"],"sourcesContent":["export function getCollectionData(collectionList){var _collectionList_props,_collectionList_props_children_props,_collectionList_props_children,_collectionList_props1,_collectionList_props_children_props_children_props,_collectionList_props_children_props_children,_collectionList_props_children_props1,_collectionList_props_children1,_collectionList_props2,_queryParent_props;let queryParent=null;if(collectionList===null||collectionList===void 0?void 0:(_collectionList_props=collectionList.props)===null||_collectionList_props===void 0?void 0:_collectionList_props.query){queryParent=collectionList;}else if(collectionList===null||collectionList===void 0?void 0:(_collectionList_props1=collectionList.props)===null||_collectionList_props1===void 0?void 0:(_collectionList_props_children=_collectionList_props1.children)===null||_collectionList_props_children===void 0?void 0:(_collectionList_props_children_props=_collectionList_props_children.props)===null||_collectionList_props_children_props===void 0?void 0:_collectionList_props_children_props.query){queryParent=collectionList.props.children;}else if(collectionList===null||collectionList===void 0?void 0:(_collectionList_props2=collectionList.props)===null||_collectionList_props2===void 0?void 0:(_collectionList_props_children1=_collectionList_props2.children)===null||_collectionList_props_children1===void 0?void 0:(_collectionList_props_children_props1=_collectionList_props_children1.props)===null||_collectionList_props_children_props1===void 0?void 0:(_collectionList_props_children_props_children=_collectionList_props_children_props1.children)===null||_collectionList_props_children_props_children===void 0?void 0:(_collectionList_props_children_props_children_props=_collectionList_props_children_props_children.props)===null||_collectionList_props_children_props_children_props===void 0?void 0:_collectionList_props_children_props_children_props.query){queryParent=collectionList.props.children.props.children;}const query=queryParent===null||queryParent===void 0?void 0:(_queryParent_props=queryParent.props)===null||_queryParent_props===void 0?void 0:_queryParent_props.query;let queryData=null;if(query===null||query===void 0?void 0:query.from){if(query.from.data){queryData=query.from.data;}else if(query.from.left){let left=query.from.left;for(let i=0;i<100;i++){if(left.type==\"Collection\"){queryData=left.data;break;}else if(left.left){left=left.left;}else{break;}}}}// Get property controls\nconst propertyControlsById=(queryData===null||queryData===void 0?void 0:queryData.propertyControls)||{};const propertyControlsByName={};for(const id in propertyControlsById){const control=propertyControlsById[id];propertyControlsByName[control.title]={id,...control};}// Get children function\nlet childrenFunction=null;if(collectionList){var _collectionList_props3,_clpc_props,_clpc_props_children_props,_clpc_props_children,_clpc_props1;const clpc=(_collectionList_props3=collectionList.props)===null||_collectionList_props3===void 0?void 0:_collectionList_props3.children;if(typeof clpc==\"function\"){childrenFunction=clpc;}else if(typeof(clpc===null||clpc===void 0?void 0:(_clpc_props=clpc.props)===null||_clpc_props===void 0?void 0:_clpc_props.children)==\"function\"){childrenFunction=clpc.props.children;}else if(typeof(clpc===null||clpc===void 0?void 0:(_clpc_props1=clpc.props)===null||_clpc_props1===void 0?void 0:(_clpc_props_children=_clpc_props1.children)===null||_clpc_props_children===void 0?void 0:(_clpc_props_children_props=_clpc_props_children.props)===null||_clpc_props_children_props===void 0?void 0:_clpc_props_children_props.children)==\"function\"){childrenFunction=clpc.props.children.props.children;}}return{query,queryParent,queryData,propertyControlsById,propertyControlsByName,childrenFunction};}export function addFieldsToSelect(fields,query,propertyControlsByName){const alias=query.alias;const select=Array.isArray(query===null||query===void 0?void 0:query.select)?[...query.select]:[];for(const fieldName of fields){var _propertyControlsByName_fieldName;const fieldId=(_propertyControlsByName_fieldName=propertyControlsByName[fieldName])===null||_propertyControlsByName_fieldName===void 0?void 0:_propertyControlsByName_fieldName.id;if(!fieldId){continue;}let matchFound=false;for(const item of select){if(item.name===fieldId&&item.type===\"Identifier\"&&item.collection===alias){matchFound=true;continue;}}if(matchFound){continue;}select.push({collection:alias,name:fieldId,type:\"Identifier\"});}return select;}\nexport const __FramerMetadata__ = {\"exports\":{\"getCollectionData\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"addFieldsToSelect\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CMSLibrary.map","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":"A,2KAAA,SAAgBU,EAAkB,EAAe,CAAC,IAA+DC,EAA+BC,EAA2EC,EAA8CC,EAAsCC,EAAgCC,EAA0C,IAAIC,EAAY,KAAQC,GAAiB,MAA4DA,EAAe,OAA2E,MAAO,EAAYA,EAAwBA,GAAiB,OAAsC,EAAuBA,EAAe,QAAS,OAA8C,EAA+BN,EAAuB,WAAY,MAA2FD,EAA+B,OAAyG,MAAO,EAAYO,EAAe,MAAM,SAAkBA,GAAiB,OAAsC,EAAuBA,EAAe,QAAS,OAA8C,EAAgCF,EAAuB,WAAY,OAAuD,EAAsCD,EAAgC,QAAS,OAA6D,EAA8CD,EAAsC,WAAY,MAAyHD,EAA8C,OAAuI,QAAO,EAAYK,EAAe,MAAM,SAAS,MAAM,UAAU,IAAMC,EAAMF,GAAgF,OAAqE,MAAUG,EAAU,KAAK,GAAGD,GAA0C,KAAK,CAAC,GAAGA,EAAM,KAAK,KAAM,EAAUA,EAAM,KAAK,UAAW,GAAGA,EAAM,KAAK,KAAK,CAAC,IAAIE,EAAKF,EAAM,KAAK,KAAK,IAAI,IAAIG,EAAE,EAAEA,EAAE,IAAI,IAAK,GAAGD,EAAK,MAAM,aAAa,CAAC,EAAUA,EAAK,KAAK,KAAM,MAAM,GAAGA,EAAK,KAAM,EAAKA,EAAK,UAAW,KAAQ,CAAC,CAC54E,IAAME,EAAsBH,GAAsD,kBAAmB,CAAC,EAAQI,EAAuB,CAAC,EAAE,IAAI,IAAMC,KAAMF,EAAqB,CAAC,IAAMG,EAAQH,E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