{"version":3,"file":"BRNDeferredImage.DuheQwkV.mjs","names":["useRef","useState","__esmMin","init_npm_react_18_3_1","_e","p","c","init_jsx_runtime","ce","de","addPropertyControls","init_framer_BWFVvmND","ControlType","BRNDeferredImage","asset","image","host","near","setNear","element","observer","entries","entry","crop","position","params","width","height","shouldLoad","priority","style","sizeHint","altText","natural","init_BRNDeferredImage"],"sources":["https:/framerusercontent.com/modules/Io9Ie5ltKQh78j8QF0cF/y6Chs2O4MtOYFfE8sx5w/BRNDeferredImage.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useEffect,useRef,useState}from\"react\";/**\n * Preserves the original photograph, responsive asset variants and crop.\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function BRNDeferredImage({image,priority=false,natural=false,position=\"center center\",sizeHint=\"100vw\",altText,style}){const asset=typeof image===\"string\"?{src:image}:image;const host=useRef(null);const[near,setNear]=useState(false);useEffect(()=>{const element=host.current;if(!element)return;if(typeof IntersectionObserver===\"undefined\"){setNear(true);return;}const observer=new IntersectionObserver(entries=>{if(entries.some(entry=>entry.isIntersecting)){setNear(true);observer.disconnect();}},{rootMargin:\"1200px 0px\"});observer.observe(element);return()=>observer.disconnect();},[]);if(!asset?.src)return null;const crop=position===\"center center\"&&(asset.positionX||asset.positionY)?`${asset.positionX||\"50%\"} ${asset.positionY||\"50%\"}`:position;const params=new URL(asset.src,\"https://framerusercontent.com\").searchParams;const width=Number(params.get(\"width\"))||undefined;const height=Number(params.get(\"height\"))||undefined;const shouldLoad=priority||near;return /*#__PURE__*/_jsxs(\"div\",{ref:host,style:{width:\"100%\",height:\"100%\",...style,overflow:\"hidden\"},children:[/*#__PURE__*/_jsx(\"img\",{src:shouldLoad?asset.src:undefined,srcSet:shouldLoad?asset.srcSet||undefined:undefined,sizes:sizeHint,width:width,height:height,alt:altText||asset.alt||\"\",loading:priority?\"eager\":\"lazy\",fetchPriority:priority?\"high\":\"low\",decoding:\"async\",style:{display:\"block\",width:\"100%\",objectFit:\"cover\",borderRadius:\"inherit\",height:natural?\"auto\":\"100%\",opacity:shouldLoad?1:0,objectPosition:crop,pointerEvents:\"none\"}}),/*#__PURE__*/_jsx(\"noscript\",{children:/*#__PURE__*/_jsx(\"img\",{src:asset.src,srcSet:asset.srcSet,sizes:sizeHint,width:width,height:height,alt:altText||asset.alt||\"\",loading:\"lazy\",style:{display:\"block\",width:\"100%\",height:\"100%\",objectFit:\"cover\",objectPosition:crop}})})]});}addPropertyControls(BRNDeferredImage,{image:{type:ControlType.ResponsiveImage,title:\"Image\"},priority:{type:ControlType.Boolean,title:\"Load First\",defaultValue:false},natural:{type:ControlType.Boolean,title:\"Natural Height\",defaultValue:false},position:{type:ControlType.String,title:\"Crop\",defaultValue:\"center center\"},sizeHint:{type:ControlType.String,title:\"Display Width\",defaultValue:\"100vw\"},altText:{type:ControlType.String,title:\"Alt Text\",defaultValue:\"\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"BRNDeferredImage\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any\",\"framerSupportedLayoutHeight\":\"any\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./BRNDeferredImage.map"],"mappings":"A,+LAIG,SAAwBa,EAAiB,CAAC,QAAM,WAAS,GAAM,UAAQ,GAAM,WAAS,gBAAgB,WAAS,QAAQ,UAAQ,SAAO,CAAC,IAAMC,EAAM,OAAOC,GAAQ,SAAS,CAAC,IAAIA,CAAK,EAAEA,EAAYC,EAAKhB,EAAO,IAAI,EAAO,CAACiB,EAAKC,GAASjB,EAAS,EAAK,EAAqW,GAAnWO,MAAc,CAAC,IAAMW,EAAQH,EAAK,QAAQ,GAAG,CAACG,EAAQ,OAAO,GAAG,OAAO,qBAAuB,IAAY,CAACD,EAAQ,EAAI,EAAE,MAAO,CAAC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