import{d as T,r as z,X as f,Y as y,Z as l,f as r,u as o,E as n,_ as v,a9 as d,a6 as I,F as M,a2 as N,aa as H}from"./vue-fae2b924.js";import{V as x,k as K,x as W}from"./index-7a259168.js";import{u as q}from"./index-ac72395e.js";import{L as G,aW as X,b7 as Y,aG as g,aV as w,by as Z,bH as j,U as m,M as C,bd as A,bt as b,b0 as P,bI as h}from"./radical-e583b742.js";import{u as J,c as Q,h as V,q as tt}from"./global-f6e5c3a3.js";import{s as et}from"./mp4-36ad9846.js";import{g as S}from"./utils-b13a2728.js";import{s as at}from"./state-2bc841f6.js";import{u as ot}from"./usePlay-2edeeb77.js";import"./index-3ee11f11.js";import"./jb4-52644b2c.js";import"./canvas-14fb4930.js";import"./gb28181-c1c04a54.js";const lt={style:{padding:"16px"}},rt=T({name:"StreamPush"}),kt=T({...rt,setup(it){const{pause:D,resume:O}=J(u);x.renderer.add("State",{renderDefault(a,t){const{row:e}=t;return at[e.state]}}),x.renderer.add("BPS",{renderDefault(a,t){const{row:e}=t;let s=0,p=0;return e.audioTrack&&(s=e.audioTrack.bps,p=e.audioTrack.bpsOut),e.videoTrack&&(s+=e.videoTrack.bps,p+=e.videoTrack.bpsOut),`↑${S(s)} ↓${S(p)}`}});const c=q(),_=a=>{a.length>1&&(a=a.sort((t,e)=>Date.parse(t.startTime)-Date.parse(e.startTime))),c.tableRef.reloadData(a)};async function u(){_(await Q())}u();const i=z({visible:!1,form:{streamPath:"",filePath:"records",hours:0,minutes:1,seconds:0}});function R(a){c.tableRef.toggleRowExpand(a)}function k(a){i.form.streamPath=a.path,i.visible=!0}async function $(){try{const a=`${i.form.hours}h${i.form.minutes}m${i.form.seconds}s`;await et({streamPath:i.form.streamPath,filePath:i.form.filePath,type:"mp4",fragment:a}),i.visible=!1,u()}catch(a){console.error("录制失败:",a)}}async function B(a){try{await V(a),u()}catch(t){console.error("停止录制失败:",t)}}const E={maxHeight:"100%",rowConfig:{keyField:"path",useKey:!0},expandConfig:{expandRowKeys:[],accordion:!1,lazy:!1},columnConfig:{useKey:!0},columns:[{field:"pluginName",title:"所属插件",width:"100px"},{field:"path",title:"StreamPath",showOverflow:"tooltip",minWidth:"150px"},{field:"audioTrack",title:"音频",width:"60px",formatter:({cellValue:a})=>a==null?void 0:a.codec},{field:"videoTrack",title:"视频",width:"60px",formatter:({cellValue:a})=>a==null?void 0:a.codec},{field:"state",title:"状态",showOverflow:"tooltip",cellRender:{name:"State"},width:"120px"},{field:"type",title:"类型",width:"80px",showOverflow:"tooltip"},{field:"subscribers",title:"订阅",showOverflow:"tooltip",width:"50px"},{field:"startTime",title:"创建时间",width:"180px",formatter:({cellValue:a})=>W.toDateString(new Date(a),"yyyy-MM-dd HH:mm:ss")},{field:"BPS",title:"BPS",cellRender:{name:"BPS"}},{field:"recording",title:"录制",width:"50px",align:"center",slots:{default:"recording",content:"recordingExpand"}},{field:"operate",title:"操作",width:"170px",align:"center",slots:{default:"operate"}}],data:[]},U=a=>{C.confirm({title:"提示",content:`此操作将停止 ${a.path},是否继续?`,onOk:async()=>{await tt(a.path),u()}})},F=G(),L=a=>{F({name:"StreamPushDetailFrameDetailFrame",query:{path:a}})};return(a,t)=>(f(),y(o(w),{bordered:!1,bodyStyle:{padding:"10px",height:"100%"},style:{height:"calc(100% - 100px)"}},{default:l(()=>[r(o(X),{windowWidth:1716}),r(o(K),{uid:o(c).uid,gridOptions:E},{recording:l(({row:e})=>[r(o(Y),{color:e.recording.length>0?"blue":"",style:{cursor:"pointer"},onClick:s=>e.recording.length>0?R(e):k(e)},{default:l(()=>[n(v(e.recording.length||0),1)]),_:2},1032,["color","onClick"])]),recordingExpand:l(({row:e})=>[d("div",lt,[r(o(g),{direction:"vertical",style:{width:"100%"}},{default:l(()=>[e.recording.length?(f(),y(o(w),{key:0,size:"small",bordered:!1},{title:l(()=>t[7]||(t[7]=[n("录制列表")])),default:l(()=>[r(o(Z),null,{default:l(()=>[(f(!0),I(M,null,N(e.recording,(s,p)=>(f(),y(o(j),{key:p},{default:l(()=>[r(o(g),null,{default:l(()=>[d("span",null,"文件路径: "+v(s.filePath),1),d("span",null,"片段时长: "+v(s.fragment),1),r(o(m),{type:"link",danger:"",onClick:()=>B(e.pointer)},{default:l(()=>t[8]||(t[8]=[n(" 停止 ")])),_:2},1032,["onClick"])]),_:2},1024)]),_:2},1024))),128))]),_:2},1024)]),_:2},1024)):H("",!0),r(o(m),{type:"primary",onClick:()=>k(e)},{default:l(()=>t[9]||(t[9]=[n(" 新增录制 ")])),_:2},1032,["onClick"])]),_:2},1024)])]),operate:l(({row:e})=>[r(o(g),null,{default:l(()=>[r(o(m),{size:"small",type:"link",onClick:()=>(o(ot)({path:e.path,type:e.type},{onClose:o(O)}),o(D)())},{default:l(()=>t[10]||(t[10]=[n(" 播放 ")])),_:2},1032,["onClick"]),r(o(m),{size:"small",type:"link",onClick:()=>L(e.path)},{default:l(()=>t[11]||(t[11]=[n(" 详情 ")])),_:2},1032,["onClick"]),r(o(m),{size:"small",type:"link",onClick:()=>U(e)},{default:l(()=>t[12]||(t[12]=[n(" 停止 ")])),_:2},1032,["onClick"])]),_:2},1024)]),_:1},8,["uid"]),r(o(C),{visible:i.visible,"onUpdate:visible":t[5]||(t[5]=e=>i.visible=e),title:"录制设置",onOk:$,onCancel:t[6]||(t[6]=e=>i.visible=!1)},{default:l(()=>[r(o(A),{model:i.form,layout:"vertical"},{default:l(()=>[r(o(b),{label:"流路径"},{default:l(()=>[r(o(P),{value:i.form.streamPath,"onUpdate:value":t[0]||(t[0]=e=>i.form.streamPath=e),disabled:""},null,8,["value"])]),_:1}),r(o(b),{label:"文件路径"},{default:l(()=>[r(o(P),{value:i.form.filePath,"onUpdate:value":t[1]||(t[1]=e=>i.form.filePath=e),placeholder:"请输入保存文件路径"},null,8,["value"])]),_:1}),r(o(b),{label:"片段时长"},{default:l(()=>[r(o(g),null,{default:l(()=>[r(o(h),{value:i.form.hours,"onUpdate:value":t[2]||(t[2]=e=>i.form.hours=e),min:0,max:23,placeholder:"时",style:{width:"80px"}},null,8,["value"]),t[13]||(t[13]=d("span",null,"时",-1)),r(o(h),{value:i.form.minutes,"onUpdate:value":t[3]||(t[3]=e=>i.form.minutes=e),min:0,max:59,placeholder:"分",style:{width:"80px"}},null,8,["value"]),t[14]||(t[14]=d("span",null,"分",-1)),r(o(h),{value:i.form.seconds,"onUpdate:value":t[4]||(t[4]=e=>i.form.seconds=e),min:0,max:59,placeholder:"秒",style:{width:"80px"}},null,8,["value"]),t[15]||(t[15]=d("span",null,"秒",-1))]),_:1})]),_:1})]),_:1},8,["model"])]),_:1},8,["visible"])]),_:1}))}});export{kt as default};