import{m as cv,B as fv,G as lv,P as Hu,W as dv,R as pv,C as hv,n as gv}from"./index-17a5ec1d.js";import{g as qu,c as Kn}from"./overlayscrollbars-44d87bcf.js";import{a4 as Uo,a5 as fi,a6 as li,a7 as er}from"./echarts-ff51454d.js";import{l as mv,m as vv,q as yv}from"./vuetify-4c65b4c3.js";function _v(i,s){for(var n=0;no[a]})}}}return Object.freeze(Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}))}f.sessions=new Map;f.isExtensionEnabled=function(){if(navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia)return!0;if(window.navigator.userAgent.match("Chrome")){let i=parseInt(window.navigator.userAgent.match(/Chrome\/(.*) /)[1],10),s=33;return window.navigator.userAgent.match("Linux")&&(s=35),i>=26&&i<=s?!0:f.extension.isInstalled()}else return!0};var Ju={extensionId:"hapfgfdkleiggjjpfpenajgdnfckjpaj",isInstalled:function(){return document.querySelector("#janus-extension-installed")!==null},getScreen:function(i){let s=window.setTimeout(function(){let n=new Error("NavigatorUserMediaError");return n.name='The required Chrome extension is not installed: click here to install it. (NOTE: this will need you to refresh the page)',i(n)},1e3);this.cache[s]=i,window.postMessage({type:"janusGetScreen",id:s},"*")},init:function(){let i={};this.cache=i,window.addEventListener("message",function(s){if(s.origin==window.location.origin)if(s.data.type=="janusGotScreen"&&i[s.data.id]){let n=i[s.data.id];if(delete i[s.data.id],s.data.sourceId===""){let o=new Error("NavigatorUserMediaError");o.name="You cancelled the request for permission, giving up...",n(o)}else n(null,s.data.sourceId)}else s.data.type=="janusGetScreenPending"&&window.clearTimeout(s.data.id)})}};f.useDefaultDependencies=function(i){let s=i&&i.fetch||fetch,n=i&&i.Promise||Promise,o=i&&i.WebSocket||WebSocket;return{newWebSocket:function(a,u){return new o(a,u)},extension:i&&i.extension||Ju,isArray:function(a){return Array.isArray(a)},webRTCAdapter:i&&i.adapter||adapter,httpAPICall:function(a,u){let p={method:u.verb,headers:{Accept:"application/json, text/plain, */*"},cache:"no-cache"};u.verb==="POST"&&(p.headers["Content-Type"]="application/json"),typeof u.withCredentials<"u"&&(p.credentials=u.withCredentials===!0?"include":u.withCredentials?u.withCredentials:"omit"),u.body&&(p.body=JSON.stringify(u.body));let g=s(a,p).catch(function(T){return n.reject({message:"Probably a network error, is the server down?",error:T})});if(u.timeout){let T=new n(function(l,_){let D=setTimeout(function(){return clearTimeout(D),_({message:"Request timed out",timeout:u.timeout})},u.timeout)});g=n.race([g,T])}return g.then(function(T){if(T.ok){if(typeof u.success==typeof f.noop)return T.json().then(function(l){try{u.success(l)}catch(_){f.error("Unhandled httpAPICall success callback error",_)}},function(l){return n.reject({message:"Failed to parse response body",error:l,response:T})})}else return n.reject({message:"API call failed",response:T})}).catch(function(T){typeof u.error==typeof f.noop&&u.error(T.message||"<< internal error >>",T)}),g}}};f.useOldDependencies=function(i){let s=i&&i.jQuery||jQuery,n=i&&i.WebSocket||WebSocket;return{newWebSocket:function(o,a){return new n(o,a)},isArray:function(o){return s.isArray(o)},extension:i&&i.extension||Ju,webRTCAdapter:i&&i.adapter||adapter,httpAPICall:function(o,a){let u=typeof a.body<"u"?{contentType:"application/json",data:JSON.stringify(a.body)}:{},p=typeof a.withCredentials<"u"?{xhrFields:{withCredentials:a.withCredentials}}:{};return s.ajax(s.extend(u,p,{url:o,type:a.verb,cache:!1,dataType:"json",async:a.async,timeout:a.timeout,success:function(g){typeof a.success==typeof f.noop&&a.success(g)},error:function(g,T,l){typeof a.error==typeof f.noop&&a.error(T,l)}}))}}};f.mediaToTracks=function(i){let s=[];if(!i)s.push({type:"audio",capture:!0,recv:!0}),s.push({type:"video",capture:!0,recv:!0});else{if(!i.keepAudio&&i.audio!==!1&&(typeof i.audio>"u"||i.audio||i.audioSend||i.audioRecv||i.addAudio||i.replaceAudio||i.removeAudio)){let n={type:"audio"};i.removeAudio?n.remove=!0:(i.addAudio?n.add=!0:i.replaceAudio&&(n.replace=!0),i.audioSend!==!1&&(n.capture=i.audio||!0),i.audioRecv!==!1&&(n.recv=!0)),(n.remove||n.capture||n.recv)&&s.push(n)}if(!i.keepVideo&&i.video!==!1&&(typeof i.video>"u"||i.video||i.videoSend||i.videoRecv||i.addVideo||i.replaceVideo||i.removeVideo)){let n={type:"video"};i.removeVideo?n.remove=!0:(i.addVideo?n.add=!0:i.replaceVideo&&(n.replace=!0),i.videoSend!==!1&&(n.capture=i.video||!0,["screen","window","desktop"].includes(n.capture)&&(n.type="screen",n.capture={video:{}},i.screenshareFrameRate&&(n.capture.frameRate=i.screenshareFrameRate),i.screenshareHeight&&(n.capture.height=i.screenshareHeight),i.screenshareWidth&&(n.capture.width=i.screenshareWidth))),i.videoRecv!==!1&&(n.recv=!0)),(n.remove||n.capture||n.recv)&&s.push(n)}i.data&&s.push({type:"data"})}return s};f.trackConstraints=function(i){let s={};if(!i||!i.capture)return s;if(i.type==="audio")s.audio=i.capture;else if(i.type==="video")if((i.simulcast||i.svc)&&i.capture===!0&&(i.capture="hires"),i.capture===!0||typeof i.capture=="object")s.video=i.capture;else{let n=0,o=0;i.capture==="lowres"?(n=320,o=240):i.capture==="lowres-16:9"?(n=320,o=180):i.capture==="hires"||i.capture==="hires-16:9"||i.capture==="hdres"?(n=1280,o=720):i.capture==="fhdres"?(n=1920,o=1080):i.capture==="4kres"?(n=3840,o=2160):i.capture==="stdres"?(n=640,o=480):i.capture==="stdres-16:9"?(n=640,o=360):(f.log("Default video setting is stdres 4:3"),n=640,o=480),s.video={width:{ideal:n},height:{ideal:o}}}else i.type==="screen"&&(s.video=i.capture);return s};f.noop=function(){};f.dataChanDefaultLabel="JanusDataChannel";f.endOfCandidates=null;f.stopAllTracks=function(i){try{let s=i.getTracks();for(let n of s)f.log(n),n&&n.dontStop!==!0&&n.stop()}catch{}};f.init=function(i){if(i=i||{},i.callback=typeof i.callback=="function"?i.callback:f.noop,f.initDone)i.callback();else{if(typeof console.log>"u"&&(console.log=function(){}),f.trace=f.noop,f.debug=f.noop,f.vdebug=f.noop,f.log=f.noop,f.warn=f.noop,f.error=f.noop,i.debug===!0||i.debug==="all")f.trace=console.trace.bind(console),f.debug=console.debug.bind(console),f.vdebug=console.debug.bind(console),f.log=console.log.bind(console),f.warn=console.warn.bind(console),f.error=console.error.bind(console);else if(Array.isArray(i.debug))for(let u of i.debug)switch(u){case"trace":f.trace=console.trace.bind(console);break;case"debug":f.debug=console.debug.bind(console);break;case"vdebug":f.vdebug=console.debug.bind(console);break;case"log":f.log=console.log.bind(console);break;case"warn":f.warn=console.warn.bind(console);break;case"error":f.error=console.error.bind(console);break}f.log("Initializing library");let s=i.dependencies||f.useDefaultDependencies();f.isArray=s.isArray,f.webRTCAdapter=s.webRTCAdapter,f.httpAPICall=s.httpAPICall,f.newWebSocket=s.newWebSocket,f.extension=s.extension,f.extension.init(),f.listDevices=function(u,p){u=typeof u=="function"?u:f.noop,p||(p={audio:!0,video:!0}),f.isGetUserMediaAvailable()?navigator.mediaDevices.getUserMedia(p).then(function(g){navigator.mediaDevices.enumerateDevices().then(function(T){f.debug(T),u(T),f.stopAllTracks(g)})}).catch(function(g){f.error(g),u([])}):(f.warn("navigator.mediaDevices unavailable"),u([]))},f.attachMediaStream=function(u,p){try{u.srcObject=p}catch{try{u.src=URL.createObjectURL(p)}catch(T){f.error("Error attaching stream to element",T)}}},f.reattachMediaStream=function(u,p){try{u.srcObject=p.srcObject}catch{try{u.src=p.src}catch(T){f.error("Error reattaching stream to element",T)}}};let o=["iPad","iPhone","iPod"].indexOf(navigator.platform)>=0?"pagehide":"beforeunload",a=window["on"+o];if(window.addEventListener(o,function(){f.log("Closing window");for(const[u,p]of f.sessions)p&&p.destroyOnUnload&&(f.log("Destroying session "+u),p.destroy({unload:!0,notifyDestroyed:!1}));a&&typeof a=="function"&&a()}),f.safariVp8=!1,f.safariVp9=!1,f.webRTCAdapter.browserDetails.browser==="safari"&&f.webRTCAdapter.browserDetails.version>=605)if(RTCRtpSender&&RTCRtpSender.getCapabilities&&RTCRtpSender.getCapabilities("video")&&RTCRtpSender.getCapabilities("video").codecs&&RTCRtpSender.getCapabilities("video").codecs.length){for(let u of RTCRtpSender.getCapabilities("video").codecs)u&&u.mimeType&&u.mimeType.toLowerCase()==="video/vp8"?f.safariVp8=!0:u&&u.mimeType&&u.mimeType.toLowerCase()==="video/vp9"&&(f.safariVp9=!0);f.safariVp8?f.log("This version of Safari supports VP8"):f.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 u=new RTCPeerConnection({});u.createOffer({offerToReceiveVideo:!0}).then(function(p){f.safariVp8=p.sdp.indexOf("VP8")!==-1,f.safariVp9=p.sdp.indexOf("VP9")!==-1,f.safariVp8?f.log("This version of Safari supports VP8"):f.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"),u.close(),u=null})}f.initDone=!0,i.callback()}};f.isWebrtcSupported=function(){return!!window.RTCPeerConnection};f.isGetUserMediaAvailable=function(){return navigator.mediaDevices&&navigator.mediaDevices.getUserMedia};f.randomString=function(i){let s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n="";for(let o=0;o3){_e=!1,i.error("Lost connection to the server (is it down?)");return}mt()}})}function Zt(v,C){if(Ze=0,!s&&typeof $<"u"&&$!==null&&C!==!0&&mt(),!s&&f.isArray(v)){for(let b=0;b0)for(let A in x){let B=x[A];if(B&&B.sender&&B.sender.track&&B.sender.track.kind==="video"){let re=B.sender.getParameters();re&&re.encodings&&re.encodings[0]&&re.encodings[0].scalabilityMode&&(W||(W=[]),W.push({mindex:parseInt(A),mid:B.mid,svc:re.encodings[0].scalabilityMode}))}}}W&&(w.jsep.svc=W)}if(f.debug("Sending message to plugin (handle="+v+"):"),f.debug(w),s){w.session_id=$,w.handle_id=v,me.set(I,function(W){if(f.debug("Message sent!"),f.debug(W),W.janus==="success"){let F=W.plugindata;if(!F){f.warn("Request succeeded, but missing plugindata..."),C.success();return}f.log("Synchronous transaction successful ("+F.plugin+")");let x=F.data;f.debug(x),C.success(x);return}else if(W.janus!=="ack"){W.error?(f.error("Ooops: "+W.error.code+" "+W.error.reason),C.error(W.error.code+" "+W.error.reason)):(f.error("Unknown error"),C.error("Unknown error"));return}C.success()}),n.send(JSON.stringify(w));return}f.httpAPICall(g+"/"+$+"/"+v,{verb:"POST",withCredentials:D,body:w,success:function(W){if(f.debug("Message sent!"),f.debug(W),W.janus==="success"){let F=W.plugindata;if(!F){f.warn("Request succeeded, but missing plugindata..."),C.success();return}f.log("Synchronous transaction successful ("+F.plugin+")");let x=F.data;f.debug(x),C.success(x);return}else if(W.janus!=="ack"){W.error?(f.error("Ooops: "+W.error.code+" "+W.error.reason),C.error(W.error.code+" "+W.error.reason)):(f.error("Unknown error"),C.error("Unknown error"));return}C.success()},error:function(W,F){f.error(W+":",F),C.error(W+": "+F)}})}function or(v,C){if(!_e){f.warn("Is the server down? (connected=false)");return}let b=X.get(v);if(!b||!b.webrtcStuff){f.warn("Invalid handle");return}let y={janus:"trickle",candidate:C,transaction:f.randomString(12)};if(b.token&&(y.token=b.token),j&&(y.apisecret=j),f.vdebug("Sending trickle candidate (handle="+v+"):"),f.vdebug(y),s){y.session_id=$,y.handle_id=v,n.send(JSON.stringify(y));return}f.httpAPICall(g+"/"+$+"/"+v,{verb:"POST",withCredentials:D,body:y,success:function(O){if(f.vdebug("Candidate sent!"),f.vdebug(O),O.janus!=="ack"){f.error("Ooops: "+O.error.code+" "+O.error.reason);return}},error:function(O,I){f.error(O+":",I)}})}function at(v,C,b,y,O){let I=X.get(v);if(!I||!I.webrtcStuff){f.warn("Invalid handle");return}let w=I.webrtcStuff;if(!w.pc){f.warn("Invalid PeerConnection");return}let W=function(A){f.log("Received message on data channel:",A);let B=A.target.label;I.ondata(A.data,B)},F=function(A){f.log("Received state change on data channel:",A);let B=A.target.label,re=A.target.protocol,fe=w.dataChannel[B]?w.dataChannel[B].readyState:"null";if(f.log("State change on <"+B+"> data channel: "+fe),fe==="open"){if(w.dataChannel[B].pending&&w.dataChannel[B].pending.length>0){f.log("Sending pending messages on <"+B+">:",w.dataChannel[B].pending.length);for(let lt of w.dataChannel[B].pending)f.log("Sending data on data channel <"+B+">"),f.debug(lt),w.dataChannel[B].send(lt);w.dataChannel[B].pending=[]}I.ondataopen(B,re)}},x=function(A){f.error("Got error on data channel:",A)};if(y)w.dataChannel[C]=y;else{let A=w.dataChannelOptions;b&&(A.protocol=b),w.dataChannel[C]=w.pc.createDataChannel(C,A)}w.dataChannel[C].onmessage=W,w.dataChannel[C].onopen=F,w.dataChannel[C].onclose=F,w.dataChannel[C].onerror=x,w.dataChannel[C].pending=[],O&&w.dataChannel[C].pending.push(O)}function ut(v,C){C=C||{},C.success=typeof C.success=="function"?C.success:f.noop,C.error=typeof C.error=="function"?C.error:f.noop;let b=X.get(v);if(!b||!b.webrtcStuff){f.warn("Invalid handle"),C.error("Invalid handle");return}let y=b.webrtcStuff,O=C.text||C.data;if(!O){f.warn("Invalid data"),C.error("Invalid data");return}let I=C.label?C.label:f.dataChanDefaultLabel;if(!y.dataChannel[I]){at(v,I,C.protocol,!1,O,C.protocol),C.success();return}if(y.dataChannel[I].readyState!=="open"){y.dataChannel[I].pending.push(O),C.success();return}f.log("Sending data on data channel <"+I+">"),f.debug(O),y.dataChannel[I].send(O),C.success()}function sr(v,C){C=C||{},C.success=typeof C.success=="function"?C.success:f.noop,C.error=typeof C.error=="function"?C.error:f.noop;let b=X.get(v);if(!b||!b.webrtcStuff){f.warn("Invalid handle"),C.error("Invalid handle");return}let y=b.webrtcStuff;if(!y.dtmfSender){if(y.pc){let x=y.pc.getSenders().find(function(A){return A.track&&A.track.kind==="audio"});if(!x){f.warn("Invalid DTMF configuration (no audio track)"),C.error("Invalid DTMF configuration (no audio track)");return}y.dtmfSender=x.dtmf,y.dtmfSender&&(f.log("Created DTMF Sender"),y.dtmfSender.ontonechange=function(A){f.debug("Sent DTMF tone: "+A.tone)})}if(!y.dtmfSender){f.warn("Invalid DTMF configuration"),C.error("Invalid DTMF configuration");return}}let O=C.dtmf;if(!O){f.warn("Invalid DTMF parameters"),C.error("Invalid DTMF parameters");return}let I=O.tones;if(!I){f.warn("Invalid DTMF string"),C.error("Invalid DTMF string");return}let w=typeof O.duration=="number"?O.duration:500,W=typeof O.gap=="number"?O.gap:50;f.debug("Sending DTMF string "+I+" (duration "+w+"ms, gap "+W+"ms)"),y.dtmfSender.insertDTMF(I,w,W),C.success()}function Lt(v,C){C=C||{},C.success=typeof C.success=="function"?C.success:f.noop,C.error=typeof C.error=="function"?C.error:f.noop;let b=C.noRequest===!0;f.log("Destroying handle "+v+" (only-locally="+b+")"),qe(v);let y=X.get(v);if(!y||y.detached){X.delete(v),C.success();return}if(y.detached=!0,b){X.delete(v),C.success();return}if(!_e){f.warn("Is the server down? (connected=false)"),C.error("Is the server down? (connected=false)");return}let O={janus:"detach",transaction:f.randomString(12)};if(y.token&&(O.token=y.token),j&&(O.apisecret=j),s){O.session_id=$,O.handle_id=v,n.send(JSON.stringify(O)),X.delete(v),C.success();return}f.httpAPICall(g+"/"+$+"/"+v,{verb:"POST",withCredentials:D,body:O,success:function(I){f.log("Destroyed handle:"),f.debug(I),I.janus!=="success"&&f.error("Ooops: "+I.error.code+" "+I.error.reason),X.delete(v),C.success()},error:function(I,w){f.error(I+":",w),X.delete(v),C.success()}})}function Xe(v,C){let b=X.get(v);if(!b||!b.webrtcStuff)throw f.warn("Invalid handle"),"Invalid handle";let y=b.webrtcStuff;if(y.pc)return;let O={iceServers:T,iceTransportPolicy:l,bundlePolicy:_};O.sdpSemantics="unified-plan";let I=!1;if(C.tracks){for(let w of C.tracks)if(w.transforms&&(w.transforms.sender||w.transforms.receiver)){I=!0;break}}RTCRtpSender&&(RTCRtpSender.prototype.createEncodedStreams||RTCRtpSender.prototype.createEncodedAudioStreams&&RTCRtpSender.prototype.createEncodedVideoStreams)&&I&&(y.insertableStreams=!0,O.forceEncodedAudioInsertableStreams=!0,O.forceEncodedVideoInsertableStreams=!0,O.encodedInsertableStreams=!0),f.log("Creating PeerConnection"),y.pc=new RTCPeerConnection(O),f.debug(y.pc),y.pc.getStats&&(y.volume={},y.bitrate.value="0 kbits/sec"),f.log("Preparing local SDP and gathering candidates (trickle="+y.trickle+")"),y.pc.oniceconnectionstatechange=function(){y.pc&&b.iceState(y.pc.iceConnectionState)},y.pc.onicecandidate=function(w){if(!w.candidate||w.candidate.candidate&&w.candidate.candidate.indexOf("endOfCandidates")>0)f.log("End of candidates."),y.iceDone=!0,y.trickle===!0?or(v,{completed:!0}):hn(v,C);else{let W={candidate:w.candidate.candidate,sdpMid:w.candidate.sdpMid,sdpMLineIndex:w.candidate.sdpMLineIndex};y.trickle===!0&&or(v,W)}},y.pc.ontrack=function(w){if(f.log("Handling Remote Track",w),!w.streams||!w.track)return;let W=w.transceiver?w.transceiver.mid:w.track.id;try{b.onremotetrack(w.track,W,!0,{reason:"created"})}catch(x){f.error("Error calling onremotetrack",x)}if(w.track.onended)return;let F=null;f.log("Adding onended callback to track:",w.track),w.track.onended=function(x){f.log("Remote track removed:",x),clearTimeout(F);let A=y.pc?y.pc.getTransceivers():null,B=A?A.find(fe=>fe.receiver.track===x.target):null,re=B?B.mid:x.target.id;try{b.onremotetrack(x.target,re,!1,{reason:"ended"})}catch(fe){f.error("Error calling onremotetrack on removal",fe)}},w.track.onmute=function(x){f.log("Remote track muted:",x),F||(F=setTimeout(function(){f.log("Removing remote track");let A=y.pc?y.pc.getTransceivers():null,B=A?A.find(fe=>fe.receiver.track===x.target):null,re=B?B.mid:x.target.id;try{b.onremotetrack(x.target,re,!1,{reason:"mute"})}catch(fe){f.error("Error calling onremotetrack on mute",fe)}F=null},3*840))},w.track.onunmute=function(x){if(f.log("Remote track flowing again:",x),F!=null)clearTimeout(F),F=null;else try{let A=y.pc?y.pc.getTransceivers():null,B=A?A.find(fe=>fe.receiver.track===x.target):null,re=B?B.mid:x.target.id;b.onremotetrack(x.target,re,!0,{reason:"unmute"})}catch(A){f.error("Error calling onremotetrack on unmute",A)}}}}async function pn(v,C,b){b=b||{},b.success=typeof b.success=="function"?b.success:f.noop,b.error=typeof b.error=="function"?b.error:fr;let y=b.jsep;if(C&&y){f.error("Provided a JSEP to a createOffer"),b.error("Provided a JSEP to a createOffer");return}else if(!C&&(!y||!y.type||!y.sdp)){f.error("A valid JSEP is required for createAnswer"),b.error("A valid JSEP is required for createAnswer");return}if(b.media&&!b.tracks){if(b.tracks=f.mediaToTracks(b.media),b.simulcast===!0||b.simulcast2===!0||b.svc){for(let w of b.tracks)if(w.type==="video"){b.simulcast===!0||b.simulcast2===!0?w.simulcast=!0:b.svc&&(w.svc=b.svc);break}}f.warn("Deprecated media object passed, use tracks instead. Automatically translated to:",b.tracks)}if(b.tracks&&!Array.isArray(b.tracks)){f.error("Tracks must be an array"),b.error("Tracks must be an array");return}let O=X.get(v);if(!O||!O.webrtcStuff){f.warn("Invalid handle"),b.error("Invalid handle");return}let I=O.webrtcStuff;I.trickle=lr(b.trickle);try{if(Xe(v,b),C&&await bt(v,b),y){if(await I.pc.setRemoteDescription(y),f.log("Remote description accepted!"),I.remoteSdp=y.sdp,I.candidates&&I.candidates.length>0){for(let W=0;W0){for(let I=0;I"u"||x.add===null)&&(typeof x.remove>"u"||x.remove===null)&&(typeof x.replace>"u"||x.replace===null)&&(x.add=!0),x.add&&x.remove||x.add&&x.remove&&x.replace){f.warn("Conflicting actions for track, ignoring:",x);continue}x.add&&x.replace?(f.warn("Both add and replace provided, falling back to replace:",x),delete x.add):x.remove&&x.replace&&(f.warn("Both remove and replace provided, falling back to remove:",x),delete x.replace);let A=x.type;x.type==="screen"&&(A="video");let B=null,re=null;if(x.mid?B=y.pc.getTransceivers().find(N=>N.mid===x.mid&&N.receiver.track.kind===A):B=y.pc.getTransceivers().find(N=>N.receiver.track.kind===A),x.replace||x.remove){if(!B){f.warn("Couldn't find a transceiver for track:",x);continue}if(!B.sender){f.warn("No sender in the transceiver for track:",x);continue}re=B.sender}if(F&&!B&&(B=y.pc.getTransceivers().find(N=>N.receiver.track.kind===A),!B)){f.warn("Couldn't find a transceiver for track:",x);continue}let fe=null,lt=null;if((x.remove||x.replace)&&(f.log("Removing track from PeerConnection",x),lt=re.track?re.track.id:null,await re.replaceTrack(null),lt&&y.myStream)){let N=null;if(A==="audio"&&y.myStream.getAudioTracks()&&y.myStream.getAudioTracks().length)for(let ne of y.myStream.getAudioTracks())ne.id===lt&&(N=ne,f.log("Removing audio track:",N));else if(A==="video"&&y.myStream.getVideoTracks()&&y.myStream.getVideoTracks().length)for(let ne of y.myStream.getVideoTracks())ne.id===lt&&(N=ne,f.log("Removing video track:",N));if(N){try{y.myStream.removeTrack(N),b.onlocaltrack(N,!1)}catch(ne){f.error("Error calling onlocaltrack on removal for renegotiation",ne)}if(N.dontStop!==!0)try{N.stop()}catch{}}}if(x.capture){if(x.gumGroup&&w[x.gumGroup]&&w[x.gumGroup].stream){let N=w[x.gumGroup].stream;fe=x.type==="audio"?N.getAudioTracks()[0]:N.getVideoTracks()[0],delete w[x.gumGroup].stream,delete w[x.gumGroup],delete x.gumGroup}else if(x.capture instanceof MediaStreamTrack)fe=x.capture;else{I||(I=!0,b.consentDialog(!0));let N=f.trackConstraints(x),ne=null;if(x.type==="audio"||x.type==="video"){if(x.gumGroup){let be=x.type==="audio"?"video":"audio";if(w[x.gumGroup]&&w[x.gumGroup][be]){let vt=w[x.gumGroup][be],yi=f.trackConstraints(vt);N[be]=yi[be]}}ne=await navigator.mediaDevices.getUserMedia(N),x.gumGroup&&N.audio&&N.video&&(w[x.gumGroup].stream=ne,delete x.gumGroup)}else ne=await navigator.mediaDevices.getDisplayMedia(N);fe=x.type==="audio"?ne.getAudioTracks()[0]:ne.getVideoTracks()[0]}if(x.replace){await re.replaceTrack(fe);let N="sendrecv";(x.recv===!1||B.direction==="inactive"||B.direction==="sendonly")&&(N="sendonly"),B.setDirection?B.setDirection(N):B.direction=N}else{if(y.myStream||(y.myStream=new MediaStream),A==="audio"||!x.simulcast&&!x.svc)re=y.pc.addTrack(fe,y.myStream),B=y.pc.getTransceivers().find(N=>N.sender===re);else if(x.simulcast){if(f.webRTCAdapter.browserDetails.browser!=="firefox"){f.log("Enabling rid-based simulcasting:",fe);let N=Ye(x.simulcastMaxBitrates);B=y.pc.addTransceiver(fe,{direction:"sendrecv",streams:[y.myStream],sendEncodings:x.sendEncodings||[{rid:"h",active:!0,scalabilityMode:"L1T2",maxBitrate:N.high},{rid:"m",active:!0,scalabilityMode:"L1T2",maxBitrate:N.medium,scaleResolutionDownBy:2},{rid:"l",active:!0,scalabilityMode:"L1T2",maxBitrate:N.low,scaleResolutionDownBy:4}]})}else if(f.log("Enabling Simulcasting for Firefox (RID)"),B=y.pc.addTransceiver(fe,{direction:"sendrecv",streams:[y.myStream]}),re=B?B.sender:null,re){let N=re.getParameters();N||(N={});let ne=Ye(x.simulcastMaxBitrates);N.encodings=x.sendEncodings||[{rid:"h",active:!0,maxBitrate:ne.high},{rid:"m",active:!0,maxBitrate:ne.medium,scaleResolutionDownBy:2},{rid:"l",active:!0,maxBitrate:ne.low,scaleResolutionDownBy:4}],re.setParameters(N)}}else f.log("Enabling SVC ("+x.svc+"):",fe),B=y.pc.addTransceiver(fe,{direction:"sendrecv",streams:[y.myStream],sendEncodings:[{scalabilityMode:x.svc}]});if(re||(re=B?B.sender:null),x.codec)if(f.webRTCAdapter.browserDetails.browser==="firefox")f.warn("setCodecPreferences not supported in Firefox, ignoring codec for track:",x);else if(typeof x.codec!="string")f.warn("Invalid codec value, ignoring for track:",x);else{let N=A+"/"+x.codec.toLowerCase(),ne=RTCRtpReceiver.getCapabilities(A).codecs.filter(function(be){return be.mimeType.toLowerCase()===N});if(!ne||ne.length===0)f.warn("Codec not supported in this browser for this track, ignoring:",x);else if(B)try{B.setCodecPreferences(ne)}catch(be){f.warn("Failed enforcing codec for this "+A+" track:",be)}}if(x.bitrate){if(x.simulcast||x.svc)f.warn("Ignoring bitrate for simulcast/SVC track, use sendEncodings for that");else if(isNaN(x.bitrate)||x.bitrate<0)f.warn("Ignoring invalid bitrate for track:",x);else if(re){let N=re.getParameters();!N||!N.encodings||N.encodings.length===0?f.warn("No encodings in the sender parameters, ignoring bitrate for track:",x):(N.encodings[0].maxBitrate=x.bitrate,await re.setParameters(N))}}if(A==="video"&&x.framerate){if(x.simulcast||x.svc)f.warn("Ignoring framerate for simulcast/SVC track, use sendEncodings for that");else if(isNaN(x.framerate)||x.framerate<0)f.warn("Ignoring invalid framerate for track:",x);else if(re){let N=re.getParameters();!N||!N.encodings||N.encodings.length===0?f.warn("No encodings in the sender parameters, ignoring framerate for track:",x):(N.encodings[0].maxFramerate=x.framerate,await re.setParameters(N))}}if(x.transforms){if(re&&x.transforms.sender){let N=null;RTCRtpSender.prototype.createEncodedStreams?N=re.createEncodedStreams():(RTCRtpSender.prototype.createAudioEncodedStreams||RTCRtpSender.prototype.createEncodedVideoStreams)&&(A==="audio"?N=re.createEncodedAudioStreams():A==="video"&&(N=re.createEncodedVideoStreams())),N&&(N.readableStream&&N.writableStream?N.readableStream.pipeThrough(x.transforms.sender).pipeTo(N.writableStream):N.readable&&N.writable&&N.readable.pipeThrough(x.transforms.sender).pipeTo(N.writable))}if(B&&B.receiver&&x.transforms.receiver){let N=null;RTCRtpReceiver.prototype.createEncodedStreams?N=B.receiver.createEncodedStreams():(RTCRtpReceiver.prototype.createAudioEncodedStreams||RTCRtpReceiver.prototype.createEncodedVideoStreams)&&(A==="audio"?N=B.receiver.createEncodedAudioStreams():A==="video"&&(N=B.receiver.createEncodedVideoStreams())),N&&(N.readableStream&&N.writableStream?N.readableStream.pipeThrough(x.transforms.receiver).pipeTo(N.writableStream):N.readable&&N.writable&&N.readable.pipeThrough(x.transforms.receiver).pipeTo(N.writable))}}}fe&&x.dontStop===!0&&(fe.dontStop=!0)}else if(x.recv&&(B||(B=y.pc.addTransceiver(A)),B)){if(x.codec)if(f.webRTCAdapter.browserDetails.browser==="firefox")f.warn("setCodecPreferences not supported in Firefox, ignoring codec for track:",x);else if(typeof x.codec!="string")f.warn("Invalid codec value, ignoring for track:",x);else{let N=A+"/"+x.codec.toLowerCase(),ne=RTCRtpReceiver.getCapabilities(A).codecs.filter(function(be){return be.mimeType.toLowerCase()===N});if(!ne||ne.length===0)f.warn("Codec not supported in this browser for this track, ignoring:",x);else try{B.setCodecPreferences(ne)}catch(be){f.warn("Failed enforcing codec for this "+A+" track:",be)}}if(B.receiver&&x.transforms&&x.transforms.receiver){let N=null;RTCRtpReceiver.prototype.createEncodedStreams?N=B.receiver.createEncodedStreams():(RTCRtpReceiver.prototype.createAudioEncodedStreams||RTCRtpReceiver.prototype.createEncodedVideoStreams)&&(A==="audio"?N=B.receiver.createEncodedAudioStreams():A==="video"&&(N=B.receiver.createEncodedVideoStreams())),N&&(N.readableStream&&N.writableStream?N.readableStream.pipeThrough(x.transforms.receiver).pipeTo(N.writableStream):N.readable&&N.writable&&N.readable.pipeThrough(x.transforms.receiver).pipeTo(N.writable))}}if(fe){y.myStream.addTrack(fe),fe.onended=function(N){f.log("Local track removed:",N);try{b.onlocaltrack(N.target,!1)}catch(ne){f.error("Error calling onlocaltrack following end",ne)}};try{b.onlocaltrack(fe,!0)}catch(N){f.error("Error calling onlocaltrack for track add",N)}}if(B){let N=B.direction,ne=null,be=fe&&B.sender.track,vt=x.recv!==!1&&B.receiver.track;be&&vt?ne="sendrecv":be&&!vt?ne="sendonly":!be&&vt?ne="recvonly":!be&&!vt&&(ne="inactive"),ne&&ne!==N&&(f.warn("Changing direction of transceiver to "+ne+" (was "+N+")",x),B.setDirection?B.setDirection(ne):B.direction=ne)}}I&&b.consentDialog(!1)}function Ut(v){let C=X.get(v);if(!C||!C.webrtcStuff)return f.warn("Invalid handle"),null;let b=C.webrtcStuff;if(!b.pc)return f.warn("Invalid PeerConnection"),null;let y=[],O=b.pc.getTransceivers();for(let I of O){let w=null;I.sender&&I.sender.track&&(w={mid:I.mid},w.type=I.sender.track.kind,w.id=I.sender.track.id,w.label=I.sender.track.label),w&&y.push(w)}return y}function cr(v){let C=X.get(v);if(!C||!C.webrtcStuff)return f.warn("Invalid handle"),null;let b=C.webrtcStuff;if(!b.pc)return f.warn("Invalid PeerConnection"),null;let y=[],O=b.pc.getTransceivers();for(let I of O){let w=null;I.receiver&&I.receiver.track&&(w={mid:I.mid},w.type=I.receiver.track.kind,w.id=I.receiver.track.id,w.label=I.receiver.track.label),w&&y.push(w)}return y}function ct(v,C,b,y){y=typeof y=="function"?y:f.noop;let O=X.get(v);if(!O||!O.webrtcStuff){f.warn("Invalid handle"),y(0);return}let I=b?"remote":"local",w=O.webrtcStuff;if(w.volume[I]||(w.volume[I]={value:0}),w.pc&&w.pc.getStats&&(f.webRTCAdapter.browserDetails.browser==="chrome"||f.webRTCAdapter.browserDetails.browser==="safari")){let W=w.pc;if(C){let F=w.pc.getTransceivers().find(x=>x.mid===C&&x.receiver.track.kind==="audio");if(!F){f.warn("No audio transceiver with mid "+C),y(0);return}if(b&&!F.receiver){f.warn("Remote transceiver track unavailable"),y(0);return}else if(!b&&!F.sender){f.warn("Local transceiver track unavailable"),y(0);return}W=b?F.receiver:F.sender}return W.getStats().then(function(F){F.forEach(function(x){!x||x.kind!=="audio"||b&&!x.remoteSource||!b&&x.type!=="media-source"||y(x.audioLevel?x.audioLevel:0)})}),w.volume[I].value}else{f.warn("Getting the "+I+" volume unsupported by browser"),y(0);return}}function Tt(v,C,b){let y=X.get(v);if(!y||!y.webrtcStuff)return f.warn("Invalid handle"),!0;let O=y.webrtcStuff;if(!O.pc)return f.warn("Invalid PeerConnection"),!0;if(!O.myStream)return f.warn("Invalid local MediaStream"),!0;if(b){if(!O.myStream.getVideoTracks()||O.myStream.getVideoTracks().length===0)return f.warn("No video track"),!0;if(C){let I=O.pc.getTransceivers().find(w=>w.mid===C&&w.receiver.track.kind==="video");return I?!I.sender||!I.sender.track?(f.warn("No video sender with mid "+C),!0):!I.sender.track.enabled:(f.warn("No video transceiver with mid "+C),!0)}else return!O.myStream.getVideoTracks()[0].enabled}else{if(!O.myStream.getAudioTracks()||O.myStream.getAudioTracks().length===0)return f.warn("No audio track"),!0;if(C){let I=O.pc.getTransceivers().find(w=>w.mid===C&&w.receiver.track.kind==="audio");return I?!I.sender||!I.sender.track?(f.warn("No audio sender with mid "+C),!0):!I.sender.track.enabled:(f.warn("No audio transceiver with mid "+C),!0)}else return!O.myStream.getAudioTracks()[0].enabled}}function ft(v,C,b,y){let O=X.get(v);if(!O||!O.webrtcStuff)return f.warn("Invalid handle"),!1;let I=O.webrtcStuff;if(!I.pc)return f.warn("Invalid PeerConnection"),!1;if(!I.myStream)return f.warn("Invalid local MediaStream"),!1;if(b){if(!I.myStream.getVideoTracks()||I.myStream.getVideoTracks().length===0)return f.warn("No video track"),!1;if(C){let w=I.pc.getTransceivers().find(W=>W.mid===C&&W.receiver.track.kind==="video");if(!w)return f.warn("No video transceiver with mid "+C),!1;if(!w.sender||!w.sender.track)return f.warn("No video sender with mid "+C),!1;w.sender.track.enabled=!y}else for(const w of I.myStream.getVideoTracks())w.enabled=!y}else{if(!I.myStream.getAudioTracks()||I.myStream.getAudioTracks().length===0)return f.warn("No audio track"),!1;if(C){let w=I.pc.getTransceivers().find(W=>W.mid===C&&W.receiver.track.kind==="audio");if(!w)return f.warn("No audio transceiver with mid "+C),!1;if(!w.sender||!w.sender.track)return f.warn("No audio sender with mid "+C),!1;w.sender.track.enabled=!y}else for(const w of I.myStream.getAudioTracks())w.enabled=!y}return!0}function Ne(v,C){let b=X.get(v);if(!b||!b.webrtcStuff)return f.warn("Invalid handle"),"Invalid handle";let y=b.webrtcStuff;if(!y.pc)return"Invalid PeerConnection";if(y.pc.getStats){let O=y.pc,I=C||"default";if(C){let w=y.pc.getTransceivers().find(W=>W.mid===C&&W.receiver.track.kind==="video");if(!w)return f.warn("No video transceiver with mid "+C),"No video transceiver with mid "+C;if(!w.receiver)return f.warn("No video receiver with mid "+C),"No video receiver with mid "+C;O=w.receiver}return y.bitrate[I]||(y.bitrate[I]={timer:null,bsnow:null,bsbefore:null,tsnow:null,tsbefore:null,value:"0 kbits/sec"}),y.bitrate[I].timer?y.bitrate[I].value:(f.log("Starting bitrate timer"+(C?" for mid "+C:"")+" (via getStats)"),y.bitrate[I].timer=setInterval(function(){O.getStats().then(function(w){w.forEach(function(W){if(!W)return;let F=!1;if(((W.mediaType==="video"||W.id.toLowerCase().indexOf("video")>-1)&&W.type==="inbound-rtp"&&W.id.indexOf("rtcp")<0||W.type=="ssrc"&&W.bytesReceived&&(W.googCodecName==="VP8"||W.googCodecName===""))&&(F=!0),F)if(y.bitrate[I].bsnow=W.bytesReceived,y.bitrate[I].tsnow=W.timestamp,y.bitrate[I].bsbefore===null||y.bitrate[I].tsbefore===null)y.bitrate[I].bsbefore=y.bitrate[I].bsnow,y.bitrate[I].tsbefore=y.bitrate[I].tsnow;else{let x=y.bitrate[I].tsnow-y.bitrate[I].tsbefore;f.webRTCAdapter.browserDetails.browser==="safari"&&(x=x/1e3);let A=Math.round((y.bitrate[I].bsnow-y.bitrate[I].bsbefore)*8/x);f.webRTCAdapter.browserDetails.browser==="safari"&&(A=parseInt(A/1e3)),y.bitrate[I].value=A+" kbits/sec",y.bitrate[I].bsbefore=y.bitrate[I].bsnow,y.bitrate[I].tsbefore=y.bitrate[I].tsnow}})})},1e3),"0 kbits/sec")}else return f.warn("Getting the video bitrate unsupported by browser"),"Feature unsupported by browser"}function Ft(v,C,b){let y=X.get(v);if(!y||!y.webrtcStuff){f.warn("Invalid handle");return}let O=y.webrtcStuff;if(!O.pc){f.warn("Invalid PeerConnection");return}let I=O.pc.getTransceivers().find(W=>W.mid===C);if(!I){f.warn("No transceiver with mid",C);return}if(!I.sender){f.warn("No sender for transceiver with mid",C);return}let w=I.sender.getParameters();!w||!w.encodings||w.encodings.length===0?f.warn("No parameters encodings"):w.encodings.length>1?f.warn("Ignoring bitrate for simulcast track, use sendEncodings for that"):isNaN(b)||b<0?f.warn("Invalid bitrate (must be a positive integer)"):(w.encodings[0].maxBitrate=b,I.sender.setParameters(w))}function fr(v){f.error("WebRTC error:",v)}function qe(v,C){f.log("Cleaning WebRTC stuff");let b=X.get(v);if(!b)return;let y=b.webrtcStuff;if(y){if(C===!0){let O={janus:"hangup",transaction:f.randomString(12)};b.token&&(O.token=b.token),j&&(O.apisecret=j),f.debug("Sending hangup request (handle="+v+"):"),f.debug(O),s?(O.session_id=$,O.handle_id=v,n.send(JSON.stringify(O))):f.httpAPICall(g+"/"+$+"/"+v,{verb:"POST",withCredentials:D,body:O})}y.volume&&(y.volume.local&&y.volume.local.timer&&clearInterval(y.volume.local.timer),y.volume.remote&&y.volume.remote.timer&&clearInterval(y.volume.remote.timer));for(let O in y.bitrate)y.bitrate[O].timer&&clearInterval(y.bitrate[O].timer);y.bitrate={},!y.streamExternal&&y.myStream&&(f.log("Stopping local stream tracks"),f.stopAllTracks(y.myStream)),y.streamExternal=!1,y.myStream=null;try{y.pc.close()}catch{}y.pc=null,y.candidates=null,y.mySdp=null,y.remoteSdp=null,y.iceDone=!1,y.dataChannel={},y.dtmfSender=null,y.insertableStreams=!1}b.oncleanup()}function lr(v){return f.debug("isTrickleEnabled:",v),v!==!1}}let zu=!0,Vu=!0;function ri(i,s,n){const o=i.match(s);return o&&o.length>=n&&parseInt(o[n],10)}function In(i,s,n){if(!i.RTCPeerConnection)return;const o=i.RTCPeerConnection.prototype,a=o.addEventListener;o.addEventListener=function(p,g){if(p!==s)return a.apply(this,arguments);const T=l=>{const _=n(l);_&&(g.handleEvent?g.handleEvent(_):g(_))};return this._eventMap=this._eventMap||{},this._eventMap[s]||(this._eventMap[s]=new Map),this._eventMap[s].set(g,T),a.apply(this,[p,T])};const u=o.removeEventListener;o.removeEventListener=function(p,g){if(p!==s||!this._eventMap||!this._eventMap[s])return u.apply(this,arguments);if(!this._eventMap[s].has(g))return u.apply(this,arguments);const T=this._eventMap[s].get(g);return this._eventMap[s].delete(g),this._eventMap[s].size===0&&delete this._eventMap[s],Object.keys(this._eventMap).length===0&&delete this._eventMap,u.apply(this,[p,T])},Object.defineProperty(o,"on"+s,{get(){return this["_on"+s]},set(p){this["_on"+s]&&(this.removeEventListener(s,this["_on"+s]),delete this["_on"+s]),p&&this.addEventListener(s,this["_on"+s]=p)},enumerable:!0,configurable:!0})}function Sv(i){return typeof i!="boolean"?new Error("Argument type: "+typeof i+". Please use a boolean."):(zu=i,i?"adapter.js logging disabled":"adapter.js logging enabled")}function Cv(i){return typeof i!="boolean"?new Error("Argument type: "+typeof i+". Please use a boolean."):(Vu=!i,"adapter.js deprecation warnings "+(i?"disabled":"enabled"))}function $u(){if(typeof window=="object"){if(zu)return;typeof console<"u"&&typeof console.log=="function"&&console.log.apply(console,arguments)}}function Vo(i,s){Vu&&console.warn(i+" is deprecated, please use "+s+" instead.")}function bv(i){const s={browser:null,version:null};if(typeof i>"u"||!i.navigator)return s.browser="Not a browser.",s;const{navigator:n}=i;if(n.mozGetUserMedia)s.browser="firefox",s.version=ri(n.userAgent,/Firefox\/(\d+)\./,1);else if(n.webkitGetUserMedia||i.isSecureContext===!1&&i.webkitRTCPeerConnection&&!i.RTCIceGatherer)s.browser="chrome",s.version=ri(n.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(i.RTCPeerConnection&&n.userAgent.match(/AppleWebKit\/(\d+)\./))s.browser="safari",s.version=ri(n.userAgent,/AppleWebKit\/(\d+)\./,1),s.supportsUnifiedPlan=i.RTCRtpTransceiver&&"currentDirection"in i.RTCRtpTransceiver.prototype;else return s.browser="Not a supported browser.",s;return s}function bu(i){return Object.prototype.toString.call(i)==="[object Object]"}function ju(i){return bu(i)?Object.keys(i).reduce(function(s,n){const o=bu(i[n]),a=o?ju(i[n]):i[n],u=o&&!Object.keys(a).length;return a===void 0||u?s:Object.assign(s,{[n]:a})},{}):i}function Fo(i,s,n){!s||n.has(s.id)||(n.set(s.id,s),Object.keys(s).forEach(o=>{o.endsWith("Id")?Fo(i,i.get(s[o]),n):o.endsWith("Ids")&&s[o].forEach(a=>{Fo(i,i.get(a),n)})}))}function Tu(i,s,n){const o=n?"outbound-rtp":"inbound-rtp",a=new Map;if(s===null)return a;const u=[];return i.forEach(p=>{p.type==="track"&&p.trackIdentifier===s.id&&u.push(p)}),u.forEach(p=>{i.forEach(g=>{g.type===o&&g.trackId===p.id&&Fo(i,g,a)})}),a}const Ru=$u;function Ku(i,s){const n=i&&i.navigator;if(!n.mediaDevices)return;const o=function(g){if(typeof g!="object"||g.mandatory||g.optional)return g;const T={};return Object.keys(g).forEach(l=>{if(l==="require"||l==="advanced"||l==="mediaSource")return;const _=typeof g[l]=="object"?g[l]:{ideal:g[l]};_.exact!==void 0&&typeof _.exact=="number"&&(_.min=_.max=_.exact);const D=function(H,z){return H?H+z.charAt(0).toUpperCase()+z.slice(1):z==="deviceId"?"sourceId":z};if(_.ideal!==void 0){T.optional=T.optional||[];let H={};typeof _.ideal=="number"?(H[D("min",l)]=_.ideal,T.optional.push(H),H={},H[D("max",l)]=_.ideal,T.optional.push(H)):(H[D("",l)]=_.ideal,T.optional.push(H))}_.exact!==void 0&&typeof _.exact!="number"?(T.mandatory=T.mandatory||{},T.mandatory[D("",l)]=_.exact):["min","max"].forEach(H=>{_[H]!==void 0&&(T.mandatory=T.mandatory||{},T.mandatory[D(H,l)]=_[H])})}),g.advanced&&(T.optional=(T.optional||[]).concat(g.advanced)),T},a=function(g,T){if(s.version>=61)return T(g);if(g=JSON.parse(JSON.stringify(g)),g&&typeof g.audio=="object"){const l=function(_,D,H){D in _&&!(H in _)&&(_[H]=_[D],delete _[D])};g=JSON.parse(JSON.stringify(g)),l(g.audio,"autoGainControl","googAutoGainControl"),l(g.audio,"noiseSuppression","googNoiseSuppression"),g.audio=o(g.audio)}if(g&&typeof g.video=="object"){let l=g.video.facingMode;l=l&&(typeof l=="object"?l:{ideal:l});const _=s.version<66;if(l&&(l.exact==="user"||l.exact==="environment"||l.ideal==="user"||l.ideal==="environment")&&!(n.mediaDevices.getSupportedConstraints&&n.mediaDevices.getSupportedConstraints().facingMode&&!_)){delete g.video.facingMode;let D;if(l.exact==="environment"||l.ideal==="environment"?D=["back","rear"]:(l.exact==="user"||l.ideal==="user")&&(D=["front"]),D)return n.mediaDevices.enumerateDevices().then(H=>{H=H.filter(j=>j.kind==="videoinput");let z=H.find(j=>D.some(ee=>j.label.toLowerCase().includes(ee)));return!z&&H.length&&D.includes("back")&&(z=H[H.length-1]),z&&(g.video.deviceId=l.exact?{exact:z.deviceId}:{ideal:z.deviceId}),g.video=o(g.video),Ru("chrome: "+JSON.stringify(g)),T(g)})}g.video=o(g.video)}return Ru("chrome: "+JSON.stringify(g)),T(g)},u=function(g){return s.version>=64?g:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[g.name]||g.name,message:g.message,constraint:g.constraint||g.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}},p=function(g,T,l){a(g,_=>{n.webkitGetUserMedia(_,T,D=>{l&&l(u(D))})})};if(n.getUserMedia=p.bind(n),n.mediaDevices.getUserMedia){const g=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(T){return a(T,l=>g(l).then(_=>{if(l.audio&&!_.getAudioTracks().length||l.video&&!_.getVideoTracks().length)throw _.getTracks().forEach(D=>{D.stop()}),new DOMException("","NotFoundError");return _},_=>Promise.reject(u(_))))}}}function Tv(i,s){if(!(i.navigator.mediaDevices&&"getDisplayMedia"in i.navigator.mediaDevices)&&i.navigator.mediaDevices){if(typeof s!="function"){console.error("shimGetDisplayMedia: getSourceId argument is not a function");return}i.navigator.mediaDevices.getDisplayMedia=function(o){return s(o).then(a=>{const u=o.video&&o.video.width,p=o.video&&o.video.height,g=o.video&&o.video.frameRate;return o.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:a,maxFrameRate:g||3}},u&&(o.video.mandatory.maxWidth=u),p&&(o.video.mandatory.maxHeight=p),i.navigator.mediaDevices.getUserMedia(o)})}}}function Yu(i){i.MediaStream=i.MediaStream||i.webkitMediaStream}function Zu(i){if(typeof i=="object"&&i.RTCPeerConnection&&!("ontrack"in i.RTCPeerConnection.prototype)){Object.defineProperty(i.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(n){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=n)},enumerable:!0,configurable:!0});const s=i.RTCPeerConnection.prototype.setRemoteDescription;i.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=o=>{o.stream.addEventListener("addtrack",a=>{let u;i.RTCPeerConnection.prototype.getReceivers?u=this.getReceivers().find(g=>g.track&&g.track.id===a.track.id):u={track:a.track};const p=new Event("track");p.track=a.track,p.receiver=u,p.transceiver={receiver:u},p.streams=[o.stream],this.dispatchEvent(p)}),o.stream.getTracks().forEach(a=>{let u;i.RTCPeerConnection.prototype.getReceivers?u=this.getReceivers().find(g=>g.track&&g.track.id===a.id):u={track:a};const p=new Event("track");p.track=a,p.receiver=u,p.transceiver={receiver:u},p.streams=[o.stream],this.dispatchEvent(p)})},this.addEventListener("addstream",this._ontrackpoly)),s.apply(this,arguments)}}else In(i,"track",s=>(s.transceiver||Object.defineProperty(s,"transceiver",{value:{receiver:s.receiver}}),s))}function Xu(i){if(typeof i=="object"&&i.RTCPeerConnection&&!("getSenders"in i.RTCPeerConnection.prototype)&&"createDTMFSender"in i.RTCPeerConnection.prototype){const s=function(a,u){return{track:u,get dtmf(){return this._dtmf===void 0&&(u.kind==="audio"?this._dtmf=a.createDTMFSender(u):this._dtmf=null),this._dtmf},_pc:a}};if(!i.RTCPeerConnection.prototype.getSenders){i.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const a=i.RTCPeerConnection.prototype.addTrack;i.RTCPeerConnection.prototype.addTrack=function(g,T){let l=a.apply(this,arguments);return l||(l=s(this,g),this._senders.push(l)),l};const u=i.RTCPeerConnection.prototype.removeTrack;i.RTCPeerConnection.prototype.removeTrack=function(g){u.apply(this,arguments);const T=this._senders.indexOf(g);T!==-1&&this._senders.splice(T,1)}}const n=i.RTCPeerConnection.prototype.addStream;i.RTCPeerConnection.prototype.addStream=function(u){this._senders=this._senders||[],n.apply(this,[u]),u.getTracks().forEach(p=>{this._senders.push(s(this,p))})};const o=i.RTCPeerConnection.prototype.removeStream;i.RTCPeerConnection.prototype.removeStream=function(u){this._senders=this._senders||[],o.apply(this,[u]),u.getTracks().forEach(p=>{const g=this._senders.find(T=>T.track===p);g&&this._senders.splice(this._senders.indexOf(g),1)})}}else if(typeof i=="object"&&i.RTCPeerConnection&&"getSenders"in i.RTCPeerConnection.prototype&&"createDTMFSender"in i.RTCPeerConnection.prototype&&i.RTCRtpSender&&!("dtmf"in i.RTCRtpSender.prototype)){const s=i.RTCPeerConnection.prototype.getSenders;i.RTCPeerConnection.prototype.getSenders=function(){const o=s.apply(this,[]);return o.forEach(a=>a._pc=this),o},Object.defineProperty(i.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 Qu(i){if(!i.RTCPeerConnection)return;const s=i.RTCPeerConnection.prototype.getStats;i.RTCPeerConnection.prototype.getStats=function(){const[o,a,u]=arguments;if(arguments.length>0&&typeof o=="function")return s.apply(this,arguments);if(s.length===0&&(arguments.length===0||typeof o!="function"))return s.apply(this,[]);const p=function(T){const l={};return T.result().forEach(D=>{const H={id:D.id,timestamp:D.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[D.type]||D.type};D.names().forEach(z=>{H[z]=D.stat(z)}),l[H.id]=H}),l},g=function(T){return new Map(Object.keys(T).map(l=>[l,T[l]]))};if(arguments.length>=2){const T=function(l){a(g(p(l)))};return s.apply(this,[T,o])}return new Promise((T,l)=>{s.apply(this,[function(_){T(g(p(_)))},l])}).then(a,u)}}function ec(i){if(!(typeof i=="object"&&i.RTCPeerConnection&&i.RTCRtpSender&&i.RTCRtpReceiver))return;if(!("getStats"in i.RTCRtpSender.prototype)){const n=i.RTCPeerConnection.prototype.getSenders;n&&(i.RTCPeerConnection.prototype.getSenders=function(){const u=n.apply(this,[]);return u.forEach(p=>p._pc=this),u});const o=i.RTCPeerConnection.prototype.addTrack;o&&(i.RTCPeerConnection.prototype.addTrack=function(){const u=o.apply(this,arguments);return u._pc=this,u}),i.RTCRtpSender.prototype.getStats=function(){const u=this;return this._pc.getStats().then(p=>Tu(p,u.track,!0))}}if(!("getStats"in i.RTCRtpReceiver.prototype)){const n=i.RTCPeerConnection.prototype.getReceivers;n&&(i.RTCPeerConnection.prototype.getReceivers=function(){const a=n.apply(this,[]);return a.forEach(u=>u._pc=this),a}),In(i,"track",o=>(o.receiver._pc=o.srcElement,o)),i.RTCRtpReceiver.prototype.getStats=function(){const a=this;return this._pc.getStats().then(u=>Tu(u,a.track,!1))}}if(!("getStats"in i.RTCRtpSender.prototype&&"getStats"in i.RTCRtpReceiver.prototype))return;const s=i.RTCPeerConnection.prototype.getStats;i.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof i.MediaStreamTrack){const o=arguments[0];let a,u,p;return this.getSenders().forEach(g=>{g.track===o&&(a?p=!0:a=g)}),this.getReceivers().forEach(g=>(g.track===o&&(u?p=!0:u=g),g.track===o)),p||a&&u?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):a?a.getStats():u?u.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return s.apply(this,arguments)}}function tc(i){i.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(p=>this._shimmedLocalStreams[p][0])};const s=i.RTCPeerConnection.prototype.addTrack;i.RTCPeerConnection.prototype.addTrack=function(p,g){if(!g)return s.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const T=s.apply(this,arguments);return this._shimmedLocalStreams[g.id]?this._shimmedLocalStreams[g.id].indexOf(T)===-1&&this._shimmedLocalStreams[g.id].push(T):this._shimmedLocalStreams[g.id]=[g,T],T};const n=i.RTCPeerConnection.prototype.addStream;i.RTCPeerConnection.prototype.addStream=function(p){this._shimmedLocalStreams=this._shimmedLocalStreams||{},p.getTracks().forEach(l=>{if(this.getSenders().find(D=>D.track===l))throw new DOMException("Track already exists.","InvalidAccessError")});const g=this.getSenders();n.apply(this,arguments);const T=this.getSenders().filter(l=>g.indexOf(l)===-1);this._shimmedLocalStreams[p.id]=[p].concat(T)};const o=i.RTCPeerConnection.prototype.removeStream;i.RTCPeerConnection.prototype.removeStream=function(p){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[p.id],o.apply(this,arguments)};const a=i.RTCPeerConnection.prototype.removeTrack;i.RTCPeerConnection.prototype.removeTrack=function(p){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},p&&Object.keys(this._shimmedLocalStreams).forEach(g=>{const T=this._shimmedLocalStreams[g].indexOf(p);T!==-1&&this._shimmedLocalStreams[g].splice(T,1),this._shimmedLocalStreams[g].length===1&&delete this._shimmedLocalStreams[g]}),a.apply(this,arguments)}}function nc(i,s){if(!i.RTCPeerConnection)return;if(i.RTCPeerConnection.prototype.addTrack&&s.version>=65)return tc(i);const n=i.RTCPeerConnection.prototype.getLocalStreams;i.RTCPeerConnection.prototype.getLocalStreams=function(){const _=n.apply(this);return this._reverseStreams=this._reverseStreams||{},_.map(D=>this._reverseStreams[D.id])};const o=i.RTCPeerConnection.prototype.addStream;i.RTCPeerConnection.prototype.addStream=function(_){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},_.getTracks().forEach(D=>{if(this.getSenders().find(z=>z.track===D))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[_.id]){const D=new i.MediaStream(_.getTracks());this._streams[_.id]=D,this._reverseStreams[D.id]=_,_=D}o.apply(this,[_])};const a=i.RTCPeerConnection.prototype.removeStream;i.RTCPeerConnection.prototype.removeStream=function(_){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},a.apply(this,[this._streams[_.id]||_]),delete this._reverseStreams[this._streams[_.id]?this._streams[_.id].id:_.id],delete this._streams[_.id]},i.RTCPeerConnection.prototype.addTrack=function(_,D){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const H=[].slice.call(arguments,1);if(H.length!==1||!H[0].getTracks().find(ee=>ee===_))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(ee=>ee.track===_))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const j=this._streams[D.id];if(j)j.addTrack(_),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const ee=new i.MediaStream([_]);this._streams[D.id]=ee,this._reverseStreams[ee.id]=D,this.addStream(ee)}return this.getSenders().find(ee=>ee.track===_)};function u(l,_){let D=_.sdp;return Object.keys(l._reverseStreams||[]).forEach(H=>{const z=l._reverseStreams[H],j=l._streams[z.id];D=D.replace(new RegExp(j.id,"g"),z.id)}),new RTCSessionDescription({type:_.type,sdp:D})}function p(l,_){let D=_.sdp;return Object.keys(l._reverseStreams||[]).forEach(H=>{const z=l._reverseStreams[H],j=l._streams[z.id];D=D.replace(new RegExp(z.id,"g"),j.id)}),new RTCSessionDescription({type:_.type,sdp:D})}["createOffer","createAnswer"].forEach(function(l){const _=i.RTCPeerConnection.prototype[l],D={[l](){const H=arguments;return arguments.length&&typeof arguments[0]=="function"?_.apply(this,[j=>{const ee=u(this,j);H[0].apply(null,[ee])},j=>{H[1]&&H[1].apply(null,j)},arguments[2]]):_.apply(this,arguments).then(j=>u(this,j))}};i.RTCPeerConnection.prototype[l]=D[l]});const g=i.RTCPeerConnection.prototype.setLocalDescription;i.RTCPeerConnection.prototype.setLocalDescription=function(){return!arguments.length||!arguments[0].type?g.apply(this,arguments):(arguments[0]=p(this,arguments[0]),g.apply(this,arguments))};const T=Object.getOwnPropertyDescriptor(i.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(i.RTCPeerConnection.prototype,"localDescription",{get(){const l=T.get.apply(this);return l.type===""?l:u(this,l)}}),i.RTCPeerConnection.prototype.removeTrack=function(_){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!_._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(_._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{};let H;Object.keys(this._streams).forEach(z=>{this._streams[z].getTracks().find(ee=>_.track===ee)&&(H=this._streams[z])}),H&&(H.getTracks().length===1?this.removeStream(this._reverseStreams[H.id]):H.removeTrack(_.track),this.dispatchEvent(new Event("negotiationneeded")))}}function No(i,s){!i.RTCPeerConnection&&i.webkitRTCPeerConnection&&(i.RTCPeerConnection=i.webkitRTCPeerConnection),i.RTCPeerConnection&&s.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(n){const o=i.RTCPeerConnection.prototype[n],a={[n](){return arguments[0]=new(n==="addIceCandidate"?i.RTCIceCandidate:i.RTCSessionDescription)(arguments[0]),o.apply(this,arguments)}};i.RTCPeerConnection.prototype[n]=a[n]})}function rc(i,s){In(i,"negotiationneeded",n=>{const o=n.target;if(!((s.version<72||o.getConfiguration&&o.getConfiguration().sdpSemantics==="plan-b")&&o.signalingState!=="stable"))return n})}const xu=Object.freeze(Object.defineProperty({__proto__:null,fixNegotiationNeeded:rc,shimAddTrackRemoveTrack:nc,shimAddTrackRemoveTrackWithNative:tc,shimGetDisplayMedia:Tv,shimGetSendersWithDtmf:Xu,shimGetStats:Qu,shimGetUserMedia:Ku,shimMediaStream:Yu,shimOnTrack:Zu,shimPeerConnection:No,shimSenderReceiverGetStats:ec},Symbol.toStringTag,{value:"Module"}));function ic(i,s){const n=i&&i.navigator,o=i&&i.MediaStreamTrack;if(n.getUserMedia=function(a,u,p){Vo("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),n.mediaDevices.getUserMedia(a).then(u,p)},!(s.version>55&&"autoGainControl"in n.mediaDevices.getSupportedConstraints())){const a=function(p,g,T){g in p&&!(T in p)&&(p[T]=p[g],delete p[g])},u=n.mediaDevices.getUserMedia.bind(n.mediaDevices);if(n.mediaDevices.getUserMedia=function(p){return typeof p=="object"&&typeof p.audio=="object"&&(p=JSON.parse(JSON.stringify(p)),a(p.audio,"autoGainControl","mozAutoGainControl"),a(p.audio,"noiseSuppression","mozNoiseSuppression")),u(p)},o&&o.prototype.getSettings){const p=o.prototype.getSettings;o.prototype.getSettings=function(){const g=p.apply(this,arguments);return a(g,"mozAutoGainControl","autoGainControl"),a(g,"mozNoiseSuppression","noiseSuppression"),g}}if(o&&o.prototype.applyConstraints){const p=o.prototype.applyConstraints;o.prototype.applyConstraints=function(g){return this.kind==="audio"&&typeof g=="object"&&(g=JSON.parse(JSON.stringify(g)),a(g,"autoGainControl","mozAutoGainControl"),a(g,"noiseSuppression","mozNoiseSuppression")),p.apply(this,[g])}}}}function Rv(i,s){i.navigator.mediaDevices&&"getDisplayMedia"in i.navigator.mediaDevices||i.navigator.mediaDevices&&(i.navigator.mediaDevices.getDisplayMedia=function(o){if(!(o&&o.video)){const a=new DOMException("getDisplayMedia without video constraints is undefined");return a.name="NotFoundError",a.code=8,Promise.reject(a)}return o.video===!0?o.video={mediaSource:s}:o.video.mediaSource=s,i.navigator.mediaDevices.getUserMedia(o)})}function oc(i){typeof i=="object"&&i.RTCTrackEvent&&"receiver"in i.RTCTrackEvent.prototype&&!("transceiver"in i.RTCTrackEvent.prototype)&&Object.defineProperty(i.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function Go(i,s){if(typeof i!="object"||!(i.RTCPeerConnection||i.mozRTCPeerConnection))return;!i.RTCPeerConnection&&i.mozRTCPeerConnection&&(i.RTCPeerConnection=i.mozRTCPeerConnection),s.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(a){const u=i.RTCPeerConnection.prototype[a],p={[a](){return arguments[0]=new(a==="addIceCandidate"?i.RTCIceCandidate:i.RTCSessionDescription)(arguments[0]),u.apply(this,arguments)}};i.RTCPeerConnection.prototype[a]=p[a]});const n={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},o=i.RTCPeerConnection.prototype.getStats;i.RTCPeerConnection.prototype.getStats=function(){const[u,p,g]=arguments;return o.apply(this,[u||null]).then(T=>{if(s.version<53&&!p)try{T.forEach(l=>{l.type=n[l.type]||l.type})}catch(l){if(l.name!=="TypeError")throw l;T.forEach((_,D)=>{T.set(D,Object.assign({},_,{type:n[_.type]||_.type}))})}return T}).then(p,g)}}function sc(i){if(!(typeof i=="object"&&i.RTCPeerConnection&&i.RTCRtpSender)||i.RTCRtpSender&&"getStats"in i.RTCRtpSender.prototype)return;const s=i.RTCPeerConnection.prototype.getSenders;s&&(i.RTCPeerConnection.prototype.getSenders=function(){const a=s.apply(this,[]);return a.forEach(u=>u._pc=this),a});const n=i.RTCPeerConnection.prototype.addTrack;n&&(i.RTCPeerConnection.prototype.addTrack=function(){const a=n.apply(this,arguments);return a._pc=this,a}),i.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function ac(i){if(!(typeof i=="object"&&i.RTCPeerConnection&&i.RTCRtpSender)||i.RTCRtpSender&&"getStats"in i.RTCRtpReceiver.prototype)return;const s=i.RTCPeerConnection.prototype.getReceivers;s&&(i.RTCPeerConnection.prototype.getReceivers=function(){const o=s.apply(this,[]);return o.forEach(a=>a._pc=this),o}),In(i,"track",n=>(n.receiver._pc=n.srcElement,n)),i.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function uc(i){!i.RTCPeerConnection||"removeStream"in i.RTCPeerConnection.prototype||(i.RTCPeerConnection.prototype.removeStream=function(n){Vo("removeStream","removeTrack"),this.getSenders().forEach(o=>{o.track&&n.getTracks().includes(o.track)&&this.removeTrack(o)})})}function cc(i){i.DataChannel&&!i.RTCDataChannel&&(i.RTCDataChannel=i.DataChannel)}function fc(i){if(!(typeof i=="object"&&i.RTCPeerConnection))return;const s=i.RTCPeerConnection.prototype.addTransceiver;s&&(i.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];const o=arguments[1],a=o&&"sendEncodings"in o;a&&o.sendEncodings.forEach(p=>{if("rid"in p&&!/^[a-z0-9]{0,16}$/i.test(p.rid))throw new TypeError("Invalid RID value provided.");if("scaleResolutionDownBy"in p&&!(parseFloat(p.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in p&&!(parseFloat(p.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")});const u=s.apply(this,arguments);if(a){const{sender:p}=u,g=p.getParameters();(!("encodings"in g)||g.encodings.length===1&&Object.keys(g.encodings[0]).length===0)&&(g.encodings=o.sendEncodings,p.sendEncodings=o.sendEncodings,this.setParametersPromises.push(p.setParameters(g).then(()=>{delete p.sendEncodings}).catch(()=>{delete p.sendEncodings})))}return u})}function lc(i){if(!(typeof i=="object"&&i.RTCRtpSender))return;const s=i.RTCRtpSender.prototype.getParameters;s&&(i.RTCRtpSender.prototype.getParameters=function(){const o=s.apply(this,arguments);return"encodings"in o||(o.encodings=[].concat(this.sendEncodings||[{}])),o})}function dc(i){if(!(typeof i=="object"&&i.RTCPeerConnection))return;const s=i.RTCPeerConnection.prototype.createOffer;i.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>s.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):s.apply(this,arguments)}}function pc(i){if(!(typeof i=="object"&&i.RTCPeerConnection))return;const s=i.RTCPeerConnection.prototype.createAnswer;i.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>s.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):s.apply(this,arguments)}}const Pu=Object.freeze(Object.defineProperty({__proto__:null,shimAddTransceiver:fc,shimCreateAnswer:pc,shimCreateOffer:dc,shimGetDisplayMedia:Rv,shimGetParameters:lc,shimGetUserMedia:ic,shimOnTrack:oc,shimPeerConnection:Go,shimRTCDataChannel:cc,shimReceiverGetStats:ac,shimRemoveStream:uc,shimSenderGetStats:sc},Symbol.toStringTag,{value:"Module"}));function hc(i){if(!(typeof i!="object"||!i.RTCPeerConnection)){if("getLocalStreams"in i.RTCPeerConnection.prototype||(i.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in i.RTCPeerConnection.prototype)){const s=i.RTCPeerConnection.prototype.addTrack;i.RTCPeerConnection.prototype.addStream=function(o){this._localStreams||(this._localStreams=[]),this._localStreams.includes(o)||this._localStreams.push(o),o.getAudioTracks().forEach(a=>s.call(this,a,o)),o.getVideoTracks().forEach(a=>s.call(this,a,o))},i.RTCPeerConnection.prototype.addTrack=function(o,...a){return a&&a.forEach(u=>{this._localStreams?this._localStreams.includes(u)||this._localStreams.push(u):this._localStreams=[u]}),s.apply(this,arguments)}}"removeStream"in i.RTCPeerConnection.prototype||(i.RTCPeerConnection.prototype.removeStream=function(n){this._localStreams||(this._localStreams=[]);const o=this._localStreams.indexOf(n);if(o===-1)return;this._localStreams.splice(o,1);const a=n.getTracks();this.getSenders().forEach(u=>{a.includes(u.track)&&this.removeTrack(u)})})}}function gc(i){if(!(typeof i!="object"||!i.RTCPeerConnection)&&("getRemoteStreams"in i.RTCPeerConnection.prototype||(i.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in i.RTCPeerConnection.prototype))){Object.defineProperty(i.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(n){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=n),this.addEventListener("track",this._onaddstreampoly=o=>{o.streams.forEach(a=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(a))return;this._remoteStreams.push(a);const u=new Event("addstream");u.stream=a,this.dispatchEvent(u)})})}});const s=i.RTCPeerConnection.prototype.setRemoteDescription;i.RTCPeerConnection.prototype.setRemoteDescription=function(){const o=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(a){a.streams.forEach(u=>{if(o._remoteStreams||(o._remoteStreams=[]),o._remoteStreams.indexOf(u)>=0)return;o._remoteStreams.push(u);const p=new Event("addstream");p.stream=u,o.dispatchEvent(p)})}),s.apply(o,arguments)}}}function mc(i){if(typeof i!="object"||!i.RTCPeerConnection)return;const s=i.RTCPeerConnection.prototype,n=s.createOffer,o=s.createAnswer,a=s.setLocalDescription,u=s.setRemoteDescription,p=s.addIceCandidate;s.createOffer=function(l,_){const D=arguments.length>=2?arguments[2]:arguments[0],H=n.apply(this,[D]);return _?(H.then(l,_),Promise.resolve()):H},s.createAnswer=function(l,_){const D=arguments.length>=2?arguments[2]:arguments[0],H=o.apply(this,[D]);return _?(H.then(l,_),Promise.resolve()):H};let g=function(T,l,_){const D=a.apply(this,[T]);return _?(D.then(l,_),Promise.resolve()):D};s.setLocalDescription=g,g=function(T,l,_){const D=u.apply(this,[T]);return _?(D.then(l,_),Promise.resolve()):D},s.setRemoteDescription=g,g=function(T,l,_){const D=p.apply(this,[T]);return _?(D.then(l,_),Promise.resolve()):D},s.addIceCandidate=g}function vc(i){const s=i&&i.navigator;if(s.mediaDevices&&s.mediaDevices.getUserMedia){const n=s.mediaDevices,o=n.getUserMedia.bind(n);s.mediaDevices.getUserMedia=a=>o(yc(a))}!s.getUserMedia&&s.mediaDevices&&s.mediaDevices.getUserMedia&&(s.getUserMedia=(function(o,a,u){s.mediaDevices.getUserMedia(o).then(a,u)}).bind(s))}function yc(i){return i&&i.video!==void 0?Object.assign({},i,{video:ju(i.video)}):i}function _c(i){if(!i.RTCPeerConnection)return;const s=i.RTCPeerConnection;i.RTCPeerConnection=function(o,a){if(o&&o.iceServers){const u=[];for(let p=0;pp.receiver.track.kind==="audio");o.offerToReceiveAudio===!1&&a?a.direction==="sendrecv"?a.setDirection?a.setDirection("sendonly"):a.direction="sendonly":a.direction==="recvonly"&&(a.setDirection?a.setDirection("inactive"):a.direction="inactive"):o.offerToReceiveAudio===!0&&!a&&this.addTransceiver("audio",{direction:"recvonly"}),typeof o.offerToReceiveVideo<"u"&&(o.offerToReceiveVideo=!!o.offerToReceiveVideo);const u=this.getTransceivers().find(p=>p.receiver.track.kind==="video");o.offerToReceiveVideo===!1&&u?u.direction==="sendrecv"?u.setDirection?u.setDirection("sendonly"):u.direction="sendonly":u.direction==="recvonly"&&(u.setDirection?u.setDirection("inactive"):u.direction="inactive"):o.offerToReceiveVideo===!0&&!u&&this.addTransceiver("video",{direction:"recvonly"})}return s.apply(this,arguments)}}function bc(i){typeof i!="object"||i.AudioContext||(i.AudioContext=i.webkitAudioContext)}const wu=Object.freeze(Object.defineProperty({__proto__:null,shimAudioContext:bc,shimCallbacksAPI:mc,shimConstraints:yc,shimCreateOfferLegacy:Cc,shimGetUserMedia:vc,shimLocalStreamsAPI:hc,shimRTCIceServerUrls:_c,shimRemoteStreamsAPI:gc,shimTrackEventTransceiver:Sc},Symbol.toStringTag,{value:"Module"}));var Tc={exports:{}};(function(i){const s={};s.generateIdentifier=function(){return Math.random().toString(36).substring(2,12)},s.localCName=s.generateIdentifier(),s.splitLines=function(n){return n.trim().split("\n").map(o=>o.trim())},s.splitSections=function(n){return n.split("\nm=").map((a,u)=>(u>0?"m="+a:a).trim()+"\r\n")},s.getDescription=function(n){const o=s.splitSections(n);return o&&o[0]},s.getMediaSections=function(n){const o=s.splitSections(n);return o.shift(),o},s.matchPrefix=function(n,o){return s.splitLines(n).filter(a=>a.indexOf(o)===0)},s.parseCandidate=function(n){let o;n.indexOf("a=candidate:")===0?o=n.substring(12).split(" "):o=n.substring(10).split(" ");const a={foundation:o[0],component:{1:"rtp",2:"rtcp"}[o[1]]||o[1],protocol:o[2].toLowerCase(),priority:parseInt(o[3],10),ip:o[4],address:o[4],port:parseInt(o[5],10),type:o[7]};for(let u=8;u0?o[0].split("/")[1]:"sendrecv",uri:o[1],attributes:o.slice(2).join(" ")}},s.writeExtmap=function(n){return"a=extmap:"+(n.id||n.preferredId)+(n.direction&&n.direction!=="sendrecv"?"/"+n.direction:"")+" "+n.uri+(n.attributes?" "+n.attributes:"")+"\r\n"},s.parseFmtp=function(n){const o={};let a;const u=n.substring(n.indexOf(" ")+1).split(";");for(let p=0;p{n.parameters[p]!==void 0?u.push(p+"="+n.parameters[p]):u.push(p)}),o+="a=fmtp:"+a+" "+u.join(";")+"\r\n"}return o},s.parseRtcpFb=function(n){const o=n.substring(n.indexOf(" ")+1).split(" ");return{type:o.shift(),parameter:o.join(" ")}},s.writeRtcpFb=function(n){let o="",a=n.payloadType;return n.preferredPayloadType!==void 0&&(a=n.preferredPayloadType),n.rtcpFeedback&&n.rtcpFeedback.length&&n.rtcpFeedback.forEach(u=>{o+="a=rtcp-fb:"+a+" "+u.type+(u.parameter&&u.parameter.length?" "+u.parameter:"")+"\r\n"}),o},s.parseSsrcMedia=function(n){const o=n.indexOf(" "),a={ssrc:parseInt(n.substring(7,o),10)},u=n.indexOf(":",o);return u>-1?(a.attribute=n.substring(o+1,u),a.value=n.substring(u+1)):a.attribute=n.substring(o+1),a},s.parseSsrcGroup=function(n){const o=n.substring(13).split(" ");return{semantics:o.shift(),ssrcs:o.map(a=>parseInt(a,10))}},s.getMid=function(n){const o=s.matchPrefix(n,"a=mid:")[0];if(o)return o.substring(6)},s.parseFingerprint=function(n){const o=n.substring(14).split(" ");return{algorithm:o[0].toLowerCase(),value:o[1].toUpperCase()}},s.getDtlsParameters=function(n,o){return{role:"auto",fingerprints:s.matchPrefix(n+o,"a=fingerprint:").map(s.parseFingerprint)}},s.writeDtlsParameters=function(n,o){let a="a=setup:"+o+"\r\n";return n.fingerprints.forEach(u=>{a+="a=fingerprint:"+u.algorithm+" "+u.value+"\r\n"}),a},s.parseCryptoLine=function(n){const o=n.substring(9).split(" ");return{tag:parseInt(o[0],10),cryptoSuite:o[1],keyParams:o[2],sessionParams:o.slice(3)}},s.writeCryptoLine=function(n){return"a=crypto:"+n.tag+" "+n.cryptoSuite+" "+(typeof n.keyParams=="object"?s.writeCryptoKeyParams(n.keyParams):n.keyParams)+(n.sessionParams?" "+n.sessionParams.join(" "):"")+"\r\n"},s.parseCryptoKeyParams=function(n){if(n.indexOf("inline:")!==0)return null;const o=n.substring(7).split("|");return{keyMethod:"inline",keySalt:o[0],lifeTime:o[1],mkiValue:o[2]?o[2].split(":")[0]:void 0,mkiLength:o[2]?o[2].split(":")[1]:void 0}},s.writeCryptoKeyParams=function(n){return n.keyMethod+":"+n.keySalt+(n.lifeTime?"|"+n.lifeTime:"")+(n.mkiValue&&n.mkiLength?"|"+n.mkiValue+":"+n.mkiLength:"")},s.getCryptoParameters=function(n,o){return s.matchPrefix(n+o,"a=crypto:").map(s.parseCryptoLine)},s.getIceParameters=function(n,o){const a=s.matchPrefix(n+o,"a=ice-ufrag:")[0],u=s.matchPrefix(n+o,"a=ice-pwd:")[0];return a&&u?{usernameFragment:a.substring(12),password:u.substring(10)}:null},s.writeIceParameters=function(n){let o="a=ice-ufrag:"+n.usernameFragment+"\r\na=ice-pwd:"+n.password+"\r\n";return n.iceLite&&(o+="a=ice-lite\r\n"),o},s.parseRtpParameters=function(n){const o={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},u=s.splitLines(n)[0].split(" ");o.profile=u[2];for(let g=3;g{o.headerExtensions.push(s.parseExtmap(g))});const p=s.matchPrefix(n,"a=rtcp-fb:* ").map(s.parseRtcpFb);return o.codecs.forEach(g=>{p.forEach(T=>{g.rtcpFeedback.find(_=>_.type===T.type&&_.parameter===T.parameter)||g.rtcpFeedback.push(T)})}),o},s.writeRtpDescription=function(n,o){let a="";a+="m="+n+" ",a+=o.codecs.length>0?"9":"0",a+=" "+(o.profile||"UDP/TLS/RTP/SAVPF")+" ",a+=o.codecs.map(p=>p.preferredPayloadType!==void 0?p.preferredPayloadType:p.payloadType).join(" ")+"\r\n",a+="c=IN IP4 0.0.0.0\r\n",a+="a=rtcp:9 IN IP4 0.0.0.0\r\n",o.codecs.forEach(p=>{a+=s.writeRtpMap(p),a+=s.writeFmtp(p),a+=s.writeRtcpFb(p)});let u=0;return o.codecs.forEach(p=>{p.maxptime>u&&(u=p.maxptime)}),u>0&&(a+="a=maxptime:"+u+"\r\n"),o.headerExtensions&&o.headerExtensions.forEach(p=>{a+=s.writeExtmap(p)}),a},s.parseRtpEncodingParameters=function(n){const o=[],a=s.parseRtpParameters(n),u=a.fecMechanisms.indexOf("RED")!==-1,p=a.fecMechanisms.indexOf("ULPFEC")!==-1,g=s.matchPrefix(n,"a=ssrc:").map(H=>s.parseSsrcMedia(H)).filter(H=>H.attribute==="cname"),T=g.length>0&&g[0].ssrc;let l;const _=s.matchPrefix(n,"a=ssrc-group:FID").map(H=>H.substring(17).split(" ").map(j=>parseInt(j,10)));_.length>0&&_[0].length>1&&_[0][0]===T&&(l=_[0][1]),a.codecs.forEach(H=>{if(H.name.toUpperCase()==="RTX"&&H.parameters.apt){let z={ssrc:T,codecPayloadType:parseInt(H.parameters.apt,10)};T&&l&&(z.rtx={ssrc:l}),o.push(z),u&&(z=JSON.parse(JSON.stringify(z)),z.fec={ssrc:T,mechanism:p?"red+ulpfec":"red"},o.push(z))}}),o.length===0&&T&&o.push({ssrc:T});let D=s.matchPrefix(n,"b=");return D.length&&(D[0].indexOf("b=TIAS:")===0?D=parseInt(D[0].substring(7),10):D[0].indexOf("b=AS:")===0?D=parseInt(D[0].substring(5),10)*1e3*.95-50*40*8:D=void 0,o.forEach(H=>{H.maxBitrate=D})),o},s.parseRtcpParameters=function(n){const o={},a=s.matchPrefix(n,"a=ssrc:").map(g=>s.parseSsrcMedia(g)).filter(g=>g.attribute==="cname")[0];a&&(o.cname=a.value,o.ssrc=a.ssrc);const u=s.matchPrefix(n,"a=rtcp-rsize");o.reducedSize=u.length>0,o.compound=u.length===0;const p=s.matchPrefix(n,"a=rtcp-mux");return o.mux=p.length>0,o},s.writeRtcpParameters=function(n){let o="";return n.reducedSize&&(o+="a=rtcp-rsize\r\n"),n.mux&&(o+="a=rtcp-mux\r\n"),n.ssrc!==void 0&&n.cname&&(o+="a=ssrc:"+n.ssrc+" cname:"+n.cname+"\r\n"),o},s.parseMsid=function(n){let o;const a=s.matchPrefix(n,"a=msid:");if(a.length===1)return o=a[0].substring(7).split(" "),{stream:o[0],track:o[1]};const u=s.matchPrefix(n,"a=ssrc:").map(p=>s.parseSsrcMedia(p)).filter(p=>p.attribute==="msid");if(u.length>0)return o=u[0].value.split(" "),{stream:o[0],track:o[1]}},s.parseSctpDescription=function(n){const o=s.parseMLine(n),a=s.matchPrefix(n,"a=max-message-size:");let u;a.length>0&&(u=parseInt(a[0].substring(19),10)),isNaN(u)&&(u=65536);const p=s.matchPrefix(n,"a=sctp-port:");if(p.length>0)return{port:parseInt(p[0].substring(12),10),protocol:o.fmt,maxMessageSize:u};const g=s.matchPrefix(n,"a=sctpmap:");if(g.length>0){const T=g[0].substring(10).split(" ");return{port:parseInt(T[0],10),protocol:T[1],maxMessageSize:u}}},s.writeSctpDescription=function(n,o){let a=[];return n.protocol!=="DTLS/SCTP"?a=["m="+n.kind+" 9 "+n.protocol+" "+o.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+o.port+"\r\n"]:a=["m="+n.kind+" 9 "+n.protocol+" "+o.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+o.port+" "+o.protocol+" 65535\r\n"],o.maxMessageSize!==void 0&&a.push("a=max-message-size:"+o.maxMessageSize+"\r\n"),a.join("")},s.generateSessionId=function(){return Math.random().toString().substr(2,22)},s.writeSessionBoilerplate=function(n,o,a){let u;const p=o!==void 0?o:2;return n?u=n:u=s.generateSessionId(),"v=0\r\no="+(a||"thisisadapterortc")+" "+u+" "+p+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},s.getDirection=function(n,o){const a=s.splitLines(n);for(let u=0;u(n.candidate&&Object.defineProperty(n,"candidate",{value:new i.RTCIceCandidate(n.candidate),writable:"false"}),n))}function oi(i,s){if(!i.RTCPeerConnection)return;"sctp"in i.RTCPeerConnection.prototype||Object.defineProperty(i.RTCPeerConnection.prototype,"sctp",{get(){return typeof this._sctp>"u"?null:this._sctp}});const n=function(g){if(!g||!g.sdp)return!1;const T=Xn.splitSections(g.sdp);return T.shift(),T.some(l=>{const _=Xn.parseMLine(l);return _&&_.kind==="application"&&_.protocol.indexOf("SCTP")!==-1})},o=function(g){const T=g.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(T===null||T.length<2)return-1;const l=parseInt(T[1],10);return l!==l?-1:l},a=function(g){let T=65536;return s.browser==="firefox"&&(s.version<57?g===-1?T=16384:T=2147483637:s.version<60?T=s.version===57?65535:65536:T=2147483637),T},u=function(g,T){let l=65536;s.browser==="firefox"&&s.version===57&&(l=65535);const _=Xn.matchPrefix(g.sdp,"a=max-message-size:");return _.length>0?l=parseInt(_[0].substr(19),10):s.browser==="firefox"&&T!==-1&&(l=2147483637),l},p=i.RTCPeerConnection.prototype.setRemoteDescription;i.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,s.browser==="chrome"&&s.version>=76){const{sdpSemantics:T}=this.getConfiguration();T==="plan-b"&&Object.defineProperty(this,"sctp",{get(){return typeof this._sctp>"u"?null:this._sctp},enumerable:!0,configurable:!0})}if(n(arguments[0])){const T=o(arguments[0]),l=a(T),_=u(arguments[0],T);let D;l===0&&_===0?D=Number.POSITIVE_INFINITY:l===0||_===0?D=Math.max(l,_):D=Math.min(l,_);const H={};Object.defineProperty(H,"maxMessageSize",{get(){return D}}),this._sctp=H}return p.apply(this,arguments)}}function si(i){if(!(i.RTCPeerConnection&&"createDataChannel"in i.RTCPeerConnection.prototype))return;function s(o,a){const u=o.send;o.send=function(){const g=arguments[0],T=g.length||g.size||g.byteLength;if(o.readyState==="open"&&a.sctp&&T>a.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+a.sctp.maxMessageSize+" bytes)");return u.apply(o,arguments)}}const n=i.RTCPeerConnection.prototype.createDataChannel;i.RTCPeerConnection.prototype.createDataChannel=function(){const a=n.apply(this,arguments);return s(a,this),a},In(i,"datachannel",o=>(s(o.channel,o.target),o))}function Wo(i){if(!i.RTCPeerConnection||"connectionState"in i.RTCPeerConnection.prototype)return;const s=i.RTCPeerConnection.prototype;Object.defineProperty(s,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(s,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(n){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),n&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=n)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(n=>{const o=s[n];s[n]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=a=>{const u=a.target;if(u._lastConnectionState!==u.connectionState){u._lastConnectionState=u.connectionState;const p=new Event("connectionstatechange",a);u.dispatchEvent(p)}return a},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),o.apply(this,arguments)}})}function Bo(i,s){if(!i.RTCPeerConnection||s.browser==="chrome"&&s.version>=71||s.browser==="safari"&&s.version>=605)return;const n=i.RTCPeerConnection.prototype.setRemoteDescription;i.RTCPeerConnection.prototype.setRemoteDescription=function(a){if(a&&a.sdp&&a.sdp.indexOf("\na=extmap-allow-mixed")!==-1){const u=a.sdp.split("\n").filter(p=>p.trim()!=="a=extmap-allow-mixed").join("\n");i.RTCSessionDescription&&a instanceof i.RTCSessionDescription?arguments[0]=new i.RTCSessionDescription({type:a.type,sdp:u}):a.sdp=u}return n.apply(this,arguments)}}function ai(i,s){if(!(i.RTCPeerConnection&&i.RTCPeerConnection.prototype))return;const n=i.RTCPeerConnection.prototype.addIceCandidate;!n||n.length===0||(i.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?(s.browser==="chrome"&&s.version<78||s.browser==="firefox"&&s.version<68||s.browser==="safari")&&arguments[0]&&arguments[0].candidate===""?Promise.resolve():n.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function ui(i,s){if(!(i.RTCPeerConnection&&i.RTCPeerConnection.prototype))return;const n=i.RTCPeerConnection.prototype.setLocalDescription;!n||n.length===0||(i.RTCPeerConnection.prototype.setLocalDescription=function(){let a=arguments[0]||{};if(typeof a!="object"||a.type&&a.sdp)return n.apply(this,arguments);if(a={type:a.type,sdp:a.sdp},!a.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":a.type="offer";break;default:a.type="answer";break}return a.sdp||a.type!=="offer"&&a.type!=="answer"?n.apply(this,[a]):(a.type==="offer"?this.createOffer:this.createAnswer).apply(this).then(p=>n.apply(this,[p]))})}const Pv=Object.freeze(Object.defineProperty({__proto__:null,removeExtmapAllowMixed:Bo,shimAddIceCandidateNullOrEmpty:ai,shimConnectionState:Wo,shimMaxMessageSize:oi,shimParameterlessSetLocalDescription:ui,shimRTCIceCandidate:ii,shimSendThrowTypeError:si},Symbol.toStringTag,{value:"Module"}));function wv({window:i}={},s={shimChrome:!0,shimFirefox:!0,shimSafari:!0}){const n=$u,o=bv(i),a={browserDetails:o,commonShim:Pv,extractVersion:ri,disableLog:Sv,disableWarnings:Cv,sdp:xv};switch(o.browser){case"chrome":if(!xu||!No||!s.shimChrome)return n("Chrome shim is not included in this adapter release."),a;if(o.version===null)return n("Chrome shim can not determine version, not shimming."),a;n("adapter.js shimming chrome."),a.browserShim=xu,ai(i,o),ui(i),Ku(i,o),Yu(i),No(i,o),Zu(i),nc(i,o),Xu(i),Qu(i),ec(i),rc(i,o),ii(i),Wo(i),oi(i,o),si(i),Bo(i,o);break;case"firefox":if(!Pu||!Go||!s.shimFirefox)return n("Firefox shim is not included in this adapter release."),a;n("adapter.js shimming firefox."),a.browserShim=Pu,ai(i,o),ui(i),ic(i,o),Go(i,o),oc(i),uc(i),sc(i),ac(i),cc(i),fc(i),lc(i),dc(i),pc(i),ii(i),Wo(i),oi(i,o),si(i);break;case"safari":if(!wu||!s.shimSafari)return n("Safari shim is not included in this adapter release."),a;n("adapter.js shimming safari."),a.browserShim=wu,ai(i,o),ui(i),_c(i),Cc(i),mc(i),hc(i),gc(i),Sc(i),vc(i),bc(i),ii(i),oi(i,o),si(i),Bo(i,o);break;default:n("Unsupported browser!");break}return a}const Eu=wv({window:typeof window>"u"?void 0:window});function Mt(i){return typeof i=="function"}function xc(i){var s=function(o){Error.call(o),o.stack=new Error().stack},n=i(s);return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var Do=xc(function(i){return function(n){i(this),this.message=n?n.length+" errors occurred during unsubscription:\n"+n.map(function(o,a){return a+1+") "+o.toString()}).join("\n "):"",this.name="UnsubscriptionError",this.errors=n}});function Ho(i,s){if(i){var n=i.indexOf(s);0<=n&&i.splice(n,1)}}var hi=function(){function i(s){this.initialTeardown=s,this.closed=!1,this._parentage=null,this._finalizers=null}return i.prototype.unsubscribe=function(){var s,n,o,a,u;if(!this.closed){this.closed=!0;var p=this._parentage;if(p)if(this._parentage=null,Array.isArray(p))try{for(var g=Uo(p),T=g.next();!T.done;T=g.next()){var l=T.value;l.remove(this)}}catch(ee){s={error:ee}}finally{try{T&&!T.done&&(n=g.return)&&n.call(g)}finally{if(s)throw s.error}}else p.remove(this);var _=this.initialTeardown;if(Mt(_))try{_()}catch(ee){u=ee instanceof Do?ee.errors:[ee]}var D=this._finalizers;if(D){this._finalizers=null;try{for(var H=Uo(D),z=H.next();!z.done;z=H.next()){var j=z.value;try{Ou(j)}catch(ee){u=u!=null?u:[],ee instanceof Do?u=fi(fi([],li(u)),li(ee.errors)):u.push(ee)}}}catch(ee){o={error:ee}}finally{try{z&&!z.done&&(a=H.return)&&a.call(H)}finally{if(o)throw o.error}}}if(u)throw new Do(u)}},i.prototype.add=function(s){var n;if(s&&s!==this)if(this.closed)Ou(s);else{if(s instanceof i){if(s.closed||s._hasParent(this))return;s._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(s)}},i.prototype._hasParent=function(s){var n=this._parentage;return n===s||Array.isArray(n)&&n.includes(s)},i.prototype._addParent=function(s){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(s),n):n?[n,s]:s},i.prototype._removeParent=function(s){var n=this._parentage;n===s?this._parentage=null:Array.isArray(n)&&Ho(n,s)},i.prototype.remove=function(s){var n=this._finalizers;n&&Ho(n,s),s instanceof i&&s._removeParent(this)},i.EMPTY=function(){var s=new i;return s.closed=!0,s}(),i}(),Pc=hi.EMPTY;function wc(i){return i instanceof hi||i&&"closed"in i&&Mt(i.remove)&&Mt(i.add)&&Mt(i.unsubscribe)}function Ou(i){Mt(i)?i():i.unsubscribe()}var Ec={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},qo={setTimeout:function(i,s){for(var n=[],o=2;o0},enumerable:!1,configurable:!0}),s.prototype._trySubscribe=function(n){return this._throwIfClosed(),i.prototype._trySubscribe.call(this,n)},s.prototype._subscribe=function(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)},s.prototype._innerSubscribe=function(n){var o=this,a=this,u=a.hasError,p=a.isStopped,g=a.observers;return u||p?Pc:(this.currentObservers=null,g.push(n),new hi(function(){o.currentObservers=null,Ho(g,n)}))},s.prototype._checkFinalizedStatuses=function(n){var o=this,a=o.hasError,u=o.thrownError,p=o.isStopped;a?n.error(u):p&&n.complete()},s.prototype.asObservable=function(){var n=new Iu;return n.source=this,n},s.create=function(n,o){return new Mu(n,o)},s}(Iu),Mu=function(i){er(s,i);function s(n,o){var a=i.call(this)||this;return a.destination=n,a.source=o,a}return s.prototype.next=function(n){var o,a;(a=(o=this.destination)===null||o===void 0?void 0:o.next)===null||a===void 0||a.call(o,n)},s.prototype.error=function(n){var o,a;(a=(o=this.destination)===null||o===void 0?void 0:o.error)===null||a===void 0||a.call(o,n)},s.prototype.complete=function(){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.complete)===null||o===void 0||o.call(n)},s.prototype._subscribe=function(n){var o,a;return(a=(o=this.source)===null||o===void 0?void 0:o.subscribe(n))!==null&&a!==void 0?a:Pc},s}(cn),Ct=function(i){er(s,i);function s(n){var o=i.call(this)||this;return o._value=n,o}return Object.defineProperty(s.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),s.prototype._subscribe=function(n){var o=i.prototype._subscribe.call(this,n);return!o.closed&&n.next(this._value),o},s.prototype.getValue=function(){var n=this,o=n.hasError,a=n.thrownError,u=n._value;if(o)throw a;return this._throwIfClosed(),u},s.prototype.next=function(n){i.prototype.next.call(this,this._value=n)},s}(cn),di={exports:{}};/** * @license * Lodash * Copyright OpenJS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */di.exports;(function(i,s){(function(){var n,o="4.17.21",a=200,u="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",p="Expected a function",g="Invalid `variable` option passed into `_.template`",T="__lodash_hash_undefined__",l=500,_="__lodash_placeholder__",D=1,H=2,z=4,j=1,ee=2,xe=1,Ye=2,_e=4,$=8,X=16,Oe=32,Ze=64,me=128,mt=256,Zt=512,nr=30,dn="...",gi=800,mi=16,rr=1,ir=2,or=3,at=1/0,ut=9007199254740991,sr=17976931348623157e292,Lt=0/0,Xe=4294967295,pn=Xe-1,ar=Xe>>>1,vi=[["ary",me],["bind",xe],["bindKey",Ye],["curry",$],["curryRight",X],["flip",Zt],["partial",Oe],["partialRight",Ze],["rearg",mt]],kt="[object Arguments]",hn="[object Array]",ur="[object AsyncFunction]",bt="[object Boolean]",Ut="[object Date]",cr="[object DOMException]",ct="[object Error]",Tt="[object Function]",ft="[object GeneratorFunction]",Ne="[object Map]",Ft="[object Number]",fr="[object Null]",qe="[object Object]",lr="[object Promise]",v="[object Proxy]",C="[object RegExp]",b="[object Set]",y="[object String]",O="[object Symbol]",I="[object Undefined]",w="[object WeakMap]",W="[object WeakSet]",F="[object ArrayBuffer]",x="[object DataView]",A="[object Float32Array]",B="[object Float64Array]",re="[object Int8Array]",fe="[object Int16Array]",lt="[object Int32Array]",N="[object Uint8Array]",ne="[object Uint8ClampedArray]",be="[object Uint16Array]",vt="[object Uint32Array]",yi=/\b__p \+= '';/g,Ac=/\b(__p \+=) '' \+/g,Ic=/(__e\(.*?\)|\b__t\)) \+\n'';/g,$o=/&(?:amp|lt|gt|quot|#39);/g,jo=/[&<>"']/g,Dc=RegExp($o.source),Mc=RegExp(jo.source),Lc=/<%-([\s\S]+?)%>/g,kc=/<%([\s\S]+?)%>/g,Ko=/<%=([\s\S]+?)%>/g,Uc=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Fc=/^\w*$/,Nc=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,_i=/[\\^$.*+?()[\]{}|]/g,Gc=RegExp(_i.source),Si=/^\s+/,Wc=/\s/,Bc=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Hc=/\{\n\/\* \[wrapped with (.+)\] \*/,qc=/,? & /,Jc=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,zc=/[()=,{}\[\]\/\s]/,Vc=/\\(\\)?/g,$c=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Yo=/\w*$/,jc=/^[-+]0x[0-9a-f]+$/i,Kc=/^0b[01]+$/i,Yc=/^\[object .+?Constructor\]$/,Zc=/^0o[0-7]+$/i,Xc=/^(?:0|[1-9]\d*)$/,Qc=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,dr=/($^)/,ef=/['\n\r\u2028\u2029\\]/g,pr="\\ud800-\\udfff",tf="\\u0300-\\u036f",nf="\\ufe20-\\ufe2f",rf="\\u20d0-\\u20ff",Zo=tf+nf+rf,Xo="\\u2700-\\u27bf",Qo="a-z\\xdf-\\xf6\\xf8-\\xff",of="\\xac\\xb1\\xd7\\xf7",sf="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",af="\\u2000-\\u206f",uf=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",es="A-Z\\xc0-\\xd6\\xd8-\\xde",ts="\\ufe0e\\ufe0f",ns=of+sf+af+uf,Ci="['’]",cf="["+pr+"]",rs="["+ns+"]",hr="["+Zo+"]",is="\\d+",ff="["+Xo+"]",os="["+Qo+"]",ss="[^"+pr+ns+is+Xo+Qo+es+"]",bi="\\ud83c[\\udffb-\\udfff]",lf="(?:"+hr+"|"+bi+")",as="[^"+pr+"]",Ti="(?:\\ud83c[\\udde6-\\uddff]){2}",Ri="[\\ud800-\\udbff][\\udc00-\\udfff]",gn="["+es+"]",us="\\u200d",cs="(?:"+os+"|"+ss+")",df="(?:"+gn+"|"+ss+")",fs="(?:"+Ci+"(?:d|ll|m|re|s|t|ve))?",ls="(?:"+Ci+"(?:D|LL|M|RE|S|T|VE))?",ds=lf+"?",ps="["+ts+"]?",pf="(?:"+us+"(?:"+[as,Ti,Ri].join("|")+")"+ps+ds+")*",hf="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",gf="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",hs=ps+ds+pf,mf="(?:"+[ff,Ti,Ri].join("|")+")"+hs,vf="(?:"+[as+hr+"?",hr,Ti,Ri,cf].join("|")+")",yf=RegExp(Ci,"g"),_f=RegExp(hr,"g"),xi=RegExp(bi+"(?="+bi+")|"+vf+hs,"g"),Sf=RegExp([gn+"?"+os+"+"+fs+"(?="+[rs,gn,"$"].join("|")+")",df+"+"+ls+"(?="+[rs,gn+cs,"$"].join("|")+")",gn+"?"+cs+"+"+fs,gn+"+"+ls,gf,hf,is,mf].join("|"),"g"),Cf=RegExp("["+us+pr+Zo+ts+"]"),bf=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Tf=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Rf=-1,ve={};ve[A]=ve[B]=ve[re]=ve[fe]=ve[lt]=ve[N]=ve[ne]=ve[be]=ve[vt]=!0,ve[kt]=ve[hn]=ve[F]=ve[bt]=ve[x]=ve[Ut]=ve[ct]=ve[Tt]=ve[Ne]=ve[Ft]=ve[qe]=ve[C]=ve[b]=ve[y]=ve[w]=!1;var ge={};ge[kt]=ge[hn]=ge[F]=ge[x]=ge[bt]=ge[Ut]=ge[A]=ge[B]=ge[re]=ge[fe]=ge[lt]=ge[Ne]=ge[Ft]=ge[qe]=ge[C]=ge[b]=ge[y]=ge[O]=ge[N]=ge[ne]=ge[be]=ge[vt]=!0,ge[ct]=ge[Tt]=ge[w]=!1;var xf={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},Pf={"&":"&","<":"<",">":">",'"':""","'":"'"},wf={"&":"&","<":"<",">":">",""":'"',"'":"'"},Ef={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Of=parseFloat,Af=parseInt,gs=typeof Kn=="object"&&Kn&&Kn.Object===Object&&Kn,If=typeof self=="object"&&self&&self.Object===Object&&self,Ae=gs||If||Function("return this")(),Pi=s&&!s.nodeType&&s,Xt=Pi&&!0&&i&&!i.nodeType&&i,ms=Xt&&Xt.exports===Pi,wi=ms&&gs.process,Qe=function(){try{var P=Xt&&Xt.require&&Xt.require("util").types;return P||wi&&wi.binding&&wi.binding("util")}catch{}}(),vs=Qe&&Qe.isArrayBuffer,ys=Qe&&Qe.isDate,_s=Qe&&Qe.isMap,Ss=Qe&&Qe.isRegExp,Cs=Qe&&Qe.isSet,bs=Qe&&Qe.isTypedArray;function Je(P,L,M){switch(M.length){case 0:return P.call(L);case 1:return P.call(L,M[0]);case 2:return P.call(L,M[0],M[1]);case 3:return P.call(L,M[0],M[1],M[2])}return P.apply(L,M)}function Df(P,L,M,J){for(var Q=-1,le=P==null?0:P.length;++Q-1}function Ei(P,L,M){for(var J=-1,Q=P==null?0:P.length;++J-1;);return M}function As(P,L){for(var M=P.length;M--&&mn(L,P[M],0)>-1;);return M}function Bf(P,L){for(var M=P.length,J=0;M--;)P[M]===L&&++J;return J}var Hf=Di(xf),qf=Di(Pf);function Jf(P){return"\\"+Ef[P]}function zf(P,L){return P==null?n:P[L]}function vn(P){return Cf.test(P)}function Vf(P){return bf.test(P)}function $f(P){for(var L,M=[];!(L=P.next()).done;)M.push(L.value);return M}function Ui(P){var L=-1,M=Array(P.size);return P.forEach(function(J,Q){M[++L]=[Q,J]}),M}function Is(P,L){return function(M){return P(L(M))}}function Wt(P,L){for(var M=-1,J=P.length,Q=0,le=[];++M-1}function Ll(e,t){var r=this.__data__,c=Dr(r,e);return c<0?(++this.size,r.push([e,t])):r[c][1]=t,this}Rt.prototype.clear=Al,Rt.prototype.delete=Il,Rt.prototype.get=Dl,Rt.prototype.has=Ml,Rt.prototype.set=Ll;function xt(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t=t?e:t)),e}function rt(e,t,r,c,d,m){var S,R=t&D,E=t&H,k=t&z;if(r&&(S=d?r(e,c,d,m):r(e)),S!==n)return S;if(!Se(e))return e;var U=te(e);if(U){if(S=Nd(e),!R)return Ge(e,S)}else{var G=Me(e),q=G==Tt||G==ft;if(Vt(e))return pa(e,R);if(G==qe||G==kt||q&&!d){if(S=E||q?{}:Da(e),!R)return E?wd(e,Yl(S,e)):Pd(e,qs(S,e))}else{if(!ge[G])return d?e:{};S=Gd(e,G,R)}}m||(m=new pt);var V=m.get(e);if(V)return V;m.set(e,S),au(e)?e.forEach(function(Z){S.add(rt(Z,t,r,Z,e,m))}):ou(e)&&e.forEach(function(Z,ae){S.set(ae,rt(Z,t,r,ae,e,m))});var Y=k?E?uo:ao:E?Be:Ee,oe=U?n:Y(e);return et(oe||e,function(Z,ae){oe&&(ae=Z,Z=e[ae]),Wn(S,ae,rt(Z,t,r,ae,e,m))}),S}function Zl(e){var t=Ee(e);return function(r){return Js(r,e,t)}}function Js(e,t,r){var c=r.length;if(e==null)return!c;for(e=he(e);c--;){var d=r[c],m=t[d],S=e[d];if(S===n&&!(d in e)||!m(S))return!1}return!0}function zs(e,t,r){if(typeof e!="function")throw new tt(p);return $n(function(){e.apply(n,r)},t)}function Bn(e,t,r,c){var d=-1,m=gr,S=!0,R=e.length,E=[],k=t.length;if(!R)return E;r&&(t=ye(t,ze(r))),c?(m=Ei,S=!1):t.length>=a&&(m=Ln,S=!1,t=new tn(t));e:for(;++dd?0:d+r),c=c===n||c>d?d:ie(c),c<0&&(c+=d),c=r>c?0:cu(c);r0&&r(R)?t>1?Ie(R,t-1,r,c,d):Gt(d,R):c||(d[d.length]=R)}return d}var qi=_a(),js=_a(!0);function yt(e,t){return e&&qi(e,t,Ee)}function Ji(e,t){return e&&js(e,t,Ee)}function Lr(e,t){return Nt(t,function(r){return At(e[r])})}function rn(e,t){t=Jt(t,e);for(var r=0,c=t.length;e!=null&&rt}function ed(e,t){return e!=null&&pe.call(e,t)}function td(e,t){return e!=null&&t in he(e)}function nd(e,t,r){return e>=De(t,r)&&e=120&&U.length>=120)?new tn(S&&U):n}U=e[0];var G=-1,q=R[0];e:for(;++G-1;)R!==e&&xr.call(R,E,1),xr.call(e,E,1);return e}function oa(e,t){for(var r=e?t.length:0,c=r-1;r--;){var d=t[r];if(r==c||d!==m){var m=d;Ot(d)?xr.call(e,d,1):eo(e,d)}}return e}function Zi(e,t){return e+Er(Gs()*(t-e+1))}function gd(e,t,r,c){for(var d=-1,m=we(wr((t-e)/(r||1)),0),S=M(m);m--;)S[c?m:++d]=e,e+=r;return S}function Xi(e,t){var r="";if(!e||t<1||t>ut)return r;do t%2&&(r+=e),t=Er(t/2),t&&(e+=e);while(t);return r}function se(e,t){return mo(ka(e,t,He),e+"")}function md(e){return Hs(En(e))}function vd(e,t){var r=En(e);return zr(r,nn(t,0,r.length))}function Jn(e,t,r,c){if(!Se(e))return e;t=Jt(t,e);for(var d=-1,m=t.length,S=m-1,R=e;R!=null&&++dd?0:d+t),r=r>d?d:r,r<0&&(r+=d),d=t>r?0:r-t>>>0,t>>>=0;for(var m=M(d);++c>>1,S=e[m];S!==null&&!$e(S)&&(r?S<=t:S=a){var k=t?null:Id(e);if(k)return vr(k);S=!1,d=Ln,E=new tn}else E=t?[]:R;e:for(;++c=c?e:it(e,t,r)}var da=ul||function(e){return Ae.clearTimeout(e)};function pa(e,t){if(t)return e.slice();var r=e.length,c=Ls?Ls(r):new e.constructor(r);return e.copy(c),c}function io(e){var t=new e.constructor(e.byteLength);return new Tr(t).set(new Tr(e)),t}function bd(e,t){var r=t?io(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}function Td(e){var t=new e.constructor(e.source,Yo.exec(e));return t.lastIndex=e.lastIndex,t}function Rd(e){return Gn?he(Gn.call(e)):{}}function ha(e,t){var r=t?io(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function ga(e,t){if(e!==t){var r=e!==n,c=e===null,d=e===e,m=$e(e),S=t!==n,R=t===null,E=t===t,k=$e(t);if(!R&&!k&&!m&&e>t||m&&S&&E&&!R&&!k||c&&S&&E||!r&&E||!d)return 1;if(!c&&!m&&!k&&e=R)return E;var k=r[c];return E*(k=="desc"?-1:1)}}return e.index-t.index}function ma(e,t,r,c){for(var d=-1,m=e.length,S=r.length,R=-1,E=t.length,k=we(m-S,0),U=M(E+k),G=!c;++R1?r[d-1]:n,S=d>2?r[2]:n;for(m=e.length>3&&typeof m=="function"?(d--,m):n,S&&ke(r[0],r[1],S)&&(m=d<3?n:m,d=1),t=he(t);++c-1?d[m?t[S]:S]:n}}function ba(e){return Et(function(t){var r=t.length,c=r,d=nt.prototype.thru;for(e&&t.reverse();c--;){var m=t[c];if(typeof m!="function")throw new tt(p);if(d&&!S&&qr(m)=="wrapper")var S=new nt([],!0)}for(c=S?c:r;++c1&&ce.reverse(),U&&ER))return!1;var k=m.get(e),U=m.get(t);if(k&&U)return k==t&&U==e;var G=-1,q=!0,V=r&ee?new tn:n;for(m.set(e,t),m.set(t,e);++G1?"& ":"")+t[c],t=t.join(r>2?", ":" "),e.replace(Bc,"{\n/* [wrapped with "+t+"] */\n")}function Bd(e){return te(e)||an(e)||!!(Fs&&e&&e[Fs])}function Ot(e,t){var r=typeof e;return t=t==null?ut:t,!!t&&(r=="number"||r!="symbol"&&Xc.test(e))&&e>-1&&e%1==0&&e0){if(++t>=gi)return arguments[0]}else t=0;return e.apply(n,arguments)}}function zr(e,t){var r=-1,c=e.length,d=c-1;for(t=t===n?c:t;++r1?e[t-1]:n;return r=typeof r=="function"?(e.pop(),r):n,$a(e,r)});function ja(e){var t=h(e);return t.__chain__=!0,t}function Xp(e,t){return t(e),e}function Vr(e,t){return t(e)}var Qp=Et(function(e){var t=e.length,r=t?e[0]:0,c=this.__wrapped__,d=function(m){return Hi(m,e)};return t>1||this.__actions__.length||!(c instanceof ue)||!Ot(r)?this.thru(d):(c=c.slice(r,+r+(t?1:0)),c.__actions__.push({func:Vr,args:[d],thisArg:n}),new nt(c,this.__chain__).thru(function(m){return t&&!m.length&&m.push(n),m}))});function eh(){return ja(this)}function th(){return new nt(this.value(),this.__chain__)}function nh(){this.__values__===n&&(this.__values__=uu(this.value()));var e=this.__index__>=this.__values__.length,t=e?n:this.__values__[this.__index__++];return{done:e,value:t}}function rh(){return this}function ih(e){for(var t,r=this;r instanceof Ir;){var c=Ba(r);c.__index__=0,c.__values__=n,t?d.__wrapped__=c:t=c;var d=c;r=r.__wrapped__}return d.__wrapped__=e,t}function oh(){var e=this.__wrapped__;if(e instanceof ue){var t=e;return this.__actions__.length&&(t=new ue(this)),t=t.reverse(),t.__actions__.push({func:Vr,args:[vo],thisArg:n}),new nt(t,this.__chain__)}return this.thru(vo)}function sh(){return fa(this.__wrapped__,this.__actions__)}var ah=Nr(function(e,t,r){pe.call(e,r)?++e[r]:Pt(e,r,1)});function uh(e,t,r){var c=te(e)?Ts:Xl;return r&&ke(e,t,r)&&(t=n),c(e,K(t,3))}function ch(e,t){var r=te(e)?Nt:$s;return r(e,K(t,3))}var fh=Ca(Ha),lh=Ca(qa);function dh(e,t){return Ie($r(e,t),1)}function ph(e,t){return Ie($r(e,t),at)}function hh(e,t,r){return r=r===n?1:ie(r),Ie($r(e,t),r)}function Ka(e,t){var r=te(e)?et:Ht;return r(e,K(t,3))}function Ya(e,t){var r=te(e)?Mf:Vs;return r(e,K(t,3))}var gh=Nr(function(e,t,r){pe.call(e,r)?e[r].push(t):Pt(e,r,[t])});function mh(e,t,r,c){e=We(e)?e:En(e),r=r&&!c?ie(r):0;var d=e.length;return r<0&&(r=we(d+r,0)),Xr(e)?r<=d&&e.indexOf(t,r)>-1:!!d&&mn(e,t,r)>-1}var vh=se(function(e,t,r){var c=-1,d=typeof t=="function",m=We(e)?M(e.length):[];return Ht(e,function(S){m[++c]=d?Je(t,S,r):Hn(S,t,r)}),m}),yh=Nr(function(e,t,r){Pt(e,r,t)});function $r(e,t){var r=te(e)?ye:Qs;return r(e,K(t,3))}function _h(e,t,r,c){return e==null?[]:(te(t)||(t=t==null?[]:[t]),r=c?n:r,te(r)||(r=r==null?[]:[r]),ra(e,t,r))}var Sh=Nr(function(e,t,r){e[r?0:1].push(t)},function(){return[[],[]]});function Ch(e,t,r){var c=te(e)?Oi:ws,d=arguments.length<3;return c(e,K(t,4),r,d,Ht)}function bh(e,t,r){var c=te(e)?Lf:ws,d=arguments.length<3;return c(e,K(t,4),r,d,Vs)}function Th(e,t){var r=te(e)?Nt:$s;return r(e,Yr(K(t,3)))}function Rh(e){var t=te(e)?Hs:md;return t(e)}function xh(e,t,r){(r?ke(e,t,r):t===n)?t=1:t=ie(t);var c=te(e)?$l:vd;return c(e,t)}function Ph(e){var t=te(e)?jl:_d;return t(e)}function wh(e){if(e==null)return 0;if(We(e))return Xr(e)?yn(e):e.length;var t=Me(e);return t==Ne||t==b?e.size:ji(e).length}function Eh(e,t,r){var c=te(e)?Ai:Sd;return r&&ke(e,t,r)&&(t=n),c(e,K(t,3))}var Oh=se(function(e,t){if(e==null)return[];var r=t.length;return r>1&&ke(e,t[0],t[1])?t=[]:r>2&&ke(t[0],t[1],t[2])&&(t=[t[0]]),ra(e,Ie(t,1),[])}),jr=cl||function(){return Ae.Date.now()};function Ah(e,t){if(typeof t!="function")throw new tt(p);return e=ie(e),function(){if(--e<1)return t.apply(this,arguments)}}function Za(e,t,r){return t=r?n:t,t=e&&t==null?e.length:t,wt(e,me,n,n,n,n,t)}function Xa(e,t){var r;if(typeof t!="function")throw new tt(p);return e=ie(e),function(){return--e>0&&(r=t.apply(this,arguments)),e<=1&&(t=n),r}}var _o=se(function(e,t,r){var c=xe;if(r.length){var d=Wt(r,Pn(_o));c|=Oe}return wt(e,c,t,r,d)}),Qa=se(function(e,t,r){var c=xe|Ye;if(r.length){var d=Wt(r,Pn(Qa));c|=Oe}return wt(t,c,e,r,d)});function eu(e,t,r){t=r?n:t;var c=wt(e,$,n,n,n,n,n,t);return c.placeholder=eu.placeholder,c}function tu(e,t,r){t=r?n:t;var c=wt(e,X,n,n,n,n,n,t);return c.placeholder=tu.placeholder,c}function nu(e,t,r){var c,d,m,S,R,E,k=0,U=!1,G=!1,q=!0;if(typeof e!="function")throw new tt(p);t=st(t)||0,Se(r)&&(U=!!r.leading,G="maxWait"in r,m=G?we(st(r.maxWait)||0,t):m,q="trailing"in r?!!r.trailing:q);function V(Re){var gt=c,Dt=d;return c=d=n,k=Re,S=e.apply(Dt,gt),S}function Y(Re){return k=Re,R=$n(ae,t),U?V(Re):S}function oe(Re){var gt=Re-E,Dt=Re-k,Cu=t-gt;return G?De(Cu,m-Dt):Cu}function Z(Re){var gt=Re-E,Dt=Re-k;return E===n||gt>=t||gt<0||G&&Dt>=m}function ae(){var Re=jr();if(Z(Re))return ce(Re);R=$n(ae,oe(Re))}function ce(Re){return R=n,q&&c?V(Re):(c=d=n,S)}function je(){R!==n&&da(R),k=0,c=E=d=R=n}function Ue(){return R===n?S:ce(jr())}function Ke(){var Re=jr(),gt=Z(Re);if(c=arguments,d=this,E=Re,gt){if(R===n)return Y(E);if(G)return da(R),R=$n(ae,t),V(E)}return R===n&&(R=$n(ae,t)),S}return Ke.cancel=je,Ke.flush=Ue,Ke}var Ih=se(function(e,t){return zs(e,1,t)}),Dh=se(function(e,t,r){return zs(e,st(t)||0,r)});function Mh(e){return wt(e,Zt)}function Kr(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new tt(p);var r=function(){var c=arguments,d=t?t.apply(this,c):c[0],m=r.cache;if(m.has(d))return m.get(d);var S=e.apply(this,c);return r.cache=m.set(d,S)||m,S};return r.cache=new(Kr.Cache||xt),r}Kr.Cache=xt;function Yr(e){if(typeof e!="function")throw new tt(p);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}function Lh(e){return Xa(2,e)}var kh=Cd(function(e,t){t=t.length==1&&te(t[0])?ye(t[0],ze(K())):ye(Ie(t,1),ze(K()));var r=t.length;return se(function(c){for(var d=-1,m=De(c.length,r);++d=t}),an=Ys(function(){return arguments}())?Ys:function(e){return Ce(e)&&pe.call(e,"callee")&&!Us.call(e,"callee")},te=M.isArray,Yh=vs?ze(vs):id;function We(e){return e!=null&&Zr(e.length)&&!At(e)}function Te(e){return Ce(e)&&We(e)}function Zh(e){return e===!0||e===!1||Ce(e)&&Le(e)==bt}var Vt=ll||Io,Xh=ys?ze(ys):od;function Qh(e){return Ce(e)&&e.nodeType===1&&!jn(e)}function eg(e){if(e==null)return!0;if(We(e)&&(te(e)||typeof e=="string"||typeof e.splice=="function"||Vt(e)||wn(e)||an(e)))return!e.length;var t=Me(e);if(t==Ne||t==b)return!e.size;if(Vn(e))return!ji(e).length;for(var r in e)if(pe.call(e,r))return!1;return!0}function tg(e,t){return qn(e,t)}function ng(e,t,r){r=typeof r=="function"?r:n;var c=r?r(e,t):n;return c===n?qn(e,t,n,r):!!c}function Co(e){if(!Ce(e))return!1;var t=Le(e);return t==ct||t==cr||typeof e.message=="string"&&typeof e.name=="string"&&!jn(e)}function rg(e){return typeof e=="number"&&Ns(e)}function At(e){if(!Se(e))return!1;var t=Le(e);return t==Tt||t==ft||t==ur||t==v}function iu(e){return typeof e=="number"&&e==ie(e)}function Zr(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=ut}function Se(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function Ce(e){return e!=null&&typeof e=="object"}var ou=_s?ze(_s):ad;function ig(e,t){return e===t||$i(e,t,fo(t))}function og(e,t,r){return r=typeof r=="function"?r:n,$i(e,t,fo(t),r)}function sg(e){return su(e)&&e!=+e}function ag(e){if(Jd(e))throw new Q(u);return Zs(e)}function ug(e){return e===null}function cg(e){return e==null}function su(e){return typeof e=="number"||Ce(e)&&Le(e)==Ft}function jn(e){if(!Ce(e)||Le(e)!=qe)return!1;var t=Rr(e);if(t===null)return!0;var r=pe.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&Sr.call(r)==ol}var bo=Ss?ze(Ss):ud;function fg(e){return iu(e)&&e>=-ut&&e<=ut}var au=Cs?ze(Cs):cd;function Xr(e){return typeof e=="string"||!te(e)&&Ce(e)&&Le(e)==y}function $e(e){return typeof e=="symbol"||Ce(e)&&Le(e)==O}var wn=bs?ze(bs):fd;function lg(e){return e===n}function dg(e){return Ce(e)&&Me(e)==w}function pg(e){return Ce(e)&&Le(e)==W}var hg=Hr(Ki),gg=Hr(function(e,t){return e<=t});function uu(e){if(!e)return[];if(We(e))return Xr(e)?dt(e):Ge(e);if(kn&&e[kn])return $f(e[kn]());var t=Me(e),r=t==Ne?Ui:t==b?vr:En;return r(e)}function It(e){if(!e)return e===0?e:0;if(e=st(e),e===at||e===-at){var t=e<0?-1:1;return t*sr}return e===e?e:0}function ie(e){var t=It(e),r=t%1;return t===t?r?t-r:t:0}function cu(e){return e?nn(ie(e),0,Xe):0}function st(e){if(typeof e=="number")return e;if($e(e))return Lt;if(Se(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Se(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Es(e);var r=Kc.test(e);return r||Zc.test(e)?Af(e.slice(2),r?2:8):jc.test(e)?Lt:+e}function fu(e){return _t(e,Be(e))}function mg(e){return e?nn(ie(e),-ut,ut):e===0?e:0}function de(e){return e==null?"":Ve(e)}var vg=Rn(function(e,t){if(Vn(t)||We(t)){_t(t,Ee(t),e);return}for(var r in t)pe.call(t,r)&&Wn(e,r,t[r])}),lu=Rn(function(e,t){_t(t,Be(t),e)}),Qr=Rn(function(e,t,r,c){_t(t,Be(t),e,c)}),yg=Rn(function(e,t,r,c){_t(t,Ee(t),e,c)}),_g=Et(Hi);function Sg(e,t){var r=Tn(e);return t==null?r:qs(r,t)}var Cg=se(function(e,t){e=he(e);var r=-1,c=t.length,d=c>2?t[2]:n;for(d&&ke(t[0],t[1],d)&&(c=1);++r1),m}),_t(e,uo(e),r),c&&(r=rt(r,D|H|z,Dd));for(var d=t.length;d--;)eo(r,t[d]);return r});function Gg(e,t){return pu(e,Yr(K(t)))}var Wg=Et(function(e,t){return e==null?{}:pd(e,t)});function pu(e,t){if(e==null)return{};var r=ye(uo(e),function(c){return[c]});return t=K(t),ia(e,r,function(c,d){return t(c,d[0])})}function Bg(e,t,r){t=Jt(t,e);var c=-1,d=t.length;for(d||(d=1,e=n);++ct){var c=e;e=t,t=c}if(r||e%1||t%1){var d=Gs();return De(e+d*(t-e+Of("1e-"+((d+"").length-1))),t)}return Zi(e,t)}var Xg=xn(function(e,t,r){return t=t.toLowerCase(),e+(r?mu(t):t)});function mu(e){return xo(de(e).toLowerCase())}function vu(e){return e=de(e),e&&e.replace(Qc,Hf).replace(_f,"")}function Qg(e,t,r){e=de(e),t=Ve(t);var c=e.length;r=r===n?c:nn(ie(r),0,c);var d=r;return r-=t.length,r>=0&&e.slice(r,d)==t}function em(e){return e=de(e),e&&Mc.test(e)?e.replace(jo,qf):e}function tm(e){return e=de(e),e&&Gc.test(e)?e.replace(_i,"\\$&"):e}var nm=xn(function(e,t,r){return e+(r?"-":"")+t.toLowerCase()}),rm=xn(function(e,t,r){return e+(r?" ":"")+t.toLowerCase()}),im=Sa("toLowerCase");function om(e,t,r){e=de(e),t=ie(t);var c=t?yn(e):0;if(!t||c>=t)return e;var d=(t-c)/2;return Br(Er(d),r)+e+Br(wr(d),r)}function sm(e,t,r){e=de(e),t=ie(t);var c=t?yn(e):0;return t&&c>>0,r?(e=de(e),e&&(typeof t=="string"||t!=null&&!bo(t))&&(t=Ve(t),!t&&vn(e))?zt(dt(e),0,r):e.split(t,r)):[]}var pm=xn(function(e,t,r){return e+(r?" ":"")+xo(t)});function hm(e,t,r){return e=de(e),r=r==null?0:nn(ie(r),0,e.length),t=Ve(t),e.slice(r,r+t.length)==t}function gm(e,t,r){var c=h.templateSettings;r&&ke(e,t,r)&&(t=n),e=de(e),t=Qr({},t,c,wa);var d=Qr({},t.imports,c.imports,wa),m=Ee(d),S=ki(d,m),R,E,k=0,U=t.interpolate||dr,G="__p += '",q=Fi((t.escape||dr).source+"|"+U.source+"|"+(U===Ko?$c:dr).source+"|"+(t.evaluate||dr).source+"|$","g"),V="//# sourceURL="+(pe.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Rf+"]")+"\n";e.replace(q,function(Z,ae,ce,je,Ue,Ke){return ce||(ce=je),G+=e.slice(k,Ke).replace(ef,Jf),ae&&(R=!0,G+="' +\n__e("+ae+") +\n'"),Ue&&(E=!0,G+="';\n"+Ue+";\n__p += '"),ce&&(G+="' +\n((__t = ("+ce+")) == null ? '' : __t) +\n'"),k=Ke+Z.length,Z}),G+="';\n";var Y=pe.call(t,"variable")&&t.variable;if(!Y)G="with (obj) {\n"+G+"\n}\n";else if(zc.test(Y))throw new Q(g);G=(E?G.replace(yi,""):G).replace(Ac,"$1").replace(Ic,"$1;"),G="function("+(Y||"obj")+") {\n"+(Y?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(R?", __e = _.escape":"")+(E?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+G+"return __p\n}";var oe=_u(function(){return le(m,V+"return "+G).apply(n,S)});if(oe.source=G,Co(oe))throw oe;return oe}function mm(e){return de(e).toLowerCase()}function vm(e){return de(e).toUpperCase()}function ym(e,t,r){if(e=de(e),e&&(r||t===n))return Es(e);if(!e||!(t=Ve(t)))return e;var c=dt(e),d=dt(t),m=Os(c,d),S=As(c,d)+1;return zt(c,m,S).join("")}function _m(e,t,r){if(e=de(e),e&&(r||t===n))return e.slice(0,Ds(e)+1);if(!e||!(t=Ve(t)))return e;var c=dt(e),d=As(c,dt(t))+1;return zt(c,0,d).join("")}function Sm(e,t,r){if(e=de(e),e&&(r||t===n))return e.replace(Si,"");if(!e||!(t=Ve(t)))return e;var c=dt(e),d=Os(c,dt(t));return zt(c,d).join("")}function Cm(e,t){var r=nr,c=dn;if(Se(t)){var d="separator"in t?t.separator:d;r="length"in t?ie(t.length):r,c="omission"in t?Ve(t.omission):c}e=de(e);var m=e.length;if(vn(e)){var S=dt(e);m=S.length}if(r>=m)return e;var R=r-yn(c);if(R<1)return c;var E=S?zt(S,0,R).join(""):e.slice(0,R);if(d===n)return E+c;if(S&&(R+=E.length-R),bo(d)){if(e.slice(R).search(d)){var k,U=E;for(d.global||(d=Fi(d.source,de(Yo.exec(d))+"g")),d.lastIndex=0;k=d.exec(U);)var G=k.index;E=E.slice(0,G===n?R:G)}}else if(e.indexOf(Ve(d),R)!=R){var q=E.lastIndexOf(d);q>-1&&(E=E.slice(0,q))}return E+c}function bm(e){return e=de(e),e&&Dc.test(e)?e.replace($o,Zf):e}var Tm=xn(function(e,t,r){return e+(r?" ":"")+t.toUpperCase()}),xo=Sa("toUpperCase");function yu(e,t,r){return e=de(e),t=r?n:t,t===n?Vf(e)?el(e):Ff(e):e.match(t)||[]}var _u=se(function(e,t){try{return Je(e,n,t)}catch(r){return Co(r)?r:new Q(r)}}),Rm=Et(function(e,t){return et(t,function(r){r=St(r),Pt(e,r,_o(e[r],e))}),e});function xm(e){var t=e==null?0:e.length,r=K();return e=t?ye(e,function(c){if(typeof c[1]!="function")throw new tt(p);return[r(c[0]),c[1]]}):[],se(function(c){for(var d=-1;++dut)return[];var r=Xe,c=De(e,Xe);t=K(t),e-=Xe;for(var d=Li(c,t);++r0||t<0)?new ue(r):(e<0?r=r.takeRight(-e):e&&(r=r.drop(e)),t!==n&&(t=ie(t),r=t<0?r.dropRight(-t):r.take(t-e)),r)},ue.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},ue.prototype.toArray=function(){return this.take(Xe)},yt(ue.prototype,function(e,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),c=/^(?:head|last)$/.test(t),d=h[c?"take"+(t=="last"?"Right":""):t],m=c||/^find/.test(t);d&&(h.prototype[t]=function(){var S=this.__wrapped__,R=c?[1]:arguments,E=S instanceof ue,k=R[0],U=E||te(S),G=function(ae){var ce=d.apply(h,Gt([ae],R));return c&&q?ce[0]:ce};U&&r&&typeof k=="function"&&k.length!=1&&(E=U=!1);var q=this.__chain__,V=!!this.__actions__.length,Y=m&&!q,oe=E&&!V;if(!m&&U){S=oe?S:new ue(this);var Z=e.apply(S,R);return Z.__actions__.push({func:Vr,args:[G],thisArg:n}),new nt(Z,q)}return Y&&oe?e.apply(this,R):(Z=this.thru(G),Y?c?Z.value()[0]:Z.value():Z)})}),et(["pop","push","shift","sort","splice","unshift"],function(e){var t=yr[e],r=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",c=/^(?:pop|shift)$/.test(e);h.prototype[e]=function(){var d=arguments;if(c&&!this.__chain__){var m=this.value();return t.apply(te(m)?m:[],d)}return this[r](function(S){return t.apply(te(S)?S:[],d)})}}),yt(ue.prototype,function(e,t){var r=h[t];if(r){var c=r.name+"";pe.call(bn,c)||(bn[c]=[]),bn[c].push({name:t,func:r})}}),bn[Gr(n,Ye).name]=[{name:"wrapper",func:n}],ue.prototype.clone=bl,ue.prototype.reverse=Tl,ue.prototype.value=Rl,h.prototype.at=Qp,h.prototype.chain=eh,h.prototype.commit=th,h.prototype.next=nh,h.prototype.plant=ih,h.prototype.reverse=oh,h.prototype.toJSON=h.prototype.valueOf=h.prototype.value=sh,h.prototype.first=h.prototype.head,kn&&(h.prototype[kn]=rh),h},_n=tl();Xt?((Xt.exports=_n)._=_n,Pi._=_n):Ae._=_n}).call(Kn)})(di,di.exports);var Gv=di.exports;const fn=qu(Gv);var un=globalThis&&globalThis.__assign||function(){return un=Object.assign||function(i){for(var s,n=1,o=arguments.length;n0&&u[u.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!u||l[1]>u[0]&&l[1]0&&u[u.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!u||l[1]>u[0]&&l[1]0&&u[u.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!u||l[1]>u[0]&&l[1]0&&u[u.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!u||l[1]>u[0]&&l[1]0&&u[u.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!u||l[1]>u[0]&&l[1]0&&u[u.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!u||l[1]>u[0]&&l[1]0&&u[u.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!u||l[1]>u[0]&&l[1]0&&u[u.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!u||l[1]>u[0]&&l[1]{for(var a=o>1?void 0:o?Kv(s,n):s,u=i.length-1,p;u>=0;u--)(p=i[u])&&(a=(o?p(s,n,a):p(a))||a);return o&&a&&jv(s,n,a),a};let ln=class extends cv(fv,lv){constructor(){super(...arguments),this.janusClient=null,this.session=null,this.handle=null,this.useStun=!1,this.aspectRatio=null,this.status="connecting"}get url(){var o;const s=this.camSettings.stream_url;let n=new URL(s,this.printerUrl===null?this.hostUrl.toString():this.printerUrl);if(n.port="8188",n.protocol=(o=this.printerUrl)!=null&&o.startsWith("https")?"wss":"ws",s.startsWith("ws")||s.startsWith("http")){n=new URL(s);const a=n.pathname.split("/");n.pathname=a.slice(0,a.length-1).join("/")}return n}get streamId(){const s=new URL(this.camSettings.stream_url).pathname.split("/");return s[s.length-1]}get webcamStyle(){var n,o,a;const s={transform:this.generateTransform((n=this.camSettings.flip_horizontal)!=null?n:!1,(o=this.camSettings.flip_vertical)!=null?o:!1,(a=this.camSettings.rotation)!=null?a:0),aspectRatio:1.7777777777777777};return this.aspectRatio&&(s.aspectRatio=this.aspectRatio),s}get streamConfig(){let s={server:this.url.toString()};return this.useStun&&(s.iceServers=[{urls:["stun:stun.l.google.com:19302"]}]),s}async startStream(){var n,o;this.janusClient=new zo(this.streamConfig),await this.janusClient.init({debug:!1}),this.session=await this.janusClient.createSession(),this.handle=await this.session.attach(Jv,{}),(n=this.handle)==null||n.onMessage.subscribe(async({message:a,jsep:u})=>{var p,g,T;if((p=a==null?void 0:a.result)!=null&&p.status&&(this.status=a.result.status),u){const l=await((g=this.handle)==null?void 0:g.createAnswer({jsep:u}));(T=this.handle)==null||T.send({message:{request:"start"},jsep:l})}});const s=new MediaStream;zo.attachMediaStream(this.stream,s),(o=this.handle)==null||o.onRemoteTrack.subscribe(({on:a,track:u})=>{a?s.addTrack(u):s.removeTrack(u)}),this.handle.onIceState.subscribe(a=>{console.log("ICE state changed to ".concat(a))}),this.handle.onError.subscribe(a=>{this.status="errored: ".concat(JSON.stringify(a))}),await this.handle.send({message:{request:"watch",id:parseInt(this.streamId)}})}mounted(){this.startStream()}updateAspectRatio(){this.aspectRatio=this.stream.videoWidth/this.stream.videoHeight}beforeDestroy(){var s;(s=this.session)==null||s.destroy({})}async changedUrl(){var s;await((s=this.session)==null?void 0:s.destroy({})),await this.startStream()}};tr([Hu({required:!0})],ln.prototype,"camSettings",2);tr([Hu({default:null})],ln.prototype,"printerUrl",2);tr([pv()],ln.prototype,"stream",2);tr([dv("url")],ln.prototype,"changedUrl",1);ln=tr([hv],ln);var Yv=function(){var i=this,s=i.$createElement,n=i._self._c||s;return n("div",[n("video",{directives:[{name:"show",rawName:"v-show",value:i.status==="started",expression:"status === 'started'"}],ref:"stream",staticClass:"webcamStream",style:i.webcamStyle,attrs:{autoplay:"",muted:"",playsinline:""},domProps:{muted:!0},on:{playing:i.updateAspectRatio}}),i.status!=="started"?n(mv,[n(vv,{staticClass:"_webcam_webrtc_output text-center d-flex flex-column justify-center align-center"},[i.status==="connecting"?n(yv,{staticClass:"mb-3",attrs:{indeterminate:"",color:"primary"}}):i._e(),n("span",{staticClass:"mt-3"},[i._v(i._s(i.status))])],1)],1):i._e()],1)},Zv=[];const Bu={};var Xv=gv(ln,Yv,Zv,!1,Qv,"5fed87a3",null,null);function Qv(i){for(let s in Bu)this[s]=Bu[s]}const oy=function(){return Xv.exports}();export{oy as default};