{"version":3,"file":"ScaleToFitWidth.Buj-d80z.mjs","names":["useRef","useState","useCallback","useLayoutEffect","useEffect"],"sources":["https:/framerusercontent.com/modules/ctCm3l3gE6EILlYf2JmR/6aFaZJhXaXJf90Slf4vM/ScaleToFitWidth.js"],"sourcesContent":["// User request: Create a new code file ScaleToFitWidth.tsx exporting a Framer code override named `scaleToFitWidth`. It wraps a fixed-size canvas frame (design width e.g. 1200px, fixed height e.g. 3113px, freeform children) that sits as a relative child of a vertical stack page. Behavior at runtime (not in static/canvas renderer — use RenderTarget check and leave the element untouched on canvas): measure parent width and own unscaled size, scale down to fit width, apply transform from top-left with negative margin compensation, keep flexShrink 0, SSR-safe, and avoid layout flash with useLayoutEffect on client.\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,startTransition,useCallback,useEffect,useLayoutEffect,useRef,useState}from\"react\";import{RenderTarget}from\"framer\";export function scaleToFitWidth(Component){return /*#__PURE__*/forwardRef(function ScaleToFitWidth(props,ref){const localRef=useRef(null);const[scale,setScale]=useState(1);const[size,setSize]=useState({width:0,height:0,parentWidth:0});const setRefs=useCallback(node=>{localRef.current=node;if(typeof ref===\"function\"){ref(node);return;}if(ref&&typeof ref===\"object\"){ref.current=node;}},[ref]);const shouldEnhance=typeof window!==\"undefined\"&&(RenderTarget.current()===RenderTarget.preview||RenderTarget.current()===RenderTarget.canvas);const measure=useCallback(()=>{if(!shouldEnhance)return;const node=localRef.current;if(!node)return;let parent=node.parentElement;while(parent&&(getComputedStyle(parent).display===\"contents\"||parent.clientWidth<=0)){parent=parent.parentElement;}if(!parent)return;const parentWidth=parent.clientWidth;const width=node.offsetWidth;const height=node.offsetHeight;if(parentWidth<=0||width<=0||height<=0)return;const nextScale=Math.min(1,parentWidth/width);parent.style.setProperty(\"--kronos-content-height\",`${height*nextScale}px`);startTransition(()=>{setScale(prev=>Math.abs(prev-nextScale)<.001?prev:nextScale);setSize(prev=>prev.width===width&&prev.height===height&&prev.parentWidth===parentWidth?prev:{width,height,parentWidth});});},[shouldEnhance]);const useIsomorphicLayoutEffect=typeof window!==\"undefined\"?useLayoutEffect:useEffect;useIsomorphicLayoutEffect(()=>{if(!shouldEnhance)return;const node=localRef.current;if(!node)return;let parent=node.parentElement;while(parent&&(getComputedStyle(parent).display===\"contents\"||parent.clientWidth<=0)){parent=parent.parentElement;}if(!parent)return;let frameId=0;const scheduleMeasure=()=>{if(frameId)window.cancelAnimationFrame(frameId);frameId=window.requestAnimationFrame(()=>{frameId=0;measure();});};scheduleMeasure();window.addEventListener(\"resize\",scheduleMeasure);let observer=null;if(typeof ResizeObserver!==\"undefined\"){observer=new ResizeObserver(()=>scheduleMeasure());observer.observe(parent);}return()=>{if(frameId)window.cancelAnimationFrame(frameId);window.removeEventListener(\"resize\",scheduleMeasure);if(observer)observer.disconnect();};},[measure,shouldEnhance]);const isScaled=shouldEnhance&&Math.abs(scale-1)>.001;const runtimeTransform=isScaled?`${props.style?.transform?`${props.style.transform} `:\"\"}scale(${scale})`:props.style?.transform;const style={...props.style||{},\"--kronos-scale\":scale,\"--kronos-background-width\":`${Math.max(size.parentWidth,1200*scale)/scale}px`,transform:runtimeTransform,transformOrigin:isScaled?\"top left\":props.style?.transformOrigin,marginBottom:isScaled?`${-(size.height*(1-scale))}px`:props.style?.marginBottom,marginRight:isScaled?`${-(size.width*(1-scale))}px`:props.style?.marginRight,flexShrink:0};return /*#__PURE__*/_jsx(Component,{ref:setRefs,...props,style:style});});}// Consistent responsive navigation and small-screen readability across templates.\nconst siteReadabilityCSS='\\n[data-framer-name=\"Home Composition\"] { transform:scale(var(--kronos-scale,1)) !important; transform-origin:top left !important; }\\n[data-framer-name=\"Navigation Bar\"] { width:min(520px,calc(100% - 48px)) !important; height:36px !important; left:50% !important; right:auto !important; top:56px !important; transform:translateX(-50%) !important; }\\n[data-framer-name=\"Navigation Bar\"] > div { width:100% !important; height:100% !important; display:flex !important; gap:0 !important; align-items:stretch !important; }\\n[data-framer-name=\"Navigation Bar\"] > div > div { width:20% !important; flex:1 1 0 !important; height:100% !important; position:relative !important; }\\n[data-framer-name=\"Navigation Bar\"] [data-framer-component-type=\"RichTextContainer\"] { position:absolute !important; inset:0 !important; width:100% !important; height:100% !important; transform:none !important; }\\n[data-framer-name=\"Navigation Bar\"] p { margin:0 !important; width:100% !important; height:100% !important; font-size:11px !important; line-height:1.2 !important; }\\n[data-framer-name=\"Navigation Bar\"] a { display:flex !important; width:100% !important; height:100% !important; align-items:center !important; justify-content:center !important; font-size:11px !important; line-height:1.2 !important; white-space:nowrap !important; }\\n[data-framer-name=\"KRONOS Footer\"] { width:100% !important; }\\n[data-framer-name=\"Footer Content\"] { width:100% !important; max-width:1152px !important; }\\n[data-framer-name=\"Footer Content\"] p { font-size:12px !important; line-height:1.5 !important; }\\n[data-framer-name=\"Footer Content\"] [data-framer-component-type=\"RichTextContainer\"] { height:auto !important; }\\ninput, textarea { font-size:16px !important; }\\n@media(max-width:809px) {\\n[data-framer-name=\"Navigation Bar\"] { width:calc(100% - 40px) !important; max-width:400px !important; height:34px !important; top:40px !important; }\\n[data-framer-name=\"Navigation Bar\"] p, [data-framer-name=\"Navigation Bar\"] a { font-size:9.5px !important; }\\n[data-framer-name=\"Contact Page\"] [data-framer-name=\"Contact Description\"] p, [data-framer-name=\"Contact Page\"] [data-framer-name=\"Contact Details and Location\"] p { font-size:16px !important; }\\n[data-framer-name=\"Phone content\"] p { font-size:16px !important; line-height:1.5 !important; }\\n[data-framer-name=\"Phone content\"] h3 { font-size:18px !important; }\\n}\\n\\n[data-framer-name=\"FAQ Dark Section\"] a { min-height:44px !important; }\\n[data-framer-name=\"FAQ Dark Section\"] a p { font-size:14px !important; }\\n@media(min-width:810px) and (max-width:1199px) {\\n[data-framer-name=\"Home Composition\"] p { font-size:calc(16px / var(--kronos-scale, 1)) !important; }\\n[data-framer-name=\"Home Composition\"] a[href=\"/contact\"] { min-height:calc(44px / var(--kronos-scale, 1)) !important; box-sizing:border-box !important; }\\n[data-framer-name=\"Home Composition\"] [data-ko] div[style*=\"font-size: 10px\"], [data-framer-name=\"Home Composition\"] [data-ko] div[style*=\"font-size: 13px\"] { font-size:calc(12px / var(--kronos-scale, 1)) !important; line-height:1.35 !important; }\\n}\\n[class$=\"-run\"] p { font-size:14px !important; line-height:1.5 !important; }\\n[role=\"tab\"] { font-size:13px !important; min-height:44px !important; }\\n@media(max-width:809px) {\\n[data-framer-name=\"Navigation Bar\"] a { white-space:normal !important; text-align:center !important; padding:0 3px !important; box-sizing:border-box !important; }\\n[data-framer-name=\"Phone content\"] div:has(> [class$=\"-run\"]) { transform:none !important; width:100% !important; }\\n[data-framer-name=\"Phone content\"] div:has(> div > [class$=\"-run\"]) { height:auto !important; }\\n[data-framer-name=\"Phone content\"] [class$=\"-run\"] p { font-size:16px !important; }\\n[data-framer-name=\"Phone content\"] [role=\"tab\"] { font-size:12px !important; min-height:44px !important; white-space:normal !important; padding:0 2px !important; }\\n}\\n\\n@media(min-width:810px) and (max-width:1199px) {\\n}\\n\\n@media(min-width:810px) and (max-width:1199px) {\\n}\\n@media(max-width:809px) {\\n[data-framer-name=\"Headline Block\"] { max-width:calc(100% - 40px) !important; }\\n}\\n\\n@media(max-width:809px) {\\n}\\n\\n@media(min-width:810px) {\\n}\\n\\n@media(max-width:809px) {\\n[data-framer-name=\"Home Phone\"] div:has(> a[href=\"/contact\"]) > p { font-size:16px !important; }\\n[data-framer-name=\"Home Phone\"] a[href=\"/contact\"] { min-height:48px !important; box-sizing:border-box !important; }\\n[data-framer-name=\"Home Phone\"] [data-ko] p { font-size:16px !important; line-height:1.5 !important; }\\n[data-framer-name=\"Home Phone\"] [data-ko] div[style*=\"font-size: 10px\"] { font-size:12px !important; line-height:1.35 !important; }\\n}\\n\\n[data-framer-name=\"Navigation Bar\"] > div { position:relative !important; left:0 !important; right:auto !important; top:0 !important; transform:none !important; width:100% !important; }\\n@media(min-width:810px) and (max-width:1199px) {\\n[data-framer-name=\"Home Composition\"] > .framer-1jimt75-container { width:100% !important; left:0 !important; right:0 !important; transform:none !important; }\\n}\\n\\n@media(min-width:810px) and (max-width:1199px) {\\n[data-framer-name=\"Home Composition\"] > div:has([data-ko]) { width:1000px !important; top:2350px !important; bottom:auto !important; }\\n[data-framer-name=\"Home Composition\"] [data-ko] p { font-size:calc(14px / var(--kronos-scale,1)) !important; line-height:1.5 !important; }\\n[data-framer-name=\"Home Composition\"] [data-ko] span[style*=\"font-size: 13px\"], [data-framer-name=\"Home Composition\"] [data-ko] span[style*=\"font-size: 11px\"] { font-size:calc(12px / var(--kronos-scale,1)) !important; line-height:1.35 !important; }\\n}\\n\\n@media(min-width:810px) and (max-width:1199px) {\\n[data-framer-name=\"Home Composition\"] { height:3213px !important; background:#e9e5df !important; }\\n[data-framer-name=\"Home Composition\"] > .framer-8qwueb, [data-framer-name=\"Home Composition\"] > .framer-1esh2sg, [data-framer-name=\"Home Composition\"] > .framer-1aet7ee { transform:translateY(70px) !important; }\\n[data-framer-name=\"Home Composition\"] > .framer-uricv8-container { top:2577px !important; bottom:auto !important; }\\n}\\n\\n@media(min-width:810px) and (max-width:1199px) {\\n[data-framer-name=\"Home Composition\"] > .framer-1tt8rls { top:1888px !important; bottom:auto !important; }\\n[data-framer-name=\"Home Composition\"] > .framer-1gwbgnn { top:1934px !important; bottom:auto !important; }\\n[data-framer-name=\"Home Composition\"] > .framer-1aet7ee { top:2704px !important; bottom:auto !important; transform:none !important; }\\n[data-framer-name=\"Home Composition\"] > .framer-8qwueb { top:2750px !important; bottom:auto !important; transform:none !important; }\\n[data-framer-name=\"Home Composition\"] > .framer-1esh2sg { top:2856px !important; bottom:auto !important; transform:none !important; }\\n}\\n\\n@media(max-width:809px) {\\n}\\n';const backgroundContinuityCSS='\\n/* Let sections grow with content and cover spare viewport space above the footer. */\\n[data-framer-name=\"Contact Page\"], [data-framer-name=\"Privacy Page\"] { min-height:calc(100dvh - 170px) !important; height:auto !important; max-height:none !important; box-sizing:border-box !important; background-color:#061426 !important; }\\n[data-framer-name=\"Responsive Home\"] { background-color:#e9e5df !important; }\\n[data-framer-name=\"How We Help Hero\"] { max-height:none !important; }\\n';const desktopSizingCSS='\\n/* Keep content at its designed desktop size while backgrounds span the viewport. */\\n[data-framer-name=\"Responsive Home\"] { height:var(--kronos-content-height,auto) !important; aspect-ratio:auto !important; }\\n[data-framer-name=\"Home Composition\"] { left:50% !important; right:auto !important; transform:translateX(-50%) scale(var(--kronos-scale,1)) !important; transform-origin:center top !important; overflow:visible !important; }\\n[data-framer-name=\"Home Composition\"] > [data-framer-name=\"Home Light Background\"], [data-framer-name=\"Home Composition\"] > [data-framer-name=\"Paint Stroke Divider\"], [data-framer-name=\"Home Composition\"] > [data-framer-name=\"Hero Colour Transition\"] { width:var(--kronos-background-width,1200px) !important; left:50% !important; right:auto !important; transform:translateX(-50%) !important; }\\n[data-framer-name=\"Home Composition\"] > .framer-1jimt75-container { width:max(1337px,var(--kronos-background-width,1200px)) !important; left:50% !important; right:auto !important; transform:translateX(-50%) !important; }\\n[data-framer-name=\"Navigation Bar\"] { left:50vw !important; }\\n';const paintDividerCSS='\\n[data-framer-name=\"Home Composition\"] > [data-framer-name=\"Paint Stroke Divider\"] { height:900px !important; aspect-ratio:auto !important; }\\n[data-framer-name=\"Home Composition\"] > [data-framer-name=\"Paint Stroke Divider\"] img { object-fit:fill !important; }\\n';export function withSiteReadability(Component){return /*#__PURE__*/forwardRef(function SiteReadability(props,ref){useEffect(()=>{if(RenderTarget.current()!==RenderTarget.preview)return;const tag=document.createElement(\"style\");tag.setAttribute(\"data-kronos-readability\",\"true\");tag.textContent=siteReadabilityCSS+backgroundContinuityCSS+desktopSizingCSS+paintDividerCSS;document.head.appendChild(tag);return()=>{tag.remove();};},[]);return /*#__PURE__*/_jsx(Component,{...props,ref:ref});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withSiteReadability\":{\"type\":\"reactHoc\",\"name\":\"withSiteReadability\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"scaleToFitWidth\":{\"type\":\"reactHoc\",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