Exploit databaseDownload repository ZIP
GH-8ffaaa2c33364b540d85c0f3eb40f8a0
remipelloux/hackooglemini
Sources for CVE-2021-30563
1 sourcePreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars.
Repository files28
remipelloux/hackoogleminiRevision 398d6f99af69
- ↑..Parent directory
- chunks_1016-4314bae36c5e95cd.js
- chunks_121-2ae1955ff43c4009.js
- chunks_1610-1b371c1088cf0712.js
- chunks_1718-7967289411854c38.js
- chunks_2200-70325a58ffcbbcbc.js
- chunks_2262-51ac6c5da7b74db0.js
- chunks_3503-9fb1cb94be5b0662.js
- chunks_3794-50ffabe5ed0a960a.js
- chunks_4bd1b696-04d4e6726f46d1d5.js
- chunks_69b09407-eb28c4d1f25ec0d0.js
- chunks_7645-93c1c33264293479.js
- chunks_7720-8d454a4ae87c046c.js
- chunks_8500-01a63dafd809e317.js
- chunks_870fdd6f-8e80e840694faf05.js
- chunks_8896-d693a48c874735f7.js
- chunks_9302-2733301e9d8ebe2e.js
- chunks_9411-8562af0ea4b36be9.js
- chunks_9934-d6c09def75ea20da.js
- chunks_app_chat_page-59fab86379918100.js
- chunks_app_dashboard_page-7fe7d47782ee2ae1.js
- chunks_app_docs_page-91e06e58f83db4f6.js
- chunks_app_layout-9d59e5e2050ae70b.js
- chunks_app_login_page-0d76961c7c277a10.js
- chunks_app_page-2fa550e347d50605.js
- chunks_app_status_page-11c5f7774d7ca489.js
- chunks_main-app-04c590686f73cfea.js
- chunks_polyfills-42372ed130431b0a.js
- chunks_webpack-049429b45fcc350c.js
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
ghostcli/target/web/chunks/chunks_app_dashboard_page-7fe7d47782ee2ae1.js
JavaScript · 42,301 bytes(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5105],{27955:()=>{},79834:(e,a,s)=>{Promise.resolve().then(s.bind(s,83932))},83932:(e,a,s)=>{"use strict";s.r(a),s.d(a,{default:()=>P});var t=s(95155),r=s(88798),n=s(98500),i=s.n(n),d=s(89302),l=s(12115),c=s(31610),o=s(92584);let h={32:16,128:28};function x(e){let a;if(/^\d{1,3}(\.\d{1,3}){3}$/.test(e)){let a=e.split(".").map(Number);return a.every(e=>e<=255)?a.map(e=>e.toString(2).padStart(8,"0")).join(""):null}if(!e.includes(":"))return null;try{a=new URL(`http://[${e}]/`).hostname.slice(1,-1)}catch{return null}let[s,t]=a.includes("::")?a.split("::"):[a,null],r=s?s.split(":"):[],n=t?t.split(":"):[],i=[...r,...null===t?[]:Array(8-r.length-n.length).fill("0"),...n];return 8===i.length?i.map(e=>parseInt(e,16).toString(2).padStart(16,"0")).join(""):null}function m({keyId:e}){let{t:a,f:s}=(0,d.o)(),[r,n]=(0,l.useState)([]),[i,p]=(0,l.useState)(""),[u,b]=(0,l.useState)(null),[g,j]=(0,l.useState)(""),[f,v]=(0,l.useState)(""),[N,y]=(0,l.useState)(""),[w,k]=(0,l.useState)(!1),[S,_]=(0,l.useState)(null),[C,$]=(0,l.useState)(!0),[R,T]=(0,l.useState)(1),[E,L]=(0,l.useState)(5),M=()=>_({key:"ipConnectionFailed",kind:"error"}),D=(0,l.useCallback)(async()=>{$(!0);try{let a=await fetch(`/api/keys/ips?keyId=${e}`,{cache:"no-store"}),s=await a.json();if(!a.ok)throw Error(s.error);n(s.ips||[]),p(s.currentIp||""),b(s.currentNetwork||null),"number"==typeof s.limite&&T(s.limite),"number"==typeof s.teto&&L(s.teto)}catch{_({key:"ipLoadFailed",kind:"error"})}finally{$(!1)}},[e]);(0,l.useEffect)(()=>{D()},[D]);let A=async s=>{k(!0),_(null);try{let t=await fetch("/api/keys/ips",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({keyId:e,...s})}),r=await t.json();if(!t.ok)return _({key:r.errorCode&&Object.hasOwn(a.dashboard,r.errorCode)?r.errorCode:"generic",kind:"error"}),null;return r.ips&&n(r.ips),r}catch{return M(),null}finally{k(!1)}},B=async e=>{let a=await A({action:"request",ip:e});a&&(v(""),a.renewed?(y(""),_({key:"ipRenewed",kind:"success"})):(y(e),_({key:"ipSent",kind:"sent"})))},P=async e=>{k(!0),_(null);try{let s=await fetch(`/api/keys/ips?id=${e.id}`,{method:"DELETE"}),t=await s.json();if(!s.ok)return void _({key:t.errorCode&&Object.hasOwn(a.dashboard,t.errorCode)?t.errorCode:"generic",kind:"error"});n(t.ips||[]),(t.ips||[]).some(e=>e.ip===N)||(y(""),v("")),_({key:"ipRemoved",kind:"success"})}catch{M()}finally{k(!1)}},U=e=>!!(e.expires_at&&Date.parse(e.expires_at.replace(" ","T")+"Z")<=Date.now()),F=e=>1===e.confirmed&&!U(e),O=new Set(r.filter(F).map(e=>e.asn?`as:${e.asn}`:e.bloco?`bloco:${e.bloco}`:`ip:${e.ip}`)).size,G=r.some(e=>F(e)&&(e.ip===i||!!(u&&e.asn===u.asn)||function(e,a){let[s="",t=""]=(a??"").split("/"),r=/^\d{1,3}$/.test(t)?Number(t):NaN,n=x(e),i=x(s);return!!n&&!!i&&n.length===i.length&&!!(r>=h[n.length]&&r<=n.length)&&n.slice(0,r)===i.slice(0,r)}(i,e.bloco))),I=r.find(e=>e.ip===N);return(0,t.jsxs)("div",{className:"network-access",children:[(0,t.jsxs)("div",{className:"network-heading",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{children:a.dashboard.ipsTitle}),(0,t.jsx)("p",{children:a.dashboard.ipsHint})]}),(0,t.jsxs)("span",{className:"network-count",children:[O,"/",R," ",a.dashboard.ipNetworks]})]}),C?(0,t.jsxs)("p",{className:"network-loading",children:[(0,t.jsx)(c.gc,{icon:o.z1G,className:"w-3 animate-spin"})," ",a.dashboard.ipLoading]}):0===r.length?(0,t.jsx)("p",{className:"network-empty",children:a.dashboard.ipsNone}):(0,t.jsx)("ul",{className:"network-list",children:r.map(e=>(0,t.jsxs)("li",{children:[(0,t.jsx)("span",{className:"network-symbol",children:(0,t.jsx)(c.gc,{icon:o.eGi,className:"w-4"})}),(0,t.jsxs)("div",{className:"network-identity",children:[(0,t.jsx)("code",{children:e.ip}),(0,t.jsx)("div",{children:e.asn?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("span",{className:"asn-tag",children:["AS",e.asn]}),(0,t.jsx)("span",{children:e.asn_name||a.dashboard.ipProviderUnavailable}),e.bloco&&(0,t.jsx)("span",{className:"asn-tag",children:e.bloco})]}):e.bloco?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"asn-tag",children:e.bloco}),(0,t.jsx)("span",{children:a.dashboard.ipSharedBlock})]}):(0,t.jsx)("span",{children:a.dashboard.ipAsnUnavailable})})]}),(0,t.jsx)("span",{className:`network-status ${F(e)?"is-active":"is-pending"}`,children:e.confirmed?U(e)?a.dashboard.ipExpired:a.dashboard.ipActive:a.dashboard.ipPending}),!e.confirmed&&(0,t.jsx)("button",{type:"button",disabled:w,className:"btn-ghost network-small-button",onClick:()=>{y(e.ip),v(""),_(null)},children:a.dashboard.ipEnterCode}),!!e.ever_confirmed&&U(e)&&(0,t.jsx)("button",{type:"button",disabled:w,className:"btn-ghost network-small-button",onClick:()=>void A({action:"renew",ip:e.ip}),children:a.dashboard.ipRenew}),(0,t.jsx)("button",{type:"button",onClick:()=>void P(e),disabled:w,className:"btn-ghost network-remove","aria-label":`${a.dashboard.ipRemove} ${e.confirmed&&e.asn?`AS${e.asn}`:e.confirmed&&e.bloco?e.bloco:e.ip}`,title:e.confirmed&&(e.asn||e.bloco)?a.dashboard.ipRemoveNetwork:a.dashboard.ipRemove,children:(0,t.jsx)(c.gc,{icon:o.yLS,className:"w-3"})})]},e.id))}),S&&(0,t.jsxs)("div",{className:`network-notice is-${S.kind}`,role:"error"===S.kind?"alert":"status",children:[(0,t.jsx)("span",{className:"network-notice-icon",children:(0,t.jsx)(c.gc,{icon:"sent"===S.kind?o.isI:"error"===S.kind?o.lEd:o.QRE,className:"w-4"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("strong",{children:"generic"===S.key?a.errors.generic:a.dashboard[S.key]}),"sent"===S.kind&&(0,t.jsx)("p",{children:a.dashboard.ipInboxHint})]})]}),N&&(0,t.jsxs)("form",{className:"network-confirm",onSubmit:async e=>{e.preventDefault(),await A({action:"confirm",ip:N,code:f})&&(y(""),v(""),_({key:"ipRenewed",kind:"success"}))},children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{htmlFor:`network-code-${e}`,children:a.dashboard.ipCodeLabel}),(0,t.jsx)("p",{children:I?.asn?`AS${I.asn} \xb7 ${I.asn_name}`:N})]}),(0,t.jsxs)("div",{className:"network-confirm-controls",children:[(0,t.jsx)("input",{id:`network-code-${e}`,value:f,onChange:e=>v(e.target.value.replace(/\D/g,"").slice(0,6)),placeholder:"000000",inputMode:"numeric",autoComplete:"one-time-code",maxLength:6,required:!0}),(0,t.jsx)("button",{disabled:w||6!==f.length,className:"btn-primary",children:w?(0,t.jsx)(c.gc,{icon:o.z1G,className:"w-3 animate-spin"}):a.dashboard.ipConfirm}),(0,t.jsx)("button",{type:"button",disabled:w,className:"btn-ghost",onClick:()=>void B(N),children:a.dashboard.ipResend})]}),(0,t.jsx)("p",{children:a.dashboard.ipConfirmHint})]}),(0,t.jsxs)("div",{className:"network-actions",children:[i&&(0,t.jsxs)("div",{className:"network-current",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>void B(i),disabled:w||C||G,className:"btn-ghost",children:[(0,t.jsx)(c.gc,{icon:G?o.QRE:o.isI,className:"w-3"}),G?a.dashboard.ipCurrentAuthorized:a.dashboard.ipAuthorizeCurrent]}),(0,t.jsxs)("span",{children:[(0,t.jsx)("code",{children:i}),u&&(0,t.jsxs)(t.Fragment,{children:[" \xb7 AS",u.asn," \xb7 ",u.name]})]})]}),(0,t.jsxs)("form",{className:"network-manual",onSubmit:e=>{e.preventDefault(),g.trim()&&B(g.trim())},children:[(0,t.jsx)("label",{className:"sr-only",htmlFor:`network-ip-${e}`,children:a.dashboard.ipOther}),(0,t.jsx)("input",{id:`network-ip-${e}`,value:g,onChange:e=>j(e.target.value),placeholder:a.dashboard.ipOtherNetwork}),(0,t.jsx)("button",{disabled:w||C||!g.trim(),className:"btn-ghost",children:a.dashboard.ipRequest})]})]}),O>=R&&R<E&&(0,t.jsxs)("div",{className:"network-upsell",children:[(0,t.jsx)("p",{children:s(a.dashboard.ipBuyBody,{limite:String(R)})}),(0,t.jsx)("a",{href:"/checkout?item=ip",className:"btn-ghost",children:a.dashboard.ipBuyCta})]})]})}var p=s(92040),u=s(62262),b=s(73321),g=s(5772),j=s(96921);s(27955);var f=s(4450),v=s(75121),N=s(28408),y=s(32539),w=s(59656),k=s(18662),S=s(1925),_=s(67389);function C({active:e,payload:a}){if(!e||!a?.length)return null;let s=a[0].payload,[r,n,i]=s.day.split("-");return(0,t.jsxs)("div",{className:"rounded-md border border-[var(--border-hover)] bg-[var(--surface-2)] px-3 py-2 shadow-xl shadow-black/50",children:[(0,t.jsxs)("p",{className:"mono-label mb-1",children:[i,"/",n,"/",r]}),(0,t.jsxs)("p",{className:"font-mono text-[13px] text-[var(--text)]",children:[s.messages," ",1===s.messages?"mensagem":"mensagens"]}),(0,t.jsxs)("p",{className:"font-mono text-[11px] text-[var(--text-muted)]",children:[s.tokens.toLocaleString("pt-BR")," tokens"]})]})}function $({data:e}){let a=Math.max(1,...e.map(e=>e.messages));return(0,t.jsx)("div",{className:"h-56 w-full",children:(0,t.jsx)(f.u,{width:"100%",height:"100%",children:(0,t.jsxs)(v.E,{data:e,margin:{top:8,right:4,bottom:0,left:-18},barCategoryGap:2,children:[(0,t.jsx)(N.d,{stroke:"rgba(255,255,255,0.05)",strokeDasharray:"2 4",vertical:!1}),(0,t.jsx)(y.W,{dataKey:"label",tick:{fill:"#4b5563",fontSize:10,fontFamily:"var(--font-mono)"},tickLine:!1,axisLine:{stroke:"rgba(255,255,255,0.06)"},interval:4}),(0,t.jsx)(w.h,{allowDecimals:!1,width:44,tick:{fill:"#4b5563",fontSize:10,fontFamily:"var(--font-mono)"},tickLine:!1,axisLine:!1,domain:[0,a]}),(0,t.jsx)(k.m,{content:(0,t.jsx)(C,{}),cursor:{fill:"rgba(255,255,255,0.03)"}}),(0,t.jsx)(S.y,{dataKey:"messages",radius:[4,4,0,0],isAnimationActive:!1,children:e.map(e=>(0,t.jsx)(_.f,{fill:e.messages>0?"#3a6df0":"rgba(58, 109, 240, 0.28)"},e.day))})]})})})}var R=s(92500),T=s(9726),E=s(91337);let L="https://ghostcli.cloud";function M(e){return e?e.split("-").reverse().join("/"):"—"}function D(){let{t:e,f:a}=(0,d.o)(),[s,r]=(0,l.useState)(null),[n,i]=(0,l.useState)(null),[h,x]=(0,l.useState)([]),[m,p]=(0,l.useState)(0),[u,b]=(0,l.useState)(0),[g,j]=(0,l.useState)(!0),[f,v]=(0,l.useState)(!1),[N,y]=(0,l.useState)(""),[w,k]=(0,l.useState)(""),[S,_]=(0,l.useState)(!1),[C,$]=(0,l.useState)(!1),R=async()=>{try{let e=await fetch("/api/affiliate"),a=await e.json();e.ok&&(r(a.code),i(a.randomCode||null),x(a.commissions||[]),p(a.total||0),b(a.referrals||0))}catch{}finally{j(!1)}};(0,l.useEffect)(()=>{R()},[]);let T=async()=>{v(!0),k("");try{let e=await fetch("/api/affiliate",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({code:N})}),a=await e.json();if(!e.ok)return void k(a.error);r(a.code),y("")}catch{k("Falha de rede.")}finally{v(!1)}},E=async()=>{if(s)try{await navigator.clipboard.writeText(`https://ghostcli.cloud/?ref=${s}`),_(!0),setTimeout(()=>_(!1),1800)}catch{}};return g?null:s?(0,t.jsx)("section",{className:"space-y-4 scroll-mt-20",children:(0,t.jsxs)("div",{className:"tech-card gx-aff space-y-5",children:[(0,t.jsxs)("div",{className:"gx-aff__head",children:[(0,t.jsx)("span",{className:"gx-aff__icon",children:(0,t.jsx)(c.gc,{icon:o.gdJ})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h2",{className:"font-heading text-lg font-semibold text-[var(--text)]",children:e.dashboard.affTitle}),(0,t.jsx)("p",{className:"text-[13px] text-[var(--text-muted)]",children:e.dashboard.affIntro.replace("{pct}","25%")})]})]}),(0,t.jsxs)("div",{className:"gx-aff__stats",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("span",{children:[(0,t.jsx)(c.gc,{icon:o.CQO}),e.dashboard.affSeuCodigo.replace(":","")]}),(0,t.jsx)("b",{className:"font-mono",children:s})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("span",{children:[(0,t.jsx)(c.gc,{icon:o.nWR}),1===u?e.dashboard.affIndicado:e.dashboard.affIndicados]}),(0,t.jsx)("b",{children:u})]}),(0,t.jsxs)("div",{"data-tone":"good",children:[(0,t.jsxs)("span",{children:[(0,t.jsx)(c.gc,{icon:o.iwP}),e.dashboard.affGanhos.replace(/^(?:R|US)\$\s*\{v\}\s*/,"")]}),(0,t.jsxs)("b",{children:["R$ ",m.toFixed(2).replace(".",",")]})]})]}),(0,t.jsxs)("div",{className:"gx-aff__links",children:[(0,t.jsx)("p",{className:"mono-label",children:e.dashboard.affSeuLink}),(0,t.jsxs)("div",{className:"gx-aff__link",children:[(0,t.jsxs)("code",{children:["https://ghostcli.cloud/?ref=",s]}),(0,t.jsxs)("button",{onClick:E,className:"btn-primary px-4 py-2 text-[13px] font-medium flex items-center gap-2",children:[(0,t.jsx)(c.gc,{icon:S?o.e68:o.jPR,className:"w-3 h-3"}),S?e.common.copied:e.common.copy]})]}),n&&(0,t.jsxs)("div",{className:"gx-aff__link",children:[(0,t.jsxs)("code",{children:["https://ghostcli.cloud/?r=",n]}),(0,t.jsxs)("button",{onClick:async()=>{try{await navigator.clipboard.writeText(`https://ghostcli.cloud/?r=${n}`),$(!0),setTimeout(()=>$(!1),1800)}catch{}},className:"btn-ghost px-4 py-2 text-[13px] font-medium flex items-center gap-2",children:[(0,t.jsx)(c.gc,{icon:C?o.e68:o.jPR,className:"w-3 h-3"}),C?e.common.copied:e.common.copy]})]})]}),h.length>0?(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("p",{className:"text-[13px] font-medium text-[var(--text)]",children:"\xdaltimas comiss\xf5es"}),(0,t.jsx)("div",{className:"divide-y divide-[var(--border)]",children:h.map(e=>(0,t.jsxs)("div",{className:"flex items-center justify-between py-2 text-[13px]",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-[var(--text-2)]",children:e.user_name||e.user_email}),(0,t.jsx)("p",{className:"text-[11px] text-[var(--text-muted)]",children:M(e.created_at.slice(0,10))})]}),(0,t.jsxs)("div",{className:"text-right",children:[(0,t.jsxs)("p",{className:"text-[var(--text)]",children:["R$ ",e.commission_brl.toFixed(2)]}),(0,t.jsxs)("p",{className:"text-[11px] text-[var(--text-dimmed)]",children:["Venda: R$ ",e.amount_brl.toFixed(2)]})]})]},e.id))})]}):(0,t.jsx)("p",{className:"text-[13px] text-[var(--text-dimmed)] text-center py-4",children:e.dashboard.affSemComissao})]})}):(0,t.jsx)("section",{className:"space-y-4 scroll-mt-20",children:(0,t.jsxs)("div",{className:"tech-card p-5 space-y-4",children:[(0,t.jsx)("div",{className:"flex items-start justify-between gap-4",children:(0,t.jsxs)("div",{children:[(0,t.jsx)("h2",{className:"font-heading text-lg font-semibold text-[var(--text)]",children:e.dashboard.affTitle}),(0,t.jsxs)("p",{className:"text-[13px] text-[var(--text-muted)]",children:[e.dashboard.affIntro.replace("{pct}","25%"),e.dashboard.affLinkAtivo]})]})}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)("input",{value:N,onChange:e=>y(e.target.value),placeholder:e.dashboard.affCodePh,className:"field w-48 py-1.5 text-[13px]"}),(0,t.jsx)("button",{onClick:T,disabled:f,className:"btn-primary px-4 py-1.5 rounded-md text-sm font-medium",children:f?e.dashboard.affCreating:e.dashboard.affCreate})]}),w&&(0,t.jsx)("p",{className:"text-[12px] text-[var(--bad)]",children:w})]})})}let A={blue:{ink:"#7b9bff",tint:"rgba(58,109,240,.14)",glow:"rgba(58,109,240,.18)"},green:{ink:"#4ade80",tint:"rgba(34,197,94,.13)",glow:"rgba(34,197,94,.14)"},amber:{ink:"#fbbf24",tint:"rgba(245,158,11,.13)",glow:"rgba(245,158,11,.12)"},violet:{ink:"#a5b4fc",tint:"rgba(99,102,241,.14)",glow:"rgba(99,102,241,.16)"}};function B({label:e,value:a,hint:s,accent:r,icon:n,tom:i="blue"}){let d=A[i];return(0,t.jsxs)("div",{className:"tech-card gx-stat",style:{"--gx-ink":d.ink,"--gx-tint":d.tint,"--gx-glow":d.glow},children:[(0,t.jsxs)("div",{className:"gx-stat__top",children:[(0,t.jsx)("p",{className:"mono-label",children:e}),(0,t.jsx)("span",{className:"gx-stat__icon",children:(0,t.jsx)(c.gc,{icon:n})})]}),(0,t.jsx)("p",{className:"gx-stat__value",style:{color:r||"var(--text)"},children:a}),s&&(0,t.jsx)("p",{className:"gx-stat__hint",children:s})]})}function P(){let e,a,s,{t:n,f:h,language:x}=(0,d.o)(),f=(0,p.lA)(x),v=(0,b.useRouter)(),{me:N,loading:y,refresh:w}=(0,T.A)(),[k,S]=(0,l.useState)(null),[_,C]=(0,l.useState)([]),[A,P]=(0,l.useState)(0),[U,F]=(0,l.useState)(null),[O,G]=(0,l.useState)(""),[I,z]=(0,l.useState)(""),[q,J]=(0,l.useState)(!1),[H,W]=(0,l.useState)(!1),[K,Z]=(0,l.useState)(!1),[V,Q]=(0,l.useState)(!1);(0,l.useEffect)(()=>{let e=new URLSearchParams(window.location.search);if("processing"!==e.get("payment"))return;let a=!0,s=0;Q(!0);let t=async()=>{s++;try{let s=await fetch("/api/pay/whop/check",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({reference:e.get("ref")||void 0})}),t=await s.json();if(!a)return;if(t?.paid){await w(),Q(!1),window.history.replaceState({},"","/dashboard");return}}catch{}if(a){if(s>=12)return void Q(!1);setTimeout(t,5e3)}};return t(),()=>{a=!1}},[]);let X=N?.user?.plan||"free",Y=N?.subscription??null,ee=!!Y&&["active","trialing","past_due","canceling"].includes(Y.status),ea=Y?.gateway==="whop",es=async e=>{J(!0),z("");try{let a=await fetch("/api/subscription",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:e})}),s=await a.json().catch(()=>({}));a.ok||z(s.error||n.errors.generic),await w()}catch{z(n.errors.generic)}finally{J(!1)}},et=!!N?.api?.active,er=N?.api?.until??N?.user?.apiAccessUntil??null,en=er?Math.max(0,Math.ceil((new Date(`${er}T23:59:59Z`).getTime()-Date.now())/864e5)):null,ei=new Date().toISOString().slice(0,10),ed=N?.user?.planRenewsAt??null,el="free"!==X&&!!ed&&ed<ei,ec="free"!==X&&!!er&&er<ei,eo=ed&&!el?Math.round((new Date(`${ed}T00:00:00Z`).getTime()-new Date(`${ei}T00:00:00Z`).getTime())/864e5):null,eh="free"!==X&&null!==eo&&eo>=1&&eo<=7,ex=!!Y&&["active","trialing"].includes(Y.status),em=!!Y&&"past_due"===Y.status;(0,l.useEffect)(()=>{y||N?.user||v.push("/login")},[y,N,v]);let ep=(0,l.useCallback)(async()=>{let[e,a]=await Promise.all([fetch("/api/usage",{cache:"no-store"}).then(e=>e.json()),fetch("/api/keys",{cache:"no-store"}).then(e=>e.json())]);e.error||S({...e,byModel:function(e){let a=new Map;for(let s of e){let e=(0,u.E1)(s.id),t=e?.id??s.id,r=a.get(t);r?(r.messages+=s.messages,r.tokens+=s.tokens,r.marketUsd+=s.marketUsd):a.set(t,{...s,id:t,name:e?.name??s.name,provider:e?.provider??s.provider})}return[...a.values()].sort((e,a)=>a.messages-e.messages)}(e.byModel||[])}),a.error||(C(a.keys),P(a.max))},[]);(0,l.useEffect)(()=>{N?.user&&ep()},[N,ep]);let eu=async e=>{if("free"!==e)return void v.push(`/checkout?plan=${e}`);if(window.confirm(n.dashboard.cancelConfirm)){J(!0),z("");try{let e=await fetch("/api/plan",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({plan:"free"})}),a=await e.json();if(!e.ok)return void z(a.error||n.dashboard.cancelFailed);await w(),await ep()}finally{J(!1)}}},eb=async()=>{J(!0),z("");try{let e=await fetch("/api/keys",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({name:O||n.dashboard.keyUnnamed})}),a=await e.json();if(!e.ok)return void z(a.error||n.dashboard.keyCreateFailed);F(a.key),C(a.keys),G("")}finally{J(!1)}},eg=async e=>{let a=_.find(a=>a.id===e);if(!window.confirm(h(n.dashboard.keyRevokeConfirm,{prefix:a?.prefix??""})))return;let s=await fetch(`/api/keys?id=${e}`,{method:"DELETE"}),t=await s.json();s.ok&&C(t.keys)},ej=async()=>{U&&(await navigator.clipboard.writeText(U),W(!0),setTimeout(()=>W(!1),2e3))};if(y||!N?.user)return(0,t.jsx)(r.V,{});let ef=k?.totals,ev="BRL"===f?"pt-BR":"en-US",eN=Math.max(1,...(k?.byModel||[]).map(e=>e.messages)),ey=(ef?.tokens_in||0)+(ef?.tokens_out||0);return(0,t.jsxs)("div",{className:"gx-app design-page dashboard-page min-h-screen bg-[var(--bg)]",children:[(0,t.jsx)(j.R,{}),(0,t.jsxs)("main",{className:"tb-grade py-8 space-y-10",children:[(em||!ex&&(el||eh)||!ex&&ec)&&(0,t.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3 rounded-xl border px-4 py-3 "+(em||el?"border-[var(--bad)]/40 bg-[var(--bad-muted)]":"border-[var(--warn)]/30 bg-[var(--warn-muted)]"),children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 min-w-0",children:[(0,t.jsx)(c.gc,{icon:o.JAe,className:"w-4 h-4 shrink-0 "+(em||el?"text-[var(--bad)]":"text-[var(--warn)]")}),(0,t.jsx)("p",{className:"text-[14px] text-[var(--text)]",children:em?n.dashboard.recorrenteFalhou:el?n.dashboard.planExpiredBanner:eh?1===eo?n.dashboard.planExpiringBannerOne:h(n.dashboard.planExpiringBanner,{dias:String(eo)}):n.dashboard.apiExpiredBanner})]}),(0,t.jsx)(i(),{href:em?Y.manageUrl||`/checkout?plan=${X}&addon=1`:el||eh?`/checkout?plan=${X}&addon=1`:"/checkout?item=api",className:"shrink-0 rounded-md px-4 py-2 text-sm font-semibold transition-opacity hover:opacity-90 "+(em||el?"bg-[var(--bad)] text-white":"bg-[var(--warn)] text-[#1a1205]"),children:em?n.dashboard.updateCard:el?n.dashboard.renewNow:eh?n.dashboard.renewPlan:n.dashboard.renewApi})]}),(0,t.jsxs)("div",{className:"dashboard-welcome flex flex-wrap items-end justify-between gap-4",children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("h1",{className:"font-heading text-2xl font-bold tracking-tight text-[var(--text)]",children:h(n.dashboard.greeting,{name:N.user.name.split(" ")[0]})}),(0,t.jsxs)("p",{className:"text-sm text-[var(--text-muted)]",children:[h(n.dashboard.planLine,{plan:X}),N.user.planRenewsAt&&` \xb7 ${h(n.dashboard.renewsAt,{date:(0,E.Xd)(N.user.planRenewsAt,"BRL"===f?"pt-BR":"en-US")})}`]})]}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsxs)(i(),{href:"/docs",className:"btn-ghost px-3 py-2 rounded-md text-[13px] font-medium flex items-center gap-2",children:[(0,t.jsx)(c.gc,{icon:o.LBj,className:"w-3 h-3"}),n.dashboard.tutorials]}),(0,t.jsxs)(i(),{href:"/afiliados",className:"btn-ghost px-3 py-2 rounded-md text-[13px] font-medium flex items-center gap-2",children:[(0,t.jsx)(c.gc,{icon:o.gdJ,className:"w-3 h-3"}),n.dashboard.affiliatesLink]}),(0,t.jsxs)(i(),{href:"/chat",className:"btn-primary px-4 py-2 rounded-md text-sm font-medium flex items-center gap-2",children:[n.dashboard.openChat,(0,t.jsx)(c.gc,{icon:o.dmS,className:"w-3 h-3"})]})]})]}),(0,t.jsxs)("section",{id:"overview",className:"dashboard-stats grid gap-3 sm:grid-cols-2 lg:grid-cols-4",children:[(0,t.jsx)(B,{label:n.dashboard.statMessagesToday,icon:o.q9p,value:String(N.usage?.today??0),hint:N.usage?.remaining==null?n.dashboard.hintUnlimited:`${N.usage.remaining} restantes no plano Free`,accent:"var(--accent)"}),(0,t.jsx)(B,{label:n.dashboard.statMessagesTotal,icon:o.gK3,tom:"green",value:(ef?.messages??0).toLocaleString("pt-BR"),hint:n.dashboard.hintSinceStart}),(0,t.jsx)(B,{label:n.dashboard.statTokens,icon:o.zm_,tom:"amber",value:(0,E.Gy)(ey),hint:n.dashboard.hintTokens}),(0,t.jsx)(B,{label:n.dashboard.statModels,icon:o.qIE,tom:"violet",value:String(k?.byModel.length??0),hint:n.dashboard.hintModels})]}),(0,t.jsx)("section",{className:"glow-card",children:(0,t.jsxs)("div",{className:"p-5 sm:p-6 flex flex-wrap items-start gap-5",children:[(0,t.jsxs)("div",{className:"shrink-0 flex items-center gap-2.5 p-2.5 rounded-xl surface-2 border border-[var(--border)]",children:[(0,t.jsx)(g.default,{src:"/logos/claude-code.png",alt:"",width:28,height:28,className:"w-7 h-7"}),(0,t.jsx)("span",{className:"w-px h-6 bg-[var(--border)]","aria-hidden":!0}),(0,t.jsx)(g.default,{src:"/logos/codex.png",alt:"",width:28,height:28,className:"w-7 h-7"})]}),(0,t.jsxs)("div",{className:"flex-1 min-w-[220px] space-y-2",children:[(0,t.jsx)("span",{className:"mono-eyebrow",children:n.dashboard.docsEyebrow}),(0,t.jsx)("h2",{className:"font-heading text-xl font-bold text-[var(--text)]",children:n.dashboard.docsTitle}),(0,t.jsx)("p",{className:"text-[13.5px] text-[var(--text-muted)] leading-relaxed max-w-xl",children:n.dashboard.docsBody}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2 pt-1",children:[(0,t.jsxs)(i(),{href:"/docs",className:"btn-primary px-4 py-2 rounded-md text-sm font-medium flex items-center gap-2",children:[(0,t.jsx)(c.gc,{icon:o.LBj,className:"w-3 h-3"}),n.dashboard.docsOpen]}),(0,t.jsxs)(i(),{href:"/docs#inicio",className:"btn-ghost px-3 py-2 rounded-md text-[13px] flex items-center gap-2",children:[(0,t.jsx)(c.gc,{icon:o.bMg,className:"w-3 h-3"}),n.dashboard.docsGenerator]}),(0,t.jsxs)(i(),{href:"/docs#erros",className:"btn-ghost px-3 py-2 rounded-md text-[13px] flex items-center gap-2",children:[(0,t.jsx)(c.gc,{icon:o.wG0,className:"w-3 h-3"}),n.dashboard.docsErrors]})]})]})]})}),I&&(0,t.jsxs)("div",{className:"flex items-start gap-2.5 p-3 rounded-md border border-[var(--bad)]/30 bg-[var(--bad-muted)] text-[13px] text-[var(--text-2)]",children:[(0,t.jsx)(c.gc,{icon:o.lEd,className:"w-3.5 h-3.5 mt-0.5 text-[var(--bad)]"}),I]}),(0,t.jsxs)("section",{className:"tech-card p-5 space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-baseline justify-between gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h2",{className:"text-[15px] font-medium text-[var(--text)]",children:n.dashboard.chartTitle}),(0,t.jsx)("p",{className:"text-[12px] text-[var(--text-muted)]",children:n.dashboard.chartSubtitle})]}),(0,t.jsx)("span",{className:"mono-label",children:h(n.dashboard.chartPeriod,{n:(k?.daily||[]).reduce((e,a)=>e+a.messages,0)})})]}),k?(0,t.jsx)($,{data:k.daily}):(0,t.jsx)("div",{className:"h-56 shimmer rounded-md"})]}),(0,t.jsxs)("section",{className:"tech-card p-5 space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h2",{className:"text-[15px] font-medium text-[var(--text)]",children:n.dashboard.savedTitle}),(0,t.jsx)("p",{className:"text-[12px] text-[var(--text-muted)]",children:n.dashboard.savedSubtitle})]}),k&&k.marketUsdTotal>0?(e="BRL"===f?5.4*k.marketUsdTotal:k.marketUsdTotal,s=Math.max(0,e-(a=(0,p.id)((0,u.U7)(N.user.plan),f))),(0,t.jsxs)("div",{className:"gx-save",children:[(0,t.jsxs)("div",{className:"gx-save__hero",children:[(0,t.jsx)("p",{className:"mono-label",children:n.dashboard.savedDiff}),(0,t.jsx)("strong",{children:(0,p.TG)(s,f)}),a>0&&e>a&&(0,t.jsx)("span",{className:"gx-save__ratio",children:h(n.calc.cheaper,{n:(e/a).toLocaleString(ev,{maximumFractionDigits:e/a>=100?0:1})})})]}),(0,t.jsxs)("div",{className:"gx-save__bars",children:[(0,t.jsxs)("div",{"data-tone":"bad",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{children:n.dashboard.savedMarket}),(0,t.jsx)("b",{children:(0,p.TG)(e,f)})]}),(0,t.jsx)("i",{children:(0,t.jsx)("em",{style:{width:"100%"}})})]}),(0,t.jsxs)("div",{"data-tone":"good",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{children:n.dashboard.savedPlan}),(0,t.jsx)("b",{children:(0,p.TG)(a,f)})]}),(0,t.jsx)("i",{children:(0,t.jsx)("em",{style:{width:`${Math.max(1.5,a/Math.max(e,1)*100)}%`}})})]})]}),(0,t.jsx)("ul",{className:"gx-save__list",children:k.byModel.filter(e=>e.marketUsd>0).map(e=>{let a=(0,u.E1)(e.id),s="BRL"===f?5.4*e.marketUsd:e.marketUsd;return(0,t.jsxs)("li",{children:[a?(0,t.jsx)(R.ProviderMark,{provider:a.provider,size:"sm"}):(0,t.jsx)("span",{className:"gx-model-unknown",children:(0,t.jsx)(c.gc,{icon:o.br3})}),(0,t.jsx)("span",{className:"gx-save__name",children:e.name}),(0,t.jsxs)("span",{className:"gx-save__tok",children:[(0,E.Gy)(e.tokens)," tokens"]}),(0,t.jsx)("b",{children:(0,p.TG)(s,f)})]},e.id)})})]})):(0,t.jsx)("p",{className:"text-[13px] text-[var(--text-dimmed)]",children:n.dashboard.savedNone})]}),(0,t.jsxs)("section",{className:"tech-card p-5 space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h2",{className:"text-[15px] font-medium text-[var(--text)]",children:n.dashboard.byModelTitle}),(0,t.jsx)("p",{className:"text-[12px] text-[var(--text-muted)]",children:n.dashboard.byModelSubtitle})]}),k&&k.byModel.length>0?(0,t.jsx)("ol",{className:"gx-usage",children:k.byModel.map((e,a)=>{let s=(0,u.E1)(e.id),r=k.byModel.reduce((e,a)=>e+a.messages,0)||1,i=e.messages/r*100;return(0,t.jsxs)("li",{children:[(0,t.jsx)("span",{className:"gx-usage__rank",children:a+1}),s?(0,t.jsx)(R.ProviderMark,{provider:s.provider,size:"md"}):(0,t.jsx)("span",{className:"gx-model-unknown gx-model-unknown--md",children:(0,t.jsx)(c.gc,{icon:o.br3})}),(0,t.jsxs)("div",{className:"gx-usage__body",children:[(0,t.jsxs)("div",{className:"gx-usage__top",children:[(0,t.jsx)("b",{children:e.name}),(0,t.jsxs)("span",{children:[i<.1?"<0,1":i.toLocaleString(ev,{maximumFractionDigits:1}),"%"]})]}),(0,t.jsx)("div",{className:"gx-usage__bar",children:(0,t.jsx)("i",{style:{width:`${Math.max(1,e.messages/eN*100)}%`}})}),(0,t.jsx)("small",{children:h(n.dashboard.byModelLine,{n:e.messages.toLocaleString(ev),word:1===e.messages?n.dashboard.messageOne:n.dashboard.messageMany,tokens:(0,E.Gy)(e.tokens)})})]})]},e.id)})}):(0,t.jsx)("p",{className:"py-6 text-center text-[13px] text-[var(--text-dimmed)]",children:"Ainda n\xe3o h\xe1 uso registrado. Comece uma conversa no chat."})]}),(0,t.jsxs)("section",{id:"plano",className:"space-y-4 scroll-mt-20",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h2",{className:"font-heading text-lg font-semibold text-[var(--text)]",children:n.dashboard.planSection}),(0,t.jsx)("p",{className:"text-[13px] text-[var(--text-muted)]",children:n.dashboard.planSectionHint})]}),(0,t.jsx)("div",{className:"gx-plans",children:u.NB.map(e=>{let a=(0,p.Dj)(e,N.user,f),s=a.atual||e.id===X,r=a.upgrade,i=a.inferior;return(0,t.jsxs)("div",{className:"gx-plan","data-active":s,"data-inferior":i,children:[(0,t.jsxs)("div",{className:"gx-plan__head",children:[(0,t.jsx)("p",{children:e.name}),s&&(0,t.jsx)("span",{className:"gx-plan__badge",children:n.dashboard.planBadgeCurrent})]}),(0,t.jsxs)("p",{className:"gx-plan__price",children:[(0,p.TG)(a.amount,f),(0,t.jsx)("span",{children:n.dashboard.perMonthShort})]}),(0,t.jsx)("ul",{className:"gx-plan__list",children:(n.plans_content[e.id]?.features??e.features).slice(0,3).map(e=>(0,t.jsxs)("li",{children:[(0,t.jsx)(c.gc,{icon:o.e68}),e]},e))}),(0,t.jsx)("button",{onClick:()=>eu(e.id),disabled:s||q||i,className:`gx-plan__cta ${!s&&!i&&r?"btn-primary":"btn-ghost"}`,children:s?n.dashboard.planCurrent:0===e.priceBrl?n.dashboard.planBackToFree:i?n.dashboard.planNoDowngrade:r?n.dashboard.planUpgradeTo:h(n.dashboard.planSubscribe,{plan:e.name})})]},e.id)})}),(0,t.jsxs)("div",{className:"gx-note",children:[(0,t.jsx)(c.gc,{icon:o.mEO}),(0,t.jsx)("span",{children:n.dashboard.paymentNotice})]})]}),ee&&(0,t.jsxs)("section",{id:"assinatura",className:"space-y-4 scroll-mt-20",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h2",{className:"font-heading text-lg font-semibold text-[var(--text)]",children:n.dashboard.subSection}),(0,t.jsx)("p",{className:"text-[13px] text-[var(--text-muted)]",children:h(n.dashboard.subHint,{gateway:ea?"Whop":"Stripe"})})]}),(0,t.jsxs)("div",{className:"tech-card p-5 flex flex-wrap items-center gap-4",children:[(0,t.jsx)("span",{className:"w-10 h-10 rounded-lg surface-2 border border-[var(--border)] flex items-center justify-center shrink-0",children:ea?(0,t.jsx)(g.default,{src:"/logos/whop.png",alt:"Whop",width:18,height:18,className:"w-[18px] h-[18px] object-contain"}):(0,t.jsx)(g.default,{src:"/logos/stripe.svg",alt:"Stripe",width:18,height:18,className:"w-[18px] h-[18px] object-contain"})}),(0,t.jsxs)("div",{className:"flex-1 min-w-[200px] space-y-1",children:[(0,t.jsx)("p",{className:"mono-label",style:{color:Y.cancelAtPeriodEnd?"var(--warn)":"past_due"===Y.status?"var(--bad)":"var(--good)"},children:"past_due"===Y.status?h(n.dashboard.subPastDue,{gateway:ea?"Whop":"Stripe"}):Y.cancelAtPeriodEnd?h(n.dashboard.subCanceling,{date:Y.currentPeriodEnd?M(Y.currentPeriodEnd):"—"}):h(n.dashboard.subActive,{date:Y.currentPeriodEnd?M(Y.currentPeriodEnd):"—"})}),(0,t.jsxs)("p",{className:"text-[12.5px] text-[var(--text-muted)]",children:[ea?"Whop":"Stripe"," \xb7 ",Y.addon?n.dashboard.subWithAddon:n.dashboard.subPlanOnly]})]}),Y.cancelAtPeriodEnd?(0,t.jsxs)("button",{onClick:()=>void es("resume"),disabled:q,className:"btn-primary px-4 py-2 rounded-md text-sm font-medium flex items-center gap-2 whitespace-nowrap disabled:opacity-50",children:[(0,t.jsx)(c.gc,{icon:o.BF2,className:"w-3 h-3"}),n.dashboard.subResume]}):(0,t.jsxs)("button",{onClick:()=>{let e=Y.currentPeriodEnd?M(Y.currentPeriodEnd):"—";window.confirm(h(n.dashboard.subCancelConfirm,{date:e}))&&es("cancel")},disabled:q,className:"btn-ghost px-4 py-2 rounded-md text-sm flex items-center gap-2 whitespace-nowrap disabled:opacity-50",children:[(0,t.jsx)(c.gc,{icon:o.Dfk,className:"w-3 h-3"}),n.dashboard.subCancel]})]}),(0,t.jsx)("p",{className:"text-[12px] text-[var(--text-dimmed)]",children:n.dashboard.subOneOff})]}),(0,t.jsxs)("section",{id:"api",className:"space-y-4 scroll-mt-20",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h2",{className:"font-heading text-lg font-semibold text-[var(--text)]",children:n.dashboard.apiSection}),(0,t.jsx)("p",{className:"text-[13px] text-[var(--text-muted)]",children:n.dashboard.apiSectionHint})]}),(0,t.jsxs)("div",{className:`tech-card p-5 flex flex-wrap items-center gap-4 ${et?"border-[var(--primary)]/40 bg-[var(--primary)]/[0.04]":""}`,children:[(0,t.jsxs)("div",{className:"flex gap-2 shrink-0",children:[(0,t.jsx)(g.default,{src:"/logos/claude-code.png",alt:"",width:26,height:26,className:"w-[26px] h-[26px]"}),(0,t.jsx)(g.default,{src:"/logos/codex.png",alt:"",width:26,height:26,className:"w-[26px] h-[26px]"})]}),(0,t.jsxs)("div",{className:"flex-1 min-w-[200px] space-y-1",children:[(0,t.jsxs)("p",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)("span",{className:"mono-label",style:{color:et?"var(--good)":er?"var(--bad)":"var(--warn)"},children:et?h(n.dashboard.apiActive,{date:M(er)}):er?h(n.dashboard.apiExpired,{date:M(er)}):n.dashboard.apiNever}),et&&null!=en&&(0,t.jsx)("span",{className:"text-[12px] text-[var(--text-dimmed)]",children:h(n.dashboard.apiDaysLeft,{n:en})})]}),(0,t.jsx)("p",{className:"text-[12.5px] text-[var(--text-muted)] leading-relaxed",children:h(n.dashboard.apiWhat,{endpoints:"/v1/messages \xb7 /v1/responses \xb7 /v1/chat/completions"})})]}),"free"===X?(0,t.jsx)("span",{className:"text-[12.5px] text-[var(--text-dimmed)]",children:n.dashboard.apiNeedsPlan}):(0,t.jsxs)(i(),{href:"/checkout?item=api",className:`px-4 py-2 rounded-md text-sm font-medium flex items-center gap-2 whitespace-nowrap ${et?"btn-ghost":"btn-primary"}`,children:[(0,t.jsx)(c.gc,{icon:er?o.BF2:o.qtl,className:"w-3 h-3"}),h(et?n.dashboard.apiExtend:er?n.dashboard.apiRenew:n.dashboard.apiBuy,{price:(0,p.TG)((0,p.b7)(f),f)})]})]})]}),(0,t.jsx)(D,{}),(0,t.jsxs)("section",{id:"chaves",className:"space-y-4 scroll-mt-20",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-end justify-between gap-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h2",{className:"font-heading text-lg font-semibold text-[var(--text)]",children:n.dashboard.keysSection}),(0,t.jsx)("p",{className:"text-[13px] text-[var(--text-muted)]",children:0===A?n.dashboard.keysProHint:h(n.dashboard.keysCount,{n:_.length,max:A})})]}),A>0&&(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)("input",{value:O,onChange:e=>G(e.target.value),placeholder:n.dashboard.keyNameField,className:"field w-44 py-1.5 text-[13px]"}),(0,t.jsxs)("button",{onClick:eb,disabled:q||_.length>=A,className:"btn-primary px-3 py-1.5 rounded-md text-sm font-medium flex items-center gap-2 whitespace-nowrap",children:[(0,t.jsx)(c.gc,{icon:o.QLR,className:"w-3 h-3"}),n.dashboard.keyGenerate]})]})]}),A>0&&(0,t.jsxs)("div",{className:"p-3 rounded-md surface-2 border border-[var(--border)] flex items-center gap-3",children:[(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("p",{className:"mono-label text-[var(--text-muted)]",children:n.dashboard.gatewayLabel}),(0,t.jsx)("code",{className:"block font-mono text-[13px] text-[var(--text)] truncate",children:L})]}),(0,t.jsxs)("button",{onClick:async()=>{try{await navigator.clipboard.writeText(L),Z(!0),setTimeout(()=>Z(!1),1800)}catch{}},className:"px-3 py-1.5 rounded-md text-[13px] font-medium surface border border-[var(--border)] hover:border-[var(--primary)]/40 transition-colors flex items-center gap-2 whitespace-nowrap",children:[(0,t.jsx)(c.gc,{icon:K?o.e68:o.jPR,className:`w-3 h-3 ${K?"text-[var(--good)]":""}`}),K?n.dashboard.gatewayCopied:n.common.copy]})]}),U&&(0,t.jsxs)("div",{className:"p-4 rounded-md border border-[var(--good)]/30 bg-[var(--good-muted)] space-y-2",children:[(0,t.jsx)("p",{className:"mono-label text-[var(--good)]",children:n.dashboard.keyCopyNow}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("code",{className:"flex-1 font-mono text-[12.5px] text-[var(--text)] break-all",children:U}),(0,t.jsx)("button",{onClick:ej,className:"btn-ghost px-2.5 py-1.5 rounded-md shrink-0",title:n.common.copy,children:(0,t.jsx)(c.gc,{icon:H?o.e68:o.jPR,className:"w-3 h-3"})})]})]}),(0,t.jsx)("div",{className:"tech-card divide-y divide-[var(--border)]",children:0===_.length?(0,t.jsx)("p",{className:"p-6 text-center text-[13px] text-[var(--text-dimmed)]",children:0===A?n.dashboard.keysProOnly:"{t.dashboard.keysNone}"}):_.map(e=>(0,t.jsxs)("div",{className:"p-3.5",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"w-8 h-8 rounded-md surface-2 flex items-center justify-center shrink-0",children:(0,t.jsx)(c.gc,{icon:o.bMg,className:"w-3 h-3 text-[var(--text-muted)]"})}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("p",{className:"text-[13.5px] text-[var(--text-2)] truncate",children:e.name}),(0,t.jsxs)("p",{className:"mono-label",children:[e.prefix,"••••••••• \xb7"," ",h(n.dashboard.keyCreatedAt,{date:(0,E.Xd)(e.created_at,"BRL"===f?"pt-BR":"en-US")})]})]}),(0,t.jsx)("button",{onClick:()=>eg(e.id),className:"p-2 rounded-md text-[var(--text-muted)] hover:text-[var(--bad)] hover:bg-[var(--surface-2)] transition-colors",title:n.dashboard.keyRevoke,children:(0,t.jsx)(c.gc,{icon:o.yLS,className:"w-3 h-3"})})]}),(0,t.jsx)(m,{keyId:e.id})]},e.id))})]}),(0,t.jsxs)("section",{className:"space-y-4",children:[(0,t.jsx)("h2",{className:"font-heading text-lg font-semibold text-[var(--text)]",children:n.dashboard.accountSection}),(0,t.jsx)("div",{className:"tech-card divide-y divide-[var(--border)]",children:[{label:n.dashboard.accountName,value:N.user.name},{label:n.dashboard.accountEmail,value:N.user.email},{label:n.dashboard.accountSince,value:(0,E.Xd)(N.user.createdAt,"BRL"===f?"pt-BR":"en-US")}].map(e=>(0,t.jsxs)("div",{className:"flex items-center justify-between gap-4 p-3.5",children:[(0,t.jsx)("span",{className:"mono-label",children:e.label}),(0,t.jsx)("span",{className:"text-[13.5px] text-[var(--text-2)] truncate",children:e.value})]},e.label))})]})]})]})}},88798:(e,a,s)=>{"use strict";s.d(a,{V:()=>i});var t=s(95155),r=s(31610),n=s(92584);function i(){return(0,t.jsxs)("div",{className:"gl-load",role:"status","aria-label":"Carregando",children:[(0,t.jsxs)("div",{className:"gl-load__mark",children:[(0,t.jsx)("span",{className:"gl-load__glow","aria-hidden":"true"}),(0,t.jsx)("span",{className:"gl-load__tile",children:(0,t.jsx)(r.gc,{icon:n.r29})})]}),(0,t.jsxs)("p",{className:"gl-load__word","aria-hidden":"true",children:["Ghost",(0,t.jsx)("b",{children:"CLI"})]}),(0,t.jsx)("span",{className:"gl-load__bar","aria-hidden":"true",children:(0,t.jsx)("i",{})})]})}s(91015)},91015:()=>{},91337:(e,a,s)=>{"use strict";function t(e){return`R$ ${e.toFixed(2).replace(".",",")}`}function r(e){return`$${e.toFixed(2)}`}function n(e){return e<1e3?String(e):e<1e6?`${(e/1e3).toFixed(1).replace(".",",")}k`:e<1e9?`${(e/1e6).toFixed(1).replace(".",",")}M`:`${(e/1e9).toFixed(1).replace(".",",")}B`}function i(e,a,s="pt-BR"){let t=new Date(e.includes("T")?e:e.replace(" ","T")+"Z").getTime(),r=Math.floor((Date.now()-t)/6e4),n=(e,a)=>e.replace("{n}",String(a));if(r<1)return a.timeNow;if(r<60)return n(a.timeMinutes,r);let d=Math.floor(r/60);if(d<24)return n(a.timeHours,d);let l=Math.floor(d/24);return 1===l?a.timeYesterday:l<7?n(a.timeDays,l):new Date(t).toLocaleDateString(s,{day:"2-digit",month:"short"})}function d(e,a){return new Date(10===e.length?e+"T00:00:00Z":e).toLocaleDateString(a,{day:"2-digit",month:"2-digit",year:"numeric"})}s.d(a,{Gy:()=>n,Jf:()=>t,Xd:()=>d,dR:()=>r,fF:()=>i})},92040:(e,a,s)=>{"use strict";s.d(a,{Dj:()=>c,TG:()=>l,b7:()=>i,id:()=>n,lA:()=>r,wF:()=>d});var t=s(62262);function r(e){return"en"===e?"USD":"BRL"}function n(e,a){return"USD"===a?e.priceUsd:e.priceBrl}function i(e){return"USD"===e?t.Kf.priceUsd:t.Kf.priceBrl}function d(e){return"USD"===e?t.V$.priceUsd:t.V$.priceBrl}function l(e,a){let s=new Intl.NumberFormat("USD"===a?"en-US":"pt-BR",{style:"currency",currency:a,minimumFractionDigits:2,maximumFractionDigits:2}).format(e);return"USD"===a?`${s} USD`:s}function c(e,a,s){let r=n(e,s),i=a?(0,t.fj)({plan:a.plan??"free",plan_renews_at:a.planRenewsAt??null}):"free",d=t.R3[i]??0,l=t.R3[e.id]??0,c=d>0,o=i===e.id,h=c&&l>d,x="USD"===s?t.Kf.priceUsd:0;return{atual:o,upgrade:h,inferior:c&&l<d,amount:h?Math.max(.01,r+x-(n((0,t.U7)(i),s)+x)):r}}},92500:(e,a,s)=>{"use strict";s.d(a,{ProviderMark:()=>i});var t=s(95155),r=s(62262);let n={sm:{box:"w-6 h-6 rounded-[5px]",icon:13},md:{box:"w-8 h-8 rounded-md",icon:17},lg:{box:"w-10 h-10 rounded-lg",icon:21}};function i({provider:e,size:a="md"}){let s=r.xq[e],d=n[a];return(0,t.jsx)("div",{className:`${d.box} flex items-center justify-center shrink-0 border`,style:{color:s.color,backgroundColor:`${s.color}14`,borderColor:`${s.color}33`},title:s.label,role:"img","aria-label":s.label,children:(0,t.jsx)("span",{className:"icon-mask",style:{width:d.icon,height:d.icon,WebkitMaskImage:`url(${s.logo})`,maskImage:`url(${s.logo})`}})})}},96921:(e,a,s)=>{"use strict";s.d(a,{R:()=>c});var t=s(95155),r=s(73321),n=s(92584),i=s(9726),d=s(89302),l=s(98644);function c(){let{me:e,logout:a}=(0,i.A)(),{t:s,language:c}=(0,d.o)(),o="en"===c,h=(0,r.useRouter)(),x=e?.user;if(!x)return null;let m="free"!==x.plan,p=[{href:"/dashboard",label:s.nav.dashboard,icon:n.bgB},{href:"/invoices",label:s.invoices.title,icon:n.p4e},{href:"/chat",label:"Chat",icon:n.q9p}];return x.isAdmin&&p.push({href:"/admin",label:"Admin",icon:n.CN3}),(0,t.jsx)(l.k,{brandHref:"/dashboard",items:[{href:"/dashboard",label:o?"Overview":"Vis\xe3o geral",icon:n.bgB},{href:"/dashboard#plano",label:o?"Plan":"Plano",icon:n.qIE},{href:"/dashboard#api",label:"API",icon:n.jTw},{href:"/dashboard#chaves",label:o?"Keys":"Chaves",icon:n.bMg},{href:"/invoices",label:s.invoices.title,icon:n.p4e},{href:"/afiliados",label:o?"Affiliates":"Afiliados",icon:n.Z8x},{href:"/docs",label:"Docs",icon:n.LBj}],cta:m?{href:"/chat",label:o?"Open chat":"Abrir chat",icon:n.q9p}:{href:"/dashboard#plano",label:o?"Subscribe":"Assinar plano",icon:n.zm_},user:{name:x.name,email:x.email,plan:x.plan},accountLinks:p,onLogout:async()=>{await a(),h.push("/")}})}}},e=>{e.O(0,[3246,2903,6674,2266,1610,8500,7645,9934,9302,2262,3503,8441,3794,7358],()=>e(e.s=79834)),_N_E=e.O()}]);