1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/client-BAUT9REw.js","assets/chunk-QTnfLwEv.js","assets/preload-helper-zJ_50EbN.js"])))=>i.map(i=>d[i]); 2import{n as e,r as t}from"./chunk-QTnfLwEv.js";import{t as n}from"./react-xd4aoMiW.js";import{t as r}from"./jsx-runtime-DsKLSDJq.js";import{t as i}from"./preload-helper-zJ_50EbN.js";import{t as a}from"./Trans-DQT6BCXZ.js";import{t as o}from"./useTranslation-BMiKfG12.js";import{t as s}from"./LiquidOrb-DgOoSj4l.js";import{t as c}from"./createLucideIcon-CJP-tiyj.js";import{t as l}from"./arrow-up-_-U5aKGK.js";import{t as u}from"./check-CofJLF9h.js";import{t as d}from"./chevron-down-CoKp0OzZ.js";import{n as ee,r as te,t as ne}from"./parseVerdict-BWnr51fM.js";import{t as re}from"./plus-l4z-tLFa.js";import{t as ie}from"./rotate-ccw-CTpgd56y.js";import{t as ae}from"./x-CW_k_mth.js";import{t as oe}from"./TradingViewChart-GVMdoJFi.js";import{t as se}from"./SymbolSuggest-BbsYNmKi.js";import{n as ce}from"./chrome-store-A2a7ZqdD.js";var le=c(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),f=e({CopilotDemoModal:()=>C,detectSymbolCommand:()=>Se}),p=t(n(),1),m=r(),h=`sirius:conversation:v1`,ue=1440*60*1e3,de=200*1024,fe=4*1024*1024,pe=1600;function me(){if(typeof window>`u`)return null;try{let e=window.localStorage.getItem(h);if(!e)return null;let t=JSON.parse(e);if(!t||typeof t!=`object`||!Array.isArray(t.messages)||Date.now()-(t.savedAt??0)>ue)return null;let n=t.messages.map(e=>e.content).join(` 3`);return/Sem dados de mercado|Dados Ausentes|_Sem dados de mercado_|sem snapshot/i.test(n)?(window.localStorage.removeItem(h),null):t}catch{return null}}function he(e){if(!(typeof window>`u`))try{let t=e.messages,n=JSON.stringify({...e,messages:t});for(;n.length>de&&t.length>2;)t=t.slice(2),n=JSON.stringify({...e,messages:t});window.localStorage.setItem(h,n)}catch{}}function ge(){if(!(typeof window>`u`))try{window.localStorage.removeItem(h)}catch{}}async function _e(e){let t=await new Promise((t,n)=>{let r=new FileReader;r.onerror=()=>n(Error(`read fail`)),r.onload=()=>t(String(r.result)),r.readAsDataURL(e)}),n=await new Promise((e,n)=>{let r=new Image;r.onload=()=>e(r),r.onerror=()=>n(Error(`decode fail`)),r.src=t}),r=Math.min(1,pe/Math.max(n.width,n.height));if(r>=1)return t;let i=Math.round(n.width*r),a=Math.round(n.height*r),o=document.createElement(`canvas`);o.width=i,o.height=a;let s=o.getContext(`2d`);return s?(s.drawImage(n,0,0,i,a),o.toDataURL(`image/jpeg`,.85)):t}var ve=[{ticker:`PETR4`,timeframe:`1D`,question:`Analise PETR4 no diário. Tendência, S/R e cenário para os próximos pregões.`}],ye=360,be=440;function g(e){let t=e.trim().toUpperCase();return t.includes(`:`)?t:/^[A-Z]{4}\d{1,2}$/.test(t)?`BMFBOVESPA:${t}`:/^(BTC|ETH|SOL|BNB|XRP|ADA|DOGE|AVAX|LINK|MATIC|DOT|LTC|TRX|SHIB)[A-Z]{3,4}$/.test(t)?`BINANCE:${t}`:`NASDAQ:${t}`}function _(e){return e.includes(`:`)?e.split(`:`)[1]:e}function xe(e){return e.includes(`:`)?e.split(`:`)[0]:``}var v=new Set([`ESSA`,`ESSE`,`ISSO`,`ISTO`,`AQUI`,`IMAGEM`,`IMAGE`,`PRINT`,`TELA`,`FOTO`,`ATUAL`,`ACAO`,`AÃÃO`,`PAPEL`,`TICKER`,`QUAL`,`COMO`,`ONDE`,`MEU`,`SEU`]);function y(e){if(!e)return!1;let t=_(e).toUpperCase();return v.has(t)?!1:/^[A-Z0-9.\-]{2,12}$/.test(t)}var b={"1M":`1`,"1MIN":`1`,"5M":`5`,"5MIN":`5`,"15M":`15`,"15MIN":`15`,"30M":`30`,"30MIN":`30`,"1H":`60`,"60M":`60`,"2H":`120`,"4H":`240`,"1D":`D`,D:`D`,DIÃRIO:`D`,DIARIO:`D`,"1W":`W`,W:`W`,"1S":`W`,SEMANAL:`W`};function x(e){return b[e.trim().toUpperCase()]??`D`}function S(e){return{1:`1m`,5:`5m`,15:`15m`,30:`30m`,60:`1h`,120:`2h`,240:`4h`,D:`1D`,W:`1S`,M:`1M`,"12M":`1Y`}[e]??e}function Se(e){let t=e.toUpperCase(),n={},r=t.match(/\b([A-Z]{4}\d{1,2})\b/);if(r)n.symbol=g(r[1]);else{let e=new Set(`ANALISA.ANALISE.ANALISAR.OLHA.OLHAR.VE.VÃ.VER.MOSTRA.MOSTRAR.CHAMA.CHAMAR.ABRE.ABRIR.TROCA.TROCAR.AGORA.HOJE.ATIVO.GRÃFICO.GRAFICO.MERCADO.SETUP.SIRIUS.BUY.SELL.STOP.ENTRADA.SAÃDA.SAIDA.NEUTRO.LATERAL.ALTA.BAIXA.RSI.EMA.VOLUME.PREÃO.PRECO.IBOV.BVSP.ESSA.ESSE.ISSO.ISTO.AQUI.AQUELA.AQUELE.AQUILO.IMAGEM.IMAGE.PRINT.TELA.FOTO.CAPTURA.SCREENSHOT.ATUAL.ATUALMENTE.AÃÃO.ACAO.PAPEL.TICKER.QUAL.COMO.ONDE.POR.PARA.COM.SEM.UMA.UM.DOS.DAS.MEU.MINHA.SEU.SUA.QUE.QUE?.AI.AÃ.LA.LÃ.MAIS.MENOS.SOBRE`.split(`.`));if(/(ANALIS[AE]R?|OLHA[R]?|V[EÃ]R?|MOSTRA[R]?|CHAMA[R]?|ABRE|ABRIR|TROCA[R]?)/.test(t)){let r=[...t.matchAll(/\b([A-Z]{3,5})\b/g)].map(e=>e[1]).filter(t=>!e.has(t));r.length&&(n.symbol=g(r[0]))}}let i=t.match(/\b(1M|5M|15M|30M|1H|2H|4H|1D|D|DI[AÃ]RIO|1W|W|SEMANAL)\b/);return i&&(n.interval=x(i[1])),!n.symbol&&!n.interval?null:n}function C({open:e,onClose:t,onDownload:n,initialSymbol:r,initialInterval:c}){let{t:f}=o(),h=(0,p.useMemo)(()=>ve[Math.floor(Math.random()*ve.length)],[e]),ue=()=>y(r)?r:g(h.ticker),de=()=>c&&c.length>0?c:x(h.timeframe),[pe,v]=(0,p.useState)(``),[b,C]=(0,p.useState)(``),[w,T]=(0,p.useState)(!1),[E,D]=(0,p.useState)([]),[O,k]=(0,p.useState)(!1),[Ee,A]=(0,p.useState)(!1),[De,j]=(0,p.useState)(null),[Oe,M]=(0,p.useState)(!1),[ke,Ae]=(0,p.useState)(be),[N,P]=(0,p.useState)(!1),[F,I]=(0,p.useState)(ue),[L,R]=(0,p.useState)(de),[z,je]=(0,p.useState)(null),[B,V]=(0,p.useState)(null),[Me,H]=(0,p.useState)(null),[Ne,Pe]=(0,p.useState)(!1),[U,Fe]=(0,p.useState)(!1),[Ie,Le]=(0,p.useState)(!1),[Re,ze]=(0,p.useState)(0),W=(0,p.useRef)(null),[G,Be]=(0,p.useState)(null),[Ve,He]=(0,p.useState)(5),[Ue,We]=(0,p.useState)(!1),[Ge,Ke]=(0,p.useState)(``),[qe,Je]=(0,p.useState)(!1),[Ye,Xe]=(0,p.useState)(``),[Ze,K]=(0,p.useState)(!1),[Qe,$e]=(0,p.useState)(null),[et,tt]=(0,p.useState)(!1),nt=(0,p.useRef)(null),q=(0,p.useRef)(null),J=(0,p.useRef)(null),rt=(0,p.useRef)([]),it=(0,p.useRef)(!0),Y=(0,p.useRef)(``),X=(0,p.useRef)(0),Z=(0,p.useRef)(null),at=(0,p.useRef)(null),ot=(0,p.useRef)(null),Q=(0,p.useRef)(null),st=(0,p.useRef)(null),$=(0,p.useRef)(null),ct=(0,p.useRef)(null),lt=typeof window<`u`&&window.location.search.includes(`debug=1`);(0,p.useEffect)(()=>
3{if(!e)return;C(``),k(!1),A(!1),j(null),M(!1),V(null),H(null),Y.current=``,X.current=0;let t=me(),n=y(r)?r:null,i=c&&c.length>0?c:null,a=n&&t?.activeSymbol&&n!==t.activeSymbol||i&&t?.activeInterval&&i!==t.activeInterval;if(a&&ge(),!a&&t&&t.messages.length>0)return T(!0),v(``),D(t.messages),je(t.snapshot??null),I(y(t.activeSymbol)?t.activeSymbol:g(h.ticker)),R(t.activeInterval||x(h.timeframe)),setTimeout(()=>Q.current?.focus(),60),()=>{Z.current?.abort()};T(!1),v(``),D([]);let o=ue(),s=de();I(o),R(s);let l=`Analise ${_(o)} no ${S(s)}. Tendência, S/R e cenário para os próximos candles.`,u=0;return $.current=setInterval(()=>{u+=1,v(l.slice(0,u)),u>=l.length&&($.current&&clearInterval($.current),$.current=null,setTimeout(()=>{if(w)return;let e={role:`user`,content:l};D([e,{role:`assistant`,content:``}]),dt([e],o,s)},350))},28),()=>{$.current&&clearInterval($.current),$.current=null,Z.current?.abort()}},[e,h]),(0,p.useEffect)(()=>{if(!e||O)return;let t=E.filter(e=>e.content.trim().length>0);t.length!==0&&he({savedAt:Date.now(),activeSymbol:F,activeInterval:L,snapshot:z,messages:t})},[E,O,F,L,z,e]),(0,p.useEffect)(()=>{if(!Oe)return;let e=e=>{ot.current?.contains(e.target)||M(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[Oe]);let ut=e=>{let t=window.innerWidth-e,n=window.innerWidth;Ae(Math.max(Math.min(ye,n),Math.min(n,t)))};(0,p.useEffect)(()=>{if(!N)return;let e=e=>{ut(e.clientX)},t=()=>P(!1);return document.addEventListener(`mousemove`,e),document.addEventListener(`mouseup`,t),document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`,()=>{document.removeEventListener(`mousemove`,e),document.removeEventListener(`mouseup`,t),document.body.style.cursor=``,document.body.style.userSelect=``}},[N]);let dt=async(e,t,n,r)=>{Y.current=``,X.current=0,je(null),k(!0),A(!1),j(null),nt.current?.abort(),Je(!1),Xe(``),$e(null),K(!1),tt(!1);let i=new AbortController;Z.current=i;try{let a=await fetch(`/api/public/copilot-demo`,{method:`POST`,headers:{"Content-Type":`application/json`},signal:i.signal,body:JSON.stringify({messages:e,ticker:_(t),timeframe:S(n),...r?{screenshot:r}:{}})}),o=a.headers.get(`X-Demo-Remaining`),s=a.headers.get(`X-Demo-Limit`);if(o!==null&&Be(Math.max(0,Number(o)||0)),s!==null&&He(Math.max(1,Number(s)||5)),!a.ok||!a.body){let e=`HTTP ${a.status}`;try{let t=await a.clone().json();t&&typeof t.message==`string`&&t.message.trim()&&(e=t.message)}catch{}throw Error(e)}let c=a.headers.get(`X-Market-Snapshot`);if(c)try{je(JSON.parse(decodeURIComponent(c)))}catch{}let l=a.body.getReader(),u=new TextDecoder,d=``,ee=setInterval(()=>{let e=Y.current;X.current<e.length&&(X.current=Math.min(e.length,X.current+2),D(t=>{let n=[...t];return n[n.length-1]={role:`assistant`,content:e.slice(0,X.current)},n}),at.current&&it.current&&(at.current.scrollTop=at.current.scrollHeight))},18);for(;;){let{done:e,value:t}=await l.read();if(e)break;d+=u.decode(t,{stream:!0});let n;for(;(n=d.indexOf(` 4`))!==-1;){let e=d.slice(0,n).trim();if(d=d.slice(n+1),!e.startsWith(`data:`))continue;let t=e.slice(5).trim();if(t!==`[DONE]`)try{let e=JSON.parse(t).choices?.[0]?.delta?.content;e&&(Y.current+=e)}catch{}}}await new Promise(e=>{let t=setInterval(()=>{X.current>=Y.current.length&&(clearInterval(t),e())},40)}),clearInterval(ee),k(!1),A(!0),setTimeout(()=>Q.current?.focus(),40)}catch(e){if(e?.name===`AbortError`){k(!1);return}j(e instanceof Error?e.message:String(e)),k(!1)}},ft=e=>{let t=e.trim(),n=!!B;if(!t&&!n||O)return;let r=t||(n?f(`cd.attach.default`):``),i=n?null:Se(r),a=F,o=L;i?.symbol&&i.symbol!==F&&(a=i.symbol,I(i.symbol)),i?.interval&&i.interval!==L&&(o=i.interval,R(i.interval));let s=n?`${r} ð`:r,c=[...E.filter(e=>e.content),{role:`user`,content:s}];D([...c,{role:`assistant`,content:``}]),C(``),A(!1);
4let l=B?.dataUrl;V(null),H(null),dt(c,a,o,l)},pt=()=>{Z.current?.abort(),k(!1)},mt=async()=>{if(!Ze){Je(!0),$e(null),tt(!1),Xe(``);try{let{supabase:e}=await i(async()=>{let{supabase:e}=await import(`./client-BAUT9REw.js`).then(e=>e.t);return{supabase:e}},__vite__mapDeps([0,1,2])),{data:t}=await e.auth.getSession(),n=t?.session?.access_token;if(!n){tt(!0);return}K(!0);let r=new AbortController;nt.current=r;let a=``,o=[...E].reverse().find(e=>e.role===`assistant`);if(o){let e=ne(o.content);e.verdict&&(a=JSON.stringify({ticker:_(F),...e.verdict}))}let s=await fetch(`/api/public/copilot-deep`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${n}`},signal:r.signal,body:JSON.stringify({ticker:_(F),exchange:xe(F)||void 0,timeframe:S(L),...a?{operational_card:a}:{}})});if(!s.ok||!s.body){let e=await s.text().catch(()=>``);throw Error(e.slice(0,200)||`HTTP ${s.status}`)}let c=s.body.getReader(),l=new TextDecoder,u=``;for(;;){let{done:e,value:t}=await c.read();if(e)break;u+=l.decode(t,{stream:!0});let n;for(;(n=u.indexOf(` 5`))!==-1;){let e=u.slice(0,n).trim();if(u=u.slice(n+1),!e.startsWith(`data:`))continue;let t=e.slice(5).trim();if(t!==`[DONE]`)try{let e=JSON.parse(t).choices?.[0]?.delta?.content;e&&Xe(t=>t+e)}catch{}}}K(!1)}catch(e){if(e?.name===`AbortError`){K(!1);return}$e(e instanceof Error?e.message:String(e)),K(!1)}}},ht=async e=>{if(H(null),e){if(!e.type.startsWith(`image/`)){H(f(`cd.err.imgOnly`));return}if(e.size>fe){H(f(`cd.err.imgBig`));return}try{V({dataUrl:await _e(e),name:e.name||`screenshot.png`})}catch{H(`Falha ao ler a imagem.`)}}},gt=()=>{Z.current?.abort(),ge(),D([]),C(``),V(null),H(null),k(!1),A(!1),j(null),T(!1),v(``),I(g(h.ticker)),R(x(h.timeframe)),Y.current=``,X.current=0,$.current&&clearInterval($.current);let e=0,t=h.question;$.current=setInterval(()=>{e+=1,v(t.slice(0,e)),e>=t.length&&($.current&&clearInterval($.current),$.current=null,setTimeout(()=>{if(w)return;let e=g(h.ticker),t=x(h.timeframe),n={role:`user`,content:h.question};D([n,{role:`assistant`,content:``}]),dt([n],e,t)},350))},28)},_t=(e,t)=>{let n=e??F,r=t??L;if(!y(n))return;O&&Z.current?.abort(),T(!0),$.current&&=(clearInterval($.current),null),v(``);let i={role:`user`,content:`Analise ${_(n)} no ${S(r)}. Tendência, S/R e cenário para os próximos candles.`};D([i,{role:`assistant`,content:``}]),dt([i],n,r)},vt=async()=>{if(!(U||Ie)){if(!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`){H(f(`cd.err.recBrowser`));return}try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});J.current=e;let t=MediaRecorder.isTypeSupported(`audio/webm`)?`audio/webm`:MediaRecorder.isTypeSupported(`audio/mp4`)?`audio/mp4`:``,n=t?new MediaRecorder(e,{mimeType:t}):new MediaRecorder(e);rt.current=[],n.ondataavailable=e=>{e.data&&e.data.size>0&&rt.current.push(e.data)},n.onstop=async()=>{J.current?.getTracks().forEach(e=>e.stop()),J.current=null;let e=n.mimeType||`audio/webm`,t=new Blob(rt.current,{type:e});if(rt.current=[],t.size<1200){H(f(`cd.err.recShort`)),Le(!1);return}Le(!0);try{let n=new FormData,r=e.includes(`mp4`)?`mp4`:`webm`;n.append(`file`,t,`voz.${r}`);let{supabase:a}=await i(async()=>{let{supabase:e}=await import(`./client-BAUT9REw.js`).then(e=>e.t);return{supabase:e}},__vite__mapDeps([0,1,2])),{data:o}=await a.auth.getSession(),s=o?.session?.access_token;if(!s){H(f(`cd.err.recLogin`)),Le(!1);return}let c=await fetch(`/api/public/transcribe`,{method:`POST`,body:n,headers:{Authorization:`Bearer ${s}`}});if(!c.ok)throw Error(`HTTP ${c.status}`);let l=((await c.json()).text??``).trim();l?(T(!0),$.current&&=(clearInterval($.current),null),v(``),C(e=>e?`${e} ${l}`:l),setTimeout(()=>Q.current?.focus(),40)):H(f(`cd.err.recNoUnd`))}catch(e){H(e instanceof Error?e.message:`Falha ao transcrever.`)}finally{Le(!1)}},q.current=n,n.start(),H(null),Fe(!0),ze(0),W.current&&clearInterval(W.current);let r=Date.now();W.current=setInterval(()=>{ze(Math.floor((Date.now()-r)/1e3))},250)}catch{H(f(`cd.err.mic`))}}},yt=()=>{if(U){Fe(!1),W.current&&=(clearInterval(W.current),null);try{q.current?.stop()}catch{}q.current=null}},bt=()=>{U?yt():vt()},xt=e=>{e.currentTarget.setPointerCapture(e.pointerId),P(!0),ut(e.clientX)},St=e=>{N&&ut(e.clientX)},Ct=e=>{try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}P(!1)};if((0,p.useEffect)(()=>
5{if(!e&&U){try{q.current?.stop()}catch{}J.current?.getTracks().forEach(e=>e.stop()),J.current=null,q.current=null,Fe(!1)}},[e]),!e)return null;let wt=z&&!(`error`in z);return(0,m.jsxs)(`div`,{className:`fixed inset-0 z-[100] flex bg-black animate-fade-in`,children:[(0,m.jsxs)(`div`,{ref:ct,className:`relative min-w-0 flex-1 overflow-hidden bg-[#0a0a0b]`,children:[(0,m.jsx)(oe,{symbol:F,interval:L}),(0,m.jsx)(`div`,{className:`pointer-events-none absolute inset-y-0 right-0 w-[60px]`,style:{background:`linear-gradient(90deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.5) 100%)`}})]}),N&&(0,m.jsx)(`div`,{className:`fixed inset-0 z-[120] cursor-col-resize`,onMouseMove:e=>ut(e.clientX),onMouseUp:()=>P(!1)}),(0,m.jsx)(`div`,{onPointerDown:xt,onPointerMove:St,onPointerUp:Ct,onPointerCancel:Ct,className:`group relative w-[6px] shrink-0 cursor-col-resize bg-white/[0.04] transition ${N?`bg-white/20`:`hover:bg-white/10`}`,title:f(`cd.drag`),children:(0,m.jsx)(`div`,{className:`absolute left-1/2 top-1/2 h-10 w-[3px] -translate-x-1/2 -translate-y-1/2 rounded-full bg-white/25 opacity-70 group-hover:opacity-100`})}),(0,m.jsxs)(`aside`,{className:`relative flex h-full shrink-0 flex-col border-l border-white/10 bg-[#0a0a0b]`,style:{width:`min(${ke}px, 100vw)`},children:[(0,m.jsx)(`div`,{className:`pointer-events-none absolute inset-0`,style:{background:`radial-gradient(80% 40% at 50% 110%, rgba(139,92,246,0.14) 0%, rgba(236,72,153,0.05) 40%, transparent 70%)`}}),(0,m.jsxs)(`div`,{className:`relative z-10 flex h-full w-full flex-col`,children:[(0,m.jsxs)(`header`,{className:`flex items-center justify-between px-4 py-3`,children:[(0,m.jsxs)(`div`,{ref:ot,className:`relative`,children:[(0,m.jsxs)(`button`,{onClick:()=>M(e=>!e),className:`flex items-center gap-1.5 rounded-lg px-2 py-1.5 text-[15px] text-white/90 transition hover:bg-white/[0.06]`,children:[(0,m.jsx)(`span`,{className:`font-medium`,children:`Syrius`}),(0,m.jsx)(`span`,{className:`text-white/50`,children:f(`cd.plan.free`)}),(0,m.jsx)(d,{className:`h-4 w-4 text-white/50`})]}),Oe&&(0,m.jsxs)(`div`,{className:`absolute left-0 top-[110%] z-30 w-[280px] overflow-hidden rounded-2xl border border-white/10 bg-[#1c1c1e] shadow-2xl animate-fade-in`,children:[(0,m.jsxs)(`button`,{onClick:()=>M(!1),className:`flex w-full items-start gap-3 px-4 py-3 text-left transition hover:bg-white/[0.05]`,children:[(0,m.jsx)(u,{className:`mt-0.5 h-4 w-4 shrink-0 text-white`}),(0,m.jsxs)(`div`,{className:`flex-1`,children:[(0,m.jsxs)(`div`,{className:`text-[14px] font-medium text-white`,children:[`Syrius `,f(`cd.plan.free`)]}),(0,m.jsx)(`div`,{className:`text-[12px] text-white/50`,children:f(`cd.plan.free.desc`)})]})]}),(0,m.jsxs)(`button`,{disabled:!0,title:f(`cd.plan.voice.title`),className:`flex w-full items-start gap-3 px-4 py-3 text-left opacity-60`,children:[(0,m.jsx)(`div`,{className:`mt-0.5 h-4 w-4 shrink-0`}),(0,m.jsxs)(`div`,{className:`flex-1`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsx)(`span`,{className:`text-[14px] font-medium text-white`,children:f(`cd.plan.voice`)}),(0,m.jsx)(`span`,{className:`rounded-full bg-white/10 px-2 py-0.5 text-[10px] font-semibold text-white/70`,children:f(`cd.plan.voice.tag`)})]}),(0,m.jsx)(`div`,{className:`text-[12px] text-white/50`,children:f(`cd.plan.voice.desc`)})]})]})]})]}),(0,m.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,m.jsx)(`button`,{onClick:gt,title:f(`cd.btn.new`),"aria-label":f(`cd.btn.new`),className:`grid h-9 w-9 place-items-center rounded-full text-white/60 transition hover:bg-white/[0.06] hover:text-white`,children:(0,m.jsx)(ie,{className:`h-4 w-4`})}),(0,m.jsx)(`button`,{onClick:t,"aria-label":f(`cd.btn.close`),className:`grid h-9 w-9 place-items-center rounded-full text-white/60 transition hover:bg-white/[0.06] hover:text-white`,children:(0,m.jsx)(ae,{className:`h-5 w-5`})})]})]}),(0,m.jsxs)(`div`,{className:`relative flex flex-wrap items-center gap-2 px-4 pb-2 pt-0.5`,children:[(0,m.jsxs)(`button`,{type:`button`,onClick:()=>We(e=>!e),title:f(`cd.symbol.change`),className:`inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[11px] font-semibold uppercase tracking-wide transition ${Ue?`bg-white text-black`:`bg-white/[0.06] text-white/80 hover:bg-white/[0.12] hover:text-white`}`,children:[_(F),(0,m.jsx)(d,{className:`h-3 w-3 transition ${Ue?`rotate-180`:``}`})]}),Ue&&(0,m.jsx)(`div`,{className:`absolute left-4 top-[calc(100%+2px)] z-50 w-[320px] max-w-[calc(100%-2rem)]`,children:(0,m.jsxs)(`div`,{className:`rounded-xl border border-white/10 bg-[#0a0a0b] p-2 shadow-2xl`,children:[(0,m.jsx)(`input`,{autoFocus:!0,value:Ge,onChange:e=>Ke(e.target.value.toUpperCase()),placeholder:f(`cd.symbol.search`),className:`mb-2 w-full rounded-md border border-white/10 bg-white/[0.04] px-3 py-1.5 text-[12.5px] font-mono text-white placeholder:text-white/35 focus:border-[#22a1ff]/60 focus:outline-none`}),Ge.trim().length>=2?(0,m.jsx)(se,{query:Ge,onPick:e=>{let t=e.symbol.toUpperCase(),n=e.exchange&&!t.includes(`:`)?`${e.exchange}:${t}`:t;y(n)&&(I(n),_t(n,L)),Ke(``),We(!1)}}):(0,m.jsx)(`p`,{className:`px-1 py-2 text-[11.5px] text-white/45`,children:f(`cd.symbol.min`)})]})}),(0,m.jsx)(`div`,{className:`flex items-center gap-0.5 rounded-full bg-white/[0.06] p-0.5`,children:[[`1`,`1m`],[`5`,`5m`],[`15`,`15m`],[`60`,`1h`],[`240`,`4h`],[`D`,`1D`],[`W`,`1S`],[`M`,`1M`],[`12M`,`1Y`]].map(([e,t])=>(0,m.jsx)(`button`,{type:`button`,onClick:()=>{R(e),e!==L&&_t(F,e)},className:`rounded-full px-2 py-1 text-[11px] font-medium transition ${L===e?`bg-white text-black`:`text-white/60 hover:text-white`}`,children:t},e))}),(0,m.jsx)(`button`,{type:`button`,onClick:()=>_t(),disabled:O,className:`inline-flex items-center gap-1.5 rounded-full bg-gradient-to-r from-[#22a1ff] via-[#5b6cff] to-[#c04bff] px-3 py-1 text-[11px] font-semibold uppercase tracking-wide text-white shadow-[0_6px_18px_-8px_rgba(91,108,255,0.9)] transition hover:opacity-95 disabled:opacity-50`,title:f(`cd.reanalyze.title`,{sym:_(F),tf:S(L)}),children:f(`cd.reanalyze.cta`)}),(0,m.jsx)(`span`,{className:`ml-auto text-[11px] ${G===0?`text-amber-300`:`text-white/45`}`,children:G===null?f(`cd.credits.total`,{limit:Ve}):f(`cd.credits.left`,{n:G,limit:Ve})})]}),(0,m.jsx)(`div`,{ref:at,onScroll:e=>{let t=e.currentTarget;it.current=t.scrollHeight-(t.scrollTop+t.clientHeight)<32},className:`flex-1 overflow-y-auto scrollbar-hide`,children:(0,m.jsxs)(`div`,{className:`flex w-full flex-col gap-5 px-5 pb-6 pt-2`,children:[E.length===0&&(0,m.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-4 py-20`,children:[(0,m.jsx)(s,{size:140,state:`thinking`}),(0,m.jsx)(`p`,{className:`text-[13px] text-white/50`,children:f(`cd.analyzing`)})]}),E.map((e,t)=>(0,m.jsx)(`div`,{className:e.role===`user`?`flex justify-end`:``,children:e.role===`user`?(0,m.jsx)(`div`,{className:`max-w-[90%] rounded-2xl bg-white/[0.08] px-4 py-2.5 text-[14.5px] text-white`,children:e.content}):(()=>{let t=ne(e.content),n=z&&!(`error`in z)?z:null;return(0,m.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[t.verdict&&(0,m.jsx)(ee,{verdict:t.verdict,currentPrice:n?.price??null,changePct:n?.change_pct_bar??null,symbol:_(F)},`${F}-${L}`),lt&&z&&(0,m.jsx)(Ce,{snap:z}),t.body&&(0,m.jsxs)(`details`,{className:`group rounded-xl border border-white/10 bg-white/[0.02] px-3.5 py-2.5`,children:[(0,m.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between text-[12.5px] font-medium text-white/60 transition hover:text-white/90`,children:[(0,m.jsx)(`span`,{children:f(`cd.reasoning`)}),(0,m.jsx)(d,{className:`h-4 w-4 transition group-open:rotate-180`})]}),(0,m.jsx)(`div`,{className:`sirius-md mt-2 text-[13.5px] leading-[1.6] text-white/85`,dangerouslySetInnerHTML:{__html:Te(t.body)}})]})]})})()},t)),O&&E.at(-1)?.content===``&&(0,m.jsxs)(`div`,{className:`flex items-center gap-3 text-white/55`,children:[(0,m.jsx)(s,{size:24,state:`thinking`}),(0,m.jsx)(`span`,{className:`text-[13.5px]`,children:f(`cd.thinking`)})]}),De&&(0,m.jsx)(`p`,{className:`text-sm text-red-400`,children:De.startsWith(`HTTP `)?f(`cd.err.http`,{msg:De}):De}),G===0&&(0,m.jsx)(`div`,{className:`mt-1 animate-fade-in overflow-hidden rounded-2xl border border-white/10 bg-gradient-to-br from-[#1a1030] via-[#0f1530] to-[#0a0f24] p-5 shadow-[0_20px_60px_-2
50px_rgba(120,80,255,0.55)]`,children:(0,m.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,m.jsx)(s,{size:44,state:`thinking`}),(0,m.jsxs)(`div`,{className:`flex-1`,children:[(0,m.jsx)(`p`,{className:`text-[13px] font-semibold uppercase tracking-wider text-white/60`,children:f(`cd.exhaust.tag`)}),(0,m.jsx)(`h4`,{className:`mt-1 text-[17px] font-semibold text-white`,children:f(`cd.exhaust.title`)}),(0,m.jsx)(`p`,{className:`mt-1 text-[13px] text-white/65`,children:f(`cd.exhaust.body`)}),(0,m.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,m.jsx)(`button`,{type:`button`,onClick:()=>{ce(`demo-zero-credits`),t()},className:`inline-flex items-center justify-center rounded-full bg-gradient-to-r from-[#22a1ff] via-[#5b6cff] to-[#c04bff] px-5 py-2.5 text-[13px] font-semibold text-white shadow-[0_10px_40px_-8px_rgba(192,75,255,0.7)] transition hover:opacity-95`,children:f(`cd.exhaust.cta`)}),(0,m.jsx)(`a`,{href:`/planos`,className:`inline-flex items-center justify-center rounded-full border border-white/15 bg-white/[0.04] px-4 py-2.5 text-[13px] font-medium text-white/85 transition hover:bg-white/[0.08]`,children:f(`cd.exhaust.plans`)})]})]})]})}),Ee&&(0,m.jsxs)(`div`,{className:`mt-3 animate-fade-in rounded-2xl border border-white/10 bg-white/[0.03] p-4 text-center`,children:[(0,m.jsx)(`p`,{className:`text-[13.5px] text-white/75`,children:wt?(0,m.jsx)(a,{i18nKey:`cd.done.real`,components:{b:(0,m.jsx)(`strong`,{className:`text-white`})}}):f(`cd.done.nodata`)}),(0,m.jsx)(`button`,{onClick:()=>{n(),t()},className:`mt-3 inline-flex items-center justify-center rounded-full bg-gradient-to-r from-[#22a1ff] via-[#5b6cff] to-[#c04bff] px-5 py-2.5 text-[13.5px] font-semibold text-white shadow-[0_10px_40px_-8px_rgba(192,75,255,0.7)] transition hover:opacity-95`,children:f(`cd.done.cta`)})]}),Ee&&(0,m.jsx)(`div`,{className:`mt-2 animate-fade-in`,children:qe?et?(0,m.jsxs)(`div`,{className:`rounded-2xl border border-white/10 bg-white/[0.03] p-4 text-center`,children:[(0,m.jsx)(`p`,{className:`text-[13.5px] text-white/85`,children:f(`cd.dossier.login`)}),(0,m.jsx)(`a`,{href:`/auth?next=/copiloto`,className:`mt-3 inline-flex rounded-full bg-white px-5 py-2 text-[13px] font-semibold text-black transition hover:opacity-90`,children:f(`cd.dossier.loginBtn`)})]}):(0,m.jsxs)(`div`,{className:`rounded-2xl border border-white/10 bg-white/[0.02] p-4`,children:[(0,m.jsxs)(`div`,{className:`mb-2 flex items-center justify-between text-[11.5px] text-white/50`,children:[(0,m.jsxs)(`span`,{children:[f(`cd.dossier.head`),` â `,_(F),` ⢠`,S(L)]}),Ze&&(0,m.jsx)(`span`,{className:`text-white/40`,children:f(`cd.dossier.gen`)})]}),Qe&&(0,m.jsx)(`p`,{className:`text-sm text-rose-400`,children:f(`cd.dossier.err`,{msg:Qe})}),Ye?(0,m.jsx)(`div`,{className:`sirius-md text-[13.5px] leading-[1.65] text-white/85`,dangerouslySetInnerHTML:{__html:Te(Ye)}}):Qe?null:(0,m.jsxs)(`div`,{className:`flex items-center gap-3 text-white/60`,children:[(0,m.jsx)(s,{size:22,state:`thinking`}),(0,m.jsx)(`span`,{className:`text-[13px]`,children:f(`cd.dossier.loading`)})]})]}):(0,m.jsxs)(`button`,{onClick:mt,className:`flex w-full items-center justify-between gap-3 rounded-2xl border border-white/10 bg-white/[0.04] px-4 py-3 text-left text-[13px] text-white/85 transition hover:bg-white/[0.07]`,children:[(0,m.jsxs)(`span`,{className:`flex flex-col`,children:[(0,m.jsx)(`strong`,{className:`text-[13.5px] font-semibold text-white`,children:f(`cd.dossier.cta`)}),(0,m.jsx)(`span`,{className:`text-[11.5px] text-white/55`,children:f(`cd.dossier.sub`)})]}),(0,m.jsx)(d,{className:`h-4 w-4 shrink-0 -rotate-90 text-white/50`})]})})]})}),(0,m.jsxs)(`div`,{className:`relative px-4 pb-5`,children:[(()=>{let e=b.trim().split(/\s+/),t=e[e.length-1]??``;return t.length>=2&&t.length<=12&&/^[A-Z0-9.\-]+$/.test(t)&&!/^\d+$/.test(t)&&![`BUY`,`SELL`,`STOP`,`TP`,`SL`,`RSI`,`EMA`,`MACD`].includes(t)?(0,m.jsx)(`div`,{className:`absolute bottom-[calc(100%+6px)] left-4 right-4 max-w-[440px]`,children:(0,m.jsx)(se,{query:t,onPick:t=>{let n=t.symbol.toUpperCase(),r=t.exchange&&!n.includes(`:`)?`${t.exchange}:${n}`:n;y(r)&&I(r);let i=e.slice(0,-1).join(` `);C((i?`${i} `:``)+n+` `),setTimeout(()=>
5Q.current?.focus(),0)}})}):null})(),(B||Me)&&(0,m.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[B&&(0,m.jsxs)(`div`,{className:`relative`,children:[(0,m.jsx)(`img`,{src:B.dataUrl,alt:`Pré-visualização da imagem anexada: ${B.name}`,className:`h-14 w-14 rounded-lg border border-white/15 object-cover`}),(0,m.jsx)(`button`,{type:`button`,onClick:()=>V(null),"aria-label":f(`cd.attach.remove`),className:`absolute -right-1.5 -top-1.5 grid h-5 w-5 place-items-center rounded-full bg-black/80 text-white ring-1 ring-white/20 hover:bg-black`,children:(0,m.jsx)(ae,{className:`h-3 w-3`})})]}),Me&&(0,m.jsx)(`span`,{className:`text-[11.5px] font-medium text-rose-400`,children:Me})]}),(0,m.jsx)(`input`,{ref:st,type:`file`,accept:`image/*`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];ht(t),e.target.value=``}}),(0,m.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),ft(b)},onDragOver:e=>{e.dataTransfer?.types?.includes(`Files`)&&(e.preventDefault(),Pe(!0))},onDragLeave:()=>Pe(!1),onDrop:e=>{e.preventDefault(),Pe(!1);let t=e.dataTransfer?.files?.[0];t&&ht(t)},className:`flex w-full items-end gap-1.5 rounded-3xl bg-[#1c1c1e] px-2.5 py-2 shadow-[0_10px_40px_-20px_rgba(0,0,0,0.8)] transition ${Ne?`ring-2 ring-[#5b6cff]/60`:``}`,children:[(0,m.jsx)(`button`,{type:`button`,onClick:()=>st.current?.click(),title:f(`cd.attach.add`),"aria-label":f(`cd.attach.add`),className:`grid h-9 w-9 shrink-0 place-items-center rounded-full text-white/60 transition hover:bg-white/[0.06] hover:text-white`,children:(0,m.jsx)(re,{className:`h-5 w-5`})}),(0,m.jsx)(`textarea`,{ref:Q,value:w?b:b||pe,onChange:e=>{w||($.current&&=(clearInterval($.current),null),T(!0),v(``)),C(e.target.value);let t=e.target;t.style.height=`auto`,t.style.height=Math.min(t.scrollHeight,120)+`px`},onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),ft(b))},onPaste:e=>{let t=e.clipboardData?.items;if(t){for(let n of Array.from(t))if(n.kind===`file`&&n.type.startsWith(`image/`)){let t=n.getAsFile();if(t){e.preventDefault(),ht(t);break}}}},onFocus:()=>{w||($.current&&=(clearInterval($.current),null),T(!0),v(``))},rows:1,placeholder:f(`cd.composer.placeholder`),className:`flex-1 resize-none border-0 bg-transparent px-1 py-2 text-[14.5px] leading-snug text-white placeholder:text-white/40 focus:outline-none scrollbar-hide`,style:{maxHeight:120,scrollbarWidth:`none`,msOverflowStyle:`none`}}),(0,m.jsx)(`button`,{type:`button`,onClick:bt,disabled:Ie,title:f(U?`cd.mic.stop`:Ie?`cd.mic.transcribing`:`cd.mic.speak`),"aria-label":f(U?`cd.mic.stop`:`cd.mic.record`),className:`grid shrink-0 place-items-center rounded-full transition ${U?`h-9 gap-1.5 bg-rose-500/90 px-2.5 text-[11px] font-semibold tabular-nums text-white`:Ie?`h-9 w-9 bg-white/10 text-white/60`:`h-9 w-9 text-white/60 hover:bg-white/[0.06] hover:text-white`}`,children:U?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-white animate-pulse`}),(0,m.jsx)(`span`,{children:we(Re)}),(0,m.jsx)(le,{className:`h-3 w-3 fill-current`})]}):(0,m.jsx)(te,{className:`h-5 w-5`})}),O?(0,m.jsx)(`button`,{type:`button`,onClick:pt,title:f(`cd.composer.stop`),className:`grid h-10 w-10 shrink-0 place-items-center rounded-full bg-white/10 text-white transition hover:bg-white/20`,children:(0,m.jsx)(le,{className:`h-4 w-4 fill-current`})}):b.trim()||B?(0,m.jsx)(`button`,{type:`submit`,title:f(`cd.composer.send`),className:`grid h-10 w-10 shrink-0 place-items-center rounded-full bg-gradient-to-br from-[#22a1ff] via-[#5b6cff] to-[#c04bff] text-white shadow-[0_6px_20px_-6px_rgba(91,108,255,0.7)] transition hover:brightness-110`,children:(0,m.jsx)(l,{className:`h-5 w-5`})}):(0,m.jsx)(`button`,{type:`button`,title:f(`cd.voice.soon`),className:`grid h-10 w-10 shrink-0 place-items-center rounded-full transition hover:brightness-110`,children:(0,m.jsx)(s,{size:36,state:`idle`})})]})]})]})]})]})}function Ce({snap:e}){return(0,m.jsxs)(`details`,{className:`rounded-xl border border-white/10 bg-black/40 px-3 py-2 text-[11px] text-white/60`,children:[(0,m.jsx)(`summary`,{className:`cursor-pointer`,children:`debug: snapshot backend (prompt do Syrius)`}),(0,m.jsx)(`pre`,{className:`mt-2 overflow-x-auto text-[10.5px] leading-tight text-white/70`,children:JSON.stringify(e,null,2)})]})}function we(e){return`${Math.floor(e/60)}:${(e%60).toString().padStart(2,`0`)}`}function Te(e){let t=e=>e.replace(/[&<>]/g,e=>({"&":`&`,"<":`<`,">":`>`})[e]),n=e.replace(/\r\n/g,` 6`).split(` 7`),r=[],i=!1,a=()=>{i&&=(r.push(`</ul>`),!1)},o=e=>{let n=t(e);return n=n.replace(/`([^`]+)`/g,`<code>$1</code>`),n=n.replace(/\*\*([^*]+)\*\*/g,`<strong>$1</strong>`),n=n.replace(/(^|\s)_([^_\n]+)_/g,`$1<em>$2</em>`),n};for(let e of n){let t=e.trimEnd(),n=/^(#{1,3})\s+(.+)$/.exec(t),s=/^[-*]\s+(.+)$/.exec(t);if(n){a();let e=n[1].length,t=e===1?`mt-2 mb-3 text-[20px] font-semibold text-white`:e===2?`mt-4 mb-2 text-[17px] font-semibold text-white`:`mt-3 mb-1.5 text-[14.5px] font-semibold text-white/95`;r.push(`<h${e} class="${t}">${o(n[2])}</h${e}>`)}else s?(i||=(r.push(`<ul class="my-2 space-y-1.5 pl-1">`),!0),r.push(`<li class="flex gap-2"><span class="mt-[9px] h-[4px] w-[4px] shrink-0 rounded-full bg-white/50"></span><span>${o(s[1])}</span></li>`)):t===``?(a(),r.push(``)):(a(),r.push(`<p class="my-2">${o(t)}</p>`))}return a(),r.join(` 8`)}export{f as n,C as t};
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.