{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/Qe04u5Sp8MO5rrZKDpBw/3EwLvP1wXjyzjmzbAI1J/Sunshine_Map_For_Multiple_Markers_.js"],
  "sourcesContent": ["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useState}from\"react\";/**\n * These annotations control how your component sizes\n * Learn more: https://www.framer.com/developers/components/auto-sizing\n *\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function Sunshine_Map_For_Multiple_Markers(props){// add markers in this list to add the marker\nconst markers=[{position:{lat:28.642755857511567,lng:77.17491324055584},title:\"east_patel_nagar\",city:\"delhi\"},{position:{lat:28.646688755647588,lng:77.36543796754387},title:\"indirapuram\",city:\"delhi\"},{position:{lat:28.694571366930013,lng:77.12797846939269},title:\"pitampura\",city:\"delhi\"},{position:{lat:28.564030905938875,lng:77.24790304383819},title:\"east_of_kailash\",city:\"delhi\"},{position:{lat:28.422730034040196,lng:77.06644310909975},title:\"sec-51\",city:\"gurgaon\"},{position:{lat:28.467894243828628,lng:77.02715636753885},title:\"railway_road\",city:\"gurgaon\"},{position:{lat:26.85409842323667,lng:80.99406365400118},title:\"gomti_nagar\",city:\"lucknow\"},{position:{lat:26.786929653185638,lng:80.91428982231514},title:\"ashiyana\",city:\"lucknow\"},{position:{lat:18.568688829734473,lng:73.90752444032701},title:\"viman_nagar\",city:\"pune\"},{position:{lat:18.500889878401495,lng:73.94624744860366},title:\"vaibhavi\",city:\"pune\"},{position:{lat:18.52430305336982,lng:73.93344489891582},title:\"magarpatta\",city:\"pune\"},{position:{lat:12.955891290241677,lng:77.64094071141317},title:\"domlur\",city:\"bangalore\"},{position:{lat:17.446709,lng:78.3618692},title:\"gachibowli\",city:\"hyderabad\"},{position:{lat:26.889407178316326,lng:75.75369748283741},title:\"nirman_nagar\",city:\"jaipur\"},{position:{lat:12.9637066397182,lng:77.70891291141328},title:\"brookefield\",city:\"bangalore\"},{position:{lat:12.96575810399689,lng:77.73247630956585},title:\"whitefield\",city:\"bangalore\"},{position:{lat:17.406969459560607,lng:78.43713809219882},title:\"banjara hills\",city:\"hyderabad\"},{position:{lat:28.597693254362838,lng:77.39278272521315},title:\"cleo county\",city:\"noida\"}];// to fetch user's location\nconst[userLocation,setUserLocation]=useState(null);// Calculate distance between two coordinates in kilometers using Haversine formula\nconst calculateDistance=(lat1,lon1,lat2,lon2)=>{const R=6371// Radius of the earth in km\n;const dLat=(lat2-lat1)*Math.PI/180;const dLon=(lon2-lon1)*Math.PI/180;const a=Math.sin(dLat/2)*Math.sin(dLat/2)+Math.cos(lat1*Math.PI/180)*Math.cos(lat2*Math.PI/180)*Math.sin(dLon/2)*Math.sin(dLon/2);const c=2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a));return R*c// Distance in km\n;};// Find the closest city based on the user's coordinates\nconst findClosestCity=(latitude,longitude)=>{if(markers.length===0)return null;let closestDistance=Infinity;let closestCity=null;for(const marker of markers){const distance=calculateDistance(latitude,longitude,marker.position.lat,marker.position.lng);if(distance<closestDistance){closestDistance=distance;closestCity=marker.city||null;}}// Only consider it a match if within reasonable distance (e.g., 50km)\n// Can adjust this threshold based on your needs\nreturn closestDistance<=50?closestCity:null;};useEffect(()=>{if(\"geolocation\"in navigator){navigator.geolocation.getCurrentPosition(position=>{const{latitude,longitude}=position.coords;// Find closest city based on coordinates only\nconst closestCity=findClosestCity(latitude,longitude);setUserLocation({latitude,longitude,city:closestCity?.toLowerCase()});},error=>{setUserLocation({latitude:props.defaultLatitude,longitude:props.defaultLongitude});});}else{setUserLocation({latitude:props.defaultLatitude,longitude:props.defaultLongitude});}},[props.defaultLatitude,props.defaultLongitude]);// do not touch this unless needed, you can adjust width and height\nreturn /*#__PURE__*/_jsx(\"div\",{style:{width:\"3000px\",height:\"2000px\"},children:/*#__PURE__*/_jsx(MapComponent,{apiKey:\"AIzaSyBi_1A5DWaWz1Xy1d5MNngeDFCSA7eNz5M\",mapStyleId:\"ad5b8b8fd1011464\",markers:markers,userLocation:userLocation})});}// Keep track of script loading state\nlet isLoading=false;let isLoaded=false;const loadGoogleMapsScript=apiKey=>{return new Promise((resolve,reject)=>{if(isLoaded){resolve();return;}if(isLoading){const checkLoaded=setInterval(()=>{if(isLoaded){clearInterval(checkLoaded);resolve();}},100);return;}isLoading=true;const script=document.createElement(\"script\");script.src=`https://maps.googleapis.com/maps/api/js?key=${apiKey}`;script.async=true;script.defer=true;script.onload=()=>{isLoaded=true;isLoading=false;resolve();};script.onerror=()=>{isLoading=false;reject(new Error(\"Failed to load Google Maps script\"));};document.head.appendChild(script);});};const createOrangeMarker=props=>{const{map,position,title}=props;let outerCircle=null;let innerCircle=null;const calculateRadiusBasedOnZoom=(baseRadius,zoom)=>{// Google maps uses ~2 as the scale factor between zoom levels\n// This formula keeps the visual size consistent across zoom levels\nreturn baseRadius*Math.pow(2,13-zoom);};const createCircles=zoom=>{// Clear existing circles if they exist\nif(outerCircle)outerCircle.setMap(null);if(innerCircle)innerCircle.setMap(null);// Create outer glow circle (larger, more transparent)\nouterCircle=new google.maps.Circle({strokeColor:\"#FF8C00\",strokeOpacity:.1,strokeWeight:1,fillColor:\"#FFA500\",fillOpacity:.2,map:map,center:position,radius:calculateRadiusBasedOnZoom(600,zoom)});// Create inner circle (smaller, more vibrant)\ninnerCircle=new google.maps.Circle({strokeColor:\"#FF8C00\",strokeOpacity:.6,strokeWeight:1,fillColor:\"#FF7800\",fillOpacity:.8,map:map,center:position,radius:calculateRadiusBasedOnZoom(300,zoom)});};// Initial creation with current zoom\nconst currentZoom=map.getZoom();createCircles(currentZoom);// Return interface for controlling the marker\nreturn{setMap:newMap=>{if(outerCircle)outerCircle.setMap(newMap);if(innerCircle)innerCircle.setMap(newMap);},getPosition:()=>position,updateSize:zoom=>{createCircles(zoom);}};};const initMap=async(apiKey,mapStyleId,markers=[],userLocation,map)=>{try{await loadGoogleMapsScript(apiKey);// Set default center\nlet center={lat:12.9716,lng:77.5946}// default fallback\n;const zoomLevelForIndia=5.2;const centralPointOfIndia={lat:21.1458,lng:79.0882};const zoomLevelForCity=13;// Initial map settings - will be updated based on conditions\nlet initialZoom=zoomLevelForIndia;let initialCenter=centralPointOfIndia;console.log(`user city is ${userLocation?.city}`);// Use user location if available\nif(userLocation&&userLocation.latitude&&userLocation.longitude){// Create user center point\nconst userCenter={lat:userLocation.latitude,lng:userLocation.longitude};// Check if user's city matches any marker city\nlet cityMatched=false;if(userLocation.city){// Convert to lowercase for case-insensitive comparison\nconst userCity=userLocation.city.toLowerCase();// Search for matching city in markers\nfor(const marker of markers){if(marker.city&&marker.city.toLowerCase()===userCity){cityMatched=true;break;}}// If city matches, zoom to city level and center at user location\nif(cityMatched){initialZoom=zoomLevelForCity;initialCenter=userCenter;}// If no match, use India defaults (already set)\n}}map=new google.maps.Map(document.getElementById(\"hero_map\"),{center:initialCenter,zoom:initialZoom,mapId:mapStyleId,disableDefaultUI:true});// Store created markers to access later\nlet orangeMarkers=[];// Create markers\nmarkers.forEach(marker=>{const orangeMarker=createOrangeMarker({map,position:marker.position,title:marker.title});orangeMarkers.push(orangeMarker);});// Add zoom change listener to update circle sizes\nmap.addListener(\"zoom_changed\",()=>{const newZoom=map.getZoom();orangeMarkers.forEach(marker=>marker.updateSize(newZoom));});}catch(error){console.error(\"Error initializing map:\",error);}};const MapComponent=({apiKey,mapStyleId,markers=[],userLocation})=>{useEffect(()=>{let map=null;initMap(apiKey,mapStyleId,markers,userLocation,map);return()=>{// Clean up markers if needed, but don't remove the script\nif(map){// @ts-ignore - Clear the map instance\nmap=null;}};},[apiKey,mapStyleId,markers,userLocation]);return /*#__PURE__*/_jsx(\"div\",{id:\"hero_map\",style:{height:\"800px\",width:\"3000px\"}});};// Styles are written in object syntax\n// Learn more: https://reactjs.org/docs/dom-elements.html#style\nconst containerStyle={height:\"100%\",display:\"flex\",justifyContent:\"center\",alignItems:\"center\",overflow:\"hidden\"};\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Sunshine_Map_For_Multiple_Markers\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"auto\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Sunshine_Map_For_Multiple_Markers_.map"],
  "mappings": "gGAMkB,SAARA,EAAmDC,EAAM,CACnE,IAAMC,EAAQ,CAAC,CAAC,SAAS,CAAC,IAAI,mBAAmB,IAAI,iBAAiB,EAAE,MAAM,mBAAmB,KAAK,OAAO,EAAE,CAAC,SAAS,CAAC,IAAI,mBAAmB,IAAI,iBAAiB,EAAE,MAAM,cAAc,KAAK,OAAO,EAAE,CAAC,SAAS,CAAC,IAAI,mBAAmB,IAAI,iBAAiB,EAAE,MAAM,YAAY,KAAK,OAAO,EAAE,CAAC,SAAS,CAAC,IAAI,mBAAmB,IAAI,iBAAiB,EAAE,MAAM,kBAAkB,KAAK,OAAO,EAAE,CAAC,SAAS,CAAC,IAAI,mBAAmB,IAAI,iBAAiB,EAAE,MAAM,SAAS,KAAK,SAAS,EAAE,CAAC,SAAS,CAAC,IAAI,mBAAmB,IAAI,iBAAiB,EAAE,MAAM,eAAe,KAAK,SAAS,EAAE,CAAC,SAAS,CAAC,IAAI,kBAAkB,IAAI,iBAAiB,EAAE,MAAM,cAAc,KAAK,SAAS,EAAE,CAAC,SAAS,CAAC,IAAI,mBAAmB,IAAI,iBAAiB,EAAE,MAAM,WAAW,KAAK,SAAS,EAAE,CAAC,SAAS,CAAC,IAAI,mBAAmB,IAAI,iBAAiB,EAAE,MAAM,cAAc,KAAK,MAAM,EAAE,CAAC,SAAS,CAAC,IAAI,mBAAmB,IAAI,iBAAiB,EAAE,MAAM,WAAW,KAAK,MAAM,EAAE,CAAC,SAAS,CAAC,IAAI,kBAAkB,IAAI,iBAAiB,EAAE,MAAM,aAAa,KAAK,MAAM,EAAE,CAAC,SAAS,CAAC,IAAI,mBAAmB,IAAI,iBAAiB,EAAE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sBsB,EAAK,MAAM,CAAC,GAAG,WAAW,MAAM,CAAC,OAAO,QAAQ,MAAM,QAAQ,CAAC,CAAC",
  "names": ["Sunshine_Map_For_Multiple_Markers", "props", "markers", "userLocation", "setUserLocation", "ye", "calculateDistance", "lat1", "lon1", "lat2", "lon2", "dLat", "dLon", "a", "findClosestCity", "latitude", "longitude", "closestDistance", "closestCity", "marker", "distance", "ue", "navigator", "position", "error", "p", "MapComponent", "isLoading", "isLoaded", "loadGoogleMapsScript", "apiKey", "resolve", "reject", "checkLoaded", "script", "createOrangeMarker", "map", "title", "outerCircle", "innerCircle", "calculateRadiusBasedOnZoom", "baseRadius", "zoom", "createCircles", "currentZoom", "newMap", "initMap", "mapStyleId", "center", "zoomLevelForIndia", "centralPointOfIndia", "zoomLevelForCity", "initialZoom", "initialCenter", "userCenter", "cityMatched", "userCity", "orangeMarkers", "orangeMarker", "newZoom"]
}
