agrasya-voice-sdk 1.0.29 → 1.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';function
|
|
1
|
+
'use strict';const a0_0xa582e2=a0_0x48eb;function a0_0x48eb(_0xbc7851,_0x9c76a5){_0xbc7851=_0xbc7851-0x1ba;const _0x14e474=a0_0x14e4();let _0x48eb55=_0x14e474[_0xbc7851];return _0x48eb55;}(function(_0xbbdb20,_0x2e7693){const _0x59a2dc=a0_0x48eb,_0xcc53fd=_0xbbdb20();while(!![]){try{const _0x2b42c9=parseInt(_0x59a2dc(0x1f8))/0x1+-parseInt(_0x59a2dc(0x215))/0x2*(parseInt(_0x59a2dc(0x1c5))/0x3)+-parseInt(_0x59a2dc(0x214))/0x4*(-parseInt(_0x59a2dc(0x1e7))/0x5)+-parseInt(_0x59a2dc(0x1fd))/0x6*(parseInt(_0x59a2dc(0x204))/0x7)+parseInt(_0x59a2dc(0x1c6))/0x8*(-parseInt(_0x59a2dc(0x207))/0x9)+parseInt(_0x59a2dc(0x1ba))/0xa*(parseInt(_0x59a2dc(0x202))/0xb)+parseInt(_0x59a2dc(0x1d8))/0xc*(-parseInt(_0x59a2dc(0x213))/0xd);if(_0x2b42c9===_0x2e7693)break;else _0xcc53fd['push'](_0xcc53fd['shift']());}catch(_0x2d8388){_0xcc53fd['push'](_0xcc53fd['shift']());}}}(a0_0x14e4,0x704f3));function a0_0x14e4(){const _0x13159c=['setupWebRTC','text','key\x20is\x20null\x20or\x20undefined.','prototype','initializeBackendSession','setLocalDescription','createDataChannel','dataChannel','901585GWugbm','session_ended','/v1/agrasya/connect','fetchMinutesUsage','success','134586WOkelK','getPrototypeOf','apiKey','Failed\x20to\x20initialize\x20session:\x20','onmessage','1793voHYlN','srcObject','70doTCqa','default','baseUrl','18216SMkdbF','stopVoiceSession','setStatus','answer','body','disconnect','initializing','statusText','sessionId','POST','data','join_session','23777sOMljY','8hovCfR','6418RQSGAV','parse','oai-events','application/json','error','addTrack','2960xiVIaM','message','createOffer','defineProperty','create','cleanup','sdp','socket.io-client','audioStream','ephKey','getTracks','21KDEYEx','608erbxaU','emit','durationInterval','mediaDevices','GET','config','debug','setupSocketListeners','type','idle','exports','log','setRemoteDescription','http://localhost:4001','createElement','events','hasOwnProperty','minutesLeft','4908FmRtOI','Backend\x20initialization\x20failed','Failed\x20to\x20fetch\x20minutes\x20usage:\x20','callDuration','stringify','autoplay','appendChild','dataUrl','ontrack','getOwnPropertyNames','socket','function','getUserMedia','/v1/agrasya/usage','json','1647110oPQcrI','stopTimer','peerConnection','__esModule','close','model','audio','/v1/agrasya/client-token?language=','streams'];a0_0x14e4=function(){return _0x13159c;};return a0_0x14e4();}var __create=Object[a0_0xa582e2(0x1be)],__defProp=Object[a0_0xa582e2(0x1bd)],__getOwnPropDesc=Object['getOwnPropertyDescriptor'],__getOwnPropNames=Object[a0_0xa582e2(0x1e1)],__getProtoOf=Object[a0_0xa582e2(0x1fe)],__hasOwnProp=Object[a0_0xa582e2(0x1f3)][a0_0xa582e2(0x1d6)],__export=(_0x140def,_0x1fc01b)=>{for(var _0x2d5404 in _0x1fc01b)__defProp(_0x140def,_0x2d5404,{'get':_0x1fc01b[_0x2d5404],'enumerable':!![]});},__copyProps=(_0xb0b648,_0x2001fc,_0x2e4239,_0x408bb9)=>{const _0x1a5d69=a0_0xa582e2;if(_0x2001fc&&typeof _0x2001fc==='object'||typeof _0x2001fc===_0x1a5d69(0x1e3)){for(let _0x149f70 of __getOwnPropNames(_0x2001fc))if(!__hasOwnProp['call'](_0xb0b648,_0x149f70)&&_0x149f70!==_0x2e4239)__defProp(_0xb0b648,_0x149f70,{'get':()=>_0x2001fc[_0x149f70],'enumerable':!(_0x408bb9=__getOwnPropDesc(_0x2001fc,_0x149f70))||_0x408bb9['enumerable']});}return _0xb0b648;},__toESM=(_0x3f8440,_0x5585f0,_0x56a80d)=>(_0x56a80d=_0x3f8440!=null?__create(__getProtoOf(_0x3f8440)):{},__copyProps(_0x5585f0||!_0x3f8440||!_0x3f8440['__esModule']?__defProp(_0x56a80d,'default',{'value':_0x3f8440,'enumerable':!![]}):_0x56a80d,_0x3f8440)),__toCommonJS=_0x1b67a5=>__copyProps(__defProp({},a0_0xa582e2(0x1ea),{'value':!![]}),_0x1b67a5),index_exports={};__export(index_exports,{'AgrasyaVoiceSDK':()=>AgrasyaVoiceSDK}),module[a0_0xa582e2(0x1d0)]=__toCommonJS(index_exports);var import_socket=__toESM(require(a0_0xa582e2(0x1c1))),AgrasyaVoiceSDK=class{['config'];[a0_0xa582e2(0x1d5)];[a0_0xa582e2(0x1e9)]=null;['dataChannel']=null;[a0_0xa582e2(0x1c2)]=null;['socket']=null;['sessionId']=null;[a0_0xa582e2(0x1c3)]=null;[a0_0xa582e2(0x1df)]=null;[a0_0xa582e2(0x1ec)]=null;['callDuration']=0x0;[a0_0xa582e2(0x1c8)]=null;constructor(_0x5d20db,_0x27a276={}){const _0x2cfea4=a0_0xa582e2;this['config']={'baseUrl':_0x2cfea4(0x1d3),'language':'','debug':![],..._0x5d20db},this['events']=_0x27a276;}[a0_0xa582e2(0x1d1)](..._0x5f103e){const _0x3c01ca=a0_0xa582e2;this[_0x3c01ca(0x1cb)][_0x3c01ca(0x1cc)]&&console['log']('[AgrasyaSDK]',..._0x5f103e);}['setStatus'](_0x5d3c2c){const _0x3766bf=a0_0xa582e2;this[_0x3766bf(0x1d5)]['onStatusChange']?.(_0x5d3c2c);}['startTimer'](){const _0x43f47b=a0_0xa582e2;this[_0x43f47b(0x1db)]=0x0,this[_0x43f47b(0x1c8)]=setInterval(()=>{const _0x487d62=_0x43f47b;this[_0x487d62(0x1db)]+=0x1,this[_0x487d62(0x1d5)]['onCallDurationUpdate']?.(this[_0x487d62(0x1db)]);},0x3e8);}[a0_0xa582e2(0x1e8)](){const _0x2fa50d=a0_0xa582e2;this[_0x2fa50d(0x1c8)]&&(clearInterval(this[_0x2fa50d(0x1c8)]),this['durationInterval']=null);}async[a0_0xa582e2(0x1f4)](){const _0x530740=a0_0xa582e2,_0x43f55a=this[_0x530740(0x1cb)][_0x530740(0x206)]+_0x530740(0x1ee)+this[_0x530740(0x1cb)]['language'],_0x3a795b=await fetch(_0x43f55a,{'method':'GET','headers':{'x-agrasya-client-api-key':this['config'][_0x530740(0x1ff)],'Content-Type':_0x530740(0x218)}});if(!_0x3a795b['ok']){const _0x50ca4e=await _0x3a795b[_0x530740(0x1e6)]()['catch'](()=>({'message':_0x3a795b[_0x530740(0x20e)]}));throw new Error(_0x530740(0x200)+(_0x50ca4e[_0x530740(0x1bb)]||_0x3a795b[_0x530740(0x20e)]));}const _0x2120b4=await _0x3a795b[_0x530740(0x1e6)]();if(!_0x2120b4['success'])throw new Error(_0x2120b4[_0x530740(0x1bb)]||_0x530740(0x1d9));return _0x2120b4['data'];}async['setupWebRTC'](_0x473485){const _0x5c8f47=a0_0xa582e2;this[_0x5c8f47(0x1e9)]=new RTCPeerConnection(),this[_0x5c8f47(0x1f7)]=this[_0x5c8f47(0x1e9)][_0x5c8f47(0x1f6)](_0x5c8f47(0x217));this[_0x5c8f47(0x1f7)]&&(this[_0x5c8f47(0x1f7)][_0x5c8f47(0x201)]=_0x17f471=>{const _0x248c47=_0x5c8f47,_0x20a33b=JSON[_0x248c47(0x216)](_0x17f471[_0x248c47(0x211)]);this['events']['onTranscript']?.(_0x20a33b);});this['peerConnection'][_0x5c8f47(0x1e0)]=_0x4b8df3=>{const _0x3ea09a=_0x5c8f47,_0x40398d=document[_0x3ea09a(0x1d4)](_0x3ea09a(0x1ed));_0x40398d[_0x3ea09a(0x203)]=_0x4b8df3[_0x3ea09a(0x1ef)][0x0],_0x40398d[_0x3ea09a(0x1dd)]=!![],document[_0x3ea09a(0x20b)][_0x3ea09a(0x1de)](_0x40398d);},this[_0x5c8f47(0x1c2)]=await navigator[_0x5c8f47(0x1c9)][_0x5c8f47(0x1e4)]({'audio':!![]});if(this['audioStream']){const _0x4fbcfe=this[_0x5c8f47(0x1c2)][_0x5c8f47(0x1c4)]()[0x0];this[_0x5c8f47(0x1e9)][_0x5c8f47(0x21a)](_0x4fbcfe,this[_0x5c8f47(0x1c2)]);}const _0x54cfb3=await this[_0x5c8f47(0x1e9)][_0x5c8f47(0x1bc)]();await this[_0x5c8f47(0x1e9)][_0x5c8f47(0x1f5)](_0x54cfb3);const _0xadaa55=this['config'][_0x5c8f47(0x206)]+_0x5c8f47(0x1fa),_0x54c9ac=await fetch(_0xadaa55,{'method':_0x5c8f47(0x210),'body':JSON[_0x5c8f47(0x1dc)]({'sessionId':this[_0x5c8f47(0x20f)],'sdp':_0x54cfb3[_0x5c8f47(0x1c0)]}),'headers':{'x-agrasya-client-api-key':this[_0x5c8f47(0x1cb)][_0x5c8f47(0x1ff)],'Content-Type':_0x5c8f47(0x218)}});if(!_0x54c9ac['ok'])throw new Error('SDP\x20exchange\x20failed:\x20'+_0x54c9ac[_0x5c8f47(0x20e)]);const _0x5a596b={'type':_0x5c8f47(0x20a),'sdp':await _0x54c9ac[_0x5c8f47(0x1f1)]()},_0xa7d79c={'type':_0x5a596b[_0x5c8f47(0x1ce)],'sdp':_0x5a596b[_0x5c8f47(0x1c0)]};await this[_0x5c8f47(0x1e9)][_0x5c8f47(0x1d2)](_0xa7d79c);}['setupSocketListeners'](_0x4d70cb){const _0x470035=a0_0xa582e2;_0x4d70cb['on'](_0x470035(0x20c),()=>{const _0x4c1f79=_0x470035;this[_0x4c1f79(0x1bf)]();}),_0x4d70cb['on'](_0x470035(0x1f9),()=>{const _0x3fc1eb=_0x470035;this[_0x3fc1eb(0x1bf)]();});}async['startVoiceSession'](_0xa46916){const _0x5cf6e=a0_0xa582e2;try{this[_0x5cf6e(0x209)](_0x5cf6e(0x20d));const _0x5637c9=await this[_0x5cf6e(0x1f4)]();this[_0x5cf6e(0x20f)]=_0x5637c9['sessionId'],this['ephKey']=_0x5637c9['ephKey'];if(!this[_0x5cf6e(0x1c3)])throw new Error(_0x5cf6e(0x1f2));const _0x228b5f=await this[_0x5cf6e(0x1fb)]();this[_0x5cf6e(0x1d1)]('Minutes\x20left:\x20'+_0x228b5f),await this[_0x5cf6e(0x1f0)](this[_0x5cf6e(0x1c3)]),this[_0x5cf6e(0x1e2)]=(0x0,import_socket[_0x5cf6e(0x205)])(this[_0x5cf6e(0x1cb)][_0x5cf6e(0x206)],{'transports':['websocket']}),this['socket'][_0x5cf6e(0x1c7)](_0x5cf6e(0x212),{'sessionId':this[_0x5cf6e(0x20f)]}),this[_0x5cf6e(0x1cd)](this['socket']),this[_0x5cf6e(0x209)]('connected'),this['startTimer']();}catch(_0x168aa6){this[_0x5cf6e(0x209)](_0x5cf6e(0x219));throw _0x168aa6;}}async[a0_0xa582e2(0x208)](){this['cleanup']();}[a0_0xa582e2(0x1bf)](){const _0x4c88d7=a0_0xa582e2;this[_0x4c88d7(0x1e9)]&&(this[_0x4c88d7(0x1e9)][_0x4c88d7(0x1eb)](),this['peerConnection']=null),this[_0x4c88d7(0x1f7)]&&(this[_0x4c88d7(0x1f7)][_0x4c88d7(0x1eb)](),this[_0x4c88d7(0x1f7)]=null),this[_0x4c88d7(0x1c2)]&&(this[_0x4c88d7(0x1c2)][_0x4c88d7(0x1c4)]()['forEach'](_0x4cafca=>_0x4cafca['stop']()),this[_0x4c88d7(0x1c2)]=null),this[_0x4c88d7(0x1e2)]&&(this['socket'][_0x4c88d7(0x20c)](),this[_0x4c88d7(0x1e2)]=null),this[_0x4c88d7(0x1e8)](),this['setStatus'](_0x4c88d7(0x1cf));}async[a0_0xa582e2(0x1fb)](){const _0x5d4645=a0_0xa582e2,_0x40791a=this[_0x5d4645(0x1cb)][_0x5d4645(0x206)]+_0x5d4645(0x1e5),_0x6ccefd=await fetch(_0x40791a,{'method':_0x5d4645(0x1ca),'headers':{'x-agrasya-client-api-key':this[_0x5d4645(0x1cb)][_0x5d4645(0x1ff)],'Content-Type':_0x5d4645(0x218)}});if(!_0x6ccefd['ok']){const _0x2f6fc7=await _0x6ccefd['json']()['catch'](()=>({'message':_0x6ccefd[_0x5d4645(0x20e)]}));throw new Error(_0x5d4645(0x1da)+(_0x2f6fc7[_0x5d4645(0x1bb)]||_0x6ccefd[_0x5d4645(0x20e)]));}const _0x5df3ad=await _0x6ccefd[_0x5d4645(0x1e6)]();if(!_0x5df3ad[_0x5d4645(0x1fc)])throw new Error(_0x5df3ad['message']||'Failed\x20to\x20fetch\x20minutes\x20usage');return _0x5df3ad[_0x5d4645(0x211)][_0x5d4645(0x1d7)];}};0x0&&(module['exports']={'AgrasyaVoiceSDK':AgrasyaVoiceSDK});
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a1_0xd835(_0x1e3c50,_0x337c69){_0x1e3c50=_0x1e3c50-0x102;const _0x39aab1=a1_0x39aa();let _0xd8353d=_0x39aab1[_0x1e3c50];return _0xd8353d;}const a1_0x41d950=a1_0xd835;(function(_0x5d51a5,_0x188c21){const _0x5af730=a1_0xd835,_0x1988a7=_0x5d51a5();while(!![]){try{const _0x515219=-parseInt(_0x5af730(0x116))/0x1*(-parseInt(_0x5af730(0x11a))/0x2)+parseInt(_0x5af730(0x10b))/0x3*(-parseInt(_0x5af730(0x106))/0x4)+-parseInt(_0x5af730(0x11e))/0x5*(parseInt(_0x5af730(0x11c))/0x6)+-parseInt(_0x5af730(0x13b))/0x7*(parseInt(_0x5af730(0x109))/0x8)+parseInt(_0x5af730(0x136))/0x9+-parseInt(_0x5af730(0x140))/0xa+parseInt(_0x5af730(0x137))/0xb*(parseInt(_0x5af730(0x132))/0xc);if(_0x515219===_0x188c21)break;else _0x1988a7['push'](_0x1988a7['shift']());}catch(_0x43e079){_0x1988a7['push'](_0x1988a7['shift']());}}}(a1_0x39aa,0xe823a));function a1_0x39aa(){const _0x1d1e13=['autoplay','36cidKwR','minutesLeft','154370cugRmM','stop','mediaDevices','setupSocketListeners','audio','baseUrl','dataUrl','sessionId','stopVoiceSession','apiKey','audioStream','/v1/agrasya/usage','error','dataChannel','srcObject','/v1/agrasya/connect','onStatusChange','ontrack','callDuration','emit','204wCDjzk','idle','json','close','5971797gtQRha','1877711KmCHgn','application/json','socket','connected','177982PUszeV','Failed\x20to\x20fetch\x20minutes\x20usage','startVoiceSession','sdp','streams','5648140trMjjv','addTrack','fetchMinutesUsage','createDataChannel','durationInterval','events','setStatus','startTimer','cleanup','log','answer','GET','peerConnection','debug','setLocalDescription','Failed\x20to\x20initialize\x20session:\x20','websocket','config','statusText','setupWebRTC','data','model','message','POST','key\x20is\x20null\x20or\x20undefined.','4jnWorP','stringify','initializing','512Nvefmy','type','4826937HpqPcI','ephKey','getTracks','forEach','http://localhost:4001','createOffer','stopTimer','disconnect','success','onTranscript','Minutes\x20left:\x20','159ufTmCB','onmessage','initializeBackendSession','catch','17254WevieP'];a1_0x39aa=function(){return _0x1d1e13;};return a1_0x39aa();}import a1_0x19e74a from'socket.io-client';var AgrasyaVoiceSDK=class{[a1_0x41d950(0x151)];['events'];[a1_0x41d950(0x14c)]=null;[a1_0x41d950(0x12b)]=null;['audioStream']=null;[a1_0x41d950(0x139)]=null;[a1_0x41d950(0x125)]=null;[a1_0x41d950(0x10c)]=null;[a1_0x41d950(0x124)]=null;[a1_0x41d950(0x102)]=null;['callDuration']=0x0;[a1_0x41d950(0x144)]=null;constructor(_0x58765f,_0x420180={}){const _0x4f345d=a1_0x41d950;this[_0x4f345d(0x151)]={'baseUrl':_0x4f345d(0x10f),'language':'','debug':![],..._0x58765f},this[_0x4f345d(0x145)]=_0x420180;}[a1_0x41d950(0x149)](..._0x45c973){const _0x40542f=a1_0x41d950;this[_0x40542f(0x151)][_0x40542f(0x14d)]&&console['log']('[AgrasyaSDK]',..._0x45c973);}['setStatus'](_0x517cb6){const _0x527f3b=a1_0x41d950;this[_0x527f3b(0x145)][_0x527f3b(0x12e)]?.(_0x517cb6);}[a1_0x41d950(0x147)](){const _0x51a551=a1_0x41d950;this[_0x51a551(0x130)]=0x0,this['durationInterval']=setInterval(()=>{const _0x2c0dd8=_0x51a551;this[_0x2c0dd8(0x130)]+=0x1,this['events']['onCallDurationUpdate']?.(this[_0x2c0dd8(0x130)]);},0x3e8);}[a1_0x41d950(0x111)](){const _0x4a30c8=a1_0x41d950;this[_0x4a30c8(0x144)]&&(clearInterval(this[_0x4a30c8(0x144)]),this[_0x4a30c8(0x144)]=null);}async[a1_0x41d950(0x118)](){const _0x750921=a1_0x41d950,_0x229371=this['config']['baseUrl']+'/v1/agrasya/client-token?language='+this[_0x750921(0x151)]['language'],_0x16d19d=await fetch(_0x229371,{'method':_0x750921(0x14b),'headers':{'x-agrasya-client-api-key':this[_0x750921(0x151)]['apiKey'],'Content-Type':_0x750921(0x138)}});if(!_0x16d19d['ok']){const _0x19f255=await _0x16d19d[_0x750921(0x134)]()[_0x750921(0x119)](()=>({'message':_0x16d19d[_0x750921(0x152)]}));throw new Error(_0x750921(0x14f)+(_0x19f255['message']||_0x16d19d[_0x750921(0x152)]));}const _0xe7838e=await _0x16d19d[_0x750921(0x134)]();if(!_0xe7838e[_0x750921(0x113)])throw new Error(_0xe7838e[_0x750921(0x103)]||'Backend\x20initialization\x20failed');return _0xe7838e['data'];}async['setupWebRTC'](_0x321af1){const _0x230d0=a1_0x41d950;this[_0x230d0(0x14c)]=new RTCPeerConnection(),this['dataChannel']=this[_0x230d0(0x14c)][_0x230d0(0x143)]('oai-events');this[_0x230d0(0x12b)]&&(this[_0x230d0(0x12b)][_0x230d0(0x117)]=_0x33bdd7=>{const _0x1a8006=_0x230d0,_0x5d82d4=JSON['parse'](_0x33bdd7[_0x1a8006(0x154)]);this['events'][_0x1a8006(0x114)]?.(_0x5d82d4);});this['peerConnection'][_0x230d0(0x12f)]=_0x32beb3=>{const _0x4121de=_0x230d0,_0x383b2c=document['createElement'](_0x4121de(0x122));_0x383b2c[_0x4121de(0x12c)]=_0x32beb3[_0x4121de(0x13f)][0x0],_0x383b2c[_0x4121de(0x11b)]=!![],document['body']['appendChild'](_0x383b2c);},this[_0x230d0(0x128)]=await navigator[_0x230d0(0x120)]['getUserMedia']({'audio':!![]});if(this[_0x230d0(0x128)]){const _0x483210=this[_0x230d0(0x128)][_0x230d0(0x10d)]()[0x0];this['peerConnection'][_0x230d0(0x141)](_0x483210,this[_0x230d0(0x128)]);}const _0x4903ce=await this['peerConnection'][_0x230d0(0x110)]();await this[_0x230d0(0x14c)][_0x230d0(0x14e)](_0x4903ce);const _0x3fedbc=this['config'][_0x230d0(0x123)]+_0x230d0(0x12d),_0x15e5e0=await fetch(_0x3fedbc,{'method':_0x230d0(0x104),'body':JSON[_0x230d0(0x107)]({'sessionId':this[_0x230d0(0x125)],'sdp':_0x4903ce[_0x230d0(0x13e)]}),'headers':{'x-agrasya-client-api-key':this[_0x230d0(0x151)]['apiKey'],'Content-Type':_0x230d0(0x138)}});if(!_0x15e5e0['ok'])throw new Error('SDP\x20exchange\x20failed:\x20'+_0x15e5e0['statusText']);const _0x5b5782={'type':_0x230d0(0x14a),'sdp':await _0x15e5e0['text']()},_0x4939ef={'type':_0x5b5782[_0x230d0(0x10a)],'sdp':_0x5b5782[_0x230d0(0x13e)]};await this[_0x230d0(0x14c)]['setRemoteDescription'](_0x4939ef);}[a1_0x41d950(0x121)](_0x4cc384){const _0xea81c2=a1_0x41d950;_0x4cc384['on'](_0xea81c2(0x112),()=>{const _0x21455c=_0xea81c2;this[_0x21455c(0x148)]();}),_0x4cc384['on']('session_ended',()=>{const _0x68a85b=_0xea81c2;this[_0x68a85b(0x148)]();});}async[a1_0x41d950(0x13d)](_0x7248de){const _0x4af00f=a1_0x41d950;try{this[_0x4af00f(0x146)](_0x4af00f(0x108));const _0x54ff32=await this[_0x4af00f(0x118)]();this[_0x4af00f(0x125)]=_0x54ff32[_0x4af00f(0x125)],this[_0x4af00f(0x10c)]=_0x54ff32[_0x4af00f(0x10c)];if(!this['ephKey'])throw new Error(_0x4af00f(0x105));const _0x4df3b1=await this[_0x4af00f(0x142)]();this[_0x4af00f(0x149)](_0x4af00f(0x115)+_0x4df3b1),await this[_0x4af00f(0x153)](this[_0x4af00f(0x10c)]),this[_0x4af00f(0x139)]=a1_0x19e74a(this['config'][_0x4af00f(0x123)],{'transports':[_0x4af00f(0x150)]}),this[_0x4af00f(0x139)][_0x4af00f(0x131)]('join_session',{'sessionId':this[_0x4af00f(0x125)]}),this['setupSocketListeners'](this[_0x4af00f(0x139)]),this['setStatus'](_0x4af00f(0x13a)),this['startTimer']();}catch(_0x31d71c){this[_0x4af00f(0x146)](_0x4af00f(0x12a));throw _0x31d71c;}}async[a1_0x41d950(0x126)](){const _0xc3c798=a1_0x41d950;this[_0xc3c798(0x148)]();}[a1_0x41d950(0x148)](){const _0x2021db=a1_0x41d950;this[_0x2021db(0x14c)]&&(this['peerConnection'][_0x2021db(0x135)](),this['peerConnection']=null),this[_0x2021db(0x12b)]&&(this[_0x2021db(0x12b)]['close'](),this[_0x2021db(0x12b)]=null),this[_0x2021db(0x128)]&&(this[_0x2021db(0x128)]['getTracks']()[_0x2021db(0x10e)](_0x221650=>_0x221650[_0x2021db(0x11f)]()),this[_0x2021db(0x128)]=null),this[_0x2021db(0x139)]&&(this['socket'][_0x2021db(0x112)](),this[_0x2021db(0x139)]=null),this[_0x2021db(0x111)](),this[_0x2021db(0x146)](_0x2021db(0x133));}async[a1_0x41d950(0x142)](){const _0x4dbcbe=a1_0x41d950,_0x2dd6c8=this[_0x4dbcbe(0x151)][_0x4dbcbe(0x123)]+_0x4dbcbe(0x129),_0x15838=await fetch(_0x2dd6c8,{'method':_0x4dbcbe(0x14b),'headers':{'x-agrasya-client-api-key':this[_0x4dbcbe(0x151)][_0x4dbcbe(0x127)],'Content-Type':'application/json'}});if(!_0x15838['ok']){const _0x283cd2=await _0x15838['json']()[_0x4dbcbe(0x119)](()=>({'message':_0x15838[_0x4dbcbe(0x152)]}));throw new Error('Failed\x20to\x20fetch\x20minutes\x20usage:\x20'+(_0x283cd2[_0x4dbcbe(0x103)]||_0x15838[_0x4dbcbe(0x152)]));}const _0x1366ae=await _0x15838[_0x4dbcbe(0x134)]();if(!_0x1366ae['success'])throw new Error(_0x1366ae[_0x4dbcbe(0x103)]||_0x4dbcbe(0x13c));return _0x1366ae['data'][_0x4dbcbe(0x11d)];}};export{AgrasyaVoiceSDK};
|