| Server IP : 54.37.205.81 / Your IP : 216.73.216.76 Web Server : nginx/1.22.1 System : Linux vps-249481fa 6.1.0-50-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.176-1 (2026-07-02) x86_64 User : debian ( 1000) PHP Version : 8.2.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/admin.copyrightchain.it/html/assets/ |
Upload File : |
import{c as _,r,t as S,u as D,j as e,G as A,g as z,f as I,i as N,L as E,a as G,D as L,e as O,k as T,E as $}from"./index-0V3kacYJ.js";/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const B=[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]],R=_("briefcase",B),P="https://app.copyrightchain.it/api/ai",M=({certificates:d,lang:n})=>{r.useMemo(()=>S[n],[n]);const{notify:c,deductCredits:x,user:f}=D(),[a,y]=r.useState(null),[o,p]=r.useState("cease_and_desist"),[b,g]=r.useState(!1),[i,j]=r.useState(null),h=r.useRef(null),k=async()=>{if(!a||!x(5))return;g(!0),j(null);const l=`Genera un atto di ${o} formale in ${n==="it"?"Italiano":"English"} per l'opera "${a.title}".
Includi il riferimento al certificato ID ${a.id} e all'impronta digitale ${a.fileHash}.
Il tono deve essere severo, professionale e giuridicamente credibile.`;try{const m=sessionStorage.getItem("ccp_client_token")||"";if(!m)throw new Error("session_missing");const w=await fetch(`${P}/client/ai/defense`,{method:"POST",headers:{"Content-Type":"application/json","X-CCP-Token":m},body:JSON.stringify({prompt:l})}),t=await w.json().catch(()=>null);if(!w.ok||!(t!=null&&t.ok))throw new Error((t==null?void 0:t.error)||"defense_failed");const C=t.text||"Errore nella generazione.";j({id:`LD-${Math.random().toString(36).substr(2,6).toUpperCase()}`,type:o,content:C,date:new Date().toISOString(),linkedCertificateId:a.id}),c("Atto legale generato (5 ABO usati)","success")}catch{c("AI Error","error")}finally{g(!1)}},v=async()=>{if(h.current)try{const s=await T(h.current,{scale:2}),l=new $("p","mm","a4");l.addImage(s.toDataURL("image/png"),"PNG",0,0,210,s.height*210/s.width),l.save(`Legal_Act_${i==null?void 0:i.id}.pdf`)}catch{c("Download failed","error")}};return e.jsxs("div",{className:"space-y-10 pb-10",children:[e.jsxs("div",{className:"flex flex-col md:flex-row justify-between items-start md:items-end gap-6",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-4xl font-black text-slate-900 tracking-tight flex items-center gap-4 uppercase",children:[e.jsx(A,{size:36,className:"text-blue-600"})," Defense Center"]}),e.jsx("p",{className:"text-slate-500 font-medium mt-1",children:"Genera diffide e atti legali professionali."})]}),e.jsxs("div",{className:"bg-blue-50 px-6 py-3 rounded-2xl border border-blue-100 flex items-center gap-3",children:[e.jsx(z,{size:18,className:"text-blue-600"}),e.jsxs("div",{className:"text-left",children:[e.jsx("p",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest",children:"Wallet"}),e.jsxs("p",{className:"text-sm font-black text-blue-700",children:[f.credits.balance," ABO"]})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-10",children:[e.jsx("div",{className:"lg:col-span-1 space-y-8",children:e.jsx("div",{className:"bg-white p-8 rounded-[3rem] border border-slate-100 shadow-xl",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest ml-1",children:"Certificato di Riferimento"}),e.jsxs("select",{className:"w-full p-4 rounded-2xl bg-slate-50 border border-slate-100 font-black text-xs outline-none",onChange:s=>y(d.find(l=>l.id===s.target.value)||null),children:[e.jsx("option",{value:"",children:"Seleziona..."}),d.map(s=>e.jsx("option",{value:s.id,children:s.title},s.id))]})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-2",children:[e.jsx(u,{active:o==="cease_and_desist",onClick:()=>p("cease_and_desist"),icon:e.jsx(I,{size:16}),label:"Diffida (C&D)"}),e.jsx(u,{active:o==="ownership_notice",onClick:()=>p("ownership_notice"),icon:e.jsx(N,{size:16}),label:"Nota Proprietà"}),e.jsx(u,{active:o==="royalty_request",onClick:()=>p("royalty_request"),icon:e.jsx(R,{size:16}),label:"Richiesta Royalties"})]}),e.jsx("button",{onClick:k,disabled:!a||b||f.credits.balance<5,className:"w-full py-5 bg-blue-600 text-white rounded-2xl font-black uppercase text-[10px] tracking-widest shadow-xl shadow-blue-100 disabled:opacity-50",children:b?e.jsx(E,{size:18,className:"animate-spin"}):e.jsxs(e.Fragment,{children:[e.jsx(G,{size:18,className:"inline mr-2"})," Genera Atto (5 ABO)"]})})]})})}),e.jsx("div",{className:"lg:col-span-2",children:i?e.jsxs("div",{className:"space-y-6 animate-in slide-in-from-right-4",children:[e.jsxs("div",{className:"flex justify-between items-center bg-white p-4 rounded-2xl border border-slate-100 shadow-sm",children:[e.jsxs("span",{className:"text-[10px] font-black uppercase tracking-widest text-slate-400",children:["Atto: ",i.id]}),e.jsxs("button",{onClick:v,className:"flex items-center gap-2 bg-slate-900 text-white px-6 py-2.5 rounded-xl font-black text-[10px] uppercase tracking-widest shadow-xl",children:[e.jsx(L,{size:16})," Scarica PDF"]})]}),e.jsxs("div",{ref:h,className:"bg-white p-20 shadow-2xl rounded-sm border-[15px] border-double border-slate-50 min-h-[900px]",children:[e.jsxs("div",{className:"flex justify-between items-start mb-20",children:[e.jsx("div",{className:"bg-slate-900 text-white p-4 rounded-2xl shadow-xl",children:e.jsx(N,{size:32})}),e.jsx("div",{className:"text-right",children:e.jsx("p",{className:"font-black text-slate-900 uppercase text-lg tracking-tight",children:"LEGAL NOTICE"})})]}),e.jsx("div",{className:"serif-font text-slate-900 whitespace-pre-wrap leading-relaxed text-sm",children:i.content})]})]}):e.jsxs("div",{className:"h-full min-h-[500px] bg-white rounded-[3rem] border-4 border-dashed border-slate-100 flex flex-col items-center justify-center text-center p-12",children:[e.jsx(O,{size:48,className:"text-slate-100 mb-6"}),e.jsx("h3",{className:"text-xl font-black text-slate-300 uppercase",children:"Seleziona un certificato"}),e.jsx("p",{className:"text-xs text-slate-300 font-bold uppercase mt-2",children:"Costo Atto: 5 ABO COIN"})]})})]})]})},u=({active:d,onClick:n,icon:c,label:x})=>e.jsxs("button",{onClick:n,className:`w-full p-4 rounded-xl flex items-center gap-3 font-black text-[10px] uppercase tracking-widest transition-all border ${d?"bg-blue-600 text-white border-blue-600 shadow-lg":"bg-white text-slate-400 border-slate-100 hover:border-blue-200"}`,children:[c," ",x]});export{M as default};