(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,51892,22305,e=>{"use strict";var t=e.i(24049),n=e.i(50699),o=e.i(82310),i=e.i(32322);let l=(0,n.createLayerComponent)(function({position:e,...n},l){let a=new i.Marker(e,n);return(0,t.createElementObject)(a,(0,o.extendContext)(l,{overlayContainer:a}))},function(e,t,n){t.position!==n.position&&e.setLatLng(t.position),null!=t.icon&&t.icon!==n.icon&&e.setIcon(t.icon),null!=t.zIndexOffset&&t.zIndexOffset!==n.zIndexOffset&&e.setZIndexOffset(t.zIndexOffset),null!=t.opacity&&t.opacity!==n.opacity&&e.setOpacity(t.opacity),null!=e.dragging&&t.draggable!==n.draggable&&(!0===t.draggable?e.dragging.enable():e.dragging.disable())});e.s(["Marker",0,l],51892);var a=e.i(71645);let r=(0,n.createOverlayComponent)(function(e,n){let o=new i.Popup(e,n.overlayContainer);return(0,t.createElementObject)(o,n)},function(e,t,{position:n},o){(0,a.useEffect)(function(){let{instance:i}=e;function l(e){e.popup===i&&(i.update(),o(!0))}function a(e){e.popup===i&&o(!1)}return t.map.on({popupopen:l,popupclose:a}),null==t.overlayContainer?(null!=n&&i.setLatLng(n),i.openOn(t.map)):t.overlayContainer.bindPopup(i),function(){t.map.off({popupopen:l,popupclose:a}),t.overlayContainer?.unbindPopup(),t.map.removeLayer(i)}},[e,t,o,n])});e.s(["Popup",0,r],22305)},53270,e=>{"use strict";var t=e.i(43476),n=e.i(71645),o=e.i(10007),i=e.i(23177),l=e.i(54346),a=e.i(36730),r=e.i(51892),c=e.i(22305);let s=new(e.i(32322)).default.Icon({iconUrl:"https://cdn-icons-png.flaticon.com/512/684/684908.png",iconSize:[35,35],iconAnchor:[17,35]});function p({center:e}){let t=(0,a.useMap)();return(0,n.useEffect)(()=>{e&&e[0]&&e[1]&&t.setView(e,15)},[e,t]),null}e.s(["default",0,function({seccionElectoral:e}){let[a,u]=(0,n.useState)(null),[d,f]=(0,n.useState)(null),[g,x]=(0,n.useState)(!0);if((0,n.useEffect)(()=>{e&&(x(!0),fetch(`/api/maps?seccion=${e}`).then(e=>e.json()).then(e=>{u(e),x(!1)}).catch(()=>x(!1)))},[e]),g)return(0,t.jsx)("div",{className:"h-[250px] flex items-center justify-center text-[10px] font-black uppercase text-gray-500 animate-pulse",children:"Sincronizando..."});let h=[18.845,-99.184];if(a?.features?.length>0){let e=a.features[0].geometry,t=null;"MultiPolygon"===e.type?t=e.coordinates[0][0][0]:"Polygon"===e.type&&(t=e.coordinates[0][0]),t&&t[1]&&t[0]&&(h=[t[1],t[0]])}return(0,t.jsxs)("div",{className:"flex flex-col gap-4 w-full",children:[(0,t.jsx)("button",{onClick:()=>{if(!navigator.geolocation)return alert("GPS no soportado");navigator.geolocation.getCurrentPosition(e=>f([e.coords.latitude,e.coords.longitude]),()=>alert("Activa el GPS de tu dispositivo"))},className:"w-full bg-blue-600 hover:bg-blue-700 text-white font-black py-4 rounded-2xl shadow-lg transition-all flex items-center justify-center gap-2 text-[10px] uppercase italic tracking-widest",children:"📍 ¿DÓNDE ESTOY?"}),(0,t.jsx)("div",{className:"h-[300px] w-full rounded-[2rem] overflow-hidden border border-gray-800 relative shadow-2xl",children:(0,t.jsxs)(o.MapContainer,{center:h,zoom:15,style:{height:"100%",width:"100%"},zoomControl:!1,children:[(0,t.jsx)(p,{center:d||h}),(0,t.jsx)(i.TileLayer,{url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",attribution:"© OpenStreetMap"}),a&&(0,t.jsx)(l.GeoJSON,{data:a,style:{color:"#ec4899",weight:4,fillColor:"#ec4899",fillOpacity:.25}},e),d&&(0,t.jsx)(r.Marker,{position:d,icon:s,children:(0,t.jsx)(c.Popup,{children:"Estás aquí"})})]})})]})}])},63995,e=>{e.n(e.i(53270))}]);