| 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/app.copyrightchain.it/html_bak_20260421_180119/assets/ |
Upload File : |
import{r as t,t as y,u as C,j as e,n as b,h as z,L,a as D,D as S,k as G,G as A,l as E,E as I}from"./index-Cr5nrdaF.js";const O=({certificates:n,lang:l})=>{t.useMemo(()=>y[l],[l]);const{notify:i,deductCredits:j,user:m}=C(),[a,N]=t.useState(null),[c,o]=t.useState("commercial"),[p,h]=t.useState(!1),[u,g]=t.useState(null),d=t.useRef(null),w=async()=>{if(!a||!j(2))return;h(!0),g(null);const s=new A({apiKey:"PLACEHOLDER_API_KEY"}),k=`Genera un contratto di licenza d'uso professionale in ${l==="it"?"Italiano":"English"}.
Dettagli:
- Tipo: ${c.replace("_"," ").toUpperCase()}
- Opera: ${a.title} (ID Certificato: ${a.id})
- Licenziante (Autore): ${a.author}
- Riferimento Data Certa: ${new Date(a.timestamp).toLocaleString()}
- Hash SHA-256: ${a.fileHash}
Il testo deve includere:
1. Definizione dell'oggetto della licenza.
2. Diritti concessi (e limitazioni).
3. Riferimento legale alla prova crittografica fornita da CopyrightChain.
4. Termini di validità.`;try{const f=await s.models.generateContent({model:"gemini-3-flash-preview",contents:k});g(f.text||""),i("Licenza generata (2 ABO Usati)","success")}catch{i("AI Error","error")}finally{h(!1)}},v=async()=>{if(d.current)try{const s=await E(d.current,{scale:2}),r=new I("p","mm","a4");r.addImage(s.toDataURL("image/png"),"PNG",0,0,210,s.height*210/s.width),r.save(`License_${a==null?void 0:a.id}.pdf`)}catch{i("Download error","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(b,{size:36,className:"text-emerald-600"})," Generatore Licenze"]}),e.jsx("p",{className:"text-slate-500 font-medium mt-1",children:"Emetti licenze d'uso ufficiali per le tue opere protette."})]}),e.jsxs("div",{className:"bg-emerald-50 px-6 py-3 rounded-2xl border border-emerald-100 flex items-center gap-3",children:[e.jsx(z,{size:18,className:"text-emerald-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-emerald-700",children:[m.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:"Seleziona Opera"}),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=>N(n.find(r=>r.id===s.target.value)||null),children:[e.jsx("option",{value:"",children:"Scegli certificato..."}),n.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(x,{active:c==="commercial",onClick:()=>o("commercial"),label:"Commerciale"}),e.jsx(x,{active:c==="personal",onClick:()=>o("personal"),label:"Uso Personale"}),e.jsx(x,{active:c==="creative_commons",onClick:()=>o("creative_commons"),label:"Creative Commons"})]}),e.jsx("button",{onClick:w,disabled:!a||p||m.credits.balance<2,className:"w-full py-5 bg-emerald-600 text-white rounded-2xl font-black uppercase text-[10px] tracking-widest shadow-xl shadow-emerald-100 disabled:opacity-50",children:p?e.jsx(L,{size:18,className:"animate-spin"}):e.jsxs(e.Fragment,{children:[e.jsx(D,{size:18,className:"inline mr-2"})," Genera (2 ABO)"]})})]})})}),e.jsx("div",{className:"lg:col-span-2",children:u?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.jsx("span",{className:"text-[10px] font-black uppercase tracking-widest text-slate-400",children:"Documento Generato"}),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(S,{size:16})," Scarica PDF"]})]}),e.jsxs("div",{ref:d,className:"bg-white p-16 shadow-2xl rounded-sm border-[10px] border-slate-50 min-h-[800px]",children:[e.jsxs("div",{className:"flex justify-between items-start mb-12",children:[e.jsx("div",{className:"bg-emerald-600 text-white p-4 rounded-2xl shadow-xl",children:e.jsx(G,{size:32})}),e.jsx("div",{className:"text-right",children:e.jsx("p",{className:"font-black text-slate-900 uppercase text-lg tracking-tight",children:"USAGE LICENSE"})})]}),e.jsx("div",{className:"serif-font text-slate-900 whitespace-pre-wrap leading-relaxed text-sm",children:u})]})]}):e.jsxs("div",{className:"h-full min-h-[400px] 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(b,{size:48,className:"text-slate-100 mb-4"}),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 Licenza: 2 ABO COIN"})]})})]})]})},x=({active:n,onClick:l,label:i})=>e.jsx("button",{onClick:l,className:`p-4 rounded-xl font-black text-[10px] uppercase tracking-widest transition-all border ${n?"bg-emerald-600 text-white border-emerald-600":"bg-white text-slate-400 border-slate-100 hover:border-emerald-200"}`,children:i});export{O as default};