hanc-webrtc-widgets 1.1.0 → 1.1.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.
|
@@ -766,6 +766,12 @@ const Ar = kt`
|
|
|
766
766
|
padding: 0;
|
|
767
767
|
border: 0;
|
|
768
768
|
}
|
|
769
|
+
|
|
770
|
+
button {
|
|
771
|
+
font-family: inherit;
|
|
772
|
+
font-size: inherit;
|
|
773
|
+
font-weight: inherit;
|
|
774
|
+
}
|
|
769
775
|
`;
|
|
770
776
|
var Pt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, mt = {}, ue = {}, Je = { exports: {} }, Vt;
|
|
771
777
|
function ee() {
|
|
@@ -185,6 +185,12 @@
|
|
|
185
185
|
padding: 0;
|
|
186
186
|
border: 0;
|
|
187
187
|
}
|
|
188
|
+
|
|
189
|
+
button {
|
|
190
|
+
font-family: inherit;
|
|
191
|
+
font-size: inherit;
|
|
192
|
+
font-weight: inherit;
|
|
193
|
+
}
|
|
188
194
|
`;var bt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},St={},fe={},Xe={exports:{}},Yt;function Z(){if(Yt)return Xe.exports;Yt=1;var C=typeof Reflect=="object"?Reflect:null,n=C&&typeof C.apply=="function"?C.apply:function(s,h,I){return Function.prototype.apply.call(s,h,I)},t;C&&typeof C.ownKeys=="function"?t=C.ownKeys:Object.getOwnPropertySymbols?t=function(s){return Object.getOwnPropertyNames(s).concat(Object.getOwnPropertySymbols(s))}:t=function(s){return Object.getOwnPropertyNames(s)};function c(d){console&&console.warn&&console.warn(d)}var l=Number.isNaN||function(s){return s!==s};function g(){g.init.call(this)}Xe.exports=g,Xe.exports.once=o,g.EventEmitter=g,g.prototype._events=void 0,g.prototype._eventsCount=0,g.prototype._maxListeners=void 0;var y=10;function _(d){if(typeof d!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof d)}Object.defineProperty(g,"defaultMaxListeners",{enumerable:!0,get:function(){return y},set:function(d){if(typeof d!="number"||d<0||l(d))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+d+".");y=d}}),g.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},g.prototype.setMaxListeners=function(s){if(typeof s!="number"||s<0||l(s))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+s+".");return this._maxListeners=s,this};function E(d){return d._maxListeners===void 0?g.defaultMaxListeners:d._maxListeners}g.prototype.getMaxListeners=function(){return E(this)},g.prototype.emit=function(s){for(var h=[],I=1;I<arguments.length;I++)h.push(arguments[I]);var v=s==="error",O=this._events;if(O!==void 0)v=v&&O.error===void 0;else if(!v)return!1;if(v){var T;if(h.length>0&&(T=h[0]),T instanceof Error)throw T;var k=new Error("Unhandled error."+(T?" ("+T.message+")":""));throw k.context=T,k}var P=O[s];if(P===void 0)return!1;if(typeof P=="function")n(P,this,h);else for(var R=P.length,p=r(P,R),I=0;I<R;++I)n(p[I],this,h);return!0};function w(d,s,h,I){var v,O,T;if(_(h),O=d._events,O===void 0?(O=d._events=Object.create(null),d._eventsCount=0):(O.newListener!==void 0&&(d.emit("newListener",s,h.listener?h.listener:h),O=d._events),T=O[s]),T===void 0)T=O[s]=h,++d._eventsCount;else if(typeof T=="function"?T=O[s]=I?[h,T]:[T,h]:I?T.unshift(h):T.push(h),v=E(d),v>0&&T.length>v&&!T.warned){T.warned=!0;var k=new Error("Possible EventEmitter memory leak detected. "+T.length+" "+String(s)+" listeners added. Use emitter.setMaxListeners() to increase limit");k.name="MaxListenersExceededWarning",k.emitter=d,k.type=s,k.count=T.length,c(k)}return d}g.prototype.addListener=function(s,h){return w(this,s,h,!1)},g.prototype.on=g.prototype.addListener,g.prototype.prependListener=function(s,h){return w(this,s,h,!0)};function S(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function m(d,s,h){var I={fired:!1,wrapFn:void 0,target:d,type:s,listener:h},v=S.bind(I);return v.listener=h,I.wrapFn=v,v}g.prototype.once=function(s,h){return _(h),this.on(s,m(this,s,h)),this},g.prototype.prependOnceListener=function(s,h){return _(h),this.prependListener(s,m(this,s,h)),this},g.prototype.removeListener=function(s,h){var I,v,O,T,k;if(_(h),v=this._events,v===void 0)return this;if(I=v[s],I===void 0)return this;if(I===h||I.listener===h)--this._eventsCount===0?this._events=Object.create(null):(delete v[s],v.removeListener&&this.emit("removeListener",s,I.listener||h));else if(typeof I!="function"){for(O=-1,T=I.length-1;T>=0;T--)if(I[T]===h||I[T].listener===h){k=I[T].listener,O=T;break}if(O<0)return this;O===0?I.shift():e(I,O),I.length===1&&(v[s]=I[0]),v.removeListener!==void 0&&this.emit("removeListener",s,k||h)}return this},g.prototype.off=g.prototype.removeListener,g.prototype.removeAllListeners=function(s){var h,I,v;if(I=this._events,I===void 0)return this;if(I.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):I[s]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete I[s]),this;if(arguments.length===0){var O=Object.keys(I),T;for(v=0;v<O.length;++v)T=O[v],T!=="removeListener"&&this.removeAllListeners(T);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(h=I[s],typeof h=="function")this.removeListener(s,h);else if(h!==void 0)for(v=h.length-1;v>=0;v--)this.removeListener(s,h[v]);return this};function u(d,s,h){var I=d._events;if(I===void 0)return[];var v=I[s];return v===void 0?[]:typeof v=="function"?h?[v.listener||v]:[v]:h?i(v):r(v,v.length)}g.prototype.listeners=function(s){return u(this,s,!0)},g.prototype.rawListeners=function(s){return u(this,s,!1)},g.listenerCount=function(d,s){return typeof d.listenerCount=="function"?d.listenerCount(s):b.call(d,s)},g.prototype.listenerCount=b;function b(d){var s=this._events;if(s!==void 0){var h=s[d];if(typeof h=="function")return 1;if(h!==void 0)return h.length}return 0}g.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]};function r(d,s){for(var h=new Array(s),I=0;I<s;++I)h[I]=d[I];return h}function e(d,s){for(;s+1<d.length;s++)d[s]=d[s+1];d.pop()}function i(d){for(var s=new Array(d.length),h=0;h<s.length;++h)s[h]=d[h].listener||d[h];return s}function o(d,s){return new Promise(function(h,I){function v(T){d.removeListener(s,O),I(T)}function O(){typeof d.removeListener=="function"&&d.removeListener("error",v),h([].slice.call(arguments))}f(d,s,O,{once:!0}),s!=="error"&&a(d,v,{once:!0})})}function a(d,s,h){typeof d.on=="function"&&f(d,"error",s,h)}function f(d,s,h,I){if(typeof d.on=="function")I.once?d.once(s,h):d.on(s,h);else if(typeof d.addEventListener=="function")d.addEventListener(s,function v(O){I.once&&d.removeEventListener(s,v),h(O)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof d)}return Xe.exports}var Ae={},Zt;function en(){if(Zt)return Ae;Zt=1;var C=Ae&&Ae.__extends||function(){var c=function(l,g){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,_){y.__proto__=_}||function(y,_){for(var E in _)Object.prototype.hasOwnProperty.call(_,E)&&(y[E]=_[E])},c(l,g)};return function(l,g){c(l,g);function y(){this.constructor=l}l.prototype=g===null?Object.create(g):(y.prototype=g.prototype,new y)}}();Object.defineProperty(Ae,"__esModule",{value:!0});var n=Z(),t=function(c){C(l,c);function l(g){var y=c.call(this)||this;return Object.defineProperties(y,{_attempts:{value:0,writable:!0},_duration:{enumerable:!1,get:function(){var _=this._min*Math.pow(this._factor,this._attempts);if(this._jitter){var E=Math.random(),w=Math.floor(E*this._jitter*_);_=(Math.floor(E*10)&1)===0?_-w:_+w}return Math.min(_,this._max)|0}},_factor:{value:g.factor||2},_jitter:{value:g.jitter>0&&g.jitter<=1?g.jitter:0},_max:{value:g.max||1e4},_min:{value:g.min||100},_timeoutID:{value:null,writable:!0}}),y}return l.prototype.backoff=function(){var g=this,y=this._duration;this._timeoutID&&(clearTimeout(this._timeoutID),this._timeoutID=null),this.emit("backoff",this._attempts,y),this._timeoutID=setTimeout(function(){g.emit("ready",g._attempts,y),g._attempts++},y)},l.prototype.reset=function(){this._attempts=0,this._timeoutID&&(clearTimeout(this._timeoutID),this._timeoutID=null)},l}(n.EventEmitter);return Ae.default=t,Ae}var Q={},Ye={exports:{}},Ir=Ye.exports,tn;function nn(){return tn||(tn=1,function(C){(function(n,t){C.exports?C.exports=t():n.log=t()})(Ir,function(){var n=function(){},t="undefined",c=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),l=["trace","debug","info","warn","error"];function g(e,i){var o=e[i];if(typeof o.bind=="function")return o.bind(e);try{return Function.prototype.bind.call(o,e)}catch{return function(){return Function.prototype.apply.apply(o,[e,arguments])}}}function y(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function _(e){return e==="debug"&&(e="log"),typeof console===t?!1:e==="trace"&&c?y:console[e]!==void 0?g(console,e):console.log!==void 0?g(console,"log"):n}function E(e,i){for(var o=0;o<l.length;o++){var a=l[o];this[a]=o<e?n:this.methodFactory(a,e,i)}this.log=this.debug}function w(e,i,o){return function(){typeof console!==t&&(E.call(this,i,o),this[e].apply(this,arguments))}}function S(e,i,o){return _(e)||w.apply(this,arguments)}function m(e,i,o){var a=this,f,d="loglevel";e&&(d+=":"+e);function s(v){var O=(l[v]||"silent").toUpperCase();if(typeof window!==t){try{window.localStorage[d]=O;return}catch{}try{window.document.cookie=encodeURIComponent(d)+"="+O+";"}catch{}}}function h(){var v;if(typeof window!==t){try{v=window.localStorage[d]}catch{}if(typeof v===t)try{var O=window.document.cookie,T=O.indexOf(encodeURIComponent(d)+"=");T!==-1&&(v=/^([^;]+)/.exec(O.slice(T))[1])}catch{}return a.levels[v]===void 0&&(v=void 0),v}}a.name=e,a.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},a.methodFactory=o||S,a.getLevel=function(){return f},a.setLevel=function(v,O){if(typeof v=="string"&&a.levels[v.toUpperCase()]!==void 0&&(v=a.levels[v.toUpperCase()]),typeof v=="number"&&v>=0&&v<=a.levels.SILENT){if(f=v,O!==!1&&s(v),E.call(a,v,e),typeof console===t&&v<a.levels.SILENT)return"No console available for logging"}else throw"log.setLevel() called with invalid level: "+v},a.setDefaultLevel=function(v){h()||a.setLevel(v,!1)},a.enableAll=function(v){a.setLevel(a.levels.TRACE,v)},a.disableAll=function(v){a.setLevel(a.levels.SILENT,v)};var I=h();I==null&&(I=i??"WARN"),a.setLevel(I,!1)}var u=new m,b={};u.getLogger=function(i){if(typeof i!="string"||i==="")throw new TypeError("You must supply a name when creating a logger.");var o=b[i];return o||(o=b[i]=new m(i,u.getLevel(),u.methodFactory)),o};var r=typeof window!==t?window.log:void 0;return u.noConflict=function(){return typeof window!==t&&window.log===u&&(window.log=r),u},u.getLoggers=function(){return b},u})}(Ye)),Ye.exports}var ne={},He={},We={},ke={},rn;function Ar(){if(rn)return ke;rn=1;var C=ke&&ke.__extends||function(){var t=function(c,l){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(g,y){g.__proto__=y}||function(g,y){for(var _ in y)Object.prototype.hasOwnProperty.call(y,_)&&(g[_]=y[_])},t(c,l)};return function(c,l){t(c,l);function g(){this.constructor=c}c.prototype=l===null?Object.create(l):(g.prototype=l.prototype,new g)}}();Object.defineProperty(ke,"__esModule",{value:!0});var n=function(t){C(c,t);function c(l,g){var y=t.call(this)||this;Object.setPrototypeOf(y,c.prototype);var _=typeof l=="string"?l:y.explanation,E=typeof l=="object"?l:g;return y.message=y.name+" ("+y.code+"): "+_,y.originalError=E,y}return c}(Error);return ke.default=n,ke}var on;function kr(){return on||(on=1,function(C){var n=We&&We.__extends||function(){var u=function(b,r){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,i){e.__proto__=i}||function(e,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[o])},u(b,r)};return function(b,r){u(b,r);function e(){this.constructor=b}b.prototype=r===null?Object.create(r):(e.prototype=r.prototype,new e)}}();Object.defineProperty(C,"__esModule",{value:!0}),C.errorsByCode=C.MediaErrors=C.SignalingErrors=C.UserMediaErrors=C.MalformedRequestErrors=C.GeneralErrors=C.SIPServerErrors=C.ClientErrors=C.SignatureValidationErrors=C.AuthorizationErrors=C.TwilioError=void 0;var t=Ar();C.TwilioError=t.default;var c;(function(u){var b=function(i){n(o,i);function o(a,f){var d=i.call(this,a,f)||this;d.causes=[],d.code=20101,d.description="Invalid access token",d.explanation="Twilio was unable to validate your Access Token",d.name="AccessTokenInvalid",d.solutions=[],Object.setPrototypeOf(d,u.AccessTokenInvalid.prototype);var s=typeof a=="string"?a:d.explanation,h=typeof a=="object"?a:f;return d.message=d.name+" ("+d.code+"): "+s,d.originalError=h,d}return o}(t.default);u.AccessTokenInvalid=b;var r=function(i){n(o,i);function o(a,f){var d=i.call(this,a,f)||this;d.causes=[],d.code=20104,d.description="Access token expired or expiration date invalid",d.explanation="The Access Token provided to the Twilio API has expired, the expiration time specified in the token was invalid, or the expiration time specified was too far in the future",d.name="AccessTokenExpired",d.solutions=[],Object.setPrototypeOf(d,u.AccessTokenExpired.prototype);var s=typeof a=="string"?a:d.explanation,h=typeof a=="object"?a:f;return d.message=d.name+" ("+d.code+"): "+s,d.originalError=h,d}return o}(t.default);u.AccessTokenExpired=r;var e=function(i){n(o,i);function o(a,f){var d=i.call(this,a,f)||this;d.causes=[],d.code=20151,d.description="Authentication Failed",d.explanation="The Authentication with the provided JWT failed",d.name="AuthenticationFailed",d.solutions=[],Object.setPrototypeOf(d,u.AuthenticationFailed.prototype);var s=typeof a=="string"?a:d.explanation,h=typeof a=="object"?a:f;return d.message=d.name+" ("+d.code+"): "+s,d.originalError=h,d}return o}(t.default);u.AuthenticationFailed=e})(c=C.AuthorizationErrors||(C.AuthorizationErrors={}));var l;(function(u){var b=function(r){n(e,r);function e(i,o){var a=r.call(this,i,o)||this;a.causes=["The access token has an invalid Account SID, API Key, or API Key Secret."],a.code=31202,a.description="Signature validation failed.",a.explanation="The provided access token failed signature validation.",a.name="AccessTokenSignatureValidationFailed",a.solutions=["Ensure the Account SID, API Key, and API Key Secret are valid when generating your access token."],Object.setPrototypeOf(a,u.AccessTokenSignatureValidationFailed.prototype);var f=typeof i=="string"?i:a.explanation,d=typeof i=="object"?i:o;return a.message=a.name+" ("+a.code+"): "+f,a.originalError=d,a}return e}(t.default);u.AccessTokenSignatureValidationFailed=b})(l=C.SignatureValidationErrors||(C.SignatureValidationErrors={}));var g;(function(u){var b=function(o){n(a,o);function a(f,d){var s=o.call(this,f,d)||this;s.causes=[],s.code=31400,s.description="Bad Request (HTTP/SIP)",s.explanation="The request could not be understood due to malformed syntax.",s.name="BadRequest",s.solutions=[],Object.setPrototypeOf(s,u.BadRequest.prototype);var h=typeof f=="string"?f:s.explanation,I=typeof f=="object"?f:d;return s.message=s.name+" ("+s.code+"): "+h,s.originalError=I,s}return a}(t.default);u.BadRequest=b;var r=function(o){n(a,o);function a(f,d){var s=o.call(this,f,d)||this;s.causes=["The outbound call was made to an invalid phone number.","The TwiML application sid is missing a Voice URL."],s.code=31404,s.description="Not Found (HTTP/SIP)",s.explanation="The server has not found anything matching the request.",s.name="NotFound",s.solutions=["Ensure the phone number dialed is valid.","Ensure the TwiML application is configured correctly with a Voice URL link."],Object.setPrototypeOf(s,u.NotFound.prototype);var h=typeof f=="string"?f:s.explanation,I=typeof f=="object"?f:d;return s.message=s.name+" ("+s.code+"): "+h,s.originalError=I,s}return a}(t.default);u.NotFound=r;var e=function(o){n(a,o);function a(f,d){var s=o.call(this,f,d)||this;s.causes=[],s.code=31480,s.description="Temporarily Unavailable (SIP)",s.explanation="The callee is currently unavailable.",s.name="TemporarilyUnavailable",s.solutions=[],Object.setPrototypeOf(s,u.TemporarilyUnavailable.prototype);var h=typeof f=="string"?f:s.explanation,I=typeof f=="object"?f:d;return s.message=s.name+" ("+s.code+"): "+h,s.originalError=I,s}return a}(t.default);u.TemporarilyUnavailable=e;var i=function(o){n(a,o);function a(f,d){var s=o.call(this,f,d)||this;s.causes=[],s.code=31486,s.description="Busy Here (SIP)",s.explanation="The callee is busy.",s.name="BusyHere",s.solutions=[],Object.setPrototypeOf(s,u.BusyHere.prototype);var h=typeof f=="string"?f:s.explanation,I=typeof f=="object"?f:d;return s.message=s.name+" ("+s.code+"): "+h,s.originalError=I,s}return a}(t.default);u.BusyHere=i})(g=C.ClientErrors||(C.ClientErrors={}));var y;(function(u){var b=function(r){n(e,r);function e(i,o){var a=r.call(this,i,o)||this;a.causes=[],a.code=31603,a.description="Decline (SIP)",a.explanation="The callee does not wish to participate in the call.",a.name="Decline",a.solutions=[],Object.setPrototypeOf(a,u.Decline.prototype);var f=typeof i=="string"?i:a.explanation,d=typeof i=="object"?i:o;return a.message=a.name+" ("+a.code+"): "+f,a.originalError=d,a}return e}(t.default);u.Decline=b})(y=C.SIPServerErrors||(C.SIPServerErrors={}));var _;(function(u){var b=function(d){n(s,d);function s(h,I){var v=d.call(this,h,I)||this;v.causes=[],v.code=31e3,v.description="Unknown Error",v.explanation="An unknown error has occurred. See error details for more information.",v.name="UnknownError",v.solutions=[],Object.setPrototypeOf(v,u.UnknownError.prototype);var O=typeof h=="string"?h:v.explanation,T=typeof h=="object"?h:I;return v.message=v.name+" ("+v.code+"): "+O,v.originalError=T,v}return s}(t.default);u.UnknownError=b;var r=function(d){n(s,d);function s(h,I){var v=d.call(this,h,I)||this;v.causes=[],v.code=31001,v.description="Application Not Found",v.explanation="",v.name="ApplicationNotFoundError",v.solutions=[],Object.setPrototypeOf(v,u.ApplicationNotFoundError.prototype);var O=typeof h=="string"?h:v.explanation,T=typeof h=="object"?h:I;return v.message=v.name+" ("+v.code+"): "+O,v.originalError=T,v}return s}(t.default);u.ApplicationNotFoundError=r;var e=function(d){n(s,d);function s(h,I){var v=d.call(this,h,I)||this;v.causes=[],v.code=31002,v.description="Connection Declined",v.explanation="",v.name="ConnectionDeclinedError",v.solutions=[],Object.setPrototypeOf(v,u.ConnectionDeclinedError.prototype);var O=typeof h=="string"?h:v.explanation,T=typeof h=="object"?h:I;return v.message=v.name+" ("+v.code+"): "+O,v.originalError=T,v}return s}(t.default);u.ConnectionDeclinedError=e;var i=function(d){n(s,d);function s(h,I){var v=d.call(this,h,I)||this;v.causes=[],v.code=31003,v.description="Connection Timeout",v.explanation="The server could not produce a response within a suitable amount of time.",v.name="ConnectionTimeoutError",v.solutions=[],Object.setPrototypeOf(v,u.ConnectionTimeoutError.prototype);var O=typeof h=="string"?h:v.explanation,T=typeof h=="object"?h:I;return v.message=v.name+" ("+v.code+"): "+O,v.originalError=T,v}return s}(t.default);u.ConnectionTimeoutError=i;var o=function(d){n(s,d);function s(h,I){var v=d.call(this,h,I)||this;v.causes=[],v.code=31005,v.description="Connection error",v.explanation="A connection error occurred during the call",v.name="ConnectionError",v.solutions=[],Object.setPrototypeOf(v,u.ConnectionError.prototype);var O=typeof h=="string"?h:v.explanation,T=typeof h=="object"?h:I;return v.message=v.name+" ("+v.code+"): "+O,v.originalError=T,v}return s}(t.default);u.ConnectionError=o;var a=function(d){n(s,d);function s(h,I){var v=d.call(this,h,I)||this;v.causes=["The incoming call was cancelled because it was not answered in time or it was accepted/rejected by another application instance registered with the same identity."],v.code=31008,v.description="Call cancelled",v.explanation="Unable to answer because the call has ended",v.name="CallCancelledError",v.solutions=[],Object.setPrototypeOf(v,u.CallCancelledError.prototype);var O=typeof h=="string"?h:v.explanation,T=typeof h=="object"?h:I;return v.message=v.name+" ("+v.code+"): "+O,v.originalError=T,v}return s}(t.default);u.CallCancelledError=a;var f=function(d){n(s,d);function s(h,I){var v=d.call(this,h,I)||this;v.causes=[],v.code=31009,v.description="Transport error",v.explanation="No transport available to send or receive messages",v.name="TransportError",v.solutions=[],Object.setPrototypeOf(v,u.TransportError.prototype);var O=typeof h=="string"?h:v.explanation,T=typeof h=="object"?h:I;return v.message=v.name+" ("+v.code+"): "+O,v.originalError=T,v}return s}(t.default);u.TransportError=f})(_=C.GeneralErrors||(C.GeneralErrors={}));var E;(function(u){var b=function(d){n(s,d);function s(h,I){var v=d.call(this,h,I)||this;v.causes=["Invalid content or MessageType passed to sendMessage method."],v.code=31100,v.description="The request had malformed syntax.",v.explanation="The request could not be understood due to malformed syntax.",v.name="MalformedRequestError",v.solutions=["Ensure content and MessageType passed to sendMessage method are valid."],Object.setPrototypeOf(v,u.MalformedRequestError.prototype);var O=typeof h=="string"?h:v.explanation,T=typeof h=="object"?h:I;return v.message=v.name+" ("+v.code+"): "+O,v.originalError=T,v}return s}(t.default);u.MalformedRequestError=b;var r=function(d){n(s,d);function s(h,I){var v=d.call(this,h,I)||this;v.causes=[],v.code=31101,v.description="Missing parameter array in request",v.explanation="",v.name="MissingParameterArrayError",v.solutions=[],Object.setPrototypeOf(v,u.MissingParameterArrayError.prototype);var O=typeof h=="string"?h:v.explanation,T=typeof h=="object"?h:I;return v.message=v.name+" ("+v.code+"): "+O,v.originalError=T,v}return s}(t.default);u.MissingParameterArrayError=r;var e=function(d){n(s,d);function s(h,I){var v=d.call(this,h,I)||this;v.causes=[],v.code=31102,v.description="Authorization token missing in request.",v.explanation="",v.name="AuthorizationTokenMissingError",v.solutions=[],Object.setPrototypeOf(v,u.AuthorizationTokenMissingError.prototype);var O=typeof h=="string"?h:v.explanation,T=typeof h=="object"?h:I;return v.message=v.name+" ("+v.code+"): "+O,v.originalError=T,v}return s}(t.default);u.AuthorizationTokenMissingError=e;var i=function(d){n(s,d);function s(h,I){var v=d.call(this,h,I)||this;v.causes=[],v.code=31103,v.description="Maximum parameter length has been exceeded.",v.explanation="Length of parameters cannot exceed MAX_PARAM_LENGTH.",v.name="MaxParameterLengthExceededError",v.solutions=[],Object.setPrototypeOf(v,u.MaxParameterLengthExceededError.prototype);var O=typeof h=="string"?h:v.explanation,T=typeof h=="object"?h:I;return v.message=v.name+" ("+v.code+"): "+O,v.originalError=T,v}return s}(t.default);u.MaxParameterLengthExceededError=i;var o=function(d){n(s,d);function s(h,I){var v=d.call(this,h,I)||this;v.causes=[],v.code=31104,v.description="Invalid bridge token",v.explanation="",v.name="InvalidBridgeTokenError",v.solutions=[],Object.setPrototypeOf(v,u.InvalidBridgeTokenError.prototype);var O=typeof h=="string"?h:v.explanation,T=typeof h=="object"?h:I;return v.message=v.name+" ("+v.code+"): "+O,v.originalError=T,v}return s}(t.default);u.InvalidBridgeTokenError=o;var a=function(d){n(s,d);function s(h,I){var v=d.call(this,h,I)||this;v.causes=["Client name contains invalid characters."],v.code=31105,v.description="Invalid client name",v.explanation="Client name should not contain control, space, delims, or unwise characters.",v.name="InvalidClientNameError",v.solutions=["Make sure that client name does not contain any of the invalid characters."],Object.setPrototypeOf(v,u.InvalidClientNameError.prototype);var O=typeof h=="string"?h:v.explanation,T=typeof h=="object"?h:I;return v.message=v.name+" ("+v.code+"): "+O,v.originalError=T,v}return s}(t.default);u.InvalidClientNameError=a;var f=function(d){n(s,d);function s(h,I){var v=d.call(this,h,I)||this;v.causes=[],v.code=31107,v.description="The reconnect parameter is invalid",v.explanation="",v.name="ReconnectParameterInvalidError",v.solutions=[],Object.setPrototypeOf(v,u.ReconnectParameterInvalidError.prototype);var O=typeof h=="string"?h:v.explanation,T=typeof h=="object"?h:I;return v.message=v.name+" ("+v.code+"): "+O,v.originalError=T,v}return s}(t.default);u.ReconnectParameterInvalidError=f})(E=C.MalformedRequestErrors||(C.MalformedRequestErrors={})),function(u){var b=function(h){n(I,h);function I(v,O){var T=h.call(this,v,O)||this;T.causes=[],T.code=31201,T.description="Authorization error",T.explanation="The request requires user authentication. The server understood the request, but is refusing to fulfill it.",T.name="AuthorizationError",T.solutions=[],Object.setPrototypeOf(T,u.AuthorizationError.prototype);var k=typeof v=="string"?v:T.explanation,P=typeof v=="object"?v:O;return T.message=T.name+" ("+T.code+"): "+k,T.originalError=P,T}return I}(t.default);u.AuthorizationError=b;var r=function(h){n(I,h);function I(v,O){var T=h.call(this,v,O)||this;T.causes=[],T.code=31203,T.description="No valid account",T.explanation="",T.name="NoValidAccountError",T.solutions=[],Object.setPrototypeOf(T,u.NoValidAccountError.prototype);var k=typeof v=="string"?v:T.explanation,P=typeof v=="object"?v:O;return T.message=T.name+" ("+T.code+"): "+k,T.originalError=P,T}return I}(t.default);u.NoValidAccountError=r;var e=function(h){n(I,h);function I(v,O){var T=h.call(this,v,O)||this;T.causes=[],T.code=31204,T.description="Invalid JWT token",T.explanation="",T.name="InvalidJWTTokenError",T.solutions=[],Object.setPrototypeOf(T,u.InvalidJWTTokenError.prototype);var k=typeof v=="string"?v:T.explanation,P=typeof v=="object"?v:O;return T.message=T.name+" ("+T.code+"): "+k,T.originalError=P,T}return I}(t.default);u.InvalidJWTTokenError=e;var i=function(h){n(I,h);function I(v,O){var T=h.call(this,v,O)||this;T.causes=[],T.code=31205,T.description="JWT token expired",T.explanation="",T.name="JWTTokenExpiredError",T.solutions=[],Object.setPrototypeOf(T,u.JWTTokenExpiredError.prototype);var k=typeof v=="string"?v:T.explanation,P=typeof v=="object"?v:O;return T.message=T.name+" ("+T.code+"): "+k,T.originalError=P,T}return I}(t.default);u.JWTTokenExpiredError=i;var o=function(h){n(I,h);function I(v,O){var T=h.call(this,v,O)||this;T.causes=["Rate limit exceeded."],T.code=31206,T.description="Rate exceeded authorized limit.",T.explanation="The request performed exceeds the authorized limit.",T.name="RateExceededError",T.solutions=["Ensure message send rate does not exceed authorized limits."],Object.setPrototypeOf(T,u.RateExceededError.prototype);var k=typeof v=="string"?v:T.explanation,P=typeof v=="object"?v:O;return T.message=T.name+" ("+T.code+"): "+k,T.originalError=P,T}return I}(t.default);u.RateExceededError=o;var a=function(h){n(I,h);function I(v,O){var T=h.call(this,v,O)||this;T.causes=[],T.code=31207,T.description="JWT token expiration too long",T.explanation="",T.name="JWTTokenExpirationTooLongError",T.solutions=[],Object.setPrototypeOf(T,u.JWTTokenExpirationTooLongError.prototype);var k=typeof v=="string"?v:T.explanation,P=typeof v=="object"?v:O;return T.message=T.name+" ("+T.code+"): "+k,T.originalError=P,T}return I}(t.default);u.JWTTokenExpirationTooLongError=a;var f=function(h){n(I,h);function I(v,O){var T=h.call(this,v,O)||this;T.causes=[],T.code=31209,T.description="Reconnect attempt is not authorized.",T.explanation="",T.name="ReconnectAttemptError",T.solutions=[],Object.setPrototypeOf(T,u.ReconnectAttemptError.prototype);var k=typeof v=="string"?v:T.explanation,P=typeof v=="object"?v:O;return T.message=T.name+" ("+T.code+"): "+k,T.originalError=P,T}return I}(t.default);u.ReconnectAttemptError=f;var d=function(h){n(I,h);function I(v,O){var T=h.call(this,v,O)||this;T.causes=["The Call Message Event Type is invalid and is not understood by Twilio Voice."],T.code=31210,T.description="Call Message Event Type is invalid.",T.explanation="The Call Message Event Type is invalid and is not understood by Twilio Voice.",T.name="CallMessageEventTypeInvalidError",T.solutions=["Ensure the Call Message Event Type is Valid and understood by Twilio Voice and try again."],Object.setPrototypeOf(T,u.CallMessageEventTypeInvalidError.prototype);var k=typeof v=="string"?v:T.explanation,P=typeof v=="object"?v:O;return T.message=T.name+" ("+T.code+"): "+k,T.originalError=P,T}return I}(t.default);u.CallMessageEventTypeInvalidError=d;var s=function(h){n(I,h);function I(v,O){var T=h.call(this,v,O)||this;T.causes=["The payload size of Call Message Event exceeds the authorized limit."],T.code=31212,T.description="Call Message Event Payload size exceeded authorized limit.",T.explanation="The request performed to send a Call Message Event exceeds the payload size authorized limit",T.name="PayloadSizeExceededError",T.solutions=["Reduce payload size of Call Message Event to be within the authorized limit and try again."],Object.setPrototypeOf(T,u.PayloadSizeExceededError.prototype);var k=typeof v=="string"?v:T.explanation,P=typeof v=="object"?v:O;return T.message=T.name+" ("+T.code+"): "+k,T.originalError=P,T}return I}(t.default);u.PayloadSizeExceededError=s}(c=C.AuthorizationErrors||(C.AuthorizationErrors={}));var w;(function(u){var b=function(e){n(i,e);function i(o,a){var f=e.call(this,o,a)||this;f.causes=["The user denied the getUserMedia request.","The browser denied the getUserMedia request."],f.code=31401,f.description="UserMedia Permission Denied Error",f.explanation="The browser or end-user denied permissions to user media. Therefore we were unable to acquire input audio.",f.name="PermissionDeniedError",f.solutions=["The user should accept the request next time prompted. If the browser saved the deny, the user should change that permission in their browser.","The user should to verify that the browser has permission to access the microphone at this address."],Object.setPrototypeOf(f,u.PermissionDeniedError.prototype);var d=typeof o=="string"?o:f.explanation,s=typeof o=="object"?o:a;return f.message=f.name+" ("+f.code+"): "+d,f.originalError=s,f}return i}(t.default);u.PermissionDeniedError=b;var r=function(e){n(i,e);function i(o,a){var f=e.call(this,o,a)||this;f.causes=["NotFoundError - The deviceID specified was not found.","The getUserMedia constraints were overconstrained and no devices matched."],f.code=31402,f.description="UserMedia Acquisition Failed Error",f.explanation="The browser and end-user allowed permissions, however getting the media failed. Usually this is due to bad constraints, but can sometimes fail due to browser, OS or hardware issues.",f.name="AcquisitionFailedError",f.solutions=["Ensure the deviceID being specified exists.","Try acquiring media with fewer constraints."],Object.setPrototypeOf(f,u.AcquisitionFailedError.prototype);var d=typeof o=="string"?o:f.explanation,s=typeof o=="object"?o:a;return f.message=f.name+" ("+f.code+"): "+d,f.originalError=s,f}return i}(t.default);u.AcquisitionFailedError=r})(w=C.UserMediaErrors||(C.UserMediaErrors={}));var S;(function(u){var b=function(e){n(i,e);function i(o,a){var f=e.call(this,o,a)||this;f.causes=[],f.code=53e3,f.description="Signaling connection error",f.explanation="Raised whenever a signaling connection error occurs that is not covered by a more specific error code.",f.name="ConnectionError",f.solutions=[],Object.setPrototypeOf(f,u.ConnectionError.prototype);var d=typeof o=="string"?o:f.explanation,s=typeof o=="object"?o:a;return f.message=f.name+" ("+f.code+"): "+d,f.originalError=s,f}return i}(t.default);u.ConnectionError=b;var r=function(e){n(i,e);function i(o,a){var f=e.call(this,o,a)||this;f.causes=["The device running your application lost its Internet connection."],f.code=53001,f.description="Signaling connection disconnected",f.explanation="Raised whenever the signaling connection is unexpectedly disconnected.",f.name="ConnectionDisconnected",f.solutions=["Ensure the device running your application has access to a stable Internet connection."],Object.setPrototypeOf(f,u.ConnectionDisconnected.prototype);var d=typeof o=="string"?o:f.explanation,s=typeof o=="object"?o:a;return f.message=f.name+" ("+f.code+"): "+d,f.originalError=s,f}return i}(t.default);u.ConnectionDisconnected=r})(S=C.SignalingErrors||(C.SignalingErrors={}));var m;(function(u){var b=function(i){n(o,i);function o(a,f){var d=i.call(this,a,f)||this;d.causes=["The Client may not be using a supported WebRTC implementation.","The Client may not have the necessary resources to create or apply a new media description."],d.code=53400,d.description="Client is unable to create or apply a local media description",d.explanation="Raised whenever a Client is unable to create or apply a local media description.",d.name="ClientLocalDescFailed",d.solutions=["If you are experiencing this error using the JavaScript SDK, ensure you are running it with a supported WebRTC implementation."],Object.setPrototypeOf(d,u.ClientLocalDescFailed.prototype);var s=typeof a=="string"?a:d.explanation,h=typeof a=="object"?a:f;return d.message=d.name+" ("+d.code+"): "+s,d.originalError=h,d}return o}(t.default);u.ClientLocalDescFailed=b;var r=function(i){n(o,i);function o(a,f){var d=i.call(this,a,f)||this;d.causes=["The Client may not be using a supported WebRTC implementation.","The Client may be connecting peer-to-peer with another Participant that is not using a supported WebRTC implementation.","The Client may not have the necessary resources to apply a new media description."],d.code=53402,d.description="Client is unable to apply a remote media description",d.explanation="Raised whenever the Client receives a remote media description but is unable to apply it.",d.name="ClientRemoteDescFailed",d.solutions=["If you are experiencing this error using the JavaScript SDK, ensure you are running it with a supported WebRTC implementation."],Object.setPrototypeOf(d,u.ClientRemoteDescFailed.prototype);var s=typeof a=="string"?a:d.explanation,h=typeof a=="object"?a:f;return d.message=d.name+" ("+d.code+"): "+s,d.originalError=h,d}return o}(t.default);u.ClientRemoteDescFailed=r;var e=function(i){n(o,i);function o(a,f){var d=i.call(this,a,f)||this;d.causes=["The Client was unable to establish a media connection.","A media connection which was active failed liveliness checks."],d.code=53405,d.description="Media connection failed",d.explanation="Raised by the Client or Server whenever a media connection fails.",d.name="ConnectionError",d.solutions=["If the problem persists, try connecting to another region.","Check your Client's network connectivity.","If you've provided custom ICE Servers then ensure that the URLs and credentials are valid."],Object.setPrototypeOf(d,u.ConnectionError.prototype);var s=typeof a=="string"?a:d.explanation,h=typeof a=="object"?a:f;return d.message=d.name+" ("+d.code+"): "+s,d.originalError=h,d}return o}(t.default);u.ConnectionError=e})(m=C.MediaErrors||(C.MediaErrors={})),C.errorsByCode=new Map([[20101,c.AccessTokenInvalid],[20104,c.AccessTokenExpired],[20151,c.AuthenticationFailed],[31202,l.AccessTokenSignatureValidationFailed],[31400,g.BadRequest],[31404,g.NotFound],[31480,g.TemporarilyUnavailable],[31486,g.BusyHere],[31603,y.Decline],[31e3,_.UnknownError],[31001,_.ApplicationNotFoundError],[31002,_.ConnectionDeclinedError],[31003,_.ConnectionTimeoutError],[31005,_.ConnectionError],[31008,_.CallCancelledError],[31009,_.TransportError],[31100,E.MalformedRequestError],[31101,E.MissingParameterArrayError],[31102,E.AuthorizationTokenMissingError],[31103,E.MaxParameterLengthExceededError],[31104,E.InvalidBridgeTokenError],[31105,E.InvalidClientNameError],[31107,E.ReconnectParameterInvalidError],[31201,c.AuthorizationError],[31203,c.NoValidAccountError],[31204,c.InvalidJWTTokenError],[31205,c.JWTTokenExpiredError],[31206,c.RateExceededError],[31207,c.JWTTokenExpirationTooLongError],[31209,c.ReconnectAttemptError],[31210,c.CallMessageEventTypeInvalidError],[31212,c.PayloadSizeExceededError],[31401,w.PermissionDeniedError],[31402,w.AcquisitionFailedError],[53e3,S.ConnectionError],[53001,S.ConnectionDisconnected],[53400,m.ClientLocalDescFailed],[53402,m.ClientRemoteDescFailed],[53405,m.ConnectionError]]),Object.freeze(C.errorsByCode)}(We)),We}var an;function z(){return an||(an=1,function(C){var n=He&&He.__extends||function(){var S=function(m,u){return S=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(b,r){b.__proto__=r}||function(b,r){for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(b[e]=r[e])},S(m,u)};return function(m,u){S(m,u);function b(){this.constructor=m}m.prototype=u===null?Object.create(u):(b.prototype=u.prototype,new b)}}();Object.defineProperty(C,"__esModule",{value:!0}),C.UserMediaErrors=C.TwilioError=C.SIPServerErrors=C.SignatureValidationErrors=C.SignalingErrors=C.MediaErrors=C.MalformedRequestErrors=C.GeneralErrors=C.ClientErrors=C.AuthorizationErrors=C.hasErrorByCode=C.getErrorByCode=C.NotSupportedError=C.InvalidStateError=C.InvalidArgumentError=C.getPreciseSignalingErrorByCode=void 0;var t=kr();Object.defineProperty(C,"AuthorizationErrors",{enumerable:!0,get:function(){return t.AuthorizationErrors}}),Object.defineProperty(C,"ClientErrors",{enumerable:!0,get:function(){return t.ClientErrors}}),Object.defineProperty(C,"GeneralErrors",{enumerable:!0,get:function(){return t.GeneralErrors}}),Object.defineProperty(C,"MalformedRequestErrors",{enumerable:!0,get:function(){return t.MalformedRequestErrors}}),Object.defineProperty(C,"MediaErrors",{enumerable:!0,get:function(){return t.MediaErrors}}),Object.defineProperty(C,"SignalingErrors",{enumerable:!0,get:function(){return t.SignalingErrors}}),Object.defineProperty(C,"SignatureValidationErrors",{enumerable:!0,get:function(){return t.SignatureValidationErrors}}),Object.defineProperty(C,"SIPServerErrors",{enumerable:!0,get:function(){return t.SIPServerErrors}}),Object.defineProperty(C,"TwilioError",{enumerable:!0,get:function(){return t.TwilioError}}),Object.defineProperty(C,"UserMediaErrors",{enumerable:!0,get:function(){return t.UserMediaErrors}});var c=new Set([31001,31002,31003,31101,31102,31103,31104,31105,31107,31201,31202,31203,31204,31205,31207,31404,31480,31486,31603]);function l(S,m){if(typeof m=="number"&&w(m)){var u=S?!0:!c.has(m);if(u)return E(m)}}C.getPreciseSignalingErrorByCode=l;var g=function(S){n(m,S);function m(u){var b=S.call(this,u)||this;return b.name="InvalidArgumentError",b}return m}(Error);C.InvalidArgumentError=g;var y=function(S){n(m,S);function m(u){var b=S.call(this,u)||this;return b.name="InvalidStateError",b}return m}(Error);C.InvalidStateError=y;var _=function(S){n(m,S);function m(u){var b=S.call(this,u)||this;return b.name="NotSupportedError",b}return m}(Error);C.NotSupportedError=_;function E(S){var m=t.errorsByCode.get(S);if(!m)throw new g("Error code "+S+" not found");return m}C.getErrorByCode=E;function w(S){return t.errorsByCode.has(S)}C.hasErrorByCode=w}(He)),He}var pe={},K={},sn;function Re(){if(sn)return K;sn=1,Object.defineProperty(K,"__esModule",{value:!0}),K.SOUNDS_BASE_URL=K.RELEASE_VERSION=K.PACKAGE_NAME=K.ECHO_TEST_DURATION=K.COWBELL_AUDIO_URL=void 0;var C="@twilio/voice-sdk";K.PACKAGE_NAME=C;var n="2.13.0";K.RELEASE_VERSION=n;var t="https://sdk.twilio.com/js/client/sounds/releases/1.0.0";K.SOUNDS_BASE_URL=t;var c=t+"/cowbell.mp3?cache="+n;K.COWBELL_AUDIO_URL=c;var l=2e4;return K.ECHO_TEST_DURATION=l,K}var cn;function X(){if(cn)return pe;cn=1;var C=pe&&pe.__spreadArrays||function(){for(var l=0,g=0,y=arguments.length;g<y;g++)l+=arguments[g].length;for(var _=Array(l),E=0,g=0;g<y;g++)for(var w=arguments[g],S=0,m=w.length;S<m;S++,E++)_[E]=w[S];return _};Object.defineProperty(pe,"__esModule",{value:!0}),pe.Logger=void 0;var n=nn(),t=Re(),c=function(){function l(g,y){this._log=l.getLogLevelInstance(y),this._prefix="[TwilioVoice]["+g+"]"}return l.getLogLevelInstance=function(g){if(!l.loglevelInstance)try{l.loglevelInstance=(g&&g.LogLevelModule?g.LogLevelModule:n).getLogger(t.PACKAGE_NAME)}catch{console.warn("Cannot create custom logger"),l.loglevelInstance=console}return l.loglevelInstance},l.prototype.debug=function(){for(var g,y=[],_=0;_<arguments.length;_++)y[_]=arguments[_];(g=this._log).debug.apply(g,C([this._prefix],y))},l.prototype.error=function(){for(var g,y=[],_=0;_<arguments.length;_++)y[_]=arguments[_];(g=this._log).error.apply(g,C([this._prefix],y))},l.prototype.info=function(){for(var g,y=[],_=0;_<arguments.length;_++)y[_]=arguments[_];(g=this._log).info.apply(g,C([this._prefix],y))},l.prototype.setDefaultLevel=function(g){this._log.setDefaultLevel?this._log.setDefaultLevel(g):console.warn("Logger cannot setDefaultLevel")},l.prototype.warn=function(){for(var g,y=[],_=0;_<arguments.length;_++)y[_]=arguments[_];(g=this._log).warn.apply(g,C([this._prefix],y))},l.levels=n.levels,l}();return pe.Logger=c.getLogLevelInstance(),pe.default=c,pe}var Ze={},un;function Rr(){if(un)return Ze;un=1,Object.defineProperty(Ze,"__esModule",{value:!0});var C=Re(),n=z(),t=X(),c=C.SOUNDS_BASE_URL+"/outgoing.mp3",l=function(){function g(y,_,E,w){this._name=y,this._availableDevices=_,this._beforeChange=E,this._isSupported=w,this._activeDevices=new Set,this._log=new t.default("OutputDeviceCollection")}return g.prototype.delete=function(y){this._log.debug(".delete",y);var _=!!this._activeDevices.delete(y),E=this._availableDevices.get("default")||Array.from(this._availableDevices.values())[0];!this._activeDevices.size&&E&&this._activeDevices.add(E);var w=Array.from(this._activeDevices.values()).map(function(S){return S.deviceId});return this._beforeChange(this._name,w),!!_},g.prototype.get=function(){return this._activeDevices},g.prototype.set=function(y){var _=this;if(this._log.debug(".set",y),!this._isSupported)return Promise.reject(new n.NotSupportedError("This browser does not support audio output selection"));var E=Array.isArray(y)?y:[y];if(!E.length)return Promise.reject(new n.InvalidArgumentError("Must specify at least one device to set"));var w=[],S=E.map(function(m){var u=_._availableDevices.get(m);return u||w.push(m),u});return w.length?Promise.reject(new n.InvalidArgumentError("Devices not found: "+w.join(", "))):new Promise(function(m){m(_._beforeChange(_._name,E))}).then(function(){_._activeDevices.clear(),S.forEach(_._activeDevices.add,_._activeDevices)})},g.prototype.test=function(y){return y===void 0&&(y=c),this._isSupported?this._activeDevices.size?Promise.all(Array.from(this._activeDevices).map(function(_){var E;return new Promise(function(w){E=new Audio(y),E.oncanplay=w}).then(function(){return E.setSinkId(_.deviceId).then(function(){return E.play()})})})):Promise.reject(new n.InvalidStateError("No active output devices to test")):Promise.reject(new n.NotSupportedError("This browser does not support audio output selection"))},g}();return Ze.default=l,Ze}var et={},ln;function xr(){if(ln)return et;ln=1,Object.defineProperty(et,"__esModule",{value:!0});var C=function(){function n(t){Object.defineProperties(this,{deviceId:{get:function(){return t.deviceId}},groupId:{get:function(){return t.groupId}},kind:{get:function(){return t.kind}},label:{get:function(){return t.label}}})}return n}();return et.default=C,et}var H={},dn;function he(){if(dn)return H;dn=1,Object.defineProperty(H,"__esModule",{value:!0}),H.promisifyEvents=H.flatMap=H.queryToJson=H.isUnifiedPlanDefault=H.isSafari=H.isLegacyEdge=H.isFirefox=H.isChrome=H.isElectron=H.difference=H.average=H.Exception=void 0;function C(b){if(!(this instanceof C))return new C(b);this.message=b}C.prototype.toString=function(){return"Twilio.Exception: "+this.message};function n(b){return b&&b.length?b.reduce(function(r,e){return r+e})/b.length:0}H.average=n;function t(b,r,e){e=e||function(o){return o};var i=new Set(r.map(e));return b.filter(function(o){return!i.has(e(o))})}H.difference=t;function c(b){return!!b.userAgent.match("Electron")}H.isElectron=c;function l(b,r){var e=!!r.userAgent.match("CriOS"),i=!!r.userAgent.match("HeadlessChrome"),o=typeof b.chrome<"u"&&r.vendor==="Google Inc."&&r.userAgent.indexOf("OPR")===-1&&r.userAgent.indexOf("Edge")===-1;return e||c(r)||o||i}H.isChrome=l;function g(b){return b=b||(typeof window>"u"?bt.navigator:window.navigator),!!b&&typeof b.userAgent=="string"&&/firefox|fxios/i.test(b.userAgent)}H.isFirefox=g;function y(b){return b=b||(typeof window>"u"?bt.navigator:window.navigator),!!b&&typeof b.userAgent=="string"&&/edge\/\d+/i.test(b.userAgent)}H.isLegacyEdge=y;function _(b){return!!b.vendor&&b.vendor.indexOf("Apple")!==-1&&b.userAgent&&b.userAgent.indexOf("CriOS")===-1&&b.userAgent.indexOf("FxiOS")===-1}H.isSafari=_;function E(b,r,e,i){if(typeof b>"u"||typeof r>"u"||typeof e>"u"||typeof i>"u"||typeof e.prototype>"u"||typeof i.prototype>"u")return!1;if(l(b,r)&&e.prototype.addTransceiver){var o=new e,a=!0;try{o.addTransceiver("audio")}catch{a=!1}return o.close(),a}else{if(g(r))return!0;if(_(r))return"currentDirection"in i.prototype}return!1}H.isUnifiedPlanDefault=E;function w(b){return b?b.split("&").reduce(function(r,e){var i=e.split("="),o=i[0],a=decodeURIComponent((i[1]||"").replace(/\+/g,"%20"));return o&&(r[o]=a),r},{}):""}H.queryToJson=w;function S(b,r){var e=b instanceof Map||b instanceof Set?Array.from(b.values()):b;return r=r||function(i){return i},e.reduce(function(i,o){var a=r(o);return i.concat(a)},[])}H.flatMap=S;function m(b,r,e){return new Promise(function(i,o){function a(){b.removeListener(e,f),i()}function f(){b.removeListener(r,a),o()}b.once(r,a),b.once(e,f)})}H.promisifyEvents=m;var u=C;return H.Exception=u,H}var fn;function Dr(){if(fn)return ne;fn=1;var C=ne&&ne.__extends||function(){var u=function(b,r){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,i){e.__proto__=i}||function(e,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[o])},u(b,r)};return function(b,r){u(b,r);function e(){this.constructor=b}b.prototype=r===null?Object.create(r):(e.prototype=r.prototype,new e)}}(),n=ne&&ne.__awaiter||function(u,b,r,e){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function f(h){try{s(e.next(h))}catch(I){a(I)}}function d(h){try{s(e.throw(h))}catch(I){a(I)}}function s(h){h.done?o(h.value):i(h.value).then(f,d)}s((e=e.apply(u,b||[])).next())})},t=ne&&ne.__generator||function(u,b){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},e,i,o,a;return a={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function f(s){return function(h){return d([s,h])}}function d(s){if(e)throw new TypeError("Generator is already executing.");for(;r;)try{if(e=1,i&&(o=s[0]&2?i.return:s[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,s[1])).done)return o;switch(i=0,o&&(s=[s[0]&2,o.value]),s[0]){case 0:case 1:o=s;break;case 4:return r.label++,{value:s[1],done:!1};case 5:r.label++,i=s[1],s=[0];continue;case 7:s=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(s[0]===6||s[0]===2)){r=0;continue}if(s[0]===3&&(!o||s[1]>o[0]&&s[1]<o[3])){r.label=s[1];break}if(s[0]===6&&r.label<o[1]){r.label=o[1],o=s;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(s);break}o[2]&&r.ops.pop(),r.trys.pop();continue}s=b.call(u,r)}catch(h){s=[6,h],i=0}finally{e=o=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}};Object.defineProperty(ne,"__esModule",{value:!0});var c=Z(),l=lt(),g=z(),y=X(),_=Rr(),E=xr(),w=he(),S={audioinput:"Audio Input",audiooutput:"Audio Output"},m=function(u){C(b,u);function b(r,e,i){var o,a=u.call(this)||this;a.availableInputDevices=new Map,a.availableOutputDevices=new Map,a._audioConstraints=null,a._defaultInputDeviceStream=null,a._enabledSounds=(o={},o[l.default.SoundName.Disconnect]=!0,o[l.default.SoundName.Incoming]=!0,o[l.default.SoundName.Outgoing]=!0,o),a._inputDevice=null,a._inputDevicePromise=null,a._isPollingInputVolume=!1,a._log=new y.default("AudioHelper"),a._processedStream=null,a._selectedInputDeviceStream=null,a._unknownDeviceIndexes={audioinput:{},audiooutput:{}},a._updateAvailableDevices=function(){return!a._mediaDevices||!a._enumerateDevices?Promise.reject("Enumeration not supported"):a._enumerateDevices().then(function(h){a._updateDevices(h.filter(function(v){return v.kind==="audiooutput"}),a.availableOutputDevices,a._removeLostOutput),a._updateDevices(h.filter(function(v){return v.kind==="audioinput"}),a.availableInputDevices,a._removeLostInput);var I=a.availableOutputDevices.get("default")||Array.from(a.availableOutputDevices.values())[0];[a.speakerDevices,a.ringtoneDevices].forEach(function(v){!v.get().size&&a.availableOutputDevices.size&&a.isOutputSelectionSupported&&v.set(I.deviceId).catch(function(O){a._log.warn("Unable to set audio output devices. "+O)})})})},a._removeLostInput=function(h){if(!a.inputDevice||a.inputDevice.deviceId!==h.deviceId)return!1;a._destroyProcessedStream(),a._replaceStream(null),a._inputDevice=null,a._maybeStopPollingVolume();var I=a.availableInputDevices.get("default")||Array.from(a.availableInputDevices.values())[0];return I&&a.setInputDevice(I.deviceId),!0},a._removeLostOutput=function(h){var I=a.speakerDevices.delete(h),v=a.ringtoneDevices.delete(h);return I||v},i=Object.assign({AudioContext:typeof AudioContext<"u"&&AudioContext,setSinkId:typeof HTMLAudioElement<"u"&&HTMLAudioElement.prototype.setSinkId},i),a._beforeSetInputDevice=i.beforeSetInputDevice||function(){return Promise.resolve()},a._updateUserOptions(i),a._audioProcessorEventObserver=i.audioProcessorEventObserver,a._mediaDevices=i.mediaDevices||navigator.mediaDevices,a._onActiveInputChanged=e,a._enumerateDevices=typeof i.enumerateDevices=="function"?i.enumerateDevices:a._mediaDevices&&a._mediaDevices.enumerateDevices.bind(a._mediaDevices);var f=!!(i.AudioContext||i.audioContext),d=!!a._enumerateDevices;i.enabledSounds&&(a._enabledSounds=i.enabledSounds);var s=typeof i.setSinkId=="function";return a.isOutputSelectionSupported=d&&s,a.isVolumeSupported=f,a.isVolumeSupported&&(a._audioContext=i.audioContext||i.AudioContext&&new i.AudioContext,a._audioContext&&(a._inputVolumeAnalyser=a._audioContext.createAnalyser(),a._inputVolumeAnalyser.fftSize=32,a._inputVolumeAnalyser.smoothingTimeConstant=.3)),a.ringtoneDevices=new _.default("ringtone",a.availableOutputDevices,r,a.isOutputSelectionSupported),a.speakerDevices=new _.default("speaker",a.availableOutputDevices,r,a.isOutputSelectionSupported),a.addListener("newListener",function(h){h==="inputVolume"&&a._maybeStartPollingVolume()}),a.addListener("removeListener",function(h){h==="inputVolume"&&a._maybeStopPollingVolume()}),a.once("newListener",function(){a.isOutputSelectionSupported||a._log.warn("Warning: This browser does not support audio output selection."),a.isVolumeSupported||a._log.warn("Warning: This browser does not support Twilio's volume indicator feature.")}),d&&a._initializeEnumeration(),navigator&&navigator.permissions&&typeof navigator.permissions.query=="function"?navigator.permissions.query({name:"microphone"}).then(function(h){if(h.state!=="granted"){var I=function(){a._updateAvailableDevices(),a._stopMicrophonePermissionListener()};h.addEventListener("change",I),a._microphonePermissionStatus=h,a._onMicrophonePermissionStatusChanged=I}}).catch(function(h){return a._log.warn("Warning: unable to listen for microphone permission changes. "+h)}):a._log.warn("Warning: current browser does not support permissions API."),a}return Object.defineProperty(b.prototype,"audioConstraints",{get:function(){return this._audioConstraints},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"inputDevice",{get:function(){return this._inputDevice},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"inputStream",{get:function(){return this._processedStream||this._selectedInputDeviceStream},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"processedStream",{get:function(){return this._processedStream},enumerable:!1,configurable:!0}),b.prototype._destroy=function(){this._stopDefaultInputDeviceStream(),this._stopSelectedInputDeviceStream(),this._destroyProcessedStream(),this._maybeStopPollingVolume(),this.removeAllListeners(),this._stopMicrophonePermissionListener(),this._unbind()},b.prototype._getInputDevicePromise=function(){return this._inputDevicePromise},b.prototype._maybeStartPollingVolume=function(){var r=this;if(!(!this.isVolumeSupported||!this.inputStream)&&(this._updateVolumeSource(),!(this._isPollingInputVolume||!this._inputVolumeAnalyser))){var e=this._inputVolumeAnalyser.frequencyBinCount,i=new Uint8Array(e);this._isPollingInputVolume=!0;var o=function(){if(r._isPollingInputVolume){if(r._inputVolumeAnalyser){r._inputVolumeAnalyser.getByteFrequencyData(i);var a=w.average(i);r.emit("inputVolume",a/255)}requestAnimationFrame(o)}};requestAnimationFrame(o)}},b.prototype._maybeStopPollingVolume=function(){this.isVolumeSupported&&(!this._isPollingInputVolume||this.inputStream&&this.listenerCount("inputVolume")||(this._inputVolumeSource&&(this._inputVolumeSource.disconnect(),delete this._inputVolumeSource),this._isPollingInputVolume=!1))},b.prototype._openDefaultDeviceWithConstraints=function(r){var e=this;return this._log.info("Opening default device with constraints",r),this._getUserMedia(r).then(function(i){return e._log.info("Opened default device. Updating available devices."),e._updateAvailableDevices().catch(function(o){e._log.warn("Unable to updateAvailableDevices after gUM call",o)}),e._defaultInputDeviceStream=i,e._maybeCreateProcessedStream(i)})},b.prototype._stopDefaultInputDeviceStream=function(){this._defaultInputDeviceStream&&(this._log.info("stopping default device stream"),this._defaultInputDeviceStream.getTracks().forEach(function(r){return r.stop()}),this._defaultInputDeviceStream=null,this._destroyProcessedStream())},b.prototype._unbind=function(){var r;!((r=this._mediaDevices)===null||r===void 0)&&r.removeEventListener&&this._mediaDevices.removeEventListener("devicechange",this._updateAvailableDevices)},b.prototype._updateUserOptions=function(r){typeof r.enumerateDevices=="function"&&(this._enumerateDevices=r.enumerateDevices),typeof r.getUserMedia=="function"&&(this._getUserMedia=r.getUserMedia)},b.prototype.addProcessor=function(r){if(this._log.debug(".addProcessor"),this._processor)throw new g.NotSupportedError("Adding multiple AudioProcessors is not supported at this time.");if(typeof r!="object"||r===null)throw new g.InvalidArgumentError("Missing AudioProcessor argument.");if(typeof r.createProcessedStream!="function")throw new g.InvalidArgumentError("Missing createProcessedStream() method.");if(typeof r.destroyProcessedStream!="function")throw new g.InvalidArgumentError("Missing destroyProcessedStream() method.");return this._processor=r,this._audioProcessorEventObserver.emit("add"),this._restartStreams()},b.prototype.disconnect=function(r){return this._log.debug(".disconnect",r),this._maybeEnableSound(l.default.SoundName.Disconnect,r)},b.prototype.incoming=function(r){return this._log.debug(".incoming",r),this._maybeEnableSound(l.default.SoundName.Incoming,r)},b.prototype.outgoing=function(r){return this._log.debug(".outgoing",r),this._maybeEnableSound(l.default.SoundName.Outgoing,r)},b.prototype.removeProcessor=function(r){if(this._log.debug(".removeProcessor"),typeof r!="object"||r===null)throw new g.InvalidArgumentError("Missing AudioProcessor argument.");if(this._processor!==r)throw new g.InvalidArgumentError("Cannot remove an AudioProcessor that has not been previously added.");return this._destroyProcessedStream(),this._processor=null,this._audioProcessorEventObserver.emit("remove"),this._restartStreams()},b.prototype.setAudioConstraints=function(r){return this._log.debug(".setAudioConstraints",r),this._audioConstraints=Object.assign({},r),delete this._audioConstraints.deviceId,this.inputDevice?this._setInputDevice(this.inputDevice.deviceId,!0):Promise.resolve()},b.prototype.setInputDevice=function(r){return this._log.debug(".setInputDevice",r),this._setInputDevice(r,!1)},b.prototype.unsetAudioConstraints=function(){return this._log.debug(".unsetAudioConstraints"),this._audioConstraints=null,this.inputDevice?this._setInputDevice(this.inputDevice.deviceId,!0):Promise.resolve()},b.prototype.unsetInputDevice=function(){var r=this;return this._log.debug(".unsetInputDevice",this.inputDevice),this.inputDevice?(this._destroyProcessedStream(),this._onActiveInputChanged(null).then(function(){r._replaceStream(null),r._inputDevice=null,r._maybeStopPollingVolume()})):Promise.resolve()},b.prototype._destroyProcessedStream=function(){if(this._processor&&this._processedStream){this._log.info("destroying processed stream");var r=this._processedStream;this._processedStream.getTracks().forEach(function(e){return e.stop()}),this._processedStream=null,this._processor.destroyProcessedStream(r),this._audioProcessorEventObserver.emit("destroy")}},b.prototype._getUnknownDeviceIndex=function(r){var e=r.deviceId,i=r.kind,o=this._unknownDeviceIndexes[i][e];return o||(o=Object.keys(this._unknownDeviceIndexes[i]).length+1,this._unknownDeviceIndexes[i][e]=o),o},b.prototype._initializeEnumeration=function(){var r=this;if(!this._mediaDevices||!this._enumerateDevices)throw new g.NotSupportedError("Enumeration is not supported");this._mediaDevices.addEventListener&&this._mediaDevices.addEventListener("devicechange",this._updateAvailableDevices),this._updateAvailableDevices().then(function(){r.isOutputSelectionSupported&&Promise.all([r.speakerDevices.set("default"),r.ringtoneDevices.set("default")]).catch(function(e){r._log.warn("Warning: Unable to set audio output devices. "+e)})})},b.prototype._maybeCreateProcessedStream=function(r){var e=this;return this._processor?(this._log.info("Creating processed stream"),this._processor.createProcessedStream(r).then(function(i){return e._processedStream=i,e._audioProcessorEventObserver.emit("create"),e._processedStream})):Promise.resolve(r)},b.prototype._maybeEnableSound=function(r,e){return typeof e<"u"&&(this._enabledSounds[r]=e),this._enabledSounds[r]},b.prototype._replaceStream=function(r){this._log.info("Replacing with new stream."),this._selectedInputDeviceStream&&(this._log.info("Old stream detected. Stopping tracks."),this._stopSelectedInputDeviceStream()),this._selectedInputDeviceStream=r},b.prototype._restartStreams=function(){if(this.inputDevice&&this._selectedInputDeviceStream)return this._log.info("Restarting selected input device"),this._setInputDevice(this.inputDevice.deviceId,!0);if(this._defaultInputDeviceStream){var r=this.availableInputDevices.get("default")||Array.from(this.availableInputDevices.values())[0];return this._log.info("Restarting default input device, now becoming selected."),this._setInputDevice(r.deviceId,!0)}return Promise.resolve()},b.prototype._setInputDevice=function(r,e){return n(this,void 0,void 0,function(){var i,o=this;return t(this,function(a){return i=function(){return n(o,void 0,void 0,function(){var f,d,s=this;return t(this,function(h){switch(h.label){case 0:return[4,this._beforeSetInputDevice()];case 1:if(h.sent(),typeof r!="string")return[2,Promise.reject(new g.InvalidArgumentError("Must specify the device to set"))];if(f=this.availableInputDevices.get(r),!f)return[2,Promise.reject(new g.InvalidArgumentError("Device not found: "+r))];if(this._log.info("Setting input device. ID: "+r),this._inputDevice&&this._inputDevice.deviceId===r&&this._selectedInputDeviceStream){if(!e)return[2,Promise.resolve()];this._log.info("Same track detected on setInputDevice, stopping old tracks."),this._stopSelectedInputDeviceStream()}return this._stopDefaultInputDeviceStream(),d={audio:Object.assign({deviceId:{exact:r}},this.audioConstraints)},this._log.info("setInputDevice: getting new tracks."),[2,this._getUserMedia(d).then(function(I){return s._destroyProcessedStream(),s._maybeCreateProcessedStream(I).then(function(v){return s._log.info("setInputDevice: invoking _onActiveInputChanged."),s._onActiveInputChanged(v).then(function(){s._replaceStream(I),s._inputDevice=f,s._maybeStartPollingVolume()})})})]}})})},[2,this._inputDevicePromise=i().finally(function(){o._inputDevicePromise=null})]})})},b.prototype._stopMicrophonePermissionListener=function(){var r;!((r=this._microphonePermissionStatus)===null||r===void 0)&&r.removeEventListener&&this._microphonePermissionStatus.removeEventListener("change",this._onMicrophonePermissionStatusChanged)},b.prototype._stopSelectedInputDeviceStream=function(){this._selectedInputDeviceStream&&(this._log.info("Stopping selected device stream"),this._selectedInputDeviceStream.getTracks().forEach(function(r){return r.stop()}))},b.prototype._updateDevices=function(r,e,i){var o=this,a=r.map(function(T){return T.deviceId}),f=Array.from(e.values()).map(function(T){return T.deviceId}),d=[],s=w.difference(f,a);s.forEach(function(T){var k=e.get(T);k&&(e.delete(T),i(k)&&d.push(k))});var h=!1;if(r.forEach(function(T){var k=e.get(T.deviceId),P=o._wrapMediaDeviceInfo(T);(!k||k.label!==P.label)&&(e.set(T.deviceId,P),h=!0)}),h||s.length){var I="default",v=this.inputDevice&&this.inputDevice.deviceId===I,O=this._defaultInputDeviceStream&&this.availableInputDevices.get(I);(v||O)&&(this._log.warn("Calling getUserMedia after device change to ensure that the tracks of the active device (default) have not gone stale."),setTimeout(function(){o._setInputDevice(I,!0)},0)),this._log.debug("#deviceChange",d),this.emit("deviceChange",d)}},b.prototype._updateVolumeSource=function(){if(!(!this.inputStream||!this._audioContext||!this._inputVolumeAnalyser)){this._inputVolumeSource&&this._inputVolumeSource.disconnect();try{this._inputVolumeSource=this._audioContext.createMediaStreamSource(this.inputStream),this._inputVolumeSource.connect(this._inputVolumeAnalyser)}catch(r){this._log.warn("Unable to update volume source",r),delete this._inputVolumeSource}}},b.prototype._wrapMediaDeviceInfo=function(r){var e={deviceId:r.deviceId,groupId:r.groupId,kind:r.kind,label:r.label};if(!e.label)if(e.deviceId==="default")e.label="Default";else{var i=this._getUnknownDeviceIndex(r);e.label="Unknown "+S[e.kind]+" Device "+i}return new E.default(e)},b}(c.EventEmitter);return m||(m={}),ne.default=m,ne}var be={},pn;function Or(){if(pn)return be;pn=1;var C=be&&be.__extends||function(){var l=function(g,y){return l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(_,E){_.__proto__=E}||function(_,E){for(var w in E)Object.prototype.hasOwnProperty.call(E,w)&&(_[w]=E[w])},l(g,y)};return function(g,y){l(g,y);function _(){this.constructor=g}g.prototype=y===null?Object.create(y):(_.prototype=y.prototype,new _)}}();Object.defineProperty(be,"__esModule",{value:!0}),be.AudioProcessorEventObserver=void 0;var n=Z(),t=X(),c=function(l){C(g,l);function g(){var y=l.call(this)||this;return y._log=new t.default("AudioProcessorEventObserver"),y._log.info("Creating AudioProcessorEventObserver instance"),y.on("enabled",function(){return y._reEmitEvent("enabled")}),y.on("add",function(){return y._reEmitEvent("add")}),y.on("remove",function(){return y._reEmitEvent("remove")}),y.on("create",function(){return y._reEmitEvent("create-processed-stream")}),y.on("destroy",function(){return y._reEmitEvent("destroy-processed-stream")}),y}return g.prototype.destroy=function(){this.removeAllListeners()},g.prototype._reEmitEvent=function(y){this._log.info("AudioProcessor:"+y),this.emit("event",{name:y,group:"audio-processor"})},g}(n.EventEmitter);return be.AudioProcessorEventObserver=c,be}var tt={},hn;function Mr(){if(hn)return tt;hn=1,Object.defineProperty(tt,"__esModule",{value:!0});var C=z(),n={dtmf0:[1360,960],dtmf1:[1230,720],dtmf2:[1360,720],dtmf3:[1480,720],dtmf4:[1230,790],dtmf5:[1360,790],dtmf6:[1480,790],dtmf7:[1230,870],dtmf8:[1360,870],dtmf9:[1480,870],dtmfh:[1480,960],dtmfs:[1230,960]},t=function(){function c(l){var g=this;this._context=l,this._gainNodes=[],this._gainNodes=[this._context.createGain(),this._context.createGain()],this._gainNodes.forEach(function(y){y.connect(g._context.destination),y.gain.value=.1,g._gainNodes.push(y)})}return c.prototype.cleanup=function(){this._gainNodes.forEach(function(l){l.disconnect()})},c.prototype.play=function(l){var g=this,y=n[l];if(!y)throw new C.InvalidArgumentError("Invalid DTMF sound name");var _=[this._context.createOscillator(),this._context.createOscillator()];_.forEach(function(E,w){E.type="sine",E.frequency.value=y[w],E.connect(g._gainNodes[w]),E.start(),E.stop(g._context.currentTime+.1),E.addEventListener("ended",function(){return E.disconnect()})})},c}();return tt.default=t,tt}var xe={},nt={},vn;function Lr(){if(vn)return nt;vn=1,Object.defineProperty(nt,"__esModule",{value:!0});function C(t,c,l){var g=JSON.stringify(c.body||{}),y=new Headers;c.headers=c.headers||[],Object.entries(c.headers).forEach(function(_){var E=_[0],w=_[1];return y.append(E,w)}),fetch(c.url,{body:g,headers:y,method:t}).then(function(_){return _.text()},l).then(function(_){return l(null,_)},l)}var n=C;return n.get=function(c,l){return new this("GET",c,l)},n.post=function(c,l){return new this("POST",c,l)},nt.default=n,nt}var gn;function jr(){if(gn)return xe;gn=1;var C=xe&&xe.__extends||function(){var y=function(_,E){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(w,S){w.__proto__=S}||function(w,S){for(var m in S)Object.prototype.hasOwnProperty.call(S,m)&&(w[m]=S[m])},y(_,E)};return function(_,E){y(_,E);function w(){this.constructor=_}_.prototype=E===null?Object.create(E):(w.prototype=E.prototype,new w)}}();Object.defineProperty(xe,"__esModule",{value:!0});var n=Z(),t=X(),c=Lr(),l=function(y){C(_,y);function _(E,w,S){var m=y.call(this)||this;if(!(m instanceof _))return new _(E,w,S);S=Object.assign({defaultPayload:function(){return{}}},S);var u=S.defaultPayload;typeof u!="function"&&(u=function(){return Object.assign({},S.defaultPayload)});var b=!0,r=Object.assign({app_name:void 0,app_version:void 0},S.metadata);return Object.defineProperties(m,{_defaultPayload:{value:u},_host:{value:S.host,writable:!0},_isEnabled:{get:function(){return b},set:function(e){b=e}},_log:{value:new t.default("EventPublisher")},_request:{value:S.request||c.default,writable:!0},_token:{value:w,writable:!0},isEnabled:{enumerable:!0,get:function(){return b}},metadata:{enumerable:!0,get:function(){return r}},productName:{enumerable:!0,value:E},token:{enumerable:!0,get:function(){return this._token}}}),m}return _}(n.EventEmitter);l.prototype._post=function(_,E,w,S,m,u,b){var r=this;if(!this.isEnabled&&!b||!this._host)return this._log.debug("Publishing cancelled",JSON.stringify({isEnabled:this.isEnabled,force:b,host:this._host})),Promise.resolve();if(!u||(!u.parameters||!u.parameters.CallSid)&&!u.outboundConnectionId)return u?this._log.debug("Publishing cancelled. Missing connection info",JSON.stringify({outboundConnectionId:u.outboundConnectionId,parameters:u.parameters})):this._log.debug("Publishing cancelled. Missing connection object"),Promise.resolve();var e={group:w,level:E.toUpperCase(),name:S,payload:m&&m.forEach?m.slice(0):Object.assign(this._defaultPayload(u),m),payload_type:"application/json",private:!1,publisher:this.productName,timestamp:new Date().toISOString()};this.metadata&&(e.publisher_metadata=this.metadata),_==="EndpointEvents"&&this._log.debug("Publishing insights",JSON.stringify({endpointName:_,event:e,force:b,host:this._host}));var i={body:e,headers:{"Content-Type":"application/json","X-Twilio-Token":this.token},url:"https://"+this._host+"/v4/"+_};return new Promise(function(o,a){r._request.post(i,function(f){f?(r.emit("error",f),a(f)):o()})}).catch(function(o){r._log.error("Unable to post "+w+" "+S+" event to Insights. Received error: "+o)})},l.prototype.post=function(_,E,w,S,m,u){return this._post("EndpointEvents",_,E,w,S,m,u)},l.prototype.debug=function(_,E,w,S){return this.post("debug",_,E,w,S)},l.prototype.info=function(_,E,w,S){return this.post("info",_,E,w,S)},l.prototype.warn=function(_,E,w,S){return this.post("warning",_,E,w,S)},l.prototype.error=function(_,E,w,S){return this.post("error",_,E,w,S)},l.prototype.postMetrics=function(_,E,w,S,m){var u=this;return new Promise(function(b){var r=w.map(g).map(function(e){return Object.assign(e,S)});b(u._post("EndpointMetrics","info",_,E,r,m))})},l.prototype.setHost=function(_){this._host=_},l.prototype.setToken=function(_){this._token=_},l.prototype.enable=function(){this._isEnabled=!0},l.prototype.disable=function(){this._isEnabled=!1};function g(y){return{audio_codec:y.codecName,audio_level_in:y.audioInputLevel,audio_level_out:y.audioOutputLevel,bytes_received:y.bytesReceived,bytes_sent:y.bytesSent,call_volume_input:y.inputVolume,call_volume_output:y.outputVolume,jitter:y.jitter,mos:y.mos&&Math.round(y.mos*100)/100,packets_lost:y.packetsLost,packets_lost_fraction:y.packetsLostFraction&&Math.round(y.packetsLostFraction*100)/100,packets_received:y.packetsReceived,rtt:y.rtt,timestamp:new Date(y.timestamp).toISOString(),total_bytes_received:y.totals.bytesReceived,total_bytes_sent:y.totals.bytesSent,total_packets_lost:y.totals.packetsLost,total_packets_received:y.totals.packetsReceived,total_packets_sent:y.totals.packetsSent}}return xe.default=l,xe}var ee={},oe={},rt={},mn;function Ur(){if(mn)return rt;mn=1,Object.defineProperty(rt,"__esModule",{value:!0});var C=32767,n=typeof window<"u"?window.RTCStatsReport:void 0;function t(f){if(!(this instanceof t))return new t(f);var d=this;Object.defineProperties(this,{_map:{value:f},size:{enumerable:!0,get:function(){return d._map.size}}}),this[Symbol.iterator]=f[Symbol.iterator]}n&&(t.prototype=Object.create(n.prototype),t.prototype.constructor=t),["entries","forEach","get","has","keys","values"].forEach(function(f){t.prototype[f]=function(){for(var d,s=[],h=0;h<arguments.length;h++)s[h]=arguments[h];return(d=this._map)[f].apply(d,s)}}),t.fromArray=function(d){return new t(d.reduce(function(s,h){return s.set(h.id,h),s},new Map))},t.fromRTCStatsResponse=function(d){var s,h=new Map,I=d.result().reduce(function(O,T){var k=T.id;switch(T.type){case"googCertificate":O.set(k,m(T));break;case"datachannel":O.set(k,u(T));break;case"googCandidatePair":o(T,"googActiveConnection")&&(s=k),O.set(k,S(T));break;case"localcandidate":O.set(k,w(T,!1));break;case"remotecandidate":O.set(k,w(T,!0));break;case"ssrc":a(T,"packetsReceived")?O.set("rtp-"+k,_(T)):O.set("rtp-"+k,E(T)),O.set("track-"+k,g(T)),O.set("codec-"+k,l(T));break;case"googComponent":var P=c(T);h.set(P.selectedCandidatePairId,k),O.set(k,c(T));break}return O},new Map);if(s){var v=h.get(s);v&&(I.get(v).dtlsState="connected")}return new t(I)};function c(f){return{bytesReceived:void 0,bytesSent:void 0,dtlsState:void 0,id:f.id,localCertificateId:f.stat("localCertificateId"),remoteCertificateId:f.stat("remoteCertificateId"),rtcpTransportStatsId:void 0,selectedCandidatePairId:f.stat("selectedCandidatePairId"),timestamp:Date.parse(f.timestamp),type:"transport"}}function l(f){return{channels:void 0,clockRate:void 0,id:f.id,implementation:void 0,mimeType:f.stat("mediaType")+"/"+f.stat("googCodecName"),payloadType:void 0,sdpFmtpLine:void 0,timestamp:Date.parse(f.timestamp),type:"codec"}}function g(f){return{audioLevel:a(f,"audioOutputLevel")?e(f,"audioOutputLevel")/C:(e(f,"audioInputLevel")||0)/C,detached:void 0,echoReturnLoss:i(f,"googEchoCancellationReturnLoss"),echoReturnLossEnhancement:i(f,"googEchoCancellationReturnLossEnhancement"),ended:void 0,frameHeight:a(f,"googFrameHeightReceived")?e(f,"googFrameHeightReceived"):e(f,"googFrameHeightSent"),frameWidth:a(f,"googFrameWidthReceived")?e(f,"googFrameWidthReceived"):e(f,"googFrameWidthSent"),framesCorrupted:void 0,framesDecoded:e(f,"framesDecoded"),framesDropped:void 0,framesPerSecond:void 0,framesReceived:void 0,framesSent:e(f,"framesEncoded"),fullFramesLost:void 0,id:f.id,kind:f.stat("mediaType"),partialFramesLost:void 0,remoteSource:void 0,ssrcIds:void 0,timestamp:Date.parse(f.timestamp),trackIdentifier:f.stat("googTrackId"),type:"track"}}function y(f,d){return{associateStatsId:void 0,codecId:"codec-"+f.id,firCount:d?e(f,"googFirsSent"):void 0,id:f.id,isRemote:void 0,mediaType:f.stat("mediaType"),nackCount:d?e(f,"googNacksSent"):e(f,"googNacksReceived"),pliCount:d?e(f,"googPlisSent"):e(f,"googPlisReceived"),qpSum:e(f,"qpSum"),sliCount:void 0,ssrc:f.stat("ssrc"),timestamp:Date.parse(f.timestamp),trackId:"track-"+f.id,transportId:f.stat("transportId")}}function _(f){var d=y(f,!0);return Object.assign(d,{burstDiscardCount:void 0,burstDiscardRate:void 0,burstLossCount:void 0,burstLossRate:void 0,burstPacketsDiscarded:void 0,burstPacketsLost:void 0,bytesReceived:e(f,"bytesReceived"),fractionLost:void 0,framesDecoded:e(f,"framesDecoded"),gapDiscardRate:void 0,gapLossRate:void 0,jitter:b(f.stat("googJitterReceived")),packetsDiscarded:void 0,packetsLost:e(f,"packetsLost"),packetsReceived:e(f,"packetsReceived"),packetsRepaired:void 0,roundTripTime:b(f.stat("googRtt")),type:"inbound-rtp"}),d}function E(f){var d=y(f,!1);return Object.assign(d,{bytesSent:e(f,"bytesSent"),framesEncoded:e(f,"framesEncoded"),packetsSent:e(f,"packetsSent"),remoteTimestamp:void 0,targetBitrate:void 0,type:"outbound-rtp"}),d}function w(f,d){return{candidateType:r(f.stat("candidateType")),deleted:void 0,id:f.id,ip:f.stat("ipAddress"),isRemote:d,port:e(f,"portNumber"),priority:i(f,"priority"),protocol:f.stat("transport"),relayProtocol:void 0,timestamp:Date.parse(f.timestamp),transportId:void 0,type:d?"remote-candidate":"local-candidate",url:void 0}}function S(f){return{availableIncomingBitrate:void 0,availableOutgoingBitrate:void 0,bytesReceived:e(f,"bytesReceived"),bytesSent:e(f,"bytesSent"),consentRequestsSent:e(f,"consentRequestsSent"),currentRoundTripTime:b(f.stat("googRtt")),id:f.id,lastPacketReceivedTimestamp:void 0,lastPacketSentTimestamp:void 0,localCandidateId:f.stat("localCandidateId"),nominated:void 0,priority:void 0,readable:void 0,remoteCandidateId:f.stat("remoteCandidateId"),requestsReceived:e(f,"requestsReceived"),requestsSent:e(f,"requestsSent"),responsesReceived:e(f,"responsesReceived"),responsesSent:e(f,"responsesSent"),retransmissionsReceived:void 0,retransmissionsSent:void 0,state:void 0,timestamp:Date.parse(f.timestamp),totalRoundTripTime:void 0,transportId:f.stat("googChannelId"),type:"candidate-pair",writable:o(f,"googWritable")}}function m(f){return{base64Certificate:f.stat("googDerBase64"),fingerprint:f.stat("googFingerprint"),fingerprintAlgorithm:f.stat("googFingerprintAlgorithm"),id:f.id,issuerCertificateId:f.stat("googIssuerId"),timestamp:Date.parse(f.timestamp),type:"certificate"}}function u(f){return{bytesReceived:void 0,bytesSent:void 0,datachannelid:f.stat("datachannelid"),id:f.id,label:f.stat("label"),messagesReceived:void 0,messagesSent:void 0,protocol:f.stat("protocol"),state:f.stat("state"),timestamp:Date.parse(f.timestamp),transportId:f.stat("transportId"),type:"data-channel"}}function b(f){return isNaN(f)||f===""?void 0:parseInt(f,10)/1e3}function r(f){switch(f){case"peerreflexive":return"prflx";case"serverreflexive":return"srflx";case"host":case"relay":default:return f}}function e(f,d){var s=f.stat(d);return a(f,d)?parseInt(s,10):void 0}function i(f,d){var s=f.stat(d);return a(f,d)?parseFloat(s):void 0}function o(f,d){var s=f.stat(d);return a(f,d)?s==="true"||s===!0:void 0}function a(f,d){var s=f.stat(d);return typeof s<"u"&&s!==""}return rt.default=t,rt}var _n;function yn(){if(_n)return oe;_n=1;var C=oe&&oe.__spreadArrays||function(){for(var m=0,u=0,b=arguments.length;u<b;u++)m+=arguments[u].length;for(var r=Array(m),e=0,u=0;u<b;u++)for(var i=arguments[u],o=0,a=i.length;o<a;o++,e++)r[e]=i[o];return r};Object.defineProperty(oe,"__esModule",{value:!0}),oe.getRTCIceCandidateStatsReport=oe.getRTCStats=void 0;var n=z(),t=Ur(),c="PeerConnection is null",l="WebRTC statistics are unsupported";function g(m,u){return typeof m.get=="function"?m.get(u):m.find(function(b){return b.id===u})}function y(m){if(!m)return Promise.reject(new n.InvalidArgumentError(c));if(typeof m.getStats!="function")return Promise.reject(new n.NotSupportedError(l));var u;try{u=m.getStats()}catch{u=new Promise(function(r){return m.getStats(r)}).then(t.default.fromRTCStatsResponse)}return u}function _(m,u){return u=Object.assign({createRTCSample:S},u),y(m).then(u.createRTCSample)}oe.getRTCStats=_;function E(m){return y(m).then(function(u){var b=Array.from(u.values()).reduce(function(d,s){switch(["candidatePairs","localCandidates","remoteCandidates"].forEach(function(h){d[h]||(d[h]=[])}),s.type){case"candidate-pair":d.candidatePairs.push(s);break;case"local-candidate":d.localCandidates.push(s);break;case"remote-candidate":d.remoteCandidates.push(s);break;case"transport":s.selectedCandidatePairId&&(d.transport=s);break}return d},{}),r=b.candidatePairs,e=b.localCandidates,i=b.remoteCandidates,o=b.transport,a=r.find(function(d){return d.selected||o&&d.id===o.selectedCandidatePairId}),f;return a&&(f={localCandidate:e.find(function(d){return d.id===a.localCandidateId}),remoteCandidate:i.find(function(d){return d.id===a.remoteCandidateId})}),{iceCandidateStats:C(e,i),selectedIceCandidatePairStats:f}})}oe.getRTCIceCandidateStatsReport=E;function w(){}function S(m){var u=null,b=new w,r;Array.from(m.values()).forEach(function(f){if(!f.isRemote){var d=f.type.replace("-","");if(r=r||f.timestamp,f.remoteId){var s=g(m,f.remoteId);s&&s.roundTripTime&&(b.rtt=s.roundTripTime*1e3)}switch(d){case"inboundrtp":b.timestamp=b.timestamp||f.timestamp,b.jitter=f.jitter*1e3,b.packetsLost=f.packetsLost,b.packetsReceived=f.packetsReceived,b.bytesReceived=f.bytesReceived;break;case"outboundrtp":if(b.timestamp=f.timestamp,b.packetsSent=f.packetsSent,b.bytesSent=f.bytesSent,f.codecId){var h=g(m,f.codecId);b.codecName=h?h.mimeType&&h.mimeType.match(/(.*\/)?(.*)/)[2]:f.codecId}break;case"transport":u=f.id;break}}}),b.timestamp||(b.timestamp=r);var e=g(m,u);if(!e)return b;var i=g(m,e.selectedCandidatePairId);if(!i)return b;var o=g(m,i.localCandidateId),a=g(m,i.remoteCandidateId);return b.rtt||(b.rtt=i&&i.currentRoundTripTime*1e3),Object.assign(b,{localAddress:o&&(o.address||o.ip),remoteAddress:a&&(a.address||a.ip)}),b}return oe}var bn;function Sn(){return bn||(bn=1,function(C){var n=ee&&ee.__extends||function(){var b=function(r,e){return b=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,o){i.__proto__=o}||function(i,o){for(var a in o)Object.prototype.hasOwnProperty.call(o,a)&&(i[a]=o[a])},b(r,e)};return function(r,e){b(r,e);function i(){this.constructor=r}r.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}(),t=ee&&ee.__assign||function(){return t=Object.assign||function(b){for(var r,e=1,i=arguments.length;e<i;e++){r=arguments[e];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(b[o]=r[o])}return b},t.apply(this,arguments)},c=ee&&ee.__awaiter||function(b,r,e,i){function o(a){return a instanceof e?a:new e(function(f){f(a)})}return new(e||(e=Promise))(function(a,f){function d(I){try{h(i.next(I))}catch(v){f(v)}}function s(I){try{h(i.throw(I))}catch(v){f(v)}}function h(I){I.done?a(I.value):o(I.value).then(d,s)}h((i=i.apply(b,r||[])).next())})},l=ee&&ee.__generator||function(b,r){var e={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},i,o,a,f;return f={next:d(0),throw:d(1),return:d(2)},typeof Symbol=="function"&&(f[Symbol.iterator]=function(){return this}),f;function d(h){return function(I){return s([h,I])}}function s(h){if(i)throw new TypeError("Generator is already executing.");for(;e;)try{if(i=1,o&&(a=h[0]&2?o.return:h[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,h[1])).done)return a;switch(o=0,a&&(h=[h[0]&2,a.value]),h[0]){case 0:case 1:a=h;break;case 4:return e.label++,{value:h[1],done:!1};case 5:e.label++,o=h[1],h=[0];continue;case 7:h=e.ops.pop(),e.trys.pop();continue;default:if(a=e.trys,!(a=a.length>0&&a[a.length-1])&&(h[0]===6||h[0]===2)){e=0;continue}if(h[0]===3&&(!a||h[1]>a[0]&&h[1]<a[3])){e.label=h[1];break}if(h[0]===6&&e.label<a[1]){e.label=a[1],a=h;break}if(a&&e.label<a[2]){e.label=a[2],e.ops.push(h);break}a[2]&&e.ops.pop(),e.trys.pop();continue}h=r.call(b,e)}catch(I){h=[6,I],o=0}finally{i=a=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}};Object.defineProperty(C,"__esModule",{value:!0}),C.PreflightTest=void 0;var g=Z(),y=Rt(),_=lt(),E=z(),w=X(),S=yn(),m=Re(),u=function(b){n(r,b);function r(e,i){var o=b.call(this)||this;o._hasInsightsErrored=!1,o._log=new w.default("PreflightTest"),o._networkTiming={},o._options={codecPreferences:[y.default.Codec.PCMU,y.default.Codec.Opus],edge:"roaming",fakeMicInput:!1,logLevel:"error",signalingTimeoutMs:1e4},o._status=r.Status.Connecting,Object.assign(o._options,i),o._samples=[],o._warnings=[],o._startTime=Date.now(),o._initDevice(e,t(t({},o._options),{fileInputStream:o._options.fakeMicInput?o._getStreamFromFile():void 0}));var a=["codecPreferences","edge","fakeMicInput","logLevel","signalingTimeoutMs"],f=["audioContext","deviceFactory","fileInputStream","getRTCIceCandidateStatsReport","iceServers","rtcConfiguration"];if(typeof i=="object"){var d=t({},i);Object.keys(d).forEach(function(s){!a.includes(s)&&!f.includes(s)&&delete d[s],f.includes(s)&&(d[s]=!0)}),o._log.debug(".constructor",JSON.stringify(d))}return o}return r.prototype.stop=function(){var e=this;this._log.debug(".stop");var i=new E.GeneralErrors.CallCancelledError;this._device?(this._device.once(_.default.EventName.Unregistered,function(){return e._onFailed(i)}),this._device.destroy()):this._onFailed(i)},r.prototype._emitWarning=function(e,i,o){var a={name:e,description:i};o&&(a.rtcWarning=o),this._warnings.push(a),this._log.debug("#"+r.Events.Warning,JSON.stringify(a)),this.emit(r.Events.Warning,a)},r.prototype._getCallQuality=function(e){return e>4.2?r.CallQuality.Excellent:e>=4.1&&e<=4.2?r.CallQuality.Great:e>=3.7&&e<=4?r.CallQuality.Good:e>=3.1&&e<=3.6?r.CallQuality.Fair:r.CallQuality.Degraded},r.prototype._getReport=function(){var e,i,o,a=this._getRTCStats(),f={start:this._startTime};this._endTime&&(f.end=this._endTime,f.duration=this._endTime-this._startTime);var d={callSid:this._callSid,edge:this._edge,iceCandidateStats:(i=(e=this._rtcIceCandidateStatsReport)===null||e===void 0?void 0:e.iceCandidateStats)!==null&&i!==void 0?i:[],networkTiming:this._networkTiming,samples:this._samples,selectedEdge:this._options.edge,stats:a,testTiming:f,totals:this._getRTCSampleTotals(),warnings:this._warnings},s=(o=this._rtcIceCandidateStatsReport)===null||o===void 0?void 0:o.selectedIceCandidatePairStats;return s&&(d.selectedIceCandidatePairStats=s,d.isTurnRequired=s.localCandidate.candidateType==="relay"||s.remoteCandidate.candidateType==="relay"),a&&(d.callQuality=this._getCallQuality(a.mos.average)),d},r.prototype._getRTCSampleTotals=function(){if(this._latestSample)return t({},this._latestSample.totals)},r.prototype._getRTCStats=function(){var e=this._samples.findIndex(function(o){return typeof o.mos=="number"&&o.mos>0}),i=e>=0?this._samples.slice(e):[];if(!(!i||!i.length))return["jitter","mos","rtt"].reduce(function(o,a){var f,d=i.map(function(s){return s[a]});return t(t({},o),(f={},f[a]={average:Number((d.reduce(function(s,h){return s+h})/d.length).toPrecision(5)),max:Math.max.apply(Math,d),min:Math.min.apply(Math,d)},f))},{})},r.prototype._getStreamFromFile=function(){var e=this._options.audioContext;if(!e)throw new E.NotSupportedError("Cannot fake input audio stream: AudioContext is not supported by this browser.");var i=new Audio(m.COWBELL_AUDIO_URL);i.addEventListener("canplaythrough",function(){return i.play()}),typeof i.setAttribute=="function"&&i.setAttribute("crossorigin","anonymous");var o=e.createMediaElementSource(i),a=e.createMediaStreamDestination();return o.connect(a),a.stream},r.prototype._initDevice=function(e,i){var o=this;try{this._device=new(i.deviceFactory||_.default)(e,{chunderw:i.chunderw,codecPreferences:i.codecPreferences,edge:i.edge,eventgw:i.eventgw,fileInputStream:i.fileInputStream,logLevel:i.logLevel,preflight:!0}),this._device.once(_.default.EventName.Registered,function(){o._onDeviceRegistered()}),this._device.once(_.default.EventName.Error,function(a){o._onDeviceError(a)}),this._device.register()}catch(a){setTimeout(function(){o._onFailed(a)});return}this._signalingTimeoutTimer=setTimeout(function(){o._onDeviceError(new E.SignalingErrors.ConnectionError("WebSocket Connection Timeout"))},i.signalingTimeoutMs)},r.prototype._onDeviceError=function(e){this._device.destroy(),this._onFailed(e)},r.prototype._onDeviceRegistered=function(){return c(this,void 0,void 0,function(){var e,i,o,a=this;return l(this,function(f){switch(f.label){case 0:return clearTimeout(this._echoTimer),clearTimeout(this._signalingTimeoutTimer),e=this,[4,this._device.connect({rtcConfiguration:this._options.rtcConfiguration})];case 1:return e._call=f.sent(),this._networkTiming.signaling={start:Date.now()},this._setupCallHandlers(this._call),this._edge=this._device.edge||void 0,this._options.fakeMicInput&&(this._echoTimer=setTimeout(function(){return a._device.disconnectAll()},m.ECHO_TEST_DURATION),i=this._device.audio,i&&(i.disconnect(!1),i.outgoing(!1))),this._call.once("disconnect",function(){a._device.once(_.default.EventName.Unregistered,function(){return a._onUnregistered()}),a._device.destroy()}),o=this._call._publisher,o.on("error",function(){a._hasInsightsErrored||a._emitWarning("insights-connection-error","Received an error when attempting to connect to Insights gateway"),a._hasInsightsErrored=!0}),[2]}})})},r.prototype._onFailed=function(e){clearTimeout(this._echoTimer),clearTimeout(this._signalingTimeoutTimer),this._releaseHandlers(),this._endTime=Date.now(),this._status=r.Status.Failed,this._log.debug("#"+r.Events.Failed,e),this.emit(r.Events.Failed,e)},r.prototype._onUnregistered=function(){var e=this;setTimeout(function(){e._status!==r.Status.Failed&&(clearTimeout(e._echoTimer),clearTimeout(e._signalingTimeoutTimer),e._releaseHandlers(),e._endTime=Date.now(),e._status=r.Status.Completed,e._report=e._getReport(),e._log.debug("#"+r.Events.Completed,JSON.stringify(e._report)),e.emit(r.Events.Completed,e._report))},10)},r.prototype._releaseHandlers=function(){[this._device,this._call].forEach(function(e){e&&e.eventNames().forEach(function(i){return e.removeAllListeners(i)})})},r.prototype._setupCallHandlers=function(e){var i=this;this._options.fakeMicInput&&e.once("volume",function(){e._mediaHandler.outputs.forEach(function(o){return o.audio.muted=!0})}),e.on("warning",function(o,a){i._emitWarning(o,"Received an RTCWarning. See .rtcWarning for the RTCWarning",a)}),e.once("accept",function(){i._callSid=e._mediaHandler.callSid,i._status=r.Status.Connected,i._log.debug("#"+r.Events.Connected),i.emit(r.Events.Connected)}),e.on("sample",function(o){return c(i,void 0,void 0,function(){var a;return l(this,function(f){switch(f.label){case 0:return this._latestSample?[3,2]:(a=this,[4,(this._options.getRTCIceCandidateStatsReport||S.getRTCIceCandidateStatsReport)(e._mediaHandler.version.pc)]);case 1:a._rtcIceCandidateStatsReport=f.sent(),f.label=2;case 2:return this._latestSample=o,this._samples.push(o),this._log.debug("#"+r.Events.Sample,JSON.stringify(o)),this.emit(r.Events.Sample,o),[2]}})})}),[{reportLabel:"peerConnection",type:"pcconnection"},{reportLabel:"ice",type:"iceconnection"},{reportLabel:"dtls",type:"dtlstransport"},{reportLabel:"signaling",type:"signaling"}].forEach(function(o){var a=o.type,f=o.reportLabel,d="on"+a+"statechange",s=e._mediaHandler[d];e._mediaHandler[d]=function(h){var I=i._networkTiming[f]=i._networkTiming[f]||{start:0};h==="connecting"||h==="checking"?I.start=Date.now():(h==="connected"||h==="stable")&&!I.duration&&(I.end=Date.now(),I.duration=I.end-I.start),s(h)}})},Object.defineProperty(r.prototype,"callSid",{get:function(){return this._callSid},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"endTime",{get:function(){return this._endTime},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"latestSample",{get:function(){return this._latestSample},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"report",{get:function(){return this._report},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"startTime",{get:function(){return this._startTime},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"status",{get:function(){return this._status},enumerable:!1,configurable:!0}),r}(g.EventEmitter);C.PreflightTest=u,function(b){(function(r){r.Excellent="excellent",r.Great="great",r.Good="good",r.Fair="fair",r.Degraded="degraded"})(b.CallQuality||(b.CallQuality={})),function(r){r.Completed="completed",r.Connected="connected",r.Failed="failed",r.Sample="sample",r.Warning="warning"}(b.Events||(b.Events={})),function(r){r.Connecting="connecting",r.Connected="connected",r.Completed="completed",r.Failed="failed"}(b.Status||(b.Status={}))}(u=C.PreflightTest||(C.PreflightTest={})),C.PreflightTest=u}(ee)),ee}var De={},Se={},Cn;function Nr(){return Cn||(Cn=1,function(C){var n=Se&&Se.__extends||function(){var o=function(a,f){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,s){d.__proto__=s}||function(d,s){for(var h in s)Object.prototype.hasOwnProperty.call(s,h)&&(d[h]=s[h])},o(a,f)};return function(a,f){o(a,f);function d(){this.constructor=a}a.prototype=f===null?Object.create(f):(d.prototype=f.prototype,new d)}}(),t=Se&&Se.__assign||function(){return t=Object.assign||function(o){for(var a,f=1,d=arguments.length;f<d;f++){a=arguments[f];for(var s in a)Object.prototype.hasOwnProperty.call(a,s)&&(o[s]=a[s])}return o},t.apply(this,arguments)};Object.defineProperty(C,"__esModule",{value:!0}),C.WSTransportState=void 0;var c=Z(),l=en(),g=z(),y=X(),_=globalThis.WebSocket,E=1e4,w=5e3,S=15e3,m=15e3,u=1/0,b=1e3,r=2e4,e;(function(o){o.Connecting="connecting",o.Closed="closed",o.Open="open"})(e=C.WSTransportState||(C.WSTransportState={}));var i=function(o){n(a,o);function a(f,d){d===void 0&&(d={});var s=o.call(this)||this;return s.state=e.Closed,s._backoffStartTime={preferred:null,primary:null},s._connectedUri=null,s._log=new y.default("WSTransport"),s._shouldFallback=!1,s._uriIndex=0,s._moveUriIndex=function(){s._uriIndex++,s._uriIndex>=s._uris.length&&(s._uriIndex=0)},s._onSocketClose=function(h){if(s._log.error("Received websocket close event code: "+h.code+". Reason: "+h.reason),h.code===1006||h.code===1015){s.emit("error",{code:31005,message:h.reason||"Websocket connection to Twilio's signaling servers were unexpectedly ended. If this is happening consistently, there may be an issue resolving the hostname provided. If a region or an edge is being specified in Device setup, ensure it is valid.",twilioError:new g.SignalingErrors.ConnectionError});var I=s.state===e.Open||s._previousState===e.Open;(s._shouldFallback||!I)&&s._moveUriIndex(),s._shouldFallback=!0}s._closeSocket()},s._onSocketError=function(h){s._log.error("WebSocket received error: "+h.message),s.emit("error",{code:31e3,message:h.message||"WSTransport socket error",twilioError:new g.SignalingErrors.ConnectionDisconnected})},s._onSocketMessage=function(h){if(s._setHeartbeatTimeout(),s._socket&&h.data===`
|
|
189
195
|
`){s._socket.send(`
|
|
190
196
|
`),s._log.debug("heartbeat");return}h&&typeof h.data=="string"&&s._log.debug("Received: "+h.data),s.emit("message",h)},s._onSocketOpen=function(){s._log.info("WebSocket opened successfully."),s._timeOpened=Date.now(),s._shouldFallback=!1,s._setState(e.Open),clearTimeout(s._connectTimeout),s._resetBackoffs(),s._setHeartbeatTimeout(),s.emit("open")},s._options=t(t({},a.defaultConstructorOptions),d),s._uris=f,s._backoff=s._setupBackoffs(),s}return a.prototype.close=function(){this._log.info("WSTransport.close() called..."),this._close()},a.prototype.open=function(){if(this._log.info("WSTransport.open() called..."),this._socket&&(this._socket.readyState===_.CONNECTING||this._socket.readyState===_.OPEN)){this._log.info("WebSocket already open.");return}this._preferredUri?this._connect(this._preferredUri):this._connect(this._uris[this._uriIndex])},a.prototype.send=function(f){if(this._log.debug("Sending: "+f),!this._socket||this._socket.readyState!==_.OPEN)return this._log.debug("Cannot send message. WebSocket is not open."),!1;try{this._socket.send(f)}catch(d){return this._log.error("Error while sending message:",d.message),this._closeSocket(),!1}return!0},a.prototype.updatePreferredURI=function(f){this._preferredUri=f},a.prototype.updateURIs=function(f){typeof f=="string"&&(f=[f]),this._uris=f,this._uriIndex=0},a.prototype._close=function(){this._setState(e.Closed),this._closeSocket()},a.prototype._closeSocket=function(){if(clearTimeout(this._connectTimeout),clearTimeout(this._heartbeatTimeout),this._log.info("Closing and cleaning up WebSocket..."),!this._socket){this._log.info("No WebSocket to clean up.");return}this._socket.removeEventListener("close",this._onSocketClose),this._socket.removeEventListener("error",this._onSocketError),this._socket.removeEventListener("message",this._onSocketMessage),this._socket.removeEventListener("open",this._onSocketOpen),(this._socket.readyState===_.CONNECTING||this._socket.readyState===_.OPEN)&&this._socket.close(),this._timeOpened&&Date.now()-this._timeOpened>E&&this._resetBackoffs(),this.state!==e.Closed&&this._performBackoff(),delete this._socket,this.emit("close")},a.prototype._connect=function(f,d){var s=this;this._log.info(typeof d=="number"?"Attempting to reconnect (retry #"+d+")...":"Attempting to connect..."),this._closeSocket(),this._setState(e.Connecting),this._connectedUri=f;try{this._socket=new this._options.WebSocket(this._connectedUri)}catch(h){this._log.error("Could not connect to endpoint:",h.message),this._close(),this.emit("error",{code:31e3,message:h.message||"Could not connect to "+this._connectedUri,twilioError:new g.SignalingErrors.ConnectionDisconnected});return}this._socket.addEventListener("close",this._onSocketClose),this._socket.addEventListener("error",this._onSocketError),this._socket.addEventListener("message",this._onSocketMessage),this._socket.addEventListener("open",this._onSocketOpen),delete this._timeOpened,this._connectTimeout=setTimeout(function(){s._log.info("WebSocket connection attempt timed out."),s._moveUriIndex(),s._closeSocket()},this._options.connectTimeoutMs)},a.prototype._performBackoff=function(){this._preferredUri?(this._log.info("Preferred URI set; backing off."),this._backoff.preferred.backoff()):(this._log.info("Preferred URI not set; backing off."),this._backoff.primary.backoff())},a.prototype._resetBackoffs=function(){this._backoff.preferred.reset(),this._backoff.primary.reset(),this._backoffStartTime.preferred=null,this._backoffStartTime.primary=null},a.prototype._setHeartbeatTimeout=function(){var f=this;clearTimeout(this._heartbeatTimeout),this._heartbeatTimeout=setTimeout(function(){f._log.info("No messages received in "+S/1e3+" seconds. Reconnecting..."),f._shouldFallback=!0,f._closeSocket()},S)},a.prototype._setState=function(f){this._previousState=this.state,this.state=f},a.prototype._setupBackoffs=function(){var f=this,d={factor:2,jitter:.4,max:this._options.maxPreferredDelayMs,min:100};this._log.info("Initializing preferred transport backoff using config: ",d);var s=new l.default(d);s.on("backoff",function(v,O){if(f.state===e.Closed){f._log.info("Preferred backoff initiated but transport state is closed; not attempting a connection.");return}f._log.info("Will attempt to reconnect Websocket to preferred URI in "+O+"ms"),v===0&&(f._backoffStartTime.preferred=Date.now(),f._log.info("Preferred backoff start; "+f._backoffStartTime.preferred))}),s.on("ready",function(v,O){if(f.state===e.Closed){f._log.info("Preferred backoff ready but transport state is closed; not attempting a connection.");return}if(f._backoffStartTime.preferred===null){f._log.info("Preferred backoff start time invalid; not attempting a connection.");return}if(Date.now()-f._backoffStartTime.preferred>f._options.maxPreferredDurationMs){f._log.info("Max preferred backoff attempt time exceeded; falling back to primary backoff."),f._preferredUri=null,f._backoff.primary.backoff();return}if(typeof f._preferredUri!="string"){f._log.info("Preferred URI cleared; falling back to primary backoff."),f._preferredUri=null,f._backoff.primary.backoff();return}f._connect(f._preferredUri,v+1)});var h={factor:2,jitter:.4,max:this._options.maxPrimaryDelayMs,min:this._uris&&this._uris.length>1?Math.floor(Math.random()*4001)+1e3:100};this._log.info("Initializing primary transport backoff using config: ",h);var I=new l.default(h);return I.on("backoff",function(v,O){if(f.state===e.Closed){f._log.info("Primary backoff initiated but transport state is closed; not attempting a connection.");return}f._log.info("Will attempt to reconnect WebSocket in "+O+"ms"),v===0&&(f._backoffStartTime.primary=Date.now(),f._log.info("Primary backoff start; "+f._backoffStartTime.primary))}),I.on("ready",function(v,O){if(f.state===e.Closed){f._log.info("Primary backoff ready but transport state is closed; not attempting a connection.");return}if(f._backoffStartTime.primary===null){f._log.info("Primary backoff start time invalid; not attempting a connection.");return}if(Date.now()-f._backoffStartTime.primary>f._options.maxPrimaryDurationMs){f._log.info("Max primary backoff attempt time exceeded; not attempting a connection.");return}f._connect(f._uris[f._uriIndex],v+1)}),{preferred:s,primary:I}},Object.defineProperty(a.prototype,"uri",{get:function(){return this._connectedUri},enumerable:!1,configurable:!0}),a.defaultConstructorOptions={WebSocket:_,connectTimeoutMs:w,maxPreferredDelayMs:b,maxPreferredDurationMs:m,maxPrimaryDelayMs:r,maxPrimaryDurationMs:u},a}(c.EventEmitter);C.default=i}(Se)),Se}var wn;function Fr(){if(wn)return De;wn=1;var C=De&&De.__extends||function(){var S=function(m,u){return S=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(b,r){b.__proto__=r}||function(b,r){for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(b[e]=r[e])},S(m,u)};return function(m,u){S(m,u);function b(){this.constructor=m}m.prototype=u===null?Object.create(u):(b.prototype=u.prototype,new b)}}();Object.defineProperty(De,"__esModule",{value:!0});var n=Z(),t=Re(),c=z(),l=X(),g=Nr(),y="1.6",_=30,E=function(S){C(m,S);function m(u,b,r){var e=S.call(this)||this;if(!(e instanceof m))return new m(u,b,r);var i={TransportFactory:g.default};r=r||{};for(var o in i)o in r||(r[o]=i[o]);e.options=r,e.token=u||"",e.status="disconnected",e.gateway=null,e.region=null,e._messageQueue=[],e._preferredUri=null,e._uris=b,e._handleTransportClose=e._handleTransportClose.bind(e),e._handleTransportError=e._handleTransportError.bind(e),e._handleTransportMessage=e._handleTransportMessage.bind(e),e._handleTransportOpen=e._handleTransportOpen.bind(e),e._log=new l.default("PStream"),e.on("error",function(){e._log.warn("Unexpected error handled in pstream")});var a=e;return e.addListener("ready",function(){a.status="ready"}),e.addListener("offline",function(){a.status="offline"}),e.addListener("close",function(){a._log.info('Received "close" from server. Destroying PStream...'),a._destroy()}),e.transport=new e.options.TransportFactory(e._uris,{backoffMaxMs:e.options.backoffMaxMs,maxPreferredDurationMs:e.options.maxPreferredDurationMs}),Object.defineProperties(e,{uri:{enumerable:!0,get:function(){return this.transport.uri}}}),e.transport.on("close",e._handleTransportClose),e.transport.on("error",e._handleTransportError),e.transport.on("message",e._handleTransportMessage),e.transport.on("open",e._handleTransportOpen),e.transport.open(),e}return m}(n.EventEmitter);E.prototype._handleTransportClose=function(){this.emit("transportClose"),this.status!=="disconnected"&&(this.status!=="offline"&&this.emit("offline",this),this.status="disconnected")},E.prototype._handleTransportError=function(S){if(!S){this.emit("error",{error:{code:31e3,message:"Websocket closed without a provided reason",twilioError:new c.SignalingErrors.ConnectionDisconnected}});return}this.emit("error",typeof S.code<"u"?{error:S}:S)},E.prototype._handleTransportMessage=function(S){if(!(!S||!S.data||typeof S.data!="string")){var m=JSON.parse(S.data),u=m.type,b=m.payload,r=b===void 0?{}:b;this.gateway=r.gateway||this.gateway,this.region=r.region||this.region,u==="error"&&r.error&&(r.error.twilioError=new c.SignalingErrors.ConnectionError),this.emit(u,r)}},E.prototype._handleTransportOpen=function(){var S=this;this.status="connected",this.setToken(this.token),this.emit("transportOpen");var m=this._messageQueue.splice(0,this._messageQueue.length);m.forEach(function(u){return S._publish.apply(S,u)})},E.toString=function(){return"[Twilio.PStream class]"},E.prototype.toString=function(){return"[Twilio.PStream instance]"},E.prototype.setToken=function(S){this._log.info("Setting token and publishing listen"),this.token=S;var m=0,u=this.options.maxPreferredDurationMs;this._log.info("maxPreferredDurationMs:"+u),typeof u=="number"&&u>=0&&(m=Math.min(Math.ceil(u/1e3),_)),this._log.info("reconnectTimeout:"+m);var b={browserinfo:w(),reconnectTimeout:m,token:S};this._publish("listen",b)},E.prototype.sendMessage=function(S,m,u,b,r){u===void 0&&(u="application/json");var e={callsid:S,content:m,contenttype:u,messagetype:b,voiceeventsid:r};this._publish("message",e,!0)},E.prototype.register=function(S){var m={media:S};this._publish("register",m,!0)},E.prototype.invite=function(S,m,u){var b={callsid:m,sdp:S,twilio:u?{params:u}:{}};this._publish("invite",b,!0)},E.prototype.reconnect=function(S,m,u){var b={callsid:m,reconnect:u,sdp:S,twilio:{}};this._publish("invite",b,!0)},E.prototype.answer=function(S,m){this._publish("answer",{sdp:S,callsid:m},!0)},E.prototype.dtmf=function(S,m){this._publish("dtmf",{callsid:S,dtmf:m},!0)},E.prototype.hangup=function(S,m){var u=m?{callsid:S,message:m}:{callsid:S};this._publish("hangup",u,!0)},E.prototype.reject=function(S){this._publish("reject",{callsid:S},!0)},E.prototype.reinvite=function(S,m){this._publish("reinvite",{sdp:S,callsid:m},!1)},E.prototype._destroy=function(){this.transport.removeListener("close",this._handleTransportClose),this.transport.removeListener("error",this._handleTransportError),this.transport.removeListener("message",this._handleTransportMessage),this.transport.removeListener("open",this._handleTransportOpen),this.transport.close(),this.emit("offline",this)},E.prototype.destroy=function(){return this._log.info("PStream.destroy() called..."),this._destroy(),this},E.prototype.updatePreferredURI=function(S){this._preferredUri=S,this.transport.updatePreferredURI(S)},E.prototype.updateURIs=function(S){this._uris=S,this.transport.updateURIs(this._uris)},E.prototype.publish=function(S,m){return this._publish(S,m,!0)},E.prototype._publish=function(S,m,u){var b=JSON.stringify({payload:m,type:S,version:y}),r=!!this.transport.send(b);r||(this.emit("error",{error:{code:31009,message:"No transport available to send or receive messages",twilioError:new c.GeneralErrors.TransportError}}),u&&this._messageQueue.push([S,m,!0]))};function w(){var S=typeof navigator<"u"?navigator:{},m={browser:{platform:S.platform||"unknown",userAgent:S.userAgent||"unknown"},p:"browser",plugin:"rtc",v:t.RELEASE_VERSION};return m}return De.default=E,De}var Ct={},En;function $r(){return En||(En=1,function(C){var n;Object.defineProperty(C,"__esModule",{value:!0}),C.getRegionShortcode=C.getChunderURIs=C.createSignalingEndpointURL=C.createEventGatewayURI=C.defaultEdge=C.regionToEdge=C.regionShortcodes=C.Region=C.Edge=void 0;var t=z(),c;(function(m){m.Sydney="sydney",m.SaoPaulo="sao-paulo",m.Dublin="dublin",m.Frankfurt="frankfurt",m.Tokyo="tokyo",m.Singapore="singapore",m.Ashburn="ashburn",m.Umatilla="umatilla",m.Roaming="roaming",m.AshburnIx="ashburn-ix",m.SanJoseIx="san-jose-ix",m.LondonIx="london-ix",m.FrankfurtIx="frankfurt-ix",m.SingaporeIx="singapore-ix",m.SydneyIx="sydney-ix",m.TokyoIx="tokyo-ix"})(c=C.Edge||(C.Edge={}));var l;(function(m){m.Au1="au1",m.Au1Ix="au1-ix",m.Br1="br1",m.De1="de1",m.De1Ix="de1-ix",m.Gll="gll",m.Ie1="ie1",m.Ie1Ix="ie1-ix",m.Ie1Tnx="ie1-tnx",m.Jp1="jp1",m.Jp1Ix="jp1-ix",m.Sg1="sg1",m.Sg1Ix="sg1-ix",m.Sg1Tnx="sg1-tnx",m.Us1="us1",m.Us1Ix="us1-ix",m.Us1Tnx="us1-tnx",m.Us2="us2",m.Us2Ix="us2-ix",m.Us2Tnx="us2-tnx"})(l=C.Region||(C.Region={})),C.regionShortcodes={ASIAPAC_SINGAPORE:l.Sg1,ASIAPAC_SYDNEY:l.Au1,ASIAPAC_TOKYO:l.Jp1,EU_FRANKFURT:l.De1,EU_IRELAND:l.Ie1,SOUTH_AMERICA_SAO_PAULO:l.Br1,US_EAST_VIRGINIA:l.Us1,US_WEST_OREGON:l.Us2},C.regionToEdge=(n={},n[l.Au1]=c.Sydney,n[l.Br1]=c.SaoPaulo,n[l.Ie1]=c.Dublin,n[l.De1]=c.Frankfurt,n[l.Jp1]=c.Tokyo,n[l.Sg1]=c.Singapore,n[l.Us1]=c.Ashburn,n[l.Us2]=c.Umatilla,n[l.Gll]=c.Roaming,n[l.Us1Ix]=c.AshburnIx,n[l.Us2Ix]=c.SanJoseIx,n[l.Ie1Ix]=c.LondonIx,n[l.De1Ix]=c.FrankfurtIx,n[l.Sg1Ix]=c.SingaporeIx,n[l.Au1Ix]=c.SydneyIx,n[l.Jp1Ix]=c.TokyoIx,n[l.Us1Tnx]=c.AshburnIx,n[l.Us2Tnx]=c.AshburnIx,n[l.Ie1Tnx]=c.LondonIx,n[l.Sg1Tnx]=c.SingaporeIx,n),C.defaultEdge=c.Roaming;var g="eventgw.twilio.com";function y(m){return"voice-js."+m+".twilio.com"}function _(m){return m?"eventgw."+m+".twilio.com":g}C.createEventGatewayURI=_;function E(m){return"wss://"+m+"/signal"}C.createSignalingEndpointURL=E;function w(m){if(m&&typeof m!="string"&&!Array.isArray(m))throw new t.InvalidArgumentError("If `edge` is provided, it must be of type `string` or an array of strings.");var u;if(m){var b=Array.isArray(m)?m:[m];u=b.map(function(r){return y(r)})}else u=[y(C.defaultEdge)];return u}C.getChunderURIs=w;function S(m){return C.regionShortcodes[m]||null}C.getRegionShortcode=S}(Ct)),Ct}var ae={},it={},ot={},te={},Tn;function wt(){if(Tn)return te;Tn=1,Object.defineProperty(te,"__esModule",{value:!0}),te.setMaxAverageBitrate=te.setIceAggressiveNomination=te.setCodecPreferences=te.getPreferredCodecInfo=void 0;var C=he(),n={0:"PCMU",8:"PCMA"},t=111,c=51e4,l=6e3;function g(e){var i=/a=rtpmap:(\d+) (\S+)/m.exec(e)||[null,"",""],o=i[1],a=i[2],f=new RegExp("a=fmtp:"+o+" (\\S+)","m"),d=f.exec(e)||[null,""],s=d[1];return{codecName:a,codecParams:s}}te.getPreferredCodecInfo=g;function y(e){return C.isChrome(window,window.navigator)?e.split(`
|