PageSourceSearch

https://sabhia.ai/assets/checkout-PKRrlTrL.js

js sabhia.ai collected 2026-10-05 12:34:04 UTC 129,447 bytes, 1 lines download raw bytes

1import{a as vs,j as e,A as js,m as Ea}from"./vendor-motion-CPxq9Xvn.js";import{r as n,u as bt}from"./vendor-i18n-CO3kK2bH.js";import{Y as ws,S as De,K as Xe,a7 as U,A as Pe,ap as F,aa as Wa,l as at,a5 as ys,aq as Ns,a2 as ks,a1 as Cs,eV as _s,c as Ss,d as Ps,s as Is,bM as As,bL as Ts,bN as Es,bO as Os,eW as Bs,eX as $s,eY as Rs,bK as Ls,bI as Ms,eZ as Oa,e_ as zs,e$ as Ba,f0 as $a,f as Le,B as Ut,ao as Me,b as ht,a as qs,f1 as Us,C as Fe,N as Ue,i as Ra,X as ea,ab as La,V as Ds,P as ta,e as Dt,G as Ft,Z as Xt,D as Fs,q as Xs,aj as Vs,r as Hs,al as Ks,ah as Gs,ae as Ws,af as Js,ag as Qs,e1 as Zs,ax as Ys}from"./index-CFAvyuXu.js";import{t as Ma}from"./funnelReplayMilestones-CwHjpBBb.js";import{P as er}from"./pix-qr-image-D45mJvPS.js";import{t as ft}from"./umami-Dn1fY-Xd.js";import{i as ze,g as Vt,b as gt,d as za,T as qa,P as ie}from"./pricing-CEwbcjb3.js";import{A as Ua}from"./AsaasCardForm-BxkUkrK1.js";import{E as tr,i as Ht,n as Kt,C as Da,O as Gt}from"./OrderBumpPrice-BwfzT5fw.js";import{v as ar,f as sr}from"./cpf-uNBOM1K4.js";import{L as rr}from"./log-in-BWcU6fvU.js";import{M as Ja}from"./megaphone-CJoAWoYP.js";import{G as Qa}from"./globe-D0MKCb1Y.js";import"./vendor-react-CQmBMThG.js";import"./circle-alert-CixghSwT.js";function or({storageKey:i,title:l="Espere — você está quase lá",message:_="Seu progresso está salvo. Falta pouco para o seu livro ganhar vida.",bullets:A=["Pagamento 100% seguro","Garantia de satisfação","Suporte humano de verdade"],ctaLabel:y="Continuar de onde parei",enabled:S=!0,pixOffer:j=!1,customerName:T,bookTitle:r,pixData:R,preparing:N=!1,error:z,onOfferShown:k,onPreparePix:B}){const[h,$]=n.useState(!1),[Z,ne]=n.useState(!1),fe=n.useRef(!1),le=n.useRef(null),V=n.useRef(null),we=vs(),ce=`sb_exit_intent_${i}_v1`,Ie=T?.trim().split(/\s+/)[0]||"autor",de=R?.qrCode?.trim()||"",Ve=j||R!=null||N||!!z||!!B;n.useEffect(()=>{if(!S)return;try{if(sessionStorage.getItem(ce)==="1"){fe.current=!0;return}}catch{}if(window.matchMedia?.("(pointer: coarse)").matches)return;const L=()=>
1{if(!fe.current){fe.current=!0;try{sessionStorage.setItem(ce,"1")}catch{}V.current=document.activeElement,$(!0),Ve&&k?.()}},H=Y=>{!Y.relatedTarget&&Y.clientY<=4&&L()},E=window.setTimeout(()=>document.addEventListener("mouseout",H),6e3);return()=>{window.clearTimeout(E),document.removeEventListener("mouseout",H)}},[S,ce,Ve,k]),n.useEffect(()=>{if(!h)return;le.current?.focus();const L=H=>{if(H.key==="Escape"){H.preventDefault(),$(!1);return}if(H.key!=="Tab")return;const E=document.querySelector("[data-testid='exit-intent-modal']");if(!E)return;const Y=Array.from(E.querySelectorAll("button, [href], input, textarea, [tabindex]:not([tabindex='-1'])")).filter(K=>!K.hasAttribute("disabled"));if(!Y.length)return;const X=Y.indexOf(document.activeElement),jt=H.shiftKey?X<=0?Y.length-1:X-1:X===Y.length-1?0:X+1;H.preventDefault(),Y[jt].focus()};return document.addEventListener("keydown",L),()=>document.removeEventListener("keydown",L)},[h]),n.useEffect(()=>{h||V.current?.focus?.()},[h]);async function st(){if(de)try{if(navigator.clipboard?.writeText)await navigator.clipboard.writeText(de);else{const L=document.createElement("textarea");L.value=de,L.style.position="fixed",L.style.opacity="0",document.body.appendChild(L),L.select(),document.execCommand("copy"),L.remove()}ne(!0),window.setTimeout(()=>ne(!1),2200)}catch{ne(!1)}}const ge=()=>$(!1),vt=we?{duration:0}:{type:"spring",duration:.4};return e.jsx(js,{children:h&&e.jsxs(Ea.div,{className:"fixed inset-0 z-[100] flex items-center justify-center overflow-y-auto p-3 sm:p-6",initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},"data-testid":"exit-intent-overlay",children:[e.jsx("div",{className:"absolute inset-0 bg-[#03161b]/80 backdrop-blur-md",onClick:ge,"data-testid":"exit-intent-backdrop"}),e.jsxs(Ea.div,{role:"dialog","aria-modal":"true","aria-labelledby":"exit-intent-heading",initial:we?void 0:{opacity:0,scale:.94,y:16},animate:{opacity:1,scale:1,y:0},exit:we?void 0:{opacity:0,scale:.96,y:10},transition:vt,className:`relative my-auto w-full overflow-hidden rounded-[28px] border border-[#f5cc62]/25 bg-[#071f27] text-[#effffb] shadow-[0_30px_100px_rgba(0,0,0,.55)] ${j?"max-w-2xl":"max-w-md"}`,"data-testid":"exit-intent-modal",children:[e.jsx("div",{className:"absolute inset-x-0 top-0 h-px bg-gradient-to-r from-transparent via-[#f5cc62] to-transparent"}),e.jsx("button",{ref:le,type:"button",onClick:ge,"aria-label":"Fechar",className:"absolute right-3 top-3 z-10 rounded-full p-2 text-[#8eaeae] transition hover:bg-white/10 hover:text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#f5cc62]",children:e.jsx(ws,{className:"h-5 w-5","aria-hidden":"true"})}),Ve?e.jsxs("div",{className:"relative grid gap-6 p-5 sm:p-8 md:grid-cols-[.85fr_1.15fr]",children:[e.jsxs("div",{children:[e.jsx("span",{className:"mb-5 flex h-12 w-12 items-center justify-center rounded-2xl border border-[#f5cc62]/35 bg-[#f5cc62]/10 text-[#f5cc62]",children:e.jsx(De,{className:"h-6 w-6","aria-hidden":"true"})}),e.jsx("p",{className:"text-[10px] font-black uppercase tracking-[.22em] text-[#f5cc62]",children:"Oferta de continuidade"}),e.jsxs("h2",{id:"exit-intent-heading",className:"mt-3 text-3xl font-bold leading-[.98] tracking-[-.05em] sm:text-4xl",children:["Oi, ",Ie,"."]}),e.jsxs("p",{className:"mt-4 text-sm leading-6 text-[#b9d3d0]",children:["Coloque ",e.jsx("strong",{className:"text-white",children:r||"seu livro"})," publicado e vendendo em menos de 1 hora."]}),e.jsxs("div",{className:"mt-6 rounded-2xl border border-[#f5cc62]/35 bg-[#f5cc62]/[.09] p-4",children:[e.jsx("p",{className:"text-[10px] font-black uppercase tracking-[.18em] text-[#d8c47d]",children:"Pague este PIX e ganhe"}),e.jsx("p",{className:"mt-2 text-3xl font-black text-[#f5cc62]",children:"R$ 30 em créditos"}),e.jsx("p",{className:"mt-1 text-sm font-semibold text-[#e8eee2]",children:"3.000 créditos liberados após a confirmação"})]}),e.jsxs("div",{className:"mt-4 flex items-center gap-2 text-xs text-[#a6c3be]",children:[e.jsx(Xe,{className:"h-4 w-4 text-[#9af4e5]","aria-hidden":"true"})," Checkout protegido e confirmação automática"]})]}),e.jsx("div",{children:N?e.jsxs("div",{className:"flex min-h-[330px] flex-col items-center justify-center rounded-2xl border border-[#9af4e5]/20 bg-[#0b3038] text-center",children:[e.jsx(U,{className:"h-7 w-7 animate-spin text-[#f5cc62]","aria-hidden":"true"}),e.jsx("p",{className:"mt-4 text-sm font-semibold",children:"Preparando seu PIX seguro…"}),e.jsx("p",{className:"mt-2 text-xs text-[#91afb3]",children:"Isso leva só alguns segundos."})]}):z?e.jsxs("div",{className:"flex min-h-[330px] flex-col items-center justify-center rounded-2xl border border-red-300/25 bg-red-950/20 p-6 text-center",children:[e.jsx("p",{className:"text-sm font-semibold text-[#ffd8d2]",children:z}),B&&e.jsxs("button",{type:"button",onClick:B,className:"mt-5 inline-flex items-center gap-2 rounded-xl bg-[#f5cc62] px-5 py-3 text-sm font-black text-[#18343a] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white",children:["Tentar novamente ",e.jsx(Pe,{className:"h-4 w-4"})]})]}):de?e.jsxs("div",{className:"rounded-2xl border border-[#9af4e5]/20 bg-[#0b3038] p-4 sm:p-5",children:[e.jsx("div",{className:"mx-auto flex w-fit rounded-xl bg-white p-3",children:e.jsx(er,{brCode:de,qrCodeImage:R?.imageUrl,alt:"QR Code para pagamento PIX",className:"h-44 w-44 sm:h-52 sm:w-52"})}),e.jsx("label",{htmlFor:"pix-code",className:"mt-4 block text-[10px] font-black uppercase tracking-[.16em] text-[#8fb9b8]",children:"Código PIX copia e cola"}),e.jsx("textarea",{id:"pix-code",readOnly:!0,value:de,rows:3,className:"mt-2 w-full resize-none rounded-xl border border-[#9af4e5]/20 bg-[#061f27] p-3 text-xs leading-5 text-[#d7ebe5] outline-none focus:border-[#f5cc62]"}),e.jsx("button",{type:"button",onClick:st,className:"mt-3 flex w-full items-center justify-center gap-2 rounded-xl bg-[#f5cc62] px-5 py-3.5 text-sm font-black text-[#18343a] transition hover:-translate-y-0.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white",children:Z?e.jsxs(e.Fragment,{children:[e.jsx(F,{className:"h-4 w-4"})," Código copiado"]}):e.jsxs(e.Fragment,{children:[e.jsx(Wa,{className:"h-4 w-4"})," Copiar código PIX"]})})]}):e.jsxs("div",{className:"flex min-h-[330px] flex-col items-center justify-center rounded-2xl border border-dashed border-[#9af4e5]/25 bg-[#0b3038] p-6 text-center",children:[e.jsx(at,{className:"h-7 w-7 text-[#f5cc62]","aria-hidden":"true"}),e.jsx("p",{className:"mt-4 text-sm font-semibold",children:"Seu PIX está quase pronto"}),B&&e.jsx("button",{type:"button",onClick:B,className:"mt-5 rounded-xl bg-[#f5cc62] px-5 py-3 text-sm font-black text-[#18343a] focu
1s-visible:outline-none focus-visible:ring-2 focus-visible:ring-white",children:"Preparar pagamento"})]})})]}):e.jsxs("div",{className:"relative p-6 text-center sm:p-7",children:[e.jsx("span",{className:"mx-auto mb-4 flex h-14 w-14 items-center justify-center rounded-2xl bg-[#f5cc62]/15 ring-1 ring-[#f5cc62]/25",children:e.jsx(De,{className:"h-7 w-7 text-[#f5cc62]","aria-hidden":"true"})}),e.jsx("h2",{id:"exit-intent-heading",className:"text-xl font-extrabold text-white","data-testid":"text-exit-intent-title",children:l}),e.jsx("p",{className:"mt-2 text-sm leading-relaxed text-[#c0d3d0]",children:_}),e.jsx("div",{className:"mt-5 grid gap-2 text-left",children:A.map((L,H)=>e.jsxs("div",{className:"flex items-center gap-2.5 rounded-xl bg-white/[.04] px-3 py-2 ring-1 ring-white/5",children:[e.jsx(Xe,{className:"h-4 w-4 shrink-0 text-[#9af4e5]","aria-hidden":"true"}),e.jsx("span",{className:"text-[13px] text-[#e0ece8]",children:L})]},L))}),e.jsxs("button",{type:"button",onClick:ge,className:"mt-6 flex w-full items-center justify-center gap-2 rounded-xl bg-[#f5cc62] px-5 py-3.5 text-sm font-extrabold uppercase tracking-wide text-[#18343a] transition hover:-translate-y-0.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white","data-testid":"button-continue-exit-intent",children:[y,e.jsx(Pe,{className:"h-4 w-4"})]})]})]})]})})}function Wt(i){return i.paymentMethod==="credits"}function ir({pixContent:i,greeting:l,promise:_}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{"data-testid":"pix-first-primary-payment",children:i}),e.jsxs("div",{className:"mb-5 mt-5 rounded-xl border border-amber-400/20 bg-amber-400/[0.05] px-4 py-3","aria-live":"polite","data-testid":"pix-first-greeting",children:[e.jsx("p",{className:"text-sm font-semibold text-amber-100",children:l}),e.jsx("p",{className:"mt-1 text-xs leading-5 text-white/60",children:_})]})]})}const Jt=[{pt:"Manuscrito completo (100-130 páginas)",en:"Complete manuscript (100-130 pages)",essencial:!0,profissional:!0,premium:!0},{pt:"Capítulos estruturados pelo time editorial SÁBHIA",en:"Chapters structured by the SÁBHIA editorial team",essencial:!0,profissional:!0,premium:!0},{pt:"Estilo e tom personalizados ao seu gênero",en:"Style and tone personalized to your genre",essencial:!0,profissional:!0,premium:!0},{pt:"Revisão editorial automatizada",en:"Automated editorial review",essencial:!0,profissional:!0,premium:!0},{pt:"Arquivos PDF, DOCX e EPUB inclusos",en:"PDF, DOCX and EPUB files included",essencial:!0,profissional:!0,premium:!0},{pt:"100% dos direitos autorais são seus",en:"100% of copyright is yours",essencial:!0,profissional:!0,premium:!0},{pt:"4 opções de capa profissional pela SÁBHIA",en:"4 professional cover options by SÁBHIA",essencial:!1,profissional:!0,premium:!0},{pt:"Capa pronta para publicar na Amazon KDP",en:"Cover ready to publish on Amazon KDP",essencial:!1,profissional:!0,premium:!0},{pt:"1 ilustração exclusiva por capítulo",en:"1 exclusive illustration per chapter",essencial:!1,profissional:!1,premium:!0},{pt:"Estilo artístico personalizado ao seu livro",en:"Art style personalized to your book",essencial:!1,profissional:!1,premium:!0},{pt:"Guia passo a passo para registrar seu ISBN",en:"Step-by-step guide to register your ISBN",essencial:!1,profissional:!1,premium:!0},{pt:"Sinopse profissional escrita pela SÁBHIA",en:"Professional synopsis written by SÁBHIA",essencial:!1,profissional:!1,premium:!0},{pt:"Metadados otimizados para ranqueamento Amazon",en:"Metadata optimized for Amazon ranking",essencial:!1,profissional:!1,premium:!0},{pt:"Categorias e palavras-chave de bestseller",en:"Bestseller categories and keywords",essencial:!1,profissional:!1,premium:!0},{pt:"Kit completo de posts para Instagram",en:"Complete kit of Instagram posts",essencial:!1,profissional:!1,premium:!0},{pt:"Banners e capas para redes sociais",en:"Banners and social media covers",essencial:!1,profissional:!1,premium:!0},{pt:"Stories prontos para divulgar",en:"Ready-to-share Stories",essencial:!1,profissional:!1,premium:!0},{pt:"Sequência de e-mail para seus leitores",en:"Email sequence for your readers",essencial:!1,profissional:!1,premium:!0}],Qt={_default:{emoji:"🏦",title:"Cartão recusado pelo banco",cause:"O banco bloqueou automaticamente esta transação. Isso é muito comum em compras online de valor mais alto — é uma proteção automática que você pode resolver em poucos minutos.",steps:['Ligue para o número no verso do cartão e diga: "Quero autorizar uma compra online da SÁBHIA Books"',"Volte aqui e tente o pagamento novamente — geralmente funciona na segunda tentativa","Ou use outro cartão de crédito ou débito"]},generic_decline:{emoji:"🏦",title:"Cartão recusado pelo banco",cause:"O banco bloqueou esta transação automaticamente. Isso acontece por limite de compras online, antifraude ou bloqueio de parcelamento de valor alto — e é facilmente resolvido.",steps:["📞 Ligue para o banco (número no verso do cartão) e peça para autorizar a compra","🔄 Volte aqui e tente novamente — costuma funcionar na hora","💳 Ou tente outro cartão (qualquer crédito ou débito)"]},do_not_honor:{emoji:"🏦",title:"Banco não autorizou a compra",cause:"Seu banco recusou a transação sem dar detalhes — geralmente é proteção automática para compras online. A boa notícia é que isso se resolve com uma ligação rápida.",steps:['📞 Ligue para o banco (número no verso do cartão) e diga: "Quero liberar uma compra online"',"🔄 Tente o pagamento novamente aqui após falar com o banco","📲 Ou pague agora via PIX — aprovação imediata, sem burocracia"]},call_issuer:{emoji:"📞",title:"Banco pediu para entrar em contato",cause:"Seu banco sinalizou que precisa falar com você antes de autorizar esta compra. É rápido!",steps:["📞 Ligue agora para o banco (número no verso do cartão)","✅ Autorize a compra e volte aqui para tentar novamente","📲 Ou pague via PIX enquanto isso — nenhuma ligação necessária"]},card_declined:{emoji:"🏦",title:"Cartão recusado pelo banco",cause:"O banco recusou esta transação. Isso pode ser por limite, antifraude ou bloqueio para compras online.",steps:["📞 Ligue para o banco e peça para autorizar a compra online","🔄 Tente novamente ou use outro cartão","📲 Pague via PIX — sem risco de recusa, aprovação na hora"]},insufficient_funds:{emoji:"💳",title:"Limite insuficiente no cartão",cause:"Seu cartão não tem limite ou saldo disponível suficie
1nte para esta compra no momento.",steps:["💳 Tente com outro cartão que tenha limite disponível","📲 Pague via PIX — sem precisar de limite, aprovação imediata","📞 Ou ligue para o banco para verificar se há possibilidade de aumento temporário"]},incorrect_cvc:{emoji:"🔐",title:"Código de segurança (CVV) incorreto",cause:"O código de 3 dígitos digitado não confere com o cartão.",steps:["🔍 Localize o código de 3 dígitos no verso do cartão (em cartões Amex: 4 dígitos na frente)","✏️ Corrija o código aqui e tente novamente","📲 Se preferir, pague via PIX — não precisa de CVV"]},invalid_cvc:{emoji:"🔐",title:"Código de segurança (CVV) inválido",cause:"O código CVV digitado não é válido para este cartão.",steps:["🔍 Verifique o código de 3 dígitos no verso do cartão","✏️ Corrija e tente novamente","📲 Ou pague via PIX — simples e sem CVV"]},incorrect_number:{emoji:"🔢",title:"Número do cartão inválido",cause:"O número de cartão digitado contém algum erro.",steps:["🔍 Confira o número de 16 dígitos impresso na frente do cartão","✏️ Corrija os números e tente novamente","📲 Ou use PIX — bem mais simples que digitar dados do cartão"]},invalid_number:{emoji:"🔢",title:"Número do cartão inválido",cause:"O número digitado não passou na validação do cartão.",steps:["🔍 Verifique cuidadosamente os 16 dígitos na frente do cartão","✏️ Digite novamente com atenção, sem espaços extras","📲 Ou pague via PIX para evitar preenchimento de dados"]},invalid_expiry_month:{emoji:"📅",title:"Mês de vencimento inválido",cause:"O mês de validade digitado não é válido (deve ser de 01 a 12).",steps:["📅 Verifique o mês de vencimento impresso no cartão (ex: 05 para maio)","✏️ Corrija e tente novamente"]},invalid_expiry_year:{emoji:"📅",title:"Ano de vencimento inválido",cause:"O ano de validade digitado não confere com o cartão.",steps:["📅 Verifique o ano de vencimento impresso no cartão","✏️ Corrija o ano e tente novamente"]},expired_card:{emoji:"⏰",title:"Cartão vencido",cause:"Este cartão está fora do prazo de validade e não pode mais ser usado.",steps:["💳 Use um cartão dentro da validade","📲 Ou pague via PIX — instantâneo e sem precisar de cartão","📞 Se precisar de ajuda, fale com a gente no chat"]},new_account_information_available:{emoji:"⏰",title:"Dados do cartão desatualizados",cause:"Este cartão foi renovado ou substituído e os dados precisam ser atualizados.",steps:["💳 Use o novo cartão que o banco enviou","📲 Ou pague via PIX — mais fácil e sem precisar do cartão novo"]},authentication_required:{emoji:"🔒",title:"Banco pede confirmação extra",cause:"Seu banco ativou a autenticação 3D Secure para esta compra — é uma proteção adicional.",steps:["🔄 Clique em tentar novamente — seu banco vai enviar um SMS ou notificação no app","📱 Abra o app do banco ou verifique o SMS e aprove a transação","✅ Após confirmar no banco, o pagamento é concluído automaticamente","📲 Ou pague via PIX para evitar essa etapa completamente"]},approve_with_id:{emoji:"🔒",title:"Banco requer verificação de identidade",cause:"Seu banco exige uma confirmação extra para aprovar esta compra.",steps:["📱 Abra o app do banco e procure por confirmação de compra pendente","✅ Aprove a transação e tente novamente aqui","📲 Ou pague via PIX — sem verificação adicional"]},card_velocity_exceeded:{emoji:"⚡",title:"Muitas tentativas em sequência",cause:"Seu cartão foi temporariamente bloqueado por excesso de tentativas em pouco tempo — é uma proteção automática do banco.",steps:["⏳ Aguarde 10 a 15 minutos antes de tentar novamente","📲 Ou pague agora via PIX — aprovação imediata, sem essa limitação"]},withdrawal_count_limit_exceeded:{emoji:"⚡",title:"Limite de transações atingido",cause:"Seu cartão atingiu o limite de transações permitidas pelo banco por hoje.",steps:["⏳ Tente novamente amanhã ou use outro cartão","📲 Pague via PIX agora — sem limite de tentativas"]},do_not_try_again:{emoji:"🔒",title:"Compras online bloqueadas neste cartão",cause:"Este cartão está configurado para não aceitar compras pela internet.",steps:["📞 Ligue para o banco e peça para habilitar compras online neste cartão","💳 Ou use outro cartão que aceite compras online","📲 Pague via PIX — sem restrições, aprovação na hora"]},card_not_supported:{emoji:"💳",title:"Tipo de cartão não suportado",cause:"Este tipo de cartão (ex: pré-pago ou corporativo com restrição) não é aceito para esta transação.",steps:["💳 Use um cartão de crédito ou débito pessoal padrão","📲 Ou pague via PIX — aceito de qualquer banco, sem restrições"]},currency_not_supported:{emoji:"💳",title:"Moeda não suportada pelo cartão",cause:"Seu cartão não está habilitado para transações nesta moeda.",steps:["💳 Use um cartão habilitado para compras em reais (BRL)","📲 Ou pague via PIX — simples, rápido e sem restrições de moeda"]},processing_error:{emoji:"⚙️",title:"Erro temporário de processamento",cause:"Houve um problema técnico momentâneo com a operadora de pagamento. Não é problema no seu cartão!",steps:["🔄 Aguarde alguns segundos e clique em tentar novamente","📲 Ou garanta sua compra agora via PIX — sem chance de erro técnico"]},try_again_later:{emoji:"⚙️",title:"Serviço temporariamente indisponível",cause:"A operadora está com instabilidade no momento. Seu cartão está ok — é algo passageiro.",steps:["🔄 Aguarde 2 a 3 minutos e tente novamente","📲 Ou pague agora via PIX para garantir sua compra sem esperar"]},lost_card:{emoji:"🚨",title:"Cartão bloqueado por segurança",cause:"Este cartão consta como perdido no sistema do banco.",steps:["💳 Use outro cartão válido","📲 Ou pague via PIX — sem precisar de cartão","📞 Entre em contato com seu banco para regularizar a situação do cartão"]},stolen_card:{emoji:"🚨",title:"Cartão bloqueado por segurança",cause:"Este cartão está bloqueado por medidas de segurança.",steps:["💳 Use outro cartão válido","📲 Ou pague via PIX — rápido e seguro","📞 Entre em contato com seu banco para maiores informações"]},pickup_card:{emoji:"🚨",title:"Cartão bloqueado pelo banco",cause:"Seu banco sinalizou uma restrição especial neste cartão.",steps:["📞 Entre em contato com seu banco para entender a situação","💳 Use outro cartão enquanto isso","📲 Ou pague via PIX — nenhuma restrição, aprovação imediata"]},fraudulent:{emoji:"🔒",title:"Transação não autorizada",cause:"O banco não autorizou esta transação por razões de segurança.",steps:["💳 Tente com outro cartão","📲 Pague via PIX — simples e sem possibilidade de recusa","📞 Em caso de dúv
1ida, entre em contato com a gente pelo chat"]},not_permitted:{emoji:"🚫",title:"Transação não permitida neste cartão",cause:"Este tipo de compra não é permitida para este cartão específico.",steps:["💳 Tente com outro cartão (crédito pessoal costuma funcionar)","📲 Ou pague via PIX — sem restrições de tipo de transação"]},service_not_allowed:{emoji:"🚫",title:"Serviço não permitido neste cartão",cause:"Este cartão tem restrições que impedem este tipo de pagamento.",steps:["💳 Use outro cartão de crédito ou débito","📲 Pague via PIX — a forma mais simples e sem restrições"]},transaction_not_allowed:{emoji:"🚫",title:"Transação não permitida",cause:"O banco não permite este tipo de transação com o cartão informado.",steps:["💳 Tente com outro cartão","📲 Ou pague via PIX — aprovado na hora"]},restricted_card:{emoji:"🔒",title:"Cartão com restrições",cause:"Este cartão tem limitações que impedem esta compra.",steps:["💳 Use outro cartão sem restrições","📲 Pague via PIX — sem complicação","📞 Ligue para o banco para saber mais sobre as restrições"]},revocation_of_authorization:{emoji:"🏦",title:"Autorização revogada pelo banco",cause:"O banco cancelou a autorização desta transação.",steps:["📞 Ligue para o banco e peça para liberar a compra","🔄 Tente novamente após falar com o banco","📲 Ou pague via PIX agora mesmo"]},revocation_of_all_authorizations:{emoji:"🏦",title:"Cartão cancelado pelo banco",cause:"Todas as autorizações deste cartão foram revogadas pelo banco.",steps:["💳 Use outro cartão válido","📲 Ou pague via PIX — sem precisar de cartão","📞 Contate o banco para regularizar o cartão"]},invalid_account:{emoji:"💳",title:"Conta do cartão inválida",cause:"A conta associada a este cartão não está ativa ou válida.",steps:["💳 Use outro cartão válido","📲 Pague via PIX — mais simples e sem essas restrições"]},security_violation:{emoji:"🔒",title:"Verificação de segurança não passou",cause:"O banco detectou algo incomum e bloqueou por precaução.",steps:["📞 Ligue para o banco para confirmar que é você fazendo a compra","🔄 Tente novamente após confirmar","📲 Ou pague via PIX — zero burocracia"]},no_action_taken:{emoji:"🏦",title:"Banco não respondeu a solicitação",cause:"Seu banco não processou a solicitação neste momento.",steps:["🔄 Tente novamente em alguns instantes","📞 Se persistir, ligue para o banco","📲 Ou pague via PIX para garantir agora"]}};function nr(i){return i&&Qt[i]?Qt[i]:Qt._default}function Fa({declineCode:i,paymentError:l,onPixFallback:_,isBrazil:A}){const y=nr(i);return e.jsxs("div",{className:"mb-5 space-y-3","data-testid":"text-payment-error",children:[e.jsxs("div",{className:"bg-red-500/8 border border-red-500/20 rounded-2xl overflow-hidden",children:[e.jsxs("div",{className:"flex items-start gap-3 p-4 pb-3",children:[e.jsx("div",{className:"w-9 h-9 rounded-full bg-red-500/15 flex items-center justify-center flex-shrink-0 text-lg leading-none",children:y.emoji}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-bold text-red-300 leading-snug",children:y.title}),e.jsx("p",{className:"text-xs text-red-400/70 mt-1 leading-relaxed",children:y.cause})]})]}),e.jsxs("div",{className:"mx-4 mb-4 bg-black/20 rounded-xl p-3 space-y-2.5",children:[e.jsx("p",{className:"text-[10px] font-bold text-red-300/60 uppercase tracking-widest mb-1",children:"O que fazer agora:"}),y.steps.map((S,j)=>e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx("span",{className:"w-5 h-5 rounded-full bg-red-500/20 text-red-300 text-[10px] font-bold flex items-center justify-center flex-shrink-0 mt-0.5",children:j+1}),e.jsx("p",{className:"text-xs text-red-200/80 leading-relaxed",children:S})]},j))]}),e.jsx("div",{className:"px-4 pb-4",children:e.jsx("p",{className:"text-[11px] text-red-400/50 text-center leading-relaxed",children:"💬 Estamos aqui para ajudar! Clique no ícone de chat no canto da tela"})})]}),A&&e.jsxs("button",{"data-testid":"button-pix-fallback",onClick:_,className:"w-full py-4 bg-gradient-to-r from-emerald-500 to-teal-500 hover:from-emerald-400 hover:to-teal-400 text-white font-extrabold text-sm rounded-2xl transition-all duration-300 flex items-center justify-center gap-3 shadow-xl shadow-emerald-500/25 hover:shadow-emerald-500/35 hover:scale-[1.01] active:scale-[0.99]",children:[e.jsx("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"
1currentColor",children:e.jsx("path",{d:"M17.66 7.93L14.76 5.03C14.37 4.64 13.74 4.64 13.35 5.03L12 6.38 10.65 5.03C10.26 4.64 9.63 4.64 9.24 5.03L6.34 7.93C5.95 8.32 5.95 8.95 6.34 9.34L9.24 12.24 6.34 15.14C5.95 15.53 5.95 16.16 6.34 16.55L9.24 19.45C9.63 19.84 10.26 19.84 10.65 19.45L12 18.1 13.35 19.45C13.74 19.84 14.37 19.84 14.76 19.45L17.66 16.55C18.05 16.16 18.05 15.53 17.66 15.14L14.76 12.24 17.66 9.34C18.05 8.95 18.05 8.32 17.66 7.93Z"})}),"PAGAR VIA PIX — APROVAÇÃO GARANTIDA",e.jsx(Pe,{className:"w-4 h-4"})]})]})}const Zt={card_declined:"Seu cartão foi recusado. Tente outro cartão ou pague via PIX.",insufficient_funds:"Saldo insuficiente. Tente outro cartão ou pague via PIX — é instantâneo!",expired_card:"Cartão expirado. Use outro cartão ou pague via PIX.",incorrect_cvc:"Código de segurança incorreto. Verifique o CVV atrás do cartão.",incorrect_number:"Número do cartão inválido. Confira os dados e tente novamente.",processing_error:"Erro temporário na operadora. Tente novamente ou pague via PIX.",generic_decline:"Pagamento não autorizado pelo banco. Tente outro cartão ou PIX.",fraudulent:"Pagamento não autorizado. Tente outro cartão ou pague via PIX.",lost_card:"Cartão reportado como perdido. Use outro cartão ou pague via PIX.",stolen_card:"Cartão não autorizado. Use outro cartão ou pague via PIX.",authentication_required:"Seu banco requer autenticação. Tente novamente ou use PIX.",approve_with_id:"Banco requer verificação. Tente novamente ou pague via PIX.",call_issuer:"Banco solicitou contato. Tente outro cartão ou pague via PIX.",do_not_honor:"Pagamento não autorizado. Tente outro cartão ou PIX — sem burocracia!",do_not_try_again:"Cartão bloqueado para compras online. Use outro cartão ou PIX.",invalid_account:"Conta do cartão inválida. Tente outro cartão ou PIX.",new_account_information_available:"Dados do cartão desatualizados. Use outro cartão ou PIX.",no_action_taken:"Banco não autorizou. Tente outro cartão ou pague via PIX.",not_permitted:"Tipo de transação não permitida. Tente outro cartão ou PIX.",restricted_card:"Cartão com restrições. Use outro cartão ou pague instantaneamente via PIX.",revocation_of_all_authorizations:"Cartão cancelado. Use outro cartão ou pague via PIX.",revocation_of_authorization:"Autorização revogada. Use outro cartão ou PIX.",security_violation:"Violação de segurança detectada. Use outro cartão ou PIX.",service_not_allowed:"Serviço não permitido neste cartão. Tente outro ou use PIX.",transaction_not_allowed:"Transação não permitida. Tente outro cartão ou PIX.",try_again_later:"Erro temporário. Tente novamente em alguns minutos ou pague via PIX agora.",withdrawal_count_limit_exceeded:"Limite de transações atingido. Tente amanhã ou pague via PIX."};function lr(i){if(!i)return"Erro no pagamento. Tente novamente ou pague via PIX.";const l=i.decline_code||i.code;return l&&Zt[l]?Zt[l]:i.type==="card_error"?Zt.card_declined:"Erro no pagamento. Tente outro cartão ou pague via PIX."}function Xa({scopeKey:i,selectedBumps:l,onAddBump:_}){const{t:A}=bt("checkout"),y=A(`scope.${i}.included`,{returnObjects:!0}),S=A(`scope.${i}.notIncluded`,{returnObjects:!0}),j=Array.isArray(y)?y:[],R=(Array.isArray(S)?S:[]).map(h=>{if(typeof h=="string")return{text:h};if(h&&typeof h=="object"&&"text"in h){const $=h;return{text:String($.text),bumpType:typeof $.bumpType=="string"?$.bumpType:void 0}}return null}).filter(h=>h!==null).filter(h=>!(h.bumpType&&l?.has(h.bumpType)));if(j.length===0&&R.length===0)return null;const N=A("scope.includedLabel"),z=A("scope.notIncludedLabel"),k=A("scope.addBumpCta",{defaultValue:"Adicionar"}),B=A("scope.disclaimer");return e.jsxs("div",{className:"mt-3 rounded-xl border border-white/[0.06] bg-black/20 p-3 space-y-3","data-testid":`scope-${i}`,children:[j.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[e.jsx(Fe,{className:"w-3.5 h-3.5 text-emerald-400 flex-shrink-0"}),e.jsx("span",{className:"text-[10px] sm:text-[11px] font-black uppercase tracking-wider text-emerald-400",children:N})]}),e.jsx("ul",{className:"space-y-1",children:j.map((h,$)=>e.jsxs("li",{className:"flex items-start gap-2 text-[11px] sm:text-xs text-gray-300 leading-snug",children:[e.jsx("span",{className:"text-emerald-400 flex-shrink-0 mt-0.5",children:"✓"}),e.jsx("span",{children:h})]},$))})]}),R.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[e.jsx(ea,{className:"w-3.5 h-3.5 text-orange-400 flex-shrink-0"}),e.jsx("span",{className:"text-[10px] sm:text-[11px] font-black uppercase tracking-wider text-orange-400",children:z})]}),e.jsx("ul",{className:"space-y-1",children:R.map((h,$)=>{const Z=!!(h.bumpType&&_);return e.jsxs("li",{className:"flex items-start gap-2 text-[11px] sm:text-xs text-gray-400 leading-snug",children:[e.jsx("span",{className:"text-orange-400/80 flex-shrink-0 mt-0.5",children:"✗"}),e.jsx("span",{className:"flex-1",children:h.text}),Z&&e.jsxs("button",{type:"button",onClick:()=>_(h.bumpType),"data-testid":`button-scope-add-${h.bumpType}-from-${i}`,className:"flex-shrink-0 text-[10px] sm:text-[11px] font-bold uppercase tracking-wider text-emerald-400 hover:text-emerald-300 underline underline-offset-2 transition-colors",children:["+ ",k]})]},$)})})]}),B&&B!=="scope.disclaimer"&&e.jsx("p",{className:"text-[10px] sm:text-[11px] text-gray-500 italic leading-snug pt-1 border-t border-white/[0.04]",children:B})]})}function cr(){return e.jsxs("div",{className:"flex items-center gap-2 justify-center","data-testid":"card-brand-logos",children:[e.jsxs("svg",{viewBox:"0 0 48 32",className:"h-7 w-auto","aria-label":"Visa",children:[e.jsx("rect",{width:"48",height:"32",rx:"4",fill:"#1A1F71"}),e.jsx("text",{x:"24",y:"20",textAnchor:"middle",fill:"white",fontSize:"14",fontWeight:"bold",fontFamily:"Arial",children:"VISA"})]}),e.jsxs("svg",{viewBox:"0 0 48 32",className:"h-7 w-auto","aria-label":"Mastercard",children:[e.jsx("rect",{width:"48",height:"32",rx:"4",fill:"#2D2D2D"}),e.jsx("circle",{cx:"19",cy:"16",r:"9",fill:"#EB001B",opacity:"0.9"}),e.jsx("circle",{cx:"29",cy:"16",r:"9",fill:"#F79E1B",opacity:"0.9"}),e.jsx("ellipse",{cx:"24",cy:"16",rx:"4.5",ry:"7.5",fill:"#FF5F00",opacity:"0.8"})]}),e.jsxs("svg",{viewBox:"0 0 48 32",className:"h-7 w-auto","aria-label":"Elo",children:[e.jsx("rect",{width:"48",height:"32",rx:"4",fill:"#000"}),e.jsx("text",{x:"24",y:"20",textAnchor:"middle",fill:"#FFCB05",fontSize:"14",fontWeight:"bold",fontFamily:"Arial",children:"elo"})]}),e.jsxs("svg",{viewBox:"0 0 48 32",className:"h-7 w-auto","aria-label":"Amex",children:[e.jsx("rect",{width:"48",height:"32",rx:"4",fill:"#006FCF"}),e.jsx("text",{x:"24",y:"20",textAnchor:"middle",fill:"white",fontSize:"9",fontWeight:"bold",fontFamily:"Arial",children:"AMEX"})]})]})}let Yt=null;function dr(){return Yt||(Yt=fetch("/api/stripe/publishable-key").then(i=>i.json()).then(i=>Gs(i.publishableKey))),Yt}function mr(i,l){if(typeof i=="string"&&i.trim())return i.trim();if(i&&typeof i=="object"){const _=i;for(const A of["text","message","promise","canonicalPromise"]){const y=_[A];if(typeof y=="string"&&y.trim())return y.trim()}}return l?.summary?.trim()?l.summary.trim():"Seu projeto editorial será preparado pela SÁBHIA com a entrega descrita nesta oferta."}function qe(i){return JSON.stringify({name:i.userName.trim(),email:i.email.trim().toLowerCase(),phone:i.phone.replace(/\D/g,""),cpf:i.cpf.replace(/\D/g,"")})}const ur={cover_ebook:e.jsx(ta,{className:"w-5 h-5"}),publication_prep:e.jsx(Qa,{className:"w-5 h-5"}
1),marketing_kit:e.jsx(Ja,{className:"w-5 h-5"}),combo_publish:e.jsx(Ys,{className:"w-5 h-5"})},Va={cover_ebook:{bg:"from-purple-500/10 to-purple-600/5",border:"border-purple-500/30",icon:"text-purple-400",text:"text-purple-300",glow:"shadow-purple-500/20",btnBg:"from-purple-600/30 to-purple-500/20"},publication_prep:{bg:"from-blue-500/10 to-blue-600/5",border:"border-blue-500/30",icon:"text-blue-400",text:"text-blue-300",glow:"shadow-blue-500/20",btnBg:"from-blue-600/30 to-blue-500/20"},marketing_kit:{bg:"from-orange-500/10 to-orange-600/5",border:"border-orange-500/30",icon:"text-orange-400",text:"text-orange-300",glow:"shadow-orange-500/20",btnBg:"from-orange-600/30 to-orange-500/20"}},Ha={cover_ebook:"/images/bump-cover-preview.png",publication_prep:"/images/bump-publication-preview.png",marketing_kit:"/images/bump-marketing-preview.png"},pr={cover_ebook:{pt:"Livros com capa profissional vendem 3x mais",en:"Books with pro covers sell 3x more"},publication_prep:{pt:"Amazon + 400 plataformas em até 48h",en:"Amazon + 400 platforms in 48h"},marketing_kit:{pt:"3 feeds + 3 stories prontos para divulgar",en:"3 feeds + 3 stories ready to promote"}};function Ka({onSuccess:i,onError:l,processing:_,setProcessing:A,country:y,captureBillingAddress:S,totalCentavos:j,formatPrice:T,ctaText:r,ctaColor:R,exactCtaText:N=!1,extraDisabled:z}){const k=Ws(),B=Js(),{t:h}=bt("checkout"),$=async()=>{if(!k||!B)return;A(!0);const{error:Z}=await k.confirmPayment({elements:B,confirmParams:{return_url:window.location.href},redirect:"if_required"});Z?(A(!1),l(lr(Z),Z)):i()};return e.jsxs("div",{className:"space-y-5",children:[e.jsx("div",{className:"bg-gradient-to-br from-[#0c0c1e] to-[#0a0a16] rounded-2xl border border-white/[0.06] p-5 space-y-1",children:e.jsx(Qs,{options:{layout:"tabs",fields:Zs(S),...S?{defaultValues:{billingDetails:{address:{country:y||"BR"}}}}:{},paymentMethodOrder:["card"]}})}),e.jsx(cr,{}),e.jsx("button",{"data-testid":"button-pay-card",onClick:$,disabled:_||!k||!!z,className:"group w-full py-4 lg:py-5 bg-gradient-to-r from-emerald-500 to-emerald-600 hover:from-emerald-400 hover:to-emerald-500 disabled:from-gray-700 disabled:to-gray-800 text-white font-extrabold text-base lg:text-lg rounded-2xl transition-all duration-300 flex items-center justify-center gap-2.5 shadow-xl shadow-emerald-500/25 hover:shadow-emerald-500/35 hover:scale-[1.01] active:scale-[0.99]",style:R?{background:`linear-gradient(to right, ${R}, ${R})`}:void 0,children:_?e.jsxs(e.Fragment,{children:[e.jsx(U,{className:"w-5 h-5 animate-spin"})," ",h("cta.processing")]}):e.jsxs(e.Fragment,{children:[e.jsx(Ue,{className:"w-4 h-4"}),N&&r?r:e.jsxs(e.Fragment,{children:[r||h("cta.buyNow")," — ",T(j)]}),e.jsx(Pe,{className:"w-4 h-4 group-hover:translate-x-0.5 transition-transform"})]})})]})}function Ga({checkoutId:i,token:l,onPaid:_,initialPixData:A,onEvent:y,pixFirst:S=!1}){const{t:j}=bt("checkout"),[T,r]=n.useState(A||null),[R,N]=n.useState(!1),z=n.useRef(null);n.useEffect(()=>{T&&y?.("pix_prepared")},[T,y]),n.useEffect(()=>(z.current=setInterval(async()=>{try{const B=await fetch(`/api/checkout/${i}/status?token=${l}`);if(B.ok&&(await B.json()).status==="paid"){z.current&&clearInterval(z.current),_();return}}catch{}},3e3),()=>{z.current&&clearInterval(z.current)}),[i,l,_]);const k=()=>{T?.qrCode&&(navigator.clipboard.writeText(T.qrCode),N(!0),y?.("pix_code_copied"),setTimeout(()=>N(!1),3e3))};return T?e.jsxs("div",{className:"space-y-5",children:[T.imageUrl&&e.jsx("div",{className:"flex justify-center",children:e.jsx("div",{className:"ph-no-capture ph-mask bg-white rounded-2xl p-4 shadow-xl shadow-emerald-500/10","data-ph-no-capture":"true",children:e.jsx("img",{src:T.imageUrl,alt:"PIX QR Code",className:"w-44 h-44"})})}),e.jsx("p",{className:"text-center text-sm text-gray-400",children:S?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"sm:hidden",children:"Use o botão abaixo para copiar no celular. O QR Code é ideal para escanear em outro dispositivo."}),e.jsx("span",{className:"hidden sm:inline",children:j("scanQrOrCopy")})]}):j("scanQrOrCopy")}),T.qrCode&&e.jsxs("div",{className:`ph-no-capture ph-mask bg-[#0d0d1a] border border-gray-800 rounded-xl p-3 ${S?"flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-2":"flex items-center gap-2"}`,"data-ph-no-capture":"true",children:[e.jsx("input",{type:"text",value:T.qrCode,readOnly:!0,className:"flex-1 bg-transparent text-white text-xs truncate outline-none font-mono","data-testid":"input-pix-code"}),e.jsx("button",{"data-testid":"button-copy-pix",onClick:k,className:`flex items-center justify-center gap-1.5 px-4 bg-emerald-500 hover:bg-emerald-400 text-white rounded-xl text-sm font-semibold transition-all shadow-md shadow-emerald-500/20 ${S?"w-full min-h-12 py-3 sm:w-auto 
1sm:min-h-0 sm:py-2":"py-2"}`,children:R?e.jsxs(e.Fragment,{children:[e.jsx(Fe,{className:"w-4 h-4"})," ",j("copied")]}):e.jsxs(e.Fragment,{children:[e.jsx(Wa,{className:"w-4 h-4"})," ",j("copyPixCode")]})})]}),e.jsxs("div",{className:"flex items-center justify-center gap-2.5 text-sm text-gray-400 bg-emerald-500/5 border border-emerald-500/10 rounded-xl py-3",children:[e.jsx("div",{className:"relative flex items-center justify-center",children:e.jsx(U,{className:"w-4 h-4 animate-spin text-emerald-400"})}),j("waitingPayment")]}),e.jsxs("div",{className:"flex items-start gap-2.5 text-xs bg-sky-500/5 border border-sky-500/15 rounded-xl p-3.5","data-testid":"banner-pix-bank-alert",children:[e.jsx(Xe,{className:"w-4 h-4 text-sky-400 shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-gray-300",children:[e.jsx("p",{className:"font-semibold text-sky-200 mb-0.5",children:j("pixBankAlertTitle")}),e.jsx("p",{className:"text-gray-400",children:j("pixBankAlertBody")}),e.jsx("a",{href:"/suporte",target:"_blank",rel:"noreferrer",className:"inline-block mt-1.5 text-sky-300 hover:text-sky-200 underline underline-offset-2","data-testid":"link-pix-bank-alert-support",children:j("pixBankAlertSupportCta")})]})]})]}):e.jsxs("div",{className:"flex flex-col items-center gap-4 py-10",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-emerald-500/10 flex items-center justify-center",children:e.jsx(U,{className:"w-8 h-8 animate-spin text-emerald-400"})}),e.jsx("div",{className:"absolute inset-0 rounded-full bg-emerald-500/5 animate-ping"})]}),e.jsx("p",{className:"text-gray-400 text-sm",children:j("generatingPixCharge")})]})}function Ar(){const{checkoutId:i}=ys(),{t:l,i18n:_}=bt("checkout"),{formatPrice:A,isBrazil:y}=Ns(),{user:S,isLoading:j}=ks(),[,T]=Cs(),[r,R]=n.useState(null),[N,z]=n.useState(null),[k,B]=n.useState(null),[h,$]=n.useState({userName:"",email:"",phone:"",cpf:""}),[Z,ne]=n.useState("idle"),[fe,le]=n.useState(null),V=n.useRef({userName:"",email:"",phone:"",cpf:""}),we=n.useRef(""),ce=n.useRef(null),Ie=n.useRef(!1),de=n.useRef(!1),Ve=n.useRef(null),st=n.useRef(!1),[ge,vt]=n.useState(null),[L,H]=n.useState(""),[E,Y]=n.useState({}),[X,jt]=n.useState(null),[K,Za]=n.useState(null),[G,Ya]=n.useState([]),[W,es]=n.useState([]),[I,ts]=n.useState(!1),[p,Ae]=n.useState(new Set(["tier:book_and_cover"])),aa=n.useRef(!1),[b,ee]=n.useState("card"),sa=n.useRef("card"),[D,He]=n.useState(tr),[me,Ke]=n.useState("profissional"),[as,ra]=n.useState(!1),[Te,Ee]=n.useState(null),[wt,yt]=n.useState(null),oa=n.useRef({}),ia=n.useRef(!1),na=n.useRef(""),[xr,la]=n.useState(!1),[ss,Ge]=n.useState(!0),[Nt,Oe]=n.useState(null),[ca,Be]=n.useState(null),[J,q]=n.useState(null),[da,te]=n.useState(!1),[ma,ae]=n.useState(null),[We,ue]=n.useState(!1),[$e,rt]=n.useState(!1),[kt,Ct]=n.useState(null),[ua,_t]=n.useState(900),[pe,Je]=n.useState(null),pa=n.useRef(!1),[St,Pt]=n.useState("idle"),[rs,xa]=n.useState(null),[ye,It]=n.useState(!1),[Qe,os]=n.useState("stripe"),[ha,is]=n.useState([]),[ns,fa]=n.useState(null),[ot,At]=n.useState(!1),xe=n.useRef(null),ga=n.useRef(!1),ba=n.useRef(!1),va=n.useRef(!1),it=n.useRef(!1),nt=n.useRef(!1),v=E.layout==="ativo_standard",ls=String(r?.currency||"").toUpperCase(),cs=String(r?.country||"").toUpperCase(),se=v?ls==="BRL"&&cs==="BR":y,Ne=v?se:se&&S?.market!=="es",Ze=!!(N?.assignmentId&&N.assigned&&v&&se),be=!!(N?.arm==="pix_first"&&Ze),lt=v&&k?.assigned?k.priceCents:null,Tt=new URLSearchParams(window.location.search),x=Tt.get("token")||"",ja=Tt.get("redirect_status"),Et=Tt.get("payment_intent");n.useEffect(()=>{ba.current||(ba.current=!0,_s(),Ss(),Ps().catch(()=>{}),Is())},[]),n.useEffect(()=>{ja==="succeeded"&&Et&&i&&x&&!$e&&(ue(!0),(async()=>{let t=!1;for(let a=0;a<3;a++)try{const o=await fetch(`/api/checkout/${i}/confirm-card-payment`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:x,paymentIntentId:Et})});if(o.ok){const s=await o.json();if(s.status==="paid"){t=!0,s.magicLoginUrl&&Ct(s.magicLoginUrl);break}if(s.status==="processing"){await new Promise(d=>setTimeout(d,2e3));continue}}break}catch{a<2&&await new Promise(o=>setTimeout(o,2e3))}t&&(rt(!0),kt||ke()),ue(!1)})())},[ja,Et,i,x,$e]),n.useEffect(()=>{if(!v){const c=E.timerMinutes||15;_t(c*60);const u=window.setInterval(()=>{_t(f=>f<=0?c*60:f-1)},1e3);return()=>window.clearInterval(u)}if(!i)return;const t=`ativo-editorial-offer-deadline:${i}`,a=(E.timerMinutes||15)*60*1e3;let o=0;try{o=Number(window.sessionStorage.getItem(t))}catch{}if(!Number.isFinite(o)||o<=0){o=Date.now()+a;try{window.sessionStorage.setItem(t,String(o))}catch{}}const s=()=>_t(Math.max(0,Math.ceil((o-Date.now())/1e3)));s();const d=window.setInterval(s,1e3);return()=>window.clearInterval(d)},[v,i,E.timerMinutes]);const Ye=n.useCallback(async t=>{if(!(!Ze||!N||!i||!x))try{await fetch(`/api/checkout/${i}/experiment-event`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:x,assignmentId:N.assignmentId,eventType:t})})}catch{}},[N,i,Ze,x]),wa=n.useRef(null);n.useEffect(()=>{if(!Ze||!N||!i||!x||wa.current===N.assignmentId)return;const t=window.requestAnimationFrame(()=>{wa.current=N.assignmentId,fetch(`/api/checkout/${i}/experiment-exposure`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:x,assignmentId:N.assignmentId})}).catch(()=>{})});return()=>window.cancelAnimationFrame(t)},[N,i,Ze,x]);const ya=n.useRef(null);n.useEffect(()=>{if(!k?.assigned||!v||!i||!x||ya.current===k.assignmentId)return;const t=window.requestAnimationFrame(()=>
1{ya.current=k.assignmentId,fetch(`/api/chat-checkout/${i}/price-experiment/exposure`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:x,assignmentId:k.assignmentId})}).catch(()=>{})});return()=>window.cancelAnimationFrame(t)},[k,i,v,x]);const ke=n.useCallback(async()=>{if(!(!i||!x))for(let t=0;t<3;t++){try{const a=await fetch(`/api/checkout/${i}/magic-access`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:x})});if(a.ok){const o=await a.json();if(o.magicLoginUrl){Ct(o.magicLoginUrl);return}}}catch{}t<2&&await new Promise(a=>setTimeout(a,2e3))}},[i,x]);n.useEffect(()=>{async function t(){try{const o=await fetch(`/api/checkout/${i}?token=${x}`);if(!o.ok){const c=await o.json().catch(()=>({}));if(c.recoveryUrl){window.location.replace(c.recoveryUrl);return}if((o.status===401||o.status===403)&&S&&await a())return;Be(c.code||"checkout_unknown"),Oe(c.message||l("errors.sessionNotFound")),Ge(!1);return}const s=await o.json();if(z(s.checkoutExperiment||s.session?.checkoutExperiment||null),B(s.checkoutPriceExperiment||s.session?.checkoutPriceExperiment||null),s.variantConfig?.layout==="ativo_standard"){const c={userName:s.session.userName||"",email:s.session.email||"",phone:s.session.phone||"",cpf:s.session.cpfCnpj||s.session.cpf||""};V.current=c,we.current=qe(c),$(c)}if(s.session.checkoutAddress&&He({postalCode:s.session.checkoutAddress.postalCode,addressNumber:s.session.checkoutAddress.addressNumber,cepStatus:"idle"}),jt(s.mainProduct),Za(s.ativoPackage||null),Ya(s.bumps),os(s.cardProvider==="asaas"?"asaas":"stripe"),ts(s.inlineCatalogCheckout===!0),s.variantConfig&&(Y(s.variantConfig),s.variantConfig.layout==="minimal"&&(Ae(new Set),Ke("essencial"))),Array.isArray(s.funnelUnifiedBumps)&&es(s.funnelUnifiedBumps),s.inlineCatalogCheckout===!0)Ae(new Set(s.session.selectedBumps||[]));else if(Array.isArray(s.funnelBumpItems)){const c=new Set(s.funnelBumpItems);if(Array.isArray(s.funnelUnifiedBumps))for(const f of s.funnelUnifiedBumps)s.funnelBumpItems.includes(f.id)&&c.add(f.id);const u=Array.from(c).find(f=>ze(f));if(u){for(const f of Array.from(c))ze(f)&&f!==u&&c.delete(f);for(const f of Vt(u))c.delete(f);c.delete("combo_publish")}Ae(c)}s.funnelMainProductTier&&Ke(s.funnelMainProductTier),s.session.status==="paid"&&(rt(!0),ke());const d=s.variantConfig?.layout==="ativo_standard"?String(s.session.currency||"").toUpperCase()==="BRL"&&String(s.session.country||"").toUpperCase()==="BR":y&&S?.market!=="es";if(sa.current=d?"pix":"card",s.session.status!=="paid"&&d&&ee("pix"),s.session.paymentMethod==="pix"&&s.session.status==="pending"){const c=await fetch(`/api/checkout/${i}/status?token=${x}`);if(c.ok){const u=await c.json();u.status==="paid"?(rt(!0),ke()):u.pixData&&(pa.current=!0,Je(u.pixData),ee("pix"))}}R(s.session)}catch{Be("checkout_network_error"),Oe(l("errors.loadError"))}Ge(!1)}async function a(){try{const o=await fetch(`/api/checkout/${i}/recover-access`,{method:"POST",headers:{"Content-Type":"application/json"}}),s=await o.json().catch(()=>({}));if(o.ok&&s.checkoutUrl)return window.location.replace(s.checkoutUrl),!0;if(s.recoveryUrl)return window.location.replace(s.recoveryUrl),!0;Be(s.code||"checkout_recovery_failed"),Oe(s.message||l("errors.loadError"))}catch{Be("checkout_network_error"),Oe(l("errors.loadError"))}return Ge(!1),!1}if(!i){Be("checkout_not_found"),Oe(l("errors.sessionNotFound")),Ge(!1);return}if(!x){if(j)return;if(S){a();return}Be("checkout_token_required"),Oe("Este link está incompleto. Entre na conta vinculada para restaurar o checkout."),Ge(!1);return}t()},[i,x,l,ke,j,S]),n.useEffect(()=>{if(r&&i&&x&&!ga.current){ga.current=!0;const t=As();fetch(`/api/checkout/${i}/viewed`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:x,fbp:Os(),fbc:Es(),fbclid:t.fbclid,sessionFingerprint:Ts(),utmSource:t.utm_source,utmMedium:t.utm_medium,utmCampaign:t.utm_campaign,utmContent:t.utm_content,utmTerm:t.utm_term,gclid:t.gclid,gbraid:t.gbraid,wbraid:t.wbraid,gadCampaignId:t.gad_campaignid})}).catch(()=>{}),r.userId&&Bs(r.userId),$s({em:r.email,...r.phone?{ph:r.phone}:{}});const a=X?.price||49.99;Rs(`Checkout: ${r.bookTitle}`,"checkout",a,i,`vc_checkout_${i}`),va.current||(va.current=!0,v&&Ls(i,`Checkout: ${r.bookTitle}`,a),ft("checkout_started",{price:a}),Ms(r.email,a,`Checkout: ${r.bookTitle}`,i,`ic_checkout_${i}`))}},[r,i,x,X,v]);const et=n.useCallback(t=>{Ma(p.has(t)?"bump_declined":"bump_accepted",{choice:p.has(t)?"declined":"accepted"}),Ae(a=>
1{const o=new Set(a),s=W.find(c=>c.id===t);if(I){const c=!o.has(t);if(c?o.add(t):o.delete(t),c){const u=G.find(f=>f.type===t);u&&Oa(u.name||t,u.priceInCentavos/100,t,r?.email)}return o}let d=!1;if(ze(t))if(o.has(t))o.delete(t);else{o.delete("tier:book_and_cover"),o.delete("tier:publish_bundle"),o.delete("combo_publish");for(const c of Vt(t))o.delete(c);o.add(t),d=!0}else t==="combo_publish"?(o.delete("tier:book_and_cover"),o.delete("tier:publish_bundle"),o.has("combo_publish")?(o.delete("combo_publish"),o.delete("cover_ebook"),o.delete("publication_prep"),o.delete("marketing_kit")):(o.add("combo_publish"),o.add("cover_ebook"),o.add("publication_prep"),o.add("marketing_kit"),d=!0)):(s&&["produto","curso","credito"].includes(s.kind)||(o.delete("tier:book_and_cover"),o.delete("tier:publish_bundle")),o.has(t)?(o.delete(t),o.delete("combo_publish")):(o.add(t),d=!0,o.has("cover_ebook")&&o.has("publication_prep")&&o.has("marketing_kit")&&o.add("combo_publish")));if(d&&G.length>0){const c=G.find(u=>u.type===t);c&&Oa(c.name||t,c.priceInCentavos/100,t,r?.email)}return o}),Ee(null)},[G,W,I,p,r]),ds=n.useCallback(()=>{if(!X)return 0;const t=lt??X.priceInCentavos,a=new Map(W.map(s=>[s.id,s]));if(I){let s=t;for(const d of Array.from(p)){const c=a.get(d);if(c){s+=c.priceCents;continue}const u=G.find(f=>f.type===d);u&&(s+=u.priceInCentavos)}return s}if(p.has("tier:publish_bundle")){const s="tier:publish_bundle",d=a.get(s)?.priceCents??gt("premium",r?.currency||"BRL");let c=0;for(const u of Array.from(p)){if(u===s)continue;const f=a.get(u);f&&(c+=f.priceCents)}return d+c}if(p.has("tier:book_and_cover")){const s="tier:book_and_cover",d=a.get(s)?.priceCents??gt("profissional",r?.currency||"BRL");let c=0;for(const u of Array.from(p)){if(u===s)continue;const f=a.get(u);f&&(c+=f.priceCents)}return d+c}let o=t;if(p.has("combo_publish")){const s=a.get("combo_publish"),d=G.find(c=>c.type==="combo_publish");o+=s?.priceCents??d?.priceInCentavos??0;for(const c of Array.from(p)){if(c==="combo_publish"||ze(c))continue;const u=a.get(c);u&&(o+=u.priceCents)}}else for(const s of Array.from(p)){if(ze(s))continue;const d=a.get(s);if(d){o+=d.priceCents;continue}const c=G.find(u=>u.type===s);c&&(o+=c.priceInCentavos)}return o},[X,p,G,W,r,I,lt]),tt=n.useRef(!1),ct=n.useRef(""),Ot=n.useRef(!1),Bt=n.useRef(null),dt=n.useCallback((t,a)=>{Ie.current=!0;const o={...V.current,[t]:a};V.current=o,$(o),ne("idle"),le(null),ct.current="",Je(null),Ee(null),yt(null),It(!1)},[]),Ce=n.useCallback(async t=>{if(!v||!i||!x||r?.status!=="pending")return!0;for(;;){if(ce.current){if(!await ce.current)return!1;continue}const a=V.current,o=a.cpf.replace(/\D/g,""),s=ar(o),d=t==="card"&&Qe==="asaas";if(d&&s)return H(s),Ie.current&&le(s),!1;!d&&s&&(H(""),le(null));const c={name:a.userName.trim(),email:a.email.trim(),phone:a.phone.trim(),...s?{}:{cpf:o}},u=qe(a);if(u===we.current)return ne("saved"),!0;ne("saving"),le(null);const f=(async()=>{try{const Q=await fetch(`/api/checkout/${i}/contact`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:x,...c}),signal:AbortSignal.timeout(1e4)}),w=await Q.json().catch(()=>({}));if(!Q.ok)return ne("idle"),le(w.message||"Confira seus dados para continuar."),!1;const P={userName:w.session?.userName||c.name,email:w.session?.email||c.email,phone:w.session?.phone||c.phone,cpf:w.session?.cpfCnpj||w.session?.cpf||c.cpf||a.cpf};return we.current=qe(P),qe(V.current)===u&&(V.current=P,$(P)),v&&!st.current&&(st.current=!0,window.setTimeout(()=>{(document.getElementById("ativo-order-bumps")||document.getElementById("ativo-payment"))?.scrollIntoView({behavior:window.matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth",block:"start"})},80)),R(oe=>oe&&{...oe,userName:P.userName,email:P.email,phone:P.phone,cpfCnpj:P.cpf}),!0}catch{return ne("idle"),le("Não foi possível salvar seus dados. Tente novamente."),!1}})();ce.current=f;const Re=await f;if(ce.current===f&&(ce.current=null),!Re)return!1}},[Qe,v,i,x,r?.status]),$t=n.useCallback(t=>(I?Array.from(t):t.has("combo_publish")?["combo_publish"]:Array.from(t)).sort().join(","),[I]),O=n.useCallback(async(t,a,o=!1,s)=>{if(!r||!i||!x||!await Ce(t))return;const d=v?qe(V.current):"",c=t==="card"&&Qe==="asaas"&&!ye;if(r.captureCheckoutAddress&&!Ht(D)&&!c){o&&q("Informe o CEP e o número do endereço para continuar.");return}const u=I?Array.from(a):a.has("combo_publish")?["combo_publish"]:Array.from(a),f=r.captureCheckoutAddress&&Ht(D)?Kt(D):void 0,Re=`${t}_${u.sort().join(",")}_${f?.postalCode||""}_${f?.addressNumber||""}_${d}`,Q=!!s?.preferIntentId;if(o&&!Q&&!aa.current&&(aa.current=!0,Ma("payment_started",{choice:"started"})),!(!o&&ct.current===Re)){if(Ot.current){Bt.current={method:t,bumpsSet:a,opts:s};return}Ot.current=!0,q(null),te(!1),ae(null),Q||(t==="pix"?Je(null):Ee(null));try{const w=await fetch(I?`/api/chat-checkout/${i}/prepare-payment`:`/api/checkout/${i}/prepare-payment`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(I?{token:x,acceptedBumpIds:u,paymentMethod:t,checkoutAddress:f}:{token:x,selectedBumps:u,paymentMethod:t,checkoutAddress:f,...s?.preferIntentId?{preferPaymentIntentId:s.preferIntentId}:{}}
1),signal:AbortSignal.timeout(2e4)});if(!w.ok){const xt=await w.json().catch(()=>({}));Q?console.error("[CHECKOUT] Background tier sync failed:",xt.message):q(xt.message||l("errors.paymentFailed"));return}const P=await w.json();ct.current=Re;const oe=(!v||d===qe(V.current))&&(!s?.activeKey||s.activeKey===na.current);if(P.provider==="asaas"&&t==="card"&&oe?(It(!0),Array.isArray(P.installmentOptions)&&is(P.installmentOptions)):(oe&&It(!1),P.pixData&&oe&&Je(P.pixData),P.clientSecret&&oe&&Ee(P.clientSecret),P.paymentIntentId&&oe&&yt(P.paymentIntentId)),r&&P.totalReais){const xt=v?V.current.email.trim():r.email;zs(xt,P.totalReais,`Checkout: ${r.bookTitle}`,t,i||void 0)}}catch{Q||q(l("errors.networkError"))}finally{Ot.current=!1,Q&&la(!1);const w=Bt.current;Bt.current=null,w&&O(w.method,w.bumpsSet,!0,w.opts)}}},[r,i,x,l,I,D,Ce,v,Qe,ye]);n.useEffect(()=>{if(r&&!tt.current&&r.status!=="paid"){tt.current=!0;const t=sa.current;if(ee(t),t==="pix"&&pa.current)return;O(t,p)}},[r]);const Na=n.useCallback(async()=>{if(!v||!i||!x||r?.status!=="pending")return!1;try{if(!(await fetch(`/api/checkout/${i}/exit-pix-offer-shown`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:x}),signal:AbortSignal.timeout(1e4)})).ok)throw new Error("Não foi possível ativar o bônus deste PIX.");return!0}catch{return!1}},[v,i,x,r?.status]),Rt=n.useCallback(async()=>{if(!v||!Ne||!r||r.status!=="pending")return;if(Je(null),Pt("marking"),xa(null),ee("pix"),q(null),te(!1),ae(null),!await Na()){Pt("error"),xa("Não foi possível ativar o bônus agora. Tente novamente para gerar um PIX elegível.");return}Pt("ready"),await O("pix",new Set(p),!0)},[v,Ne,r,O,p,Na]),ms=n.useCallback(()=>{Rt()},[Rt]);n.useEffect(()=>{!r||r.status==="paid"||I||r.captureCheckoutAddress||ia.current||(ia.current=!0,(async()=>{try{const t=await fetch(`/api/checkout/${i}/prewarm-tier-intents`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:x}),signal:AbortSignal.timeout(15e3)});if(!t.ok)return;const a=await t.json();a?.intents&&(oa.current=a.intents)}catch{}})())},[r,i,x,I]);const us=n.useCallback(t=>{ft("tier_selected",{tier:t}),Ke(t);const a=za.find(c=>c.id===t);if(!a)return;const o=new Set(a.bumps);Ae(o),ra(!0);const s=`card_${$t(o)}`;na.current=s;const d=b==="card"?oa.current[t]:void 0;d?(Ee(d.clientSecret),yt(d.paymentIntentId),ct.current=s,la(!0),O("card",o,!0,{preferIntentId:d.paymentIntentId,activeKey:s})):Ee(null)},[b,O,$t]);n.useEffect(()=>{!r||r.status==="paid"||!tt.current||O(b,p)},[b]);const ps=$t(p);n.useEffect(()=>{if(!r||r.status==="paid"||!tt.current)return;const t=setTimeout(()=>{O(b,p)},600);return()=>clearTimeout(t)},[ps]);const xs=`${D.postalCode}|${D.addressNumber}`;n.useEffect(()=>{if(!r?.captureCheckoutAddress||r.status==="paid"||!tt.current||!Ht(D))return;const t=setTimeout(()=>O(b,p),300);return()=>clearTimeout(t)},[xs]);const M=ds(),_e=lt??K?.priceCents??X?.priceInCentavos??0,re=v&&k?.assigned?k.referencePriceCents:null,ka=M===_e;n.useEffect(()=>{if(!r||!i||!v||it.current||Wt(r)||r.status!=="paid"&&r.status!=="delivered"&&!r.paidAt)return;it.current=!0;const t=M/100;Ba(i,`Checkout: ${r.bookTitle}`,t,r.paymentMethod||void 0),$a(r.email,t,i,`Checkout: ${r.bookTitle}`,void 0,`purchase_checkout_${i}`)},[r,i,M,v]),n.useEffect(()=>{nt.current||!r||!i||Wt(r)||r.status!=="paid"&&r.status!=="delivered"&&!r.paidAt||(nt.current=!0,ft("purchase_completed",{value:M/100,payment_method:r.paymentMethod||"unknown"}))},[r,i,M]);const mt=W.find(t=>t.id.startsWith("tier:")&&p.has(t.id)),Ca=(()=>{const t=qa[me],a=t==="book_and_cover"?ie.book_and_cover_original:t==="publish_bundle"?ie.publish_bundle_original:null;return{originalPriceCents:typeof a=="number"?Math.round(a*100):null}})(),_a=n.useCallback(async t=>{if(!i||!x)return!1;for(let a=0;a<3;a++)try{const o=await fetch(`/api/checkout/${i}/confirm-card-payment`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:x,paymentIntentId:t})});if(o.ok){const s=await o.json();if(s.status==="paid")return console.log("[CHECKOUT] Card payment confirmed by server"),s.magicLoginUrl&&
1Ct(s.magicLoginUrl),!0;if(s.status==="processing"){await new Promise(d=>setTimeout(d,2e3));continue}}break}catch{a<2&&await new Promise(o=>setTimeout(o,2e3))}return!1},[i,x]),ve=n.useCallback((t=!1)=>{if(rt(!0),ue(!1),r&&i&&!Wt(r)){const a=M/100,o=`purchase_checkout_${i}`;it.current||(it.current=!0,nt.current||(nt.current=!0,ft("purchase_completed",{value:a,payment_method:r.paymentMethod||"unknown"})),v&&Ba(i,`Checkout: ${r.bookTitle}`,a,r.paymentMethod||void 0),$a(r.email,a,i,`Checkout: ${r.bookTitle}`,void 0,o))}wt&&!t?_a(wt).then(()=>{ke()}):ke()},[r,i,M,wt,_a,ke,v]);n.useEffect(()=>{if(!(!ot||!i||!x))return xe.current&&clearInterval(xe.current),xe.current=setInterval(async()=>{try{const t=await fetch(`/api/checkout/${i}/status?token=${x}`);if(t.ok){const a=await t.json();a.status==="paid"?(xe.current&&clearInterval(xe.current),At(!1),ve(!0)):(a.terminal===!0||a.status==="card_failed")&&(xe.current&&clearInterval(xe.current),At(!1),ue(!1),q(a.message||"O cartão não foi autorizado. Confira os dados e tente novamente."))}}catch{}},3e3),()=>{xe.current&&clearInterval(xe.current)}},[ot,i,x,ve]);const Sa=n.useCallback(async t=>{if(!r||!i||!x)return;if(!await Ce("card"))throw new Error(fe||"Confira seus dados antes de continuar.");ue(!0),q(null);const a=I?Array.from(p):p.has("combo_publish")?["combo_publish"]:Array.from(p),o=I?{token:x,acceptedBumpIds:a,paymentMethod:"card",asaasCard:t,checkoutAddress:Kt(D)}:{token:x,selectedBumps:a,paymentMethod:"card",asaasCard:t,checkoutAddress:Kt(D)},s=I?`/api/chat-checkout/${i}/prepare-payment`:`/api/checkout/${i}/prepare-payment`;try{const d=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o),signal:AbortSignal.timeout(3e4)});if(!d.ok){const u=await d.json().catch(()=>({})),f=new Error(u.message||"Não foi possível processar o cartão.");throw f.title=u.title,f.category=u.category,f.isPlatformFault=u.isPlatformFault,f}const c=await d.json();if(c.paid)ve(!0);else if(c.pending===!0&&c.paymentId)ue(!1),At(!0);else{const u=new Error(c.message||"Pagamento não confirmado. Tente novamente.");throw u.title=c.title,u.category=c.category,u.isPlatformFault=c.isPlatformFault,u}}catch(d){throw ue(!1),d}},[r,i,x,I,p,ve,D,Ce,fe]);n.useEffect(()=>{if(!$e||!i||!x)return;const t=setTimeout(()=>{T(`/obrigado?checkoutId=${encodeURIComponent(i)}&token=${encodeURIComponent(x)}`)},700);return()=>clearTimeout(t)},[$e,i,x,T]);const Lt=Math.floor(ua/60),Mt=ua%60,hs=E.showTimer!==!1,fs=E.showSocialProof!==!1,Se=E.layout||"standard",m=v,he=Se==="bumps"||m;n.useEffect(()=>{if(!m||de.current||!r)return;const a=["userName","email","phone"].filter(s=>h[s].trim());if(!a.length||Ie.current)return;de.current=!0;const o=[];return a.forEach((s,d)=>{o.push(window.setTimeout(()=>{Ie.current||document.activeElement!==document.body||vt(s)},d*520))}),()=>o.forEach(window.clearTimeout)},[m,r,h]),n.useEffect(()=>{!m||!r?.locale||_.resolvedLanguage===r.locale||_.language===r.locale||_.changeLanguage(r.locale)},[_,m,r?.locale]);const g=t=>{if(m&&r?.currency)try{return new Intl.NumberFormat(r.locale||"pt-BR",{style:"currency",currency:r.currency}).format(t/100)}catch{}return A(t)},je=b==="card"&&ye?ns:null;n.useEffect(()=>{he&&Ae(t=>{if(!t.has("tier:book_and_cover")&&!t.has("tier:publish_bundle"))return t;const a=new Set(t);return a.delete("tier:book_and_cover"),a.delete("tier:publish_bundle"),a})},[he]);const Pa=E.customHeadline||l("pageTitle"),Ia=E.customSubheadline||l("pageSubtitle"),gs=E.ctaText,ut=E.ctaColor,Aa="PAGAR AGORA E RECEBER MEU LIVRO PUBLICADO",pt=m?Aa:gs,zt=E.bumpOrder?[...G].sort((t,a)=>{const o=E.bumpOrder.indexOf(t.type),s=E.bumpOrder.indexOf(a.type);return(o===-1?999:o)-(s===-1?999:s)}):G,C=r?.locale?.startsWith("pt"),bs=zt.filter(t=>t.type!=="combo_publish")[0]?.type;if(ss)return e.jsx("div",{className:"min-h-screen bg-[#060610] flex items-center justify-center",children:e.jsx("div",{className:"relative",children:e.jsx("div",{className:"w-16 h-16 rounded-full bg-emerald-500/10 flex items-center justify-center",children:e.jsx(U,{className:"w-8 h-8 animate-spin text-emerald-400"})})})});if(Nt||!r){const t=!!S&&!j,a=ca==="checkout_inactive",o=["checkout_token_required","checkout_token_invalid","checkout_access_de
1nied","checkout_auth_required"].includes(ca||"");return t?e.jsx("div",{className:"min-h-screen bg-[#0a0e17] flex items-center justify-center p-4",children:e.jsxs("div",{className:"max-w-md w-full text-center space-y-6","data-testid":"checkout-error-loggedin",children:[e.jsx("div",{className:"flex justify-center",children:e.jsxs("div",{className:"relative w-20 h-20 rounded-full bg-emerald-500/10 border border-emerald-500/20 flex items-center justify-center",children:[e.jsx(Le,{className:"w-10 h-10 text-emerald-400"}),e.jsx("div",{className:"absolute -top-1 -right-1 w-7 h-7 rounded-full bg-[#0a0e17] border border-emerald-500/30 flex items-center justify-center",children:e.jsx(U,{className:"w-3.5 h-3.5 animate-spin text-emerald-300"})})]})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h1",{className:"text-2xl font-bold text-white","data-testid":"text-redirect-title",children:a?"Esta cobrança foi encerrada":o?"Não conseguimos restaurar este checkout":"Não conseguimos abrir o checkout agora"}),e.jsx("p",{className:"text-white/60 text-sm leading-relaxed",children:a?"Abra o livro para iniciar uma nova cobrança com as condições atuais.":Nt||"Tente novamente. Se o problema persistir, abra o livro e continue por lá."})]}),e.jsxs("div",{className:"flex flex-col gap-2.5 pt-2",children:[e.jsxs(Ut,{onClick:()=>T("/dashboard"),className:"w-full h-12 bg-emerald-600 hover:bg-emerald-500 text-white font-semibold rounded-xl text-sm","data-testid":"button-go-to-books",children:[e.jsx(Le,{className:"w-4 h-4 mr-2"}),"Ir pros meus livros",e.jsx(Pe,{className:"w-4 h-4 ml-2"})]}),e.jsxs("button",{onClick:()=>window.location.reload(),className:"text-xs text-white/40 hover:text-white/70 inline-flex items-center justify-center gap-1.5 py-2","data-testid":"button-retry-checkout",children:[e.jsx(Me,{className:"w-3 h-3"})," Tentar abrir o checkout de novo"]})]}),e.jsx("p",{className:"text-[11px] text-white/20",children:"SÁBHIA BOOKS — Plataforma brasileira de criação de livros"})]})}):e.jsx("div",{className:"min-h-screen bg-[#0a0e17] flex items-center justify-center p-4",children:e.jsxs("div",{className:"max-w-lg w-full text-center space-y-6","data-testid":"checkout-error-anonymous",children:[e.jsx("div",{className:"flex justify-center",children:e.jsx("div",{className:"w-20 h-20 rounded-full bg-amber-500/10 border border-amber-500/20 flex items-center justify-center",children:e.jsx(at,{className:"w-10 h-10 text-amber-400"})})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h1",{className:"text-2xl font-bold text-white","data-testid":"text-checkout-error-title",children:a?"Esta cobrança foi encerrada":o?"Este link precisa ser restaurado":"Não conseguimos abrir o checkout agora"}),e.jsx("p",{className:"text-white/50 text-sm",children:a?"Entre na sua conta para continuar pelo livro e criar uma cobrança nova.":Nt||"Tente novamente em alguns instantes."})]}),e.jsxs("div",{className:"bg-white/5 border border-white/10 rounded-2xl p-6 text-left space-y-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(ht,{className:"w-5 h-5 text-emerald-400 mt-0.5 flex-shrink-0"}),e.jsxs("p",{className:"text-sm text-white/80 leading-relaxed",children:["Não se preocupe — ",e.jsx("strong",{className:"text-white",children:"seu acesso e seus livros estão a salvo"}),". Por segurança, links de pagamento são únicos e temporários. Se você já tem uma conta na SÁBHIA, basta entrar normalmente para ver tudo o que estava fazendo."]})]}),e.jsxs("div",{className:"border-t border-white/5 pt-4 space-y-3",children:[e.jsx("p",{className:"text-xs text-white/40 uppercase tracking-wider font-medium",children:"O que você pode fazer agora"}),e.jsxs("div",{className:"space-y-2.5",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"w-5 h-5 rounded-full bg-emerald-500/15 flex items-center justify-center flex-shrink-0 mt-0.5",children:e.jsx("span",{className:"text-[10px] font-bold text-emerald-400",children:"1"})}),e.jsxs("p",{className:"text-sm text-white/70",children:[e.jsx("strong",{className:"text-white/90",children:"Entrar na sua conta"})," — informe o e-mail ou WhatsApp da conta SÁBHIA e você recebe um código de acesso na hora."]})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"w-5 h-5 rounded-full bg-emerald-500/15 flex items-center justify-center flex-shrink-0 mt-0.5",children:e.jsx("span",{className:"text-[10px] font-bold text-emerald-400",children:"2"})}),e.jsxs("p",{className:"text-sm text-white/70",children:[e.jsx("strong",{className:"text-white/90",children:"Começar um livro novo"})," — vá pra página inicial e crie um livro do zero, com o assistente da SÁBHIA."]})]})]})]})]}),e.jsxs("div",{className:"space-y-2.5",children:[e.jsxs(Ut,{onClick:()=>
1T("/login"),className:"w-full h-12 bg-emerald-600 hover:bg-emerald-500 text-white font-semibold rounded-xl text-sm","data-testid":"button-login-from-checkout-error",children:[e.jsx(rr,{className:"w-4 h-4 mr-2"}),"Entrar na minha conta",e.jsx(Pe,{className:"w-4 h-4 ml-2"})]}),e.jsx(qs,{href:"/",children:e.jsxs(Ut,{variant:"outline",className:"w-full h-12 bg-white/5 border-white/10 hover:bg-white/10 text-white/80 hover:text-white font-medium rounded-xl text-sm","data-testid":"button-home-from-checkout-error",children:[e.jsx(Us,{className:"w-4 h-4 mr-2"}),"Ir pra página inicial"]})}),e.jsxs("button",{onClick:()=>window.location.reload(),className:"text-xs text-white/40 hover:text-white/70 inline-flex items-center justify-center gap-1.5 py-2 mx-auto","data-testid":"button-retry-checkout-anonymous",children:[e.jsx(Me,{className:"w-3 h-3"})," Tentar abrir o checkout de novo"]})]}),e.jsx("p",{className:"text-[11px] text-white/20",children:"SÁBHIA BOOKS — Plataforma brasileira de criação de livros"})]})})}if($e)return e.jsx("div",{className:"min-h-screen bg-[#060610] flex items-center justify-center p-4",children:e.jsxs("div",{className:"bg-[#0f0f1e] border border-emerald-500/20 rounded-3xl p-10 text-center max-w-lg shadow-2xl shadow-emerald-500/5",children:[e.jsxs("div",{className:"relative w-24 h-24 mx-auto mb-6",children:[e.jsx("div",{className:"absolute inset-0 bg-emerald-500/20 rounded-full animate-ping"}),e.jsx("div",{className:"relative w-24 h-24 bg-gradient-to-br from-emerald-400 to-emerald-600 rounded-full flex items-center justify-center shadow-xl shadow-emerald-500/30",children:e.jsx(Fe,{className:"w-12 h-12 text-white"})})]}),e.jsx("h2",{"data-testid":"text-payment-confirmed",className:"text-2xl font-bold text-white mb-2",children:l("success.title")}),e.jsx("p",{className:"text-gray-400 mb-4",children:l("success.subtitle")}),e.jsxs("p",{className:"text-lg font-semibold text-emerald-400 mb-2",children:['"',r.bookTitle,'"']}),r.pipelineStatus&&e.jsxs("div",{className:"mt-6 space-y-2.5 text-left",children:[e.jsx("p",{className:"text-xs text-gray-500 uppercase tracking-widest mb-3 font-semibold",children:l("success.pipelineTitle")}),Object.entries(r.pipelineStatus).map(([t,a])=>{if(a==="skipped")return null;const o={book:e.jsx(Le,{className:"w-4 h-4"}),cover:e.jsx(ta,{className:"w-4 h-4"}),publication:e.jsx(Qa,{className:"w-4 h-4"}),marketing:e.jsx(Ja,{className:"w-4 h-4"})},s={book:l("success.bookStep"),cover:l("success.coverStep"),publication:l("success.publicationStep"),marketing:l("success.marketingStep")},d={pending:l("success.pending"),generating:l("success.generating"),done:l("success.completed")},c={pending:"text-gray-400",generating:"text-yellow-400",done:"text-emerald-400"};return e.jsxs("div",{className:`flex items-center gap-3 py-3 px-4 rounded-2xl bg-white/[0.03] border border-white/5 ${c[a]||"text-gray-500"}`,children:[o[t],e.jsx("span",{className:"text-sm flex-1 font-medium",children:s[t]||t}),e.jsx("span",{className:"text-xs font-medium",children:d[a]||a}),a==="generating"&&e.jsx(U,{className:"w-3 h-3 animate-spin"}),a==="done"&&e.jsx(F,{className:"w-4 h-4"})]},t)})]}),kt?e.jsxs("a",{href:kt,"data-testid":"link-dashboard",className:"inline-flex items-center gap-2 mt-8 px-8 py-3.5 bg-gradient-to-r from-emerald-500 to-emerald-600 hover:from-emerald-400 hover:to-emerald-500 text-white font-bold rounded-2xl transition-all shadow-lg shadow-emerald-500/30 hover:shadow-emerald-500/40",children:[l("success.accessMyBook")," ",e.jsx(Pe,{className:"w-4 h-4"})]}):e.jsxs("div",{"data-testid":"link-dashboard-loading",className:"inline-flex items-center gap-2 mt-8 px-8 py-3.5 bg-gradient-to-r from-emerald-500/60 to-emerald-600/60 text-white/80 font-bold rounded-2xl cursor-wait",children:[e.jsx(U,{className:"w-4 h-4 animate-spin"})," ",l("success.preparingAccess")]})]})});const Ta=dr();return e.jsxs("div",{"data-support-chat-context":m?"hidden":"allowed",className:`min-h-screen text-white ${m?"bg-[#080c10] pb-44 min-[380px]:pb-28 lg:pb-0":"bg-[#060610]"}`,children:[(hs||m&&k?.assigned)&&(m?k?.assigned&&re?e.jsx("div",{className:"sticky top-0 z-50 w-full",children:e.jsx("div",{className:"border-b border-red-200/25 bg-[#b51e2b] px-3 pb-2 pt-[max(.5rem,env(safe-area-inset-top))] text-white shadow-lg shadow-red-950/30",children:e.jsxs("div",{className:"mx-auto flex max-w-5xl items-center justify-center gap-2.5 leading-tight",children:[e.jsxs("div",{className:"min-w-0 text-center",children:[e.jsxs("p",{className:"text-[11px] font-black uppercase tracking-[.01em] min-[375px]:text-xs sm:text-sm",children:["Oferta relâmpago · de ",e.jsx("span",{className:"text-white/65 line-through decoration-2",children:g(re)})," por ",e.jsx("span",{className:"price-reveal inline-block",children:g(_e)})]}),e.jsx("p",{className:"mt-0.5 text-[9px] font-semibold text-red-100 min-[375px]:text-[10px]",children:"Condição reservada para esta página"})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1 rounded-full border border-white/20 bg-red-950/25 px-2 py-1 font-mono text-[11px] font-black tabular-nums min-[375px]:px-2.5 min-[375px]:text-xs","data-testid":"text-timer","aria-label":"Tempo restante da oferta",children:[e.jsx(at,{className:"h-3 w-3"}),String(Lt).padStart(2,"0"),":",String(Mt).padStart(2,"0")]})]})})}):e.jsxs("div",{className:"sticky top-0 z-50 w-full",children:[e.jsx("div",{className:"h-[3px] w-full bg-gradient-to-r from-emerald-500 via-amber-400 to-emerald-500"}),e.jsx("div",{className:"border-b border-white/[0.06] bg-[#0c1117]/95 px-4 py-3 backdrop-blur-xl",children:e.jsxs("div",{className:"mx-auto flex max-w-5xl items-center justify-between gap-4",children:[e.jsx("img",{src:"/logo.webp",alt:"SÁBHIA",className:"h-7 w-auto"}),e.jsxs("div",{className:"hidden flex-col items-center text-center sm:flex",children:[e.jsx("span",{className:"text-sm font-bold uppercase tracking-widest text-white",children:"Aproveite agora"}),e.jsx("span",{className:"text-xs text-emerald-400",children:"Garanta seu projeto editorial"})]}),e.jsxs("div",{className:"flex items-center gap-1.5 rounded-full bg-red-600 px-3 py-1.5 text-sm font-bold tabular-nums text-white shadow-lg shadow-red-900/40","data-testid":"text-timer",children:[e.jsx(at,{className:"h-3.5 w-3.5"}),String(Lt).padStart(2,"0"),":",String(Mt).padStart(2,"0")]})]})})]}):e.jsx("div",{className:`sticky top-0 z-50 backdrop-blur-xl border-b ${Se==="urgency"?"bg-gradient-to-r from-red-950/90 via-red-900/90 to-orange-950/90 border-red-500/20":"bg-gradient-to-r from-[#0a1628]/95 via-[#0d1f35]/95 to-[#0a1628]/95 border-emerald-500/10"}`,children:e.jsxs("div",{className:"max-w-6xl mx-auto px-4 py-3 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("img",{src:"/logo.png",alt:"SÁBHIA",className:"h-8 object-contain drop-shadow-lg"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-extrabold text-white uppercase tracking-wide",children:l("timer.title")}),e.jsx("p",{className:`text-[11px] font-medium ${Se==="urgency"?"text-orange-300":"text-emerald-400/80"}
1`,children:l("timer.subtitle")})]})]}),e.jsxs("div",{className:`relative flex items-center gap-1 px-5 py-2.5 rounded-2xl font-mono font-black text-xl tabular-nums tracking-wider ${Se==="urgency"?"bg-red-600 text-white shadow-lg shadow-red-500/30":"bg-gradient-to-r from-red-600 to-red-500 text-white shadow-lg shadow-red-500/20"}`,"data-testid":"text-timer",children:[e.jsx(at,{className:"w-4 h-4 mr-1"}),String(Lt).padStart(2,"0"),":",String(Mt).padStart(2,"0")]})]})})),e.jsxs("div",{className:`mx-auto px-3 sm:px-4 ${m?"max-w-5xl py-4 sm:py-8":`py-6 lg:py-12 ${Se==="minimal"?"max-w-2xl":"max-w-6xl"}`}`,children:[m?null:Se==="minimal"?e.jsxs("div",{className:"text-center mb-6",children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-extrabold text-white mb-1 tracking-tight",children:Pa}),e.jsx("p",{className:"text-gray-500 text-sm max-w-md mx-auto",children:Ia})]}):e.jsxs("div",{className:"text-center mb-8 lg:mb-10",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 bg-emerald-500/10 border border-emerald-500/20 text-emerald-400 text-[10px] sm:text-xs font-bold uppercase tracking-widest px-3 sm:px-4 py-1.5 rounded-full mb-3 lg:mb-4",children:[e.jsx(Xe,{className:"w-3.5 h-3.5"})," ",l("trust.securePurchase")]}),e.jsx("h1",{className:"text-2xl sm:text-3xl lg:text-4xl font-extrabold text-white mb-2 lg:mb-3 tracking-tight",children:Pa}),e.jsx("p",{className:"text-gray-400 text-sm lg:text-lg max-w-xl mx-auto",children:Ia})]}),Se==="minimal"?e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"bg-white/[0.03] border border-white/[0.08] rounded-2xl p-5",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-12 h-12 bg-emerald-500/10 rounded-xl flex items-center justify-center flex-shrink-0",children:e.jsx(Le,{className:"w-6 h-6 text-emerald-400"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-xs text-emerald-400 uppercase tracking-widest font-bold mb-0.5",children:l("mainProduct.name")}),e.jsxs("h2",{"data-testid":"text-book-title",className:"text-base font-bold text-white truncate",children:['"',r.bookTitle,'"']})]}),e.jsxs("div",{className:"text-right flex-shrink-0",children:[e.jsx("span",{className:"text-2xl font-extrabold text-white",children:g(M)}),se&&e.jsx("p",{className:"text-[10px] text-gray-500 font-medium",children:l("tiers.oneTimePayment")})]})]}),e.jsxs("div",{className:"flex items-center gap-4 mt-3 pt-3 border-t border-white/[0.05] text-[11px] text-gray-500",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(F,{className:"w-3 h-3 text-emerald-500"})," Texto por nosso ghostwriter profissional"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(F,{className:"w-3 h-3 text-emerald-500"})," 100% seus direitos"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(F,{className:"w-3 h-3 text-emerald-500"})," Pronto em 1h"]})]})]}),e.jsxs("div",{className:"bg-[#0d0d1a] border border-white/[0.06] rounded-2xl p-5",children:[e.jsxs("h3",{className:"text-sm font-bold text-white mb-4 flex items-center gap-2",children:[e.jsx(Ue,{className:"w-4 h-4 text-emerald-400"}),l("paymentMethod")]}),Ne&&e.jsx("div",{className:"mb-5",children:e.jsxs("div",{className:`flex gap-2 bg-white/[0.03] p-1 rounded-xl border border-white/[0.06] ${m?"flex-row-reverse":""}`,children:[e.jsxs("button",{"data-testid":"tab-card",onClick:()=>{ee("card"),te(!1),ae(null),q(null),Ye("card_selected")},className:`flex-1 py-2.5 rounded-lg font-bold text-xs transition-all flex items-center justify-center gap-1.5 ${b==="card"?"bg-emerald-500 text-white shadow-md":"text-gray-400 hover:text-gray-300"}`,children:[e.jsx(Ra,{className:"w-3.5 h-3.5"})," ",l("payment.tabCard")]}),e.jsxs("button",{"data-testid":"tab-pix",onClick:()=>{ee("pix"),te(!1),ae(null),q(null)},className:`flex-1 py-2.5 rounded-lg font-bold text-xs transition-all flex items-center justify-center gap-1.5 ${b==="pix"?"bg-emerald-500 text-white shadow-md":"text-gray-400 hover:text-gray-300"}`,children:[e.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"
1currentColor",children:e.jsx("path",{d:"M17.66 7.93L14.76 5.03C14.37 4.64 13.74 4.64 13.35 5.03L12 6.38 10.65 5.03C10.26 4.64 9.63 4.64 9.24 5.03L6.34 7.93C5.95 8.32 5.95 8.95 6.34 9.34L9.24 12.24 6.34 15.14C5.95 15.53 5.95 16.16 6.34 16.55L9.24 19.45C9.63 19.84 10.26 19.84 10.65 19.45L12 18.1 13.35 19.45C13.74 19.84 14.37 19.84 14.76 19.45L17.66 16.55C18.05 16.16 18.05 15.53 17.66 15.14L14.76 12.24 17.66 9.34C18.05 8.95 18.05 8.32 17.66 7.93Z"})}),"PIX"]})]})}),r.captureCheckoutAddress&&!(b==="card"&&ye)&&e.jsx("div",{className:"mb-5",children:e.jsx(Da,{value:D,onChange:He})}),J&&(da&&se&&b==="card"?e.jsx(Fa,{declineCode:ma,paymentError:J,onPixFallback:()=>{ee("pix"),q(null),te(!1),ae(null),O("pix",p,!0)},isBrazil:Ne}):e.jsx("div",{className:"mb-4","data-testid":"text-payment-error",children:e.jsxs("div",{className:"bg-red-500/10 border border-red-500/20 rounded-xl p-3 flex items-center gap-2",children:[e.jsx(ea,{className:"w-4 h-4 text-red-400 flex-shrink-0"}),e.jsx("p",{className:"text-sm text-red-400",children:J})]})})),b==="card"?ye?ot?e.jsxs("div",{className:"flex flex-col items-center gap-3 py-8","data-testid":"asaas-pending-poll",children:[e.jsx(U,{className:"w-6 h-6 animate-spin text-emerald-400"}),e.jsx("span",{className:"text-sm text-gray-400",children:"Aguardando confirmação do pagamento..."})]}):e.jsx(Ua,{installmentOptions:ha,prefill:m?{name:h.userName,email:h.email,phone:h.phone}:{name:r.userName,email:r.email,phone:r.phone},onSubmit:Sa,processing:We,ctaText:pt,exactCtaText:m,ctaColor:ut,totalCentavos:M,checkoutAddress:D,onCheckoutAddressChange:He,captureCpfCnpj:m||r.captureCheckoutTaxId,authoritativeCpfCnpj:m?h.cpf:void 0,onInstallmentChange:fa,emphasizeCta:m}):Te?e.jsxs(La,{stripe:Ta,options:{clientSecret:Te,appearance:{theme:"night",variables:{colorPrimary:"#10b981",colorBackground:"#0a0a18",colorText:"#ffffff",colorDanger:"#ef4444",borderRadius:"12px",fontFamily:"Inter, system-ui, sans-serif",fontSizeBase:"14px"},rules:{".Input":{border:"1px solid rgba(255,255,255,0.12)",backgroundColor:"rgba(255,255,255,0.04)",padding:"14px 16px"},".Input:focus":{border:"1px solid rgba(16,185,129,0.6)",boxShadow:"0 0 0 4px rgba(16,185,129,0.12)"},".Label":{color:"rgba(255,255,255,0.5)",fontSize:"12px",fontWeight:"600",textTransform:"uppercase",letterSpacing:"0.05em"},".Tab":{display:"none"},".Tab--selected":{display:"none"},".TabLabel":{display:"none"},".Block":{backgroundColor:"transparent",border:"none",padding:"0"}}}},children:[e.jsx(Ka,{onSuccess:ve,onError:(t,a)=>{q(t),(a?.type==="card_error"||a?.decline_code)&&(te(!0),ae(a?.decline_code||a?.code||null))},processing:We,setProcessing:ue,country:r.country||"BR",captureBillingAddress:r.captureCheckoutAddress,totalCentavos:M,formatPrice:g,ctaText:pt,exactCtaText:m,ctaColor:ut}),(r.currency||"BRL").toUpperCase()==="EUR"&&e.jsx("p",{className:"mt-3 text-[11px] leading-relaxed text-gray-500 text-center","data-testid":"text-eu-withdrawal-waiver",children:l("euWithdrawalWaiver")})]},Te):J?e.jsx("div",{className:"flex justify-center py-6",children:e.jsxs("button",{onClick:()=>O("card",p,!0),className:"inline-flex items-center gap-2 px-5 py-3 bg-emerald-600 hover:bg-emerald-500 text-white font-semibold text-sm rounded-xl transition-colors","data-testid":"button-retry-prepare-card",children:[e.jsx(Me,{className:"w-4 h-4"})," ",l("tryAgain")]})}):J?e.jsx("div",{className:"flex justify-center py-6",children:e.jsxs("button",{onClick:()=>O("card",p,!0),className:"inline-flex items-center gap-2 px-5 py-3 bg-emerald-600 hover:bg-emerald-500 text-white font-semibold text-sm rounded-xl transition-colors","data-testid":"button-retry-prepare-card-bumps",children:[e.jsx(Me,{className:"w-4 h-4"})," ",l("tryAgain")]})}):e.jsxs("div",{className:"flex items-center justify-center py-8",children:[e.jsx(U,{className:"w-6 h-6 animate-spin text-emerald-400"}),e.jsx("span",{className:"ml-2 text-sm text-gray-400",children:l("cta.preparingPayment")||"Preparando pagamento seguro..."})]}):pe?e.jsx(Ga,{checkoutId:i,token:x,onPaid:ve,initialPixData:pe,onEvent:Ye,pixFirst:be}):J?e.jsx("div",{className:"flex justify-center py-6",children:e.jsxs("button",{onClick:()=>O("pix",p,!0),className:"inline-flex items-center gap-2 px-5 py-3 bg-emerald-600 hover:bg-emerald-500 text-white font-semibold text-sm rounded-xl transition-colors","data-testid":"button-retry-prepare-pix",children:[e.jsx(Me,{className:"w-4 h-4"})," ",l("tryAgain")]})}):J?e.jsx("div",{className:"flex justify-center py-6",children:e.jsxs("button",{onClick:()=>O("pix",p,!0),className:"inline-flex items-center gap-2 px-5 py-3 bg-emerald-600 hover:bg-emerald-500 text-white font-semibold text-sm rounded-xl transition-colors","data-testid":"button-retry-prepare-pix-bumps",children:[e.jsx(Me,{className:"w-4 h-4"})," ",l("tryAgain")]})}):e.jsxs("div",{className:"flex items-center justify-center py-8",children:[e.jsx(U,{className:"w-6 h-6 animate-spin text-emerald-400"}),e.jsx("span",{className:"ml-2 text-sm text-gray-400",children:l("cta.preparingPix")||"Gerando PIX..."})]})]}),e.jsxs("div",{className:"flex items-center justify-center gap-5 text-[10px] text-gray-600",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ht,{className:"w-3 h-3"})," ",l("trust.guarantee7days")]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Ue,{className:"w-3 h-3"})," ",l("trust.encryptedInfo")]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Fe,{className:"w-3 h-3"})," Stripe"]})]})]}):e.jsxs("div",{className:`lg:grid lg:grid-cols-[1fr_360px] ${m?"lg:gap-6":"lg:gap-10"}`,"data-testid":m?"ativo-standard-checkout":void 0,children:[e.jsxs("div",{className:be?"flex flex-col gap-6 lg:gap-8":"space-y-6 lg:space-y-8",children:[m&&K&&e.jsx("section",{className:`overflow-hidden rounded-2xl border ${K.id==="complete"?"border-amber-400/30 bg-gradient-to-br from-amber-400/[0.08] to-white/[0.025]":"border-emerald-400/20 bg-gradient-to-br from-emerald-400/[0.07] to-white/[0.025]"}`,"data-testid":"ativo-selected-package",children:K.id==="apice"?e.jsxs("div",{className:"relative overflow-hidden p-4 sm:p-6",children:[e.jsx("div",{"aria-hidden":"true",className:"absolute -right-12 -top-16 h-44 w-44 rounded-full bg-emerald-400/10 blur-3xl"}),e.jsx("p",{className:"relative text-[11px] font-black uppercase tracking-[.16em] text-emerald-300",children:"O que você vai re
1ceber:"}),e.jsxs("p",{className:"relative mt-2.5 text-[15px] font-semibold leading-6 text-white sm:text-lg sm:leading-8",children:[e.jsx("strong",{className:"text-emerald-300",children:"SEU LIVRO ESCRITO"}),", com ",e.jsx("strong",{children:"CAPA PROFISSIONAL"}),", publicado na ",e.jsx("strong",{children:"VITRINE DA ÁPICE BOOKS"}),", com ",e.jsx("strong",{children:"PÁGINA DE VENDAS PERSUASIVA"})," e experiência de ",e.jsx("strong",{children:"LEITURA COM COMUNIDADE"}),"..."]}),e.jsx("p",{className:"relative mt-3 text-[13px] font-black uppercase leading-5 text-white sm:text-base",children:"TUDO ISSO ENTREGUE PRONTO EM ATÉ UMA HORA"}),e.jsxs("div",{className:"relative mt-3 flex flex-wrap items-end gap-x-2 gap-y-1 rounded-xl border border-emerald-300/20 bg-black/25 px-3 py-2.5 sm:rounded-2xl sm:px-4 sm:py-3",children:[re&&e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"pb-1 text-xs font-bold text-gray-400 line-through decoration-red-400/80 decoration-2 sm:text-sm",children:["DE ",g(re)]}),e.jsx("span",{className:"pb-1 text-[10px] font-black uppercase tracking-wider text-gray-400 sm:text-xs",children:"por"})]}),e.jsx("strong",{className:"text-3xl font-black leading-none tracking-[-.05em] text-emerald-300 sm:text-5xl",children:g(_e)})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col gap-3 border-b border-white/[0.06] px-5 py-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-[10px] font-extrabold uppercase tracking-[.16em] text-amber-300",children:["Pacote escolhido · ",K.eyebrow]}),e.jsx("h2",{className:"mt-1 text-xl font-extrabold text-white",children:K.title})]}),e.jsx("p",{className:"text-2xl font-black text-white",children:g(lt??K.priceCents)})]}),e.jsxs("div",{className:"p-5",children:[e.jsx("p",{className:"text-sm leading-6 text-gray-300",children:K.summary}),e.jsx("ul",{className:"mt-4 grid gap-2 sm:grid-cols-2",children:K.benefits.map(t=>e.jsxs("li",{className:"flex items-start gap-2 text-xs leading-5 text-gray-300",children:[e.jsx(Fe,{className:"mt-0.5 h-4 w-4 shrink-0 text-amber-300"}),e.jsx("span",{children:t})]},t))})]})]})}),m&&e.jsxs("section",{className:"overflow-hidden rounded-2xl border border-white/[0.08] bg-white/[0.03]","data-testid":"ativo-identity-card",children:[e.jsxs("div",{className:"flex items-center gap-2 border-b border-white/[0.06] bg-white/[0.02] px-5 py-4",children:[e.jsx(Xe,{className:"h-4 w-4 text-emerald-400"}),e.jsx("h2",{className:"text-sm font-semibold text-white",children:"Seus dados"})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-3 p-5 sm:grid-cols-2",children:[e.jsxs("label",{className:"sm:col-span-2",children:[e.jsx("span",{className:"mb-1.5 block text-xs font-medium text-gray-300",children:"Nome completo"}),e.jsx("input",{id:"input-ativo-nome",value:h.userName,onChange:t=>dt("userName",t.target.value),onBlur:()=>{b==="card"?Ce("pix"):O("pix",new Set(p),!0)},required:!0,minLength:2,maxLength:120,className:`h-11 w-full rounded-xl border bg-white/[0.04] px-3 text-base text-white outline-none transition focus:border-emerald-400/60 focus:ring-2 focus:ring-emerald-400/10 ${ge==="userName"?"border-emerald-400/70 ring-2 ring-emerald-400/15":"border-white/[0.08]"}`,autoComplete:"name","data-testid":"input-ativo-nome"})]}),e.jsxs("label",{children:[e.jsx("span",{className:"mb-1.5 block text-xs font-medium text-gray-300",children:"E-mail"}),e.jsx("input",{id:"input-ativo-email",type:"email",value:h.email,onChange:t=>dt("email",t.target.value),onBlur:()=>{b==="card"?Ce("pix"):O("pix",new Set(p),!0)},required:!0,maxLength:320,className:`h-11 w-full rounded-xl border bg-white/[0.04] px-3 text-base text-white outline-none transition focus:border-emerald-400/60 focus:ring-2 focus:ring-emerald-400/10 ${ge==="email"?"border-emerald-400/70 ring-2 ring-emerald-400/15":"border-white/[0.08]"}`,autoComplete:"email","data-testid":"input-ativo-email"})]}),e.jsxs("label",{children:[e.jsx("span",{className:"mb-1.5 block text-xs font-medium text-gray-300",children:"Telefone"}),e.jsx("input",{id:"input-ativo-telefone",type:"tel",value:h.phone,onChange:t=>dt("phone",t.target.value),onBlur:()=>{b==="card"?Ce("pix"):O("pix",new Set(p),!0)},required:!0,minLength:8,maxLength:40,inputMode:"tel",className:`h-11 w-full rounded-xl border bg-white/[0.04] px-3 text-base text-white outline-none transition focus:border-emerald-400/60 focus:ring-2 focus:ring-emerald-400/10 ${ge==="p
1hone"?"border-emerald-400/70 ring-2 ring-emerald-400/15":"border-white/[0.08]"}`,autoComplete:"tel","data-testid":"input-ativo-telefone"})]}),e.jsx("div",{className:"min-h-5 text-xs sm:col-span-2","aria-live":"polite",children:fe?e.jsx("span",{className:"text-red-300","data-testid":"text-ativo-contact-error",children:fe}):Z==="saving"?e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-gray-400",children:[e.jsx(U,{className:"h-3 w-3 animate-spin"})," Salvando seus dados..."]}):Z==="saved"?e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-emerald-300",children:[e.jsx(F,{className:"h-3 w-3"})," Dados salvos"]}):null})]})]}),!he&&e.jsx("div",{className:"relative bg-gradient-to-br from-emerald-500/[0.06] to-teal-500/[0.03] border border-emerald-500/15 rounded-2xl lg:rounded-3xl p-4 sm:p-5 overflow-hidden",children:e.jsxs("div",{className:"flex items-center gap-3 sm:gap-4",children:[e.jsx("div",{className:"w-11 h-11 sm:w-12 sm:h-12 bg-gradient-to-br from-emerald-400/20 to-emerald-600/10 rounded-xl flex items-center justify-center flex-shrink-0 border border-emerald-500/20",children:e.jsx(Le,{className:"w-5 h-5 sm:w-6 sm:h-6 text-emerald-400"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-[10px] sm:text-xs text-emerald-400 uppercase tracking-widest font-bold mb-0.5",children:l("mainProduct.name")}),e.jsxs("h2",{"data-testid":"text-book-title",className:"text-base sm:text-lg font-bold text-white leading-tight truncate",children:['"',r.bookTitle,'"']}),r.bookSubtitle&&e.jsx("p",{className:"text-xs text-gray-400 mt-0.5 truncate",children:r.bookSubtitle})]})]})}),e.jsxs("div",{children:[!he&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[e.jsx("div",{className:"h-px flex-1 bg-gradient-to-r from-transparent via-emerald-500/20 to-transparent"}),e.jsxs("h3",{className:"text-base font-extrabold text-white flex items-center gap-2 uppercase tracking-wide",children:[e.jsx(De,{className:"w-5 h-5 text-emerald-400"}),l("tiers.sectionTitle")]}),e.jsx("div",{className:"h-px flex-1 bg-gradient-to-r from-transparent via-emerald-500/20 to-transparent"})]}),e.jsx("p",{className:"text-center text-sm text-gray-400 mb-6 -mt-2",children:l("tiers.sectionSubtitle")}),e.jsx("div",{className:"grid grid-cols-3 gap-1.5 sm:gap-3 mb-4 items-stretch",children:za.map(t=>{const a=me===t.id,o=gt(t.id),s=qa[t.id],d=s==="book_and_cover"?ie.book_and_cover_original:s==="publish_bundle"?ie.publish_bundle_original:null,c=s==="book_and_cover"?ie.book_and_cover:s==="publish_bundle"?ie.publish_bundle:null,u=d!==null&&c!==null?Math.round((1-c/d)*100):null,f=d!==null?Math.round(d*100):null,Re=Jt.filter(qt=>qt[t.id]).length,Q=Jt.length,w={essencial:{border:"border-gray-500/30",bg:"from-gray-500/5 to-gray-600/5",accent:"text-gray-400",ring:"ring-gray-500/40",badge:"",icon:Le,iconBg:"bg-gray-500/10 border-gray-500/20",iconColor:"text-gray-300"},profissional:{border:"border-emerald-500/40",bg:"from-emerald-500/10 to-teal-500/5",accent:"text-emerald-400",ring:"ring-emerald-500/50",badge:"bg-emerald-500",icon:ta,iconBg:"bg-emerald-500/15 border-emerald-500/30",iconColor:"text-emerald-300"},premium:{border:"border-yellow-500/40",bg:"from-yellow-500/10 to-amber-500/5",accent:"text-yellow-400",ring:"ring-yellow-500/50",badge:"bg-gradient-to-r from-yellow-500 to-amber-500",icon:Ds,iconBg:"bg-gradient-to-br from-yellow-400/25 to-amber-500/25 border-yellow-400/40",iconColor:"text-yellow-300"}}[t.id],P=w.icon;return e.jsxs("button",{"data-testid":`tier-${t.id}`,onClick:()=>us(t.id),className:`relative flex flex-col text-left rounded-xl border-2 p-2 sm:p-4 transition-all duration-300 cursor-pointer ${a?`${w.border} bg-gradient-to-br ${w.bg} ring-2 ${w.ring} shadow-lg sm:scale-[1.02]`:"border-white/[0.08] bg-white/[0.02] hover:bg-white/[0.04] hover:border-white/[0.15]"}`,children:[t.badge&&e.jsx("div",{className:`absolute -top-2.5 left-1/2 -translate-x-1/2 ${w.badge} text-white text-[7px] sm:text-[10px] font-black px-1.5 sm:px-3 py-0.5 sm:py-1 rounded-full shadow-lg uppercase tracking-wider whitespace-nowrap`,children:l(`tiers.${t.badge}`)}),e.jsxs("div",{className:"flex flex-col items-center sm:items-start gap-1 sm:gap-1.5 mb-1.5 sm:mb-2 mt-1.5 sm:mt-1",children:[e.jsx("div",{className:`w-6 h-6 sm:w-9 sm:h-9 rounded-lg flex items-center justify-center border ${w.iconBg}`,children:e.jsx(P,{className:`w-3 h-3 sm:w-4 sm:h-4 ${w.iconColor}`})}),e.jsx("div",{className:`text-[9px] sm:text-xs font-black uppercase tracking-wide sm:tracking-widest text-center sm:text-left ${a?w.accent:"text-gray-500"}`,children:l(`tiers.${t.id}.name`)})]}),e.jsxs("div",{className:"text-center sm:text-left mb-1.5 sm:mb-3",children:[f!==null&&e.jsx("div",{className:"text-[8px] sm:text-[11px] text-gray-600 line-through leading-none mb-0.5",children:g(f)}),e.jsx("div",{className:"text-sm sm:text-2xl font-extrabold text-white leading-tight",children:g(o)}),u!==null?e.jsx("div",{className:`inline-flex items-center mt-0.5 sm:mt-1 px-1.5 py-0.5 rounded-md ${t.id==="premium"?"bg-amber-500/20 border border-amber-500/40":"bg-emerald-500/15 border border-emerald-500/30"}`,children:e.jsxs("span",{className:`text-[8px] sm:text-[10px] font-extrabold ${t.id==="premium"?"text-amber-200":"text-emerald-300"}`,children:["-",u,"%"]})}):e.jsx("div",{className:"text-[7px] sm:text-[10px] text-gray-500 font-medium mt
1-0.5",children:l("tiers.oneTimePayment")})]}),e.jsxs("div",{className:"text-[8px] sm:text-[11px] text-gray-500 mb-1.5 sm:mb-3 text-center sm:text-left leading-snug",children:[e.jsx("span",{className:`font-bold ${a?w.accent:"text-gray-300"}`,children:Re})," ",C?"de":"of"," ",Q," ",C?"itens":"items"]}),e.jsx("div",{className:`mt-auto py-1.5 sm:py-2 rounded-lg text-center text-[8px] sm:text-xs font-extrabold uppercase tracking-wider transition-all ${a?`${t.id==="premium"?"bg-yellow-500 text-black":"bg-emerald-500 text-white"} shadow-md`:"bg-white/5 text-gray-400"}`,children:a?C?"SELECIONADO":"SELECTED":C?"SELECIONAR":"SELECT"})]},t.id)})}),e.jsxs("div",{className:"rounded-xl border border-amber-500/30 bg-gradient-to-r from-amber-500/[0.08] via-orange-500/[0.06] to-amber-500/[0.08] p-3 sm:p-3.5 flex items-center gap-2.5 sm:gap-3 mb-3",children:[e.jsx("div",{className:"shrink-0 w-8 h-8 sm:w-10 sm:h-10 rounded-full bg-gradient-to-br from-amber-400/30 to-orange-500/30 border border-amber-400/40 flex items-center justify-center",children:e.jsx(Dt,{className:"w-4 h-4 sm:w-5 sm:h-5 text-amber-300 fill-amber-300/50"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-[11px] sm:text-sm font-bold text-amber-100 leading-snug",children:C?`No pacote ${l("tiers.premium.name")} você economiza ${g(Math.round((ie.publish_bundle_original-ie.publish_bundle)*100))}`:`Save ${g(Math.round((ie.publish_bundle_original-ie.publish_bundle)*100))} with the ${l("tiers.premium.name")} package`}),e.jsx("div",{className:"text-[10px] sm:text-xs text-amber-200/70 leading-snug mt-0.5",children:C?"Tudo pronto pra publicar e vender — sem precisar contratar capista, diagramador, copywriter ou agência de marketing.":"Everything ready to publish and sell — no need to hire a cover designer, formatter, copywriter or marketing agency."})]})]}),e.jsxs("div",{className:"flex items-center justify-center gap-1.5 text-[11px] sm:text-xs font-semibold text-emerald-400 mb-4 py-1",children:[e.jsx(De,{className:"w-3 h-3"}),e.jsx("span",{children:C?"Comparação completa dos pacotes":"Full package comparison"})]}),e.jsx("div",{className:"mb-4 rounded-xl border border-white/10 bg-white/[0.02] overflow-hidden","data-testid":"section-comparison-table",children:e.jsxs("div",{className:"grid grid-cols-[1fr_auto_auto_auto] text-[10px] sm:text-xs",children:[e.jsx("div",{className:"px-2.5 sm:px-3 py-2.5 bg-white/[0.03] text-gray-500 font-medium text-[9px] sm:text-[11px] uppercase tracking-wide",children:C?"Inclui":"Includes"}),e.jsx("div",{className:"px-1.5 sm:px-2 py-2.5 bg-white/[0.03] text-center text-gray-400 font-bold text-[9px] sm:text-[11px]",children:l("tiers.essencial.name")}),e.jsx("div",{className:"px-1.5 sm:px-2 py-2.5 bg-emerald-500/10 text-center text-emerald-300 font-bold text-[9px] sm:text-[11px]",children:l("tiers.profissional.name")}),e.jsx("div",{className:"px-1.5 sm:px-2 py-2.5 bg-gradient-to-b from-yellow-500/30 to-yellow-500/15 text-center text-yellow-200 font-extrabold text-[9px] sm:text-[11px] border-l-2 border-r-2 border-t-2 border-yellow-400/40",children:l("tiers.premium.name")}),Jt.map((t,a)=>{const o=a%2===1;return e.jsxs("div",{className:"contents",children:[e.jsx("div",{className:`px-2.5 sm:px-3 py-2 text-gray-300 border-t border-white/5 leading-snug ${o?"bg-white/[0.015]":""}`,children:C?t.pt:t.en}),e.jsx("div",{className:`px-1.5 sm:px-2 py-2 text-center border-t border-white/5 ${o?"bg-white/[0.015]":""}`,children:t.essencial?e.jsx(F,{className:"w-3.5 h-3.5 text-gray-400 inline"}):e.jsx("span",{className:"text-gray-700 text-base leading-none",children:"—"})}),e.jsx("div",{className:`px-1.5 sm:px-2 py-2 text-center border-t border-white/5 ${o?"bg-emerald-500/[0.07]":"bg-emerald-500/[0.04]"}`,children:t.profissional?e.jsx(F,{className:"w-3.5 h-3.5 text-emerald-400 inline"}):e.jsx("span",{className:"text-gray-700 text-base leading-none",children:"—"})}),e.jsx("div",{className:`px-1.5 sm:px-2 py-2 text-center border-t-2 border-l-2 border-r-2 border-yellow-400/40 ${o?"bg-yellow-500/[0.14]":"bg-yellow-500/[0.10]"}`,children:e.jsx(F,{className:"w-3.5 h-3.5 text-yellow-300 inline",strokeWidth:3})})]},a)}),e.jsx("div",{className:"border-t border-white/5"}),e.jsx("div",{className:"border-t border-white/5"}),e.jsx("div",{className:"border-t border-white/5 bg-emerald-500/[0.04]"}),e.jsx("div",{className:"border-t-2 border-b-2 border-l-2 border-r-2 border-yellow-400/40 bg-yellow-500/[0.10] h-1.5"})]})})]}),he&&e.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[e.jsx("div",{className:"h-px flex-1 bg-gradient-to-r from-transparent via-emerald-500/20 to-transparent"}),e.jsxs("h3",{className:"text-base font-extrabold text-white flex items-center gap-2 uppercase tracking-wide",children:[e.jsx(Ft,{className:"w-5 h-5 text-emerald-400"}),l("bumps.sectionTitle")]}),e.jsx("div",{className:"h-px flex-1 bg-gradient-to-r from-transparent via-emerald-500/20 to-transparent"})]}),(he||W.length>0)&&e.jsxs("div",{id:m?"ativo-order-bumps":void 0,className:"space-y-3 mt-3 pt-3 border-t border-white/[0.06]",children:[he&&zt.filter(t=>(m||t.type!=="combo_publish")&&!W.some(a=>a.id===t.type)).map(t=>{const a=p.has(t.type),o=!I&&p.has("combo_publish"),s=Va[t.type]||Va.cover_ebook,d=pr[t.type],c=t.type===bs;return e.jsxs("div",{"data-testid":`bump-${t.type}`,className:`relative border rounded-2xl overflow-hidden transition-all duration-300 ${a?`bg-gradient-to-r ${s.bg} ${s.border} shadow-lg ${s.glow}`:c?"border-amber-400/30 bg-amber-400/[0.03] hover:bg-amber-400/[0.05] hover:border-amber-400/40":"border-white/[0.06] bg-white/[0.02] hover:bg-white/[0.04] hover:border-white/[0.12]"}`,children:[c&&!a&&e.jsxs("div",{className:"absolute top-0 right-0 z-10 rounded-bl-lg rounded-tr-2xl bg-gradient-to-r from-amber-400 to-amber-500 px-2.5 py-1 text-[9px] font-extrabold uppercase tracking-wider text-black shadow-sm flex items-center gap-1","data-testid":`badge-recommended-${t.type}`,children:[e.jsx(Dt,{className:"w-3 h-3 fill-black"}),C?"Recomendado":"Recommended"]}),e.jsxs("div",{className:"p-4 lg:p-5 space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:`w-10 h-10 lg:w-11 lg:h-11 rounded-xl flex items-center justify-center flex-shrink-0 ${a?`bg-white/10 ${s.icon}`:"bg-white/5 text-gray-500"}`,children:ur[t.type]||e.jsx(Ft,{className:"w-5 h-5"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:`text-sm lg:text-base font-bold block ${a?"text-white":"text-gray-200"}`,children:t.name||l(`bumps.${t.type}.name`)}),d&&e.jsx("span",{className:`text-[11px] lg:text-xs font-semibold block mt-0.5 ${a?s.text:"text-gray-400"}`,children:C?d.pt:d.en})]}
1),e.jsx(Gt,{priceCents:t.priceInCentavos,anchorCents:t.originalPrice?t.originalPrice*100:null,paymentMethod:b,installment:je,formatPrice:g,priceClassName:"text-lg lg:text-xl text-white",oneTimeLabel:se&&!o?l("tiers.oneTimePayment"):"",anchorTestId:`text-anchor-${t.type}`,strikethroughOnly:o&&a,language:C?"pt":"en"})]}),e.jsxs("div",{className:"flex gap-3",children:[(t.imageUrl||Ha[t.type])&&e.jsx("div",{className:"relative rounded-lg overflow-hidden w-20 h-20 lg:w-24 lg:h-24 flex-shrink-0 border border-white/10",children:e.jsx("img",{src:t.imageUrl||Ha[t.type],alt:"",className:"w-full h-full object-cover",loading:"lazy"})}),e.jsx("p",{className:`text-[13px] leading-relaxed whitespace-pre-line flex-1 ${a?"text-gray-300":"text-gray-500"}`,children:t.description||l(`bumps.${t.type}.description`)})]}),!m&&e.jsx(Xa,{scopeKey:t.type,selectedBumps:p,onAddBump:et}),e.jsx("button",{onClick:()=>{et(t.type),Ke("essencial")},className:m?`flex w-full cursor-pointer select-none items-center justify-center gap-2 rounded-xl border py-3 text-sm font-bold transition-all ${a?"border-emerald-400/50 bg-emerald-500/15 text-emerald-300":"border-white/10 bg-white/[0.04] text-gray-200 hover:border-emerald-500/35 hover:bg-emerald-500/[0.06]"}`:`w-full py-3.5 lg:py-4 rounded-xl font-extrabold text-sm uppercase tracking-wider transition-all duration-300 flex items-center justify-center gap-2 cursor-pointer select-none ${a?"bg-emerald-500 text-white shadow-lg shadow-emerald-500/30 scale-[1.01]":`bg-gradient-to-r ${s.btnBg} border-2 ${s.border} ${s.text} hover:brightness-125 shadow-md ${s.glow}`}`,style:!m&&!a?{animation:"bumpPulse 2s ease-in-out infinite"}:void 0,children:m?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:`flex h-4 w-4 items-center justify-center rounded border ${a?"border-emerald-400 bg-emerald-500":"border-white/30 bg-black/20"}`,children:a&&e.jsx(F,{className:"h-3 w-3 text-white"})}),a?"Adicionado ao pedido":"Adicionar ao pedido"]}):a?e.jsxs(e.Fragment,{children:[e.jsx(F,{className:"w-4 h-4"})," ",C?"ADICIONADO!":"ADDED!"]}):e.jsxs(e.Fragment,{children:[e.jsx(De,{className:"w-4 h-4"})," ",l("bumps.checkboxLabel")]})})]})]},t.type)}),!m&&zt.filter(t=>t.type==="combo_publish"&&!W.some(a=>a.id===t.type)).map(t=>{const a=p.has("combo_publish");return e.jsxs("div",{"data-testid":"bump-combo_publish",className:`relative border-2 rounded-2xl overflow-hidden transition-all duration-300 ${a?"border-yellow-500/50 bg-gradient-to-r from-yellow-500/[0.08] via-amber-500/[0.06] to-yellow-500/[0.08] shadow-xl shadow-yellow-500/10":"border-dashed border-yellow-600/30 bg-gradient-to-r from-yellow-500/[0.03] to-amber-500/[0.02] hover:border-yellow-600/50"}`,children:[e.jsx("div",{className:"absolute top-0 left-0 right-0 h-0.5 bg-gradient-to-r from-yellow-500/0 via-yellow-400/60 to-yellow-500/0"}),e.jsxs("div",{className:"p-4 lg:p-5 space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:`w-10 h-10 lg:w-11 lg:h-11 rounded-xl flex items-center justify-center flex-shrink-0 ${a?"bg-yellow-500/20 text-yellow-400":"bg-yellow-500/10 text-yellow-500/60"}`,children:e.jsx(Xt,{className:"w-5 h-5"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"font-extrabold text-white text-sm lg:text-base",children:l("bumps.combo_publish.name")}),e.jsxs("span",{className:"bg-gradient-to-r from-red-500 to-red-600 text-white text-[10px] font-black px-2.5 py-0.5 rounded-full shadow-md shadow-red-500/20 uppercase",children:["-",t.discountPercent,"%"]})]}),e.jsx("p",{className:"text-xs text-yellow-400/80 mt-0.5 font-semibold",children:l("bumps.combo_publish.allProductsAbove")})]}),e.jsx(Gt,{priceCents:t.priceInCentavos,anchorCents:(t.originalPrice||89.97)*100,paymentMethod:b,installment:je,formatPrice:g,priceClassName:"text-xl lg:text-2xl text-yellow-400",oneTimeLabel:se?l("tiers.oneTimePayment"):"",language:C?"pt":"en"})]}),e.jsx("p",{className:"text-sm text-gray-400 leading-relaxed",children:l("bumps.combo_publish.description")}
1),e.jsx(Xa,{scopeKey:"combo_publish",selectedBumps:p,onAddBump:et}),e.jsx("button",{onClick:()=>{et("combo_publish"),Ke(p.has("combo_publish")?"essencial":"premium")},className:`w-full py-3.5 lg:py-4 rounded-xl font-extrabold text-sm uppercase tracking-wider transition-all duration-300 flex items-center justify-center gap-2 cursor-pointer select-none ${a?"bg-yellow-500 text-black shadow-lg shadow-yellow-500/30 scale-[1.01]":"bg-gradient-to-r from-yellow-500/20 to-amber-500/15 border-2 border-yellow-500/40 text-yellow-400 hover:brightness-125 shadow-md shadow-yellow-500/20"}`,style:a?void 0:{animation:"bumpPulse 2s ease-in-out infinite"},children:a?e.jsxs(e.Fragment,{children:[e.jsx(F,{className:"w-4 h-4"})," ",C?"COMBO ATIVADO!":"COMBO ACTIVATED!"]}):e.jsxs(e.Fragment,{children:[e.jsx(Xt,{className:"w-4 h-4"})," ",l("bumps.checkboxLabel")]})})]})]},"combo_publish")}),W.filter(t=>{const a=Array.from(p).find(o=>ze(o));return!a||!Vt(a).includes(t.id)}).map(t=>{const a=p.has(t.id),s={product:C?"Produto":"Product",course:C?"Curso":"Course",portable_credit:C?"Crédito":"Credit"}[t.kind]??t.kind;return e.jsxs("div",{"data-testid":`funnel-unified-bump-${t.id}`,className:`relative overflow-hidden rounded-2xl border-2 border-dashed transition-all duration-300 ${a?"border-amber-300/70 bg-gradient-to-br from-amber-300/[0.18] via-yellow-400/[0.11] to-orange-400/[0.08] shadow-lg shadow-amber-500/15":"border-amber-300/45 bg-gradient-to-br from-amber-300/[0.13] via-yellow-400/[0.08] to-orange-400/[0.05] shadow-md shadow-amber-500/[0.08] hover:border-amber-300/70 hover:bg-amber-300/[0.16]"}`,children:[e.jsx("div",{className:"absolute inset-x-0 top-0 h-px bg-gradient-to-r from-transparent via-amber-200/80 to-transparent"}),e.jsxs("div",{className:"p-4 lg:p-5 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-black uppercase tracking-[0.16em] text-amber-200",children:[e.jsx(De,{className:"h-3.5 w-3.5 fill-amber-300/30 text-amber-300"}),C?"Oferta especial desta compra":"Special offer with this purchase"]}),e.jsxs("div",{className:"flex items-start gap-3",children:[t.imageUrl?e.jsx("div",{className:"relative rounded-lg overflow-hidden w-10 h-10 lg:w-11 lg:h-11 flex-shrink-0 border border-amber-200/25",children:e.jsx("img",{src:t.imageUrl,alt:"",className:"w-full h-full object-cover",loading:"lazy"})}):e.jsx("div",{className:"flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-xl border border-amber-300/20 bg-amber-300/10 text-amber-300 lg:h-11 lg:w-11",children:e.jsx(Ft,{className:"w-5 h-5"})}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("div",{className:"flex items-center gap-2 flex-wrap mb-0.5",children:[e.jsx("span",{className:"text-sm font-extrabold text-white lg:text-base",children:t.title}),e.jsx("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded text-[9px] font-bold uppercase tracking-wider bg-amber-300/10 text-amber-100/80 border border-amber-200/20",children:s})]})}),e.jsx(Gt,{priceCents:t.priceCents,anchorCents:t.anchorCents,paymentMethod:b,installment:je,formatPrice:g,priceClassName:"text-lg lg:text-xl text-amber-200",oneTimeLabel:se?l("tiers.oneTimePayment"):"",priceTestId:`text-price-${t.id}`,anchorTestId:`text-anchor-${t.id}`,language:C?"pt":"en"})]}),e.jsx("p",{className:"text-[13px] leading-relaxed text-amber-50/70",children:t.description}),e.jsxs("label",{htmlFor:`funnel-unified-bump-toggle-${t.id}`,className:`flex w-full cursor-pointer select-none items-center justify-center gap-2 rounded-xl border py-3 text-sm font-bold transition-all ${a?"border-emerald-400/50 bg-emerald-500/15 text-emerald-300":"border-white/10 bg-white/[0.04] text-gray-200 hover:border-emerald-500/35 hover:bg-emerald-500/[0.06]"}`,"data-testid":`label-funnel-unified-bump-${t.id}`,children:[e.jsx("input",{id:`funnel-unified-bump-toggle-${t.id}`,type:"checkbox",checked:a,onChange:()=>et(t.id),className:"sr-only","data-testid":`checkbox-funnel-unified-bump-${t.id}`}),e.jsx("span",{className:`flex h-4 w-4 items-center justify-center rounded border ${a?"border-emerald-400 bg-emerald-500":"border-white/30 bg-black/20"}`,children:a&&e.jsx(F,{className:"h-3 w-3 text-white"})}),a?C?"Adicionado ao pedido":"Added to order":C?"Adicionar ao pedido":"Add to order"]})]})]},t.id)})]})]}),(()=>{const t=pe?e.jsx(Ga,{checkoutId:i,token:x,onPaid:ve,initialPixData:pe,onEvent:Ye,pixFirst:be}):e.jsxs("div",{className:"flex items-center justify-center py-8","data-testid":"pix-first-preparing",children:[e.jsx(U,{className:"w-6 h-6 animate-spin text-emerald-400"}),e.jsx("span",{className:"ml-2 text-sm text-gray-400",children:l("cta.preparingPix")||"Gerando PIX..."})]}),a=(()=>{const s=Number(new Intl.DateTimeFormat("en-US",{timeZone:"America/Sao_Paulo",hour:"numeric",hour12:!1}).format(new Date)),d=s<12?"Bom dia":s<18?"Boa tarde":"Boa noite",c=(h.userName||r.userName||"").trim().split(/\s+/)[0];return`${d}${c?`, ${c}`:""}.`})(),o=e.jsxs(e.Fragment,{children:[be&&b==="pix"&&e.jsx(ir,{pixContent:t,greeting:a,promise:mr(N?.promiseSnapshot,K)}),(!be||b==="card")&&e.jsxs("h3",{className:"text-base lg:text-lg font-extrabold text-white mb-4 lg:mb-5 flex items-center gap-2",children:[e.jsx(Ue,{className:"w-5 h-5 text-emerald-400"}),l("paymentMethod")]}),Ne&&e.jsx("div",{className:"mb-6 space-y-2","data-testid":"payment-method-selector",children:e.jsxs("div",{className:`flex gap-2 bg-white/[0.03] p-1.5 rounded-2xl border border-white/[0.06] ${m?"flex-row-reverse":""}`,children:[e.jsxs("button",{"data-testid":"tab-card",onClick:()=>{ee("card"),te(!1),ae(null),q(null),Ye("card_selected")},className:`flex-1 py-3 rounded-xl font-bold text-sm transition-all duration-200 flex flex-col items-center justify-center gap-0.5 ${b==="card"?"bg-gradient-to-r from-emerald-500 to-emerald-600 text-white shadow-lg shadow-emerald-500/20":"text-gray-400 hover:text-gray-300 hover:bg-white/5"}`,children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(Ra,{className:"w-4 h-4"}),l("payment.tabCard")]}),e.jsx("span",{className:"text-[10px] font-medium opacity-70",children:"pagamento seguro"})]}),e.jsxs("button",{"data-testid":"tab-pix",onClick:()=>{ee("pix"),te(!1),ae(null),q(null)},className:`flex-1 py-3 rounded-xl font-bold text-sm transition-all duration-200 flex flex-col items-center justify-center gap-0.5 ${b==="pix"?"bg-gradient-to-r from-emerald-500 to-emerald-600 text-white shadow-lg shadow-emerald-500/20":"text-gray-400 hover:text-gray-300 hover:bg-white/5"}`,children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"
1currentColor",children:e.jsx("path",{d:"M17.66 7.93L14.76 5.03C14.37 4.64 13.74 4.64 13.35 5.03L12 6.38 10.65 5.03C10.26 4.64 9.63 4.64 9.24 5.03L6.34 7.93C5.95 8.32 5.95 8.95 6.34 9.34L9.24 12.24 6.34 15.14C5.95 15.53 5.95 16.16 6.34 16.55L9.24 19.45C9.63 19.84 10.26 19.84 10.65 19.45L12 18.1 13.35 19.45C13.74 19.84 14.37 19.84 14.76 19.45L17.66 16.55C18.05 16.16 18.05 15.53 17.66 15.14L14.76 12.24 17.66 9.34C18.05 8.95 18.05 8.32 17.66 7.93Z"})}),"PIX"]}),e.jsx("span",{className:"text-[10px] font-medium opacity-70",children:"aprovação imediata"})]})]})}),m&&b==="pix"&&e.jsx("div",{className:"mb-6 rounded-xl border border-emerald-500/20 bg-emerald-500/[0.06] px-3 py-2.5 text-xs leading-relaxed text-emerald-100","data-testid":"ativo-pix-no-cpf",children:"PIX não exige CPF. Seu nome, e-mail e telefone serão salvos normalmente para a compra."}),m&&b==="card"&&Qe==="asaas"&&e.jsxs("label",{className:"mb-6 block rounded-xl border border-white/[0.08] bg-white/[0.025] p-3",children:[e.jsxs("span",{className:"mb-1.5 block text-xs font-medium text-gray-300",children:["CPF ",e.jsx("span",{className:"font-normal text-gray-500",children:"— obrigatório somente para cartão"})]}),e.jsx("input",{ref:Ve,id:"input-ativo-cpf",value:h.cpf,onChange:s=>dt("cpf",sr(s.target.value)),onBlur:()=>{O("card",new Set(p),!0)},required:!0,inputMode:"numeric",autoComplete:"cpf",placeholder:"000.000.000-00",className:`h-11 w-full rounded-xl border bg-white/[0.04] px-3 text-base text-white outline-none transition focus:border-emerald-400/60 focus:ring-2 focus:ring-emerald-400/10 ${ge==="cpf"?"border-emerald-400/70 ring-2 ring-emerald-400/15":"border-white/[0.08]"}`,"data-testid":"input-ativo-cpf"}),e.jsx("span",{className:"mt-1.5 block min-h-4 text-[11px] text-gray-500","aria-live":"polite",children:L||"O CPF é validado e usado pelo servidor apenas no pagamento com cartão."})]}),r.captureCheckoutAddress&&!(b==="card"&&ye)&&e.jsx("div",{className:"mb-6",children:e.jsx(Da,{value:D,onChange:He})}),J&&(da&&se&&b==="card"?e.jsx(Fa,{declineCode:ma,paymentError:J,onPixFallback:()=>{ee("pix"),q(null),te(!1),ae(null),O("pix",p,!0)},isBrazil:Ne}):e.jsx("div",{className:"mb-5 space-y-3","data-testid":"text-payment-error",children:e.jsxs("div",{className:"bg-red-500/10 border border-red-500/20 rounded-2xl p-4 flex items-start gap-3",children:[e.jsx("div",{className:"w-6 h-6 rounded-full bg-red-500/20 flex items-center justify-center flex-shrink-0 mt-0.5",children:e.jsx(ea,{className:"w-3.5 h-3.5 text-red-400"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm text-red-300 font-semibold mb-0.5",children:"Pagamento não concluído"}),e.jsx("p",{className:"text-sm text-red-400/80",children:J})]})]})})),b==="card"?ye?ot?e.jsxs("div",{className:"flex flex-col items-center gap-3 py-8","data-testid":"asaas-pending-poll",children:[e.jsx(U,{className:"w-6 h-6 animate-spin text-emerald-400"}),e.jsx("span",{className:"text-sm text-gray-400",children:"Aguardando confirmação do pagamento..."})]}):e.jsx(Ua,{installmentOptions:ha,prefill:m?{name:h.userName,email:h.email,phone:h.phone}:{name:r.userName,email:r.email,phone:r.phone},onSubmit:Sa,processing:We,ctaText:pt,exactCtaText:m,ctaColor:ut,totalCentavos:M,checkoutAddress:D,onCheckoutAddressChange:He,captureCpfCnpj:m||r.captureCheckoutTaxId,authoritativeCpfCnpj:m?h.cpf:void 0,onInstallmentChange:fa,emphasizeCta:m}):Te?e.jsxs(La,{stripe:Ta,options:{clientSecret:Te,appearance:{theme:"night",variables:{colorPrimary:"#10b981",colorBackground:"#0a0a18",colorText:"#ffffff",colorDanger:"#ef4444",borderRadius:"12px",fontFamily:"Inter, system-ui, sans-serif",fontSizeBase:"15px",spacingUnit:"5px",colorTextPlaceholder:"rgba(255,255,255,0.3)"},rules:{".Input":{border:"1px solid rgba(255,255,255,0.12)",backgroundColor:"rgba(255,255,255,0.04)",padding:"14px 16px",fontSize:"15px",transition:"all 0.2s ease"},".Input:focus":{border:"1px solid rgba(16,185,129,0.6)",boxShadow:"0 0 0 4px rgba(16,185,129,0.12)",backgroundColor:"rgba(255,255,255,0.06)"},".Input:hover":{border:"1px solid rgba(255,255,255,0.2)"},".Label":{color:"rgba(255,255,255,0.5)",fontSize:"12px",fontWeight:"600",textTransform:"uppercase",letterSpacing:"0.05em",marginBottom:"6px"},".Tab":{border:"none",backgroundColor:"transparent",display:"none"},".Tab--selected":{display:"none"},".TabLabel":{display:"none"},".Block":{backgroundColor:"transparent",border:"none",padding:"0"}}}},children:[e.jsx(Ka,{onSuccess:ve,onError:(s,d)=>{q(s),(d?.type==="card_error"||d?.decline_code)&&(te(!0),ae(d?.decline_code||d?.code||null))},processing:We,setProcessing:ue,country:r.country||"BR",captureBillingAddress:r.captureCheckoutAddress,totalCentavos:M,formatPrice:g,ctaText:pt,exactCtaText:m,ctaColor:ut}),(r.currency||"BRL").toUpperCase()==="EUR"&&e.jsx("p",{className:"mt-3 text-[11px] leading-relaxed text-gray-500 text-center","data-testid":"text-eu-withdrawal-waiver",children:l("euWithdrawalWaiver")})]},Te):e.jsxs("div",{className:"flex items-center justify-center py-8",children:[e.jsx(U,{className:"w-6 h-6 animate-spin text-emerald-400"}),e.jsx("span",{className:"ml-2 text-sm text-gray-400",children:l("cta.preparingPayment")||"Preparando pagamento seguro..."})]}):be?null:t,e.jsxs("div",{className:"flex items-center justify-center gap-6 mt-5 opacity-40 grayscale",children:[e.jsx("img",{src:"/logo.png",alt:"SÁBHIA",className:"h-5 object-contain"}),e.jsx("svg",{className:"h-5 w-auto",viewBox:"0 0 60 25",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("text",{x:"0",y:"18",fontFamily:"Arial, sans-serif",fontSize:"11",fontWeight:"700",fill:"#a0a0a0",letterSpacing:"1",children:"STRIPE"})})]}),e.jsxs("div",{className:"flex items-center justify-center gap-4 mt-2 text-[11px] text-gray-500 font-medium",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Ue,{className:"w-3 h-3"})," SSL 256-bit"]}),e.jsx("span",{className:"text-gray-700",children:"•"}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ht,{className:"w-3 h-3"})," ",l("trust.encryptedInfo")]})]})]});return he?e.jsx("div",{id:m?"ativo-payment":void 0,className:`${be?"order-first":""} border border-white/[0.08] p-4 sm:p-6 ${m?"rounded-2xl bg-white/[0.03]":"rounded-2xl bg-[#0d0d1a] lg:rounded-3xl lg:p-7"}`,children:o}):e.jsx(Fs,{open:as,onOpenChange:s=>{(s||!We)&&ra(s)},children:e.jsxs(Xs,{className:"bg-[#101012] border-white/10 text-white w-[95%] sm:max-w-md p-0 overflow-hidden gap-0 max-h-[90dvh] flex flex-col rounded-xl",children:[e.jsxs(Vs,{className:"sr-only",children:[e.jsx(Hs,{children:l("paymentMethod")}),e.jsx(Ks,{children:l(`tiers.${me}.description`)})]}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsxs("div",{className:"p-4 md:p-6 pt-6 space-y-4",children:[e.jsxs("div",{className:"pb-4 border-b border-white/[0.06] space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3 pr-8 sm:pr-9",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-[10px] font-bold text-emerald-400 uppercase tracking-widest mb-1",children:l("orderSummary.selectedPackage")}),e.jsx("h3",{className:"text-lg font-extrabold text-white leading-tight","data-testid":"text-modal-tier-name",children:l(`tiers.${me}.name`)})]}),e.jsxs("div",{className:"text-right shrink-0",children:[Ca.originalPriceCents!==null&&e.jsx("p",{className:"text-xs text-gray-500 line-through",children:g(Ca.originalPriceCents)}),e.jsx("p",{className:"text-2xl font-extrabold text-emerald-400","data-testid":"text-modal-tier-price",children:g(M)})]})]}),e.jsx("div",{className:"grid grid-cols-1 gap-1.5",children:l(`tiers.${me}.features`,{returnObjects:!0}).map(s=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(F,{className:"w-3.5 h-3.5 text-emerald-400 shrink-0"}),e.jsx("span",{className:"text-xs text-gray-300",children:s})]},s))})]}),o]})})]})})})()]}),e.jsx("div",{className:"mt-6 lg:mt-0",children:e.jsxs("div",{className:"lg:sticky lg:top-20 space-y-3 lg:space-y-4",children:[e.jsxs("div",{className:`border border-emerald-500/20 p-4 shadow-xl shadow-black/20 sm:p-6 ${m?"rounded-2xl bg-gradient-to-b from-white/[0.04] to-white/[0.02]":"rounded-2xl bg-gradient-to-br from-[#0f1a2e] to-[#0d1525] shadow-emerald-500/5 lg:rounded-3xl"}`,children:[e.jsxs("div",{className:"flex items-center gap-2.5 mb-5",children:[e.jsx("div",{className:"w-8 h-8 bg-emerald-500/15 rounded-xl flex items-center justify-center",children:e.jsx(Xe,{className:"w-4 h-4 text-emerald-400"})}),e.jsx("span",{className:"text-xs font-black text-emerald-400 uppercase tracking-widest",children:l("trust.securePurchase")})]}),e.jsxs("div",{className:"space-y-2.5",children:[he?e.jsxs("div",{className:"flex items-start justify-between gap-3 py-1","data-testid":"order-summary-book-generation",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-[10px] font-bold uppercase tracking-widest text-emerald-400",children:"Gerar meu livro"}),e.jsx("p",{className:"mt-1 text-sm font-bold leading-snug text-white",children:"Escrever, fazer capa e publicar"}),e.jsxs("p",{className:"mt-0.5 text-xs leading-relaxed text-gray-400 break-words",children:['"',r.bookTitle,'"']})]}),m&&re?e.jsxs("span",{className:"shrink-0 whitespace-nowrap pt-2 text-right",children:[e.jsxs("span",{className:"block text-[10px] font-semibold text-gray-500 line-through decoration-red-400/80",children:["De ",g(re)]}),e.jsxs("span",{className:"block text-sm font-bold text-white",children:["Por ",g(_e)]})]}):e.jsx("span",{className:"shrink-0 whitespace-nowrap pt-4 text-sm font-bold text-white",children:g(m?_e:X?.priceInCentavos||4999)})]}):p.has("tier:book_and_cover")||p.has("tier:publish_bundle")||!p.size||me==="essencial"?e.jsxs("div",{className:"flex items-start justify-between text-sm py-1 gap-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("span",{className:"text-gray-300 font-bold block",children:[l("orderSummary.selectedPackage"),": ",mt?.title||l(`tiers.${me}.name`)]}),e.jsx("span",{className:"text-[11px] text-gray-500 leading-relaxed block mt-0.5",children:mt?.description||l(`tiers.${me}.description`)})]}),e.jsx("span",{className:"text-white font-bold whitespace-nowrap",children:g(mt?.priceCents??gt(me,r?.currency||"BRL"))})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between text-sm py-1",children:[e.jsx("span",{className:"text-gray-400 font-medium",children:l("orderSummary.mainProduct")}),e.jsx("span",{className:"text-white font-bold",children:g(m?_e:X?.priceInCentavos||4999)})]}),Array.from(p).filter(t=>!t.startsWith("tier:")&&(I||t!=="combo_publish")&&!W.some(a=>a.id===t)).map(t=>{const a=G.find(s=>
1s.type===t);if(!a)return null;const o=!I&&p.has("combo_publish");return e.jsxs("div",{className:"flex items-center justify-between text-sm py-1",children:[e.jsx("span",{className:"text-gray-400 font-medium",children:l(`bumps.${t}.shortDesc`)}),e.jsx("span",{className:o?"text-gray-600 line-through text-xs":"text-white font-bold",children:g(a.priceInCentavos)})]},t)}),!I&&p.has("combo_publish")&&!W.some(t=>t.id==="combo_publish")&&e.jsxs("div",{className:"flex items-center justify-between text-sm border-t border-yellow-500/10 pt-2.5 mt-1",children:[e.jsxs("span",{className:"text-yellow-400 font-bold flex items-center gap-1.5",children:[e.jsx(Xt,{className:"w-3 h-3"})," ",l("bumps.combo_publish.shortDesc")]}),e.jsx("span",{className:"text-yellow-400 font-bold",children:g(G.find(t=>t.type==="combo_publish")?.priceInCentavos||6298)})]})]}),W.filter(t=>p.has(t.id)&&t.id!==mt?.id).map(t=>e.jsxs("div",{className:"flex items-center justify-between text-sm py-1","data-testid":`order-summary-funnel-unified-bump-${t.id}`,children:[e.jsx("span",{className:"text-gray-400 font-medium",children:t.title}),e.jsx("span",{className:"text-white font-bold",children:g(t.priceCents)})]},t.id)),e.jsx("div",{className:"border-t border-white/[0.06] pt-4 mt-3",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-extrabold text-white text-lg",children:m?"Seu investimento":l("total")}),e.jsxs("div",{className:"text-right",children:[m&&re&&ka&&e.jsxs("span",{className:"block text-[10px] font-semibold text-gray-500 line-through decoration-red-400/80",children:["De ",g(re)]}),e.jsx("span",{"data-testid":"text-total",className:"font-extrabold text-emerald-400 text-2xl",children:je?`${je.count}× ${g(je.perInstallmentCents)}`:g(M)}),se&&e.jsx("p",{className:"text-[11px] text-gray-500 font-medium mt-0.5",children:m?`à vista ${g(M)}`:je?`total ${g(je.totalCents)}`:l("tiers.oneTimePayment")})]})]})})]})]}),e.jsxs("div",{className:"bg-[#0d0d1a] border border-white/[0.06] rounded-3xl p-5 space-y-3.5",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-7 h-7 bg-emerald-500/10 rounded-lg flex items-center justify-center flex-shrink-0",children:e.jsx(ht,{className:"w-3.5 h-3.5 text-emerald-400"})}),e.jsx("span",{className:"text-sm text-gray-300 font-medium",children:l("trust.guarantee7days")})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-7 h-7 bg-emerald-500/10 rounded-lg flex items-center justify-center flex-shrink-0",children:e.jsx(Ue,{className:"w-3.5 h-3.5 text-emerald-400"})}),e.jsx("span",{className:"text-sm text-gray-300 font-medium",children:l("trust.encryptedInfo")})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-7 h-7 bg-emerald-500/10 rounded-lg flex items-center justify-center flex-shrink-0",children:e.jsx(Fe,{className:"w-3.5 h-3.5 text-emerald-400"})}),e.jsx("span",{className:"text-sm text-gray-300 font-medium",children:l("processedByStripe")})]})]}),fs&&e.jsxs("div",{className:"bg-gradient-to-br from-[#0f0f1e] to-[#0d0d18] border border-white/[0.06] rounded-3xl p-5",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex -space-x-1",children:[...Array(5)].map((t,a)=>e.jsx(Dt,{className:"w-3.5 h-3.5 text-yellow-400 fill-yellow-400"},a))}),e.jsx("span",{className:"text-xs text-gray-500 font-medium",children:"4.9/5"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm text-gray-300 font-semibold",children:l("socialProof.booksGenerated")}),e.jsx("p",{className:"text-sm text-gray-300 font-semibold",children:l("socialProof.happyCustomers")}),e.jsx("p",{className:"text-sm text-gray-300 font-semibold",children:l("socialProof.satisfaction")})]})]}),e.jsx("div",{className:"flex justify-center mt-4 pt-3 border-t border-white/[0.04]",children:e.jsx("img",{src:"/logo.png",alt:"SÁBHIA",className:"h-7 opacity-40 hover:opacity-60 transition-opacity"})})]})]})})]})]}),m&&e.jsx("div",{className:"fixed inset-x-0 bottom-0 z-40 border-t border-emerald-500/20 bg-[#0c1117]/95 px-3 pb-[max(.55rem,env(safe-area-inset-bottom))] pt-2 shadow-[0_-8px_24px_rgba(0,0,0,0.35)] backdrop-blur lg:hidden","data-testid":"ativo-mobile-total",children:e.jsxs("div",{className:"mx-auto flex max-w-5xl items-center justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0 shrink-0",children:[e.jsx("span",{className:"block text-[9px] font-semibold uppercase tracking-wider text-gray-400",children:"Seu investimento"}),re&&ka&&e.jsxs("span",{className:"block text-[10px] font-semibold text-gray-500 line-through decoration-red-400/80",children:["De ",g(re)]})]}),e.jsx("div",{className:"min-w-0 text-right",children:e.jsx("span",{className:"block text-lg font-bold leading-tight text-emerald-400 min-[375px]:text-xl",children:g(M||_e)})}),e.jsx("button",{type:"button",onClick:()=>
1{if(b==="pix"&&pe?.qrCode){navigator.clipboard.writeText(pe.qrCode),be&&Ye("pix_code_copied");return}document.getElementById("ativo-payment")?.scrollIntoView({behavior:window.matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth",block:"start"})},className:"min-h-11 min-w-0 flex-1 rounded-xl bg-gradient-to-r from-emerald-500 to-teal-400 px-2 py-2 text-[10px] font-black uppercase leading-tight text-white shadow-[0_0_20px_rgba(16,185,129,.25)] transition hover:from-emerald-400 hover:to-teal-300 active:scale-[0.98] min-[375px]:max-w-[218px] min-[375px]:px-3 min-[375px]:text-[11px]","data-testid":"button-ativo-mobile-pagar",children:b==="pix"&&pe?.qrCode?"Copiar código PIX":Aa})]})}),r&&e.jsx(or,{storageKey:m?`ativo-editorial-${r.id}`:"checkout",enabled:!$e&&r.status==="pending",pixOffer:m&&Ne,customerName:m&&(h.userName||r.userName)||void 0,bookTitle:r.bookTitle,pixData:m&&St==="ready"?pe:null,preparing:m&&(St==="marking"||St==="ready"&&!pe&&!J),error:m?rs||(b==="pix"?J:null):null,onOfferShown:m?ms:void 0,onPreparePix:m?Rt:void 0})]})}export{Ar as default};

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.