1import{a0 as k,a1 as S,a2 as w,b as N,a3 as te,r as o,e as L,ae as O,j as e}from"./index-B4mWWRqi.js";const re=k({method:"POST"}).middleware([S]).handler(w("09cb2f40aa5471ec6f9c5f787624a114a7b6b926d22698007bd78be5b473dc78")),ae=k({method:"GET"}).middleware([S]).handler(w("3977a0ce041904c3ec4a8258e7ba23d98f01af56b1502583281f8cfffa6507e3")),se=k({method:"POST"}).middleware([S]).handler(w("31622c9bc8d7d3e6785b888392f4b267f2b7829978264b898909bfca0299560d")),de=k({method:"POST"}).middleware([S]).handler(w("b213ad0d3c0f294709da198e2a9406db81da30151b2140a8736731ed5864720a")),ne=k({method:"GET"}).middleware([S]).handler(w("269c68bd5cc706322d58ebb7a97c0b1bec73522d886da58f6a2edc74e4e9310b")),oe=k({method:"POST"}).middleware([S]).handler(w("854922a4b422ec78b837782ab27cd91f1b73082e473d605285831845a60c098f")),G={feature:"Feature",improvement:"Verbesserung",fix:"Fehlerbehebung"},U={feature:"bg-emerald-500/15 text-emerald-600 dark:text-emerald-400 border-emerald-500/30",improvement:"bg-sky-500/15 text-sky-600 dark:text-sky-400 border-sky-500/30",fix:"bg-amber-500/15 text-amber-600 dark:text-amber-400 border-amber-500/30"};function ie(r){return new Date(r).toLocaleDateString("de-DE",{year:"numeric",month:"long",day:"2-digit",weekday:"long"})}function le(r){return new Date(r).toLocaleTimeString("de-DE",{hour:"2-digit",minute:"2-digit"})}function ce(r){const n=new Date(r);return`${n.getFullYear()}-${String(n.getMonth()+1).padStart(2,"0")}-${String(n.getDate()).padStart(2,"0")}`}function ue(r){const n=new Date(r),l=c=>String(c).padStart(2,"0");return`${n.getFullYear()}-${l(n.getMonth()+1)}-${l(n.getDate())}T${l(n.getHours())}:${l(n.getMinutes())}`}function me(r){return new Date(r).toISOString()}function xe(){const r=N(re),n=N(ae),l=N(se),c=N(de),x=N(oe),C=N(ne),i=te(),[m,y]=o.useState(""),[u,T]=o.useState([]),[h,F]=o.useState([]),[f,M]=o.useState(""),[s,P]=o.useState(""),[A,$]=o.useState(null),[g,v]=o.useState(1),[p,Y]=o.useState(50),B=o.useMemo(()=>({search:m||void 0,types:u.length>0?u:void 0,tags:h.length>0?h:void 0,from:f?new Date(f).toISOString():void 0,to:s?new Date(`${s}T23:59:59`).toISOString():void 0,limit:p,offset:(g-1)*p}),[m,u,h,f,s,g,p]);o.useEffect(()=>{v(1)},[m,u,h,f,s,p]);const _=L({queryKey:["admin","changelog",B],queryFn:()=>r({data:B})}),Z=L({queryKey:["admin","changelog-tags"],queryFn:()=>n()}),j=L({queryKey:["admin","changelog-stats"],queryFn:()=>C()}),I=O({mutationFn:t=>l({data:t}),onSuccess:()=>{i.invalidateQueries({queryKey:["admin","changelog"]}),i.invalidateQueries({queryKey:["admin","changelog-tags"]}),i.invalidateQueries({queryKey:["admin","changelog-stats"]}),$(null)}}),R=O({mutationFn:t=>c({data:{id:t}}),onSuccess:()=>{i.invalidateQueries({queryKey:["admin","changelog"]}),i.invalidateQueries({queryKey:["admin","changelog-stats"]})}}),b=O({mutationFn:()=>x(),onSuccess:()=>{i.invalidateQueries({queryKey:["admin","changelog"]}),i.invalidateQueries({queryKey:["admin","changelog-tags"]}),i.invalidateQueries({queryKey:["admin","changelog-stats"]})}}),z=_.data?.items??[],E=_.data?.total??0,D=Math.max(1,Math.ceil(E/p)),H=E===0?0:(g-1)*p+1,W=Math.min(g*p,E),V=o.useMemo(()=>{const t=new Map;for(const d of z){const a=ce(d.occurred_at),q=t.get(a)??[];q.push(d),t.set(a,q)}return Array.from(t.entries()).sort((d,a)=>d[0]<a[0]?1:-1)},[z]);function K(t){T(d=>d.includes(t)?d.filter(a=>a!==t):[...d,t])}function J(t){F(d=>d.includes(t)?d.filter(a=>a!==t):[...d,t])}function X(){y(""),T([]),F([]),M(""),P(""),v(1)}function ee(){$({occurred_at:new Date().toISOString(),entry_type:"feature",title:"",description:"",tags:[],source:"manual"})}return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("header",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Changelog"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Chronologisches Ãnderungsprotokoll â Features, Verbesserungen, Fehlerbehebungen."})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>b.mutate(),disabled:b.isPending,className:"rounded-md border border-border bg-background px-4 py-2 text-sm font-medium hover:bg-muted disabled:opacity-50",title:"Importiert neue Migrationen, Git-Commits und Deploy-Events",children:b.isPending?"Synchronisiereâ¦":"Aus System-Ãnderungen aktualisieren"}),e.jsx("button",{onClick:ee,className:"rounded-md bg-primary text-primary-foreground px-4 py-2 text-sm font-medium hover:opacity-90",children:"+ Neuer Eintrag"})]})]}),b.data&&e.jsxs("div",{className:"rounded-md border border-emerald-500/30 bg-emerald-500/10 px-3 py-2 text-sm text-emerald-700 dark:text-emerald-300",children:["Sync abgeschlossen: ",b.data.inserted," neue Einträge (",b.data.scanned," geprüft, ",b.data.skipped," bereits vorhanden)."]}),b.isError&&e.jsxs("div",{className:"rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive",children:["Sync fehlgeschlagen: ",b.error?.message??"unbekannter Fehler"]}),e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[e.jsx(Q,{label:"Features",value:j.data?.features??null,active:u.includes("feature"),onClick:()=>K("feature"),className:"bg-emerald-500/10 border-emerald-500/30 text-emerald-700 dark:text-emerald-300",activeClassName:"ring-2 ring-emerald-500"}),e.jsx(Q,{label:"Verbesserungen",value:j.data?.improvements??null,active:u.includes("improvement"),onClick:()=>K("improvement"),className:"bg-sky-500/10 border-sky-500/30 text-sky-700 dark:text-sky-300",activeClassName:"ring-2 ring-sky-500"}),e.jsx(Q,{label:"Fehlerbehebungen",value:j.data?.fixes??null,active:u.includes("fix"),onClick:()=>K("fix"),className:"bg-amber-500/10 border-amber-500/30 text-amber-700 dark:text-amber-300",activeClassName:"ring-2 ring-amber-500"}),e.jsx(Q,{label:"Letztes Update",value:j.data?j.data.lastUpdate?new Date(j.data.lastUpdate).toLocaleDateString("de-DE",{year:"numeric",month:"2-digit",day:"2-digit"}):"â":null,className:"bg-primary/10 border-primary/30 text-primary"})]}),e.jsxs("div",{className:"rounded-lg border border-border bg-card p-4 space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap gap-3 items-end",children:[e.jsxs("div",{className:"flex-1 min-w-[200px]",children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Suche"}),e.jsx("input",{value:m,onChange:t=>y(t.target.value),placeholder:"Titel oder Beschreibungâ¦",className:"mt-1 w-full rounded-md border border-border bg-background px-3 py-2 text-sm"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Von"}),e.jsx("input",{type:"date",value:f,onChange:t=>M(t.target.value),className:"mt-1 rounded-md border border-border bg-background px-3 py-2 text-sm"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Bis"}),e.jsx("input",{type:"date",value:s,onChange:t=>P(t.target.value),className:"mt-1 rounded-md border border-border bg-background px-3 py-2 text-sm"})]}),e.jsx("button",{onClick:X,className:"rounded-md border border-border bg-background px-3 py-2 text-sm hover:bg-muted",children:"Zurücksetzen"})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[["feature","improvement","fix"].map(t=>{const d=u.includes(t);return e.jsx("button",{onClick:()=>K(t),className:`text-xs px-2.5 py-1 rounded-full border transition ${d?U[t]:"border-border text-muted-foreground hover:bg-muted"}`,children:G[t]},t)}),e.jsx("span",{className:"mx-2 text-border",children:"|"}),(Z.data??[]).map(t=>{const d=h.includes(t);return e.jsxs("button",{onClick:()=>J(t),className:`text-xs px-2.5 py-1 rounded-full border transition ${d?"bg-primary/15 text-primary border-primary/30":"border-border text-muted-foreground hover:bg-muted"}`,children:["#",t]},t)})]})]}
1),_.isLoading?e.jsx("p",{className:"text-sm text-muted-foreground",children:"Ladeâ¦"}):V.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"Keine Einträge gefunden."}):e.jsx("div",{className:"space-y-8",children:V.map(([t,d])=>e.jsxs("section",{children:[e.jsx("h2",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wider mb-3 border-b border-border pb-2",children:ie(d[0].occurred_at)}),e.jsx("ul",{className:"space-y-3",children:d.map(a=>e.jsx("li",{className:"group rounded-lg border border-border bg-card p-4 hover:border-primary/40 transition",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:`text-[10px] px-2 py-0.5 rounded-full border font-medium ${U[a.entry_type]}`,children:G[a.entry_type]}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[le(a.occurred_at)," Uhr"]}),a.tags.map(q=>e.jsxs("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:["#",q]},q)),a.source==="chat-import"&&e.jsx("span",{className:"text-[10px] text-muted-foreground italic",children:"automatisch importiert"})]}),e.jsx("h3",{className:"mt-1 font-medium",children:a.title}),a.description&&e.jsx("p",{className:"mt-1 text-sm text-muted-foreground whitespace-pre-wrap",children:a.description})]}),e.jsxs("div",{className:"flex gap-1 opacity-0 group-hover:opacity-100 transition",children:[e.jsx("button",{onClick:()=>$(a),className:"text-xs px-2 py-1 rounded border border-border hover:bg-muted",children:"Bearbeiten"}),e.jsx("button",{onClick:()=>{confirm("Eintrag löschen?")&&R.mutate(a.id)},className:"text-xs px-2 py-1 rounded border border-border hover:bg-destructive hover:text-destructive-foreground",children:"Löschen"})]})]})},a.id))})]},t))}),E>0&&e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 rounded-lg border border-border bg-card px-4 py-3 text-sm",children:[e.jsxs("div",{className:"text-muted-foreground",children:[H,"â",W," von ",E]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:"Pro Seite"}),e.jsx("select",{value:p,onChange:t=>Y(Number(t.target.value)),className:"rounded-md border border-border bg-background px-2 py-1 text-sm",children:[25,50,100,200].map(t=>e.jsx("option",{value:t,children:t},t))}),e.jsx("button",{onClick:()=>v(1),disabled:g<=1,className:"rounded-md border border-border bg-background px-2 py-1 text-sm hover:bg-muted disabled:opacity-40",children:"«"}),e.jsx("button",{onClick:()=>v(t=>Math.max(1,t-1)),disabled:g<=1,className:"rounded-md border border-border bg-background px-3 py-1 text-sm hover:bg-muted disabled:opacity-40",children:"Zurück"}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["Seite ",g," / ",D]}),e.jsx("button",{onClick:()=>v(t=>Math.min(D,t+1)),disabled:g>=D,className:"rounded-md border border-border bg-background px-3 py-1 text-sm hover:bg-muted disabled:opacity-40",children:"Weiter"}),e.jsx("button",{onClick:()=>v(D),disabled:g>=D,className:"rounded-md border border-border bg-background px-2 py-1 text-sm hover:bg-muted disabled:opacity-40",children:"»"})]})]}),A&&e.jsx(ge,{entry:A,onClose:()=>$(null),onSave:t=>I.mutate(t),saving:I.isPending})]})}function ge({entry:r,onClose:n,onSave:l,saving:c}){const[x,C]=o.useState(ue(r.occurred_at??new Date().toISOString())),[i,m]=o.useState(r.entry_type??"feature"),[y,u]=o.useState(r.title??""),[T,h]=o.useState(r.description??""),[F,f]=o.useState((r.tags??[]).join(", "));function M(s){s.preventDefault(),l({id:r.id,occurred_at:me(x),entry_type:i,title:y.trim(),description:T.trim(),tags:F.split(",").map(P=>P.trim()).filter(Boolean),source:r.source??"manual"})}return e.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 flex items-center justify-center p-4",onClick:n,children:e.jsxs("form",{onClick:s=>s.stopPropagation(),onSubmit:M,className:"w-full max-w-lg rounded-lg border border-border bg-card p-6 space-y-4",children:[e.jsx("h2",{className:"text-lg font-semibold",children:r.id?"Eintrag bearbeiten":"Neuer Eintrag"}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium",children:"Datum & Zeit"}),e.jsx("input",{type:"datetime-local",value:x,onChange:s=>C(s.target.value),className:"mt-1 w-full rounded-md border border-border bg-background px-3 py-2 text-sm",required:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium",children:"Typ"}),e.jsxs("select",{value:i,onChange:s=>m(s.target.value),className:"mt-1 w-full rounded-md border border-border bg-background px-3 py-2 text-sm",children:[e.jsx("option",{value:"feature",children:"Feature"}),e.jsx("option",{value:"improvement",children:"Verbesserung"}),e.jsx("option",{value:"fix",children:"Fehlerbehebung"})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium",children:"Titel"}),e.jsx("input",{value:y,onChange:s=>u(s.target.value),className:"mt-1 w-full rounded-md border border-border bg-background px-3 py-2 text-sm",required:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium",children:"Beschreibung"}),e.jsx("textarea",{value:T,onChange:s=>h(s.target.value),rows:5,className:"mt-1 w-full rounded-md border border-border bg-background px-3 py-2 text-sm"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium",children:"Tags (Komma-getrennt)"}),e.jsx("input",{value:F,onChange:s=>
1f(s.target.value),placeholder:"CMS, Newsletter, Bookingâ¦",className:"mt-1 w-full rounded-md border border-border bg-background px-3 py-2 text-sm"})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx("button",{type:"button",onClick:n,className:"rounded-md border border-border bg-background px-4 py-2 text-sm hover:bg-muted",children:"Abbrechen"}),e.jsx("button",{type:"submit",disabled:c||y.trim().length===0,className:"rounded-md bg-primary text-primary-foreground px-4 py-2 text-sm font-medium hover:opacity-90 disabled:opacity-50",children:c?"Speichernâ¦":"Speichern"})]})]})})}function Q({label:r,value:n,className:l,onClick:c,active:x,activeClassName:C}){const i=`rounded-lg border p-4 text-left w-full transition ${l??"bg-card border-border"} ${x?C??"ring-2 ring-primary":""} ${c?"hover:opacity-90 cursor-pointer":""}`,m=e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"text-xs font-medium uppercase tracking-wider opacity-80",children:[r,x&&e.jsx("span",{className:"ml-2 normal-case opacity-70",children:"· aktiv"})]}),e.jsx("div",{className:"mt-1 text-2xl font-bold tabular-nums",children:n===null?"â¦":n})]});return c?e.jsx("button",{type:"button",onClick:c,className:i,"aria-pressed":!!x,children:m}):e.jsx("div",{className:i,children:m})}export{xe as component};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.