PageSourceSearch

https://brasilmineral.com.br/_next/static/chunks/58585-84329e4d22240af9.js

js brasilmineral.com.br collected 2026-10-02 05:23:04 UTC 24,880 bytes, 46 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[58585],{23256:(e,a,t)=>{"use strict";async function s(e){let a=new AbortController,t=setTimeout(()=>a.abort(),6e4);try{let s=await fetch("/api/google-analytics",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:a.signal});if(clearTimeout(t),!s.ok){let e=await s.json().catch(()=>({details:`A requisi\xe7\xe3o para a API falhou com o status ${s.status}`})),a=e.details||e.error||e.message||"Ocorreu um erro desconhecido ao buscar os dados do Analytics.";throw Error(a)}return await s.json()}catch(e){if(clearTimeout(t),console.error("Error fetching Google Analytics data from service:",e),"AbortError"===e.name||"TimeoutError"===e.name)throw Error("A requisi\xe7\xe3o demorou muito para responder. Verifique sua conex\xe3o com a internet e tente novamente.");if("Failed to fetch"===e.message||e.message?.includes("fetch")||"TypeError"===e.name){let e=window.location.hostname;throw Error(`N\xe3o foi poss\xedvel conectar ao servidor (${e}). Verifique se o servidor est\xe1 rodando na porta 9000 e sua conex\xe3o com a internet.`)}throw e}}async function r(e){let a=new AbortController,t=setTimeout(()=>a.abort(),6e4);try{let s=await fetch("/api/google-analytics",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:a.signal});if(clearTimeout(t),!s.ok){let e=await s.json().catch(()=>({details:`A requisi\xe7\xe3o para a API de detalhes falhou com o status ${s.status}`})),a=e.details||e.error||e.message||"Ocorreu um erro desconhecido ao buscar os dados detalhados.";throw Error(a)}return await s.json()}catch(e){if(clearTimeout(t),console.error("Error fetching Detailed Google Analytics data from service:",e),"AbortError"===e.name||"TimeoutError"===e.name)throw Error("A requisi\xe7\xe3o demorou muito para responder. Verifique sua conex\xe3o com a internet e tente novamente.");if("Failed to fetch"===e.message||e.message?.includes("fetch")||"TypeError"===e.name){let e=window.location.hostname;throw Error(`N\xe3o foi poss\xedvel conectar ao servidor (${e}). Verifique se o servidor est\xe1 rodando na porta 9000 e sua conex\xe3o com a internet.`)}throw e}}t.d(a,{h:()=>r,v:()=>s})},33807:(e,a,t)=>{"use strict";t.d(a,{J:()=>d});var s=t(95155),r=t(12115),i=t(29486),o=t(18460),l=t(40980);let n=(0,o.F)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),d=r.forwardRef(({className:e,...a},t)=>(0,s.jsx)(i.b,{ref:t,className:(0,l.cn)(n(),e),...a}));d.displayName=i.b.displayName},41754:(e,a,t)=>{"use strict";t.d(a,{Cn:()=>s,SS:()=>i,yy:()=>r}),t(41463);let s="brasil-mineral",r="Brasil Mineral",i=s},51956:(e,a,t)=>{"use strict";t.d(a,{DetailedAnalyticsPage:()=>en});var s=t(95155),r=t(12115),i=t(26708),o=t(23256),l=t(68136),n=t(70518),d=t(35871),c=t(56533),h=t(47296),m=t(81477),x=t(86846),u=t(15283),p=t(17414),g=t(89239),f=t(9281),b=t(40980),y=t(80723),j=t(57420),v=t(13545),w=t(7915),N=t(7810),A=t(26179),S=t(24538),k=t(8470),E=t(97810),T=t(41585),$=t(6296),C=t(91663),P=t(56204),R=t(4450),M=t(16746),D=t(28408),L=t(32539),B=t(59656),G=t(18662),F=t(93459),z=t(70468),I=t(48035),O=t(75045),Z=t(24758),U=t(68022),W=t(67389),q=t(98500),V=t.n(q),K=t(33807),J=t(60529),_=t(6695),X=t(81258),H=t(86901),Y=t(9339);let Q=(0,Y.createServerReference)("607a33ccd921daa2cd5260ab8fdfe13cef42e2ac3f",Y.callServer,void 0,Y.findSourceMapURL,"analyzeDetailedGaData");var ee=t(48375);function ea({content:e}){return(0,s.jsx)("div",{className:"prose prose-sm dark:prose-invert max-w-none text-sm leading-relaxed",children:e.split("\n").map((e,a)=>e.startsWith("## ")?(0,s.jsx)("h3",{className:"text-lg font-semibold mt-4 mb-2 border-b pb-1",children:e.substring(3)},a):""===e.trim()?(0,s.jsx)("div",{className:"h-2"},a):(0,s.jsx)("p",{children:e},a))})}function et({analyticsData:e,isDataLoading:a,onInsightsGenerated:t}){let{toast:i}=(0,_.dj)(),{user:o}=(0,ee.A)(),[l,n]=(0,r.useState)(!1),[d,c]=(0,r.useState)(null),[h,p]=(0,r.useState)(null),f=async()=>{if(a)return void i({title:"Aguarde",description:"Os dados de an\xe1lise ainda est\xe3o sendo carregados.",variant:"default"});n(!0),c(null),p(null),t(null);let s=e.timeSeries.reduce((e,a)=>e+a.views,0);try{let a=await Q({pageTitle:e.pageTitle,pagePath:e.pagePath,totalViews:s,byCity:e.byCity,byState:e.byState,byGender:e.byGender,byAge:e.byAge},await o?.getIdToken()??"");p(a.insightsMarkdown),t(a.insightsMarkdown),i({title:"An\xe1lise Gerada",description:"Insights sobre a audi\xeancia foram gerados com sucesso."})}catch(e){console.error("Error generating detailed AI insights:",e),c(e.message||"Ocorreu um erro desconhecido ao gerar a an\xe1lise."),i({title:"Erro na An\xe1lise",description:e.message,variant:"destructive"})}finally{n(!1)}};return(0,s.jsxs)(m.Zp,{children:[(0,s.jsxs)(m.aR,{children:[(0,s.jsxs)(m.ZB,{className:"flex items-center gap-2",children:[(0,s.jsx)(H.A,{size:20})," An\xe1lise de Audi\xeancia com IA"]}),(0,s.jsx)(m.BT,{children:"Gere um resumo sobre o perfil geogr\xe1fico e demogr\xe1fico dos leitores que acessaram esta p\xe1gina."})]}),(0,s.jsxs)(m.Wu,{className:"space-y-4",children:[(0,s.jsxs)(g.$,{onClick:f,disabled:l||a,children:[l?(0,s.jsx)($.A,{className:"mr-2 animate-spin"}):(0,s.jsx)(H.A,{className:"mr-2"}),l?"Analisando...":"Gerar An\xe1lise da Audi\xeancia"]}),a&&(0,s.jsx)("div",{className:"text-center text-muted-foreground py-4",children:(0,s.jsx)("p",{children:"Aguardando dados do Google Analytics..."})}),l&&(0,s.jsxs)("div",{className:"space-y-3 pt-2",children:[(0,s.jsx)(x.E,{className:"h-6 w-3/4"}),(0,s.jsx)(x.E,{className:"h-4 w-full"}),(0,s.jsx)(x.E,{className:"h-4 w-5/6"}),(0,s.jsx)(x.E,{className:"h-4 w-full"})]}),d&&(0,s.jsxs)(u.Fc,{variant:"destructive",children:[(0,s.jsx)(v.A,{className:"h-4 w-4"}),(0,s.jsx)(u.XL,{children:"Erro na An\xe1lise"}),(0,s.jsx)(u.TN,{children:d})]}),h&&(0,s.jsx)("div",{className:"p-4 border rounded-lg bg-muted/50 mt-4",children:(0,s.jsx)(ea,{content:h})})]})]})}var es=t(81343),er=t(76914);let ei=["hsl(var(--chart-1))","hsl(var(--chart-2))","hsl(var(--chart-3))","hsl(var(--chart-4))","hsl(var(--chart-5))"],eo={"brasil-mineral":"https://firebasestorage.googleapis.com/v0/b/brasil-mineral-newsletter.firebasestorage.app/o/BRASILMINERAL.png?alt=media&token=c1e3
16e97-f285-4128-88f6-8d53f5f617be","saneamento-ambiental":"https://saneamentoambiental.com.br/wp-content/uploads/2023/03/logo-sa.png"};function el({title:e,icon:a,children:t,isLoading:r}){return(0,s.jsxs)(m.Zp,{children:[(0,s.jsx)(m.aR,{children:(0,s.jsxs)(m.ZB,{className:"flex items-center gap-2 text-base font-semibold",children:[(0,s.jsx)(a,{className:"h-5 w-5 text-primary"}),e]})}),(0,s.jsx)(m.Wu,{className:"h-[250px] text-xs",children:r?(0,s.jsx)(x.E,{className:"h-full w-full"}):t})]})}function en({pagePath:e,pageTitle:a}){let{theme:t,isLoadingTheme:q}=(0,l.w)(),{toast:H}=(0,_.dj)(),{user:Y}=(0,ee.A)(),Q=e.match(/\/revista\/(\d+)/)?.[1]||null,[ea,ed]=(0,r.useState)({from:(0,n.e)(new Date,29),to:new Date}),[ec,eh]=(0,r.useState)(""),[em,ex]=(0,r.useState)(!1),[eu,ep]=(0,r.useState)(!1),[eg,ef]=(0,r.useState)(null),{data:eb,isLoading:ey,error:ej,isFetching:ev}=(0,i.I)({queryKey:["detailedAnalyticsData",t,ea,e],queryFn:()=>{if(!ea?.from||!ea?.to||!t)throw Error("Par\xe2metros inv\xe1lidos para busca.");return(0,o.h)({startDate:(0,d.GP)(ea.from,"yyyy-MM-dd"),endDate:(0,d.GP)(ea.to,"yyyy-MM-dd"),theme:t,pagePath:e,pageTitle:a})},enabled:!!ea?.from&&!!ea?.to&&!!t&&!q}),{data:ew,isLoading:eN}=(0,i.I)({queryKey:["magazineReadingStats",Q,ea],queryFn:async()=>{let e=await Y?.getIdToken(),a=new URLSearchParams({edition:Q,startDate:(0,d.GP)(ea.from,"yyyy-MM-dd"),endDate:(0,d.GP)(ea.to,"yyyy-MM-dd")}),t=await fetch(`/api/analytics/magazine-reading-stats?${a}`,{headers:e?{Authorization:`Bearer ${e}`}:{}});if(!t.ok)throw Error("Falha ao buscar leitura do flipbook");return t.json()},enabled:!!Q&&!!ea?.from&&!!ea?.to&&!!Y}),eA=(0,r.useCallback)(()=>{if(!eb)return"";let e="brasil-mineral"===t?"Brasil Mineral":"Saneamento Ambiental",a=ea?.from?(0,d.GP)(ea.from,"dd/MM/yyyy"):"",s=ea?.to?(0,d.GP)(ea.to,"dd/MM/yyyy"):"",r=eb.byCity[0]?.value||0,i=eb.byState[0]?.value||0,o=(e,a,t)=>a&&0!==a.length?`
2            <h3 style="font-size: 16px; font-weight: bold; margin-top: 20px; margin-bottom: 10px;">${e}</h3>
3            <table width="100%" cellpadding="5" cellspacing="0">
4                ${a.slice(0,10).map(e=>{var a;return`
5                    <tr>
6                        <td style="border-bottom: 1px solid #eee; width: 40%; vertical-align: top;">${e.label}</td>
7                        <td style="border-bottom: 1px solid #eee; width: 60%;">
8                            <div style="display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-align: center; -ms-flex-align: center; align-items: center;">
9                                <span style="font-weight: bold; margin-right: 8px;">${e.value.toLocaleString("pt-BR")}</span>
10                                ${a=e.value,`
11    <div style="background-color: #e5e7eb; border-radius: 4px; width: 100%; height: 18px; margin-top: 2px;">
12      <div style="background-color: hsl(var(--primary)); width: ${t>0?a/t*100:0}%; height: 100%; border-radius: 4px;"></div>
13    </div>
14  `}
15                            </div>
16                        </td>
17                    </tr>
18                `}).join("")}
19            </table>
20        `:"",l=eg?`
21        <h2 style="font-size: 18px; font-weight: bold; border-bottom: 1px solid #e5e7eb; padding-bottom: 10px; margin-top: 20px; margin-bottom: 15px;">An\xe1lise com IA</h2>
22        <div style="background-color: #f9fafb; border: 1px solid #e5e7eb; border-radius: 8px; padding: 15px; font-size: 14px; line-height: 1.6;">
23            ${eg.replace(/\n/g,"<br>")}
24        </div>
25    `:"";return`
26        <!DOCTYPE html><html><head><style>body{font-family: Arial, sans-serif;}</style></head>
27        <body style="background-color: #f3f4f6; padding: 20px;">
28            <table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td align="center">
29            <table width="600" cellpadding="20" cellspacing="0" border="0" style="background-color: #ffffff; border-radius: 8px;">
30                <tr><td>
31                    <h1 style="font-size: 24px; font-weight: bold;">Relat\xf3rio Detalhado de Tr\xe1fego - ${e}</h1>
32                    <p style="color: #6b7280;">Per\xedodo: ${a} - ${s}</p>
33                    <h2 style="font-size: 18px; font-weight: bold; margin-top: 15px; margin-bottom: 5px; color: hsl(var(--primary));">${eb.pageTitle}</h2>
34                    <p style="font-size: 12px; color: #6b7280; margin-top:0;">${eb.pagePath}</p>
35                    <div style="background-color: #f9fafb; border: 1px solid #e5e7eb; border-radius: 8px; padding: 15px; margin-top: 20px;">
36                        <p style="margin: 0; color: #6b7280; font-size: 14px;">Total de Visualiza\xe7\xf5es no Per\xedodo</p>
37                        <p style="margin: 5px 0 0 0; color: #111827; font-size: 24px; font-weight: bold;">
37${eb.totalViews.toLocaleString("pt-BR")}</p>
38                    </div>
39                    ${l}
40                    ${o("Top 10 Cidades",eb.byCity,r)}
41                    ${o("Top 10 Estados",eb.byState,i)}
42                </td></tr>
43            </table>
44            </td></tr></table>
45        </body></html>
46    `},[eb,t,ea,eg]),eS=(0,r.useCallback)(async()=>{let e=ec.split(",").map(e=>e.trim()).filter(e=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e));if(0===e.length)return void H({title:"Destinat\xe1rios Inv\xe1lidos",description:"Por favor, insira ao menos um e-mail v\xe1lido.",variant:"destructive"});if(!eb||!eg)return void H({title:"Dados Incompletos",description:"Gere a an\xe1lise da IA antes de enviar o relat\xf3rio.",variant:"destructive"});ex(!0);let a=eA(),s=`Relat\xf3rio de Tr\xe1fego: ${eb.pageTitle}`;try{let r=await (0,X.Os)({subject:s,htmlContent:a,recipientEmails:e,isTest:!0,theme:t});if(r.success)H({title:"Relat\xf3rio Enviado!",description:`O relat\xf3rio foi enviado para: ${e.join(", ")}`,variant:"default"});else throw Error(r.errorMessage||"Falha ao enviar o relat\xf3rio.")}catch(e){H({title:"Erro ao Enviar Relat\xf3rio",description:e.message,variant:"destructive"})}finally{ex(!1)}},[ec,eb,t,H,eA,eg]),ek=(0,r.useCallback)(async()=>{if(!eb)return void H({title:"Sem dados",description:"Aguarde o carregamento dos dados para exportar.",variant:"destructive"});if(t){ep(!0);try{let e=eo[t]||eo["brasil-mineral"],a=await (0,er.S)(e),s=eA(),r=a?`<div style="margin-bottom: 24px;"><img src="${a}" alt="Logo" style="max-width: 180px; height: auto;" /></div>`:"",i=s.replace(/<body[^>]*>/i,e=>e+r),o=await fetch("/api/generate-pdf",{method:"POST",headers:{"Content-Type":"application/json",...await (0,es.$)()},body:JSON.stringify({htmlContent:i,title:`Relat\xf3rio Detalhado - ${eb.pageTitle}`})}),l=await o.json();if(!o.ok||!l.success)throw Error(l.error||"Falha ao gerar PDF");let n=atob(l.pdf),c=new Uint8Array(n.length);for(let e=0;e<n.length;e++)c[e]=n.charCodeAt(e);let h=new Blob([c],{type:"application/pdf"}),m=URL.createObjectURL(h),x=document.createElement("a");x.href=m,x.download=`relatorio-detalhado-${t}-${(0,d.GP)(new Date,"yyyy-MM-dd")}.pdf`,x.click(),URL.revokeObjectURL(m),H({title:"PDF exportado!",description:"O relat\xf3rio foi baixado com sucesso."})}catch(e){H({title:"Erro ao exportar PDF",description:e.message||"Tente novamente.",variant:"destructive"})}finally{ep(!1)}}},[eb,t,eA,H]),eE=eb?.byGender.filter(e=>"desconhecido"!==e.label.toLowerCase()),eT=eb?.byAge.filter(e=>"desconhecido"!==e.label.toLowerCase()),e$=eb?.byCity.filter(e=>!["(not set)","unknown"].includes(e.label.toLowerCase())),eC=eb?.byState.filter(e=>!["(not set)","unknown"].includes(e.label.toLowerCase())),eP=eb?.timeSeries.map(e=>({...e,date:(0,d.GP)((0,c.H)(e.date),"dd/MM")}));return(0,s.jsxs)("div",{className:"container mx-auto py-8 px-4 space-y-6",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)(V(),{href:"/dashboard/analytics",className:(0,b.cn)((0,g.r)({variant:"ghost"}),"mb-4"),children:[(0,s.jsx)(y.A,{className:"mr-2"})," Voltar para An\xe1lise Geral"]}),(0,s.jsxs)(m.ZB,{className:"text-2xl break-all",children:["An\xe1lise Detalhada: ",a]}),(0,s.jsx)(m.BT,{className:"break-all",children:e})]}),(0,s.jsxs)(p.AM,{children:[(0,s.jsx)(p.Wv,{asChild:!0,children:(0,s.jsxs)("div",{id:"date",className:(0,b.cn)((0,g.r)({variant:"outline"}),"w-[260px] justify-start text-left font-normal cursor-pointer",!ea&&"text-muted-foreground"),children:[(0,s.jsx)(j.A,{className:"mr-2 h-4 w-4"}),ea?.from?ea.to?`${(0,d.GP)(ea.from,"dd/MM/yy")} - ${(0,d.GP)(ea.to,"dd/MM/yy")}`:(0,d.GP)(ea.from,"dd/MM/yy"):(0,s.jsx)("span",{children:"Escolha um per\xedodo"})]})}),(0,s.jsx)(p.hl,{className:"w-auto p-0",align:"start",children:(0,s.jsx)(f.V,{autoFocus:!0,mode:"range",defaultMonth:ea?.from,selected:ea,onSelect:ed,numberOfMonths:2,locale:h.F})})]}),ej&&(0,s.jsxs)(u.Fc,{variant:"destructive",children:[(0,s.jsx)(v.A,{className:"h-4 w-4"}),(0,s.jsx)(u.XL,{children:"Erro ao Carregar Dados Detalhados"}),(0,s.jsx)(u.TN,{children:ej.message})]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,s.jsxs)(m.Zp,{children:[(0,s.jsxs)(m.aR,{className:"flex flex-row items-center justify-between pb-2",children:[(0,s.jsx)(m.ZB,{className:"text-base font-semibold",children:"Total de Visualiza\xe7\xf5es"}),(0,s.jsx)(w.A,{className:"h-5 w-5 text-primary"})]}),(0,s.jsxs)(m.Wu,{children:[ey||ev?(0,s.jsx)(x.E,{className:"h-10 w-28"}):(0,s.jsx)("div",{className:"text-4xl font-bold",children:eb?.totalViews?.toLocaleStr
46ing("pt-BR")??"0"}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"no per\xedodo selecionado"})]})]}),(0,s.jsxs)(m.Zp,{children:[(0,s.jsxs)(m.aR,{className:"flex flex-row items-center justify-between pb-2",children:[(0,s.jsx)(m.ZB,{className:"text-base font-semibold",children:"Total de Usu\xe1rios"}),(0,s.jsx)(N.A,{className:"h-5 w-5 text-primary"})]}),(0,s.jsxs)(m.Wu,{children:[ey||ev?(0,s.jsx)(x.E,{className:"h-10 w-28"}):(0,s.jsx)("div",{className:"text-4xl font-bold",children:eb?.totalUsers?.toLocaleString("pt-BR")??"0"}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"no per\xedodo selecionado"})]})]})]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-3 gap-6",children:[(0,s.jsx)(el,{title:"Visualiza\xe7\xf5es no Per\xedodo",icon:A.A,isLoading:ey||ev,children:eP&&eP.length>0?(0,s.jsx)(R.u,{width:"100%",height:"100%",children:(0,s.jsxs)(M.b,{data:eP,margin:{top:5,right:20,left:-10,bottom:5},children:[(0,s.jsx)(D.d,{strokeDasharray:"3 3"}),(0,s.jsx)(L.W,{dataKey:"date"}),(0,s.jsx)(B.h,{}),(0,s.jsx)(G.m,{contentStyle:{backgroundColor:"hsl(var(--background))",border:"1px solid hsl(var(--border))"}}),(0,s.jsx)(F.s,{}),(0,s.jsx)(z.N,{type:"monotone",dataKey:"views",name:"Visualiza\xe7\xf5es",stroke:"hsl(var(--primary))",strokeWidth:2,dot:!1})]})}):(0,s.jsx)("p",{className:"text-center text-muted-foreground pt-10",children:"Nenhum dado de visualiza\xe7\xe3o no per\xedodo."})}),(0,s.jsx)(el,{title:"Top 10 Cidades",icon:S.A,isLoading:ey||ev,children:e$&&e$.length>0?(0,s.jsx)(R.u,{width:"100%",height:"100%",children:(0,s.jsxs)(I.E,{data:e$,layout:"vertical",margin:{right:30},children:[(0,s.jsx)(L.W,{type:"number",hide:!0}),(0,s.jsx)(B.h,{dataKey:"label",type:"category",width:80,tick:{fontSize:10},interval:0}),(0,s.jsx)(G.m,{contentStyle:{backgroundColor:"hsl(var(--background))",border:"1px solid hsl(var(--border))"}}),(0,s.jsx)(O.y,{dataKey:"value",name:"Usu\xe1rios",fill:"hsl(var(--chart-2))",radius:[0,4,4,0]})]})}):(0,s.jsx)("p",{className:"text-center text-muted-foreground pt-10",children:"Nenhum dado de cidade dispon\xedvel."})}),(0,s.jsx)(el,{title:"Top 10 Estados",icon:S.A,isLoading:ey||ev,children:eC&&eC.length>0?(0,s.jsx)(R.u,{width:"100%",height:"100%",children:(0,s.jsxs)(I.E,{data:eC,layout:"vertical",margin:{right:30},children:[(0,s.jsx)(L.W,{type:"number",hide:!0}),(0,s.jsx)(B.h,{dataKey:"label",type:"category",width:80,tick:{fontSize:10},interval:0}),(0,s.jsx)(G.m,{contentStyle:{backgroundColor:"hsl(var(--background))",border:"1px solid hsl(var(--border))"}}),(0,s.jsx)(O.y,{dataKey:"value",name:"Usu\xe1rios",fill:"hsl(var(--chart-3))",radius:[0,4,4,0]})]})}):(0,s.jsx)("p",{className:"text-center text-muted-foreground pt-10",children:"Nenhum dado de estado dispon\xedvel."})}),(0,s.jsx)(el,{title:"Usu\xe1rios por G\xeanero",icon:N.A,isLoading:ey||ev,children:eE&&eE.length>0?(0,s.jsx)(R.u,{width:"100%",height:"100%",children:(0,s.jsxs)(Z.r,{children:[(0,s.jsx)(U.F,{data:eE,dataKey:"value",nameKey:"label",cx:"50%",cy:"50%",outerRadius:80,label:!0,children:eE.map((e,a)=>(0,s.jsx)(W.f,{fill:ei[a%ei.length]},`cell-${a}`))}),(0,s.jsx)(G.m,{contentStyle:{backgroundColor:"hsl(var(--background))",border:"1px solid hsl(var(--border))"}}),(0,s.jsx)(F.s,{})]})}):(0,s.jsx)("p",{className:"text-center text-muted-foreground pt-10",children:"Nenhum dado de g\xeanero dispon\xedvel."})}),(0,s.jsx)(el,{title:"Usu\xe1rios por Idade",icon:k.A,isLoading:ey||ev,children:eT&&eT.length>0?(0,s.jsx)(R.u,{width:"100%",height:"100%",children:(0,s.jsxs)(Z.r,{children:[(0,s.jsx)(U.F,{data:eT,dataKey:"value",nameKey:"label",cx:"50%",cy:"50%",outerRadius:80,label:!0,children:eT.map((e,a)=>(0,s.jsx)(W.f,{fill:ei[a%ei.length]},`cell-${a}`))}),(0,s.jsx)(G.m,{contentStyle:{backgroundColor:"hsl(var(--background))",border:"1px solid hsl(var(--border))"}}),(0,s.jsx)(F.s,{})]})}):(0,s.jsx)("p",{className:"text-center text-muted-foreground pt-10",children:"Nenhum dado de idade dispon\xedvel."})})]}),Q&&(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("h2",{className:"text-xl font-semibold flex items-center gap-2",children:[(0,s.jsx)(E.A,{className:"h-5 w-5 text-primary"})," Leitura do Flipbook"]}),(0,s.jsx)(V(),{href:`/admin/magazine-stats?edition=${Q}`,className:"text-sm text-primary hover:underline",children:"Ver relat\xf3rio completo de an\xfancios desta edi\xe7\xe3o →"})]}),eN?(0,s.jsx)(x.E,{className:"h-32 w-full"}):ew?.available?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[(0,s.jsxs)(m.Zp,{children:[(0,s.jsx)(m.aR,{className:"pb-2",children:(0,s.jsx)(m.ZB,{className:"text-sm font-medium",children:"Sess\xf5es de Leitura"})}),(0,s.jsx)(m.Wu,{children:(0,s.jsx)("div",{className:"text-2xl font-bold",children:ew.totalSessions.toLocaleStr
46ing("pt-BR")})})]}),(0,s.jsxs)(m.Zp,{children:[(0,s.jsx)(m.aR,{className:"pb-2",children:(0,s.jsx)(m.ZB,{className:"text-sm font-medium",children:"P\xe1ginas M\xe9dias por Sess\xe3o"})}),(0,s.jsx)(m.Wu,{children:(0,s.jsx)("div",{className:"text-2xl font-bold",children:ew.avgPagesPerSession.toFixed(1)})})]}),(0,s.jsxs)(m.Zp,{children:[(0,s.jsx)(m.aR,{className:"pb-2",children:(0,s.jsx)(m.ZB,{className:"text-sm font-medium",children:"Dura\xe7\xe3o M\xe9dia"})}),(0,s.jsx)(m.Wu,{children:(0,s.jsx)("div",{className:"text-2xl font-bold",children:null!=ew.avgDurationSeconds?`${Math.round(ew.avgDurationSeconds/60)} min`:"N/D"})})]})]}),ew.funnel.length>0&&(0,s.jsxs)(m.Zp,{children:[(0,s.jsxs)(m.aR,{children:[(0,s.jsx)(m.ZB,{className:"text-base",children:"Alcance por P\xe1gina"}),(0,s.jsx)(m.BT,{children:"% das sess\xf5es de leitura que chegaram em cada p\xe1gina."})]}),(0,s.jsx)(m.Wu,{children:(0,s.jsx)("div",{className:"space-y-1.5 max-h-96 overflow-y-auto",children:ew.funnel.map(e=>(0,s.jsxs)("div",{className:"flex items-center gap-3 text-sm",children:[(0,s.jsxs)("span",{className:"w-14 shrink-0 tabular-nums text-muted-foreground",children:["P\xe1g. ",e.page]}),(0,s.jsx)("div",{className:"flex-1 h-4 rounded bg-neutral-100 overflow-hidden",children:(0,s.jsx)("div",{className:"h-full rounded",style:{width:`${e.pctOfTotal}%`,backgroundColor:"hsl(var(--primary))"}})}),(0,s.jsxs)("span",{className:"w-28 shrink-0 text-right tabular-nums text-muted-foreground",children:[e.pctOfTotal.toFixed(1),"% (",e.sessionsReached.toLocaleString("pt-BR"),")"]})]},e.page))})})]})]}):(0,s.jsxs)(u.Fc,{variant:"default",className:"border-amber-300 bg-amber-50 text-amber-800",children:[(0,s.jsx)(T.A,{className:"h-4 w-4"}),(0,s.jsx)(u.XL,{children:"Leitura do flipbook indispon\xedvel"}),(0,s.jsx)(u.TN,{children:ew?.reason||"Sem dados de leitura para esta edi\xe7\xe3o no per\xedodo selecionado."})]})]}),eb&&(0,s.jsx)(et,{analyticsData:eb,isDataLoading:ey||ev,onInsightsGenerated:ef}),(0,s.jsxs)(m.Zp,{children:[(0,s.jsxs)(m.aR,{children:[(0,s.jsx)(m.ZB,{children:"Enviar Relat\xf3rio por Email"}),(0,s.jsx)(m.BT,{children:"Envie este relat\xf3rio detalhado para os destinat\xe1rios desejados via SendGrid."})]}),(0,s.jsxs)(m.Wu,{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(K.J,{htmlFor:"report-recipients-detailed",children:"Destinat\xe1rios"}),(0,s.jsx)(J.p,{id:"report-recipients-detailed",placeholder:"[email protected], [email protected]",value:ec,onChange:e=>eh(e.target.value),disabled:em||ey||ev}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Separe m\xfaltiplos emails por v\xedrgula."})]}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsxs)(g.$,{onClick:ek,disabled:eu||!eb,variant:"outline",children:[eu?(0,s.jsx)($.A,{className:"mr-2 h-4 w-4 animate-spin"}):(0,s.jsx)(C.A,{className:"mr-2 h-4 w-4"}),eu?"Exportando...":"Exportar PDF"]}),(0,s.jsxs)(g.$,{onClick:eS,disabled:!ec||em||ey||ev||!eb||!eg,children:[em?(0,s.jsx)($.A,{className:"mr-2 animate-spin"}):(0,s.jsx)(P.A,{className:"mr-2"}),em?"Enviando...":"Enviar Relat\xf3rio"]})]})]})]})]})}},58585:(e,a,t)=>{Promise.resolve().then(t.bind(t,51956))},68136:(e,a,t)=>{"use strict";t.d(a,{N:()=>l,w:()=>n});var s=t(95155),r=t(12115),i=t(41754);let o=(0,r.createContext)(void 0);function l({children:e}){let[a,t]=(0,r.useState)(i.SS),[n,d]=(0,r.useState)(!1);(0,r.useEffect)(()=>{let e=(localStorage.getItem("app-theme"),i.SS);t(e),localStorage.setItem("app-theme",e),document.documentElement.setAttribute("data-theme",e),d(!1)},[]);let c=e=>{let a=i.SS;t(a),localStorage.setItem("app-theme",a),document.documentElement.setAttribute("data-theme",a)},h=(0,r.useMemo)(()=>({theme:a,setTheme:c,isLoadingTheme:n}),[a,n]);return(0,s.jsx)(o.Provider,{value:h,children:e})}function n(){let e=(0,r.useContext)(o);if(void 0===e)throw Error("useThemeContext must be used within a ThemeProvider");return e}},76914:(e,a,t)=>{"use strict";async function s(e){try{let a=await fetch(e);if(!a.ok)return null;let t=await a.blob();return await new Promise((e,a)=>{let s=new FileReader;s.onloadend=()=>e(s.result),s.onerror=a,s.readAsDataURL(t)})}catch{return null}}t.d(a,{S:()=>s})},81343:(e,a,t)=>{"use strict";t.d(a,{$:()=>r});var s=t(19865);async function r(){let e=await s.j2.currentUser?.getIdToken().catch(()=>null);return e?{Authorization:`Bearer ${e}`}:{}}}}]);

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.