import{_ as m,h as _}from"./app-DsGfdhEg.js";import{o as f,C as s,l,A as p,u as g,n,t as y,x as h,H as w,e as u}from"./Button-C102TjBP.js";const v={class:"min-h-screen bg-gray-100 flex flex-col items-center justify-center p-6"},b={class:"w-full max-w-sm rounded-2xl border border-gray-200 bg-white p-8 shadow-lg text-center"},x={class:"text-gray-700 font-medium"},C={key:0,class:"mt-4 flex justify-center"},E=Object.assign({layout:null},{__name:"CardConfirm",props:{client_secret:{type:String,required:!0},return_url:{type:String,default:"/"},stripe_publishable_key:{type:String,default:""}},setup(c){const e=c,r=u("loading"),t=u("Confirmando pagamento...");return f(async()=>{if(!e.stripe_publishable_key?.trim()||!e.client_secret?.trim()){r.value="error",t.value="Configuração inválida. Redirecionando.",setTimeout(()=>{window.location.href=e.return_url||"/"},2e3);return}try{const{loadStripe:o}=await m(async()=>{const{loadStripe:d}=await import("./index-BGiJ-87v.js");return{loadStripe:d}},[]),a=await o(e.stripe_publishable_key.trim());if(!a)throw new Error("Stripe não carregou");const{error:i}=await a.confirmCardPayment(e.client_secret);if(i){t.value=i.message||"Falha na confirmação.",r.value="error",setTimeout(()=>{window.location.href=e.return_url||"/"},3e3);return}r.value="success",t.value="Pagamento confirmado! Redirecionando...",window.location.href=e.return_url||"/"}catch(o){r.value="error",t.value=o?.message||"Erro ao confirmar. Redirecionando.",setTimeout(()=>{window.location.href=e.return_url||"/"},3e3)}}),(o,a)=>(s(),l(w,null,[p(g(_),{title:"Confirmar pagamento"}),n("div",v,[n("div",b,[n("p",x,y(t.value),1),r.value==="loading"?(s(),l("div",C,[...a[0]||(a[0]=[n("span",{class:"inline-block h-8 w-8 animate-spin rounded-full border-2 border-gray-300 border-t-gray-600"},null,-1)])])):h("",!0)])])],64))}});export{E as default};
