{"version":3,"file":"LCPSectionPriority.DfrsNQB4.mjs","names":["React.useRef"],"sources":["https:/framerusercontent.com/modules/WDwvYYE85tJWMTdvtedt/wVp72XZpnVyBIFjGbFRb/LCPSectionPriority.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";function setImagePriority(img){img.loading=\"eager\";img.fetchPriority=\"high\";img.decoding=\"sync\";img.setAttribute(\"loading\",\"eager\");img.setAttribute(\"fetchpriority\",\"high\");img.setAttribute(\"decoding\",\"sync\");}function getLargestImage(root){const images=Array.from(root.querySelectorAll(\"img\"));if(!images.length)return null;return images.reduce((largest,img)=>{const currentArea=img.getBoundingClientRect().width*img.getBoundingClientRect().height;const largestArea=largest.getBoundingClientRect().width*largest.getBoundingClientRect().height;return currentArea>largestArea?img:largest;});}function assignRef(ref,value){if(typeof ref===\"function\"){ref(value);}else if(ref){ref.current=value;}}/**\n * Apply this to the Hero Section / Container.\n * It prioritises only the largest image inside.\n */export function withHeroImagePriority(Component){const Wrapped=/*#__PURE__*/React.forwardRef((props,ref)=>{const localRef=React.useRef(null);React.useEffect(()=>{const root=localRef.current;if(!root)return;const apply=()=>{requestAnimationFrame(()=>{const img=getLargestImage(root);if(img)setImagePriority(img);});};apply();const observer=new MutationObserver(apply);observer.observe(root,{childList:true,subtree:true,attributes:true,attributeFilter:[\"src\",\"srcset\",\"sizes\"]});return()=>observer.disconnect();},[]);return /*#__PURE__*/_jsx(Component,{...props,ref:node=>{localRef.current=node;assignRef(ref,node);}});});Wrapped.displayName=\"withHeroImagePriority\";return Wrapped;}/**\n * More aggressive.\n * Prioritises every real <img> inside the section.\n */export function withAllImagesPriorityInside(Component){const Wrapped=/*#__PURE__*/React.forwardRef((props,ref)=>{const localRef=React.useRef(null);React.useEffect(()=>{const root=localRef.current;if(!root)return;const apply=()=>{requestAnimationFrame(()=>{root.querySelectorAll(\"img\").forEach(img=>{setImagePriority(img);});});};apply();const observer=new MutationObserver(apply);observer.observe(root,{childList:true,subtree:true,attributes:true,attributeFilter:[\"src\",\"srcset\",\"sizes\"]});return()=>observer.disconnect();},[]);return /*#__PURE__*/_jsx(Component,{...props,ref:node=>{localRef.current=node;assignRef(ref,node);}});});Wrapped.displayName=\"withAllImagesPriorityInside\";return Wrapped;}\nexport const __FramerMetadata__ = {\"exports\":{\"withHeroImagePriority\":{\"type\":\"reactHoc\",\"name\":\"withHeroImagePriority\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withAllImagesPriorityInside\":{\"type\":\"reactHoc\",\"name\":\"withAllImagesPriorityInside\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./LCPSectionPriority.map"],"mappings":"2HAAuE,SAAS,EAAiB,EAAI,CAAC,EAAI,QAAQ,QAAQ,EAAI,cAAc,OAAO,EAAI,SAAS,OAAO,EAAI,aAAa,UAAU,OAAO,EAAE,EAAI,aAAa,gBAAgB,MAAM,EAAE,EAAI,aAAa,WAAW,MAAM,CAAE,CAA8X,SAAS,EAAU,EAAI,EAAM,CAAI,OAAO,GAAM,WAAY,EAAI,CAAK,EAAW,IAAK,EAAI,QAAQ,EAAO,CAMzvB,SAAgB,EAA4B,EAAU,CAAC,IAAM,EAAqB,GAAkB,EAAM,IAAM,CAAC,IAAM,EAASA,EAAa,IAAI,EAA+X,OAA7X,MAAoB,CAAC,IAAM,EAAK,EAAS,QAAQ,GAAG,CAAC,EAAK,OAAO,IAAM,MAAU,CAAC,0BAA0B,CAAC,EAAK,iBAAiB,KAAK,CAAC,CAAC,QAAQ,GAAK,CAAC,EAAiB,CAAG,CAAE,CAAC,CAAE,CAAC,CAAE,EAAE,EAAM,EAAE,IAAM,EAAS,IAAI,iBAAiB,CAAK,EAAgH,OAA9G,EAAS,QAAQ,EAAK,CAAC,UAAU,GAAK,QAAQ,GAAK,WAAW,GAAK,gBAAgB,CAAC,MAAM,SAAS,OAAO,CAAC,CAAC,MAAY,EAAS,WAAW,CAAE,EAAE,CAAC,CAAC,EAAsB,EAAK,EAAU,CAAC,GAAG,EAAM,IAAI,GAAM,CAAC,EAAS,QAAQ,EAAK,EAAU,EAAI,CAAI,CAAE,CAAC,CAAC,CAAE,CAAC,EAAoD,MAAlD,GAAQ,YAAY,8BAAqC,CAAQ,iBANnpB,IAA4B"}