1import{f as Y,r as i,j as e,A as X,m as B,X as J,C as I,n as R,w as Q,h as _,i as j,o as Z,u as ee,b as te,a3 as se,L as le,a as ae}from"./index-DrHaVjH7.js";import{l as ne,d as ie}from"./template-service-DcGeyQnF.js";import{c as oe,h as re,i as ce,j as de,k as me}from"./docx-template-service-TzHG-hHN.js";import{S as xe}from"./SecurityConfigModal-BlyVOD8K.js";import{S as H}from"./site-D8F4ttkB.js";import{D as pe}from"./DynamicDocForm-j5NVaOHR.js";import{t as ue,n as fe,s as be}from"./documents-service-i_FPQewe.js";import{F as A}from"./file-type-2-B0gDbfck.js";import{E as he}from"./external-link-CX8N4Iez.js";import{S as ge}from"./shield-CyNJJ9ts.js";import{P as je}from"./pencil-Ci69c58-.js";import{A as ye}from"./arrow-right-BcVOgyOZ.js";import{C as K}from"./chevron-down-BJkYA3rc.js";import{D as Ne}from"./DesktopAppShell-DSV9oAzR.js";import{C as ve}from"./circle-help-BAe-p9qo.js";import{P as O}from"./plus-Dxr30pZ2.js";import{F as P}from"./file-text-CcBFGqvh.js";import{B as ke}from"./building-2-BTlDCp8W.js";import{L as we}from"./link-2-Nu9Nues_.js";import{P as U}from"./pen-line-BKGLDb4c.js";import{T as V}from"./trash-2-DCmXyPgK.js";import{F as Ce}from"./file-pen-line-ILm2-XvX.js";import{S as Se}from"./send-B3z3keZb.js";import"./signatureService-BrRkRqCZ.js";import"./signature-jurisdictions-BptF5suH.js";import"./camera-Bnia3YkV.js";import"./credit-card-Qk5_Bvp7.js";import"./fingerprint-BNWfM-2a.js";import"./file-check-dVaJhea1.js";import"./chart-column-Dc52NzAJ.js";import"./BotonDictado-BUuZ_Rpd.js";import"./use-dictation-Cz28pAcg.js";import"./ai-review-service-Bp4cdxgD.js";import"./square-D_LBC4bp.js";import"./mic-B46fFof9.js";import"./loader-circle-BhfW3tzf.js";import"./templates-CyrwSTQ5.js";import"./wedding-planner-template-CdCPM7Yh.js";import"./Logo-BQtkPw0o.js";import"./layout-template-BYRo2BQN.js";import"./folder-open-HyqvVlyp.js";import"./settings-NBcshI1Z.js";import"./user-BC1LhX_v.js";import"./mobile-dashboard-service-dajeFPhW.js";import"./bell-S0i3gyAx.js";import"./DomainJoinPrompt-nRTU4M90.js";import"./company-service-lFs_C-E_.js";import"./mobile-theme-IulMb__8.js";function ze({template:l,language:t,onClose:o}){const{user:p,unlimitedActive:d,subscriptionActive:b,isAdmin:g}=Y(),u=!!(d||b||g),[h,f]=i.useState({}),[a,r]=i.useState(null),[x,c]=i.useState(!1),[N,S]=i.useState(!1),[y,z]=i.useState(null),[v,k]=i.useState(!1),[L,E]=i.useState(!1),$=!!l,w=a??(l==null?void 0:l.securityConfig),M=w?Object.values(w).filter(Boolean).length:0,D=()=>{f({}),r(null),z(null),k(!1),E(!1),o()},T=((l==null?void 0:l.detectedFields)??[]).filter(m=>{var C;return m.required&&!((C=h[m.key])!=null&&C.trim())}),s=L?new Set(T.map(m=>m.key)):void 0,n=async()=>{if(l){if(T.length>0){E(!0),j.error(t==="en"?"Fill in all required fields first.":"Completa todos los campos obligatorios primero.");return}S(!0);try{const m=await oe(l.publicSlug,h,{securityOverride:a??void 0,intent:"fill_send"});if(z(`${H}/sign/${m}`),p!=null&&p.id){const C=ue(l.name,fe(h,l.detectedFields),t);be(p.id,l.id,C).catch(G=>{console.error("saveDocumentRecord (plantilla Word):",G)})}}catch(m){j.error(m instanceof Error?m.message:t==="en"?"Could not generate the link.":"No se pudo generar el enlace.")}finally{S(!1)}}},F=()=>{y&&navigator.clipboard.writeText(y).then(()=>{k(!0),setTimeout(()=>k(!1),2e3)})};return e.jsx(X,{children:$&&l&&e.jsxs(B.div,{className:"fixed inset-0 z-50 flex items-center justify-center p-4",initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},style:{background:"rgba(15,23,42,0.55)",backdropFilter:"blur(10px)"},onClick:D,children:[e.jsxs(B.div,{className:"max-h-[90vh] w-full max-w-xl overflow-hidden bg-white",initial:{opacity:0,scale:.94,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.94,y:12},transition:{duration:.32,ease:[.22,1,.36,1]},style:{borderRadius:"24px",boxShadow:"0 2px 4px rgba(0,0,0,0.04), 0 12px 32px rgba(15,23,42,0.10), 0 32px 80px rgba(15,23,42,0.16)"},onClick:m=>m.stopPropagation(),children:[e.jsxs("div",{className:"relative overflow-hidden px-5 py-5 sm:px-7 sm:py-6",style:{background:"linear-gradient(135deg,#f8fafc 0%,#f1f5f9 100%)",borderBottom:"1px solid #e2e8f0"},children:[e.jsx("div",{className:"absolute inset-x-0 top-0 h-1",style:{background:"linear-gradient(90deg,#2563eb 0%,#7c3aed 60%,#0891b2 100%)"}}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex size-11 shrink-0 items-center justify-center rounded-2xl",style:{background:"linear-gradient(135deg,#60a5fa 0%,#2563eb 100%)",boxShadow:"0 3px 10px rgba(37,99,235,0.35)"},children:e.jsx(A,{className:"size-5 text-white"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"truncate text-base font-black text-slate-900",children:l.name}),e.jsx("p",{className:"text-xs text-slate-500",children:t==="en"?"Fill it in, then send only for a signature":"Llénalo tú, y envÃalo solo para firmar"})]}),e.jsx("button",{type:"button",onClick:D,className:"flex size-8 shrink-0 items-center justify-center rounded-lg text-slate-400 hover:bg-slate-100 hover:text-slate-700",children:e.jsx(J,{className:"size-4"})})]})]}),e.jsx("div",{className:"max-h-[calc(90vh-88px)] overflow-y-auto p-5 sm:p-7",children:y?e.jsxs("div",{className:"flex flex-col items-center gap-4 py-4 text-center",children:[e.jsx("div",{className:"rounded-full bg-emerald-100 p-4",children:e.jsx(I,{className:"size-8 text-emerald-600"})}),e.jsx("h3",{className:"text-lg font-black text-slate-900",children:t==="en"?"Signing link ready":"Enlace de firma listo"}),e.jsx("p",{className:"max-w-sm text-sm text-slate-500",children:t==="en"?"Send this one-time link to your recipient â the document is already filled in, they just review and sign.":"EnvÃa este enlace único a tu destinatario â el documento ya está lleno, solo debe revisarlo y firmarlo."}),e.jsxs("div",{className:"flex w-full items-center gap-2 rounded-2xl border border-slate-200 bg-slate-50 p-2",children:[e.jsx("input",{readOnly:!0,value:y,className:"min-w-0 flex-1 truncate bg-transparent px-3 text-sm font-mono text-slate-600 outline-none"}),e.jsxs("button",{type:"button",onClick:F,className:"flex shrink-0 items-center gap-1.5 rounded-xl bg-indigo-600 px-3 py-2 text-xs font-bold text-white",children:[v?e.jsx(I,{className:"size-3.5"}):e.jsx(R,{className:"size-3.5"})," ",v?t==="en"?"Copied":"Copiado":t==="en"?"Copy":"Copiar"]}),e.jsx("a",{href:y,target:"_blank",rel:"noreferrer",className:"flex shrink-0 items-center justify-center rounded-xl bg-white p-2 text-slate-400 hover:text-slate-700",children:e.jsx(he,{className:"size-4"})})]}),e.jsx("button",{type:"button",onClick:D,className:"mt-2 text-sm font-semibold text-slate-500 hover:text-slate-700",children:t==="en"?"Done":"Listo"})]}):e.jsxs("div",{className:"space-y-5",children:[e.jsx(pe,{nombreDocumento:l.name,tienePremium:u,fields:l.detectedFields,values:h,onChange:(m,C)=>f(G=>({...G,[m]:C})),language:t,invalidKeys:s}),e.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-2xl border border-blue-100 bg-blue-50/60 p-3.5",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[e.jsx(ge,{className:"size-4 shrink-0 text-blue-600"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-xs font-bold text-blue-900",children:t==="en"?"Security for this document":"Seguridad para este documento"}),e.jsxs("p",{className:"text-[11px] text-blue-700",children:[M," ",t==="en"?"option(s) active":"opción(es) activa(s)",!a&&(t==="en"?" · template default":" · valor por defecto de la plantilla")]})]})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[a&&e.jsx("button",{type:"button",onClick:()=>r(null),title:t==="en"?"Reset to template default":"Restablecer al valor por defecto",className:"flex size-8 items-center justify-center rounded-lg text-blue-400 hover:bg-blue-100 hover:text-blue-700",children:e.jsx(Q,{className:"size-3.5"})}),e.jsxs("button",{type:"button",onClick:()=>c(!0),className:"flex items-center gap-1.5 rounded-xl bg-blue-600 px-3 py-2 text-xs font-bold text-white hover:bg-blue-700",children:[e.jsx(je,{className:"size-3.5"})," ",t==="en"?"Adjust":"Ajustar"]})]})]}),e.jsx("button",{type:"button",disabled:N,onClick:()=>void n(),className:"flex w-full items-center justify-center gap-2 rounded-xl py-3.5 text-sm font-bold text-white transition active:translate-y-0.5 disabled:opacity-60",style:{background:"linear-gradient(180deg,#818cf8 0%,#4f46e5 38%,#4338ca 68%,#312e81 100%)",boxShadow:"0 3px 0 #312e81, 0 5px 14px rgba(67,56,202,0.4), 0 1px 0 rgba(255,255,255,0.2) inset"},children:N?e.jsxs(e.Fragment,{children:[e.jsx(_,{className:"size-4 animate-spin"})," ",t==="en"?"Generating...":"Generando..."]}):e.jsxs(e.Fragment,{children:[t==="en"?"Generate signing link":"Generar enlace de firma"," ",e.jsx(ye,{className:"size-4"})]})})]})})]}),e.jsx(xe,{open:x,language:t,initialConfig:w,onConfirm:m=>{r(m),c(!1)},onCancel:()=>c(!1)})]})})}const q=["#7C3AED","#2563EB","#0891B2","#059669","#D97706","#DC2626","#DB2777","#4F46E5"];function W(l){let t=0;for(let o=0;o<l.length;o++)t=(t+l.charCodeAt(o))%9973;return q[t%q.length]}function Ee(l){let t=l.trim(),o="";const p=/^(.*?)\s*\(([^()]+)\)\s*$/.exec(t);return p&&(t=p[1].trim(),o=p[2].trim()),t=t.replace(/\s*[ââ-]\s*Plantilla de Ejemplo\s*$/i,"").replace(/\s*[ââ-]\s*Example Template\s*$/i,"").trim(),{nombre:t||l,sector:o}}function De({ejemplos:l,language:t,cloningId:o,onUsar:p}){const d=t==="es",[b,g]=i.useState(null),u=i.useMemo(()=>l.map(a=>{const{nombre:r,sector:x}=Ee(a.exampleLabel||a.name);return{ex:a,nombre:r,sector:x||"General"}}),[l,d]),h=i.useMemo(()=>{const a=new Map;for(const r of u)a.set(r.sector,(a.get(r.sector)??0)+1);return[...a.entries()].sort((r,x)=>r[0].localeCompare(x[0],"es"))},[u]),f=b?u.filter(a=>a.sector===b):u;return e.jsxs("div",{className:"mt-6",children:[e.jsxs("h2",{className:"mb-3 flex items-center gap-2 text-sm font-black uppercase tracking-wide text-slate-400",children:[e.jsx(Z,{className:"size-4 text-purple-500"}),d?"Plantillas de ejemplo":"Example templates",e.jsx("span",{className:"rounded-full bg-slate-100 px-2 py-0.5 text-[11px] font-bold text-slate-500",children:l.length})]}),h.length>1&&e.jsxs("div",{className:"mb-4 flex flex-wrap gap-1.5",children:[e.jsx("button",{type:"button",onClick:()=>g(null),className:"rounded-full px-3 py-1.5 text-[11px] font-bold transition",style:b===null?{background:"#0F172A",color:"#fff"}:{background:"#fff",color:"#475569",border:"1px solid #E2E8F0"},children:d?"Todos":"All"}),h.map(([a,r])=>{const x=W(a),c=b===a;return e.jsxs("button",{type:"button",onClick:()=>g(c?null:a),className:"flex items-center gap-1.5 rounded-full px-3 py-1.5 text-[11px] font-bold transition",style:c?{background:x,color:"#fff"}:{background:"#fff",color:"#475569",border:"1px solid #E2E8F0"},children:[e.jsx("span",{className:"size-1.5 rounded-full",style:{background:c?"#fff":x}}),a,e.jsx("span",{className:"tabular-nums opacity-60",children:r})]},a)})]}),e.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3",children:f.map(({ex:a,nombre:r,sector:x})=>{const c=W(x),N=(d?a.instructionsEs:a.instructionsEn)||(d?"Obtén tu propia copia independiente â reescribe las cláusulas, campos y formulario como lo necesites.":"Get your own independent copy â rewrite the clauses, fields, and form however you need.");return e.jsxs("div",{className:"flex flex-col rounded-3xl border border-slate-200 bg-white p-5 shadow-sm transition hover:shadow-md",children:[e.jsx("span",{className:"mb-3.5 block h-1 w-9 rounded-full",style:{background:c}}),e.jsx("span",{className:"mb-2 inline-flex w-fit items-center rounded-full px-2 py-0.5 text-[10px] font-black uppercase tracking-wide",style:{background:`${c}14`,color:c},children:x}),e.jsx("p",{className:"line-clamp-2 min-h-[2.6em] text-sm font-bold leading-snug text-slate-900",children:r}),e.jsxs("p",{className:"mt-1 text-[11px] font-semibold text-slate-400",children:[a.fieldCount," ",d?"campos · totalmente editable":"fields · fully editable"]}),e.jsx("p",{className:"mt-2.5 line-clamp-3 min-h-[3.9em] text-xs leading-relaxed text-slate-500",children:N}),e.jsxs("button",{type:"button",disabled:o===a.id,onClick:()=>p(a),className:"mt-4 flex items-center justify-center gap-1.5 rounded-xl py-2.5 text-xs font-bold text-white transition hover:brightness-110 disabled:opacity-60",style:{background:c},children:[o===a.id?e.jsx(_,{className:"size-3.5 animate-spin"}):e.jsx(R,{className:"size-3.5"}),d?"Usar esta plantilla":"Use this template"]})]},a.id)})}),b&&f.length<u.length&&e.jsxs("button",{type:"button",onClick:()=>g(null),className:"mx-auto mt-4 flex items-center gap-1.5 text-xs font-semibold text-slate-400 transition hover:text-slate-700",children:[e.jsx(K,{className:"size-3.5"}),d?`Ver las ${u.length} plantillas de ejemplo`:`See all ${u.length} example templates`]})]})}function wt(){const{user:l}=Y(),{language:t}=ee(),o=te(),p=se(),[d,b]=i.useState(null),[g,u]=i.useState(null),[h,f]=i.useState(null),[a,r]=i.useState(null),[x,c]=i.useState(!1),[N,S]=i.useState(null),[y,z]=i.useState(null),[v,k]=i.useState(null),[L,E]=i.useState(null);i.useEffect(()=>{l!=null&&l.id&&(ne(l.id).then(b).catch(()=>b([])),re(l.id).then(u).catch(()=>
1u([])))},[l==null?void 0:l.id]),i.useEffect(()=>{ce().then(k).catch(()=>k([]))},[]);const $=async s=>{if(l!=null&&l.id){E(s.id);try{const n=await de(s.id,l.id,t);j.success(t==="en"?"Your own editable copy is ready!":"¡Tu copia editable está lista!"),o(`/my-templates/${n.id}/edit-docx`)}catch(n){j.error(n instanceof Error?n.message:t==="en"?"Could not copy this template.":"No se pudo copiar esta plantilla.")}finally{E(null)}}},w=(s,n)=>{navigator.clipboard.writeText(`${H}/t/${s}`).then(()=>{S(s),setTimeout(()=>S(null),2e3),n&&j.success(t==="en"?"Link copied â share it so the recipient fills it in and signs":"Enlace copiado â compártelo para que el destinatario lo llene y firme")})},M=async s=>{r(s);try{await me(s),u(n=>(n==null?void 0:n.filter(F=>F.id!==s))??n),j.success(t==="en"?"Template deleted":"Plantilla eliminada")}catch(n){j.error(n instanceof Error?n.message:t==="en"?"Could not delete":"No se pudo eliminar")}finally{r(null),f(null)}},D=async s=>{r(s);try{await ie(s),b(n=>(n==null?void 0:n.filter(F=>F.id!==s))??n),j.success(t==="en"?"Template deleted":"Plantilla eliminada")}catch(n){j.error(n instanceof Error?n.message:t==="en"?"Could not delete":"No se pudo eliminar")}finally{r(null),f(null)}};if(!l)return e.jsxs("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-slate-50 px-4 text-center",children:[e.jsx("p",{className:"text-lg font-bold text-slate-800",children:t==="en"?"Sign in to see your templates":"Inicia sesión para ver tus plantillas"}),e.jsx(le,{to:"/",className:"rounded-xl bg-indigo-600 px-5 py-2.5 text-sm font-bold text-white",children:t==="en"?"Go home":"Ir al inicio"})]});const T=e.jsxs("div",{className:"mx-auto max-w-5xl",children:[p&&e.jsxs("button",{type:"button",onClick:()=>o("/app"),className:"mb-4 flex items-center gap-1.5 text-sm font-semibold text-slate-500 hover:text-slate-700",children:[e.jsx(ae,{className:"size-4"}),t==="en"?"Back":"Volver"]}),e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-black text-slate-900",children:t==="en"?"My Templates":"Mis Plantillas"}),e.jsx("p",{className:"mt-1 text-sm text-slate-500",children:t==="en"?"Upload your own document once, mark the fields, and reuse it every time â the form fills it in automatically.":"Sube tu propio documento una vez, marca los campos, y reúsalo cada vez â el formulario lo llena automáticamente."})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[e.jsx("button",{type:"button",onClick:()=>o("/my-templates/ayuda"),className:"flex size-11 items-center justify-center rounded-2xl border border-slate-200 bg-white text-slate-400 hover:text-indigo-600",title:t==="en"?"Help":"Ayuda",children:e.jsx(ve,{className:"size-5"})}),e.jsxs("div",{className:"relative",children:[e.jsxs("button",{type:"button",onClick:()=>c(s=>!s),className:"flex items-center gap-2 rounded-2xl bg-gradient-to-r from-blue-600 to-indigo-600 px-5 py-3 text-sm font-bold text-white shadow-lg transition hover:scale-[1.02]",children:[e.jsx(O,{className:"size-4"}),t==="en"?"New Template":"Nueva Plantilla",e.jsx(K,{className:`size-4 transition-transform ${x?"rotate-180":""}`})]}),x&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>c(!1)}),e.jsxs("div",{className:"absolute right-0 top-full z-20 mt-2 w-64 overflow-hidden rounded-2xl border border-slate-200 bg-white shadow-xl",children:[e.jsxs("button",{type:"button",onClick:()=>{c(!1),o("/my-templates/new-docx")},className:"flex w-full items-center gap-3 px-4 py-3.5 text-left hover:bg-slate-50",children:[e.jsx(A,{className:"size-5 shrink-0 text-indigo-500"}),e.jsxs("span",{children:[e.jsx("span",{className:"block text-sm font-bold text-slate-800",children:t==="en"?"Word with {{variables}}":"Word con {{variables}}"}),e.jsx("span",{className:"block text-xs text-slate-400",children:t==="en"?"Public link, anyone can fill & sign":"Enlace público, cualquiera llena y firma"})]})]}),e.jsxs("button",{type:"button",onClick:()=>{c(!1),o("/my-templates/new")},className:"flex w-full items-center gap-3 border-t border-slate-100 px-4 py-3.5 text-left hover:bg-slate-50",children:[e.jsx(P,{className:"size-5 shrink-0 text-slate-400"}),e.jsxs("span",{children:[e.jsx("span",{className:"block text-sm font-bold text-slate-800",children:t==="en"?"PDF with boxes":"PDF con casillas"}),e.jsx("span",{className:"block text-xs text-slate-400",children:t==="en"?"Click to place fields":"Clic para colocar campos"})]})]})]})]})]})]})]}),v!==null&&v.length>0&&e.jsx(De,{ejemplos:v,language:t,cloningId:L,onUsar:s=>void $(s)}),g!==null&&g.length>0&&e.jsxs("div",{className:"mt-6",children:[e.jsxs("h2",{className:"mb-3 flex items-center gap-2 text-sm font-black uppercase tracking-wide text-slate-400",children:[e.jsx(A,{className:"size-4"})," ",t==="en"?"Word templates (public link)":"Plantillas Word (enlace público)"]}),e.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3",children:g.map(s=>e.jsx("div",{className:"flex flex-col gap-3 rounded-3xl border border-slate-200 bg-white p-5 shadow-sm",children:h===s.id?e.jsxs("div",{className:"flex flex-1 flex-col justify-between gap-3",children:[e.jsx("p",{className:"text-sm font-semibold text-red-700",children:t==="en"?`Delete "${s.name}"?`:`¿Eliminar "${s.name}"?`}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"button",onClick:()=>f(null),className:"flex-1 rounded-xl bg-slate-100 py-2 text-xs font-bold text-slate-600",children:t==="en"?"Cancel":"Cancelar"}),e.jsx("button",{type:"button",disabled:a===s.id,onClick:()=>void M(s.id),className:"flex-1 rounded-xl bg-red-600 py-2 text-xs font-bold text-white disabled:opacity-50",children:a===s.id?"â¦":t==="en"?"Delete":"Eliminar"})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex size-11 shrink-0 items-center justify-center rounded-2xl bg-indigo-50",children:e.jsx(A,{className:"size-5 text-indigo-500"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"truncate text-sm font-bold text-slate-900",children:s.name}),e.jsxs("p",{className:"text-xs text-slate-400",children:[s.detectedFields.length," ",t==="en"?"field(s)":"campo(s)"]}),s.userId!==l.id&&e.jsxs("span",{className:"mt-1 inline-flex items-center gap-1 rounded-full bg-violet-100 px-2 py-0.5 text-[10px] font-black uppercase text-violet-700",children:[e.jsx(ke,{className:"size-2.5"})," ",t==="en"?"Shared with you":"Compartida contigo"]})]})]}),e.jsxs("button",{type:"button",onClick:()=>w(s.publicSlug),className:"flex items-center gap-1.5 truncate rounded-xl bg-slate-50 px-3 py-2 text-left text-xs font-mono text-slate-500 hover:bg-slate-100",children:[N===s.publicSlug?e.jsx(I,{className:"size-3.5 shrink-0 text-emerald-600"}):e.jsx(we,{className:"size-3.5 shrink-0 text-slate-400"}),e.jsxs("span",{className:"truncate",children:["/t/",s.publicSlug]}),e.jsx(R,{className:"ml-auto size-3.5 shrink-0 text-slate-300"})]}),e.jsxs("div",{className:"mt-auto flex flex-col gap-2",children:[s.userId===l.id&&e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>o(`/my-templates/${s.id}/edit-docx`),className:"flex flex-1 items-center justify-center gap-1.5 rounded-xl bg-indigo-600 py-2.5 text-xs font-bold text-white hover:bg-indigo-500",children:[e.jsx(U,{className:"size-3.5"}),t==="en"?"Edit":"Editar"]}),e.jsx("button",{type:"button",onClick:()=>f(s.id),className:"flex size-9 shrink-0 items-center justify-center rounded-xl bg-slate-50 text-slate-400 hover:text-red-600",children:e.jsx(V,{className:"size-4"})})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>z(s),title:t==="en"?"You fill it in, then send only for a signature":"Tú lo llenas, y lo envÃas
1solo para firmar",className:"flex flex-1 items-center justify-center gap-1.5 rounded-xl border border-blue-200 bg-blue-50 py-2 text-[11px] font-bold text-blue-700 hover:bg-blue-100",children:[e.jsx(Ce,{className:"size-3.5"}),t==="en"?"Fill before sending":"Llenar antes de enviar"]}),e.jsxs("button",{type:"button",onClick:()=>w(s.publicSlug,!0),title:t==="en"?"Copy the public link â the recipient fills it in and signs":"Copia el enlace público â el destinatario lo llena y firma",className:"flex flex-1 items-center justify-center gap-1.5 rounded-xl border border-slate-200 bg-slate-50 py-2 text-[11px] font-bold text-slate-600 hover:bg-slate-100",children:[e.jsx(Se,{className:"size-3.5"}),t==="en"?"Signer fills & signs":"Firmante llena y firma"]})]})]})]})},s.id))})]}),e.jsx(ze,{template:y,language:t,onClose:()=>z(null)}),e.jsxs("h2",{className:"mb-3 mt-8 flex items-center gap-2 text-sm font-black uppercase tracking-wide text-slate-400",children:[e.jsx(P,{className:"size-4"})," ",t==="en"?"PDF templates":"Plantillas PDF"]}),e.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3",children:d===null?[0,1,2].map(s=>e.jsx("div",{className:"h-40 animate-pulse rounded-3xl bg-white shadow-sm"},s)):d.length===0?e.jsxs("div",{className:"col-span-full rounded-3xl border-2 border-dashed border-slate-200 bg-white px-6 py-16 text-center",children:[e.jsx(P,{className:"mx-auto mb-3 size-10 text-slate-300"}),e.jsx("p",{className:"text-sm font-semibold text-slate-500",children:t==="en"?"You don't have any templates yet":"TodavÃa no tienes plantillas"}),e.jsxs("button",{type:"button",onClick:()=>o("/my-templates/new"),className:"mt-4 inline-flex items-center gap-2 rounded-xl bg-indigo-600 px-4 py-2.5 text-sm font-bold text-white",children:[e.jsx(O,{className:"size-4"}),t==="en"?"Create your first template":"Crea tu primera plantilla"]})]}):d.map(s=>e.jsx("div",{className:"flex flex-col gap-3 rounded-3xl border border-slate-200 bg-white p-5 shadow-sm",children:h===s.id?e.jsxs("div",{className:"flex flex-1 flex-col justify-between gap-3",children:[e.jsx("p",{className:"text-sm font-semibold text-red-700",children:t==="en"?`Delete "${s.name}"?`:`¿Eliminar "${s.name}"?`}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"button",onClick:()=>f(null),className:"flex-1 rounded-xl bg-slate-100 py-2 text-xs font-bold text-slate-600",children:t==="en"?"Cancel":"Cancelar"}),e.jsx("button",{type:"button",disabled:a===s.id,onClick:()=>void D(s.id),className:"flex-1 rounded-xl bg-red-600 py-2 text-xs font-bold text-white disabled:opacity-50",children:a===s.id?"â¦":t==="en"?"Delete":"Eliminar"})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex size-11 shrink-0 items-center justify-center rounded-2xl bg-indigo-50",children:e.jsx(P,{className:"size-5 text-indigo-500"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"truncate text-sm font-bold text-slate-900",children:s.name}),e.jsxs("p",{className:"text-xs text-slate-400",children:[s.fields.length," ",t==="en"?"field(s)":"campo(s)"]})]})]}),e.jsxs("div",{className:"mt-auto flex gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>o(`/my-templates/${s.id}/fill`),className:"flex flex-1 items-center justify-center gap-1.5 rounded-xl bg-indigo-600 py-2.5 text-xs font-bold text-white hover:bg-indigo-500",children:[e.jsx(U,{className:"size-3.5"}),t==="en"?"Use template":"Usar plantilla"]}),e.jsx("button",{type:"button",onClick:()=>f(s.id),className:"flex size-9 shrink-0 items-center justify-center rounded-xl bg-slate-50 text-slate-400 hover:text-red-600",children:e.jsx(V,{className:"size-4"})})]})]})},s.id))})]});return p?e.jsx("div",{className:"min-h-screen bg-slate-50 px-4 py-8 md:px-8",children:T}):e.jsx(Ne,{children:T})}export{wt as MyTemplatesPage};
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.