import{R as K,J as H,x as Q,_ as G,$ as X,a0 as Y,y as Z,K as ee,L as te,N as se,I as oe}from"./element-plus.0aa2c80d.js";import{_ as ie}from"./index.vue_vue_type_script_setup_true_lang.4e44db35.js";import{o as h,c as f,a as t,L as S,ab as M,d as N,r as E,_ as x,D as ne,T as i,K as c,U as A,S as v,Q as B,u as j,J as V,a6 as ae,R as O}from"./@vue.108c970a.js";import{d as le,t as T}from"./index.7d0bde5f.js";import{u as ue}from"./useDictOptions.2e5fb2d1.js";import{a as ce,b as $}from"./device.ee46859a.js";import{u as de}from"./vue-router.ed788fee.js";import"./@vueuse.d3d080b7.js";import"./@element-plus.d6eabd08.js";import"./lodash-es.29c53eac.js";import"./dayjs.664390f6.js";import"./axios.4ebfdb3f.js";import"./async-validator.fb49d0f5.js";import"./@ctrl.82a509e0.js";import"./@popperjs.36402333.js";import"./escape-html.e5dfadb9.js";import"./normalize-wheel-es.8aeb3683.js";import"./lodash.e92d81a1.js";import"./pinia.eff1ffd5.js";import"./vue-demi.ebc8116b.js";import"./css-color-function.dbf33394.js";import"./color.e1b5fced.js";import"./clone.0a4e8ac3.js";import"./color-convert.755d189f.js";import"./color-name.e7a4e1d3.js";import"./color-string.e356f5de.js";import"./balanced-match.d2a36341.js";import"./debug.f174a91e.js";import"./ms.a9ae1d6d.js";import"./nprogress.d7c3ab1b.js";import"./vue-clipboard3.add720e2.js";import"./clipboard.01ea18f5.js";import"./echarts.8d7a50ae.js";import"./zrender.1084fa23.js";import"./tslib.60310f1a.js";import"./highlight.js.4ebdf9a4.js";import"./@highlightjs.241b9b5d.js";const re={name:"VideoPlayer",props:{video_url:String},data(){return{jessibuca:null,version:"",wasm:!1,videoUrl:"",vc:"ff",playing:!1,quieting:!0,loaded:!1,showOperateBtns:!1,showBandwidth:!1,err:"",speed:0,performance:"",volume:1,rotate:0,useWCS:!1,useMSE:!0,useOffscreen:!1,recording:!1,recordType:"webm",scale:0}},mounted(){this.create(),this.videoUrl=this.video_url,window.onerror=u=>this.err=u,setTimeout(()=>{this.play()},2e3)},unmounted(){this.jessibuca.destroy()},methods:{create(u){u=u||{},this.jessibuca=new window.Jessibuca(Object.assign({container:this.$refs.container,videoBuffer:Number(this.$refs.buffer.value),isResize:!1,useWCS:this.useWCS,useMSE:this.useMSE,text:"",loadingText:"\u75AF\u72C2\u52A0\u8F7D\u4E2D...",debug:!1,decoder:"/decoder.js",supportDblclickFullscreen:!0,showBandwidth:this.showBandwidth,operateBtns:{fullscreen:this.showOperateBtns,screenshot:this.showOperateBtns,play:this.showOperateBtns,audio:this.showOperateBtns},vod:this.vod,forceNoOffscreen:!this.useOffscreen,isNotMute:!0,timeout:10},u));let o=this;this.jessibuca.on("load",function(){console.log("on load")}),this.jessibuca.on("log",function(e){console.log("on log",e)}),this.jessibuca.on("record",function(e){console.log("on record:",e)}),this.jessibuca.on("pause",function(){console.log("on pause"),o.playing=!1}),this.jessibuca.on("play",function(){console.log("on play"),o.playing=!0}),this.jessibuca.on("fullscreen",function(e){console.log("on fullscreen",e)}),this.jessibuca.on("mute",function(e){console.log("on mute",e),o.quieting=e}),this.jessibuca.on("mute",function(e){console.log("on mute2",e)}),this.jessibuca.on("audioInfo",function(e){console.log("audioInfo",e)}),this.jessibuca.on("videoInfo",function(e){console.log("videoInfo",e)}),this.jessibuca.on("error",function(e){console.log("error",e)}),this.jessibuca.on("timeout",function(){console.log("timeout")}),this.jessibuca.on("start",function(){console.log("frame start")}),this.jessibuca.on("performance",function(e){var n="\u5361\u987F";e===2?n="\u975E\u5E38\u6D41\u7545":e===1&&(n="\u6D41\u7545"),o.performance=n}),this.jessibuca.on("buffer",function(e){console.log("buffer",e)}),this.jessibuca.on("stats",function(e){console.log("stats",e)}),this.jessibuca.on("kBps",function(e){console.log("kBps",e)}),this.jessibuca.on("play",()=>{this.playing=!0,this.loaded=!0,this.quieting=this.jessibuca.isMute()}),this.jessibuca.on("recordingTimestamp",e=>{console.log("recordingTimestamp",e)})},play(){this.$refs.playUrl.value&&this.jessibuca.play(this.$refs.playUrl.value)},mute(){this.jessibuca.mute()},cancelMute(){this.jessibuca.cancelMute()},pause(){this.jessibuca.pause(),this.playing=!1,this.err="",this.performance=""},volumeChange(){this.jessibuca.setVolume(this.volume)},rotateChange(){this.jessibuca.setRotate(this.rotate)},destroy(){this.jessibuca&&this.jessibuca.destroy(),this.create(),this.playing=!1,this.loaded=!1,this.performance=""},fullscreen(){this.jessibuca.setFullscreen(!0)},clearView(){this.jessibuca.clearView()},startRecord(){const u=new Date().getTime();this.jessibuca.startRecord(u,this.recordType)},stopAndSaveRecord(){this.jessibuca.stopRecordAndSave()},screenShot(){this.jessibuca.screenshot()},restartPlay(u){u==="mse"?(this.useWCS=!1,this.useOffscreen=!1):u==="wcs"?this.useMSE=!1:u==="offscreen"&&(this.useMSE=!1),this.destroy(),setTimeout(()=>{this.play()},100)},changeBuffer(){this.jessibuca.setBufferTime(Number(this.$refs.buffer.value))},scaleChange(){this.jessibuca.setScaleMode(this.scale)}}},_e={class:"rot"},me={class:"container-shell"},pe={class:"option",style:{display:"none"}},ve=t("span",null,"MediaSource",-1),he=t("span",null,"webcodecs",-1),fe={id:"container",ref:"container"},ge={class:"input",style:{display:"none"}},be=t("div",null,"\u8F93\u5165URL\uFF1A",-1),ye=["value"];function we(u,o,e,n,p,d){return h(),f("div",_e,[t("div",me,[t("div",pe,[t("input",{style:{width:"50px"},type:"number",ref:"buffer",value:"0.2",onChange:o[0]||(o[0]=(...r)=>d.changeBuffer&&d.changeBuffer(...r))},null,544),S(t("input",{type:"checkbox","onUpdate:modelValue":o[1]||(o[1]=r=>p.useMSE=r),ref:"vod",onChange:o[2]||(o[2]=r=>d.restartPlay("mse"))},null,544),[[M,p.useMSE]]),ve,S(t("input",{type:"checkbox","onUpdate:modelValue":o[3]||(o[3]=r=>p.useWCS=r),ref:"vod",onChange:o[4]||(o[4]=r=>d.restartPlay("wcs"))},null,544),[[M,p.useWCS]]),he]),t("div",fe,null,512),t("div",ge,[be,t("input",{type:"input",autocomplete:"on",ref:"playUrl",value:e.video_url},null,8,ye),p.playing?(h(),f("button",{key:1,onClick:o[6]||(o[6]=(...r)=>d.pause&&d.pause(...r))},"\u505C\u6B62")):(h(),f("button",{key:0,onClick:o[5]||(o[5]=(...r)=>d.play&&d.play(...r))},"\u64AD\u653E"))])])])}const xe=le(re,[["render",we]]),Fe=t("div",null,[t("span",{class:"card-title"},"\u8BBE\u5907\u8D44\u6599")],-1),Ee={class:"flex flex-wrap"},Be={key:0,class:"w-1/2 mb-4 md:w-1/3"},je=t("div",{class:"leading-10"},"\u6240\u5C5E\u571F\u5730\uFF1A",-1),De={class:"text-3xl text-tx-gray"},Ce={key:1,class:"w-1/2 mb-4 md:w-1/3"},ke=t("div",{class:"leading-10"},"\u6240\u5C5E\u4EA7\u54C1\uFF1A",-1),Se={class:"text-3xl text-tx-gray"},Me={class:"flex flex-wrap"},Ae={class:"w-1/2 mb-4 md:w-1/6"},Ve=t("div",{class:"leading-10"},"\u8BBE\u5907\u540D\u79F0\uFF1A",-1),Te={class:"text-3xl text-tx-gray"},$e={class:"w-1/2 mb-4 md:w-1/6"},Ne=t("div",{class:"leading-10"},"\u8BBE\u5907\u7F16\u7801\uFF1A",-1),Oe={class:"text-3xl text-tx-gray"},Ue={class:"w-1/2 mb-4 md:w-1/6"},Re=t("div",{class:"leading-10"},"\u8BBE\u5907\u7C7B\u578B\uFF1A",-1),ze={class:"text-3xl text-tx-gray"},We={class:"w-1/2 mb-4 md:w-1/6"},Ie=t("div",{class:"leading-10"},"\u8BBE\u5907\u72B6\u6001\uFF1A",-1),qe={class:"text-3xl text-tx-gray"},Le={class:"w-1/2 mb-4 md:w-1/6"},Pe=t("div",{class:"leading-10"},"\u662F\u5426\u5728\u7EBF\uFF1A",-1),Je={class:"text-3xl text-tx-gray"},Ke={class:"flex justify-between mb-2"},He={class:"mt-2 text-sm text-tx-secondary"},Qe=["onClick"],Ge={class:"my-6 text-3xl"},Xe={class:"mt-2 text-sm text-tx-secondary"},Ye=O("\u53EA\u8BFB"),Ze=N({name:"deviceDetail"}),Rt=N({...Ze,setup(u){const o=E("monitor_video"),e=x({device:{},monitor_item:[]}),n=x({device_id:"",monitor_type:"",page_no:1,page_size:15,total:""}),{dictData:p}=ue("device_type,device_status,device_online_status,device_bind_status,monitor_item"),d=de();(async()=>{ce({id:d.query.device_id}).then(s=>{D.username=s.account,D.device=s.id,e.device.name=s.name,e.device.code=s.code,e.device.type=s.type,e.device.status=s.status,e.device.is_online=s.is_online,e.device.is_bind=s.is_bind,e.device.land_id=s.land_id==null?"":s.land_id,e.device.land_title=s.land_title==null?"":s.land_title,e.device.product_id=s.product_id==null?"":s.product_id,e.device.product_name=s.product_name==null?"":s.product_name,e.monitor_item=s.monitor_item,e.device.video_url=s.video_url}).catch(s=>{console.log("err",s)})})();const w=E(!1),b=x({gridData:[{}]}),U=(s,a)=>{b.gridData=[{}],n.device_id=s,n.monitor_type=a,$({id:s,monitor_type:a,page_no:n.page_no,page_size:n.page_size}).then(l=>{w.value=!0,n.total=l.count,l.lists.map(_=>{n.total=l.count,b.gridData.push({id:_.id,date:_.create_time?T(_.create_time,"yyyy-mm-dd hh:MM:ss"):"",value:_.monitor_value})})}).catch(l=>{console.log("err",l)})},R=s=>{console.log(`current page: ${s}`),b.gridData=[{}],$({id:n.device_id,monitor_type:n.monitor_type,page_no:s,page_size:n.page_size}).then(a=>{w.value=!0,n.total=a.count,a.lists.map(l=>{b.gridData.push({id:l.id,date:l.create_time?T(l.create_time,"yyyy-mm-dd hh:MM:ss"):"",value:l.monitor_value})})}).catch(a=>{console.log("err",a)})},D=x({username:"",device:"",scence:2}),C=E(!1),y=new WebSocket("wss://iot.lihaink.cn/test");return(s=>{const a=g=>{console.log("scoket\u6253\u5F00"),y.send(JSON.stringify(s)),C.value=!0},l=g=>{console.log("WebSocket\u8FDE\u63A5\u5DF2\u5173\u95ED")},_=g=>{console.error("WebSocket\u8FDE\u63A5\u53D1\u751F\u9519\u8BEF")};y.addEventListener("open",a),y.addEventListener("close",l),y.addEventListener("error",_)})({username:d.query.userName,device:"lihai_lot_walnutpi_dev_"+d.query.device_id,scence:"web"}),ne(()=>{y.close()}),(s,a)=>{const l=K,_=H,g=ie,k=Q,z=G,W=X,I=Y,q=Z,F=ee,L=te,P=se,J=oe;return h(),f(A,null,[t("div",null,[i(_,{class:"!border-none",shadow:"never"},{default:c(()=>[i(l,{content:"\u8BBE\u5907\u8BE6\u60C5",onBack:a[0]||(a[0]=m=>s.$router.back())})]),_:1}),i(_,{class:"!border-none mt-4 flex-1",shadow:"never"},{header:c(()=>[Fe]),default:c(()=>[t("div",Ee,[e.device.land_id!=""?(h(),f("div",Be,[je,t("div",De,"ID\uFF1A"+v(e.device.land_id)+" / \u540D\u79F0\uFF1A"+v(e.device.land_title),1)])):B("",!0),e.device.product_id!=""?(h(),f("div",Ce,[ke,t("div",Se,"ID\uFF1A"+v(e.device.product_id)+" / \u540D\u79F0\uFF1A"+v(e.device.product_name),1)])):B("",!0)]),t("div",Me,[t("div",Ae,[Ve,t("div",Te,v(e.device.name),1)]),t("div",$e,[Ne,t("div",Oe,v(e.device.code),1)]),t("div",Ue,[Re,t("div",ze,[i(g,{options:j(p).device_type,value:e.device.type},null,8,["options","value"])])]),t("div",We,[Ie,t("div",qe,[i(g,{options:j(p).device_status,value:e.device.status},null,8,["options","value"])])]),t("div",Le,[Pe,t("div",Je,[i(g,{options:j(p).device_online_status,value:e.device.is_online},null,8,["options","value"])])])])]),_:1}),i(_,{class:"!border-none mt-4 flex-1",shadow:"never"},{default:c(()=>[i(q,{modelValue:o.value,"onUpdate:modelValue":a[1]||(a[1]=m=>o.value=m),class:""},{default:c(()=>[i(k,{label:"\u76D1\u63A7\u89C6\u9891",name:"monitor_video",style:{width:"100vw","padding-left":"15vw"}},{default:c(()=>[e.device.video_url!=""&&C.value?(h(),V(xe,{key:0,video_url:e.device.video_url},null,8,["video_url"])):B("",!0)]),_:1}),i(k,{label:"\u76D1\u63A7\u6570\u636E",name:"monitor_item"},{default:c(()=>[i(I,{gutter:12},{default:c(()=>[(h(!0),f(A,null,ae(e.monitor_item,m=>(h(),V(W,{span:6,key:m},{default:c(()=>[i(_,{shadow:"always",class:"mb-4"},{default:c(()=>[t("div",Ke,[t("div",He,v(m.name),1),t("div",{class:"mt-2 text-sm text-tx-secondary",style:{cursor:"pointer"},onClick:tt=>U(m.device_id,m.value)}," \u5386\u53F2\u6570\u636E ",8,Qe)]),t("div",Ge,v(m.monitor_value),1),t("div",Xe,[i(z,{class:"mr-2",type:"info"},{default:c(()=>[Ye]),_:1}),O(v(m.last_time),1)])]),_:2},1024)]),_:2},1024))),128))]),_:1})]),_:1})]),_:1},8,["modelValue"])]),_:1})]),i(J,{modelValue:w.value,"onUpdate:modelValue":a[2]||(a[2]=m=>w.value=m),title:"\u5386\u53F2\u6570\u636E"},{default:c(()=>[i(L,{data:b.gridData},{default:c(()=>[i(F,{property:"id",label:"ID",width:"80"}),i(F,{property:"date",label:"\u65F6\u95F4",width:"250"}),i(F,{property:"value",label:"\u6570\u636E"})]),_:1},8,["data"]),i(P,{small:"",background:"",layout:"prev, pager, next","page-size":n.page_size,total:n.total,class:"mt-4",onCurrentChange:R},null,8,["page-size","total"])]),_:1},8,["modelValue"])],64)}}});export{Rt as default};