{"version":3,"file":"WithLoopingRightDigit.BD_DZfPt.mjs","names":["useState","useMemo","__esmMin","pe","init_ssg_sandbox_shims","te","init_npm_react_18_3_1","window","init_jsx_runtime","J","p","ce","_e","AnimatePresence","init_framer_motion_DhsWWWsN","motion","useIsStaticRenderer","init_framer_BWFVvmND","createLoopingRightDigitOverride","isStaticRenderer","index","setIndex","intervalId","prev","sequence","STEP_MS","fallbackValue","value","previousValue","rightDigit","previousRightDigit","direction","current","previous","incomingY","SHIFT_Y_PX","outgoingY","Component","props","DIGIT_STYLE","stablePrefix","SWAP_DURATION_S","withLoopingRightDigit","LOOP_SEQUENCE","withLoopingRightDigit132","LOOP_SEQUENCE_132","init_WithLoopingRightDigit"],"sources":["https:/framerusercontent.com/modules/ZspkkMqOeCWUQPpicuUm/883kJK1AELT3fH9bQSOy/WithLoopingRightDigit.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{forwardRef,startTransition,useEffect,useMemo,useState}from\"react\";import{useIsStaticRenderer}from\"framer\";import{AnimatePresence,motion}from\"framer-motion\";// User request: Create a Framer code override export for an existing canvas RichText text layer named something like withLoopingRightDigit. Keep wrapped layer editable and preserve typography/layout/color. Default visible value is 32. Every 2 seconds loop through: 32, 33, 34, 33, 34, 35, 36, 34, 33, 32. Only right digit animates, left digit stays visually stable as 3. Use subtle blur and opacity transition, no large movement, no stop condition. Safe for preview/browser, clean timers, avoid hydration issues.\nconst LOOP_SEQUENCE=[32,33,34,33,34,35,36,34,33,32];const STEP_MS=4e3;const SWAP_DURATION_S=.16;const SHIFT_Y_PX=5;const LOOP_SEQUENCE_132=[132,133,134,133,134,135,136,134,133,132];const DIGIT_STYLE={fontFamily:\"Inter, sans-serif\",fontWeight:500,fontSize:\"15px\",lineHeight:\"1.2em\",fontStyle:\"normal\",fontVariantNumeric:\"tabular-nums\",color:\"inherit\"};function createLoopingRightDigitOverride(Component,sequence,stablePrefix){return /*#__PURE__*/forwardRef((props,ref)=>{const isStaticRenderer=useIsStaticRenderer();const[index,setIndex]=useState(0);useEffect(()=>{if(isStaticRenderer)return;if(typeof window===\"undefined\")return;const intervalId=window.setInterval(()=>{startTransition(()=>{setIndex(prev=>(prev+1)%sequence.length);});},STEP_MS);return()=>{window.clearInterval(intervalId);};},[isStaticRenderer]);const fallbackValue=sequence[0]??0;const value=sequence[index]??fallbackValue;const previousIndex=(index-1+sequence.length)%sequence.length;const previousValue=sequence[previousIndex]??fallbackValue;const rightDigit=useMemo(()=>String(value).slice(-1),[value]);const previousRightDigit=useMemo(()=>String(previousValue).slice(-1),[previousValue]);const direction=useMemo(()=>{const current=Number(rightDigit);const previous=Number(previousRightDigit);if(current>previous)return 1;if(current<previous)return-1;return 0;},[rightDigit,previousRightDigit]);const incomingY=direction>0?-SHIFT_Y_PX:direction<0?SHIFT_Y_PX:0;const outgoingY=direction>0?SHIFT_Y_PX:direction<0?-SHIFT_Y_PX:0;return /*#__PURE__*/_jsx(Component,{ref:ref,...props,style:{...props.style},children:/*#__PURE__*/_jsxs(\"span\",{style:{display:\"inline-flex\",alignItems:\"baseline\",color:\"inherit\"},children:[/*#__PURE__*/_jsx(\"span\",{style:{display:\"inline-block\",...DIGIT_STYLE},children:stablePrefix}),/*#__PURE__*/_jsx(AnimatePresence,{mode:\"wait\",initial:false,children:/*#__PURE__*/_jsx(motion.span,{initial:{opacity:.35,filter:\"blur(1.4px)\",y:incomingY},animate:{opacity:1,filter:\"blur(0px)\",y:0},exit:{opacity:.35,filter:\"blur(1.4px)\",y:outgoingY},transition:{duration:SWAP_DURATION_S,ease:\"easeOut\"},style:{display:\"inline-block\",...DIGIT_STYLE,minWidth:\"1ch\",textAlign:\"left\"},children:rightDigit},`${index}-${rightDigit}`)})]})});});}export function withLoopingRightDigit(Component){return createLoopingRightDigitOverride(Component,LOOP_SEQUENCE,\"3\");}export function withLoopingRightDigit132(Component){return createLoopingRightDigitOverride(Component,LOOP_SEQUENCE_132,\"13\");}\nexport const __FramerMetadata__ = {\"exports\":{\"withLoopingRightDigit\":{\"type\":\"reactHoc\",\"name\":\"withLoopingRightDigit\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withLoopingRightDigit132\":{\"type\":\"reactHoc\",\"name\":\"withLoopingRightDigit132\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./WithLoopingRightDigit.map"],"mappings":"A,6QAC+V,SAASkB,EAAgC,EAAU,EAAS,EAAa,CAAC,MAAoB,iBAAY,EAAM,IAAM,CAAC,IAAMC,EAAiBH,EAAoB,EAAO,CAACI,EAAMC,GAAUrB,EAAS,CAAC,EAAEW,MAAc,CAA4B,GAAxBQ,GAAkCZ,IAAS,OAAY,OAAO,IAAMe,EAAWf,EAAO,gBAAgB,CAACF,MAAoB,CAACgB,EAAS,IAAOE,EAAK,GAAGC,EAAS,MAAM,CAAE,CAAC,CAAE,EAAEC,CAAO,EAAE,UAAU,CAAClB,EAAO,cAAce,CAAU,CAAE,CAAE,EAAE,CAACH,CAAgB,CAAC,EAAE,IAAMO,EAAcF,EAAS,IAAI,EAAQG,EAAMH,EAASJ,IAAQM,EAAkFE,EAAcJ,GAA7DJ,EAAM,EAAEI,EAAS,QAAQA,EAAS,SAAoDE,EAAoBG,EAAW5B,MAAY,OAAO0B,CAAK,CAAC,CAAC,MAAM,EAAE,EAAE,CAACA,CAAK,CAAC,EAAQG,EAAmB7B,MAAY,OAAO2B,CAAa,CAAC,CAAC,MAAM,EAAE,EAAE,CAACA,CAAa,CAAC,EAAQG,EAAU9B,MAAY,CAAC,IAAM+B,EAAQ,OAAOH,CAAU,EAAQI,EAAS,OAAOH,CAAkB,EAA4D,OAAvDE,EAAQC,EAAgB,EAAKD,EAAQC,EAAe,GAAU,CAAE,EAAE,CAACJ,EAAWC,CAAkB,CAAC,EAAQI,EAAUH,EAAU,EAAE,GAAYA,EAAU,EAAEI,EAAW,EAAQC,EAAUL,EAAU,EAAEI,EAAWJ,EAA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