var C=Object.defineProperty;var _=(o,s,e)=>s in o?C(o,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[s]=e;var r=(o,s,e)=>_(o,typeof s!="symbol"?s+"":s,e);import{s as b,b as $,X as j,v as w,a8 as A,a9 as D,x as R,y as U,A as d,z as u,C as B,R as I,D as f,B as c,F as p,S as h,M as L}from"./en-Dy5_N6qX.js";import{j as k,v as x}from"./main-BpQs1T8X.js";const n=class n{constructor(s){r(this,"audio");this.audio=new Audio(s),Object.seal(this)}static async from(s){const e=await(await fetch(s)).blob(),t=URL.createObjectURL(e),i=new n(t);return n.registry.register(i,t),i}playOnce(){return this.audio.loop=!1,this.audio.play()}playInLoop(){return this.audio.loop=!0,this.audio.play()}stop(){this.audio.pause(),this.audio.load()}pause(){this.audio.pause()}};r(n,"registry",new FinalizationRegistry(s=>URL.revokeObjectURL(s)));let m=n;const O="/sounds/ring_tone.mp3",z=b({__name:"incoming-call-dialog",props:{chatId:{},peerAddress:{}},emits:["close"],setup(o,{emit:s}){const e=o,t=s,{$tr:i}=$(j),g=w(()=>k(e.peerAddress));async function v(){await x.joinCallInRoom({chatId:e.chatId,peerAddress:e.peerAddress}),t("close")}let a;return A(async()=>{a=await m.from(O),a.playInLoop()}),D(()=>{a==null||a.stop()}),(l,y)=>(R(),U("div",{class:c(l.$style.incomingCallDialog)},[d("div",{class:c(l.$style.user)},[u(B,{size:180,name:g.value},null,8,["name"]),I(" "+f(g.value),1)],2),d("div",{class:c(l.$style.text)},f(p(i)("chat.incoming.dialog.title"))+" ... ",3),d("div",{class:c(l.$style.actions)},[u(p(h),{type:"icon",color:"var(--error-content-default)",icon:"round-call-end",onClick:y[0]||(y[0]=S=>t("close"))}),u(p(h),{type:"icon",color:"var(--success-content-default)",icon:"round-phone",onClick:v})],2)],2))}}),M="_incomingCallDialog_1mn68_1",N="_user_1mn68_11",F="_text_1mn68_24",V="_actions_1mn68_31",X={incomingCallDialog:M,user:N,text:F,actions:V},E={$style:X},H=L(z,[["__cssModules",E]]);export{H as default};
