PageSourceSearch

https://portal.brisaakademi.com.tr/assets/B8BEJ4K_.js

js brisaakademi.com.tr collected 2026-09-24 14:28:56 UTC 177,775 bytes, 1 lines download raw bytes

1var kt=Object.defineProperty;var vt=(t,s,a)=>s in t?kt(t,s,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[s]=a;var be=(t,s,a)=>vt(t,typeof s!="symbol"?s+"":s,a);import{m as p,k as e}from"./BSYLsQ-1.js";import{gr as I,jT as K,cU as Ye,ad as ke,g1 as Fe,U as wt,cs as St,c9 as At,di as Ct,cv as Tt,ew as R,gE as S,ay as Lt,df as P,eL as se,c4 as Ue,aZ as It,aJ as lt,aI as dt,aF as Re,aG as J,aH as Y,f4 as ae,fO as pe,e as ot,jU as $,jO as D,k0 as z,e0 as re,aC as Mt,dI as Et,en as Pt,ep as Kt,es as Dt,dJ as qt,fh as Ft,dM as Rt,a9 as $t,b1 as me,gc as it,fF as zt,fj as Ge,f5 as $e,f6 as Bt,bh as Ot,e5 as ze,fM as Be,aM as je,aQ as Qe,j as Ht,$ as Yt,eC as Ut,aP as Gt,cA as ct,bZ as Qt,bA as _t,bO as Vt,dt as Wt,ft as ge,gb as _e,af as Jt,X as Ve,j7 as Zt,c$ as Xt,dU as Pe,e6 as es,a4 as ts,dg as ss,cP as as,M as rs,G as ns,bN as ls,fu as X,a$ as We,aS as mt,c2 as ds,g4 as os,ek as is,c1 as ut,a_ as Je}from"./sSvtHvyR.js";import{h as cs,f as ms,C as us,X as xs,Y as ps,T as bs,e as Ze}from"./DjlRatrT.js";import{S as gs,A as hs}from"./DrgqHVmX.js";import{E as we,e as Se,d as Ae,S as Xe,a as Ce,c as he}from"./DB9OKaxE.js";import"./DDB6-BYI.js";import{E as ys,S as et}from"./BkArfFwN.js";import{M as fs}from"./CSa_rIzw.js";import"./J_Wt1L_a.js";import"./SFk0Fnst.js";import"./DDqtQ-Fi.js";import"./BgRUjgry.js";import"./e0Y6qrIs.js";import"./B1S2JH2m.js";import"./BRF6rWNh.js";import"./DD0mkNNK.js";import"./Bjll5bNE.js";import"./D0Xp7-mI.js";import"./ByMFkulf.js";import"./6r8wdJ8M.js";import"./BdAa_wPz.js";import"./CvkYiHR4.js";import"./Cu1eIQam.js";import"./CACcmaRE.js";import"./BdKSdbD8.js";import"./6F5DkEq8.js";import"./DVWUi1_k.js";import"./Duw3XZ9u.js";async function js(t){var s,a;try{const n=await I.get(`/SysAdmin/Account/${t}/AdminHandoff`),l=((s=n.data)==null?void 0:s.data)??n.data;if(!(l!=null&&l.encryptMemberId)){window.alert(((a=n.data)==null?void 0:a.message)||"Bu hesapta giriş yapılabilecek yönetici bulunamadı.");return}let d=(l.domain||"").trim()||window.location.origin;/^https?:\/\//i.test(d)||(d=`https://${d}`),d=d.replace(/\/$/,"");const m=`${d}/Home/SysAdminForAdminLogin?memberInfo=${encodeURIComponent(l.encryptMemberId)}&isNewProject=true`;window.open(m,"_blank","noopener")}catch(n){window.alert("Hesaba giriş başlatılamadı."),console.error("[impersonate]",n)}}class ve{static async getStats(){const a=(await I.get("/SysAdmin/DashboardStats")).data;return(a==null?void 0:a.data)??a}}const Ns={computedAt:null,totals:{accounts:0,companies:0,users:0,certificates:0,trainingCompletionPct:0,trainingAssignments:0,programCompletionPct:0,programAssignments:0,loginsThisWeek:0},trend:[],accounts:[]};function ks({c:t}){const s=t.icon;return e.jsxs("div",{className:"flex items-center justify-between rounded-xl border border-border bg-background p-4 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:S("flex h-11 w-11 items-center justify-center rounded-lg",t.tint),children:e.jsx(s,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium text-muted-foreground",children:t.label}),t.sub&&e.jsx("div",{className:"text-xs text-muted-foreground/70",children:t.sub})]})]}),e.jsx("div",{className:"text-2xl font-bold text-foreground",children:t.value})]})}const vs=[{key:7,label:"Son 7 gün"},{key:30,label:"Son 30 gün"},{key:90,label:"Son 90 gün"},{key:0,label:"Tümü"}];function Ha(){const[t,s]=p.useState(7),[a,n]=p.useState(""),{data:l,isLoading:d,isError:m,refetch:x,isFetching:j}=K({queryKey:["sysadmin-dashboard-stats"],queryFn:()=>ve.getStats(),staleTime:5*60*1e3,retry:!1}),i=l??Ns,g=i.totals,f=!l||m,w=[{label:"Toplam Hesap",value:g.accounts,sub:g.accountsCached?`${g.accountsCached} önbellekte`:void 0,icon:Ye,tint:"bg-blue-50 text-blue-600"},{label:"Şirket",value:g.companies,icon:ke,tint:"bg-violet-50 text-violet-600"},{label:"Toplam Kullanıcı",value:g.users,sub:g.usersInclPassive?`${g.usersInclPassive} (pasifler dahil)`:void 0,icon:Fe,tint:"bg-rose-50 text-rose-600"},{label:"Sertifika",value:g.certificates,sub:g.certificatesThisMonth?`${g.certificatesThisMonth} bu ay`:void 0,icon:wt,tint:"bg-amber-50 text-amber-600"},{label:"Eğitim Tamamlama",value:`%${g.trainingCompletionPct}`,sub:g.trainingAssignments?`${g.trainingAssignments} atama`:void 0,icon:St,tint:"bg-emerald-50 text-emerald-600"},{label:"Program Tamamlama",value:`%${g.programCompletionPct}`,sub:g.programAssignments?`${g.programAssignments} atama`:void 0,icon:At,tint:"bg-cyan-50 text-cyan-600"},{label:"Bu Hafta Giriş",value:g.loginsThisWeek,icon:Ct,tint:"bg-indigo-50 text-indigo-600"},{label:"Disk Durumu",value:g.diskPct!=null?`%${g.diskPct}`:"—",sub:g.diskUsedGb!=null?`${g.diskUsedGb} / ${g.diskTotalGb} GB`:void 0,icon:Tt,tint:"bg-slate-100 text-slate-600"}],b=p.useMemo(()=>{var o;return(o=i.trend)!=null&&o.length?t===0?i.trend:i.trend.slice(-t):[]},[i.trend,t]),k=p.useMemo(()=>{const o=b.reduce((c,y)=>c+(y.totalLogins||0),0),v=b.reduce((c,y)=>c+(y.uniqueLogins||0),0),r=b.length||1;return{total:o,unique:v,dailyAvg:Math.round(o/r)}},[b]),h=p.useMemo(()=>{const o=a.trim().toLocaleLowerCase("tr");return o?i.accounts.filter(v=>v.name.toLocaleLowerCase("tr").includes(o)||(v.slug??"").includes(o)):i.accounts},[i.accounts,a]);return e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"InfinityLMS — Tüm Hesaplar Kullanım Özeti"}),e.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:["Veriler her ge
1ce 03:00'te toplanır",i.computedAt?` · Son güncelleme: ${new Date(i.computedAt).toLocaleDateString("tr-TR")}`:""]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{value:a,onChange:o=>n(o.target.value),placeholder:"Hesap ara (tümü)...",className:"h-10 w-56 rounded-md border border-input bg-background px-3 text-sm focus:outline-none focus:ring-2 focus:ring-ring"}),e.jsxs("button",{onClick:()=>x(),className:"flex h-10 items-center gap-2 rounded-md border border-border px-3 text-sm font-medium hover:bg-accent",children:[e.jsx(R,{className:S("h-4 w-4",j&&"animate-spin")}),"Yenile"]})]})]}),f&&!d&&e.jsxs("div",{className:"rounded-lg border border-dashed border-amber-300 bg-amber-50 p-4 text-sm text-amber-800",children:["Henüz özet veri yok. Backend ucu (",e.jsx("code",{children:"GET /SysAdmin/DashboardStats"}),") + gece Hangfire job'ı yapım aşamasında — uç canlı olunca kartlar gerçek verilerle dolar."]}),e.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",children:w.map(o=>e.jsx(ks,{c:o},o.label))}),e.jsxs("div",{className:"rounded-xl border border-border bg-background p-5 shadow-sm",children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsx("h2",{className:"text-base font-semibold text-foreground",children:"Giriş Trendi"}),e.jsx("div",{className:"flex gap-1",children:vs.map(o=>e.jsx("button",{onClick:()=>s(o.key),className:S("rounded-md px-3 py-1.5 text-xs font-medium transition-colors",t===o.key?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent"),children:o.label},o.key))})]}),e.jsxs("div",{className:"mb-4 grid grid-cols-3 gap-3",children:[e.jsxs("div",{className:"rounded-lg bg-rose-50 p-4 text-center",children:[e.jsx("div",{className:"text-xs font-semibold uppercase text-rose-500",children:"Toplam Giriş"}),e.jsx("div",{className:"text-2xl font-bold text-rose-600",children:k.total})]}),e.jsxs("div",{className:"rounded-lg bg-blue-50 p-4 text-center",children:[e.jsx("div",{className:"text-xs font-semibold uppercase text-blue-500",children:"Toplam Tekil Giriş"}),e.jsx("div",{className:"text-2xl font-bold text-blue-600",children:k.unique})]}),e.jsxs("div",{className:"rounded-lg bg-amber-50 p-4 text-center",children:[e.jsx("div",{className:"text-xs font-semibold uppercase text-amber-500",children:"Günlük Ort."}),e.jsx("div",{className:"text-2xl font-bold text-amber-600",children:k.dailyAvg})]})]}),e.jsx("div",{className:"h-64",children:b.length>0?e.jsx(cs,{width:"100%",height:"100%",children:e.jsxs(ms,{data:b,margin:{top:8,right:16,left:0,bottom:0},children:[e.jsx(us,{strokeDasharray:"3 3",stroke:"#eee"}),e.jsx(xs,{dataKey:"date",fontSize:11,tickLine:!1}),e.jsx(ps,{fontSize:11,tickLine:!1,width:32}),e.jsx(bs,{}),e.jsx(Ze,{type:"monotone",dataKey:"totalLogins",stroke:"#e11d48",strokeWidth:2,dot:!1,name:"Toplam"}),e.jsx(Ze,{type:"monotone",dataKey:"uniqueLogins",stroke:"#2563eb",strokeWidth:2,dot:!1,name:"Tekil"})]})}):e.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:"Giriş trendi verisi yok"})})]}),e.jsxs("div",{className:"rounded-xl border border-border bg-background shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-5 py-4",children:[e.jsx(Ye,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"font-semibold text-foreground",children:"Hesap Bazında"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[h.length," hesap"]})]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border text-left text-xs font-semibold uppercase text-muted-foreground",children:[e.jsx("th",{className:"px-5 py-3",children:"Hesap"}),e.jsx("th",{className:"px-5 py-3",children:"Kullanıcı"}),e.jsx("th",{className:"px-5 py-3",children:"Aktif"}),e.jsx("th",{className:"px-5 py-3",children:"Eğitim"}),e.jsx("th",{className:"px-5 py-3",children:"Sertifika"}),e.jsx("th",{className:"px-5 py-3",children:"Bu Hafta"}),e.jsx("th",{className:"px-5 py-3",children:"Durum"}),e.jsx("th",{className:"px-5 py-3"})]})}),e.jsx("tbody",{children:h.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:8,className:"px-5 py-8 text-center text-muted-foreground",children:"Hesap verisi yok"})}):h.map(o=>e.jsxs("tr",{className:"border-b border-border/60 last:border-0 hover:bg-accent/30",children:[e.jsxs("td",{className:"px-5 py-3",children:[e.jsx("div",{className:"font-medium text-foreground",children:o.name}),o.slug&&e.jsx("div",{className:"text-xs text-muted-foreground",children:o.slug})]}),e.jsx("td",{className:"px-5 py-3",children:o.users}),e.jsx("td",{className:"px-5 py-3 text-emerald-600",children:o.activeUsers}),e.jsxs("td",{className:"px-5 py-3",children:["%",o.trainingCompletionPct]}),e.jsx("td",{className:"px-5 py-3",children:o.certificates}),e.jsx("td",{className:"px-5 py-3",children:o.loginsThisWeek}),e.jsx("td",{className:"px-5 py-3",children:e.jsx("span",{className:S("roun
1ded-full px-2 py-0.5 text-xs font-medium",o.isActive?"bg-emerald-50 text-emerald-600":"bg-gray-100 text-gray-500"),children:o.isActive?"Aktif":"Pasif"})}),e.jsx("td",{className:"px-5 py-3 text-right",children:e.jsx("button",{onClick:()=>js(o.id),title:"Bu hesabın yöneticisiyle yeni sekmede giriş yap",className:"rounded-md border border-border px-3 py-1 text-xs font-medium hover:bg-accent",children:"Hesaba Gir →"})})]},o.id))})]})})]})]})}function Ya(){const{data:t,isLoading:s,isError:a,refetch:n,isFetching:l}=K({queryKey:["sysadmin-analytics-overview"],queryFn:()=>gs.overviewUrl(),staleTime:48e4,retry:!1});return e.jsxs("div",{className:"flex h-full flex-col p-6",children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Lt,{className:"h-5 w-5 text-indigo-600"}),e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Analitik — Tüm Hesaplar (Web + Mobil)"})]}),e.jsxs("button",{onClick:()=>n(),className:"flex h-9 items-center gap-2 rounded-md border border-border px-3 text-sm font-medium hover:bg-accent",children:[e.jsx(R,{className:l?"h-4 w-4 animate-spin":"h-4 w-4"}),"Yenile"]})]}),s?e.jsxs("div",{className:"flex flex-1 items-center justify-center text-muted-foreground",children:[e.jsx(P,{className:"mr-2 h-5 w-5 animate-spin"})," Yükleniyor..."]}):a||!(t!=null&&t.url)?e.jsxs("div",{className:"rounded-lg border border-dashed border-amber-300 bg-amber-50 p-4 text-sm text-amber-800",children:["Analitik yüklenemedi. ",(t==null?void 0:t.message)||"IPS embed yapılandırması (IpsEmbed:Secret) gerekli olabilir."]}):e.jsx("iframe",{src:t.url,title:"IPS Analitik",className:"w-full flex-1 rounded-lg border border-border",style:{minHeight:640},loading:"lazy"})]})}function ws(t){const s=t.data;return(s==null?void 0:s.data)??s}class Ss{static async list(s){const a=await I.get("/SysAdmin/Catalog/Trainings",{params:s});return ws(a)??[]}}const Te=30;function Ua(){const[t,s]=p.useState(""),[a,n]=p.useState(""),[l,d]=p.useState(0),{data:m=[],isLoading:x,isFetching:j}=K({queryKey:["sysadmin-catalog",a,l],queryFn:()=>Ss.list({search:a,skip:l*Te,take:Te}),staleTime:3e4});return e.jsxs("div",{className:"space-y-5 p-6",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Kataloglar"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Katalog eğitimleri (salt-görüntüleme). En son eklenenler başta."})]}),e.jsx("form",{onSubmit:i=>{i.preventDefault(),d(0),n(t.trim())},className:"flex items-center gap-2",children:e.jsxs("div",{className:"relative",children:[e.jsx(se,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx("input",{value:t,onChange:i=>s(i.target.value),placeholder:"Eğitim ara...",className:"h-10 w-64 rounded-md border border-input bg-background pl-8 pr-3 text-sm focus:outline-none focus:ring-2 focus:ring-ring"})]})})]}),x?e.jsxs("div",{className:"flex items-center justify-center py-20 text-muted-foreground",children:[e.jsx(P,{className:"mr-2 h-5 w-5 animate-spin"})," Yükleniyor..."]}):m.length===0?e.jsx("div",{className:"rounded-lg border border-dashed border-border py-16 text-center text-muted-foreground",children:"Eğitim bulunamadı."}):e.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:m.map(i=>e.jsx(As,{item:i},i.id))}),e.jsxs("div",{className:"flex items-center justify-center gap-3 pt-2",children:[e.jsx("button",{disabled:l===0||j,onClick:()=>d(i=>Math.max(0,i-1)),className:"h-9 rounded-md border border-border px-4 text-sm font-medium disabled:opacity-40 hover:bg-accent",children:"← Önceki"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["Sayfa ",l+1]}),e.jsx("button",{disabled:m.length<Te||j,onClick:()=>d(i=>i+1),className:"h-9 rounded-md border border-border px-4 text-sm font-medium disabled:opacity-40 hover:bg-accent",children:"Sonraki →"})]})]})}function As({item:t}){return e.jsxs("div",{className:"flex flex-col overflow-hidden rounded-xl border border-border bg-background shadow-sm",children:[e.jsx("div",{className:"relative h-32 bg-muted",children:t.image?e.jsx("img",{src:t.image,alt:t.name,className:"h-full w-full object-cover",loading:"lazy"}):e.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:e.jsx(Ue,{className:"h-8 w-8"})})}),e.jsxs("div",{className:"flex flex-1 flex-col gap-2 p-3",children:[e.jsx("div",{className:"line-clamp-2 min-h-[2.5rem] text-sm font-semibold text-foreground",title:t.name,children:t.name}),e.jsxs("div",{className:"flex items-center justify-between gap-2 text-xs text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Ue,{className:"h-3 w-3"})," ",t.videoCount," video"]}),t.insertedDate&&e.jsxs("span",{className:"flex items-center gap-1",title:new Date(t.insertedDate).toLocaleStr
1ing("tr-TR"),children:[e.jsx(It,{className:"h-3 w-3"}),new Date(t.insertedDate).toLocaleDateString("tr-TR")]})]})]})]})}const M=25;function ne({page:t,total:s,onPage:a}){const n=Math.max(1,Math.ceil(s/M));return s===0?null:e.jsxs("div",{className:"flex items-center justify-between px-1 py-3 text-sm text-muted-foreground",children:[e.jsxs("span",{children:[t*M+1,"–",Math.min(s,(t+1)*M)," / ",s]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{type:"button",disabled:t===0,onClick:()=>a(t-1),className:"flex items-center gap-1 rounded-lg border border-border px-2.5 py-1.5 font-medium hover:bg-accent disabled:opacity-40",children:[e.jsx(J,{className:"h-4 w-4"}),"Önceki"]}),e.jsxs("span",{className:"tabular-nums",children:[t+1," / ",n]}),e.jsxs("button",{type:"button",disabled:t>=n-1,onClick:()=>a(t+1),className:"flex items-center gap-1 rounded-lg border border-border px-2.5 py-1.5 font-medium hover:bg-accent disabled:opacity-40",children:["Sonraki",e.jsx(Y,{className:"h-4 w-4"})]})]})]})}function T({label:t,col:s,sort:a,setSort:n,align:l}){const d=a.key===s,m=d?a.dir==="asc"?dt:Re:lt;return e.jsx("th",{className:S("px-4 py-3 font-semibold",l==="right"&&"text-right",l==="center"&&"text-center"),children:e.jsxs("button",{type:"button",onClick:()=>n({key:s,dir:d&&a.dir==="asc"?"desc":"asc"}),className:S("inline-flex items-center gap-1 hover:text-foreground",l==="right"&&"flex-row-reverse"),children:[t,e.jsx(m,{className:S("h-3.5 w-3.5",d?"text-foreground":"opacity-40")})]})})}function q(t,s){return t==null&&s==null?0:t==null?1:s==null?-1:typeof t=="number"&&typeof s=="number"?t-s:t instanceof Date&&s instanceof Date?t.getTime()-s.getTime():String(t).localeCompare(String(s),"tr",{sensitivity:"base",numeric:!0})}function tt(t){const s=new URLSearchParams;Object.entries(t).forEach(([n,l])=>{l!==void 0&&l!==""&&l!==null&&s.set(n,String(l))});const a=s.toString();return a?`?${a}`:""}class Oe{static async adminActions(s={}){var n;const a=await I.get(`/SysAdmin/Logs/AdminActions${tt({...s,take:s.take??200})}`);return((n=a.data)==null?void 0:n.data)??a.data??[]}static async userActivity(s={}){var n;const a=await I.get(`/SysAdmin/Logs/UserActivity${tt({...s,take:s.take??200})}`);return((n=a.data)==null?void 0:n.data)??a.data??[]}}const Cs=[{key:"errors",label:"Sistem Hataları",icon:ae},{key:"admin",label:"İdari Aksiyon",icon:pe},{key:"activity",label:"Kullanıcı Aktivitesi",icon:ot}],Ts={[he.New]:"bg-red-50 text-red-600",[he.Investigating]:"bg-amber-50 text-amber-600",[he.Resolved]:"bg-emerald-50 text-emerald-600",[he.Ignored]:"bg-gray-100 text-gray-500"},Ls={[Ce.Low]:"bg-gray-100 text-gray-500",[Ce.Medium]:"bg-amber-50 text-amber-600",[Ce.High]:"bg-red-50 text-red-600"};function ue(t){if(!t)return"—";const s=new Date(t);return Number.isNaN(s.getTime())?t:s.toLocaleString("tr-TR",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"})}const H=25;function He({page:t,total:s,onPage:a}){const n=Math.max(1,Math.ceil(s/H));if(s===0)return null;const l=t*H+1,d=Math.min(s,(t+1)*H);return e.jsxs("div",{className:"flex items-center justify-between px-1 py-3 text-sm text-muted-foreground",children:[e.jsxs("span",{children:[l,"–",d," / ",s]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{type:"button",disabled:t===0,onClick:()=>a(t-1),className:"flex items-center gap-1 rounded-lg border border-border px-2.5 py-1.5 font-medium hover:bg-accent disabled:opacity-40",children:[e.jsx(J,{className:"h-4 w-4"}),"Önceki"]}),e.jsxs("span",{className:"tabular-nums",children:[t+1," / ",n]}),e.jsxs("button",{type:"button",disabled:t>=n-1,onClick:()=>a(t+1),className:"flex items-center gap-1 rounded-lg border border-border px-2.5 py-1.5 font-medium hover:bg-accent disabled:opacity-40",children:["Sonraki",e.jsx(Y,{className:"h-4 w-4"})]})]})]})}function Is(){var o,v;const t=$(),[s,a]=p.useState(void 0),[n,l]=p.useState(void 0),[d,m]=p.useState(null),[x,j]=p.useState(0),{data:i=[],isLoading:g,isFetching:f,refetch:w}=K({queryKey:["sysadmin-error-issues",s,n],queryFn:()=>we.getAll({status:s,source:n}),staleTime:3e4});p.useEffect(()=>j(0),[s,n]);const b=i.slice(x*H,(x+1)*H),{data:k}=K({queryKey:["sysadmin-error-issue-detail",d],queryFn:()=>we.getById(d),enabled:d!==null,staleTime:0}),h=D({mutationFn:({id:r,next:c})=>we.updateStatus(r,c),onSuccess:()=>{t.invalidateQueries({queryKey:["sysadmin-error-issues"]}),t.invalidateQueries({queryKey:["sysadmin-error-issue-detail"]})}});return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-4 flex flex-wrap items-center gap-3",children:[e.jsxs("select",{value:s??"",onChange:r=>a(r.target.value===""?void 0:Number(r.target.value)),className:"rounded-lg border border-border bg-background px-3 py-2 text-sm",children:[e.jsx("option",{value:"",children:"Tüm Durumlar"}),Object.entries(Se).map(([r,c])=>e.jsx("option",{value:r,children:c},r))]}),e.jsxs("select",{value:n??"",onChange:r=>l(r.target.value===""?void 0:Number(r.target.value)),className:"rounded-lg border border-border bg-background px-3 py-2 text-sm",children:[e.jsx("option",{value:"",children:"Tüm Kaynaklar"}),Object.entries(Ae).map(([r,c])=>e.jsx("option",{value:r,children:c},r))]}),e.jsxs("button",{type:"button",onClick:()=>w(),className:"ml-auto flex items-center gap-2 rounded-lg border border-border px-3 py-2 text-sm font-medium text-foreground
1/80 hover:bg-accent",children:[e.jsx(R,{className:S("h-4 w-4",f&&"animate-spin")}),"Yenile"]})]}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-background",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border bg-muted/30 text-left text-xs uppercase tracking-wide text-muted-foreground",children:[e.jsx("th",{className:"px-4 py-3 font-semibold",children:"Kaynak"}),e.jsx("th",{className:"px-4 py-3 font-semibold",children:"Hata"}),e.jsx("th",{className:"px-4 py-3 font-semibold",children:"Endpoint"}),e.jsx("th",{className:"px-4 py-3 text-right font-semibold",children:"Adet"}),e.jsx("th",{className:"px-4 py-3 font-semibold",children:"Son Görülme"}),e.jsx("th",{className:"px-4 py-3 font-semibold",children:"Hesap"}),e.jsx("th",{className:"px-4 py-3 font-semibold",children:"Durum"}),e.jsx("th",{className:"px-4 py-3"})]})}),e.jsx("tbody",{children:g?e.jsx("tr",{children:e.jsx("td",{colSpan:8,className:"px-4 py-10 text-center text-muted-foreground",children:e.jsx(P,{className:"mx-auto h-5 w-5 animate-spin"})})}):i.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:8,className:"px-4 py-10 text-center text-muted-foreground",children:"Kayıt bulunamadı."})}):b.map(r=>e.jsxs("tr",{onClick:()=>m(r.id),className:"cursor-pointer border-b border-border/60 transition-colors hover:bg-accent/40",children:[e.jsx("td",{className:"px-4 py-3",children:e.jsx("span",{className:"rounded-full bg-muted px-2 py-0.5 text-xs font-medium",children:Ae[r.source]??r.source})}),e.jsxs("td",{className:"max-w-[360px] px-4 py-3",children:[e.jsx("div",{className:"truncate font-medium text-foreground",children:r.title||r.sampleMessage||"—"}),e.jsx("span",{className:S("mt-1 inline-block rounded px-1.5 py-0.5 text-[10px] font-semibold",Ls[r.severity]),children:Xe[r.severity]??r.severity})]}),e.jsx("td",{className:"max-w-[220px] px-4 py-3 text-muted-foreground",children:e.jsxs("span",{className:"truncate",children:[r.method?`${r.method} `:"",r.endpoint||"—"]})}),e.jsx("td",{className:"px-4 py-3 text-right font-semibold tabular-nums",children:r.occurrenceCount}),e.jsx("td",{className:"px-4 py-3 whitespace-nowrap text-muted-foreground",children:ue(r.lastSeen)}),e.jsx("td",{className:"px-4 py-3 text-muted-foreground tabular-nums",children:r.lastAccountId??"—"}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("span",{className:S("rounded-full px-2 py-0.5 text-xs font-medium",Ts[r.status]),children:Se[r.status]??r.status})}),e.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:e.jsx(Y,{className:"h-4 w-4"})})]},r.id))})]})})}),e.jsx(He,{page:x,total:i.length,onPage:j}),d!==null&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-end bg-black/30",onClick:()=>m(null),children:e.jsxs("div",{className:"h-full w-full max-w-2xl overflow-y-auto bg-background p-6 shadow-2xl",onClick:r=>r.stopPropagation(),children:[e.jsxs("div",{className:"mb-4 flex items-start justify-between gap-4",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground",children:["Hata Detayı #",d]}),e.jsx("button",{type:"button",onClick:()=>m(null),className:"rounded-md border border-border px-2 py-1 text-sm hover:bg-accent",children:"Kapat"})]}),k?e.jsxs("div",{className:"space-y-4 text-sm",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(B,{label:"Kaynak",value:Ae[k.source]}),e.jsx(B,{label:"Önem",value:Xe[k.severity]}),e.jsx(B,{label:"Hesap",value:((o=k.lastAccountId)==null?void 0:o.toString())??"—"}),e.jsx(B,{label:"Üye",value:((v=k.lastMemberId)==null?void 0:v.toString())??"—"}),e.jsx(B,{label:"İlk görülme",value:ue(k.firstSeen)}),e.jsx(B,{label:"Son görülme",value:ue(k.lastSeen)}),e.jsx(B,{label:"Adet",value:String(k.occurrenceCount)}),e.jsx(B,{label:"Endpoint",value:`${k.method??""} ${k.endpoint??"—"}`})]}),k.lastUrl&&e.jsx(B,{label:"URL",value:k.lastUrl,mono:!0}),e.jsxs("div",{children:[e.jsx("div",{className:"mb-1 text-xs font-semibold uppercase text-muted-foreground",children:"Mesaj"}),e.jsx("pre",{className:"max-h-40 overflow-auto rounded-lg bg-muted/40 p-3 text-xs",children:k.sampleMessage||"—"})]}),k.sampleStack&&e.jsxs("div",{children:[e.jsx("div",{className:"mb-1 text-xs font-semibold uppercase text-muted-foreground",children:"Stack"}),e.jsx("pre",{className:"max-h-72 overflow-auto rounded-lg bg-muted/40 p-3 text-[11px] leading-relaxed",children:k.sampleStack})]}),e.jsx("div",{className:"flex flex-wrap gap-2 pt-2",children:Object.entries(Se).map(([r,c])=>{const y=Number(r);return e.jsx("button",{type:"button",disabled:h.isPending||k.status===y,onClick:()=>h.mutate({id:k.id,next:y}
1),className:S("rounded-lg border px-3 py-1.5 text-xs font-medium transition-colors disabled:opacity-40",k.status===y?"border-primary bg-primary/10 text-primary":"border-border hover:bg-accent"),children:c},r)})})]}):e.jsx(P,{className:"h-5 w-5 animate-spin text-muted-foreground"})]})})]})}function B({label:t,value:s,mono:a}){return e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-semibold uppercase text-muted-foreground",children:t}),e.jsx("div",{className:S("mt-0.5 break-words text-foreground",a&&"font-mono text-xs"),children:s})]})}const Ms=["SessionStart","TrainingOpened","TrainingCompleted","ProgramOpened","ExamStarted","ExamSubmitted","SurveyAnswered","ContentViewed"];function Es(){return K({queryKey:["sysadmin-dashboard-accounts"],queryFn:()=>ve.getStats(),staleTime:5*6e4,select:t=>[...t.accounts??[]].sort((s,a)=>(s.name??"").localeCompare(a.name??"","tr",{sensitivity:"base"}))})}function xt({filters:t,setFilters:s,showEventType:a,onRefresh:n,isFetching:l}){const{data:d=[]}=Es();return e.jsxs("div",{className:"mb-4 flex flex-wrap items-end gap-3",children:[e.jsxs("label",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Hesap"}),e.jsxs("select",{value:t.accountId??"",onChange:m=>s({...t,accountId:m.target.value===""?void 0:Number(m.target.value)}),className:"min-w-[180px] rounded-lg border border-border bg-background px-3 py-2 text-sm",children:[e.jsx("option",{value:"",children:"Tüm Hesaplar"}),d.map(m=>e.jsxs("option",{value:m.id,children:[m.name," (",m.id,")"]},m.id))]})]}),a&&e.jsxs("label",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Olay"}),e.jsxs("select",{value:t.eventType??"",onChange:m=>s({...t,eventType:m.target.value||void 0}),className:"rounded-lg border border-border bg-background px-3 py-2 text-sm",children:[e.jsx("option",{value:"",children:"Tüm Olaylar"}),Ms.map(m=>e.jsx("option",{value:m,children:m},m))]})]}),e.jsxs("label",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Başlangıç"}),e.jsx("input",{type:"date",value:t.from??"",onChange:m=>s({...t,from:m.target.value||void 0}),className:"rounded-lg border border-border bg-background px-3 py-2 text-sm"})]}),e.jsxs("label",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Bitiş"}),e.jsx("input",{type:"date",value:t.to??"",onChange:m=>s({...t,to:m.target.value||void 0}),className:"rounded-lg border border-border bg-background px-3 py-2 text-sm"})]}),e.jsxs("label",{className:"flex flex-1 flex-col gap-1",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Ara"}),e.jsx("input",{type:"text",value:t.q,onChange:m=>s({...t,q:m.target.value}),placeholder:"İsim / özet / modül...",className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm"})]}),e.jsxs("button",{type:"button",onClick:n,className:"flex items-center gap-2 rounded-lg border border-border px-3 py-2 text-sm font-medium text-foreground/80 hover:bg-accent",children:[e.jsx(R,{className:S("h-4 w-4",l&&"animate-spin")}),"Yenile"]})]})}function pt({headers:t,renderHeaders:s,isLoading:a,empty:n,children:l}){return e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-background",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsx("tr",{className:"border-b border-border bg-muted/30 text-left text-xs uppercase tracking-wide text-muted-foreground",children:s?s():t.map(d=>e.jsx("th",{className:"px-4 py-3 font-semibold",children:d},d))})}),e.jsx("tbody",{children:a?e.jsx("tr",{children:e.jsx("td",{colSpan:t.length,className:"px-4 py-10 text-center text-muted-foreground",children:e.jsx(P,{className:"mx-auto h-5 w-5 animate-spin"})})}):n?e.jsx("tr",{children:e.jsx("td",{colSpan:t.length,className:"px-4 py-10 text-center text-muted-foreground",children:"Kayıt bulunamadı."})}):l})]})})})}function Ps(){const[t,s]=p.useState({q:""}),[a,n]=p.useState({q:""}),[l,d]=p.useState(0),{data:m=[],isLoading:x,isFetching:j,refetch:i}=K({queryKey:["sysadmin-logs-admin",a],queryFn:()=>Oe.adminActions({accountId:a.accountId,from:a.from,to:a.to,q:a.q||void 0}),staleTime:3e4}),[g,f]=p.useState({key:"date",dir:"desc"});p.useEffect(()=>d(0),[a]);const b=[...m].sort((h,o)=>{const v=r=>g.key==="date"?new Date(r.insertedDate):g.key==="actor"?r.actorName:g.key==="action"?r.action:r.accountId;return(g.dir==="asc"?1:-1)*q(v(h),v(o))}).slice(l*H,(l+1)*H),k=()=>n(t);return e.jsxs("div",{children:[e.jsx(xt,{filters:t,setFilters:h=>{s(h),n(h)},onRefresh:()=>{k(),i()},isFetching:j}),e.jsx(pt,{headers:["Tarih","Aktör","Rol","Aksiyon","Varlık","Özet","Sonuç","Hesap"],renderHeaders:()=>e.jsxs(e.Fragment,{children:[e.jsx(T,{label:"Tarih",col:"date",sort:g,setSort:f}
1),e.jsx(T,{label:"Aktör",col:"actor",sort:g,setSort:f}),e.jsx("th",{className:"px-4 py-3 font-semibold",children:"Rol"}),e.jsx(T,{label:"Aksiyon",col:"action",sort:g,setSort:f}),e.jsx("th",{className:"px-4 py-3 font-semibold",children:"Varlık"}),e.jsx("th",{className:"px-4 py-3 font-semibold",children:"Özet"}),e.jsx("th",{className:"px-4 py-3 font-semibold",children:"Sonuç"}),e.jsx(T,{label:"Hesap",col:"account",sort:g,setSort:f})]}),isLoading:x,empty:m.length===0,children:b.map(h=>e.jsxs("tr",{className:"border-b border-border/60 hover:bg-accent/40",children:[e.jsx("td",{className:"whitespace-nowrap px-4 py-3 text-muted-foreground",children:ue(h.insertedDate)}),e.jsx("td",{className:"px-4 py-3 font-medium text-foreground",children:h.actorName||"—"}),e.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:h.actorRole||"—"}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("span",{className:"rounded-full bg-muted px-2 py-0.5 text-xs font-medium",children:h.action||"—"})}),e.jsxs("td",{className:"px-4 py-3 text-muted-foreground",children:[h.entityType||"—",h.entityName?e.jsxs("span",{className:"text-foreground/70",children:[" · ",h.entityName]}):null]}),e.jsx("td",{className:"max-w-[280px] truncate px-4 py-3 text-muted-foreground",title:h.summary??"",children:h.summary||"—"}),e.jsx("td",{className:"px-4 py-3",children:e.jsxs("span",{className:S("rounded-full px-2 py-0.5 text-xs font-medium",h.success?"bg-emerald-50 text-emerald-600":"bg-red-50 text-red-600"),children:[h.success?"Başarılı":"Hata",h.statusCode?` ${h.statusCode}`:""]})}),e.jsx("td",{className:"px-4 py-3 text-muted-foreground tabular-nums",children:h.accountId??"—"})]},h.id))}),e.jsx(He,{page:l,total:m.length,onPage:d})]})}function Ks(){const[t,s]=p.useState({q:""}),[a,n]=p.useState(0),{data:l=[],isLoading:d,isFetching:m,refetch:x}=K({queryKey:["sysadmin-logs-activity",t],queryFn:()=>Oe.userActivity({accountId:t.accountId,from:t.from,to:t.to,eventType:t.eventType,q:t.q||void 0}),staleTime:3e4}),[j,i]=p.useState({key:"date",dir:"desc"});p.useEffect(()=>n(0),[t]);const f=[...l].sort((w,b)=>{const k=h=>j.key==="date"?new Date(h.insertedDate):j.key==="member"?h.memberName:j.key==="event"?h.eventType:h.accountId;return(j.dir==="asc"?1:-1)*q(k(w),k(b))}).slice(a*H,(a+1)*H);return e.jsxs("div",{children:[e.jsx(xt,{filters:t,setFilters:s,showEventType:!0,onRefresh:()=>x(),isFetching:m}),e.jsx(pt,{headers:["Tarih","Kullanıcı","Olay","Modül","Kaynak","İlerleme","Platform","Hesap"],renderHeaders:()=>e.jsxs(e.Fragment,{children:[e.jsx(T,{label:"Tarih",col:"date",sort:j,setSort:i}),e.jsx(T,{label:"Kullanıcı",col:"member",sort:j,setSort:i}),e.jsx(T,{label:"Olay",col:"event",sort:j,setSort:i}),e.jsx("th",{className:"px-4 py-3 font-semibold",children:"Modül"}),e.jsx("th",{className:"px-4 py-3 font-semibold",children:"Kaynak"}),e.jsx("th",{className:"px-4 py-3 font-semibold",children:"İlerleme"}),e.jsx("th",{className:"px-4 py-3 font-semibold",children:"Platform"}),e.jsx(T,{label:"Hesap",col:"account",sort:j,setSort:i})]}),isLoading:d,empty:l.length===0,children:f.map(w=>e.jsxs("tr",{className:"border-b border-border/60 hover:bg-accent/40",children:[e.jsx("td",{className:"whitespace-nowrap px-4 py-3 text-muted-foreground",children:ue(w.insertedDate)}),e.jsx("td",{className:"px-4 py-3 font-medium text-foreground",children:w.memberName||"—"}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("span",{className:"rounded-full bg-muted px-2 py-0.5 text-xs font-medium",children:w.eventType||"—"})}),e.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:w.module||"—"}),e.jsx("td",{className:"max-w-[240px] truncate px-4 py-3 text-muted-foreground",title:w.sourceName??"",children:w.sourceName||"—"}),e.jsx("td",{className:"px-4 py-3 text-muted-foreground tabular-nums",children:w.progress!=null?`%${Math.round(w.progress)}`:"—"}),e.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:w.platform||"—"}),e.jsx("td",{className:"px-4 py-3 text-muted-foreground tabular-nums",children:w.accountId??"—"})]},w.id))}),e.jsx(He,{page:a,total:l.length,onPage:n})]})}function Ga(){const[t,s]=p.useState("errors");return e.jsxs("div",{className:"p-6",children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Loglar"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Tüm hesaplar genelinde sistem hataları, idari aksiyon ve kullanıcı aktivitesi."}),e.jsx("div",{className:"mt-5 flex gap-1 border-b border-border",children:Cs.map(({key:a,label:n,icon:l})=>e.jsxs("button",{type:"button",onClick:()=>s(a),className:S("flex items-center gap-2 border-b-2 px-4 py-2.5 text-sm font-medium transition-colors",t===a?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:[e.jsx(l,{className:"h-4 w-4"}),n]},a))}),e.jsxs("div",{className:"mt-5",children:[t==="errors"&&e.jsx(Is,{}),t==="admin"&&e.jsx(Ps,{}),t==="activity"&&e.jsx(Ks,{})]})]})}class Ds{static async list(){var a;const s=await I.get("/SysAdmin/Whitelabel");return((a=s.data)==null?void 0:a.data)??s.data??[]}}function qs({on:t}){return t?e.jsx(Mt,{className:"h-4 w-4 text-emerald-600"}
1):e.jsx(Et,{className:"h-4 w-4 text-muted-foreground/50"})}function Qa(){const t=$(),{showSuccess:s,showError:a}=z(),[n,l]=p.useState(""),[d,m]=p.useState(0),[x,j]=p.useState(null),[i,g]=p.useState({open:!1,item:null}),{data:f=[],isLoading:w,isFetching:b,refetch:k}=K({queryKey:["sysadmin-whitelabel-sites"],queryFn:()=>Ds.list(),staleTime:5*6e4}),{data:h}=K({queryKey:["sysadmin-whitelabel-detail",x],queryFn:()=>et.getById(x),enabled:x!==null,staleTime:Kt.NO_CACHE,gcTime:Pt.NO_CACHE});p.useEffect(()=>{h!=null&&h.data&&x!==null&&(g({open:!0,item:h.data}),j(null))},[h,x]);const o=D({mutationFn:({id:u,data:C})=>et.update(u,C),onSuccess:()=>{t.invalidateQueries({queryKey:["sysadmin-whitelabel-sites"]}),g({open:!1,item:null}),s("save")},onError:u=>a(u)}),v=u=>{i.item&&o.mutate({id:i.item.companyId,data:u})},[r,c]=p.useState({key:"account",dir:"asc"}),y=p.useMemo(()=>{const u=n.trim().toLocaleLowerCase("tr"),C=u?f.filter(E=>(E.accountName??"").toLocaleLowerCase("tr").includes(u)||(E.companyName??"").toLocaleLowerCase("tr").includes(u)||(E.domain??"").toLocaleLowerCase("tr").includes(u)||(E.reactDomain??"").toLocaleLowerCase("tr").includes(u)||String(E.accountId??"").includes(u)):f,A=E=>r.key==="account"?E.accountName:r.key==="domain"?E.domain:r.key==="title"?E.title:E.isActive?1:0;return[...C].sort((E,F)=>(r.dir==="asc"?1:-1)*q(A(E),A(F)))},[f,n,r]);p.useEffect(()=>m(0),[n]);const N=y.slice(d*M,(d+1)*M),L=Math.max(1,Math.ceil(y.length/M));return e.jsxs("div",{className:"p-6",children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Whitelabel"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Tüm hesapların domain, SSL ve marka ayarları envanteri. (Düzenleme sonraki dilimde.)"}),e.jsxs("div",{className:"mt-5 mb-4 flex flex-wrap items-center gap-3",children:[e.jsx("input",{type:"text",value:n,onChange:u=>l(u.target.value),placeholder:"Hesap adı / domain / ID ara...",className:"w-full max-w-sm rounded-lg border border-border bg-background px-3 py-2 text-sm"}),e.jsxs("button",{type:"button",onClick:()=>k(),className:"ml-auto flex items-center gap-2 rounded-lg border border-border px-3 py-2 text-sm font-medium text-foreground/80 hover:bg-accent",children:[e.jsx(R,{className:S("h-4 w-4",b&&"animate-spin")}),"Yenile"]})]}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-background",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border bg-muted/30 text-left text-xs uppercase tracking-wide text-muted-foreground",children:[e.jsx("th",{className:"px-4 py-3 font-semibold",children:"Logo"}),e.jsx(T,{label:"Hesap",col:"account",sort:r,setSort:c}),e.jsx(T,{label:"Domain",col:"domain",sort:r,setSort:c}),e.jsx("th",{className:"px-4 py-3 font-semibold",children:"React Domain"}),e.jsx("th",{className:"px-4 py-3 text-center font-semibold",children:"SSL"}),e.jsx(T,{label:"Başlık",col:"title",sort:r,setSort:c}),e.jsx("th",{className:"px-4 py-3 text-center font-semibold",children:"Favicon"}),e.jsx(T,{label:"Durum",col:"status",sort:r,setSort:c,align:"center"}),e.jsx("th",{className:"px-4 py-3 text-right font-semibold",children:"İşlem"})]})}),e.jsx("tbody",{children:w?e.jsx("tr",{children:e.jsx("td",{colSpan:9,className:"px-4 py-10 text-center text-muted-foreground",children:e.jsx(P,{className:"mx-auto h-5 w-5 animate-spin"})})}):N.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:9,className:"px-4 py-10 text-center text-muted-foreground",children:"Kayıt bulunamadı."})}):N.map(u=>e.jsxs("tr",{className:"border-b border-border/60 hover:bg-accent/40",children:[e.jsx("td",{className:"px-4 py-3",children:u.logoUrl?e.jsx("img",{src:u.logoUrl,alt:u.accountName??"logo",className:"h-8 max-w-[96px] rounded object-contain",loading:"lazy",onError:C=>{C.currentTarget.style.display="none"}}):e.jsx("div",{className:"flex h-8 w-16 items-center justify-center rounded bg-muted text-[10px] text-muted-foreground",children:"logo yok"})}),e.jsxs("td",{className:"px-4 py-3",children:[e.jsx("div",{className:"font-medium text-foreground",children:u.accountName||"—"}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[u.isMain?"ana · ":"","acc ",u.accountId??"—"," · comp ",u.companyId]})]}),e.jsx("td",{className:"max-w-[260px] px-4 py-3",children:u.domain?e.jsx("a",{href:u.domain,target:"_blank",rel:"noreferrer",className:"truncate text-primary hover:underline",children:u.domain}):e.jsx("span",{className:"text-muted-foreground",children:"—"})}),e.jsx("td",{className:"max-w-[220px] truncate px-4 py-3 text-muted-foreground",children:u.reactDomain||"—"}),e.jsx("td",{className:"px-4 py-3 text-center",children:e.jsx("span",{className:S("roun
1ded-full px-2 py-0.5 text-xs font-medium",u.useSSL?"bg-emerald-50 text-emerald-600":"bg-amber-50 text-amber-600"),children:u.useSSL?"SSL":"Yok"})}),e.jsx("td",{className:"max-w-[200px] truncate px-4 py-3 text-muted-foreground",children:u.title||"—"}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("div",{className:"flex justify-center",children:u.faviconUrl?e.jsx("img",{src:u.faviconUrl,alt:"favicon",className:"h-5 w-5 rounded object-contain",loading:"lazy",onError:C=>{C.currentTarget.style.display="none"}}):e.jsx(qs,{on:!!u.favicon})})}),e.jsx("td",{className:"px-4 py-3 text-center",children:e.jsx("span",{className:S("rounded-full px-2 py-0.5 text-xs font-medium",u.isActive?"bg-emerald-50 text-emerald-600":"bg-gray-100 text-gray-500"),children:u.isActive?"Aktif":"Pasif"})}),e.jsx("td",{className:"px-4 py-3 text-right",children:e.jsxs("button",{type:"button",onClick:()=>j(u.companyId),disabled:x===u.companyId,className:"inline-flex items-center gap-1.5 rounded-lg border border-border px-2.5 py-1.5 text-xs font-medium text-foreground/80 hover:bg-accent disabled:opacity-50",children:[x===u.companyId?e.jsx(P,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(re,{className:"h-3.5 w-3.5"}),"Düzenle"]})})]},u.companyId))})]})})}),y.length>0&&e.jsxs("div",{className:"flex items-center justify-between px-1 py-3 text-sm text-muted-foreground",children:[e.jsxs("span",{children:[d*M+1,"–",Math.min(y.length,(d+1)*M)," /"," ",y.length]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{type:"button",disabled:d===0,onClick:()=>m(u=>u-1),className:"flex items-center gap-1 rounded-lg border border-border px-2.5 py-1.5 font-medium hover:bg-accent disabled:opacity-40",children:[e.jsx(J,{className:"h-4 w-4"}),"Önceki"]}),e.jsxs("span",{className:"tabular-nums",children:[d+1," / ",L]}),e.jsxs("button",{type:"button",disabled:d>=L-1,onClick:()=>m(u=>u+1),className:"flex items-center gap-1 rounded-lg border border-border px-2.5 py-1.5 font-medium hover:bg-accent disabled:opacity-40",children:["Sonraki",e.jsx(Y,{className:"h-4 w-4"})]})]})]}),i.open&&i.item&&e.jsx(ys,{onClose:()=>g({open:!1,item:null}),onSubmit:v,isLoading:o.isPending,item:i.item},i.item.companyId)]})}class st{static async list(){var a;const s=await I.get("/SysAdmin/Usage");return((a=s.data)==null?void 0:a.data)??s.data??[]}static async onlineNow(s=15){var l;const a=await I.get("/SysAdmin/OnlineNow",{params:{windowMinutes:s}}),n=((l=a.data)==null?void 0:l.data)??a.data??{};return{windowMinutes:n.windowMinutes??s,asOf:n.asOf??new Date().toISOString(),totalOnline:n.totalOnline??0,totalWeb:n.totalWeb??0,totalMobile:n.totalMobile??0,accounts:n.accounts??[]}}}function bt(t){if(!t)return"—";const s=new Date(t);return Number.isNaN(s.getTime())?t:s.toLocaleString("tr-TR",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"})}function _({label:t,value:s,icon:a,tint:n}){return e.jsxs("div",{className:"flex items-center gap-3 rounded-xl border border-border bg-background px-4 py-3",children:[e.jsx("span",{className:S("inline-flex h-10 w-10 items-center justify-center rounded-lg",n),children:e.jsx(a,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xl font-bold tabular-nums text-foreground",children:s}),e.jsx("div",{className:"text-xs text-muted-foreground",children:t})]})]})}function _a(){const[t,s]=p.useState(""),[a,n]=p.useState(0),[l,d]=p.useState(null),{data:m=[],isLoading:x,isFetching:j,refetch:i}=K({queryKey:["sysadmin-usage"],queryFn:()=>st.list(),staleTime:5*6e4}),{data:g}=K({queryKey:["sysadmin-online-now"],queryFn:()=>st.onlineNow(15),refetchInterval:2e4,staleTime:15e3}),f=p.useMemo(()=>{const r=new Map;for(const c of(g==null?void 0:g.accounts)??[])r.set(c.accountId,{online:c.online,web:c.web,mobile:c.mobile});return r},[g]),w=p.useMemo(()=>{const r=m.filter(N=>N.lastActivity).length,c=m.filter(N=>!N.lastActivity&&N.isActive).length,y=m.reduce((N,L)=>N+(L.count30||0),0);return{total:m.length,active:r,dormant:c,activity30:y}},[m]),[b,k]=p.useState({key:"lastActivity",dir:"desc"}),h=p.useMemo(()=>{const r=t.trim().toLocaleLowerCase("tr"),c=r?m.filter(N=>(N.accountName??"").toLocaleLowerCase("tr").includes(r)||String(N.accountId).includes(r)):m,y=N=>b.key==="account"?N.accountName:b.key==="lastActivity"?N.lastActivity?new Date(N.lastActivity):null:b.key==="count30"?N.count30:b.key==="activeMembers30"?N.activeMembers30:N.isActive?N.lastActivity?2:1:0;return[...c].sort((N,L)=>(b.dir==="asc"?1:-1)*q(y(N),y(L)))},[m,t,b]);p.useEffect(()=>n(0),[t]);const o=h.slice(a*M,(a+1)*M),v=Math.max(1,Math.ceil(h.length/M));return e.jsxs("div",{className:"p-6",children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Kullanım & İzleme"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Hesap sağlığı — son aktiflik ve son 30 günlük aktivite. Atıl hesapları tespit et."}),e.jsxs("div",{className:"mt-5 rounded-xl border border-emerald-200 bg-emerald-50/40 p-4 dark:border-emerald-900/40 dark:bg-emerald-950/20",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsxs("span",{className:"relative flex h-2.5 w-2.5",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-400 opacity-75"}),e.jsx("span",{className:"relative inline-flex h-2.5 w-2.5 rounded-full bg-emerald-500"})]}),e.jsx("span",{className:"text-sm font-semibold text-foreground",children:"Şu An Online"}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["son ",(g==null?void 0:g.windowMinutes)??15," dk · 20 sn'de bir güncellenir"]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsx(_,{label:"Toplam Online",value:((g==null?void 0:g.totalOnline)??0).toLocaleStr
1ing("tr-TR"),icon:Dt,tint:"bg-emerald-100 text-emerald-700"}),e.jsx(_,{label:"Web",value:((g==null?void 0:g.totalWeb)??0).toLocaleString("tr-TR"),icon:qt,tint:"bg-blue-100 text-blue-700"}),e.jsx(_,{label:"Mobil",value:((g==null?void 0:g.totalMobile)??0).toLocaleString("tr-TR"),icon:Ft,tint:"bg-violet-100 text-violet-700"})]})]}),e.jsxs("div",{className:"mt-5 grid grid-cols-2 gap-3 lg:grid-cols-4",children:[e.jsx(_,{label:"Toplam Hesap",value:w.total,icon:ke,tint:"bg-blue-50 text-blue-600"}),e.jsx(_,{label:"Son 30g Aktif",value:w.active,icon:ot,tint:"bg-emerald-50 text-emerald-600"}),e.jsx(_,{label:"Atıl (30g aktivite yok)",value:w.dormant,icon:Rt,tint:"bg-amber-50 text-amber-600"}),e.jsx(_,{label:"Toplam Aktivite (30g)",value:w.activity30.toLocaleString("tr-TR"),icon:Fe,tint:"bg-violet-50 text-violet-600"})]}),e.jsxs("div",{className:"mb-4 mt-5 flex flex-wrap items-center gap-3",children:[e.jsx("input",{type:"text",value:t,onChange:r=>s(r.target.value),placeholder:"Hesap adı / ID ara...",className:"w-full max-w-sm rounded-lg border border-border bg-background px-3 py-2 text-sm"}),e.jsxs("button",{type:"button",onClick:()=>i(),className:"ml-auto flex items-center gap-2 rounded-lg border border-border px-3 py-2 text-sm font-medium text-foreground/80 hover:bg-accent",children:[e.jsx(R,{className:S("h-4 w-4",j&&"animate-spin")}),"Yenile"]})]}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-background",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border bg-muted/30 text-left text-xs uppercase tracking-wide text-muted-foreground",children:[e.jsx(T,{label:"Hesap",col:"account",sort:b,setSort:k}),e.jsx("th",{className:"px-4 py-3 text-right font-semibold",children:"Online (canlı)"}),e.jsx(T,{label:"Son Aktiflik",col:"lastActivity",sort:b,setSort:k}),e.jsx(T,{label:"Aktivite (30g)",col:"count30",sort:b,setSort:k,align:"right"}),e.jsx(T,{label:"Aktif Üye (30g)",col:"activeMembers30",sort:b,setSort:k,align:"right"}),e.jsx(T,{label:"Durum",col:"status",sort:b,setSort:k,align:"center"}),e.jsx("th",{className:"px-4 py-3 text-right font-semibold",children:"İşlem"})]})}),e.jsx("tbody",{children:x?e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"px-4 py-10 text-center text-muted-foreground",children:e.jsx(P,{className:"mx-auto h-5 w-5 animate-spin"})})}):o.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"px-4 py-10 text-center text-muted-foreground",children:"Kayıt bulunamadı."})}):o.map(r=>{const c=r.isActive?r.lastActivity?{label:"Aktif",cls:"bg-emerald-50 text-emerald-600"}:{label:"Atıl",cls:"bg-amber-50 text-amber-600"}:{label:"Pasif",cls:"bg-gray-100 text-gray-500"};return e.jsxs("tr",{className:"border-b border-border/60 hover:bg-accent/40",children:[e.jsxs("td",{className:"px-4 py-3",children:[e.jsx("div",{className:"font-medium text-foreground",children:r.accountName||"—"}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["acc ",r.accountId]})]}),e.jsx("td",{className:"px-4 py-3 text-right",children:(()=>{const y=f.get(r.accountId);return!y||y.online===0?e.jsx("span",{className:"text-muted-foreground",children:"—"}):e.jsxs("div",{children:[e.jsxs("div",{className:"inline-flex items-center gap-1.5 font-semibold tabular-nums text-emerald-600",children:[e.jsxs("span",{className:"relative flex h-1.5 w-1.5",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-400 opacity-75"}),e.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-emerald-500"})]}),y.online.toLocaleString("tr-TR")]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[y.web.toLocaleString("tr-TR")," web · ",y.mobile.toLocaleString("tr-TR")," mobil"]})]})})()}),e.jsx("td",{className:"whitespace-nowrap px-4 py-3 text-muted-foreground",children:bt(r.lastActivity)}),e.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-foreground",children:(r.count30||0).toLocaleString("tr-TR")}),e.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-muted-foreground",children:(r.activeMembers30||0).toLocaleStr
1ing("tr-TR")}),e.jsx("td",{className:"px-4 py-3 text-center",children:e.jsx("span",{className:S("rounded-full px-2 py-0.5 text-xs font-medium",c.cls),children:c.label})}),e.jsx("td",{className:"px-4 py-3 text-right",children:e.jsx("button",{type:"button",onClick:()=>d(r),className:"rounded-lg border border-border px-2.5 py-1.5 text-xs font-medium text-foreground/80 hover:bg-accent",children:"Aktivite →"})})]},r.accountId)})})]})})}),h.length>0&&e.jsxs("div",{className:"flex items-center justify-between px-1 py-3 text-sm text-muted-foreground",children:[e.jsxs("span",{children:[a*M+1,"–",Math.min(h.length,(a+1)*M)," / ",h.length]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{type:"button",disabled:a===0,onClick:()=>n(r=>r-1),className:"flex items-center gap-1 rounded-lg border border-border px-2.5 py-1.5 font-medium hover:bg-accent disabled:opacity-40",children:[e.jsx(J,{className:"h-4 w-4"}),"Önceki"]}),e.jsxs("span",{className:"tabular-nums",children:[a+1," / ",v]}),e.jsxs("button",{type:"button",disabled:a>=v-1,onClick:()=>n(r=>r+1),className:"flex items-center gap-1 rounded-lg border border-border px-2.5 py-1.5 font-medium hover:bg-accent disabled:opacity-40",children:["Sonraki",e.jsx(Y,{className:"h-4 w-4"})]})]})]}),l&&e.jsx(Fs,{row:l,onClose:()=>d(null)})]})}function Fs({row:t,onClose:s}){const{data:a=[],isLoading:n}=K({queryKey:["sysadmin-usage-detail",t.accountId],queryFn:()=>Oe.userActivity({accountId:t.accountId,take:50}),staleTime:3e4});return e.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-end bg-black/30",onClick:s,children:e.jsxs("div",{className:"h-full w-full max-w-xl overflow-y-auto bg-background p-6 shadow-2xl",onClick:l=>l.stopPropagation(),children:[e.jsxs("div",{className:"mb-1 flex items-start justify-between gap-4",children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:t.accountName}),e.jsx("button",{type:"button",onClick:s,className:"rounded-md border border-border px-2 py-1 text-sm hover:bg-accent",children:"Kapat"})]}),e.jsxs("p",{className:"mb-4 text-xs text-muted-foreground",children:["acc ",t.accountId," · son 50 aktivite olayı"]}),n?e.jsx(P,{className:"h-5 w-5 animate-spin text-muted-foreground"}):a.length===0?e.jsx("div",{className:"rounded-lg border border-dashed border-border p-6 text-center text-sm text-muted-foreground",children:"Aktivite kaydı bulunamadı."}):e.jsx("div",{className:"space-y-1.5",children:a.map(l=>e.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-lg border border-border/60 px-3 py-2 text-sm",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate font-medium text-foreground",children:l.memberName||"—"}),e.jsxs("div",{className:"truncate text-xs text-muted-foreground",children:[e.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5",children:l.eventType||"—"}),l.sourceName?` · ${l.sourceName}`:""]})]}),e.jsx("div",{className:"shrink-0 whitespace-nowrap text-xs text-muted-foreground",children:bt(l.insertedDate)})]},l.id))})]})})}class oe{static async getAccounts(){var a;return((a=(await I.get(`${this.BASE}/Accounts`)).data)==null?void 0:a.data)??[]}static async getSummary(){var a;return((a=(await I.get(`${this.BASE}/Summary`)).data)==null?void 0:a.data)??null}static async saveSetting(s){await I.post(`${this.BASE}/Setting`,s)}}be(oe,"BASE","/SysAdmin/SmartPanel");const U=new Intl.NumberFormat("tr-TR");function V(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}B`:U.format(t)}function ee({ikon:t,baslik:s,deger:a,alt:n,vurgu:l}){return e.jsxs("div",{className:"rounded-xl border border-border bg-card p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-muted-foreground",children:[e.jsx(t,{className:"h-4 w-4"}),s]}),e.jsx("div",{className:S("mt-2 text-2xl font-semibold tabular-nums",l==="uyari"&&"text-amber-600 dark:text-amber-400",l==="iyi"&&"text-emerald-600 dark:text-emerald-400"),children:a}),n?e.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:n}):null]})}function Va(){const t=$(),[s,a]=p.useState(""),[n,l]=p.useState(0),[d,m]=p.useState({key:"todayTokens",dir:"desc"}),[x,j]=p.useState(null),{data:i,isPending:g}=K({queryKey:["sysadmin-smartpanel-summary"],queryFn:()=>oe.getSummary()}
1),{data:f=[],isPending:w,refetch:b,isFetching:k}=K({queryKey:["sysadmin-smartpanel-accounts"],queryFn:()=>oe.getAccounts()}),h=D({mutationFn:u=>oe.saveSetting(u),onSuccess:()=>{j(null),t.invalidateQueries({queryKey:["sysadmin-smartpanel-accounts"]})}}),o=D({mutationFn:u=>oe.saveSetting(u),onSuccess:()=>t.invalidateQueries({queryKey:["sysadmin-smartpanel-accounts"]})}),v=f.find(u=>u.accountId===0),r=(v==null?void 0:v.dailyMessageLimit)??0,c=(v==null?void 0:v.dailyTokenLimit)??0,y=p.useMemo(()=>{const u=s.trim().toLocaleLowerCase("tr-TR");return[...u?f.filter(A=>(A.accountName??"").toLocaleLowerCase("tr-TR").includes(u)||String(A.accountId).includes(u)):f].sort((A,E)=>{if(A.accountId===0)return-1;if(E.accountId===0)return 1;const F=d.dir==="asc"?1:-1;switch(d.key){case"account":return F*q(A.accountName??"",E.accountName??"");case"enabled":return F*q(Number(A.isEnabled),Number(E.isEnabled));case"todayMessages":return F*q(A.todayMessages,E.todayMessages);case"tokens30":return F*q(A.tokens30,E.tokens30);default:return F*q(A.todayTokens,E.todayTokens)}})},[f,s,d]),N=y.slice(n*M,(n+1)*M),L=f.filter(u=>u.accountId!==0&&u.isEnabled).length;return e.jsxs("div",{className:"space-y-5 p-4 md:p-6",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"flex items-center gap-2 text-xl font-semibold",children:[e.jsx($t,{className:"h-5 w-5"}),"SmartPanel Yönetimi"]}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Tüm aktif hesaplar listelenir. Durum sütunundaki anahtara tıklayarak SmartPanel'i tek tıkla açıp kapatabilir, Düzenle ile o hesaba özel kota verebilirsiniz. Kota dolan hesap ertesi gün otomatik açılır."})]}),e.jsxs("button",{type:"button",onClick:()=>b(),className:"flex items-center gap-2 rounded-lg border border-border px-3 py-2 text-sm font-medium hover:bg-accent",children:[e.jsx(R,{className:S("h-4 w-4",k&&"animate-spin")}),"Yenile"]})]}),g?e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(P,{className:"h-4 w-4 animate-spin"})," Özet yükleniyor…"]}):e.jsxs("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-6",children:[e.jsx(ee,{ikon:me,baslik:"Bugün token",deger:V((i==null?void 0:i.todayTokens)??0),alt:`${U.format((i==null?void 0:i.todayMessages)??0)} mesaj`}),e.jsx(ee,{ikon:me,baslik:"7 gün token",deger:V((i==null?void 0:i.tokens7)??0),alt:`${U.format((i==null?void 0:i.messages7)??0)} mesaj`}),e.jsx(ee,{ikon:it,baslik:"Önbellek isabeti",deger:`%${(i==null?void 0:i.cacheHitRate)??0}`,alt:`${V((i==null?void 0:i.cacheWriteTokens)??0)} token yazıldı`,vurgu:((i==null?void 0:i.cacheHitRate)??0)>=40?"iyi":"uyari"}),e.jsx(ee,{ikon:ae,baslik:"Kotaya takılan",deger:U.format((i==null?void 0:i.blockedCount)??0),alt:"son 7 gün",vurgu:((i==null?void 0:i.blockedCount)??0)>0?"uyari":void 0}),e.jsx(ee,{ikon:zt,baslik:"Ortalama süre",deger:`${U.format(Math.round(((i==null?void 0:i.avgDurationMs)??0)/100)/10)} sn`,alt:`LLM'siz yanıt: %${(i==null?void 0:i.courtesyRate)??0}`}),e.jsx(ee,{ikon:me,baslik:"SmartQuery (7 gün)",deger:V((i==null?void 0:i.smartQueryTokens7)??0),alt:`${U.format((i==null?void 0:i.smartQueryMessages7)??0)} sorgu · kotadan düşmez`})]}),e.jsxs("div",{className:"rounded-xl border border-border bg-card",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3 border-b border-border p-3",children:[e.jsxs("div",{className:"relative flex-1 min-w-[220px]",children:[e.jsx(se,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx("input",{value:s,onChange:u=>{a(u.target.value),l(0)},placeholder:"Hesap adı veya numarası ara…",className:"w-full rounded-lg border border-border bg-background py-2 pl-9 pr-3 text-sm"})]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[L," hesapta açık"]})]}),w?e.jsxs("div",{className:"flex items-center gap-2 p-6 text-sm text-muted-foreground",children:[e.jsx(P,{className:"h-4 w-4 animate-spin"})," Yükleniyor…"]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"border-b border-border text-left text-xs uppercase text-muted-foreground",children:e.jsxs("tr",{children:[e.jsx(T,{label:"Hesap",col:"account",sort:d,setSort:m}),e.jsx(T,{label:"SmartPanel",col:"enabled",sort:d,setSort:m}),e.jsx("th",{className:"px-3 py-2",children:"Günlük limit"}),e.jsx(T,{label:"Bugün mesaj",col:"todayMessages",sort:d,setSort:m,align:"right"}
1),e.jsx(T,{label:"Bugün token",col:"todayTokens",sort:d,setSort:m,align:"right"}),e.jsx(T,{label:"30 gün token",col:"tokens30",sort:d,setSort:m,align:"right"}),e.jsx("th",{className:"px-3 py-2 text-right",children:"İşlem"})]})}),e.jsxs("tbody",{children:[N.map(u=>{const C=u.accountId===0;return e.jsxs("tr",{className:S("border-b border-border/60",C&&"bg-muted/40"),children:[e.jsxs("td",{className:"px-3 py-2",children:[e.jsx("div",{className:"font-medium",children:u.accountName||"—"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:C?"hesaba özel ayar yoksa bu geçerli":`#${u.accountId}`})]}),e.jsx("td",{className:"px-3 py-2",children:C?e.jsx("span",{className:"text-xs text-muted-foreground",children:u.isEnabled?"yeni hesaplarda açık":"yeni hesaplarda kapalı"}):e.jsxs("button",{type:"button",disabled:o.isPending,onClick:()=>o.mutate({accountId:u.accountId,isEnabled:!u.isEnabled,dailyMessageLimit:u.dailyMessageLimit,dailyTokenLimit:u.dailyTokenLimit,note:u.note}),title:u.isEnabled?"Kapatmak için tıklayın":"Açmak için tıklayın",className:S("inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-medium transition","disabled:opacity-50",u.isEnabled?"bg-emerald-100 text-emerald-800 hover:bg-emerald-200 dark:bg-emerald-950/40 dark:text-emerald-300":"bg-muted text-muted-foreground hover:bg-accent"),children:[e.jsx("span",{className:S("relative h-3.5 w-6 rounded-full transition",u.isEnabled?"bg-emerald-500":"bg-muted-foreground/40"),children:e.jsx("span",{className:S("absolute top-0.5 h-2.5 w-2.5 rounded-full bg-white transition-all",u.isEnabled?"left-3":"left-0.5")})}),u.isEnabled?"Açık":"Kapalı"]})}),e.jsxs("td",{className:"px-3 py-2 text-xs",children:[U.format(u.dailyMessageLimit??r)," mesaj ·"," ",V(u.dailyTokenLimit??c)," token",!C&&u.dailyMessageLimit==null&&u.dailyTokenLimit==null?e.jsx("span",{className:"ml-1 text-muted-foreground",children:"(varsayılan)"}):null]}),e.jsx("td",{className:"px-3 py-2 tabular-nums",children:U.format(u.todayMessages)}),e.jsx("td",{className:"px-3 py-2 tabular-nums",children:V(u.todayTokens)}),e.jsx("td",{className:"px-3 py-2 tabular-nums text-muted-foreground",children:V(u.tokens30)}),e.jsx("td",{className:"px-3 py-2 text-right",children:e.jsxs("button",{type:"button",onClick:()=>j(u),className:"inline-flex items-center gap-1 rounded-lg border border-border px-2.5 py-1.5 text-xs font-medium hover:bg-accent",children:[e.jsx(re,{className:"h-3.5 w-3.5"})," Düzenle"]})})]},u.accountId)}),N.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"px-3 py-6 text-center text-muted-foreground",children:"Kayıt bulunamadı."})}):null]})]})}),e.jsx(ne,{page:n,total:y.length,onPage:l})]})]}),x?e.jsx(Rs,{satir:x,kaydediliyor:h.isPending,onKapat:()=>j(null),onKaydet:u=>h.mutate(u)}):null]})}function Rs({satir:t,kaydediliyor:s,onKapat:a,onKaydet:n}){var k,h;const l=t.accountId===0,[d,m]=p.useState(t.isEnabled),[x,j]=p.useState(((k=t.dailyMessageLimit)==null?void 0:k.toString())??""),[i,g]=p.useState(((h=t.dailyTokenLimit)==null?void 0:h.toString())??""),[f,w]=p.useState(t.note??""),b=l&&(x.trim()===""||i.trim()==="");return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",children:e.jsxs("div",{className:"w-full max-w-md rounded-xl border border-border bg-card p-5",children:[e.jsx("h2",{className:"text-base font-semibold",children:l?"Global varsayılan ayarlar":`${t.accountName||`#${t.accountId}`} — SmartPanel`}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:l?"Hesaba özel ayarı olmayan tüm hesaplar için geçerlidir.":"Limit alanını boş bırakırsanız global varsayılan uygulanır. 0 yazarsanız o ölçüt sınırsız olur."}),e.jsxs("label",{className:"mt-4 flex items-center gap-2 text-sm",children:[e.jsx("input",{type:"checkbox",checked:d,onChange:o=>m(o.target.checked),className:"h-4 w-4"}),l?"Yeni hesaplarda varsayılan olarak açık olsun":"SmartPanel bu hesapta açık"]}),e.jsxs("div",{className:"mt-4 grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Günlük mesaj limiti"}),e.jsx("input",{value:x,onChange:o=>j(o.target.value.replace(/\D/g,"")),placeholder:l?"zorunlu":"varsayılan",className:"mt-1 w-full rounded-lg border border-border bg-background px-3 py-2 text-sm"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Günlük token limiti"}),e.jsx("input",{value:i,onChange:o=>g(o.target.value.replace(/\D/g,"")),placeholder:l?"zorunlu":"varsayılan",className:"mt-1 w-full rounded-lg border border-border bg-background px-3 py-2 text-sm"})]})]}),e.jsxs("div",{className:"mt-3",children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Not (isteğe bağlı)"}),e.jsx("input",{value:f,onChange:o=>w(o.target.value),className:"mt-1 w-full rounded-lg border border-border bg-background px-3 py-2 text-sm"})]}),l&&d?e.jsxs("p",{className:"mt-3 rounded-lg bg-amber-100 px-3 py-2 text-[11px] font-medium text-amber-900 dark:bg-amber-950/40 dark:text-amber-200",children:["⚠️ Bu kutu işaretliyken, kendi ayarı olmayan ",e.jsx("strong",{children:"TÜM hesaplarda"})," SmartPanel açılır. Tek tek açmak istiyorsanız burayı kapalı bırakıp hesap satırlarından açın."]}):null,e.jsx("p",{className:"mt-3 text-[11px] text-muted-foreground",children:"Değişiklik en geç bir dakika içinde yürürlüğe girer. Kota dolduğunda kullanıcıya destek adresimize yönlendiren bir mesaj gösterilir."}),e.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[e.jsx("button",{type:"button",onClick:a,className:"rounded-lg border border-border px-3 py-2 text-sm font-medium hover:bg-accent",children:"Vazgeç"}),e.jsxs("button",{type:"button",disabled:s||b,onClick:()=>n({accountId:t.accountId,isEnabled:d,dailyMessageLimit:x.trim()===""?null:Number(x),dailyTokenLimit:i.trim()===""?null:Number(i),note:f.trim()===""?null:f.trim()}),className:"inline-flex items-center gap-2 rounded-lg bg-primary px-3 py-2 text-sm font-medium text-primary-foreground disabled:opacity-50",children:[s?e.jsx(P,{className:"h-4 w-4 animate-spin"}):null,"Kaydet"]})]})]})})}const Ke=[{value:"SmartAssessment",label:"Smart Değerlendirme"},{value:"SmartQuiz",label:"Smart Sınav"},{value:"SmartTrainer",label:"Smart Trainer (Eğitim Asistanı)"}
1,{value:"SmartSurvey",label:"Smart Survey (anket üretimi)"},{value:"SmartSurveyThemes",label:"Smart Survey — cevap gruplama"},{value:"AcademyScorecard",label:"LMS Karneniz (hedef gerekçesi)"},{value:"Bulten",label:"Otomatik Bülten (taslak üretimi)"}];class ie{static async getAccounts(s){var n;return((n=(await I.get(`${this.BASE}/Accounts`,{params:{product:s}})).data)==null?void 0:n.data)??[]}static async getSummary(s){var n;return((n=(await I.get(`${this.BASE}/Summary`,{params:{product:s}})).data)==null?void 0:n.data)??null}static async saveSetting(s){await I.post(`${this.BASE}/Setting`,s)}}be(ie,"BASE","/SysAdmin/AiModule");const G=new Intl.NumberFormat("tr-TR");function te(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}B`:G.format(t)}function de({ikon:t,baslik:s,deger:a,alt:n,vurgu:l}){return e.jsxs("div",{className:"rounded-xl border border-border bg-card p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-muted-foreground",children:[e.jsx(t,{className:"h-4 w-4"}),s]}),e.jsx("div",{className:S("mt-2 text-2xl font-semibold tabular-nums",l==="uyari"&&"text-amber-600 dark:text-amber-400",l==="iyi"&&"text-emerald-600 dark:text-emerald-400"),children:a}),n?e.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:n}):null]})}function Wa(){const t=$(),[s,a]=p.useState(Ke[0].value),[n,l]=p.useState(""),[d,m]=p.useState(0),[x,j]=p.useState({key:"todayTokens",dir:"desc"}),[i,g]=p.useState(null),{data:f,isPending:w}=K({queryKey:["sysadmin-aimodule-summary",s],queryFn:()=>ie.getSummary(s)}),{data:b=[],isPending:k,refetch:h,isFetching:o}=K({queryKey:["sysadmin-aimodule-accounts",s],queryFn:()=>ie.getAccounts(s)}),v=D({mutationFn:A=>ie.saveSetting(A),onSuccess:()=>{g(null),t.invalidateQueries({queryKey:["sysadmin-aimodule-accounts",s]})}}),r=D({mutationFn:A=>ie.saveSetting(A),onSuccess:()=>t.invalidateQueries({queryKey:["sysadmin-aimodule-accounts",s]})}),c=b.find(A=>A.accountId===0),y=(c==null?void 0:c.dailyRequestLimit)??0,N=(c==null?void 0:c.dailyTokenLimit)??0,L=p.useMemo(()=>{const A=n.trim().toLocaleLowerCase("tr-TR");return[...A?b.filter(F=>(F.accountName??"").toLocaleLowerCase("tr-TR").includes(A)||String(F.accountId).includes(A)):b].sort((F,Z)=>{if(F.accountId===0)return-1;if(Z.accountId===0)return 1;const le=x.dir==="asc"?1:-1;switch(x.key){case"account":return le*q(F.accountName??"",Z.accountName??"");case"enabled":return le*q(Number(F.isEnabled),Number(Z.isEnabled));case"todayRequests":return le*q(F.todayRequests,Z.todayRequests);case"tokens30":return le*q(F.tokens30,Z.tokens30);default:return le*q(F.todayTokens,Z.todayTokens)}})},[b,n,x]),u=L.slice(d*M,(d+1)*M),C=b.filter(A=>A.accountId!==0&&A.isEnabled).length;return e.jsxs("div",{className:"space-y-5 p-4 md:p-6",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"flex items-center gap-2 text-xl font-semibold",children:[e.jsx(Ge,{className:"h-5 w-5"}),"AI Modülleri"]}),e.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:["Tüm aktif hesaplar listelenir. Modül ",e.jsx("strong",{children:"varsayılan olarak kapalıdır"}),"; durum sütunundaki anahtara tıklayarak tek tıkla açıp kapatabilir, Düzenle ile o hesaba özel kota verebilirsiniz. Kota dolan hesap ertesi gün otomatik açılır."]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("select",{value:s,onChange:A=>{a(A.target.value),m(0)},className:"rounded-lg border border-border bg-background px-3 py-2 text-sm",children:Ke.map(A=>e.jsx("option",{value:A.value,children:A.label},A.value))}),e.jsxs("button",{type:"button",onClick:()=>h(),className:"flex items-center gap-2 rounded-lg border border-border px-3 py-2 text-sm font-medium hover:bg-accent",children:[e.jsx(R,{className:S("h-4 w-4",o&&"animate-spin")}),"Yenile"]})]})]}),w?e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(P,{className:"h-4 w-4 animate-spin"})," Özet yükleniyor…"]}):e.jsxs("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-5",children:[e.jsx(de,{ikon:me,baslik:"Bugün token",deger:te((f==null?void 0:f.todayTokens)??0),alt:`${G.format((f==null?void 0:f.todayRequests)??0)} üretim`}),e.jsx(de,{ikon:me,baslik:"7 gün token",deger:te((f==null?void 0:f.week7Tokens)??0),alt:`${G.format((f==null?void 0:f.week7Requests)??0)} üretim`}),e.jsx(de,{ikon:it,baslik:"30 gün token",deger:te((f==null?void 0:f.total30Tokens)??0),alt:`${G.format((f==null?void 0:f.total30Requests)??0)} üretim`}),e.jsx(de,{ikon:ae,baslik:"Kesilen yanıt",deger:G.format((f==null?void 0:f.truncatedResponses)??0),alt:"son 30 gün · uzunluk sınırı",vurgu:((f==null?void 0:f.truncatedResponses)??0)>0?"uyari":void 0}),e.jsx(de,{ikon:Ge,baslik:"Açık hesap",deger:G.format((f==null?void 0:f.enabledAccounts)??0),alt:f!=null&&f.globalEnabled?"global varsayılan AÇIK":"global varsayılan kapalı",vurgu:f!=null&&f.globalEnabled?"uyari":void 0})]}),e.jsxs("div",{className:"rounded-xl border border-border bg-card",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3 border-b border-border p-3",children:[e.jsxs("div",{className:"relative flex-1 min-w-[220px]",children:[e.jsx(se,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx("input",{value:n,onChange:A=>{l(A.target.value),m(0)},placeholder:"Hesap adı veya numarası ara…",className:"w-full rounded-lg border border-border bg-background py-2 pl-9 pr-3 text-sm"})]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[C," hesapta açık"]})]}),k?e.jsxs("div",{className:"flex items-center gap-2 p-6 text-sm text-muted-foreground",children:[e.jsx(P,{className:"h-4 w-4 animate-spin"})," Yükleniyor…"]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"border-b border-border text-left text-xs uppercase text-muted-foreground",children:e.jsxs("tr",{children:[e.jsx(T,{label:"Hesap",col:"account",sort:x,setSort:j}),e.jsx(T,{label:"Durum",col:"enabled",sort:x,setSort:j}),e.jsx("th",{className:"px-3 py-2",children:"Günlük limit"}),e.jsx(T,{label:"Bugün üretim",col:"todayRequests",sort:x,setSort:j,align:"right"}
1),e.jsx(T,{label:"Bugün token",col:"todayTokens",sort:x,setSort:j,align:"right"}),e.jsx(T,{label:"30 gün token",col:"tokens30",sort:x,setSort:j,align:"right"}),e.jsx("th",{className:"px-3 py-2 text-right",children:"İşlem"})]})}),e.jsxs("tbody",{children:[u.map(A=>{const E=A.accountId===0;return e.jsxs("tr",{className:S("border-b border-border/60",E&&"bg-muted/40"),children:[e.jsxs("td",{className:"px-3 py-2",children:[e.jsx("div",{className:"font-medium",children:A.accountName||"—"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:E?"hesaba özel ayar yoksa bu geçerli":`#${A.accountId}`})]}),e.jsx("td",{className:"px-3 py-2",children:E?e.jsx("span",{className:"text-xs text-muted-foreground",children:A.isEnabled?"yeni hesaplarda açık":"yeni hesaplarda kapalı"}):e.jsxs("button",{type:"button",disabled:r.isPending,onClick:()=>r.mutate({product:s,accountId:A.accountId,isEnabled:!A.isEnabled,dailyRequestLimit:A.dailyRequestLimit,dailyTokenLimit:A.dailyTokenLimit,note:A.note}),title:A.isEnabled?"Kapatmak için tıklayın":"Açmak için tıklayın",className:S("inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-medium transition","disabled:opacity-50",A.isEnabled?"bg-emerald-100 text-emerald-800 hover:bg-emerald-200 dark:bg-emerald-950/40 dark:text-emerald-300":"bg-muted text-muted-foreground hover:bg-accent"),children:[e.jsx("span",{className:S("relative h-3.5 w-6 rounded-full transition",A.isEnabled?"bg-emerald-500":"bg-muted-foreground/40"),children:e.jsx("span",{className:S("absolute top-0.5 h-2.5 w-2.5 rounded-full bg-white transition-all",A.isEnabled?"left-3":"left-0.5")})}),A.isEnabled?"Açık":"Kapalı"]})}),e.jsxs("td",{className:"px-3 py-2 text-xs",children:[G.format(A.dailyRequestLimit??y)," üretim ·"," ",te(A.dailyTokenLimit??N)," token",!E&&A.dailyRequestLimit==null&&A.dailyTokenLimit==null?e.jsx("span",{className:"ml-1 text-muted-foreground",children:"(varsayılan)"}):null]}),e.jsx("td",{className:"px-3 py-2 tabular-nums",children:G.format(A.todayRequests)}),e.jsx("td",{className:"px-3 py-2 tabular-nums",children:te(A.todayTokens)}),e.jsx("td",{className:"px-3 py-2 tabular-nums text-muted-foreground",children:te(A.tokens30)}),e.jsx("td",{className:"px-3 py-2 text-right",children:e.jsxs("button",{type:"button",onClick:()=>g(A),className:"inline-flex items-center gap-1 rounded-lg border border-border px-2.5 py-1.5 text-xs font-medium hover:bg-accent",children:[e.jsx(re,{className:"h-3.5 w-3.5"})," Düzenle"]})})]},A.accountId)}),u.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"px-3 py-6 text-center text-muted-foreground",children:"Kayıt bulunamadı."})}):null]})]})}),e.jsx(ne,{page:d,total:L.length,onPage:m})]})]}),i?e.jsx($s,{urun:s,satir:i,kaydediliyor:v.isPending,onKapat:()=>g(null),onKaydet:A=>v.mutate(A)}):null]})}function $s({urun:t,satir:s,kaydediliyor:a,onKapat:n,onKaydet:l}){var o,v,r;const d=s.accountId===0,[m,x]=p.useState(s.isEnabled),[j,i]=p.useState(((o=s.dailyRequestLimit)==null?void 0:o.toString())??""),[g,f]=p.useState(((v=s.dailyTokenLimit)==null?void 0:v.toString())??""),[w,b]=p.useState(s.note??""),k=d&&(j.trim()===""||g.trim()===""),h=((r=Ke.find(c=>c.value===t))==null?void 0:r.label)??t;return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",children:e.jsxs("div",{className:"w-full max-w-md rounded-xl border border-border bg-card p-5",children:[e.jsx("h2",{className:"text-base font-semibold",children:d?`Global varsayılan — ${h}`:`${s.accountName||`#${s.accountId}`} — ${h}`}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:d?"Hesaba özel ayarı olmayan tüm hesaplar için geçerlidir.":"Limit alanını boş bırakırsanız global varsayılan uygulanır. 0 yazarsanız o ölçüt sınırsız olur."}),e.jsxs("label",{className:"mt-4 flex items-center gap-2 text-sm",children:[e.jsx("input",{type:"checkbox",checked:m,onChange:c=>x(c.target.checked),className:"h-4 w-4"}),d?"Yeni hesaplarda varsayılan olarak açık olsun":`${h} bu hesapta açık`]}),e.jsxs("div",{className:"mt-4 grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Günlük üretim limiti"}),e.jsx("input",{value:j,onChange:c=>i(c.target.value.replace(/\D/g,"")),placeholder:d?"zorunlu":"varsayılan",className:"mt-1 w-full rounded-lg border border-border bg-background px-3 py-2 text-sm"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Günlük token limiti"}),e.jsx("input",{value:g,onChange:c=>f(c.target.value.replace(/\D/g,"")),placeholder:d?"zorunlu":"varsayılan",className:"mt-1 w-full rounded-lg border border-border bg-background px-3 py-2 text-sm"})]})]}),e.jsxs("div",{className:"mt-3",children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Not (isteğe bağlı)"}),e.jsx("input",{value:w,onChange:c=>b(c.target.value),className:"mt-1 w-full rounded-lg border border-border bg-background px-3 py-2 text-sm"})]}),d&&m?e.jsxs("p",{className:"mt-3 rounded-lg bg-amber-100 px-3 py-2 text-[11px] font-medium text-amber-900 dark:bg-amber-950/40 dark:text-amber-200",children:["⚠️ Bu kutu işaretliyken, kendi ayarı olmayan ",e.jsx("strong",{children:"TÜM hesaplarda"})," ",h," ","açılır. Tek tek açmak istiyorsanız burayı kapalı bırakıp hesap satırlarından açın."]}):null,e.jsx("p",{className:"mt-3 text-[11px] text-muted-foreground",children:"Değişiklik en geç bir dakika içinde yürürlüğe girer. Kota dolduğunda kullanıcıya destek adresimize yönlendiren bir mesaj gösterilir."}),e.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[e.jsx("button",{type:"button",onClick:n,className:"rounded-lg border border-border px-3 py-2 text-sm font-medium hover:bg-accent",children:"Vazgeç"}),e.jsxs("button",{type:"button",disabled:a||k,onClick:()=>l({product:t,accountId:s.accountId,isEnabled:m,dailyRequestLimit:j.trim()===""?null:Number(j),dailyTokenLimit:g.trim()===""?null:Number(g),note:w.trim()===""?null:w.trim()}),className:"inline-flex items-center gap-2 rounded-lg bg-primary px-3 py-2 text-sm font-medium text-primary-foreground disabled:opacity-50",children:[a?e.jsx(P,{className:"h-4 w-4 animate-spin"}):null,"Kaydet"]})]})]})})}const at={async accounts(){var s;return((s=(await I.get("/SysAdmin/PanelRole/Accounts")).data)==null?void 0:s.data)??[]},async setEnabled(t,s){var n;return(n=(await I.post("/SysAdmin/PanelRole/Setting",{accountId:t,isEnabled:s})).data)==null?void 0:n.data}};function Ja(){const t=$(),{showSuccess:s,showError:a}=z(),[n,l]=p.useState(""),[d,m]=p.useState(0),[x,j]=p.useState(null),{data:i,isLoading:g}=K({queryKey:["sysadmin","panel-role-accounts"],queryFn:()=>at.accounts(),staleTime:3e4}),f=D({mutationFn:({accountId:o,isEnabled:v})=>at.setEnabled(o,v),onSuccess:o=>{!o||o.affectedRows===0?a(new Error((o==null?void 0:o.uyari)||"Değişiklik yazılamadı.")):s("save"),t.invalidateQueries({queryKey:["sysadmin","panel-role-accounts"]}),j(null)},onError:o=>{a(o),j(null)}}),w=p.useMemo(()=>{const o=n.trim().toLocaleLowerCase("tr"),v=i??[];return o?v.filter(r=>(r.accountName??"").toLocaleLowerCase("tr").includes(o)||String(r.accountId).includes(o)):v},[i,n]),b=w.slice(d*M,(d+1)*M),k=(i??[]).filter(o=>o.isEnabled).length,h=(i??[]).filter(o=>o.isEnabled).reduce((o,v)=>o+v.memberCount,0);return e.jsxs("div",{className:"p-6",children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Panel Rolleri"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Hesap bazlı açma/kapama. Kapalı hesapta panel rol sistemi hiç devreye girmez — tanımlı roller ve atamalar durur, yalnız uygulanmaz."}),e.jsxs("div",{className:"mt-4 flex items-start gap-2 rounded-lg border border-amber-200 bg-amber-50 p-3 text-sm dark:border-amber-900 dark:bg-amber-950/40",children:[e.jsx(pe,{className:"mt-0.5 h-4 w-4 shrink-0 text-amber-600 dar
1k:text-amber-400"}),e.jsxs("p",{className:"text-amber-900 dark:text-amber-200",children:[e.jsx("strong",{children:"Değişiklik anında etkili DEĞİL."}),' Bayrak her uygulama sunucusunda 10 dakikaya kadar önbellekte kalır (canlıda 3 sunucu). Açılış da kapanış da en geç 10 dakika içinde geçerli olur — "çalışmadı" sanıp tekrar basmayın. Daha hızlısı gerekiyorsa uygulama havuzu geri dönüştürülmeli.']})]}),e.jsxs("div",{className:"mt-4 flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:[e.jsx("strong",{className:"text-foreground",children:k})," hesapta açık ·"," ",e.jsx("strong",{className:"text-foreground",children:h})," kullanıcı etkileniyor"]}),e.jsxs("div",{className:"relative w-full sm:w-72",children:[e.jsx(se,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx("input",{className:"w-full rounded-lg border border-border bg-background py-2 pl-8 pr-3 text-sm",placeholder:"Hesap adı ya da numarası…",value:n,onChange:o=>{l(o.target.value),m(0)}})]})]}),e.jsx("div",{className:"mt-3 overflow-x-auto rounded-lg border border-border",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-muted/40 text-left",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-3 py-2 font-medium",children:"Hesap"}),e.jsx("th",{className:"px-3 py-2 font-medium",children:"Tanımlı rol"}),e.jsx("th",{className:"px-3 py-2 font-medium",children:"Rol atanmış kullanıcı"}),e.jsx("th",{className:"px-3 py-2 font-medium",children:"Durum"}),e.jsx("th",{className:"px-3 py-2 text-right font-medium",children:"İşlem"})]})}),e.jsxs("tbody",{className:"divide-y divide-border",children:[g&&e.jsx("tr",{children:e.jsx("td",{colSpan:5,className:"px-3 py-6 text-center text-muted-foreground",children:"Yükleniyor…"})}),!g&&b.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:5,className:"px-3 py-6 text-center text-muted-foreground",children:"Kayıt bulunamadı."})}),b.map(o=>e.jsxs("tr",{className:"hover:bg-muted/30",children:[e.jsxs("td",{className:"px-3 py-2.5",children:[e.jsx("div",{className:"font-medium",children:o.accountName||`#${o.accountId}`}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["#",o.accountId]})]}),e.jsxs("td",{className:"px-3 py-2.5 text-muted-foreground",children:[o.activeRoleCount,o.roleCount!==o.activeRoleCount&&e.jsxs("span",{className:"ml-1 text-xs",children:["(",o.roleCount," toplam)"]})]}),e.jsx("td",{className:"px-3 py-2.5 text-muted-foreground",children:o.memberCount}),e.jsxs("td",{className:"px-3 py-2.5",children:[e.jsxs("span",{className:`inline-flex items-center gap-1 rounded px-2 py-0.5 text-xs ${o.isEnabled?"bg-emerald-100 text-emerald-800 dark:bg-emerald-950 dark:text-emerald-200":"bg-muted text-muted-foreground"}`,children:[o.isEnabled?e.jsx($e,{className:"h-3 w-3"}):e.jsx(Bt,{className:"h-3 w-3"}),o.isEnabled?"Açık":"Kapalı"]}),!o.hasDetailRow&&e.jsx("span",{className:"ml-2 rounded bg-destructive/10 px-1.5 py-0.5 text-[11px] text-destructive",title:"Bu hesabın AccountDetails satırı yok; bayrak yazılamaz.",children:"ayar satırı yok"})]}),e.jsx("td",{className:"px-3 py-2.5 text-right",children:e.jsx("button",{type:"button",disabled:!o.hasDetailRow||f.isPending,onClick:()=>j({satir:o,hedef:!o.isEnabled}),className:"rounded-lg border border-border px-2.5 py-1.5 text-xs font-medium hover:bg-accent disabled:opacity-40",children:o.isEnabled?"Kapat":"Aç"})})]},o.accountId))]})]})}),e.jsx(ne,{page:d,total:w.length,onPage:m}),x&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4",children:e.jsxs("div",{className:"w-full max-w-md rounded-lg border border-border bg-background p-5 shadow-lg",children:[e.jsx("h2",{className:"text-base font-semibold",children:x.hedef?"Panel rolleri açılsın mı?":"Panel rolleri kapatılsın mı?"}),e.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:[e.jsx("strong",{className:"text-foreground",children:x.satir.accountName||`#${x.satir.accountId}`})," ","hesabında"," ",x.hedef?e.jsxs(e.Fragment,{children:["panel rol yetkilendirmesi devreye girecek. Tanımlı"," ",x.satir.activeRoleCount," rol ve rol atanmış"," ",x.satir.memberCount," kullanıcı etkilenecek."]}):e.jsxs(e.Fragment,{children:["panel rol yetkilendirmesi duracak. Rol atanmış"," ",x.satir.memberCount," kullanıcı düz üyeye döner ve panele giremez. Roller ve atamalar SİLİNMEZ; tekrar açıldığında kaldığı yerden çalışır."]})]}),e.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[e.jsx("button",{type:"button",className:"rounded-lg border border-border px-3 py-1.5 text-sm",onClick:()=>j(null),children:"Vazgeç"}),e.jsx("button",{type:"button",disabled:f.isPending,className:"rounded-lg bg-primary px-3 py-1.5 text-sm font-medium text-primary-foreground disabled:opacity-50",onClick:()=>f.mutate({accountId:x.satir.accountId,isEnabled:x.hedef}),children:x.hedef?"Aç":"Kapat"})]})]})})]})}class Q{static async list(){var a;const s=await I.get("/SysAdmin/Plans");return((a=s.data)==null?void 0:a.data)??s.data??[]}static async create(s){var n;const a=await I.post("/SysAdmin/Plans",s);return((n=a.data)==null?void 0:n.data)??a.data}static async update(s,a){await I.put(`/SysAdmin/Plans/${s}`,a)}static async deactivate(s){await I.delete(`/SysAdmin/Plans/${s}`)}static async accounts(){var a;const s=await I.get("/SysAdmin/Plans/Accounts");return((a=s.data)==null?void 0:a.data)??s.data??[]}static async assign(s){await I.post("/SysAdmin/Plans/Assign",s)}static async unassign(s){await I.delete(`/SysAdmin/Plans/Assign/${s}`)}}
1function zs(t){return(t/100).toLocaleString("tr-TR",{minimumFractionDigits:2,maximumFractionDigits:2})}const Bs={Name:"",Description:"",MaxUsers:null,MaxStorageGb:null,MaxModules:null,PriceKurus:0,Currency:"TRY",PeriodMonths:12,IsActive:!0};function Os({plan:t,onClose:s,onSubmit:a,isLoading:n}){const[l,d]=p.useState(t?{Name:t.name,Description:t.description,MaxUsers:t.maxUsers,MaxStorageGb:t.maxStorageGb,MaxModules:t.maxModules,PriceKurus:t.priceKurus,Currency:t.currency??"TRY",PeriodMonths:t.periodMonths,IsActive:t.isActive}:Bs),[m,x]=p.useState(t?String(t.priceKurus/100):"0"),j=g=>g.trim()===""?null:Math.max(0,Math.floor(Number(g))),i=()=>{if(!l.Name.trim())return;const g=Math.round(Number(m.replace(",","."))*100)||0;a({...l,Name:l.Name.trim(),PriceKurus:g})};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4",onClick:s,children:e.jsxs("div",{className:"w-full max-w-lg rounded-2xl bg-background p-6 shadow-2xl",onClick:g=>g.stopPropagation(),children:[e.jsx("h2",{className:"mb-4 text-lg font-semibold text-foreground",children:t?"Plan Düzenle":"Yeni Plan"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Plan Adı *"}),e.jsx("input",{value:l.Name,onChange:g=>d({...l,Name:g.target.value}),className:"mt-1 w-full rounded-lg border border-border bg-background px-3 py-2 text-sm"})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Açıklama"}),e.jsx("input",{value:l.Description??"",onChange:g=>d({...l,Description:g.target.value}),className:"mt-1 w-full rounded-lg border border-border bg-background px-3 py-2 text-sm"})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Maks. Kullanıcı"}),e.jsx("input",{type:"number",min:0,placeholder:"∞",value:l.MaxUsers??"",onChange:g=>d({...l,MaxUsers:j(g.target.value)}),className:"mt-1 w-full rounded-lg border border-border bg-background px-3 py-2 text-sm"})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Depolama (GB)"}),e.jsx("input",{type:"number",min:0,placeholder:"∞",value:l.MaxStorageGb??"",onChange:g=>d({...l,MaxStorageGb:j(g.target.value)}),className:"mt-1 w-full rounded-lg border border-border bg-background px-3 py-2 text-sm"})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Maks. Modül"}),e.jsx("input",{type:"number",min:0,placeholder:"∞",value:l.MaxModules??"",onChange:g=>d({...l,MaxModules:j(g.target.value)}),className:"mt-1 w-full rounded-lg border border-border bg-background px-3 py-2 text-sm"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Fiyat (₺)"}),e.jsx("input",{type:"number",min:0,step:"0.01",value:m,onChange:g=>x(g.target.value),className:"mt-1 w-full rounded-lg border border-border bg-background px-3 py-2 text-sm"})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Periyot (ay)"}),e.jsx("input",{type:"number",min:1,value:l.PeriodMonths??12,onChange:g=>d({...l,PeriodMonths:Math.max(1,Number(g.target.value)||12)}),className:"mt-1 w-full rounded-lg border border-border bg-background px-3 py-2 text-sm"})]})]}),e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",checked:l.IsActive,onChange:g=>d({...l,IsActive:g.target.checked})}),e.jsx("span",{className:"text-sm text-foreground",children:"Aktif"})]}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Boş kota = sınırsız. Bu plan hiçbir akışı engellemez (yalnız görünürlük)."})]}),e.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[e.jsx("button",{type:"button",onClick:s,className:"rounded-lg border border-border px-4 py-2 text-sm hover:bg-accent",children:"İptal"}),e.jsxs("button",{type:"button",onClick:i,disabled:n||!l.Name.trim(),className:"flex items-center gap-2 rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:opacity-90 disabled:opacity-50",children:[n&&e.jsx(P,{className:"h-4 w-4 animate-spin"}),"Kaydet"]})]})]})})}function Hs(){const t=$(),{showSuccess:s,showError:a}=z(),[n,l]=p.useState({open:!1,plan:null}),[d,m]=p.useState({key:"name",dir:"asc"}),[x,j]=p.useState(0),{data:i=[],isLoading:g,isFetching:f,refetch:w}=K({queryKey:["sysadmin-plans"],queryFn:()=>Q.list(),staleTime:6e4}),b=p.useMemo(()=>{const r=c=>d.key==="name"?c.name:d.key==="maxUsers"?c.maxUsers:d.key==="price"?c.priceKurus:c.isActive?1:0;return[...i].sort((c,y)=>(d.dir==="asc"?1:-1)*q(r(c),r(y)))},[i,d]),k=b.slice(x*M,(x+1)*M),h=D({mutationFn:r=>Q.create(r),onSuccess:()=>{t.invalidateQueries({queryKey:["sysadmin-plans"]}),l({open:!1,plan:null}),s("save")},onError:r=>a(r)}),o=D({mutationFn:({id:r,d:c})=>Q.update(r,c),onSuccess:()=>{t.invalidateQueries({queryKey:["sysadmin-plans"]}),l({open:!1,plan:null}),s("save")},onError:r=>a(r)}),v=D({mutationFn:r=>Q.deactivate(r),onSuccess:()=>{t.invalidateQueries({queryKey:["sysadmin-plans"]}),s("save")},onError:r=>a(r)});return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[e.jsxs("button",{type:"button",onClick:()=>l({open:!0,plan:null}),className:"flex items-center gap-2 rounded-lg bg-primary px-3 py-2 text-sm font-medium text-primary-foreground hover:opacity-90",children:[e.jsx(ze,{className:"h-4 w-4"}),"Yeni Plan"]}),e.jsxs("button",{type:"button",onClick:()=>w(),className:"ml-auto flex items-center gap-2 rounded-lg border border-border px-3 py-2 text-sm font-medium text-foreground
1/80 hover:bg-accent",children:[e.jsx(R,{className:S("h-4 w-4",f&&"animate-spin")}),"Yenile"]})]}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-background",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border bg-muted/30 text-left text-xs uppercase tracking-wide text-muted-foreground",children:[e.jsx(T,{label:"Plan",col:"name",sort:d,setSort:m}),e.jsx(T,{label:"Kullanıcı",col:"maxUsers",sort:d,setSort:m,align:"right"}),e.jsx("th",{className:"px-4 py-3 text-right font-semibold",children:"Depolama"}),e.jsx("th",{className:"px-4 py-3 text-right font-semibold",children:"Modül"}),e.jsx(T,{label:"Fiyat",col:"price",sort:d,setSort:m,align:"right"}),e.jsx(T,{label:"Durum",col:"status",sort:d,setSort:m,align:"center"}),e.jsx("th",{className:"px-4 py-3 text-right font-semibold",children:"İşlem"})]})}),e.jsx("tbody",{children:g?e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"px-4 py-10 text-center text-muted-foreground",children:e.jsx(P,{className:"mx-auto h-5 w-5 animate-spin"})})}):k.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"px-4 py-10 text-center text-muted-foreground",children:"Henüz plan tanımlanmadı."})}):k.map(r=>e.jsxs("tr",{className:"border-b border-border/60 hover:bg-accent/40",children:[e.jsxs("td",{className:"px-4 py-3",children:[e.jsx("div",{className:"font-medium text-foreground",children:r.name}),r.description&&e.jsx("div",{className:"text-xs text-muted-foreground",children:r.description})]}),e.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-muted-foreground",children:r.maxUsers??"∞"}),e.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-muted-foreground",children:r.maxStorageGb!=null?`${r.maxStorageGb} GB`:"∞"}),e.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-muted-foreground",children:r.maxModules??"∞"}),e.jsxs("td",{className:"px-4 py-3 text-right tabular-nums text-foreground",children:["₺",zs(r.priceKurus),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[" /",r.periodMonths,"ay"]})]}),e.jsx("td",{className:"px-4 py-3 text-center",children:e.jsx("span",{className:S("rounded-full px-2 py-0.5 text-xs font-medium",r.isActive?"bg-emerald-50 text-emerald-600":"bg-gray-100 text-gray-500"),children:r.isActive?"Aktif":"Pasif"})}),e.jsx("td",{className:"px-4 py-3",children:e.jsxs("div",{className:"flex justify-end gap-1",children:[e.jsx("button",{type:"button",onClick:()=>l({open:!0,plan:r}),className:"rounded-md border border-border p-1.5 hover:bg-accent",title:"Düzenle",children:e.jsx(re,{className:"h-3.5 w-3.5"})}),r.isActive&&e.jsx("button",{type:"button",onClick:()=>v.mutate(r.id),disabled:v.isPending,className:"rounded-md border border-border p-1.5 text-red-500 hover:bg-red-50 disabled:opacity-50",title:"Pasife al",children:e.jsx(Be,{className:"h-3.5 w-3.5"})})]})})]},r.id))})]})})}),e.jsx(ne,{page:x,total:b.length,onPage:j}),n.open&&e.jsx(Os,{plan:n.plan,onClose:()=>l({open:!1,plan:null}),onSubmit:r=>n.plan?o.mutate({id:n.plan.id,d:r}):h.mutate(r),isLoading:h.isPending||o.isPending})]})}function Ys(){const t=$(),{showSuccess:s,showError:a}=z(),[n,l]=p.useState(""),[d,m]=p.useState(0),{data:x=[],isLoading:j}=K({queryKey:["sysadmin-plan-accounts"],queryFn:()=>Q.accounts(),staleTime:6e4}),{data:i=[]}=K({queryKey:["sysadmin-plans"],queryFn:()=>Q.list(),staleTime:6e4}),{data:g=new Map}=K({queryKey:["sysadmin-dashboard-users"],queryFn:async()=>{const r=await ve.getStats();return new Map((r.accounts??[]).map(c=>[c.id,c.users]))},staleTime:5*6e4}),f=p.useMemo(()=>i.filter(r=>r.isActive),[i]),w=D({mutationFn:({accountId:r,planId:c})=>c===0?Q.unassign(r):Q.assign({AccountId:r,PlanId:c,Status:"active"}),onSuccess:()=>{t.invalidateQueries({queryKey:["sysadmin-plan-accounts"]}),s("save")},onError:r=>a(r)}),[b,k]=p.useState({key:"account",dir:"asc"}),h=p.useMemo(()=>{const r=n.trim().toLocaleLowerCase("tr"),c=r?x.filter(N=>(N.accountName??"").toLocaleLowerCase("tr").includes(r)||String(N.accountId).includes(r)):x,y=N=>b.key==="account"?N.accountName:N.planName;return[...c].sort((N,L)=>(b.dir==="asc"?1:-1)*q(y(N),y(L)))},[x,n,b]);p.useEffect(()=>m(0),[n]);const o=h.slice(d*M,(d+1)*M),v=Math.max(1,Math.ceil(h.length/M));return e.jsxs("div",{children:[e.jsx("div",{className:"mb-4 flex flex-wrap items-center gap-3",children:e.jsx("input",{type:"text",value:n,onChange:r=>l(r.target.value),placeholder:"Hesap adı / ID ara...",className:"w-full max-w-sm rounded-lg border border-border bg-background px-3 py-2 text-sm"})}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-background",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border bg-muted/30 text-left text-xs uppercase tracking-wide text-muted-foreground",children:[e.jsx(T,{label:"Hesap",col:"account",sort:b,setSort:k}),e.jsx(T,{label:"Plan",col:"plan",sort:b,setSort:k}),e.jsx("th",{className:"px-4 py-3 font-semibold",children:"Kullanıcı / Kota"}),e.jsx("th",{className:"px-4 py-3 font-semibold",children:"Atama"})]})}),e.jsx("tbody",{children:j?e.jsx("tr",{children:e.jsx("td",{colSpan:4,className:"px-4 py-10 text-center text-muted-foreground",children:e.jsx(P,{className:"mx-auto h-5 w-5 animate-spin"})})}):o.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:4,className:"px-4 py-10 text-center text-muted-foreground",children:"Kayıt bulunamadı."})}):o.map(r=>{const c=g.get(r.accountId),y=r.maxUsers!=null&&c!=null&&c>r.maxUsers;return e.jsxs("tr",{className:"border-b border-border/60 hover:bg-accent/40",children:[e.jsxs("td",{className:"px-4 py-3",children:[e.jsx("div",{className:"font-medium text-foreground",children:r.accountName||"—"}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["acc ",r.accountId]})]}),e.jsx("td",{className:"px-4 py-3",children:r.planName?e.jsx("span",{className:"rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary",children:r.planName}):e.jsx("span",{className:"text-xs text-muted-foreground",children:"— atanmadı"})}),e.jsxs("td",{className:"px-4 py-3",children:[e.jsx("span",{className:S("tabular-nums",y?"font-semibold text-red-600":"text-foreground"),children:c??"—"}),e.jsxs("span",{className:"text-muted-foreground",children:[" / ",r.maxUsers??"∞"]}
1),y&&e.jsx("span",{className:"ml-2 rounded bg-red-50 px-1.5 py-0.5 text-[10px] font-semibold text-red-600",children:"AŞIM"})]}),e.jsx("td",{className:"px-4 py-3",children:e.jsxs("select",{value:r.planId??0,onChange:N=>w.mutate({accountId:r.accountId,planId:Number(N.target.value)}),disabled:w.isPending,className:"rounded-lg border border-border bg-background px-2 py-1.5 text-sm",children:[e.jsx("option",{value:0,children:"— atama yok"}),f.map(N=>e.jsx("option",{value:N.id,children:N.name},N.id))]})})]},r.accountId)})})]})})}),h.length>0&&e.jsxs("div",{className:"flex items-center justify-between px-1 py-3 text-sm text-muted-foreground",children:[e.jsxs("span",{children:[d*M+1,"–",Math.min(h.length,(d+1)*M)," / ",h.length]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button",disabled:d===0,onClick:()=>m(r=>r-1),className:"rounded-lg border border-border px-2.5 py-1.5 font-medium hover:bg-accent disabled:opacity-40",children:"Önceki"}),e.jsxs("span",{className:"tabular-nums",children:[d+1," / ",v]}),e.jsx("button",{type:"button",disabled:d>=v-1,onClick:()=>m(r=>r+1),className:"rounded-lg border border-border px-2.5 py-1.5 font-medium hover:bg-accent disabled:opacity-40",children:"Sonraki"})]})]})]})}function Za(){const[t,s]=p.useState("plans");return e.jsxs("div",{className:"p-6",children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Planlar & Limitler"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Operatör abonelik planları + hesaba atama. Kota aşımı yalnız gösterilir — hiçbir akış engellenmez."}),e.jsxs("div",{className:"mt-5 flex gap-1 border-b border-border",children:[e.jsxs("button",{type:"button",onClick:()=>s("plans"),className:S("flex items-center gap-2 border-b-2 px-4 py-2.5 text-sm font-medium transition-colors",t==="plans"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:[e.jsx(Ot,{className:"h-4 w-4"})," Planlar"]}),e.jsxs("button",{type:"button",onClick:()=>s("accounts"),className:S("flex items-center gap-2 border-b-2 px-4 py-2.5 text-sm font-medium transition-colors",t==="accounts"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:[e.jsx(ke,{className:"h-4 w-4"})," Hesap Atamaları"]})]}),e.jsx("div",{className:"mt-5",children:t==="plans"?e.jsx(Hs,{}):e.jsx(Ys,{})})]})}class ce{static async list(){var a;const s=await I.get("/SysAdmin/Subscriptions");return((a=s.data)==null?void 0:a.data)??s.data??[]}static async suspend(s,a){await I.post("/SysAdmin/Subscriptions/Suspend",{AccountId:s,Note:a})}static async resume(s,a){await I.post("/SysAdmin/Subscriptions/Resume",{AccountId:s,Note:a})}static async renew(s,a){await I.post("/SysAdmin/Subscriptions/Renew",{AccountId:s,Note:a})}static async history(s){var n;const a=await I.get(`/SysAdmin/Subscriptions/${s}/History`);return((n=a.data)==null?void 0:n.data)??a.data??[]}}function gt(t){if(!t)return"—";const s=new Date(t);return Number.isNaN(s.getTime())?t:s.toLocaleDateString("tr-TR",{day:"2-digit",month:"2-digit",year:"numeric"})}function Us(t){if(!t)return"—";const s=new Date(t);return Number.isNaN(s.getTime())?t:s.toLocaleString("tr-TR",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"})}const Gs={active:{label:"Aktif",cls:"bg-emerald-50 text-emerald-600"},suspended:{label:"Askıda",cls:"bg-amber-50 text-amber-600"},cancelled:{label:"İptal",cls:"bg-gray-100 text-gray-500"}},Qs={assigned:"Atandı",renewed:"Yenilendi",suspended:"Askıya alındı",resumed:"Yeniden açıldı",cancelled:"İptal edildi",updated:"Güncellendi"};function Xa(){const t=$(),{showSuccess:s,showError:a}=z(),[n,l]=p.useState(""),[d,m]=p.useState(0),[x,j]=p.useState(null),{data:i=[],isLoading:g,isFetching:f,refetch:w}=K({queryKey:["sysadmin-subscriptions"],queryFn:()=>ce.list(),staleTime:6e4}),b=D({mutationFn:({kind:y,accountId:N})=>y==="suspend"?ce.suspend(N):y==="resume"?ce.resume(N):ce.renew(N),onSuccess:()=>{t.invalidateQueries({queryKey:["sysadmin-subscriptions"]}),s("save")},onError:y=>a(y)}),k=p.useMemo(()=>{const y=i.filter(C=>C.status==="active").length,N=i.filter(C=>C.status==="suspended").length,L=i.filter(C=>
1C.daysLeft!=null&&C.daysLeft>=0&&C.daysLeft<=30).length,u=i.filter(C=>C.daysLeft!=null&&C.daysLeft<0).length;return{total:i.length,active:y,suspended:N,dueSoon:L,overdue:u}},[i]),[h,o]=p.useState({key:"renews",dir:"asc"}),v=p.useMemo(()=>{const y=n.trim().toLocaleLowerCase("tr"),N=y?i.filter(u=>(u.accountName??"").toLocaleLowerCase("tr").includes(y)||String(u.accountId).includes(y)):i,L=u=>h.key==="account"?u.accountName:h.key==="plan"?u.planName:h.key==="status"?u.status:h.key==="renews"?u.renewsAt?new Date(u.renewsAt):null:u.daysLeft;return[...N].sort((u,C)=>(h.dir==="asc"?1:-1)*q(L(u),L(C)))},[i,n,h]);p.useEffect(()=>m(0),[n]);const r=v.slice(d*M,(d+1)*M),c=Math.max(1,Math.ceil(v.length/M));return e.jsxs("div",{className:"p-6",children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Abonelik & Yenileme"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Abonelikli hesaplar — askıya al / aç / yenile. Yaklaşan ve gecikmiş yenilemeler öne çıkar. (Otomatik hatırlatma yok.)"}),e.jsxs("div",{className:"mt-5 grid grid-cols-2 gap-3 lg:grid-cols-4",children:[e.jsx(ye,{label:"Toplam Abonelik",value:k.total,icon:je,tint:"bg-blue-50 text-blue-600"}),e.jsx(ye,{label:"Aktif",value:k.active,icon:Qe,tint:"bg-emerald-50 text-emerald-600"}),e.jsx(ye,{label:"30 Günde Yenilenecek",value:k.dueSoon,icon:Ht,tint:"bg-amber-50 text-amber-600"}),e.jsx(ye,{label:"Gecikmiş",value:k.overdue,icon:Yt,tint:"bg-red-50 text-red-600"})]}),e.jsxs("div",{className:"mb-4 mt-5 flex flex-wrap items-center gap-3",children:[e.jsx("input",{type:"text",value:n,onChange:y=>l(y.target.value),placeholder:"Hesap adı / ID ara...",className:"w-full max-w-sm rounded-lg border border-border bg-background px-3 py-2 text-sm"}),e.jsxs("button",{type:"button",onClick:()=>w(),className:"ml-auto flex items-center gap-2 rounded-lg border border-border px-3 py-2 text-sm font-medium text-foreground/80 hover:bg-accent",children:[e.jsx(R,{className:S("h-4 w-4",f&&"animate-spin")}),"Yenile"]})]}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-background",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border bg-muted/30 text-left text-xs uppercase tracking-wide text-muted-foreground",children:[e.jsx(T,{label:"Hesap",col:"account",sort:h,setSort:o}),e.jsx(T,{label:"Plan",col:"plan",sort:h,setSort:o}),e.jsx(T,{label:"Durum",col:"status",sort:h,setSort:o,align:"center"}),e.jsx(T,{label:"Yenileme",col:"renews",sort:h,setSort:o}),e.jsx(T,{label:"Kalan",col:"daysLeft",sort:h,setSort:o,align:"right"}),e.jsx("th",{className:"px-4 py-3 text-right font-semibold",children:"İşlem"})]})}),e.jsx("tbody",{children:g?e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"px-4 py-10 text-center text-muted-foreground",children:e.jsx(P,{className:"mx-auto h-5 w-5 animate-spin"})})}):r.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"px-4 py-10 text-center text-muted-foreground",children:"Abonelikli hesap yok. (Önce Planlar > Hesap Atamaları'ndan plan atayın.)"})}):r.map(y=>{const N=Gs[y.status??""]??{label:y.status??"—",cls:"bg-gray-100 text-gray-500"},L=y.daysLeft!=null&&y.daysLeft<0,u=y.daysLeft!=null&&y.daysLeft>=0&&y.daysLeft<=30,C=b.isPending;return e.jsxs("tr",{className:"border-b border-border/60 hover:bg-accent/40",children:[e.jsxs("td",{className:"px-4 py-3",children:[e.jsx("div",{className:"font-medium text-foreground",children:y.accountName||"—"}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["acc ",y.accountId]})]}),e.jsx("td",{className:"px-4 py-3",children:y.planName?e.jsx("span",{className:"rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary",children:y.planName}):"—"}),e.jsx("td",{className:"px-4 py-3 text-center",children:e.jsx("span",{className:S("rounded-full px-2 py-0.5 text-xs font-medium",N.cls),children:N.label})}),e.jsx("td",{className:"whitespace-nowrap px-4 py-3 text-muted-foreground",children:gt(y.renewsAt)}),e.jsx("td",{className:"px-4 py-3 text-right",children:y.daysLeft==null?e.jsx("span",{className:"text-muted-foreground",children:"—"}):e.jsx("span",{className:S("tabular-nums font-medium",L?"text-red-600":u?"text-amber-600":"text-foreground"),children:L?`${Math.abs(y.daysLeft)} gün gecikmiş`:`${y.daysLeft} gün`})}),e.jsx("td",{className:"px-4 py-3",children:e.jsxs("div",{className:"flex justify-end gap-1",children:[e.jsx("button",{type:"button",disabled:C,onClick:()=>b.mutate({kind:"renew",accountId:y.accountId}),title:"Yenile",className:"rounded-md border border-border p-1.5 text-emerald-600 hover:bg-emerald-50 disabled:opacity-50",children:e.jsx(Ut,{className:"h-3.5 w-3.5"})}),y.status==="suspended"?e.jsx("button",{type:"button",disabled:C,onClick:()=>b.mutate({kind:"resume",accountId:y.accountId}),title:"Yeniden aç",className:"rounded-md border border-border p-1.5 text-emerald-600 hover:bg-emerald-50 disabled:opacity-50",children:e.jsx(Qe,{className:"h-3.5 w-3.5"})}):e.jsx("button",{type:"button",disabled:C,onClick:()=>b.mutate({kind:"suspend",accountId:y.accountId}),title:"Askıya al",className:"rounded-md border border-border p-1.5 text-amber-600 hover:bg-amber-50 disabled:opacity-50",children:e.jsx(Gt,{className:"h-3.5 w-3.5"})}),e.jsx("button",{type:"button",onClick:()=>j(y),title:"Tarihçe",className:"rounded-md border border-border p-1.5 text-foreground
1/70 hover:bg-accent",children:e.jsx(ct,{className:"h-3.5 w-3.5"})})]})})]},y.accountId)})})]})})}),v.length>0&&e.jsxs("div",{className:"flex items-center justify-between px-1 py-3 text-sm text-muted-foreground",children:[e.jsxs("span",{children:[d*M+1,"–",Math.min(v.length,(d+1)*M)," / ",v.length]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{type:"button",disabled:d===0,onClick:()=>m(y=>y-1),className:"flex items-center gap-1 rounded-lg border border-border px-2.5 py-1.5 font-medium hover:bg-accent disabled:opacity-40",children:[e.jsx(J,{className:"h-4 w-4"}),"Önceki"]}),e.jsxs("span",{className:"tabular-nums",children:[d+1," / ",c]}),e.jsxs("button",{type:"button",disabled:d>=c-1,onClick:()=>m(y=>y+1),className:"flex items-center gap-1 rounded-lg border border-border px-2.5 py-1.5 font-medium hover:bg-accent disabled:opacity-40",children:["Sonraki",e.jsx(Y,{className:"h-4 w-4"})]})]})]}),x&&e.jsx(_s,{sub:x,onClose:()=>j(null)})]})}function ye({label:t,value:s,icon:a,tint:n}){return e.jsxs("div",{className:"flex items-center gap-3 rounded-xl border border-border bg-background px-4 py-3",children:[e.jsx("span",{className:S("inline-flex h-10 w-10 items-center justify-center rounded-lg",n),children:e.jsx(a,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xl font-bold tabular-nums text-foreground",children:s}),e.jsx("div",{className:"text-xs text-muted-foreground",children:t})]})]})}function _s({sub:t,onClose:s}){const{data:a=[],isLoading:n}=K({queryKey:["sysadmin-subscription-history",t.accountId],queryFn:()=>ce.history(t.accountId),staleTime:0});return e.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-end bg-black/30",onClick:s,children:e.jsxs("div",{className:"h-full w-full max-w-lg overflow-y-auto bg-background p-6 shadow-2xl",onClick:l=>l.stopPropagation(),children:[e.jsxs("div",{className:"mb-1 flex items-start justify-between gap-4",children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:t.accountName}),e.jsx("button",{type:"button",onClick:s,className:"rounded-md border border-border px-2 py-1 text-sm hover:bg-accent",children:"Kapat"})]}),e.jsxs("p",{className:"mb-4 text-xs text-muted-foreground",children:["acc ",t.accountId," · abonelik geçmişi"]}),n?e.jsx(P,{className:"h-5 w-5 animate-spin text-muted-foreground"}):a.length===0?e.jsx("div",{className:"rounded-lg border border-dashed border-border p-6 text-center text-sm text-muted-foreground",children:"Kayıt yok."}):e.jsx("div",{className:"space-y-2",children:a.map(l=>e.jsxs("div",{className:"rounded-lg border border-border/60 px-3 py-2 text-sm",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{className:"font-medium text-foreground",children:Qs[l.eventType??""]??l.eventType}),e.jsx("span",{className:"whitespace-nowrap text-xs text-muted-foreground",children:Us(l.createdAt)})]}),e.jsxs("div",{className:"mt-0.5 text-xs text-muted-foreground",children:[l.oldStatus&&l.newStatus&&l.oldStatus!==l.newStatus?`${l.oldStatus} → ${l.newStatus}`:l.newStatus,l.renewsAtAfter&&l.renewsAtBefore!==l.renewsAtAfter?` · yenileme: ${gt(l.renewsAtAfter)}`:"",l.note?` · ${l.note}`:""]})]},l.id))})]})})}class De{static async search(s){var n;return((n=(await I.get(`/SysAdmin/Kvkk/Search?q=${encodeURIComponent(s)}`)).data)==null?void 0:n.data)??[]}static async exportMember(s){var n;const a=await I.get(`/SysAdmin/Kvkk/Export/${s}`);return((n=a.data)==null?void 0:n.data)??a.data}static async log(){var a;return((a=(await I.get("/SysAdmin/Kvkk/Log")).data)==null?void 0:a.data)??[]}}function Vs(t){if(!t)return"—";const s=new Date(t);return Number.isNaN(s.getTime())?t:s.toLocaleString("tr-TR",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"})}function Ws(){const{showError:t,showSuccess:s}=z(),[a,n]=p.useState(""),[l,d]=p.useState(""),[m,x]=p.useState(null),[j,i]=p.useState(null),[g,f]=p.useState(!1),{data:w=[],isFetching:b}=K({queryKey:["sysadmin-kvkk-search",l],queryFn:()=>De.search(l),enabled:l.trim().length>=3,staleTime:3e4}),k=async o=>{x(o),i(null),f(!0);try{const v=await De.exportMember(o.memberId);i(v)}catch(v){t(v)}finally{f(!1)}},h=()=>
1{if(!j||!m)return;const o=new Blob([JSON.stringify(j,null,2)],{type:"application/json"}),v=URL.createObjectURL(o),r=document.createElement("a");r.href=v,r.download=`kvkk-${m.memberId}-${(m.email??"kisi").replace(/[^a-z0-9]/gi,"_")}.json`,r.click(),URL.revokeObjectURL(v),s("save")};return e.jsxs("div",{className:"grid gap-5 lg:grid-cols-2",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(se,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx("input",{value:a,onChange:o=>n(o.target.value),onKeyDown:o=>o.key==="Enter"&&d(a),placeholder:"E-posta / TC / ad-soyad (en az 3 karakter)",className:"w-full rounded-lg border border-border bg-background py-2 pl-9 pr-3 text-sm"})]}),e.jsx("button",{type:"button",onClick:()=>d(a),className:"rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:opacity-90",children:"Ara"})]}),e.jsx("div",{className:"mt-3 space-y-1.5",children:l.trim().length>=3&&b?e.jsx("div",{className:"py-6 text-center text-muted-foreground",children:e.jsx(P,{className:"mx-auto h-5 w-5 animate-spin"})}):l.trim().length>=3&&w.length===0?e.jsx("div",{className:"rounded-lg border border-dashed border-border p-6 text-center text-sm text-muted-foreground",children:"Kişi bulunamadı."}):w.map(o=>e.jsxs("button",{type:"button",onClick:()=>k(o),className:S("flex w-full items-center justify-between gap-3 rounded-lg border px-3 py-2 text-left text-sm transition-colors",(m==null?void 0:m.memberId)===o.memberId?"border-primary bg-primary/5":"border-border hover:bg-accent"),children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate font-medium text-foreground",children:[o.name,o.surname].filter(Boolean).join(" ")||o.email||`#${o.memberId}`}),e.jsxs("div",{className:"truncate text-xs text-muted-foreground",children:[o.email," · ",o.accountName??`acc ${o.accountId}`]})]}),!o.isActive&&e.jsx("span",{className:"shrink-0 rounded bg-gray-100 px-1.5 py-0.5 text-[10px] text-gray-500",children:"pasif"})]},o.memberId))})]}),e.jsx("div",{children:m?e.jsxs("div",{className:"rounded-xl border border-border bg-background p-4",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate font-semibold text-foreground",children:[m.name,m.surname].filter(Boolean).join(" ")||m.email}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["member #",m.memberId]})]}),e.jsxs("button",{type:"button",onClick:h,disabled:!j||g,className:"flex items-center gap-2 rounded-lg bg-primary px-3 py-2 text-sm font-medium text-primary-foreground hover:opacity-90 disabled:opacity-50",children:[e.jsx(_t,{className:"h-4 w-4"})," JSON indir"]})]}),g?e.jsx("div",{className:"py-10 text-center text-muted-foreground",children:e.jsx(P,{className:"mx-auto h-5 w-5 animate-spin"})}):j?e.jsx("pre",{className:"max-h-[420px] overflow-auto rounded-lg bg-muted/40 p-3 text-[11px] leading-relaxed",children:JSON.stringify(j,null,2)}):null]}):e.jsx("div",{className:"flex h-full min-h-[200px] items-center justify-center rounded-xl border border-dashed border-border p-8 text-center text-sm text-muted-foreground",children:e.jsxs("div",{children:[e.jsx(Qt,{className:"mx-auto mb-2 h-8 w-8 opacity-40"}),"Soldan bir kişi seçin — kişisel veri paketi burada görünür."]})})})]})}function Js(){const[t,s]=p.useState(""),[a,n]=p.useState(0),[l,d]=p.useState({key:"date",dir:"desc"}),{data:m=[],isLoading:x,isFetching:j,refetch:i}=K({queryKey:["sysadmin-kvkk-log"],queryFn:()=>De.log(),staleTime:3e4}),g=p.useMemo(()=>{const w=t.trim().toLocaleLowerCase("tr"),b=w?m.filter(h=>[h.memberEmail,h.exportedByName].some(o=>(o??"").toLocaleLowerCase("tr").includes(w))||String(h.memberId).includes(w)):m,k=h=>l.key==="date"?new Date(h.exportedAt):l.key==="by"?h.exportedByName:l.key==="member"?h.memberId:h.accountId;return[...b].sort((h,o)=>(l.dir==="asc"?1:-1)*q(k(h),k(o)))},[m,t,l]);p.useEffect(()=>n(0),[t]);
1const f=g.slice(a*M,(a+1)*M);return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-4 flex flex-wrap items-center gap-3",children:[e.jsx("input",{type:"text",value:t,onChange:w=>s(w.target.value),placeholder:"E-posta / aktaran / member ara...",className:"w-full max-w-sm rounded-lg border border-border bg-background px-3 py-2 text-sm"}),e.jsxs("button",{type:"button",onClick:()=>i(),className:"ml-auto flex items-center gap-2 rounded-lg border border-border px-3 py-2 text-sm font-medium text-foreground/80 hover:bg-accent",children:[e.jsx(R,{className:S("h-4 w-4",j&&"animate-spin")})," Yenile"]})]}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-background",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border bg-muted/30 text-left text-xs uppercase tracking-wide text-muted-foreground",children:[e.jsx(T,{label:"Tarih",col:"date",sort:l,setSort:d}),e.jsx(T,{label:"Aktaran",col:"by",sort:l,setSort:d}),e.jsx(T,{label:"Kişi (member)",col:"member",sort:l,setSort:d}),e.jsx("th",{className:"px-4 py-3 font-semibold",children:"E-posta"}),e.jsx(T,{label:"Hesap",col:"account",sort:l,setSort:d})]})}),e.jsx("tbody",{children:x?e.jsx("tr",{children:e.jsx("td",{colSpan:5,className:"px-4 py-10 text-center text-muted-foreground",children:e.jsx(P,{className:"mx-auto h-5 w-5 animate-spin"})})}):f.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:5,className:"px-4 py-10 text-center text-muted-foreground",children:"Henüz export yapılmadı."})}):f.map(w=>e.jsxs("tr",{className:"border-b border-border/60 hover:bg-accent/40",children:[e.jsx("td",{className:"whitespace-nowrap px-4 py-3 text-muted-foreground",children:Vs(w.exportedAt)}),e.jsx("td",{className:"px-4 py-3 text-foreground",children:w.exportedByName||`#${w.exportedBy}`}),e.jsxs("td",{className:"px-4 py-3 tabular-nums text-muted-foreground",children:["#",w.memberId]}),e.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:w.memberEmail||"—"}),e.jsx("td",{className:"px-4 py-3 tabular-nums text-muted-foreground",children:w.accountId??"—"})]},w.id))})]})})}),e.jsx(ne,{page:a,total:g.length,onPage:n})]})}function er(){const[t,s]=p.useState("export");return e.jsxs("div",{className:"p-6",children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Yedek & KVKK"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"KVKK kişisel veri export'u (erişim/taşınabilirlik hakkı) + export izi. Salt-okuma — silme yok, şifre aktarılmaz."}),e.jsxs("div",{className:"mt-5 flex gap-1 border-b border-border",children:[e.jsxs("button",{type:"button",onClick:()=>s("export"),className:S("flex items-center gap-2 border-b-2 px-4 py-2.5 text-sm font-medium transition-colors",t==="export"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:[e.jsx($e,{className:"h-4 w-4"})," Kişisel Veri Export"]}),e.jsxs("button",{type:"button",onClick:()=>s("log"),className:S("flex items-center gap-2 border-b-2 px-4 py-2.5 text-sm font-medium transition-colors",t==="log"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:[e.jsx(ct,{className:"h-4 w-4"})," Export İzi"]})]}),e.jsx("div",{className:"mt-5",children:t==="export"?e.jsx(Ws,{}):e.jsx(Js,{})})]})}function Le(t){return t?t.replace(/<[^>]*>/g," ").replace(/&nbsp;/g," ").replace(/\s+/g," ").trim():""}const ht={info:{label:"Bilgi",cls:"bg-blue-50 text-blue-600"},maintenance:{label:"Bakım",cls:"bg-amber-50 text-amber-600"},feature:{label:"Özellik",cls:"bg-violet-50 text-violet-600"},changelog:{label:"Changelog",cls:"bg-emerald-50 text-emerald-600"}};function rt(t){if(!t)return"—";const s=new Date(t);return Number.isNaN(s.getTime())?t:s.toLocaleDateString("tr-TR",{day:"2-digit",month:"2-digit",year:"numeric"})}function nt(t){if(!t)return"";const s=new Date(t);if(Number.isNaN(s.getTime()))return"";const a=n=>String(n).padStart(2,"0");return`${s.getFullYear()}-${a(s.getMonth()+1)}-${a(s.getDate())}T${a(s.getHours())}:${a(s.getMinutes())}`}function Zs({item:t,onClose:s,onSubmit:a,isLoading:n}){const l=p.useMemo(()=>
1{if(!(t!=null&&t.targetAccountsJson))return[];try{return JSON.parse(t.targetAccountsJson)}catch{return[]}},[t]),[d,m]=p.useState(t?{Title:t.title,Body:t.body,Type:t.type,TargetScope:t.targetScope,TargetAccountIds:l,StartsAt:t.startsAt,EndsAt:t.endsAt,IsActive:t.isActive}:{Title:"",Body:"",Type:"info",TargetScope:"all",TargetAccountIds:[],StartsAt:null,EndsAt:null,IsActive:!0}),[x,j]=p.useState(""),{data:i=[]}=K({queryKey:["sysadmin-dashboard-accounts"],queryFn:()=>ve.getStats(),staleTime:5*6e4,select:b=>[...b.accounts??[]].sort((k,h)=>(k.name??"").localeCompare(h.name??"","tr"))}),g=p.useMemo(()=>{const b=x.trim().toLocaleLowerCase("tr");return b?i.filter(k=>(k.name??"").toLocaleLowerCase("tr").includes(b)||String(k.id).includes(b)):i},[i,x]),f=b=>{const k=d.TargetAccountIds??[];m({...d,TargetAccountIds:k.includes(b)?k.filter(h=>h!==b):[...k,b]})},w=()=>{d.Title.trim()&&a({...d,Title:d.Title.trim(),StartsAt:d.StartsAt||null,EndsAt:d.EndsAt||null,TargetAccountIds:d.TargetScope==="accounts"?d.TargetAccountIds:[]})};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4",onClick:s,children:e.jsxs("div",{className:"flex max-h-[92vh] w-full max-w-5xl flex-col overflow-hidden rounded-2xl bg-background shadow-2xl",onClick:b=>b.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-border px-6 py-4",children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:t?"Duyuru Düzenle":"Yeni Duyuru"}),e.jsx("button",{type:"button",onClick:s,className:"rounded-md border border-border p-1.5 text-muted-foreground hover:bg-accent",children:e.jsx(_e,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-3 border-b border-border px-6 py-4 md:grid-cols-2",children:[e.jsxs("label",{className:"block md:col-span-2",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Başlık *"}),e.jsx("input",{value:d.Title,onChange:b=>m({...d,Title:b.target.value}),className:"mt-1 w-full rounded-lg border border-border bg-background px-3 py-2 text-sm"})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Tip"}),e.jsx("select",{value:d.Type,onChange:b=>m({...d,Type:b.target.value}),className:"mt-1 w-full rounded-lg border border-border bg-background px-3 py-2 text-sm",children:Object.entries(ht).map(([b,k])=>e.jsx("option",{value:b,children:k.label},b))})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Hedef"}),e.jsxs("select",{value:d.TargetScope,onChange:b=>m({...d,TargetScope:b.target.value}),className:"mt-1 w-full rounded-lg border border-border bg-background px-3 py-2 text-sm",children:[e.jsx("option",{value:"all",children:"Tüm hesaplar"}),e.jsx("option",{value:"accounts",children:"Belirli hesaplar"})]})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Başlangıç (ops.)"}),e.jsx("input",{type:"datetime-local",value:nt(d.StartsAt),onChange:b=>m({...d,StartsAt:b.target.value?new Date(b.target.value).toISOString():null}),className:"mt-1 w-full rounded-lg border border-border bg-background px-3 py-2 text-sm"})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Bitiş (ops.)"}),e.jsx("input",{type:"datetime-local",value:nt(d.EndsAt),onChange:b=>m({...d,EndsAt:b.target.value?new Date(b.target.value).toISOString():null}),className:"mt-1 w-full rounded-lg border border-border bg-background px-3 py-2 text-sm"})]}),d.TargetScope==="accounts"&&e.jsxs("div",{className:"rounded-lg border border-border p-2 md:col-span-2",children:[e.jsx("input",{value:x,onChange:b=>j(b.target.value),placeholder:"Hesap ara...",className:"mb-2 w-full rounded-md border border-border bg-background px-2 py-1.5 text-sm"}),e.jsx("div",{className:"grid max-h-32 grid-cols-2 gap-x-3 gap-y-0.5 overflow-y-auto",children:g.map(b=>e.jsxs("label",{className:"flex items-center gap-2 rounded px-1.5 py-1 text-sm hover:bg-accent",children:[e.jsx("input",{type:"checkbox",checked:(d.TargetAccountIds??[]).includes(b.id),onChange:()=>f(b.id)}),e.jsxs("span",{className:"truncate",children:[b.name," ",e.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",b.id,")"]})]})]},b.id))}),e.jsxs("div",{className:"mt-1 text-[11px] text-muted-foreground",children:[(d.TargetAccountIds??[]).length," hesap seçili"]})]})]}),e.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-1 gap-0 overflow-hidden lg:grid-cols-2",children:[e.jsxs("div",{className:"flex min-h-0 flex-col overflow-y-auto border-b border-border p-6 lg:border-b-0 lg:border-r",children:[e.jsx("span",{className:"mb-1.5 text-xs font-medium text-muted-foreground",children:"İçerik"}),e.jsx(Jt,{value:d.Body??"",onChange:b=>m({...d,Body:b}),variant:"modal"})]}),e.jsxs("div",{className:"flex min-h-0 flex-col overflow-y-auto bg-muted/20 p-6",children:[e.jsx("span",{className:"mb-1.5 text-xs font-medium text-muted-foreground",children:"Önizleme — hesap yöneticileri şunu görecek:"}),(()=>{var h;const b=Ve[d.Type]??Ve.info,k=b.icon;return e.jsxs("div",{className:S("flex items-start gap-3 rounded-lg border px-4 py-2.5 text-sm",b.cls),children:[e.jsx(k,{className:"mt-0.5 h-4 w-4 shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"font-semibold",children:d.Title.trim()||"Başlık…"}),(h=d.Body)!=null&&h.trim()?e.jsx("div",{className:"broadcast-body mt-0.5 text-[13px] opacity-90",dangerouslySetInnerHTML:{__html:Zt(d.Body)}}):e.jsx("div",{className:"mt-0.5 text-[13px] italic opacity-50",children:"İçerik…"})]}),e.jsx(_e,{className:"h-4 w-4 shrink-0 opacity-70"})]})})(),e.jsx("p",{className:"mt-3 text-[11px] text-muted-foreground",children:"Mail/SMS gönderilmez — yalnız panel içi banner. Yazdıkça önizleme canlı güncellenir."})]})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3 border-t border-border px-6 py-4",children:[e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",checked:d.IsActive,onChange:b=>m({...d,IsActive:b.target.checked})}),e.jsx("span",{className:"text-sm text-foreground",children:"Aktif (yayında)"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"button",onClick:s,className:"rounded-lg border border-border px-4 py-2 text-sm hover:bg-accent",children:"İptal"}),e.jsxs("button",{type:"button",onClick:w,disabled:n||!d.Title.trim(),className:"flex items-center gap-2 rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:opacity-90 disabled:opacity-50",children:[n&&e.jsx(P,{className:"h-4 w-4 animate-spin"}),"Kaydet"]})]})]})]})})}function tr(){const t=$(),{showSuccess:s,showError:a}=z(),[n,l]=p.useState({open:!1,item:null}),[d,m]=p.useState(""),[x,j]=p.useState(0),[i,g]=p.useState({key:"date",dir:"desc"}),{data:f=[],isLoading:w,isFetching:b,refetch:k}=K({queryKey:["sysadmin-broadcasts"],queryFn:()=>ge.list(),staleTime:6e4}),h=p.useMemo(()=>{const N=d.trim().toLocaleLowerCase("tr"),L=N?f.filter(C=>C.title.toLocaleLowerCase("tr").includes(N)||Le(C.body).toLocaleLowerCase("tr").includes(N)):f,u=C=>i.key==="title"?C.title:i.key==="type"?C.type:i.key==="target"?C.targetScope:i.key==="date"?C.startsAt?new Date(C.startsAt):C.createdAt?new Date(C.createdAt):null:i.key==="reads"?C.readCount:C.isActive?1:0;return[...L].sort((C,A)=>(i.dir==="asc"?1:-1)*q(u(C),u(A)))},[f,d,i]);p.useEffect(()=>j(0),[d]);
1const o=h.slice(x*M,(x+1)*M),v=()=>t.invalidateQueries({queryKey:["sysadmin-broadcasts"]}),r=D({mutationFn:N=>ge.create(N),onSuccess:()=>{v(),l({open:!1,item:null}),s("save")},onError:N=>a(N)}),c=D({mutationFn:({id:N,d:L})=>ge.update(N,L),onSuccess:()=>{v(),l({open:!1,item:null}),s("save")},onError:N=>a(N)}),y=D({mutationFn:N=>ge.deactivate(N),onSuccess:()=>{v(),s("save")},onError:N=>a(N)});return e.jsxs("div",{className:"p-6",children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Duyurular"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Platform duyurusu → hesap yöneticilerine in-app banner + okundu izi. Mail/SMS gönderilmez."}),e.jsxs("div",{className:"mb-4 mt-5 flex flex-wrap items-center gap-3",children:[e.jsxs("button",{type:"button",onClick:()=>l({open:!0,item:null}),className:"flex items-center gap-2 rounded-lg bg-primary px-3 py-2 text-sm font-medium text-primary-foreground hover:opacity-90",children:[e.jsx(ze,{className:"h-4 w-4"})," Yeni Duyuru"]}),e.jsx("input",{type:"text",value:d,onChange:N=>m(N.target.value),placeholder:"Duyuru ara (başlık/içerik)...",className:"w-full max-w-xs rounded-lg border border-border bg-background px-3 py-2 text-sm"}),e.jsxs("button",{type:"button",onClick:()=>k(),className:"ml-auto flex items-center gap-2 rounded-lg border border-border px-3 py-2 text-sm font-medium text-foreground/80 hover:bg-accent",children:[e.jsx(R,{className:S("h-4 w-4",b&&"animate-spin")})," Yenile"]})]}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-background",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border bg-muted/30 text-left text-xs uppercase tracking-wide text-muted-foreground",children:[e.jsx(T,{label:"Duyuru",col:"title",sort:i,setSort:g}),e.jsx(T,{label:"Tip",col:"type",sort:i,setSort:g}),e.jsx(T,{label:"Hedef",col:"target",sort:i,setSort:g}),e.jsx(T,{label:"Tarih",col:"date",sort:i,setSort:g}),e.jsx(T,{label:"Okunma",col:"reads",sort:i,setSort:g,align:"right"}),e.jsx(T,{label:"Durum",col:"status",sort:i,setSort:g,align:"center"}),e.jsx("th",{className:"px-4 py-3 text-right font-semibold",children:"İşlem"})]})}),e.jsx("tbody",{children:w?e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"px-4 py-10 text-center text-muted-foreground",children:e.jsx(P,{className:"mx-auto h-5 w-5 animate-spin"})})}):o.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"px-4 py-10 text-center text-muted-foreground",children:"Henüz duyuru yok."})}):o.map(N=>{const L=ht[N.type]??{label:N.type,cls:"bg-gray-100 text-gray-500"};return e.jsxs("tr",{className:"border-b border-border/60 hover:bg-accent/40",children:[e.jsxs("td",{className:"max-w-[280px] px-4 py-3",children:[e.jsx("div",{className:"truncate font-medium text-foreground",children:N.title}),Le(N.body)&&e.jsx("div",{className:"truncate text-xs text-muted-foreground",children:Le(N.body)})]}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("span",{className:S("rounded-full px-2 py-0.5 text-xs font-medium",L.cls),children:L.label})}),e.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:N.targetScope==="all"?"Tüm hesaplar":"Belirli hesaplar"}),e.jsxs("td",{className:"whitespace-nowrap px-4 py-3 text-muted-foreground",children:[rt(N.startsAt),N.endsAt?` – ${rt(N.endsAt)}`:""]}),e.jsx("td",{className:"px-4 py-3 text-right",children:e.jsxs("span",{className:"inline-flex items-center gap-1 tabular-nums text-muted-foreground",children:[e.jsx(Vt,{className:"h-3.5 w-3.5"}),N.readCount]})}),e.jsx("td",{className:"px-4 py-3 text-center",children:e.jsx("span",{className:S("rounded-full px-2 py-0.5 text-xs font-medium",N.isActive?"bg-emerald-50 text-emerald-600":"bg-gray-100 text-gray-500"),children:N.isActive?"Yayında":"Pasif"})}),e.jsx("td",{className:"px-4 py-3",children:e.jsxs("div",{className:"flex justify-end gap-1",children:[e.jsx("button",{type:"button",onClick:()=>l({open:!0,item:N}),className:"rounded-md border border-border p-1.5 hover:bg-accent",title:"Düzenle",children:e.jsx(re,{className:"h-3.5 w-3.5"})}),N.isActive&&e.jsx("button",{type:"button",onClick:()=>y.mutate(N.id),disabled:y.isPending,className:"rounded-md border border-border p-1.5 text-red-500 hover:bg-red-50 disabled:opacity-50",title:"Pasife al",children:e.jsx(Be,{className:"h-3.5 w-3.5"})})]})})]},N.id)})})]})})}),e.jsx(ne,{page:x,total:h.length,onPage:j}),f.length===0&&!w&&e.jsxs("div",{className:"mt-3 flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(Wt,{className:"h-3.5 w-3.5"})," Duyuru oluşturun; hesap yöneticileri panele girince banner görür."]}),n.open&&e.jsx(Zs,{item:n.item,onClose:()=>l({open:!1,item:null}),onSubmit:N=>n.item?c.mutate({id:n.item.id,d:N}):r.mutate(N),isLoading:r.isPending||c.isPending})]})}class Ie{static async list(){var a;const s=await I.get("/SysAdmin/Publications");return((a=s.data)==null?void 0:a.data)??s.data??[]}static async toggle(s,a){const n=s==="catalog"?"AddCatalog":s==="podcast"?"AddPodcast":"AddPacket";await I.post(`/Account/${n}?accountId=${a}`)}static async setContentAuto(s,a){await I.post("/SysAdmin/CatalogContentAuto",{accountId:s,enabled:a})}}const Me={catalog:{label:"Katalog",icon:ts},podcast:{label:"Podcast",icon:es},packet:{label:"Paket",icon:Pe},contentAuto:{label:"İçerik aboneliği",icon:Xt}};function Xs({on:t,busy:s,onClick:a}){return e.jsxs("button",{type:"button",onClick:a,disabled:s,className:S("relative inline-flex h-6 w-11 items-center rounded-full transition-colors disabled:opacity-50",t?"bg-emerald-500":"bg-gray-300 dark:bg-gray-600"),title:t?"Yayında — kapatmak için tıkla":"Kapalı — açmak için tıkla",children:[e.jsx("span",{className:S("inline-block h-4 w-4 transform rounded-full bg-white transition-transform",t?"translate-x-6":"translate-x-1")}),s&&e.jsx(P,{className:"absolute -right-5 h-3.5 w-3.5 animate-spin text-muted-foreground"})]})}function sr(){const t=$(),{showSuccess:s,showError:a}=z(),[n,l]=p.useState(""),[d,m]=p.useState(0),[x,j]=p.useState(null),[i,g]=p.useState(null),{data:f=[],isLoading:w,isFetching:b,refetch:k}=K({queryKey:["sysadmin-publications"],queryFn:()=>Ie.list(),staleTime:6e4}),h=D({mutationFn:({kind:u,accountId:C,turnOn:A})=>u==="contentAuto"?Ie.setContentAuto(C,A):Ie.toggle(u,C),onSuccess:()=>{t.invalidateQueries({queryKey:["sysadmin-publications"]}),s("save")},onError:u=>a(u),onSettled:()=>g(null)}),o=()=>{x&&(g(`${x.row.accountId}-${x.kind}`),h.mutate({kind:x.kind,accountId:x.row.accountId,turnOn:x.turnOn}),j(null))},[v,r]=p.useState({key:"account",dir:"asc"}),c=p.useMemo(()=>{const u=n.trim().toLocaleLowerCase("tr"),C=u?f.filter(E=>(E.accountName??"").toLocaleLowerCase("tr").includes(u)||String(E.accountId).includes(u)):f,A=E=>v.key==="account"?E.accountName:v.key==="catalog"?E.isCatalog?1:0:v.key==="podcast"?E.isPodcast?1:0:v.key==="packet"?E.isPacket?1:0:v.key==="contentAuto"?E.isContentAuto?1:0:E.isActive?1:0;return[...C].sort((E,F)=>(v.dir==="asc"?1:-1)*q(A(E),A(F)))},[f,n,v]);p.useEffect(()=>m(0),[n]);const y=c.slice(d*M,(d+1)*M),N=Math.max(1,Math.ceil(c.length/M)),L=(u,C,A)=>{const E=`${u.accountId}-${C}`;return e.jsx(Xs,{on:A,busy:i===E,onClick:()=>j({row:u,kind:C,turnOn:!A})})};return e.jsxs("div",{className:"p-6",children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Yayınlamalar"}),e.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:["Hesap başına genel katalog / podcast / paket yayını. Açınca hesabın kataloğuna toplu eklenir — kullanıcıya atama/mail YOK.",e.jsx("br",{}),e.jsx("b",{children:"İçerik (oto)"}),": açık hesaplara katalogdaki kütüphane ve video kalemleri her gece 02:20'de kendiliğinden düşer. Bağlantı, podcast ve makale bu kapsamda ",e.jsx("b",{children:"değildir"}),"."]}),e.jsxs("div",{className:"mb-4 mt-5 flex flex-wrap items-center gap-3",children:[e.jsx("input",{type:"text",value:n,onChange:u=>l(u.target.value),placeholder:"Hesap adı / ID ara...",className:"w-full max-w-sm rounded-lg border border-border bg-background px-3 py-2 text-sm"}),e.jsxs("button",{type:"button",onClick:()=>k(),className:"ml-auto flex items-center gap-2 rounded-lg border border-border px-3 py-2 text-sm font-medium text-foreground
1/80 hover:bg-accent",children:[e.jsx(R,{className:S("h-4 w-4",b&&"animate-spin")})," Yenile"]})]}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-background",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border bg-muted/30 text-left text-xs uppercase tracking-wide text-muted-foreground",children:[e.jsx(T,{label:"Hesap",col:"account",sort:v,setSort:r}),e.jsx(T,{label:"Katalog",col:"catalog",sort:v,setSort:r,align:"center"}),e.jsx(T,{label:"Podcast",col:"podcast",sort:v,setSort:r,align:"center"}),e.jsx(T,{label:"Paket",col:"packet",sort:v,setSort:r,align:"center"}),e.jsx(T,{label:"İçerik (oto)",col:"contentAuto",sort:v,setSort:r,align:"center"}),e.jsx(T,{label:"Durum",col:"status",sort:v,setSort:r,align:"center"})]})}),e.jsx("tbody",{children:w?e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"px-4 py-10 text-center text-muted-foreground",children:e.jsx(P,{className:"mx-auto h-5 w-5 animate-spin"})})}):y.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"px-4 py-10 text-center text-muted-foreground",children:"Kayıt bulunamadı."})}):y.map(u=>e.jsxs("tr",{className:"border-b border-border/60 hover:bg-accent/40",children:[e.jsxs("td",{className:"px-4 py-3",children:[e.jsx("div",{className:"font-medium text-foreground",children:u.accountName||"—"}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["acc ",u.accountId]})]}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("div",{className:"flex justify-center",children:L(u,"catalog",u.isCatalog)})}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("div",{className:"flex justify-center",children:L(u,"podcast",u.isPodcast)})}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("div",{className:"flex justify-center",children:L(u,"packet",u.isPacket)})}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("div",{className:"flex justify-center",children:L(u,"contentAuto",u.isContentAuto)})}),e.jsx("td",{className:"px-4 py-3 text-center",children:e.jsx("span",{className:S("rounded-full px-2 py-0.5 text-xs font-medium",u.isActive?"bg-emerald-50 text-emerald-600":"bg-gray-100 text-gray-500"),children:u.isActive?"Aktif":"Pasif"})})]},u.accountId))})]})})}),c.length>0&&e.jsxs("div",{className:"flex items-center justify-between px-1 py-3 text-sm text-muted-foreground",children:[e.jsxs("span",{children:[d*M+1,"–",Math.min(c.length,(d+1)*M)," / ",c.length]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{type:"button",disabled:d===0,onClick:()=>m(u=>u-1),className:"flex items-center gap-1 rounded-lg border border-border px-2.5 py-1.5 font-medium hover:bg-accent disabled:opacity-40",children:[e.jsx(J,{className:"h-4 w-4"}),"Önceki"]}),e.jsxs("span",{className:"tabular-nums",children:[d+1," / ",N]}),e.jsxs("button",{type:"button",disabled:d>=N-1,onClick:()=>m(u=>u+1),className:"flex items-center gap-1 rounded-lg border border-border px-2.5 py-1.5 font-medium hover:bg-accent disabled:opacity-40",children:["Sonraki",e.jsx(Y,{className:"h-4 w-4"})]})]})]}),x&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4",onClick:()=>j(null),children:e.jsxs("div",{className:"w-full max-w-md rounded-2xl bg-background p-6 shadow-2xl",onClick:u=>u.stopPropagation(),children:[e.jsxs("div",{className:"mb-3 flex items-center gap-3",children:[e.jsx("span",{className:"inline-flex h-10 w-10 items-center justify-center rounded-lg bg-amber-50 text-amber-600",children:e.jsx(pe,{className:"h-5 w-5"})}),e.jsxs("h2",{className:"text-lg font-semibold text-foreground",children:[Me[x.kind].label," ",x.turnOn?"yayını AÇ":"yayınını KAPAT"]})]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.jsx("span",{className:"font-medium text-foreground",children:x.row.accountName})," hesabında",x.kind==="contentAuto"?x.turnOn?e.jsxs(e.Fragment,{children:[" ","katalogdaki kütüphane ve video kalemleri ",e.jsx("b",{children:"her gece otomatik"}
1)," düşmeye başlayacak. Değişiklik ",e.jsx("b",{children:"bu gece 02:20'de"})," görünür — şu anda hiçbir şey eklenmez."]}):e.jsxs(e.Fragment,{children:[" ",e.jsx("b",{children:"bundan sonra"})," yeni katalog içeriği otomatik düşmeyecek."]}):x.turnOn?e.jsxs(e.Fragment,{children:[" tüm genel ",Me[x.kind].label.toLowerCase()," içeriği hesabın ",e.jsx("b",{children:"kataloğuna toplu eklenecek"}),"."]}):e.jsxs(e.Fragment,{children:[" genel ",Me[x.kind].label.toLowerCase()," içeriği hesabın ",e.jsx("b",{children:"kataloğundan kaldırılacak"}),"."]}),e.jsx("br",{}),x.kind==="contentAuto"&&x.turnOn&&e.jsxs("span",{className:"mt-2 block text-xs font-medium text-amber-600",children:["İlk gece ",e.jsx("b",{children:"birikmiş kataloğun tamamı"})," düşer — yalnız yeni eklenenler değil (20 Eyl ölçümü: ~1.200 kalem). Geri alma ",e.jsx("b",{children:"elle"})," yapılır; bayrağı kapatmak düşmüş içeriği geri almaz."]}),x.kind==="contentAuto"&&!x.turnOn&&e.jsx("span",{className:"mt-2 block text-xs font-medium text-amber-600",children:"Kapatmak geçmişte düşmüş içeriği GERİ ALMAZ — hesapta kalır. Kaldırma hesap yöneticisinin kararı."}),e.jsx("span",{className:"mt-2 block text-xs",children:"Kullanıcıya atama yapılmaz, mail/SMS gitmez — yalnız katalog görünürlüğü değişir."})]}),e.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[e.jsx("button",{type:"button",onClick:()=>j(null),className:"rounded-lg border border-border px-4 py-2 text-sm hover:bg-accent",children:"Vazgeç"}),e.jsx("button",{type:"button",onClick:o,className:S("rounded-lg px-4 py-2 text-sm font-medium text-white",x.turnOn?"bg-emerald-600 hover:bg-emerald-700":"bg-amber-600 hover:bg-amber-700"),children:x.turnOn?"Aç":"Kapat"})]})]})})]})}class Ne{static async team(){var a;const s=await I.get("/SysAdmin/Team");return((a=s.data)==null?void 0:a.data)??s.data??[]}static async assignRole(s,a){await I.post("/SysAdmin/Team/Role",{MemberId:s,OperatorRole:a})}static async failedLogins(){var a;const s=await I.get("/SysAdmin/Security/FailedLogins");return((a=s.data)==null?void 0:a.data)??s.data??[]}static async twoFactor(){var a;const s=await I.get("/SysAdmin/Security/TwoFactor");return((a=s.data)==null?void 0:a.data)??s.data}}const W=25;function yt({page:t,total:s,onPage:a}){const n=Math.max(1,Math.ceil(s/W));return s===0?null:e.jsxs("div",{className:"flex items-center justify-between px-1 py-3 text-sm text-muted-foreground",children:[e.jsxs("span",{children:[t*W+1,"–",Math.min(s,(t+1)*W)," / ",s]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{type:"button",disabled:t===0,onClick:()=>a(t-1),className:"flex items-center gap-1 rounded-lg border border-border px-2.5 py-1.5 font-medium hover:bg-accent disabled:opacity-40",children:[e.jsx(J,{className:"h-4 w-4"}),"Önceki"]}),e.jsxs("span",{className:"tabular-nums",children:[t+1," / ",n]}),e.jsxs("button",{type:"button",disabled:t>=n-1,onClick:()=>a(t+1),className:"flex items-center gap-1 rounded-lg border border-border px-2.5 py-1.5 font-medium hover:bg-accent disabled:opacity-40",children:["Sonraki",e.jsx(Y,{className:"h-4 w-4"})]})]})]})}function O({label:t,col:s,sort:a,setSort:n,align:l}){const d=a.key===s,m=d?a.dir==="asc"?dt:Re:lt;return e.jsx("th",{className:S("px-4 py-3 font-semibold",l==="right"&&"text-right",l==="center"&&"text-center"),children:e.jsxs("button",{type:"button",onClick:()=>n({key:s,dir:d&&a.dir==="asc"?"desc":"asc"}),className:S("inline-flex items-center gap-1 hover:text-foreground",l==="right"&&"flex-row-reverse"),children:[t,e.jsx(m,{className:S("h-3.5 w-3.5",d?"text-foreground":"opacity-40")})]})})}function ft(t,s){return t==null&&s==null?0:t==null?1:s==null?-1:typeof t=="number"&&typeof s=="number"?t-s:String(t).localeCompare(String(s),"tr",{sensitivity:"base",numeric:!0})}const ea={owner:{label:"Owner",cls:"bg-purple-50 text-purple-600"},admin:{label:"Admin",cls:"bg-blue-50 text-blue-600"},support:{label:"Support",cls:"bg-emerald-50 text-emerald-600"},readonly:{label:"Read-only",cls:"bg-gray-100 text-gray-500"}};function qe(t){if(!t)return"—";const s=new Date(t);
1return Number.isNaN(s.getTime())?t:s.toLocaleString("tr-TR",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"})}function ta(){const t=$(),{showSuccess:s,showError:a}=z(),[n,l]=p.useState(""),[d,m]=p.useState(0),[x,j]=p.useState({key:"name",dir:"asc"}),{data:i=[],isLoading:g,isFetching:f,refetch:w}=K({queryKey:["sysadmin-team"],queryFn:()=>Ne.team(),staleTime:6e4}),b=D({mutationFn:({memberId:o,role:v})=>Ne.assignRole(o,v),onSuccess:()=>{t.invalidateQueries({queryKey:["sysadmin-team"]}),s("save")},onError:o=>a(o)}),k=p.useMemo(()=>{const o=n.trim().toLocaleLowerCase("tr"),v=o?i.filter(c=>[c.name,c.surname,c.email,c.accountName].some(y=>(y??"").toLocaleLowerCase("tr").includes(o))||String(c.memberId).includes(o)):i,r=c=>x.key==="name"?[c.name,c.surname].filter(Boolean).join(" ")||c.email:x.key==="account"?c.accountName:x.key==="lastLogin"?c.lastLoginDate:c.operatorRole;return[...v].sort((c,y)=>(x.dir==="asc"?1:-1)*ft(r(c),r(y)))},[i,n,x]);p.useEffect(()=>m(0),[n]);const h=k.slice(d*W,(d+1)*W);return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-4 flex flex-wrap items-center gap-3",children:[e.jsx("input",{type:"text",value:n,onChange:o=>l(o.target.value),placeholder:"Operatör ara (ad/e-posta/hesap)...",className:"w-full max-w-sm rounded-lg border border-border bg-background px-3 py-2 text-sm"}),e.jsxs("button",{type:"button",onClick:()=>w(),className:"ml-auto flex items-center gap-2 rounded-lg border border-border px-3 py-2 text-sm font-medium text-foreground/80 hover:bg-accent",children:[e.jsx(R,{className:S("h-4 w-4",f&&"animate-spin")})," Yenile"]})]}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-background",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border bg-muted/30 text-left text-xs uppercase tracking-wide text-muted-foreground",children:[e.jsx(O,{label:"Operatör",col:"name",sort:x,setSort:j}),e.jsx(O,{label:"Hesap",col:"account",sort:x,setSort:j}),e.jsx(O,{label:"Son Giriş",col:"lastLogin",sort:x,setSort:j}),e.jsx("th",{className:"px-4 py-3 text-center font-semibold",children:"Durum"}),e.jsx(O,{label:"Alt-Rol",col:"role",sort:x,setSort:j})]})}),e.jsx("tbody",{children:g?e.jsx("tr",{children:e.jsx("td",{colSpan:5,className:"px-4 py-10 text-center text-muted-foreground",children:e.jsx(P,{className:"mx-auto h-5 w-5 animate-spin"})})}):h.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:5,className:"px-4 py-10 text-center text-muted-foreground",children:"Operatör bulunamadı."})}):h.map(o=>e.jsxs("tr",{className:"border-b border-border/60 hover:bg-accent/40",children:[e.jsxs("td",{className:"px-4 py-3",children:[e.jsx("div",{className:"font-medium text-foreground",children:[o.name,o.surname].filter(Boolean).join(" ")||o.email||`#${o.memberId}`}),e.jsx("div",{className:"text-xs text-muted-foreground",children:o.email})]}),e.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:o.accountName??`acc ${o.accountId??"—"}`}),e.jsx("td",{className:"whitespace-nowrap px-4 py-3 text-muted-foreground",children:qe(o.lastLoginDate)}),e.jsx("td",{className:"px-4 py-3 text-center",children:e.jsx("span",{className:S("rounded-full px-2 py-0.5 text-xs font-medium",o.isActive?"bg-emerald-50 text-emerald-600":"bg-gray-100 text-gray-500"),children:o.isActive?"Aktif":"Pasif"})}),e.jsx("td",{className:"px-4 py-3",children:e.jsxs("select",{value:o.operatorRole??"",onChange:v=>v.target.value&&b.mutate({memberId:o.memberId,role:v.target.value}),disabled:b.isPending,className:"rounded-lg border border-border bg-background px-2 py-1.5 text-sm",children:[e.jsx("option",{value:"",children:"— atanmadı"}),Object.entries(ea).map(([v,r])=>e.jsx("option",{value:v,children:r.label},v))]})})]},o.memberId))})]})})}),e.jsx(yt,{page:d,total:k.length,onPage:m}),e.jsx("p",{className:"mt-2 text-[11px] text-muted-foreground",children:"Not: Alt-roller v1'de bilgilendirici — henüz panel yetkisini kısıtlamaz (asıl yetki Sys Admin rolüdür). Enforcement ayrı faz."})]})}function fe({label:t,value:s,icon:a,tint:n}){return e.jsxs("div",{className:"flex items-center gap-3 rounded-xl border border-border bg-background px-4 py-3",children:[e.jsx("span",{className:S("inline-flex h-10 w-10 items-center justify-center rounded-lg",n),children:e.jsx(a,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xl font-bold tabular-nums text-foreground",children:s}),e.jsx("div",{className:"text-xs text-muted-foreground",children:t})]})]})}function sa(){const[t,s]=p.useState(""),[a,n]=p.useState(0),[l,d]=p.useState(!1),[m,x]=p.useState({key:"firstFail",dir:"desc"}),{data:j=[],isLoading:i,isFetching:g,refetch:f}=K({queryKey:["sysadmin-failed-logins"],queryFn:()=>Ne.failedLogins(),staleTime:3e4}),{data:w}=K({queryKey:["sysadmin-twofactor"],queryFn:()=>Ne.twoFactor(),staleTime:6e4}),b=p.useMemo(()=>j.filter(o=>o.isLocked).length,[j]),k=p.useMemo(()=>{const o=t.trim().toLocaleLowerCase("tr");let v=j;l&&(v=v.filter(c=>c.isLocked)),o&&(v=v.filter(c=>(c.loginIdentifier??"").toLocaleLowerCase("tr").includes(o)||String(c.accountId??"").includes(o)));const r=c=>m.key==="identifier"?c.loginIdentifier:m.key==="account"?c.accountId:m.key==="failCount"?c.failCount:m.key==="firstFail"?c.firstFailAt:c.lockedUntil;return[...v].sort((c,y)=>(m.dir==="asc"?1:-1)*ft(r(c),r(y)))},[j,t,l,m]);p.useEffect(()=>n(0),[t,l]);const h=k.slice(a*W,(a+1)*W);return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-5 grid grid-cols-2 gap-3 lg:grid-cols-4",children:[e.jsx(fe,{label:"Kilitli hesap/kimlik",value:b,icon:ss,tint:"bg-red-50 text-red-600"}),e.jsx(fe,{label:"Başarısız kayıt (son 200)",value:j.length,icon:ae,tint:"bg-amber-50 text-amber-600"}),e.jsx(fe,{label:"2FA açık hesap",value:w?w.with2fa:"—",icon:$e,tint:"bg-emerald-50 text-emerald-600"}),e.jsx(fe,{label:"Toplam hesap",value:w?w.total:"—",icon:as,tint:"bg-blue-50 text-blue-600"})]}),e.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-3",children:[e.jsx("div",{className:"text-sm font-medium text-foreground",children:"Başarısız Giriş / Kilitler"}),e.jsx("input",{type:"text",value:t,onChange:o=>s(o.target.value),placeholder:"Kimlik / hesap ara...",className:"w-full max-w-xs rounded-lg border border-border bg-background px-3 py-1.5 text-sm"}),e.jsxs("label",{className:"flex items-center gap-1.5 text-sm text-muted-foreground",children:[e.jsx("input",{type:"checkbox",checked:l,onChange:o=>d(o.target.checked)})," Sadece kilitli"]}),e.jsxs("button",{type:"button",onClick:()=>f(),className:"ml-auto flex items-center gap-2 rounded-lg border border-border px-3 py-1.5 text-sm font-medium text-foreground
1/80 hover:bg-accent",children:[e.jsx(R,{className:S("h-4 w-4",g&&"animate-spin")})," Yenile"]})]}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-background",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border bg-muted/30 text-left text-xs uppercase tracking-wide text-muted-foreground",children:[e.jsx(O,{label:"Kimlik (e-posta/kod)",col:"identifier",sort:m,setSort:x}),e.jsx(O,{label:"Hesap",col:"account",sort:m,setSort:x,align:"right"}),e.jsx(O,{label:"Deneme",col:"failCount",sort:m,setSort:x,align:"right"}),e.jsx(O,{label:"İlk Hata",col:"firstFail",sort:m,setSort:x}),e.jsx(O,{label:"Kilit Bitiş",col:"lockedUntil",sort:m,setSort:x}),e.jsx("th",{className:"px-4 py-3 text-center font-semibold",children:"Durum"})]})}),e.jsx("tbody",{children:i?e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"px-4 py-10 text-center text-muted-foreground",children:e.jsx(P,{className:"mx-auto h-5 w-5 animate-spin"})})}):h.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"px-4 py-10 text-center text-muted-foreground",children:"Kayıt bulunamadı."})}):h.map((o,v)=>e.jsxs("tr",{className:"border-b border-border/60 hover:bg-accent/40",children:[e.jsx("td",{className:"px-4 py-3 font-medium text-foreground",children:o.loginIdentifier||"—"}),e.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-muted-foreground",children:o.accountId??"—"}),e.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-foreground",children:o.failCount}),e.jsx("td",{className:"whitespace-nowrap px-4 py-3 text-muted-foreground",children:qe(o.firstFailAt)}),e.jsx("td",{className:"whitespace-nowrap px-4 py-3 text-muted-foreground",children:qe(o.lockedUntil)}),e.jsx("td",{className:"px-4 py-3 text-center",children:e.jsx("span",{className:S("rounded-full px-2 py-0.5 text-xs font-medium",o.isLocked?"bg-red-50 text-red-600":"bg-gray-100 text-gray-500"),children:o.isLocked?"Kilitli":"Açık"})})]},`${o.loginIdentifier}-${v}`))})]})})}),e.jsx(yt,{page:a,total:k.length,onPage:n}),e.jsx("p",{className:"mt-2 text-[11px] text-muted-foreground",children:"Salt-okuma: mevcut brute-force koruması (LoginFailedAttempts) ve hesap 2FA durumu. Kilit açma/2FA değişimi bu ekranda yapılmaz (auth core'a dokunulmaz)."})]})}function ar(){const[t,s]=p.useState("team");return e.jsxs("div",{className:"p-6",children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Ekip & Güvenlik"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Operatör ekibi + güvenlik durumu. (v1: alt-roller bilgilendirici, güvenlik salt-okuma — login akışına dokunulmaz.)"}),e.jsxs("div",{className:"mt-5 flex gap-1 border-b border-border",children:[e.jsxs("button",{type:"button",onClick:()=>s("team"),className:S("flex items-center gap-2 border-b-2 px-4 py-2.5 text-sm font-medium transition-colors",t==="team"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:[e.jsx(Fe,{className:"h-4 w-4"})," Ekip"]}),e.jsxs("button",{type:"button",onClick:()=>s("security"),className:S("flex items-center gap-2 border-b-2 px-4 py-2.5 text-sm font-medium transition-colors",t==="security"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:[e.jsx(ae,{className:"h-4 w-4"})," Güvenlik"]})]}),e.jsx("div",{className:"mt-5",children:t==="team"?e.jsx(ta,{}):e.jsx(sa,{})})]})}const jt=[{key:"account-admin",label:"Hesap Yöneticisi"},{key:"user",label:"Kullanıcı"},{key:"all",label:"Tümü"}],aa={"account-admin":"Hesap Yöneticisi",user:"Kullanıcı",all:"Tümü"};function ra({step:t,defaultRole:s,nextOrder:a,onClose:n,onSubmit:l,isLoading:d}){const[m,x]=p.useState(t?{Title:t.title,Description:t.description,TargetRole:t.targetRole,SortOrder:t.sortOrder,LinkUrl:t.linkUrl,Icon:t.icon,IsActive:t.isActive}:{Title:"",Description:"",TargetRole:s,SortOrder:a,LinkUrl:"",Icon:"",IsActive:!0}),j=()=>{m.Title.trim()&&l({...m,Title:m.Title.trim()})};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4",onClick:n,children:e.jsxs("div",{className:"w-full max-w-lg rounded-2xl bg-background p-6 shadow-2xl",onClick:i=>i.stopPropagation(),children:[e.jsx("h2",{className:"mb-4 text-lg font-semibold text-foreground",children:t?"Adım Düzenle":"Yeni Adım"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Başlık *"}),e.jsx("input",{value:m.Title,onChange:i=>x({...m,Title:i.target.value}),className:"mt-1 w-full rounded-lg border border-border bg-background px-3 py-2 text-sm"})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Açıklama"}),e.jsx("textarea",{value:m.Description??"",onChange:i=>x({...m,Description:i.target.value}),rows:3,className:"mt-1 w-full rounded-lg border border-border bg-background px-3 py-2 text-sm"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Hedef Rol"}),e.jsx("select",{value:m.TargetRole,onChange:i=>x({...m,TargetRole:i.target.value}),className:"mt-1 w-full rounded-lg border border-border bg-background px-3 py-2 text-sm",children:jt.map(i=>e.jsx("option",{value:i.key,children:i.label},i.key))})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Sıra"}),e.jsx("input",{type:"number",value:m.SortOrder,onChange:i=>x({...m,SortOrder:Number(i.target.value)||0}),className:"mt-1 w-full rounded-lg border border-border bg-background px-3 py-2 text-sm"})]})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Bağlantı (opsiyonel)"}),e.jsx("input",{value:m.LinkUrl??"",onChange:i=>x({...m,LinkUrl:i.target.value}),placeholder:"https://...",className:"mt-1 w-full rounded-lg border border-border bg-background px-3 py-2 text-sm"})]}),e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",checked:m.IsActive,onChange:i=>x({...m,IsActive:i.target.checked})}),e.jsx("span",{className:"text-sm text-foreground",children:"Aktif"})]}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"v1: adımlar yalnız burada saklanır; kullanıcıya gösterme entegrasyonu sonraki fazda."})]}),e.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[e.jsx("button",{type:"button",onClick:n,className:"rounded-lg border border-border px-4 py-2 text-sm hover:bg-accent",children:"İptal"}),e.jsxs("button",{type:"button",onClick:j,disabled:d||!m.Title.trim(),className:"flex items-center gap-2 rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:opacity-90 disabled:opacity-50",children:[d&&e.jsx(P,{className:"h-4 w-4 animate-spin"}),"Kaydet"]})]})]})})}function rr(){const t=$(),{showSuccess:s,showError:a}=z(),[n,l]=p.useState("account-admin"),[d,m]=p.useState({open:!1,step:null}),{data:x=[],isLoading:j,isFetching:i,refetch:g}=K({queryKey:["sysadmin-onboarding"],queryFn:()=>X.list(),staleTime:6e4}),f=p.useMemo(()=>x.filter(c=>c.targetRole===n).sort((c,y)=>c.sortOrder-y.sortOrder||c.id-y.id),[x,n]),w=p.useMemo(()=>f.length?Math.max(...f.map(c=>c.sortOrder))+1:0,[f]),b=()=>
1t.invalidateQueries({queryKey:["sysadmin-onboarding"]}),k=D({mutationFn:c=>X.create(c),onSuccess:()=>{b(),m({open:!1,step:null}),s("save")},onError:c=>a(c)}),h=D({mutationFn:({id:c,d:y})=>X.update(c,y),onSuccess:()=>{b(),m({open:!1,step:null}),s("save")},onError:c=>a(c)}),o=D({mutationFn:c=>X.remove(c),onSuccess:()=>{b(),s("delete")},onError:c=>a(c)}),v=D({mutationFn:async({a:c,b:y})=>{const N=(L,u)=>({Title:L.title,Description:L.description,TargetRole:L.targetRole,SortOrder:u,LinkUrl:L.linkUrl,Icon:L.icon,IsActive:L.isActive});await X.update(c.id,N(c,y.sortOrder)),await X.update(y.id,N(y,c.sortOrder))},onSuccess:()=>b(),onError:c=>a(c)}),r=(c,y)=>{const N=f[c+y],L=f[c];L&&N&&v.mutate({a:L,b:N})};return e.jsxs("div",{className:"p-6",children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Onboarding"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Role göre yönlendirme adımları. (v1: editör — kullanıcıya gösterim sonraki fazda.)"}),e.jsx("div",{className:"mt-5 flex gap-1 border-b border-border",children:jt.map(c=>e.jsxs("button",{type:"button",onClick:()=>l(c.key),className:S("border-b-2 px-4 py-2.5 text-sm font-medium transition-colors",n===c.key?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:[c.label,e.jsx("span",{className:"ml-2 rounded-full bg-muted px-1.5 py-0.5 text-[10px] tabular-nums text-muted-foreground",children:x.filter(y=>y.targetRole===c.key).length})]},c.key))}),e.jsxs("div",{className:"mt-4 flex items-center gap-3",children:[e.jsxs("button",{type:"button",onClick:()=>m({open:!0,step:null}),className:"flex items-center gap-2 rounded-lg bg-primary px-3 py-2 text-sm font-medium text-primary-foreground hover:opacity-90",children:[e.jsx(ze,{className:"h-4 w-4"})," Yeni Adım"]}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["Hedef: ",aa[n]]}),e.jsxs("button",{type:"button",onClick:()=>g(),className:"ml-auto flex items-center gap-2 rounded-lg border border-border px-3 py-2 text-sm font-medium text-foreground/80 hover:bg-accent",children:[e.jsx(R,{className:S("h-4 w-4",i&&"animate-spin")})," Yenile"]})]}),e.jsx("div",{className:"mt-4 space-y-2",children:j?e.jsx("div",{className:"py-10 text-center text-muted-foreground",children:e.jsx(P,{className:"mx-auto h-5 w-5 animate-spin"})}):f.length===0?e.jsx("div",{className:"rounded-xl border border-dashed border-border p-10 text-center text-sm text-muted-foreground",children:'Bu rol için adım yok. "Yeni Adım" ile ekleyin.'}):f.map((c,y)=>e.jsxs("div",{className:S("flex items-center gap-3 rounded-xl border border-border bg-background px-4 py-3",!c.isActive&&"opacity-60"),children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("button",{type:"button",disabled:y===0||v.isPending,onClick:()=>r(y,-1),className:"text-muted-foreground hover:text-foreground disabled:opacity-30",children:e.jsx(rs,{className:"h-4 w-4"})}),e.jsx("button",{type:"button",disabled:y===f.length-1||v.isPending,onClick:()=>r(y,1),className:"text-muted-foreground hover:text-foreground disabled:opacity-30",children:e.jsx(ns,{className:"h-4 w-4"})})]}),e.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-primary/10 text-xs font-bold text-primary",children:y+1}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium text-foreground",children:c.title}),!c.isActive&&e.jsx("span",{className:"rounded bg-gray-100 px-1.5 py-0.5 text-[10px] text-gray-500",children:"pasif"}),c.linkUrl&&e.jsx(ls,{className:"h-3 w-3 text-muted-foreground"})]}),c.description&&e.jsx("div",{className:"truncate text-xs text-muted-foreground",children:c.description})]}),e.jsxs("div",{className:"flex shrink-0 gap-1",children:[e.jsx("button",{type:"button",onClick:()=>m({open:!0,step:c}),className:"rounded-md border border-border p-1.5 hover:bg-accent",title:"Düzenle",children:e.jsx(re,{className:"h-3.5 w-3.5"})}),e.jsx("button",{type:"button",onClick:()=>o.mutate(c.id),disabled:o.isPending,className:"rounded-md border border-border p-1.5 text-red-500 hover:bg-red-50 disabled:opacity-50",title:"Sil",children:e.jsx(Be,{className:"h-3.5 w-3.5"})})]})]},c.id))}),d.open&&e.jsx(ra,{step:d.step,defaultRole:n,nextOrder:w,onClose:()=>m({open:!1,step:null}),onSubmit:c=>d.step?h.mutate({id:d.step.id,d:c}):k.mutate(c),isLoading:k.isPending||h.isPending})]})}class xe{static async analyze(s){var l;const a={Files:s.map(d=>({Name:d.name,Size:d.size}))},n=await I.post(`${this.BASE}
1/analyze`,a);return((l=n.data)==null?void 0:l.data)??n.data}static async parseQuestions(s){var l;const a=new FormData;a.append("file",s);const n=await I.post(`${this.BASE}/parse-questions`,a,{headers:{"Content-Type":void 0}});return((l=n.data)==null?void 0:l.data)??n.data}static async searchAccounts(s){var n;return((n=(await I.get(`${this.BASE}/accounts`,{params:{q:s}})).data)==null?void 0:n.data)??[]}static async importQuestions(s){var l;const a={TargetAccountId:s.targetAccountId,TrainingName:s.trainingName,Questions:s.questions.map(d=>({Text:d.text,QuestionType:d.questionType,Options:d.options.map(m=>({Text:m.text,IsCorrect:m.isCorrect}))}))},n=await I.post(`${this.BASE}/import-questions`,a);return((l=n.data)==null?void 0:l.data)??n.data}}be(xe,"BASE","/SmartMigrate");function na(t){const s=t.lastIndexOf(".");return s>0?t.slice(0,s):t}const la={multipleChoice:"Çoktan seçmeli",trueFalse:"Doğru / Yanlış",unknown:"Belirsiz"},da={spreadsheet:ut,presentation:is,video:os,document:ds,scorm:Pe,archive:Pe,unknown:mt};function Nt(t){return`%${Math.round(Math.max(0,Math.min(1,t))*100)}`}function oa(t){if(t<=0)return"—";const s=["B","KB","MB","GB"];let a=t,n=0;for(;a>=1024&&n<s.length-1;)a/=1024,n++;return`${a.toFixed(a>=10||n===0?0:1)} ${s[n]}`}function nr(){const{showError:t}=z(),s=p.useRef(null),[a,n]=p.useState([]),[l,d]=p.useState(null),[m,x]=p.useState({}),[j,i]=p.useState(null),[g,f]=p.useState(null),[w,b]=p.useState(null),k=D({mutationFn:r=>xe.analyze(r),onSuccess:r=>d(r),onError:r=>t(r)}),h=D({mutationFn:r=>xe.parseQuestions(r.file),onMutate:r=>i(r.index),onSuccess:(r,c)=>{x(y=>({...y,[c.index]:r})),f(c.index)},onError:r=>t(r),onSettled:()=>i(null)}),o=r=>{const c=r?Array.from(r):[];n(c),d(null),x({}),f(null),c.length>0&&k.mutate(c)},v=k.isPending;return e.jsxs("div",{className:"p-6 max-w-5xl mx-auto space-y-6",children:[e.jsxs("header",{className:"space-y-1",children:[e.jsxs("h1",{className:"text-xl font-semibold flex items-center gap-2",children:[e.jsx(We,{className:"h-5 w-5 text-primary"}),"Smart Transfer — İçerik Taşıma Sihirbazı"]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Eski platformdan gelen dosyaları seçin; sistem önce envanter çıkarır, soru tablolarını AI ile güven skorlu önizler. Bu ekran yalnız analiz/önizlemedir — hiçbir kayıt yazılmaz."})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-5 space-y-4",children:[e.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 rounded-md border border-dashed p-8 text-center cursor-pointer hover:bg-accent/40 transition",onClick:()=>{var r;return(r=s.current)==null?void 0:r.click()},children:[e.jsx(We,{className:"h-8 w-8 text-muted-foreground"}),e.jsx("div",{className:"text-sm",children:a.length>0?e.jsxs("span",{className:"font-medium",children:[a.length," dosya seçildi"]}):e.jsxs(e.Fragment,{children:["Dosyaları seçmek için tıklayın"," ",e.jsx("span",{className:"text-muted-foreground",children:"(birden çok dosya seçebilirsiniz)"})]})}),e.jsx("input",{ref:s,type:"file",multiple:!0,className:"hidden",onChange:r=>o(r.target.files)})]}),v&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(P,{className:"h-4 w-4 animate-spin"})," Dosyalar analiz ediliyor…"]})]}),l&&e.jsxs("div",{className:"space-y-4",children:[e.jsx(ia,{analysis:l}),e.jsx(ma,{selected:w,onSelect:b}),e.jsx("div",{className:"rounded-lg border divide-y",children:l.files.map((r,c)=>{const y=da[r.kind]??mt,N=r.kind==="spreadsheet"&&/\.(xlsx|xls)$/i.test(r.name),L=m[c],u=g===c&&!!L;return e.jsxs("div",{className:"p-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(y,{className:"h-5 w-5 text-muted-foreground shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate text-sm font-medium",children:r.name}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[r.kindLabel," · ",oa(r.sizeBytes),r.note?` · ${r.note}`:""]})]}),N&&e.jsxs("button",{type:"button",disabled:j!==null,onClick:()=>L?f(u?null:c):h.mutate({index:c,file:a[c]}),className:S("shrink-0 inline-flex items-center gap-1.5 rounded-md border px-3 py-1.5 text-xs font-medium hover:bg-accent",j!==null&&"opacity-50 cursor-not-allowed"),children:[j===c?e.jsx(P,{className:"h-3.5 w-3.5 animate-spin"}):L?u?e.jsx(Re,{className:"h-3.5 w-3.5"}):e.jsx(Y,{className:"h-3.5 w-3.5"}):e.jsx(ut,{className:"h-3.5 w-3.5"}),j===c?"Ayrıştırılıyor…":L?`${L.totalQuestions} soru`:"Soruları önizle"]})]}),u&&e.jsx("div",{className:"mt-3 pl-8",children:e.jsx(ca,{preview:L,defaultName:na(r.name),targetAccount:w})})]},c)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Sonraki adım (yakında): doğruladığınız içerikler tek tıkla taslak eğitim/sınav olarak 
1içeri aktarılacak. Şu an hiçbir kayıt yazılmadı."})]})]})}function ia({analysis:t}){const s=p.useMemo(()=>t.summary,[t]);return e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("span",{className:"text-sm font-medium",children:[t.totalFiles," dosya bulundu:"]}),s.map(a=>e.jsxs("span",{className:S("inline-flex items-center gap-1 rounded-full border px-2.5 py-0.5 text-xs",a.kind==="unknown"&&"border-amber-300 bg-amber-50 text-amber-800 dark:bg-amber-950/30 dark:text-amber-300"),children:[a.count," ",a.label]},a.kind))]})}function ca({preview:t,defaultName:s,targetAccount:a}){return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3",children:[e.jsx(Ee,{label:"Bulunan soru",value:String(t.totalQuestions)}),e.jsx(Ee,{label:"Elle kontrol gereken",value:String(t.lowConfidenceCount),tone:t.lowConfidenceCount>0?"warn":"ok"}),e.jsx(Ee,{label:"Güven eşiği",value:Nt(t.confidenceThreshold)})]}),t.warnings.length>0&&e.jsxs("div",{className:"rounded-md border border-amber-300 bg-amber-50 dark:bg-amber-950/30 p-3 text-sm space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2 font-medium text-amber-700 dark:text-amber-400",children:[e.jsx(pe,{className:"h-4 w-4"})," Uyarılar"]}),e.jsx("ul",{className:"list-disc pl-5 text-amber-800 dark:text-amber-300",children:t.warnings.map((n,l)=>e.jsx("li",{children:n},l))})]}),t.totalQuestions===0?e.jsx("div",{className:"rounded-md border p-6 text-center text-sm text-muted-foreground",children:"Bu dosyada soru bulunamadı. Geçmiş kayıt tablosu olabilir (o akış ayrı fazda gelecek)."}):e.jsx("ol",{className:"space-y-3",children:t.questions.map((n,l)=>e.jsx(xa,{index:l+1,q:n,threshold:t.confidenceThreshold},l))}),t.totalQuestions>0&&e.jsx(ua,{preview:t,defaultName:s,targetAccount:a})]})}function ma({selected:t,onSelect:s}){const[a,n]=p.useState(""),[l,d]=p.useState(!1),{data:m=[],isFetching:x}=K({queryKey:["smartmigrate-accounts",a],queryFn:()=>xe.searchAccounts(a),enabled:l,staleTime:3e4});return e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[e.jsx(ke,{className:"h-4 w-4 text-primary"}),"Hedef hesap",t&&e.jsxs("span",{className:"ml-1 rounded-full bg-primary/10 text-primary px-2 py-0.5 text-xs",children:[t.name," (#",t.id,")"]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(se,{className:"absolute left-2 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx("input",{value:a,onChange:j=>n(j.target.value),onFocus:()=>d(!0),placeholder:"Hesap ara (ad)…",className:"w-full rounded-md border pl-8 pr-3 py-2 text-sm bg-background"}),l&&e.jsx("div",{className:"absolute z-10 mt-1 w-full max-h-56 overflow-y-auto rounded-md border bg-popover shadow",children:x?e.jsxs("div",{className:"p-2 text-xs text-muted-foreground flex items-center gap-2",children:[e.jsx(P,{className:"h-3.5 w-3.5 animate-spin"})," Aranıyor…"]}):m.length===0?e.jsx("div",{className:"p-2 text-xs text-muted-foreground",children:"Sonuç yok."}):m.map(j=>e.jsxs("button",{type:"button",onClick:()=>{s(j),n(j.name),d(!1)},className:"block w-full text-left px-3 py-1.5 text-sm hover:bg-accent",children:[j.name," ",e.jsxs("span",{className:"text-muted-foreground",children:["#",j.id]})]},j.id))})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["İçeri aktarılan içerik bu hesabın altında ",e.jsx("b",{children:"taslak"})," eğitim olarak oluşur."]})]})}function ua({preview:t,defaultName:s,targetAccount:a}){const{showError:n,showSuccess:l}=z(),[d,m]=p.useState(s),[x,j]=p.useState(null),i=p.useMemo(()=>t.questions.filter(b=>b.confidence>=t.confidenceThreshold),[t]),g=t.questions.length-i.length,f=D({mutationFn:()=>xe.importQuestions({targetAccountId:a.id,trainingName:d.trim(),questions:i.map(b=>({text:b.text,questionType:b.questionType,options:b.options.map(k=>({text:k.text,isCorrect:k.isCorrect}))}))}),onSuccess:b=>{j(b),l("save")},onError:b=>n(b)}),w=!a||!d.trim()||f.isPending||i.length===0||!!x;return e.jsxs("div",{className:"rounded-lg border border-primary/30 bg-primary/5 p-4 space-y-3",children:[e.jsxs("div",{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(Je,{className:"h-4 w-4 text-primary"}
1)," Taslak eğitim olarak içeri aktar"]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 sm:items-center",children:[e.jsx("input",{value:d,onChange:b=>m(b.target.value),placeholder:"Eğitim adı",className:"flex-1 rounded-md border px-3 py-2 text-sm bg-background"}),e.jsxs("button",{type:"button",disabled:w,onClick:()=>f.mutate(),className:S("inline-flex items-center justify-center gap-2 rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground",w&&"opacity-50 cursor-not-allowed"),children:[f.isPending?e.jsx(P,{className:"h-4 w-4 animate-spin"}):e.jsx(Je,{className:"h-4 w-4"}),"Taslak eğitim oluştur"]})]}),!a&&e.jsx("p",{className:"text-xs text-amber-700 dark:text-amber-400",children:"Önce yukarıdan bir hedef hesap seçin."}),!x&&(i.length===0?e.jsx("p",{className:"text-xs text-amber-700 dark:text-amber-400",children:"Tüm sorular eşik altında (düşük güven). Aktarmadan önce elle kontrol gerekiyor."}):e.jsxs("p",{className:"text-xs text-muted-foreground",children:[i.length," yüksek-güven soru aktarılacak",g>0?` · ${g} düşük-güven soru elle kontrol için hariç tutuldu`:"","."]})),x&&e.jsxs("div",{className:"rounded-md border border-emerald-300 bg-emerald-50 dark:bg-emerald-950/30 p-3 text-sm space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2 font-medium text-emerald-800 dark:text-emerald-300",children:[e.jsx(je,{className:"h-4 w-4"}),"Taslak eğitim oluşturuldu (#",x.trainingId,") — ",x.createdQuestions," soru yazıldı",x.skippedQuestions>0?`, ${x.skippedQuestions} atlandı`:"","."]}),x.skipped.length>0&&e.jsx("ul",{className:"list-disc pl-5 text-xs text-emerald-800/80 dark:text-emerald-300/80",children:x.skipped.map((b,k)=>e.jsx("li",{children:b},k))})]})]})}function Ee({label:t,value:s,tone:a="default"}){return e.jsxs("div",{className:S("rounded-lg border p-4",a==="warn"&&"border-amber-300 bg-amber-50 dark:bg-amber-950/30",a==="ok"&&"border-emerald-300 bg-emerald-50 dark:bg-emerald-950/30"),children:[e.jsx("div",{className:"text-2xl font-semibold",children:s}),e.jsx("div",{className:"text-xs text-muted-foreground",children:t})]})}function xa({index:t,q:s,threshold:a}){const n=s.confidence<a;return e.jsxs("li",{className:S("rounded-lg border p-4 space-y-3",n&&"border-amber-300 bg-amber-50/60 dark:bg-amber-950/20"),children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"font-medium",children:[e.jsxs("span",{className:"text-muted-foreground mr-1",children:[t,"."]}),s.text]}),e.jsxs("span",{className:S("shrink-0 inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs font-medium",n?"bg-amber-100 text-amber-800 dark:bg-amber-900/50 dark:text-amber-300":"bg-emerald-100 text-emerald-800 dark:bg-emerald-900/50 dark:text-emerald-300"),title:n?"Eşik altı — elle kontrol gerekir":"Yüksek güven",children:[n?e.jsx(ae,{className:"h-3 w-3"}):e.jsx(je,{className:"h-3 w-3"}),Nt(s.confidence)]})]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:la[s.questionType]??s.questionType}),s.options.length>0&&e.jsx("ul",{className:"space-y-1",children:s.options.map((l,d)=>e.jsxs("li",{className:S("flex items-center gap-2 rounded px-2 py-1 text-sm",l.isCorrect&&"bg-emerald-50 dark:bg-emerald-950/30 font-medium"),children:[l.isCorrect?e.jsx(je,{className:"h-4 w-4 text-emerald-600 shrink-0"}):e.jsx("span",{className:"h-4 w-4 shrink-0 rounded-full border"}),l.text]},d))}),s.note&&e.jsxs("div",{className:"text-xs text-amber-700 dark:text-amber-400 flex items-center gap-1",children:[e.jsx(pe,{className:"h-3 w-3"})," ",s.note]})]})}function lr(){return e.jsx(hs,{})}function dr(){return e.jsx(fs,{})}export{Xa as SysAdminAbonelikPage,Wa as SysAdminAiModulesPage,Ya as SysAdminAnalitikPage,Ha as SysAdminDashboardPage,tr as SysAdminDuyurularPage,ar as SysAdminGuvenlikPage,lr as SysAdminHesaplarPage,Ua as SysAdminKataloglarPage,dr as SysAdminKullanicilarPage,_a as SysAdminKullanimIzlemePage,Ga as SysAdminLoglarPage,rr as SysAdminOnboardingPage,Ja as SysAdminPanelRolePage,Za as SysAdminPlanlarPage,nr as SysAdm
1inSmartMigratePage,Va as SysAdminSmartPanelPage,Qa as SysAdminWhitelabelPage,sr as SysAdminYayinlamalarPage,er as SysAdminYedekKvkkPage};

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.