import{S as k}from"./StatusGrid-DAyEP9oU.js";import{B as w,C as g}from"./BandwidthChartView-C_txU6C2.js";import{f as V}from"./localDay-CoEbUe3O.js";import{d as y,u as S,r as u,w as C,e as p,f as l,g as I,h as o,x,o as c,y as D,E as H,q as O,_ as B}from"./index-D92x6h1h.js";import"./DataGrid-CbtTsx8d.js";import"./index-BG9mM10J.js";import"./index-7HNOjfAo.js";import"./useGridLayout-DCIiMD42.js";import"./CollapsibleSection.vue_vue_type_style_index_0_lang-Cq2AVc9p.js";import"./sliders-horizontal-Am8f4Xsv.js";import"./status-CE0GKX14.js";import"./play-DDT_Ndp2.js";const E={class:"status-view__row"},P=["aria-label","aria-pressed"],n="tvh-bandwidth-show:status-subscriptions",R=y({__name:"SubscriptionsView",setup(U){const{t}=S(),m=e=>typeof e!="number"?"":("0000000"+e.toString(16).toUpperCase()).slice(-8),d=e=>typeof e=="number"?Math.round(e/1024).toString():"",f=e=>{if(!Array.isArray(e)||e.length===0)return"";const s=[...e].sort((r,a)=>r-a);return s[s.length-1]===65535?"all":s.join(", ")},h=[{field:"id",label:t("Id"),sortable:!0,minVisible:"desktop",format:m},{field:"hostname",label:t("Hostname"),sortable:!0,minVisible:"desktop"},{field:"username",label:t("Username"),sortable:!0,minVisible:"desktop"},{field:"title",label:t("Title"),sortable:!0,minVisible:"phone",phoneRole:"primary"},{field:"client",label:t("Client / User agent"),sortable:!0,minVisible:"phone",phoneOrder:2},{field:"channel",label:t("Channel"),sortable:!0,minVisible:"phone",phoneOrder:1},{field:"service",label:t("Service"),sortable:!0,minVisible:"desktop"},{field:"profile",label:t("Profile"),sortable:!0,minVisible:"desktop"},{field:"start",label:t("Start"),sortable:!0,minVisible:"desktop",format:V},{field:"state",label:t("State"),sortable:!0,minVisible:"phone",phoneOrder:4},{field:"pids",label:t("PID list"),sortable:!1,minVisible:"desktop",width:200,format:f},{field:"descramble",label:t("Descramble"),sortable:!0,minVisible:"desktop"},{field:"errors",label:t("Errors"),sortable:!0,minVisible:"desktop"},{field:"in",label:t("Input (kb/s)"),sortable:!0,minVisible:"desktop",format:d},{field:"out",label:t("Output (kb/s)"),sortable:!0,minVisible:"phone",phoneOrder:3,format:d}],b=u(null),i=u(_());function _(){try{return localStorage.getItem(n)==="1"}catch{return!1}}C(i,e=>{try{e?localStorage.setItem(n,"1"):localStorage.removeItem(n)}catch{}});function v(e){const r=[typeof e.id=="number"?`sub-${e.id}`:""];return typeof e.client=="string"&&e.client&&r.push(e.client),typeof e.channel=="string"&&e.channel&&r.push(e.channel),r.filter(Boolean).join(" · ")}return(e,s)=>{const r=x("tooltip");return c(),p("div",E,[l(k,{ref_key:"gridRef",ref:b,endpoint:"status/subscriptions","help-page":"status_subscriptions","notification-class":"subscriptions",columns:h,"key-field":"id","default-sort":{key:"start",dir:"DESC"},"storage-key":"status-subscriptions",selectable:!0,class:"status-view__grid"},{toolbarMeta:I(({isPhone:a})=>[a?O("",!0):D((c(),p("button",{key:0,type:"button",class:H(["status-view__chart-toggle",{"status-view__chart-toggle--active":i.value}]),"aria-label":i.value?o(t)("Hide bandwidth chart"):o(t)("Show bandwidth chart"),"aria-pressed":i.value,onClick:s[0]||(s[0]=A=>i.value=!i.value)},[l(o(g),{size:16,"stroke-width":2})],10,P)),[[r,i.value?o(t)("Hide bandwidth chart"):o(t)("Show bandwidth chart"),void 0,{bottom:!0}]])]),_:1},512),l(w,{visible:i.value,"onUpdate:visible":s[1]||(s[1]=a=>i.value=a),rows:()=>b.value?.selection??[],"key-field":"id",metrics:["in","out"],units:"bytes","row-label":v,noun:o(t)("subscription")},null,8,["visible","rows","noun"])])}}}),F=B(R,[["__scopeId","data-v-0eabeb16"]]);export{F as default};
