var v=Object.defineProperty;var _=(o,s,e)=>s in o?v(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{v as b,r as $,X as j,y as w,ac as A,a8 as D,z as U,A as B,D as d,B as u,C as I,V as L,F as f,E as c,H as p,Y as h,O}from"./en-BGJTCDgq.js";import{j as R,v as k}from"./main-oA9njtMa.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 x="/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),y=w(()=>R(e.peerAddress));async function C(){await k.joinCallInRoom({chatId:e.chatId,peerAddress:e.peerAddress}),t("close")}let a;return A(async()=>{a=await m.from(x),a.playInLoop()}),D(()=>{a==null||a.stop()}),(l,g)=>(U(),B("div",{class:c(l.$style.incomingCallDialog)},[d("div",{class:c(l.$style.user)},[u(I,{size:180,name:y.value},null,8,["name"]),L(" "+f(y.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:g[0]||(g[0]=H=>t("close"))}),u(p(h),{type:"icon",color:"var(--success-content-default)",icon:"round-phone",onClick:C})],2)],2))}}),N="_incomingCallDialog_1mn68_1",V="_user_1mn68_11",F="_text_1mn68_24",M="_actions_1mn68_31",E={incomingCallDialog:N,user:V,text:F,actions:M},X={$style:E},q=O(z,[["__cssModules",X]]);export{q as default};
