{"version":3,"file":"ScrollProgress.Num1ukG_.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/57StV1MQ4xnxFySEVbuw/KJLhbkF4OtdyDfMJ73ZN/ScrollProgress.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useScroll,motion}from\"framer\";import{addPropertyControls,ControlType}from\"framer\";import{useEffect,useState}from\"react\";/**\n *\n * @framerDisableUnlink\n *\n */export function ScrollProgressBar(props){const{thickness,useGradient,gradientColors=[\"#894AFF\",\"#00ff00\"],multiColorMode,multiColors=[\"#894AFF\",\"#00ff00\",\"#0000ff\",\"#64C57D\",\"#FFC229\"],solidColor=\"#aefa1d\"}=props;// Hook to track scroll progress\nconst{scrollYProgress}=useScroll();// State for current scroll progress\nconst[progress,setProgress]=useState(0);useEffect(()=>{const unsubscribe=scrollYProgress.onChange(latest=>{setProgress(latest*100)// Convert progress to percentage\n;});return()=>unsubscribe();},[scrollYProgress]);let backgroundStyle;if(multiColorMode){// Multi-color segmented logic\nconst numColors=multiColors.filter(Boolean).length// Ensure only valid colors are counted\n;const segmentSize=100/numColors// Percentage range per color\n;const background=multiColors.filter(Boolean).map((color,index)=>{const segmentStart=index*segmentSize;const segmentEnd=(index+1)*segmentSize;// If progress is beyond this segment, the color is fully revealed\nif(progress>=segmentEnd){return`${color} ${segmentStart}%, ${color} ${segmentEnd}%`;}// If progress is within this segment, progressively reveal the color\nif(progress>segmentStart){return`${color} ${segmentStart}%, ${color} ${progress}%, transparent ${progress}%, transparent ${segmentEnd}%`;}// For segments beyond the current progress, keep them transparent\nreturn`transparent ${segmentStart}%, transparent ${segmentEnd}%`;}).join(\", \");backgroundStyle={background:`linear-gradient(to right, ${background})`};}else if(useGradient){// Gradient background\nbackgroundStyle={background:`linear-gradient(to right, ${gradientColors.filter(Boolean).join(\", \")})`};}else{// Default solid color\nbackgroundStyle={background:solidColor};}return /*#__PURE__*/_jsx(motion.div,{style:{position:\"fixed\",top:0,left:0,height:thickness,width:\"100%\",transformOrigin:\"0% 0%\",scaleX:scrollYProgress,zIndex:9999,...backgroundStyle}});}// Property controls for customization\naddPropertyControls(ScrollProgressBar,{thickness:{type:ControlType.Number,title:\"Thickness\",min:1,max:100,defaultValue:4},useGradient:{type:ControlType.Boolean,title:\"Use Gradient\",defaultValue:false,hidden:props=>props.multiColorMode},gradientColors:{type:ControlType.Array,title:\"Gradient Colors\",propertyControl:{type:ControlType.Color},defaultValue:[\"#894AFF\",\"#FF9900\"],hidden:props=>!props.useGradient||props.multiColorMode},multiColorMode:{type:ControlType.Boolean,title:\"Multi-Color Mode\",defaultValue:false,hidden:props=>props.useGradient},multiColors:{type:ControlType.Array,title:\"Multi Colors\",propertyControl:{type:ControlType.Color},defaultValue:[\"#894AFF\",\"#FF9900\",\"#0000ff\",\"#64C57D\",\"#FFC229\"],hidden:props=>!props.multiColorMode||props.useGradient},solidColor:{type:ControlType.Color,title:\"Solid Color\",defaultValue:\"#aefa1d\",hidden:props=>props.useGradient||props.multiColorMode}});\nexport const __FramerMetadata__ = {\"exports\":{\"ScrollProgressBar\":{\"type\":\"reactComponent\",\"name\":\"ScrollProgressBar\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerDisableUnlink\":\"*\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ScrollProgress.map"],"mappings":"oOAIG,SAAgB,EAAkB,EAAM,CAAC,GAAK,CAAC,YAAU,cAAY,iBAAe,CAAC,UAAU,SAAS,EAAE,iBAAe,cAAY,CAAC,UAAU,UAAU,UAAU,UAAU,SAAS,EAAE,aAAW,WAAW,EAC7M,CAAC,mBAAiB,EAAU,EAC5B,CAAC,EAAS,GAAaA,EAAS,CAAC,EAAE,MAAc,CAAC,IAAM,EAAY,EAAgB,SAAS,GAAQ,CAAC,EAAY,EAAO,GAAG,CAChI,CAAC,EAAE,UAAU,EAAY,CAAE,EAAE,CAAC,CAAe,CAAC,EAAE,IAAI,EAAgB,GAAG,EAAe,CAEtF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