{"version":3,"file":"CMSSlideshow.Bf8p41g0.mjs","names":["SlideShow","j","Children"],"sources":["https:/framerusercontent.com/modules/u5zZXmxC8Fkv1kmoo9i6/e0nz2ulLW2EIio7irmGS/CMSSlideshow.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,// @ts-ignore\ngetPropertyControls,// @ts-ignore\nuseQueryData,ControlType,RenderTarget}from\"framer\";import{cloneElement,Children}from\"react\";import{motion}from\"framer-motion\";import SlideShow from\"https://framer.com/m/SlideShow-07du.js\";import{getCollectionData}from\"https://framer.com/m/CMSLibrary-09eo.js\";const slideshowProps=getComponentProps(SlideShow);/**\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n * @framerIntrinsicWidth 400\n * @framerIntrinsicHeight 200\n */export default function CMSSlideshow(props){const{startLayers,endLayers,...otherProps}=props;const isCanvas=RenderTarget.current()===RenderTarget.canvas;const items=isCanvas?[]:getCollectionListItems(props.collectionList?.[0]);let layers=[];if(startLayers){layers=layers.concat(startLayers);}if(!isCanvas){for(let i=0;i<items.length;i++){const layer=/*#__PURE__*/cloneElement(items[i].props.children.props.children,{style:{width:\"100%\",height:\"100%\"}});layers.push(/*#__PURE__*/_jsx(motion.div,{style:{width:\"100%\",height:\"100%\"},children:layer}));}if(props.randomize){layers=shuffleArray(layers);}}else{for(let i=0;i<props.itemAmount;i++){layers.push(/*#__PURE__*/_jsx(CanvasPlaceholder,{title:\"Run project to view slideshow content\",subtitle:\"Collection List content is not accessible to the slideshow component in the editor. Run your project orvisit the live website to view the slideshow with CMS content.\"}));}}if(endLayers){layers=layers.concat(endLayers);}return /*#__PURE__*/_jsx(SlideShow,{...otherProps,slots:layers});}CMSSlideshow.displayName=\"CMS Slideshow\";addPropertyControls(CMSSlideshow,{collectionList:{type:ControlType.ComponentInstance},startLayers:{type:ControlType.Array,control:{type:ControlType.ComponentInstance},title:\"Start\"},endLayers:{type:ControlType.Array,control:{type:ControlType.ComponentInstance},title:\"End\"},randomize:{type:ControlType.Boolean,defaultValue:false,description:\"Shuffle order of CMS items\"},...slideshowProps,arrowOptions:{...slideshowProps.arrowOptions,controls:{...slideshowProps.arrowOptions.controls,arrowPadding:{...slideshowProps.arrowOptions.controls.arrowPadding,max:Infinity,min:Infinity}}}});function getComponentProps(component){const{slots,...otherProps}=getPropertyControls(component);return otherProps;}export function CanvasPlaceholder({title,subtitle}){return /*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",width:\"100%\",height:\"100%\",placeContent:\"center\",placeItems:\"center\",flexDirection:\"column\",backgroundColor:\"rgba(136, 85, 255, 0.1)\",borderRadius:6,border:\"1px dashed rgb(136, 85, 255)\",color:\"rgb(136, 85, 255)\",fontSize:12,padding:24},children:[/*#__PURE__*/_jsx(\"p\",{style:{margin:0,marginBottom:10,fontWeight:600,textAlign:\"center\"},children:title}),/*#__PURE__*/_jsx(\"p\",{style:{margin:0,opacity:.7,maxWidth:500,lineHeight:1.5,textAlign:\"center\"},children:subtitle})]});}function shuffleArray(array){for(let i=array.length-1;i>0;i--){const j=Math.floor(Math.random()*(i+1));[array[i],array[j]]=[array[j],array[i]];}return array;}export function getCollectionListItems(collectionList){const{query,childrenFunction}=getCollectionData(collectionList);if(query&&childrenFunction){const data=useQueryData(query);let children=[];let 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;}if(children){return Children.toArray(children);}}return[];}\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CMSSlideshow\",\"slots\":[],\"annotations\":{\"framerIntrinsicHeight\":\"200\",\"framerIntrinsicWidth\":\"400\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerContractVersion\":\"1\"}},\"CanvasPlaceholder\":{\"type\":\"reactComponent\",\"name\":\"CanvasPlaceholder\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"getCollectionListItems\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CMSSlideshow.map"],"mappings":"6WAOG,SAAwB,EAAa,EAAM,CAAC,GAAK,CAAC,cAAY,YAAU,GAAG,GAAY,EAAY,EAAS,EAAa,SAAS,GAAG,EAAa,OAAa,EAAM,EAAS,EAAE,CAAC,EAAuB,EAAM,iBAAiB,GAAG,CAAK,EAAO,EAAE,CAAoD,GAAhD,IAAa,EAAO,EAAO,OAAO,EAAY,EAAM,EAAoT,IAAI,IAAI,EAAE,EAAE,EAAE,EAAM,WAAW,IAAK,EAAO,KAAkB,EAAK,EAAkB,CAAC,MAAM,wCAAwC,SAAS,wKAAwK,CAAC,CAAC,KAAjmB,CAAC,IAAI,IAAI,EAAE,EAAE,EAAE,EAAM,OAAO,IAAI,CAAC,IAAM,EAAmB,EAAa,EAAM,GAAG,MAAM,SAAS,MAAM,SAAS,CAAC,MAAM,CAAC,MAAM,OAAO,OAAO,OAAO,CAAC,CAAC,CAAC,EAAO,KAAkB,EAAK,EAAO,IAAI,CAAC,MAAM,CAAC,MAAM,OAAO,OAAO,OAAO,CAAC,SAAS,EAAM,CAAC,CAAC,CAAK,EAAM,YAAW,EAAO,EAAa,EAAO,EAAgX,OAA5C,IAAW,EAAO,EAAO,OAAO,EAAU,EAAsB,EAAKA,EAAU,CAAC,GAAG,EAAW,MAAM,EAAO,CAAC,CAAinB,SAAS,EAAkB,EAAU,CAAC,GAAK,CAAC,QAAM,GAAG,GAAY,EAAoB,EAAU,CAAC,OAAO,EAAY,SAAgB,EAAkB,CAAC,QAAM,YAAU,CAAC,OAAoB,EAAM,MAAM,CAAC,MAAM,CAAC,QAAQ,OAAO,MAAM,OAAO,OAAO,OAAO,aAAa,SAAS,WAAW,SAAS,cAAc,SAAS,gBAAgB,0BAA0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