{"version":3,"file":"Map.C4zn2eZP.mjs","names":["React.useRef","React.useCallback"],"sources":["https:/framerusercontent.com/modules/pZrfPShDuOrLiexF41tl/HmZinaIiLUeUP2hyQ51w/Map.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";// -----------------------------\n// DEFAULT KNOXVILLE MARKERS\n// -----------------------------\nconst defaultKnoxvilleMarkers=[{lat:35.9606,lng:-83.9207,title:\"Knoxville, TN\",address:\"Serving Knoxville and nearby areas\",type:\"main\"},{lat:35.9647,lng:-83.9207,title:\"Downtown Knoxville\",address:\"Serving Downtown Knoxville\",type:\"service\"},{lat:35.9406,lng:-83.9827,title:\"Bearden\",address:\"Serving Bearden, Knoxville\",type:\"service\"},{lat:36.0362,lng:-83.9307,title:\"Fountain City\",address:\"Serving Fountain City, Knoxville\",type:\"service\"},{lat:36.0081,lng:-83.9296,title:\"North Knoxville\",address:\"Serving North Knoxville\",type:\"service\"},{lat:35.9428,lng:-84.0456,title:\"West Knoxville\",address:\"Serving West Knoxville\",type:\"service\"},{lat:35.8845,lng:-84.1535,title:\"Farragut\",address:\"Serving Farragut, TN\",type:\"service\"},{lat:35.9845,lng:-84.1149,title:\"Karns\",address:\"Serving Karns, Knoxville\",type:\"service\"},{lat:35.9245,lng:-84.0916,title:\"Cedar Bluff\",address:\"Serving Cedar Bluff, Knoxville\",type:\"service\"},{lat:35.9345,lng:-84.0388,title:\"West Hills\",address:\"Serving West Hills, Knoxville\",type:\"service\"},{lat:36.0104,lng:-84.2696,title:\"Oak Ridge\",address:\"Serving Oak Ridge, TN\",type:\"service\"},{lat:35.7565,lng:-83.9705,title:\"Maryville\",address:\"Serving Maryville, TN\",type:\"service\"},{lat:35.7973,lng:-84.256,title:\"Lenoir City\",address:\"Serving Lenoir City, TN\",type:\"service\"},{lat:35.8217,lng:-84.0471,title:\"Louisville\",address:\"Serving Louisville, TN\",type:\"service\"}];// -----------------------------\n// GOOGLE SCRIPT LOADER\n// -----------------------------\nlet mapsLoaded=false;let mapsLoadingPromise=null;function loadGoogle(apiKey){if(typeof window===\"undefined\")return Promise.resolve(false);if(mapsLoaded||window.google&&window.google.maps){mapsLoaded=true;return Promise.resolve(true);}if(mapsLoadingPromise)return mapsLoadingPromise;mapsLoadingPromise=new Promise(resolve=>{const existing=document.querySelector('script[data-framer-google-maps=\"1\"]');if(existing){if(window.google&&window.google.maps){mapsLoaded=true;resolve(true);return;}existing.addEventListener(\"load\",()=>{mapsLoaded=true;resolve(true);});existing.addEventListener(\"error\",()=>resolve(false));return;}const script=document.createElement(\"script\");script.dataset.framerGoogleMaps=\"1\";script.async=true;script.defer=true;script.onerror=()=>resolve(false);script.onload=()=>{mapsLoaded=true;resolve(true);};script.src=`https://maps.googleapis.com/maps/api/js?key=${apiKey}&v=weekly`;document.head.appendChild(script);});return mapsLoadingPromise;}function nextFrame(){return new Promise(resolve=>requestAnimationFrame(()=>resolve()));}// -----------------------------\n// MAP COMPONENT\n// -----------------------------\nexport default function Map(props){const{apiKey,markers=defaultKnoxvilleMarkers,zoom=10,fitPadding=30}=props;const mapRef=React.useRef(null);const mapInstance=React.useRef(null);const infoWindow=React.useRef(null);const markerList=React.useRef([]);const boundsRef=React.useRef(null);const hasInited=React.useRef(false);const manualZoomRef=React.useRef(false);const activeMarkers=markers&&markers.length>0?markers:defaultKnoxvilleMarkers;const clearMarkers=React.useCallback(()=>{markerList.current.forEach(marker=>marker?.setMap?.(null));markerList.current=[];},[]);const buildBubble=React.useCallback(marker=>{const safeTitle=(marker.title??\"\").replace(/</g,\"&lt;\").replace(/>/g,\"&gt;\");const safeAddress=(marker.address??\"\").replace(/</g,\"&lt;\").replace(/>/g,\"&gt;\");const addressHtml=safeAddress?`<div style=\"font-size:12px;color:#555;margin-bottom:8px;\">${safeAddress}</div>`:\"\";return`\n            <div style=\"\n                font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;\n                background: white;\n                border-radius: 12px;\n                padding: 10px 14px 12px 14px;\n                box-shadow: 0 2px 12px rgba(0,0,0,0.15);\n                max-width: 240px;\n            \">\n                <div style=\"font-size:15px;font-weight:600;margin-bottom:6px;\">\n                    ${safeTitle}\n                </div>\n\n                ${addressHtml}\n\n                <a href=\"https://www.google.com/maps?q=${marker.lat},${marker.lng}\"\n                   target=\"_blank\"\n                   rel=\"noopener noreferrer\"\n                   style=\"font-size:12px;color:#1a73e8;text-decoration:underline;\">\n                    View on Google Maps\n                </a>\n            </div>\n        `;},[]);const fitAll=React.useCallback(()=>{const map=mapInstance.current;const g=window.google;if(!map||!g?.maps)return;requestAnimationFrame(()=>{requestAnimationFrame(()=>{g.maps.event.trigger(map,\"resize\");if(activeMarkers.length>1&&boundsRef.current){map.fitBounds(boundsRef.current,fitPadding??30);if(manualZoomRef.current){g.maps.event.addListenerOnce(map,\"idle\",()=>{map.setZoom(zoom);});}}else if(activeMarkers.length===1){map.setCenter({lat:activeMarkers[0].lat,lng:activeMarkers[0].lng});map.setZoom(zoom);}});});},[activeMarkers,zoom,fitPadding]);const renderMarkers=React.useCallback(()=>{const map=mapInstance.current;const g=window.google;if(!map||!g?.maps)return;clearMarkers();boundsRef.current=new g.maps.LatLngBounds;if(!infoWindow.current){infoWindow.current=new g.maps.InfoWindow({maxWidth:260,pixelOffset:new g.maps.Size(0,-30)});}activeMarkers.forEach(markerItem=>{const marker=new g.maps.Marker({position:{lat:markerItem.lat,lng:markerItem.lng},map,title:markerItem.title});marker.addListener(\"click\",()=>{const bubble=buildBubble(markerItem);infoWindow.current.setContent(bubble);infoWindow.current.open(map,marker);props.onMarkerClick?.(markerItem);map.panTo(marker.getPosition());});markerList.current.push(marker);boundsRef.current.extend(marker.getPosition());});fitAll();},[activeMarkers,clearMarkers,buildBubble,fitAll,props]);// -----------------------------\n// Lazy init with IntersectionObserver\n// -----------------------------\nReact.useEffect(()=>{if(!mapRef.current)return;if(!apiKey)return;let cancelled=false;const observer=new IntersectionObserver(async entries=>{if(cancelled)return;if(!entries[0].isIntersecting)return;if(hasInited.current)return;const ok=await loadGoogle(apiKey);if(!ok||cancelled)return;const g=window.google;if(!g?.maps||!mapRef.current)return;await nextFrame();await nextFrame();if(cancelled)return;if(!window.google?.maps||!mapRef.current)return;hasInited.current=true;const center=activeMarkers.length>0?{lat:activeMarkers[0].lat,lng:activeMarkers[0].lng}:{lat:35.9606,lng:-83.9207};mapInstance.current=new window.google.maps.Map(mapRef.current,{center,zoom,mapTypeControl:false,streetViewControl:false,fullscreenControl:false});await nextFrame();if(cancelled)return;renderMarkers();observer.disconnect();},{rootMargin:\"800px\"});observer.observe(mapRef.current);return()=>{cancelled=true;observer.disconnect();};},[apiKey]);// -----------------------------\n// Update markers when props change\n// -----------------------------\nReact.useEffect(()=>{if(!hasInited.current)return;if(!mapInstance.current)return;if(!(window.google&&window.google.maps))return;manualZoomRef.current=false;renderMarkers();},[activeMarkers,renderMarkers]);// -----------------------------\n// Update zoom when prop changes\n// -----------------------------\nReact.useEffect(()=>{if(!hasInited.current)return;if(!mapInstance.current)return;if(!(window.google&&window.google.maps))return;manualZoomRef.current=true;mapInstance.current.setZoom(zoom);},[zoom]);// -----------------------------\n// Update fitPadding when prop changes\n// -----------------------------\nReact.useEffect(()=>{if(!hasInited.current)return;if(!mapInstance.current)return;if(!(window.google&&window.google.maps))return;if(activeMarkers.length>1){renderMarkers();}},[fitPadding,activeMarkers.length,renderMarkers]);// -----------------------------\n// Cleanup on unmount\n// -----------------------------\nReact.useEffect(()=>{return()=>{clearMarkers();infoWindow.current=null;mapInstance.current=null;boundsRef.current=null;hasInited.current=false;manualZoomRef.current=false;};},[clearMarkers]);return /*#__PURE__*/_jsx(\"div\",{ref:mapRef,style:{width:\"100%\",height:\"100%\",minHeight:350,borderRadius:12,overflow:\"hidden\",background:\"#f3f4f6\"}});}// -----------------------------\n// FRAMER CONTROLS\n// -----------------------------\naddPropertyControls(Map,{apiKey:{type:ControlType.String,title:\"API Key\"},zoom:{type:ControlType.Number,title:\"Zoom\",defaultValue:10,min:1,max:40},fitPadding:{type:ControlType.Number,title:\"Fit Padding\",defaultValue:30,min:0,max:200},markers:{type:ControlType.Array,title:\"Markers\",defaultValue:defaultKnoxvilleMarkers,propertyControl:{type:ControlType.Object,controls:{lat:{type:ControlType.Number,title:\"Lat\"},lng:{type:ControlType.Number,title:\"Lng\"},title:{type:ControlType.String,title:\"Title\"},address:{type:ControlType.String,title:\"Address\"},type:{type:ControlType.Enum,title:\"Type\",options:[\"main\",\"service\"],optionTitles:[\"Main\",\"Service\"]}}}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Map\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Map.map"],"mappings":"sMAMiD,SAAS,EAAW,EAAO,CAA81B,OAAn1B,IAAS,OAAmB,QAAQ,QAAQ,GAAM,CAAI,GAAY,EAAO,QAAQ,EAAO,OAAO,MAAM,EAAW,GAAY,QAAQ,QAAQ,GAAK,EAAK,IAA6C,EAAmB,IAAI,QAAQ,GAAS,CAAC,IAAM,EAAS,SAAS,cAAc,sCAAsC,CAAC,GAAG,EAAS,CAAC,GAAG,EAAO,QAAQ,EAAO,OAAO,KAAK,CAAC,EAAW,GAAK,EAAQ,GAAK,CAAC,OAAQ,EAAS,iBAAiB,WAAW,CAAC,EAAW,GAAK,EAAQ,GAAK,EAAG,CAAC,EAAS,iBAAiB,YAAY,EAAQ,GAAM,CAAC,CAAC,OAAQ,IAAM,EAAO,SAAS,cAAc,SAAS,CAAC,EAAO,QAAQ,iBAAiB,IAAI,EAAO,MAAM,GAAK,EAAO,MAAM,GAAK,EAAO,YAAY,EAAQ,GAAM,CAAC,EAAO,WAAW,CAAC,EAAW,GAAK,EAAQ,GAAK,EAAG,EAAO,IAAI,+CAA+C,EAAO,WAAW,SAAS,KAAK,YAAY,EAAO,EAAG,CAAQ,GAAoB,SAAS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