PageSourceSearch

https://sabhia.ai/assets/chat-v3-CQXS97Jb.js

js sabhia.ai collected 2026-10-05 12:32:52 UTC 44,217 bytes, 30 lines download raw bytes

1import{j as e}from"./vendor-motion-CPxq9Xvn.js";import{r}from"./vendor-i18n-CO3kK2bH.js";import{dF as Ue,c as Ve,d as Ge,s as Qe,b1 as Je,b2 as He,dG as G,aK as Ke,a_ as Xe,ap as ye,ay as Ze,i as We,a7 as oe,C as Ye,aa as ea,ab as aa,f as je,ae as ta,af as sa,ag as oa,ah as ra}from"./index-CFAvyuXu.js";import{A as ia}from"./arrow-left-DY50GvQQ.js";import{E as na}from"./ellipsis-vertical-0l79KCRs.js";import{M as la}from"./maximize-2-BDHmjU2g.js";import"./vendor-react-CQmBMThG.js";const ca="/images/sabhia-icon.webp";let se=null;function da(){return se||(se=fetch("/api/stripe/publishable-key").then(o=>o.json()).then(o=>ra(o.publishableKey))),se}const pa={hook:2,challenge:5,money_proof:14,awareness:18,problem_reveal:28,ai_objection:32,solution_reveal:36,desire_close:40,commitment:44,lets_go:48,collect_title:56,collect_topic:56,collect_summary:62,collect_plan_whatsapp:64,generating_plan:66,show_plan:72,collect_author:76,collect_email:82,confirm_data:86,countdown:90,sending_plan:92,checkout_bumps:94,checkout_payment:96,checkout_processing:98,checkout_success:100};function R(){return new Date().toLocaleTimeString("pt-BR",{hour:"2-digit",minute:"2-digit"})}function we(o){const n=o.replace(/\D/g,"").slice(0,11);return n.length<=2?n.length?`(${n}`:"":n.length<=7?`(${n.slice(0,2)}) ${n.slice(2)}`:`(${n.slice(0,2)}) ${n.slice(2,7)}-${n.slice(7)}`}function ma(){return e.jsx("div",{className:"flex px-[18px] sm:px-[63px] mb-[3px]","data-testid":"typing-indicator","data-msg-row":!0,style:{animation:"waFadeIn .2s ease"},children:e.jsxs("div",{className:"relative bg-white rounded-[7.5px] rounded-bl-[3px] px-[9px] py-[6px] shadow-[0_1px_0.5px_rgba(11,20,26,0.13)]",style:{minWidth:52},children:[e.jsx("div",{className:"wa-tail-l"}),e.jsxs("div",{className:"flex gap-[5px] items-center",style:{height:17},children:[e.jsx("span",{className:"wa-dot",style:{animationDelay:"0ms"}}),e.jsx("span",{className:"wa-dot",style:{animationDelay:"200ms"}}),e.jsx("span",{className:"wa-dot",style:{animationDelay:"400ms"}})]})]})})}function ua({images:o,currentIndex:n,onClose:h,onNav:u}){return r.useEffect(()=>{const g=c=>{c.key==="ArrowRight"?u(1):c.key==="ArrowLeft"?u(-1):c.key==="Escape"&&h()};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[u,h]),e.jsxs("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/90",onClick:h,"data-testid":"image-lightbox",children:[e.jsx("button",{className:"absolute top-4 right-4 text-white text-3xl font-light w-10 h-10 flex items-center justify-center z-10",onClick:h,"data-testid":"lightbox-close",children:"×"}),e.jsxs("div",{className:"absolute top-4 left-1/2 -translate-x-1/2 text-white/70 text-sm z-10",children:[n+1," / ",o.length]}),o.length>1&&e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"absolute left-3 top-1/2 -translate-y-1/2 w-11 h-11 rounded-full bg-black/50 flex items-center justify-center text-white text-2xl z-10 hover:bg-black/70 transition-colors",onClick:g=>{g.stopPropagation(),u(-1)},"data-testid":"lightbox-prev",children:"‹"}),e.jsx("button",{className:"absolute right-3 top-1/2 -translate-y-1/2 w-11 h-11 rounded-full bg-black/50 flex items-center justify-center text-white text-2xl z-10 hover:bg-black/70 transition-colors",onClick:g=>{g.stopPropagation(),u(1)},"data-testid":"lightbox-next",children:"›"})]}),e.jsx("img",{src:o[n],className:"max-w-[92vw] max-h-[85vh] object-contain rounded-lg",onClick:g=>g.stopPropagation(),alt:`Bestseller ${n+1}`})]})}function xa({pages:o,currentIndex:n,onClose:h,onNav:u}){const g=r.useRef(0),c=r.useRef(null);return r.useEffect(()=>{const d=x=>{x.key==="ArrowRight"?u(1):x.key==="ArrowLeft"?u(-1):x.key==="Escape"&&h()};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[u,h]),r.useEffect(()=>{if(c.current){const d=c.current.children[n];d&&d.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})}},[n]),e.jsxs("div",{className:"fixed inset-0 z-[9999] flex flex-col",style:{background:"rgba(0,0,0,0.95)"},"data-testid":"document-viewer",children:[e.jsxs("div",{className:"shrink-0 flex items-center justify-between px-4 py-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-white text-[14px] font-medium truncate",children:"Planejamento Editorial"}),e.jsxs("p",{className:"text-white/60 text-[12px]",children:["Pagina ",n+1," de ",o.length]})]}),e.jsx("button",{onClick:h,className:"w-[44px] h-[44px] flex items-center justify-center text-white text-3xl font-light","data-testid":"doc-viewer-close",children:"×"})]}),e.jsxs("div",{className:"flex-1 flex items-center justify-center relative overflow-hidden cursor-pointer",onTouchStart:d=>{g.current=d.touches[0].clientX},onTouchEnd:d=>{const x=g.current-d.changedTouches[0].clientX;Math.abs(x)>50&&u(x>0?1:-1)},onClick:h,children:[n>0&&e.jsx("button",{className:"absolute left-2 top-1/2 -translate-y-1/2 w-[48px] h-[48px] rounded-full flex items-center justify-center text-white text-3xl z-10 transition-colors",style:{background:"rgba(255,255,255,0.15)"},onClick:d=>{d.stopPropagation(),u(-1)},"data-testid":"doc-viewer-prev",children:"‹"}),n<o.length-1&&e.jsx("button",{className:"absolute right-2 top-1/2 -translate-y-1/2 w-[48px] h-[48px] rounded-full flex items-center justify-center text-white text-3xl z-10 transition-colors",style:{background:"rgba(255,255,255,0.15)"},onClick:d=>{d.stopPropagation(),u(1)},"data-testid":"doc-viewer-next",children:"›"}),e.jsx("img",{src:o[n],className:"max-w-[92vw] max-h-[85vh] object-contain transition-opacity duration-200",alt:`Pagina ${n+1}`,draggable:!1,onClick:d=>d.stopPropagation()})]}),e.jsx("div",{className:"shrink-0 py-2 px-2",children:e.jsx("div",{ref:c,className:"flex gap-[6px] overflow-x-auto justify-center",style:{scrollbarWidth:"thin"},children:o.map((d,x)=>e.jsx("div",{className:"flex-shrink-0 cursor-pointer rounded-[3px] overflow-hidden transition-all",style:{width:36,height:50,border:x===n?"2px solid #25D366":"2px solid transparent",opacity:x===n?1:.5},onClick:()=>u(x-n),"data-testid":`doc-thumb-${x}`,children:e.jsx("img",{src:d,className:"w-full h-full object-cover",alt:`Miniatura ${x+1}`})},x))})})]})}function ha({msg:o,showTail:n,onImageClick:h,onDocClick:u}){const g=o.sender==="sabhia";if(o.isImageGroup&&o.images){const c=o.images,d=o.imageLayout==="pages",x=Math.min(c.length,6),b=c.length-x;return e.jsx("div",{className:"flex px-[18px] sm:px-[63px] mb-[3px]","data-msg-row":!0,style:{animation:"waFadeIn .2s ease"},children:e.jsxs("div",{className:"relative max-w-[280px] sm:max-w-[320px]","data-msg-images":!0,children:[n&&e.jsx("div",{className:"wa-tail-l"}),e.jsxs("div",{className:`bg-white shadow-[0_1px_0.5px_rgba(11,20,26,0.13)] ${n?"rounded-[7.5px] rounded-bl-[3px]":"rounded-[7.5px]"} overflow-hidden p-[3px]`,"data-testid":`message-images-${o.id}`,children:[d?e.jsx("div",{className:"flex gap-[3px] overflow-x-auto pb-1",style:{scrollbarWidth:"thin"},children:c.map((I,v)=>e.jsx("div",{className:"relative cursor-pointer overflow-hidden rounded-[4px] flex-shrink-0 shadow-sm border border-gray-100",style:{width:"90px",height:"120px"},onClick:()=>u?.(c,v),children:e.jsx("img",{src:I,className:"w-full h-full object-cover",alt:`Pagina ${v+1}`})},v))}):e.jsx("div",{className:"grid grid-cols-3 gap-[2px]",children:c.slice(0,x).map((I,v)=>e.jsxs("div",{className:"relative cursor-pointer overflow-hidden rounded-[3px]",style:{aspectRatio:"1/1"},onClick:()=>h?.(c,v),children:[e.jsx("img",{src:I,className:"w-full h-full object-cover",alt:`Bestseller ${v+1}`}),v===x-1&&b>0&&e.jsx("div",{className:"absolute inset-0 bg-black/50 flex items-center justify-center",children:e.jsxs("span",{className:"text-white text-2xl font-semibold",children:["+",b]})})]},v))}),e.jsxs("div",{className:`flex ${d?"justify-between":"justify-end"} px-[6px] py-[2px]`,children:[d&&e.jsx("span",{className:"text-[10px] font-medium",style:{color:"#25D366"},children:"Toque para ver"}),e.jsx("span",{className:"text-[11px]",style:{color:"#667781"},children:o.time})]})]})]})})}return o.isCard&&o.cardData?e.jsx("div",{className:"flex px-[18px] sm:px-[63px] mb-[3px]","data-msg-row":!0,style:{animation:"waFadeIn .2s ease"},children:e.jsxs("div",{className:"relative max-w-[85%] sm:max-w-[65%]","data-msg-bubble":!0,children:[n&&e.jsx("div",{className:"wa-tail-l"}),e.jsxs("div",{className:`bg-white shadow-[0_1px_0.5px_rgba(11,20,26,0.13)] ${n?"rounded-[7.5px] rounded-bl-[3px]":"rounded-[7.5px]"} overflow-hidden`,"data-testid":`message-card-${o.id}`,children:[e.jsx("div",{className:"h-[3px]",style:{background:"#25D366"}}),e.jsxs("div",{className:"px-[9px] py-[5px]",children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-[6px]",children:[e.jsx(je,{className:"w-[13px] h-[13px]",style:{color:"#25D366"}}),e.jsx("span",{className:"text-[11.5px] font-semibold",style:{color:"#25D366"},children:"Resumo do seu livro"})]}
1),o.cardData.title&&e.jsxs("div",{className:"mb-[5px]",children:[e.jsx("p",{className:"text-[10.5px]",style:{color:"#667781"},children:"Titulo"}),e.jsx("p",{className:"text-[14.2px] font-semibold",style:{color:"#111B21"},children:o.cardData.title})]}),o.cardData.subtitle&&e.jsxs("div",{className:"mb-[5px]",children:[e.jsx("p",{className:"text-[10.5px]",style:{color:"#667781"},children:"Subtitulo"}),e.jsx("p",{className:"text-[13.5px]",style:{color:"#3B4A54"},children:o.cardData.subtitle})]}),o.cardData.summary&&e.jsxs("div",{className:"mb-[5px]",children:[e.jsx("p",{className:"text-[10.5px]",style:{color:"#667781"},children:"Sobre"}),e.jsx("p",{className:"text-[13.5px] leading-[1.35]",style:{color:"#3B4A54"},children:o.cardData.summary})]}),o.cardData.language&&e.jsxs("div",{className:"mb-[5px]",children:[e.jsx("p",{className:"text-[10.5px]",style:{color:"#667781"},children:"Idioma"}),e.jsx("p",{className:"text-[13.5px]",style:{color:"#3B4A54"},children:o.cardData.language})]}),o.cardData.author&&e.jsxs("div",{className:"mb-[3px]",children:[e.jsx("p",{className:"text-[10.5px]",style:{color:"#667781"},children:"Autor(a)"}),e.jsx("p",{className:"text-[13.5px]",style:{color:"#3B4A54"},children:o.cardData.author})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx("span",{className:"text-[11px]",style:{color:"#667781"},children:o.time})})]})]})]})}):g?e.jsx("div",{className:"flex px-[18px] sm:px-[63px] mb-[3px]","data-msg-row":!0,style:{animation:"waFadeIn .2s ease"},children:e.jsxs("div",{className:`relative bg-white shadow-[0_1px_0.5px_rgba(11,20,26,0.13)] ${n?"rounded-[7.5px] rounded-bl-[3px]":"rounded-[7.5px]"} px-[9px] py-[6px] max-w-[85%] sm:max-w-[65%]`,"data-testid":`message-${o.id}`,"data-msg-bubble":!0,children:[n&&e.jsx("div",{className:"wa-tail-l"}),e.jsx("span",{className:`text-[14.2px] leading-[19px] whitespace-pre-line ${o.isBold?"font-bold":""}`,style:{color:"#111B21"},children:o.text}),e.jsx("span",{className:"float-right mt-[3px] ml-[8px] text-[11px] leading-none whitespace-nowrap",style:{color:"#667781"},children:o.time})]})}):e.jsx("div",{className:"flex justify-end px-[18px] sm:px-[63px] mb-[3px]","data-msg-row":!0,style:{animation:"waFadeIn .2s ease"},children:e.jsxs("div",{className:`relative shadow-[0_1px_0.5px_rgba(11,20,26,0.13)] ${n?"rounded-[7.5px] rounded-br-[3px]":"rounded-[7.5px]"} px-[9px] py-[6px] max-w-[85%] sm:max-w-[65%]`,style:{background:"#D9FDD3"},"data-testid":`message-${o.id}`,"data-msg-bubble":!0,children:[n&&e.jsx("div",{className:"wa-tail-r"}),e.jsx("span",{className:"text-[14.2px] leading-[19px]",style:{color:"#111B21"},children:o.text}),e.jsxs("span",{className:"float-right mt-[3px] ml-[8px] text-[11px] leading-none whitespace-nowrap",style:{color:"#667781"},children:[o.time,e.jsxs("svg",{className:"inline ml-[3px] -mt-[1px]",width:"18",height:"11",viewBox:"0 0 18 11",children:[e.jsx("path",{d:"M3.5 6.5L0.5 3.5l-1 1 4 4 8.5-8.5-1-1z",fill:"#53BDEB"}),e.jsx("path",{d:"M9.5 6.5L6.5 3.5l-1 1 4 4 8.5-8.5-1-1z",fill:"#53BDEB"})]})]})]})})}function ga({phase:o}){const n=[{icon:"🧠",text:"Analisando o tema..."},{icon:"📝",text:"Criando estrutura..."},{icon:"✨",text:"Finalizando planejamento..."}];return e.jsx("div",{className:"flex px-[18px] sm:px-[63px] mb-[3px]","data-msg-row":!0,style:{animation:"waFadeIn .2s ease"},children:e.jsxs("div",{className:"relative bg-white shadow-[0_1px_0.5px_rgba(11,20,26,0.13)] rounded-[7.5px] rounded-bl-[3px] px-[9px] py-[6px] min-w-[200px]","data-testid":"generating-progress",children:[e.jsx("div",{className:"wa-tail-l"}),e.jsx("div",{className:"space-y-2",children:n.map((h,u)=>e.jsxs("div",{className:`flex items-center gap-2.5 transition-opacity duration-500 ${u<=o?"opacity-100":"opacity-30"}`,children:[u<o?e.jsx("div",{className:"w-[18px] h-[18px] rounded-full flex items-center justify-center",style:{background:"#25D366",animation:"waScaleIn .3s ease"},children:e.jsx(ye,{className:"w-[11px] h-[11px] text-white"})}):u===o?e.jsx("div",{className:"w-[18px] h-[18px] rounded-full border-2 border-t-transparent animate-spin",style:{borderColor:"#25D366",borderTopColor:"transparent"}}):e.jsx("div",{className:"w-[18px] h-[18px] rounded-full",style:{border:"1px solid #CCD0D5"}}),e.jsxs("span",{className:"text-[13px]",style:{color:"#3B4A54"},children:[h.icon," ",h.text]})]},u))}),e.jsx("div",{className:"flex justify-end mt-1",children:e.jsx("span",{className:"text-[11px]",style:{color:"#667781"},children:R()})})]})})}function ba({number:o}){return e.jsx("div",{className:"flex px-[18px] sm:px-[63px] mb-[3px]","data-msg-row":!0,style:{animation:"waFadeIn .2s ease"},children:e.jsxs("div",{className:"relative bg-white shadow-[0_1px_0.5px_rgba(11,20,26,0.13)] rounded-[7.5px] rounded-bl-[3px] px-[12px] py-[8px]","data-testid":`countdown-${o}
1`,children:[e.jsx("div",{className:"wa-tail-l"}),e.jsx("span",{className:"text-[28px] font-black",style:{color:"#10B981",animation:"waScaleIn .3s ease",display:"inline-block"},children:o}),e.jsx("span",{className:"float-right mt-[12px] ml-[8px] text-[11px] leading-none whitespace-nowrap",style:{color:"#667781"},children:R()})]})})}const fa={cover_ebook:{name:"Capa Personalizada Premium",shortDesc:"Capa profissional exclusiva da SÁBHIA",emoji:"🎨"},publication_prep:{name:"Publicacao na Amazon",shortDesc:"Metadados, SEO e descricao para Amazon KDP",emoji:"🌎"},marketing_kit:{name:"Kit Divulgacao (6 pecas)",shortDesc:"6 pecas de conteudo para redes sociais",emoji:"📢"},combo_publish:{name:'COMBO "Publique Ja" - 30% OFF',shortDesc:"Capa + Amazon + Kit com 30% OFF",emoji:"🔥"}};function wa({onSuccess:o,onError:n}){const h=ta(),u=sa(),[g,c]=r.useState(!1),d=async()=>{if(!h||!u)return;c(!0);const{error:x}=await h.confirmPayment({elements:u,confirmParams:{return_url:window.location.href},redirect:"if_required"});x?(c(!1),n(x.message||"Erro ao processar pagamento.")):o()};return e.jsxs("div",{className:"space-y-3",children:[e.jsx(oa,{options:{layout:"tabs",defaultValues:{billingDetails:{address:{country:"BR"}}}}}),e.jsx("button",{"data-testid":"button-chat-pay-card",onClick:d,disabled:g||!h,className:"w-full py-3 rounded-xl font-bold text-white text-[15px] transition-all flex items-center justify-center gap-2",style:{background:g?"#6B7280":"#10B981"},children:g?e.jsxs(e.Fragment,{children:[e.jsx(oe,{className:"w-5 h-5 animate-spin"})," Processando..."]}):e.jsx(e.Fragment,{children:"Pagar agora"})})]})}function Da({mode:o="page",onClose:n,onExpand:h,variant:u="C"}){const g=r.useRef(null);if(!g.current&&o==="page")try{const a=sessionStorage.getItem("sabhia_chat_state_v3");a&&(g.current=JSON.parse(a),sessionStorage.removeItem("sabhia_chat_state_v3"))}catch{}const c=g.current,[d,x]=r.useState(c?.messages||[]),[b,I]=r.useState(c?.currentStep||"hook"),[v,re]=r.useState(!1),[O,ve]=r.useState(c?.sessionId||null),F=r.useRef(O),ke=a=>{F.current=a,ve(a)},[B,M]=r.useState(""),[$,y]=r.useState(c?.choices||[]),[k,j]=r.useState(c?.inputConfig||null),[Q,Ne]=r.useState(c?.bookData||{}),m=r.useRef(Q),S=a=>{Ne(t=>{const s=typeof a=="function"?a(t):a;return m.current=s,s})},[_e,T]=r.useState(-1),[ie,E]=r.useState(!1),[X,Ce]=r.useState(c?.planData||null),J=Ue(),[N,ya]=r.useState(c?.checkoutData||null),[q,ja]=r.useState(c?.availableBumps||[]),[_,Se]=r.useState(new Set(c?.selectedBumps||[])),[A,ne]=r.useState(c?.checkoutPaymentMethod||null),[le,ce]=r.useState(null),[D,Ee]=r.useState(null),[De,de]=r.useState(!1),P=r.useRef(null),[pe,me]=r.useState(!1),[ue,Pe]=r.useState([]),[Z,W]=r.useState(null),[Y,ee]=r.useState(null),xe=r.useRef(null),H=r.useRef(null),z=r.useRef(c?.msgIdCounter||0),he=r.useRef(!!c),w=r.useCallback(()=>{setTimeout(()=>{xe.current?.scrollIntoView({behavior:"smooth"})},100)},[]),i=r.useCallback(async(a,t)=>{y([]),j(null);for(let s=0;s<a.length;s++){re(!0),w();const p=a[s],f=typeof p=="object",K=f?p.text:p,qe=f?p.bold:!1,ze=K.length<30?350+Math.random()*250:500+Math.random()*400;await new Promise(V=>setTimeout(V,ze)),re(!1);const Le=`msg-${++z.current}`;x(V=>[...V,{id:Le,sender:"sabhia",text:K,time:R(),isBold:qe}]),w(),s<a.length-1&&await new Promise(V=>setTimeout(V,150+Math.random()*150))}t?.()},[w]),ge=r.useCallback(a=>{const t=`msg-${++z.current}`;x(s=>[...s,{id:t,sender:"sabhia",text:"",isCard:!0,cardData:a,time:R()}]),w()},[w]),ae=r.useCallback((a,t)=>{const s=`msg-${++z.current}`;x(p=>[...p,{id:s,sender:"sabhia",text:"",isImageGroup:!0,images:a,imageLayout:t||"grid",time:R()}]),w()},[w]),C=r.useCallback(a=>{const t=`msg-${++z.current}`;x(s=>[...s,{id:t,sender:"user",text:a,time:R()}]),w()},[w]),L=a=>new Promise(t=>setTimeout(t,a));r.useEffect(()=>{if(he.current)return;he.current=!0,Ve(),Ge().catch(()=>{}),Qe();const a=new URLSearchParams(window.location.search),t={utmSource:a.get("utm_source")||void 0,utmMedium:a.get("utm_medium")||void 0,utmCampaign:a.get("utm_campaign")||void 0,utmContent:a.get("utm_content")||void 0,utmTerm:a.get("utm_term")||void 0},s=navigator.language||"pt-BR";fetch("/api/chat/session",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...t,variant:u,locale:s})}).then(p=>p.json()).then(p=>{const f=p.sessionId||p.session?.id;f&&ke(f)}).catch(()=>{}),l("hook")},[]);const U=r.useCallback(async(a,t)=>{if(F.current)try{await fetch("/api/chat/step",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:F.current,input:a,action:t})})}catch{}},[]),l=r.useCallback(async a=>{switch(I(a),a){case"hook":await i(["Ola, sou a Sabhia!","Vou ser bem direta: eu consigo escrever seu livro inteiro para voce em menos de 1 hora.","Sem voce precisar digitar uma unica linha de conteudo.","Podemos comecar o desafio?"],()=>y(["PODE!","PODE COM CERTEZA!"]));break;case"challenge":await i(["Maravilha, qual seu nome?"],()=>{j({type:"text",placeholder:"Preencha seu nome..."})});break;case"money_proof":await i([`Muito prazer, ${m.current.userName}!`,"Olha o que esta acontecendo no mercado de ebooks...",{text:"Pessoas comuns estao ganhando MUITO DINHEIRO publicando livros digitais na Amazon.",bold:!0}],()=>{ae(["/images/proof-bestseller-1.webp","/images/proof-bestseller-2.webp","/images/proof-bestseller-3.webp","/images/proof-bestseller-4.webp","/images/proof-bestseller-5.webp","/images/proof-bestseller-6.webp"]),setTimeout(async()=>{await i(["No meu primeiro ano, eu escrevi MAIS DE 100 MIL LIVROS para pessoas como voce.","Pastores, professores, empreendedores, aposentados... pessoas comuns que tinham um sonho."],()=>y(["NUNCA NEM IMAGINEI!","JA SABIA SIM!"]))},600)});break;case"awareness":await i(["Perfeito, entao pense um pouco...","Qual e a maior dificuldade de ganhar dinheiro publicando ebooks?","(na Amazon, Google Play Books, Apple Books, etc)"]),await L(4e3),await i(["Conseguiu chegar em alguma resposta?"],()=>y(["ACHO QUE SIM","SIM, EU SEI","NAO FACO IDEIA"]));break;case"problem_reveal":await i([{text:"Com certeza a maior dificuldade e ESCREVER OS EBOOKS!",bold:!0},"Voce precisa gastar semanas, meses ou ate ANOS em alguns casos, para escrever um livro e colocar para vender.","E mesmo com tecnologia avançada, as plataformas conseguem identificar se seu ebook foi escrito de forma automática ou por um humano.","E se pegarem que foi escrito de forma automática podem ate bloquear sua conta..."],()=>y(["E AGORA?"]));break;case"ai_objection":await i(["Mas isso NAO precisa te desanimar!",{text:"Porque eu fui criada para escrever 100% COM LINGUAGEM HUMANA.",bold:!0},"E voce pode publicar DEZENAS de livros por semana, se quiser...","Quer saber como funciona?"],()=>y(["QUERO SIM!"]));break;case"solution_reveal":await i(["Bom demais!","Vou te mostrar um exemplo real. Deslize para ver as paginas de um planejamento editorial que eu crio gratuitamente para voce:"],()=>{const t=Array.from({length:10},(s,p)=>`/images/plan-pages/p${p+1}.webp`);ae(t,"pages"),setTimeout(async()=>{await i([J?`Esse planejamento, numa editora tradicional, custa entre ${G(2e3)} e ${G(5e3)}.`:"Esse planejamento, numa editora tradicional, custa entre R$2.000 e R$5.000.",{text:"Aqui? E DE GRACA.",bold:!0}],()=>y(["QUERO MEU LIVRO!"]))},800)});break;
1case"desire_close":await i(["Maravilha! Entao vamos comecar!"]),l("commitment");break;case"commitment":await i(["Vou escrever UM LIVRO COMPLETO PARA VOCE, DO ZERO, com 100% dos direitos autorais seus, em menos de 1 hora!","Com aproximadamente 100 a 130 paginas.","Escrito palavra por palavra, seguindo exatamente tudo que voce quiser.",J?`E tudo isso por apenas ${G(49.99)}.`:"E tudo isso por apenas R$49,99.",J?`Editoras cobram de ${G(2e3)} a ${G(5e3)} para fazer o mesmo.`:"Editoras cobram de R$2.000 a R$5.000 para fazer o mesmo.","Vamos comecar?"],()=>y(["VAMOS, QUERO FAZER!"]));break;case"lets_go":await i([`Muito bom, ${m.current.userName}!`,"Voce ja tem a ideia do livro que quer gerar? Como titulo, subtitulo e o conteudo..."],()=>y(["JA TENHO A IDEIA COMPLETA!","QUERO AJUDA PARA PLANEJAR"]));break;case"collect_title":await i(["Certo! Qual o titulo do livro? (Em poucas palavras)","(Ex: O Clube das 5 da Manha)"],()=>{j({type:"text",placeholder:"Preencha aqui..."})});break;case"collect_summary":await i(["Um breve resumo do que voce quer que tenha no conteudo do livro. Seja rico(a) em detalhes. Quanto mais informacoes, melhor sera seu livro!"],()=>{j({type:"textarea",placeholder:"Descreva os temas, assuntos ou historia do seu livro..."})});break;case"collect_author":await i(["Nome do autor(a):"],()=>{j({type:"text",placeholder:"Seu nome real ou pseudonimo"})});break;case"collect_topic":await i(["Tudo bem, me diga so sobre o que voce gostaria de ter um livro 100% seu...","Pode ser qualquer coisa, qualquer assunto, qualquer tema..."],()=>{j({type:"textarea",placeholder:"Ex: Quero um livro sobre como viver melhor depois dos 60 anos"})});break;case"collect_plan_whatsapp":await i(["Antes de eu gerar seu planejamento, me diga qual o seu WhatsApp?","E por la que vou te enviar o seu planejamento."],()=>{j({type:"tel",placeholder:"(00) 00000-0000"})});break;case"generating_plan":await i(["Que tema incrivel! Deixa eu pensar aqui..."],()=>{E(!0),T(0)}),setTimeout(()=>T(1),3e3),setTimeout(()=>T(2),6e3);{let t=!1;try{const s=await fetch("/api/chat/generate-plan",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:F.current,topic:m.current.topic,phone:m.current.phone})});if(s.ok){const p=await s.json();if(p.title||p.plan){const f=p.plan||p;Ce(f),m.current={...m.current,title:f.title,subtitle:f.subtitle,summary:f.summary,language:"Portugues"},S(K=>({...K,title:f.title,subtitle:f.subtitle,summary:f.summary,language:"Portugues"})),t=!0}}}catch{}await L(8e3),E(!1),T(-1),t?l("show_plan"):await i(["Ops, tive um probleminha tecnico. Mas nao se preocupe!","Me conta de novo sobre qual assunto voce gostaria de escrever?"],()=>{j({type:"textarea",placeholder:"Ex: Quero um livro sobre como viver melhor depois dos 60 anos"}),I("collect_topic")})}break;case"show_plan":{const t=m.current;ge({title:t.title,subtitle:t.subtitle,summary:t.summary,language:t.language,author:t.author}),await L(400),await i([`Entao o titulo ficou "${t.title||""}"`,"Tudo certo? Posso avancar e escrever seu livro?"],()=>y(["PODE SIM!","QUERO COMECAR DO ZERO"]))}break;case"collect_email":await i(["Em que email voce deseja receber o planejamento do livro?"],()=>{j({type:"email",placeholder:"[email protected]"})});break;case"confirm_data":{const t=m.current;await i(["Perfeito! Esses sao seus dados:",`Email: ${t.email}
2Autor: ${t.author||t.userName}`,"Esta tudo correto?"],()=>y(["TUDO CERTO, VAMOS SEGUIR!","PRECISO CORRIGIR MEU EMAIL"]))}break;case"countdown":await i(["Perfeito! Assim que finalizar, voce podera analisar se esta de acordo com o que deseja.","Estou te direcionando para finalizar em:"]),me(!0);for(let t=5;t>=1;t--)await L(800),Pe(s=>[...s,t]),w();await L(600),me(!1),l("sending_plan");break;case"sending_plan":await i(["Preparando tudo para voce..."],()=>{E(!0),T(0)});try{const t=await fetch("/api/chat/confirm-contact",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:F.current,email:m.current.email,userName:m.current.userName,phone:m.current.phone})});if(t.ok){const s=await t.json();try{Je(m.current.email),He(m.current.email)}catch{}if(s.checkoutSessionId&&s.checkoutToken)setTimeout(()=>{E(!1),window.location.href=`/checkout/${s.checkoutSessionId}?token=${s.checkoutToken}`},2500);
2else if(s.checkoutUrl){const p=new URL(s.checkoutUrl);setTimeout(()=>{E(!1),window.location.href=p.pathname+p.search},2500)}else setTimeout(()=>{E(!1),window.location.href="/"},2500)}else E(!1),await i(["Ops, algo deu errado. Tente novamente em alguns instantes."])}catch{E(!1),await i(["Ops, algo deu errado. Tente novamente em alguns instantes."])}break;case"checkout_bumps":q.length>0?await i(["Seu livro ja esta sendo preparado!","Antes de pagar, veja o que mais posso fazer por voce:"]):(await i(["Seu livro ja esta sendo preparado!"]),l("checkout_payment"));break;case"checkout_payment":await i(["Como voce prefere pagar?"]);break;case"checkout_processing":await i(["Aguardando a confirmacao do seu pagamento..."]);break;case"checkout_success":await i(["Pagamento confirmado!",`Que perfeito, ${m.current.userName}! Estou feliz por voce!`,"Seu livro esta sendo gerado agora mesmo! Em breve voce podera acessa-lo na plataforma."]);break}},[i,ge,ae,w,O,Q,X,J]),Ie=r.useCallback(async a=>{switch(C(a),y([]),U(a,b),b){case"hook":l("challenge");break;case"money_proof":l("awareness");break;case"awareness":l("problem_reveal");break;case"problem_reveal":l("ai_objection");break;case"ai_objection":l("solution_reveal");break;case"solution_reveal":l("desire_close");break;case"commitment":l("lets_go");break;case"lets_go":a.includes("IDEIA")||a.includes("ideia")?l("collect_title"):l("collect_topic");break;case"show_plan":a.includes("ZERO")||a.includes("zero")?l("collect_topic"):l("collect_author");break;case"confirm_data":a.includes("CORRIGIR")||a.includes("corrigir")?l("collect_email"):l("countdown");break}},[b,C,l,U]),te=r.useCallback(async a=>{const t=(a??B).trim();if(t){if(b==="collect_plan_whatsapp"){const s=t.replace(/\D/g,"");if(s.length<10||s.length>15){M(t),await i(["Hmm, esse numero de WhatsApp nao parece valido.","Por favor, digite um numero com DDD (entre 10 e 15 digitos)."],()=>{j({type:"tel",placeholder:"(00) 00000-0000"})});return}C(we(s)),M(""),j(null),U(s,b),m.current={...m.current,phone:s},S(p=>({...p,phone:s})),l("generating_plan");return}switch(C(t),M(""),j(null),U(t,b),b){case"challenge":m.current={...m.current,userName:t},S(s=>({...s,userName:t})),l("money_proof");break;case"collect_title":m.current={...m.current,title:t},S(s=>({...s,title:t})),await i([`"${t}" — que titulo poderoso!`]),l("collect_summary");break;case"collect_summary":m.current={...m.current,summary:t,language:"Portugues"},S(s=>({...s,summary:t,language:"Portugues"})),await i(["Maravilha! Esse livro vai ser incrivel!"]),l("collect_author");break;case"collect_author":m.current={...m.current,author:t},S(s=>({...s,author:t})),l("collect_email");break;case"collect_topic":m.current={...m.current,topic:t},S(s=>({...s,topic:t})),l("collect_plan_whatsapp");break;case"collect_email":m.current={...m.current,email:t},S(s=>({...s,email:t})),l("confirm_data");break}}},[B,b,C,l,U,i]),Ae=r.useCallback(a=>{Se(t=>{const s=new Set(t);return a==="combo_publish"?s.has("combo_publish")?s.delete("combo_publish"):(s.clear(),s.add("combo_publish")):(s.delete("combo_publish"),s.has(a)?s.delete(a):s.add(a)),s})},[]),Re=r.useCallback(()=>{C(_.size>0?`Selecionei ${_.size} produto(s) adicional(is)`:"Sem produtos adicionais"),l("checkout_payment")},[_,C,l]),be=r.useCallback(async a=>{if(N){ne(a),C(a==="pix"?"Quero pagar com PIX":"Quero pagar com Cartao");try{const t=await fetch(`/api/checkout/${N.checkoutSessionId}/pay`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:N.checkoutToken,selectedBumps:Array.from(_),paymentMethod:a})});if(t.ok){const s=await t.json();ce(s.clientSecret),l("checkout_processing"),a==="pix"&&(P.current=setInterval(async()=>{try{const p=await fetch(`/api/checkout/${N.checkoutSessionId}/status?token=${N.checkoutToken}`);if(p.ok){const f=await p.json();if(f.status==="paid"){P.current&&clearInterval(P.current),l("checkout_success");return}f.pixData&&Ee(f.pixData)}}catch{}},3e3))}else await i(["Ops, houve um erro ao processar. Tente novamente."]),l("checkout_payment")}catch{await i(["Ops, houve um erro de conexao. Tente novamente."]),l("checkout_payment")}}},[N,_,C,l,i]),Oe=r.useCallback(()=>{P.current&&clearInterval(P.current),l("checkout_success")},[l]),Fe=r.useCallback(async a=>{await i([`Erro no pagamento: ${a}`,"Tente novamente ou escolha outro metodo."]),ce(null),ne(null),l("checkout_payment")},[i,l]),Be=r.useCallback(()=>{D?.qrCode&&(navigator.clipboard.writeText(D.qrCode),de(!0),setTimeout(()=>de(!1),3e3))},[D]);r.useEffect(()=>()=>{P.current&&clearInterval(P.current)},[]),r.useEffect(()=>{w()},[d,v,ie,$,pe,ue,w]),r.useEffect(()=>{k&&H.current&&setTimeout(()=>H.current?.focus(),300)},[k]);const fe=r.useCallback(()=>{try{sessionStorage.setItem("sabhia_chat_state_v3",JSON.stringify({messages:d,currentStep:b,sessionId:O,choices:$,inputConfig:k,bookData:Q,planData:X,msgIdCounter:z.current,checkoutData:N,availableBumps:q,selectedBumps:Array.from(_),checkoutPaymentMethod:A}))}catch{}},[d,b,O,$,k,Q,X,N,q,_,A]);r.useEffect(()=>{b!=="hook"&&O&&fe()},[b,d.length,_,A]);const Me=pa[b]||0,$e=a=>a===0?!0:d[a].sender!==d[a-1].sender,Te=!!k;return e.jsxs("div",{className:`${o==="widget"?"h-full min-h-0":"h-[100dvh]"} flex flex-col overflow-hidden`,style:{background:"#ECE5DD"},"data-testid":"chat-page-v3","data-chat-mode":o,children:[Z&&e.jsx(ua,{images:Z.images,currentIndex:Z.index,onClose:()=>W(null),onNav:a=>W(t=>t?{...t,index:(t.index+a+t.images.length)%t.images.length}:null)}),Y&&e.jsx(xa,{pages:Y.pages,currentIndex:Y.index,onClose:()=>ee(null),onNav:a=>ee(t=>t?{...t,index:Math.max(0,Math.min(t.pages.length-1,t.index+a))}:null)}),e.jsx("style",{children:`
3        @keyframes waFadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
4        @keyframes waScaleIn { from { opacity: 0; transform: scale(0.5); } to { opacity: 1; transform: scale(1); } }
5        @keyframes waDotPulse { 0%, 60%, 100% { opacity: 0.3; transform: scale(0.85); } 30% { opacity: 1; transform: scale(1.1); } }
6        @keyframes shimmerBtn { 0% { background-position: 200% center; } 100% { background-position: -200% center; } }
7        @keyframes pulseGlow { 0%, 100% { box-shadow: 0 0 15px -3px rgba(16,185,129,0.3), 0 4px 12px -2px rgba(0,0,0,0.15); }
7 50% { box-shadow: 0 0 25px -3px rgba(16,185,129,0.5), 0 6px 16px -2px rgba(0,0,0,0.2); } }
8        .wa-dot { width: 7px; height: 7px; border-radius: 50%; background: #9CA3AF; animation: waDotPulse 1.4s ease-in-out infinite; display: inline-block; }
9        .wa-tail-l { position: absolute; bottom: 0; left: -8px; width: 8px; height: 13px; }
10        .wa-tail-l::before { content: ''; position: absolute; bottom: 0; left: 0; width: 0; height: 0; border-bottom: 0px solid transparent; border-top: 13px solid transparent; border-right: 8px solid #FFFFFF; }
11        .wa-tail-r { position: absolute; bottom: 0; right: -8px; width: 8px; height: 13px; }
12        .wa-tail-r::before { content: ''; position: absolute; bottom: 0; right: 0; width: 0; height: 0; border-bottom: 0px solid transparent; border-top: 13px solid transparent; border-left: 8px solid #D9FDD3; }
13        .sabhia-choice-btn {
14          display: flex; align-items: center; justify-content: center; width: 100%;
15          padding: 14px 20px; border-radius: 14px;
16          background: linear-gradient(135deg, rgba(16,185,129,0.08), rgba(6,182,212,0.08));
17          border: 2px solid rgba(16,185,129,0.35); color: #065F46;
18          font-size: 15px; font-weight: 600; cursor: pointer;
19          transition: all 0.2s ease; text-align: center;
20          box-shadow: 0 2px 8px rgba(0,0,0,0.06); line-height: 1.3;
21          backdrop-filter: blur(4px);
22        }
23        .sabhia-choice-btn:hover { background: linear-gradient(135deg, rgba(16,185,129,0.15), rgba(6,182,212,0.15)); border-color: rgba(16,185,129,0.6); box-shadow: 0 4px 16px rgba(16,185,129,0.2); transform: translateY(-1px); }
24        .sabhia-choice-btn:active { transform: translateY(0) scale(0.98); box-shadow: 0 1px 4px rgba(0,0,0,0.1); }
25        [data-chat-mode="widget"] [data-msg-row] { padding-left: 14px !important; padding-right: 14px !important; }
26        [data-chat-mode="widget"] [data-msg-bubble] { max-width: 85% !important; }
27        [data-chat-mode="widget"] [data-msg-images] { max-width: 85% !important; }
28        [data-chat-mode="widget"] .sabhia-choice-btn { padding: 10px 14px; font-size: 14px; }
29        [data-chat-mode="widget"] [data-choices-row] { padding-left: 14px !important; padding-right: 14px !important; }
30      `}),e.jsxs("div",{className:"shrink-0 relative",style:{background:"#111111"},children:[e.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-[2px] overflow-hidden",style:{background:"rgba(255,255,255,0.05)"},children:e.jsx("div",{className:"h-full transition-all duration-700 ease-out",style:{width:`${Me}%`,background:"linear-gradient(90deg, #10B981, #06B6D4)"}})}),e.jsxs("div",{className:"max-w-[800px] mx-auto flex items-center gap-[10px] px-3 py-[10px]",children:[o==="page"&&e.jsx("a",{href:"/",className:"flex items-center transition-colors text-white/70 hover:text-white","data-testid":"chat-back-btn",children:e.jsx(ia,{className:"w-[22px] h-[22px]"})}),e.jsx("img",{src:ca,alt:"Sabhia",className:"w-[40px] h-[40px] rounded-full object-cover shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-[16.5px] font-medium text-white leading-tight",children:"Sabhia"}),e.jsx("p",{className:"text-[13px] leading-tight",style:{color:"#10B981"},children:"online"})]}),e.jsxs("div",{className:"flex items-center gap-5 text-white/50",children:[e.jsx(Ke,{className:"w-[20px] h-[20px]"}),e.jsx(Xe,{className:"w-[18px] h-[18px]"}),e.jsx(na,{className:"w-[20px] h-[20px]"}),o==="widget"&&h&&e.jsx("button",{onClick:()=>{fe(),h()},className:"text-white/70 hover:text-white transition-colors","data-testid":"chat-expand-btn",children:e.jsx(la,{className:"w-[18px] h-[18px]"})})]})]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden py-3",style:{backgroundColor:"#ECE5DD"},children:e.jsxs("div",{className:"max-w-[800px] mx-auto flex flex-col",children:[e.jsx("div",{className:"flex justify-center mb-3 mt-1",children:e.jsx("div",{className:"px-3 py-[5px] rounded-[7.5px] text-[12.5px] shadow-[0_1px_0.5px_rgba(11,20,26,0.13)]",style:{background:"#FFFFFF",color:"#54656F"},children:"Hoje"})}),d.map((a,t)=>e.jsx(ha,{msg:a,showTail:$e(t),onImageClick:(s,p)=>W({images:s,index:p}),onDocClick:(s,p)=>ee({pages:s,index:p})},a.id)),v&&e.jsx(ma,{}),ie&&e.jsx(ga,{phase:_e}),pe&&ue.map(a=>e.jsx(ba,{number:a},a)),$.length>0&&e.jsx("div",{className:"px-[18px] sm:px-[63px] mt-3 mb-2 flex flex-col gap-[10px]","data-choices-row":!0,style:{animation:"waFadeIn .3s ease"},children:$.map((a,t)=>e.jsx("button",{onClick:()=>Ie(a),className:"sabhia-choice-btn","data-testid":`choice-btn-${t}`,children:a},t))}),b==="checkout_bumps"&&q.length>0&&e.jsxs("div",{className:"px-[18px] sm:px-[63px] mt-3 mb-2 flex flex-col gap-[10px]",style:{animation:"waFadeIn .3s ease"},children:[e.jsx("div",{className:"flex px-0 mb-[3px]",children:e.jsxs("div",{className:"relative bg-white shadow-[0_1px_0.5px_rgba(11,20,26,0.13)] rounded-[7.5px] rounded-bl-[3px] overflow-hidden max-w-[85%] sm:max-w-[65%]",children:[e.jsx("div",{className:"wa-tail-l"}),e.jsx("div",{className:"h-[3px]",style:{background:"#10B981"}}),e.jsxs("div",{className:"px-[12px] py-[8px]",children:[e.jsx("p",{className:"text-[11px] font-semibold mb-2",style:{color:"#10B981"},children:"Geracao do Livro — R$49,99"}),e.jsx("p",{className:"text-[12px]",style:{color:"#667781"},children:"Incluido no seu pedido"})]})]})}),q.map(a=>{const t=fa[a.type];if(!t)return null;const s=_.has(a.type);return e.jsx("div",{onClick:()=>Ae(a.type),className:"cursor-pointer","data-testid":`bump-card-${a.type}`,children:e.jsx("div",{className:`bg-white shadow-[0_1px_0.5px_rgba(11,20,26,0.13)] rounded-[7.5px] overflow-hidden transition-all ${s?"ring-2 ring-emerald-500":""}`,children:e.jsxs("div",{className:"px-[12px] py-[10px] flex items-start gap-3",children:[e.jsx("div",{className:`w-[22px] h-[22px] rounded-full border-2 flex items-center justify-center shrink-0 mt-0.5 transition-all ${s?"border-emerald-500 bg-emerald-500":"border-gray-300"}`,children:s&&e.jsx(ye,{className:"w-3 h-3 text-white"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{children:t.emoji}),e.jsx("span",{className:"text-[13.5px] font-semibold",style:{color:"#111B21"},children:t.name})]}),e.jsx("p",{className:"text-[12px] mt-0.5",style:{color:"#667781"}
30,children:t.shortDesc}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[a.originalPrice&&e.jsxs("span",{className:"text-[11px] line-through",style:{color:"#999"},children:["R$",a.originalPrice.toFixed(2)]}),e.jsxs("span",{className:"text-[13px] font-bold",style:{color:"#10B981"},children:["R$",a.price.toFixed(2)]}),a.discountPercent&&e.jsxs("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full font-semibold bg-emerald-100 text-emerald-700",children:[a.discountPercent,"% OFF"]})]})]})]})})},a.type)}),e.jsx("button",{onClick:Re,className:"sabhia-choice-btn",style:{background:"linear-gradient(135deg, #10B981, #059669)",color:"#fff",border:"none"},"data-testid":"checkout-proceed-payment",children:"Continuar para pagamento"})]}),b==="checkout_payment"&&!A&&e.jsxs("div",{className:"px-[18px] sm:px-[63px] mt-3 mb-2 flex flex-col gap-[10px]",style:{animation:"waFadeIn .3s ease"},children:[e.jsxs("button",{onClick:()=>be("pix"),className:"sabhia-choice-btn flex items-center justify-center gap-2","data-testid":"checkout-pay-pix",children:[e.jsx(Ze,{className:"w-5 h-5"})," PIX — Aprovacao instantanea"]}),e.jsxs("button",{onClick:()=>be("card"),className:"sabhia-choice-btn flex items-center justify-center gap-2","data-testid":"checkout-pay-card",children:[e.jsx(We,{className:"w-5 h-5"})," Cartao de Credito"]})]}),b==="checkout_processing"&&A==="pix"&&e.jsx("div",{className:"px-[18px] sm:px-[63px] mt-3 mb-2",style:{animation:"waFadeIn .3s ease"},children:e.jsx("div",{className:"bg-white shadow-[0_1px_0.5px_rgba(11,20,26,0.13)] rounded-[7.5px] overflow-hidden p-4",children:D?e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-[13px] font-semibold text-center",style:{color:"#111B21"},children:"Pagamento via PIX"}),D.imageUrl&&e.jsx("div",{className:"flex justify-center",children:e.jsx("img",{src:D.imageUrl,alt:"PIX QR Code",className:"w-40 h-40 rounded-lg bg-white p-1 border","data-testid":"pix-qr-image"})}),e.jsx("p",{className:"text-[11px] text-center",style:{color:"#667781"},children:"Escaneie o QR Code ou copie o codigo abaixo:"}),D.qrCode&&e.jsxs("div",{className:"flex items-center gap-2 rounded-lg p-2",style:{background:"#F0F2F5"},children:[e.jsx("input",{type:"text",value:D.qrCode,readOnly:!0,className:"flex-1 bg-transparent text-[11px] truncate outline-none",style:{color:"#111B21"},"data-testid":"input-chat-pix-code"}),e.jsx("button",{onClick:Be,className:"flex items-center gap-1 px-2 py-1 rounded-lg text-white text-[11px] shrink-0",style:{background:"#10B981"},"data-testid":"button-chat-copy-pix",children:De?e.jsxs(e.Fragment,{children:[e.jsx(Ye,{className:"w-3 h-3"})," Copiado!"]}):e.jsxs(e.Fragment,{children:[e.jsx(ea,{className:"w-3 h-3"})," Copiar"]})})]}),e.jsxs("div",{className:"flex items-center justify-center gap-2 text-[12px]",style:{color:"#667781"},children:[e.jsx(oe,{className:"w-3 h-3 animate-spin"})," Aguardando pagamento..."]})]}):e.jsxs("div",{className:"flex flex-col items-center gap-3 py-4",children:[e.jsx(oe,{className:"w-7 h-7 animate-spin",style:{color:"#10B981"}}),e.jsx("p",{className:"text-[13px]",style:{color:"#667781"},children:"Gerando cobranca PIX..."})]})})}),b==="checkout_processing"&&A==="card"&&le&&e.jsx("div",{className:"px-[18px] sm:px-[63px] mt-3 mb-2",style:{animation:"waFadeIn .3s ease"},children:e.jsxs("div",{className:"bg-white shadow-[0_1px_0.5px_rgba(11,20,26,0.13)] rounded-[7.5px] overflow-hidden p-4",children:[e.jsx("p",{className:"text-[13px] font-semibold mb-3",style:{color:"#111B21"},children:"Pagamento com Cartao"}),e.jsx(aa,{stripe:da(),options:{clientSecret:le,appearance:{theme:"stripe",variables:{colorPrimary:"#10B981"}}},children:e.jsx(wa,{onSuccess:Oe,onError:Fe})})]})}),b==="checkout_success"&&N&&e.jsx("div",{className:"px-[18px] sm:px-[63px] mt-3 mb-2",style:{animation:"waFadeIn .3s ease"},children:e.jsxs("div",{className:"bg-white shadow-[0_1px_0.5px_rgba(11,20,26,0.13)] rounded-[7.5px] overflow-hidden p-4 text-center",children:[e.jsx("div",{className:"text-[48px] mb-2",style:{animation:"waScaleIn .5s ease"},children:"🎊"}),e.jsx("p",{className:"text-[16px] font-bold mb-1",style:{color:"#111B21"},children:"Pagamento Confirmado!"}),e.jsx("p",{className:"text-[13px] mb-4",style:{color:"#667781"},children:"Seu livro esta sendo gerado"}),e.jsxs("a",{href:`/book/${N.bookId}`,className:"inline-flex items-center justify-center gap-2 px-6 py-3 rounded-xl font-bold text-white text-[15px]",style:{background:"#10B981"},"data-testid":"checkout-success-view-book",children:[e.jsx(je,{className:"w-5 h-5"})," Ver meu livro"]})]})}),e.jsx("div",{ref:xe})]})}),Te&&e.jsx("div",{className:"shrink-0",style:{background:"#F0F2F5",animation:"waFadeIn .2s ease"},children:e.jsx("div",{className:"max-w-[800px] mx-auto px-[10px] py-[5px] flex items-end gap-[6px]",children:e.jsxs("div",{className:"flex-1 flex items-end gap-[6px]",children:[k?.type==="textarea"?e.jsx("textarea",{ref:H,value:B,onChange:a=>{M(a.target.value);const t=a.target;t.style.height="auto",t.style.height=Math.min(t.scrollHeight,160)+"px"},onKeyDown:a=>
30{a.key==="Enter"&&!a.shiftKey&&(a.preventDefault(),te())},placeholder:k.placeholder,rows:2,className:"flex-1 rounded-[21px] px-[14px] py-[12px] text-[17px] outline-none resize-none leading-[24px]",style:{background:"#FFFFFF",color:"#111B21",maxHeight:160,minHeight:56,border:"1px solid #CCD0D5",overflow:"hidden"},"data-testid":"chat-textarea"}):e.jsx("input",{ref:H,type:k?.type||"text",value:k?.type==="tel"?we(B):B,onChange:a=>M(k?.type==="tel"?a.target.value.replace(/\D/g,""):a.target.value),onKeyDown:a=>{a.key==="Enter"&&(a.preventDefault(),te())},placeholder:k?.placeholder,className:"flex-1 rounded-[21px] px-[14px] py-[12px] text-[17px] outline-none",style:{background:"#FFFFFF",color:"#111B21",height:52,border:"1px solid #CCD0D5"},"data-testid":"chat-input"}),e.jsx("button",{onClick:()=>te(),className:"w-[52px] h-[52px] rounded-full flex items-center justify-center shrink-0 transition-opacity hover:opacity-90",style:{background:"#111111"},"data-testid":"send-btn",children:e.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:e.jsx("path",{d:"M2.01 21L23 12 2.01 3 2 10l15 2-15 2z",fill:"white"})})})]})})})]})}export{Da 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.