import{_ as q}from"./MemberAreaAppLayout-D_cKMjf9.js";import{l as N}from"./app-BGHbmPiW.js";import{o as P,j as V,C as s,l as c,z as D,B as z,D as d,t as n,U as I,x as m,n as e,Q as v,O as U,I as E,A as M,u as T,g as i,e as H}from"./Button-d1z8wTLU.js";import"./PwaInstallPrompt-_tJoDav2.js";import"./usePwaInstall-BhXgK-nU.js";import"./smartphone-De3EtBt6.js";import"./x-D0-XOdNy.js";import"./check-DMFnGJz1.js";import"./external-link-BSg-vtFm.js";import"./menu-CEwXRoeR.js";import"./trophy-BARwkCNT.js";import"./circle-check-big-Cx69knlP.js";import"./chevron-down-CHk_XzBd.js";import"./user-CQPrN8wc.js";import"./lock-DfRO0FW2.js";import"./circle-alert-CiZtsqBU.js";const L={class:"print-certificate-wrapper space-y-8"},W=["href"],Q={key:0,class:"pointer-events-none absolute inset-0 z-20 flex flex-col items-center justify-center rounded-2xl bg-black/60 p-6 print:hidden","aria-hidden":"true"},R={class:"flex flex-col items-center gap-3 rounded-xl bg-zinc-900/95 px-6 py-5 text-center shadow-xl"},G={class:"max-w-xs text-sm text-zinc-300"},J={class:"pointer-events-none absolute inset-0 flex items-center justify-center opacity-[0.06]",style:{"z-index":"0"}},K={class:"text-6xl font-bold whitespace-nowrap",style:{color:"var(--cert-primary)",transform:"rotate(-35deg)"}},X={class:"certificate-inner relative flex flex-col",style:{"z-index":"1"}},Y={class:"mt-6 text-center text-2xl font-bold certificate-body",style:{color:"var(--cert-title)"}},Z={class:"certificate-body mt-8 text-center",style:{color:"var(--cert-text)"}},tt={class:"mt-2"},et={class:"inline-block border-b-2 px-1 font-bold",style:{"border-color":"var(--cert-primary)",color:"var(--cert-text)"}},rt={class:"mt-3"},ot={key:0,class:"mt-2",style:{color:"var(--cert-text)",opacity:"0.9"}},it={key:1,class:"mt-2 print:hidden",style:{color:"var(--cert-text)",opacity:"0.8"}},at={class:"certificate-footer mt-12 grid grid-cols-2 gap-8 border-t pt-8",style:{"border-color":"rgba(0,0,0,0.12)",color:"var(--cert-text)"}},nt={class:"text-right"},lt={class:"font-semibold"},st={class:"flex flex-wrap justify-center gap-4 print:hidden"},zt=Object.assign({layout:q},{__name:"Certificado",props:{product:{type:Object,required:!0},config:{type:Object,default:()=>({})},certificate:{type:Object,required:!0},recipient_name:{type:String,default:""},slug:{type:String,required:!0},certificate_available:{type:Boolean,default:!1},progress_percent:{type:Number,default:0},completion_required_percent:{type:Number,default:100}},setup(r){const o=r,u=H(null),A=i(()=>o.certificate?.title||o.product?.name||""),p=i(()=>o.certificate?.platform_name||""),y=i(()=>o.certificate?.issued_at_full||o.certificate?.issued_at||""),b=i(()=>o.certificate?.primary_color||"var(--ma-primary)"),l=i(()=>o.certificate?.background_image_url||null),j=i(()=>o.certificate?.text_color||"#262626"),x=i(()=>o.certificate?.signature_font_family||"Dancing Script"),g=i(()=>{const a=x.value;return a?`https://fonts.googleapis.com/css2?family=${encodeURIComponent(a).replace(/%20/g,"+")}&display=swap`:null}),S=i(()=>l.value&&o.certificate?.background_overlay_enabled),$=i(()=>o.certificate?.background_overlay_color||"#000000"),F=i(()=>{const a=o.certificate?.background_overlay_opacity??50;return(a<=1?a*100:a)/100}),O=i(()=>u.value||(o.certificate?.print_format==="A3"?"A3":"A4")),h=i(()=>{const t=O.value==="A3",f=t?"420mm":"297mm",B=t?"297mm":"210mm",_=t?"400mm":"277mm",C=t?"277mm":"190mm";return`
@media print {
    @page {
        size: ${f} ${B};
        margin: 0;
    }
    body, body *, .print-certificate-wrapper {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }
    .print-certificate-wrapper {
        width: 100vw !important;
        height: 100vh !important;
        margin: 0 !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: #fff !important;
    }
    .certificate-print-area {
        width: ${_} !important;
        height: ${C} !important;
        max-width: ${_} !important;
        min-height: ${C} !important;
        margin: 0 !important;
        padding: 2rem !important;
        page-break-after: avoid;
        page-break-inside: avoid;
        box-sizing: border-box !important;
    }
    .certificate-print-area .certificate-inner {
        display: flex !important;
        flex-direction: column !important;
        min-height: 100% !important;
        height: 100% !important;
        box-sizing: border-box !important;
    }
    .certificate-print-area .certificate-inner .certificate-body {
        flex: 0 0 auto !important;
    }
    .certificate-print-area .certificate-footer {
        margin-top: auto !important;
        flex-shrink: 0 !important;
    }
}
`});function k(a){u.value=a==="A3"?"A3":"A4",requestAnimationFrame(()=>{window.print()})}function w(){u.value=null}return P(()=>{window.addEventListener("afterprint",w)}),V(()=>{window.removeEventListener("afterprint",w)}),(a,t)=>(s(),c("div",L,[h.value?(s(),D(I("style"),{key:0},{default:z(()=>[d(n(h.value),1)]),_:1})):m("",!0),g.value?(s(),c("link",{key:1,rel:"stylesheet",href:g.value},null,8,W)):m("",!0),t[17]||(t[17]=e("h1",{class:"text-2xl font-bold print:hidden"},"Certificado de conclusão",-1)),e("div",{class:"certificate-print-area relative mx-auto max-w-2xl overflow-hidden rounded-2xl border border-zinc-200 p-8 shadow-md dark:border-zinc-500 print:max-w-none print:rounded-none print:shadow-none",style:v({fontFamily:r.certificate.font_family||"sans-serif",backgroundColor:l.value?"transparent":"#fff",backgroundImage:l.value?`url(${l.value})`:"none",backgroundSize:l.value?"cover":void 0,backgroundPosition:l.value?"center":void 0,"--cert-primary":b.value,"--cert-text":l.value?r.certificate.text_color||"#171717":j.value,"--cert-title":l.value&&r.certificate.title_color?r.certificate.title_color:b.value})},[r.certificate_available?m("",!0):(s(),c("div",Q,[e("div",R,[t[5]||(t[5]=e("svg",{class:"h-12 w-12 text-amber-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"})],-1)),t[6]||(t[6]=e("p",{class:"text-lg font-semibold text-white"},"Certificado bloqueado",-1)),e("p",G,[t[2]||(t[2]=d(" Complete ",-1)),e("strong",null,n(r.completion_required_percent)+"%",1),t[3]||(t[3]=d(" do curso para liberar. Seu progresso: ",-1)),e("strong",null,n(r.progress_percent)+"%",1),t[4]||(t[4]=d(". ",-1))])])])),t[12]||(t[12]=e("div",{class:"absolute left-0 top-0 h-16 w-16 border-l-4 border-t-4 rounded-tl-lg",style:{"border-color":"var(--cert-primary)"},"aria-hidden":"true"},null,-1)),t[13]||(t[13]=e("div",{class:"absolute right-0 top-0 h-16 w-16 border-r-4 border-t-4 rounded-tr-lg",style:{"border-color":"var(--cert-primary)"},"aria-hidden":"true"},null,-1)),t[14]||(t[14]=e("div",{class:"absolute bottom-0 left-0 h-16 w-16 border-b-4 border-l-4 rounded-bl-lg",style:{"border-color":"var(--cert-primary)"},"aria-hidden":"true"},null,-1)),t[15]||(t[15]=e("div",{class:"absolute bottom-0 right-0 h-16 w-16 border-b-4 border-r-4 rounded-br-lg",style:{"border-color":"var(--cert-primary)"},"aria-hidden":"true"},null,-1)),S.value?(s(),c("div",{key:1,class:"pointer-events-none absolute inset-0",style:v([{"z-index":"0"},{backgroundColor:$.value,opacity:F.value}]),"aria-hidden":"true"},null,4)):m("",!0),e("div",J,[e("span",K,n(p.value),1)]),e("div",X,[t[11]||(t[11]=U('<div class="certificate-body flex flex-col items-center text-center"><div class="relative flex h-14 w-14 items-center justify-center rounded-full text-[var(--cert-primary)]"><div class="absolute inset-0 rounded-full" style="background-color:var(--cert-primary);opacity:0.15;" aria-hidden="true"></div><svg class="relative z-10 h-8 w-8" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4M7.835 4.697a3.42 3.42 0 001.946-.806 3.42 3.42 0 014.438 0 3.42 3.42 0 001.946.806 3.42 3.42 0 013.138 3.138 3.42 3.42 0 00.806 1.946 3.42 3.42 0 010 4.438 3.42 3.42 0 00-.806 1.946 3.42 3.42 0 01-3.138 3.138 3.42 3.42 0 00-1.946.806 3.42 3.42 0 01-4.438 0 3.42 3.42 0 00-1.946-.806 3.42 3.42 0 01-3.138-3.138 3.42 3.42 0 00-.806-1.946 3.42 3.42 0 010-4.438 3.42 3.42 0 00.806-1.946 3.42 3.42 0 013.138-3.138z"></path></svg></div><p class="mt-3 text-xs font-semibold uppercase tracking-[0.2em]" style="color:var(--cert-text);"> Certificado de conclusão </p></div>',1)),e("h2",Y,n(A.value),1),e("div",Z,[t[8]||(t[8]=e("p",null,"Certificamos que",-1)),e("p",tt,[e("span",et,n(r.recipient_name||"Aluno"),1)]),e("p",rt,[t[7]||(t[7]=d(" completou com sucesso o curso em ",-1)),e("strong",null,n(p.value),1)]),y.value?(s(),c("p",ot," em "+n(y.value),1)):r.certificate_available?m("",!0):(s(),c("p",it," em -- "))]),e("div",at,[e("div",null,[t[9]||(t[9]=e("p",{class:"text-xs font-medium uppercase tracking-wide",style:{opacity:"0.85"}},"Assinatura do Instrutor",-1)),e("p",{class:"mt-1 font-medium",style:v({fontFamily:x.value,color:"var(--cert-text)"})},n(r.certificate.signature_text||"Instrutor"),5)]),e("div",nt,[e("p",lt,n(p.value),1),t[10]||(t[10]=e("p",{class:"text-sm",style:{opacity:"0.85"}},"Plataforma de Cursos",-1))])])])],4),e("div",st,[r.certificate_available?(s(),c(E,{key:0},[e("button",{type:"button",class:"rounded-xl px-5 py-2.5 text-sm font-semibold text-white shadow transition hover:opacity-95",style:{"background-color":"var(--ma-primary)"},onClick:t[0]||(t[0]=f=>k("A4"))}," Salvar PDF A4 "),e("button",{type:"button",class:"rounded-xl border-2 px-5 py-2.5 text-sm font-semibold transition hover:opacity-95",style:{"border-color":"var(--ma-primary)",color:"var(--ma-primary)"},onClick:t[1]||(t[1]=f=>k("A3"))}," Salvar PDF A3 ")],64)):m("",!0),M(T(N),{href:`/m/${r.slug}`,class:"rounded-xl border-2 px-5 py-2.5 text-sm font-medium transition hover:opacity-90",style:{"border-color":"var(--ma-primary)",color:"var(--ma-primary)"}},{default:z(()=>[...t[16]||(t[16]=[d(" Voltar à área de membros ",-1)])]),_:1},8,["href"])])]))}});export{zt as default};
