const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../assets/leaflet.CIGW-MKW.css"])))=>i.map(i=>d[i]);
import{_ as S}from"../chunks/PPVm8Dsz.js";import{a as l,f as n}from"../chunks/Bkzsmr9I.js";import{o as de}from"../chunks/trpXq522.js";import{d as ce,s as u,p as B,b as i,f as ve,t as _,h as pe,e as ge,c as r,g as o,$ as me,r as a,a as h}from"../chunks/Cjw4vZKn.js";import{d as fe,s as d,a as ue}from"../chunks/DfJQ0EIT.js";import{i as L}from"../chunks/kjB3f-xG.js";import{h as _e,e as Z,i as q}from"../chunks/DaCWmHjB.js";import{s as he}from"../chunks/RVjQLo13.js";import{s as xe}from"../chunks/CWOupeSg.js";var be=n(' '),ye=n('
'),we=n('
'),ke=n('
'),Oe=n(''),Ae=n(''),Ee=n('Klicke auf einen Marker um die zugehörigen Vorlagen zu sehen.
'),$e=n(' '),Ve=n('📍 Anträge auf der Karte Orte aus Anträgen und Anfragen in Hagen
',1);function Ke(J,Q){ce(Q,!0);let g=u(B([])),p=u(null),x=u(B([])),P=u(!0),b=null;const T=typeof window<"u"&&window.location.port==="5173"?`http://${window.location.hostname}:8099/api`:"/api",U=[51.361,7.476],W=12;async function X(){try{const t=await fetch(`${T}/orte`);t.ok&&h(g,await t.json(),!0)}catch(t){console.error("Fehler beim Laden der Orte:",t)}finally{h(P,!1)}}async function H(t){h(p,t,!0);try{const e=await fetch(`${T}/orte/${t.id}/vorlagen`);e.ok&&h(x,await e.json(),!0)}catch(e){console.error("Fehler:",e)}}de(async()=>{await X();const t=await S(()=>import("../chunks/CjPBq9Bq.js").then(e=>e.l),[],import.meta.url);await S(()=>Promise.resolve({}),__vite__mapDeps([0]),import.meta.url),b=t.map("map").setView(U,W),t.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:'© OpenStreetMap '}).addTo(b);for(const e of o(g)){const s=t.circleMarker([e.lat,e.lon],{radius:Math.min(8+e.vorlage_count*2,20),fillColor:"#16a34a",color:"#166534",weight:2,opacity:1,fillOpacity:.7}).addTo(b);s.bindPopup(`
${e.name}
${e.vorlage_count} Vorlage(n)
`),s.on("click",()=>H(e))}});var j=Ve();_e("hbihfm",t=>{var e=be();ge(()=>{me.title="Karte - Antragstracker Hagen"}),l(t,e)});var G=i(ve(j),2),y=r(G),w=r(y),Y=r(w);{var ee=t=>{var e=ye();l(t,e)},te=t=>{var e=we();l(t,e)};L(Y,t=>{o(P)?t(ee):t(te,-1)})}a(w);var I=i(w,2),ae=r(I);a(I),a(y);var K=i(y,2),N=r(K);{var re=t=>{var e=Ae(),s=r(e),v=r(s,!0);a(s);var c=i(s,2),k=r(c);a(c);var m=i(c,2);{var O=A=>{var E=Oe();Z(E,21,()=>o(x),q,(se,f)=>{var $=ke(),V=r($),M=r(V),z=r(M),ie=r(z,!0);a(z);var D=i(z,2),le=r(D,!0);a(D),a(M);var F=i(M,2),ne=r(F,!0);a(F),a(V),a($),_(()=>{he(V,"href",`/vorlagen/${o(f).id??""}`),d(ie,o(f).aktenzeichen),d(le,o(f).typ),d(ne,o(f).betreff)}),l(se,$)}),a(E),l(A,E)};L(m,A=>{o(x).length>0&&A(O)})}a(e),_(()=>{d(v,o(p).name),d(k,`${o(p).vorlage_count??""} Vorlage(n) betreffen diesen Ort`)}),l(t,e)},oe=t=>{var e=Ee();l(t,e)};L(N,t=>{o(p)?t(re):t(oe,-1)})}var R=i(N,2),C=i(r(R),2);Z(C,21,()=>o(g),q,(t,e)=>{var s=$e(),v=r(s),c=r(v),k=r(c,!0);a(c);var m=i(c,2),O=r(m);a(m),a(v),a(s),_(()=>{xe(v,1,`w-full text-left px-3 py-2 rounded-lg hover:bg-gray-50 transition-colors text-sm
${o(p)?.id===o(e).id?"bg-green-50 text-green-700":"text-gray-700"}`),d(k,o(e).name),d(O,`(${o(e).vorlage_count??""})`)}),ue("click",v,()=>H(o(e))),l(t,s)}),a(C),a(R),a(K),a(G),_(()=>d(ae,`${o(g).length??""} Orte geocodiert • Marker-Größe = Anzahl Vorlagen`)),l(J,j),pe()}fe(["click"]);export{Ke as component};