{"version":3,"file":"LocationDistanceLabel.BOM2bzDR.mjs","names":["React.forwardRef","React.useState","React.useCallback","React.useMemo","__esmMin","init_ssg_sandbox_shims","navigator","te","ne","window","_e","pe","J","init_jsx_runtime","ce","init_npm_react_18_3_1","motion","addPropertyControls","cx","withCSS","init_framer_B6PCHH0A","useSVGTemplate","ControlType","mask","Base","MotionSVG","SVG","svg","getProps","Icon","init_Whn4aos15","props","rest","animated","color","width1","alpha","restProps","href","className","qxTvv_EBh","ezTt3ayMo","lschgej4H","style","toRadians","value","haversineDistance","earthRadius","units","dLat","toLat","fromLat","dLon","toLon","fromLon","lat1","lat2","a","formatDistance","distance","LocationDistanceLabel","coords","setCoords","label","setLabel","computeLabel","currentLat","currentLon","latitude","longitude","position","nextLabel","textStyle","align","fontSize","init_LocationDistanceLabel"],"sources":["https:/framerusercontent.com/modules/FaxZInRwAZReJpbcbldd/muqXBKZwrJnuW4AxlyYL/Whn4aos15.js","https:/framerusercontent.com/modules/VDs1iAqLBP2aRYyq6olF/ovgUNstoANvbnQlamio0/LocationDistanceLabel.js"],"sourcesContent":["// Generated by Framer (6ca5d98)\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,cx,motion,useSVGTemplate,withCSS}from\"framer\";import*as React from\"react\";import{forwardRef}from\"react\";const mask=\"var(--framer-icon-mask)\";const Base=/*#__PURE__*/forwardRef(function(props,ref){return /*#__PURE__*/_jsx(\"svg\",{...props,ref:ref,children:props.children});});const MotionSVG=motion.create(Base);const SVG=/*#__PURE__*/forwardRef((props,ref)=>{const{animated,layoutId,children,...rest}=props;return animated?/*#__PURE__*/_jsx(MotionSVG,{...rest,layoutId:layoutId,ref:ref,children:children}):/*#__PURE__*/_jsx(\"svg\",{...rest,ref:ref,children:children});});const svg='<svg display=\"block\" role=\"presentation\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M 7.5 0 C 3.358 0 0 3.358 0 7.5 C 0 14.25 7.5 19.5 7.5 19.5 C 7.5 19.5 15 14.25 15 7.5 C 15 3.358 11.642 0 7.5 0 Z M 7.5 10.5 C 5.843 10.5 4.5 9.157 4.5 7.5 C 4.5 5.843 5.843 4.5 7.5 4.5 C 9.157 4.5 10.5 5.843 10.5 7.5 C 10.5 9.157 9.157 10.5 7.5 10.5 Z\" fill-opacity=\"var(--1m6trwb, 0)\" fill=\"var(--21h8s6, rgb(0, 0, 0))\" height=\"19.5px\" id=\"eB8SaW_W5\" transform=\"translate(4.5 2.25)\" width=\"15px\"/><path d=\"M 0 3 C 0 1.343 1.343 0 3 0 C 4.657 0 6 1.343 6 3 C 6 4.657 4.657 6 3 6 C 1.343 6 0 4.657 0 3 Z\" fill=\"transparent\" height=\"6px\" id=\"Psdr3EPAA\" stroke-dasharray=\"\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"var(--pgex8v, 1.5)\" stroke=\"var(--21h8s6, rgb(0, 0, 0))\" transform=\"translate(9 6.75)\" width=\"6px\"/><path d=\"M 15 7.5 C 15 14.25 7.5 19.5 7.5 19.5 C 7.5 19.5 0 14.25 0 7.5 C 0 3.358 3.358 0 7.5 0 C 11.642 0 15 3.358 15 7.5 Z\" fill=\"transparent\" height=\"19.5px\" id=\"nWyCs7cMd\" stroke-dasharray=\"\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"var(--pgex8v, 1.5)\" stroke=\"var(--21h8s6, rgb(0, 0, 0))\" transform=\"translate(4.5 2.25)\" width=\"15px\"/></svg>';const getProps=({alpha,color,height,id,width,width1,...props})=>{return{...props,ezTt3ayMo:color??props.ezTt3ayMo??\"rgb(0, 0, 0)\",lschgej4H:width1??props.lschgej4H??1.5,qxTvv_EBh:alpha??props.qxTvv_EBh};};const Component=/*#__PURE__*/React.forwardRef(function(props,ref){const{style,className,layoutId,variant,ezTt3ayMo,lschgej4H,qxTvv_EBh,...restProps}=getProps(props);const href=useSVGTemplate(\"4159562592\",svg);return /*#__PURE__*/_jsx(SVG,{...restProps,className:cx(\"framer-XrTFE\",className),layoutId:layoutId,ref:ref,role:\"presentation\",style:{\"--1m6trwb\":qxTvv_EBh,\"--21h8s6\":ezTt3ayMo,\"--pgex8v\":lschgej4H,...style},viewBox:\"0 0 24 24\",children:/*#__PURE__*/_jsx(\"use\",{href:href})});});const css=[`.framer-XrTFE { -webkit-mask: ${mask}; aspect-ratio: 1; display: block; mask: ${mask}; width: 24px; }`];/**\n * This is a generated Framer component.\n * @framerIntrinsicWidth 24\n * @framerIntrinsicHeight 24\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n * @framerVariables {\"ezTt3ayMo\":\"color\",\"lschgej4H\":\"width1\",\"qxTvv_EBh\":\"alpha\"}\n * @framerImmutableVariables true\n * @framerVector {\"name\":\"Map Pin\",\"color\":{\"type\":\"variable\",\"value\":\"21h8s6\"},\"set\":{\"localId\":\"vectorSet/NGVKdicsm\",\"id\":\"NGVKdicsm\",\"moduleId\":\"omX0gWFPqDwhaiWwf6ab\"}}\n * @framerDisableUnlink true\n */const Icon=withCSS(Component,css,\"framer-XrTFE\");Icon.displayName=\"Map Pin\";export default Icon;addPropertyControls(Icon,{ezTt3ayMo:{defaultValue:\"rgb(0, 0, 0)\",hidden:false,title:\"Color\",type:ControlType.Color},lschgej4H:{defaultValue:1.5,displayStepper:true,hidden:false,max:6,min:0,step:.5,title:\"Width\",type:ControlType.Number},qxTvv_EBh:{defaultValue:0,displayStepper:true,hidden:false,max:1,min:0,step:.1,title:\"Alpha\",type:ControlType.Number}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Icon\",\"slots\":[],\"annotations\":{\"framerVector\":\"{\\\"name\\\":\\\"Map Pin\\\",\\\"color\\\":{\\\"type\\\":\\\"variable\\\",\\\"value\\\":\\\"21h8s6\\\"},\\\"set\\\":{\\\"localId\\\":\\\"vectorSet/NGVKdicsm\\\",\\\"id\\\":\\\"NGVKdicsm\\\",\\\"moduleId\\\":\\\"omX0gWFPqDwhaiWwf6ab\\\"}}\",\"framerDisableUnlink\":\"true\",\"framerIntrinsicHeight\":\"24\",\"framerImmutableVariables\":\"true\",\"framerIntrinsicWidth\":\"24\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerVariables\":\"{\\\"ezTt3ayMo\\\":\\\"color\\\",\\\"lschgej4H\\\":\\\"width1\\\",\\\"qxTvv_EBh\\\":\\\"alpha\\\"}\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}","import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";function toRadians(value){return value*Math.PI/180;}function haversineDistance(fromLat,fromLon,toLat,toLon,units){const earthRadius=units===\"miles\"?3958.8:6371;const dLat=toRadians(toLat-fromLat);const dLon=toRadians(toLon-fromLon);const lat1=toRadians(fromLat);const lat2=toRadians(toLat);const a=Math.sin(dLat/2)*Math.sin(dLat/2)+Math.cos(lat1)*Math.cos(lat2)*Math.sin(dLon/2)*Math.sin(dLon/2);const c=2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a));return earthRadius*c;}function formatDistance(distance){if(distance<10)return distance.toFixed(1);return Math.round(distance).toString();}/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function LocationDistanceLabel(props){const{latitude,longitude,fontSize,color,align,units}=props;const[coords,setCoords]=React.useState(null);const[label,setLabel]=React.useState(\"\");const computeLabel=React.useCallback((currentLat,currentLon)=>{const distance=haversineDistance(currentLat,currentLon,latitude,longitude,units);const formatted=formatDistance(distance);const unitLabel=units===\"miles\"?\"mi\":\"km\";return`${formatted} ${unitLabel}`;},[latitude,longitude,units]);React.useEffect(()=>{if(typeof window===\"undefined\")return;if(typeof navigator===\"undefined\"||!navigator.geolocation){React.startTransition(()=>setCoords(null));return;}navigator.geolocation.getCurrentPosition(position=>{React.startTransition(()=>setCoords({lat:position.coords.latitude,lon:position.coords.longitude}));},()=>{React.startTransition(()=>setCoords(null));},{timeout:1e4});},[]);React.useEffect(()=>{if(!coords){React.startTransition(()=>setLabel(\"\"));return;}const nextLabel=computeLabel(coords.lat,coords.lon);React.startTransition(()=>setLabel(nextLabel));},[coords,computeLabel]);const textStyle=React.useMemo(()=>({position:\"relative\",display:\"inline-block\",width:\"fit-content\",background:\"transparent\",color,fontSize,textAlign:align,whiteSpace:\"nowrap\",lineHeight:1.3,margin:0,padding:0}),[align,color,fontSize]);return /*#__PURE__*/_jsx(\"div\",{style:textStyle,children:label});}addPropertyControls(LocationDistanceLabel,{latitude:{type:ControlType.Number,title:\"Latitude\",defaultValue:37.7749,min:-90,max:90,step:1e-4},longitude:{type:ControlType.Number,title:\"Longitude\",defaultValue:-122.4194,min:-180,max:180,step:1e-4},prefix:{type:ControlType.String,title:\"Prefix\",defaultValue:\"\"},unavailableText:{type:ControlType.String,title:\"Unavailable\",defaultValue:\"Enable location to see distance\"},loadingText:{type:ControlType.String,title:\"Loading\",defaultValue:\"Calculating distance…\"},fontSize:{type:ControlType.Number,title:\"Font Size\",defaultValue:12,min:8,max:64,step:1},color:{type:ControlType.Color,title:\"Color\",defaultValue:\"rgba(25,22,20,0.8)\"},align:{type:ControlType.Enum,title:\"Align\",options:[\"left\",\"center\",\"right\"],optionTitles:[\"Left\",\"Center\",\"Right\"],defaultValue:\"center\",displaySegmentedControl:true},units:{type:ControlType.Enum,title:\"Units\",options:[\"miles\",\"kilometers\"],optionTitles:[\"Miles\",\"Kilometers\"],defaultValue:\"miles\",displaySegmentedControl:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"LocationDistanceLabel\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}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