1import{bt as ee,r as n,ad as u,j as e,S as ae,a as D,$ as se,b as I,b0 as P,B as R,a4 as te,f as ne,Y as re,C as i,h as le}from"./index-zi8Pq3mD.js";import{I as oe}from"./input-B6uaQ158.js";import{S as v,a as y,b,c as j,d as c}from"./select-CFrx_mEw.js";import{T as ie,a as ce,b as N,c as o,d as de,e as l}from"./table-BihAuLEp.js";import{C as me}from"./cpu-KzPXc9XW.js";import{R as w,C as B,X as E,Y as M,T as k,B as he,a as xe}from"./generateCategoricalChart-CIacXKEK.js";import{B as ue}from"./BarChart-DxIxJWhe.js";import{P as pe,a as fe}from"./PieChart-BF4m2UgN.js";import{L as ge}from"./LineChart-VRg4eZFt.js";import{L as ve}from"./Line-hHGTSPqz.js";import{F as ye}from"./filter-CE_KB8Xk.js";import{S as be}from"./search-aIqWVEkJ.js";import{R as je}from"./refresh-ccw-BpRiSy2i.js";import{E as Ne}from"./external-link-DPcgS_Nl.js";import"./index-BnncIDn6.js";import"./chevron-up-Cb3Xp-jp.js";const we="/assets/db-privilege-hero-FmWqgw-H.jpg",q=["#00ddff","#ff00aa","#a855f7","#22d3ee","#f59e0b","#10b981","#f43f5e","#3b82f6"];function Ke(){const[z]=ee(),[t,K]=n.useState([]),[O,S]=n.useState(!0),[C,F]=n.useState(null),[p,V]=n.useState(()=>(z.get("q")??"").slice(0,100)),[Y,$]=n.useState(!1);n.useEffect(()=>{u.auth.getSession().then(({data:a})=>$(!!a.session))},[]);const[d,H]=n.useState("all"),[m,G]=n.useState("all"),[h,J]=n.useState("all"),[f,L]=n.useState(!1),_=async()=>{S(!0);const[a,s]=await Promise.all([u.from("ai_privilege_cases").select("*").order("case_date",{ascending:!1}).limit(2e3),u.from("ai_privilege_sync_log").select("*").eq("success",!0).order("ran_at",{ascending:!1}).limit(1).maybeSingle()]);a.data&&K(a.data),s.data&&F(s.data),S(!1)};n.useEffect(()=>{_()},[]);const W=async()=>{L(!0);try{await u.functions.invoke("ai-privilege-sync"),await _()}finally{L(!1)}},A=n.useMemo(()=>Array.from(new Set(t.map(a=>a.country).filter(Boolean))).sort(),[t]),X=n.useMemo(()=>Array.from(new Set(t.map(a=>a.party).filter(Boolean))).sort(),[t]),U=n.useMemo(()=>Array.from(new Set(t.map(a=>a.case_type).filter(Boolean))).sort(),[t]),g=n.useMemo(()=>{const a=p.toLowerCase();return t.filter(s=>!(d!=="all"&&s.country!==d||m!=="all"&&s.party!==m||h!=="all"&&s.case_type!==h||a&&!((s.case_name||"").toLowerCase().includes(a)||(s.court||"").toLowerCase().includes(a)||(s.outcome||"").toLowerCase().includes(a)||(s.details||"").toLowerCase().includes(a))))},[t,p,d,m,h]),Q=n.useMemo(()=>{const a=new Map;return t.forEach(s=>{s.country&&a.set(s.country,(a.get(s.country)||0)+1)}),Array.from(a,([s,r])=>({name:s,value:r})).sort((s,r)=>r.value-s.value).slice(0,10)},[t]),T=n.useMemo(()=>{const a=new Map;return t.forEach(s=>{if(!s.outcome)return;const r=s.outcome.length>40?s.outcome.slice(0,38)+"â¦":s.outcome;a.set(r,(a.get(r)||0)+1)}),Array.from(a,([s,r])=>({name:s,value:r})).sort((s,r)=>r.value-s.value).slice(0,8)},[t]),Z=n.useMemo(()=>{const a=new Map;return t.forEach(s=>{if(!s.case_date)return;const r=s.case_date.slice(0,7);a.set(r,(a.get(r)||0)+1)}),Array.from(a,([s,r])=>({month:s,count:r})).sort((s,r)=>s.month.localeCompare(r.month))},[t]),x={total:t.length,countries:A.length,notPrivileged:t.filter(a=>/not privileged|no privilege|waived|lose/i.test(a.outcome||"")).length,privileged:t.filter(a=>/^privileged|partly privileged|protected/i.test(a.outcome||"")).length};return e.jsxs("div",{className:"min-h-screen bg-[#050a12] text-foreground relative overflow-x-hidden",children:[e.jsx(ae,{title:"LegalTek AI Privilege Database | Real-Time Tracker",description:"Real-time database of court rulings on whether AI-generated legal advice and work product qualify for attorney-client privilege. Daily-updated tracker.",url:"https://legaltek.ai/ai-privilege-tracker"}),e.jsxs("div",{className:"absolute inset-0 pointer-events-none",children:[e.jsx("div",{className:"absolute top-20 left-10 w-96 h-96 bg-[hsl(var(--neon-cyan)/0.08)] rounded-full blur-3xl"}),e.jsx("div",{className:"absolute top-96 right-10 w-96 h-96 bg-[hsl(var(--neon-magenta)/0.08)] rounded-full blur-3xl"})]}),e.jsxs("div",{className:"relative z-10 max-w-7xl mx-auto px-4 sm:px-6 py-12",children:[e.jsxs("div",{className:"mb-8 flex flex-wrap gap-6",children:[e.jsxs(D,{to:"/",className:"inline-flex items-center gap-2 text-[hsl(var(--neon-cyan))] hover:text-[hsl(var(--neon-magenta))] transition-colors",children:[e.jsx(se,{className:"w-4 h-4"})," Back to Home"]}),Y&&e.jsxs(D,{to:"/firm/ai-risk",className:"inline-flex items-center gap-2 text-[hsl(var(--neon-magenta))] hover:text-[hsl(var(--neon-cyan))] transition-colors",children:[e.jsx(I,{className:"w-4 h-4"})," Back to Firm AI Risk Dashboard"]})]}),e.jsxs("div",{className:"relative rounded-2xl overflow-hidden border border-[hsl(var(--neon-cyan)/0.3)] mb-8 shadow-[0_0_60px_hsl(var(--neon-cyan)/0.2)]",children:[e.jsx("img",{src:we,alt:"Glowing attorney-client privilege shield padlock â AI privilege database",width:1920,height:1080,className:"w-full h-48 sm:h-64 md:h-80 object-cover"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-[#050a12] via-[#050a12]/40 to-transparent"})]}),e.jsxs(P.div,{initial:{opacity:0,y:20}
1,animate:{opacity:1,y:0},transition:{duration:.6},children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4 flex-wrap",children:[e.jsxs("div",{className:"px-3 py-1 rounded-full border border-[hsl(var(--neon-cyan)/0.5)] bg-[hsl(var(--neon-cyan)/0.1)] text-[hsl(var(--neon-cyan))] text-xs font-mono uppercase tracking-widest flex items-center gap-2",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-[hsl(var(--neon-cyan))] animate-pulse"})," LIVE · DAILY SYNC"]}),e.jsx(R,{variant:"outline",className:"font-mono text-xs",children:"Source: damiencharlotin.com"})]}),e.jsx("h1",{className:"font-rajdhani font-black text-4xl sm:text-6xl uppercase tracking-tight mb-4",children:e.jsx("span",{className:"bg-gradient-to-r from-[hsl(var(--neon-cyan))] via-white to-[hsl(var(--neon-magenta))] bg-clip-text text-transparent",children:"AI Privilege Database"})}),e.jsx("p",{className:"text-lg text-muted-foreground max-w-3xl mb-2",children:"Real-time global database of court decisions ruling on whether AI-generated legal advice, analysis, and adjacent work product qualify for attorney-client privilege or work-product protection."}),e.jsxs("p",{className:"text-sm font-mono text-[hsl(var(--neon-cyan))] mb-8",children:[C?`Last sync: ${new Date(C.ran_at).toLocaleString()}`:"Awaiting first sync"," · Auto-refresh: every 24h"]})]}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-10",children:[{label:"Total Decisions",value:x.total,icon:te,color:"neon-cyan"},{label:"Jurisdictions",value:x.countries,icon:ne,color:"neon-magenta"},{label:"Privilege Upheld",value:x.privileged,icon:re,color:"neon-cyan"},{label:"Privilege Denied",value:x.notPrivileged,icon:me,color:"neon-magenta"}].map((a,s)=>e.jsx(P.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:s*.1},children:e.jsxs(i,{className:"bg-black/60 border-[hsl(var(--neon-cyan)/0.3)] p-5 backdrop-blur",children:[e.jsx(a.icon,{className:`w-6 h-6 mb-2 text-[hsl(var(--${a.color}))]`}),e.jsx("div",{className:"font-mono text-3xl font-bold text-white",children:a.value.toLocaleString()}),e.jsx("div",{className:"text-xs uppercase tracking-wider text-muted-foreground mt-1",children:a.label})]})},a.label))}),e.jsxs("div",{className:"grid lg:grid-cols-2 gap-6 mb-10",children:[e.jsxs(i,{className:"bg-black/60 border-[hsl(var(--neon-cyan)/0.3)] p-6",children:[e.jsx("h3",{className:"font-rajdhani font-bold text-xl uppercase mb-4 text-[hsl(var(--neon-cyan))]",children:"Top Jurisdictions"}),e.jsx(w,{width:"100%",height:280,children:e.jsxs(ue,{data:Q,children:[e.jsx(B,{strokeDasharray:"3 3",stroke:"#1f2937"}),e.jsx(E,{dataKey:"name",stroke:"#94a3b8",tick:{fontSize:11},angle:-30,textAnchor:"end",height:70}),e.jsx(M,{stroke:"#94a3b8",tick:{fontSize:11}}),e.jsx(k,{contentStyle:{background:"#050a12",border:"1px solid #00ddff"}}),e.jsx(he,{dataKey:"value",fill:"#00ddff"})]})})]}),e.jsxs(i,{className:"bg-black/60 border-[hsl(var(--neon-magenta)/0.3)] p-6",children:[e.jsx("h3",{className:"font-rajdhani font-bold text-xl uppercase mb-4 text-[hsl(var(--neon-magenta))]",children:"Outcome Distribution"}),e.jsx(w,{width:"100%",height:280,children:e.jsxs(pe,{children:[e.jsx(fe,{data:T,dataKey:"value",nameKey:"name",cx:"50%",cy:"50%",outerRadius:100,label:a=>`${a.value}`,children:T.map((a,s)=>e.jsx(xe,{fill:q[s%q.length]},s))}),e.jsx(k,{contentStyle:{background:"#050a12",border:"1px solid #ff00aa"}})]})})]}),e.jsxs(i,{className:"lg:col-span-2 bg-black/60 border-[hsl(var(--neon-cyan)/0.3)] p-6",children:[e.jsx("h3",{className:"font-rajdhani font-bold text-xl uppercase mb-4 text-[hsl(var(--neon-cyan))]",children:"Decisions Timeline"}),e.jsx(w,{width:"100%",height:260,children:e.jsxs(ge,{data:Z,children:[e.jsx(B,{strokeDasharray:"3 3",stroke:"#1f2937"}),e.jsx(E,{dataKey:"month",stroke:"#94a3b8",tick:{fontSize:11}}),e.jsx(M,{stroke:"#94a3b8",tick:{fontSize:11}}),e.jsx(k,{contentStyle:{background:"#050a12",border:"1px solid #00ddff"}}),e.jsx(ve,{type:"monotone",dataKey:"count",stroke:"#00ddff",strokeWidth:2,dot:{fill:"#ff00aa",r:3}})]})})]})]}),e.jsxs(i,{className:"bg-black/60 border-[hsl(var(--neon-cyan)/0.3)] p-4 mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3 text-[hsl(var(--neon-cyan))]",children:[e.jsx(ye,{className:"w-4 h-4"}),e.jsx("span",{className:"font-mono text-xs uppercase tracking-widest",children:"Filter Database"})]}
1),e.jsxs("div",{className:"grid md:grid-cols-5 gap-3",children:[e.jsxs("div",{className:"md:col-span-2 relative",children:[e.jsx(be,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx(oe,{value:p,onChange:a=>V(a.target.value),placeholder:"Search case, court, outcome, details...",className:"pl-9 bg-black/40 border-[hsl(var(--neon-cyan)/0.3)]"})]}),e.jsxs(v,{value:d,onValueChange:H,children:[e.jsx(y,{className:"bg-black/40 border-[hsl(var(--neon-cyan)/0.3)]",children:e.jsx(b,{placeholder:"Country"})}),e.jsxs(j,{className:"bg-[#050a12] border-[hsl(var(--neon-cyan)/0.3)] max-h-72",children:[e.jsx(c,{value:"all",children:"All countries"}),A.map(a=>e.jsx(c,{value:a,children:a},a))]})]}),e.jsxs(v,{value:m,onValueChange:G,children:[e.jsx(y,{className:"bg-black/40 border-[hsl(var(--neon-cyan)/0.3)]",children:e.jsx(b,{placeholder:"Party"})}),e.jsxs(j,{className:"bg-[#050a12] border-[hsl(var(--neon-cyan)/0.3)]",children:[e.jsx(c,{value:"all",children:"All parties"}),X.map(a=>e.jsx(c,{value:a,children:a},a))]})]}),e.jsxs(v,{value:h,onValueChange:J,children:[e.jsx(y,{className:"bg-black/40 border-[hsl(var(--neon-cyan)/0.3)]",children:e.jsx(b,{placeholder:"Case Type"})}),e.jsxs(j,{className:"bg-[#050a12] border-[hsl(var(--neon-cyan)/0.3)]",children:[e.jsx(c,{value:"all",children:"All case types"}),U.map(a=>e.jsx(c,{value:a,children:a},a))]})]})]}),e.jsxs("div",{className:"flex items-center justify-between mt-3 text-xs",children:[e.jsxs("span",{className:"font-mono text-muted-foreground",children:["Showing ",g.length.toLocaleString()," of ",t.length.toLocaleString()," decisions"]}),e.jsxs(le,{onClick:W,disabled:f,size:"sm",variant:"outline",className:"border-[hsl(var(--neon-cyan)/0.5)] text-[hsl(var(--neon-cyan))]",children:[e.jsx(je,{className:`w-3 h-3 mr-2 ${f?"animate-spin":""}`})," ",f?"Syncing...":"Refresh now"]})]})]}),e.jsxs(i,{className:"bg-black/60 border-[hsl(var(--neon-cyan)/0.3)] overflow-hidden",children:[e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(ie,{children:[e.jsx(ce,{children:e.jsxs(N,{className:"border-[hsl(var(--neon-cyan)/0.2)] hover:bg-transparent",children:[e.jsx(o,{className:"text-[hsl(var(--neon-cyan))] font-mono text-xs uppercase",children:"Date"}),e.jsx(o,{className:"text-[hsl(var(--neon-cyan))] font-mono text-xs uppercase",children:"Case"}),e.jsx(o,{className:"text-[hsl(var(--neon-cyan))] font-mono text-xs uppercase",children:"Court / Country"}),e.jsx(o,{className:"text-[hsl(var(--neon-cyan))] font-mono text-xs uppercase",children:"Party"}),e.jsx(o,{className:"text-[hsl(var(--neon-cyan))] font-mono text-xs uppercase",children:"Case Type"}),e.jsx(o,{className:"text-[hsl(var(--neon-cyan))] font-mono text-xs uppercase",children:"AI Tool"}),e.jsx(o,{className:"text-[hsl(var(--neon-cyan))] font-mono text-xs uppercase",children:"Outcome"})]})}),e.jsx(de,{children:O?e.jsx(N,{children:e.jsx(l,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"Loading database..."})}):g.slice(0,250).map(a=>e.jsxs(N,{className:"border-[hsl(var(--neon-cyan)/0.1)] hover:bg-[hsl(var(--neon-cyan)/0.05)] align-top",children:[e.jsx(l,{className:"font-mono text-xs text-muted-foreground whitespace-nowrap",children:a.case_date||"â"}),e.jsx(l,{className:"max-w-xs",children:a.source_url?e.jsxs("a",{href:a.source_url,target:"_blank",rel:"noopener noreferrer",className:"text-white hover:text-[hsl(var(--neon-cyan))] inline-flex items-center gap-1",children:[a.case_name," ",e.jsx(Ne,{className:"w-3 h-3 opacity-60"})]}):e.jsx("span",{className:"text-white",children:a.case_name})}),e.jsxs(l,{children:[e.jsx("div",{className:"text-xs",children:a.court||"â"}),a.country&&e.jsx(R,{variant:"outline",className:"text-[10px] mt-1",children:a.country})]}),e.jsx(l,{className:"text-xs",children:a.party||"â"}),e.jsx(l,{className:"text-xs",children:a.case_type||"â"}),e.jsx(l,{className:"text-xs font-mono text-[hsl(var(--neon-magenta))]",children:a.ai_tool||"â"}),e.jsx(l,{className:"text-xs max-w-md text-muted-foreground",children:a.outcome||"â"})]},a.id))})]})}),g.length>250&&e.jsx("div",{className:"text-center py-3 text-xs text-muted-foreground border-t border-[hsl(var(--neon-cyan)/0.2)]",children:"Displaying first 250 results â refine filters to
1see more."})]}),e.jsx("div",{className:"mt-8 p-4 rounded-lg border border-[hsl(var(--neon-magenta)/0.4)] bg-[hsl(var(--neon-magenta)/0.05)]",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(I,{className:"w-5 h-5 text-[hsl(var(--neon-magenta))] flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[e.jsx("strong",{className:"text-[hsl(var(--neon-magenta))]",children:"Not legal advice."})," LegalTek.ai is a technology company, not a law firm. This database is sourced from the public AI Privilege dataset maintained by"," ",e.jsx("a",{href:"https://www.damiencharlotin.com/ai-privilege/",target:"_blank",rel:"noopener noreferrer",className:"text-[hsl(var(--neon-cyan))] underline",children:"Damien Charlotin"})," and is provided for informational and educational purposes. Decisions are auto-synced daily; consult original court documents and qualified counsel before relying on any entry."]})]})})]})]})}export{Ke as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.