{"version":3,"file":"ProgressLine.DEV4weJm.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/k3jTjSFje3zRgl14vdo5/SN62pkU0oEslnazHwFQM/ProgressLine.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef,useState}from\"react\";import{motion}from\"framer-motion\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerIntrinsicWidth 300\n * @framerIntrinsicHeight 1\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n *\n * @framerDisableUnlink\n **/export function ProgressLine({direction=\"horizontal\",delay=0,lineColor=\"#000000\",triggerOnVisibility=true,replay=false,transition}){const[animate,setAnimate]=useState(\"start\");const[hasAnimated,setHasAnimated]=useState(false);const ref=useRef(null);const handleVisibility=entries=>{const[entry]=entries;if(entry.isIntersecting){if(!triggerOnVisibility||replay||!hasAnimated){setTimeout(()=>setAnimate(\"end\"),delay*1e3);setHasAnimated(true);}}else if(replay&&triggerOnVisibility){setAnimate(\"start\");}};useEffect(()=>{const observer=new IntersectionObserver(handleVisibility,{threshold:.1});if(ref.current)observer.observe(ref.current);return()=>observer.disconnect();},[triggerOnVisibility,replay,delay]);useEffect(()=>{if(!triggerOnVisibility){setTimeout(()=>setAnimate(\"end\"),delay*1e3);}},[triggerOnVisibility,delay]);const resolvedTransition={...transition,delay};const variants={start:{width:direction===\"horizontal\"?\"0%\":\"100%\",height:direction===\"vertical\"?\"0%\":\"100%\",transition:resolvedTransition},end:{width:\"100%\",height:\"100%\",transition:resolvedTransition}};return /*#__PURE__*/_jsx(motion.div,{ref:ref,style:{position:\"relative\",width:\"100%\",height:\"100%\",overflow:\"hidden\"},children:/*#__PURE__*/_jsx(motion.div,{variants:variants,initial:\"start\",animate:animate,style:{position:\"absolute\",top:0,left:0,backgroundColor:lineColor,width:direction===\"horizontal\"?\"0%\":\"100%\",height:direction===\"vertical\"?\"0%\":\"100%\"}})});}addPropertyControls(ProgressLine,{direction:{type:ControlType.SegmentedEnum,title:\"Direction\",options:[\"horizontal\",\"vertical\"],defaultValue:\"horizontal\"},delay:{type:ControlType.Number,title:\"Delay (s)\",min:0,step:.1,defaultValue:0,displayStepper:true},lineColor:{type:ControlType.Color,title:\"Line Color\",defaultValue:\"#000000\"},triggerOnVisibility:{type:ControlType.Boolean,title:\"Trigger on Visibility\",defaultValue:false},replay:{type:ControlType.Boolean,title:\"Replay Animation\",defaultValue:true},transition:{type:ControlType.Transition,title:\"Transition\",defaultValue:{duration:1,ease:\"easeOut\"},description:\"\\n Made by [*Anagram*](https://anagram.supply/)\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"ProgressLine\":{\"type\":\"reactComponent\",\"name\":\"ProgressLine\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerIntrinsicWidth\":\"300\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerIntrinsicHeight\":\"1\",\"framerContractVersion\":\"1\",\"framerDisableUnlink\":\"\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ProgressLine.map"],"mappings":"oOAQI,SAAgB,EAAa,CAAC,YAAU,aAAa,QAAM,EAAE,YAAU,UAAU,sBAAoB,GAAK,SAAO,GAAM,cAAY,CAAC,GAAK,CAAC,EAAQ,GAAYA,EAAS,OAAO,EAAO,CAAC,EAAY,GAAgBA,EAAS,EAAK,EAAQ,EAAIC,EAAO,IAAI,EAAQ,EAAiB,GAAS,CAAC,GAAK,CAAC,GAAO,EAAW,EAAM,gBAAmB,CAAC,GAAqB,GAAQ,CAAC,KAAa,eAAe,EAAW,KAAK,EAAE,EAAM,GAAG,EAAE,EAAe,EAAI,GAAY,GAAQ,GAAqB,EAAW,OAAO,CAAG,EAAE,MAAc,CAAC,IAAM,EAAS,IAAI,qBAAqB,EAAiB,CAAC,UAAU,EAAE,CAAC,EAA+C,OAA1C,EAAI,SAAQ,EAAS,QAAQ,EAA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