import{C as d,l as n,A as c,B as x,n as e,t as o,u as t,D as u,x as m,p as _,q as h,v as w,I as y,J as C,K as q,X as B,z as N,_ as O,g as k}from"./Button-d1z8wTLU.js";import{u as V,h as j}from"./app-DCRSamta.js";import{C as F}from"./circle-alert-CiZtsqBU.js";import{C as f}from"./circle-check-BnpJeIOu.js";import{C as R}from"./credit-card-3j0iSXvR.js";import{L as S}from"./loader-circle-BEkd_2UJ.js";const A={class:"min-h-screen bg-zinc-100 dark:bg-zinc-900"},L={class:"mx-auto max-w-md px-4 py-12 sm:px-6"},D={class:"rounded-2xl border border-zinc-200 bg-white p-6 shadow-sm dark:border-zinc-700 dark:bg-zinc-800 sm:p-8"},M={class:"mt-1 text-sm text-zinc-500 dark:text-zinc-400"},P={key:0,class:"mt-4 flex items-center gap-3 rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-800 dark:border-red-800 dark:bg-red-950/30 dark:text-red-200",role:"alert"},I={key:1,class:"mt-4 flex items-center gap-3 rounded-xl border border-emerald-200 bg-emerald-50 px-4 py-3 text-sm text-emerald-800 dark:border-emerald-800 dark:bg-emerald-950/30 dark:text-emerald-200",role:"status"},T={key:2,class:"mt-4 flex items-center gap-3 rounded-xl border border-sky-200 bg-sky-50 px-4 py-3 text-sm text-sky-800 dark:border-sky-800 dark:bg-sky-950/30 dark:text-sky-200",role:"status"},U={class:"mt-6 rounded-xl bg-zinc-50 p-4 dark:bg-zinc-800/50"},E={class:"text-2xl font-bold text-zinc-900 dark:text-white"},J={key:0,class:"mt-1 text-xs text-zinc-500 dark:text-zinc-400"},K={class:"space-y-2"},X=["value"],$={class:"font-medium text-zinc-900 dark:text-white"},ee=Object.assign({layout:null},{__name:"Show",props:{token:{type:String,required:!0},subscription:{type:Object,required:!0},product:{type:Object,required:!0},plan:{type:Object,required:!0},amount:{type:Number,required:!0},amount_brl:{type:Number,required:!0},available_payment_methods:{type:Array,default:()=>[]},saved_payment_methods:{type:Array,default:()=>[]},flash:{type:Object,default:()=>({})}},setup(a){const p=a,s=V({token:p.token,payment_method:"manual"}),b=k(()=>{const i=p.available_payment_methods||[];return i.length===0?[{id:"manual",label:"Outro (instruções por e-mail)"}]:i.map(r=>({id:r.id,label:r.label}))}),v=k(()=>new Intl.NumberFormat("pt-BR",{style:"currency",currency:"BRL"}).format(p.amount_brl));function g(){const i=b.value.find(r=>r.id===s.payment_method);s.payment_method=i?i.id:"manual",s.post("/renovar",{preserveScroll:!0})}return(i,r)=>(d(),n(y,null,[c(t(j),null,{default:x(()=>[e("title",null,"Renovar assinatura – "+o(a.product.name),1)]),_:1}),e("div",A,[e("div",L,[e("div",D,[r[3]||(r[3]=e("h1",{class:"text-xl font-semibold text-zinc-900 dark:text-white"},"Renovar assinatura",-1)),e("p",M,o(a.product.name)+" · "+o(a.plan.name),1),a.flash?.error?(d(),n("div",P,[c(t(F),{class:"h-5 w-5 shrink-0"}),u(" "+o(a.flash.error),1)])):m("",!0),a.flash?.success?(d(),n("div",I,[c(t(f),{class:"h-5 w-5 shrink-0"}),u(" "+o(a.flash.success),1)])):m("",!0),a.flash?.info?(d(),n("div",T,[c(t(f),{class:"h-5 w-5 shrink-0"}),u(" "+o(a.flash.info),1)])):m("",!0),e("div",U,[e("p",E,o(v.value),1),a.subscription.current_period_end?(d(),n("p",J," Próxima renovação: "+o(a.subscription.current_period_end),1)):m("",!0)]),e("form",{class:"mt-6 space-y-4",onSubmit:_(g,["prevent"])},[h(e("input",{"onUpdate:modelValue":r[0]||(r[0]=l=>t(s).token=l),type:"hidden",name:"token"},null,512),[[w,t(s).token]]),e("div",null,[r[2]||(r[2]=e("label",{class:"mb-2 block text-sm font-medium text-zinc-700 dark:text-zinc-300"},"Forma de pagamento",-1)),e("div",K,[(d(!0),n(y,null,C(b.value,l=>(d(),n("label",{key:l.id,class:q(["flex cursor-pointer items-center gap-3 rounded-xl border-2 px-4 py-3 transition",t(s).payment_method===l.id?"border-[var(--color-primary)] bg-[var(--color-primary)]/5 dark:bg-[var(--color-primary)]/10":"border-zinc-200 bg-white hover:border-zinc-300 dark:border-zinc-600 dark:bg-zinc-800 dark:hover:border-zinc-500"])},[h(e("input",{"onUpdate:modelValue":r[1]||(r[1]=z=>t(s).payment_method=z),type:"radio",value:l.id,class:"h-4 w-4 border-zinc-300 text-[var(--color-primary)] focus:ring-[var(--color-primary)]"},null,8,X),[[B,t(s).payment_method]]),c(t(R),{class:"h-5 w-5 text-zinc-500 dark:text-zinc-400"}),e("span",$,o(l.label),1)],2))),128))])]),c(O,{type:"submit",class:"w-full",disabled:t(s).processing},{default:x(()=>[t(s).processing?(d(),N(t(S),{key:0,class:"mr-2 h-4 w-4 animate-spin"})):m("",!0),u(" "+o(t(s).processing?"Processando…":"Pagar e renovar"),1)]),_:1},8,["disabled"])],32)])])])],64))}});export{ee as default};
