{"version":3,"file":"BeforeAfterSlider.Tz2RHVCU.mjs","names":["React.useRef","React.useCallback","__esmMin","init_ssg_sandbox_shims","ne","window","de","init_jsx_runtime","c","p","init_npm_react_18_3_1","ce","motion","useInView","useTransform","useMotionValue","useReducedMotion","animate","init_framer_motion_DhsWWWsN","RenderTarget","init_framer_BisrWwwE","addPropertyControls","ControlType","PP_FONT_FACE","PP","ppImageSrcSet","ppScaledImage","init_ppBrand","MOTION","PP_FONT","resolveSrc","value","BeforeAfterSlider","props","ref","reduceMotion","rt","isCanvas","inView","pos","clipPath","v","left","dragging","touched","sweep","setAria","off","controls","updateFromEvent","rect","x","clientX","onPointerDown","onPointerMove","onPointerUp","onKeyDown","step","next","beforeSrc","before","afterSrc","after","beforeLabel","afterLabel","style","IMG_SIZES","IMG_WIDTHS","init_BeforeAfterSlider"],"sources":["https:/framerusercontent.com/modules/n1aYvm9nKtvnb4V1Vcv6/oxbJ7is70EkPdmmWhtev/BeforeAfterSlider.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";import{animate,motion,useInView,useMotionValue,useReducedMotion,useTransform}from\"framer-motion\";import{MOTION,PP,PP_FONT,PP_FONT_FACE,ppImageSrcSet,ppScaledImage}from\"https://framerusercontent.com/modules/ntpRMZJn5GXg9XRgRRHO/tBQLb7AcK9gBkXYYoRkl/ppBrand.js\";/**\n * The slider frame renders at roughly 390-640px wide, so these caps keep a\n * full-resolution upload from being served at its native size — the home page\n * was shipping a single 6960x4640 original weighing ~20MB.\n */const IMG_WIDTHS=[512,1024,1536];const IMG_SIZES=\"(max-width: 809px) 100vw, 420px\";function resolveSrc(value){if(!value)return undefined;if(typeof value===\"string\")return value;if(value.src)return value.src;if(value.url)return value.url;return undefined;}/** @framerSupportedLayoutWidth any-fillable *//** @framerSupportedLayoutHeight any-fillable */export default function BeforeAfterSlider(props){const{before,after,beforeLabel=\"Before\",afterLabel=\"After\",style}=props;const ref=React.useRef(null);const reduceMotion=useReducedMotion();const rt=RenderTarget.current();const isCanvas=rt===RenderTarget.canvas||rt===RenderTarget.thumbnail;const inView=useInView(ref,{once:true,amount:.5});/**\n   * Divider position (0-100) as a MotionValue rather than React state. The\n   * previous implementation called setState on every pointermove, re-rendering\n   * the whole component — and both images — on every frame of a drag. A\n   * MotionValue writes straight to the DOM, so dragging never touches React's\n   * render cycle.\n   */const pos=useMotionValue(50);const clipPath=useTransform(pos,v=>`inset(0 0 0 ${v}%)`);const left=useTransform(pos,v=>`${v}%`);const dragging=React.useRef(false);const touched=React.useRef(false);const sweep=React.useRef(null);/**\n   * Mirror the value onto ARIA imperatively. Doing this through state would\n   * reintroduce the per-frame re-render this component exists to avoid.\n   */React.useEffect(()=>{const setAria=v=>{ref.current?.setAttribute(\"aria-valuenow\",String(Math.round(v)));};setAria(pos.get());const off=pos.on(\"change\",setAria);return()=>{off();document.body.style.userSelect=\"\";document.body.style.webkitUserSelect=\"\";};},[pos]);/**\n   * One-time nudge when the slider first scrolls into view: sweeps the divider\n   * to hint that it's draggable, then settles back to centre. Skipped on the\n   * canvas, for reduced-motion users, and if the visitor already grabbed it.\n   */React.useEffect(()=>{if(!inView||isCanvas||reduceMotion||touched.current)return;const controls=animate(pos,[50,68,34,50],{duration:2.4,times:[0,.3,.68,1],ease:[.16,1,.3,1],delay:.35});sweep.current=controls;return()=>{controls.stop();sweep.current=null;};},[inView,isCanvas,reduceMotion,pos]);const updateFromEvent=React.useCallback(clientX=>{if(!ref.current)return;const rect=ref.current.getBoundingClientRect();if(rect.width<=0)return;const x=Math.max(0,Math.min(rect.width,clientX-rect.left));pos.set(x/rect.width*100);},[pos]);const onPointerDown=e=>{// Stop the browser from starting a native text selection / image drag,\n// which otherwise highlights the surrounding page while sliding.\ne.preventDefault();window.getSelection?.()?.removeAllRanges();document.body.style.userSelect=\"none\";document.body.style.webkitUserSelect=\"none\";ref.current?.focus({preventScroll:true});// pos.set() does not cancel a running animate(), so without this the intro\n// sweep keeps writing over the visitor's drag until it finishes. Flipping\n// `touched` only prevents the sweep from starting, not from continuing.\nsweep.current?.stop();sweep.current=null;dragging.current=true;touched.current=true;updateFromEvent(e.clientX);try{ref.current?.setPointerCapture(e.pointerId);}catch(_){}};const onPointerMove=e=>{if(dragging.current)updateFromEvent(e.clientX);};const onPointerUp=e=>{dragging.current=false;document.body.style.userSelect=\"\";document.body.style.webkitUserSelect=\"\";try{ref.current?.releasePointerCapture(e.pointerId);}catch(_){}};/** Keyboard control — the previous version was pointer-only. */const onKeyDown=e=>{const step=e.shiftKey?10:2;let next=null;if(e.key===\"ArrowLeft\")next=Math.max(0,pos.get()-step);else if(e.key===\"ArrowRight\")next=Math.min(100,pos.get()+step);else if(e.key===\"Home\")next=0;else if(e.key===\"End\")next=100;if(next===null)return;e.preventDefault();touched.current=true;animate(pos,next,{type:\"spring\",stiffness:520,damping:38});};const beforeSrc=resolveSrc(before);const afterSrc=resolveSrc(after);return /*#__PURE__*/_jsxs(\"div\",{ref:ref,className:\"pp-bas\",role:\"slider\",tabIndex:0,\"aria-label\":`Compare ${beforeLabel} and ${afterLabel}`,\"aria-valuemin\":0,\"aria-valuemax\":100,\"aria-valuenow\":50,onKeyDown:onKeyDown,style:{...style,position:\"relative\",width:\"100%\",height:\"100%\",minHeight:220,borderRadius:12,overflow:\"hidden\",cursor:\"ew-resize\",userSelect:\"none\",WebkitUserSelect:\"none\",touchAction:\"pan-y\",background:PP.ink},onPointerDown:onPointerDown,onPointerMove:onPointerMove,onPointerUp:onPointerUp,onPointerCancel:onPointerUp,children:[/*#__PURE__*/_jsx(\"style\",{children:`${PP_FONT_FACE}.pp-bas:focus-visible{outline:none;box-shadow:0 0 0 3px rgba(42,157,142,0.45)}.pp-bas, .pp-bas *{-webkit-user-select:none;user-select:none}.pp-bas img{-webkit-user-drag:none}`}),!beforeSrc&&!afterSrc?/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",inset:0,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",color:PP.whiteMuted,fontFamily:PP_FONT,fontSize:13,letterSpacing:\"0.02em\",pointerEvents:\"none\"},children:\"Add before/after images\"}):null,beforeSrc?/*#__PURE__*/_jsx(\"img\",{alt:\"\",draggable:false,loading:\"lazy\",decoding:\"async\",sizes:IMG_SIZES,srcSet:ppImageSrcSet(beforeSrc,IMG_WIDTHS),src:ppScaledImage(beforeSrc,1024)||beforeSrc,style:{position:\"absolute\",inset:0,width:\"100%\",height:\"100%\",objectFit:\"cover\",pointerEvents:\"none\"}}):null,afterSrc?/*#__PURE__*/_jsx(motion.img,{alt:\"\",draggable:false,loading:\"lazy\",decoding:\"async\",sizes:IMG_SIZES,srcSet:ppImageSrcSet(afterSrc,IMG_WIDTHS),src:ppScaledImage(afterSrc,1024)||afterSrc,style:{position:\"absolute\",inset:0,width:\"100%\",height:\"100%\",objectFit:\"cover\",clipPath,pointerEvents:\"none\"}}):null,/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:14,left:14,padding:\"5px 10px\",borderRadius:4,background:\"rgba(23,49,59,0.78)\",color:\"#fff\",fontFamily:PP_FONT,fontWeight:700,fontSize:12,letterSpacing:\"0.14em\",textTransform:\"uppercase\"},children:beforeLabel}),/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:14,right:14,padding:\"5px 10px\",borderRadius:4,background:\"rgba(23,49,59,0.78)\",color:\"#fff\",fontFamily:PP_FONT,fontWeight:700,fontSize:12,letterSpacing:\"0.14em\",textTransform:\"uppercase\"},children:afterLabel}),/*#__PURE__*/_jsx(motion.div,{style:{position:\"absolute\",top:0,bottom:0,left,width:2,x:\"-50%\",background:PP.paper}}),/*#__PURE__*/_jsx(motion.div,{\"aria-hidden\":\"true\",tabIndex:-1,whileHover:{scale:1.08},whileTap:{scale:.94},transition:MOTION.springDrag,style:{position:\"absolute\",top:\"50%\",left,x:\"-50%\",y:\"-50%\",width:44,height:44,borderRadius:999,background:PP.paper,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",boxShadow:\"0 8px 24px rgba(0,0,0,0.28)\",color:PP.marine},children:/*#__PURE__*/_jsxs(\"svg\",{width:\"20\",height:\"20\",viewBox:\"0 0 24 24\",fill:\"none\",stroke:\"currentColor\",strokeWidth:\"2.2\",strokeLinecap:\"round\",strokeLinejoin:\"round\",children:[/*#__PURE__*/_jsx(\"path\",{d:\"M9 18l-6-6 6-6\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M15 6l6 6-6 6\"})]})})]});}addPropertyControls(BeforeAfterSlider,{before:{type:ControlType.Image,title:\"Before\"},after:{type:ControlType.Image,title:\"After\"},beforeLabel:{type:ControlType.String,title:\"Before Label\"},afterLabel:{type:ControlType.String,title:\"After Label\"}})// Rebuilt 2026-08-24: PP_FONT now resolves to the private \"PP Biennale\"\n// family, mapped only to the licensed Fontspring webfonts. Framer rebuilds a\n// component only when its own file changes, so dependents of ppBrand.ts must be\n// touched for a token change to reach the published bundle.\n// Rebuild stamp 2026-08-24b: ppBrand Ink 3 / Orange Ink darkened to meet 4.5:1.\n;\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"BeforeAfterSlider\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"\",\"framerSupportedLayoutWidth\":\"\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./BeforeAfterSlider.map"],"mappings":"A,iYAIsF,SAAS8B,EAAW,EAAM,CAAC,GAAIC,EAAuB,IAAG,OAAOA,GAAQ,SAAS,OAAOA,EAAM,GAAGA,EAAM,IAAI,OAAOA,EAAM,IAAI,GAAGA,EAAM,IAAI,OAAOA,EAAM,GAA9D,CAAmF,CAAgG,SAAwBC,EAAkB,EAAM,CAAC,GAAK,CAAC,SAAO,QAAM,cAAY,SAAS,aAAW,QAAQ,SAAOC,EAAYC,EAAIlC,EAAa,IAAI,EAAQmC,EAAanB,EAAiB,EAA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