PageSourceSearch

https://livinglines.app/static/js/1985.b2bb07cc.chunk.js

js livinglines.app collected 2026-10-07 13:37:36 UTC 365,276 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkranking=self.webpackChunkranking||[]).push([[1985],{1985(e,s,n){n.r(s),n.d(s,{AdminTeacherExplorerModal:()=>va,default:()=>Ta});var t=n(3986),a=n(9379),l=n(9950),i=n(2994),r=n(5214),c=n(486),o=n(4414);const d=function(){let e=arguments.length>1?arguments[1]:void 0;return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).map(s=>({date:s.day,value:Number(s[e])||0}))},u=e=>{let s=0;return e.map(e=>({date:e.date,value:s+=e.value}))},h=600,m=e=>{if(!e.length)return[];const s=e.length,n=[];let t=null;if(e.forEach((e,a)=>{const l=new Date(e.date+"T00:00:00"),i="".concat(l.getFullYear(),"-").concat(l.getMonth());if(i!==t){t=i;const e=(e=>16+568*e/Math.max(1,s-1))(a);n.push({x:e,pct:e/h*100,label:l.toLocaleDateString("de-DE",{month:"short",year:"2-digit"})})}}),!n.length)return[];const a=Math.ceil(n.length/6);return n.filter((e,s)=>s%a===0)},p=e=>{var s;let{series:n=[],height:t=120,yLabel:a=""}=e;const[i,r]=(0,l.useState)(()=>new Set),c=h,d=16,u=n.filter(e=>!i.has(e.label)),p=u.flatMap(e=>e.data.map(e=>e.value)),g=Math.max(1,...p),x=(null===(s=n[0])||void 0===s?void 0:s.data)||[],v=m(x);return(0,o.jsxs)("div",{className:"line-chart",children:[(0,o.jsxs)("div",{className:"line-axis",children:[(0,o.jsx)("span",{children:g}),(0,o.jsx)("span",{children:Math.round(g/2)}),(0,o.jsx)("span",{children:"0"})]}),(0,o.jsxs)("div",{className:"line-canvas",children:[(0,o.jsxs)("svg",{viewBox:"0 0 ".concat(c," ").concat(t),preserveAspectRatio:"none",style:{height:t},children:[(0,o.jsx)("line",{x1:d,y1:t-d,x2:584,y2:t-d,stroke:"#e2e8f0"}),(0,o.jsx)("line",{x1:d,y1:d,x2:584,y2:d,stroke:"#f1f5f9"}),(0,o.jsx)("line",{x1:d,y1:(t-d)/2,x2:584,y2:(t-d)/2,stroke:"#f1f5f9"}),v.map(e=>(0,o.jsx)("line",{x1:e.x,y1:d,x2:e.x,y2:t-d,stroke:"#f1f5f9",strokeWidth:"1",strokeDasharray:"3,2"},e.label)),u.map(e=>{return(0,o.jsx)("polyline",{fill:"none",stroke:e.color,strokeWidth:"2",points:(s=e.data,s.map((e,n)=>{const a=d+568*n/Math.max(1,s.length-1),l=d+(t-32)*(1-e.value/g);return"".concat(a,",").concat(l)}).join(" "))},e.label);var s})]}),a&&(0,o.jsx)("span",{className:"line-y-label",children:a})]}),(0,o.jsx)("div",{className:"line-x-axis",children:v.map(e=>(0,o.jsx)("span",{style:{left:"".concat(e.pct,"%")},children:e.label},e.label))}),(0,o.jsx)("div",{className:"line-legend",children:n.map(e=>(0,o.jsx)("span",{title:e.label,className:"legend-item".concat(i.has(e.label)?" legend-item--off":""),onClick:()=>{return s=e.label,r(e=>{const n=new Set(e);return n.has(s)?n.delete(s):n.add(s),n});var s},children:e.icon?(0,o.jsx)("span",{className:"legend-icon",style:{color:e.color},children:e.icon}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("i",{style:{background:i.has(e.label)?"transparent":e.color,borderColor:e.color}}),e.label]})},e.label))})]})},g=e=>{var s,n;let{series:t=[],height:a=220,yLabel:i=""}=e;const[r,c]=(0,l.useState)(()=>new Set),d=h,u=16,p=t.filter(e=>!r.has(e.label)),g=(null===(s=t[0])||void 0===s||null===(n=s.data)||void 0===n?void 0:n.length)||0;if(!g)return null;const x=t[0].data.map((e,s)=>p.reduce((e,n)=>{var t;return e+((null===(t=n.data[s])||void 0===t?void 0:t.value)||0)},0)),v=Math.max(1,...x),j=e=>u+568*e/Math.max(1,g-1),_=e=>u+(a-32)*(1-e/v),b=m(t[0].data),f=[];let y=new Array(g).fill(0);for(const l of p){const e=[...y];y=y.map((e,s)=>{var n;return e+((null===(n=l.data[s])||void 0===n?void 0:n.value)||0)});const s=[...y].map((e,s)=>"".concat(j(s),",").concat(_(e))).join(" "),n=[...e].reverse().map((e,s)=>"".concat(j(g-1-s),",").concat(_(e))).join(" ");f.push({points:"".concat(s," ").concat(n),color:l.color,label:l.label})}return(0,o.jsxs)("div",{className:"line-chart",children:[(0,o.jsxs)("div",{className:"line-axis",children:[(0,o.jsx)("span",{children:v}),(0,o.jsx)("span",{children:Math.round(v/2)}),(0,o.jsx)("span",{children:"0"})]}),(0,o.jsxs)("div",{className:"line-canvas",children:[(0,o.jsxs)("svg",{viewBox:"0 0 ".concat(d," ").concat(a),preserveAspectRatio:"none",style:{height:a},children:[(0,o.jsx)("line",{x1:u,y1:a-u,x2:584,y2:a-u,stroke:"#e2e8f0"}),(0,o.jsx)("line",{x1:u,y1:u,x2:584,y2:u,stroke:"#f1f5f9"}),(0,o.jsx)("line",{x1:u,y1:(a-u)/2,x2:584,y2:(a-u)/2,stroke:"#f1f5f9"}),b.map(e=>(0,o.jsx)("line",{x1:e.x,y1:u,x2:e.x,y2:a-u,stroke:"rgba(255,255,255,0.5)",strokeWidth:"1"},e.label)),f.map(e=>(0,o.jsx)("polygon",{points:e.points,fill:e.color,fillOpacity:"0.75",stroke:e.color,strokeWidth:"1.5",strokeLinejoin:"round"},e.label))]}),i&&(0,o.jsx)("span",{className:"line-y-label",children:i})]}),(0,o.jsx)("div",{className:"line-x-axis",children:b.map(e=>(0,o.jsx)("span",{style:{left:"".concat(e.pct,"%")},children:e.label},e.label))}),(0,o.jsx)("div",{className:"line-legend",children:t.map(e=>(0,o.jsx)("span",{title:e.label,className:"legend-item".concat(r.has(e.label)?" legend-item--off":""),onClick:()=>{return s=e.label,c(e=>{const n=new Set(e);return n.has(s)?n.delete(s):n.add(s),n});var s},children:e.icon?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{className:"legend-icon",style:{color:r.has(e.label)?"#cbd5e1":e.color},children:e.icon}),e.label,null!=e.total&&(0,o.jsx)("span",{className:"legend-total",children:e.total.toLocaleStr
1ing("de-DE")})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("i",{style:{background:r.has(e.label)?"transparent":e.color,borderColor:e.color}}),e.label,null!=e.total&&(0,o.jsx)("span",{className:"legend-total",children:e.total.toLocaleString("de-DE")})]})},e.label))})]})};var x=n(2875);const v=function(e,s){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:96,t=arguments.length>3&&void 0!==arguments[3]?arguments[3]:28;const a=Math.max(1,s),l=n/Math.max(1,e.length-1);return e.map((e,s)=>"".concat((s*l).toFixed(1),",").concat((t-2-Math.sqrt(Math.max(0,e)/a)*(t-4)).toFixed(1)))};function j(e){let{values:s=[],maxValue:n=1,color:t="#4f46e5",weeks:a=[],label:l="Bearbeitungen",width:i=96}=e;if(!s.length)return null;const r=28,c=v(s,n,i,r),d=s.reduce((e,s)=>e+Number(s||0),0);return(0,o.jsxs)("svg",{className:"so-spark",viewBox:"0 0 ".concat(i," ").concat(r),width:i,height:r,role:"img","aria-label":"".concat(l,": ").concat(d.toLocaleString("de-DE")," in ").concat(s.length," Wochen; gemeinsame Wurzelskala bis ").concat(n.toLocaleString("de-DE")," je Woche"),children:[(0,o.jsxs)("title",{children:[l," \xb7 gemeinsame Wurzelskala: kleine Werte deutlicher sichtbar \xb7 maximal ",n.toLocaleString("de-DE")," pro Woche"]}),(0,o.jsx)("line",{x1:"0",y1:26,x2:i,y2:26,stroke:"#e2e8f0"}),(0,o.jsx)("polygon",{points:"0,".concat(26," ").concat(c.join(" ")," ").concat(i,",").concat(26),fill:t,fillOpacity:"0.15"}),(0,o.jsx)("polyline",{points:c.join(" "),fill:"none",stroke:t,strokeWidth:"1.6",strokeLinejoin:"round"}),s.map((e,n)=>(0,o.jsx)("rect",{x:n*i/s.length,y:"0",width:i/s.length,height:r,fill:"transparent",children:(0,o.jsxs)("title",{children:[a[n]?"Woche ab ".concat(new Date("".concat(a[n],"T00:00:00")).toLocaleDateString("de-DE")):"Woche ".concat(n+1),": ",Number(e||0).toLocaleString("de-DE")," Bearbeitungen"]})},n))]})}var _=n(5177),b=n(8327),f=n(541),y=n(5645);const k=e=>{let{value:s}=e;const n=s?new Date(/(?:Z|[+-]\d\d:\d\d)$/.test(s)?s:"".concat(s,"Z")):null;return!n||Number.isNaN(n.getTime())?(0,o.jsx)("span",{children:"\u2013"}):(0,o.jsxs)("time",{dateTime:n.toISOString(),title:"Registriert am \xb7 Europe/Berlin",children:[(0,o.jsx)("span",{children:n.toLocaleDateString("de-DE",{timeZone:"Europe/Berlin",day:"2-digit",month:"2-digit",year:"numeric"})}),(0,o.jsxs)("small",{children:[n.toLocaleTimeString("de-DE",{timeZone:"Europe/Berlin",hour:"2-digit",minute:"2-digit"})," Uhr"]})]})},N=e=>e&&"none"!==e?"test"===e?{label:"Testlizenz",icon:(0,o.jsx)(x.XcJ,{})}:{label:"Jahreslizenz",icon:(0,o.jsx)(x.veT,{})}:{label:"Noch keine Schullizenz",icon:null},S=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"regular";if("none"===e)return{start:"",end:""};const s=new Date,n=new Date(s);"test"===e?n.setDate(s.getDate()+27):n.setFullYear(s.getFullYear()+1);const t=e=>e.toISOString().slice(0,10);return{start:t(s),end:t(n)}},w=(e,s,n)=>{if(!n||"none"===n)return{label:"Ohne Schullizenz",state:"inactive"};const t=(new Date).toLocaleDateString("sv-SE"),a=e?String(e).slice(0,10):null,l=s?String(s).slice(0,10):null;return"test"!==n||l?l&&l<t?{label:"Abgelaufen",state:"expired"}:a&&a>t?{label:"Inaktiv",state:"inactive"}:{label:"Aktiv",state:"active"}:{label:"Enddatum fehlt",state:"inactive"}},z=(e,s)=>{const n=(null===e||void 0===e?void 0:e.message)||s;if("string"!==typeof n)return s;const t=n.trim();if(t.startsWith("{"))try{const e=JSON.parse(t);if(null!==e&&void 0!==e&&e.detail)return e.detail}catch(a){return n}return n},A=864e5,C=e=>{const s=String(e||"").trim();return/^\d+$/.test(s)?s.replace(/^0+(?=\d)/,""):s.toLocaleLowerCase("de-DE")},D=e=>String(e||"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/\xdf/g,"ss").toLocaleLowerCase("de-DE").replace(/[^a-z0-9]+/g," ").trim().replace(/\s+/g," "),L={staatl:"staatliche",stadtl:"stadtische",priv:"private",gym:"gymnasium",rs:"realschule",gs:"grundschule",ms:"mittelschule",vs:"volksschule",wis:"wirtschaftsschule",fos:"fachoberschule",bos:"berufsoberschule",st:"sankt",v:"von"},E=e=>D(e).split(" ").filter(Boolean).map(e=>L[e]||e),M=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const s=new Map,n=new Map,t=new Map,a=new Map,l=new Map;
1e.forEach(e=>{const i=C(e.official_id);i&&s.set(i,[...s.get(i)||[],e]);const r=D(e.name);r&&n.set(r,[...n.get(r)||[],e]),e.id&&t.set(e.id,e);const c=new Set([...E(e.name),...E(e.city),String(e.postal_code||"")].filter(Boolean));l.set(e,c),c.forEach(s=>a.set(s,[...a.get(s)||[],e]))});const i=Math.max(1,e.length);return{byId:s,byName:n,byKey:t,byToken:a,tokensOf:l,weight:e=>Math.log(1+i/((a.get(e)||[]).length||1))}},T=function(e,s){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:8;if(!s)return[];const t=[...new Set(E(e))];if(!t.length)return[];const a=t.reduce((e,n)=>e+s.weight(n),0),l=new Set;return t.forEach(e=>(s.byToken.get(e)||[]).forEach(e=>l.add(e))),[...l].map(e=>{const n=s.tokensOf.get(e);return{school:e,score:t.reduce((e,t)=>e+(n.has(t)?s.weight(t):0),0)/a}}).sort((e,s)=>s.score-e.score||e.school.name.localeCompare(s.school.name,"de")).slice(0,n)},K=e=>e&&e.progress_total?e.progress_30d>0?"active":"asleep":"never",B={active:"Aktiv",asleep:"Eingeschlafen",never:"Nie aktiv"},F=e=>{const s=Number((null===e||void 0===e?void 0:e.progress_30d)||0),n=Number((null===e||void 0===e?void 0:e.progress_prev_30d)||0);if(!n)return s>0?{kind:"new",pct:null}:{kind:"none",pct:null};const t=Math.round((s-n)/n*100);return{kind:t>10?"up":t<-10?"down":"flat",pct:t}},P=function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Date.now();if(!e)return null;const n=new Date(e).getTime();return Number.isNaN(n)?null:Math.max(0,Math.floor((s-n)/A))},R=/gewonnen|closed ?won|\bwon\b/i,H=/verloren|closed ?lost|\blost\b/i,O=e=>e.stage_state||(R.test(e.stage||"")?"won":H.test(e.stage||"")?"lost":"open"),W=e=>{const s=(null===e||void 0===e?void 0:e.deals)||[],n=e=>e.reduce((e,s)=>e+(Number(s.amount)||0),0),t=s.filter(e=>"won"===O(e)),a=s.filter(e=>"lost"===O(e)),l=s.filter(e=>!t.includes(e)&&!a.includes(e)),i=[...s].sort((e,s)=>String(s.close_date||"").localeCompare(String(e.close_date||"")))[0]||null;return{count:s.length,open:l,won:t,lost:a,openAmount:n(l),wonAmount:n(t),latest:i}},Z=function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(new Date).toISOString().slice(0,10);return!(null===e||void 0===e||!e.license_type||"none"===e.license_type)&&(!(e.license_start_date&&String(e.license_start_date).slice(0,10)>s)&&!(e.license_end_date&&String(e.license_end_date).slice(0,10)<s))},V={"\xd6sterreich":"AT",Schweiz:"CH"},I=(e,s,n)=>{const t=V[e.state]||"DE";if(null!==s&&void 0!==s&&s.postal_code)return{country:s.country||"DE",postal:String(s.postal_code),source:"DACH-Verzeichnis"};const a=String((null===n||void 0===n?void 0:n.zip)||"").trim();return/^\d{5}$/.test(a)&&"DE"===t||/^\d{4}$/.test(a)&&"DE"!==t?{country:t,postal:a,source:"HubSpot"}:null},G=e=>{let{schools:s=[],activity:n=null,publicIndex:t=null,hubspot:l=null,now:i=Date.now()}=e;return s.map(e=>{var s,r,c,o,d,u,h,m;const p=(null===n||void 0===n||null===(s=n.schools)||void 0===s?void 0:s[e.id])||null,g=null!==(r=null===p||void 0===p?void 0:p.public_directory_id)&&void 0!==r?r:null,x=function(e,s){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(!s)return null;if("none"===n)return{none:!0};if(n){const e=s.byKey.get(n);return e?{school:e,confidence:"manual"}:{missing:!0}}const t=C(e.official_id);if(t){const n=(s.byId.get(t)||[]).filter(s=>(!s.region||"DE-BY"===s.region)&&(!e.state||"Bayern"===e.state));if(1===n.length)return{school:n[0],confidence:"official_id"};if(n.length>1)return null}const a=(s.byName.get(D(e.name))||[]).filter(s=>!e.state||!s.region||("AT"===s.country?"\xd6sterreich"===e.state:"CH"===s.country?"Schweiz"===e.state:s.region_name===e.state));return 1===a.length?{school:a[0],confidence:"name"}:null}((0,a.A)((0,a.A)({},e),{},{official_id:(null===p||void 0===p?void 0:p.official_id)||e.official_id}),t,g),v=x?null:((e,s)=>{const[n,t]=T(e,s,2);return!n||n.score<.75||t&&n.score-t.score<.15?null:n})(e.name,t),j=(null===l||void 0===l||null===(c=l.matches)||void 0===c?void 0:c[e.id])||null,_=Number(null===x||void 0===x||null===(o=x.school)||void 0===o?void 0:o.pupil_count)||null,b=j&&"possible"!==j.status?j:null;return{id:e.id,name:e.name,school:e,activity:p,status:K(p),trend:F(p),lastActiveDays:P(null===p||void 0===p?void 0:p.last_activity_at,i),publicSchool:(null===x||void 0===x?void 0:x.school)||null,publicConfidence:(null===x||void 0===x?void 0:x.confidence)||null,publicDirectoryId:g,publicMissing:Boolean(null===x||void 0===x?void 0:x.missing),publicSuggestion:v,hubspot:j,hubspotOverride:null!==(d=null===l||void 0===l||null===(u=l.overrides)||void 0===u?void 0:u[e.id])&&void 0!==d?d:null,hubspotMissing:((null===l||void 0===l?void 0:l.missing_companies)||[]).includes(e.id),deals:W(j),location:I(e,null===x||void 0===x?void 0:x.school,b),licenseActive:Z(e),listPrice:null!==(h=null===(m=(0,y.re)(_))||void 0===m?void 0:m.price)&&void 0!==h?h:null}})},Q=e=>Number(e)||0,q=(e,s)=>e.name.localeCompare(s.name,"de"),U=e=>null==e?1/0:e,Y={created_at:{label:"Neueste Schulen zuerst",compare:(e,s)=>(Date.parse(s.school.created_at)||0)-(Date.parse(e.school.created_at)||0)},created_oldest:{label:"\xc4lteste Schulen zuerst",compare:(e,s)=>(Date.parse(e.school.created_at)||1/0)-(Date.parse(s.school.created_at)||1/0)},progress_total:{label:"Bearbeitungen gesamt",compare:(e,s)=>{var n,t;return Q(null===(n=s.activity)||void 0===n?void 0:n.progress_total)-Q(null===(t=e.activity)||void 0===t?void 0:t.progress_total)}},progress_30d:{label:"Bearbeitungen 30 Tage",compare:(e,s)=>{var n,t;return Q(null===(n=s.activity)||void 0===n?void 0:n.progress_30d)-Q(null===(t=e.activity)||void 0===t?void 0:t.progress_30d)}},trend:{label:"Trend 30 Tage",compare:(e,s)=>{var n,t,a,l;return Q(null===(n=s.activity)||void 0===n?void 0:n.progress_30d)-Q(null===(t=s.activity)||void 0===t?void 0:t.progress_prev_30d)-(Q(null===(a=e.activity)||void 0===a?void 0:a.progress_30d)-Q(null===(l=e.activity)||void 0===l?void 0:l.progress_prev_30d))}},active_students:{label:"Aktive Sch\xfcler 30 Tage",compare:(e,s)=>{var n,t;return Q(null===(n=s.activity)||void 0===n?void 0:n.active_students_30d)-Q(null===(t=e.activity)||void 0===t?void 0:t.active_students_30d)}},students:{label:"Sch\xfcler gesamt",compare:(e,s)=>Q(s.school.student_count)-Q(e.school.student_count)}
1,teachers:{label:"Lehrkr\xe4fte",compare:(e,s)=>Q(s.school.teacher_count)-Q(e.school.teacher_count)},last_active:{label:"Zuletzt aktiv",compare:(e,s)=>U(e.lastActiveDays)-U(s.lastActiveDays)},deal_volume:{label:"Deal-Volumen (HubSpot)",compare:(e,s)=>s.deals.openAmount+s.deals.wonAmount-(e.deals.openAmount+e.deals.wonAmount)},pupils:{label:"Sch\xfclerzahl (amtlich)",compare:(e,s)=>{var n,t;return Q(null===(n=s.publicSchool)||void 0===n?void 0:n.pupil_count)-Q(null===(t=e.publicSchool)||void 0===t?void 0:t.pupil_count)}},name:{label:"Name",compare:q}},J="progress_total",X=["#4f46e5","#0ea5e9","#10b981","#f59e0b","#ef4444","#8b5cf6","#14b8a6","#ec4899"],$=e=>e?String(e).slice(0,10):null,ee=(e,s)=>{const n=new Date("".concat(e,"T00:00:00Z"));return n.setUTCMonth(n.getUTCMonth()+s),n.toISOString().slice(0,10)},se=(e,s)=>Math.round((new Date("".concat(s,"T00:00:00Z"))-new Date("".concat(e,"T00:00:00Z")))/A),ne=e=>null==e.daysLeft?2:e.daysLeft<0?1:0,te={test:"Testphase",regular:"Schullizenz",partner:"Partner"},ae={grundschulen:"grundschule",mittelschulen:"hauptschule",realschulen:"realschule",gymnasien:"gymnasium",foerderzentren:"foerderschule","fos-bos":"fos_bos",berufsschulen:"berufsschule"},le={subscriber:"Abonnent",lead:"Lead",marketingqualifiedlead:"MQL",salesqualifiedlead:"SQL",opportunity:"Opportunity",customer:"Kunde",evangelist:"F\xfcrsprecher",other:"Sonstiges"},ie=e=>Number(e||0).toLocaleString("de-DE"),re=()=>{const e=S("regular");return{name:"",state:"",schoolType:"",licenseType:"regular",licenseStart:e.start,licenseEnd:e.end,maxTeachers:"",unlimited:!1,adminQuery:""}};function ce(e){let{open:s,onClose:n,onCreated:t,username:i,password:r,publicIndex:d,existingSchools:u=[],teachers:h=[],hubspotAvailable:m=!0}=e;const[p,g]=(0,l.useState)(re),[v,j]=(0,l.useState)(null),[k,N]=(0,l.useState)(null),[w,A]=(0,l.useState)([]),[C,D]=(0,l.useState)(null),[L,E]=(0,l.useState)(!1),[K,B]=(0,l.useState)("");(0,l.useEffect)(()=>{s&&(g(re()),j(null),N(null),A([]),D(null),B(""))},[s]);const F=p.name.trim(),P=(0,l.useMemo)(()=>F.length>=3&&!v?T(F,d,5).filter(e=>e.score>=.5):[],[F,d,v]),R=(0,l.useMemo)(()=>M(u.map(e=>({id:e.id,name:e.name}))),[u]),H=(0,l.useMemo)(()=>{const e=F.length>=3?T(F,R,3).filter(e=>e.score>=.7).map(e=>e.school):[],s=v?u.filter(e=>e.publicDirectoryId===v.id):[];return[...new Map([...s,...e].map(e=>[e.id,e])).values()]},[F,R,u,v]);(0,l.useEffect)(()=>{if(!s||!m||k||F.length<3)return void A([]);let e=!0;const n=setTimeout(()=>{(0,c.Q4x)(i,r,F).then(s=>{e&&A((s.companies||[]).filter(e=>{var s;return(null!==(s=e.score)&&void 0!==s?s:1)>=.75}).slice(0,4))}).catch(()=>{e&&A([])})},300);return()=>{e=!1,clearTimeout(n)}},[s,m,k,F,i,r]);const O=(0,l.useMemo)(()=>{const e=p.adminQuery.trim().toLowerCase();return e.length<2||C?[]:h.filter(s=>(s.name||"").toLowerCase().includes(e)||(s.email||"").toLowerCase().includes(e)).slice(0,8)},[h,p.adminQuery,C]);if(!s)return null;const W=e=>g(s=>(0,a.A)((0,a.A)({},s),e)),Z=(0,y.re)(null===v||void 0===v?void 0:v.pupil_count),V=!v||!k;return(0,o.jsx)("div",{className:"scm-backdrop",onClick:n,role:"presentation",children:(0,o.jsxs)("form",{className:"scm",onClick:e=>e.stopPropagation(),onSubmit:async e=>{if(e.preventDefault(),p.name.trim()){E(!0),B("");try{const e=await(0,c.daA)(i,r,{name:p.name.trim(),license_type:p.licenseType,license_start_date:p.licenseStart||null,license_end_date:p.licenseEnd||null,max_teachers:p.unlimited?null:p.maxTeachers?Number(p.maxTeachers):null,admin_user_id:(null===C||void 0===C?void 0:C.id)||null,state:p.state||null,school_type:p.schoolType||null}),s=[];v&&s.push((0,c.k8T)(i,r,e.id,v.id)),k&&s.push((0,c.W2n)(i,r,e.id,String(k.id)));const a=await Promise.allSettled(s);if(await(null===t||void 0===t?void 0:t(e)),a.some(e=>"rejected"===e.status))return void B("Schule angelegt, aber eine Zuordnung konnte nicht gespeichert werden. Bitte in den Details nachholen.");n()}catch(s){B(z(s,"Schule konnte nicht angelegt werden."))}finally{E(!1)}}else B("Schulname fehlt.")},role:"dialog","aria-modal":"true","aria-labelledby":"scm-title",children:[(0,o.jsxs)("header",{className:"scm-header",children:[(0,o.jsxs)("h3",{id:"scm-title",children:[(0,o.jsx)(x.iM1,{})," Schule anlegen"]}),(0,o.jsx)("button",{type:"button",className:"scm-close",onClick:n,"aria-label":"Schlie\xdfen",children:(0,o.jsx)(x.QCr,{})})]}),(0,o.jsxs)("div",{className:"scm-body",children:[(0,o.jsxs)("section",{className:"scm-section",children:[(0,o.jsx)("label",{className:"scm-label",htmlFor:"scm-name",children:"Schulname"}),(0,o.jsx)("input",{id:"scm-name",className:"scm-input scm-input--large",autoFocus:!0,value:p.name,onChange:e=>W({name:e.target.value}),placeholder:"Name eingeben, passende Schulen werden vorgeschlagen"}),H.length>0&&(0,o.jsxs)("div",{className:"scm-warning",children:[(0,o.jsx)(x.BS8,{}),(0,o.jsxs)("span",{children:["Schon in LivingLines: ",H.map(e=>e.name).join(", "),"."," ","Bitte pr\xfcfen, ob es dieselbe Schule ist."]})]}
1),(v||k)&&(0,o.jsxs)("div",{className:"scm-links",children:[v&&(0,o.jsxs)("span",{className:"scm-chip",children:["DACH-Verzeichnis: ",v.name,(0,o.jsx)("button",{type:"button",onClick:()=>j(null),"aria-label":"Zuordnung entfernen",children:(0,o.jsx)(x.QCr,{})})]}),k&&(0,o.jsxs)("span",{className:"scm-chip",children:["HubSpot: ",k.name,(0,o.jsx)("button",{type:"button",onClick:()=>N(null),"aria-label":"Zuordnung entfernen",children:(0,o.jsx)(x.QCr,{})})]})]}),V&&(P.length>0||w.length>0)&&(0,o.jsxs)("div",{className:"scm-matches",children:[P.length>0&&(0,o.jsxs)("div",{className:"scm-match-group",children:[(0,o.jsx)("span",{className:"scm-match-group__title",children:"DACH-Verzeichnis"}),P.map(e=>{let{school:s}=e;return(0,o.jsxs)("button",{type:"button",className:"scm-match",onClick:()=>(e=>{j(e);const s=(e.groups||[]).map(e=>ae[e]).find(Boolean)||"",n="AT"===e.country?"\xd6sterreich":"CH"===e.country?"Schweiz":e.region_name||"Bayern",t=(0,f.S3)(n);W({name:e.name,state:n,schoolType:t.some(e=>e.id===s)?s:""})})(s),children:[(0,o.jsx)("strong",{children:s.name}),(0,o.jsx)("span",{children:["".concat(s.postal_code," ").concat(s.city),s.school_type,s.pupil_count&&"".concat(ie(s.pupil_count)," Sch\xfcler:innen")].filter(Boolean).join(" \xb7 ")})]},s.id)})]}),w.length>0&&(0,o.jsxs)("div",{className:"scm-match-group",children:[(0,o.jsx)("span",{className:"scm-match-group__title",children:"HubSpot"}),w.map(e=>(0,o.jsxs)("button",{type:"button",className:"scm-match",onClick:()=>N(e),children:[(0,o.jsx)("strong",{children:e.name}),(0,o.jsx)("span",{children:[[e.zip,e.city].filter(Boolean).join(" "),le[String(e.lifecyclestage||"").toLowerCase()]||e.lifecyclestage].filter(Boolean).join(" \xb7 ")})]},e.id))]})]}),v&&(0,o.jsxs)("div",{className:"scm-facts",children:[v.pupil_count&&(0,o.jsxs)("span",{children:[(0,o.jsx)("strong",{children:ie(v.pupil_count)})," Sch\xfcler:innen"]}),v.teacher_count&&(0,o.jsxs)("span",{children:[(0,o.jsx)("strong",{children:ie(v.teacher_count)})," Lehrkr\xe4fte"]}),Z&&(0,o.jsxs)("span",{children:["Richtpreis Schullizenz ",(0,o.jsx)("strong",{children:(I=Z.price,Number(I||0).toLocaleString("de-DE",{style:"currency",currency:"EUR",maximumFractionDigits:0}))})," / Jahr"]}),"confirmed"===v.startchancen&&(0,o.jsx)("span",{className:"scm-badge",children:"Startchancen"})]}),(0,o.jsxs)("div",{className:"scm-grid",children:[(0,o.jsxs)("label",{children:[(0,o.jsx)("span",{className:"scm-label",children:"Lehrplan"}),(0,o.jsxs)("select",{className:"scm-input",value:p.state,onChange:e=>W({state:e.target.value}),children:[(0,o.jsx)("option",{value:"",children:"\u2013 nicht gesetzt \u2013"}),f.$0.map(e=>(0,o.jsx)("optgroup",{label:e.name,children:e.curricula.map(e=>(0,o.jsx)("option",{value:e.id,children:e.name},e.id))},e.code))]})]}),(0,o.jsxs)("label",{children:[(0,o.jsx)("span",{className:"scm-label",children:"Schulart"}),(0,o.jsxs)("select",{className:"scm-input",value:p.schoolType,onChange:e=>W({schoolType:e.target.value}),children:[(0,o.jsx)("option",{value:"",children:"\u2013 nicht gesetzt \u2013"}),(0,f.S3)(p.state).map(e=>(0,o.jsx)("option",{value:e.id,children:e.name},e.id))]})]})]})]}),(0,o.jsxs)("section",{className:"scm-section",children:[(0,o.jsx)("span",{className:"scm-label",children:"Lizenz"}),(0,o.jsx)("div",{className:"scm-segmented",role:"group","aria-label":"Lizenztyp",children:[["regular","Jahreslizenz"],["test","Pilot (4 Wochen)"]].map(e=>{let[s,n]=e;return(0,o.jsx)("button",{type:"button",className:p.licenseType===s?"is-active":"",onClick:()=>{const e=S(s);W({licenseType:s,licenseStart:p.licenseStart||e.start,licenseEnd:e.end})},children:n},s)})}),(0,o.jsxs)("div",{className:"scm-grid scm-grid--3",children:[(0,o.jsxs)("label",{children:[(0,o.jsx)("span",{className:"scm-label",children:"Start"}),(0,o.jsx)("input",{className:"scm-input",type:"date",value:p.licenseStart,onChange:e=>W({licenseStart:e.target.value})})]}),(0,o.jsxs)("label",{children:[(0,o.jsx)("span",{className:"scm-label",children:"Ende"}),(0,o.jsx)("input",{className:"scm-input",type:"date",value:p.licenseEnd,onChange:e=>W({licenseEnd:e.target.value})})]}),(0,o.jsxs)("label",{children:[(0,o.jsx)("span",{className:"scm-label",children:"Max. Lehrkr\xe4fte"}),(0,o.jsx)("input",{className:"scm-input",type:"number",min:"0",value:p.maxTeachers,onChange:e=>W({maxTeachers:e.target.value}),placeholder:"z. B. 15",disabled:p.unlimited}),(0,o.jsxs)("span",{className:"scm-check",children:[(0,o.jsx)("input",{id:"scm-unlimited",type:"checkbox",checked:p.unlimited,onChange:e=>W({unlimited:e.target.checked})}),(0,o.jsx)("label",{htmlFor:"scm-unlimited",children:"Unbegrenzt"})]})]})]})]}),(0,o.jsxs)("section",{className:"scm-section",children:[(0,o.jsxs)("span",{className:"scm-label",children:["Schul-Admin ",(0,o.jsx)("span",{className:"scm-optional",children:"optional"})]}),C?(0,o.jsxs)("div",{className:"scm-admin",children:[(0,o.jsx)(b.A,{seed:C.avatar_seed,size:26}),(0,o.jsxs)("span",{children:[(0,o.jsx)("strong",{children:C.name||"\u2013"}),C.email&&(0,o.jsx)("small",{children:C.email})]}),(0,o.jsx)("button",{type:"button",onClick:()=>{D(null),W({adminQuery:""})},"aria-label":"Admin entfernen",children:(0,o.jsx)(x.QCr,{})})]}):(0,o.jsx)(_.A,{query:p.adminQuery,onQueryChange:e=>W({adminQuery:e}),suggestions:O,onSelect:e=>{D(e),W({adminQuery:""})},placeholder:"Lehrkraft nach Name oder E-Mail suchen"})]})]}),(0,o.jsxs)("footer",{className:"scm-footer",children:[K&&(0,o.jsx)("span",{className:"scm-error",role:"alert",children:K}),(0,o.jsx)("button",{type:"button",className:"sd-button",onClick:n,children:"Abbrechen"}),(0,o.jsx)("button",{type:"submit",className:"sd-button sd-button--primary",disabled:L,children:L?"Lege an \u2026":"Schule anlegen"})]})]})});var I}var oe=n(2180);const de=e=>
1Number(e||0).toLocaleString("de-DE"),ue=e=>Number(e||0).toLocaleString("de-DE",{style:"currency",currency:"EUR",maximumFractionDigits:0}),he=e=>null==e.amount||""===e.amount?"Betrag offen":Number(e.amount).toLocaleString("de-DE",{style:"currency",currency:e.currency||"EUR",maximumFractionDigits:0}),me=e=>{if(!e)return"\u2013";const s=new Date(/^\d{13}$/.test(String(e))?Number(e):e);return Number.isNaN(s.getTime())?"\u2013":s.toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric"})},pe=e=>{if(!e)return"";const s=f.HK.find(s=>s.id===e&&"DE"===s.country)||f.HK.find(s=>s.id===e);return s?s.name:String(e).replace(/(^|\s)\S/g,e=>e.toUpperCase())},ge=e=>/^https?:\/\//i.test(String(e||""))?String(e):"",xe={subscriber:"Abonnent",lead:"Lead",marketingqualifiedlead:"MQL",salesqualifiedlead:"SQL",opportunity:"Opportunity",customer:"Kunde",evangelist:"F\xfcrsprecher",other:"Sonstiges"},ve=e=>xe[String(e||"").toLowerCase()]||e||"\u2013",je={active:"#10b981",asleep:"#f59e0b",never:"#cbd5e1"},_e={"":"Alle Lizenzen",active:"Lizenz aktiv",regular:"Regul\xe4re Lizenz",test:"Testlizenz",none:"Ohne / abgelaufen",unlicensed:"Noch keine Schullizenz"},be={"":"HubSpot: alle",deals:"Mit Deals",linked:"Verkn\xfcpft",unlinked:"Nicht verkn\xfcpft"},fe={12:"12 Wochen",26:"6 Monate",52:"12 Monate"},ye=e=>{let{trend:s}=e;if(!s||"none"===s.kind)return null;if("new"===s.kind)return(0,o.jsx)("span",{className:"so-trend so-trend--new",children:"neu"});const n="up"===s.kind?"\u2191":"down"===s.kind?"\u2193":"\u2192",t=s.pct>300?">+300%":"".concat(s.pct>0?"+":"").concat(s.pct,"%");return(0,o.jsxs)("span",{className:"so-trend so-trend--".concat(s.kind),children:[n," ",t]})},ke=e=>{let{label:s,value:n,sub:t,tone:a,active:l,onClick:i}=e;const r=i?"button":"div";return(0,o.jsxs)(r,{type:i?"button":void 0,className:"so-kpi".concat(a?" so-kpi--".concat(a):"").concat(l?" is-active":"").concat(i?" is-clickable":""),onClick:i,children:[(0,o.jsx)("span",{className:"so-kpi__label",children:s}),(0,o.jsx)("strong",{className:"so-kpi__value",children:n}),t&&(0,o.jsx)("span",{className:"so-kpi__sub",children:t})]})},Ne={DE:"#e8edf4",AT:"#f1f4f9",CH:"#f1f4f9"},Se=e=>{let{mapData:s,rows:n,selectedId:t,onSelect:i}=e;const r=(0,l.useMemo)(()=>{if(!s)return null;const{min_x:e,max_x:n,min_y:t,max_y:l}=s.bounds;return{box:"".concat(e-12," ").concat(t-12," ").concat(n-e+24," ").concat(l-t+24),regions:s.regions.map(e=>(0,a.A)((0,a.A)({},e),{},{d:e.paths.map(e=>e.map((e,s)=>{let[n,t]=e;return"".concat(s?"L":"M").concat(n,",").concat(t)}).join(" ")+" Z").join(" ")}))}},[s]),c=(0,l.useMemo)(()=>{if(!s)return[];const e=Math.max(1,...n.map(e=>{var s;return Number((null===(s=e.activity)||void 0===s?void 0:s.progress_total)||0)}));return n.map(e=>{var n;return{row:e,coords:e.location&&(null===(n=s.postal[e.location.country])||void 0===n?void 0:n[e.location.postal])}}).filter(e=>e.coords).map(s=>{var n;let{row:t,coords:[a,l]}=s;return{row:t,x:a,y:l,r:4+11*Math.sqrt(Number((null===(n=t.activity)||void 0===n?void 0:n.progress_total)||0)/e)}}).sort((e,s)=>s.r-e.r)},[n,s]);if(!r)return(0,o.jsx)("div",{className:"so-map so-map--empty",children:"Karte wird geladen \u2026"});const d=n.length-c.length;return(0,o.jsxs)("div",{className:"so-map",children:[(0,o.jsxs)("svg",{viewBox:r.box,role:"img","aria-label":"LivingLines-Schulen in Deutschland, \xd6sterreich und der Schweiz nach Aktivit\xe4t",children:[r.regions.map(e=>(0,o.jsx)("path",{d:e.d,className:"so-map__region",style:{fill:Ne[e.country]},children:(0,o.jsx)("title",{children:e.name})},"".concat(e.country,"-").concat(e.name))),c.map(e=>{var s;let{row:n,x:a,y:l,r:r}=e;return(0,o.jsx)("circle",{cx:a,cy:l,r:r,fill:je[n.status],className:"so-map__dot".concat(t===n.id?" is-selected":""),onClick:()=>i(n.id),children:(0,o.jsx)("title",{children:"".concat(n.name," \xb7 ").concat(B[n.status]," \xb7 ").concat(de(null===(s=n.activity)||void 0===s?void 0:s.progress_total)," Bearbeitungen")})},n.id)})]}),(0,o.jsxs)("div",{className:"so-map__legend",children:[Object.entries(B).map(e=>{let[s,n]=e;return(0,o.jsxs)("span",{children:[(0,o.jsx)("i",{style:{background:je[s]}}),n]},s)}),(0,o.jsx)("span",{className:"so-map__note",children:"Gr\xf6\xdfe = Bearbeitungen gesamt"})]}),d>0&&(0,o.jsxs)("p",{className:"so-map__outside",children:[d," ",1===d?"Schule":"Schulen"," ohne Standort (keine PLZ aus DACH-Verzeichnis oder sicherer HubSpot-Zuordnung)"]}),(0,o.jsx)("p",{className:"so-map__source",children:"Karte: Natural Earth \xb7 PLZ: GeoNames (CC BY 4.0)"})]})},we={manual:"manuell zugeordnet",official_id:"\xfcber Schulnummer",name:"\xfcber den Namen"},ze=e=>
1[e.postal_code,e.city].filter(Boolean).join(" "),Ae=e=>{let{row:s,publicIndex:n,username:t,password:a,onChanged:i}=e;const[r,d]=(0,l.useState)(!1),[u,h]=(0,l.useState)(""),[m,p]=(0,l.useState)(!1),[g,x]=(0,l.useState)(""),v=(0,l.useMemo)(()=>r&&u.trim().length>=2?T(u,n,8):[],[r,u,n]),j=async e=>{p(!0);try{await(0,c.k8T)(t,a,s.id,e),d(!1),x(""),await i()}catch(n){x("Speichern fehlgeschlagen.")}finally{p(!1)}};return(0,o.jsxs)("div",{className:"so-link-editor",children:[s.publicSuggestion&&(0,o.jsxs)("div",{className:"so-suggestion",children:[(0,o.jsx)("span",{className:"so-muted",children:"Vorschlag:"}),(0,o.jsx)("strong",{children:s.publicSuggestion.school.name}),(0,o.jsx)("span",{className:"so-muted",children:ze(s.publicSuggestion.school)})]}),(0,o.jsxs)("div",{className:"so-link-editor__actions",children:[s.publicSuggestion&&(0,o.jsx)("button",{type:"button",className:"so-link-btn so-link-btn--primary",disabled:m,onClick:()=>j(s.publicSuggestion.school.id),children:"Vorschlag best\xe4tigen"}),(0,o.jsx)("button",{type:"button",className:"so-link-btn",disabled:m||!n,onClick:()=>{d(e=>!e),h(s.name)},children:s.publicSchool?"Anderen Eintrag w\xe4hlen":"Eintrag suchen"}),"none"!==s.publicDirectoryId&&(0,o.jsx)("button",{type:"button",className:"so-link-btn",disabled:m,onClick:()=>j("none"),children:"Kein Eintrag"}),s.publicDirectoryId&&(0,o.jsx)("button",{type:"button",className:"so-link-btn",disabled:m,onClick:()=>j(null),children:"Automatisch zuordnen"})]}),r&&(0,o.jsxs)("div",{className:"so-link-editor__picker",children:[(0,o.jsx)("input",{autoFocus:!0,value:u,onChange:e=>h(e.target.value),placeholder:"Schulname, Ort oder PLZ","aria-label":"DACH-Verzeichnis durchsuchen"}),(0,o.jsxs)("ul",{children:[v.map(e=>{let{school:s}=e;return(0,o.jsx)("li",{children:(0,o.jsxs)("button",{type:"button",disabled:m,onClick:()=>j(s.id),children:[(0,o.jsx)("strong",{children:s.name}),(0,o.jsx)("span",{className:"so-muted",children:[ze(s),s.school_type,s.pupil_count&&"".concat(de(s.pupil_count)," Sch\xfcler:innen")].filter(Boolean).join(" \xb7 ")})]})},s.id)}),u.trim().length>=2&&0===v.length&&(0,o.jsx)("li",{className:"so-muted",children:"Keine Treffer"})]})]}),g&&(0,o.jsx)("p",{className:"so-error",children:g})]})},Ce=e=>{var s,n;let{row:t,publicIndex:a,username:i,password:r,onChanged:c}=e;const d=t.publicSchool,u=(0,o.jsx)(Ae,{row:t,publicIndex:a,username:i,password:r,onChanged:c});if(!d){let e="Kein eindeutiger Eintrag im DACH-Verzeichnis gefunden (keine Schulnummer, Name weicht vom amtlichen ab).";return"none"===t.publicDirectoryId?e="Bewusst ohne Eintrag im DACH-Verzeichnis.":t.publicMissing&&(e="Der zugeordnete Eintrag ist im aktuellen DACH-Verzeichnis nicht mehr enthalten."),(0,o.jsxs)("div",{className:"so-card",children:[(0,o.jsx)("h5",{children:"\xd6ffentliche Daten"}),(0,o.jsx)("p",{className:"so-muted",children:e}),u]})}const h=[["Amtlicher Name",d.name!==t.name?d.name:null],["Schulart",d.fos_bos_profile||d.school_type],["Ort",ze(d)],["Sch\xfcler:innen",d.pupil_count?"".concat(de(d.pupil_count)).concat(d.school_year?" (".concat(d.school_year,")"):""):null],["Lehrkr\xe4fte",d.teacher_count?de(d.teacher_count):null],["Rechtsform",d.legal_status],["Tr\xe4ger",null===(s=d.sponsor)||void 0===s?void 0:s.name],["Sachaufwandstr\xe4ger",null===(n=d.school_cost_bearer)||void 0===n?void 0:n.name],["Startchancen","confirmed"===d.startchancen?"Ja, auf der Startchancen-Liste":null],["Kommune",d.municipality_name],["Finanzkraft",d.finance_eur_per_resident?"".concat(ue(d.finance_eur_per_resident)," je Einwohner (").concat(d.finance_year,")"):null],["Richtpreis Schullizenz",t.listPrice?"".concat(ue(t.listPrice)," / Jahr"):null]].filter(e=>{let[,s]=e;return s});return(0,o.jsxs)("div",{className:"so-card",children:[(0,o.jsxs)("h5",{children:["\xd6ffentliche Daten"," ",(0,o.jsx)("span",{className:"so-chip".concat("manual"===t.publicConfidence?" so-chip--ok":""),children:we[t.publicConfidence]})]}),(0,o.jsx)("dl",{className:"so-facts",children:h.map(e=>{let[s,n]=e;return(0,o.jsxs)(l.Fragment,{children:[(0,o.jsx)("dt",{children:s}),(0,o.jsx)("dd",{children:n})]},s)})}),(0,o.jsxs)("div",{className:"so-links",children:[ge(d.website)&&(0,o.jsxs)("a",{href:ge(d.website),target:"_blank",rel:"noopener noreferrer",children:["Website ",(0,o.jsx)(x.EQc,{})]}),ge(d.profile_url)&&(0,o.jsxs)("a",{href:ge(d.profile_url),target:"_blank",rel:"noopener noreferrer",children:["Amtliches Schulprofil ",(0,o.jsx)(x.EQc,{})]})]}),u]})},De=e=>{let{row:s,username:n,password:t,onChanged:a}=e;const[i,r]=(0,l.useState)(!1),[d,u]=(0,l.useState)(""),[h,m]=(0,l.useState)([]),[p,g]=(0,l.useState)(!1),[x,v]=(0,l.useState)("");(0,l.useEffect)(()=>
1{if(!i||d.trim().length<2)return void m([]);let e=!0;const s=setTimeout(()=>{(0,c.Q4x)(n,t,d.trim()).then(s=>{e&&(m(s.companies||[]),v(""))}).catch(()=>{e&&v("Suche fehlgeschlagen.")})},250);return()=>{e=!1,clearTimeout(s)}},[i,d,n,t]);const j=async e=>{g(!0);try{await(0,c.W2n)(n,t,s.id,e),r(!1),v(""),await a()}catch(l){v("Speichern fehlgeschlagen.")}finally{g(!1)}},_=s.hubspot;return(0,o.jsxs)("div",{className:"so-link-editor",children:[(0,o.jsxs)("div",{className:"so-link-editor__actions",children:["possible"===(null===_||void 0===_?void 0:_.status)&&(0,o.jsx)("button",{type:"button",className:"so-link-btn so-link-btn--primary",disabled:p,onClick:()=>j(String(_.company_id)),children:"Vorschlag best\xe4tigen"}),(0,o.jsx)("button",{type:"button",className:"so-link-btn",disabled:p,onClick:()=>{r(e=>!e),u(s.name)},children:_?"Andere Company w\xe4hlen":"Company suchen"}),"none"!==s.hubspotOverride&&(0,o.jsx)("button",{type:"button",className:"so-link-btn",disabled:p,onClick:()=>j("none"),children:"Kein HubSpot-Eintrag"}),s.hubspotOverride&&(0,o.jsx)("button",{type:"button",className:"so-link-btn",disabled:p,onClick:()=>j(null),children:"Automatisch zuordnen"})]}),i&&(0,o.jsxs)("div",{className:"so-link-editor__picker",children:[(0,o.jsx)("input",{autoFocus:!0,value:d,onChange:e=>u(e.target.value),placeholder:"Company-Name","aria-label":"HubSpot-Company suchen"}),(0,o.jsxs)("ul",{children:[h.map(e=>(0,o.jsx)("li",{children:(0,o.jsxs)("button",{type:"button",disabled:p,onClick:()=>j(String(e.id)),children:[(0,o.jsx)("strong",{children:e.name}),(0,o.jsx)("span",{className:"so-muted",children:[e.zip,e.city,ve(e.lifecyclestage)].filter(Boolean).join(" \xb7 ")})]})},e.id)),d.trim().length>=2&&0===h.length&&(0,o.jsx)("li",{className:"so-muted",children:"Keine Treffer"})]})]}),x&&(0,o.jsx)("p",{className:"so-error",children:x})]})},Le={high:["so-chip--ok","eindeutig"],manual:["so-chip--ok","manuell zugeordnet"],possible:["so-chip--warn","m\xf6glich, bitte pr\xfcfen"]},Ee=e=>{let{row:s,hubspotState:n,username:t,password:a,onChanged:i}=e;const r=s.hubspot;if("ready"!==n.status)return(0,o.jsxs)("div",{className:"so-card",children:[(0,o.jsx)("h5",{children:"HubSpot"}),(0,o.jsx)("p",{className:"so-muted",children:"loading"===n.status?"Wird abgeglichen \u2026":n.message||"Nicht geladen."})]});const c=(0,o.jsx)(De,{row:s,username:t,password:a,onChanged:i});if(!r){let e="Keine passende Company gefunden.";return"none"===s.hubspotOverride?e="Bewusst ohne HubSpot-Eintrag.":s.hubspotMissing&&(e="Die manuell gew\xe4hlte Company gibt es in HubSpot nicht mehr."),(0,o.jsxs)("div",{className:"so-card",children:[(0,o.jsx)("h5",{children:"HubSpot"}),(0,o.jsx)("p",{className:"so-muted",children:e}),c]})}const[d,u]=Le[r.status]||Le.possible,h=[["Lifecycle",ve(r.lifecyclestage)],["Nutzung",r.nutzung],["Ort",[r.zip,r.city].filter(Boolean).join(" ")],["Letzter Kontakt",r.last_contacted?me(r.last_contacted):null]].filter(e=>{let[,s]=e;return s});return(0,o.jsxs)("div",{className:"so-card",children:[(0,o.jsxs)("h5",{children:["HubSpot ",(0,o.jsx)("span",{className:"so-chip ".concat(d),children:u})]}),(0,o.jsxs)("div",{className:"so-links",children:[ge(r.url)&&(0,o.jsxs)("a",{href:ge(r.url),target:"_blank",rel:"noopener noreferrer",children:[r.company_name||"Company"," ",(0,o.jsx)(x.EQc,{})]}),"manual"!==r.status&&(0,o.jsxs)("span",{className:"so-muted",children:["Zuordnung: ",r.evidence]})]}),(0,o.jsx)("dl",{className:"so-facts",children:h.map(e=>{let[s,n]=e;return(0,o.jsxs)(l.Fragment,{children:[(0,o.jsx)("dt",{children:s}),(0,o.jsx)("dd",{children:n})]},s)})}),"possible"===r.status&&(0,o.jsx)("p",{className:"so-muted",children:"Deals werden erst nach Best\xe4tigung angezeigt."}),"possible"!==r.status&&(s.deals.count>0?(0,o.jsx)("ul",{className:"so-deals",children:r.deals.map(e=>(0,o.jsxs)("li",{children:[ge(e.url)?(0,o.jsx)("a",{href:ge(e.url),target:"_blank",rel:"noopener noreferrer",children:e.name||"Deal ".concat(e.id)}):(0,o.jsx)("span",{children:e.name||"Deal ".concat(e.id)}),(0,o.jsx)("span",{className:"so-deals__amount",children:he(e)}),(0,o.jsx)("span",{className:"so-muted",children:[e.stage,e.pipeline,e.close_date&&"Abschluss ".concat(me(e.close_date))].filter(
1Boolean).join(" \xb7 ")})]},e.id))}):(0,o.jsx)("p",{className:"so-muted",children:"Keine Deals verkn\xfcpft."})),c]})},Me=e=>{var s;let{row:n,hubspotState:t}=e;if("loading"===t.status)return(0,o.jsx)("span",{className:"so-muted",children:"\u2026"});if("ready"!==t.status||!n.hubspot)return(0,o.jsx)("span",{className:"so-muted",children:"\u2013"});const a=n.deals.openAmount+n.deals.wonAmount;return(0,o.jsxs)("div",{className:"so-hubspot-cell",children:[(0,o.jsxs)("span",{className:"so-chip".concat("possible"===n.hubspot.status?" so-chip--warn":""),title:"possible"===n.hubspot.status?"Zuordnung unsicher, in den Details pr\xfcfen":void 0,children:[ve(n.hubspot.lifecyclestage),"possible"===n.hubspot.status?" ?":""]}),n.deals.count>0&&(0,o.jsxs)("span",{className:"so-sub",children:[a>0?ue(a):"Betrag offen"," \xb7 ",(null===(s=n.deals.latest)||void 0===s?void 0:s.stage)||"".concat(n.deals.count," Deals")]})]})},Te=e=>"missing-end"===e.urgency?"Enddatum fehlt":null==e.daysLeft?"unbefristet":e.daysLeft<0?"abgelaufen vor ".concat(-e.daysLeft," T."):0===e.daysLeft?"endet heute":"endet in ".concat(e.daysLeft," T."),Ke={"":"Alle",test:"Testphasen",license:"Schullizenzen",soon:"Endet \u2264 60 Tage"},Be=e=>{let{rows:s,onSelect:n}=e;const[t,i]=(0,l.useState)(""),r=(0,l.useMemo)(()=>function(e){let{today:s=(new Date).toISOString().slice(0,10),monthsBack:n=3,monthsAhead:t=12}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const l=ee(s,-n),i=ee(s,t),r=se(l,i),c=e=>Math.min(r,Math.max(0,se(l,e)))/r*100,o=e.filter(e=>e.school.license_type).map(e=>({row:e,start:$(e.school.license_start_date),end:$(e.school.license_end_date),kind:e.school.license_type})).filter(e=>{let{start:s,end:n}=e;return(!n||n>=l)&&(!s||s<=i)}).map(e=>{const n=e.end?se(s,e.end):null,t=null==n?"test"===e.kind?"missing-end":"open":n<0?"expired":n<=30?"soon":n<=60?"upcoming":"later";return(0,a.A)((0,a.A)({},e),{},{daysLeft:n,urgency:t,left:c(e.start&&e.start>l?e.start:l),right:e.end?c(e.end):100})}).sort((e,s)=>{var n,t;return ne(e)-ne(s)||(1===ne(e)?s.daysLeft-e.daysLeft:(null!==(n=e.daysLeft)&&void 0!==n?n:0)-(null!==(t=s.daysLeft)&&void 0!==t?t:0))||e.row.name.localeCompare(s.row.name,"de")}),d=[];for(let a=-n;a<=t;a+=1){const e=ee("".concat(s.slice(0,7),"-01"),a);e>=l&&e<=i&&d.push({day:e,left:c(e),label:Number(e.slice(5,7))%3===1})}return{items:o,months:d,todayLeft:c(s),windowStart:l,windowEnd:i}}(s),[s]),c=r.items.filter(e=>"test"===t?"test"===e.kind:"license"===t?"test"!==e.kind:"soon"!==t||null!=e.daysLeft&&e.daysLeft>=0&&e.daysLeft<=60);return(0,o.jsxs)("div",{className:"so-timeline",children:[(0,o.jsxs)("div",{className:"so-timeline__controls",children:[(0,o.jsx)("div",{className:"so-segmented",role:"group","aria-label":"Lizenzen filtern",children:Object.entries(Ke).map(e=>{let[s,n]=e;return(0,o.jsx)("button",{type:"button",className:t===s?"is-active":"",onClick:()=>i(s),children:n},s)})}),(0,o.jsxs)("div",{className:"so-timeline__legend",children:[(0,o.jsxs)("span",{children:[(0,o.jsx)("i",{className:"so-bar-swatch so-bar--test"}),"Testphase"]}),(0,o.jsxs)("span",{children:[(0,o.jsx)("i",{className:"so-bar-swatch so-bar--regular"}),"Schullizenz"]}),(0,o.jsxs)("span",{children:[(0,o.jsx)("i",{className:"so-bar-swatch so-bar--partner"}),"Partner"]})]})]}),(0,o.jsxs)("div",{className:"so-timeline__grid",children:[(0,o.jsxs)("div",{className:"so-timeline__axis",children:[(0,o.jsx)("span",{}),(0,o.jsx)("div",{className:"so-timeline__track",children:r.months.filter(e=>e.label).map(e=>(0,o.jsx)("span",{className:"so-timeline__month",style:{left:"".concat(e.left,"%")},children:new Date("".concat(e.day,"T00:00:00")).toLocaleDateString("de-DE",{month:"short",year:"2-digit"})},e.day))}),(0,o.jsx)("span",{})]}),c.map(e=>{var s;return(0,o.jsxs)("button",{type:"button",className:"so-timeline__row so-timeline__row--".concat(e.urgency),onClick:()=>n(e.row.id),title:"".concat(e.row.name,": ").concat(te[e.kind]||e.kind," ").concat(me(e.start)," \u2013 ").concat(e.end?me(e.end):"offen"),children:[(0,o.jsxs)("span",{className:"so-timeline__name",children:[(0,o.jsx)("i",{className:"so-dot",style:{background:je[e.row.status]}}),(0,o.jsx)("span",{children:e.row.name})]}),(0,o.jsxs)("span",{className:"so-timeline__track",children:[r.months.map(e=>(0,o.jsx)("i",{className:"so-timeline__gridline",style:{left:"".concat(e.left,"%")}},e.day)),(0,o.jsx)("i",{className:"so-timeline__today",style:{left:"".concat(r.todayLeft,"%")}}),(0,o.jsx)("i",{className:"so-bar so-bar--".concat(e.kind).concat(e.end?"":" so-bar--open"),style:{left:"".concat(e.left,"%"),width:"".concat(Math.max(.8,e.right-e.left),"%")}})]}),(0,o.jsxs)("span",{className:"so-timeline__meta",children:[(0,o.jsx)("span",{className:"so-chip so-urgency--".concat(e.urgency),children:Te(e)}),(0,o.jsx)("span",{className:"so-sub",children:"never"===e.row.status?"nie aktiv":"".concat(de(null===(s=e.row.activity)||void 0===s?void 0:s.progress_30d)," Bearb. / 30 T")})]})]}
1,e.row.id)}),0===c.length&&(0,o.jsx)("p",{className:"so-muted so-empty",children:"Keine Lizenzen in diesem Zeitraum."})]}),(0,o.jsx)("p",{className:"so-hint",children:"Punkt = Nutzung (gr\xfcn aktiv, orange eingeschlafen, grau nie aktiv). Klick \xf6ffnet die Schule im Ranking."})]})};function Fe(e){let{schools:s=[],teachers:n=[],username:t,password:i,renderDetails:r,onSchoolCreated:d}=e;const[u,h]=(0,l.useState)(null),[m,p]=(0,l.useState)(""),[v,_]=(0,l.useState)(null),[b,f]=(0,l.useState)(""),[y,k]=(0,l.useState)(null),[N,S]=(0,l.useState)(null),[w,z]=(0,l.useState)({status:"idle",message:""}),[C,D]=(0,l.useState)(J),[L,E]=(0,l.useState)(""),[T,K]=(0,l.useState)(""),[F,P]=(0,l.useState)(""),[R,H]=(0,l.useState)(""),[O,W]=(0,l.useState)(""),[Z,V]=(0,l.useState)(!1),[I,U]=(0,l.useState)("progress"),[$,ee]=(0,l.useState)(26),[se,ne]=(0,l.useState)(!1),[te,ae]=(0,l.useState)(null),[le,ie]=(0,l.useState)("ranking"),[re,he]=(0,l.useState)(!1),[ge,xe]=(0,l.useState)(null),Ne=(0,l.useRef)({}),we=(0,l.useCallback)(async()=>{try{h(await(0,c.QEd)(t,i,52)),p("")}catch(e){p("Nutzungsdaten konnten nicht geladen werden.")}},[t,i]);(0,l.useEffect)(()=>{we()},[we]),(0,l.useEffect)(()=>{const e=new AbortController;return(0,oe.NA)().then(e=>Promise.all(e.regions.map(oe.aS))).then(s=>{e.signal.aborted||_(s.flat())}).catch(()=>{e.signal.aborted||(_([]),f("DACH-Verzeichnis konnte nicht geladen werden. Bitte die Seite neu laden."))}),fetch("".concat("","/data/dach-map.json"),{signal:e.signal}).then(e=>e.ok?e.json():Promise.reject(new Error("HTTP ".concat(e.status)))).then(k).catch(e=>{"AbortError"!==e.name&&console.error("Karte konnte nicht geladen werden:",e)}),()=>e.abort()},[]);const ze=(0,l.useMemo)(()=>v?M(v):null,[v]),Ae=(0,l.useMemo)(()=>G({schools:s,activity:u,publicIndex:ze,hubspot:N}),[s,u,ze,N]),De=(0,l.useCallback)(async()=>{z({status:"loading",message:""});try{const e=Ae.map(e=>{var s,n,t,a;return{id:e.id,name:e.name,city:(null===(s=e.publicSchool)||void 0===s?void 0:s.city)||"",postal_code:(null===(n=e.publicSchool)||void 0===n?void 0:n.postal_code)||"",website:(null===(t=e.publicSchool)||void 0===t?void 0:t.website)||"",groups:(null===(a=e.publicSchool)||void 0===a?void 0:a.groups)||[]}});S(await(0,c.noD)(t,i,e)),z({status:"ready",message:""})}catch(e){z({status:"error",message:503===e.status?"HubSpot-Lesezugang im Backend nicht konfiguriert.":"HubSpot konnte nicht geladen werden (".concat(e.status||e.message,").")})}},[Ae,t,i]),Le=(0,l.useRef)(!1);(0,l.useEffect)(()=>{!Le.current&&null!==v&&null!==u&&s.length&&(Le.current=!0,De())},[v,u,s.length,De]);const Te=(0,l.useMemo)(()=>Ae.filter(e=>Z||!e.school.is_demo),[Ae,Z]),Ke=Ae.filter(e=>e.school.is_demo).length,Fe=(0,l.useMemo)(()=>function(e){let{hubspotLoaded:s=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=s=>e.reduce((e,n)=>e+Q(s(n)),0),t=new Date(Date.now()+60*A).toISOString().slice(0,10);return{total:e.length,active:e.filter(e=>"active"===e.status).length,asleep:e.filter(e=>"asleep"===e.status).length,never:e.filter(e=>"never"===e.status).length,progress30:n(e=>{var s;return null===(s=e.activity)||void 0===s?void 0:s.progress_30d}),progressPrev30:n(e=>{var s;return null===(s=e.activity)||void 0===s?void 0:s.progress_prev_30d}),activeStudents30:n(e=>{var s;return null===(s=e.activity)||void 0===s?void 0:s.active_students_30d}),activeTeachers30:n(e=>{var s;return null===(s=e.activity)||void 0===s?void 0:s.active_teachers_30d}),paidLicenses:e.filter(e=>e.licenseActive&&"regular"===e.school.license_type).length,testLicenses:e.filter(e=>e.licenseActive&&"test"===e.school.license_type).length,expiringSoon:e.filter(e=>e.licenseActive&&e.school.license_end_date&&String(e.school.license_end_date).slice(0,10)<=t).length,hubspotLoaded:s,openDeals:e.reduce((e,s)=>e+s.deals.open.length,0),openAmount:n(e=>e.deals.openAmount),wonAmount:n(e=>e.deals.wonAmount)}}(Te,{hubspotLoaded:"ready"===w.status}),[Te,w.status]),Pe=(0,l.useMemo)(()=>[...new Set(s.map(e=>e.state).filter(Boolean))].sort((e,s)=>e.localeCompare(s,"de")),[s]),Re=(0,l.useMemo)(()=>{const e=O.trim().toLocaleLowerCase("de-DE");return function(e){const s=Y[arguments.length>1&&void 0!==arguments[1]?arguments[1]:J]||Y[J];return[...e].sort((e,n)=>s.compare(e,n)||q(e,n))}(Te.filter(s=>{var n;return(!L||s.status===L)&&((!F||s.school.state===F)&&(!("active"===T&&!s.licenseActive)&&(!!("regular"!==T||s.licenseActive&&"regular"===s.school.license_type)&&(!!("test"!==T||s.licenseActive&&"test"===s.school.license_type)&&(("none"!==T||!s.licenseActive)&&(("unlicensed"!==T||!s.school.license_type||"none"===s.school.license_type)&&(!("deals"===R&&!s.deals.count)&&(!("linked"===R&&!s.hubspot)&&(("unlinked"!==R||!s.hubspot)&&!(e&&![s.name,null===(n=s.publicSchool)||void 0===n?void 0:n.city,s.school.state,s.school.admin_names].some(s=>String(s||"").toLocaleLowerCase("de-DE").includes(e))))))))))))}),C)},[Te,O,L,F,T,R,C]),He=(0,l.useMemo)(()=>Math.max(1,...Te.flatMap(e=>{var s;return((null===(s=e.activity)||void 0===s?void 0:s.weekly_progress)||[]).slice(-12)})),[Te]),Oe=(0,l.useMemo)(()=>(e=>{let{rows:s,weeks:n=[],metric:t="progress",range:l=26,top:i=8,cumulative:r=!1}=e;const c="active_students"===t?"weekly_active_students":"weekly_progress",o=Math.max(0,n.length-l),d=n.slice(o);if(!d.length)return[];const u=s.map(e=>{var s;return{row:e,values:((null===(s=e.activity)||void 0===s?void 0:s[c])||[]).slice(o)}}).map(e=>(0,a.A)((0,a.A)({},e),{},{total:e.values.reduce((e,s)=>e+s,0)})).filter(e=>e.total>0).sort((e,s)=>s.total-e.total||q(e.row,s.row)),h=u.slice(0,i),m=u.slice(i),p=(e,s,n,t)=>{const a=r?(e=>{let s=0;return e.map(e=>s+=e)})(n):n;return{label:e,color:s,total:t,data:d.map((e,s)=>({date:e,value:a[s]||0}))}},g=h.map((e,s)=>p(e.row.name,X[s%X.length],e.values,e.total));if(m.length){const e=d.map((e,s)=>m.reduce((e,n)=>e+(n.values[s]||0),0));g.push(p("Weitere ".concat(m.length," Schulen"),"#cbd5e1",e,e.reduce((e,s)=>e+s,0)))}return g})({rows:Re,weeks:(null===u||void 0===u?void 0:u.weeks)||[],metric:I,range:$,cumulative:se}),[Re,u,I,$,se]),We=e=>{ie("ranking"),ae(e),window.requestAnimationFrame(()=>{var s;return null===(s=Ne.current[e])||void 0===s?void 0:s.scrollIntoView({behavior:"smooth",block:"center"})})},Ze=e=>E(s=>s===e?"":e);(0,l.useEffect)(()=>{ge&&Ae.some(e=>e.id===ge)&&(We(ge),xe(null))},[ge,Ae]);const Ve=Fe.progressPrev30?Math.round((Fe.progress30-Fe.progressPrev30)/Fe.progressPrev30*100):null,Ie=function(e,s){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return(0,o.jsx)("th",{className:n,children:(0,o.jsxs)("button",{type:"button",className:"so-sort".concat(C===e?" is-active":""),onClick:()=>D(e),children:[s,C===e?" \u2193":""]})})};return(0,o.jsxs)("div",{className:"schools-overview",children:[(0,o.jsxs)("div",{className:"section-header",children:[(0,o.jsxs)("h3",{className:"section-title",children:[(0,o.jsx)(x.iM1,{})," Schulen (",s.length,")"]}),(0,o.jsxs)("div",{className:"so-header-actions",children:[(0,o.jsxs)("span",{className:"so-muted",children:["ready"===w.status&&(null===N||void 0===N?void 0:N.retrieved_at_utc)&&"HubSpot: Stand ".concat(new Date(N.retrieved_at_utc).toLocaleTimeString("de-DE",{hour:"2-digit",minute:"2-digit"})),"loading"===w.status&&"HubSpot wird abgeglichen \u2026","error"===w.status&&w.message]}),(0,o.jsxs)("button",{type:"button",className:"section-button",onClick:De,disabled:"loading"===w.status||!Ae.length,children:[(0,o.jsx)(x.KP4,{})," HubSpot"]}),(0,o.jsxs)("button",{type:"button",className:"section-button",onClick:()=>he(!0),children:[(0,o.jsx)(x.OiG,{})," Schule anlegen"]})]})]}),m&&(0,o.jsx)("p",{className:"so-error",role:"alert",children:m}),b&&(0,o.jsx)("p",{className:"so-error",role:"alert",children:b}),(0,o.jsxs)("label",{className:"so-hint",children:[(0,o.jsx)("input",{type:"checkbox",checked:Z,onChange:e=>V(e.target.checked)})," Test-/Demo-Schulen anzeigen (",Ke,")"]}),!Z&&Ke>0&&(0,o.jsxs)("p",{className:"so-hint",children:[Ke," Test-/Demo-Schulen sind aus Ranking, Diagrammen, Karte und Gesamtkennzahlen ausgeblendet. Kennzeichnung in \u201eSchule bearbeiten\u201c \xe4ndern."]}),(0,o.jsxs)("div",{className:"so-kpis",children:[(0,o.jsx)(ke,{label:"Aktive Schulen",value:"".concat(Fe.active," / ").concat(Fe.total),sub:"mit Bearbeitungen in 30 Tagen",tone:"green",active:"active"===L,onClick:()=>Ze("active")}),(0,o.jsx)(ke,{label:"Eingeschlafen",value:Fe.asleep,sub:"fr\xfcher aktiv, seit 30 Tagen still",tone:"amber",active:"asleep"===L,onClick:()=>Ze("asleep")}),(0,o.jsx)(ke,{label:"Bearbeitungen 30 Tage",value:de(Fe.progress30),sub:null==Ve?"davor keine Bearbeitungen":Ve>300?"deutlich mehr als davor (".concat(de(Fe.progressPrev30),")"):"".concat(Ve>=0?"\u2191 +":"\u2193 ").concat(Ve,"% zu den 30 Tagen davor")}),(0,o.jsx)(ke,{label:"Aktive Sch\xfcler 30 Tage",value:de(Fe.activeStudents30),sub:"".concat(de(Fe.activeTeachers30)," Lehrkr\xe4fte mit aktiven Klassen")}),(0,o.jsx)(ke,{label:"HubSpot-Pipeline",value:Fe.hubspotLoaded?ue(Fe.openAmount):"\u2013",sub:Fe.hubspotLoaded?"".concat(Fe.openDeals," offene Deals \xb7 ").concat(ue(Fe.wonAmount)," gewonnen"):"HubSpot nicht geladen"}),(0,o.jsx)(ke,{label:"Lizenzen aktiv",value:Fe.paidLicenses,sub:"".concat(Fe.testLicenses," Test \xb7 ").concat(Fe.expiringSoon," enden in 60 Tagen")})]}),(0,o.jsxs)("div",{className:"so-grid",children:[(0,o.jsxs)("section",{className:"so-panel",children:[(0,o.jsxs)("div",{className:"so-panel__head",children:[(0,o.jsx)("h4",{children:"Nutzung nach Schule"}),(0,o.jsxs)("div",{className:"so-segmented",role:"group","aria-label":"Kennzahl",children:[(0,o.jsx)("button",{type:"button",className:"progress"===I?"is-active":"",onClick:()=>U("progress"),children:"Bearbeitungen"}),(0,o.jsx)("button",{type:"button",className:"active_students"===I?"is-active":"",onClick:()=>U("active_students"),children:"Aktive Sch\xfcler"})]}),(0,o.jsx)("div",{className:"so-segmented",role:"group","aria-label":"Zeitraum",children:Object.entries(fe).map(e=>{let[s,n]=e;return(0,o.jsx)("button",{type:"button",className:$===Number(s)?"is-active":"",onClick:()=>ee(Number(s)),children:n},s)})}),(0,o.jsx)("button",{type:"button",className:"section-button chart-cumulative-toggle".concat(se?" active":""),onClick:()=>ne(e=>!e),children:se?"Kumuliert":"Pro Woche"})]}),!u&&!m&&(0,o.jsx)("p",{className:"so-muted",children:"Lade Nutzungsdaten \u2026"}),u&&0===Oe.length&&(0,o.jsx)("p",{className:"so-muted",children:"Im gew\xe4hlten Zeitraum keine Nutzung."}),Oe.length>0&&(0,o.jsx)(g,{series:Oe,height:240,yLabel:"progress"===I?"Bearbeitungen pro Woche":"Aktive Sch\xfcler pro Woche"},"".concat(I,"-").concat($,"-").concat(se)),(0,o.jsx)("p",{className:"so-hint",children:"Gefiltert wie die Tabelle. Legende anklicken blendet Schulen aus."})]}),(0,o.jsxs)("section",{className:"so-panel",children:[(0,o.jsx)("div",{className:"so-panel__head",children:(0,o.jsxs)("h4",{children:[(0,o.jsx)(x.ZYm,{})," Standorte"]})}),(0,o.jsx)(Se,{mapData:y,rows:Re,selectedId:te,onSelect:We})]})]}),(0,o.jsxs)("section",{className:"so-panel",children:[(0,o.jsxs)("div",{className:"so-view-switch",role:"tablist","aria-label":"Ansicht",children:[(0,o.jsx)("button",{type:"button",role:"tab","aria-selected":"ranking"===le,className:"ranking"===le?"is-active":"",onClick:()=>ie("ranking"),children:"Ranking"}),(0,o.jsxs)("button",{type:"button",role:"tab","aria-selected":"licenses"===le,className:"licenses"===le?"is-active":"",onClick:()=>ie("licenses"),children:["Lizenzen & Testphasen",Fe.expiringSoon>0&&(0,o.jsx)("span",{className:"so-badge",children:Fe.expiringSoon})]})]}),(0,o.jsxs)("div",{className:"so-filters",children:[(0,o.jsxs)("label",{className:"so-search",children:[(0,o.jsx)(x.KSO,{"aria-hidden":"true"}),(0,o.jsx)("input",{value:O,onChange:e=>W(e.target.value),placeholder:"Schule, Ort, Admin suchen","aria-label":"Schulen durchsuchen"})]}),(0,o.jsxs)("div",{className:"so-segmented",role:"group","aria-label":"Status",children:[(0,o.jsxs)("button",{type:"button",className:L?"":"is-active",onClick:()=>E(""),children:["Alle ",Fe.total]}),Object.entries(B).map(e=>{let[s,n]=e;return(0,o.jsxs)("button",{type:"button",className:L===s?"is-active":"",onClick:()=>Ze(s),children:[(0,o.jsx)("i",{className:"so-dot",style:{background:je[s]}}),n," ",Fe[s]]},s)})]}),(0,o.jsx)("select",{value:T,onChange:e=>K(e.target.value),"aria-label":"Lizenz filtern",children:Object.entries(_e).map(e=>{let[s,n]=e;return(0,o.jsx)("option",{value:s,children:n},s)})}),Pe.length>1&&(0,o.jsxs)("select",{value:F,onChange:e=>P(e.target.value),"aria-label":"Bundesland filtern",children:[(0,o.jsx)("option",{value:"",children:"Alle Bundesl\xe4nder"}),Pe.map(e=>(0,o.jsx)("option",{value:e,children:e},e))]}),(0,o.jsx)("select",{value:R,onChange:e=>H(e.target.value),"aria-label":"HubSpot filtern",children:Object.entries(be).map(e=>{let[s,n]=e;return(0,o.jsx)("option",{value:s,children:n},s)})}),(0,o.jsxs)("label",{className:"so-sort-select",children:["Sortieren nach",(0,o.jsx)("select",{value:C,onChange:e=>D(e.target.value),children:Object.entries(Y).map(e=>{let[s,n]=e;return(0,o.jsx)("option",{value:s,children:n.label},s)})})]})]}),"licenses"===le&&(0,o.jsx)(Be,{rows:Re,onSelect:We}),"ranking"===le&&(0,o.jsx)("div",{className:"so-table-wrap",children:(0,o.jsxs)("table",{className:"so-table",children:[(0,o.jsx)("thead",{children:(0,o.jsxs)("tr",{children:[(0,o.jsx)("th",{className:"so-rank",children:"#"}),Ie("name","Schule"),Ie("created_at","Angelegt"),Ie("last_active","Aktivit\xe4t (12 Wochen)"),Ie("progress_total","Bearbeitungen","so-num"),Ie("active_students","Nutzer","so-num"),(0,o.jsx)("th",{children:"Lizenz"}),Ie("deal_volume","HubSpot")]})}),(0,o.jsxs)("tbody",{children:[Re.map((e,s)=>{var n,a,c,d,h;const m=te===e.id,p=e.activity,g=[null===(n=e.publicSchool)||void 0===n?void 0:n.city,e.school.state].filter(
1Boolean).join(", ");return(0,o.jsxs)(l.Fragment,{children:[(0,o.jsxs)("tr",{ref:s=>{Ne.current[e.id]=s},className:"so-row so-row--".concat(e.status).concat(m?" is-open":""),onClick:()=>ae(m?null:e.id),children:[(0,o.jsx)("td",{className:"so-rank",children:s+1}),(0,o.jsxs)("td",{children:[(0,o.jsx)("button",{type:"button",className:"so-name","aria-expanded":m,onClick:s=>{s.stopPropagation(),ae(m?null:e.id)},children:e.name}),e.school.is_demo&&(0,o.jsx)("span",{className:"so-chip so-chip--warn",children:"Test / Demo"}),(0,o.jsx)("span",{className:"so-sub",children:[(null===(a=e.publicSchool)||void 0===a?void 0:a.school_type)||pe(e.school.school_type),g].filter(Boolean).join(" \xb7 ")||"\u2013"}),"confirmed"===(null===(c=e.publicSchool)||void 0===c?void 0:c.startchancen)&&(0,o.jsx)("span",{className:"so-chip so-chip--info",children:"Startchancen"})]}),(0,o.jsx)("td",{children:(0,o.jsx)("span",{className:"so-sub",children:e.school.created_at?me(e.school.created_at):"Nicht erfasst"})}),(0,o.jsx)("td",{children:(0,o.jsxs)("div",{className:"so-activity",children:[(0,o.jsx)(j,{maxValue:He,weeks:((null===u||void 0===u?void 0:u.weeks)||[]).slice(-12),label:"".concat(e.name,": Klassenbearbeitungen"),values:((null===p||void 0===p?void 0:p.weekly_progress)||[]).slice(-12),color:"#cbd5e1"===je[e.status]?"#94a3b8":je[e.status]}),(0,o.jsxs)("span",{className:"so-sub",children:[(0,o.jsx)("i",{className:"so-dot",style:{background:je[e.status]}}),"never"===e.status?"Nie aktiv":(x=e.lastActiveDays,null==x?"nie":0===x?"heute":1===x?"gestern":x<14?"vor ".concat(x," Tagen"):x<60?"vor ".concat(Math.round(x/7)," Wochen"):"vor ".concat(Math.round(x/30)," Monaten"))]})]})}),(0,o.jsxs)("td",{className:"so-num",children:[(0,o.jsx)("strong",{children:de(null===p||void 0===p?void 0:p.progress_total)}),(0,o.jsxs)("span",{className:"so-sub",children:["30 T: ",de(null===p||void 0===p?void 0:p.progress_30d)," ",(0,o.jsx)(ye,{trend:e.trend})]})]}),(0,o.jsxs)("td",{className:"so-num",children:[(0,o.jsx)("strong",{children:de(e.school.student_count)}),(0,o.jsxs)("span",{className:"so-sub",children:[de(null===p||void 0===p?void 0:p.active_students_30d)," aktiv \xb7 ",de(e.school.teacher_count)," LK"]})]}),(0,o.jsxs)("td",{children:[(0,o.jsx)("span",{className:"so-chip".concat(e.licenseActive?"test"===e.school.license_type?" so-chip--warn":" so-chip--ok":""),children:e.licenseActive?"test"===e.school.license_type?"Test":"partner"===e.school.license_type?"Partner":"Regul\xe4r":e.school.license_type&&"none"!==e.school.license_type?"Abgelaufen / inaktiv":"Noch keine Schullizenz"}),e.school.eduplaces_school_id&&(0,o.jsx)("span",{className:"so-sub",children:"\xdcber EduPlaces verbunden"}),e.licenseActive&&e.school.license_end_date&&(0,o.jsxs)("span",{className:"so-sub",children:["bis ",me(e.school.license_end_date)]})]}),(0,o.jsx)("td",{children:(0,o.jsx)(Me,{row:e,hubspotState:w})})]}),m&&(0,o.jsx)("tr",{className:"so-detail-row",children:(0,o.jsx)("td",{colSpan:8,children:(0,o.jsxs)("div",{className:"so-detail",children:[(0,o.jsx)(l.Fragment,{children:null===r||void 0===r?void 0:r(e.school)},"".concat(e.id,":").concat((null===(d=e.hubspot)||void 0===d?void 0:d.company_id)||"")),(0,o.jsxs)("div",{className:"so-detail__cards",children:[(0,o.jsxs)("details",{className:"so-fold",children:[(0,o.jsxs)("summary",{children:["\xd6ffentliche Schuldaten ",(0,o.jsx)("span",{children:(null===(h=e.publicSchool)||void 0===h?void 0:h.city)||"Zuordnung & Quellen"})]}),(0,o.jsx)(Ce,{row:e,publicIndex:ze,username:t,password:i,onChanged:we})]}),(0,o.jsxs)("details",{className:"so-fold",children:[(0,o.jsxs)("summary",{children:["HubSpot ",(0,o.jsx)("span",{children:e.hubspot?ve(e.hubspot.lifecyclestage):"loading"===w.status?"Wird geladen \u2026":"Zuordnung & Deals"})]}),(0,o.jsx)(Ee,{row:e,hubspotState:w,username:t,password:i,onChanged:De})]})]})]})})})]},e.id);var x}),0===Re.length&&(0,o.jsx)("tr",{children:(0,o.jsx)("td",{colSpan:8,className:"so-muted so-empty",children:"Keine Schulen f\xfcr diese Filter."})})]})]})})]}),(0,o.jsx)(ce,{open:re,onClose:()=>he(!1),onCreated:async e=>{await Promise.allSettled([null===d||void 0===d?void 0:d(),we()]),"ready"===w.status&&De(),W(""),E(""),xe(e.id)},username:t,password:i,publicIndex:ze,existingSchools:Ae.map(e=>{var s;return{id:e.id,name:e.name,publicDirectoryId:(null===(s=e.publicSchool)||void 0===s?void 0:s.id)||null}}),teachers:n,hubspotAvailable:"error"!==w.status})]})}var Pe=n(6339),Re=n(8678),He=n(2005);const Oe={new:"Neu",contacted:"Kontaktiert",meeting:"Termin vereinbart",pilot:"Pilot gestartet",closed:"Abgeschlossen"},We={not_requested:"Nicht angefordert",queued:"Wird verschickt",sending:"Versand l\xe4uft",sent:"Versandt",failed:"Versand fehlgeschlagen"},Ze={q:"",status:"",event_name:"",variant:"",due:""},Ve=e=>e?new Date(e).toLocaleDateString("de-DE"):"Offen",Ie=e=>({status:e.status,owner:e.owner||"",follow_up_on:e.follow_up_on||"",follow_up_notes:e.follow_up_notes||""}),Ge=e=>{let{person:s,title:n}=e;return s.name||s.contact?(0,o.jsxs)("div",{className:"lead-person",children:[(0,o.jsx)("span",{children:n}),(0,o.jsx)("strong",{children:s.name||"Name offen"}),(0,o.jsx)("p",{children:s.role}),(0,o.jsx)("p",{children:s.contact})]}):null};function Qe(e){let{username:s,password:n}=e;const[t,r]=(0,l.useState)(Ze),[c,d]=(0,l.useState)(0),[u,h]=(0,l.useState)({items:[],total:0,events:[],counts:{}}),[m,p]=(0,l.useState)(null),[g,x]=(0,l.useState)(null),[v,j]=(0,l.useState)(!0),[_,b]=(0,l.useState)(""),[f,y]=(0,l.useState)(""),[k,N]=(0,l.useState)(!1),[S,w]=(0,l.useState)(0);(0,l.useEffect)(()=>{const e=new AbortController,l=setTimeout(()=>{j(!0),b(""),(0,Re.qM)(s,n,(0,a.A)((0,a.A)({},t),{},{due:t.due||"false",limit:50,offset:50*c}
1),e.signal).then(h).catch(e=>{"AbortError"!==e.name&&b(e.message)}).finally(()=>{e.signal.aborted||j(!1)})},200);return()=>{e.abort(),clearTimeout(l)}},[s,n,t,c,S]);const z=(e,s)=>{r(n=>(0,a.A)((0,a.A)({},n),{},{[e]:s})),d(0)};return(0,o.jsxs)("div",{className:"fair-leads-panel",children:[(0,o.jsxs)("header",{className:"lead-heading",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h3",{children:"Messekontakte & Pilottests"}),(0,o.jsx)("p",{children:"Gespr\xe4ch, Schulzugang und n\xe4chster Schritt an einem Ort."})]}),(0,o.jsxs)("div",{className:"lead-launch",children:[(0,o.jsx)(i.N_,{to:"/messe/dach",target:"_blank",children:"Messe DACH \u2197"}),(0,o.jsx)(i.N_,{to:"/messe/nrw",target:"_blank",children:"Messe NRW \u2197"})]})]}),(0,o.jsx)("div",{className:"lead-counters",children:["new","contacted","meeting","pilot"].map(e=>(0,o.jsxs)("button",{onClick:()=>z("status",e),className:t.status===e?"active":"",children:[(0,o.jsx)("strong",{children:u.counts[e]||0}),(0,o.jsx)("span",{children:Oe[e]})]},e))}),(0,o.jsxs)("div",{className:"lead-filters",children:[(0,o.jsx)("input",{"aria-label":"Messekontakte durchsuchen",placeholder:"Schule, Kontakt oder zust\xe4ndige Person \u2026",value:t.q,onChange:e=>z("q",e.target.value)}),(0,o.jsxs)("select",{"aria-label":"Messe filtern",value:t.event_name,onChange:e=>z("event_name",e.target.value),children:[(0,o.jsx)("option",{value:"",children:"Alle Messen"}),u.events.map(e=>(0,o.jsx)("option",{value:e,children:e},e))]}),(0,o.jsxs)("select",{"aria-label":"Status filtern",value:t.status,onChange:e=>z("status",e.target.value),children:[(0,o.jsx)("option",{value:"",children:"Alle Status"}),Object.entries(Oe).map(e=>{let[s,n]=e;return(0,o.jsx)("option",{value:s,children:n},s)})]}),(0,o.jsxs)("select",{"aria-label":"Messeansicht filtern",value:t.variant,onChange:e=>z("variant",e.target.value),children:[(0,o.jsx)("option",{value:"",children:"DACH & NRW"}),(0,o.jsx)("option",{value:"dach",children:"DACH"}),(0,o.jsx)("option",{value:"nrw",children:"NRW"})]}),(0,o.jsxs)("label",{children:[(0,o.jsx)("input",{type:"checkbox",checked:"true"===t.due,onChange:e=>z("due",e.target.checked?"true":"")}),"Wiedervorlage f\xe4llig"]}),(0,o.jsx)("button",{onClick:()=>w(e=>e+1),"aria-label":"Messekontakte aktualisieren",children:(0,o.jsx)(Pe.jTZ,{})}),(0,o.jsxs)("button",{onClick:async()=>{N(!0),b("");try{await(0,Re.ER)(s,n,(0,a.A)((0,a.A)({},t),{},{due:t.due||"false"}))}catch(e){b(e.message)}finally{N(!1)}},disabled:k,children:[(0,o.jsx)(Pe.a4x,{})," CSV"]})]}),_&&(0,o.jsx)("p",{className:"lead-error",role:"alert",children:_}),(0,o.jsxs)("div",{className:"lead-content".concat(m?" with-detail":""),children:[(0,o.jsxs)("section",{className:"lead-list","aria-label":"Messekontakte",children:[(0,o.jsx)("p",{className:"lead-count","aria-live":"polite",children:v?"Kontakte werden geladen \u2026":"".concat(u.total," Kontakte")}),!v&&!u.items.length&&(0,o.jsxs)("div",{className:"lead-empty",children:[(0,o.jsx)("h4",{children:"Keine Kontakte in dieser Auswahl."}),(0,o.jsx)("p",{children:"Neue Messeanmeldungen erscheinen hier mit dem zugeh\xf6rigen Schulzugang."})]}),u.items.map(e=>(0,o.jsxs)("button",{className:"lead-row".concat((null===m||void 0===m?void 0:m.id)===e.id?" selected":""),onClick:()=>(e=>{p(e),x(Ie(e)),y(""),b("")})(e),children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("span",{className:"lead-status ".concat(e.status),children:Oe[e.status]}),(0,o.jsxs)("small",{children:[e.event_name," \xb7 ",Ve(e.created_at)]})]}),(0,o.jsx)("strong",{children:e.school_name}),(0,o.jsxs)("p",{children:[e.contact_name," \xb7 ",e.payload.interested_person.role||"Rolle offen"]}),(0,o.jsx)("span",{className:"lead-row-contact",children:e.contact}),(0,o.jsxs)("div",{className:"lead-meta",children:[(0,o.jsx)("span",{children:e.owner||"Noch nicht zugeordnet"}),(0,o.jsx)("span",{children:e.follow_up_on?"Wiedervorlage ".concat(Ve(e.follow_up_on)):"Keine Wiedervorlage"})]})]},e.id)),(0,o.jsxs)("div",{className:"lead-pagination",children:[(0,o.jsx)("button",{disabled:0===c||v,onClick:()=>d(e=>e-1),children:"Zur\xfcck"}),(0,o.jsxs)("span",{children:["Seite ",c+1]}),(0,o.jsx)("button",{disabled:50*(c+1)>=u.total||v,onClick:()=>d(e=>e+1),children:"Weiter"})]})]}),m&&(0,o.jsxs)("aside",{className:"lead-detail",children:[(0,o.jsxs)("div",{className:"lead-detail-heading",children:[(0,o.jsxs)("div",{children:[(0,o.jsxs)("span",{children:[m.event_name," \xb7 ","self_service"===m.payload.mode?"Selbst eingetragen":"Messegespr\xe4ch"]}),(0,o.jsx)("h4",{children:m.school_name})]}),(0,o.jsx)("button",{"aria-label":"Kontaktdetails schlie\xdfen",onClick:()=>p(null),children:(0,o.jsx)(Pe.yGN,{})})]}),(0,o.jsx)("p",{children:[m.payload.school.city,m.payload.school.curriculum,m.payload.school.school_type].filter(
1Boolean).join(" \xb7 ")}),"confirmed"===m.payload.school.startchancen&&(0,o.jsx)("span",{className:"lead-startchancen",children:"Startchancen-Schule"}),m.payload.school.website&&(0,o.jsx)("a",{href:m.payload.school.website,target:"_blank",rel:"noopener noreferrer",children:"Schulwebsite \xf6ffnen \u2197"}),(0,o.jsxs)("div",{className:"lead-people",children:[(0,o.jsx)(Ge,{person:m.payload.interested_person,title:"Interessent"}),(0,o.jsx)(Ge,{person:m.payload.school_leadership,title:"Schulleitung"})]}),(0,o.jsx)("div",{className:"lead-interests",children:m.payload.interests.map(e=>{var s;return(0,o.jsx)("span",{children:(null===(s=He.uA.find(s=>s.id===e))||void 0===s?void 0:s.label)||e},e)})}),m.payload.interest_other&&(0,o.jsx)("p",{children:m.payload.interest_other}),m.payload.notes&&(0,o.jsxs)("div",{className:"lead-conversation",children:[(0,o.jsx)("strong",{children:"Gespr\xe4chsnotizen"}),(0,o.jsx)("p",{children:m.payload.notes})]}),(0,o.jsxs)("div",{className:"lead-access",children:[(0,o.jsx)("strong",{children:"Schulzugang"}),m.access_url&&(0,o.jsx)("a",{href:m.access_url,target:"_blank",rel:"noopener noreferrer",children:"Einladungslink \xf6ffnen \u2197"}),(0,o.jsxs)("span",{children:["Einladungsmail: ",We[m.email_status]||m.email_status]}),m.payload.send_invitation&&["failed","sent"].includes(m.email_status)&&(0,o.jsx)("button",{disabled:k,onClick:async()=>{N(!0);try{await(0,Re.LE)(s,n,m.id),p((0,a.A)((0,a.A)({},m),{},{email_status:"queued"})),y("Einladungsmail wird verschickt."),w(e=>e+1)}catch(e){b(e.message)}finally{N(!1)}},children:"Einladung erneut schicken"})]}),(0,o.jsxs)("form",{onSubmit:async e=>{e.preventDefault(),N(!0),y(""),b("");try{const e=await(0,Re.qq)(s,n,m.id,(0,a.A)((0,a.A)({},g),{},{follow_up_on:g.follow_up_on||null}));p(e),x(Ie(e)),w(e=>e+1),y("Follow-up gespeichert.")}catch(t){b(t.message)}finally{N(!1)}},children:[(0,o.jsx)("h4",{children:"N\xe4chster Schritt"}),(0,o.jsxs)("div",{className:"lead-edit-grid",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{htmlFor:"lead-status",children:"Status"}),(0,o.jsx)("select",{id:"lead-status",value:g.status,onChange:e=>x((0,a.A)((0,a.A)({},g),{},{status:e.target.value})),children:Object.entries(Oe).map(e=>{let[s,n]=e;return(0,o.jsx)("option",{value:s,children:n},s)})})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{htmlFor:"lead-owner",children:"Zust\xe4ndig"}),(0,o.jsx)("input",{id:"lead-owner",value:g.owner,maxLength:160,onChange:e=>x((0,a.A)((0,a.A)({},g),{},{owner:e.target.value})),placeholder:"z. B. Tobias"})]})]}),(0,o.jsx)("label",{htmlFor:"lead-followup",children:"Wiedervorlage"}),(0,o.jsx)("input",{id:"lead-followup",type:"date",value:g.follow_up_on,onChange:e=>x((0,a.A)((0,a.A)({},g),{},{follow_up_on:e.target.value}))}),(0,o.jsx)("label",{htmlFor:"lead-followup-notes",children:"Follow-up-Notizen"}),(0,o.jsx)("textarea",{id:"lead-followup-notes",value:g.follow_up_notes,maxLength:5e3,rows:4,onChange:e=>x((0,a.A)((0,a.A)({},g),{},{follow_up_notes:e.target.value}))}),(0,o.jsx)("button",{className:"lead-save",disabled:k,type:"submit",children:k?"Wird gespeichert \u2026":"Follow-up speichern"}),(0,o.jsx)("p",{className:"lead-saved",role:"status",children:f})]})]})]})]})}const qe=e=>{var s;const n=[e.name,N(e.license_type).label];return"expired"===w(e.license_start_date,e.license_end_date,e.license_type).state&&n.push("abgelaufen"),e.max_teachers&&n.push("".concat(null!==(s=e.teacher_count)&&void 0!==s?s:0,"/").concat(e.max_teachers," Lehrkr\xe4fte")),n.join(" \xb7 ")},Ue=e=>{let{teacher:s,schools:n,username:t,password:a,onChanged:i}=e;const[r,d]=(0,l.useState)(s.school_id||""),[u,h]=(0,l.useState)(!1),[m,p]=(0,l.useState)(""),[g,v]=(0,l.useState)("");if("admin"===s.role)return(0,o.jsxs)("div",{className:"teacher-school-assign muted",children:["Schuladmin",s.school_name?" von ".concat(s.school_name):"",": an der Schulkarte verwalten."]});const j=[...n].sort((e,s)=>(e.name||"").localeCompare(s.name||"","de")),_=(r||"")===(s.school_id||"");return(0,o.jsxs)("div",{className:"teacher-school-assign",children:[(0,o.jsxs)("label",{children:[(0,o.jsx)(x.iM1,{})," Schule",(0,o.jsxs)("select",{value:r,onChange:e=>{d(e.target.value),v("")},disabled:u,children:[(0,o.jsx)("option",{value:"",children:"Keine Schule (ohne Lizenz)"}),j.map(e=>(0,o.jsx)("option",{value:e.id,children:qe(e)}
1,e.id))]})]}),(0,o.jsx)("button",{type:"button",className:"section-button",onClick:async()=>{h(!0),p(""),v("");try{await(0,c.Ots)(t.trim(),a.trim(),s.id,r||null),v(r?"Zugeordnet. Die Lizenz gilt ab dem n\xe4chsten Laden der Seite.":"Aus der Schule genommen."),null===i||void 0===i||i()}catch(e){p(z(e,"Zuordnung fehlgeschlagen."))}finally{h(!1)}},disabled:u||_,children:u?"Speichere\u2026":"Zuordnen"}),(0,o.jsx)("span",{className:"muted",children:"Still: die Lehrkraft bekommt keine Nachricht."}),g&&(0,o.jsx)("span",{className:"teacher-school-assign__done",children:g}),m&&(0,o.jsx)("span",{className:"form-error",children:m})]})},Ye=[["teacher","Lehrkr\xe4fte"],["student","Sch\xfcler"],["parent","Eltern"],["guest","G\xe4ste"],["all","Alle"]],Je=e=>["teacher","admin"].includes(e.role),Xe=e=>new Date(e).toLocaleDateString("de-DE",{timeZone:"Europe/Berlin"}),$e=e=>e&&new Date(e).getTime()||0,es=e=>{let{user:s,days:n,username:t,password:a,Chart:i}=e;const[r,d]=(0,l.useState)(null),[u,h]=(0,l.useState)(""),[m,p]=(0,l.useState)(0);(0,l.useEffect)(()=>{let e=!1;return d(null),h(""),(0,c.kD2)(t.trim(),a.trim(),n,s.id).then(s=>{e||d(s)}).catch(s=>{e||h(s.message)}),()=>{e=!0}},[s.id,t,a,n,m]);const g=Je(s)||"parent"===s.directory_role,x=r?[{label:"Eigene Aufgaben",color:"#2563eb",data:r.series.map(e=>({date:e.day,value:e.own_tasks}))},...g?[{label:Je(s)?"Verantwortliche Klassen":"Aufgaben der Kinder",color:"#10b981",data:r.series.map(e=>({date:e.day,value:e.learner_tasks}))}]:[],{label:"Blattzuweisungen",color:"#f59e0b",data:r.series.map(e=>({date:e.day,value:e.assigned_sheets}))},...r.series.some(e=>e.cotaught_tasks)?[{label:"Mitbetreuung (gemeinsam)",color:"#8b5cf6",data:r.series.map(e=>({date:e.day,value:e.cotaught_tasks||0}))}]:[],...r.series.some(e=>e.cotaught_sheets)?[{label:"Bl\xe4tter der Mitbetreuung",color:"#94a3b8",data:r.series.map(e=>({date:e.day,value:e.cotaught_sheets||0}))}]:[]]:[];return(0,o.jsxs)("div",{className:"user-activity-detail",children:[(0,o.jsxs)("h4",{children:["Aktivit\xe4t \xb7 ",n," Tage"]}),u?(0,o.jsxs)("div",{role:"alert",children:[u," ",(0,o.jsx)("button",{type:"button",onClick:()=>p(e=>e+1),children:"Erneut laden"})]}):r?r.series.some(e=>e.own_tasks||e.learner_tasks||e.assigned_sheets||e.cotaught_tasks||e.cotaught_sheets)?(0,o.jsx)(i,{series:x,height:130,yLabel:"Anzahl"}):(0,o.jsx)("p",{className:"muted",children:"Keine Aufgabenbearbeitung oder Blattzuweisung im gew\xe4hlten Zeitraum erfasst."}):(0,o.jsx)("p",{className:"muted",role:"status",children:"Aktivit\xe4t wird geladen\u2026"}),(0,o.jsxs)("p",{className:"user-directory-note",children:["Aufgaben nach ihrem letzten Bearbeitungsdatum; Bl\xe4tter nach ihrer letzten Zuweisung. Wiederholungen verschieben eine Aufgabe auf den neuesten Tag; das Diagramm zeigt keine vollst\xe4ndige Historie aller Versuche. ",Je(s)?"Klassen werden einmal der verantwortlichen Lehrkraft zugeordnet. Mitbetreuung ist gemeinsamer Kontext und wird nicht zum Ranking addiert. Beides belegt keinen individuellen Beitrag der Lehrkraft.":g?"Kinderaktivit\xe4t ist keine eigene Nutzung des Elternkontos.":""]})]})},ss=e=>{const[s,n]=(0,l.useState)(!1);return(0,o.jsxs)("details",{className:"user-extra-section",onToggle:e=>{e.target===e.currentTarget&&n(e.currentTarget.open)},children:[(0,o.jsx)("summary",{children:"Verlauf im Detail"}),s&&(0,o.jsx)(es,(0,a.A)({},e))]})},ns=e=>{var s,n;let{user:t,freeLimits:a}=e;const l=t.activity||{},i=l.daily_activity||(l.summary_days?Array.from({length:l.summary_days},(e,s)=>{const n=new Date;return n.setDate(n.getDate()-l.summary_days+s+1),{day:n.toLocaleDateString("sv-SE",{timeZone:"Europe/Berlin"}),tasks:0,sheets:0}}):[]),r=i.map(e=>Number(e.tasks||0)),c=i.map(e=>Number(e.sheets||0)),d=Math.max(1,...r,...c),u=v(r,d,112,28).join(" "),h=v(c,d,112,28).join(" "),m=Je(t)||"parent"===t.directory_role,p="Aktivit\xe4t mitbetreuter Klassen; gemeinsam mit deren verantwortlicher Lehrkraft. Kein zus\xe4tzlicher Ranking-Beitrag und kein Nachweis eigener Nutzung.",g=Je(t)?[{key:"classes",value:Number(t.class_count)||0,label:"Klassen",tip:"Alle eigenen und aktiv mitbetreuten Klassen. Gleiche Z\xe4hlung wie bei der Free-Limitpr\xfcfung."},{key:"sheets",value:Number(t.sheet_count)||0,label:"Bl\xe4tter",tip:"Eindeutige Bl\xe4tter in eigenen Klassen, insgesamt. Gleiche Z\xe4hlung wie bei der Free-Limitpr\xfcfung;
1 keine Zuweisungsanzahl im gew\xe4hlten Zeitraum."}]:[];return(0,o.jsxs)("div",{className:"user-activity-summary".concat(Je(t)?" user-activity-summary--teacher":""),children:[g.map(e=>{let{key:s,value:n,label:l,tip:i}=e;const r="free"===t.license_tier?null===a||void 0===a?void 0:a[s]:null,c=r>0&&n>=r;return(0,o.jsxs)("div",{className:"user-activity-number user-activity-number--total user-activity-number--".concat(s).concat(c?" user-activity-number--limit":""),"aria-label":"".concat(l,": ").concat(n).concat(r?" von ".concat(r):"").concat(c?", Free-Limit erreicht":""),title:"".concat(i).concat(r?" Free-Limit: ".concat(r,".").concat(c?" Erreicht.":""):""),children:[(0,o.jsxs)("strong",{children:[n,r>0&&(0,o.jsxs)("span",{className:"user-quota-denominator",children:[" / ",r]})]}),c&&(0,o.jsx)("small",{children:"Limit erreicht"})]},s)}),(0,o.jsxs)("div",{className:"user-activity-number user-activity-number--tasks",title:Je(t)?"Eigene Aufgaben und einmal zugeordnete Aufgaben der verantwortlichen Klassen; Mitbetreuung separat.":m?"Eigene Aufgaben und Aufgaben der Kinder":"Bearbeitete Aufgaben",children:[(0,o.jsx)("strong",{children:null!==(s=l.tasks_recent)&&void 0!==s?s:"\u2013"}),l.cotaught_tasks_recent>0&&(0,o.jsxs)("small",{className:"user-cotaught-note",title:p,children:[l.cotaught_tasks_recent.toLocaleString("de-DE")," mitbetreut"]})]}),(0,o.jsxs)("div",{className:"user-activity-number user-activity-number--assignments",title:"Blattzuweisungen in den gew\xe4hlten ".concat(l.summary_days||i.length," Tagen, nicht der Gesamtbestand."),children:[(0,o.jsx)("strong",{children:null!==(n=l.assigned_sheets_recent)&&void 0!==n?n:"\u2013"}),l.cotaught_sheets_recent>0&&(0,o.jsxs)("small",{className:"user-cotaught-note",title:p,children:[l.cotaught_sheets_recent.toLocaleString("de-DE")," mitbetreut"]})]}),(0,o.jsxs)("div",{className:"user-activity-trend",children:[i.length?(0,o.jsxs)("svg",{width:"112",height:"28",viewBox:"0 0 112 28",role:"img","aria-label":"Nutzungsverlauf \xb7 ".concat(i.length," Tage"),children:[(0,o.jsxs)("title",{children:["Aufgaben (blau) und Blattzuweisungen (orange), ",i.length," Tage. Bei Lehrkr\xe4ften eigene Nutzung und verantwortliche Klassen, ohne Mitbetreuung. Je Konto skalierter Verlauf nach letztem gespeicherten Stand."]}),(0,o.jsx)("line",{x1:"0",y1:"26",x2:"112",y2:"26",stroke:"#e2e8f0"}),(0,o.jsx)("polyline",{points:u,fill:"none",stroke:"#2563eb",strokeWidth:"1.6"}),(0,o.jsx)("polyline",{points:h,fill:"none",stroke:"#f59e0b",strokeWidth:"1.6"}),i.map((e,s)=>(0,o.jsx)("rect",{x:112*s/i.length,y:"0",width:112/i.length,height:"28",fill:"transparent",children:(0,o.jsxs)("title",{children:[Xe(e.day),": ",e.tasks," Aufgaben, ",e.sheets," Blattzuweisungen"]})},e.day))]}):(0,o.jsx)("span",{className:"muted",children:"Verlauf wird geladen\u2026"}),(0,o.jsx)("span",{children:l.last_learning_at?"Zuletzt ".concat(Xe(l.last_learning_at)):l.last_assignment_at?"Zuweisung ".concat(Xe(l.last_assignment_at)):l.last_cotaught_learning_at?"Mitbetreuung ".concat(Xe(l.last_cotaught_learning_at)):l.last_cotaught_assignment_at?"Mitbetreuung ".concat(Xe(l.last_cotaught_assignment_at)):"Keine Nutzung erfasst"})]}),t.is_demo&&(0,o.jsx)("span",{className:"user-role-badge",children:"Test / Demo"})]})},ts=e=>{let{overview:s,username:n,password:t,renderUser:i}=e;const[r,d]=(0,l.useState)("teacher"),[u,h]=(0,l.useState)(""),[m,p]=(0,l.useState)("all"),[g,x]=(0,l.useState)("all"),[v,j]=(0,l.useState)(""),[_,b]=(0,l.useState)(""),[f,y]=(0,l.useState)("newest"),[k,N]=(0,l.useState)(!1),[S,w]=(0,l.useState)(30),[z,A]=(0,l.useState)(null),[C,D]=(0,l.useState)(""),[L,E]=(0,l.useState)(0),[M,T]=(0,l.useState)(0),[K,B]=(0,l.useState)(!1);(0,l.useEffect)(()=>{let e=!1;return A(null),D(""),(0,c.kD2)(n.trim(),t.trim(),S).then(s=>{e||A(s.users)}).catch(s=>{e||D(s.message)}),()=>{e=!0}},[n,t,S,s,L]);const F=(0,l.useMemo)(()=>["teachers","students","parents","guests"].flatMap((e,n)=>(s[e]||[]).map(e=>(0,a.A)((0,a.A)({},e),{},{directory_role:["teacher","student","parent","guest"][n],activity:z?(0,a.A)({summary_days:S,tasks_recent:0,activity_days:0,active_learners:0,own_tasks_total:0,assigned_sheets_recent:0},z[e.id]):{}}))),[s,z,S]),P=(0,l.useMemo)(()=>F.filter(e=>K||!e.is_demo),[F,K]),R=(0,l.useMemo)(()=>function(e,s){let{role:n,query:t,activity:a,school:l,provider:i,license:r,sort:c,newOnly:o}=s,d=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Date.now();const u=t.trim().toLocaleLowerCase("de");return e.filter(e=>("all"===n||e.directory_role===n)&&!(u&&![e.name,e.email,e.school_name,e.class_name,e.teacher_name,e.id].some(e=>String(e||"").toLocaleLowerCase("de").includes(u)))&&!(o&&$e(e.created_at)<d-6048e5)&&(!i||e.auth_provider===i)&&!(r&&(!Je(e)||e.license_tier!==r))&&!!("all"===l||Je(e)&&("without"===l?!Boolean(e.sc
1hool_id):e.school_id))&&!!("active"!==a||e.activity.tasks_recent||e.activity.assigned_sheets_recent||e.activity.cotaught_tasks_recent||e.activity.cotaught_sheets_recent)&&("regular"!==a||e.activity.activity_days>=3)&&("unused"!==a||!(e.activity.tasks_recent||e.activity.own_tasks_total||e.activity.assigned_sheets_total||e.activity.last_cotaught_learning_at||e.activity.last_cotaught_assignment_at||e.activity.cotaught_tasks_recent||e.activity.cotaught_sheets_recent||e.class_count||e.sheet_count||e.child_count||e.progress_count))&&("unverified"!==a||"local"===e.auth_provider&&!e.is_email_verified)).sort((e,s)=>{let n=0;return"activity"===c&&(n=(s.activity.tasks_recent||0)-(e.activity.tasks_recent||0)),"own"===c&&(n=(s.activity.own_tasks_recent||0)-(e.activity.own_tasks_recent||0)),"cotaught"===c&&(n=(s.activity.cotaught_tasks_recent||0)-(e.activity.cotaught_tasks_recent||0)),"sheets"===c&&(n=(s.activity.assigned_sheets_recent||0)-(e.activity.assigned_sheets_recent||0)),"regular"===c&&(n=(s.activity.activity_days||0)-(e.activity.activity_days||0)),"reach"===c&&(n=(s.activity.active_learners||0)-(e.activity.active_learners||0)),"last"===c&&(n=$e(s.activity.last_learning_at)-$e(e.activity.last_learning_at)),"total"===c&&(n=(s.activity.own_tasks_total||0)-(e.activity.own_tasks_total||0)),n||$e(s.created_at)-$e(e.created_at)||String(e.id).localeCompare(String(s.id))})}(P,{role:r,query:u,activity:m,school:g,provider:v,license:_,sort:f,newOnly:k}),[P,r,u,m,g,v,_,f,k]);(0,l.useEffect)(()=>{T(0)},[r,u,m,g,v,_,f,k,S,K]);const H=Math.max(1,Math.ceil(R.length/25)),O=Math.min(M,H-1),W=()=>{h(""),p("all"),x("all"),j(""),b(""),y("newest"),N(!1)},Z=[...new Set(P.map(e=>e.auth_provider).filter(Boolean))].sort();return(0,o.jsxs)("div",{className:"user-directory",children:[(0,o.jsx)("div",{className:"user-directory-roles",role:"group","aria-label":"Nutzerrolle",children:Ye.map(e=>{let[s,n]=e;return(0,o.jsxs)("button",{type:"button","aria-pressed":r===s,onClick:()=>(e=>{d(e),x("all"),b(""),y("newest")})(s),children:[n," ",(0,o.jsx)("span",{children:"all"===s?P.length:P.filter(e=>e.directory_role===s).length})]},s)})}),(0,o.jsxs)("div",{className:"user-directory-filters",children:[(0,o.jsxs)("label",{className:"user-directory-search",children:["Suche",(0,o.jsx)("input",{type:"search",placeholder:"Name, E-Mail, Schule oder Klasse",value:u,onChange:e=>h(e.target.value)})]}),(0,o.jsxs)("label",{children:["Sortierung",(0,o.jsxs)("select",{value:f,onChange:e=>y(e.target.value),children:[(0,o.jsx)("option",{value:"newest",children:"Neueste zuerst"}),(0,o.jsxs)("option",{value:"activity",disabled:!z,children:["Meiste Aufgaben \xb7 ",S," Tage"]}),(0,o.jsx)("option",{value:"own",disabled:!z,children:"Eigene Aufgaben"}),("teacher"===r||"all"===r)&&(0,o.jsx)("option",{value:"cotaught",disabled:!z,children:"Mitbetreute Klassen"}),(0,o.jsx)("option",{value:"sheets",disabled:!z,children:"Meiste Blattzuweisungen"}),(0,o.jsx)("option",{value:"regular",disabled:!z,children:"Meiste Bearbeitungstage"}),(0,o.jsx)("option",{value:"last",disabled:!z,children:"Zuletzt bearbeitet"}),("teacher"===r||"parent"===r||"all"===r)&&(0,o.jsx)("option",{value:"reach",disabled:!z,children:"Meiste aktive Sch\xfcler / Kinder"}),(0,o.jsx)("option",{value:"total",disabled:!z,children:"Eigene Aufgaben gesamt"})]})]}),(0,o.jsxs)("label",{children:["Zeitraum",(0,o.jsxs)("select",{"aria-label":"Aktivit\xe4tszeitraum",value:S,onChange:e=>w(Number(e.target.value)),children:[(0,o.jsx)("option",{value:7,children:"7 Tage"}),(0,o.jsx)("option",{value:30,children:"30 Tage"}),(0,o.jsx)("option",{value:90,children:"90 Tage"})]})]})]}),(0,o.jsxs)("details",{className:"user-directory-more",children:[(0,o.jsxs)("summary",{children:["Weitere Filter",["all"!==m,"all"!==g,!!_,!!v,k,K].filter(Boolean).length>0&&" \xb7 ".concat(["all"!==m,"all"!==g,!!_,!!v,k,K].filter(Boolean).length," aktiv")]}),(0,o.jsxs)("div",{className:"user-directory-filters",children:[(0,o.jsxs)("label",{children:["Aktivit\xe4t",(0,o.jsxs)("select",{value:m,onChange:e=>p(e.target.value),children:[(0,o.jsx)("option",{value:"all",children:"Alle Nutzer"}),(0,o.jsx)("option",{value:"active",disabled:!z,children:"Mit Bearbeitung / Blattzuweisung"}),(0,o.jsx)("option",{value:"regular",disabled:!z,children:"Mind. 3 Bearbeitungstage"}),(0,o.jsx)("option",{value:"unused",disabled:!z,children:"Ohne erfasste Nutzung"}),(0,o.jsx)("option",{value:"unverified",children:"E-Mail noch unbest\xe4tigt"})]})]}),("teacher"===r||"all"===r)&&(0,o.jsxs)("label",{children:["Schulzuordnung",(0,o.jsxs)("select",{value:g,onChange:e=>x(e.target.value),children:[(0,o.jsx)("option",{value:"all",children:"Alle"}),(0,o.jsx)("option",{value:"without",children:"Lehrkr\xe4fte ohne Schule"}),(0,o.jsx)("option",{value:"with",children:"Lehrkr\xe4fte mit Schule"})]})]}),("teacher"===r||"all"===r)&&(0,o.jsxs)("label",{children:["Lizenz",(0,o.jsxs)("select",{value:_,onCh
1ange:e=>b(e.target.value),children:[(0,o.jsx)("option",{value:"",children:"Alle"}),(0,o.jsx)("option",{value:"teacher",children:"Private Lehrkraft-Lizenz"}),(0,o.jsx)("option",{value:"school",children:"Schullizenz"}),(0,o.jsx)("option",{value:"manual",children:"Manuell Premium"}),(0,o.jsx)("option",{value:"free",children:"Kostenfrei"}),(0,o.jsx)("option",{value:"admin",children:"Administrator"})]})]}),(0,o.jsxs)("label",{children:["Anmeldung",(0,o.jsxs)("select",{value:v,onChange:e=>j(e.target.value),children:[(0,o.jsx)("option",{value:"",children:"Alle Anbieter"}),Z.map(e=>(0,o.jsx)("option",{value:e,children:"local"===e?"E-Mail":e},e))]})]})]}),(0,o.jsxs)("div",{className:"user-directory-result-bar",children:[(0,o.jsxs)("label",{children:[(0,o.jsx)("input",{type:"checkbox",checked:k,onChange:e=>N(e.target.checked)})," Nur Anmeldungen der letzten 7 Tage"]}),(0,o.jsx)("button",{type:"button",onClick:W,children:"Filter zur\xfccksetzen"})]}),(0,o.jsx)("div",{className:"user-directory-result-bar",children:(0,o.jsxs)("label",{children:[(0,o.jsx)("input",{type:"checkbox",checked:K,onChange:e=>B(e.target.checked)})," Nutzer von Test-/Demo-Schulen anzeigen (",F.filter(e=>e.is_demo).length,")"]})})]}),(0,o.jsxs)("div",{className:"user-directory-count",children:[R.length," Nutzer \xb7 Aufgaben und Zuweisungen in ",S," Tagen ",(0,o.jsx)("span",{title:"Lehrkr\xe4fte: eigene Nutzung und verantwortliche Klassen; Mitbetreuung separat, nicht addieren; Eltern: inklusive verkn\xfcpfter Kinder. Aufgaben nach letztem Bearbeitungsstand, keine vollst\xe4ndige Versuchshistorie. Die Kurven sind pro Konto skaliert.",children:"\u24d8"})]}),C?(0,o.jsxs)("p",{role:"alert",children:[C," ",(0,o.jsx)("button",{type:"button",onClick:()=>E(e=>e+1),children:"Erneut laden"})]}):!z&&(0,o.jsx)("p",{className:"muted",role:"status",children:"Aktivit\xe4tsdaten werden geladen\u2026"}),(0,o.jsxs)("div",{className:"user-directory-columns","aria-hidden":"true",children:[(0,o.jsx)("span",{children:"Nutzer"}),(0,o.jsx)("span",{children:"Registriert / Anmeldung"}),("teacher"===r||"all"===r)&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{className:"user-directory-total-heading",children:"Klassen"}),(0,o.jsx)("span",{className:"user-directory-total-heading",children:"Bl\xe4tter ges."})]}),(0,o.jsx)("span",{children:"Aufgaben"}),(0,o.jsx)("span",{children:"Zuweisungen"}),(0,o.jsxs)("span",{children:["Verlauf \xb7 ",S," Tage"]})]}),(0,o.jsx)("div",{className:"admin-list",children:R.slice(25*O,25*(O+1)).map(e=>(0,o.jsx)(l.Fragment,{children:i(e,S)},e.id))}),!R.length&&z&&(0,o.jsxs)("div",{className:"user-directory-empty",children:["Keine Nutzer f\xfcr diese Filter gefunden.",(0,o.jsx)("button",{type:"button",onClick:W,children:"Filter zur\xfccksetzen"})]}),H>1&&(0,o.jsxs)("nav",{className:"user-directory-pagination","aria-label":"Nutzerseiten",children:[(0,o.jsx)("button",{type:"button",disabled:0===O,onClick:()=>T(O-1),children:"Zur\xfcck"}),(0,o.jsxs)("span",{children:["Seite ",O+1," von ",H]}),(0,o.jsx)("button",{type:"button",disabled:O+1>=H,onClick:()=>T(O+1),children:"Weiter"})]})]})},as=e=>{let{teacher:s,username:n,password:t,onChanged:a}=e;const[i,r]=(0,l.useState)(!1),[d,u]=(0,l.useState)(""),[h,m]=(0,l.useState)(""),p=Boolean(s.manual_premium);return"teacher"!==s.role?null:(0,o.jsxs)("div",{className:"teacher-manual-premium",children:[(0,o.jsxs)("div",{className:"teacher-manual-premium__copy",children:[(0,o.jsxs)("strong",{children:[(0,o.jsx)(x.gt3,{})," Manuelle Premium-Freigabe"]}),(0,o.jsx)("span",{children:p?"Aktiv".concat(s.manual_premium_updated_by?" \xb7 ge\xe4ndert von ".concat(s.manual_premium_updated_by):""):"Dauerhaft, ohne Stripe-Abo"})]}),(0,o.jsx)("button",{type:"button",className:"section-button",onClick:async()=>{r(!0),u(""),m("");try{await(0,c.kII)(n.trim(),t.trim(),s.id,!p),m(p?"Manuelle Freigabe entfernt.":"Premium manuell freigeschaltet."),null===a||void 0===a||a()}catch(e){u(z(e,"Premium-Freigabe konnte nicht ge\xe4ndert werden."))}finally{r(!1)}},disabled:i,children:i?"Speichere\u2026":p?"Freigabe entfernen":"Premium freischalten"}),h&&(0,o.jsx)("span",{className:"teacher-school-assign__done",role:"status",children:h}),d&&(0,o.jsx)("span",{className:"form-error",role:"alert",children:d})]})},ls=/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/,is=e=>{var s;let{school:n,teachers:t=[],username:a,password:i,onChanged:r}=e;const[d,u]=(0,l.useState)(""),[h,m]=(0,l.useState)(""),[p,g]=(0,l.useState)(""),[v,j]=(0,l.useState)([]),[b,f]=(0,l.useState)(!1),[y,k]=(0,l.useState)(""),[N,S]=(0,l.useState)(""),w=[a.trim(),i.trim()],A=(0,l.useMemo)(()=>((e,s,n)=>{const t=n.trim().toLowerCase();return t.length<2?[]:e.filter(e=>"admin"!==e.role&&e.school_id!==s).filter(e=>(e.name||"").toLowerCase().includes(t)||(e.email||"").toLowerCase().includes(t)).slice(0,8)})(t,n.id,d),[t,n.id,d]),C=null!=n.max_teachers&&(null!==(s=n.teacher_count)&&void 0!==s?s:0)+v.length>=n.max_teachers,D=(0,l.useCallback)(async()=>{try{j(await(0,c.qNX)(a.trim(),i.trim(),n.id))}catch(e){S(z(e,"Einladungen konnten nicht geladen werden."))}},[a,i,n.id]);(0,l.useEffect)(()=>{D()},[D]);const L=async(e,s)=>{f(!0),S(""),k("");try{return await e(),k(s),await D(),null===r||void 0===r||r(),!0}catch(n){return S(z(n,"Das hat nicht geklappt.")),!1}finally{f(!1)}};return(0,o.jsxs)("div",{className:"school-add-teachers",children:[(0,o.jsxs)("div",{className:"school-add-teachers__block",children:[(0,o.jsxs)("div",{className:"detail-title",children:[(0,o.jsx)(x.NPy,{})," Vorhandenes Konto zuordnen"]}),(0,o.jsx)(_.A,{query:d,onQueryChange:u,suggestions:A,onSelect:e=>L(()=>(0,c.Ots)(...w,e.id,n.id),"".concat(e.name||e.email," ist jetzt ").concat(n.name," zugeordnet.")).then(e=>{e&&u("")}),disabled:b,placeholder:"Lehrkraft suchen (Name oder E-Mail)",emptyState:d.trim().length>=2?(0,o.jsx)("span",{className:"muted",children:"Kein Konto gefunden. Unten per E-Mail einladen."}):null}),(0,o.jsx)("span",{className:"muted",children:"Still: die Lehrkraft bek
1ommt keine Nachricht, die Lizenz gilt ab dem n\xe4chsten Laden."})]}),(0,o.jsxs)("form",{className:"school-add-teachers__block",onSubmit:async e=>{e.preventDefault();const s=h.trim();if(!ls.test(s))return void S("Bitte eine g\xfcltige E-Mail-Adresse eingeben.");await L(()=>(0,c.rfR)(...w,n.id,s,p.trim()||null),"Einladung an ".concat(s," verschickt."))&&(m(""),g(""))},children:[(0,o.jsxs)("div",{className:"detail-title",children:[(0,o.jsx)(x.maD,{})," Per E-Mail einladen"]}),(0,o.jsxs)("div",{className:"school-add-teachers__row",children:[(0,o.jsx)("input",{type:"email",value:h,onChange:e=>m(e.target.value),placeholder:"[email protected]",disabled:b,"aria-label":"E-Mail-Adresse"}),(0,o.jsx)("input",{type:"text",value:p,onChange:e=>g(e.target.value),placeholder:"Name (optional)",disabled:b,"aria-label":"Name",maxLength:100}),(0,o.jsx)("button",{type:"submit",className:"section-button",disabled:b||!h.trim()||C,children:b?"Sende\u2026":"Einladen"})]}),(0,o.jsx)("span",{className:"muted",children:C?"Lehrkr\xe4fte-Limit der Lizenz erreicht (offene Einladungen z\xe4hlen mit).":"Die Mail kommt vom LivingLines-Team im Auftrag der Schule, der Link gilt 14 Tage."}),v.length>0&&(0,o.jsx)("ul",{className:"school-add-teachers__invites",children:v.map(e=>(0,o.jsxs)("li",{children:[(0,o.jsxs)("span",{children:[e.name?"".concat(e.name," \xb7 "):"",e.email]}),(0,o.jsxs)("span",{className:"muted",children:["eingeladen von ",e.invited_by_name||"\u2013"]}),(0,o.jsx)("button",{type:"button",className:"link-button",onClick:()=>(e=>L(()=>(0,c.v0w)(...w,n.id,e.id),"Einladung an ".concat(e.email," zur\xfcckgezogen.")))(e),disabled:b,title:"Einladung zur\xfcckziehen","aria-label":"Einladung an ".concat(e.email," zur\xfcckziehen"),children:(0,o.jsx)(x.QCr,{})})]},e.id))})]}),y&&(0,o.jsx)("span",{className:"teacher-school-assign__done",children:y}),N&&(0,o.jsx)("span",{className:"form-error",children:N})]})},rs=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,cs=e=>rs.test(String(e||"").trim()),os=e=>{let{value:s,onChange:n}=e;const[t,a]=(0,l.useState)(null),[i,r]=(0,l.useState)(!1),d=(s||"").trim(),u=""!==d&&!cs(d);return(0,o.jsxs)("div",{className:"form-group eduplaces-field",children:[(0,o.jsx)("label",{htmlFor:"eduplaces-school-id",children:"EduPlaces-Schul-ID"}),(0,o.jsxs)("div",{className:"eduplaces-field__row",children:[(0,o.jsx)("input",{id:"eduplaces-school-id",type:"text",value:s,onChange:e=>{n(e.target.value),a(null)},placeholder:"z. B. 5b644430-44f3-4dc3-8734-29417ca743b5",spellCheck:!1,autoComplete:"off"}),(0,o.jsx)("button",{type:"button",className:"section-button",onClick:async()=>{r(!0),a(null);try{var e,s;const n=await(0,c.NME)(d),t=[null===(e=n.location)||void 0===e?void 0:e.city,null===(s=n.address)||void 0===s?void 0:s.city].find(Boolean);a({ok:!0,text:[n.name,t].filter(Boolean).join(", ")||"Schule gefunden"})}catch(n){a({ok:!1,text:404===(null===n||void 0===n?void 0:n.status)?"Nicht gefunden. Das passiert auch, wenn die Schule die Daten\xfcbertragung f\xfcr LivingLines nicht freigegeben hat; die ID kann trotzdem stimmen.":"EduPlaces ist gerade nicht erreichbar."})}finally{r(!1)}},disabled:!d||u||i,children:i?"Pr\xfcfe\u2026":"Bei EduPlaces pr\xfcfen"}),d&&(0,o.jsx)("button",{type:"button",className:"section-button",onClick:()=>{n(""),a(null)},children:"Verkn\xfcpfung l\xf6sen"})]}),u&&(0,o.jsx)("span",{className:"form-error",children:"Das ist keine g\xfcltige ID (Format 8-4-4-4-12 Zeichen)."}),t&&(0,o.jsx)("span",{className:t.ok?"teacher-school-assign__done":"muted",children:t.text}),!d&&(0,o.jsx)("span",{className:"muted",children:"Leer lassen, wenn die Schule nicht \xfcber EduPlaces kommt."})]})};n(6657);var ds=n(9163),us=n(8287);n(895);const hs={active:"Klassen aktiv",preparation:"Vorbereitung",paused:"Pausiert",unused:"Keine Nutzung erfasst"};const ms=e=>Number(e||0).toLocaleString("de-DE"),ps=e=>e?new Date(/(?:Z|[+-]\d\d:\d\d)$/.test(e)?e:"".concat(e,"Z")).toLocaleDateString("de-DE"):"\u2013",gs=()=>(0,o.jsx)("svg",{className:"sta-hubspot-icon",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,o.jsxs)("g",{fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,o.jsx)("path",{d:"M12 12L5 5m9 5V4m2 10h5M12 16l-5 5"}),(0,o.jsx)("circle",{cx:"14",cy:"13",r:"4"}),(0,o.jsx)("circle",{cx:"4",cy:"4",r:"2"}),(0,o.jsx)("circle",{cx:"14",cy:"3",r:"2"}),(0,o.jsx)("circle",{cx:"22",cy:"14",r:"1"}),(0,o.jsx)("circle",{cx:"6",cy:"22",r:"1"})]})});function xs(e){let{schoolId:s,teachers:n=[],username:t,password:i,onSelectTeacher:r}=e;const[d,u]=(0,l.useState)(null),[h,m]=(0,l.useState)(""),[p,g]=(0,l.useState)("30"),[x,v]=(0,l.useState)(""),[_,f]=(0,l.useState)(!1),[y,k]=(0,l.useState)(0),[N,S]=(0,l.useState)(null),[w,z]=(0,l.useState)(""),[A,C]=(0,l.useState)(0),D=n.map(e=>String(e.id)).sort().join(",");(0,l.useEffect)(()=>{let e=!1;return u(null),m(""),(0,c.bFF)(t,i,s).then(s=>{e||u(s)}).catch(()=>{e||m("Lehrkr\xe4fte-Aktivit\xe4t konnte nicht geladen werden.")}),()=>{e=!0}},[s,t,i,y,D]),(0,l.useEffect)(()=>{let e=!1;return S(null),z(""),(0,c.W_P)(t,i,s).then(s=>{e||S(s)}).catch(s=>{e||z(503===s.status?"HubSpot-Kontaktzugang ist nicht konfiguriert.":"HubSpot-Kontakte konnten nicht geladen werden.")}),()=>{e=!0}},[s,t,i,A,D]);const L=(0,l.useMemo)(()=>function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"30",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Date;const t="all"===s?"total":"".concat(s,"d"),l="all"===s?-1/0:n.getTime()-864e5*Number(s);return e.map(e=>
1{const n=Number(e["progress_".concat(t)]||0),i="all"===s?null:Number(e["progress_prev_".concat(t)]||0),r=e.last_preparation_at,c=r?new Date(/(?:Z|[+-]\d\d:\d\d)$/.test(r)?r:"".concat(r,"Z")).getTime():-1/0,o=n>0?"active":r&&c>=l?"preparation":e.progress_total>0||e.class_count>0||e.sheet_count>0?"paused":"unused";return(0,a.A)((0,a.A)({},e),{},{progress:n,previous:i,status:o,activeStudents:Number(e["active_students_".concat(t)]||0),decline:i>0&&n<=i/2})}).sort((e,s)=>s.progress-e.progress||s.activeStudents-e.activeStudents||Number(s.sheet_count)-Number(e.sheet_count)||(e.name||"").localeCompare(s.name||"","de")||String(e.id).localeCompare(String(s.id))).map((e,s)=>(0,a.A)((0,a.A)({},e),{},{rank:s+1}))}((null===d||void 0===d?void 0:d.teachers)||[],p,new Date((null===d||void 0===d?void 0:d.retrieved_at_utc)||Date.now())),[d,p]),E=(0,l.useMemo)(()=>function(e){const s=Object.fromEntries(Object.keys(hs).map(e=>[e,0]));e.forEach(e=>{s[e.status]+=1});const n=e.reduce((e,s)=>e+s.progress,0),t=e.reduce((e,s)=>s.progress>((null===e||void 0===e?void 0:e.progress)||0)?s:e,null);return{counts:s,total:n,top:t,topShare:n?Math.round(t.progress/n*100):null}}(L),[L]),M=(0,l.useMemo)(()=>Math.max(1,...L.flatMap(e=>e.weekly_progress||[])),[L]),T=L.filter(e=>!x||e.status===x),K=_?T:T.slice(0,5),B=(null===N||void 0===N?void 0:N.additional_contacts)||[],F=x?[]:_?B:B.slice(0,3),P="all"===p?"Gesamt":"".concat(p," Tage");return(0,o.jsxs)("section",{className:"sd-section sta","aria-label":"Lehrkr\xe4fte-Aktivit\xe4t",children:[(0,o.jsxs)("div",{className:"sta-head",children:[(0,o.jsxs)("h6",{children:["Lehrkr\xe4fte-Aktivit\xe4t ",(0,o.jsx)("span",{className:"sd-count",children:d?L.length:n.length})]}),(0,o.jsx)("div",{className:"so-segmented",role:"group","aria-label":"Zeitraum Lehrkr\xe4fte",children:[["30","30 Tage"],["90","90 Tage"],["all","Gesamt"]].map(e=>{let[s,n]=e;return(0,o.jsx)("button",{type:"button","aria-pressed":p===s,className:p===s?"is-active":"",onClick:()=>{g(s),f(!1)},children:n},s)})})]}),w&&(0,o.jsxs)("p",{className:"sta-contact-note",role:"status",children:[w," ",(0,o.jsx)("button",{type:"button",className:"so-link-btn",onClick:()=>C(e=>e+1),children:"Kontaktabgleich erneut laden"})]}),!N&&!w&&(0,o.jsx)("p",{className:"sta-contact-note",role:"status",children:"HubSpot-Kontakte werden geladen \u2026"}),"possible"===(null===N||void 0===N?void 0:N.company_status)&&(0,o.jsx)("p",{className:"sta-contact-note",children:"Weitere Kontakte werden nach Best\xe4tigung der HubSpot-Schulzuordnung angezeigt."}),h?(0,o.jsxs)("p",{role:"alert",children:[h," ",(0,o.jsx)("button",{className:"so-link-btn",type:"button",onClick:()=>k(e=>e+1),children:"Erneut laden"})]}):d?L.length||B.length?(0,o.jsxs)(o.Fragment,{children:[L.length>0&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{className:"sta-summary",role:"group","aria-label":"Aktivit\xe4t filtern",children:[(0,o.jsxs)("button",{type:"button","aria-pressed":!x,className:x?"":"is-active",onClick:()=>{v(""),f(!1)},children:["Alle ",(0,o.jsx)("strong",{children:L.length})]}),Object.entries(hs).map(e=>{let[s,n]=e;return(0,o.jsxs)("button",{type:"button","aria-pressed":x===s,className:"sta-status--".concat(s).concat(x===s?" is-active":""),onClick:()=>{v(x===s?"":s),f(!1)},children:[n," ",(0,o.jsx)("strong",{children:E.counts[s]})]},s)})]}),(0,o.jsx)("p",{className:"sta-distribution",children:E.total?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("strong",{children:[ms(E.total)," Bearbeitungen"]})," \xb7 ",E.counts.active," von ",L.length," Lehrkr\xe4ften mit aktiven Klassen \xb7 ",(0,o.jsxs)("strong",{children:[E.topShare," %"]})," entfallen auf ",E.top.name||"die aktivste Lehrkraft","."]}):"Keine Klassenbearbeitungen im gew\xe4hlten Zeitraum erfasst."})]}),E.total>0&&(0,o.jsx)("div",{className:"sta-share-bar",role:"img","aria-label":"Anteile der Lehrkr\xe4fte an den Klassenbearbeitungen",title:"Jedes Segment steht f\xfcr eine Lehrkraft; Breite = Anteil an den Bearbeitungen.",children:L.filter(e=>e.progress>0).map((e,s)=>(0,o.jsx)("span",{style:{width:"".concat(e.progress/E.total*100,"%"),background:["#4f46e5","#0d9488","#0284c7","#a855f7","#64748b"][s%5]},title:"".concat(e.name||"Lehrkraft",": ").concat(Math.round(e.progress/E.total*100)," % (").concat(ms(e.progress)," Bearbeitungen)")},e.id))}),(0,o.jsx)("div",{className:"sta-table-wrap",children:(0,o.jsxs)("table",{className:"sta-table",children:[(0,o.jsx)("thead",{children:(0,o.jsxs)("tr",{children:[(0,o.jsx)("th",{children:"# / Lehrkraft"}),(0,o.jsx)("th",{children:"Status"}),(0,o.jsxs)("th",{children:["Bearbeitungen",(0,o.jsx)("br",{}),(0,o.jsx)("small",{children:P})]}),(0,o.jsx)("th",{children:"Aktive Sch\xfcler:innen"}),(0,o.jsxs)("th",{children:["Zuletzt",(0,o.jsx)("br",{}),(0,o.jsx)("small",{children:"Klassen / Vorbereitung"})]}),(0,o.jsxs)("th",{children:["Verlauf",(0,o.jsx)("br",{}),(0,o.jsx)("small",{children:"26 Wochen \xb7 Wurzelskala"})]})]})}),(0,o.jsxs)("tbody",{children:[F.map(e=>(0,o.jsxs)("tr",{className:"sta-hubspot-row",children:[(0,o.jsx)("td",{children:(0,o.jsxs)("a",{className:"sta-person-button sta-hubspot-name",href:e.url,target:"_blank",rel:"noopener noreferrer",children:[(0,o.jsx)(gs,{}),(0,o.jsx)("span",{children:e.name||e.email||"Kontakt ohne Namen"})]})}),(0,o.jsx)("td",{colSpan:5,children:(0,o.jsxs)("div",{className:"sta-hubspot-fields",children:[e.role&&(0,o.jsx)("span",{children:e.role}),e.email&&(0,o.jsx)("span",{children:e.email}),e.phone&&(0,o.jsx)("span",{children:e.phone}),(0,o.jsx)("small",{title:{none:"Kein LivingLines-Konto mit dieser E-Mail",no_email:"Keine E-Mail \xb7 Kontoabgleich nicht m\xf6glich",ambiguous:"LivingLines-Zuordnung nicht eindeutig",same_school:"LivingLines-Konto vorhanden \xb7 Kontaktabgleich offen",other_school:"LivingLines-Konto vorhanden \xb7 dieser Schule nicht zugeordnet"}[e.account_status],children:"HubSpot-Kontakt"}),(0,o.jsx)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer","aria-label":"HubSpot: ".concat(e.name||e.email||"Kontakt \xf6ffnen"),children:"HubSpot \u2197"})]})})]},"hubspot:".concat(e.id))),K.map(e=>{var s;const t=n.find(s=>String(s.id)===e.id),a=null===N||void 0===N||null===(s=N.matches)||void 0===s?void 0:s[e.id];return(0,o.jsxs)("tr",{children:[(0,o.jsx)("td",{children:(0,o.jsxs)("div",{className:"sta-person",children:[(0,o.jsx)("span",{className:"sta-rank",children:e.rank}),(0,o.jsxs)("div",{children:[(0,o.jsxs)("button",{type:"button",className:"so-link-btn sta-person-button",onClick:()=>null===r||void 0===r?void 0:r(t||e),children:[(0,o.jsx)(b.A,{seed:null===t||void 0===t?void 0:t.avatar_seed,size:24}),(0,o.jsxs)("span",{children:[e.name||"Ohne Namen","admin"===e.role&&(0,o.jsx)("small",{className:"sta-role",children:"Admin"})]})]}),"matched"===(null===a||void 0===a?void 0:a.status)&&(0,o.jsx)("small",{className:"sta-contact",children:(0,o.jsxs)("a",{href:a.url,target:"_blank",rel:"noopener noreferrer","aria-label":"HubSpot: ".concat(a.role||"Kontakt \xf6ffnen"),title:"HubSpot-Kontakt \xf6ffnen".concat("name"===a.match_basis?" \xb7 \xfcber eindeutigen Namen dieser Schule zugeordnet":"").concat(a.role?"":" \xb7 keine Rolle hinterlegt"),children:[(0,o.jsx)(gs,{}),a.role||"HubSpot-Kontakt",(0,o.jsx)("span",{"aria-hidden":"true",children:" \u2197"})]})})]})]})}),(0,o.jsxs)("td",{children:[(0,o.jsx)("span",{className:"sta-status sta-status--".concat(e.status),children:hs[e.status]}),e.decline&&(0,o.jsx)("small",{className:"sta-decline",children:"R\xfcckgang \u2265 50 %"})]}),(0,o.jsxs)("td",{className:"sta-number",children:[(0,o.jsx)("strong",{children:ms(e.progress)}),null!=e.previous&&(0,o.jsxs)("small",{children:["zuvor ",ms(e.previous)]})]}),(0,o.jsxs)("td",{className:"sta-number",children:[ms(e.activeStudents),(0,o.jsxs)("small",{children:["von ",ms(e.student_count)]})]}),(0,o.jsx)("td",{children:(0,o.jsxs)("small",{children:[ps(e.last_class_activity_at),(0,o.jsx)("br",{}),ps(e.last_preparation_at)]})}),(0,o.jsxs)("td",{children:[(0,o.jsx)(j,{values:e.weekly_progress||[],maxValue:M,weeks:d.weeks||[],width:128,label:"".concat(e.name||"Lehrkraft",": Klassenbearbeitungen")}),(0,o.jsxs)("small",{children:[ms(e.class_count)," ",1===Number(e.class_count)?"Klasse":"Klassen"," \xb7 ",ms(e.sheet_count)," ",1===Number(e.sheet_count)?"Blatt":"Bl\xe4tter"]})]})]},e.id)})]})]})}),!T.length&&!F.length&&(0,o.jsx)("p",{className:"sd-empty",children:"Keine Lehrkr\xe4fte in dieser Gruppe."}),(T.length>5||!x&&B.length>3)&&(0,o.jsx)("button",{type:"button",className:"so-link-btn sta-show",onClick:()=>f(e=>!e),children:_?"Weniger anzeigen":!x&&B.length?"Alle ".concat(T.length," Lehrkr\xe4fte und ").concat(B.length," HubSpot-Kontakte anzeigen"):"Alle ".concat(T.length," Lehrkr\xe4fte anzeigen")}),(0,o.jsxs)("details",{className:"sd-collapse sta-explanation",children:[(0,o.jsx)("summary",{children:"Was wird gemessen?"}),(0,o.jsx)("p",{children:"Ranking nach Aufgabenbearbeitungen in den Klassen der verantwortlichen Lehrkraft; Mitbetreuung wird nicht doppelt gez\xe4hlt. Vorbereitung umfasst angelegte Klassen und zugeordnete Bl\xe4tter. \u201ePausiert\u201c bedeutet: fr\xfcher Nutzung oder Vorbereitung, im gew\xe4hlten Zeitraum keine davon. \u201eKeine Nutzung erfasst\u201c bedeutet: keine dieser Daten vorhanden, nicht zwingend nie eingeloggt."}),(0,o.jsx)("p",{children:"HubSpot-Kontakte werden zuerst \xfcber die Konto-E-Mail abgeglichen. Zus\xe4tzlich wird ein identischer vollst\xe4ndiger Name zugeordnet, wenn er bei den Lehrkr\xe4ften und den HubSpot-Kontakten dieser Schule jeweils eindeutig ist; \u201eNachname, Vorname\u201c wird ebenfalls erkannt. Weitere HubSpot-Kontakte stehen am Anfang der Liste und z\xe4hlen nicht zum Aktivit\xe4tsranking. Angezeigt wird \u201eRolle im Bildungssystem\u201c, ersatzweise die Berufsbezeichnung. Kontakte und Rollen werden nicht ver\xe4ndert; der Abgleich wird f\xfcnf Minuten zwischengespeichert."}),(0,o.jsxs)("p",{children:["\u201eZuvor\u201c vergleicht mit den vorherigen ","all"===p?"30 oder 90":p," Tagen. Der Wochenverlauf zeigt immer die letzten 26 Wochen. Die gemeinsame Wurzelskala macht kleine Aktivit\xe4ten sichtbarer; die Linienh\xf6he ist nicht proportional zur Anzahl. Zahlen und Wochenwerte bleiben unver\xe4ndert. Versuche werden anhand der letzten \xc4nderung des aktuellen Aufgabenstands datiert; das ist kein vollst\xe4ndiges Ereignisprotokoll. Ferien und unter
1schiedliche Klassengr\xf6\xdfen k\xf6nnen die Werte beeinflussen."]})]})]}):(0,o.jsx)("p",{className:"sd-empty",children:"Noch keine Lehrkr\xe4fte zugeordnet."}):(0,o.jsx)("p",{className:"sd-empty",role:"status",children:"Aktivit\xe4t wird geladen \u2026"})]})}var vs=n(4304),js=n(418),_s=n(644),bs=n(3146),fs=n(264),ys=n(2009),ks=n(491);const Ns=e=>(e||"livinglines-mail").toLowerCase().normalize("NFKD").replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,60)||"livinglines-mail",Ss=(e,s,n)=>{const t=URL.createObjectURL(new Blob([e],{type:s})),a=document.createElement("a");a.href=t,a.download=n,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(t)},ws=e=>{const s=(new TextEncoder).encode(e||"");let n="";return s.forEach(e=>{n+=String.fromCharCode(e)}),btoa(n).replace(/.{1,76}/g,"$&\r\n").trimEnd()},zs=e=>{if(!e)return"\u2013";const s=new Date(e);return Number.isNaN(s.valueOf())?"\u2013":new Intl.DateTimeFormat("de-DE",{dateStyle:"medium",timeStyle:"short"}).format(s)},As={danger:0,warning:1,success:2,info:3,blocked:4,neutral:5},Cs=e=>{var s,n,t,a,i,r;let{data:c,loading:d,error:u,onRetry:h,onOpenTeacher:m,loadMailDraft:p,loadSampleMailDraft:g}=e;const[v,j]=(0,l.useState)(""),[_,f]=(0,l.useState)("all"),[y,k]=(0,l.useState)("all"),[N,S]=(0,l.useState)(!1),[w,z]=(0,l.useState)(null),[A,C]=(0,l.useState)(null),[D,L]=(0,l.useState)(!1),[E,M]=(0,l.useState)(""),[T,K]=(0,l.useState)("desktop"),B=(0,l.useMemo)(()=>new Set((null===c||void 0===c?void 0:c.mail_draft_signal_ids)||[]),[c]),F=()=>{z(null),C(null),M("")},P=(0,l.useMemo)(()=>{const e=new Map;return((null===c||void 0===c?void 0:c.teachers)||[]).forEach(s=>{var n;null===(n=s.signals)||void 0===n||n.forEach(s=>e.set(s.id,s.label))}),Array.from(e,e=>{let[s,n]=e;return{id:s,label:n}}).sort((e,s)=>e.label.localeCompare(s.label,"de"))},[c]),R=(0,l.useMemo)(()=>{const e=v.trim().toLowerCase();return((null===c||void 0===c?void 0:c.teachers)||[]).filter(e=>{var s;return"all"===_||(null===(s=e.stage)||void 0===s?void 0:s.id)===_}).filter(e=>{var s;return"all"===y||(null===(s=e.signals)||void 0===s?void 0:s.some(e=>e.id===y))}).filter(e=>!N||e.analysis_email_eligible).filter(s=>!e||[s.name,s.email,s.school_name].some(s=>(s||"").toLowerCase().includes(e))).sort((e,s)=>{var n,t,a,l;const i=Math.min(...(e.signals||[]).map(e=>{var s;return null!==(s=As[e.severity])&&void 0!==s?s:9}),9),r=Math.min(...(s.signals||[]).map(e=>{var s;return null!==(s=As[e.severity])&&void 0!==s?s:9}),9);return i!==r?i-r:(null!==(n=null===(t=s.stage)||void 0===t?void 0:t.order)&&void 0!==n?n:0)-(null!==(a=null===(l=e.stage)||void 0===l?void 0:l.order)&&void 0!==a?a:0)})},[c,N,v,y,_]);return d&&!c?(0,o.jsx)("div",{className:"lifecycle-state",children:"Lifecycle-Daten werden berechnet\u2026"}):u&&!c?(0,o.jsxs)("div",{className:"lifecycle-state lifecycle-state--error",children:[(0,o.jsx)("span",{children:u}),(0,o.jsx)("button",{type:"button",className:"section-button",onClick:h,children:"Erneut laden"})]}):c?(0,o.jsxs)("div",{className:"teacher-lifecycle",children:[(0,o.jsxs)("div",{className:"lifecycle-dry-run",children:[(0,o.jsx)(x.XcJ,{}),(0,o.jsxs)("div",{children:[(0,o.jsx)("strong",{children:"Dry-Run: Es werden keine E-Mails versendet."}),(0,o.jsx)("span",{children:"Die Einordnungen basieren ausschlie\xdflich auf vorhandenen Klassen-, Blatt- und Fortschrittsdaten."})]})]}),(0,o.jsx)("div",{className:"lifecycle-stage-grid",children:(c.stages||[]).map(e=>{var s,n,t;return(0,o.jsxs)("button",{type:"button",className:"lifecycle-stage-card".concat(_===e.id?" active":"").concat("unclassified"===e.id?" warning":""),onClick:()=>f(s=>s===e.id?"all":e.id),children:[(0,o.jsx)("strong",{children:null!==(s=null===(n=c.summary)||void 0===n||null===(t=n.stage_counts)||void 0===t?void 0:t[e.id])&&void 0!==s?s:0}),(0,o.jsx)("span",{children:e.label})]},e.id)})}),(0,o.jsxs)("div",{className:"lifecycle-toolbar",children:[(0,o.jsxs)("label",{className:"lifecycle-search",children:[(0,o.jsx)(x.KSO,{}),(0,o.jsx)("input",{type:"search",value:v,onChange:e=>j(e.target.value),placeholder:"Name, E-Mail oder Schule"})]}
1),(0,o.jsxs)("select",{value:_,onChange:e=>f(e.target.value),children:[(0,o.jsx)("option",{value:"all",children:"Alle Aktivierungsstufen"}),(c.stages||[]).map(e=>(0,o.jsx)("option",{value:e.id,children:e.label},e.id))]}),(0,o.jsxs)("select",{value:y,onChange:e=>k(e.target.value),children:[(0,o.jsx)("option",{value:"all",children:"Alle Signale"}),P.map(e=>{var s,n,t;return(0,o.jsxs)("option",{value:e.id,children:[e.label," (",null!==(s=null===(n=c.summary)||void 0===n||null===(t=n.signal_counts)||void 0===t?void 0:t[e.id])&&void 0!==s?s:0,")"]},e.id)})]}),(0,o.jsxs)("button",{type:"button",className:"section-button".concat(N?" active":""),onClick:()=>S(e=>!e),children:[(0,o.jsx)(x.maD,{})," Analyse-Mail m\xf6glich (",null!==(s=null===(n=c.summary)||void 0===n?void 0:n.analysis_email_eligible)&&void 0!==s?s:0,")"]}),(0,o.jsxs)("select",{value:"",onChange:e=>{const s=(c.mail_draft_catalog||[]).find(s=>s.id===e.target.value);s&&(async e=>{z({teacher:{name:"Mara Beispiel",email:"[email protected]"},signal:e}),C(null),M(""),K("desktop"),L(!0);try{C(await g(e))}catch(s){M((null===s||void 0===s?void 0:s.message)||"Die Mail-Vorlage konnte nicht geladen werden.")}finally{L(!1)}})(s)},"aria-label":"Mail-Vorlage mit Demo-Daten \xf6ffnen",children:[(0,o.jsx)("option",{value:"",children:"Mail-Vorlagen testen\u2026"}),(c.mail_draft_catalog||[]).map(e=>(0,o.jsx)("option",{value:e.id,children:e.label},e.id))]})]}),(0,o.jsxs)("div",{className:"lifecycle-result-meta",children:[(0,o.jsxs)("span",{children:[R.length," von ",null!==(t=null===(a=c.summary)||void 0===a?void 0:a.total)&&void 0!==t?t:0," Lehrkr\xe4ften"]}),(0,o.jsxs)("span",{children:["Stand: ",zs(c.generated_at)]}),d&&(0,o.jsx)("span",{children:"Wird aktualisiert\u2026"})]}),(0,o.jsxs)("div",{className:"lifecycle-list",children:[R.map(e=>{var s,n,t,a,l,i,r,c,d,u,h,g,v;const j=e.metrics||{},_=[...e.signals||[]].sort((e,s)=>{var n,t;return(null!==(n=As[e.severity])&&void 0!==n?n:9)-(null!==(t=As[s.severity])&&void 0!==t?t:9)});return(0,o.jsxs)("details",{className:"lifecycle-teacher-card",children:[(0,o.jsxs)("summary",{children:[(0,o.jsx)(b.A,{seed:e.avatar_seed,size:36}),(0,o.jsxs)("div",{className:"lifecycle-teacher-identity",children:[(0,o.jsx)("strong",{children:e.name||"Unbenannte Lehrkraft"}),(0,o.jsxs)("span",{children:[e.email||"Keine E-Mail",e.school_name?" \xb7 ".concat(e.school_name):""]})]}),(0,o.jsx)("div",{className:"lifecycle-stage-badge","data-stage":null===(s=e.stage)||void 0===s?void 0:s.id,children:(null===(n=e.stage)||void 0===n?void 0:n.label)||"Nicht klassifiziert"}),(0,o.jsxs)("div",{className:"lifecycle-signal-preview",children:[_.slice(0,2).map(e=>(0,o.jsx)("span",{className:"lifecycle-signal lifecycle-signal--".concat(e.severity),children:e.label},e.id)),_.length>2&&(0,o.jsxs)("span",{className:"lifecycle-more",children:["+",_.length-2]})]}),(0,o.jsxs)("span",{className:"lifecycle-mail-state".concat(e.analysis_email_eligible?" eligible":""),title:e.analysis_email_eligible?"Analyse-Mail m\xf6glich":"Analyse-Mail nicht m\xf6glich",children:[e.analysis_email_eligible?(0,o.jsx)(x.A7C,{}):(0,o.jsx)(x._Hm,{}),(0,o.jsx)(x.maD,{})]}),(0,o.jsxs)("button",{type:"button",className:"lifecycle-explorer-button",onClick:s=>{s.preventDefault(),s.stopPropagation(),null===m||void 0===m||m(e)},children:[(0,o.jsx)(x.Ny1,{})," Lehreransicht"]})]}),(0,o.jsxs)("div",{className:"lifecycle-details",children:[(0,o.jsxs)("div",{className:"lifecycle-evidence",children:[(0,o.jsxs)("h4",{children:[(0,o.jsx)(x.BS8,{})," Signale und Begr\xfcndung"]}),_.length>0?_.map(s=>(0,o.jsxs)("div",{className:"lifecycle-evidence-row lifecycle-evidence-row--".concat(s.severity),children:[(0,o.jsx)("strong",{children:s.label}),(0,o.jsx)("span",{children:s.reason}),(0,o.jsx)("code",{children:s.id}),B.has(s.id)&&(0,o.jsxs)("button",{type:"button",className:"lifecycle-draft-button",onClick:()=>(async(e,s)=>{z({teacher:e,signal:s}),C(null),M(""),K("desktop"),L(!0);try{C(await p(e,s))}catch(n){M((null===n||void 0===n?void 0:n.message)||"Der Mail-Entwurf konnte nicht geladen werden.")}finally{L(!1)}})(e,s),children:[(0,o.jsx)(x.$_Y,{})," Mail-Entwurf"]})]},s.id)):(0,o.jsx)("p",{children:"Aktuell liegt kein zus\xe4tzliches Signal vor."})]}),(0,o.jsxs)("div",{className:"lifecycle-metrics",children:[(0,o.jsxs)("h4",{children:[(0,o.jsx)(x.aQJ,{})," Evidenz"]}),(0,o.jsxs)("div",{className:"lifecycle-metric-grid",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("strong",{children:null!==(t=j.class_count)&&void 0!==t?t:0}),(0,o.jsx)("span",{children:"Klassen"})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("strong",{children:null!==(a=j.sheet_count)&&void 0!==a?a:0}),(0,o.jsx)("span",{children:"Bl\xe4tter"})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("strong",{children:null!==(l=j.assigned_task_count)&&void 0!==l?l:0}),(0,o.jsx)("span",{children:"Aufgaben"})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("strong",{children:null!==(i=j.enrolled_student_count)&&void 0!==i?i:0}),(0,o.jsx)("span",{children:"Sch\xfcler angelegt"})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("strong",{children:null!==(r=j.active_student_count)&&void 0!==r?r:0}),(0,o.jsx)("span",{children:"Sch\xfcler aktiv"})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("strong",{children:null!==(c=j.activity_day_count)&&void 0!==c?c:0}),(0,o.jsx)("span",{children:"Aktive Tage"})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("strong",{children:null!==(d=j.corrected_student_count)&&void 0!==d?d:0}),(0,o.jsx)("span",{children:"Mit Hinweis gel\xf6st"})]})]}),(0,o.jsxs)("div",{className:"lifecycle-run-summary",children:[(0,o.jsx)(x.mFx,{}),(0,o.jsxs)("span",{children:["Letzter Lauf: ",(0,o.jsxs)("strong",{children:[null!==(u=j.latest_run_student_count)&&void 0!==u?u:0,"/",null!==(h=j.latest_run_enrolled_count)&&void 0!==h?h:0]})," aktiv, Median ",(0,o.jsx)("strong",{children:null!==(g=j.latest_run_median_tasks)&&void 0!==g?g:0})," von ",(0,o.jsx)("strong",{children:null!==(v=j.latest_run_available_task_count)&&void 0!==v?v:0})," Aufgaben"]})]}),(0,o.jsxs)("div",{className:"lifecycle-dates",children:[(0,o.jsxs)("span",{children:["Stage seit: ",zs(e.stage_since)]}),(0,o.jsxs)("span",{children:["Letzte Aktivit\xe4t: ",zs(e.last_activity_at)]})]})]})]})]},e.id)}),0===R.length&&(0,o.jsx)("div",{className:"lifecycle-state",children:"Keine Lehrkraft entspricht den gew\xe4hlten Filtern."})]}),w&&(0,o.jsx)("div",{className:"lifecycle-draft-overlay",onClick:e=>{e.target===e.currentTarget&&F()},children:(0,o.jsxs)("div",{className:"lifecycle-draft-modal",children:[(0,o.jsxs)("div",{className:"lifecycle-draft-header",children:[(0,o.jsxs)("div",{children:[(0,o.jsxs)("span",{className:"lifecycle-draft-kicker",children:[null!==A&&void 0!==A&&A.sample_data?"Demo-Daten \xb7 "
1:"","Nur Vorschau \xb7 kein Versand m\xf6glich"]}),(0,o.jsx)("h3",{children:(null===A||void 0===A?void 0:A.subject)||w.signal.label}),(0,o.jsxs)("p",{children:["An: ",(null===A||void 0===A||null===(i=A.recipient)||void 0===i?void 0:i.name)||w.teacher.name||"\u2013",null!==A&&void 0!==A&&null!==(r=A.recipient)&&void 0!==r&&r.email?" <".concat(A.recipient.email,">"):" \xb7 keine E-Mail-Adresse"]})]}),(0,o.jsx)("button",{type:"button",className:"close-button",onClick:F,"aria-label":"Mail-Vorschau schlie\xdfen",children:"\xd7"})]}),(0,o.jsxs)("div",{className:"lifecycle-draft-toolbar",children:[(0,o.jsxs)("div",{className:"lifecycle-preview-toggle","aria-label":"Vorschaugr\xf6\xdfe",children:[(0,o.jsxs)("button",{type:"button",className:"desktop"===T?"active":"",onClick:()=>K("desktop"),children:[(0,o.jsx)(x.Wqt,{})," Desktop"]}),(0,o.jsxs)("button",{type:"button",className:"mobile"===T?"active":"",onClick:()=>K("mobile"),children:[(0,o.jsx)(x.rle,{})," Mobil"]})]}),A&&(0,o.jsxs)("div",{className:"lifecycle-draft-actions",children:[(0,o.jsxs)("span",{className:"lifecycle-draft-eligibility".concat(A.analysis_email_eligible?" eligible":""),children:[A.analysis_email_eligible?(0,o.jsx)(x.A7C,{}):(0,o.jsx)(x._Hm,{}),A.analysis_email_eligible?"Analyse-Mail w\xe4re zul\xe4ssig":"Versand w\xe4re unterdr\xfcckt"]}),(0,o.jsxs)("button",{type:"button",className:"lifecycle-download-button",onClick:()=>Ss(A.html,"text/html;charset=utf-8","".concat(Ns(A.subject),".html")),children:[(0,o.jsx)(x.WCW,{})," HTML"]}),(0,o.jsxs)("button",{type:"button",className:"lifecycle-download-button",onClick:()=>Ss((e=>{var s,n;const t="livinglines-preview-boundary",a="=?UTF-8?B?".concat(ws(e.subject).replace(/\s/g,""),"?="),l=((null===(s=e.recipient)||void 0===s?void 0:s.name)||"").replace(/[\r\n]/g,""),i=((null===(n=e.recipient)||void 0===n?void 0:n.email)||"").replace(/[\r\n]/g,""),r=i?"".concat(l?"=?UTF-8?B?".concat(ws(l).replace(/\s/g,""),"?= "):"","<").concat(i,">"):"";return["MIME-Version: 1.0","From: LivingLines <[email protected]>","To: ".concat(r),"Subject: ".concat(a),'Content-Type: multipart/alternative; boundary="'.concat(t,'"'),"","--".concat(t),"Content-Type: text/plain; charset=UTF-8","Content-Transfer-Encoding: base64","",ws(e.text),"--".concat(t),"Content-Type: text/html; charset=UTF-8","Content-Transfer-Encoding: base64","",ws(e.html),"
1--".concat(t,"--"),""].join("\r\n")})(A),"message/rfc822","".concat(Ns(A.subject),".eml")),children:[(0,o.jsx)(x.WCW,{})," .eml"]})]})]}),(0,o.jsxs)("div",{className:"lifecycle-draft-canvas lifecycle-draft-canvas--".concat(T),children:[D&&(0,o.jsx)("div",{className:"lifecycle-state",children:"Mail-Entwurf wird gerendert\u2026"}),E&&(0,o.jsx)("div",{className:"lifecycle-state lifecycle-state--error",children:E}),(null===A||void 0===A?void 0:A.html)&&(0,o.jsx)("iframe",{title:"Vorschau: ".concat(A.subject),srcDoc:A.html,sandbox:""})]}),(0,o.jsxs)("div",{className:"lifecycle-draft-footer",children:[(0,o.jsx)(x.XcJ,{})," Dieser Dialog kann ausschlie\xdflich Entw\xfcrfe anzeigen. HTML \xf6ffnet die Gestaltung im Browser; .eml zeigt die Mail lokal im Mail-Client. Es wird nichts versendet."]})]})})]}):null},Ds={profile_menu:"Profil-Men\xfc",task_skip:"Aufgabe \xfcbersprungen",sheet_completed:"Blatt abgeschlossen",sheet_created:"Blatt erstellt",class_session_end:"Nach Klasseneinsatz",school_year_mail:"Schuljahresmail",other:"Sonstiges"},Ls={stamm:"Aktive Nutzung",gelegentlich:"Gelegentliche Nutzung",versandet:"Eingeschlafene Nutzung",nie:"Noch nicht gestartet",neu:"Neu dabei"},Es={recognition:"Erkennung fehlerhaft",solutionNotRecognized:"Richtige L\xf6sung nicht erkannt",wrongFeedback:"Falsches Feedback",unclearInstruction:"Aufgabenstellung unklar",hangs:"H\xe4ngt fest",other:"Sonstiges"},Ms={teacher:"Lehrkraft",admin:"Admin",student:"Sch\xfcler:in",guest:"Gast"},Ts=e=>{if(!e)return"\u2014";try{return new Date(e).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",year:"2-digit",hour:"2-digit",minute:"2-digit"})}catch(s){return e}},Ks=e=>{let{username:s,password:n}=e;const[t,a]=(0,l.useState)([]),[i,r]=(0,l.useState)(0),[d,u]=(0,l.useState)(!1),[h,m]=(0,l.useState)(null),[p,g]=(0,l.useState)(""),[v,j]=(0,l.useState)(0),[_,b]=(0,l.useState)([]),[f,y]=(0,l.useState)(""),[k,N]=(0,l.useState)(null),S=(0,l.useCallback)(async()=>{u(!0),m(null);try{const e=await(0,c.Rsm)(s,n,{limit:100,offset:100*v,source:p||null});a(e.items||[]),r(e.total||0)}catch(e){m(e.message||"Feedback konnte nicht geladen werden")}finally{u(!1)}},[s,n,p,v]),w=(0,l.useCallback)(async()=>{try{const e=await(0,c.sXm)(s,n);b(e.subscribers||[])}catch(e){N(e.message||"Abonnenten konnten nicht geladen werden")}},[s,n]);(0,l.useEffect)(()=>{S()},[S]),(0,l.useEffect)(()=>{w()},[w]);const z=Math.max(0,Math.ceil(i/100)-1);return(0,o.jsxs)("div",{className:"feedback-panel",children:[(0,o.jsxs)("div",{className:"feedback-panel__controls",children:[(0,o.jsxs)("select",{value:p,onChange:e=>{g(e.target.value),j(0)},className:"feedback-panel__select",children:[(0,o.jsx)("option",{value:"",children:"Alle Orte"}),Object.entries(Ds).map(e=>{let[s,n]=e;return(0,o.jsx)("option",{value:s,children:n},s)})]}),(0,o.jsxs)("button",{type:"button",className:"section-button",onClick:S,disabled:d,children:[(0,o.jsx)(x.DIg,{})," Neu laden"]}),(0,o.jsxs)("span",{className:"feedback-panel__count",children:[i," ",1===i?"Eintrag":"Eintr\xe4ge"]})]}),h&&(0,o.jsx)("p",{className:"feedback-panel__error",children:h}),d&&(0,o.jsx)("p",{className:"feedback-panel__hint",children:"Lade Feedback\u2026"}),!d&&!h&&0===t.length&&(0,o.jsx)("p",{className:"feedback-panel__hint",children:"Noch kein Feedback eingegangen."}),t.length>0&&(0,o.jsx)("div",{className:"feedback-panel__table-wrap",children:(0,o.jsxs)("table",{className:"feedback-panel__table",children:[(0,o.jsx)("thead",{children:(0,o.jsxs)("tr",{children:[(0,o.jsx)("th",{children:"Zeitpunkt"}),(0,o.jsx)("th",{children:"Absender"}),(0,o.jsx)("th",{children:"Ort"}),(0,o.jsx)("th",{children:"Bewertung"}),(0,o.jsx)("th",{children:"Nachricht"})]})}),(0,o.jsx)("tbody",{children:t.map(e=>{var s;return(0,o.jsxs)("tr",{children:[(0,o.jsx)("td",{className:"nowrap",children:Ts(e.created_at)}),(0,o.jsx)("td",{children:(0,o.jsxs)("div",{className:"feedback-panel__sender",children:[(0,o.jsx)("span",{className:"feedback-panel__name",children:e.user_name||"Unbekannt"}),(0,o.jsxs)("span",{className:"feedback-panel__meta",children:[Ms[e.role]||e.role||"\u2014",e.school_name?" \xb7 ".concat(e.school_name):""]}),e.user_email&&(0,o.jsx)("a",{className:"feedback-panel__mail",href:"mailto:".concat(e.user_email),children:e.user_email})]})}),(0,o.jsxs)("td",{children:[(0,o.jsx)("span",{className:"feedback-panel__chip".concat("task_skip"===e.source?" feedback-panel__chip--skip":""),children:Ds[e.source]||e.source}),e.reason&&(0,o.jsx)("div",{className:"feedback-panel__reason",children:Es[e.reason]||e.reason}),e.sheet_title&&(0,o.jsx)("div",{className:"feedback-panel__path",title:e.sheet_title,children:e.sheet_title}),(null===(s=e.context)||void 0===s?void 0:s.path)&&(0,o.jsx)("div",{className:"feedback-panel__path",children:e.context.path}),"school_year_mail"===e.source&&e.context&&(0,o.jsxs)("div",{className:"feedback-panel__path",children:[Ls[e.context.segment]||e.context.segment,e.context.answer_label?" \xb7 ".concat(e.context.answer_label):"",e.context.
1interview?" \xb7 Gespr\xe4ch gew\xfcnscht":""]})]}),(0,o.jsx)("td",{className:"nowrap",children:e.rating?"".concat("\u2605".repeat(e.rating)).concat("\u2606".repeat(5-e.rating)):"\u2014"}),(0,o.jsx)("td",{className:"feedback-panel__message",children:e.message||("task_skip"===e.source?(0,o.jsx)("span",{className:"feedback-panel__muted",children:"ohne Freitext"}):"\u2014")})]},e.id)})})]})}),z>0&&(0,o.jsxs)("div",{className:"feedback-panel__pager",children:[(0,o.jsx)("button",{type:"button",className:"section-button",onClick:()=>j(e=>Math.max(0,e-1)),disabled:0===v,children:"Zur\xfcck"}),(0,o.jsxs)("span",{children:["Seite ",v+1," / ",z+1]}),(0,o.jsx)("button",{type:"button",className:"section-button",onClick:()=>j(e=>Math.min(z,e+1)),disabled:v>=z,children:"Weiter"})]}),(0,o.jsxs)("div",{className:"feedback-panel__subscribers",children:[(0,o.jsx)("h4",{children:"Benachrichtigungen bei neuem Feedback"}),(0,o.jsxs)("form",{className:"feedback-panel__sub-form",onSubmit:async e=>{e.preventDefault();const t=f.trim().toLowerCase();if(t){N(null);try{await(0,c.u5N)(s,n,t),y(""),w()}catch(a){N(a.message||"Konnte nicht hinzugef\xfcgt werden")}}},children:[(0,o.jsx)("input",{type:"email",value:f,onChange:e=>y(e.target.value),placeholder:"[email protected]"}),(0,o.jsxs)("button",{type:"submit",className:"section-button",disabled:!f.trim(),children:[(0,o.jsx)(x.OiG,{})," Hinzuf\xfcgen"]})]}),k&&(0,o.jsx)("p",{className:"feedback-panel__error",children:k}),0===_.length?(0,o.jsx)("p",{className:"feedback-panel__hint",children:"Niemand abonniert \u2014 es werden keine Mails verschickt."}):(0,o.jsx)("ul",{className:"feedback-panel__sub-list",children:_.map(e=>(0,o.jsxs)("li",{children:[(0,o.jsx)("span",{children:e.email}),(0,o.jsx)("button",{type:"button",onClick:()=>(async e=>{N(null);try{await(0,c.BQW)(s,n,e),w()}catch(t){N(t.message||"Konnte nicht entfernt werden")}})(e.email),"aria-label":"".concat(e.email," entfernen"),children:(0,o.jsx)(x.qbC,{})})]},e.email))})]})]})},Bs={cta:"Haupt-Button",video:"Einf\xfchrungsvideo",video_zeile:"Video-Link",aim:"aim-Kurs"},Fs={teacher:"Lehrkraft",admin:"Admin"},Ps={regular:"Volllizenz",test:"Testlizenz"},Rs=e=>Bs[e]||(e||"").replace(/_/g," "),Hs=e=>{if(!e)return"\u2014";try{return new Date(e).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",year:"2-digit",hour:"2-digit",minute:"2-digit"})}catch(s){return e}},Os=e=>{try{return new URL(e).pathname}catch(s){return e||""}},Ws=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return/iPhone|iPad/i.test(e)?"iPhone/iPad":/Android/i.test(e)?"Android":/Macintosh/i.test(e)?"Mac":/Windows/i.test(e)?"Windows":/Linux/i.test(e)?"Linux":"Unbekannt"},Zs=e=>{var s;let{username:n,password:t,campaign:a}=e;const[i,r]=(0,l.useState)(null),[d,u]=(0,l.useState)(""),[h,m]=(0,l.useState)(!1),[p,g]=(0,l.useState)(!1),[v,j]=(0,l.useState)(null),_=void 0!==a,b=_?a:d,f=(0,l.useCallback)(async()=>{g(!0),j(null);try{r(await(0,c.YFL)(n,t,b||null))}catch(e){j(e.message||"Klicks konnten nicht geladen werden")}finally{g(!1)}},[n,t,b]);(0,l.useEffect)(()=>{f()},[f]);const y=null===i||void 0===i?void 0:i.summary,k=((null===i||void 0===i?void 0:i.items)||[]).filter(e=>h||!e.scanner),N=Object.entries((null===y||void 0===y?void 0:y.by_label)||{});return(0,o.jsxs)("div",{className:"mail-clicks",children:[(0,o.jsxs)("div",{className:"mail-clicks__controls",children:[!_&&(0,o.jsx)("select",{id:"mail-clicks-campaign","aria-label":"Kampagne",className:"mail-clicks__select",value:b||(null===i||void 0===i?void 0:i.campaign)||"",onChange:e=>u(e.target.value),disabled:!(null!==i&&void 0!==i&&null!==(s=i.campaigns)&&void 0!==s&&s.length),children:((null===i||void 0===i?void 0:i.campaigns)||[]).map(e=>(0,o.jsx)("option",{value:e.campaign,children:e.campaign},e.campaign))}),(0,o.jsxs)("label",{className:"mail-clicks__toggle",htmlFor:"mail-clicks-scanner",children:[(0,o.jsx)("input",{id:"mail-clicks-scanner",type:"checkbox",checked:h,onChange:e=>m(e.target.checked)}),"Scanner-Klicks anzeigen"]}),(0,o.jsxs)("button",{type:"button",className:"section-button",onClick:f,disabled:p,children:[(0,o.jsx)(x.DIg,{})," Neu laden"]})]}),y&&(0,o.jsxs)("p",{className:"mail-clicks__summary",children:[(0,o.jsx)("strong",{children:y.clicks})," ",1===y.clicks?"Klick":"Klicks"," von"," ",(0,o.jsx)("strong",{children:y.accounts})," ",1===y.accounts?"Lehrkraft":"Lehrkr\xe4ften",N.length>0&&" \xb7 ".concat(N.map(e=>{let[s,n]=e;return"".concat(Rs(s)," ").concat(n)}).join(", ")),y.scanner_clicks>0&&" \xb7 ".concat(y.scanner_clicks," Scanner-Klicks nicht mitgez\xe4hlt")]}),v&&(0,o.jsx)("p",{className:"mail-clicks__error",children:v}),p&&!i&&(0,o.jsx)("p",{className:"mail-clicks__hint",children:"Lade Klicks\u2026"}
1),!p&&!v&&i&&0===k.length&&(0,o.jsx)("p",{className:"mail-clicks__hint",children:"Noch keine Klicks."}),k.length>0&&(0,o.jsx)("div",{className:"mail-clicks__table-wrap",children:(0,o.jsxs)("table",{className:"mail-clicks__table",children:[(0,o.jsx)("thead",{children:(0,o.jsxs)("tr",{children:[(0,o.jsx)("th",{children:"Zeitpunkt"}),(0,o.jsx)("th",{children:"Lehrkraft"}),(0,o.jsx)("th",{children:"Link"}),(0,o.jsx)("th",{children:"Ger\xe4t"})]})}),(0,o.jsx)("tbody",{children:k.map(e=>(0,o.jsxs)("tr",{className:e.scanner?"mail-clicks__row--scanner":void 0,children:[(0,o.jsx)("td",{className:"nowrap",children:Hs(e.clicked_at)}),(0,o.jsx)("td",{children:(0,o.jsxs)("div",{className:"mail-clicks__sender",children:[(0,o.jsx)("span",{className:"mail-clicks__name",children:e.user_name||"Unbekannt"}),(0,o.jsxs)("span",{className:"mail-clicks__meta",children:[Fs[e.role]||e.role||"\u2014",e.school_name?" \xb7 ".concat(e.school_name):"",Ps[e.license_type]?" \xb7 ".concat(Ps[e.license_type]):""]}),e.user_email&&(0,o.jsx)("a",{className:"mail-clicks__mail",href:"mailto:".concat(e.user_email),children:e.user_email})]})}),(0,o.jsxs)("td",{children:[(0,o.jsx)("span",{className:"mail-clicks__chip",children:Rs(e.label)}),(0,o.jsx)("div",{className:"mail-clicks__path",title:e.target,children:Os(e.target)})]}),(0,o.jsxs)("td",{className:"nowrap",children:[(0,o.jsx)("span",{title:e.user_agent||"",children:Ws(e.user_agent||"")}),e.scanner&&(0,o.jsx)("span",{className:"mail-clicks__chip mail-clicks__chip--scanner",children:"Scanner"})]})]},e.id))})]})})]})},Vs={newsletter:"Welle 1 \xb7 Newsletter",nutzungshilfe:"Welle 2 \xb7 Nutzungshilfe"},Is={stamm:"Stamm",gelegentlich:"Gelegentlich",versandet:"Eingeschlafen",nie:"Nie gestartet",neu:"Neu"},Gs={voll:"Volllizenz",test:"Testlizenz",ohne:"Ohne Lizenz"},Qs={klasse:"Klasse angelegt",blatt:"Blatt erstellt",team:"Kollegium dazugeholt",ler
1nende:"Klasse rechnet"},qs={"schuljahresstart-2026":{label:"Brevo-Mail M\xe4rz",clicked:[2,88],unsubscribed:[3,88]}},Us=[{key:"clicked",label:"Geklickt",tone:"good"},{key:"feedback",label:"Feedback",tone:"good"},{key:"unsubscribed",label:"Abgemeldet",tone:"bad"},{key:"active",label:"Aktiv seit Versand",tone:"good"}],Ys=[{key:"all",label:"Alle Reaktionen",test:()=>!0},{key:"clicked",label:"Mit Klick",test:e=>e.clicks.length>0},{key:"active",label:"Danach aktiv",test:e=>Object.keys(e.activity).length>0},{key:"feedback",label:"Mit Feedback",test:e=>Boolean(e.feedback)}],Js=e=>(null!==e&&void 0!==e?e:0).toLocaleString("de-DE"),Xs=(e,s)=>{if(!s)return"\u2013";const n=e/s;return"".concat((100*n).toLocaleString("de-DE",{maximumFractionDigits:n<.1?1:0})," %")},$s=e=>e?new Date(e).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit"}):"\u2013",en=(e,s)=>{const n=Math.max(0,Math.round((new Date(s)-new Date(e))/6e4));if(n<60)return"+".concat(n," Min");const t=Math.round(n/60);return t<48?"+".concat(t," Std"):"+".concat(Math.round(t/24)," T")},sn=e=>{let{label:s,value:n,detail:t,reference:a,tone:l}=e;return(0,o.jsxs)("div",{className:"mail-campaign__kpi".concat(l?" mail-campaign__kpi--".concat(l):""),children:[(0,o.jsx)("span",{className:"mail-campaign__kpi-label",children:s}),(0,o.jsx)("span",{className:"mail-campaign__kpi-value",children:n}),t&&(0,o.jsx)("span",{className:"mail-campaign__kpi-detail",children:t}),a&&(0,o.jsx)("span",{className:"mail-campaign__kpi-reference",children:a})]})},nn=e=>{let{wave:s,reference:n}=e;const{summary:t}=s,l=t.windows||[];return(0,o.jsxs)("div",{className:"mail-campaign__kpis",children:[(0,o.jsx)(sn,{label:"Verschickt",value:Js(t.sent),detail:"am ".concat($s(s.sent_at))}),(0,o.jsx)(sn,{label:"Geklickt",value:Js(t.clicked),detail:Xs(t.clicked,t.sent),reference:n&&"".concat(n.label,": ").concat(Xs(...n.clicked))}),(0,o.jsx)(sn,{label:"Feedback",value:Js(t.feedback),detail:Xs(t.feedback,t.sent)}),(0,o.jsx)(sn,{label:"Abgemeldet",value:Js(t.unsubscribed),detail:Xs(t.unsubscribed,t.sent),reference:n&&"".concat(n.label,": ").concat(Xs(...n.unsubscribed)),tone:t.unsubscribed>0?"bad":void 0}),(0,o.jsx)(sn,{label:"Aktiv seit Versand",value:Js(t.active),detail:Xs(t.active,t.sent),tone:"good"}),l.map(e=>(0,o.jsx)(sn,(0,a.A)({label:"Aktiv nach ".concat(e.days," Tagen")},((e,s)=>{if(!e.observable)return{value:"offen",detail:"ab ".concat((n=e.complete_at,n?new Date(n).toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit"}):"\u2013"))};var n;const t=e.observable<s?" von ".concat(Js(e.observable)):"";return{value:Js(e.active),detail:"".concat(Xs(e.active,e.observable)).concat(t)}})(e,t.sent)),e.days))]})},tn=e=>{let{rows:s,labels:n,total:t}=e;const a=(e,s)=>e.sent?e[s]/e.sent:0,l=Object.fromEntries(Us.map(e=>[e.key,Math.max(0,...s.map(s=>a(s,e.key)))])),i=(e,s,n)=>(0,o.jsxs)("td",{className:"num mail-campaign__heat mail-campaign__heat--".concat(s.tone).concat(e.sent<10?" mail-campaign__heat--few":""),style:n?{"--heat":(l[s.key]?a(e,s.key)/l[s.key]:0).toFixed(2)}:void 0,children:[Js(e[s.key]),e[s.key]>0&&(0,o.jsxs)("span",{className:"mail-campaign__rate",children:[" \xb7 ",Xs(e[s.key],e.sent)]})]},s.key);return(0,o.jsx)("div",{className:"mail-campaign__table-wrap",children:(0,o.jsxs)("table",{className:"mail-campaign__table mail-campaign__groups",children:[(0,o.jsx)("thead",{children:(0,o.jsxs)("tr",{children:[(0,o.jsx)("th",{children:"Gruppe"}),(0,o.jsx)("th",{className:"num",children:"Empf\xe4nger"}),Us.map(e=>(0,o.jsx)("th",{className:"num",children:e.label},e.key))]})}),(0,o.jsx)("tbody",{children:s.map(e=>{var s;return(0,o.jsxs)("tr",{children:[(0,o.jsx)("td",{children:n[e.key]||e.key||"Ohne Angabe"}),(0,o.jsx)("td",{className:"num",children:Js(e.sent)}),Us.map(s=>i(e,s,!0))]},null!==(s=e.key)&&void 0!==s?s:"none")})}),(0,o.jsx)("tfoot",{children:(0,o.jsxs)("tr",{children:[(0,o.jsx)("td",{children:"Alle"}),(0,o.jsx)("td",{className:"num",children:Js(t.sent)}),Us.map(e=>i(t,e,!1))]})})]})})},an=e=>{let{teacher:s}=e;const n=Object.entries(s.activity),t=[Is[s.segment]||s.segment,s.school_name,Gs[s.license_status]].filter(
1Boolean).join(" \xb7 ");return(0,o.jsxs)("tr",{children:[(0,o.jsx)("td",{children:(0,o.jsxs)("div",{className:"mail-campaign__person",children:[(0,o.jsx)("span",{className:"mail-campaign__name",children:s.user_name||"Unbekannt"}),t&&(0,o.jsx)("span",{className:"mail-campaign__meta",children:t}),s.user_email&&(0,o.jsx)("a",{className:"mail-campaign__mail",href:"mailto:".concat(s.user_email),children:s.user_email})]})}),(0,o.jsx)("td",{className:"nowrap",children:$s(s.sent_at)}),(0,o.jsx)("td",{children:(0,o.jsxs)("div",{className:"mail-campaign__chips",children:[0===s.clicks.length&&(0,o.jsx)("span",{className:"mail-campaign__none",children:"\u2013"}),s.clicks.map(e=>(0,o.jsxs)("span",{className:"mail-campaign__chip",children:[Rs(e.label)," ",(0,o.jsx)("small",{children:en(s.sent_at,e.clicked_at)})]},"".concat(e.label,"-").concat(e.clicked_at)))]})}),(0,o.jsx)("td",{children:s.feedback?(0,o.jsxs)("div",{className:"mail-campaign__feedback",children:[(0,o.jsx)("span",{children:s.feedback.answer||"Ohne Auswahl"}),s.feedback.interview&&(0,o.jsx)("span",{className:"mail-campaign__chip mail-campaign__chip--talk",children:"Gespr\xe4ch gew\xfcnscht"}),s.feedback.message&&(0,o.jsx)("q",{children:s.feedback.message})]}):(0,o.jsx)("span",{className:"mail-campaign__none",children:"\u2013"})}),(0,o.jsx)("td",{children:(0,o.jsxs)("div",{className:"mail-campaign__chips",children:[0===n.length&&!s.unsubscribed_at&&(0,o.jsx)("span",{className:"mail-campaign__none",children:"\u2013"}),n.map(e=>{let[n,t]=e;return(0,o.jsxs)("span",{className:"mail-campaign__chip mail-campaign__chip--active",children:[Qs[n]||n," ",(0,o.jsx)("small",{children:en(s.sent_at,t)})]},n)}),s.unsubscribed_at&&(0,o.jsxs)("span",{className:"mail-campaign__chip mail-campaign__chip--unsubscribed",children:["Abgemeldet ",(0,o.jsx)("small",{children:en(s.sent_at,s.unsubscribed_at)})]})]})})]})},ln=e=>{var s;let{username:n,password:t}=e;const[a,i]=(0,l.useState)(null),[r,d]=(0,l.useState)(""),[u,h]=(0,l.useState)(null),[m,p]=(0,l.useState)("segment"),[g,v]=(0,l.useState)("all"),[j,_]=(0,l.useState)(!1),[b,f]=(0,l.useState)(null),y=(0,l.useCallback)(async()=>{_(!0),f(null);try{i(await(0,c.zOq)(n,t,r||null))}catch(e){f(e.message||"Auswertung konnte nicht geladen werden")}finally{_(!1)}},[n,t,r]);(0,l.useEffect)(()=>{y()},[y]);const k=(null===a||void 0===a?void 0:a.waves)||[],N=k.find(e=>e.wave===u)||k[0],S=((null===a||void 0===a?void 0:a.teachers)||[]).filter(e=>!N||e.wave===N.wave),w=Ys.find(e=>e.key===g)||Ys[0],z=S.filter(w.test),A=qs[null===a||void 0===a?void 0:a.campaign];return(0,o.jsxs)("div",{className:"mail-campaign",children:[(0,o.jsxs)("div",{className:"mail-campaign__controls",children:[(0,o.jsx)("select",{id:"mail-campaign-campaign","aria-label":"Kampagne",className:"mail-campaign__select",value:r||(null===a||void 0===a?void 0:a.campaign)||"",onChange:e=>{d(e.target.value),h(null)},disabled:!(null!==a&&void 0!==a&&null!==(s=a.campaigns)&&void 0!==s&&s.length),children:((null===a||void 0===a?void 0:a.campaigns)||[]).map(e=>(0,o.jsx)("option",{value:e.campaign,children:e.campaign},e.campaign))}),k.length>1&&(0,o.jsx)("div",{className:"mail-campaign__switch",role:"group","aria-label":"Welle",children:k.map(e=>(0,o.jsx)("button",{id:"mail-campaign-wave-".concat(e.wave),type:"button","aria-pressed":e.wave===(null===N||void 0===N?void 0:N.wave),onClick:()=>h(e.wave),children:Vs[e.wave]||e.wave},e.wave))}),(0,o.jsxs)("button",{type:"button",className:"section-button",onClick:y,disabled:j,children:[(0,o.jsx)(x.DIg,{})," Neu laden"]})]}),b&&(0,o.jsx)("p",{className:"mail-campaign__error",children:b}),j&&!a&&(0,o.jsx)("p",{className:"mail-campaign__hint",children:"Lade Auswertung\u2026"}),a&&a.campaign&&!N&&(0,o.jsxs)("p",{className:"mail-campaign__hint",children:["F\xfcr diese Kampagne ist keine Empf\xe4ngerliste eingetragen, deshalb gibt es keine Quoten. Eintragen mit ",(0,o.jsx)("code",{children:"scripts/schuljahresstart/sendungen_eintragen.py"}),"."]}),N&&(0,o.jsxs)(o.Fragment,{children:[1===k.length&&(0,o.jsx)("h4",{className:"mail-campaign__heading",children:Vs[N.wave]||N.wave}),(0,o.jsx)(nn,{wave:N,reference:A}),(0,o.jsxs)("div",{className:"mail-campaign__section-head",children:[(0,o.jsx)("h4",{className:"mail-campaign__heading",children:"Reaktion nach Gruppe"}),(0,o.jsxs)("div",{className:"mail-campaign__switch",role:"group","aria-label":"Gruppieren nach",children:[(0,o.jsx)("button",{id:"mail-campaign-group-segment",type:"button","aria-pressed":"segment"===m,onClick:()=>p("segment"),children:"Segment"}),(0,o.jsx)("button",{id:"mail-campaign-group-license",type:"button","aria-pressed":"license"===m,onClick:()=>p("license"),children:"Lizenz"})]})]}),(0,o.jsx)(tn,{rows:"segment"===m?N.by_segment:N.by_license,labels:"segment"===m?Is:Gs,total:N.summary}),(0,o.jsxs)("p",{className:"mail-campaign__hint",children:["Je kr\xe4ftiger die Farbe, desto h\xf6her die Quote im Vergleich zu den anderen Gruppen. Blasse Zeilen haben weniger als ",10," Empf\xe4nger."]}),(0,o.jsxs)("div",{className:"mail-campaign__section-head",children:[(0,o.jsx)("h4",{className:"mail-campaign__heading",children:"Wer reagiert hat"}),(0,o.jsx)("div",{className:"mail-campaign__switch",role:"group","aria-label":"Filter",children:Ys.map(e=>(0,o.jsxs)("button",{id:"mail-campaign-filter-".concat(e.key),type:"button","aria-pressed":e.key===w.key,onClick:()=>v(e.key),children:[e.label," ",(0,o.jsx)("span",{className:"mail-campaign__count",children:S.filter(e.test).length})]},e.key))})]}),0===z.length?(0,o.jsx)("p",{className:"mail-campaign__hint",children:"Noch niemand in dieser Auswahl."}):(0,o.jsx)("div",{className:"mail-campaign__table-wrap",children:(0,o.jsxs)("table",{className:"mail-campaign__table mail-campaign__reactions",children:[(0,o.jsx)("thead",{children:(0,o.jsxs)("tr",{children:[(0,o.jsx)("th",{children:"Lehrkraft"}),(0,o.jsx)("th",{children:"Mail"}),(0,o.jsx)("th",{children:"Klick"}),(0,o.jsx)("th",{children:"Feedback"}),(0,o.jsx)("th",{children:"Danach"})]})}),(0,o.jsx)("tbody",{children:z.map(e=>(0,o.jsx)(an,{teacher:e},"".concat(e.user_id,"-").concat(e.wave)))})]})})]}),(null===a||void 0===a?void 0:a.campaign)&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("h4",{className:"mail-campaign__heading",children:"Einzelne Klicks"}),(0,o.jsx)(Zs,{username:n,password:t,campaign:a.campaign})]})]})};var rn=n(847),cn=n.n(rn);const on={grundschulen:"#16847a",mittelschulen:"#bc7b19",realschulen:"#4272ba",gymnasien:"#43835a",foerderzentren:"#8058b1",wirtschaftsschulen:"#bd6344","fos-bos":"#315f86",sekundarschulen:"#86713e",berufsschulen:"#98647a",weitere:"#8793a2"},dn={state:"#47815b",municipal:"#4474b8",public:"#47815b",private:"#bf7b23",unknown:"#8793a2"},un=e=>{var s,n,t;return e.ownership||(null!==(s=e.legal_status)&&void 0!==s&&s.includes("Privatschule")?"private":null!==(n=e.legal_status)&&void 0!==n&&n.includes("staatlich")?"state":null!==(t=e.legal_status)&&void 0!==t&&t.includes("kommunal")?"municipal":"unknown")},hn=(e,s)=>{if(!e.length)return s;let n=1/0,t=1/0,a=-1/0,l=-1/0;
1e.forEach(e=>{n=Math.min(n,e[0]),t=Math.min(t,e[1]),a=Math.max(a,e[0]),l=Math.max(l,e[1])});const i=Math.max(2,a-n),r=Math.max(2,l-t),c=.08*Math.max(i,r);return{x:(n+a-i)/2-c,y:(t+l-r)/2-c,width:i+2*c,height:r+2*c}};function mn(e){let{schools:s,selectedId:n,onSelect:t,groups:i,defaultOpen:r=!1}=e;const[c,d]=(0,l.useState)(!1),[u,h]=(0,l.useState)(null),[m,p]=(0,l.useState)(""),[g,x]=(0,l.useState)(null),[v,j]=(0,l.useState)("type"),[_,b]=(0,l.useState)("individual"),[f,y]=(0,l.useState)(""),[k,N]=(0,l.useState)({width:0,height:0}),S=(0,l.useRef)(null),w=(0,l.useRef)(null),z=(0,l.useRef)(!1),[A,C]=(0,l.useState)(null),[D,L]=(0,l.useState)(0),E=(0,l.useRef)(null);(0,l.useEffect)(()=>{if(!c||u)return;const e=new AbortController;return fetch("".concat("","/data/dach-map.json"),{signal:e.signal}).then(e=>{if(!e.ok)throw new Error("HTTP ".concat(e.status));return e.json()}).then(e=>{h(e),p("")}).catch(e=>{"AbortError"!==e.name&&p(e.message)}),()=>e.abort()},[c,u]),(0,l.useEffect)(()=>{C(null),L(0)},[s]);const M=(0,l.useMemo)(()=>u?{x:u.bounds.min_x-12,y:u.bounds.min_y-12,width:u.bounds.max_x-u.bounds.min_x+24,height:u.bounds.max_y-u.bounds.min_y+24}:null,[u]),T=g||M,K=(0,l.useMemo)(()=>(null===u||void 0===u?void 0:u.regions.map(e=>(0,a.A)((0,a.A)({},e),{},{d:e.paths.map(e=>e.map((e,s)=>{let[n,t]=e;return"".concat(s?"L":"M").concat(n,",").concat(t)}).join(" ")+" Z").join(" ")})))||[],[u]),B=(0,l.useMemo)(()=>c&&T&&"clusters"===_?(0,oe.oO)(s,T):[],[s,c,T,_]),F=(0,l.useMemo)(()=>s.find(e=>e.id===n),[s,n]),P=(0,l.useMemo)(()=>s.filter(e=>e.map_point).length,[s]),R=(0,l.useMemo)(()=>s.filter(e=>"postal"===e.point_accuracy).length,[s]),H=T?T.width/850:1,O=(0,l.useMemo)(()=>T?s.filter(e=>{const s=e.map_point;return s&&s[0]>=T.x&&s[0]<=T.x+T.width&&s[1]>=T.y&&s[1]<=T.y+T.height}):[],[s,T]);(0,l.useEffect)(()=>{if(!c||!T||!S.current)return;const e=new ResizeObserver(e=>{const{width:s,height:n}=e[0].contentRect;N({width:s,height:n})});return e.observe(S.current),()=>e.disconnect()},[c,u]),(0,l.useEffect)(()=>{const e=w.current,s=S.current;if(!e||!s||!k.width||"individual"!==_)return;const n=e.getContext("2d");if(!n)return;const t=window.devicePixelRatio||1;e.width=Math.round(k.width*t),e.height=Math.round(k.height*t),n.setTransform(t,0,0,t,0,0);const a=s.getScreenCTM(),l=s.getBoundingClientRect();if(a&&(O.forEach(e=>{const[s,t]=e.map_point,i=a.a*s+a.e-l.left,r=a.d*t+a.f-l.top;n.beginPath(),n.arc(i,r,4,0,2*Math.PI),n.fillStyle="type"===v?on[e.groups[0]]||on.weitere:dn[un(e)],n.fill()}),null!==F&&void 0!==F&&F.map_point)){const[e,s]=F.map_point;n.beginPath(),n.arc(a.a*e+a.e-l.left,a.d*s+a.f-l.top,7,0,2*Math.PI),n.strokeStyle="#e24e3f",n.lineWidth=2,n.stroke()}},[O,F,v,k,_]);const W=e=>{if(!T)return;const s=Math.max(1,Math.min(1.5*M.width,T.width*e)),n=s/T.width*T.height;x({x:T.x+(T.width-s)/2,y:T.y+(T.height-n)/2,width:s,height:n}),C(null)},Z=e=>{if(1===e.schools.length)return t(e.schools[0]),void C(null);const s=hn(e.schools.map(e=>e.map_point),T);s.width>=.85*T.width||T.width<5?(C(e.schools),L(0)):(x(s),C(null))};return(0,l.useEffect)(()=>{const e=S.current;if(!e||!T)return;const s=s=>{s.preventDefault();const n=e.getScreenCTM();if(!n)return;const t=Math.exp(.006*Math.max(-150,Math.min(150,s.deltaY))),a=Math.max(1,Math.min(1.5*M.width,T.width*t)),l=a/T.width,i=(s.clientX-n.e)/n.a,r=(s.clientY-n.f)/n.d;x({x:i-(i-T.x)*l,y:r-(r-T.y)*l,width:a,height:T.height*l}),C(null)};return e.addEventListener("wheel",s,{passive:!1}),()=>e.removeEventListener("wheel",s)},[T,c,M]),(0,o.jsxs)("details",{className:"outreach-directory__map-panel","aria-label":"Schulstandorte auf der DACH-Karte",open:r||void 0,onToggle:e=>d(e.currentTarget.open),children:[(0,o.jsxs)("summary",{className:"outreach-directory__map-summary",children:[(0,o.jsx)("strong",{children:"DACH-Karte"}),(0,o.jsxs)("span",{children:[P.toLocaleString("de-DE")," von ",s.length.toLocaleString("de-DE")," Schulen"]}),(0,o.jsx)("small",{children:"\xb7 Deutschland, \xd6sterreich, Schweiz"})]}),c&&(0,o.jsxs)("div",{className:"outreach-directory__map-content",children:[(0,o.jsxs)("div",{className:"outreach-directory__map-toolbar",children:[(0,o.jsxs)("select",{"aria-label":"Farbe nach",value:v,onCh
1ange:e=>j(e.target.value),children:[(0,o.jsx)("option",{value:"type",children:"Farbe: Schulart"}),(0,o.jsx)("option",{value:"ownership",children:"Farbe: Tr\xe4gerschaft"})]}),(0,o.jsxs)("select",{"aria-label":"Darstellung",value:_,onChange:e=>{b(e.target.value),C(null)},children:[(0,o.jsx)("option",{value:"individual",children:"Einzelne Schulen"}),(0,o.jsx)("option",{value:"clusters",children:"Gruppen\xfcbersicht"})]})]}),(0,o.jsxs)("div",{className:"outreach-directory__map-tools","aria-label":"Kartensteuerung",children:[(0,o.jsx)("button",{type:"button",onClick:()=>{x(null),C(null)},children:"DACH gesamt"}),(0,o.jsx)("button",{type:"button",onClick:()=>{x(hn(s.map(e=>e.map_point).filter(Boolean),M)),C(null)},children:"Auswahl einpassen"}),(0,o.jsxs)("button",{type:"button",disabled:!O.length,onClick:()=>{C(O),L(0)},children:["Schulen im Ausschnitt (",O.length.toLocaleString("de-DE"),")"]})]}),m&&(0,o.jsxs)("p",{role:"alert",children:["Kartendaten konnten nicht geladen werden: ",m]}),!u&&!m&&(0,o.jsx)("p",{children:"Kartendaten werden geladen \u2026"}),T&&(0,o.jsxs)("div",{className:"outreach-directory__map-canvas",children:[(0,o.jsxs)("svg",{ref:S,viewBox:"".concat(T.x," ").concat(T.y," ").concat(T.width," ").concat(T.height),role:"group","aria-label":"DACH-Karte mit Schulstandorten",style:{touchAction:"none"},onClick:e=>{var s;if("individual"!==_||z.current)return;const n=null===(s=S.current)||void 0===s?void 0:s.getScreenCTM();if(!n)return;const a=O.map(s=>({school:s,distance:Math.hypot(n.a*s.map_point[0]+n.e-e.clientX,n.d*s.map_point[1]+n.f-e.clientY)})).filter(e=>e.distance<=8).sort((e,s)=>e.distance-s.distance);if(!a.length)return void C(null);const l=a.filter(e=>e.distance<=a[0].distance+1).map(e=>e.school);1===l.length?t(l[0]):(C(l),L(0))},onPointerDown:e=>{if(z.current=!1,e.target.closest("[data-school-cluster]"))return;const s=e.currentTarget.getScreenCTM();s&&(E.current={clientX:e.clientX,clientY:e.clientY,current:T,scaleX:s.a,scaleY:s.d},e.currentTarget.setPointerCapture(e.pointerId))},onPointerLeave:()=>y(""),onPointerMove:e=>{if(E.current){const s=E.current;if(Math.hypot(e.clientX-s.clientX,e.clientY-s.clientY)<3)return;z.current=!0,x((0,a.A)((0,a.A)({},s.current),{},{x:s.current.x-(e.clientX-s.clientX)/s.scaleX,y:s.current.y-(e.clientY-s.clientY)/s.scaleY}))}else if("individual"===_){const s=e.currentTarget.getScreenCTM();if(!s)return;let n=null,t=8;O.forEach(a=>{const l=Math.hypot(s.a*a.map_point[0]+s.e-e.clientX,s.d*a.map_point[1]+s.f-e.clientY);l<t&&(n=a,t=l)}),y(n?"".concat(n.name," \xb7 ").concat(n.city):"")}},onPointerUp:()=>{E.current=null},onPointerCancel:()=>{E.current=null},children:[K.map(e=>(0,o.jsx)("path",{d:e.d,className:"outreach-directory__map-district",style:{strokeWidth:.8*H,fill:"DE"===e.country?"#e8edf4":"#f1f4f9"},children:(0,o.jsx)("title",{children:e.name})},"".concat(e.country,"-").concat(e.name))),"clusters"===_&&B.map(e=>{const s=e.schools[0],n=e.schools.length,t="type"===v?on[s.groups[0]]||on.weitere:dn[un(s)];return(0,o.jsxs)("g",{"data-school-cluster":"true",role:"button",tabIndex:0,"aria-label":n>1?"".concat(n," Schulen \u2013 vergr\xf6\xdfern"):"".concat(s.name,", ").concat(s.city),onClick:()=>Z(e),onKeyDown:s=>{"Enter"!==s.key&&" "!==s.key||(s.preventDefault(),Z(e))},children:[(0,o.jsx)("circle",{cx:e.x,cy:e.y,r:H*(n>1?10:4),fill:n>1?"#315f86":t,stroke:"#fff",strokeWidth:.8*H,style:{cursor:"pointer"}}),n>1&&(0,o.jsx)("text",{x:e.x,y:e.y,dy:".35em",textAnchor:"middle",fill:"#fff",fontSize:8*H,style:{pointerEvents:"none"},children:n}),(0,o.jsx)("title",{children:n>1?"".concat(n," Schulen; anklicken zum Vergr\xf6\xdfern"):"".concat(s.name," \xb7 ").concat(s.city).concat("postal"===s.point_accuracy?" \xb7 PLZ-Mittelpunkt":"")})]},e.key)}),"clusters"===_&&(null===F||void 0===F?void 0:F.map_point)&&(0,o.jsx)("circle",{cx:F.map_point[0],cy:F.map_point[1],r:7*H,fill:"none",stroke:"#e24e3f",strokeWidth:2*H,pointerEvents:"none"})]}),"individual"===_&&(0,o.jsx)("canvas",{ref:w,className:"outreach-directory__map-points","aria-hidden":"true",style:{width:k.width,height:k.height}}),(0,o.jsxs)("div",{className:"outreach-directory__map-zoom","aria-label":"Kartenzoom",children:[(0,o.jsx)("button",{type:"button","aria-label":"Karte vergr\xf6\xdfern",title:"Vergr\xf6\xdfern",onClick:()=>W(.5),children:"+"}),(0,o.jsx)("button",{type:"button","aria-label":"Karte verkleinern",title:"Verkleinern",onClick:()=>W(2),children:"\u2212"})]}),f&&(0,o.jsx)("div",{className:"outreach-directory__map-hover",children:f})]}),(0,o.jsx)("p",{className:"outreach-directory__map-hint",children:"Mausrad: zoomen \xb7 Ziehen: verschieben \xb7 Punkt: Schulprofil"}),A&&(0,o.jsxs)("div",{className:"outreach-directory__map-stack",children:[(0,o.jsxs)("strong",{children:[A.length," Schulen zur Auswahl"]}),A.slice(10*D,10*(D+1)).map(e=>(0,o.jsxs)("button",{type:"button",onClick:()=>t(e),children:[e.name," \xb7 ",e.city]},e.id)),(0,o.jsxs)("div",{children:[(0,o.jsx)("button",{type:"button",disabled:!D,onClick:()=>L(D-1),children:"Zur\xfcck"})," ",(0,o.jsx)("button",{type:"button",disabled:10*(D+1)>=A.length,onClick:()=>L(D+1),children:"Weiter"})," ",(0,o.jsx)("button",{type:"button",onClick:()=>C(null),children:"Schlie\xdfen"})]})]}),(0,o.jsx)("div",{className:"outreach-directory__map-legend",children:"type"===v?Object.entries(i).map(e=>{let[s,n]=e;return(0,o.jsxs)("span",{children:[(0,o.jsx)("i",{style:{background:on[s]||on.weitere}}),n]},s)}):[["public","\xd6ffentlich"],["municipal","Kommunal"],["private","Privat"],["unknown","Unbekannt"]].map(e=>{let[s,n]=e;return(0,o.jsxs)("span",{children:[(0,o.jsx)("i",{style:{background:dn[s]}}),n]},s)})}),(0,o.jsx)("div",{className:"outreach-directory__map-footer",children:(0,o.jsxs)("small",{children:[R.toLocaleStr
1ing("de-DE")," Standorte nur als PLZ-Mittelpunkt \xb7 ",(s.length-P).toLocaleString("de-DE")," ohne Kartenpunkt. Gruppen k\xf6nnen mehrere Schularten enthalten.",(0,o.jsx)("br",{}),"Grenzen: Natural Earth (gemeinfrei) \xb7 PLZ: GeoNames (CC BY 4.0) \xb7 genaue Standorte: jeweilige amtliche Quelle in den Schuldetails."]})})]})]})}const pn={target:"_blank",rel:"noopener noreferrer"},gn=e=>e.value.toLocaleString("de-DE",{style:"currency",currency:e.unit,maximumFractionDigits:0}),xn=e=>e.map(e=>({traegergruppe:e.name,rechtliche_struktur:e.legal_entity,laender:e.countries.join("; "),groesse_laut_quelle:e.scale_note,eintraege_im_verzeichnis:e.directory_count,finanzlage_evidenz:e.finance_label,finanzlage_hinweis:e.finance_note,finanzkennzahlen:e.financials.map(e=>"".concat(e.label,": ").concat(e.value," ").concat(e.unit,"; ").concat(e.year,"; ").concat(e.scope,"; ").concat(e.source_url)).join(" | "),kontakt_funktion:e.contact.label,email:e.contact.email||"",telefon:e.contact.phone||"",pilot_ansatz:e.pilot_idea,geprueft_am:e.reviewed_at,quellen:e.sources.map(e=>e.url).join("; ")}));function vn(e){let{contact:s}=e;return(0,o.jsxs)("p",{className:"outreach-directory__operator-contact",children:[(0,o.jsx)("strong",{children:s.label}),(0,o.jsx)("br",{}),s.email&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("a",{href:"mailto:".concat(s.email),children:s.email}),(0,o.jsx)("br",{})]}),s.phone&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("a",{href:"tel:".concat(s.phone.replace(/[^+\d]/g,"")),children:s.phone}),(0,o.jsx)("br",{})]}),(0,o.jsx)("a",(0,a.A)((0,a.A)({href:s.url},pn),{},{children:"Kontaktquelle \u2197"}))]})}function jn(e){let{catalog:s,error:n,activeId:t,onChoose:i,onRetry:r,busy:c}=e;const[d,u]=(0,l.useState)(""),[h,m]=(0,l.useState)(""),[p,g]=(0,l.useState)(""),x=(0,l.useMemo)(()=>((null===s||void 0===s?void 0:s.operators)||[]).filter(e=>(!p||e.countries.includes(p))&&(!h||e.finance_status===h)&&(!d||"".concat(e.name," ").concat(e.kind," ").concat(e.legal_entity).toLocaleLowerCase("de-DE").includes(d.toLocaleLowerCase("de-DE")))),[s,d,h,p]);return(0,o.jsxs)("details",{className:"outreach-directory__operators",children:[(0,o.jsxs)("summary",{children:[(0,o.jsx)("strong",{children:"Private Tr\xe4ger und Schulverb\xfcnde"}),(0,o.jsx)("span",{children:s?"".concat(s.operators.length," recherchierte Gruppen \xb7 zentrale Kontakte und Finanzlage"):"Tr\xe4gerdaten werden geladen \u2026"})]}),(0,o.jsxs)("div",{className:"outreach-directory__operators-content",children:[(0,o.jsx)("p",{children:"Ein zentraler Pilot kann mehrere Schulen erreichen. Die Finanzlage zeigt belegte Kennzahlen oder Finanzierungsstrukturen; Umsatz und Konzernverm\xf6gen sind kein verf\xfcgbares Schulbudget. Die Pilotans\xe4tze sind unsere Einsch\xe4tzung."}),n&&(0,o.jsxs)("p",{role:"alert",children:[n," ",(0,o.jsx)("button",{type:"button",onClick:r,children:"Erneut laden"})]}),s&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{className:"outreach-directory__operator-controls",children:[(0,o.jsxs)("label",{children:["Tr\xe4ger suchen",(0,o.jsx)("input",{type:"search",value:d,onChange:e=>u(e.target.value),placeholder:"Phorms, CJD, \u2026"})]}),(0,o.jsxs)("label",{children:["Tr\xe4gerland",(0,o.jsxs)("select",{value:p,onChange:e=>g(e.target.value),children:[(0,o.jsx)("option",{value:"",children:"Alle"}),(0,o.jsx)("option",{value:"DE",children:"Deutschland"}),(0,o.jsx)("option",{value:"AT",children:"\xd6sterreich"}),(0,o.jsx)("option",{value:"CH",children:"Schweiz"})]})]}),(0,o.jsxs)("label",{children:["Finanzlage: Belegart",(0,o.jsxs)("select",{value:h,onChange:e=>m(e.target.value),children:[(0,o.jsx)("option",{value:"",children:"Alle"}),(0,o.jsx)("option",{value:"metrics",children:"Aktuelle Konzernkennzahlen"}),(0,o.jsx)("option",{value:"group_backing",children:"Konzernanbindung"}),(0,o.jsx)("option",{value:"funding_rule",children:"Finanzierungsregel in Satzung"}),(0,o.jsx)("option",{value:"unknown",children:"Finanzkennzahlen noch offen"})]})]}),(0,o.jsx)("button",{type:"button",onClick:()=>{const e=new Blob(["\ufeff",cn().unparse(xn(x),{delimiter:";",escapeFormulae:!0})],{type:"text/csv;charset=utf-8;"}),n=URL.createObjectURL(e),t=document.createElement("a");t.href=n,t.download="private-schultraeger-".concat(s.reviewed_at,".csv"),t.click(),URL.revokeObjectURL(n)},disabled:!x.length,children:"Tr\xe4gerauswahl als CSV"})]}),(0,o.jsxs)("small",{children:["Die \xdcbersicht gilt f\xfcr den gesamten recherchierten Tr\xe4gerbestand, unabh\xe4ngig von der Schulauswahl. Quellenpr\xfcfung: ",s.reviewed_at,"."]}),(0,o.jsx)("div",{className:"outreach-directory__operator-grid",children:x.map(e=>(0,o.jsxs)("article",{className:"outreach-directory__operator-card".concat(t===e.id?" active":""),children:[(0,o.jsxs)("header",{children:[(0,o.jsxs)("small",{children:[e.kind," \xb7 ",e.countries.join(" / ")]}),(0,o.jsx)("h4",{children:e.name}),(0,o.jsx)("p",{children:e.legal_entity})]}),(0,o.jsx)("p",{children:e.scale_note}),(0,o.jsxs)("section",{"aria-label":"Finanzlage ".concat(e.name),children:[(0,o.jsx)("h5",{children:e.finance_label}),e.financials.length>0&&(0,o.jsx)("dl",{children:e.financials.map(e=>(0,o.jsxs)("div",{children:[(0,o.jsx)("dt",{children:e.label}),(0,o.jsxs)("dd",{children:[(0,o.jsx)("strong",{children:gn(e)}),(0,o.jsx)("br",{}),(0,o.jsxs)("small",{children:[e.year," \xb7 ",e.scope,e.note&&" \xb7 ".concat(e.note)]})," ",(0,o.jsx)("a",(0,a.A)((0,a.A)({href:e.source_url},pn),{},{children:"Quelle \u2197"}))]})]},e.label))}),(0,o.jsx)("p",{children:e.finance_note})]}),(0,o.jsxs)("section",{children:[(0,o.jsx)("h5",{children:"Ansatz f\xfcr den Tr\xe4ger-Pilot"}),(0,o.jsx)("p",{children:e.entry_reason}),(0,o.jsxs)("p",{children:[(0,o.jsx)("strong",{children:"Pilotidee:"})," ",e.pilot_idea]})]}),(0,o.jsx)(vn,{contact:e.contact}),e.additional_contact&&(0,o.jsx)(vn,{contact:e.additional_contact}),(0,o.jsxs)("button",{type:"button",disabled:c||!e.directory_count,onClick:()=>i(e.id),"aria-pressed":t===e.id,children:[e.directory_count," zugeordnete Verzeichniseintr\xe4ge anzeigen"]}),(0,o.jsxs)("details",{children:[(0,o.jsxs)("summary",{children:["Zugeordnete Schulprofile (",e.directory_count,")"]}),(0,o.jsx)("ul",{children:e.schools.map(e=>(0,o.jsxs)("li",{children:[(0,o.jsx)("strong",{children:e.name}),(0,o.jsx)("br",{}),(0,o.jsxs)("small",{children:[e.city," \xb7 ",e.region_name]}),e.website&&(0,o.jsxs)(o.Fragment,{children:[" \xb7 ",(0,o.jsx)("a",(0,a.A)((0,a.A)({href:e.website},pn),{},{children:"Schulwebsite \u2197"}))]})]},e.id))})]}),e.campuses.length>0&&(0,o.jsxs)("details",{children:[(0,o.jsx)("summary",{children:"Weitere Standort\xfcbersicht des Tr\xe4gers"}),(0,o.jsx)("ul",{children:e.campuses.map((e,s)=>(0,o.jsxs)("li",{children:[(0,o.jsx)("a",(0,a.A)((0,a.A)({href:e.url},pn),{},{children:e.name}))," \xb7 ",e.city,", ",e.country]},s))})]}),(0,o.jsxs)("small",{children:[e.campus_note," Gruppenmitgliedschaft ersetzt keine Pr\xfcfung des rechtlichen Vertragspartners."]}),(0,o.jsx)("footer",{children:e.sources.map(e=>(0,o.jsxs)("a",(0,a.A)((0,a.A)({href:e.url},pn),{},{children:[e.label," \u2197"]}),e.url))})]},e.id))}),!x.length&&(0,o.jsx)("p",{children:"Keine Tr\xe4gergruppe f\xfcr diese Filter."})]})]})]})}var _n=n(6568);
1const bn="https://www.kmk.org/en/bildungsministerkonferenz/vertiefende-bildungsinhalte/bildungswege-und-schulabschluesse/grundschule-primarbereich.html",fn="https://www.kmk.org/fileadmin/Dateien/pdf/Bildung/AllgBildung/Schema-Bildungsgaenge_und_Schularten-Stand_2021-02.pdf",yn="https://www.berlin.de/sen/bildung/schule/bildungswege/berliner-schulsystem/",kn="https://www.berlin.de/sen/bildung/schule/bildungswege/gemeinschaftsschule/",Nn="https://mbjs.brandenburg.de/bildung/allgemeinbildende-schulen.html",Sn="https://www.bildung-mv.de/schule/schularten/gymnasium/index.html",wn="https://www.bildung-mv.de/schule/schularten/schulartunabhaengige-orientierungsstufe/",zn="https://www.schleswig-holstein.de/DE/fachinhalte/S/schulsystem/gemeinschaftsschule",An="https://www.schleswig-holstein.de/DE/fachinhalte/S/schulsystem/gymnasium",Cn="https://www.km.bayern.de/lernen/ubertritt-und-bildungswege/das-bayerische-schulsystem",Dn="https://www.km.bayern.de/lernen/schularten/wirtschaftsschule",Ln="https://www.km.bayern.de/lernen/schularten/fachoberschule",En="https://www.km.bayern.de/lernen/schularten/berufsoberschule",Mn="https://www.mk.niedersachsen.de/startseite/schule/unsere_schulen/allgemein_bildende_schulen/gymnasium/gymnasium-6319.html",Tn="https://www.revosax.sachsen.de/vorschrift/4192.20",Kn="https://mb.sachsen-anhalt.de/themen/schulsystem/allgemeinbildende-schulen/gymnasium",Bn="https://bildung.thueringen.de/fileadmin/ministerium/publikationen/thueringer_schulgesetz.pdf",Fn="https://ifbq.hamburg.de/wp-content/uploads/sites/803/2024/03/schulstatistik-2022-23.pdf",Pn=Array.from({length:13},(e,s)=>s+1),Rn=(e,s)=>Pn.filter(n=>n>=e&&n<=s),Hn=e=>[...new Set(e)].sort((e,s)=>e-s),On=e=>Array.isArray(e)?Hn(e.filter(e=>"number"===typeof e||"string"===typeof e&&/^\d{1,2}$/.test(e)).map(Number).filter(e=>Number.isInteger(e)&&e>=1&&e<=13)):[];function Wn(e){const s=On(e),n=[];for(let t=0;t<s.length;t+=1){const e=s[t];let a=e;for(;s[t+1]===a+1;)a=s[++t];n.push(e===a?String(e):"".concat(e,"\u2013").concat(a))}return n.join(", ")}function Zn(e){const s=On(e.grade_levels);if(s.length)return{grades:s,possibleGrades:[],basis:"reported",label:"Klasse ".concat(Wn(s)),note:"Im Schulprofil erfasst.",sourceUrls:e.grade_levels_source_url?[e.grade_levels_source_url]:[]};const n=[],t=[],a=new Set,l=new Set,i=e.region||"",r=String(e.school_type||"").toLocaleLowerCase("de-DE"),c=(e,s,t)=>{n.push(...Rn(e,s)),a.add(t)},o=(e,s,n)=>{t.push(...Rn(e,s)),l.add(n),a.add(fn)},d=["DE-BE","DE-BB"].includes(i)?6:4,u=["DE-BE","DE-BB"].includes(i)?7:5,h=/f\xf6rder|foerder|sonder|kranke/.test(r),m=/abend|kolleg|zweiten bildungs|\bzbw\b/.test(r);if(i.startsWith("DE-")&&!m)if(/grundschul|grund[-, ]/.test(r)&&(c(1,d,bn),"DE-MV"===i&&/orientierungsstufe/.test(r)&&c(5,6,wn)),"DE-BY"===i&&/wirtschaftsschul/.test(r)&&(c(10,10,Dn),o(6,9,"Wirtschaftsschule: Eingangsstufe h\xe4ngt vom Bildungsgang ab."),o(11,11,"Klasse 11 nur im zweistufigen Bildungsgang.")),"DE-BY"===i&&/berufliche oberschule|fachoberschule|berufsoberschule/.test(r)){const s="BOS"===e.fos_bos_profile||/berufsoberschule/.test(r)&&!/fachoberschule/.test(r);c(s?12:11,12,s?En:Ln),o(13,13,"Klasse 13 abh\xe4ngig vom angebotenen Bildungsgang."),s&&o(11,11,"Klasse 11 nur als Vorklasse.")}else{const e=/gymnasium|gymnasien/.test(r)&&!/beruflich.{0,4}gymnasi/.test(r);if(e){c("DE-MV"===i?7:u,["DE-BY","DE-SH","DE-NI"].includes(i)?13:12,"DE-BY"===i?Cn:"DE-SH"===i?An:"DE-BE"===i?yn:"DE-BB"===i?Nn:"DE-MV"===i?Sn:"DE-NI"===i?Mn:"DE-SN"===i?Tn:"DE-ST"===i?Kn:"DE-TH"===i?Bn:"DE-HH"===i?Fn:fn),["DE-BY","DE-SH","DE-BE","DE-BB","DE-MV","DE-NI","DE-SN","DE-ST","DE-TH","DE-HH"].includes(i)||o(13,13,"G8/G9 bzw. Aufbauform im Schulprofil nicht gekl\xe4rt."),["DE-BE","DE-BB","DE-MV"].includes(i)&&o(5,6,"Klassen 5/6 nur bei besonderem bzw. grundst\xe4ndigem Bildungsgang.")}const s=/realschul|real- und|regelschul|regionale schul|mittelstufenschul|oberschul|ober- und|sekundarschul/.test(r)&&!/berufsoberschul|fachoberschul|berufliche oberschul/.test(r);s&&c(u,10,fn),/hauptschul|haupt[-, ]|mittelschul|mittel-/.test(r)&&(c(u,9,"DE-BY"===i?Cn:fn),o(10,10,"Klasse 10 abh\xe4ngig vom Bildungsgang (z. B. M-Zug)."));const n=/gemeinschaftsschul|gesamtschul|gesamt- und|stadtteilschul/.test(r);n&&(c(["DE-BE","DE-TH"].includes(i)&&/gemeinschaftsschul/.test(r)?1:u,10,"DE-SH"===i?zn:"DE-BE"===i?kn:"DE-TH"===i?Bn:fn),"DE-TH"===i&&/gemeinschaftsschul/.test(r)&&c(11,12,Bn));
1const t=/mit (?:gymnasialer )?oberstufe|mit gost|und gost/.test(r);!/oberstufe/.test(r)||n||s||e||/ohne oberstufe/.test(r)||c(11,13,fn);const a=n||"DE-BE"===i&&/integrierte sekundarschul/.test(r)||/gymnasialem angebot|beruflich.{0,4}gymnasi/.test(r);t?c(11,13,"DE-SH"===i?zn:fn):!a||/ohne oberstufe/.test(r)||"DE-TH"===i&&/gemeinschaftsschul/.test(r)||o(11,13,"Oberstufe am Standort nicht best\xe4tigt; ggf. nur \xfcber eine Partnerschule.")}h&&l.add("Jahrgangsstufen des sonderp\xe4dagogischen Angebots sind nicht pauschal zuordenbar.");const p=Hn(n),g=Hn(t).filter(e=>!p.includes(e));return p.length||g.length?{grades:p,possibleGrades:g,basis:"inferred",label:p.length?"Klasse ".concat(Wn(p)," \xb7 typisch"):"Klassenstufen abh\xe4ngig vom Bildungsgang",note:["Aus Schulart und Bundesland abgeleitet; f\xfcr diese Schule nicht best\xe4tigt.",...l].join(" "),sourceUrls:[...a]}:{grades:[],possibleGrades:[],basis:"unknown",label:"Klassenstufen offen",note:h?[...l].join(" "):"Aus der Schulart keine belastbare Jahrgangsstufenzuordnung; Bildungsgang im Profil pr\xfcfen.",sourceUrls:[]}}const Vn=e=>{var s,n;return(null===e||void 0===e||null===(s=e.bearer_finance)||void 0===s||null===(n=s.metrics)||void 0===n?void 0:n.find(e=>["by_finance_capacity_per_resident","bw_finance_capacity_per_resident","bw_county_capacity_per_resident","nrw_finance_capacity_per_resident"].includes(e.key)))||null},In=e=>{const s=Vn(e);return s&&null!=s.percentile?s.percentile<25?"low":s.percentile>=75?"high":"mid":"unknown"},Gn=e=>{var s,n;return Boolean(null===e||void 0===e||null===(s=e.bearer_finance)||void 0===s||null===(n=s.household_status)||void 0===n?void 0:n.restricted)},Qn=e=>Number(e||0).toLocaleString("de-DE"),qn=e=>Number(e||0).toLocaleString("de-DE",{style:"currency",currency:"EUR",maximumFractionDigits:0}),Un=e=>null==e.amount||""===e.amount?"Betrag offen":Number(e.amount).toLocaleString("de-DE",{style:"currency",currency:e.currency||"EUR",maximumFractionDigits:0}),Yn=e=>e?new Date(/^\d{13}$/.test(String(e))?Number(e):e).toLocaleString("de-DE",{dateStyle:"medium",timeStyle:"short"}):"\u2013",Jn=e=>null==e||""===e?"\u2013":String(e),Xn=e=>/^https?:\/\//i.test(String(e||""))?String(e):"",$n=(e,s)=>Xn(s)?"[".concat(e,"](").concat(Xn(s),")"):e,et=e=>String(null!==e&&void 0!==e?e:"").replace(/[&<>"']/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"}[e])),st=e=>{const s=e.legal_status||"";return s.includes("\xf6ffentliche Schule (staatlich)")?"state":s.includes("\xf6ffentliche Schule (kommunal)")?"municipal":s.includes("Privatschule")?"private":"unknown"},nt=e=>String(e||"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/\xdf/g,"ss").toLocaleLowerCase("de-DE").replace(/[^a-z0-9]+/g," ").trim().replace(/\s+/g," "),tt=(e,s)=>{if(!s)return null;const n=s.filter(s=>s.public_directory_id===e.id);if(1===n.length)return{school:n[0],confidence:"manual"};if(n.length>1)return{ambiguous:!0,candidates:n};const t=s.filter(e=>!e.public_directory_id),a=ot(e.official_id);if(a){const e=t.filter(e=>ot(e.official_id)===a);if(1===e.length)return{school:e[0],confidence:"official_id"};if(e.length>1)return{ambiguous:!0,candidates:e}}const l=nt(e.name);if(!l)return null;const i=t.filter(e=>nt(e.name)===l&&!(a&&e.official_id&&ot(e.official_id)!==a));return 1===i.length?{school:i[0],confidence:"name"}:i.length>1?{ambiguous:!0,candidates:i}:null},at={official_id:"eindeutig \xfcber Schulnummer",manual:"manuell zugeordnet"},lt=e=>at[e.confidence]||"Namensgleichheit; bitte pr\xfcfen",it=e=>"official_id"===(null===e||void 0===e?void 0:e.confidence)||"manual"===(null===e||void 0===e?void 0:e.confidence),rt=e=>({regular:"Regul\xe4r",test:"Testlizenz",partner:"Partner"}[e]||(e?String(e):"Keine Lizenz")),ct=e=>{if(null===e||void 0===e||!e.license_type)return"Keine Lizenz";const s=(new Date).toISOString().slice(0,10);return e.license_start_date&&String(e.license_start_date).slice(0,10)>s?"".concat(rt(e.license_type)," \xb7 startet ").concat(e.license_start_date):"test"!==e.license_type||e.license_end_date?e.license_end_date&&String(e.license_end_date).slice(0,10)<s?"".concat(rt(e.license_type)," \xb7 abgelaufen"):"".concat(rt(e.license_type)," \xb7 aktiv"):"Testlizenz \xb7 Enddatum fehlt"},ot=e=>{const s=String(e||"").trim();return/^\d+$/.test(s)?s.replace(/^0+(?=\d)/,""):s.toLocaleLowerCase("de-DE")},dt=e=>{const s=e.groups||[];return s.includes("fos-bos")?"fos-bos":s.includes("foerderzentren")?"foerderzentren":s.length>1?"combined":s[0]||"other"};function ut(e){var s,n,t,i,r,d,u,h,m,p,g,x;let{username:v,password:j}=e;const[_,b]=(0,l.useState)(null),[f,k]=(0,l.useState)(null),[N,S]=(0,l.useState)(""),[w,z]=(0,l.useState)("DE-BY"),[A,C]=(0,l.useState)(!0),[D,L]=(0,l.useState)(null),[E,M]=(0,l.useState)(""),[T,K]=(0,l.useState)(0),[B,F]=(0,l.useState)(""),[P,R]=(0,l.useState)(null),[H,O]=(0,l.useState)(null),[W,Z]=(0,l.useState)(""),[V,I]=(0,l.useState)(""),[G,Q]=(0,l.useState)(!1),[q,U]=(0,l.useState)(""),[Y,J]=(0,l.useState)(""),[X,$]=(0,l.useState)([]),[ee,se]=(0,l.useState)("any"),[ne,te]=(0,l.useState)("typical"),[ae,le]=(0,l.useState)(""),[ie,re]=(0,l.useState)(""),[ce,de]=(0,l.useState)(""),[ue,he]=(0,l.useState)(""),[me,pe]=(0,l.useState)(""),[ge,xe]=(0,l.useState)(""),[ve,je]=(0,l.useState)(""),[_e,be]=(0,l.useState)(""),[fe,ye]=(0,l.useState)(""),[ke,Ne]=(0,l.useState)(""),[Se,we]=(0,l.useState)("profile"),[ze,Ae]=(0,l.useState)(""),[Ce,De]=(0,l.useState)(null),[Le,Ee]=(0,l.useState)(""),[Me,Te]=(0,l.useState)(0),Ke=(0,l.useMemo)(()=>null===Ce||void 0===Ce?void 0:Ce.operators.find(e=>e.id===ze),[Ce,ze]),[Be,Fe]=(0,l.useState)(""),[Re,He]=(0,l.useState)(""),[Oe,We]=(0,l.useState)(""),[Ze,Ve]=(0,l.useState)(""),[Ie,Ge]=(0,l.useState)(""),[Qe,qe]=(0,l.useState)(""),[Ue,Ye]=(0,l.useState)(""),[Je,Xe]=(0,l.useState)("name"),[$e,es]=(0,l.useState)(0),[ss,ns]=(0,l.useState)(null),[ts,as]=(0,l.useState)(!1),ls=(0,l.useDeferredValue)(ae);(0,l.useEffect)(()=>{let e=!0;return(0,oe.NA)().then(s=>{e&&k(s)}).catch(s=>{e&&(F("Verzeichnis konnte nicht geladen werden: ".concat(s.message)),C(!1))}),()=>{e=!1}},[]),(0,l.useEffect)(()=>
1{if(!f)return;let e=!0;return L(null),M(""),(0,oe.yd)(f).then(s=>{e&&L(s)}).catch(()=>{e&&M("Vergleichsdaten konnten nicht vollst\xe4ndig geladen werden. Sch\xe4tzungen sind noch nicht eingerechnet.")}),()=>{e=!1}},[f,T]),(0,l.useEffect)(()=>{if(!f)return;let e=!0;return Ee(""),(0,oe.F6)(f).then(s=>{e&&De(s)}).catch(s=>{e&&Ee("Tr\xe4gerdaten konnten nicht geladen werden: ".concat(s.message))}),()=>{e=!1}},[f,Me]),(0,l.useEffect)(()=>{if(!f)return;let e=!0;C(!0),F(""),ns(null),es(0);const s=(0,oe.L9)((0,oe.B6)(f,N,w),Ke);return Promise.all([Promise.all(Ke?[(0,oe.CJ)(Ke)]:s.map(oe.aS)),(0,oe.xR)(f,s).then(s=>(e&&qe(""),s)).catch(s=>(e&&qe("Finanzdaten konnten nicht geladen werden: ".concat(s.message)),{entities:{},schools:{},locations:{}}))]).then(n=>{let[t,l]=n;t=t.map(e=>((e,s)=>e.map(e=>{var n;const t=s.schools[e.id];return(0,a.A)((0,a.A)({},e),{},{bearer_finance:t?s.entities[t.entity_id]:null,location_finance:s.entities[null===(n=s.locations)||void 0===n?void 0:n[e.id]]||null,bearer_finance_link:t?(0,a.A)((0,a.A)({},t),e.school_cost_bearer||e.sponsor):null})}))(e,l)),Ke&&(t=[t[0].filter(e=>s.some(s=>s.id===e.region))]),e&&(b((0,oe.IJ)(f,s,t)),C(!1))}).catch(s=>{e&&(F("Schuldaten konnten nicht geladen werden: ".concat(s.message)),C(!1))}),()=>{e=!1}},[f,N,w,Ke]);const is=(0,l.useMemo)(()=>function(e){const s=new Map;return new Map(e.map(e=>{if(Array.isArray(e.grade_levels)&&e.grade_levels.length)return[e.id,Zn(e)];const n=JSON.stringify([e.region,e.school_type,e.fos_bos_profile]);return s.has(n)||s.set(n,Zn(e)),[e.id,s.get(n)]}))}((null===_||void 0===_?void 0:_.schools)||[]),[_]),rs=(0,l.useMemo)(()=>(0,oe.A_)((null===_||void 0===_?void 0:_.schools)||[],null===H||void 0===H?void 0:H.schools,tt),[_,H]),cs=e=>e?rs.get(e.id):null;(0,l.useEffect)(()=>{let e=!0;return(0,c.BNm)(v,j).then(s=>{e&&(O(s),Z(""))}).catch(()=>{e&&Z("Lokale Lizenzdaten konnten nicht geladen werden.")}),()=>{e=!1}},[v,j]);const os=(0,l.useMemo)(()=>{if(!_)return[];const e=ls.trim().toLocaleLowerCase("de-DE"),s=""===ge?null:Number(ge),n=""===ve?null:Number(ve),t=_.schools.filter(t=>{var a,l,i,r,c,o,d;const u=Number(t.pupil_count||0),h=In(t),m=(0,y.eB)(t),p=rs.get(t.id),g=null===p||void 0===p?void 0:p.school;return(!ze||(null===Ce||void 0===Ce||null===(a=Ce.memberships[t.id])||void 0===a?void 0:a.operator_id)===ze)&&(!Y||t.groups.includes(Y))&&function(e,s){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"any",t=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"typical";if(!s.length)return!0;if("reported"===t&&"reported"!==e.basis)return!1;const a="possible"===t?[...e.grades,...e.possibleGrades]:e.grades;return"all"===n?s.every(e=>a.includes(e)):s.some(e=>a.includes(e))}(is.get(t.id),X,ee,ne)&&(!e||[t.name,t.city,t.postal_code,t.street,t.official_id].some(s=>String(s||"").toLocaleLowerCase("de-DE").includes(e)))&&(!ie||t.startchancen===ie)&&(!ce||"complete"===ce===t.address_complete)&&(!ue||"verified"===ue===Boolean(t.profile_verified))&&(!me||("unknown"===me?!m:m===y.P8[Number(me)]))&&(null===s||u>0&&u>=s)&&(null===n||u>0&&u<=n)&&(!_e||st(t)===_e||"public"===_e&&["state","municipal"].includes(st(t)))&&(!fe||(null===(l=t.sponsor)||void 0===l?void 0:l.name)===fe||(null===(i=t.school_cost_bearer)||void 0===i?void 0:i.name)===fe)&&(!ke||t.district===ke)&&(!Be||("unmatched"===Be?!g:"matched"===Be?Boolean(g):"active"===Be?(e=>Boolean(null===e||void 0===e?void 0:e.license_type)&&("test"!==e.license_type||Boolean(e.license_end_date))&&(!e.license_start_date||String(e.license_start_date).slice(0,10)<=(new Date).toISOString().slice(0,10))&&(!e.license_end_date||String(e.license_end_date).slice(0,10)>=(new Date).toISOString().slice(0,10)))(g):(null===g||void 0===g?void 0:g.license_type)===Be))&&(!Re||g&&("active"===Re?Number(g.active_teacher_count_90d)>0||Number(g.active_student_count_90d)>0:0===Number(g.active_teacher_count_90d)&&0===Number(g.active_student_count_90d)))&&(!Oe||P&&((null===(r=P.matches[t.source_feature_id])||void 0===r?void 0:r.status)||"none")===Oe)&&(!Ze||P&&"high"===(null===(c=P.matches[t.source_feature_id])||void 0===c?void 0:c.status)&&("with"===Ze?(null===(o=P.matches[t.source_feature_id].deals)||void 0===o?void 0:o.length)>0:!(null!==(d=P.matches[t.source_feature_id].deals)&&void 0!==d&&d.length)))&&(!Ie||("available"===Ie?Boolean(Vn(t)):Ie===h))&&(!Ue||"documented"===Ue===Gn(t))});return"pupils-desc"===Je&&t.sort((e,s)=>Number(s.pupil_count||0)-Number(e.pupil_count||0)||e.name.localeCompare(s.name,"de")),"pupils-asc"===Je&&t.sort((e,s)=>(Number(e.pupil_count||0)||1/0)-(Number(s.pupil_count||0)||1/0)||e.name.localeCompare(s.name,"de")),"price-desc"===Je&&t.sort((e,s)=>{var n,t;return((null===(n=(0,y.eB)(s))||void 0===n?void 0:n.price)||0)-((null===(t=(0,y.eB)(e))||void 0===t?void 0:t.price)||0)||e.name.localeCompare(s.name,"de")}),"name"===Je&&t.sort((e,s)=>e.city.localeCompare(s.city,"de")||e.name.localeCompare(s.name,"de")),"finance-desc"===Je&&t.sort((e,s)=>{var n,t,a,l;return(null!==(n=null===(t=Vn(s))||void 0===t?void 0:t.percentile)&&void 0!==n?n:-1)-(null!==(a=null===(l=Vn(e))||void 0===l?void 0:l.percentile)&&void 0!==a?a:-1)||e.name.localeCompare(s.name,"de")}),"finance-asc"===Je&&t.sort((e,s)=>{var n,t,a,l;return(null!==(n=null===(t=Vn(e))||void 0===t?void 0:t.percentile)&&void 0!==n?n:1/0)-(null!==(a=null===(l=Vn(s))||void 0===l?void 0:l.percentile)&&void 0!==a?a:1/0)||e.name.localeCompare(s.name,"de")}),t},[_,Y,ls,ie,ce,ue,me,ge,ve,_e,fe,ke,Be,Re,H,Oe,Ze,P,Ie,Ue,Je,rs,ze,Ce,is,
1X,ee,ne]),ds=(0,l.useMemo)(()=>(0,y.Dr)(os),[os]),us=(0,l.useMemo)(()=>(0,_n.DL)(os,D),[os,D]),hs=(0,l.useMemo)(()=>{const e=new Map;return os.forEach(s=>e.set(s.city,(e.get(s.city)||0)+1)),[...e.entries()].sort((e,s)=>s[1]-e[1]||e[0].localeCompare(s[0],"de")).slice(0,8)},[os]),ms=(e,s)=>{e(s),es(0),ns(null)},ps=()=>{$([]),se("any"),te("typical"),J(""),le(""),re(""),de(""),he(""),pe(""),xe(""),je(""),be(""),ye(""),Ne(""),Fe(""),He(""),We(""),Ve(""),Ge(""),Ye(""),Xe("name"),es(0),ns(null),Ae("")},gs=e=>{ps(),S(""),z(""),Ae(e)},xs=ss?(0,oe.oD)(Ce,ss.id):null,vs=ss?Zn(ss):null;if(!_&&B)return(0,o.jsx)("p",{className:"outreach-directory__error",role:"alert",children:B});if(!_)return(0,o.jsx)("p",{children:"Schulverzeichnis wird geladen \u2026"});const js=os.filter(e=>"confirmed"===e.startchancen).length,_s=os.filter(e=>!e.address_complete).length,bs=os.filter(e=>e.profile_verified).length,fs=us.knownCount,ys=us.total,ks=us.openCount,Ns=os.filter(e=>Vn(e)).length,Ss=os.filter(e=>Gn(e)).length,ws=[...new Set(_.schools.flatMap(e=>{var s,n;return(0,oe.oD)(Ce,e.id)?[]:[null===(s=e.sponsor)||void 0===s?void 0:s.name,null===(n=e.school_cost_bearer)||void 0===n?void 0:n.name]}).filter(e=>e&&"<kein Eintrag>"!==e))].sort((e,s)=>e.localeCompare(s,"de")),zs=[...new Set(_.schools.map(e=>e.district).filter(Boolean))].sort((e,s)=>e.localeCompare(s,"de")),As=os.filter(e=>{var s;return"high"===(null===P||void 0===P||null===(s=P.matches[e.source_feature_id])||void 0===s?void 0:s.status)}).length,Cs=os.filter(e=>{var s;return"possible"===(null===P||void 0===P||null===(s=P.matches[e.source_feature_id])||void 0===s?void 0:s.status)}).length,Ds=os.filter(e=>{var s,n;return(null===P||void 0===P||null===(s=P.matches[e.source_feature_id])||void 0===s||null===(n=s.deals)||void 0===n?void 0:n.length)>0}).length,Ls=os.filter(e=>{var s;return null===(s=cs(e,null===H||void 0===H||H.schools))||void 0===s?void 0:s.school}).length,Es=os.filter(e=>{var s;const n=null===(s=cs(e,null===H||void 0===H||H.schools))||void 0===s?void 0:s.school;return n&&(Number(n.active_teacher_count_90d)>0||Number(n.active_student_count_90d)>0)}).length,Ms=Boolean(X.length||ze||Y||ae||ie||ce||ue||me||ge||ve||_e||fe||ke||Be||Re||Oe||Ze||Ie||Ue||"name"!==Je),Ts=[ce,ue,me,ge,ve,_e,ke,Be,Re,Oe,Ze,Ie,Ue].filter(Boolean).length+(X.length?1:0),Ks=(null===(s=hs[0])||void 0===s?void 0:s[1])||1,Bs=Math.max(1,...ds.map(e=>e.count),us.estimatedCount,ks);return(0,o.jsxs)("section",{className:"outreach-directory","aria-label":"Schulverzeichnis DACH","aria-busy":A,children:[(0,o.jsxs)("header",{className:"outreach-directory__header",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h3",{children:"Schulakquise"}),(0,o.jsxs)("p",{children:["DACH \xb7 ",Qn(f.school_count)," Schulen im Verzeichnis"]})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("button",{type:"button",onClick:async()=>{if(_&&!G&&!A&&os.length){Q(!0),I("");try{const e=new Set(((null===H||void 0===H?void 0:H.schools)||[]).map(e=>e.public_directory_id).filter(Boolean)),s=(0,oe.g_)(os,e),n={};let t=null,l=0;for(const a of s)U("".concat(Qn(l)," / ").concat(Qn(os.length)," Schulen")),t=await(0,c.I9L)(v,j,a),Object.assign(n,t.matches||{}),l+=a.length;R(e=>(0,a.A)((0,a.A)({},t),{},{school_count:os.length,matches:(0,a.A)((0,a.A)({},(null===e||void 0===e?void 0:e.matches)||{}),n)}))}catch(e){I(503===e.status?"Im Backend fehlt ein HubSpot-Lesetoken.":"HubSpot konnte nicht geladen werden (".concat(e.status||e.message,")."))}finally{Q(!1),U("")}}},disabled:G||A||!os.length,children:G?"HubSpot wird geladen \u2026":P?"HubSpot aktualisieren":"Auswahl mit HubSpot abgleichen"})," ",(0,o.jsx)("button",{type:"button",onClick:()=>{const e=os.map(e=>{var s,n,t,a,l,i,r,c,o,d,u,h,m,p,g,x,v,j,b,f,k,N,S,w,z,A,C,D,L,E,M,T,K,B,F,R,O;return{land:e.country,region:e.region_name,teilregion:e.subregion_name||"",schulname:e.name,schulart:e.school_type,klassenstufen:Wn(is.get(e.id).grades),klassenstufen_moeglich:Wn(is.get(e.id).possibleGrades),klassenstufen_basis:"reported"===is.get(e.id).basis?"im Schulprofil erfasst":"inferred"===is.get(e.id).basis?"aus Schulart und Bundesland abgeleitet":"offen",klassenstufen_hinweis:is.get(e.id).note,klassenstufen_quellen:is.get(e.id).sourceUrls.join("; "),gruppen:e.groups.map(e=>_.groups[e]).join("; "),strasse:e.street,plz:e.postal_code,ort:e.city,anschrift_vollstaendig:e.address_complete?"ja":"nein",startchancen:"c
1onfirmed"===e.startchancen?"eindeutige Zuordnung":"not_applicable"===e.startchancen?"nicht anwendbar":"unbekannt",amtliche_schulnummer:e.official_id||"",email:e.email||"",email_paedagogik:e.pedagogical_email||"",telefon:e.phone||"",website:e.website||"",schueler:e.pupil_count||"",lehrkraefte:e.teacher_count||"",schuljahr_der_zahlen:e.school_year||"",bezugsjahr_hinweis:e.pupil_count_year_note||"",schuelerzahl_bezug:e.pupil_count_scope||"",schuelerzahl_quelle:e.pupil_count_source_url||"",schuelerzahl_gerundet:e.pupil_count_approximate?"ja":"",standort_schueler:e.site_pupil_count||"",standort_genauigkeit:e.point_accuracy||"",weitere_standorte:e.location_count||"",richtpreis_eur_pro_jahr:(null===(s=(0,y.eB)(e))||void 0===s?void 0:s.price)||"",preisstaffel:(null===(n=(0,y.eB)(e))||void 0===n?void 0:n.label)||"",preisquelle:"https://livinglines.app/preise/",rechtlicher_status:e.legal_status||"",ausbildungsrichtungen:e.education_tracks||"",traegergruppe:(null===(t=(0,oe.oD)(Ce,e.id))||void 0===t?void 0:t.name)||"",traegergruppe_zuordnung:(null===Ce||void 0===Ce||null===(a=Ce.memberships[e.id])||void 0===a?void 0:a.basis)||"",traegergruppe_quelle:(null===Ce||void 0===Ce||null===(l=Ce.memberships[e.id])||void 0===l?void 0:l.network_source_url)||"",traegergruppe_finanzlage:(null===(i=(0,oe.oD)(Ce,e.id))||void 0===i?void 0:i.finance_label)||"",traegergruppe_finanzhinweis:(null===(r=(0,oe.oD)(Ce,e.id))||void 0===r?void 0:r.finance_note)||"",traeger:(null===(c=e.sponsor)||void 0===c?void 0:c.name)||"",traeger_typ:(null===(o=e.sponsor)||void 0===o?void 0:o.kind)||"",traeger_zuordnung_basis:(null===(d=e.sponsor)||void 0===d?void 0:d.basis)||"",traeger_konfidenz:(null===(u=e.sponsor)||void 0===u?void 0:u.confidence)||"",sachaufwandstraeger:(null===(h=e.school_cost_bearer)||void 0===h?void 0:h.name)||"",sachaufwandstraeger_zuordnung_basis:(null===(m=e.school_cost_bearer)||void 0===m?void 0:m.basis)||"",standortkommune_ags:e.municipality_ags||"",finanztraeger:(null===(p=e.bearer_finance_link)||void 0===p?void 0:p.name)||"",finanztraeger_zuordnung:(null===(g=e.bearer_finance_link)||void 0===g?void 0:g.basis)||"",finanztraeger_quelle:(null===(x=e.bearer_finance_link)||void 0===x?void 0:x.source_url)||"",finanztraeger_kennzahlen:(null===(v=e.bearer_finance)||void 0===v?void 0:v.metrics.map(e=>"".concat(e.label,": ").concat(e.value," ").concat(e.unit,"; ").concat(e.year,"; ").concat(e.source_url)).join(" | "))||"",finanztraeger_haushaltslage:(null===(j=e.bearer_finance)||void 0===j||null===(b=j.household_status)||void 0===b?void 0:b.label)||"Nicht erhoben",finanzkraft_standortkommune_eur_je_einwohner:e.finance_eur_per_resident||"",standort_bw_kennzahlen:(null===(f=e.location_finance)||void 0===f?void 0:f.metrics.filter(e=>"EUR/resident"===e.unit).map(e=>"".concat(e.label,": ").concat(e.value,"; ").concat(e.year,"; ").concat(e.source_url)).join(" | "))||"",finanzkraft_jahr:e.finance_year||"",finanzkraft_vorjahr_eur_je_einwohner:e.previous_finance_eur_per_resident||"",finanzkraft_quelle:e.finance_source_url||"",finanzkraft_abgerufen_am_utc:e.finance_retrieved_at_utc||"",standortkommune_dokumentierter_haushaltsengpass:null!==(k=_.municipal_budget_alerts)&&void 0!==k&&k.some(s=>s.municipality_ags===e.municipality_ags)?"ja":"nicht erfasst",schulaufwandstraeger_verifiziert:null!==(N=e.school_cost_bearer)&&void 0!==N&&N.name?"ja":"nicht zugeordnet",hubspot_abgleich:P?(null===(S=P.matches[e.source_feature_id])||void 0===S?void 0:S.status)||"none":"nicht geladen",hubspot_company_id:(null===P||void 0===P||null===(w=P.matches[e.source_feature_id])||void 0===w?void 0:w.company_id)||"",hubspot_company_url:(null===P||void 0===P||null===(z=P.matches[e.source_feature_id])||void 0===z?void 0:z.url)||"",hubspot_deals:(null===P||void 0===P||null===(A=P.matches[e.source_feature_id])||void 0===A||null===(C=A.deals)||void 0===C?void 0:C.map(e=>"".concat(e.name||e.id," (").concat(e.stage||"Status offen","; ").concat(Un(e),")")).join("; "))||"",hubspot_deal_urls:(null===P||void 0===P||null===(D=P.matches[e.source_feature_id])||void 0===D||null===(L=D.deals)||void 0===L?void 0:L.map(e=>e.url).join("; "))||"",hubspot_abgerufen_am_utc:(null===P||void 0===P?void 0:P.retrieved_at_utc)||"",lokale_lizenz_zuordnung:(null===(E=cs(e,null===H||void 0===H||H.schools))||void 0===E?void 0:E.
1confidence)||(H?"kein_treffer":"nicht_geladen"),lokale_lizenz:null!==(M=cs(e,null===H||void 0===H||H.schools))&&void 0!==M&&M.school?ct(cs(e,null===H||void 0===H||H.schools).school):"Keine Zuordnung",lokale_aktive_lehrkraefte_90_tage:null!==(T=null===(K=cs(e,null===H||void 0===H||H.schools))||void 0===K||null===(B=K.school)||void 0===B?void 0:B.active_teacher_count_90d)&&void 0!==T?T:"",lokale_aktive_schueler_90_tage:null!==(F=null===(R=cs(e,null===H||void 0===H||H.schools))||void 0===R||null===(O=R.school)||void 0===O?void 0:O.active_student_count_90d)&&void 0!==F?F:"",profilquelle:e.profile_url||"",profil_abgerufen_am_utc:e.profile_retrieved_at_utc||"",quelle:e.source_url,abgerufen_am_utc:e.retrieved_at_utc}}),s=new Blob(["\ufeff",cn().unparse(e,{escapeFormulae:!0})],{type:"text/csv;charset=utf-8"}),n=URL.createObjectURL(s),t=document.createElement("a");t.href=n,t.download="schulen-dach-auswahl-".concat(_.source_date,".csv"),t.click(),URL.revokeObjectURL(n)},disabled:!os.length||A,children:"Auswahl als CSV exportieren"})]})]}),(0,o.jsxs)("section",{className:"outreach-directory__workspace","aria-label":"Schulen suchen",children:[A&&(0,o.jsx)("p",{role:"status",children:"Regionale Schuldaten werden geladen \u2026"}),B&&(0,o.jsx)("p",{className:"outreach-directory__error",role:"alert",children:B}),(0,o.jsxs)("div",{className:"outreach-directory__filters-primary",children:[(0,o.jsxs)("label",{children:["Land",(0,o.jsxs)("select",{value:N,onChange:e=>{S(e.target.value),z(""),J(""),Ne(""),es(0)},children:[(0,o.jsx)("option",{value:"",children:"DACH \u2013 alle L\xe4nder"}),(0,o.jsx)("option",{value:"DE",children:"Deutschland"}),(0,o.jsx)("option",{value:"AT",children:"\xd6sterreich"}),(0,o.jsx)("option",{value:"CH",children:"Schweiz"})]})]}),(0,o.jsxs)("label",{children:["Erfasste Region",(0,o.jsxs)("select",{value:w,onChange:e=>{z(e.target.value),J(""),Ne(""),es(0)},children:[(0,o.jsx)("option",{value:"",children:"Alle erfassten Regionen"}),f.regions.filter(e=>!N||e.country===N).map(e=>(0,o.jsxs)("option",{value:e.id,children:[e.label," \xb7 ",Qn(e.school_count)]},e.id))]})]}),(0,o.jsxs)("label",{children:["Tr\xe4ger",(0,o.jsxs)("select",{value:ze?"operator:".concat(ze):fe?"sponsor:".concat(fe):"",onChange:e=>{var s;(s=e.target.value).startsWith("operator:")?gs(s.slice(9)):(Ae(""),ms(ye,s.startsWith("sponsor:")?s.slice(8):""))},children:[(0,o.jsx)("option",{value:"",children:"Alle Tr\xe4ger"}),Ce&&(0,o.jsx)("optgroup",{label:"Schulverb\xfcnde",children:Ce.operators.map(e=>(0,o.jsxs)("option",{value:"operator:".concat(e.id),children:[e.name," \xb7 ",e.directory_count," Eintr\xe4ge"]},e.id))}),(0,o.jsx)("optgroup",{label:"Weitere Schul- und Sachaufwandstr\xe4ger",children:ws.map(e=>(0,o.jsx)("option",{value:"sponsor:".concat(e),children:e},e))})]})]}),(0,o.jsxs)("label",{className:"outreach-directory__search-filter",children:["Schulname oder Ort",(0,o.jsx)("input",{type:"search",value:ae,onChange:e=>ms(le,e.target.value),placeholder:"Zum Beispiel W\xfcrzburg"})]}),(0,o.jsxs)("label",{children:["Schulart",(0,o.jsxs)("select",{value:Y,onChange:e=>ms(J,e.target.value),children:[(0,o.jsx)("option",{value:"",children:"Alle Schularten"}),Object.entries(_.groups).map(e=>{let[s,n]=e;return(0,o.jsx)("option",{value:s,children:n},s)})]})]}),(0,o.jsxs)("label",{children:["Startchancen",(0,o.jsxs)("select",{value:ie,onChange:e=>ms(re,e.target.value),children:[(0,o.jsx)("option",{value:"",children:"Alle"}),(0,o.jsx)("option",{value:"confirmed",children:"Eindeutig zugeordnet"}),(0,o.jsx)("option",{value:"unknown",children:"Unbekannt"}),(0,o.jsx)("option",{value:"not_applicable",children:"Nicht anwendbar (AT / CH)"})]})]}),(0,o.jsxs)("label",{children:["Sortierung",(0,o.jsxs)("select",{value:Je,onChange:e=>ms(Xe,e.target.value),children:[(0,o.jsx)("option",{value:"name",children:"Ort und Name"}),(0,o.jsx)("option",{value:"pupils-desc",children:"Gr\xf6\xdfte zuerst"}),(0,o.jsx)("option",{value:"pupils-asc",children:"Kleinste zuerst"}),(0,o.jsx)("option",{value:"price-desc",children:"H\xf6chster Richtpreis"}),(0,o.jsx)("option",{value:"finance-desc",children:"H\xf6chste Tr\xe4gerkennzahl im Landesvergleich"}),(0,o.jsx)("option",{value:"finance-asc",children:"Niedrigste Tr\xe4gerkennzahl im Landesvergleich"})]})]})]}),(0,o.jsxs)("details",{className:"outreach-directory__filter-more",children:[(0,o.jsxs)("summary",{children:["Weitere Filter",Ts?" \xb7 ".concat(Ts," aktiv"):""]}),(0,o.jsxs)("div",{className:"outreach-directory__filter-groups",children:[(0,o.jsxs)("section",{children:[(0,o.jsx)("h5",{children:"Schulprofil & Gr\xf6\xdfe"}),(0,o.jsxs)("div",{className:"outreach-directory__filter-group-fields",children:[zs.length>0&&(0,o.jsxs)("label",{children:["Landkreis / Region",(0,o.jsxs)("select",{value:ke,onChange:e=>ms(Ne,e.target.value),children:[(0,o.jsx)("option",{value:"",children:"Alle"}),zs.map(e=>(0,o.jsx)("option",{value:e,children:e},e))]})]}),(0,o.jsxs)("label",{children:["Adresse",(0,o.jsxs)("select",{value:ce,onChange:e=>ms(de,e.target.value),children:[(0,o.jsx)("option",{value:"",children:"Alle"}),(0,o.jsx)("option",{value:"complete",children:"Vollst\xe4ndig"}),(0,o.jsx)("option",{value:"incomplete",children:"Hausnummer pr\xfcfen"})]})]}),(0,o.jsxs)("label",{children:["Amtliches Profil",(0,o.jsxs)("select",{value:ue,onChange:e=>ms(he,e.target.value),children:[(0,o.jsx)("option",{value:"",children:"Alle"}),(0,o.jsx)("option",{value:"verified",children:"Vorhanden"}),(0,o.jsx)("option",{value:"open",children:"Fehlt"})]})]}),(0,o.jsxs)("label",{children:["Preisstufe",(0,o.jsxs)("select",{value:me,onChange:e=>ms(pe,e.target.value),children:[(0,o.jsx)("option",{value:"",children:"Alle"}),y.P8.map((e,s)=>(0,o.jsxs)("option",{value:String(s),children:[e.label," \xb7 ",qn(e.price)]},e.price)),(0,o.jsx)("option",{value:"unknown",children:"Preisstufe offen"})]})]}),(0,o.jsxs)("label",{children:["Sch\xfclerzahl ab",(0,o.jsx)("input",{type:"number",min:"1",value:ge,onChange:e=>ms(xe,e.target.value),placeholder:"Min."})]}),(0,o.jsxs)("label",{children:["Sch\xfclerzahl bis",(0,o.jsx)("input",{type:"number",min:"1",value:ve,onChange:e=>ms(je,e.target.value),placeholder:"Max."})]}),(0,o.jsxs)("label",{children:["Schulstatus",(0,o.jsxs)("select",{value:_e,onChange:e=>ms(be,e.target.value),children:[(0,o.jsx)("option",{value:"",children:"Alle"}),(0,o.jsx)("option",{value:"state",children:"Staatliche Schule"}),(0,o.jsx)("option",{value:"municipal",children:"Kommunale Schule"}),(0,o.jsx)("option",{value:"private",children:"Private Schule"}),(0,o.jsx)("option",{value:"unknown",children:"Unbekannt"})]})]}),(0,o.jsxs)("fieldset",{className:"outreach-directory__grade-filter",children:[(0,o.jsx)("legend",{children:"Klassenstufen \xb7 Mehrfachauswahl"}),(0,o.jsx)("div",{className:"outreach-directory__grade-options",children:Pn.map(e=>(0,o.jsx)("button",{type:"button","aria-label":"Klasse ".concat(e),"aria-pressed":X.includes(e),onClick:()=>ms($,X.includes(e)?X.filter(s=>s!==e):[...X,e].sort((e,s)=>e-s)),children:e},e))}),(0,o.jsxs)("div",{className:"outreach-directory__grade-control
1s",children:[(0,o.jsxs)("label",{children:["Trefferregel",(0,o.jsxs)("select",{value:ee,onChange:e=>ms(se,e.target.value),children:[(0,o.jsx)("option",{value:"any",children:"Mindestens eine ausgew\xe4hlte Stufe"}),(0,o.jsx)("option",{value:"all",children:"Alle ausgew\xe4hlten Stufen"})]})]}),(0,o.jsxs)("label",{children:["Datengrundlage",(0,o.jsxs)("select",{value:ne,onChange:e=>ms(te,e.target.value),children:[(0,o.jsx)("option",{value:"typical",children:"Erfasste und typische Klassenstufen"}),(0,o.jsx)("option",{value:"possible",children:"Auch m\xf6gliche Klassenstufen"}),(0,o.jsx)("option",{value:"reported",children:"Nur im Schulprofil erfasste Stufen"})]})]}),X.length>0&&(0,o.jsx)("button",{type:"button",onClick:()=>ms($,[]),children:"Auswahl l\xf6schen"})]}),(0,o.jsx)("small",{children:"Ohne Auswahl sind alle Klassenstufen enthalten. Typische Stufen sind aus Schulart und Bundesland abgeleitet, nicht f\xfcr die einzelne Schule best\xe4tigt. M\xf6gliche Stufen h\xe4ngen vom Bildungsgang ab. Bei einer Stufenauswahl werden Schulen ohne passende Zuordnung ausgeblendet."})]})]})]}),H&&(0,o.jsxs)("section",{className:"outreach-directory__filter-group--livinglines",children:[(0,o.jsx)("h5",{children:"LivingLines"}),(0,o.jsxs)("div",{className:"outreach-directory__filter-group-fields",children:[(0,o.jsxs)("label",{children:["Lizenz / Zuordnung",(0,o.jsxs)("select",{value:Be,onChange:e=>ms(Fe,e.target.value),children:[(0,o.jsx)("option",{value:"",children:"Alle Schulen"}),(0,o.jsx)("option",{value:"active",children:"Aktive lokale Lizenz"}),(0,o.jsx)("option",{value:"regular",children:"Regul\xe4re Lizenz"}),(0,o.jsx)("option",{value:"test",children:"Testlizenz"}),(0,o.jsx)("option",{value:"matched",children:"Lokaler Datensatz verkn\xfcpft"}),(0,o.jsx)("option",{value:"unmatched",children:"Kein lokaler Datensatz"})]})]}),(0,o.jsxs)("label",{children:["Nutzung in den letzten 90 Tagen",(0,o.jsxs)("select",{value:Re,onChange:e=>ms(He,e.target.value),children:[(0,o.jsx)("option",{value:"",children:"Alle"}),(0,o.jsx)("option",{value:"active",children:"Mit Nutzung"}),(0,o.jsx)("option",{value:"inactive",children:"Ohne Nutzung"})]})]})]})]}),P&&(0,o.jsxs)("section",{className:"outreach-directory__filter-group--hubspot",children:[(0,o.jsx)("h5",{children:"HubSpot"}),(0,o.jsxs)("div",{className:"outreach-directory__filter-group-fields",children:[(0,o.jsxs)("label",{children:["Company-Abgleich",(0,o.jsxs)("select",{value:Oe,onChange:e=>ms(We,e.target.value),children:[(0,o.jsx)("option",{value:"",children:"Alle"}),(0,o.jsx)("option",{value:"high",children:"Eindeutiger Treffer"}),(0,o.jsx)("option",{value:"possible",children:"M\xf6glicher Treffer"}),(0,o.jsx)("option",{value:"none",children:"Kein Treffer"})]})]}),(0,o.jsxs)("label",{children:["Deals",(0,o.jsxs)("select",{value:Ze,onChange:e=>ms(Ve,e.target.value),children:[(0,o.jsx)("option",{value:"",children:"Alle"}),(0,o.jsx)("option",{value:"with",children:"Mit Deal"}),(0,o.jsx)("option",{value:"without",children:"Ohne Deal"})]})]})]})]}),(0,o.jsxs)("section",{className:"outreach-directory__filter-group--finance",children:[(0,o.jsx)("h5",{children:"Finanzlage des Tr\xe4gers"}),(0,o.jsxs)("div",{className:"outreach-directory__filter-group-fields",children:[(0,o.jsxs)("label",{children:["Tr\xe4gerkennzahl im Landesvergleich",(0,o.jsxs)("select",{value:Ie,onChange:e=>ms(Ge,e.target.value),children:[(0,o.jsx)("option",{value:"",children:"Alle"}),(0,o.jsx)("option",{value:"available",children:"Kennzahl vorhanden"}),(0,o.jsx)("option",{value:"low",children:"Unteres Viertel"}),(0,o.jsx)("option",{value:"mid",children:"Mittlere H\xe4lfte"}),(0,o.jsx)("option",{value:"high",children:"Oberes Viertel"}),(0,o.jsx)("option",{value:"unknown",children:"Kennzahl offen"})]})]}),(0,o.jsxs)("label",{children:["Haushaltshinweis",(0,o.jsxs)("select",{value:Ue,onChange:e=>ms(Ye,e.target.value),children:[(0,o.jsx)("option",{value:"",children:"Alle"}),(0,o.jsx)("option",{value:"documented",children:"Engpass dokumentiert"}),(0,o.jsx)("option",{value:"unrecorded",children:"Kein Einschr\xe4nkungsbeleg erfasst"})]})]})]})]})]}),(0,o.jsx)("small",{children:"\u201eStaatliche Schule\u201c benennt den Dienstherrn des Lehrpersonals, nicht den Sachaufwandstr\xe4ger. Kommunale Sachaufwandstr\xe4ger werden nur bei ausdr\xfccklich genannten Tr\xe4gern oder best\xe4tigter Quellenliste zugeordnet; ein m\xf6glicher Lizenzk\xe4ufer ist damit noch nicht best\xe4tigt."})]}),Ms&&(0,o.jsx)("button",{className:"outreach-directory__reset",type:"button",onClick:ps,children:"Filter zur\xfccksetzen"})]}),Qe&&(0,o.jsx)("p",{className:"outreach-directory__error",role:"alert",children:Qe}),(0,o.jsxs)("div",{className:"outreach-directory__results-bar",children:[(0,o.jsxs)("strong",{children:[Qn(os.length)," Schulen",Ke?" \xb7 ".concat(Ke.name):""]}),(0,o.jsx)("span",{children:"Schule ausw\xe4hlen, um das Profil zu \xf6ffnen"})]}),(0,o.jsxs)("div",{className:"outreach-directory__layout",children:[(0,o.jsxs)("div",{className:"outreach-directory__table-wrap",children:[(0,o.jsxs)("table",{children:[(0,o.jsx)("thead",{children:(0,o.jsxs)("tr",{children:[(0,o.jsxs)("th",{children:["Schule ",(0,o.jsx)("span",{children:"Schulart"})]}),(0,o.jsxs)("th",{children:["Ort ",(0,o.jsx)("span",{children:"Land \xb7 Region"})]}),(0,o.jsxs)("th",{children:["Sch\xfcler:innen ",(0,o.jsx)("span",{children:"Richtpreis / Jahr"})]}),(0,o.jsxs)("th",{children:["Signale ",(0,o.jsx)("span",{children:"LivingLines \xb7 HubSpot \xb7 F\xf6rderung"})]}),(0,o.jsx)("th",{children:"Finanzlage Tr\xe4ger"})]})}),(0,o.jsx)("tbody",{children:os.slice(50*$e,50*($e+1)).map(e=>{var s,n,t,a,l,i;const r=rs.get(e.id),c=null===P||void 0===P?void 0:P.matches[e.source_feature_id],d=Gn(e),u=(0,y.eB)(e),h=(0,oe.oD)(Ce,e.id);return(0,o.jsxs)("tr",{className:(null===ss||void 0===ss?void 0:ss.id)===e.id?"selected":"",onClick:()=>{ns(e),we("profile")},children:[(0,o.jsxs)("td",{className:"outreach-directory__table-school",children:[(0,o.jsx)("strong",{children:e.name}),h&&(0,o.jsxs)("span",{className:"outreach-directory__operator-tag",title:Ce.memberships[e.id].basis,children:["Verbund \xb7 ",h.name]}),(0,o.jsx)("span",{className:"outreach-directory__type-tag outreach-directory__type-tag--".concat(dt(e)),children:e.fos_bos_profile||e.school_type}),(null===(s=e.school_cost_bearer)||void 0===s?void 0:s.name)&&(0,o.jsxs)("span",{className:"outreach-directory__sponsor-tag",title:"".concat(e.school_cost_bearer.basis," \xb7 Quelle verifiziert"),children:["Sachaufwand \xb7 ",e.school_cost_bearer.name]}),(null===(n=e.sponsor)||void 0===n?void 0:n.name)&&(0,o.jsxs)("span",{className:"outreach-directory__sponsor-tag",title:"".concat(e.sponsor.basis," \xb7 ").concat("high"===e.sponsor.confidence?"hohe":"mittlere"," Sicherheit"),children:["Tr\xe4ger \xb7 ",e.sponsor.name]})]}),(0,o.jsxs)("td",{className:"outreach-directory__table-place",children:[(0,o.jsx)("strong",{children:e.city}),"DE-BW"===e.region&&e.district&&(0,o.jsx)("span",{children:e.district}),(0,o.jsxs)("span",{children:[e.postal_code," \xb7 ",e.country," \xb7 ",e.region_name]})]}),(0,o.jsxs)("td",{className:"outreach-directory__table-size",children:[(0,o.jsx)("strong",{children:e.pupil_count?Qn(e.pupil_count):"\u2013"}),(0,o.jsx)("span",{children:u?qn(u.price):"Preis offen"})]}),(0,o.jsx)("td",{children:(0,o.jsxs)("div",{className:"outreach-directory__signals",children:[(null===r||void 0===r?void 0:r.school)&&(0,o.jsxs)("span",{className:"outreach-directory__signal outreach-directory__signal--".concat(it(r)?"green":"amber"),title:"".concat(ct(r.school)," \xb7 ").concat(Qn(r.school.active_teacher_count_90d)," aktive Lehrkr\xe4fte in 90 Tagen").concat("name"===r.confidence?" \xb7 Namenszuordnung bitte pr\xfcfen":""),children:["LL \xb7 ","name"===r.confidence?"pr\xfcfen":rt(r.school.license_type),Number(r.school.active_teacher_count_90d)>0&&" \xb7 ".concat(Qn(r.school.active_teacher_count_90d)," aktiv")]}),"high"===(null===c||void 0===c?void 0:c.status)&&(0,o.jsxs)("span",{className:"outreach-directory__signal outreach-directory__signal--green",title:"Eindeutiger HubSpot-Treffer".concat(null!==(t=c.deals)&&void 0!==t&&t.length?" \xb7 ".concat(c.deals.length," Deal(s)"):""),children:["HubSpot",(null===(a=c.deals)||void 0===a?void 0:a.length)>0&&" \xb7 ".concat(Qn(c.deals.length)," Deal(s)")]}),"possible"===(null===c||void 0===c?void 0:c.status)&&(0,o.jsx)("span",{className:"outreach-directory__signal outreach-directory__signal--amber",title:"M\xf6glicher HubSpot-Treffer \xb7 bitte pr\xfcfen",children:"HubSpot \xb7 pr\xfcfen"}),"confirmed"===e.startchancen&&(0,o.jsx)("span",{className:"outreach-directory__signal outreach-directory__signal--violet",title:"Eindeutige Zuordnung zur amtlichen Startchancen-Liste",children:"Startchancen"}),!(null!==r&&void 0!==r&&r.school)&&"high"!==(null===c||void 0===c?void 0:c.status)&&"possible"!==(null===c||void 0===c?void 0:c.status)&&"confirmed"!==e.startchancen&&(0,o.jsx)("span",{className:"outreach-directory__signal-empty",children:"\u2013"})]})}),(0,o.jsx)("td",{className:"outreach-directory__table-finance",title:e.bearer_finance?"Tr\xe4ger: ".concat(e.bearer_finance_link.name):"Tr\xe4ger nicht best\xe4tigt; Standortdaten separat im Profil",children:Vn(e)?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("strong",{children:qn(Vn(e).value)}),(0,o.jsxs)("span",{children:["/ Einw. \xb7 ",Vn(e).year,"DE-NW"===e.region?" (vorl.)":""]}),(0,o.jsxs)("span",{children:["high"===In(e)?"Oberes Viertel":"low"===In(e)?"Unteres Viertel":"Mittlere H\xe4lfte"," \xb7 ",e.region_name]}),d&&(0,o.jsx)("em",{children:"Haushaltshinweis"})]}):h?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("strong",{children:h.finance_label}),(0,o.jsx)("span",{children:"Verbund \xb7 siehe Profil"})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("strong",{children:null!==(l=e.bearer_finance)&&void 0!==l&&null!==(i=l.metrics)&&void 0!==i&&i.length?"Kennzahlen im Profil":"Kennzahlen offen"}),(0,o.jsx)("span",{children:e.bearer_finance?"Tr\xe4ger best\xe4tigt":e.finance_eur_per_resident?"Standortwert im Profil":"Tr\xe4gerzuordnung offen"})]})})]},e.id)})})]}),!os.length&&(0,o.jsx)("p",{className:"outreach-directory__empty",children:"Keine Schulen f\xfcr diese Filter."})]}),(0,o.jsxs)("aside",{className:"outreach-directory__aside",children:[(0,o.jsx)("div",{className:"outreach-directory__side-tabs",role:"tablist","aria-label":"Schulprofil und Recherche",children:[["profile","Schulprofil"],["research","Karte & Recherche"]].map(e=>{let[s,n]=e;return(0,o.jsx)("button",{type:"button",role:"tab",id:"outreach-tab-".concat(s),"aria-selected":Se===s,"aria-controls":"outreach-panel-".concat(s),onClick:()=>we(s),children:n},s)})}),"research"===Se?(0,o.jsxs)("div",{role:"tabpanel",id:"outreach-panel-research","aria-labelledby":"outreach-tab-research",children:["        ",(0,o.jsxs)("section",{className:"outreach-directory__explore","aria-label":"Auswertung und Recherche",children:[(0,o.jsx)("h4",{children:"Auswertung & Recherche"}),(0,o.jsx)(mn,{defaultOpen:!0,groups:_.groups,schools:os,selectedId:null===ss||void 0===ss?void 0:ss.id,onSelect:e=>{ns(e),we("profile"),window.requestAnimationFrame(()=>{var e;return null===(e=document.querySelector(".outreach-directory__aside"))||void 0===e?void 0:e.scrollIntoView({behavior:"smooth",block:"nearest"})})}}),(0,o.jsx)(jn,{catalog:Ce,error:Le,activeId:ze,onChoose:gs,onRetry:()=>Te(e=>e+1),busy:A}),(0,o.jsxs)("details",{className:"outreach-directory__tier-chart","aria-label":"Verteilung nach Preisstufen",children:[(0,o.jsxs)("summary",{className:"outreach-directory__tier-summary",children:[(0,o.jsx)("strong",{children:"Schulgr\xf6\xdfe und Richtpreis"}),(0,o.jsxs)("span",{children:[Qn(os.length)," Schulen \xb7 ",qn(ys)," / Jahr theoretischer Richtpreis \xb7 davon ",qn(us.estimatedTotal)," gesch\xe4tzt",!D&&" \xb7 Vergleichsdaten ausstehend"]})]}),(0,o.jsxs)("div",{className:"outreach-directory__tier-content",children:[(0,o.jsxs)("div",{className:"outreach-directory__tier-header",children:[(0,o.jsx)("h4",{children:"Verteilung der aktuellen Auswahl"}),(0,o.jsx)("small",{children:"Richtpreis nach Schulgr\xf6\xdfe"})]}),[...ds,{label:"Gesch\xe4tzter Richtpreis",count:us.estimatedCount,total:us.estimatedTotal},{label:"Preis offen / individuelles Angebot",count:ks,total:null}].map(e=>(0,o.jsxs)("div",{className:"outreach-directory__tier-row",children:[(0,o.jsx)("span",{children:e.label}),(0,o.jsx)("span",{className:"outreach-directory__tier-track",children:(0,o.jsx)("i",{style:{width:"".concat(100*e.count/Bs,"%")}})}),(0,o.jsxs)("strong",{children:[Qn(e.count)," Schulen"]}),(0,o.jsx)("span",{children:null!==e.total?qn(e.total):"Preis offen"})]},e.label))]})]}),(0,o.jsxs)("details",{className:"outreach-directory__analysis",children:[(0,o.jsx)("summary",{children:"Kennzahlen & Schularten"}),(0,o.jsxs)("div",{className:"outreach-directory__stats",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("strong",{children:Qn(os.length)}),(0,o.jsx)("span",{children:"Schulen in Auswahl"})]}),H&&(0,o.jsxs)("div",{className:"outreach-directory__stat--livinglines",children:[(0,o.jsx)("strong",{children:Qn(Ls)}),(0,o.jsxs)("span",{children:["LivingLines zugeordnet \xb7 ",Qn(Es)," zuletzt aktiv"]})]}),P&&(0,o.jsxs)("div",{className:"outreach-directory__stat--hubspot",children:[(0,o.jsx)("strong",{children:Qn(Ds)}),(0,o.jsx)("span",{children:"HubSpot-Treffer mit Deal"})]}),(0,o.jsxs)("div",{className:"outreach-directory__stat--startchancen",children:[(0,o.jsx)("strong",{children:Qn(js)}),(0,o.jsx)("span",{children:"Startchancen-Schulen"})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("strong",{children:qn(ys)}),(0,o.jsx)("span",{children:"Theoretischer Richtpreis / Jahr"})]}),(0,o.jsxs)("div",{children:[(0,o.jsxs)("strong",{children:[qn(us.estimatedTotal)," \xb7 ",us.estimatedShare.toLocaleStr
1ing("de-DE",{maximumFractionDigits:1})," %"]}),(0,o.jsxs)("span",{children:["Davon gesch\xe4tzt \xb7 ",Qn(us.estimatedCount)," Schulen (",(us.schoolCount?100*us.estimatedCount/us.schoolCount:0).toLocaleString("de-DE",{maximumFractionDigits:1})," %)"]})]})]}),!D&&(0,o.jsxs)("p",{role:"status",children:[E||"Vergleichsdaten werden geladen; die Summe enth\xe4lt bisher nur bekannte Richtpreise."," ",E&&(0,o.jsx)("button",{type:"button",onClick:()=>K(e=>e+1),children:"Erneut laden"})]}),(0,o.jsx)("p",{children:(0,o.jsxs)("small",{children:["Sch\xe4tzungen: Durchschnitt der bekannten Jahresrichtpreise derselben Schulart bzw. Schulartenkombination im Bundesland / in der Region. Ohne regionale Vergleichsdaten nutzen deutsche Schulen den deutschlandweiten Durchschnitt. ",Qn(us.regionalCount)," regional und ",Qn(us.germanyCount)," deutschlandweit gesch\xe4tzt. Vergleichsbasis ist das gesamte Verzeichnis, unabh\xe4ngig von den Filtern."]})}),(0,o.jsxs)("details",{className:"outreach-directory__stats-more",children:[(0,o.jsx)("summary",{children:"Weitere Kennzahlen"}),(0,o.jsxs)("div",{className:"outreach-directory__stats outreach-directory__stats--secondary",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("strong",{children:Qn(_s)}),(0,o.jsx)("span",{children:"Anschriften mit Pr\xfcfhinweis"})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("strong",{children:Qn(bs)}),(0,o.jsx)("span",{children:"Amtliche Profile"})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("strong",{children:Qn(_.startchancen.unresolved_count)}),(0,o.jsx)("span",{children:"Ungekl\xe4rte Startchancen-Eintr\xe4ge"})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("strong",{children:Qn(ks)}),(0,o.jsx)("span",{children:"Preis offen / individuelles Angebot"})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("strong",{children:Qn(Ns)}),(0,o.jsx)("span",{children:"Mit Finanzkennzahl des Tr\xe4gers"})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("strong",{children:Qn(Ss)}),(0,o.jsx)("span",{children:"Mit dokumentiertem Haushaltshinweis"})]}),P&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("strong",{children:Qn(As)}),(0,o.jsx)("span",{children:"HubSpot: eindeutige Treffer"})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("strong",{children:Qn(Cs)}),(0,o.jsx)("span",{children:"HubSpot: m\xf6gliche Treffer"})]})]})]}),(0,o.jsxs)("small",{children:["Preis-Summe: eine Schullizenz pro Schule, Standorte werden zusammengefasst. ",Qn(fs)," mit bekanntem Richtpreis, ",Qn(us.estimatedCount)," gesch\xe4tzt, ",Qn(ks)," offen. Ohne passende Vergleichsdaten, bei widerspr\xfcchlichen Gr\xf6\xdfen, explizit null Sch\xfclern oder ab 1.500 Sch\xfclern bleibt der Preis offen. Sch\xe4tzungen ver\xe4ndern keine Sch\xfclerzahlen. Ohne Abschlusswahrscheinlichkeit oder individuelle Angebote. EUR-Richtpreise; f\xfcr die Schweiz ist dies keine CHF-Preisliste. ",(0,o.jsx)("a",{href:"/preise",target:"_blank",rel:"noopener noreferrer",children:"Aktuelle Preisstaffel"})]})]}),(0,o.jsx)("div",{className:"outreach-directory__groups","aria-label":"Schularten",children:Object.entries(_.groups).map(e=>{var s,n;let[t,a]=e;return(0,o.jsxs)("button",{type:"button",className:"outreach-directory__group--".concat(t).concat(Y===t?" active":""),onClick:()=>ms(J,Y===t?"":t),children:[(0,o.jsx)("span",{children:a}),(0,o.jsx)("strong",{children:Qn(_.file_counts[t])}),(0,o.jsxs)("small",{children:[Qn((null===(s=_.profiles)||void 0===s||null===(n=s.by_group)||void 0===n?void 0:n[t])||0)," mit Profil"]})]},t)})}),(0,o.jsx)("small",{children:"Schulen k\xf6nnen mehreren Schulartgruppen angeh\xf6ren; die Gesamtzahl z\xe4hlt jeden Verzeichniseintrag einmal. Z\xfcrich: Nebenstandorte sind unter der Hauptschule zusammengefasst."})]}),(0,o.jsxs)("details",{className:"outreach-directory__data-notes",children:[(0,o.jsx)("summary",{children:"Datenstand & Abgleich"}),G&&(0,o.jsxs)("small",{children:["HubSpot-Abgleich l\xe4uft in gr\xf6\xdfenbegrenzten Teilanfragen f\xfcr ",Qn(os.length)," Schulen."]}),V&&(0,o.jsx)("p",{className:"outreach-directory__error",role:"alert",children:V}),P&&(0,o.jsxs)("small",{children:["HubSpot: ",Qn(P.company_count)," Companies und ",Qn(P.deal_count)," Deals gelesen am ",Yn(P.deals_retrieved_at_utc),". Deals erscheinen nur bei eindeutig zugeordneten Companies; CRM-Aktivit\xe4ten und Status bleiben in HubSpot f\xfchrend."]}),H&&(0,o.jsxs)("small",{children:["LivingLines-Lizenzen: ",Qn(Ls)," Schulen zugeordnet, davon ",Qn(Es)," mit Nutzung in den letzten 90 Tagen \xb7 Stand ",Yn(H.retrieved_at_utc),". Automatische Nummernzuordnung bleibt auf Bayern begrenzt; neue Regionen brauchen eine manuelle Verkn\xfcpfung. Namensgleichheiten bitte pr\xfcfen."]}),W&&(0,o.jsx)("small",{className:"outreach-directory__error",children:W}),(0,o.jsxs)("details",{className:"outreach-directory__coverage",children:[(0,o.jsx)("summary",{children:"Datenabdeckung und Quellen je Region"}),(0,o.jsxs)("table",{children:[(0,o.jsx)("thead",{children:(0,o.jsxs)("tr",{children:[(0,o.jsx)("th",{children:"Region"}),(0,o.jsx)("th",{children:"Schulen"}),(0,o.jsx)("th",{children:"Sch\xfclerzahl"}),(0,o.jsx)("th",{children:"Lehrkr\xe4ftezahl"}),(0,o.jsx)("th",{children:"E-Mail"})]})}),(0,o.jsx)("tbody",{children:f.regions.map(e=>(0,o.jsxs)("tr",{children:[(0,o.jsx)("td",{children:e.label}),(0,o.jsx)("td",{children:Qn(e.school_count)}),(0,o.jsx)("td",{children:Qn(e.coverage.pupil_count)}),(0,o.jsx)("td",{children:Qn(e.coverage.teacher_count)}),(0,o.jsx)("td",{children:Qn(e.coverage.email)})]},e.id))})]}),f.regions.map(e=>(0,o.jsxs)("p",{children:[(0,o.jsxs)("strong",{children:[e.label,":"]}
1)," ",e.note," ",e.source_urls.map(e=>(0,o.jsx)("a",{href:e,target:"_blank",rel:"noopener noreferrer",children:"Amtliche Quelle \u2197 "},e)),(0,o.jsx)("small",{children:e.license})]},e.id))]})]})]})]}):(0,o.jsx)("div",{role:"tabpanel",id:"outreach-panel-profile","aria-labelledby":"outreach-tab-profile",children:ss?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{className:"outreach-directory__aside-header",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("span",{className:"outreach-directory__eyebrow",children:"SCHULAKQUISE \xb7 DACH"}),(0,o.jsx)("h4",{children:ss.name}),(0,o.jsx)("span",{className:"outreach-directory__school-type",children:ss.fos_bos_profile||ss.school_type}),(0,o.jsxs)("small",{className:"outreach-directory__grade-label",title:vs.note,children:[vs.label,vs.possibleGrades.length>0&&" \xb7 ggf. ".concat(Wn(vs.possibleGrades))]})]}),(0,o.jsx)("button",{type:"button",className:"outreach-directory__copy",onClick:async()=>{if(!ss)return;const e=((e,s,n,t,a)=>{var l,i,r,c;const o=Zn(e),d="".concat(o.label).concat(o.possibleGrades.length?" \xb7 m\xf6glich: ".concat(Wn(o.possibleGrades)):""," (").concat(o.note,")"),u=["# ".concat(e.name),"**".concat(e.fos_bos_profile||e.school_type,"** \xb7 ").concat(e.postal_code," ").concat(e.city),"","## Kurzprofil","- Adresse: ".concat([e.street,"".concat(e.postal_code," ").concat(e.city)].filter(Boolean).join(", ")),"- Schulnummer: ".concat(Jn(e.official_id)),"- Klassenstufen: ".concat(d),"- Sch\xfcler:innen: ".concat(e.pupil_count?Qn(e.pupil_count):"unbekannt").concat(e.school_year?" (".concat(e.school_year,")"):""),"- Lehrkr\xe4fte: ".concat(e.teacher_count?Qn(e.teacher_count):"unbekannt"),"- Rechtlicher Status: ".concat(Jn(e.legal_status)),...null!==(l=e.sponsor)&&void 0!==l&&l.name?["- Tr\xe4ger-Zuordnung: ".concat(e.sponsor.name," (").concat(e.sponsor.basis,")")]:[],...null!==(i=e.school_cost_bearer)&&void 0!==i&&i.name?["- Sachaufwandstr\xe4ger: ".concat(e.school_cost_bearer.name," (").concat(e.school_cost_bearer.basis,")")]:[],"- Richtpreis Schullizenz: ".concat((0,y.eB)(e)?"".concat(qn((0,y.eB)(e).price)," / Jahr"):"offen"," (Listenrichtpreis)"),...e.website?["- Website: ".concat($n(e.website,e.website))]:[],...e.profile_url?["- Amtliches Schulprofil: ".concat($n("\xf6ffnen",e.profile_url))]:[],"","## F\xf6rderprogramm","- Startchancen: ".concat("confirmed"===e.startchancen?"eindeutig zugeordnet":"unbekannt; kein Treffer ist kein Nachweis der Nichtteilnahme")],h=['<h1 style="margin:0 0 6px;color:#173b57">'.concat(et(e.name),"</h1>"),'<p style="margin:0 0 20px;color:#526174"><strong>'.concat(et(e.fos_bos_profile||e.school_type),"</strong> \xb7 ").concat(et(e.postal_code)," ").concat(et(e.city),"</p>"),'<h2 style="margin:20px 0 8px;color:#173b57">Kurzprofil</h2><ul style="margin:0;padding-left:22px">',"<li><strong>Adresse:</strong> ".concat(et([e.street,"".concat(e.postal_code," ").concat(e.city)].filter(Boolean).join(", ")),"</li>"),"<li><strong>Schulnummer:</strong> ".concat(et(Jn(e.official_id)),"</li>"),"<li><strong>Klassenstufen:</strong> ".concat(et(d),"</li>"),"<li><strong>Sch\xfcler:innen:</strong> ".concat(et(e.pupil_count?Qn(e.pupil_count):"unbekannt")).concat(e.school_year?" (".concat(et(e.school_year),")"):"","</li>"),"<li><strong>Lehrkr\xe4fte:</strong> ".concat(et(e.teacher_count?Qn(e.teacher_count):"unbekannt"),"</li>"),"<li><strong>Rechtlicher Status:</strong> ".concat(et(Jn(e.legal_status)),"</li>"),...null!==(r=e.sponsor)&&void 0!==r&&r.name?["<li><strong>Tr\xe4ger-Zuordnung:</strong> ".concat(et(e.sponsor.name),' <span style="color:#64748b">(').concat(et(e.sponsor.basis),")</span></li>")]:[],...null!==(c=e.school_cost_bearer)&&void 0!==c&&c.name?["<li><strong>Sachaufwandstr\xe4ger:</strong> ".concat(et(e.school_cost_bearer.name),' <span style="color:#64748b">(').concat(et(e.school_cost_bearer.basis),")</span></li>")]:[],"<li><strong>Richtpreis Schullizenz:</strong> ".concat(et((0,y.eB)(e)?"".concat(qn((0,y.eB)(e).price)," / Jahr"):"offen")," (Listenrichtpreis)</li>"),...Xn(e.website)?['<li><strong>Website:</strong> <a href="'.concat(et(Xn(e.website)),'">').concat(et(e.website),"</a></li>")]:[],...Xn(e.profile_url)?['<li><strong>Amtliches Schulprofil:</strong> <a href="'.concat(et(Xn(e.profile_url)),'">\xf6ffnen</a></li>')]:[],'</ul><h2 style="margin:20px 0 8px;color:#173b57">F\xf6rderprogramm</h2><ul style="margin:0;padding-left:22px">',"<li><strong>Startchancen:</strong> ".concat(et("confirmed"===e.startchancen?"eindeutig zugeordnet":"unbekannt; kein Treffer ist kein Nachweis der Nichtteilnahme"),"</li></ul>")];
1if(e.education_tracks&&(u.push("- Ausbildungsrichtungen: ".concat(e.education_tracks)),h.push("<p><strong>Ausbildungsrichtungen:</strong> ".concat(et(e.education_tracks),"</p>"))),null!==a&&void 0!==a&&a.school){const e=a.school;u.push("","## LivingLines-Lizenz & Nutzung","- Zuordnung: ".concat(lt(a)),"- Lizenz: ".concat(ct(e)," \xb7 ").concat(e.license_start_date||"Start offen"," bis ").concat(e.license_end_date||"unbefristet"),"- Lehrkr\xe4fte: ".concat(Qn(e.teacher_count)).concat(null!=e.max_teachers?" / ".concat(Qn(e.max_teachers)," Pl\xe4tze"):""),"- Klassen / Sch\xfcler:innen / Arbeitsbl\xe4tter: ".concat(Qn(e.class_count)," / ").concat(Qn(e.student_count)," / ").concat(Qn(e.sheet_count)),"- Aktiv in 90 Tagen: ".concat(Qn(e.active_teacher_count_90d)," Lehrkr\xe4fte, ").concat(Qn(e.active_student_count_90d)," Sch\xfcler:innen, ").concat(Qn(e.updated_task_count_90d)," zuletzt aktualisierte Aufgabenst\xe4nde")),h.push('<h2 style="margin:20px 0 8px;color:#173b57">LivingLines-Lizenz &amp; Nutzung</h2><ul style="margin:0;padding-left:22px">',"<li><strong>Zuordnung:</strong> ".concat(et(lt(a)),"</li>"),"<li><strong>Lizenz:</strong> ".concat(et(ct(e))," \xb7 ").concat(et(e.license_start_date||"Start offen")," bis ").concat(et(e.license_end_date||"unbefristet"),"</li>"),"<li><strong>Lehrkr\xe4fte:</strong> ".concat(et(Qn(e.teacher_count))).concat(null!=e.max_teachers?" / ".concat(et(Qn(e.max_teachers))," Pl\xe4tze"):"","</li>"),"<li><strong>Klassen / Sch\xfcler:innen / Arbeitsbl\xe4tter:</strong> ".concat(et(Qn(e.class_count))," / ").concat(et(Qn(e.student_count))," / ").concat(et(Qn(e.sheet_count)),"</li>"),"<li><strong>Aktiv in 90 Tagen:</strong> ".concat(et(Qn(e.active_teacher_count_90d))," Lehrkr\xe4fte, ").concat(et(Qn(e.active_student_count_90d))," Sch\xfcler:innen, ").concat(et(Qn(e.updated_task_count_90d))," zuletzt aktualisierte Aufgabenst\xe4nde</li></ul>"))}var m,p;if(e.bearer_finance&&(u.push("","## Finanzlage des Tr\xe4gers","- Tr\xe4ger: ".concat(e.bearer_finance_link.name),...e.bearer_finance.metrics.map(e=>"- ".concat(e.label,": ").concat(qn(e.value)).concat("EUR/resident"===e.unit?" je Einwohner":""," (").concat(e.year,"); ").concat(e.source_url)),"- Haushaltslage: ".concat((null===(m=e.bearer_finance.household_status)||void 0===m?void 0:m.label)||"nicht erhoben"),"- Tr\xe4gerkennzahlen sind kein verf\xfcgbares Schulbudget."),h.push("<h2>Finanzlage des Tr\xe4gers</h2>","<p>".concat(et(e.bearer_finance_link.name),"</p><ul>"),...e.bearer_finance.metrics.map(e=>"<li>".concat(et(e.label),": ").concat(et(qn(e.value))).concat("EUR/resident"===e.unit?" je Einwohner":""," (").concat(e.year,'); <a href="').concat(et(e.source_url),'">Quelle</a></li>')),"</ul><p>Tr\xe4gerkennzahlen sind kein verf\xfcgbares Schulbudget.</p>")),e.finance_eur_per_resident){var g;const n=(null===(g=s.municipal_budget_alerts)||void 0===g?void 0:g.filter(s=>s.municipality_ags===e.municipality_ags))||[];u.push("","## Finanzkontext der Standortkommune","- Kommune: ".concat(Jn(e.municipality_name)," (AGS ").concat(Jn(e.municipality_ags),")"),"- Finanzkraft ".concat(Jn(e.finance_year),": ").concat(qn(e.finance_eur_per_resident)," je Einwohner"),"- Vorjahr ".concat(Jn(e.previous_year),": ").concat(qn(e.previous_finance_eur_per_resident)," je Einwohner"),"- Hinweis: Finanzkraft beschreibt die Standortkommune, nicht das Schulbudget oder den verifizierten Schulaufwandstr\xe4ger.",...n.map(e=>"- Haushaltshinweis: ".concat(e.status," (").concat(e.year,"); gilt f\xfcr die Kommune, nicht automatisch f\xfcr den Schultr\xe4ger.").concat(Xn(e.source_url)?" Quelle: ".concat($n("Stadtmitteilung",e.source_url),"."):"")),...e.finance_source_url?["- Quelle: ".concat($n("Bayerisches Landesamt f\xfcr Statistik",e.finance_source_url))]:[]),h.push('<h2 style="margin:20px 0 8px;color:#173b57">Finanzkontext der Standortkommune</h2><ul style="margin:0;padding-left:22px">',"<li><strong>Kommune:</strong> ".concat(et(Jn(e.municipality_name))," (AGS ").concat(et(Jn(e.municipality_ags)),")</li>"),"<li><strong>Finanzkraft ".concat(et(Jn(e.finance_year)),":</strong> ").concat(et(qn(e.finance_eur_per_resident))," je Einwohner</li>"),"<li><strong>Vorjahr ".concat(et(Jn(e.previous_year)),":</strong> ").concat(et(qn(e.previous_finance_eur_per_resident))," je Einwohner</li>"),"<li>Finanzkraft beschreibt die Standortkommune, nicht das Schulbudget oder den verifizierten Schulaufwandstr\xe4ger.</li>",...n.map(e=>"<li><strong>Haushaltshinweis:</strong> ".concat(et(e.status)," (").concat(et(e.year),"); gilt f\xfcr die Kommune, nicht automatisch f\xfcr den Schultr\xe4ger.").concat(Xn(e.source_url)?' <a href="'.concat(et(Xn(e.source_url)),'">Stadtmitteilung</a>'):"","</li>
1")),...Xn(e.finance_source_url)?['<li><strong>Quelle:</strong> <a href="'.concat(et(Xn(e.finance_source_url)),'">Bayerisches Landesamt f\xfcr Statistik</a></li>')]:[],"</ul>")}return n?(u.push("","## HubSpot","- Zuordnung: ".concat("high"===n.status?"eindeutig":"m\xf6glich; bitte manuell pr\xfcfen"),"- Company: ".concat(Jn(n.company_name)),"- Evidenz: ".concat(Jn(n.evidence)),"- Lifecycle: ".concat(Jn(n.lifecyclestage)),"- Nutzung: ".concat(Jn(n.nutzung)),"- Letzter Kontakt: ".concat(Yn(n.last_contacted)),...n.url?["- ".concat($n("Company in HubSpot \xf6ffnen",n.url))]:[],"- HubSpot-Daten abgerufen: ".concat(Yn(t))),h.push('<h2 style="margin:20px 0 8px;color:#173b57">HubSpot</h2><ul style="margin:0;padding-left:22px">',"<li><strong>Zuordnung:</strong> ".concat(et("high"===n.status?"eindeutig":"m\xf6glich; bitte manuell pr\xfcfen"),"</li>"),"<li><strong>Company:</strong> ".concat(et(Jn(n.company_name)),"</li>"),"<li><strong>Evidenz:</strong> ".concat(et(Jn(n.evidence)),"</li>"),"<li><strong>Lifecycle:</strong> ".concat(et(Jn(n.lifecyclestage)),"</li>"),"<li><strong>Nutzung:</strong> ".concat(et(Jn(n.nutzung)),"</li>"),"<li><strong>Letzter Kontakt:</strong> ".concat(et(Yn(n.last_contacted)),"</li>"),...Xn(n.url)?['<li><a href="'.concat(et(Xn(n.url)),'">Company in HubSpot \xf6ffnen</a></li>')]:[],"<li><strong>Abgerufen:</strong> ".concat(et(Yn(t)),"</li>"),"</ul>"),"high"===n.status&&(u.push("","### Deals"),h.push('<h3 style="margin:16px 0 8px;color:#173b57">Deals</h3>'),null!==(p=n.deals)&&void 0!==p&&p.length?n.deals.forEach(e=>{u.push("- ".concat($n(e.name||"Deal ".concat(e.id),e.url)," \xb7 ").concat(Jn(e.pipeline)," \xb7 ").concat(Jn(e.stage)," \xb7 ").concat(Un(e)," \xb7 Abschluss: ").concat(Yn(e.close_date))),h.push('<p style="margin:0 0 10px">'.concat(Xn(e.url)?'<a href="'.concat(et(Xn(e.url)),'">'):"","<strong>").concat(et(e.name||"Deal ".concat(e.id)),"</strong>").concat(Xn(e.url)?"</a>":"","<br>").concat(et(Jn(e.pipeline))," \xb7 ").concat(et(Jn(e.stage))," \xb7 ").concat(et(Un(e)),"<br>Abschluss: ").concat(et(Yn(e.close_date)),"</p>"))}):(u.push("- Keine zugeordneten Deals gefunden."),h.push("<p>Keine zugeordneten Deals gefunden.</p>")))):(u.push("","## HubSpot","- Noch nicht abgeglichen."),h.push('<h2 style="margin:20px 0 8px;color:#173b57">HubSpot</h2><p>Noch nicht abgeglichen.</p>')),u.push("","## Quellen","- Schulstandort: ".concat($n("Amtliche Quelldaten",e.source_url)),...e.profile_url?["- Schuldaten: ".concat($n("Amtliches Schulprofil",e.profile_url)," (Abruf ").concat(Yn(e.profile_retrieved_at_utc),")")]:[],..."confirmed"===e.startchancen&&(e.startchancen_source_url||s.startchancen.source_url)?["- ".concat($n("Startchancen-Liste",e.startchancen_source_url||s.startchancen.source_url))]:[],"- Schulstandortdaten abgerufen: ".concat(Yn(e.retrieved_at_utc))),h.push('<h2 style="margin:20px 0 8px;color:#173b57">Quellen</h2><ul style="margin:0;padding-left:22px">',"<li>".concat(Xn(e.source_url)?'<a href="'.concat(et(Xn(e.source_url)),'">Amtliche Quelldaten</a>'):"Amtliche Quelldaten","</li>"),...Xn(e.profile_url)?['<li><a href="'.concat(et(Xn(e.profile_url)),'">Amtliches Schulprofil</a> (Abruf ').concat(et(Yn(e.profile_retrieved_at_utc)),")</li>")]:[],..."confirmed"===e.startchancen&&Xn(e.startchancen_source_url||s.startchancen.source_url)?['<li><a href="'.concat(et(Xn(e.startchancen_source_url||s.startchancen.source_url)),'">Startchancen-Liste</a></li>')]:[],"<li>Schulstandortdaten abgerufen: ".concat(et(Yn(e.retrieved_at_utc)),"</li></ul>")),{text:u.join("\n"),html:'<div style="font-family:Arial,sans-serif;color:#263445;line-height:1.5">'.concat(h.join(""),"</div>")}})(ss,_,null===P||void 0===P?void 0:P.matches[ss.source_feature_id],null===P||void 0===P?void 0:P.retrieved_at_utc,cs(ss,null===H||void 0===H||H.schools));try{var s,n;if(null!==(s=navigator.clipboard)&&void 0!==s&&s.write&&window.ClipboardItem)await navigator.clipboard.write([new window.ClipboardItem({"text/plain":new Blob([e.text],{type:"text/plain"}),"text/html":new Blob([e.html],{type:"text/html"})})]);else{if(null===(n=navigator.clipboard)||void 0===n||!n.writeText)throw new Error("Clipboard API unavailable");await navigator.clipboard.writeText(e.text)}as(!0),window.setTimeout(()=>as(!1),1800)}catch(t){const s=document.createElement("textarea");s.value=e.text,s.setAttribute("readonly",""),s.style.position="fixed",s.style.opacity="0",document.body.appendChild(s),s.select();const n=document.execCommand("copy");s.remove(),as(n),n&&window.setTimeout(()=>as(!1),1800)}},"aria-label":ts?"Schulzusammenfassung kopiert":"Schulzusammenfassung kopieren","aria-live":"polite",title:ts?"Kopiert":"Schulzusammenfassung kopieren",children:ts?(0,o.jsx)(Pe.YrT,{"aria-hidden":"true"}):(0,o.jsx)(Pe.nxz,{"aria-hidden":"true"})})]}),(0,o.jsxs)("section",{className:"outreach-directory__aside-section",children:[(0,o.jsx)("h5",{children:"Steckbrief"}),(0,o.jsxs)("dl",{className:"outreach-directory__facts",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("dt",{children:"Adresse"}),(0,o.jsxs)("dd",{children:[ss.street||"\u2013",ss.street&&(0,o.jsx)("br",{}),ss.postal_code," ",ss.city]})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("dt",{children:"Land / Region"}),(0,o.jsxs)("dd",{children:[ss.country," \xb7 ",ss.subregion_name||ss.region_name]})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("dt",{children:"Schulnummer"}),(0,o.jsx)("dd",{children:ss.official_id||"\u2013"})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("dt",{children:"Klassenstufen"}),(0,o.jsxs)("dd",{children:[vs.label,vs.possibleGrades.length>0&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("br",{}),(0,o.jsxs)("small",{children:["M\xf6glich: ",Wn(vs.possibleGrades)]})]}),(0,o.jsx)("br",{}),(0,o.jsx)("small",{className:"outreach-directory__muted",children:vs.note}),vs.sourceUrls.map((e,s)=>(0,o.jsxs)(l.Fragment,{children:[" \xb7 ",(0,o.jsxs)("a",{href:e,target:"_blank",rel:"noopener noreferrer",children:["reported"===vs.basis?"Profilquelle":"Zuordnung ".concat(s+1)," \u2197"]})]},e))]})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("dt",{children:"Sch\xfcler:innen"}),(0,o.jsx)("dd",{children:ss.pupil_count?"".concat(Qn(ss.pupil_count)).concat(ss.school_year?" \xb7 ".concat(ss.school_year):""):"Unbekannt"})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("dt",{children:"Lehrkr\xe4fte"}),(0,o.jsx)("dd",{children:ss.teacher_count?Qn(ss.teacher_count):"Unbekannt"})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("dt",{children:"Schulstatus"}),(0,o.jsx)("dd",{children:ss.legal_status||"Unbekannt"})]}),(null===(n=ss.school_cost_bearer)||void 0===n?void 0:n.name)&&(0,o.jsxs)("div",{children:[(0,o.jsx)("dt",{children:"Sachaufwand"}),(0,o.jsxs)("dd",{children:[(0,o.jsx)("strong",{children:ss.school_cost_bearer.name}),(0,o.jsx)("br",{}),(0,o.jsxs)("span",{className:"outreach-directory__muted",children:[ss.school_cost_bearer.basis," \xb7 ",(0,o.jsx)("a",{href:ss.school_cost_bearer.source_url,target:"_blank",rel:"noopener noreferrer",children:"Quelle \u2197"})]})]})]}),(null===(t=ss.sponsor)||void 0===t?void 0:t.name)&&(0,o.jsxs)("div",{children:[(0,o.jsx)("dt",{children:"Tr\xe4gerhinweis"}),(0,o.jsxs)("dd",{children:[(0,o.jsx)("strong",{children:ss.sponsor.name}),(0,o.jsx)("br",{}),(0,o.jsxs)("span",{className:"outreach-directory__muted",children:[ss.sponsor.basis," \xb7 ","high"===ss.sponsor.confidence?"hohe":"mittlere"," Sicherheit"]})]})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("dt",{children:"Schullizenz / Jahr"}),(0,o.jsxs)("dd",{children:[(0,o.jsx)("strong",{children:(0,y.eB)(ss)?qn((0,y.eB)(ss).price):"Preis offen"})," ",(0,o.jsx)("span",{className:"outreach-directory__muted",children:"Listenrichtpreis"})]})]})]}),ss.pupil_count_source_url&&(0,o.jsxs)("p",{className:"outreach-directory__fact-line",children:["Sch\xfclerzahl: ",(0,o.jsx)("a",{href:ss.pupil_count_source_url,target:"_blank",rel:"noopener noreferrer",children:"Quelle \u2197"}),ss.pupil_count_scope?" \xb7 ".concat(ss.pupil_count_scope):"",ss.pupil_count_approximate?" \xb7 gerundet":""]}),ss.site_pupil_count&&(0,o.jsxs)("p",{className:"outreach-directory__fact-line",children:["Davon an diesem Standort: ",Qn(ss.site_pupil_count)]}),(null===(i=ss.ganztag)||void 0===i?void 0:i.length)>0&&(0,o.jsxs)("p",{className:"outreach-directory__fact-line",children:["Ganztag: ",ss.ganztag.join(", ")
1]}),ss.pupil_count_year_note&&(0,o.jsxs)("p",{className:"outreach-directory__fact-line",children:["Zahlenstand: ",ss.pupil_count_year_note]}),ss.pupil_count_scope&&"Schule"!==ss.pupil_count_scope&&(0,o.jsx)("p",{className:"outreach-directory__fact-line",children:"F\xfcr einen Schullizenzpreis fehlt die Gesamtsch\xfclerzahl der Schule."}),ss.pupil_count_rounding_margin>0&&ss.pupil_count>0&&ss.pupil_count<1500&&!(0,y.eB)(ss)&&(0,o.jsx)("p",{className:"outreach-directory__fact-line",children:"Die gerundete Sch\xfclerzahl liegt an einer Preisgrenze. Vor dem Angebot bitte die aktuelle Gesamtzahl best\xe4tigen."}),ss.school_type_basis&&(0,o.jsxs)("p",{className:"outreach-directory__fact-line",children:["Schulart: ",ss.school_type_basis]}),ss.profile_review_note&&(0,o.jsxs)("p",{className:"outreach-directory__fact-line",children:["Profilhinweis: ",ss.profile_review_note]}),ss.email&&(0,o.jsxs)("p",{className:"outreach-directory__fact-line",children:["E-Mail ",(0,o.jsx)("a",{href:"mailto:".concat(ss.email),children:ss.email})]}),ss.pedagogical_email&&(0,o.jsxs)("p",{className:"outreach-directory__fact-line",children:["P\xe4dagogik ",(0,o.jsx)("a",{href:"mailto:".concat(ss.pedagogical_email),children:ss.pedagogical_email})]}),ss.sponsor_category&&(0,o.jsxs)("p",{className:"outreach-directory__fact-line",children:["Schulerhalter-Kategorie: ",ss.sponsor_category]}),ss.location_count>1&&(0,o.jsxs)("details",{children:[(0,o.jsxs)("summary",{children:[ss.location_count," Schulstandorte"]}),ss.locations.map((e,s)=>(0,o.jsxs)("p",{children:[e.kind,": ",e.street,", ",e.postal_code," ",e.city]},s))]}),ss.phone&&(0,o.jsxs)("p",{className:"outreach-directory__fact-line",children:["Telefon ",(0,o.jsx)("a",{href:"tel:".concat(ss.phone.replace(/[^+\d]/g,"")),children:ss.phone})]}),ss.website&&(0,o.jsxs)("p",{className:"outreach-directory__fact-line",children:["Website ",(0,o.jsx)("a",{href:ss.website,target:"_blank",rel:"noopener noreferrer",children:ss.website})]}),ss.education_tracks&&(0,o.jsxs)("p",{className:"outreach-directory__fact-line",children:["Ausbildungsrichtungen: ",ss.education_tracks]}),"DE-BY"===ss.region&&(0,o.jsx)("a",{className:"outreach-directory__pricing-link",href:"/preise?schule=".concat(encodeURIComponent(ss.id)),target:"_blank",rel:"noopener noreferrer",children:"Schullizenz mit diesen Angaben ansehen \u2197"})]}),xs&&(0,o.jsxs)("section",{className:"outreach-directory__aside-section outreach-directory__operator-aside",children:[(0,o.jsx)("h5",{children:"Private Tr\xe4gergruppe"}),(0,o.jsx)("strong",{children:xs.name}),(0,o.jsxs)("p",{children:[Ce.memberships[ss.id].basis,". Gruppenmitgliedschaft; der rechtliche Schultr\xe4ger bleibt separat."]}),(0,o.jsxs)("p",{children:[(0,o.jsx)("strong",{children:xs.finance_label}),(0,o.jsx)("br",{}),xs.finance_note]}),(0,o.jsxs)("a",{href:xs.contact.url,target:"_blank",rel:"noopener noreferrer",children:["Zentraler Kontakt: ",xs.contact.label," \u2197"]}),(0,o.jsxs)("p",{children:[(0,o.jsx)("strong",{children:"Pilotidee:"})," ",xs.pilot_idea]}),(0,o.jsx)("button",{type:"button",onClick:()=>gs(xs.id),children:"Schulen dieser Gruppe anzeigen"})]}),H&&(0,o.jsxs)("section",{className:"outreach-directory__aside-section outreach-directory__local-license".concat(it(cs(ss,H.schools))?" outreach-directory__local-license--exact":""),children:[(0,o.jsx)("h5",{children:"LivingLines-Lizenz & Nutzung"}),(()=>{const e=cs(ss,H.schools);if(null!==e&&void 0!==e&&e.school){const s=e.school;return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{className:"outreach-directory__crm-status ".concat(it(e)?"outreach-directory__crm-status--high":"outreach-directory__crm-status--possible"),children:{official_id:"Eindeutig \xfcber Schulnummer",manual:"Manuell zugeordnet"}[e.confidence]||"Namensgleichheit \xb7 bitte pr\xfcfen"}),(0,o.jsxs)("p",{className:"outreach-directory__hubspot-company",children:[(0,o.jsx)("strong",{children:s.name}),s.official_id&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("br",{}),(0,o.jsxs)("span",{children:["Lokale Schulnummer: ",s.official_id]})]})]}),(0,o.jsxs)("dl",{className:"outreach-directory__facts outreach-directory__facts--compact",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("dt",{children:"Lizenz"}),(0,o.jsx)("dd",{children:ct(s)})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("dt",{children:"Laufzeit"}),(0,o.jsxs)("dd",{children:[s.license_start_date||"Start offen"," \u2013 ",s.license_end_date||"unbefristet"]})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("dt",{children:"Lehrkr\xe4fte"}),(0,o.jsxs)("dd",{children:[Qn(s.teacher_count),null!=s.max_teachers?" / ".concat(Qn(s.max_teachers)," Pl\xe4tze"):""]})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("dt",{children:"Klassen"}),(0,o.jsx)("dd",{children:Qn(s.class_count)})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("dt",{children:"Sch\xfcler:innen"}),(0,o.jsx)("dd",{children:Qn(s.student_count)}
1)]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("dt",{children:"Arbeitsbl\xe4tter"}),(0,o.jsx)("dd",{children:Qn(s.sheet_count)})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("dt",{children:"Aktiv, 90 Tage"}),(0,o.jsxs)("dd",{children:[Qn(s.active_teacher_count_90d)," Lehrkr\xe4fte \xb7 ",Qn(s.active_student_count_90d)," Sch\xfcler:innen"]})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("dt",{children:"Aufgabenst\xe4nde aktualisiert, 90 Tage"}),(0,o.jsx)("dd",{children:Qn(s.updated_task_count_90d)})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("dt",{children:"Letzte Nutzung"}),(0,o.jsx)("dd",{children:Yn(s.last_activity_at)})]})]})]})}return null!==e&&void 0!==e&&e.ambiguous?(0,o.jsxs)("p",{children:[Qn(e.candidates.length)," lokale Schulen mit passendem Namen; bitte manuell zuordnen."]}):(0,o.jsx)("p",{children:"Keine lokale Lizenzschule \xfcber Schulnummer oder eindeutigen Namensabgleich gefunden."})})()]}),"confirmed"===ss.startchancen&&(0,o.jsxs)("section",{className:"outreach-directory__aside-section outreach-directory__startchancen",children:[(0,o.jsx)("h5",{children:"F\xf6rderprogramme"}),(0,o.jsx)("strong",{children:"Startchancen-Schule"}),(0,o.jsx)("a",{href:ss.startchancen_source_url||_.startchancen.source_url,target:"_blank",rel:"noopener noreferrer",children:"Amtliche Startchancen-Liste \u2197"})]}),(0,o.jsxs)("section",{className:"outreach-directory__aside-section",children:[(0,o.jsx)("h5",{children:"Finanzlage des Tr\xe4gers"}),ss.bearer_finance?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("p",{children:[(0,o.jsx)("strong",{children:ss.bearer_finance_link.name}),(0,o.jsx)("br",{}),(0,o.jsx)("small",{children:ss.bearer_finance_link.basis})]}),ss.bearer_finance.metrics.length?(0,o.jsx)("dl",{children:ss.bearer_finance.metrics.map(e=>(0,o.jsxs)(l.Fragment,{children:[(0,o.jsx)("dt",{children:e.label}),(0,o.jsxs)("dd",{children:[qn(e.value),"EUR/resident"===e.unit?" / Einw.":""," \xb7 ",e.year,(0,o.jsx)("br",{}),(0,o.jsxs)("small",{children:[e.status,e.derivation&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("br",{}),e.derivation]})]})," ",(0,o.jsx)("a",{href:e.source_url,target:"_blank",rel:"noopener noreferrer",children:"Quelle \u2197"})]})]},e.key))}):(0,o.jsx)("p",{children:ss.bearer_finance.pending_note||"Keine belastbaren Finanzkennzahlen f\xfcr diesen Tr\xe4ger vorhanden."}),ss.bearer_finance.household_status&&(0,o.jsxs)("p",{children:[(0,o.jsx)("strong",{children:"Haushaltslage:"})," ",ss.bearer_finance.household_status.label," \xb7 ",ss.bearer_finance.household_status.year]}),!ss.bearer_finance.household_status&&(0,o.jsx)("small",{children:"Haushaltslage nicht erhoben."}),ss.bearer_finance.pending_source_url&&(0,o.jsx)("p",{children:(0,o.jsx)("a",{href:ss.bearer_finance.pending_source_url,target:"_blank",rel:"noopener noreferrer",children:"Amtliche Finanzdaten \u2197"})}),(0,o.jsx)("p",{className:"outreach-directory__caution",children:"Kennzahlen des Tr\xe4gers, kein verf\xfcgbares Schulbudget. Landesvergleiche ber\xfccksichtigen nur denselben Indikator, dasselbe Jahr und dieselbe K\xf6rperschaftsart."})]}):(0,o.jsx)("p",{children:"Der zust\xe4ndige Tr\xe4ger ist noch nicht best\xe4tigt. Ein Standortwert beschreibt nicht die Finanzlage des Schultr\xe4gers."})]}),ss.location_finance&&(0,o.jsxs)("section",{className:"outreach-directory__aside-section",children:[(0,o.jsx)("h5",{children:"Regionaler Standortkontext"}),(0,o.jsxs)("p",{children:[(0,o.jsx)("strong",{children:ss.location_finance.name}),ss.district&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("br",{}),ss.district]})]}),ss.location_finance.metrics.filter(e=>"EUR/resident"===e.unit).map(e=>(0,o.jsxs)("p",{children:[e.label,": ",(0,o.jsxs)("strong",{children:[qn(e.value)," / Einw."]})," \xb7 ",e.year," ",(0,o.jsx)("a",{href:e.source_url,target:"_blank",rel:"noopener noreferrer",children:"Quelle \u2197"})]},e.key)),(0,o.jsx)("small",{children:"Beschreibt die Standortgemeinde, unabh\xe4ngig vom Tr\xe4ger dieser Schule. Private und Kreisschulen erhalten daraus keine Tr\xe4gerbewertung."})]}),ss.finance_eur_per_resident&&(0,o.jsxs)("section",{className:"outreach-directory__aside-section",children:[(0,o.jsx)("h5",{children:"Finanzkontext der Standortkommune"}),(0,o.jsxs)("p",{children:[(0,o.jsx)("strong",{children:ss.municipality_name})," \xb7 AGS ",ss.municipality_ags,(0,o.jsx)("br",{}),"Finanzkraft ",ss.finance_year,": ",qn(ss.finance_eur_per_resident)," je Einwohner",(0,o.jsx)("br",{}),"Vorjahr ",ss.previous_year,": ",qn(ss.previous_finance_eur_per_resident)," je Einwohner"]}),(0,o.jsx)("p",{className:"outreach-directory__note",children:"Das ist ein allgemeiner Wert der Standortkommune, kein Schulbudget und kein best\xe4tigter Schulaufwandstr\xe4ger."}),null===(r=_.municipal_budget_alerts)||void 0===r?void 0:r.filter(e=>e.municipality_ags===ss.municipality_ags).map(e=>(0,o.jsxs)("p",{className:"outreach-directory__alert",children:[(0,o.jsxs)("strong",{children:[e.status," (",e.year,")"]})," \xb7 ",(0,o.jsxs)("a",{href:e.source_url,target:"_blank",rel:"noopener noreferrer",children:["Quelle vom ",e.published_on]})]},e.municipality_ags)),(0,o.jsx)("a",{href:ss.finance_source_url,target:"_blank",rel:"noopener noreferrer",children:"Amtliche Finanzdaten"}),(0,o.jsxs)("small",{children:["Abgerufen ",Yn(ss.finance_retrieved_at_utc)]})]}),P&&(0,o.jsxs)("section",{className:"outreach-directory__aside-section outreach-directory__hubspot".concat("high"===(null===(d=P.matches[ss.source_feature_id])||void 0===d?void 0:d.status)?" outreach-directory__hubspot--high":""),children:[(0,o.jsx)("h5",{children:"HubSpot"}),P.matches[ss.source_feature_id]?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{className:"outreach-directory__crm-status outreach-directory__crm-status--".concat(P.matches[ss.source_feature_id].status),children:"high"===P.matches[ss.source_feature_id].status?"\u2713 Eindeutiger HubSpot-Treffer":"M\xf6glicher Treffer \xb7 bitte pr\xfcfen"}),(0,o.jsxs)("p",{className:"outreach-directory__hubspot-company",children:[(0,o.jsx)("strong",{children:P.matches[ss.source_feature_id].company_name}),(0,o.jsx)("br",{}),(0,o.jsxs)("span",{children:["Evidenz: ",P.matches[ss.source_feature_id].evidence]})]}),(0,o.jsxs)("dl",{className:"outreach-directory__facts outreach-directory__facts--compact",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("dt",{children:"Lifecycle"}),(0,o.jsx)("dd",{children:P.matches[ss.source_feature_id].lifecyclestage||"\u2013"})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("dt",{children:"Nutzung"}),(0,o.jsx)("dd",{children:P.matches[ss.source_feature_id].nutzung||"\u2013"})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("dt",{children:"Letzter Kontakt"}),(0,o.jsx)("dd",{children:Yn(P.matches[ss.source_feature_id].last_contacted)})]})]}),(0,o.jsx)("a",{href:P.matches[ss.source_feature_id].url,target:"_blank",rel:"noopener noreferrer",children:"Company in HubSpot \xf6ffnen \u2197"}),"high"===P.matches[ss.source_feature_id].status&&(0,o.jsxs)("div",{className:"outreach-directory__deals",children:[(0,o.jsxs)("h6",{children:["Deal
1s ",(0,o.jsx)("span",{children:Qn((null===(u=P.matches[ss.source_feature_id].deals)||void 0===u?void 0:u.length)||0)})]}),null!==(h=P.matches[ss.source_feature_id].deals)&&void 0!==h&&h.length?P.matches[ss.source_feature_id].deals.map(e=>(0,o.jsxs)("div",{className:"outreach-directory__deal",children:[(0,o.jsx)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",children:(0,o.jsxs)("strong",{children:[e.name||"Deal ".concat(e.id)," \u2197"]})}),(0,o.jsxs)("span",{children:[e.pipeline||"Pipeline offen"," \xb7 ",e.stage||"Status offen"]}),(0,o.jsxs)("span",{children:[Un(e)," \xb7 Abschluss ",Yn(e.close_date)]})]},e.id)):(0,o.jsx)("p",{children:"Keine zugeordneten Deals."})]})]}):(0,o.jsx)("p",{children:"Kein belastbarer Treffer aus den verf\xfcgbaren CRM-Feldern."})]}),(0,o.jsxs)("section",{className:"outreach-directory__aside-sources",children:[(0,o.jsx)("span",{className:"outreach-directory__eyebrow",children:"QUELLEN & AKTUALIT\xc4T"}),(0,o.jsx)("a",{href:ss.source_url,target:"_blank",rel:"noopener noreferrer",children:"Amtliche Standortdaten \u2197"}),ss.profile_url&&(0,o.jsx)("a",{href:ss.profile_url,target:"_blank",rel:"noopener noreferrer",children:"Amtliches Schulprofil \u2197"}),(0,o.jsxs)("small",{children:["Standortdaten abgerufen ",Yn(ss.retrieved_at_utc),ss.profile_retrieved_at_utc?" \xb7 Profil ".concat(Yn(ss.profile_retrieved_at_utc)):""]}),(0,o.jsxs)("small",{children:["Quell-ID: ",ss.id]}),ss.map_point&&(0,o.jsxs)("small",{children:["Kartenstandort: ","postal"===ss.point_accuracy?"ungef\xe4hr \u2013 PLZ-Mittelpunkt":"amtlicher Schulstandort",ss.coordinate_school_year?" \xb7 Geodaten ".concat(ss.coordinate_school_year):""]}),ss.source_data_date&&(0,o.jsxs)("small",{children:["Quellenstand: ",ss.source_data_date]})]})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("h4",{children:"Orte in der Auswahl"}),hs.map(e=>{let[s,n]=e;return(0,o.jsxs)("div",{className:"outreach-directory__city",children:[(0,o.jsx)("span",{children:s}),(0,o.jsx)("strong",{children:Qn(n)}),(0,o.jsx)("i",{style:{width:"".concat(Math.max(3,100*n/Ks),"%")}})]},s)}),(0,o.jsx)("small",{children:"Die Ortsz\xe4hlung verwendet die postalische Ortsangabe, nicht den Landkreis."})]})})]})]}),(0,o.jsxs)("div",{className:"outreach-directory__pager",children:[(0,o.jsx)("span",{children:os.length?"".concat(Qn(50*$e+1),"\u2013").concat(Qn(Math.min(50*($e+1),os.length))," von ").concat(Qn(os.length)):"0 Schulen"}),(0,o.jsx)("button",{type:"button",disabled:0===$e,onClick:()=>es($e-1),children:"Zur\xfcck"}),(0,o.jsx)("button",{type:"button",disabled:50*($e+1)>=os.length,onClick:()=>es($e+1),children:"Weiter"})]}),(0,o.jsxs)("details",{className:"outreach-directory__method",children:[(0,o.jsx)("summary",{children:"Quellen und Abgleich"}),(0,o.jsx)("p",{children:"Tr\xe4gerfinanzen: Baden-W\xfcrttemberg 2026 umfasst 1.101 Gemeinden und 35 Landkreise; 2.805 Schulprofile sind mit einer Tr\xe4gerkennzahl verkn\xfcpft. In Bayern sind zun\xe4chst 28 belegte kommunale Tr\xe4gerzuordnungen mit Finanzwerten 2025 verkn\xfcpft. Standortwerte bleiben separat erhalten. NRW-Tr\xe4ger sind zugeordnet, die Finanzkennzahlen noch offen. Landesvergleiche verwenden dieselbe Kennzahl, dasselbe Jahr und dieselbe K\xf6rperschaftsart; sie zeigen kein verf\xfcgbares Schulbudget."}),(0,o.jsxs)("p",{children:["Bayern \u2013 Schulstandorte: ",(0,o.jsx)("a",{href:"https://data.gov.de/suche/daten/schulstandorte-der-beruflichen-schulen",target:"_blank",rel:"noopener noreferrer",children:"Bayerisches Kultusministerium \xfcber GovData"}),". Startchancen: ",(0,o.jsx)("a",{href:_.startchancen.source_url,target:"_blank",rel:"noopener noreferrer",children:"amtliche Schulliste"}),", abgerufen ",Yn(_.startchancen.retrieved_at_utc),"."]}),(0,o.jsxs)("p",{children:["Bayern: Startchancen \u201eeindeutig zugeordnet\u201c bedeutet exakt normalisierter Schulname und genau ein passender Standort. Die \xfcbrigen Schulen gelten als unbekannt. Von ",Qn(_.startchancen.source_count)," Listeneintr\xe4gen konnten ",Qn(_.startchancen.confirmed_count)," zugeordnet werden; ",Qn(_.startchancen.unresolved_count)," bleiben f\xfcr weitere Schularten oder manuelle Pr\xfcfung offen. Der Abrufzeitpunkt ist kein \xc4nderungsdatum einzelner Schulen."]}),(0,o.jsxs)("p",{children:["Amtliche Profildaten in der geladenen Auswahl: ",Qn((null===(m=_.profiles)||void 0===m?void 0:m.verified_count)||0)," von ",Qn((null===(p=_.profiles)||void 0===p?void 0:p.source_count)||0)," Schulen verf\xfcgbar. Bayern-Zuordnung \xfcber Anschrift, Schulname und Schulart gepr\xfcft; darunter ",Qn((null===(g=_.fos_bos_profiles)||void 0===g?void 0:g.verified_count)||0)," von ",Qn((null===(x=_.fos_bos_profiles)||void 0===x?void 0:x.source_count)||0)," FOS/BOS. Sch\xfcler- und Lehrkr\xe4ftezahl beziehen sich auf das beim jeweiligen Profil angegebene Schuljahr. Fehlende Profile bleiben offen."]}),(0,o.jsxs)("p",{children:["Richtpreis je Schullizenz: bis 250 Sc
1h\xfcler:innen 499 \u20ac, 251\u2013500 899 \u20ac, 501\u2013800 1.199 \u20ac, 801\u20131.499 1.499 \u20ac pro Jahr. Ab 1.500 Sch\xfcler:innen wird ein individuelles Angebot erstellt. Die aggregierten Summen enthalten bekannte Listenrichtpreise und separat gekennzeichnete Sch\xe4tzungen anhand vergleichbarer Schulen. Sie sind weder gebuchter Umsatz noch eine Prognose. Fehlende Sch\xfclerzahlen werden nicht gesch\xe4tzt; individuelle Angebote k\xf6nnen abweichen. ",(0,o.jsx)("a",{href:"/preise",target:"_blank",rel:"noopener noreferrer",children:"Preisquelle"}),"."]}),_.municipal_finances&&(0,o.jsxs)("p",{children:["Kommunale Finanzkraft: ",(0,o.jsxs)("a",{href:_.municipal_finances.source_url,target:"_blank",rel:"noopener noreferrer",children:["Bayerisches Landesamt f\xfcr Statistik, ",_.municipal_finances.year]}),", abgerufen ",Yn(_.municipal_finances.retrieved_at_utc),". ",Qn(_.municipal_finances.matched_count)," von ",Qn(_.municipal_finances.source_count)," Schulen wurden \xfcber einen in Bayern eindeutigen postalischen Ortsnamen einer Gemeinde zugeordnet. Mehrdeutige Orte bleiben offen. Die Finanzkraft je Einwohner ist ein allgemeiner Finanzindikator der Standortkommune, kein frei verf\xfcgbares Schulbudget. Der tats\xe4chliche Schulaufwandstr\xe4ger kann Landkreis, Zweckverband, Kommune oder privat sein. Fehlende Haushaltshinweise bedeuten nicht, dass keine Einschr\xe4nkungen bestehen."]}),(0,o.jsx)("p",{children:"HubSpot wird nur im gesch\xfctzten Admin-Bereich \xfcber das Backend gelesen. Abgleich: Schulart, Ortsangaben, Name und soweit vorhanden Website-Domain; Mehrdeutigkeiten bleiben m\xf6gliche Treffer. Es werden weder CRM-Daten in die \xf6ffentliche Schuldatei geschrieben noch Companies oder Aktivit\xe4ten ver\xe4ndert."}),(0,o.jsxs)("details",{children:[(0,o.jsx)("summary",{children:"Ungekl\xe4rte Startchancen-Eintr\xe4ge anzeigen"}),(0,o.jsx)("div",{className:"outreach-directory__unresolved",children:_.unresolved_startchancen.map((e,s)=>(0,o.jsxs)("p",{children:[e.name," \xb7 ",e.district," \xb7 ",e.reason]},"".concat(e.name,"-").concat(s)))})]})]})]})}const ht=[{key:"aus",label:"Aus",hint:"Nichts wird geplant und nichts verschickt."},{key:"beobachten",label:"Beobachten",hint:"Wird geplant und angezeigt, aber nie verschickt. F\xe4llige Mails landen als \u201eBeobachtet\u201c im Verlauf."},{key:"probe",label:"Probe",hint:"Jede Mail geht nur an die Probeadresse, nie an die Lehrkraft."},{key:"aktiv",label:"Aktiv",hint:"Die Mails gehen an die Lehrkr\xe4fte."}],mt={planned:"Geplant",sent:"Verschickt",probe:"Probe",observed:"Beobachtet",dropped:"Entfallen"},pt={lehrkraft:"je Lehrkraft",klasse:"je Klasse",schule:"je Schule"},gt=e=>(null!==e&&void 0!==e?e:0).toLocaleString("de-DE"),xt=(e,s)=>{if(!s)return"\u2013";const n=e/s;return"".concat((100*n).toLocaleString("de-DE",{maximumFractionDigits:n<.1?1:0})," %")},vt=e=>e?new Date(e).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit"}):"\u2013",jt=e=>{if(!e)return"\u2013";const s=new Date(e),n=Math.round((s.setHours(0,0,0,0)-(new Date).setHours(0,0,0,0))/864e5),t=new Date(e).toLocaleTimeString("de-DE",{hour:"2-digit",minute:"2-digit"});return 0===n?"heute ".concat(t):1===n?"morgen ".concat(t):n>1&&n<7?"in ".concat(n," Tagen, ").concat(t):vt(e)},_t=e=>{var s,n,t,a;const l=e.facts||{};switch(e.occasion){case"keine_klasse":return"seit ".concat(null!==(s=l.tage_seit_registrierung)&&void 0!==s?s:"?"," Tagen registriert, keine Klasse");case"leere_klasse":return"Klasse \u201e".concat(null!==(n=l.klasse)&&void 0!==n?n:"?","\u201c, angelegt am ").concat(vt(l.angelegt_am),", niemand angemeldet");case"zugangskarten":return"".concat(gt(l.zugangskarten)," Karten, ").concat(gt(l.benutzt)," benutzt");case"unterrichtslauf":case"nach_und_nach":{var i,r,c;const s=null!==(i=null===(r=l.blaetter)||void 0===r?void 0:r.length)&&void 0!==i?i:1,n=l.tag?new Date(l.tag).toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit"}):"?",t=l.klassen>1?"".concat(gt(l.klassen)," Klassen"):"Klasse ".concat(null!==(c=l.klasse)&&void 0!==c?c:"?"),a="unterrichtslauf"===e.occasion?"".concat(gt(l.gleichzeitig)," gleichzeitig"):"nacheinander";
1return"".concat(n,": ").concat(gt(l.lernende)," Lernende in ").concat(t,", ").concat(a," \xb7 ").concat(s," Blatt").concat(1===s?"":"er")}case"testphase_endet":return"Testphase endet am ".concat(new Date(l.endet_am).toLocaleDateString("de-DE")," (").concat(l.tage_bis_ende," Tage)");case"eingeschlafen":return"".concat(null!==(t=l.aktive_tage)&&void 0!==t?t:"?"," aktive Tage, seit ").concat(null!==(a=l.tage_ruhe)&&void 0!==a?a:"?"," Tagen Ruhe");default:return""}},bt=e=>{let{row:s}=e;return(0,o.jsxs)("div",{className:"lifecycle-mails__person",children:[(0,o.jsx)("span",{className:"lifecycle-mails__name",children:s.user_name||"Ohne Namen"}),(0,o.jsx)("span",{className:"lifecycle-mails__meta",children:[s.school_name,pt[s.subject]].filter(Boolean).join(" \xb7 ")}),s.user_email&&(0,o.jsx)("a",{className:"lifecycle-mails__mail",href:"mailto:".concat(s.user_email),children:s.user_email})]})},ft=e=>{let{occasion:s,onChange:n,busy:t}=e;return(0,o.jsx)("div",{className:"lifecycle-mails__switch",role:"group","aria-label":"Schalter f\xfcr ".concat(s.label),children:ht.map(e=>(0,o.jsx)("button",{type:"button",title:e.hint,disabled:t,"aria-pressed":s.mode===e.key,className:"lifecycle-mails__mode lifecycle-mails__mode--".concat(e.key),onClick:()=>n(s.id,e.key),children:e.label},e.key))})},yt=e=>{let{occasions:s,onChange:n,onSample:t,busy:a}=e;return(0,o.jsx)("div",{className:"lifecycle-mails__table-wrap",children:(0,o.jsxs)("table",{className:"lifecycle-mails__table",children:[(0,o.jsx)("thead",{children:(0,o.jsxs)("tr",{children:[(0,o.jsx)("th",{children:"Anlass"}),(0,o.jsx)("th",{children:"Ausl\xf6ser"}),(0,o.jsx)("th",{className:"num",children:"Anstehend"}),(0,o.jsx)("th",{className:"num",children:"Verschickt"}),(0,o.jsx)("th",{className:"num",children:"Geklickt"}),(0,o.jsx)("th",{className:"num",children:"Ziel erreicht"}),(0,o.jsx)("th",{className:"num",children:"Abgemeldet"}),(0,o.jsx)("th",{children:"Schalter"})]})}),(0,o.jsx)("tbody",{children:s.map(e=>{const s=e.counts,l=s.sent+s.probe;return(0,o.jsxs)("tr",{children:[(0,o.jsxs)("td",{children:[(0,o.jsx)("button",{type:"button",className:"lifecycle-mails__link",onClick:()=>t(e.id),children:e.label}),(0,o.jsxs)("span",{className:"lifecycle-mails__meta",children:[pt[e.subject],e.category_label&&" \xb7 ".concat(e.category_label),e.started_at&&" \xb7 aktiv seit ".concat(vt(e.started_at))]})]}),(0,o.jsxs)("td",{className:"lifecycle-mails__trigger",children:[e.trigger,(0,o.jsxs)("span",{className:"lifecycle-mails__meta",children:["Ziel: ",e.goal," (",e.goal_days," Tage)"]})]}),(0,o.jsx)("td",{className:"num",children:gt(s.planned)}),(0,o.jsxs)("td",{className:"num",children:[gt(l),s.probe>0&&(0,o.jsxs)("span",{className:"lifecycle-mails__rate",children:[" \xb7 ",gt(s.probe)," Probe"]}),s.observed>0&&(0,o.jsxs)("span",{className:"lifecycle-mails__rate",children:[" \xb7 ",gt(s.observed)," beobachtet"]})]}),(0,o.jsxs)("td",{className:"num",children:[gt(s.clicked),l>0&&(0,o.jsxs)("span",{className:"lifecycle-mails__rate",children:[" \xb7 ",xt(s.clicked,l)]})]}),(0,o.jsxs)("td",{className:"num",children:[gt(s.goal_reached),l>0&&(0,o.jsxs)("span",{className:"lifecycle-mails__rate",children:[" \xb7 ",xt(s.goal_reached,l)]})]}),(0,o.jsxs)("td",{className:"num",children:[gt(s.unsubscribed),s.sent>0&&(0,o.jsxs)("span",{className:"lifecycle-mails__rate",children:[" \xb7 ",xt(s.unsubscribed,s.sent)]})]}),(0,o.jsx)("td",{children:(0,o.jsx)(ft,{occasion:e,onChange:n,busy:a})})]},e.id)})})]})})},kt={abmeldeseite:"Link in der Mail",ein_klick:"Knopf im Mailprogramm",profil:"Profil",bestaetigung:"Best\xe4tigungsmail"},Nt=e=>{let{unsubscribes:s}=e;if(!s)return null;const n=s.recent.slice(0,10);return(0,o.jsxs)("div",{className:"lifecycle-mails__unsubscribes",children:[(0,o.jsx)("h4",{className:"lifecycle-mails__subhead",children:"Mail-Einstellungen der Lehrkr\xe4fte"}),(0,o.jsx)("div",{className:"lifecycle-mails__table-wrap",children:(0,o.jsxs)("table",{className:"lifecycle-mails__table",children:[(0,o.jsx)("thead",{children:(0,o.jsxs)("tr",{children:[(0,o.jsx)("th",{children:"Kategorie"}),(0,o.jsx)("th",{className:"num",children:"Bekommen sie nicht"}),(0,o.jsx)("th",{className:"num",children:"Abgemeldet (30 Tage)"}),(0,o.jsx)("th",{className:"num",children:"davon \xfcber eine Anlass-Mail"}),(0,o.jsx)("th",{className:"num",children:"Wieder an (30 Tage)"})]})}),(0,o.jsx)("tbody",{children:s.categories.map(e=>(0,o.jsxs)("tr",{children:[(0,o.jsx)("td",{children:e.label}),(0,o.jsx)("td",{className:"num",children:null===e.off?"\u2013":gt(e.off)}),(0,o.jsx)("td",{className:"num",children:gt(e.unsubscribed_30d)}),(0,o.jsx)("td",{className:"num",children:gt(e.via_mail_30d)}),(0,o.jsx)("td",{className:"num",children:gt(e.resubscribed_30d)})]},e.id))})]})}),n.length>0&&(0,o.jsx)("ul",{className:"lifecycle-mails__events",children:n.map((e,s)=>(0,o.jsxs)("li",{children:[(0,o.jsx)("span",{className:"lifecycle-mails__meta",children:vt(e.at)})," ",e.user_email||"gel\xf6schtes Konto"," ",e.enabled?"bekommt wieder":"hat abbestellt",": ",e.category_label,(0,o.jsxs)("span",{className:"lifecycle-mails__meta",children:[kt[e.source]||e.source,e.occasion_label&&" \xb7 aus \u201e".concat(e.occasion_label,"\u201c")]})]},"".concat(e.at,"-").concat(s)))})]})},St=e=>{let{rows:s,onPreview:n,modes:t={}}=e;return(0,o.jsx)("div",{className:"lifecycle-mails__table-wrap",children:(0,o.jsxs)("table",{className:"lifecycle-mails__table",children:[(0,o.jsx)("thead",{children:(0,o.jsxs)("tr",{children:[(0,o.jsx)("th",{children:"Zeitpunkt"}),(0,o.jsx)("th",{children:"Anlass"}),(0,o.jsx)("th",{children:"Empf\xe4ngerin oder Empf\xe4nger"}),(0,o.jsx)("th",{children:"Warum"}),(0,o.jsx)("th",{children:"Zustand"})]})}),(0,o.jsx)("tbody",{children:s.map(e=>{const s="beobachten"===t[e.occasion];return(0,o.jsxs)("tr",{children:[(0,o.jsxs)("td",{className:"nowrap",children:[jt(e.due_at),(0,o.jsx)("span",{className:"lifecycle-mails__meta",children:s?"wird nur beobachtet":"geht raus"})]}),(0,o.jsxs)("td",{children:[(0,o.jsx)("button",{type:"button",className:"lifecycle-mails__link",onClick:()=>n(e.id),children:e.occasion_label}),e.subject_label&&(0,o.jsx)("span",{className:"lifecycle-mails__meta",children:e.subject_label})]}),(0,o.jsx)("td",{children:(0,o.jsx)(bt,{row:e})}),(0,o.jsx)("td",{className:"lifecycle-mails__why",children:_t(e)}),(0,o.jsxs)("td",{children:[s?(0,o.jsx)("span",{className:"lifecycle-mails__badge lifecycle-mails__badge--observed",children:"Nur Beobachtung"}):(0,o.jsx)("span",{className:"lifecycle-mails__badge lifecycle-mails__badge--".concat(e.status),children:mt[e.status]||e.status}),e.reason&&(0,o.jsx)("span",{className:"lifecycle-mails__meta",children:e.reason})]})]},e.id)})})]})})},wt=e=>{let{rows:s,onPreview:n}=e;return(0,o.jsx)("div",{className:"lifecycle-mails__table-wrap",children:(0,o.jsxs)("table",{className:"lifecycle-mails__table",children:[(0,o.jsx)("thead",{children:(0,o.jsxs)("tr",{children:[(0,o.jsx)("th",{children:"Zeitpunkt"}),(0,o.jsx)("th",{children:"Anlass"}),(0,o.jsx)("th",{children:"Empf\xe4ngerin oder Empf\xe4nger"}),(0,o.jsx)("th",{children:"Reaktion"}),(0,o.jsx)("th",{children:"Zustand"})]})}),(0,o.jsx)("tbody",{children:s.map(e=>{const s=(e.clicks||[]).filter(e=>!e.scanner),t=(e.clicks||[]).length-s.length;return(0,o.jsxs)("tr",{children:[(0,o.jsxs)("td",{className:"nowrap",children:["observed"===e.status&&(0,o.jsxs)(o.Fragment,{children:[vt(e.due_at),(0,o.jsx)("span",{className:"lifecycle-mails__meta",children:"w\xe4re rausgegangen"})]}),"dropped"===e.status&&(0,o.jsxs)(o.Fragment,{children:[vt(e.due_at),(0,o.jsx)("span",{className:"lifecycle-mails__meta",children:"nicht verschickt"})]}),("sent"===e.status||"probe"===e.status)&&vt(e.sent_at),e.recipient&&(0,o.jsxs)("span",{className:"lifecycle-mails__meta",children:["an ",e.recipient]})]}),(0,o.jsxs)("td",{children:[(0,o.jsx)("button",{type:"button",className:"lifecycle-mails__link",onClick:()=>n(e.id),children:e.occasion_label}),e.subject&&(0,o.jsx)("span",{className:"lifecycle-mails__meta",children:e.subject})]}),(0,o.jsx)("td",{children:(0,o.jsx)(bt,{row:e})}),(0,o.jsx)("td",{children:(0,o.jsxs)("div",{className:"lifecycle-mails__reactions",children:[s.length>0&&(0,o.jsxs)("span",{className:"lifecycle-mails__tag lifecycle-mails__tag--good",children:[(0,o.jsx)(x.L2J,{})," ",s.length," Klick",1===s.length?"":"s"," \xb7 ",vt(s[0].clicked_at)]}),e.goal_reached_at&&(0,o.jsxs)("span",{className:"lifecycle-mails__tag lifecycle-mails__tag--good",children:[(0,o.jsx)(x.A7C,{})," Ziel ",vt(e.goal_reached_at)]}),e.unsubscribed_at&&(0,o.jsx)("span",{className:"lifecycle-mails__tag lifecycle-mails__tag--bad",children:"Abgemeldet"}),!1===e.analysis_mail_opt_in&&(0,o.jsx)("span",{className:"lifecycle-mails__tag lifecycle-mails__tag--bad",children:"Analyse-Mails aus"}),t>0&&(0,o.jsxs)("span",{className:"lifecycle-mails__meta",children:[t," Scanner-Klick(s)"]}),0===s.length&&!e.goal_reached_at&&!e.unsubscribed_at&&(0,o.jsx)("span",{className:"lifecycle-mails__meta",children:"keine Reaktion"})]})}),(0,o.jsxs)("td",{children:[(0,o.jsx)("span",{className:"lifecycle-mails__badge lifecycle-mails__badge--".concat(e.status),children:mt[e.status]||e.status}),e.reason&&(0,o.jsx)("span",{className:"lifecycle-mails__meta",children:e.reason})]})]},e.id)})})]})})},zt=e=>{let{preview:s,onClose:n}=e;return(0,o.jsx)("div",{className:"lifecycle-mails__overlay",onClick:n,children:(0,o.jsxs)("div",{className:"lifecycle-mails__preview",onClick:e=>e.stopPropagation(),children:[(0,o.jsxs)("div",{className:"lifecycle-mails__preview-head",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("strong",{children:s.subject}),(0,o.jsx)("span",{className:"lifecycle-mails__meta",children:s.sample?"Beispiel mit erfundenen Angaben":"an ".concat(s.recipient||"unbekannt").concat(s.user_name?" \xb7 ".concat(s.user_name):"")}),s.preheader&&(0,o.jsxs)("span",{className:"lifecycle-mails__meta",children:["Vorschau: ",s.preheader]})]}),(0,o.jsx)("button",{type:"button",className:"lifecycle-mails__close",onClick:n,"aria-label":"Schlie\xdfen",children:(0,o.jsx)(x.QCr,{})})]}),(0,o.jsx)("iframe",{title:"Vorschau der Mail",srcDoc:s.html,className:"lifecycle-mails__frame"})]})})},At=e=>{var s;let{username:n,password:t}=e;const[a,i]=(0,l.useState)(null),[r,d]=(0,l.useState)(!1),[u,h]=(0,l.useState)(!1),[m,p]=(0,l.useState)(""),[g,v]=(0,l.useState)(""),[j,_]=(0,l.useState)(null),[b,f]=(0,l.useState)("upcoming"),[y,k]=(0,l.useState)(""),N=(0,l.useCallback)(async()=>{d(!0),p("");try{i(await(0,c.W3S)(n,t))}catch(e){p(e.message||"Anlass-Mails konnten nicht geladen werden")}finally{d(!1)}},[n,t]);(0,l.useEffect)(()=>{N()},[N]);const S=async e=>{h(!0),v("");try{const s=await(0,c.RA9)(n,t,{send:e}),a=Object.values(s.planned||{}).reduce((e,s)=>e+s.geplant,0),l=s.sent||{};v(e?"".concat(a," neu geplant, ").concat(l.versendet||0," verschickt, ").concat(l.probe||0," als Probe, ")+"".concat(l.entfallen||0," entfallen").concat(l.offen?", ".concat(l.offen," warten auf den n\xe4chsten Lauf"):"","."):"".concat(a," neu geplant. Verschickt wurde nichts.")),await N()}catch(s){p(s.message||"Lauf fehlgeschlagen")}finally{h(!1)}},w=async e=>{try{_(await(0,c.foP)(n,t,e))}catch(s){p(s.message||"Vorschau konnte nicht geladen werden")}},z=(0,l.useMemo)(()=>
1{if(!a)return[];const e="upcoming"===b?a.upcoming:a.history;return y?e.filter(e=>e.occasion===y):e},[a,b,y]),A=(0,l.useMemo)(()=>{var e,s;const n=((null===a||void 0===a?void 0:a.occasions)||[]).map(e=>e.counts),t=e=>n.reduce((s,n)=>s+n[e],0);return{planned:t("planned"),sent:t("sent")+t("probe"),clicked:t("clicked"),goal:t("goal_reached"),dropped:t("dropped"),unsubscribed30:((null===a||void 0===a||null===(e=a.unsubscribes)||void 0===e?void 0:e.categories)||[]).reduce((e,s)=>e+s.unsubscribed_30d,0),viaMail30:((null===a||void 0===a||null===(s=a.unsubscribes)||void 0===s?void 0:s.categories)||[]).reduce((e,s)=>e+s.via_mail_30d,0)}},[a]);if(!a&&r)return(0,o.jsx)("p",{className:"lifecycle-mails__hint",children:"Lade Anlass-Mails\u2026"});if(!a)return(0,o.jsx)("p",{className:"lifecycle-mails__error",children:m||"Keine Daten"});const C=Object.fromEntries(a.occasions.map(e=>[e.id,e.mode])),D=a.upcoming.filter(e=>"beobachten"===C[e.occasion]).length,L=a.occasions.filter(e=>"aktiv"===e.mode).length,E=a.occasions.filter(e=>"probe"===e.mode).length,M=a.occasions.filter(e=>"beobachten"===e.mode).length;return(0,o.jsxs)("div",{className:"lifecycle-mails",children:[(0,o.jsxs)("div",{className:"lifecycle-mails__controls",children:[(0,o.jsxs)("div",{className:"lifecycle-mails__kpis",children:[(0,o.jsxs)("div",{className:"lifecycle-mails__kpi",children:[(0,o.jsx)("span",{className:"lifecycle-mails__kpi-label",children:"Anstehend"}),(0,o.jsx)("span",{className:"lifecycle-mails__kpi-value",children:gt(A.planned)}),(0,o.jsx)("span",{className:"lifecycle-mails__kpi-detail",children:D>0?"davon ".concat(gt(D)," nur beobachtet, geht nicht raus"):"n\xe4chstes Fenster ".concat(jt(a.next_window))})]}),(0,o.jsxs)("div",{className:"lifecycle-mails__kpi",children:[(0,o.jsx)("span",{className:"lifecycle-mails__kpi-label",children:"Verschickt"}),(0,o.jsx)("span",{className:"lifecycle-mails__kpi-value",children:gt(A.sent)}),(0,o.jsxs)("span",{className:"lifecycle-mails__kpi-detail",children:[gt(A.clicked)," mit Klick \xb7 ",xt(A.clicked,A.sent)]})]}),(0,o.jsxs)("div",{className:"lifecycle-mails__kpi",children:[(0,o.jsx)("span",{className:"lifecycle-mails__kpi-label",children:"Ziel erreicht"}),(0,o.jsx)("span",{className:"lifecycle-mails__kpi-value",children:gt(A.goal)}),(0,o.jsxs)("span",{className:"lifecycle-mails__kpi-detail",children:[xt(A.goal,A.sent)," der verschickten"]})]}),(0,o.jsxs)("div",{className:"lifecycle-mails__kpi",children:[(0,o.jsx)("span",{className:"lifecycle-mails__kpi-label",children:"Abmeldungen"}),(0,o.jsx)("span",{className:"lifecycle-mails__kpi-value",children:gt(A.unsubscribed30)}),(0,o.jsxs)("span",{className:"lifecycle-mails__kpi-detail",children:["letzte 30 Tage \xb7 ",gt(A.viaMail30)," \xfcber eine Anlass-Mail"]})]}),(0,o.jsxs)("div",{className:"lifecycle-mails__kpi",children:[(0,o.jsx)("span",{className:"lifecycle-mails__kpi-label",children:"Scharf"}),(0,o.jsx)("span",{className:"lifecycle-mails__kpi-value",children:L}),(0,o.jsxs)("span",{className:"lifecycle-mails__kpi-detail",children:[E," im Probebetrieb \xb7 ",M," beobachtet"]})]})]}),(0,o.jsxs)("div",{className:"lifecycle-mails__buttons",children:[(0,o.jsxs)("button",{type:"button",className:"lifecycle-mails__button",disabled:u||r,onClick:()=>S(!1),children:[(0,o.jsx)(x.DIg,{})," Nachrechnen"]}),(0,o.jsxs)("button",{type:"button",className:"lifecycle-mails__button lifecycle-mails__button--primary",disabled:u||r||L+E===0,title:L+E===0?"Kein Anlass ist freigegeben, es g\xe4be nichts zu verschicken.":"Verschickt, was f\xe4llig ist. Probe geht an ".concat(a.probe_recipient,"."),onClick:()=>S(!0),children:[(0,o.jsx)(x.XcJ,{})," F\xe4lliges verschicken"]})]})]}),g&&(0,o.jsx)("p",{className:"lifecycle-mails__note",children:g}),m&&(0,o.jsx)("p",{className:"lifecycle-mails__error",children:m}),(0,o.jsxs)("p",{className:"lifecycle-mails__hint",children:["Erinnerungen: h\xf6chstens eine pro Lehrkraft in ",a.guardrails.weekly_gap_days," Tagen,"," ",a.guardrails.window,"."," ","Ergebnis-Mails z\xe4hlen dabei nicht mit, kommen h\xf6chstens einmal am Tag und auch morgens ",null!==(s=a.guardrails.morning_window)&&void 0!==s?s:"07:15\u201308:30 Uhr","."," ","Probemails nur an ",a.probe_recipient,"."]}),(0,o.jsx)(yt,{occasions:a.occasions,onChange:async(e,s)=>{h(!0),v("");try{await(0,c.gWj)(n,t,e,s),await N()}catch(a){p(a.message||"Schalter konnte nicht umgelegt werden")}finally{h(!1)}},onSample:async e=>{try{_(await(0,c.lnV)(n,t,e))}catch(s){p(s.message||"Beispiel konnte nicht geladen werden")}},busy:u}),(0,o.jsx)(Nt,{unsubscribes:a.unsubscribes}),(0,o.jsxs)("div",{className:"lifecycle-mails__section-head",children:[(0,o.jsxs)("div",{className:"lifecycle-mails__switch",children:[(0,o.jsxs)("button",{type:"button","aria-pressed":"upcoming"===b,onClick:()=>f("upcoming"),children:["Anstehend (",gt(a.upcoming.length),")"]}),(0,o.jsxs)("button",{type:"button","aria-pressed":"history"===b,onClick:()=>f("history"),children:["Verlauf (",gt(a.history.length),")"]})]}),(0,o.jsxs)("select",{className:"lifecycle-mails__select",value:y,onChange:e=>k(e.target.value),children:[(0,o.jsx)("option",{value:"",children:"Alle Anl\xe4sse"}),a.occasions.map(e=>(0,o.jsx)("option",{value:e.id,children:e.label},e.id))]})]}),0===z.length?(0,o.jsx)("p",{className:"lifecycle-mails__hint",children:"upcoming"===b?"Nichts anstehend. \u201eNachrechnen\u201c sucht erneut nach offenen F\xe4llen.":"Noch nichts verschickt."}):"upcoming"===b?(0,o.jsx)(St,{rows:z,onPreview:w,modes:C}):(0,o.jsx)(wt,{rows:z,onPreview:w}),j&&(0,o.jsx)(zt,{preview:j,onClose:()=>_(null)})]})};
1var Ct=n(7831),Dt=n(24);const Lt={teacher:"Lehrkraft",admin:"Schuladmin",student:"Sch\xfcler:in",guest:"Gast",parent:"Eltern"},Et=e=>[Lt[e.role]||e.role,e.email,e.school_name].filter(Boolean).join(" \xb7 "),Mt=e=>{let{user:s}=e;const n=[...new Set([s.email?"email":null,...s.providers||[],["managed","guest"].includes(s.auth_provider)?s.auth_provider:null])].filter(Boolean);return(0,o.jsx)("span",{className:"account-picker__providers",children:n.map(e=>(0,o.jsx)(Dt.rb,{provider:e,size:14},e))})},Tt=e=>{let{label:s,value:n,onChange:t,username:a,password:i,exclude:r}=e;const[d,u]=(0,l.useState)(""),[h,m]=(0,l.useState)([]),[p,g]=(0,l.useState)(!1),[v,j]=(0,l.useState)("");return n?(0,o.jsxs)("div",{className:"account-picker",children:[(0,o.jsx)("span",{className:"account-picker__label",children:s}),(0,o.jsxs)("div",{className:"account-picker__chosen",children:[(0,o.jsxs)("span",{children:[(0,o.jsx)("strong",{children:n.name||"(ohne Namen)"})," ",(0,o.jsx)(Mt,{user:n}),(0,o.jsxs)("span",{className:"muted",children:[" ",Et(n)]})]}),(0,o.jsx)("button",{type:"button",className:"section-button",onClick:()=>t(null),"aria-label":"Auswahl l\xf6sen",children:(0,o.jsx)(x.QCr,{})})]})]}):(0,o.jsxs)("div",{className:"account-picker",children:[(0,o.jsx)("span",{className:"account-picker__label",children:s}),(0,o.jsxs)("form",{className:"account-picker__search",onSubmit:async e=>{if(e.preventDefault(),!(d.trim().length<2)){g(!0),j("");try{m(await(0,c.oNZ)(a,i,d.trim()))}catch(s){j(z(s,"Suche fehlgeschlagen."))}finally{g(!1)}}},children:[(0,o.jsx)("input",{type:"search",placeholder:"Name, E-Mail oder Konto-ID",value:d,onChange:e=>u(e.target.value)}),(0,o.jsxs)("button",{type:"submit",className:"section-button",disabled:p,children:[(0,o.jsx)(x.KSO,{})," ",p?"Suche \u2026":"Suchen"]})]}),v&&(0,o.jsx)("span",{className:"form-error",children:v}),h.length>0&&(0,o.jsx)("ul",{className:"account-picker__results",children:h.filter(e=>e.id!==r).map(e=>(0,o.jsx)("li",{children:(0,o.jsxs)("button",{type:"button",onClick:()=>{t(e),m([])},children:[(0,o.jsxs)("strong",{children:[e.name||"(ohne Namen)"," ",(0,o.jsx)(Mt,{user:e})]}),(0,o.jsx)("span",{className:"muted",children:Et(e)})]})},e.id))})]})},Kt=e=>{let{user:s,username:n,password:t,onChanged:a}=e;const[i,r]=(0,l.useState)(null),[d,u]=(0,l.useState)("");(0,l.useEffect)(()=>{let e=!0;return(0,c.hcC)(n,t,s.id).then(s=>{e&&r(s)}).catch(s=>{e&&u(z(s,"Anmeldewege nicht geladen."))}),()=>{e=!1}},[s.id,n,t]);return i?(0,o.jsxs)("div",{className:"account-login-methods",children:[(0,o.jsxs)("span",{className:"account-picker__label",children:["Anmeldewege von ",s.name||"Konto"]}),(0,o.jsxs)("ul",{children:[i.password&&(0,o.jsxs)("li",{children:[(0,o.jsx)(Dt.rb,{provider:"email",size:13})," E-Mail und Passwort (",i.email,")"]}),i.identities.map(e=>(0,o.jsxs)("li",{children:[(0,o.jsx)(Dt.rb,{provider:e.provider,size:13})," ",e.label,e.email?" (".concat(e.email,")"):"","email"===e.provider&&!e.has_password&&(0,o.jsx)("span",{className:"muted",children:" \xb7 ohne Passwort"}),e.primary&&(0,o.jsx)("span",{className:"muted",children:" \xb7 prim\xe4r"}),(0,o.jsx)("button",{type:"button",className:"account-login-methods__unlink",onClick:()=>(async e=>{const l=e.relinks_by_email?"Weil die Adresse zum Konto geh\xf6rt, verbindet die n\xe4chste Anmeldung damit es wieder.":"Die n\xe4chste Anmeldung damit legt ein neues Konto an.";if(window.confirm("".concat(e.label," aus ").concat(s.name||"diesem Konto"," entfernen? Das Konto beim Anbieter bleibt unber\xfchrt. ").concat(l))){u("");try{r(await(0,c.JuM)(n,t,s.id,e.id)),null===a||void 0===a||a()}catch(i){u(z(i,"Trennen fehlgeschlagen."))}}})(e),children:"entfernen"})]},e.id)),!i.password&&0===i.identities.length&&(0,o.jsx)("li",{className:"muted",children:"Keine (Gast oder Zugangskarte)"})]}),d&&(0,o.jsx)("span",{className:"form-error",children:d})]}):d?(0,o.jsx)("span",{className:"form-error",children:d}):null},Bt=e=>{let{username:s,password:n,refreshKey:t}=e;const[a,i]=(0,l.useState)(null);return(0,l.useEffect)(()=>{(0,c.qpL)(s,n).then(i).catch(()=>i([]))},[s,n,t]),null!==a&&void 0!==a&&a.length?(0,o.jsxs)("div",{className:"account-merge-log",children:[(0,o.jsx)("span",{className:"account-picker__label",children:"Zuletzt zusammengef\xfchrt"}),(0,o.jsxs)("table",{children:[(0,o.jsx)("thead",{children:(0,o.jsxs)("tr",{children:[(0,o.jsx)("th",{children:"Wann"}),(0,o.jsx)("th",{children:"Aufgegangen"}),(0,o.jsx)("th",{children:"Geblieben"}),(0,o.jsx)("th",{children:"Durch"})]})}),(0,o.jsx)("tbody",{children:a.map(e=>(0,o.jsxs)("tr",{children:[(0,o.jsx)("td",{children:new Date(e.created_at).toLocaleStr
1ing("de-DE",{dateStyle:"short",timeStyle:"short"})}),(0,o.jsxs)("td",{children:[e.source_name||"\u2013",e.source_email?" (".concat(e.source_email,")"):""]}),(0,o.jsxs)("td",{children:[e.target_name||"\u2013",e.target_email?" (".concat(e.target_email,")"):""]}),(0,o.jsx)("td",{children:"self"===e.actor_type?"Person selbst":"school_admin"===e.actor_type?"Schuladmin":e.actor_id})]},e.id))})]})]}):null},Ft=e=>{let{username:s,password:n}=e;const[t,a]=(0,l.useState)(null),[i,r]=(0,l.useState)(null),[d,u]=(0,l.useState)(null),[h,m]=(0,l.useState)(""),[p,g]=(0,l.useState)(""),[v,j]=(0,l.useState)(!1),[_,b]=(0,l.useState)(!1),[f,y]=(0,l.useState)(0),k=(0,l.useCallback)(async()=>{if(u(null),b(!1),t&&i){m("");try{u(await(0,c.Kg4)(s,n,t.id,i.id))}catch(e){m(z(e,"Vorschau fehlgeschlagen."))}}},[t,i,s,n]);(0,l.useEffect)(()=>{k()},[k]);return(0,o.jsxs)("div",{className:"account-merge-panel",children:[(0,o.jsx)("p",{className:"muted",children:"F\xfcr Personen mit zwei Konten, etwa einmal per E-Mail und einmal \xfcber EduPlaces registriert. Alles aus dem einen Konto wandert in das andere, auch alle Anmeldewege (E-Mail-Adressen samt Passwort, Google, Microsoft ...)."}),(0,o.jsxs)("div",{className:"account-merge-panel__pickers",children:[(0,o.jsx)(Tt,{label:"Geht auf",value:t,onChange:e=>{a(e),g("")},username:s,password:n,exclude:null===i||void 0===i?void 0:i.id}),(0,o.jsx)("button",{type:"button",className:"section-button account-merge-panel__swap",onClick:()=>{a(i),r(t)},disabled:!t&&!i,"aria-label":"Richtung tauschen",children:(0,o.jsx)(x.yk7,{})}),(0,o.jsx)(Tt,{label:"Bleibt",value:i,onChange:e=>{r(e),g("")},username:s,password:n,exclude:null===t||void 0===t?void 0:t.id})]}),(t||i)&&(0,o.jsxs)("div",{className:"account-merge-panel__methods",children:[t&&(0,o.jsx)(Kt,{user:t,username:s,password:n,onChanged:k},"s-".concat(t.id,"-").concat(f)),i&&(0,o.jsx)(Kt,{user:i,username:s,password:n,onChanged:k},"t-".concat(i.id,"-").concat(f))]}),d&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Ct.Ay,{preview:d}),d.suggested_target_id&&d.suggested_target_id!==i.id&&(0,o.jsx)("p",{className:"muted",children:"Tipp: Meist bleibt besser das andere Konto (mehr Inhalte oder \xe4lter). Richtung tauschen?"}),0===d.blockers.length&&(0,o.jsxs)("div",{className:"account-merge-panel__confirm",children:[(0,o.jsxs)("label",{children:[(0,o.jsx)("input",{type:"checkbox",checked:_,onChange:e=>b(e.target.checked)}),"Beide Konten geh\xf6ren nachweislich derselben Person."]}),(0,o.jsx)("button",{type:"button",className:"section-button",onClick:async()=>{j(!0),m("");try{await(0,c.ui7)(s,n,t.id,i.id),g("".concat(t.name||"Das Konto"," ist in ").concat(i.name||"das Zielkonto"," aufgegangen.")),a(null),y(e=>e+1)}catch(r){var e,l;const s=null===(e=r.data)||void 0===e||null===(l=e.detail)||void 0===l?void 0:l.blockers;m(null!==s&&void 0!==s&&s.length?s.join(" "):z(r,"Zusammenf\xfchren fehlgeschlagen."))}finally{j(!1)}},disabled:!_||v,children:v?"F\xfchre zusammen \u2026":"Zusammenf\xfchren"})]})]}),h&&(0,o.jsx)("span",{className:"form-error",children:h}),p&&(0,o.jsx)("span",{className:"teacher-school-assign__done",children:p}),(0,o.jsx)(Bt,{username:s,password:n,refreshKey:f})]})};var Pt=n(9313);const Rt=["gradeNum"],Ht=e=>{const s=new Map;return e.forEach(e=>{var n,t,a,l,i,r,c,o,d,u,h,m;if(!e.sheet_id)return;const p="".concat(e.sheet_id,"__").concat(null!==(n=null!==(t=e.activity_date)&&void 0!==t?t:e.student_id)&&void 0!==n?n:"all");s.has(p)||s.set(p,{id:e.sheet_id,title:e.sheet_title,created_at:e.sheet_created_at,first_progress_at:null!==(a=e.first_progress_at)&&void 0!==a?a:null,last_progress_at:null!==(l=e.last_progress_at)&&void 0!==l?l:null,activity_date:null!==(i=e.activity_date)&&void 0!==i?i:null,student_count:Number(e.student_count)||0,teacher_count:Number(e.teacher_count)||0,student_count_recent:Number(e.student_count_recent)||0,teacher_count_recent:Number(e.teacher_count_recent)||0,class_id:null!==(r=e.class_id)&&void 0!==r?r:null,class_name:null!==(c=e.class_name)&&void 0!==c?c:null,teacher_name:null!==(o=e.teacher_name)&&void 0!==o?o:null,teacher_email:null!==(d=e.teacher_email)&&void 0!==d?d:null,student_id:null!==(u=e.student_id)&&void 0!==u?u:null,student_name:null!==(h=e.student_name)&&void 0!==h?h:null,student_email:null!==(m=e.student_email)&&void 0!==m?m:null,student:e.student_id?{id:e.student_id,name:e.student_name,email:e.student_email,avatar_seed:e.student_avatar_seed,role:"student"}:null,is_student_sheet:!!e.student_name&&!e.teacher_name})}),Array.from(s.values())}
1,Ot=(e,s)=>{const n=null===e||void 0===e?void 0:e.status,t=z(e,"");if(401===n)return"Login fehlgeschlagen (401). Falsche Admin-Zugangsdaten oder der Browser sendet alte Basic-Auth-Daten.";if(503===n)return"Admin-Zugang ist im Backend nicht konfiguriert (ADMIN_USERNAME/ADMIN_PASSWORD).";if(n){const s=null!==e&&void 0!==e&&e.url?" (".concat(e.url,")"):"";return"Backend-Fehler ".concat(n).concat(s).concat(t?": ".concat(t):"")}return t||s},Wt=function(){const e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).reduce((e,s)=>(e[s.status]=Number(s.count)||0,e),{}),s=e=>Array.from({length:e},(e,s)=>s);return{correct:s(e.correct||0),corrected:s(e.corrected||0),wrong:s(e.wrong||0),inWork:s(e["in-work"]||e.in_work||0),error:s(e.error||0),notAttempted:s(e["not-attempted"]||0)}},Zt=e=>{if(null===e||void 0===e)return"";const s="string"===typeof e?e.trim():String(e).trim();return s?(0,f.$P)(s)||s.split(/\s+/).map(e=>e?"".concat(e[0].toUpperCase()).concat(e.slice(1)):e).join(" "):""},Vt=function(e){let{includeGrade:s=!0}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return[s?(e=>{if(null===e||void 0===e)return"";const s="string"===typeof e?e.trim():String(e).trim();if(!s)return"";const n=s.match(/\d+/);return n?"".concat(n[0],". Kl."):s})(null===e||void 0===e?void 0:e.grade_level):"",Zt(null===e||void 0===e?void 0:e.school_type),null===e||void 0===e?void 0:e.state].map(e=>"string"===typeof e?e.trim():e).filter(e=>e)},It=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],s=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0;const t=new Map;return e.forEach(e=>{const a=null===e||void 0===e?void 0:e[s];if(null===a||void 0===a)return;const l="string"===typeof a?a.trim():String(a).trim(),i=n?n(l):l;i&&t.set(i,(t.get(i)||0)+1)}),Array.from(t.entries()).sort((e,s)=>s[1]-e[1]).map(e=>{let[s,n]=e;return{label:s,value:n}})},Gt=function(){const e=It(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],"grade_level"),s=[];let n=0;e.forEach(e=>{const t=(e=>{if("string"!==typeof e)return null;const s=e.match(/\d+/);return s?Number(s[0]):null})(e.label);null!=t&&t>=4&&t<=13?s.push((0,a.A)((0,a.A)({},e),{},{gradeNum:t})):n+=e.value||0}),s.sort((e,s)=>e.gradeNum-s.gradeNum);const l=s.map(e=>{let{gradeNum:s}=e;return(0,t.A)(e,Rt)});return n>0&&l.push({label:"Andere",value:n}),l},Qt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:13;const t=new Map;return e.forEach(e=>{const a=null===e||void 0===e?void 0:e.grade_level;if(null===a||void 0===a)return;const l=("string"===typeof a?a:String(a)).match(/\d+/);if(!l)return;const i=Number(l[0]);Number.isNaN(i)||i<s||i>n||t.set(i,(t.get(i)||0)+1)}),Array.from({length:n-s+1},(e,n)=>{const a=s+n;return{label:String(a),value:t.get(a)||0}})},qt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:13;const t=new Map;let a=0;e.forEach(e=>{const l=(null===e||void 0===e?void 0:e.class_name)||(null===e||void 0===e?void 0:e.name)||"",i=String(l).match(/\d+/);if(!i)return void(a+=1);const r=Number(i[0]);Number.isNaN(r)||r<s||r>n?a+=1:t.set(r,(t.get(r)||0)+1)});const l=Array.from({length:n-s+1},(e,n)=>{const a=s+n;return{label:String(a),value:t.get(a)||0}});return a>0&&l.push({label:"?",value:a}),l},Ut=["#2563eb","#10b981","#f59e0b","#f97316","#14b8a6","#8b5cf6","#ef4444"],Yt=e=>{if("string"!==typeof e)return e;const s=e.trim();if(!s)return s;return new Map([["Baden-W??rttemberg","Baden-W\xfcrttemberg"],["Baden-W?rttemberg","Baden-W\xfcrttemberg"]]).get(s)||s},Jt=e=>Zt(e),Xt={google:"Google",microsoft:"Microsoft",apple:"Apple",local:"E-Mail",eduplaces:"EduPlaces",managed:"QR-Karte",guest:"Gast"},$t=e=>Xt[null===e||void 0===e?void 0:e.toLowerCase()]||"Sonstiges",ea={Google:"#EA4335",Microsoft:"#00A4EF",Apple:"#1f2937","E-Mail":"#10b981",EduPlaces:"#7C3AED","QR-Karte":"#6b7280",Verwaltet:"#6b7280",Gast:"#d1d5db",Sonstiges:"#94a3b8"},sa={Google:(0,o.jsx)(x.DSS,{size:13}),Microsoft:(0,o.jsx)(x.cpg,{size:13}),Apple:(0,o.jsx)(x.eMv,{size:13}),"E-Mail":(0,o.jsx)(x.pXu,{size:13}),EduPlaces:(0,o.jsx)("img",{src:"/infoPage/Bildmarke-Edu-RGB_RZ-k1.svg",alt:"EduPlaces",height:13,style:{objectFit:"contain",verticalAlign:"middle"}}),"QR-Karte":(0,o.jsx)(x.AWX,{size:13}),Verwaltet:(0,o.jsx)(x.AWX,{size:13}),Gast:(0,o.jsx)(x.K9B,{size:13})},na=function(){return It(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],"auth_provider",$t).map(e=>(0,a.A)((0,a.A)({},e),{},{color:ea[e.label],icon:sa[e.label]}))},ta=function(e){var s;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(null===e||void 0===e||null===(s=e.sessions)||void 0===s||!s.length)return{};const t=new Map;
1e.sessions.forEach(e=>{const s=new Set((e.tasks||[]).map(e=>e.id));t.set(e.id,s)});const a=new Set(n.map(e=>e.student_id)),l={};n.forEach(e=>{const s=e.student_id,n=e.task_id;l[s]||(l[s]={}),l[s][n]=(0,fs.S)(e.status)});const i={};return e.sessions.forEach(e=>{i[e.id]={correct:[],corrected:[],wrong:[],notAttempted:[],inWork:[],error:[]};(t.get(e.id)||new Set).forEach(s=>{a.forEach(n=>{var t;const a=(0,fs.S)(null===(t=l[n])||void 0===t?void 0:t[s]);"correct"===a?i[e.id].correct.push(s):"corrected"===a?i[e.id].corrected.push(s):"wrong"===a?i[e.id].wrong.push(s):"error"===a?i[e.id].error.push(s):"in-work"===a?i[e.id].inWork.push(s):i[e.id].notAttempted.push(s)})})}),i},aa={google:"\ud83d\udd0d Google",chatgpt:"\ud83e\udd16 ChatGPT",gemini:"\u2728 Gemini",perplexity:"\ud83d\udd2e Perplexity",bing:"\ud83d\udd0d Bing",twitter:"\ud835\udd4f Twitter/X",instagram:"\ud83d\udcf8 Instagram",facebook:"\ud83d\udc64 Facebook",linkedin:"\ud83d\udcbc LinkedIn",youtube:"\u25b6\ufe0f YouTube",tiktok:"\ud83c\udfb5 TikTok",reddit:"\ud83d\udfe0 Reddit",pinterest:"\ud83d\udccc Pinterest",whatsapp:"\ud83d\udcac WhatsApp",direct:"\u27a1\ufe0f Direkt"},la=e=>aa[e]||e||"\u2013",ia=e=>{let{title:s,data:n=[],compact:t=!1}=e;const l=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6;const n=e=>"Other"===e.label||"Andere"===e.label,t=e.find(n),l=e.filter(e=>!n(e)),i=t?[...l,t]:l;if(i.length<=s)return i;const r=i.slice(0,s-1),c=i.slice(s-1).reduce((e,s)=>e+(s.value||0),0);return[...r,(0,a.A)({label:"Andere",value:c},null!==t&&void 0!==t&&t.color?{color:t.color}:{})]}(n),i=l.reduce((e,s)=>e+(s.value||0),0),r=(e,s)=>e.color||Ut[s%Ut.length],c=i?l.reduce((e,s,n)=>{const t=e.offset,a=t+s.value/i*100;return e.stops.push("".concat(r(s,n)," ").concat(t.toFixed(2),"% ").concat(a.toFixed(2),"%")),e.offset=a,e},{stops:[],offset:0}).stops.join(", "):"";return(0,o.jsxs)("div",{className:"pie-card".concat(t?" pie-card--compact":""),children:[(0,o.jsx)("div",{className:"pie-title",children:s}),i>0?(0,o.jsxs)("div",{className:"pie-body",children:[(0,o.jsx)("div",{className:"pie-chart",style:{background:"conic-gradient(".concat(c,")")}}),(0,o.jsx)("div",{className:"pie-legend",children:l.map((e,s)=>(0,o.jsxs)("div",(0,a.A)((0,a.A)({className:"pie-legend-item"},e.icon?{"data-tooltip-id":"admin-icon-tip","data-tooltip-content":e.label}:{title:e.label}),{},{children:[e.icon?(0,o.jsx)("span",{className:"pie-icon",style:{color:r(e,s)},children:e.icon}):(0,o.jsx)("span",{className:"pie-dot",style:{background:r(e,s)}}),!e.icon&&(0,o.jsx)("span",{className:"pie-label",children:e.label}),(0,o.jsx)("span",{className:"pie-value",children:e.value})]}),"".concat(e.label,"-").concat(s)))})]}):(0,o.jsx)("div",{className:"pie-empty",children:"Keine Daten"})]})},ra=e=>{let{title:s,data:n=[]}=e;const t=Math.max(1,...n.map(e=>e.value||0)),a=t,l=Math.round(t/2);return(0,o.jsxs)("div",{className:"pie-card column-card",children:[(0,o.jsx)("div",{className:"pie-title",children:s}),(0,o.jsxs)("div",{className:"column-chart",children:[(0,o.jsxs)("div",{className:"column-axis",children:[(0,o.jsx)("span",{children:a}),(0,o.jsx)("span",{children:l}),(0,o.jsx)("span",{children:"0"})]}),(0,o.jsx)("div",{className:"column-list",style:{gridTemplateColumns:"repeat(".concat(n.length,", minmax(0, 1fr))")},children:n.map(e=>(0,o.jsxs)("div",{className:"column-item",children:[(0,o.jsx)("span",{className:"column-tooltip",children:e.value}),(0,o.jsx)("div",{className:"column-bar",children:(0,o.jsx)("span",{className:"column-fill",style:{height:"".concat(e.value/t*100,"%")},title:"".concat(e.label,": ").concat(e.value)})}),(0,o.jsx)("div",{className:"column-label",children:e.label})]},e.label))})]})]})},ca=e=>{switch(e){case"google":return(0,o.jsx)(x.DSS,{title:"Google"});case"microsoft":return(0,o.jsx)(x.cpg,{title:"Microsoft"});case"apple":return(0,o.jsx)(x.eMv,{title:"Apple"});case"eduplaces":return(0,o.jsx)("img",{src:"/infoPage/Bildmarke-Edu-1K_RZ-k1.svg",alt:"Eduplaces",title:"Eduplaces",className:"teacher-provider-logo"});default:return(0,o.jsx)(x.pXu,{title:"Local"})}},oa=e=>{let{provider:s}=e;
1return(0,o.jsx)("span",{className:"teacher-provider","data-tooltip-id":"admin-icon-tip","data-tooltip-content":Xt[s]||"E-Mail / Passwort",children:ca(s)})},da=e=>{let{schoolId:s,username:n,password:t}=e;const[a,i]=(0,l.useState)(null),[r,h]=(0,l.useState)(!1),[m,p]=(0,l.useState)(!0),x=(0,l.useRef)(!1);if((0,l.useEffect)(()=>{x.current||(x.current=!0,h(!0),(0,c.Xtq)(n,t,s).then(i).catch(console.error).finally(()=>h(!1)))},[]),r)return(0,o.jsx)("div",{className:"muted school-insight-loading",children:"Lade Statistiken\u2026"});if(!a)return null;const v=m?u:e=>e,j=[{label:"Sch\xfcler",color:"#2563eb",data:v(d(a.registration_series,"students"))},{label:"Lehrkr\xe4fte",color:"#f59e0b",data:v(d(a.registration_series,"teachers"))}],_=[{label:"Sch\xfcler",color:"#2563eb",data:v(d(a.sheet_series,"student_sheets"))},{label:"Lehrkraft",color:"#f59e0b",data:v(d(a.sheet_series,"teacher_sheets"))}],b=[{label:"Fehlerhaft",color:"#000000",data:v(d(a.progress_series,"error"))},{label:"Falsch",color:"#ef4444",data:v(d(a.progress_series,"wrong"))},{label:"In Arbeit",color:"#f59e0b",data:v(d(a.progress_series,"in_work"))},{label:"Korrigiert",color:"#86d486",data:v(d(a.progress_series,"corrected"))},{label:"Korrekt",color:"#10b981",data:v(d(a.progress_series,"correct"))}],f=a.progress_series.slice(-30).reduce((e,s)=>e+(Number(s.progress)||0),0),y=a.progress_series.slice(-60,-30).reduce((e,s)=>e+(Number(s.progress)||0),0),k=y>0?Math.round((f-y)/y*100):null,N=null===k?f>0?"new":"none":k>5?"up":k<-5?"down":"flat";let S=null;for(let l=a.progress_series.length-1;l>=0;l--)if(Number(a.progress_series[l].progress)>0){S=a.progress_series[l].day;break}return(0,o.jsxs)("div",{className:"school-insight-charts",children:[(0,o.jsxs)("div",{className:"school-insight-header",children:[(0,o.jsx)("span",{className:"school-insight-title",children:"Nutzungsstatistik"}),(0,o.jsxs)("div",{className:"school-insight-meta",children:[S&&(0,o.jsxs)("span",{className:"school-last-active",children:["Zuletzt aktiv: ",(0,js.Yq)(S)]}),"none"!==N&&(0,o.jsxs)("span",{className:"school-trend-pill trend-".concat(N),children:["up"===N&&"\u2191 +".concat(k,"% (30T)"),"down"===N&&"\u2193 ".concat(k,"% (30T)"),"flat"===N&&"\u2192 Stabil (30T)","new"===N&&"Erstmals aktiv"]}),(0,o.jsx)("button",{type:"button",className:"section-button chart-cumulative-toggle".concat(m?" active":""),onClick:()=>p(e=>!e),children:m?"Kumuliert":"Pro Tag"})]})]}),(0,o.jsxs)("div",{className:"school-charts-row",children:[(0,o.jsxs)("div",{className:"school-chart-block",children:[(0,o.jsx)("div",{className:"school-chart-label",children:"Neuanmeldungen"}),(0,o.jsx)(g,{series:j,height:100})]}),(0,o.jsxs)("div",{className:"school-chart-block",children:[(0,o.jsx)("div",{className:"school-chart-label",children:"\xdcbungsbl\xe4tter"}),(0,o.jsx)(g,{series:_,height:100})]}),(0,o.jsxs)("div",{className:"school-chart-block",children:[(0,o.jsx)("div",{className:"school-chart-label",children:"Berechnungen"}),(0,o.jsx)(g,{series:b,height:100})]})]})]})},ua=e=>String(null!==e&&void 0!==e?e:"").replace(/[&<>"']/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"}[e])),ha=[{id:"teacher",tab:"Lehrkr\xe4fte",tokenField:"signup_token",printTitle:"LivingLines \u2013 Registrierung f\xfcr Lehrkr\xe4fte",intro:"registrieren sich automatisch als Lehrkraft der Schule"},{id:"student",tab:"Sch\xfcler",tokenField:"student_signup_token",printTitle:"LivingLines \u2013 Registrierung f\xfcr Sch\xfclerinnen und Sch\xfcler",intro:"registrieren sich automatisch als Sch\xfcler der Schule"}],ma=e=>{let{school:s,username:n,password:t,onClose:i,onTokenChanged:r}=e;const[d,u]=(0,l.useState)("teacher"),[h,m]=(0,l.useState)({teacher:s.signup_token||null,student:s.student_signup_token||null}),[p,g]=(0,l.useState)(!1),[v,j]=(0,l.useState)(""),[_,b]=(0,l.useState)(null),f=(0,l.useRef)(null),y=ha.find(e=>e.id===d),k=h[d],N=_===d,S=k?"".concat(window.location.origin,"/schule/").concat(k):null,w=!s.state||!s.school_type,A=async e=>{if(!e||window.confirm("Neuen Link generieren? Bereits verteilte QR-Codes mit dem alten Link funktionieren dann nicht mehr.")){g(!0),j("");try{const e=await(0,c.ClT)(n.trim(),t.trim(),s.id,d);m(s=>(0,a.A)((0,a.A)({},s),{},{[d]:e.signup_token})),b(null),r&&r()}catch(l){j(z(l,"Link konnte nicht generiert werden."))}finally{g(!1)}}};return(0,o.jsx)("div",{className:"school-modal",onClick:i,children:(0,o.jsxs)("div",{className:"school-modal-card",onClick:e=>e.stopPropagation(),children:[(0,o.jsxs)("div",{className:"modal-header",children:[(0,o.jsxs)("h3",{children:[(0,o.jsx)(x.Acq,{})," Schul-QR-Code"]}),(0,o.jsx)("button",{className:"modal-close",onClick:i,children:"\xd7"})]}),(0,o.jsxs)("div",{className:"school-qr-body",children:[(0,o.jsx)("div",{className:"school-qr-tabs",role:"tablist",children:ha.map(e=>(0,o.jsxs)("button",{type:"button",role:"tab","aria-selected":d===e.id,className:d===e.id?"active":"",onClick:()=>{return s=e.id,u(s),void j("");var s},children:[e.tab,h[e.id]&&(0,o.jsx)("span",{className:"school-qr-tab-dot",title:"Link aktiv"})]},e.id))}),(0,o.jsxs)("p",{className:"school-qr-intro",children:["Wer diesen Link \xf6ffnet, ",y.intro," ",(0,o.jsx)("strong",{children:s.name})," \u2014 Rolle, Bundesland und Schulart sind vorbelegt.","student"===d&&" Einer Klasse treten Sch\xfcler danach per Klassen-QR-Code oder Code bei."]}),w?(0,o.jsx)("p",{className:"school-qr-warning",children:"Bundesland und Schulart m\xfcssen f\xfcr diese Schule gesetzt sein. Bitte erg\xe4nze beides zuerst unter \u201eBearbeiten\u201c, bevor du den Anmeldelink generierst."}):k?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{className:"school-qr-code",ref:f,children:(0,o.jsx)(ds.h,{value:S,size:220,level:"H",includeMargin:!0})}),(0,o.jsx)("p",{className:"school-qr-url",children:S}),(0,o.jsxs)("div",{className:"form-actions school-qr-actions",children:[(0,o.jsx)("button",{type:"button",onClick:async()=>{try{await navigator.clipboard.writeText(S),b(d)}catch(e){j("Kopieren fehlgeschlagen \u2014 bitte Link manuell markieren.")}},children:N?"Kopiert!":"Link kopieren"}),(0,o.jsx)("button",{type:"button",onClick:()=>
1{if(!f.current||!S)return;const e=window.open("","_blank","width=600,height=700");e&&(e.document.write('<!DOCTYPE html><html lang="de"><head><title>Schul-QR-Code \u2013 '.concat(ua(s.name),"</title>\n<style>body{font-family:sans-serif;text-align:center;padding:40px}svg{width:320px;height:320px}p{word-break:break-all;color:#555;font-size:14px}</style>\n</head><body>\n<h2>").concat(ua(s.name),"</h2>\n<h3>").concat(ua(y.printTitle),"</h3>\n").concat(f.current.innerHTML,"\n<p>").concat(ua(S),"</p>\n</body></html>")),e.document.close(),e.focus(),e.print())},children:"Drucken"}),(0,o.jsx)("button",{type:"button",onClick:()=>A(!0),disabled:p,children:p?"Generiere\u2026":"Neu generieren"})]})]}):(0,o.jsx)("div",{className:"form-actions",children:(0,o.jsx)("button",{type:"button",onClick:()=>A(!1),disabled:p,children:p?"Generiere\u2026":"Anmeldelink generieren"})}),v&&(0,o.jsx)("span",{className:"form-error",children:v})]})]})})},pa=e=>{if(!e)return null;const s=new Date(String(e).slice(0,10)+"T00:00:00");return Number.isNaN(s.getTime())?null:s.toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric"})},ga=e=>{var s,n,t,a;let{school:i,teachersBySchool:r,allTeachers:c=[],username:d,password:u,onEdit:h,onTokenChanged:m}=e;const[p,g]=(0,l.useState)(null),[v,j]=(0,l.useState)(!1),_=r.get(i.id)||[],b=w(i.license_start_date,i.license_end_date,i.license_type),f=N(i.license_type),y=(e=>{if(!e)return null;const s=new Date(String(e).slice(0,10)+"T00:00:00"),n=new Date((new Date).toLocaleDateString("sv-SE")+"T00:00:00");return Math.round((s-n)/864e5)})(i.license_end_date),k=Number(null!==(s=i.teacher_count)&&void 0!==s?s:0),S=null==i.max_teachers?null:Number(i.max_teachers),z=S?Math.min(100,Math.round(k/S*100)):null;let A="ohne Enddatum";return null!=y&&(A=y<0?"seit ".concat(-y," Tagen abgelaufen"):0===y?"endet heute":"noch ".concat(y," Tage")),(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{className:"sd",children:[(0,o.jsxs)("div",{className:"sd-head",children:[(0,o.jsxs)("span",{className:"sd-pill sd-pill--".concat(b.state),children:[(0,o.jsx)("span",{className:"sd-pill__dot"}),b.label]}),(0,o.jsxs)("span",{className:"sd-tag",children:[f.icon,f.label]}),i.eduplaces_school_id&&(0,o.jsx)("span",{className:"sd-tag",title:"EduPlaces-Schul-ID ".concat(i.eduplaces_school_id),children:"EduPlaces verkn\xfcpft"}),(0,o.jsx)("span",{className:"sd-head__spacer"}),(0,o.jsxs)("button",{type:"button",className:"sd-button",onClick:()=>j(!0),children:[(0,o.jsx)(x.Acq,{})," QR-Code"]}),(0,o.jsx)("button",{type:"button",className:"sd-button sd-button--primary",onClick:()=>h(i),children:"Bearbeiten"})]}),(0,o.jsxs)("div",{className:"sd-stats",children:[(0,o.jsxs)("div",{className:"sd-stat".concat(null!=y&&y>=0&&y<=30?" sd-stat--warn":""),children:[(0,o.jsx)("span",{className:"sd-stat__label",children:"Lizenz"}),(0,o.jsx)("strong",{className:"sd-stat__value",children:i.license_type?pa(i.license_end_date)?"bis ".concat(pa(i.license_end_date)):"unbefristet":"Noch keine Schullizenz"}),(0,o.jsx)("span",{className:"sd-stat__sub",children:i.license_type?(0,o.jsxs)(o.Fragment,{children:[pa(i.license_start_date)?"seit ".concat(pa(i.license_start_date)," \xb7 "):"",A]}):"Individuell ausprobieren \xb7 kein schulweiter Pilot gestartet"})]}),(0,o.jsxs)("div",{className:"sd-stat",children:[(0,o.jsx)("span",{className:"sd-stat__label",children:"Lehrkr\xe4fte"}),(0,o.jsxs)("strong",{className:"sd-stat__value",children:[k,null!=S?" / ".concat(S):""]}),null!=z?(0,o.jsx)("span",{className:"sd-meter","aria-label":"".concat(z," % der Pl\xe4tze belegt"),children:(0,o.jsx)("span",{style:{width:"".concat(z,"%")},className:z>=90?"is-full":""})}):(0,o.jsx)("span",{className:"sd-stat__sub",children:"ohne Limit"})]}),(0,o.jsxs)("div",{className:"sd-stat",children:[(0,o.jsx)("span",{className:"sd-stat__label",children:"Klassen"}),(0,o.jsx)("strong",{className:"sd-stat__value",children:null!==(n=i.class_count)&&void 0!==n?n:0})]}),(0,o.jsxs)("div",{className:"sd-stat",children:[(0,o.jsx)("span",{className:"sd-stat__label",children:"Sch\xfcler:innen"}),(0,o.jsx)("strong",{className:"sd-stat__value",children:null!==(t=i.student_count)&&void 0!==t?t:0})]}),(0,o.jsxs)("div",{className:"sd-stat",children:[(0,o.jsx)("span",{className:"sd-stat__label",children:"\xdcbungsbl\xe4tter"}),(0,o.jsx)("strong",{className:"sd-stat__value",children:null!==(a=i.sheet_count)&&void 0!==a?a:0})]})]}),(0,o.jsx)(xs,{schoolId:i.id,teachers:_,username:d,password:u,onSelectTeacher:g}),(0,o.jsxs)("details",{className:"sd-section sd-collapse",children:[(0,o.jsx)("summary",{children:"Lehrkraft zuordnen oder einladen"}),(0,o.jsx)(is,{school:i,teachers:c,username:d,password:u,onChanged:m})]}),(0,o.jsx)("section",{className:"sd-section",children:(0,o.jsxs)("details",{className:"sd-collapse",children:[(0,o.jsx)("summary",{children:"Schulaktivit\xe4t im Zeitverlauf"}),(0,o.jsx)(da,{schoolId:i.id,username:d,password:u})]})})]}),p&&(0,o.jsx)(va,{teacher:p,onClose:()=>g(null)}),v&&(0,o.jsx)(ma,{school:i,username:d,password:u,onClose:()=>j(!1),onTokenChanged:m})]})},xa=e=>{let{teacher:s}=e;const[n,t]=(0,l.useState)([]),[r,d]=(0,l.useState)(null),[u,h]=(0,l.useState)([]),[m,p]=(0,l.useState)(!1),[g,x]=(0,l.useState)(!1),[v,j]=(0,l.useState)([]),[_,b]=(0,l.useState)("");(0,l.useEffect)(()=>
1{if(null===s||void 0===s||!s.id)return;let e=!1;return p(!0),b(""),t([]),d(null),(0,c.lwH)(s.id).then(s=>{e||t(Array.isArray(s)?s:[])}).catch(s=>{e||(console.error("Error loading admin classes:",s),b("Klassen konnten nicht geladen werden."),t([]))}).finally(()=>{e||p(!1)}),()=>{e=!0}},[null===s||void 0===s?void 0:s.id]);const f=(0,l.useCallback)(async()=>{if(null===r||void 0===r||!r.id)return h([]),void j([]);x(!0);try{const[e,s,n]=await Promise.all([(0,c.hqt)(r.id),(0,c.Zl3)(r.id).catch(()=>[]),(0,c.kOw)(r.id).catch(()=>[])]),t=new Map((s||[]).map(e=>[e.id,e.connected])),l=(e||[]).map(e=>(0,a.A)((0,a.A)({},e),{},{connected:t.has(e.id)?t.get(e.id):Boolean(e.connected)}));h(l),j(Array.isArray(n)?n:[])}catch(e){console.error("Error loading admin class students:",e),h([]),j([])}finally{x(!1)}},[null===r||void 0===r?void 0:r.id]);return(0,l.useEffect)(()=>{f()},[f]),(0,o.jsxs)("div",{className:"admin-class-explorer",children:[(0,o.jsxs)("div",{className:"admin-class-sidebar",children:[m&&(0,o.jsx)("div",{className:"muted",children:"Klassen werden geladen\u2026"}),_&&(0,o.jsx)("div",{className:"muted",children:_}),(0,o.jsx)(_s.Ay,{classes:n,students:u,activeClass:r,onSelectClass:d,onCreateClass:()=>{},onDeleteClass:()=>{},onToggleClassOpen:()=>{},readOnly:!0,storageKey:"admin-selected-class-".concat((null===s||void 0===s?void 0:s.id)||"unknown")})]}),(0,o.jsxs)("div",{className:"admin-class-detail",children:[g&&r&&(0,o.jsx)("div",{className:"muted",children:"Sch\xfcler werden geladen\u2026"}),(0,o.jsx)(bs.A,{classStudents:u,classTeachers:v,activeClass:r,school:(null===s||void 0===s?void 0:s.school_name)||"",onToggleClassOpen:void 0,teacherId:null===s||void 0===s?void 0:s.id,hasClasses:n.length>0,readOnly:!0,headerExtra:null!==r&&void 0!==r&&r.code?(0,o.jsx)(i.N_,{to:"/join?code=".concat(r.code),className:"admin-student-view-btn",title:"Als Sch\xfcler beitreten (Code: ".concat(r.code,")"),children:"\ud83d\udc41 Als Sch\xfcler anschauen"}):null})]})]})},va=e=>{let{teacher:s,onClose:n}=e;return(0,o.jsx)("div",{className:"teacher-explorer-overlay",onClick:e=>{e.target===e.currentTarget&&n()},children:(0,o.jsxs)("div",{className:"teacher-explorer-modal",children:[(0,o.jsxs)("div",{className:"teacher-explorer-header",children:[(0,o.jsxs)("div",{className:"teacher-explorer-title",children:[(0,o.jsx)(b.A,{seed:s.avatar_seed,size:32}),(0,o.jsxs)("div",{children:[(0,o.jsx)("div",{className:"teacher-explorer-name",children:s.name||"\u2013"}),(0,o.jsx)("div",{className:"teacher-explorer-email",children:s.email||"\u2013"})]})]}),(0,o.jsx)("button",{type:"button",className:"close-button",onClick:n,"aria-label":"Lehreransicht schlie\xdfen",children:(0,o.jsx)(x.QCr,{})})]}),(0,o.jsx)(xa,{teacher:s})]})})},ja={desktop:(0,o.jsx)(x.Wqt,{}),mobile:(0,o.jsx)(x.rle,{}),tablet:(0,o.jsx)(x.z4D,{})},_a={desktop:"Desktop",mobile:"Mobile",tablet:"Tablet"},ba=e=>{let{devices:s=[]}=e;return s.length?(0,o.jsx)("span",{className:"device-icons",children:["desktop","mobile","tablet"].filter(e=>s.includes(e)).map(e=>(0,o.jsx)("span",{className:"device-icon","data-tooltip-id":"admin-icon-tip","data-tooltip-content":_a[e],children:ja[e]},e))}):null},fa={Chrome:(0,o.jsx)(x.Wjq,{}),Firefox:(0,o.jsx)(x.zNO,{}),Safari:(0,o.jsx)(x.M7O,{}),Edge:(0,o.jsx)(x.lIe,{}),Opera:(0,o.jsx)(x.Lef,{})},ya=e=>{let{browsers:s=[]}=e;return s.length?(0,o.jsx)("span",{className:"device-icons",children:s.map(e=>{var s;return(0,o.jsx)("span",{className:"device-icon","data-tooltip-id":"admin-icon-tip","data-tooltip-content":e,children:null!==(s=fa[e])&&void 0!==s?s:(0,o.jsx)(x.vwk,{})},e)})}):null},ka=e=>{let{teacher:s,schools:n=[],username:t,password:a,onSchoolChanged:i,freeLimits:r,activityDays:c=30}=e;const[d,u]=(0,l.useState)(!1),[h,m]=(0,l.useState)(!1);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("details",{onToggle:e=>{e.target===e.currentTarget&&u(e.currentTarget.open)},children:[(0,o.jsxs)("summary",{children:[(0,o.jsx)(b.A,{seed:s.avatar_seed,size:32}),(0,o.jsxs)("div",{className:"teacher-summary",children:[(0,o.jsx)("div",{className:"teacher-name",title:Vt(s).join(" \xb7 ")||void 0,children:s.name||"\u2013"}),(0,o.jsx)("div",{className:"teacher-email",children:s.email||"\u2013"}),(0,o.jsxs)("div",{className:"teacher-school".concat(s.school_name?"":" teacher-school--none"),children:[s.school_name||"ohne Schule","admin"!==s.role&&(0,o.jsx)("button",{type:"button",className:"teacher-school-edit".concat(s.school_name?" teacher-school-edit--icon":""),onClick:e=>{e.preventDefault(),e.stopPropagation(),m(!0)},title:s.school_name?"Schule \xe4ndern":"Schule zuordnen","aria-label":s.school_name?"Schule \xe4ndern":"Schule zuordnen",children:s.school_name?(0,o.jsx)(x.Mbp,{}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(x.iM1,{})," zuordnen"]})})]}),s.manual_premium&&(0,o.jsx)("span",{className:"teacher-manual-premium-badge",children:"Manuell Premium"}),"teacher"===s.license_tier&&(0,o.jsx)("span",{className:"teacher-manual-premium-badge",children:"Private Lehrkraft-Lizenz"})]}),(0,o.jsx)("div",{className:"teacher-meta-date",title:"Registriert am",children:(0,o.jsx)(k,{value:s.created_at})}),(0,o.jsxs)("div",{className:"teacher-meta",children:[(0,o.jsx)(ba,{devices:s.devices}),(0,o.jsx)(ya,{browsers:s.browsers}),(0,o.jsx)(oa,{provider:s.auth_provider}),(0,o.jsx)("span",{className:"teacher-verified ".concat(s.is_email_verified?"verified":"unverified"),children:s.is_email_verified?(0,o.jsx)(x.A7C,{}):(0,o.jsx)(x._Hm,{})})]}),(0,o.jsx)(ns,{user:s,freeLimits:r})]}),(0,o.jsxs)("div",{className:"details-body",children:[d&&(0,o.jsx)(ss,{user:s,days:c,username:t,password:a,Chart:p}),d&&(0,o.jsxs)("details",{className:"user-extra-section",children:[(0,o.jsx)("summary",{children:"Schule und Lizenz verwalten"}),(0,o.jsx)(Ue,{teacher:s,schools:n,username:t,password:a,onChanged:i}),"teacher"===s.role&&(0,o.jsx)(as,{teacher:s,username:t,password:a,onChanged:i})]}),d&&(0,o.jsx)(xa,{teacher:s})]})]}),h&&(0,o.jsx)("div",{className:"school-modal",onClick:()=>m(!1),children:(0,o.jsxs)("div",{className:"school-modal-card school-modal-card--compact",onClick:e=>e.stopPropagation(),children:[(0,o.jsxs)("div",{className:"modal-header",children:[(0,o.jsxs)("h3",{children:[(0,o.jsx)(x.iM1,{})," ",s.name||s.email||"Lehrkraft",": Schule zuordnen"]}),(0,o.jsx)("button",{type:"button",className:"modal-close",onClick:()=>m(!1),children:"\xd7"})]}),(0,o.jsx)(Ue,{teacher:s,schools:n,username:t,password:a,onChanged:i})]})})]})},Na=e=>{let{student:s,username:n,password:t,activityDays:a=30}=e;const[i,r]=(0,l.useState)(!1);return(0,o.jsxs)("details",{onToggle:e=>{e.target===e.currentTarget&&r(e.currentTarget.open)},children:[(0,o.jsxs)("summary",{children:[(0,o.jsx)(b.A,{seed:s.avatar_seed,size:32}),(0,o.jsxs)("div",{className:"teacher-summary",children:[(0,o.jsx)("div",{className:"teacher-name",title:Vt(s).join(" \xb7 ")||void 0,children:s.name||"".concat("guest"===s.directory_role?"Gast":"Sch\xfcler"," \xb7 ").concat(String(s.id).slice(0,8))}),s.email&&(0,o.jsx)("div",{className:"teacher-email",children:s.email}),s.school_name&&(0,o.jsx)("div",{className:"teacher-school",children:s.school_name})]}),s.created_at&&(0,o.jsx)("div",{className:"teacher-meta-date",children:(0,o.jsx)(k,{value:s.created_at})}),(0,o.jsxs)("div",{className:"teacher-meta",children:[(0,o.jsx)(ba,{devices:s.devices}),(0,o.jsx)(ya,{browsers:s.browsers}),(0,o.jsx)(oa,{provider:s.auth_provider})]}),(0,o.jsx)(ns,{user:s})]}),(0,o.jsxs)("div",{className:"details-body",children:[i&&(0,o.jsx)(ss,{user:s,days:a,username:n,password:t,Chart:p}),s.class_name&&(0,o.jsxs)("div",{children:["Klasse: ",s.class_name]}),s.teacher_name&&(0,o.jsxs)("div",{children:["Lehrkraft: ",s.teacher_name]}),s.teacher_email&&(0,o.jsxs)("div",{children:["Lehrkraft-Mail: ",s.teacher_email]}),i&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(wa,{studentId:s.id}),(0,o.jsx)(ks.StudentModalContent,{student:s,inline:!0})]})]})]})},Sa=e=>{let{parent:s,username:n,password:t,activityDays:a=30}=e;const[i,r]=(0,l.useState)(!1);return(0,o.jsxs)("details",{onToggle:e=>{e.target===e.currentTarget&&r(e.currentTarget.open)},children:[(0,o.jsxs)("summary",{children:[(0,o.jsx)(b.A,{seed:s.avatar_seed,size:32}),(0,o.jsxs)("div",{className:"teacher-summary",children:[s.name&&(0,o.jsx)("div",{className:"teacher-name",children:s.name}),s.email&&(0,o.jsx)("div",{className:"teacher-email",children:s.email})]}),(0,o.jsx)("div",{className:"teacher-meta",children:(0,o.jsx)(oa,{provider:s.auth_provider})}),s.created_at&&(0,o.jsx)("div",{className:"teacher-meta-date",children:(0,o.jsx)(k,{value:s.created_at})}),(0,o.jsx)("div",{className:"teacher-counts",children:(0,o.jsxs)("div",{children:[(0,o.jsx)("strong",{children:Number(s.child_count)||0}),(0,o.jsx)("span",{children:"Kinder"})]})}),(0,o.jsx)(ns,{user:s})]}),(0,o.jsxs)("div",{className:"details-body",children:[i&&(0,o.jsx)(ss,{user:s,days:a,username:n,password:t,Chart:p}),s.children&&s.children.length>0?(0,o.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:"0.5rem",marginTop:"0.5rem"},children:s.children.map(e=>(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"0.4rem",background:"#f3f4f6",borderRadius:"6px",padding:"0.3rem 0.6rem",fontSize:"0.85rem"},children:[(0,o.jsx)(b.A,{seed:e.avatar_seed,size:24}),(0,o.jsx)("span",{children:e.name||"(kein Name)"}),e.points>0&&(0,o.jsxs)("span",{style:{color:"#6b7280"},children:["\xb7 ",e.points," XP"]})]},e.id))}):(0,o.jsx)("div",{className:"muted",children:"Keine verkn\xfcpften Kinder"})]})]})},wa=e=>{let{studentId:s}=e;const[n,t]=(0,l.useState)(null);return(0,l.useEffect)(()=>
1{if(!s)return;let e=!1;return(0,c.D$3)(s).then(s=>{e||t(Array.isArray(s)?s:[])}).catch(()=>{e||t([])}),()=>{e=!0}},[s]),null===n?(0,o.jsx)("div",{className:"muted",children:"Diagnostik wird geladen\u2026"}):0===n.length?null:(0,o.jsxs)("div",{className:"admin-diagnostic-log",children:[(0,o.jsx)("div",{className:"admin-diagnostic-title",children:"Diagnostik-Log"}),(0,o.jsx)("div",{className:"admin-diagnostic-entries",children:n.map(e=>(0,o.jsxs)("div",{className:"admin-diagnostic-entry",children:[(0,o.jsx)("span",{className:"diagnostic-indicator ".concat(e.is_correct?"is-correct":"is-wrong")}),(0,o.jsxs)("span",{className:"diagnostic-body",children:[(0,o.jsx)("span",{className:"diagnostic-diagnosis",children:e.diagnosis}),(0,o.jsxs)("span",{className:"diagnostic-meta",children:[e.task_type&&(0,o.jsx)("span",{className:"diagnostic-tag",children:e.task_type}),(0,o.jsx)("span",{className:"diagnostic-time",children:(0,js.Yq)(e.created_at)})]})]})]},e.id))})]})},za={teacher:"Lehrkraft",admin:"Lehrkraft",student:"Sch\xfcler",guest:"Gast",parent:"Elternteil"},Aa=e=>{let{username:s,password:n}=e;const[t,a]=(0,l.useState)([]);return(0,l.useEffect)(()=>{let e=!1;const t=()=>{(0,c.HiV)(s,n).then(s=>{e||a(s.users||[])}).catch(()=>{})};t();const l=setInterval(t,15e3);return()=>{e=!0,clearInterval(l)}},[s,n]),0===t.length?null:(0,o.jsxs)("div",{className:"online-strip",children:[(0,o.jsx)("span",{className:"online-strip-dot"}),(0,o.jsxs)("span",{className:"online-strip-count",children:[t.length," online"]}),(0,o.jsx)("div",{className:"online-strip-avatars",children:t.map(e=>{const s="online-tip-".concat(e.id),n=[e.name||e.email||"?",za[e.role]||e.role,e.class_name,e.school_name].filter(Boolean).join(" \xb7 ");return(0,o.jsxs)(l.Fragment,{children:[(0,o.jsx)("div",{className:"online-avatar-wrap","data-tooltip-id":s,"data-tooltip-content":n,children:(0,o.jsx)(b.A,{seed:e.avatar_seed,size:26})}),(0,o.jsx)(vs.m_,{id:s,place:"bottom"})]},e.id)})})]})},Ca={progress:"#22c55e",session:"#a855f7",hints:"#f97316",sheets:"#14b8a6",tasks:"#6366f1",register:"#3b82f6",login:"#ec4899",students:"#0ea5e9",teachers:"#f59e0b",summary:"#10b981",practice:"#f43f5e",parents:"#84cc16",folders:"#64748b",welcome:"#a78bfa",other:"#94a3b8"},Da={progress:"Fortschritt",session:"Session",hints:"Hints/AI",sheets:"Bl\xe4tter",tasks:"Aufgaben",register:"Registrierung",login:"Login",students:"Sch\xfcler-API",teachers:"Lehrer-API",summary:"Zusammenfassung",practice:"\xdcben",parents:"Eltern-API",folders:"Ordner",welcome:"Willkommen",other:"Sonstiges"};function La(e){const s=e.getTimezoneOffset();return new Date(e.getTime()-6e4*s).toISOString().slice(0,16)}function Ea(e){let{username:s,password:n}=e;const t=new Date,[i,r]=(0,l.useState)(()=>La(new Date(t-36e5))),[d,u]=(0,l.useState)(()=>La(t)),[h,m]=(0,l.useState)("1h"),[p,g]=(0,l.useState)(null),[v,j]=(0,l.useState)(!1),[_,b]=(0,l.useState)(null),[f,y]=(0,l.useState)(null),[k,N]=(0,l.useState)(null),S=(0,l.useCallback)(async(e,t)=>{j(!0),b(null);try{const a=await(0,c.MU1)(s,n,{from_ts:e.toISOString(),to_ts:t.toISOString()});g(a)}catch(a){b(a.message||"Fehler beim Laden")}finally{j(!1)}},[s,n]),w=(0,l.useCallback)(e=>{var s;const n=new Date,t=null!==(s={"1h":1,"6h":6,"24h":24}[e])&&void 0!==s?s:1,a=new Date(n-36e5*t);r(La(a)),u(La(n)),m(e),S(a,n)},[S]);(0,l.useEffect)(()=>{w("1h")},[w]);const{userRows:z,fromTs:A,rangeMs:C,categories:D}=(0,l.useMemo)(()=>{if(!p)return{userRows:[],fromTs:null,rangeMs:0,categories:[]};const e=new Date(p.from_ts),s=new Date(p.to_ts)-e||1,n=new Map,t=new Set;p.logs.forEach(e=>{var s;const a=null!==(s=e.user_id)&&void 0!==s?s:"__anon__";var l,i,r;n.has(a)||n.set(a,{user_id:e.user_id,user_name:null!==(l=e.user_name)&&void 0!==l?l:"Anonym",user_email:null!==(i=e.user_email)&&void 0!==i?i:null,user_role:null!==(r=e.user_role)&&void 0!==r?r:null,events:[],first_ts:new Date(e.ts)});n.get(a).events.push(e),e.category&&t.add(e.category)});const a={student:0,teacher:1};return{userRows:Array.from(n.values()).sort((e,s)=>{var n,t;return(null!==(n=a[e.user_role])&&void 0!==n?n:9)-(null!==(t=a[s.user_role])&&void 0!==t?t:9)||e.first_ts-s.first_ts}),fromTs:e,rangeMs:s,categories:Array.from(t).sort()}},[p]),L=(0,l.useMemo)(()=>
1{if(!A||!C)return[];return Array.from({length:9},(e,s)=>({pct:s/8*100,label:new Date(A.getTime()+s/8*C).toLocaleTimeString("de-DE",{hour:"2-digit",minute:"2-digit"})}))},[A,C]);return(0,o.jsxs)("section",{className:"admin-section",children:[(0,o.jsxs)("h3",{className:"section-title",children:[(0,o.jsx)(x.ATg,{})," Aktions\xfcbersicht"]}),(0,o.jsxs)("div",{className:"action-controls",children:[[["1h","Letzte Stunde"],["6h","Letzte 6 Std."],["24h","Letzte 24 Std."]].map(e=>{let[s,n]=e;return(0,o.jsx)("button",{type:"button",className:"action-preset".concat(h===s?" active":""),onClick:()=>w(s),children:n},s)}),(0,o.jsx)("span",{className:"action-controls-sep"}),(0,o.jsx)("label",{className:"action-range-label",children:"Von"}),(0,o.jsx)("input",{type:"datetime-local",className:"action-range-input",value:i,onChange:e=>{r(e.target.value),m(null)}}),(0,o.jsx)("label",{className:"action-range-label",children:"Bis"}),(0,o.jsx)("input",{type:"datetime-local",className:"action-range-input",value:d,onChange:e=>{u(e.target.value),m(null)}}),(0,o.jsxs)("button",{type:"button",className:"action-reload",onClick:()=>{m(null),S(new Date(i),new Date(d))},children:[(0,o.jsx)(x.DIg,{})," Laden"]}),p&&(0,o.jsxs)("span",{className:"action-count-badge",children:[p.total," Aktionen"]})]}),D.length>0&&(0,o.jsxs)("div",{className:"action-legend",children:[D.map(e=>{var s,n;return(0,o.jsxs)("span",{className:"action-legend-item",children:[(0,o.jsx)("span",{className:"action-legend-dot",style:{background:null!==(s=Ca[e])&&void 0!==s?s:"#94a3b8"}}),null!==(n=Da[e])&&void 0!==n?n:e]},e)}),(0,o.jsxs)("span",{className:"action-legend-item",children:[(0,o.jsx)("span",{className:"action-legend-dot action-legend-dot--slow"}),">2s"]}),(0,o.jsx)("span",{className:"action-legend-hint",children:"Zeile anklicken f\xfcr Details"})]}),v&&(0,o.jsx)("p",{style:{color:"#64748b",fontSize:"0.85rem"},children:"Lade\u2026"}),_&&(0,o.jsx)("p",{style:{color:"#dc2626",fontSize:"0.85rem"},children:_}),p&&!v&&(0,o.jsxs)("div",{className:"action-timeline-wrap",onMouseLeave:()=>N(null),children:[(0,o.jsxs)("div",{className:"action-timeline-row action-timeline-row--header",children:[(0,o.jsx)("div",{className:"action-user-col"}),(0,o.jsx)("div",{className:"action-track-col",children:L.map((e,s)=>(0,o.jsx)("span",{className:"action-time-tick",style:{left:"".concat(e.pct,"%")},children:e.label},s))})]}),0===z.length?(0,o.jsx)("div",{style:{padding:"12px 16px",color:"#94a3b8",fontSize:"0.85rem"},children:"Keine Aktionen im gew\xe4hlten Zeitraum."}):z.map(e=>{var s;const n=null!==(s=e.user_id)&&void 0!==s?s:"__anon__",t=f===n,i=function(e,s,n){let t=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1.2;if(!e.length)return[];const a=[...e].sort((e,s)=>new Date(e.ts)-new Date(s.ts)),l=[];let i={events:[a[0]],pct:(new Date(a[0].ts)-s)/n*100};for(let r=1;r<a.length;r++){const e=(new Date(a[r].ts)-s)/n*100;e-i.pct<t?i.events.push(a[r]):(l.push(i),i={events:[a[r]],pct:e})}return l.push(i),l}(e.events,A,C),r=Math.max(...e.events.map(e=>{var s;return null!==(s=e.duration_ms)&&void 0!==s?s:0})),c=r>2e3,d=!c&&r>1e3;return(0,o.jsxs)(l.Fragment,{children:[(0,o.jsxs)("div",{className:"action-timeline-row action-timeline-row--clickable".concat(t?" action-timeline-row--open":""),onClick:()=>(e=>y(s=>s===e?null:e))(n),children:[(0,o.jsxs)("div",{className:"action-user-col",children:[(0,o.jsxs)("div",{className:"action-user-name",children:[e.user_name,c&&(0,o.jsx)("span",{className:"action-user-slow-badge",title:"Mind. 1 Aufruf >2s",children:"!"}),d&&!c&&(0,o.jsx)("span",{className:"action-user-warn-badge",title:"Mind. 1 Aufruf >1s",children:"~"})]}),e.user_email&&(0,o.jsx)("div",{className:"action-user-email",children:e.user_email}),(0,o.jsxs)("div",{className:"action-user-footer",children:[e.user_role&&(0,o.jsx)("span",{className:"action-user-role action-user-role--".concat(e.user_role),children:e.user_role}),(0,o.jsx)("span",{className:"action-user-count",children:e.events.length})]})]}),(0,o.jsx)("div",{className:"action-track-col",children:i.map((e,s)=>{var n;const t=function(e){var s,n;const t={};
1return e.forEach(e=>{var s;t[e.category]=(null!==(s=t[e.category])&&void 0!==s?s:0)+1}),null!==(s=null===(n=Object.entries(t).sort((e,s)=>s[1]-e[1])[0])||void 0===n?void 0:n[0])&&void 0!==s?s:"other"}(e.events),l=null!==(n=Ca[t])&&void 0!==n?n:"#94a3b8",i=e.events.length,r=Math.max(...e.events.map(e=>{var s;return null!==(s=e.duration_ms)&&void 0!==s?s:0})),c=r>2e3,d=!c&&r>1e3,u=1===i?9:i<=4?12:15,h=Math.max(.5,Math.min(99.5,e.pct));return(0,o.jsx)("span",{className:"action-dot".concat(c?" action-dot--slow":d?" action-dot--warn":""),style:{left:h,width:u,height:u,background:l,marginLeft:-u/2,marginTop:-u/2},onMouseEnter:s=>N({cluster:e,x:s.clientX,y:s.clientY}),onMouseMove:e=>N(s=>s?(0,a.A)((0,a.A)({},s),{},{x:e.clientX,y:e.clientY}):null),children:i>1&&(0,o.jsx)("span",{className:"action-dot-count",children:i>99?"99+":i})},s)})})]}),t&&(0,o.jsxs)("div",{className:"action-detail",children:[(0,o.jsxs)("div",{className:"action-detail-stats",children:[(0,o.jsxs)("span",{children:[e.events.length," Aufrufe"]}),(0,o.jsxs)("span",{children:["\xd8 ",Math.round(e.events.reduce((e,s)=>{var n;return e+(null!==(n=s.duration_ms)&&void 0!==n?n:0)},0)/e.events.length)," ms"]}),(0,o.jsxs)("span",{children:["Max ",r," ms"]})]}),(0,o.jsx)("div",{className:"action-detail-table-wrap",children:(0,o.jsxs)("table",{className:"action-detail-table",children:[(0,o.jsx)("thead",{children:(0,o.jsxs)("tr",{children:[(0,o.jsx)("th",{children:"Zeit"}),(0,o.jsx)("th",{children:"Kategorie"}),(0,o.jsx)("th",{children:"Methode"}),(0,o.jsx)("th",{children:"Pfad"}),(0,o.jsx)("th",{children:"Status"}),(0,o.jsx)("th",{children:"Dauer"})]})}),(0,o.jsx)("tbody",{children:[...e.events].sort((e,s)=>new Date(e.ts)-new Date(s.ts)).map((e,s)=>{var n,t,a;const l=e.duration_ms>2e3,i=!l&&e.duration_ms>1e3;return(0,o.jsxs)("tr",{className:l?"action-row--slow":i?"action-row--warn":"",children:[(0,o.jsx)("td",{className:"action-cell-time",children:new Date(e.ts).toLocaleTimeString("de-DE",{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),(0,o.jsx)("td",{children:(0,o.jsx)("span",{className:"action-cat-chip",style:{background:null!==(t=Ca[e.category])&&void 0!==t?t:"#94a3b8"},children:null!==(a=Da[e.category])&&void 0!==a?a:e.category})}),(0,o.jsx)("td",{className:"action-cell-method",children:e.method}),(0,o.jsx)("td",{className:"action-cell-path",title:e.path,children:e.path}),(0,o.jsx)("td",{className:e.status_code>=400?"action-cell-err":"",children:e.status_code}),(0,o.jsxs)("td",{className:"action-cell-dur".concat(l?" slow":i?" warn":""),children:[e.duration_ms," ms"]})]},null!==(n=e.id)&&void 0!==n?n:s)})})]})})]})]},n)})]}),k&&(0,o.jsx)("div",{className:"action-tooltip",style:{left:k.x+14,top:k.y-10},children:1===k.cluster.events.length?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{className:"action-tooltip-path",children:[(0,o.jsx)("strong",{children:k.cluster.events[0].method})," ",k.cluster.events[0].path]}),(0,o.jsxs)("div",{className:"action-tooltip-meta",children:[k.cluster.events[0].status_code," \xb7 ",(0,o.jsxs)("span",{className:k.cluster.events[0].duration_ms>2e3?"action-tooltip-slow":k.cluster.events[0].duration_ms>1e3?"action-tooltip-warn":"",children:[k.cluster.events[0].duration_ms," ms"]})," \xb7 ",new Date(k.cluster.events[0].ts).toLocaleTimeString("de-DE")]})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{className:"action-tooltip-cluster-head",children:[k.cluster.events.length," Aufrufe"," \xb7 ",new Date(k.cluster.events[0].ts).toLocaleTimeString("de-DE")," \u2013 ",new Date(k.cluster.events[k.cluster.events.length-1].ts).toLocaleTimeString("de-DE")]}),k.cluster.events.slice(0,5).map((e,s)=>{var n;return(0,o.jsxs)("div",{className:"action-tooltip-cluster-row",children:[(0,o.jsx)("span",{className:"action-tooltip-dot",style:{background:null!==(n=Ca[e.category])&&void 0!==n?n:"#94a3b8"}}),(0,o.jsxs)("span",{className:"action-tooltip-path",children:[e.method," ",e.path]}),(0,o.jsxs)("span",{className:"action-tooltip-dur ".concat(e.duration_ms>2e3?"action-tooltip-slow":e.duration_ms>1e3?"action-tooltip-warn":""),children:[e.duration_ms,"ms"]})]},s)}),k.cluster.events.length>5&&(0,o.jsxs)("div",{className:"action-tooltip-meta",children:["\u2026und ",k.cluster.events.length-5," weitere"]})]})})]})}const Ma=new Set(["overview","users","schools"]),Ta=()=>{var e,s,n,t,h,m,v,j,y,k,N,w,A,C,D,L,E,M,T,K,B,F,P,R,H,O,W,Z,V;const{creds:I,logout:G}=(0,r.bn)(),[Q]=(0,l.useState)((null===I||void 0===I?void 0:I.username)||""),[q]=(0,l.useState)((null===I||void 0===I?void 0:I.password)||""),[U,Y]=(0,l.useState)(!1),[J,X]=(0,l.useState)(""),[$,ee]=(0,l.useState)(null),[se,ne]=(0,l.useState)(null),[te,ae]=(0,l.useState)(null),[le,ie]=(0,l.useState)(null),[re,ce]=(0,l.useState)(null),[oe]=(0,i.ok)(),de=oe.get("tab"),ue=Pt.XN.includes(de)?de:Pt.Qy,he=Ma.has(ue),[me,pe]=(0,l.useState)(!1),[ge,xe]=(0,l.useState)(!1),[ve,je]=(0,l.useState)(!1),[_e,be]=(0,l.useState)(!1),[fe,ye]=(0,l.useState)(!1),[ke,Ne]=(0,l.useState)(""),[Se,we]=(0,l.useState)(null),ze=(0,l.useRef)(!1),Ae=(0,l.useRef)(!1),Ce=(0,l.useRef)(!1),De=(0,l.useRef)(!1),Le=(0,l.useRef)(!1),Ee=(new Date).toISOString().slice(0,10),[Me,Te]=(0,l.useState)(""),[Ke,Be]=(0,l.useState)(Ee),[Pe,Re]=(0,l.useState)(!1),[He,Oe]=(0,l.useState)(null),[We,Ze]=(0,l.useState)(null),[Ve,Ie]=(0,l.useState)(""),[Ge,qe]=(0,l.useState)(""),[Ue,Ye]=(0,l.useState)(!1),[Je,Xe]=(0,l.useState)(null),[$e,es]=(0,l.useState)(!1),[ss,ns]=(0,l.useState)(!1),[as,ls]=(0,l.useState)(""),[is,rs]=(0,l.useState)(!0),[ds,hs]=(0,l.useState)(!1),[ms,ps]=(0,l.useState)(!1),[gs,xs]=(0,l.useState)(!1),[_s,bs]=(0,l.useState)(!1),[fs,ks]=(0,l.useState)(null),Ns=(0,l.useRef)(!1),[Ss,ws]=(0,l.useState)(!0),[zs,As]=(0,l.useState)(!1),[Ds,Ls]=(0,l.useState)(null),[Es,Ms]=(0,l.useState)({}),[Ts,Bs]=(0,l.useState)([]),[Fs,Ps]=(0,l.useState)([]),[Rs,Hs]=(0,l.useState)([]),[Os,Ws]=(0,l.useState)([]),[Zs,Vs]=(0,l.useState)(null),Is=(0,l.useMemo)(()=>[...null!==te&&void 0!==te&&te.sheets?Ht(te.sheets):[],...null!==te&&void 0!==te&&te.student_sheets?Ht(te.student_sheets):[]].sort((e,s)=>{var n,t,a,l;const i=new Date(null!==(n=null!==(t=e.last_progress_at)&&void 0!==t?t:e.created_at)&&void 0!==n?n:0);return new Date(null!==(a=null!==(l=s.last_progress_at)&&void 0!==l?l:s.created_at)&&void 0!==a?a:0)-i}),[te]),Gs=(0,l.useMemo)(()=>
1{const e=Me?new Date(Me).getTime():null,s=Ke?new Date(Ke+"T23:59:59").getTime():null;return Is.filter(n=>{var t,a;const l=new Date(null!==(t=null!==(a=n.last_progress_at)&&void 0!==a?a:n.created_at)&&void 0!==t?t:0).getTime();return!(e&&l<e)&&!(s&&l>s)})},[Is,Me,Ke]),Qs=(0,l.useMemo)(()=>{const e=new Map;return null!==$&&void 0!==$&&$.teachers?($.teachers.forEach(s=>{s.school_id&&(e.has(s.school_id)||e.set(s.school_id,[]),e.get(s.school_id).push(s))}),e.forEach(e=>{e.sort((e,s)=>(e.name||"").localeCompare(s.name||""))}),e):e},[$]),qs=(0,l.useMemo)(()=>{const e=[...(null===$||void 0===$?void 0:$.teachers)||[],...(null===$||void 0===$?void 0:$.students)||[]],s=(null===$||void 0===$?void 0:$.teachers)||[],n=(null===$||void 0===$?void 0:$.students)||[],t=(null===$||void 0===$?void 0:$.parents)||[],a=(null===$||void 0===$?void 0:$.teacher_classes)||[];return{states:It(e,"state",Yt),grades:Gt(e),schoolTypes:It(e,"school_type",Jt),teachers:{states:It(s,"state",Yt),gradeBars:qt(a,1,13),schoolTypes:It(s,"school_type",Jt),providers:na(s)},students:{states:It(n,"state",Yt),grades:Gt(n),gradeBars:Qt(n,1,13),schoolTypes:It(n,"school_type",Jt),providers:na(n)},parents:{providers:na(t)},allProviders:na([...s,...n,...t])}},[$]),Us=(0,l.useMemo)(()=>{const e=Ss?null===se||void 0===se?void 0:se.user_series:null===se||void 0===se?void 0:se.user_series_all;if(!e)return[];const s=is?u:e=>e,n=[{label:"Nutzer",color:"#2563eb",data:s(d(e,"total_users"))},{label:"Lehrkr\xe4fte",color:"#f59e0b",data:s(d(e,"teachers"))},{label:"Eltern",color:"#8b5cf6",data:s(d(e,"parents"))}];return zs&&n.push({label:"G\xe4ste",color:"#d1d5db",data:s(d(e,"guest_users"))}),n},[se,is,Ss,zs]),Ys=(0,l.useMemo)(()=>{const e=Ss?null===se||void 0===se?void 0:se.user_series:null===se||void 0===se?void 0:se.user_series_all;if(!e)return[];const s=is?u:e=>e,n=d(e,"teachers"),t=d(e,"parents"),a=e.map(e=>({date:e.day,value:Math.max(0,(Number(e.total_users)||0)-(Number(e.teachers)||0)-(Number(e.parents)||0)+(zs&&Number(e.guest_users)||0))}));return[{label:"Lehrkr\xe4fte",color:"#f59e0b",data:s(n)},{label:"Eltern",color:"#8b5cf6",data:s(t)},{label:"Sch\xfcler",color:"#2563eb",data:s(a)}]},[se,is,Ss,zs]),Js=(0,l.useMemo)(()=>{const e=Ss?null===se||void 0===se?void 0:se.user_series:null===se||void 0===se?void 0:se.user_series_all;if(!e)return[];const s=is?u:e=>e,n=[{label:"E-Mail",icon:sa["E-Mail"],color:ea["E-Mail"],data:s(d(e,"local_users"))},{label:"Google",icon:sa.Google,color:ea.Google,data:s(d(e,"google_users"))},{label:"Microsoft",icon:sa.Microsoft,color:ea.Microsoft,data:s(d(e,"microsoft_users"))},{label:"EduPlaces",icon:sa.EduPlaces,color:ea.EduPlaces,data:s(d(e,"eduplaces_users"))},{label:"Apple",icon:sa.Apple,color:ea.Apple,data:s(d(e,"apple_users"))},{label:"QR-Karte",icon:sa["QR-Karte"],color:ea["QR-Karte"],data:s(d(e,"other_users"))}];zs&&n.push({label:"G\xe4ste",icon:sa.Gast,color:ea.Gast,data:s(d(e,"guest_users"))});const t=e=>e.data.reduce((e,s)=>{var n;return e+(null!==(n=s.y)&&void 0!==n?n:0)},0);return n.sort((e,s)=>t(s)-t(e))},[se,is,Ss,zs]),Xs=(0,l.useMemo)(()=>null!==se&&void 0!==se&&se.returning_series?is?[{label:"Sch\xfcler (erstmals zur\xfcck)",color:"#2563eb",data:u(d(se.returning_series,"new_returning_students"))},{label:"Lehrkr\xe4fte (erstmals zur\xfcck)",color:"#f59e0b",data:u(d(se.returning_series,"new_returning_teachers"))}]:[{label:"Sch\xfcler aktiv",color:"#2563eb",data:d(se.returning_series,"returning_students")},{label:"Lehrkr\xe4fte aktiv",color:"#f59e0b",data:d(se.returning_series,"returning_teachers")}]:[],[se,is]),$s=(0,l.useMemo)(()=>{if(null===se||void 0===se||!se.sheet_series)return[];const e=is?u:e=>e;return[{label:"Lehrkraft",color:"#f59e0b",data:e(d(se.sheet_series,"teacher_sheets"))},{label:"Sch\xfcler",color:"#2563eb",data:e(d(se.sheet_series,"student_sheets"))}]},[se,is]),en=(0,l.useMemo)(()=>{if(null===se||void 0===se||!se.progress_series)return[];const e=is?u:e=>e;return[{label:"Fehlerhaft",color:"#000000",data:e(d(se.progress_series,"error"))},{label:"Falsch",color:"#ef4444",data:e(d(se.progress_series,"wrong"))},{label:"In Arbeit",color:"#f59e0b",data:e(d(se.progress_series,"in_work"))},{label:"Korrigiert",color:"#86d486",data:e(d(se.progress_series,"corrected"))},{label:"Korrekt",color:"#10b981",data:e(d(se.progress_series,"correct"))}]},[se,is]),sn=(0,l.useMemo)(()=>
1{if(null===se||void 0===se||!se.task_type_series)return[];const e=is?u:e=>e,s=[{key:"sketch",label:"Skizze",color:"#8b5cf6"},{key:"choice",label:"Multiple Choice",color:"#2563eb"},{key:"cloze",label:"L\xfcckentext",color:"#10b981"},{key:"matching",label:"Zuordnung",color:"#f59e0b"},{key:"sort",label:"Sortierung",color:"#f97316"},{key:"coordinate",label:"Koordinate",color:"#14b8a6"},{key:"number_line",label:"Zahlenstrahl",color:"#ef4444"},{key:"number_pyramid",label:"Zahlenpyramide",color:"#ec4899"}].map(s=>(0,a.A)((0,a.A)({},s),{},{total:se.task_type_series.reduce((e,n)=>e+(Number(n[s.key])||0),0),data:e(d(se.task_type_series,s.key))}));return s.sort((e,s)=>e.total-s.total),s.filter(e=>e.total>0)},[se,is]),nn={Chrome:(0,o.jsx)(x.Wjq,{}),Firefox:(0,o.jsx)(x.zNO,{}),Safari:(0,o.jsx)(x.M7O,{}),Edge:(0,o.jsx)(x.lIe,{}),Opera:(0,o.jsx)(x.Lef,{})},tn={Chrome:"#4285f4",Firefox:"#e55b0a",Safari:"#af52de",Edge:"#00b7c3",Opera:"#cc0f16",Samsung:"#1428a0",Other:"#94a3b8"},an=(0,l.useMemo)(()=>{var e,s,n,t,a,l,i;if(null===fs||void 0===fs||null===(e=fs.device_series)||void 0===e||!e.length)return[];const r=is?u:e=>e;return[{label:"Desktop",icon:(0,o.jsx)(x.Wqt,{}),color:"#2563eb",total:null!==(s=null===(n=fs.device_totals)||void 0===n?void 0:n.desktop)&&void 0!==s?s:0,data:r(fs.device_series.map(e=>({date:e.day,value:e.desktop||0})))},{label:"Mobile",icon:(0,o.jsx)(x.rle,{}),color:"#10b981",total:null!==(t=null===(a=fs.device_totals)||void 0===a?void 0:a.mobile)&&void 0!==t?t:0,data:r(fs.device_series.map(e=>({date:e.day,value:e.mobile||0})))},{label:"Tablet",icon:(0,o.jsx)(x.z4D,{}),color:"#f59e0b",total:null!==(l=null===(i=fs.device_totals)||void 0===i?void 0:i.tablet)&&void 0!==l?l:0,data:r(fs.device_series.map(e=>({date:e.day,value:e.tablet||0})))}]},[fs,is]),rn=(0,l.useMemo)(()=>{var e,s;if(null===fs||void 0===fs||null===(e=fs.browser_series)||void 0===e||!e.length)return[];const n=is?u:e=>e;return(null!==(s=fs.browser_keys)&&void 0!==s?s:[]).map(e=>{var s,t,a,l;return{label:e,icon:null!==(s=nn[e])&&void 0!==s?s:null,color:null!==(t=tn[e])&&void 0!==t?t:"#94a3b8",total:null!==(a=null===(l=fs.browser_totals)||void 0===l?void 0:l[e])&&void 0!==a?a:0,data:n(fs.browser_series.map(s=>({date:s.day,value:s[e]||0})))}}).filter(e=>e.total>0).sort((e,s)=>s.total-e.total)},[fs,is]),cn=(0,l.useCallback)(async()=>{if(!Le.current){Le.current=!0,Y(!0),X("");try{ee(await(0,c.paO)(Q.trim(),q.trim(),200))}catch(e){Le.current=!1,X(Ot(e,"Abruf fehlgeschlagen"))}finally{Y(!1)}}},[Q,q]),on=(0,l.useCallback)(async()=>{if(!ze.current&&!me){ze.current=!0,pe(!0),xe(!1);try{const e=await(0,c.ny0)(Q.trim(),q.trim());ne(e)}catch(e){ze.current=!1,xe(!0)}finally{pe(!1)}}},[Q,q,me]),dn=(0,l.useCallback)(async()=>{if(!Ae.current&&!ve){Ae.current=!0,je(!0);try{const e=await(0,c.bLm)(Q.trim(),q.trim(),200);ae(e)}catch(e){Ae.current=!1}finally{je(!1)}}},[Q,q,ve]),un=(0,l.useCallback)(async()=>{if(!Ce.current&&!_e){Ce.current=!0,be(!0);try{const e=await(0,c.mks)(Q.trim(),q.trim());ie(e)}catch(e){Ce.current=!1}finally{be(!1)}}},[Q,q,_e]),hn=(0,l.useCallback)(async()=>{if(!De.current&&!fe){De.current=!0,ye(!0),Ne("");try{const e=await(0,c.mOT)(Q.trim(),q.trim());ce(e)}catch(e){De.current=!1,Ne(z(e,"Lifecycle-Daten konnten nicht geladen werden."))}finally{ye(!1)}}},[Q,q,fe]),mn=(0,l.useCallback)((e,s)=>(0,c.U7u)(Q.trim(),q.trim(),e.id,s.id),[Q,q]),pn=(0,l.useCallback)(e=>(0,c.ou$)(Q.trim(),q.trim(),e.id),[Q,q]),gn=(0,l.useCallback)(async()=>{if(!Ns.current){Ns.current=!0;try{const e=await(0,c.e82)(Q.trim(),q.trim());ks(e)}catch(e){Ns.current=!1}}},[Q,q]);(0,l.useEffect)(()=>{Q&&q&&(he&&cn(),"overview"!==ue&&"stats"!==ue||gn(),"stats"===ue&&on(),"sheets"===ue&&dn(),"campaigns"===ue&&un(),"lifecycle"===ue&&hn())},[ue,he,Q,q,cn,gn,on,dn,un,hn]);const xn=(0,l.useMemo)(()=>{var e;if(null===$||void 0===$||!$.teachers||Ve.trim().length<2||!He)return[];const s=Ve.trim().toLowerCase(),n=new Set(null===(e=He.admins)||void 0===e?void 0:e.map(e=>e.id));return $.teachers.filter(e=>(e.name||"").toLowerCase().includes(s)||(e.email||"").toLowerCase().includes(s)).filter(e=>!n.has(e.id)&&(!e.school_id||e.school_id===He.id)).slice(0,8)},[null===$||void 0===$?void 0:$.teachers,Ve,He]),vn=(0,l.useCallback)(async()=>{try{const e=await(0,c.paO)(Q.trim(),q.trim(),200);ee(e)}catch(e){}},[Q,q]),jn=e=>{var s;qe(""),Oe((0,a.A)((0,a.A)({},e),{},{admins:((null===$||void 0===$?void 0:$.teachers)||[]).filter(s=>"admin"===s.role&&s.school_id===e.id)}
1)),Ze({name:e.name||"",isDemo:Boolean(e.is_demo),licenseType:e.license_type||"none",licenseStart:e.license_start_date?new Date(e.license_start_date).toISOString().slice(0,10):"",licenseEnd:e.license_end_date?new Date(e.license_end_date).toISOString().slice(0,10):"",maxTeachers:null!==(s=e.max_teachers)&&void 0!==s?s:"",unlimited:null==e.max_teachers,state:e.state||"",schoolType:e.school_type||"",eduplacesSchoolId:e.eduplaces_school_id||""}),Ie(""),Re(!0)},_n=()=>{es(!1),Xe(null),ls(""),ns(!1),Ls(null),Ms({}),Bs([]),Ps([]),Hs([]),Ws([]),Vs(null)};return(0,o.jsxs)("div",{className:"admin-page",children:[(0,o.jsxs)("div",{className:"admin-card",children:[(0,o.jsxs)("div",{className:"admin-header",children:[(0,o.jsxs)("div",{className:"admin-header-row",children:[(0,o.jsx)("h2",{children:"Admin"}),(0,o.jsx)("div",{className:"admin-header-spacer"}),(null===$||void 0===$?void 0:$.generated_at)&&(0,o.jsxs)("span",{className:"admin-meta",children:["Stand: ",(0,js.Yq)($.generated_at)]}),(0,o.jsx)("button",{type:"button",className:"icon-btn",onClick:e=>(async e=>{e&&e.preventDefault(),Y(!0),X("");try{const e=Q.trim(),s=q.trim(),[n,t,a,l,i,r]=await Promise.all([Le.current||he?(0,c.paO)(e,s,200):null,ze.current?(0,c.ny0)(e,s):null,Ae.current?(0,c.bLm)(e,s,200):null,Ce.current?(0,c.mks)(e,s):null,Ns.current?(0,c.e82)(e,s):null,De.current?(0,c.mOT)(e,s):null]);n&&(ee(n),Le.current=!0),t&&ne(t),a&&ae(a),l&&ie(l),i&&ks(i),r&&ce(r)}catch(s){X(Ot(s,"Abruf fehlgeschlagen"))}finally{Y(!1)}})(e),disabled:U,title:"Neu laden",children:(0,o.jsx)(x.DIg,{})}),(0,o.jsx)("button",{type:"button",className:"icon-btn icon-btn--danger",onClick:G,title:"Abmelden",children:(0,o.jsx)(x.axc,{})})]}),(0,o.jsx)(Aa,{username:Q,password:q}),(0,o.jsx)(Pt.Ay,{})]}),he&&!$&&U&&(0,o.jsx)("p",{style:{color:"#64748b",fontSize:"0.9rem"},children:"Lade \xdcbersicht\u2026"}),J&&(0,o.jsx)("p",{style:{color:"#dc2626",fontSize:"0.85rem"},children:J}),($||!he)&&(0,o.jsxs)("div",{className:"admin-content",children:[(0,o.jsx)(vs.m_,{id:"admin-icon-tip",place:"top"}),"overview"===ue&&(0,o.jsxs)("section",{className:"admin-section",children:[(0,o.jsxs)("h3",{className:"section-title",children:[(0,o.jsx)(x.YYR,{})," \xdcbersicht"]}),(0,o.jsxs)("div",{className:"admin-grid",children:[(0,o.jsxs)("div",{children:[(0,o.jsxs)("span",{children:[(0,o.jsx)(x.$hd,{})," Lehrkr\xe4fte"]}),(0,o.jsx)("strong",{children:null!==(e=null===(s=$.counts)||void 0===s?void 0:s.teachers)&&void 0!==e?e:0})]}),(0,o.jsxs)("div",{children:[(0,o.jsxs)("span",{children:[(0,o.jsx)(x.mFx,{})," Sch\xfcler"]}),(0,o.jsx)("strong",{children:null!==(n=null===(t=$.counts)||void 0===t?void 0:t.students)&&void 0!==n?n:0})]}),(0,o.jsxs)("div",{children:[(0,o.jsxs)("span",{children:[(0,o.jsx)(x.K9B,{})," G\xe4ste (nur Anzahl)"]}),(0,o.jsx)("strong",{children:null!==(h=null===(m=$.counts)||void 0===m?void 0:m.guests)&&void 0!==h?h:0})]}),(0,o.jsxs)("div",{children:[(0,o.jsxs)("span",{children:[(0,o.jsx)(x.YXz,{})," Eltern"]}),(0,o.jsx)("strong",{children:null!==(v=null===(j=$.counts)||void 0===j?void 0:j.parents)&&void 0!==v?v:0})]}),(0,o.jsxs)("div",{children:[(0,o.jsxs)("span",{children:[(0,o.jsx)(x.iM1,{})," Klassen"]}),(0,o.jsx)("strong",{children:null!==(y=null===(k=$.counts)||void 0===k?void 0:k.classes)&&void 0!==y?y:0})]}),(0,o.jsxs)("div",{children:[(0,o.jsxs)("span",{children:[(0,o.jsx)(x.iM1,{})," Schulen"]}),(0,o.jsx)("strong",{children:null!==(N=null===(w=$.counts)||void 0===w?void 0:w.schools)&&void 0!==N?N:0})]}),(0,o.jsxs)("div",{children:[(0,o.jsxs)("span",{children:[(0,o.jsx)(x.aQJ,{})," \xdcbungsbl\xe4tter"]}),(0,o.jsx)("strong",{children:null!==(A=null===(C=$.counts)||void 0===C?void 0:C.sheets)&&void 0!==A?A:0})]}),(0,o.jsxs)("div",{children:[(0,o.jsxs)("span",{children:[(0,o.jsx)(x.v5n,{})," Sessions"]}),(0,o.jsx)("strong",{children:null!==(D=null===(L=$.counts)||void 0===L?void 0:L.sessions)&&void 0!==D?D:0})]}),(0,o.jsxs)("div",{children:[(0,o.jsxs)("span",{children:[(0,o.jsx)(x.w8j,{})," Aufgaben"]}),(0,o.jsx)("strong",{children:null!==(E=null===(M=$.counts)||void 0===M?void 0:M.tasks)&&void 0!==E?E:0})]})]})]}),"stats"===ue&&(0,o.jsxs)("section",{className:"admin-section",children:[(0,o.jsxs)("h3",{className:"section-title",children:[(0,o.jsx)(x.p7b,{})," Nutzer \u2014 Statistik"]}),(0,o.jsxs)("div",{className:"admin-panel",children:[me&&(0,o.jsx)("p",{style:{color:"#64748b",fontSize:"0.9rem"},children:"Lade Statistiken\u2026"}),ge&&(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"0.5rem 0"},children:[(0,o.jsx)("span",{style:{color:"#dc2626",fontSize:"0.85rem"},children:"Statistiken konnten nicht geladen werden."}),(0,o.jsx)("button",{type:"button",className:"section-button",onClick:on,children:"Erneut laden"})]}),!se&&!me&&!ge&&null,(0,o.jsxs)("div",{className:"chart-control
1s",children:[(0,o.jsxs)("div",{className:"chart-control-group",children:[(0,o.jsx)("button",{type:"button",className:"chart-btn".concat(ms||ds?"":" active"),onClick:()=>{ps(!1),hs(!1)},children:"Verlauf"}),(0,o.jsx)("button",{type:"button",className:"chart-btn".concat(ms?" active":""),onClick:()=>{hs(!1),xs(!1),bs(!1),ps(e=>!e)},children:"Anmeldemethode"}),(0,o.jsx)("button",{type:"button",className:"chart-btn".concat(ds?" active":""),onClick:()=>{ps(!1),xs(!1),bs(!1),hs(e=>!e)},children:"Wiederkehrende"}),(0,o.jsx)("button",{type:"button",className:"chart-btn".concat(gs?" active":""),onClick:()=>{ps(!1),hs(!1),bs(!1),xs(e=>!e)},children:"Ger\xe4t"}),(0,o.jsx)("button",{type:"button",className:"chart-btn".concat(_s?" active":""),onClick:()=>{ps(!1),hs(!1),xs(!1),bs(e=>!e)},children:"Browser"})]}),(0,o.jsxs)("div",{className:"chart-control-group chart-control-group--options",children:[(0,o.jsx)("button",{type:"button",className:"chart-btn".concat(is?" active":""),onClick:()=>rs(e=>!e),children:"Kumuliert"}),!ds&&!gs&&!_s&&(0,o.jsx)("button",{type:"button",className:"chart-btn".concat(Ss?" active":""),onClick:()=>ws(e=>!e),children:"Nur Aktive"}),!gs&&!_s&&(0,o.jsx)("button",{type:"button",className:"chart-btn".concat(zs?" active":""),onClick:()=>As(e=>!e),children:"G\xe4ste"})]})]}),(0,o.jsx)("div",{className:"panel-row user-panel-row",children:gs?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(g,{series:an,yLabel:is?"Aktive Nutzer gesamt":"Aktive Nutzer / Tag",height:220}),(0,o.jsx)("p",{style:{fontSize:"0.75rem",color:"#94a3b8",margin:"0.25rem 0.5rem 0",lineHeight:1.4},children:"Distinct Nutzer pro Ger\xe4t und Tag. Nutzer mit mehreren Ger\xe4ten werden pro Ger\xe4ttyp separat gez\xe4hlt."})]}):_s?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(g,{series:rn,yLabel:is?"Aktive Nutzer gesamt":"Aktive Nutzer / Tag",height:220}),(0,o.jsx)("p",{style:{fontSize:"0.75rem",color:"#94a3b8",margin:"0.25rem 0.5rem 0",lineHeight:1.4},children:"Distinct Nutzer pro Browser und Tag. Nutzer mit mehreren Browsern werden pro Browser separat gez\xe4hlt."})]}):ds?(0,o.jsx)(p,{series:Xs,yLabel:is?"R\xfcckkehrer gesamt":"Aktive R\xfcckkehrer / Tag",height:220}):ms?is?(0,o.jsx)(g,{series:Js,yLabel:"Nutzer gesamt",height:220}):(0,o.jsx)(p,{series:Js,yLabel:"Registrierungen pro Tag",height:220}):is?(0,o.jsx)(g,{series:Ys,yLabel:"Nutzer gesamt",height:220}):(0,o.jsx)(p,{series:Us,yLabel:"Registrierungen pro Tag",height:220})}),ds&&((e,s,n,t)=>{const a=null!==(e=null===se||void 0===se?void 0:se.return_frequency)&&void 0!==e?e:{},l=Number(null!==(s=a.once)&&void 0!==s?s:0),i=Number(null!==(n=a.two_to_five)&&void 0!==n?n:0),r=Number(null!==(t=a.five_plus)&&void 0!==t?t:0);return l||i||r?(0,o.jsxs)("div",{style:{fontSize:"0.8rem",color:"#6b7280",padding:"0.4rem 0.5rem 0",textAlign:"center"},children:["Sch\xfcler nach R\xfcckkehrh\xe4ufigkeit: ",(0,o.jsx)("strong",{children:l})," an 1 Tag \xb7 ",(0,o.jsx)("strong",{children:i})," an 2\u20135 Tagen \xb7 ",(0,o.jsx)("strong",{children:r})," an 5+ Tagen"]}):null})()]})]}),"overview"===ue&&(0,o.jsxs)("section",{className:"admin-section",children:[(0,o.jsxs)("h3",{className:"section-title",children:[(0,o.jsx)(x.p7b,{})," Nutzer nach Merkmalen"]}),(0,o.jsx)("div",{className:"admin-panel",children:(0,o.jsxs)("div",{className:"user-stats",children:[(null===fs||void 0===fs?void 0:fs.device_totals)&&fs.device_totals.desktop+fs.device_totals.mobile+fs.device_totals.tablet>0&&((e,s,n,t)=>{const a=e=>{var s,n,t;return[{label:"Desktop",icon:(0,o.jsx)(x.Wqt,{}),value:null!==(s=null===e||void 0===e?void 0:e.desktop)&&void 0!==s?s:0,color:"#2563eb"},{label:"Mobile",icon:(0,o.jsx)(x.rle,{}),value:null!==(n=null===e||void 0===e?void 0:e.mobile)&&void 0!==n?n:0,color:"#10b981"},{label:"Tablet",icon:(0,o.jsx)(x.z4D,{}),value:null!==(t=null===e||void 0===e?void 0:e.tablet)&&void 0!==t?t:0,color:"#f59e0b"}]};return(0,o.jsxs)("div",{className:"user-stats-group",children:[(0,o.jsx)("div",{className:"user-stats-title",children:"Ger\xe4t"}),(0,o.jsxs)("div",{className:"user-stats-grid three-cols",children:[(0,o.jsx)(ia,{title:"Gesamt",data:a(fs.device_totals),compact:!0}),(0,o.jsx)(ia,{title:"Lehrkr\xe4fte",data:a(null===(e=fs.device_by_role)||void 0===e?void 0:e.teacher),compact:!0}),(0,o.jsx)(ia,{title:"Sch\xfcler",data:a(null===(s=fs.device_by_role)||void 0===s?void 0:s.student),compact:!0}),(0,o.jsx)(ia,{title:"G\xe4ste",data:a(null===(n=fs.device_by_role)||void 0===n?void 0:n.guest),compact:!0}),(0,o.jsx)(ia,{title:"Eltern",data:a(null===(t=fs.device_by_role)||void 0===t?void 0:t.parent),compact:!0})]}),(0,o.jsx)("p",{style:{fontSize:"0.72rem",color:"#94a3b8",margin:"0.3rem 0 0",lineHeight:1.4},children:"Distinct Nutzer je Ger\xe4ttyp (gesamt). Multi-Device-Nutzer erscheinen in mehreren Kategorien."})]})})(),(null===fs||void 0===fs?void 0:fs.browser_totals)&&Object.values(fs.browser_totals).some(e=>e>0)&&((e,s,n,t)=>{const a=e=>{var s;return(null!==(s=fs.browser_keys)&&void 0!==s?s:[]).map(s=>{var n,t,a;return{label:s,icon:null!==(n=nn[s])&&void 0!==n?n:null,value:null!==(t=null===e||void 0===e?void 0:e[s])&&void 0!==t?t:0,color:null!==(a=tn[s])&&void 0!==a?a:"#94a3b8"}}).filter(e=>e.value>0).sort((e,s)=>s.value-e.value)};return(0,o.jsxs)("div",{className:"user-stats-group",children:[(0,o.jsx)("div",{className:"user-stats-title",children:"Browser"}),(0,o.jsxs)("div",{className:"user-stats-grid three-cols",children:[(0,o.jsx)(ia,{title:"Gesamt",data:a(fs.browser_totals),compact:!0}),(0,o.jsx)(ia,{title:"Lehrkr\xe4fte",data:a(null===(e=fs.browser_by_role)||void 0===e?void 0:e.teacher),compact:!0}),(0,o.jsx)(ia,{title:"Sch\xfcler",data:a(null===(s=fs.browser_by_role)||void 0===s?void 0:s.student),compact:!0}),(0,o.jsx)(ia,{title:"G\xe4ste",data:a(null===(n=fs.browser_by_role)||void 0===n?void 0:n.guest),compact:!0}),(0,o.jsx)(ia,{title:"Eltern",data:a(null===(t=fs.browser_by_role)||void 0===t?void 0:t.parent),compact:!0})]}),(0,o.jsx)("p",{style:{fontSize:"0.72rem",color:"#94a3b8",margin:"0.3rem 0 0",lineHeight:1.4},children:"Distinct Nutzer je Browser (gesamt). Multi-Browser-Nutzer erscheinen in mehreren Kategorien."})]})})(),(0,o.jsxs)("div",{className:"user-stats-group",children:[(0,o.jsx)("div",{className:"user-stats-title",children:"Anmeldemethode"}),(0,o.jsxs)("div",{className:"user-stats-grid three-cols",children:[(0,o.jsx)(ia,{title:"Gesamt",data:qs.allProviders,compact:!0}),(0,o.jsx)(ia,{title:"Lehrkr\xe4fte",data:qs.teachers.providers,compact:!0}),(0,o.jsx)(ia,{title:"Sch\xfcler",data:qs.students.providers,compact:!0}),(0,o.jsx)(ia,{title:"Eltern",data:qs.parents.providers,compact:!0})]})]}),(0,o.jsxs)("div",{className:"user-stats-group",children:[(0,o.jsx)("div",{className:"user-stats-title",children:"Lehrkr\xe4fte"}),(0,o.jsxs)("div",{className:"user-stats-grid two-cols",children:[(0,o.jsx)(ia,{title:"Bundesland",data:qs.teachers.states}),(0,o.jsx)(ia,{title:"Schulart",data:qs.teachers.schoolTypes}),(0,o.jsx)(ra,{title:"Klassenstufe",data:qs.teachers.gradeBars})]})]}),(0,o.jsxs)("div",{className:"user-stats-group",children:[(0,o.jsx)("div",{className:"user-stats-title",children:"Sch\xfcler"}),(0,o.jsxs)("div",{className:"user-stats-grid three-cols",children:[(0,o.jsx)(ia,{title:"Bundesland",data:qs.students.states}),(0,o.jsx)(ia,{title:"Schulart",data:qs.students.schoolTypes}),(0,o.jsx)(ra,{title:"Klassenstufe",data:qs.students.gradeBars})]})]})]})})]}),"users"===ue&&(0,o.jsxs)("section",{className:"admin-section",children:[(0,o.jsxs)("h3",{className:"section-title",children:[(0,o.jsx)(x.YXz,{})," Nutzer"]}),(0,o.jsx)("div",{className:"admin-panel",children:(0,o.jsx)(ts,{overview:$,username:Q,password:q,renderUser:(e,s)=>"teacher"===e.directory_role?(0,o.jsx)(ka,{teacher:e,schools:$.schools||[],username:Q,password:q,onSch
1oolChanged:vn,freeLimits:$.teacher_free_limits,activityDays:s}):"parent"===e.directory_role?(0,o.jsx)(Sa,{parent:e,username:Q,password:q,activityDays:s}):(0,o.jsx)(Na,{student:e,username:Q,password:q,activityDays:s})})})]}),"schools"===ue&&(0,o.jsx)("section",{className:"admin-section",children:(0,o.jsx)(Fe,{schools:$.schools||[],username:Q,password:q,teachers:$.teachers||[],onSchoolCreated:vn,renderDetails:e=>(0,o.jsx)(ga,{school:e,teachersBySchool:Qs,allTeachers:$.teachers||[],username:Q,password:q,onEdit:jn,onTokenChanged:vn})})}),"stats"===ue&&(0,o.jsxs)("section",{className:"admin-section",children:[(0,o.jsxs)("div",{className:"section-header",children:[(0,o.jsxs)("h3",{className:"section-title",children:[(0,o.jsx)(x.aQJ,{})," Aufgaben & Nutzung"]}),(0,o.jsx)("button",{type:"button",className:"section-button chart-cumulative-toggle".concat(is?" active":""),onClick:()=>rs(e=>!e),children:is?"Kumuliert":"Pro Tag"})]}),(0,o.jsxs)("div",{className:"admin-panel",children:[me&&(0,o.jsx)("p",{style:{color:"#64748b",fontSize:"0.9rem"},children:"Lade Statistiken\u2026"}),(0,o.jsxs)("div",{className:"panel-row",children:[(0,o.jsx)(g,{series:$s,yLabel:is?"Bl\xe4tter gesamt":"Bl\xe4tter pro Tag"}
1),(0,o.jsx)(g,{series:en,yLabel:is?"Berechnungen gesamt":"Berechnungen pro Tag"}),sn.length>0&&(0,o.jsx)(g,{series:sn,yLabel:is?"Aufgaben gesamt":"Aufgaben pro Tag"})]}),(0,o.jsx)("div",{className:"panel-row",children:(0,o.jsxs)("div",{className:"panel-progress",children:[(0,o.jsx)("div",{className:"panel-progress-header",children:"Fortschritt nach Status"}),(0,o.jsx)(us.A,{progress:Wt(null!==(T=null===se||void 0===se?void 0:se.progress_breakdown)&&void 0!==T?T:[])})]})})]})]}),"lifecycle"===ue&&(0,o.jsxs)("section",{className:"admin-section",children:[(0,o.jsxs)("div",{className:"section-header",children:[(0,o.jsxs)("h3",{className:"section-title",children:[(0,o.jsx)(x.ATg,{})," Lehrkr\xe4fte-Lifecycle"]}),(0,o.jsxs)("button",{type:"button",className:"section-button",onClick:()=>{De.current=!1,hn()},disabled:fe,children:[(0,o.jsx)(x.DIg,{})," Neu berechnen"]})]}),(0,o.jsx)(Cs,{data:re,loading:fe,error:ke,onRetry:hn,onOpenTeacher:we,loadMailDraft:mn,loadSampleMailDraft:pn})]}),"feedback"===ue&&(0,o.jsxs)("section",{className:"admin-section",children:[(0,o.jsx)("div",{className:"section-header",children:(0,o.jsxs)("h3",{className:"section-title",children:[(0,o.jsx)(x.hYw,{})," Feedback"]})}),(0,o.jsx)(Ks,{username:Q,password:q})]}),"sheets"===ue&&(0,o.jsxs)("section",{className:"admin-section",children:[(0,o.jsxs)("div",{className:"section-header",children:[(0,o.jsxs)("h3",{className:"section-title",children:[(0,o.jsx)(x.aQJ,{})," \xdcbungsbl\xe4tter"]}),(0,o.jsxs)("div",{className:"sheet-date-filter",children:[(0,o.jsx)("label",{children:"Von"}),(0,o.jsx)("input",{type:"date",value:Me,onChange:e=>Te(e.target.value),max:Ke||Ee}),(0,o.jsx)("label",{children:"Bis"}),(0,o.jsx)("input",{type:"date",value:Ke,onChange:e=>Be(e.target.value),min:Me||void 0,max:Ee}),Me&&(0,o.jsx)("button",{type:"button",className:"section-button",onClick:()=>{Te(""),Be(Ee)},children:"Zur\xfccksetzen"})]})]}),(0,o.jsxs)("div",{className:"admin-panel",children:[ve&&(0,o.jsx)("p",{style:{color:"#64748b",fontSize:"0.9rem"},children:"Lade \xdcbungsbl\xe4tter\u2026"}),te&&0===Gs.length&&!ve&&(0,o.jsx)("p",{style:{color:"#94a3b8",fontSize:"0.85rem",padding:"0.5rem"},children:"Keine \xdcbungsbl\xe4tter im gew\xe4hlten Zeitraum."}),(0,o.jsx)("div",{className:"sheet-activity-list",children:(()=>{const e=new Date;e.setHours(0,0,0,0);const s=new Date(e);s.setDate(s.getDate()-1);const n=n=>{const t=new Date(n);return t.setHours(0,0,0,0),t.getTime()===e.getTime()?"Heute":t.getTime()===s.getTime()?"Gestern":t.toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric"})},t=[];Gs.forEach(e=>{var s;const n=e.is_student_sheet,a=null!==(s=n?e.student_name:e.teacher_name)&&void 0!==s?s:"",l="".concat(n?"S":"T",":").concat(a),i=t[t.length-1];if(i&&i.runKey===l)i.sheets.push(e);else{const s=n?e.student_email:[e.teacher_email,e.class_name].filter(Boolean).join(" \xb7 ");t.push({runKey:l,name:a,isStudent:n,meta:s,sheets:[e]})}});const i=[];let r=null;for(const l of t){var d,u;const e=n(new Date(null!==(d=null!==(u=l.sheets[0].last_progress_at)&&void 0!==u?u:l.sheets[0].created_at)&&void 0!==d?d:0));i.push((0,a.A)((0,a.A)({},l),{},{dateLabel:e,showDateHeader:e!==r})),r=e}return i.map((e,s)=>(0,o.jsxs)(l.Fragment,{children:[e.showDateHeader&&(0,o.jsx)("div",{className:"sheet-activity-date-header",children:e.dateLabel}),(0,o.jsxs)("div",{className:"sheet-activity-person-run",children:[(0,o.jsxs)("div",{className:"sheet-activity-person-header",children:[(0,o.jsx)("span",{className:"sheet-activity-icon ".concat(e.isStudent?"student":"teacher"),children:e.isStudent?(0,o.jsx)(x.mFx,{}):(0,o.jsx)(x.$hd,{})}),(0,o.jsx)("span",{className:"sheet-activity-name",children:e.name||"\u2013"}),e.meta&&(0,o.jsx)("span",{className:"sheet-activity-meta",children:e.meta})]}),e.sheets.map(s=>{var n;const t=e=>e?new Date(e).toLocaleTimeString("de-DE",{hour:"2-digit",minute:"2-digit"}):null,a=t(s.first_progress_at),l=t(null!==(n=s.last_progress_at)&&void 0!==n?n:s.created_at),i=a&&l&&a!==l?"".concat(a,"\u2013").concat(l):null!==l&&void 0!==l?l:"",r=e.isStudent?!!s.last_progress_at:s.student_count>0;return(0,o.jsxs)("div",{className:"sheet-activity-row",onClick:()=>(async e=>{var s;const n=(null===e||void 0===e?void 0:e.id)||e;if(!n)return;if(!Q||!q)return;Xe(null),es(!0),ns(!0),ls(""),Ms({}),Bs([]),Ps([]),Hs([]),Ws([]),Vs(null);const t=(null===e||void 0===e?void 0:e.class_id)||null;Ls(t);const a=(null===e||void 0===e?void 0:e.student_id)||(null===e||void 0===e||null===(s=e.student)||void 0===s?void 0:s.id)||null;
1try{const s=await(0,c.ayW)(Q.trim(),q.trim(),n);if(Xe(s),t){const[e,a,l,i]=await Promise.all([(0,c.FzP)(t,n),(0,c.DjN)(t),(0,c.hqt)(t),(0,c.kOw)(t)]),r=(a||[]).filter(e=>e.sheet_id===n);Bs(e||[]),Ps(r||[]),Hs(l||[]),Ws(i||[]),Ms(ta(s,e||[]))}else if(a){const t=await(0,c.lnp)(Q.trim(),q.trim(),n,a),l=null!==e&&void 0!==e&&e.student?e.student:{id:a,role:"student"};Bs(t||[]),Hs([l]),Ms(ta(s,t||[]))}}catch(l){ls(z(l,"Sheet-Details konnten nicht geladen werden."))}finally{ns(!1)}})(s),children:[(0,o.jsx)("span",{className:"sheet-activity-dot ".concat(r?"active":""),title:r?"Bearbeitet":"Noch keine Bearbeitung"}),(0,o.jsx)("div",{className:"sheet-activity-body",children:(0,o.jsx)("div",{className:"sheet-activity-title",children:s.title})}),(0,o.jsxs)("div",{className:"sheet-activity-right",children:[!e.isStudent&&(()=>{const e=s.student_count_recent,n=s.student_count,t=s.teacher_count_recent,a=s.teacher_count;return n||a?(0,o.jsxs)("span",{className:"sheet-activity-count-wrap",children:[e>0?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{className:"sheet-activity-count student",title:"Sch\xfcler an diesem Tag",children:e}),n>e&&(0,o.jsxs)("span",{className:"sheet-activity-total",title:"Sch\xfcler gesamt",children:["(",n,")"]})]}):n>0&&(0,o.jsxs)("span",{className:"sheet-activity-total",title:"".concat(n," Sch\xfcler gesamt, keine an diesem Tag"),children:["(",n,")"]}),t>0&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{className:"sheet-activity-count teacher",title:"Lehrer an diesem Tag",children:t}),a>t&&(0,o.jsxs)("span",{className:"sheet-activity-total",title:"Lehrer gesamt",children:["(",a,")"]})]})]}):null})(),(0,o.jsx)("span",{className:"sheet-activity-time",children:i})]})]},s.id)})]})]},s))})()})]})]}),"campaigns"===ue&&(0,o.jsxs)("section",{className:"admin-section",children:[(0,o.jsxs)("h3",{className:"section-title",children:[(0,o.jsx)(x.Acq,{})," Kampagnen-Tracking"]}),_e&&(0,o.jsx)("p",{style:{color:"#64748b",fontSize:"0.9rem"},children:"Lade Kampagnendaten\u2026"}),le&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{className:"admin-grid",children:[(0,o.jsxs)("div",{children:[(0,o.jsxs)("span",{children:[(0,o.jsx)(x.Ny1,{})," Visits gesamt"]}),(0,o.jsx)("strong",{children:null!==(K=null===(B=le.kpi)||void 0===B?void 0:B.total_visits)&&void 0!==K?K:0})]}),(0,o.jsxs)("div",{children:[(0,o.jsxs)("span",{children:[(0,o.jsx)(x.yk7,{})," Conversions"]}),(0,o.jsx)("strong",{children:null!==(F=null===(P=le.kpi)||void 0===P?void 0:P.converted_visits)&&void 0!==F?F:0})]}),(0,o.jsxs)("div",{children:[(0,o.jsxs)("span",{children:[(0,o.jsx)(x.YYR,{})," Conv.-Rate"]}),(0,o.jsxs)("strong",{children:[null!==(R=null===(H=le.kpi)||void 0===H?void 0:H.conversion_rate_pct)&&void 0!==R?R:0," %"]})]})]}),(null===(O=le.daily)||void 0===O?void 0:O.length)>0&&(0,o.jsx)("div",{className:"admin-panel",style:{marginTop:16},children:(0,o.jsx)("div",{className:"panel-row user-panel-row",children:(0,o.jsx)(p,{series:[{label:"Visits",color:"#6366f1",data:le.daily.map(e=>({date:e.day,value:Number(e.visits)}))},{label:"Conversions",color:"#10b981",data:le.daily.map(e=>({date:e.day,value:Number(e.conversions)}))}],yLabel:"pro Tag (letzte 30 Tage)",height:160})})}),(null===(W=le.by_source)||void 0===W?void 0:W.length)>0&&(0,o.jsxs)("div",{style:{marginTop:16,overflowX:"auto"},children:[(0,o.jsx)("div",{style:{fontSize:"0.8rem",fontWeight:600,color:"#64748b",marginBottom:6},children:"Traffic-Quellen"}),(0,o.jsxs)("table",{className:"campaign-table",children:[(0,o.jsx)("thead",{children:(0,o.jsxs)("tr",{children:[(0,o.jsx)("th",{children:"Quelle"}),(0,o.jsx)("th",{children:"Visits"}),(0,o.jsx)("th",{children:"Conv."}),(0,o.jsx)("th",{children:"Rate"})]})}),(0,o.jsx)("tbody",{children:le.by_source.map((e,s)=>(0,o.jsxs)("tr",{children:[(0,o.jsx)("td",{children:la(e.source)}),(0,o.jsx)("td",{children:e.visits}),(0,o.jsx)("td",{children:e.conversions}),(0,o.jsx)("td",{children:e.visits>0?"".concat((e.conversions/e.visits*100).toFixed(1)," %"):"\u2013"})]},s))})]})]}),(null===(Z=le.by_campaign)||void 0===Z?void 0:Z.length)>0&&(0,o.jsx)("div",{style:{marginTop:16,overflowX:"auto"},children:(0,o.jsxs)("table",{className:"campaign-table",children:[(0,o.jsx)("thead",{children:(0,o.jsxs)("tr",{children:[(0,o.jsx)("th",{children:"Kampagne"}),(0,o.jsx)("th",{children:"Source"}),(0,o.jsx)("th",{children:"Medium"}),(0,o.jsx)("th",{children:"Visits"}),(0,o.jsx)("th",{children:"Conv."}),(0,o.jsx)("th",{children:"Rate"})]})}),(0,o.jsx)("tbody",{children:le.by_campaign.filter(e=>!("(none)"===e.utm_campaign&&"(none)"===e.utm_source&&"(none)"===e.utm_medium)).map((e,s)=>{const n=e=>e&&"(none)"!==e?e:"\u2013";return(0,o.jsxs)("tr",{children:[(0,o.jsx)("td",{children:n(e.utm_campaign)}),(0,o.jsx)("td",{children:n(e.utm_source)}),(0,o.jsx)("td",{children:n(e.utm_medium)}),(0,o.jsx)("td",{children:e.visits}),(0,o.jsx)("td",{children:e.conversions}),(0,o.jsx)("td",{children:e.visits>0?"".concat((e.conversions/e.visits*100).toFixed(1)," %"):"\u2013"})]},s)})})]})}),(null===(V=le.recent)||void 0===V?void 0:V.length)>0&&(0,o.jsxs)("div",{style:{marginTop:16,overflowX:"auto"},children:[(0,o.jsx)("div",{style:{fontSize:"0.8rem",fontWeight:600,color:"#64748b",marginBottom:6},children:"Letzte Visits"}),(0,o.jsxs)("table",{className:"campaign-table campaign-table--recent",children:[(0,o.jsx)("thead",{children:(0,o.jsxs)("tr",{children:[(0,o.jsx)("th",{children:"Zeitpunkt"}),(0,o.jsx)("th",{children:"Quelle"}),(0,o.jsx)("th",{children:"Kampagne"}),(0,o.jsx)("th",{children:"Standort"}
1),(0,o.jsx)("th",{children:"Konvertiert"})]})}),(0,o.jsx)("tbody",{children:le.recent.map((e,s)=>{return(0,o.jsxs)("tr",{className:e.user_id?"campaign-row--converted":"",children:[(0,o.jsx)("td",{children:(0,js.Yq)(e.visited_at)}),(0,o.jsx)("td",{children:la(e.utm_source||e.referrer_source)}),(0,o.jsx)("td",{children:e.utm_campaign||"\u2013"}),(0,o.jsxs)("td",{style:{whiteSpace:"nowrap"},children:[e.country_code?"".concat((n=e.country_code,n&&2===n.length?String.fromCodePoint(...n.toUpperCase().split("").map(e=>127462+e.charCodeAt(0)-65)):"")," ").concat(e.city||e.country_name||e.country_code):e.ip_address||"\u2013",e.ip_address&&(0,o.jsx)("button",{title:e.ip_address,onClick:()=>navigator.clipboard.writeText(e.ip_address),style:{marginLeft:6,background:"none",border:"none",cursor:"pointer",color:"#94a3b8",padding:"0 2px",fontSize:"0.75rem"},children:(0,o.jsx)(x.paH,{})})]}),(0,o.jsx)("td",{children:e.converted_at?(0,o.jsx)(x.A7C,{style:{color:"#10b981"}}):(0,o.jsx)(x._Hm,{style:{color:"#e2e8f0"}})})]},s);var n})})]})]})]})]}),"campaigns"===ue&&(0,o.jsxs)("section",{className:"admin-section",children:[(0,o.jsx)("div",{className:"section-header",children:(0,o.jsxs)("h3",{className:"section-title",children:[(0,o.jsx)(x.maD,{})," Kampagnen-Mails"]})}),(0,o.jsx)(ln,{username:Q,password:q})]}),"outreach"===ue&&(0,o.jsx)("section",{className:"admin-section",children:(0,o.jsx)(ut,{username:Q,password:q})}),"fair-leads"===ue&&(0,o.jsx)("section",{className:"admin-section",children:(0,o.jsx)(Qe,{username:Q,password:q})}),"accounts"===ue&&(0,o.jsxs)("section",{className:"admin-section",children:[(0,o.jsx)("div",{className:"section-header",children:(0,o.jsxs)("h3",{className:"section-title",children:[(0,o.jsx)(x.YXz,{})," Konten zusammenf\xfchren"]})}),(0,o.jsx)(Ft,{username:Q,password:q})]}),"anlass-mails"===ue&&(0,o.jsxs)("section",{className:"admin-section",children:[(0,o.jsx)("div",{className:"section-header",children:(0,o.jsxs)("h3",{className:"section-title",children:[(0,o.jsx)(x.maD,{})," Anlass-Mails"]})}),(0,o.jsx)(At,{username:Q,password:q})]}),"actions"===ue&&(0,o.jsx)(Ea,{username:Q,password:q})]})]}),$e&&ss&&!Je&&(0,o.jsx)("div",{className:"modal-overlay sheet-detail-modal",onClick:_n,children:(0,o.jsxs)("div",{className:"modal-content sheet-detail-content",onClick:e=>e.stopPropagation(),children:[(0,o.jsx)("button",{className:"close-button",onClick:_n,children:(0,o.jsx)(x.QCr,{size:20})}),(0,o.jsx)("div",{className:"details-body",children:"Lade \xdcbungsblatt\u2026"})]})}),$e&&!ss&&as&&!Je&&(0,o.jsx)("div",{className:"modal-overlay sheet-detail-modal",onClick:_n,children:(0,o.jsxs)("div",{className:"modal-content sheet-detail-content",onClick:e=>e.stopPropagation(),children:[(0,o.jsx)("button",{className:"close-button",onClick:_n,children:(0,o.jsx)(x.QCr,{size:20})}),(0,o.jsx)("div",{className:"details-body",children:as})]})}),(0,o.jsx)(ys.A,{isOpen:$e&&!!Je,sheet:Je,classId:Ds,readOnly:!0,onClose:_n,sessionProgress:Es,studentEntries:Ts,teacherEntries:Fs,classStudents:Rs,classTeachers:Os,selectedSessionId:Zs,onSessionSelect:e=>Vs(e),showStudentProgress:!0,showTeacherProgress:!0}),Pe&&We&&(0,o.jsx)("div",{className:"school-modal",onClick:()=>Re(!1),children:(0,o.jsxs)("div",{className:"school-modal-card",onClick:e=>e.stopPropagation(),children:[(0,o.jsxs)("div",{className:"modal-header",children:[(0,o.jsxs)("h3",{children:[(0,o.jsx)(x.iM1,{})," Schule bearbeiten"]}),(0,o.jsx)("button",{className:"modal-close",onClick:()=>Re(!1),children:"\xd7"})]}),(0,o.jsxs)("form",{className:"school-form",onSubmit:async e=>{if(e.preventDefault(),He&&We)if(!We.eduplacesSchoolId.trim()||cs(We.eduplacesSchoolId)){Ye(!0),qe("");try{const e=Q.trim(),s=q.trim();await(0,c.Gm_)(e,s,He.id,{name:We.name.trim(),is_demo:We.isDemo,license_type:We.licenseType,license_start_date:We.licenseStart||null,license_end_date:We.licenseEnd||null,max_teachers:We.unlimited?null:We.maxTeachers?Number(We.maxTeachers):null,state:We.state||null,school_type:We.schoolType||null,eduplaces_school_id:We.eduplacesSchoolId.trim()||null});const n=await(0,c.paO)(e,s,200);ee(n),Re(!1),Oe(null),Ze(null)}catch(s){qe(z(s,"Aktualisieren fehlgeschlagen."))}finally{Ye(!1)}}else qe("Die EduPlaces-Schul-ID hat nicht das richtige Format.")},children:[(0,o.jsxs)("div",{className:"school-form-grid",children:[(0,o.jsxs)("div",{className:"form-group",children:[(0,o.jsx)("label",{children:"Schulname"}),(0,o.jsx)("input",{type:"text",value:We.name,onChange:e=>Ze((0,a.A)((0,a.A)({},We),{},{name:e.target.value}))})]}),(0,o.jsxs)("div",{className:"form-group",children:[(0,o.jsx)("label",{children:"Lehrplan"}),(0,o.jsxs)("select",{value:We.state,onChange:e=>Ze((0,a.A)((0,a.A)({},We),{},{state:e.target.value})),children:[(0,o.jsx)("option",{value:"",children:"\u2013 nicht gesetzt \u2013"}),We.state&&!f.jw.some(e=>e.id===We.state)&&(0,o.jsxs)("option",{value:We.state,children:[We.state," (Altwert)"]}),f.$0.map(e=>(0,o.jsx)("optgroup",{label:e.name,children:e.curricula.map(e=>(0,o.jsx)("option",{value:e.id,children:e.name},e.id))},e.code))]})]}),(0,o.jsxs)("div",{className:"form-group",children:[(0,o.jsx)("label",{children:"Schulart"}
1),(0,o.jsx)("select",{value:We.schoolType,onChange:e=>Ze((0,a.A)((0,a.A)({},We),{},{schoolType:e.target.value})),children:(()=>{const e=(0,f.S3)(We.state),s=We.schoolType&&!e.some(e=>e.id===We.schoolType);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("option",{value:"",children:"\u2013 nicht gesetzt \u2013"}),s&&(0,o.jsxs)("option",{value:We.schoolType,children:[(0,f.$P)(We.schoolType,We.state)||We.schoolType," (Altwert)"]}),e.map(e=>(0,o.jsx)("option",{value:e.id,children:e.name},e.id))]})})()})]}),(0,o.jsxs)("div",{className:"form-group",children:[(0,o.jsxs)("label",{className:"checkbox-inline",children:[(0,o.jsx)("input",{type:"checkbox",checked:We.isDemo,onChange:e=>Ze((0,a.A)((0,a.A)({},We),{},{isDemo:e.target.checked}))}),"Test-/Demo-Schule (intern, Review oder Integrationstest)"]}),(0,o.jsx)("p",{className:"muted",children:"Standardm\xe4\xdfig aus Schulranking und Nutzer-Auswertung ausgeblendet. Eine echte Schule in der Pilotphase bleibt sichtbar."}),(0,o.jsx)("label",{children:"Lizenztyp"}),(0,o.jsxs)("select",{value:We.licenseType,onChange:e=>{const s=e.target.value;Ze((0,a.A)((0,a.A)((0,a.A)({},We),{},{licenseType:s},"none"===s?{licenseStart:"",licenseEnd:""}:{}),"test"===s&&"test"!==We.licenseType?{licenseStart:S("test").start,licenseEnd:S("test").end}:{}))},children:[(0,o.jsx)("option",{value:"none",children:"Noch keine Schullizenz"}),(0,o.jsx)("option",{value:"regular",children:"Jahreslizenz"}),(0,o.jsx)("option",{value:"test",children:"Pilotlizenz (4 Wochen)"})]})]}),(0,o.jsxs)("div",{className:"form-group",children:[(0,o.jsx)("label",{children:"Startdatum"}),(0,o.jsx)("input",{type:"date",value:We.licenseStart,disabled:"none"===We.licenseType,onChange:e=>Ze((0,a.A)((0,a.A)({},We),{},{licenseStart:e.target.value}))})]}),(0,o.jsxs)("div",{className:"form-group",children:[(0,o.jsx)("label",{children:"Enddatum"}),(0,o.jsx)("input",{type:"date",value:We.licenseEnd,disabled:"none"===We.licenseType,onChange:e=>Ze((0,a.A)((0,a.A)({},We),{},{licenseEnd:e.target.value}))}),"regular"===We.licenseType&&(0,o.jsx)("button",{type:"button",className:"extend-button",onClick:async()=>{if(!He||!We)return;if("regular"!==We.licenseType)return;const e=We.licenseEnd?new Date(We.licenseEnd):new Date,s=new Date(e);s.setFullYear(e.getFullYear()+1),Ze((0,a.A)((0,a.A)({},We),{},{licenseEnd:s.toISOString().slice(0,10)}))},children:"+1 Jahr verl\xe4ngern"})]}),(0,o.jsxs)("div",{className:"form-group",children:[(0,o.jsx)("label",{children:"Max. Lehrkr\xe4fte"}),(0,o.jsx)("input",{type:"number",min:"0",value:We.maxTeachers,onChange:e=>Ze((0,a.A)((0,a.A)({},We),{},{maxTeachers:e.target.value})),disabled:We.unlimited}),(0,o.jsxs)("label",{className:"checkbox-row",children:[(0,o.jsx)("input",{type:"checkbox",checked:We.unlimited,onChange:e=>Ze((0,a.A)((0,a.A)({},We),{},{unlimited:e.target.checked}))}),"Unbegrenzt"]})]}),(0,o.jsx)(os,{value:We.eduplacesSchoolId,onChange:e=>Ze((0,a.A)((0,a.A)({},We),{},{eduplacesSchoolId:e}))}),(0,o.jsxs)("div",{className:"form-group",children:[(0,o.jsx)("label",{children:"Admins"}),(0,o.jsxs)("div",{className:"selected-admins",children:[(He.admins||[]).map(e=>(0,o.jsxs)("button",{type:"button",className:"selected-chip",onClick:()=>(async e=>{if(He){Ye(!0),qe("");try{var s;const n=Q.trim(),t=q.trim();await(0,c.i88)(n,t,He.id,e);const l=await(0,c.paO)(n,t,200);ee(l);const i=null===(s=l.schools)||void 0===s?void 0:s.find(e=>e.id===He.id),r=l.teachers||[];Oe((0,a.A)((0,a.A)({},i),{},{admins:r.filter(e=>"admin"===e.role&&e.school_id===He.id)}))}catch(n){qe(z(n,"Admin entfernen fehlgeschlagen."))}finally{Ye(!1)}}})(e.id),children:[(0,o.jsx)(b.A,{seed:e.avatar_seed,size:20}),e.name||e.email||"\u2013"," ",(0,o.jsx)("span",{children:"\xd7"})]},e.id)),0===(He.admins||[]).length&&(0,o.jsx)("span",{className:"muted",children:"Keine Admins"})]}),(0,o.jsx)(_.A,{query:Ve,onQueryChange:Ie,suggestions:xn,onSelect:async e=>{if(He){Ye(!0),qe("");try{var s;const n=Q.trim(),t=q.trim();await(0,c.PgW)(n,t,He.id,e.id);const l=await(0,c.paO)(n,t,200);ee(l);const i=null===(s=l.schools)||void 0===s?void 0:s.find(e=>e.id===He.id),r=l.teachers||[];Oe((0,a.A)((0,a.A)({},i),{},{admins:r.filter(e=>"admin"===e.role&&e.school_id===He.id)})),Ie("")}catch(n){qe(z(n,"Admin hinzuf\xfcgen fehlgeschlagen."))}finally{Ye(!1)}}},placeholder:"Admin hinzuf\xfcgen (Name oder E-Mail)"})]})]}),(0,o.jsxs)("div",{className:"form-actions",children:[(0,o.jsx)("button",{type:"submit",disabled:Ue,children:Ue?"Speichere\u2026":"\xc4nderungen speichern"}),Ge&&(0,o.jsx)("span",{className:"form-error",children:Ge})]})]})]})}),Se&&(0,o.jsx)(va,{teacher:Se,onClose:()=>we(null)})]})}},6657(){}}]);

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.