@snapcall/stream-ui 1.4.0 → 1.4.1

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.
@@ -591,7 +591,7 @@ class $c31e3fb4360572af$export$2e2bcd8739ae039 extends $c31e3fb4360572af$var$Str
591
591
  streamerApi: String("https://g.snapcall.io/stream"),
592
592
  iceServers: [
593
593
  {
594
- urls: "turns:t.snapcall.io:443?transport=tcp,turns:t2.snapcall.io:443?transport=tcp"?.split(",") || [],
594
+ urls: "turns:t.snapcall.io:443?transport=tcp,turns:t2.snapcall.io:443?transport=tcp,turn:t.snapcall.io:80?transport=tcp,turn:t2.snapcall.io:80?transport=tcp,turn:t.snapcall.io:80?transport=udp,turn:t2.snapcall.io:80?transport=udp"?.split(",") || [],
595
595
  username: "test",
596
596
  credential: "test",
597
597
  credentialType: "password"
package/dist/stream-ui.js CHANGED
@@ -599,7 +599,7 @@ class $1dedebd5ff3002eb$export$2e2bcd8739ae039 extends $1dedebd5ff3002eb$var$Str
599
599
  streamerApi: String("https://g.snapcall.io/stream"),
600
600
  iceServers: [
601
601
  {
602
- urls: "turns:t.snapcall.io:443?transport=tcp,turns:t2.snapcall.io:443?transport=tcp"?.split(",") || [],
602
+ urls: "turns:t.snapcall.io:443?transport=tcp,turns:t2.snapcall.io:443?transport=tcp,turn:t.snapcall.io:80?transport=tcp,turn:t2.snapcall.io:80?transport=tcp,turn:t.snapcall.io:80?transport=udp,turn:t2.snapcall.io:80?transport=udp"?.split(",") || [],
603
603
  username: "test",
604
604
  credential: "test",
605
605
  credentialType: "password"
@@ -132,7 +132,7 @@ object-assign
132
132
  /*! iNoBounce - v0.2.0
133
133
  * https://github.com/lazd/iNoBounce/
134
134
  * Copyright (c) 2013 Larry Davis <lazdnet@gmail.com>; Licensed BSD */
135
- !function(e){var t=0,r=!1,n=!1;try{var i=Object.defineProperty({},"passive",{get:function(){n=!0}});window.addEventListener("test",null,i)}catch(e){}var a=function(e){var r=e.target,n=window.innerWidth/window.document.documentElement.clientWidth;if(!(e.touches.length>1||1!==n)){for(;r!==document.body&&r!==document;){var i=window.getComputedStyle(r);if(!i)break;if("INPUT"===r.nodeName&&"range"===r.getAttribute("type"))return;var a=i.getPropertyValue("-webkit-overflow-scrolling"),s=i.getPropertyValue("overflow-y"),o=parseInt(i.getPropertyValue("height"),10),c="touch"===a&&("auto"===s||"scroll"===s),l=r.scrollHeight>r.offsetHeight;if(c&&l){var d=e.touches?e.touches[0].screenY:e.screenY,u=t<=d&&0===r.scrollTop,p=t>=d&&r.scrollHeight-r.scrollTop===o;return void((u||p)&&e.preventDefault())}r=r.parentNode}e.preventDefault()}},s=function(e){t=e.touches?e.touches[0].screenY:e.screenY},o=function(){window.addEventListener("touchstart",s,!!n&&{passive:!1}),window.addEventListener("touchmove",a,!!n&&{passive:!1}),r=!0},c=document.createElement("div");document.documentElement.appendChild(c),c.style.WebkitOverflowScrolling="touch";var l="getComputedStyle"in window&&"touch"===window.getComputedStyle(c)["-webkit-overflow-scrolling"];document.documentElement.removeChild(c),l&&o();var d={enable:o,disable:function(){window.removeEventListener("touchstart",s,!1),window.removeEventListener("touchmove",a,!1),r=!1},isEnabled:function(){return r},isScrollSupported:l};Lr&&(Lr=d),"function"==typeof e.define?(0,e.define)("iNoBounce",[],(function(){return d})):e.iNoBounce=d}(Lr);d=a("85Hg2");var Ar,Nr=a("4Fy4N"),Fr=new Uint8Array(16);function zr(){if(!Ar&&!(Ar="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ar(Fr)}var Br=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;for(var Ur=function(e){return"string"==typeof e&&Br.test(e)},Vr=[],Hr=0;Hr<256;++Hr)Vr.push((Hr+256).toString(16).substr(1));var Wr=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(Vr[e[t+0]]+Vr[e[t+1]]+Vr[e[t+2]]+Vr[e[t+3]]+"-"+Vr[e[t+4]]+Vr[e[t+5]]+"-"+Vr[e[t+6]]+Vr[e[t+7]]+"-"+Vr[e[t+8]]+Vr[e[t+9]]+"-"+Vr[e[t+10]]+Vr[e[t+11]]+Vr[e[t+12]]+Vr[e[t+13]]+Vr[e[t+14]]+Vr[e[t+15]]).toLowerCase();if(!Ur(r))throw TypeError("Stringified UUID is invalid");return r};var qr,$r,Gr,Zr=function(e,t,r){var n=(e=e||{}).random||(e.rng||zr)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(var i=0;i<16;++i)t[r+i]=n[i];return t}return Wr(n)},Kr=JSON.parse('{"name":"protoo-client","version":"4.0.6","description":"protoo JavaScript client module","author":"Iñaki Baz Castillo <ibc@aliax.net>","homepage":"https://protoo.versatica.com","license":"MIT","repository":{"type":"git","url":"https://github.com/ibc/protoo.git"},"main":"lib/index.js","keywords":["nodejs","browser","websocket"],"engines":{"node":">=8.0.0"},"scripts":{"lint":"eslint -c .eslintrc.js lib"},"dependencies":{"debug":"^4.3.1","events":"^3.2.0","retry":"^0.12.0"},"devDependencies":{"eslint":"^5.16.0"},"optionalDependencies":{"websocket":"^1.0.33"}}').version,Qr={},Yr=a("hZG0u");const Jr="protoo-client";Qr=class{constructor(e){e?(this._debug=Yr(`protoo-client:${e}`),this._warn=Yr(`protoo-client:WARN:${e}`),this._error=Yr(`protoo-client:ERROR:${e}`)):(this._debug=Yr(Jr),this._warn=Yr("protoo-client:WARN"),this._error=Yr("protoo-client:ERROR")),this._debug.log=console.info.bind(console),this._warn.log=console.warn.bind(console),this._error.log=console.error.bind(console)}get debug(){return this._debug}get warn(){return this._warn}get error(){return this._error}};var Xr,en=a("3oV8N").EventEmitter;Xr=class extends en{constructor(e){super(),this.setMaxListeners(1/0),this._logger=e||new Qr("EnhancedEventEmitter")}safeEmit(e,...t){try{this.emit(e,...t)}catch(t){this._logger.error("safeEmit() | event listener threw an error [event:%s]:%o",e,t)}}async safeEmitAsPromise(e,...t){return new Promise(((r,n)=>{this.safeEmit(e,...t,r,n)}))}};var tn={},rn=function(){return Math.round(1e7*Math.random())};const nn=new Qr("Message");tn=class{static parse(e){let t;const r={};try{t=JSON.parse(e)}catch(e){return void nn.error("parse() | invalid JSON: %s",e)}if("object"==typeof t&&!Array.isArray(t)){if(t.request){if(r.request=!0,"string"!=typeof t.method)return void nn.error("parse() | missing/invalid method field");if("number"!=typeof t.id)return void nn.error("parse() | missing/invalid id field");r.id=t.id,r.method=t.method,r.data=t.data||{}}else if(t.response){if(r.response=!0,"number"!=typeof t.id)return void nn.error("parse() | missing/invalid id field");r.id=t.id,t.ok?(r.ok=!0,r.data=t.data||{}):(r.ok=!1,r.errorCode=t.errorCode,r.errorReason=t.errorReason)}else{if(!t.notification)return void nn.error("parse() | missing request/response field");if(r.notification=!0,"string"!=typeof t.method)return void nn.error("parse() | missing/invalid method field");r.method=t.method,r.data=t.data||{}}return r}nn.error("parse() | not an object")}static createRequest(e,t){return{request:!0,id:rn(),method:e,data:t||{}}}static createSuccessResponse(e,t){return{response:!0,id:e.id,ok:!0,data:t||{}}}static createErrorResponse(e,t,r){return{response:!0,id:e.id,ok:!1,errorCode:t,errorReason:r}}static createNotification(e,t){return{notification:!0,method:e,data:t||{}}}};const an=new Qr("Peer");Gr=class extends Xr{constructor(e){super(an),an.debug("constructor()"),this._closed=!1,this._transport=e,this._connected=!1,this._data={},this._sents=new Map,this._handleTransport()}get closed(){return this._closed}get connected(){return this._connected}get data(){return this._data}set data(e){throw new Error("cannot override data object")}close(){if(!this._closed){an.debug("close()"),this._closed=!0,this._connected=!1,this._transport.close();for(const e of this._sents.values())e.close();this.safeEmit("close")}}async request(e,t){const r=tn.createRequest(e,t);return this._logger.debug("request() [method:%s, id:%s]",e,r.id),await this._transport.send(r),new Promise(((e,t)=>{const n=1500*(15+.1*this._sents.size),i={id:r.id,method:r.method,resolve:t=>{this._sents.delete(r.id)&&(clearTimeout(i.timer),e(t))},reject:e=>{this._sents.delete(r.id)&&(clearTimeout(i.timer),t(e))},timer:setTimeout((()=>{this._sents.delete(r.id)&&t(new Error("request timeout"))}),n),close:()=>{clearTimeout(i.timer),t(new Error("peer closed"))}};this._sents.set(r.id,i)}))}async notify(e,t){const r=tn.createNotification(e,t);this._logger.debug("notify() [method:%s]",e),await this._transport.send(r)}_handleTransport(){if(this._transport.closed)return this._closed=!0,void setTimeout((()=>{this._closed||(this._connected=!1,this.safeEmit("close"))}));this._transport.on("open",(()=>{this._closed||(an.debug('emit "open"'),this._connected=!0,this.safeEmit("open"))})),this._transport.on("disconnected",(()=>{this._closed||(an.debug('emit "disconnected"'),this._connected=!1,this.safeEmit("disconnected"))})),this._transport.on("failed",(e=>{this._closed||(an.debug('emit "failed" [currentAttempt:%s]',e),this._connected=!1,this.safeEmit("failed",e))})),this._transport.on("close",(()=>{this._closed||(this._closed=!0,an.debug('emit "close"'),this._connected=!1,this.safeEmit("close"))})),this._transport.on("message",(e=>{e.request?this._handleRequest(e):e.response?this._handleResponse(e):e.notification&&this._handleNotification(e)}))}_handleRequest(e){try{this.emit("request",e,(t=>{const r=tn.createSuccessResponse(e,t);this._transport.send(r).catch((()=>{}))}),((t,r)=>{t instanceof Error?(r=t.message,t=500):"number"==typeof t&&r instanceof Error&&(r=r.message);const n=tn.createErrorResponse(e,t,r);this._transport.send(n).catch((()=>{}))}))}catch(t){const r=tn.createErrorResponse(e,500,String(t));this._transport.send(r).catch((()=>{}))}}_handleResponse(e){const t=this._sents.get(e.id);if(t)if(e.ok)t.resolve(e.data);else{const r=new Error(e.errorReason);r.code=e.errorCode,t.reject(r)}else an.error("received response does not match any sent request [id:%s]",e.id)}_handleNotification(e){this.safeEmit("notification",e)}};var sn;if("object"==typeof globalThis)sn=globalThis;else try{sn=a("jCEG4")}catch(e){}finally{if(sn||"undefined"==typeof window||(sn=window),!sn)throw new Error("Could not determine global this")}var on,cn=sn.WebSocket||sn.MozWebSocket;function ln(e,t){return t?new cn(e,t):new cn(e)}on=a("kUMHr").version,cn&&["CONNECTING","OPEN","CLOSING","CLOSED"].forEach((function(e){Object.defineProperty(ln,e,{get:function(){return cn[e]}})}));var dn={w3cwebsocket:cn?ln:null,version:on}.w3cwebsocket,un={};un=a("jxXWz");const pn={retries:10,factor:2,minTimeout:1e3,maxTimeout:8e3},hn=new Qr("WebSocketTransport");qr=Gr,$r=class extends Xr{constructor(e,t){super(hn),hn.debug("constructor() [url:%s, options:%o]",e,t),this._closed=!1,this._url=e,this._options=t||{},this._ws=null,this._runWebSocket()}get closed(){return this._closed}close(){if(!this._closed){hn.debug("close()"),this._closed=!0,this.safeEmit("close");try{this._ws.onopen=null,this._ws.onclose=null,this._ws.onerror=null,this._ws.onmessage=null,this._ws.close()}catch(e){hn.error("close() | error closing the WebSocket: %o",e)}}}async send(e){if(this._closed)throw new Error("transport closed");try{this._ws.send(JSON.stringify(e))}catch(e){throw hn.warn("send() failed:%o",e),e}}_runWebSocket(){const e=un.operation(this._options.retry||pn);let t=!1;e.attempt((r=>{this._closed?e.stop():(hn.debug("_runWebSocket() [currentAttempt:%s]",r),this._ws=new dn(this._url,"protoo",this._options.origin,this._options.headers,this._options.requestOptions,this._options.clientConfig),this._ws.onopen=()=>{this._closed||(t=!0,this.safeEmit("open"))},this._ws.onclose=n=>{if(!this._closed){if(hn.warn('WebSocket "close" event [wasClean:%s, code:%s, reason:"%s"]',n.wasClean,n.code,n.reason),4e3!==n.code){if(t){if(e.stop(),this.safeEmit("disconnected"),this._closed)return;return void this._runWebSocket()}if(this.safeEmit("failed",r),this._closed)return;if(e.retry(!0))return}this._closed=!0,this.safeEmit("close")}},this._ws.onerror=()=>{this._closed||hn.error('WebSocket "error" event')},this._ws.onmessage=e=>{if(this._closed)return;const t=tn.parse(e.data);t&&(0!==this.listenerCount("message")?this.safeEmit("message",t):hn.error('no listeners for WebSocket "message" event, ignoring received message'))})}))}};var fn={},mn=fn&&fn.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),gn=fn&&fn.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),vn=fn&&fn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&mn(t,e,r);return gn(t,e),t},yn=fn&&fn.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(fn,"__esModule",{value:!0}),fn.debug=fn.parseScalabilityMode=fn.detectDevice=fn.Device=fn.version=fn.types=void 0;const bn=yn(a("hZG0u"));fn.debug=bn.default;var wn=a("1ZHQC");Object.defineProperty(fn,"Device",{enumerable:!0,get:function(){return wn.Device}}),Object.defineProperty(fn,"detectDevice",{enumerable:!0,get:function(){return wn.detectDevice}});const xn=vn(a("cQumC"));fn.types=xn,fn.version="3.6.53";var _n=a("fT1lN");Object.defineProperty(fn,"parseScalabilityMode",{enumerable:!0,get:function(){return _n.parse}});const Sn=window.AudioContext||window.webkitAudioContext;class kn{speakStartEventTime=0;speakStopEventTime=0;speaking=!1;audioMedianInterval=-1;audioLevelInterval=-1;audioLevels=[];constructor(e,t){this.id=e.id,this.listener=t,this.stream=e,this.audioContext=new Sn,this.analyser=this.audioContext.createAnalyser(),this.audioStreamSource=this.audioContext.createMediaStreamSource(this.stream),this.analyser.fftSize=32,this.analyser.minDecibels=-90,this.analyser.maxDecibels=-10,this.audioStreamSource.connect(this.analyser)}getAudioLevelMedian(){const{length:e}=this.audioLevels;return this.audioLevels.reduce(((e,t)=>e+t),0)/e}getCurrentAudioLevel(){const{length:e}=this.audioLevels;return e?this.audioLevels[e-1]:0}audioMuteDetection(){0===this.getAudioLevelMedian()&&this.audioLevels.length>0&&this.listener?.onMuteDetection?.(this.id)}detectSpeakingChange(e){e<20&&!this.speakStopEventTime&&(this.speakStartEventTime=0,this.speakStopEventTime=Date.now()),e>=20&&!this.speakStartEventTime&&(this.speakStartEventTime=Date.now(),this.speakStopEventTime=0);const t=this.speakStartEventTime||this.speakStopEventTime,r=Boolean(this.speakStartEventTime);(Date.now()-t>500&&r||Date.now()-t>300&&!r)&&this.speaking!==r&&(this.speaking=r,r?this.listener?.onStartSpeak():this.listener?.onStopSpeak())}computeRMS(e){let t=0;for(let r=0;r<e.length;r++)t+=e[r]*e[r];return t/=e.length,Math.sqrt(t)}getInstantAudioLevel(){const e=new Uint8Array(this.analyser.frequencyBinCount);this.analyser.getByteFrequencyData(e);const t=this.computeRMS(e);return t>0?100*t/255:0}loopCalcul(){const e=this.getInstantAudioLevel();this.audioLevels=this.audioLevels.splice(-59),this.detectSpeakingChange(e),this.audioLevels.push(e),this.listener?.onAudioLevel?.(e,this.id)}analyse(){this.audioLevelInterval=window.setInterval((()=>this.loopCalcul()),1e3/60),this.audioMedianInterval=window.setInterval((()=>this.audioMuteDetection()),2e3)}release(){this.listener=void 0,clearInterval(this.audioLevelInterval),clearInterval(this.audioMedianInterval),this.stream.getTracks().forEach((e=>{this.stream.removeTrack(e)}));try{this.audioStreamSource.disconnect(this.analyser)}catch(e){console.error("audioStreamSource failed to disconnect",e)}this.audioContext.close().catch((e=>{console.error("audioContext failed to close",e)})),this.audioLevels=[]}static isAPIAvailable(){return!!Sn}}var En=class{constructor({consumerId:e}){this.consumerId=e,this.audio=new Audio,this.audio.id=e,this.audio.autoplay=!0,document.body.appendChild(this.audio)}destroy(){this.audio.pause(),this.audio.srcObject=null,document.body.removeChild(this.audio)}setSource(e){this.audio.srcObject=e}async setSink(e){await(this.audio.setSinkId?.(e))}async play(){await this.audio.play().catch((e=>{console.warn("failed to play"),setTimeout((()=>{this.play()}),1e3)}))}},Cn={};e(Cn,"FunctionToString",(()=>Gn)),e(Cn,"InboundFilters",(()=>Kn));var Rn=Object.prototype.toString;function Pn(e,t){return Rn.call(e)===`[object ${t}]`}function Tn(e){return Pn(e,"String")}function jn(e){return Pn(e,"Object")}function Mn(e){return Boolean(e&&e.then&&"function"==typeof e.then)}var In=(0,(Nn=a("bWPEY")).getGlobalObject)(),Dn=["debug","info","warn","error","log","assert","trace"];function On(e){var t=(0,Nn.getGlobalObject)();if(!("console"in t))return e();var r=t.console,n={};Dn.forEach((e=>{var i=r[e]&&r[e].__sentry_original__;e in t.console&&i&&(n[e]=r[e],r[e]=i)}));try{return e()}finally{Object.keys(n).forEach((e=>{r[e]=n[e]}))}}function Ln(){let e=!1;var t={enable:()=>{e=!0},disable:()=>{e=!1}};return"undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__?Dn.forEach((r=>{t[r]=(...t)=>{e&&On((()=>{In.console[r](`Sentry Logger [${r}]:`,...t)}))}})):Dn.forEach((e=>{t[e]=()=>{}})),t}let An;An="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__?(0,Nn.getGlobalSingleton)("logger",Ln):Ln();var Nn=a("bWPEY");Nn=a("bWPEY");function Fn(e,t){return!!Tn(e)&&(Pn(t,"RegExp")?t.test(e):"string"==typeof t&&-1!==e.indexOf(t))}function zn(e){return Bn(e,new Map)}function Bn(e,t){if(jn(e)){if(void 0!==(i=t.get(e)))return i;var r={};for(var n of(t.set(e,r),Object.keys(e)))void 0!==e[n]&&(r[n]=Bn(e[n],t));return r}if(Array.isArray(e)){var i;if(void 0!==(i=t.get(e)))return i;r=[];return t.set(e,r),e.forEach((e=>{r.push(Bn(e,t))})),r}return e}function Un(){var e=(0,Nn.getGlobalObject)(),t=e.crypto||e.msCrypto;if(void 0!==t&&t.getRandomValues){var r=new Uint16Array(8);t.getRandomValues(r),r[3]=4095&r[3]|16384,r[4]=16383&r[4]|32768;var n=e=>{let t=e.toString(16);for(;t.length<4;)t=`0${t}`;return t};return n(r[0])+n(r[1])+n(r[2])+n(r[3])+n(r[4])+n(r[5])+n(r[6])+n(r[7])}return"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,(e=>{var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))}function Vn(e){return e.exception&&e.exception.values?e.exception.values[0]:void 0}function Hn(e){const{message:t,event_id:r}=e;if(t)return t;var n=Vn(e);return n?n.type&&n.value?`${n.type}: ${n.value}`:n.type||n.value||r||"<unknown>":r||"<unknown>"}var Wn;!function(e){e[e.PENDING=0]="PENDING";e[e.RESOLVED=1]="RESOLVED";e[e.REJECTED=2]="REJECTED"}(Wn||(Wn={}));class qn{__init(){this._state=Wn.PENDING}__init2(){this._handlers=[]}constructor(e){qn.prototype.__init.call(this),qn.prototype.__init2.call(this),qn.prototype.__init3.call(this),qn.prototype.__init4.call(this),qn.prototype.__init5.call(this),qn.prototype.__init6.call(this);try{e(this._resolve,this._reject)}catch(e){this._reject(e)}}then(e,t){return new qn(((r,n)=>{this._handlers.push([!1,t=>{if(e)try{r(e(t))}catch(e){n(e)}else r(t)},e=>{if(t)try{r(t(e))}catch(e){n(e)}else n(e)}]),this._executeHandlers()}))}catch(e){return this.then((e=>e),e)}finally(e){return new qn(((t,r)=>{let n,i;return this.then((t=>{i=!1,n=t,e&&e()}),(t=>{i=!0,n=t,e&&e()})).then((()=>{i?r(n):t(n)}))}))}__init3(){this._resolve=e=>{this._setResult(Wn.RESOLVED,e)}}__init4(){this._reject=e=>{this._setResult(Wn.REJECTED,e)}}__init5(){this._setResult=(e,t)=>{this._state===Wn.PENDING&&(Mn(t)?t.then(this._resolve,this._reject):(this._state=e,this._value=t,this._executeHandlers()))}}__init6(){this._executeHandlers=()=>{if(this._state!==Wn.PENDING){var e=this._handlers.slice();this._handlers=[],e.forEach((e=>{e[0]||(this._state===Wn.RESOLVED&&e[1](this._value),this._state===Wn.REJECTED&&e[2](this._value),e[0]=!0)}))}}}}let $n;class Gn{constructor(){Gn.prototype.__init.call(this)}static __initStatic(){this.id="FunctionToString"}__init(){this.name=Gn.id}setupOnce(){$n=Function.prototype.toString,Function.prototype.toString=function(...e){var t=this.__sentry_original__||this;return $n.apply(t,e)}}}Gn.__initStatic();var Zn=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/];class Kn{static __initStatic(){this.id="InboundFilters"}__init(){this.name=Kn.id}constructor(e={}){this._options=e,Kn.prototype.__init.call(this)}setupOnce(e,t){var r=e=>{var r=t();if(r){var n=r.getIntegration(Kn);if(n){var i=r.getClient(),a=i?i.getOptions():{},s=function(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...Zn],ignoreInternal:void 0===e.ignoreInternal||e.ignoreInternal}}(n._options,a);return function(e,t){if(t.ignoreInternal&&function(e){try{return"SentryError"===e.exception.values[0].type}catch(e){}return!1}(e))return("undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__)&&An.warn(`Event dropped due to being internal Sentry Error.\nEvent: ${Hn(e)}`),!0;if(function(e,t){return!(!t||!t.length)&&function(e){if(e.message)return[e.message];if(e.exception)try{const{type:t="",value:r=""}=e.exception.values&&e.exception.values[0]||{};return[`${r}`,`${t}: ${r}`]}catch(t){return("undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__)&&An.error(`Cannot extract message for event ${Hn(e)}`),[]}return[]}(e).some((e=>t.some((t=>Fn(e,t)))))}(e,t.ignoreErrors))return("undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__)&&An.warn(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${Hn(e)}`),!0;if(function(e,t){if(!t||!t.length)return!1;var r=Qn(e);return!!r&&t.some((e=>Fn(r,e)))}(e,t.denyUrls))return("undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__)&&An.warn(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${Hn(e)}.\nUrl: ${Qn(e)}`),!0;if(!function(e,t){if(!t||!t.length)return!0;var r=Qn(e);return!r||t.some((e=>Fn(r,e)))}(e,t.allowUrls))return("undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__)&&An.warn(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${Hn(e)}.\nUrl: ${Qn(e)}`),!0;return!1}(e,s)?null:e}}return e};r.id=this.name,e(r)}}function Qn(e){try{let t;try{t=e.exception.values[0].stacktrace.frames}catch(e){}return t?function(e=[]){for(let r=e.length-1;r>=0;r--){var t=e[r];if(t&&"<anonymous>"!==t.filename&&"[native code]"!==t.filename)return t.filename||null}return null}(t):null}catch(t){return("undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__)&&An.error(`Cannot extract url for event ${Hn(e)}`),null}}Kn.__initStatic();var Yn=a("gTODe"),Jn=(Nn=a("bWPEY"),a("hLvaX"));a("gTODe"),Nn=a("bWPEY"),Yn=a("gTODe");function Xn(e){var t=(0,Yn.timestampInSeconds)(),r={sid:Un(),init:!0,timestamp:t,started:t,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>function(e){return zn({sid:`${e.sid}`,init:e.init,started:new Date(1e3*e.started).toISOString(),timestamp:new Date(1e3*e.timestamp).toISOString(),status:e.status,errors:e.errors,did:"number"==typeof e.did||"string"==typeof e.did?`${e.did}`:void 0,duration:e.duration,attrs:{release:e.release,environment:e.environment,ip_address:e.ipAddress,user_agent:e.userAgent}})}(r)};return e&&ei(r,e),r}function ei(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),e.did||t.did||(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||(0,Yn.timestampInSeconds)(),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=32===t.sid.length?t.sid:Un()),void 0!==t.init&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),"number"==typeof t.started&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if("number"==typeof t.duration)e.duration=t.duration;else{var r=e.timestamp-e.started;e.duration=r>=0?r:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),"number"==typeof t.errors&&(e.errors=t.errors),t.status&&(e.status=t.status)}function ti(e,t){let r={};t?r={status:t}:"ok"===e.status&&(r={status:"exited"}),ei(e,r)}class ri{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={}}static clone(e){var t=new ri;return e&&(t._breadcrumbs=[...e._breadcrumbs],t._tags={...e._tags},t._extra={...e._extra},t._contexts={...e._contexts},t._user=e._user,t._level=e._level,t._span=e._span,t._session=e._session,t._transactionName=e._transactionName,t._fingerprint=e._fingerprint,t._eventProcessors=[...e._eventProcessors],t._requestSession=e._requestSession,t._attachments=[...e._attachments]),t}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{},this._session&&ei(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(e){return this._requestSession=e,this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,t){return this._tags={...this._tags,[e]:t},this._notifyScopeListeners(),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,t){return this._extra={...this._extra,[e]:t},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,t){return null===t?delete this._contexts[e]:this._contexts={...this._contexts,[e]:t},this._notifyScopeListeners(),this}setSpan(e){return this._span=e,this._notifyScopeListeners(),this}getSpan(){return this._span}getTransaction(){var e=this.getSpan();return e&&e.transaction}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;if("function"==typeof e){var t=e(this);return t instanceof ri?t:this}return e instanceof ri?(this._tags={...this._tags,...e._tags},this._extra={...this._extra,...e._extra},this._contexts={...this._contexts,...e._contexts},e._user&&Object.keys(e._user).length&&(this._user=e._user),e._level&&(this._level=e._level),e._fingerprint&&(this._fingerprint=e._fingerprint),e._requestSession&&(this._requestSession=e._requestSession)):jn(e)&&(this._tags={...this._tags,...e.tags},this._extra={...this._extra,...e.extra},this._contexts={...this._contexts,...e.contexts},e.user&&(this._user=e.user),e.level&&(this._level=e.level),e.fingerprint&&(this._fingerprint=e.fingerprint),e.requestSession&&(this._requestSession=e.requestSession)),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._span=void 0,this._session=void 0,this._notifyScopeListeners(),this._attachments=[],this}addBreadcrumb(e,t){var r="number"==typeof t?Math.min(t,100):100;if(r<=0)return this;var n={timestamp:(0,Yn.dateTimestampInSeconds)(),...e};return this._breadcrumbs=[...this._breadcrumbs,n].slice(-r),this._notifyScopeListeners(),this}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}getAttachments(){return this._attachments}clearAttachments(){return this._attachments=[],this}applyToEvent(e,t={}){if(this._extra&&Object.keys(this._extra).length&&(e.extra={...this._extra,...e.extra}),this._tags&&Object.keys(this._tags).length&&(e.tags={...this._tags,...e.tags}),this._user&&Object.keys(this._user).length&&(e.user={...this._user,...e.user}),this._contexts&&Object.keys(this._contexts).length&&(e.contexts={...this._contexts,...e.contexts}),this._level&&(e.level=this._level),this._transactionName&&(e.transaction=this._transactionName),this._span){e.contexts={trace:this._span.getTraceContext(),...e.contexts};var r=this._span.transaction&&this._span.transaction.name;r&&(e.tags={transaction:r,...e.tags})}return this._applyFingerprint(e),e.breadcrumbs=[...e.breadcrumbs||[],...this._breadcrumbs],e.breadcrumbs=e.breadcrumbs.length>0?e.breadcrumbs:void 0,e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...this._sdkProcessingMetadata},this._notifyEventProcessors([...ni(),...this._eventProcessors],e,t)}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata={...this._sdkProcessingMetadata,...e},this}_notifyEventProcessors(e,t,r,n=0){return new qn(((i,a)=>{var s=e[n];if(null===t||"function"!=typeof s)i(t);else{var o=s({...t},r);("undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__)&&s.id&&null===o&&An.log(`Event processor "${s.id}" dropped event`),Mn(o)?o.then((t=>this._notifyEventProcessors(e,t,r,n+1).then(i))).then(null,a):this._notifyEventProcessors(e,o,r,n+1).then(i).then(null,a)}}))}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach((e=>{e(this)})),this._notifyingListeners=!1)}_applyFingerprint(e){e.fingerprint=e.fingerprint?Array.isArray(e.fingerprint)?e.fingerprint:[e.fingerprint]:[],this._fingerprint&&(e.fingerprint=e.fingerprint.concat(this._fingerprint)),e.fingerprint&&!e.fingerprint.length&&delete e.fingerprint}}function ni(){return(0,Nn.getGlobalSingleton)("globalEventProcessors",(()=>[]))}var ii=100;class ai{__init(){this._stack=[{}]}constructor(e,t=new ri,r=4){this._version=r,ai.prototype.__init.call(this),this.getStackTop().scope=t,e&&this.bindClient(e)}isOlderThan(e){return this._version<e}bindClient(e){this.getStackTop().client=e,e&&e.setupIntegrations&&e.setupIntegrations()}pushScope(){var e=ri.clone(this.getScope());return this.getStack().push({client:this.getClient(),scope:e}),e}popScope(){return!(this.getStack().length<=1)&&!!this.getStack().pop()}withScope(e){var t=this.pushScope();try{e(t)}finally{this.popScope()}}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getStack(){return this._stack}getStackTop(){return this._stack[this._stack.length-1]}captureException(e,t){var r=this._lastEventId=t&&t.event_id?t.event_id:Un(),n=new Error("Sentry syntheticException");return this._withClient(((i,a)=>{i.captureException(e,{originalException:e,syntheticException:n,...t,event_id:r},a)})),r}captureMessage(e,t,r){var n=this._lastEventId=r&&r.event_id?r.event_id:Un(),i=new Error(e);return this._withClient(((a,s)=>{a.captureMessage(e,t,{originalException:e,syntheticException:i,...r,event_id:n},s)})),n}captureEvent(e,t){var r=t&&t.event_id?t.event_id:Un();return"transaction"!==e.type&&(this._lastEventId=r),this._withClient(((n,i)=>{n.captureEvent(e,{...t,event_id:r},i)})),r}lastEventId(){return this._lastEventId}addBreadcrumb(e,t){const{scope:r,client:n}=this.getStackTop();if(!r||!n)return;const{beforeBreadcrumb:i=null,maxBreadcrumbs:a=ii}=n.getOptions&&n.getOptions()||{};if(!(a<=0)){var s={timestamp:(0,Yn.dateTimestampInSeconds)(),...e},o=i?On((()=>i(s,t))):s;null!==o&&r.addBreadcrumb(o,a)}}setUser(e){var t=this.getScope();t&&t.setUser(e)}setTags(e){var t=this.getScope();t&&t.setTags(e)}setExtras(e){var t=this.getScope();t&&t.setExtras(e)}setTag(e,t){var r=this.getScope();r&&r.setTag(e,t)}setExtra(e,t){var r=this.getScope();r&&r.setExtra(e,t)}setContext(e,t){var r=this.getScope();r&&r.setContext(e,t)}configureScope(e){const{scope:t,client:r}=this.getStackTop();t&&r&&e(t)}run(e){var t=oi(this);try{e(this)}finally{oi(t)}}getIntegration(e){var t=this.getClient();if(!t)return null;try{return t.getIntegration(e)}catch(t){return("undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__)&&An.warn(`Cannot retrieve integration ${e.id} from the current Hub`),null}}startTransaction(e,t){return this._callExtensionMethod("startTransaction",e,t)}traceHeaders(){return this._callExtensionMethod("traceHeaders")}captureSession(e=!1){if(e)return this.endSession();this._sendSessionUpdate()}endSession(){var e=this.getStackTop(),t=e&&e.scope,r=t&&t.getSession();r&&ti(r),this._sendSessionUpdate(),t&&t.setSession()}startSession(e){const{scope:t,client:r}=this.getStackTop(),{release:n,environment:i}=r&&r.getOptions()||{};var a=(0,Nn.getGlobalObject)();const{userAgent:s}=a.navigator||{};var o=Xn({release:n,environment:i,...t&&{user:t.getUser()},...s&&{userAgent:s},...e});if(t){var c=t.getSession&&t.getSession();c&&"ok"===c.status&&ei(c,{status:"exited"}),this.endSession(),t.setSession(o)}return o}shouldSendDefaultPii(){var e=this.getClient(),t=e&&e.getOptions();return Boolean(t&&t.sendDefaultPii)}_sendSessionUpdate(){const{scope:e,client:t}=this.getStackTop();if(e){var r=e.getSession();r&&t&&t.captureSession&&t.captureSession(r)}}_withClient(e){const{scope:t,client:r}=this.getStackTop();r&&e(r,t)}_callExtensionMethod(e,...t){var r=si().__SENTRY__;if(r&&r.extensions&&"function"==typeof r.extensions[e])return r.extensions[e].apply(this,t);("undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__)&&An.warn(`Extension method ${e} couldn't be found, doing nothing.`)}}function si(){var e=(0,Nn.getGlobalObject)();return e.__SENTRY__=e.__SENTRY__||{extensions:{},hub:void 0},e}function oi(e){var t=si(),r=di(t);return ui(t,e),r}function ci(){var e=si();return li(e)&&!di(e).isOlderThan(4)||ui(e,new ai),(0,Jn.isNodeEnv)()?function(e){try{var t=si().__SENTRY__,r=t&&t.extensions&&t.extensions.domain&&t.extensions.domain.active;if(!r)return di(e);if(!li(r)||di(r).isOlderThan(4)){var n=di(e).getStackTop();ui(r,new ai(n.client,ri.clone(n.scope)))}return di(r)}catch(t){return di(e)}}(e):di(e)}function li(e){return!!(e&&e.__SENTRY__&&e.__SENTRY__.hub)}function di(e){return(0,Nn.getGlobalSingleton)("hub",(()=>new ai),e)}function ui(e,t){return!!e&&((e.__SENTRY__=e.__SENTRY__||{}).hub=t,!0)}function pi(e,t){return ci().captureException(e,{captureContext:t})}const hi=e=>new Promise((t=>{const r=window.devicePixelRatio||1,n=e.getContext("2d"),i=new Blob(['<svg width="103" height="36" fill="none" xmlns="http://www.w3.org/2000/svg"><g opacity=".8" fill="#fff"><path d="M10.994 33.06c.903 0 1.658-.734 1.392-1.581a5.249 5.249 0 0 0-1.279-2.124 5.171 5.171 0 0 0-3.673-1.535 5.171 5.171 0 0 0-3.673 1.535c-.595.6-1.03 1.33-1.28 2.124-.265.847.49 1.582 1.393 1.582h7.12ZM10.65 16.2c-.902 0-1.658.735-1.392 1.582.25.794.685 1.524 1.28 2.124a5.171 5.171 0 0 0 3.672 1.535 5.172 5.172 0 0 0 3.674-1.535 5.25 5.25 0 0 0 1.279-2.124c.266-.847-.49-1.582-1.393-1.582h-7.12ZM14.21 31.455c0 .887.75 1.63 1.606 1.35a5.187 5.187 0 0 0 2.067-1.279 5.264 5.264 0 0 0 1.521-3.706c0-1.39-.547-2.723-1.52-3.705a5.187 5.187 0 0 0-2.068-1.278c-.856-.281-1.606.462-1.606 1.349v7.27ZM7.434 17.806c0-.887-.75-1.63-1.607-1.35a5.186 5.186 0 0 0-2.066 1.279 5.264 5.264 0 0 0-1.522 3.706c0 1.39.548 2.723 1.522 3.705a5.186 5.186 0 0 0 2.066 1.278c.857.281 1.607-.462 1.607-1.349v-7.27Z"/><path d="M32.965 31.098c-1.442 0-2.601-.227-3.478-.68-.865-.465-1.517-1.043-1.955-1.734a.416.416 0 0 1-.052-.187c0-.125.057-.227.173-.306l.986-.731a.286.286 0 0 1 .208-.085c.103 0 .201.062.294.187.773 1.224 2.07 1.836 3.893 1.836.796 0 1.471-.142 2.025-.425.565-.284.848-.737.848-1.36 0-.465-.161-.827-.485-1.088-.311-.26-.796-.493-1.453-.697-.6-.181-.975-.289-1.125-.323-.992-.283-1.707-.504-2.146-.663-1.107-.408-1.84-.878-2.198-1.41-.357-.534-.536-1.089-.536-1.667 0-.476.15-.986.45-1.53.311-.555.796-1.025 1.453-1.41.67-.397 1.506-.595 2.51-.595 1.05 0 1.932.13 2.647.39.716.25 1.396.67 2.042 1.258.081.08.121.159.121.238 0 .114-.057.204-.173.272l-1.107.731a.469.469 0 0 1-.225.085c-.104 0-.202-.05-.294-.153-.692-.725-1.644-1.088-2.856-1.088-.692 0-1.228.102-1.609.306-.37.204-.617.431-.744.68-.115.25-.173.47-.173.663 0 .408.162.737.485.986.323.25.801.476 1.436.68.058.023.502.153 1.332.391.52.136 1.056.29 1.61.46 1.21.396 2.019.9 2.422 1.512.416.612.623 1.201.623 1.768 0 .612-.15 1.196-.45 1.75-.288.556-.801 1.02-1.54 1.395-.727.362-1.713.544-2.959.544ZM44.114 21.766c.865 0 1.667.249 2.405.748.739.487 1.108 1.388 1.108 2.702v5.321a.364.364 0 0 1-.104.272c-.058.057-.144.085-.26.085H46.14a.423.423 0 0 1-.277-.085.407.407 0 0 1-.087-.272v-5.032c-.035-.646-.22-1.155-.554-1.53-.323-.373-.744-.56-1.263-.56-.37 0-.738.102-1.107.306-.358.192-.664.492-.918.9-.253.397-.403.896-.45 1.496v4.42a.365.365 0 0 1-.103.272c-.058.057-.145.085-.26.085h-1.125a.423.423 0 0 1-.276-.085.407.407 0 0 1-.087-.272v-8.193c0-.114.029-.199.087-.255a.378.378 0 0 1 .276-.102h1.125c.116 0 .202.034.26.102.069.056.103.141.103.255v.204c0 .079.012.141.035.187a.168.168 0 0 0 .121.05c.092 0 .214-.062.364-.186a4.02 4.02 0 0 1 1.038-.612c.38-.148.738-.221 1.073-.221ZM57.436 28.207c.023.34.081.607.173.8.093.18.289.322.589.424.184.068.277.165.277.29a.396.396 0 0 1-.052.17l-.485.951c-.092.204-.242.278-.45.221-.669-.147-1.13-.47-1.384-.969-.058-.124-.115-.187-.173-.187-.058 0-.121.046-.19.136-.6.714-1.575 1.071-2.925 1.071-.819 0-1.482-.141-1.99-.425-.496-.283-.848-.623-1.056-1.02-.207-.408-.311-.799-.311-1.173 0-.612.19-1.161.571-1.648.392-.488.975-.828 1.748-1.02.53-.125 1.269-.221 2.215-.29.646-.045 1.113-.09 1.401-.135.231-.034.335-.17.312-.408-.058-.51-.23-.918-.52-1.224-.276-.318-.743-.476-1.4-.476-.428 0-.837.09-1.23.272-.38.17-.674.47-.882.9-.104.216-.254.29-.45.222l-1.055-.29c-.185-.056-.277-.152-.277-.288 0-.034.011-.085.034-.153a3.292 3.292 0 0 1 1.367-1.564c.635-.397 1.46-.595 2.475-.595.992 0 1.834.255 2.526.765.693.498 1.062 1.224 1.108 2.176.011.453.017 1.06.017 1.819.012.759.017 1.308.017 1.648Zm-4.326 1.445c.312 0 .652-.073 1.021-.22.38-.148.715-.403 1.004-.766.3-.374.484-.872.554-1.495v-.034c0-.114-.035-.199-.104-.256-.07-.067-.162-.09-.277-.067l-.675.067c-.75.069-1.361.148-1.834.238-.462.08-.86.227-1.194.442a.984.984 0 0 0-.485.884c0 .465.208.782.623.952.416.17.871.255 1.367.255ZM64.486 21.766c1.107 0 1.967.26 2.578.782.611.51 1.027 1.116 1.246 1.819a6.83 6.83 0 0 1 .329 2.073c0 .692-.11 1.389-.329 2.091-.22.692-.635 1.298-1.246 1.82-.611.509-1.47.764-2.578.764-.9 0-1.65-.238-2.25-.714-.08-.08-.161-.119-.242-.119-.116 0-.173.096-.173.29v3.569c0 .113-.035.198-.104.255-.058.068-.144.102-.26.102H60.42a.378.378 0 0 1-.277-.102c-.058-.057-.086-.142-.086-.255V22.344c0-.114.028-.199.086-.255a.378.378 0 0 1 .277-.102h1.038c.116 0 .202.034.26.102.069.056.104.141.104.255 0 .09.011.164.034.22.035.046.075.069.122.069.057 0 .109-.023.155-.068.612-.533 1.396-.8 2.354-.8Zm-.173 7.785c.888 0 1.54-.3 1.955-.9.427-.601.64-1.338.64-2.21 0-.873-.213-1.61-.64-2.21-.415-.601-1.067-.902-1.955-.902-.877 0-1.518.3-1.921.901-.393.59-.589 1.326-.589 2.21 0 .884.197 1.627.589 2.227.403.59 1.044.884 1.92.884ZM76.268 31.097c-1.316 0-2.452-.277-3.41-.833a5.531 5.531 0 0 1-2.163-2.277c-.484-.975-.726-2.08-.726-3.315 0-1.236.242-2.335.727-3.298a5.507 5.507 0 0 1 2.163-2.295c.957-.555 2.094-.833 3.409-.833 1.246 0 2.324.25 3.236.748a5.437 5.437 0 0 1 2.163 2.09c.034.069.052.131.052.188 0 .125-.087.215-.26.272l-1.298.323a.39.39 0 0 1-.12.017c-.151 0-.266-.074-.347-.221-.715-1.156-1.857-1.734-3.426-1.734-.97 0-1.771.221-2.406.663a3.907 3.907 0 0 0-1.401 1.75c-.3.715-.45 1.491-.45 2.33 0 .838.15 1.615.45 2.329.3.713.767 1.291 1.401 1.733.635.442 1.437.663 2.406.663.911 0 1.701-.21 2.37-.628.681-.42 1.165-1.06 1.454-1.921.08-.216.225-.306.433-.272l1.315.17c.196.034.294.124.294.272 0 .022-.012.079-.035.17-.507 1.303-1.246 2.283-2.215 2.94-.957.646-2.163.97-3.616.97ZM91.216 28.207c.023.34.08.607.173.8.092.18.288.322.588.424.185.068.277.165.277.29a.396.396 0 0 1-.052.17l-.484.951c-.093.204-.243.278-.45.221-.67-.147-1.13-.47-1.385-.969-.057-.124-.115-.187-.173-.187-.057 0-.12.046-.19.136-.6.714-1.575 1.071-2.925 1.071-.819 0-1.482-.141-1.99-.425-.496-.283-.848-.623-1.055-1.02-.208-.408-.312-.799-.312-1.173 0-.612.19-1.161.571-1.648.393-.488.975-.828 1.748-1.02.53-.125 1.27-.221 2.215-.29.646-.045 1.113-.09 1.402-.135.23-.034.334-.17.311-.408-.057-.51-.23-.918-.519-1.224-.277-.318-.744-.476-1.401-.476-.427 0-.837.09-1.23.272-.38.17-.674.47-.882.9-.103.216-.254.29-.45.222l-1.055-.29c-.185-.056-.277-.152-.277-.288a.53.53 0 0 1 .034-.153 3.293 3.293 0 0 1 1.368-1.564c.634-.397 1.459-.595 2.474-.595.992 0 1.834.255 2.527.765.692.498 1.06 1.224 1.107 2.176.012.453.017 1.06.017 1.819.012.759.018 1.308.018 1.648Zm-4.326 1.445c.311 0 .651-.073 1.02-.22.381-.148.716-.403 1.004-.766.3-.374.485-.872.554-1.495v-.034c0-.114-.035-.199-.104-.256-.07-.067-.161-.09-.277-.067l-.675.067c-.75.069-1.36.148-1.834.238-.461.08-.86.227-1.194.442a.984.984 0 0 0-.484.884c0 .465.207.782.622.952.416.17.871.255 1.368.255ZM95.687 30.536a.364.364 0 0 1-.104.272c-.058.057-.144.085-.26.085h-1.125a.424.424 0 0 1-.277-.085.407.407 0 0 1-.086-.272V18.79c0-.114.029-.199.086-.255a.378.378 0 0 1 .277-.102h1.125c.116 0 .202.034.26.102.069.056.104.141.104.255v11.746ZM100.033 30.536a.364.364 0 0 1-.104.272c-.057.057-.144.085-.26.085h-1.124a.423.423 0 0 1-.277-.085.407.407 0 0 1-.086-.272V18.79c0-.114.028-.199.086-.255a.378.378 0 0 1 .277-.102h1.125c.115 0 .202.034.26.102.069.056.103.141.103.255v11.746Z" stroke="#fff" stroke-width=".5"/><path d="M43.151 8.686c.296 0 .554-.036.774-.108.22-.076.402-.182.546-.318.148-.14.258-.308.33-.504.072-.2.108-.422.108-.666a1.75 1.75 0 0 0-.108-.63 1.245 1.245 0 0 0-.324-.48 1.41 1.41 0 0 0-.546-.3 2.516 2.516 0 0 0-.78-.108h-1.206v3.114h1.206Zm0-4.362c.58 0 1.082.068 1.506.204.424.136.774.326 1.05.57.276.244.48.536.612.876.136.34.204.712.204 1.116 0 .42-.07.806-.21 1.158-.14.348-.35.648-.63.9s-.632.448-1.056.588c-.42.14-.912.21-1.476.21h-1.206V13h-1.614V4.324h2.82Zm6.819 2.424c.456 0 .87.074 1.242.222a2.692 2.692 0 0 1 1.578 1.626c.144.392.216.83.216 1.314 0 .488-.072.928-.216 1.32-.144.392-.35.726-.618 1.002a2.653 2.653 0 0 1-.96.636 3.333 3.333 0 0 1-1.242.222c-.46 0-.878-.074-1.254-.222a2.712 2.712 0 0 1-.966-.636 2.922 2.922 0 0 1-.618-1.002 3.807 3.807 0 0 1-.216-1.32c0-.484.072-.922.216-1.314.148-.392.354-.724.618-.996.268-.272.59-.482.966-.63a3.397 3.397 0 0 1 1.254-.222Zm0 5.202c.512 0 .89-.172 1.134-.516.248-.344.372-.848.372-1.512s-.124-1.17-.372-1.518c-.244-.348-.622-.522-1.134-.522-.52 0-.906.176-1.158.528-.248.348-.372.852-.372 1.512s.124 1.164.372 1.512c.252.344.638.516 1.158.516Zm12.85-5.106L60.866 13h-1.188c-.136 0-.23-.088-.282-.264L58.29 9.178c-.036-.12-.07-.238-.102-.354a5.729 5.729 0 0 1-.072-.36 6.81 6.81 0 0 1-.084.366c-.028.12-.06.24-.096.36l-1.122 3.546c-.048.176-.154.264-.318.264h-1.14l-1.95-6.156h1.182c.108 0 .2.026.276.078a.363.363 0 0 1 .15.198l.882 3.288c.044.18.082.356.114.528.036.172.066.344.09.516.044-.172.09-.344.138-.516l.162-.528 1.02-3.3a.382.382 0 0 1 .138-.198.429.429 0 0 1 .258-.078h.654c.104 0 .192.026.264.078a.363.363 0 0 1 .15.198l.99 3.3c.052.18.1.358.144.534.048.172.094.344.138.516.052-.34.126-.69.222-1.05l.906-3.288a.405.405 0 0 1 .15-.198.429.429 0 0 1 .258-.078h1.128Zm4.704 2.37c0-.192-.028-.372-.084-.54a1.25 1.25 0 0 0-.24-.45 1.096 1.096 0 0 0-.414-.3 1.358 1.358 0 0 0-.576-.114c-.428 0-.766.122-1.014.366-.244.244-.4.59-.468 1.038h2.796Zm-2.826.894c.024.316.08.59.168.822.088.228.204.418.348.57.144.148.314.26.51.336.2.072.42.108.66.108.24 0 .446-.028.618-.084a2.76 2.76 0 0 0 .456-.186 7.55 7.55 0 0 0 .342-.186.59.59 0 0 1 .288-.084c.124 0 .216.046.276.138l.426.54a2.536 2.536 0 0 1-.552.486 3.281 3.281 0 0 1-1.32.474 4.79 4.79 0 0 1-.666.048 3.33 3.33 0 0 1-1.194-.21 2.726 2.726 0 0 1-.96-.63 2.993 2.993 0 0 1-.642-1.032c-.156-.412-.234-.888-.234-1.428 0-.42.068-.814.204-1.182.136-.372.33-.694.582-.966.256-.276.566-.494.93-.654.368-.16.782-.24 1.242-.24.388 0 .746.062 1.074.186.328.124.61.306.846.546.236.236.42.528.552.876.136.344.204.738.204 1.182 0 .224-.024.376-.072.456-.048.076-.14.114-.276.114h-3.81Zm6.668-2.196c.192-.368.42-.656.684-.864a1.45 1.45 0 0 1 .936-.318c.284 0 .512.062.684.186l-.096 1.11a.294.294 0 0 1-.09.156.239.239 0 0 1-.15.042c-.06 0-.15-.01-.27-.03a2.01 2.01 0 0 0-.342-.03 1.11 1.11 0 0 0-.786.282c-.1.088-.19.196-.27.324a3.44 3.44 0 0 0-.216.438V13h-1.482V6.844h.87c.152 0 .258.028.318.084.06.052.1.148.12.288l.09.696Zm6.87 1.302c0-.192-.029-.372-.085-.54a1.25 1.25 0 0 0-.24-.45 1.096 1.096 0 0 0-.414-.3 1.358 1.358 0 0 0-.576-.114c-.428 0-.766.122-1.014.366-.244.244-.4.59-.468 1.038h2.796Zm-2.827.894c.024.316.08.59.168.822.088.228.204.418.348.57.144.148.314.26.51.336.2.072.42.108.66.108.24 0 .446-.028.618-.084a2.76 2.76 0 0 0 .456-.186 7.55 7.55 0 0 0 .342-.186.59.59 0 0 1 .288-.084c.124 0 .216.046.276.138l.426.54a2.536 2.536 0 0 1-.552.486 3.281 3.281 0 0 1-1.32.474 4.79 4.79 0 0 1-.666.048 3.33 3.33 0 0 1-1.194-.21 2.726 2.726 0 0 1-.96-.63 2.993 2.993 0 0 1-.642-1.032c-.156-.412-.234-.888-.234-1.428 0-.42.068-.814.204-1.182.136-.372.33-.694.582-.966.256-.276.566-.494.93-.654.368-.16.782-.24 1.242-.24.388 0 .746.062 1.074.186.328.124.61.306.846.546.236.236.42.528.552.876.136.344.204.738.204 1.182 0 .224-.024.376-.072.456-.048.076-.14.114-.276.114h-3.81Zm9.134-1.692a1.451 1.451 0 0 0-.552-.432 1.597 1.597 0 0 0-.636-.126c-.224 0-.426.042-.606.126a1.21 1.21 0 0 0-.462.384 1.8 1.8 0 0 0-.294.648c-.068.26-.102.568-.102.924 0 .36.028.666.084.918.06.248.144.452.252.612.108.156.24.27.396.342.156.068.33.102.522.102.308 0 .57-.064.786-.192.216-.128.42-.31.612-.546v-2.76Zm1.482-4.332V13h-.906c-.196 0-.32-.09-.372-.27l-.126-.594a3.09 3.09 0 0 1-.858.69c-.32.176-.694.264-1.122.264-.336 0-.644-.07-.924-.21a2.098 2.098 0 0 1-.726-.606 3.033 3.033 0 0 1-.468-.99 5.072 5.072 0 0 1-.162-1.344c0-.456.062-.88.186-1.272s.302-.732.534-1.02c.232-.288.51-.512.834-.672a2.384 2.384 0 0 1 1.092-.246c.344 0 .638.054.882.162.244.108.462.254.654.438V4.084h1.482Zm5.863 7.32c.168.204.35.348.546.432.2.084.41.126.63.126.228 0 .432-.04.612-.12.184-.084.34-.212.468-.384a1.93 1.93 0 0 0 .294-.666 4.05 4.05 0 0 0 .102-.972c0-.676-.112-1.164-.336-1.464-.224-.304-.546-.456-.966-.456-.284 0-.532.066-.744.198a2.38 2.38 0 0 0-.606.546v2.76Zm0-3.804a3.02 3.02 0 0 1 .822-.618c.304-.156.65-.234 1.038-.234.356 0 .676.07.96.21.288.14.532.342.732.606.204.26.36.576.468.948.108.372.162.79.162 1.254 0 .5-.062.954-.186 1.362a3.132 3.132 0 0 1-.534 1.05 2.4 2.4 0 0 1-.828.672c-.324.16-.684.24-1.08.24a2.103 2.103 0 0 1-.954-.216 1.891 1.891 0 0 1-.366-.246c-.108-.1-.212-.21-.312-.33l-.066.414c-.024.104-.066.178-.126.222a.37.37 0 0 1-.234.066h-.978V4.084h1.482V7.6Zm10.743-.756-3.354 7.848a.538.538 0 0 1-.174.234c-.068.056-.174.084-.318.084H97.68l1.152-2.472-2.49-5.694h1.302c.116 0 .206.028.27.084.068.056.118.12.15.192l1.308 3.192c.044.108.08.216.108.324.032.108.062.218.09.33a32.3 32.3 0 0 1 .108-.33c.036-.112.076-.222.12-.33l1.236-3.186a.437.437 0 0 1 .408-.276h1.188Z"/></g></svg>'],{type:"image/svg+xml;charset=utf-8"}),a=URL.createObjectURL(i),s=new Image;s.onload=()=>{const i=e.width/r-s.width-16,a=e.height/r-s.height-16;n?.drawImage(s,i,a),t(e)},s.src=a})),fi=async e=>{const{videoWidth:t,videoHeight:r}=e,n=t>r?"landscape":"portrait",i="portrait"===n?t:r,a="landscape"===n?r:t,s="landscape"===n?(t-i)/2:0,o="portrait"===n?(r-a)/2:0,c=document.createElement("canvas"),l=c.getContext("2d"),d=window.devicePixelRatio||1;c.width=i*d,c.height=a*d,l?.scale(d,d),l?.drawImage(e,s,o,i,a,0,0,c.width/d,c.height/d);return(await hi(c)).toDataURL("image/jpeg")},mi=async e=>{const t=document.createElement("video"),r=new MediaStream;r.addTrack(e),t.srcObject=r,t.setAttribute("muted","true");const n=e.getSettings();t.width=n.width||0,t.height=n.height||0,await t.play();const i=document.createElement("canvas"),a=i.getContext("2d");i.height=t.height,i.width=t.width,a?.drawImage(t,0,0);return(await hi(i)).toDataURL("image/jpeg")};var gi=a("eEB2e");Nr=a("4Fy4N");const vi="WRTC1",yi="WRTC2",bi="TRANS1",wi="CONS1",xi="SOCK1",_i={qvga:{width:{ideal:320},height:{ideal:240},qualityIndex:3},vga:{width:{ideal:640},height:{ideal:480},qualityIndex:2},hd:{width:{ideal:1280},height:{ideal:720},qualityIndex:1}};class Si extends CustomEvent{constructor(e,t){super(e,t)}}const ki=EventTarget;const Ei=new class extends ki{pendingDeviceRequest={};joinOptions={};devicesList=[];constructor(){super(),navigator.mediaDevices.addEventListener("devicechange",(()=>this.onDeviceChange())),this.config={apiUrl:String("https://api.snapcall.io/v2"),streamerServer:String("wss://g.snapcall.io/stream"),streamerApi:String("https://g.snapcall.io/stream"),iceServers:[{urls:"turns:t.snapcall.io:443?transport=tcp,turns:t2.snapcall.io:443?transport=tcp"?.split(",")||[],username:"test",credential:"test",credentialType:"password"}]},this.peers=new Map,this.consumers=new Map,this.webcams=new Map,this.webcam={device:null,resolution:"hd"},this.webcamTrack=null,this.webcamZoom={available:!1,min:0,max:0},this.muted=!1,this.roomId="",this.peerId="",this.webcamProducer=null,this.screenshareProducer=null,this.customMessages=new Map,this.audioRenderers={},this.profile={}}getState(){const e=[];return this.peers.forEach(((t,r)=>{const n={microphone:{enabled:!1,muted:!1},camera:{enabled:!1},screenshare:{enabled:!1}};t.producersData.forEach((e=>{"microphone"===e.deviceType?(n.microphone.enabled=!0,n.microphone.muted=e.paused):"screen"===e.deviceType?n.screenshare.enabled=!0:"webcam"===e.deviceType&&(n.camera.enabled=!0)})),e.push({peerId:r,profile:t.profile,deviceState:n})})),{roomId:this.roomId,peerId:this.peerId,profile:this.profile,callId:void 0,deviceState:this.getDevicesState(),peers:e}}onStartSpeak(){if(this.micProducer&&!this.micProducer.paused){const e=new Si("localStartSpeak",{cancelable:!0,bubbles:!0,detail:{}});this.dispatchEvent(e),this.protoo.notify("startSpeak")}}onStopSpeak(){if(this.micProducer&&!this.micProducer.paused){const e=new Si("localStopSpeak",{detail:{}});this.dispatchEvent(e),this.protoo.notify("stopSpeak")}}onCriticalError(e){const t=new Si("criticalError",{detail:{code:e}});this.dispatchEvent(t)}async generateToken(e){const t=this.config.streamerApi,{token:r}=await fetch(`${t}/stream`,{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({bid:e})}).then((e=>e.json()));return r}async init(e=this.roomId,t=this.joinOptions){if(this.roomId=e,this.joinOptions=t,!this.roomId)throw new Error("Missing room ID");let r;this.peerId||(this.peerId=Zr());try{const{instanceId:t}=await fetch(`${this.config.streamerApi}/instance/${this.roomId}`,{method:"get",headers:{"Content-Type":"application/json"}}).then((e=>{if(e.ok)return e.json();throw new Error("Invalid room ID")}));r=`${this.config.streamerServer}/${t}/?roomId=${e}&peerId=${this.peerId}`}catch(e){const t=new Si("invalidRoom",{detail:{}});this.dispatchEvent(t)}if(!r)throw new Error("Invalid socket URL");this.protooTransport=new $r(r,{retry:{retries:0}}),this.protoo=new qr(this.protooTransport),this.protoo.on("open",(()=>{this.joinRoom()})),this.protoo.on("failed",(()=>{console.error("failed"),this.onCriticalError(xi)})),this.protoo.on("disconnected",(()=>{console.error("disconnected"),this.onCriticalError(xi)})),this.protoo.on("close",(()=>console.log("close :("))),this.protoo.on("notification",(async e=>{if(console.log("notification",e),"newPeer"===e.method){const{id:t,profile:r}=e.data;this.peers.set(t,{id:t,peerId:t,profile:r,producersData:[]});const n=new Si("newPeer",{detail:{peerId:t,displayName:r.name,profile:r}});this.dispatchEvent(n)}else if("newProducer"===e.method){const{peerId:t,producerId:r,deviceType:n,paused:i}=e.data;await this.consumeProducer({peerId:t,producerId:r,deviceType:n,paused:i})}else if("peerClosed"===e.method){const{peerId:t,relatedConsumers:r}=e.data;this.peers.delete(t),r.forEach((e=>{this.onConsumerClose({consumerId:e.id})}));const n=new Si("peerClosed",{detail:{peerId:t}});this.dispatchEvent(n)}else if("consumerClosed"===e.method){const{consumerId:t}=e.data;this.onConsumerClose({consumerId:t})}else if("displayName"===e.method){const{peerId:t,displayName:r}=e.data,n=new Si("displayName",{detail:{peerId:t,displayName:r,profile:{}}});this.dispatchEvent(n)}else if("profile"===e.method){const{peerId:t,profile:r}=e.data,n=new CustomEvent("profileUpdate",{detail:{peerId:t,profile:r}});this.dispatchEvent(n)}else if("requestDevice"===e.method){this.pendingDeviceRequest[e.data.requestId]=e.data;const t=new Si("requestDevice",{detail:e.data});this.dispatchEvent(t)}else if("startSpeak"===e.method);else if("stopSpeak"===e.method);else if("producerPaused"===e.method||"producerResumed"===e.method){const{peerId:t,producerId:r,deviceType:n}=e.data;if("microphone"===e.data?.deviceType){const n=this.peers.get(t)?.producersData.find((e=>r===e.producerId));n&&(n.paused="producerPaused"===e.method)}let i=r;for(let[,e]of Array.from(this.consumers.entries()))if(e.mediaSoupConsumer.producerId===r){i=e.mediaSoupConsumer.id;break}const a="producerPaused"===e.method?"mediaPause":"mediaResume",s=new Si(a,{detail:{mediaId:i,peerId:t,deviceType:n,paused:"producerPaused"===e.method}});this.dispatchEvent(s)}else if("requestDeviceResult"===e.method){const t=new Si(e.method,{detail:e.data});this.dispatchEvent(t)}else if("terminateRoom"===e.method){this.release();const t=new Si(e.method,{detail:e.data});this.dispatchEvent(t)}else if("customMessage"===e.method){const{messageId:t,chunk:r,chunkIndex:n,totalChunks:i}=e.data.event,a=this.customMessages.get(t);a?a.chunks.push({index:n,data:r}):this.customMessages.set(t,{chunks:[{index:n,data:r}],totalChunks:i});const s=this.customMessages.get(t);if(s&&s.totalChunks===s.chunks.length){const r=s.chunks.sort(((e,t)=>e.index-t.index)).reduce(((e,t)=>e+t.data),""),n=JSON.parse(r),i=new Si("customMessage",{detail:{...e.data,event:n}});this.dispatchEvent(i),this.customMessages.delete(t)}}}))}deviceAutoDetection(){try{const n=navigator.userAgent,i=Nr.getParser(n);t="DeviceDetectionForced",r=!0,ci().setTag(t,r),e={type:"debug",category:"browser",data:i.getResult()},ci().addBreadcrumb(e);const a=i.getOS();if("Safari"===i.getBrowserName()&&"iOS"===a.name&&Number(a.version)>=14.3)return new fn.Device({handlerName:"Safari12"});throw Error("failed to autoDetect browser, falling back to chrome 74")}catch(e){console.error(e),pi(e),this.dispatchEvent(new CustomEvent("browserDetectionFailed"))}var e,t,r;return new fn.Device({handlerName:"Chrome74"})}createDevice(){try{return new fn.Device}catch(e){return console.error("failed to detects device from mediasoup, fallback on auto detection",e),this.deviceAutoDetection()}}closeWebrtcTransport(e){e?.transport.close(),clearTimeout(e?.disconnectTimeout)}async createTransportConfig(){const e=await this.protoo.request("createWebRtcTransport");return{id:e.id,iceParameters:e.iceParameters,iceCandidates:e.iceCandidates,dtlsParameters:{...e.dtlsParameters,role:"auto"},sctpParameters:e.sctpParameters,iceServers:this.config.iceServers,proprietaryConstraints:{optional:[{googDscp:!0}]},additionalSettings:{encodedInsertableStreams:!1}}}async createSendTransport(e){const t=this.mediasoupDevice.createSendTransport(await this.createTransportConfig());t.on("connect",(({dtlsParameters:e},r,n)=>{console.log("dtlsParameters",t.id,e),this.protoo.request("connectWebRtcTransport",{transportId:t.id,dtlsParameters:e}).then(r).catch(n)})),t.on("produce",(async({kind:e,rtpParameters:r,appData:n},i,a)=>{try{const{id:a}=await this.protoo.request("produce",{transportId:t.id,kind:e,rtpParameters:r,appData:n});i({id:a}),console.log("producerTransport: ",t)}catch(e){a(e)}}));const r={transport:t,disconnectTimeout:void 0,kind:e};return this.listenWebRTCTransportStats(r),r}async createRecvTransport(e){const t=this.mediasoupDevice.createRecvTransport(await this.createTransportConfig());t.on("connect",(({dtlsParameters:e},r,n)=>{console.log("dtls",t.id,e),this.protoo.request("connectWebRtcTransport",{transportId:t.id,dtlsParameters:e}).then(r).catch(n)}));const r={transport:t,disconnectTimeout:void 0,kind:e};return this.listenWebRTCTransportStats(r),r}listenWebRTCTransportStats(e){e.transport.on("connectionstatechange",(t=>{if(!e.transport.closed)if(console.log("recv connectionstatechange: ",t),"disconnected"===t)e.disconnectTimeout=setTimeout((()=>{console.log(`trying to restart transport for ${e.kind}`),this.restartIce(e.transport)}),5e3);else if("connected"===t)clearTimeout(e.disconnectTimeout);else if("failed"===t){const t=new Error(`webRTC transport state failed for ${e.kind}`);pi(t,{extra:{direction:e.transport.direction,id:e.transport.id,kind:e.kind}}),console.error("webrtc stat failed",t),this.onCriticalError(vi)}}))}async joinRoom(){this.mediasoupDevice=this.createDevice(),this.routerRtpCapabilities=await this.protoo.request("getRouterRtpCapabilities"),this.routerRtpCapabilities.headerExtensions=this.routerRtpCapabilities.headerExtensions?.filter((e=>"urn:3gpp:video-orientation"!==e.uri)),await this.mediasoupDevice.load({routerRtpCapabilities:this.routerRtpCapabilities});try{this.recvAudioTransports=await this.createRecvTransport("audio"),this.sendAudioTransports=await this.createSendTransport("audio"),this.recvVideoTransports=await this.createRecvTransport("video"),this.sendVideoTransports=await this.createSendTransport("video")}catch(e){throw this.onCriticalError(bi),e}if(this.joinOptions.apiKey&&this.joinOptions.email)try{await this.fetchAgentInfo({apiKey:this.joinOptions.apiKey,email:this.joinOptions.email})&&this.dispatchEvent(new Si("agentIdentity",{detail:{success:!0,email:this.joinOptions.email}}))}catch(e){console.warn(e),this.dispatchEvent(new Si("agentIdentity",{detail:{success:!1}}))}const{peers:e}=await this.protoo.request("getRoomPeers",{apiKey:this.joinOptions.apiKey,email:this.joinOptions.email});this.peers=new Map(e.map((e=>[e.id||e.peerId,{...e,peerId:e.id||e.peerId}])));const t=await this.getCallId();this.dispatchEvent(new Si("enterRoom",{detail:{peerId:this.peerId,peers:e.map((e=>({...e,peerId:e.id||e.peerId}))),callId:t}})),console.log("peers",e),this.joinOptions.displayName&&await this.setDisplayName(this.joinOptions.displayName),this.joinOptions.profile&&await this.setProfile(this.joinOptions.profile),e.forEach((e=>{this.consumePeer({peerId:e.id||e.peerId,producersData:e.producersData})}))}async switchMicrophone(e){try{console.log("switchMicrophone","switching Microphone"),this.audioLevel?.release(),this.audioLevel=void 0,this.micProducer&&this.micProducer.track&&(this.micProducer?.track?.stop(),console.log("switchMicrophone","stopping previous track"));const t=await this.handleGetUserMediaError("microphone",navigator.mediaDevices.getUserMedia({audio:{deviceId:e,noiseSuppression:!0,echoCancellation:!0}}));this.audioLevel=new kn(t,this),this.audioLevel.analyse();const r=t.getAudioTracks()[0];await(this.micProducer?.replaceTrack({track:r})),console.log("switchMicrophone","switched Microphone")}catch(e){console.error("switchMicrophone error",e),await this.closeMicrophoneProducer()}}async closeMicrophoneProducer(){const e=this.micProducer?.id;this.micProducer?.close(),this.micProducer=void 0;const t=new Si("microphoneMute",{detail:{}});this.dispatchEvent(t),await this.protoo.request("closeProducer",{producerId:e})}async onDeviceChange(){console.log("detecting device change");const e=new Si("devicesListChange",{detail:{}});if(this.dispatchEvent(e),!this.protoo.closed&&this.micProducer){const e=await navigator.mediaDevices.enumerateDevices(),t=e.filter((e=>"audioinput"===e.kind));if(0===t.length)return console.warn("no audio input device"),void await this.closeMicrophoneProducer();const r=t.find((e=>"default"===e.deviceId));if(r){const t=e.filter((e=>!Boolean(this.devicesList.find((t=>t.deviceId===e.deviceId&&t.label===e.label)))));console.log(t),this.devicesList=e;const n=Boolean(t.find((e=>"audioinput"===e.kind)));if(0!==t.length&&!1===n)return void console.log("no audio input change");if(console.log("detecting audio input change"),!this.audioInputDefaultDevice||this.audioInputDefaultDevice.label!==r.label){const e=new Si("defaultAudioDeviceChange",{detail:r});this.audioInputDefaultDevice=r,this.dispatchEvent(e),console.log("new default audio input trying to switch new :",r.deviceId,r.label)}this.switchMicrophone("default")}else this.switchMicrophone()}}async enableMicrophone(){if(!this.micProducer||this.micProducer?.closed){const e=await this.handleGetUserMediaError("microphone",navigator.mediaDevices.getUserMedia({audio:{noiseSuppression:!0,echoCancellation:!0}}));if(this.devicesList=await navigator.mediaDevices.enumerateDevices(),!this.sendAudioTransports)throw new Error("audio transport not found");this.audioLevel=new kn(e,this),this.audioLevel.analyse();const t=e.getAudioTracks()[0],r="microphone",n=await(this.sendAudioTransports?.transport.produce({track:t,codecOptions:{opusStereo:!0,opusDtx:!0},appData:{deviceType:r}}));n.on("transportclose",(()=>{console.log("micproducer transportclose")})),t.addEventListener("ended",(()=>{console.log("track ended!")})),n.on("trackended",(async()=>{console.log("microphone disconnected!"),void 0===navigator.mediaDevices.ondevicechange&&this.closeMicrophoneProducer()})),this.micProducer=n,this.muted=!1;const i=new Si("microphoneEnabled",{detail:{}});this.dispatchEvent(i)}}async muteMicrophone(){if(this.micProducer){this.onStopSpeak(),this.micProducer?.pause(),await this.protoo.request("pauseProducer",{producerId:this.micProducer?.id}),this.muted=!0;const e=new Si("microphoneMute",{detail:{}});this.dispatchEvent(e)}}async unMuteMicrophone(){if(this.micProducer){this.micProducer.resume(),this.resolvePendingDeviceRequest("microphone",!0),await this.protoo.request("resumeProducer",{producerId:this.micProducer.id}),this.muted=!1;const e=new Si("microphoneUnmute",{detail:{}});this.dispatchEvent(e)}}async toggleMute(){return this.muted?(await this.unMuteMicrophone(),{muted:!1}):(await this.muteMicrophone(),{muted:!0})}release(){console.log("release"),this.closeWebrtcTransport(this.sendAudioTransports),this.closeWebrtcTransport(this.recvAudioTransports),this.closeWebrtcTransport(this.sendVideoTransports),this.closeWebrtcTransport(this.recvVideoTransports),this.webcamTrack?.stop(),this.webcamTrack=null,this.protooTransport.close(),this.protoo.close(),this.micProducer?.close(),this.screenshareProducer?.close(),this.webcamProducer?.close(),this.consumers.forEach((e=>{e.mediaSoupConsumer.close()})),this.consumers.clear(),this.audioLevel?.release()}endCall(){this.release();const e=new Si("leaveRoom",{detail:{}});this.dispatchEvent(e);const t=new CustomEvent("snapcallEvent_callEnd");window.dispatchEvent(t)}terminateRoom(){this.protoo.request("terminateRoom")}async updateWebcams(){this.webcams=new Map;const e=await navigator.mediaDevices.enumerateDevices();for(const t of e)"videoinput"===t.kind&&this.webcams.set(t.deviceId,t);0===this.webcams.size?this.webcam.device=null:this.webcam.device||(this.webcam.device=this.webcams.values().next().value);const t=new Si("webcamsUpdate",{detail:{numberOfAvailableWebcams:this.webcams.size}});this.dispatchEvent(t)}isVideoZoomAvailable(){return this.webcamZoom.available}resolvePendingDeviceRequest(e,t,r){Object.keys(this.pendingDeviceRequest).forEach((n=>{const i=this.pendingDeviceRequest[n];e===i.deviceType&&(delete this.pendingDeviceRequest[n],this.protoo.notify("requestDeviceResult",{result:Boolean(t),failure:r,...i}))}))}async handleGetUserMediaError(e,t){let r,n;try{r=await t}catch(e){n=e}finally{if(this.resolvePendingDeviceRequest(e,Boolean(r),n?.name),n)throw n;return r}}async restartIce(e){if(console.log("restartIce",e.connectionState,e.closed),"disconnected"===e.connectionState&&!e.closed)try{const t=await this.protoo.request("restartIce",{transportId:e.id});console.log(t),await e.restartIce({iceParameters:t})}catch(t){this.onCriticalError(yi),console.log("restartIceFailed",t),pi(t,{extra:{direction:e.direction,id:e.id}})}}scaleVideoMediasConstraintsParameter(e){let t=_i.hd;2===e?t=_i.vga:e>2&&(t=_i.qvga),(!this.webcam.resolution||_i[this.webcam.resolution].qualityIndex>=t.qualityIndex)&&(console.log(`scaling video by ${e}`,t),this.webcamProducer?.track?.applyConstraints(t))}scaleVideoEncodingsParameter(){try{let e=0;this.consumers.forEach((t=>{"video"===t.mediaSoupConsumer.kind&&e++})),this.screenshareProducer&&!this.screenshareProducer.closed&&e++;let t={scaleResolutionDownBy:1};if(e>=3&&(t={scaleResolutionDownBy:2}),e>=9&&(t={scaleResolutionDownBy:4}),!gi.Producer.prototype.setRtpEncodingParameters)return this.scaleVideoMediasConstraintsParameter(t.scaleResolutionDownBy);this.webcamProducer&&!this.webcamProducer.closed&&(console.log(`scaling video by ${t.scaleResolutionDownBy}`),this.webcamProducer?.setRtpEncodingParameters?.(t).catch((e=>{console.error("scaleResolutionDownBy not supported",e),this.scaleVideoMediasConstraintsParameter(t.scaleResolutionDownBy)})))}catch(e){console.error("scaleVideo error",e)}}async switchWebcam({device:e,resolution:t,rotate:r}){if(!this.webcam.device)throw new Error("no webcam devices");if(r){const e=Array.from(this.webcams.keys()),t=this.webcam?.device?.deviceId||"unknow";let r=e.indexOf(t);r<e.length-1?r++:r=0;const n=this.webcams.get(e[r]);if(!n)throw new Error("no webcam device");this.webcam.device=n,this.webcam.resolution="hd"}else e&&(this.webcam.device=e),t&&(this.webcam.resolution=t);const n=await this.handleGetUserMediaError("webcam",navigator.mediaDevices.getUserMedia({video:{deviceId:{ideal:this.webcam.device.deviceId},..._i[t||this.webcam.resolution]}}));if(!this.sendVideoTransports)throw new Error("video transport not found");const i=n.getVideoTracks()[0];this.webcamTrack=i,await(this.webcamProducer?.replaceTrack?.({track:i}));const a=await(i.getCapabilities?.())||navigator.mediaDevices.getSupportedConstraints?.();this.webcamZoom={available:Boolean(a?.zoom),min:a?.zoom?.min||0,max:a?.zoom?.max||0};const s=new Si("localVideoChange",{detail:{camera:this.getCurrentWebcam()}});this.dispatchEvent(s)}async enableVideo(e){if(await this.updateWebcams(),e?.device&&(this.webcam.device=e.device),!this.webcam.device)throw new Error("no webcam devices");const t=await this.handleGetUserMediaError("webcam",navigator.mediaDevices.getUserMedia({video:{deviceId:{ideal:this.webcam.device.deviceId},..._i[e?.resolution||this.webcam.resolution]}}));if(!this.sendVideoTransports)throw new Error("video transport not found");const r=t.getVideoTracks()[0];this.webcamTrack=r;const n=await(r.getCapabilities?.())||navigator.mediaDevices.getSupportedConstraints?.();this.webcamZoom={available:Boolean(n?.zoom),min:n?.zoom?.min||0,max:n?.zoom?.max||0};this.webcamProducer=await this.sendVideoTransports.transport.produce({track:r,encodings:undefined,codecOptions:{videoGoogleStartBitrate:1e3},appData:{deviceType:"webcam"}}),this.scaleVideoEncodingsParameter(),this.webcamProducer.on("transportclose",(()=>{this.webcamProducer=null})),this.webcamProducer.on("trackended",(()=>{this.disableVideo().catch((()=>{}))}));const i=new Si("localVideoAvailable",{detail:{camera:this.getCurrentWebcam()}});this.dispatchEvent(i)}async rotateVideo(){await this.switchWebcam({rotate:!0})}async zoomVideo(){if(!this.webcamZoom.available)throw new Error("Webcam zoom is not available");if(!this.webcamTrack)throw new Error("No webcam track available");this.webcamTrack.applyConstraints({advanced:[{zoom:2*this.webcamZoom.min}]})}async unzoomVideo(){if(!this.webcamZoom.available)throw new Error("Webcam zoom is not available");if(!this.webcamTrack)throw new Error("No webcam track available");this.webcamTrack.applyConstraints({advanced:[{zoom:this.webcamZoom.min}]})}async disableVideo(){if(!this.webcamProducer)return;this.webcamProducer.close(),await this.protoo.request("closeProducer",{producerId:this.webcamProducer.id}),this.webcamProducer=null;const e=new Si("localVideoUnavailable",{detail:{}});this.dispatchEvent(e)}async enableScreenshare(){const e=await this.handleGetUserMediaError("screen",navigator.mediaDevices.getDisplayMedia({audio:!1,video:{displaySurface:"monitor",logicalSurface:!0,width:{max:1920},height:{max:1080},frameRate:{max:30}}}));if(!e)return;if(!this.sendVideoTransports)throw new Error("video screen transport not found");const t=e.getVideoTracks()[0];this.screenshareProducer=await this.sendVideoTransports.transport.produce({track:t,encodings:undefined,codecOptions:{videoGoogleStartBitrate:1e3},appData:{deviceType:"screen",share:!0}}),this.screenshareProducer.on("transportclose",(()=>{this.screenshareProducer=null})),this.screenshareProducer.on("trackended",(()=>{this.disableScreenshare().catch((()=>{}))}));const r=new Si("screenshareEnabled",{detail:{}});this.dispatchEvent(r)}async disableScreenshare(){this.screenshareProducer&&(this.screenshareProducer.close(),await this.protoo.request("closeProducer",{producerId:this.screenshareProducer.id}),this.screenshareProducer=null);const e=new Si("screenshareDisabled",{detail:{}});this.dispatchEvent(e)}onConsumerClose({consumerId:e}){const t=this.consumers.get(e);if(t){const r=t.mediaSoupConsumer.producerId;this.peers.forEach((e=>{const t=e.producersData.findIndex((e=>e.producerId===r));-1!==t&&e.producersData.splice(t,1)})),t.mediaSoupConsumer.close(),this.consumers.delete(e),this.scaleVideoEncodingsParameter();const n=new Si("mediaStop",{detail:{mediaId:e,peerId:String(t.mediaSoupConsumer.appData.peerId),deviceType:t.deviceType,paused:!1}});"microphone"===t.deviceType&&this.deleteAudioRenderer(e),this.dispatchEvent(n)}}requestVideo({mediaId:e,element:t}){const r=this.consumers.get(e);if(r){const e=new MediaStream;e.onremovetrack=()=>console.log("Remove Track"),r.mediaSoupConsumer.track.onended=()=>console.log("Track Ended"),e.addTrack(r.mediaSoupConsumer.track),t.srcObject=e}else console.error(`Video consumer ${r} not found`)}async captureVideo(e){let t;if(e)t=await fi(e);else{if(!this.webcamProducer||!this.webcamProducer.track)throw new Error("no video to capture");t=await mi(this.webcamProducer.track)}return t}requestLocalVideo(e){if(this.webcamProducer){const t=new MediaStream;t.addTrack(this.webcamProducer.track),e.srcObject=t;const r=this.webcamProducer.track?.getSettings();return{facingMode:r?.facingMode||"user"}}throw new Error("webcam producer not available yet")}requestLocalScreenshare(e){if(this.screenshareProducer){const t=new MediaStream;t.addTrack(this.screenshareProducer.track),e.srcObject=t}else console.log("screenshare producer not available yet")}consumePeer({peerId:e,producersData:t}){t.forEach((t=>{this.consumeProducer({peerId:e,producerId:t.producerId,deviceType:t.deviceType,paused:t.paused})}))}getRecvTransport(e){return"microphone"===e?this.recvAudioTransports:this.recvVideoTransports}async consumeProducer({peerId:e,producerId:t,deviceType:r,paused:n}){const i=this.getRecvTransport(r);if(!i)throw new Error(`transport for ${r} not found`);const a=await this.protoo.request("consume",{peerId:e,producerId:t,transportId:i.transport.id,rtpCapabilities:this.mediasoupDevice.rtpCapabilities}),s=this.peers.get(e);s&&s.producersData.push({producerId:t,deviceType:r,paused:n});const{producerId:o,id:c,kind:l,rtpParameters:d,appData:u}=a;console.log("Data: ",a);try{const t=await i.transport.consume({id:c,producerId:o,kind:l,rtpParameters:d,appData:{...u,peerId:e}});console.log("transport",i.transport),console.log("consumer",t),this.consumers.set(t.id,{mediaSoupConsumer:t,deviceType:r}),this.scaleVideoEncodingsParameter();const a=new Si("mediaStart",{detail:{peerId:e,mediaId:t.id,deviceType:r,paused:n}});if(this.dispatchEvent(a),"audio"===t.kind){const e=this.createAudioRenderer(t.id),r=new MediaStream;r.addTrack(t.track),e.setSource(r),e.play()}"video"===t.kind&&await this.protoo.request("resumeConsumer",{consumerId:t.id})}catch(e){throw this.onCriticalError(wi),console.error("newConsumer request failed",e),e}}async setDisplayName(e){await this.setProfile({name:e});const t=new Si("selfDisplayName",{detail:{peerId:this.peerId,displayName:this.profile?.name,profile:this.profile}});this.dispatchEvent(t)}async setProfile(e){const t=await this.protoo.request("setProfile",e);this.profile={...t};const r=new Si("selfProfileUpdate",{detail:{peerId:this.peerId,profile:this.profile}});this.dispatchEvent(r)}async requestPeerDevice(e,t){return this.protoo.request("requestPeerDevice",{remotePeerId:e,deviceType:t})}denyDeviceRequest(e){this.resolvePendingDeviceRequest(e,!1,"user denied permission")}async getCallId(){try{const{callId:e}=await this.protoo.request("getCallId");return e}catch(e){throw console.error("Failed to get callId"),e}}getConsumers(){return this.consumers}getDevicesState(){const e=!!this.micProducer&&!this.micProducer.closed,t=!!this.webcamProducer&&!this.webcamProducer.closed,r=!!this.screenshareProducer&&!this.screenshareProducer.closed;return{microphone:{enabled:e,muted:this.muted},camera:{enabled:t},screenshare:{enabled:r}}}getCustomMessageEventChunks(e){const t=JSON.stringify(e),r=[];for(let e=0;e<t.length;e+=9e4)r.push(t.substring(e,e+9e4));return r}async sendCustomMessageToAll(e){const t=Zr(),r=this.getCustomMessageEventChunks(e),n=r.map(((e,n)=>this.protoo.notify("customMessageToAllPeers",{messageId:t,chunkIndex:n,chunk:e,totalChunks:r.length})));await Promise.all(n)}async sendCustomMessage(e,t){const r=Zr(),n=this.getCustomMessageEventChunks(t),i=n.map(((t,i)=>this.protoo.notify("customMessageToPeer",{peerId:e,event:{messageId:r,chunkIndex:i,chunk:t,totalChunks:n.length}})));await Promise.all(i)}async listAudioDevices(){return(await navigator.mediaDevices.enumerateDevices()).filter((e=>"audioinput"===e.kind||"audiooutput"===e.kind))}async listVideoDevices(){return(await navigator.mediaDevices.enumerateDevices()).filter((e=>"videoinput"===e.kind))}isListDevicesSupported(){return Boolean(navigator.mediaDevices?.enumerateDevices)}getCurrentWebcam(){return this.webcam}async setWebcamResolution(e){if(this.webcam.device)await this.switchWebcam({resolution:e});else{this.webcam.resolution=e;const t=new Si("localVideoChange",{detail:{camera:this.getCurrentWebcam()}});this.dispatchEvent(t)}}createAudioRenderer(e){const t=new En({consumerId:e});return this.audioRenderers[e]=t,t}deleteAudioRenderer(e){this.audioRenderers[e]?.destroy(),delete this.audioRenderers[e]}async playAudioRenderer(e){await(this.audioRenderers[e]?.play())}async setAudioSink(e){const t=Object.keys(this.audioRenderers).map((t=>this.audioRenderers[t].setSink(e).catch((e=>console.warn("Failed to setSinkId on renderer (consumerId: %s): ",t,e)))));await Promise.allSettled(t)}dispatchEvent(e){const t=super.dispatchEvent(e);return window.dispatchEvent(e),t}async getShareLinkData(e){return await this.protoo.request("shareLink",{url:e})}async fetchAgentInfo({apiKey:e,email:t}){const r=this.config.apiUrl;return await fetch(`${r}/agents/${t}`,{method:"get",headers:{Authorization:`Bearer ${e}`}}).then((e=>{if(e.ok)return e.json();throw new Error("Invalid agent info")}))}setConfig(e){this.config={...this.config,...e}}};var Ci=(0,(d=a("85Hg2")).createContext)({});d=a("85Hg2");let Ri;var Pi;(Pi=Ri||(Ri={}))[Pi.SET_STREAMS=0]="SET_STREAMS",Pi[Pi.ADD_STREAM=1]="ADD_STREAM",Pi[Pi.REMOVE_STREAM=2]="REMOVE_STREAM",Pi[Pi.DEVICE_UPDATE=3]="DEVICE_UPDATE",Pi[Pi.MUTE=4]="MUTE",Pi[Pi.UNMUTE=5]="UNMUTE",Pi[Pi.SET_HIGHLIGHTED_TILE=6]="SET_HIGHLIGHTED_TILE",Pi[Pi.UNSET_HIGHLIGHTED_TILE=7]="UNSET_HIGHLIGHTED_TILE",Pi[Pi.SET_STREAM_PROFILE=8]="SET_STREAM_PROFILE",Pi[Pi.SET_STREAM_SPEAKING=9]="SET_STREAM_SPEAKING";const Ti={streams:[],highlightedTile:null},ji=(e,t)=>{switch(t.type){case Ri.SET_STREAMS:return{...e,streams:t.payload};case Ri.ADD_STREAM:return e.streams.find((e=>e.id===t.payload.id))?e:{...e,streams:[...e.streams,t.payload]};case Ri.REMOVE_STREAM:return{...e,streams:[...e.streams.filter((e=>e.id!==t.payload.id))]};case Ri.DEVICE_UPDATE:{const{streamId:r,mediaId:n,device:i,available:a,paused:s}=t.payload;return{...e,streams:e.streams.map((e=>{if(e.id===r){let t=e.muted;return"microphone"===i&&(t=s),{...e,[i]:a?n:null,muted:t}}return e}))}}case Ri.MUTE:return{...e,streams:e.streams.map((e=>e.id===t.payload.streamId?{...e,muted:!0}:e))};case Ri.UNMUTE:return{...e,streams:e.streams.map((e=>e.id===t.payload.streamId?{...e,muted:!1}:e))};case Ri.SET_HIGHLIGHTED_TILE:return{...e,highlightedTile:t.payload};case Ri.UNSET_HIGHLIGHTED_TILE:return{...e,highlightedTile:null};case Ri.SET_STREAM_PROFILE:return{...e,streams:e.streams.map((e=>e.id===t.payload.streamId?{...e,profile:t.payload.profile}:e))};case Ri.SET_STREAM_SPEAKING:return{...e,streams:e.streams.map((e=>e.id===t.payload.streamId?{...e,isSpeaking:t.payload.isSpeaking}:e))};default:return e}},Mi=(0,d.createContext)(void 0),Ii=({children:e})=>{const[t,r]=(0,d.useReducer)(ji,Ti),n={state:t,dispatch:r};return(0,s.jsx)(Mi.Provider,{value:n,children:e})},Di=()=>{const e=(0,d.useContext)(Mi);if(void 0===e)throw new Error("useStreams must be used within a StreamsProvider");return{streams:e.state.streams,highlightedTile:e.state.highlightedTile,dispatch:e.dispatch}};var Oi=e=>navigator.clipboard?navigator.clipboard.writeText(e):new Promise(((t,r)=>{((e,t,r)=>{const n=document.createRange(),i=document.createElement("textarea");if(i.value=e,document.body.appendChild(i),navigator.userAgent.match(/ipad|ipod|iphone/i)){i.readOnly=!1,i.contentEditable="true",n.selectNodeContents(i);const e=window.getSelection();e&&(e.removeAllRanges(),e.addRange(n)),i.setSelectionRange(0,999999)}else i.focus(),i.select();try{document.execCommand("copy")?t():r(new Error("Copy to clipboard fallback failed"))}catch(e){e instanceof Error?r(e):console.error(e)}document.body.removeChild(i)})(e,t,r)}));const Li=vr.path`
135
+ !function(e){var t=0,r=!1,n=!1;try{var i=Object.defineProperty({},"passive",{get:function(){n=!0}});window.addEventListener("test",null,i)}catch(e){}var a=function(e){var r=e.target,n=window.innerWidth/window.document.documentElement.clientWidth;if(!(e.touches.length>1||1!==n)){for(;r!==document.body&&r!==document;){var i=window.getComputedStyle(r);if(!i)break;if("INPUT"===r.nodeName&&"range"===r.getAttribute("type"))return;var a=i.getPropertyValue("-webkit-overflow-scrolling"),s=i.getPropertyValue("overflow-y"),o=parseInt(i.getPropertyValue("height"),10),c="touch"===a&&("auto"===s||"scroll"===s),l=r.scrollHeight>r.offsetHeight;if(c&&l){var d=e.touches?e.touches[0].screenY:e.screenY,u=t<=d&&0===r.scrollTop,p=t>=d&&r.scrollHeight-r.scrollTop===o;return void((u||p)&&e.preventDefault())}r=r.parentNode}e.preventDefault()}},s=function(e){t=e.touches?e.touches[0].screenY:e.screenY},o=function(){window.addEventListener("touchstart",s,!!n&&{passive:!1}),window.addEventListener("touchmove",a,!!n&&{passive:!1}),r=!0},c=document.createElement("div");document.documentElement.appendChild(c),c.style.WebkitOverflowScrolling="touch";var l="getComputedStyle"in window&&"touch"===window.getComputedStyle(c)["-webkit-overflow-scrolling"];document.documentElement.removeChild(c),l&&o();var d={enable:o,disable:function(){window.removeEventListener("touchstart",s,!1),window.removeEventListener("touchmove",a,!1),r=!1},isEnabled:function(){return r},isScrollSupported:l};Lr&&(Lr=d),"function"==typeof e.define?(0,e.define)("iNoBounce",[],(function(){return d})):e.iNoBounce=d}(Lr);d=a("85Hg2");var Ar,Nr=a("4Fy4N"),Fr=new Uint8Array(16);function zr(){if(!Ar&&!(Ar="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ar(Fr)}var Br=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;for(var Ur=function(e){return"string"==typeof e&&Br.test(e)},Vr=[],Hr=0;Hr<256;++Hr)Vr.push((Hr+256).toString(16).substr(1));var Wr=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(Vr[e[t+0]]+Vr[e[t+1]]+Vr[e[t+2]]+Vr[e[t+3]]+"-"+Vr[e[t+4]]+Vr[e[t+5]]+"-"+Vr[e[t+6]]+Vr[e[t+7]]+"-"+Vr[e[t+8]]+Vr[e[t+9]]+"-"+Vr[e[t+10]]+Vr[e[t+11]]+Vr[e[t+12]]+Vr[e[t+13]]+Vr[e[t+14]]+Vr[e[t+15]]).toLowerCase();if(!Ur(r))throw TypeError("Stringified UUID is invalid");return r};var qr,$r,Gr,Zr=function(e,t,r){var n=(e=e||{}).random||(e.rng||zr)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(var i=0;i<16;++i)t[r+i]=n[i];return t}return Wr(n)},Kr=JSON.parse('{"name":"protoo-client","version":"4.0.6","description":"protoo JavaScript client module","author":"Iñaki Baz Castillo <ibc@aliax.net>","homepage":"https://protoo.versatica.com","license":"MIT","repository":{"type":"git","url":"https://github.com/ibc/protoo.git"},"main":"lib/index.js","keywords":["nodejs","browser","websocket"],"engines":{"node":">=8.0.0"},"scripts":{"lint":"eslint -c .eslintrc.js lib"},"dependencies":{"debug":"^4.3.1","events":"^3.2.0","retry":"^0.12.0"},"devDependencies":{"eslint":"^5.16.0"},"optionalDependencies":{"websocket":"^1.0.33"}}').version,Qr={},Yr=a("hZG0u");const Jr="protoo-client";Qr=class{constructor(e){e?(this._debug=Yr(`protoo-client:${e}`),this._warn=Yr(`protoo-client:WARN:${e}`),this._error=Yr(`protoo-client:ERROR:${e}`)):(this._debug=Yr(Jr),this._warn=Yr("protoo-client:WARN"),this._error=Yr("protoo-client:ERROR")),this._debug.log=console.info.bind(console),this._warn.log=console.warn.bind(console),this._error.log=console.error.bind(console)}get debug(){return this._debug}get warn(){return this._warn}get error(){return this._error}};var Xr,en=a("3oV8N").EventEmitter;Xr=class extends en{constructor(e){super(),this.setMaxListeners(1/0),this._logger=e||new Qr("EnhancedEventEmitter")}safeEmit(e,...t){try{this.emit(e,...t)}catch(t){this._logger.error("safeEmit() | event listener threw an error [event:%s]:%o",e,t)}}async safeEmitAsPromise(e,...t){return new Promise(((r,n)=>{this.safeEmit(e,...t,r,n)}))}};var tn={},rn=function(){return Math.round(1e7*Math.random())};const nn=new Qr("Message");tn=class{static parse(e){let t;const r={};try{t=JSON.parse(e)}catch(e){return void nn.error("parse() | invalid JSON: %s",e)}if("object"==typeof t&&!Array.isArray(t)){if(t.request){if(r.request=!0,"string"!=typeof t.method)return void nn.error("parse() | missing/invalid method field");if("number"!=typeof t.id)return void nn.error("parse() | missing/invalid id field");r.id=t.id,r.method=t.method,r.data=t.data||{}}else if(t.response){if(r.response=!0,"number"!=typeof t.id)return void nn.error("parse() | missing/invalid id field");r.id=t.id,t.ok?(r.ok=!0,r.data=t.data||{}):(r.ok=!1,r.errorCode=t.errorCode,r.errorReason=t.errorReason)}else{if(!t.notification)return void nn.error("parse() | missing request/response field");if(r.notification=!0,"string"!=typeof t.method)return void nn.error("parse() | missing/invalid method field");r.method=t.method,r.data=t.data||{}}return r}nn.error("parse() | not an object")}static createRequest(e,t){return{request:!0,id:rn(),method:e,data:t||{}}}static createSuccessResponse(e,t){return{response:!0,id:e.id,ok:!0,data:t||{}}}static createErrorResponse(e,t,r){return{response:!0,id:e.id,ok:!1,errorCode:t,errorReason:r}}static createNotification(e,t){return{notification:!0,method:e,data:t||{}}}};const an=new Qr("Peer");Gr=class extends Xr{constructor(e){super(an),an.debug("constructor()"),this._closed=!1,this._transport=e,this._connected=!1,this._data={},this._sents=new Map,this._handleTransport()}get closed(){return this._closed}get connected(){return this._connected}get data(){return this._data}set data(e){throw new Error("cannot override data object")}close(){if(!this._closed){an.debug("close()"),this._closed=!0,this._connected=!1,this._transport.close();for(const e of this._sents.values())e.close();this.safeEmit("close")}}async request(e,t){const r=tn.createRequest(e,t);return this._logger.debug("request() [method:%s, id:%s]",e,r.id),await this._transport.send(r),new Promise(((e,t)=>{const n=1500*(15+.1*this._sents.size),i={id:r.id,method:r.method,resolve:t=>{this._sents.delete(r.id)&&(clearTimeout(i.timer),e(t))},reject:e=>{this._sents.delete(r.id)&&(clearTimeout(i.timer),t(e))},timer:setTimeout((()=>{this._sents.delete(r.id)&&t(new Error("request timeout"))}),n),close:()=>{clearTimeout(i.timer),t(new Error("peer closed"))}};this._sents.set(r.id,i)}))}async notify(e,t){const r=tn.createNotification(e,t);this._logger.debug("notify() [method:%s]",e),await this._transport.send(r)}_handleTransport(){if(this._transport.closed)return this._closed=!0,void setTimeout((()=>{this._closed||(this._connected=!1,this.safeEmit("close"))}));this._transport.on("open",(()=>{this._closed||(an.debug('emit "open"'),this._connected=!0,this.safeEmit("open"))})),this._transport.on("disconnected",(()=>{this._closed||(an.debug('emit "disconnected"'),this._connected=!1,this.safeEmit("disconnected"))})),this._transport.on("failed",(e=>{this._closed||(an.debug('emit "failed" [currentAttempt:%s]',e),this._connected=!1,this.safeEmit("failed",e))})),this._transport.on("close",(()=>{this._closed||(this._closed=!0,an.debug('emit "close"'),this._connected=!1,this.safeEmit("close"))})),this._transport.on("message",(e=>{e.request?this._handleRequest(e):e.response?this._handleResponse(e):e.notification&&this._handleNotification(e)}))}_handleRequest(e){try{this.emit("request",e,(t=>{const r=tn.createSuccessResponse(e,t);this._transport.send(r).catch((()=>{}))}),((t,r)=>{t instanceof Error?(r=t.message,t=500):"number"==typeof t&&r instanceof Error&&(r=r.message);const n=tn.createErrorResponse(e,t,r);this._transport.send(n).catch((()=>{}))}))}catch(t){const r=tn.createErrorResponse(e,500,String(t));this._transport.send(r).catch((()=>{}))}}_handleResponse(e){const t=this._sents.get(e.id);if(t)if(e.ok)t.resolve(e.data);else{const r=new Error(e.errorReason);r.code=e.errorCode,t.reject(r)}else an.error("received response does not match any sent request [id:%s]",e.id)}_handleNotification(e){this.safeEmit("notification",e)}};var sn;if("object"==typeof globalThis)sn=globalThis;else try{sn=a("jCEG4")}catch(e){}finally{if(sn||"undefined"==typeof window||(sn=window),!sn)throw new Error("Could not determine global this")}var on,cn=sn.WebSocket||sn.MozWebSocket;function ln(e,t){return t?new cn(e,t):new cn(e)}on=a("kUMHr").version,cn&&["CONNECTING","OPEN","CLOSING","CLOSED"].forEach((function(e){Object.defineProperty(ln,e,{get:function(){return cn[e]}})}));var dn={w3cwebsocket:cn?ln:null,version:on}.w3cwebsocket,un={};un=a("jxXWz");const pn={retries:10,factor:2,minTimeout:1e3,maxTimeout:8e3},hn=new Qr("WebSocketTransport");qr=Gr,$r=class extends Xr{constructor(e,t){super(hn),hn.debug("constructor() [url:%s, options:%o]",e,t),this._closed=!1,this._url=e,this._options=t||{},this._ws=null,this._runWebSocket()}get closed(){return this._closed}close(){if(!this._closed){hn.debug("close()"),this._closed=!0,this.safeEmit("close");try{this._ws.onopen=null,this._ws.onclose=null,this._ws.onerror=null,this._ws.onmessage=null,this._ws.close()}catch(e){hn.error("close() | error closing the WebSocket: %o",e)}}}async send(e){if(this._closed)throw new Error("transport closed");try{this._ws.send(JSON.stringify(e))}catch(e){throw hn.warn("send() failed:%o",e),e}}_runWebSocket(){const e=un.operation(this._options.retry||pn);let t=!1;e.attempt((r=>{this._closed?e.stop():(hn.debug("_runWebSocket() [currentAttempt:%s]",r),this._ws=new dn(this._url,"protoo",this._options.origin,this._options.headers,this._options.requestOptions,this._options.clientConfig),this._ws.onopen=()=>{this._closed||(t=!0,this.safeEmit("open"))},this._ws.onclose=n=>{if(!this._closed){if(hn.warn('WebSocket "close" event [wasClean:%s, code:%s, reason:"%s"]',n.wasClean,n.code,n.reason),4e3!==n.code){if(t){if(e.stop(),this.safeEmit("disconnected"),this._closed)return;return void this._runWebSocket()}if(this.safeEmit("failed",r),this._closed)return;if(e.retry(!0))return}this._closed=!0,this.safeEmit("close")}},this._ws.onerror=()=>{this._closed||hn.error('WebSocket "error" event')},this._ws.onmessage=e=>{if(this._closed)return;const t=tn.parse(e.data);t&&(0!==this.listenerCount("message")?this.safeEmit("message",t):hn.error('no listeners for WebSocket "message" event, ignoring received message'))})}))}};var fn={},mn=fn&&fn.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),gn=fn&&fn.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),vn=fn&&fn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&mn(t,e,r);return gn(t,e),t},yn=fn&&fn.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(fn,"__esModule",{value:!0}),fn.debug=fn.parseScalabilityMode=fn.detectDevice=fn.Device=fn.version=fn.types=void 0;const bn=yn(a("hZG0u"));fn.debug=bn.default;var wn=a("1ZHQC");Object.defineProperty(fn,"Device",{enumerable:!0,get:function(){return wn.Device}}),Object.defineProperty(fn,"detectDevice",{enumerable:!0,get:function(){return wn.detectDevice}});const xn=vn(a("cQumC"));fn.types=xn,fn.version="3.6.53";var _n=a("fT1lN");Object.defineProperty(fn,"parseScalabilityMode",{enumerable:!0,get:function(){return _n.parse}});const Sn=window.AudioContext||window.webkitAudioContext;class kn{speakStartEventTime=0;speakStopEventTime=0;speaking=!1;audioMedianInterval=-1;audioLevelInterval=-1;audioLevels=[];constructor(e,t){this.id=e.id,this.listener=t,this.stream=e,this.audioContext=new Sn,this.analyser=this.audioContext.createAnalyser(),this.audioStreamSource=this.audioContext.createMediaStreamSource(this.stream),this.analyser.fftSize=32,this.analyser.minDecibels=-90,this.analyser.maxDecibels=-10,this.audioStreamSource.connect(this.analyser)}getAudioLevelMedian(){const{length:e}=this.audioLevels;return this.audioLevels.reduce(((e,t)=>e+t),0)/e}getCurrentAudioLevel(){const{length:e}=this.audioLevels;return e?this.audioLevels[e-1]:0}audioMuteDetection(){0===this.getAudioLevelMedian()&&this.audioLevels.length>0&&this.listener?.onMuteDetection?.(this.id)}detectSpeakingChange(e){e<20&&!this.speakStopEventTime&&(this.speakStartEventTime=0,this.speakStopEventTime=Date.now()),e>=20&&!this.speakStartEventTime&&(this.speakStartEventTime=Date.now(),this.speakStopEventTime=0);const t=this.speakStartEventTime||this.speakStopEventTime,r=Boolean(this.speakStartEventTime);(Date.now()-t>500&&r||Date.now()-t>300&&!r)&&this.speaking!==r&&(this.speaking=r,r?this.listener?.onStartSpeak():this.listener?.onStopSpeak())}computeRMS(e){let t=0;for(let r=0;r<e.length;r++)t+=e[r]*e[r];return t/=e.length,Math.sqrt(t)}getInstantAudioLevel(){const e=new Uint8Array(this.analyser.frequencyBinCount);this.analyser.getByteFrequencyData(e);const t=this.computeRMS(e);return t>0?100*t/255:0}loopCalcul(){const e=this.getInstantAudioLevel();this.audioLevels=this.audioLevels.splice(-59),this.detectSpeakingChange(e),this.audioLevels.push(e),this.listener?.onAudioLevel?.(e,this.id)}analyse(){this.audioLevelInterval=window.setInterval((()=>this.loopCalcul()),1e3/60),this.audioMedianInterval=window.setInterval((()=>this.audioMuteDetection()),2e3)}release(){this.listener=void 0,clearInterval(this.audioLevelInterval),clearInterval(this.audioMedianInterval),this.stream.getTracks().forEach((e=>{this.stream.removeTrack(e)}));try{this.audioStreamSource.disconnect(this.analyser)}catch(e){console.error("audioStreamSource failed to disconnect",e)}this.audioContext.close().catch((e=>{console.error("audioContext failed to close",e)})),this.audioLevels=[]}static isAPIAvailable(){return!!Sn}}var En=class{constructor({consumerId:e}){this.consumerId=e,this.audio=new Audio,this.audio.id=e,this.audio.autoplay=!0,document.body.appendChild(this.audio)}destroy(){this.audio.pause(),this.audio.srcObject=null,document.body.removeChild(this.audio)}setSource(e){this.audio.srcObject=e}async setSink(e){await(this.audio.setSinkId?.(e))}async play(){await this.audio.play().catch((e=>{console.warn("failed to play"),setTimeout((()=>{this.play()}),1e3)}))}},Cn={};e(Cn,"FunctionToString",(()=>Gn)),e(Cn,"InboundFilters",(()=>Kn));var Rn=Object.prototype.toString;function Pn(e,t){return Rn.call(e)===`[object ${t}]`}function Tn(e){return Pn(e,"String")}function jn(e){return Pn(e,"Object")}function Mn(e){return Boolean(e&&e.then&&"function"==typeof e.then)}var In=(0,(Nn=a("bWPEY")).getGlobalObject)(),Dn=["debug","info","warn","error","log","assert","trace"];function On(e){var t=(0,Nn.getGlobalObject)();if(!("console"in t))return e();var r=t.console,n={};Dn.forEach((e=>{var i=r[e]&&r[e].__sentry_original__;e in t.console&&i&&(n[e]=r[e],r[e]=i)}));try{return e()}finally{Object.keys(n).forEach((e=>{r[e]=n[e]}))}}function Ln(){let e=!1;var t={enable:()=>{e=!0},disable:()=>{e=!1}};return"undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__?Dn.forEach((r=>{t[r]=(...t)=>{e&&On((()=>{In.console[r](`Sentry Logger [${r}]:`,...t)}))}})):Dn.forEach((e=>{t[e]=()=>{}})),t}let An;An="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__?(0,Nn.getGlobalSingleton)("logger",Ln):Ln();var Nn=a("bWPEY");Nn=a("bWPEY");function Fn(e,t){return!!Tn(e)&&(Pn(t,"RegExp")?t.test(e):"string"==typeof t&&-1!==e.indexOf(t))}function zn(e){return Bn(e,new Map)}function Bn(e,t){if(jn(e)){if(void 0!==(i=t.get(e)))return i;var r={};for(var n of(t.set(e,r),Object.keys(e)))void 0!==e[n]&&(r[n]=Bn(e[n],t));return r}if(Array.isArray(e)){var i;if(void 0!==(i=t.get(e)))return i;r=[];return t.set(e,r),e.forEach((e=>{r.push(Bn(e,t))})),r}return e}function Un(){var e=(0,Nn.getGlobalObject)(),t=e.crypto||e.msCrypto;if(void 0!==t&&t.getRandomValues){var r=new Uint16Array(8);t.getRandomValues(r),r[3]=4095&r[3]|16384,r[4]=16383&r[4]|32768;var n=e=>{let t=e.toString(16);for(;t.length<4;)t=`0${t}`;return t};return n(r[0])+n(r[1])+n(r[2])+n(r[3])+n(r[4])+n(r[5])+n(r[6])+n(r[7])}return"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,(e=>{var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))}function Vn(e){return e.exception&&e.exception.values?e.exception.values[0]:void 0}function Hn(e){const{message:t,event_id:r}=e;if(t)return t;var n=Vn(e);return n?n.type&&n.value?`${n.type}: ${n.value}`:n.type||n.value||r||"<unknown>":r||"<unknown>"}var Wn;!function(e){e[e.PENDING=0]="PENDING";e[e.RESOLVED=1]="RESOLVED";e[e.REJECTED=2]="REJECTED"}(Wn||(Wn={}));class qn{__init(){this._state=Wn.PENDING}__init2(){this._handlers=[]}constructor(e){qn.prototype.__init.call(this),qn.prototype.__init2.call(this),qn.prototype.__init3.call(this),qn.prototype.__init4.call(this),qn.prototype.__init5.call(this),qn.prototype.__init6.call(this);try{e(this._resolve,this._reject)}catch(e){this._reject(e)}}then(e,t){return new qn(((r,n)=>{this._handlers.push([!1,t=>{if(e)try{r(e(t))}catch(e){n(e)}else r(t)},e=>{if(t)try{r(t(e))}catch(e){n(e)}else n(e)}]),this._executeHandlers()}))}catch(e){return this.then((e=>e),e)}finally(e){return new qn(((t,r)=>{let n,i;return this.then((t=>{i=!1,n=t,e&&e()}),(t=>{i=!0,n=t,e&&e()})).then((()=>{i?r(n):t(n)}))}))}__init3(){this._resolve=e=>{this._setResult(Wn.RESOLVED,e)}}__init4(){this._reject=e=>{this._setResult(Wn.REJECTED,e)}}__init5(){this._setResult=(e,t)=>{this._state===Wn.PENDING&&(Mn(t)?t.then(this._resolve,this._reject):(this._state=e,this._value=t,this._executeHandlers()))}}__init6(){this._executeHandlers=()=>{if(this._state!==Wn.PENDING){var e=this._handlers.slice();this._handlers=[],e.forEach((e=>{e[0]||(this._state===Wn.RESOLVED&&e[1](this._value),this._state===Wn.REJECTED&&e[2](this._value),e[0]=!0)}))}}}}let $n;class Gn{constructor(){Gn.prototype.__init.call(this)}static __initStatic(){this.id="FunctionToString"}__init(){this.name=Gn.id}setupOnce(){$n=Function.prototype.toString,Function.prototype.toString=function(...e){var t=this.__sentry_original__||this;return $n.apply(t,e)}}}Gn.__initStatic();var Zn=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/];class Kn{static __initStatic(){this.id="InboundFilters"}__init(){this.name=Kn.id}constructor(e={}){this._options=e,Kn.prototype.__init.call(this)}setupOnce(e,t){var r=e=>{var r=t();if(r){var n=r.getIntegration(Kn);if(n){var i=r.getClient(),a=i?i.getOptions():{},s=function(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...Zn],ignoreInternal:void 0===e.ignoreInternal||e.ignoreInternal}}(n._options,a);return function(e,t){if(t.ignoreInternal&&function(e){try{return"SentryError"===e.exception.values[0].type}catch(e){}return!1}(e))return("undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__)&&An.warn(`Event dropped due to being internal Sentry Error.\nEvent: ${Hn(e)}`),!0;if(function(e,t){return!(!t||!t.length)&&function(e){if(e.message)return[e.message];if(e.exception)try{const{type:t="",value:r=""}=e.exception.values&&e.exception.values[0]||{};return[`${r}`,`${t}: ${r}`]}catch(t){return("undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__)&&An.error(`Cannot extract message for event ${Hn(e)}`),[]}return[]}(e).some((e=>t.some((t=>Fn(e,t)))))}(e,t.ignoreErrors))return("undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__)&&An.warn(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${Hn(e)}`),!0;if(function(e,t){if(!t||!t.length)return!1;var r=Qn(e);return!!r&&t.some((e=>Fn(r,e)))}(e,t.denyUrls))return("undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__)&&An.warn(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${Hn(e)}.\nUrl: ${Qn(e)}`),!0;if(!function(e,t){if(!t||!t.length)return!0;var r=Qn(e);return!r||t.some((e=>Fn(r,e)))}(e,t.allowUrls))return("undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__)&&An.warn(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${Hn(e)}.\nUrl: ${Qn(e)}`),!0;return!1}(e,s)?null:e}}return e};r.id=this.name,e(r)}}function Qn(e){try{let t;try{t=e.exception.values[0].stacktrace.frames}catch(e){}return t?function(e=[]){for(let r=e.length-1;r>=0;r--){var t=e[r];if(t&&"<anonymous>"!==t.filename&&"[native code]"!==t.filename)return t.filename||null}return null}(t):null}catch(t){return("undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__)&&An.error(`Cannot extract url for event ${Hn(e)}`),null}}Kn.__initStatic();var Yn=a("gTODe"),Jn=(Nn=a("bWPEY"),a("hLvaX"));a("gTODe"),Nn=a("bWPEY"),Yn=a("gTODe");function Xn(e){var t=(0,Yn.timestampInSeconds)(),r={sid:Un(),init:!0,timestamp:t,started:t,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>function(e){return zn({sid:`${e.sid}`,init:e.init,started:new Date(1e3*e.started).toISOString(),timestamp:new Date(1e3*e.timestamp).toISOString(),status:e.status,errors:e.errors,did:"number"==typeof e.did||"string"==typeof e.did?`${e.did}`:void 0,duration:e.duration,attrs:{release:e.release,environment:e.environment,ip_address:e.ipAddress,user_agent:e.userAgent}})}(r)};return e&&ei(r,e),r}function ei(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),e.did||t.did||(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||(0,Yn.timestampInSeconds)(),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=32===t.sid.length?t.sid:Un()),void 0!==t.init&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),"number"==typeof t.started&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if("number"==typeof t.duration)e.duration=t.duration;else{var r=e.timestamp-e.started;e.duration=r>=0?r:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),"number"==typeof t.errors&&(e.errors=t.errors),t.status&&(e.status=t.status)}function ti(e,t){let r={};t?r={status:t}:"ok"===e.status&&(r={status:"exited"}),ei(e,r)}class ri{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={}}static clone(e){var t=new ri;return e&&(t._breadcrumbs=[...e._breadcrumbs],t._tags={...e._tags},t._extra={...e._extra},t._contexts={...e._contexts},t._user=e._user,t._level=e._level,t._span=e._span,t._session=e._session,t._transactionName=e._transactionName,t._fingerprint=e._fingerprint,t._eventProcessors=[...e._eventProcessors],t._requestSession=e._requestSession,t._attachments=[...e._attachments]),t}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{},this._session&&ei(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(e){return this._requestSession=e,this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,t){return this._tags={...this._tags,[e]:t},this._notifyScopeListeners(),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,t){return this._extra={...this._extra,[e]:t},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,t){return null===t?delete this._contexts[e]:this._contexts={...this._contexts,[e]:t},this._notifyScopeListeners(),this}setSpan(e){return this._span=e,this._notifyScopeListeners(),this}getSpan(){return this._span}getTransaction(){var e=this.getSpan();return e&&e.transaction}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;if("function"==typeof e){var t=e(this);return t instanceof ri?t:this}return e instanceof ri?(this._tags={...this._tags,...e._tags},this._extra={...this._extra,...e._extra},this._contexts={...this._contexts,...e._contexts},e._user&&Object.keys(e._user).length&&(this._user=e._user),e._level&&(this._level=e._level),e._fingerprint&&(this._fingerprint=e._fingerprint),e._requestSession&&(this._requestSession=e._requestSession)):jn(e)&&(this._tags={...this._tags,...e.tags},this._extra={...this._extra,...e.extra},this._contexts={...this._contexts,...e.contexts},e.user&&(this._user=e.user),e.level&&(this._level=e.level),e.fingerprint&&(this._fingerprint=e.fingerprint),e.requestSession&&(this._requestSession=e.requestSession)),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._span=void 0,this._session=void 0,this._notifyScopeListeners(),this._attachments=[],this}addBreadcrumb(e,t){var r="number"==typeof t?Math.min(t,100):100;if(r<=0)return this;var n={timestamp:(0,Yn.dateTimestampInSeconds)(),...e};return this._breadcrumbs=[...this._breadcrumbs,n].slice(-r),this._notifyScopeListeners(),this}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}getAttachments(){return this._attachments}clearAttachments(){return this._attachments=[],this}applyToEvent(e,t={}){if(this._extra&&Object.keys(this._extra).length&&(e.extra={...this._extra,...e.extra}),this._tags&&Object.keys(this._tags).length&&(e.tags={...this._tags,...e.tags}),this._user&&Object.keys(this._user).length&&(e.user={...this._user,...e.user}),this._contexts&&Object.keys(this._contexts).length&&(e.contexts={...this._contexts,...e.contexts}),this._level&&(e.level=this._level),this._transactionName&&(e.transaction=this._transactionName),this._span){e.contexts={trace:this._span.getTraceContext(),...e.contexts};var r=this._span.transaction&&this._span.transaction.name;r&&(e.tags={transaction:r,...e.tags})}return this._applyFingerprint(e),e.breadcrumbs=[...e.breadcrumbs||[],...this._breadcrumbs],e.breadcrumbs=e.breadcrumbs.length>0?e.breadcrumbs:void 0,e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...this._sdkProcessingMetadata},this._notifyEventProcessors([...ni(),...this._eventProcessors],e,t)}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata={...this._sdkProcessingMetadata,...e},this}_notifyEventProcessors(e,t,r,n=0){return new qn(((i,a)=>{var s=e[n];if(null===t||"function"!=typeof s)i(t);else{var o=s({...t},r);("undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__)&&s.id&&null===o&&An.log(`Event processor "${s.id}" dropped event`),Mn(o)?o.then((t=>this._notifyEventProcessors(e,t,r,n+1).then(i))).then(null,a):this._notifyEventProcessors(e,o,r,n+1).then(i).then(null,a)}}))}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach((e=>{e(this)})),this._notifyingListeners=!1)}_applyFingerprint(e){e.fingerprint=e.fingerprint?Array.isArray(e.fingerprint)?e.fingerprint:[e.fingerprint]:[],this._fingerprint&&(e.fingerprint=e.fingerprint.concat(this._fingerprint)),e.fingerprint&&!e.fingerprint.length&&delete e.fingerprint}}function ni(){return(0,Nn.getGlobalSingleton)("globalEventProcessors",(()=>[]))}var ii=100;class ai{__init(){this._stack=[{}]}constructor(e,t=new ri,r=4){this._version=r,ai.prototype.__init.call(this),this.getStackTop().scope=t,e&&this.bindClient(e)}isOlderThan(e){return this._version<e}bindClient(e){this.getStackTop().client=e,e&&e.setupIntegrations&&e.setupIntegrations()}pushScope(){var e=ri.clone(this.getScope());return this.getStack().push({client:this.getClient(),scope:e}),e}popScope(){return!(this.getStack().length<=1)&&!!this.getStack().pop()}withScope(e){var t=this.pushScope();try{e(t)}finally{this.popScope()}}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getStack(){return this._stack}getStackTop(){return this._stack[this._stack.length-1]}captureException(e,t){var r=this._lastEventId=t&&t.event_id?t.event_id:Un(),n=new Error("Sentry syntheticException");return this._withClient(((i,a)=>{i.captureException(e,{originalException:e,syntheticException:n,...t,event_id:r},a)})),r}captureMessage(e,t,r){var n=this._lastEventId=r&&r.event_id?r.event_id:Un(),i=new Error(e);return this._withClient(((a,s)=>{a.captureMessage(e,t,{originalException:e,syntheticException:i,...r,event_id:n},s)})),n}captureEvent(e,t){var r=t&&t.event_id?t.event_id:Un();return"transaction"!==e.type&&(this._lastEventId=r),this._withClient(((n,i)=>{n.captureEvent(e,{...t,event_id:r},i)})),r}lastEventId(){return this._lastEventId}addBreadcrumb(e,t){const{scope:r,client:n}=this.getStackTop();if(!r||!n)return;const{beforeBreadcrumb:i=null,maxBreadcrumbs:a=ii}=n.getOptions&&n.getOptions()||{};if(!(a<=0)){var s={timestamp:(0,Yn.dateTimestampInSeconds)(),...e},o=i?On((()=>i(s,t))):s;null!==o&&r.addBreadcrumb(o,a)}}setUser(e){var t=this.getScope();t&&t.setUser(e)}setTags(e){var t=this.getScope();t&&t.setTags(e)}setExtras(e){var t=this.getScope();t&&t.setExtras(e)}setTag(e,t){var r=this.getScope();r&&r.setTag(e,t)}setExtra(e,t){var r=this.getScope();r&&r.setExtra(e,t)}setContext(e,t){var r=this.getScope();r&&r.setContext(e,t)}configureScope(e){const{scope:t,client:r}=this.getStackTop();t&&r&&e(t)}run(e){var t=oi(this);try{e(this)}finally{oi(t)}}getIntegration(e){var t=this.getClient();if(!t)return null;try{return t.getIntegration(e)}catch(t){return("undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__)&&An.warn(`Cannot retrieve integration ${e.id} from the current Hub`),null}}startTransaction(e,t){return this._callExtensionMethod("startTransaction",e,t)}traceHeaders(){return this._callExtensionMethod("traceHeaders")}captureSession(e=!1){if(e)return this.endSession();this._sendSessionUpdate()}endSession(){var e=this.getStackTop(),t=e&&e.scope,r=t&&t.getSession();r&&ti(r),this._sendSessionUpdate(),t&&t.setSession()}startSession(e){const{scope:t,client:r}=this.getStackTop(),{release:n,environment:i}=r&&r.getOptions()||{};var a=(0,Nn.getGlobalObject)();const{userAgent:s}=a.navigator||{};var o=Xn({release:n,environment:i,...t&&{user:t.getUser()},...s&&{userAgent:s},...e});if(t){var c=t.getSession&&t.getSession();c&&"ok"===c.status&&ei(c,{status:"exited"}),this.endSession(),t.setSession(o)}return o}shouldSendDefaultPii(){var e=this.getClient(),t=e&&e.getOptions();return Boolean(t&&t.sendDefaultPii)}_sendSessionUpdate(){const{scope:e,client:t}=this.getStackTop();if(e){var r=e.getSession();r&&t&&t.captureSession&&t.captureSession(r)}}_withClient(e){const{scope:t,client:r}=this.getStackTop();r&&e(r,t)}_callExtensionMethod(e,...t){var r=si().__SENTRY__;if(r&&r.extensions&&"function"==typeof r.extensions[e])return r.extensions[e].apply(this,t);("undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__)&&An.warn(`Extension method ${e} couldn't be found, doing nothing.`)}}function si(){var e=(0,Nn.getGlobalObject)();return e.__SENTRY__=e.__SENTRY__||{extensions:{},hub:void 0},e}function oi(e){var t=si(),r=di(t);return ui(t,e),r}function ci(){var e=si();return li(e)&&!di(e).isOlderThan(4)||ui(e,new ai),(0,Jn.isNodeEnv)()?function(e){try{var t=si().__SENTRY__,r=t&&t.extensions&&t.extensions.domain&&t.extensions.domain.active;if(!r)return di(e);if(!li(r)||di(r).isOlderThan(4)){var n=di(e).getStackTop();ui(r,new ai(n.client,ri.clone(n.scope)))}return di(r)}catch(t){return di(e)}}(e):di(e)}function li(e){return!!(e&&e.__SENTRY__&&e.__SENTRY__.hub)}function di(e){return(0,Nn.getGlobalSingleton)("hub",(()=>new ai),e)}function ui(e,t){return!!e&&((e.__SENTRY__=e.__SENTRY__||{}).hub=t,!0)}function pi(e,t){return ci().captureException(e,{captureContext:t})}const hi=e=>new Promise((t=>{const r=window.devicePixelRatio||1,n=e.getContext("2d"),i=new Blob(['<svg width="103" height="36" fill="none" xmlns="http://www.w3.org/2000/svg"><g opacity=".8" fill="#fff"><path d="M10.994 33.06c.903 0 1.658-.734 1.392-1.581a5.249 5.249 0 0 0-1.279-2.124 5.171 5.171 0 0 0-3.673-1.535 5.171 5.171 0 0 0-3.673 1.535c-.595.6-1.03 1.33-1.28 2.124-.265.847.49 1.582 1.393 1.582h7.12ZM10.65 16.2c-.902 0-1.658.735-1.392 1.582.25.794.685 1.524 1.28 2.124a5.171 5.171 0 0 0 3.672 1.535 5.172 5.172 0 0 0 3.674-1.535 5.25 5.25 0 0 0 1.279-2.124c.266-.847-.49-1.582-1.393-1.582h-7.12ZM14.21 31.455c0 .887.75 1.63 1.606 1.35a5.187 5.187 0 0 0 2.067-1.279 5.264 5.264 0 0 0 1.521-3.706c0-1.39-.547-2.723-1.52-3.705a5.187 5.187 0 0 0-2.068-1.278c-.856-.281-1.606.462-1.606 1.349v7.27ZM7.434 17.806c0-.887-.75-1.63-1.607-1.35a5.186 5.186 0 0 0-2.066 1.279 5.264 5.264 0 0 0-1.522 3.706c0 1.39.548 2.723 1.522 3.705a5.186 5.186 0 0 0 2.066 1.278c.857.281 1.607-.462 1.607-1.349v-7.27Z"/><path d="M32.965 31.098c-1.442 0-2.601-.227-3.478-.68-.865-.465-1.517-1.043-1.955-1.734a.416.416 0 0 1-.052-.187c0-.125.057-.227.173-.306l.986-.731a.286.286 0 0 1 .208-.085c.103 0 .201.062.294.187.773 1.224 2.07 1.836 3.893 1.836.796 0 1.471-.142 2.025-.425.565-.284.848-.737.848-1.36 0-.465-.161-.827-.485-1.088-.311-.26-.796-.493-1.453-.697-.6-.181-.975-.289-1.125-.323-.992-.283-1.707-.504-2.146-.663-1.107-.408-1.84-.878-2.198-1.41-.357-.534-.536-1.089-.536-1.667 0-.476.15-.986.45-1.53.311-.555.796-1.025 1.453-1.41.67-.397 1.506-.595 2.51-.595 1.05 0 1.932.13 2.647.39.716.25 1.396.67 2.042 1.258.081.08.121.159.121.238 0 .114-.057.204-.173.272l-1.107.731a.469.469 0 0 1-.225.085c-.104 0-.202-.05-.294-.153-.692-.725-1.644-1.088-2.856-1.088-.692 0-1.228.102-1.609.306-.37.204-.617.431-.744.68-.115.25-.173.47-.173.663 0 .408.162.737.485.986.323.25.801.476 1.436.68.058.023.502.153 1.332.391.52.136 1.056.29 1.61.46 1.21.396 2.019.9 2.422 1.512.416.612.623 1.201.623 1.768 0 .612-.15 1.196-.45 1.75-.288.556-.801 1.02-1.54 1.395-.727.362-1.713.544-2.959.544ZM44.114 21.766c.865 0 1.667.249 2.405.748.739.487 1.108 1.388 1.108 2.702v5.321a.364.364 0 0 1-.104.272c-.058.057-.144.085-.26.085H46.14a.423.423 0 0 1-.277-.085.407.407 0 0 1-.087-.272v-5.032c-.035-.646-.22-1.155-.554-1.53-.323-.373-.744-.56-1.263-.56-.37 0-.738.102-1.107.306-.358.192-.664.492-.918.9-.253.397-.403.896-.45 1.496v4.42a.365.365 0 0 1-.103.272c-.058.057-.145.085-.26.085h-1.125a.423.423 0 0 1-.276-.085.407.407 0 0 1-.087-.272v-8.193c0-.114.029-.199.087-.255a.378.378 0 0 1 .276-.102h1.125c.116 0 .202.034.26.102.069.056.103.141.103.255v.204c0 .079.012.141.035.187a.168.168 0 0 0 .121.05c.092 0 .214-.062.364-.186a4.02 4.02 0 0 1 1.038-.612c.38-.148.738-.221 1.073-.221ZM57.436 28.207c.023.34.081.607.173.8.093.18.289.322.589.424.184.068.277.165.277.29a.396.396 0 0 1-.052.17l-.485.951c-.092.204-.242.278-.45.221-.669-.147-1.13-.47-1.384-.969-.058-.124-.115-.187-.173-.187-.058 0-.121.046-.19.136-.6.714-1.575 1.071-2.925 1.071-.819 0-1.482-.141-1.99-.425-.496-.283-.848-.623-1.056-1.02-.207-.408-.311-.799-.311-1.173 0-.612.19-1.161.571-1.648.392-.488.975-.828 1.748-1.02.53-.125 1.269-.221 2.215-.29.646-.045 1.113-.09 1.401-.135.231-.034.335-.17.312-.408-.058-.51-.23-.918-.52-1.224-.276-.318-.743-.476-1.4-.476-.428 0-.837.09-1.23.272-.38.17-.674.47-.882.9-.104.216-.254.29-.45.222l-1.055-.29c-.185-.056-.277-.152-.277-.288 0-.034.011-.085.034-.153a3.292 3.292 0 0 1 1.367-1.564c.635-.397 1.46-.595 2.475-.595.992 0 1.834.255 2.526.765.693.498 1.062 1.224 1.108 2.176.011.453.017 1.06.017 1.819.012.759.017 1.308.017 1.648Zm-4.326 1.445c.312 0 .652-.073 1.021-.22.38-.148.715-.403 1.004-.766.3-.374.484-.872.554-1.495v-.034c0-.114-.035-.199-.104-.256-.07-.067-.162-.09-.277-.067l-.675.067c-.75.069-1.361.148-1.834.238-.462.08-.86.227-1.194.442a.984.984 0 0 0-.485.884c0 .465.208.782.623.952.416.17.871.255 1.367.255ZM64.486 21.766c1.107 0 1.967.26 2.578.782.611.51 1.027 1.116 1.246 1.819a6.83 6.83 0 0 1 .329 2.073c0 .692-.11 1.389-.329 2.091-.22.692-.635 1.298-1.246 1.82-.611.509-1.47.764-2.578.764-.9 0-1.65-.238-2.25-.714-.08-.08-.161-.119-.242-.119-.116 0-.173.096-.173.29v3.569c0 .113-.035.198-.104.255-.058.068-.144.102-.26.102H60.42a.378.378 0 0 1-.277-.102c-.058-.057-.086-.142-.086-.255V22.344c0-.114.028-.199.086-.255a.378.378 0 0 1 .277-.102h1.038c.116 0 .202.034.26.102.069.056.104.141.104.255 0 .09.011.164.034.22.035.046.075.069.122.069.057 0 .109-.023.155-.068.612-.533 1.396-.8 2.354-.8Zm-.173 7.785c.888 0 1.54-.3 1.955-.9.427-.601.64-1.338.64-2.21 0-.873-.213-1.61-.64-2.21-.415-.601-1.067-.902-1.955-.902-.877 0-1.518.3-1.921.901-.393.59-.589 1.326-.589 2.21 0 .884.197 1.627.589 2.227.403.59 1.044.884 1.92.884ZM76.268 31.097c-1.316 0-2.452-.277-3.41-.833a5.531 5.531 0 0 1-2.163-2.277c-.484-.975-.726-2.08-.726-3.315 0-1.236.242-2.335.727-3.298a5.507 5.507 0 0 1 2.163-2.295c.957-.555 2.094-.833 3.409-.833 1.246 0 2.324.25 3.236.748a5.437 5.437 0 0 1 2.163 2.09c.034.069.052.131.052.188 0 .125-.087.215-.26.272l-1.298.323a.39.39 0 0 1-.12.017c-.151 0-.266-.074-.347-.221-.715-1.156-1.857-1.734-3.426-1.734-.97 0-1.771.221-2.406.663a3.907 3.907 0 0 0-1.401 1.75c-.3.715-.45 1.491-.45 2.33 0 .838.15 1.615.45 2.329.3.713.767 1.291 1.401 1.733.635.442 1.437.663 2.406.663.911 0 1.701-.21 2.37-.628.681-.42 1.165-1.06 1.454-1.921.08-.216.225-.306.433-.272l1.315.17c.196.034.294.124.294.272 0 .022-.012.079-.035.17-.507 1.303-1.246 2.283-2.215 2.94-.957.646-2.163.97-3.616.97ZM91.216 28.207c.023.34.08.607.173.8.092.18.288.322.588.424.185.068.277.165.277.29a.396.396 0 0 1-.052.17l-.484.951c-.093.204-.243.278-.45.221-.67-.147-1.13-.47-1.385-.969-.057-.124-.115-.187-.173-.187-.057 0-.12.046-.19.136-.6.714-1.575 1.071-2.925 1.071-.819 0-1.482-.141-1.99-.425-.496-.283-.848-.623-1.055-1.02-.208-.408-.312-.799-.312-1.173 0-.612.19-1.161.571-1.648.393-.488.975-.828 1.748-1.02.53-.125 1.27-.221 2.215-.29.646-.045 1.113-.09 1.402-.135.23-.034.334-.17.311-.408-.057-.51-.23-.918-.519-1.224-.277-.318-.744-.476-1.401-.476-.427 0-.837.09-1.23.272-.38.17-.674.47-.882.9-.103.216-.254.29-.45.222l-1.055-.29c-.185-.056-.277-.152-.277-.288a.53.53 0 0 1 .034-.153 3.293 3.293 0 0 1 1.368-1.564c.634-.397 1.459-.595 2.474-.595.992 0 1.834.255 2.527.765.692.498 1.06 1.224 1.107 2.176.012.453.017 1.06.017 1.819.012.759.018 1.308.018 1.648Zm-4.326 1.445c.311 0 .651-.073 1.02-.22.381-.148.716-.403 1.004-.766.3-.374.485-.872.554-1.495v-.034c0-.114-.035-.199-.104-.256-.07-.067-.161-.09-.277-.067l-.675.067c-.75.069-1.36.148-1.834.238-.461.08-.86.227-1.194.442a.984.984 0 0 0-.484.884c0 .465.207.782.622.952.416.17.871.255 1.368.255ZM95.687 30.536a.364.364 0 0 1-.104.272c-.058.057-.144.085-.26.085h-1.125a.424.424 0 0 1-.277-.085.407.407 0 0 1-.086-.272V18.79c0-.114.029-.199.086-.255a.378.378 0 0 1 .277-.102h1.125c.116 0 .202.034.26.102.069.056.104.141.104.255v11.746ZM100.033 30.536a.364.364 0 0 1-.104.272c-.057.057-.144.085-.26.085h-1.124a.423.423 0 0 1-.277-.085.407.407 0 0 1-.086-.272V18.79c0-.114.028-.199.086-.255a.378.378 0 0 1 .277-.102h1.125c.115 0 .202.034.26.102.069.056.103.141.103.255v11.746Z" stroke="#fff" stroke-width=".5"/><path d="M43.151 8.686c.296 0 .554-.036.774-.108.22-.076.402-.182.546-.318.148-.14.258-.308.33-.504.072-.2.108-.422.108-.666a1.75 1.75 0 0 0-.108-.63 1.245 1.245 0 0 0-.324-.48 1.41 1.41 0 0 0-.546-.3 2.516 2.516 0 0 0-.78-.108h-1.206v3.114h1.206Zm0-4.362c.58 0 1.082.068 1.506.204.424.136.774.326 1.05.57.276.244.48.536.612.876.136.34.204.712.204 1.116 0 .42-.07.806-.21 1.158-.14.348-.35.648-.63.9s-.632.448-1.056.588c-.42.14-.912.21-1.476.21h-1.206V13h-1.614V4.324h2.82Zm6.819 2.424c.456 0 .87.074 1.242.222a2.692 2.692 0 0 1 1.578 1.626c.144.392.216.83.216 1.314 0 .488-.072.928-.216 1.32-.144.392-.35.726-.618 1.002a2.653 2.653 0 0 1-.96.636 3.333 3.333 0 0 1-1.242.222c-.46 0-.878-.074-1.254-.222a2.712 2.712 0 0 1-.966-.636 2.922 2.922 0 0 1-.618-1.002 3.807 3.807 0 0 1-.216-1.32c0-.484.072-.922.216-1.314.148-.392.354-.724.618-.996.268-.272.59-.482.966-.63a3.397 3.397 0 0 1 1.254-.222Zm0 5.202c.512 0 .89-.172 1.134-.516.248-.344.372-.848.372-1.512s-.124-1.17-.372-1.518c-.244-.348-.622-.522-1.134-.522-.52 0-.906.176-1.158.528-.248.348-.372.852-.372 1.512s.124 1.164.372 1.512c.252.344.638.516 1.158.516Zm12.85-5.106L60.866 13h-1.188c-.136 0-.23-.088-.282-.264L58.29 9.178c-.036-.12-.07-.238-.102-.354a5.729 5.729 0 0 1-.072-.36 6.81 6.81 0 0 1-.084.366c-.028.12-.06.24-.096.36l-1.122 3.546c-.048.176-.154.264-.318.264h-1.14l-1.95-6.156h1.182c.108 0 .2.026.276.078a.363.363 0 0 1 .15.198l.882 3.288c.044.18.082.356.114.528.036.172.066.344.09.516.044-.172.09-.344.138-.516l.162-.528 1.02-3.3a.382.382 0 0 1 .138-.198.429.429 0 0 1 .258-.078h.654c.104 0 .192.026.264.078a.363.363 0 0 1 .15.198l.99 3.3c.052.18.1.358.144.534.048.172.094.344.138.516.052-.34.126-.69.222-1.05l.906-3.288a.405.405 0 0 1 .15-.198.429.429 0 0 1 .258-.078h1.128Zm4.704 2.37c0-.192-.028-.372-.084-.54a1.25 1.25 0 0 0-.24-.45 1.096 1.096 0 0 0-.414-.3 1.358 1.358 0 0 0-.576-.114c-.428 0-.766.122-1.014.366-.244.244-.4.59-.468 1.038h2.796Zm-2.826.894c.024.316.08.59.168.822.088.228.204.418.348.57.144.148.314.26.51.336.2.072.42.108.66.108.24 0 .446-.028.618-.084a2.76 2.76 0 0 0 .456-.186 7.55 7.55 0 0 0 .342-.186.59.59 0 0 1 .288-.084c.124 0 .216.046.276.138l.426.54a2.536 2.536 0 0 1-.552.486 3.281 3.281 0 0 1-1.32.474 4.79 4.79 0 0 1-.666.048 3.33 3.33 0 0 1-1.194-.21 2.726 2.726 0 0 1-.96-.63 2.993 2.993 0 0 1-.642-1.032c-.156-.412-.234-.888-.234-1.428 0-.42.068-.814.204-1.182.136-.372.33-.694.582-.966.256-.276.566-.494.93-.654.368-.16.782-.24 1.242-.24.388 0 .746.062 1.074.186.328.124.61.306.846.546.236.236.42.528.552.876.136.344.204.738.204 1.182 0 .224-.024.376-.072.456-.048.076-.14.114-.276.114h-3.81Zm6.668-2.196c.192-.368.42-.656.684-.864a1.45 1.45 0 0 1 .936-.318c.284 0 .512.062.684.186l-.096 1.11a.294.294 0 0 1-.09.156.239.239 0 0 1-.15.042c-.06 0-.15-.01-.27-.03a2.01 2.01 0 0 0-.342-.03 1.11 1.11 0 0 0-.786.282c-.1.088-.19.196-.27.324a3.44 3.44 0 0 0-.216.438V13h-1.482V6.844h.87c.152 0 .258.028.318.084.06.052.1.148.12.288l.09.696Zm6.87 1.302c0-.192-.029-.372-.085-.54a1.25 1.25 0 0 0-.24-.45 1.096 1.096 0 0 0-.414-.3 1.358 1.358 0 0 0-.576-.114c-.428 0-.766.122-1.014.366-.244.244-.4.59-.468 1.038h2.796Zm-2.827.894c.024.316.08.59.168.822.088.228.204.418.348.57.144.148.314.26.51.336.2.072.42.108.66.108.24 0 .446-.028.618-.084a2.76 2.76 0 0 0 .456-.186 7.55 7.55 0 0 0 .342-.186.59.59 0 0 1 .288-.084c.124 0 .216.046.276.138l.426.54a2.536 2.536 0 0 1-.552.486 3.281 3.281 0 0 1-1.32.474 4.79 4.79 0 0 1-.666.048 3.33 3.33 0 0 1-1.194-.21 2.726 2.726 0 0 1-.96-.63 2.993 2.993 0 0 1-.642-1.032c-.156-.412-.234-.888-.234-1.428 0-.42.068-.814.204-1.182.136-.372.33-.694.582-.966.256-.276.566-.494.93-.654.368-.16.782-.24 1.242-.24.388 0 .746.062 1.074.186.328.124.61.306.846.546.236.236.42.528.552.876.136.344.204.738.204 1.182 0 .224-.024.376-.072.456-.048.076-.14.114-.276.114h-3.81Zm9.134-1.692a1.451 1.451 0 0 0-.552-.432 1.597 1.597 0 0 0-.636-.126c-.224 0-.426.042-.606.126a1.21 1.21 0 0 0-.462.384 1.8 1.8 0 0 0-.294.648c-.068.26-.102.568-.102.924 0 .36.028.666.084.918.06.248.144.452.252.612.108.156.24.27.396.342.156.068.33.102.522.102.308 0 .57-.064.786-.192.216-.128.42-.31.612-.546v-2.76Zm1.482-4.332V13h-.906c-.196 0-.32-.09-.372-.27l-.126-.594a3.09 3.09 0 0 1-.858.69c-.32.176-.694.264-1.122.264-.336 0-.644-.07-.924-.21a2.098 2.098 0 0 1-.726-.606 3.033 3.033 0 0 1-.468-.99 5.072 5.072 0 0 1-.162-1.344c0-.456.062-.88.186-1.272s.302-.732.534-1.02c.232-.288.51-.512.834-.672a2.384 2.384 0 0 1 1.092-.246c.344 0 .638.054.882.162.244.108.462.254.654.438V4.084h1.482Zm5.863 7.32c.168.204.35.348.546.432.2.084.41.126.63.126.228 0 .432-.04.612-.12.184-.084.34-.212.468-.384a1.93 1.93 0 0 0 .294-.666 4.05 4.05 0 0 0 .102-.972c0-.676-.112-1.164-.336-1.464-.224-.304-.546-.456-.966-.456-.284 0-.532.066-.744.198a2.38 2.38 0 0 0-.606.546v2.76Zm0-3.804a3.02 3.02 0 0 1 .822-.618c.304-.156.65-.234 1.038-.234.356 0 .676.07.96.21.288.14.532.342.732.606.204.26.36.576.468.948.108.372.162.79.162 1.254 0 .5-.062.954-.186 1.362a3.132 3.132 0 0 1-.534 1.05 2.4 2.4 0 0 1-.828.672c-.324.16-.684.24-1.08.24a2.103 2.103 0 0 1-.954-.216 1.891 1.891 0 0 1-.366-.246c-.108-.1-.212-.21-.312-.33l-.066.414c-.024.104-.066.178-.126.222a.37.37 0 0 1-.234.066h-.978V4.084h1.482V7.6Zm10.743-.756-3.354 7.848a.538.538 0 0 1-.174.234c-.068.056-.174.084-.318.084H97.68l1.152-2.472-2.49-5.694h1.302c.116 0 .206.028.27.084.068.056.118.12.15.192l1.308 3.192c.044.108.08.216.108.324.032.108.062.218.09.33a32.3 32.3 0 0 1 .108-.33c.036-.112.076-.222.12-.33l1.236-3.186a.437.437 0 0 1 .408-.276h1.188Z"/></g></svg>'],{type:"image/svg+xml;charset=utf-8"}),a=URL.createObjectURL(i),s=new Image;s.onload=()=>{const i=e.width/r-s.width-16,a=e.height/r-s.height-16;n?.drawImage(s,i,a),t(e)},s.src=a})),fi=async e=>{const{videoWidth:t,videoHeight:r}=e,n=t>r?"landscape":"portrait",i="portrait"===n?t:r,a="landscape"===n?r:t,s="landscape"===n?(t-i)/2:0,o="portrait"===n?(r-a)/2:0,c=document.createElement("canvas"),l=c.getContext("2d"),d=window.devicePixelRatio||1;c.width=i*d,c.height=a*d,l?.scale(d,d),l?.drawImage(e,s,o,i,a,0,0,c.width/d,c.height/d);return(await hi(c)).toDataURL("image/jpeg")},mi=async e=>{const t=document.createElement("video"),r=new MediaStream;r.addTrack(e),t.srcObject=r,t.setAttribute("muted","true");const n=e.getSettings();t.width=n.width||0,t.height=n.height||0,await t.play();const i=document.createElement("canvas"),a=i.getContext("2d");i.height=t.height,i.width=t.width,a?.drawImage(t,0,0);return(await hi(i)).toDataURL("image/jpeg")};var gi=a("eEB2e");Nr=a("4Fy4N");const vi="WRTC1",yi="WRTC2",bi="TRANS1",wi="CONS1",xi="SOCK1",_i={qvga:{width:{ideal:320},height:{ideal:240},qualityIndex:3},vga:{width:{ideal:640},height:{ideal:480},qualityIndex:2},hd:{width:{ideal:1280},height:{ideal:720},qualityIndex:1}};class Si extends CustomEvent{constructor(e,t){super(e,t)}}const ki=EventTarget;const Ei=new class extends ki{pendingDeviceRequest={};joinOptions={};devicesList=[];constructor(){super(),navigator.mediaDevices.addEventListener("devicechange",(()=>this.onDeviceChange())),this.config={apiUrl:String("https://api.snapcall.io/v2"),streamerServer:String("wss://g.snapcall.io/stream"),streamerApi:String("https://g.snapcall.io/stream"),iceServers:[{urls:"turns:t.snapcall.io:443?transport=tcp,turns:t2.snapcall.io:443?transport=tcp,turn:t.snapcall.io:80?transport=tcp,turn:t2.snapcall.io:80?transport=tcp,turn:t.snapcall.io:80?transport=udp,turn:t2.snapcall.io:80?transport=udp"?.split(",")||[],username:"test",credential:"test",credentialType:"password"}]},this.peers=new Map,this.consumers=new Map,this.webcams=new Map,this.webcam={device:null,resolution:"hd"},this.webcamTrack=null,this.webcamZoom={available:!1,min:0,max:0},this.muted=!1,this.roomId="",this.peerId="",this.webcamProducer=null,this.screenshareProducer=null,this.customMessages=new Map,this.audioRenderers={},this.profile={}}getState(){const e=[];return this.peers.forEach(((t,r)=>{const n={microphone:{enabled:!1,muted:!1},camera:{enabled:!1},screenshare:{enabled:!1}};t.producersData.forEach((e=>{"microphone"===e.deviceType?(n.microphone.enabled=!0,n.microphone.muted=e.paused):"screen"===e.deviceType?n.screenshare.enabled=!0:"webcam"===e.deviceType&&(n.camera.enabled=!0)})),e.push({peerId:r,profile:t.profile,deviceState:n})})),{roomId:this.roomId,peerId:this.peerId,profile:this.profile,callId:void 0,deviceState:this.getDevicesState(),peers:e}}onStartSpeak(){if(this.micProducer&&!this.micProducer.paused){const e=new Si("localStartSpeak",{cancelable:!0,bubbles:!0,detail:{}});this.dispatchEvent(e),this.protoo.notify("startSpeak")}}onStopSpeak(){if(this.micProducer&&!this.micProducer.paused){const e=new Si("localStopSpeak",{detail:{}});this.dispatchEvent(e),this.protoo.notify("stopSpeak")}}onCriticalError(e){const t=new Si("criticalError",{detail:{code:e}});this.dispatchEvent(t)}async generateToken(e){const t=this.config.streamerApi,{token:r}=await fetch(`${t}/stream`,{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({bid:e})}).then((e=>e.json()));return r}async init(e=this.roomId,t=this.joinOptions){if(this.roomId=e,this.joinOptions=t,!this.roomId)throw new Error("Missing room ID");let r;this.peerId||(this.peerId=Zr());try{const{instanceId:t}=await fetch(`${this.config.streamerApi}/instance/${this.roomId}`,{method:"get",headers:{"Content-Type":"application/json"}}).then((e=>{if(e.ok)return e.json();throw new Error("Invalid room ID")}));r=`${this.config.streamerServer}/${t}/?roomId=${e}&peerId=${this.peerId}`}catch(e){const t=new Si("invalidRoom",{detail:{}});this.dispatchEvent(t)}if(!r)throw new Error("Invalid socket URL");this.protooTransport=new $r(r,{retry:{retries:0}}),this.protoo=new qr(this.protooTransport),this.protoo.on("open",(()=>{this.joinRoom()})),this.protoo.on("failed",(()=>{console.error("failed"),this.onCriticalError(xi)})),this.protoo.on("disconnected",(()=>{console.error("disconnected"),this.onCriticalError(xi)})),this.protoo.on("close",(()=>console.log("close :("))),this.protoo.on("notification",(async e=>{if(console.log("notification",e),"newPeer"===e.method){const{id:t,profile:r}=e.data;this.peers.set(t,{id:t,peerId:t,profile:r,producersData:[]});const n=new Si("newPeer",{detail:{peerId:t,displayName:r.name,profile:r}});this.dispatchEvent(n)}else if("newProducer"===e.method){const{peerId:t,producerId:r,deviceType:n,paused:i}=e.data;await this.consumeProducer({peerId:t,producerId:r,deviceType:n,paused:i})}else if("peerClosed"===e.method){const{peerId:t,relatedConsumers:r}=e.data;this.peers.delete(t),r.forEach((e=>{this.onConsumerClose({consumerId:e.id})}));const n=new Si("peerClosed",{detail:{peerId:t}});this.dispatchEvent(n)}else if("consumerClosed"===e.method){const{consumerId:t}=e.data;this.onConsumerClose({consumerId:t})}else if("displayName"===e.method){const{peerId:t,displayName:r}=e.data,n=new Si("displayName",{detail:{peerId:t,displayName:r,profile:{}}});this.dispatchEvent(n)}else if("profile"===e.method){const{peerId:t,profile:r}=e.data,n=new CustomEvent("profileUpdate",{detail:{peerId:t,profile:r}});this.dispatchEvent(n)}else if("requestDevice"===e.method){this.pendingDeviceRequest[e.data.requestId]=e.data;const t=new Si("requestDevice",{detail:e.data});this.dispatchEvent(t)}else if("startSpeak"===e.method);else if("stopSpeak"===e.method);else if("producerPaused"===e.method||"producerResumed"===e.method){const{peerId:t,producerId:r,deviceType:n}=e.data;if("microphone"===e.data?.deviceType){const n=this.peers.get(t)?.producersData.find((e=>r===e.producerId));n&&(n.paused="producerPaused"===e.method)}let i=r;for(let[,e]of Array.from(this.consumers.entries()))if(e.mediaSoupConsumer.producerId===r){i=e.mediaSoupConsumer.id;break}const a="producerPaused"===e.method?"mediaPause":"mediaResume",s=new Si(a,{detail:{mediaId:i,peerId:t,deviceType:n,paused:"producerPaused"===e.method}});this.dispatchEvent(s)}else if("requestDeviceResult"===e.method){const t=new Si(e.method,{detail:e.data});this.dispatchEvent(t)}else if("terminateRoom"===e.method){this.release();const t=new Si(e.method,{detail:e.data});this.dispatchEvent(t)}else if("customMessage"===e.method){const{messageId:t,chunk:r,chunkIndex:n,totalChunks:i}=e.data.event,a=this.customMessages.get(t);a?a.chunks.push({index:n,data:r}):this.customMessages.set(t,{chunks:[{index:n,data:r}],totalChunks:i});const s=this.customMessages.get(t);if(s&&s.totalChunks===s.chunks.length){const r=s.chunks.sort(((e,t)=>e.index-t.index)).reduce(((e,t)=>e+t.data),""),n=JSON.parse(r),i=new Si("customMessage",{detail:{...e.data,event:n}});this.dispatchEvent(i),this.customMessages.delete(t)}}}))}deviceAutoDetection(){try{const n=navigator.userAgent,i=Nr.getParser(n);t="DeviceDetectionForced",r=!0,ci().setTag(t,r),e={type:"debug",category:"browser",data:i.getResult()},ci().addBreadcrumb(e);const a=i.getOS();if("Safari"===i.getBrowserName()&&"iOS"===a.name&&Number(a.version)>=14.3)return new fn.Device({handlerName:"Safari12"});throw Error("failed to autoDetect browser, falling back to chrome 74")}catch(e){console.error(e),pi(e),this.dispatchEvent(new CustomEvent("browserDetectionFailed"))}var e,t,r;return new fn.Device({handlerName:"Chrome74"})}createDevice(){try{return new fn.Device}catch(e){return console.error("failed to detects device from mediasoup, fallback on auto detection",e),this.deviceAutoDetection()}}closeWebrtcTransport(e){e?.transport.close(),clearTimeout(e?.disconnectTimeout)}async createTransportConfig(){const e=await this.protoo.request("createWebRtcTransport");return{id:e.id,iceParameters:e.iceParameters,iceCandidates:e.iceCandidates,dtlsParameters:{...e.dtlsParameters,role:"auto"},sctpParameters:e.sctpParameters,iceServers:this.config.iceServers,proprietaryConstraints:{optional:[{googDscp:!0}]},additionalSettings:{encodedInsertableStreams:!1}}}async createSendTransport(e){const t=this.mediasoupDevice.createSendTransport(await this.createTransportConfig());t.on("connect",(({dtlsParameters:e},r,n)=>{console.log("dtlsParameters",t.id,e),this.protoo.request("connectWebRtcTransport",{transportId:t.id,dtlsParameters:e}).then(r).catch(n)})),t.on("produce",(async({kind:e,rtpParameters:r,appData:n},i,a)=>{try{const{id:a}=await this.protoo.request("produce",{transportId:t.id,kind:e,rtpParameters:r,appData:n});i({id:a}),console.log("producerTransport: ",t)}catch(e){a(e)}}));const r={transport:t,disconnectTimeout:void 0,kind:e};return this.listenWebRTCTransportStats(r),r}async createRecvTransport(e){const t=this.mediasoupDevice.createRecvTransport(await this.createTransportConfig());t.on("connect",(({dtlsParameters:e},r,n)=>{console.log("dtls",t.id,e),this.protoo.request("connectWebRtcTransport",{transportId:t.id,dtlsParameters:e}).then(r).catch(n)}));const r={transport:t,disconnectTimeout:void 0,kind:e};return this.listenWebRTCTransportStats(r),r}listenWebRTCTransportStats(e){e.transport.on("connectionstatechange",(t=>{if(!e.transport.closed)if(console.log("recv connectionstatechange: ",t),"disconnected"===t)e.disconnectTimeout=setTimeout((()=>{console.log(`trying to restart transport for ${e.kind}`),this.restartIce(e.transport)}),5e3);else if("connected"===t)clearTimeout(e.disconnectTimeout);else if("failed"===t){const t=new Error(`webRTC transport state failed for ${e.kind}`);pi(t,{extra:{direction:e.transport.direction,id:e.transport.id,kind:e.kind}}),console.error("webrtc stat failed",t),this.onCriticalError(vi)}}))}async joinRoom(){this.mediasoupDevice=this.createDevice(),this.routerRtpCapabilities=await this.protoo.request("getRouterRtpCapabilities"),this.routerRtpCapabilities.headerExtensions=this.routerRtpCapabilities.headerExtensions?.filter((e=>"urn:3gpp:video-orientation"!==e.uri)),await this.mediasoupDevice.load({routerRtpCapabilities:this.routerRtpCapabilities});try{this.recvAudioTransports=await this.createRecvTransport("audio"),this.sendAudioTransports=await this.createSendTransport("audio"),this.recvVideoTransports=await this.createRecvTransport("video"),this.sendVideoTransports=await this.createSendTransport("video")}catch(e){throw this.onCriticalError(bi),e}if(this.joinOptions.apiKey&&this.joinOptions.email)try{await this.fetchAgentInfo({apiKey:this.joinOptions.apiKey,email:this.joinOptions.email})&&this.dispatchEvent(new Si("agentIdentity",{detail:{success:!0,email:this.joinOptions.email}}))}catch(e){console.warn(e),this.dispatchEvent(new Si("agentIdentity",{detail:{success:!1}}))}const{peers:e}=await this.protoo.request("getRoomPeers",{apiKey:this.joinOptions.apiKey,email:this.joinOptions.email});this.peers=new Map(e.map((e=>[e.id||e.peerId,{...e,peerId:e.id||e.peerId}])));const t=await this.getCallId();this.dispatchEvent(new Si("enterRoom",{detail:{peerId:this.peerId,peers:e.map((e=>({...e,peerId:e.id||e.peerId}))),callId:t}})),console.log("peers",e),this.joinOptions.displayName&&await this.setDisplayName(this.joinOptions.displayName),this.joinOptions.profile&&await this.setProfile(this.joinOptions.profile),e.forEach((e=>{this.consumePeer({peerId:e.id||e.peerId,producersData:e.producersData})}))}async switchMicrophone(e){try{console.log("switchMicrophone","switching Microphone"),this.audioLevel?.release(),this.audioLevel=void 0,this.micProducer&&this.micProducer.track&&(this.micProducer?.track?.stop(),console.log("switchMicrophone","stopping previous track"));const t=await this.handleGetUserMediaError("microphone",navigator.mediaDevices.getUserMedia({audio:{deviceId:e,noiseSuppression:!0,echoCancellation:!0}}));this.audioLevel=new kn(t,this),this.audioLevel.analyse();const r=t.getAudioTracks()[0];await(this.micProducer?.replaceTrack({track:r})),console.log("switchMicrophone","switched Microphone")}catch(e){console.error("switchMicrophone error",e),await this.closeMicrophoneProducer()}}async closeMicrophoneProducer(){const e=this.micProducer?.id;this.micProducer?.close(),this.micProducer=void 0;const t=new Si("microphoneMute",{detail:{}});this.dispatchEvent(t),await this.protoo.request("closeProducer",{producerId:e})}async onDeviceChange(){console.log("detecting device change");const e=new Si("devicesListChange",{detail:{}});if(this.dispatchEvent(e),!this.protoo.closed&&this.micProducer){const e=await navigator.mediaDevices.enumerateDevices(),t=e.filter((e=>"audioinput"===e.kind));if(0===t.length)return console.warn("no audio input device"),void await this.closeMicrophoneProducer();const r=t.find((e=>"default"===e.deviceId));if(r){const t=e.filter((e=>!Boolean(this.devicesList.find((t=>t.deviceId===e.deviceId&&t.label===e.label)))));console.log(t),this.devicesList=e;const n=Boolean(t.find((e=>"audioinput"===e.kind)));if(0!==t.length&&!1===n)return void console.log("no audio input change");if(console.log("detecting audio input change"),!this.audioInputDefaultDevice||this.audioInputDefaultDevice.label!==r.label){const e=new Si("defaultAudioDeviceChange",{detail:r});this.audioInputDefaultDevice=r,this.dispatchEvent(e),console.log("new default audio input trying to switch new :",r.deviceId,r.label)}this.switchMicrophone("default")}else this.switchMicrophone()}}async enableMicrophone(){if(!this.micProducer||this.micProducer?.closed){const e=await this.handleGetUserMediaError("microphone",navigator.mediaDevices.getUserMedia({audio:{noiseSuppression:!0,echoCancellation:!0}}));if(this.devicesList=await navigator.mediaDevices.enumerateDevices(),!this.sendAudioTransports)throw new Error("audio transport not found");this.audioLevel=new kn(e,this),this.audioLevel.analyse();const t=e.getAudioTracks()[0],r="microphone",n=await(this.sendAudioTransports?.transport.produce({track:t,codecOptions:{opusStereo:!0,opusDtx:!0},appData:{deviceType:r}}));n.on("transportclose",(()=>{console.log("micproducer transportclose")})),t.addEventListener("ended",(()=>{console.log("track ended!")})),n.on("trackended",(async()=>{console.log("microphone disconnected!"),void 0===navigator.mediaDevices.ondevicechange&&this.closeMicrophoneProducer()})),this.micProducer=n,this.muted=!1;const i=new Si("microphoneEnabled",{detail:{}});this.dispatchEvent(i)}}async muteMicrophone(){if(this.micProducer){this.onStopSpeak(),this.micProducer?.pause(),await this.protoo.request("pauseProducer",{producerId:this.micProducer?.id}),this.muted=!0;const e=new Si("microphoneMute",{detail:{}});this.dispatchEvent(e)}}async unMuteMicrophone(){if(this.micProducer){this.micProducer.resume(),this.resolvePendingDeviceRequest("microphone",!0),await this.protoo.request("resumeProducer",{producerId:this.micProducer.id}),this.muted=!1;const e=new Si("microphoneUnmute",{detail:{}});this.dispatchEvent(e)}}async toggleMute(){return this.muted?(await this.unMuteMicrophone(),{muted:!1}):(await this.muteMicrophone(),{muted:!0})}release(){console.log("release"),this.closeWebrtcTransport(this.sendAudioTransports),this.closeWebrtcTransport(this.recvAudioTransports),this.closeWebrtcTransport(this.sendVideoTransports),this.closeWebrtcTransport(this.recvVideoTransports),this.webcamTrack?.stop(),this.webcamTrack=null,this.protooTransport.close(),this.protoo.close(),this.micProducer?.close(),this.screenshareProducer?.close(),this.webcamProducer?.close(),this.consumers.forEach((e=>{e.mediaSoupConsumer.close()})),this.consumers.clear(),this.audioLevel?.release()}endCall(){this.release();const e=new Si("leaveRoom",{detail:{}});this.dispatchEvent(e);const t=new CustomEvent("snapcallEvent_callEnd");window.dispatchEvent(t)}terminateRoom(){this.protoo.request("terminateRoom")}async updateWebcams(){this.webcams=new Map;const e=await navigator.mediaDevices.enumerateDevices();for(const t of e)"videoinput"===t.kind&&this.webcams.set(t.deviceId,t);0===this.webcams.size?this.webcam.device=null:this.webcam.device||(this.webcam.device=this.webcams.values().next().value);const t=new Si("webcamsUpdate",{detail:{numberOfAvailableWebcams:this.webcams.size}});this.dispatchEvent(t)}isVideoZoomAvailable(){return this.webcamZoom.available}resolvePendingDeviceRequest(e,t,r){Object.keys(this.pendingDeviceRequest).forEach((n=>{const i=this.pendingDeviceRequest[n];e===i.deviceType&&(delete this.pendingDeviceRequest[n],this.protoo.notify("requestDeviceResult",{result:Boolean(t),failure:r,...i}))}))}async handleGetUserMediaError(e,t){let r,n;try{r=await t}catch(e){n=e}finally{if(this.resolvePendingDeviceRequest(e,Boolean(r),n?.name),n)throw n;return r}}async restartIce(e){if(console.log("restartIce",e.connectionState,e.closed),"disconnected"===e.connectionState&&!e.closed)try{const t=await this.protoo.request("restartIce",{transportId:e.id});console.log(t),await e.restartIce({iceParameters:t})}catch(t){this.onCriticalError(yi),console.log("restartIceFailed",t),pi(t,{extra:{direction:e.direction,id:e.id}})}}scaleVideoMediasConstraintsParameter(e){let t=_i.hd;2===e?t=_i.vga:e>2&&(t=_i.qvga),(!this.webcam.resolution||_i[this.webcam.resolution].qualityIndex>=t.qualityIndex)&&(console.log(`scaling video by ${e}`,t),this.webcamProducer?.track?.applyConstraints(t))}scaleVideoEncodingsParameter(){try{let e=0;this.consumers.forEach((t=>{"video"===t.mediaSoupConsumer.kind&&e++})),this.screenshareProducer&&!this.screenshareProducer.closed&&e++;let t={scaleResolutionDownBy:1};if(e>=3&&(t={scaleResolutionDownBy:2}),e>=9&&(t={scaleResolutionDownBy:4}),!gi.Producer.prototype.setRtpEncodingParameters)return this.scaleVideoMediasConstraintsParameter(t.scaleResolutionDownBy);this.webcamProducer&&!this.webcamProducer.closed&&(console.log(`scaling video by ${t.scaleResolutionDownBy}`),this.webcamProducer?.setRtpEncodingParameters?.(t).catch((e=>{console.error("scaleResolutionDownBy not supported",e),this.scaleVideoMediasConstraintsParameter(t.scaleResolutionDownBy)})))}catch(e){console.error("scaleVideo error",e)}}async switchWebcam({device:e,resolution:t,rotate:r}){if(!this.webcam.device)throw new Error("no webcam devices");if(r){const e=Array.from(this.webcams.keys()),t=this.webcam?.device?.deviceId||"unknow";let r=e.indexOf(t);r<e.length-1?r++:r=0;const n=this.webcams.get(e[r]);if(!n)throw new Error("no webcam device");this.webcam.device=n,this.webcam.resolution="hd"}else e&&(this.webcam.device=e),t&&(this.webcam.resolution=t);const n=await this.handleGetUserMediaError("webcam",navigator.mediaDevices.getUserMedia({video:{deviceId:{ideal:this.webcam.device.deviceId},..._i[t||this.webcam.resolution]}}));if(!this.sendVideoTransports)throw new Error("video transport not found");const i=n.getVideoTracks()[0];this.webcamTrack=i,await(this.webcamProducer?.replaceTrack?.({track:i}));const a=await(i.getCapabilities?.())||navigator.mediaDevices.getSupportedConstraints?.();this.webcamZoom={available:Boolean(a?.zoom),min:a?.zoom?.min||0,max:a?.zoom?.max||0};const s=new Si("localVideoChange",{detail:{camera:this.getCurrentWebcam()}});this.dispatchEvent(s)}async enableVideo(e){if(await this.updateWebcams(),e?.device&&(this.webcam.device=e.device),!this.webcam.device)throw new Error("no webcam devices");const t=await this.handleGetUserMediaError("webcam",navigator.mediaDevices.getUserMedia({video:{deviceId:{ideal:this.webcam.device.deviceId},..._i[e?.resolution||this.webcam.resolution]}}));if(!this.sendVideoTransports)throw new Error("video transport not found");const r=t.getVideoTracks()[0];this.webcamTrack=r;const n=await(r.getCapabilities?.())||navigator.mediaDevices.getSupportedConstraints?.();this.webcamZoom={available:Boolean(n?.zoom),min:n?.zoom?.min||0,max:n?.zoom?.max||0};this.webcamProducer=await this.sendVideoTransports.transport.produce({track:r,encodings:undefined,codecOptions:{videoGoogleStartBitrate:1e3},appData:{deviceType:"webcam"}}),this.scaleVideoEncodingsParameter(),this.webcamProducer.on("transportclose",(()=>{this.webcamProducer=null})),this.webcamProducer.on("trackended",(()=>{this.disableVideo().catch((()=>{}))}));const i=new Si("localVideoAvailable",{detail:{camera:this.getCurrentWebcam()}});this.dispatchEvent(i)}async rotateVideo(){await this.switchWebcam({rotate:!0})}async zoomVideo(){if(!this.webcamZoom.available)throw new Error("Webcam zoom is not available");if(!this.webcamTrack)throw new Error("No webcam track available");this.webcamTrack.applyConstraints({advanced:[{zoom:2*this.webcamZoom.min}]})}async unzoomVideo(){if(!this.webcamZoom.available)throw new Error("Webcam zoom is not available");if(!this.webcamTrack)throw new Error("No webcam track available");this.webcamTrack.applyConstraints({advanced:[{zoom:this.webcamZoom.min}]})}async disableVideo(){if(!this.webcamProducer)return;this.webcamProducer.close(),await this.protoo.request("closeProducer",{producerId:this.webcamProducer.id}),this.webcamProducer=null;const e=new Si("localVideoUnavailable",{detail:{}});this.dispatchEvent(e)}async enableScreenshare(){const e=await this.handleGetUserMediaError("screen",navigator.mediaDevices.getDisplayMedia({audio:!1,video:{displaySurface:"monitor",logicalSurface:!0,width:{max:1920},height:{max:1080},frameRate:{max:30}}}));if(!e)return;if(!this.sendVideoTransports)throw new Error("video screen transport not found");const t=e.getVideoTracks()[0];this.screenshareProducer=await this.sendVideoTransports.transport.produce({track:t,encodings:undefined,codecOptions:{videoGoogleStartBitrate:1e3},appData:{deviceType:"screen",share:!0}}),this.screenshareProducer.on("transportclose",(()=>{this.screenshareProducer=null})),this.screenshareProducer.on("trackended",(()=>{this.disableScreenshare().catch((()=>{}))}));const r=new Si("screenshareEnabled",{detail:{}});this.dispatchEvent(r)}async disableScreenshare(){this.screenshareProducer&&(this.screenshareProducer.close(),await this.protoo.request("closeProducer",{producerId:this.screenshareProducer.id}),this.screenshareProducer=null);const e=new Si("screenshareDisabled",{detail:{}});this.dispatchEvent(e)}onConsumerClose({consumerId:e}){const t=this.consumers.get(e);if(t){const r=t.mediaSoupConsumer.producerId;this.peers.forEach((e=>{const t=e.producersData.findIndex((e=>e.producerId===r));-1!==t&&e.producersData.splice(t,1)})),t.mediaSoupConsumer.close(),this.consumers.delete(e),this.scaleVideoEncodingsParameter();const n=new Si("mediaStop",{detail:{mediaId:e,peerId:String(t.mediaSoupConsumer.appData.peerId),deviceType:t.deviceType,paused:!1}});"microphone"===t.deviceType&&this.deleteAudioRenderer(e),this.dispatchEvent(n)}}requestVideo({mediaId:e,element:t}){const r=this.consumers.get(e);if(r){const e=new MediaStream;e.onremovetrack=()=>console.log("Remove Track"),r.mediaSoupConsumer.track.onended=()=>console.log("Track Ended"),e.addTrack(r.mediaSoupConsumer.track),t.srcObject=e}else console.error(`Video consumer ${r} not found`)}async captureVideo(e){let t;if(e)t=await fi(e);else{if(!this.webcamProducer||!this.webcamProducer.track)throw new Error("no video to capture");t=await mi(this.webcamProducer.track)}return t}requestLocalVideo(e){if(this.webcamProducer){const t=new MediaStream;t.addTrack(this.webcamProducer.track),e.srcObject=t;const r=this.webcamProducer.track?.getSettings();return{facingMode:r?.facingMode||"user"}}throw new Error("webcam producer not available yet")}requestLocalScreenshare(e){if(this.screenshareProducer){const t=new MediaStream;t.addTrack(this.screenshareProducer.track),e.srcObject=t}else console.log("screenshare producer not available yet")}consumePeer({peerId:e,producersData:t}){t.forEach((t=>{this.consumeProducer({peerId:e,producerId:t.producerId,deviceType:t.deviceType,paused:t.paused})}))}getRecvTransport(e){return"microphone"===e?this.recvAudioTransports:this.recvVideoTransports}async consumeProducer({peerId:e,producerId:t,deviceType:r,paused:n}){const i=this.getRecvTransport(r);if(!i)throw new Error(`transport for ${r} not found`);const a=await this.protoo.request("consume",{peerId:e,producerId:t,transportId:i.transport.id,rtpCapabilities:this.mediasoupDevice.rtpCapabilities}),s=this.peers.get(e);s&&s.producersData.push({producerId:t,deviceType:r,paused:n});const{producerId:o,id:c,kind:l,rtpParameters:d,appData:u}=a;console.log("Data: ",a);try{const t=await i.transport.consume({id:c,producerId:o,kind:l,rtpParameters:d,appData:{...u,peerId:e}});console.log("transport",i.transport),console.log("consumer",t),this.consumers.set(t.id,{mediaSoupConsumer:t,deviceType:r}),this.scaleVideoEncodingsParameter();const a=new Si("mediaStart",{detail:{peerId:e,mediaId:t.id,deviceType:r,paused:n}});if(this.dispatchEvent(a),"audio"===t.kind){const e=this.createAudioRenderer(t.id),r=new MediaStream;r.addTrack(t.track),e.setSource(r),e.play()}"video"===t.kind&&await this.protoo.request("resumeConsumer",{consumerId:t.id})}catch(e){throw this.onCriticalError(wi),console.error("newConsumer request failed",e),e}}async setDisplayName(e){await this.setProfile({name:e});const t=new Si("selfDisplayName",{detail:{peerId:this.peerId,displayName:this.profile?.name,profile:this.profile}});this.dispatchEvent(t)}async setProfile(e){const t=await this.protoo.request("setProfile",e);this.profile={...t};const r=new Si("selfProfileUpdate",{detail:{peerId:this.peerId,profile:this.profile}});this.dispatchEvent(r)}async requestPeerDevice(e,t){return this.protoo.request("requestPeerDevice",{remotePeerId:e,deviceType:t})}denyDeviceRequest(e){this.resolvePendingDeviceRequest(e,!1,"user denied permission")}async getCallId(){try{const{callId:e}=await this.protoo.request("getCallId");return e}catch(e){throw console.error("Failed to get callId"),e}}getConsumers(){return this.consumers}getDevicesState(){const e=!!this.micProducer&&!this.micProducer.closed,t=!!this.webcamProducer&&!this.webcamProducer.closed,r=!!this.screenshareProducer&&!this.screenshareProducer.closed;return{microphone:{enabled:e,muted:this.muted},camera:{enabled:t},screenshare:{enabled:r}}}getCustomMessageEventChunks(e){const t=JSON.stringify(e),r=[];for(let e=0;e<t.length;e+=9e4)r.push(t.substring(e,e+9e4));return r}async sendCustomMessageToAll(e){const t=Zr(),r=this.getCustomMessageEventChunks(e),n=r.map(((e,n)=>this.protoo.notify("customMessageToAllPeers",{messageId:t,chunkIndex:n,chunk:e,totalChunks:r.length})));await Promise.all(n)}async sendCustomMessage(e,t){const r=Zr(),n=this.getCustomMessageEventChunks(t),i=n.map(((t,i)=>this.protoo.notify("customMessageToPeer",{peerId:e,event:{messageId:r,chunkIndex:i,chunk:t,totalChunks:n.length}})));await Promise.all(i)}async listAudioDevices(){return(await navigator.mediaDevices.enumerateDevices()).filter((e=>"audioinput"===e.kind||"audiooutput"===e.kind))}async listVideoDevices(){return(await navigator.mediaDevices.enumerateDevices()).filter((e=>"videoinput"===e.kind))}isListDevicesSupported(){return Boolean(navigator.mediaDevices?.enumerateDevices)}getCurrentWebcam(){return this.webcam}async setWebcamResolution(e){if(this.webcam.device)await this.switchWebcam({resolution:e});else{this.webcam.resolution=e;const t=new Si("localVideoChange",{detail:{camera:this.getCurrentWebcam()}});this.dispatchEvent(t)}}createAudioRenderer(e){const t=new En({consumerId:e});return this.audioRenderers[e]=t,t}deleteAudioRenderer(e){this.audioRenderers[e]?.destroy(),delete this.audioRenderers[e]}async playAudioRenderer(e){await(this.audioRenderers[e]?.play())}async setAudioSink(e){const t=Object.keys(this.audioRenderers).map((t=>this.audioRenderers[t].setSink(e).catch((e=>console.warn("Failed to setSinkId on renderer (consumerId: %s): ",t,e)))));await Promise.allSettled(t)}dispatchEvent(e){const t=super.dispatchEvent(e);return window.dispatchEvent(e),t}async getShareLinkData(e){return await this.protoo.request("shareLink",{url:e})}async fetchAgentInfo({apiKey:e,email:t}){const r=this.config.apiUrl;return await fetch(`${r}/agents/${t}`,{method:"get",headers:{Authorization:`Bearer ${e}`}}).then((e=>{if(e.ok)return e.json();throw new Error("Invalid agent info")}))}setConfig(e){this.config={...this.config,...e}}};var Ci=(0,(d=a("85Hg2")).createContext)({});d=a("85Hg2");let Ri;var Pi;(Pi=Ri||(Ri={}))[Pi.SET_STREAMS=0]="SET_STREAMS",Pi[Pi.ADD_STREAM=1]="ADD_STREAM",Pi[Pi.REMOVE_STREAM=2]="REMOVE_STREAM",Pi[Pi.DEVICE_UPDATE=3]="DEVICE_UPDATE",Pi[Pi.MUTE=4]="MUTE",Pi[Pi.UNMUTE=5]="UNMUTE",Pi[Pi.SET_HIGHLIGHTED_TILE=6]="SET_HIGHLIGHTED_TILE",Pi[Pi.UNSET_HIGHLIGHTED_TILE=7]="UNSET_HIGHLIGHTED_TILE",Pi[Pi.SET_STREAM_PROFILE=8]="SET_STREAM_PROFILE",Pi[Pi.SET_STREAM_SPEAKING=9]="SET_STREAM_SPEAKING";const Ti={streams:[],highlightedTile:null},ji=(e,t)=>{switch(t.type){case Ri.SET_STREAMS:return{...e,streams:t.payload};case Ri.ADD_STREAM:return e.streams.find((e=>e.id===t.payload.id))?e:{...e,streams:[...e.streams,t.payload]};case Ri.REMOVE_STREAM:return{...e,streams:[...e.streams.filter((e=>e.id!==t.payload.id))]};case Ri.DEVICE_UPDATE:{const{streamId:r,mediaId:n,device:i,available:a,paused:s}=t.payload;return{...e,streams:e.streams.map((e=>{if(e.id===r){let t=e.muted;return"microphone"===i&&(t=s),{...e,[i]:a?n:null,muted:t}}return e}))}}case Ri.MUTE:return{...e,streams:e.streams.map((e=>e.id===t.payload.streamId?{...e,muted:!0}:e))};case Ri.UNMUTE:return{...e,streams:e.streams.map((e=>e.id===t.payload.streamId?{...e,muted:!1}:e))};case Ri.SET_HIGHLIGHTED_TILE:return{...e,highlightedTile:t.payload};case Ri.UNSET_HIGHLIGHTED_TILE:return{...e,highlightedTile:null};case Ri.SET_STREAM_PROFILE:return{...e,streams:e.streams.map((e=>e.id===t.payload.streamId?{...e,profile:t.payload.profile}:e))};case Ri.SET_STREAM_SPEAKING:return{...e,streams:e.streams.map((e=>e.id===t.payload.streamId?{...e,isSpeaking:t.payload.isSpeaking}:e))};default:return e}},Mi=(0,d.createContext)(void 0),Ii=({children:e})=>{const[t,r]=(0,d.useReducer)(ji,Ti),n={state:t,dispatch:r};return(0,s.jsx)(Mi.Provider,{value:n,children:e})},Di=()=>{const e=(0,d.useContext)(Mi);if(void 0===e)throw new Error("useStreams must be used within a StreamsProvider");return{streams:e.state.streams,highlightedTile:e.state.highlightedTile,dispatch:e.dispatch}};var Oi=e=>navigator.clipboard?navigator.clipboard.writeText(e):new Promise(((t,r)=>{((e,t,r)=>{const n=document.createRange(),i=document.createElement("textarea");if(i.value=e,document.body.appendChild(i),navigator.userAgent.match(/ipad|ipod|iphone/i)){i.readOnly=!1,i.contentEditable="true",n.selectNodeContents(i);const e=window.getSelection();e&&(e.removeAllRanges(),e.addRange(n)),i.setSelectionRange(0,999999)}else i.focus(),i.select();try{document.execCommand("copy")?t():r(new Error("Copy to clipboard fallback failed"))}catch(e){e instanceof Error?r(e):console.error(e)}document.body.removeChild(i)})(e,t,r)}));const Li=vr.path`
136
136
  fill: ${e=>e.theme.logoColor};
137
137
  stroke: ${e=>e.stroke?e.theme.logoColor:"unset"};
138
138
  `,Ai=()=>(0,s.jsx)("svg",{width:"17",height:"17",viewBox:"0 0 17 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,s.jsx)(Li,{d:"M7.82 15.328c.806 0 1.48-.668 1.243-1.438a4.788 4.788 0 0 0-1.143-1.93 4.579 4.579 0 0 0-3.28-1.396c-1.231 0-2.411.502-3.281 1.395a4.788 4.788 0 0 0-1.143 1.93c-.237.771.438 1.44 1.244 1.44h6.36ZM7.513 0C6.706 0 6.03.668 6.269 1.438a4.788 4.788 0 0 0 1.142 1.93 4.58 4.58 0 0 0 3.281 1.396c1.23 0 2.411-.502 3.281-1.395.531-.545.92-1.209 1.143-1.93C15.353.667 14.678 0 13.872 0h-6.36ZM10.692 13.868c0 .807.67 1.482 1.435 1.227a4.622 4.622 0 0 0 1.846-1.162 4.83 4.83 0 0 0 1.36-3.369 4.83 4.83 0 0 0-1.36-3.369 4.62 4.62 0 0 0-1.846-1.162c-.764-.255-1.435.42-1.435 1.227v6.608ZM4.64 1.46c0-.806-.67-1.482-1.435-1.226a4.62 4.62 0 0 0-1.846 1.161A4.83 4.83 0 0 0 0 4.765a4.83 4.83 0 0 0 1.359 3.368 4.62 4.62 0 0 0 1.846 1.162c.765.255 1.435-.42 1.435-1.226v-6.61Z"})}),Ni=()=>(0,s.jsx)("svg",{width:"71",height:"17",viewBox:"17 0 71 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,s.jsx)(Li,{d:"M27.445 13.543c-1.288 0-2.324-.206-3.107-.618-.773-.422-1.355-.948-1.747-1.576a.327.327 0 0 1 .108-.448l.882-.665a.253.253 0 0 1 .185-.077c.093 0 .18.056.263.17.69 1.112 1.85 1.669 3.477 1.669.712 0 1.314-.129 1.809-.387.505-.257.757-.67.757-1.236 0-.422-.144-.752-.432-.989-.279-.237-.712-.448-1.299-.634-.536-.164-.87-.262-1.005-.293a32.224 32.224 0 0 1-1.916-.603c-.99-.37-1.644-.798-1.963-1.282-.32-.485-.48-.99-.48-1.515 0-.433.135-.896.402-1.39.279-.506.712-.933 1.299-1.283.598-.361 1.345-.541 2.241-.541.938 0 1.726.118 2.365.355.639.227 1.247.608 1.824 1.144.072.072.108.144.108.216 0 .103-.051.186-.155.247l-.989.665a.414.414 0 0 1-.2.077c-.093 0-.181-.046-.263-.139-.619-.66-1.469-.989-2.55-.989-.619 0-1.098.093-1.438.278-.33.186-.551.392-.665.618a1.486 1.486 0 0 0-.154.603c0 .37.144.67.432.896.289.227.716.433 1.283.618.052.021.448.14 1.19.356.464.123.943.263 1.438.417 1.082.36 1.803.82 2.164 1.375.37.557.556 1.093.556 1.608 0 .556-.134 1.087-.402 1.591-.257.505-.716.928-1.375 1.268-.65.33-1.53.494-2.643.494ZM37.403 5.06c.773 0 1.489.226 2.148.679.66.443.99 1.262.99 2.457v4.837c0 .103-.031.186-.093.247-.052.052-.13.078-.232.078H39.21a.374.374 0 0 1-.247-.078.374.374 0 0 1-.077-.247V8.46c-.031-.587-.196-1.051-.495-1.39-.289-.34-.665-.51-1.128-.51-.33 0-.66.092-.99.277-.32.175-.592.448-.819.82-.227.36-.36.813-.402 1.36v4.017c0 .103-.03.186-.092.247-.052.052-.13.078-.232.078h-1.005a.373.373 0 0 1-.247-.078.374.374 0 0 1-.078-.247V5.585c0-.104.026-.18.078-.232a.334.334 0 0 1 .247-.093h1.005c.103 0 .18.03.232.093.061.051.092.128.092.232v.185c0 .072.01.129.031.17.031.03.067.046.108.046.083 0 .191-.056.325-.17a3.58 3.58 0 0 1 .927-.556c.34-.134.66-.2.959-.2ZM49.302 10.916c.02.309.072.551.155.726.082.165.257.294.525.386.165.062.248.15.248.263a.364.364 0 0 1-.047.155l-.432.865c-.083.186-.217.252-.402.201-.598-.134-1.01-.428-1.237-.88-.052-.114-.103-.17-.155-.17-.051 0-.108.04-.17.123-.535.649-1.406.973-2.612.973-.731 0-1.324-.128-1.777-.386-.443-.258-.758-.567-.943-.927-.185-.371-.278-.726-.278-1.066 0-.557.17-1.056.51-1.5.35-.442.87-.752 1.561-.927.474-.113 1.134-.2 1.978-.262.577-.042.995-.083 1.252-.124.206-.03.3-.155.279-.37-.052-.464-.206-.835-.464-1.114-.247-.288-.665-.432-1.252-.432-.381 0-.747.082-1.098.247-.34.155-.602.428-.788.819-.093.196-.227.263-.402.2l-.943-.262c-.164-.051-.247-.139-.247-.262 0-.031.01-.078.031-.14a2.977 2.977 0 0 1 1.221-1.421c.567-.36 1.304-.541 2.21-.541.886 0 1.639.232 2.257.695.618.454.948 1.113.99 1.978.01.412.015.964.015 1.654.01.69.015 1.19.015 1.499Zm-3.864 1.313c.278 0 .582-.067.912-.2.34-.134.639-.366.896-.696.268-.34.433-.793.495-1.36v-.03c0-.104-.03-.181-.093-.233-.061-.061-.144-.082-.247-.061l-.603.061a17.05 17.05 0 0 0-1.638.217 2.807 2.807 0 0 0-1.067.402.898.898 0 0 0-.433.803c0 .423.186.711.557.866.371.154.778.231 1.221.231ZM55.598 5.06c.99 0 1.757.236 2.303.71.547.464.918 1.015 1.113 1.653.196.629.294 1.257.294 1.886 0 .628-.098 1.262-.294 1.9-.195.63-.566 1.18-1.113 1.654-.546.464-1.313.696-2.303.696-.803 0-1.473-.217-2.009-.65-.072-.072-.144-.108-.216-.108-.103 0-.155.088-.155.263v3.245c0 .103-.03.18-.093.232-.051.062-.128.093-.231.093h-.928a.335.335 0 0 1-.247-.093c-.052-.051-.077-.129-.077-.232V5.584c0-.103.025-.18.077-.231a.334.334 0 0 1 .247-.093h.928c.103 0 .18.03.231.093.062.051.093.128.093.232 0 .082.01.149.031.2.031.042.067.062.108.062.052 0 .098-.02.14-.062.545-.484 1.246-.726 2.101-.726Zm-.154 7.077c.793 0 1.375-.273 1.746-.82.382-.545.572-1.215.572-2.008 0-.793-.19-1.463-.572-2.01-.37-.545-.953-.818-1.746-.818-.783 0-1.355.273-1.716.819-.35.536-.525 1.205-.525 2.009 0 .803.175 1.478.525 2.024.36.536.933.804 1.716.804ZM66.122 13.543c-1.174 0-2.19-.253-3.045-.757a4.991 4.991 0 0 1-1.932-2.071c-.433-.886-.649-1.89-.649-3.014 0-1.123.216-2.122.65-2.998a4.97 4.97 0 0 1 1.931-2.086c.856-.505 1.87-.757 3.045-.757 1.113 0 2.077.227 2.89.68a4.896 4.896 0 0 1 1.933 1.9c.03.062.046.12.046.17 0 .114-.077.196-.232.248L69.6 5.15a.342.342 0 0 1-.108.016c-.134 0-.237-.067-.31-.201-.638-1.05-1.658-1.576-3.06-1.576-.865 0-1.582.2-2.148.602a3.541 3.541 0 0 0-1.252 1.592 5.497 5.497 0 0 0-.402 2.117c0 .763.134 1.468.402 2.117a3.555 3.555 0 0 0 1.252 1.577c.566.402 1.283.602 2.148.602.814 0 1.52-.19 2.118-.571.608-.382 1.04-.964 1.298-1.747.072-.195.201-.278.387-.247l1.174.155c.175.03.263.113.263.247a.93.93 0 0 1-.03.154c-.454 1.185-1.114 2.076-1.98 2.674-.855.587-1.931.88-3.23.88ZM79.474 10.916c.02.309.072.551.155.726.082.165.257.294.525.386.165.062.248.15.248.263a.364.364 0 0 1-.047.155l-.433.865c-.082.186-.216.252-.401.201-.598-.134-1.01-.428-1.237-.88-.052-.114-.103-.17-.155-.17-.051 0-.108.04-.17.123-.535.649-1.406.973-2.612.973-.731 0-1.324-.128-1.777-.386-.443-.258-.758-.567-.943-.927-.186-.371-.278-.726-.278-1.066a2.4 2.4 0 0 1 .51-1.5c.35-.442.87-.752 1.56-.927.475-.113 1.134-.2 1.98-.262.576-.042.994-.083 1.251-.124.206-.03.3-.155.278-.37-.051-.464-.206-.835-.463-1.114-.248-.288-.665-.432-1.252-.432-.381 0-.747.082-1.098.247-.34.155-.602.428-.788.819-.093.196-.227.263-.402.2l-.943-.262c-.165-.051-.247-.139-.247-.262 0-.031.01-.078.03-.14a2.979 2.979 0 0 1 1.222-1.421c.567-.36 1.303-.541 2.21-.541.887 0 1.639.232 2.257.695.618.454.948 1.113.99 1.978.01.412.015.964.015 1.654.01.69.015 1.19.015 1.499Zm-3.864 1.313c.278 0 .582-.067.912-.2.34-.134.639-.366.896-.696.268-.34.433-.793.495-1.36v-.03c0-.104-.03-.181-.093-.233-.062-.061-.144-.082-.247-.061l-.603.061c-.67.062-1.216.134-1.638.217a2.808 2.808 0 0 0-1.067.402.898.898 0 0 0-.432.803c0 .423.185.711.556.866.37.154.778.231 1.221.231ZM83.467 13.033c0 .103-.03.185-.092.247-.052.052-.13.077-.232.077h-1.005a.374.374 0 0 1-.247-.077.374.374 0 0 1-.078-.247V2.354c0-.103.026-.18.078-.232a.335.335 0 0 1 .247-.092h1.005c.103 0 .18.03.232.093.061.051.092.128.092.231v10.679ZM87.35 13.033c0 .103-.03.185-.093.247-.051.052-.129.077-.232.077h-1.004a.374.374 0 0 1-.248-.077.374.374 0 0 1-.077-.247V2.354c0-.103.026-.18.078-.232a.334.334 0 0 1 .247-.092h1.004c.103 0 .18.03.232.093.062.051.093.128.093.231v10.679Z",stroke:"#fff",strokeWidth:".5"})});var Fi=({size:e="large"})=>"small"===e?(0,s.jsx)(Ai,{}):"medium"===e?(0,s.jsx)(Ni,{}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(Ai,{}),(0,s.jsx)(Ni,{})]});const zi=()=>(0,s.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,s.jsx)("path",{d:"M19 2H9a3 3 0 0 0-3 3v1H5a3 3 0 0 0-3 3v10a3 3 0 0 0 3 3h10a3 3 0 0 0 3-3v-1h1a3 3 0 0 0 3-3V5a3 3 0 0 0-3-3Zm-3 17a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1v-7h12v7Zm0-9H4V9a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v1Zm4 5a1 1 0 0 1-1 1h-1V9a3 3 0 0 0-.18-1H20v7Zm0-9H8V5a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v1Z",fill:"#fff"})}),Bi=()=>(0,s.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,s.jsx)("path",{d:"M21 8.94a1.307 1.307 0 0 0-.06-.27v-.09a1.07 1.07 0 0 0-.19-.28l-6-6a1.071 1.071 0 0 0-.28-.19.32.32 0 0 0-.09 0 .88.88 0 0 0-.33-.11H10a3 3 0 0 0-3 3v1H6a3 3 0 0 0-3 3v10a3 3 0 0 0 3 3h8a3 3 0 0 0 3-3v-1h1a3 3 0 0 0 3-3V8.94Zm-6-3.53L17.59 8H16a1 1 0 0 1-1-1V5.41ZM15 19a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1h1v7a3 3 0 0 0 3 3h5v1Zm4-4a1 1 0 0 1-1 1h-8a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h3v3a3 3 0 0 0 3 3h3v5Z",fill:"#fff"})}),Ui=()=>(0,s.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,s.jsx)("path",{d:"M8 21H4a1 1 0 0 1-1-1v-4a1 1 0 1 0-2 0v4a3 3 0 0 0 3 3h4a1 1 0 0 0 0-2Zm14-6a1 1 0 0 0-1 1v4a1 1 0 0 1-1 1h-4a1 1 0 0 0 0 2h4a3 3 0 0 0 3-3v-4a1 1 0 0 0-1-1ZM20 1h-4a1 1 0 1 0 0 2h4a1 1 0 0 1 1 1v4a1 1 0 0 0 2 0V4a3 3 0 0 0-3-3ZM2 9a1 1 0 0 0 1-1V4a1 1 0 0 1 1-1h4a1 1 0 0 0 0-2H4a3 3 0 0 0-3 3v4a1 1 0 0 0 1 1Zm8-4H6a1 1 0 0 0-1 1v4a1 1 0 0 0 1 1h4a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1ZM9 9H7V7h2v2Zm5 2h4a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v4a1 1 0 0 0 1 1Zm1-4h2v2h-2V7Zm-5 6H6a1 1 0 0 0-1 1v4a1 1 0 0 0 1 1h4a1 1 0 0 0 1-1v-4a1 1 0 0 0-1-1Zm-1 4H7v-2h2v2Zm5-1a1 1 0 0 0 1-1 1 1 0 0 0 0-2h-1a1 1 0 0 0-1 1v1a1 1 0 0 0 1 1Zm4-3a1 1 0 0 0-1 1v3a1 1 0 0 0 0 2h1a1 1 0 0 0 1-1v-4a1 1 0 0 0-1-1Zm-4 4a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",fill:"#fff"})}),Vi=()=>(0,s.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,s.jsx)("path",{d:"m21.32 9.55-1.89-.63.89-1.78A1 1 0 0 0 20.13 6L18 3.87a1 1 0 0 0-1.15-.19l-1.78.89-.63-1.89A1 1 0 0 0 13.5 2h-3a1 1 0 0 0-.95.68l-.63 1.89-1.78-.89A1 1 0 0 0 6 3.87L3.87 6a1 1 0 0 0-.19 1.15l.89 1.78-1.89.63a1 1 0 0 0-.68.94v3a1 1 0 0 0 .68.95l1.89.63-.89 1.78A1 1 0 0 0 3.87 18L6 20.13a1 1 0 0 0 1.15.19l1.78-.89.63 1.89a1 1 0 0 0 .95.68h3a1 1 0 0 0 .95-.68l.63-1.89 1.78.89a1 1 0 0 0 1.13-.19L20.13 18a1 1 0 0 0 .19-1.15l-.89-1.78 1.89-.63a1 1 0 0 0 .68-.94v-3a1 1 0 0 0-.68-.95ZM20 12.78l-1.2.4A2 2 0 0 0 17.64 16l.57 1.14-1.1 1.1-1.11-.6a2 2 0 0 0-2.79 1.16l-.4 1.2h-1.59l-.4-1.2A2 2 0 0 0 8 17.64l-1.14.57-1.1-1.1.6-1.11a2 2 0 0 0-1.16-2.82l-1.2-.4v-1.56l1.2-.4A2 2 0 0 0 6.36 8l-.57-1.11 1.1-1.1L8 6.36a2 2 0 0 0 2.82-1.16l.4-1.2h1.56l.4 1.2A2 2 0 0 0 16 6.36l1.14-.57 1.1 1.1-.6 1.11a2 2 0 0 0 1.16 2.79l1.2.4v1.59ZM12 8a4 4 0 1 0 0 8 4 4 0 0 0 0-8Zm0 6a2 2 0 1 1 0-4 2 2 0 0 1 0 4Z",fill:"#fff"})}),Hi=()=>(0,s.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,s.jsx)("path",{d:"M4 12a1 1 0 0 0 1 1h7.59l-2.3 2.29a1.002 1.002 0 0 0 .325 1.639 1 1 0 0 0 1.095-.219l4-4a1 1 0 0 0 .21-.33 1 1 0 0 0 0-.76 1 1 0 0 0-.21-.33l-4-4a1.003 1.003 0 1 0-1.42 1.42l2.3 2.29H5a1 1 0 0 0-1 1ZM17 2H7a3 3 0 0 0-3 3v3a1 1 0 0 0 2 0V5a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1v-3a1 1 0 1 0-2 0v3a3 3 0 0 0 3 3h10a3 3 0 0 0 3-3V5a3 3 0 0 0-3-3Z",fill:"#fff"})}),Wi=()=>(0,s.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,s.jsx)("path",{d:"M4.91 13.1a1 1 0 0 0 .85.47A1 1 0 0 0 6.61 12a17 17 0 0 1-2.47-6.85 1 1 0 0 1 .578-1.06A1 1 0 0 1 5.13 4h3a1 1 0 0 1 1 .8c0 .23.08.44.13.67v.13c.116.525.273 1.04.47 1.54l-1.39.66a1 1 0 0 0-.52.57 1 1 0 0 0 0 .77c.1.21.2.42.32.64a1 1 0 0 0 1.755-.028 1 1 0 0 0 .115-.542l.57-.21a2 2 0 0 0 1.05-2.48 9.317 9.317 0 0 1-.39-1.3v-.1c0-.2-.08-.4-.11-.58A3 3 0 0 0 8.16 2h-3a3 3 0 0 0-2.28 1 3 3 0 0 0-.72 2.39 19.05 19.05 0 0 0 2.75 7.71Zm14.61-.21-.6-.11h-.08a9.325 9.325 0 0 1-1.33-.39 2 2 0 0 0-2.47 1l-.21.46a12.392 12.392 0 0 1-1.92-1.37l8.8-8.79a1.004 1.004 0 1 0-1.42-1.42l-18 18a.999.999 0 0 0 0 1.42 1 1 0 0 0 1.42 0l4.59-4.6a19.09 19.09 0 0 0 10.29 4.73c.133.01.267.01.4 0a3 3 0 0 0 2-.75 3 3 0 0 0 1-2.25v-3a3 3 0 0 0-2.47-2.93Zm.48 6a.999.999 0 0 1-.718.96 1 1 0 0 1-.432.03 17.07 17.07 0 0 1-9.14-4.18l1.77-1.77a14.695 14.695 0 0 0 3.38 2.21 1.002 1.002 0 0 0 .77 0 1 1 0 0 0 .57-.52l.62-1.41c.522.194 1.056.35 1.6.47h.11l.69.13a1 1 0 0 1 .78 1v3.08Z",fill:"#D84949"})}),qi=()=>(0,s.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,s.jsxs)("g",{clipPath:"url(#pip)",fill:"#fff",children:[(0,s.jsx)("path",{d:"M0 5v10a3 3 0 0 0 3 3h14a3 3 0 0 0 3-3V5a3 3 0 0 0-3-3H3a3 3 0 0 0-3 3Zm17-1a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h14Z"}),(0,s.jsx)("path",{d:"M10 14v4.879a3 3 0 0 0 3 3h8a3 3 0 0 0 3-3V14a3 3 0 0 0-3-3h-8a3 3 0 0 0-3 3ZM10 11.149c0 .113-.02.226-.06.332a.85.85 0 0 1-.8.519H5.736a.851.851 0 0 1 0-1.702h1.353l-2.792-2.8a.851.851 0 1 1 1.2-1.2l2.8 2.8V7.744a.851.851 0 0 1 1.703 0v3.405Z"})]})});d=a("85Hg2"),d=a("85Hg2");const $i=(e,t)=>((0,d.useEffect)((()=>{const r=r=>{e?.current?.contains(r.target)||t()};if(e?.current)return window.addEventListener("click",r),()=>window.removeEventListener("click",r)}),[e,t]),null),Gi=vr.div`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snapcall/stream-ui",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "",
5
5
  "source": "src/index.tsx",
6
6
  "main": "dist/stream-ui.js",