{"version":3,"file":"ParticleSystem.otDjut8Q.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/6Gespj0wiqSvTtWn608u/KeR3kuXcfXoxAEOnqAWg/ParticleSystem.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useState}from\"react\";import{addPropertyControls,ControlType}from\"framer\";// RGB to Hex conversion\nfunction rgbToHex(rgb){if(rgb.startsWith(\"#\"))return rgb;const match=rgb.match(/rgb\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)/);if(!match)return rgb;const[,r,g,b]=match;return\"#\"+[r,g,b].map(x=>{const hex=parseInt(x).toString(16);return hex.length===1?\"0\"+hex:hex;}).join(\"\");}function isModernGPU(vendor,renderer){const v=vendor.toLowerCase();const r=renderer.toLowerCase();// NVIDIA: RTX 2000+\nif(v.includes(\"nvidia\")){return/rtx [2-9]/.test(r)||/rtx [3-9][0-9]{2}/.test(r);}// AMD: RX 5000+\nif(v.includes(\"amd\")||r.includes(\"radeon\")){return/rx [5-9][0-9]{2,3}/.test(r)||/radeon (pro )?w[5-9]/.test(r);}// Intel Arc: A500+ / Pro\nif(v.includes(\"intel\")){return/arc a[5-9]/.test(r)||/arc pro/.test(r);}// Apple Silicon: M1+ (detailed string or Safari fallback \"Apple GPU\")\nif(v.includes(\"apple\")||r.includes(\"apple\")){// Safari hides details, just says \"Apple GPU\"\nif(r.includes(\"apple gpu\")){return true// Safari fallback → Apple Silicon\n;}// Detailed model (M1, M2, M3, M4…)\nreturn/m[1-9]/.test(r);}return false// unknown or older\n;}const hasGoodWebGL=()=>{const canvas=document.createElement(\"canvas\");const gl=canvas.getContext(\"webgl2\");if(!gl)return false;// Try detailed GPU info\nconst debugInfo=gl.getExtension(\"WEBGL_debug_renderer_info\");if(debugInfo){const renderer=gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL)||\"\";const vendor=gl.getParameter(debugInfo.UNMASKED_VENDOR_WEBGL)||\"\";// console.log(\"GPU renderer:\", renderer, \"| vendor:\", vendor)\nreturn isModernGPU(vendor,renderer);}let textureSize=gl.getParameter(gl.MAX_TEXTURE_SIZE);// console.log(\"textureSize\", textureSize)\nreturn textureSize>=16384;};export default function ParticleFrame(props){const{gradientColor1,gradientColor2,gradientColor3,gradientColor4,...restProps}=props;const[ParticleSystem,setParticleSystem]=useState(null);const[isVisible,setIsVisible]=useState(false);const[hideAnimation,setHideAnimation]=useState(false);const[prefersReducedMotion,setPrefersReducedMotion]=useState(false);const[showFallback,setShowFallback]=useState(false);const[isFallbackVisible,setIsFallbackVisible]=useState(false);// Detect environment flags once client-side\nuseEffect(()=>{if(typeof navigator!==\"undefined\"&&typeof window!==\"undefined\"){const isMobile=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);let shouldHide=false;if(isMobile){const isAndroid=/Android/i.test(navigator.userAgent);if(isAndroid){shouldHide=true;}else{//iOS - assume powerful enough\n}}else{shouldHide=!hasGoodWebGL();}//check at the end for reduce motion\nconst reduceMotion=window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;// console.log(\"Should hide\", shouldHide)\nsetHideAnimation(shouldHide||reduceMotion);}},[]);// Lazy-load particle system if not Android\nuseEffect(()=>{if(!hideAnimation){// After 0.5s, show fallback if still loading\nlet timeoutId=setTimeout(()=>{if(!ParticleSystem){setShowFallback(true);// trigger fade-in on next frame\nrequestAnimationFrame(()=>setIsFallbackVisible(true));}},1e3);import(\"https://cdn.jsdelivr.net/gh/j-gj/particle-system-bundle@v1.0.19/dist/particle-system.js\").then(mod=>{clearTimeout(timeoutId);setShowFallback(false)// no need for fallback anymore\n;setParticleSystem(()=>mod.default||mod);});return()=>clearTimeout(timeoutId);}},[hideAnimation]);// Trigger fade-in after one paint with opacity 0\nuseEffect(()=>{if(ParticleSystem){const id=requestAnimationFrame(()=>setIsVisible(true));return()=>cancelAnimationFrame(id);}},[ParticleSystem]);const particleSystemProps={...restProps,gradientColors:[rgbToHex(gradientColor1||\"#de11fc\"),rgbToHex(gradientColor2||\"#637AFF\"),rgbToHex(gradientColor3||\"#372CD5\"),rgbToHex(gradientColor4||\"#F0F4FF\")],backgroundColor:rgbToHex(props.backgroundColor||\"#637aff\")};// const [ParticleSystem, setParticleSystem] = useState(null)\n// const [isReady, setIsReady] = useState(false)\n// const [hideAnimation, setHideAnimation] = useState(false)\n// const [prefersReducedMotion, setPrefersReducedMotion] = useState(false)\n// useEffect(() => {\n//     // Detect Android\n//     const android = /android/i.test(navigator.userAgent)\n//     //const android = true //test\n//     setHideAnimation(android)\n//     if (android) return\n//     // Detect prefers-reduced-motion once at mount\n//     const mediaQuery = window.matchMedia(\"(prefers-reduced-motion: reduce)\")\n//     setPrefersReducedMotion(mediaQuery.matches)\n//     // Import particle system lazily\n//     import(\n//         \"https://cdn.jsdelivr.net/gh/j-gj/particle-system-bundle@v1.0.19/dist/particle-system.js\"\n//     ).then((mod) => {\n//         setParticleSystem(() => mod.default || mod)\n//         // setIsReady(true)\n//         requestAnimationFrame(() => setIsReady(true))\n//     })\n// }, [])\n// // Apply reduced motion\n// const particleSystemProps = {\n//     ...restProps,\n//     speedFactor: prefersReducedMotion ? 0 : restProps.speedFactor,\n//     gradientColors: [\n//         rgbToHex(gradientColor1 || \"#de11fc\"),\n//         rgbToHex(gradientColor2 || \"#637AFF\"),\n//         rgbToHex(gradientColor3 || \"#372CD5\"),\n//         rgbToHex(gradientColor4 || \"#F0F4FF\"),\n//     ],\n//     backgroundColor: rgbToHex(props.backgroundColor || \"#637aff\"),\n// }\nconst src=props.imageBackup?.src??\"\";// console.log(\"image src\", src)\n// === Case 1: Android → static image only ===\nif(hideAnimation){return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\",backgroundColor:particleSystemProps.backgroundColor},children:/*#__PURE__*/_jsx(\"img\",{src:src,alt:\"Particle fallback\",style:{width:\"100%\",height:\"100%\",objectFit:\"cover\",display:\"block\"}})});}//  <img\n//                 src={src}\n//                 alt=\"Particle fallback\"\n//                 style={{\n//                     width: \"100%\",\n//                     height: \"100%\",\n//                     objectFit: \"cover\",\n//                     position: \"absolute\",\n//                     top: 0,\n//                     left: 0,\n//                 }}\n//             />\n// === Case 2: Non-Android → fallback first, then particles ===\nreturn /*#__PURE__*/_jsxs(\"div\",{style:{width:\"100%\",height:\"100%\",position:\"relative\",overflow:\"hidden\"},children:[showFallback&&!ParticleSystem&&/*#__PURE__*/_jsx(\"img\",{src:src,alt:\"Particle fallback\",style:{width:\"100%\",height:\"100%\",opacity:isFallbackVisible?1:0,transition:\"opacity 0.5s ease-in\",objectFit:\"cover\",position:\"absolute\",top:0,left:0}}),ParticleSystem&&/*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\",opacity:isVisible?1:0,transition:\"opacity 0.7s ease-in 0.2s\",position:\"absolute\",top:0,left:0},children:/*#__PURE__*/_jsx(ParticleSystem,{...particleSystemProps})})]});}// const ParticleSystem = React.lazy(\n//     () =>\n//         import(\n//             \"https://cdn.jsdelivr.net/gh/j-gj/particle-system-bundle@v1.0.19/dist/particle-system.js\"\n//         )\n// )\n// import ParticleSystem from \"https://cdn.jsdelivr.net/gh/j-gj/particle-system-bundle@v1.0.19/dist/particle-system.js\"\n// export default function ParticleFrame(props) {\n//     // Destructure the gradient color props to exclude from DOM\n//     const {\n//         gradientColor1,\n//         gradientColor2,\n//         gradientColor3,\n//         gradientColor4,\n//         ...restProps // Everything else passes through\n//     } = props\n//     // Transform colors to array and convert RGB to hex\n//     const particleSystemProps = {\n//         ...restProps,\n//         gradientColors: [\n//             rgbToHex(gradientColor1 || \"#de11fc\"),\n//             rgbToHex(gradientColor2 || \"#637AFF\"),\n//             rgbToHex(gradientColor3 || \"#372CD5\"),\n//             rgbToHex(gradientColor4 || \"#F0F4FF\"),\n//         ],\n//         backgroundColor: rgbToHex(props.backgroundColor || \"#637aff\"),\n//     }\n//     return (\n//         <div\n//             style={{\n//                 width: \"100%\",\n//                 height: \"100%\",\n//                 display: \"block\",\n//             }}\n//         >\n//             <ParticleSystem {...particleSystemProps} />\n//         </div>\n//     )\n// }\n// <React.Suspense fallback={<div>Loading…</div>}>\n//                 <ParticleSystem {...particleSystemProps} />\n//             </React.Suspense>\naddPropertyControls(ParticleFrame,{imageBackup:{type:ControlType.ResponsiveImage,title:\"Image Backup\"},backgroundColor:{type:ControlType.Color,defaultValue:\"#F0F4FF\"},frequency:{type:ControlType.Number,title:\"Density\",defaultValue:.15,min:0,max:1,step:.01,displayStepper:true},speedFactor:{type:ControlType.Number,title:\"Speed\",defaultValue:4,min:.1,max:20,step:.1,displayStepper:true},rotationSpeed:{type:ControlType.Number,title:\"Rotation Speed\",defaultValue:.3,min:0,max:3,step:.05,displayStepper:true},autoRotate:{type:ControlType.Boolean,title:\"Auto Rotate\",defaultValue:true},enableVerticalRotation:{type:ControlType.Boolean,title:\"Vertical Rotation\",defaultValue:true},// === VISUAL EFFECTS ===\nblur:{type:ControlType.Number,title:\"Blur\",defaultValue:24,min:0,max:50,step:.5,displayStepper:true},focus:{type:ControlType.Number,title:\"Focus\",defaultValue:8.7,min:3,max:15,step:.1,displayStepper:true},cameraZ:{type:ControlType.Number,title:\"CameraZ\",defaultValue:7.6,min:3,max:15,step:.1,displayStepper:true},particles:{type:ControlType.Number,title:\"Particle Count\",defaultValue:256,min:32,max:512,step:32,displayStepper:true},gradientColor1:{type:ControlType.Color,title:\"Color 1\",defaultValue:\"#de11fc\"},gradientColor2:{type:ControlType.Color,title:\"Color 2\",defaultValue:\"#637AFF\"},gradientColor3:{type:ControlType.Color,title:\"Color 3\",defaultValue:\"#372CD5\"},gradientColor4:{type:ControlType.Color,title:\"Color 4\",defaultValue:\"#F0F4FF\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ParticleFrame\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ParticleSystem.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