{"version":3,"file":"LottiePlayer.AcxC7CK7.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/6QKcDaEyTJp47XSHNQ77/3RZokLvrWemf6VCiktcA/LottiePlayer.js"],"sourcesContent":["// Lottie player component with play on appear option\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef,useState,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n\n * Lottie Player with Play on Appear\n\n *\n\n * @framerIntrinsicWidth 200\n\n * @framerIntrinsicHeight 200\n\n *\n\n * @framerSupportedLayoutWidth any-prefer-fixed\n\n * @framerSupportedLayoutHeight any-prefer-fixed\n\n */export default function LottiePlayer(props){const{sourceType=\"url\",src=\"https://lottie.host/4db68bbd-31f6-4cd8-84eb-189de081159a/IGmMCqhzpt.json\",file=\"\",loop=true,autoplay=true,playOnAppear=false,delay=0,speed=1,direction=1}=props;const containerRef=useRef(null);const animationRef=useRef(null);const[isVisible,setIsVisible]=useState(false);const hasPlayedRef=useRef(false);const[lottieLoaded,setLottieLoaded]=useState(false);const loadAttemptRef=useRef(0);const[shouldLoad,setShouldLoad]=useState(false);// Detect reduced motion preference\nconst prefersReducedMotionRef=useRef(false);useEffect(()=>{if(typeof window===\"undefined\")return;const mediaQuery=window.matchMedia(\"(prefers-reduced-motion: reduce)\");prefersReducedMotionRef.current=mediaQuery.matches;const handleChange=e=>{prefersReducedMotionRef.current=e.matches;};mediaQuery.addEventListener(\"change\",handleChange);return()=>mediaQuery.removeEventListener(\"change\",handleChange);},[]);// Load lottie-web dynamically via script tag\nuseEffect(()=>{if(typeof window===\"undefined\")return;if(!shouldLoad)return;// Check if lottie is already loaded\nif(window.lottie){setLottieLoaded(true);return;}// Prevent multiple script injections\nconst existingScript=document.querySelector('script[src*=\"lottie\"]');if(existingScript){// Wait for existing script to load\nconst checkInterval=setInterval(()=>{if(window.lottie){clearInterval(checkInterval);setLottieLoaded(true);}},100);return()=>clearInterval(checkInterval);}const script=document.createElement(\"script\");script.src=\"https://cdnjs.cloudflare.com/ajax/libs/lottie-web/5.12.2/lottie.min.js\";script.async=true;script.onload=()=>{if(window.lottie){setLottieLoaded(true);}};script.onerror=()=>{console.error(\"Failed to load lottie-web\");};document.head.appendChild(script);return()=>{if(script.parentNode){script.parentNode.removeChild(script);}};},[shouldLoad]);useEffect(()=>{if(!containerRef.current||typeof window===\"undefined\"||!lottieLoaded||!window.lottie)return;if(!shouldLoad)return;// Cleanup previous animation\nif(animationRef.current){animationRef.current.destroy();animationRef.current=null;}const animationSource=sourceType===\"file\"?file:src;// Ensure we have a valid source\nif(!animationSource)return;try{// Clear container before loading new animation\nif(containerRef.current){containerRef.current.innerHTML=\"\";}animationRef.current=window.lottie.loadAnimation({container:containerRef.current,renderer:\"svg\",loop,autoplay:playOnAppear?false:autoplay,path:animationSource,rendererSettings:{preserveAspectRatio:\"xMidYMid meet\",clearCanvas:true,progressiveLoad:true,hideOnTransparent:true}});animationRef.current.setSpeed(speed);animationRef.current.setDirection(direction);// Handle reduced motion: go to last frame and stop\nif(prefersReducedMotionRef.current&&animationRef.current){animationRef.current.addEventListener(\"DOMLoaded\",()=>{if(animationRef.current){const totalFrames=animationRef.current.totalFrames;animationRef.current.goToAndStop(totalFrames-1,true);}});}// If playOnAppear is false and autoplay is true, ensure it plays\nif(!playOnAppear&&autoplay&&!prefersReducedMotionRef.current){animationRef.current.play();}// Reset hasPlayed when animation changes\nhasPlayedRef.current=false;}catch(error){console.error(\"Failed to load Lottie animation:\",error);}return()=>{if(animationRef.current){animationRef.current.destroy();animationRef.current=null;}};},[src,file,sourceType,loop,autoplay,playOnAppear,speed,direction,lottieLoaded,shouldLoad]);// Lazy-load: Observe when component is near viewport\nuseEffect(()=>{if(!containerRef.current||typeof window===\"undefined\")return;const observer=new IntersectionObserver(entries=>{entries.forEach(entry=>{if(entry.isIntersecting){startTransition(()=>setShouldLoad(true));observer.disconnect();}});},{rootMargin:\"50px\"});observer.observe(containerRef.current);return()=>{observer.disconnect();};},[]);useEffect(()=>{if(!playOnAppear||!containerRef.current||typeof window===\"undefined\")return;if(!shouldLoad)return;const observer=new IntersectionObserver(entries=>{entries.forEach(entry=>{if(entry.isIntersecting&&!hasPlayedRef.current&&animationRef.current){hasPlayedRef.current=true;setTimeout(()=>{if(animationRef.current&&!prefersReducedMotionRef.current){animationRef.current.goToAndPlay(0,true);}},delay*1e3);}});},{threshold:.1});observer.observe(containerRef.current);return()=>{observer.disconnect();};},[playOnAppear,delay,shouldLoad]);return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{width:\"100%\",height:\"100%\",minWidth:5,minHeight:5,position:\"relative\",...props.style}});}addPropertyControls(LottiePlayer,{sourceType:{type:ControlType.Enum,title:\"Source Type\",options:[\"url\",\"file\"],optionTitles:[\"URL\",\"File\"],defaultValue:\"url\",displaySegmentedControl:true},src:{type:ControlType.String,title:\"Source URL\",defaultValue:\"https://lottie.host/4db68bbd-31f6-4cd8-84eb-189de081159a/IGmMCqhzpt.json\",placeholder:\"Lottie JSON URL...\",hidden:({sourceType})=>sourceType===\"file\"},file:{type:ControlType.File,title:\"Lottie File\",allowedFileTypes:[\"json\"],hidden:({sourceType})=>sourceType===\"url\"},playOnAppear:{type:ControlType.Boolean,title:\"Play on Appear\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"},delay:{type:ControlType.Number,title:\"Delay\",defaultValue:0,min:0,max:10,step:.1,unit:\"s\",hidden:({playOnAppear})=>!playOnAppear},autoplay:{type:ControlType.Boolean,title:\"Autoplay\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\",hidden:({playOnAppear})=>playOnAppear},loop:{type:ControlType.Boolean,title:\"Loop\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},speed:{type:ControlType.Number,title:\"Speed\",defaultValue:1,min:.1,max:3,step:.1},direction:{type:ControlType.Enum,title:\"Direction\",options:[1,-1],optionTitles:[\"Forward\",\"Reverse\"],defaultValue:1,displaySegmentedControl:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"LottiePlayer\",\"slots\":[],\"annotations\":{\"framerIntrinsicWidth\":\"200\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerIntrinsicHeight\":\"200\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./LottiePlayer.map"],"mappings":"iUAiBG,SAAwB,EAAa,EAAM,CAAC,GAAK,CAAC,aAAW,MAAM,MAAI,2EAA2E,OAAK,GAAG,OAAK,GAAK,WAAS,GAAK,eAAa,GAAM,QAAM,EAAE,QAAM,EAAE,YAAU,GAAG,EAAY,EAAaA,EAAO,KAAK,CAAO,EAAaA,EAAO,KAAK,CAAM,CAAC,EAAU,GAAcC,EAAS,GAAM,CAAO,EAAaD,EAAO,GAAM,CAAM,CAAC,EAAa,GAAiBC,EAAS,GAAM,CAAsB,EAAO,EAAE,CAAC,GAAK,CAAC,EAAW,GAAeA,EAAS,GAAM,CACtf,EAAwBD,EAAO,GAAM,CAW80B,OAX70B,MAAc,CAAC,GAAU,IAAS,OAAY,OAAO,IAAM,EAAW,EAAO,WAAW,mCAAmC,CAAC,EAAwB,QAAQ,EAAW,QAAQ,IAAM,EAAa,GAAG,CAAC,EAAwB,QAAQ,EAAE,SAA6D,OAAnD,EAAW,iBAAiB,SAAS,EAAa,KAAW,EAAW,oBAAoB,SAAS,EAAa,EAAG,EAAE,CAAC,CACtZ,MAAc,CAAuC,GAA5B,IAAS,QAAsB,CAAC,EAAW,OACpE,GAAG,EAAO,OAAO,CAAC,EAAgB,GAAK,CAAC,OAC6B,GAAhD,SAAS,cAAc,wBAAwB,CAAmB,CACvF,IAAM,EAAc,gBAAgB,CAAI,EAAO,SAAQ,cAAc,EAAc,CAAC,EAAgB,GAAK,GAAI,IAAI,CAAC,UAAU,cAAc,EAAc,CAAE,IAAM,EAAO,SAAS,cAAc,SAA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