import{dX as V,bC as O,l as w,az as D,V as T,b2 as h,a3 as l,bM as _,bI as M,Y as y,cx as R,a2 as B,ch as Q,bT as F,dY as C}from"./index.69621fe4.js";const n=new Image(1920,1080);let e,t,i,o,s,u,b;function N(a){i.save(),o.save(),i.clearRect(0,0,e.width,e.height),i.drawImage(a.segmentationMask,0,0,e.width,e.height),o.clearRect(0,0,t.width,t.height),o.drawImage(a.segmentationMask,0,0,t.width,t.height),i.globalCompositeOperation="source-out",i.drawImage(n,0,0,n.width,n.height,0,0,e.width,e.height),o.globalCompositeOperation="source-out",o.drawImage(n,0,0,n.width,n.height,0,0,t.width,t.height),i.globalCompositeOperation="destination-atop",i.drawImage(a.image,0,0,e.width,e.height),o.globalCompositeOperation="destination-atop",o.drawImage(a.image,0,0,t.width,t.height),i.restore(),o.restore()}async function k(){await u.send({image:s}),b=s.requestVideoFrameCallback(k)}function $(a,g,v,p){t=p,e=v,i=e.getContext("2d"),o=t.getContext("2d"),n.src=g,s=a,u=new V({locateFile:c=>`./ia/${c}`}),u.setOptions({modelSelection:1,selfieMode:!0}),u.onResults(N),b=s.requestVideoFrameCallback(k)}async function j(){if(b&&s.cancelVideoFrameCallback(b),s&&s.srcObject.getTracks().forEach(a=>a.stop()),u){try{await u.close()}catch(a){console.log(a)}i.clearRect(0,0,e.width,e.height),o.clearRect(0,0,e.width,e.height)}}var q="assets/ccr_virtualbg.a403074d.jpeg";const E={__name:"videoTeste",setup(a){const g=w(null),v=w(null),p=w(null),c=w(!1);function x(){c.value=!1,j()}function I(){console.log("dialogShow")}async function S(){const m={video:{width:{min:720,ideal:1920,max:1920},height:{min:480,ideal:1080,max:1080}},audio:{echoCancellation:!1,noiseSuppression:!1}};if(C.getItem("config")){const r=JSON.parse(C.getItem("config"));r.videoDevices&&r.videoDevices.value!=="default"&&(m.video.deviceId=r.videoDevices.value),r.inputDevice&&r.inputDevice.value!=="default"&&(m.audio.deviceId=r.inputDevice.value)}const d=await navigator.mediaDevices.getUserMedia(m),f=new MediaStream(d.getVideoTracks());g.value.srcObject=f,$(g.value,q,v.value,p.value)}return(m,d)=>(D(),T(F,{padding:""},{default:h(()=>[l(_,{color:"white","text-color":"black",label:"Open",onClick:d[0]||(d[0]=f=>c.value=!0)}),l(Q,{onShow:I,modelValue:c.value,"onUpdate:modelValue":d[1]||(d[1]=f=>c.value=f),persistent:"","transition-show":"slide-up","transition-hide":"slide-down"},{default:h(()=>[l(M,{flat:"",ref:"dialogMove",class:"q-pa-none video-card",style:{width:"800px",height:"600px"}},{default:h(()=>[y("video",{ref_key:"video",ref:g,width:"1920",height:"1080",style:{display:"none"},autoplay:"","webkit-playsinline":"",playsinline:""},null,512),y("canvas",{ref_key:"canvas",ref:v,class:"videoLocal"},null,512),y("canvas",{ref_key:"canvascopy",ref:p,width:"1920",height:"1080",style:{display:"none"}},null,512),l(_,{color:"white","text-color":"black",label:"Start",onClick:S}),l(_,{class:"btn",round:"",color:"red",icon:"call_end",onClick:x}),l(_,{class:"btn",round:"",color:"black",icon:"cached"},{default:h(()=>[l(R,{class:"bg-white text-primary"},{default:h(()=>[B("Girar imagem")]),_:1})]),_:1})]),_:1},512)]),_:1},8,["modelValue"])]),_:1}))}};var U=O(E,[["__scopeId","data-v-140b959e"]]);export{U as default};
