{"version":3,"file":"WipeSlideshow.COi-M6cI.mjs","names":["useRef","useReducer","useState","startTransition","_jsxs","_jsx","__esmMin","init_npm_react_18_3_1","te","ye","de","init_jsx_runtime","c","p","_e","addPropertyControls","useIsStaticRenderer","init_framer_ChujFWHC","ControlType","useInView","useReducedMotion","init_framer_motion_1EwlFBEG","reducer","state","index","WipeSlideshow","props","interval","wipeDuration","radius","barColor","barsOffset","loadBlur","style","slides","slide","isStatic","reducedMotion","rootRef","inView","imageRefs","wipeEndsAt","current","previous","go","hovered","setHovered","focused","setFocused","stopped","setStopped","count","animate","autoplay","running","dwell","goTo","image","start","fill","value","i","isCurrent","wipesIn","EASE","el","init_WipeSlideshow"],"sources":["https:/framerusercontent.com/modules/D0BlHh5pwc6SOMET14u6/VE9fuAcHUPN2vMYyV1Zs/WipeSlideshow.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{startTransition,useReducer,useRef,useState}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{useInView,useReducedMotion}from\"framer-motion\";const EASE=\"cubic-bezier(0.65, 0, 0.35, 1)\";const fill={position:\"absolute\",inset:0,width:\"100%\",height:\"100%\"};function reducer(state,index){return index===state.current?state:{current:index,previous:state.current};}/**\n * Screenshots that replace each other with a left-to-right wipe, with progress bars below the frame.\n * The bars sit outside the component's box, so its parent must not clip overflow.\n * Pauses while hovered, focused or off screen. Clicking a bar stops it; tapping the screenshot stops or restarts it,\n * which is how touch visitors pause it. Never advances on its own for visitors who ask for reduced motion.\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function WipeSlideshow(props){const{interval,wipeDuration,radius,barColor,barsOffset,loadBlur,style}=props;const slides=props.slides.filter(slide=>slide.image);const isStatic=useIsStaticRenderer();const reducedMotion=useReducedMotion();const rootRef=useRef(null);const inView=useInView(rootRef,{amount:.3});const imageRefs=useRef([]);const wipeEndsAt=useRef(0);const[{current,previous},go]=useReducer(reducer,{current:0,previous:null});const[hovered,setHovered]=useState(false);const[focused,setFocused]=useState(false);const[stopped,setStopped]=useState(false);const count=slides.length;const animate=!isStatic&&!reducedMotion;const autoplay=count>1&&animate&&!stopped;const running=autoplay&&inView&&!hovered&&!focused;// A wipe must finish before the next one starts, whatever the two controls are set to\nconst dwell=Math.max(interval,wipeDuration+.5);const goTo=index=>{if(index===current||performance.now()<wipeEndsAt.current)return;wipeEndsAt.current=animate?performance.now()+wipeDuration*1e3:0;const image=imageRefs.current[index];const start=()=>startTransition(()=>go(index));// Starting the wipe before the image is decoded makes it appear in one jump partway through\nif(image)image.decode().catch(()=>{}).then(start);else start();};return /*#__PURE__*/_jsxs(\"div\",{ref:rootRef,style:{...style,position:\"relative\",width:\"100%\",height:\"100%\",\"--wipe-slideshow-bar\":barColor,\"--wipe-slideshow-load-blur\":`${loadBlur}px`},onPointerEnter:()=>setHovered(true),onPointerLeave:()=>setHovered(false),onFocus:e=>setFocused(e.target.matches(\":focus-visible\")),onBlur:e=>{if(!e.currentTarget.contains(e.relatedTarget))setFocused(false);},children:[/*#__PURE__*/_jsx(\"div\",{className:!isStatic&&loadBlur>0?\"wipe-slideshow-load\":undefined,style:{...fill,overflow:\"hidden\",borderRadius:radius},onClick:()=>setStopped(value=>!value),children:slides.map((slide,i)=>{const isCurrent=i===current;const wipesIn=isCurrent&&previous!==null&&animate;return(// The wipe moves this mask in from the left while the image inside moves the opposite way, so\n// the image stays put and is uncovered left to right. Transforms on layers that stay promoted\n// never make the browser re-raster the image, which a clip-path animation inside the tilted,\n// blurred frame did, flickering when each wipe ended.\n/*#__PURE__*/_jsx(\"div\",{style:{...fill,overflow:\"hidden\",willChange:\"transform\",zIndex:isCurrent?2:i===previous?1:0,animation:wipesIn?`wipe-slideshow-mask ${wipeDuration}s ${EASE} both`:\"none\"},children:/*#__PURE__*/_jsx(\"img\",{ref:el=>{imageRefs.current[i]=el;},src:slide.image.src,srcSet:slide.image.srcSet,sizes:\"(max-width: 809px) 100vw, 60vw\",alt:isCurrent?slide.alt:\"\",\"aria-hidden\":!isCurrent,// @ts-expect-error lowercase so React passes it to the DOM as-is; it's absent from the img prop types\nfetchpriority:i===0?\"high\":\"low\",// Chrome skips drawing large async-decoded images until a background decode finishes,\n// which showed the screenshot underneath for a frame\ndecoding:\"sync\",style:{...fill,objectFit:\"cover\",objectPosition:\"top left\",willChange:\"transform\",animation:wipesIn?`wipe-slideshow-image ${wipeDuration}s ${EASE} both`:\"none\"}})},i));})}),count>1&&/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",left:0,right:0,top:`calc(100% + ${barsOffset}px)`,display:\"flex\",justifyContent:\"center\",gap:8},children:slides.map((slide,i)=>/*#__PURE__*/_jsx(\"button\",{type:\"button\",\"aria-label\":`Show screen ${i+1}: ${slide.alt}`,\"aria-current\":i===current,onClick:()=>{setStopped(true);goTo(i);},className:\"wipe-slideshow-bar\",style:{position:\"relative\",width:48,height:4,padding:0,border:0,background:\"none\",cursor:\"pointer\"},children:/*#__PURE__*/_jsx(\"span\",{style:{display:\"block\",height:\"100%\",borderRadius:4,background:\"rgba(255, 255, 255, 0.18)\",overflow:\"hidden\"},children:/*#__PURE__*/_jsx(\"span\",{onAnimationEnd:()=>goTo((current+1)%count),style:{display:\"block\",height:\"100%\",background:barColor,transformOrigin:\"left\",transform:i<current||i===current&&!autoplay?\"none\":\"scaleX(0)\",animation:i===current&&autoplay?`wipe-slideshow-fill ${dwell}s linear forwards`:\"none\",animationPlayState:running?\"running\":\"paused\"}},`${i}-${current}`)})},i))}),/*#__PURE__*/_jsx(\"style\",{children:`\n                @keyframes wipe-slideshow-mask { from { transform: translateX(-100%) } to { transform: none } }\n                @keyframes wipe-slideshow-image { from { transform: translateX(100%) } to { transform: none } }\n                @keyframes wipe-slideshow-fill { from { transform: scaleX(0) } to { transform: none } }\n                @keyframes wipe-slideshow-focus { from { filter: blur(var(--wipe-slideshow-load-blur)) } to { filter: none } }\n                /* In CSS rather than JS so the server-rendered page already knows about reduced motion; \"both\" keeps\n                   the finished animation applied, so nothing changes on the image layers when it ends */\n                @media (prefers-reduced-motion: no-preference) {\n                    .wipe-slideshow-load { animation: wipe-slideshow-focus 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.3s both; }\n                }\n                .wipe-slideshow-bar::before { content: \"\"; position: absolute; inset: -10px -2px; }\n                .wipe-slideshow-bar:focus-visible { outline: 2px solid var(--wipe-slideshow-bar); outline-offset: 4px; }\n            `})]});}addPropertyControls(WipeSlideshow,{slides:{type:ControlType.Array,title:\"Slides\",maxCount:6,control:{type:ControlType.Object,controls:{image:{type:ControlType.ResponsiveImage,title:\"Image\"},alt:{type:ControlType.String,title:\"Alt text\",defaultValue:\"Product screenshot\"}}},defaultValue:[{alt:\"Product screenshot\"}]},interval:{type:ControlType.Number,title:\"Interval\",defaultValue:6,min:2,max:20,step:.5,unit:\"s\"},wipeDuration:{type:ControlType.Number,title:\"Wipe\",defaultValue:1.1,min:.2,max:3,step:.1,unit:\"s\"},radius:{type:ControlType.Number,title:\"Radius\",defaultValue:12,min:0,max:40},barColor:{type:ControlType.Color,title:\"Bar color\",defaultValue:\"#FF6B35\"},barsOffset:{type:ControlType.Number,title:\"Bars offset\",defaultValue:24,min:0,max:80,unit:\"px\"},loadBlur:{type:ControlType.Number,title:\"Load blur\",defaultValue:8,min:0,max:24,unit:\"px\",description:\"The first screenshot sharpens from this blur when the page opens. 0 turns it off.\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"WipeSlideshow\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./WipeSlideshow.map"],"mappings":"A,sQAAqW,SAASsB,EAAQC,EAAMC,EAAM,CAAC,OAAOA,IAAQD,EAAM,QAAQA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