{"version":3,"file":"AdvanceCounter.DoEhc99j.mjs","names":["useState","useRef","useMemo"],"sources":["https:/framerusercontent.com/modules/DRSXYwbK3T2qTNdA5N5v/JyoKjnKrHYMWaDeMTBOR/AdvanceCounter.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useEffect,useRef,startTransition,useMemo}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{motion,useInView}from\"framer-motion\";/**\n * Vertical Text Rolling Animation\n *\n * Each character position shows a vertical column of the SAME target letter repeated multiple times, rolling to reveal the final character.\n *\n * @framerIntrinsicWidth 400\n * @framerIntrinsicHeight 120\n *\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function AdvanceCounter(props){const{targetNumber=12345,prefix=\"\",suffix=\"\",duplicateCount=8,rollDuration=2,staggerDelay=.1,blurIntensity=8,useRandomStart=false,autoplay=true,showBackground=true,backgroundColor=\"#000000\",textColor=\"#FFFFFF\",font,prefixFont,suffixFont,prefixColor=\"#FFFFFF\",suffixColor=\"#FFFFFF\",animationPattern=\"sequential\",gap=.05,operator=\"\",operatorPosition=3,operatorFont,operatorColor=\"#FFFFFF\"}=props;const[isAnimating,setIsAnimating]=useState(false);const[advanceCounter,setAdvanceCounter]=useState(0);const containerRef=useRef(null);const isInView=useInView(containerRef,{once:true});const isStatic=useIsStaticRenderer();const characters=String(targetNumber).split(\"\");// Autoplay when in view\nuseEffect(()=>{if(isInView&&autoplay&&!isStatic){startTransition(()=>setIsAnimating(true));}},[isInView,autoplay,isStatic]);const handleReplay=()=>{startTransition(()=>{setIsAnimating(false);setAdvanceCounter(prev=>prev+1);setTimeout(()=>{startTransition(()=>setIsAnimating(true));},50);});};return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{...props.style,position:\"relative\",width:\"100%\",height:\"100%\",backgroundColor:showBackground?backgroundColor:\"transparent\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",overflow:\"hidden\",cursor:\"pointer\",userSelect:\"none\"},onClick:isStatic?undefined:handleReplay,children:/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",alignItems:\"center\",justifyContent:\"center\",gap:`${gap}em`,...font},children:[prefix&&/*#__PURE__*/_jsx(\"span\",{style:{color:prefixColor,...prefixFont},children:prefix}),characters.map((char,index)=>{const shouldShowOperator=operator&&operatorPosition>0&&index===operatorPosition-1;return /*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",alignItems:\"center\",gap:`${gap}em`},children:[/*#__PURE__*/_jsx(CharacterColumn,{character:char,duplicateCount:duplicateCount,rollDuration:rollDuration,delay:index*staggerDelay,blurIntensity:blurIntensity,isAnimating:isAnimating,textColor:textColor,font:font,isStatic:isStatic,animationPattern:animationPattern,characterIndex:index,useRandomStart:useRandomStart,advanceCounter:advanceCounter}),shouldShowOperator&&/*#__PURE__*/_jsx(\"span\",{style:{color:operatorColor,...operatorFont},children:operator})]},`${char}-${index}`);}),suffix&&/*#__PURE__*/_jsx(\"span\",{style:{color:suffixColor,...suffixFont},children:suffix})]})});}function CharacterColumn({character,duplicateCount,rollDuration,delay,blurIntensity,isAnimating,textColor,font,isStatic,animationPattern,characterIndex,useRandomStart,advanceCounter}){// Determine animation direction based on pattern and character position\nconst isOddPosition=characterIndex%2===0;const shouldRollFromBottom=animationPattern===\"alternating\"&&!isOddPosition;// Create array: show random numbers cycling, then settle on target\nconst duplicates=useMemo(()=>useRandomStart?(()=>{const result=[];// Fill with random digits\n    for(let i=0;i<duplicateCount;i++){if(shouldRollFromBottom){// For bottom-to-top: target is at the start (index 0)\n    if(i===0){result.push(character);}else{result.push(String(Math.floor(Math.random()*10)));}}else{// For top-to-bottom: target is at the end (last index)\n    if(i===duplicateCount-1){result.push(character);}else{result.push(String(Math.floor(Math.random()*10)));}}}return result;})():Array(duplicateCount).fill(character),[advanceCounter,character,duplicateCount,shouldRollFromBottom,useRandomStart]);// Calculate the height needed to show one character\nconst lineHeightValue=font?.lineHeight||\"1em\";let lineHeight=parseFloat(lineHeightValue);// Handle percentage values (e.g., \"120%\" -> 1.2)\nif(typeof lineHeightValue===\"string\"&&lineHeightValue.includes(\"%\")){lineHeight=lineHeight/100;}const fontSize=parseFloat(font?.fontSize||\"60px\");const characterHeight=fontSize*lineHeight;// Calculate total scroll distance (all duplicates minus the final visible one)\nconst totalScrollDistance=characterHeight*(duplicateCount-1);// Set initial and final positions based on direction\nconst initialY=shouldRollFromBottom?-totalScrollDistance:0;const finalY=shouldRollFromBottom?0:-totalScrollDistance;if(isStatic){return /*#__PURE__*/_jsx(\"div\",{style:{position:\"relative\",height:`${characterHeight}px`,overflow:\"hidden\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\"},children:/*#__PURE__*/_jsx(\"span\",{style:{color:textColor,...font,lineHeight:font?.lineHeight||\"1em\"},children:character})});}return /*#__PURE__*/_jsx(\"div\",{style:{position:\"relative\",height:`${characterHeight}px`,overflow:\"hidden\",display:\"flex\",alignItems:\"flex-start\",justifyContent:\"center\"},children:/*#__PURE__*/_jsx(motion.div,{style:{display:\"flex\",flexDirection:\"column\",alignItems:\"center\"},initial:{y:initialY},animate:isAnimating?{y:finalY}:{y:initialY},transition:{duration:rollDuration,delay:delay,ease:[.25,.46,.45,.94],type:\"tween\"},children:duplicates.map((char,index)=>/*#__PURE__*/_jsx(motion.span,{style:{color:textColor,height:`${characterHeight}px`,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",...font,lineHeight:font?.lineHeight||\"1em\"},initial:{filter:\"blur(0px)\"},animate:isAnimating?{filter:[\"blur(0px)\",`blur(${blurIntensity}px)`,`blur(${blurIntensity}px)`,\"blur(0px)\"]}:{filter:\"blur(0px)\"},transition:{duration:rollDuration,delay:delay,times:[0,.2,.8,1],ease:\"easeOut\"},children:char},index))})});}addPropertyControls(AdvanceCounter,{targetNumber:{type:ControlType.Number,title:\"Target Number\",defaultValue:12345,displayStepper:true},autoplay:{type:ControlType.Boolean,title:\"Autoplay\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},useRandomStart:{type:ControlType.Boolean,title:\"Random Start\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"},operator:{type:ControlType.String,title:\"Operator\",defaultValue:\"\",placeholder:\"e.g., , or .\"},operatorPosition:{type:ControlType.Number,title:\"Operator Position\",defaultValue:3,min:1,max:10,step:1,displayStepper:true,hidden:({operator})=>!operator},operatorFont:{type:ControlType.Font,title:\"Operator Font\",defaultValue:{fontSize:\"60px\",variant:\"Bold\",letterSpacing:\"-0.02em\",lineHeight:\"1em\"},controls:\"extended\",defaultFontType:\"sans-serif\",hidden:({operator})=>!operator},operatorColor:{type:ControlType.Color,title:\"Operator Color\",defaultValue:\"#FFFFFF\",hidden:({operator})=>!operator},prefix:{type:ControlType.String,title:\"Prefix\",defaultValue:\"\",placeholder:\"Text before...\"},prefixFont:{type:ControlType.Font,title:\"Prefix Font\",defaultValue:{fontSize:\"60px\",variant:\"Bold\",letterSpacing:\"-0.02em\",lineHeight:\"1em\"},controls:\"extended\",defaultFontType:\"sans-serif\",hidden:({prefix})=>!prefix},prefixColor:{type:ControlType.Color,title:\"Prefix Color\",defaultValue:\"#FFFFFF\",hidden:({prefix})=>!prefix},suffix:{type:ControlType.String,title:\"Suffix\",defaultValue:\"\",placeholder:\"Text after...\"},suffixFont:{type:ControlType.Font,title:\"Suffix Font\",defaultValue:{fontSize:\"60px\",variant:\"Bold\",letterSpacing:\"-0.02em\",lineHeight:\"1em\"},controls:\"extended\",defaultFontType:\"sans-serif\",hidden:({suffix})=>!suffix},suffixColor:{type:ControlType.Color,title:\"Suffix Color\",defaultValue:\"#FFFFFF\",hidden:({suffix})=>!suffix},gap:{type:ControlType.Number,title:\"Gap\",defaultValue:.05,min:0,max:1,step:.01,unit:\"em\"},animationPattern:{type:ControlType.Enum,title:\"Animation Pattern\",options:[\"sequential\",\"alternating\"],optionTitles:[\"Sequential\",\"Alternating\"],defaultValue:\"sequential\",displaySegmentedControl:true},font:{type:ControlType.Font,title:\"Font\",defaultValue:{fontSize:\"60px\",variant:\"Bold\",letterSpacing:\"-0.02em\",lineHeight:\"1em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#FFFFFF\"},duplicateCount:{type:ControlType.Number,title:\"Duplicate Count\",defaultValue:8,min:3,max:20,step:1},rollDuration:{type:ControlType.Number,title:\"Roll Duration\",defaultValue:2,min:.5,max:5,step:.1,unit:\"s\"},staggerDelay:{type:ControlType.Number,title:\"Stagger Delay\",defaultValue:.1,min:0,max:.5,step:.01,unit:\"s\"},blurIntensity:{type:ControlType.Number,title:\"Blur Intensity\",defaultValue:8,min:0,max:20,step:1,unit:\"px\"},showBackground:{type:ControlType.Boolean,title:\"Show Background\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#000000\",hidden:({showBackground})=>!showBackground}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"AdvanceCounter\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerIntrinsicWidth\":\"400\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"auto\",\"framerIntrinsicHeight\":\"120\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./AdvanceCounter.map"],"mappings":"6QAUG,SAAwB,EAAe,EAAM,CAAC,GAAK,CAAC,eAAa,MAAM,SAAO,GAAG,SAAO,GAAG,iBAAe,EAAE,eAAa,EAAE,eAAa,GAAG,gBAAc,EAAE,iBAAe,GAAM,WAAS,GAAK,iBAAe,GAAK,kBAAgB,UAAU,YAAU,UAAU,OAAK,aAAW,aAAW,cAAY,UAAU,cAAY,UAAU,mBAAiB,aAAa,MAAI,IAAI,WAAS,GAAG,mBAAiB,EAAE,eAAa,gBAAc,WAAW,EAAW,CAAC,EAAY,GAAgBA,EA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