1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index.esm-CQ_Nafil.js","assets/index-CPP4aw51.js","assets/index-BfvdTsnn.css"])))=>i.map(i=>d[i]); 2import{y as qs,p as Ae,f as m,e as C,t as j,m as Z,ad as rs,q as T,w as M,n as us,o as me,u as Js,a as Gs,_ as Ks,V as wt,r as d,W as P,R as is,b as he,j as e,O as Je,ac as Ie,P as Zs,S as Le,M as ft,C as jt,J as De,X as z,L as vt,U as ls,a6 as Ge,B as W,Q as X,a1 as Ys,a2 as Qs,a3 as Xs,a4 as ea,af as Me,ag as ta,H as sa,g as aa}from"./index-CPP4aw51.js";import{B as os}from"./config-BRsQMxtB.js";import{g as na}from"./members-ehv7A5Td.js";import{s as cs}from"./notifications-OodVPZ5q.js";import{A as ra}from"./arrow-left-FTGe0X4D.js";import{H as ia}from"./history-DXlCqyji.js";import{S as la}from"./shield-mFfui3SW.js";import{T as se}from"./trash-2-G2KzcNqy.js";import{U as Ke}from"./users-CqkkHayf.js";import{C as _e}from"./check-xcPbKcoX.js";import{T as oa}from"./triangle-alert-CRJ7xhzl.js";import{S as Nt}from"./search-CgcqduWw.js";import{F as kt}from"./file-spreadsheet-CSxaokGz.js";import{A as ca}from"./arrow-right-VTP-JGFX.js";import{S as da}from"./index.esm-CQ_Nafil.js";import{L as ha}from"./layout-grid-DhnFHpT-.js";import{C as ma}from"./copy-hx-aCJls.js";import{S as ds}from"./square-check-big-QMCMVyfg.js";import{U as xa}from"./upload-Dazp3q2K.js";const ua=[["path",{d:"m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9",key:"1hayfq"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"15ts47"}]],hs=qs("hammer",ua);async function pa(h,c,b,g,v){const x=Ae(m),f=C(j(m,"work_assignments"));x.set(f,{memberId:h,hours:Number(c),description:b,date:g,createdAt:Z(),createdBy:v});const y=C(m,"club_members",h);x.update(y,{workHoursSaldo:rs(Number(c))});const O=T(us(m,"profiles"),M("linkedMemberId","==",h)),H=await me(O);H.empty||H.docs.forEach($=>{x.update($.ref,{workHours:rs(Number(c))})}),await x.commit()}const A=({children:h,className:c="",onClick:b,style:g})=>e.jsxs("div",{onClick:b,style:g,className:` 3 group relative overflow-hidden rounded-3xl 4 border border-white/10 bg-[#12141c]/40 backdrop-blur-xl 5 shadow-2xl shadow-black/20 6 transition-all duration-300 ease-out 7 ${b?"active:scale-[0.98] cursor-pointer hover:bg-white/[0.08] hover:border-white/20":""} 8 ${c} 9 `,children:[e.jsx("div",{className:"absolute inset-0 rounded-3xl shadow-[inset_0_1px_0_0_rgba(255,255,255,0.1)] pointer-events-none"}),h]}),Ze=({title:h,icon:c,color:b,onClick:g,subtitle:v,badge:x})=>{const f={blue:"from-blue-600 to-blue-400 shadow-blue-500/20 border-blue-400/20",orange:"from-orange-600 to-amber-500 shadow-orange-500/20 border-orange-400/20",purple:"from-purple-600 to-indigo-400 shadow-purple-500/20 border-purple-400/20",red:"from-red-600 to-rose-500 shadow-red-500/20 border-red-400/20"},y=f[b]||f.blue;return e.jsxs("div",{onClick:g,className:`relative overflow-hidden rounded-3xl p-6 cursor-pointer group active:scale-95 transition-all duration-300 border bg-gradient-to-br ${y} min-h-[160px] flex flex-col justify-between`,children:[e.jsx("div",{className:"absolute top-0 right-0 p-4 opacity-10 group-hover:opacity-20 transition-opacity transform group-hover:scale-110 duration-500",children:e.jsx(c,{className:"w-32 h-32 text-white"})}),e.jsx("div",{className:"relative z-10",children:e.jsx("div",{className:"w-12 h-12 rounded-2xl bg-white/20 backdrop-blur-md flex items-center justify-center mb-4 shadow-lg border border-white/10",children:e.jsx(c,{className:"w-6 h-6 text-white"})})}),e.jsxs("div",{className:"relative z-10",children:[e.jsx("h3",{className:"text-2xl font-black text-white tracking-tighter uppercase leading-none mb-1 drop-shadow-lg",children:h}),e.jsx("p",{className:"text-xs text-white/90 font-bold uppercase tracking-widest opacity-80",children:v})]}),x>0&&e.jsx("div",{className:"absolute top-4 right-4 bg-red-500 text-white text-xs font-black px-2 py-1 rounded-full shadow-lg animate-pulse border border-white/20",children:x})]})},Te=h=>h?new Date(h).toLocaleDateString("de-DE",{weekday:"short",day:"2-digit",month:"2-digit"}):"",ms=(h,c)=>{const b=new Date(h);return c==="daily"?b.setDate(b.getDate()+1):c==="weekly"?b.setDate(b.getDate()+7):c==="monthly"?b.setMonth(b.getMonth()+1):c==="quarterly"?b.setMonth(b.getMonth()+3):c==="semi-annually"?b.setMonth(b.getMonth()+6):c==="annually"&&b.setFullYear(b.getFullYear()+1),b.toISOString().split("T")[0]},Ye=async(h,c,b,g,v="info",x=null)=>{if(h)try{await X(j(m,"users",h,"notifications"),{title:b,message:g,type:v,link:x,read:!1,createdAt:Z(),targetProfileId:c,targetUserId:h,targetCompositeId:`${h}_${c}`})}catch(f){console.error("Notification failed",f)}},xe=(h,c)=>!h||!c?"":`${h}_${c}`,q=h=>{const c=h.docs.map(b=>({id:b.id,...b.data()}));return new Map(c.map(b=>[b.id,b]))},yt=(...h)=>{const c=new Map;return h.forEach(b=>{b.forEach((g,v)=>c.set(v,g))}),Array.from(c.values()).sort((b,g)=>g.date.localeCompare(b.date))},xs=({profile:h,ownerName:c,title:b,date:g,hours:v,status:x,createdByAdmin:f,source:y})=>({assignmentSchemaVersion:2,subjectType:"profile",userId:h.id,userAccountUid:h.accountUid,userProfileId:h.id,compositeId:xe(h.accountUid,h.id
9),linkedMemberId:h.linkedMemberId||null,owner:c,userName:c,title:b,date:g,hours:v,status:x,source:y,createdAt:Z(),...f?{createdByAdmin:f}:{}}),Ct=async({accountUid:h,profileId:c,linkedMemberId:b})=>{if(!h||!c)return;const g=C(m,"users",h,"profiles",c),v=await aa(g),x=b||v.data()?.linkedMemberId||null,f=new Map;(await Promise.all([me(T(j(m,"work_assignments"),M("compositeId","==",xe(h,c)))),me(T(j(m,"work_assignments"),M("userAccountUid","==",h),M("userProfileId","==",c))),x?me(T(j(m,"work_assignments"),M("memberId","==",x))):Promise.resolve(null),x?me(T(j(m,"work_assignments"),M("userId","==",x))):Promise.resolve(null)])).forEach($=>{$&&$.docs.forEach(K=>{f.set(K.id,{id:K.id,...K.data()})})});const O=Array.from(f.values()).filter($=>$.status==="confirmed").reduce(($,K)=>$+Number(K.hours||0),0),H=Ae(m);if(H.update(g,{workHours:O,workHoursUpdatedAt:Z()}),x){const $=C(m,"club_members",x);H.update($,{workHoursSaldo:O,workHoursUpdatedAt:Z()})}await H.commit()},ba=h=>{const c=h.filter(x=>x.status==="confirmed"||x.status==="pending").reduce((x,f)=>{const y=f.date.substring(0,7);return x[y]||(x[y]={confirmed:0,pending:0}),f.status==="confirmed"?x[y].confirmed+=Number(f.hours):x[y].pending+=Number(f.hours),x},{}),b=Object.keys(c).sort((x,f)=>x.localeCompare(f));if(b.length===0)return e.jsx("div",{className:"text-center py-12 text-white/30 italic",children:"Keine Einträge für dieses Jahr vorhanden."});const g=b.reduce((x,f)=>x+c[f].confirmed,0),v=b.reduce((x,f)=>x+c[f].pending,0);return e.jsxs(A,{className:"p-5 border-l-4 border-l-purple-500",children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsx("h4",{className:"font-black text-lg text-white",children:"Jahresübersicht"}),e.jsxs("div",{className:"flex gap-2",children:[v>0&&e.jsxs("div",{className:"bg-orange-500/20 text-orange-400 px-3 py-1 rounded-lg font-black text-sm flex items-center gap-1",children:[e.jsx(De,{className:"h-3 w-3"})," ",v,"h"]}),e.jsxs("div",{className:"bg-purple-500/20 text-purple-400 px-3 py-1 rounded-lg font-black text-sm flex items-center gap-1",children:[e.jsx(_e,{className:"h-4 w-4"})," ",g,"h"]})]})]}),e.jsx("div",{className:"space-y-0",children:b.map(x=>{const y=new Date(x+"-01").toLocaleDateString("de-DE",{month:"long"});return e.jsxs("div",{className:"flex justify-between items-center text-sm py-2.5 border-t border-white/5",children:[e.jsx("span",{className:"text-white/70 font-medium",children:y}),e.jsxs("div",{className:"flex items-center gap-2",children:[c[x].pending>0&&e.jsxs("span",{className:"text-orange-400 font-bold text-xs",children:[c[x].pending,"h ausstehend"]}),e.jsxs("span",{className:"text-teal-400 font-black",children:[c[x].confirmed,"h"]})]})]},x)})})]})},ga=h=>{const c=h.filter(g=>g.status==="confirmed"||g.status==="pending").reduce((g,v)=>{const x=v.date.substring(0,7);return g[x]||(g[x]={totalHours:0,pendingHours:0,entries:[]}),v.status==="confirmed"?g[x].totalHours+=Number(v.hours):g[x].pendingHours+=Number(v.hours),g[x].entries.push(v),g},{}),b=Object.keys(c).sort((g,v)=>v.localeCompare(g));return b.length===0?e.jsx("div",{className:"text-center py-12 text-white/30 italic",children:"Keine Einträge für diesen Zeitraum vorhanden."}):b.map(g=>{const x=new Date(g+"-01").toLocaleDateString("de-DE",{month:"long",year:"numeric"});return e.jsxs(A,{className:"p-5 border-l-4 border-l-teal-500 mb-4",children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsx("h4",{className:"font-black text-lg text-white",children:x}),e.jsxs("div",{className:"flex gap-2",children:[c[g].pendingHours>0&&e.jsxs("div",{className:"bg-orange-500/20 text-orange-400 px-3 py-1 rounded-lg font-black text-sm flex items-center gap-1",children:[e.jsx(De,{className:"h-3 w-3"})," ",c[g].pendingHours,"h"]}),e.jsxs("div",{className:"bg-teal-500/20 text-teal-400 px-3 py-1 rounded-lg font-black text-sm flex items-center gap-1",children:[e.jsx(_e,{className:"h-4 w-4"})," ",c[g].totalHours,"h"]})]})]}),e.jsx("div",{className:"space-y-2",children:c[g].entries.map((f,y)=>e.jsxs("div",{className:"flex justify-between items-center text-sm py-2 border-t border-white/5",children:[e.jsxs("span",{className:"text-white/70",children:[f.date.split("-").reverse().join(".")," - ",f.title]}),e.jsxs("div",{className:"flex items-center gap-2",children:[f.status==="pending"&&e.jsx("span",{className:"text-[9px] uppercase font-black text-orange-500 bg-orange-500/10 px-2 py-0.5 rounded",children:"Wartet"}),e.jsxs("span",{className:`font-bold ${f.status==="pending"?"text-orange-400":"text-teal-400"}`,children:[f.hours,"h"]})]})]},y))})]},g)})};function Ua({user:h}){const c=Js(),b=Gs(),[g,v]=Ks(),x=wt(h,"groundskeeper")||wt(h,"board")||wt(h,"admin"),f=h.targetWorkHours||0,[y,O]=d.useState("dashboard"),[H,$]=d.useState("review"),[K,St]=d.useState("templates"),ps=()=>
9{if(y!=="dashboard"){O("dashboard");return}window.history.length>1?b(-1):b("/",{replace:!0})},Ee=g.get("oppId");d.useEffect(()=>(document.body.style.overflow="hidden",()=>{document.body.style.overflow="auto"}),[]);const[ue,bs]=d.useState(()=>{try{const t=localStorage.getItem("pwa_work_opportunities_cache");return t?JSON.parse(t):[]}catch{return[]}}),[Pe,It]=d.useState(()=>{try{const t=localStorage.getItem("pwa_work_assignments_cache");return t?JSON.parse(t):[]}catch{return[]}}),[Re,gs]=d.useState([]),[Lt,ws]=d.useState([]),[Mt,fs]=d.useState([]),[wa,js]=d.useState(()=>!localStorage.getItem("pwa_work_opportunities_cache")),[He,ae]=d.useState(!1),[p,F]=d.useState({title:"",date:"",time:"10:00",location:"Clubanlage",description:"",isTemplate:!1,isRecurring:!1,interval:"monthly",recipients:[],requiredParticipants:""}),[$e,Tt]=d.useState(""),[fa,vs]=d.useState(null);d.useEffect(()=>{if(!Ee||!ue||ue.length===0)return;O("opportunities"),vs(Ee),window.setTimeout(()=>{const s=document.getElementById(`opp-${Ee}`);s&&s.scrollIntoView({behavior:"smooth",block:"center"})},50);const t=new URLSearchParams(g);t.delete("oppId"),v(t,{replace:!0})},[Ee,ue,g,v]);const[Qe,At]=d.useState(""),[Xe,Dt]=d.useState(""),[et,_t]=d.useState(""),[ne,tt]=d.useState(null),[Et,Ns]=d.useState([]),[Y,ks]=d.useState([]),[pe,Pt]=d.useState(""),[ys,Rt]=d.useState([]),[Cs,Ht]=d.useState(!1),[N,$t]=d.useState(null),[st,Ut]=d.useState([]),[B,Ue]=d.useState({hours:"",description:"",date:new Date().toISOString().split("T")[0]}),[zt,at]=d.useState(!1),[re,Ss]=d.useState([]),[ze,ie]=d.useState(!1),[Be,be]=d.useState(!1),[ge,Bt]=d.useState(""),[nt,Ot]=d.useState(""),[rt,Ft]=d.useState("Clubanlage"),[we,it]=d.useState(null),[Vt,lt]=d.useState(""),[J,G]=d.useState([{date:"",times:[{timeLabel:"morgens",maxHelpers:"4"}]}]),[le,ot]=d.useState(!1),[fe,Wt]=d.useState(""),[je,qt]=d.useState(""),[ve,Jt]=d.useState("weekly"),[ct,oe]=d.useState([{timeLabel:"morgens",maxHelpers:"4"}]),[Gt,Kt]=d.useState(!1),[D,Ne]=d.useState(null),[Oe,Fe]=d.useState(""),[E,ce]=d.useState(null),[Q,Zt]=d.useState(""),[ee,Yt]=d.useState(""),[Ve,Qt]=d.useState(""),[te,R]=d.useState([]),[dt,de]=d.useState(!1),[ke,ht]=d.useState(""),[ye,mt]=d.useState(""),[Ce,Is]=d.useState("weekly"),[xt,Se]=d.useState([{timeLabel:"morgens",maxHelpers:"4"}]),Xt=d.useRef({showCreateOpp:!1,showParticipants:null,showCreateChoice:!1,showCreateCall:!1,showSlotAdmin:null,editingCall:null}),We=d.useRef(!1);Xt.current={showCreateOpp:He,showParticipants:ne,showCreateChoice:ze,showCreateCall:Be,showSlotAdmin:D,editingCall:E},d.useEffect(()=>{const t=He||!!ne||ze||Be||!!D||!!E;t&&!We.current?(window.history.pushState({...window.history.state||{},workTrap:!0},"",window.location.pathname),We.current=!0):t||(We.current=!1)},[He,ne,ze,Be,D,E]),d.useEffect(()=>{const t=s=>{const a=Xt.current;!a.showCreateOpp&&!a.showParticipants&&!a.showCreateChoice&&!a.showCreateCall&&!a.showSlotAdmin&&!a.editingCall||(s.stopImmediatePropagation(),We.current=!1,a.editingCall?ce(null):a.showSlotAdmin?Ne(null):a.showCreateCall?be(!1):a.showCreateChoice?ie(!1):a.showParticipants?tt(null):a.showCreateOpp&&ae(!1))};return window.addEventListener("popstate",t,!0),()=>window.removeEventListener("popstate",t,!0)},[]);const[V,Ls]=d.useState(null),[es,ts]=d.useState([]),[ut,Ms]=d.useState(new Date().getFullYear()),[pt,Ts]=d.useState(new Date().getMonth()+1);d.useEffect(()=>{if(!V||!x){ts([]);return}const t=V.compositeId||xe(V.accountUid,V.id),s=new Map,a=new Map,n=new Map,r=new Map,i=()=>{ts(yt(s,a,n,r))},l=[P(T(j(m,"work_assignments"),M("compositeId","==",t)),o=>{s.clear(),q(o).forEach((u,w)=>s.set(w,u)),i()}),P(T(j(m,"work_assignments"),M("userAccountUid","==",V.accountUid),M("userProfileId","==",V.id)),o=>{a.clear(),q(o).forEach((u,w)=>a.set(w,u)),i()})];return V.linkedMemberId&&(l.push(P(T(j(m,"work_assignments"),M("memberId","==",V.linkedMemberId)),o=>{n.clear(),q(o).forEach((u,w)=>n.set(w,u)),i()})),l.push(P(T(j(m,"work_assignments"),M("userId","==",V.linkedMemberId)),o=>{r.clear(),q(o).forEach((u,w)=>r.set(w,u)),i()}))),()=>l.forEach(o=>o())},[V,x]),d.useEffect(()=>{const t=T(j(m,"work_calls"),is("createdAt","desc")),s=P(t,a=>{Ss(a.docs.map(n=>({id:n.id,...n.data()})))});return()=>s()},[]);const bt=g.get("callId");d.useEffect(()=>{if(!bt||re.length===0)return;O("opportunities"),window.setTimeout(()=>{const s=document.getElementById(`call-${bt}`);s&&s.scrollIntoView({behavior:"smooth",block:"center"})},80);const t=new URLSearchParams(g);t.delete("callId"),v(t,{replace:!0})},[bt,re,g,v]),d.useEffect(()=>{if(!D)return;const t=re.find(a=>a.id===D.call.id);if(!t)return;const s=(t.slots||[]).find(a=>a.id===D.slot.id);s&&Ne({call:t,slot:s})},[re]),d.useEffect(()=>{const t=T(j(m,"work_opportunities"),is("date","asc")),s=P(t,I=>{const L=I.docs.map(_=>({id:_.id,..._.data()}));bs(L),localStorage.setItem("pwa_work_opportunities_cache",JSON.stringify(L)),js(!1)}),a=h.accountUid||he.currentUser?.uid,n=new Map,r=new Map,i=()=>{const I=yt(n,r);It(I),localStorage.setItem("pwa_work_assignments_cache",JSON.stringify(I))};let l=()=>{},o=()=>{};if(a){const I=T(j(m,"work_assignments"),M("compositeId","==",xe(a,h.id)));l=P(I,_=>{n.clear(),q(_).forEach((U,k)=>n.set(k,U)),i()});const L=T(j(m,"work_assignments"),M("userAccountUid","==",a),M("userProfileId","==",h.id));o=P(L,_=>{r.clear(),q(_).forEach((U,k)=>r.set(k,U)),i()})}else It([]),localStorage.setItem("pwa_work_assignments_cache",JSON.stringify([]));let u=()=>{},w=()=>{},S=()=>{};if(x){const I=T(j(m,"work_assignments"),M("status","==","pending"));u=P(I,L=>{const _=L.docs.map(U=>({id:U.id,...U.data()}));_.sort((U,k)=>U.date.localeCompare(k.date)),gs(_)}),na().then(Ns),me(T(us(m,"profiles"))).then(L=>{const _=L.docs.map(U=>{const k=U.ref.parent.parent?.id;return k?{...U.data(),id:U.id,accountUid:k,compositeId:xe(k,U.id)}:null}
9).filter(Boolean);ks(_)}),w=P(j(m,"work_templates"),L=>{ws(L.docs.map(_=>({id:_.id,..._.data()})))}),S=P(j(m,"work_recurring"),L=>{const _=L.docs.map(k=>({id:k.id,...k.data()}));fs(_);const U=new Date().toISOString().split("T")[0];_.forEach(async k=>{if(k.nextRun&&k.nextRun<=U){const Ws=ms(k.nextRun,k.interval);try{await W(C(m,"work_recurring",k.id),{nextRun:Ws}),await X(j(m,"work_opportunities"),{title:k.title,time:k.time,location:k.location,description:k.description,date:k.nextRun,participants:[],createdBy:k.createdBy,createdAt:Z(),assignedTo:k.recipients||[]}),k.recipients?.length>0&&k.recipients.forEach(qe=>Ye(qe.id,qe.id,"Wiederkehrende Aufgabe",k.title,"task","/work"))}catch(qe){console.error("Error processing recurring task:",qe)}}})})}return()=>{s(),l(),o(),u(),w(),S()}},[h.id,x]),d.useEffect(()=>{if(!N||!x){Ut([]);return}const t=new Map,s=new Map,a=new Map,n=new Map,r=()=>{Ut(yt(t,s,a,n))},i=[];return N.type==="profile"?(i.push(P(T(j(m,"work_assignments"),M("compositeId","==",N.data.compositeId)),l=>{t.clear(),q(l).forEach((o,u)=>t.set(u,o)),r()})),i.push(P(T(j(m,"work_assignments"),M("userAccountUid","==",N.data.accountUid),M("userProfileId","==",N.data.id)),l=>{s.clear(),q(l).forEach((o,u)=>s.set(u,o)),r()})),N.data.linkedMemberId&&(i.push(P(T(j(m,"work_assignments"),M("memberId","==",N.data.linkedMemberId)),l=>{a.clear(),q(l).forEach((o,u)=>a.set(u,o)),r()})),i.push(P(T(j(m,"work_assignments"),M("userId","==",N.data.linkedMemberId)),l=>{n.clear(),q(l).forEach((o,u)=>n.set(u,o)),r()})))):(i.push(P(T(j(m,"work_assignments"),M("memberId","==",N.data.id)),l=>{t.clear(),q(l).forEach((o,u)=>t.set(u,o)),r()})),i.push(P(T(j(m,"work_assignments"),M("userId","==",N.data.id)),l=>{s.clear(),q(l).forEach((o,u)=>s.set(u,o)),r()}))),()=>i.forEach(l=>l())},[N,x]),d.useEffect(()=>{if(!pe||pe.length<2){Rt([]);return}const t=setTimeout(()=>{Ht(!0);const s=pe.toLowerCase(),a=[];Et.filter(r=>{const l=(r.lastName+" "+r.firstName).toLowerCase().includes(s)||r.memberId?.toLowerCase().includes(s),o=!r.linkedUserId;return l&&o}).slice(0,5).forEach(r=>a.push({type:"member",data:r})),Y.length>0&&Y.filter(i=>(i.name||"").toLowerCase().includes(s)).slice(0,5).forEach(i=>{i.accountUid&&a.push({type:"profile",data:i})}),Rt(a),Ht(!1)},300);return()=>clearTimeout(t)},[pe,Et,Y]);const ss=d.useMemo(()=>{const t=new Date().toISOString().split("T")[0];return ue.filter(s=>s.date>=t&&(!s.assignedTo||s.assignedTo.length===0||s.assignedTo.some(a=>a.id===h.id)))},[ue,h.id]),gt=d.useMemo(()=>Pe.filter(t=>t.status==="confirmed").reduce((t,s)=>t+Number(s.hours),0),[Pe]),As=async()=>{if(!(!p.title||!p.date))try{const t={title:p.title,date:p.date,time:p.time,location:p.location,description:p.description,participants:[],createdBy:h.name,createdAt:Z(),assignedTo:p.recipients,requiredParticipants:p.requiredParticipants?parseInt(p.requiredParticipants):null};p.isTemplate&&await X(j(m,"work_templates"),{title:p.title,time:p.time,location:p.location,description:p.description}),p.isRecurring&&await X(j(m,"work_recurring"),{title:p.title,time:p.time,location:p.location,description:p.description,interval:p.interval,nextRun:ms(p.date,p.interval),recipients:p.recipients,createdBy:h.id});const s=await X(j(m,"work_opportunities"),t);p.recipients.length>0?p.recipients.forEach(a=>Ye(a.id,a.id,"Neue zugewiesene Aufgabe",p.title,"task",`/work?oppId=${s.id}`)):await cs("ð ï¸ Hilfe benötigt",`Neuer Einsatz: ${p.title}`,"task",`/work?oppId=${s.id}`),ae(!1),F({title:"",date:"",time:"10:00",location:"Clubanlage",description:"",isTemplate:!1,isRecurring:!1,interval:"monthly",recipients:[],requiredParticipants:""}),await c.toast({title:"Erfolgreich erstellt."})}catch{await c.alert({title:"Die Annonce konnte nicht veröffentlicht werden.",tone:"default"})}},Ds=async()=>{if(!ge.trim()||J.every(t=>!t.date)){await c.alert({title:"Bitte Titel und mindestens einen Termin mit Datum angeben.",tone:"default"});return}Kt(!0);try{let t="";if(we){const l=Date.now(),o=Ys(Qs,`work_calls/${l}_${we.name}`);await Xs(o,we),t=await ea(o)}const s=[];for(const l of J)if(l.date)for(const o of l.times)o.timeLabel.trim()&&s.push({id:`${Date.now()}_${Math.random().toString(36).slice(2,8)}`,date:l.date,timeLabel:o.timeLabel,maxHelpers:Math.max(1,parseInt(o.maxHelpers)||4),registrations:[]});const a=s.map(l=>({date:l.date,timeLabel:l.timeLabel,maxHelpers:l.maxHelpers,helperCount:0})),n=he.currentUser?.uid||"",r=await X(j(m,"news"),{title:ge,author:h.name,content:nt||"",imageUrl:t||null,workCallSlots:a,location:rt,createdAt:Z(),feedVisible:!0,showInFeed:!0,likes:[],dislikes:[]}),i=await X(j(m,"work_calls"),{title:ge,description:nt||"",location:rt,imageUrl:t||null,newsPostId:r.id,createdByUid:n,createdBy:h.name,createdAt:Z(),status:"active",slots:s});await W(r,{workCallId:i.id}),await cs("ð ï¸ Neuer Arbeitseinsatz",`${ge} â Meld dich jetzt an!`,"task","/work?callId="+i.id),Bt(""),Ot(""),Ft("Clubanlage"),it(null),lt(""),G([{date:"",times:[{timeLabel:"morgens",maxHelpers:"4"}]}]),ot(!1),Wt(""),qt(""),Jt("weekly"),oe([{timeLabel:"morgens",maxHelpers:"4"}]),be(!1),await c.toast({title:"Sammelaufruf veröffentlicht!"})}catch(t){console.error(t),await c.alert({title:"Erstellen fehlgeschlagen. Bitte erneut versuchen.",tone:"default"})}finally{Kt(!1)}},_s=()=>
9{if(!fe||!je)return 0;const t=new Date(fe+"T00:00:00"),s=new Date(je+"T00:00:00");if(t>s)return 0;let a=0;const n=new Date(t);for(;n<=s&&a<60;)a++,ve==="daily"?n.setDate(n.getDate()+1):ve==="weekly"?n.setDate(n.getDate()+7):n.setMonth(n.getMonth()+1);return a},Es=()=>{if(!fe||!je)return;const t=new Date(fe+"T00:00:00"),s=new Date(je+"T00:00:00");if(t>s)return;const a=[],n=new Date(t);for(;n<=s&&a.length<60;)a.push({date:n.toISOString().split("T")[0],times:ct.map(r=>({...r}))}),ve==="daily"?n.setDate(n.getDate()+1):ve==="weekly"?n.setDate(n.getDate()+7):n.setMonth(n.getMonth()+1);G(a)},Ps=async(t,s)=>{const a=he.currentUser?.uid;if(!a){await c.alert({title:"Dein Profil konnte nicht identifiziert werden. Bitte neu einloggen."});return}const n=s.registrations||[];if(n.some(i=>!!i.userId&&i.userId===a)){await c.alert({title:"Du bist bereits angemeldet."});return}if(n.length>=s.maxHelpers){await c.alert({title:"Dieser Platz ist bereits voll belegt."});return}const r=C(m,"work_calls",t.id);try{let i=[];if(await Me(m,async l=>{const o=await l.get(r);if(!o.exists())throw new Error("not_found");const u=o.data().slots||[],w=u.findIndex(L=>L.id===s.id);if(w<0)throw new Error("slot_not_found");const S=u[w];if((S.registrations||[]).some(L=>!!L.userId&&L.userId===a))throw new Error("already");if((S.registrations||[]).length>=S.maxHelpers)throw new Error("full");const I={userId:a,name:h.name,registeredAt:new Date().toISOString()};i=u.map((L,_)=>_===w?{...L,registrations:[...L.registrations||[],I]}:L),l.update(r,{slots:i})}),t.newsPostId&&i.length>0){const l=i.map(o=>({date:o.date,timeLabel:o.timeLabel,maxHelpers:o.maxHelpers,helperCount:o.registrations.length}));W(C(m,"news",t.newsPostId),{workCallSlots:l}).catch(()=>{})}await c.toast({title:"Du bist angemeldet!"})}catch(i){i.message==="full"?await c.alert({title:"Dieser Platz ist bereits voll."}):i.message==="already"?await c.alert({title:"Du bist bereits angemeldet."}):await c.alert({title:"Anmeldung fehlgeschlagen.",tone:"default"})}},Rs=async(t,s)=>{const a=he.currentUser?.uid,n=C(m,"work_calls",t.id);try{let r=[];if(await Me(m,async i=>{const l=await i.get(n);if(!l.exists())throw new Error("not_found");const o=l.data().slots||[],u=o.findIndex(w=>w.id===s.id);if(u<0)throw new Error("slot_not_found");r=o.map((w,S)=>S===u?{...w,registrations:(w.registrations||[]).filter(I=>!(I.userId&&I.userId===a))}:w),i.update(n,{slots:r})}),t.newsPostId&&r.length>0){const i=r.map(l=>({date:l.date,timeLabel:l.timeLabel,maxHelpers:l.maxHelpers,helperCount:(l.registrations||[]).length}));W(C(m,"news",t.newsPostId),{workCallSlots:i}).catch(()=>{})}await c.toast({title:"Du wurdest abgemeldet."})}catch{await c.alert({title:"Abmeldung fehlgeschlagen.",tone:"default"})}},Hs=async()=>{if(!(!E||!Q.trim()))try{const t=[];for(const r of te)if(r.date)for(const i of r.times)i.timeLabel.trim()&&t.push({id:`${Date.now()}_${Math.random().toString(36).slice(2,8)}`,date:r.date,timeLabel:i.timeLabel,maxHelpers:Math.max(1,parseInt(i.maxHelpers)||4),registrations:[]});const s=new Set(E.slots.map(r=>`${r.date}|${r.timeLabel}`)),a=t.filter(r=>s.has(`${r.date}|${r.timeLabel}`));if(a.length>0){const r=a.slice(0,3).map(l=>`${l.date} · ${l.timeLabel}`).join(", ")+(a.length>3?` +${a.length-3} weitere`:"");if(!await c.confirm({title:`${a.length} Termin${a.length>1?"e existieren":" existiert"} bereits (${r}). Duplikate überspringen und fortfahren?`,confirmText:"Ãberspringen & fortfahren",cancelText:"Abbrechen"}))return;if(t.splice(0,t.length,...t.filter(l=>!s.has(`${l.date}|${l.timeLabel}`))),t.length===0){await W(C(m,"work_calls",E.id),{title:Q.trim(),description:ee.trim(),location:Ve.trim()}),E.newsPostId&&W(C(m,"news",E.newsPostId),{title:Q.trim(),content:ee.trim(),workCallId:E.id}).catch(()=>{}),ce(null),R([]),de(!1),ht(""),mt(""),await c.toast({title:"Annonce aktualisiert. Keine neuen Termine (alle bereits vorhanden)."});return}}const n=C(m,"work_calls",E.id);if(t.length>0){if(await Me(m,async r=>{const i=await r.get(n);if(!i.exists())throw new Error("not_found");const l=i.data().slots||[];r.update(n,{title:Q.trim(),description:ee.trim(),location:Ve.trim(),slots:[...l,...t]})}),E.newsPostId){const l=((await ta(async()=>{const{getDoc:o}=await import("./index.esm-CQ_Nafil.js").then(u=>u.i);return{getDoc:o}},__vite__mapDeps([0,1,2])).then(({getDoc:o})=>o(n))).data()?.slots||[]).map(o=>({date:o.date,timeLabel:o.timeLabel,maxHelpers:o.maxHelpers,helperCount:o.registrations.length}));W(C(m,"news",E.newsPostId),{title:Q.trim(),content:ee.trim(),workCallSlots:l,workCallId:E.id}).catch(()=>{})}}else await W(n,{title:Q.trim(),description:ee.trim(),location:Ve.trim()}),E.newsPostId&&W(C(m,"news",E.newsPostId),{title:Q.trim(),content:ee.trim(),workCallId:E.id}).catch(()=>{});ce(null),R([]),de(!1),ht(""),mt(""),await c.toast({title:"Annonce aktualisiert."})}catch{await c.alert({title:"Speichern fehlgeschlagen.",tone:"default"})}},$s=()=>
9{if(!ke||!ye)return 0;const t=new Date(ke+"T00:00:00"),s=new Date(ye+"T00:00:00");if(t>s)return 0;let a=0;const n=new Date(t);for(;n<=s&&a<60;)a++,Ce==="daily"?n.setDate(n.getDate()+1):Ce==="weekly"?n.setDate(n.getDate()+7):n.setMonth(n.getMonth()+1);return a},Us=()=>{if(!ke||!ye)return;const t=new Date(ke+"T00:00:00"),s=new Date(ye+"T00:00:00");if(t>s)return;const a=[],n=new Date(t);for(;n<=s&&a.length<60;)a.push({date:n.toISOString().split("T")[0],times:xt.map(r=>({...r}))}),Ce==="daily"?n.setDate(n.getDate()+1):Ce==="weekly"?n.setDate(n.getDate()+7):n.setMonth(n.getMonth()+1);R(a)},zs=async(t,s,a,n)=>{if(s.registrations.some(i=>i.userId===a)){await c.alert({title:`${n} ist bereits eingetragen.`});return}const r=C(m,"work_calls",t.id);try{let i=[];if(await Me(m,async l=>{const o=await l.get(r);if(!o.exists())throw new Error("not_found");const u=o.data().slots||[],w=u.findIndex(I=>I.id===s.id);if(w<0)throw new Error("slot_not_found");const S={userId:a,name:n,registeredAt:new Date().toISOString(),registeredBy:h.name};i=u.map((I,L)=>L===w?{...I,registrations:[...I.registrations,S]}:I),l.update(r,{slots:i})}),t.newsPostId&&i.length>0){const l=i.map(o=>({date:o.date,timeLabel:o.timeLabel,maxHelpers:o.maxHelpers,helperCount:o.registrations.length}));W(C(m,"news",t.newsPostId),{workCallSlots:l}).catch(()=>{})}Fe(""),await c.toast({title:`${n} wurde eingetragen.`})}catch{await c.alert({title:"Eintragen fehlgeschlagen.",tone:"default"})}},Bs=async(t,s,a)=>{const n=C(m,"work_calls",t.id);try{let r=[];if(await Me(m,async i=>{const l=await i.get(n);if(!l.exists())throw new Error("not_found");const o=l.data().slots||[],u=o.findIndex(w=>w.id===s.id);if(u<0)throw new Error("slot_not_found");r=o.map((w,S)=>S===u?{...w,registrations:w.registrations.filter(I=>I.userId!==a)}:w),i.update(n,{slots:r})}),t.newsPostId&&r.length>0){const i=r.map(l=>({date:l.date,timeLabel:l.timeLabel,maxHelpers:l.maxHelpers,helperCount:l.registrations.length}));W(C(m,"news",t.newsPostId),{workCallSlots:i}).catch(()=>{})}await c.toast({title:"Person wurde ausgetragen."})}catch{await c.alert({title:"Austragen fehlgeschlagen.",tone:"default"})}},Os=async t=>{try{await W(C(m,"work_opportunities",t.id),{participants:sa({userId:h.id,name:h.name,signedUpAt:new Date().toISOString()})}),await c.toast({title:"Du bist angemeldet!"})}catch{await c.alert({title:"Anmeldung fehlgeschlagen. Bitte versuche es später erneut.",tone:"default"})}},Fs=async()=>{if(!Qe.trim()||!Xe||!et)return await c.alert({title:"Bitte fülle alle Felder aus.",tone:"default"});const t=parseFloat(et.replace(",","."));if(isNaN(t)||t<=0)return await c.alert({title:"Bitte gib eine gültige Stundenanzahl ein.",tone:"default"});const s=h.accountUid||he.currentUser?.uid;if(!s)return await c.alert({title:"Dein Account konnte nicht identifiziert werden.",tone:"default"});const a={...h,accountUid:s,compositeId:xe(s,h.id),linkedMemberId:h.linkedMemberId||null};try{await X(j(m,"work_assignments"),xs({profile:a,ownerName:h.name,title:Qe,date:Xe,hours:t,status:"pending",source:"manual"})),await c.toast({title:"Eingereicht!"}),At(""),Dt(""),_t(""),O("history")}catch{await c.alert({title:"Fehler",tone:"danger"})}},as=async(t,s)=>{try{const a=t.userAccountUid,n=t.userProfileId||t.userId,r=t.linkedMemberId||null,i=Ae(m);i.update(C(m,"work_assignments",t.id),{status:s,reviewedAt:Z(),reviewedBy:h.id}),await i.commit(),a&&n&&await Ct({accountUid:a,profileId:n,linkedMemberId:r}),a&&await Ye(a,n,s==="confirmed"?"â
Stunden akzeptiert":"â Stunden abgelehnt",`Eintrag: ${t.hours}h`,s==="confirmed"?"success":"warning")}catch(a){console.error(a),await c.alert({title:"Buchung fehlgeschlagen.",tone:"default"})}finally{at(!1)}},Vs=async()=>{if(!(!N||!B.hours||!B.description)){at(!0);try{const t=parseFloat(B.hours.replace(",","."));if(N.type==="member")await pa(N.data.id,t,B.description,B.date,h.id);else{const s=Ae(m),a=C(j(m,"work_assignments"));s.set(a,xs({profile:N.data,ownerName:N.data.name,title:B.description,date:B.date,hours:t,status:"confirmed",createdByAdmin:h.id,source:"admin_booking"})),await s.commit(),await Ct({accountUid:N.data.accountUid,profileId:N.data.id,linkedMemberId:N.data.linkedMemberId||null}),await Ye(N.data.accountUid,N.data.id,"â
Stunden verbucht",`Admin Buchung: ${t}h (${B.description})`,"success","/work")}await c.toast({title:"Verbucht"}),Ue({hours:"",description:"",date:new Date().toISOString().split("T")[0]})}
9catch(t){console.error(t),await c.alert({title:"Fehler",tone:"danger"})}finally{at(!1)}}},ns=async t=>{if(await c.confirm({title:"Eintrag löschen? Bestätigte Stunden werden vom Profil abgezogen.",confirmText:"Löschen",cancelText:"Abbrechen"}))try{const s=Ae(m),a=C(m,"work_assignments",t.id);s.delete(a);const n=t.userAccountUid,r=t.userProfileId||t.userId,i=t.linkedMemberId||null;await s.commit(),n&&r&&await Ct({accountUid:n,profileId:r,linkedMemberId:i}),await c.toast({title:"Gelöscht & verrechnet",variant:"default"})}catch(s){console.error(s),await c.alert({title:"Fehler beim Löschen",tone:"danger"})}};return e.jsxs("div",{className:"fixed inset-0 h-[100dvh] w-full text-white font-sans selection:bg-orange-500/30 overflow-hidden bg-slate-950 overscroll-none",children:[e.jsx("div",{className:"fixed inset-0 z-0 pointer-events-none",style:{backgroundImage:`url('${os.construction||os.grass}')`,backgroundSize:"cover",backgroundPosition:"center",backgroundRepeat:"no-repeat",filter:"blur(4px) brightness(0.6) opacity(0.8)",transform:"scale(1.05)"}}),e.jsxs("div",{className:"relative z-10 h-full flex flex-col overflow-hidden",children:[e.jsx("div",{className:"shrink-0 bg-black/40 backdrop-blur-xl border-b border-white/10 z-40",children:e.jsxs("div",{className:"px-4 pt-4 pb-4 max-w-xl mx-auto flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("button",{onClick:ps,className:"h-10 w-10 bg-white/5 border border-white/10 rounded-xl flex items-center justify-center hover:bg-white/10 active:scale-95 transition-all text-white/80 hover:text-white",children:e.jsx(ra,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-black text-transparent bg-clip-text bg-gradient-to-r from-orange-400 to-amber-400 leading-none",children:y==="dashboard"?"Arbeitseinsatz":y==="opportunities"?"Annoncen":y==="report"?"Stunden melden":y==="history"?"Historie":"Admin Bereich"}),e.jsx("p",{className:"text-slate-400 text-[10px] mt-1 font-bold uppercase tracking-widest",children:"Gemeinsam anpacken"})]})]}),x&&y==="opportunities"&&e.jsx("button",{onClick:()=>ie(!0),className:"h-10 w-10 bg-orange-500 hover:bg-orange-400 text-black rounded-xl flex items-center justify-center shadow-lg shadow-orange-500/20 transition-all active:scale-95",children:e.jsx(Je,{className:"h-6 w-6"})})]})}),e.jsx("div",{className:"flex-1 overflow-y-auto custom-scrollbar",children:e.jsxs("div",{className:"p-4 pt-6 pb-32 max-w-xl mx-auto space-y-6 animate-in fade-in slide-in-from-bottom-8 duration-700",children:[y==="dashboard"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:gap-4",children:[e.jsx(Ze,{title:"Annoncen",subtitle:"Aufrufe & Termine",icon:Ie,color:"blue",onClick:()=>O("opportunities")}),e.jsx(Ze,{title:"Melden",subtitle:"Stunden erfassen",icon:hs,color:"orange",onClick:()=>O("report")}),e.jsx(Ze,{title:"Historie",subtitle:"Meine Einsätze",icon:ia,color:"purple",onClick:()=>O("history")}),x&&e.jsx(e.Fragment,{children:e.jsx(Ze,{title:"Admin",subtitle:"Verwaltung",icon:la,color:"red",onClick:()=>O("admin"),badge:Re.length})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs(A,{className:"p-5 flex flex-col items-center justify-center text-center",children:[e.jsx("div",{className:"text-white/40 text-[10px] font-black uppercase tracking-widest mb-1",children:"Mein Soll"}),e.jsxs("div",{className:"text-3xl font-black text-white",children:[f," ",e.jsx("span",{className:"text-sm font-bold opacity-50",children:"h"})]})]}),e.jsxs(A,{className:"p-5 flex flex-col items-center justify-center text-center bg-green-500/10 border-green-500/20",children:[e.jsx("div",{className:"text-green-400 text-[10px] font-black uppercase tracking-widest mb-1",children:"Erledigt"}),e.jsxs("div",{className:"text-3xl font-black text-white",children:[Number.isInteger(gt)?gt:gt.toFixed(1),e.jsx("span",{className:"text-sm font-bold opacity-50 ml-1",children:"h"})]})]})]})]}),y==="opportunities"&&e.jsxs("div",{className:"space-y-4 animate-in fade-in",children:[re.filter(t=>t.status==="active").map(t=>{const s=[...t.slots||[]].sort((a,n)=>a.date.localeCompare(n.date)||a.timeLabel.localeCompare(n.timeLabel));return e.jsxs(A,{id:`call-${t.id}`,className:"overflow-hidden",children:[e.jsxs("div",{className:"p-5 pb-3",children:[t.imageUrl&&e.jsx("div",{className:"rounded-2xl overflow-hidden mb-4",style:{aspectRatio:"16/9"},children:e.jsx("img",{src:t.imageUrl,alt:t.title,className:"w-full h-full object-cover"})}),e.jsxs("div",{className:"flex justify-between items-start mb-1",children:[e.jsx("span",{className:"px-2 py-1 rounded-lg bg-orange-500/20 text-orange-400 text-[10px] font-black uppercase tracking-wider border border-orange-500/20",children:"Sammelaufruf"}),x&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>{ce(t),Zt(t.title),Yt(t.description||""),Qt(t.location||"")},className:"text-white/20 hover:text-orange-400 transition-colors",children:e.jsx(Zs,{className:"h-4 w-4"})}),e.jsx("button",{onClick:async()=>{window.confirm("Sammelaufruf und zugehörigen Newsbeitrag wirklich löschen?")&&(await Le(C(m,"work_calls",t.id)),t.newsPostId&&Le(C(m,"news",t.newsPostId)).catch(()=>{}))},className:"text-white/20 hover:text-red-500 transition-colors",children:e.jsx(se,{className:"h-4 w-4"})})]})]}),e.jsx("h3",{className:"text-xl font-black leading-tight text-white mt-2 mb-1",children:t.title}),t.description&&e.jsx("p",{className:"text-sm text-white/50 mb-2 leading-relaxed",children:t.description}),t.location&&e.jsxs("div",{className:"flex items-center gap-1.5 text-sm text-slate-400 font-medium mb-1",children:[e.jsx(ft,{className:"h-3.5 w-3.5 text-orange-500"})," ",t.location]})]}),e.jsx("div",{className:"border-t border-white/5",children:s.map((a,n)=>{const r=a.registrations||[],i=he.currentUser?.uid,l=!!i&&r.some(S=>!!S.userId&&S.userId===i),o=r.length>=a.maxHelpers,u=a.maxHelpers>0?Math.min(100,r.length/a.maxHelpers*100):0;let w="";try{w=new Date(a.date+"T00:00:00").toLocaleDateString("de-DE",{weekday:"short",day:"2-digit",month:"2-digit"})}catch{}return e.jsxs("div",{className:`flex items-center gap-3 px-5 py-4 border-b border-white/5 last:border-0 ${o&&!l?"opacity-50":""}`,children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"text-sm font-bold text-white mb-1.5",children:[w," · ",e.jsx("span",{className:"text-orange-400",children:a.timeLabel})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex-1 h-1.5 bg-white/10 rounded-full overflow-hidden",children:e.jsx("div",{className:`h-full rounded-full transition-all ${o?"bg-red-500":"bg-orange-500"}`,style:{width:`${u}%`}})}),e.jsxs("span",{className:`text-xs font-black ${o?"text-red-400":"text-white/40"}`,children:[r.length,"/",a.maxHelpers]})]}),r.length>0&&e.jsx("div",{className:"text-xs text-white/25 mt-1 truncate",title:r.map(S=>S.name).join(", "),children:r.map(S=>S.name).join(" · ")})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[l?e.jsxs("button",{onClick:()=>Rs(t,a),title:"Klicken zum Abmelden",className:"px-3 py-2 bg-green-500/20 border border-green-500/30 text-green-400 rounded-xl text-xs font-bold flex items-center gap-1.5 hover:bg-red-500/20 hover:border-red-500/30 hover:text-red-400 transition-colors",children:[e.jsx(jt,{className:"h-3.5 w-3.5"})," Gemeldet"]}):o?e.jsx("span",{className:"px-3 py-2 bg-white/5 border border-white/10 text-white/30 rounded-xl text-xs font-bold",children:"Voll"}):e.jsx("button",{onClick:()=>Ps(t,a),className:"px-3 py-2 bg-white text-slate-900 rounded-xl text-xs font-black uppercase tracking-wide hover:bg-white/90 shadow",children:"Melden"}),x&&e.jsx("button",{onClick:()=>{Ne({call:t,slot:a}),Fe("")},className:"p-2 bg-white/5 border border-white/10 rounded-xl text-white/40 hover:text-white hover:bg-white/10 transition-colors",children:e.jsx(Ke,{className:"h-4 w-4"})})]})]},a.id||n)})})]},t.id)}),ss.map(t=>{const s=t.participants.some(a=>a.userId===h.id);return e.jsxs(A,{className:"p-5",children:[t.requiredParticipants&&t.participants.length>=t.requiredParticipants&&e.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-[2px] z-20 flex flex-col items-center justify-center rounded-3xl",children:e.jsx("div",{className:"bg-orange-500 text-black font-black px-6 py-3 rounded-2xl transform -rotate-12 text-2xl border-4 border-black shadow-2xl",children:"VOLL BELEGT"})}),e.jsxs("div",{className:"flex justify-between items-start mb-3",children:[e.jsx("div",{className:"flex gap-2",children:e.jsx("span",{className:"px-2 py-1 rounded-lg bg-orange-500/20 text-orange-400 text-[10px] font-black uppercase tracking-wider border border-orange-500/20",children:t.assignedTo&&t.assignedTo.length>0?"Zugewiesen":"Gesuch"})}),x&&e.jsx("button",{onClick:a=>{a.stopPropagation(),Le(C(m,"work_opportunities",t.id))},className:"text-white/20 hover:text-red-500 transition-colors",children:e.jsx(se,{className:"h-4 w-4"})})]}),e.jsx("h3",{className:"text-xl font-black leading-tight mb-2 text-white",children:t.title}),e.jsxs("div",{className:"flex flex-wrap gap-4 text-sm text-slate-400 mb-6 font-medium",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(Ie,{className:"h-4 w-4 text-orange-500"})," ",Te(t.date)]}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(De,{className:"h-4 w-4 text-orange-500"})," ",t.time]}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(ft,{className:"h-4 w-4 text-orange-500"})," ",t.location]})]}),e.jsxs("div",{className:"flex gap-3",children:[s?e.jsxs("button",{className:"flex-1 py-3 bg-green-500/20 border border-green-500/30 text-green-400 rounded-2xl font-bold text-sm cursor-default flex items-center justify-center gap-2",children:[e.jsx(jt,{className:"h-4 w-4"})," Angemeldet"]}):e.jsx("button",{onClick:()=>
9Os(t),className:"flex-1 py-3 bg-white text-slate-900 rounded-2xl font-black text-sm uppercase tracking-wide hover:bg-white/90 shadow-lg",children:"Ich helfe!"}),x&&e.jsx("button",{onClick:()=>tt(t),className:"px-4 bg-white/5 border border-white/10 rounded-2xl text-white/60 hover:text-white hover:bg-white/10 transition-colors",children:e.jsx(Ke,{className:"h-5 w-5"})})]})]},t.id)}),ss.length===0&&re.filter(t=>t.status==="active").length===0&&e.jsx("div",{className:"text-center py-12 text-white/30 italic",children:"Keine offenen Aufgaben."})]}),y==="report"&&e.jsx("div",{className:"animate-in fade-in",children:e.jsxs(A,{className:"p-6",children:[e.jsxs("h3",{className:"font-black text-xl mb-6 flex items-center gap-2",children:[e.jsx(hs,{className:"h-5 w-5 text-orange-500"})," Stunden einreichen"]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("input",{value:Qe,onChange:t=>At(t.target.value),className:"w-full bg-black/40 border border-white/10 p-4 rounded-2xl text-sm font-bold text-white placeholder:text-white/20 outline-none focus:border-orange-500/50 transition-all shadow-inner",placeholder:"Tätigkeit"}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx("input",{type:"date",value:Xe,onChange:t=>Dt(t.target.value),className:"w-full bg-black/40 border border-white/10 p-4 rounded-2xl text-sm font-bold text-white outline-none focus:border-orange-500/50 transition-all shadow-inner"}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:"number",step:"0.1",value:et,onChange:t=>_t(t.target.value),className:"w-full bg-black/40 border border-white/10 p-4 rounded-2xl text-sm font-bold text-white placeholder:text-white/20 outline-none focus:border-orange-500/50 transition-all shadow-inner pl-4",placeholder:"Stunden"}),e.jsx("span",{className:"absolute right-4 top-4 text-xs font-bold text-white/30 pointer-events-none",children:"Std."})]})]}),e.jsx("button",{onClick:Fs,className:"w-full py-4 bg-gradient-to-r from-orange-500 to-amber-600 text-black font-black rounded-2xl uppercase tracking-widest shadow-xl shadow-orange-900/20 hover:scale-[1.02] transition-transform",children:"Einreichen"})]})]})}),y==="history"&&e.jsxs("div",{className:"space-y-3 animate-in fade-in",children:[Pe.sort((t,s)=>s.date.localeCompare(t.date)).map(t=>e.jsxs(A,{className:"flex items-center justify-between p-4 border border-white/5",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:`h-12 w-12 rounded-2xl flex items-center justify-center border shadow-inner ${t.status==="confirmed"?"bg-green-500/10 border-green-500/20 text-green-500":t.status==="rejected"?"bg-red-500/10 border-red-500/20 text-red-500":"bg-orange-500/10 border-orange-500/20 text-orange-500"}`,children:t.status==="confirmed"?e.jsx(_e,{className:"h-6 w-6"}):t.status==="rejected"?e.jsx(z,{className:"h-6 w-6"}):e.jsx(De,{className:"h-6 w-6"})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-bold text-sm text-white",children:t.title}),e.jsx("div",{className:"text-xs text-slate-400 font-medium",children:Te(t.date)})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"text-right",children:[e.jsxs("div",{className:"font-black text-xl text-white",children:[t.hours,"h"]}),t.status==="pending"&&e.jsx("div",{className:"text-[9px] text-orange-500 uppercase font-black tracking-wider",children:"Wartet"})]}),x&&e.jsx("button",{onClick:()=>ns(t),className:"p-2 bg-white/5 rounded-full text-white/20 hover:text-red-500 hover:bg-white/10 transition-colors",children:e.jsx(se,{className:"h-4 w-4"})})]})]},t.id)),Pe.length===0&&e.jsx("div",{className:"text-center py-10 text-white/30 italic",children:"Noch keine Einträge."})]}),y==="admin"&&x&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 p-1 bg-white/5 rounded-2xl border border-white/5 mb-6",children:[e.jsxs("button",{onClick:()=>$("review"),className:`py-3 rounded-xl text-xs font-black uppercase transition-all ${H==="review"?"bg-orange-500 text-slate-950 shadow-lg":"text-white/40 hover:bg-white/5 hover:text-white"}`,children:["Prüfung (",Re.length,")"]}),e.jsx("button",{onClick:()=>$("booking"),className:`py-3 rounded-xl text-xs font-black uppercase transition-all ${H==="booking"?"bg-blue-500 text-slate-950 shadow-lg":"text-white/40 hover:bg-white/5 hover:text-white"}`,children:"Verbuchung"}),e.jsx("button",{onClick:()=>$("templates"),className:`py-3 rounded-xl text-xs font-black uppercase transition-all flex items-center justify-center gap-1 ${H==="templates"?"bg-teal-500 text-slate-950 shadow-lg":"text-white/40 hover:bg-white/5 hover:text-white"}`,children:"Vorlagen"}),e.jsx("button",{onClick:()=>$("reports"),className:`py-3 rounded-xl text-xs font-black uppercase transition-all flex items-center justify-center gap-1 ${H==="reports"?"bg-purple-500 text-slate-950 shadow-lg":"text-white/40 hover:bg-white/5 hover:text-white"}
9`,children:"Berichte"})]}),H==="review"&&e.jsxs("div",{className:"space-y-4 animate-in fade-in",children:[Re.map(t=>e.jsxs(A,{className:"p-5 border-l-4 border-l-orange-500",children:[e.jsxs("div",{className:"flex justify-between items-start mb-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] text-orange-400 font-black uppercase tracking-widest mb-1",children:"Prüfung erforderlich"}),e.jsx("h3",{className:"font-black text-lg text-white",children:t.userName||"Unbekannt"})]}),e.jsxs("div",{className:"px-3 py-1 bg-white/10 rounded-lg text-xl font-black text-white",children:[t.hours,"h"]})]}),e.jsxs("div",{className:"bg-black/30 p-3 rounded-xl mb-4 text-sm text-slate-300 font-medium flex items-center gap-2",children:[e.jsx(oa,{className:"h-4 w-4 text-orange-500"}),' "',t.title,'" ',e.jsx("span",{className:"opacity-30 mx-1",children:"|"})," ",Te(t.date)]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx("button",{onClick:()=>as(t,"rejected"),className:"flex-1 py-3 rounded-xl bg-red-500/10 border border-red-500/20 text-red-400 font-bold text-xs uppercase hover:bg-red-500/20 transition-colors",children:"Ablehnen"}),e.jsx("button",{onClick:()=>as(t,"confirmed"),className:"flex-[2] py-3 rounded-xl bg-green-500 text-black font-black text-xs uppercase shadow-lg shadow-green-500/20 hover:bg-green-400 transition-colors",children:"Bestätigen"})]})]},t.id)),Re.length===0&&e.jsxs("div",{className:"text-center py-20 text-white/30 flex flex-col items-center",children:[e.jsx(jt,{className:"h-10 w-10 mb-2 opacity-50"})," Alles erledigt."]})]}),H==="booking"&&e.jsx("div",{className:"animate-in fade-in space-y-6",children:N?e.jsxs(e.Fragment,{children:[e.jsxs(A,{className:"p-6",children:[e.jsxs("div",{className:"flex justify-between items-center mb-6 pb-4 border-b border-white/10",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:`h-14 w-14 rounded-2xl flex items-center justify-center shadow-lg ${N.type==="profile"?"bg-blue-500 text-black":"bg-amber-500 text-black"}`,children:N.type==="profile"?e.jsx(ls,{className:"h-7 w-7"}):e.jsx(kt,{className:"h-7 w-7"})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] opacity-50 font-black uppercase tracking-widest",children:N.type==="profile"?"App User":"Stammdaten"}),e.jsx("h2",{className:"font-black text-2xl leading-none text-white",children:N.type==="member"?N.data.lastName:N.data.name})]})]}),e.jsx("button",{onClick:()=>$t(null),className:"h-10 w-10 bg-white/10 rounded-full flex items-center justify-center hover:bg-white/20 transition-colors border border-white/10",children:e.jsx(z,{className:"h-5 w-5"})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:"number",value:B.hours,onChange:t=>Ue({...B,hours:t.target.value}),className:"w-full bg-black/40 border border-white/10 h-14 px-4 rounded-2xl font-bold text-white outline-none focus:border-white/30 transition-all shadow-inner",placeholder:"Stunden"}),e.jsx("span",{className:"absolute right-4 top-4 text-xs font-bold text-white/30 pointer-events-none",children:"Std."})]}),e.jsx("input",{type:"date",value:B.date,onChange:t=>Ue({...B,date:t.target.value}),className:"w-full bg-black/40 border border-white/10 h-14 px-4 rounded-2xl font-bold text-white outline-none focus:border-white/30 transition-all shadow-inner"})]}),e.jsx("input",{value:B.description,onChange:t=>Ue({...B,description:t.target.value}),className:"w-full bg-black/40 border border-white/10 h-14 px-4 rounded-2xl font-bold text-white outline-none focus:border-white/30 transition-all shadow-inner",placeholder:"Beschreibung der Tätigkeit"}),e.jsx("button",{onClick:Vs,disabled:zt,className:"w-full py-4 bg-white text-black font-black rounded-2xl shadow-xl flex items-center justify-center gap-2 hover:scale-[1.02] transition-transform",children:zt?e.jsx(vt,{className:"animate-spin h-5 w-5"}):e.jsxs(e.Fragment,{children:[e.jsx(da,{className:"h-5 w-5"})," Buchen"]})})]})]}),e.jsxs("div",{className:"space-y-2 mt-8",children:[e.jsxs("div",{className:"px-4 text-xs font-bold uppercase text-slate-500 mb-2 flex items-center gap-2",children:[e.jsx(ha,{className:"h-3 w-3"})," Historie (",st.length,")"]}),st.length===0&&e.jsx("div",{className:"p-6 rounded-3xl border border-white/10 border-dashed text-center text-white/30 text-sm",children:"Keine Einträge gefunden."}),st.map(t=>e.jsxs(A,{className:"flex items-center justify-between p-4 border border-white/5 hover:bg-white/10",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:`h-10 w-10 rounded-xl flex items-center justify-center border text-xs font-bold shadow-inner ${t.status==="confirmed"?"bg-green-500/10 border-green-500/20 text-green-500":"bg-orange-500/10 border-orange-500/20 text-orange-500"}`,children:[t.hours,"h"]}),e.jsxs("div",{children:[e.jsx("div",{className:"font-bold text-sm text-white",children:t.title}),e.jsx("div",{className:"text-xs text-slate-400",children:Te(t.date)})]})]}),e.jsx("button",{onClick:()=>ns(t),className:"h-9 w-9 bg-white/5 rounded-full flex items-center justify-center text-white/20 hover:text-red-500 hover:bg-white/20 transition-all border border-white/5",title:"Löschen & Zurückbuchen",children:e.jsx(se,{className:"h-4 w-4"})})]},t.id))]})]}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"relative",children:[e.jsx(Nt,{className:"absolute left-4 top-4 h-5 w-5 text-white/30"}
9),e.jsx("input",{placeholder:"Mitglied suchen...",value:pe,onChange:t=>Pt(t.target.value),className:"w-full bg-black/40 border border-white/10 rounded-2xl h-14 pl-12 pr-4 font-bold text-white outline-none focus:border-white/20 transition-all shadow-inner",autoFocus:!0}),Cs&&e.jsx(vt,{className:"absolute right-4 top-4 h-5 w-5 text-white/30 animate-spin"})]}),e.jsx("div",{className:"space-y-2",children:ys.map((t,s)=>e.jsxs(A,{onClick:()=>{$t(t),Pt("")},className:"p-4 flex items-center justify-between cursor-pointer hover:bg-white/10",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:`h-10 w-10 rounded-xl flex items-center justify-center font-bold shadow-inner ${t.type==="profile"?"bg-blue-500/20 text-blue-400 border border-blue-500/30":"bg-amber-500/20 text-amber-400 border border-amber-500/30"}`,children:t.type==="profile"?e.jsx(ls,{className:"h-5 w-5"}):e.jsx(kt,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-bold text-sm text-white",children:t.type==="member"?`${t.data.lastName}, ${t.data.firstName}`:t.data.name}),e.jsx("div",{className:"text-xs text-slate-400",children:t.type==="member"?`Stammdaten ⢠ID: ${t.data.memberId}`:"App Profil"})]})]}),e.jsx(ca,{className:"h-4 w-4 text-white/20"})]},s))})]})}),H==="templates"&&e.jsxs("div",{className:"animate-in fade-in space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2 p-1 bg-white/5 rounded-2xl border border-white/5 mb-6",children:[e.jsxs("button",{onClick:()=>St("templates"),className:`py-3 rounded-xl text-xs font-black uppercase transition-all flex items-center justify-center gap-2 ${K==="templates"?"bg-teal-500 text-slate-950 shadow-lg":"text-white/40 hover:bg-white/5 hover:text-white"}`,children:[e.jsx(ma,{className:"h-4 w-4"})," Vorlagen"]}),e.jsxs("button",{onClick:()=>St("recurring"),className:`py-3 rounded-xl text-xs font-black uppercase transition-all flex items-center justify-center gap-2 ${K==="recurring"?"bg-blue-500 text-slate-950 shadow-lg":"text-white/40 hover:bg-white/5 hover:text-white"}`,children:[e.jsx(Ge,{className:"h-4 w-4"})," Wiederkehrend"]})]}),K==="templates"&&e.jsxs("div",{className:"space-y-3",children:[Lt.map(t=>e.jsxs(A,{className:"p-4 flex items-center justify-between border-l-4 border-l-teal-500 cursor-pointer hover:bg-white/10",onClick:()=>{F({title:t.title,date:new Date().toISOString().split("T")[0],time:t.time,location:t.location,description:t.description,isTemplate:!1,isRecurring:!1,interval:"monthly",recipients:[],requiredParticipants:""}),ae(!0)},children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-bold text-white text-base mb-1",children:t.title}),e.jsxs("div",{className:"text-xs text-slate-400 flex items-center gap-2",children:[e.jsx(De,{className:"h-3 w-3"})," ",e.jsx("span",{children:t.time})," ",e.jsx("span",{className:"opacity-30",children:"|"})," ",e.jsx(ft,{className:"h-3 w-3"})," ",e.jsx("span",{children:t.location})]})]}),e.jsx("button",{onClick:s=>{s.stopPropagation(),Le(C(m,"work_templates",t.id))},className:"text-white/20 hover:text-red-500 p-2",children:e.jsx(se,{className:"h-5 w-5"})})]},t.id)),Lt.length===0&&e.jsx("p",{className:"text-center text-white/30 italic py-8",children:"Keine Vorlagen gespeichert."})]}),K==="recurring"&&e.jsxs("div",{className:"space-y-3",children:[Mt.map(t=>e.jsxs(A,{className:"p-4 border border-white/5",children:[e.jsxs("div",{className:"flex justify-between items-start mb-2",children:[e.jsx("h3",{className:"font-bold text-white",children:t.title}),e.jsx("button",{onClick:()=>Le(C(m,"work_recurring",t.id)),className:"text-white/20 hover:text-red-500 p-1 bg-white/5 rounded-full hover:bg-white/10 transition-colors",children:e.jsx(se,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 text-[10px] font-bold uppercase tracking-widest mb-3",children:[e.jsxs("span",{className:"bg-blue-500/20 text-blue-400 px-2 py-1 rounded-md border border-blue-500/20 flex items-center gap-1",children:[e.jsx(Ge,{className:"h-3 w-3"})," ",t.interval]}),e.jsxs("span",{className:"bg-orange-500/20 text-orange-400 px-2 py-1 rounded-md border border-orange-500/20 flex items-center gap-1",children:[e.jsx(Ie,{className:"h-3 w-3"})," Nächster: ",Te(t.nextRun)]})]}),t.recipients?.length>0&&e.jsxs("div",{className:"text-xs text-slate-300 mt-2 bg-black/20 p-2 rounded-xl",children:[e.jsx("span",{className:"font-bold text-white/50 block mb-1",children:"Zugewiesen an:"}),t.recipients.map(s=>
9s.name).join(", ")]})]},t.id)),Mt.length===0&&e.jsx("p",{className:"text-center text-white/30 italic py-8",children:"Keine wiederkehrenden Aufgaben."})]})]}),H==="reports"&&e.jsxs("div",{className:"animate-in fade-in space-y-4",children:[e.jsxs("div",{className:"mb-6 border-b border-white/10 pb-6",children:[e.jsxs("h4",{className:"font-black text-white/50 uppercase tracking-widest text-xs flex items-center gap-2 mb-4",children:[e.jsx(kt,{className:"h-4 w-4 text-purple-500"})," Monatsberichte einsehen"]}),e.jsxs("div",{className:"relative mb-3",children:[e.jsxs("select",{className:"w-full bg-black/40 border border-white/10 p-4 rounded-2xl text-sm font-bold text-white outline-none focus:border-purple-500/50 shadow-inner appearance-none cursor-pointer",onChange:t=>{const s=Y.find(a=>a.compositeId===t.target.value);Ls(s||null)},value:V?.compositeId||"",children:[e.jsx("option",{value:"",children:"-- Platzwart auswählen --"}),Y.filter(t=>t.role==="groundskeeper").map(t=>e.jsx("option",{value:t.compositeId,children:t.name},t.compositeId))]}),e.jsx("div",{className:"absolute right-4 top-1/2 -translate-y-1/2 pointer-events-none text-white/50 font-bold",children:"â¼"})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx("select",{className:"w-full bg-black/40 border border-white/10 p-3 rounded-2xl text-sm font-bold text-white outline-none focus:border-purple-500/50 shadow-inner appearance-none cursor-pointer",value:ut,onChange:t=>Ms(Number(t.target.value)),children:Array.from({length:5},(t,s)=>new Date().getFullYear()-s).map(t=>e.jsx("option",{value:t,children:t},t))}),e.jsx("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none text-white/50 text-xs font-bold",children:"â¼"})]}),e.jsxs("div",{className:"relative flex-1",children:[e.jsxs("select",{className:"w-full bg-black/40 border border-white/10 p-3 rounded-2xl text-sm font-bold text-white outline-none focus:border-purple-500/50 shadow-inner appearance-none cursor-pointer",value:pt,onChange:t=>Ts(Number(t.target.value)),children:[e.jsx("option",{value:0,children:"Gesamtes Jahr"}),["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"].map((t,s)=>e.jsx("option",{value:s+1,children:t},s+1))]}),e.jsx("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none text-white/50 text-xs font-bold",children:"â¼"})]})]})]}),V?pt===0?ba(es.filter(t=>typeof t.date=="string"&&t.date.startsWith(`${ut}-`))):ga(es.filter(t=>{const s=`${ut}-${String(pt).padStart(2,"0")}`;return typeof t.date=="string"&&t.date.startsWith(s)})):e.jsx("div",{className:"text-center py-12 text-white/30 italic",children:"Bitte wähle oben ein Profil aus, um den Bericht zu laden."})]})]})]})})]}),He&&e.jsxs("div",{className:"fixed inset-0 z-[100] flex items-center justify-center p-4 pb-24",children:[e.jsx("div",{className:"absolute inset-0 bg-black/90 backdrop-blur-md animate-in fade-in",onClick:()=>ae(!1)}),e.jsxs(A,{className:"bg-slate-900 w-full max-w-sm p-6 relative animate-in zoom-in-95 max-h-[90vh] overflow-y-auto custom-scrollbar",children:[e.jsxs("div",{className:"flex justify-between items-center mb-6",children:[e.jsxs("h2",{className:"text-xl font-black text-white flex items-center gap-2",children:[e.jsx(ds,{className:"h-5 w-5 text-orange-500"})," Aufgabe erstellen"]}),e.jsx("button",{onClick:()=>ae(!1),className:"p-2 bg-white/5 rounded-full hover:bg-white/10 text-white/50",children:e.jsx(z,{className:"h-5 w-5"})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("input",{value:p.title,onChange:t=>F({...p,title:t.target.value}),placeholder:"Titel",className:"w-full bg-black/40 border border-white/10 p-4 rounded-2xl text-sm font-bold text-white outline-none focus:border-orange-500/50 shadow-inner"}),e.jsx("textarea",{value:p.description,onChange:t=>F({...p,description:t.target.value}),placeholder:"Beschreibung...",className:"w-full bg-black/40 border border-white/10 p-4 rounded-2xl text-sm font-medium text-slate-300 h-24 resize-none outline-none focus:border-orange-500/50 shadow-inner custom-scrollbar"}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx("input",{type:"date",value:p.date,onChange:t=>F({...p,date:t.target.value}),className:"w-full bg-black/40 border border-white/10 p-4 rounded-2xl text-sm font-bold text-white outline-none shadow-inner"}),e.jsx("input",{type:"time",value:p.time,onChange:t=>F({...p,time:t.target.value}),className:"w-full bg-black/40 border border-white/10 p-4 rounded-2xl text-sm font-bold text-white outline-none shadow-inner"})]}),e.jsx("input",{value:p.location,onChange:t=>F({...p,location:t.target.value}),className:"w-full bg-black/40 border border-white/10 p-4 rounded-2xl text-sm font-bold text-white outline-none shadow-inner",placeholder:"Ort"}),e.jsx("input",{type:"number",min:"1",value:p.requiredParticipants,onChange:t=>F({...p,requiredParticipants:t.target.value}),className:"w-full bg-black/40 border border-white/10 p-4 rounded-2xl text-sm font-bold text-white outline-none shadow-inner",placeholder:"Benötigte Personen (leer = unbegrenzt)"}),e.jsxs("div",{className:"p-4 bg-white/5 rounded-2xl border border-white/10 space-y-3 mt-4",children:[e.jsxs("label",{className:"flex items-center gap-3 text-sm font-bold text-white cursor-pointer",children:[e.jsxs("div",{className:"relative flex items-center",children:[e.jsx("input",{type:"checkbox",checked:p.isTemplate,onChange:t=>F({...p,isTemplate:t.target.checked}),className:"peer sr-only"}),e.jsx("div",{className:"w-5 h-5 rounded border border-white/20 bg-black/40 peer-checked:bg-orange-500 peer-checked:border-orange-500 transition-colors flex items-center justify-center",children:e.jsx(_e,{className:"h-3 w-3 text-black opacity-0 peer-checked:opacity-100"})})]}),"Als Vorlage speichern"]}),e.jsxs("label",{className:"flex items-center gap-3 text-sm font-bold text-white cursor-pointer",children:[e.jsxs("div",{className:"relative flex items-center",children:[e.jsx("input",{type:"checkbox",checked:p.isRecurring,onChange:t=>F({...p,isRecurring:t.target.checked}),className:"peer sr-only"}),e.jsx("div",{className:"w-5 h-5 rounded border border-white/20 bg-black/40 peer-checked:bg-orange-500 peer-checked:border-orange-500 transition-colors flex items-center justify-center",children:e.jsx(_e,{className:"h-3 w-3 text-black opacity-0 peer-checked:opacity-100"})})]}),"Wiederkehrende Aufgabe"]}),p.isRecurring&&e.jsxs("div",{className:"pt-2 space-y-3 border-t border-white/10 animate-in fade-in",children:[e.jsxs("select",{value:p.interval,onChange:t=>F({...p,interval:t.target.value}),className:"w-full bg-black/40 border border-white/10 p-3 rounded-xl text-sm font-bold text-white outline-none",children:[e.jsx("option",{value:"daily",children:"Täglich"}),e.jsx("option",{value:"weekly",children:"Wöchentlich"}),e.jsx("option",{value:"monthly",children:"Monatlich"}),e.jsx("option",{value:"quarterly",children:"Vierteljährlich"}),e.jsx("option",{value:"semi-annually",children:"Halbjährlich"}),e.jsx("option",{value:"annually",children:"Jährlich"})]}),e.jsxs("div",{className:"relative",children:[e.jsx(Nt,{className:"absolute left-3 top-3 h-4 w-4 text-white/30"}),e.jsx("input",{placeholder:"Zuweisen an (Suche)...",value:$e,onChange:t=>Tt(t.target.value),className:"w-full bg-black/40 border border-white/10 rounded-xl h-10 pl-10 pr-3 text-sm font-bold text-white outline-none"})]}),$e.length>1&&e.jsxs("div",{className:"bg-slate-800 border border-white/10 rounded-xl max-h-32 overflow-y-auto mt-1 p-1 custom-scrollbar",children:[Y.filter(t=>t.name?.toLowerCase().includes($e.toLowerCase())).slice(0,5).map(t=>e.jsx("div",{onClick:()=>{p.recipients.find(s=>s.id===t.id)||F({...p,recipients:[...p.recipients,{id:t.id,name:t.name}]}),Tt("")},className:"p-2 text-sm text-white hover:bg-white/10 cursor-pointer rounded-lg font-medium",children:t.name},t.id)),Y.filter(t=>t.name?.toLowerCase().includes($e.toLowerCase())).length===0&&e.jsx("div",{className:"p-2 text-xs text-white/30 text-center",children:"Keine Treffer"})]}),p.recipients.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:p.recipients.map(t=>e.jsxs("span",{className:"bg-blue-500/20 text-blue-400 text-xs px-2 py-1.5 rounded-lg flex items-center gap-1.5 border border-blue-500/20 font-bold",children:[t.name," ",e.jsx(z,{className:"h-3 w-3 cursor-pointer hover:text-white",onClick:()=>F({...p,recipients:p.recipients.filter(s=>s.id!==t.id)})})]},t.id))})]})]}),e.jsx("button",{onClick:As,className:"w-full py-4 bg-gradient-to-r from-orange-500 to-amber-600 text-black font-black rounded-2xl mt-2 uppercase tracking-widest shadow-xl",children:"Veröffentlichen"})]})]})]}),ne&&e.jsxs("div",{className:"fixed inset-0 z-[100] flex items-center justify-center p-6 pb-24",onClick:()=>tt(null),children:[e.jsx("div",{className:"absolute inset-0 bg-black/90 backdrop-blur-md animate-in fade-in"}),e.jsxs(A,{className:"w-full max-w-sm p-6 relative animate-in zoom-in-95",onClick:t=>t.stopPropagation(),children:[e.jsxs("h3",{className:"font-black text-xl mb-6 text-white flex items-center gap-2",children:[e.jsx(Ke,{className:"h-5 w-5 text-orange-500"})," Teilnehmer"]}),e.jsxs("div",{className:"space-y-3 max-h-[50vh] overflow-y-auto custom-scrollbar",children:[ne.participants.map((t,s)=>e.jsxs("div",{className:"flex items-center gap-4 p-4 bg-white/5 border border-white/5 rounded-2xl",children:[e.jsx("div",{className:"h-10 w-10 rounded-full bg-gradient-to-br from-orange-500 to-amber-600 text-black flex items-center justify-center font-black text-sm shadow-lg",children:t.name.charAt(0)}),e.jsx("div",{className:"text-sm font-bold text-white",children:t.name})]},s)),ne.participants.length===0&&e.jsx("p",{className:"text-white/30 text-center py-10 italic",children:"Noch niemand angemeldet."})]})]})]}),E&&e.jsxs("div",{className:"fixed inset-0 z-[100] flex items-center justify-center p-4 pb-16",children:[e.jsx("div",{className:"absolute inset-0 bg-black/80 backdrop-blur-sm animate-in fade-in",onClick:()=>{ce(null),R([]),de(!1)}}),e.jsxs(A,{className:"bg-slate-900 w-full max-w-sm relative animate-in slide-in-from-bottom-4 sm:zoom-in-95 overflow-y-auto max-h-[90dvh]",children:[e.jsxs("div",{className:"p-6 pb-4",children:[e.jsxs("div",{className:"flex justify-between items-center mb-5",children:[e.jsx("h2",{className:"text-lg font-black text-white",children:"Annonce bearbeiten"}),e.jsx("button",{onClick:()=>{ce(null),R([]),de(!1)},className:"text-white/40 hover:text-white",children:e.jsx(z,{className:"h-5 w-5"})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-bold text-white/50 mb-1.5 uppercase tracking-wider",children:"Titel *"}),e.jsx("input",{value:Q,onChange:t=>Zt(t.target.value),className:"w-full bg-white/5 border border-white/10 rounded-xl px-4 py-3 text-white text-sm focus:outline-none focus:border-orange-500/50"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-bold text-white/50 mb-1.5 uppercase tracking-wider",children:"Beschreibung"}),e.jsx("textarea",{value:ee,onChange:t=>Yt(t.target.value),rows:3,className:"w-full bg-white/5 border border-white/10 rounded-xl px-4 py-3 text-white text-sm focus:outline-none focus:border-orange-500/50 resize-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-bold text-white/50 mb-1.5 uppercase tracking-wider",children:"Ort"}),e.jsx("input",{value:Ve,onChange:t=>Qt(t.target.value),className:"w-full bg-white/5 border border-white/10 rounded-xl px-4 py-3 text-white text-sm focus:outline-none focus:border-orange-500/50"})]})]})]}),e.jsxs("div",{className:"border-t border-white/10 p-6 pt-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-xs font-black text-white/50 uppercase tracking-wider",children:"Neue Termine hinzufügen"}),e.jsxs("div",{className:"flex rounded-xl overflow-hidden border border-white/10 text-xs font-black",children:[e.jsx("button",{onClick:()=>{de(!1),R([])},className:`px-3 py-1.5 transition-colors ${dt?"text-white/40 hover:text-white":"bg-orange-500 text-black"}`,children:"Manuell"}),e.jsx("button",{onClick:()=>{de(!0),R([])},className:`px-3 py-1.5 transition-colors ${dt?"bg-orange-500 text-black":"text-white/40 hover:text-white"}`,children:"Wiederkehrend"})]})]}),dt?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-bold text-white/40 mb-1 uppercase",children:"Von"}),e.jsx("input",{type:"date",value:ke,onChange:t=>ht(t.target.value),className:"w-full bg-white/5 border border-white/10 rounded-xl px-3 py-2 text-white text-xs focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-bold text-white/40 mb-1 uppercase",children:"Bis"}),e.jsx("input",{type:"date",value:ye,onChange:t=>mt(t.target.value),className:"w-full bg-white/5 border border-white/10 rounded-xl px-3 py-2 text-white text-xs focus:outline-none"})]})]}),e.jsx("div",{className:"flex rounded-xl overflow-hidden border border-white/10 text-xs font-black",children:["daily","weekly","monthly"].map(t=>e.jsx("button",{onClick:()=>Is(t),className:`flex-1 py-2 transition-colors ${Ce===t?"bg-orange-500/30 text-orange-400":"text-white/40 hover:text-white"}`,children:t==="daily"?"Täglich":t==="weekly"?"Wöchentlich":"Monatlich"},t))}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-[10px] font-black text-white/40 uppercase tracking-wider",children:"Uhrzeiten pro Termin"}),xt.map((t,s)=>e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsxs("select",{value:t.timeLabel.match(/^\d{2}:\d{2}
9$/)?"custom":t.timeLabel,onChange:a=>{const n=a.target.value==="custom"?"08:00":a.target.value;Se(r=>r.map((i,l)=>l===s?{...i,timeLabel:n}:i))},className:"flex-1 bg-black/40 border border-white/10 p-2 rounded-xl text-xs font-bold text-white outline-none",children:[e.jsx("option",{value:"morgens",children:"Morgens"}),e.jsx("option",{value:"mittags",children:"Mittags"}),e.jsx("option",{value:"abends",children:"Abends"}),e.jsx("option",{value:"custom",children:"Uhrzeitâ¦"})]}),t.timeLabel.match(/^\d{2}:\d{2}$/)&&e.jsx("input",{type:"time",value:t.timeLabel,onChange:a=>Se(n=>n.map((r,i)=>i===s?{...r,timeLabel:a.target.value}:r)),className:"w-24 bg-black/40 border border-white/10 p-2 rounded-xl text-xs font-bold text-white outline-none"}),e.jsx("input",{type:"number",min:"1",placeholder:"Max",value:t.maxHelpers,onChange:a=>Se(n=>n.map((r,i)=>i===s?{...r,maxHelpers:a.target.value}:r)),className:"w-16 bg-black/40 border border-white/10 p-2 rounded-xl text-xs font-bold text-white outline-none text-center"}),xt.length>1&&e.jsx("button",{onClick:()=>Se(a=>a.filter((n,r)=>r!==s)),className:"text-white/20 hover:text-red-400",children:e.jsx(z,{className:"h-4 w-4"})})]},s)),e.jsx("button",{onClick:()=>Se(t=>[...t,{timeLabel:"abends",maxHelpers:"4"}]),className:"text-xs text-orange-400/60 hover:text-orange-400 font-bold",children:"+ Uhrzeit"})]}),(()=>{const t=$s();return e.jsxs("button",{onClick:Us,disabled:t===0,className:"w-full py-3 bg-orange-500/20 border border-orange-500/40 text-orange-400 font-black rounded-xl text-sm hover:bg-orange-500/30 transition-colors disabled:opacity-40 flex items-center justify-center gap-2",children:[e.jsx(Ge,{className:"h-4 w-4"}),t>0?`${t} Termine generieren`:"Datum auswählen"]})})(),te.length>0&&e.jsxs("div",{className:"bg-white/5 rounded-xl p-3 space-y-1 border border-white/10",children:[e.jsxs("div",{className:"flex justify-between text-[10px] font-black text-white/40 uppercase mb-2",children:[e.jsxs("span",{children:[te.length," Termine generiert"]}),e.jsx("button",{onClick:()=>R([]),className:"text-red-400/60 hover:text-red-400",children:"Löschen"})]}),te.slice(0,5).map((t,s)=>{let a=t.date;try{a=new Date(t.date+"T00:00:00").toLocaleDateString("de-DE",{weekday:"short",day:"2-digit",month:"2-digit"})}catch{}return e.jsxs("div",{className:"text-xs text-white/50",children:[a," · ",t.times.map(n=>n.timeLabel).join(", ")]},s)}),te.length>5&&e.jsxs("div",{className:"text-xs text-white/30",children:["+",te.length-5," weitere"]})]})]}):e.jsxs("div",{className:"space-y-2",children:[te.map((t,s)=>{let a=t.date;try{a=t.date?new Date(t.date+"T00:00:00").toLocaleDateString("de-DE",{weekday:"short",day:"2-digit",month:"2-digit"}):""}catch{}return e.jsxs("div",{className:"bg-white/5 rounded-xl p-3 space-y-2 border border-white/10",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"date",value:t.date,onChange:n=>R(r=>r.map((i,l)=>l===s?{...i,date:n.target.value}:i)),className:"flex-1 bg-white/5 border border-white/10 rounded-lg px-3 py-2 text-white text-xs focus:outline-none"}),e.jsx("button",{onClick:()=>R(n=>n.filter((r,i)=>i!==s)),className:"text-white/20 hover:text-red-400",children:e.jsx(z,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"text-[10px] text-white/30 px-1",children:a}),t.times.map((n,r)=>e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsxs("select",{value:n.timeLabel.match(/^\d{2}:\d{2}$/)?"custom":n.timeLabel,onChange:i=>{const l=i.target.value==="custom"?"08:00":i.target.value;R(o=>o.map((u,w)=>w===s?{...u,times:u.times.map((S,I)=>I===r?{...S,timeLabel:l}:S)}:u))},className:"flex-1 bg-black/40 border border-white/10 p-2 rounded-xl text-xs font-bold text-white outline-none",children:[e.jsx("option",{value:"morgens",children:"Morgens"}),e.jsx("option",{value:"mittags",children:"Mittags"}),e.jsx("option",{value:"abends",children:"Abends"}),e.jsx("option",{value:"custom",children:"Uhrzeitâ¦"})]}),n.timeLabel.match(/^\d{2}:\d{2}$/)&&e.jsx("input",{type:"time",value:n.timeLabel,onChange:i=>R(l=>l.map((o,u)=>u===s?{...o,times:o.times.map((w,S)=>S===r?{...w,timeLabel:i.target.value}:w)}:o)),className:"w-24 bg-black/40 border border-white/10 p-2 rounded-xl text-xs font-bold text-white outline-none"}),e.jsx("input",{type:"number",min:"1",placeholder:"Max",value:n.maxHelpers,onChange:i=>R(l=>l.map((o,u)=>u===s?{...o,times:o.times.map((w,S)=>S===r?{...w,maxHelpers:i.target.value}:w)}:o)),className:"w-16 bg-black/40 border border-white/10 p-2 rounded-xl text-xs font-bold text-white outline-none text-center"}),t.times.length>1&&e.jsx("button",{onClick:()=>R(i=>i.map((l,o)=>
9o===s?{...l,times:l.times.filter((u,w)=>w!==r)}:l)),className:"text-white/20 hover:text-red-400",children:e.jsx(z,{className:"h-4 w-4"})})]},r)),e.jsx("button",{onClick:()=>R(n=>n.map((r,i)=>i===s?{...r,times:[...r.times,{timeLabel:"",maxHelpers:"4"}]}:r)),className:"text-xs text-orange-400/60 hover:text-orange-400 font-bold",children:"+ Uhrzeit"})]},s)}),e.jsx("button",{onClick:()=>R(t=>[...t,{date:"",times:[{timeLabel:"morgens",maxHelpers:"4"}]}]),className:"w-full py-2.5 bg-white/5 border border-dashed border-white/20 text-white/40 hover:text-white rounded-xl text-xs font-bold transition-colors",children:"+ Termin hinzufügen"})]}),e.jsx("p",{className:"text-xs text-white/30",children:"Bestehende Termine und Anmeldungen werden nicht verändert."}),e.jsx("button",{onClick:Hs,disabled:!Q.trim(),className:"w-full py-3 rounded-xl bg-orange-500 text-black font-black text-sm disabled:opacity-40",children:"Speichern"})]})]})]}),ze&&e.jsxs("div",{className:"fixed inset-0 z-[100] flex items-end sm:items-center justify-center p-4 pb-10 sm:pb-4",children:[e.jsx("div",{className:"absolute inset-0 bg-black/80 backdrop-blur-sm animate-in fade-in",onClick:()=>ie(!1)}),e.jsxs(A,{className:"bg-slate-900 w-full max-w-sm p-6 relative animate-in slide-in-from-bottom-4 sm:zoom-in-95",children:[e.jsxs("div",{className:"flex justify-between items-center mb-5",children:[e.jsx("h2",{className:"text-lg font-black text-white",children:"Was möchtest du erstellen?"}),e.jsx("button",{onClick:()=>ie(!1),className:"p-2 bg-white/5 rounded-full hover:bg-white/10 text-white/50",children:e.jsx(z,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("button",{onClick:()=>{ie(!1),be(!0)},className:"w-full text-left p-4 bg-orange-500/10 border border-orange-500/30 rounded-2xl hover:bg-orange-500/20 active:scale-[0.98] transition-all group",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"h-10 w-10 rounded-xl bg-orange-500/20 border border-orange-500/30 flex items-center justify-center shrink-0 group-hover:bg-orange-500/30 transition-colors",children:e.jsx(Ie,{className:"h-5 w-5 text-orange-400"})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-black text-white text-sm mb-1",children:"Sammel-/Mehrterminaufgabe"}),e.jsx("div",{className:"text-xs text-white/50 leading-relaxed",children:"Mehrere Termine (auch wiederkehrend) auf einmal. Mitglieder melden sich pro Zeitslot an â perfekt für Arbeitseinsätze über mehrere Tage."})]})]})}),e.jsx("button",{onClick:()=>{ie(!1),ae(!0)},className:"w-full text-left p-4 bg-white/5 border border-white/10 rounded-2xl hover:bg-white/10 active:scale-[0.98] transition-all group",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"h-10 w-10 rounded-xl bg-white/10 border border-white/10 flex items-center justify-center shrink-0 group-hover:bg-white/15 transition-colors",children:e.jsx(ds,{className:"h-5 w-5 text-white/60"})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-black text-white text-sm mb-1",children:"Einzelterminaufgabe"}),e.jsx("div",{className:"text-xs text-white/50 leading-relaxed",children:"Eine Aufgabe an einem einzigen Datum und Zeitpunkt. Einfach und schnell â für spontane oder einmalige Einsätze."})]})]})})]})]})]}),Be&&e.jsxs("div",{className:"fixed inset-0 z-[100] flex items-center justify-center p-4 pb-24",children:[e.jsx("div",{className:"absolute inset-0 bg-black/90 backdrop-blur-md animate-in fade-in",onClick:()=>be(!1)}),e.jsxs(A,{className:"bg-slate-900 w-full max-w-sm p-6 relative animate-in zoom-in-95 max-h-[92vh] overflow-y-auto custom-scrollbar",children:[e.jsxs("div",{className:"flex justify-between items-center mb-6",children:[e.jsxs("h2",{className:"text-xl font-black text-white flex items-center gap-2",children:[e.jsx(Ie,{className:"h-5 w-5 text-orange-500"})," Sammelaufruf erstellen"]}),e.jsx("button",{onClick:()=>be(!1),className:"p-2 bg-white/5 rounded-full hover:bg-white/10 text-white/50",children:e.jsx(z,{className:"h-5 w-5"})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("input",{value:ge,onChange:t=>Bt(t.target.value),placeholder:"Titel des Aufrufs",className:"w-full bg-black/40 border border-white/10 p-4 rounded-2xl text-sm font-bold text-white outline-none focus:border-orange-500/50 shadow-inner"}),e.jsx("textarea",{value:nt,onChange:t=>Ot(t.target.value),placeholder:"Beschreibung...",className:"w-full bg-black/40 border border-white/10 p-4 rounded-2xl text-sm font-medium text-slate-300 h-20 resize-none outline-none focus:border-orange-500/50 shadow-inner custom-scrollbar"}),e.jsx("input",{value:rt,onChange:t=>Ft(t.target.value),placeholder:"Ort",className:"w-full bg-black/40 border border-white/10 p-4 rounded-2xl text-sm font-bold text-white outline-none focus:border-orange-500/50 shadow-inner"}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-black text-white/50 uppercase tracking-wider mb-2",children:"Bild für Newsbeitrag"}),Vt&&e.jsxs("div",{className:"rounded-2xl overflow-hidden mb-2 relative",style:{aspectRatio:"16/9"},children:[e.jsx("img",{src:Vt,alt:"",className:"w-full h-full object-cover"}),e.jsx("button",{onClick:()=>{it(null),lt("")},className:"absolute top-2 right-2 p-1.5 bg-black/60 rounded-full text-white/80 hover:bg-black/80",children:e.jsx(z,{className:"h-3.5 w-3.5"})})]}),e.jsxs("label",{className:"flex items-center gap-3 p-4 bg-white/5 border border-dashed border-white/20 rounded-2xl cursor-pointer hover:bg-white/10 transition-colors",children:[e.jsx(xa,{
9className:"h-5 w-5 text-orange-400 shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm font-bold text-white truncate",children:we?we.name:"Bild auswählen"}),e.jsx("div",{className:"text-xs text-orange-400/70 mt-0.5",children:"ð¡ Empfohlen â erscheint im Newsbeitrag"})]}),e.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:t=>{const s=t.target.files?.[0];s&&(it(s),lt(URL.createObjectURL(s)))}})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("label",{className:"text-xs font-black text-white/50 uppercase tracking-wider",children:"Termine & Zeitslots"}),e.jsxs("div",{className:"flex rounded-xl overflow-hidden border border-white/10 text-xs font-black",children:[e.jsx("button",{onClick:()=>ot(!1),className:`px-3 py-1.5 transition-colors ${le?"bg-white/5 text-white/50 hover:bg-white/10":"bg-orange-500 text-black"}`,children:"Manuell"}),e.jsx("button",{onClick:()=>ot(!0),className:`px-3 py-1.5 transition-colors ${le?"bg-orange-500 text-black":"bg-white/5 text-white/50 hover:bg-white/10"}`,children:"Wiederkehrend"})]})]}),le&&e.jsxs("div",{className:"p-4 bg-white/5 border border-white/10 rounded-2xl space-y-3 mb-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] font-black text-white/40 uppercase tracking-wider mb-1",children:"Startdatum"}),e.jsx("input",{type:"date",value:fe,onChange:t=>Wt(t.target.value),className:"w-full bg-black/40 border border-white/10 p-3 rounded-xl text-sm font-bold text-white outline-none"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] font-black text-white/40 uppercase tracking-wider mb-1",children:"Enddatum"}),e.jsx("input",{type:"date",value:je,onChange:t=>qt(t.target.value),className:"w-full bg-black/40 border border-white/10 p-3 rounded-xl text-sm font-bold text-white outline-none"})]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] font-black text-white/40 uppercase tracking-wider mb-1",children:"Wiederholung"}),e.jsx("div",{className:"flex rounded-xl overflow-hidden border border-white/10 text-xs font-black",children:[["daily","Täglich"],["weekly","Wöchentl."],["monthly","Monatlich"]].map(([t,s])=>e.jsx("button",{onClick:()=>Jt(t),className:`flex-1 py-2.5 transition-colors ${ve===t?"bg-orange-500 text-black":"bg-white/5 text-white/50 hover:bg-white/10"}`,children:s},t))})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] font-black text-white/40 uppercase tracking-wider mb-2",children:"Zeitslots pro Termin"}),ct.map((t,s)=>e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsxs("select",{value:t.timeLabel.match(/^\d{2}:\d{2}$/)?"custom":t.timeLabel,onChange:a=>{const n=a.target.value==="custom"?"08:00":a.target.value;oe(r=>r.map((i,l)=>l===s?{...i,timeLabel:n}:i))},className:"flex-1 bg-black/40 border border-white/10 p-2.5 rounded-xl text-sm font-bold text-white outline-none",children:[e.jsx("option",{value:"morgens",children:"Morgens"}),e.jsx("option",{value:"mittags",children:"Mittags"}),e.jsx("option",{value:"abends",children:"Abends"}),e.jsx("option",{value:"custom",children:"Uhrzeitâ¦"})]}),t.timeLabel.match(/^\d{2}:\d{2}$/)&&e.jsx("input",{type:"time",value:t.timeLabel,onChange:a=>oe(n=>n.map((r,i)=>i===s?{...r,timeLabel:a.target.value}:r)),className:"w-24 bg-black/40 border border-white/10 p-2.5 rounded-xl text-sm font-bold text-white outline-none"}),e.jsx("input",{type:"number",min:"1",value:t.maxHelpers,placeholder:"Helfer",onChange:a=>oe(n=>n.map((r,i)=>i===s?{...r,maxHelpers:a.target.value}:r)),className:"w-20 bg-black/40 border border-white/10 p-2.5 rounded-xl text-sm font-bold text-white outline-none text-center"}),ct.length>1&&e.jsx("button",{onClick:()=>oe(a=>a.filter((n,r)=>r!==s)),className:"p-2 text-white/30 hover:text-red-400",children:e.jsx(z,{className:"h-3.5 w-3.5"})})]},s)),e.jsxs("button",{onClick:()=>oe(t=>[...t,{timeLabel:"abends",maxHelpers:"4"}]),className:"text-xs text-orange-400/70 hover:text-orange-400 font-bold flex items-center gap-1",children:[e.jsx(Je,{className:"h-3 w-3"})," Zeitslot"]})]}),(()=>{const t=_s();return e.jsxs("button",{onClick:Es,disabled:t===0,className:"w-full py-3 bg-orange-500/20 border border-orange-500/40 text-orange-400 font-black rounded-xl text-sm hover:bg-orange-500/30 transition-colors disabled:opacity-40 disabled:cursor-not-allowed flex items-center justify-center gap-2",children:[e.jsx(Ge,{className:"h-4 w-4"}),t>0?`${t} Termin${t!==1?"e":""} generieren`:"Termine generieren"]})})()]}),!le&&e.jsx("div",{className:"flex justify-end mb-2",children:e.jsxs("button",{onClick:()=>G(t=>[...t,{date:"",times:[{timeLabel:"morgens",maxHelpers:"4"}]}]),className:"flex items-center gap-1 px-3 py-1.5 bg-orange-500/20 border border-orange-500/30 text-orange-400 rounded-lg text-xs font-bold hover:bg-orange-500/30 transition-colors",children:[e.jsx(Je,{className:"h-3 w-3"})," Datum"]})}),J.length>0&&e.jsxs("div",{className:"space-y-3",children:[le&&e.jsxs("div",{className:"flex items-center justify-between text-xs font-black text-white/40 uppercase tracking-wider px-1",children:[e.jsxs("span",{children:["Generierte Termine (",J.length,")"]}),e.jsx("button",{onClick:()=>G([]),className:"text-red-400/60 hover:text-red-400 font-bold",children:"Alle löschen"})]}),J.map((t,s)=>{let a=t.date;try{a=t.date?new Date(t.date+"T00:00:00").toLocaleDateString("de-DE",{weekday:"short",day:"2-digit",month:"2-digit"}):""}catch{}return e.jsxs("div",{className:"p-3 bg-white/5 border border-white/10 rounded-2xl",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[le?e.jsx("div",{className:"flex-1 text-sm font-black text-white px-3 py-2 bg-black/20 rounded-xl",children:a||t.date}):e.jsx("input",{type:"date",value:t.date,onChange:n=>{const r=[...J];r[s]={...r[s],date:n.target.value},G(r)},className:"flex-1 bg-black/40 border border-white/10 p-3 rounded-xl text-sm font-bold text-white outline-none"}),e.jsx("button",{onClick:()=>G(n=>n.filter((r,i)=>i!==s)),className:"p-2 text-white/30 hover:text-red-400",children:e.jsx(se,{className:"h-4 w-4"})})]}),t.times.map((n,r)=>e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsxs("select",{value:n.timeLabel.match(/^\d{2}:\d{2}
9$/)?"custom":n.timeLabel,onChange:i=>{const l=[...J],o=i.target.value==="custom"?"08:00":i.target.value;l[s]={...l[s],times:l[s].times.map((u,w)=>w===r?{...u,timeLabel:o}:u)},G(l)},className:"flex-1 bg-black/40 border border-white/10 p-2.5 rounded-xl text-sm font-bold text-white outline-none",children:[e.jsx("option",{value:"morgens",children:"Morgens"}),e.jsx("option",{value:"mittags",children:"Mittags"}),e.jsx("option",{value:"abends",children:"Abends"}),e.jsx("option",{value:"custom",children:"Uhrzeitâ¦"})]}),n.timeLabel.match(/^\d{2}:\d{2}$/)&&e.jsx("input",{type:"time",value:n.timeLabel,onChange:i=>{const l=[...J];l[s]={...l[s],times:l[s].times.map((o,u)=>u===r?{...o,timeLabel:i.target.value}:o)},G(l)},className:"w-24 bg-black/40 border border-white/10 p-2.5 rounded-xl text-sm font-bold text-white outline-none"}),e.jsx("input",{type:"number",min:"1",value:n.maxHelpers,placeholder:"Helfer",onChange:i=>{const l=[...J];l[s]={...l[s],times:l[s].times.map((o,u)=>u===r?{...o,maxHelpers:i.target.value}:o)},G(l)},className:"w-20 bg-black/40 border border-white/10 p-2.5 rounded-xl text-sm font-bold text-white outline-none text-center"}),t.times.length>1&&e.jsx("button",{onClick:()=>{const i=[...J];i[s]={...i[s],times:i[s].times.filter((l,o)=>o!==r)},G(i)},className:"p-2 text-white/30 hover:text-red-400",children:e.jsx(z,{className:"h-3.5 w-3.5"})})]},r)),e.jsxs("button",{onClick:()=>{const n=[...J];n[s]={...n[s],times:[...n[s].times,{timeLabel:"abends",maxHelpers:"4"}]},G(n)},className:"text-xs text-orange-400/70 hover:text-orange-400 font-bold flex items-center gap-1 mt-1",children:[e.jsx(Je,{className:"h-3 w-3"})," Zeitslot"]})]},s)})]})]}),e.jsx("button",{onClick:Ds,disabled:Gt,className:"w-full py-4 bg-gradient-to-r from-orange-500 to-amber-600 text-black font-black rounded-2xl mt-2 uppercase tracking-widest shadow-xl disabled:opacity-50 flex items-center justify-center gap-2",children:Gt?e.jsxs(e.Fragment,{children:[e.jsx(vt,{className:"h-4 w-4 animate-spin"})," Erstelleâ¦"]}):"Veröffentlichen"})]})]})]}),D&&e.jsxs("div",{className:"fixed inset-0 z-[100] flex items-center justify-center p-6 pb-24",onClick:()=>Ne(null),children:[e.jsx("div",{className:"absolute inset-0 bg-black/90 backdrop-blur-md animate-in fade-in"}),e.jsxs(A,{className:"w-full max-w-sm p-6 relative animate-in zoom-in-95 max-h-[85vh] flex flex-col",onClick:t=>t.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsxs("h3",{className:"font-black text-lg text-white flex items-center gap-2",children:[e.jsx(Ke,{className:"h-5 w-5 text-orange-500"})," Teilnehmer"]}),e.jsx("button",{onClick:()=>Ne(null),className:"p-2 bg-white/5 rounded-full hover:bg-white/10 text-white/50",children:e.jsx(z,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"text-xs text-white/40 font-bold mb-4",children:[(()=>{try{return new Date(D.slot.date+"T00:00:00").toLocaleDateString("de-DE",{weekday:"long",day:"2-digit",month:"2-digit"})}catch{return D.slot.date}})()," · ",D.slot.timeLabel," · ",D.slot.registrations.length,"/",D.slot.maxHelpers," Plätze"]}),e.jsxs("div",{className:"overflow-y-auto custom-scrollbar flex-1 space-y-2 mb-4 min-h-0",children:[D.slot.registrations.map((t,s)=>e.jsxs("div",{className:"flex items-center gap-3 p-3 bg-white/5 border border-white/5 rounded-2xl",children:[e.jsx("div",{className:"h-9 w-9 rounded-full bg-gradient-to-br from-orange-500 to-amber-600 text-black flex items-center justify-center font-black text-xs shadow-lg shrink-0",children:t.name.charAt(0)}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-bold text-white truncate",children:t.name}),t.registeredBy&&e.jsxs("div",{className:"text-xs text-white/30",children:["eingetragen von ",t.registeredBy]})]}),e.jsx("button",{onClick:()=>Bs(D.call,D.slot,t.userId),className:"p-1.5 text-white/20 hover:text-red-400 transition-colors",children:e.jsx(z,{className:"h-4 w-4"})})]},s)),D.slot.registrations.length===0&&e.jsx("p",{className:"text-white/30 text-center py-6 italic text-sm",children:"Noch niemand angemeldet."})]}),e.jsxs("div",{className:"border-t border-white/10 pt-4 shrink-0",children:[e.jsx("div",{className:"text-xs font-black text-white/50 uppercase tracking-wider mb-2",children:"Mitglied eintragen"}),e.jsxs("div",{className:"relative",children:[Oe.length>1&&e.jsxs("div",{className:"absolute bottom-full mb-1 left-0 right-0 bg-slate-800 border border-white/10 rounded-xl max-h-52 overflow-y-auto p-1 custom-scrollbar z-10",children:[Y.filter(t=>t.name?.toLowerCase().includes(Oe.toLowerCase())&&!(D.slot.registrations||[]).some(s=>s.userId===t.id)).slice(0,8).map(t=>e.jsx("div",{onClick:()=>
9{zs(D.call,D.slot,t.accountUid||t.id,t.name),Fe("")},className:"p-2.5 text-sm text-white hover:bg-white/10 cursor-pointer rounded-lg font-medium",children:t.name},t.id)),Y.filter(t=>t.name?.toLowerCase().includes(Oe.toLowerCase())).length===0&&e.jsx("div",{className:"p-2 text-xs text-white/30 text-center",children:"Keine Treffer"})]}),e.jsx(Nt,{className:"absolute left-3 top-3 h-4 w-4 text-white/30"}),e.jsx("input",{placeholder:"Mitglied suchenâ¦",value:Oe,onChange:t=>Fe(t.target.value),className:"w-full bg-black/40 border border-white/10 rounded-xl h-10 pl-10 pr-3 text-sm font-bold text-white outline-none"})]})]})]})]})]})}export{Ua as default};
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.