{"version":3,"file":"Scaler.GU-InOPN.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/LfHrCFWlNFi7Ew8lGXJ8/BGWsaZbEVFtyprwzlC8e/Scaler.js"],"sourcesContent":["// Component that scales all content inside a connected frame\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useEffect,useRef,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * Scale Wrapper - Scales all content inside a connected frame\n *\n * @framerIntrinsicWidth 200\n * @framerIntrinsicHeight 200\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function Scaler(props){const{connectedFrame}=props;const containerRef=useRef(null);const measureRef=useRef(null);const[containerSize,setContainerSize]=useState({width:0,height:0});const[contentSize,setContentSize]=useState({width:0,height:0});useEffect(()=>{if(typeof window===\"undefined\")return;const resizeObserver=new ResizeObserver(entries=>{for(const entry of entries){if(entry.target===containerRef.current){const{width,height}=entry.contentRect;startTransition(()=>{setContainerSize({width,height});});}else if(entry.target===measureRef.current){const{width,height}=entry.contentRect;startTransition(()=>{setContentSize({width,height});});}}});if(containerRef.current){resizeObserver.observe(containerRef.current);}if(measureRef.current){resizeObserver.observe(measureRef.current);}return()=>{resizeObserver.disconnect();};},[connectedFrame]);// Calculate scale factors to fill container completely\nconst scaleX=contentSize.width>0?containerSize.width/contentSize.width:1;const scaleY=contentSize.height>0?containerSize.height/contentSize.height:1;return /*#__PURE__*/_jsxs(\"div\",{ref:containerRef,style:{...props.style,position:\"relative\",width:\"100%\",height:\"100%\",minWidth:\"5px\",minHeight:\"5px\",overflow:\"hidden\"},children:[/*#__PURE__*/_jsx(\"div\",{ref:measureRef,style:{position:\"absolute\",top:0,left:0,visibility:\"hidden\",pointerEvents:\"none\",width:\"max-content\",height:\"max-content\",zIndex:-1},children:connectedFrame}),/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:0,left:0,width:\"100%\",height:\"100%\",transform:`scale(${scaleX}, ${scaleY})`,transformOrigin:\"top left\"},children:connectedFrame})]});}addPropertyControls(Scaler,{connectedFrame:{type:ControlType.Slot,title:\"Connected Frame\",maxCount:1}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Scaler\",\"slots\":[\"connectedFrame\"],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any\",\"framerSupportedLayoutWidth\":\"any\",\"framerIntrinsicHeight\":\"200\",\"framerIntrinsicWidth\":\"200\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Scaler.map"],"mappings":"gNASG,SAAwB,EAAO,EAAM,CAAC,GAAK,CAAC,kBAAgB,EAAY,EAAaA,EAAO,KAAK,CAAO,EAAWA,EAAO,KAAK,CAAM,CAAC,EAAc,GAAkBC,EAAS,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,CAAM,CAAC,EAAY,GAAgBA,EAAS,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC,MAAc,CAAC,GAAU,IAAS,OAAY,OAAO,IAAM,EAAe,IAAI,eAAe,GAAS,CAAC,IAAI,IAAM,KAAS,EAAS,GAAG,EAAM,SAAS,EAAa,QAAQ,CAAC,GAAK,CAAC,QAAM,UAAQ,EAAM,YAAY,MAAoB,CAAC,EAAiB,CAAC,QAAM,SAAO,CAAC,EAAG,SAAU,EAAM,SAAS,EAAW,QAAQ,CAAC,GAAK,CAAC,QAAM,UAAQ,EAAM,YAAY,MAAoB,CAAC,EAAe,CAAC,QAAM,SAAO,CAAC,EAAG,GAAK,CAA2I,OAAvI,EAAa,SAAS,EAAe,QAAQ,EAAa,QAAQ,CAAK,EAAW,SAAS,EAAe,QAAQ,EAAW,QAAQ,KAAY,CAAC,EAAe,YAAY,GAAK,CAAC,EAAe,CAAC,CACn2B,IAAM,EAAO,EAAY,MAAM,EAAE,EAAc,MAAM,EAAY,MAAM,EAAQ,EAAO,EAAY,OAAO,EAAE,EAA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