"use strict";(self.webpackChunkelement_web=self.webpackChunkelement_web||[]).push([[8227],{"./src/components/views/location/Marker.tsx":(e,t,o)=>{o.d(t,{A:()=>m});var n=o("./node_modules/react/index.js"),r=o("./node_modules/classnames/index.js"),a=o.n(r),l=o("./node_modules/@vector-im/compound-design-tokens/assets/web/icons/location-pin-solid.js"),i=o("./src/utils/FormattingUtils.ts"),s=o("./src/components/views/avatars/MemberAvatar.tsx");const c=({tooltip:e,children:t})=>{const[o,r]=(0,n.useState)(!1);if(!e)return n.createElement(n.Fragment,null,t);return n.createElement("div",{onMouseEnter:()=>r(!0),onClick:e=>{e.stopPropagation(),r(!o)},onMouseLeave:()=>r(!1)},t,o&&e)},m=n.forwardRef((({id:e,roomMember:t,useMemberColor:o,tooltip:r},m)=>{const d=o&&t?(0,i.yJ)(t.userId):"";return n.createElement("div",{ref:m,id:e,className:a()("mx_Marker",d,{mx_Marker_defaultColor:!d})},n.createElement(c,{tooltip:r},n.createElement("div",{className:"mx_Marker_border"},t?n.createElement(s.A,{member:t,size:"36px",viewUserOnClick:!1,hideTitle:!!r}):n.createElement(l.A,{className:"mx_Marker_icon"}))))}))},"./src/components/views/location/SmartMarker.tsx":(e,t,o)=>{o.r(t),o.d(t,{default:()=>i});var n=o("./node_modules/react/index.js"),r=o("./src/utils/location/index.ts"),a=o("./src/utils/location/map.ts"),l=o("./src/components/views/location/Marker.tsx");const i=({id:e,map:t,geoUri:o,roomMember:i,useMemberColor:s,tooltip:c})=>{const{onElementRef:m}=((e,t)=>{const[o,l]=(0,n.useState)(),i=(0,n.useCallback)((n=>{if(o||!n)return;const i=(0,r.XB)(t);if(i){const t=(0,a.h)(i,n);t.addTo(e),l(t)}}),[o,t,e]);return(0,n.useEffect)((()=>{if(o){const e=(0,r.XB)(t);e&&o.setLngLat({lon:e.longitude,lat:e.latitude})}}),[o,t]),(0,n.useEffect)((()=>()=>{o&&o.remove()}),[o]),{marker:o,onElementRef:i}})(t,o);return n.createElement("span",null,n.createElement(l.A,{ref:m,id:e,roomMember:i,useMemberColor:s,tooltip:c}))}},"./src/utils/location/map.ts":(e,t,o)=>{o.d(t,{h:()=>c,p:()=>s});var n=o("./node_modules/maplibre-gl/dist/maplibre-gl.js"),r=o("./node_modules/matrix-js-sdk/src/logger.ts"),a=o("./src/languageHandler.tsx"),l=o("./src/utils/location/findMapStyleUrl.ts"),i=o("./src/utils/location/LocationShareErrors.ts");const s=(e,t,o,s)=>{try{const c=(0,l.M)(e),m=new n.Map({container:o,style:c,zoom:15,interactive:t,attributionControl:!1,locale:{"AttributionControl.ToggleAttribution":(0,a._t)("location_sharing|toggle_attribution"),"AttributionControl.MapFeedback":(0,a._t)("location_sharing|map_feedback"),"FullscreenControl.Enter":(0,a._t)("action|enter_fullscreen"),"FullscreenControl.Exit":(0,a._t)("action|exit_fullscreeen"),"GeolocateControl.FindMyLocation":(0,a._t)("location_sharing|find_my_location"),"GeolocateControl.LocationNotAvailable":(0,a._t)("location_sharing|location_not_available"),"LogoControl.Title":(0,a._t)("location_sharing|mapbox_logo"),"NavigationControl.ResetBearing":(0,a._t)("location_sharing|reset_bearing"),"NavigationControl.ZoomIn":(0,a._t)("action|zoom_in"),"NavigationControl.ZoomOut":(0,a._t)("action|zoom_out")}});return m.addControl(new n.AttributionControl,"top-right"),m.on("error",(e=>{r.v.error("Failed to load map: check map_style_url in config.json has a valid URL and API key",e.error),null==s||s(new Error(i.$.MapStyleUrlNotReachable))})),m}catch(e){r.v.error("Failed to render map",e);if((null==e?void 0:e.message).includes("Failed to initialize WebGL"))throw new Error(i.$.WebGLNotEnabled);throw e}},c=(e,t)=>new n.Marker({element:t,anchor:"bottom",offset:[0,-1]}).setLngLat({lon:e.longitude,lat:e.latitude})}}]);
//# sourceMappingURL=8227.js.map