import{r as e}from"./rolldown-runtime-BM3Ffeng.js";import{Q as t,Z as n,nt as r}from"./element-plus-vendor-BF9PNysW.js";import{A as i,D as a,I as o,N as s,O as c,P as l,Pt as u,Xt as d,Yt as f,et as p,ht as m,nt as h,qt as g,x as _}from"./vue-vendor-DMUmTARL.js";import{t as v}from"./ZPinyinSelect-DHOF7HIV.js";import{i as y}from"./scopeMeta-CzBMS2X0.js";import{t as b}from"./TrendChart-zQsanbqh.js";var x={class:`rounded-zf-lg border border-border-light bg-surface p-5 sm:p-6`},S={class:`mb-4 flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between`},C={class:`flex min-w-0 flex-col gap-2 sm:flex-row sm:items-center`},w={class:`flex max-w-full items-center gap-1 overflow-x-auto pb-1 text-xs`},T=[`onClick`],E={class:`text-xs text-secondary`},D=o({__name:`DownloadStatsAnalysis`,props:{trendData:{},trendLoading:{type:Boolean},smooth:{type:Boolean},hideEmpty:{type:Boolean},granularity:{},hourDisabled:{type:Boolean},rangeLabel:{},scopeLabel:{},selectedScopes:{},scopes:{},storageKey:{},storageOptions:{}},emits:[`update:smooth`,`update:hideEmpty`,`granularity-change`,`scope-all`,`scope-toggle`,`storage-change`],setup(e,{emit:o}){let D=o,O=e=>[`flex shrink-0 items-center gap-1.5 rounded-zf-sm px-2.5 py-1.5 font-medium transition-all duration-300 ease-in-out`,e?`bg-zp/10 text-zp`:`text-secondary hover:bg-page hover:text-primary`],k=e=>{D(`storage-change`,typeof e==`string`?e:void 0)};return(o,A)=>{let j=r,M=v,N=n,P=t;return p(),i(`section`,x,[a(`div`,S,[A[4]||=a(`div`,null,[a(`h2`,{class:`text-sm font-semibold text-primary`},`下载趋势`),a(`p`,{class:`mt-0.5 text-xs text-placeholder`},`筛选影响概览、趋势与下方维度分析`)],-1),a(`div`,C,[l(M,{"model-value":e.storageKey,clearable:``,filterable:``,placeholder:`全部存储源`,class:`w-full sm:w-48`,onChange:k},{default:m(()=>[(p(!0),i(_,null,h(e.storageOptions,e=>(p(),c(j,{key:e.storageKey,label:e.storageName||e.storageKey,value:e.storageKey},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`]),a(`div`,w,[a(`button`,{type:`button`,class:g(O(!e.selectedScopes.length)),onClick:A[0]||=e=>D(`scope-all`)},` 全部 `,2),(p(!0),i(_,null,h(e.scopes,t=>(p(),i(`button`,{key:t.key,type:`button`,class:g(O(e.selectedScopes.includes(t.key))),onClick:e=>D(`scope-toggle`,t.key)},[a(`span`,{class:`h-2 w-2 rounded-full`,style:f({backgroundColor:u(y)(t)})},null,4),s(` `+d(t.label),1)],10,T))),128))])])]),l(b,{"trend-data":e.trendData,loading:e.trendLoading,smooth:e.smooth,"hide-empty":e.hideEmpty,"chart-height-class":`h-72 sm:h-80 xl:h-96`,"export-file-name":`download-trend`,"onUpdate:smooth":A[2]||=e=>D(`update:smooth`,e),"onUpdate:hideEmpty":A[3]||=e=>D(`update:hideEmpty`,e)},{title:m(()=>[a(`span`,E,d(e.rangeLabel)+` · `+d(e.scopeLabel),1)]),"toolbar-prepend":m(()=>[l(P,{"model-value":e.granularity,size:`small`,onChange:A[1]||=e=>D(`granularity-change`,e)},{default:m(()=>[l(N,{value:`day`},{default:m(()=>[...A[5]||=[s(`按天`,-1)]]),_:1}),l(N,{value:`hour`,disabled:e.hourDisabled,title:e.hourDisabled?`日期范围超过 7 天时不支持按小时统计`:``},{default:m(()=>[...A[6]||=[s(` 按小时 `,-1)]]),_:1},8,[`disabled`,`title`])]),_:1},8,[`model-value`])]),_:1},8,[`trend-data`,`loading`,`smooth`,`hide-empty`])])}}}),O=e({default:()=>k}),k=D;export{O as n,k as t};