{"version":3,"file":"PolaroidStack.nOiigbJB.mjs","names":["draggedIndex"],"sources":["https:/framerusercontent.com/modules/D8OiERKFjgsgxbERP1Ef/cYtPI1uP7JN79GLLsq1K/PolaroidStack.js"],"sourcesContent":["// Polaroid image stack component with tap-to-shift functionality\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,startTransition,useRef}from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{motion,AnimatePresence}from\"framer-motion\";/**\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function PolaroidStack(props){const{images=[{src:{src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",alt:\"Gradient 1 - Blue\"}},{src:{src:\"https://framerusercontent.com/images/aNsAT3jCvt4zglbWCUoFe33Q.jpg\",alt:\"Gradient 2 - Purple\"}},{src:{src:\"https://framerusercontent.com/images/BYnxEV1zjYb9bhWh1IwBZ1ZoS60.jpg\",alt:\"Gradient 3 - Orange\"}}],stackOffset=8,rotationRange=6,backgroundColor=\"#FFFFFF\",shadowIntensity=.15,animationDuration=.4}=props;const[currentIndex,setCurrentIndex]=useState(0);const[isDragging,setIsDragging]=useState(false);const[draggedIndex,setDraggedIndex]=useState(null);const containerRef=useRef(null);const handleClick=()=>{if(!isDragging){startTransition(()=>{// Move the bottom card to the top by cycling backwards\nsetCurrentIndex(prev=>(prev-1+images.length)%images.length);});}};const handleDragStart=index=>{startTransition(()=>{setIsDragging(true);setDraggedIndex(index);});};const handleDragEnd=index=>{startTransition(()=>{setIsDragging(false);setDraggedIndex(null);});};const handleReorder=(draggedIndex,targetIndex)=>{if(draggedIndex===targetIndex)return;// Calculate the new order based on drag and drop\nconst newOrder=[...images];const draggedItem=newOrder[draggedIndex];newOrder.splice(draggedIndex,1);newOrder.splice(targetIndex,0,draggedItem);// Update the current index to maintain the visual order\nconst draggedCurrentPos=(draggedIndex-currentIndex+images.length)%images.length;const targetCurrentPos=(targetIndex-currentIndex+images.length)%images.length;if(draggedCurrentPos===0){// If we're dragging the top card\nsetCurrentIndex(targetIndex);}else if(targetCurrentPos===0){// If we're dropping on the top card\nsetCurrentIndex(draggedIndex);}};const getRotation=(index,current)=>{const distance=(index-current+images.length)%images.length;const seed=index*123.456;const baseRotation=Math.sin(seed)*rotationRange;// Add slight variation for stacked cards\nif(distance>0){const stackSeed=index*456.789;const stackVariation=Math.cos(stackSeed)*3;return baseRotation+stackVariation;}return baseRotation;};const getZIndex=(index,current)=>{const distance=(index-current+images.length)%images.length;return images.length-distance;};const getOffset=(index,current)=>{const distance=(index-current+images.length)%images.length;if(distance===0)return 0;// Create organic offset with slight randomness\nconst baseOffset=stackOffset*distance;const seed=index*789.123;const randomOffset=Math.sin(seed)*5;const cosOffset=Math.cos(seed*1.5)*2;return baseOffset+randomOffset+cosOffset;};const getScale=(index,current)=>{const distance=(index-current+images.length)%images.length;if(distance===0)return 1;return 1-distance*.02;};return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{position:\"relative\",width:\"100%\",height:\"100%\",cursor:isDragging?\"grabbing\":\"pointer\",perspective:\"1000px\"},onClick:handleClick,children:/*#__PURE__*/_jsx(AnimatePresence,{children:images.map((image,index)=>/*#__PURE__*/_jsx(motion.div,{drag:true,dragConstraints:containerRef,dragElastic:.1,onDragStart:()=>handleDragStart(index),onDragEnd:()=>handleDragEnd(index),style:{position:\"absolute\",top:0,left:0,width:\"100%\",height:\"100%\",zIndex:draggedIndex===index?1e3:getZIndex(index,currentIndex),cursor:isDragging&&draggedIndex===index?\"grabbing\":\"grab\"},initial:{y:getOffset(index,currentIndex),x:getOffset(index,currentIndex)*.4,rotate:getRotation(index,currentIndex),scale:getScale(index,currentIndex),opacity:1},animate:{y:getOffset(index,currentIndex),x:getOffset(index,currentIndex)*.4,rotate:getRotation(index,currentIndex),scale:getScale(index,currentIndex),opacity:1},transition:{duration:isDragging&&draggedIndex===index?0:animationDuration,ease:\"easeInOut\",type:\"tween\"},whileHover:{scale:index===currentIndex?1.02:getScale(index,currentIndex),transition:{duration:.2}},whileDrag:{scale:1.05,rotate:getRotation(index,currentIndex)+5,zIndex:1e3},children:/*#__PURE__*/_jsxs(\"div\",{style:{width:\"100%\",height:\"100%\",backgroundColor:backgroundColor,borderRadius:\"4px\",padding:\"12px\",boxShadow:`0 4px 20px rgba(0, 0, 0, ${shadowIntensity})`,display:\"flex\",flexDirection:\"column\"},children:[/*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"85%\",backgroundColor:\"#f0f0f0\",borderRadius:\"2px\",overflow:\"hidden\"},children:/*#__PURE__*/_jsx(\"img\",{src:image.src.src,alt:image.src.alt||\"Polaroid photo\",style:{width:\"100%\",height:\"100%\",objectFit:\"cover\"}})}),/*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"15%\",backgroundColor:backgroundColor,display:\"flex\",alignItems:\"center\",justifyContent:\"center\"}})]})},`${index}-${currentIndex}`))})});}addPropertyControls(PolaroidStack,{images:{type:ControlType.Array,title:\"Images\",control:{type:ControlType.Object,controls:{src:{type:ControlType.ResponsiveImage,title:\"Image\"}}},defaultValue:[{src:{src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",alt:\"Gradient 1 - Blue\"}},{src:{src:\"https://framerusercontent.com/images/aNsAT3jCvt4zglbWCUoFe33Q.jpg\",alt:\"Gradient 2 - Purple\"}},{src:{src:\"https://framerusercontent.com/images/BYnxEV1zjYb9bhWh1IwBZ1ZoS60.jpg\",alt:\"Gradient 3 - Orange\"}}],maxCount:8},stackOffset:{type:ControlType.Number,title:\"Stack Offset\",defaultValue:8,min:0,max:30,step:1,unit:\"px\"},rotationRange:{type:ControlType.Number,title:\"Rotation Range\",defaultValue:6,min:0,max:15,step:.5,unit:\"deg\"},backgroundColor:{type:ControlType.Color,title:\"Polaroid Color\",defaultValue:\"#FFFFFF\"},shadowIntensity:{type:ControlType.Number,title:\"Shadow Intensity\",defaultValue:.15,min:0,max:.5,step:.05},animationDuration:{type:ControlType.Number,title:\"Animation Speed\",defaultValue:.4,min:.1,max:1,step:.1,unit:\"s\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"PolaroidStack\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerSupportedLayoutHeight\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./PolaroidStack.map"],"mappings":"6XAIG,SAAwB,EAAc,EAAM,CAAC,GAAK,CAAC,SAAO,CAAC,CAAC,IAAI,CAAC,IAAI,sEAAsE,IAAI,mBAAoB,CAAC,EAAC,CAAC,IAAI,CAAC,IAAI,oEAAoE,IAAI,qBAAsB,CAAC,EAAC,CAAC,IAAI,CAAC,IAAI,uEAAuE,IAAI,qBAAsB,CAAC,CAAC,EAAC,cAAY,EAAE,gBAAc,EAAE,kBAAgB,UAAU,kBAAgB,IAAI,oBAAkB,GAAG,CAAC,EAAW,CAAC,EAAa,EAAgB,CAAC,EAAS,EAAE,CAAM,CAAC,EAAW,EAAc,CAAC,GAAS,EAAM,CAAM,CAAC,EAAa,EAAgB,CAAC,EAAS,KAAK,CAAO,EAAa,EAAO,KAAK,CAAO,EAAY,IAAI,CAAC,AAAI,GAAY,EAAgB,IAAI,CACttB,EAAgB,IAAO,EAAK,EAAE,EAAO,QAAQ,EAAO,OAAO,AAAE,EAAC,AAAG,EAAO,EAAgB,GAAO,CAAC,EAAgB,IAAI,CAAqB,AAApB,GAAc,EAAK,CAAC,EAAgB,EAAM,AAAE,EAAC,AAAE,EAAO,EAAc,GAAO,CAAC,EAAgB,IAAI,CAAsB,AAArB,GAAc,EAAM,CAAC,EAAgB,KAAK,AAAE,EAAC,AAAE,EAAO,EAAc,CAACA,EAAa,IAAc,CAAC,GAAGA,IAAe,EAAY,OACrV,IAAM,EAAS,CAAC,GAAG,CAAO,EAAO,EAAY,EAASA,GAA8C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