@raghuraj-singh/swift-link 1.0.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.
- package/README.md +50 -0
- package/dist/ringtone.mp3 +0 -0
- package/dist/swift-link.css +1 -0
- package/dist/swift-link.es.js +6954 -0
- package/dist/swift-link.umd.js +162 -0
- package/package.json +44 -0
@@ -0,0 +1,162 @@
|
|
1
|
+
(function(ve,re){typeof exports=="object"&&typeof module<"u"?re(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],re):(ve=typeof globalThis<"u"?globalThis:ve||self,re(ve.SwiftLink={},ve.React))})(this,function(ve,re){"use strict";function Mr(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}function Dr(n,e){for(var t=0;t<e.length;t++){const r=e[t];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in n)){const o=Object.getOwnPropertyDescriptor(r,i);o&&Object.defineProperty(n,i,o.get?o:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}const de=Mr(re);(function(n){if(typeof ve=="object"&&typeof module<"u")module.exports=n();else if(typeof define=="function"&&define.amd)define([],n);else{var e;typeof window<"u"?e=window:typeof global<"u"?e=global:typeof self<"u"?e=self:e=this,e.adapter=n()}})(function(){return function(){function n(e,t,r){function i(c,f){if(!t[c]){if(!e[c]){var d=typeof require=="function"&&require;if(!f&&d)return d(c,!0);if(o)return o(c,!0);var v=new Error("Cannot find module '"+c+"'");throw v.code="MODULE_NOT_FOUND",v}var R=t[c]={exports:{}};e[c][0].call(R.exports,function(D){var N=e[c][1][D];return i(N||D)},R,R.exports,n,e,t,r)}return t[c].exports}for(var o=typeof require=="function"&&require,s=0;s<r.length;s++)i(r[s]);return i}return n}()({1:[function(n,e,t){var r=n("./adapter_factory.js"),i=(0,r.adapterFactory)({window:typeof window>"u"?void 0:window});e.exports=i},{"./adapter_factory.js":2}],2:[function(n,e,t){function r(N){"@babel/helpers - typeof";return r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(M){return typeof M}:function(M){return M&&typeof Symbol=="function"&&M.constructor===Symbol&&M!==Symbol.prototype?"symbol":typeof M},r(N)}Object.defineProperty(t,"__esModule",{value:!0}),t.adapterFactory=D;var i=R(n("./utils")),o=R(n("./chrome/chrome_shim")),s=R(n("./firefox/firefox_shim")),c=R(n("./safari/safari_shim")),f=R(n("./common_shim")),d=R(n("sdp"));function v(N){if(typeof WeakMap!="function")return null;var M=new WeakMap,H=new WeakMap;return(v=function(y){return y?H:M})(N)}function R(N,M){if(N&&N.__esModule)return N;if(N===null||r(N)!="object"&&typeof N!="function")return{default:N};var H=v(M);if(H&&H.has(N))return H.get(N);var O={__proto__:null},y=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var P in N)if(P!=="default"&&{}.hasOwnProperty.call(N,P)){var m=y?Object.getOwnPropertyDescriptor(N,P):null;m&&(m.get||m.set)?Object.defineProperty(O,P,m):O[P]=N[P]}return O.default=N,H&&H.set(N,O),O}function D(){var N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},M=N.window,H=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimSafari:!0},O=i.log,y=i.detectBrowser(M),P={browserDetails:y,commonShim:f,extractVersion:i.extractVersion,disableLog:i.disableLog,disableWarnings:i.disableWarnings,sdp:d};switch(y.browser){case"chrome":if(!o||!o.shimPeerConnection||!H.shimChrome)return O("Chrome shim is not included in this adapter release."),P;if(y.version===null)return O("Chrome shim can not determine version, not shimming."),P;O("adapter.js shimming chrome."),P.browserShim=o,f.shimAddIceCandidateNullOrEmpty(M,y),f.shimParameterlessSetLocalDescription(M,y),o.shimGetUserMedia(M,y),o.shimMediaStream(M,y),o.shimPeerConnection(M,y),o.shimOnTrack(M,y),o.shimAddTrackRemoveTrack(M,y),o.shimGetSendersWithDtmf(M,y),o.shimSenderReceiverGetStats(M,y),o.fixNegotiationNeeded(M,y),f.shimRTCIceCandidate(M,y),f.shimRTCIceCandidateRelayProtocol(M,y),f.shimConnectionState(M,y),f.shimMaxMessageSize(M,y),f.shimSendThrowTypeError(M,y),f.removeExtmapAllowMixed(M,y);break;case"firefox":if(!s||!s.shimPeerConnection||!H.shimFirefox)return O("Firefox shim is not included in this adapter release."),P;O("adapter.js shimming firefox."),P.browserShim=s,f.shimAddIceCandidateNullOrEmpty(M,y),f.shimParameterlessSetLocalDescription(M,y),s.shimGetUserMedia(M,y),s.shimPeerConnection(M,y),s.shimOnTrack(M,y),s.shimRemoveStream(M,y),s.shimSenderGetStats(M,y),s.shimReceiverGetStats(M,y),s.shimRTCDataChannel(M,y),s.shimAddTransceiver(M,y),s.shimGetParameters(M,y),s.shimCreateOffer(M,y),s.shimCreateAnswer(M,y),f.shimRTCIceCandidate(M,y),f.shimConnectionState(M,y),f.shimMaxMessageSize(M,y),f.shimSendThrowTypeError(M,y);break;case"safari":if(!c||!H.shimSafari)return O("Safari shim is not included in this adapter release."),P;O("adapter.js shimming safari."),P.browserShim=c,f.shimAddIceCandidateNullOrEmpty(M,y),f.shimParameterlessSetLocalDescription(M,y),c.shimRTCIceServerUrls(M,y),c.shimCreateOfferLegacy(M,y),c.shimCallbacksAPI(M,y),c.shimLocalStreamsAPI(M,y),c.shimRemoteStreamsAPI(M,y),c.shimTrackEventTransceiver(M,y),c.shimGetUserMedia(M,y),c.shimAudioContext(M,y),f.shimRTCIceCandidate(M,y),f.shimRTCIceCandidateRelayProtocol(M,y),f.shimMaxMessageSize(M,y),f.shimSendThrowTypeError(M,y),f.removeExtmapAllowMixed(M,y);break;default:O("Unsupported browser!");break}return P}},{"./chrome/chrome_shim":3,"./common_shim":5,"./firefox/firefox_shim":6,"./safari/safari_shim":9,"./utils":10,sdp:11}],3:[function(n,e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.fixNegotiationNeeded=P,t.shimAddTrackRemoveTrack=O,t.shimAddTrackRemoveTrackWithNative=H,t.shimGetSendersWithDtmf=N,Object.defineProperty(t,"shimGetUserMedia",{enumerable:!0,get:function(){return i.shimGetUserMedia}}),t.shimMediaStream=R,t.shimOnTrack=D,t.shimPeerConnection=y,t.shimSenderReceiverGetStats=M;var r=s(n("../utils.js")),i=n("./getusermedia");function o(m){if(typeof WeakMap!="function")return null;var g=new WeakMap,p=new WeakMap;return(o=function(I){return I?p:g})(m)}function s(m,g){if(m&&m.__esModule)return m;if(m===null||v(m)!="object"&&typeof m!="function")return{default:m};var p=o(g);if(p&&p.has(m))return p.get(m);var b={__proto__:null},I=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var F in m)if(F!=="default"&&{}.hasOwnProperty.call(m,F)){var j=I?Object.getOwnPropertyDescriptor(m,F):null;j&&(j.get||j.set)?Object.defineProperty(b,F,j):b[F]=m[F]}return b.default=m,p&&p.set(m,b),b}function c(m,g,p){return g=f(g),g in m?Object.defineProperty(m,g,{value:p,enumerable:!0,configurable:!0,writable:!0}):m[g]=p,m}function f(m){var g=d(m,"string");return v(g)=="symbol"?g:g+""}function d(m,g){if(v(m)!="object"||!m)return m;var p=m[Symbol.toPrimitive];if(p!==void 0){var b=p.call(m,g);if(v(b)!="object")return b;throw new TypeError("@@toPrimitive must return a primitive value.")}return(g==="string"?String:Number)(m)}function v(m){"@babel/helpers - typeof";return v=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(g){return typeof g}:function(g){return g&&typeof Symbol=="function"&&g.constructor===Symbol&&g!==Symbol.prototype?"symbol":typeof g},v(m)}function R(m){m.MediaStream=m.MediaStream||m.webkitMediaStream}function D(m){if(v(m)==="object"&&m.RTCPeerConnection&&!("ontrack"in m.RTCPeerConnection.prototype)){Object.defineProperty(m.RTCPeerConnection.prototype,"ontrack",{get:function(){return this._ontrack},set:function(b){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=b)},enumerable:!0,configurable:!0});var g=m.RTCPeerConnection.prototype.setRemoteDescription;m.RTCPeerConnection.prototype.setRemoteDescription=function(){var b=this;return this._ontrackpoly||(this._ontrackpoly=function(I){I.stream.addEventListener("addtrack",function(F){var j;m.RTCPeerConnection.prototype.getReceivers?j=b.getReceivers().find(function(G){return G.track&&G.track.id===F.track.id}):j={track:F.track};var A=new Event("track");A.track=F.track,A.receiver=j,A.transceiver={receiver:j},A.streams=[I.stream],b.dispatchEvent(A)}),I.stream.getTracks().forEach(function(F){var j;m.RTCPeerConnection.prototype.getReceivers?j=b.getReceivers().find(function(G){return G.track&&G.track.id===F.id}):j={track:F};var A=new Event("track");A.track=F,A.receiver=j,A.transceiver={receiver:j},A.streams=[I.stream],b.dispatchEvent(A)})},this.addEventListener("addstream",this._ontrackpoly)),g.apply(this,arguments)}}else r.wrapPeerConnectionEvent(m,"track",function(p){return p.transceiver||Object.defineProperty(p,"transceiver",{value:{receiver:p.receiver}}),p})}function N(m){if(v(m)==="object"&&m.RTCPeerConnection&&!("getSenders"in m.RTCPeerConnection.prototype)&&"createDTMFSender"in m.RTCPeerConnection.prototype){var g=function(G,S){return{track:S,get dtmf(){return this._dtmf===void 0&&(S.kind==="audio"?this._dtmf=G.createDTMFSender(S):this._dtmf=null),this._dtmf},_pc:G}};if(!m.RTCPeerConnection.prototype.getSenders){m.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};var p=m.RTCPeerConnection.prototype.addTrack;m.RTCPeerConnection.prototype.addTrack=function(G,S){var k=p.apply(this,arguments);return k||(k=g(this,G),this._senders.push(k)),k};var b=m.RTCPeerConnection.prototype.removeTrack;m.RTCPeerConnection.prototype.removeTrack=function(G){b.apply(this,arguments);var S=this._senders.indexOf(G);S!==-1&&this._senders.splice(S,1)}}var I=m.RTCPeerConnection.prototype.addStream;m.RTCPeerConnection.prototype.addStream=function(G){var S=this;this._senders=this._senders||[],I.apply(this,[G]),G.getTracks().forEach(function(k){S._senders.push(g(S,k))})};var F=m.RTCPeerConnection.prototype.removeStream;m.RTCPeerConnection.prototype.removeStream=function(G){var S=this;this._senders=this._senders||[],F.apply(this,[G]),G.getTracks().forEach(function(k){var J=S._senders.find(function(q){return q.track===k});J&&S._senders.splice(S._senders.indexOf(J),1)})}}else if(v(m)==="object"&&m.RTCPeerConnection&&"getSenders"in m.RTCPeerConnection.prototype&&"createDTMFSender"in m.RTCPeerConnection.prototype&&m.RTCRtpSender&&!("dtmf"in m.RTCRtpSender.prototype)){var j=m.RTCPeerConnection.prototype.getSenders;m.RTCPeerConnection.prototype.getSenders=function(){var G=this,S=j.apply(this,[]);return S.forEach(function(k){return k._pc=G}),S},Object.defineProperty(m.RTCRtpSender.prototype,"dtmf",{get:function(){return this._dtmf===void 0&&(this.track.kind==="audio"?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function M(m){if(v(m)==="object"&&m.RTCPeerConnection&&m.RTCRtpSender&&m.RTCRtpReceiver){if(!("getStats"in m.RTCRtpSender.prototype)){var g=m.RTCPeerConnection.prototype.getSenders;g&&(m.RTCPeerConnection.prototype.getSenders=function(){var j=this,A=g.apply(this,[]);return A.forEach(function(G){return G._pc=j}),A});var p=m.RTCPeerConnection.prototype.addTrack;p&&(m.RTCPeerConnection.prototype.addTrack=function(){var j=p.apply(this,arguments);return j._pc=this,j}),m.RTCRtpSender.prototype.getStats=function(){var j=this;return this._pc.getStats().then(function(A){return r.filterStats(A,j.track,!0)})}}if(!("getStats"in m.RTCRtpReceiver.prototype)){var b=m.RTCPeerConnection.prototype.getReceivers;b&&(m.RTCPeerConnection.prototype.getReceivers=function(){var j=this,A=b.apply(this,[]);return A.forEach(function(G){return G._pc=j}),A}),r.wrapPeerConnectionEvent(m,"track",function(F){return F.receiver._pc=F.srcElement,F}),m.RTCRtpReceiver.prototype.getStats=function(){var j=this;return this._pc.getStats().then(function(A){return r.filterStats(A,j.track,!1)})}}if("getStats"in m.RTCRtpSender.prototype&&"getStats"in m.RTCRtpReceiver.prototype){var I=m.RTCPeerConnection.prototype.getStats;m.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof m.MediaStreamTrack){var j=arguments[0],A,G,S;return this.getSenders().forEach(function(k){k.track===j&&(A?S=!0:A=k)}),this.getReceivers().forEach(function(k){return k.track===j&&(G?S=!0:G=k),k.track===j}),S||A&&G?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):A?A.getStats():G?G.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return I.apply(this,arguments)}}}}function H(m){m.RTCPeerConnection.prototype.getLocalStreams=function(){var j=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(function(A){return j._shimmedLocalStreams[A][0]})};var g=m.RTCPeerConnection.prototype.addTrack;m.RTCPeerConnection.prototype.addTrack=function(j,A){if(!A)return g.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};var G=g.apply(this,arguments);return this._shimmedLocalStreams[A.id]?this._shimmedLocalStreams[A.id].indexOf(G)===-1&&this._shimmedLocalStreams[A.id].push(G):this._shimmedLocalStreams[A.id]=[A,G],G};var p=m.RTCPeerConnection.prototype.addStream;m.RTCPeerConnection.prototype.addStream=function(j){var A=this;this._shimmedLocalStreams=this._shimmedLocalStreams||{},j.getTracks().forEach(function(k){var J=A.getSenders().find(function(q){return q.track===k});if(J)throw new DOMException("Track already exists.","InvalidAccessError")});var G=this.getSenders();p.apply(this,arguments);var S=this.getSenders().filter(function(k){return G.indexOf(k)===-1});this._shimmedLocalStreams[j.id]=[j].concat(S)};var b=m.RTCPeerConnection.prototype.removeStream;m.RTCPeerConnection.prototype.removeStream=function(j){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[j.id],b.apply(this,arguments)};var I=m.RTCPeerConnection.prototype.removeTrack;m.RTCPeerConnection.prototype.removeTrack=function(j){var A=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},j&&Object.keys(this._shimmedLocalStreams).forEach(function(G){var S=A._shimmedLocalStreams[G].indexOf(j);S!==-1&&A._shimmedLocalStreams[G].splice(S,1),A._shimmedLocalStreams[G].length===1&&delete A._shimmedLocalStreams[G]}),I.apply(this,arguments)}}function O(m,g){if(!m.RTCPeerConnection)return;if(m.RTCPeerConnection.prototype.addTrack&&g.version>=65)return H(m);var p=m.RTCPeerConnection.prototype.getLocalStreams;m.RTCPeerConnection.prototype.getLocalStreams=function(){var k=this,J=p.apply(this);return this._reverseStreams=this._reverseStreams||{},J.map(function(q){return k._reverseStreams[q.id]})};var b=m.RTCPeerConnection.prototype.addStream;m.RTCPeerConnection.prototype.addStream=function(k){var J=this;if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},k.getTracks().forEach(function(B){var K=J.getSenders().find(function(Q){return Q.track===B});if(K)throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[k.id]){var q=new m.MediaStream(k.getTracks());this._streams[k.id]=q,this._reverseStreams[q.id]=k,k=q}b.apply(this,[k])};var I=m.RTCPeerConnection.prototype.removeStream;m.RTCPeerConnection.prototype.removeStream=function(k){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},I.apply(this,[this._streams[k.id]||k]),delete this._reverseStreams[this._streams[k.id]?this._streams[k.id].id:k.id],delete this._streams[k.id]},m.RTCPeerConnection.prototype.addTrack=function(k,J){var q=this;if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");var B=[].slice.call(arguments,1);if(B.length!==1||!B[0].getTracks().find(function(ne){return ne===k}))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");var K=this.getSenders().find(function(ne){return ne.track===k});if(K)throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};var Q=this._streams[J.id];if(Q)Q.addTrack(k),Promise.resolve().then(function(){q.dispatchEvent(new Event("negotiationneeded"))});else{var te=new m.MediaStream([k]);this._streams[J.id]=te,this._reverseStreams[te.id]=J,this.addStream(te)}return this.getSenders().find(function(ne){return ne.track===k})};function F(S,k){var J=k.sdp;return Object.keys(S._reverseStreams||[]).forEach(function(q){var B=S._reverseStreams[q],K=S._streams[B.id];J=J.replace(new RegExp(K.id,"g"),B.id)}),new RTCSessionDescription({type:k.type,sdp:J})}function j(S,k){var J=k.sdp;return Object.keys(S._reverseStreams||[]).forEach(function(q){var B=S._reverseStreams[q],K=S._streams[B.id];J=J.replace(new RegExp(B.id,"g"),K.id)}),new RTCSessionDescription({type:k.type,sdp:J})}["createOffer","createAnswer"].forEach(function(S){var k=m.RTCPeerConnection.prototype[S],J=c({},S,function(){var q=this,B=arguments,K=arguments.length&&typeof arguments[0]=="function";return K?k.apply(this,[function(Q){var te=F(q,Q);B[0].apply(null,[te])},function(Q){B[1]&&B[1].apply(null,Q)},arguments[2]]):k.apply(this,arguments).then(function(Q){return F(q,Q)})});m.RTCPeerConnection.prototype[S]=J[S]});var A=m.RTCPeerConnection.prototype.setLocalDescription;m.RTCPeerConnection.prototype.setLocalDescription=function(){return!arguments.length||!arguments[0].type?A.apply(this,arguments):(arguments[0]=j(this,arguments[0]),A.apply(this,arguments))};var G=Object.getOwnPropertyDescriptor(m.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(m.RTCPeerConnection.prototype,"localDescription",{get:function(){var k=G.get.apply(this);return k.type===""?k:F(this,k)}}),m.RTCPeerConnection.prototype.removeTrack=function(k){var J=this;if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!k._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");var q=k._pc===this;if(!q)throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{};var B;Object.keys(this._streams).forEach(function(K){var Q=J._streams[K].getTracks().find(function(te){return k.track===te});Q&&(B=J._streams[K])}),B&&(B.getTracks().length===1?this.removeStream(this._reverseStreams[B.id]):B.removeTrack(k.track),this.dispatchEvent(new Event("negotiationneeded")))}}function y(m,g){!m.RTCPeerConnection&&m.webkitRTCPeerConnection&&(m.RTCPeerConnection=m.webkitRTCPeerConnection),m.RTCPeerConnection&&g.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(p){var b=m.RTCPeerConnection.prototype[p],I=c({},p,function(){return arguments[0]=new(p==="addIceCandidate"?m.RTCIceCandidate:m.RTCSessionDescription)(arguments[0]),b.apply(this,arguments)});m.RTCPeerConnection.prototype[p]=I[p]})}function P(m,g){r.wrapPeerConnectionEvent(m,"negotiationneeded",function(p){var b=p.target;if(!((g.version<72||b.getConfiguration&&b.getConfiguration().sdpSemantics==="plan-b")&&b.signalingState!=="stable"))return p})}},{"../utils.js":10,"./getusermedia":4}],4:[function(n,e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.shimGetUserMedia=f;var r=o(n("../utils.js"));function i(d){if(typeof WeakMap!="function")return null;var v=new WeakMap,R=new WeakMap;return(i=function(N){return N?R:v})(d)}function o(d,v){if(d&&d.__esModule)return d;if(d===null||s(d)!="object"&&typeof d!="function")return{default:d};var R=i(v);if(R&&R.has(d))return R.get(d);var D={__proto__:null},N=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var M in d)if(M!=="default"&&{}.hasOwnProperty.call(d,M)){var H=N?Object.getOwnPropertyDescriptor(d,M):null;H&&(H.get||H.set)?Object.defineProperty(D,M,H):D[M]=d[M]}return D.default=d,R&&R.set(d,D),D}function s(d){"@babel/helpers - typeof";return s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(v){return typeof v}:function(v){return v&&typeof Symbol=="function"&&v.constructor===Symbol&&v!==Symbol.prototype?"symbol":typeof v},s(d)}var c=r.log;function f(d,v){var R=d&&d.navigator;if(R.mediaDevices){var D=function(P){if(s(P)!=="object"||P.mandatory||P.optional)return P;var m={};return Object.keys(P).forEach(function(g){if(!(g==="require"||g==="advanced"||g==="mediaSource")){var p=s(P[g])==="object"?P[g]:{ideal:P[g]};p.exact!==void 0&&typeof p.exact=="number"&&(p.min=p.max=p.exact);var b=function(j,A){return j?j+A.charAt(0).toUpperCase()+A.slice(1):A==="deviceId"?"sourceId":A};if(p.ideal!==void 0){m.optional=m.optional||[];var I={};typeof p.ideal=="number"?(I[b("min",g)]=p.ideal,m.optional.push(I),I={},I[b("max",g)]=p.ideal,m.optional.push(I)):(I[b("",g)]=p.ideal,m.optional.push(I))}p.exact!==void 0&&typeof p.exact!="number"?(m.mandatory=m.mandatory||{},m.mandatory[b("",g)]=p.exact):["min","max"].forEach(function(F){p[F]!==void 0&&(m.mandatory=m.mandatory||{},m.mandatory[b(F,g)]=p[F])})}}),P.advanced&&(m.optional=(m.optional||[]).concat(P.advanced)),m},N=function(P,m){if(v.version>=61)return m(P);if(P=JSON.parse(JSON.stringify(P)),P&&s(P.audio)==="object"){var g=function(j,A,G){A in j&&!(G in j)&&(j[G]=j[A],delete j[A])};P=JSON.parse(JSON.stringify(P)),g(P.audio,"autoGainControl","googAutoGainControl"),g(P.audio,"noiseSuppression","googNoiseSuppression"),P.audio=D(P.audio)}if(P&&s(P.video)==="object"){var p=P.video.facingMode;p=p&&(s(p)==="object"?p:{ideal:p});var b=v.version<66;if(p&&(p.exact==="user"||p.exact==="environment"||p.ideal==="user"||p.ideal==="environment")&&!(R.mediaDevices.getSupportedConstraints&&R.mediaDevices.getSupportedConstraints().facingMode&&!b)){delete P.video.facingMode;var I;if(p.exact==="environment"||p.ideal==="environment"?I=["back","rear"]:(p.exact==="user"||p.ideal==="user")&&(I=["front"]),I)return R.mediaDevices.enumerateDevices().then(function(F){F=F.filter(function(A){return A.kind==="videoinput"});var j=F.find(function(A){return I.some(function(G){return A.label.toLowerCase().includes(G)})});return!j&&F.length&&I.includes("back")&&(j=F[F.length-1]),j&&(P.video.deviceId=p.exact?{exact:j.deviceId}:{ideal:j.deviceId}),P.video=D(P.video),c("chrome: "+JSON.stringify(P)),m(P)})}P.video=D(P.video)}return c("chrome: "+JSON.stringify(P)),m(P)},M=function(P){return v.version>=64?P:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[P.name]||P.name,message:P.message,constraint:P.constraint||P.constraintName,toString:function(){return this.name+(this.message&&": ")+this.message}}},H=function(P,m,g){N(P,function(p){R.webkitGetUserMedia(p,m,function(b){g&&g(M(b))})})};if(R.getUserMedia=H.bind(R),R.mediaDevices.getUserMedia){var O=R.mediaDevices.getUserMedia.bind(R.mediaDevices);R.mediaDevices.getUserMedia=function(y){return N(y,function(P){return O(P).then(function(m){if(P.audio&&!m.getAudioTracks().length||P.video&&!m.getVideoTracks().length)throw m.getTracks().forEach(function(g){g.stop()}),new DOMException("","NotFoundError");return m},function(m){return Promise.reject(M(m))})})}}}}},{"../utils.js":10}],5:[function(n,e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.removeExtmapAllowMixed=M,t.shimAddIceCandidateNullOrEmpty=H,t.shimConnectionState=N,t.shimMaxMessageSize=R,t.shimParameterlessSetLocalDescription=O,t.shimRTCIceCandidate=d,t.shimRTCIceCandidateRelayProtocol=v,t.shimSendThrowTypeError=D;var r=c(n("sdp")),i=s(n("./utils"));function o(y){if(typeof WeakMap!="function")return null;var P=new WeakMap,m=new WeakMap;return(o=function(p){return p?m:P})(y)}function s(y,P){if(y&&y.__esModule)return y;if(y===null||f(y)!="object"&&typeof y!="function")return{default:y};var m=o(P);if(m&&m.has(y))return m.get(y);var g={__proto__:null},p=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var b in y)if(b!=="default"&&{}.hasOwnProperty.call(y,b)){var I=p?Object.getOwnPropertyDescriptor(y,b):null;I&&(I.get||I.set)?Object.defineProperty(g,b,I):g[b]=y[b]}return g.default=y,m&&m.set(y,g),g}function c(y){return y&&y.__esModule?y:{default:y}}function f(y){"@babel/helpers - typeof";return f=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(P){return typeof P}:function(P){return P&&typeof Symbol=="function"&&P.constructor===Symbol&&P!==Symbol.prototype?"symbol":typeof P},f(y)}function d(y){if(!(!y.RTCIceCandidate||y.RTCIceCandidate&&"foundation"in y.RTCIceCandidate.prototype)){var P=y.RTCIceCandidate;y.RTCIceCandidate=function(g){if(f(g)==="object"&&g.candidate&&g.candidate.indexOf("a=")===0&&(g=JSON.parse(JSON.stringify(g)),g.candidate=g.candidate.substring(2)),g.candidate&&g.candidate.length){var p=new P(g),b=r.default.parseCandidate(g.candidate);for(var I in b)I in p||Object.defineProperty(p,I,{value:b[I]});return p.toJSON=function(){return{candidate:p.candidate,sdpMid:p.sdpMid,sdpMLineIndex:p.sdpMLineIndex,usernameFragment:p.usernameFragment}},p}return new P(g)},y.RTCIceCandidate.prototype=P.prototype,i.wrapPeerConnectionEvent(y,"icecandidate",function(m){return m.candidate&&Object.defineProperty(m,"candidate",{value:new y.RTCIceCandidate(m.candidate),writable:"false"}),m})}}function v(y){!y.RTCIceCandidate||y.RTCIceCandidate&&"relayProtocol"in y.RTCIceCandidate.prototype||i.wrapPeerConnectionEvent(y,"icecandidate",function(P){if(P.candidate){var m=r.default.parseCandidate(P.candidate.candidate);m.type==="relay"&&(P.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[m.priority>>24])}return P})}function R(y,P){if(y.RTCPeerConnection){"sctp"in y.RTCPeerConnection.prototype||Object.defineProperty(y.RTCPeerConnection.prototype,"sctp",{get:function(){return typeof this._sctp>"u"?null:this._sctp}});var m=function(j){if(!j||!j.sdp)return!1;var A=r.default.splitSections(j.sdp);return A.shift(),A.some(function(G){var S=r.default.parseMLine(G);return S&&S.kind==="application"&&S.protocol.indexOf("SCTP")!==-1})},g=function(j){var A=j.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(A===null||A.length<2)return-1;var G=parseInt(A[1],10);return G!==G?-1:G},p=function(j){var A=65536;return P.browser==="firefox"&&(P.version<57?j===-1?A=16384:A=2147483637:P.version<60?A=P.version===57?65535:65536:A=2147483637),A},b=function(j,A){var G=65536;P.browser==="firefox"&&P.version===57&&(G=65535);var S=r.default.matchPrefix(j.sdp,"a=max-message-size:");return S.length>0?G=parseInt(S[0].substring(19),10):P.browser==="firefox"&&A!==-1&&(G=2147483637),G},I=y.RTCPeerConnection.prototype.setRemoteDescription;y.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,P.browser==="chrome"&&P.version>=76){var j=this.getConfiguration(),A=j.sdpSemantics;A==="plan-b"&&Object.defineProperty(this,"sctp",{get:function(){return typeof this._sctp>"u"?null:this._sctp},enumerable:!0,configurable:!0})}if(m(arguments[0])){var G=g(arguments[0]),S=p(G),k=b(arguments[0],G),J;S===0&&k===0?J=Number.POSITIVE_INFINITY:S===0||k===0?J=Math.max(S,k):J=Math.min(S,k);var q={};Object.defineProperty(q,"maxMessageSize",{get:function(){return J}}),this._sctp=q}return I.apply(this,arguments)}}}function D(y){if(!(y.RTCPeerConnection&&"createDataChannel"in y.RTCPeerConnection.prototype))return;function P(g,p){var b=g.send;g.send=function(){var F=arguments[0],j=F.length||F.size||F.byteLength;if(g.readyState==="open"&&p.sctp&&j>p.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+p.sctp.maxMessageSize+" bytes)");return b.apply(g,arguments)}}var m=y.RTCPeerConnection.prototype.createDataChannel;y.RTCPeerConnection.prototype.createDataChannel=function(){var p=m.apply(this,arguments);return P(p,this),p},i.wrapPeerConnectionEvent(y,"datachannel",function(g){return P(g.channel,g.target),g})}function N(y){if(!(!y.RTCPeerConnection||"connectionState"in y.RTCPeerConnection.prototype)){var P=y.RTCPeerConnection.prototype;Object.defineProperty(P,"connectionState",{get:function(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(P,"onconnectionstatechange",{get:function(){return this._onconnectionstatechange||null},set:function(g){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),g&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=g)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(function(m){var g=P[m];P[m]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=function(p){var b=p.target;if(b._lastConnectionState!==b.connectionState){b._lastConnectionState=b.connectionState;var I=new Event("connectionstatechange",p);b.dispatchEvent(I)}return p},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),g.apply(this,arguments)}})}}function M(y,P){if(y.RTCPeerConnection&&!(P.browser==="chrome"&&P.version>=71)&&!(P.browser==="safari"&&P.version>=605)){var m=y.RTCPeerConnection.prototype.setRemoteDescription;y.RTCPeerConnection.prototype.setRemoteDescription=function(p){if(p&&p.sdp&&p.sdp.indexOf(`
|
2
|
+
a=extmap-allow-mixed`)!==-1){var b=p.sdp.split(`
|
3
|
+
`).filter(function(I){return I.trim()!=="a=extmap-allow-mixed"}).join(`
|
4
|
+
`);y.RTCSessionDescription&&p instanceof y.RTCSessionDescription?arguments[0]=new y.RTCSessionDescription({type:p.type,sdp:b}):p.sdp=b}return m.apply(this,arguments)}}}function H(y,P){if(y.RTCPeerConnection&&y.RTCPeerConnection.prototype){var m=y.RTCPeerConnection.prototype.addIceCandidate;!m||m.length===0||(y.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?(P.browser==="chrome"&&P.version<78||P.browser==="firefox"&&P.version<68||P.browser==="safari")&&arguments[0]&&arguments[0].candidate===""?Promise.resolve():m.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}}function O(y,P){if(y.RTCPeerConnection&&y.RTCPeerConnection.prototype){var m=y.RTCPeerConnection.prototype.setLocalDescription;!m||m.length===0||(y.RTCPeerConnection.prototype.setLocalDescription=function(){var p=this,b=arguments[0]||{};if(f(b)!=="object"||b.type&&b.sdp)return m.apply(this,arguments);if(b={type:b.type,sdp:b.sdp},!b.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":b.type="offer";break;default:b.type="answer";break}if(b.sdp||b.type!=="offer"&&b.type!=="answer")return m.apply(this,[b]);var I=b.type==="offer"?this.createOffer:this.createAnswer;return I.apply(this).then(function(F){return m.apply(p,[F])})})}}},{"./utils":10,sdp:11}],6:[function(n,e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.shimAddTransceiver=F,t.shimCreateAnswer=G,t.shimCreateOffer=A,Object.defineProperty(t,"shimGetDisplayMedia",{enumerable:!0,get:function(){return o.shimGetDisplayMedia}}),t.shimGetParameters=j,Object.defineProperty(t,"shimGetUserMedia",{enumerable:!0,get:function(){return i.shimGetUserMedia}}),t.shimOnTrack=P,t.shimPeerConnection=m,t.shimRTCDataChannel=I,t.shimReceiverGetStats=p,t.shimRemoveStream=b,t.shimSenderGetStats=g;var r=c(n("../utils")),i=n("./getusermedia"),o=n("./getdisplaymedia");function s(S){if(typeof WeakMap!="function")return null;var k=new WeakMap,J=new WeakMap;return(s=function(B){return B?J:k})(S)}function c(S,k){if(S&&S.__esModule)return S;if(S===null||y(S)!="object"&&typeof S!="function")return{default:S};var J=s(k);if(J&&J.has(S))return J.get(S);var q={__proto__:null},B=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var K in S)if(K!=="default"&&{}.hasOwnProperty.call(S,K)){var Q=B?Object.getOwnPropertyDescriptor(S,K):null;Q&&(Q.get||Q.set)?Object.defineProperty(q,K,Q):q[K]=S[K]}return q.default=S,J&&J.set(S,q),q}function f(S){return D(S)||R(S)||v(S)||d()}function d(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
5
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function v(S,k){if(S){if(typeof S=="string")return N(S,k);var J=Object.prototype.toString.call(S).slice(8,-1);if(J==="Object"&&S.constructor&&(J=S.constructor.name),J==="Map"||J==="Set")return Array.from(S);if(J==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(J))return N(S,k)}}function R(S){if(typeof Symbol<"u"&&S[Symbol.iterator]!=null||S["@@iterator"]!=null)return Array.from(S)}function D(S){if(Array.isArray(S))return N(S)}function N(S,k){(k==null||k>S.length)&&(k=S.length);for(var J=0,q=new Array(k);J<k;J++)q[J]=S[J];return q}function M(S,k,J){return k=H(k),k in S?Object.defineProperty(S,k,{value:J,enumerable:!0,configurable:!0,writable:!0}):S[k]=J,S}function H(S){var k=O(S,"string");return y(k)=="symbol"?k:k+""}function O(S,k){if(y(S)!="object"||!S)return S;var J=S[Symbol.toPrimitive];if(J!==void 0){var q=J.call(S,k);if(y(q)!="object")return q;throw new TypeError("@@toPrimitive must return a primitive value.")}return(k==="string"?String:Number)(S)}function y(S){"@babel/helpers - typeof";return y=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(k){return typeof k}:function(k){return k&&typeof Symbol=="function"&&k.constructor===Symbol&&k!==Symbol.prototype?"symbol":typeof k},y(S)}function P(S){y(S)==="object"&&S.RTCTrackEvent&&"receiver"in S.RTCTrackEvent.prototype&&!("transceiver"in S.RTCTrackEvent.prototype)&&Object.defineProperty(S.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})}function m(S,k){if(!(y(S)!=="object"||!(S.RTCPeerConnection||S.mozRTCPeerConnection))){!S.RTCPeerConnection&&S.mozRTCPeerConnection&&(S.RTCPeerConnection=S.mozRTCPeerConnection),k.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(B){var K=S.RTCPeerConnection.prototype[B],Q=M({},B,function(){return arguments[0]=new(B==="addIceCandidate"?S.RTCIceCandidate:S.RTCSessionDescription)(arguments[0]),K.apply(this,arguments)});S.RTCPeerConnection.prototype[B]=Q[B]});var J={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},q=S.RTCPeerConnection.prototype.getStats;S.RTCPeerConnection.prototype.getStats=function(){var K=Array.prototype.slice.call(arguments),Q=K[0],te=K[1],ne=K[2];return q.apply(this,[Q||null]).then(function(ie){if(k.version<53&&!te)try{ie.forEach(function(ue){ue.type=J[ue.type]||ue.type})}catch(ue){if(ue.name!=="TypeError")throw ue;ie.forEach(function(W,$){ie.set($,Object.assign({},W,{type:J[W.type]||W.type}))})}return ie}).then(te,ne)}}}function g(S){if(y(S)==="object"&&S.RTCPeerConnection&&S.RTCRtpSender&&!(S.RTCRtpSender&&"getStats"in S.RTCRtpSender.prototype)){var k=S.RTCPeerConnection.prototype.getSenders;k&&(S.RTCPeerConnection.prototype.getSenders=function(){var B=this,K=k.apply(this,[]);return K.forEach(function(Q){return Q._pc=B}),K});var J=S.RTCPeerConnection.prototype.addTrack;J&&(S.RTCPeerConnection.prototype.addTrack=function(){var B=J.apply(this,arguments);return B._pc=this,B}),S.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}}function p(S){if(y(S)==="object"&&S.RTCPeerConnection&&S.RTCRtpSender&&!(S.RTCRtpSender&&"getStats"in S.RTCRtpReceiver.prototype)){var k=S.RTCPeerConnection.prototype.getReceivers;k&&(S.RTCPeerConnection.prototype.getReceivers=function(){var q=this,B=k.apply(this,[]);return B.forEach(function(K){return K._pc=q}),B}),r.wrapPeerConnectionEvent(S,"track",function(J){return J.receiver._pc=J.srcElement,J}),S.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}}function b(S){!S.RTCPeerConnection||"removeStream"in S.RTCPeerConnection.prototype||(S.RTCPeerConnection.prototype.removeStream=function(J){var q=this;r.deprecated("removeStream","removeTrack"),this.getSenders().forEach(function(B){B.track&&J.getTracks().includes(B.track)&&q.removeTrack(B)})})}function I(S){S.DataChannel&&!S.RTCDataChannel&&(S.RTCDataChannel=S.DataChannel)}function F(S){if(y(S)==="object"&&S.RTCPeerConnection){var k=S.RTCPeerConnection.prototype.addTransceiver;k&&(S.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];var q=arguments[1]&&arguments[1].sendEncodings;q===void 0&&(q=[]),q=f(q);var B=q.length>0;B&&q.forEach(function(ne){if("rid"in ne){var ie=/^[a-z0-9]{0,16}$/i;if(!ie.test(ne.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in ne&&!(parseFloat(ne.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in ne&&!(parseFloat(ne.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")});var K=k.apply(this,arguments);if(B){var Q=K.sender,te=Q.getParameters();(!("encodings"in te)||te.encodings.length===1&&Object.keys(te.encodings[0]).length===0)&&(te.encodings=q,Q.sendEncodings=q,this.setParametersPromises.push(Q.setParameters(te).then(function(){delete Q.sendEncodings}).catch(function(){delete Q.sendEncodings})))}return K})}}function j(S){if(y(S)==="object"&&S.RTCRtpSender){var k=S.RTCRtpSender.prototype.getParameters;k&&(S.RTCRtpSender.prototype.getParameters=function(){var q=k.apply(this,arguments);return"encodings"in q||(q.encodings=[].concat(this.sendEncodings||[{}])),q})}}function A(S){if(y(S)==="object"&&S.RTCPeerConnection){var k=S.RTCPeerConnection.prototype.createOffer;S.RTCPeerConnection.prototype.createOffer=function(){var q=arguments,B=this;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(function(){return k.apply(B,q)}).finally(function(){B.setParametersPromises=[]}):k.apply(this,arguments)}}}function G(S){if(y(S)==="object"&&S.RTCPeerConnection){var k=S.RTCPeerConnection.prototype.createAnswer;S.RTCPeerConnection.prototype.createAnswer=function(){var q=arguments,B=this;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(function(){return k.apply(B,q)}).finally(function(){B.setParametersPromises=[]}):k.apply(this,arguments)}}}},{"../utils":10,"./getdisplaymedia":7,"./getusermedia":8}],7:[function(n,e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.shimGetDisplayMedia=r;function r(i,o){i.navigator.mediaDevices&&"getDisplayMedia"in i.navigator.mediaDevices||i.navigator.mediaDevices&&(i.navigator.mediaDevices.getDisplayMedia=function(c){if(!(c&&c.video)){var f=new DOMException("getDisplayMedia without video constraints is undefined");return f.name="NotFoundError",f.code=8,Promise.reject(f)}return c.video===!0?c.video={mediaSource:o}:c.video.mediaSource=o,i.navigator.mediaDevices.getUserMedia(c)})}},{}],8:[function(n,e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.shimGetUserMedia=c;var r=o(n("../utils"));function i(f){if(typeof WeakMap!="function")return null;var d=new WeakMap,v=new WeakMap;return(i=function(D){return D?v:d})(f)}function o(f,d){if(f&&f.__esModule)return f;if(f===null||s(f)!="object"&&typeof f!="function")return{default:f};var v=i(d);if(v&&v.has(f))return v.get(f);var R={__proto__:null},D=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var N in f)if(N!=="default"&&{}.hasOwnProperty.call(f,N)){var M=D?Object.getOwnPropertyDescriptor(f,N):null;M&&(M.get||M.set)?Object.defineProperty(R,N,M):R[N]=f[N]}return R.default=f,v&&v.set(f,R),R}function s(f){"@babel/helpers - typeof";return s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(d){return typeof d}:function(d){return d&&typeof Symbol=="function"&&d.constructor===Symbol&&d!==Symbol.prototype?"symbol":typeof d},s(f)}function c(f,d){var v=f&&f.navigator,R=f&&f.MediaStreamTrack;if(v.getUserMedia=function(O,y,P){r.deprecated("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),v.mediaDevices.getUserMedia(O).then(y,P)},!(d.version>55&&"autoGainControl"in v.mediaDevices.getSupportedConstraints())){var D=function(y,P,m){P in y&&!(m in y)&&(y[m]=y[P],delete y[P])},N=v.mediaDevices.getUserMedia.bind(v.mediaDevices);if(v.mediaDevices.getUserMedia=function(O){return s(O)==="object"&&s(O.audio)==="object"&&(O=JSON.parse(JSON.stringify(O)),D(O.audio,"autoGainControl","mozAutoGainControl"),D(O.audio,"noiseSuppression","mozNoiseSuppression")),N(O)},R&&R.prototype.getSettings){var M=R.prototype.getSettings;R.prototype.getSettings=function(){var O=M.apply(this,arguments);return D(O,"mozAutoGainControl","autoGainControl"),D(O,"mozNoiseSuppression","noiseSuppression"),O}}if(R&&R.prototype.applyConstraints){var H=R.prototype.applyConstraints;R.prototype.applyConstraints=function(O){return this.kind==="audio"&&s(O)==="object"&&(O=JSON.parse(JSON.stringify(O)),D(O,"autoGainControl","mozAutoGainControl"),D(O,"noiseSuppression","mozNoiseSuppression")),H.apply(this,[O])}}}}},{"../utils":10}],9:[function(n,e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.shimAudioContext=H,t.shimCallbacksAPI=d,t.shimConstraints=R,t.shimCreateOfferLegacy=M,t.shimGetUserMedia=v,t.shimLocalStreamsAPI=c,t.shimRTCIceServerUrls=D,t.shimRemoteStreamsAPI=f,t.shimTrackEventTransceiver=N;var r=o(n("../utils"));function i(O){if(typeof WeakMap!="function")return null;var y=new WeakMap,P=new WeakMap;return(i=function(g){return g?P:y})(O)}function o(O,y){if(O&&O.__esModule)return O;if(O===null||s(O)!="object"&&typeof O!="function")return{default:O};var P=i(y);if(P&&P.has(O))return P.get(O);var m={__proto__:null},g=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var p in O)if(p!=="default"&&{}.hasOwnProperty.call(O,p)){var b=g?Object.getOwnPropertyDescriptor(O,p):null;b&&(b.get||b.set)?Object.defineProperty(m,p,b):m[p]=O[p]}return m.default=O,P&&P.set(O,m),m}function s(O){"@babel/helpers - typeof";return s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(y){return typeof y}:function(y){return y&&typeof Symbol=="function"&&y.constructor===Symbol&&y!==Symbol.prototype?"symbol":typeof y},s(O)}function c(O){if(!(s(O)!=="object"||!O.RTCPeerConnection)){if("getLocalStreams"in O.RTCPeerConnection.prototype||(O.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in O.RTCPeerConnection.prototype)){var y=O.RTCPeerConnection.prototype.addTrack;O.RTCPeerConnection.prototype.addStream=function(m){var g=this;this._localStreams||(this._localStreams=[]),this._localStreams.includes(m)||this._localStreams.push(m),m.getAudioTracks().forEach(function(p){return y.call(g,p,m)}),m.getVideoTracks().forEach(function(p){return y.call(g,p,m)})},O.RTCPeerConnection.prototype.addTrack=function(m){for(var g=this,p=arguments.length,b=new Array(p>1?p-1:0),I=1;I<p;I++)b[I-1]=arguments[I];return b&&b.forEach(function(F){g._localStreams?g._localStreams.includes(F)||g._localStreams.push(F):g._localStreams=[F]}),y.apply(this,arguments)}}"removeStream"in O.RTCPeerConnection.prototype||(O.RTCPeerConnection.prototype.removeStream=function(m){var g=this;this._localStreams||(this._localStreams=[]);var p=this._localStreams.indexOf(m);if(p!==-1){this._localStreams.splice(p,1);var b=m.getTracks();this.getSenders().forEach(function(I){b.includes(I.track)&&g.removeTrack(I)})}})}}function f(O){if(!(s(O)!=="object"||!O.RTCPeerConnection)&&("getRemoteStreams"in O.RTCPeerConnection.prototype||(O.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in O.RTCPeerConnection.prototype))){Object.defineProperty(O.RTCPeerConnection.prototype,"onaddstream",{get:function(){return this._onaddstream},set:function(m){var g=this;this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=m),this.addEventListener("track",this._onaddstreampoly=function(p){p.streams.forEach(function(b){if(g._remoteStreams||(g._remoteStreams=[]),!g._remoteStreams.includes(b)){g._remoteStreams.push(b);var I=new Event("addstream");I.stream=b,g.dispatchEvent(I)}})})}});var y=O.RTCPeerConnection.prototype.setRemoteDescription;O.RTCPeerConnection.prototype.setRemoteDescription=function(){var m=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(g){g.streams.forEach(function(p){if(m._remoteStreams||(m._remoteStreams=[]),!(m._remoteStreams.indexOf(p)>=0)){m._remoteStreams.push(p);var b=new Event("addstream");b.stream=p,m.dispatchEvent(b)}})}),y.apply(m,arguments)}}}function d(O){if(!(s(O)!=="object"||!O.RTCPeerConnection)){var y=O.RTCPeerConnection.prototype,P=y.createOffer,m=y.createAnswer,g=y.setLocalDescription,p=y.setRemoteDescription,b=y.addIceCandidate;y.createOffer=function(j,A){var G=arguments.length>=2?arguments[2]:arguments[0],S=P.apply(this,[G]);return A?(S.then(j,A),Promise.resolve()):S},y.createAnswer=function(j,A){var G=arguments.length>=2?arguments[2]:arguments[0],S=m.apply(this,[G]);return A?(S.then(j,A),Promise.resolve()):S};var I=function(j,A,G){var S=g.apply(this,[j]);return G?(S.then(A,G),Promise.resolve()):S};y.setLocalDescription=I,I=function(j,A,G){var S=p.apply(this,[j]);return G?(S.then(A,G),Promise.resolve()):S},y.setRemoteDescription=I,I=function(j,A,G){var S=b.apply(this,[j]);return G?(S.then(A,G),Promise.resolve()):S},y.addIceCandidate=I}}function v(O){var y=O&&O.navigator;if(y.mediaDevices&&y.mediaDevices.getUserMedia){var P=y.mediaDevices,m=P.getUserMedia.bind(P);y.mediaDevices.getUserMedia=function(g){return m(R(g))}}!y.getUserMedia&&y.mediaDevices&&y.mediaDevices.getUserMedia&&(y.getUserMedia=(function(p,b,I){y.mediaDevices.getUserMedia(p).then(b,I)}).bind(y))}function R(O){return O&&O.video!==void 0?Object.assign({},O,{video:r.compactObject(O.video)}):O}function D(O){if(O.RTCPeerConnection){var y=O.RTCPeerConnection;O.RTCPeerConnection=function(m,g){if(m&&m.iceServers){for(var p=[],b=0;b<m.iceServers.length;b++){var I=m.iceServers[b];I.urls===void 0&&I.url?(r.deprecated("RTCIceServer.url","RTCIceServer.urls"),I=JSON.parse(JSON.stringify(I)),I.urls=I.url,delete I.url,p.push(I)):p.push(m.iceServers[b])}m.iceServers=p}return new y(m,g)},O.RTCPeerConnection.prototype=y.prototype,"generateCertificate"in y&&Object.defineProperty(O.RTCPeerConnection,"generateCertificate",{get:function(){return y.generateCertificate}})}}function N(O){s(O)==="object"&&O.RTCTrackEvent&&"receiver"in O.RTCTrackEvent.prototype&&!("transceiver"in O.RTCTrackEvent.prototype)&&Object.defineProperty(O.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})}function M(O){var y=O.RTCPeerConnection.prototype.createOffer;O.RTCPeerConnection.prototype.createOffer=function(m){if(m){typeof m.offerToReceiveAudio<"u"&&(m.offerToReceiveAudio=!!m.offerToReceiveAudio);var g=this.getTransceivers().find(function(b){return b.receiver.track.kind==="audio"});m.offerToReceiveAudio===!1&&g?g.direction==="sendrecv"?g.setDirection?g.setDirection("sendonly"):g.direction="sendonly":g.direction==="recvonly"&&(g.setDirection?g.setDirection("inactive"):g.direction="inactive"):m.offerToReceiveAudio===!0&&!g&&this.addTransceiver("audio",{direction:"recvonly"}),typeof m.offerToReceiveVideo<"u"&&(m.offerToReceiveVideo=!!m.offerToReceiveVideo);var p=this.getTransceivers().find(function(b){return b.receiver.track.kind==="video"});m.offerToReceiveVideo===!1&&p?p.direction==="sendrecv"?p.setDirection?p.setDirection("sendonly"):p.direction="sendonly":p.direction==="recvonly"&&(p.setDirection?p.setDirection("inactive"):p.direction="inactive"):m.offerToReceiveVideo===!0&&!p&&this.addTransceiver("video",{direction:"recvonly"})}return y.apply(this,arguments)}}function H(O){s(O)!=="object"||O.AudioContext||(O.AudioContext=O.webkitAudioContext)}},{"../utils":10}],10:[function(n,e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.compactObject=y,t.deprecated=M,t.detectBrowser=H,t.disableLog=R,t.disableWarnings=D,t.extractVersion=d,t.filterStats=m,t.log=N,t.walkStats=P,t.wrapPeerConnectionEvent=v;function r(g,p,b){return p=i(p),p in g?Object.defineProperty(g,p,{value:b,enumerable:!0,configurable:!0,writable:!0}):g[p]=b,g}function i(g){var p=o(g,"string");return s(p)=="symbol"?p:p+""}function o(g,p){if(s(g)!="object"||!g)return g;var b=g[Symbol.toPrimitive];if(b!==void 0){var I=b.call(g,p);if(s(I)!="object")return I;throw new TypeError("@@toPrimitive must return a primitive value.")}return(p==="string"?String:Number)(g)}function s(g){"@babel/helpers - typeof";return s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(p){return typeof p}:function(p){return p&&typeof Symbol=="function"&&p.constructor===Symbol&&p!==Symbol.prototype?"symbol":typeof p},s(g)}var c=!0,f=!0;function d(g,p,b){var I=g.match(p);return I&&I.length>=b&&parseInt(I[b],10)}function v(g,p,b){if(g.RTCPeerConnection){var I=g.RTCPeerConnection.prototype,F=I.addEventListener;I.addEventListener=function(A,G){if(A!==p)return F.apply(this,arguments);var S=function(J){var q=b(J);q&&(G.handleEvent?G.handleEvent(q):G(q))};return this._eventMap=this._eventMap||{},this._eventMap[p]||(this._eventMap[p]=new Map),this._eventMap[p].set(G,S),F.apply(this,[A,S])};var j=I.removeEventListener;I.removeEventListener=function(A,G){if(A!==p||!this._eventMap||!this._eventMap[p])return j.apply(this,arguments);if(!this._eventMap[p].has(G))return j.apply(this,arguments);var S=this._eventMap[p].get(G);return this._eventMap[p].delete(G),this._eventMap[p].size===0&&delete this._eventMap[p],Object.keys(this._eventMap).length===0&&delete this._eventMap,j.apply(this,[A,S])},Object.defineProperty(I,"on"+p,{get:function(){return this["_on"+p]},set:function(G){this["_on"+p]&&(this.removeEventListener(p,this["_on"+p]),delete this["_on"+p]),G&&this.addEventListener(p,this["_on"+p]=G)},enumerable:!0,configurable:!0})}}function R(g){return typeof g!="boolean"?new Error("Argument type: "+s(g)+". Please use a boolean."):(c=g,g?"adapter.js logging disabled":"adapter.js logging enabled")}function D(g){return typeof g!="boolean"?new Error("Argument type: "+s(g)+". Please use a boolean."):(f=!g,"adapter.js deprecation warnings "+(g?"disabled":"enabled"))}function N(){if((typeof window>"u"?"undefined":s(window))==="object"){if(c)return;typeof console<"u"&&typeof console.log=="function"&&console.log.apply(console,arguments)}}function M(g,p){f&&console.warn(g+" is deprecated, please use "+p+" instead.")}function H(g){var p={browser:null,version:null};if(typeof g>"u"||!g.navigator||!g.navigator.userAgent)return p.browser="Not a browser.",p;var b=g.navigator;if(b.userAgentData&&b.userAgentData.brands){var I=b.userAgentData.brands.find(function(F){return F.brand==="Chromium"});if(I)return{browser:"chrome",version:parseInt(I.version,10)}}if(b.mozGetUserMedia)p.browser="firefox",p.version=d(b.userAgent,/Firefox\/(\d+)\./,1);else if(b.webkitGetUserMedia||g.isSecureContext===!1&&g.webkitRTCPeerConnection)p.browser="chrome",p.version=d(b.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(g.RTCPeerConnection&&b.userAgent.match(/AppleWebKit\/(\d+)\./))p.browser="safari",p.version=d(b.userAgent,/AppleWebKit\/(\d+)\./,1),p.supportsUnifiedPlan=g.RTCRtpTransceiver&&"currentDirection"in g.RTCRtpTransceiver.prototype;else return p.browser="Not a supported browser.",p;return p}function O(g){return Object.prototype.toString.call(g)==="[object Object]"}function y(g){return O(g)?Object.keys(g).reduce(function(p,b){var I=O(g[b]),F=I?y(g[b]):g[b],j=I&&!Object.keys(F).length;return F===void 0||j?p:Object.assign(p,r({},b,F))},{}):g}function P(g,p,b){!p||b.has(p.id)||(b.set(p.id,p),Object.keys(p).forEach(function(I){I.endsWith("Id")?P(g,g.get(p[I]),b):I.endsWith("Ids")&&p[I].forEach(function(F){P(g,g.get(F),b)})}))}function m(g,p,b){var I=b?"outbound-rtp":"inbound-rtp",F=new Map;if(p===null)return F;var j=[];return g.forEach(function(A){A.type==="track"&&A.trackIdentifier===p.id&&j.push(A)}),j.forEach(function(A){g.forEach(function(G){G.type===I&&G.trackId===A.id&&P(g,G,F)})}),F}},{}],11:[function(n,e,t){var r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},i={};i.generateIdentifier=function(){return Math.random().toString(36).substring(2,12)},i.localCName=i.generateIdentifier(),i.splitLines=function(o){return o.trim().split(`
|
6
|
+
`).map(function(s){return s.trim()})},i.splitSections=function(o){var s=o.split(`
|
7
|
+
m=`);return s.map(function(c,f){return(f>0?"m="+c:c).trim()+`\r
|
8
|
+
`})},i.getDescription=function(o){var s=i.splitSections(o);return s&&s[0]},i.getMediaSections=function(o){var s=i.splitSections(o);return s.shift(),s},i.matchPrefix=function(o,s){return i.splitLines(o).filter(function(c){return c.indexOf(s)===0})},i.parseCandidate=function(o){var s=void 0;o.indexOf("a=candidate:")===0?s=o.substring(12).split(" "):s=o.substring(10).split(" ");for(var c={foundation:s[0],component:{1:"rtp",2:"rtcp"}[s[1]]||s[1],protocol:s[2].toLowerCase(),priority:parseInt(s[3],10),ip:s[4],address:s[4],port:parseInt(s[5],10),type:s[7]},f=8;f<s.length;f+=2)switch(s[f]){case"raddr":c.relatedAddress=s[f+1];break;case"rport":c.relatedPort=parseInt(s[f+1],10);break;case"tcptype":c.tcpType=s[f+1];break;case"ufrag":c.ufrag=s[f+1],c.usernameFragment=s[f+1];break;default:c[s[f]]===void 0&&(c[s[f]]=s[f+1]);break}return c},i.writeCandidate=function(o){var s=[];s.push(o.foundation);var c=o.component;c==="rtp"?s.push(1):c==="rtcp"?s.push(2):s.push(c),s.push(o.protocol.toUpperCase()),s.push(o.priority),s.push(o.address||o.ip),s.push(o.port);var f=o.type;return s.push("typ"),s.push(f),f!=="host"&&o.relatedAddress&&o.relatedPort&&(s.push("raddr"),s.push(o.relatedAddress),s.push("rport"),s.push(o.relatedPort)),o.tcpType&&o.protocol.toLowerCase()==="tcp"&&(s.push("tcptype"),s.push(o.tcpType)),(o.usernameFragment||o.ufrag)&&(s.push("ufrag"),s.push(o.usernameFragment||o.ufrag)),"candidate:"+s.join(" ")},i.parseIceOptions=function(o){return o.substring(14).split(" ")},i.parseRtpMap=function(o){var s=o.substring(9).split(" "),c={payloadType:parseInt(s.shift(),10)};return s=s[0].split("/"),c.name=s[0],c.clockRate=parseInt(s[1],10),c.channels=s.length===3?parseInt(s[2],10):1,c.numChannels=c.channels,c},i.writeRtpMap=function(o){var s=o.payloadType;o.preferredPayloadType!==void 0&&(s=o.preferredPayloadType);var c=o.channels||o.numChannels||1;return"a=rtpmap:"+s+" "+o.name+"/"+o.clockRate+(c!==1?"/"+c:"")+`\r
|
9
|
+
`},i.parseExtmap=function(o){var s=o.substring(9).split(" ");return{id:parseInt(s[0],10),direction:s[0].indexOf("/")>0?s[0].split("/")[1]:"sendrecv",uri:s[1],attributes:s.slice(2).join(" ")}},i.writeExtmap=function(o){return"a=extmap:"+(o.id||o.preferredId)+(o.direction&&o.direction!=="sendrecv"?"/"+o.direction:"")+" "+o.uri+(o.attributes?" "+o.attributes:"")+`\r
|
10
|
+
`},i.parseFmtp=function(o){for(var s={},c=void 0,f=o.substring(o.indexOf(" ")+1).split(";"),d=0;d<f.length;d++)c=f[d].trim().split("="),s[c[0].trim()]=c[1];return s},i.writeFmtp=function(o){var s="",c=o.payloadType;if(o.preferredPayloadType!==void 0&&(c=o.preferredPayloadType),o.parameters&&Object.keys(o.parameters).length){var f=[];Object.keys(o.parameters).forEach(function(d){o.parameters[d]!==void 0?f.push(d+"="+o.parameters[d]):f.push(d)}),s+="a=fmtp:"+c+" "+f.join(";")+`\r
|
11
|
+
`}return s},i.parseRtcpFb=function(o){var s=o.substring(o.indexOf(" ")+1).split(" ");return{type:s.shift(),parameter:s.join(" ")}},i.writeRtcpFb=function(o){var s="",c=o.payloadType;return o.preferredPayloadType!==void 0&&(c=o.preferredPayloadType),o.rtcpFeedback&&o.rtcpFeedback.length&&o.rtcpFeedback.forEach(function(f){s+="a=rtcp-fb:"+c+" "+f.type+(f.parameter&&f.parameter.length?" "+f.parameter:"")+`\r
|
12
|
+
`}),s},i.parseSsrcMedia=function(o){var s=o.indexOf(" "),c={ssrc:parseInt(o.substring(7,s),10)},f=o.indexOf(":",s);return f>-1?(c.attribute=o.substring(s+1,f),c.value=o.substring(f+1)):c.attribute=o.substring(s+1),c},i.parseSsrcGroup=function(o){var s=o.substring(13).split(" ");return{semantics:s.shift(),ssrcs:s.map(function(c){return parseInt(c,10)})}},i.getMid=function(o){var s=i.matchPrefix(o,"a=mid:")[0];if(s)return s.substring(6)},i.parseFingerprint=function(o){var s=o.substring(14).split(" ");return{algorithm:s[0].toLowerCase(),value:s[1].toUpperCase()}},i.getDtlsParameters=function(o,s){var c=i.matchPrefix(o+s,"a=fingerprint:");return{role:"auto",fingerprints:c.map(i.parseFingerprint)}},i.writeDtlsParameters=function(o,s){var c="a=setup:"+s+`\r
|
13
|
+
`;return o.fingerprints.forEach(function(f){c+="a=fingerprint:"+f.algorithm+" "+f.value+`\r
|
14
|
+
`}),c},i.parseCryptoLine=function(o){var s=o.substring(9).split(" ");return{tag:parseInt(s[0],10),cryptoSuite:s[1],keyParams:s[2],sessionParams:s.slice(3)}},i.writeCryptoLine=function(o){return"a=crypto:"+o.tag+" "+o.cryptoSuite+" "+(r(o.keyParams)==="object"?i.writeCryptoKeyParams(o.keyParams):o.keyParams)+(o.sessionParams?" "+o.sessionParams.join(" "):"")+`\r
|
15
|
+
`},i.parseCryptoKeyParams=function(o){if(o.indexOf("inline:")!==0)return null;var s=o.substring(7).split("|");return{keyMethod:"inline",keySalt:s[0],lifeTime:s[1],mkiValue:s[2]?s[2].split(":")[0]:void 0,mkiLength:s[2]?s[2].split(":")[1]:void 0}},i.writeCryptoKeyParams=function(o){return o.keyMethod+":"+o.keySalt+(o.lifeTime?"|"+o.lifeTime:"")+(o.mkiValue&&o.mkiLength?"|"+o.mkiValue+":"+o.mkiLength:"")},i.getCryptoParameters=function(o,s){var c=i.matchPrefix(o+s,"a=crypto:");return c.map(i.parseCryptoLine)},i.getIceParameters=function(o,s){var c=i.matchPrefix(o+s,"a=ice-ufrag:")[0],f=i.matchPrefix(o+s,"a=ice-pwd:")[0];return c&&f?{usernameFragment:c.substring(12),password:f.substring(10)}:null},i.writeIceParameters=function(o){var s="a=ice-ufrag:"+o.usernameFragment+`\r
|
16
|
+
a=ice-pwd:`+o.password+`\r
|
17
|
+
`;return o.iceLite&&(s+=`a=ice-lite\r
|
18
|
+
`),s},i.parseRtpParameters=function(o){var s={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},c=i.splitLines(o),f=c[0].split(" ");s.profile=f[2];for(var d=3;d<f.length;d++){var v=f[d],R=i.matchPrefix(o,"a=rtpmap:"+v+" ")[0];if(R){var D=i.parseRtpMap(R),N=i.matchPrefix(o,"a=fmtp:"+v+" ");switch(D.parameters=N.length?i.parseFmtp(N[0]):{},D.rtcpFeedback=i.matchPrefix(o,"a=rtcp-fb:"+v+" ").map(i.parseRtcpFb),s.codecs.push(D),D.name.toUpperCase()){case"RED":case"ULPFEC":s.fecMechanisms.push(D.name.toUpperCase());break}}}i.matchPrefix(o,"a=extmap:").forEach(function(H){s.headerExtensions.push(i.parseExtmap(H))});var M=i.matchPrefix(o,"a=rtcp-fb:* ").map(i.parseRtcpFb);return s.codecs.forEach(function(H){M.forEach(function(O){var y=H.rtcpFeedback.find(function(P){return P.type===O.type&&P.parameter===O.parameter});y||H.rtcpFeedback.push(O)})}),s},i.writeRtpDescription=function(o,s){var c="";c+="m="+o+" ",c+=s.codecs.length>0?"9":"0",c+=" "+(s.profile||"UDP/TLS/RTP/SAVPF")+" ",c+=s.codecs.map(function(d){return d.preferredPayloadType!==void 0?d.preferredPayloadType:d.payloadType}).join(" ")+`\r
|
19
|
+
`,c+=`c=IN IP4 0.0.0.0\r
|
20
|
+
`,c+=`a=rtcp:9 IN IP4 0.0.0.0\r
|
21
|
+
`,s.codecs.forEach(function(d){c+=i.writeRtpMap(d),c+=i.writeFmtp(d),c+=i.writeRtcpFb(d)});var f=0;return s.codecs.forEach(function(d){d.maxptime>f&&(f=d.maxptime)}),f>0&&(c+="a=maxptime:"+f+`\r
|
22
|
+
`),s.headerExtensions&&s.headerExtensions.forEach(function(d){c+=i.writeExtmap(d)}),c},i.parseRtpEncodingParameters=function(o){var s=[],c=i.parseRtpParameters(o),f=c.fecMechanisms.indexOf("RED")!==-1,d=c.fecMechanisms.indexOf("ULPFEC")!==-1,v=i.matchPrefix(o,"a=ssrc:").map(function(H){return i.parseSsrcMedia(H)}).filter(function(H){return H.attribute==="cname"}),R=v.length>0&&v[0].ssrc,D=void 0,N=i.matchPrefix(o,"a=ssrc-group:FID").map(function(H){var O=H.substring(17).split(" ");return O.map(function(y){return parseInt(y,10)})});N.length>0&&N[0].length>1&&N[0][0]===R&&(D=N[0][1]),c.codecs.forEach(function(H){if(H.name.toUpperCase()==="RTX"&&H.parameters.apt){var O={ssrc:R,codecPayloadType:parseInt(H.parameters.apt,10)};R&&D&&(O.rtx={ssrc:D}),s.push(O),f&&(O=JSON.parse(JSON.stringify(O)),O.fec={ssrc:R,mechanism:d?"red+ulpfec":"red"},s.push(O))}}),s.length===0&&R&&s.push({ssrc:R});var M=i.matchPrefix(o,"b=");return M.length&&(M[0].indexOf("b=TIAS:")===0?M=parseInt(M[0].substring(7),10):M[0].indexOf("b=AS:")===0?M=parseInt(M[0].substring(5),10)*1e3*.95-50*40*8:M=void 0,s.forEach(function(H){H.maxBitrate=M})),s},i.parseRtcpParameters=function(o){var s={},c=i.matchPrefix(o,"a=ssrc:").map(function(v){return i.parseSsrcMedia(v)}).filter(function(v){return v.attribute==="cname"})[0];c&&(s.cname=c.value,s.ssrc=c.ssrc);var f=i.matchPrefix(o,"a=rtcp-rsize");s.reducedSize=f.length>0,s.compound=f.length===0;var d=i.matchPrefix(o,"a=rtcp-mux");return s.mux=d.length>0,s},i.writeRtcpParameters=function(o){var s="";return o.reducedSize&&(s+=`a=rtcp-rsize\r
|
23
|
+
`),o.mux&&(s+=`a=rtcp-mux\r
|
24
|
+
`),o.ssrc!==void 0&&o.cname&&(s+="a=ssrc:"+o.ssrc+" cname:"+o.cname+`\r
|
25
|
+
`),s},i.parseMsid=function(o){var s=void 0,c=i.matchPrefix(o,"a=msid:");if(c.length===1)return s=c[0].substring(7).split(" "),{stream:s[0],track:s[1]};var f=i.matchPrefix(o,"a=ssrc:").map(function(d){return i.parseSsrcMedia(d)}).filter(function(d){return d.attribute==="msid"});if(f.length>0)return s=f[0].value.split(" "),{stream:s[0],track:s[1]}},i.parseSctpDescription=function(o){var s=i.parseMLine(o),c=i.matchPrefix(o,"a=max-message-size:"),f=void 0;c.length>0&&(f=parseInt(c[0].substring(19),10)),isNaN(f)&&(f=65536);var d=i.matchPrefix(o,"a=sctp-port:");if(d.length>0)return{port:parseInt(d[0].substring(12),10),protocol:s.fmt,maxMessageSize:f};var v=i.matchPrefix(o,"a=sctpmap:");if(v.length>0){var R=v[0].substring(10).split(" ");return{port:parseInt(R[0],10),protocol:R[1],maxMessageSize:f}}},i.writeSctpDescription=function(o,s){var c=[];return o.protocol!=="DTLS/SCTP"?c=["m="+o.kind+" 9 "+o.protocol+" "+s.protocol+`\r
|
26
|
+
`,`c=IN IP4 0.0.0.0\r
|
27
|
+
`,"a=sctp-port:"+s.port+`\r
|
28
|
+
`]:c=["m="+o.kind+" 9 "+o.protocol+" "+s.port+`\r
|
29
|
+
`,`c=IN IP4 0.0.0.0\r
|
30
|
+
`,"a=sctpmap:"+s.port+" "+s.protocol+` 65535\r
|
31
|
+
`],s.maxMessageSize!==void 0&&c.push("a=max-message-size:"+s.maxMessageSize+`\r
|
32
|
+
`),c.join("")},i.generateSessionId=function(){return Math.random().toString().substr(2,22)},i.writeSessionBoilerplate=function(o,s,c){var f=void 0,d=s!==void 0?s:2;o?f=o:f=i.generateSessionId();var v=c||"thisisadapterortc";return`v=0\r
|
33
|
+
o=`+v+" "+f+" "+d+` IN IP4 127.0.0.1\r
|
34
|
+
s=-\r
|
35
|
+
t=0 0\r
|
36
|
+
`},i.getDirection=function(o,s){for(var c=i.splitLines(o),f=0;f<c.length;f++)switch(c[f]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return c[f].substring(2)}return s?i.getDirection(s):"sendrecv"},i.getKind=function(o){var s=i.splitLines(o),c=s[0].split(" ");return c[0].substring(2)},i.isRejected=function(o){return o.split(" ",2)[1]==="0"},i.parseMLine=function(o){var s=i.splitLines(o),c=s[0].substring(2).split(" ");return{kind:c[0],port:parseInt(c[1],10),protocol:c[2],fmt:c.slice(3).join(" ")}},i.parseOLine=function(o){var s=i.matchPrefix(o,"o=")[0],c=s.substring(2).split(" ");return{username:c[0],sessionId:c[1],sessionVersion:parseInt(c[2],10),netType:c[3],addressType:c[4],address:c[5]}},i.isValidSDP=function(o){if(typeof o!="string"||o.length===0)return!1;for(var s=i.splitLines(o),c=0;c<s.length;c++)if(s[c].length<2||s[c].charAt(1)!=="=")return!1;return!0},(typeof e>"u"?"undefined":r(e))==="object"&&(e.exports=i)},{}]},{},[1])(1)});function ht(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Ve={exports:{}},Me={};/**
|
37
|
+
* @license React
|
38
|
+
* react-jsx-runtime.production.js
|
39
|
+
*
|
40
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
41
|
+
*
|
42
|
+
* This source code is licensed under the MIT license found in the
|
43
|
+
* LICENSE file in the root directory of this source tree.
|
44
|
+
*/var gt;function Ar(){if(gt)return Me;gt=1;var n=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(r,i,o){var s=null;if(o!==void 0&&(s=""+o),i.key!==void 0&&(s=""+i.key),"key"in i){o={};for(var c in i)c!=="key"&&(o[c]=i[c])}else o=i;return i=o.ref,{$$typeof:n,type:r,key:s,ref:i!==void 0?i:null,props:o}}return Me.Fragment=e,Me.jsx=t,Me.jsxs=t,Me}var De={};/**
|
45
|
+
* @license React
|
46
|
+
* react-jsx-runtime.development.js
|
47
|
+
*
|
48
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
49
|
+
*
|
50
|
+
* This source code is licensed under the MIT license found in the
|
51
|
+
* LICENSE file in the root directory of this source tree.
|
52
|
+
*/var vt;function Ir(){return vt||(vt=1,process.env.NODE_ENV!=="production"&&function(){function n(a){if(a==null)return null;if(typeof a=="function")return a.$$typeof===Q?null:a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case b:return"Fragment";case p:return"Portal";case F:return"Profiler";case I:return"StrictMode";case S:return"Suspense";case k:return"SuspenseList"}if(typeof a=="object")switch(typeof a.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),a.$$typeof){case A:return(a.displayName||"Context")+".Provider";case j:return(a._context.displayName||"Context")+".Consumer";case G:var l=a.render;return a=a.displayName,a||(a=l.displayName||l.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case J:return l=a.displayName||null,l!==null?l:n(a.type)||"Memo";case q:l=a._payload,a=a._init;try{return n(a(l))}catch{}}return null}function e(a){return""+a}function t(a){try{e(a);var l=!1}catch{l=!0}if(l){l=console;var h=l.error,u=typeof Symbol=="function"&&Symbol.toStringTag&&a[Symbol.toStringTag]||a.constructor.name||"Object";return h.call(l,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",u),e(a)}}function r(){}function i(){if($===0){w=console.log,fe=console.info,he=console.warn,le=console.error,je=console.group,Ee=console.groupCollapsed,Le=console.groupEnd;var a={configurable:!0,enumerable:!0,value:r,writable:!0};Object.defineProperties(console,{info:a,log:a,warn:a,error:a,group:a,groupCollapsed:a,groupEnd:a})}$++}function o(){if($--,$===0){var a={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:ie({},a,{value:w}),info:ie({},a,{value:fe}),warn:ie({},a,{value:he}),error:ie({},a,{value:le}),group:ie({},a,{value:je}),groupCollapsed:ie({},a,{value:Ee}),groupEnd:ie({},a,{value:Le})})}0>$&&console.error("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}function s(a){if(Oe===void 0)try{throw Error()}catch(h){var l=h.stack.trim().match(/\n( *(at )?)/);Oe=l&&l[1]||"",ge=-1<h.stack.indexOf(`
|
53
|
+
at`)?" (<anonymous>)":-1<h.stack.indexOf("@")?"@unknown:0:0":""}return`
|
54
|
+
`+Oe+a+ge}function c(a,l){if(!a||ye)return"";var h=pe.get(a);if(h!==void 0)return h;ye=!0,h=Error.prepareStackTrace,Error.prepareStackTrace=void 0;var u=null;u=te.H,te.H=null,i();try{var E={DetermineComponentFrameRoot:function(){try{if(l){var Y=function(){throw Error()};if(Object.defineProperty(Y.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Y,[])}catch(se){var Z=se}Reflect.construct(a,[],Y)}else{try{Y.call()}catch(se){Z=se}a.call(Y.prototype)}}else{try{throw Error()}catch(se){Z=se}(Y=a())&&typeof Y.catch=="function"&&Y.catch(function(){})}}catch(se){if(se&&Z&&typeof se.stack=="string")return[se.stack,Z.stack]}return[null,null]}};E.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var _=Object.getOwnPropertyDescriptor(E.DetermineComponentFrameRoot,"name");_&&_.configurable&&Object.defineProperty(E.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var C=E.DetermineComponentFrameRoot(),U=C[0],L=C[1];if(U&&L){var T=U.split(`
|
55
|
+
`),x=L.split(`
|
56
|
+
`);for(C=_=0;_<T.length&&!T[_].includes("DetermineComponentFrameRoot");)_++;for(;C<x.length&&!x[C].includes("DetermineComponentFrameRoot");)C++;if(_===T.length||C===x.length)for(_=T.length-1,C=x.length-1;1<=_&&0<=C&&T[_]!==x[C];)C--;for(;1<=_&&0<=C;_--,C--)if(T[_]!==x[C]){if(_!==1||C!==1)do if(_--,C--,0>C||T[_]!==x[C]){var z=`
|
57
|
+
`+T[_].replace(" at new "," at ");return a.displayName&&z.includes("<anonymous>")&&(z=z.replace("<anonymous>",a.displayName)),typeof a=="function"&&pe.set(a,z),z}while(1<=_&&0<=C);break}}}finally{ye=!1,te.H=u,o(),Error.prepareStackTrace=h}return T=(T=a?a.displayName||a.name:"")?s(T):"",typeof a=="function"&&pe.set(a,T),T}function f(a){if(a==null)return"";if(typeof a=="function"){var l=a.prototype;return c(a,!(!l||!l.isReactComponent))}if(typeof a=="string")return s(a);switch(a){case S:return s("Suspense");case k:return s("SuspenseList")}if(typeof a=="object")switch(a.$$typeof){case G:return a=c(a.render,!1),a;case J:return f(a.type);case q:l=a._payload,a=a._init;try{return f(a(l))}catch{}}return""}function d(){var a=te.A;return a===null?null:a.getOwner()}function v(a){if(ne.call(a,"key")){var l=Object.getOwnPropertyDescriptor(a,"key").get;if(l&&l.isReactWarning)return!1}return a.key!==void 0}function R(a,l){function h(){Ne||(Ne=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",l))}h.isReactWarning=!0,Object.defineProperty(a,"key",{get:h,configurable:!0})}function D(){var a=n(this.type);return Ue[a]||(Ue[a]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),a=this.props.ref,a!==void 0?a:null}function N(a,l,h,u,E,_){return h=_.ref,a={$$typeof:g,type:a,key:l,props:_,_owner:E},(h!==void 0?h:null)!==null?Object.defineProperty(a,"ref",{enumerable:!1,get:D}):Object.defineProperty(a,"ref",{enumerable:!1,value:null}),a._store={},Object.defineProperty(a._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(a,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.freeze&&(Object.freeze(a.props),Object.freeze(a)),a}function M(a,l,h,u,E,_){if(typeof a=="string"||typeof a=="function"||a===b||a===F||a===I||a===S||a===k||a===B||typeof a=="object"&&a!==null&&(a.$$typeof===q||a.$$typeof===J||a.$$typeof===A||a.$$typeof===j||a.$$typeof===G||a.$$typeof===ue||a.getModuleId!==void 0)){var C=l.children;if(C!==void 0)if(u)if(W(C)){for(u=0;u<C.length;u++)H(C[u],a);Object.freeze&&Object.freeze(C)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else H(C,a)}else C="",(a===void 0||typeof a=="object"&&a!==null&&Object.keys(a).length===0)&&(C+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."),a===null?u="null":W(a)?u="array":a!==void 0&&a.$$typeof===g?(u="<"+(n(a.type)||"Unknown")+" />",C=" Did you accidentally export a JSX literal instead of a component?"):u=typeof a,console.error("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",u,C);if(ne.call(l,"key")){C=n(a);var U=Object.keys(l).filter(function(T){return T!=="key"});u=0<U.length?"{key: someKey, "+U.join(": ..., ")+": ...}":"{key: someKey}",xe[C+u]||(U=0<U.length?"{"+U.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
58
|
+
let props = %s;
|
59
|
+
<%s {...props} />
|
60
|
+
React keys must be passed directly to JSX without using spread:
|
61
|
+
let props = %s;
|
62
|
+
<%s key={someKey} {...props} />`,u,C,U,C),xe[C+u]=!0)}if(C=null,h!==void 0&&(t(h),C=""+h),v(l)&&(t(l.key),C=""+l.key),"key"in l){h={};for(var L in l)L!=="key"&&(h[L]=l[L])}else h=l;return C&&R(h,typeof a=="function"?a.displayName||a.name||"Unknown":a),N(a,C,_,E,d(),h)}function H(a,l){if(typeof a=="object"&&a&&a.$$typeof!==$e){if(W(a))for(var h=0;h<a.length;h++){var u=a[h];O(u)&&y(u,l)}else if(O(a))a._store&&(a._store.validated=1);else if(a===null||typeof a!="object"?h=null:(h=K&&a[K]||a["@@iterator"],h=typeof h=="function"?h:null),typeof h=="function"&&h!==a.entries&&(h=h.call(a),h!==a))for(;!(a=h.next()).done;)O(a.value)&&y(a.value,l)}}function O(a){return typeof a=="object"&&a!==null&&a.$$typeof===g}function y(a,l){if(a._store&&!a._store.validated&&a.key==null&&(a._store.validated=1,l=P(l),!Ye[l])){Ye[l]=!0;var h="";a&&a._owner!=null&&a._owner!==d()&&(h=null,typeof a._owner.tag=="number"?h=n(a._owner.type):typeof a._owner.name=="string"&&(h=a._owner.name),h=" It was passed a child from "+h+".");var u=te.getCurrentStack;te.getCurrentStack=function(){var E=f(a.type);return u&&(E+=u()||""),E},console.error('Each child in a list should have a unique "key" prop.%s%s See https://react.dev/link/warning-keys for more information.',l,h),te.getCurrentStack=u}}function P(a){var l="",h=d();return h&&(h=n(h.type))&&(l=`
|
63
|
+
|
64
|
+
Check the render method of \``+h+"`."),l||(a=n(a))&&(l=`
|
65
|
+
|
66
|
+
Check the top-level render call using <`+a+">."),l}var m=re,g=Symbol.for("react.transitional.element"),p=Symbol.for("react.portal"),b=Symbol.for("react.fragment"),I=Symbol.for("react.strict_mode"),F=Symbol.for("react.profiler"),j=Symbol.for("react.consumer"),A=Symbol.for("react.context"),G=Symbol.for("react.forward_ref"),S=Symbol.for("react.suspense"),k=Symbol.for("react.suspense_list"),J=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),B=Symbol.for("react.offscreen"),K=Symbol.iterator,Q=Symbol.for("react.client.reference"),te=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ne=Object.prototype.hasOwnProperty,ie=Object.assign,ue=Symbol.for("react.client.reference"),W=Array.isArray,$=0,w,fe,he,le,je,Ee,Le;r.__reactDisabledLog=!0;var Oe,ge,ye=!1,pe=new(typeof WeakMap=="function"?WeakMap:Map),$e=Symbol.for("react.client.reference"),Ne,Ue={},xe={},Ye={};De.Fragment=b,De.jsx=function(a,l,h,u,E){return M(a,l,h,!1,u,E)},De.jsxs=function(a,l,h,u,E){return M(a,l,h,!0,u,E)}}()),De}var yt;function jr(){return yt||(yt=1,process.env.NODE_ENV==="production"?Ve.exports=Ar():Ve.exports=Ir()),Ve.exports}var ee=jr(),Ct=function(n){if(typeof define=="function"&&define.amd)define(n);else if(typeof module=="object"&&module.exports)module.exports=n();else if(typeof window=="object")return n()}(function(){e.sessions=new Map,e.isExtensionEnabled=function(){if(navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia)return!0;if(window.navigator.userAgent.match("Chrome")){let t=parseInt(window.navigator.userAgent.match(/Chrome\/(.*) /)[1],10),r=33;return window.navigator.userAgent.match("Linux")&&(r=35),t>=26&&t<=r?!0:e.extension.isInstalled()}else return!0};var n={extensionId:"hapfgfdkleiggjjpfpenajgdnfckjpaj",isInstalled:function(){return document.querySelector("#janus-extension-installed")!==null},getScreen:function(t){let r=window.setTimeout(function(){let i=new Error("NavigatorUserMediaError");return i.name='The required Chrome extension is not installed: click <a href="#">here</a> to install it. (NOTE: this will need you to refresh the page)',t(i)},1e3);this.cache[r]=t,window.postMessage({type:"janusGetScreen",id:r},"*")},init:function(){let t={};this.cache=t,window.addEventListener("message",function(r){if(r.origin==window.location.origin)if(r.data.type=="janusGotScreen"&&t[r.data.id]){let i=t[r.data.id];if(delete t[r.data.id],r.data.sourceId===""){let o=new Error("NavigatorUserMediaError");o.name="You cancelled the request for permission, giving up...",i(o)}else i(null,r.data.sourceId)}else r.data.type=="janusGetScreenPending"&&window.clearTimeout(r.data.id)})}};e.useDefaultDependencies=function(t){let r=t&&t.fetch||fetch,i=t&&t.Promise||Promise,o=t&&t.WebSocket||WebSocket;return{newWebSocket:function(s,c){return new o(s,c)},extension:t&&t.extension||n,isArray:function(s){return Array.isArray(s)},webRTCAdapter:t&&t.adapter||adapter,httpAPICall:function(s,c){let f={method:c.verb,headers:{Accept:"application/json, text/plain, */*"},cache:"no-cache"};c.verb==="POST"&&(f.headers["Content-Type"]="application/json"),typeof c.withCredentials<"u"&&(f.credentials=c.withCredentials===!0?"include":c.withCredentials?c.withCredentials:"omit"),c.body&&(f.body=JSON.stringify(c.body));let d=r(s,f).catch(function(v){return i.reject({message:"Probably a network error, is the server down?",error:v})});if(c.timeout){let v=new i(function(R,D){let N=setTimeout(function(){return clearTimeout(N),D({message:"Request timed out",timeout:c.timeout})},c.timeout)});d=i.race([d,v])}return d.then(function(v){if(v.ok){if(typeof c.success==typeof e.noop)return v.json().then(function(R){try{c.success(R)}catch(D){e.error("Unhandled httpAPICall success callback error",D)}},function(R){return i.reject({message:"Failed to parse response body",error:R,response:v})})}else return i.reject({message:"API call failed",response:v})}).catch(function(v){typeof c.error==typeof e.noop&&c.error(v.message||"<< internal error >>",v)}),d}}},e.useOldDependencies=function(t){let r=t&&t.jQuery||jQuery,i=t&&t.WebSocket||WebSocket;return{newWebSocket:function(o,s){return new i(o,s)},isArray:function(o){return r.isArray(o)},extension:t&&t.extension||n,webRTCAdapter:t&&t.adapter||adapter,httpAPICall:function(o,s){let c=typeof s.body<"u"?{contentType:"application/json",data:JSON.stringify(s.body)}:{},f=typeof s.withCredentials<"u"?{xhrFields:{withCredentials:s.withCredentials}}:{};return r.ajax(r.extend(c,f,{url:o,type:s.verb,cache:!1,dataType:"json",async:s.async,timeout:s.timeout,success:function(d){typeof s.success==typeof e.noop&&s.success(d)},error:function(d,v,R){typeof s.error==typeof e.noop&&s.error(v,R)}}))}}},e.mediaToTracks=function(t){let r=[];if(!t)r.push({type:"audio",capture:!0,recv:!0}),r.push({type:"video",capture:!0,recv:!0});else{if(!t.keepAudio&&t.audio!==!1&&(typeof t.audio>"u"||t.audio||t.audioSend||t.audioRecv||t.addAudio||t.replaceAudio||t.removeAudio)){let i={type:"audio"};t.removeAudio?i.remove=!0:(t.addAudio?i.add=!0:t.replaceAudio&&(i.replace=!0),t.audioSend!==!1&&(i.capture=t.audio||!0),t.audioRecv!==!1&&(i.recv=!0)),(i.remove||i.capture||i.recv)&&r.push(i)}if(!t.keepVideo&&t.video!==!1&&(typeof t.video>"u"||t.video||t.videoSend||t.videoRecv||t.addVideo||t.replaceVideo||t.removeVideo)){let i={type:"video"};t.removeVideo?i.remove=!0:(t.addVideo?i.add=!0:t.replaceVideo&&(i.replace=!0),t.videoSend!==!1&&(i.capture=t.video||!0,["screen","window","desktop"].includes(i.capture)&&(i.type="screen",i.capture={video:{}},t.screenshareFrameRate&&(i.capture.frameRate=t.screenshareFrameRate),t.screenshareHeight&&(i.capture.height=t.screenshareHeight),t.screenshareWidth&&(i.capture.width=t.screenshareWidth))),t.videoRecv!==!1&&(i.recv=!0)),(i.remove||i.capture||i.recv)&&r.push(i)}t.data&&r.push({type:"data"})}return r},e.trackConstraints=function(t){let r={};if(!t||!t.capture)return r;if(t.type==="audio")r.audio=t.capture;else if(t.type==="video")if((t.simulcast||t.svc)&&t.capture===!0&&(t.capture="hires"),t.capture===!0||typeof t.capture=="object")r.video=t.capture;else{let i=0,o=0;t.capture==="lowres"?(i=320,o=240):t.capture==="lowres-16:9"?(i=320,o=180):t.capture==="hires"||t.capture==="hires-16:9"||t.capture==="hdres"?(i=1280,o=720):t.capture==="fhdres"?(i=1920,o=1080):t.capture==="4kres"?(i=3840,o=2160):t.capture==="stdres"?(i=640,o=480):t.capture==="stdres-16:9"?(i=640,o=360):(e.log("Default video setting is stdres 4:3"),i=640,o=480),r.video={width:{ideal:i},height:{ideal:o}}}else t.type==="screen"&&(r.video=t.capture);return r},e.noop=function(){},e.dataChanDefaultLabel="JanusDataChannel",e.endOfCandidates=null,e.stopAllTracks=function(t){try{let r=t.getTracks();for(let i of r)e.log(i),i&&i.dontStop!==!0&&i.stop()}catch{}},e.init=function(t){if(t=t||{},t.callback=typeof t.callback=="function"?t.callback:e.noop,e.initDone)t.callback();else{if(typeof console.log>"u"&&(console.log=function(){}),e.trace=e.noop,e.debug=e.noop,e.vdebug=e.noop,e.log=e.noop,e.warn=e.noop,e.error=e.noop,t.debug===!0||t.debug==="all")e.trace=console.trace.bind(console),e.debug=console.debug.bind(console),e.vdebug=console.debug.bind(console),e.log=console.log.bind(console),e.warn=console.warn.bind(console),e.error=console.error.bind(console);else if(Array.isArray(t.debug))for(let c of t.debug)switch(c){case"trace":e.trace=console.trace.bind(console);break;case"debug":e.debug=console.debug.bind(console);break;case"vdebug":e.vdebug=console.debug.bind(console);break;case"log":e.log=console.log.bind(console);break;case"warn":e.warn=console.warn.bind(console);break;case"error":e.error=console.error.bind(console);break}e.log("Initializing library");let r=t.dependencies||e.useDefaultDependencies();e.isArray=r.isArray,e.webRTCAdapter=r.webRTCAdapter,e.httpAPICall=r.httpAPICall,e.newWebSocket=r.newWebSocket,e.extension=r.extension,e.extension.init(),e.listDevices=function(c,f){c=typeof c=="function"?c:e.noop,f||(f={audio:!0,video:!0}),e.isGetUserMediaAvailable()?navigator.mediaDevices.getUserMedia(f).then(function(d){navigator.mediaDevices.enumerateDevices().then(function(v){e.debug(v),c(v),e.stopAllTracks(d)})}).catch(function(d){e.error(d),c([])}):(e.warn("navigator.mediaDevices unavailable"),c([]))},e.attachMediaStream=function(c,f){try{c.srcObject=f}catch{try{c.src=URL.createObjectURL(f)}catch(v){e.error("Error attaching stream to element",v)}}},e.reattachMediaStream=function(c,f){try{c.srcObject=f.srcObject}catch{try{c.src=f.src}catch(v){e.error("Error reattaching stream to element",v)}}};let o=["iPad","iPhone","iPod"].indexOf(navigator.platform)>=0?"pagehide":"beforeunload",s=window["on"+o];if(window.addEventListener(o,function(){e.log("Closing window");for(const[c,f]of e.sessions)f&&f.destroyOnUnload&&(e.log("Destroying session "+c),f.destroy({unload:!0,notifyDestroyed:!1}));s&&typeof s=="function"&&s()}),e.safariVp8=!1,e.safariVp9=!1,e.webRTCAdapter.browserDetails.browser==="safari"&&e.webRTCAdapter.browserDetails.version>=605)if(RTCRtpSender&&RTCRtpSender.getCapabilities&&RTCRtpSender.getCapabilities("video")&&RTCRtpSender.getCapabilities("video").codecs&&RTCRtpSender.getCapabilities("video").codecs.length){for(let c of RTCRtpSender.getCapabilities("video").codecs)c&&c.mimeType&&c.mimeType.toLowerCase()==="video/vp8"?e.safariVp8=!0:c&&c.mimeType&&c.mimeType.toLowerCase()==="video/vp9"&&(e.safariVp9=!0);e.safariVp8?e.log("This version of Safari supports VP8"):e.warn("This version of Safari does NOT support VP8: if you're using a Technology Preview, try enabling the 'WebRTC VP8 codec' setting in the 'Experimental Features' Develop menu")}else{let c=new RTCPeerConnection({});c.createOffer({offerToReceiveVideo:!0}).then(function(f){e.safariVp8=f.sdp.indexOf("VP8")!==-1,e.safariVp9=f.sdp.indexOf("VP9")!==-1,e.safariVp8?e.log("This version of Safari supports VP8"):e.warn("This version of Safari does NOT support VP8: if you're using a Technology Preview, try enabling the 'WebRTC VP8 codec' setting in the 'Experimental Features' Develop menu"),c.close(),c=null})}e.initDone=!0,t.callback()}},e.isWebrtcSupported=function(){return!!window.RTCPeerConnection},e.isGetUserMediaAvailable=function(){return navigator.mediaDevices&&navigator.mediaDevices.getUserMedia},e.randomString=function(t){let r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i="";for(let o=0;o<t;o++){let s=Math.floor(Math.random()*r.length);i+=r.charAt(s)}return i};function e(t){if(t=t||{},t.success=typeof t.success=="function"?t.success:e.noop,t.error=typeof t.error=="function"?t.error:e.noop,t.destroyed=typeof t.destroyed=="function"?t.destroyed:e.noop,!e.initDone)return t.error("Library not initialized"),{};if(!e.isWebrtcSupported())return t.error("WebRTC not supported by this browser"),{};if(e.log("Library initialized: "+e.initDone),!t.server)return t.error("Invalid server url"),{};let r=!1,i=null,o={},s=null,c=null,f=0,d=t.server;e.isArray(d)?(e.log("Multiple servers provided ("+d.length+"), will use the first that works"),d=null,c=t.server,e.debug(c)):d.indexOf("ws")===0?(r=!0,e.log("Using WebSockets to contact Janus: "+d)):(r=!1,e.log("Using REST API to contact Janus: "+d));let v=t.iceServers||[{urls:"stun:stun.l.google.com:19302"}],R=t.iceTransportPolicy,D=t.bundlePolicy,N=!1;typeof t.withCredentials<"u"&&t.withCredentials!==null&&(N=t.withCredentials===!0);let M=10;typeof t.max_poll_events<"u"&&t.max_poll_events!==null&&(M=t.max_poll_events),M<1&&(M=1);let H=null;typeof t.token<"u"&&t.token!==null&&(H=t.token);let O=null;typeof t.apisecret<"u"&&t.apisecret!==null&&(O=t.apisecret),this.destroyOnUnload=!0,typeof t.destroyOnUnload<"u"&&t.destroyOnUnload!==null&&(this.destroyOnUnload=t.destroyOnUnload===!0);let y=25e3;typeof t.keepAlivePeriod<"u"&&t.keepAlivePeriod!==null&&(y=t.keepAlivePeriod),isNaN(y)&&(y=25e3);let P=6e4;typeof t.longPollTimeout<"u"&&t.longPollTimeout!==null&&(P=t.longPollTimeout),isNaN(P)&&(P=6e4);function m(a){let l={high:9e5,medium:3e5,low:1e5};return typeof a<"u"&&a!==null&&(a.high&&(l.high=a.high),a.medium&&(l.medium=a.medium),a.low&&(l.low=a.low)),l}let g=!1,p=null,b=new Map,I=this,F=0,j=new Map;k(t),this.getServer=function(){return d},this.isConnected=function(){return g},this.reconnect=function(a){a=a||{},a.success=typeof a.success=="function"?a.success:e.noop,a.error=typeof a.error=="function"?a.error:e.noop,a.reconnect=!0,k(a)},this.getSessionId=function(){return p},this.getInfo=function(a){J(a)},this.destroy=function(a){q(a)},this.attach=function(a){B(a)};function A(){if(p==null)return;if(e.debug("Long poll..."),!g){e.warn("Is the server down? (connected=false)");return}let a=d+"/"+p+"?rid="+new Date().getTime();M&&(a=a+"&maxev="+M),H&&(a=a+"&token="+encodeURIComponent(H)),O&&(a=a+"&apisecret="+encodeURIComponent(O)),e.httpAPICall(a,{verb:"GET",withCredentials:N,success:G,timeout:P,error:function(l,h){if(e.error(l+":",h),F++,F>3){g=!1,t.error("Lost connection to the server (is it down?)");return}A()}})}function G(a,l){if(F=0,!r&&typeof p<"u"&&p!==null&&l!==!0&&A(),!r&&e.isArray(a)){for(let h=0;h<a.length;h++)G(a[h],!0);return}if(a.janus==="keepalive"){e.vdebug("Got a keepalive on session "+p);return}else if(a.janus==="server_info"){e.debug("Got info on the Janus instance"),e.debug(a);const h=a.transaction;if(h){const u=j.get(h);u&&u(a),j.delete(h)}return}else if(a.janus==="ack"){e.debug("Got an ack on session "+p),e.debug(a);const h=a.transaction;if(h){const u=j.get(h);u&&u(a),j.delete(h)}return}else if(a.janus==="success"){e.debug("Got a success on session "+p),e.debug(a);const h=a.transaction;if(h){const u=j.get(h);u&&u(a),j.delete(h)}return}else if(a.janus==="trickle"){const h=a.sender;if(!h){e.warn("Missing sender...");return}const u=b.get(h);if(!u){e.debug("This handle is not attached to this session");return}let E=a.candidate;e.debug("Got a trickled candidate on session "+p),e.debug(E);let _=u.webrtcStuff;_.pc&&_.remoteSdp?(e.debug("Adding remote candidate:",E),!E||E.completed===!0?_.pc.addIceCandidate(e.endOfCandidates):_.pc.addIceCandidate(E)):(e.debug("We didn't do setRemoteDescription (trickle got here before the offer?), caching candidate"),_.candidates||(_.candidates=[]),_.candidates.push(E),e.debug(_.candidates))}else if(a.janus==="webrtcup"){e.debug("Got a webrtcup event on session "+p),e.debug(a);const h=a.sender;if(!h){e.warn("Missing sender...");return}const u=b.get(h);if(!u){e.debug("This handle is not attached to this session");return}u.webrtcState(!0);return}else if(a.janus==="hangup"){e.debug("Got a hangup event on session "+p),e.debug(a);const h=a.sender;if(!h){e.warn("Missing sender...");return}const u=b.get(h);if(!u){e.debug("This handle is not attached to this session");return}u.webrtcState(!1,a.reason),u.hangup()}else if(a.janus==="detached"){e.debug("Got a detached event on session "+p),e.debug(a);const h=a.sender;if(!h){e.warn("Missing sender...");return}const u=b.get(h);if(!u)return;u.ondetached(),u.detach()}else if(a.janus==="media"){e.debug("Got a media event on session "+p),e.debug(a);const h=a.sender;if(!h){e.warn("Missing sender...");return}const u=b.get(h);if(!u){e.debug("This handle is not attached to this session");return}u.mediaState(a.type,a.receiving,a.mid)}else if(a.janus==="slowlink"){e.debug("Got a slowlink event on session "+p),e.debug(a);const h=a.sender;if(!h){e.warn("Missing sender...");return}const u=b.get(h);if(!u){e.debug("This handle is not attached to this session");return}u.slowLink(a.uplink,a.lost,a.mid)}else if(a.janus==="error"){e.error("Ooops: "+a.error.code+" "+a.error.reason),e.debug(a);let h=a.transaction;if(h){let u=j.get(h);u&&u(a),j.delete(h)}return}else if(a.janus==="event"){e.debug("Got a plugin event on session "+p),e.debug(a);const h=a.sender;if(!h){e.warn("Missing sender...");return}let u=a.plugindata;if(!u){e.warn("Missing plugindata...");return}e.debug(" -- Event is coming from "+h+" ("+u.plugin+")");let E=u.data;e.debug(E);const _=b.get(h);if(!_){e.warn("This handle is not attached to this session");return}let C=a.jsep;C&&(e.debug("Handling SDP as well..."),e.debug(C));let U=_.onmessage;U?(e.debug("Notifying application..."),U(E,C)):e.debug("No provided notification callback")}else if(a.janus==="timeout"){e.error("Timeout on session "+p),e.debug(a),r&&i.close(3504,"Gateway timeout");return}else e.warn("Unknown message/event '"+a.janus+"' on session "+p),e.debug(a)}function S(){if(!d||!r||!g)return;s=setTimeout(S,y);let a={janus:"keepalive",session_id:p,transaction:e.randomString(12)};H&&(a.token=H),O&&(a.apisecret=O),i.send(JSON.stringify(a))}function k(a){let l=e.randomString(12),h={janus:"create",transaction:l};if(a.reconnect&&(g=!1,h.janus="claim",h.session_id=p,i&&(i.onopen=null,i.onerror=null,i.onclose=null,s&&(clearTimeout(s),s=null))),H&&(h.token=H),O&&(h.apisecret=O),!d&&e.isArray(c)&&(d=c[f],d.indexOf("ws")===0?(r=!0,e.log("Server #"+(f+1)+": trying WebSockets to contact Janus ("+d+")")):(r=!1,e.log("Server #"+(f+1)+": trying REST API to contact Janus ("+d+")"))),r){i=e.newWebSocket(d,"janus-protocol"),o={error:function(){if(e.error("Error connecting to the Janus WebSockets server... "+d),e.isArray(c)&&!a.reconnect){if(f++,f===c.length){a.error("Error connecting to any of the provided Janus servers: Is the server down?");return}d=null,setTimeout(function(){k(a)},200);return}a.error("Error connecting to the Janus WebSockets server: Is the server down?")},open:function(){j.set(l,function(u){if(e.debug(u),u.janus!=="success"){e.error("Ooops: "+u.error.code+" "+u.error.reason),a.error(u.error.reason);return}s=setTimeout(S,y),g=!0,p=u.session_id?u.session_id:u.data.id,a.reconnect?e.log("Claimed session: "+p):e.log("Created session: "+p),e.sessions.set(p,I),a.success()}),i.send(JSON.stringify(h))},message:function(u){G(JSON.parse(u.data))},close:function(){!d||!g||(g=!1,t.error("Lost connection to the server (is it down?)"))}};for(let u in o)i.addEventListener(u,o[u]);return}e.httpAPICall(d,{verb:"POST",withCredentials:N,body:h,success:function(u){if(e.debug(u),u.janus!=="success"){e.error("Ooops: "+u.error.code+" "+u.error.reason),a.error(u.error.reason);return}g=!0,p=u.session_id?u.session_id:u.data.id,a.reconnect?e.log("Claimed session: "+p):e.log("Created session: "+p),e.sessions.set(p,I),A(),a.success()},error:function(u,E){if(e.error(u+":",E),e.isArray(c)&&!a.reconnect){if(f++,f===c.length){a.error("Error connecting to any of the provided Janus servers: Is the server down?");return}d=null,setTimeout(function(){k(a)},200);return}E===""?a.error(u+": Is the server down?"):E&&E.error?a.error(u+": "+E.error.message):a.error(u+": "+E)}})}function J(a){if(a=a||{},a.success=typeof a.success=="function"?a.success:e.noop,a.error=typeof a.error=="function"?a.error:e.noop,e.log("Getting info on Janus instance"),!g){e.warn("Is the server down? (connected=false)"),a.error("Is the server down? (connected=false)");return}let l=e.randomString(12),h={janus:"info",transaction:l};if(H&&(h.token=H),O&&(h.apisecret=O),r){j.set(l,function(u){e.log("Server info:"),e.debug(u),u.janus!=="server_info"&&e.error("Ooops: "+u.error.code+" "+u.error.reason),a.success(u)}),i.send(JSON.stringify(h));return}e.httpAPICall(d,{verb:"POST",withCredentials:N,body:h,success:function(u){e.log("Server info:"),e.debug(u),u.janus!=="server_info"&&e.error("Ooops: "+u.error.code+" "+u.error.reason),a.success(u)},error:function(u,E){e.error(u+":",E),E===""?a.error(u+": Is the server down?"):a.error(u+": "+E)}})}function q(a){a=a||{},a.success=typeof a.success=="function"?a.success:e.noop,a.error=typeof a.error=="function"?a.error:e.noop;let l=a.unload===!0,h=!0;typeof a.notifyDestroyed<"u"&&a.notifyDestroyed!==null&&(h=a.notifyDestroyed===!0);let u=a.cleanupHandles===!0;if(e.log("Destroying session "+p+" (unload="+l+")"),!p){e.warn("No session to destroy"),a.success(),h&&t.destroyed();return}if(u)for(const _ of b.keys())ue(_,{noRequest:!0});if(!g){e.warn("Is the server down? (connected=false)"),p=null,a.success();return}let E={janus:"destroy",transaction:e.randomString(12)};if(H&&(E.token=H),O&&(E.apisecret=O),l){r?(i.onclose=null,i.close(),i=null):navigator.sendBeacon(d+"/"+p,JSON.stringify(E)),e.log("Destroyed session:"),p=null,g=!1,a.success(),h&&t.destroyed();return}if(r){E.session_id=p;let _=function(){for(let L in o)i.removeEventListener(L,o[L]);i.removeEventListener("message",C),i.removeEventListener("error",U),s&&clearTimeout(s),i.close()},C=function(L){let T=JSON.parse(L.data);T.session_id==E.session_id&&T.transaction==E.transaction&&(_(),a.success(),h&&t.destroyed())},U=function(){_(),a.error("Failed to destroy the server: Is the server down?"),h&&t.destroyed()};i.addEventListener("message",C),i.addEventListener("error",U),i.readyState===1?i.send(JSON.stringify(E)):U();return}e.httpAPICall(d+"/"+p,{verb:"POST",withCredentials:N,body:E,success:function(_){e.log("Destroyed session:"),e.debug(_),p=null,g=!1,_.janus!=="success"&&e.error("Ooops: "+_.error.code+" "+_.error.reason),a.success(),h&&t.destroyed()},error:function(_,C){e.error(_+":",C),p=null,g=!1,a.success(),h&&t.destroyed()}})}function B(a){if(a=a||{},a.success=typeof a.success=="function"?a.success:e.noop,a.error=typeof a.error=="function"?a.error:e.noop,a.dataChannelOptions=a.dataChannelOptions||{ordered:!0},a.consentDialog=typeof a.consentDialog=="function"?a.consentDialog:e.noop,a.connectionState=typeof a.connectionState=="function"?a.connectionState:e.noop,a.iceState=typeof a.iceState=="function"?a.iceState:e.noop,a.mediaState=typeof a.mediaState=="function"?a.mediaState:e.noop,a.webrtcState=typeof a.webrtcState=="function"?a.webrtcState:e.noop,a.slowLink=typeof a.slowLink=="function"?a.slowLink:e.noop,a.onmessage=typeof a.onmessage=="function"?a.onmessage:e.noop,a.onlocaltrack=typeof a.onlocaltrack=="function"?a.onlocaltrack:e.noop,a.onremotetrack=typeof a.onremotetrack=="function"?a.onremotetrack:e.noop,a.ondata=typeof a.ondata=="function"?a.ondata:e.noop,a.ondataopen=typeof a.ondataopen=="function"?a.ondataopen:e.noop,a.oncleanup=typeof a.oncleanup=="function"?a.oncleanup:e.noop,a.ondetached=typeof a.ondetached=="function"?a.ondetached:e.noop,!g){e.warn("Is the server down? (connected=false)"),a.error("Is the server down? (connected=false)");return}let l=a.plugin;if(!l){e.error("Invalid plugin"),a.error("Invalid plugin");return}let h=a.opaqueId,u=a.loopIndex,E=a.token?a.token:H,_=e.randomString(12),C={janus:"attach",plugin:l,opaque_id:h,loop_index:u,transaction:_};if(E&&(C.token=E),O&&(C.apisecret=O),r){j.set(_,function(U){if(e.debug(U),U.janus!=="success"){e.error("Ooops: "+U.error.code+" "+U.error.reason),a.error("Ooops: "+U.error.code+" "+U.error.reason);return}let L=U.data.id;e.log("Created handle: "+L);let T={session:I,plugin:l,id:L,token:E,detached:!1,webrtcStuff:{started:!1,myStream:null,streamExternal:!1,mySdp:null,mediaConstraints:null,pc:null,dataChannelOptions:a.dataChannelOptions,dataChannel:{},dtmfSender:null,trickle:!0,iceDone:!1,bitrate:{}},getId:function(){return L},getPlugin:function(){return l},getVolume:function(x,z){return ge(L,x,!0,z)},getRemoteVolume:function(x,z){return ge(L,x,!0,z)},getLocalVolume:function(x,z){return ge(L,x,!1,z)},isAudioMuted:function(x){return ye(L,x,!1)},muteAudio:function(x){return pe(L,x,!1,!0)},unmuteAudio:function(x){return pe(L,x,!1,!1)},isVideoMuted:function(x){return ye(L,x,!0)},muteVideo:function(x){return pe(L,x,!0,!0)},unmuteVideo:function(x){return pe(L,x,!0,!1)},getBitrate:function(x){return $e(L,x)},setMaxBitrate:function(x,z){return Ne(L,x,z)},send:function(x){K(L,x)},data:function(x){ne(L,x)},dtmf:function(x){ie(L,x)},consentDialog:a.consentDialog,connectionState:a.connectionState,iceState:a.iceState,mediaState:a.mediaState,webrtcState:a.webrtcState,slowLink:a.slowLink,onmessage:a.onmessage,createOffer:function(x){$(L,!0,x)},createAnswer:function(x){$(L,!1,x)},handleRemoteJsep:function(x){w(L,x)},replaceTracks:function(x){je(L,x)},getLocalTracks:function(){return Le(L)},getRemoteTracks:function(){return Oe(L)},onlocaltrack:a.onlocaltrack,onremotetrack:a.onremotetrack,ondata:a.ondata,ondataopen:a.ondataopen,oncleanup:a.oncleanup,ondetached:a.ondetached,hangup:function(x){xe(L,x===!0)},detach:function(x){ue(L,x)}};b.set(L,T),a.success(T)}),C.session_id=p,i.send(JSON.stringify(C));return}e.httpAPICall(d+"/"+p,{verb:"POST",withCredentials:N,body:C,success:function(U){if(e.debug(U),U.janus!=="success"){e.error("Ooops: "+U.error.code+" "+U.error.reason),a.error("Ooops: "+U.error.code+" "+U.error.reason);return}let L=U.data.id;e.log("Created handle: "+L);let T={session:I,plugin:l,id:L,token:E,detached:!1,webrtcStuff:{started:!1,myStream:null,streamExternal:!1,mySdp:null,mediaConstraints:null,pc:null,dataChannelOptions:a.dataChannelOptions,dataChannel:{},dtmfSender:null,trickle:!0,iceDone:!1,bitrate:{}},getId:function(){return L},getPlugin:function(){return l},getVolume:function(x,z){return ge(L,x,!0,z)},getRemoteVolume:function(x,z){return ge(L,x,!0,z)},getLocalVolume:function(x,z){return ge(L,x,!1,z)},isAudioMuted:function(x){return ye(L,x,!1)},muteAudio:function(x){return pe(L,x,!1,!0)},unmuteAudio:function(x){return pe(L,x,!1,!1)},isVideoMuted:function(x){return ye(L,x,!0)},muteVideo:function(x){return pe(L,x,!0,!0)},unmuteVideo:function(x){return pe(L,x,!0,!1)},getBitrate:function(x){return $e(L,x)},setMaxBitrate:function(x,z){return Ne(L,x,z)},send:function(x){K(L,x)},data:function(x){ne(L,x)},dtmf:function(x){ie(L,x)},consentDialog:a.consentDialog,connectionState:a.connectionState,iceState:a.iceState,mediaState:a.mediaState,webrtcState:a.webrtcState,slowLink:a.slowLink,onmessage:a.onmessage,createOffer:function(x){$(L,!0,x)},createAnswer:function(x){$(L,!1,x)},handleRemoteJsep:function(x){w(L,x)},replaceTracks:function(x){je(L,x)},getLocalTracks:function(){return Le(L)},getRemoteTracks:function(){return Oe(L)},onlocaltrack:a.onlocaltrack,onremotetrack:a.onremotetrack,ondata:a.ondata,ondataopen:a.ondataopen,oncleanup:a.oncleanup,ondetached:a.ondetached,hangup:function(x){xe(L,x===!0)},detach:function(x){ue(L,x)}};b.set(L,T),a.success(T)},error:function(U,L){e.error(U+":",L),L===""?a.error(U+": Is the server down?"):a.error(U+": "+L)}})}function K(a,l){if(l=l||{},l.success=typeof l.success=="function"?l.success:e.noop,l.error=typeof l.error=="function"?l.error:e.noop,!g){e.warn("Is the server down? (connected=false)"),l.error("Is the server down? (connected=false)");return}let h=b.get(a);if(!h||!h.webrtcStuff){e.warn("Invalid handle"),l.error("Invalid handle");return}let u=l.message,E=l.jsep,_=e.randomString(12),C={janus:"message",body:u,transaction:_};if(h.token&&(C.token=h.token),O&&(C.apisecret=O),E){C.jsep={type:E.type,sdp:E.sdp},E.e2ee&&(C.jsep.e2ee=!0),(E.rid_order==="hml"||E.rid_order==="lmh")&&(C.jsep.rid_order=E.rid_order),E.force_relay&&(C.jsep.force_relay=!0);let U=null,L=h.webrtcStuff;if(L.pc){let T=L.pc.getTransceivers();if(T&&T.length>0)for(let x in T){let z=T[x];if(z&&z.sender&&z.sender.track&&z.sender.track.kind==="video"){let Y=z.sender.getParameters();Y&&Y.encodings&&Y.encodings[0]&&Y.encodings[0].scalabilityMode&&(U||(U=[]),U.push({mindex:parseInt(x),mid:z.mid,svc:Y.encodings[0].scalabilityMode}))}}}U&&(C.jsep.svc=U)}if(e.debug("Sending message to plugin (handle="+a+"):"),e.debug(C),r){C.session_id=p,C.handle_id=a,j.set(_,function(U){if(e.debug("Message sent!"),e.debug(U),U.janus==="success"){let L=U.plugindata;if(!L){e.warn("Request succeeded, but missing plugindata..."),l.success();return}e.log("Synchronous transaction successful ("+L.plugin+")");let T=L.data;e.debug(T),l.success(T);return}else if(U.janus!=="ack"){U.error?(e.error("Ooops: "+U.error.code+" "+U.error.reason),l.error(U.error.code+" "+U.error.reason)):(e.error("Unknown error"),l.error("Unknown error"));return}l.success()}),i.send(JSON.stringify(C));return}e.httpAPICall(d+"/"+p+"/"+a,{verb:"POST",withCredentials:N,body:C,success:function(U){if(e.debug("Message sent!"),e.debug(U),U.janus==="success"){let L=U.plugindata;if(!L){e.warn("Request succeeded, but missing plugindata..."),l.success();return}e.log("Synchronous transaction successful ("+L.plugin+")");let T=L.data;e.debug(T),l.success(T);return}else if(U.janus!=="ack"){U.error?(e.error("Ooops: "+U.error.code+" "+U.error.reason),l.error(U.error.code+" "+U.error.reason)):(e.error("Unknown error"),l.error("Unknown error"));return}l.success()},error:function(U,L){e.error(U+":",L),l.error(U+": "+L)}})}function Q(a,l){if(!g){e.warn("Is the server down? (connected=false)");return}let h=b.get(a);if(!h||!h.webrtcStuff){e.warn("Invalid handle");return}let u={janus:"trickle",candidate:l,transaction:e.randomString(12)};if(h.token&&(u.token=h.token),O&&(u.apisecret=O),e.vdebug("Sending trickle candidate (handle="+a+"):"),e.vdebug(u),r){u.session_id=p,u.handle_id=a,i.send(JSON.stringify(u));return}e.httpAPICall(d+"/"+p+"/"+a,{verb:"POST",withCredentials:N,body:u,success:function(E){if(e.vdebug("Candidate sent!"),e.vdebug(E),E.janus!=="ack"){e.error("Ooops: "+E.error.code+" "+E.error.reason);return}},error:function(E,_){e.error(E+":",_)}})}function te(a,l,h,u,E){let _=b.get(a);if(!_||!_.webrtcStuff){e.warn("Invalid handle");return}let C=_.webrtcStuff;if(!C.pc){e.warn("Invalid PeerConnection");return}let U=function(x){e.log("Received message on data channel:",x);let z=x.target.label;_.ondata(x.data,z)},L=function(x){e.log("Received state change on data channel:",x);let z=x.target.label,Y=x.target.protocol,Z=C.dataChannel[z]?C.dataChannel[z].readyState:"null";if(e.log("State change on <"+z+"> data channel: "+Z),Z==="open"){if(C.dataChannel[z].pending&&C.dataChannel[z].pending.length>0){e.log("Sending pending messages on <"+z+">:",C.dataChannel[z].pending.length);for(let se of C.dataChannel[z].pending)e.log("Sending data on data channel <"+z+">"),e.debug(se),C.dataChannel[z].send(se);C.dataChannel[z].pending=[]}_.ondataopen(z,Y)}},T=function(x){e.error("Got error on data channel:",x)};if(u)C.dataChannel[l]=u;else{let x=C.dataChannelOptions;h&&(x.protocol=h),C.dataChannel[l]=C.pc.createDataChannel(l,x)}C.dataChannel[l].onmessage=U,C.dataChannel[l].onopen=L,C.dataChannel[l].onclose=L,C.dataChannel[l].onerror=T,C.dataChannel[l].pending=[],E&&C.dataChannel[l].pending.push(E)}function ne(a,l){l=l||{},l.success=typeof l.success=="function"?l.success:e.noop,l.error=typeof l.error=="function"?l.error:e.noop;let h=b.get(a);if(!h||!h.webrtcStuff){e.warn("Invalid handle"),l.error("Invalid handle");return}let u=h.webrtcStuff,E=l.text||l.data;if(!E){e.warn("Invalid data"),l.error("Invalid data");return}let _=l.label?l.label:e.dataChanDefaultLabel;if(!u.dataChannel[_]){te(a,_,l.protocol,!1,E,l.protocol),l.success();return}if(u.dataChannel[_].readyState!=="open"){u.dataChannel[_].pending.push(E),l.success();return}e.log("Sending data on data channel <"+_+">"),e.debug(E),u.dataChannel[_].send(E),l.success()}function ie(a,l){l=l||{},l.success=typeof l.success=="function"?l.success:e.noop,l.error=typeof l.error=="function"?l.error:e.noop;let h=b.get(a);if(!h||!h.webrtcStuff){e.warn("Invalid handle"),l.error("Invalid handle");return}let u=h.webrtcStuff;if(!u.dtmfSender){if(u.pc){let T=u.pc.getSenders().find(function(x){return x.track&&x.track.kind==="audio"});if(!T){e.warn("Invalid DTMF configuration (no audio track)"),l.error("Invalid DTMF configuration (no audio track)");return}u.dtmfSender=T.dtmf,u.dtmfSender&&(e.log("Created DTMF Sender"),u.dtmfSender.ontonechange=function(x){e.debug("Sent DTMF tone: "+x.tone)})}if(!u.dtmfSender){e.warn("Invalid DTMF configuration"),l.error("Invalid DTMF configuration");return}}let E=l.dtmf;if(!E){e.warn("Invalid DTMF parameters"),l.error("Invalid DTMF parameters");return}let _=E.tones;if(!_){e.warn("Invalid DTMF string"),l.error("Invalid DTMF string");return}let C=typeof E.duration=="number"?E.duration:500,U=typeof E.gap=="number"?E.gap:50;e.debug("Sending DTMF string "+_+" (duration "+C+"ms, gap "+U+"ms)"),u.dtmfSender.insertDTMF(_,C,U),l.success()}function ue(a,l){l=l||{},l.success=typeof l.success=="function"?l.success:e.noop,l.error=typeof l.error=="function"?l.error:e.noop;let h=l.noRequest===!0;e.log("Destroying handle "+a+" (only-locally="+h+")"),xe(a);let u=b.get(a);if(!u||u.detached){b.delete(a),l.success();return}if(u.detached=!0,h){b.delete(a),l.success();return}if(!g){e.warn("Is the server down? (connected=false)"),l.error("Is the server down? (connected=false)");return}let E={janus:"detach",transaction:e.randomString(12)};if(u.token&&(E.token=u.token),O&&(E.apisecret=O),r){E.session_id=p,E.handle_id=a,i.send(JSON.stringify(E)),b.delete(a),l.success();return}e.httpAPICall(d+"/"+p+"/"+a,{verb:"POST",withCredentials:N,body:E,success:function(_){e.log("Destroyed handle:"),e.debug(_),_.janus!=="success"&&e.error("Ooops: "+_.error.code+" "+_.error.reason),b.delete(a),l.success()},error:function(_,C){e.error(_+":",C),b.delete(a),l.success()}})}function W(a,l){let h=b.get(a);if(!h||!h.webrtcStuff)throw e.warn("Invalid handle"),"Invalid handle";let u=h.webrtcStuff;if(u.pc)return;let E={iceServers:v,iceTransportPolicy:R,bundlePolicy:D};E.sdpSemantics="unified-plan";let _=!1;if(l.tracks){for(let C of l.tracks)if(C.transforms&&(C.transforms.sender||C.transforms.receiver)){_=!0;break}}l.externalEncryption&&(_=!0,u.externalEncryption=!0),RTCRtpSender&&(RTCRtpSender.prototype.createEncodedStreams||RTCRtpSender.prototype.createEncodedAudioStreams&&RTCRtpSender.prototype.createEncodedVideoStreams)&&_&&(u.insertableStreams=!0,E.forceEncodedAudioInsertableStreams=!0,E.forceEncodedVideoInsertableStreams=!0,E.encodedInsertableStreams=!0),e.log("Creating PeerConnection"),u.pc=new RTCPeerConnection(E),e.debug(u.pc),u.pc.getStats&&(u.volume={},u.bitrate.value="0 kbits/sec"),e.log("Preparing local SDP and gathering candidates (trickle="+u.trickle+")"),u.pc.onconnectionstatechange=function(){u.pc&&h.connectionState(u.pc.connectionState)},u.pc.oniceconnectionstatechange=function(){u.pc&&h.iceState(u.pc.iceConnectionState)},u.pc.onicecandidate=function(C){if(!C.candidate||C.candidate.candidate&&C.candidate.candidate.indexOf("endOfCandidates")>0)e.log("End of candidates."),u.iceDone=!0,u.trickle===!0?Q(a,{completed:!0}):le(a,l);else{let U={candidate:C.candidate.candidate,sdpMid:C.candidate.sdpMid,sdpMLineIndex:C.candidate.sdpMLineIndex};u.trickle===!0&&Q(a,U)}},u.pc.ontrack=function(C){if(e.log("Handling Remote Track",C),!C.streams||!C.track)return;let U=C.transceiver?C.transceiver.mid:C.track.id;try{C.transceiver&&C.transceiver.mid&&C.track.id&&(h.mids||(h.mids={}),h.mids[C.track.id]=C.transceiver.mid),h.onremotetrack(C.track,U,!0,{reason:"created"})}catch(T){e.error("Error calling onremotetrack",T)}if(C.track.onended)return;let L=null;e.log("Adding onended callback to track:",C.track),C.track.onended=function(T){e.log("Remote track removed:",T),clearTimeout(L);let x=u.pc?u.pc.getTransceivers():null,z=x?x.find(Z=>Z.receiver.track===T.target):null,Y=z?z.mid:T.target.id;Y===T.target.id&&h.mids&&h.mids[C.track.id]&&(Y=h.mids[C.track.id]);try{h.onremotetrack(T.target,Y,!1,{reason:"ended"})}catch(Z){e.error("Error calling onremotetrack on removal",Z)}delete h.mids[C.track.id]},C.track.onmute=function(T){e.log("Remote track muted:",T),L||(L=setTimeout(function(){e.log("Removing remote track");let x=u.pc?u.pc.getTransceivers():null,z=x?x.find(Z=>Z.receiver.track===T.target):null,Y=z?z.mid:T.target.id;Y===T.target.id&&h.mids&&h.mids[C.track.id]&&(Y=h.mids[C.track.id]);try{h.onremotetrack(T.target,Y,!1,{reason:"mute"})}catch(Z){e.error("Error calling onremotetrack on mute",Z)}L=null},3*840))},C.track.onunmute=function(T){if(e.log("Remote track flowing again:",T),L!=null)clearTimeout(L),L=null;else try{let x=u.pc?u.pc.getTransceivers():null,z=x?x.find(Z=>Z.receiver.track===T.target):null,Y=z?z.mid:T.target.id;h.onremotetrack(T.target,Y,!0,{reason:"unmute"})}catch(x){e.error("Error calling onremotetrack on unmute",x)}}}}async function $(a,l,h){h=h||{},h.success=typeof h.success=="function"?h.success:e.noop,h.error=typeof h.error=="function"?h.error:Ue;let u=h.jsep;if(l&&u){e.error("Provided a JSEP to a createOffer"),h.error("Provided a JSEP to a createOffer");return}else if(!l&&(!u||!u.type||!u.sdp)){e.error("A valid JSEP is required for createAnswer"),h.error("A valid JSEP is required for createAnswer");return}if(h.media&&!h.tracks){if(h.tracks=e.mediaToTracks(h.media),h.simulcast===!0||h.simulcast2===!0||h.svc){for(let C of h.tracks)if(C.type==="video"){h.simulcast===!0||h.simulcast2===!0?C.simulcast=!0:h.svc&&(C.svc=h.svc);break}}e.warn("Deprecated media object passed, use tracks instead. Automatically translated to:",h.tracks)}if(h.tracks&&!Array.isArray(h.tracks)){e.error("Tracks must be an array"),h.error("Tracks must be an array");return}let E=b.get(a);if(!E||!E.webrtcStuff){e.warn("Invalid handle"),h.error("Invalid handle");return}let _=E.webrtcStuff;_.trickle=Ye(h.trickle);try{if(W(a,h),l&&await Ee(a,h),u){if(await _.pc.setRemoteDescription(u),e.log("Remote description accepted!"),_.remoteSdp=u.sdp,_.candidates&&_.candidates.length>0){for(let U=0;U<_.candidates.length;U++){let L=_.candidates[U];e.debug("Adding remote candidate:",L),!L||L.completed===!0?_.pc.addIceCandidate(e.endOfCandidates):_.pc.addIceCandidate(L)}_.candidates=[]}await Ee(a,h);let C=await he(a,h);h.success(C)}else{let C=await fe(a,h);h.success(C)}}catch(C){e.error(C),h.error(C)}}function w(a,l){l=l||{},l.success=typeof l.success=="function"?l.success:e.noop,l.error=typeof l.error=="function"?l.error:Ue,l.customizeSdp=typeof l.customizeSdp=="function"?l.customizeSdp:e.noop;let h=l.jsep,u=b.get(a);if(!u||!u.webrtcStuff){e.warn("Invalid handle"),l.error("Invalid handle");return}let E=u.webrtcStuff;if(h){if(!E.pc){e.warn("Wait, no PeerConnection?? if this is an answer, use createAnswer and not handleRemoteJsep"),l.error("No PeerConnection: if this is an answer, use createAnswer and not handleRemoteJsep");return}l.customizeSdp(h),E.pc.setRemoteDescription(h).then(function(){if(e.log("Remote description accepted!"),E.remoteSdp=h.sdp,E.candidates&&E.candidates.length>0){for(let _=0;_<E.candidates.length;_++){let C=E.candidates[_];e.debug("Adding remote candidate:",C),!C||C.completed===!0?E.pc.addIceCandidate(e.endOfCandidates):E.pc.addIceCandidate(C)}E.candidates=[]}l.success()},l.error)}else l.error("Invalid JSEP")}async function fe(a,l){l=l||{},l.customizeSdp=typeof l.customizeSdp=="function"?l.customizeSdp:e.noop;let h=b.get(a);if(!h||!h.webrtcStuff)throw e.warn("Invalid handle"),"Invalid handle";let u=h.webrtcStuff;e.log("Creating offer (iceDone="+u.iceDone+")");let E={};l.iceRestart===!0&&(E.iceRestart=!0),e.debug(E);let C=await u.pc.createOffer(E);e.debug(C);let U={type:"offer",sdp:C.sdp};return l.customizeSdp(U),C.sdp=U.sdp,e.log("Setting local description"),u.mySdp={type:"offer",sdp:C.sdp},await u.pc.setLocalDescription(C),u.mediaConstraints=E,!u.iceDone&&!u.trickle?(e.log("Waiting for all candidates..."),null):((u.insertableStreams||u.externalEncryption)&&(C.e2ee=!0),C)}async function he(a,l){l=l||{},l.customizeSdp=typeof l.customizeSdp=="function"?l.customizeSdp:e.noop;let h=b.get(a);if(!h||!h.webrtcStuff)throw e.warn("Invalid handle"),"Invalid handle";let u=h.webrtcStuff;e.log("Creating answer (iceDone="+u.iceDone+")");let E=await u.pc.createAnswer();e.debug(E);let _={type:"answer",sdp:E.sdp};return l.customizeSdp(_),E.sdp=_.sdp,e.log("Setting local description"),u.mySdp={type:"answer",sdp:E.sdp},await u.pc.setLocalDescription(E),!u.iceDone&&!u.trickle?(e.log("Waiting for all candidates..."),null):((u.insertableStreams||u.externalEncryption)&&(E.e2ee=!0),E)}function le(a,l){l=l||{},l.success=typeof l.success=="function"?l.success:e.noop,l.error=typeof l.error=="function"?l.error:e.noop;let h=b.get(a);if(!h||!h.webrtcStuff){e.warn("Invalid handle, not sending anything");return}let u=h.webrtcStuff;if(e.log("Sending offer/answer SDP..."),!u.mySdp){e.warn("Local SDP instance is invalid, not sending anything...");return}u.mySdp={type:u.pc.localDescription.type,sdp:u.pc.localDescription.sdp},u.trickle===!1&&(u.mySdp.trickle=!1),e.debug(l),u.sdpSent=!0,l.success(u.mySdp)}async function je(a,l){if(l=l||{},l.success=typeof l.success=="function"?l.success:e.noop,l.error=typeof l.error=="function"?l.error:e.noop,l.tracks&&!Array.isArray(l.tracks)){e.error("Tracks must be an array"),l.error("Tracks must be an array");return}for(let h of l.tracks)(h.add||!h.replace&&!h.remove)&&(h.replace=!0);try{await Ee(a,l),l.success()}catch(h){e.error(h),l.error(h)}}async function Ee(a,l){let h=b.get(a);if(!h||!h.webrtcStuff)throw e.warn("Invalid handle, not sending anything"),"Invalid handle";let u=h.webrtcStuff;if(!u.pc)throw e.warn("Invalid PeerConnection"),"Invalid PeerConnection";let E=l.tracks;if(!E||!Array.isArray(E)||E.length===0)return;let _=!1,C={};for(let T of E){if(delete T.gumGroup,!T.type||!["audio","video"].includes(T.type)||!T.capture||T.capture instanceof MediaStreamTrack)continue;let x=T.group?T.group:"default";C[x]||(C[x]={}),!C[x][T.type]&&(T.gumGroup=x,C[x][T.type]=T)}let U=Object.keys(C);for(let T of U){let x=C[T];(!x.audio||!x.video)&&(x.audio&&delete x.audio.gumGroup,x.video&&delete x.video.gumGroup,delete C[T])}let L=!!l.jsep;for(let T of E){if(!T.type){e.warn("Missing track type:",T);continue}if(T.type==="data"){if(u.pc.ondatachannel){e.warn("Data channel exists already, not creating another one");continue}e.log("Creating default data channel"),te(a,e.dataChanDefaultLabel,null,!1),u.pc.ondatachannel=function(V){e.log("Data channel created by Janus:",V),te(a,V.channel.label,V.channel.protocol,V.channel)};continue}if((typeof T.add>"u"||T.add===null)&&(typeof T.remove>"u"||T.remove===null)&&(typeof T.replace>"u"||T.replace===null)&&(T.add=!0),T.add&&T.remove||T.add&&T.remove&&T.replace){e.warn("Conflicting actions for track, ignoring:",T);continue}T.add&&T.replace?(e.warn("Both add and replace provided, falling back to replace:",T),delete T.add):T.remove&&T.replace&&(e.warn("Both remove and replace provided, falling back to remove:",T),delete T.replace);let x=T.type;T.type==="screen"&&(x="video");let z=null,Y=null;if(T.mid?z=u.pc.getTransceivers().find(V=>V.mid===T.mid&&V.receiver.track.kind===x):T.add||(z=u.pc.getTransceivers().find(V=>V.receiver.track.kind===x)),T.replace||T.remove){if(!z){e.warn("Couldn't find a transceiver for track:",T);continue}if(!z.sender){e.warn("No sender in the transceiver for track:",T);continue}Y=z.sender}if(L&&!z&&(z=u.pc.getTransceivers().find(V=>V.receiver.track.kind===x),!z)){e.warn("Couldn't find a transceiver for track:",T);continue}let Z=null,se=null;if((T.remove||T.replace)&&(e.log("Removing track from PeerConnection",T),se=Y.track?Y.track.id:null,await Y.replaceTrack(null),se&&u.myStream)){let V=null;if(x==="audio"&&u.myStream.getAudioTracks()&&u.myStream.getAudioTracks().length)for(let X of u.myStream.getAudioTracks())X.id===se&&(V=X,e.log("Removing audio track:",V));else if(x==="video"&&u.myStream.getVideoTracks()&&u.myStream.getVideoTracks().length)for(let X of u.myStream.getVideoTracks())X.id===se&&(V=X,e.log("Removing video track:",V));if(V){try{u.myStream.removeTrack(V),h.onlocaltrack(V,!1)}catch(X){e.error("Error calling onlocaltrack on removal for renegotiation",X)}if(V.dontStop!==!0)try{V.stop()}catch{}}}if(T.capture){if(T.gumGroup&&C[T.gumGroup]&&C[T.gumGroup].stream){let V=C[T.gumGroup].stream;Z=T.type==="audio"?V.getAudioTracks()[0]:V.getVideoTracks()[0],delete C[T.gumGroup].stream,delete C[T.gumGroup],delete T.gumGroup}else if(T.capture instanceof MediaStreamTrack)Z=T.capture;else{_||(_=!0,h.consentDialog(!0));let V=e.trackConstraints(T),X=null;if(T.type==="audio"||T.type==="video"){if(T.gumGroup){let ae=T.type==="audio"?"video":"audio";if(C[T.gumGroup]&&C[T.gumGroup][ae]){let ke=C[T.gumGroup][ae],Vn=e.trackConstraints(ke);V[ae]=Vn[ae]}}X=await navigator.mediaDevices.getUserMedia(V),T.gumGroup&&V.audio&&V.video&&(C[T.gumGroup].stream=X,delete T.gumGroup)}else X=await navigator.mediaDevices.getDisplayMedia(V);Z=T.type==="audio"?X.getAudioTracks()[0]:X.getVideoTracks()[0]}if(T.replace){await Y.replaceTrack(Z);let V="sendrecv";(T.recv===!1||z.direction==="inactive"||z.direction==="sendonly")&&(V="sendonly"),z.setDirection?z.setDirection(V):z.direction=V}else{if(u.myStream||(u.myStream=new MediaStream),x==="audio"||!T.simulcast&&!T.svc)Y=u.pc.addTrack(Z,u.myStream),z=u.pc.getTransceivers().find(V=>V.sender===Y);else if(T.simulcast){if(e.webRTCAdapter.browserDetails.browser!=="firefox"){e.log("Enabling rid-based simulcasting:",Z);let V=m(T.simulcastMaxBitrates);z=u.pc.addTransceiver(Z,{direction:"sendrecv",streams:[u.myStream],sendEncodings:T.sendEncodings||[{rid:"h",active:!0,scalabilityMode:"L1T2",maxBitrate:V.high},{rid:"m",active:!0,scalabilityMode:"L1T2",maxBitrate:V.medium,scaleResolutionDownBy:2},{rid:"l",active:!0,scalabilityMode:"L1T2",maxBitrate:V.low,scaleResolutionDownBy:4}]})}else if(e.log("Enabling Simulcasting for Firefox (RID)"),z=u.pc.addTransceiver(Z,{direction:"sendrecv",streams:[u.myStream]}),Y=z?z.sender:null,Y){let V=Y.getParameters();V||(V={});let X=m(T.simulcastMaxBitrates);V.encodings=T.sendEncodings||[{rid:"h",active:!0,maxBitrate:X.high},{rid:"m",active:!0,maxBitrate:X.medium,scaleResolutionDownBy:2},{rid:"l",active:!0,maxBitrate:X.low,scaleResolutionDownBy:4}],Y.setParameters(V)}}else e.log("Enabling SVC ("+T.svc+"):",Z),z=u.pc.addTransceiver(Z,{direction:"sendrecv",streams:[u.myStream],sendEncodings:[{scalabilityMode:T.svc}]});if(Y||(Y=z?z.sender:null),T.codec)if(e.webRTCAdapter.browserDetails.browser==="firefox")e.warn("setCodecPreferences not supported in Firefox, ignoring codec for track:",T);else if(typeof T.codec!="string")e.warn("Invalid codec value, ignoring for track:",T);else{let V=x+"/"+T.codec.toLowerCase(),X=RTCRtpReceiver.getCapabilities(x).codecs.filter(function(ae){return ae.mimeType.toLowerCase()===V});if(!X||X.length===0)e.warn("Codec not supported in this browser for this track, ignoring:",T);else if(z)try{z.setCodecPreferences(X)}catch(ae){e.warn("Failed enforcing codec for this "+x+" track:",ae)}}if(T.bitrate){if(T.simulcast||T.svc)e.warn("Ignoring bitrate for simulcast/SVC track, use sendEncodings for that");else if(isNaN(T.bitrate)||T.bitrate<0)e.warn("Ignoring invalid bitrate for track:",T);else if(Y){let V=Y.getParameters();!V||!V.encodings||V.encodings.length===0?e.warn("No encodings in the sender parameters, ignoring bitrate for track:",T):(V.encodings[0].maxBitrate=T.bitrate,await Y.setParameters(V))}}if(x==="video"&&T.framerate){if(T.simulcast||T.svc)e.warn("Ignoring framerate for simulcast/SVC track, use sendEncodings for that");else if(isNaN(T.framerate)||T.framerate<0)e.warn("Ignoring invalid framerate for track:",T);else if(Y){let V=Y.getParameters();!V||!V.encodings||V.encodings.length===0?e.warn("No encodings in the sender parameters, ignoring framerate for track:",T):(V.encodings[0].maxFramerate=T.framerate,await Y.setParameters(V))}}if(T.transforms){if(Y&&T.transforms.sender){let V=null;RTCRtpSender.prototype.createEncodedStreams?V=Y.createEncodedStreams():(RTCRtpSender.prototype.createAudioEncodedStreams||RTCRtpSender.prototype.createEncodedVideoStreams)&&(x==="audio"?V=Y.createEncodedAudioStreams():x==="video"&&(V=Y.createEncodedVideoStreams())),V&&(V.readableStream&&V.writableStream?V.readableStream.pipeThrough(T.transforms.sender).pipeTo(V.writableStream):V.readable&&V.writable&&V.readable.pipeThrough(T.transforms.sender).pipeTo(V.writable))}if(z&&z.receiver&&T.transforms.receiver){let V=null;RTCRtpReceiver.prototype.createEncodedStreams?V=z.receiver.createEncodedStreams():(RTCRtpReceiver.prototype.createAudioEncodedStreams||RTCRtpReceiver.prototype.createEncodedVideoStreams)&&(x==="audio"?V=z.receiver.createEncodedAudioStreams():x==="video"&&(V=z.receiver.createEncodedVideoStreams())),V&&(V.readableStream&&V.writableStream?V.readableStream.pipeThrough(T.transforms.receiver).pipeTo(V.writableStream):V.readable&&V.writable&&V.readable.pipeThrough(T.transforms.receiver).pipeTo(V.writable))}}}Z&&T.dontStop===!0&&(Z.dontStop=!0)}else if(T.recv&&(z||(z=u.pc.addTransceiver(x)),z)){if(T.codec)if(e.webRTCAdapter.browserDetails.browser==="firefox")e.warn("setCodecPreferences not supported in Firefox, ignoring codec for track:",T);else if(typeof T.codec!="string")e.warn("Invalid codec value, ignoring for track:",T);else{let V=x+"/"+T.codec.toLowerCase(),X=RTCRtpReceiver.getCapabilities(x).codecs.filter(function(ae){return ae.mimeType.toLowerCase()===V});if(!X||X.length===0)e.warn("Codec not supported in this browser for this track, ignoring:",T);else try{z.setCodecPreferences(X)}catch(ae){e.warn("Failed enforcing codec for this "+x+" track:",ae)}}if(z.receiver&&T.transforms&&T.transforms.receiver){let V=null;RTCRtpReceiver.prototype.createEncodedStreams?V=z.receiver.createEncodedStreams():(RTCRtpReceiver.prototype.createAudioEncodedStreams||RTCRtpReceiver.prototype.createEncodedVideoStreams)&&(x==="audio"?V=z.receiver.createEncodedAudioStreams():x==="video"&&(V=z.receiver.createEncodedVideoStreams())),V&&(V.readableStream&&V.writableStream?V.readableStream.pipeThrough(T.transforms.receiver).pipeTo(V.writableStream):V.readable&&V.writable&&V.readable.pipeThrough(T.transforms.receiver).pipeTo(V.writable))}}if(Z){u.myStream.addTrack(Z),Z.onended=function(V){e.log("Local track removed:",V);try{h.onlocaltrack(V.target,!1)}catch(X){e.error("Error calling onlocaltrack following end",X)}};try{h.onlocaltrack(Z,!0)}catch(V){e.error("Error calling onlocaltrack for track add",V)}}if(z){let V=z.direction,X=null,ae=Z&&z.sender.track,ke=T.recv!==!1&&z.receiver.track;ae&&ke?X="sendrecv":ae&&!ke?X="sendonly":!ae&&ke?X="recvonly":!ae&&!ke&&(X="inactive"),X&&X!==V&&(e.warn("Changing direction of transceiver to "+X+" (was "+V+")",T),z.setDirection?z.setDirection(X):z.direction=X)}}_&&h.consentDialog(!1)}function Le(a){let l=b.get(a);if(!l||!l.webrtcStuff)return e.warn("Invalid handle"),null;let h=l.webrtcStuff;if(!h.pc)return e.warn("Invalid PeerConnection"),null;let u=[],E=h.pc.getTransceivers();for(let _ of E){let C=null;_.sender&&_.sender.track&&(C={mid:_.mid},C.type=_.sender.track.kind,C.id=_.sender.track.id,C.label=_.sender.track.label),C&&u.push(C)}return u}function Oe(a){let l=b.get(a);if(!l||!l.webrtcStuff)return e.warn("Invalid handle"),null;let h=l.webrtcStuff;if(!h.pc)return e.warn("Invalid PeerConnection"),null;let u=[],E=h.pc.getTransceivers();for(let _ of E){let C=null;_.receiver&&_.receiver.track&&(C={mid:_.mid},C.type=_.receiver.track.kind,C.id=_.receiver.track.id,C.label=_.receiver.track.label),C&&u.push(C)}return u}function ge(a,l,h,u){u=typeof u=="function"?u:e.noop;let E=b.get(a);if(!E||!E.webrtcStuff){e.warn("Invalid handle"),u(0);return}let _=h?"remote":"local",C=E.webrtcStuff;if(C.volume[_]||(C.volume[_]={value:0}),C.pc&&C.pc.getStats&&(e.webRTCAdapter.browserDetails.browser==="chrome"||e.webRTCAdapter.browserDetails.browser==="safari")){let U=C.pc;if(l){let L=C.pc.getTransceivers().find(T=>T.mid===l&&T.receiver.track.kind==="audio");if(!L){e.warn("No audio transceiver with mid "+l),u(0);return}if(h&&!L.receiver){e.warn("Remote transceiver track unavailable"),u(0);return}else if(!h&&!L.sender){e.warn("Local transceiver track unavailable"),u(0);return}U=h?L.receiver:L.sender}return U.getStats().then(function(L){L.forEach(function(T){!T||T.kind!=="audio"||h&&!T.remoteSource||!h&&T.type!=="media-source"||u(T.audioLevel?T.audioLevel:0)})}),C.volume[_].value}else{e.warn("Getting the "+_+" volume unsupported by browser"),u(0);return}}function ye(a,l,h){let u=b.get(a);if(!u||!u.webrtcStuff)return e.warn("Invalid handle"),!0;let E=u.webrtcStuff;if(!E.pc)return e.warn("Invalid PeerConnection"),!0;if(!E.myStream)return e.warn("Invalid local MediaStream"),!0;if(h){if(!E.myStream.getVideoTracks()||E.myStream.getVideoTracks().length===0)return e.warn("No video track"),!0;if(l){let _=E.pc.getTransceivers().find(C=>C.mid===l&&C.receiver.track.kind==="video");return _?!_.sender||!_.sender.track?(e.warn("No video sender with mid "+l),!0):!_.sender.track.enabled:(e.warn("No video transceiver with mid "+l),!0)}else return!E.myStream.getVideoTracks()[0].enabled}else{if(!E.myStream.getAudioTracks()||E.myStream.getAudioTracks().length===0)return e.warn("No audio track"),!0;if(l){let _=E.pc.getTransceivers().find(C=>C.mid===l&&C.receiver.track.kind==="audio");return _?!_.sender||!_.sender.track?(e.warn("No audio sender with mid "+l),!0):!_.sender.track.enabled:(e.warn("No audio transceiver with mid "+l),!0)}else return!E.myStream.getAudioTracks()[0].enabled}}function pe(a,l,h,u){let E=b.get(a);if(!E||!E.webrtcStuff)return e.warn("Invalid handle"),!1;let _=E.webrtcStuff;if(!_.pc)return e.warn("Invalid PeerConnection"),!1;if(!_.myStream)return e.warn("Invalid local MediaStream"),!1;if(h){if(!_.myStream.getVideoTracks()||_.myStream.getVideoTracks().length===0)return e.warn("No video track"),!1;if(l){let C=_.pc.getTransceivers().find(U=>U.mid===l&&U.receiver.track.kind==="video");if(!C)return e.warn("No video transceiver with mid "+l),!1;if(!C.sender||!C.sender.track)return e.warn("No video sender with mid "+l),!1;C.sender.track.enabled=!u}else for(const C of _.myStream.getVideoTracks())C.enabled=!u}else{if(!_.myStream.getAudioTracks()||_.myStream.getAudioTracks().length===0)return e.warn("No audio track"),!1;if(l){let C=_.pc.getTransceivers().find(U=>U.mid===l&&U.receiver.track.kind==="audio");if(!C)return e.warn("No audio transceiver with mid "+l),!1;if(!C.sender||!C.sender.track)return e.warn("No audio sender with mid "+l),!1;C.sender.track.enabled=!u}else for(const C of _.myStream.getAudioTracks())C.enabled=!u}return!0}function $e(a,l){let h=b.get(a);if(!h||!h.webrtcStuff)return e.warn("Invalid handle"),"Invalid handle";let u=h.webrtcStuff;if(!u.pc)return"Invalid PeerConnection";if(u.pc.getStats){let E=u.pc,_=l||"default";if(l){let C=u.pc.getTransceivers().find(U=>U.mid===l&&U.receiver.track.kind==="video");if(!C)return e.warn("No video transceiver with mid "+l),"No video transceiver with mid "+l;if(!C.receiver)return e.warn("No video receiver with mid "+l),"No video receiver with mid "+l;E=C.receiver}return u.bitrate[_]||(u.bitrate[_]={timer:null,bsnow:null,bsbefore:null,tsnow:null,tsbefore:null,value:"0 kbits/sec"}),u.bitrate[_].timer?u.bitrate[_].value:(e.log("Starting bitrate timer"+(l?" for mid "+l:"")+" (via getStats)"),u.bitrate[_].timer=setInterval(function(){E.getStats().then(function(C){C.forEach(function(U){if(!U)return;let L=!1;if(((U.mediaType==="video"||U.kind==="video"||U.id.toLowerCase().indexOf("video")>-1)&&U.type==="inbound-rtp"&&U.id.indexOf("rtcp")<0||U.type=="ssrc"&&U.bytesReceived&&(U.googCodecName==="VP8"||U.googCodecName===""))&&(L=!0),L)if(u.bitrate[_].bsnow=U.bytesReceived,u.bitrate[_].tsnow=U.timestamp,u.bitrate[_].bsbefore===null||u.bitrate[_].tsbefore===null)u.bitrate[_].bsbefore=u.bitrate[_].bsnow,u.bitrate[_].tsbefore=u.bitrate[_].tsnow;else{let T=u.bitrate[_].tsnow-u.bitrate[_].tsbefore;e.webRTCAdapter.browserDetails.browser==="safari"&&(T=T/1e3);let x=Math.round((u.bitrate[_].bsnow-u.bitrate[_].bsbefore)*8/T);e.webRTCAdapter.browserDetails.browser==="safari"&&(x=parseInt(x/1e3)),u.bitrate[_].value=x+" kbits/sec",u.bitrate[_].bsbefore=u.bitrate[_].bsnow,u.bitrate[_].tsbefore=u.bitrate[_].tsnow}})})},1e3),"0 kbits/sec")}else return e.warn("Getting the video bitrate unsupported by browser"),"Feature unsupported by browser"}function Ne(a,l,h){let u=b.get(a);if(!u||!u.webrtcStuff){e.warn("Invalid handle");return}let E=u.webrtcStuff;if(!E.pc){e.warn("Invalid PeerConnection");return}let _=E.pc.getTransceivers().find(U=>U.mid===l);if(!_){e.warn("No transceiver with mid",l);return}if(!_.sender){e.warn("No sender for transceiver with mid",l);return}let C=_.sender.getParameters();!C||!C.encodings||C.encodings.length===0?e.warn("No parameters encodings"):C.encodings.length>1?e.warn("Ignoring bitrate for simulcast track, use sendEncodings for that"):isNaN(h)||h<0?e.warn("Invalid bitrate (must be a positive integer)"):(C.encodings[0].maxBitrate=h,_.sender.setParameters(C))}function Ue(a){e.error("WebRTC error:",a)}function xe(a,l){e.log("Cleaning WebRTC stuff");let h=b.get(a);if(!h)return;let u=h.webrtcStuff;if(u){if(l===!0){let E={janus:"hangup",transaction:e.randomString(12)};h.token&&(E.token=h.token),O&&(E.apisecret=O),e.debug("Sending hangup request (handle="+a+"):"),e.debug(E),r?(E.session_id=p,E.handle_id=a,i.send(JSON.stringify(E))):e.httpAPICall(d+"/"+p+"/"+a,{verb:"POST",withCredentials:N,body:E})}u.volume&&(u.volume.local&&u.volume.local.timer&&clearInterval(u.volume.local.timer),u.volume.remote&&u.volume.remote.timer&&clearInterval(u.volume.remote.timer));for(let E in u.bitrate)u.bitrate[E].timer&&clearInterval(u.bitrate[E].timer);u.bitrate={},!u.streamExternal&&u.myStream&&(e.log("Stopping local stream tracks"),e.stopAllTracks(u.myStream)),u.streamExternal=!1,u.myStream=null;try{u.pc.close()}catch{}u.pc=null,u.candidates=null,u.mySdp=null,u.remoteSdp=null,u.iceDone=!1,u.dataChannel={},u.dtmfSender=null,u.insertableStreams=!1,u.externalEncryption=!1}h.oncleanup()}function Ye(a){return e.debug("isTrickleEnabled:",a),a!==!1}}return e}),St=re.createContext({});function Ce(){return Ce=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)({}).hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Ce.apply(null,arguments)}function Lr(n){if(Array.isArray(n))return n}function Nr(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var r,i,o,s,c=[],f=!0,d=!1;try{if(o=(t=t.call(n)).next,e!==0)for(;!(f=(r=o.call(t)).done)&&(c.push(r.value),c.length!==e);f=!0);}catch(v){d=!0,i=v}finally{try{if(!f&&t.return!=null&&(s=t.return(),Object(s)!==s))return}finally{if(d)throw i}}return c}}function Tt(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=Array(e);t<e;t++)r[t]=n[t];return r}function Ur(n,e){if(n){if(typeof n=="string")return Tt(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Tt(n,e):void 0}}function Vr(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
67
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function bt(n,e){return Lr(n)||Nr(n,e)||Ur(n,e)||Vr()}function Se(n){"@babel/helpers - typeof";return Se=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Se(n)}function Gr(n,e){if(Se(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(Se(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Fr(n){var e=Gr(n,"string");return Se(e)=="symbol"?e:e+""}function ce(n,e,t){return(e=Fr(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function zr(n,e){if(n==null)return{};var t={};for(var r in n)if({}.hasOwnProperty.call(n,r)){if(e.indexOf(r)!==-1)continue;t[r]=n[r]}return t}function Rt(n,e){if(n==null)return{};var t,r,i=zr(n,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);for(r=0;r<o.length;r++)t=o[r],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(n,t)&&(i[t]=n[t])}return i}var Ke={exports:{}};/*!
|
68
|
+
Copyright (c) 2018 Jed Watson.
|
69
|
+
Licensed under the MIT License (MIT), see
|
70
|
+
http://jedwatson.github.io/classnames
|
71
|
+
*/var Pt;function Hr(){return Pt||(Pt=1,function(n){(function(){var e={}.hasOwnProperty;function t(){for(var o="",s=0;s<arguments.length;s++){var c=arguments[s];c&&(o=i(o,r(c)))}return o}function r(o){if(typeof o=="string"||typeof o=="number")return o;if(typeof o!="object")return"";if(Array.isArray(o))return t.apply(null,o);if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]"))return o.toString();var s="";for(var c in o)e.call(o,c)&&o[c]&&(s=i(s,c));return s}function i(o,s){return s?o?o+" "+s:o+s:o}n.exports?(t.default=t,n.exports=t):window.classNames=t})()}(Ke)),Ke.exports}var Jr=Hr();const Wr=ht(Jr),oe=Math.round;function Xe(n,e){const t=n.replace(/^[^(]*\((.*)/,"$1").replace(/\).*/,"").match(/\d*\.?\d+%?/g)||[],r=t.map(i=>parseFloat(i));for(let i=0;i<3;i+=1)r[i]=e(r[i]||0,t[i]||"",i);return t[3]?r[3]=t[3].includes("%")?r[3]/100:r[3]:r[3]=1,r}const _t=(n,e,t)=>t===0?n:n/100;function Ae(n,e){const t=e||255;return n>t?t:n<0?0:n}class Re{constructor(e){ce(this,"isValid",!0),ce(this,"r",0),ce(this,"g",0),ce(this,"b",0),ce(this,"a",1),ce(this,"_h",void 0),ce(this,"_s",void 0),ce(this,"_l",void 0),ce(this,"_v",void 0),ce(this,"_max",void 0),ce(this,"_min",void 0),ce(this,"_brightness",void 0);function t(r){return r[0]in e&&r[1]in e&&r[2]in e}if(e)if(typeof e=="string"){let i=function(o){return r.startsWith(o)};const r=e.trim();/^#?[A-F\d]{3,8}$/i.test(r)?this.fromHexString(r):i("rgb")?this.fromRgbString(r):i("hsl")?this.fromHslString(r):(i("hsv")||i("hsb"))&&this.fromHsvString(r)}else if(e instanceof Re)this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this._h=e._h,this._s=e._s,this._l=e._l,this._v=e._v;else if(t("rgb"))this.r=Ae(e.r),this.g=Ae(e.g),this.b=Ae(e.b),this.a=typeof e.a=="number"?Ae(e.a,1):1;else if(t("hsl"))this.fromHsl(e);else if(t("hsv"))this.fromHsv(e);else throw new Error("@ant-design/fast-color: unsupported input "+JSON.stringify(e))}setR(e){return this._sc("r",e)}setG(e){return this._sc("g",e)}setB(e){return this._sc("b",e)}setA(e){return this._sc("a",e,1)}setHue(e){const t=this.toHsv();return t.h=e,this._c(t)}getLuminance(){function e(o){const s=o/255;return s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4)}const t=e(this.r),r=e(this.g),i=e(this.b);return .2126*t+.7152*r+.0722*i}getHue(){if(typeof this._h>"u"){const e=this.getMax()-this.getMin();e===0?this._h=0:this._h=oe(60*(this.r===this.getMax()?(this.g-this.b)/e+(this.g<this.b?6:0):this.g===this.getMax()?(this.b-this.r)/e+2:(this.r-this.g)/e+4))}return this._h}getSaturation(){if(typeof this._s>"u"){const e=this.getMax()-this.getMin();e===0?this._s=0:this._s=e/this.getMax()}return this._s}getLightness(){return typeof this._l>"u"&&(this._l=(this.getMax()+this.getMin())/510),this._l}getValue(){return typeof this._v>"u"&&(this._v=this.getMax()/255),this._v}getBrightness(){return typeof this._brightness>"u"&&(this._brightness=(this.r*299+this.g*587+this.b*114)/1e3),this._brightness}darken(e=10){const t=this.getHue(),r=this.getSaturation();let i=this.getLightness()-e/100;return i<0&&(i=0),this._c({h:t,s:r,l:i,a:this.a})}lighten(e=10){const t=this.getHue(),r=this.getSaturation();let i=this.getLightness()+e/100;return i>1&&(i=1),this._c({h:t,s:r,l:i,a:this.a})}mix(e,t=50){const r=this._c(e),i=t/100,o=c=>(r[c]-this[c])*i+this[c],s={r:oe(o("r")),g:oe(o("g")),b:oe(o("b")),a:oe(o("a")*100)/100};return this._c(s)}tint(e=10){return this.mix({r:255,g:255,b:255,a:1},e)}shade(e=10){return this.mix({r:0,g:0,b:0,a:1},e)}onBackground(e){const t=this._c(e),r=this.a+t.a*(1-this.a),i=o=>oe((this[o]*this.a+t[o]*t.a*(1-this.a))/r);return this._c({r:i("r"),g:i("g"),b:i("b"),a:r})}isDark(){return this.getBrightness()<128}isLight(){return this.getBrightness()>=128}equals(e){return this.r===e.r&&this.g===e.g&&this.b===e.b&&this.a===e.a}clone(){return this._c(this)}toHexString(){let e="#";const t=(this.r||0).toString(16);e+=t.length===2?t:"0"+t;const r=(this.g||0).toString(16);e+=r.length===2?r:"0"+r;const i=(this.b||0).toString(16);if(e+=i.length===2?i:"0"+i,typeof this.a=="number"&&this.a>=0&&this.a<1){const o=oe(this.a*255).toString(16);e+=o.length===2?o:"0"+o}return e}toHsl(){return{h:this.getHue(),s:this.getSaturation(),l:this.getLightness(),a:this.a}}toHslString(){const e=this.getHue(),t=oe(this.getSaturation()*100),r=oe(this.getLightness()*100);return this.a!==1?`hsla(${e},${t}%,${r}%,${this.a})`:`hsl(${e},${t}%,${r}%)`}toHsv(){return{h:this.getHue(),s:this.getSaturation(),v:this.getValue(),a:this.a}}toRgb(){return{r:this.r,g:this.g,b:this.b,a:this.a}}toRgbString(){return this.a!==1?`rgba(${this.r},${this.g},${this.b},${this.a})`:`rgb(${this.r},${this.g},${this.b})`}toString(){return this.toRgbString()}_sc(e,t,r){const i=this.clone();return i[e]=Ae(t,r),i}_c(e){return new this.constructor(e)}getMax(){return typeof this._max>"u"&&(this._max=Math.max(this.r,this.g,this.b)),this._max}getMin(){return typeof this._min>"u"&&(this._min=Math.min(this.r,this.g,this.b)),this._min}fromHexString(e){const t=e.replace("#","");function r(i,o){return parseInt(t[i]+t[o||i],16)}t.length<6?(this.r=r(0),this.g=r(1),this.b=r(2),this.a=t[3]?r(3)/255:1):(this.r=r(0,1),this.g=r(2,3),this.b=r(4,5),this.a=t[6]?r(6,7)/255:1)}fromHsl({h:e,s:t,l:r,a:i}){if(this._h=e%360,this._s=t,this._l=r,this.a=typeof i=="number"?i:1,t<=0){const D=oe(r*255);this.r=D,this.g=D,this.b=D}let o=0,s=0,c=0;const f=e/60,d=(1-Math.abs(2*r-1))*t,v=d*(1-Math.abs(f%2-1));f>=0&&f<1?(o=d,s=v):f>=1&&f<2?(o=v,s=d):f>=2&&f<3?(s=d,c=v):f>=3&&f<4?(s=v,c=d):f>=4&&f<5?(o=v,c=d):f>=5&&f<6&&(o=d,c=v);const R=r-d/2;this.r=oe((o+R)*255),this.g=oe((s+R)*255),this.b=oe((c+R)*255)}fromHsv({h:e,s:t,v:r,a:i}){this._h=e%360,this._s=t,this._v=r,this.a=typeof i=="number"?i:1;const o=oe(r*255);if(this.r=o,this.g=o,this.b=o,t<=0)return;const s=e/60,c=Math.floor(s),f=s-c,d=oe(r*(1-t)*255),v=oe(r*(1-t*f)*255),R=oe(r*(1-t*(1-f))*255);switch(c){case 0:this.g=R,this.b=d;break;case 1:this.r=v,this.b=d;break;case 2:this.r=d,this.b=R;break;case 3:this.r=d,this.g=v;break;case 4:this.r=R,this.g=d;break;case 5:default:this.g=d,this.b=v;break}}fromHsvString(e){const t=Xe(e,_t);this.fromHsv({h:t[0],s:t[1],v:t[2],a:t[3]})}fromHslString(e){const t=Xe(e,_t);this.fromHsl({h:t[0],s:t[1],l:t[2],a:t[3]})}fromRgbString(e){const t=Xe(e,(r,i)=>i.includes("%")?oe(r/100*255):r);this.r=t[0],this.g=t[1],this.b=t[2],this.a=t[3]}}var Ge=2,Et=.16,qr=.05,Br=.05,$r=.15,Ot=5,xt=4,Yr=[{index:7,amount:15},{index:6,amount:25},{index:5,amount:30},{index:5,amount:45},{index:5,amount:65},{index:5,amount:85},{index:4,amount:90},{index:3,amount:95},{index:2,amount:97},{index:1,amount:98}];function kt(n,e,t){var r;return Math.round(n.h)>=60&&Math.round(n.h)<=240?r=t?Math.round(n.h)-Ge*e:Math.round(n.h)+Ge*e:r=t?Math.round(n.h)+Ge*e:Math.round(n.h)-Ge*e,r<0?r+=360:r>=360&&(r-=360),r}function Mt(n,e,t){if(n.h===0&&n.s===0)return n.s;var r;return t?r=n.s-Et*e:e===xt?r=n.s+Et:r=n.s+qr*e,r>1&&(r=1),t&&e===Ot&&r>.1&&(r=.1),r<.06&&(r=.06),Math.round(r*100)/100}function Dt(n,e,t){var r;return t?r=n.v+Br*e:r=n.v-$r*e,r=Math.max(0,Math.min(1,r)),Math.round(r*100)/100}function Kr(n){for(var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=[],r=new Re(n),i=r.toHsv(),o=Ot;o>0;o-=1){var s=new Re({h:kt(i,o,!0),s:Mt(i,o,!0),v:Dt(i,o,!0)});t.push(s)}t.push(r);for(var c=1;c<=xt;c+=1){var f=new Re({h:kt(i,c),s:Mt(i,c),v:Dt(i,c)});t.push(f)}return e.theme==="dark"?Yr.map(function(d){var v=d.index,R=d.amount;return new Re(e.backgroundColor||"#141414").mix(t[v],R).toHexString()}):t.map(function(d){return d.toHexString()})}var Qe=["#e6f4ff","#bae0ff","#91caff","#69b1ff","#4096ff","#1677ff","#0958d9","#003eb3","#002c8c","#001d66"];Qe.primary=Qe[5];function At(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function me(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?At(Object(t),!0).forEach(function(r){ce(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):At(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Xr(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}function Qr(n,e){if(!n)return!1;if(n.contains)return n.contains(e);for(var t=e;t;){if(t===n)return!0;t=t.parentNode}return!1}var It="data-rc-order",jt="data-rc-priority",Zr="rc-util-key",Ze=new Map;function Lt(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=n.mark;return e?e.startsWith("data-")?e:"data-".concat(e):Zr}function we(n){if(n.attachTo)return n.attachTo;var e=document.querySelector("head");return e||document.body}function wr(n){return n==="queue"?"prependQueue":n?"prepend":"append"}function et(n){return Array.from((Ze.get(n)||n).children).filter(function(e){return e.tagName==="STYLE"})}function Nt(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Xr())return null;var t=e.csp,r=e.prepend,i=e.priority,o=i===void 0?0:i,s=wr(r),c=s==="prependQueue",f=document.createElement("style");f.setAttribute(It,s),c&&o&&f.setAttribute(jt,"".concat(o)),t!=null&&t.nonce&&(f.nonce=t==null?void 0:t.nonce),f.innerHTML=n;var d=we(e),v=d.firstChild;if(r){if(c){var R=(e.styles||et(d)).filter(function(D){if(!["prepend","prependQueue"].includes(D.getAttribute(It)))return!1;var N=Number(D.getAttribute(jt)||0);return o>=N});if(R.length)return d.insertBefore(f,R[R.length-1].nextSibling),f}d.insertBefore(f,v)}else d.appendChild(f);return f}function en(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=we(e);return(e.styles||et(t)).find(function(r){return r.getAttribute(Lt(e))===n})}function tn(n,e){var t=Ze.get(n);if(!t||!Qr(document,t)){var r=Nt("",e),i=r.parentNode;Ze.set(n,i),n.removeChild(r)}}function rn(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=we(t),i=et(r),o=me(me({},t),{},{styles:i});tn(r,o);var s=en(e,o);if(s){var c,f;if((c=o.csp)!==null&&c!==void 0&&c.nonce&&s.nonce!==((f=o.csp)===null||f===void 0?void 0:f.nonce)){var d;s.nonce=(d=o.csp)===null||d===void 0?void 0:d.nonce}return s.innerHTML!==n&&(s.innerHTML=n),s}var v=Nt(n,o);return v.setAttribute(Lt(o),e),v}function Ut(n){var e;return n==null||(e=n.getRootNode)===null||e===void 0?void 0:e.call(n)}function nn(n){return Ut(n)instanceof ShadowRoot}function on(n){return nn(n)?Ut(n):null}var tt={},rt=[],sn=function(e){rt.push(e)};function an(n,e){if(process.env.NODE_ENV!=="production"&&!n&&console!==void 0){var t=rt.reduce(function(r,i){return i(r??"","warning")},e);t&&console.error("Warning: ".concat(t))}}function cn(n,e){if(process.env.NODE_ENV!=="production"&&!n&&console!==void 0){var t=rt.reduce(function(r,i){return i(r??"","note")},e);t&&console.warn("Note: ".concat(t))}}function un(){tt={}}function Vt(n,e,t){!e&&!tt[t]&&(n(!1,t),tt[t]=!0)}function Fe(n,e){Vt(an,n,e)}function fn(n,e){Vt(cn,n,e)}Fe.preMessage=sn,Fe.resetWarned=un,Fe.noteOnce=fn;function dn(n){return n.replace(/-(.)/g,function(e,t){return t.toUpperCase()})}function ln(n,e){Fe(n,"[@ant-design/icons] ".concat(e))}function Gt(n){return Se(n)==="object"&&typeof n.name=="string"&&typeof n.theme=="string"&&(Se(n.icon)==="object"||typeof n.icon=="function")}function Ft(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return Object.keys(n).reduce(function(e,t){var r=n[t];switch(t){case"class":e.className=r,delete e.class;break;default:delete e[t],e[dn(t)]=r}return e},{})}function nt(n,e,t){return t?re.createElement(n.tag,me(me({key:e},Ft(n.attrs)),t),(n.children||[]).map(function(r,i){return nt(r,"".concat(e,"-").concat(n.tag,"-").concat(i))})):re.createElement(n.tag,me({key:e},Ft(n.attrs)),(n.children||[]).map(function(r,i){return nt(r,"".concat(e,"-").concat(n.tag,"-").concat(i))}))}function zt(n){return Kr(n)[0]}function Ht(n){return n?Array.isArray(n)?n:[n]:[]}var pn=`
|
72
|
+
.anticon {
|
73
|
+
display: inline-flex;
|
74
|
+
align-items: center;
|
75
|
+
color: inherit;
|
76
|
+
font-style: normal;
|
77
|
+
line-height: 0;
|
78
|
+
text-align: center;
|
79
|
+
text-transform: none;
|
80
|
+
vertical-align: -0.125em;
|
81
|
+
text-rendering: optimizeLegibility;
|
82
|
+
-webkit-font-smoothing: antialiased;
|
83
|
+
-moz-osx-font-smoothing: grayscale;
|
84
|
+
}
|
85
|
+
|
86
|
+
.anticon > * {
|
87
|
+
line-height: 1;
|
88
|
+
}
|
89
|
+
|
90
|
+
.anticon svg {
|
91
|
+
display: inline-block;
|
92
|
+
}
|
93
|
+
|
94
|
+
.anticon::before {
|
95
|
+
display: none;
|
96
|
+
}
|
97
|
+
|
98
|
+
.anticon .anticon-icon {
|
99
|
+
display: block;
|
100
|
+
}
|
101
|
+
|
102
|
+
.anticon[tabindex] {
|
103
|
+
cursor: pointer;
|
104
|
+
}
|
105
|
+
|
106
|
+
.anticon-spin::before,
|
107
|
+
.anticon-spin {
|
108
|
+
display: inline-block;
|
109
|
+
-webkit-animation: loadingCircle 1s infinite linear;
|
110
|
+
animation: loadingCircle 1s infinite linear;
|
111
|
+
}
|
112
|
+
|
113
|
+
@-webkit-keyframes loadingCircle {
|
114
|
+
100% {
|
115
|
+
-webkit-transform: rotate(360deg);
|
116
|
+
transform: rotate(360deg);
|
117
|
+
}
|
118
|
+
}
|
119
|
+
|
120
|
+
@keyframes loadingCircle {
|
121
|
+
100% {
|
122
|
+
-webkit-transform: rotate(360deg);
|
123
|
+
transform: rotate(360deg);
|
124
|
+
}
|
125
|
+
}
|
126
|
+
`,mn=function(e){var t=re.useContext(St),r=t.csp,i=t.prefixCls,o=t.layer,s=pn;i&&(s=s.replace(/anticon/g,i)),o&&(s="@layer ".concat(o,` {
|
127
|
+
`).concat(s,`
|
128
|
+
}`)),re.useEffect(function(){var c=e.current,f=on(c);rn(s,"@ant-design-icons",{prepend:!o,csp:r,attachTo:f})},[])},hn=["icon","className","onClick","style","primaryColor","secondaryColor"],Ie={primaryColor:"#333",secondaryColor:"#E6E6E6",calculated:!1};function gn(n){var e=n.primaryColor,t=n.secondaryColor;Ie.primaryColor=e,Ie.secondaryColor=t||zt(e),Ie.calculated=!!t}function vn(){return me({},Ie)}var Pe=function(e){var t=e.icon,r=e.className,i=e.onClick,o=e.style,s=e.primaryColor,c=e.secondaryColor,f=Rt(e,hn),d=de.useRef(),v=Ie;if(s&&(v={primaryColor:s,secondaryColor:c||zt(s)}),mn(d),ln(Gt(t),"icon should be icon definiton, but got ".concat(t)),!Gt(t))return null;var R=t;return R&&typeof R.icon=="function"&&(R=me(me({},R),{},{icon:R.icon(v.primaryColor,v.secondaryColor)})),nt(R.icon,"svg-".concat(R.name),me(me({className:r,onClick:i,style:o,"data-icon":R.name,width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},f),{},{ref:d}))};Pe.displayName="IconReact",Pe.getTwoToneColors=vn,Pe.setTwoToneColors=gn;function Jt(n){var e=Ht(n),t=bt(e,2),r=t[0],i=t[1];return Pe.setTwoToneColors({primaryColor:r,secondaryColor:i})}function yn(){var n=Pe.getTwoToneColors();return n.calculated?[n.primaryColor,n.secondaryColor]:n.primaryColor}var Cn=["className","icon","spin","rotate","tabIndex","onClick","twoToneColor"];Jt(Qe.primary);var Te=de.forwardRef(function(n,e){var t=n.className,r=n.icon,i=n.spin,o=n.rotate,s=n.tabIndex,c=n.onClick,f=n.twoToneColor,d=Rt(n,Cn),v=de.useContext(St),R=v.prefixCls,D=R===void 0?"anticon":R,N=v.rootClassName,M=Wr(N,D,ce(ce({},"".concat(D,"-").concat(r.name),!!r.name),"".concat(D,"-spin"),!!i||r.name==="loading"),t),H=s;H===void 0&&c&&(H=-1);var O=o?{msTransform:"rotate(".concat(o,"deg)"),transform:"rotate(".concat(o,"deg)")}:void 0,y=Ht(f),P=bt(y,2),m=P[0],g=P[1];return de.createElement("span",Ce({role:"img","aria-label":r.name},d,{ref:e,tabIndex:H,onClick:c,className:M}),de.createElement(Pe,{icon:r,primaryColor:m,secondaryColor:g,style:O}))});Te.displayName="AntdIcon",Te.getTwoToneColor=yn,Te.setTwoToneColor=Jt;var Sn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M842 454c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 140.3-113.7 254-254 254S258 594.3 258 454c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 168.7 126.6 307.9 290 327.6V884H326.7c-13.7 0-24.7 14.3-24.7 32v36c0 4.4 2.8 8 6.2 8h407.6c3.4 0 6.2-3.6 6.2-8v-36c0-17.7-11-32-24.7-32H548V782.1c165.3-18 294-158 294-328.1zM512 624c93.9 0 170-75.2 170-168V232c0-92.8-76.1-168-170-168s-170 75.2-170 168v224c0 92.8 76.1 168 170 168zm-94-392c0-50.6 41.9-92 94-92s94 41.4 94 92v224c0 50.6-41.9 92-94 92s-94-41.4-94-92V232z"}}]},name:"audio",theme:"outlined"},Tn=function(e,t){return de.createElement(Te,Ce({},e,{ref:t,icon:Sn}))},it=de.forwardRef(Tn);process.env.NODE_ENV!=="production"&&(it.displayName="AudioOutlined");var bn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M864 248H728l-32.4-90.8a32.07 32.07 0 00-30.2-21.2H358.6c-13.5 0-25.6 8.5-30.1 21.2L296 248H160c-44.2 0-80 35.8-80 80v456c0 44.2 35.8 80 80 80h704c44.2 0 80-35.8 80-80V328c0-44.2-35.8-80-80-80zm8 536c0 4.4-3.6 8-8 8H160c-4.4 0-8-3.6-8-8V328c0-4.4 3.6-8 8-8h186.7l17.1-47.8 22.9-64.2h250.5l22.9 64.2 17.1 47.8H864c4.4 0 8 3.6 8 8v456zM512 384c-88.4 0-160 71.6-160 160s71.6 160 160 160 160-71.6 160-160-71.6-160-160-160zm0 256c-53 0-96-43-96-96s43-96 96-96 96 43 96 96-43 96-96 96z"}}]},name:"camera",theme:"outlined"},Rn=function(e,t){return de.createElement(Te,Ce({},e,{ref:t,icon:bn}))},ot=de.forwardRef(Rn);process.env.NODE_ENV!=="production"&&(ot.displayName="CameraOutlined");var Pn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M877.1 238.7L770.6 132.3c-13-13-30.4-20.3-48.8-20.3s-35.8 7.2-48.8 20.3L558.3 246.8c-13 13-20.3 30.5-20.3 48.9 0 18.5 7.2 35.8 20.3 48.9l89.6 89.7a405.46 405.46 0 01-86.4 127.3c-36.7 36.9-79.6 66-127.2 86.6l-89.6-89.7c-13-13-30.4-20.3-48.8-20.3a68.2 68.2 0 00-48.8 20.3L132.3 673c-13 13-20.3 30.5-20.3 48.9 0 18.5 7.2 35.8 20.3 48.9l106.4 106.4c22.2 22.2 52.8 34.9 84.2 34.9 6.5 0 12.8-.5 19.2-1.6 132.4-21.8 263.8-92.3 369.9-198.3C818 606 888.4 474.6 910.4 342.1c6.3-37.6-6.3-76.3-33.3-103.4zm-37.6 91.5c-19.5 117.9-82.9 235.5-178.4 331s-213 158.9-330.9 178.4c-14.8 2.5-30-2.5-40.8-13.2L184.9 721.9 295.7 611l119.8 120 .9.9 21.6-8a481.29 481.29 0 00285.7-285.8l8-21.6-120.8-120.7 110.8-110.9 104.5 104.5c10.8 10.8 15.8 26 13.3 40.8z"}}]},name:"phone",theme:"outlined"},_n=function(e,t){return de.createElement(Te,Ce({},e,{ref:t,icon:Pn}))},Wt=de.forwardRef(_n);process.env.NODE_ENV!=="production"&&(Wt.displayName="PhoneOutlined");var En={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"defs",attrs:{},children:[{tag:"style",attrs:{}}]},{tag:"path",attrs:{d:"M368 724H252V608c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v116H72c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h116v116c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V788h116c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z"}},{tag:"path",attrs:{d:"M912 302.3L784 376V224c0-35.3-28.7-64-64-64H128c-35.3 0-64 28.7-64 64v352h72V232h576v560H448v72h272c35.3 0 64-28.7 64-64V648l128 73.7c21.3 12.3 48-3.1 48-27.6V330c0-24.6-26.7-40-48-27.7zM888 625l-104-59.8V458.9L888 399v226z"}},{tag:"path",attrs:{d:"M320 360c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H208c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h112z"}}]},name:"video-camera-add",theme:"outlined"},On=function(e,t){return de.createElement(Te,Ce({},e,{ref:t,icon:En}))},st=de.forwardRef(On);process.env.NODE_ENV!=="production"&&(st.displayName="VideoCameraAddOutlined");let qt=!0,Bt=!0;function ze(n,e,t){const r=n.match(e);return r&&r.length>=t&&parseInt(r[t],10)}function be(n,e,t){if(!n.RTCPeerConnection)return;const r=n.RTCPeerConnection.prototype,i=r.addEventListener;r.addEventListener=function(s,c){if(s!==e)return i.apply(this,arguments);const f=d=>{const v=t(d);v&&(c.handleEvent?c.handleEvent(v):c(v))};return this._eventMap=this._eventMap||{},this._eventMap[e]||(this._eventMap[e]=new Map),this._eventMap[e].set(c,f),i.apply(this,[s,f])};const o=r.removeEventListener;r.removeEventListener=function(s,c){if(s!==e||!this._eventMap||!this._eventMap[e])return o.apply(this,arguments);if(!this._eventMap[e].has(c))return o.apply(this,arguments);const f=this._eventMap[e].get(c);return this._eventMap[e].delete(c),this._eventMap[e].size===0&&delete this._eventMap[e],Object.keys(this._eventMap).length===0&&delete this._eventMap,o.apply(this,[s,f])},Object.defineProperty(r,"on"+e,{get(){return this["_on"+e]},set(s){this["_on"+e]&&(this.removeEventListener(e,this["_on"+e]),delete this["_on"+e]),s&&this.addEventListener(e,this["_on"+e]=s)},enumerable:!0,configurable:!0})}function xn(n){return typeof n!="boolean"?new Error("Argument type: "+typeof n+". Please use a boolean."):(qt=n,n?"adapter.js logging disabled":"adapter.js logging enabled")}function kn(n){return typeof n!="boolean"?new Error("Argument type: "+typeof n+". Please use a boolean."):(Bt=!n,"adapter.js deprecation warnings "+(n?"disabled":"enabled"))}function $t(){if(typeof window=="object"){if(qt)return;typeof console<"u"&&typeof console.log=="function"&&console.log.apply(console,arguments)}}function at(n,e){Bt&&console.warn(n+" is deprecated, please use "+e+" instead.")}function Mn(n){const e={browser:null,version:null};if(typeof n>"u"||!n.navigator||!n.navigator.userAgent)return e.browser="Not a browser.",e;const{navigator:t}=n;if(t.userAgentData&&t.userAgentData.brands){const r=t.userAgentData.brands.find(i=>i.brand==="Chromium");if(r)return{browser:"chrome",version:parseInt(r.version,10)}}if(t.mozGetUserMedia)e.browser="firefox",e.version=ze(t.userAgent,/Firefox\/(\d+)\./,1);else if(t.webkitGetUserMedia||n.isSecureContext===!1&&n.webkitRTCPeerConnection)e.browser="chrome",e.version=ze(t.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(n.RTCPeerConnection&&t.userAgent.match(/AppleWebKit\/(\d+)\./))e.browser="safari",e.version=ze(t.userAgent,/AppleWebKit\/(\d+)\./,1),e.supportsUnifiedPlan=n.RTCRtpTransceiver&&"currentDirection"in n.RTCRtpTransceiver.prototype;else return e.browser="Not a supported browser.",e;return e}function Yt(n){return Object.prototype.toString.call(n)==="[object Object]"}function Kt(n){return Yt(n)?Object.keys(n).reduce(function(e,t){const r=Yt(n[t]),i=r?Kt(n[t]):n[t],o=r&&!Object.keys(i).length;return i===void 0||o?e:Object.assign(e,{[t]:i})},{}):n}function ct(n,e,t){!e||t.has(e.id)||(t.set(e.id,e),Object.keys(e).forEach(r=>{r.endsWith("Id")?ct(n,n.get(e[r]),t):r.endsWith("Ids")&&e[r].forEach(i=>{ct(n,n.get(i),t)})}))}function Xt(n,e,t){const r=t?"outbound-rtp":"inbound-rtp",i=new Map;if(e===null)return i;const o=[];return n.forEach(s=>{s.type==="track"&&s.trackIdentifier===e.id&&o.push(s)}),o.forEach(s=>{n.forEach(c=>{c.type===r&&c.trackId===s.id&&ct(n,c,i)})}),i}const Qt=$t;function Zt(n,e){const t=n&&n.navigator;if(!t.mediaDevices)return;const r=function(c){if(typeof c!="object"||c.mandatory||c.optional)return c;const f={};return Object.keys(c).forEach(d=>{if(d==="require"||d==="advanced"||d==="mediaSource")return;const v=typeof c[d]=="object"?c[d]:{ideal:c[d]};v.exact!==void 0&&typeof v.exact=="number"&&(v.min=v.max=v.exact);const R=function(D,N){return D?D+N.charAt(0).toUpperCase()+N.slice(1):N==="deviceId"?"sourceId":N};if(v.ideal!==void 0){f.optional=f.optional||[];let D={};typeof v.ideal=="number"?(D[R("min",d)]=v.ideal,f.optional.push(D),D={},D[R("max",d)]=v.ideal,f.optional.push(D)):(D[R("",d)]=v.ideal,f.optional.push(D))}v.exact!==void 0&&typeof v.exact!="number"?(f.mandatory=f.mandatory||{},f.mandatory[R("",d)]=v.exact):["min","max"].forEach(D=>{v[D]!==void 0&&(f.mandatory=f.mandatory||{},f.mandatory[R(D,d)]=v[D])})}),c.advanced&&(f.optional=(f.optional||[]).concat(c.advanced)),f},i=function(c,f){if(e.version>=61)return f(c);if(c=JSON.parse(JSON.stringify(c)),c&&typeof c.audio=="object"){const d=function(v,R,D){R in v&&!(D in v)&&(v[D]=v[R],delete v[R])};c=JSON.parse(JSON.stringify(c)),d(c.audio,"autoGainControl","googAutoGainControl"),d(c.audio,"noiseSuppression","googNoiseSuppression"),c.audio=r(c.audio)}if(c&&typeof c.video=="object"){let d=c.video.facingMode;d=d&&(typeof d=="object"?d:{ideal:d});const v=e.version<66;if(d&&(d.exact==="user"||d.exact==="environment"||d.ideal==="user"||d.ideal==="environment")&&!(t.mediaDevices.getSupportedConstraints&&t.mediaDevices.getSupportedConstraints().facingMode&&!v)){delete c.video.facingMode;let R;if(d.exact==="environment"||d.ideal==="environment"?R=["back","rear"]:(d.exact==="user"||d.ideal==="user")&&(R=["front"]),R)return t.mediaDevices.enumerateDevices().then(D=>{D=D.filter(M=>M.kind==="videoinput");let N=D.find(M=>R.some(H=>M.label.toLowerCase().includes(H)));return!N&&D.length&&R.includes("back")&&(N=D[D.length-1]),N&&(c.video.deviceId=d.exact?{exact:N.deviceId}:{ideal:N.deviceId}),c.video=r(c.video),Qt("chrome: "+JSON.stringify(c)),f(c)})}c.video=r(c.video)}return Qt("chrome: "+JSON.stringify(c)),f(c)},o=function(c){return e.version>=64?c:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[c.name]||c.name,message:c.message,constraint:c.constraint||c.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}},s=function(c,f,d){i(c,v=>{t.webkitGetUserMedia(v,f,R=>{d&&d(o(R))})})};if(t.getUserMedia=s.bind(t),t.mediaDevices.getUserMedia){const c=t.mediaDevices.getUserMedia.bind(t.mediaDevices);t.mediaDevices.getUserMedia=function(f){return i(f,d=>c(d).then(v=>{if(d.audio&&!v.getAudioTracks().length||d.video&&!v.getVideoTracks().length)throw v.getTracks().forEach(R=>{R.stop()}),new DOMException("","NotFoundError");return v},v=>Promise.reject(o(v))))}}}function wt(n){n.MediaStream=n.MediaStream||n.webkitMediaStream}function er(n){if(typeof n=="object"&&n.RTCPeerConnection&&!("ontrack"in n.RTCPeerConnection.prototype)){Object.defineProperty(n.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(t){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=t)},enumerable:!0,configurable:!0});const e=n.RTCPeerConnection.prototype.setRemoteDescription;n.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=r=>{r.stream.addEventListener("addtrack",i=>{let o;n.RTCPeerConnection.prototype.getReceivers?o=this.getReceivers().find(c=>c.track&&c.track.id===i.track.id):o={track:i.track};const s=new Event("track");s.track=i.track,s.receiver=o,s.transceiver={receiver:o},s.streams=[r.stream],this.dispatchEvent(s)}),r.stream.getTracks().forEach(i=>{let o;n.RTCPeerConnection.prototype.getReceivers?o=this.getReceivers().find(c=>c.track&&c.track.id===i.id):o={track:i};const s=new Event("track");s.track=i,s.receiver=o,s.transceiver={receiver:o},s.streams=[r.stream],this.dispatchEvent(s)})},this.addEventListener("addstream",this._ontrackpoly)),e.apply(this,arguments)}}else be(n,"track",e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e))}function tr(n){if(typeof n=="object"&&n.RTCPeerConnection&&!("getSenders"in n.RTCPeerConnection.prototype)&&"createDTMFSender"in n.RTCPeerConnection.prototype){const e=function(i,o){return{track:o,get dtmf(){return this._dtmf===void 0&&(o.kind==="audio"?this._dtmf=i.createDTMFSender(o):this._dtmf=null),this._dtmf},_pc:i}};if(!n.RTCPeerConnection.prototype.getSenders){n.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const i=n.RTCPeerConnection.prototype.addTrack;n.RTCPeerConnection.prototype.addTrack=function(c,f){let d=i.apply(this,arguments);return d||(d=e(this,c),this._senders.push(d)),d};const o=n.RTCPeerConnection.prototype.removeTrack;n.RTCPeerConnection.prototype.removeTrack=function(c){o.apply(this,arguments);const f=this._senders.indexOf(c);f!==-1&&this._senders.splice(f,1)}}const t=n.RTCPeerConnection.prototype.addStream;n.RTCPeerConnection.prototype.addStream=function(o){this._senders=this._senders||[],t.apply(this,[o]),o.getTracks().forEach(s=>{this._senders.push(e(this,s))})};const r=n.RTCPeerConnection.prototype.removeStream;n.RTCPeerConnection.prototype.removeStream=function(o){this._senders=this._senders||[],r.apply(this,[o]),o.getTracks().forEach(s=>{const c=this._senders.find(f=>f.track===s);c&&this._senders.splice(this._senders.indexOf(c),1)})}}else if(typeof n=="object"&&n.RTCPeerConnection&&"getSenders"in n.RTCPeerConnection.prototype&&"createDTMFSender"in n.RTCPeerConnection.prototype&&n.RTCRtpSender&&!("dtmf"in n.RTCRtpSender.prototype)){const e=n.RTCPeerConnection.prototype.getSenders;n.RTCPeerConnection.prototype.getSenders=function(){const r=e.apply(this,[]);return r.forEach(i=>i._pc=this),r},Object.defineProperty(n.RTCRtpSender.prototype,"dtmf",{get(){return this._dtmf===void 0&&(this.track.kind==="audio"?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function rr(n){if(!(typeof n=="object"&&n.RTCPeerConnection&&n.RTCRtpSender&&n.RTCRtpReceiver))return;if(!("getStats"in n.RTCRtpSender.prototype)){const t=n.RTCPeerConnection.prototype.getSenders;t&&(n.RTCPeerConnection.prototype.getSenders=function(){const o=t.apply(this,[]);return o.forEach(s=>s._pc=this),o});const r=n.RTCPeerConnection.prototype.addTrack;r&&(n.RTCPeerConnection.prototype.addTrack=function(){const o=r.apply(this,arguments);return o._pc=this,o}),n.RTCRtpSender.prototype.getStats=function(){const o=this;return this._pc.getStats().then(s=>Xt(s,o.track,!0))}}if(!("getStats"in n.RTCRtpReceiver.prototype)){const t=n.RTCPeerConnection.prototype.getReceivers;t&&(n.RTCPeerConnection.prototype.getReceivers=function(){const i=t.apply(this,[]);return i.forEach(o=>o._pc=this),i}),be(n,"track",r=>(r.receiver._pc=r.srcElement,r)),n.RTCRtpReceiver.prototype.getStats=function(){const i=this;return this._pc.getStats().then(o=>Xt(o,i.track,!1))}}if(!("getStats"in n.RTCRtpSender.prototype&&"getStats"in n.RTCRtpReceiver.prototype))return;const e=n.RTCPeerConnection.prototype.getStats;n.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof n.MediaStreamTrack){const r=arguments[0];let i,o,s;return this.getSenders().forEach(c=>{c.track===r&&(i?s=!0:i=c)}),this.getReceivers().forEach(c=>(c.track===r&&(o?s=!0:o=c),c.track===r)),s||i&&o?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):i?i.getStats():o?o.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return e.apply(this,arguments)}}function nr(n){n.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(s=>this._shimmedLocalStreams[s][0])};const e=n.RTCPeerConnection.prototype.addTrack;n.RTCPeerConnection.prototype.addTrack=function(s,c){if(!c)return e.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const f=e.apply(this,arguments);return this._shimmedLocalStreams[c.id]?this._shimmedLocalStreams[c.id].indexOf(f)===-1&&this._shimmedLocalStreams[c.id].push(f):this._shimmedLocalStreams[c.id]=[c,f],f};const t=n.RTCPeerConnection.prototype.addStream;n.RTCPeerConnection.prototype.addStream=function(s){this._shimmedLocalStreams=this._shimmedLocalStreams||{},s.getTracks().forEach(d=>{if(this.getSenders().find(R=>R.track===d))throw new DOMException("Track already exists.","InvalidAccessError")});const c=this.getSenders();t.apply(this,arguments);const f=this.getSenders().filter(d=>c.indexOf(d)===-1);this._shimmedLocalStreams[s.id]=[s].concat(f)};const r=n.RTCPeerConnection.prototype.removeStream;n.RTCPeerConnection.prototype.removeStream=function(s){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[s.id],r.apply(this,arguments)};const i=n.RTCPeerConnection.prototype.removeTrack;n.RTCPeerConnection.prototype.removeTrack=function(s){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},s&&Object.keys(this._shimmedLocalStreams).forEach(c=>{const f=this._shimmedLocalStreams[c].indexOf(s);f!==-1&&this._shimmedLocalStreams[c].splice(f,1),this._shimmedLocalStreams[c].length===1&&delete this._shimmedLocalStreams[c]}),i.apply(this,arguments)}}function ir(n,e){if(!n.RTCPeerConnection)return;if(n.RTCPeerConnection.prototype.addTrack&&e.version>=65)return nr(n);const t=n.RTCPeerConnection.prototype.getLocalStreams;n.RTCPeerConnection.prototype.getLocalStreams=function(){const v=t.apply(this);return this._reverseStreams=this._reverseStreams||{},v.map(R=>this._reverseStreams[R.id])};const r=n.RTCPeerConnection.prototype.addStream;n.RTCPeerConnection.prototype.addStream=function(v){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},v.getTracks().forEach(R=>{if(this.getSenders().find(N=>N.track===R))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[v.id]){const R=new n.MediaStream(v.getTracks());this._streams[v.id]=R,this._reverseStreams[R.id]=v,v=R}r.apply(this,[v])};const i=n.RTCPeerConnection.prototype.removeStream;n.RTCPeerConnection.prototype.removeStream=function(v){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[v.id]||v]),delete this._reverseStreams[this._streams[v.id]?this._streams[v.id].id:v.id],delete this._streams[v.id]},n.RTCPeerConnection.prototype.addTrack=function(v,R){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const D=[].slice.call(arguments,1);if(D.length!==1||!D[0].getTracks().find(H=>H===v))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find(H=>H.track===v))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const M=this._streams[R.id];if(M)M.addTrack(v),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const H=new n.MediaStream([v]);this._streams[R.id]=H,this._reverseStreams[H.id]=R,this.addStream(H)}return this.getSenders().find(H=>H.track===v)};function o(d,v){let R=v.sdp;return Object.keys(d._reverseStreams||[]).forEach(D=>{const N=d._reverseStreams[D],M=d._streams[N.id];R=R.replace(new RegExp(M.id,"g"),N.id)}),new RTCSessionDescription({type:v.type,sdp:R})}function s(d,v){let R=v.sdp;return Object.keys(d._reverseStreams||[]).forEach(D=>{const N=d._reverseStreams[D],M=d._streams[N.id];R=R.replace(new RegExp(N.id,"g"),M.id)}),new RTCSessionDescription({type:v.type,sdp:R})}["createOffer","createAnswer"].forEach(function(d){const v=n.RTCPeerConnection.prototype[d],R={[d](){const D=arguments;return arguments.length&&typeof arguments[0]=="function"?v.apply(this,[M=>{const H=o(this,M);D[0].apply(null,[H])},M=>{D[1]&&D[1].apply(null,M)},arguments[2]]):v.apply(this,arguments).then(M=>o(this,M))}};n.RTCPeerConnection.prototype[d]=R[d]});const c=n.RTCPeerConnection.prototype.setLocalDescription;n.RTCPeerConnection.prototype.setLocalDescription=function(){return!arguments.length||!arguments[0].type?c.apply(this,arguments):(arguments[0]=s(this,arguments[0]),c.apply(this,arguments))};const f=Object.getOwnPropertyDescriptor(n.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(n.RTCPeerConnection.prototype,"localDescription",{get(){const d=f.get.apply(this);return d.type===""?d:o(this,d)}}),n.RTCPeerConnection.prototype.removeTrack=function(v){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!v._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(v._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{};let D;Object.keys(this._streams).forEach(N=>{this._streams[N].getTracks().find(H=>v.track===H)&&(D=this._streams[N])}),D&&(D.getTracks().length===1?this.removeStream(this._reverseStreams[D.id]):D.removeTrack(v.track),this.dispatchEvent(new Event("negotiationneeded")))}}function ut(n,e){!n.RTCPeerConnection&&n.webkitRTCPeerConnection&&(n.RTCPeerConnection=n.webkitRTCPeerConnection),n.RTCPeerConnection&&e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(t){const r=n.RTCPeerConnection.prototype[t],i={[t](){return arguments[0]=new(t==="addIceCandidate"?n.RTCIceCandidate:n.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};n.RTCPeerConnection.prototype[t]=i[t]})}function or(n,e){be(n,"negotiationneeded",t=>{const r=t.target;if(!((e.version<72||r.getConfiguration&&r.getConfiguration().sdpSemantics==="plan-b")&&r.signalingState!=="stable"))return t})}const sr=Object.freeze(Object.defineProperty({__proto__:null,fixNegotiationNeeded:or,shimAddTrackRemoveTrack:ir,shimAddTrackRemoveTrackWithNative:nr,shimGetSendersWithDtmf:tr,shimGetUserMedia:Zt,shimMediaStream:wt,shimOnTrack:er,shimPeerConnection:ut,shimSenderReceiverGetStats:rr},Symbol.toStringTag,{value:"Module"}));function ar(n,e){const t=n&&n.navigator,r=n&&n.MediaStreamTrack;if(t.getUserMedia=function(i,o,s){at("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),t.mediaDevices.getUserMedia(i).then(o,s)},!(e.version>55&&"autoGainControl"in t.mediaDevices.getSupportedConstraints())){const i=function(s,c,f){c in s&&!(f in s)&&(s[f]=s[c],delete s[c])},o=t.mediaDevices.getUserMedia.bind(t.mediaDevices);if(t.mediaDevices.getUserMedia=function(s){return typeof s=="object"&&typeof s.audio=="object"&&(s=JSON.parse(JSON.stringify(s)),i(s.audio,"autoGainControl","mozAutoGainControl"),i(s.audio,"noiseSuppression","mozNoiseSuppression")),o(s)},r&&r.prototype.getSettings){const s=r.prototype.getSettings;r.prototype.getSettings=function(){const c=s.apply(this,arguments);return i(c,"mozAutoGainControl","autoGainControl"),i(c,"mozNoiseSuppression","noiseSuppression"),c}}if(r&&r.prototype.applyConstraints){const s=r.prototype.applyConstraints;r.prototype.applyConstraints=function(c){return this.kind==="audio"&&typeof c=="object"&&(c=JSON.parse(JSON.stringify(c)),i(c,"autoGainControl","mozAutoGainControl"),i(c,"noiseSuppression","mozNoiseSuppression")),s.apply(this,[c])}}}}function Dn(n,e){n.navigator.mediaDevices&&"getDisplayMedia"in n.navigator.mediaDevices||n.navigator.mediaDevices&&(n.navigator.mediaDevices.getDisplayMedia=function(r){if(!(r&&r.video)){const i=new DOMException("getDisplayMedia without video constraints is undefined");return i.name="NotFoundError",i.code=8,Promise.reject(i)}return r.video===!0?r.video={mediaSource:e}:r.video.mediaSource=e,n.navigator.mediaDevices.getUserMedia(r)})}function cr(n){typeof n=="object"&&n.RTCTrackEvent&&"receiver"in n.RTCTrackEvent.prototype&&!("transceiver"in n.RTCTrackEvent.prototype)&&Object.defineProperty(n.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function ft(n,e){if(typeof n!="object"||!(n.RTCPeerConnection||n.mozRTCPeerConnection))return;!n.RTCPeerConnection&&n.mozRTCPeerConnection&&(n.RTCPeerConnection=n.mozRTCPeerConnection),e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(i){const o=n.RTCPeerConnection.prototype[i],s={[i](){return arguments[0]=new(i==="addIceCandidate"?n.RTCIceCandidate:n.RTCSessionDescription)(arguments[0]),o.apply(this,arguments)}};n.RTCPeerConnection.prototype[i]=s[i]});const t={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},r=n.RTCPeerConnection.prototype.getStats;n.RTCPeerConnection.prototype.getStats=function(){const[o,s,c]=arguments;return r.apply(this,[o||null]).then(f=>{if(e.version<53&&!s)try{f.forEach(d=>{d.type=t[d.type]||d.type})}catch(d){if(d.name!=="TypeError")throw d;f.forEach((v,R)=>{f.set(R,Object.assign({},v,{type:t[v.type]||v.type}))})}return f}).then(s,c)}}function ur(n){if(!(typeof n=="object"&&n.RTCPeerConnection&&n.RTCRtpSender)||n.RTCRtpSender&&"getStats"in n.RTCRtpSender.prototype)return;const e=n.RTCPeerConnection.prototype.getSenders;e&&(n.RTCPeerConnection.prototype.getSenders=function(){const i=e.apply(this,[]);return i.forEach(o=>o._pc=this),i});const t=n.RTCPeerConnection.prototype.addTrack;t&&(n.RTCPeerConnection.prototype.addTrack=function(){const i=t.apply(this,arguments);return i._pc=this,i}),n.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function fr(n){if(!(typeof n=="object"&&n.RTCPeerConnection&&n.RTCRtpSender)||n.RTCRtpSender&&"getStats"in n.RTCRtpReceiver.prototype)return;const e=n.RTCPeerConnection.prototype.getReceivers;e&&(n.RTCPeerConnection.prototype.getReceivers=function(){const r=e.apply(this,[]);return r.forEach(i=>i._pc=this),r}),be(n,"track",t=>(t.receiver._pc=t.srcElement,t)),n.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function dr(n){!n.RTCPeerConnection||"removeStream"in n.RTCPeerConnection.prototype||(n.RTCPeerConnection.prototype.removeStream=function(t){at("removeStream","removeTrack"),this.getSenders().forEach(r=>{r.track&&t.getTracks().includes(r.track)&&this.removeTrack(r)})})}function lr(n){n.DataChannel&&!n.RTCDataChannel&&(n.RTCDataChannel=n.DataChannel)}function pr(n){if(!(typeof n=="object"&&n.RTCPeerConnection))return;const e=n.RTCPeerConnection.prototype.addTransceiver;e&&(n.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let r=arguments[1]&&arguments[1].sendEncodings;r===void 0&&(r=[]),r=[...r];const i=r.length>0;i&&r.forEach(s=>{if("rid"in s&&!/^[a-z0-9]{0,16}$/i.test(s.rid))throw new TypeError("Invalid RID value provided.");if("scaleResolutionDownBy"in s&&!(parseFloat(s.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in s&&!(parseFloat(s.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")});const o=e.apply(this,arguments);if(i){const{sender:s}=o,c=s.getParameters();(!("encodings"in c)||c.encodings.length===1&&Object.keys(c.encodings[0]).length===0)&&(c.encodings=r,s.sendEncodings=r,this.setParametersPromises.push(s.setParameters(c).then(()=>{delete s.sendEncodings}).catch(()=>{delete s.sendEncodings})))}return o})}function mr(n){if(!(typeof n=="object"&&n.RTCRtpSender))return;const e=n.RTCRtpSender.prototype.getParameters;e&&(n.RTCRtpSender.prototype.getParameters=function(){const r=e.apply(this,arguments);return"encodings"in r||(r.encodings=[].concat(this.sendEncodings||[{}])),r})}function hr(n){if(!(typeof n=="object"&&n.RTCPeerConnection))return;const e=n.RTCPeerConnection.prototype.createOffer;n.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>e.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):e.apply(this,arguments)}}function gr(n){if(!(typeof n=="object"&&n.RTCPeerConnection))return;const e=n.RTCPeerConnection.prototype.createAnswer;n.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>e.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):e.apply(this,arguments)}}const vr=Object.freeze(Object.defineProperty({__proto__:null,shimAddTransceiver:pr,shimCreateAnswer:gr,shimCreateOffer:hr,shimGetDisplayMedia:Dn,shimGetParameters:mr,shimGetUserMedia:ar,shimOnTrack:cr,shimPeerConnection:ft,shimRTCDataChannel:lr,shimReceiverGetStats:fr,shimRemoveStream:dr,shimSenderGetStats:ur},Symbol.toStringTag,{value:"Module"}));function yr(n){if(!(typeof n!="object"||!n.RTCPeerConnection)){if("getLocalStreams"in n.RTCPeerConnection.prototype||(n.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in n.RTCPeerConnection.prototype)){const e=n.RTCPeerConnection.prototype.addTrack;n.RTCPeerConnection.prototype.addStream=function(r){this._localStreams||(this._localStreams=[]),this._localStreams.includes(r)||this._localStreams.push(r),r.getAudioTracks().forEach(i=>e.call(this,i,r)),r.getVideoTracks().forEach(i=>e.call(this,i,r))},n.RTCPeerConnection.prototype.addTrack=function(r,...i){return i&&i.forEach(o=>{this._localStreams?this._localStreams.includes(o)||this._localStreams.push(o):this._localStreams=[o]}),e.apply(this,arguments)}}"removeStream"in n.RTCPeerConnection.prototype||(n.RTCPeerConnection.prototype.removeStream=function(t){this._localStreams||(this._localStreams=[]);const r=this._localStreams.indexOf(t);if(r===-1)return;this._localStreams.splice(r,1);const i=t.getTracks();this.getSenders().forEach(o=>{i.includes(o.track)&&this.removeTrack(o)})})}}function Cr(n){if(!(typeof n!="object"||!n.RTCPeerConnection)&&("getRemoteStreams"in n.RTCPeerConnection.prototype||(n.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in n.RTCPeerConnection.prototype))){Object.defineProperty(n.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(t){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=t),this.addEventListener("track",this._onaddstreampoly=r=>{r.streams.forEach(i=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(i))return;this._remoteStreams.push(i);const o=new Event("addstream");o.stream=i,this.dispatchEvent(o)})})}});const e=n.RTCPeerConnection.prototype.setRemoteDescription;n.RTCPeerConnection.prototype.setRemoteDescription=function(){const r=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(i){i.streams.forEach(o=>{if(r._remoteStreams||(r._remoteStreams=[]),r._remoteStreams.indexOf(o)>=0)return;r._remoteStreams.push(o);const s=new Event("addstream");s.stream=o,r.dispatchEvent(s)})}),e.apply(r,arguments)}}}function Sr(n){if(typeof n!="object"||!n.RTCPeerConnection)return;const e=n.RTCPeerConnection.prototype,t=e.createOffer,r=e.createAnswer,i=e.setLocalDescription,o=e.setRemoteDescription,s=e.addIceCandidate;e.createOffer=function(d,v){const R=arguments.length>=2?arguments[2]:arguments[0],D=t.apply(this,[R]);return v?(D.then(d,v),Promise.resolve()):D},e.createAnswer=function(d,v){const R=arguments.length>=2?arguments[2]:arguments[0],D=r.apply(this,[R]);return v?(D.then(d,v),Promise.resolve()):D};let c=function(f,d,v){const R=i.apply(this,[f]);return v?(R.then(d,v),Promise.resolve()):R};e.setLocalDescription=c,c=function(f,d,v){const R=o.apply(this,[f]);return v?(R.then(d,v),Promise.resolve()):R},e.setRemoteDescription=c,c=function(f,d,v){const R=s.apply(this,[f]);return v?(R.then(d,v),Promise.resolve()):R},e.addIceCandidate=c}function Tr(n){const e=n&&n.navigator;if(e.mediaDevices&&e.mediaDevices.getUserMedia){const t=e.mediaDevices,r=t.getUserMedia.bind(t);e.mediaDevices.getUserMedia=i=>r(br(i))}!e.getUserMedia&&e.mediaDevices&&e.mediaDevices.getUserMedia&&(e.getUserMedia=(function(r,i,o){e.mediaDevices.getUserMedia(r).then(i,o)}).bind(e))}function br(n){return n&&n.video!==void 0?Object.assign({},n,{video:Kt(n.video)}):n}function Rr(n){if(!n.RTCPeerConnection)return;const e=n.RTCPeerConnection;n.RTCPeerConnection=function(r,i){if(r&&r.iceServers){const o=[];for(let s=0;s<r.iceServers.length;s++){let c=r.iceServers[s];c.urls===void 0&&c.url?(at("RTCIceServer.url","RTCIceServer.urls"),c=JSON.parse(JSON.stringify(c)),c.urls=c.url,delete c.url,o.push(c)):o.push(r.iceServers[s])}r.iceServers=o}return new e(r,i)},n.RTCPeerConnection.prototype=e.prototype,"generateCertificate"in e&&Object.defineProperty(n.RTCPeerConnection,"generateCertificate",{get(){return e.generateCertificate}})}function Pr(n){typeof n=="object"&&n.RTCTrackEvent&&"receiver"in n.RTCTrackEvent.prototype&&!("transceiver"in n.RTCTrackEvent.prototype)&&Object.defineProperty(n.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function _r(n){const e=n.RTCPeerConnection.prototype.createOffer;n.RTCPeerConnection.prototype.createOffer=function(r){if(r){typeof r.offerToReceiveAudio<"u"&&(r.offerToReceiveAudio=!!r.offerToReceiveAudio);const i=this.getTransceivers().find(s=>s.receiver.track.kind==="audio");r.offerToReceiveAudio===!1&&i?i.direction==="sendrecv"?i.setDirection?i.setDirection("sendonly"):i.direction="sendonly":i.direction==="recvonly"&&(i.setDirection?i.setDirection("inactive"):i.direction="inactive"):r.offerToReceiveAudio===!0&&!i&&this.addTransceiver("audio",{direction:"recvonly"}),typeof r.offerToReceiveVideo<"u"&&(r.offerToReceiveVideo=!!r.offerToReceiveVideo);const o=this.getTransceivers().find(s=>s.receiver.track.kind==="video");r.offerToReceiveVideo===!1&&o?o.direction==="sendrecv"?o.setDirection?o.setDirection("sendonly"):o.direction="sendonly":o.direction==="recvonly"&&(o.setDirection?o.setDirection("inactive"):o.direction="inactive"):r.offerToReceiveVideo===!0&&!o&&this.addTransceiver("video",{direction:"recvonly"})}return e.apply(this,arguments)}}function Er(n){typeof n!="object"||n.AudioContext||(n.AudioContext=n.webkitAudioContext)}const Or=Object.freeze(Object.defineProperty({__proto__:null,shimAudioContext:Er,shimCallbacksAPI:Sr,shimConstraints:br,shimCreateOfferLegacy:_r,shimGetUserMedia:Tr,shimLocalStreamsAPI:yr,shimRTCIceServerUrls:Rr,shimRemoteStreamsAPI:Cr,shimTrackEventTransceiver:Pr},Symbol.toStringTag,{value:"Module"}));var dt={exports:{}},xr;function An(){return xr||(xr=1,function(n){const e={};e.generateIdentifier=function(){return Math.random().toString(36).substring(2,12)},e.localCName=e.generateIdentifier(),e.splitLines=function(t){return t.trim().split(`
|
129
|
+
`).map(r=>r.trim())},e.splitSections=function(t){return t.split(`
|
130
|
+
m=`).map((i,o)=>(o>0?"m="+i:i).trim()+`\r
|
131
|
+
`)},e.getDescription=function(t){const r=e.splitSections(t);return r&&r[0]},e.getMediaSections=function(t){const r=e.splitSections(t);return r.shift(),r},e.matchPrefix=function(t,r){return e.splitLines(t).filter(i=>i.indexOf(r)===0)},e.parseCandidate=function(t){let r;t.indexOf("a=candidate:")===0?r=t.substring(12).split(" "):r=t.substring(10).split(" ");const i={foundation:r[0],component:{1:"rtp",2:"rtcp"}[r[1]]||r[1],protocol:r[2].toLowerCase(),priority:parseInt(r[3],10),ip:r[4],address:r[4],port:parseInt(r[5],10),type:r[7]};for(let o=8;o<r.length;o+=2)switch(r[o]){case"raddr":i.relatedAddress=r[o+1];break;case"rport":i.relatedPort=parseInt(r[o+1],10);break;case"tcptype":i.tcpType=r[o+1];break;case"ufrag":i.ufrag=r[o+1],i.usernameFragment=r[o+1];break;default:i[r[o]]===void 0&&(i[r[o]]=r[o+1]);break}return i},e.writeCandidate=function(t){const r=[];r.push(t.foundation);const i=t.component;i==="rtp"?r.push(1):i==="rtcp"?r.push(2):r.push(i),r.push(t.protocol.toUpperCase()),r.push(t.priority),r.push(t.address||t.ip),r.push(t.port);const o=t.type;return r.push("typ"),r.push(o),o!=="host"&&t.relatedAddress&&t.relatedPort&&(r.push("raddr"),r.push(t.relatedAddress),r.push("rport"),r.push(t.relatedPort)),t.tcpType&&t.protocol.toLowerCase()==="tcp"&&(r.push("tcptype"),r.push(t.tcpType)),(t.usernameFragment||t.ufrag)&&(r.push("ufrag"),r.push(t.usernameFragment||t.ufrag)),"candidate:"+r.join(" ")},e.parseIceOptions=function(t){return t.substring(14).split(" ")},e.parseRtpMap=function(t){let r=t.substring(9).split(" ");const i={payloadType:parseInt(r.shift(),10)};return r=r[0].split("/"),i.name=r[0],i.clockRate=parseInt(r[1],10),i.channels=r.length===3?parseInt(r[2],10):1,i.numChannels=i.channels,i},e.writeRtpMap=function(t){let r=t.payloadType;t.preferredPayloadType!==void 0&&(r=t.preferredPayloadType);const i=t.channels||t.numChannels||1;return"a=rtpmap:"+r+" "+t.name+"/"+t.clockRate+(i!==1?"/"+i:"")+`\r
|
132
|
+
`},e.parseExtmap=function(t){const r=t.substring(9).split(" ");return{id:parseInt(r[0],10),direction:r[0].indexOf("/")>0?r[0].split("/")[1]:"sendrecv",uri:r[1],attributes:r.slice(2).join(" ")}},e.writeExtmap=function(t){return"a=extmap:"+(t.id||t.preferredId)+(t.direction&&t.direction!=="sendrecv"?"/"+t.direction:"")+" "+t.uri+(t.attributes?" "+t.attributes:"")+`\r
|
133
|
+
`},e.parseFmtp=function(t){const r={};let i;const o=t.substring(t.indexOf(" ")+1).split(";");for(let s=0;s<o.length;s++)i=o[s].trim().split("="),r[i[0].trim()]=i[1];return r},e.writeFmtp=function(t){let r="",i=t.payloadType;if(t.preferredPayloadType!==void 0&&(i=t.preferredPayloadType),t.parameters&&Object.keys(t.parameters).length){const o=[];Object.keys(t.parameters).forEach(s=>{t.parameters[s]!==void 0?o.push(s+"="+t.parameters[s]):o.push(s)}),r+="a=fmtp:"+i+" "+o.join(";")+`\r
|
134
|
+
`}return r},e.parseRtcpFb=function(t){const r=t.substring(t.indexOf(" ")+1).split(" ");return{type:r.shift(),parameter:r.join(" ")}},e.writeRtcpFb=function(t){let r="",i=t.payloadType;return t.preferredPayloadType!==void 0&&(i=t.preferredPayloadType),t.rtcpFeedback&&t.rtcpFeedback.length&&t.rtcpFeedback.forEach(o=>{r+="a=rtcp-fb:"+i+" "+o.type+(o.parameter&&o.parameter.length?" "+o.parameter:"")+`\r
|
135
|
+
`}),r},e.parseSsrcMedia=function(t){const r=t.indexOf(" "),i={ssrc:parseInt(t.substring(7,r),10)},o=t.indexOf(":",r);return o>-1?(i.attribute=t.substring(r+1,o),i.value=t.substring(o+1)):i.attribute=t.substring(r+1),i},e.parseSsrcGroup=function(t){const r=t.substring(13).split(" ");return{semantics:r.shift(),ssrcs:r.map(i=>parseInt(i,10))}},e.getMid=function(t){const r=e.matchPrefix(t,"a=mid:")[0];if(r)return r.substring(6)},e.parseFingerprint=function(t){const r=t.substring(14).split(" ");return{algorithm:r[0].toLowerCase(),value:r[1].toUpperCase()}},e.getDtlsParameters=function(t,r){return{role:"auto",fingerprints:e.matchPrefix(t+r,"a=fingerprint:").map(e.parseFingerprint)}},e.writeDtlsParameters=function(t,r){let i="a=setup:"+r+`\r
|
136
|
+
`;return t.fingerprints.forEach(o=>{i+="a=fingerprint:"+o.algorithm+" "+o.value+`\r
|
137
|
+
`}),i},e.parseCryptoLine=function(t){const r=t.substring(9).split(" ");return{tag:parseInt(r[0],10),cryptoSuite:r[1],keyParams:r[2],sessionParams:r.slice(3)}},e.writeCryptoLine=function(t){return"a=crypto:"+t.tag+" "+t.cryptoSuite+" "+(typeof t.keyParams=="object"?e.writeCryptoKeyParams(t.keyParams):t.keyParams)+(t.sessionParams?" "+t.sessionParams.join(" "):"")+`\r
|
138
|
+
`},e.parseCryptoKeyParams=function(t){if(t.indexOf("inline:")!==0)return null;const r=t.substring(7).split("|");return{keyMethod:"inline",keySalt:r[0],lifeTime:r[1],mkiValue:r[2]?r[2].split(":")[0]:void 0,mkiLength:r[2]?r[2].split(":")[1]:void 0}},e.writeCryptoKeyParams=function(t){return t.keyMethod+":"+t.keySalt+(t.lifeTime?"|"+t.lifeTime:"")+(t.mkiValue&&t.mkiLength?"|"+t.mkiValue+":"+t.mkiLength:"")},e.getCryptoParameters=function(t,r){return e.matchPrefix(t+r,"a=crypto:").map(e.parseCryptoLine)},e.getIceParameters=function(t,r){const i=e.matchPrefix(t+r,"a=ice-ufrag:")[0],o=e.matchPrefix(t+r,"a=ice-pwd:")[0];return i&&o?{usernameFragment:i.substring(12),password:o.substring(10)}:null},e.writeIceParameters=function(t){let r="a=ice-ufrag:"+t.usernameFragment+`\r
|
139
|
+
a=ice-pwd:`+t.password+`\r
|
140
|
+
`;return t.iceLite&&(r+=`a=ice-lite\r
|
141
|
+
`),r},e.parseRtpParameters=function(t){const r={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},o=e.splitLines(t)[0].split(" ");r.profile=o[2];for(let c=3;c<o.length;c++){const f=o[c],d=e.matchPrefix(t,"a=rtpmap:"+f+" ")[0];if(d){const v=e.parseRtpMap(d),R=e.matchPrefix(t,"a=fmtp:"+f+" ");switch(v.parameters=R.length?e.parseFmtp(R[0]):{},v.rtcpFeedback=e.matchPrefix(t,"a=rtcp-fb:"+f+" ").map(e.parseRtcpFb),r.codecs.push(v),v.name.toUpperCase()){case"RED":case"ULPFEC":r.fecMechanisms.push(v.name.toUpperCase());break}}}e.matchPrefix(t,"a=extmap:").forEach(c=>{r.headerExtensions.push(e.parseExtmap(c))});const s=e.matchPrefix(t,"a=rtcp-fb:* ").map(e.parseRtcpFb);return r.codecs.forEach(c=>{s.forEach(f=>{c.rtcpFeedback.find(v=>v.type===f.type&&v.parameter===f.parameter)||c.rtcpFeedback.push(f)})}),r},e.writeRtpDescription=function(t,r){let i="";i+="m="+t+" ",i+=r.codecs.length>0?"9":"0",i+=" "+(r.profile||"UDP/TLS/RTP/SAVPF")+" ",i+=r.codecs.map(s=>s.preferredPayloadType!==void 0?s.preferredPayloadType:s.payloadType).join(" ")+`\r
|
142
|
+
`,i+=`c=IN IP4 0.0.0.0\r
|
143
|
+
`,i+=`a=rtcp:9 IN IP4 0.0.0.0\r
|
144
|
+
`,r.codecs.forEach(s=>{i+=e.writeRtpMap(s),i+=e.writeFmtp(s),i+=e.writeRtcpFb(s)});let o=0;return r.codecs.forEach(s=>{s.maxptime>o&&(o=s.maxptime)}),o>0&&(i+="a=maxptime:"+o+`\r
|
145
|
+
`),r.headerExtensions&&r.headerExtensions.forEach(s=>{i+=e.writeExtmap(s)}),i},e.parseRtpEncodingParameters=function(t){const r=[],i=e.parseRtpParameters(t),o=i.fecMechanisms.indexOf("RED")!==-1,s=i.fecMechanisms.indexOf("ULPFEC")!==-1,c=e.matchPrefix(t,"a=ssrc:").map(D=>e.parseSsrcMedia(D)).filter(D=>D.attribute==="cname"),f=c.length>0&&c[0].ssrc;let d;const v=e.matchPrefix(t,"a=ssrc-group:FID").map(D=>D.substring(17).split(" ").map(M=>parseInt(M,10)));v.length>0&&v[0].length>1&&v[0][0]===f&&(d=v[0][1]),i.codecs.forEach(D=>{if(D.name.toUpperCase()==="RTX"&&D.parameters.apt){let N={ssrc:f,codecPayloadType:parseInt(D.parameters.apt,10)};f&&d&&(N.rtx={ssrc:d}),r.push(N),o&&(N=JSON.parse(JSON.stringify(N)),N.fec={ssrc:f,mechanism:s?"red+ulpfec":"red"},r.push(N))}}),r.length===0&&f&&r.push({ssrc:f});let R=e.matchPrefix(t,"b=");return R.length&&(R[0].indexOf("b=TIAS:")===0?R=parseInt(R[0].substring(7),10):R[0].indexOf("b=AS:")===0?R=parseInt(R[0].substring(5),10)*1e3*.95-50*40*8:R=void 0,r.forEach(D=>{D.maxBitrate=R})),r},e.parseRtcpParameters=function(t){const r={},i=e.matchPrefix(t,"a=ssrc:").map(c=>e.parseSsrcMedia(c)).filter(c=>c.attribute==="cname")[0];i&&(r.cname=i.value,r.ssrc=i.ssrc);const o=e.matchPrefix(t,"a=rtcp-rsize");r.reducedSize=o.length>0,r.compound=o.length===0;const s=e.matchPrefix(t,"a=rtcp-mux");return r.mux=s.length>0,r},e.writeRtcpParameters=function(t){let r="";return t.reducedSize&&(r+=`a=rtcp-rsize\r
|
146
|
+
`),t.mux&&(r+=`a=rtcp-mux\r
|
147
|
+
`),t.ssrc!==void 0&&t.cname&&(r+="a=ssrc:"+t.ssrc+" cname:"+t.cname+`\r
|
148
|
+
`),r},e.parseMsid=function(t){let r;const i=e.matchPrefix(t,"a=msid:");if(i.length===1)return r=i[0].substring(7).split(" "),{stream:r[0],track:r[1]};const o=e.matchPrefix(t,"a=ssrc:").map(s=>e.parseSsrcMedia(s)).filter(s=>s.attribute==="msid");if(o.length>0)return r=o[0].value.split(" "),{stream:r[0],track:r[1]}},e.parseSctpDescription=function(t){const r=e.parseMLine(t),i=e.matchPrefix(t,"a=max-message-size:");let o;i.length>0&&(o=parseInt(i[0].substring(19),10)),isNaN(o)&&(o=65536);const s=e.matchPrefix(t,"a=sctp-port:");if(s.length>0)return{port:parseInt(s[0].substring(12),10),protocol:r.fmt,maxMessageSize:o};const c=e.matchPrefix(t,"a=sctpmap:");if(c.length>0){const f=c[0].substring(10).split(" ");return{port:parseInt(f[0],10),protocol:f[1],maxMessageSize:o}}},e.writeSctpDescription=function(t,r){let i=[];return t.protocol!=="DTLS/SCTP"?i=["m="+t.kind+" 9 "+t.protocol+" "+r.protocol+`\r
|
149
|
+
`,`c=IN IP4 0.0.0.0\r
|
150
|
+
`,"a=sctp-port:"+r.port+`\r
|
151
|
+
`]:i=["m="+t.kind+" 9 "+t.protocol+" "+r.port+`\r
|
152
|
+
`,`c=IN IP4 0.0.0.0\r
|
153
|
+
`,"a=sctpmap:"+r.port+" "+r.protocol+` 65535\r
|
154
|
+
`],r.maxMessageSize!==void 0&&i.push("a=max-message-size:"+r.maxMessageSize+`\r
|
155
|
+
`),i.join("")},e.generateSessionId=function(){return Math.random().toString().substr(2,22)},e.writeSessionBoilerplate=function(t,r,i){let o;const s=r!==void 0?r:2;return t?o=t:o=e.generateSessionId(),`v=0\r
|
156
|
+
o=`+(i||"thisisadapterortc")+" "+o+" "+s+` IN IP4 127.0.0.1\r
|
157
|
+
s=-\r
|
158
|
+
t=0 0\r
|
159
|
+
`},e.getDirection=function(t,r){const i=e.splitLines(t);for(let o=0;o<i.length;o++)switch(i[o]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return i[o].substring(2)}return r?e.getDirection(r):"sendrecv"},e.getKind=function(t){return e.splitLines(t)[0].split(" ")[0].substring(2)},e.isRejected=function(t){return t.split(" ",2)[1]==="0"},e.parseMLine=function(t){const i=e.splitLines(t)[0].substring(2).split(" ");return{kind:i[0],port:parseInt(i[1],10),protocol:i[2],fmt:i.slice(3).join(" ")}},e.parseOLine=function(t){const i=e.matchPrefix(t,"o=")[0].substring(2).split(" ");return{username:i[0],sessionId:i[1],sessionVersion:parseInt(i[2],10),netType:i[3],addressType:i[4],address:i[5]}},e.isValidSDP=function(t){if(typeof t!="string"||t.length===0)return!1;const r=e.splitLines(t);for(let i=0;i<r.length;i++)if(r[i].length<2||r[i].charAt(1)!=="=")return!1;return!0},n.exports=e}(dt)),dt.exports}var kr=An();const _e=ht(kr),In=Dr({__proto__:null,default:_e},[kr]);function He(n){if(!n.RTCIceCandidate||n.RTCIceCandidate&&"foundation"in n.RTCIceCandidate.prototype)return;const e=n.RTCIceCandidate;n.RTCIceCandidate=function(r){if(typeof r=="object"&&r.candidate&&r.candidate.indexOf("a=")===0&&(r=JSON.parse(JSON.stringify(r)),r.candidate=r.candidate.substring(2)),r.candidate&&r.candidate.length){const i=new e(r),o=_e.parseCandidate(r.candidate);for(const s in o)s in i||Object.defineProperty(i,s,{value:o[s]});return i.toJSON=function(){return{candidate:i.candidate,sdpMid:i.sdpMid,sdpMLineIndex:i.sdpMLineIndex,usernameFragment:i.usernameFragment}},i}return new e(r)},n.RTCIceCandidate.prototype=e.prototype,be(n,"icecandidate",t=>(t.candidate&&Object.defineProperty(t,"candidate",{value:new n.RTCIceCandidate(t.candidate),writable:"false"}),t))}function lt(n){!n.RTCIceCandidate||n.RTCIceCandidate&&"relayProtocol"in n.RTCIceCandidate.prototype||be(n,"icecandidate",e=>{if(e.candidate){const t=_e.parseCandidate(e.candidate.candidate);t.type==="relay"&&(e.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[t.priority>>24])}return e})}function Je(n,e){if(!n.RTCPeerConnection)return;"sctp"in n.RTCPeerConnection.prototype||Object.defineProperty(n.RTCPeerConnection.prototype,"sctp",{get(){return typeof this._sctp>"u"?null:this._sctp}});const t=function(c){if(!c||!c.sdp)return!1;const f=_e.splitSections(c.sdp);return f.shift(),f.some(d=>{const v=_e.parseMLine(d);return v&&v.kind==="application"&&v.protocol.indexOf("SCTP")!==-1})},r=function(c){const f=c.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(f===null||f.length<2)return-1;const d=parseInt(f[1],10);return d!==d?-1:d},i=function(c){let f=65536;return e.browser==="firefox"&&(e.version<57?c===-1?f=16384:f=2147483637:e.version<60?f=e.version===57?65535:65536:f=2147483637),f},o=function(c,f){let d=65536;e.browser==="firefox"&&e.version===57&&(d=65535);const v=_e.matchPrefix(c.sdp,"a=max-message-size:");return v.length>0?d=parseInt(v[0].substring(19),10):e.browser==="firefox"&&f!==-1&&(d=2147483637),d},s=n.RTCPeerConnection.prototype.setRemoteDescription;n.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,e.browser==="chrome"&&e.version>=76){const{sdpSemantics:f}=this.getConfiguration();f==="plan-b"&&Object.defineProperty(this,"sctp",{get(){return typeof this._sctp>"u"?null:this._sctp},enumerable:!0,configurable:!0})}if(t(arguments[0])){const f=r(arguments[0]),d=i(f),v=o(arguments[0],f);let R;d===0&&v===0?R=Number.POSITIVE_INFINITY:d===0||v===0?R=Math.max(d,v):R=Math.min(d,v);const D={};Object.defineProperty(D,"maxMessageSize",{get(){return R}}),this._sctp=D}return s.apply(this,arguments)}}function We(n){if(!(n.RTCPeerConnection&&"createDataChannel"in n.RTCPeerConnection.prototype))return;function e(r,i){const o=r.send;r.send=function(){const c=arguments[0],f=c.length||c.size||c.byteLength;if(r.readyState==="open"&&i.sctp&&f>i.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+i.sctp.maxMessageSize+" bytes)");return o.apply(r,arguments)}}const t=n.RTCPeerConnection.prototype.createDataChannel;n.RTCPeerConnection.prototype.createDataChannel=function(){const i=t.apply(this,arguments);return e(i,this),i},be(n,"datachannel",r=>(e(r.channel,r.target),r))}function pt(n){if(!n.RTCPeerConnection||"connectionState"in n.RTCPeerConnection.prototype)return;const e=n.RTCPeerConnection.prototype;Object.defineProperty(e,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(e,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(t){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),t&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=t)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(t=>{const r=e[t];e[t]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=i=>{const o=i.target;if(o._lastConnectionState!==o.connectionState){o._lastConnectionState=o.connectionState;const s=new Event("connectionstatechange",i);o.dispatchEvent(s)}return i},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),r.apply(this,arguments)}})}function mt(n,e){if(!n.RTCPeerConnection||e.browser==="chrome"&&e.version>=71||e.browser==="safari"&&e.version>=605)return;const t=n.RTCPeerConnection.prototype.setRemoteDescription;n.RTCPeerConnection.prototype.setRemoteDescription=function(i){if(i&&i.sdp&&i.sdp.indexOf(`
|
160
|
+
a=extmap-allow-mixed`)!==-1){const o=i.sdp.split(`
|
161
|
+
`).filter(s=>s.trim()!=="a=extmap-allow-mixed").join(`
|
162
|
+
`);n.RTCSessionDescription&&i instanceof n.RTCSessionDescription?arguments[0]=new n.RTCSessionDescription({type:i.type,sdp:o}):i.sdp=o}return t.apply(this,arguments)}}function qe(n,e){if(!(n.RTCPeerConnection&&n.RTCPeerConnection.prototype))return;const t=n.RTCPeerConnection.prototype.addIceCandidate;!t||t.length===0||(n.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?(e.browser==="chrome"&&e.version<78||e.browser==="firefox"&&e.version<68||e.browser==="safari")&&arguments[0]&&arguments[0].candidate===""?Promise.resolve():t.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function Be(n,e){if(!(n.RTCPeerConnection&&n.RTCPeerConnection.prototype))return;const t=n.RTCPeerConnection.prototype.setLocalDescription;!t||t.length===0||(n.RTCPeerConnection.prototype.setLocalDescription=function(){let i=arguments[0]||{};if(typeof i!="object"||i.type&&i.sdp)return t.apply(this,arguments);if(i={type:i.type,sdp:i.sdp},!i.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":i.type="offer";break;default:i.type="answer";break}return i.sdp||i.type!=="offer"&&i.type!=="answer"?t.apply(this,[i]):(i.type==="offer"?this.createOffer:this.createAnswer).apply(this).then(s=>t.apply(this,[s]))})}const jn=Object.freeze(Object.defineProperty({__proto__:null,removeExtmapAllowMixed:mt,shimAddIceCandidateNullOrEmpty:qe,shimConnectionState:pt,shimMaxMessageSize:Je,shimParameterlessSetLocalDescription:Be,shimRTCIceCandidate:He,shimRTCIceCandidateRelayProtocol:lt,shimSendThrowTypeError:We},Symbol.toStringTag,{value:"Module"}));function Ln({window:n}={},e={shimChrome:!0,shimFirefox:!0,shimSafari:!0}){const t=$t,r=Mn(n),i={browserDetails:r,commonShim:jn,extractVersion:ze,disableLog:xn,disableWarnings:kn,sdp:In};switch(r.browser){case"chrome":if(!sr||!ut||!e.shimChrome)return t("Chrome shim is not included in this adapter release."),i;if(r.version===null)return t("Chrome shim can not determine version, not shimming."),i;t("adapter.js shimming chrome."),i.browserShim=sr,qe(n,r),Be(n),Zt(n,r),wt(n),ut(n,r),er(n),ir(n,r),tr(n),rr(n),or(n,r),He(n),lt(n),pt(n),Je(n,r),We(n),mt(n,r);break;case"firefox":if(!vr||!ft||!e.shimFirefox)return t("Firefox shim is not included in this adapter release."),i;t("adapter.js shimming firefox."),i.browserShim=vr,qe(n,r),Be(n),ar(n,r),ft(n,r),cr(n),dr(n),ur(n),fr(n),lr(n),pr(n),mr(n),hr(n),gr(n),He(n),pt(n),Je(n,r),We(n);break;case"safari":if(!Or||!e.shimSafari)return t("Safari shim is not included in this adapter release."),i;t("adapter.js shimming safari."),i.browserShim=Or,qe(n,r),Be(n),Rr(n),_r(n),Sr(n),yr(n),Cr(n),Pr(n),Tr(n),Er(n),He(n),lt(n),Je(n,r),We(n),mt(n,r);break;default:t("Unsupported browser!");break}return i}Ln({window:typeof window>"u"?void 0:window});const Nn={newUser:{id:"123",name:{firstName:"John",lastName:"Doe"}},serverUrl:"wss://janus2.okruti.com/janus"},Un=n=>{const e=n||Nn,t=re.useRef(null),[r,i]=re.useState(""),[o,s]=re.useState(!1),[c,f]=re.useState([]),{newUser:d}=e,[v,R]=re.useState(null),[D,N]=re.useState(null),[M,H]=re.useState(!1),[O,y]=re.useState(!0),[P,m]=re.useState(!0),g=re.useRef(null),p=re.useRef(null),b=re.useRef(null),I=re.useRef(new Audio("/ringtone.mp3")),F=()=>{const W=I.current;document.visibilityState==="visible"&&(W.loop=!0,W.volume=1,W.play().catch($=>{console.warn("đ Ringtone play blocked:",$)}))},j=()=>{const W=I.current;W.pause(),W.currentTime=0},A=re.useCallback(()=>{const W=new Ct({server:e.serverUrl,success:()=>{W.attach({plugin:"janus.plugin.videocall",success:$=>{console.log("â
Janus Plugin Attached:",$),t.current=$},error:$=>console.error("â Plugin Attach Error",$),onmessage:($,w)=>J($,w),onremotetrack:$=>{if($.kind==="video"){const w=new MediaStream;w.addTrack($),p.current instanceof HTMLVideoElement&&(p.current.srcObject=w)}if($.kind==="audio"){const w=new MediaStream;w.addTrack($),b.current instanceof HTMLAudioElement&&(b.current.srcObject=w)}}})},error:$=>console.error("â Janus Connection Error",$)})},[]);re.useEffect(()=>{console.log(d),!(d&&!d.id)&&(Ct.init({debug:!0,callback:A}),setTimeout(()=>{G(d)},2e3))},[A,d]);const G=W=>{if(!t.current)return;const $={request:"register",username:`${W.name.firstName};${W.id}`};t.current.send({message:$}),S(),i($.username)},S=()=>{t.current&&t.current.send({message:{request:"list"}})},k=W=>{!t.current||!W||navigator.mediaDevices.getUserMedia({video:!0,audio:!0}).then($=>{g.current&&(g.current.srcObject=$),t.current.createOffer({media:{video:!0,audio:!0},stream:$,success:w=>{console.log("đ Calling user:",W),t.current.send({message:{request:"call",username:W},jsep:w})},error:w=>console.error("â Offer Error",w)})}).catch($=>console.error("â GetUserMedia Error",$))},J=(W,$)=>{var w,fe,he;if(!t.current){console.warn("â ī¸ Plugin handle not ready yet. Retrying..."),setTimeout(()=>J(W,$),100);return}if(console.log("đŠ Incoming Message:",W),$&&(console.log("â
Handling Remote JSEP:",$),t.current.handleRemoteJsep({jsep:$})),N($),((w=W.result)==null?void 0:w.event)==="incomingcall"){const le=W.result.username.split(";")[0];R(le),F()}((fe=W.result)==null?void 0:fe.event)==="accepted"&&(console.log("â
Call Accepted:",W),j(),s(!0)),((he=W.result)==null?void 0:he.event)==="hangup"&&(console.log("đ¨ The other user hung up!"),g.current&&g.current.srcObject&&(g.current.srcObject.getTracks().forEach(le=>le.stop()),g.current.srcObject=null),p.current&&p.current.srcObject&&(p.current.srcObject.getTracks().forEach(le=>le.stop()),p.current.srcObject=null),b.current&&b.current.srcObject&&(b.current.srcObject.getTracks().forEach(le=>le.stop()),b.current.srcObject=null),s(!1),R(null)),W.videocall==="event"&&(W.record!==void 0&&(W.record?(console.log("đŦ Recording started!"),H(!0)):(console.log("đ Recording stopped!"),H(!1))),W.filename&&console.log("đ Recording saved as:",W.filename)),W.result&&W.result.list&&(console.log("msg.result.list",W.result.list),f(W.result.list))},q=W=>{navigator.mediaDevices.getUserMedia({video:!0,audio:!0}).then($=>{j(),g.current&&(g.current.srcObject=$),t.current.createAnswer({media:{video:!0,audio:!0},stream:$,jsep:W,success:w=>{t.current.send({message:{request:"accept"},jsep:w})},error:w=>console.error("â Answer Error",w)})}).catch($=>console.error("â GetUserMedia Error",$)),R(null)},B=()=>{console.log("â Call rejected"),g.current&&g.current.srcObject&&(g.current.srcObject.getTracks().forEach(W=>W.stop()),g.current.srcObject=null),j(),t.current.send({message:{request:"hangup"}}),R(null)},K=()=>{g.current&&g.current.srcObject&&(g.current.srcObject.getTracks().forEach(w=>w.stop()),g.current.srcObject=null),p.current&&p.current.srcObject&&(p.current.srcObject.getTracks().forEach(w=>w.stop()),p.current.srcObject=null,b.current&&(b.current.srcObject=null)),t.current.send({message:{request:"hangup"}}),s(!1),R(null)},Q=()=>{if(!t.current)return;let W=`/opt/janus/share/janus/recordings/${r}`;t.current.send({message:{request:"set",record:!0,filename:W},success:$=>{console.log("â
Janus accepted recording request:",$||"No response")},error:$=>{console.error("â Janus recording error:",$)}}),H(!0),console.log("đŦ Recording Start Request Sent:",r)},te=()=>{t.current&&(t.current.send({message:{request:"set",record:!1},success:W=>{console.log("â
Janus stopped recording request:",W||"No response")},error:W=>{console.error("â Janus recording error:",W)}}),H(!1),console.log("âšī¸ Recording Stop Request Sent"))},ne=()=>{t.current&&(t.current.send({message:{request:"set",audio:!O},success:W=>{console.log("â
Janus audio :",O?"enabled":"disabled",W||"No response")},error:W=>{console.error("â Janus Audio error:",W)}}),y(!O))},ie=()=>{const W=document.createElement("canvas");W.width=640,W.height=480;const $=W.getContext("2d");return $.fillStyle="black",$.fillRect(0,0,W.width,W.height),W.captureStream(30).getVideoTracks()[0]},ue=()=>{t.current&&(t.current.send({message:{request:"set",video:!P},success:W=>{if(console.log("â
Janus Video ",P?"enabled":"disabled",W||"No response"),g.current&&g.current.srcObject){const $=g.current.srcObject,w=$.getVideoTracks()[0];if(w&&P){w.enabled=!1,w.stop();const fe=new MediaStream,he=ie();fe.addTrack(he),$.removeTrack(w),g.current.srcObject=fe,console.log("đĢ Camera turned off, blank track sent."),m(!P)}else navigator.mediaDevices.getUserMedia({video:!0,audio:!0}).then(fe=>{g.current.srcObject=fe,w.enabled=!0,m(!P)}).catch(fe=>console.error("â GetUserMedia Error",fe))}},error:W=>{console.error("â Janus recording error:",W)}}),console.log("âšī¸ Recording Stop Request Sent"))};return console.log("User List: ",c),ee.jsxs("div",{className:"swift-link-meeting",children:[ee.jsx("h2",{className:"swift-link-meeting__heading",children:"swift-link P2P Video Call"}),ee.jsxs("div",{className:"swift-link-meeting__main-section",children:[ee.jsxs("div",{children:[ee.jsxs("section",{className:"swift-link-meeting__available-users",children:[ee.jsx("h3",{className:"swift-link-meeting__available-users__heading",children:"Available Users"}),c.length<=0?ee.jsx("p",{className:"swift-link-meeting__available-users__no-user",children:"There is no user available currently!!"}):ee.jsx("ul",{className:"swift-link-meeting__available-users__list-items",children:c.map(W=>ee.jsxs("li",{className:"swift-link-meeting__available-users__item",children:[W.split(";")[0],W!==r&&ee.jsx("button",{className:"swift-link-meeting__button call",onClick:()=>k(W),children:ee.jsx(Wt,{})})]},W))})]}),ee.jsxs("div",{className:"swift-link-meeting__video-section__caller__section",children:[ee.jsx("video",{className:"swift-link-meeting__video-section__caller",ref:g,autoPlay:!0,muted:!0,playsInline:!0}),ee.jsxs("div",{className:"swift-link-meeting__video-section__caller__buttons",children:[o&&ee.jsx("button",{className:"swift-link-meeting__video-section__caller__button recording",style:{backgroundColor:M?"green":"#e74c3c"},onClick:M?te:Q,children:M?ee.jsx(st,{}):ee.jsx(st,{})}),o&&ee.jsx("button",{className:"swift-link-meeting__video-section__caller__button audio",style:{backgroundColor:O?"green":"#e74c3c"},onClick:ne,children:O?ee.jsx(it,{}):ee.jsx(it,{})}),o&&ee.jsx("button",{className:"swift-link-meeting__video-section__caller__button camera",style:{backgroundColor:P?"green":"#e74c3c"},onClick:ue,children:P?ee.jsx(ot,{twoToneColor:"#862633"}):ee.jsx(ot,{})})]})]})]}),ee.jsxs("section",{className:"swift-link-meeting__video-section",children:[ee.jsxs("div",{className:"swift-link-meeting__video-section__callee-section",children:[ee.jsx("video",{className:"swift-link-meeting__video-section__callee",ref:p,autoPlay:!0,playsInline:!0}),o&&ee.jsx("button",{className:"swift-link-meeting__button hangup",onClick:K,children:"Hang Up"})]}),ee.jsx("audio",{ref:b,autoPlay:!0,hidden:!0})]})]}),v&&ee.jsxs("div",{className:"swift-link-meeting__incoming-popup",children:[ee.jsxs("p",{className:"swift-link-meeting__incoming-popup__heading",children:["đ Incoming call from ",v]}),ee.jsx("button",{className:"swift-link-meeting__button accept",onClick:()=>q(D),children:"â
Accept"}),ee.jsx("button",{className:"swift-link-meeting__button decline",onClick:()=>B(),children:"â Decline"})]})]})};ve.SwiftLink=Un,Object.defineProperty(ve,Symbol.toStringTag,{value:"Module"})});
|