(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,51626,e=>{"use strict";e.s(["default",()=>p]);var o=e.i(43476),t=e.i(71645),i=e.i(34382),l=e.i(46932),n=e.i(94245),a=e.i(67696);let r={width:"100%",height:"500px",borderRadius:"16px"},s={lat:24.7136,lng:46.6753},p=t.default.memo(e=>{var p;let{Arabic:c,filters:d,onLocationSelect:u}=e,g=(0,n.useTranslations)("MapPage"),{isLoaded:x}=(0,i.useJsApiLoader)({id:"google-map-script",googleMapsApiKey:"AIzaSyA5uCMsffpxvv7inIY3x4_rcrq2c3Yjktk"}),{data:m,isLoading:h,error:y}=(0,a.useGetAllHospitals)(d),[b,v]=(0,t.useState)(null),[j,f]=(0,t.useState)(null),[w,C]=(0,t.useState)(null),S=(null==m?void 0:m.data)||[],k=(0,t.useCallback)(()=>{if(!navigator.geolocation)return void alert(g("noGeoSupport"));navigator.geolocation.getCurrentPosition(e=>{let o={lat:e.coords.latitude,lng:e.coords.longitude};f(o),null==b||b.panTo(o),null==b||b.setZoom(12),null==u||u(o)},()=>alert(g("locateError")))},[b,u,g]);if(h)return(0,o.jsx)("p",{className:"text-center py-10 text-gray-600",children:g("loading")});if(y)return(0,o.jsx)("p",{className:"text-center py-10 text-red-500",children:g("error")});let T=x?{url:"/icons/Map Point.png",scaledSize:new google.maps.Size(32,32),anchor:new google.maps.Point(16,32)}:void 0,z=x?{url:"/icons/Map Point.png",scaledSize:new google.maps.Size(28,28),anchor:new google.maps.Point(14,28)}:void 0;return(0,o.jsx)(l.motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},transition:{duration:.5},style:{position:"relative"},children:x&&(0,o.jsxs)(i.GoogleMap,{mapContainerStyle:r,center:j||s,zoom:6,onLoad:e=>v(e),options:{streetViewControl:!1,mapTypeControl:!1,fullscreenControl:!1},children:[(0,o.jsx)(l.motion.button,{onClick:k,whileHover:{scale:1.05},whileTap:{scale:.95},initial:{opacity:0,y:-10},animate:{opacity:1,y:0},transition:{duration:.4},style:{position:"absolute",top:"10px",right:"10px",zIndex:1e3,background:"#2563eb",color:"white",border:"none",borderRadius:"8px",padding:"8px 12px",cursor:"pointer",fontWeight:"bold",boxShadow:"0 2px 8px rgba(0,0,0,0.2)"},children:g("locateButton")}),j&&(0,o.jsx)(i.Marker,{position:j,icon:z,title:g("yourLocation")}),S.map(e=>{let t=parseFloat(e.lat),l=parseFloat(e.lng);return isNaN(t)||isNaN(l)?null:(0,o.jsx)(i.Marker,{position:{lat:t,lng:l},icon:T,onClick:()=>C(e)},e.id)}),w&&(0,o.jsx)(i.InfoWindow,{position:{lat:parseFloat(w.lat),lng:parseFloat(w.lng)},onCloseClick:()=>C(null),children:(0,o.jsxs)("div",{style:{width:"300px"},children:[(0,o.jsx)("h3",{style:{fontSize:"1rem",fontWeight:"bold",marginBottom:"4px"},children:w.name}),(0,o.jsxs)("p",{style:{marginBottom:"4px"},children:["📍 ",(null==(p=w.city)?void 0:p.name)||"غير محدد"]}),(0,o.jsx)("p",{children:w.address||"بدون عنوان"}),w.image&&(0,o.jsx)("img",{src:w.image,alt:w.name,style:{width:"100%",height:"100px",objectFit:"cover",borderRadius:"8px",marginTop:"6px"}})]})})]})})})},58059,e=>{e.n(e.i(51626))}]);