aliyun-rtc-sdk 7.1.5 → 7.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- import{o as Jr,k as $r,A as Zr}from"./index-BvRi8Pnp.js";import"eventemitter3";const en=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]));function $e(Y,L,M,V){return new(M||(M=Promise))(function(Q,j){function T(d){try{m(V.next(d))}catch(f){j(f)}}function _(d){try{m(V.throw(d))}catch(f){j(f)}}function m(d){var f;d.done?Q(d.value):(f=d.value,f instanceof M?f:new M(function(y){y(f)})).then(T,_)}m((V=V.apply(Y,[])).next())})}typeof SuppressedError=="function"&&SuppressedError;var Ye;function Qt(){return $e(this,void 0,void 0,function*(){let Y=!1;try{Y=yield en()}catch{Y=!1}return console.log("isSupportedSIMD",Y),Y})}(function(Y){Y[Y.ERROR=0]="ERROR",Y[Y.WARN=1]="WARN",Y[Y.INFO=2]="INFO",Y[Y.LOG=3]="LOG",Y[Y.DEBUG=4]="DEBUG"})(Ye||(Ye={}));let Be=class Ge{static error(...L){var M;Ge.logLevel>=Ye.ERROR&&((M=console.error)===null||M===void 0||M.call(console,`[${Ge.logTag}] `,...L))}static warn(...L){var M;Ge.logLevel>=Ye.WARN&&((M=console.warn)===null||M===void 0||M.call(console,`[${Ge.logTag}] `,...L))}static info(...L){var M;Ge.logLevel>=Ye.INFO&&((M=console.info)===null||M===void 0||M.call(console,`[${Ge.logTag}] `,...L))}static log(...L){var M;Ge.logLevel>=Ye.LOG&&((M=console.log)===null||M===void 0||M.call(console,`[${Ge.logTag}] `,...L))}static debug(...L){var M;Ge.logLevel>=Ye.DEBUG&&((M=console.debug)===null||M===void 0||M.call(console,`[${Ge.logTag}] `,...L))}};Be.logLevel=Ye.WARN,Be.logTag="aliyun-audio-3a";let tn=class{},Jt=class extends tn{static isSupported(){return function(){if(typeof window=="object"&&window!==null){const L="AudioWorklet"in window,M="WebAssembly"in window;return L&&M}return!1}()}static isSupportedSIMD(){return $e(this,void 0,void 0,function*(){return yield Qt()})}static setLogger(L){Be.logLevel=L}constructor(L){super(),this.channelCount=1,this.sampleRate=48e3,this.collectDumpOutputData=[],this.collectDumpNearInputData=[],this.collectDumpFarInputData=[],this.collectDumpMetaData=[],this.statUpdateTimer=0,this.statUpdateInterval=5e3,this.options=Object.assign({aecOn:!0,ansOn:!0,agcOn:!0,hdOn:!1,ansMode:1,dumpOn:!1,aiaecOn:!1,wasmCdnPath:"https://g.alicdn.com/code/npm/@ali/aliyun-audio-3a/0.0.6/"},L||{})}initWASM(L,M,V){return $e(this,void 0,void 0,function*(){Be.log("initWASM",L,M,V);const Q=T=>$e(this,void 0,void 0,function*(){try{const _=yield fetch(T,{credentials:"same-origin"});return _.ok||this.onLoadError(new Error(`Failed to fetch WASM: ${_.status}:${_.statusText}, url:${T}`)),_.arrayBuffer()}catch(_){return this.onLoadError(new Error("WASM load error")),Be.error("Error fetching WASM:",_),new Uint8Array(0)}}),j=T=>$e(this,void 0,void 0,function*(){return fetch(T).then(_=>_.text())});try{const T=yield Qt(),_=this.options.wasmCdnPath+"audio_module_v2.wasm",m=this.options.wasmCdnPath+"audio_module_v2_simd.wasm",f=yield Q(T?m:_),y=this.options.wasmCdnPath+"audio_module_v2.js",v=this.options.wasmCdnPath+"audio_module_v2_simd.js",s=T?v:y,c=yield j(s);L.port.postMessage(Object.assign({type:"init",channelCount:M,sampleRate:V,wasmBuffer:f,isSupportSIMD:T,audioModuleScript:c,logLevel:Be.logLevel},this.options),[f])}catch(T){Be.error("Error initializing WASM:",T),this.onLoadError(new Error("WASM init error"))}L.port.onmessage=T=>{T.data.type==="init_done"&&this.onLoadSuccess(void 0),T.data.type==="dump_output_data"&&this.onDumpOutputData(T.data.data),T.data.type==="dump_near_data"&&this.onDumpNearInputData(T.data.data),T.data.type==="dump_far_data"&&this.onDumpFarInputData(T.data.data),T.data.type==="dump_meta_data"&&this.onDumpMeatData(T.data.data),T.data.type==="output_log"&&this.onOutputLog(T.data.data),T.data.type==="apm_stat_data"&&this.onStatData(T.data.data)}})}createProcessor(L,M,V,Q,j){return $e(this,void 0,void 0,function*(){this.audioContext=L,this.audioContext.resume(),this.channelCount=V,this.sampleRate=Q;try{const m=new Blob(['!function(){"use strict";function t(t,e,a,n){return new(a||(a=Promise))((function(s,i){function o(t){try{h(n.next(t))}catch(t){i(t)}}function r(t){try{h(n.throw(t))}catch(t){i(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof a?e:new a((function(t){t(e)}))).then(o,r)}h((n=n.apply(t,e||[])).next())}))}var e;"function"==typeof SuppressedError&&SuppressedError,function(t){t[t.ERROR=0]="ERROR",t[t.WARN=1]="WARN",t[t.INFO=2]="INFO",t[t.LOG=3]="LOG",t[t.DEBUG=4]="DEBUG"}(e||(e={}));class a{static error(...t){var n;a.logLevel>=e.ERROR&&(null===(n=console.error)||void 0===n||n.call(console,`[${a.logTag}] `,...t))}static warn(...t){var n;a.logLevel>=e.WARN&&(null===(n=console.warn)||void 0===n||n.call(console,`[${a.logTag}] `,...t))}static info(...t){var n;a.logLevel>=e.INFO&&(null===(n=console.info)||void 0===n||n.call(console,`[${a.logTag}] `,...t))}static log(...t){var n;a.logLevel>=e.LOG&&(null===(n=console.log)||void 0===n||n.call(console,`[${a.logTag}] `,...t))}static debug(...t){var n;a.logLevel>=e.DEBUG&&(null===(n=console.debug)||void 0===n||n.call(console,`[${a.logTag}] `,...t))}}a.logLevel=e.WARN,a.logTag="aliyun-audio-3a";const n=Float32Array.BYTES_PER_ELEMENT,s=Uint16Array.BYTES_PER_ELEMENT;class i{constructor(t,e,a,n,s){this._channelData=[],this._name=t,this._isInitialized=!1,this._module=e,this._length=a,this._ringLength=2*a,this._maxChannelCount=s?Math.min(s,32):n,this._channelCount=n,this._allocateHeap(),this._isInitialized=!0,this._readIndex=0,this._writeIndex=0,this._framesAvailable=0,this._channelDataLocal=[];for(let t=0;t<this._channelCount;++t)this._channelDataLocal[t]=new Float32Array(this._ringLength)}_allocateHeap(){const t=this._length*n,e=this._channelCount*t;this._dataPtr=this._module._malloc(e),this._channelData=[];for(let e=0;e<this._channelCount;++e){const a=this._dataPtr+e*t,n=a+t;this._channelData[e]=this._module.HEAPF32.subarray(a>>s,n>>s)}}adaptChannel(t){t<this._maxChannelCount&&(this._channelCount=t)}get length(){return this._isInitialized?this._length:null}get numberOfChannels(){return this._isInitialized?this._channelCount:null}get maxChannelCount(){return this._isInitialized?this._maxChannelCount:null}getChannelData(t){return void 0!==t&&t>=this._channelCount?null:void 0===t?this._channelData:this._channelData[t]}getHeapAddress(){return this._dataPtr}getPointer(){return this._dataPtr}free(){this._isInitialized=!1,null!==this._dataPtr&&this._module._free(this._dataPtr),this._channelData=[]}get framesAvailable(){return this._framesAvailable}push(t){const e=t[0].length;for(let a=0;a<e;++a){for(let e=0;e<this._channelCount;++e)this._channelDataLocal[e][this._writeIndex]=t[e][a];this._writeIndex=(this._writeIndex+1)%this._ringLength}this._framesAvailable+=e,this._framesAvailable>this._ringLength&&(console.warn(this._name,"Too many frames available, overflow"),this._framesAvailable=this._ringLength,this._writeIndex=0)}pull(t){if(0===this._framesAvailable)return void console.warn(this._name,"No frames available");const e=t[0].length;for(let a=0;a<e;++a){for(let e=0;e<this._channelCount;++e)t[e][a]=this._channelDataLocal[e][this._readIndex];this._readIndex=(this._readIndex+1)%this._ringLength}this._framesAvailable-=e,this._framesAvailable<0&&(this._framesAvailable=0,this._readIndex=0)}}class o{constructor(t){this.inited=!1,this.handle=null,this.channelCount=1,this.isEnable=!0,this.dumpAudioData=!1,this.kernelBufferSize=512,this.node=t,this.onDumpOutputDataFunction=null,this.onDumpNearDataFunction=null,this.onDumpFarDataFunction=null,this.onDumpMetaDataFunction=null,this.wasmInvoker=null,this._nearAudioBuffer={},this._outputAudioBuffer={}}destructor(){this.wasmInvoker=null,this.handle=null}init(n){return t(this,void 0,void 0,(function*(){const{wasmBuffer:t,audioModuleScript:s,channelCount:o=1,sampleRate:r=44100,dumpAudioData:h=!1,logLevel:l=e.DEBUG}=n;a.logLevel=l,a.log("AudioAPM init",JSON.stringify(n)),this.channelCount=o,this.dumpAudioData=h;try{const e=new Function(`let module={};let exports={};${s}; return module`)();this.wasmInvoker=yield e.exports({wasmBinary:t})}catch(t){this.node.port.postMessage({type:"error",message:"audioModule init error"}),a.error(t)}this._nearAudioBuffer=new i("inBuffer",this.wasmInvoker,this.kernelBufferSize,2*this.channelCount,32),this._outputAudioBuffer=new i("outBuffer",this.wasmInvoker,this.kernelBufferSize,this.channelCount,32);const u=this.wasmInvoker.addFunction(((t,e)=>{const a=this.wasmInvoker.HEAPU8.subarray(t,t+e),n=String.fromCharCode.apply(null,a);this.node&&this.node.port&&this.node.port.postMessage({type:"output_log",message:"output_log",data:n})}),"vii");if(this.wasmInvoker.__apm_log_callback(u),this.handle=this.wasmInvoker.__apm_create(n.aecOn?1:0,n.ansOn?1:0,n.agcOn?1:0,n.hdOn?1:0,r,o,n.dumpOn?1:0,this.kernelBufferSize),n.aiaecOn){const t=102;this.wasmInvoker.__apm_set_param(this.handle,t,7)}if(n.useHardOnly){const t=108;this.wasmInvoker.__apm_set_param(this.handle,t,1)}this.node.port.postMessage({type:"init_done",message:"init done"}),this.inited=!0}))}getStatData(){if(this.wasmInvoker&&this.isEnable){let t=this.wasmInvoker.__apm_get_stat(this.handle),e=this.wasmInvoker.UTF8ToString(t);this.wasmInvoker._free(t),this.node&&this.node.port&&this.node.port.postMessage({type:"apm_stat_data",message:"apm_stat_data",data:e})}}onOutputLog(t){console.log("[WASM_LOG]",t)}destory(){return t(this,void 0,void 0,(function*(){var t;try{null===(t=this.wasmInvoker)||void 0===t||t.__apm_destory(this.handle),this.inited=!1}catch(t){a.error(t)}finally{this.handle=null}}))}enable(){this.isEnable=!0,a.log("APM enable")}disable(){this.isEnable=!1,a.log("APM disable")}getStat(){if(null==this.wasmInvoker||null==this.handle)return"";let t=this.wasmInvoker.__apm_get_stat(this.handle),e=this.wasmInvoker.UTF8ToString(t);return this.wasmInvoker._free(t),e}startDump(){this.onDumpOutputDataFunction=this.wasmInvoker.addFunction(((t,e)=>{const a=this.wasmInvoker.HEAPU8.subarray(t,t+e),n=new Uint8Array(a);this.node&&this.node.port&&this.node.port.postMessage({type:"dump_output_data",message:"dump_output_data",data:n})}),"vii"),this.onDumpNearDataFunction=this.wasmInvoker.addFunction(((t,e)=>{const a=this.wasmInvoker.HEAPU8.subarray(t,t+e),n=new Uint8Array(a);this.node&&this.node.port&&this.node.port.postMessage({type:"dump_near_data",message:"dump_near_data",data:n})}),"vii"),this.onDumpFarDataFunction=this.wasmInvoker.addFunction(((t,e)=>{const a=this.wasmInvoker.HEAPU8.subarray(t,t+e),n=new Uint8Array(a);this.node&&this.node.port&&this.node.port.postMessage({type:"dump_far_data",message:"dump_far_data",data:n})}),"vii"),this.onDumpMetaDataFunction=this.wasmInvoker.addFunction(((t,e)=>{const a=this.wasmInvoker.HEAPU8.subarray(t,t+e),n=new Uint8Array(a);this.node&&this.node.port&&this.node.port.postMessage({type:"dump_meta_data",message:"dump_meta_data",data:n})}),"vii"),this.wasmInvoker.__apm_dump_start(this.handle,this.onDumpOutputDataFunction,this.onDumpNearDataFunction,this.onDumpFarDataFunction,this.onDumpMetaDataFunction)}stopDump(){this.wasmInvoker.__apm_dump_stop(this.handle),this.wasmInvoker&&(this.wasmInvoker.removeFunction(this.onDumpOutputDataFunction),this.wasmInvoker.removeFunction(this.onDumpNearDataFunction),this.wasmInvoker.removeFunction(this.onDumpFarDataFunction),this.wasmInvoker.removeFunction(this.onDumpMetaDataFunction))}process(t,e,a){if(!this.inited||!this.isEnable){for(let e=0;e<this.channelCount;e++){a[e].set(t[e])}return}const n=this.channelCount;let s=0;if(this.handle&&this.isEnable){const i=t[0].length,o=[];for(let a=0;a<n;a++)e[a]&&e[a].length>0&&(s=1),o.push(t[a]||new Float32Array(i).fill(0)),o.push(e[a]||new Float32Array(i).fill(0));if(this._nearAudioBuffer.push(o),this._nearAudioBuffer.framesAvailable>=this.kernelBufferSize){this._nearAudioBuffer.pull(this._nearAudioBuffer.getChannelData()),this.wasmInvoker.__apm_process_new(this.handle,this._nearAudioBuffer.getHeapAddress(),this._outputAudioBuffer.getHeapAddress(),n,s);const t=this._outputAudioBuffer.getChannelData();this._outputAudioBuffer.push(t)}this._outputAudioBuffer.pull(a)}}}class r extends AudioWorkletProcessor{constructor(){super(),this.apm=new o(this),this.port.onmessage=t=>{const e=t.data||{};switch(a.log("onmessage data",e),e.type){case"init":this.apm.init(e);break;case"destroy":this.apm.destory();break;case"enable":this.apm.enable();break;case"disable":this.apm.disable();break;case"start_dump":this.apm.startDump();break;case"stop_dump":this.apm.stopDump();break;case"get_stat_data":this.apm.getStatData();break;default:a.warn("Unknown message type:",e.type)}}}process(t,e){const a=t[0],n=t.length>1?t[1]:[],s=e[0];return this.apm.process(a,n,s),!0}}registerProcessor("aliyun-web-3a-processor",r)}();\n'],{type:"application/javascript"}),d=URL.createObjectURL(m);yield this.audioContext.audioWorklet.addModule(d)}catch(m){Be.error("Failed to add module to audio worklet:",m)}let T=new AudioWorkletNode(this.audioContext,"aliyun-web-3a-processor",{numberOfInputs:2,outputChannelCount:[V]});this.workletNode=T,M.connect(T),j&&(this.farNode=j,j.connect(T,0,1));const _=this.audioContext.createMediaStreamDestination();T.connect(_),this.targetMediaTrack=_.stream.getAudioTracks()[0],yield this.initWASM(T,V,Q),this.statUpdateTimer=window.setInterval(()=>{this.getStatData()},this.statUpdateInterval)})}addFarNode(L){this.workletNode&&(this.farNode&&this.farNode.disconnect(this.workletNode),L&&(this.farNode=L,L.connect(this.workletNode,0,1)))}getStatData(){var L;try{(L=this.workletNode)===null||L===void 0||L.port.postMessage({type:"get_stat_data"})}catch(M){Be.error("Failed to post message to worklet node:",M)}}destroy(){if(this.statUpdateTimer&&window.clearInterval(this.statUpdateTimer),this.audioContext&&this.workletNode&&this.workletNode.port)try{this.workletNode.port.postMessage({type:"destroy"}),this.workletNode.port.onmessage=null,this.workletNode.disconnect(),Be.log("postMessage destroy")}catch(L){Be.error("Failed to post message to worklet node:",L)}}startDump(){var L;try{(L=this.workletNode)===null||L===void 0||L.port.postMessage({type:"start_dump"})}catch(M){Be.error("Failed to post message to worklet node:",M)}}stopDump(){var L;try{(L=this.workletNode)===null||L===void 0||L.port.postMessage({type:"stop_dump"})}catch(M){Be.error("Failed to post message to worklet node:",M)}setTimeout(()=>{this.onDumpOutputData(null,!0),this.onDumpNearInputData(null,!0),this.onDumpFarInputData(null,!0),this.onDumpMeatData(null,!0)},3e3)}onDumpOutputData(L,M=!1){if(L&&L.length>0&&this.collectDumpOutputData.push(L),M&&this.collectDumpOutputData.length>0||1024*this.collectDumpOutputData.length>=this.getMaxDumpBytes()){let V=new Blob(this.collectDumpOutputData);this.onDumpData(V,"output_"+this.sampleRate+"hz_"+this.channelCount+"ch.pcm"),this.collectDumpOutputData=[]}}onDumpNearInputData(L,M=!1){if(L&&L.length>0&&this.collectDumpNearInputData.push(L),M&&this.collectDumpNearInputData.length>0||1024*this.collectDumpNearInputData.length>=this.getMaxDumpBytes()){let V=new Blob(this.collectDumpNearInputData);this.onDumpData(V,"near_input_"+this.sampleRate+"hz_"+this.channelCount+"ch.pcm"),this.collectDumpNearInputData=[]}}onDumpFarInputData(L,M=!1){if(L&&L.length>0&&this.collectDumpFarInputData.push(L),M&&this.collectDumpFarInputData.length>0||1024*this.collectDumpFarInputData.length>=this.getMaxDumpBytes()){let V=new Blob(this.collectDumpFarInputData);this.onDumpData(V,"far_input_"+this.sampleRate+"hz_"+this.channelCount+"ch.pcm"),this.collectDumpFarInputData=[]}}onDumpMeatData(L,M=!1){if(L&&L.length>0&&this.collectDumpMetaData.push(L),M&&this.collectDumpMetaData.length>0||1024*this.collectDumpMetaData.length>=this.getMaxDumpBytes()){let V=new Blob(this.collectDumpMetaData);this.onDumpData(V,"meta_"+this.sampleRate+"hz_"+this.channelCount+"ch.pcm"),this.collectDumpMetaData=[]}}getMaxDumpBytes(){return 600*Number(this.sampleRate.toFixed(0))*Number(this.channelCount.toFixed(0))*2}enable(){var L;if(!((L=this.workletNode)===null||L===void 0)&&L.port)try{this.workletNode.port.postMessage({type:"enable"}),Be.log("postMessage enable")}catch(M){Be.error("Failed to post message to worklet node:",M)}}disable(){var L;if(!((L=this.workletNode)===null||L===void 0)&&L.port)try{Be.log("postMessage disable"),this.workletNode.port.postMessage({type:"disable"})}catch(M){Be.error("Failed to post message to worklet node:",M)}}on(L,M){L==="loaderror"&&(this.onLoadError=M),L==="loadsuccess"&&(this.onLoadSuccess=M),L==="dumpdata"&&(this.onDumpData=M),L==="outputlog"&&(this.onOutputLog=M),L==="statdata"&&(this.onStatData=M)}onLoadError(L){console.log("onLoadError",L)}onLoadSuccess(L){console.log("onLoadSuccess",L)}onDumpData(L,M){console.log("onDumpData",L,M)}onOutputLog(L){console.log("[WASM]",L)}onStatData(L){console.log("onStatData:",L)}};function rn(Y,L,M){Object.defineProperty(Y,L,{writable:!0,enumerable:!0,configurable:!0,value:M})}function $t(Y,L,M,V){rn(Y,L,M)}Array(32);class nn{constructor(L){this.timer=null,this.time=10,this.count=10,this.arr=[];var M,V;this.time=(M=L.time)!=null?M:10,this.count=(V=L.count)!=null?V:10,L.host.startsWith("http://")||L.host.startsWith("https://")?this.url=L.host+"/logstores/"+L.logstore+"/track":this.url="https://"+L.project+"."+L.host+"/logstores/"+L.logstore+"/track",this.opt=L,L.installUnloadHook&&typeof L.installUnloadHook=="function"&&L.installUnloadHook(()=>{this.sendImmediateInner()})}assemblePayload(L){const M={__logs__:L};return this.opt.tags&&(M.__tags__=this.opt.tags),this.opt.topic&&(M.__topic__=this.opt.topic),this.opt.source&&(M.__source__=this.opt.source),JSON.stringify(M)}platformSend(){if(this.opt.sendPayload&&typeof this.opt.sendPayload=="function"){const L=this.assemblePayload(this.arr);this.opt.sendPayload(this.url,L)}}transString(L){let M={};for(let V in L)typeof L[V]=="object"?M[V]=JSON.stringify(L[V]):M[V]=String(L[V]);return M}sendImmediateInner(){this.arr&&this.arr.length>0&&(this.platformSend(),this.timer!=null&&(clearTimeout(this.timer),this.timer=null),this.arr=[])}sendInner(){if(this.timer)this.arr.length>=this.count&&(clearTimeout(this.timer),this.timer=null,this.sendImmediateInner());else{const L=this;this.arr.length>=this.count||this.time<=0?this.sendImmediateInner():this.timer=setTimeout(function(){L.sendImmediateInner()},this.time*1e3)}}send(L){const M=this.transString(L);this.arr.push(M),this.sendInner()}sendImmediate(L){const M=this.transString(L);this.arr.push(M),this.sendImmediateInner()}sendBatchLogs(L){const M=L.map(V=>this.transString(V));this.arr.push(...M),this.sendInner()}sendBatchLogsImmediate(L){const M=L.map(V=>this.transString(V));this.arr.push(...M),this.sendImmediateInner()}overwriteTransString(L){this.transString=L.transString}getOpt(){return this.opt}}var on=(Y,L,M)=>new Promise((V,Q)=>{var j=m=>{try{_(M.next(m))}catch(d){Q(d)}},T=m=>{try{_(M.throw(m))}catch(d){Q(d)}},_=m=>m.done?V(m.value):Promise.resolve(m.value).then(j,T);_((M=M.apply(Y,L)).next())});function an(Y,L){return navigator&&navigator.sendBeacon?navigator.sendBeacon(`${Y}?APIVersion=0.6.0`,L):!1}function Zt(Y,L){const M=new window.XMLHttpRequest;M.open("POST",`${Y}?APIVersion=0.6.0`,!0),M.send(L)}function sn(Y,L){try{if(L.length>=32768){Zt(Y,L);return}an(Y,L)||Zt(Y,L)}catch(M){window&&window.console&&typeof window.console.error=="function"&&(console.error(`Failed to log to ali log service because of this exception:
2
- `+M),console.error("Failed log data:",Y))}}function cn(Y,L,M){return on(this,null,function*(){try{Y=Y.slice(0,-6);const{data:V,header:Q}=yield M.process(Y,L),j=new window.XMLHttpRequest;j.open("POST",Y,!0);for(let T in Q)j.setRequestHeader(T,Q[T]);j.send(V)}catch(V){window&&window.console&&typeof window.console.error=="function"&&(console.error(`Failed to log to ali log service because of this exception:
3
- `+V),console.error("Failed log data:",Y))}})}class er extends nn{constructor(L){const M=Object.assign({},L,{installUnloadHook:V=>{window.addEventListener("beforeunload",()=>{V()})},sendPayload:(V,Q)=>{sn(V,Q)}});super(M)}useStsPlugin(L){this.getOpt().sendPayload=(M,V)=>{cn(M,V,L)},this.overwriteTransString(L)}}$t(window,"SLS_Tracker",er);var ye=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function un(Y){return Y&&Y.__esModule&&Object.prototype.hasOwnProperty.call(Y,"default")?Y.default:Y}var tr={exports:{}};function dn(Y){throw new Error('Could not dynamically require "'+Y+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var st={exports:{}},rr;function _e(){return rr||(rr=1,function(Y,L){(function(M,V){Y.exports=V()})(ye,function(){var M=M||function(V,Q){var j;if(typeof window<"u"&&window.crypto&&(j=window.crypto),typeof self<"u"&&self.crypto&&(j=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(j=globalThis.crypto),!j&&typeof window<"u"&&window.msCrypto&&(j=window.msCrypto),!j&&typeof ye<"u"&&ye.crypto&&(j=ye.crypto),!j&&typeof dn=="function")try{j=require("crypto")}catch{}var T=function(){if(j){if(typeof j.getRandomValues=="function")try{return j.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof j.randomBytes=="function")try{return j.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},_=Object.create||function(){function i(){}return function(o){var t;return i.prototype=o,t=new i,i.prototype=null,t}}(),m={},d=m.lib={},f=d.Base=function(){return{extend:function(i){var o=_(this);return i&&o.mixIn(i),(!o.hasOwnProperty("init")||this.init===o.init)&&(o.init=function(){o.$super.init.apply(this,arguments)}),o.init.prototype=o,o.$super=this,o},create:function(){var i=this.extend();return i.init.apply(i,arguments),i},init:function(){},mixIn:function(i){for(var o in i)i.hasOwnProperty(o)&&(this[o]=i[o]);i.hasOwnProperty("toString")&&(this.toString=i.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),y=d.WordArray=f.extend({init:function(i,o){i=this.words=i||[],o!=Q?this.sigBytes=o:this.sigBytes=i.length*4},toString:function(i){return(i||s).stringify(this)},concat:function(i){var o=this.words,t=i.words,n=this.sigBytes,u=i.sigBytes;if(this.clamp(),n%4)for(var h=0;h<u;h++){var S=t[h>>>2]>>>24-h%4*8&255;o[n+h>>>2]|=S<<24-(n+h)%4*8}else for(var x=0;x<u;x+=4)o[n+x>>>2]=t[x>>>2];return this.sigBytes+=u,this},clamp:function(){var i=this.words,o=this.sigBytes;i[o>>>2]&=4294967295<<32-o%4*8,i.length=V.ceil(o/4)},clone:function(){var i=f.clone.call(this);return i.words=this.words.slice(0),i},random:function(i){for(var o=[],t=0;t<i;t+=4)o.push(T());return new y.init(o,i)}}),v=m.enc={},s=v.Hex={stringify:function(i){for(var o=i.words,t=i.sigBytes,n=[],u=0;u<t;u++){var h=o[u>>>2]>>>24-u%4*8&255;n.push((h>>>4).toString(16)),n.push((h&15).toString(16))}return n.join("")},parse:function(i){for(var o=i.length,t=[],n=0;n<o;n+=2)t[n>>>3]|=parseInt(i.substr(n,2),16)<<24-n%8*4;return new y.init(t,o/2)}},c=v.Latin1={stringify:function(i){for(var o=i.words,t=i.sigBytes,n=[],u=0;u<t;u++){var h=o[u>>>2]>>>24-u%4*8&255;n.push(String.fromCharCode(h))}return n.join("")},parse:function(i){for(var o=i.length,t=[],n=0;n<o;n++)t[n>>>2]|=(i.charCodeAt(n)&255)<<24-n%4*8;return new y.init(t,o)}},a=v.Utf8={stringify:function(i){try{return decodeURIComponent(escape(c.stringify(i)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(i){return c.parse(unescape(encodeURIComponent(i)))}},e=d.BufferedBlockAlgorithm=f.extend({reset:function(){this._data=new y.init,this._nDataBytes=0},_append:function(i){typeof i=="string"&&(i=a.parse(i)),this._data.concat(i),this._nDataBytes+=i.sigBytes},_process:function(i){var o,t=this._data,n=t.words,u=t.sigBytes,h=this.blockSize,S=h*4,x=u/S;i?x=V.ceil(x):x=V.max((x|0)-this._minBufferSize,0);var E=x*h,p=V.min(E*4,u);if(E){for(var b=0;b<E;b+=h)this._doProcessBlock(n,b);o=n.splice(0,E),t.sigBytes-=p}return new y.init(o,p)},clone:function(){var i=f.clone.call(this);return i._data=this._data.clone(),i},_minBufferSize:0});d.Hasher=e.extend({cfg:f.extend(),init:function(i){this.cfg=this.cfg.extend(i),this.reset()},reset:function(){e.reset.call(this),this._doReset()},update:function(i){return this._append(i),this._process(),this},finalize:function(i){i&&this._append(i);var o=this._doFinalize();return o},blockSize:16,_createHelper:function(i){return function(o,t){return new i.init(t).finalize(o)}},_createHmacHelper:function(i){return function(o,t){return new r.HMAC.init(i,t).finalize(o)}}});var r=m.algo={};return m}(Math);return M})}(st)),st.exports}var ct={exports:{}},nr;function rt(){return nr||(nr=1,function(Y,L){(function(M,V){Y.exports=V(_e())})(ye,function(M){return function(V){var Q=M,j=Q.lib,T=j.Base,_=j.WordArray,m=Q.x64={};m.Word=T.extend({init:function(d,f){this.high=d,this.low=f}}),m.WordArray=T.extend({init:function(d,f){d=this.words=d||[],f!=V?this.sigBytes=f:this.sigBytes=d.length*8},toX32:function(){for(var d=this.words,f=d.length,y=[],v=0;v<f;v++){var s=d[v];y.push(s.high),y.push(s.low)}return _.create(y,this.sigBytes)},clone:function(){for(var d=T.clone.call(this),f=d.words=this.words.slice(0),y=f.length,v=0;v<y;v++)f[v]=f[v].clone();return d}})}(),M})}(ct)),ct.exports}var ut={exports:{}},ir;function ln(){return ir||(ir=1,function(Y,L){(function(M,V){Y.exports=V(_e())})(ye,function(M){return function(){if(typeof ArrayBuffer=="function"){var V=M,Q=V.lib,j=Q.WordArray,T=j.init,_=j.init=function(m){if(m instanceof ArrayBuffer&&(m=new Uint8Array(m)),(m instanceof Int8Array||typeof Uint8ClampedArray<"u"&&m instanceof Uint8ClampedArray||m instanceof Int16Array||m instanceof Uint16Array||m instanceof Int32Array||m instanceof Uint32Array||m instanceof Float32Array||m instanceof Float64Array)&&(m=new Uint8Array(m.buffer,m.byteOffset,m.byteLength)),m instanceof Uint8Array){for(var d=m.byteLength,f=[],y=0;y<d;y++)f[y>>>2]|=m[y]<<24-y%4*8;T.call(this,f,d)}else T.apply(this,arguments)};_.prototype=j}}(),M.lib.WordArray})}(ut)),ut.exports}var dt={exports:{}},or;function pn(){return or||(or=1,function(Y,L){(function(M,V){Y.exports=V(_e())})(ye,function(M){return function(){var V=M,Q=V.lib,j=Q.WordArray,T=V.enc;T.Utf16=T.Utf16BE={stringify:function(m){for(var d=m.words,f=m.sigBytes,y=[],v=0;v<f;v+=2){var s=d[v>>>2]>>>16-v%4*8&65535;y.push(String.fromCharCode(s))}return y.join("")},parse:function(m){for(var d=m.length,f=[],y=0;y<d;y++)f[y>>>1]|=m.charCodeAt(y)<<16-y%2*16;return j.create(f,d*2)}},T.Utf16LE={stringify:function(m){for(var d=m.words,f=m.sigBytes,y=[],v=0;v<f;v+=2){var s=_(d[v>>>2]>>>16-v%4*8&65535);y.push(String.fromCharCode(s))}return y.join("")},parse:function(m){for(var d=m.length,f=[],y=0;y<d;y++)f[y>>>1]|=_(m.charCodeAt(y)<<16-y%2*16);return j.create(f,d*2)}};function _(m){return m<<8&4278255360|m>>>8&16711935}}(),M.enc.Utf16})}(dt)),dt.exports}var lt={exports:{}},ar;function Qe(){return ar||(ar=1,function(Y,L){(function(M,V){Y.exports=V(_e())})(ye,function(M){return function(){var V=M,Q=V.lib,j=Q.WordArray,T=V.enc;T.Base64={stringify:function(m){var d=m.words,f=m.sigBytes,y=this._map;m.clamp();for(var v=[],s=0;s<f;s+=3)for(var c=d[s>>>2]>>>24-s%4*8&255,a=d[s+1>>>2]>>>24-(s+1)%4*8&255,e=d[s+2>>>2]>>>24-(s+2)%4*8&255,r=c<<16|a<<8|e,i=0;i<4&&s+i*.75<f;i++)v.push(y.charAt(r>>>6*(3-i)&63));var o=y.charAt(64);if(o)for(;v.length%4;)v.push(o);return v.join("")},parse:function(m){var d=m.length,f=this._map,y=this._reverseMap;if(!y){y=this._reverseMap=[];for(var v=0;v<f.length;v++)y[f.charCodeAt(v)]=v}var s=f.charAt(64);if(s){var c=m.indexOf(s);c!==-1&&(d=c)}return _(m,d,y)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function _(m,d,f){for(var y=[],v=0,s=0;s<d;s++)if(s%4){var c=f[m.charCodeAt(s-1)]<<s%4*2,a=f[m.charCodeAt(s)]>>>6-s%4*2,e=c|a;y[v>>>2]|=e<<24-v%4*8,v++}return j.create(y,v)}}(),M.enc.Base64})}(lt)),lt.exports}var pt={exports:{}},sr;function fn(){return sr||(sr=1,function(Y,L){(function(M,V){Y.exports=V(_e())})(ye,function(M){return function(){var V=M,Q=V.lib,j=Q.WordArray,T=V.enc;T.Base64url={stringify:function(m,d){d===void 0&&(d=!0);var f=m.words,y=m.sigBytes,v=d?this._safe_map:this._map;m.clamp();for(var s=[],c=0;c<y;c+=3)for(var a=f[c>>>2]>>>24-c%4*8&255,e=f[c+1>>>2]>>>24-(c+1)%4*8&255,r=f[c+2>>>2]>>>24-(c+2)%4*8&255,i=a<<16|e<<8|r,o=0;o<4&&c+o*.75<y;o++)s.push(v.charAt(i>>>6*(3-o)&63));var t=v.charAt(64);if(t)for(;s.length%4;)s.push(t);return s.join("")},parse:function(m,d){d===void 0&&(d=!0);var f=m.length,y=d?this._safe_map:this._map,v=this._reverseMap;if(!v){v=this._reverseMap=[];for(var s=0;s<y.length;s++)v[y.charCodeAt(s)]=s}var c=y.charAt(64);if(c){var a=m.indexOf(c);a!==-1&&(f=a)}return _(m,f,v)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function _(m,d,f){for(var y=[],v=0,s=0;s<d;s++)if(s%4){var c=f[m.charCodeAt(s-1)]<<s%4*2,a=f[m.charCodeAt(s)]>>>6-s%4*2,e=c|a;y[v>>>2]|=e<<24-v%4*8,v++}return j.create(y,v)}}(),M.enc.Base64url})}(pt)),pt.exports}var ft={exports:{}},cr;function Je(){return cr||(cr=1,function(Y,L){(function(M,V){Y.exports=V(_e())})(ye,function(M){return function(V){var Q=M,j=Q.lib,T=j.WordArray,_=j.Hasher,m=Q.algo,d=[];(function(){for(var a=0;a<64;a++)d[a]=V.abs(V.sin(a+1))*4294967296|0})();var f=m.MD5=_.extend({_doReset:function(){this._hash=new T.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(a,e){for(var r=0;r<16;r++){var i=e+r,o=a[i];a[i]=(o<<8|o>>>24)&16711935|(o<<24|o>>>8)&4278255360}var t=this._hash.words,n=a[e+0],u=a[e+1],h=a[e+2],S=a[e+3],x=a[e+4],E=a[e+5],p=a[e+6],b=a[e+7],l=a[e+8],A=a[e+9],R=a[e+10],C=a[e+11],g=a[e+12],D=a[e+13],O=a[e+14],U=a[e+15],k=t[0],w=t[1],N=t[2],H=t[3];k=y(k,w,N,H,n,7,d[0]),H=y(H,k,w,N,u,12,d[1]),N=y(N,H,k,w,h,17,d[2]),w=y(w,N,H,k,S,22,d[3]),k=y(k,w,N,H,x,7,d[4]),H=y(H,k,w,N,E,12,d[5]),N=y(N,H,k,w,p,17,d[6]),w=y(w,N,H,k,b,22,d[7]),k=y(k,w,N,H,l,7,d[8]),H=y(H,k,w,N,A,12,d[9]),N=y(N,H,k,w,R,17,d[10]),w=y(w,N,H,k,C,22,d[11]),k=y(k,w,N,H,g,7,d[12]),H=y(H,k,w,N,D,12,d[13]),N=y(N,H,k,w,O,17,d[14]),w=y(w,N,H,k,U,22,d[15]),k=v(k,w,N,H,u,5,d[16]),H=v(H,k,w,N,p,9,d[17]),N=v(N,H,k,w,C,14,d[18]),w=v(w,N,H,k,n,20,d[19]),k=v(k,w,N,H,E,5,d[20]),H=v(H,k,w,N,R,9,d[21]),N=v(N,H,k,w,U,14,d[22]),w=v(w,N,H,k,x,20,d[23]),k=v(k,w,N,H,A,5,d[24]),H=v(H,k,w,N,O,9,d[25]),N=v(N,H,k,w,S,14,d[26]),w=v(w,N,H,k,l,20,d[27]),k=v(k,w,N,H,D,5,d[28]),H=v(H,k,w,N,h,9,d[29]),N=v(N,H,k,w,b,14,d[30]),w=v(w,N,H,k,g,20,d[31]),k=s(k,w,N,H,E,4,d[32]),H=s(H,k,w,N,l,11,d[33]),N=s(N,H,k,w,C,16,d[34]),w=s(w,N,H,k,O,23,d[35]),k=s(k,w,N,H,u,4,d[36]),H=s(H,k,w,N,x,11,d[37]),N=s(N,H,k,w,b,16,d[38]),w=s(w,N,H,k,R,23,d[39]),k=s(k,w,N,H,D,4,d[40]),H=s(H,k,w,N,n,11,d[41]),N=s(N,H,k,w,S,16,d[42]),w=s(w,N,H,k,p,23,d[43]),k=s(k,w,N,H,A,4,d[44]),H=s(H,k,w,N,g,11,d[45]),N=s(N,H,k,w,U,16,d[46]),w=s(w,N,H,k,h,23,d[47]),k=c(k,w,N,H,n,6,d[48]),H=c(H,k,w,N,b,10,d[49]),N=c(N,H,k,w,O,15,d[50]),w=c(w,N,H,k,E,21,d[51]),k=c(k,w,N,H,g,6,d[52]),H=c(H,k,w,N,S,10,d[53]),N=c(N,H,k,w,R,15,d[54]),w=c(w,N,H,k,u,21,d[55]),k=c(k,w,N,H,l,6,d[56]),H=c(H,k,w,N,U,10,d[57]),N=c(N,H,k,w,p,15,d[58]),w=c(w,N,H,k,D,21,d[59]),k=c(k,w,N,H,x,6,d[60]),H=c(H,k,w,N,C,10,d[61]),N=c(N,H,k,w,h,15,d[62]),w=c(w,N,H,k,A,21,d[63]),t[0]=t[0]+k|0,t[1]=t[1]+w|0,t[2]=t[2]+N|0,t[3]=t[3]+H|0},_doFinalize:function(){var a=this._data,e=a.words,r=this._nDataBytes*8,i=a.sigBytes*8;e[i>>>5]|=128<<24-i%32;var o=V.floor(r/4294967296),t=r;e[(i+64>>>9<<4)+15]=(o<<8|o>>>24)&16711935|(o<<24|o>>>8)&4278255360,e[(i+64>>>9<<4)+14]=(t<<8|t>>>24)&16711935|(t<<24|t>>>8)&4278255360,a.sigBytes=(e.length+1)*4,this._process();for(var n=this._hash,u=n.words,h=0;h<4;h++){var S=u[h];u[h]=(S<<8|S>>>24)&16711935|(S<<24|S>>>8)&4278255360}return n},clone:function(){var a=_.clone.call(this);return a._hash=this._hash.clone(),a}});function y(a,e,r,i,o,t,n){var u=a+(e&r|~e&i)+o+n;return(u<<t|u>>>32-t)+e}function v(a,e,r,i,o,t,n){var u=a+(e&i|r&~i)+o+n;return(u<<t|u>>>32-t)+e}function s(a,e,r,i,o,t,n){var u=a+(e^r^i)+o+n;return(u<<t|u>>>32-t)+e}function c(a,e,r,i,o,t,n){var u=a+(r^(e|~i))+o+n;return(u<<t|u>>>32-t)+e}Q.MD5=_._createHelper(f),Q.HmacMD5=_._createHmacHelper(f)}(Math),M.MD5})}(ft)),ft.exports}var ht={exports:{}},ur;function dr(){return ur||(ur=1,function(Y,L){(function(M,V){Y.exports=V(_e())})(ye,function(M){return function(){var V=M,Q=V.lib,j=Q.WordArray,T=Q.Hasher,_=V.algo,m=[],d=_.SHA1=T.extend({_doReset:function(){this._hash=new j.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(f,y){for(var v=this._hash.words,s=v[0],c=v[1],a=v[2],e=v[3],r=v[4],i=0;i<80;i++){if(i<16)m[i]=f[y+i]|0;else{var o=m[i-3]^m[i-8]^m[i-14]^m[i-16];m[i]=o<<1|o>>>31}var t=(s<<5|s>>>27)+r+m[i];i<20?t+=(c&a|~c&e)+1518500249:i<40?t+=(c^a^e)+1859775393:i<60?t+=(c&a|c&e|a&e)-1894007588:t+=(c^a^e)-899497514,r=e,e=a,a=c<<30|c>>>2,c=s,s=t}v[0]=v[0]+s|0,v[1]=v[1]+c|0,v[2]=v[2]+a|0,v[3]=v[3]+e|0,v[4]=v[4]+r|0},_doFinalize:function(){var f=this._data,y=f.words,v=this._nDataBytes*8,s=f.sigBytes*8;return y[s>>>5]|=128<<24-s%32,y[(s+64>>>9<<4)+14]=Math.floor(v/4294967296),y[(s+64>>>9<<4)+15]=v,f.sigBytes=y.length*4,this._process(),this._hash},clone:function(){var f=T.clone.call(this);return f._hash=this._hash.clone(),f}});V.SHA1=T._createHelper(d),V.HmacSHA1=T._createHmacHelper(d)}(),M.SHA1})}(ht)),ht.exports}var vt={exports:{}},lr;function mt(){return lr||(lr=1,function(Y,L){(function(M,V){Y.exports=V(_e())})(ye,function(M){return function(V){var Q=M,j=Q.lib,T=j.WordArray,_=j.Hasher,m=Q.algo,d=[],f=[];(function(){function s(r){for(var i=V.sqrt(r),o=2;o<=i;o++)if(!(r%o))return!1;return!0}function c(r){return(r-(r|0))*4294967296|0}for(var a=2,e=0;e<64;)s(a)&&(e<8&&(d[e]=c(V.pow(a,1/2))),f[e]=c(V.pow(a,1/3)),e++),a++})();var y=[],v=m.SHA256=_.extend({_doReset:function(){this._hash=new T.init(d.slice(0))},_doProcessBlock:function(s,c){for(var a=this._hash.words,e=a[0],r=a[1],i=a[2],o=a[3],t=a[4],n=a[5],u=a[6],h=a[7],S=0;S<64;S++){if(S<16)y[S]=s[c+S]|0;else{var x=y[S-15],E=(x<<25|x>>>7)^(x<<14|x>>>18)^x>>>3,p=y[S-2],b=(p<<15|p>>>17)^(p<<13|p>>>19)^p>>>10;y[S]=E+y[S-7]+b+y[S-16]}var l=t&n^~t&u,A=e&r^e&i^r&i,R=(e<<30|e>>>2)^(e<<19|e>>>13)^(e<<10|e>>>22),C=(t<<26|t>>>6)^(t<<21|t>>>11)^(t<<7|t>>>25),g=h+C+l+f[S]+y[S],D=R+A;h=u,u=n,n=t,t=o+g|0,o=i,i=r,r=e,e=g+D|0}a[0]=a[0]+e|0,a[1]=a[1]+r|0,a[2]=a[2]+i|0,a[3]=a[3]+o|0,a[4]=a[4]+t|0,a[5]=a[5]+n|0,a[6]=a[6]+u|0,a[7]=a[7]+h|0},_doFinalize:function(){var s=this._data,c=s.words,a=this._nDataBytes*8,e=s.sigBytes*8;return c[e>>>5]|=128<<24-e%32,c[(e+64>>>9<<4)+14]=V.floor(a/4294967296),c[(e+64>>>9<<4)+15]=a,s.sigBytes=c.length*4,this._process(),this._hash},clone:function(){var s=_.clone.call(this);return s._hash=this._hash.clone(),s}});Q.SHA256=_._createHelper(v),Q.HmacSHA256=_._createHmacHelper(v)}(Math),M.SHA256})}(vt)),vt.exports}var Et={exports:{}},pr;function hn(){return pr||(pr=1,function(Y,L){(function(M,V,Q){Y.exports=V(_e(),mt())})(ye,function(M){return function(){var V=M,Q=V.lib,j=Q.WordArray,T=V.algo,_=T.SHA256,m=T.SHA224=_.extend({_doReset:function(){this._hash=new j.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var d=_._doFinalize.call(this);return d.sigBytes-=4,d}});V.SHA224=_._createHelper(m),V.HmacSHA224=_._createHmacHelper(m)}(),M.SHA224})}(Et)),Et.exports}var gt={exports:{}},fr;function hr(){return fr||(fr=1,function(Y,L){(function(M,V,Q){Y.exports=V(_e(),rt())})(ye,function(M){return function(){var V=M,Q=V.lib,j=Q.Hasher,T=V.x64,_=T.Word,m=T.WordArray,d=V.algo;function f(){return _.create.apply(_,arguments)}var y=[f(1116352408,3609767458),f(1899447441,602891725),f(3049323471,3964484399),f(3921009573,2173295548),f(961987163,4081628472),f(1508970993,3053834265),f(2453635748,2937671579),f(2870763221,3664609560),f(3624381080,2734883394),f(310598401,1164996542),f(607225278,1323610764),f(1426881987,3590304994),f(1925078388,4068182383),f(2162078206,991336113),f(2614888103,633803317),f(3248222580,3479774868),f(3835390401,2666613458),f(4022224774,944711139),f(264347078,2341262773),f(604807628,2007800933),f(770255983,1495990901),f(1249150122,1856431235),f(1555081692,3175218132),f(1996064986,2198950837),f(2554220882,3999719339),f(2821834349,766784016),f(2952996808,2566594879),f(3210313671,3203337956),f(3336571891,1034457026),f(3584528711,2466948901),f(113926993,3758326383),f(338241895,168717936),f(666307205,1188179964),f(773529912,1546045734),f(1294757372,1522805485),f(1396182291,2643833823),f(1695183700,2343527390),f(1986661051,1014477480),f(2177026350,1206759142),f(2456956037,344077627),f(2730485921,1290863460),f(2820302411,3158454273),f(3259730800,3505952657),f(3345764771,106217008),f(3516065817,3606008344),f(3600352804,1432725776),f(4094571909,1467031594),f(275423344,851169720),f(430227734,3100823752),f(506948616,1363258195),f(659060556,3750685593),f(883997877,3785050280),f(958139571,3318307427),f(1322822218,3812723403),f(1537002063,2003034995),f(1747873779,3602036899),f(1955562222,1575990012),f(2024104815,1125592928),f(2227730452,2716904306),f(2361852424,442776044),f(2428436474,593698344),f(2756734187,3733110249),f(3204031479,2999351573),f(3329325298,3815920427),f(3391569614,3928383900),f(3515267271,566280711),f(3940187606,3454069534),f(4118630271,4000239992),f(116418474,1914138554),f(174292421,2731055270),f(289380356,3203993006),f(460393269,320620315),f(685471733,587496836),f(852142971,1086792851),f(1017036298,365543100),f(1126000580,2618297676),f(1288033470,3409855158),f(1501505948,4234509866),f(1607167915,987167468),f(1816402316,1246189591)],v=[];(function(){for(var c=0;c<80;c++)v[c]=f()})();var s=d.SHA512=j.extend({_doReset:function(){this._hash=new m.init([new _.init(1779033703,4089235720),new _.init(3144134277,2227873595),new _.init(1013904242,4271175723),new _.init(2773480762,1595750129),new _.init(1359893119,2917565137),new _.init(2600822924,725511199),new _.init(528734635,4215389547),new _.init(1541459225,327033209)])},_doProcessBlock:function(c,a){for(var e=this._hash.words,r=e[0],i=e[1],o=e[2],t=e[3],n=e[4],u=e[5],h=e[6],S=e[7],x=r.high,E=r.low,p=i.high,b=i.low,l=o.high,A=o.low,R=t.high,C=t.low,g=n.high,D=n.low,O=u.high,U=u.low,k=h.high,w=h.low,N=S.high,H=S.low,F=x,P=E,B=p,W=b,z=l,G=A,J=R,re=C,te=g,ie=D,ce=O,se=U,ue=k,pe=w,de=N,ve=H,Ee=0;Ee<80;Ee++){var fe,me,ge=v[Ee];if(Ee<16)me=ge.high=c[a+Ee*2]|0,fe=ge.low=c[a+Ee*2+1]|0;else{var be=v[Ee-15],Re=be.high,Te=be.low,Ie=(Re>>>1|Te<<31)^(Re>>>8|Te<<24)^Re>>>7,xe=(Te>>>1|Re<<31)^(Te>>>8|Re<<24)^(Te>>>7|Re<<25),De=v[Ee-2],Ce=De.high,Oe=De.low,Me=(Ce>>>19|Oe<<13)^(Ce<<3|Oe>>>29)^Ce>>>6,Pe=(Oe>>>19|Ce<<13)^(Oe<<3|Ce>>>29)^(Oe>>>6|Ce<<26),ke=v[Ee-7],Ue=ke.high,Ae=ke.low,I=v[Ee-16],K=I.high,q=I.low;fe=xe+Ae,me=Ie+Ue+(fe>>>0<xe>>>0?1:0),fe=fe+Pe,me=me+Me+(fe>>>0<Pe>>>0?1:0),fe=fe+q,me=me+K+(fe>>>0<q>>>0?1:0),ge.high=me,ge.low=fe}var X=te&ce^~te&ue,Z=ie&se^~ie&pe,ee=F&B^F&z^B&z,$=P&W^P&G^W&G,oe=(F>>>28|P<<4)^(F<<30|P>>>2)^(F<<25|P>>>7),ne=(P>>>28|F<<4)^(P<<30|F>>>2)^(P<<25|F>>>7),ae=(te>>>14|ie<<18)^(te>>>18|ie<<14)^(te<<23|ie>>>9),le=(ie>>>14|te<<18)^(ie>>>18|te<<14)^(ie<<23|te>>>9),he=y[Ee],Se=he.high,We=he.low,Fe=ve+le,ze=de+ae+(Fe>>>0<ve>>>0?1:0),Fe=Fe+Z,ze=ze+X+(Fe>>>0<Z>>>0?1:0),Fe=Fe+We,ze=ze+Se+(Fe>>>0<We>>>0?1:0),Fe=Fe+fe,ze=ze+me+(Fe>>>0<fe>>>0?1:0),Xt=ne+$,Qr=oe+ee+(Xt>>>0<ne>>>0?1:0);de=ue,ve=pe,ue=ce,pe=se,ce=te,se=ie,ie=re+Fe|0,te=J+ze+(ie>>>0<re>>>0?1:0)|0,J=z,re=G,z=B,G=W,B=F,W=P,P=Fe+Xt|0,F=ze+Qr+(P>>>0<Fe>>>0?1:0)|0}E=r.low=E+P,r.high=x+F+(E>>>0<P>>>0?1:0),b=i.low=b+W,i.high=p+B+(b>>>0<W>>>0?1:0),A=o.low=A+G,o.high=l+z+(A>>>0<G>>>0?1:0),C=t.low=C+re,t.high=R+J+(C>>>0<re>>>0?1:0),D=n.low=D+ie,n.high=g+te+(D>>>0<ie>>>0?1:0),U=u.low=U+se,u.high=O+ce+(U>>>0<se>>>0?1:0),w=h.low=w+pe,h.high=k+ue+(w>>>0<pe>>>0?1:0),H=S.low=H+ve,S.high=N+de+(H>>>0<ve>>>0?1:0)},_doFinalize:function(){var c=this._data,a=c.words,e=this._nDataBytes*8,r=c.sigBytes*8;a[r>>>5]|=128<<24-r%32,a[(r+128>>>10<<5)+30]=Math.floor(e/4294967296),a[(r+128>>>10<<5)+31]=e,c.sigBytes=a.length*4,this._process();var i=this._hash.toX32();return i},clone:function(){var c=j.clone.call(this);return c._hash=this._hash.clone(),c},blockSize:1024/32});V.SHA512=j._createHelper(s),V.HmacSHA512=j._createHmacHelper(s)}(),M.SHA512})}(gt)),gt.exports}var yt={exports:{}},vr;function vn(){return vr||(vr=1,function(Y,L){(function(M,V,Q){Y.exports=V(_e(),rt(),hr())})(ye,function(M){return function(){var V=M,Q=V.x64,j=Q.Word,T=Q.WordArray,_=V.algo,m=_.SHA512,d=_.SHA384=m.extend({_doReset:function(){this._hash=new T.init([new j.init(3418070365,3238371032),new j.init(1654270250,914150663),new j.init(2438529370,812702999),new j.init(355462360,4144912697),new j.init(1731405415,4290775857),new j.init(2394180231,1750603025),new j.init(3675008525,1694076839),new j.init(1203062813,3204075428)])},_doFinalize:function(){var f=m._doFinalize.call(this);return f.sigBytes-=16,f}});V.SHA384=m._createHelper(d),V.HmacSHA384=m._createHmacHelper(d)}(),M.SHA384})}(yt)),yt.exports}var _t={exports:{}},mr;function mn(){return mr||(mr=1,function(Y,L){(function(M,V,Q){Y.exports=V(_e(),rt())})(ye,function(M){return function(V){var Q=M,j=Q.lib,T=j.WordArray,_=j.Hasher,m=Q.x64,d=m.Word,f=Q.algo,y=[],v=[],s=[];(function(){for(var e=1,r=0,i=0;i<24;i++){y[e+5*r]=(i+1)*(i+2)/2%64;var o=r%5,t=(2*e+3*r)%5;e=o,r=t}for(var e=0;e<5;e++)for(var r=0;r<5;r++)v[e+5*r]=r+(2*e+3*r)%5*5;for(var n=1,u=0;u<24;u++){for(var h=0,S=0,x=0;x<7;x++){if(n&1){var E=(1<<x)-1;E<32?S^=1<<E:h^=1<<E-32}n&128?n=n<<1^113:n<<=1}s[u]=d.create(h,S)}})();var c=[];(function(){for(var e=0;e<25;e++)c[e]=d.create()})();var a=f.SHA3=_.extend({cfg:_.cfg.extend({outputLength:512}),_doReset:function(){for(var e=this._state=[],r=0;r<25;r++)e[r]=new d.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(e,r){for(var i=this._state,o=this.blockSize/2,t=0;t<o;t++){var n=e[r+2*t],u=e[r+2*t+1];n=(n<<8|n>>>24)&16711935|(n<<24|n>>>8)&4278255360,u=(u<<8|u>>>24)&16711935|(u<<24|u>>>8)&4278255360;var h=i[t];h.high^=u,h.low^=n}for(var S=0;S<24;S++){for(var x=0;x<5;x++){for(var E=0,p=0,b=0;b<5;b++){var h=i[x+5*b];E^=h.high,p^=h.low}var l=c[x];l.high=E,l.low=p}for(var x=0;x<5;x++)for(var A=c[(x+4)%5],R=c[(x+1)%5],C=R.high,g=R.low,E=A.high^(C<<1|g>>>31),p=A.low^(g<<1|C>>>31),b=0;b<5;b++){var h=i[x+5*b];h.high^=E,h.low^=p}for(var D=1;D<25;D++){var E,p,h=i[D],O=h.high,U=h.low,k=y[D];k<32?(E=O<<k|U>>>32-k,p=U<<k|O>>>32-k):(E=U<<k-32|O>>>64-k,p=O<<k-32|U>>>64-k);var w=c[v[D]];w.high=E,w.low=p}var N=c[0],H=i[0];N.high=H.high,N.low=H.low;for(var x=0;x<5;x++)for(var b=0;b<5;b++){var D=x+5*b,h=i[D],F=c[D],P=c[(x+1)%5+5*b],B=c[(x+2)%5+5*b];h.high=F.high^~P.high&B.high,h.low=F.low^~P.low&B.low}var h=i[0],W=s[S];h.high^=W.high,h.low^=W.low}},_doFinalize:function(){var e=this._data,r=e.words;this._nDataBytes*8;var i=e.sigBytes*8,o=this.blockSize*32;r[i>>>5]|=1<<24-i%32,r[(V.ceil((i+1)/o)*o>>>5)-1]|=128,e.sigBytes=r.length*4,this._process();for(var t=this._state,n=this.cfg.outputLength/8,u=n/8,h=[],S=0;S<u;S++){var x=t[S],E=x.high,p=x.low;E=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360,p=(p<<8|p>>>24)&16711935|(p<<24|p>>>8)&4278255360,h.push(p),h.push(E)}return new T.init(h,n)},clone:function(){for(var e=_.clone.call(this),r=e._state=this._state.slice(0),i=0;i<25;i++)r[i]=r[i].clone();return e}});Q.SHA3=_._createHelper(a),Q.HmacSHA3=_._createHmacHelper(a)}(Math),M.SHA3})}(_t)),_t.exports}var St={exports:{}},Er;function En(){return Er||(Er=1,function(Y,L){(function(M,V){Y.exports=V(_e())})(ye,function(M){/** @preserve
1
+ import{o as $r,k as Jr,A as Zr}from"./index-BvRi8Pnp.js";import"eventemitter3";const en=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]));function Je(Y,L,B,F){return new(B||(B=Promise))(function($,H){function T(l){try{f(F.next(l))}catch(m){H(m)}}function _(l){try{f(F.throw(l))}catch(m){H(m)}}function f(l){var m;l.done?$(l.value):(m=l.value,m instanceof B?m:new B(function(h){h(m)})).then(T,_)}f((F=F.apply(Y,[])).next())})}typeof SuppressedError=="function"&&SuppressedError;var Ye;function Qt(){return Je(this,void 0,void 0,function*(){let Y=!1;try{Y=yield en()}catch{Y=!1}return console.log("isSupportedSIMD",Y),Y})}(function(Y){Y[Y.ERROR=0]="ERROR",Y[Y.WARN=1]="WARN",Y[Y.INFO=2]="INFO",Y[Y.LOG=3]="LOG",Y[Y.DEBUG=4]="DEBUG"})(Ye||(Ye={}));let Be=class Ge{static error(...L){var B;Ge.logLevel>=Ye.ERROR&&((B=console.error)===null||B===void 0||B.call(console,`[${Ge.logTag}] `,...L))}static warn(...L){var B;Ge.logLevel>=Ye.WARN&&((B=console.warn)===null||B===void 0||B.call(console,`[${Ge.logTag}] `,...L))}static info(...L){var B;Ge.logLevel>=Ye.INFO&&((B=console.info)===null||B===void 0||B.call(console,`[${Ge.logTag}] `,...L))}static log(...L){var B;Ge.logLevel>=Ye.LOG&&((B=console.log)===null||B===void 0||B.call(console,`[${Ge.logTag}] `,...L))}static debug(...L){var B;Ge.logLevel>=Ye.DEBUG&&((B=console.debug)===null||B===void 0||B.call(console,`[${Ge.logTag}] `,...L))}};Be.logLevel=Ye.WARN,Be.logTag="aliyun-audio-3a";let tn=class{},$t=class extends tn{static isSupported(){return function(){if(typeof window=="object"&&window!==null){const L="AudioWorklet"in window,B="WebAssembly"in window;return L&&B}return!1}()}static isSupportedSIMD(){return Je(this,void 0,void 0,function*(){return yield Qt()})}static setLogger(L){Be.logLevel=L}constructor(L){super(),this.channelCount=1,this.sampleRate=48e3,this.collectDumpOutputData=[],this.collectDumpNearInputData=[],this.collectDumpFarInputData=[],this.collectDumpMetaData=[],this.statUpdateTimer=0,this.statUpdateInterval=5e3,this.options=Object.assign({aecOn:!0,ansOn:!0,agcOn:!0,hdOn:!1,ansMode:1,dumpOn:!1,aiaecOn:!1,wasmCdnPath:"https://g.alicdn.com/code/npm/@ali/aliyun-audio-3a/0.0.6/"},L||{})}initWASM(L,B,F){return Je(this,void 0,void 0,function*(){Be.log("initWASM",L,B,F);const $=T=>Je(this,void 0,void 0,function*(){try{const _=yield fetch(T,{credentials:"same-origin"});return _.ok||this.onLoadError(new Error(`Failed to fetch WASM: ${_.status}:${_.statusText}, url:${T}`)),_.arrayBuffer()}catch(_){return this.onLoadError(new Error("WASM load error")),Be.error("Error fetching WASM:",_),new Uint8Array(0)}}),H=T=>Je(this,void 0,void 0,function*(){return fetch(T).then(_=>_.text())});try{const T=yield Qt(),_=this.options.wasmCdnPath+"audio_module_v2.wasm",f=this.options.wasmCdnPath+"audio_module_v2_simd.wasm",m=yield $(T?f:_),h=this.options.wasmCdnPath+"audio_module_v2.js",v=this.options.wasmCdnPath+"audio_module_v2_simd.js",u=T?v:h,s=yield H(u);L.port.postMessage(Object.assign({type:"init",channelCount:B,sampleRate:F,wasmBuffer:m,isSupportSIMD:T,audioModuleScript:s,logLevel:Be.logLevel},this.options),[m])}catch(T){Be.error("Error initializing WASM:",T),this.onLoadError(new Error("WASM init error"))}L.port.onmessage=T=>{T.data.type==="init_done"&&this.onLoadSuccess(void 0),T.data.type==="dump_output_data"&&this.onDumpOutputData(T.data.data),T.data.type==="dump_near_data"&&this.onDumpNearInputData(T.data.data),T.data.type==="dump_far_data"&&this.onDumpFarInputData(T.data.data),T.data.type==="dump_meta_data"&&this.onDumpMeatData(T.data.data),T.data.type==="output_log"&&this.onOutputLog(T.data.data),T.data.type==="apm_stat_data"&&this.onStatData(T.data.data)}})}createProcessor(L,B,F,$,H){return Je(this,void 0,void 0,function*(){this.audioContext=L,this.audioContext.resume(),this.channelCount=F,this.sampleRate=$;try{const f=new Blob(['!function(){"use strict";function t(t,e,a,n){return new(a||(a=Promise))((function(s,i){function o(t){try{h(n.next(t))}catch(t){i(t)}}function r(t){try{h(n.throw(t))}catch(t){i(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof a?e:new a((function(t){t(e)}))).then(o,r)}h((n=n.apply(t,e||[])).next())}))}var e;"function"==typeof SuppressedError&&SuppressedError,function(t){t[t.ERROR=0]="ERROR",t[t.WARN=1]="WARN",t[t.INFO=2]="INFO",t[t.LOG=3]="LOG",t[t.DEBUG=4]="DEBUG"}(e||(e={}));class a{static error(...t){var n;a.logLevel>=e.ERROR&&(null===(n=console.error)||void 0===n||n.call(console,`[${a.logTag}] `,...t))}static warn(...t){var n;a.logLevel>=e.WARN&&(null===(n=console.warn)||void 0===n||n.call(console,`[${a.logTag}] `,...t))}static info(...t){var n;a.logLevel>=e.INFO&&(null===(n=console.info)||void 0===n||n.call(console,`[${a.logTag}] `,...t))}static log(...t){var n;a.logLevel>=e.LOG&&(null===(n=console.log)||void 0===n||n.call(console,`[${a.logTag}] `,...t))}static debug(...t){var n;a.logLevel>=e.DEBUG&&(null===(n=console.debug)||void 0===n||n.call(console,`[${a.logTag}] `,...t))}}a.logLevel=e.WARN,a.logTag="aliyun-audio-3a";const n=Float32Array.BYTES_PER_ELEMENT,s=Uint16Array.BYTES_PER_ELEMENT;class i{constructor(t,e,a,n,s){this._channelData=[],this._name=t,this._isInitialized=!1,this._module=e,this._length=a,this._ringLength=2*a,this._maxChannelCount=s?Math.min(s,32):n,this._channelCount=n,this._allocateHeap(),this._isInitialized=!0,this._readIndex=0,this._writeIndex=0,this._framesAvailable=0,this._channelDataLocal=[];for(let t=0;t<this._channelCount;++t)this._channelDataLocal[t]=new Float32Array(this._ringLength)}_allocateHeap(){const t=this._length*n,e=this._channelCount*t;this._dataPtr=this._module._malloc(e),this._channelData=[];for(let e=0;e<this._channelCount;++e){const a=this._dataPtr+e*t,n=a+t;this._channelData[e]=this._module.HEAPF32.subarray(a>>s,n>>s)}}adaptChannel(t){t<this._maxChannelCount&&(this._channelCount=t)}get length(){return this._isInitialized?this._length:null}get numberOfChannels(){return this._isInitialized?this._channelCount:null}get maxChannelCount(){return this._isInitialized?this._maxChannelCount:null}getChannelData(t){return void 0!==t&&t>=this._channelCount?null:void 0===t?this._channelData:this._channelData[t]}getHeapAddress(){return this._dataPtr}getPointer(){return this._dataPtr}free(){this._isInitialized=!1,null!==this._dataPtr&&this._module._free(this._dataPtr),this._channelData=[]}get framesAvailable(){return this._framesAvailable}push(t){const e=t[0].length;for(let a=0;a<e;++a){for(let e=0;e<this._channelCount;++e)this._channelDataLocal[e][this._writeIndex]=t[e][a];this._writeIndex=(this._writeIndex+1)%this._ringLength}this._framesAvailable+=e,this._framesAvailable>this._ringLength&&(console.warn(this._name,"Too many frames available, overflow"),this._framesAvailable=this._ringLength,this._writeIndex=0)}pull(t){if(0===this._framesAvailable)return void console.warn(this._name,"No frames available");const e=t[0].length;for(let a=0;a<e;++a){for(let e=0;e<this._channelCount;++e)t[e][a]=this._channelDataLocal[e][this._readIndex];this._readIndex=(this._readIndex+1)%this._ringLength}this._framesAvailable-=e,this._framesAvailable<0&&(this._framesAvailable=0,this._readIndex=0)}}class o{constructor(t){this.inited=!1,this.handle=null,this.channelCount=1,this.isEnable=!0,this.dumpAudioData=!1,this.kernelBufferSize=512,this.node=t,this.onDumpOutputDataFunction=null,this.onDumpNearDataFunction=null,this.onDumpFarDataFunction=null,this.onDumpMetaDataFunction=null,this.wasmInvoker=null,this._nearAudioBuffer={},this._outputAudioBuffer={}}destructor(){this.wasmInvoker=null,this.handle=null}init(n){return t(this,void 0,void 0,(function*(){const{wasmBuffer:t,audioModuleScript:s,channelCount:o=1,sampleRate:r=44100,dumpAudioData:h=!1,logLevel:l=e.DEBUG}=n;a.logLevel=l,a.log("AudioAPM init",JSON.stringify(n)),this.channelCount=o,this.dumpAudioData=h;try{const e=new Function(`let module={};let exports={};${s}; return module`)();this.wasmInvoker=yield e.exports({wasmBinary:t})}catch(t){this.node.port.postMessage({type:"error",message:"audioModule init error"}),a.error(t)}this._nearAudioBuffer=new i("inBuffer",this.wasmInvoker,this.kernelBufferSize,2*this.channelCount,32),this._outputAudioBuffer=new i("outBuffer",this.wasmInvoker,this.kernelBufferSize,this.channelCount,32);const u=this.wasmInvoker.addFunction(((t,e)=>{const a=this.wasmInvoker.HEAPU8.subarray(t,t+e),n=String.fromCharCode.apply(null,a);this.node&&this.node.port&&this.node.port.postMessage({type:"output_log",message:"output_log",data:n})}),"vii");if(this.wasmInvoker.__apm_log_callback(u),this.handle=this.wasmInvoker.__apm_create(n.aecOn?1:0,n.ansOn?1:0,n.agcOn?1:0,n.hdOn?1:0,r,o,n.dumpOn?1:0,this.kernelBufferSize),n.aiaecOn){const t=102;this.wasmInvoker.__apm_set_param(this.handle,t,7)}if(n.useHardOnly){const t=108;this.wasmInvoker.__apm_set_param(this.handle,t,1)}this.node.port.postMessage({type:"init_done",message:"init done"}),this.inited=!0}))}getStatData(){if(this.wasmInvoker&&this.isEnable){let t=this.wasmInvoker.__apm_get_stat(this.handle),e=this.wasmInvoker.UTF8ToString(t);this.wasmInvoker._free(t),this.node&&this.node.port&&this.node.port.postMessage({type:"apm_stat_data",message:"apm_stat_data",data:e})}}onOutputLog(t){console.log("[WASM_LOG]",t)}destory(){return t(this,void 0,void 0,(function*(){var t;try{null===(t=this.wasmInvoker)||void 0===t||t.__apm_destory(this.handle),this.inited=!1}catch(t){a.error(t)}finally{this.handle=null}}))}enable(){this.isEnable=!0,a.log("APM enable")}disable(){this.isEnable=!1,a.log("APM disable")}getStat(){if(null==this.wasmInvoker||null==this.handle)return"";let t=this.wasmInvoker.__apm_get_stat(this.handle),e=this.wasmInvoker.UTF8ToString(t);return this.wasmInvoker._free(t),e}startDump(){this.onDumpOutputDataFunction=this.wasmInvoker.addFunction(((t,e)=>{const a=this.wasmInvoker.HEAPU8.subarray(t,t+e),n=new Uint8Array(a);this.node&&this.node.port&&this.node.port.postMessage({type:"dump_output_data",message:"dump_output_data",data:n})}),"vii"),this.onDumpNearDataFunction=this.wasmInvoker.addFunction(((t,e)=>{const a=this.wasmInvoker.HEAPU8.subarray(t,t+e),n=new Uint8Array(a);this.node&&this.node.port&&this.node.port.postMessage({type:"dump_near_data",message:"dump_near_data",data:n})}),"vii"),this.onDumpFarDataFunction=this.wasmInvoker.addFunction(((t,e)=>{const a=this.wasmInvoker.HEAPU8.subarray(t,t+e),n=new Uint8Array(a);this.node&&this.node.port&&this.node.port.postMessage({type:"dump_far_data",message:"dump_far_data",data:n})}),"vii"),this.onDumpMetaDataFunction=this.wasmInvoker.addFunction(((t,e)=>{const a=this.wasmInvoker.HEAPU8.subarray(t,t+e),n=new Uint8Array(a);this.node&&this.node.port&&this.node.port.postMessage({type:"dump_meta_data",message:"dump_meta_data",data:n})}),"vii"),this.wasmInvoker.__apm_dump_start(this.handle,this.onDumpOutputDataFunction,this.onDumpNearDataFunction,this.onDumpFarDataFunction,this.onDumpMetaDataFunction)}stopDump(){this.wasmInvoker.__apm_dump_stop(this.handle),this.wasmInvoker&&(this.wasmInvoker.removeFunction(this.onDumpOutputDataFunction),this.wasmInvoker.removeFunction(this.onDumpNearDataFunction),this.wasmInvoker.removeFunction(this.onDumpFarDataFunction),this.wasmInvoker.removeFunction(this.onDumpMetaDataFunction))}process(t,e,a){if(!this.inited||!this.isEnable){for(let e=0;e<this.channelCount;e++){a[e].set(t[e])}return}const n=this.channelCount;let s=0;if(this.handle&&this.isEnable){const i=t[0].length,o=[];for(let a=0;a<n;a++)e[a]&&e[a].length>0&&(s=1),o.push(t[a]||new Float32Array(i).fill(0)),o.push(e[a]||new Float32Array(i).fill(0));if(this._nearAudioBuffer.push(o),this._nearAudioBuffer.framesAvailable>=this.kernelBufferSize){this._nearAudioBuffer.pull(this._nearAudioBuffer.getChannelData()),this.wasmInvoker.__apm_process_new(this.handle,this._nearAudioBuffer.getHeapAddress(),this._outputAudioBuffer.getHeapAddress(),n,s);const t=this._outputAudioBuffer.getChannelData();this._outputAudioBuffer.push(t)}this._outputAudioBuffer.pull(a)}}}class r extends AudioWorkletProcessor{constructor(){super(),this.apm=new o(this),this.port.onmessage=t=>{const e=t.data||{};switch(a.log("onmessage data",e),e.type){case"init":this.apm.init(e);break;case"destroy":this.apm.destory();break;case"enable":this.apm.enable();break;case"disable":this.apm.disable();break;case"start_dump":this.apm.startDump();break;case"stop_dump":this.apm.stopDump();break;case"get_stat_data":this.apm.getStatData();break;default:a.warn("Unknown message type:",e.type)}}}process(t,e){const a=t[0],n=t.length>1?t[1]:[],s=e[0];return this.apm.process(a,n,s),!0}}registerProcessor("aliyun-web-3a-processor",r)}();\n'],{type:"application/javascript"}),l=URL.createObjectURL(f);yield this.audioContext.audioWorklet.addModule(l)}catch(f){Be.error("Failed to add module to audio worklet:",f)}let T=new AudioWorkletNode(this.audioContext,"aliyun-web-3a-processor",{numberOfInputs:2,outputChannelCount:[F]});this.workletNode=T,B.connect(T),H&&(this.farNode=H,H.connect(T,0,1));const _=this.audioContext.createMediaStreamDestination();T.connect(_),this.targetMediaTrack=_.stream.getAudioTracks()[0],yield this.initWASM(T,F,$),this.statUpdateTimer=window.setInterval(()=>{this.getStatData()},this.statUpdateInterval)})}addFarNode(L){this.workletNode&&(this.farNode&&this.farNode.disconnect(this.workletNode),L&&(this.farNode=L,L.connect(this.workletNode,0,1)))}getStatData(){var L;try{(L=this.workletNode)===null||L===void 0||L.port.postMessage({type:"get_stat_data"})}catch(B){Be.error("Failed to post message to worklet node:",B)}}destroy(){if(this.statUpdateTimer&&window.clearInterval(this.statUpdateTimer),this.audioContext&&this.workletNode&&this.workletNode.port)try{this.workletNode.port.postMessage({type:"destroy"}),this.workletNode.port.onmessage=null,this.workletNode.disconnect(),Be.log("postMessage destroy")}catch(L){Be.error("Failed to post message to worklet node:",L)}}startDump(){var L;try{(L=this.workletNode)===null||L===void 0||L.port.postMessage({type:"start_dump"})}catch(B){Be.error("Failed to post message to worklet node:",B)}}stopDump(){var L;try{(L=this.workletNode)===null||L===void 0||L.port.postMessage({type:"stop_dump"})}catch(B){Be.error("Failed to post message to worklet node:",B)}setTimeout(()=>{this.onDumpOutputData(null,!0),this.onDumpNearInputData(null,!0),this.onDumpFarInputData(null,!0),this.onDumpMeatData(null,!0)},3e3)}onDumpOutputData(L,B=!1){if(L&&L.length>0&&this.collectDumpOutputData.push(L),B&&this.collectDumpOutputData.length>0||1024*this.collectDumpOutputData.length>=this.getMaxDumpBytes()){let F=new Blob(this.collectDumpOutputData);this.onDumpData(F,"output_"+this.sampleRate+"hz_"+this.channelCount+"ch.pcm"),this.collectDumpOutputData=[]}}onDumpNearInputData(L,B=!1){if(L&&L.length>0&&this.collectDumpNearInputData.push(L),B&&this.collectDumpNearInputData.length>0||1024*this.collectDumpNearInputData.length>=this.getMaxDumpBytes()){let F=new Blob(this.collectDumpNearInputData);this.onDumpData(F,"near_input_"+this.sampleRate+"hz_"+this.channelCount+"ch.pcm"),this.collectDumpNearInputData=[]}}onDumpFarInputData(L,B=!1){if(L&&L.length>0&&this.collectDumpFarInputData.push(L),B&&this.collectDumpFarInputData.length>0||1024*this.collectDumpFarInputData.length>=this.getMaxDumpBytes()){let F=new Blob(this.collectDumpFarInputData);this.onDumpData(F,"far_input_"+this.sampleRate+"hz_"+this.channelCount+"ch.pcm"),this.collectDumpFarInputData=[]}}onDumpMeatData(L,B=!1){if(L&&L.length>0&&this.collectDumpMetaData.push(L),B&&this.collectDumpMetaData.length>0||1024*this.collectDumpMetaData.length>=this.getMaxDumpBytes()){let F=new Blob(this.collectDumpMetaData);this.onDumpData(F,"meta_"+this.sampleRate+"hz_"+this.channelCount+"ch.pcm"),this.collectDumpMetaData=[]}}getMaxDumpBytes(){return 600*Number(this.sampleRate.toFixed(0))*Number(this.channelCount.toFixed(0))*2}enable(){var L;if(!((L=this.workletNode)===null||L===void 0)&&L.port)try{this.workletNode.port.postMessage({type:"enable"}),Be.log("postMessage enable")}catch(B){Be.error("Failed to post message to worklet node:",B)}}disable(){var L;if(!((L=this.workletNode)===null||L===void 0)&&L.port)try{Be.log("postMessage disable"),this.workletNode.port.postMessage({type:"disable"})}catch(B){Be.error("Failed to post message to worklet node:",B)}}on(L,B){L==="loaderror"&&(this.onLoadError=B),L==="loadsuccess"&&(this.onLoadSuccess=B),L==="dumpdata"&&(this.onDumpData=B),L==="outputlog"&&(this.onOutputLog=B),L==="statdata"&&(this.onStatData=B)}onLoadError(L){console.log("onLoadError",L)}onLoadSuccess(L){console.log("onLoadSuccess",L)}onDumpData(L,B){console.log("onDumpData",L,B)}onOutputLog(L){console.log("[WASM]",L)}onStatData(L){console.log("onStatData:",L)}};function rn(Y,L,B){Object.defineProperty(Y,L,{writable:!0,enumerable:!0,configurable:!0,value:B})}function Jt(Y,L,B,F){rn(Y,L,B)}Array(32);class nn{constructor(L){this.timer=null,this.time=10,this.count=10,this.arr=[];var B,F;this.time=(B=L.time)!=null?B:10,this.count=(F=L.count)!=null?F:10,L.host.startsWith("http://")||L.host.startsWith("https://")?this.url=L.host+"/logstores/"+L.logstore+"/track":this.url="https://"+L.project+"."+L.host+"/logstores/"+L.logstore+"/track",this.opt=L,L.installUnloadHook&&typeof L.installUnloadHook=="function"&&L.installUnloadHook(()=>{this.sendImmediateInner()})}assemblePayload(L){const B={__logs__:L};return this.opt.tags&&(B.__tags__=this.opt.tags),this.opt.topic&&(B.__topic__=this.opt.topic),this.opt.source&&(B.__source__=this.opt.source),JSON.stringify(B)}platformSend(){if(this.opt.sendPayload&&typeof this.opt.sendPayload=="function"){const L=this.assemblePayload(this.arr);this.opt.sendPayload(this.url,L)}}transString(L){let B={};for(let F in L)typeof L[F]=="object"?B[F]=JSON.stringify(L[F]):B[F]=String(L[F]);return B}sendImmediateInner(){this.arr&&this.arr.length>0&&(this.platformSend(),this.timer!=null&&(clearTimeout(this.timer),this.timer=null),this.arr=[])}sendInner(){if(this.timer)this.arr.length>=this.count&&(clearTimeout(this.timer),this.timer=null,this.sendImmediateInner());else{const L=this;this.arr.length>=this.count||this.time<=0?this.sendImmediateInner():this.timer=setTimeout(function(){L.sendImmediateInner()},this.time*1e3)}}send(L){const B=this.transString(L);this.arr.push(B),this.sendInner()}sendImmediate(L){const B=this.transString(L);this.arr.push(B),this.sendImmediateInner()}sendBatchLogs(L){const B=L.map(F=>this.transString(F));this.arr.push(...B),this.sendInner()}sendBatchLogsImmediate(L){const B=L.map(F=>this.transString(F));this.arr.push(...B),this.sendImmediateInner()}overwriteTransString(L){this.transString=L.transString}getOpt(){return this.opt}}var on=(Y,L,B)=>new Promise((F,$)=>{var H=f=>{try{_(B.next(f))}catch(l){$(l)}},T=f=>{try{_(B.throw(f))}catch(l){$(l)}},_=f=>f.done?F(f.value):Promise.resolve(f.value).then(H,T);_((B=B.apply(Y,L)).next())});function an(Y,L){return navigator&&navigator.sendBeacon?navigator.sendBeacon(`${Y}?APIVersion=0.6.0`,L):!1}function Zt(Y,L){const B=new window.XMLHttpRequest;B.open("POST",`${Y}?APIVersion=0.6.0`,!0),B.send(L)}function sn(Y,L){try{if(L.length>=32768){Zt(Y,L);return}an(Y,L)||Zt(Y,L)}catch(B){window&&window.console&&typeof window.console.error=="function"&&(console.error(`Failed to log to ali log service because of this exception:
2
+ `+B),console.error("Failed log data:",Y))}}function cn(Y,L,B){return on(this,null,function*(){try{Y=Y.slice(0,-6);const{data:F,header:$}=yield B.process(Y,L),H=new window.XMLHttpRequest;H.open("POST",Y,!0);for(let T in $)H.setRequestHeader(T,$[T]);H.send(F)}catch(F){window&&window.console&&typeof window.console.error=="function"&&(console.error(`Failed to log to ali log service because of this exception:
3
+ `+F),console.error("Failed log data:",Y))}})}class er extends nn{constructor(L){const B=Object.assign({},L,{installUnloadHook:F=>{window.addEventListener("beforeunload",()=>{F()})},sendPayload:(F,$)=>{sn(F,$)}});super(B)}useStsPlugin(L){this.getOpt().sendPayload=(B,F)=>{cn(B,F,L)},this.overwriteTransString(L)}}Jt(window,"SLS_Tracker",er);var ye=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function un(Y){return Y&&Y.__esModule&&Object.prototype.hasOwnProperty.call(Y,"default")?Y.default:Y}var tr={exports:{}};function dn(Y){throw new Error('Could not dynamically require "'+Y+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var st={exports:{}},rr;function Se(){return rr||(rr=1,function(Y,L){(function(B,F){Y.exports=F()})(ye,function(){var B=B||function(F,$){var H;if(typeof window<"u"&&window.crypto&&(H=window.crypto),typeof self<"u"&&self.crypto&&(H=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(H=globalThis.crypto),!H&&typeof window<"u"&&window.msCrypto&&(H=window.msCrypto),!H&&typeof ye<"u"&&ye.crypto&&(H=ye.crypto),!H&&typeof dn=="function")try{H=require("crypto")}catch{}var T=function(){if(H){if(typeof H.getRandomValues=="function")try{return H.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof H.randomBytes=="function")try{return H.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},_=Object.create||function(){function r(){}return function(a){var t;return r.prototype=a,t=new r,r.prototype=null,t}}(),f={},l=f.lib={},m=l.Base=function(){return{extend:function(r){var a=_(this);return r&&a.mixIn(r),(!a.hasOwnProperty("init")||this.init===a.init)&&(a.init=function(){a.$super.init.apply(this,arguments)}),a.init.prototype=a,a.$super=this,a},create:function(){var r=this.extend();return r.init.apply(r,arguments),r},init:function(){},mixIn:function(r){for(var a in r)r.hasOwnProperty(a)&&(this[a]=r[a]);r.hasOwnProperty("toString")&&(this.toString=r.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),h=l.WordArray=m.extend({init:function(r,a){r=this.words=r||[],a!=$?this.sigBytes=a:this.sigBytes=r.length*4},toString:function(r){return(r||u).stringify(this)},concat:function(r){var a=this.words,t=r.words,n=this.sigBytes,c=r.sigBytes;if(this.clamp(),n%4)for(var p=0;p<c;p++){var C=t[p>>>2]>>>24-p%4*8&255;a[n+p>>>2]|=C<<24-(n+p)%4*8}else for(var x=0;x<c;x+=4)a[n+x>>>2]=t[x>>>2];return this.sigBytes+=c,this},clamp:function(){var r=this.words,a=this.sigBytes;r[a>>>2]&=4294967295<<32-a%4*8,r.length=F.ceil(a/4)},clone:function(){var r=m.clone.call(this);return r.words=this.words.slice(0),r},random:function(r){for(var a=[],t=0;t<r;t+=4)a.push(T());return new h.init(a,r)}}),v=f.enc={},u=v.Hex={stringify:function(r){for(var a=r.words,t=r.sigBytes,n=[],c=0;c<t;c++){var p=a[c>>>2]>>>24-c%4*8&255;n.push((p>>>4).toString(16)),n.push((p&15).toString(16))}return n.join("")},parse:function(r){for(var a=r.length,t=[],n=0;n<a;n+=2)t[n>>>3]|=parseInt(r.substr(n,2),16)<<24-n%8*4;return new h.init(t,a/2)}},s=v.Latin1={stringify:function(r){for(var a=r.words,t=r.sigBytes,n=[],c=0;c<t;c++){var p=a[c>>>2]>>>24-c%4*8&255;n.push(String.fromCharCode(p))}return n.join("")},parse:function(r){for(var a=r.length,t=[],n=0;n<a;n++)t[n>>>2]|=(r.charCodeAt(n)&255)<<24-n%4*8;return new h.init(t,a)}},i=v.Utf8={stringify:function(r){try{return decodeURIComponent(escape(s.stringify(r)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(r){return s.parse(unescape(encodeURIComponent(r)))}},e=l.BufferedBlockAlgorithm=m.extend({reset:function(){this._data=new h.init,this._nDataBytes=0},_append:function(r){typeof r=="string"&&(r=i.parse(r)),this._data.concat(r),this._nDataBytes+=r.sigBytes},_process:function(r){var a,t=this._data,n=t.words,c=t.sigBytes,p=this.blockSize,C=p*4,x=c/C;r?x=F.ceil(x):x=F.max((x|0)-this._minBufferSize,0);var y=x*p,E=F.min(y*4,c);if(y){for(var S=0;S<y;S+=p)this._doProcessBlock(n,S);a=n.splice(0,y),t.sigBytes-=E}return new h.init(a,E)},clone:function(){var r=m.clone.call(this);return r._data=this._data.clone(),r},_minBufferSize:0});l.Hasher=e.extend({cfg:m.extend(),init:function(r){this.cfg=this.cfg.extend(r),this.reset()},reset:function(){e.reset.call(this),this._doReset()},update:function(r){return this._append(r),this._process(),this},finalize:function(r){r&&this._append(r);var a=this._doFinalize();return a},blockSize:16,_createHelper:function(r){return function(a,t){return new r.init(t).finalize(a)}},_createHmacHelper:function(r){return function(a,t){return new o.HMAC.init(r,t).finalize(a)}}});var o=f.algo={};return f}(Math);return B})}(st)),st.exports}var ct={exports:{}},nr;function rt(){return nr||(nr=1,function(Y,L){(function(B,F){Y.exports=F(Se())})(ye,function(B){return function(F){var $=B,H=$.lib,T=H.Base,_=H.WordArray,f=$.x64={};f.Word=T.extend({init:function(l,m){this.high=l,this.low=m}}),f.WordArray=T.extend({init:function(l,m){l=this.words=l||[],m!=F?this.sigBytes=m:this.sigBytes=l.length*8},toX32:function(){for(var l=this.words,m=l.length,h=[],v=0;v<m;v++){var u=l[v];h.push(u.high),h.push(u.low)}return _.create(h,this.sigBytes)},clone:function(){for(var l=T.clone.call(this),m=l.words=this.words.slice(0),h=m.length,v=0;v<h;v++)m[v]=m[v].clone();return l}})}(),B})}(ct)),ct.exports}var ut={exports:{}},or;function ln(){return or||(or=1,function(Y,L){(function(B,F){Y.exports=F(Se())})(ye,function(B){return function(){if(typeof ArrayBuffer=="function"){var F=B,$=F.lib,H=$.WordArray,T=H.init,_=H.init=function(f){if(f instanceof ArrayBuffer&&(f=new Uint8Array(f)),(f instanceof Int8Array||typeof Uint8ClampedArray<"u"&&f instanceof Uint8ClampedArray||f instanceof Int16Array||f instanceof Uint16Array||f instanceof Int32Array||f instanceof Uint32Array||f instanceof Float32Array||f instanceof Float64Array)&&(f=new Uint8Array(f.buffer,f.byteOffset,f.byteLength)),f instanceof Uint8Array){for(var l=f.byteLength,m=[],h=0;h<l;h++)m[h>>>2]|=f[h]<<24-h%4*8;T.call(this,m,l)}else T.apply(this,arguments)};_.prototype=H}}(),B.lib.WordArray})}(ut)),ut.exports}var dt={exports:{}},ir;function pn(){return ir||(ir=1,function(Y,L){(function(B,F){Y.exports=F(Se())})(ye,function(B){return function(){var F=B,$=F.lib,H=$.WordArray,T=F.enc;T.Utf16=T.Utf16BE={stringify:function(f){for(var l=f.words,m=f.sigBytes,h=[],v=0;v<m;v+=2){var u=l[v>>>2]>>>16-v%4*8&65535;h.push(String.fromCharCode(u))}return h.join("")},parse:function(f){for(var l=f.length,m=[],h=0;h<l;h++)m[h>>>1]|=f.charCodeAt(h)<<16-h%2*16;return H.create(m,l*2)}},T.Utf16LE={stringify:function(f){for(var l=f.words,m=f.sigBytes,h=[],v=0;v<m;v+=2){var u=_(l[v>>>2]>>>16-v%4*8&65535);h.push(String.fromCharCode(u))}return h.join("")},parse:function(f){for(var l=f.length,m=[],h=0;h<l;h++)m[h>>>1]|=_(f.charCodeAt(h)<<16-h%2*16);return H.create(m,l*2)}};function _(f){return f<<8&4278255360|f>>>8&16711935}}(),B.enc.Utf16})}(dt)),dt.exports}var lt={exports:{}},ar;function Qe(){return ar||(ar=1,function(Y,L){(function(B,F){Y.exports=F(Se())})(ye,function(B){return function(){var F=B,$=F.lib,H=$.WordArray,T=F.enc;T.Base64={stringify:function(f){var l=f.words,m=f.sigBytes,h=this._map;f.clamp();for(var v=[],u=0;u<m;u+=3)for(var s=l[u>>>2]>>>24-u%4*8&255,i=l[u+1>>>2]>>>24-(u+1)%4*8&255,e=l[u+2>>>2]>>>24-(u+2)%4*8&255,o=s<<16|i<<8|e,r=0;r<4&&u+r*.75<m;r++)v.push(h.charAt(o>>>6*(3-r)&63));var a=h.charAt(64);if(a)for(;v.length%4;)v.push(a);return v.join("")},parse:function(f){var l=f.length,m=this._map,h=this._reverseMap;if(!h){h=this._reverseMap=[];for(var v=0;v<m.length;v++)h[m.charCodeAt(v)]=v}var u=m.charAt(64);if(u){var s=f.indexOf(u);s!==-1&&(l=s)}return _(f,l,h)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function _(f,l,m){for(var h=[],v=0,u=0;u<l;u++)if(u%4){var s=m[f.charCodeAt(u-1)]<<u%4*2,i=m[f.charCodeAt(u)]>>>6-u%4*2,e=s|i;h[v>>>2]|=e<<24-v%4*8,v++}return H.create(h,v)}}(),B.enc.Base64})}(lt)),lt.exports}var pt={exports:{}},sr;function fn(){return sr||(sr=1,function(Y,L){(function(B,F){Y.exports=F(Se())})(ye,function(B){return function(){var F=B,$=F.lib,H=$.WordArray,T=F.enc;T.Base64url={stringify:function(f,l){l===void 0&&(l=!0);var m=f.words,h=f.sigBytes,v=l?this._safe_map:this._map;f.clamp();for(var u=[],s=0;s<h;s+=3)for(var i=m[s>>>2]>>>24-s%4*8&255,e=m[s+1>>>2]>>>24-(s+1)%4*8&255,o=m[s+2>>>2]>>>24-(s+2)%4*8&255,r=i<<16|e<<8|o,a=0;a<4&&s+a*.75<h;a++)u.push(v.charAt(r>>>6*(3-a)&63));var t=v.charAt(64);if(t)for(;u.length%4;)u.push(t);return u.join("")},parse:function(f,l){l===void 0&&(l=!0);var m=f.length,h=l?this._safe_map:this._map,v=this._reverseMap;if(!v){v=this._reverseMap=[];for(var u=0;u<h.length;u++)v[h.charCodeAt(u)]=u}var s=h.charAt(64);if(s){var i=f.indexOf(s);i!==-1&&(m=i)}return _(f,m,v)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function _(f,l,m){for(var h=[],v=0,u=0;u<l;u++)if(u%4){var s=m[f.charCodeAt(u-1)]<<u%4*2,i=m[f.charCodeAt(u)]>>>6-u%4*2,e=s|i;h[v>>>2]|=e<<24-v%4*8,v++}return H.create(h,v)}}(),B.enc.Base64url})}(pt)),pt.exports}var ft={exports:{}},cr;function $e(){return cr||(cr=1,function(Y,L){(function(B,F){Y.exports=F(Se())})(ye,function(B){return function(F){var $=B,H=$.lib,T=H.WordArray,_=H.Hasher,f=$.algo,l=[];(function(){for(var i=0;i<64;i++)l[i]=F.abs(F.sin(i+1))*4294967296|0})();var m=f.MD5=_.extend({_doReset:function(){this._hash=new T.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(i,e){for(var o=0;o<16;o++){var r=e+o,a=i[r];i[r]=(a<<8|a>>>24)&16711935|(a<<24|a>>>8)&4278255360}var t=this._hash.words,n=i[e+0],c=i[e+1],p=i[e+2],C=i[e+3],x=i[e+4],y=i[e+5],E=i[e+6],S=i[e+7],d=i[e+8],R=i[e+9],D=i[e+10],A=i[e+11],b=i[e+12],g=i[e+13],O=i[e+14],k=i[e+15],U=t[0],w=t[1],W=t[2],M=t[3];U=h(U,w,W,M,n,7,l[0]),M=h(M,U,w,W,c,12,l[1]),W=h(W,M,U,w,p,17,l[2]),w=h(w,W,M,U,C,22,l[3]),U=h(U,w,W,M,x,7,l[4]),M=h(M,U,w,W,y,12,l[5]),W=h(W,M,U,w,E,17,l[6]),w=h(w,W,M,U,S,22,l[7]),U=h(U,w,W,M,d,7,l[8]),M=h(M,U,w,W,R,12,l[9]),W=h(W,M,U,w,D,17,l[10]),w=h(w,W,M,U,A,22,l[11]),U=h(U,w,W,M,b,7,l[12]),M=h(M,U,w,W,g,12,l[13]),W=h(W,M,U,w,O,17,l[14]),w=h(w,W,M,U,k,22,l[15]),U=v(U,w,W,M,c,5,l[16]),M=v(M,U,w,W,E,9,l[17]),W=v(W,M,U,w,A,14,l[18]),w=v(w,W,M,U,n,20,l[19]),U=v(U,w,W,M,y,5,l[20]),M=v(M,U,w,W,D,9,l[21]),W=v(W,M,U,w,k,14,l[22]),w=v(w,W,M,U,x,20,l[23]),U=v(U,w,W,M,R,5,l[24]),M=v(M,U,w,W,O,9,l[25]),W=v(W,M,U,w,C,14,l[26]),w=v(w,W,M,U,d,20,l[27]),U=v(U,w,W,M,g,5,l[28]),M=v(M,U,w,W,p,9,l[29]),W=v(W,M,U,w,S,14,l[30]),w=v(w,W,M,U,b,20,l[31]),U=u(U,w,W,M,y,4,l[32]),M=u(M,U,w,W,d,11,l[33]),W=u(W,M,U,w,A,16,l[34]),w=u(w,W,M,U,O,23,l[35]),U=u(U,w,W,M,c,4,l[36]),M=u(M,U,w,W,x,11,l[37]),W=u(W,M,U,w,S,16,l[38]),w=u(w,W,M,U,D,23,l[39]),U=u(U,w,W,M,g,4,l[40]),M=u(M,U,w,W,n,11,l[41]),W=u(W,M,U,w,C,16,l[42]),w=u(w,W,M,U,E,23,l[43]),U=u(U,w,W,M,R,4,l[44]),M=u(M,U,w,W,b,11,l[45]),W=u(W,M,U,w,k,16,l[46]),w=u(w,W,M,U,p,23,l[47]),U=s(U,w,W,M,n,6,l[48]),M=s(M,U,w,W,S,10,l[49]),W=s(W,M,U,w,O,15,l[50]),w=s(w,W,M,U,y,21,l[51]),U=s(U,w,W,M,b,6,l[52]),M=s(M,U,w,W,C,10,l[53]),W=s(W,M,U,w,D,15,l[54]),w=s(w,W,M,U,c,21,l[55]),U=s(U,w,W,M,d,6,l[56]),M=s(M,U,w,W,k,10,l[57]),W=s(W,M,U,w,E,15,l[58]),w=s(w,W,M,U,g,21,l[59]),U=s(U,w,W,M,x,6,l[60]),M=s(M,U,w,W,A,10,l[61]),W=s(W,M,U,w,p,15,l[62]),w=s(w,W,M,U,R,21,l[63]),t[0]=t[0]+U|0,t[1]=t[1]+w|0,t[2]=t[2]+W|0,t[3]=t[3]+M|0},_doFinalize:function(){var i=this._data,e=i.words,o=this._nDataBytes*8,r=i.sigBytes*8;e[r>>>5]|=128<<24-r%32;var a=F.floor(o/4294967296),t=o;e[(r+64>>>9<<4)+15]=(a<<8|a>>>24)&16711935|(a<<24|a>>>8)&4278255360,e[(r+64>>>9<<4)+14]=(t<<8|t>>>24)&16711935|(t<<24|t>>>8)&4278255360,i.sigBytes=(e.length+1)*4,this._process();for(var n=this._hash,c=n.words,p=0;p<4;p++){var C=c[p];c[p]=(C<<8|C>>>24)&16711935|(C<<24|C>>>8)&4278255360}return n},clone:function(){var i=_.clone.call(this);return i._hash=this._hash.clone(),i}});function h(i,e,o,r,a,t,n){var c=i+(e&o|~e&r)+a+n;return(c<<t|c>>>32-t)+e}function v(i,e,o,r,a,t,n){var c=i+(e&r|o&~r)+a+n;return(c<<t|c>>>32-t)+e}function u(i,e,o,r,a,t,n){var c=i+(e^o^r)+a+n;return(c<<t|c>>>32-t)+e}function s(i,e,o,r,a,t,n){var c=i+(o^(e|~r))+a+n;return(c<<t|c>>>32-t)+e}$.MD5=_._createHelper(m),$.HmacMD5=_._createHmacHelper(m)}(Math),B.MD5})}(ft)),ft.exports}var ht={exports:{}},ur;function dr(){return ur||(ur=1,function(Y,L){(function(B,F){Y.exports=F(Se())})(ye,function(B){return function(){var F=B,$=F.lib,H=$.WordArray,T=$.Hasher,_=F.algo,f=[],l=_.SHA1=T.extend({_doReset:function(){this._hash=new H.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(m,h){for(var v=this._hash.words,u=v[0],s=v[1],i=v[2],e=v[3],o=v[4],r=0;r<80;r++){if(r<16)f[r]=m[h+r]|0;else{var a=f[r-3]^f[r-8]^f[r-14]^f[r-16];f[r]=a<<1|a>>>31}var t=(u<<5|u>>>27)+o+f[r];r<20?t+=(s&i|~s&e)+1518500249:r<40?t+=(s^i^e)+1859775393:r<60?t+=(s&i|s&e|i&e)-1894007588:t+=(s^i^e)-899497514,o=e,e=i,i=s<<30|s>>>2,s=u,u=t}v[0]=v[0]+u|0,v[1]=v[1]+s|0,v[2]=v[2]+i|0,v[3]=v[3]+e|0,v[4]=v[4]+o|0},_doFinalize:function(){var m=this._data,h=m.words,v=this._nDataBytes*8,u=m.sigBytes*8;return h[u>>>5]|=128<<24-u%32,h[(u+64>>>9<<4)+14]=Math.floor(v/4294967296),h[(u+64>>>9<<4)+15]=v,m.sigBytes=h.length*4,this._process(),this._hash},clone:function(){var m=T.clone.call(this);return m._hash=this._hash.clone(),m}});F.SHA1=T._createHelper(l),F.HmacSHA1=T._createHmacHelper(l)}(),B.SHA1})}(ht)),ht.exports}var vt={exports:{}},lr;function mt(){return lr||(lr=1,function(Y,L){(function(B,F){Y.exports=F(Se())})(ye,function(B){return function(F){var $=B,H=$.lib,T=H.WordArray,_=H.Hasher,f=$.algo,l=[],m=[];(function(){function u(o){for(var r=F.sqrt(o),a=2;a<=r;a++)if(!(o%a))return!1;return!0}function s(o){return(o-(o|0))*4294967296|0}for(var i=2,e=0;e<64;)u(i)&&(e<8&&(l[e]=s(F.pow(i,1/2))),m[e]=s(F.pow(i,1/3)),e++),i++})();var h=[],v=f.SHA256=_.extend({_doReset:function(){this._hash=new T.init(l.slice(0))},_doProcessBlock:function(u,s){for(var i=this._hash.words,e=i[0],o=i[1],r=i[2],a=i[3],t=i[4],n=i[5],c=i[6],p=i[7],C=0;C<64;C++){if(C<16)h[C]=u[s+C]|0;else{var x=h[C-15],y=(x<<25|x>>>7)^(x<<14|x>>>18)^x>>>3,E=h[C-2],S=(E<<15|E>>>17)^(E<<13|E>>>19)^E>>>10;h[C]=y+h[C-7]+S+h[C-16]}var d=t&n^~t&c,R=e&o^e&r^o&r,D=(e<<30|e>>>2)^(e<<19|e>>>13)^(e<<10|e>>>22),A=(t<<26|t>>>6)^(t<<21|t>>>11)^(t<<7|t>>>25),b=p+A+d+m[C]+h[C],g=D+R;p=c,c=n,n=t,t=a+b|0,a=r,r=o,o=e,e=b+g|0}i[0]=i[0]+e|0,i[1]=i[1]+o|0,i[2]=i[2]+r|0,i[3]=i[3]+a|0,i[4]=i[4]+t|0,i[5]=i[5]+n|0,i[6]=i[6]+c|0,i[7]=i[7]+p|0},_doFinalize:function(){var u=this._data,s=u.words,i=this._nDataBytes*8,e=u.sigBytes*8;return s[e>>>5]|=128<<24-e%32,s[(e+64>>>9<<4)+14]=F.floor(i/4294967296),s[(e+64>>>9<<4)+15]=i,u.sigBytes=s.length*4,this._process(),this._hash},clone:function(){var u=_.clone.call(this);return u._hash=this._hash.clone(),u}});$.SHA256=_._createHelper(v),$.HmacSHA256=_._createHmacHelper(v)}(Math),B.SHA256})}(vt)),vt.exports}var Et={exports:{}},pr;function hn(){return pr||(pr=1,function(Y,L){(function(B,F,$){Y.exports=F(Se(),mt())})(ye,function(B){return function(){var F=B,$=F.lib,H=$.WordArray,T=F.algo,_=T.SHA256,f=T.SHA224=_.extend({_doReset:function(){this._hash=new H.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var l=_._doFinalize.call(this);return l.sigBytes-=4,l}});F.SHA224=_._createHelper(f),F.HmacSHA224=_._createHmacHelper(f)}(),B.SHA224})}(Et)),Et.exports}var gt={exports:{}},fr;function hr(){return fr||(fr=1,function(Y,L){(function(B,F,$){Y.exports=F(Se(),rt())})(ye,function(B){return function(){var F=B,$=F.lib,H=$.Hasher,T=F.x64,_=T.Word,f=T.WordArray,l=F.algo;function m(){return _.create.apply(_,arguments)}var h=[m(1116352408,3609767458),m(1899447441,602891725),m(3049323471,3964484399),m(3921009573,2173295548),m(961987163,4081628472),m(1508970993,3053834265),m(2453635748,2937671579),m(2870763221,3664609560),m(3624381080,2734883394),m(310598401,1164996542),m(607225278,1323610764),m(1426881987,3590304994),m(1925078388,4068182383),m(2162078206,991336113),m(2614888103,633803317),m(3248222580,3479774868),m(3835390401,2666613458),m(4022224774,944711139),m(264347078,2341262773),m(604807628,2007800933),m(770255983,1495990901),m(1249150122,1856431235),m(1555081692,3175218132),m(1996064986,2198950837),m(2554220882,3999719339),m(2821834349,766784016),m(2952996808,2566594879),m(3210313671,3203337956),m(3336571891,1034457026),m(3584528711,2466948901),m(113926993,3758326383),m(338241895,168717936),m(666307205,1188179964),m(773529912,1546045734),m(1294757372,1522805485),m(1396182291,2643833823),m(1695183700,2343527390),m(1986661051,1014477480),m(2177026350,1206759142),m(2456956037,344077627),m(2730485921,1290863460),m(2820302411,3158454273),m(3259730800,3505952657),m(3345764771,106217008),m(3516065817,3606008344),m(3600352804,1432725776),m(4094571909,1467031594),m(275423344,851169720),m(430227734,3100823752),m(506948616,1363258195),m(659060556,3750685593),m(883997877,3785050280),m(958139571,3318307427),m(1322822218,3812723403),m(1537002063,2003034995),m(1747873779,3602036899),m(1955562222,1575990012),m(2024104815,1125592928),m(2227730452,2716904306),m(2361852424,442776044),m(2428436474,593698344),m(2756734187,3733110249),m(3204031479,2999351573),m(3329325298,3815920427),m(3391569614,3928383900),m(3515267271,566280711),m(3940187606,3454069534),m(4118630271,4000239992),m(116418474,1914138554),m(174292421,2731055270),m(289380356,3203993006),m(460393269,320620315),m(685471733,587496836),m(852142971,1086792851),m(1017036298,365543100),m(1126000580,2618297676),m(1288033470,3409855158),m(1501505948,4234509866),m(1607167915,987167468),m(1816402316,1246189591)],v=[];(function(){for(var s=0;s<80;s++)v[s]=m()})();var u=l.SHA512=H.extend({_doReset:function(){this._hash=new f.init([new _.init(1779033703,4089235720),new _.init(3144134277,2227873595),new _.init(1013904242,4271175723),new _.init(2773480762,1595750129),new _.init(1359893119,2917565137),new _.init(2600822924,725511199),new _.init(528734635,4215389547),new _.init(1541459225,327033209)])},_doProcessBlock:function(s,i){for(var e=this._hash.words,o=e[0],r=e[1],a=e[2],t=e[3],n=e[4],c=e[5],p=e[6],C=e[7],x=o.high,y=o.low,E=r.high,S=r.low,d=a.high,R=a.low,D=t.high,A=t.low,b=n.high,g=n.low,O=c.high,k=c.low,U=p.high,w=p.low,W=C.high,M=C.low,N=x,P=y,V=E,j=S,z=d,G=R,X=D,re=A,te=b,oe=g,ue=O,se=k,ce=U,de=w,pe=W,he=M,Ee=0;Ee<80;Ee++){var fe,me,ge=v[Ee];if(Ee<16)me=ge.high=s[i+Ee*2]|0,fe=ge.low=s[i+Ee*2+1]|0;else{var be=v[Ee-15],Re=be.high,Te=be.low,Pe=(Re>>>1|Te<<31)^(Re>>>8|Te<<24)^Re>>>7,Oe=(Te>>>1|Re<<31)^(Te>>>8|Re<<24)^(Te>>>7|Re<<25),Ae=v[Ee-2],_e=Ae.high,xe=Ae.low,Me=(_e>>>19|xe<<13)^(_e<<3|xe>>>29)^_e>>>6,Ie=(xe>>>19|_e<<13)^(xe<<3|_e>>>29)^(xe>>>6|_e<<26),ke=v[Ee-7],Ue=ke.high,De=ke.low,I=v[Ee-16],K=I.high,q=I.low;fe=Oe+De,me=Pe+Ue+(fe>>>0<Oe>>>0?1:0),fe=fe+Ie,me=me+Me+(fe>>>0<Ie>>>0?1:0),fe=fe+q,me=me+K+(fe>>>0<q>>>0?1:0),ge.high=me,ge.low=fe}var Q=te&ue^~te&ce,Z=oe&se^~oe&de,ee=N&V^N&z^V&z,J=P&j^P&G^j&G,ie=(N>>>28|P<<4)^(N<<30|P>>>2)^(N<<25|P>>>7),ne=(P>>>28|N<<4)^(P<<30|N>>>2)^(P<<25|N>>>7),ae=(te>>>14|oe<<18)^(te>>>18|oe<<14)^(te<<23|oe>>>9),le=(oe>>>14|te<<18)^(oe>>>18|te<<14)^(oe<<23|te>>>9),ve=h[Ee],Ce=ve.high,We=ve.low,Fe=he+le,ze=pe+ae+(Fe>>>0<he>>>0?1:0),Fe=Fe+Z,ze=ze+Q+(Fe>>>0<Z>>>0?1:0),Fe=Fe+We,ze=ze+Ce+(Fe>>>0<We>>>0?1:0),Fe=Fe+fe,ze=ze+me+(Fe>>>0<fe>>>0?1:0),Xt=ne+J,Qr=ie+ee+(Xt>>>0<ne>>>0?1:0);pe=ce,he=de,ce=ue,de=se,ue=te,se=oe,oe=re+Fe|0,te=X+ze+(oe>>>0<re>>>0?1:0)|0,X=z,re=G,z=V,G=j,V=N,j=P,P=Fe+Xt|0,N=ze+Qr+(P>>>0<Fe>>>0?1:0)|0}y=o.low=y+P,o.high=x+N+(y>>>0<P>>>0?1:0),S=r.low=S+j,r.high=E+V+(S>>>0<j>>>0?1:0),R=a.low=R+G,a.high=d+z+(R>>>0<G>>>0?1:0),A=t.low=A+re,t.high=D+X+(A>>>0<re>>>0?1:0),g=n.low=g+oe,n.high=b+te+(g>>>0<oe>>>0?1:0),k=c.low=k+se,c.high=O+ue+(k>>>0<se>>>0?1:0),w=p.low=w+de,p.high=U+ce+(w>>>0<de>>>0?1:0),M=C.low=M+he,C.high=W+pe+(M>>>0<he>>>0?1:0)},_doFinalize:function(){var s=this._data,i=s.words,e=this._nDataBytes*8,o=s.sigBytes*8;i[o>>>5]|=128<<24-o%32,i[(o+128>>>10<<5)+30]=Math.floor(e/4294967296),i[(o+128>>>10<<5)+31]=e,s.sigBytes=i.length*4,this._process();var r=this._hash.toX32();return r},clone:function(){var s=H.clone.call(this);return s._hash=this._hash.clone(),s},blockSize:1024/32});F.SHA512=H._createHelper(u),F.HmacSHA512=H._createHmacHelper(u)}(),B.SHA512})}(gt)),gt.exports}var yt={exports:{}},vr;function vn(){return vr||(vr=1,function(Y,L){(function(B,F,$){Y.exports=F(Se(),rt(),hr())})(ye,function(B){return function(){var F=B,$=F.x64,H=$.Word,T=$.WordArray,_=F.algo,f=_.SHA512,l=_.SHA384=f.extend({_doReset:function(){this._hash=new T.init([new H.init(3418070365,3238371032),new H.init(1654270250,914150663),new H.init(2438529370,812702999),new H.init(355462360,4144912697),new H.init(1731405415,4290775857),new H.init(2394180231,1750603025),new H.init(3675008525,1694076839),new H.init(1203062813,3204075428)])},_doFinalize:function(){var m=f._doFinalize.call(this);return m.sigBytes-=16,m}});F.SHA384=f._createHelper(l),F.HmacSHA384=f._createHmacHelper(l)}(),B.SHA384})}(yt)),yt.exports}var _t={exports:{}},mr;function mn(){return mr||(mr=1,function(Y,L){(function(B,F,$){Y.exports=F(Se(),rt())})(ye,function(B){return function(F){var $=B,H=$.lib,T=H.WordArray,_=H.Hasher,f=$.x64,l=f.Word,m=$.algo,h=[],v=[],u=[];(function(){for(var e=1,o=0,r=0;r<24;r++){h[e+5*o]=(r+1)*(r+2)/2%64;var a=o%5,t=(2*e+3*o)%5;e=a,o=t}for(var e=0;e<5;e++)for(var o=0;o<5;o++)v[e+5*o]=o+(2*e+3*o)%5*5;for(var n=1,c=0;c<24;c++){for(var p=0,C=0,x=0;x<7;x++){if(n&1){var y=(1<<x)-1;y<32?C^=1<<y:p^=1<<y-32}n&128?n=n<<1^113:n<<=1}u[c]=l.create(p,C)}})();var s=[];(function(){for(var e=0;e<25;e++)s[e]=l.create()})();var i=m.SHA3=_.extend({cfg:_.cfg.extend({outputLength:512}),_doReset:function(){for(var e=this._state=[],o=0;o<25;o++)e[o]=new l.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(e,o){for(var r=this._state,a=this.blockSize/2,t=0;t<a;t++){var n=e[o+2*t],c=e[o+2*t+1];n=(n<<8|n>>>24)&16711935|(n<<24|n>>>8)&4278255360,c=(c<<8|c>>>24)&16711935|(c<<24|c>>>8)&4278255360;var p=r[t];p.high^=c,p.low^=n}for(var C=0;C<24;C++){for(var x=0;x<5;x++){for(var y=0,E=0,S=0;S<5;S++){var p=r[x+5*S];y^=p.high,E^=p.low}var d=s[x];d.high=y,d.low=E}for(var x=0;x<5;x++)for(var R=s[(x+4)%5],D=s[(x+1)%5],A=D.high,b=D.low,y=R.high^(A<<1|b>>>31),E=R.low^(b<<1|A>>>31),S=0;S<5;S++){var p=r[x+5*S];p.high^=y,p.low^=E}for(var g=1;g<25;g++){var y,E,p=r[g],O=p.high,k=p.low,U=h[g];U<32?(y=O<<U|k>>>32-U,E=k<<U|O>>>32-U):(y=k<<U-32|O>>>64-U,E=O<<U-32|k>>>64-U);var w=s[v[g]];w.high=y,w.low=E}var W=s[0],M=r[0];W.high=M.high,W.low=M.low;for(var x=0;x<5;x++)for(var S=0;S<5;S++){var g=x+5*S,p=r[g],N=s[g],P=s[(x+1)%5+5*S],V=s[(x+2)%5+5*S];p.high=N.high^~P.high&V.high,p.low=N.low^~P.low&V.low}var p=r[0],j=u[C];p.high^=j.high,p.low^=j.low}},_doFinalize:function(){var e=this._data,o=e.words;this._nDataBytes*8;var r=e.sigBytes*8,a=this.blockSize*32;o[r>>>5]|=1<<24-r%32,o[(F.ceil((r+1)/a)*a>>>5)-1]|=128,e.sigBytes=o.length*4,this._process();for(var t=this._state,n=this.cfg.outputLength/8,c=n/8,p=[],C=0;C<c;C++){var x=t[C],y=x.high,E=x.low;y=(y<<8|y>>>24)&16711935|(y<<24|y>>>8)&4278255360,E=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360,p.push(E),p.push(y)}return new T.init(p,n)},clone:function(){for(var e=_.clone.call(this),o=e._state=this._state.slice(0),r=0;r<25;r++)o[r]=o[r].clone();return e}});$.SHA3=_._createHelper(i),$.HmacSHA3=_._createHmacHelper(i)}(Math),B.SHA3})}(_t)),_t.exports}var St={exports:{}},Er;function En(){return Er||(Er=1,function(Y,L){(function(B,F){Y.exports=F(Se())})(ye,function(B){/** @preserve
4
4
  (c) 2012 by Cédric Mesnil. All rights reserved.
5
5
 
6
6
  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
@@ -9,25 +9,25 @@ import{o as Jr,k as $r,A as Zr}from"./index-BvRi8Pnp.js";import"eventemitter3";c
9
9
  - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10
10
 
11
11
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12
- */return function(V){var Q=M,j=Q.lib,T=j.WordArray,_=j.Hasher,m=Q.algo,d=T.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),f=T.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),y=T.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),v=T.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),s=T.create([0,1518500249,1859775393,2400959708,2840853838]),c=T.create([1352829926,1548603684,1836072691,2053994217,0]),a=m.RIPEMD160=_.extend({_doReset:function(){this._hash=T.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(u,h){for(var S=0;S<16;S++){var x=h+S,E=u[x];u[x]=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360}var p=this._hash.words,b=s.words,l=c.words,A=d.words,R=f.words,C=y.words,g=v.words,D,O,U,k,w,N,H,F,P,B;N=D=p[0],H=O=p[1],F=U=p[2],P=k=p[3],B=w=p[4];for(var W,S=0;S<80;S+=1)W=D+u[h+A[S]]|0,S<16?W+=e(O,U,k)+b[0]:S<32?W+=r(O,U,k)+b[1]:S<48?W+=i(O,U,k)+b[2]:S<64?W+=o(O,U,k)+b[3]:W+=t(O,U,k)+b[4],W=W|0,W=n(W,C[S]),W=W+w|0,D=w,w=k,k=n(U,10),U=O,O=W,W=N+u[h+R[S]]|0,S<16?W+=t(H,F,P)+l[0]:S<32?W+=o(H,F,P)+l[1]:S<48?W+=i(H,F,P)+l[2]:S<64?W+=r(H,F,P)+l[3]:W+=e(H,F,P)+l[4],W=W|0,W=n(W,g[S]),W=W+B|0,N=B,B=P,P=n(F,10),F=H,H=W;W=p[1]+U+P|0,p[1]=p[2]+k+B|0,p[2]=p[3]+w+N|0,p[3]=p[4]+D+H|0,p[4]=p[0]+O+F|0,p[0]=W},_doFinalize:function(){var u=this._data,h=u.words,S=this._nDataBytes*8,x=u.sigBytes*8;h[x>>>5]|=128<<24-x%32,h[(x+64>>>9<<4)+14]=(S<<8|S>>>24)&16711935|(S<<24|S>>>8)&4278255360,u.sigBytes=(h.length+1)*4,this._process();for(var E=this._hash,p=E.words,b=0;b<5;b++){var l=p[b];p[b]=(l<<8|l>>>24)&16711935|(l<<24|l>>>8)&4278255360}return E},clone:function(){var u=_.clone.call(this);return u._hash=this._hash.clone(),u}});function e(u,h,S){return u^h^S}function r(u,h,S){return u&h|~u&S}function i(u,h,S){return(u|~h)^S}function o(u,h,S){return u&S|h&~S}function t(u,h,S){return u^(h|~S)}function n(u,h){return u<<h|u>>>32-h}Q.RIPEMD160=_._createHelper(a),Q.HmacRIPEMD160=_._createHmacHelper(a)}(),M.RIPEMD160})}(St)),St.exports}var Ct={exports:{}},gr;function bt(){return gr||(gr=1,function(Y,L){(function(M,V){Y.exports=V(_e())})(ye,function(M){(function(){var V=M,Q=V.lib,j=Q.Base,T=V.enc,_=T.Utf8,m=V.algo;m.HMAC=j.extend({init:function(d,f){d=this._hasher=new d.init,typeof f=="string"&&(f=_.parse(f));var y=d.blockSize,v=y*4;f.sigBytes>v&&(f=d.finalize(f)),f.clamp();for(var s=this._oKey=f.clone(),c=this._iKey=f.clone(),a=s.words,e=c.words,r=0;r<y;r++)a[r]^=1549556828,e[r]^=909522486;s.sigBytes=c.sigBytes=v,this.reset()},reset:function(){var d=this._hasher;d.reset(),d.update(this._iKey)},update:function(d){return this._hasher.update(d),this},finalize:function(d){var f=this._hasher,y=f.finalize(d);f.reset();var v=f.finalize(this._oKey.clone().concat(y));return v}})})()})}(Ct)),Ct.exports}var Rt={exports:{}},yr;function gn(){return yr||(yr=1,function(Y,L){(function(M,V,Q){Y.exports=V(_e(),mt(),bt())})(ye,function(M){return function(){var V=M,Q=V.lib,j=Q.Base,T=Q.WordArray,_=V.algo,m=_.SHA256,d=_.HMAC,f=_.PBKDF2=j.extend({cfg:j.extend({keySize:128/32,hasher:m,iterations:25e4}),init:function(y){this.cfg=this.cfg.extend(y)},compute:function(y,v){for(var s=this.cfg,c=d.create(s.hasher,y),a=T.create(),e=T.create([1]),r=a.words,i=e.words,o=s.keySize,t=s.iterations;r.length<o;){var n=c.update(v).finalize(e);c.reset();for(var u=n.words,h=u.length,S=n,x=1;x<t;x++){S=c.finalize(S),c.reset();for(var E=S.words,p=0;p<h;p++)u[p]^=E[p]}a.concat(n),i[0]++}return a.sigBytes=o*4,a}});V.PBKDF2=function(y,v,s){return f.create(s).compute(y,v)}}(),M.PBKDF2})}(Rt)),Rt.exports}var xt={exports:{}},_r;function qe(){return _r||(_r=1,function(Y,L){(function(M,V,Q){Y.exports=V(_e(),dr(),bt())})(ye,function(M){return function(){var V=M,Q=V.lib,j=Q.Base,T=Q.WordArray,_=V.algo,m=_.MD5,d=_.EvpKDF=j.extend({cfg:j.extend({keySize:128/32,hasher:m,iterations:1}),init:function(f){this.cfg=this.cfg.extend(f)},compute:function(f,y){for(var v,s=this.cfg,c=s.hasher.create(),a=T.create(),e=a.words,r=s.keySize,i=s.iterations;e.length<r;){v&&c.update(v),v=c.update(f).finalize(y),c.reset();for(var o=1;o<i;o++)v=c.finalize(v),c.reset();a.concat(v)}return a.sigBytes=r*4,a}});V.EvpKDF=function(f,y,v){return d.create(v).compute(f,y)}}(),M.EvpKDF})}(xt)),xt.exports}var Tt={exports:{}},Sr;function Ne(){return Sr||(Sr=1,function(Y,L){(function(M,V,Q){Y.exports=V(_e(),qe())})(ye,function(M){M.lib.Cipher||function(V){var Q=M,j=Q.lib,T=j.Base,_=j.WordArray,m=j.BufferedBlockAlgorithm,d=Q.enc;d.Utf8;var f=d.Base64,y=Q.algo,v=y.EvpKDF,s=j.Cipher=m.extend({cfg:T.extend(),createEncryptor:function(E,p){return this.create(this._ENC_XFORM_MODE,E,p)},createDecryptor:function(E,p){return this.create(this._DEC_XFORM_MODE,E,p)},init:function(E,p,b){this.cfg=this.cfg.extend(b),this._xformMode=E,this._key=p,this.reset()},reset:function(){m.reset.call(this),this._doReset()},process:function(E){return this._append(E),this._process()},finalize:function(E){E&&this._append(E);var p=this._doFinalize();return p},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function E(p){return typeof p=="string"?x:u}return function(p){return{encrypt:function(b,l,A){return E(l).encrypt(p,b,l,A)},decrypt:function(b,l,A){return E(l).decrypt(p,b,l,A)}}}}()});j.StreamCipher=s.extend({_doFinalize:function(){var E=this._process(!0);return E},blockSize:1});var c=Q.mode={},a=j.BlockCipherMode=T.extend({createEncryptor:function(E,p){return this.Encryptor.create(E,p)},createDecryptor:function(E,p){return this.Decryptor.create(E,p)},init:function(E,p){this._cipher=E,this._iv=p}}),e=c.CBC=function(){var E=a.extend();E.Encryptor=E.extend({processBlock:function(b,l){var A=this._cipher,R=A.blockSize;p.call(this,b,l,R),A.encryptBlock(b,l),this._prevBlock=b.slice(l,l+R)}}),E.Decryptor=E.extend({processBlock:function(b,l){var A=this._cipher,R=A.blockSize,C=b.slice(l,l+R);A.decryptBlock(b,l),p.call(this,b,l,R),this._prevBlock=C}});function p(b,l,A){var R,C=this._iv;C?(R=C,this._iv=V):R=this._prevBlock;for(var g=0;g<A;g++)b[l+g]^=R[g]}return E}(),r=Q.pad={},i=r.Pkcs7={pad:function(E,p){for(var b=p*4,l=b-E.sigBytes%b,A=l<<24|l<<16|l<<8|l,R=[],C=0;C<l;C+=4)R.push(A);var g=_.create(R,l);E.concat(g)},unpad:function(E){var p=E.words[E.sigBytes-1>>>2]&255;E.sigBytes-=p}};j.BlockCipher=s.extend({cfg:s.cfg.extend({mode:e,padding:i}),reset:function(){var E;s.reset.call(this);var p=this.cfg,b=p.iv,l=p.mode;this._xformMode==this._ENC_XFORM_MODE?E=l.createEncryptor:(E=l.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==E?this._mode.init(this,b&&b.words):(this._mode=E.call(l,this,b&&b.words),this._mode.__creator=E)},_doProcessBlock:function(E,p){this._mode.processBlock(E,p)},_doFinalize:function(){var E,p=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(p.pad(this._data,this.blockSize),E=this._process(!0)):(E=this._process(!0),p.unpad(E)),E},blockSize:128/32});var o=j.CipherParams=T.extend({init:function(E){this.mixIn(E)},toString:function(E){return(E||this.formatter).stringify(this)}}),t=Q.format={},n=t.OpenSSL={stringify:function(E){var p,b=E.ciphertext,l=E.salt;return l?p=_.create([1398893684,1701076831]).concat(l).concat(b):p=b,p.toString(f)},parse:function(E){var p,b=f.parse(E),l=b.words;return l[0]==1398893684&&l[1]==1701076831&&(p=_.create(l.slice(2,4)),l.splice(0,4),b.sigBytes-=16),o.create({ciphertext:b,salt:p})}},u=j.SerializableCipher=T.extend({cfg:T.extend({format:n}),encrypt:function(E,p,b,l){l=this.cfg.extend(l);var A=E.createEncryptor(b,l),R=A.finalize(p),C=A.cfg;return o.create({ciphertext:R,key:b,iv:C.iv,algorithm:E,mode:C.mode,padding:C.padding,blockSize:E.blockSize,formatter:l.format})},decrypt:function(E,p,b,l){l=this.cfg.extend(l),p=this._parse(p,l.format);var A=E.createDecryptor(b,l).finalize(p.ciphertext);return A},_parse:function(E,p){return typeof E=="string"?p.parse(E,this):E}}),h=Q.kdf={},S=h.OpenSSL={execute:function(E,p,b,l,A){if(l||(l=_.random(64/8)),A)var R=v.create({keySize:p+b,hasher:A}).compute(E,l);else var R=v.create({keySize:p+b}).compute(E,l);var C=_.create(R.words.slice(p),b*4);return R.sigBytes=p*4,o.create({key:R,iv:C,salt:l})}},x=j.PasswordBasedCipher=u.extend({cfg:u.cfg.extend({kdf:S}),encrypt:function(E,p,b,l){l=this.cfg.extend(l);var A=l.kdf.execute(b,E.keySize,E.ivSize,l.salt,l.hasher);l.iv=A.iv;var R=u.encrypt.call(this,E,p,A.key,l);return R.mixIn(A),R},decrypt:function(E,p,b,l){l=this.cfg.extend(l),p=this._parse(p,l.format);var A=l.kdf.execute(b,E.keySize,E.ivSize,p.salt,l.hasher);l.iv=A.iv;var R=u.decrypt.call(this,E,p,A.key,l);return R}})}()})}(Tt)),Tt.exports}var At={exports:{}},Cr;function yn(){return Cr||(Cr=1,function(Y,L){(function(M,V,Q){Y.exports=V(_e(),Ne())})(ye,function(M){return M.mode.CFB=function(){var V=M.lib.BlockCipherMode.extend();V.Encryptor=V.extend({processBlock:function(j,T){var _=this._cipher,m=_.blockSize;Q.call(this,j,T,m,_),this._prevBlock=j.slice(T,T+m)}}),V.Decryptor=V.extend({processBlock:function(j,T){var _=this._cipher,m=_.blockSize,d=j.slice(T,T+m);Q.call(this,j,T,m,_),this._prevBlock=d}});function Q(j,T,_,m){var d,f=this._iv;f?(d=f.slice(0),this._iv=void 0):d=this._prevBlock,m.encryptBlock(d,0);for(var y=0;y<_;y++)j[T+y]^=d[y]}return V}(),M.mode.CFB})}(At)),At.exports}var Dt={exports:{}},br;function _n(){return br||(br=1,function(Y,L){(function(M,V,Q){Y.exports=V(_e(),Ne())})(ye,function(M){return M.mode.CTR=function(){var V=M.lib.BlockCipherMode.extend(),Q=V.Encryptor=V.extend({processBlock:function(j,T){var _=this._cipher,m=_.blockSize,d=this._iv,f=this._counter;d&&(f=this._counter=d.slice(0),this._iv=void 0);var y=f.slice(0);_.encryptBlock(y,0),f[m-1]=f[m-1]+1|0;for(var v=0;v<m;v++)j[T+v]^=y[v]}});return V.Decryptor=Q,V}(),M.mode.CTR})}(Dt)),Dt.exports}var Ot={exports:{}},Rr;function Sn(){return Rr||(Rr=1,function(Y,L){(function(M,V,Q){Y.exports=V(_e(),Ne())})(ye,function(M){/** @preserve
12
+ */return function(F){var $=B,H=$.lib,T=H.WordArray,_=H.Hasher,f=$.algo,l=T.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),m=T.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),h=T.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),v=T.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),u=T.create([0,1518500249,1859775393,2400959708,2840853838]),s=T.create([1352829926,1548603684,1836072691,2053994217,0]),i=f.RIPEMD160=_.extend({_doReset:function(){this._hash=T.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(c,p){for(var C=0;C<16;C++){var x=p+C,y=c[x];c[x]=(y<<8|y>>>24)&16711935|(y<<24|y>>>8)&4278255360}var E=this._hash.words,S=u.words,d=s.words,R=l.words,D=m.words,A=h.words,b=v.words,g,O,k,U,w,W,M,N,P,V;W=g=E[0],M=O=E[1],N=k=E[2],P=U=E[3],V=w=E[4];for(var j,C=0;C<80;C+=1)j=g+c[p+R[C]]|0,C<16?j+=e(O,k,U)+S[0]:C<32?j+=o(O,k,U)+S[1]:C<48?j+=r(O,k,U)+S[2]:C<64?j+=a(O,k,U)+S[3]:j+=t(O,k,U)+S[4],j=j|0,j=n(j,A[C]),j=j+w|0,g=w,w=U,U=n(k,10),k=O,O=j,j=W+c[p+D[C]]|0,C<16?j+=t(M,N,P)+d[0]:C<32?j+=a(M,N,P)+d[1]:C<48?j+=r(M,N,P)+d[2]:C<64?j+=o(M,N,P)+d[3]:j+=e(M,N,P)+d[4],j=j|0,j=n(j,b[C]),j=j+V|0,W=V,V=P,P=n(N,10),N=M,M=j;j=E[1]+k+P|0,E[1]=E[2]+U+V|0,E[2]=E[3]+w+W|0,E[3]=E[4]+g+M|0,E[4]=E[0]+O+N|0,E[0]=j},_doFinalize:function(){var c=this._data,p=c.words,C=this._nDataBytes*8,x=c.sigBytes*8;p[x>>>5]|=128<<24-x%32,p[(x+64>>>9<<4)+14]=(C<<8|C>>>24)&16711935|(C<<24|C>>>8)&4278255360,c.sigBytes=(p.length+1)*4,this._process();for(var y=this._hash,E=y.words,S=0;S<5;S++){var d=E[S];E[S]=(d<<8|d>>>24)&16711935|(d<<24|d>>>8)&4278255360}return y},clone:function(){var c=_.clone.call(this);return c._hash=this._hash.clone(),c}});function e(c,p,C){return c^p^C}function o(c,p,C){return c&p|~c&C}function r(c,p,C){return(c|~p)^C}function a(c,p,C){return c&C|p&~C}function t(c,p,C){return c^(p|~C)}function n(c,p){return c<<p|c>>>32-p}$.RIPEMD160=_._createHelper(i),$.HmacRIPEMD160=_._createHmacHelper(i)}(),B.RIPEMD160})}(St)),St.exports}var Ct={exports:{}},gr;function bt(){return gr||(gr=1,function(Y,L){(function(B,F){Y.exports=F(Se())})(ye,function(B){(function(){var F=B,$=F.lib,H=$.Base,T=F.enc,_=T.Utf8,f=F.algo;f.HMAC=H.extend({init:function(l,m){l=this._hasher=new l.init,typeof m=="string"&&(m=_.parse(m));var h=l.blockSize,v=h*4;m.sigBytes>v&&(m=l.finalize(m)),m.clamp();for(var u=this._oKey=m.clone(),s=this._iKey=m.clone(),i=u.words,e=s.words,o=0;o<h;o++)i[o]^=1549556828,e[o]^=909522486;u.sigBytes=s.sigBytes=v,this.reset()},reset:function(){var l=this._hasher;l.reset(),l.update(this._iKey)},update:function(l){return this._hasher.update(l),this},finalize:function(l){var m=this._hasher,h=m.finalize(l);m.reset();var v=m.finalize(this._oKey.clone().concat(h));return v}})})()})}(Ct)),Ct.exports}var Rt={exports:{}},yr;function gn(){return yr||(yr=1,function(Y,L){(function(B,F,$){Y.exports=F(Se(),mt(),bt())})(ye,function(B){return function(){var F=B,$=F.lib,H=$.Base,T=$.WordArray,_=F.algo,f=_.SHA256,l=_.HMAC,m=_.PBKDF2=H.extend({cfg:H.extend({keySize:128/32,hasher:f,iterations:25e4}),init:function(h){this.cfg=this.cfg.extend(h)},compute:function(h,v){for(var u=this.cfg,s=l.create(u.hasher,h),i=T.create(),e=T.create([1]),o=i.words,r=e.words,a=u.keySize,t=u.iterations;o.length<a;){var n=s.update(v).finalize(e);s.reset();for(var c=n.words,p=c.length,C=n,x=1;x<t;x++){C=s.finalize(C),s.reset();for(var y=C.words,E=0;E<p;E++)c[E]^=y[E]}i.concat(n),r[0]++}return i.sigBytes=a*4,i}});F.PBKDF2=function(h,v,u){return m.create(u).compute(h,v)}}(),B.PBKDF2})}(Rt)),Rt.exports}var xt={exports:{}},_r;function qe(){return _r||(_r=1,function(Y,L){(function(B,F,$){Y.exports=F(Se(),dr(),bt())})(ye,function(B){return function(){var F=B,$=F.lib,H=$.Base,T=$.WordArray,_=F.algo,f=_.MD5,l=_.EvpKDF=H.extend({cfg:H.extend({keySize:128/32,hasher:f,iterations:1}),init:function(m){this.cfg=this.cfg.extend(m)},compute:function(m,h){for(var v,u=this.cfg,s=u.hasher.create(),i=T.create(),e=i.words,o=u.keySize,r=u.iterations;e.length<o;){v&&s.update(v),v=s.update(m).finalize(h),s.reset();for(var a=1;a<r;a++)v=s.finalize(v),s.reset();i.concat(v)}return i.sigBytes=o*4,i}});F.EvpKDF=function(m,h,v){return l.create(v).compute(m,h)}}(),B.EvpKDF})}(xt)),xt.exports}var Tt={exports:{}},Sr;function Ne(){return Sr||(Sr=1,function(Y,L){(function(B,F,$){Y.exports=F(Se(),qe())})(ye,function(B){B.lib.Cipher||function(F){var $=B,H=$.lib,T=H.Base,_=H.WordArray,f=H.BufferedBlockAlgorithm,l=$.enc;l.Utf8;var m=l.Base64,h=$.algo,v=h.EvpKDF,u=H.Cipher=f.extend({cfg:T.extend(),createEncryptor:function(y,E){return this.create(this._ENC_XFORM_MODE,y,E)},createDecryptor:function(y,E){return this.create(this._DEC_XFORM_MODE,y,E)},init:function(y,E,S){this.cfg=this.cfg.extend(S),this._xformMode=y,this._key=E,this.reset()},reset:function(){f.reset.call(this),this._doReset()},process:function(y){return this._append(y),this._process()},finalize:function(y){y&&this._append(y);var E=this._doFinalize();return E},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function y(E){return typeof E=="string"?x:c}return function(E){return{encrypt:function(S,d,R){return y(d).encrypt(E,S,d,R)},decrypt:function(S,d,R){return y(d).decrypt(E,S,d,R)}}}}()});H.StreamCipher=u.extend({_doFinalize:function(){var y=this._process(!0);return y},blockSize:1});var s=$.mode={},i=H.BlockCipherMode=T.extend({createEncryptor:function(y,E){return this.Encryptor.create(y,E)},createDecryptor:function(y,E){return this.Decryptor.create(y,E)},init:function(y,E){this._cipher=y,this._iv=E}}),e=s.CBC=function(){var y=i.extend();y.Encryptor=y.extend({processBlock:function(S,d){var R=this._cipher,D=R.blockSize;E.call(this,S,d,D),R.encryptBlock(S,d),this._prevBlock=S.slice(d,d+D)}}),y.Decryptor=y.extend({processBlock:function(S,d){var R=this._cipher,D=R.blockSize,A=S.slice(d,d+D);R.decryptBlock(S,d),E.call(this,S,d,D),this._prevBlock=A}});function E(S,d,R){var D,A=this._iv;A?(D=A,this._iv=F):D=this._prevBlock;for(var b=0;b<R;b++)S[d+b]^=D[b]}return y}(),o=$.pad={},r=o.Pkcs7={pad:function(y,E){for(var S=E*4,d=S-y.sigBytes%S,R=d<<24|d<<16|d<<8|d,D=[],A=0;A<d;A+=4)D.push(R);var b=_.create(D,d);y.concat(b)},unpad:function(y){var E=y.words[y.sigBytes-1>>>2]&255;y.sigBytes-=E}};H.BlockCipher=u.extend({cfg:u.cfg.extend({mode:e,padding:r}),reset:function(){var y;u.reset.call(this);var E=this.cfg,S=E.iv,d=E.mode;this._xformMode==this._ENC_XFORM_MODE?y=d.createEncryptor:(y=d.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==y?this._mode.init(this,S&&S.words):(this._mode=y.call(d,this,S&&S.words),this._mode.__creator=y)},_doProcessBlock:function(y,E){this._mode.processBlock(y,E)},_doFinalize:function(){var y,E=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(E.pad(this._data,this.blockSize),y=this._process(!0)):(y=this._process(!0),E.unpad(y)),y},blockSize:128/32});var a=H.CipherParams=T.extend({init:function(y){this.mixIn(y)},toString:function(y){return(y||this.formatter).stringify(this)}}),t=$.format={},n=t.OpenSSL={stringify:function(y){var E,S=y.ciphertext,d=y.salt;return d?E=_.create([1398893684,1701076831]).concat(d).concat(S):E=S,E.toString(m)},parse:function(y){var E,S=m.parse(y),d=S.words;return d[0]==1398893684&&d[1]==1701076831&&(E=_.create(d.slice(2,4)),d.splice(0,4),S.sigBytes-=16),a.create({ciphertext:S,salt:E})}},c=H.SerializableCipher=T.extend({cfg:T.extend({format:n}),encrypt:function(y,E,S,d){d=this.cfg.extend(d);var R=y.createEncryptor(S,d),D=R.finalize(E),A=R.cfg;return a.create({ciphertext:D,key:S,iv:A.iv,algorithm:y,mode:A.mode,padding:A.padding,blockSize:y.blockSize,formatter:d.format})},decrypt:function(y,E,S,d){d=this.cfg.extend(d),E=this._parse(E,d.format);var R=y.createDecryptor(S,d).finalize(E.ciphertext);return R},_parse:function(y,E){return typeof y=="string"?E.parse(y,this):y}}),p=$.kdf={},C=p.OpenSSL={execute:function(y,E,S,d,R){if(d||(d=_.random(64/8)),R)var D=v.create({keySize:E+S,hasher:R}).compute(y,d);else var D=v.create({keySize:E+S}).compute(y,d);var A=_.create(D.words.slice(E),S*4);return D.sigBytes=E*4,a.create({key:D,iv:A,salt:d})}},x=H.PasswordBasedCipher=c.extend({cfg:c.cfg.extend({kdf:C}),encrypt:function(y,E,S,d){d=this.cfg.extend(d);var R=d.kdf.execute(S,y.keySize,y.ivSize,d.salt,d.hasher);d.iv=R.iv;var D=c.encrypt.call(this,y,E,R.key,d);return D.mixIn(R),D},decrypt:function(y,E,S,d){d=this.cfg.extend(d),E=this._parse(E,d.format);var R=d.kdf.execute(S,y.keySize,y.ivSize,E.salt,d.hasher);d.iv=R.iv;var D=c.decrypt.call(this,y,E,R.key,d);return D}})}()})}(Tt)),Tt.exports}var At={exports:{}},Cr;function yn(){return Cr||(Cr=1,function(Y,L){(function(B,F,$){Y.exports=F(Se(),Ne())})(ye,function(B){return B.mode.CFB=function(){var F=B.lib.BlockCipherMode.extend();F.Encryptor=F.extend({processBlock:function(H,T){var _=this._cipher,f=_.blockSize;$.call(this,H,T,f,_),this._prevBlock=H.slice(T,T+f)}}),F.Decryptor=F.extend({processBlock:function(H,T){var _=this._cipher,f=_.blockSize,l=H.slice(T,T+f);$.call(this,H,T,f,_),this._prevBlock=l}});function $(H,T,_,f){var l,m=this._iv;m?(l=m.slice(0),this._iv=void 0):l=this._prevBlock,f.encryptBlock(l,0);for(var h=0;h<_;h++)H[T+h]^=l[h]}return F}(),B.mode.CFB})}(At)),At.exports}var Dt={exports:{}},br;function _n(){return br||(br=1,function(Y,L){(function(B,F,$){Y.exports=F(Se(),Ne())})(ye,function(B){return B.mode.CTR=function(){var F=B.lib.BlockCipherMode.extend(),$=F.Encryptor=F.extend({processBlock:function(H,T){var _=this._cipher,f=_.blockSize,l=this._iv,m=this._counter;l&&(m=this._counter=l.slice(0),this._iv=void 0);var h=m.slice(0);_.encryptBlock(h,0),m[f-1]=m[f-1]+1|0;for(var v=0;v<f;v++)H[T+v]^=h[v]}});return F.Decryptor=$,F}(),B.mode.CTR})}(Dt)),Dt.exports}var Ot={exports:{}},Rr;function Sn(){return Rr||(Rr=1,function(Y,L){(function(B,F,$){Y.exports=F(Se(),Ne())})(ye,function(B){/** @preserve
13
13
  * Counter block mode compatible with Dr Brian Gladman fileenc.c
14
14
  * derived from CryptoJS.mode.CTR
15
15
  * Jan Hruby jhruby.web@gmail.com
16
- */return M.mode.CTRGladman=function(){var V=M.lib.BlockCipherMode.extend();function Q(_){if((_>>24&255)===255){var m=_>>16&255,d=_>>8&255,f=_&255;m===255?(m=0,d===255?(d=0,f===255?f=0:++f):++d):++m,_=0,_+=m<<16,_+=d<<8,_+=f}else _+=1<<24;return _}function j(_){return(_[0]=Q(_[0]))===0&&(_[1]=Q(_[1])),_}var T=V.Encryptor=V.extend({processBlock:function(_,m){var d=this._cipher,f=d.blockSize,y=this._iv,v=this._counter;y&&(v=this._counter=y.slice(0),this._iv=void 0),j(v);var s=v.slice(0);d.encryptBlock(s,0);for(var c=0;c<f;c++)_[m+c]^=s[c]}});return V.Decryptor=T,V}(),M.mode.CTRGladman})}(Ot)),Ot.exports}var wt={exports:{}},xr;function Cn(){return xr||(xr=1,function(Y,L){(function(M,V,Q){Y.exports=V(_e(),Ne())})(ye,function(M){return M.mode.OFB=function(){var V=M.lib.BlockCipherMode.extend(),Q=V.Encryptor=V.extend({processBlock:function(j,T){var _=this._cipher,m=_.blockSize,d=this._iv,f=this._keystream;d&&(f=this._keystream=d.slice(0),this._iv=void 0),_.encryptBlock(f,0);for(var y=0;y<m;y++)j[T+y]^=f[y]}});return V.Decryptor=Q,V}(),M.mode.OFB})}(wt)),wt.exports}var Pt={exports:{}},Tr;function bn(){return Tr||(Tr=1,function(Y,L){(function(M,V,Q){Y.exports=V(_e(),Ne())})(ye,function(M){return M.mode.ECB=function(){var V=M.lib.BlockCipherMode.extend();return V.Encryptor=V.extend({processBlock:function(Q,j){this._cipher.encryptBlock(Q,j)}}),V.Decryptor=V.extend({processBlock:function(Q,j){this._cipher.decryptBlock(Q,j)}}),V}(),M.mode.ECB})}(Pt)),Pt.exports}var It={exports:{}},Ar;function Rn(){return Ar||(Ar=1,function(Y,L){(function(M,V,Q){Y.exports=V(_e(),Ne())})(ye,function(M){return M.pad.AnsiX923={pad:function(V,Q){var j=V.sigBytes,T=Q*4,_=T-j%T,m=j+_-1;V.clamp(),V.words[m>>>2]|=_<<24-m%4*8,V.sigBytes+=_},unpad:function(V){var Q=V.words[V.sigBytes-1>>>2]&255;V.sigBytes-=Q}},M.pad.Ansix923})}(It)),It.exports}var Mt={exports:{}},Dr;function xn(){return Dr||(Dr=1,function(Y,L){(function(M,V,Q){Y.exports=V(_e(),Ne())})(ye,function(M){return M.pad.Iso10126={pad:function(V,Q){var j=Q*4,T=j-V.sigBytes%j;V.concat(M.lib.WordArray.random(T-1)).concat(M.lib.WordArray.create([T<<24],1))},unpad:function(V){var Q=V.words[V.sigBytes-1>>>2]&255;V.sigBytes-=Q}},M.pad.Iso10126})}(Mt)),Mt.exports}var kt={exports:{}},Or;function Tn(){return Or||(Or=1,function(Y,L){(function(M,V,Q){Y.exports=V(_e(),Ne())})(ye,function(M){return M.pad.Iso97971={pad:function(V,Q){V.concat(M.lib.WordArray.create([2147483648],1)),M.pad.ZeroPadding.pad(V,Q)},unpad:function(V){M.pad.ZeroPadding.unpad(V),V.sigBytes--}},M.pad.Iso97971})}(kt)),kt.exports}var Nt={exports:{}},wr;function An(){return wr||(wr=1,function(Y,L){(function(M,V,Q){Y.exports=V(_e(),Ne())})(ye,function(M){return M.pad.ZeroPadding={pad:function(V,Q){var j=Q*4;V.clamp(),V.sigBytes+=j-(V.sigBytes%j||j)},unpad:function(V){for(var Q=V.words,j=V.sigBytes-1,j=V.sigBytes-1;j>=0;j--)if(Q[j>>>2]>>>24-j%4*8&255){V.sigBytes=j+1;break}}},M.pad.ZeroPadding})}(Nt)),Nt.exports}var Bt={exports:{}},Pr;function Dn(){return Pr||(Pr=1,function(Y,L){(function(M,V,Q){Y.exports=V(_e(),Ne())})(ye,function(M){return M.pad.NoPadding={pad:function(){},unpad:function(){}},M.pad.NoPadding})}(Bt)),Bt.exports}var Lt={exports:{}},Ir;function On(){return Ir||(Ir=1,function(Y,L){(function(M,V,Q){Y.exports=V(_e(),Ne())})(ye,function(M){return function(V){var Q=M,j=Q.lib,T=j.CipherParams,_=Q.enc,m=_.Hex,d=Q.format;d.Hex={stringify:function(f){return f.ciphertext.toString(m)},parse:function(f){var y=m.parse(f);return T.create({ciphertext:y})}}}(),M.format.Hex})}(Lt)),Lt.exports}var Ut={exports:{}},Mr;function wn(){return Mr||(Mr=1,function(Y,L){(function(M,V,Q){Y.exports=V(_e(),Qe(),Je(),qe(),Ne())})(ye,function(M){return function(){var V=M,Q=V.lib,j=Q.BlockCipher,T=V.algo,_=[],m=[],d=[],f=[],y=[],v=[],s=[],c=[],a=[],e=[];(function(){for(var o=[],t=0;t<256;t++)t<128?o[t]=t<<1:o[t]=t<<1^283;for(var n=0,u=0,t=0;t<256;t++){var h=u^u<<1^u<<2^u<<3^u<<4;h=h>>>8^h&255^99,_[n]=h,m[h]=n;var S=o[n],x=o[S],E=o[x],p=o[h]*257^h*16843008;d[n]=p<<24|p>>>8,f[n]=p<<16|p>>>16,y[n]=p<<8|p>>>24,v[n]=p;var p=E*16843009^x*65537^S*257^n*16843008;s[h]=p<<24|p>>>8,c[h]=p<<16|p>>>16,a[h]=p<<8|p>>>24,e[h]=p,n?(n=S^o[o[o[E^S]]],u^=o[o[u]]):n=u=1}})();var r=[0,1,2,4,8,16,32,64,128,27,54],i=T.AES=j.extend({_doReset:function(){var o;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var t=this._keyPriorReset=this._key,n=t.words,u=t.sigBytes/4,h=this._nRounds=u+6,S=(h+1)*4,x=this._keySchedule=[],E=0;E<S;E++)E<u?x[E]=n[E]:(o=x[E-1],E%u?u>6&&E%u==4&&(o=_[o>>>24]<<24|_[o>>>16&255]<<16|_[o>>>8&255]<<8|_[o&255]):(o=o<<8|o>>>24,o=_[o>>>24]<<24|_[o>>>16&255]<<16|_[o>>>8&255]<<8|_[o&255],o^=r[E/u|0]<<24),x[E]=x[E-u]^o);for(var p=this._invKeySchedule=[],b=0;b<S;b++){var E=S-b;if(b%4)var o=x[E];else var o=x[E-4];b<4||E<=4?p[b]=o:p[b]=s[_[o>>>24]]^c[_[o>>>16&255]]^a[_[o>>>8&255]]^e[_[o&255]]}}},encryptBlock:function(o,t){this._doCryptBlock(o,t,this._keySchedule,d,f,y,v,_)},decryptBlock:function(o,t){var n=o[t+1];o[t+1]=o[t+3],o[t+3]=n,this._doCryptBlock(o,t,this._invKeySchedule,s,c,a,e,m);var n=o[t+1];o[t+1]=o[t+3],o[t+3]=n},_doCryptBlock:function(o,t,n,u,h,S,x,E){for(var p=this._nRounds,b=o[t]^n[0],l=o[t+1]^n[1],A=o[t+2]^n[2],R=o[t+3]^n[3],C=4,g=1;g<p;g++){var D=u[b>>>24]^h[l>>>16&255]^S[A>>>8&255]^x[R&255]^n[C++],O=u[l>>>24]^h[A>>>16&255]^S[R>>>8&255]^x[b&255]^n[C++],U=u[A>>>24]^h[R>>>16&255]^S[b>>>8&255]^x[l&255]^n[C++],k=u[R>>>24]^h[b>>>16&255]^S[l>>>8&255]^x[A&255]^n[C++];b=D,l=O,A=U,R=k}var D=(E[b>>>24]<<24|E[l>>>16&255]<<16|E[A>>>8&255]<<8|E[R&255])^n[C++],O=(E[l>>>24]<<24|E[A>>>16&255]<<16|E[R>>>8&255]<<8|E[b&255])^n[C++],U=(E[A>>>24]<<24|E[R>>>16&255]<<16|E[b>>>8&255]<<8|E[l&255])^n[C++],k=(E[R>>>24]<<24|E[b>>>16&255]<<16|E[l>>>8&255]<<8|E[A&255])^n[C++];o[t]=D,o[t+1]=O,o[t+2]=U,o[t+3]=k},keySize:256/32});V.AES=j._createHelper(i)}(),M.AES})}(Ut)),Ut.exports}var Ft={exports:{}},kr;function Pn(){return kr||(kr=1,function(Y,L){(function(M,V,Q){Y.exports=V(_e(),Qe(),Je(),qe(),Ne())})(ye,function(M){return function(){var V=M,Q=V.lib,j=Q.WordArray,T=Q.BlockCipher,_=V.algo,m=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],d=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],f=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],y=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],v=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],s=_.DES=T.extend({_doReset:function(){for(var r=this._key,i=r.words,o=[],t=0;t<56;t++){var n=m[t]-1;o[t]=i[n>>>5]>>>31-n%32&1}for(var u=this._subKeys=[],h=0;h<16;h++){for(var S=u[h]=[],x=f[h],t=0;t<24;t++)S[t/6|0]|=o[(d[t]-1+x)%28]<<31-t%6,S[4+(t/6|0)]|=o[28+(d[t+24]-1+x)%28]<<31-t%6;S[0]=S[0]<<1|S[0]>>>31;for(var t=1;t<7;t++)S[t]=S[t]>>>(t-1)*4+3;S[7]=S[7]<<5|S[7]>>>27}for(var E=this._invSubKeys=[],t=0;t<16;t++)E[t]=u[15-t]},encryptBlock:function(r,i){this._doCryptBlock(r,i,this._subKeys)},decryptBlock:function(r,i){this._doCryptBlock(r,i,this._invSubKeys)},_doCryptBlock:function(r,i,o){this._lBlock=r[i],this._rBlock=r[i+1],c.call(this,4,252645135),c.call(this,16,65535),a.call(this,2,858993459),a.call(this,8,16711935),c.call(this,1,1431655765);for(var t=0;t<16;t++){for(var n=o[t],u=this._lBlock,h=this._rBlock,S=0,x=0;x<8;x++)S|=y[x][((h^n[x])&v[x])>>>0];this._lBlock=h,this._rBlock=u^S}var E=this._lBlock;this._lBlock=this._rBlock,this._rBlock=E,c.call(this,1,1431655765),a.call(this,8,16711935),a.call(this,2,858993459),c.call(this,16,65535),c.call(this,4,252645135),r[i]=this._lBlock,r[i+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function c(r,i){var o=(this._lBlock>>>r^this._rBlock)&i;this._rBlock^=o,this._lBlock^=o<<r}function a(r,i){var o=(this._rBlock>>>r^this._lBlock)&i;this._lBlock^=o,this._rBlock^=o<<r}V.DES=T._createHelper(s);var e=_.TripleDES=T.extend({_doReset:function(){var r=this._key,i=r.words;if(i.length!==2&&i.length!==4&&i.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var o=i.slice(0,2),t=i.length<4?i.slice(0,2):i.slice(2,4),n=i.length<6?i.slice(0,2):i.slice(4,6);this._des1=s.createEncryptor(j.create(o)),this._des2=s.createEncryptor(j.create(t)),this._des3=s.createEncryptor(j.create(n))},encryptBlock:function(r,i){this._des1.encryptBlock(r,i),this._des2.decryptBlock(r,i),this._des3.encryptBlock(r,i)},decryptBlock:function(r,i){this._des3.decryptBlock(r,i),this._des2.encryptBlock(r,i),this._des1.decryptBlock(r,i)},keySize:192/32,ivSize:64/32,blockSize:64/32});V.TripleDES=T._createHelper(e)}(),M.TripleDES})}(Ft)),Ft.exports}var Vt={exports:{}},Nr;function In(){return Nr||(Nr=1,function(Y,L){(function(M,V,Q){Y.exports=V(_e(),Qe(),Je(),qe(),Ne())})(ye,function(M){return function(){var V=M,Q=V.lib,j=Q.StreamCipher,T=V.algo,_=T.RC4=j.extend({_doReset:function(){for(var f=this._key,y=f.words,v=f.sigBytes,s=this._S=[],c=0;c<256;c++)s[c]=c;for(var c=0,a=0;c<256;c++){var e=c%v,r=y[e>>>2]>>>24-e%4*8&255;a=(a+s[c]+r)%256;var i=s[c];s[c]=s[a],s[a]=i}this._i=this._j=0},_doProcessBlock:function(f,y){f[y]^=m.call(this)},keySize:256/32,ivSize:0});function m(){for(var f=this._S,y=this._i,v=this._j,s=0,c=0;c<4;c++){y=(y+1)%256,v=(v+f[y])%256;var a=f[y];f[y]=f[v],f[v]=a,s|=f[(f[y]+f[v])%256]<<24-c*8}return this._i=y,this._j=v,s}V.RC4=j._createHelper(_);var d=T.RC4Drop=_.extend({cfg:_.cfg.extend({drop:192}),_doReset:function(){_._doReset.call(this);for(var f=this.cfg.drop;f>0;f--)m.call(this)}});V.RC4Drop=j._createHelper(d)}(),M.RC4})}(Vt)),Vt.exports}var Ht={exports:{}},Br;function Mn(){return Br||(Br=1,function(Y,L){(function(M,V,Q){Y.exports=V(_e(),Qe(),Je(),qe(),Ne())})(ye,function(M){return function(){var V=M,Q=V.lib,j=Q.StreamCipher,T=V.algo,_=[],m=[],d=[],f=T.Rabbit=j.extend({_doReset:function(){for(var v=this._key.words,s=this.cfg.iv,c=0;c<4;c++)v[c]=(v[c]<<8|v[c]>>>24)&16711935|(v[c]<<24|v[c]>>>8)&4278255360;var a=this._X=[v[0],v[3]<<16|v[2]>>>16,v[1],v[0]<<16|v[3]>>>16,v[2],v[1]<<16|v[0]>>>16,v[3],v[2]<<16|v[1]>>>16],e=this._C=[v[2]<<16|v[2]>>>16,v[0]&4294901760|v[1]&65535,v[3]<<16|v[3]>>>16,v[1]&4294901760|v[2]&65535,v[0]<<16|v[0]>>>16,v[2]&4294901760|v[3]&65535,v[1]<<16|v[1]>>>16,v[3]&4294901760|v[0]&65535];this._b=0;for(var c=0;c<4;c++)y.call(this);for(var c=0;c<8;c++)e[c]^=a[c+4&7];if(s){var r=s.words,i=r[0],o=r[1],t=(i<<8|i>>>24)&16711935|(i<<24|i>>>8)&4278255360,n=(o<<8|o>>>24)&16711935|(o<<24|o>>>8)&4278255360,u=t>>>16|n&4294901760,h=n<<16|t&65535;e[0]^=t,e[1]^=u,e[2]^=n,e[3]^=h,e[4]^=t,e[5]^=u,e[6]^=n,e[7]^=h;for(var c=0;c<4;c++)y.call(this)}},_doProcessBlock:function(v,s){var c=this._X;y.call(this),_[0]=c[0]^c[5]>>>16^c[3]<<16,_[1]=c[2]^c[7]>>>16^c[5]<<16,_[2]=c[4]^c[1]>>>16^c[7]<<16,_[3]=c[6]^c[3]>>>16^c[1]<<16;for(var a=0;a<4;a++)_[a]=(_[a]<<8|_[a]>>>24)&16711935|(_[a]<<24|_[a]>>>8)&4278255360,v[s+a]^=_[a]},blockSize:128/32,ivSize:64/32});function y(){for(var v=this._X,s=this._C,c=0;c<8;c++)m[c]=s[c];s[0]=s[0]+1295307597+this._b|0,s[1]=s[1]+3545052371+(s[0]>>>0<m[0]>>>0?1:0)|0,s[2]=s[2]+886263092+(s[1]>>>0<m[1]>>>0?1:0)|0,s[3]=s[3]+1295307597+(s[2]>>>0<m[2]>>>0?1:0)|0,s[4]=s[4]+3545052371+(s[3]>>>0<m[3]>>>0?1:0)|0,s[5]=s[5]+886263092+(s[4]>>>0<m[4]>>>0?1:0)|0,s[6]=s[6]+1295307597+(s[5]>>>0<m[5]>>>0?1:0)|0,s[7]=s[7]+3545052371+(s[6]>>>0<m[6]>>>0?1:0)|0,this._b=s[7]>>>0<m[7]>>>0?1:0;for(var c=0;c<8;c++){var a=v[c]+s[c],e=a&65535,r=a>>>16,i=((e*e>>>17)+e*r>>>15)+r*r,o=((a&4294901760)*a|0)+((a&65535)*a|0);d[c]=i^o}v[0]=d[0]+(d[7]<<16|d[7]>>>16)+(d[6]<<16|d[6]>>>16)|0,v[1]=d[1]+(d[0]<<8|d[0]>>>24)+d[7]|0,v[2]=d[2]+(d[1]<<16|d[1]>>>16)+(d[0]<<16|d[0]>>>16)|0,v[3]=d[3]+(d[2]<<8|d[2]>>>24)+d[1]|0,v[4]=d[4]+(d[3]<<16|d[3]>>>16)+(d[2]<<16|d[2]>>>16)|0,v[5]=d[5]+(d[4]<<8|d[4]>>>24)+d[3]|0,v[6]=d[6]+(d[5]<<16|d[5]>>>16)+(d[4]<<16|d[4]>>>16)|0,v[7]=d[7]+(d[6]<<8|d[6]>>>24)+d[5]|0}V.Rabbit=j._createHelper(f)}(),M.Rabbit})}(Ht)),Ht.exports}var jt={exports:{}},Lr;function kn(){return Lr||(Lr=1,function(Y,L){(function(M,V,Q){Y.exports=V(_e(),Qe(),Je(),qe(),Ne())})(ye,function(M){return function(){var V=M,Q=V.lib,j=Q.StreamCipher,T=V.algo,_=[],m=[],d=[],f=T.RabbitLegacy=j.extend({_doReset:function(){var v=this._key.words,s=this.cfg.iv,c=this._X=[v[0],v[3]<<16|v[2]>>>16,v[1],v[0]<<16|v[3]>>>16,v[2],v[1]<<16|v[0]>>>16,v[3],v[2]<<16|v[1]>>>16],a=this._C=[v[2]<<16|v[2]>>>16,v[0]&4294901760|v[1]&65535,v[3]<<16|v[3]>>>16,v[1]&4294901760|v[2]&65535,v[0]<<16|v[0]>>>16,v[2]&4294901760|v[3]&65535,v[1]<<16|v[1]>>>16,v[3]&4294901760|v[0]&65535];this._b=0;for(var e=0;e<4;e++)y.call(this);for(var e=0;e<8;e++)a[e]^=c[e+4&7];if(s){var r=s.words,i=r[0],o=r[1],t=(i<<8|i>>>24)&16711935|(i<<24|i>>>8)&4278255360,n=(o<<8|o>>>24)&16711935|(o<<24|o>>>8)&4278255360,u=t>>>16|n&4294901760,h=n<<16|t&65535;a[0]^=t,a[1]^=u,a[2]^=n,a[3]^=h,a[4]^=t,a[5]^=u,a[6]^=n,a[7]^=h;for(var e=0;e<4;e++)y.call(this)}},_doProcessBlock:function(v,s){var c=this._X;y.call(this),_[0]=c[0]^c[5]>>>16^c[3]<<16,_[1]=c[2]^c[7]>>>16^c[5]<<16,_[2]=c[4]^c[1]>>>16^c[7]<<16,_[3]=c[6]^c[3]>>>16^c[1]<<16;for(var a=0;a<4;a++)_[a]=(_[a]<<8|_[a]>>>24)&16711935|(_[a]<<24|_[a]>>>8)&4278255360,v[s+a]^=_[a]},blockSize:128/32,ivSize:64/32});function y(){for(var v=this._X,s=this._C,c=0;c<8;c++)m[c]=s[c];s[0]=s[0]+1295307597+this._b|0,s[1]=s[1]+3545052371+(s[0]>>>0<m[0]>>>0?1:0)|0,s[2]=s[2]+886263092+(s[1]>>>0<m[1]>>>0?1:0)|0,s[3]=s[3]+1295307597+(s[2]>>>0<m[2]>>>0?1:0)|0,s[4]=s[4]+3545052371+(s[3]>>>0<m[3]>>>0?1:0)|0,s[5]=s[5]+886263092+(s[4]>>>0<m[4]>>>0?1:0)|0,s[6]=s[6]+1295307597+(s[5]>>>0<m[5]>>>0?1:0)|0,s[7]=s[7]+3545052371+(s[6]>>>0<m[6]>>>0?1:0)|0,this._b=s[7]>>>0<m[7]>>>0?1:0;for(var c=0;c<8;c++){var a=v[c]+s[c],e=a&65535,r=a>>>16,i=((e*e>>>17)+e*r>>>15)+r*r,o=((a&4294901760)*a|0)+((a&65535)*a|0);d[c]=i^o}v[0]=d[0]+(d[7]<<16|d[7]>>>16)+(d[6]<<16|d[6]>>>16)|0,v[1]=d[1]+(d[0]<<8|d[0]>>>24)+d[7]|0,v[2]=d[2]+(d[1]<<16|d[1]>>>16)+(d[0]<<16|d[0]>>>16)|0,v[3]=d[3]+(d[2]<<8|d[2]>>>24)+d[1]|0,v[4]=d[4]+(d[3]<<16|d[3]>>>16)+(d[2]<<16|d[2]>>>16)|0,v[5]=d[5]+(d[4]<<8|d[4]>>>24)+d[3]|0,v[6]=d[6]+(d[5]<<16|d[5]>>>16)+(d[4]<<16|d[4]>>>16)|0,v[7]=d[7]+(d[6]<<8|d[6]>>>24)+d[5]|0}V.RabbitLegacy=j._createHelper(f)}(),M.RabbitLegacy})}(jt)),jt.exports}var Wt={exports:{}},Ur;function Nn(){return Ur||(Ur=1,function(Y,L){(function(M,V,Q){Y.exports=V(_e(),Qe(),Je(),qe(),Ne())})(ye,function(M){return function(){var V=M,Q=V.lib,j=Q.BlockCipher,T=V.algo;const _=16,m=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],d=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var f={pbox:[],sbox:[]};function y(e,r){let i=r>>24&255,o=r>>16&255,t=r>>8&255,n=r&255,u=e.sbox[0][i]+e.sbox[1][o];return u=u^e.sbox[2][t],u=u+e.sbox[3][n],u}function v(e,r,i){let o=r,t=i,n;for(let u=0;u<_;++u)o=o^e.pbox[u],t=y(e,o)^t,n=o,o=t,t=n;return n=o,o=t,t=n,t=t^e.pbox[_],o=o^e.pbox[_+1],{left:o,right:t}}function s(e,r,i){let o=r,t=i,n;for(let u=_+1;u>1;--u)o=o^e.pbox[u],t=y(e,o)^t,n=o,o=t,t=n;return n=o,o=t,t=n,t=t^e.pbox[1],o=o^e.pbox[0],{left:o,right:t}}function c(e,r,i){for(let h=0;h<4;h++){e.sbox[h]=[];for(let S=0;S<256;S++)e.sbox[h][S]=d[h][S]}let o=0;for(let h=0;h<_+2;h++)e.pbox[h]=m[h]^r[o],o++,o>=i&&(o=0);let t=0,n=0,u=0;for(let h=0;h<_+2;h+=2)u=v(e,t,n),t=u.left,n=u.right,e.pbox[h]=t,e.pbox[h+1]=n;for(let h=0;h<4;h++)for(let S=0;S<256;S+=2)u=v(e,t,n),t=u.left,n=u.right,e.sbox[h][S]=t,e.sbox[h][S+1]=n;return!0}var a=T.Blowfish=j.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var e=this._keyPriorReset=this._key,r=e.words,i=e.sigBytes/4;c(f,r,i)}},encryptBlock:function(e,r){var i=v(f,e[r],e[r+1]);e[r]=i.left,e[r+1]=i.right},decryptBlock:function(e,r){var i=s(f,e[r],e[r+1]);e[r]=i.left,e[r+1]=i.right},blockSize:64/32,keySize:128/32,ivSize:64/32});V.Blowfish=j._createHelper(a)}(),M.Blowfish})}(Wt)),Wt.exports}(function(Y,L){(function(M,V,Q){Y.exports=V(_e(),rt(),ln(),pn(),Qe(),fn(),Je(),dr(),mt(),hn(),hr(),vn(),mn(),En(),bt(),gn(),qe(),Ne(),yn(),_n(),Sn(),Cn(),bn(),Rn(),xn(),Tn(),An(),Dn(),On(),wn(),Pn(),In(),Mn(),kn(),Nn())})(ye,function(M){return M})})(tr);var Bn=tr.exports,et=un(Bn);function Ln(Y){return et.MD5(Y).toString().toUpperCase()}function Un(Y,L,M,V,Q,j,T,_){var m;let d="";j.set("x-log-apiversion","0.6.0"),j.set("x-log-signaturemethod","hmac-sha1"),d+=Y+`
16
+ */return B.mode.CTRGladman=function(){var F=B.lib.BlockCipherMode.extend();function $(_){if((_>>24&255)===255){var f=_>>16&255,l=_>>8&255,m=_&255;f===255?(f=0,l===255?(l=0,m===255?m=0:++m):++l):++f,_=0,_+=f<<16,_+=l<<8,_+=m}else _+=1<<24;return _}function H(_){return(_[0]=$(_[0]))===0&&(_[1]=$(_[1])),_}var T=F.Encryptor=F.extend({processBlock:function(_,f){var l=this._cipher,m=l.blockSize,h=this._iv,v=this._counter;h&&(v=this._counter=h.slice(0),this._iv=void 0),H(v);var u=v.slice(0);l.encryptBlock(u,0);for(var s=0;s<m;s++)_[f+s]^=u[s]}});return F.Decryptor=T,F}(),B.mode.CTRGladman})}(Ot)),Ot.exports}var wt={exports:{}},xr;function Cn(){return xr||(xr=1,function(Y,L){(function(B,F,$){Y.exports=F(Se(),Ne())})(ye,function(B){return B.mode.OFB=function(){var F=B.lib.BlockCipherMode.extend(),$=F.Encryptor=F.extend({processBlock:function(H,T){var _=this._cipher,f=_.blockSize,l=this._iv,m=this._keystream;l&&(m=this._keystream=l.slice(0),this._iv=void 0),_.encryptBlock(m,0);for(var h=0;h<f;h++)H[T+h]^=m[h]}});return F.Decryptor=$,F}(),B.mode.OFB})}(wt)),wt.exports}var Pt={exports:{}},Tr;function bn(){return Tr||(Tr=1,function(Y,L){(function(B,F,$){Y.exports=F(Se(),Ne())})(ye,function(B){return B.mode.ECB=function(){var F=B.lib.BlockCipherMode.extend();return F.Encryptor=F.extend({processBlock:function($,H){this._cipher.encryptBlock($,H)}}),F.Decryptor=F.extend({processBlock:function($,H){this._cipher.decryptBlock($,H)}}),F}(),B.mode.ECB})}(Pt)),Pt.exports}var It={exports:{}},Ar;function Rn(){return Ar||(Ar=1,function(Y,L){(function(B,F,$){Y.exports=F(Se(),Ne())})(ye,function(B){return B.pad.AnsiX923={pad:function(F,$){var H=F.sigBytes,T=$*4,_=T-H%T,f=H+_-1;F.clamp(),F.words[f>>>2]|=_<<24-f%4*8,F.sigBytes+=_},unpad:function(F){var $=F.words[F.sigBytes-1>>>2]&255;F.sigBytes-=$}},B.pad.Ansix923})}(It)),It.exports}var Mt={exports:{}},Dr;function xn(){return Dr||(Dr=1,function(Y,L){(function(B,F,$){Y.exports=F(Se(),Ne())})(ye,function(B){return B.pad.Iso10126={pad:function(F,$){var H=$*4,T=H-F.sigBytes%H;F.concat(B.lib.WordArray.random(T-1)).concat(B.lib.WordArray.create([T<<24],1))},unpad:function(F){var $=F.words[F.sigBytes-1>>>2]&255;F.sigBytes-=$}},B.pad.Iso10126})}(Mt)),Mt.exports}var kt={exports:{}},Or;function Tn(){return Or||(Or=1,function(Y,L){(function(B,F,$){Y.exports=F(Se(),Ne())})(ye,function(B){return B.pad.Iso97971={pad:function(F,$){F.concat(B.lib.WordArray.create([2147483648],1)),B.pad.ZeroPadding.pad(F,$)},unpad:function(F){B.pad.ZeroPadding.unpad(F),F.sigBytes--}},B.pad.Iso97971})}(kt)),kt.exports}var Nt={exports:{}},wr;function An(){return wr||(wr=1,function(Y,L){(function(B,F,$){Y.exports=F(Se(),Ne())})(ye,function(B){return B.pad.ZeroPadding={pad:function(F,$){var H=$*4;F.clamp(),F.sigBytes+=H-(F.sigBytes%H||H)},unpad:function(F){for(var $=F.words,H=F.sigBytes-1,H=F.sigBytes-1;H>=0;H--)if($[H>>>2]>>>24-H%4*8&255){F.sigBytes=H+1;break}}},B.pad.ZeroPadding})}(Nt)),Nt.exports}var Bt={exports:{}},Pr;function Dn(){return Pr||(Pr=1,function(Y,L){(function(B,F,$){Y.exports=F(Se(),Ne())})(ye,function(B){return B.pad.NoPadding={pad:function(){},unpad:function(){}},B.pad.NoPadding})}(Bt)),Bt.exports}var Lt={exports:{}},Ir;function On(){return Ir||(Ir=1,function(Y,L){(function(B,F,$){Y.exports=F(Se(),Ne())})(ye,function(B){return function(F){var $=B,H=$.lib,T=H.CipherParams,_=$.enc,f=_.Hex,l=$.format;l.Hex={stringify:function(m){return m.ciphertext.toString(f)},parse:function(m){var h=f.parse(m);return T.create({ciphertext:h})}}}(),B.format.Hex})}(Lt)),Lt.exports}var Ut={exports:{}},Mr;function wn(){return Mr||(Mr=1,function(Y,L){(function(B,F,$){Y.exports=F(Se(),Qe(),$e(),qe(),Ne())})(ye,function(B){return function(){var F=B,$=F.lib,H=$.BlockCipher,T=F.algo,_=[],f=[],l=[],m=[],h=[],v=[],u=[],s=[],i=[],e=[];(function(){for(var a=[],t=0;t<256;t++)t<128?a[t]=t<<1:a[t]=t<<1^283;for(var n=0,c=0,t=0;t<256;t++){var p=c^c<<1^c<<2^c<<3^c<<4;p=p>>>8^p&255^99,_[n]=p,f[p]=n;var C=a[n],x=a[C],y=a[x],E=a[p]*257^p*16843008;l[n]=E<<24|E>>>8,m[n]=E<<16|E>>>16,h[n]=E<<8|E>>>24,v[n]=E;var E=y*16843009^x*65537^C*257^n*16843008;u[p]=E<<24|E>>>8,s[p]=E<<16|E>>>16,i[p]=E<<8|E>>>24,e[p]=E,n?(n=C^a[a[a[y^C]]],c^=a[a[c]]):n=c=1}})();var o=[0,1,2,4,8,16,32,64,128,27,54],r=T.AES=H.extend({_doReset:function(){var a;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var t=this._keyPriorReset=this._key,n=t.words,c=t.sigBytes/4,p=this._nRounds=c+6,C=(p+1)*4,x=this._keySchedule=[],y=0;y<C;y++)y<c?x[y]=n[y]:(a=x[y-1],y%c?c>6&&y%c==4&&(a=_[a>>>24]<<24|_[a>>>16&255]<<16|_[a>>>8&255]<<8|_[a&255]):(a=a<<8|a>>>24,a=_[a>>>24]<<24|_[a>>>16&255]<<16|_[a>>>8&255]<<8|_[a&255],a^=o[y/c|0]<<24),x[y]=x[y-c]^a);for(var E=this._invKeySchedule=[],S=0;S<C;S++){var y=C-S;if(S%4)var a=x[y];else var a=x[y-4];S<4||y<=4?E[S]=a:E[S]=u[_[a>>>24]]^s[_[a>>>16&255]]^i[_[a>>>8&255]]^e[_[a&255]]}}},encryptBlock:function(a,t){this._doCryptBlock(a,t,this._keySchedule,l,m,h,v,_)},decryptBlock:function(a,t){var n=a[t+1];a[t+1]=a[t+3],a[t+3]=n,this._doCryptBlock(a,t,this._invKeySchedule,u,s,i,e,f);var n=a[t+1];a[t+1]=a[t+3],a[t+3]=n},_doCryptBlock:function(a,t,n,c,p,C,x,y){for(var E=this._nRounds,S=a[t]^n[0],d=a[t+1]^n[1],R=a[t+2]^n[2],D=a[t+3]^n[3],A=4,b=1;b<E;b++){var g=c[S>>>24]^p[d>>>16&255]^C[R>>>8&255]^x[D&255]^n[A++],O=c[d>>>24]^p[R>>>16&255]^C[D>>>8&255]^x[S&255]^n[A++],k=c[R>>>24]^p[D>>>16&255]^C[S>>>8&255]^x[d&255]^n[A++],U=c[D>>>24]^p[S>>>16&255]^C[d>>>8&255]^x[R&255]^n[A++];S=g,d=O,R=k,D=U}var g=(y[S>>>24]<<24|y[d>>>16&255]<<16|y[R>>>8&255]<<8|y[D&255])^n[A++],O=(y[d>>>24]<<24|y[R>>>16&255]<<16|y[D>>>8&255]<<8|y[S&255])^n[A++],k=(y[R>>>24]<<24|y[D>>>16&255]<<16|y[S>>>8&255]<<8|y[d&255])^n[A++],U=(y[D>>>24]<<24|y[S>>>16&255]<<16|y[d>>>8&255]<<8|y[R&255])^n[A++];a[t]=g,a[t+1]=O,a[t+2]=k,a[t+3]=U},keySize:256/32});F.AES=H._createHelper(r)}(),B.AES})}(Ut)),Ut.exports}var Ft={exports:{}},kr;function Pn(){return kr||(kr=1,function(Y,L){(function(B,F,$){Y.exports=F(Se(),Qe(),$e(),qe(),Ne())})(ye,function(B){return function(){var F=B,$=F.lib,H=$.WordArray,T=$.BlockCipher,_=F.algo,f=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],l=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],m=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],h=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],v=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],u=_.DES=T.extend({_doReset:function(){for(var o=this._key,r=o.words,a=[],t=0;t<56;t++){var n=f[t]-1;a[t]=r[n>>>5]>>>31-n%32&1}for(var c=this._subKeys=[],p=0;p<16;p++){for(var C=c[p]=[],x=m[p],t=0;t<24;t++)C[t/6|0]|=a[(l[t]-1+x)%28]<<31-t%6,C[4+(t/6|0)]|=a[28+(l[t+24]-1+x)%28]<<31-t%6;C[0]=C[0]<<1|C[0]>>>31;for(var t=1;t<7;t++)C[t]=C[t]>>>(t-1)*4+3;C[7]=C[7]<<5|C[7]>>>27}for(var y=this._invSubKeys=[],t=0;t<16;t++)y[t]=c[15-t]},encryptBlock:function(o,r){this._doCryptBlock(o,r,this._subKeys)},decryptBlock:function(o,r){this._doCryptBlock(o,r,this._invSubKeys)},_doCryptBlock:function(o,r,a){this._lBlock=o[r],this._rBlock=o[r+1],s.call(this,4,252645135),s.call(this,16,65535),i.call(this,2,858993459),i.call(this,8,16711935),s.call(this,1,1431655765);for(var t=0;t<16;t++){for(var n=a[t],c=this._lBlock,p=this._rBlock,C=0,x=0;x<8;x++)C|=h[x][((p^n[x])&v[x])>>>0];this._lBlock=p,this._rBlock=c^C}var y=this._lBlock;this._lBlock=this._rBlock,this._rBlock=y,s.call(this,1,1431655765),i.call(this,8,16711935),i.call(this,2,858993459),s.call(this,16,65535),s.call(this,4,252645135),o[r]=this._lBlock,o[r+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function s(o,r){var a=(this._lBlock>>>o^this._rBlock)&r;this._rBlock^=a,this._lBlock^=a<<o}function i(o,r){var a=(this._rBlock>>>o^this._lBlock)&r;this._lBlock^=a,this._rBlock^=a<<o}F.DES=T._createHelper(u);var e=_.TripleDES=T.extend({_doReset:function(){var o=this._key,r=o.words;if(r.length!==2&&r.length!==4&&r.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var a=r.slice(0,2),t=r.length<4?r.slice(0,2):r.slice(2,4),n=r.length<6?r.slice(0,2):r.slice(4,6);this._des1=u.createEncryptor(H.create(a)),this._des2=u.createEncryptor(H.create(t)),this._des3=u.createEncryptor(H.create(n))},encryptBlock:function(o,r){this._des1.encryptBlock(o,r),this._des2.decryptBlock(o,r),this._des3.encryptBlock(o,r)},decryptBlock:function(o,r){this._des3.decryptBlock(o,r),this._des2.encryptBlock(o,r),this._des1.decryptBlock(o,r)},keySize:192/32,ivSize:64/32,blockSize:64/32});F.TripleDES=T._createHelper(e)}(),B.TripleDES})}(Ft)),Ft.exports}var Vt={exports:{}},Nr;function In(){return Nr||(Nr=1,function(Y,L){(function(B,F,$){Y.exports=F(Se(),Qe(),$e(),qe(),Ne())})(ye,function(B){return function(){var F=B,$=F.lib,H=$.StreamCipher,T=F.algo,_=T.RC4=H.extend({_doReset:function(){for(var m=this._key,h=m.words,v=m.sigBytes,u=this._S=[],s=0;s<256;s++)u[s]=s;for(var s=0,i=0;s<256;s++){var e=s%v,o=h[e>>>2]>>>24-e%4*8&255;i=(i+u[s]+o)%256;var r=u[s];u[s]=u[i],u[i]=r}this._i=this._j=0},_doProcessBlock:function(m,h){m[h]^=f.call(this)},keySize:256/32,ivSize:0});function f(){for(var m=this._S,h=this._i,v=this._j,u=0,s=0;s<4;s++){h=(h+1)%256,v=(v+m[h])%256;var i=m[h];m[h]=m[v],m[v]=i,u|=m[(m[h]+m[v])%256]<<24-s*8}return this._i=h,this._j=v,u}F.RC4=H._createHelper(_);var l=T.RC4Drop=_.extend({cfg:_.cfg.extend({drop:192}),_doReset:function(){_._doReset.call(this);for(var m=this.cfg.drop;m>0;m--)f.call(this)}});F.RC4Drop=H._createHelper(l)}(),B.RC4})}(Vt)),Vt.exports}var Ht={exports:{}},Br;function Mn(){return Br||(Br=1,function(Y,L){(function(B,F,$){Y.exports=F(Se(),Qe(),$e(),qe(),Ne())})(ye,function(B){return function(){var F=B,$=F.lib,H=$.StreamCipher,T=F.algo,_=[],f=[],l=[],m=T.Rabbit=H.extend({_doReset:function(){for(var v=this._key.words,u=this.cfg.iv,s=0;s<4;s++)v[s]=(v[s]<<8|v[s]>>>24)&16711935|(v[s]<<24|v[s]>>>8)&4278255360;var i=this._X=[v[0],v[3]<<16|v[2]>>>16,v[1],v[0]<<16|v[3]>>>16,v[2],v[1]<<16|v[0]>>>16,v[3],v[2]<<16|v[1]>>>16],e=this._C=[v[2]<<16|v[2]>>>16,v[0]&4294901760|v[1]&65535,v[3]<<16|v[3]>>>16,v[1]&4294901760|v[2]&65535,v[0]<<16|v[0]>>>16,v[2]&4294901760|v[3]&65535,v[1]<<16|v[1]>>>16,v[3]&4294901760|v[0]&65535];this._b=0;for(var s=0;s<4;s++)h.call(this);for(var s=0;s<8;s++)e[s]^=i[s+4&7];if(u){var o=u.words,r=o[0],a=o[1],t=(r<<8|r>>>24)&16711935|(r<<24|r>>>8)&4278255360,n=(a<<8|a>>>24)&16711935|(a<<24|a>>>8)&4278255360,c=t>>>16|n&4294901760,p=n<<16|t&65535;e[0]^=t,e[1]^=c,e[2]^=n,e[3]^=p,e[4]^=t,e[5]^=c,e[6]^=n,e[7]^=p;for(var s=0;s<4;s++)h.call(this)}},_doProcessBlock:function(v,u){var s=this._X;h.call(this),_[0]=s[0]^s[5]>>>16^s[3]<<16,_[1]=s[2]^s[7]>>>16^s[5]<<16,_[2]=s[4]^s[1]>>>16^s[7]<<16,_[3]=s[6]^s[3]>>>16^s[1]<<16;for(var i=0;i<4;i++)_[i]=(_[i]<<8|_[i]>>>24)&16711935|(_[i]<<24|_[i]>>>8)&4278255360,v[u+i]^=_[i]},blockSize:128/32,ivSize:64/32});function h(){for(var v=this._X,u=this._C,s=0;s<8;s++)f[s]=u[s];u[0]=u[0]+1295307597+this._b|0,u[1]=u[1]+3545052371+(u[0]>>>0<f[0]>>>0?1:0)|0,u[2]=u[2]+886263092+(u[1]>>>0<f[1]>>>0?1:0)|0,u[3]=u[3]+1295307597+(u[2]>>>0<f[2]>>>0?1:0)|0,u[4]=u[4]+3545052371+(u[3]>>>0<f[3]>>>0?1:0)|0,u[5]=u[5]+886263092+(u[4]>>>0<f[4]>>>0?1:0)|0,u[6]=u[6]+1295307597+(u[5]>>>0<f[5]>>>0?1:0)|0,u[7]=u[7]+3545052371+(u[6]>>>0<f[6]>>>0?1:0)|0,this._b=u[7]>>>0<f[7]>>>0?1:0;for(var s=0;s<8;s++){var i=v[s]+u[s],e=i&65535,o=i>>>16,r=((e*e>>>17)+e*o>>>15)+o*o,a=((i&4294901760)*i|0)+((i&65535)*i|0);l[s]=r^a}v[0]=l[0]+(l[7]<<16|l[7]>>>16)+(l[6]<<16|l[6]>>>16)|0,v[1]=l[1]+(l[0]<<8|l[0]>>>24)+l[7]|0,v[2]=l[2]+(l[1]<<16|l[1]>>>16)+(l[0]<<16|l[0]>>>16)|0,v[3]=l[3]+(l[2]<<8|l[2]>>>24)+l[1]|0,v[4]=l[4]+(l[3]<<16|l[3]>>>16)+(l[2]<<16|l[2]>>>16)|0,v[5]=l[5]+(l[4]<<8|l[4]>>>24)+l[3]|0,v[6]=l[6]+(l[5]<<16|l[5]>>>16)+(l[4]<<16|l[4]>>>16)|0,v[7]=l[7]+(l[6]<<8|l[6]>>>24)+l[5]|0}F.Rabbit=H._createHelper(m)}(),B.Rabbit})}(Ht)),Ht.exports}var jt={exports:{}},Lr;function kn(){return Lr||(Lr=1,function(Y,L){(function(B,F,$){Y.exports=F(Se(),Qe(),$e(),qe(),Ne())})(ye,function(B){return function(){var F=B,$=F.lib,H=$.StreamCipher,T=F.algo,_=[],f=[],l=[],m=T.RabbitLegacy=H.extend({_doReset:function(){var v=this._key.words,u=this.cfg.iv,s=this._X=[v[0],v[3]<<16|v[2]>>>16,v[1],v[0]<<16|v[3]>>>16,v[2],v[1]<<16|v[0]>>>16,v[3],v[2]<<16|v[1]>>>16],i=this._C=[v[2]<<16|v[2]>>>16,v[0]&4294901760|v[1]&65535,v[3]<<16|v[3]>>>16,v[1]&4294901760|v[2]&65535,v[0]<<16|v[0]>>>16,v[2]&4294901760|v[3]&65535,v[1]<<16|v[1]>>>16,v[3]&4294901760|v[0]&65535];this._b=0;for(var e=0;e<4;e++)h.call(this);for(var e=0;e<8;e++)i[e]^=s[e+4&7];if(u){var o=u.words,r=o[0],a=o[1],t=(r<<8|r>>>24)&16711935|(r<<24|r>>>8)&4278255360,n=(a<<8|a>>>24)&16711935|(a<<24|a>>>8)&4278255360,c=t>>>16|n&4294901760,p=n<<16|t&65535;i[0]^=t,i[1]^=c,i[2]^=n,i[3]^=p,i[4]^=t,i[5]^=c,i[6]^=n,i[7]^=p;for(var e=0;e<4;e++)h.call(this)}},_doProcessBlock:function(v,u){var s=this._X;h.call(this),_[0]=s[0]^s[5]>>>16^s[3]<<16,_[1]=s[2]^s[7]>>>16^s[5]<<16,_[2]=s[4]^s[1]>>>16^s[7]<<16,_[3]=s[6]^s[3]>>>16^s[1]<<16;for(var i=0;i<4;i++)_[i]=(_[i]<<8|_[i]>>>24)&16711935|(_[i]<<24|_[i]>>>8)&4278255360,v[u+i]^=_[i]},blockSize:128/32,ivSize:64/32});function h(){for(var v=this._X,u=this._C,s=0;s<8;s++)f[s]=u[s];u[0]=u[0]+1295307597+this._b|0,u[1]=u[1]+3545052371+(u[0]>>>0<f[0]>>>0?1:0)|0,u[2]=u[2]+886263092+(u[1]>>>0<f[1]>>>0?1:0)|0,u[3]=u[3]+1295307597+(u[2]>>>0<f[2]>>>0?1:0)|0,u[4]=u[4]+3545052371+(u[3]>>>0<f[3]>>>0?1:0)|0,u[5]=u[5]+886263092+(u[4]>>>0<f[4]>>>0?1:0)|0,u[6]=u[6]+1295307597+(u[5]>>>0<f[5]>>>0?1:0)|0,u[7]=u[7]+3545052371+(u[6]>>>0<f[6]>>>0?1:0)|0,this._b=u[7]>>>0<f[7]>>>0?1:0;for(var s=0;s<8;s++){var i=v[s]+u[s],e=i&65535,o=i>>>16,r=((e*e>>>17)+e*o>>>15)+o*o,a=((i&4294901760)*i|0)+((i&65535)*i|0);l[s]=r^a}v[0]=l[0]+(l[7]<<16|l[7]>>>16)+(l[6]<<16|l[6]>>>16)|0,v[1]=l[1]+(l[0]<<8|l[0]>>>24)+l[7]|0,v[2]=l[2]+(l[1]<<16|l[1]>>>16)+(l[0]<<16|l[0]>>>16)|0,v[3]=l[3]+(l[2]<<8|l[2]>>>24)+l[1]|0,v[4]=l[4]+(l[3]<<16|l[3]>>>16)+(l[2]<<16|l[2]>>>16)|0,v[5]=l[5]+(l[4]<<8|l[4]>>>24)+l[3]|0,v[6]=l[6]+(l[5]<<16|l[5]>>>16)+(l[4]<<16|l[4]>>>16)|0,v[7]=l[7]+(l[6]<<8|l[6]>>>24)+l[5]|0}F.RabbitLegacy=H._createHelper(m)}(),B.RabbitLegacy})}(jt)),jt.exports}var Wt={exports:{}},Ur;function Nn(){return Ur||(Ur=1,function(Y,L){(function(B,F,$){Y.exports=F(Se(),Qe(),$e(),qe(),Ne())})(ye,function(B){return function(){var F=B,$=F.lib,H=$.BlockCipher,T=F.algo;const _=16,f=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],l=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var m={pbox:[],sbox:[]};function h(e,o){let r=o>>24&255,a=o>>16&255,t=o>>8&255,n=o&255,c=e.sbox[0][r]+e.sbox[1][a];return c=c^e.sbox[2][t],c=c+e.sbox[3][n],c}function v(e,o,r){let a=o,t=r,n;for(let c=0;c<_;++c)a=a^e.pbox[c],t=h(e,a)^t,n=a,a=t,t=n;return n=a,a=t,t=n,t=t^e.pbox[_],a=a^e.pbox[_+1],{left:a,right:t}}function u(e,o,r){let a=o,t=r,n;for(let c=_+1;c>1;--c)a=a^e.pbox[c],t=h(e,a)^t,n=a,a=t,t=n;return n=a,a=t,t=n,t=t^e.pbox[1],a=a^e.pbox[0],{left:a,right:t}}function s(e,o,r){for(let p=0;p<4;p++){e.sbox[p]=[];for(let C=0;C<256;C++)e.sbox[p][C]=l[p][C]}let a=0;for(let p=0;p<_+2;p++)e.pbox[p]=f[p]^o[a],a++,a>=r&&(a=0);let t=0,n=0,c=0;for(let p=0;p<_+2;p+=2)c=v(e,t,n),t=c.left,n=c.right,e.pbox[p]=t,e.pbox[p+1]=n;for(let p=0;p<4;p++)for(let C=0;C<256;C+=2)c=v(e,t,n),t=c.left,n=c.right,e.sbox[p][C]=t,e.sbox[p][C+1]=n;return!0}var i=T.Blowfish=H.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var e=this._keyPriorReset=this._key,o=e.words,r=e.sigBytes/4;s(m,o,r)}},encryptBlock:function(e,o){var r=v(m,e[o],e[o+1]);e[o]=r.left,e[o+1]=r.right},decryptBlock:function(e,o){var r=u(m,e[o],e[o+1]);e[o]=r.left,e[o+1]=r.right},blockSize:64/32,keySize:128/32,ivSize:64/32});F.Blowfish=H._createHelper(i)}(),B.Blowfish})}(Wt)),Wt.exports}(function(Y,L){(function(B,F,$){Y.exports=F(Se(),rt(),ln(),pn(),Qe(),fn(),$e(),dr(),mt(),hn(),hr(),vn(),mn(),En(),bt(),gn(),qe(),Ne(),yn(),_n(),Sn(),Cn(),bn(),Rn(),xn(),Tn(),An(),Dn(),On(),wn(),Pn(),In(),Mn(),kn(),Nn())})(ye,function(B){return B})})(tr);var Bn=tr.exports,et=un(Bn);function Ln(Y){return et.MD5(Y).toString().toUpperCase()}function Un(Y,L,B,F,$,H,T,_){var f;let l="";H.set("x-log-apiversion","0.6.0"),H.set("x-log-signaturemethod","hmac-sha1"),l+=Y+`
17
17
  `+T+`
18
- `+((m=j.get("Content-Type"))!=null?m:"")+`
18
+ `+((f=H.get("Content-Type"))!=null?f:"")+`
19
19
  `+_+`
20
- `;const f=(c,a)=>c[0].localeCompare(a[0]),y=c=>c[0].startsWith("x-log-")||c[0].startsWith("x-acs-");try{const c=[...j.entries()].filter(y).sort(f).map(a=>a[0]+":"+a[1]+`
21
- `).join("");d+=c}catch{}d+=L,Q.size>0&&(d+="?");try{d+=[...Q.entries()].sort(f).map(c=>c[0]+"="+c[1]).join("&")}catch{}const v=et.HmacSHA1(d,V).toString(et.enc.Base64),s="LOG "+M+":"+v;return j.set("Authorization",s),j.set("x-log-date",_),s}var Fn=(Y,L,M)=>new Promise((V,Q)=>{var j=m=>{try{_(M.next(m))}catch(d){Q(d)}},T=m=>{try{_(M.throw(m))}catch(d){Q(d)}},_=m=>m.done?V(m.value):Promise.resolve(m.value).then(j,T);_((M=M.apply(Y,L)).next())});function Vn(Y){return Fn(this,null,function*(){const L=new Date;if(Y.refreshSTSTokenInterval||(Y.refreshSTSTokenInterval=3e5),!Y.stsTokenFreshTime||+L-Y.stsTokenFreshTime>=Y.refreshSTSTokenInterval){Y.stsTokenFreshTime=L;try{yield Y.refreshSTSToken()}catch(M){typeof console.error=="function"&&console.error(`Some error occured during excuting refreshSTSToken, see:
22
- `+M)}}return null})}var Hn=(Y,L,M)=>new Promise((V,Q)=>{var j=m=>{try{_(M.next(m))}catch(d){Q(d)}},T=m=>{try{_(M.throw(m))}catch(d){Q(d)}},_=m=>m.done?V(m.value):Promise.resolve(m.value).then(j,T);_((M=M.apply(Y,L)).next())});function Fr(Y){return{transString:function(L){let M={},V=0,Q=!1;for(let j in L){if((j==="time"||j==="__time__")&&typeof L[j]=="number"){V=L[j],Q=!0;continue}typeof L[j]=="object"?M[j]=JSON.stringify(L[j]):M[j]=String(L[j])}return M.__time__=Q?V:Math.floor(new Date().getTime()/1e3),M},process:function(L,M){return Hn(this,null,function*(){yield Vn(Y);let V=L.slice(L.indexOf("/logstores")),Q=M.length,j=Ln(M),T=new Date().toUTCString(),_=new Map,m=new Map([["Content-Type","application/json"],["Content-MD5",j],["x-log-bodyrawsize",Q.toString()]]);Y.securityToken&&m.set("x-acs-security-token",Y.securityToken),Un("POST",V,Y.accessKeyId,Y.accessKeySecret,_,m,j,T);let d=Object.fromEntries(m);return{data:M,header:d}})}}}typeof window<"u"&&$t(window,"stsPlugin",Fr);var Vr={exports:{}};/*! aliyun rts sdk - ver2.13.0 created:2025/7/24 20:19:04 */(function(Y,L){(function(M,V){Y.exports=V()})(self,()=>(()=>{var M={280:j=>{var T;T=()=>(()=>{var _={692:y=>{var v=y.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(s){return s.encoding?"rtpmap:%d %s/%s/%s":s.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(s){return s.address!=null?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(s){return s.subtype!=null?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(s){return"extmap:%d"+(s.direction?"/%s":"%v")+(s["encrypt-uri"]?" %s":"%v")+" %s"+(s.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(s){return s.sessionConfig!=null?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(s){var c="candidate:%s %d %s %d %s %d typ %s";return c+=s.raddr!=null?" raddr %s rport %d":"%v%v",c+=s.tcptype!=null?" tcptype %s":"%v",s.generation!=null&&(c+=" generation %d"),(c+=s["network-id"]!=null?" network-id %d":"%v")+(s["network-cost"]!=null?" network-cost %d":"%v")}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(s){var c="ssrc:%d";return s.attribute!=null&&(c+=" %s",s.value!=null&&(c+=":%s")),c}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(s){return s.maxMessageSize!=null?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(s){return s.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(s){return"imageattr:%s %s %s"+(s.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(s){return"simulcast:%s %s"+(s.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(s){return"ts-refclk:%s"+(s.clksrcExt!=null?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(s){var c="mediaclk:";return c+=s.id!=null?"id=%s %s":"%v%s",c+=s.mediaClockValue!=null?"=%s":"",(c+=s.rateNumerator!=null?" rate=%s":"")+(s.rateDenominator!=null?"/%s":"")}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]};Object.keys(v).forEach(function(s){v[s].forEach(function(c){c.reg||(c.reg=/(.*)/),c.format||(c.format="%s")})})},766:(y,v,s)=>{var c=s(962),a=s(627);v.write=a,v.parse=c.parse,v.parseParams=c.parseParams,v.parseFmtpConfig=c.parseFmtpConfig,v.parsePayloads=c.parsePayloads,v.parseRemoteCandidates=c.parseRemoteCandidates,v.parseImageAttributes=c.parseImageAttributes,v.parseSimulcastStreamList=c.parseSimulcastStreamList},962:(y,v,s)=>{var c=function(o){return String(Number(o))===o?Number(o):o},a=function(o,t,n){var u=o.name&&o.names;o.push&&!t[o.push]?t[o.push]=[]:u&&!t[o.name]&&(t[o.name]={});var h=o.push?{}:u?t[o.name]:t;(function(S,x,E,p){if(p&&!E)x[p]=c(S[1]);else for(var b=0;b<E.length;b+=1)S[b+1]!=null&&(x[E[b]]=c(S[b+1]))})(n.match(o.reg),h,o.names,o.name),o.push&&t[o.push].push(h)},e=s(692),r=RegExp.prototype.test.bind(/^([a-z])=(.*)/);v.parse=function(o){var t={},n=[],u=t;return o.split(/(\r\n|\r|\n)/).filter(r).forEach(function(h){var S=h[0],x=h.slice(2);S==="m"&&(n.push({rtp:[],fmtp:[]}),u=n[n.length-1]);for(var E=0;E<(e[S]||[]).length;E+=1){var p=e[S][E];if(p.reg.test(x))return a(p,u,x)}}),t.media=n,t};var i=function(o,t){var n=t.split(/=(.+)/,2);return n.length===2?o[n[0]]=c(n[1]):n.length===1&&t.length>1&&(o[n[0]]=void 0),o};v.parseParams=function(o){return o.split(/;\s?/).reduce(i,{})},v.parseFmtpConfig=v.parseParams,v.parsePayloads=function(o){return o.toString().split(" ").map(Number)},v.parseRemoteCandidates=function(o){for(var t=[],n=o.split(" ").map(c),u=0;u<n.length;u+=3)t.push({component:n[u],ip:n[u+1],port:n[u+2]});return t},v.parseImageAttributes=function(o){return o.split(" ").map(function(t){return t.substring(1,t.length-1).split(",").reduce(i,{})})},v.parseSimulcastStreamList=function(o){return o.split(";").map(function(t){return t.split(",").map(function(n){var u,h=!1;return n[0]!=="~"?u=c(n):(u=c(n.substring(1,n.length)),h=!0),{scid:u,paused:h}})})}},627:(y,v,s)=>{var c=s(692),a=/%[sdv%]/g,e=function(t){var n=1,u=arguments,h=u.length;return t.replace(a,function(S){if(n>=h)return S;var x=u[n];switch(n+=1,S){case"%%":return"%";case"%s":return String(x);case"%d":return Number(x);case"%v":return""}})},r=function(t,n,u){var h=[t+"="+(n.format instanceof Function?n.format(n.push?u:u[n.name]):n.format)];if(n.names)for(var S=0;S<n.names.length;S+=1){var x=n.names[S];n.name?h.push(u[n.name][x]):h.push(u[n.names[S]])}else h.push(u[n.name]);return e.apply(null,h)},i=["v","o","s","i","u","e","p","c","b","t","r","z","a"],o=["i","c","b","a"];y.exports=function(t,n){n=n||{},t.version==null&&(t.version=0),t.name==null&&(t.name=" "),t.media.forEach(function(x){x.payloads==null&&(x.payloads="")});var u=n.outerOrder||i,h=n.innerOrder||o,S=[];return u.forEach(function(x){c[x].forEach(function(E){E.name in t&&t[E.name]!=null?S.push(r(x,E,t)):E.push in t&&t[E.push]!=null&&t[E.push].forEach(function(p){S.push(r(x,E,p))})})}),t.media.forEach(function(x){S.push(r("m",c.m[0],x)),h.forEach(function(E){c[E].forEach(function(p){p.name in x&&x[p.name]!=null?S.push(r(E,p,x)):p.push in x&&x[p.push]!=null&&x[p.push].forEach(function(b){S.push(r(E,p,b))})})})}),S.join(`\r
20
+ `;const m=(s,i)=>s[0].localeCompare(i[0]),h=s=>s[0].startsWith("x-log-")||s[0].startsWith("x-acs-");try{const s=[...H.entries()].filter(h).sort(m).map(i=>i[0]+":"+i[1]+`
21
+ `).join("");l+=s}catch{}l+=L,$.size>0&&(l+="?");try{l+=[...$.entries()].sort(m).map(s=>s[0]+"="+s[1]).join("&")}catch{}const v=et.HmacSHA1(l,F).toString(et.enc.Base64),u="LOG "+B+":"+v;return H.set("Authorization",u),H.set("x-log-date",_),u}var Fn=(Y,L,B)=>new Promise((F,$)=>{var H=f=>{try{_(B.next(f))}catch(l){$(l)}},T=f=>{try{_(B.throw(f))}catch(l){$(l)}},_=f=>f.done?F(f.value):Promise.resolve(f.value).then(H,T);_((B=B.apply(Y,L)).next())});function Vn(Y){return Fn(this,null,function*(){const L=new Date;if(Y.refreshSTSTokenInterval||(Y.refreshSTSTokenInterval=3e5),!Y.stsTokenFreshTime||+L-Y.stsTokenFreshTime>=Y.refreshSTSTokenInterval){Y.stsTokenFreshTime=L;try{yield Y.refreshSTSToken()}catch(B){typeof console.error=="function"&&console.error(`Some error occured during excuting refreshSTSToken, see:
22
+ `+B)}}return null})}var Hn=(Y,L,B)=>new Promise((F,$)=>{var H=f=>{try{_(B.next(f))}catch(l){$(l)}},T=f=>{try{_(B.throw(f))}catch(l){$(l)}},_=f=>f.done?F(f.value):Promise.resolve(f.value).then(H,T);_((B=B.apply(Y,L)).next())});function Fr(Y){return{transString:function(L){let B={},F=0,$=!1;for(let H in L){if((H==="time"||H==="__time__")&&typeof L[H]=="number"){F=L[H],$=!0;continue}typeof L[H]=="object"?B[H]=JSON.stringify(L[H]):B[H]=String(L[H])}return B.__time__=$?F:Math.floor(new Date().getTime()/1e3),B},process:function(L,B){return Hn(this,null,function*(){yield Vn(Y);let F=L.slice(L.indexOf("/logstores")),$=B.length,H=Ln(B),T=new Date().toUTCString(),_=new Map,f=new Map([["Content-Type","application/json"],["Content-MD5",H],["x-log-bodyrawsize",$.toString()]]);Y.securityToken&&f.set("x-acs-security-token",Y.securityToken),Un("POST",F,Y.accessKeyId,Y.accessKeySecret,_,f,H,T);let l=Object.fromEntries(f);return{data:B,header:l}})}}}typeof window<"u"&&Jt(window,"stsPlugin",Fr);var Vr={exports:{}};/*! aliyun rts sdk - ver2.13.2 created:2025/10/14 11:48:41 */(function(Y,L){(function(B,F){Y.exports=F()})(self,()=>(()=>{var B={280:H=>{var T;T=()=>(()=>{var _={775:h=>{var v=Object.prototype.hasOwnProperty;function u(i){return"[Throws: "+(i?i.message:"?")+"]"}function s(i){var e=[];return function o(r){if(r===null||typeof r!="object")return r;if(e.indexOf(r)!==-1)return"[Circular]";if(e.push(r),typeof r.toJSON=="function")try{var a=o(r.toJSON());return e.pop(),a}catch(c){return u(c)}if(Array.isArray(r)){var t=r.map(o);return e.pop(),t}var n=Object.keys(r).reduce(function(c,p){return c[p]=o(function(C,x){if(v.call(C,x))try{return C[x]}catch(y){return u(y)}return C[x]}(r,p)),c},{});return e.pop(),n}(i)}h.exports=function(i,e,o){return JSON.stringify(s(i),e,o)},h.exports.ensureProperties=s},692:h=>{var v=h.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(u){return u.encoding?"rtpmap:%d %s/%s/%s":u.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(u){return u.address!=null?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(u){return u.subtype!=null?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(u){return"extmap:%d"+(u.direction?"/%s":"%v")+(u["encrypt-uri"]?" %s":"%v")+" %s"+(u.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(u){return u.sessionConfig!=null?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(u){var s="candidate:%s %d %s %d %s %d typ %s";return s+=u.raddr!=null?" raddr %s rport %d":"%v%v",s+=u.tcptype!=null?" tcptype %s":"%v",u.generation!=null&&(s+=" generation %d"),(s+=u["network-id"]!=null?" network-id %d":"%v")+(u["network-cost"]!=null?" network-cost %d":"%v")}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(u){var s="ssrc:%d";return u.attribute!=null&&(s+=" %s",u.value!=null&&(s+=":%s")),s}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(u){return u.maxMessageSize!=null?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(u){return u.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(u){return"imageattr:%s %s %s"+(u.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(u){return"simulcast:%s %s"+(u.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(u){return"ts-refclk:%s"+(u.clksrcExt!=null?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(u){var s="mediaclk:";return s+=u.id!=null?"id=%s %s":"%v%s",s+=u.mediaClockValue!=null?"=%s":"",(s+=u.rateNumerator!=null?" rate=%s":"")+(u.rateDenominator!=null?"/%s":"")}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]};Object.keys(v).forEach(function(u){v[u].forEach(function(s){s.reg||(s.reg=/(.*)/),s.format||(s.format="%s")})})},766:(h,v,u)=>{var s=u(962),i=u(627);v.write=i,v.parse=s.parse,v.parseParams=s.parseParams,v.parseFmtpConfig=s.parseFmtpConfig,v.parsePayloads=s.parsePayloads,v.parseRemoteCandidates=s.parseRemoteCandidates,v.parseImageAttributes=s.parseImageAttributes,v.parseSimulcastStreamList=s.parseSimulcastStreamList},962:(h,v,u)=>{var s=function(a){return String(Number(a))===a?Number(a):a},i=function(a,t,n){var c=a.name&&a.names;a.push&&!t[a.push]?t[a.push]=[]:c&&!t[a.name]&&(t[a.name]={});var p=a.push?{}:c?t[a.name]:t;(function(C,x,y,E){if(E&&!y)x[E]=s(C[1]);else for(var S=0;S<y.length;S+=1)C[S+1]!=null&&(x[y[S]]=s(C[S+1]))})(n.match(a.reg),p,a.names,a.name),a.push&&t[a.push].push(p)},e=u(692),o=RegExp.prototype.test.bind(/^([a-z])=(.*)/);v.parse=function(a){var t={},n=[],c=t;return a.split(/(\r\n|\r|\n)/).filter(o).forEach(function(p){var C=p[0],x=p.slice(2);C==="m"&&(n.push({rtp:[],fmtp:[]}),c=n[n.length-1]);for(var y=0;y<(e[C]||[]).length;y+=1){var E=e[C][y];if(E.reg.test(x))return i(E,c,x)}}),t.media=n,t};var r=function(a,t){var n=t.split(/=(.+)/,2);return n.length===2?a[n[0]]=s(n[1]):n.length===1&&t.length>1&&(a[n[0]]=void 0),a};v.parseParams=function(a){return a.split(/;\s?/).reduce(r,{})},v.parseFmtpConfig=v.parseParams,v.parsePayloads=function(a){return a.toString().split(" ").map(Number)},v.parseRemoteCandidates=function(a){for(var t=[],n=a.split(" ").map(s),c=0;c<n.length;c+=3)t.push({component:n[c],ip:n[c+1],port:n[c+2]});return t},v.parseImageAttributes=function(a){return a.split(" ").map(function(t){return t.substring(1,t.length-1).split(",").reduce(r,{})})},v.parseSimulcastStreamList=function(a){return a.split(";").map(function(t){return t.split(",").map(function(n){var c,p=!1;return n[0]!=="~"?c=s(n):(c=s(n.substring(1,n.length)),p=!0),{scid:c,paused:p}})})}},627:(h,v,u)=>{var s=u(692),i=/%[sdv%]/g,e=function(t){var n=1,c=arguments,p=c.length;return t.replace(i,function(C){if(n>=p)return C;var x=c[n];switch(n+=1,C){case"%%":return"%";case"%s":return String(x);case"%d":return Number(x);case"%v":return""}})},o=function(t,n,c){var p=[t+"="+(n.format instanceof Function?n.format(n.push?c:c[n.name]):n.format)];if(n.names)for(var C=0;C<n.names.length;C+=1){var x=n.names[C];n.name?p.push(c[n.name][x]):p.push(c[n.names[C]])}else p.push(c[n.name]);return e.apply(null,p)},r=["v","o","s","i","u","e","p","c","b","t","r","z","a"],a=["i","c","b","a"];h.exports=function(t,n){n=n||{},t.version==null&&(t.version=0),t.name==null&&(t.name=" "),t.media.forEach(function(x){x.payloads==null&&(x.payloads="")});var c=n.outerOrder||r,p=n.innerOrder||a,C=[];return c.forEach(function(x){s[x].forEach(function(y){y.name in t&&t[y.name]!=null?C.push(o(x,y,t)):y.push in t&&t[y.push]!=null&&t[y.push].forEach(function(E){C.push(o(x,y,E))})})}),t.media.forEach(function(x){C.push(o("m",s.m[0],x)),p.forEach(function(y){s[y].forEach(function(E){E.name in x&&x[E.name]!=null?C.push(o(y,E,x)):E.push in x&&x[E.push]!=null&&x[E.push].forEach(function(S){C.push(o(y,E,S))})})})}),C.join(`\r
23
23
  `)+`\r
24
- `}},776:function(y,v,s){var c,a=this&&this.__extends||(c=function(N,H){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(F,P){F.__proto__=P}||function(F,P){for(var B in P)Object.prototype.hasOwnProperty.call(P,B)&&(F[B]=P[B])},c(N,H)},function(N,H){if(typeof H!="function"&&H!==null)throw new TypeError("Class extends value "+String(H)+" is not a constructor or null");function F(){this.constructor=N}c(N,H),N.prototype=H===null?Object.create(H):(F.prototype=H.prototype,new F)}),e=this&&this.__assign||function(){return e=Object.assign||function(N){for(var H,F=1,P=arguments.length;F<P;F++)for(var B in H=arguments[F])Object.prototype.hasOwnProperty.call(H,B)&&(N[B]=H[B]);return N},e.apply(this,arguments)},r=this&&this.__awaiter||function(N,H,F,P){return new(F||(F=Promise))(function(B,W){function z(re){try{J(P.next(re))}catch(te){W(te)}}function G(re){try{J(P.throw(re))}catch(te){W(te)}}function J(re){var te;re.done?B(re.value):(te=re.value,te instanceof F?te:new F(function(ie){ie(te)})).then(z,G)}J((P=P.apply(N,H||[])).next())})},i=this&&this.__generator||function(N,H){var F,P,B,W,z={label:0,sent:function(){if(1&B[0])throw B[1];return B[1]},trys:[],ops:[]};return W={next:G(0),throw:G(1),return:G(2)},typeof Symbol=="function"&&(W[Symbol.iterator]=function(){return this}),W;function G(J){return function(re){return function(te){if(F)throw new TypeError("Generator is already executing.");for(;W&&(W=0,te[0]&&(z=0)),z;)try{if(F=1,P&&(B=2&te[0]?P.return:te[0]?P.throw||((B=P.return)&&B.call(P),0):P.next)&&!(B=B.call(P,te[1])).done)return B;switch(P=0,B&&(te=[2&te[0],B.value]),te[0]){case 0:case 1:B=te;break;case 4:return z.label++,{value:te[1],done:!1};case 5:z.label++,P=te[1],te=[0];continue;case 7:te=z.ops.pop(),z.trys.pop();continue;default:if(!((B=(B=z.trys).length>0&&B[B.length-1])||te[0]!==6&&te[0]!==2)){z=0;continue}if(te[0]===3&&(!B||te[1]>B[0]&&te[1]<B[3])){z.label=te[1];break}if(te[0]===6&&z.label<B[1]){z.label=B[1],B=te;break}if(B&&z.label<B[2]){z.label=B[2],z.ops.push(te);break}B[2]&&z.ops.pop(),z.trys.pop();continue}te=H.call(N,z)}catch(ie){te=[6,ie],P=0}finally{F=B=0}if(5&te[0])throw te[1];return{value:te[0]?te[1]:void 0,done:!0}}([J,re])}}},o=this&&this.__spreadArray||function(N,H,F){if(F||arguments.length===2)for(var P,B=0,W=H.length;B<W;B++)!P&&B in H||(P||(P=Array.prototype.slice.call(H,0,B)),P[B]=H[B]);return N.concat(P||Array.prototype.slice.call(H))},t=this&&this.__importDefault||function(N){return N&&N.__esModule?N:{default:N}};Object.defineProperty(v,"__esModule",{value:!0}),v.PeerConnectionCore=v.DEFAULT_HEARTBEAT_INTERVAL=v.EDatachannelStatus=void 0;var n=s(887),u=s(248),h=s(237),S=s(619),x=s(628),E=s(961),p=s(844),b=s(651);Object.defineProperty(v,"EDatachannelStatus",{enumerable:!0,get:function(){return b.EDatachannelStatus}});var l,A=s(854),R=t(s(885)),C=s(132),g=t(s(123)),D=s(125),O="rts video",U="rts audio";v.DEFAULT_HEARTBEAT_INTERVAL=2500,function(N){N.SUB_ADD="subsribe add",N.SUB_DELETE="subscribe delete",N.SUB_ACTIVE="subscribe active",N.SUB_STOP="subscribe stop",N.PUB_ADD="publish add",N.PUB_DELETE="publish delete",N.PUB_REPLACE="publish replace",N.PUB_STOP="publish stop",N.DATACHANNEL_SUB_ADD="sub add datachannel",N.DATACHANNEL_SUB_ACTIVE="sub active datachannel",N.DATACHANNEL_SUB_STOP="sub delete datachannel",N.DATACHANNEL_PUB_ADD="pub add datachannel",N.DATACHANNEL_PUB_STOP="pub delete datachannel"}(l||(l={}));var k=function(N){function H(F){var P=N.call(this)||this;return P.PCCore=F,P}return a(H,N),H.prototype.excuteSignal=function(F,P,B,W){var z=this;switch(F){case l.SUB_ADD:this.PCCore.proceedSubscribeAdd(W.configList,W.reconnecting).then(function(G){P(G)}).catch(function(G){B(G)}).finally(function(){z.emit("onSignalDone")});break;case l.SUB_DELETE:this.PCCore.proceedSubscribeDeleteTracks(W.configList,W.skipError).then(function(G){P(G)}).catch(function(G){B(G)}).finally(function(){z.emit("onSignalDone")});break;case l.SUB_ACTIVE:break;case l.SUB_STOP:this.PCCore.proceedSubscribeStop(W.configList).then(function(G){P(G)}).catch(function(G){B(G)}).finally(function(){z.emit("onSignalDone")});break;case l.PUB_ADD:this.PCCore.proceedPublishAdd(W.configList).then(function(G){P(G)}).catch(function(G){B(G)}).finally(function(){z.emit("onSignalDone")});break;case l.PUB_REPLACE:this.PCCore.proceedPublishReplaceTracks(W.configList).then(function(G){P(G)}).catch(function(G){B(G)}).finally(function(){z.emit("onSignalDone")});break;case l.PUB_DELETE:this.PCCore.proceedPublishDeleteTracks(W.configList).then(function(G){P(G)}).catch(function(G){B(G)}).finally(function(){z.emit("onSignalDone")});break;case l.PUB_STOP:this.PCCore.proceedPublishStop(W.configList).then(function(G){P(G)}).catch(function(G){B(G)}).finally(function(){z.emit("onSignalDone")});break;case l.DATACHANNEL_SUB_ADD:this.PCCore.proceedSubscribeAddDatachannel(W.configList).then(function(G){P(G)}).catch(function(G){B(G)}).finally(function(){z.emit("onSignalDone")});break;case l.DATACHANNEL_SUB_STOP:this.PCCore.proceedSubscribeStopDatachannel(W.configList).then(function(G){P(G)}).catch(function(G){B(G)}).finally(function(){z.emit("onSignalDone")});break;case l.DATACHANNEL_PUB_ADD:this.PCCore.proceedPublishAddDatachannel(W.configList).then(function(G){P(G)}).catch(function(G){B(G)}).finally(function(){z.emit("onSignalDone")});break;case l.DATACHANNEL_PUB_STOP:this.PCCore.proceedPublishStopDatachannel(W.configList).then(function(G){P(G)}).catch(function(G){B(G)}).finally(function(){z.emit("onSignalDone")})}},H}(R.default),w=function(N){function H(F){var P=N.call(this)||this;return P.heartbeatTimelineMap=new Map,P.removeTwcc=!1,P.mutex=!1,P.eventQueue=new A.CacheBuffer("signal queue"),P.signalTimer=null,P.rollbackController=new C.PeerConnectionRollbackController(P),P.onInnerSubscribeDelete=function(){},P.receiverCodecPreferences={},P.senderCodecPreferences={},P.removeTrackListener=function(){},P.heartbeatTimerHandle=null,P.heartbeatTokenRing=0,P.streamManager=new x.StreamManager,F.pc?(P.pc=F.pc,P.signal=new S.Signal({pc:F.pc,onDatachannelEvent:F.onDatachannelEvent,delayOpen:F.delayOpen}),P.heartbeatProcessor=new g.default(P.signal.getDatachannelCore().getWebrtcDatachannel(),P.streamManager),P.initHeartbeatListener(),P.notifyProcessor=new D.NotifyProcessor,P.initNotifyListener(),P.onInnerSubscribeDelete=F.onInnerSubscribeDelete||function(){},P.offerSdpHook=F.offerSdpHook,P.answerSdpHook=F.answerSdpHook,P):(console.error("peerconnetion is required"),P)}return a(H,N),H.prototype.getStreamManager=function(){return this.streamManager},H.prototype.getSignal=function(){return this.signal},H.prototype.setPrevOfferSdp=function(F){this.prevOfferSdp=F},H.prototype.setPrevAnswerSdp=function(F){this.prevAnswerSdp=F},H.prototype.setStreamManager=function(F){this.streamManager=F},H.prototype.getTrackIds=function(F){return F.reduce(function(P,B){return o(o([],P,!0),[B.id],!1)},[])},H.prototype.setRemoveTwcc=function(F){this.removeTwcc=F},H.prototype.setReceiverCodecPreferences=function(F){this.receiverCodecPreferences=e({},F)},H.prototype.setSenderCodecPreferences=function(F){this.senderCodecPreferences=e({},F)},H.prototype.subscribeAdd=function(F,P){var B=this;return new Promise(function(W,z){var G=new k(B);if(B.mutex){var J={type:l.SUB_ADD,excuter:G,res:W,rej:z,data:{configList:F}};B.eventQueue.cache(J)}else B.atomSignalExec(l.SUB_ADD,G,W,z,{configList:F,reconnecting:P})})},H.prototype.subscribeDeleteTracks=function(F,P){var B=this;return new Promise(function(W,z){var G=new k(B);if(B.mutex){var J={type:l.SUB_DELETE,excuter:G,res:W,rej:z,data:{configList:F,skipError:P}};B.eventQueue.cache(J)}else B.atomSignalExec(l.SUB_DELETE,G,W,z,{configList:F,skipError:P})})},H.prototype.subscribeStop=function(F){var P=this;return new Promise(function(B,W){var z=new k(P);if(P.mutex){var G={type:l.SUB_STOP,excuter:z,res:B,rej:W,data:{configList:F}};P.eventQueue.cache(G)}else P.atomSignalExec(l.SUB_STOP,z,B,W,{configList:F})})},H.prototype.publishAdd=function(F){var P=this;return new Promise(function(B,W){var z=new k(P);if(P.mutex){var G={type:l.PUB_ADD,excuter:z,res:B,rej:W,data:{configList:F}};P.eventQueue.cache(G)}else P.atomSignalExec(l.PUB_ADD,z,B,W,{configList:F})})},H.prototype.publishReplaceTracks=function(F){var P=this;return new Promise(function(B,W){var z=new k(P);if(P.mutex){var G={type:l.PUB_REPLACE,excuter:z,res:B,rej:W,data:{configList:F}};P.eventQueue.cache(G)}else P.atomSignalExec(l.PUB_REPLACE,z,B,W,{configList:F})})},H.prototype.publishDeleteTracks=function(F){var P=this;return new Promise(function(B,W){var z=new k(P);if(P.mutex){var G={type:l.PUB_DELETE,excuter:z,res:B,rej:W,data:{configList:F}};P.eventQueue.cache(G)}else P.atomSignalExec(l.PUB_DELETE,z,B,W,{configList:F})})},H.prototype.publishStop=function(F){var P=this;return new Promise(function(B,W){var z=new k(P);if(P.mutex){var G={type:l.PUB_STOP,excuter:z,res:B,rej:W,data:{configList:F}};P.eventQueue.cache(G)}else P.atomSignalExec(l.PUB_STOP,z,B,W,{configList:F})})},H.prototype.subscribeAddDatachannel=function(F){var P=this;return new Promise(function(B,W){var z=new k(P);if(P.mutex){var G={type:l.DATACHANNEL_SUB_ADD,excuter:z,res:B,rej:W,data:{configList:F}};P.eventQueue.cache(G)}else P.atomSignalExec(l.DATACHANNEL_SUB_ADD,z,B,W,{configList:F})})},H.prototype.subscribeStopDatachannel=function(F){var P=this;return new Promise(function(B,W){var z=new k(P);if(P.mutex){var G={type:l.DATACHANNEL_SUB_STOP,excuter:z,res:B,rej:W,data:{configList:F}};P.eventQueue.cache(G)}else P.atomSignalExec(l.DATACHANNEL_SUB_STOP,z,B,W,{configList:F})})},H.prototype.publishAddDatachannel=function(F){var P=this;return new Promise(function(B,W){var z=new k(P);if(P.mutex){var G={type:l.DATACHANNEL_PUB_ADD,excuter:z,res:B,rej:W,data:{configList:F}};P.eventQueue.cache(G)}else P.atomSignalExec(l.DATACHANNEL_PUB_ADD,z,B,W,{configList:F})})},H.prototype.publishStopDatachannel=function(F){var P=this;return new Promise(function(B,W){var z=new k(P);if(P.mutex){var G={type:l.DATACHANNEL_PUB_STOP,excuter:z,res:B,rej:W,data:{configList:F}};P.eventQueue.cache(G)}else P.atomSignalExec(l.DATACHANNEL_PUB_STOP,z,B,W,{configList:F})})},H.prototype.atomSignalExec=function(F,P,B,W,z){var G=this;this.mutex=!0,P.once("onSignalDone",function(){G.eventQueue.isEmpty()?G.mutex=!1:setTimeout(function(){var J=G.eventQueue.getFirst();G.atomSignalExec(J.type,J.excuter,J.res,J.rej,J.data)})}),P.excuteSignal(F,B,W,z)},H.prototype.proceedSubscribeAdd=function(F,P){return r(this,void 0,void 0,function(){var B,W,z,G,J,re,te,ie,ce,se=this;return i(this,function(ue){switch(ue.label){case 0:if(this.log("SUB LIST: ",F),B=new Date().getTime(),W=new Date().getTime(),z=new Date().getTime(),G=this,J=this.extendUrl(F),re=J.map(function(pe){var de=pe.urlData,ve=pe.vMsid,Ee=pe.aMsid;if(se.streamManager.has(de.url)){var fe=se.streamManager.get(de.url),me=fe.videoInfoList.map(function(Te){return Te.msid}),ge=fe.audioInfoList.map(function(Te){return Te.msid}),be=(0,n.intersection)(me,ve),Re=(0,n.intersection)(ge,Ee);if(Re.length||be.length)return{url:de.url,vMsid:be,aMsid:Re}}}).filter(function(pe){return pe}),this.log("DELETE LIST: ",re),te=[],!re?.length)return[3,4];ue.label=1;case 1:return ue.trys.push([1,3,,4]),[4,this.proceedSubscribeDeleteTracks(re,!0,P)];case 2:return te=ue.sent(),this.onInnerSubscribeDelete&&this.onInnerSubscribeDelete(re),[3,4];case 3:throw ie=ue.sent(),(ce=ie).extraInfo=e(e({},ce.extraInfo),{api:"subscribeAdd",signal_api:"subscribeDeleteTracks",configList:F}),ce;case 4:return B=new Date().getTime(),[2,new Promise(function(pe,de){return r(se,void 0,void 0,function(){function ve(){return r(this,void 0,void 0,function(){var K,q;return i(this,function(X){switch(X.label){case 0:G.removeTrackListener(),K=G.buildUrlStreamMap(J),X.label=1;case 1:return X.trys.push([1,3,,4]),[4,G.subscribeActive(F)];case 2:return X.sent(),[3,4];case 3:return(q=X.sent()).extraInfo=e(e({},q.extraInfo),{api:"subscribeAdd",signal_api:"subscribeActive"}),G.rollbackController.rollback({pcTransceiversRollback:!0,streamManagerRollback:!0}),[2,de(q)];case 4:return W=new Date().getTime(),pe({deleteRspTime:B,subAddRspTime:z,activeRspTime:W,streamList:K}),[2]}})})}var Ee,fe,me,ge,be,Re,Te,Ie,xe,De,Ce,Oe,Me,Pe,ke,Ue,Ae,I=this;return i(this,function(K){switch(K.label){case 0:if(!this.pc)return[2,de(new E.RtsError(p.ErrorCode.CORE_NO_PC_ERROR,"subscribeAdd: no peerconnection",""))];this.pc.addEventListener("track",ve),this.removeTrackListener=function(){var q;(q=I.pc)===null||q===void 0||q.removeEventListener("track",ve)},this.rollbackController.saveStreamManager(this.streamManager),Ee=[],J.forEach(function(q){var X,Z,ee=q.urlData,$=q.vMsid,oe=q.aMsid;if(I.pc){if(I.streamManager.init(ee.url),ee.subVideo&&!I.streamManager.isMsidSubPubDone(ee.url,{vMsid:$[0]})){var ne=I.pc.addTransceiver("video",{direction:"recvonly"});Ee.push({type:"video",msid:$[0],trans:ne});var ae=(X=te.find(function(he){return he.vMsid===$[0]}))===null||X===void 0?void 0:X.vStream;I.streamManager.update(ee.url,{vMsid:$[0],vTransceiver:ne,stream:ae,cumuDelay:I.cumuDelay}),I.setCodecPreferences(ne,I.receiverCodecPreferences.video)}if(ee.subAudio&&!I.streamManager.isMsidSubPubDone(ee.url,{aMsid:oe[0]})){var le=I.pc.addTransceiver("audio",{direction:"recvonly"});Ee.push({type:"audio",msid:oe[0],trans:le}),ae=(Z=te.find(function(he){return he.aMsid===oe[0]}))===null||Z===void 0?void 0:Z.aStream,I.streamManager.update(ee.url,{aMsid:oe[0],aTransceiver:le,stream:ae}),I.setCodecPreferences(le,I.receiverCodecPreferences.audio)}}}),this.rollbackController.setFakeSdpMedias(Ee,"sub"),K.label=1;case 1:return K.trys.push([1,3,,4]),[4,this.pc.createOffer()];case 2:return fe=K.sent(),[3,4];case 3:return me=K.sent(),[2,de(new E.RtsError(p.ErrorCode.DATACHANNEL_CREATE_OFFER_ERROR,"CreateOffer Error: ".concat(me),"",{api:"subscribeAdd",err:me}))];case 4:if(ge=new u.SdpUtil({sdp:fe.sdp||""}),this.restorePublishedSsrc(ge),ge.addNack(),ge.updateBundle(),fe=new RTCSessionDescription({type:"offer",sdp:ge.generate()}),be=this.findNewSubPubMids(fe?.sdp||"",this.prevOfferSdp||""),this.setPrevOfferSdp(fe.sdp||""),this.rollbackController.setFakeSdpMids(be),Re=this.avoidMsidConflict(fe.sdp),this.offerSdpHook)try{Re=this.offerSdpHook(Re)}catch(q){console.log("offerSdpHook error: ",q)}K.label=5;case 5:return K.trys.push([5,7,,9]),[4,this.pc.setLocalDescription(new RTCSessionDescription({type:"offer",sdp:Re}))];case 6:return K.sent(),[3,9];case 7:return Te=K.sent(),[4,this.rollbackController.rollback({trackListnerRollback:!0,pcTransceiversRollback:!0,streamManagerRollback:!0,runSimulateSignal:!0})];case 8:return K.sent(),[2,de(new E.RtsError(p.ErrorCode.DATACHANNEL_SET_OFFER_ERROR,"SetLocalDescription error: ".concat(Te),"",{api:"subscribeAdd",sdp:fe}))];case 9:if(Ie=[],xe=[],J.forEach(function(q){var X=new u.SdpUtil({sdp:fe?.sdp||""}),Z=[],ee=q.vMsid.length!==0,$=q.aMsid.length!==0,oe=!1,ne=!1;X.detail.media.forEach(function(le){var he=String(le.mid);be.includes(he)&&(xe.includes(he)||(le.type==="video"&&ee&&!oe?(Z.push(String(le.mid)),oe=!0):le.type==="audio"&&$&&!ne&&(Z.push(String(le.mid)),ne=!0)))}),xe=o(o([],xe,!0),Z,!0),X.keepMedia(Z);var ae=X.generate();I.cumuDelay&&(ae=ae.replace(/(m=video[^\n]*\n)/,`$1a=cumudelay
25
- `)),Ie.push(ae)}),this.log("ADD LIST: ",J),this.offerSdpHook)try{Ie=Ie.map(function(q){return I.offerSdpHook(q)})}catch(q){console.log("offerSdpHook error: ",q)}K.label=10;case 10:return K.trys.push([10,12,,14]),[4,(Ae=this.signal)===null||Ae===void 0?void 0:Ae.subscribeAdd(J,Ie,this.streamManager)];case 11:return De=K.sent(),[3,14];case 12:return Ce=K.sent(),[4,this.rollbackController.rollback({trackListnerRollback:!0,pcTransceiversRollback:!0,streamManagerRollback:!0,runSimulateSignal:!0})];case 13:return K.sent(),Ce.extraInfo=e({api:"subscribeAdd",signal_api:"subscribeAdd"},Ce.extraInfo),[2,de(Ce)];case 14:if(Oe=[],De.streams.forEach(function(q,X){I.log("Sub TraceId[".concat(X,"]: "),q.traceid);var Z=new u.SdpUtil({sdp:q.sdp});Oe=o(o([],Oe,!0),Z.detail.media,!0);var ee=J.find(function($){return $.urlData.url===q.url});ee&&(ee.traceId=q.traceid,ee.urlTraceId=q.url_traceid)}),(Me=new u.SdpUtil({sdp:this.prevAnswerSdp||""})).addOrUpdateMedia(Oe),this.alignAnswerMidsWithOffer(Me),Pe=Me.generate(),this.setPrevAnswerSdp(Pe),ke=this.avoidMsidConflict(Pe),this.answerSdpHook)try{ke=this.answerSdpHook(ke)}catch(q){console.log("answerSdpHook error: ",q)}K.label=15;case 15:return K.trys.push([15,17,,19]),[4,this.pc.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:ke}))];case 16:return K.sent(),J.forEach(function(q){I.streamManager.markAlreadySubPub(q.urlData.url,{vMsid:q.vMsid[0],aMsid:q.aMsid[0]})}),[3,19];case 17:return Ue=K.sent(),[4,this.rollbackController.rollback({trackListnerRollback:!0,pcTransceiversRollback:!0,streamManagerRollback:!0})];case 18:return K.sent(),[2,de(new E.RtsError(p.ErrorCode.DATACHANNEL_SET_ANSWER_ERROR,"SetRemoteDescription error: ".concat(Ue),"",{api:"subscribeAdd",sdp:Pe}))];case 19:return z=new Date().getTime(),[2]}})})})]}})})},H.prototype.subscribeActive=function(F){var P;return r(this,void 0,void 0,function(){return i(this,function(B){return[2,(P=this.signal)===null||P===void 0?void 0:P.subscribeActive(this.extendUrl(F))]})})},H.prototype.proceedSubscribeDeleteTracks=function(F,P,B){var W,z,G,J;return r(this,void 0,void 0,function(){var re,te,ie,ce,se,ue,pe,de=this;return i(this,function(ve){switch(ve.label){case 0:F.forEach(function(Ee){Ee.rawUrl=Ee.url,Ee.url=de.streamManager.getOriginUrl(Ee.url)}),re=!1,te=!!P,ie=void 0,ve.label=1;case 1:return ve.trys.push([1,3,,4]),[4,(W=this.signal)===null||W===void 0?void 0:W.subscribeDelete(F)];case 2:return ve.sent(),[3,4];case 3:return ce=ve.sent(),re=(ie=ce).errorCode===p.ErrorCode.DATACHANNEL_RESPONSE_ERROR&&((G=(z=ie.extraInfo)===null||z===void 0?void 0:z.parsedData)===null||G===void 0?void 0:G.streams)&&((J=ie.extraInfo.parsedData.streams[0])===null||J===void 0?void 0:J.res_code)===404,[3,4];case 4:if(ie&&!re)throw ie.extraInfo=e({api:"subscribeDeleteTracks"},ie.extraInfo),ie;return se=te&&re,ue=[],pe=F.map(function(Ee){var fe=Ee.url,me=Ee.vMsid,ge=Ee.aMsid,be=Ee.rawUrl;return r(de,void 0,void 0,function(){var Re,Te,Ie,xe,De,Ce,Oe,Me,Pe,ke;return i(this,function(Ue){switch(Ue.label){case 0:fe=(0,n.pruneSubUrl)(fe),this.streamManager.has(fe)&&(me&&(Ie=this.streamManager.getTransceiver(fe,{vMsid:me[0]}))&&(Te=Ie.receiver.track).stop(),ge&&(xe=this.streamManager.getTransceiver(fe,{aMsid:ge[0]}))&&(Re=xe.receiver.track).stop()),Ue.label=1;case 1:return Ue.trys.push([1,3,,4]),[4,this.simulateOfferAnswer()];case 2:return Ue.sent(),[3,4];case 3:throw(De=Ue.sent()).extraInfo=e({api:"subscribeDeleteTracks"},De.extraInfo),De;case 4:return Te&&(Ce=this.streamManager.getStreamByMsid({url:fe,vMsid:me?.[0]}),(Pe=Ce?.mediastream)===null||Pe===void 0||Pe.removeTrack(Te)),Re&&(Oe=this.streamManager.getStreamByMsid({url:fe,aMsid:ge?.[0]}),(ke=Oe?.mediastream)===null||ke===void 0||ke.removeTrack(Re)),B||this.streamManager.pruneStreamList(fe),this.streamManager.removeMsid(fe,{vMsid:me?.length?this.unifyMsid(me,"video"):void 0,aMsid:ge?.length?this.unifyMsid(ge,"audio"):void 0}),Me={url:be||"",stream:this.streamManager.getStreamByMsid({url:fe,vMsid:me?.[0],aMsid:ge?.[0]})},B&&(Me=e(e({},Me),{vStream:Ce,aStream:Oe,vMsid:me?.[0],aMsid:ge?.[0]})),ue.push(Me),[2]}})})}),[4,Promise.all(pe)];case 5:if(ve.sent(),!se&&ie)throw ie.extraInfo=e({api:"subscribeDeleteTracks"},ie.extraInfo),ie;return[2,ue]}})})},H.prototype.proceedSubscribeStop=function(F){var P;return r(this,void 0,void 0,function(){var B,W,z=this;return i(this,function(G){switch(G.label){case 0:return G.trys.push([0,2,,3]),[4,(P=this.signal)===null||P===void 0?void 0:P.subscribeStop(this.extendUrl(F))];case 1:return G.sent(),[3,3];case 2:throw(B=G.sent()).extraInfo=e({api:"subscribeStop"},B.extraInfo),B;case 3:return F.forEach(function(J){J.rawUrl=J.url,J.url=z.streamManager.getOriginUrl(J.url)}),W=F.map(function(J){var re=J.url;return J.rawUrl,J.targetStreams,r(z,void 0,void 0,function(){var te;return i(this,function(ie){switch(ie.label){case 0:re=(0,n.pruneSubUrl)(re),this.streamManager.getAllTransceivers(re).forEach(function(ce){var se;(se=ce?.receiver.track)===null||se===void 0||se.stop()}),this.streamManager.get(re).streamList.forEach(function(ce){return ce.release()}),this.streamManager.remove(re),ie.label=1;case 1:return ie.trys.push([1,3,,4]),[4,this.simulateOfferAnswer()];case 2:return ie.sent(),[3,4];case 3:throw(te=ie.sent()).extraInfo=e({api:"subscribeStop"},te.extraInfo),te;case 4:return[2]}})})}),[4,Promise.all(W)];case 4:return G.sent(),[2]}})})},H.prototype.proceedPublishAdd=function(F){var P;return r(this,void 0,void 0,function(){var B,W,z,G,J,re,te,ie,ce,se,ue,pe,de,ve,Ee,fe,me,ge,be,Re,Te,Ie,xe,De,Ce,Oe,Me,Pe,ke,Ue=this;return i(this,function(Ae){switch(Ae.label){case 0:if(F.length>1)throw console.error("Only one stream is supported."),new E.RtsError(p.ErrorCode.CORE_PUBLIST_EXCEED_ERROR,"publishAdd: publishList exceed limit","",{api:"publishAdd"});if(!this.pc)throw new E.RtsError(p.ErrorCode.CORE_NO_PC_ERROR,"publishAdd: no peerconnection","",{api:"publishAdd"});B=F[0],W=B.stream,z=this.unifyMsid(B.aMsid,"audio"),G=this.unifyMsid(B.vMsid,"video"),B.rawUrl=B.url,B.url=this.streamManager.getOriginUrl(B.url),typeof B.updateSourceStream!="boolean"&&(B.updateSourceStream=!0),J=W.videoTrack,re=W.audioTrack,this.rollbackController.saveStreamManager(this.streamManager),te=[],ie=this.streamManager.getStreamByMsid({url:B.url,vMsid:G,aMsid:z}),this.streamManager.init(B.url,x.EStreamType.Publish),J&&(ce=this.pc.addTransceiver(W.videoTrack,{direction:"sendonly"}),this.streamManager.update(B.url,{vMsid:G,vTransceiver:ce,stream:W,cumuDelay:this.cumuDelay}),te.push({type:"video",trans:ce,msid:G}),this.setCodecPreferences(ce,this.senderCodecPreferences.video)),re&&(ce=this.pc.addTransceiver(W.audioTrack,{direction:"sendonly"}),this.streamManager.update(B.url,{aMsid:z,aTransceiver:ce,stream:W}),te.push({type:"audio",trans:ce,msid:z}),this.setCodecPreferences(ce,this.senderCodecPreferences.audio)),this.rollbackController.setFakeSdpMedias(te,"pub"),Ae.label=1;case 1:return Ae.trys.push([1,3,,4]),[4,this.pc.createOffer()];case 2:return se=Ae.sent(),[3,4];case 3:throw ue=Ae.sent(),new E.RtsError(p.ErrorCode.DATACHANNEL_CREATE_OFFER_ERROR,"CreateOffer Error: ".concat(ue),"",{api:"publishAdd",err:ue});case 4:if(pe=new u.SdpUtil({sdp:se.sdp||""}),de=this.parseMsidString(G),ve=this.parseMsidString(z),Ee=this.findNewSubPubMids(se.sdp||"",this.prevOfferSdp||""),this.rollbackController.setFakeSdpMids(Ee),de.stream&&pe.detail.msidSemantic&&(pe.detail.msidSemantic.token=de.stream),fe=pe.detail.media.reduce(function(I,K){return K.direction==="inactive"?o(o([],I,!0),[String(K.mid)],!1):I},[]),pe.detail.media.forEach(function(I){var K;if(I.direction!=="recvonly"&&I.type!=="application"&&Ee.includes(String(I.mid))){var q=I.type==="video"?de:ve,X=Ue.parseMsidString(I.msid);X.stream=q.stream||X.stream,X.track=q.track||X.track;var Z=Ue.stringifyMsid(X);I.msid=Z,(K=I.ssrcs)===null||K===void 0||K.forEach(function(ee){switch(ee.attribute){case"cname":case"label":ee.value=q.track||ee.value;break;case"msid":ee.value=Z;break;case"mslabel":ee.value=q.stream||ee.value}})}}),this.restorePublishedSsrc(pe),this.restorePublishMsid(pe),pe.addNack(),me=pe.generate(),this.setPrevOfferSdp(me),ge=this.avoidMsidConflict(me),this.offerSdpHook)try{ge=this.offerSdpHook(ge)}catch(I){console.log("offerSdoHook error: ",I)}Ae.label=5;case 5:return Ae.trys.push([5,7,,8]),[4,this.pc.setLocalDescription(new RTCSessionDescription({type:"offer",sdp:ge}))];case 6:return Ae.sent(),[3,8];case 7:throw be=Ae.sent(),this.rollbackController.rollback({streamManagerRollback:!0,runSimulateSignal:!0}),new E.RtsError(p.ErrorCode.DATACHANNEL_SET_OFFER_ERROR,"SetLocalDescription error: ".concat(be),"",{api:"publishAdd",sdp:me});case 8:if(pe.keepMedia(Ee),this.updateTrackInfoList({url:B.rawUrl,stream:B.stream,vMsid:G,aMsid:z,sdpMediaList:pe.detail.media}),ge=pe.generate(),this.offerSdpHook)try{ge=this.offerSdpHook(ge)}catch(I){console.log("offerSdpHook error: ",I)}Ae.label=9;case 9:return Ae.trys.push([9,11,,12]),[4,(P=this.signal)===null||P===void 0?void 0:P.publishAdd([B.url],[ge],[J?[this.stringifyMsid(de)]:[]],[re?[this.stringifyMsid(ve)]:[]])];case 10:return Re=Ae.sent(),[3,12];case 11:throw Te=Ae.sent(),(Ie=Te).extraInfo=e({api:"publishAdd"},Ie.extraInfo),this.rollbackController.rollback({streamManagerRollback:!0,runSimulateSignal:!0}),Ie;case 12:if(xe=Re.streams[0],B.traceId=xe.traceid,B.urlTraceId=xe.url_traceid,this.log("Pub TraceId: ",B.traceId),(De=new u.SdpUtil({sdp:xe.sdp})).detail.media.forEach(function(I){I.type!=="application"&&I.direction==="sendrecv"&&(I.direction="recvonly")}),(Ce=new u.SdpUtil({sdp:this.prevAnswerSdp||""})).detail.media.forEach(function(I){I.type==="application"&&(delete I.candidates,delete I.endOfCandidates)}),Ce.setMediaInactive(fe),Ce.addOrUpdateMedia(De.detail.media,{isPublish:!0}),this.alignAnswerMidsWithOffer(Ce),this.removeTwcc&&(Oe=["http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01"],Ce.detail.media.forEach(function(I){var K;I.ext=(K=I.ext)===null||K===void 0?void 0:K.filter(function(q){return!Oe.includes(q.uri)})})),Me=Ce.generate(),this.setPrevAnswerSdp(Me),Pe=this.avoidMsidConflict(Me),this.answerSdpHook)try{Pe=this.answerSdpHook(Pe)}catch(I){console.log("answerSdpHook error: ",I)}Ae.label=13;case 13:return Ae.trys.push([13,15,,16]),[4,this.pc.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:Pe}))];case 14:return Ae.sent(),this.streamManager.markAlreadySubPub(B.url,{vMsid:G,aMsid:z,isPub:!0}),[3,16];case 15:throw ke=Ae.sent(),this.rollbackController.rollback({streamManagerRollback:!0}),new E.RtsError(p.ErrorCode.DATACHANNEL_SET_ANSWER_ERROR,"SetRemoteDescription error: ".concat(ke),"",{api:"publishAdd",sdp:Me});case 16:return ie&&B.updateSourceStream&&ie.mergeStream(W),[2,F.map(function(I){return{url:I.rawUrl,trackInfoList:Ue.streamManager.getAllMediaInfoList(B.url),traceId:I.traceId,urlTraceId:I.urlTraceId}})]}})})},H.prototype.proceedPublishDeleteTracks=function(F){var P,B,W,z,G,J,re;return r(this,void 0,void 0,function(){var te,ie,ce,se,ue,pe,de,ve,Ee,fe,me=this;return i(this,function(ge){switch(ge.label){case 0:F.forEach(function(be){be.rawUrl=be.url,be.url=me.streamManager.getOriginUrl(be.url)}),ge.label=1;case 1:return ge.trys.push([1,3,,4]),[4,(P=this.signal)===null||P===void 0?void 0:P.publishDelete(F)];case 2:return ge.sent(),[3,4];case 3:throw(te=ge.sent()).extraInfo=e({api:"publishDeleteTracks"},te.extraInfo),te;case 4:if(ie=F[0],ce=(0,n.pruneSubUrl)(ie.url),typeof ie.updateSourceStream!="boolean"&&(ie.updateSourceStream=!0),se=!1,ue=!1,!this.streamManager.has(ce))return[3,9];!((B=ie.vMsid)===null||B===void 0)&&B.length&&((pe=this.streamManager.getTransceiver(ce,{vMsid:ie.vMsid[0]}))!=null&&pe.sender&&((W=this.pc)===null||W===void 0||W.removeTrack(pe?.sender)),se=!0),!((z=ie.aMsid)===null||z===void 0)&&z.length&&((de=this.streamManager.getTransceiver(ce,{aMsid:ie.aMsid[0]}))!=null&&de.sender&&((G=this.pc)===null||G===void 0||G.removeTrack(de?.sender)),ue=!0),ge.label=5;case 5:return ge.trys.push([5,7,,8]),[4,this.simulateOfferAnswer()];case 6:return ge.sent(),[3,8];case 7:throw(ve=ge.sent()).extraInfo=e({api:"publishDeleteTracks"},ve.extraInfo),ve;case 8:return(Ee=this.streamManager.getStreamByMsid({url:ce,vMsid:(J=ie.vMsid)===null||J===void 0?void 0:J[0],aMsid:(re=ie.aMsid)===null||re===void 0?void 0:re[0]}))&&ie.updateSourceStream&&Ee.deleteTracks({video:se,audio:ue}),this.streamManager.removeMsid(ce,{vMsid:se?this.unifyMsid(ie.vMsid,"video"):void 0,aMsid:ue?this.unifyMsid(ie.aMsid,"audio"):void 0}),this.streamManager.pruneStreamList(ce),fe=this.streamManager.getAllMediaInfoList(ie.url),[2,F.map(function(be){return{url:be.rawUrl,trackInfoList:fe}})];case 9:return[2]}})})},H.prototype.proceedPublishReplaceTracks=function(F){var P,B,W,z,G;return r(this,void 0,void 0,function(){var J,re,te,ie,ce,se,ue,pe,de,ve,Ee=this;return i(this,function(fe){switch(fe.label){case 0:if(J=F[0],re=J.stream,te=J.vMsid,ie=J.aMsid,J.rawUrl=J.url,J.url=this.streamManager.getOriginUrl(J.url),!this.streamManager.has(J.url))throw new E.RtsError(p.ErrorCode.CORE_PUB_REPLACE_URL_NOT_FOUND,"No stream found for this url: ".concat(J.url),"",{api:"publishReplaceTracks",configList:F});return typeof J.updateSourceStream!="boolean"&&(J.updateSourceStream=!0),ce=re.audioTrack,se=re.videoTrack,ue=this.streamManager.getAllMediaInfoList(J.url,!0),ce&&(de=(P=ue.find(function(me){return me.type==="audio"&&(!ie||me.msid===ie)}))===null||P===void 0?void 0:P.transceiver)&&ce.id!==((W=(B=de.sender)===null||B===void 0?void 0:B.track)===null||W===void 0?void 0:W.id)?[4,de.sender.replaceTrack(ce)]:[3,2];case 1:fe.sent(),fe.label=2;case 2:return se?(pe=ue.find(function(me){return me.type==="video"&&(!te||me.msid===te)}),(de=pe?.transceiver)&&se.id!==((G=(z=de.sender)===null||z===void 0?void 0:z.track)===null||G===void 0?void 0:G.id)?[4,de.sender.replaceTrack(se)]:[3,4]):[3,4];case 3:fe.sent(),re.isCustomStream||(pe.from=re.hasScreen?"screen":"camera"),fe.label=4;case 4:return(ve=this.streamManager.getStreamByMsid({url:J.url,vMsid:te,aMsid:ie}))&&J.updateSourceStream&&ve.mergeStream(re),[2,F.map(function(me){return{url:me.rawUrl,trackInfoList:Ee.streamManager.getAllMediaInfoList(J.url)}})]}})})},H.prototype.proceedPublishStop=function(F){var P;return r(this,void 0,void 0,function(){var B,W,z=this;return i(this,function(G){switch(G.label){case 0:return G.trys.push([0,2,,3]),[4,(P=this.signal)===null||P===void 0?void 0:P.publishStop(F.map(function(J){return z.streamManager.getOriginUrl(J.url)}))];case 1:return G.sent(),[3,3];case 2:throw(B=G.sent()).extraInfo=e({api:"publishStop"},B.extraInfo),B;case 3:return W=F.map(function(J){var re=J.url;return r(z,void 0,void 0,function(){var te,ie=this;return i(this,function(ce){switch(ce.label){case 0:re=(0,n.pruneSubUrl)(re),this.streamManager.getAllTransceivers(re).forEach(function(se){var ue;se?.sender&&((ue=ie.pc)===null||ue===void 0||ue.removeTrack(se?.sender))}),this.streamManager.get(re).streamList.forEach(function(se){return se.deleteTracks({video:!0,audio:!0})}),this.streamManager.remove(re),ce.label=1;case 1:return ce.trys.push([1,3,,4]),[4,this.simulateOfferAnswer()];case 2:return ce.sent(),[3,4];case 3:throw(te=ce.sent()).extraInfo=e({api:"publishStop"},te.extraInfo),te;case 4:return[2]}})})}),[4,Promise.all(W)];case 4:return G.sent(),[2]}})})},H.prototype.proceedSubscribeAddDatachannel=function(F){return r(this,void 0,void 0,function(){var P=this;return i(this,function(B){return[2,new Promise(function(W,z){return r(P,void 0,void 0,function(){var G,J,re,te,ie,ce=this;return i(this,function(se){switch(se.label){case 0:return se.trys.push([0,2,,3]),[4,(te=this.signal)===null||te===void 0?void 0:te.subscribeAddDatachannel(F)];case 1:return se.sent(),[3,3];case 2:return(G=se.sent()).extraInfo=e({api:"subscribeAddDatachannel",signal_api:"subscribeAddDatachannel"},G.extraInfo),[2,z(G)];case 3:J={},se.label=4;case 4:return se.trys.push([4,6,,7]),[4,(ie=this.signal)===null||ie===void 0?void 0:ie.subscribeActiveDatachannel(F)];case 5:return J=se.sent(),[3,7];case 6:return(re=se.sent()).extraInfo=e({api:"subscribeAddDatachannel",signal_api:"subscribeActiveDatachannel"},re.extraInfo),[2,z(re)];case 7:return F.forEach(function(ue){ce.streamManager.addOrUpdateDatachannelItem({type:"sub-data",url:(0,n.pruneSubUrl)(ue.url,!0),msids:[{name:ue.msid,id:ue.datachannelId,type:"data",label:ue.label,datachannel:ue.datachannel}],originUrl:ue.url,streams:[]})}),W(J),[2]}})})})]})})},H.prototype.proceedSubscribeStopDatachannel=function(F){return r(this,void 0,void 0,function(){var P=this;return i(this,function(B){return[2,new Promise(function(W,z){return r(P,void 0,void 0,function(){var G,J,re,te,ie,ce,se,ue=this;return i(this,function(pe){switch(pe.label){case 0:return pe.trys.push([0,2,,3]),[4,(re=this.signal)===null||re===void 0?void 0:re.subscribeStopDatachannel(F)];case 1:return pe.sent(),[3,3];case 2:return G=pe.sent(),((se=(ce=(ie=(te=(J=G)==null?void 0:J.extraInfo)===null||te===void 0?void 0:te.parsedData)===null||ie===void 0?void 0:ie.streams)===null||ce===void 0?void 0:ce[0])===null||se===void 0?void 0:se.res_code)===404?[3,3]:(J.extraInfo=e({api:"subscribeStopDatachannel",signal_api:"subscribeStopDatachannel"},J.extraInfo),[2,z(G)]);case 3:return F.forEach(function(de){ue.streamManager.deleteDatachannelItem({url:(0,n.pruneSubUrl)(de.url,!0)})}),W(),[2]}})})})]})})},H.prototype.proceedPublishAddDatachannel=function(F){return r(this,void 0,void 0,function(){var P=this;return i(this,function(B){return[2,new Promise(function(W,z){return r(P,void 0,void 0,function(){var G,J,re,te=this;return i(this,function(ie){switch(ie.label){case 0:G={},ie.label=1;case 1:return ie.trys.push([1,3,,4]),[4,(re=this.signal)===null||re===void 0?void 0:re.publishAddDatachannel(F)];case 2:return G=ie.sent(),[3,4];case 3:return(J=ie.sent()).extraInfo=e({api:"publishAddDatachannel",signal_api:"publishAddDatachannel"},J.extraInfo),[2,z(J)];case 4:return F.forEach(function(ce){te.streamManager.addOrUpdateDatachannelItem({type:"pub-data",url:(0,n.pruneSubUrl)(ce.url,!0),msids:[{name:ce.msid,id:ce.datachannelId,type:"data",label:ce.label,datachannel:ce.datachannel}],originUrl:ce.url,streams:[]})}),W(G),[2]}})})})]})})},H.prototype.proceedPublishStopDatachannel=function(F){return r(this,void 0,void 0,function(){var P=this;return i(this,function(B){return[2,new Promise(function(W,z){return r(P,void 0,void 0,function(){var G,J,re=this;return i(this,function(te){switch(te.label){case 0:return te.trys.push([0,2,,3]),[4,(J=this.signal)===null||J===void 0?void 0:J.publishStopDatachannel(F)];case 1:return te.sent(),[3,3];case 2:return(G=te.sent()).extraInfo=e({api:"publishStopDatachannel",signal_api:"publishStopDatachannel"},G.extraInfo),[2,z(G)];case 3:return F.forEach(function(ie){re.streamManager.deleteDatachannelItem({url:(0,n.pruneSubUrl)(ie.url,!0)})}),W(),[2]}})})})]})})},H.prototype.buildUrlStreamMap=function(F){var P=this,B=[];return F.forEach(function(W){var z=W.urlData,G=W.traceId,J=W.urlTraceId,re=W.url,te=W.vMsid,ie=W.aMsid,ce=z.url,se=new MediaStream;P.streamManager.getAllMediaInfoList(ce,!0).forEach(function(ue){var pe,de;if(ue.type==="video"&&ue.msid===te[0]||ue.type==="audio"&&ue.msid===ie[0]){var ve=(de=(pe=ue.transceiver)===null||pe===void 0?void 0:pe.receiver)===null||de===void 0?void 0:de.track;ve&&se.addTrack(ve)}}),B.push({url:re,stream:se,traceId:G,urlTraceId:J})}),B},H.prototype.extendUrl=function(F){var P=this;return F.map(function(B){var W=B.url,z=B.subAudio,G=B.subVideo,J=B.aMsid,re=B.vMsid,te=P.streamManager.getOriginUrl(W),ie=new h.UrlData({url:te,subAudio:z,subVideo:G});return e(e({},B),{urlData:ie,aMsid:ie.subAudio?J||[U]:[],vMsid:ie.subVideo?re||[O]:[]})})},H.prototype.parseSdp=function(F){return new u.SdpUtil({sdp:F})},H.prototype.getTrackInfoList=function(F,P,B){F===void 0&&(F=[]);var W=[];return F.forEach(function(z){var G,J,re,te;if(z.type!=="application"){var ie,ce=Number(z.ssrcs&&((G=z.ssrcs[0])===null||G===void 0?void 0:G.id))||-1,se=z.rtp.find(function(fe){var me;return["opus","h264"].includes((me=fe.codec)===null||me===void 0?void 0:me.toLowerCase())}),ue=se?.codec||"",pe=se?.payload||0;P.isCustomStream||z.type==="video"&&(ie=P.hasScreen?"screen":"camera");var de=z.msid;if(B?.aMsid||B?.vMsid){var ve=(z.type==="video"?B.vMsid:B.aMsid)||"";ve?.trim().includes(" ")||(de=(J=z.msid)===null||J===void 0?void 0:J.split(" ")[1])}var Ee=z.type==="video"?(re=P.videoTrack)===null||re===void 0?void 0:re.id:(te=P.audioTrack)===null||te===void 0?void 0:te.id;W.push({ssrc:ce,codec:ue,type:z.type,pt:pe,msid:de,from:ie,trackId:Ee})}}),W},H.prototype.patchSubscribeStreamManagerRecord=function(F,P){var B=this;this.extendUrl([{url:F,vMsid:P.vMsid,aMsid:P.aMsid}]).forEach(function(W){var z=W.urlData,G=W.vMsid,J=W.aMsid;if(B.pc&&(B.cumuDelay=P.cumuDelay,B.streamManager.remove(z.url),B.streamManager.init(z.url),B.pc.getTransceivers)){var re=B.pc.getTransceivers()||[];if(z.subVideo){var te=re.find(function(ce){return ce.receiver.track.kind==="video"});B.streamManager.update(z.url,{vMsid:G[0],vTransceiver:te,stream:P.stream,cumuDelay:P.cumuDelay})}if(z.subAudio){var ie=re.find(function(ce){return ce.receiver.track.kind==="audio"});B.streamManager.update(z.url,{aMsid:J[0],aTransceiver:ie,stream:P.stream})}B.streamManager.markAlreadySubPub(F,{vMsid:G[0],aMsid:J[0],isPub:!1})}})},H.prototype.patchPublishStreamManagerRecord=function(F,P){if(this.pc){var B=P.stream,W=B.videoTrack,z=B.audioTrack,G=this.unifyMsid(P.aMsid,"audio"),J=this.unifyMsid(P.vMsid,"video");if(this.streamManager.init(F,x.EStreamType.Publish),this.cumuDelay=P.cumuDelay,this.pc.getTransceivers){var re=this.pc.getTransceivers()||[];if(W){var te=re.find(function(ce){var se,ue;return((ue=(se=ce.sender)===null||se===void 0?void 0:se.track)===null||ue===void 0?void 0:ue.id)===W.id});te&&this.streamManager.update(F,{vMsid:J,vTransceiver:te,stream:P.stream,cumuDelay:P.cumuDelay})}if(z){var ie=re.find(function(ce){var se,ue;return((ue=(se=ce.sender)===null||se===void 0?void 0:se.track)===null||ue===void 0?void 0:ue.id)===z.id});ie&&this.streamManager.update(F,{aMsid:G,aTransceiver:ie,stream:P.stream})}this.streamManager.markAlreadySubPub(F,{vMsid:J,aMsid:G,isPub:!0})}}},H.prototype.updateTrackInfoList=function(F){var P=F.url,B=F.stream,W=F.vMsid,z=F.aMsid,G=F.sdpMediaList;P||console.error("[updateTrackInfoList] url is required");var J=this.getTrackInfoList(G,B,{vMsid:W,aMsid:z}),re=J.find(function(ie){return ie.type==="video"}),te=J.find(function(ie){return ie.type==="audio"});return W&&re&&this.streamManager.updateSdpInfo(P,e({vMsid:W},re)),z&&te&&this.streamManager.updateSdpInfo(P,e({aMsid:z},te)),J},H.prototype.unifyMsid=function(F,P){var B=P==="video"?O:U;return F?.[0]||B},H.prototype.startSignalHeartbeatTimer=function(F){var P=this;F&&F<200?console.warn("PEER CORE: heartbeat interval ".concat(F," is too small and will not take effect. At least 200ms")):(this.stopSignalHeartbeatTimer(),this.heartbeatTimerHandle=setInterval(function(){var B=void 0,W=P.streamManager.getSize(),z=P.streamManager.getSubOrPubDoneMediaMapSize();if(P.heartbeatTokenRing%=W,P.heartbeatTokenRing<z){var G=P.heartbeatTokenRing,J=P.streamManager.getPubOrSubDoneMediaUrlByIndex(G);J&&(B=[]).push({url:J})}else if(P.heartbeatTokenRing<W){G=P.heartbeatTokenRing-z;var re=P.streamManager.getDcUrlByIndex(G);re&&(B=[]).push(re)}P.heartbeatTokenRing++,P.heartbeatTokenRing%=W,P.sendOnceHeartbeat(B)},F||v.DEFAULT_HEARTBEAT_INTERVAL))},H.prototype.stopSignalHeartbeatTimer=function(){this.heartbeatTimerHandle!==null&&clearInterval(this.heartbeatTimerHandle),this.heartbeatTimerHandle=null},H.prototype.sendOnceHeartbeat=function(F){var P,B=(P=this.signal)===null||P===void 0?void 0:P.sendHeartbeat(F);B&&(this.hebtLog(">>> Send: heartbeat",B),this.heartbeatTimelineMap.set(B.msg_id,performance.now()))},H.prototype.sendFalseHeartbeat=function(F){var P,B=(P=this.signal)===null||P===void 0?void 0:P.sendFalseHeartbeat(F);B&&(this.hebtLog(">>> Send: false heartbeat",F),this.heartbeatTimelineMap.set(B.msg_id,performance.now()))},H.prototype.dispose=function(){var F,P;this.pc=void 0,this.prevOfferSdp=void 0,this.prevAnswerSdp=void 0,(F=this.signal)===null||F===void 0||F.dispose(),(P=this.streamManager)===null||P===void 0||P.dispose(),this.stopSignalHeartbeatTimer()},H.prototype.initHeartbeatListener=function(){var F,P,B,W,z,G,J,re=this;(F=this.heartbeatProcessor)===null||F===void 0||F.on("pcReconnect",function(te){re.emit("pcReconnect",te)}),(P=this.heartbeatProcessor)===null||P===void 0||P.on("streamError",function(te){re.emit("streamError",te)}),(B=this.heartbeatProcessor)===null||B===void 0||B.on("streamReconnect",function(te){re.emit("streamReconnect",te)}),(W=this.heartbeatProcessor)===null||W===void 0||W.on("traceIdUpdate",function(te){re.emit("traceIdUpdate",te)}),(z=this.heartbeatProcessor)===null||z===void 0||z.on("hebtReceived",function(te){if(te){var ie=re.heartbeatTimelineMap.get(te.msg_id)||0;re.heartbeatTimelineMap.delete(te.msg_id),re.hebtLog("<<< Received: heartbeat","".concat(Math.ceil(performance.now()-ie),"ms"),te)}re.emit("hebtReceived",te)}),(G=this.heartbeatProcessor)===null||G===void 0||G.on("datachannelNotEnabled",function(){re.emit("datachannelNotEnabled")}),(J=this.signal)===null||J===void 0||J.getDatachannelCore().on("message",function(te){var ie;(ie=re.heartbeatProcessor)===null||ie===void 0||ie.process(te)})},H.prototype.initNotifyListener=function(){var F,P,B,W=this;(F=this.notifyProcessor)===null||F===void 0||F.on("pcReconnect",function(z){W.emit("pcReconnect",z)}),(P=this.notifyProcessor)===null||P===void 0||P.on("message",function(z){W.emit("message",z)}),(B=this.signal)===null||B===void 0||B.getDatachannelCore().on("message",function(z){var G,J;(G=W.notifyProcessor)===null||G===void 0||G.processIpMigration(z),(J=W.notifyProcessor)===null||J===void 0||J.processInternalException(z)})},H.prototype.findNewSubPubMids=function(F,P){var B=new u.SdpUtil({sdp:F}),W=new u.SdpUtil({sdp:P}),z=B.detail.media.filter(function(J){return J.direction!=="inactive"}).map(function(J){return J.mid}),G=W.detail.media.map(function(J){return J.mid});return this.findDiff(z,G).map(function(J){return String(J)})},H.prototype.findDiff=function(F,P){return Array.from(new Set(o([],F,!0).filter(function(B){return!P.includes(B)})))},H.prototype.parseMsidString=function(F){var P={stream:"",track:""};if(!F)return P;var B=F.trim().split(" "),W=B[0],z=B[1];return z?(P.stream=W,P.track=z):P.track=W,P},H.prototype.stringifyMsid=function(F){var P=F.stream,B=F.track;return"".concat(P).concat(P?" ":"").concat(B)},H.prototype.restorePublishedSsrc=function(F){var P=new u.SdpUtil({sdp:this.prevOfferSdp||""}).getPublishSsrcs();F.detail.media.forEach(function(B){var W;B.direction!=="recvonly"&&((W=B.ssrcs)===null||W===void 0||W.forEach(function(z){var G,J=(G=P.find(function(re){return re.mid===String(B.mid)}))===null||G===void 0?void 0:G.ssrc;J&&(z.id=String(J))}))})},H.prototype.restorePublishMsid=function(F){var P=this,B=new u.SdpUtil({sdp:this.prevOfferSdp||""}).getPublishMsids();B?.length&&F.detail.media.forEach(function(W){var z,G;if(W.direction!=="recvonly"){var J=(z=B.find(function(te){return te.mid===String(W.mid)}))===null||z===void 0?void 0:z.msid;if(!J)return;var re=P.parseMsidString(J);W.msid=J||W.msid,(G=W.ssrcs)===null||G===void 0||G.forEach(function(te){switch(te.attribute){case"cname":te.value=re.track||te.value;break;case"msid":te.value=J||te.value}})}})},H.prototype.alignAnswerMidsWithOffer=function(F){var P=new u.SdpUtil({sdp:this.prevOfferSdp||""}).detail.media.map(function(G){return String(G.mid)}),B=F.detail.media.map(function(G){return String(G.mid)}),W=this.findDiff(B,P);F.removeMedia(W);var z=[];P.forEach(function(G){var J=F.detail.media.find(function(re){return String(re.mid)===G});J&&z.push(J)}),F.detail.media=z.filter(function(G){return G})},H.prototype.simulateOfferAnswer=function(F){var P,B,W;return r(this,void 0,void 0,function(){var z,G,J,re,te,ie,ce,se,ue,pe,de,ve,Ee;return i(this,function(fe){switch(fe.label){case 0:return fe.trys.push([0,2,,3]),[4,(P=this.pc)===null||P===void 0?void 0:P.createOffer()];case 1:return z=fe.sent(),G=new u.SdpUtil({sdp:z?.sdp||""}),J=G.detail.media.filter(function(me){return me.direction==="inactive"}).map(function(me){return String(me.mid)}),this.restorePublishedSsrc(G),this.restorePublishMsid(G),this.prevOfferSdp=G.generate(),(re=new u.SdpUtil({sdp:this.prevAnswerSdp||""})).setMediaInactive(J),F&&(te=(0,u.generateFakeMediaSdpAnswer)(F))&&(ie=new u.SdpUtil({sdp:te}),ce=o([],ie.detail.media,!0),re.addOrUpdateMedia(ce),this.alignAnswerMidsWithOffer(re)),se=re.generate(),this.setPrevAnswerSdp(se),[3,3];case 2:throw ue=fe.sent(),new E.RtsError(p.ErrorCode.DATACHANNEL_CREATE_OFFER_ERROR,"CreateOffer error: ".concat(ue),"",{pc:this.pc});case 3:if(pe=this.avoidMsidConflict(this.prevOfferSdp),this.offerSdpHook)try{pe=this.offerSdpHook(pe)}catch(me){console.log("offerSdoHook error: ",me)}fe.label=4;case 4:return fe.trys.push([4,6,,7]),[4,(B=this.pc)===null||B===void 0?void 0:B.setLocalDescription(new RTCSessionDescription({type:"offer",sdp:pe}))];case 5:return fe.sent(),[3,7];case 6:throw de=fe.sent(),new E.RtsError(p.ErrorCode.DATACHANNEL_SET_OFFER_ERROR,"SetLocalDescription error: ".concat(de),"",{sdp:this.prevOfferSdp});case 7:if(fe.trys.push([7,10,,11]),!this.prevAnswerSdp)return[3,9];if(ve=this.avoidMsidConflict(this.prevAnswerSdp),this.answerSdpHook)try{ve=this.answerSdpHook(ve)}catch(me){console.log("answerSdpHook error: ",me)}return[4,(W=this.pc)===null||W===void 0?void 0:W.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:ve}))];case 8:fe.sent(),fe.label=9;case 9:return[3,11];case 10:throw Ee=fe.sent(),new E.RtsError(p.ErrorCode.DATACHANNEL_SET_ANSWER_ERROR,"SetRemoteDescription error: ".concat(Ee),"",{sdp:this.prevAnswerSdp});case 11:return[2]}})})},H.prototype.avoidMsidConflict=function(F){var P=new u.SdpUtil({sdp:F});return P.mungleMsid(),P.generate()},H.prototype.setCodecPreferences=function(F,P){if(P)try{F.setCodecPreferences(P)}catch(B){console.warn("setCodecPreferences error",B)}},H.prototype.log=function(){for(var F=[],P=0;P<arguments.length;P++)F[P]=arguments[P];window.RTS_DATACHANNEL_DEBUG&&console.log.apply(console,o(["[PC-Core]"],F,!1))},H.prototype.hebtLog=function(){for(var F,P,B=[],W=0;W<arguments.length;W++)B[W]=arguments[W];window.RTS_HEBT_DEBUG&&console.log.apply(console,o(["".concat(this.now()," [datachannel|").concat((F=this.signal)===null||F===void 0?void 0:F.getDatachannelCore().label,"|").concat((P=this.signal)===null||P===void 0?void 0:P.getDatachannelCore().id,"]")],B,!1))},H.prototype.now=function(){var F=new Date;return"".concat(F.getHours(),":").concat(F.getMinutes(),":").concat(F.getSeconds(),".").concat(String(F.getMilliseconds()).padStart(3,"0"))},H}(R.default);v.PeerConnectionCore=w},651:function(y,v,s){var c,a=this&&this.__extends||(c=function(x,E){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(p,b){p.__proto__=b}||function(p,b){for(var l in b)Object.prototype.hasOwnProperty.call(b,l)&&(p[l]=b[l])},c(x,E)},function(x,E){if(typeof E!="function"&&E!==null)throw new TypeError("Class extends value "+String(E)+" is not a constructor or null");function p(){this.constructor=x}c(x,E),x.prototype=E===null?Object.create(E):(p.prototype=E.prototype,new p)}),e=this&&this.__importDefault||function(x){return x&&x.__esModule?x:{default:x}};Object.defineProperty(v,"__esModule",{value:!0}),v.DataChannelCore=v.EDatachannelStatus=void 0;var r,i=s(844),o=s(961),t=s(854),n=e(s(885)),u=e(s(973));function h(){}(function(x){x[x.DATACHANNEL_STATUS_CLOSE=0]="DATACHANNEL_STATUS_CLOSE",x[x.DATACHANNEL_STATUS_OPEN=1]="DATACHANNEL_STATUS_OPEN"})(r=v.EDatachannelStatus||(v.EDatachannelStatus={}));var S=function(x){function E(p){var b=x.call(this)||this;return b.pendingPromiseMap=new Map,b.mutexSendData=!1,b.timerSendData=null,b.eventQueue=new t.CacheBuffer("send tasks"),b.datachannelList=[],b.pc=p.pc,b.eventHandler=p.onDatachannelEvent||h,b.datachannelList=p.datachannelList||[],b.createDatachannel(p.label,p.assignId,p.delayOpen),b}return a(E,x),E.prototype.getWebrtcDatachannel=function(){return this.datachannel},E.prototype.getNextId=function(){var p=0,b=this.datachannelList.reduce(function(l,A){return A.readyState==="open"?l+1:(p||(p=A.id),l)},0);return p||2*(b+1)},E.prototype.createDatachannel=function(p,b,l){var A=this,R={ordered:!0};b&&this.pc.connectionState==="connected"&&(R.id=this.getNextId()),this.datachannel=this.pc.createDataChannel(p||"GRTN_RTC_DATACHANNEL"+"_".concat(Date.now()),R),this.datachannel.addEventListener("open",function(){l?setTimeout(function(){A.eventHandler(r.DATACHANNEL_STATUS_OPEN),A.emit("statusChange",r.DATACHANNEL_STATUS_OPEN)},200):(A.eventHandler(r.DATACHANNEL_STATUS_OPEN),A.emit("statusChange",r.DATACHANNEL_STATUS_OPEN))}),this.datachannel.addEventListener("close",function(){A.eventHandler(r.DATACHANNEL_STATUS_CLOSE),A.emit("statusChange",r.DATACHANNEL_STATUS_CLOSE)}),this.datachannel.addEventListener("closing",function(){}),this.datachannel.addEventListener("error",function(C){console.log(">> error",C),A.emit("error",C)}),this.datachannel.addEventListener("bufferedamountlow",function(){}),this.datachannel.addEventListener("message",function(C){A.emit("message",C.data)})},Object.defineProperty(E.prototype,"id",{get:function(){return this.datachannel.id},enumerable:!1,configurable:!0}),Object.defineProperty(E.prototype,"label",{get:function(){return this.datachannel.label},enumerable:!1,configurable:!0}),Object.defineProperty(E.prototype,"readyState",{get:function(){return this.datachannel.readyState},enumerable:!1,configurable:!0}),E.prototype.send=function(p){if(this.datachannel.readyState!=="open")throw new Error("Datachannel(label:".concat(this.datachannel.label,",id:").concat(this.datachannel.id,") is closed."));return this.datachannel.send(p)},E.prototype.sendAsync=function(p){if(this.datachannel.readyState==="open")return this.datachannel.send(JSON.stringify(p)),!0;console.log("Async signal message failed. Datachannel(label:".concat(this.datachannel.label,",id:").concat(this.datachannel.id,") is closed."))},E.prototype.sendData=function(p){var b=this;return new Promise(function(l,A){var R=new u.default(b.datachannel);if(b.mutexSendData){var C={sender:R,res:l,rej:A,data:p};b.eventQueue.cache(C)}else b.atomSend(R,l,A,p)})},E.prototype.dispose=function(){var p;this.emit("dispose"),this.mutexSendData=!1,this.timerSendData!==null&&clearTimeout(this.timerSendData),this.timerSendData=null,this.eventQueue=new t.CacheBuffer("send tasks"),(p=this.datachannel)===null||p===void 0||p.close()},E.prototype.atomSend=function(p,b,l,A){var R=this;this.mutexSendData=!0,p.on("onSendDataDone",function(){if(R.timerSendData!==null&&clearTimeout(R.timerSendData),R.timerSendData=null,R.mutexSendData=!1,!R.eventQueue.isEmpty()){var C=R.eventQueue.getFirst();R.atomSend(C.sender,C.res,C.rej,C.data)}}),this.timerSendData=setTimeout(function(){l(new o.RtsError(i.ErrorCode.DATACHANNEL_TIMEOUT_ERROR,"request timeout after ".concat(E.REQUEST_TIMEOUT,"ms"),"",A)),R.timerSendData=null,R.mutexSendData=!1,p.emit("onSendDataDone")},E.REQUEST_TIMEOUT),p.sendingProcess(b,l,A)},E.REQUEST_TIMEOUT=5e3,E}(n.default);v.DataChannelCore=S},973:function(y,v,s){var c,a=this&&this.__extends||(c=function(S,x){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(E,p){E.__proto__=p}||function(E,p){for(var b in p)Object.prototype.hasOwnProperty.call(p,b)&&(E[b]=p[b])},c(S,x)},function(S,x){if(typeof x!="function"&&x!==null)throw new TypeError("Class extends value "+String(x)+" is not a constructor or null");function E(){this.constructor=S}c(S,x),S.prototype=x===null?Object.create(x):(E.prototype=x.prototype,new E)}),e=this&&this.__spreadArray||function(S,x,E){if(E||arguments.length===2)for(var p,b=0,l=x.length;b<l;b++)!p&&b in x||(p||(p=Array.prototype.slice.call(x,0,b)),p[b]=x[b]);return S.concat(p||Array.prototype.slice.call(x))},r=this&&this.__importDefault||function(S){return S&&S.__esModule?S:{default:S}};Object.defineProperty(v,"__esModule",{value:!0}),v.EDatachannelSignalResCode=v.EMessageType=void 0;var i,o,t=s(844),n=s(961),u=r(s(885));(function(S){S.HEBT="hebt",S.NOTI="NOTI"})(i=v.EMessageType||(v.EMessageType={})),function(S){S[S.NGX_RTC_PUBLISH_ALREADY=402]="NGX_RTC_PUBLISH_ALREADY",S[S.NGX_RTC_REQUEST_FORBIDDEN=403]="NGX_RTC_REQUEST_FORBIDDEN",S[S.NGX_RTC_STREAM_NO_FOUND=404]="NGX_RTC_STREAM_NO_FOUND",S[S.NGX_RTC_SUBSCRIBE_ALREADY=410]="NGX_RTC_SUBSCRIBE_ALREADY",S[S.NGX_RTC_NORMAL_CLOSED=200]="NGX_RTC_NORMAL_CLOSED",S[S.NGX_RTC_LIMITED=508]="NGX_RTC_LIMITED",S[S.NGX_RTC_INTERNAL_SERVER_ERROR=500]="NGX_RTC_INTERNAL_SERVER_ERROR",S[S.NGX_RTC_BAD_REQUEST=400]="NGX_RTC_BAD_REQUEST",S[S.NGX_RTC_NEED_RETRY=213]="NGX_RTC_NEED_RETRY",S[S.NGX_RTC_DATACHANNEL_HEBT_MSID_NOT_FOUND=130]="NGX_RTC_DATACHANNEL_HEBT_MSID_NOT_FOUND"}(o=v.EDatachannelSignalResCode||(v.EDatachannelSignalResCode={}));var h=function(S){function x(E){var p=S.call(this)||this;return p.datachannel=E,p}return a(x,S),x.prototype.sendingProcess=function(E,p,b){var l,A=this,R=performance.now();this.datachannel.onmessage=function(C){try{var g=JSON.parse(C.data),D=A.checkResponse(g);if(D.ignore)return;if(A.log("<<< Received:","".concat(Math.ceil(performance.now()-R),"ms"),g),D.pass)E(g);else{if(D.code===o.NGX_RTC_NEED_RETRY)return void setTimeout(function(){A.log(">>> Send:",b),A.datachannel.send(JSON.stringify(b))},200);p(new n.RtsError(t.ErrorCode.DATACHANNEL_RESPONSE_ERROR,"[code]".concat(D.code,"; [msg]").concat(D.msg),D.traceId,{parsedData:g}))}}catch(O){p(new n.RtsError(t.ErrorCode.DATACHANNEL_PARSE_ERROR,"datachannel message parse error","",{data:C.data,err:O}))}A.emit("onSendDataDone")};try{this.log(">>> Sent:","".concat(b.type,"-").concat(!((l=b.streams)===null||l===void 0)&&l.length?b.streams[0].method:"-"),b)}catch{}this.datachannel.send(JSON.stringify(b))},x.prototype.checkResponse=function(E){var p={pass:!0,ignore:!1,code:0,msg:"",traceId:""};if([i.HEBT,i.NOTI].includes(E.type))return p.ignore=!0,p.pass=!1,p;E.recode!==0&&(p.pass=!1,p.code=E.recode,p.msg=E.msg);var b=E.streams;return b&&b.length>0&&b.forEach(function(l){l.res_code!==200&&(p.pass=!1,p.code=l.res_code,p.msg=l.res_msg,p.traceId=l.traceid)}),p},x.prototype.log=function(){for(var E=[],p=0;p<arguments.length;p++)E[p]=arguments[p];window.RTS_DATACHANNEL_DEBUG&&console.log.apply(console,e(["".concat(this.now()," [datachannel|").concat(this.datachannel.label,"|").concat(this.datachannel.id,"]")],E,!1))},x.prototype.now=function(){var E=new Date;return"".concat(E.getHours(),":").concat(E.getMinutes(),":").concat(E.getSeconds(),".").concat(String(E.getMilliseconds()).padStart(3,"0"))},x}(u.default);v.default=h},844:(y,v)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.ErrorCode=void 0,function(s){s[s.DATACHANNEL_SIGNAL_ERROR=15e3]="DATACHANNEL_SIGNAL_ERROR",s[s.DATACHANNEL_SET_OFFER_ERROR=15001]="DATACHANNEL_SET_OFFER_ERROR",s[s.DATACHANNEL_SET_ANSWER_ERROR=15002]="DATACHANNEL_SET_ANSWER_ERROR",s[s.DATACHANNEL_CREATE_OFFER_ERROR=15003]="DATACHANNEL_CREATE_OFFER_ERROR",s[s.DATACHANNEL_RESPONSE_ERROR=15004]="DATACHANNEL_RESPONSE_ERROR",s[s.DATACHANNEL_PARSE_ERROR=15005]="DATACHANNEL_PARSE_ERROR",s[s.DATACHANNEL_TIMEOUT_ERROR=15006]="DATACHANNEL_TIMEOUT_ERROR",s[s.CORE_NO_PC_ERROR=15007]="CORE_NO_PC_ERROR",s[s.CORE_PUBLIST_EXCEED_ERROR=15008]="CORE_PUBLIST_EXCEED_ERROR",s[s.CORE_PUB_REPLACE_URL_NOT_FOUND=15009]="CORE_PUB_REPLACE_URL_NOT_FOUND",s[s.CORE_TRANSCEIVERS_NOT_FOUND=15010]="CORE_TRANSCEIVERS_NOT_FOUND"}(v.ErrorCode||(v.ErrorCode={}))},961:(y,v,s)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.RtsError=void 0;var c=s(844);v.RtsError=function(a,e,r,i){this.errorCode=a,this.errorCodeName=c.ErrorCode[a],this.message=e,this.traceId=r,i&&(this.extraInfo=i)}},854:(y,v)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.CacheBuffer=void 0;var s=function(){function c(a){this.data=[],this.tag=a||"unknown",this.maxBufferLength=90}return c.prototype.setMaxCapacity=function(a){this.maxBufferLength=90,a>=0&&(this.maxBufferLength=a),this.maxBufferLength>200&&(this.maxBufferLength=200)},c.prototype.cache=function(a){this.data.length>this.maxBufferLength&&(this.data.shift(),console.log(this.tag+" CACHE: Reach Max Capacity")),this.data.push(a)},c.prototype.getFirst=function(){return this.data.shift()},c.prototype.isEmpty=function(){return this.data.length<=0},c}();v.CacheBuffer=s},885:(y,v)=>{Object.defineProperty(v,"__esModule",{value:!0});var s=function(){function c(){this._eventMap={}}return c.prototype.listeners=function(a){return this._eventMap[a]||[]},c.prototype.emit=function(a){for(var e=this,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];var o=this._eventMap[a];return!!Array.isArray(o)&&(o.forEach(function(t){return t.apply(e,r)}),!0)},c.prototype.off=function(a,e){var r=this._eventMap[a];return Array.isArray(r)&&(this._eventMap[a]=r.filter(function(i){return i!==e})),this},c.prototype.removeAllListeners=function(a){return a===void 0?this._eventMap={}:this._eventMap[a]&&(this._eventMap[a]=[]),this},c.prototype.on=function(a,e){return this._eventMap[a]?this._eventMap[a].push(e):this._eventMap[a]=[e],this},c.prototype.once=function(a,e){var r=this,i=function(){for(var o=[],t=0;t<arguments.length;t++)o[t]=arguments[t];r.off(a,i),e.apply(r,o)};return this.on(a,i),this},c}();v.default=s},887:(y,v)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.intersection=v.pruneSubUrl=v.parseUrlSubParams=void 0,v.parseUrlSubParams=function(s){var c={subVideo:!0,subAudio:!0};return s&&(s.includes("@subvideo=no")&&(c.subVideo=!1),s.includes("@subaudio=no")&&(c.subAudio=!1)),c},v.pruneSubUrl=function(s,c){var a=s||"";return a=a.replace("@subaudio=no","").replace("@subvideo=no",""),c&&(a=a.split("?")[0]),a},v.intersection=function(s,c){return s.filter(function(a){return c.includes(a)})}},390:function(y,v){var s=this&&this.__spreadArray||function(a,e,r){if(r||arguments.length===2)for(var i,o=0,t=e.length;o<t;o++)!i&&o in e||(i||(i=Array.prototype.slice.call(e,0,o)),i[o]=e[o]);return a.concat(i||Array.prototype.slice.call(e))};Object.defineProperty(v,"__esModule",{value:!0}),v.Logger=void 0;var c=function(){function a(e){this.switchName=e.switchName,this.displayName=e.displayName}return a.prototype.log=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];window[this.switchName||Math.random()]&&console.log.apply(console,s(["".concat(this.now()," [").concat(this.displayName,"]")],e,!1))},a.prototype.now=function(){var e=new Date;return"".concat(this.padStart(e.getHours()),":").concat(this.padStart(e.getMinutes()),":").concat(this.padStart(e.getSeconds()),".").concat(this.padStart(e.getMilliseconds(),3))},a.prototype.padStart=function(e,r,i){return r===void 0&&(r=2),i===void 0&&(i="0"),String(e).padStart(r,i)},a}();v.Logger=c},248:function(y,v,s){var c=this&&this.__assign||function(){return c=Object.assign||function(i){for(var o,t=1,n=arguments.length;t<n;t++)for(var u in o=arguments[t])Object.prototype.hasOwnProperty.call(o,u)&&(i[u]=o[u]);return i},c.apply(this,arguments)},a=this&&this.__spreadArray||function(i,o,t){if(t||arguments.length===2)for(var n,u=0,h=o.length;u<h;u++)!n&&u in o||(n||(n=Array.prototype.slice.call(o,0,u)),n[u]=o[u]);return i.concat(n||Array.prototype.slice.call(o))};Object.defineProperty(v,"__esModule",{value:!0}),v.generateFakeMediaSdpAnswer=v.SdpUtil=void 0;var e=s(766),r=function(){function i(o){if(this.rawSdp=o.sdp,!o.sdp)throw new Error("No sdp to parse");this.sdpDetail=this.parse()}return Object.defineProperty(i.prototype,"detail",{get:function(){return this.sdpDetail},enumerable:!1,configurable:!0}),i.prototype.removeMedia=function(o){return this.removeMediaInner(o)},i.prototype.keepMedia=function(o){return this.removeMediaInner(o,{revert:!0})},i.prototype.removeMediaInner=function(o,t){t===void 0&&(t={revert:!1}),o.length&&this.sdpDetail.media&&this.sdpDetail.media.length&&(t.revert?this.sdpDetail.media=this.sdpDetail.media.filter(function(n){return o.includes(String(n.mid)||"")}):this.sdpDetail.media=this.sdpDetail.media.filter(function(n){return!o.includes(String(n.mid)||"")}),this.updateBundle())},i.prototype.addOrUpdateMedia=function(o,t){t===void 0&&(t={}),o=o.map(function(u){return c(c({},u),{setup:"passive"})});var n=[];this.sdpDetail.media=this.sdpDetail.media.map(function(u){var h=o.find(function(E){return E.mid===u.mid});if(h){n.push(u.mid);var S=h,x=u;return t.isPublish&&(S.ssrcs=x.ssrcs,S.ssrcGroups=x.ssrcGroups),h}return u}),this.sdpDetail.media=a(a([],this.sdpDetail.media,!0),o.filter(function(u){return!n.includes(u.mid)}),!0),this.updateBundle()},i.prototype.mungleMsid=function(){this.sdpDetail.media.forEach(function(o){if(o.msid){var t="";o.msid=o.msid.split(" ").map(function(n,u){return u===1?(t=n,n+"_"+o.mid):n}).join(" "),t&&o.ssrcs&&o.ssrcs.forEach(function(n){n.value&&(n.value=n.value.replace(t,t+"_"+o.mid))})}})},i.prototype.addMedia=function(o){var t;o=o.map(function(h){return c(c({},h),{setup:"passive"})}),this.sdpDetail.media=a(a([],this.sdpDetail.media,!0),o,!0);var n=o.reduce(function(h,S){return h+" "+S.mid},""),u=(t=this.sdpDetail.groups)===null||t===void 0?void 0:t.find(function(h){return h.type==="BUNDLE"});u&&(u.mids+="".concat(n))},i.prototype.setMediaInactive=function(o){this.sdpDetail.media.forEach(function(t){o.includes(String(t.mid))&&(t.direction="inactive")}),this.updateBundle()},i.prototype.getPublishSsrcs=function(){var o=[];return this.sdpDetail.media.forEach(function(t){t.direction!=="recvonly"&&t.ssrcs&&o.push({type:t.type,ssrc:t.ssrcs[0].id||"ERR_NOT_FOUND",mid:String(t.mid)})}),o},i.prototype.getPublishMsids=function(){var o=[];return this.sdpDetail.media.forEach(function(t){t.direction!=="recvonly"&&t.msid&&o.push({type:t.type,msid:t.msid,mid:String(t.mid)})}),o},i.prototype.generate=function(){return(0,e.write)(this.sdpDetail)},i.prototype.updateBundle=function(){var o,t=(o=this.sdpDetail.groups)===null||o===void 0?void 0:o.find(function(n){return n.type==="BUNDLE"});t&&(t.mids=this.sdpDetail.media.reduce(function(n,u){return n+u.mid+" "},"").trim())},i.prototype.addNack=function(){this.sdpDetail.media.forEach(function(o){var t,n,u;if(o.type==="audio"){if(!((t=o.rtcpFb)===null||t===void 0)&&t.some(function(S){return S.type==="nack"}))return;var h=(n=o.rtp.find(function(S){return S.codec==="opus"}))===null||n===void 0?void 0:n.payload;h&&((u=o.rtcpFb)===null||u===void 0||u.push({payload:h,type:"nack"}))}})},i.prototype.parse=function(){var o=(0,e.parse)(this.rawSdp);return this.patchMsid(o)},i.prototype.getMids=function(o){return o?.length?o.reduce(function(t,n){return a(a([],t,!0),[String(n.mid)],!1)},[]):[]},i.prototype.patchMsid=function(o){return o.media.forEach(function(t){var n,u;t.type==="application"||t.msid||(t.msid=(u=(n=t.ssrcs)===null||n===void 0?void 0:n.find(function(h){return h.attribute==="msid"}))===null||u===void 0?void 0:u.value)}),o},i}();v.SdpUtil=r,v.generateFakeMediaSdpAnswer=function(i){if(!i.mids.length||!i.medias.length||i.mids.length!==i.medias.length)return"";var o=`v=0
24
+ `}},776:function(h,v,u){var s,i=this&&this.__extends||(s=function(W,M){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(N,P){N.__proto__=P}||function(N,P){for(var V in P)Object.prototype.hasOwnProperty.call(P,V)&&(N[V]=P[V])},s(W,M)},function(W,M){if(typeof M!="function"&&M!==null)throw new TypeError("Class extends value "+String(M)+" is not a constructor or null");function N(){this.constructor=W}s(W,M),W.prototype=M===null?Object.create(M):(N.prototype=M.prototype,new N)}),e=this&&this.__assign||function(){return e=Object.assign||function(W){for(var M,N=1,P=arguments.length;N<P;N++)for(var V in M=arguments[N])Object.prototype.hasOwnProperty.call(M,V)&&(W[V]=M[V]);return W},e.apply(this,arguments)},o=this&&this.__awaiter||function(W,M,N,P){return new(N||(N=Promise))(function(V,j){function z(re){try{X(P.next(re))}catch(te){j(te)}}function G(re){try{X(P.throw(re))}catch(te){j(te)}}function X(re){var te;re.done?V(re.value):(te=re.value,te instanceof N?te:new N(function(oe){oe(te)})).then(z,G)}X((P=P.apply(W,M||[])).next())})},r=this&&this.__generator||function(W,M){var N,P,V,j,z={label:0,sent:function(){if(1&V[0])throw V[1];return V[1]},trys:[],ops:[]};return j={next:G(0),throw:G(1),return:G(2)},typeof Symbol=="function"&&(j[Symbol.iterator]=function(){return this}),j;function G(X){return function(re){return function(te){if(N)throw new TypeError("Generator is already executing.");for(;j&&(j=0,te[0]&&(z=0)),z;)try{if(N=1,P&&(V=2&te[0]?P.return:te[0]?P.throw||((V=P.return)&&V.call(P),0):P.next)&&!(V=V.call(P,te[1])).done)return V;switch(P=0,V&&(te=[2&te[0],V.value]),te[0]){case 0:case 1:V=te;break;case 4:return z.label++,{value:te[1],done:!1};case 5:z.label++,P=te[1],te=[0];continue;case 7:te=z.ops.pop(),z.trys.pop();continue;default:if(!((V=(V=z.trys).length>0&&V[V.length-1])||te[0]!==6&&te[0]!==2)){z=0;continue}if(te[0]===3&&(!V||te[1]>V[0]&&te[1]<V[3])){z.label=te[1];break}if(te[0]===6&&z.label<V[1]){z.label=V[1],V=te;break}if(V&&z.label<V[2]){z.label=V[2],z.ops.push(te);break}V[2]&&z.ops.pop(),z.trys.pop();continue}te=M.call(W,z)}catch(oe){te=[6,oe],P=0}finally{N=V=0}if(5&te[0])throw te[1];return{value:te[0]?te[1]:void 0,done:!0}}([X,re])}}},a=this&&this.__spreadArray||function(W,M,N){if(N||arguments.length===2)for(var P,V=0,j=M.length;V<j;V++)!P&&V in M||(P||(P=Array.prototype.slice.call(M,0,V)),P[V]=M[V]);return W.concat(P||Array.prototype.slice.call(M))},t=this&&this.__importDefault||function(W){return W&&W.__esModule?W:{default:W}};Object.defineProperty(v,"__esModule",{value:!0}),v.PeerConnectionCore=v.DEFAULT_HEARTBEAT_INTERVAL=v.EDatachannelStatus=void 0;var n=u(887),c=u(248),p=u(237),C=u(619),x=u(628),y=u(961),E=u(844),S=u(651);Object.defineProperty(v,"EDatachannelStatus",{enumerable:!0,get:function(){return S.EDatachannelStatus}});var d,R=u(854),D=t(u(885)),A=u(132),b=t(u(123)),g=u(125),O="rts video",k="rts audio";v.DEFAULT_HEARTBEAT_INTERVAL=2500,function(W){W.SUB_ADD="subsribe add",W.SUB_DELETE="subscribe delete",W.SUB_ACTIVE="subscribe active",W.SUB_STOP="subscribe stop",W.PUB_ADD="publish add",W.PUB_DELETE="publish delete",W.PUB_REPLACE="publish replace",W.PUB_STOP="publish stop",W.DATACHANNEL_SUB_ADD="sub add datachannel",W.DATACHANNEL_SUB_ACTIVE="sub active datachannel",W.DATACHANNEL_SUB_STOP="sub delete datachannel",W.DATACHANNEL_PUB_ADD="pub add datachannel",W.DATACHANNEL_PUB_STOP="pub delete datachannel"}(d||(d={}));var U=function(W){function M(N){var P=W.call(this)||this;return P.PCCore=N,P}return i(M,W),M.prototype.excuteSignal=function(N,P,V,j){var z=this;switch(N){case d.SUB_ADD:this.PCCore.proceedSubscribeAdd(j.configList,j.reconnecting).then(function(G){P(G)}).catch(function(G){V(G)}).finally(function(){z.emit("onSignalDone")});break;case d.SUB_DELETE:this.PCCore.proceedSubscribeDeleteTracks(j.configList,j.skipError).then(function(G){P(G)}).catch(function(G){V(G)}).finally(function(){z.emit("onSignalDone")});break;case d.SUB_ACTIVE:break;case d.SUB_STOP:this.PCCore.proceedSubscribeStop(j.configList).then(function(G){P(G)}).catch(function(G){V(G)}).finally(function(){z.emit("onSignalDone")});break;case d.PUB_ADD:this.PCCore.proceedPublishAdd(j.configList).then(function(G){P(G)}).catch(function(G){V(G)}).finally(function(){z.emit("onSignalDone")});break;case d.PUB_REPLACE:this.PCCore.proceedPublishReplaceTracks(j.configList).then(function(G){P(G)}).catch(function(G){V(G)}).finally(function(){z.emit("onSignalDone")});break;case d.PUB_DELETE:this.PCCore.proceedPublishDeleteTracks(j.configList).then(function(G){P(G)}).catch(function(G){V(G)}).finally(function(){z.emit("onSignalDone")});break;case d.PUB_STOP:this.PCCore.proceedPublishStop(j.configList).then(function(G){P(G)}).catch(function(G){V(G)}).finally(function(){z.emit("onSignalDone")});break;case d.DATACHANNEL_SUB_ADD:this.PCCore.proceedSubscribeAddDatachannel(j.configList).then(function(G){P(G)}).catch(function(G){V(G)}).finally(function(){z.emit("onSignalDone")});break;case d.DATACHANNEL_SUB_STOP:this.PCCore.proceedSubscribeStopDatachannel(j.configList).then(function(G){P(G)}).catch(function(G){V(G)}).finally(function(){z.emit("onSignalDone")});break;case d.DATACHANNEL_PUB_ADD:this.PCCore.proceedPublishAddDatachannel(j.configList).then(function(G){P(G)}).catch(function(G){V(G)}).finally(function(){z.emit("onSignalDone")});break;case d.DATACHANNEL_PUB_STOP:this.PCCore.proceedPublishStopDatachannel(j.configList).then(function(G){P(G)}).catch(function(G){V(G)}).finally(function(){z.emit("onSignalDone")})}},M}(D.default),w=function(W){function M(N){var P=W.call(this)||this;return P.heartbeatTimelineMap=new Map,P.removeTwcc=!1,P.mutex=!1,P.eventQueue=new R.CacheBuffer("signal queue"),P.signalTimer=null,P.rollbackController=new A.PeerConnectionRollbackController(P),P.onInnerSubscribeDelete=function(){},P.receiverCodecPreferences={},P.senderCodecPreferences={},P.removeTrackListener=function(){},P.heartbeatTimerHandle=null,P.heartbeatTokenRing=0,P.streamManager=new x.StreamManager,N.pc?(P.pc=N.pc,P.signal=new C.Signal({pc:N.pc,onDatachannelEvent:N.onDatachannelEvent,delayOpen:N.delayOpen}),P.heartbeatProcessor=new b.default(P.signal.getDatachannelCore().getWebrtcDatachannel(),P.streamManager),P.initHeartbeatListener(),P.notifyProcessor=new g.NotifyProcessor,P.initNotifyListener(),P.onInnerSubscribeDelete=N.onInnerSubscribeDelete||function(){},P.offerSdpHook=N.offerSdpHook,P.answerSdpHook=N.answerSdpHook,P):(console.error("peerconnetion is required"),P)}return i(M,W),M.prototype.getStreamManager=function(){return this.streamManager},M.prototype.getSignal=function(){return this.signal},M.prototype.setPrevOfferSdp=function(N){this.prevOfferSdp=N},M.prototype.setPrevAnswerSdp=function(N){this.prevAnswerSdp=N},M.prototype.setStreamManager=function(N){this.streamManager=N},M.prototype.getTrackIds=function(N){return N.reduce(function(P,V){return a(a([],P,!0),[V.id],!1)},[])},M.prototype.setRemoveTwcc=function(N){this.removeTwcc=N},M.prototype.setReceiverCodecPreferences=function(N){this.receiverCodecPreferences=e({},N)},M.prototype.setSenderCodecPreferences=function(N){this.senderCodecPreferences=e({},N)},M.prototype.subscribeAdd=function(N,P){var V=this;return new Promise(function(j,z){var G=new U(V);if(V.mutex){var X={type:d.SUB_ADD,excuter:G,res:j,rej:z,data:{configList:N}};V.eventQueue.cache(X)}else V.atomSignalExec(d.SUB_ADD,G,j,z,{configList:N,reconnecting:P})})},M.prototype.subscribeDeleteTracks=function(N,P){var V=this;return new Promise(function(j,z){var G=new U(V);if(V.mutex){var X={type:d.SUB_DELETE,excuter:G,res:j,rej:z,data:{configList:N,skipError:P}};V.eventQueue.cache(X)}else V.atomSignalExec(d.SUB_DELETE,G,j,z,{configList:N,skipError:P})})},M.prototype.subscribeStop=function(N){var P=this;return new Promise(function(V,j){var z=new U(P);if(P.mutex){var G={type:d.SUB_STOP,excuter:z,res:V,rej:j,data:{configList:N}};P.eventQueue.cache(G)}else P.atomSignalExec(d.SUB_STOP,z,V,j,{configList:N})})},M.prototype.publishAdd=function(N){var P=this;return new Promise(function(V,j){var z=new U(P);if(P.mutex){var G={type:d.PUB_ADD,excuter:z,res:V,rej:j,data:{configList:N}};P.eventQueue.cache(G)}else P.atomSignalExec(d.PUB_ADD,z,V,j,{configList:N})})},M.prototype.publishReplaceTracks=function(N){var P=this;return new Promise(function(V,j){var z=new U(P);if(P.mutex){var G={type:d.PUB_REPLACE,excuter:z,res:V,rej:j,data:{configList:N}};P.eventQueue.cache(G)}else P.atomSignalExec(d.PUB_REPLACE,z,V,j,{configList:N})})},M.prototype.publishDeleteTracks=function(N){var P=this;return new Promise(function(V,j){var z=new U(P);if(P.mutex){var G={type:d.PUB_DELETE,excuter:z,res:V,rej:j,data:{configList:N}};P.eventQueue.cache(G)}else P.atomSignalExec(d.PUB_DELETE,z,V,j,{configList:N})})},M.prototype.publishStop=function(N){var P=this;return new Promise(function(V,j){var z=new U(P);if(P.mutex){var G={type:d.PUB_STOP,excuter:z,res:V,rej:j,data:{configList:N}};P.eventQueue.cache(G)}else P.atomSignalExec(d.PUB_STOP,z,V,j,{configList:N})})},M.prototype.subscribeAddDatachannel=function(N){var P=this;return new Promise(function(V,j){var z=new U(P);if(P.mutex){var G={type:d.DATACHANNEL_SUB_ADD,excuter:z,res:V,rej:j,data:{configList:N}};P.eventQueue.cache(G)}else P.atomSignalExec(d.DATACHANNEL_SUB_ADD,z,V,j,{configList:N})})},M.prototype.subscribeStopDatachannel=function(N){var P=this;return new Promise(function(V,j){var z=new U(P);if(P.mutex){var G={type:d.DATACHANNEL_SUB_STOP,excuter:z,res:V,rej:j,data:{configList:N}};P.eventQueue.cache(G)}else P.atomSignalExec(d.DATACHANNEL_SUB_STOP,z,V,j,{configList:N})})},M.prototype.publishAddDatachannel=function(N){var P=this;return new Promise(function(V,j){var z=new U(P);if(P.mutex){var G={type:d.DATACHANNEL_PUB_ADD,excuter:z,res:V,rej:j,data:{configList:N}};P.eventQueue.cache(G)}else P.atomSignalExec(d.DATACHANNEL_PUB_ADD,z,V,j,{configList:N})})},M.prototype.publishStopDatachannel=function(N){var P=this;return new Promise(function(V,j){var z=new U(P);if(P.mutex){var G={type:d.DATACHANNEL_PUB_STOP,excuter:z,res:V,rej:j,data:{configList:N}};P.eventQueue.cache(G)}else P.atomSignalExec(d.DATACHANNEL_PUB_STOP,z,V,j,{configList:N})})},M.prototype.atomSignalExec=function(N,P,V,j,z){var G=this;this.mutex=!0,P.once("onSignalDone",function(){G.eventQueue.isEmpty()?G.mutex=!1:setTimeout(function(){var X=G.eventQueue.getFirst();G.atomSignalExec(X.type,X.excuter,X.res,X.rej,X.data)})}),P.excuteSignal(N,V,j,z)},M.prototype.proceedSubscribeAdd=function(N,P){return o(this,void 0,void 0,function(){var V,j,z,G,X,re,te,oe,ue,se=this;return r(this,function(ce){switch(ce.label){case 0:if(this.log("SUB LIST: ",N),V=new Date().getTime(),j=new Date().getTime(),z=new Date().getTime(),G=this,X=this.extendUrl(N),re=X.map(function(de){var pe=de.urlData,he=de.vMsid,Ee=de.aMsid;if(se.streamManager.has(pe.url)){var fe=se.streamManager.get(pe.url),me=fe.videoInfoList.map(function(Te){return Te.msid}),ge=fe.audioInfoList.map(function(Te){return Te.msid}),be=(0,n.intersection)(me,he),Re=(0,n.intersection)(ge,Ee);if(Re.length||be.length)return{url:pe.url,vMsid:be,aMsid:Re}}}).filter(function(de){return de}),this.log("DELETE LIST: ",re),te=[],!re?.length)return[3,4];ce.label=1;case 1:return ce.trys.push([1,3,,4]),[4,this.proceedSubscribeDeleteTracks(re,!0,P)];case 2:return te=ce.sent(),this.onInnerSubscribeDelete&&this.onInnerSubscribeDelete(re),[3,4];case 3:throw oe=ce.sent(),(ue=oe).extraInfo=e(e({},ue.extraInfo),{api:"subscribeAdd",signal_api:"subscribeDeleteTracks",configList:N}),ue;case 4:return V=new Date().getTime(),[2,new Promise(function(de,pe){return o(se,void 0,void 0,function(){function he(){return o(this,void 0,void 0,function(){var K,q;return r(this,function(Q){switch(Q.label){case 0:G.removeTrackListener(),K=G.buildUrlStreamMap(X),Q.label=1;case 1:return Q.trys.push([1,3,,4]),[4,G.subscribeActive(N)];case 2:return Q.sent(),[3,4];case 3:return(q=Q.sent()).extraInfo=e(e({},q.extraInfo),{api:"subscribeAdd",signal_api:"subscribeActive"}),G.rollbackController.rollback({pcTransceiversRollback:!0,streamManagerRollback:!0}),[2,pe(q)];case 4:return j=new Date().getTime(),de({deleteRspTime:V,subAddRspTime:z,activeRspTime:j,streamList:K}),[2]}})})}var Ee,fe,me,ge,be,Re,Te,Pe,Oe,Ae,_e,xe,Me,Ie,ke,Ue,De,I=this;return r(this,function(K){switch(K.label){case 0:if(!this.pc)return[2,pe(new y.RtsError(E.ErrorCode.CORE_NO_PC_ERROR,"subscribeAdd: no peerconnection",""))];this.pc.addEventListener("track",he),this.removeTrackListener=function(){var q;(q=I.pc)===null||q===void 0||q.removeEventListener("track",he)},this.rollbackController.saveStreamManager(this.streamManager),Ee=[],X.forEach(function(q){var Q,Z,ee=q.urlData,J=q.vMsid,ie=q.aMsid;if(I.pc){if(I.streamManager.init(ee.url),ee.subVideo&&!I.streamManager.isMsidSubPubDone(ee.url,{vMsid:J[0]})){var ne=I.pc.addTransceiver("video",{direction:"recvonly"});Ee.push({type:"video",msid:J[0],trans:ne});var ae=(Q=te.find(function(ve){return ve.vMsid===J[0]}))===null||Q===void 0?void 0:Q.vStream;I.streamManager.update(ee.url,{vMsid:J[0],vTransceiver:ne,stream:ae,cumuDelay:I.cumuDelay}),I.setCodecPreferences(ne,I.receiverCodecPreferences.video)}if(ee.subAudio&&!I.streamManager.isMsidSubPubDone(ee.url,{aMsid:ie[0]})){var le=I.pc.addTransceiver("audio",{direction:"recvonly"});Ee.push({type:"audio",msid:ie[0],trans:le}),ae=(Z=te.find(function(ve){return ve.aMsid===ie[0]}))===null||Z===void 0?void 0:Z.aStream,I.streamManager.update(ee.url,{aMsid:ie[0],aTransceiver:le,stream:ae}),I.setCodecPreferences(le,I.receiverCodecPreferences.audio)}}}),this.rollbackController.setFakeSdpMedias(Ee,"sub"),K.label=1;case 1:return K.trys.push([1,3,,4]),[4,this.pc.createOffer()];case 2:return fe=K.sent(),[3,4];case 3:return me=K.sent(),[2,pe(new y.RtsError(E.ErrorCode.DATACHANNEL_CREATE_OFFER_ERROR,"CreateOffer Error: ".concat(me),"",{api:"subscribeAdd",err:me}))];case 4:if(ge=new c.SdpUtil({sdp:fe.sdp||""}),this.restorePublishedSsrc(ge),ge.addNack(),ge.updateBundle(),fe=new RTCSessionDescription({type:"offer",sdp:ge.generate()}),be=this.findNewSubPubMids(fe?.sdp||"",this.prevOfferSdp||""),this.setPrevOfferSdp(fe.sdp||""),this.rollbackController.setFakeSdpMids(be),Re=this.avoidMsidConflict(fe.sdp),this.offerSdpHook)try{Re=this.offerSdpHook(Re)}catch(q){console.log("offerSdpHook error: ",q)}K.label=5;case 5:return K.trys.push([5,7,,9]),[4,this.pc.setLocalDescription(new RTCSessionDescription({type:"offer",sdp:Re}))];case 6:return K.sent(),[3,9];case 7:return Te=K.sent(),[4,this.rollbackController.rollback({trackListnerRollback:!0,pcTransceiversRollback:!0,streamManagerRollback:!0,runSimulateSignal:!0})];case 8:return K.sent(),[2,pe(new y.RtsError(E.ErrorCode.DATACHANNEL_SET_OFFER_ERROR,"SetLocalDescription error: ".concat(Te),"",{api:"subscribeAdd",sdp:fe}))];case 9:if(Pe=[],Oe=[],X.forEach(function(q){var Q=new c.SdpUtil({sdp:fe?.sdp||""}),Z=[],ee=q.vMsid.length!==0,J=q.aMsid.length!==0,ie=!1,ne=!1;Q.detail.media.forEach(function(le){var ve=String(le.mid);be.includes(ve)&&(Oe.includes(ve)||(le.type==="video"&&ee&&!ie?(Z.push(String(le.mid)),ie=!0):le.type==="audio"&&J&&!ne&&(Z.push(String(le.mid)),ne=!0)))}),Oe=a(a([],Oe,!0),Z,!0),Q.keepMedia(Z);var ae=Q.generate();I.cumuDelay&&(ae=ae.replace(/(m=video[^\n]*\n)/,`$1a=cumudelay
25
+ `)),Pe.push(ae)}),this.log("ADD LIST: ",X),this.offerSdpHook)try{Pe=Pe.map(function(q){return I.offerSdpHook(q)})}catch(q){console.log("offerSdpHook error: ",q)}K.label=10;case 10:return K.trys.push([10,12,,14]),[4,(De=this.signal)===null||De===void 0?void 0:De.subscribeAdd(X,Pe,this.streamManager)];case 11:return Ae=K.sent(),[3,14];case 12:return _e=K.sent(),[4,this.rollbackController.rollback({trackListnerRollback:!0,pcTransceiversRollback:!0,streamManagerRollback:!0,runSimulateSignal:!0})];case 13:return K.sent(),_e.extraInfo=e({api:"subscribeAdd",signal_api:"subscribeAdd"},_e.extraInfo),[2,pe(_e)];case 14:if(xe=[],Ae.streams.forEach(function(q,Q){I.log("Sub TraceId[".concat(Q,"]: "),q.traceid);var Z=new c.SdpUtil({sdp:q.sdp});xe=a(a([],xe,!0),Z.detail.media,!0);var ee=X.find(function(J){return J.urlData.url===q.url});ee&&(ee.traceId=q.traceid,ee.urlTraceId=q.url_traceid)}),(Me=new c.SdpUtil({sdp:this.prevAnswerSdp||""})).addOrUpdateMedia(xe),this.alignAnswerMidsWithOffer(Me),Ie=Me.generate(),this.setPrevAnswerSdp(Ie),ke=this.avoidMsidConflict(Ie),this.answerSdpHook)try{ke=this.answerSdpHook(ke)}catch(q){console.log("answerSdpHook error: ",q)}K.label=15;case 15:return K.trys.push([15,17,,19]),[4,this.pc.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:ke}))];case 16:return K.sent(),X.forEach(function(q){I.streamManager.markAlreadySubPub(q.urlData.url,{vMsid:q.vMsid[0],aMsid:q.aMsid[0]})}),[3,19];case 17:return Ue=K.sent(),[4,this.rollbackController.rollback({trackListnerRollback:!0,pcTransceiversRollback:!0,streamManagerRollback:!0})];case 18:return K.sent(),[2,pe(new y.RtsError(E.ErrorCode.DATACHANNEL_SET_ANSWER_ERROR,"SetRemoteDescription error: ".concat(Ue),"",{api:"subscribeAdd",sdp:Ie}))];case 19:return z=new Date().getTime(),[2]}})})})]}})})},M.prototype.subscribeActive=function(N){var P;return o(this,void 0,void 0,function(){return r(this,function(V){return[2,(P=this.signal)===null||P===void 0?void 0:P.subscribeActive(this.extendUrl(N))]})})},M.prototype.proceedSubscribeDeleteTracks=function(N,P,V){var j,z,G,X;return o(this,void 0,void 0,function(){var re,te,oe,ue,se,ce,de,pe=this;return r(this,function(he){switch(he.label){case 0:N.forEach(function(Ee){Ee.rawUrl=Ee.url,Ee.url=pe.streamManager.getOriginUrl(Ee.url)}),re=!1,te=!!P,oe=void 0,he.label=1;case 1:return he.trys.push([1,3,,4]),[4,(j=this.signal)===null||j===void 0?void 0:j.subscribeDelete(N)];case 2:return he.sent(),[3,4];case 3:return ue=he.sent(),re=(oe=ue).errorCode===E.ErrorCode.DATACHANNEL_RESPONSE_ERROR&&((G=(z=oe.extraInfo)===null||z===void 0?void 0:z.parsedData)===null||G===void 0?void 0:G.streams)&&((X=oe.extraInfo.parsedData.streams[0])===null||X===void 0?void 0:X.res_code)===404,[3,4];case 4:if(oe&&!re)throw oe.extraInfo=e({api:"subscribeDeleteTracks"},oe.extraInfo),oe;return se=te&&re,ce=[],de=N.map(function(Ee){var fe=Ee.url,me=Ee.vMsid,ge=Ee.aMsid,be=Ee.rawUrl;return o(pe,void 0,void 0,function(){var Re,Te,Pe,Oe,Ae,_e,xe,Me,Ie,ke;return r(this,function(Ue){switch(Ue.label){case 0:fe=(0,n.pruneSubUrl)(fe),this.streamManager.has(fe)&&(me&&(Pe=this.streamManager.getTransceiver(fe,{vMsid:me[0]}))&&(Te=Pe.receiver.track).stop(),ge&&(Oe=this.streamManager.getTransceiver(fe,{aMsid:ge[0]}))&&(Re=Oe.receiver.track).stop()),Ue.label=1;case 1:return Ue.trys.push([1,3,,4]),[4,this.simulateOfferAnswer()];case 2:return Ue.sent(),[3,4];case 3:throw(Ae=Ue.sent()).extraInfo=e({api:"subscribeDeleteTracks"},Ae.extraInfo),Ae;case 4:return Te&&(_e=this.streamManager.getStreamByMsid({url:fe,vMsid:me?.[0]}),(Ie=_e?.mediastream)===null||Ie===void 0||Ie.removeTrack(Te)),Re&&(xe=this.streamManager.getStreamByMsid({url:fe,aMsid:ge?.[0]}),(ke=xe?.mediastream)===null||ke===void 0||ke.removeTrack(Re)),V||this.streamManager.pruneStreamList(fe),this.streamManager.removeMsid(fe,{vMsid:me?.length?this.unifyMsid(me,"video"):void 0,aMsid:ge?.length?this.unifyMsid(ge,"audio"):void 0}),Me={url:be||"",stream:this.streamManager.getStreamByMsid({url:fe,vMsid:me?.[0],aMsid:ge?.[0]})},V&&(Me=e(e({},Me),{vStream:_e,aStream:xe,vMsid:me?.[0],aMsid:ge?.[0]})),ce.push(Me),[2]}})})}),[4,Promise.all(de)];case 5:if(he.sent(),!se&&oe)throw oe.extraInfo=e({api:"subscribeDeleteTracks"},oe.extraInfo),oe;return[2,ce]}})})},M.prototype.proceedSubscribeStop=function(N){var P;return o(this,void 0,void 0,function(){var V,j,z=this;return r(this,function(G){switch(G.label){case 0:return G.trys.push([0,2,,3]),[4,(P=this.signal)===null||P===void 0?void 0:P.subscribeStop(this.extendUrl(N))];case 1:return G.sent(),[3,3];case 2:throw(V=G.sent()).extraInfo=e({api:"subscribeStop"},V.extraInfo),V;case 3:return N.forEach(function(X){X.rawUrl=X.url,X.url=z.streamManager.getOriginUrl(X.url)}),j=N.map(function(X){var re=X.url;return X.rawUrl,X.targetStreams,o(z,void 0,void 0,function(){var te;return r(this,function(oe){switch(oe.label){case 0:re=(0,n.pruneSubUrl)(re),this.streamManager.getAllTransceivers(re).forEach(function(ue){var se;(se=ue?.receiver.track)===null||se===void 0||se.stop()}),this.streamManager.get(re).streamList.forEach(function(ue){return ue.release()}),this.streamManager.remove(re),oe.label=1;case 1:return oe.trys.push([1,3,,4]),[4,this.simulateOfferAnswer()];case 2:return oe.sent(),[3,4];case 3:throw(te=oe.sent()).extraInfo=e({api:"subscribeStop"},te.extraInfo),te;case 4:return[2]}})})}),[4,Promise.all(j)];case 4:return G.sent(),[2]}})})},M.prototype.proceedPublishAdd=function(N){var P;return o(this,void 0,void 0,function(){var V,j,z,G,X,re,te,oe,ue,se,ce,de,pe,he,Ee,fe,me,ge,be,Re,Te,Pe,Oe,Ae,_e,xe,Me,Ie,ke,Ue=this;return r(this,function(De){switch(De.label){case 0:if(N.length>1)throw console.error("Only one stream is supported."),new y.RtsError(E.ErrorCode.CORE_PUBLIST_EXCEED_ERROR,"publishAdd: publishList exceed limit","",{api:"publishAdd"});if(!this.pc)throw new y.RtsError(E.ErrorCode.CORE_NO_PC_ERROR,"publishAdd: no peerconnection","",{api:"publishAdd"});V=N[0],j=V.stream,z=this.unifyMsid(V.aMsid,"audio"),G=this.unifyMsid(V.vMsid,"video"),V.rawUrl=V.url,V.url=this.streamManager.getOriginUrl(V.url),typeof V.updateSourceStream!="boolean"&&(V.updateSourceStream=!0),X=j.videoTrack,re=j.audioTrack,this.rollbackController.saveStreamManager(this.streamManager),te=[],oe=this.streamManager.getStreamByMsid({url:V.url,vMsid:G,aMsid:z}),this.streamManager.init(V.url,x.EStreamType.Publish),X&&(ue=this.pc.addTransceiver(j.videoTrack,{direction:"sendonly"}),this.streamManager.update(V.url,{vMsid:G,vTransceiver:ue,stream:j,cumuDelay:this.cumuDelay}),te.push({type:"video",trans:ue,msid:G}),this.setCodecPreferences(ue,this.senderCodecPreferences.video)),re&&(ue=this.pc.addTransceiver(j.audioTrack,{direction:"sendonly"}),this.streamManager.update(V.url,{aMsid:z,aTransceiver:ue,stream:j}),te.push({type:"audio",trans:ue,msid:z}),this.setCodecPreferences(ue,this.senderCodecPreferences.audio)),this.rollbackController.setFakeSdpMedias(te,"pub"),De.label=1;case 1:return De.trys.push([1,3,,4]),[4,this.pc.createOffer()];case 2:return se=De.sent(),[3,4];case 3:throw ce=De.sent(),new y.RtsError(E.ErrorCode.DATACHANNEL_CREATE_OFFER_ERROR,"CreateOffer Error: ".concat(ce),"",{api:"publishAdd",err:ce});case 4:if(de=new c.SdpUtil({sdp:se.sdp||""}),pe=this.parseMsidString(G),he=this.parseMsidString(z),Ee=this.findNewSubPubMids(se.sdp||"",this.prevOfferSdp||""),this.rollbackController.setFakeSdpMids(Ee),pe.stream&&de.detail.msidSemantic&&(de.detail.msidSemantic.token=pe.stream),fe=de.detail.media.reduce(function(I,K){return K.direction==="inactive"?a(a([],I,!0),[String(K.mid)],!1):I},[]),de.detail.media.forEach(function(I){var K;if(I.direction!=="recvonly"&&I.type!=="application"&&Ee.includes(String(I.mid))){var q=I.type==="video"?pe:he,Q=Ue.parseMsidString(I.msid);Q.stream=q.stream||Q.stream,Q.track=q.track||Q.track;var Z=Ue.stringifyMsid(Q);I.msid=Z,(K=I.ssrcs)===null||K===void 0||K.forEach(function(ee){switch(ee.attribute){case"cname":case"label":ee.value=q.track||ee.value;break;case"msid":ee.value=Z;break;case"mslabel":ee.value=q.stream||ee.value}})}}),this.restorePublishedSsrc(de),this.restorePublishMsid(de),de.addNack(),me=de.generate(),this.setPrevOfferSdp(me),ge=this.avoidMsidConflict(me),this.offerSdpHook)try{ge=this.offerSdpHook(ge)}catch(I){console.log("offerSdoHook error: ",I)}De.label=5;case 5:return De.trys.push([5,7,,8]),[4,this.pc.setLocalDescription(new RTCSessionDescription({type:"offer",sdp:ge}))];case 6:return De.sent(),[3,8];case 7:throw be=De.sent(),this.rollbackController.rollback({streamManagerRollback:!0,runSimulateSignal:!0}),new y.RtsError(E.ErrorCode.DATACHANNEL_SET_OFFER_ERROR,"SetLocalDescription error: ".concat(be),"",{api:"publishAdd",sdp:me});case 8:if(de.keepMedia(Ee),this.updateTrackInfoList({url:V.rawUrl,stream:V.stream,vMsid:G,aMsid:z,sdpMediaList:de.detail.media}),ge=de.generate(),this.offerSdpHook)try{ge=this.offerSdpHook(ge)}catch(I){console.log("offerSdpHook error: ",I)}De.label=9;case 9:return De.trys.push([9,11,,12]),[4,(P=this.signal)===null||P===void 0?void 0:P.publishAdd([V.url],[ge],[X?[this.stringifyMsid(pe)]:[]],[re?[this.stringifyMsid(he)]:[]])];case 10:return Re=De.sent(),[3,12];case 11:throw Te=De.sent(),(Pe=Te).extraInfo=e({api:"publishAdd"},Pe.extraInfo),this.rollbackController.rollback({streamManagerRollback:!0,runSimulateSignal:!0}),Pe;case 12:if(Oe=Re.streams[0],V.traceId=Oe.traceid,V.urlTraceId=Oe.url_traceid,this.log("Pub TraceId: ",V.traceId),(Ae=new c.SdpUtil({sdp:Oe.sdp})).detail.media.forEach(function(I){I.type!=="application"&&I.direction==="sendrecv"&&(I.direction="recvonly")}),(_e=new c.SdpUtil({sdp:this.prevAnswerSdp||""})).detail.media.forEach(function(I){I.type==="application"&&(delete I.candidates,delete I.endOfCandidates)}),_e.setMediaInactive(fe),_e.addOrUpdateMedia(Ae.detail.media,{isPublish:!0}),this.alignAnswerMidsWithOffer(_e),this.removeTwcc&&(xe=["http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01"],_e.detail.media.forEach(function(I){var K;I.ext=(K=I.ext)===null||K===void 0?void 0:K.filter(function(q){return!xe.includes(q.uri)})})),Me=_e.generate(),this.setPrevAnswerSdp(Me),Ie=this.avoidMsidConflict(Me),this.answerSdpHook)try{Ie=this.answerSdpHook(Ie)}catch(I){console.log("answerSdpHook error: ",I)}De.label=13;case 13:return De.trys.push([13,15,,16]),[4,this.pc.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:Ie}))];case 14:return De.sent(),this.streamManager.markAlreadySubPub(V.url,{vMsid:G,aMsid:z,isPub:!0}),[3,16];case 15:throw ke=De.sent(),this.rollbackController.rollback({streamManagerRollback:!0}),new y.RtsError(E.ErrorCode.DATACHANNEL_SET_ANSWER_ERROR,"SetRemoteDescription error: ".concat(ke),"",{api:"publishAdd",sdp:Me});case 16:return oe&&V.updateSourceStream&&oe.mergeStream(j),[2,N.map(function(I){return{url:I.rawUrl,trackInfoList:Ue.streamManager.getAllMediaInfoList(V.url),traceId:I.traceId,urlTraceId:I.urlTraceId}})]}})})},M.prototype.proceedPublishDeleteTracks=function(N){var P,V,j,z,G,X,re;return o(this,void 0,void 0,function(){var te,oe,ue,se,ce,de,pe,he,Ee,fe,me=this;return r(this,function(ge){switch(ge.label){case 0:N.forEach(function(be){be.rawUrl=be.url,be.url=me.streamManager.getOriginUrl(be.url)}),ge.label=1;case 1:return ge.trys.push([1,3,,4]),[4,(P=this.signal)===null||P===void 0?void 0:P.publishDelete(N)];case 2:return ge.sent(),[3,4];case 3:throw(te=ge.sent()).extraInfo=e({api:"publishDeleteTracks"},te.extraInfo),te;case 4:if(oe=N[0],ue=(0,n.pruneSubUrl)(oe.url),typeof oe.updateSourceStream!="boolean"&&(oe.updateSourceStream=!0),se=!1,ce=!1,!this.streamManager.has(ue))return[3,9];!((V=oe.vMsid)===null||V===void 0)&&V.length&&((de=this.streamManager.getTransceiver(ue,{vMsid:oe.vMsid[0]}))!=null&&de.sender&&((j=this.pc)===null||j===void 0||j.removeTrack(de?.sender)),se=!0),!((z=oe.aMsid)===null||z===void 0)&&z.length&&((pe=this.streamManager.getTransceiver(ue,{aMsid:oe.aMsid[0]}))!=null&&pe.sender&&((G=this.pc)===null||G===void 0||G.removeTrack(pe?.sender)),ce=!0),ge.label=5;case 5:return ge.trys.push([5,7,,8]),[4,this.simulateOfferAnswer()];case 6:return ge.sent(),[3,8];case 7:throw(he=ge.sent()).extraInfo=e({api:"publishDeleteTracks"},he.extraInfo),he;case 8:return(Ee=this.streamManager.getStreamByMsid({url:ue,vMsid:(X=oe.vMsid)===null||X===void 0?void 0:X[0],aMsid:(re=oe.aMsid)===null||re===void 0?void 0:re[0]}))&&oe.updateSourceStream&&Ee.deleteTracks({video:se,audio:ce}),this.streamManager.removeMsid(ue,{vMsid:se?this.unifyMsid(oe.vMsid,"video"):void 0,aMsid:ce?this.unifyMsid(oe.aMsid,"audio"):void 0}),this.streamManager.pruneStreamList(ue),fe=this.streamManager.getAllMediaInfoList(oe.url),[2,N.map(function(be){return{url:be.rawUrl,trackInfoList:fe}})];case 9:return[2]}})})},M.prototype.proceedPublishReplaceTracks=function(N){var P,V,j,z,G;return o(this,void 0,void 0,function(){var X,re,te,oe,ue,se,ce,de,pe,he,Ee=this;return r(this,function(fe){switch(fe.label){case 0:if(X=N[0],re=X.stream,te=X.vMsid,oe=X.aMsid,X.rawUrl=X.url,X.url=this.streamManager.getOriginUrl(X.url),!this.streamManager.has(X.url))throw new y.RtsError(E.ErrorCode.CORE_PUB_REPLACE_URL_NOT_FOUND,"No stream found for this url: ".concat(X.url),"",{api:"publishReplaceTracks",configList:N});return typeof X.updateSourceStream!="boolean"&&(X.updateSourceStream=!0),ue=re.audioTrack,se=re.videoTrack,ce=this.streamManager.getAllMediaInfoList(X.url,!0),ue&&(pe=(P=ce.find(function(me){return me.type==="audio"&&(!oe||me.msid===oe)}))===null||P===void 0?void 0:P.transceiver)&&ue.id!==((j=(V=pe.sender)===null||V===void 0?void 0:V.track)===null||j===void 0?void 0:j.id)?[4,pe.sender.replaceTrack(ue)]:[3,2];case 1:fe.sent(),fe.label=2;case 2:return se?(de=ce.find(function(me){return me.type==="video"&&(!te||me.msid===te)}),(pe=de?.transceiver)&&se.id!==((G=(z=pe.sender)===null||z===void 0?void 0:z.track)===null||G===void 0?void 0:G.id)?[4,pe.sender.replaceTrack(se)]:[3,4]):[3,4];case 3:fe.sent(),re.isCustomStream||(de.from=re.hasScreen?"screen":"camera"),fe.label=4;case 4:return(he=this.streamManager.getStreamByMsid({url:X.url,vMsid:te,aMsid:oe}))&&X.updateSourceStream&&he.mergeStream(re),[2,N.map(function(me){return{url:me.rawUrl,trackInfoList:Ee.streamManager.getAllMediaInfoList(X.url)}})]}})})},M.prototype.proceedPublishStop=function(N){var P;return o(this,void 0,void 0,function(){var V,j,z=this;return r(this,function(G){switch(G.label){case 0:return G.trys.push([0,2,,3]),[4,(P=this.signal)===null||P===void 0?void 0:P.publishStop(N.map(function(X){return z.streamManager.getOriginUrl(X.url)}))];case 1:return G.sent(),[3,3];case 2:throw(V=G.sent()).extraInfo=e({api:"publishStop"},V.extraInfo),V;case 3:return j=N.map(function(X){var re=X.url;return o(z,void 0,void 0,function(){var te,oe=this;return r(this,function(ue){switch(ue.label){case 0:re=(0,n.pruneSubUrl)(re),this.streamManager.getAllTransceivers(re).forEach(function(se){var ce;se?.sender&&((ce=oe.pc)===null||ce===void 0||ce.removeTrack(se?.sender))}),this.streamManager.get(re).streamList.forEach(function(se){return se.deleteTracks({video:!0,audio:!0})}),this.streamManager.remove(re),ue.label=1;case 1:return ue.trys.push([1,3,,4]),[4,this.simulateOfferAnswer()];case 2:return ue.sent(),[3,4];case 3:throw(te=ue.sent()).extraInfo=e({api:"publishStop"},te.extraInfo),te;case 4:return[2]}})})}),[4,Promise.all(j)];case 4:return G.sent(),[2]}})})},M.prototype.proceedSubscribeAddDatachannel=function(N){return o(this,void 0,void 0,function(){var P=this;return r(this,function(V){return[2,new Promise(function(j,z){return o(P,void 0,void 0,function(){var G,X,re,te,oe,ue=this;return r(this,function(se){switch(se.label){case 0:return se.trys.push([0,2,,3]),[4,(te=this.signal)===null||te===void 0?void 0:te.subscribeAddDatachannel(N)];case 1:return se.sent(),[3,3];case 2:return(G=se.sent()).extraInfo=e({api:"subscribeAddDatachannel",signal_api:"subscribeAddDatachannel"},G.extraInfo),[2,z(G)];case 3:X={},se.label=4;case 4:return se.trys.push([4,6,,7]),[4,(oe=this.signal)===null||oe===void 0?void 0:oe.subscribeActiveDatachannel(N)];case 5:return X=se.sent(),[3,7];case 6:return(re=se.sent()).extraInfo=e({api:"subscribeAddDatachannel",signal_api:"subscribeActiveDatachannel"},re.extraInfo),[2,z(re)];case 7:return N.forEach(function(ce){ue.streamManager.addOrUpdateDatachannelItem({type:"sub-data",url:(0,n.pruneSubUrl)(ce.url,!0),msids:[{name:ce.msid,id:ce.datachannelId,type:"data",label:ce.label,datachannel:ce.datachannel}],originUrl:ce.url,streams:[]})}),j(X),[2]}})})})]})})},M.prototype.proceedSubscribeStopDatachannel=function(N){return o(this,void 0,void 0,function(){var P=this;return r(this,function(V){return[2,new Promise(function(j,z){return o(P,void 0,void 0,function(){var G,X,re,te,oe,ue,se,ce=this;return r(this,function(de){switch(de.label){case 0:return de.trys.push([0,2,,3]),[4,(re=this.signal)===null||re===void 0?void 0:re.subscribeStopDatachannel(N)];case 1:return de.sent(),[3,3];case 2:return G=de.sent(),((se=(ue=(oe=(te=(X=G)==null?void 0:X.extraInfo)===null||te===void 0?void 0:te.parsedData)===null||oe===void 0?void 0:oe.streams)===null||ue===void 0?void 0:ue[0])===null||se===void 0?void 0:se.res_code)===404?[3,3]:(X.extraInfo=e({api:"subscribeStopDatachannel",signal_api:"subscribeStopDatachannel"},X.extraInfo),[2,z(G)]);case 3:return N.forEach(function(pe){ce.streamManager.deleteDatachannelItem({url:(0,n.pruneSubUrl)(pe.url,!0)})}),j(),[2]}})})})]})})},M.prototype.proceedPublishAddDatachannel=function(N){return o(this,void 0,void 0,function(){var P=this;return r(this,function(V){return[2,new Promise(function(j,z){return o(P,void 0,void 0,function(){var G,X,re,te=this;return r(this,function(oe){switch(oe.label){case 0:G={},oe.label=1;case 1:return oe.trys.push([1,3,,4]),[4,(re=this.signal)===null||re===void 0?void 0:re.publishAddDatachannel(N)];case 2:return G=oe.sent(),[3,4];case 3:return(X=oe.sent()).extraInfo=e({api:"publishAddDatachannel",signal_api:"publishAddDatachannel"},X.extraInfo),[2,z(X)];case 4:return N.forEach(function(ue){te.streamManager.addOrUpdateDatachannelItem({type:"pub-data",url:(0,n.pruneSubUrl)(ue.url,!0),msids:[{name:ue.msid,id:ue.datachannelId,type:"data",label:ue.label,datachannel:ue.datachannel}],originUrl:ue.url,streams:[]})}),j(G),[2]}})})})]})})},M.prototype.proceedPublishStopDatachannel=function(N){return o(this,void 0,void 0,function(){var P=this;return r(this,function(V){return[2,new Promise(function(j,z){return o(P,void 0,void 0,function(){var G,X,re=this;return r(this,function(te){switch(te.label){case 0:return te.trys.push([0,2,,3]),[4,(X=this.signal)===null||X===void 0?void 0:X.publishStopDatachannel(N)];case 1:return te.sent(),[3,3];case 2:return(G=te.sent()).extraInfo=e({api:"publishStopDatachannel",signal_api:"publishStopDatachannel"},G.extraInfo),[2,z(G)];case 3:return N.forEach(function(oe){re.streamManager.deleteDatachannelItem({url:(0,n.pruneSubUrl)(oe.url,!0)})}),j(),[2]}})})})]})})},M.prototype.buildUrlStreamMap=function(N){var P=this,V=[];return N.forEach(function(j){var z=j.urlData,G=j.traceId,X=j.urlTraceId,re=j.url,te=j.vMsid,oe=j.aMsid,ue=z.url,se=new MediaStream;P.streamManager.getAllMediaInfoList(ue,!0).forEach(function(ce){var de,pe;if(ce.type==="video"&&ce.msid===te[0]||ce.type==="audio"&&ce.msid===oe[0]){var he=(pe=(de=ce.transceiver)===null||de===void 0?void 0:de.receiver)===null||pe===void 0?void 0:pe.track;he&&se.addTrack(he)}}),V.push({url:re,stream:se,traceId:G,urlTraceId:X})}),V},M.prototype.extendUrl=function(N){var P=this;return N.map(function(V){var j=V.url,z=V.subAudio,G=V.subVideo,X=V.aMsid,re=V.vMsid,te=P.streamManager.getOriginUrl(j),oe=new p.UrlData({url:te,subAudio:z,subVideo:G});return e(e({},V),{urlData:oe,aMsid:oe.subAudio?X||[k]:[],vMsid:oe.subVideo?re||[O]:[]})})},M.prototype.parseSdp=function(N){return new c.SdpUtil({sdp:N})},M.prototype.getTrackInfoList=function(N,P,V){N===void 0&&(N=[]);var j=[];return N.forEach(function(z){var G,X,re,te;if(z.type!=="application"){var oe,ue=Number(z.ssrcs&&((G=z.ssrcs[0])===null||G===void 0?void 0:G.id))||-1,se=z.rtp.find(function(fe){var me;return["opus","h264"].includes((me=fe.codec)===null||me===void 0?void 0:me.toLowerCase())}),ce=se?.codec||"",de=se?.payload||0;P.isCustomStream||z.type==="video"&&(oe=P.hasScreen?"screen":"camera");var pe=z.msid;if(V?.aMsid||V?.vMsid){var he=(z.type==="video"?V.vMsid:V.aMsid)||"";he?.trim().includes(" ")||(pe=(X=z.msid)===null||X===void 0?void 0:X.split(" ")[1])}var Ee=z.type==="video"?(re=P.videoTrack)===null||re===void 0?void 0:re.id:(te=P.audioTrack)===null||te===void 0?void 0:te.id;j.push({ssrc:ue,codec:ce,type:z.type,pt:de,msid:pe,from:oe,trackId:Ee})}}),j},M.prototype.patchSubscribeStreamManagerRecord=function(N,P){var V=this;this.extendUrl([{url:N,vMsid:P.vMsid,aMsid:P.aMsid}]).forEach(function(j){var z=j.urlData,G=j.vMsid,X=j.aMsid;if(V.pc&&(V.cumuDelay=P.cumuDelay,V.streamManager.remove(z.url),V.streamManager.init(z.url),V.pc.getTransceivers)){var re=V.pc.getTransceivers()||[];if(z.subVideo){var te=re.find(function(ue){return ue.receiver.track.kind==="video"});V.streamManager.update(z.url,{vMsid:G[0],vTransceiver:te,stream:P.stream,cumuDelay:P.cumuDelay})}if(z.subAudio){var oe=re.find(function(ue){return ue.receiver.track.kind==="audio"});V.streamManager.update(z.url,{aMsid:X[0],aTransceiver:oe,stream:P.stream})}V.streamManager.markAlreadySubPub(N,{vMsid:G[0],aMsid:X[0],isPub:!1})}})},M.prototype.patchPublishStreamManagerRecord=function(N,P){if(this.pc){var V=P.stream,j=V.videoTrack,z=V.audioTrack,G=this.unifyMsid(P.aMsid,"audio"),X=this.unifyMsid(P.vMsid,"video");if(this.streamManager.init(N,x.EStreamType.Publish),this.cumuDelay=P.cumuDelay,this.pc.getTransceivers){var re=this.pc.getTransceivers()||[];if(j){var te=re.find(function(ue){var se,ce;return((ce=(se=ue.sender)===null||se===void 0?void 0:se.track)===null||ce===void 0?void 0:ce.id)===j.id});te&&this.streamManager.update(N,{vMsid:X,vTransceiver:te,stream:P.stream,cumuDelay:P.cumuDelay})}if(z){var oe=re.find(function(ue){var se,ce;return((ce=(se=ue.sender)===null||se===void 0?void 0:se.track)===null||ce===void 0?void 0:ce.id)===z.id});oe&&this.streamManager.update(N,{aMsid:G,aTransceiver:oe,stream:P.stream})}this.streamManager.markAlreadySubPub(N,{vMsid:X,aMsid:G,isPub:!0})}}},M.prototype.updateTrackInfoList=function(N){var P=N.url,V=N.stream,j=N.vMsid,z=N.aMsid,G=N.sdpMediaList;P||console.error("[updateTrackInfoList] url is required");var X=this.getTrackInfoList(G,V,{vMsid:j,aMsid:z}),re=X.find(function(oe){return oe.type==="video"}),te=X.find(function(oe){return oe.type==="audio"});return j&&re&&this.streamManager.updateSdpInfo(P,e({vMsid:j},re)),z&&te&&this.streamManager.updateSdpInfo(P,e({aMsid:z},te)),X},M.prototype.unifyMsid=function(N,P){var V=P==="video"?O:k;return N?.[0]||V},M.prototype.startSignalHeartbeatTimer=function(N){var P=this;N&&N<200?console.warn("PEER CORE: heartbeat interval ".concat(N," is too small and will not take effect. At least 200ms")):(this.stopSignalHeartbeatTimer(),this.heartbeatTimerHandle=setInterval(function(){var V=void 0,j=P.streamManager.getSize(),z=P.streamManager.getSubOrPubDoneMediaMapSize();if(P.heartbeatTokenRing%=j,P.heartbeatTokenRing<z){var G=P.heartbeatTokenRing,X=P.streamManager.getPubOrSubDoneMediaUrlByIndex(G);X&&(V=[]).push({url:X})}else if(P.heartbeatTokenRing<j){G=P.heartbeatTokenRing-z;var re=P.streamManager.getDcUrlByIndex(G);re&&(V=[]).push(re)}P.heartbeatTokenRing++,P.heartbeatTokenRing%=j,P.sendOnceHeartbeat(V)},N||v.DEFAULT_HEARTBEAT_INTERVAL))},M.prototype.stopSignalHeartbeatTimer=function(){this.heartbeatTimerHandle!==null&&clearInterval(this.heartbeatTimerHandle),this.heartbeatTimerHandle=null},M.prototype.sendOnceHeartbeat=function(N){var P,V=(P=this.signal)===null||P===void 0?void 0:P.sendHeartbeat(N);V&&(this.hebtLog(">>> Send: heartbeat",V),this.heartbeatTimelineMap.set(V.msg_id,performance.now()))},M.prototype.sendFalseHeartbeat=function(N){var P,V=(P=this.signal)===null||P===void 0?void 0:P.sendFalseHeartbeat(N);V&&(this.hebtLog(">>> Send: false heartbeat",N),this.heartbeatTimelineMap.set(V.msg_id,performance.now()))},M.prototype.dispose=function(){var N,P;this.pc=void 0,this.prevOfferSdp=void 0,this.prevAnswerSdp=void 0,(N=this.signal)===null||N===void 0||N.dispose(),(P=this.streamManager)===null||P===void 0||P.dispose(),this.stopSignalHeartbeatTimer()},M.prototype.initHeartbeatListener=function(){var N,P,V,j,z,G,X,re=this;(N=this.heartbeatProcessor)===null||N===void 0||N.on("pcReconnect",function(te){re.emit("pcReconnect",te)}),(P=this.heartbeatProcessor)===null||P===void 0||P.on("streamError",function(te){re.emit("streamError",te)}),(V=this.heartbeatProcessor)===null||V===void 0||V.on("streamReconnect",function(te){re.emit("streamReconnect",te)}),(j=this.heartbeatProcessor)===null||j===void 0||j.on("traceIdUpdate",function(te){re.emit("traceIdUpdate",te)}),(z=this.heartbeatProcessor)===null||z===void 0||z.on("hebtReceived",function(te){if(te){var oe=re.heartbeatTimelineMap.get(te.msg_id)||0;re.heartbeatTimelineMap.delete(te.msg_id),re.hebtLog("<<< Received: heartbeat","".concat(Math.ceil(performance.now()-oe),"ms"),te)}re.emit("hebtReceived",te)}),(G=this.heartbeatProcessor)===null||G===void 0||G.on("datachannelNotEnabled",function(){re.emit("datachannelNotEnabled")}),(X=this.signal)===null||X===void 0||X.getDatachannelCore().on("message",function(te){var oe;(oe=re.heartbeatProcessor)===null||oe===void 0||oe.process(te)})},M.prototype.initNotifyListener=function(){var N,P,V,j=this;(N=this.notifyProcessor)===null||N===void 0||N.on("pcReconnect",function(z){j.emit("pcReconnect",z)}),(P=this.notifyProcessor)===null||P===void 0||P.on("message",function(z){j.emit("message",z)}),(V=this.signal)===null||V===void 0||V.getDatachannelCore().on("message",function(z){var G,X;(G=j.notifyProcessor)===null||G===void 0||G.processIpMigration(z),(X=j.notifyProcessor)===null||X===void 0||X.processInternalException(z)})},M.prototype.findNewSubPubMids=function(N,P){var V=new c.SdpUtil({sdp:N}),j=new c.SdpUtil({sdp:P}),z=V.detail.media.filter(function(X){return X.direction!=="inactive"}).map(function(X){return X.mid}),G=j.detail.media.map(function(X){return X.mid});return this.findDiff(z,G).map(function(X){return String(X)})},M.prototype.findDiff=function(N,P){return Array.from(new Set(a([],N,!0).filter(function(V){return!P.includes(V)})))},M.prototype.parseMsidString=function(N){var P={stream:"",track:""};if(!N)return P;var V=N.trim().split(" "),j=V[0],z=V[1];return z?(P.stream=j,P.track=z):P.track=j,P},M.prototype.stringifyMsid=function(N){var P=N.stream,V=N.track;return"".concat(P).concat(P?" ":"").concat(V)},M.prototype.restorePublishedSsrc=function(N){var P=new c.SdpUtil({sdp:this.prevOfferSdp||""}).getPublishSsrcs();N.detail.media.forEach(function(V){var j;V.direction!=="recvonly"&&((j=V.ssrcs)===null||j===void 0||j.forEach(function(z){var G,X=(G=P.find(function(re){return re.mid===String(V.mid)}))===null||G===void 0?void 0:G.ssrc;X&&(z.id=String(X))}))})},M.prototype.restorePublishMsid=function(N){var P=this,V=new c.SdpUtil({sdp:this.prevOfferSdp||""}).getPublishMsids();V?.length&&N.detail.media.forEach(function(j){var z,G;if(j.direction!=="recvonly"){var X=(z=V.find(function(te){return te.mid===String(j.mid)}))===null||z===void 0?void 0:z.msid;if(!X)return;var re=P.parseMsidString(X);j.msid=X||j.msid,(G=j.ssrcs)===null||G===void 0||G.forEach(function(te){switch(te.attribute){case"cname":te.value=re.track||te.value;break;case"msid":te.value=X||te.value}})}})},M.prototype.alignAnswerMidsWithOffer=function(N){var P=new c.SdpUtil({sdp:this.prevOfferSdp||""}).detail.media.map(function(G){return String(G.mid)}),V=N.detail.media.map(function(G){return String(G.mid)}),j=this.findDiff(V,P);N.removeMedia(j);var z=[];P.forEach(function(G){var X=N.detail.media.find(function(re){return String(re.mid)===G});X&&z.push(X)}),N.detail.media=z.filter(function(G){return G})},M.prototype.simulateOfferAnswer=function(N){var P,V,j;return o(this,void 0,void 0,function(){var z,G,X,re,te,oe,ue,se,ce,de,pe,he,Ee;return r(this,function(fe){switch(fe.label){case 0:return fe.trys.push([0,2,,3]),[4,(P=this.pc)===null||P===void 0?void 0:P.createOffer()];case 1:return z=fe.sent(),G=new c.SdpUtil({sdp:z?.sdp||""}),X=G.detail.media.filter(function(me){return me.direction==="inactive"}).map(function(me){return String(me.mid)}),this.restorePublishedSsrc(G),this.restorePublishMsid(G),this.prevOfferSdp=G.generate(),(re=new c.SdpUtil({sdp:this.prevAnswerSdp||""})).setMediaInactive(X),N&&(te=(0,c.generateFakeMediaSdpAnswer)(N))&&(oe=new c.SdpUtil({sdp:te}),ue=a([],oe.detail.media,!0),re.addOrUpdateMedia(ue),this.alignAnswerMidsWithOffer(re)),se=re.generate(),this.setPrevAnswerSdp(se),[3,3];case 2:throw ce=fe.sent(),new y.RtsError(E.ErrorCode.DATACHANNEL_CREATE_OFFER_ERROR,"CreateOffer error: ".concat(ce),"",{pc:this.pc});case 3:if(de=this.avoidMsidConflict(this.prevOfferSdp),this.offerSdpHook)try{de=this.offerSdpHook(de)}catch(me){console.log("offerSdoHook error: ",me)}fe.label=4;case 4:return fe.trys.push([4,6,,7]),[4,(V=this.pc)===null||V===void 0?void 0:V.setLocalDescription(new RTCSessionDescription({type:"offer",sdp:de}))];case 5:return fe.sent(),[3,7];case 6:throw pe=fe.sent(),new y.RtsError(E.ErrorCode.DATACHANNEL_SET_OFFER_ERROR,"SetLocalDescription error: ".concat(pe),"",{sdp:this.prevOfferSdp});case 7:if(fe.trys.push([7,10,,11]),!this.prevAnswerSdp)return[3,9];if(he=this.avoidMsidConflict(this.prevAnswerSdp),this.answerSdpHook)try{he=this.answerSdpHook(he)}catch(me){console.log("answerSdpHook error: ",me)}return[4,(j=this.pc)===null||j===void 0?void 0:j.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:he}))];case 8:fe.sent(),fe.label=9;case 9:return[3,11];case 10:throw Ee=fe.sent(),new y.RtsError(E.ErrorCode.DATACHANNEL_SET_ANSWER_ERROR,"SetRemoteDescription error: ".concat(Ee),"",{sdp:this.prevAnswerSdp});case 11:return[2]}})})},M.prototype.avoidMsidConflict=function(N){var P=new c.SdpUtil({sdp:N});return P.mungleMsid(),P.generate()},M.prototype.setCodecPreferences=function(N,P){if(P)try{N.setCodecPreferences(P)}catch(V){console.warn("setCodecPreferences error",V)}},M.prototype.log=function(){for(var N=[],P=0;P<arguments.length;P++)N[P]=arguments[P];window.RTS_DATACHANNEL_DEBUG&&console.log.apply(console,a(["[PC-Core]"],N,!1))},M.prototype.hebtLog=function(){for(var N,P,V=[],j=0;j<arguments.length;j++)V[j]=arguments[j];window.RTS_HEBT_DEBUG&&console.log.apply(console,a(["".concat(this.now()," [datachannel|").concat((N=this.signal)===null||N===void 0?void 0:N.getDatachannelCore().label,"|").concat((P=this.signal)===null||P===void 0?void 0:P.getDatachannelCore().id,"]")],V,!1))},M.prototype.now=function(){var N=new Date;return"".concat(N.getHours(),":").concat(N.getMinutes(),":").concat(N.getSeconds(),".").concat(String(N.getMilliseconds()).padStart(3,"0"))},M}(D.default);v.PeerConnectionCore=w},651:function(h,v,u){var s,i=this&&this.__extends||(s=function(y,E){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(S,d){S.__proto__=d}||function(S,d){for(var R in d)Object.prototype.hasOwnProperty.call(d,R)&&(S[R]=d[R])},s(y,E)},function(y,E){if(typeof E!="function"&&E!==null)throw new TypeError("Class extends value "+String(E)+" is not a constructor or null");function S(){this.constructor=y}s(y,E),y.prototype=E===null?Object.create(E):(S.prototype=E.prototype,new S)}),e=this&&this.__importDefault||function(y){return y&&y.__esModule?y:{default:y}};Object.defineProperty(v,"__esModule",{value:!0}),v.DataChannelCore=v.EDatachannelStatus=void 0;var o,r=u(844),a=u(961),t=u(854),n=e(u(885)),c=e(u(973)),p=e(u(775));function C(){}(function(y){y[y.DATACHANNEL_STATUS_CLOSE=0]="DATACHANNEL_STATUS_CLOSE",y[y.DATACHANNEL_STATUS_OPEN=1]="DATACHANNEL_STATUS_OPEN"})(o=v.EDatachannelStatus||(v.EDatachannelStatus={}));var x=function(y){function E(S){var d=y.call(this)||this;return d.pendingPromiseMap=new Map,d.mutexSendData=!1,d.timerSendData=null,d.eventQueue=new t.CacheBuffer("send tasks"),d.datachannelList=[],d.pc=S.pc,d.eventHandler=S.onDatachannelEvent||C,d.datachannelList=S.datachannelList||[],d.createDatachannel(S.label,S.assignId,S.delayOpen),d}return i(E,y),E.prototype.getWebrtcDatachannel=function(){return this.datachannel},E.prototype.getNextId=function(){var S=0,d=this.datachannelList.reduce(function(R,D){return D.readyState==="open"?R+1:(S||(S=D.id),R)},0);return S||2*(d+1)},E.prototype.createDatachannel=function(S,d,R){var D=this,A={ordered:!0};d&&this.pc.connectionState==="connected"&&(A.id=this.getNextId()),this.datachannel=this.pc.createDataChannel(S||"GRTN_RTC_DATACHANNEL"+"_".concat(Date.now()),A),this.datachannel.addEventListener("open",function(){R?setTimeout(function(){D.eventHandler(o.DATACHANNEL_STATUS_OPEN),D.emit("statusChange",o.DATACHANNEL_STATUS_OPEN)},200):(D.eventHandler(o.DATACHANNEL_STATUS_OPEN),D.emit("statusChange",o.DATACHANNEL_STATUS_OPEN))}),this.datachannel.addEventListener("close",function(){D.eventHandler(o.DATACHANNEL_STATUS_CLOSE),D.emit("statusChange",o.DATACHANNEL_STATUS_CLOSE)}),this.datachannel.addEventListener("closing",function(){}),this.datachannel.addEventListener("error",function(b){console.log(">> error",b),D.emit("error",b)}),this.datachannel.addEventListener("bufferedamountlow",function(){}),this.datachannel.addEventListener("message",function(b){D.emit("message",b.data)})},Object.defineProperty(E.prototype,"id",{get:function(){return this.datachannel.id},enumerable:!1,configurable:!0}),Object.defineProperty(E.prototype,"label",{get:function(){return this.datachannel.label},enumerable:!1,configurable:!0}),Object.defineProperty(E.prototype,"readyState",{get:function(){return this.datachannel.readyState},enumerable:!1,configurable:!0}),E.prototype.send=function(S){if(this.datachannel.readyState!=="open")throw new Error("Datachannel(label:".concat(this.datachannel.label,",id:").concat(this.datachannel.id,") is closed."));return this.datachannel.send(S)},E.prototype.sendAsync=function(S){if(this.datachannel.readyState==="open")return this.datachannel.send((0,p.default)(S)),!0;console.log("Async signal message failed. Datachannel(label:".concat(this.datachannel.label,",id:").concat(this.datachannel.id,") is closed."))},E.prototype.sendData=function(S){var d=this;return new Promise(function(R,D){var A=new c.default(d.datachannel);if(d.mutexSendData){var b={sender:A,res:R,rej:D,data:S};d.eventQueue.cache(b)}else d.atomSend(A,R,D,S)})},E.prototype.dispose=function(){var S;this.emit("dispose"),this.mutexSendData=!1,this.timerSendData!==null&&clearTimeout(this.timerSendData),this.timerSendData=null,this.eventQueue=new t.CacheBuffer("send tasks"),(S=this.datachannel)===null||S===void 0||S.close()},E.prototype.atomSend=function(S,d,R,D){var A=this;this.mutexSendData=!0,S.on("onSendDataDone",function(){if(A.timerSendData!==null&&clearTimeout(A.timerSendData),A.timerSendData=null,A.mutexSendData=!1,!A.eventQueue.isEmpty()){var b=A.eventQueue.getFirst();A.atomSend(b.sender,b.res,b.rej,b.data)}}),this.timerSendData=setTimeout(function(){R(new a.RtsError(r.ErrorCode.DATACHANNEL_TIMEOUT_ERROR,"request timeout after ".concat(E.REQUEST_TIMEOUT,"ms"),"",D)),A.timerSendData=null,A.mutexSendData=!1,S.emit("onSendDataDone")},E.REQUEST_TIMEOUT),S.sendingProcess(d,R,D)},E.REQUEST_TIMEOUT=5e3,E}(n.default);v.DataChannelCore=x},973:function(h,v,u){var s,i=this&&this.__extends||(s=function(x,y){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(E,S){E.__proto__=S}||function(E,S){for(var d in S)Object.prototype.hasOwnProperty.call(S,d)&&(E[d]=S[d])},s(x,y)},function(x,y){if(typeof y!="function"&&y!==null)throw new TypeError("Class extends value "+String(y)+" is not a constructor or null");function E(){this.constructor=x}s(x,y),x.prototype=y===null?Object.create(y):(E.prototype=y.prototype,new E)}),e=this&&this.__spreadArray||function(x,y,E){if(E||arguments.length===2)for(var S,d=0,R=y.length;d<R;d++)!S&&d in y||(S||(S=Array.prototype.slice.call(y,0,d)),S[d]=y[d]);return x.concat(S||Array.prototype.slice.call(y))},o=this&&this.__importDefault||function(x){return x&&x.__esModule?x:{default:x}};Object.defineProperty(v,"__esModule",{value:!0}),v.EDatachannelSignalResCode=v.EMessageType=void 0;var r,a,t=u(844),n=u(961),c=o(u(885)),p=o(u(775));(function(x){x.HEBT="hebt",x.NOTI="NOTI"})(r=v.EMessageType||(v.EMessageType={})),function(x){x[x.NGX_RTC_PUBLISH_ALREADY=402]="NGX_RTC_PUBLISH_ALREADY",x[x.NGX_RTC_REQUEST_FORBIDDEN=403]="NGX_RTC_REQUEST_FORBIDDEN",x[x.NGX_RTC_STREAM_NO_FOUND=404]="NGX_RTC_STREAM_NO_FOUND",x[x.NGX_RTC_SUBSCRIBE_ALREADY=410]="NGX_RTC_SUBSCRIBE_ALREADY",x[x.NGX_RTC_NORMAL_CLOSED=200]="NGX_RTC_NORMAL_CLOSED",x[x.NGX_RTC_LIMITED=508]="NGX_RTC_LIMITED",x[x.NGX_RTC_INTERNAL_SERVER_ERROR=500]="NGX_RTC_INTERNAL_SERVER_ERROR",x[x.NGX_RTC_BAD_REQUEST=400]="NGX_RTC_BAD_REQUEST",x[x.NGX_RTC_NEED_RETRY=213]="NGX_RTC_NEED_RETRY",x[x.NGX_RTC_DATACHANNEL_HEBT_MSID_NOT_FOUND=130]="NGX_RTC_DATACHANNEL_HEBT_MSID_NOT_FOUND"}(a=v.EDatachannelSignalResCode||(v.EDatachannelSignalResCode={}));var C=function(x){function y(E){var S=x.call(this)||this;return S.datachannel=E,S}return i(y,x),y.prototype.sendingProcess=function(E,S,d){var R,D=this,A=performance.now();this.datachannel.onmessage=function(b){try{var g=JSON.parse(b.data),O=D.checkResponse(g);if(O.ignore)return;if(D.log("<<< Received:","".concat(Math.ceil(performance.now()-A),"ms"),g),O.pass)E(g);else{if(O.code===a.NGX_RTC_NEED_RETRY)return void setTimeout(function(){D.log(">>> Send:",d),D.datachannel.send((0,p.default)(d))},200);S(new n.RtsError(t.ErrorCode.DATACHANNEL_RESPONSE_ERROR,"[code]".concat(O.code,"; [msg]").concat(O.msg),O.traceId,{parsedData:g}))}}catch(k){S(new n.RtsError(t.ErrorCode.DATACHANNEL_PARSE_ERROR,"datachannel message parse error","",{data:b.data,err:k}))}D.emit("onSendDataDone")};try{this.log(">>> Sent:","".concat(d.type,"-").concat(!((R=d.streams)===null||R===void 0)&&R.length?d.streams[0].method:"-"),d)}catch{}this.datachannel.send((0,p.default)(d))},y.prototype.checkResponse=function(E){var S={pass:!0,ignore:!1,code:0,msg:"",traceId:""};if([r.HEBT,r.NOTI].includes(E.type))return S.ignore=!0,S.pass=!1,S;E.recode!==0&&(S.pass=!1,S.code=E.recode,S.msg=E.msg);var d=E.streams;return d&&d.length>0&&d.forEach(function(R){R.res_code!==200&&(S.pass=!1,S.code=R.res_code,S.msg=R.res_msg,S.traceId=R.traceid)}),S},y.prototype.log=function(){for(var E=[],S=0;S<arguments.length;S++)E[S]=arguments[S];window.RTS_DATACHANNEL_DEBUG&&console.log.apply(console,e(["".concat(this.now()," [datachannel|").concat(this.datachannel.label,"|").concat(this.datachannel.id,"]")],E,!1))},y.prototype.now=function(){var E=new Date;return"".concat(E.getHours(),":").concat(E.getMinutes(),":").concat(E.getSeconds(),".").concat(String(E.getMilliseconds()).padStart(3,"0"))},y}(c.default);v.default=C},844:(h,v)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.ErrorCode=void 0,function(u){u[u.DATACHANNEL_SIGNAL_ERROR=15e3]="DATACHANNEL_SIGNAL_ERROR",u[u.DATACHANNEL_SET_OFFER_ERROR=15001]="DATACHANNEL_SET_OFFER_ERROR",u[u.DATACHANNEL_SET_ANSWER_ERROR=15002]="DATACHANNEL_SET_ANSWER_ERROR",u[u.DATACHANNEL_CREATE_OFFER_ERROR=15003]="DATACHANNEL_CREATE_OFFER_ERROR",u[u.DATACHANNEL_RESPONSE_ERROR=15004]="DATACHANNEL_RESPONSE_ERROR",u[u.DATACHANNEL_PARSE_ERROR=15005]="DATACHANNEL_PARSE_ERROR",u[u.DATACHANNEL_TIMEOUT_ERROR=15006]="DATACHANNEL_TIMEOUT_ERROR",u[u.CORE_NO_PC_ERROR=15007]="CORE_NO_PC_ERROR",u[u.CORE_PUBLIST_EXCEED_ERROR=15008]="CORE_PUBLIST_EXCEED_ERROR",u[u.CORE_PUB_REPLACE_URL_NOT_FOUND=15009]="CORE_PUB_REPLACE_URL_NOT_FOUND",u[u.CORE_TRANSCEIVERS_NOT_FOUND=15010]="CORE_TRANSCEIVERS_NOT_FOUND"}(v.ErrorCode||(v.ErrorCode={}))},961:(h,v,u)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.RtsError=void 0;var s=u(844);v.RtsError=function(i,e,o,r){this.errorCode=i,this.errorCodeName=s.ErrorCode[i],this.message=e,this.traceId=o,r&&(this.extraInfo=r)}},854:(h,v)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.CacheBuffer=void 0;var u=function(){function s(i){this.data=[],this.tag=i||"unknown",this.maxBufferLength=90}return s.prototype.setMaxCapacity=function(i){this.maxBufferLength=90,i>=0&&(this.maxBufferLength=i),this.maxBufferLength>200&&(this.maxBufferLength=200)},s.prototype.cache=function(i){this.data.length>this.maxBufferLength&&(this.data.shift(),console.log(this.tag+" CACHE: Reach Max Capacity")),this.data.push(i)},s.prototype.getFirst=function(){return this.data.shift()},s.prototype.isEmpty=function(){return this.data.length<=0},s}();v.CacheBuffer=u},885:(h,v)=>{Object.defineProperty(v,"__esModule",{value:!0});var u=function(){function s(){this._eventMap={}}return s.prototype.listeners=function(i){return this._eventMap[i]||[]},s.prototype.emit=function(i){for(var e=this,o=[],r=1;r<arguments.length;r++)o[r-1]=arguments[r];var a=this._eventMap[i];return!!Array.isArray(a)&&(a.forEach(function(t){return t.apply(e,o)}),!0)},s.prototype.off=function(i,e){var o=this._eventMap[i];return Array.isArray(o)&&(this._eventMap[i]=o.filter(function(r){return r!==e})),this},s.prototype.removeAllListeners=function(i){return i===void 0?this._eventMap={}:this._eventMap[i]&&(this._eventMap[i]=[]),this},s.prototype.on=function(i,e){return this._eventMap[i]?this._eventMap[i].push(e):this._eventMap[i]=[e],this},s.prototype.once=function(i,e){var o=this,r=function(){for(var a=[],t=0;t<arguments.length;t++)a[t]=arguments[t];o.off(i,r),e.apply(o,a)};return this.on(i,r),this},s}();v.default=u},887:(h,v)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.intersection=v.pruneSubUrl=v.parseUrlSubParams=void 0,v.parseUrlSubParams=function(u){var s={subVideo:!0,subAudio:!0};return u&&(u.includes("@subvideo=no")&&(s.subVideo=!1),u.includes("@subaudio=no")&&(s.subAudio=!1)),s},v.pruneSubUrl=function(u,s){var i=u||"";return i=i.replace("@subaudio=no","").replace("@subvideo=no",""),s&&(i=i.split("?")[0]),i},v.intersection=function(u,s){return u.filter(function(i){return s.includes(i)})}},390:function(h,v){var u=this&&this.__spreadArray||function(i,e,o){if(o||arguments.length===2)for(var r,a=0,t=e.length;a<t;a++)!r&&a in e||(r||(r=Array.prototype.slice.call(e,0,a)),r[a]=e[a]);return i.concat(r||Array.prototype.slice.call(e))};Object.defineProperty(v,"__esModule",{value:!0}),v.Logger=void 0;var s=function(){function i(e){this.switchName=e.switchName,this.displayName=e.displayName}return i.prototype.log=function(){for(var e=[],o=0;o<arguments.length;o++)e[o]=arguments[o];window[this.switchName||Math.random()]&&console.log.apply(console,u(["".concat(this.now()," [").concat(this.displayName,"]")],e,!1))},i.prototype.now=function(){var e=new Date;return"".concat(this.padStart(e.getHours()),":").concat(this.padStart(e.getMinutes()),":").concat(this.padStart(e.getSeconds()),".").concat(this.padStart(e.getMilliseconds(),3))},i.prototype.padStart=function(e,o,r){return o===void 0&&(o=2),r===void 0&&(r="0"),String(e).padStart(o,r)},i}();v.Logger=s},248:function(h,v,u){var s=this&&this.__assign||function(){return s=Object.assign||function(r){for(var a,t=1,n=arguments.length;t<n;t++)for(var c in a=arguments[t])Object.prototype.hasOwnProperty.call(a,c)&&(r[c]=a[c]);return r},s.apply(this,arguments)},i=this&&this.__spreadArray||function(r,a,t){if(t||arguments.length===2)for(var n,c=0,p=a.length;c<p;c++)!n&&c in a||(n||(n=Array.prototype.slice.call(a,0,c)),n[c]=a[c]);return r.concat(n||Array.prototype.slice.call(a))};Object.defineProperty(v,"__esModule",{value:!0}),v.generateFakeMediaSdpAnswer=v.SdpUtil=void 0;var e=u(766),o=function(){function r(a){if(this.rawSdp=a.sdp,!a.sdp)throw new Error("No sdp to parse");this.sdpDetail=this.parse()}return Object.defineProperty(r.prototype,"detail",{get:function(){return this.sdpDetail},enumerable:!1,configurable:!0}),r.prototype.removeMedia=function(a){return this.removeMediaInner(a)},r.prototype.keepMedia=function(a){return this.removeMediaInner(a,{revert:!0})},r.prototype.removeMediaInner=function(a,t){t===void 0&&(t={revert:!1}),a.length&&this.sdpDetail.media&&this.sdpDetail.media.length&&(t.revert?this.sdpDetail.media=this.sdpDetail.media.filter(function(n){return a.includes(String(n.mid)||"")}):this.sdpDetail.media=this.sdpDetail.media.filter(function(n){return!a.includes(String(n.mid)||"")}),this.updateBundle())},r.prototype.addOrUpdateMedia=function(a,t){t===void 0&&(t={}),a=a.map(function(c){return s(s({},c),{setup:"passive"})});var n=[];this.sdpDetail.media=this.sdpDetail.media.map(function(c){var p=a.find(function(y){return y.mid===c.mid});if(p){n.push(c.mid);var C=p,x=c;return t.isPublish&&(C.ssrcs=x.ssrcs,C.ssrcGroups=x.ssrcGroups),p}return c}),this.sdpDetail.media=i(i([],this.sdpDetail.media,!0),a.filter(function(c){return!n.includes(c.mid)}),!0),this.updateBundle()},r.prototype.mungleMsid=function(){this.sdpDetail.media.forEach(function(a){if(a.msid){var t="";a.msid=a.msid.split(" ").map(function(n,c){return c===1?(t=n,n+"_"+a.mid):n}).join(" "),t&&a.ssrcs&&a.ssrcs.forEach(function(n){n.value&&(n.value=n.value.replace(t,t+"_"+a.mid))})}})},r.prototype.addMedia=function(a){var t;a=a.map(function(p){return s(s({},p),{setup:"passive"})}),this.sdpDetail.media=i(i([],this.sdpDetail.media,!0),a,!0);var n=a.reduce(function(p,C){return p+" "+C.mid},""),c=(t=this.sdpDetail.groups)===null||t===void 0?void 0:t.find(function(p){return p.type==="BUNDLE"});c&&(c.mids+="".concat(n))},r.prototype.setMediaInactive=function(a){this.sdpDetail.media.forEach(function(t){a.includes(String(t.mid))&&(t.direction="inactive")}),this.updateBundle()},r.prototype.getPublishSsrcs=function(){var a=[];return this.sdpDetail.media.forEach(function(t){t.direction!=="recvonly"&&t.ssrcs&&a.push({type:t.type,ssrc:t.ssrcs[0].id||"ERR_NOT_FOUND",mid:String(t.mid)})}),a},r.prototype.getPublishMsids=function(){var a=[];return this.sdpDetail.media.forEach(function(t){t.direction!=="recvonly"&&t.msid&&a.push({type:t.type,msid:t.msid,mid:String(t.mid)})}),a},r.prototype.generate=function(){return(0,e.write)(this.sdpDetail)},r.prototype.updateBundle=function(){var a,t=(a=this.sdpDetail.groups)===null||a===void 0?void 0:a.find(function(n){return n.type==="BUNDLE"});t&&(t.mids=this.sdpDetail.media.reduce(function(n,c){return n+c.mid+" "},"").trim())},r.prototype.addNack=function(){this.sdpDetail.media.forEach(function(a){var t,n,c;if(a.type==="audio"){if(!((t=a.rtcpFb)===null||t===void 0)&&t.some(function(C){return C.type==="nack"}))return;var p=(n=a.rtp.find(function(C){return C.codec==="opus"}))===null||n===void 0?void 0:n.payload;p&&((c=a.rtcpFb)===null||c===void 0||c.push({payload:p,type:"nack"}))}})},r.prototype.parse=function(){var a=(0,e.parse)(this.rawSdp);return this.patchMsid(a)},r.prototype.getMids=function(a){return a?.length?a.reduce(function(t,n){return i(i([],t,!0),[String(n.mid)],!1)},[]):[]},r.prototype.patchMsid=function(a){return a.media.forEach(function(t){var n,c;t.type==="application"||t.msid||(t.msid=(c=(n=t.ssrcs)===null||n===void 0?void 0:n.find(function(p){return p.attribute==="msid"}))===null||c===void 0?void 0:c.value)}),a},r}();v.SdpUtil=o,v.generateFakeMediaSdpAnswer=function(r){if(!r.mids.length||!r.medias.length||r.mids.length!==r.medias.length)return"";var a=`v=0
26
26
  o=- 1710852399 2 IN IP4 127.0.0.1
27
27
  s=-
28
28
  t=0 0
29
29
  a=group:BUNDLE`,t=`
30
- a=end-of-candidates`;i.mids.forEach(function(u){o+=" ".concat(u)});var n=function(){for(var u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",h="",S=0;S<24;S++)h+=u.charAt(Math.floor(62*Math.random()));return h}();return i.medias.forEach(function(u,h){if(u.type==="video"){var S=(1e4*Math.random()).toFixed(0),x=u.msid||"rts video";o+=`
30
+ a=end-of-candidates`;r.mids.forEach(function(c){a+=" ".concat(c)});var n=function(){for(var c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",p="",C=0;C<24;C++)p+=c.charAt(Math.floor(62*Math.random()));return p}();return r.medias.forEach(function(c,p){if(c.type==="video"){var C=(1e4*Math.random()).toFixed(0),x=c.msid||"rts video";a+=`
31
31
  m=video 9 UDP/TLS/RTP/SAVPF 106 107
32
32
  c=IN IP4 0.0.0.0
33
33
  a=rtcp:9 IN IP4 0.0.0.0
@@ -37,7 +37,7 @@ a=ice-options:ice-lite
37
37
  a=fingerprint:SHA-256 C3:E2:CD:1F:B8:E4:DA:77:D1:D2:36:F3:72:EA:83:CA:7A:F2:3B:26:07:C6:E0:3D:96:44:57:59:14:DE:F0:A4
38
38
  a=setup:passive
39
39
  a=sendonly
40
- a=mid:`).concat(i.mids[h],`
40
+ a=mid:`).concat(r.mids[p],`
41
41
  a=rtcp-mux
42
42
  a=rtpmap:106 H264/90000
43
43
  a=fmtp:106 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f;sps-pps-idr-in-keyframe=1
@@ -50,11 +50,11 @@ a=rtpmap:107 rtx/90000
50
50
  a=fmtp:107 apt=106
51
51
  a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
52
52
  a=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
53
- a=extmap:5 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay`);var E=`
54
- a=ssrc:`.concat(S,` cname:defaultcname
55
- a=ssrc:`).concat(S," msid:").concat(x,`
56
- a=ssrc:`).concat(S,` mslabel:rts
57
- a=ssrc:`).concat(S," label:video");i.direction==="sub"&&(o+=E),o+=t}else u.type==="audio"&&(S=(1e4*Math.random()).toFixed(0),x=u.msid||"rts audio",o+=`
53
+ a=extmap:5 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay`);var y=`
54
+ a=ssrc:`.concat(C,` cname:defaultcname
55
+ a=ssrc:`).concat(C," msid:").concat(x,`
56
+ a=ssrc:`).concat(C,` mslabel:rts
57
+ a=ssrc:`).concat(C," label:video");r.direction==="sub"&&(a+=y),a+=t}else c.type==="audio"&&(C=(1e4*Math.random()).toFixed(0),x=c.msid||"rts audio",a+=`
58
58
  m=audio 9 UDP/TLS/RTP/SAVPF 111
59
59
  c=IN IP4 0.0.0.0
60
60
  a=rtcp:9 IN IP4 0.0.0.0
@@ -64,100 +64,100 @@ a=ice-options:ice-lite
64
64
  a=fingerprint:SHA-256 C3:E2:CD:1F:B8:E4:DA:77:D1:D2:36:F3:72:EA:83:CA:7A:F2:3B:26:07:C6:E0:3D:96:44:57:59:14:DE:F0:A4
65
65
  a=setup:passive
66
66
  a=sendonly
67
- a=mid:`).concat(i.mids[h],`
67
+ a=mid:`).concat(r.mids[p],`
68
68
  a=rtcp-mux
69
69
  a=rtpmap:111 opus/48000/2
70
70
  a=fmtp:111 minptime=10;stereo=1;useinbandfec=1
71
71
  a=rtcp-fb:111 transport-cc
72
72
  a=rtcp-fb:111 nack
73
73
  a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
74
- a=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time`),E=`
75
- a=ssrc:`.concat(S,` cname:defaultcname
76
- a=ssrc:`).concat(S," msid:").concat(x,`
77
- a=ssrc:`).concat(S,` mslabel:rts
78
- a=ssrc:`).concat(S," label:audio"),i.direction==="sub"&&(o+=E),o+=t)}),o}},237:(y,v,s)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.UrlData=void 0;var c=s(887),a=function(){function e(r){var i=(0,c.parseUrlSubParams)(r.url);this.data={url:r.url,subAudio:i.subAudio,subVideo:i.subVideo},typeof r.subAudio=="boolean"&&(this.data.subAudio=r.subAudio),typeof r.subVideo=="boolean"&&(this.data.subVideo=r.subVideo)}return Object.defineProperty(e.prototype,"subVideo",{get:function(){return this.data.subVideo},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subAudio",{get:function(){return this.data.subAudio},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"url",{get:function(){return(0,c.pruneSubUrl)(this.data.url)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"originalUrl",{get:function(){return this.data.url},enumerable:!1,configurable:!0}),e}();v.UrlData=a},123:function(y,v,s){var c,a=this&&this.__extends||(c=function(u,h){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(S,x){S.__proto__=x}||function(S,x){for(var E in x)Object.prototype.hasOwnProperty.call(x,E)&&(S[E]=x[E])},c(u,h)},function(u,h){if(typeof h!="function"&&h!==null)throw new TypeError("Class extends value "+String(h)+" is not a constructor or null");function S(){this.constructor=u}c(u,h),u.prototype=h===null?Object.create(h):(S.prototype=h.prototype,new S)}),e=this&&this.__spreadArray||function(u,h,S){if(S||arguments.length===2)for(var x,E=0,p=h.length;E<p;E++)!x&&E in h||(x||(x=Array.prototype.slice.call(h,0,E)),x[E]=h[E]);return u.concat(x||Array.prototype.slice.call(h))},r=this&&this.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(v,"__esModule",{value:!0});var i=r(s(885)),o=s(973),t=[o.EDatachannelSignalResCode.NGX_RTC_STREAM_NO_FOUND,o.EDatachannelSignalResCode.NGX_RTC_DATACHANNEL_HEBT_MSID_NOT_FOUND],n=function(u){function h(S,x){var E=u.call(this)||this;return E.datachannel=S,E.streamManager=x,E}return a(h,u),h.prototype.process=function(S){var x=this,E=this.parseFormat(S);if(E){var p=this.checkRecode(E),b=p.valid,l=p.error,A=p.reason;if(!b)return E.recode===3?void this.emit("datachannelNotEnabled"):void(l&&this.emit("pcReconnect",{recode:E.recode,reMsg:A}));this.emit("hebtReceived",E),this.checkStreams(E).forEach(function(R){var C={resCode:R.resCode,resMsg:R.resMsg,url:R.url,msids:R.msids,streams:R.streams,type:R.type,latestUrl:R.latestUrl};R.isReconnectable?x.emit("streamReconnect",C):x.emit("streamError",C)})}},h.prototype.parseFormat=function(S){try{return JSON.parse(S)}catch{console.log("Heartbeat parse failed."," Response Data: ",S)}},h.prototype.checkRecode=function(S){var x={valid:!1,error:!1,reason:""};return S.type!==o.EMessageType.HEBT?(x.reason="not heartbeat signal, ignore",x):S.recode!==0?(x.reason=S.msg,x.error=!0,x):(x.valid=!0,x)},h.prototype.checkStreams=function(S){var x=this,E=[];return S.streams&&S.streams.length&&e(e([],this.streamManager.getAllStreamListWithMsids(),!0),this.streamManager.getAllDatachannelList(),!0).forEach(function(p){var b,l=-1;if(S.streams.find(function(g,D){if(g.url===p.url)return l=D,!0})&&l!==-1){var A=S.streams[l];if(A.method===o.EMessageType.HEBT&&A.res_code===200){A.traceid&&x.emit("traceIdUpdate",{url:A.url,traceId:A.traceid});var R=[];p.msids.forEach(function(g){A.msid.find(function(D){return D.name===g.name})||R.push(g)});var C=(b=p.streams)===null||b===void 0?void 0:b.filter(function(g){return!!R.find(function(D){return D.streamId===g.id})});R.length&&E.push({url:p.url,msids:R,streams:C,isReconnectable:!0,resMsg:"RTS heartbeat msid mismatch",resCode:404,type:p.type,latestUrl:p.latestUrl})}else E.push({url:p.url,msids:p.msids,streams:p.streams,isReconnectable:x.isReconnectableErrorCode(A.res_code),resMsg:A.res_msg,resCode:A.res_code,type:p.type,latestUrl:p.latestUrl})}}),E},h.prototype.isReconnectableErrorCode=function(S){return t.includes(S)},h}(i.default);v.default=n},619:function(y,v,s){var c=this&&this.__assign||function(){return c=Object.assign||function(S){for(var x,E=1,p=arguments.length;E<p;E++)for(var b in x=arguments[E])Object.prototype.hasOwnProperty.call(x,b)&&(S[b]=x[b]);return S},c.apply(this,arguments)},a=this&&this.__awaiter||function(S,x,E,p){return new(E||(E=Promise))(function(b,l){function A(g){try{C(p.next(g))}catch(D){l(D)}}function R(g){try{C(p.throw(g))}catch(D){l(D)}}function C(g){var D;g.done?b(g.value):(D=g.value,D instanceof E?D:new E(function(O){O(D)})).then(A,R)}C((p=p.apply(S,x||[])).next())})},e=this&&this.__generator||function(S,x){var E,p,b,l,A={label:0,sent:function(){if(1&b[0])throw b[1];return b[1]},trys:[],ops:[]};return l={next:R(0),throw:R(1),return:R(2)},typeof Symbol=="function"&&(l[Symbol.iterator]=function(){return this}),l;function R(C){return function(g){return function(D){if(E)throw new TypeError("Generator is already executing.");for(;l&&(l=0,D[0]&&(A=0)),A;)try{if(E=1,p&&(b=2&D[0]?p.return:D[0]?p.throw||((b=p.return)&&b.call(p),0):p.next)&&!(b=b.call(p,D[1])).done)return b;switch(p=0,b&&(D=[2&D[0],b.value]),D[0]){case 0:case 1:b=D;break;case 4:return A.label++,{value:D[1],done:!1};case 5:A.label++,p=D[1],D=[0];continue;case 7:D=A.ops.pop(),A.trys.pop();continue;default:if(!((b=(b=A.trys).length>0&&b[b.length-1])||D[0]!==6&&D[0]!==2)){A=0;continue}if(D[0]===3&&(!b||D[1]>b[0]&&D[1]<b[3])){A.label=D[1];break}if(D[0]===6&&A.label<b[1]){A.label=b[1],b=D;break}if(b&&A.label<b[2]){A.label=b[2],A.ops.push(D);break}b[2]&&A.ops.pop(),A.trys.pop();continue}D=x.call(S,A)}catch(O){D=[6,O],p=0}finally{E=b=0}if(5&D[0])throw D[1];return{value:D[0]?D[1]:void 0,done:!0}}([C,g])}}},r=this&&this.__spreadArray||function(S,x,E){if(E||arguments.length===2)for(var p,b=0,l=x.length;b<l;b++)!p&&b in x||(p||(p=Array.prototype.slice.call(x,0,b)),p[b]=x[b]);return S.concat(p||Array.prototype.slice.call(x))};Object.defineProperty(v,"__esModule",{value:!0}),v.Signal=void 0;var i,o,t,n=s(651),u=s(887);(function(S){S.Sub="sub",S.Pub="pub",S.Hebt="hebt"})(i||(i={})),function(S){S.Add="add",S.Active="active",S.Stop="stop",S.Delete="delete",S.Hebt="hebt"}(o||(o={})),function(S){S.Audio="audio",S.Video="video",S.Data="data"}(t||(t={}));var h=function(){function S(x){this.latestMsgId=0,this.latestSubAddMsgId=0,this.pc=x.pc,this.datachannel=new n.DataChannelCore({pc:this.pc,onDatachannelEvent:x.onDatachannelEvent,delayOpen:x.delayOpen})}return S.prototype.getDatachannelCore=function(){return this.datachannel},S.prototype.subscribeAdd=function(x,E,p){var b;return a(this,void 0,void 0,function(){var l;return e(this,function(A){switch(A.label){case 0:return l=c(c({},this.baseParams({type:i.Sub,method:o.Add})),{streams:x.map(function(R,C){var g=R.urlData,D=[];return g.subAudio&&!p.isMsidSubPubDone(g.url,{aMsid:R.aMsid[0]})&&D.push({type:t.Audio,name:R.aMsid[0]}),g.subVideo&&!p.isMsidSubPubDone(g.url,{vMsid:R.vMsid[0]})&&D.push({type:t.Video,name:R.vMsid[0]}),{method:o.Add,url:g.url,msid:D,sdp:E[C],ttl:300}})}),[4,(b=this.datachannel)===null||b===void 0?void 0:b.sendData(l)];case 1:return[2,A.sent()]}})})},S.prototype.subscribeActive=function(x){var E;return a(this,void 0,void 0,function(){var p;return e(this,function(b){switch(b.label){case 0:return p=c(c({},this.baseParams({type:i.Sub,method:o.Active})),{streams:x.map(function(l){var A=l.urlData;return{method:o.Active,url:A.url}})}),[4,(E=this.datachannel)===null||E===void 0?void 0:E.sendData(p)];case 1:return b.sent(),[2]}})})},S.prototype.subscribeDelete=function(x){var E;return a(this,void 0,void 0,function(){var p;return e(this,function(b){switch(b.label){case 0:return p=c(c({},this.baseParams()),{streams:x.map(function(l){var A=l.url,R=l.aMsid,C=l.vMsid,g=[];return R?.length&&(g=r(r([],g,!0),R.map(function(D){return{name:D}}),!0)),C?.length&&(g=r(r([],g,!0),C.map(function(D){return{name:D}}),!0)),{method:o.Delete,url:(0,u.pruneSubUrl)(A),msid:g}})}),[4,(E=this.datachannel)===null||E===void 0?void 0:E.sendData(p)];case 1:return[2,b.sent()]}})})},S.prototype.subscribeStop=function(x){var E;return a(this,void 0,void 0,function(){var p;return e(this,function(b){switch(b.label){case 0:return p=c(c({},this.baseParams()),{streams:x.map(function(l){var A=l.urlData;return{method:o.Stop,url:A.url}})}),[4,(E=this.datachannel)===null||E===void 0?void 0:E.sendData(p)];case 1:return[2,b.sent()]}})})},S.prototype.subscribeAddDatachannel=function(x){var E;return a(this,void 0,void 0,function(){var p;return e(this,function(b){switch(b.label){case 0:return p=c(c({},this.baseParams({type:i.Sub,method:o.Add})),{streams:x.map(function(l){var A=l.url,R=l.msid;return{method:o.Add,url:A,msid:[{type:t.Data,name:R}]}})}),[4,(E=this.datachannel)===null||E===void 0?void 0:E.sendData(p)];case 1:return[2,b.sent()]}})})},S.prototype.subscribeActiveDatachannel=function(x){var E;return a(this,void 0,void 0,function(){var p;return e(this,function(b){switch(b.label){case 0:return p=c(c({},this.baseParams({type:i.Sub,method:o.Active})),{streams:x.map(function(l){var A=l.url,R=l.datachannelId,C=l.msid;return{method:o.Active,url:A,msid:[{type:t.Data,name:C,channel:R}]}})}),[4,(E=this.datachannel)===null||E===void 0?void 0:E.sendData(p)];case 1:return[2,b.sent()]}})})},S.prototype.subscribeStopDatachannel=function(x){var E;return a(this,void 0,void 0,function(){var p;return e(this,function(b){switch(b.label){case 0:return p=c(c({},this.baseParams()),{streams:x.map(function(l){var A=l.url;return{method:o.Stop,url:A}})}),[4,(E=this.datachannel)===null||E===void 0?void 0:E.sendData(p)];case 1:return[2,b.sent()]}})})},S.prototype.publishAdd=function(x,E,p,b){var l;return a(this,void 0,void 0,function(){var A;return e(this,function(R){return A=c(c({},this.baseParams({type:i.Pub})),{streams:x.map(function(C,g){var D=p[g],O=b[g],U=[];return D.length&&U.push({type:"video",name:D[0].trim()}),O.length&&U.push({type:"audio",name:O[0].trim()}),{method:o.Add,url:C,msid:U,sdp:E[g]}})}),[2,(l=this.datachannel)===null||l===void 0?void 0:l.sendData(A)]})})},S.prototype.publishDelete=function(x){var E;return a(this,void 0,void 0,function(){var p;return e(this,function(b){return p=c(c({},this.baseParams({type:i.Pub})),{streams:x.map(function(l){var A=l.url,R=l.aMsid,C=l.vMsid,g=[];return R?.length&&(g=r(r([],g,!0),R.map(function(D){return{name:D}}),!0)),C?.length&&(g=r(r([],g,!0),C.map(function(D){return{name:D}}),!0)),{method:o.Delete,url:(0,u.pruneSubUrl)(A),msid:g}})}),[2,(E=this.datachannel)===null||E===void 0?void 0:E.sendData(p)]})})},S.prototype.publishStop=function(x){var E;return a(this,void 0,void 0,function(){var p;return e(this,function(b){return p=c(c({},this.baseParams({type:i.Pub})),{streams:x.map(function(l){return{method:o.Stop,url:l}})}),[2,(E=this.datachannel)===null||E===void 0?void 0:E.sendData(p)]})})},S.prototype.publishAddDatachannel=function(x){var E;return a(this,void 0,void 0,function(){var p;return e(this,function(b){switch(b.label){case 0:return p=c(c({},this.baseParams({type:i.Pub,method:o.Add})),{streams:x.map(function(l){var A=l.url,R=l.datachannelId,C=l.msid;return{method:o.Add,url:A,msid:[{type:t.Data,name:C,channel:R}]}})}),[4,(E=this.datachannel)===null||E===void 0?void 0:E.sendData(p)];case 1:return[2,b.sent()]}})})},S.prototype.publishStopDatachannel=function(x){var E;return a(this,void 0,void 0,function(){var p;return e(this,function(b){switch(b.label){case 0:return p=c(c({},this.baseParams({type:i.Pub})),{streams:x.map(function(l){var A=l.url;return{method:o.Stop,url:A}})}),[4,(E=this.datachannel)===null||E===void 0?void 0:E.sendData(p)];case 1:return[2,b.sent()]}})})},S.prototype.sendHeartbeat=function(x){x&&!x.map&&(x=void 0);var E=c(c({},this.baseParams({type:i.Hebt})),{streams:x?.map(function(p){var b=p.url;return{method:o.Hebt,url:b}})});if(x||delete E.streams,this.datachannel.sendAsync(E))return E},S.prototype.sendFalseHeartbeat=function(x){var E=c(c({},this.baseParams({type:i.Hebt})),{streams:x?.map(function(p){return{method:"fake",url:p.url}})});if(x||delete E.streams,this.datachannel.sendAsync(E))return E},S.prototype.dispose=function(){this.datachannel.dispose()},S.prototype.baseParams=function(x){x===void 0&&(x={type:i.Sub});var E=0;return x.type===i.Sub&&x.method===o.Add?(E=++this.latestMsgId,this.latestSubAddMsgId=this.latestMsgId):E=x.type===i.Sub&&x.method===o.Active?this.latestSubAddMsgId:++this.latestMsgId,{msg_id:E,version:2,type:x.type}},S}();v.Signal=h},125:function(y,v,s){var c,a=this&&this.__extends||(c=function(u,h){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(S,x){S.__proto__=x}||function(S,x){for(var E in x)Object.prototype.hasOwnProperty.call(x,E)&&(S[E]=x[E])},c(u,h)},function(u,h){if(typeof h!="function"&&h!==null)throw new TypeError("Class extends value "+String(h)+" is not a constructor or null");function S(){this.constructor=u}c(u,h),u.prototype=h===null?Object.create(h):(S.prototype=h.prototype,new S)}),e=this&&this.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(v,"__esModule",{value:!0}),v.NotifyProcessor=void 0;var r,i=s(973),o=e(s(885)),t=s(390);(function(u){u[u.NGX_RTC_H5_DELIVERY_INTERNAL_EXCEPTION=1]="NGX_RTC_H5_DELIVERY_INTERNAL_EXCEPTION",u[u.NGX_RTC_H5_ACCESS_IP_MIGRATION=2]="NGX_RTC_H5_ACCESS_IP_MIGRATION",u[u.NGX_RTC_H5_ACCESS_SUB_STREAMINFO=3]="NGX_RTC_H5_ACCESS_SUB_STREAMINFO"})(r||(r={}));var n=function(u){function h(){var S=u.call(this)||this;return S.logger=new t.Logger({displayName:"NotifyProcessor",switchName:"RTS_NOTIFY_DEBUG"}),S}return a(h,u),h.prototype.processIpMigration=function(S){var x,E,p=this.parseFormat(S);if(p&&this.checkRelated(p)){this.logger.log("\u3010processIpMigration\u3011parsedData",p),this.emit("message",{message:p});var b=this.parseIP(p.notify_msg);!((x=b.pull)===null||x===void 0)&&x.length||!((E=b.push)===null||E===void 0)&&E.length?(console.warn("\u3010processIpMigration\u3011\u9700\u8981\u91CD\u8FDE",b),this.emit("pcReconnect",{ips:b})):this.logger.log("\u3010processIpMigration\u3011No valid ip found: ",p.notify_msg)}},h.prototype.processSubStreamInfo=function(S){var x=this.parseFormat(S);if(this.logger.log("\u3010processSubStreamInfo\u3011parsedData",x),x&&this.checkRelated(x,r.NGX_RTC_H5_ACCESS_SUB_STREAMINFO))return x},h.prototype.processInternalException=function(S){var x=this.parseFormat(S);if(x&&this.checkRelated(x,r.NGX_RTC_H5_DELIVERY_INTERNAL_EXCEPTION)){this.emit("message",{message:x}),this.logger.log("\u3010processInternalException\u3011parsedData",x);var E=Number(x.res_code);E&&![200,204,205,207,221,403,404,405,429,504,616,409,601].includes(E)?(console.warn("\u3010processInternalException\u3011\u9700\u8981\u91CD\u8FDE",E),this.emit("pcReconnect",{})):this.logger.log("\u3010processInternalException\u3011Error code should not retry ",E)}},h.prototype.parseFormat=function(S){try{return JSON.parse(S)}catch{console.warn("Notify parse failed."," Response Data: ",S)}},h.prototype.checkRelated=function(S,x){return x===void 0&&(x=r.NGX_RTC_H5_ACCESS_IP_MIGRATION),S.type===i.EMessageType.NOTI&&S.notify_type===x},h.prototype.parseIP=function(S){S===void 0&&(S=""),this.logger.log("Paring IP string: ".concat(S));var x=S.split(";"),E=/^(?:\d{1,3}\.){3}\d{1,3}$/,p=/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,b=/^(push|pull)_ips:(.*)$/,l={};return x.forEach(function(A){var R=b.exec(A);if(R){var C=R[1],g=R[2].split(",").filter(function(D){return E.test(D)||p.test(D)});l[C]=g}}),this.logger.log("Parsed IP:",l),l},h}(o.default);v.NotifyProcessor=n},132:function(y,v){var s=this&&this.__awaiter||function(r,i,o,t){return new(o||(o=Promise))(function(n,u){function h(E){try{x(t.next(E))}catch(p){u(p)}}function S(E){try{x(t.throw(E))}catch(p){u(p)}}function x(E){var p;E.done?n(E.value):(p=E.value,p instanceof o?p:new o(function(b){b(p)})).then(h,S)}x((t=t.apply(r,i||[])).next())})},c=this&&this.__generator||function(r,i){var o,t,n,u,h={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return u={next:S(0),throw:S(1),return:S(2)},typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function S(x){return function(E){return function(p){if(o)throw new TypeError("Generator is already executing.");for(;u&&(u=0,p[0]&&(h=0)),h;)try{if(o=1,t&&(n=2&p[0]?t.return:p[0]?t.throw||((n=t.return)&&n.call(t),0):t.next)&&!(n=n.call(t,p[1])).done)return n;switch(t=0,n&&(p=[2&p[0],n.value]),p[0]){case 0:case 1:n=p;break;case 4:return h.label++,{value:p[1],done:!1};case 5:h.label++,t=p[1],p=[0];continue;case 7:p=h.ops.pop(),h.trys.pop();continue;default:if(!((n=(n=h.trys).length>0&&n[n.length-1])||p[0]!==6&&p[0]!==2)){h=0;continue}if(p[0]===3&&(!n||p[1]>n[0]&&p[1]<n[3])){h.label=p[1];break}if(p[0]===6&&h.label<n[1]){h.label=n[1],n=p;break}if(n&&h.label<n[2]){h.label=n[2],h.ops.push(p);break}n[2]&&h.ops.pop(),h.trys.pop();continue}p=i.call(r,h)}catch(b){p=[6,b],t=0}finally{o=n=0}if(5&p[0])throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}([x,E])}}},a=this&&this.__spreadArray||function(r,i,o){if(o||arguments.length===2)for(var t,n=0,u=i.length;n<u;n++)!t&&n in i||(t||(t=Array.prototype.slice.call(i,0,n)),t[n]=i[n]);return r.concat(t||Array.prototype.slice.call(i))};Object.defineProperty(v,"__esModule",{value:!0}),v.PeerConnectionRollbackController=void 0;var e=function(){function r(i){this.fakeSdpParams={direction:"sub",mids:[],medias:[]},this.pcCore=i}return r.prototype.setFakeSdpMids=function(i){this.fakeSdpParams.mids=i},r.prototype.setFakeSdpMedias=function(i,o){this.fakeSdpParams.medias=i,this.fakeSdpParams.direction=o},r.prototype.saveStreamManager=function(i){var o;this.streamManager=i,(o=this.streamManager)===null||o===void 0||o.backup()},r.prototype.rollback=function(i){return s(this,void 0,void 0,function(){var o;return c(this,function(t){switch(t.label){case 0:if(i?.trackListnerRollback&&(this.pcCore.removeTrackListener(),this.log("Sub Track Listener Removed")),i?.streamManagerRollback&&this.streamManager){this.streamManager.restore();try{this.log("Stream Manager Restored",JSON.parse(JSON.stringify(this.streamManager)))}catch{}}if(i?.pcTransceiversRollback&&(this.fakeSdpParams.medias.forEach(function(n){var u;(u=n.trans)===null||u===void 0||u.receiver.track.stop()}),this.log("Sub Track(s) Stopped",this.fakeSdpParams.medias)),!i?.runSimulateSignal)return[3,4];this.log("SDP Simulating...",this.fakeSdpParams),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.pcCore.simulateOfferAnswer(this.fakeSdpParams)];case 2:return t.sent(),this.log("SDP Simulation Done"),[3,4];case 3:return o=t.sent(),this.log("SDP Simulation Failed",o),[3,4];case 4:return[2]}})})},r.prototype.log=function(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];window.RTS_DATACHANNEL_DEBUG&&console.log.apply(console,a(["[PC-Core-Rollback]"],i,!1))},r}();v.PeerConnectionRollbackController=e},628:function(y,v,s){var c=this&&this.__assign||function(){return c=Object.assign||function(o){for(var t,n=1,u=arguments.length;n<u;n++)for(var h in t=arguments[n])Object.prototype.hasOwnProperty.call(t,h)&&(o[h]=t[h]);return o},c.apply(this,arguments)},a=this&&this.__spreadArray||function(o,t,n){if(n||arguments.length===2)for(var u,h=0,S=t.length;h<S;h++)!u&&h in t||(u||(u=Array.prototype.slice.call(t,0,h)),u[h]=t[h]);return o.concat(u||Array.prototype.slice.call(t))};Object.defineProperty(v,"__esModule",{value:!0}),v.StreamManager=v.EStreamType=void 0;var e,r=s(887);(function(o){o.Subscribe="sub",o.Publish="pub"})(e=v.EStreamType||(v.EStreamType={}));var i=function(){function o(t){this.streamMap={},this.streamMapBackup={},this.datachannelMap=new Map}return o.prototype.backup=function(){var t=this,n={};Object.keys(this.streamMap).forEach(function(u){var h=t.streamMap[u];n[u]=c(c({},t.streamMap[u]),{videoInfoList:a([],h.videoInfoList,!0),audioInfoList:a([],h.audioInfoList,!0),streamList:a([],h.streamList,!0)})}),this.streamMapBackup=n},o.prototype.restore=function(){this.streamMap=c({},this.streamMapBackup)},o.prototype.init=function(t,n){n===void 0&&(n=e.Subscribe);var u=(0,r.pruneSubUrl)(t);t=(0,r.pruneSubUrl)(t,!0),this.has(t)||(this.streamMap[t]={type:n,videoInfoList:[],audioInfoList:[],streamList:[],originUrl:u})},o.prototype.remove=function(t){delete this.streamMap[(0,r.pruneSubUrl)(t,!0)]},o.prototype.update=function(t,n){var u=this.get(t);if(!u)throw new Error("No url found");if(n.aMsid){var h=u.audioInfoList.find(function(x){return x.msid===n.aMsid})||this.createMediaItem(n.aMsid,"audio");n.aTransceiver&&(h.transceiver=n.aTransceiver),n.stream&&(h.streamId=n.stream.id),this.updateMediaInfoList(h,u.audioInfoList)}if(n.vMsid){var S=u.videoInfoList.find(function(x){return x.msid===n.vMsid})||this.createMediaItem(n.vMsid,"video");n.vTransceiver&&(S.transceiver=n.vTransceiver),n.cumuDelay&&(S.cumuDelay=n.cumuDelay),n.stream&&(S.streamId=n.stream.id),this.updateMediaInfoList(S,u.videoInfoList)}n.stream&&(u.streamList.some(function(x){return x.id===n.stream.id})||(u.streamList=a(a([],u.streamList,!0),[n.stream],!1)))},o.prototype.pruneStreamList=function(t){var n=this.get(t);n&&(n.streamList=n.streamList.filter(function(u){var h;return((h=u.mediaStream)===null||h===void 0?void 0:h.getTracks().length)>0}))},o.prototype.updateSdpInfo=function(t,n){var u,h=this.get(t);if(!h)throw new Error("No url found");if(n.aMsid?u=h.audioInfoList.find(function(S){return S.msid===n.aMsid}):n.vMsid&&(u=h.videoInfoList.find(function(S){return S.msid===n.vMsid})),!u)throw new Error("No target media found");u.ssrc=n.ssrc,u.codec=n.codec,u.pt=n.pt,u.from=n.from},o.prototype.get=function(t){return this.streamMap[(0,r.pruneSubUrl)(t,!0)]},o.prototype.has=function(t){return!!this.get(t)},o.prototype.getSize=function(){return this.getSubOrPubDoneMediaMapSize()+this.getDcMapSize()},o.prototype.getSubOrPubDoneMediaMapSize=function(){var t=this,n=0;return Object.keys(this.streamMap).forEach(function(u){var h=t.streamMap[u],S=!1;h.audioInfoList.forEach(function(x){S=S||h.type===e.Publish&&x.pubDone||h.type===e.Subscribe&&x.subDone}),h.videoInfoList.forEach(function(x){S=S||h.type===e.Publish&&x.pubDone||h.type===e.Subscribe&&x.subDone}),S&&n++}),n},o.prototype.getDcMapSize=function(){return this.datachannelMap.size},o.prototype.removeMsid=function(t,n){t=(0,r.pruneSubUrl)(t,!0);var u=this.get(t);u&&(n.vMsid&&(u.videoInfoList=u.videoInfoList.filter(function(h){return h.msid!==n.vMsid})),n.aMsid&&(u.audioInfoList=u.audioInfoList.filter(function(h){return h.msid!==n.aMsid})))},o.prototype.getMids=function(t,n){n===void 0&&(n={filterSubDone:!1}),t=(0,r.pruneSubUrl)(t,!0);var u=this.streamMap[t];return u?a(a([],u.audioInfoList.reduce(function(h,S){return S.transceiver&&(!n.filterSubDone||n.filterSubDone&&!S.subDone)?a(a([],h,!0),[String(S.transceiver.mid)],!1):h},[]),!0),u.videoInfoList.reduce(function(h,S){return S.transceiver&&(!n.filterSubDone||n.filterSubDone&&!S.subDone)?a(a([],h,!0),[String(S.transceiver.mid)],!1):h},[]),!0):[]},o.prototype.getAllTransceivers=function(t){if(!t)return[];t=(0,r.pruneSubUrl)(t,!0);var n=this.get(t);return n?a(a([],n.videoInfoList.map(function(u){return u.transceiver}),!0),n.audioInfoList.map(function(u){return u.transceiver}),!0):[]},o.prototype.getTransceiver=function(t,n){if(n===void 0&&(n={}),t){t=(0,r.pruneSubUrl)(t,!0);var u=n.vMsid,h=n.aMsid,S=this.get(t);if(S){var x;if(u)return(x=S.videoInfoList.find(function(E){return E.msid===u}))==null?void 0:x.transceiver;if(h)return(x=S.audioInfoList.find(function(E){return E.msid===h}))==null?void 0:x.transceiver}}},o.prototype.getStreamByMsid=function(t){var n,u,h=this.get(t.url);if(h){if(t.vMsid){var S=(n=h.videoInfoList.find(function(E){return E.msid===t.vMsid}))===null||n===void 0?void 0:n.streamId;return h.streamList.find(function(E){return E.id===S})}if(t.aMsid){var x=(u=h.audioInfoList.find(function(E){return E.msid===t.aMsid}))===null||u===void 0?void 0:u.streamId;return h.streamList.find(function(E){return E.id===x})}return h.streamList[0]}},o.prototype.hasTransceiver=function(t,n){return n===void 0&&(n={}),!!this.getTransceiver(t,n)},o.prototype.removeTransceiver=function(t,n){t=(0,r.pruneSubUrl)(t,!0);var u,h=this.get(t);h&&(n.vMsid&&(u=h.videoInfoList.find(function(S){return S.msid===n.vMsid}))&&(u.transceiver=void 0),n.aMsid&&(u=h.audioInfoList.find(function(S){return S.msid===n.aMsid}))&&(u.transceiver=void 0))},o.prototype.markAlreadySubPub=function(t,n){n===void 0&&(n={}),t=(0,r.pruneSubUrl)(t,!0);var u,h=this.streamMap[t];h&&(n.vMsid&&(u=h.videoInfoList.find(function(S){return S.msid===n.vMsid}))&&(u[n.isPub?"pubDone":"subDone"]=!n.reset),n.aMsid&&(u=h.audioInfoList.find(function(S){return S.msid===n.aMsid}))&&(u[n.isPub?"pubDone":"subDone"]=!n.reset))},o.prototype.isMsidSubPubDone=function(t,n){n===void 0&&(n={}),t=(0,r.pruneSubUrl)(t,!0);var u=this.streamMap[t];if(!u)return!1;if(n.vMsid){var h=u.videoInfoList.find(function(S){return S.msid===n.vMsid});return n.isPub?h?.pubDone:h?.subDone}return n.aMsid?(h=u.audioInfoList.find(function(S){return S.msid===n.aMsid}),n.isPub?h?.pubDone:h?.subDone):void 0},o.prototype.getAllMediaInfoList=function(t,n){var u=this.get(t);return u?a(a([],u.audioInfoList.map(function(h){var S,x,E,p,b=h.type,l=h.msid,A=h.ssrc,R=h.pt,C=h.codec,g=h.from,D=h.transceiver,O={type:b,msid:l,ssrc:A,pt:R,codec:C,from:g,trackId:u.type===e.Subscribe?(x=(S=D?.receiver)===null||S===void 0?void 0:S.track)===null||x===void 0?void 0:x.id:(p=(E=D?.sender)===null||E===void 0?void 0:E.track)===null||p===void 0?void 0:p.id};return n?c(c({},O),{transceiver:D}):O}),!0),u.videoInfoList.map(function(h){var S,x,E,p,b=h.type,l=h.msid,A=h.ssrc,R=h.pt,C=h.codec,g=h.from,D=h.transceiver,O={type:b,msid:l,ssrc:A,pt:R,codec:C,from:g,trackId:u.type===e.Subscribe?(x=(S=D?.receiver)===null||S===void 0?void 0:S.track)===null||x===void 0?void 0:x.id:(p=(E=D?.sender)===null||E===void 0?void 0:E.track)===null||p===void 0?void 0:p.id};return n?c(c({},O),{transceiver:D}):O}),!0):[]},o.prototype.getOriginUrl=function(t){var n=(0,r.pruneSubUrl)(t,!0),u=this.get(n);return u?u.originUrl:t},o.prototype.getAllTrackPairList=function(t){var n,u,h,S,x=[];for(var E in this.streamMap){var p=this.streamMap[E];if(p.type===t)for(var b=Math.max(p.audioInfoList.length,p.videoInfoList.length),l=0;l<b;l++){var A={url:E,originUrl:p.originUrl};l<p.audioInfoList.length&&(A.aTransceiver=t===e.Subscribe?(n=p.audioInfoList[l].transceiver)===null||n===void 0?void 0:n.receiver:(u=p.audioInfoList[l].transceiver)===null||u===void 0?void 0:u.sender,A.aMsid=p.audioInfoList[l].msid),l<p.videoInfoList.length&&(A.vTransceiver=t===e.Subscribe?(h=p.videoInfoList[l].transceiver)===null||h===void 0?void 0:h.receiver:(S=p.videoInfoList[l].transceiver)===null||S===void 0?void 0:S.sender,A.vMsid=p.videoInfoList[l].msid,A.cumuDelay=p.videoInfoList[l].cumuDelay),x.push(A)}}return x},o.prototype.getAllStreamListWithMsids=function(){var t,n=[];for(var u in this.streamMap){for(var h=this.streamMap[u],S=Math.max(h.audioInfoList.length,h.videoInfoList.length,h.streamList.length),x={url:u,msids:[],type:h.type,latestUrl:h.latestUrl||h.originUrl,streams:[]},E=0;E<S;E++){if(E<h.audioInfoList.length&&h.audioInfoList[E].msid){var p=h.audioInfoList[E];p.msid&&(h.type===e.Publish&&p.pubDone||h.type===e.Subscribe&&p.subDone)&&x.msids.push({name:p.msid||"",type:p.type||"audio",streamId:p.streamId})}if(E<h.videoInfoList.length&&h.videoInfoList[E].msid){var b=h.videoInfoList[E];b.msid&&(h.type===e.Publish&&b.pubDone||h.type===e.Subscribe&&b.subDone)&&x.msids.push({name:b.msid||"",type:b.type||"video",streamId:b.streamId})}E<h.streamList.length&&h.streamList[E]&&((t=x.streams)===null||t===void 0||t.push(h.streamList[E]))}x.msids.length&&n.push(x)}return n},o.prototype.getSender=function(t,n,u){var h,S,x=void 0,E=this.getAllMediaInfoList(t,!0);return u?E.forEach(function(p){var b,l,A,R=(l=(b=p.transceiver)===null||b===void 0?void 0:b.sender)===null||l===void 0?void 0:l.track;R?.kind===n&&p.msid===u&&(x=(A=p.transceiver)===null||A===void 0?void 0:A.sender)}):x=(S=(h=E?.find(function(p){var b,l,A;return((A=(l=(b=p.transceiver)===null||b===void 0?void 0:b.sender)===null||l===void 0?void 0:l.track)===null||A===void 0?void 0:A.kind)===n}))===null||h===void 0?void 0:h.transceiver)===null||S===void 0?void 0:S.sender,x},o.prototype.getReceiver=function(t,n,u){var h,S,x=void 0,E=this.getAllMediaInfoList(t,!0);return u?E.forEach(function(p){var b,l,A,R=(l=(b=p.transceiver)===null||b===void 0?void 0:b.receiver)===null||l===void 0?void 0:l.track;R?.kind===n&&p.msid===u&&(x=(A=p.transceiver)===null||A===void 0?void 0:A.receiver)}):x=(S=(h=E?.find(function(p){var b,l,A;return((A=(l=(b=p.transceiver)===null||b===void 0?void 0:b.receiver)===null||l===void 0?void 0:l.track)===null||A===void 0?void 0:A.kind)===n}))===null||h===void 0?void 0:h.transceiver)===null||S===void 0?void 0:S.receiver,x},o.prototype.dispose=function(){this.streamMap={}},o.prototype.updateMediaInfoList=function(t,n){var u=n.findIndex(function(h){return h.msid===t.msid});u!==-1?n.splice(u,1,t):n.push(t)},o.prototype.findMediaItemByMsid=function(t,n){return n.find(function(u){return u.msid===t})},o.prototype.createMediaItem=function(t,n){return{msid:t,ssrc:void 0,transceiver:void 0,subDone:!1,pubDone:!1,type:n,streamId:void 0}},o.prototype.addOrUpdateDatachannelItem=function(t){var n=this.datachannelMap.get(t.url);n?t.msids.forEach(function(u){n.msids.find(function(h){if(h.id===u.id&&h.name===u.name)return!0})?console.log("RTS [STREAM MANAGER]: duplicate msid for datachannel",t):n.msids.push(u)}):this.datachannelMap.set(t.url,t)},o.prototype.deleteDatachannelItem=function(t){this.datachannelMap.delete(t.url)},o.prototype.getAllDatachannelList=function(){var t=[];return this.datachannelMap.forEach(function(n){t.push(c(c({},n),{latestUrl:n.latestUrl||n.originUrl}))}),t},o.prototype.getDatachannelByMsid=function(t){var n;if(t.url){var u=this.datachannelMap.get((0,r.pruneSubUrl)(t.url,!0));if(u)return t.msid?(n=u.msids.find(function(h){return h.name===t.msid}))===null||n===void 0?void 0:n.datachannel:u.msids[0].datachannel}else console.warn("[getDatachannelByMsid] config.url is required.")},o.prototype.getPubOrSubDoneMediaUrlByIndex=function(t){var n=0,u=function(E){var p=h.streamMap[E],b=!1;if(p.audioInfoList.forEach(function(l){b=b||p.type===e.Publish&&l.pubDone||p.type===e.Subscribe&&l.subDone}),p.videoInfoList.forEach(function(l){b=b||p.type===e.Publish&&l.pubDone||p.type===e.Subscribe&&l.subDone}),b){if(n===t)return{value:E};n++}},h=this;for(var S in this.streamMap){var x=u(S);if(typeof x=="object")return x.value}},o.prototype.getDcUrlByIndex=function(t){var n=void 0;return this.datachannelMap.forEach(function(u){t===0&&(n={url:u.originUrl})}),n},o.prototype.updateLatestUrl=function(t){var n=this.get(t);return!!n&&(n.latestUrl=t,!0)},o}();v.StreamManager=i}},m={};function d(y){var v=m[y];if(v!==void 0)return v.exports;var s=m[y]={exports:{}};return _[y].call(s.exports,s,s.exports,d),s.exports}var f={};return(()=>{var y=f;Object.defineProperty(y,"__esModule",{value:!0}),y.DataChannelCore=y.EDatachannelStatus=y.PeerConnectionCore=void 0;var v=d(776);Object.defineProperty(y,"PeerConnectionCore",{enumerable:!0,get:function(){return v.PeerConnectionCore}}),Object.defineProperty(y,"EDatachannelStatus",{enumerable:!0,get:function(){return v.EDatachannelStatus}});var s=d(651);Object.defineProperty(y,"DataChannelCore",{enumerable:!0,get:function(){return s.DataChannelCore}})})(),f})(),j.exports=T()},2505:(j,T,_)=>{j.exports=_(8015)},5592:(j,T,_)=>{var m=_(9516),d=_(7522),f=_(3948),y=_(9106),v=_(9615),s=_(2012),c=_(4202),a=_(7763);j.exports=function(e){return new Promise(function(r,i){var o=e.data,t=e.headers,n=e.responseType;m.isFormData(o)&&delete t["Content-Type"];var u=new XMLHttpRequest;if(e.auth){var h=e.auth.username||"",S=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";t.Authorization="Basic "+btoa(h+":"+S)}var x=v(e.baseURL,e.url);function E(){if(u){var b="getAllResponseHeaders"in u?s(u.getAllResponseHeaders()):null,l={data:n&&n!=="text"&&n!=="json"?u.response:u.responseText,status:u.status,statusText:u.statusText,headers:b,config:e,request:u};d(r,i,l),u=null}}if(u.open(e.method.toUpperCase(),y(x,e.params,e.paramsSerializer),!0),u.timeout=e.timeout,"onloadend"in u?u.onloadend=E:u.onreadystatechange=function(){u&&u.readyState===4&&(u.status!==0||u.responseURL&&u.responseURL.indexOf("file:")===0)&&setTimeout(E)},u.onabort=function(){u&&(i(a("Request aborted",e,"ECONNABORTED",u)),u=null)},u.onerror=function(){i(a("Network Error",e,null,u)),u=null},u.ontimeout=function(){var b="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(b=e.timeoutErrorMessage),i(a(b,e,e.transitional&&e.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",u)),u=null},m.isStandardBrowserEnv()){var p=(e.withCredentials||c(x))&&e.xsrfCookieName?f.read(e.xsrfCookieName):void 0;p&&(t[e.xsrfHeaderName]=p)}"setRequestHeader"in u&&m.forEach(t,function(b,l){o===void 0&&l.toLowerCase()==="content-type"?delete t[l]:u.setRequestHeader(l,b)}),m.isUndefined(e.withCredentials)||(u.withCredentials=!!e.withCredentials),n&&n!=="json"&&(u.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&u.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&u.upload&&u.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then(function(b){u&&(u.abort(),i(b),u=null)}),o||(o=null),u.send(o)})}},8015:(j,T,_)=>{var m=_(9516),d=_(9012),f=_(5155),y=_(5343);function v(c){var a=new f(c),e=d(f.prototype.request,a);return m.extend(e,f.prototype,a),m.extend(e,a),e}var s=v(_(6987));s.Axios=f,s.create=function(c){return v(y(s.defaults,c))},s.Cancel=_(1928),s.CancelToken=_(3191),s.isCancel=_(3864),s.all=function(c){return Promise.all(c)},s.spread=_(7980),s.isAxiosError=_(5019),j.exports=s,j.exports.default=s},1928:j=>{function T(_){this.message=_}T.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},T.prototype.__CANCEL__=!0,j.exports=T},3191:(j,T,_)=>{var m=_(1928);function d(f){if(typeof f!="function")throw new TypeError("executor must be a function.");var y;this.promise=new Promise(function(s){y=s});var v=this;f(function(s){v.reason||(v.reason=new m(s),y(v.reason))})}d.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},d.source=function(){var f;return{token:new d(function(y){f=y}),cancel:f}},j.exports=d},3864:j=>{j.exports=function(T){return!(!T||!T.__CANCEL__)}},5155:(j,T,_)=>{var m=_(9516),d=_(9106),f=_(3471),y=_(4490),v=_(5343),s=_(4841),c=s.validators;function a(e){this.defaults=e,this.interceptors={request:new f,response:new f}}a.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=v(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var r=e.transitional;r!==void 0&&s.assertOptions(r,{silentJSONParsing:c.transitional(c.boolean,"1.0.0"),forcedJSONParsing:c.transitional(c.boolean,"1.0.0"),clarifyTimeoutError:c.transitional(c.boolean,"1.0.0")},!1);var i=[],o=!0;this.interceptors.request.forEach(function(E){typeof E.runWhen=="function"&&E.runWhen(e)===!1||(o=o&&E.synchronous,i.unshift(E.fulfilled,E.rejected))});var t,n=[];if(this.interceptors.response.forEach(function(E){n.push(E.fulfilled,E.rejected)}),!o){var u=[y,void 0];for(Array.prototype.unshift.apply(u,i),u=u.concat(n),t=Promise.resolve(e);u.length;)t=t.then(u.shift(),u.shift());return t}for(var h=e;i.length;){var S=i.shift(),x=i.shift();try{h=S(h)}catch(E){x(E);break}}try{t=y(h)}catch(E){return Promise.reject(E)}for(;n.length;)t=t.then(n.shift(),n.shift());return t},a.prototype.getUri=function(e){return e=v(this.defaults,e),d(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},m.forEach(["delete","get","head","options"],function(e){a.prototype[e]=function(r,i){return this.request(v(i||{},{method:e,url:r,data:(i||{}).data}))}}),m.forEach(["post","put","patch"],function(e){a.prototype[e]=function(r,i,o){return this.request(v(o||{},{method:e,url:r,data:i}))}}),j.exports=a},3471:(j,T,_)=>{var m=_(9516);function d(){this.handlers=[]}d.prototype.use=function(f,y,v){return this.handlers.push({fulfilled:f,rejected:y,synchronous:!!v&&v.synchronous,runWhen:v?v.runWhen:null}),this.handlers.length-1},d.prototype.eject=function(f){this.handlers[f]&&(this.handlers[f]=null)},d.prototype.forEach=function(f){m.forEach(this.handlers,function(y){y!==null&&f(y)})},j.exports=d},9615:(j,T,_)=>{var m=_(9137),d=_(4680);j.exports=function(f,y){return f&&!m(y)?d(f,y):y}},7763:(j,T,_)=>{var m=_(5449);j.exports=function(d,f,y,v,s){var c=new Error(d);return m(c,f,y,v,s)}},4490:(j,T,_)=>{var m=_(9516),d=_(2881),f=_(3864),y=_(6987);function v(s){s.cancelToken&&s.cancelToken.throwIfRequested()}j.exports=function(s){return v(s),s.headers=s.headers||{},s.data=d.call(s,s.data,s.headers,s.transformRequest),s.headers=m.merge(s.headers.common||{},s.headers[s.method]||{},s.headers),m.forEach(["delete","get","head","post","put","patch","common"],function(c){delete s.headers[c]}),(s.adapter||y.adapter)(s).then(function(c){return v(s),c.data=d.call(s,c.data,c.headers,s.transformResponse),c},function(c){return f(c)||(v(s),c&&c.response&&(c.response.data=d.call(s,c.response.data,c.response.headers,s.transformResponse))),Promise.reject(c)})}},5449:j=>{j.exports=function(T,_,m,d,f){return T.config=_,m&&(T.code=m),T.request=d,T.response=f,T.isAxiosError=!0,T.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},T}},5343:(j,T,_)=>{var m=_(9516);j.exports=function(d,f){f=f||{};var y={},v=["url","method","data"],s=["headers","auth","proxy","params"],c=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],a=["validateStatus"];function e(t,n){return m.isPlainObject(t)&&m.isPlainObject(n)?m.merge(t,n):m.isPlainObject(n)?m.merge({},n):m.isArray(n)?n.slice():n}function r(t){m.isUndefined(f[t])?m.isUndefined(d[t])||(y[t]=e(void 0,d[t])):y[t]=e(d[t],f[t])}m.forEach(v,function(t){m.isUndefined(f[t])||(y[t]=e(void 0,f[t]))}),m.forEach(s,r),m.forEach(c,function(t){m.isUndefined(f[t])?m.isUndefined(d[t])||(y[t]=e(void 0,d[t])):y[t]=e(void 0,f[t])}),m.forEach(a,function(t){t in f?y[t]=e(d[t],f[t]):t in d&&(y[t]=e(void 0,d[t]))});var i=v.concat(s).concat(c).concat(a),o=Object.keys(d).concat(Object.keys(f)).filter(function(t){return i.indexOf(t)===-1});return m.forEach(o,r),y}},7522:(j,T,_)=>{var m=_(7763);j.exports=function(d,f,y){var v=y.config.validateStatus;y.status&&v&&!v(y.status)?f(m("Request failed with status code "+y.status,y.config,null,y.request,y)):d(y)}},2881:(j,T,_)=>{var m=_(9516),d=_(6987);j.exports=function(f,y,v){var s=this||d;return m.forEach(v,function(c){f=c.call(s,f,y)}),f}},6987:(j,T,_)=>{var m=_(9516),d=_(7018),f=_(5449),y={"Content-Type":"application/x-www-form-urlencoded"};function v(a,e){!m.isUndefined(a)&&m.isUndefined(a["Content-Type"])&&(a["Content-Type"]=e)}var s,c={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:((typeof XMLHttpRequest<"u"||typeof process<"u"&&Object.prototype.toString.call(process)==="[object process]")&&(s=_(5592)),s),transformRequest:[function(a,e){return d(e,"Accept"),d(e,"Content-Type"),m.isFormData(a)||m.isArrayBuffer(a)||m.isBuffer(a)||m.isStream(a)||m.isFile(a)||m.isBlob(a)?a:m.isArrayBufferView(a)?a.buffer:m.isURLSearchParams(a)?(v(e,"application/x-www-form-urlencoded;charset=utf-8"),a.toString()):m.isObject(a)||e&&e["Content-Type"]==="application/json"?(v(e,"application/json"),function(r,i,o){if(m.isString(r))try{return(i||JSON.parse)(r),m.trim(r)}catch(t){if(t.name!=="SyntaxError")throw t}return(0,JSON.stringify)(r)}(a)):a}],transformResponse:[function(a){var e=this.transitional,r=e&&e.silentJSONParsing,i=e&&e.forcedJSONParsing,o=!r&&this.responseType==="json";if(o||i&&m.isString(a)&&a.length)try{return JSON.parse(a)}catch(t){if(o)throw t.name==="SyntaxError"?f(t,this,"E_JSON_PARSE"):t}return a}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(a){return a>=200&&a<300}};c.headers={common:{Accept:"application/json, text/plain, */*"}},m.forEach(["delete","get","head"],function(a){c.headers[a]={}}),m.forEach(["post","put","patch"],function(a){c.headers[a]=m.merge(y)}),j.exports=c},9012:j=>{j.exports=function(T,_){return function(){for(var m=new Array(arguments.length),d=0;d<m.length;d++)m[d]=arguments[d];return T.apply(_,m)}}},9106:(j,T,_)=>{var m=_(9516);function d(f){return encodeURIComponent(f).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}j.exports=function(f,y,v){if(!y)return f;var s;if(v)s=v(y);else if(m.isURLSearchParams(y))s=y.toString();else{var c=[];m.forEach(y,function(e,r){e!=null&&(m.isArray(e)?r+="[]":e=[e],m.forEach(e,function(i){m.isDate(i)?i=i.toISOString():m.isObject(i)&&(i=JSON.stringify(i)),c.push(d(r)+"="+d(i))}))}),s=c.join("&")}if(s){var a=f.indexOf("#");a!==-1&&(f=f.slice(0,a)),f+=(f.indexOf("?")===-1?"?":"&")+s}return f}},4680:j=>{j.exports=function(T,_){return _?T.replace(/\/+$/,"")+"/"+_.replace(/^\/+/,""):T}},3948:(j,T,_)=>{var m=_(9516);j.exports=m.isStandardBrowserEnv()?{write:function(d,f,y,v,s,c){var a=[];a.push(d+"="+encodeURIComponent(f)),m.isNumber(y)&&a.push("expires="+new Date(y).toGMTString()),m.isString(v)&&a.push("path="+v),m.isString(s)&&a.push("domain="+s),c===!0&&a.push("secure"),document.cookie=a.join("; ")},read:function(d){var f=document.cookie.match(new RegExp("(^|;\\s*)("+d+")=([^;]*)"));return f?decodeURIComponent(f[3]):null},remove:function(d){this.write(d,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},9137:j=>{j.exports=function(T){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(T)}},5019:j=>{j.exports=function(T){return typeof T=="object"&&T.isAxiosError===!0}},4202:(j,T,_)=>{var m=_(9516);j.exports=m.isStandardBrowserEnv()?function(){var d,f=/(msie|trident)/i.test(navigator.userAgent),y=document.createElement("a");function v(s){var c=s;return f&&(y.setAttribute("href",c),c=y.href),y.setAttribute("href",c),{href:y.href,protocol:y.protocol?y.protocol.replace(/:$/,""):"",host:y.host,search:y.search?y.search.replace(/^\?/,""):"",hash:y.hash?y.hash.replace(/^#/,""):"",hostname:y.hostname,port:y.port,pathname:y.pathname.charAt(0)==="/"?y.pathname:"/"+y.pathname}}return d=v(window.location.href),function(s){var c=m.isString(s)?v(s):s;return c.protocol===d.protocol&&c.host===d.host}}():function(){return!0}},7018:(j,T,_)=>{var m=_(9516);j.exports=function(d,f){m.forEach(d,function(y,v){v!==f&&v.toUpperCase()===f.toUpperCase()&&(d[f]=y,delete d[v])})}},2012:(j,T,_)=>{var m=_(9516),d=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];j.exports=function(f){var y,v,s,c={};return f&&m.forEach(f.split(`
79
- `),function(a){if(s=a.indexOf(":"),y=m.trim(a.substr(0,s)).toLowerCase(),v=m.trim(a.substr(s+1)),y){if(c[y]&&d.indexOf(y)>=0)return;c[y]=y==="set-cookie"?(c[y]?c[y]:[]).concat([v]):c[y]?c[y]+", "+v:v}}),c}},7980:j=>{j.exports=function(T){return function(_){return T.apply(null,_)}}},4841:(j,T,_)=>{var m=_(4198),d={};["object","boolean","number","function","string","symbol"].forEach(function(s,c){d[s]=function(a){return typeof a===s||"a"+(c<1?"n ":" ")+s}});var f={},y=m.version.split(".");function v(s,c){for(var a=c?c.split("."):y,e=s.split("."),r=0;r<3;r++){if(a[r]>e[r])return!0;if(a[r]<e[r])return!1}return!1}d.transitional=function(s,c,a){var e=c&&v(c);function r(i,o){return"[Axios v"+m.version+"] Transitional option '"+i+"'"+o+(a?". "+a:"")}return function(i,o,t){if(s===!1)throw new Error(r(o," has been removed in "+c));return e&&!f[o]&&(f[o]=!0,console.warn(r(o," has been deprecated since v"+c+" and will be removed in the near future"))),!s||s(i,o,t)}},j.exports={isOlderVersion:v,assertOptions:function(s,c,a){if(typeof s!="object")throw new TypeError("options must be an object");for(var e=Object.keys(s),r=e.length;r-- >0;){var i=e[r],o=c[i];if(o){var t=s[i],n=t===void 0||o(t,i,s);if(n!==!0)throw new TypeError("option "+i+" must be "+n)}else if(a!==!0)throw Error("Unknown option "+i)}},validators:d}},9516:(j,T,_)=>{var m=_(9012),d=Object.prototype.toString;function f(e){return d.call(e)==="[object Array]"}function y(e){return e===void 0}function v(e){return e!==null&&typeof e=="object"}function s(e){if(d.call(e)!=="[object Object]")return!1;var r=Object.getPrototypeOf(e);return r===null||r===Object.prototype}function c(e){return d.call(e)==="[object Function]"}function a(e,r){if(e!=null)if(typeof e!="object"&&(e=[e]),f(e))for(var i=0,o=e.length;i<o;i++)r.call(null,e[i],i,e);else for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&r.call(null,e[t],t,e)}j.exports={isArray:f,isArrayBuffer:function(e){return d.call(e)==="[object ArrayBuffer]"},isBuffer:function(e){return e!==null&&!y(e)&&e.constructor!==null&&!y(e.constructor)&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e)},isFormData:function(e){return typeof FormData<"u"&&e instanceof FormData},isArrayBufferView:function(e){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return typeof e=="string"},isNumber:function(e){return typeof e=="number"},isObject:v,isPlainObject:s,isUndefined:y,isDate:function(e){return d.call(e)==="[object Date]"},isFile:function(e){return d.call(e)==="[object File]"},isBlob:function(e){return d.call(e)==="[object Blob]"},isFunction:c,isStream:function(e){return v(e)&&c(e.pipe)},isURLSearchParams:function(e){return typeof URLSearchParams<"u"&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return(typeof navigator>"u"||navigator.product!=="ReactNative"&&navigator.product!=="NativeScript"&&navigator.product!=="NS")&&typeof window<"u"&&typeof document<"u"},forEach:a,merge:function e(){var r={};function i(n,u){s(r[u])&&s(n)?r[u]=e(r[u],n):s(n)?r[u]=e({},n):f(n)?r[u]=n.slice():r[u]=n}for(var o=0,t=arguments.length;o<t;o++)a(arguments[o],i);return r},extend:function(e,r,i){return a(r,function(o,t){e[t]=i&&typeof o=="function"?m(o,i):o}),e},trim:function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},stripBOM:function(e){return e.charCodeAt(0)===65279&&(e=e.slice(1)),e}}},3412:j=>{/*! media-device - ver 1.4.0 created:2025/7/3 19:29:03 */j.exports=(()=>{var T={304:(m,d,f)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.BrowserDeviceManager=void 0;var y=f(101),v=f(853),s=f(62),c=f(913),a=f(331),e=f(1),r=f(935),i=f(603),o=function(){function t(){this.systemUtil=new y.SystemUtil,this.deviceManager=this.createDeviceManager()}return t.prototype.getCameraList=function(){return this.deviceManager.getCameraList()},t.prototype.getMicList=function(){return this.deviceManager.getMicList()},t.prototype.getSpeakerList=function(){return this.deviceManager.getSpeakerList()},t.prototype.getAudioTrack=function(n){return this.deviceManager.getAudioTrack(n)},t.prototype.getVideoTrack=function(n){return this.deviceManager.getVideoTrack(n)},t.prototype.getAudioVideoTracks=function(n){return this.deviceManager.getAudioVideoTracks(n)},t.prototype.getScreenTrack=function(n){return this.deviceManager.getScreenTrack(n)},t.prototype.getAudioStream=function(n){return this.deviceManager.getAudioStream(n)},t.prototype.getVideoStream=function(n){return this.deviceManager.getVideoStream(n)},t.prototype.getScreenStream=function(n){return this.deviceManager.getScreenStream(n)},t.prototype.checkSupportScreenShare=function(){return this.deviceManager.checkSupportScreenShare()},t.prototype.createDeviceManager=function(){return this.systemUtil.isWindows?new r.WindowsDeviceManager:this.systemUtil.isAndroid?new v.AndroidDeviceManager:this.systemUtil.isIos?new c.IosDeviceManager:this.systemUtil.isMacOS?new e.MacDeviceManager:this.systemUtil.isLinux?new a.LinuxDeviceManager:new s.BaseDeviceManager},t.isDeviceManagerError=i.DeviceError.isDeviceManagerError,t}();d.BrowserDeviceManager=o},603:(m,d,f)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.DeviceError=d.DeviceErrorDescription=d.DeviceErrorCode=void 0;var y=f(610);(function(s){s[s.ERROR_DEVICE_UNKNOWNERROR=1e4]="ERROR_DEVICE_UNKNOWNERROR",s[s.ERROR_DEVICE_AUDIODEVICE_NOTFOUND=10001]="ERROR_DEVICE_AUDIODEVICE_NOTFOUND",s[s.ERROR_DEVICE_VIDEODEVICE_NOTFOUND=10002]="ERROR_DEVICE_VIDEODEVICE_NOTFOUND",s[s.ERROR_DEVICE_NOTFOUND=10020]="ERROR_DEVICE_NOTFOUND",s[s.ERROR_DEVICE_AUDIODEVICE_NOTALLOWED=10003]="ERROR_DEVICE_AUDIODEVICE_NOTALLOWED",s[s.ERROR_DEVICE_VIDEODEVICE_NOTALLOWED=10004]="ERROR_DEVICE_VIDEODEVICE_NOTALLOWED",s[s.ERROR_DEVICE_NOTALLOWED=10021]="ERROR_DEVICE_NOTALLOWED",s[s.ERROR_DEVICE_AUDIODEVICE_NOTREADABLE=10005]="ERROR_DEVICE_AUDIODEVICE_NOTREADABLE",s[s.ERROR_DEVICE_VIDEODEVICE_NOTREADABLE=10006]="ERROR_DEVICE_VIDEODEVICE_NOTREADABLE",s[s.ERROR_DEVICE_NOTREADABLE=10022]="ERROR_DEVICE_NOTREADABLE",s[s.ERROR_DEIVCE_CONSTRAINEDERROR=10007]="ERROR_DEIVCE_CONSTRAINEDERROR",s[s.ERROR_SCREENSHARE_UNKNOWNERRO=10010]="ERROR_SCREENSHARE_UNKNOWNERRO",s[s.ERROR_SCREENSHARE_NOTALLOWED=10011]="ERROR_SCREENSHARE_NOTALLOWED",s[s.ERROR_SCREENSHARE_ENDED=10012]="ERROR_SCREENSHARE_ENDED",s[s.ERROR_SCREENSHARE_NOPERMISSION=10013]="ERROR_SCREENSHARE_NOPERMISSION",s[s.ERROR_SCREENSHARE_INVALIDACCESS=10014]="ERROR_SCREENSHARE_INVALIDACCESS",s[s.ERROR_SCREENSHARE_NOTSUPPORT=10018]="ERROR_SCREENSHARE_NOTSUPPORT",s[s.ERROR_DEVICE_NOTSUPPORT=10019]="ERROR_DEVICE_NOTSUPPORT"})(d.DeviceErrorCode||(d.DeviceErrorCode={})),function(s){s.ERRORMESSAGE_DEVICENOTFOUND="Requested device not found",s.ERRORMESSAGE_DEVICENOTALLOWED="Permission denied",s.ERRORMESSAGE_MACCHROME_DEVICENOTREADABLE="Permission denied by system",s.ERRORMESSAGE_MACSAFARI_DEVICENOTALLOWED="The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.",s.ERRORMESSAGE_MOBILEDEVICE_NOTALLOWED="video device not allowed",s.ERRORMESSAGE_AUDIODEVICENOTREADABLE="Could not start audio source",s.ERRORMESSAGE_VIDEODEVICENOTREADABLE="Could not start video source",s.ERRORNAME_DEVICENOTFOUND="NotFoundError",s.ERRORNAME_DEVICENOTALLOWED="NotAllowedError",s.ERRORNAME_DEVICENOTREADABLE="NotReadableError",s.ERRORNAME_DEVICEOVERCONSTRAINED="OverconstrainedError",s.ERRORNAME_INVALID_ACCESS="InvalidAccessError"}(d.DeviceErrorDescription||(d.DeviceErrorDescription={}));var v=function(){function s(c,a){this.linkUtil=new y.LinkUtil,this.code=c,this.reason=a,this.relatedLink=this.linkUtil.getRelatedLink(c)}return s.isDeviceManagerError=function(c){return!!(c&&typeof c=="object"&&"code"in c&&"reason"in c)},s}();d.DeviceError=v},873:(m,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.DeviceType=d.MobileCameraType=void 0,function(f){f[f.USER=0]="USER",f[f.ENV=1]="ENV"}(d.MobileCameraType||(d.MobileCameraType={})),function(f){f.Camera="videoinput",f.Mic="audioinput",f.Mixed="audiovideoinput",f.Screen="screen",f.Speaker="audiooutput"}(d.DeviceType||(d.DeviceType={}))},853:function(m,d,f){var y,v=this&&this.__extends||(y=function(c,a){return(y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])})(c,a)},function(c,a){function e(){this.constructor=c}y(c,a),c.prototype=a===null?Object.create(a):(e.prototype=a.prototype,new e)});Object.defineProperty(d,"__esModule",{value:!0}),d.AndroidDeviceManager=void 0;var s=function(c){function a(){return c.call(this)||this}return v(a,c),a}(f(583).MobileDeviceManager);d.AndroidDeviceManager=s},62:(m,d,f)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.BaseDeviceManager=void 0;var y=f(603),v=f(873),s=function(){function c(){}return c.prototype.checkSupportScreenShare=function(){return!!(navigator&&navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia&&navigator.mediaDevices.getDisplayMedia)},c.prototype.getCameraList=function(){var a=this;return new Promise(function(e,r){a.checkSupport()?a.getDeviceRight(v.DeviceType.Camera).then(function(){a.getDeviceList(v.DeviceType.Camera).then(function(i){e(i)}).catch(function(i){r(a.parseError(v.DeviceType.Camera,i))})}).catch(function(i){r(a.parseError(v.DeviceType.Camera,i))}):r(new y.DeviceError(y.DeviceErrorCode.ERROR_DEVICE_NOTSUPPORT,"not support navigator.mediaDevices"))})},c.prototype.getMicList=function(){var a=this;return new Promise(function(e,r){a.checkSupport()?a.getDeviceRight(v.DeviceType.Mic).then(function(){a.getDeviceList(v.DeviceType.Mic).then(function(i){e(i)}).catch(function(i){r(a.parseError(v.DeviceType.Mic,i))})}).catch(function(i){r(a.parseError(v.DeviceType.Mic,i))}):r(new y.DeviceError(y.DeviceErrorCode.ERROR_DEVICE_NOTSUPPORT,"not support navigator.mediaDevices"))})},c.prototype.getSpeakerList=function(){var a=this;return new Promise(function(e,r){a.checkSupport()?a.getDeviceRight(v.DeviceType.Speaker).then(function(){a.getDeviceList(v.DeviceType.Speaker).then(function(i){e(i)}).catch(function(i){r(a.parseError(v.DeviceType.Speaker,i))})}).catch(function(i){r(a.parseError(v.DeviceType.Speaker,i))}):r(new y.DeviceError(y.DeviceErrorCode.ERROR_DEVICE_NOTSUPPORT,"not support navigator.mediaDevices"))})},c.prototype.getAudioTrack=function(a){return this.getAudioStream(a).then(function(e){return e.getAudioTracks()[0]})},c.prototype.getAudioStream=function(a){var e=this;return new Promise(function(r,i){if(e.checkSupport()){var o=e.createAudioConstraints(a);navigator.mediaDevices.getUserMedia(o).then(function(t){r(t)}).catch(function(t){i(e.parseError(v.DeviceType.Mic,t))})}else i(new y.DeviceError(y.DeviceErrorCode.ERROR_DEVICE_NOTSUPPORT,"not support navigator.mediaDevices"))})},c.prototype.getVideoTrack=function(a){return this.getVideoStream(a).then(function(e){return e.getVideoTracks()[0]})},c.prototype.getVideoStream=function(a){var e=this;return new Promise(function(r,i){if(e.checkSupport()){var o=e.createVideoConstraints(a);navigator.mediaDevices.getUserMedia(o).then(function(t){r(t)}).catch(function(t){i(e.parseError(v.DeviceType.Camera,t))})}else i(new y.DeviceError(y.DeviceErrorCode.ERROR_DEVICE_NOTSUPPORT,"not support navigator.mediaDevices"))})},c.prototype.getAudioVideoTracks=function(a){return this.getMixedStream(a).then(function(e){return e.getTracks()})},c.prototype.getMixedStream=function(a){var e=this;return new Promise(function(r,i){if(e.checkSupport()){var o=e.createMixedConstraints(a);navigator.mediaDevices.getUserMedia(o).then(function(t){r(t)}).catch(function(t){i(e.parseError(v.DeviceType.Mixed,t))})}else i(new y.DeviceError(y.DeviceErrorCode.ERROR_DEVICE_NOTSUPPORT,"not support navigator.mediaDevices"))})},c.prototype.getScreenTrack=function(a){return this.getScreenStream(a).then(function(e){return e.getTracks()})},c.prototype.getScreenStream=function(a){var e=this;return new Promise(function(r,i){e.checkSupportScreenShare()?navigator.mediaDevices.getDisplayMedia(a).then(function(o){r(o)}).catch(function(o){i(e.parseError(v.DeviceType.Screen,o))}):i(new y.DeviceError(y.DeviceErrorCode.ERROR_SCREENSHARE_NOTSUPPORT,"browser not support screenshare"))})},c.prototype.checkSupport=function(){return!!(navigator&&navigator.mediaDevices&&navigator.mediaDevices.enumerateDevices&&navigator.mediaDevices.getUserMedia)},c.prototype.getDeviceList=function(a){return new Promise(function(e,r){navigator.mediaDevices.enumerateDevices().then(function(i){var o=[];i.forEach(function(t){t.kind===a&&o.push(t)}),e(o)}).catch(function(i){r(i)})})},c.prototype.getDeviceRight=function(a){return new Promise(function(e,r){var i;v.DeviceType.Camera===a?i={video:!0}:v.DeviceType.Mic!==a&&v.DeviceType.Speaker!==a||(i={audio:!0}),navigator.mediaDevices.getUserMedia(i).then(function(o){o.getTracks().forEach(function(t){t.stop()}),e(void 0)}).catch(function(o){e(void 0)})})},c.prototype.parseError=function(a,e){var r=null;return v.DeviceType.Mic===a?r=this.parseAudioError(e):v.DeviceType.Camera===a?r=this.parseVideoError(e):v.DeviceType.Mixed===a?r=this.parseMixedError(e):v.DeviceType.Screen===a&&(r=this.parseScreenError(e)),r===null?new y.DeviceError(y.DeviceErrorCode.ERROR_DEVICE_UNKNOWNERROR,""):r},c.prototype.parseAudioError=function(a){return a.message===y.DeviceErrorDescription.ERRORMESSAGE_DEVICENOTFOUND||a.name===y.DeviceErrorDescription.ERRORNAME_DEVICENOTFOUND?new y.DeviceError(y.DeviceErrorCode.ERROR_DEVICE_AUDIODEVICE_NOTFOUND,"audio device not found"):a.message===y.DeviceErrorDescription.ERRORMESSAGE_DEVICENOTALLOWED||a.message===y.DeviceErrorDescription.ERRORMESSAGE_MACSAFARI_DEVICENOTALLOWED?new y.DeviceError(y.DeviceErrorCode.ERROR_DEVICE_AUDIODEVICE_NOTALLOWED,"audio device not allowed"):a.message===y.DeviceErrorDescription.ERRORMESSAGE_MACCHROME_DEVICENOTREADABLE||a.message===y.DeviceErrorDescription.ERRORMESSAGE_AUDIODEVICENOTREADABLE||a.message===y.DeviceErrorDescription.ERRORNAME_DEVICENOTREADABLE?new y.DeviceError(y.DeviceErrorCode.ERROR_DEVICE_AUDIODEVICE_NOTREADABLE,"audio device not readable"):null},c.prototype.parseVideoError=function(a){return a.message===y.DeviceErrorDescription.ERRORMESSAGE_DEVICENOTFOUND||a.name===y.DeviceErrorDescription.ERRORNAME_DEVICENOTFOUND?new y.DeviceError(y.DeviceErrorCode.ERROR_DEVICE_VIDEODEVICE_NOTFOUND,"video device not found"):a.message===y.DeviceErrorDescription.ERRORMESSAGE_DEVICENOTALLOWED||a.message===y.DeviceErrorDescription.ERRORMESSAGE_MOBILEDEVICE_NOTALLOWED||a.message===y.DeviceErrorDescription.ERRORMESSAGE_MACSAFARI_DEVICENOTALLOWED?new y.DeviceError(y.DeviceErrorCode.ERROR_DEVICE_VIDEODEVICE_NOTALLOWED,"video device not allowed"):a.message===y.DeviceErrorDescription.ERRORMESSAGE_MACCHROME_DEVICENOTREADABLE||a.message===y.DeviceErrorDescription.ERRORMESSAGE_VIDEODEVICENOTREADABLE||a.name===y.DeviceErrorDescription.ERRORNAME_DEVICENOTREADABLE?new y.DeviceError(y.DeviceErrorCode.ERROR_DEVICE_VIDEODEVICE_NOTREADABLE,"video device not readable"):null},c.prototype.parseMixedError=function(a){return a.message===y.DeviceErrorDescription.ERRORMESSAGE_DEVICENOTFOUND||a.name===y.DeviceErrorDescription.ERRORNAME_DEVICENOTFOUND?new y.DeviceError(y.DeviceErrorCode.ERROR_DEVICE_NOTFOUND,"audio or video device not found"):a.message===y.DeviceErrorDescription.ERRORMESSAGE_DEVICENOTALLOWED||a.message===y.DeviceErrorDescription.ERRORMESSAGE_MACSAFARI_DEVICENOTALLOWED?new y.DeviceError(y.DeviceErrorCode.ERROR_DEVICE_NOTALLOWED,"audio or video device not allowed"):a.message===y.DeviceErrorDescription.ERRORMESSAGE_MOBILEDEVICE_NOTALLOWED?new y.DeviceError(y.DeviceErrorCode.ERROR_DEVICE_VIDEODEVICE_NOTALLOWED,"video device not allowed"):a.message===y.DeviceErrorDescription.ERRORMESSAGE_MACCHROME_DEVICENOTREADABLE||a.name===y.DeviceErrorDescription.ERRORNAME_DEVICENOTREADABLE?new y.DeviceError(y.DeviceErrorCode.ERROR_DEVICE_NOTREADABLE,"audio or video device not readable"):a.message===y.DeviceErrorDescription.ERRORMESSAGE_AUDIODEVICENOTREADABLE?new y.DeviceError(y.DeviceErrorCode.ERROR_DEVICE_AUDIODEVICE_NOTREADABLE,"audio device not readable"):a.message===y.DeviceErrorDescription.ERRORMESSAGE_VIDEODEVICENOTREADABLE?new y.DeviceError(y.DeviceErrorCode.ERROR_DEVICE_VIDEODEVICE_NOTREADABLE,"video device not readable"):null},c.prototype.parseScreenError=function(a){return a.name===y.DeviceErrorDescription.ERRORNAME_DEVICENOTALLOWED?a.message===y.DeviceErrorDescription.ERRORMESSAGE_DEVICENOTALLOWED?new y.DeviceError(y.DeviceErrorCode.ERROR_SCREENSHARE_NOTALLOWED,a.message):new y.DeviceError(y.DeviceErrorCode.ERROR_SCREENSHARE_NOPERMISSION,a.message):a.name===y.DeviceErrorDescription.ERRORNAME_INVALID_ACCESS?new y.DeviceError(y.DeviceErrorCode.ERROR_SCREENSHARE_INVALIDACCESS,a.message):null},c.prototype.createVideoConstraints=function(a){var e={video:a};return Object.keys(a).length===0&&(e={video:!0}),e},c.prototype.createAudioConstraints=function(a){var e={audio:a};return Object.keys(a).length===0&&(e={audio:!0}),e},c.prototype.createMixedConstraints=function(a){return a},c}();d.BaseDeviceManager=s},913:function(m,d,f){var y,v=this&&this.__extends||(y=function(c,a){return(y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])})(c,a)},function(c,a){function e(){this.constructor=c}y(c,a),c.prototype=a===null?Object.create(a):(e.prototype=a.prototype,new e)});Object.defineProperty(d,"__esModule",{value:!0}),d.IosDeviceManager=void 0;var s=function(c){function a(){return c.call(this)||this}return v(a,c),a}(f(583).MobileDeviceManager);d.IosDeviceManager=s},331:function(m,d,f){var y,v=this&&this.__extends||(y=function(c,a){return(y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])})(c,a)},function(c,a){function e(){this.constructor=c}y(c,a),c.prototype=a===null?Object.create(a):(e.prototype=a.prototype,new e)});Object.defineProperty(d,"__esModule",{value:!0}),d.LinuxDeviceManager=void 0;var s=function(c){function a(){return c.call(this)||this}return v(a,c),a}(f(62).BaseDeviceManager);d.LinuxDeviceManager=s},1:function(m,d,f){var y,v=this&&this.__extends||(y=function(c,a){return(y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])})(c,a)},function(c,a){function e(){this.constructor=c}y(c,a),c.prototype=a===null?Object.create(a):(e.prototype=a.prototype,new e)});Object.defineProperty(d,"__esModule",{value:!0}),d.MacDeviceManager=void 0;var s=function(c){function a(){return c.call(this)||this}return v(a,c),a}(f(62).BaseDeviceManager);d.MacDeviceManager=s},583:function(m,d,f){var y,v=this&&this.__extends||(y=function(a,e){return(y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(r[o]=i[o])})(a,e)},function(a,e){function r(){this.constructor=a}y(a,e),a.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(d,"__esModule",{value:!0}),d.MobileDeviceManager=void 0;var s=f(603),c=function(a){function e(){return a.call(this)||this}return v(e,a),e.prototype.checkSupportScreenShare=function(){return!1},e.prototype.getScreenTrack=function(r){return new Promise(function(i,o){o(new s.DeviceError(s.DeviceErrorCode.ERROR_SCREENSHARE_NOTSUPPORT,"mobile not support screenshare"))})},e.prototype.getScreenStream=function(r){return new Promise(function(i,o){o(new s.DeviceError(s.DeviceErrorCode.ERROR_SCREENSHARE_NOTSUPPORT,"mobile not support screenshare"))})},e}(f(62).BaseDeviceManager);d.MobileDeviceManager=c},935:function(m,d,f){var y,v=this&&this.__extends||(y=function(c,a){return(y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])})(c,a)},function(c,a){function e(){this.constructor=c}y(c,a),c.prototype=a===null?Object.create(a):(e.prototype=a.prototype,new e)});Object.defineProperty(d,"__esModule",{value:!0}),d.WindowsDeviceManager=void 0;var s=function(c){function a(){return c.call(this)||this}return v(a,c),a}(f(62).BaseDeviceManager);d.WindowsDeviceManager=s},607:function(m,d,f){var y=this&&this.__createBinding||(Object.create?function(c,a,e,r){r===void 0&&(r=e),Object.defineProperty(c,r,{enumerable:!0,get:function(){return a[e]}})}:function(c,a,e,r){r===void 0&&(r=e),c[r]=a[e]}),v=this&&this.__exportStar||function(c,a){for(var e in c)e==="default"||Object.prototype.hasOwnProperty.call(a,e)||y(a,c,e)};Object.defineProperty(d,"__esModule",{value:!0}),d.BrowserDeviceManager=void 0;var s=f(304);Object.defineProperty(d,"BrowserDeviceManager",{enumerable:!0,get:function(){return s.BrowserDeviceManager}}),v(f(873),d),window&&(window.BrowserDeviceManager=s.BrowserDeviceManager)},610:(m,d,f)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.LinkUtil=void 0;var y,v=f(603),s=f(261),c=f(54);(function(o){o[o.Windows=0]="Windows",o[o.MacOS=1]="MacOS",o[o.Other=2]="Other"})(y||(y={}));var a="ms-settings:",e="x-apple.systempreferences:com.apple.preference.security?",r={SYS_MIC:[a+"privacy-microphone",e+"Privacy_Microphone"],SYS_CAMERA:[a+"privacy-webcam",e+"Privacy_Camera"],SYS_SCREENSHARE:["",e+"Privacy_ScreenCapture"]},i=function(){function o(){s||console.error("SystemUtil is not found"),this.systemType=this.getSystemType()}return o.prototype.getRelatedLink=function(t){var n="",u=this.systemType;switch(t){case v.DeviceErrorCode.ERROR_DEVICE_AUDIODEVICE_NOTFOUND:case v.DeviceErrorCode.ERROR_DEVICE_AUDIODEVICE_NOTREADABLE:n=r.SYS_MIC[u];break;case v.DeviceErrorCode.ERROR_DEVICE_VIDEODEVICE_NOTFOUND:case v.DeviceErrorCode.ERROR_DEVICE_VIDEODEVICE_NOTREADABLE:n=r.SYS_CAMERA[u];break;case v.DeviceErrorCode.ERROR_SCREENSHARE_UNKNOWNERRO:case v.DeviceErrorCode.ERROR_SCREENSHARE_NOPERMISSION:n=r.SYS_SCREENSHARE[u];break;case v.DeviceErrorCode.ERROR_DEVICE_AUDIODEVICE_NOTALLOWED:case v.DeviceErrorCode.ERROR_DEVICE_VIDEODEVICE_NOTALLOWED:case v.DeviceErrorCode.ERROR_DEVICE_NOTALLOWED:c.isChrome?n=this.getChromeResetLink():c.isEdge&&(n=this.getEdgeResetLink());break;default:n=""}return n},o.prototype.getSystemType=function(){return s.isWindows?y.Windows:s.isMacOS?y.MacOS:y.Other},o.prototype.getChromeResetLink=function(){return"chrome://settings/content/siteDetails?site="+encodeURIComponent(window.location.origin)},o.prototype.getEdgeResetLink=function(){return"edge://settings/content/siteDetails?site="+encodeURIComponent(window.location.origin)},o}();d.LinkUtil=i},101:(m,d)=>{var f;Object.defineProperty(d,"__esModule",{value:!0}),d.SystemUtil=void 0,function(v){v[v.Unknown=0]="Unknown",v[v.MacOS=1]="MacOS",v[v.Windows=2]="Windows",v[v.Android=3]="Android",v[v.Iphone=4]="Iphone",v[v.Ipad=5]="Ipad",v[v.Linux=6]="Linux"}(f||(f={}));var y=function(){function v(){this.systemType=f.Unknown,this.getSystemInfo()}return Object.defineProperty(v.prototype,"isIos",{get:function(){return this.systemType===f.Ipad||this.systemType===f.Iphone},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"isAndroid",{get:function(){return this.systemType===f.Android},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"isMacOS",{get:function(){return this.systemType===f.MacOS},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"isWindows",{get:function(){return this.systemType===f.Windows},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"isLinux",{get:function(){return this.systemType===f.Linux},enumerable:!1,configurable:!0}),v.prototype.getSystemInfo=function(){if(navigator&&navigator.userAgent){var s=navigator.userAgent.toLocaleLowerCase();s.indexOf("ipad")>-1?this.systemType=f.Ipad:s.indexOf("iphone")>-1?this.systemType=f.Iphone:s.indexOf("android")>-1?this.systemType=f.Android:s.indexOf("win")>-1?this.systemType=f.Windows:s.indexOf("mac")>-1?this.systemType=f.MacOS:s.indexOf("linux")>-1?this.systemType=f.Linux:s.indexOf("")>-1&&(this.systemType=f.Unknown)}},v}();d.SystemUtil=y},54:m=>{m.exports=window.BrowserUtil},261:m=>{m.exports=window.SystemUtil}},_={};return function m(d){if(_[d])return _[d].exports;var f=_[d]={exports:{}};return T[d].call(f.exports,f,f.exports,m),f.exports}(607)})()},6677:(j,T,_)=>{var m=_(7963);function d(c,a,e,r,i){var o=m.writeRtpDescription(c.kind,a);if(o+=m.writeIceParameters(c.iceGatherer.getLocalParameters()),o+=m.writeDtlsParameters(c.dtlsTransport.getLocalParameters(),e==="offer"?"actpass":i||"active"),o+="a=mid:"+c.mid+`\r
80
- `,c.rtpSender&&c.rtpReceiver?o+=`a=sendrecv\r
81
- `:c.rtpSender?o+=`a=sendonly\r
82
- `:c.rtpReceiver?o+=`a=recvonly\r
83
- `:o+=`a=inactive\r
84
- `,c.rtpSender){var t=c.rtpSender._initialTrackId||c.rtpSender.track.id;c.rtpSender._initialTrackId=t;var n="msid:"+(r?r.id:"-")+" "+t+`\r
85
- `;o+="a="+n,o+="a=ssrc:"+c.sendEncodingParameters[0].ssrc+" "+n,c.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+c.sendEncodingParameters[0].rtx.ssrc+" "+n,o+="a=ssrc-group:FID "+c.sendEncodingParameters[0].ssrc+" "+c.sendEncodingParameters[0].rtx.ssrc+`\r
86
- `)}return o+="a=ssrc:"+c.sendEncodingParameters[0].ssrc+" cname:"+m.localCName+`\r
87
- `,c.rtpSender&&c.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+c.sendEncodingParameters[0].rtx.ssrc+" cname:"+m.localCName+`\r
88
- `),o}function f(c,a){var e={codecs:[],headerExtensions:[],fecMechanisms:[]},r=function(o,t){o=parseInt(o,10);for(var n=0;n<t.length;n++)if(t[n].payloadType===o||t[n].preferredPayloadType===o)return t[n]},i=function(o,t,n,u){var h=r(o.parameters.apt,n),S=r(t.parameters.apt,u);return h&&S&&h.name.toLowerCase()===S.name.toLowerCase()};return c.codecs.forEach(function(o){for(var t=0;t<a.codecs.length;t++){var n=a.codecs[t];if(o.name.toLowerCase()===n.name.toLowerCase()&&o.clockRate===n.clockRate){if(o.name.toLowerCase()==="rtx"&&o.parameters&&n.parameters.apt&&!i(o,n,c.codecs,a.codecs))continue;(n=JSON.parse(JSON.stringify(n))).numChannels=Math.min(o.numChannels,n.numChannels),e.codecs.push(n),n.rtcpFeedback=n.rtcpFeedback.filter(function(u){for(var h=0;h<o.rtcpFeedback.length;h++)if(o.rtcpFeedback[h].type===u.type&&o.rtcpFeedback[h].parameter===u.parameter)return!0;return!1});break}}}),c.headerExtensions.forEach(function(o){for(var t=0;t<a.headerExtensions.length;t++){var n=a.headerExtensions[t];if(o.uri===n.uri){e.headerExtensions.push(n);break}}}),e}function y(c,a,e){return{offer:{setLocalDescription:["stable","have-local-offer"],setRemoteDescription:["stable","have-remote-offer"]},answer:{setLocalDescription:["have-remote-offer","have-local-pranswer"],setRemoteDescription:["have-local-offer","have-remote-pranswer"]}}[a][c].indexOf(e)!==-1}function v(c,a){var e=c.getRemoteCandidates().find(function(r){return a.foundation===r.foundation&&a.ip===r.ip&&a.port===r.port&&a.priority===r.priority&&a.protocol===r.protocol&&a.type===r.type});return e||c.addRemoteCandidate(a),!e}function s(c,a){var e=new Error(a);return e.name=c,e.code={NotSupportedError:9,InvalidStateError:11,InvalidAccessError:15,TypeError:void 0,OperationError:void 0}[c],e}j.exports=function(c,a){function e(t,n){n.addTrack(t),n.dispatchEvent(new c.MediaStreamTrackEvent("addtrack",{track:t}))}function r(t,n,u,h){var S=new Event("track");S.track=n,S.receiver=u,S.transceiver={receiver:u},S.streams=h,c.setTimeout(function(){t._dispatchEvent("track",S)})}var i=function(t){var n=this,u=document.createDocumentFragment();if(["addEventListener","removeEventListener","dispatchEvent"].forEach(function(S){n[S]=u[S].bind(u)}),this.canTrickleIceCandidates=null,this.needNegotiation=!1,this.localStreams=[],this.remoteStreams=[],this._localDescription=null,this._remoteDescription=null,this.signalingState="stable",this.iceConnectionState="new",this.connectionState="new",this.iceGatheringState="new",t=JSON.parse(JSON.stringify(t||{})),this.usingBundle=t.bundlePolicy==="max-bundle",t.rtcpMuxPolicy==="negotiate")throw s("NotSupportedError","rtcpMuxPolicy 'negotiate' is not supported");switch(t.rtcpMuxPolicy||(t.rtcpMuxPolicy="require"),t.iceTransportPolicy){case"all":case"relay":break;default:t.iceTransportPolicy="all"}switch(t.bundlePolicy){case"balanced":case"max-compat":case"max-bundle":break;default:t.bundlePolicy="balanced"}if(t.iceServers=function(S,x){var E=!1;return(S=JSON.parse(JSON.stringify(S))).filter(function(p){if(p&&(p.urls||p.url)){var b=p.urls||p.url;p.url&&!p.urls&&console.warn("RTCIceServer.url is deprecated! Use urls instead.");var l=typeof b=="string";return l&&(b=[b]),b=b.filter(function(A){return A.indexOf("turn:")!==0||A.indexOf("transport=udp")===-1||A.indexOf("turn:[")!==-1||E?A.indexOf("stun:")===0&&x>=14393&&A.indexOf("?transport=udp")===-1:(E=!0,!0)}),delete p.url,p.urls=l?b[0]:b,!!b.length}})}(t.iceServers||[],a),this._iceGatherers=[],t.iceCandidatePoolSize)for(var h=t.iceCandidatePoolSize;h>0;h--)this._iceGatherers.push(new c.RTCIceGatherer({iceServers:t.iceServers,gatherPolicy:t.iceTransportPolicy}));else t.iceCandidatePoolSize=0;this._config=t,this.transceivers=[],this._sdpSessionId=m.generateSessionId(),this._sdpSessionVersion=0,this._dtlsRole=void 0,this._isClosed=!1};Object.defineProperty(i.prototype,"localDescription",{configurable:!0,get:function(){return this._localDescription}}),Object.defineProperty(i.prototype,"remoteDescription",{configurable:!0,get:function(){return this._remoteDescription}}),i.prototype.onicecandidate=null,i.prototype.onaddstream=null,i.prototype.ontrack=null,i.prototype.onremovestream=null,i.prototype.onsignalingstatechange=null,i.prototype.oniceconnectionstatechange=null,i.prototype.onconnectionstatechange=null,i.prototype.onicegatheringstatechange=null,i.prototype.onnegotiationneeded=null,i.prototype.ondatachannel=null,i.prototype._dispatchEvent=function(t,n){this._isClosed||(this.dispatchEvent(n),typeof this["on"+t]=="function"&&this["on"+t](n))},i.prototype._emitGatheringStateChange=function(){var t=new Event("icegatheringstatechange");this._dispatchEvent("icegatheringstatechange",t)},i.prototype.getConfiguration=function(){return this._config},i.prototype.getLocalStreams=function(){return this.localStreams},i.prototype.getRemoteStreams=function(){return this.remoteStreams},i.prototype._createTransceiver=function(t,n){var u=this.transceivers.length>0,h={track:null,iceGatherer:null,iceTransport:null,dtlsTransport:null,localCapabilities:null,remoteCapabilities:null,rtpSender:null,rtpReceiver:null,kind:t,mid:null,sendEncodingParameters:null,recvEncodingParameters:null,stream:null,associatedRemoteMediaStreams:[],wantReceive:!0};if(this.usingBundle&&u)h.iceTransport=this.transceivers[0].iceTransport,h.dtlsTransport=this.transceivers[0].dtlsTransport;else{var S=this._createIceAndDtlsTransports();h.iceTransport=S.iceTransport,h.dtlsTransport=S.dtlsTransport}return n||this.transceivers.push(h),h},i.prototype.addTrack=function(t,n){if(this._isClosed)throw s("InvalidStateError","Attempted to call addTrack on a closed peerconnection.");var u;if(this.transceivers.find(function(S){return S.track===t}))throw s("InvalidAccessError","Track already exists.");for(var h=0;h<this.transceivers.length;h++)this.transceivers[h].track||this.transceivers[h].kind!==t.kind||(u=this.transceivers[h]);return u||(u=this._createTransceiver(t.kind)),this._maybeFireNegotiationNeeded(),this.localStreams.indexOf(n)===-1&&this.localStreams.push(n),u.track=t,u.stream=n,u.rtpSender=new c.RTCRtpSender(t,u.dtlsTransport),u.rtpSender},i.prototype.addStream=function(t){var n=this;if(a>=15025)t.getTracks().forEach(function(h){n.addTrack(h,t)});else{var u=t.clone();t.getTracks().forEach(function(h,S){var x=u.getTracks()[S];h.addEventListener("enabled",function(E){x.enabled=E.enabled})}),u.getTracks().forEach(function(h){n.addTrack(h,u)})}},i.prototype.removeTrack=function(t){if(this._isClosed)throw s("InvalidStateError","Attempted to call removeTrack on a closed peerconnection.");if(!(t instanceof c.RTCRtpSender))throw new TypeError("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.");var n=this.transceivers.find(function(h){return h.rtpSender===t});if(!n)throw s("InvalidAccessError","Sender was not created by this connection.");var u=n.stream;n.rtpSender.stop(),n.rtpSender=null,n.track=null,n.stream=null,this.transceivers.map(function(h){return h.stream}).indexOf(u)===-1&&this.localStreams.indexOf(u)>-1&&this.localStreams.splice(this.localStreams.indexOf(u),1),this._maybeFireNegotiationNeeded()},i.prototype.removeStream=function(t){var n=this;t.getTracks().forEach(function(u){var h=n.getSenders().find(function(S){return S.track===u});h&&n.removeTrack(h)})},i.prototype.getSenders=function(){return this.transceivers.filter(function(t){return!!t.rtpSender}).map(function(t){return t.rtpSender})},i.prototype.getReceivers=function(){return this.transceivers.filter(function(t){return!!t.rtpReceiver}).map(function(t){return t.rtpReceiver})},i.prototype._createIceGatherer=function(t,n){var u=this;if(n&&t>0)return this.transceivers[0].iceGatherer;if(this._iceGatherers.length)return this._iceGatherers.shift();var h=new c.RTCIceGatherer({iceServers:this._config.iceServers,gatherPolicy:this._config.iceTransportPolicy});return Object.defineProperty(h,"state",{value:"new",writable:!0}),this.transceivers[t].bufferedCandidateEvents=[],this.transceivers[t].bufferCandidates=function(S){var x=!S.candidate||Object.keys(S.candidate).length===0;h.state=x?"completed":"gathering",u.transceivers[t].bufferedCandidateEvents!==null&&u.transceivers[t].bufferedCandidateEvents.push(S)},h.addEventListener("localcandidate",this.transceivers[t].bufferCandidates),h},i.prototype._gather=function(t,n){var u=this,h=this.transceivers[n].iceGatherer;if(!h.onlocalcandidate){var S=this.transceivers[n].bufferedCandidateEvents;this.transceivers[n].bufferedCandidateEvents=null,h.removeEventListener("localcandidate",this.transceivers[n].bufferCandidates),h.onlocalcandidate=function(x){if(!(u.usingBundle&&n>0)){var E=new Event("icecandidate");E.candidate={sdpMid:t,sdpMLineIndex:n};var p=x.candidate,b=!p||Object.keys(p).length===0;if(b)h.state!=="new"&&h.state!=="gathering"||(h.state="completed");else{h.state==="new"&&(h.state="gathering"),p.component=1,p.ufrag=h.getLocalParameters().usernameFragment;var l=m.writeCandidate(p);E.candidate=Object.assign(E.candidate,m.parseCandidate(l)),E.candidate.candidate=l,E.candidate.toJSON=function(){return{candidate:E.candidate.candidate,sdpMid:E.candidate.sdpMid,sdpMLineIndex:E.candidate.sdpMLineIndex,usernameFragment:E.candidate.usernameFragment}}}var A=m.getMediaSections(u._localDescription.sdp);A[E.candidate.sdpMLineIndex]+=b?`a=end-of-candidates\r
89
- `:"a="+E.candidate.candidate+`\r
90
- `,u._localDescription.sdp=m.getDescription(u._localDescription.sdp)+A.join("");var R=u.transceivers.every(function(C){return C.iceGatherer&&C.iceGatherer.state==="completed"});u.iceGatheringState!=="gathering"&&(u.iceGatheringState="gathering",u._emitGatheringStateChange()),b||u._dispatchEvent("icecandidate",E),R&&(u._dispatchEvent("icecandidate",new Event("icecandidate")),u.iceGatheringState="complete",u._emitGatheringStateChange())}},c.setTimeout(function(){S.forEach(function(x){h.onlocalcandidate(x)})},0)}},i.prototype._createIceAndDtlsTransports=function(){var t=this,n=new c.RTCIceTransport(null);n.onicestatechange=function(){t._updateIceConnectionState(),t._updateConnectionState()};var u=new c.RTCDtlsTransport(n);return u.ondtlsstatechange=function(){t._updateConnectionState()},u.onerror=function(){Object.defineProperty(u,"state",{value:"failed",writable:!0}),t._updateConnectionState()},{iceTransport:n,dtlsTransport:u}},i.prototype._disposeIceAndDtlsTransports=function(t){var n=this.transceivers[t].iceGatherer;n&&(delete n.onlocalcandidate,delete this.transceivers[t].iceGatherer);var u=this.transceivers[t].iceTransport;u&&(delete u.onicestatechange,delete this.transceivers[t].iceTransport);var h=this.transceivers[t].dtlsTransport;h&&(delete h.ondtlsstatechange,delete h.onerror,delete this.transceivers[t].dtlsTransport)},i.prototype._transceive=function(t,n,u){var h=f(t.localCapabilities,t.remoteCapabilities);n&&t.rtpSender&&(h.encodings=t.sendEncodingParameters,h.rtcp={cname:m.localCName,compound:t.rtcpParameters.compound},t.recvEncodingParameters.length&&(h.rtcp.ssrc=t.recvEncodingParameters[0].ssrc),t.rtpSender.send(h)),u&&t.rtpReceiver&&h.codecs.length>0&&(t.kind==="video"&&t.recvEncodingParameters&&a<15019&&t.recvEncodingParameters.forEach(function(S){delete S.rtx}),t.recvEncodingParameters.length?h.encodings=t.recvEncodingParameters:h.encodings=[{}],h.rtcp={compound:t.rtcpParameters.compound},t.rtcpParameters.cname&&(h.rtcp.cname=t.rtcpParameters.cname),t.sendEncodingParameters.length&&(h.rtcp.ssrc=t.sendEncodingParameters[0].ssrc),t.rtpReceiver.receive(h))},i.prototype.setLocalDescription=function(t){var n,u,h=this;if(["offer","answer"].indexOf(t.type)===-1)return Promise.reject(s("TypeError",'Unsupported type "'+t.type+'"'));if(!y("setLocalDescription",t.type,h.signalingState)||h._isClosed)return Promise.reject(s("InvalidStateError","Can not set local "+t.type+" in state "+h.signalingState));if(t.type==="offer")n=m.splitSections(t.sdp),u=n.shift(),n.forEach(function(x,E){var p=m.parseRtpParameters(x);h.transceivers[E].localCapabilities=p}),h.transceivers.forEach(function(x,E){h._gather(x.mid,E)});else if(t.type==="answer"){n=m.splitSections(h._remoteDescription.sdp),u=n.shift();var S=m.matchPrefix(u,"a=ice-lite").length>0;n.forEach(function(x,E){var p=h.transceivers[E],b=p.iceGatherer,l=p.iceTransport,A=p.dtlsTransport,R=p.localCapabilities,C=p.remoteCapabilities;if(!(m.isRejected(x)&&m.matchPrefix(x,"a=bundle-only").length===0)&&!p.rejected){var g=m.getIceParameters(x,u),D=m.getDtlsParameters(x,u);S&&(D.role="server"),h.usingBundle&&E!==0||(h._gather(p.mid,E),l.state==="new"&&l.start(b,g,S?"controlling":"controlled"),A.state==="new"&&A.start(D));var O=f(R,C);h._transceive(p,O.codecs.length>0,!1)}})}return h._localDescription={type:t.type,sdp:t.sdp},t.type==="offer"?h._updateSignalingState("have-local-offer"):h._updateSignalingState("stable"),Promise.resolve()},i.prototype.setRemoteDescription=function(t){var n=this;if(["offer","answer"].indexOf(t.type)===-1)return Promise.reject(s("TypeError",'Unsupported type "'+t.type+'"'));if(!y("setRemoteDescription",t.type,n.signalingState)||n._isClosed)return Promise.reject(s("InvalidStateError","Can not set remote "+t.type+" in state "+n.signalingState));var u={};n.remoteStreams.forEach(function(l){u[l.id]=l});var h=[],S=m.splitSections(t.sdp),x=S.shift(),E=m.matchPrefix(x,"a=ice-lite").length>0,p=m.matchPrefix(x,"a=group:BUNDLE ").length>0;n.usingBundle=p;var b=m.matchPrefix(x,"a=ice-options:")[0];return n.canTrickleIceCandidates=!!b&&b.substr(14).split(" ").indexOf("trickle")>=0,S.forEach(function(l,A){var R=m.splitLines(l),C=m.getKind(l),g=m.isRejected(l)&&m.matchPrefix(l,"a=bundle-only").length===0,D=R[0].substr(2).split(" ")[2],O=m.getDirection(l,x),U=m.parseMsid(l),k=m.getMid(l)||m.generateIdentifier();if(g||C==="application"&&(D==="DTLS/SCTP"||D==="UDP/DTLS/SCTP"))n.transceivers[A]={mid:k,kind:C,protocol:D,rejected:!0};else{var w,N,H,F,P,B,W,z,G;!g&&n.transceivers[A]&&n.transceivers[A].rejected&&(n.transceivers[A]=n._createTransceiver(C,!0));var J,re,te=m.parseRtpParameters(l);g||(J=m.getIceParameters(l,x),(re=m.getDtlsParameters(l,x)).role="client"),W=m.parseRtpEncodingParameters(l);var ie=m.parseRtcpParameters(l),ce=m.matchPrefix(l,"a=end-of-candidates",x).length>0,se=m.matchPrefix(l,"a=candidate:").map(function(de){return m.parseCandidate(de)}).filter(function(de){return de.component===1});if((t.type==="offer"||t.type==="answer")&&!g&&p&&A>0&&n.transceivers[A]&&(n._disposeIceAndDtlsTransports(A),n.transceivers[A].iceGatherer=n.transceivers[0].iceGatherer,n.transceivers[A].iceTransport=n.transceivers[0].iceTransport,n.transceivers[A].dtlsTransport=n.transceivers[0].dtlsTransport,n.transceivers[A].rtpSender&&n.transceivers[A].rtpSender.setTransport(n.transceivers[0].dtlsTransport),n.transceivers[A].rtpReceiver&&n.transceivers[A].rtpReceiver.setTransport(n.transceivers[0].dtlsTransport)),t.type!=="offer"||g)t.type==="answer"&&!g&&(N=(w=n.transceivers[A]).iceGatherer,H=w.iceTransport,F=w.dtlsTransport,P=w.rtpReceiver,B=w.sendEncodingParameters,z=w.localCapabilities,n.transceivers[A].recvEncodingParameters=W,n.transceivers[A].remoteCapabilities=te,n.transceivers[A].rtcpParameters=ie,se.length&&H.state==="new"&&(!E&&!ce||p&&A!==0?se.forEach(function(de){v(w.iceTransport,de)}):H.setRemoteCandidates(se)),p&&A!==0||(H.state==="new"&&H.start(N,J,"controlling"),F.state==="new"&&F.start(re)),!f(w.localCapabilities,w.remoteCapabilities).codecs.filter(function(de){return de.name.toLowerCase()==="rtx"}).length&&w.sendEncodingParameters[0].rtx&&delete w.sendEncodingParameters[0].rtx,n._transceive(w,O==="sendrecv"||O==="recvonly",O==="sendrecv"||O==="sendonly"),!P||O!=="sendrecv"&&O!=="sendonly"?delete w.rtpReceiver:(G=P.track,U?(u[U.stream]||(u[U.stream]=new c.MediaStream),e(G,u[U.stream]),h.push([G,P,u[U.stream]])):(u.default||(u.default=new c.MediaStream),e(G,u.default),h.push([G,P,u.default]))));else{(w=n.transceivers[A]||n._createTransceiver(C)).mid=k,w.iceGatherer||(w.iceGatherer=n._createIceGatherer(A,p)),se.length&&w.iceTransport.state==="new"&&(!ce||p&&A!==0?se.forEach(function(de){v(w.iceTransport,de)}):w.iceTransport.setRemoteCandidates(se)),z=c.RTCRtpReceiver.getCapabilities(C),a<15019&&(z.codecs=z.codecs.filter(function(de){return de.name!=="rtx"})),B=w.sendEncodingParameters||[{ssrc:1001*(2*A+2)}];var ue,pe=!1;O==="sendrecv"||O==="sendonly"?(pe=!w.rtpReceiver,P=w.rtpReceiver||new c.RTCRtpReceiver(w.dtlsTransport,C),pe&&(G=P.track,U&&U.stream==="-"||(U?(u[U.stream]||(u[U.stream]=new c.MediaStream,Object.defineProperty(u[U.stream],"id",{get:function(){return U.stream}})),Object.defineProperty(G,"id",{get:function(){return U.track}}),ue=u[U.stream]):(u.default||(u.default=new c.MediaStream),ue=u.default)),ue&&(e(G,ue),w.associatedRemoteMediaStreams.push(ue)),h.push([G,P,ue]))):w.rtpReceiver&&w.rtpReceiver.track&&(w.associatedRemoteMediaStreams.forEach(function(de){var ve=de.getTracks().find(function(Ee){return Ee.id===w.rtpReceiver.track.id});ve&&function(Ee,fe){fe.removeTrack(Ee),fe.dispatchEvent(new c.MediaStreamTrackEvent("removetrack",{track:Ee}))}(ve,de)}),w.associatedRemoteMediaStreams=[]),w.localCapabilities=z,w.remoteCapabilities=te,w.rtpReceiver=P,w.rtcpParameters=ie,w.sendEncodingParameters=B,w.recvEncodingParameters=W,n._transceive(n.transceivers[A],!1,pe)}}}),n._dtlsRole===void 0&&(n._dtlsRole=t.type==="offer"?"active":"passive"),n._remoteDescription={type:t.type,sdp:t.sdp},t.type==="offer"?n._updateSignalingState("have-remote-offer"):n._updateSignalingState("stable"),Object.keys(u).forEach(function(l){var A=u[l];if(A.getTracks().length){if(n.remoteStreams.indexOf(A)===-1){n.remoteStreams.push(A);var R=new Event("addstream");R.stream=A,c.setTimeout(function(){n._dispatchEvent("addstream",R)})}h.forEach(function(C){var g=C[0],D=C[1];A.id===C[2].id&&r(n,g,D,[A])})}}),h.forEach(function(l){l[2]||r(n,l[0],l[1],[])}),c.setTimeout(function(){n&&n.transceivers&&n.transceivers.forEach(function(l){l.iceTransport&&l.iceTransport.state==="new"&&l.iceTransport.getRemoteCandidates().length>0&&(console.warn("Timeout for addRemoteCandidate. Consider sending an end-of-candidates notification"),l.iceTransport.addRemoteCandidate({}))})},4e3),Promise.resolve()},i.prototype.close=function(){this.transceivers.forEach(function(t){t.iceTransport&&t.iceTransport.stop(),t.dtlsTransport&&t.dtlsTransport.stop(),t.rtpSender&&t.rtpSender.stop(),t.rtpReceiver&&t.rtpReceiver.stop()}),this._isClosed=!0,this._updateSignalingState("closed")},i.prototype._updateSignalingState=function(t){this.signalingState=t;var n=new Event("signalingstatechange");this._dispatchEvent("signalingstatechange",n)},i.prototype._maybeFireNegotiationNeeded=function(){var t=this;this.signalingState==="stable"&&this.needNegotiation!==!0&&(this.needNegotiation=!0,c.setTimeout(function(){if(t.needNegotiation){t.needNegotiation=!1;var n=new Event("negotiationneeded");t._dispatchEvent("negotiationneeded",n)}},0))},i.prototype._updateIceConnectionState=function(){var t,n={new:0,closed:0,checking:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach(function(h){h.iceTransport&&!h.rejected&&n[h.iceTransport.state]++}),t="new",n.failed>0?t="failed":n.checking>0?t="checking":n.disconnected>0?t="disconnected":n.new>0?t="new":n.connected>0?t="connected":n.completed>0&&(t="completed"),t!==this.iceConnectionState){this.iceConnectionState=t;var u=new Event("iceconnectionstatechange");this._dispatchEvent("iceconnectionstatechange",u)}},i.prototype._updateConnectionState=function(){var t,n={new:0,closed:0,connecting:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach(function(h){h.iceTransport&&h.dtlsTransport&&!h.rejected&&(n[h.iceTransport.state]++,n[h.dtlsTransport.state]++)}),n.connected+=n.completed,t="new",n.failed>0?t="failed":n.connecting>0?t="connecting":n.disconnected>0?t="disconnected":n.new>0?t="new":n.connected>0&&(t="connected"),t!==this.connectionState){this.connectionState=t;var u=new Event("connectionstatechange");this._dispatchEvent("connectionstatechange",u)}},i.prototype.createOffer=function(){var t=this;if(t._isClosed)return Promise.reject(s("InvalidStateError","Can not call createOffer after close"));var n=t.transceivers.filter(function(E){return E.kind==="audio"}).length,u=t.transceivers.filter(function(E){return E.kind==="video"}).length,h=arguments[0];if(h){if(h.mandatory||h.optional)throw new TypeError("Legacy mandatory/optional constraints not supported.");h.offerToReceiveAudio!==void 0&&(n=h.offerToReceiveAudio===!0?1:h.offerToReceiveAudio===!1?0:h.offerToReceiveAudio),h.offerToReceiveVideo!==void 0&&(u=h.offerToReceiveVideo===!0?1:h.offerToReceiveVideo===!1?0:h.offerToReceiveVideo)}for(t.transceivers.forEach(function(E){E.kind==="audio"?--n<0&&(E.wantReceive=!1):E.kind==="video"&&--u<0&&(E.wantReceive=!1)});n>0||u>0;)n>0&&(t._createTransceiver("audio"),n--),u>0&&(t._createTransceiver("video"),u--);var S=m.writeSessionBoilerplate(t._sdpSessionId,t._sdpSessionVersion++);t.transceivers.forEach(function(E,p){var b=E.track,l=E.kind,A=E.mid||m.generateIdentifier();E.mid=A,E.iceGatherer||(E.iceGatherer=t._createIceGatherer(p,t.usingBundle));var R=c.RTCRtpSender.getCapabilities(l);a<15019&&(R.codecs=R.codecs.filter(function(g){return g.name!=="rtx"})),R.codecs.forEach(function(g){g.name==="H264"&&g.parameters["level-asymmetry-allowed"]===void 0&&(g.parameters["level-asymmetry-allowed"]="1"),E.remoteCapabilities&&E.remoteCapabilities.codecs&&E.remoteCapabilities.codecs.forEach(function(D){g.name.toLowerCase()===D.name.toLowerCase()&&g.clockRate===D.clockRate&&(g.preferredPayloadType=D.payloadType)})}),R.headerExtensions.forEach(function(g){(E.remoteCapabilities&&E.remoteCapabilities.headerExtensions||[]).forEach(function(D){g.uri===D.uri&&(g.id=D.id)})});var C=E.sendEncodingParameters||[{ssrc:1001*(2*p+1)}];b&&a>=15019&&l==="video"&&!C[0].rtx&&(C[0].rtx={ssrc:C[0].ssrc+1}),E.wantReceive&&(E.rtpReceiver=new c.RTCRtpReceiver(E.dtlsTransport,l)),E.localCapabilities=R,E.sendEncodingParameters=C}),t._config.bundlePolicy!=="max-compat"&&(S+="a=group:BUNDLE "+t.transceivers.map(function(E){return E.mid}).join(" ")+`\r
91
- `),S+=`a=ice-options:trickle\r
92
- `,t.transceivers.forEach(function(E,p){S+=d(E,E.localCapabilities,"offer",E.stream,t._dtlsRole),S+=`a=rtcp-rsize\r
93
- `,!E.iceGatherer||t.iceGatheringState==="new"||p!==0&&t.usingBundle||(E.iceGatherer.getLocalCandidates().forEach(function(b){b.component=1,S+="a="+m.writeCandidate(b)+`\r
94
- `}),E.iceGatherer.state==="completed"&&(S+=`a=end-of-candidates\r
95
- `))});var x=new c.RTCSessionDescription({type:"offer",sdp:S});return Promise.resolve(x)},i.prototype.createAnswer=function(){var t=this;if(t._isClosed)return Promise.reject(s("InvalidStateError","Can not call createAnswer after close"));if(t.signalingState!=="have-remote-offer"&&t.signalingState!=="have-local-pranswer")return Promise.reject(s("InvalidStateError","Can not call createAnswer in signalingState "+t.signalingState));var n=m.writeSessionBoilerplate(t._sdpSessionId,t._sdpSessionVersion++);t.usingBundle&&(n+="a=group:BUNDLE "+t.transceivers.map(function(S){return S.mid}).join(" ")+`\r
74
+ a=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time`),y=`
75
+ a=ssrc:`.concat(C,` cname:defaultcname
76
+ a=ssrc:`).concat(C," msid:").concat(x,`
77
+ a=ssrc:`).concat(C,` mslabel:rts
78
+ a=ssrc:`).concat(C," label:audio"),r.direction==="sub"&&(a+=y),a+=t)}),a}},237:(h,v,u)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.UrlData=void 0;var s=u(887),i=function(){function e(o){var r=(0,s.parseUrlSubParams)(o.url);this.data={url:o.url,subAudio:r.subAudio,subVideo:r.subVideo},typeof o.subAudio=="boolean"&&(this.data.subAudio=o.subAudio),typeof o.subVideo=="boolean"&&(this.data.subVideo=o.subVideo)}return Object.defineProperty(e.prototype,"subVideo",{get:function(){return this.data.subVideo},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subAudio",{get:function(){return this.data.subAudio},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"url",{get:function(){return(0,s.pruneSubUrl)(this.data.url)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"originalUrl",{get:function(){return this.data.url},enumerable:!1,configurable:!0}),e}();v.UrlData=i},123:function(h,v,u){var s,i=this&&this.__extends||(s=function(c,p){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(C,x){C.__proto__=x}||function(C,x){for(var y in x)Object.prototype.hasOwnProperty.call(x,y)&&(C[y]=x[y])},s(c,p)},function(c,p){if(typeof p!="function"&&p!==null)throw new TypeError("Class extends value "+String(p)+" is not a constructor or null");function C(){this.constructor=c}s(c,p),c.prototype=p===null?Object.create(p):(C.prototype=p.prototype,new C)}),e=this&&this.__spreadArray||function(c,p,C){if(C||arguments.length===2)for(var x,y=0,E=p.length;y<E;y++)!x&&y in p||(x||(x=Array.prototype.slice.call(p,0,y)),x[y]=p[y]);return c.concat(x||Array.prototype.slice.call(p))},o=this&&this.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(v,"__esModule",{value:!0});var r=o(u(885)),a=u(973),t=[a.EDatachannelSignalResCode.NGX_RTC_STREAM_NO_FOUND,a.EDatachannelSignalResCode.NGX_RTC_DATACHANNEL_HEBT_MSID_NOT_FOUND],n=function(c){function p(C,x){var y=c.call(this)||this;return y.datachannel=C,y.streamManager=x,y}return i(p,c),p.prototype.process=function(C){var x=this,y=this.parseFormat(C);if(y){var E=this.checkRecode(y),S=E.valid,d=E.error,R=E.reason;if(!S)return y.recode===3?void this.emit("datachannelNotEnabled"):void(d&&this.emit("pcReconnect",{recode:y.recode,reMsg:R}));this.emit("hebtReceived",y),this.checkStreams(y).forEach(function(D){var A={resCode:D.resCode,resMsg:D.resMsg,url:D.url,msids:D.msids,streams:D.streams,type:D.type,latestUrl:D.latestUrl};D.isReconnectable?x.emit("streamReconnect",A):x.emit("streamError",A)})}},p.prototype.parseFormat=function(C){try{return JSON.parse(C)}catch{console.log("Heartbeat parse failed."," Response Data: ",C)}},p.prototype.checkRecode=function(C){var x={valid:!1,error:!1,reason:""};return C.type!==a.EMessageType.HEBT?(x.reason="not heartbeat signal, ignore",x):C.recode!==0?(x.reason=C.msg,x.error=!0,x):(x.valid=!0,x)},p.prototype.checkStreams=function(C){var x=this,y=[];return C.streams&&C.streams.length&&e(e([],this.streamManager.getAllStreamListWithMsids(),!0),this.streamManager.getAllDatachannelList(),!0).forEach(function(E){var S,d=-1;if(C.streams.find(function(b,g){if(b.url===E.url)return d=g,!0})&&d!==-1){var R=C.streams[d];if(R.method===a.EMessageType.HEBT&&R.res_code===200){R.traceid&&x.emit("traceIdUpdate",{url:R.url,traceId:R.traceid});var D=[];E.msids.forEach(function(b){R.msid.find(function(g){return g.name===b.name})||D.push(b)});var A=(S=E.streams)===null||S===void 0?void 0:S.filter(function(b){return!!D.find(function(g){return g.streamId===b.id})});D.length&&y.push({url:E.url,msids:D,streams:A,isReconnectable:!0,resMsg:"RTS heartbeat msid mismatch",resCode:404,type:E.type,latestUrl:E.latestUrl})}else y.push({url:E.url,msids:E.msids,streams:E.streams,isReconnectable:x.isReconnectableErrorCode(R.res_code),resMsg:R.res_msg,resCode:R.res_code,type:E.type,latestUrl:E.latestUrl})}}),y},p.prototype.isReconnectableErrorCode=function(C){return t.includes(C)},p}(r.default);v.default=n},619:function(h,v,u){var s=this&&this.__assign||function(){return s=Object.assign||function(C){for(var x,y=1,E=arguments.length;y<E;y++)for(var S in x=arguments[y])Object.prototype.hasOwnProperty.call(x,S)&&(C[S]=x[S]);return C},s.apply(this,arguments)},i=this&&this.__awaiter||function(C,x,y,E){return new(y||(y=Promise))(function(S,d){function R(b){try{A(E.next(b))}catch(g){d(g)}}function D(b){try{A(E.throw(b))}catch(g){d(g)}}function A(b){var g;b.done?S(b.value):(g=b.value,g instanceof y?g:new y(function(O){O(g)})).then(R,D)}A((E=E.apply(C,x||[])).next())})},e=this&&this.__generator||function(C,x){var y,E,S,d,R={label:0,sent:function(){if(1&S[0])throw S[1];return S[1]},trys:[],ops:[]};return d={next:D(0),throw:D(1),return:D(2)},typeof Symbol=="function"&&(d[Symbol.iterator]=function(){return this}),d;function D(A){return function(b){return function(g){if(y)throw new TypeError("Generator is already executing.");for(;d&&(d=0,g[0]&&(R=0)),R;)try{if(y=1,E&&(S=2&g[0]?E.return:g[0]?E.throw||((S=E.return)&&S.call(E),0):E.next)&&!(S=S.call(E,g[1])).done)return S;switch(E=0,S&&(g=[2&g[0],S.value]),g[0]){case 0:case 1:S=g;break;case 4:return R.label++,{value:g[1],done:!1};case 5:R.label++,E=g[1],g=[0];continue;case 7:g=R.ops.pop(),R.trys.pop();continue;default:if(!((S=(S=R.trys).length>0&&S[S.length-1])||g[0]!==6&&g[0]!==2)){R=0;continue}if(g[0]===3&&(!S||g[1]>S[0]&&g[1]<S[3])){R.label=g[1];break}if(g[0]===6&&R.label<S[1]){R.label=S[1],S=g;break}if(S&&R.label<S[2]){R.label=S[2],R.ops.push(g);break}S[2]&&R.ops.pop(),R.trys.pop();continue}g=x.call(C,R)}catch(O){g=[6,O],E=0}finally{y=S=0}if(5&g[0])throw g[1];return{value:g[0]?g[1]:void 0,done:!0}}([A,b])}}},o=this&&this.__spreadArray||function(C,x,y){if(y||arguments.length===2)for(var E,S=0,d=x.length;S<d;S++)!E&&S in x||(E||(E=Array.prototype.slice.call(x,0,S)),E[S]=x[S]);return C.concat(E||Array.prototype.slice.call(x))};Object.defineProperty(v,"__esModule",{value:!0}),v.Signal=void 0;var r,a,t,n=u(651),c=u(887);(function(C){C.Sub="sub",C.Pub="pub",C.Hebt="hebt"})(r||(r={})),function(C){C.Add="add",C.Active="active",C.Stop="stop",C.Delete="delete",C.Hebt="hebt"}(a||(a={})),function(C){C.Audio="audio",C.Video="video",C.Data="data"}(t||(t={}));var p=function(){function C(x){this.latestMsgId=0,this.latestSubAddMsgId=0,this.pc=x.pc,this.datachannel=new n.DataChannelCore({pc:this.pc,onDatachannelEvent:x.onDatachannelEvent,delayOpen:x.delayOpen})}return C.prototype.getDatachannelCore=function(){return this.datachannel},C.prototype.subscribeAdd=function(x,y,E){var S;return i(this,void 0,void 0,function(){var d;return e(this,function(R){switch(R.label){case 0:return d=s(s({},this.baseParams({type:r.Sub,method:a.Add})),{streams:x.map(function(D,A){var b=D.urlData,g=[];return b.subAudio&&!E.isMsidSubPubDone(b.url,{aMsid:D.aMsid[0]})&&g.push({type:t.Audio,name:D.aMsid[0]}),b.subVideo&&!E.isMsidSubPubDone(b.url,{vMsid:D.vMsid[0]})&&g.push({type:t.Video,name:D.vMsid[0]}),{method:a.Add,url:b.url,msid:g,sdp:y[A],ttl:300}})}),[4,(S=this.datachannel)===null||S===void 0?void 0:S.sendData(d)];case 1:return[2,R.sent()]}})})},C.prototype.subscribeActive=function(x){var y;return i(this,void 0,void 0,function(){var E;return e(this,function(S){switch(S.label){case 0:return E=s(s({},this.baseParams({type:r.Sub,method:a.Active})),{streams:x.map(function(d){var R=d.urlData;return{method:a.Active,url:R.url}})}),[4,(y=this.datachannel)===null||y===void 0?void 0:y.sendData(E)];case 1:return S.sent(),[2]}})})},C.prototype.subscribeDelete=function(x){var y;return i(this,void 0,void 0,function(){var E;return e(this,function(S){switch(S.label){case 0:return E=s(s({},this.baseParams()),{streams:x.map(function(d){var R=d.url,D=d.aMsid,A=d.vMsid,b=[];return D?.length&&(b=o(o([],b,!0),D.map(function(g){return{name:g}}),!0)),A?.length&&(b=o(o([],b,!0),A.map(function(g){return{name:g}}),!0)),{method:a.Delete,url:(0,c.pruneSubUrl)(R),msid:b}})}),[4,(y=this.datachannel)===null||y===void 0?void 0:y.sendData(E)];case 1:return[2,S.sent()]}})})},C.prototype.subscribeStop=function(x){var y;return i(this,void 0,void 0,function(){var E;return e(this,function(S){switch(S.label){case 0:return E=s(s({},this.baseParams()),{streams:x.map(function(d){var R=d.urlData;return{method:a.Stop,url:R.url}})}),[4,(y=this.datachannel)===null||y===void 0?void 0:y.sendData(E)];case 1:return[2,S.sent()]}})})},C.prototype.subscribeAddDatachannel=function(x){var y;return i(this,void 0,void 0,function(){var E;return e(this,function(S){switch(S.label){case 0:return E=s(s({},this.baseParams({type:r.Sub,method:a.Add})),{streams:x.map(function(d){var R=d.url,D=d.msid;return{method:a.Add,url:R,msid:[{type:t.Data,name:D}]}})}),[4,(y=this.datachannel)===null||y===void 0?void 0:y.sendData(E)];case 1:return[2,S.sent()]}})})},C.prototype.subscribeActiveDatachannel=function(x){var y;return i(this,void 0,void 0,function(){var E;return e(this,function(S){switch(S.label){case 0:return E=s(s({},this.baseParams({type:r.Sub,method:a.Active})),{streams:x.map(function(d){var R=d.url,D=d.datachannelId,A=d.msid;return{method:a.Active,url:R,msid:[{type:t.Data,name:A,channel:D}]}})}),[4,(y=this.datachannel)===null||y===void 0?void 0:y.sendData(E)];case 1:return[2,S.sent()]}})})},C.prototype.subscribeStopDatachannel=function(x){var y;return i(this,void 0,void 0,function(){var E;return e(this,function(S){switch(S.label){case 0:return E=s(s({},this.baseParams()),{streams:x.map(function(d){var R=d.url;return{method:a.Stop,url:R}})}),[4,(y=this.datachannel)===null||y===void 0?void 0:y.sendData(E)];case 1:return[2,S.sent()]}})})},C.prototype.publishAdd=function(x,y,E,S){var d;return i(this,void 0,void 0,function(){var R;return e(this,function(D){return R=s(s({},this.baseParams({type:r.Pub})),{streams:x.map(function(A,b){var g=E[b],O=S[b],k=[];return g.length&&k.push({type:"video",name:g[0].trim()}),O.length&&k.push({type:"audio",name:O[0].trim()}),{method:a.Add,url:A,msid:k,sdp:y[b]}})}),[2,(d=this.datachannel)===null||d===void 0?void 0:d.sendData(R)]})})},C.prototype.publishDelete=function(x){var y;return i(this,void 0,void 0,function(){var E;return e(this,function(S){return E=s(s({},this.baseParams({type:r.Pub})),{streams:x.map(function(d){var R=d.url,D=d.aMsid,A=d.vMsid,b=[];return D?.length&&(b=o(o([],b,!0),D.map(function(g){return{name:g}}),!0)),A?.length&&(b=o(o([],b,!0),A.map(function(g){return{name:g}}),!0)),{method:a.Delete,url:(0,c.pruneSubUrl)(R),msid:b}})}),[2,(y=this.datachannel)===null||y===void 0?void 0:y.sendData(E)]})})},C.prototype.publishStop=function(x){var y;return i(this,void 0,void 0,function(){var E;return e(this,function(S){return E=s(s({},this.baseParams({type:r.Pub})),{streams:x.map(function(d){return{method:a.Stop,url:d}})}),[2,(y=this.datachannel)===null||y===void 0?void 0:y.sendData(E)]})})},C.prototype.publishAddDatachannel=function(x){var y;return i(this,void 0,void 0,function(){var E;return e(this,function(S){switch(S.label){case 0:return E=s(s({},this.baseParams({type:r.Pub,method:a.Add})),{streams:x.map(function(d){var R=d.url,D=d.datachannelId,A=d.msid;return{method:a.Add,url:R,msid:[{type:t.Data,name:A,channel:D}]}})}),[4,(y=this.datachannel)===null||y===void 0?void 0:y.sendData(E)];case 1:return[2,S.sent()]}})})},C.prototype.publishStopDatachannel=function(x){var y;return i(this,void 0,void 0,function(){var E;return e(this,function(S){switch(S.label){case 0:return E=s(s({},this.baseParams({type:r.Pub})),{streams:x.map(function(d){var R=d.url;return{method:a.Stop,url:R}})}),[4,(y=this.datachannel)===null||y===void 0?void 0:y.sendData(E)];case 1:return[2,S.sent()]}})})},C.prototype.sendHeartbeat=function(x){x&&!x.map&&(x=void 0);var y=s(s({},this.baseParams({type:r.Hebt})),{streams:x?.map(function(E){var S=E.url;return{method:a.Hebt,url:S}})});if(x||delete y.streams,this.datachannel.sendAsync(y))return y},C.prototype.sendFalseHeartbeat=function(x){var y=s(s({},this.baseParams({type:r.Hebt})),{streams:x?.map(function(E){return{method:"fake",url:E.url}})});if(x||delete y.streams,this.datachannel.sendAsync(y))return y},C.prototype.dispose=function(){this.datachannel.dispose()},C.prototype.baseParams=function(x){x===void 0&&(x={type:r.Sub});var y=0;return x.type===r.Sub&&x.method===a.Add?(y=++this.latestMsgId,this.latestSubAddMsgId=this.latestMsgId):y=x.type===r.Sub&&x.method===a.Active?this.latestSubAddMsgId:++this.latestMsgId,{msg_id:y,version:2,type:x.type}},C}();v.Signal=p},125:function(h,v,u){var s,i=this&&this.__extends||(s=function(c,p){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(C,x){C.__proto__=x}||function(C,x){for(var y in x)Object.prototype.hasOwnProperty.call(x,y)&&(C[y]=x[y])},s(c,p)},function(c,p){if(typeof p!="function"&&p!==null)throw new TypeError("Class extends value "+String(p)+" is not a constructor or null");function C(){this.constructor=c}s(c,p),c.prototype=p===null?Object.create(p):(C.prototype=p.prototype,new C)}),e=this&&this.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(v,"__esModule",{value:!0}),v.NotifyProcessor=void 0;var o,r=u(973),a=e(u(885)),t=u(390);(function(c){c[c.NGX_RTC_H5_DELIVERY_INTERNAL_EXCEPTION=1]="NGX_RTC_H5_DELIVERY_INTERNAL_EXCEPTION",c[c.NGX_RTC_H5_ACCESS_IP_MIGRATION=2]="NGX_RTC_H5_ACCESS_IP_MIGRATION",c[c.NGX_RTC_H5_ACCESS_SUB_STREAMINFO=3]="NGX_RTC_H5_ACCESS_SUB_STREAMINFO"})(o||(o={}));var n=function(c){function p(){var C=c.call(this)||this;return C.logger=new t.Logger({displayName:"NotifyProcessor",switchName:"RTS_NOTIFY_DEBUG"}),C}return i(p,c),p.prototype.processIpMigration=function(C){var x,y,E=this.parseFormat(C);if(E&&this.checkRelated(E)){this.logger.log("\u3010processIpMigration\u3011parsedData",E),this.emit("message",{message:E});var S=this.parseIP(E.notify_msg);!((x=S.pull)===null||x===void 0)&&x.length||!((y=S.push)===null||y===void 0)&&y.length?(console.warn("\u3010processIpMigration\u3011\u9700\u8981\u91CD\u8FDE",S),this.emit("pcReconnect",{ips:S})):this.logger.log("\u3010processIpMigration\u3011No valid ip found: ",E.notify_msg)}},p.prototype.processSubStreamInfo=function(C){var x=this.parseFormat(C);if(this.logger.log("\u3010processSubStreamInfo\u3011parsedData",x),x&&this.checkRelated(x,o.NGX_RTC_H5_ACCESS_SUB_STREAMINFO))return x},p.prototype.processInternalException=function(C){var x=this.parseFormat(C);if(x&&this.checkRelated(x,o.NGX_RTC_H5_DELIVERY_INTERNAL_EXCEPTION)){this.emit("message",{message:x}),this.logger.log("\u3010processInternalException\u3011parsedData",x);var y=Number(x.res_code);y&&![200,204,205,207,221,403,404,405,429,504,616,409,601].includes(y)?(console.warn("\u3010processInternalException\u3011\u9700\u8981\u91CD\u8FDE",y),this.emit("pcReconnect",{})):this.logger.log("\u3010processInternalException\u3011Error code should not retry ",y)}},p.prototype.parseFormat=function(C){try{return JSON.parse(C)}catch{console.warn("Notify parse failed."," Response Data: ",C)}},p.prototype.checkRelated=function(C,x){return x===void 0&&(x=o.NGX_RTC_H5_ACCESS_IP_MIGRATION),C.type===r.EMessageType.NOTI&&C.notify_type===x},p.prototype.parseIP=function(C){C===void 0&&(C=""),this.logger.log("Paring IP string: ".concat(C));var x=C.split(";"),y=/^(?:\d{1,3}\.){3}\d{1,3}$/,E=/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,S=/^(push|pull)_ips:(.*)$/,d={};return x.forEach(function(R){var D=S.exec(R);if(D){var A=D[1],b=D[2].split(",").filter(function(g){return y.test(g)||E.test(g)});d[A]=b}}),this.logger.log("Parsed IP:",d),d},p}(a.default);v.NotifyProcessor=n},132:function(h,v,u){var s=this&&this.__awaiter||function(t,n,c,p){return new(c||(c=Promise))(function(C,x){function y(d){try{S(p.next(d))}catch(R){x(R)}}function E(d){try{S(p.throw(d))}catch(R){x(R)}}function S(d){var R;d.done?C(d.value):(R=d.value,R instanceof c?R:new c(function(D){D(R)})).then(y,E)}S((p=p.apply(t,n||[])).next())})},i=this&&this.__generator||function(t,n){var c,p,C,x,y={label:0,sent:function(){if(1&C[0])throw C[1];return C[1]},trys:[],ops:[]};return x={next:E(0),throw:E(1),return:E(2)},typeof Symbol=="function"&&(x[Symbol.iterator]=function(){return this}),x;function E(S){return function(d){return function(R){if(c)throw new TypeError("Generator is already executing.");for(;x&&(x=0,R[0]&&(y=0)),y;)try{if(c=1,p&&(C=2&R[0]?p.return:R[0]?p.throw||((C=p.return)&&C.call(p),0):p.next)&&!(C=C.call(p,R[1])).done)return C;switch(p=0,C&&(R=[2&R[0],C.value]),R[0]){case 0:case 1:C=R;break;case 4:return y.label++,{value:R[1],done:!1};case 5:y.label++,p=R[1],R=[0];continue;case 7:R=y.ops.pop(),y.trys.pop();continue;default:if(!((C=(C=y.trys).length>0&&C[C.length-1])||R[0]!==6&&R[0]!==2)){y=0;continue}if(R[0]===3&&(!C||R[1]>C[0]&&R[1]<C[3])){y.label=R[1];break}if(R[0]===6&&y.label<C[1]){y.label=C[1],C=R;break}if(C&&y.label<C[2]){y.label=C[2],y.ops.push(R);break}C[2]&&y.ops.pop(),y.trys.pop();continue}R=n.call(t,y)}catch(D){R=[6,D],p=0}finally{c=C=0}if(5&R[0])throw R[1];return{value:R[0]?R[1]:void 0,done:!0}}([S,d])}}},e=this&&this.__spreadArray||function(t,n,c){if(c||arguments.length===2)for(var p,C=0,x=n.length;C<x;C++)!p&&C in n||(p||(p=Array.prototype.slice.call(n,0,C)),p[C]=n[C]);return t.concat(p||Array.prototype.slice.call(n))},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(v,"__esModule",{value:!0}),v.PeerConnectionRollbackController=void 0;var r=o(u(775)),a=function(){function t(n){this.fakeSdpParams={direction:"sub",mids:[],medias:[]},this.pcCore=n}return t.prototype.setFakeSdpMids=function(n){this.fakeSdpParams.mids=n},t.prototype.setFakeSdpMedias=function(n,c){this.fakeSdpParams.medias=n,this.fakeSdpParams.direction=c},t.prototype.saveStreamManager=function(n){var c;this.streamManager=n,(c=this.streamManager)===null||c===void 0||c.backup()},t.prototype.rollback=function(n){return s(this,void 0,void 0,function(){var c;return i(this,function(p){switch(p.label){case 0:if(n?.trackListnerRollback&&(this.pcCore.removeTrackListener(),this.log("Sub Track Listener Removed")),n?.streamManagerRollback&&this.streamManager){this.streamManager.restore();try{this.log("Stream Manager Restored",JSON.parse((0,r.default)(this.streamManager)))}catch{}}if(n?.pcTransceiversRollback&&(this.fakeSdpParams.medias.forEach(function(C){var x;(x=C.trans)===null||x===void 0||x.receiver.track.stop()}),this.log("Sub Track(s) Stopped",this.fakeSdpParams.medias)),!n?.runSimulateSignal)return[3,4];this.log("SDP Simulating...",this.fakeSdpParams),p.label=1;case 1:return p.trys.push([1,3,,4]),[4,this.pcCore.simulateOfferAnswer(this.fakeSdpParams)];case 2:return p.sent(),this.log("SDP Simulation Done"),[3,4];case 3:return c=p.sent(),this.log("SDP Simulation Failed",c),[3,4];case 4:return[2]}})})},t.prototype.log=function(){for(var n=[],c=0;c<arguments.length;c++)n[c]=arguments[c];window.RTS_DATACHANNEL_DEBUG&&console.log.apply(console,e(["[PC-Core-Rollback]"],n,!1))},t}();v.PeerConnectionRollbackController=a},628:function(h,v,u){var s=this&&this.__assign||function(){return s=Object.assign||function(a){for(var t,n=1,c=arguments.length;n<c;n++)for(var p in t=arguments[n])Object.prototype.hasOwnProperty.call(t,p)&&(a[p]=t[p]);return a},s.apply(this,arguments)},i=this&&this.__spreadArray||function(a,t,n){if(n||arguments.length===2)for(var c,p=0,C=t.length;p<C;p++)!c&&p in t||(c||(c=Array.prototype.slice.call(t,0,p)),c[p]=t[p]);return a.concat(c||Array.prototype.slice.call(t))};Object.defineProperty(v,"__esModule",{value:!0}),v.StreamManager=v.EStreamType=void 0;var e,o=u(887);(function(a){a.Subscribe="sub",a.Publish="pub"})(e=v.EStreamType||(v.EStreamType={}));var r=function(){function a(t){this.streamMap={},this.streamMapBackup={},this.datachannelMap=new Map}return a.prototype.backup=function(){var t=this,n={};Object.keys(this.streamMap).forEach(function(c){var p=t.streamMap[c];n[c]=s(s({},t.streamMap[c]),{videoInfoList:i([],p.videoInfoList,!0),audioInfoList:i([],p.audioInfoList,!0),streamList:i([],p.streamList,!0)})}),this.streamMapBackup=n},a.prototype.restore=function(){this.streamMap=s({},this.streamMapBackup)},a.prototype.init=function(t,n){n===void 0&&(n=e.Subscribe);var c=(0,o.pruneSubUrl)(t);t=(0,o.pruneSubUrl)(t,!0),this.has(t)||(this.streamMap[t]={type:n,videoInfoList:[],audioInfoList:[],streamList:[],originUrl:c})},a.prototype.remove=function(t){delete this.streamMap[(0,o.pruneSubUrl)(t,!0)]},a.prototype.update=function(t,n){var c=this.get(t);if(!c)throw new Error("No url found");if(n.aMsid){var p=c.audioInfoList.find(function(x){return x.msid===n.aMsid})||this.createMediaItem(n.aMsid,"audio");n.aTransceiver&&(p.transceiver=n.aTransceiver),n.stream&&(p.streamId=n.stream.id),this.updateMediaInfoList(p,c.audioInfoList)}if(n.vMsid){var C=c.videoInfoList.find(function(x){return x.msid===n.vMsid})||this.createMediaItem(n.vMsid,"video");n.vTransceiver&&(C.transceiver=n.vTransceiver),n.cumuDelay&&(C.cumuDelay=n.cumuDelay),n.stream&&(C.streamId=n.stream.id),this.updateMediaInfoList(C,c.videoInfoList)}n.stream&&(c.streamList.some(function(x){return x.id===n.stream.id})||(c.streamList=i(i([],c.streamList,!0),[n.stream],!1)))},a.prototype.pruneStreamList=function(t){var n=this.get(t);n&&(n.streamList=n.streamList.filter(function(c){var p;return((p=c.mediaStream)===null||p===void 0?void 0:p.getTracks().length)>0}))},a.prototype.updateSdpInfo=function(t,n){var c,p=this.get(t);if(!p)throw new Error("No url found");if(n.aMsid?c=p.audioInfoList.find(function(C){return C.msid===n.aMsid}):n.vMsid&&(c=p.videoInfoList.find(function(C){return C.msid===n.vMsid})),!c)throw new Error("No target media found");c.ssrc=n.ssrc,c.codec=n.codec,c.pt=n.pt,c.from=n.from},a.prototype.get=function(t){return this.streamMap[(0,o.pruneSubUrl)(t,!0)]},a.prototype.has=function(t){return!!this.get(t)},a.prototype.getSize=function(){return this.getSubOrPubDoneMediaMapSize()+this.getDcMapSize()},a.prototype.getSubOrPubDoneMediaMapSize=function(){var t=this,n=0;return Object.keys(this.streamMap).forEach(function(c){var p=t.streamMap[c],C=!1;p.audioInfoList.forEach(function(x){C=C||p.type===e.Publish&&x.pubDone||p.type===e.Subscribe&&x.subDone}),p.videoInfoList.forEach(function(x){C=C||p.type===e.Publish&&x.pubDone||p.type===e.Subscribe&&x.subDone}),C&&n++}),n},a.prototype.getDcMapSize=function(){return this.datachannelMap.size},a.prototype.removeMsid=function(t,n){t=(0,o.pruneSubUrl)(t,!0);var c=this.get(t);c&&(n.vMsid&&(c.videoInfoList=c.videoInfoList.filter(function(p){return p.msid!==n.vMsid})),n.aMsid&&(c.audioInfoList=c.audioInfoList.filter(function(p){return p.msid!==n.aMsid})))},a.prototype.getMids=function(t,n){n===void 0&&(n={filterSubDone:!1}),t=(0,o.pruneSubUrl)(t,!0);var c=this.streamMap[t];return c?i(i([],c.audioInfoList.reduce(function(p,C){return C.transceiver&&(!n.filterSubDone||n.filterSubDone&&!C.subDone)?i(i([],p,!0),[String(C.transceiver.mid)],!1):p},[]),!0),c.videoInfoList.reduce(function(p,C){return C.transceiver&&(!n.filterSubDone||n.filterSubDone&&!C.subDone)?i(i([],p,!0),[String(C.transceiver.mid)],!1):p},[]),!0):[]},a.prototype.getAllTransceivers=function(t){if(!t)return[];t=(0,o.pruneSubUrl)(t,!0);var n=this.get(t);return n?i(i([],n.videoInfoList.map(function(c){return c.transceiver}),!0),n.audioInfoList.map(function(c){return c.transceiver}),!0):[]},a.prototype.getTransceiver=function(t,n){if(n===void 0&&(n={}),t){t=(0,o.pruneSubUrl)(t,!0);var c=n.vMsid,p=n.aMsid,C=this.get(t);if(C){var x;if(c)return(x=C.videoInfoList.find(function(y){return y.msid===c}))==null?void 0:x.transceiver;if(p)return(x=C.audioInfoList.find(function(y){return y.msid===p}))==null?void 0:x.transceiver}}},a.prototype.getStreamByMsid=function(t){var n,c,p=this.get(t.url);if(p){if(t.vMsid){var C=(n=p.videoInfoList.find(function(y){return y.msid===t.vMsid}))===null||n===void 0?void 0:n.streamId;return p.streamList.find(function(y){return y.id===C})}if(t.aMsid){var x=(c=p.audioInfoList.find(function(y){return y.msid===t.aMsid}))===null||c===void 0?void 0:c.streamId;return p.streamList.find(function(y){return y.id===x})}return p.streamList[0]}},a.prototype.hasTransceiver=function(t,n){return n===void 0&&(n={}),!!this.getTransceiver(t,n)},a.prototype.removeTransceiver=function(t,n){t=(0,o.pruneSubUrl)(t,!0);var c,p=this.get(t);p&&(n.vMsid&&(c=p.videoInfoList.find(function(C){return C.msid===n.vMsid}))&&(c.transceiver=void 0),n.aMsid&&(c=p.audioInfoList.find(function(C){return C.msid===n.aMsid}))&&(c.transceiver=void 0))},a.prototype.markAlreadySubPub=function(t,n){n===void 0&&(n={}),t=(0,o.pruneSubUrl)(t,!0);var c,p=this.streamMap[t];p&&(n.vMsid&&(c=p.videoInfoList.find(function(C){return C.msid===n.vMsid}))&&(c[n.isPub?"pubDone":"subDone"]=!n.reset),n.aMsid&&(c=p.audioInfoList.find(function(C){return C.msid===n.aMsid}))&&(c[n.isPub?"pubDone":"subDone"]=!n.reset))},a.prototype.isMsidSubPubDone=function(t,n){n===void 0&&(n={}),t=(0,o.pruneSubUrl)(t,!0);var c=this.streamMap[t];if(!c)return!1;if(n.vMsid){var p=c.videoInfoList.find(function(C){return C.msid===n.vMsid});return n.isPub?p?.pubDone:p?.subDone}return n.aMsid?(p=c.audioInfoList.find(function(C){return C.msid===n.aMsid}),n.isPub?p?.pubDone:p?.subDone):void 0},a.prototype.getAllMediaInfoList=function(t,n){var c=this.get(t);return c?i(i([],c.audioInfoList.map(function(p){var C,x,y,E,S=p.type,d=p.msid,R=p.ssrc,D=p.pt,A=p.codec,b=p.from,g=p.transceiver,O={type:S,msid:d,ssrc:R,pt:D,codec:A,from:b,trackId:c.type===e.Subscribe?(x=(C=g?.receiver)===null||C===void 0?void 0:C.track)===null||x===void 0?void 0:x.id:(E=(y=g?.sender)===null||y===void 0?void 0:y.track)===null||E===void 0?void 0:E.id};return n?s(s({},O),{transceiver:g}):O}),!0),c.videoInfoList.map(function(p){var C,x,y,E,S=p.type,d=p.msid,R=p.ssrc,D=p.pt,A=p.codec,b=p.from,g=p.transceiver,O={type:S,msid:d,ssrc:R,pt:D,codec:A,from:b,trackId:c.type===e.Subscribe?(x=(C=g?.receiver)===null||C===void 0?void 0:C.track)===null||x===void 0?void 0:x.id:(E=(y=g?.sender)===null||y===void 0?void 0:y.track)===null||E===void 0?void 0:E.id};return n?s(s({},O),{transceiver:g}):O}),!0):[]},a.prototype.getOriginUrl=function(t){var n=(0,o.pruneSubUrl)(t,!0),c=this.get(n);return c?c.originUrl:t},a.prototype.getAllTrackPairList=function(t){var n,c,p,C,x=[];for(var y in this.streamMap){var E=this.streamMap[y];if(E.type===t)for(var S=Math.max(E.audioInfoList.length,E.videoInfoList.length),d=0;d<S;d++){var R={url:y,originUrl:E.originUrl};d<E.audioInfoList.length&&(R.aTransceiver=t===e.Subscribe?(n=E.audioInfoList[d].transceiver)===null||n===void 0?void 0:n.receiver:(c=E.audioInfoList[d].transceiver)===null||c===void 0?void 0:c.sender,R.aMsid=E.audioInfoList[d].msid),d<E.videoInfoList.length&&(R.vTransceiver=t===e.Subscribe?(p=E.videoInfoList[d].transceiver)===null||p===void 0?void 0:p.receiver:(C=E.videoInfoList[d].transceiver)===null||C===void 0?void 0:C.sender,R.vMsid=E.videoInfoList[d].msid,R.cumuDelay=E.videoInfoList[d].cumuDelay),x.push(R)}}return x},a.prototype.getAllStreamListWithMsids=function(){var t,n=[];for(var c in this.streamMap){for(var p=this.streamMap[c],C=Math.max(p.audioInfoList.length,p.videoInfoList.length,p.streamList.length),x={url:c,msids:[],type:p.type,latestUrl:p.latestUrl||p.originUrl,streams:[]},y=0;y<C;y++){if(y<p.audioInfoList.length&&p.audioInfoList[y].msid){var E=p.audioInfoList[y];E.msid&&(p.type===e.Publish&&E.pubDone||p.type===e.Subscribe&&E.subDone)&&x.msids.push({name:E.msid||"",type:E.type||"audio",streamId:E.streamId})}if(y<p.videoInfoList.length&&p.videoInfoList[y].msid){var S=p.videoInfoList[y];S.msid&&(p.type===e.Publish&&S.pubDone||p.type===e.Subscribe&&S.subDone)&&x.msids.push({name:S.msid||"",type:S.type||"video",streamId:S.streamId})}y<p.streamList.length&&p.streamList[y]&&((t=x.streams)===null||t===void 0||t.push(p.streamList[y]))}x.msids.length&&n.push(x)}return n},a.prototype.getSender=function(t,n,c){var p,C,x=void 0,y=this.getAllMediaInfoList(t,!0);return c?y.forEach(function(E){var S,d,R,D=(d=(S=E.transceiver)===null||S===void 0?void 0:S.sender)===null||d===void 0?void 0:d.track;D?.kind===n&&E.msid===c&&(x=(R=E.transceiver)===null||R===void 0?void 0:R.sender)}):x=(C=(p=y?.find(function(E){var S,d,R;return((R=(d=(S=E.transceiver)===null||S===void 0?void 0:S.sender)===null||d===void 0?void 0:d.track)===null||R===void 0?void 0:R.kind)===n}))===null||p===void 0?void 0:p.transceiver)===null||C===void 0?void 0:C.sender,x},a.prototype.getReceiver=function(t,n,c){var p,C,x=void 0,y=this.getAllMediaInfoList(t,!0);return c?y.forEach(function(E){var S,d,R,D=(d=(S=E.transceiver)===null||S===void 0?void 0:S.receiver)===null||d===void 0?void 0:d.track;D?.kind===n&&E.msid===c&&(x=(R=E.transceiver)===null||R===void 0?void 0:R.receiver)}):x=(C=(p=y?.find(function(E){var S,d,R;return((R=(d=(S=E.transceiver)===null||S===void 0?void 0:S.receiver)===null||d===void 0?void 0:d.track)===null||R===void 0?void 0:R.kind)===n}))===null||p===void 0?void 0:p.transceiver)===null||C===void 0?void 0:C.receiver,x},a.prototype.dispose=function(){this.streamMap={}},a.prototype.updateMediaInfoList=function(t,n){var c=n.findIndex(function(p){return p.msid===t.msid});c!==-1?n.splice(c,1,t):n.push(t)},a.prototype.findMediaItemByMsid=function(t,n){return n.find(function(c){return c.msid===t})},a.prototype.createMediaItem=function(t,n){return{msid:t,ssrc:void 0,transceiver:void 0,subDone:!1,pubDone:!1,type:n,streamId:void 0}},a.prototype.addOrUpdateDatachannelItem=function(t){var n=this.datachannelMap.get(t.url);n?t.msids.forEach(function(c){n.msids.find(function(p){if(p.id===c.id&&p.name===c.name)return!0})?console.log("RTS [STREAM MANAGER]: duplicate msid for datachannel",t):n.msids.push(c)}):this.datachannelMap.set(t.url,t)},a.prototype.deleteDatachannelItem=function(t){this.datachannelMap.delete(t.url)},a.prototype.getAllDatachannelList=function(){var t=[];return this.datachannelMap.forEach(function(n){t.push(s(s({},n),{latestUrl:n.latestUrl||n.originUrl}))}),t},a.prototype.getDatachannelByMsid=function(t){var n;if(t.url){var c=this.datachannelMap.get((0,o.pruneSubUrl)(t.url,!0));if(c)return t.msid?(n=c.msids.find(function(p){return p.name===t.msid}))===null||n===void 0?void 0:n.datachannel:c.msids[0].datachannel}else console.warn("[getDatachannelByMsid] config.url is required.")},a.prototype.getPubOrSubDoneMediaUrlByIndex=function(t){var n=0,c=function(y){var E=p.streamMap[y],S=!1;if(E.audioInfoList.forEach(function(d){S=S||E.type===e.Publish&&d.pubDone||E.type===e.Subscribe&&d.subDone}),E.videoInfoList.forEach(function(d){S=S||E.type===e.Publish&&d.pubDone||E.type===e.Subscribe&&d.subDone}),S){if(n===t)return{value:y};n++}},p=this;for(var C in this.streamMap){var x=c(C);if(typeof x=="object")return x.value}},a.prototype.getDcUrlByIndex=function(t){var n=void 0;return this.datachannelMap.forEach(function(c){t===0&&(n={url:c.originUrl})}),n},a.prototype.updateLatestUrl=function(t){var n=this.get(t);return!!n&&(n.latestUrl=t,!0)},a}();v.StreamManager=r}},f={};function l(h){var v=f[h];if(v!==void 0)return v.exports;var u=f[h]={exports:{}};return _[h].call(u.exports,u,u.exports,l),u.exports}var m={};return(()=>{var h=m;Object.defineProperty(h,"__esModule",{value:!0}),h.DataChannelCore=h.EDatachannelStatus=h.PeerConnectionCore=void 0;var v=l(776);Object.defineProperty(h,"PeerConnectionCore",{enumerable:!0,get:function(){return v.PeerConnectionCore}}),Object.defineProperty(h,"EDatachannelStatus",{enumerable:!0,get:function(){return v.EDatachannelStatus}});var u=l(651);Object.defineProperty(h,"DataChannelCore",{enumerable:!0,get:function(){return u.DataChannelCore}})})(),m})(),H.exports=T()},2505:(H,T,_)=>{H.exports=_(8015)},5592:(H,T,_)=>{var f=_(9516),l=_(7522),m=_(3948),h=_(9106),v=_(9615),u=_(2012),s=_(4202),i=_(7763);H.exports=function(e){return new Promise(function(o,r){var a=e.data,t=e.headers,n=e.responseType;f.isFormData(a)&&delete t["Content-Type"];var c=new XMLHttpRequest;if(e.auth){var p=e.auth.username||"",C=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";t.Authorization="Basic "+btoa(p+":"+C)}var x=v(e.baseURL,e.url);function y(){if(c){var S="getAllResponseHeaders"in c?u(c.getAllResponseHeaders()):null,d={data:n&&n!=="text"&&n!=="json"?c.response:c.responseText,status:c.status,statusText:c.statusText,headers:S,config:e,request:c};l(o,r,d),c=null}}if(c.open(e.method.toUpperCase(),h(x,e.params,e.paramsSerializer),!0),c.timeout=e.timeout,"onloadend"in c?c.onloadend=y:c.onreadystatechange=function(){c&&c.readyState===4&&(c.status!==0||c.responseURL&&c.responseURL.indexOf("file:")===0)&&setTimeout(y)},c.onabort=function(){c&&(r(i("Request aborted",e,"ECONNABORTED",c)),c=null)},c.onerror=function(){r(i("Network Error",e,null,c)),c=null},c.ontimeout=function(){var S="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(S=e.timeoutErrorMessage),r(i(S,e,e.transitional&&e.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",c)),c=null},f.isStandardBrowserEnv()){var E=(e.withCredentials||s(x))&&e.xsrfCookieName?m.read(e.xsrfCookieName):void 0;E&&(t[e.xsrfHeaderName]=E)}"setRequestHeader"in c&&f.forEach(t,function(S,d){a===void 0&&d.toLowerCase()==="content-type"?delete t[d]:c.setRequestHeader(d,S)}),f.isUndefined(e.withCredentials)||(c.withCredentials=!!e.withCredentials),n&&n!=="json"&&(c.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&c.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&c.upload&&c.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then(function(S){c&&(c.abort(),r(S),c=null)}),a||(a=null),c.send(a)})}},8015:(H,T,_)=>{var f=_(9516),l=_(9012),m=_(5155),h=_(5343);function v(s){var i=new m(s),e=l(m.prototype.request,i);return f.extend(e,m.prototype,i),f.extend(e,i),e}var u=v(_(6987));u.Axios=m,u.create=function(s){return v(h(u.defaults,s))},u.Cancel=_(1928),u.CancelToken=_(3191),u.isCancel=_(3864),u.all=function(s){return Promise.all(s)},u.spread=_(7980),u.isAxiosError=_(5019),H.exports=u,H.exports.default=u},1928:H=>{function T(_){this.message=_}T.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},T.prototype.__CANCEL__=!0,H.exports=T},3191:(H,T,_)=>{var f=_(1928);function l(m){if(typeof m!="function")throw new TypeError("executor must be a function.");var h;this.promise=new Promise(function(u){h=u});var v=this;m(function(u){v.reason||(v.reason=new f(u),h(v.reason))})}l.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},l.source=function(){var m;return{token:new l(function(h){m=h}),cancel:m}},H.exports=l},3864:H=>{H.exports=function(T){return!(!T||!T.__CANCEL__)}},5155:(H,T,_)=>{var f=_(9516),l=_(9106),m=_(3471),h=_(4490),v=_(5343),u=_(4841),s=u.validators;function i(e){this.defaults=e,this.interceptors={request:new m,response:new m}}i.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=v(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var o=e.transitional;o!==void 0&&u.assertOptions(o,{silentJSONParsing:s.transitional(s.boolean,"1.0.0"),forcedJSONParsing:s.transitional(s.boolean,"1.0.0"),clarifyTimeoutError:s.transitional(s.boolean,"1.0.0")},!1);var r=[],a=!0;this.interceptors.request.forEach(function(y){typeof y.runWhen=="function"&&y.runWhen(e)===!1||(a=a&&y.synchronous,r.unshift(y.fulfilled,y.rejected))});var t,n=[];if(this.interceptors.response.forEach(function(y){n.push(y.fulfilled,y.rejected)}),!a){var c=[h,void 0];for(Array.prototype.unshift.apply(c,r),c=c.concat(n),t=Promise.resolve(e);c.length;)t=t.then(c.shift(),c.shift());return t}for(var p=e;r.length;){var C=r.shift(),x=r.shift();try{p=C(p)}catch(y){x(y);break}}try{t=h(p)}catch(y){return Promise.reject(y)}for(;n.length;)t=t.then(n.shift(),n.shift());return t},i.prototype.getUri=function(e){return e=v(this.defaults,e),l(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},f.forEach(["delete","get","head","options"],function(e){i.prototype[e]=function(o,r){return this.request(v(r||{},{method:e,url:o,data:(r||{}).data}))}}),f.forEach(["post","put","patch"],function(e){i.prototype[e]=function(o,r,a){return this.request(v(a||{},{method:e,url:o,data:r}))}}),H.exports=i},3471:(H,T,_)=>{var f=_(9516);function l(){this.handlers=[]}l.prototype.use=function(m,h,v){return this.handlers.push({fulfilled:m,rejected:h,synchronous:!!v&&v.synchronous,runWhen:v?v.runWhen:null}),this.handlers.length-1},l.prototype.eject=function(m){this.handlers[m]&&(this.handlers[m]=null)},l.prototype.forEach=function(m){f.forEach(this.handlers,function(h){h!==null&&m(h)})},H.exports=l},9615:(H,T,_)=>{var f=_(9137),l=_(4680);H.exports=function(m,h){return m&&!f(h)?l(m,h):h}},7763:(H,T,_)=>{var f=_(5449);H.exports=function(l,m,h,v,u){var s=new Error(l);return f(s,m,h,v,u)}},4490:(H,T,_)=>{var f=_(9516),l=_(2881),m=_(3864),h=_(6987);function v(u){u.cancelToken&&u.cancelToken.throwIfRequested()}H.exports=function(u){return v(u),u.headers=u.headers||{},u.data=l.call(u,u.data,u.headers,u.transformRequest),u.headers=f.merge(u.headers.common||{},u.headers[u.method]||{},u.headers),f.forEach(["delete","get","head","post","put","patch","common"],function(s){delete u.headers[s]}),(u.adapter||h.adapter)(u).then(function(s){return v(u),s.data=l.call(u,s.data,s.headers,u.transformResponse),s},function(s){return m(s)||(v(u),s&&s.response&&(s.response.data=l.call(u,s.response.data,s.response.headers,u.transformResponse))),Promise.reject(s)})}},5449:H=>{H.exports=function(T,_,f,l,m){return T.config=_,f&&(T.code=f),T.request=l,T.response=m,T.isAxiosError=!0,T.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},T}},5343:(H,T,_)=>{var f=_(9516);H.exports=function(l,m){m=m||{};var h={},v=["url","method","data"],u=["headers","auth","proxy","params"],s=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],i=["validateStatus"];function e(t,n){return f.isPlainObject(t)&&f.isPlainObject(n)?f.merge(t,n):f.isPlainObject(n)?f.merge({},n):f.isArray(n)?n.slice():n}function o(t){f.isUndefined(m[t])?f.isUndefined(l[t])||(h[t]=e(void 0,l[t])):h[t]=e(l[t],m[t])}f.forEach(v,function(t){f.isUndefined(m[t])||(h[t]=e(void 0,m[t]))}),f.forEach(u,o),f.forEach(s,function(t){f.isUndefined(m[t])?f.isUndefined(l[t])||(h[t]=e(void 0,l[t])):h[t]=e(void 0,m[t])}),f.forEach(i,function(t){t in m?h[t]=e(l[t],m[t]):t in l&&(h[t]=e(void 0,l[t]))});var r=v.concat(u).concat(s).concat(i),a=Object.keys(l).concat(Object.keys(m)).filter(function(t){return r.indexOf(t)===-1});return f.forEach(a,o),h}},7522:(H,T,_)=>{var f=_(7763);H.exports=function(l,m,h){var v=h.config.validateStatus;h.status&&v&&!v(h.status)?m(f("Request failed with status code "+h.status,h.config,null,h.request,h)):l(h)}},2881:(H,T,_)=>{var f=_(9516),l=_(6987);H.exports=function(m,h,v){var u=this||l;return f.forEach(v,function(s){m=s.call(u,m,h)}),m}},6987:(H,T,_)=>{var f=_(9516),l=_(7018),m=_(5449),h={"Content-Type":"application/x-www-form-urlencoded"};function v(i,e){!f.isUndefined(i)&&f.isUndefined(i["Content-Type"])&&(i["Content-Type"]=e)}var u,s={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:((typeof XMLHttpRequest<"u"||typeof process<"u"&&Object.prototype.toString.call(process)==="[object process]")&&(u=_(5592)),u),transformRequest:[function(i,e){return l(e,"Accept"),l(e,"Content-Type"),f.isFormData(i)||f.isArrayBuffer(i)||f.isBuffer(i)||f.isStream(i)||f.isFile(i)||f.isBlob(i)?i:f.isArrayBufferView(i)?i.buffer:f.isURLSearchParams(i)?(v(e,"application/x-www-form-urlencoded;charset=utf-8"),i.toString()):f.isObject(i)||e&&e["Content-Type"]==="application/json"?(v(e,"application/json"),function(o,r,a){if(f.isString(o))try{return(r||JSON.parse)(o),f.trim(o)}catch(t){if(t.name!=="SyntaxError")throw t}return(0,JSON.stringify)(o)}(i)):i}],transformResponse:[function(i){var e=this.transitional,o=e&&e.silentJSONParsing,r=e&&e.forcedJSONParsing,a=!o&&this.responseType==="json";if(a||r&&f.isString(i)&&i.length)try{return JSON.parse(i)}catch(t){if(a)throw t.name==="SyntaxError"?m(t,this,"E_JSON_PARSE"):t}return i}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(i){return i>=200&&i<300}};s.headers={common:{Accept:"application/json, text/plain, */*"}},f.forEach(["delete","get","head"],function(i){s.headers[i]={}}),f.forEach(["post","put","patch"],function(i){s.headers[i]=f.merge(h)}),H.exports=s},9012:H=>{H.exports=function(T,_){return function(){for(var f=new Array(arguments.length),l=0;l<f.length;l++)f[l]=arguments[l];return T.apply(_,f)}}},9106:(H,T,_)=>{var f=_(9516);function l(m){return encodeURIComponent(m).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}H.exports=function(m,h,v){if(!h)return m;var u;if(v)u=v(h);else if(f.isURLSearchParams(h))u=h.toString();else{var s=[];f.forEach(h,function(e,o){e!=null&&(f.isArray(e)?o+="[]":e=[e],f.forEach(e,function(r){f.isDate(r)?r=r.toISOString():f.isObject(r)&&(r=JSON.stringify(r)),s.push(l(o)+"="+l(r))}))}),u=s.join("&")}if(u){var i=m.indexOf("#");i!==-1&&(m=m.slice(0,i)),m+=(m.indexOf("?")===-1?"?":"&")+u}return m}},4680:H=>{H.exports=function(T,_){return _?T.replace(/\/+$/,"")+"/"+_.replace(/^\/+/,""):T}},3948:(H,T,_)=>{var f=_(9516);H.exports=f.isStandardBrowserEnv()?{write:function(l,m,h,v,u,s){var i=[];i.push(l+"="+encodeURIComponent(m)),f.isNumber(h)&&i.push("expires="+new Date(h).toGMTString()),f.isString(v)&&i.push("path="+v),f.isString(u)&&i.push("domain="+u),s===!0&&i.push("secure"),document.cookie=i.join("; ")},read:function(l){var m=document.cookie.match(new RegExp("(^|;\\s*)("+l+")=([^;]*)"));return m?decodeURIComponent(m[3]):null},remove:function(l){this.write(l,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},9137:H=>{H.exports=function(T){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(T)}},5019:H=>{H.exports=function(T){return typeof T=="object"&&T.isAxiosError===!0}},4202:(H,T,_)=>{var f=_(9516);H.exports=f.isStandardBrowserEnv()?function(){var l,m=/(msie|trident)/i.test(navigator.userAgent),h=document.createElement("a");function v(u){var s=u;return m&&(h.setAttribute("href",s),s=h.href),h.setAttribute("href",s),{href:h.href,protocol:h.protocol?h.protocol.replace(/:$/,""):"",host:h.host,search:h.search?h.search.replace(/^\?/,""):"",hash:h.hash?h.hash.replace(/^#/,""):"",hostname:h.hostname,port:h.port,pathname:h.pathname.charAt(0)==="/"?h.pathname:"/"+h.pathname}}return l=v(window.location.href),function(u){var s=f.isString(u)?v(u):u;return s.protocol===l.protocol&&s.host===l.host}}():function(){return!0}},7018:(H,T,_)=>{var f=_(9516);H.exports=function(l,m){f.forEach(l,function(h,v){v!==m&&v.toUpperCase()===m.toUpperCase()&&(l[m]=h,delete l[v])})}},2012:(H,T,_)=>{var f=_(9516),l=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];H.exports=function(m){var h,v,u,s={};return m&&f.forEach(m.split(`
79
+ `),function(i){if(u=i.indexOf(":"),h=f.trim(i.substr(0,u)).toLowerCase(),v=f.trim(i.substr(u+1)),h){if(s[h]&&l.indexOf(h)>=0)return;s[h]=h==="set-cookie"?(s[h]?s[h]:[]).concat([v]):s[h]?s[h]+", "+v:v}}),s}},7980:H=>{H.exports=function(T){return function(_){return T.apply(null,_)}}},4841:(H,T,_)=>{var f=_(4198),l={};["object","boolean","number","function","string","symbol"].forEach(function(u,s){l[u]=function(i){return typeof i===u||"a"+(s<1?"n ":" ")+u}});var m={},h=f.version.split(".");function v(u,s){for(var i=s?s.split("."):h,e=u.split("."),o=0;o<3;o++){if(i[o]>e[o])return!0;if(i[o]<e[o])return!1}return!1}l.transitional=function(u,s,i){var e=s&&v(s);function o(r,a){return"[Axios v"+f.version+"] Transitional option '"+r+"'"+a+(i?". "+i:"")}return function(r,a,t){if(u===!1)throw new Error(o(a," has been removed in "+s));return e&&!m[a]&&(m[a]=!0,console.warn(o(a," has been deprecated since v"+s+" and will be removed in the near future"))),!u||u(r,a,t)}},H.exports={isOlderVersion:v,assertOptions:function(u,s,i){if(typeof u!="object")throw new TypeError("options must be an object");for(var e=Object.keys(u),o=e.length;o-- >0;){var r=e[o],a=s[r];if(a){var t=u[r],n=t===void 0||a(t,r,u);if(n!==!0)throw new TypeError("option "+r+" must be "+n)}else if(i!==!0)throw Error("Unknown option "+r)}},validators:l}},9516:(H,T,_)=>{var f=_(9012),l=Object.prototype.toString;function m(e){return l.call(e)==="[object Array]"}function h(e){return e===void 0}function v(e){return e!==null&&typeof e=="object"}function u(e){if(l.call(e)!=="[object Object]")return!1;var o=Object.getPrototypeOf(e);return o===null||o===Object.prototype}function s(e){return l.call(e)==="[object Function]"}function i(e,o){if(e!=null)if(typeof e!="object"&&(e=[e]),m(e))for(var r=0,a=e.length;r<a;r++)o.call(null,e[r],r,e);else for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&o.call(null,e[t],t,e)}H.exports={isArray:m,isArrayBuffer:function(e){return l.call(e)==="[object ArrayBuffer]"},isBuffer:function(e){return e!==null&&!h(e)&&e.constructor!==null&&!h(e.constructor)&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e)},isFormData:function(e){return typeof FormData<"u"&&e instanceof FormData},isArrayBufferView:function(e){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return typeof e=="string"},isNumber:function(e){return typeof e=="number"},isObject:v,isPlainObject:u,isUndefined:h,isDate:function(e){return l.call(e)==="[object Date]"},isFile:function(e){return l.call(e)==="[object File]"},isBlob:function(e){return l.call(e)==="[object Blob]"},isFunction:s,isStream:function(e){return v(e)&&s(e.pipe)},isURLSearchParams:function(e){return typeof URLSearchParams<"u"&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return(typeof navigator>"u"||navigator.product!=="ReactNative"&&navigator.product!=="NativeScript"&&navigator.product!=="NS")&&typeof window<"u"&&typeof document<"u"},forEach:i,merge:function e(){var o={};function r(n,c){u(o[c])&&u(n)?o[c]=e(o[c],n):u(n)?o[c]=e({},n):m(n)?o[c]=n.slice():o[c]=n}for(var a=0,t=arguments.length;a<t;a++)i(arguments[a],r);return o},extend:function(e,o,r){return i(o,function(a,t){e[t]=r&&typeof a=="function"?f(a,r):a}),e},trim:function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},stripBOM:function(e){return e.charCodeAt(0)===65279&&(e=e.slice(1)),e}}},3412:H=>{/*! media-device - ver 1.4.0 created:2025/7/3 19:29:03 */H.exports=(()=>{var T={304:(f,l,m)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BrowserDeviceManager=void 0;var h=m(101),v=m(853),u=m(62),s=m(913),i=m(331),e=m(1),o=m(935),r=m(603),a=function(){function t(){this.systemUtil=new h.SystemUtil,this.deviceManager=this.createDeviceManager()}return t.prototype.getCameraList=function(){return this.deviceManager.getCameraList()},t.prototype.getMicList=function(){return this.deviceManager.getMicList()},t.prototype.getSpeakerList=function(){return this.deviceManager.getSpeakerList()},t.prototype.getAudioTrack=function(n){return this.deviceManager.getAudioTrack(n)},t.prototype.getVideoTrack=function(n){return this.deviceManager.getVideoTrack(n)},t.prototype.getAudioVideoTracks=function(n){return this.deviceManager.getAudioVideoTracks(n)},t.prototype.getScreenTrack=function(n){return this.deviceManager.getScreenTrack(n)},t.prototype.getAudioStream=function(n){return this.deviceManager.getAudioStream(n)},t.prototype.getVideoStream=function(n){return this.deviceManager.getVideoStream(n)},t.prototype.getScreenStream=function(n){return this.deviceManager.getScreenStream(n)},t.prototype.checkSupportScreenShare=function(){return this.deviceManager.checkSupportScreenShare()},t.prototype.createDeviceManager=function(){return this.systemUtil.isWindows?new o.WindowsDeviceManager:this.systemUtil.isAndroid?new v.AndroidDeviceManager:this.systemUtil.isIos?new s.IosDeviceManager:this.systemUtil.isMacOS?new e.MacDeviceManager:this.systemUtil.isLinux?new i.LinuxDeviceManager:new u.BaseDeviceManager},t.isDeviceManagerError=r.DeviceError.isDeviceManagerError,t}();l.BrowserDeviceManager=a},603:(f,l,m)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DeviceError=l.DeviceErrorDescription=l.DeviceErrorCode=void 0;var h=m(610);(function(u){u[u.ERROR_DEVICE_UNKNOWNERROR=1e4]="ERROR_DEVICE_UNKNOWNERROR",u[u.ERROR_DEVICE_AUDIODEVICE_NOTFOUND=10001]="ERROR_DEVICE_AUDIODEVICE_NOTFOUND",u[u.ERROR_DEVICE_VIDEODEVICE_NOTFOUND=10002]="ERROR_DEVICE_VIDEODEVICE_NOTFOUND",u[u.ERROR_DEVICE_NOTFOUND=10020]="ERROR_DEVICE_NOTFOUND",u[u.ERROR_DEVICE_AUDIODEVICE_NOTALLOWED=10003]="ERROR_DEVICE_AUDIODEVICE_NOTALLOWED",u[u.ERROR_DEVICE_VIDEODEVICE_NOTALLOWED=10004]="ERROR_DEVICE_VIDEODEVICE_NOTALLOWED",u[u.ERROR_DEVICE_NOTALLOWED=10021]="ERROR_DEVICE_NOTALLOWED",u[u.ERROR_DEVICE_AUDIODEVICE_NOTREADABLE=10005]="ERROR_DEVICE_AUDIODEVICE_NOTREADABLE",u[u.ERROR_DEVICE_VIDEODEVICE_NOTREADABLE=10006]="ERROR_DEVICE_VIDEODEVICE_NOTREADABLE",u[u.ERROR_DEVICE_NOTREADABLE=10022]="ERROR_DEVICE_NOTREADABLE",u[u.ERROR_DEIVCE_CONSTRAINEDERROR=10007]="ERROR_DEIVCE_CONSTRAINEDERROR",u[u.ERROR_SCREENSHARE_UNKNOWNERRO=10010]="ERROR_SCREENSHARE_UNKNOWNERRO",u[u.ERROR_SCREENSHARE_NOTALLOWED=10011]="ERROR_SCREENSHARE_NOTALLOWED",u[u.ERROR_SCREENSHARE_ENDED=10012]="ERROR_SCREENSHARE_ENDED",u[u.ERROR_SCREENSHARE_NOPERMISSION=10013]="ERROR_SCREENSHARE_NOPERMISSION",u[u.ERROR_SCREENSHARE_INVALIDACCESS=10014]="ERROR_SCREENSHARE_INVALIDACCESS",u[u.ERROR_SCREENSHARE_NOTSUPPORT=10018]="ERROR_SCREENSHARE_NOTSUPPORT",u[u.ERROR_DEVICE_NOTSUPPORT=10019]="ERROR_DEVICE_NOTSUPPORT"})(l.DeviceErrorCode||(l.DeviceErrorCode={})),function(u){u.ERRORMESSAGE_DEVICENOTFOUND="Requested device not found",u.ERRORMESSAGE_DEVICENOTALLOWED="Permission denied",u.ERRORMESSAGE_MACCHROME_DEVICENOTREADABLE="Permission denied by system",u.ERRORMESSAGE_MACSAFARI_DEVICENOTALLOWED="The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.",u.ERRORMESSAGE_MOBILEDEVICE_NOTALLOWED="video device not allowed",u.ERRORMESSAGE_AUDIODEVICENOTREADABLE="Could not start audio source",u.ERRORMESSAGE_VIDEODEVICENOTREADABLE="Could not start video source",u.ERRORNAME_DEVICENOTFOUND="NotFoundError",u.ERRORNAME_DEVICENOTALLOWED="NotAllowedError",u.ERRORNAME_DEVICENOTREADABLE="NotReadableError",u.ERRORNAME_DEVICEOVERCONSTRAINED="OverconstrainedError",u.ERRORNAME_INVALID_ACCESS="InvalidAccessError"}(l.DeviceErrorDescription||(l.DeviceErrorDescription={}));var v=function(){function u(s,i){this.linkUtil=new h.LinkUtil,this.code=s,this.reason=i,this.relatedLink=this.linkUtil.getRelatedLink(s)}return u.isDeviceManagerError=function(s){return!!(s&&typeof s=="object"&&"code"in s&&"reason"in s)},u}();l.DeviceError=v},873:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DeviceType=l.MobileCameraType=void 0,function(m){m[m.USER=0]="USER",m[m.ENV=1]="ENV"}(l.MobileCameraType||(l.MobileCameraType={})),function(m){m.Camera="videoinput",m.Mic="audioinput",m.Mixed="audiovideoinput",m.Screen="screen",m.Speaker="audiooutput"}(l.DeviceType||(l.DeviceType={}))},853:function(f,l,m){var h,v=this&&this.__extends||(h=function(s,i){return(h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,o){e.__proto__=o}||function(e,o){for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])})(s,i)},function(s,i){function e(){this.constructor=s}h(s,i),s.prototype=i===null?Object.create(i):(e.prototype=i.prototype,new e)});Object.defineProperty(l,"__esModule",{value:!0}),l.AndroidDeviceManager=void 0;var u=function(s){function i(){return s.call(this)||this}return v(i,s),i}(m(583).MobileDeviceManager);l.AndroidDeviceManager=u},62:(f,l,m)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BaseDeviceManager=void 0;var h=m(603),v=m(873),u=function(){function s(){}return s.prototype.checkSupportScreenShare=function(){return!!(navigator&&navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia&&navigator.mediaDevices.getDisplayMedia)},s.prototype.getCameraList=function(){var i=this;return new Promise(function(e,o){i.checkSupport()?i.getDeviceRight(v.DeviceType.Camera).then(function(){i.getDeviceList(v.DeviceType.Camera).then(function(r){e(r)}).catch(function(r){o(i.parseError(v.DeviceType.Camera,r))})}).catch(function(r){o(i.parseError(v.DeviceType.Camera,r))}):o(new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_NOTSUPPORT,"not support navigator.mediaDevices"))})},s.prototype.getMicList=function(){var i=this;return new Promise(function(e,o){i.checkSupport()?i.getDeviceRight(v.DeviceType.Mic).then(function(){i.getDeviceList(v.DeviceType.Mic).then(function(r){e(r)}).catch(function(r){o(i.parseError(v.DeviceType.Mic,r))})}).catch(function(r){o(i.parseError(v.DeviceType.Mic,r))}):o(new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_NOTSUPPORT,"not support navigator.mediaDevices"))})},s.prototype.getSpeakerList=function(){var i=this;return new Promise(function(e,o){i.checkSupport()?i.getDeviceRight(v.DeviceType.Speaker).then(function(){i.getDeviceList(v.DeviceType.Speaker).then(function(r){e(r)}).catch(function(r){o(i.parseError(v.DeviceType.Speaker,r))})}).catch(function(r){o(i.parseError(v.DeviceType.Speaker,r))}):o(new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_NOTSUPPORT,"not support navigator.mediaDevices"))})},s.prototype.getAudioTrack=function(i){return this.getAudioStream(i).then(function(e){return e.getAudioTracks()[0]})},s.prototype.getAudioStream=function(i){var e=this;return new Promise(function(o,r){if(e.checkSupport()){var a=e.createAudioConstraints(i);navigator.mediaDevices.getUserMedia(a).then(function(t){o(t)}).catch(function(t){r(e.parseError(v.DeviceType.Mic,t))})}else r(new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_NOTSUPPORT,"not support navigator.mediaDevices"))})},s.prototype.getVideoTrack=function(i){return this.getVideoStream(i).then(function(e){return e.getVideoTracks()[0]})},s.prototype.getVideoStream=function(i){var e=this;return new Promise(function(o,r){if(e.checkSupport()){var a=e.createVideoConstraints(i);navigator.mediaDevices.getUserMedia(a).then(function(t){o(t)}).catch(function(t){r(e.parseError(v.DeviceType.Camera,t))})}else r(new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_NOTSUPPORT,"not support navigator.mediaDevices"))})},s.prototype.getAudioVideoTracks=function(i){return this.getMixedStream(i).then(function(e){return e.getTracks()})},s.prototype.getMixedStream=function(i){var e=this;return new Promise(function(o,r){if(e.checkSupport()){var a=e.createMixedConstraints(i);navigator.mediaDevices.getUserMedia(a).then(function(t){o(t)}).catch(function(t){r(e.parseError(v.DeviceType.Mixed,t))})}else r(new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_NOTSUPPORT,"not support navigator.mediaDevices"))})},s.prototype.getScreenTrack=function(i){return this.getScreenStream(i).then(function(e){return e.getTracks()})},s.prototype.getScreenStream=function(i){var e=this;return new Promise(function(o,r){e.checkSupportScreenShare()?navigator.mediaDevices.getDisplayMedia(i).then(function(a){o(a)}).catch(function(a){r(e.parseError(v.DeviceType.Screen,a))}):r(new h.DeviceError(h.DeviceErrorCode.ERROR_SCREENSHARE_NOTSUPPORT,"browser not support screenshare"))})},s.prototype.checkSupport=function(){return!!(navigator&&navigator.mediaDevices&&navigator.mediaDevices.enumerateDevices&&navigator.mediaDevices.getUserMedia)},s.prototype.getDeviceList=function(i){return new Promise(function(e,o){navigator.mediaDevices.enumerateDevices().then(function(r){var a=[];r.forEach(function(t){t.kind===i&&a.push(t)}),e(a)}).catch(function(r){o(r)})})},s.prototype.getDeviceRight=function(i){return new Promise(function(e,o){var r;v.DeviceType.Camera===i?r={video:!0}:v.DeviceType.Mic!==i&&v.DeviceType.Speaker!==i||(r={audio:!0}),navigator.mediaDevices.getUserMedia(r).then(function(a){a.getTracks().forEach(function(t){t.stop()}),e(void 0)}).catch(function(a){e(void 0)})})},s.prototype.parseError=function(i,e){var o=null;return v.DeviceType.Mic===i?o=this.parseAudioError(e):v.DeviceType.Camera===i?o=this.parseVideoError(e):v.DeviceType.Mixed===i?o=this.parseMixedError(e):v.DeviceType.Screen===i&&(o=this.parseScreenError(e)),o===null?new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_UNKNOWNERROR,""):o},s.prototype.parseAudioError=function(i){return i.message===h.DeviceErrorDescription.ERRORMESSAGE_DEVICENOTFOUND||i.name===h.DeviceErrorDescription.ERRORNAME_DEVICENOTFOUND?new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_AUDIODEVICE_NOTFOUND,"audio device not found"):i.message===h.DeviceErrorDescription.ERRORMESSAGE_DEVICENOTALLOWED||i.message===h.DeviceErrorDescription.ERRORMESSAGE_MACSAFARI_DEVICENOTALLOWED?new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_AUDIODEVICE_NOTALLOWED,"audio device not allowed"):i.message===h.DeviceErrorDescription.ERRORMESSAGE_MACCHROME_DEVICENOTREADABLE||i.message===h.DeviceErrorDescription.ERRORMESSAGE_AUDIODEVICENOTREADABLE||i.message===h.DeviceErrorDescription.ERRORNAME_DEVICENOTREADABLE?new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_AUDIODEVICE_NOTREADABLE,"audio device not readable"):null},s.prototype.parseVideoError=function(i){return i.message===h.DeviceErrorDescription.ERRORMESSAGE_DEVICENOTFOUND||i.name===h.DeviceErrorDescription.ERRORNAME_DEVICENOTFOUND?new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_VIDEODEVICE_NOTFOUND,"video device not found"):i.message===h.DeviceErrorDescription.ERRORMESSAGE_DEVICENOTALLOWED||i.message===h.DeviceErrorDescription.ERRORMESSAGE_MOBILEDEVICE_NOTALLOWED||i.message===h.DeviceErrorDescription.ERRORMESSAGE_MACSAFARI_DEVICENOTALLOWED?new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_VIDEODEVICE_NOTALLOWED,"video device not allowed"):i.message===h.DeviceErrorDescription.ERRORMESSAGE_MACCHROME_DEVICENOTREADABLE||i.message===h.DeviceErrorDescription.ERRORMESSAGE_VIDEODEVICENOTREADABLE||i.name===h.DeviceErrorDescription.ERRORNAME_DEVICENOTREADABLE?new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_VIDEODEVICE_NOTREADABLE,"video device not readable"):null},s.prototype.parseMixedError=function(i){return i.message===h.DeviceErrorDescription.ERRORMESSAGE_DEVICENOTFOUND||i.name===h.DeviceErrorDescription.ERRORNAME_DEVICENOTFOUND?new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_NOTFOUND,"audio or video device not found"):i.message===h.DeviceErrorDescription.ERRORMESSAGE_DEVICENOTALLOWED||i.message===h.DeviceErrorDescription.ERRORMESSAGE_MACSAFARI_DEVICENOTALLOWED?new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_NOTALLOWED,"audio or video device not allowed"):i.message===h.DeviceErrorDescription.ERRORMESSAGE_MOBILEDEVICE_NOTALLOWED?new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_VIDEODEVICE_NOTALLOWED,"video device not allowed"):i.message===h.DeviceErrorDescription.ERRORMESSAGE_MACCHROME_DEVICENOTREADABLE||i.name===h.DeviceErrorDescription.ERRORNAME_DEVICENOTREADABLE?new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_NOTREADABLE,"audio or video device not readable"):i.message===h.DeviceErrorDescription.ERRORMESSAGE_AUDIODEVICENOTREADABLE?new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_AUDIODEVICE_NOTREADABLE,"audio device not readable"):i.message===h.DeviceErrorDescription.ERRORMESSAGE_VIDEODEVICENOTREADABLE?new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_VIDEODEVICE_NOTREADABLE,"video device not readable"):null},s.prototype.parseScreenError=function(i){return i.name===h.DeviceErrorDescription.ERRORNAME_DEVICENOTALLOWED?i.message===h.DeviceErrorDescription.ERRORMESSAGE_DEVICENOTALLOWED?new h.DeviceError(h.DeviceErrorCode.ERROR_SCREENSHARE_NOTALLOWED,i.message):new h.DeviceError(h.DeviceErrorCode.ERROR_SCREENSHARE_NOPERMISSION,i.message):i.name===h.DeviceErrorDescription.ERRORNAME_INVALID_ACCESS?new h.DeviceError(h.DeviceErrorCode.ERROR_SCREENSHARE_INVALIDACCESS,i.message):null},s.prototype.createVideoConstraints=function(i){var e={video:i};return Object.keys(i).length===0&&(e={video:!0}),e},s.prototype.createAudioConstraints=function(i){var e={audio:i};return Object.keys(i).length===0&&(e={audio:!0}),e},s.prototype.createMixedConstraints=function(i){return i},s}();l.BaseDeviceManager=u},913:function(f,l,m){var h,v=this&&this.__extends||(h=function(s,i){return(h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,o){e.__proto__=o}||function(e,o){for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])})(s,i)},function(s,i){function e(){this.constructor=s}h(s,i),s.prototype=i===null?Object.create(i):(e.prototype=i.prototype,new e)});Object.defineProperty(l,"__esModule",{value:!0}),l.IosDeviceManager=void 0;var u=function(s){function i(){return s.call(this)||this}return v(i,s),i}(m(583).MobileDeviceManager);l.IosDeviceManager=u},331:function(f,l,m){var h,v=this&&this.__extends||(h=function(s,i){return(h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,o){e.__proto__=o}||function(e,o){for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])})(s,i)},function(s,i){function e(){this.constructor=s}h(s,i),s.prototype=i===null?Object.create(i):(e.prototype=i.prototype,new e)});Object.defineProperty(l,"__esModule",{value:!0}),l.LinuxDeviceManager=void 0;var u=function(s){function i(){return s.call(this)||this}return v(i,s),i}(m(62).BaseDeviceManager);l.LinuxDeviceManager=u},1:function(f,l,m){var h,v=this&&this.__extends||(h=function(s,i){return(h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,o){e.__proto__=o}||function(e,o){for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])})(s,i)},function(s,i){function e(){this.constructor=s}h(s,i),s.prototype=i===null?Object.create(i):(e.prototype=i.prototype,new e)});Object.defineProperty(l,"__esModule",{value:!0}),l.MacDeviceManager=void 0;var u=function(s){function i(){return s.call(this)||this}return v(i,s),i}(m(62).BaseDeviceManager);l.MacDeviceManager=u},583:function(f,l,m){var h,v=this&&this.__extends||(h=function(i,e){return(h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(o[a]=r[a])})(i,e)},function(i,e){function o(){this.constructor=i}h(i,e),i.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)});Object.defineProperty(l,"__esModule",{value:!0}),l.MobileDeviceManager=void 0;var u=m(603),s=function(i){function e(){return i.call(this)||this}return v(e,i),e.prototype.checkSupportScreenShare=function(){return!1},e.prototype.getScreenTrack=function(o){return new Promise(function(r,a){a(new u.DeviceError(u.DeviceErrorCode.ERROR_SCREENSHARE_NOTSUPPORT,"mobile not support screenshare"))})},e.prototype.getScreenStream=function(o){return new Promise(function(r,a){a(new u.DeviceError(u.DeviceErrorCode.ERROR_SCREENSHARE_NOTSUPPORT,"mobile not support screenshare"))})},e}(m(62).BaseDeviceManager);l.MobileDeviceManager=s},935:function(f,l,m){var h,v=this&&this.__extends||(h=function(s,i){return(h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,o){e.__proto__=o}||function(e,o){for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])})(s,i)},function(s,i){function e(){this.constructor=s}h(s,i),s.prototype=i===null?Object.create(i):(e.prototype=i.prototype,new e)});Object.defineProperty(l,"__esModule",{value:!0}),l.WindowsDeviceManager=void 0;var u=function(s){function i(){return s.call(this)||this}return v(i,s),i}(m(62).BaseDeviceManager);l.WindowsDeviceManager=u},607:function(f,l,m){var h=this&&this.__createBinding||(Object.create?function(s,i,e,o){o===void 0&&(o=e),Object.defineProperty(s,o,{enumerable:!0,get:function(){return i[e]}})}:function(s,i,e,o){o===void 0&&(o=e),s[o]=i[e]}),v=this&&this.__exportStar||function(s,i){for(var e in s)e==="default"||Object.prototype.hasOwnProperty.call(i,e)||h(i,s,e)};Object.defineProperty(l,"__esModule",{value:!0}),l.BrowserDeviceManager=void 0;var u=m(304);Object.defineProperty(l,"BrowserDeviceManager",{enumerable:!0,get:function(){return u.BrowserDeviceManager}}),v(m(873),l),window&&(window.BrowserDeviceManager=u.BrowserDeviceManager)},610:(f,l,m)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.LinkUtil=void 0;var h,v=m(603),u=m(261),s=m(54);(function(a){a[a.Windows=0]="Windows",a[a.MacOS=1]="MacOS",a[a.Other=2]="Other"})(h||(h={}));var i="ms-settings:",e="x-apple.systempreferences:com.apple.preference.security?",o={SYS_MIC:[i+"privacy-microphone",e+"Privacy_Microphone"],SYS_CAMERA:[i+"privacy-webcam",e+"Privacy_Camera"],SYS_SCREENSHARE:["",e+"Privacy_ScreenCapture"]},r=function(){function a(){u||console.error("SystemUtil is not found"),this.systemType=this.getSystemType()}return a.prototype.getRelatedLink=function(t){var n="",c=this.systemType;switch(t){case v.DeviceErrorCode.ERROR_DEVICE_AUDIODEVICE_NOTFOUND:case v.DeviceErrorCode.ERROR_DEVICE_AUDIODEVICE_NOTREADABLE:n=o.SYS_MIC[c];break;case v.DeviceErrorCode.ERROR_DEVICE_VIDEODEVICE_NOTFOUND:case v.DeviceErrorCode.ERROR_DEVICE_VIDEODEVICE_NOTREADABLE:n=o.SYS_CAMERA[c];break;case v.DeviceErrorCode.ERROR_SCREENSHARE_UNKNOWNERRO:case v.DeviceErrorCode.ERROR_SCREENSHARE_NOPERMISSION:n=o.SYS_SCREENSHARE[c];break;case v.DeviceErrorCode.ERROR_DEVICE_AUDIODEVICE_NOTALLOWED:case v.DeviceErrorCode.ERROR_DEVICE_VIDEODEVICE_NOTALLOWED:case v.DeviceErrorCode.ERROR_DEVICE_NOTALLOWED:s.isChrome?n=this.getChromeResetLink():s.isEdge&&(n=this.getEdgeResetLink());break;default:n=""}return n},a.prototype.getSystemType=function(){return u.isWindows?h.Windows:u.isMacOS?h.MacOS:h.Other},a.prototype.getChromeResetLink=function(){return"chrome://settings/content/siteDetails?site="+encodeURIComponent(window.location.origin)},a.prototype.getEdgeResetLink=function(){return"edge://settings/content/siteDetails?site="+encodeURIComponent(window.location.origin)},a}();l.LinkUtil=r},101:(f,l)=>{var m;Object.defineProperty(l,"__esModule",{value:!0}),l.SystemUtil=void 0,function(v){v[v.Unknown=0]="Unknown",v[v.MacOS=1]="MacOS",v[v.Windows=2]="Windows",v[v.Android=3]="Android",v[v.Iphone=4]="Iphone",v[v.Ipad=5]="Ipad",v[v.Linux=6]="Linux"}(m||(m={}));var h=function(){function v(){this.systemType=m.Unknown,this.getSystemInfo()}return Object.defineProperty(v.prototype,"isIos",{get:function(){return this.systemType===m.Ipad||this.systemType===m.Iphone},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"isAndroid",{get:function(){return this.systemType===m.Android},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"isMacOS",{get:function(){return this.systemType===m.MacOS},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"isWindows",{get:function(){return this.systemType===m.Windows},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"isLinux",{get:function(){return this.systemType===m.Linux},enumerable:!1,configurable:!0}),v.prototype.getSystemInfo=function(){if(navigator&&navigator.userAgent){var u=navigator.userAgent.toLocaleLowerCase();u.indexOf("ipad")>-1?this.systemType=m.Ipad:u.indexOf("iphone")>-1?this.systemType=m.Iphone:u.indexOf("android")>-1?this.systemType=m.Android:u.indexOf("win")>-1?this.systemType=m.Windows:u.indexOf("mac")>-1?this.systemType=m.MacOS:u.indexOf("linux")>-1?this.systemType=m.Linux:u.indexOf("")>-1&&(this.systemType=m.Unknown)}},v}();l.SystemUtil=h},54:f=>{f.exports=window.BrowserUtil},261:f=>{f.exports=window.SystemUtil}},_={};return function f(l){if(_[l])return _[l].exports;var m=_[l]={exports:{}};return T[l].call(m.exports,m,m.exports,f),m.exports}(607)})()},6677:(H,T,_)=>{var f=_(7963);function l(s,i,e,o,r){var a=f.writeRtpDescription(s.kind,i);if(a+=f.writeIceParameters(s.iceGatherer.getLocalParameters()),a+=f.writeDtlsParameters(s.dtlsTransport.getLocalParameters(),e==="offer"?"actpass":r||"active"),a+="a=mid:"+s.mid+`\r
80
+ `,s.rtpSender&&s.rtpReceiver?a+=`a=sendrecv\r
81
+ `:s.rtpSender?a+=`a=sendonly\r
82
+ `:s.rtpReceiver?a+=`a=recvonly\r
83
+ `:a+=`a=inactive\r
84
+ `,s.rtpSender){var t=s.rtpSender._initialTrackId||s.rtpSender.track.id;s.rtpSender._initialTrackId=t;var n="msid:"+(o?o.id:"-")+" "+t+`\r
85
+ `;a+="a="+n,a+="a=ssrc:"+s.sendEncodingParameters[0].ssrc+" "+n,s.sendEncodingParameters[0].rtx&&(a+="a=ssrc:"+s.sendEncodingParameters[0].rtx.ssrc+" "+n,a+="a=ssrc-group:FID "+s.sendEncodingParameters[0].ssrc+" "+s.sendEncodingParameters[0].rtx.ssrc+`\r
86
+ `)}return a+="a=ssrc:"+s.sendEncodingParameters[0].ssrc+" cname:"+f.localCName+`\r
87
+ `,s.rtpSender&&s.sendEncodingParameters[0].rtx&&(a+="a=ssrc:"+s.sendEncodingParameters[0].rtx.ssrc+" cname:"+f.localCName+`\r
88
+ `),a}function m(s,i){var e={codecs:[],headerExtensions:[],fecMechanisms:[]},o=function(a,t){a=parseInt(a,10);for(var n=0;n<t.length;n++)if(t[n].payloadType===a||t[n].preferredPayloadType===a)return t[n]},r=function(a,t,n,c){var p=o(a.parameters.apt,n),C=o(t.parameters.apt,c);return p&&C&&p.name.toLowerCase()===C.name.toLowerCase()};return s.codecs.forEach(function(a){for(var t=0;t<i.codecs.length;t++){var n=i.codecs[t];if(a.name.toLowerCase()===n.name.toLowerCase()&&a.clockRate===n.clockRate){if(a.name.toLowerCase()==="rtx"&&a.parameters&&n.parameters.apt&&!r(a,n,s.codecs,i.codecs))continue;(n=JSON.parse(JSON.stringify(n))).numChannels=Math.min(a.numChannels,n.numChannels),e.codecs.push(n),n.rtcpFeedback=n.rtcpFeedback.filter(function(c){for(var p=0;p<a.rtcpFeedback.length;p++)if(a.rtcpFeedback[p].type===c.type&&a.rtcpFeedback[p].parameter===c.parameter)return!0;return!1});break}}}),s.headerExtensions.forEach(function(a){for(var t=0;t<i.headerExtensions.length;t++){var n=i.headerExtensions[t];if(a.uri===n.uri){e.headerExtensions.push(n);break}}}),e}function h(s,i,e){return{offer:{setLocalDescription:["stable","have-local-offer"],setRemoteDescription:["stable","have-remote-offer"]},answer:{setLocalDescription:["have-remote-offer","have-local-pranswer"],setRemoteDescription:["have-local-offer","have-remote-pranswer"]}}[i][s].indexOf(e)!==-1}function v(s,i){var e=s.getRemoteCandidates().find(function(o){return i.foundation===o.foundation&&i.ip===o.ip&&i.port===o.port&&i.priority===o.priority&&i.protocol===o.protocol&&i.type===o.type});return e||s.addRemoteCandidate(i),!e}function u(s,i){var e=new Error(i);return e.name=s,e.code={NotSupportedError:9,InvalidStateError:11,InvalidAccessError:15,TypeError:void 0,OperationError:void 0}[s],e}H.exports=function(s,i){function e(t,n){n.addTrack(t),n.dispatchEvent(new s.MediaStreamTrackEvent("addtrack",{track:t}))}function o(t,n,c,p){var C=new Event("track");C.track=n,C.receiver=c,C.transceiver={receiver:c},C.streams=p,s.setTimeout(function(){t._dispatchEvent("track",C)})}var r=function(t){var n=this,c=document.createDocumentFragment();if(["addEventListener","removeEventListener","dispatchEvent"].forEach(function(C){n[C]=c[C].bind(c)}),this.canTrickleIceCandidates=null,this.needNegotiation=!1,this.localStreams=[],this.remoteStreams=[],this._localDescription=null,this._remoteDescription=null,this.signalingState="stable",this.iceConnectionState="new",this.connectionState="new",this.iceGatheringState="new",t=JSON.parse(JSON.stringify(t||{})),this.usingBundle=t.bundlePolicy==="max-bundle",t.rtcpMuxPolicy==="negotiate")throw u("NotSupportedError","rtcpMuxPolicy 'negotiate' is not supported");switch(t.rtcpMuxPolicy||(t.rtcpMuxPolicy="require"),t.iceTransportPolicy){case"all":case"relay":break;default:t.iceTransportPolicy="all"}switch(t.bundlePolicy){case"balanced":case"max-compat":case"max-bundle":break;default:t.bundlePolicy="balanced"}if(t.iceServers=function(C,x){var y=!1;return(C=JSON.parse(JSON.stringify(C))).filter(function(E){if(E&&(E.urls||E.url)){var S=E.urls||E.url;E.url&&!E.urls&&console.warn("RTCIceServer.url is deprecated! Use urls instead.");var d=typeof S=="string";return d&&(S=[S]),S=S.filter(function(R){return R.indexOf("turn:")!==0||R.indexOf("transport=udp")===-1||R.indexOf("turn:[")!==-1||y?R.indexOf("stun:")===0&&x>=14393&&R.indexOf("?transport=udp")===-1:(y=!0,!0)}),delete E.url,E.urls=d?S[0]:S,!!S.length}})}(t.iceServers||[],i),this._iceGatherers=[],t.iceCandidatePoolSize)for(var p=t.iceCandidatePoolSize;p>0;p--)this._iceGatherers.push(new s.RTCIceGatherer({iceServers:t.iceServers,gatherPolicy:t.iceTransportPolicy}));else t.iceCandidatePoolSize=0;this._config=t,this.transceivers=[],this._sdpSessionId=f.generateSessionId(),this._sdpSessionVersion=0,this._dtlsRole=void 0,this._isClosed=!1};Object.defineProperty(r.prototype,"localDescription",{configurable:!0,get:function(){return this._localDescription}}),Object.defineProperty(r.prototype,"remoteDescription",{configurable:!0,get:function(){return this._remoteDescription}}),r.prototype.onicecandidate=null,r.prototype.onaddstream=null,r.prototype.ontrack=null,r.prototype.onremovestream=null,r.prototype.onsignalingstatechange=null,r.prototype.oniceconnectionstatechange=null,r.prototype.onconnectionstatechange=null,r.prototype.onicegatheringstatechange=null,r.prototype.onnegotiationneeded=null,r.prototype.ondatachannel=null,r.prototype._dispatchEvent=function(t,n){this._isClosed||(this.dispatchEvent(n),typeof this["on"+t]=="function"&&this["on"+t](n))},r.prototype._emitGatheringStateChange=function(){var t=new Event("icegatheringstatechange");this._dispatchEvent("icegatheringstatechange",t)},r.prototype.getConfiguration=function(){return this._config},r.prototype.getLocalStreams=function(){return this.localStreams},r.prototype.getRemoteStreams=function(){return this.remoteStreams},r.prototype._createTransceiver=function(t,n){var c=this.transceivers.length>0,p={track:null,iceGatherer:null,iceTransport:null,dtlsTransport:null,localCapabilities:null,remoteCapabilities:null,rtpSender:null,rtpReceiver:null,kind:t,mid:null,sendEncodingParameters:null,recvEncodingParameters:null,stream:null,associatedRemoteMediaStreams:[],wantReceive:!0};if(this.usingBundle&&c)p.iceTransport=this.transceivers[0].iceTransport,p.dtlsTransport=this.transceivers[0].dtlsTransport;else{var C=this._createIceAndDtlsTransports();p.iceTransport=C.iceTransport,p.dtlsTransport=C.dtlsTransport}return n||this.transceivers.push(p),p},r.prototype.addTrack=function(t,n){if(this._isClosed)throw u("InvalidStateError","Attempted to call addTrack on a closed peerconnection.");var c;if(this.transceivers.find(function(C){return C.track===t}))throw u("InvalidAccessError","Track already exists.");for(var p=0;p<this.transceivers.length;p++)this.transceivers[p].track||this.transceivers[p].kind!==t.kind||(c=this.transceivers[p]);return c||(c=this._createTransceiver(t.kind)),this._maybeFireNegotiationNeeded(),this.localStreams.indexOf(n)===-1&&this.localStreams.push(n),c.track=t,c.stream=n,c.rtpSender=new s.RTCRtpSender(t,c.dtlsTransport),c.rtpSender},r.prototype.addStream=function(t){var n=this;if(i>=15025)t.getTracks().forEach(function(p){n.addTrack(p,t)});else{var c=t.clone();t.getTracks().forEach(function(p,C){var x=c.getTracks()[C];p.addEventListener("enabled",function(y){x.enabled=y.enabled})}),c.getTracks().forEach(function(p){n.addTrack(p,c)})}},r.prototype.removeTrack=function(t){if(this._isClosed)throw u("InvalidStateError","Attempted to call removeTrack on a closed peerconnection.");if(!(t instanceof s.RTCRtpSender))throw new TypeError("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.");var n=this.transceivers.find(function(p){return p.rtpSender===t});if(!n)throw u("InvalidAccessError","Sender was not created by this connection.");var c=n.stream;n.rtpSender.stop(),n.rtpSender=null,n.track=null,n.stream=null,this.transceivers.map(function(p){return p.stream}).indexOf(c)===-1&&this.localStreams.indexOf(c)>-1&&this.localStreams.splice(this.localStreams.indexOf(c),1),this._maybeFireNegotiationNeeded()},r.prototype.removeStream=function(t){var n=this;t.getTracks().forEach(function(c){var p=n.getSenders().find(function(C){return C.track===c});p&&n.removeTrack(p)})},r.prototype.getSenders=function(){return this.transceivers.filter(function(t){return!!t.rtpSender}).map(function(t){return t.rtpSender})},r.prototype.getReceivers=function(){return this.transceivers.filter(function(t){return!!t.rtpReceiver}).map(function(t){return t.rtpReceiver})},r.prototype._createIceGatherer=function(t,n){var c=this;if(n&&t>0)return this.transceivers[0].iceGatherer;if(this._iceGatherers.length)return this._iceGatherers.shift();var p=new s.RTCIceGatherer({iceServers:this._config.iceServers,gatherPolicy:this._config.iceTransportPolicy});return Object.defineProperty(p,"state",{value:"new",writable:!0}),this.transceivers[t].bufferedCandidateEvents=[],this.transceivers[t].bufferCandidates=function(C){var x=!C.candidate||Object.keys(C.candidate).length===0;p.state=x?"completed":"gathering",c.transceivers[t].bufferedCandidateEvents!==null&&c.transceivers[t].bufferedCandidateEvents.push(C)},p.addEventListener("localcandidate",this.transceivers[t].bufferCandidates),p},r.prototype._gather=function(t,n){var c=this,p=this.transceivers[n].iceGatherer;if(!p.onlocalcandidate){var C=this.transceivers[n].bufferedCandidateEvents;this.transceivers[n].bufferedCandidateEvents=null,p.removeEventListener("localcandidate",this.transceivers[n].bufferCandidates),p.onlocalcandidate=function(x){if(!(c.usingBundle&&n>0)){var y=new Event("icecandidate");y.candidate={sdpMid:t,sdpMLineIndex:n};var E=x.candidate,S=!E||Object.keys(E).length===0;if(S)p.state!=="new"&&p.state!=="gathering"||(p.state="completed");else{p.state==="new"&&(p.state="gathering"),E.component=1,E.ufrag=p.getLocalParameters().usernameFragment;var d=f.writeCandidate(E);y.candidate=Object.assign(y.candidate,f.parseCandidate(d)),y.candidate.candidate=d,y.candidate.toJSON=function(){return{candidate:y.candidate.candidate,sdpMid:y.candidate.sdpMid,sdpMLineIndex:y.candidate.sdpMLineIndex,usernameFragment:y.candidate.usernameFragment}}}var R=f.getMediaSections(c._localDescription.sdp);R[y.candidate.sdpMLineIndex]+=S?`a=end-of-candidates\r
89
+ `:"a="+y.candidate.candidate+`\r
90
+ `,c._localDescription.sdp=f.getDescription(c._localDescription.sdp)+R.join("");var D=c.transceivers.every(function(A){return A.iceGatherer&&A.iceGatherer.state==="completed"});c.iceGatheringState!=="gathering"&&(c.iceGatheringState="gathering",c._emitGatheringStateChange()),S||c._dispatchEvent("icecandidate",y),D&&(c._dispatchEvent("icecandidate",new Event("icecandidate")),c.iceGatheringState="complete",c._emitGatheringStateChange())}},s.setTimeout(function(){C.forEach(function(x){p.onlocalcandidate(x)})},0)}},r.prototype._createIceAndDtlsTransports=function(){var t=this,n=new s.RTCIceTransport(null);n.onicestatechange=function(){t._updateIceConnectionState(),t._updateConnectionState()};var c=new s.RTCDtlsTransport(n);return c.ondtlsstatechange=function(){t._updateConnectionState()},c.onerror=function(){Object.defineProperty(c,"state",{value:"failed",writable:!0}),t._updateConnectionState()},{iceTransport:n,dtlsTransport:c}},r.prototype._disposeIceAndDtlsTransports=function(t){var n=this.transceivers[t].iceGatherer;n&&(delete n.onlocalcandidate,delete this.transceivers[t].iceGatherer);var c=this.transceivers[t].iceTransport;c&&(delete c.onicestatechange,delete this.transceivers[t].iceTransport);var p=this.transceivers[t].dtlsTransport;p&&(delete p.ondtlsstatechange,delete p.onerror,delete this.transceivers[t].dtlsTransport)},r.prototype._transceive=function(t,n,c){var p=m(t.localCapabilities,t.remoteCapabilities);n&&t.rtpSender&&(p.encodings=t.sendEncodingParameters,p.rtcp={cname:f.localCName,compound:t.rtcpParameters.compound},t.recvEncodingParameters.length&&(p.rtcp.ssrc=t.recvEncodingParameters[0].ssrc),t.rtpSender.send(p)),c&&t.rtpReceiver&&p.codecs.length>0&&(t.kind==="video"&&t.recvEncodingParameters&&i<15019&&t.recvEncodingParameters.forEach(function(C){delete C.rtx}),t.recvEncodingParameters.length?p.encodings=t.recvEncodingParameters:p.encodings=[{}],p.rtcp={compound:t.rtcpParameters.compound},t.rtcpParameters.cname&&(p.rtcp.cname=t.rtcpParameters.cname),t.sendEncodingParameters.length&&(p.rtcp.ssrc=t.sendEncodingParameters[0].ssrc),t.rtpReceiver.receive(p))},r.prototype.setLocalDescription=function(t){var n,c,p=this;if(["offer","answer"].indexOf(t.type)===-1)return Promise.reject(u("TypeError",'Unsupported type "'+t.type+'"'));if(!h("setLocalDescription",t.type,p.signalingState)||p._isClosed)return Promise.reject(u("InvalidStateError","Can not set local "+t.type+" in state "+p.signalingState));if(t.type==="offer")n=f.splitSections(t.sdp),c=n.shift(),n.forEach(function(x,y){var E=f.parseRtpParameters(x);p.transceivers[y].localCapabilities=E}),p.transceivers.forEach(function(x,y){p._gather(x.mid,y)});else if(t.type==="answer"){n=f.splitSections(p._remoteDescription.sdp),c=n.shift();var C=f.matchPrefix(c,"a=ice-lite").length>0;n.forEach(function(x,y){var E=p.transceivers[y],S=E.iceGatherer,d=E.iceTransport,R=E.dtlsTransport,D=E.localCapabilities,A=E.remoteCapabilities;if(!(f.isRejected(x)&&f.matchPrefix(x,"a=bundle-only").length===0)&&!E.rejected){var b=f.getIceParameters(x,c),g=f.getDtlsParameters(x,c);C&&(g.role="server"),p.usingBundle&&y!==0||(p._gather(E.mid,y),d.state==="new"&&d.start(S,b,C?"controlling":"controlled"),R.state==="new"&&R.start(g));var O=m(D,A);p._transceive(E,O.codecs.length>0,!1)}})}return p._localDescription={type:t.type,sdp:t.sdp},t.type==="offer"?p._updateSignalingState("have-local-offer"):p._updateSignalingState("stable"),Promise.resolve()},r.prototype.setRemoteDescription=function(t){var n=this;if(["offer","answer"].indexOf(t.type)===-1)return Promise.reject(u("TypeError",'Unsupported type "'+t.type+'"'));if(!h("setRemoteDescription",t.type,n.signalingState)||n._isClosed)return Promise.reject(u("InvalidStateError","Can not set remote "+t.type+" in state "+n.signalingState));var c={};n.remoteStreams.forEach(function(d){c[d.id]=d});var p=[],C=f.splitSections(t.sdp),x=C.shift(),y=f.matchPrefix(x,"a=ice-lite").length>0,E=f.matchPrefix(x,"a=group:BUNDLE ").length>0;n.usingBundle=E;var S=f.matchPrefix(x,"a=ice-options:")[0];return n.canTrickleIceCandidates=!!S&&S.substr(14).split(" ").indexOf("trickle")>=0,C.forEach(function(d,R){var D=f.splitLines(d),A=f.getKind(d),b=f.isRejected(d)&&f.matchPrefix(d,"a=bundle-only").length===0,g=D[0].substr(2).split(" ")[2],O=f.getDirection(d,x),k=f.parseMsid(d),U=f.getMid(d)||f.generateIdentifier();if(b||A==="application"&&(g==="DTLS/SCTP"||g==="UDP/DTLS/SCTP"))n.transceivers[R]={mid:U,kind:A,protocol:g,rejected:!0};else{var w,W,M,N,P,V,j,z,G;!b&&n.transceivers[R]&&n.transceivers[R].rejected&&(n.transceivers[R]=n._createTransceiver(A,!0));var X,re,te=f.parseRtpParameters(d);b||(X=f.getIceParameters(d,x),(re=f.getDtlsParameters(d,x)).role="client"),j=f.parseRtpEncodingParameters(d);var oe=f.parseRtcpParameters(d),ue=f.matchPrefix(d,"a=end-of-candidates",x).length>0,se=f.matchPrefix(d,"a=candidate:").map(function(pe){return f.parseCandidate(pe)}).filter(function(pe){return pe.component===1});if((t.type==="offer"||t.type==="answer")&&!b&&E&&R>0&&n.transceivers[R]&&(n._disposeIceAndDtlsTransports(R),n.transceivers[R].iceGatherer=n.transceivers[0].iceGatherer,n.transceivers[R].iceTransport=n.transceivers[0].iceTransport,n.transceivers[R].dtlsTransport=n.transceivers[0].dtlsTransport,n.transceivers[R].rtpSender&&n.transceivers[R].rtpSender.setTransport(n.transceivers[0].dtlsTransport),n.transceivers[R].rtpReceiver&&n.transceivers[R].rtpReceiver.setTransport(n.transceivers[0].dtlsTransport)),t.type!=="offer"||b)t.type==="answer"&&!b&&(W=(w=n.transceivers[R]).iceGatherer,M=w.iceTransport,N=w.dtlsTransport,P=w.rtpReceiver,V=w.sendEncodingParameters,z=w.localCapabilities,n.transceivers[R].recvEncodingParameters=j,n.transceivers[R].remoteCapabilities=te,n.transceivers[R].rtcpParameters=oe,se.length&&M.state==="new"&&(!y&&!ue||E&&R!==0?se.forEach(function(pe){v(w.iceTransport,pe)}):M.setRemoteCandidates(se)),E&&R!==0||(M.state==="new"&&M.start(W,X,"controlling"),N.state==="new"&&N.start(re)),!m(w.localCapabilities,w.remoteCapabilities).codecs.filter(function(pe){return pe.name.toLowerCase()==="rtx"}).length&&w.sendEncodingParameters[0].rtx&&delete w.sendEncodingParameters[0].rtx,n._transceive(w,O==="sendrecv"||O==="recvonly",O==="sendrecv"||O==="sendonly"),!P||O!=="sendrecv"&&O!=="sendonly"?delete w.rtpReceiver:(G=P.track,k?(c[k.stream]||(c[k.stream]=new s.MediaStream),e(G,c[k.stream]),p.push([G,P,c[k.stream]])):(c.default||(c.default=new s.MediaStream),e(G,c.default),p.push([G,P,c.default]))));else{(w=n.transceivers[R]||n._createTransceiver(A)).mid=U,w.iceGatherer||(w.iceGatherer=n._createIceGatherer(R,E)),se.length&&w.iceTransport.state==="new"&&(!ue||E&&R!==0?se.forEach(function(pe){v(w.iceTransport,pe)}):w.iceTransport.setRemoteCandidates(se)),z=s.RTCRtpReceiver.getCapabilities(A),i<15019&&(z.codecs=z.codecs.filter(function(pe){return pe.name!=="rtx"})),V=w.sendEncodingParameters||[{ssrc:1001*(2*R+2)}];var ce,de=!1;O==="sendrecv"||O==="sendonly"?(de=!w.rtpReceiver,P=w.rtpReceiver||new s.RTCRtpReceiver(w.dtlsTransport,A),de&&(G=P.track,k&&k.stream==="-"||(k?(c[k.stream]||(c[k.stream]=new s.MediaStream,Object.defineProperty(c[k.stream],"id",{get:function(){return k.stream}})),Object.defineProperty(G,"id",{get:function(){return k.track}}),ce=c[k.stream]):(c.default||(c.default=new s.MediaStream),ce=c.default)),ce&&(e(G,ce),w.associatedRemoteMediaStreams.push(ce)),p.push([G,P,ce]))):w.rtpReceiver&&w.rtpReceiver.track&&(w.associatedRemoteMediaStreams.forEach(function(pe){var he=pe.getTracks().find(function(Ee){return Ee.id===w.rtpReceiver.track.id});he&&function(Ee,fe){fe.removeTrack(Ee),fe.dispatchEvent(new s.MediaStreamTrackEvent("removetrack",{track:Ee}))}(he,pe)}),w.associatedRemoteMediaStreams=[]),w.localCapabilities=z,w.remoteCapabilities=te,w.rtpReceiver=P,w.rtcpParameters=oe,w.sendEncodingParameters=V,w.recvEncodingParameters=j,n._transceive(n.transceivers[R],!1,de)}}}),n._dtlsRole===void 0&&(n._dtlsRole=t.type==="offer"?"active":"passive"),n._remoteDescription={type:t.type,sdp:t.sdp},t.type==="offer"?n._updateSignalingState("have-remote-offer"):n._updateSignalingState("stable"),Object.keys(c).forEach(function(d){var R=c[d];if(R.getTracks().length){if(n.remoteStreams.indexOf(R)===-1){n.remoteStreams.push(R);var D=new Event("addstream");D.stream=R,s.setTimeout(function(){n._dispatchEvent("addstream",D)})}p.forEach(function(A){var b=A[0],g=A[1];R.id===A[2].id&&o(n,b,g,[R])})}}),p.forEach(function(d){d[2]||o(n,d[0],d[1],[])}),s.setTimeout(function(){n&&n.transceivers&&n.transceivers.forEach(function(d){d.iceTransport&&d.iceTransport.state==="new"&&d.iceTransport.getRemoteCandidates().length>0&&(console.warn("Timeout for addRemoteCandidate. Consider sending an end-of-candidates notification"),d.iceTransport.addRemoteCandidate({}))})},4e3),Promise.resolve()},r.prototype.close=function(){this.transceivers.forEach(function(t){t.iceTransport&&t.iceTransport.stop(),t.dtlsTransport&&t.dtlsTransport.stop(),t.rtpSender&&t.rtpSender.stop(),t.rtpReceiver&&t.rtpReceiver.stop()}),this._isClosed=!0,this._updateSignalingState("closed")},r.prototype._updateSignalingState=function(t){this.signalingState=t;var n=new Event("signalingstatechange");this._dispatchEvent("signalingstatechange",n)},r.prototype._maybeFireNegotiationNeeded=function(){var t=this;this.signalingState==="stable"&&this.needNegotiation!==!0&&(this.needNegotiation=!0,s.setTimeout(function(){if(t.needNegotiation){t.needNegotiation=!1;var n=new Event("negotiationneeded");t._dispatchEvent("negotiationneeded",n)}},0))},r.prototype._updateIceConnectionState=function(){var t,n={new:0,closed:0,checking:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach(function(p){p.iceTransport&&!p.rejected&&n[p.iceTransport.state]++}),t="new",n.failed>0?t="failed":n.checking>0?t="checking":n.disconnected>0?t="disconnected":n.new>0?t="new":n.connected>0?t="connected":n.completed>0&&(t="completed"),t!==this.iceConnectionState){this.iceConnectionState=t;var c=new Event("iceconnectionstatechange");this._dispatchEvent("iceconnectionstatechange",c)}},r.prototype._updateConnectionState=function(){var t,n={new:0,closed:0,connecting:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach(function(p){p.iceTransport&&p.dtlsTransport&&!p.rejected&&(n[p.iceTransport.state]++,n[p.dtlsTransport.state]++)}),n.connected+=n.completed,t="new",n.failed>0?t="failed":n.connecting>0?t="connecting":n.disconnected>0?t="disconnected":n.new>0?t="new":n.connected>0&&(t="connected"),t!==this.connectionState){this.connectionState=t;var c=new Event("connectionstatechange");this._dispatchEvent("connectionstatechange",c)}},r.prototype.createOffer=function(){var t=this;if(t._isClosed)return Promise.reject(u("InvalidStateError","Can not call createOffer after close"));var n=t.transceivers.filter(function(y){return y.kind==="audio"}).length,c=t.transceivers.filter(function(y){return y.kind==="video"}).length,p=arguments[0];if(p){if(p.mandatory||p.optional)throw new TypeError("Legacy mandatory/optional constraints not supported.");p.offerToReceiveAudio!==void 0&&(n=p.offerToReceiveAudio===!0?1:p.offerToReceiveAudio===!1?0:p.offerToReceiveAudio),p.offerToReceiveVideo!==void 0&&(c=p.offerToReceiveVideo===!0?1:p.offerToReceiveVideo===!1?0:p.offerToReceiveVideo)}for(t.transceivers.forEach(function(y){y.kind==="audio"?--n<0&&(y.wantReceive=!1):y.kind==="video"&&--c<0&&(y.wantReceive=!1)});n>0||c>0;)n>0&&(t._createTransceiver("audio"),n--),c>0&&(t._createTransceiver("video"),c--);var C=f.writeSessionBoilerplate(t._sdpSessionId,t._sdpSessionVersion++);t.transceivers.forEach(function(y,E){var S=y.track,d=y.kind,R=y.mid||f.generateIdentifier();y.mid=R,y.iceGatherer||(y.iceGatherer=t._createIceGatherer(E,t.usingBundle));var D=s.RTCRtpSender.getCapabilities(d);i<15019&&(D.codecs=D.codecs.filter(function(b){return b.name!=="rtx"})),D.codecs.forEach(function(b){b.name==="H264"&&b.parameters["level-asymmetry-allowed"]===void 0&&(b.parameters["level-asymmetry-allowed"]="1"),y.remoteCapabilities&&y.remoteCapabilities.codecs&&y.remoteCapabilities.codecs.forEach(function(g){b.name.toLowerCase()===g.name.toLowerCase()&&b.clockRate===g.clockRate&&(b.preferredPayloadType=g.payloadType)})}),D.headerExtensions.forEach(function(b){(y.remoteCapabilities&&y.remoteCapabilities.headerExtensions||[]).forEach(function(g){b.uri===g.uri&&(b.id=g.id)})});var A=y.sendEncodingParameters||[{ssrc:1001*(2*E+1)}];S&&i>=15019&&d==="video"&&!A[0].rtx&&(A[0].rtx={ssrc:A[0].ssrc+1}),y.wantReceive&&(y.rtpReceiver=new s.RTCRtpReceiver(y.dtlsTransport,d)),y.localCapabilities=D,y.sendEncodingParameters=A}),t._config.bundlePolicy!=="max-compat"&&(C+="a=group:BUNDLE "+t.transceivers.map(function(y){return y.mid}).join(" ")+`\r
91
+ `),C+=`a=ice-options:trickle\r
92
+ `,t.transceivers.forEach(function(y,E){C+=l(y,y.localCapabilities,"offer",y.stream,t._dtlsRole),C+=`a=rtcp-rsize\r
93
+ `,!y.iceGatherer||t.iceGatheringState==="new"||E!==0&&t.usingBundle||(y.iceGatherer.getLocalCandidates().forEach(function(S){S.component=1,C+="a="+f.writeCandidate(S)+`\r
94
+ `}),y.iceGatherer.state==="completed"&&(C+=`a=end-of-candidates\r
95
+ `))});var x=new s.RTCSessionDescription({type:"offer",sdp:C});return Promise.resolve(x)},r.prototype.createAnswer=function(){var t=this;if(t._isClosed)return Promise.reject(u("InvalidStateError","Can not call createAnswer after close"));if(t.signalingState!=="have-remote-offer"&&t.signalingState!=="have-local-pranswer")return Promise.reject(u("InvalidStateError","Can not call createAnswer in signalingState "+t.signalingState));var n=f.writeSessionBoilerplate(t._sdpSessionId,t._sdpSessionVersion++);t.usingBundle&&(n+="a=group:BUNDLE "+t.transceivers.map(function(C){return C.mid}).join(" ")+`\r
96
96
  `),n+=`a=ice-options:trickle\r
97
- `;var u=m.getMediaSections(t._remoteDescription.sdp).length;t.transceivers.forEach(function(S,x){if(!(x+1>u)){if(S.rejected)return S.kind==="application"?S.protocol==="DTLS/SCTP"?n+=`m=application 0 DTLS/SCTP 5000\r
98
- `:n+="m=application 0 "+S.protocol+` webrtc-datachannel\r
99
- `:S.kind==="audio"?n+=`m=audio 0 UDP/TLS/RTP/SAVPF 0\r
97
+ `;var c=f.getMediaSections(t._remoteDescription.sdp).length;t.transceivers.forEach(function(C,x){if(!(x+1>c)){if(C.rejected)return C.kind==="application"?C.protocol==="DTLS/SCTP"?n+=`m=application 0 DTLS/SCTP 5000\r
98
+ `:n+="m=application 0 "+C.protocol+` webrtc-datachannel\r
99
+ `:C.kind==="audio"?n+=`m=audio 0 UDP/TLS/RTP/SAVPF 0\r
100
100
  a=rtpmap:0 PCMU/8000\r
101
- `:S.kind==="video"&&(n+=`m=video 0 UDP/TLS/RTP/SAVPF 120\r
101
+ `:C.kind==="video"&&(n+=`m=video 0 UDP/TLS/RTP/SAVPF 120\r
102
102
  a=rtpmap:120 VP8/90000\r
103
103
  `),void(n+=`c=IN IP4 0.0.0.0\r
104
104
  a=inactive\r
105
- a=mid:`+S.mid+`\r
106
- `);var E;S.stream&&(S.kind==="audio"?E=S.stream.getAudioTracks()[0]:S.kind==="video"&&(E=S.stream.getVideoTracks()[0]),E&&a>=15019&&S.kind==="video"&&!S.sendEncodingParameters[0].rtx&&(S.sendEncodingParameters[0].rtx={ssrc:S.sendEncodingParameters[0].ssrc+1}));var p=f(S.localCapabilities,S.remoteCapabilities);!p.codecs.filter(function(b){return b.name.toLowerCase()==="rtx"}).length&&S.sendEncodingParameters[0].rtx&&delete S.sendEncodingParameters[0].rtx,n+=d(S,p,"answer",S.stream,t._dtlsRole),S.rtcpParameters&&S.rtcpParameters.reducedSize&&(n+=`a=rtcp-rsize\r
107
- `)}});var h=new c.RTCSessionDescription({type:"answer",sdp:n});return Promise.resolve(h)},i.prototype.addIceCandidate=function(t){var n,u=this;return t&&t.sdpMLineIndex===void 0&&!t.sdpMid?Promise.reject(new TypeError("sdpMLineIndex or sdpMid required")):new Promise(function(h,S){if(!u._remoteDescription)return S(s("InvalidStateError","Can not add ICE candidate without a remote description"));if(t&&t.candidate!==""){var x=t.sdpMLineIndex;if(t.sdpMid){for(var E=0;E<u.transceivers.length;E++)if(u.transceivers[E].mid===t.sdpMid){x=E;break}}var p=u.transceivers[x];if(!p)return S(s("OperationError","Can not add ICE candidate"));if(p.rejected)return h();var b=Object.keys(t.candidate).length>0?m.parseCandidate(t.candidate):{};if(b.protocol==="tcp"&&(b.port===0||b.port===9)||b.component&&b.component!==1)return h();if((x===0||x>0&&p.iceTransport!==u.transceivers[0].iceTransport)&&!v(p.iceTransport,b))return S(s("OperationError","Can not add ICE candidate"));var l=t.candidate.trim();l.indexOf("a=")===0&&(l=l.substr(2)),(n=m.getMediaSections(u._remoteDescription.sdp))[x]+="a="+(b.type?l:"end-of-candidates")+`\r
108
- `,u._remoteDescription.sdp=m.getDescription(u._remoteDescription.sdp)+n.join("")}else for(var A=0;A<u.transceivers.length&&(u.transceivers[A].rejected||(u.transceivers[A].iceTransport.addRemoteCandidate({}),(n=m.getMediaSections(u._remoteDescription.sdp))[A]+=`a=end-of-candidates\r
109
- `,u._remoteDescription.sdp=m.getDescription(u._remoteDescription.sdp)+n.join(""),!u.usingBundle));A++);h()})},i.prototype.getStats=function(t){if(t&&t instanceof c.MediaStreamTrack){var n=null;if(this.transceivers.forEach(function(h){h.rtpSender&&h.rtpSender.track===t?n=h.rtpSender:h.rtpReceiver&&h.rtpReceiver.track===t&&(n=h.rtpReceiver)}),!n)throw s("InvalidAccessError","Invalid selector.");return n.getStats()}var u=[];return this.transceivers.forEach(function(h){["rtpSender","rtpReceiver","iceGatherer","iceTransport","dtlsTransport"].forEach(function(S){h[S]&&u.push(h[S].getStats())})}),Promise.all(u).then(function(h){var S=new Map;return h.forEach(function(x){x.forEach(function(E){S.set(E.id,E)})}),S})},["RTCRtpSender","RTCRtpReceiver","RTCIceGatherer","RTCIceTransport","RTCDtlsTransport"].forEach(function(t){var n=c[t];if(n&&n.prototype&&n.prototype.getStats){var u=n.prototype.getStats;n.prototype.getStats=function(){return u.apply(this).then(function(h){var S=new Map;return Object.keys(h).forEach(function(x){var E;h[x].type={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[(E=h[x]).type]||E.type,S.set(x,h[x])}),S})}}});var o=["createOffer","createAnswer"];return o.forEach(function(t){var n=i.prototype[t];i.prototype[t]=function(){var u=arguments;return typeof u[0]=="function"||typeof u[1]=="function"?n.apply(this,[arguments[2]]).then(function(h){typeof u[0]=="function"&&u[0].apply(null,[h])},function(h){typeof u[1]=="function"&&u[1].apply(null,[h])}):n.apply(this,arguments)}}),(o=["setLocalDescription","setRemoteDescription","addIceCandidate"]).forEach(function(t){var n=i.prototype[t];i.prototype[t]=function(){var u=arguments;return typeof u[1]=="function"||typeof u[2]=="function"?n.apply(this,arguments).then(function(){typeof u[1]=="function"&&u[1].apply(null)},function(h){typeof u[2]=="function"&&u[2].apply(null,[h])}):n.apply(this,arguments)}}),["getStats"].forEach(function(t){var n=i.prototype[t];i.prototype[t]=function(){var u=arguments;return typeof u[1]=="function"?n.apply(this,arguments).then(function(){typeof u[1]=="function"&&u[1].apply(null)}):n.apply(this,arguments)}}),i}},7963:j=>{var T={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};T.localCName=T.generateIdentifier(),T.splitLines=function(_){return _.trim().split(`
110
- `).map(function(m){return m.trim()})},T.splitSections=function(_){return _.split(`
111
- m=`).map(function(m,d){return(d>0?"m="+m:m).trim()+`\r
112
- `})},T.getDescription=function(_){var m=T.splitSections(_);return m&&m[0]},T.getMediaSections=function(_){var m=T.splitSections(_);return m.shift(),m},T.matchPrefix=function(_,m){return T.splitLines(_).filter(function(d){return d.indexOf(m)===0})},T.parseCandidate=function(_){for(var m,d={foundation:(m=_.indexOf("a=candidate:")===0?_.substring(12).split(" "):_.substring(10).split(" "))[0],component:parseInt(m[1],10),protocol:m[2].toLowerCase(),priority:parseInt(m[3],10),ip:m[4],address:m[4],port:parseInt(m[5],10),type:m[7]},f=8;f<m.length;f+=2)switch(m[f]){case"raddr":d.relatedAddress=m[f+1];break;case"rport":d.relatedPort=parseInt(m[f+1],10);break;case"tcptype":d.tcpType=m[f+1];break;case"ufrag":d.ufrag=m[f+1],d.usernameFragment=m[f+1];break;default:d[m[f]]=m[f+1]}return d},T.writeCandidate=function(_){var m=[];m.push(_.foundation),m.push(_.component),m.push(_.protocol.toUpperCase()),m.push(_.priority),m.push(_.address||_.ip),m.push(_.port);var d=_.type;return m.push("typ"),m.push(d),d!=="host"&&_.relatedAddress&&_.relatedPort&&(m.push("raddr"),m.push(_.relatedAddress),m.push("rport"),m.push(_.relatedPort)),_.tcpType&&_.protocol.toLowerCase()==="tcp"&&(m.push("tcptype"),m.push(_.tcpType)),(_.usernameFragment||_.ufrag)&&(m.push("ufrag"),m.push(_.usernameFragment||_.ufrag)),"candidate:"+m.join(" ")},T.parseIceOptions=function(_){return _.substr(14).split(" ")},T.parseRtpMap=function(_){var m=_.substr(9).split(" "),d={payloadType:parseInt(m.shift(),10)};return m=m[0].split("/"),d.name=m[0],d.clockRate=parseInt(m[1],10),d.channels=m.length===3?parseInt(m[2],10):1,d.numChannels=d.channels,d},T.writeRtpMap=function(_){var m=_.payloadType;_.preferredPayloadType!==void 0&&(m=_.preferredPayloadType);var d=_.channels||_.numChannels||1;return"a=rtpmap:"+m+" "+_.name+"/"+_.clockRate+(d!==1?"/"+d:"")+`\r
113
- `},T.parseExtmap=function(_){var m=_.substr(9).split(" ");return{id:parseInt(m[0],10),direction:m[0].indexOf("/")>0?m[0].split("/")[1]:"sendrecv",uri:m[1]}},T.writeExtmap=function(_){return"a=extmap:"+(_.id||_.preferredId)+(_.direction&&_.direction!=="sendrecv"?"/"+_.direction:"")+" "+_.uri+`\r
114
- `},T.parseFmtp=function(_){for(var m,d={},f=_.substr(_.indexOf(" ")+1).split(";"),y=0;y<f.length;y++)d[(m=f[y].trim().split("="))[0].trim()]=m[1];return d},T.writeFmtp=function(_){var m="",d=_.payloadType;if(_.preferredPayloadType!==void 0&&(d=_.preferredPayloadType),_.parameters&&Object.keys(_.parameters).length){var f=[];Object.keys(_.parameters).forEach(function(y){_.parameters[y]?f.push(y+"="+_.parameters[y]):f.push(y)}),m+="a=fmtp:"+d+" "+f.join(";")+`\r
115
- `}return m},T.parseRtcpFb=function(_){var m=_.substr(_.indexOf(" ")+1).split(" ");return{type:m.shift(),parameter:m.join(" ")}},T.writeRtcpFb=function(_){var m="",d=_.payloadType;return _.preferredPayloadType!==void 0&&(d=_.preferredPayloadType),_.rtcpFeedback&&_.rtcpFeedback.length&&_.rtcpFeedback.forEach(function(f){m+="a=rtcp-fb:"+d+" "+f.type+(f.parameter&&f.parameter.length?" "+f.parameter:"")+`\r
116
- `}),m},T.parseSsrcMedia=function(_){var m=_.indexOf(" "),d={ssrc:parseInt(_.substr(7,m-7),10)},f=_.indexOf(":",m);return f>-1?(d.attribute=_.substr(m+1,f-m-1),d.value=_.substr(f+1)):d.attribute=_.substr(m+1),d},T.parseSsrcGroup=function(_){var m=_.substr(13).split(" ");return{semantics:m.shift(),ssrcs:m.map(function(d){return parseInt(d,10)})}},T.getMid=function(_){var m=T.matchPrefix(_,"a=mid:")[0];if(m)return m.substr(6)},T.parseFingerprint=function(_){var m=_.substr(14).split(" ");return{algorithm:m[0].toLowerCase(),value:m[1]}},T.getDtlsParameters=function(_,m){return{role:"auto",fingerprints:T.matchPrefix(_+m,"a=fingerprint:").map(T.parseFingerprint)}},T.writeDtlsParameters=function(_,m){var d="a=setup:"+m+`\r
117
- `;return _.fingerprints.forEach(function(f){d+="a=fingerprint:"+f.algorithm+" "+f.value+`\r
118
- `}),d},T.parseCryptoLine=function(_){var m=_.substr(9).split(" ");return{tag:parseInt(m[0],10),cryptoSuite:m[1],keyParams:m[2],sessionParams:m.slice(3)}},T.writeCryptoLine=function(_){return"a=crypto:"+_.tag+" "+_.cryptoSuite+" "+(typeof _.keyParams=="object"?T.writeCryptoKeyParams(_.keyParams):_.keyParams)+(_.sessionParams?" "+_.sessionParams.join(" "):"")+`\r
119
- `},T.parseCryptoKeyParams=function(_){if(_.indexOf("inline:")!==0)return null;var m=_.substr(7).split("|");return{keyMethod:"inline",keySalt:m[0],lifeTime:m[1],mkiValue:m[2]?m[2].split(":")[0]:void 0,mkiLength:m[2]?m[2].split(":")[1]:void 0}},T.writeCryptoKeyParams=function(_){return _.keyMethod+":"+_.keySalt+(_.lifeTime?"|"+_.lifeTime:"")+(_.mkiValue&&_.mkiLength?"|"+_.mkiValue+":"+_.mkiLength:"")},T.getCryptoParameters=function(_,m){return T.matchPrefix(_+m,"a=crypto:").map(T.parseCryptoLine)},T.getIceParameters=function(_,m){var d=T.matchPrefix(_+m,"a=ice-ufrag:")[0],f=T.matchPrefix(_+m,"a=ice-pwd:")[0];return d&&f?{usernameFragment:d.substr(12),password:f.substr(10)}:null},T.writeIceParameters=function(_){return"a=ice-ufrag:"+_.usernameFragment+`\r
105
+ a=mid:`+C.mid+`\r
106
+ `);var y;C.stream&&(C.kind==="audio"?y=C.stream.getAudioTracks()[0]:C.kind==="video"&&(y=C.stream.getVideoTracks()[0]),y&&i>=15019&&C.kind==="video"&&!C.sendEncodingParameters[0].rtx&&(C.sendEncodingParameters[0].rtx={ssrc:C.sendEncodingParameters[0].ssrc+1}));var E=m(C.localCapabilities,C.remoteCapabilities);!E.codecs.filter(function(S){return S.name.toLowerCase()==="rtx"}).length&&C.sendEncodingParameters[0].rtx&&delete C.sendEncodingParameters[0].rtx,n+=l(C,E,"answer",C.stream,t._dtlsRole),C.rtcpParameters&&C.rtcpParameters.reducedSize&&(n+=`a=rtcp-rsize\r
107
+ `)}});var p=new s.RTCSessionDescription({type:"answer",sdp:n});return Promise.resolve(p)},r.prototype.addIceCandidate=function(t){var n,c=this;return t&&t.sdpMLineIndex===void 0&&!t.sdpMid?Promise.reject(new TypeError("sdpMLineIndex or sdpMid required")):new Promise(function(p,C){if(!c._remoteDescription)return C(u("InvalidStateError","Can not add ICE candidate without a remote description"));if(t&&t.candidate!==""){var x=t.sdpMLineIndex;if(t.sdpMid){for(var y=0;y<c.transceivers.length;y++)if(c.transceivers[y].mid===t.sdpMid){x=y;break}}var E=c.transceivers[x];if(!E)return C(u("OperationError","Can not add ICE candidate"));if(E.rejected)return p();var S=Object.keys(t.candidate).length>0?f.parseCandidate(t.candidate):{};if(S.protocol==="tcp"&&(S.port===0||S.port===9)||S.component&&S.component!==1)return p();if((x===0||x>0&&E.iceTransport!==c.transceivers[0].iceTransport)&&!v(E.iceTransport,S))return C(u("OperationError","Can not add ICE candidate"));var d=t.candidate.trim();d.indexOf("a=")===0&&(d=d.substr(2)),(n=f.getMediaSections(c._remoteDescription.sdp))[x]+="a="+(S.type?d:"end-of-candidates")+`\r
108
+ `,c._remoteDescription.sdp=f.getDescription(c._remoteDescription.sdp)+n.join("")}else for(var R=0;R<c.transceivers.length&&(c.transceivers[R].rejected||(c.transceivers[R].iceTransport.addRemoteCandidate({}),(n=f.getMediaSections(c._remoteDescription.sdp))[R]+=`a=end-of-candidates\r
109
+ `,c._remoteDescription.sdp=f.getDescription(c._remoteDescription.sdp)+n.join(""),!c.usingBundle));R++);p()})},r.prototype.getStats=function(t){if(t&&t instanceof s.MediaStreamTrack){var n=null;if(this.transceivers.forEach(function(p){p.rtpSender&&p.rtpSender.track===t?n=p.rtpSender:p.rtpReceiver&&p.rtpReceiver.track===t&&(n=p.rtpReceiver)}),!n)throw u("InvalidAccessError","Invalid selector.");return n.getStats()}var c=[];return this.transceivers.forEach(function(p){["rtpSender","rtpReceiver","iceGatherer","iceTransport","dtlsTransport"].forEach(function(C){p[C]&&c.push(p[C].getStats())})}),Promise.all(c).then(function(p){var C=new Map;return p.forEach(function(x){x.forEach(function(y){C.set(y.id,y)})}),C})},["RTCRtpSender","RTCRtpReceiver","RTCIceGatherer","RTCIceTransport","RTCDtlsTransport"].forEach(function(t){var n=s[t];if(n&&n.prototype&&n.prototype.getStats){var c=n.prototype.getStats;n.prototype.getStats=function(){return c.apply(this).then(function(p){var C=new Map;return Object.keys(p).forEach(function(x){var y;p[x].type={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[(y=p[x]).type]||y.type,C.set(x,p[x])}),C})}}});var a=["createOffer","createAnswer"];return a.forEach(function(t){var n=r.prototype[t];r.prototype[t]=function(){var c=arguments;return typeof c[0]=="function"||typeof c[1]=="function"?n.apply(this,[arguments[2]]).then(function(p){typeof c[0]=="function"&&c[0].apply(null,[p])},function(p){typeof c[1]=="function"&&c[1].apply(null,[p])}):n.apply(this,arguments)}}),(a=["setLocalDescription","setRemoteDescription","addIceCandidate"]).forEach(function(t){var n=r.prototype[t];r.prototype[t]=function(){var c=arguments;return typeof c[1]=="function"||typeof c[2]=="function"?n.apply(this,arguments).then(function(){typeof c[1]=="function"&&c[1].apply(null)},function(p){typeof c[2]=="function"&&c[2].apply(null,[p])}):n.apply(this,arguments)}}),["getStats"].forEach(function(t){var n=r.prototype[t];r.prototype[t]=function(){var c=arguments;return typeof c[1]=="function"?n.apply(this,arguments).then(function(){typeof c[1]=="function"&&c[1].apply(null)}):n.apply(this,arguments)}}),r}},1401:H=>{var T=Object.prototype.hasOwnProperty;function _(l){return"[Throws: "+(l?l.message:"?")+"]"}function f(l){var m=[];return function h(v){if(v===null||typeof v!="object")return v;if(m.indexOf(v)!==-1)return"[Circular]";if(m.push(v),typeof v.toJSON=="function")try{var u=h(v.toJSON());return m.pop(),u}catch(e){return _(e)}if(Array.isArray(v)){var s=v.map(h);return m.pop(),s}var i=Object.keys(v).reduce(function(e,o){return e[o]=h(function(r,a){if(T.call(r,a))try{return r[a]}catch(t){return _(t)}return r[a]}(v,o)),e},{});return m.pop(),i}(l)}H.exports=function(l,m,h){return JSON.stringify(f(l),m,h)},H.exports.ensureProperties=f},7963:H=>{var T={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};T.localCName=T.generateIdentifier(),T.splitLines=function(_){return _.trim().split(`
110
+ `).map(function(f){return f.trim()})},T.splitSections=function(_){return _.split(`
111
+ m=`).map(function(f,l){return(l>0?"m="+f:f).trim()+`\r
112
+ `})},T.getDescription=function(_){var f=T.splitSections(_);return f&&f[0]},T.getMediaSections=function(_){var f=T.splitSections(_);return f.shift(),f},T.matchPrefix=function(_,f){return T.splitLines(_).filter(function(l){return l.indexOf(f)===0})},T.parseCandidate=function(_){for(var f,l={foundation:(f=_.indexOf("a=candidate:")===0?_.substring(12).split(" "):_.substring(10).split(" "))[0],component:parseInt(f[1],10),protocol:f[2].toLowerCase(),priority:parseInt(f[3],10),ip:f[4],address:f[4],port:parseInt(f[5],10),type:f[7]},m=8;m<f.length;m+=2)switch(f[m]){case"raddr":l.relatedAddress=f[m+1];break;case"rport":l.relatedPort=parseInt(f[m+1],10);break;case"tcptype":l.tcpType=f[m+1];break;case"ufrag":l.ufrag=f[m+1],l.usernameFragment=f[m+1];break;default:l[f[m]]=f[m+1]}return l},T.writeCandidate=function(_){var f=[];f.push(_.foundation),f.push(_.component),f.push(_.protocol.toUpperCase()),f.push(_.priority),f.push(_.address||_.ip),f.push(_.port);var l=_.type;return f.push("typ"),f.push(l),l!=="host"&&_.relatedAddress&&_.relatedPort&&(f.push("raddr"),f.push(_.relatedAddress),f.push("rport"),f.push(_.relatedPort)),_.tcpType&&_.protocol.toLowerCase()==="tcp"&&(f.push("tcptype"),f.push(_.tcpType)),(_.usernameFragment||_.ufrag)&&(f.push("ufrag"),f.push(_.usernameFragment||_.ufrag)),"candidate:"+f.join(" ")},T.parseIceOptions=function(_){return _.substr(14).split(" ")},T.parseRtpMap=function(_){var f=_.substr(9).split(" "),l={payloadType:parseInt(f.shift(),10)};return f=f[0].split("/"),l.name=f[0],l.clockRate=parseInt(f[1],10),l.channels=f.length===3?parseInt(f[2],10):1,l.numChannels=l.channels,l},T.writeRtpMap=function(_){var f=_.payloadType;_.preferredPayloadType!==void 0&&(f=_.preferredPayloadType);var l=_.channels||_.numChannels||1;return"a=rtpmap:"+f+" "+_.name+"/"+_.clockRate+(l!==1?"/"+l:"")+`\r
113
+ `},T.parseExtmap=function(_){var f=_.substr(9).split(" ");return{id:parseInt(f[0],10),direction:f[0].indexOf("/")>0?f[0].split("/")[1]:"sendrecv",uri:f[1]}},T.writeExtmap=function(_){return"a=extmap:"+(_.id||_.preferredId)+(_.direction&&_.direction!=="sendrecv"?"/"+_.direction:"")+" "+_.uri+`\r
114
+ `},T.parseFmtp=function(_){for(var f,l={},m=_.substr(_.indexOf(" ")+1).split(";"),h=0;h<m.length;h++)l[(f=m[h].trim().split("="))[0].trim()]=f[1];return l},T.writeFmtp=function(_){var f="",l=_.payloadType;if(_.preferredPayloadType!==void 0&&(l=_.preferredPayloadType),_.parameters&&Object.keys(_.parameters).length){var m=[];Object.keys(_.parameters).forEach(function(h){_.parameters[h]?m.push(h+"="+_.parameters[h]):m.push(h)}),f+="a=fmtp:"+l+" "+m.join(";")+`\r
115
+ `}return f},T.parseRtcpFb=function(_){var f=_.substr(_.indexOf(" ")+1).split(" ");return{type:f.shift(),parameter:f.join(" ")}},T.writeRtcpFb=function(_){var f="",l=_.payloadType;return _.preferredPayloadType!==void 0&&(l=_.preferredPayloadType),_.rtcpFeedback&&_.rtcpFeedback.length&&_.rtcpFeedback.forEach(function(m){f+="a=rtcp-fb:"+l+" "+m.type+(m.parameter&&m.parameter.length?" "+m.parameter:"")+`\r
116
+ `}),f},T.parseSsrcMedia=function(_){var f=_.indexOf(" "),l={ssrc:parseInt(_.substr(7,f-7),10)},m=_.indexOf(":",f);return m>-1?(l.attribute=_.substr(f+1,m-f-1),l.value=_.substr(m+1)):l.attribute=_.substr(f+1),l},T.parseSsrcGroup=function(_){var f=_.substr(13).split(" ");return{semantics:f.shift(),ssrcs:f.map(function(l){return parseInt(l,10)})}},T.getMid=function(_){var f=T.matchPrefix(_,"a=mid:")[0];if(f)return f.substr(6)},T.parseFingerprint=function(_){var f=_.substr(14).split(" ");return{algorithm:f[0].toLowerCase(),value:f[1]}},T.getDtlsParameters=function(_,f){return{role:"auto",fingerprints:T.matchPrefix(_+f,"a=fingerprint:").map(T.parseFingerprint)}},T.writeDtlsParameters=function(_,f){var l="a=setup:"+f+`\r
117
+ `;return _.fingerprints.forEach(function(m){l+="a=fingerprint:"+m.algorithm+" "+m.value+`\r
118
+ `}),l},T.parseCryptoLine=function(_){var f=_.substr(9).split(" ");return{tag:parseInt(f[0],10),cryptoSuite:f[1],keyParams:f[2],sessionParams:f.slice(3)}},T.writeCryptoLine=function(_){return"a=crypto:"+_.tag+" "+_.cryptoSuite+" "+(typeof _.keyParams=="object"?T.writeCryptoKeyParams(_.keyParams):_.keyParams)+(_.sessionParams?" "+_.sessionParams.join(" "):"")+`\r
119
+ `},T.parseCryptoKeyParams=function(_){if(_.indexOf("inline:")!==0)return null;var f=_.substr(7).split("|");return{keyMethod:"inline",keySalt:f[0],lifeTime:f[1],mkiValue:f[2]?f[2].split(":")[0]:void 0,mkiLength:f[2]?f[2].split(":")[1]:void 0}},T.writeCryptoKeyParams=function(_){return _.keyMethod+":"+_.keySalt+(_.lifeTime?"|"+_.lifeTime:"")+(_.mkiValue&&_.mkiLength?"|"+_.mkiValue+":"+_.mkiLength:"")},T.getCryptoParameters=function(_,f){return T.matchPrefix(_+f,"a=crypto:").map(T.parseCryptoLine)},T.getIceParameters=function(_,f){var l=T.matchPrefix(_+f,"a=ice-ufrag:")[0],m=T.matchPrefix(_+f,"a=ice-pwd:")[0];return l&&m?{usernameFragment:l.substr(12),password:m.substr(10)}:null},T.writeIceParameters=function(_){return"a=ice-ufrag:"+_.usernameFragment+`\r
120
120
  a=ice-pwd:`+_.password+`\r
121
- `},T.parseRtpParameters=function(_){for(var m={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},d=T.splitLines(_)[0].split(" "),f=3;f<d.length;f++){var y=d[f],v=T.matchPrefix(_,"a=rtpmap:"+y+" ")[0];if(v){var s=T.parseRtpMap(v),c=T.matchPrefix(_,"a=fmtp:"+y+" ");switch(s.parameters=c.length?T.parseFmtp(c[0]):{},s.rtcpFeedback=T.matchPrefix(_,"a=rtcp-fb:"+y+" ").map(T.parseRtcpFb),m.codecs.push(s),s.name.toUpperCase()){case"RED":case"ULPFEC":m.fecMechanisms.push(s.name.toUpperCase())}}}return T.matchPrefix(_,"a=extmap:").forEach(function(a){m.headerExtensions.push(T.parseExtmap(a))}),m},T.writeRtpDescription=function(_,m){var d="";d+="m="+_+" ",d+=m.codecs.length>0?"9":"0",d+=" UDP/TLS/RTP/SAVPF ",d+=m.codecs.map(function(y){return y.preferredPayloadType!==void 0?y.preferredPayloadType:y.payloadType}).join(" ")+`\r
122
- `,d+=`c=IN IP4 0.0.0.0\r
123
- `,d+=`a=rtcp:9 IN IP4 0.0.0.0\r
124
- `,m.codecs.forEach(function(y){d+=T.writeRtpMap(y),d+=T.writeFmtp(y),d+=T.writeRtcpFb(y)});var f=0;return m.codecs.forEach(function(y){y.maxptime>f&&(f=y.maxptime)}),f>0&&(d+="a=maxptime:"+f+`\r
125
- `),d+=`a=rtcp-mux\r
126
- `,m.headerExtensions&&m.headerExtensions.forEach(function(y){d+=T.writeExtmap(y)}),d},T.parseRtpEncodingParameters=function(_){var m,d=[],f=T.parseRtpParameters(_),y=f.fecMechanisms.indexOf("RED")!==-1,v=f.fecMechanisms.indexOf("ULPFEC")!==-1,s=T.matchPrefix(_,"a=ssrc:").map(function(r){return T.parseSsrcMedia(r)}).filter(function(r){return r.attribute==="cname"}),c=s.length>0&&s[0].ssrc,a=T.matchPrefix(_,"a=ssrc-group:FID").map(function(r){return r.substr(17).split(" ").map(function(i){return parseInt(i,10)})});a.length>0&&a[0].length>1&&a[0][0]===c&&(m=a[0][1]),f.codecs.forEach(function(r){if(r.name.toUpperCase()==="RTX"&&r.parameters.apt){var i={ssrc:c,codecPayloadType:parseInt(r.parameters.apt,10)};c&&m&&(i.rtx={ssrc:m}),d.push(i),y&&((i=JSON.parse(JSON.stringify(i))).fec={ssrc:c,mechanism:v?"red+ulpfec":"red"},d.push(i))}}),d.length===0&&c&&d.push({ssrc:c});var e=T.matchPrefix(_,"b=");return e.length&&(e=e[0].indexOf("b=TIAS:")===0?parseInt(e[0].substr(7),10):e[0].indexOf("b=AS:")===0?1e3*parseInt(e[0].substr(5),10)*.95-16e3:void 0,d.forEach(function(r){r.maxBitrate=e})),d},T.parseRtcpParameters=function(_){var m={},d=T.matchPrefix(_,"a=ssrc:").map(function(v){return T.parseSsrcMedia(v)}).filter(function(v){return v.attribute==="cname"})[0];d&&(m.cname=d.value,m.ssrc=d.ssrc);var f=T.matchPrefix(_,"a=rtcp-rsize");m.reducedSize=f.length>0,m.compound=f.length===0;var y=T.matchPrefix(_,"a=rtcp-mux");return m.mux=y.length>0,m},T.parseMsid=function(_){var m,d=T.matchPrefix(_,"a=msid:");if(d.length===1)return{stream:(m=d[0].substr(7).split(" "))[0],track:m[1]};var f=T.matchPrefix(_,"a=ssrc:").map(function(y){return T.parseSsrcMedia(y)}).filter(function(y){return y.attribute==="msid"});return f.length>0?{stream:(m=f[0].value.split(" "))[0],track:m[1]}:void 0},T.parseSctpDescription=function(_){var m,d=T.parseMLine(_),f=T.matchPrefix(_,"a=max-message-size:");f.length>0&&(m=parseInt(f[0].substr(19),10)),isNaN(m)&&(m=65536);var y=T.matchPrefix(_,"a=sctp-port:");if(y.length>0)return{port:parseInt(y[0].substr(12),10),protocol:d.fmt,maxMessageSize:m};if(T.matchPrefix(_,"a=sctpmap:").length>0){var v=T.matchPrefix(_,"a=sctpmap:")[0].substr(10).split(" ");return{port:parseInt(v[0],10),protocol:v[1],maxMessageSize:m}}},T.writeSctpDescription=function(_,m){var d=[];return d=_.protocol!=="DTLS/SCTP"?["m="+_.kind+" 9 "+_.protocol+" "+m.protocol+`\r
121
+ `},T.parseRtpParameters=function(_){for(var f={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},l=T.splitLines(_)[0].split(" "),m=3;m<l.length;m++){var h=l[m],v=T.matchPrefix(_,"a=rtpmap:"+h+" ")[0];if(v){var u=T.parseRtpMap(v),s=T.matchPrefix(_,"a=fmtp:"+h+" ");switch(u.parameters=s.length?T.parseFmtp(s[0]):{},u.rtcpFeedback=T.matchPrefix(_,"a=rtcp-fb:"+h+" ").map(T.parseRtcpFb),f.codecs.push(u),u.name.toUpperCase()){case"RED":case"ULPFEC":f.fecMechanisms.push(u.name.toUpperCase())}}}return T.matchPrefix(_,"a=extmap:").forEach(function(i){f.headerExtensions.push(T.parseExtmap(i))}),f},T.writeRtpDescription=function(_,f){var l="";l+="m="+_+" ",l+=f.codecs.length>0?"9":"0",l+=" UDP/TLS/RTP/SAVPF ",l+=f.codecs.map(function(h){return h.preferredPayloadType!==void 0?h.preferredPayloadType:h.payloadType}).join(" ")+`\r
122
+ `,l+=`c=IN IP4 0.0.0.0\r
123
+ `,l+=`a=rtcp:9 IN IP4 0.0.0.0\r
124
+ `,f.codecs.forEach(function(h){l+=T.writeRtpMap(h),l+=T.writeFmtp(h),l+=T.writeRtcpFb(h)});var m=0;return f.codecs.forEach(function(h){h.maxptime>m&&(m=h.maxptime)}),m>0&&(l+="a=maxptime:"+m+`\r
125
+ `),l+=`a=rtcp-mux\r
126
+ `,f.headerExtensions&&f.headerExtensions.forEach(function(h){l+=T.writeExtmap(h)}),l},T.parseRtpEncodingParameters=function(_){var f,l=[],m=T.parseRtpParameters(_),h=m.fecMechanisms.indexOf("RED")!==-1,v=m.fecMechanisms.indexOf("ULPFEC")!==-1,u=T.matchPrefix(_,"a=ssrc:").map(function(o){return T.parseSsrcMedia(o)}).filter(function(o){return o.attribute==="cname"}),s=u.length>0&&u[0].ssrc,i=T.matchPrefix(_,"a=ssrc-group:FID").map(function(o){return o.substr(17).split(" ").map(function(r){return parseInt(r,10)})});i.length>0&&i[0].length>1&&i[0][0]===s&&(f=i[0][1]),m.codecs.forEach(function(o){if(o.name.toUpperCase()==="RTX"&&o.parameters.apt){var r={ssrc:s,codecPayloadType:parseInt(o.parameters.apt,10)};s&&f&&(r.rtx={ssrc:f}),l.push(r),h&&((r=JSON.parse(JSON.stringify(r))).fec={ssrc:s,mechanism:v?"red+ulpfec":"red"},l.push(r))}}),l.length===0&&s&&l.push({ssrc:s});var e=T.matchPrefix(_,"b=");return e.length&&(e=e[0].indexOf("b=TIAS:")===0?parseInt(e[0].substr(7),10):e[0].indexOf("b=AS:")===0?1e3*parseInt(e[0].substr(5),10)*.95-16e3:void 0,l.forEach(function(o){o.maxBitrate=e})),l},T.parseRtcpParameters=function(_){var f={},l=T.matchPrefix(_,"a=ssrc:").map(function(v){return T.parseSsrcMedia(v)}).filter(function(v){return v.attribute==="cname"})[0];l&&(f.cname=l.value,f.ssrc=l.ssrc);var m=T.matchPrefix(_,"a=rtcp-rsize");f.reducedSize=m.length>0,f.compound=m.length===0;var h=T.matchPrefix(_,"a=rtcp-mux");return f.mux=h.length>0,f},T.parseMsid=function(_){var f,l=T.matchPrefix(_,"a=msid:");if(l.length===1)return{stream:(f=l[0].substr(7).split(" "))[0],track:f[1]};var m=T.matchPrefix(_,"a=ssrc:").map(function(h){return T.parseSsrcMedia(h)}).filter(function(h){return h.attribute==="msid"});return m.length>0?{stream:(f=m[0].value.split(" "))[0],track:f[1]}:void 0},T.parseSctpDescription=function(_){var f,l=T.parseMLine(_),m=T.matchPrefix(_,"a=max-message-size:");m.length>0&&(f=parseInt(m[0].substr(19),10)),isNaN(f)&&(f=65536);var h=T.matchPrefix(_,"a=sctp-port:");if(h.length>0)return{port:parseInt(h[0].substr(12),10),protocol:l.fmt,maxMessageSize:f};if(T.matchPrefix(_,"a=sctpmap:").length>0){var v=T.matchPrefix(_,"a=sctpmap:")[0].substr(10).split(" ");return{port:parseInt(v[0],10),protocol:v[1],maxMessageSize:f}}},T.writeSctpDescription=function(_,f){var l=[];return l=_.protocol!=="DTLS/SCTP"?["m="+_.kind+" 9 "+_.protocol+" "+f.protocol+`\r
127
127
  `,`c=IN IP4 0.0.0.0\r
128
- `,"a=sctp-port:"+m.port+`\r
129
- `]:["m="+_.kind+" 9 "+_.protocol+" "+m.port+`\r
128
+ `,"a=sctp-port:"+f.port+`\r
129
+ `]:["m="+_.kind+" 9 "+_.protocol+" "+f.port+`\r
130
130
  `,`c=IN IP4 0.0.0.0\r
131
- `,"a=sctpmap:"+m.port+" "+m.protocol+` 65535\r
132
- `],m.maxMessageSize!==void 0&&d.push("a=max-message-size:"+m.maxMessageSize+`\r
133
- `),d.join("")},T.generateSessionId=function(){return Math.random().toString().substr(2,21)},T.writeSessionBoilerplate=function(_,m,d){var f=m!==void 0?m:2;return`v=0\r
134
- o=`+(d||"thisisadapterortc")+" "+(_||T.generateSessionId())+" "+f+` IN IP4 127.0.0.1\r
131
+ `,"a=sctpmap:"+f.port+" "+f.protocol+` 65535\r
132
+ `],f.maxMessageSize!==void 0&&l.push("a=max-message-size:"+f.maxMessageSize+`\r
133
+ `),l.join("")},T.generateSessionId=function(){return Math.random().toString().substr(2,21)},T.writeSessionBoilerplate=function(_,f,l){var m=f!==void 0?f:2;return`v=0\r
134
+ o=`+(l||"thisisadapterortc")+" "+(_||T.generateSessionId())+" "+m+` IN IP4 127.0.0.1\r
135
135
  s=-\r
136
136
  t=0 0\r
137
- `},T.writeMediaSection=function(_,m,d,f){var y=T.writeRtpDescription(_.kind,m);if(y+=T.writeIceParameters(_.iceGatherer.getLocalParameters()),y+=T.writeDtlsParameters(_.dtlsTransport.getLocalParameters(),d==="offer"?"actpass":"active"),y+="a=mid:"+_.mid+`\r
138
- `,_.direction?y+="a="+_.direction+`\r
139
- `:_.rtpSender&&_.rtpReceiver?y+=`a=sendrecv\r
140
- `:_.rtpSender?y+=`a=sendonly\r
141
- `:_.rtpReceiver?y+=`a=recvonly\r
142
- `:y+=`a=inactive\r
143
- `,_.rtpSender){var v="msid:"+f.id+" "+_.rtpSender.track.id+`\r
144
- `;y+="a="+v,y+="a=ssrc:"+_.sendEncodingParameters[0].ssrc+" "+v,_.sendEncodingParameters[0].rtx&&(y+="a=ssrc:"+_.sendEncodingParameters[0].rtx.ssrc+" "+v,y+="a=ssrc-group:FID "+_.sendEncodingParameters[0].ssrc+" "+_.sendEncodingParameters[0].rtx.ssrc+`\r
145
- `)}return y+="a=ssrc:"+_.sendEncodingParameters[0].ssrc+" cname:"+T.localCName+`\r
146
- `,_.rtpSender&&_.sendEncodingParameters[0].rtx&&(y+="a=ssrc:"+_.sendEncodingParameters[0].rtx.ssrc+" cname:"+T.localCName+`\r
147
- `),y},T.getDirection=function(_,m){for(var d=T.splitLines(_),f=0;f<d.length;f++)switch(d[f]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return d[f].substr(2)}return m?T.getDirection(m):"sendrecv"},T.getKind=function(_){return T.splitLines(_)[0].split(" ")[0].substr(2)},T.isRejected=function(_){return _.split(" ",2)[1]==="0"},T.parseMLine=function(_){var m=T.splitLines(_)[0].substr(2).split(" ");return{kind:m[0],port:parseInt(m[1],10),protocol:m[2],fmt:m.slice(3).join(" ")}},T.parseOLine=function(_){var m=T.matchPrefix(_,"o=")[0].substr(2).split(" ");return{username:m[0],sessionId:m[1],sessionVersion:parseInt(m[2],10),netType:m[3],addressType:m[4],address:m[5]}},T.isValidSDP=function(_){if(typeof _!="string"||_.length===0)return!1;for(var m=T.splitLines(_),d=0;d<m.length;d++)if(m[d].length<2||m[d].charAt(1)!=="=")return!1;return!0},j.exports=T},4845:function(j,T,_){var m=this&&this.__assign||function(){return m=Object.assign||function(n){for(var u,h=1,S=arguments.length;h<S;h++)for(var x in u=arguments[h])Object.prototype.hasOwnProperty.call(u,x)&&(n[x]=u[x]);return n},m.apply(this,arguments)},d=this&&this.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(T,"__esModule",{value:!0}),T.AliRTS=void 0;var f=_(2550),y=_(9428),v=_(3412),s=_(7668),c=_(233),a=d(_(2818)),e=_(5259),r=_(7989),i=_(6420),o=_(1698),t=function(){function n(){}return n.createClient=function(u){var h=u||{};return h.customReporter||(h.customReporter=n.customReporter),h.trackLog===void 0&&(h.trackLog=n.trackLog),o.configProvider.setContext(h),new s.RtsClient(h)},n.getMicList=function(){var u=this;return new Promise(function(h,S){u.deviceManager.getMicList().then(function(x){h(x)}).catch(function(x){S(x)})})},n.getCameraList=function(){var u=this;return new Promise(function(h,S){u.deviceManager.getCameraList().then(function(x){h(x)}).catch(function(x){S(x)})})},n.getSpeakerList=function(){var u=this;return new Promise(function(h,S){u.deviceManager.getSpeakerList().then(function(x){h(x)}).catch(function(x){S(x)})})},n.createStream=function(u){return new Promise(function(h,S){var x=new f.LocalStream,E=new a.default({customReporter:n.customReporter,trackLog:n.trackLog});x.init(u).then(function(){h(x),E.reportStreamCreated(u,{videoTrack:!!x.videoTrack,audioTrack:!!x.audioTrack,screenAudio:!!x.screenAudioTrack,surface:x.screenSurfaceType})}).catch(function(p){var b=m(m({},p),{relatedLink:p.extraInfo});delete b.extraInfo,S(b),E.reportErrorInfo(y.ErrorCode.ERROR_INIT_LOCAL_FAIL,p.message,p.traceId,{config:u,originErr:p})})})},n.deviceManager=new v.BrowserDeviceManager,n.BrowserUtil=c.BrowserUtil,n.SystenUtil=c.SystemUtil,n.SupportUtil=r.SupportUtil,n.Clock=i.Clock,n.VideoProfileMap=e.VideoProfileMap,n.ScreenProfileMap=e.ScreenProfileMap,n.AudioProfileMap=e.AudioProfileMap,n.ErrorCode=y.ErrorCode,n.customReporter=function(){},n.trackLog=!0,n}();T.AliRTS=t},7028:(j,T)=>{Object.defineProperty(T,"__esModule",{value:!0}),T.default={version:"2.13.0",protocol_version:2,sdk_version:"0.0.1"}},9428:(j,T)=>{var _,m;Object.defineProperty(T,"__esModule",{value:!0}),T.PUB_RECONNECT_ERROR_LIST=T.RECONNECT_ERROR_EXCLUDE_LIST=T.SUB_RECONNECT_ERROR_LIST=T.DeviceErrorCode=T.ErrorCode=void 0,function(d){d[d.ERROR_DEVICE_UNKNOWNERROR=1e4]="ERROR_DEVICE_UNKNOWNERROR",d[d.ERROR_DEVICE_AUDIODEVICE_NOTFOUND=10001]="ERROR_DEVICE_AUDIODEVICE_NOTFOUND",d[d.ERROR_DEVICE_VIDEODEVICE_NOTFOUND=10002]="ERROR_DEVICE_VIDEODEVICE_NOTFOUND",d[d.ERROR_DEVICE_NOTFOUND=10020]="ERROR_DEVICE_NOTFOUND",d[d.ERROR_DEVICE_AUDIODEVICE_NOTALLOWED=10003]="ERROR_DEVICE_AUDIODEVICE_NOTALLOWED",d[d.ERROR_DEVICE_VIDEODEVICE_NOTALLOWED=10004]="ERROR_DEVICE_VIDEODEVICE_NOTALLOWED",d[d.ERROR_DEVICE_NOTALLOWED=10021]="ERROR_DEVICE_NOTALLOWED",d[d.ERROR_DEVICE_AUDIODEVICE_NOTREADABLE=10005]="ERROR_DEVICE_AUDIODEVICE_NOTREADABLE",d[d.ERROR_DEVICE_VIDEODEVICE_NOTREADABLE=10006]="ERROR_DEVICE_VIDEODEVICE_NOTREADABLE",d[d.ERROR_DEVICE_NOTREADABLE=10022]="ERROR_DEVICE_NOTREADABLE",d[d.ERROR_DEIVCE_CONSTRAINEDERROR=10007]="ERROR_DEIVCE_CONSTRAINEDERROR",d[d.ERROR_SCREENSHARE_UNKNOWNERRO=10010]="ERROR_SCREENSHARE_UNKNOWNERRO",d[d.ERROR_SCREENSHARE_NOTALLOWED=10011]="ERROR_SCREENSHARE_NOTALLOWED",d[d.ERROR_SCREENSHARE_ENDED=10012]="ERROR_SCREENSHARE_ENDED",d[d.ERROR_SCREENSHARE_NOPERMISSION=10013]="ERROR_SCREENSHARE_NOPERMISSION",d[d.ERROR_SCREENSHARE_INVALIDACCESS=10014]="ERROR_SCREENSHARE_INVALIDACCESS",d[d.ERROR_SCREENSHARE_NOTSUPPORT=10018]="ERROR_SCREENSHARE_NOTSUPPORT",d[d.ERROR_DEVICE_NOTSUPPORT=10019]="ERROR_DEVICE_NOTSUPPORT",d[d.ERROR_SIGNAL_ERROR=10101]="ERROR_SIGNAL_ERROR",d[d.ERROR_PLAY_FAILED=10102]="ERROR_PLAY_FAILED",d[d.ERROR_NOTSUPPORT_WEBRTC=10110]="ERROR_NOTSUPPORT_WEBRTC",d[d.ERROR_BROWSER_NOTSUPPORT=10111]="ERROR_BROWSER_NOTSUPPORT",d[d.ERROR_BROWSER_VERSIONLOW=10112]="ERROR_BROWSER_VERSIONLOW",d[d.ERROR_NOTSUPPORT_H264=10113]="ERROR_NOTSUPPORT_H264",d[d.ERROR_CREATEOFFER=10114]="ERROR_CREATEOFFER",d[d.ERROR_NO_DATACHANNEL=10115]="ERROR_NO_DATACHANNEL",d[d.ERROR_INIT_LOCAL_FAIL=10116]="ERROR_INIT_LOCAL_FAIL",d[d.ERROR_HEMLELEMENT_NOTMATCH=10125]="ERROR_HEMLELEMENT_NOTMATCH",d[d.ERROR_AUTOPLAY_ERROR=10201]="ERROR_AUTOPLAY_ERROR",d[d.ERROR_PLAY_URL=10202]="ERROR_PLAY_URL",d[d.ERROR_SUBSCRIBE_NOTHING=10203]="ERROR_SUBSCRIBE_NOTHING",d[d.ERROR_HTMLELEMENT_ERROR=10204]="ERROR_HTMLELEMENT_ERROR",d[d.ERROR_HTTPREQUEST_ERROR=10205]="ERROR_HTTPREQUEST_ERROR",d[d.ERROR_ANSWER_ERROR=10206]="ERROR_ANSWER_ERROR",d[d.ERROR_INBOUND_TIMEOUT=10207]="ERROR_INBOUND_TIMEOUT",d[d.ERROR_STREAM_ENDED=10208]="ERROR_STREAM_ENDED",d[d.ERROR_PC_DISCONNECTED=10209]="ERROR_PC_DISCONNECTED",d[d.ERROR_TRANSPORT_CLOSED=10210]="ERROR_TRANSPORT_CLOSED",d[d.ERROR_SIGNAL_URL=10211]="ERROR_SIGNAL_URL",d[d.ERROR_IP_MIGRATE=10212]="ERROR_IP_MIGRATE",d[d.ERROR_PUBLISH_URL=10300]="ERROR_PUBLISH_URL",d[d.ERROR_PUBLISH_NOAUDIO=10301]="ERROR_PUBLISH_NOAUDIO",d[d.ERROR_PUBLISH_NOSTREAM=10302]="ERROR_PUBLISH_NOSTREAM",d[d.ERROR_DATACHANNEL_PARAM=10500]="ERROR_DATACHANNEL_PARAM",d[d.ERROR_DATACHANNEL_OPEN=10501]="ERROR_DATACHANNEL_OPEN",d[d.ERROR_MEDIASTREAMTRACK_TYPE_ERROR=11e3]="ERROR_MEDIASTREAMTRACK_TYPE_ERROR",d[d.ERROR_MEDIASTREAMTRACK_KIND_ERROR=11001]="ERROR_MEDIASTREAMTRACK_KIND_ERROR",d[d.ERROR_MEDIASTREAMTRACK_AUDIO_NONE=11002]="ERROR_MEDIASTREAMTRACK_AUDIO_NONE",d[d.ERROR_CUSTOMSTREAM_NONE=11003]="ERROR_CUSTOMSTREAM_NONE",d[d.ERROR_CUSTOMSTREAM_INVALID=11004]="ERROR_CUSTOMSTREAM_INVALID",d[d.ERROR_CUSTOMSTREAM_TRACK_NONE=11005]="ERROR_CUSTOMSTREAM_TRACK_NONE",d[d.ERROR_PREERCONNECTION_UNKNOWN=12e3]="ERROR_PREERCONNECTION_UNKNOWN",d[d.ERROR_SUBADD_NO_RESULT=13e3]="ERROR_SUBADD_NO_RESULT",d[d.ERROR_PUBADD_NO_RESULT=13001]="ERROR_PUBADD_NO_RESULT",d[d.ERROR_SINGLE_PC_STREAM_ERROR=13100]="ERROR_SINGLE_PC_STREAM_ERROR",d[d.ERROR_SINGLE_PC_STREAM_RECONNECT_FAILED=13101]="ERROR_SINGLE_PC_STREAM_RECONNECT_FAILED",d[d.ERROR_SINGLE_PC_FULL_RECONNECT=13102]="ERROR_SINGLE_PC_FULL_RECONNECT",d[d.ERROR_SINGLE_PC_FULL_RECONNECT_HTTP_FAILED=13103]="ERROR_SINGLE_PC_FULL_RECONNECT_HTTP_FAILED"}(_||(T.ErrorCode=_={})),function(d){d[d.ERROR_DEVICE_UNKNOWNERROR=1e4]="ERROR_DEVICE_UNKNOWNERROR",d[d.ERROR_DEVICE_AUDIODEVICE_NOTFOUND=10001]="ERROR_DEVICE_AUDIODEVICE_NOTFOUND",d[d.ERROR_DEVICE_VIDEODEVICE_NOTFOUND=10002]="ERROR_DEVICE_VIDEODEVICE_NOTFOUND",d[d.ERROR_DEVICE_AUDIODEVICE_NOTALLOWED=10003]="ERROR_DEVICE_AUDIODEVICE_NOTALLOWED",d[d.ERROR_DEVICE_VIDEODEVICE_NOTALLOWED=10004]="ERROR_DEVICE_VIDEODEVICE_NOTALLOWED",d[d.ERROR_DEVICE_AUDIODEVICE_NOTREADABLE=10005]="ERROR_DEVICE_AUDIODEVICE_NOTREADABLE",d[d.ERROR_DEVICE_VIDEODEVICE_NOTREADABLE=10006]="ERROR_DEVICE_VIDEODEVICE_NOTREADABLE",d[d.ERROR_SCREENSHARE_NOTSUPPORT=10010]="ERROR_SCREENSHARE_NOTSUPPORT",d[d.ERROR_SCREENSHARE_NOTALLOWED=10011]="ERROR_SCREENSHARE_NOTALLOWED",d[d.ERROR_SCREENSHARE_ENDED=10012]="ERROR_SCREENSHARE_ENDED",d[d.ERROR_SCREENSHARE_NOPERMISSION=10013]="ERROR_SCREENSHARE_NOPERMISSION",d[d.ERROR_SCREENSHARE_SAFARI_INVALIDACCESS=10014]="ERROR_SCREENSHARE_SAFARI_INVALIDACCESS",d[d.ERROR_SCREENSHARE_UNKNOWNERRO=10019]="ERROR_SCREENSHARE_UNKNOWNERRO",d[d.ERROR_DEVICE_NOTSUPPORT=2e4]="ERROR_DEVICE_NOTSUPPORT"}(m||(T.DeviceErrorCode=m={})),T.SUB_RECONNECT_ERROR_LIST=[_.ERROR_INBOUND_TIMEOUT,_.ERROR_STREAM_ENDED,_.ERROR_PC_DISCONNECTED],T.RECONNECT_ERROR_EXCLUDE_LIST=[_.ERROR_AUTOPLAY_ERROR,_.ERROR_PLAY_URL,_.ERROR_SUBSCRIBE_NOTHING,_.ERROR_HTMLELEMENT_ERROR,_.ERROR_HEMLELEMENT_NOTMATCH,_.ERROR_PUBLISH_URL,_.ERROR_PUBLISH_NOAUDIO,_.ERROR_PUBLISH_NOSTREAM],T.PUB_RECONNECT_ERROR_LIST=[_.ERROR_PC_DISCONNECTED,_.ERROR_TRANSPORT_CLOSED]},5044:(j,T,_)=>{Object.defineProperty(T,"__esModule",{value:!0}),T.RtsError=void 0;var m=_(9428),d=function(){function f(y,v,s,c){this.errorCode=y,this.errorCodeName=m.ErrorCode[y],this.message=v,this.traceId=s,c&&(this.extraInfo=c)}return f.prototype.renameCode=function(y){this.errorCode=y,this.errorCodeName=m.ErrorCode[y]},f}();T.RtsError=d},6091:(j,T)=>{Object.defineProperty(T,"__esModule",{value:!0}),T.PlayEvent=T.PlayType=void 0,T.PlayType={PLAY_CANPLAY:"canplay",PLAY_WAITING:"waiting",PLAY_PLAYING:"playing",PLAY_MEDIA:"media",PLAY_ENDED:"ended",PLAY_TIMEOUT:"timeout"};var _=function(m){this.event=m};T.PlayEvent=_},5917:(j,T)=>{var _,m,d,f;Object.defineProperty(T,"__esModule",{value:!0}),T.DEFAULT_RETRY_DATACHANNEL_TIMEOUT=T.DEFAULT_HEARTBEAT_TIMEOUT=T.DEFAULT_RETRY_PUBLISH_INTERVAL=T.DEFAULT_RETRY_SUBSCRIBE_INTERVAL=T.DEFAULT_RETRY_PUBLISH_LIMIT=T.DEFAULT_RETRY_SUBSCRIBE_LIMIT=T.EWorkerAction=T.EWorkerSource=T.EConnectStatus=T.TrackType=void 0,function(y){y.AUDIO="audio",y.VIDEO="video"}(_||(T.TrackType=_={})),function(y){y[y.CONNECT_STATUS_DISCONNECTED=0]="CONNECT_STATUS_DISCONNECTED",y[y.CONNECT_STATUS_CONNECTING=1]="CONNECT_STATUS_CONNECTING",y[y.CONNECT_STATUS_CONNECTED=2]="CONNECT_STATUS_CONNECTED",y[y.CONNECT_STATUS_RECONNECTING=3]="CONNECT_STATUS_RECONNECTING"}(m||(T.EConnectStatus=m={})),function(y){y.Sender="sender",y.Receiver="receiver"}(d||(T.EWorkerSource=d={})),function(y){y.Setup="setup",y.InserSEI="insertSEI",y.UpdatePubStats="updatePubStats",y.UpdateSubStats="updateSubStats",y.SwitchCumuDelay="switchCumuDelay"}(f||(T.EWorkerAction=f={})),T.DEFAULT_RETRY_SUBSCRIBE_LIMIT=5,T.DEFAULT_RETRY_PUBLISH_LIMIT=5,T.DEFAULT_RETRY_SUBSCRIBE_INTERVAL=2e3,T.DEFAULT_RETRY_PUBLISH_INTERVAL=2e3,T.DEFAULT_HEARTBEAT_TIMEOUT=8,T.DEFAULT_RETRY_DATACHANNEL_TIMEOUT=8e3},6600:function(j,T,_){var m,d=this&&this.__extends||(m=function(l,A){return m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(R,C){R.__proto__=C}||function(R,C){for(var g in C)Object.prototype.hasOwnProperty.call(C,g)&&(R[g]=C[g])},m(l,A)},function(l,A){if(typeof A!="function"&&A!==null)throw new TypeError("Class extends value "+String(A)+" is not a constructor or null");function R(){this.constructor=l}m(l,A),l.prototype=A===null?Object.create(A):(R.prototype=A.prototype,new R)}),f=this&&this.__assign||function(){return f=Object.assign||function(l){for(var A,R=1,C=arguments.length;R<C;R++)for(var g in A=arguments[R])Object.prototype.hasOwnProperty.call(A,g)&&(l[g]=A[g]);return l},f.apply(this,arguments)},y=this&&this.__awaiter||function(l,A,R,C){return new(R||(R=Promise))(function(g,D){function O(w){try{k(C.next(w))}catch(N){D(N)}}function U(w){try{k(C.throw(w))}catch(N){D(N)}}function k(w){var N;w.done?g(w.value):(N=w.value,N instanceof R?N:new R(function(H){H(N)})).then(O,U)}k((C=C.apply(l,A||[])).next())})},v=this&&this.__generator||function(l,A){var R,C,g,D,O={label:0,sent:function(){if(1&g[0])throw g[1];return g[1]},trys:[],ops:[]};return D={next:U(0),throw:U(1),return:U(2)},typeof Symbol=="function"&&(D[Symbol.iterator]=function(){return this}),D;function U(k){return function(w){return function(N){if(R)throw new TypeError("Generator is already executing.");for(;D&&(D=0,N[0]&&(O=0)),O;)try{if(R=1,C&&(g=2&N[0]?C.return:N[0]?C.throw||((g=C.return)&&g.call(C),0):C.next)&&!(g=g.call(C,N[1])).done)return g;switch(C=0,g&&(N=[2&N[0],g.value]),N[0]){case 0:case 1:g=N;break;case 4:return O.label++,{value:N[1],done:!1};case 5:O.label++,C=N[1],N=[0];continue;case 7:N=O.ops.pop(),O.trys.pop();continue;default:if(g=O.trys,!((g=g.length>0&&g[g.length-1])||N[0]!==6&&N[0]!==2)){O=0;continue}if(N[0]===3&&(!g||N[1]>g[0]&&N[1]<g[3])){O.label=N[1];break}if(N[0]===6&&O.label<g[1]){O.label=g[1],g=N;break}if(g&&O.label<g[2]){O.label=g[2],O.ops.push(N);break}g[2]&&O.ops.pop(),O.trys.pop();continue}N=A.call(l,O)}catch(H){N=[6,H],C=0}finally{R=g=0}if(5&N[0])throw N[1];return{value:N[0]?N[1]:void 0,done:!0}}([k,w])}}},s=this&&this.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(T,"__esModule",{value:!0}),T.CommonController=void 0;var c=_(771),a=_(5917),e=s(_(102)),r=_(9594),i=_(2718),o=_(1698),t=_(5044),n=_(9428),u=_(6091),h=_(5788),S=_(280),x=_(5649),E=function(l){function A(R){var C=l.call(this)||this;return C.datachannelList=new p,C.receiverCodecPreferences={},C.senderCodecPreferences={},C.canAutoAssignDcId=!0,C.reporter=R,C.signalChannel=new h.SignalChannel({reporter:R}),C.proxySignalChannelEvents(),C}return d(A,l),A.prototype.setConfig=function(R){this.config=R},A.prototype.setPeerconnection=function(R){var C=this;R!==this.peerconnection&&(this.peerconnection&&this.peerconnection.removeAllListeners(),this.peerconnection=R,this.signalChannel.isOpen||(this.waitForOpenPms=new Promise(function(g,D){C.peerconnection.on("datachannelStatusChange",function(O){var U;C.emit("datachannelStatusChange",O),O.status===S.EDatachannelStatus.DATACHANNEL_STATUS_OPEN&&(C.signalChannel.setPeerConnection(R),C.canAutoAssignDcId=typeof((U=C.signalChannel.datachannelCore)===null||U===void 0?void 0:U.id)=="number",g())})})),this.peerconnection.on("cumuDelayNotSupported",function(){var g;C.emit("cumuDelayNotSupported"),(g=C.reporter)===null||g===void 0||g.reportCumuDelayNotSupported()}),this.peerconnection.on("innerSubscribeDeleteTracks",function(g){C.handleWorkerSubDelete(g)}),this.peerconnection.on("encodedFrame",function(g){var D;C.emit("encodedFrame",g),g.kind==="video"&&(0,r.parseSei)((D=g.frame)===null||D===void 0?void 0:D.data).forEach(function(O){var U;if(O.payloadType===x.CUMU_DELAY_SEI_PAYLOAD_TYPE){var k={pub:{},sub:{},grtn:{},AIPub:{},AISub:{},AIAgent:{},AIGrtn:{},other:{}},w=new x.CumuDelaySeiPayloadParser(O.data);k.pub=w.pub||{},k.sub=g.subStats||{},k.grtn=w.grtn||{},k.AIPub=w.AIPub||{},k.AISub=w.AISub||{},k.AIAgent=w.AIAgent||{},k.AIGrtn=w.AIGrtn||{},k.other=w.other||{},Object.keys(k.pub).forEach(function(H){var F=k.pub[H];delete k.pub[H],k.pub[(0,i.lowercaseFirstLetter)(H)]=F}),Object.keys(k.sub).forEach(function(H){var F=k.sub[H];delete k.sub[H],k.sub[(0,i.lowercaseFirstLetter)(H)]=F}),Object.keys(k.AIPub).forEach(function(H){var F=k.AIPub[H];delete k.AIPub[H],k.AIPub[(0,i.lowercaseFirstLetter)(H)]=F}),Object.keys(k.AISub).forEach(function(H){var F=k.AISub[H];delete k.AISub[H],k.AISub[(0,i.lowercaseFirstLetter)(H)]=F}),Object.keys(k.AIAgent).forEach(function(H){var F=k.AIAgent[H];delete k.AIAgent[H],k.AIAgent[(0,i.underlineToCamelCase)(H.toLowerCase())]=F}),Object.keys(k.AIGrtn).forEach(function(H){var F=k.AIGrtn[H];delete k.AIGrtn[H],k.AIGrtn[(0,i.underlineToCamelCase)(H.toLowerCase())]=F}),Object.keys(k.grtn).forEach(function(H){var F=k.grtn[H];delete k.grtn[H],k.grtn[(0,i.underlineToCamelCase)(H.toLowerCase())]=F});var N=void 0;try{N=JSON.stringify(k)}catch(H){console.warn(H,k)}N&&(O.data=new TextEncoder().encode(N),(U=C.reporter)===null||U===void 0||U.updateCumuDelayInfo({json:N}))}C.emit("receivedSEI",{url:g.url,vMsid:g.vMsid,sei:O})})}),this.peerconnection.on("message",function(g){var D;(D=C.reporter)===null||D===void 0||D.reportNotifyMessage(g)}),this.peerconnection.on("hebtReceived",function(g){C.emit("heartbeat",g)}),this.peerconnection.on("streamError",function(g){C.emit("onError",new t.RtsError(n.ErrorCode.ERROR_SINGLE_PC_STREAM_ERROR,g.resMsg,"",f({},g)))}),this.peerconnection.on("streamReconnect",function(g){C.emit("reconnect",{type:g.type,reason:new t.RtsError(n.ErrorCode.ERROR_SINGLE_PC_STREAM_ERROR,g.resMsg,"",f({},g)),retryTimes:1,extraInfo:f({},g)}),C.singleStreamReconnect(g).then(function(){C.emit("reconnectFinish",{type:g.type,latestUrl:g.latestUrl,msids:g.msids})}).catch(function(D){C.emit("onError",new t.RtsError(n.ErrorCode.ERROR_SINGLE_PC_STREAM_RECONNECT_FAILED,"single stream reconnect failed","",{originError:D}))})}),this.peerconnection.on("traceIdUpdate",function(g){C.emit("traceId",g)}),this.peerconnection.on("pcReconnect",function(g){C.emit("reconnect",{type:"pc",reason:new t.RtsError(n.ErrorCode.ERROR_SINGLE_PC_FULL_RECONNECT,g.reMsg,"",f({},g)),retryTimes:1,extraInfo:f({},g)})}),(this.receiverCodecPreferences.video||this.receiverCodecPreferences.audio)&&this.peerconnection.setReceiverCodecPreferences(this.receiverCodecPreferences),(this.senderCodecPreferences.video||this.senderCodecPreferences.audio)&&this.peerconnection.setSenderCodecPreferences(this.senderCodecPreferences))},Object.defineProperty(A.prototype,"peerCore",{get:function(){var R;return(R=this.peerconnection)===null||R===void 0?void 0:R.getPeerCore()},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"streamManager",{get:function(){var R;return(R=this.peerCore)===null||R===void 0?void 0:R.getStreamManager()},enumerable:!1,configurable:!0}),A.prototype.subscribeAdd=function(R,C){return y(this,void 0,void 0,function(){var g,D,O,U,k,w,N,H,F=this;return v(this,function(P){switch(P.label){case 0:if(R.forEach(function(B){var W;(W=F.reporter)===null||W===void 0||W.reportSubscribeStart(B.url,"",B.vMsid,B.aMsid,!0)}),!this.peerconnection)throw this.makeRtsError("subscribeAdd");this.peerconnection.isReused=!0,g=new Date().getTime(),P.label=1;case 1:return P.trys.push([1,3,,4]),[4,this.peerconnection.subAdd(R,C)];case 2:if(!(D=P.sent()).streamList)throw new t.RtsError(n.ErrorCode.ERROR_SUBADD_NO_RESULT,"subAdd streamList not found","",{api:"subscribeAdd",configList:R,response:D});return[3,4];case 3:throw O=P.sent(),U=O,(H=this.reporter)===null||H===void 0||H.reportErrorInfo(U.errorCode,U.message,U.traceId,U.extraInfo),U;case 4:return k=D.deleteRspTime-g,w=D.subAddRspTime-D.deleteRspTime,N=D.activeRspTime-D.subAddRspTime,D.streamList.forEach(function(B,W){var z,G,J,re;(z=F.reporter)===null||z===void 0||z.reportSubscribeOk({vurl:B.url||void 0,isSubAdd:!0});var te,ie=R[W]||{},ce=ie.targetStream,se=ie.vMsid,ue=ie.aMsid,pe=B.stream;if(ce)return ce.mergeStream(pe),(G=F.streamManager)===null||G===void 0||G.update(B.url,{stream:ce,vMsid:se?.[0],aMsid:ue?.[0]}),void(B.stream=ce);var de=(J=F.streamManager)===null||J===void 0?void 0:J.getStreamByMsid({url:B.url,vMsid:se?.[0],aMsid:ue?.[0]});if(de)de.mergeStream(pe),te=de;else{(te=new c.RemoteStream).updateMediaStream(pe),(re=F.streamManager)===null||re===void 0||re.update(B.url,{stream:te,vMsid:se?.[0],aMsid:ue?.[0]}),te.on("onCanPlay",function(){var Ee,fe,me=new Date().getTime();(Ee=F.reporter)===null||Ee===void 0||Ee.reportFirstFrameTime(B.url,B.traceId,-1,-1,me-g,0,-1,{},k,w,N,se,ue,!0),(fe=F.peerconnection)===null||fe===void 0||fe.playStart()});var ve=new u.PlayEvent(u.PlayType.PLAY_CANPLAY);ve.data={url:B.url,vMsid:se?.[0]||"vMsid unknown",aMsid:ue?.[0]||"aMsid unknown"},F.emit("onPlayEvent",ve)}B.stream=te}),[2,D.streamList]}})})},A.prototype.subscribeActive=function(R){return y(this,void 0,void 0,function(){var C;return v(this,function(g){if(!this.peerconnection)throw this.makeRtsError("subscribeActive");return[2,(C=this.peerconnection)===null||C===void 0?void 0:C.subActive(R)]})})},A.prototype.subscribeStop=function(R){return y(this,void 0,void 0,function(){var C,g,D,O,U;return v(this,function(k){switch(k.label){case 0:if(!this.peerconnection)throw this.makeRtsError("subscribeStop");k.label=1;case 1:return k.trys.push([1,3,,4]),[4,this.peerconnection.subStop(R)];case 2:return C=k.sent(),this.peerconnection.getSubMonitor().updateTranceiversController(),g=this.peerconnection.getWorkerManager(),R.forEach(function(w){g.removeByUrl({url:w.url,source:a.EWorkerSource.Receiver})}),[3,4];case 3:throw D=k.sent(),O=D,(U=this.reporter)===null||U===void 0||U.reportErrorInfo(O.errorCode,O.message,O.traceId,O.extraInfo),D;case 4:return[2,C]}})})},A.prototype.subscribeDeleteTracks=function(R){return y(this,void 0,void 0,function(){var C,g,D,O;return v(this,function(U){switch(U.label){case 0:if(!this.peerconnection)throw this.makeRtsError("subscribeDeleteTracks");U.label=1;case 1:return U.trys.push([1,3,,4]),[4,this.peerconnection.subDeleteTracks(R)];case 2:if(!(C=U.sent()))throw this.makeRtsError("subscribeDeleteTracks");return this.peerconnection.getSubMonitor().updateTranceiversController(),this.handleWorkerSubDelete(R),[3,4];case 3:throw g=U.sent(),D=g,(O=this.reporter)===null||O===void 0||O.reportErrorInfo(D.errorCode,D.message,D.traceId,D.extraInfo),g;case 4:return[2,C]}})})},A.prototype.handleWorkerSubDelete=function(R){if(this.peerconnection){var C=this.peerconnection.getWorkerManager();R.forEach(function(g){var D,O;!((D=g.vMsid)===null||D===void 0)&&D.length&&C.removeByMsid({url:g.url,source:a.EWorkerSource.Receiver,kind:"video",msid:g.vMsid[0]}),!((O=g.aMsid)===null||O===void 0)&&O.length&&C.removeByMsid({url:g.url,source:a.EWorkerSource.Receiver,kind:"audio",msid:g.aMsid[0]})})}},A.prototype.publishAdd=function(R){return y(this,void 0,void 0,function(){var C,g,D,O,U,k,w,N,H,F,P,B=this;return v(this,function(W){switch(W.label){case 0:if(R.forEach(function(z){var G;(G=B.reporter)===null||G===void 0||G.reportStartPublish(z.url,"",!0)}),C=new Date().getTime(),!this.peerconnection)throw this.makeRtsError("publishAdd");W.label=1;case 1:return W.trys.push([1,3,,4]),[4,(N=this.peerconnection)===null||N===void 0?void 0:N.pubAdd(R)];case 2:if(!(g=W.sent()))throw new t.RtsError(n.ErrorCode.ERROR_PUBADD_NO_RESULT,"pubAdd streamList not found","",{api:"publishAdd",publishInfoList:R});return[3,4];case 3:throw D=W.sent(),O=D,(H=this.reporter)===null||H===void 0||H.reportErrorInfo(O.errorCode,O.message,O.traceId,O.extraInfo),O;case 4:return this.peerconnection.isReused=!0,U=new Date().getTime(),k=U-C,g.forEach(function(z){var G;(G=B.reporter)===null||G===void 0||G.reportPublishOk(z.url||"","",-1,-1,-1,z.traceId||"",k,!0)}),(w=(F=this.peerconnection)===null||F===void 0?void 0:F.getPc())&&(R.forEach(function(z){B.peerconnection&&z.stream.setEncodeParam(w)}),this.peerCore&&((P=this.peerconnection)===null||P===void 0||P.getPubMonitor().startHeartbeat(w,this.peerCore)),w.getSenders().forEach(function(z){var G;z.track&&((G=B.peerconnection)===null||G===void 0||G.handleEncodedInsertableStreams({sender:z}))})),[2,g]}})})},A.prototype.publishDeleteTracks=function(R){return y(this,void 0,void 0,function(){var C,g,D,O,U;return v(this,function(k){switch(k.label){case 0:if(!this.peerconnection)throw this.makeRtsError("publishDeleteTracks");k.label=1;case 1:return k.trys.push([1,3,,4]),[4,this.peerconnection.pubDeleteTracks(R)];case 2:if(!(C=k.sent()))throw this.makeRtsError("publishDeleteTracks");return this.peerconnection.getPubMonitor().updateSenders(),g=this.peerconnection.getWorkerManager(),R.forEach(function(w){var N,H;!((N=w.vMsid)===null||N===void 0)&&N.length&&g.removeByMsid({url:w.url,source:a.EWorkerSource.Sender,kind:"video",msid:w.vMsid[0]}),!((H=w.aMsid)===null||H===void 0)&&H.length&&g.removeByMsid({url:w.url,source:a.EWorkerSource.Sender,kind:"audio",msid:w.aMsid[0]})}),[3,4];case 3:throw D=k.sent(),O=D,(U=this.reporter)===null||U===void 0||U.reportErrorInfo(O.errorCode,O.message,O.traceId,O.extraInfo),D;case 4:return[2,C]}})})},A.prototype.publishReplaceTracks=function(R){return y(this,void 0,void 0,function(){var C,g,D,O;return v(this,function(U){switch(U.label){case 0:if(!this.peerconnection)throw this.makeRtsError("publishReplaceTracks");U.label=1;case 1:return U.trys.push([1,3,,4]),[4,this.peerconnection.pubReplaceTracks(R)];case 2:if(!(C=U.sent()))throw this.makeRtsError("publishReplaceTracks");return this.peerconnection.getPubMonitor().updateSenders(),[3,4];case 3:throw g=U.sent(),D=g,(O=this.reporter)===null||O===void 0||O.reportErrorInfo(D.errorCode,D.message,D.traceId,D.extraInfo),g;case 4:return[2,C]}})})},A.prototype.publishStop=function(R){return y(this,void 0,void 0,function(){var C,g,D,O,U,k=this;return v(this,function(w){switch(w.label){case 0:if(R.forEach(function(N){var H;(H=k.reporter)===null||H===void 0||H.reportStopPublish(N.url,!0)}),!this.peerconnection)throw this.makeRtsError("publishStop");w.label=1;case 1:return w.trys.push([1,3,,4]),[4,this.peerconnection.pubStop(R)];case 2:return C=w.sent(),this.peerconnection.getPubMonitor().updateSenders(),g=this.peerconnection.getWorkerManager(),R.forEach(function(N){g.removeByUrl({url:N.url,source:a.EWorkerSource.Sender})}),[3,4];case 3:throw D=w.sent(),O=D,(U=this.reporter)===null||U===void 0||U.reportErrorInfo(O.errorCode,O.message,O.traceId,O.extraInfo),D;case 4:return[2,C]}})})},A.prototype.handleAddDatachannel=function(R){return y(this,void 0,void 0,function(){var C,g,D,O,U,k,w,N,H,F,P,B,W=this;return v(this,function(z){switch(z.label){case 0:if(!R.url||!R.signalUrl||!R.msid)throw g=new t.RtsError(n.ErrorCode.ERROR_DATACHANNEL_PARAM,"url, signalUrl, msid is required by subscribe(publish)AddDatachannel",""),(w=this.reporter)===null||w===void 0||w.reportErrorInfo(g.errorCode,g.message,g.traceId,g.extraInfo),g;return C=R.type==="sub",this.waitForOpenPms?[4,this.waitForOpenPms]:[3,2];case 1:z.sent(),this.waitForOpenPms=void 0,z.label=2;case 2:if(this.signalChannel.isOpen)return[3,4];if(console.warn("Creating a new signal channel"),!R.signalUrl)throw g=new t.RtsError(n.ErrorCode.ERROR_SIGNAL_URL,"signal url is required",""),(N=this.reporter)===null||N===void 0||N.reportErrorInfo(g.errorCode,g.message,g.traceId,g.extraInfo),g;return[4,this.initSignalChannel(R)];case 3:z.sent(),this.setPeerconnection(this.signalChannel.getPeerConnection()),this.canAutoAssignDcId=typeof((H=this.signalChannel.datachannelCore)===null||H===void 0?void 0:H.id)=="number",z.label=4;case 4:if(D=performance.now(),O={url:R.url,label:R.label,surl:R.signalUrl,msid:R.msid},C?(F=this.reporter)===null||F===void 0||F.reportDatachannelSubAdd(O):(P=this.reporter)===null||P===void 0||P.reportDatachannelPubAdd(O),!(U=(B=this.peerconnection)===null||B===void 0?void 0:B.getPc()))throw new Error("No avaliable peerconnection");return k=new S.DataChannelCore({pc:U,label:R.label,datachannelList:this.datachannelList.list,assignId:!this.canAutoAssignDcId,delayOpen:o.configProvider.getContext().datachannelDelayOpen}),this.datachannelList.update(k),[2,new Promise(function(G,J){return y(W,void 0,void 0,function(){var re,te,ie,ce,se,ue,pe,de,ve,Ee,fe,me,ge,be,Re,Te,Ie=this;return v(this,function(xe){switch(xe.label){case 0:re="",te=!1,ie=!1,k.on("statusChange",function(De){var Ce;(Ce=Ie.reporter)===null||Ce===void 0||Ce.reportDatachannelStatusChange({state:S.EDatachannelStatus[De],url:R.url,label:k.label,id:k.id,msid:R.msid}),De===S.EDatachannelStatus.DATACHANNEL_STATUS_OPEN&&(te=!0,ie&&G({datachannel:k,traceId:re}))}),k.on("dispose",function(){var De;(De=Ie.reporter)===null||De===void 0||De.reportDatachannelDispose({url:R.url,label:k.label,id:k.id,msid:R.msid})}),xe.label=1;case 1:return xe.trys.push([1,6,,7]),ce=[{url:R.url,msid:R.msid,datachannelId:k.id,label:R.label,datachannel:k}],C?[4,(Ee=this.peerCore)===null||Ee===void 0?void 0:Ee.subscribeAddDatachannel(ce)]:[3,3];case 2:return ue=xe.sent(),[3,5];case 3:return[4,(fe=this.peerCore)===null||fe===void 0?void 0:fe.publishAddDatachannel(ce)];case 4:ue=xe.sent(),xe.label=5;case 5:return re=(ge=(me=(se=ue)==null?void 0:se.streams)===null||me===void 0?void 0:me[0])===null||ge===void 0?void 0:ge.traceid,[3,7];case 6:return pe=xe.sent(),de=pe,(be=this.reporter)===null||be===void 0||be.reportErrorInfo(de.errorCode,de.message||"datachannel ".concat(C?"sub":"pub"," add error"),de.traceId,de.extraInfo),[2,J(pe)];case 7:return ve={url:R.url,drct:Math.floor(performance.now()-D),tcid:re,label:k.label,id:k.id,msid:R.msid},C?(Re=this.reporter)===null||Re===void 0||Re.reportDatachannelSubAddOk(ve):(Te=this.reporter)===null||Te===void 0||Te.reportDatachannelPubAddOk(ve),ie=!0,te&&G({datachannel:k,traceId:re}),[2]}})})})]}})})},A.prototype.handleStopDatachannel=function(R){return y(this,void 0,void 0,function(){var C,g,D,O,U,k,w,N,H,F,P,B;return v(this,function(W){switch(W.label){case 0:if(!R.url||!R.datachannel)throw C=new t.RtsError(n.ErrorCode.ERROR_DATACHANNEL_PARAM,"url, datachannel is required by subscribe(publish)StopDatachannel",""),(U=this.reporter)===null||U===void 0||U.reportErrorInfo(C.errorCode,C.message,C.traceId,C.extraInfo),C;if(!this.signalChannel.isOpen)throw C=new t.RtsError(n.ErrorCode.ERROR_NO_DATACHANNEL,"Signal channel is closed",""),(k=this.reporter)===null||k===void 0||k.reportErrorInfo(C.errorCode,C.message,C.traceId,C.extraInfo),C;g=R.type==="sub",D=[{url:R.url}],O={url:R.url,label:R.datachannel.label,id:R.datachannel.id},g?(w=this.reporter)===null||w===void 0||w.reportDatachannelSubStop(O):(N=this.reporter)===null||N===void 0||N.reportDatachannelPubStop(O),W.label=1;case 1:return W.trys.push([1,6,,7]),g?[4,(H=this.peerCore)===null||H===void 0?void 0:H.subscribeStopDatachannel(D)]:[3,3];case 2:return W.sent(),[3,5];case 3:return[4,(F=this.peerCore)===null||F===void 0?void 0:F.publishStopDatachannel(D)];case 4:W.sent(),W.label=5;case 5:return[3,7];case 6:throw W.sent();case 7:return g?(P=this.reporter)===null||P===void 0||P.reportDatachannelSubStopOk(O):(B=this.reporter)===null||B===void 0||B.reportDatachannelPubStopOk(O),R.datachannel.dispose(),[2]}})})},A.prototype.subscribeAddDatachannel=function(R){return y(this,void 0,void 0,function(){return v(this,function(C){return[2,this.handleAddDatachannel(f(f({},R),{type:"sub"}))]})})},A.prototype.publishAddDatachannel=function(R){return y(this,void 0,void 0,function(){return v(this,function(C){return[2,this.handleAddDatachannel(f(f({},R),{type:"pub"}))]})})},A.prototype.subscribeStopDatachannel=function(R){return y(this,void 0,void 0,function(){return v(this,function(C){return[2,this.handleStopDatachannel(f(f({},R),{type:"sub"}))]})})},A.prototype.publishStopDatachannel=function(R){return y(this,void 0,void 0,function(){return v(this,function(C){return[2,this.handleStopDatachannel(f(f({},R),{type:"pub"}))]})})},A.prototype.getSubscribeVideoStats=function(R,C){return this.getSubscribeMediaStats(R,"video",C)},A.prototype.getSubscribeAudioStats=function(R,C){return this.getSubscribeMediaStats(R,"audio",C)},A.prototype.getPublishVideoStats=function(R,C){return this.getPublishMediaStats(R,"video",C)},A.prototype.getPublishAudioStats=function(R,C){return this.getPublishMediaStats(R,"audio",C)},A.prototype.sendSEI=function(R){var C,g;if(!((C=this.peerconnection)===null||C===void 0)&&C.isReused)return(g=this.peerconnection)===null||g===void 0?void 0:g.sendSEI(R)},A.prototype.setReceiverCodecPreferences=function(R){this.receiverCodecPreferences=f({},R)},A.prototype.setSenderCodecPreferences=function(R){this.senderCodecPreferences=f({},R)},A.prototype.getSubscribeMediaStats=function(R,C,g){var D=this;return new Promise(function(O){return y(D,void 0,void 0,function(){var U,k,w,N,H;return v(this,function(F){switch(F.label){case 0:return this.streamManager?(U=void 0,k=this.streamManager.getAllMediaInfoList(R,!0),g?k.forEach(function(P){var B,W,z,G=(W=(B=P.transceiver)===null||B===void 0?void 0:B.receiver)===null||W===void 0?void 0:W.track;G?.kind===C&&P.msid===g&&(U=(z=P.transceiver)===null||z===void 0?void 0:z.receiver)}):U=(H=(N=k?.find(function(P){var B,W,z;return((z=(W=(B=P.transceiver)===null||B===void 0?void 0:B.receiver)===null||W===void 0?void 0:W.track)===null||z===void 0?void 0:z.kind)===C}))===null||N===void 0?void 0:N.transceiver)===null||H===void 0?void 0:H.receiver,U?(w=!1,[4,U.getStats()]):[2,O({})]):[2,O({})];case 1:return F.sent().forEach(function(P){P.type==="inbound-rtp"&&(w=!0,O(P))}),w||O({}),[2]}})})})},A.prototype.getPublishMediaStats=function(R,C,g){var D=this;return new Promise(function(O){return y(D,void 0,void 0,function(){var U,k,w,N,H;return v(this,function(F){switch(F.label){case 0:return this.streamManager?(U=void 0,k=this.streamManager.getAllMediaInfoList(R,!0),g?k.forEach(function(P){var B,W,z,G=(W=(B=P.transceiver)===null||B===void 0?void 0:B.sender)===null||W===void 0?void 0:W.track;G?.kind===C&&P.msid===g&&(U=(z=P.transceiver)===null||z===void 0?void 0:z.sender)}):U=(H=(N=k?.find(function(P){var B,W,z;return((z=(W=(B=P.transceiver)===null||B===void 0?void 0:B.sender)===null||W===void 0?void 0:W.track)===null||z===void 0?void 0:z.kind)===C}))===null||N===void 0?void 0:N.transceiver)===null||H===void 0?void 0:H.sender,U?(w=!1,[4,U.getStats()]):[2,O({})]):[2,O({})];case 1:return F.sent().forEach(function(P){P.type==="outbound-rtp"&&O(P)}),w||O({}),[2]}})})})},A.prototype.proxySignalChannelEvents=function(){var R=this;this.signalChannel.on("connectStatusChange",function(C){R.emit("connectStatusChange",C)}),this.signalChannel.on("onError",function(C){R.emit("onError",C)})},A.prototype.initSignalChannel=function(R){return this.signalChannel.createDatachannel(R)},A.prototype.makeRtsError=function(R){var C,g=new t.RtsError(n.ErrorCode.ERROR_NO_DATACHANNEL,"No avaliable datachannel, you should subscribe/publish first.","",{api:R});return(C=this.reporter)===null||C===void 0||C.reportErrorInfo(g.errorCode,g.message,g.traceId,g.extraInfo),g},A.prototype.singleStreamReconnect=function(R){var C=this;return new Promise(function(g,D){var O,U,k=R.type,w=void 0,N=void 0;switch(k){case"sub":(O=R.streams)===null||O===void 0||O.forEach(function(F){var P=[],B=[],W=!0,z=!0;R.msids.forEach(function(G){G.streamId===F.id&&(G.type==="video"?B.push(G.name):G.type==="audio"&&P.push(G.name))}),P.length||(W=!1),B.length||(z=!1),C.subscribeAddWithRetry({url:R.latestUrl,subAudio:W,subVideo:z,vMsid:B,aMsid:P,targetStream:F}).then(g).catch(D)});break;case"pub":(U=R.streams)===null||U===void 0||U.forEach(function(F){var P=[],B=[];R.msids.forEach(function(W){W.streamId===F.id&&(W.type==="video"?B.push(W.name):W.type==="audio"&&P.push(W.name))}),C.publishAddWithRetry([{url:R.latestUrl,vMsid:B,aMsid:P,stream:F}]).then(g).catch(D)});break;case"pub-data":if(R.msids.forEach(function(F){w=F.name,N=F.label}),w&&N){var H=R.latestUrl;C.publishAddDatachannelWithRetry({url:H,signalUrl:H,msid:w,label:N}).then(g).catch(D)}break;case"sub-data":R.msids.forEach(function(F){w=F.name,N=F.label}),w&&N&&(H=R.latestUrl,C.subscribeAddDatachannelWithRetry({url:H,signalUrl:H,msid:w,label:N}).then(g).catch(D));break;default:console.warn("RTS PC STREAM RECONNECT: Unknown signal")}})},A.prototype.updateAuth=function(R){var C;return!!(!((C=this.streamManager)===null||C===void 0)&&C.updateLatestUrl(R))},A.prototype.subscribeAddWithRetry=function(R,C){var g=this;return C===void 0&&(C=0),new Promise(function(D,O){g.subscribeAdd([R],!0).then(function(){D()}).catch(function(U){return y(g,void 0,void 0,function(){var k,w;return v(this,function(N){switch(N.label){case 0:return C<(((k=this.config)===null||k===void 0?void 0:k.retryTimes)||0)?[4,b(((w=this.config)===null||w===void 0?void 0:w.retryInterval)||0)]:[3,2];case 1:return N.sent(),[2,this.subscribeAddWithRetry(R,C+1).then(D).catch(O)];case 2:O(U),N.label=3;case 3:return[2]}})})})})},A.prototype.publishAddWithRetry=function(R,C){var g=this;return C===void 0&&(C=0),new Promise(function(D,O){g.publishAdd(R).then(function(){D()}).catch(function(U){return y(g,void 0,void 0,function(){var k,w;return v(this,function(N){switch(N.label){case 0:return C<(((k=this.config)===null||k===void 0?void 0:k.retryTimes)||0)?[4,b(((w=this.config)===null||w===void 0?void 0:w.retryInterval)||0)]:[3,2];case 1:return N.sent(),[2,this.publishAddWithRetry(R,C+1).then(D).catch(O)];case 2:O(U),N.label=3;case 3:return[2]}})})})})},A.prototype.subscribeAddDatachannelWithRetry=function(R,C){var g=this;return C===void 0&&(C=0),new Promise(function(D,O){g.subscribeAddDatachannel(R).then(function(){D()}).catch(function(U){return y(g,void 0,void 0,function(){var k,w;return v(this,function(N){switch(N.label){case 0:return C<(((k=this.config)===null||k===void 0?void 0:k.retryTimes)||0)?[4,b(((w=this.config)===null||w===void 0?void 0:w.retryInterval)||0)]:[3,2];case 1:return N.sent(),[2,this.subscribeAddDatachannelWithRetry(R,C+1).then(D).catch(O)];case 2:O(U),N.label=3;case 3:return[2]}})})})})},A.prototype.publishAddDatachannelWithRetry=function(R,C){var g=this;return C===void 0&&(C=0),new Promise(function(D,O){g.publishAddDatachannel(R).then(function(){D()}).catch(function(U){return y(g,void 0,void 0,function(){var k,w;return v(this,function(N){switch(N.label){case 0:return C<(((k=this.config)===null||k===void 0?void 0:k.retryTimes)||0)?[4,b(((w=this.config)===null||w===void 0?void 0:w.retryInterval)||0)]:[3,2];case 1:return N.sent(),[2,this.publishAddDatachannelWithRetry(R,C+1).then(D).catch(O)];case 2:O(U),N.label=3;case 3:return[2]}})})})})},A}(e.default);T.CommonController=E;var p=function(){function l(){this._list=[]}return Object.defineProperty(l.prototype,"list",{get:function(){return this._list},enumerable:!1,configurable:!0}),l.prototype.update=function(A){var R=this._list.findIndex(function(C){return C.id===A.id});R!==-1?this._list.splice(R,1,A):this._list.push(A)},l}();function b(l){return l===void 0&&(l=1e3),new Promise(function(A){setTimeout(A,l)})}},9796:function(j,T,_){var m,d=this&&this.__extends||(m=function(S,x){return m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(E,p){E.__proto__=p}||function(E,p){for(var b in p)Object.prototype.hasOwnProperty.call(p,b)&&(E[b]=p[b])},m(S,x)},function(S,x){if(typeof x!="function"&&x!==null)throw new TypeError("Class extends value "+String(x)+" is not a constructor or null");function E(){this.constructor=S}m(S,x),S.prototype=x===null?Object.create(x):(E.prototype=x.prototype,new E)}),f=this&&this.__assign||function(){return f=Object.assign||function(S){for(var x,E=1,p=arguments.length;E<p;E++)for(var b in x=arguments[E])Object.prototype.hasOwnProperty.call(x,b)&&(S[b]=x[b]);return S},f.apply(this,arguments)},y=this&&this.__awaiter||function(S,x,E,p){return new(E||(E=Promise))(function(b,l){function A(g){try{C(p.next(g))}catch(D){l(D)}}function R(g){try{C(p.throw(g))}catch(D){l(D)}}function C(g){var D;g.done?b(g.value):(D=g.value,D instanceof E?D:new E(function(O){O(D)})).then(A,R)}C((p=p.apply(S,x||[])).next())})},v=this&&this.__generator||function(S,x){var E,p,b,l,A={label:0,sent:function(){if(1&b[0])throw b[1];return b[1]},trys:[],ops:[]};return l={next:R(0),throw:R(1),return:R(2)},typeof Symbol=="function"&&(l[Symbol.iterator]=function(){return this}),l;function R(C){return function(g){return function(D){if(E)throw new TypeError("Generator is already executing.");for(;l&&(l=0,D[0]&&(A=0)),A;)try{if(E=1,p&&(b=2&D[0]?p.return:D[0]?p.throw||((b=p.return)&&b.call(p),0):p.next)&&!(b=b.call(p,D[1])).done)return b;switch(p=0,b&&(D=[2&D[0],b.value]),D[0]){case 0:case 1:b=D;break;case 4:return A.label++,{value:D[1],done:!1};case 5:A.label++,p=D[1],D=[0];continue;case 7:D=A.ops.pop(),A.trys.pop();continue;default:if(b=A.trys,!((b=b.length>0&&b[b.length-1])||D[0]!==6&&D[0]!==2)){A=0;continue}if(D[0]===3&&(!b||D[1]>b[0]&&D[1]<b[3])){A.label=D[1];break}if(D[0]===6&&A.label<b[1]){A.label=b[1],b=D;break}if(b&&A.label<b[2]){A.label=b[2],A.ops.push(D);break}b[2]&&A.ops.pop(),A.trys.pop();continue}D=x.call(S,A)}catch(O){D=[6,O],p=0}finally{E=b=0}if(5&D[0])throw D[1];return{value:D[0]?D[1]:void 0,done:!0}}([C,g])}}},s=this&&this.__importDefault||function(S){return S&&S.__esModule?S:{default:S}};Object.defineProperty(T,"__esModule",{value:!0}),T.Publisher=void 0;var c=_(5917),a=_(4865),e=s(_(7028)),r=_(9428),i=_(5044),o=_(7989),t=s(_(102)),n=s(_(8219)),u=_(2718),h=function(S){function x(E){var p=S.call(this)||this;return p.publishStartTimeStamp=0,p.pubReconnectTimes=0,p.isConnecting=!1,p.reconnectTimerHandle=null,p.reportMonitorTimes=0,p.reportSubFlag=!1,p.reporter=E,p.peerconnection=new a.RtsPeerconnection,p.peerconnection.on("connectStatusChange",function(b){b.status!==c.EConnectStatus.CONNECT_STATUS_DISCONNECTED&&b.status!==c.EConnectStatus.CONNECT_STATUS_RECONNECTING||!p.hasRetries()?p.emit("connectStatusChange",b):p.emit("onError",new i.RtsError(r.ErrorCode.ERROR_PC_DISCONNECTED,"PC disconnected",""))}),p.peerconnection.on("onMonitorEvent",function(b){var l,A=b.eventList;(l=p.peerconnection)===null||l===void 0||l.updateStatsForSEI(A,b.type),b.type==="pub"?(p.reportMonitorTimes++,p.reportMonitorTimes%4==0&&(A.forEach(function(R){p.reporter.reportPushStats(R)}),p.reportSubFlag=!0,p.reportMonitorTimes=0)):b.type==="sub"&&p.reportSubFlag&&(p.handleSubMonitorEvent(A),p.reportSubFlag=!1)}),p.peerconnection.on("onTransportStateEvent",function(b){var l;p.peerconnection.isReused||((l=p.peerconnection.getPc())===null||l===void 0?void 0:l.connectionState)!=="closed"&&b.state==="closed"&&p.hasRetries()&&p.emit("onError",new i.RtsError(r.ErrorCode.ERROR_TRANSPORT_CLOSED,"Transport has been closed. ".concat(b.kind,"|").concat(b.type,"|").concat(b.url),"",{protocol:b.protocol}))}),p.peerconnection.on("pcReconnect",function(b){var l,A;b.ips?(l="Migrate with ips: ".concat(JSON.stringify(b.ips)),A=r.ErrorCode.ERROR_IP_MIGRATE):(l="PC disconnected",A=r.ErrorCode.ERROR_PC_DISCONNECTED),p.emit("onError",new i.RtsError(A,l,"",{pcErrorInfo:b}))}),p.signalingUrl="",p.publishUrl="",p.publishConfig={},p}return d(x,S),x.prototype.publish=function(E,p,b){var l=this;return new Promise(function(A,R){if(l.unpublish(),b?.cumuDelay&&(b.encodedInsertableStreams=!0),l.localStream=p,l.publishUrl=E,l.publishConfig=b||{},l.checkPublishUrl())if(p)if(p.audioTrack===null)R(new i.RtsError(r.ErrorCode.ERROR_PUBLISH_NOAUDIO,"publish need audiotrack",""));else{var C=b?.signalUrl;l.signalingUrl=C||l.signalingUrl,l.publishStartTimeStamp=new Date().getTime(),p.setReporter(l.reporter),l.peerconnection.createOffer(p.hasAudio,p.hasVideo||p.hasScreen,p,f(f({},b),{publishUrl:E})).then(function(g){var D=g.desp,O=g.publishTrackInfoList;l.publishTrackInfoList=O;var U=new Date().getTime();l.reporter.reportStartPublish(l.publishUrl,l.signalingUrl),l.excuteSignal(D).then(function(k){var w=new Date().getTime();l.peerconnection.recvAnswer(k.data,{answerSdpHook:b?.answerSdpHook,tcpOnly:b?.tcpOnly}).then(function(){l.reporter.reportPublishOk(l.publishUrl,l.signalingUrl,U-l.publishStartTimeStamp,w-U,new Date().getTime()-w,k.data.trace_id),A(k.data.trace_id),l.pubReconnectTimes=0,l.peerconnection.pushStart()}).catch(function(N){N.traceid=k.data?k.data.trace_id:"";var H=new i.RtsError(N.errorCode||r.ErrorCode.ERROR_ANSWER_ERROR,N.message||"set answer error",N.traceid,{sdp:N.sdp});R(H)})}).catch(function(k){var w=new i.RtsError(k.errorCode||r.ErrorCode.ERROR_HTTPREQUEST_ERROR,k.message||"","",{response:k.response,sdp:k.sdp});R(w)})}).catch(function(g){var D=new i.RtsError(g.errorCode||r.ErrorCode.ERROR_CREATEOFFER,g.message||"","");R(D)})}else R(new i.RtsError(r.ErrorCode.ERROR_PUBLISH_NOSTREAM,"publish stream not found",""));else R(new i.RtsError(r.ErrorCode.ERROR_PUBLISH_URL,"url need artc://",""))})},x.prototype.unpublish=function(){this.peerconnection.reset(),this.reporter.reportStopPublish(),this.signalingUrl="",this.publishUrl="",this.publishTrackInfoList=null},x.prototype.getTrackInfoList=function(){return this.publishTrackInfoList||[]},x.prototype.getPeerConnection=function(){return this.peerconnection},x.prototype.replaceTrack=function(E,p){return this.peerconnection.replaceTrack(this.publishUrl,E,p)},x.prototype.excuteSignal=function(E){var p,b=this,l={type:E.type,sdp:E.sdp};return this.isSingleMsid()&&(l.sdp=l.sdp.replace(/msid\:-? /g,"msid:")),!((p=this.publishConfig)===null||p===void 0)&&p.cumuDelay&&(l.sdp=l.sdp.replace(/(m=video[^\n]*\n)/,`$1a=cumudelay
148
- `)),new Promise(function(A,R){n.default.post(b.signalingUrl,{version:e.default.protocol_version,sdk_version:e.default.sdk_version,mode:"rtc",push_stream:b.publishUrl,jsep:l}).then(function(C){var g,D,O,U;if(C&&C.status===200){A(C);try{!((g=b.publishConfig)===null||g===void 0)&&g.cumuDelay&&!(!((O=(D=C.data)===null||D===void 0?void 0:D.jsep)===null||O===void 0)&&O.sdp.includes("a=cumudelay"))&&(console.warn("Not found cumudelay in server sdp"),(U=b.reporter)===null||U===void 0||U.reportCumuDelayAnswerNotFound())}catch{}}else R({message:C?"response status:"+C.status:"response is null",sdp:l.sdp})}).catch(function(C){return y(b,void 0,void 0,function(){var g,D;return v(this,function(O){switch(O.label){case 0:if(![400,500].includes((D=C.response)===null||D===void 0?void 0:D.status))return[3,4];C.sdp=E.sdp,O.label=1;case 1:return O.trys.push([1,3,,4]),[4,new o.SupportUtil().isSupport({isReceiveVideo:!0})];case 2:return O.sent(),[3,4];case 3:return g=O.sent(),C.errorCode=g?.errorCode,C.message=g?.message,this.pubReconnectTimes=1/0,[3,4];case 4:return R(C),[2]}})})})})},x.prototype.checkPublishUrl=function(){if(!this.publishUrl||this.publishUrl.indexOf("artc://")!==0)return!1;var E=window.location.protocol,p=(["http:","https:"].indexOf(E)>-1?E:"https:")+"//";return this.signalingUrl=this.publishUrl.replace("artc://",p),!0},x.prototype.isSingleMsid=function(){if(!this.publishConfig)return!1;var E=this.publishConfig,p=E.vMsid,b=E.aMsid;return!(!p||!p[0]||p[0].indexOf(" ")!==-1)||!(!b||!b[0]||b[0].indexOf(" ")!==-1)},x.prototype.retryPublish=function(E,p){return y(this,void 0,void 0,function(){var b,l,A,R,C,g,D;return v(this,function(O){switch(O.label){case 0:if(E.extraInfo=f(f({},E.extraInfo),{retryTimes:this.pubReconnectTimes}),!this.hasRetries())return[2,!1];if(typeof(b=this.publishConfig).beforeRetry!="function")return[3,4];O.label=1;case 1:return O.trys.push([1,3,,4]),[4,b.beforeRetry({url:this.publishUrl,stream:this.localStream,vMsid:b.vMsid,aMsid:b.aMsid,useTcp:p})];case 2:return(l=O.sent())?(A=l.url,R=l.stream,C=l.vMsid,g=l.aMsid,R||(console.error("Stream is not returned by beforeRetry function."),this.pubReconnectTimes=1/0),this.reporter.reportReconnectParams("pub",A,C,g,l.useTcp,R?.id),this.publishUrl=A,this.localStream=R,this.publishConfig.vMsid=C,this.publishConfig.aMsid=g,typeof l.useTcp=="boolean"&&(p=l.useTcp),console.log(`Retry with:
149
- [URL] `.concat(A,`
150
- [STREAM] `).concat(R?.id,`
151
- [VMSID]`).concat(C," [AMSID]").concat(g,`
152
- [PROTOCOL] `).concat(p?"TCP":"UDP"))):(this.reporter.reportReconnectParams("pub"),this.pubReconnectTimes=1/0),[3,4];case 3:return D=O.sent(),console.error("Error in beforeRetry",D),[3,4];case 4:return this.hasRetries()&&this.localStream?(this.emit("connectStatusChange",{status:c.EConnectStatus.CONNECT_STATUS_RECONNECTING}),this.incrementReconnectTimes(),E.extraInfo.retryTimes=this.pubReconnectTimes,E.extraInfo.tcpOnly=!!p,this.publishWithReconnect(this.publishUrl,this.localStream,f(f({},this.publishConfig),{tcpOnly:!!p})).catch(function(U){}),[2,!0]):(E.extraInfo.retryTimes=this.pubReconnectTimes,[2,!1])}})})},x.prototype.publishWithReconnect=function(E,p,b,l,A){var R=this;return new Promise(function(C,g){C=l||C,g=A||g,R.isConnecting=!0,R.publish(E,p,b).then(function(D){R.isConnecting=!1,C(D)}).catch(function(D){var O;if(R.peerconnection.reset(),!R.isConnecting)return g(D);if(!r.RECONNECT_ERROR_EXCLUDE_LIST.includes(D.errorCode)&&R.hasRetries(!0)){var U=((O=R.publishConfig)===null||O===void 0?void 0:O.retryInterval)||c.DEFAULT_RETRY_PUBLISH_INTERVAL;R.reconnectTimerHandle=setTimeout(function(){D.extraInfo=f(f({},D.extraInfo),{retryTimes:R.pubReconnectTimes}),R.emit("reconnect",D),R.publishWithReconnect(E,p,b,C,g)},U)}else g(D),D.extraInfo=f(f({},D.extraInfo),{retryTimes:R.pubReconnectTimes}),R.isConnecting=!1,R.emit("onError",D)})})},x.prototype.sendSEI=function(E){var p;(p=this.peerconnection)===null||p===void 0||p.sendSEI(E)},x.prototype.hasRetries=function(E){var p,b,l=c.DEFAULT_RETRY_PUBLISH_LIMIT;typeof((p=this.publishConfig)===null||p===void 0?void 0:p.retryTimes)=="number"&&(l=Math.floor((b=this.publishConfig)===null||b===void 0?void 0:b.retryTimes));var A=this.pubReconnectTimes<l;return E&&A&&this.incrementReconnectTimes(),A},x.prototype.resetRepublishStatus=function(){this.pubReconnectTimes=0,this.isConnecting=!1,this.reporter.updateTid(),this.reconnectTimerHandle!==null&&(clearTimeout(this.reconnectTimerHandle),this.reconnectTimerHandle=null)},x.prototype.handleSubMonitorEvent=function(E){var p=this;E.forEach(function(b){var l={ct:0,tt:4e3,url:b.url},A=b.video,R=b.audio;if(A){var C=A.transportStats,g=A.inboundRtpStats,D=A.inboundRtpStatsPerSec,O=A.localCandidate,U=A.remoteCandidate;l=f(f({},l),{rtt:C?.rtt!==-1?1e3*(C?.rtt||0):-1,cand_re_prot:U.protocol,cand_lo_prot:O.protocol,cand_re_addr:"".concat(U.ip||U.address,":").concat(U.port),cand_lo_addr:"".concat(O.ip||O.address,":").concat(O.port),w:g?.frameWidth,h:g?.frameHeight,vbps:Math.floor(8*D.bytesReceivedPerSecond),fps:g?.framesPerSecond,dfps:Math.floor(D?.framesDecodedPerSecond),vjb:Math.floor((0,u.getJitterBufferDelayAvg)(g?.jitterBufferDelay,g?.jitterBufferEmittedCount)),vMsid:b.vMsid})}R&&(C=R.transportStats,g=R.inboundRtpStats,D=R.inboundRtpStatsPerSec,O=R.localCandidate,U=R.remoteCandidate,l=f(f({},l),{rtt:C?.rtt!==-1?1e3*(C?.rtt||0):-1,cand_re_prot:U.protocol,cand_lo_prot:O.protocol,cand_re_addr:"".concat(U.ip||U.address,":").concat(U.port),cand_lo_addr:"".concat(O.ip||O.address,":").concat(O.port),abps:Math.floor(8*D.bytesReceivedPerSecond),ajb:Math.floor((0,u.getJitterBufferDelayAvg)(g?.jitterBufferDelay,g.jitterBufferEmittedCount)),aMsid:b.aMsid})),p.reporter.reportPullStats(l)})},x.prototype.incrementReconnectTimes=function(){this.pubReconnectTimes++},x.prototype.getPublishConfig=function(){return this.publishConfig},x}(t.default);T.Publisher=h},5788:function(j,T,_){var m,d=this&&this.__extends||(m=function(n,u){return m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(h,S){h.__proto__=S}||function(h,S){for(var x in S)Object.prototype.hasOwnProperty.call(S,x)&&(h[x]=S[x])},m(n,u)},function(n,u){if(typeof u!="function"&&u!==null)throw new TypeError("Class extends value "+String(u)+" is not a constructor or null");function h(){this.constructor=n}m(n,u),n.prototype=u===null?Object.create(u):(h.prototype=u.prototype,new h)}),f=this&&this.__awaiter||function(n,u,h,S){return new(h||(h=Promise))(function(x,E){function p(A){try{l(S.next(A))}catch(R){E(R)}}function b(A){try{l(S.throw(A))}catch(R){E(R)}}function l(A){var R;A.done?x(A.value):(R=A.value,R instanceof h?R:new h(function(C){C(R)})).then(p,b)}l((S=S.apply(n,u||[])).next())})},y=this&&this.__generator||function(n,u){var h,S,x,E,p={label:0,sent:function(){if(1&x[0])throw x[1];return x[1]},trys:[],ops:[]};return E={next:b(0),throw:b(1),return:b(2)},typeof Symbol=="function"&&(E[Symbol.iterator]=function(){return this}),E;function b(l){return function(A){return function(R){if(h)throw new TypeError("Generator is already executing.");for(;E&&(E=0,R[0]&&(p=0)),p;)try{if(h=1,S&&(x=2&R[0]?S.return:R[0]?S.throw||((x=S.return)&&x.call(S),0):S.next)&&!(x=x.call(S,R[1])).done)return x;switch(S=0,x&&(R=[2&R[0],x.value]),R[0]){case 0:case 1:x=R;break;case 4:return p.label++,{value:R[1],done:!1};case 5:p.label++,S=R[1],R=[0];continue;case 7:R=p.ops.pop(),p.trys.pop();continue;default:if(x=p.trys,!((x=x.length>0&&x[x.length-1])||R[0]!==6&&R[0]!==2)){p=0;continue}if(R[0]===3&&(!x||R[1]>x[0]&&R[1]<x[3])){p.label=R[1];break}if(R[0]===6&&p.label<x[1]){p.label=x[1],x=R;break}if(x&&p.label<x[2]){p.label=x[2],p.ops.push(R);break}x[2]&&p.ops.pop(),p.trys.pop();continue}R=u.call(n,p)}catch(C){R=[6,C],S=0}finally{h=x=0}if(5&R[0])throw R[1];return{value:R[0]?R[1]:void 0,done:!0}}([l,A])}}},v=this&&this.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(T,"__esModule",{value:!0}),T.SignalChannel=void 0;var s=v(_(7028)),c=_(4865),a=v(_(102)),e=v(_(8219)),r=_(9428),i=_(5044),o=_(280),t=function(n){function u(h){var S=n.call(this)||this;return S.reporter=h.reporter,S}return d(u,n),Object.defineProperty(u.prototype,"isOpen",{get:function(){return this.readyState==="open"},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"readyState",{get:function(){var h,S;return((h=this.peerconnection)===null||h===void 0?void 0:h.isConnected)&&((S=this.datachannelCore)===null||S===void 0?void 0:S.readyState)},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"datachannelCore",{get:function(){var h,S,x;return(x=(S=(h=this.peerconnection)===null||h===void 0?void 0:h.getPeerCore())===null||S===void 0?void 0:S.getSignal())===null||x===void 0?void 0:x.getDatachannelCore()},enumerable:!1,configurable:!0}),u.prototype.getPeerConnection=function(){return this.peerconnection},u.prototype.setPeerConnection=function(h){this.peerconnection=h},u.prototype.createDatachannel=function(h){return f(this,void 0,void 0,function(){var S,x,E,p,b,l,A,R,C,g,D,O;return y(this,function(U){switch(U.label){case 0:if(S=h.signalUrl,!this.checkUrl(S))throw new i.RtsError(r.ErrorCode.ERROR_DATACHANNEL_PARAM,"url need artc://","");this.closeDatachannel(),this.createPC(),this.reporter.updateUrl(S),this.reporter.reportDatachannelHttpConnect(S),x=performance.now(),U.label=1;case 1:return U.trys.push([1,3,,4]),[4,(g=this.peerconnection)===null||g===void 0?void 0:g.createOffer(!1,!1,void 0,h)];case 2:return E=U.sent(),[3,4];case 3:return p=U.sent(),this.throwRtsError(new i.RtsError(p.errorCode||r.ErrorCode.ERROR_CREATEOFFER,p.message||"","")),[3,4];case 4:l="",U.label=5;case 5:return U.trys.push([5,7,,8]),[4,this.excuteSignal(E.desp)];case 6:return b=U.sent(),l=((D=b?.data)===null||D===void 0?void 0:D.trace_id)||"",this.reporter.reportDatachannelHttpConnectOk({url:S,hrct:Math.floor(performance.now()-x),tcid:l}),[3,8];case 7:return A=U.sent(),this.throwRtsError(new i.RtsError(A.errorCode||r.ErrorCode.ERROR_HTTPREQUEST_ERROR,A.message||"",l)),[3,8];case 8:return U.trys.push([8,10,,11]),[4,(O=this.peerconnection)===null||O===void 0?void 0:O.recvAnswer(b?.data,{answerSdpHook:h.answerSdpHook})];case 9:return U.sent(),[3,11];case 10:return R=U.sent(),this.throwRtsError(new i.RtsError(R.errorCode||r.ErrorCode.ERROR_ANSWER_ERROR,R.message||"set answer error",l)),[3,11];case 11:return U.trys.push([11,13,,14]),[4,this.waitForOpen()];case 12:return U.sent(),[3,14];case 13:return C=U.sent(),this.throwRtsError(new i.RtsError(r.ErrorCode.ERROR_DATACHANNEL_OPEN,"datachannel open failed: ".concat(C),l)),[3,14];case 14:return[2,l]}})})},u.prototype.waitForOpen=function(){var h,S=this;return new Promise(function(x,E){var p;h=window.setTimeout(function(){var l;(l=S.peerconnection)===null||l===void 0||l.off("datachannelStatusChange",b),h=void 0,E("timeout")},5e3);var b=function(l){h&&(clearTimeout(h),h=void 0),l.status===o.EDatachannelStatus.DATACHANNEL_STATUS_OPEN?x(!0):E("status is ".concat(l.status))};(p=S.peerconnection)===null||p===void 0||p.once("datachannelStatusChange",b)})},u.prototype.excuteSignal=function(h){return f(this,void 0,void 0,function(){var S;return y(this,function(x){switch(x.label){case 0:return[4,e.default.post(this.signalUrl,{version:s.default.protocol_version,sdk_version:s.default.sdk_version,mode:"live",jsep:h})];case 1:if(((S=x.sent())==null?void 0:S.status)!==200)throw new i.RtsError(r.ErrorCode.ERROR_SIGNAL_ERROR,S?"response status:"+S.status:"response is null","");return[2,S]}})})},u.prototype.closeDatachannel=function(){var h;(h=this.peerconnection)===null||h===void 0||h.reset()},u.prototype.checkUrl=function(h){var S="artc://";if(h&&h.indexOf(S)===0){var x=window.location.protocol,E=(["http:","https:"].indexOf(x)>-1?x:"https:")+"//";return this.signalUrl=h.replace(S,E),!0}},u.prototype.throwRtsError=function(h){throw this.emit("onError",h),h},u.prototype.createPC=function(){var h=this;this.peerconnection=new c.RtsPeerconnection,this.peerconnection.on("connectStatusChange",function(S){h.emit("connectStatusChange",S)})},u}(a.default);T.SignalChannel=t},2550:function(j,T,_){var m,d=this&&this.__extends||(m=function(x,E){return m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(p,b){p.__proto__=b}||function(p,b){for(var l in b)Object.prototype.hasOwnProperty.call(b,l)&&(p[l]=b[l])},m(x,E)},function(x,E){if(typeof E!="function"&&E!==null)throw new TypeError("Class extends value "+String(E)+" is not a constructor or null");function p(){this.constructor=x}m(x,E),x.prototype=E===null?Object.create(E):(p.prototype=E.prototype,new p)}),f=this&&this.__assign||function(){return f=Object.assign||function(x){for(var E,p=1,b=arguments.length;p<b;p++)for(var l in E=arguments[p])Object.prototype.hasOwnProperty.call(E,l)&&(x[l]=E[l]);return x},f.apply(this,arguments)},y=this&&this.__awaiter||function(x,E,p,b){return new(p||(p=Promise))(function(l,A){function R(D){try{g(b.next(D))}catch(O){A(O)}}function C(D){try{g(b.throw(D))}catch(O){A(O)}}function g(D){var O;D.done?l(D.value):(O=D.value,O instanceof p?O:new p(function(U){U(O)})).then(R,C)}g((b=b.apply(x,E||[])).next())})},v=this&&this.__generator||function(x,E){var p,b,l,A,R={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]};return A={next:C(0),throw:C(1),return:C(2)},typeof Symbol=="function"&&(A[Symbol.iterator]=function(){return this}),A;function C(g){return function(D){return function(O){if(p)throw new TypeError("Generator is already executing.");for(;A&&(A=0,O[0]&&(R=0)),R;)try{if(p=1,b&&(l=2&O[0]?b.return:O[0]?b.throw||((l=b.return)&&l.call(b),0):b.next)&&!(l=l.call(b,O[1])).done)return l;switch(b=0,l&&(O=[2&O[0],l.value]),O[0]){case 0:case 1:l=O;break;case 4:return R.label++,{value:O[1],done:!1};case 5:R.label++,b=O[1],O=[0];continue;case 7:O=R.ops.pop(),R.trys.pop();continue;default:if(l=R.trys,!((l=l.length>0&&l[l.length-1])||O[0]!==6&&O[0]!==2)){R=0;continue}if(O[0]===3&&(!l||O[1]>l[0]&&O[1]<l[3])){R.label=O[1];break}if(O[0]===6&&R.label<l[1]){R.label=l[1],l=O;break}if(l&&R.label<l[2]){R.label=l[2],R.ops.push(O);break}l[2]&&R.ops.pop(),R.trys.pop();continue}O=E.call(x,R)}catch(U){O=[6,U],b=0}finally{p=l=0}if(5&O[0])throw O[1];return{value:O[0]?O[1]:void 0,done:!0}}([g,D])}}},s=this&&this.__rest||function(x,E){var p={};for(var b in x)Object.prototype.hasOwnProperty.call(x,b)&&E.indexOf(b)<0&&(p[b]=x[b]);if(x!=null&&typeof Object.getOwnPropertySymbols=="function"){var l=0;for(b=Object.getOwnPropertySymbols(x);l<b.length;l++)E.indexOf(b[l])<0&&Object.prototype.propertyIsEnumerable.call(x,b[l])&&(p[b[l]]=x[b[l]])}return p},c=this&&this.__importDefault||function(x){return x&&x.__esModule?x:{default:x}};Object.defineProperty(T,"__esModule",{value:!0}),T.LocalStream=void 0;var a=_(5805),e=_(3412),r=_(5044),i=_(9428),o=_(5259),t=_(233),n=c(_(335)),u=_(6295),h=_(2718),S=function(x){function E(){var p=x.call(this)||this;return p.screenSurfaceType="",p.VideoProfileMap=new Map(o.VideoProfileMap),p.ScreenProfileMap=new Map(o.ScreenProfileMap),p.AudioProfileMap=new Map(o.AudioProfileMap),p.deviceManager=new e.BrowserDeviceManager,p.mediastream=new MediaStream,p.hasVideo=!1,p.hasScreen=!1,p.videoProfile="360p_1",p.screenProfile="720p_1",p.audioProfile="standard",p.isCustomStream=!1,p.handleVideoTrackEnded=p.handleVideoTrackEnded.bind(p),p.handleAudioTrackEnded=p.handleAudioTrackEnded.bind(p),p}return d(E,x),Object.defineProperty(E.prototype,"mediaStream",{get:function(){return this.mediastream},enumerable:!1,configurable:!0}),Object.defineProperty(E.prototype,"audioTrack",{get:function(){return this.audiotrack},enumerable:!1,configurable:!0}),Object.defineProperty(E.prototype,"videoTrack",{get:function(){return this.videotrack},enumerable:!1,configurable:!0}),Object.defineProperty(E.prototype,"hasAudio",{get:function(){return!!this.audioTrack},enumerable:!1,configurable:!0}),E.prototype.getVideoProfile=function(){if(this.hasVideo)return this.videoProfile},E.prototype.getScreenProfile=function(){if(this.hasScreen)return this.screenProfile},E.prototype.getAudioProfile=function(){if(this.hasAudio)return this.audioProfile},E.prototype.init=function(p){return p.custom?this.createCustomStream(p.mediaStream):this.initWithRetry(p)},E.prototype.initWithRetry=function(p,b,l){var A=this;return new Promise(function(R,C){R=b||R,C=l||C;var g=[];p.audio&&p.video?g.push(A.initMicCamera(p)):(g.push(A.initMicAudio(p)),g.push(A.initCameraVideo(p))),p.video||g.push(A.initScreenVideoAudio(p)),Promise.all(g).then(function(){A.tryMixMicAndScreenAudio(p),A.initTracks(p),p.skipProfile?R():A.tryToSetProfile(p).then(function(){R()}).catch(function(D){console.log(D),A.resetLocalStream(),A.initWithRetry(f(f({},p),{skipProfile:!0}),R,C)})}).catch(function(D){A.stopAllTracks(),C(D)})})},E.prototype.initMicAudio=function(p){var b=this;return new Promise(function(l,A){if(!p||!p.audio)return l();var R=typeof p.audio=="boolean"?{}:p.audio;b.deviceManager.getAudioTrack(R).then(function(C){b.micAudioTrack=C,b.audiotrack=C,l()}).catch(function(C){A(new r.RtsError(C.code,C.reason,"",C.relatedLink))})})},E.prototype.initCameraVideo=function(p){var b=this;return new Promise(function(l,A){if(!p||!p.video)return l();var R=typeof p.video=="boolean"?{}:p.video;b.deviceManager.getVideoTrack(R).then(function(C){b.videotrack=C,b.hasVideo=!0,l()}).catch(function(C){A(new r.RtsError(C.code,C.reason,"",C.relatedLink))})})},E.prototype.initMicCamera=function(p){var b=this;return new Promise(function(l,A){var R={video:p.video,audio:p.audio};b.deviceManager.getAudioVideoTracks(R).then(function(C){b.videotrack=C.find(function(g){return g.kind==="video"}),b.hasVideo=!!b.videotrack,b.audiotrack=b.micAudioTrack=C.find(function(g){return g.kind==="audio"}),l()}).catch(function(C){A(new r.RtsError(C.code,C.reason,"",C.relatedLink))})})},E.prototype.initScreenVideoAudio=function(p){var b=this;return new Promise(function(l,A){if(!p||!p.screen)return l();var R=!0,C=!1,g={};if(typeof p.screen!="boolean"){var D=p.screen,O=D.video,U=D.audio;g=s(D,["video","audio"]),R=typeof O!="object"||O,typeof U!="boolean"&&typeof U!="object"||(C=U)}t.SystemUtil.isMacOS&&t.BrowserUtil.isSafari&&["16.1","16.2","16.3"].indexOf(t.BrowserUtil.browserVersion)>-1&&typeof R=="object"&&(typeof R.width=="number"&&(R.width={max:R.width}),typeof R.height=="number"&&(R.height={max:R.height})),b.deviceManager.getScreenStream(f({video:R,audio:C},g)).then(function(k){b.videotrack=k.getVideoTracks()[0],b.videotrack&&b.videotrack.getSettings&&(b.screenSurfaceType=b.videotrack.getSettings().displaySurface),b.hasScreen=!0;var w=k.getAudioTracks()[0];w&&(b.screenAudioTrack=w),l()}).catch(function(k){A(new r.RtsError(k.code,k.reason,"",k.relatedLink))})})},E.prototype.tryMixMicAndScreenAudio=function(p){p.audio&&this.micAudioTrack&&this.hasScreenAudioConfig(p)&&this.screenAudioTrack?(this.audioMixer||(this.audioMixer=new n.default({useGainNode:!1,trackList:[]})),this.audioMixer.updateTrackList([this.screenAudioTrack,this.micAudioTrack]),this.audiotrack=this.audioMixer.getMixedAudioTrack()):p.audio&&this.micAudioTrack?this.audiotrack=this.micAudioTrack:this.hasScreenAudioConfig(p)&&this.screenAudioTrack&&(this.audiotrack=this.screenAudioTrack)},E.prototype.initTracks=function(p){this.hasAudioTrackReady(p)&&this.audiotrack&&this.mediastream.addTrack(this.audiotrack),this.hasVideoTrackReady(p)&&this.videotrack&&this.mediastream.addTrack(this.videotrack),this.addTrackListener()},E.prototype.tryToSetProfile=function(p){var b=this;return new Promise(function(l,A){return y(b,void 0,void 0,function(){var R;return v(this,function(C){switch(C.label){case 0:return C.trys.push([0,4,,5]),p.video?[4,this.setVideoProfile(this.videoProfile)]:[3,2];case 1:return C.sent(),[3,3];case 2:p.screen&&this.setScreenProfile(this.screenProfile).catch(function(g){console.log(g)}),C.label=3;case 3:return l(),[3,5];case 4:return R=C.sent(),A(new r.RtsError(i.ErrorCode.ERROR_DEIVCE_CONSTRAINEDERROR,"apply constraint failed","",{originErr:R,config:p})),[3,5];case 5:return[2]}})})})},E.prototype.stopAllTracks=function(){this.screenAudioTrack&&(this.screenAudioTrack.stop(),this.screenAudioTrack=void 0),this.micAudioTrack&&(this.micAudioTrack.stop(),this.micAudioTrack=void 0),this.audioTrack&&(this.audioTrack.stop(),this.audiotrack=void 0),this.videoTrack&&(this.videoTrack.stop(),this.videotrack=void 0)},E.prototype.resetLocalStream=function(){this.deviceManager=new e.BrowserDeviceManager,this.mediastream=new MediaStream,this.hasVideo=!1,this.hasScreen=!1,this.videoProfile="360p_1",this.screenProfile="720p_1",this.isCustomStream=!1,this.stopAllTracks(),this.audioMixer=void 0,this.screenSurfaceType=""},E.prototype.setEncodeParam=function(p,b){var l=this;this.pc=p;var A=!1,R=!1;b?b==="video"?A=!0:b==="audio"&&(R=!0):A=R=!0,p.getSenders().forEach(function(C){var g=C.track;!g||g.kind!=="video"&&g.kind!=="audio"||(g.kind==="video"&&A&&l.setVideoEncodeParams(C),g.kind==="audio"&&R&&l.setAudioEncodeParams(C))})},E.prototype.setVideoEncodeParams=function(p){var b,l,A;if(((b=p.track)===null||b===void 0?void 0:b.id)===((l=this.videoTrack)===null||l===void 0?void 0:l.id)&&(this.hasVideo?A=this.VideoProfileMap.get(this.videoProfile):this.hasScreen&&(A=this.ScreenProfileMap.get(this.screenProfile)),A&&p.setParameters&&p.getParameters)){var R=p.getParameters();R.degradationPreference="maintain-resolution",R.encodings.forEach(function(C){A?.maxBitrate&&(C.maxBitrate=1024*A.maxBitrate),A?.frameRate&&(C.maxFramerate=A.frameRate)}),p.setParameters(R)}},E.prototype.setAudioEncodeParams=function(p){var b,l;if(((b=p.track)===null||b===void 0?void 0:b.id)===((l=this.audioTrack)===null||l===void 0?void 0:l.id)){var A=this.AudioProfileMap.get(this.audioProfile);if(A&&p.setParameters&&p.getParameters){var R=p.getParameters();R.encodings.forEach(function(C){A.maxBitrate&&(C.maxBitrate=1024*A.maxBitrate)}),p.setParameters(R)}}},E.prototype.play=function(p,b){var l,A=this;if((l=this.reporter)===null||l===void 0||l.reportPlay(p?p.nodeName:String(p)),p&&(this.element=p,this.mediastream)){if(this.element.srcObject=this.mediastream,(t.SystemUtil.isIos&&t.SystemUtil.systemVersion.indexOf("15.1")===0&&(t.BrowserUtil.isSafari||t.BrowserUtil.isChrome||t.BrowserUtil.isMicroMessenger)||b?.canvasStream)&&this.hasVideo){if(this.canvasRenderer)return;this.canvasRenderer=new u.CanvasRenderer({video:this.element});var R=this;this.element.addEventListener("loadeddata",function C(){if(R.element&&(R.element.removeEventListener("loadeddata",C),R.canvasRenderer)){R.canvasRenderer.start();var g=R.canvasRenderer.mediaStream;g&&(R.mediastream=g,R.videotrack=g.getVideoTracks()[0])}}),this.element.addEventListener("resize",function(){var C;if(A){var g=A.element;g&&((C=A.canvasRenderer)===null||C===void 0||C.resize(g.videoWidth,g.videoHeight))}})}if(b&&b.autoplay===!1)return;this.element.play()}},E.prototype.setVideoProfile=function(p){var b=this;return new Promise(function(l,A){return y(b,void 0,void 0,function(){var R,C,g;return v(this,function(D){switch(D.label){case 0:if((g=this.reporter)===null||g===void 0||g.reportVideoProfile(p),!(R=this.VideoProfileMap.get(p)))return[3,5];if(this.isCustomStream||!this.hasVideo||!this.videotrack||!this.videotrack.applyConstraints)return[3,4];D.label=1;case 1:return D.trys.push([1,3,,4]),[4,this.videotrack.applyConstraints(R)];case 2:return D.sent(),[3,4];case 3:return C=D.sent(),[2,A(C)];case 4:return this.videoProfile=p,this.pc&&this.setEncodeParam(this.pc,"video"),l(this.videoProfile),[3,6];case 5:A("Profile not found"),D.label=6;case 6:return[2]}})})})},E.prototype.setScreenProfile=function(p){var b=this;return new Promise(function(l,A){return y(b,void 0,void 0,function(){var R,C,g;return v(this,function(D){switch(D.label){case 0:if((g=this.reporter)===null||g===void 0||g.reportScreenProfile(p),!(R=this.ScreenProfileMap.get(p)))return[3,5];if(!(this.hasScreen&&this.videotrack&&this.videotrack.applyConstraints))return[3,4];D.label=1;case 1:return D.trys.push([1,3,,4]),[4,this.videotrack.applyConstraints(R)];case 2:return D.sent(),[3,4];case 3:return C=D.sent(),[2,A(C)];case 4:return this.screenProfile=p,this.pc&&this.setEncodeParam(this.pc,"video"),l(this.screenProfile),[3,6];case 5:A("Profile not found"),D.label=6;case 6:return[2]}})})})},E.prototype.setAudioProfile=function(p){var b=this;return new Promise(function(l,A){return y(b,void 0,void 0,function(){var R,C,g;return v(this,function(D){switch(D.label){case 0:if((g=this.reporter)===null||g===void 0||g.reportAudioProfile(p),!(R=this.AudioProfileMap.get(p)))return[3,5];if(this.isCustomStream||!this.hasAudio||!this.audioTrack||!this.audioTrack.applyConstraints)return[3,4];D.label=1;case 1:return D.trys.push([1,3,,4]),[4,this.audioTrack.applyConstraints(R)];case 2:return D.sent(),[3,4];case 3:return C=D.sent(),[2,A(C)];case 4:return this.audioProfile=p,this.pc&&this.setEncodeParam(this.pc,"audio"),l(this.audioProfile),[3,6];case 5:A("Profile not found"),D.label=6;case 6:return[2]}})})})},E.prototype.enableAudio=function(){var p;return(p=this.reporter)===null||p===void 0||p.reportEnableAudio(),!!this.audiotrack&&(this.audiotrack.enabled=!0,!0)},E.prototype.disableAudio=function(){var p;return(p=this.reporter)===null||p===void 0||p.reportDisableAudio(),!!this.audiotrack&&(this.audiotrack.enabled=!1,!0)},E.prototype.enableVideo=function(){var p;return(p=this.reporter)===null||p===void 0||p.reportEnableVideo(),!!this.videotrack&&(this.videotrack.enabled=!0,!0)},E.prototype.disableVideo=function(){var p;return(p=this.reporter)===null||p===void 0||p.reportDisableVideo(),!!this.videotrack&&(this.videotrack.enabled=!1,!0)},E.prototype.stop=function(){var p;x.prototype.stop.call(this),this.hasVideo=!1,this.hasScreen=!1,this.isCustomStream=!1,this.canvasRenderer&&(this.canvasRenderer.stop(),this.canvasRenderer=void 0),this.audiotrack&&(this.audiotrack.stop(),this.audiotrack=void 0),this.videotrack&&(this.videotrack.stop(),this.videotrack=void 0),this.micAudioTrack&&(this.micAudioTrack.stop(),this.micAudioTrack=void 0),this.screenAudioTrack&&(this.screenAudioTrack.stop(),this.screenAudioTrack=void 0),(p=this.reporter)===null||p===void 0||p.reportStop(0)},E.prototype.mergeStream=function(p){var b=p.videoTrack,l=p.audioTrack;b&&(this.videoTrack&&(this.videoTrack.removeEventListener("ended",this.handleVideoTrackEnded),this.mediaStream.removeTrack(this.videoTrack)),this.mediaStream.addTrack(b),this.videotrack=b,this.listenVideoEnded(),this.hasVideo=p.hasVideo,this.hasScreen=p.hasScreen,this.isCustomStream=p.isCustomStream,this.hasVideo&&(this.videoProfile=p.videoProfile),this.hasScreen&&(this.screenProfile=p.screenProfile)),l&&(this.audioTrack&&(this.audioTrack.removeEventListener("ended",this.handleAudioTrackEnded),this.mediaStream.removeTrack(this.audioTrack)),this.mediaStream.addTrack(l),this.audiotrack=l,this.listenAudioEnded())},E.prototype.deleteTracks=function(p){p.audio&&this.audioTrack&&(this.mediaStream.removeTrack(this.audioTrack),this.audiotrack=void 0),p.video&&this.videoTrack&&(this.mediaStream.removeTrack(this.videoTrack),this.videotrack=void 0,this.hasScreen=!1,this.hasVideo=!1)},E.prototype.createCustomStream=function(p){var b=this;return new Promise(function(l,A){if(!p)return A(new r.RtsError(i.ErrorCode.ERROR_CUSTOMSTREAM_NONE,"MediaStream is required.",""));if(!(p instanceof MediaStream))return A(new r.RtsError(i.ErrorCode.ERROR_CUSTOMSTREAM_INVALID,"MediaStream is invalid.",""));if(p.getTracks().length===0)return A(new r.RtsError(i.ErrorCode.ERROR_CUSTOMSTREAM_TRACK_NONE,"MediaStream has no track.",""));var R=(0,h.getVideoTrack)(p),C=(0,h.getAudioTrack)(p);R&&(b.hasVideo=!0,b.videotrack=R,b.mediastream.addTrack(R)),C&&(b.audiotrack=C,b.mediastream.addTrack(C)),b.isCustomStream=!0,b.setVideoProfile(b.videoProfile),b.addTrackListener(),l()})},E.prototype.releaseMediaStream=function(){var p=this;this.mediastream.getTracks().forEach(function(b){b.stop(),p.mediastream.removeTrack(b)})},E.prototype.hasVideoTrackReady=function(p){return!(!p.video&&!p.screen||!this.videotrack)||!p.video&&!p.screen},E.prototype.hasScreenAudioConfig=function(p){return typeof p.screen=="object"&&p.screen.audio},E.prototype.hasAudioTrackReady=function(p){return!(p.audio&&(!this.hasMicAudioAndReady(p)&&!this.hasScreenAudioAndReady(p)||!this.audiotrack))},E.prototype.hasMicAudioAndReady=function(p){return p.audio&&this.micAudioTrack},E.prototype.hasScreenAudioAndReady=function(p){return this.hasScreenAudioConfig(p)&&this.screenAudioTrack},E.prototype.addTrackListener=function(){this.listenVideoEnded(),this.listenAudioEnded()},E.prototype.listenVideoEnded=function(){var p=this;this.videotrack&&this.videotrack.addEventListener("ended",this.handleVideoTrackEnded),this.micAudioTrack&&this.micAudioTrack.addEventListener("ended",function(){var b;p.emit("micAudioTrackEnded"),p.screenAudioTrack&&p.screenAudioTrack.readyState==="ended"&&((b=p.audioMixer)===null||b===void 0||b.destroy(),p.emit("audioTrackEnded"))}),this.screenAudioTrack&&this.screenAudioTrack.addEventListener("ended",function(){var b;p.emit("screenAudioTrackEnded"),p.micAudioTrack&&p.micAudioTrack.readyState==="ended"&&((b=p.audioMixer)===null||b===void 0||b.destroy(),p.emit("audioTrackEnded"))})},E.prototype.listenAudioEnded=function(){this.audiotrack&&this.audiotrack.addEventListener("ended",this.handleAudioTrackEnded)},E.prototype.handleVideoTrackEnded=function(){this.hasScreen=!1,this.hasVideo=!1,this.emit("videoTrackEnded")},E.prototype.handleAudioTrackEnded=function(){this.emit("audioTrackEnded")},E}(a.Stream);T.LocalStream=S},771:function(j,T,_){var m,d=this&&this.__extends||(m=function(a,e){return m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(r[o]=i[o])},m(a,e)},function(a,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=a}m(a,e),a.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(T,"__esModule",{value:!0}),T.RemoteStream=void 0;var f=_(5805),y=_(233),v=_(5044),s=_(9428),c=function(a){function e(){var r=a.call(this)||this;return r.recvCanPlay=!1,r.autoplay=!0,r.onCanPlay=r.onCanPlay.bind(r),r}return d(e,a),Object.defineProperty(e.prototype,"muted",{get:function(){return!!this.element&&this.element.muted},set:function(r){this.element&&(this.element.muted=r)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"audioTrack",{get:function(){var r;return(r=this.mediastream)===null||r===void 0?void 0:r.getAudioTracks()[0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"videoTrack",{get:function(){var r;return(r=this.mediastream)===null||r===void 0?void 0:r.getVideoTracks()[0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasVideo",{get:function(){return!!this.videoTrack},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasAudio",{get:function(){return!!this.audioTrack},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mediaStream",{get:function(){return this.mediastream},enumerable:!1,configurable:!0}),e.prototype.updateMediaStream=function(r){var i=this.mediastream||new MediaStream;r.getTracks().forEach(function(o){return i.addTrack(o)}),this.mediastream=i,this.element&&this.play(this.element)},e.prototype.getMediaStream=function(){return this.mediastream},e.prototype.mergeStream=function(r){if(this.mediaStream){var i=r.getVideoTracks()[0],o=r.getAudioTracks()[0];i&&(this.videoTrack&&this.mediaStream.removeTrack(this.videoTrack),this.mediaStream.addTrack(i),this.videotrack=i),o&&(this.audioTrack&&this.mediaStream.removeTrack(this.audioTrack),this.mediaStream.addTrack(o),this.audiotrack=o)}},e.prototype.play=function(r,i){if(this.autoplay=!!(!i||i.autoplay),r){if(!(r instanceof HTMLMediaElement))throw new v.RtsError(s.ErrorCode.ERROR_HTMLELEMENT_ERROR,"Param is not a HTMLMediaElement","",{element:r});this.recvCanPlay=!1,this.emit("mediaElementBinded"),this.element=r,this.element.addEventListener("canplay",this.onCanPlay);var o=this.mediaStream;this.element.addEventListener("playing",function t(){r.removeEventListener("playing",t),y.SystemUtil.isIos&&parseInt(y.SystemUtil.systemVersion)<=13&&!r.muted&&o?.getAudioTracks().length&&(r.pause(),r.play())}),this.element.nodeName==="VIDEO"&&(this.element.setAttribute("playsinline",""),y.BrowserUtil.isMicroMessenger&&(this.element.setAttribute("x5-video-player-type","h5-page"),this.element.setAttribute("x5-playsinline",""),y.SystemUtil.isAndroid||y.SystemUtil.isIos&&this.element.setAttribute("x-webkit-airplay","allow"))),this.autoplay&&y.BrowserUtil.isSafari&&this.element.setAttribute("autoplay",""),this.mediastream&&this.bindMediaStream(this.mediastream)}else this.release()},e.prototype.disableVideo=function(){var r=this.getMediaStream();r&&r.getVideoTracks().forEach(function(i){i.enabled&&(i.enabled=!1)})},e.prototype.enableVideo=function(){var r=this.getMediaStream();r&&r.getVideoTracks().forEach(function(i){i.enabled||(i.enabled=!0)})},e.prototype.disableAudio=function(){var r=this.getMediaStream();r&&r.getAudioTracks().forEach(function(i){i.enabled&&(i.enabled=!1)})},e.prototype.enableAudio=function(){var r=this.getMediaStream();r&&r.getAudioTracks().forEach(function(i){i.enabled||(i.enabled=!0)})},e.prototype.stop=function(){a.prototype.stop.call(this),this.release()},e.prototype.onCanPlay=function(){var r=this;if(!this.recvCanPlay&&(this.emit("onCanPlay"),this.recvCanPlay=!0,this.autoplay))if(this.element)if(y.BrowserUtil.isMicroMessenger){var i=window.top!==window.self,o=window.WeixinJSBridge||window.top.WeixinJSBridge;o?o.invoke("getNetworkType",{},function(){r.tryToPlay()}):(i?window.top.document:document).addEventListener("WeixinJSBridgeReady",function(){o.invoke("getNetworkType",{},function(){r.tryToPlay()})})}else this.tryToPlay();else this.tryToPlay()},e.prototype.release=function(){this.element&&(this.element.pause(),this.element.srcObject=null,this.element.load(),this.element.removeEventListener("canplay",this.onCanPlay)),this.recvCanPlay=!1,this.mediastream=void 0},e.prototype.bindMediaStream=function(r){this.element&&(this.element.nodeName==="AUDIO"&&r.getVideoTracks()[0]&&r.removeTrack(r.getVideoTracks()[0]),this.element.srcObject=r),this.mediastream=r},e.prototype.tryToPlay=function(){var r=this;if(this.element){var i=this.element.play();i!==void 0&&i.then(function(){}).catch(function(o){console.log("playPromise err",o),r.element&&r.element.srcObject&&r.emit("onAutoPlayError")})}},e}(f.Stream);T.RemoteStream=c},5805:function(j,T,_){var m,d=this&&this.__extends||(m=function(s,c){return m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,e){a.__proto__=e}||function(a,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(a[r]=e[r])},m(s,c)},function(s,c){if(typeof c!="function"&&c!==null)throw new TypeError("Class extends value "+String(c)+" is not a constructor or null");function a(){this.constructor=s}m(s,c),s.prototype=c===null?Object.create(c):(a.prototype=c.prototype,new a)}),f=this&&this.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(T,"__esModule",{value:!0}),T.Stream=void 0;var y=_(233),v=function(s){function c(){var a=s.call(this)||this;return a.traceid="",a.id=y.Guid.create(32),a}return d(c,s),Object.defineProperty(c.prototype,"traceId",{get:function(){return this.traceid},set:function(a){this.traceid=a},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"mediaElement",{get:function(){return this.element},enumerable:!1,configurable:!0}),c.prototype.setReporter=function(a){this.reporter=a},c.prototype.play=function(a){},c.prototype.stop=function(){this.traceid="",this.reporter=void 0},c}(f(_(102)).default);T.Stream=v},5676:function(j,T,_){var m,d=this&&this.__extends||(m=function(l,A){return m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(R,C){R.__proto__=C}||function(R,C){for(var g in C)Object.prototype.hasOwnProperty.call(C,g)&&(R[g]=C[g])},m(l,A)},function(l,A){if(typeof A!="function"&&A!==null)throw new TypeError("Class extends value "+String(A)+" is not a constructor or null");function R(){this.constructor=l}m(l,A),l.prototype=A===null?Object.create(A):(R.prototype=A.prototype,new R)}),f=this&&this.__assign||function(){return f=Object.assign||function(l){for(var A,R=1,C=arguments.length;R<C;R++)for(var g in A=arguments[R])Object.prototype.hasOwnProperty.call(A,g)&&(l[g]=A[g]);return l},f.apply(this,arguments)},y=this&&this.__awaiter||function(l,A,R,C){return new(R||(R=Promise))(function(g,D){function O(w){try{k(C.next(w))}catch(N){D(N)}}function U(w){try{k(C.throw(w))}catch(N){D(N)}}function k(w){var N;w.done?g(w.value):(N=w.value,N instanceof R?N:new R(function(H){H(N)})).then(O,U)}k((C=C.apply(l,A||[])).next())})},v=this&&this.__generator||function(l,A){var R,C,g,D,O={label:0,sent:function(){if(1&g[0])throw g[1];return g[1]},trys:[],ops:[]};return D={next:U(0),throw:U(1),return:U(2)},typeof Symbol=="function"&&(D[Symbol.iterator]=function(){return this}),D;function U(k){return function(w){return function(N){if(R)throw new TypeError("Generator is already executing.");for(;D&&(D=0,N[0]&&(O=0)),O;)try{if(R=1,C&&(g=2&N[0]?C.return:N[0]?C.throw||((g=C.return)&&g.call(C),0):C.next)&&!(g=g.call(C,N[1])).done)return g;switch(C=0,g&&(N=[2&N[0],g.value]),N[0]){case 0:case 1:g=N;break;case 4:return O.label++,{value:N[1],done:!1};case 5:O.label++,C=N[1],N=[0];continue;case 7:N=O.ops.pop(),O.trys.pop();continue;default:if(g=O.trys,!((g=g.length>0&&g[g.length-1])||N[0]!==6&&N[0]!==2)){O=0;continue}if(N[0]===3&&(!g||N[1]>g[0]&&N[1]<g[3])){O.label=N[1];break}if(N[0]===6&&O.label<g[1]){O.label=g[1],g=N;break}if(g&&O.label<g[2]){O.label=g[2],O.ops.push(N);break}g[2]&&O.ops.pop(),O.trys.pop();continue}N=A.call(l,O)}catch(H){N=[6,H],C=0}finally{R=g=0}if(5&N[0])throw N[1];return{value:N[0]?N[1]:void 0,done:!0}}([k,w])}}},s=this&&this.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(T,"__esModule",{value:!0}),T.Subscriber=void 0;var c,a=_(4865),e=_(5917),r=_(9428),i=s(_(8219)),o=s(_(102)),t=_(5044),n=_(7989),u=_(492),h=s(_(2818)),S=s(_(7028)),x=_(6091),E=_(771),p=_(2718);(function(l){l[l.Init=0]="Init",l[l.Requesting=1]="Requesting",l[l.Playing=2]="Playing",l[l.Waiting=3]="Waiting"})(c||(c={}));var b=function(l){function A(R,C){var g=l.call(this)||this;return g.monitorStatsHistory=[],g.playTimeIndex=0,g.playCatonIndex=0,g.reportPubFlag=!1,g.state=c.Init,g.subscribeAudio=!0,g.subscribeVideo=!0,g.signalingUrl="",g.pullStreamUrl="",g.noParsePullStreamUrl="",g.subReconnectTimes=0,g.isConnecting=!1,g.reconnectTimerHandle=null,g.reporter=R,g.playTimer=0,g.config=C||{playTimeOut:5e3},g.remoteStream=new E.RemoteStream,g.remoteStream.on("onAutoPlayError",function(){g.emit("onError",new t.RtsError(r.ErrorCode.ERROR_AUTOPLAY_ERROR,"auto play failed",""))}),g.remoteStream.on("onCanPlay",function(){return y(g,void 0,void 0,function(){var D,O,U,k,w,N,H,F,P,B,W;return v(this,function(z){switch(z.label){case 0:return D=new Date().getTime(),[4,this.peerconnection.sample()];case 1:return z.sent(),O=-1,U=[],k=-1,this.monitorStatsHistory&&this.monitorStatsHistory.length&&(w=this.monitorStatsHistory[this.monitorStatsHistory.length-1],this.monitorStatsHistory.forEach(function(G){var J=G.rtt;J&&J>0&&U.push(J)}),O=Number((U.reduce(function(G,J){return G+J},0)/U.length).toFixed(3)),k=w.packetsLost,this.monitorStatsHistory=null),this.stopPlayTimer(),this.peerconnection.playStart(),this.subReconnectTimes=0,N=this._cnend||D,this.reporter.reportFirstFrameTime(this.noParsePullStreamUrl,this.remoteStream.traceId,this._cpend-this._cpstart,this._hrend-this._cpend,D-this._cpstart,0,N-this._hrend,{rttAvg:O,packetsLost:k},-1,-1,-1,(F=this.subscribeConfig)===null||F===void 0?void 0:F.vMsid,(P=this.subscribeConfig)===null||P===void 0?void 0:P.aMsid),(H=new x.PlayEvent(x.PlayType.PLAY_CANPLAY)).data={url:this.noParsePullStreamUrl,vMsid:(B=this.subscribeConfig)===null||B===void 0?void 0:B.vMsid,aMsid:(W=this.subscribeConfig)===null||W===void 0?void 0:W.aMsid},this.emit("onPlayEvent",H),[2]}})})}),g.peerconnection=new a.RtsPeerconnection,g.peerconnection.on("onConnected",function(){g._cnend=new Date().getTime()}),g.peerconnection.on("streamEnded",function(D){var O=new x.PlayEvent(x.PlayType.PLAY_ENDED);O.data=f({},D),g.emit("onPlayEvent",O),g.emit("onError",new t.RtsError(r.ErrorCode.ERROR_STREAM_ENDED,"Stream Receiver Transport is Closed",g.remoteStream.traceId))}),g.peerconnection.on("onTrackEvent",function(D){D.streams&&D.streams.length&&(g.remoteStream.updateMediaStream(D.streams[0]),g.onTrackFunction&&g.onTrackFunction())}),g.peerconnection.on("connectStatusChange",function(D){D.status!==e.EConnectStatus.CONNECT_STATUS_DISCONNECTED&&D.status!==e.EConnectStatus.CONNECT_STATUS_RECONNECTING||!g.hasRetries()?g.emit("connectStatusChange",D):g.emit("onError",new t.RtsError(r.ErrorCode.ERROR_PC_DISCONNECTED,"PC disconnected",g.remoteStream.traceId))}),g.peerconnection.on("pcReconnect",function(D){var O,U;D.ips?(O="Migrate with ips: ".concat(JSON.stringify(D.ips)),U=r.ErrorCode.ERROR_IP_MIGRATE):(O="PC disconnected",U=r.ErrorCode.ERROR_PC_DISCONNECTED),g.emit("onError",new t.RtsError(U,O,"",{pcErrorInfo:D}))}),g.mediaObserver=new u.MediaObserver({handler:function(D,O,U){var k,w=new x.PlayEvent(x.PlayType.PLAY_TIMEOUT),N={url:D};O&&(N.vMsid=O),U&&(N.aMsid=U),w.data=N,g.emit("onPlayEvent",w);var H=new t.RtsError(r.ErrorCode.ERROR_INBOUND_TIMEOUT,"Media data timeout after ".concat((k=g.mediaObserver)===null||k===void 0?void 0:k.actTimeout," ms."),g.remoteStream.traceId);g.emit("onError",H)}}),g.peerconnection.on("onMonitorEvent",function(D){var O,U=D.eventList;if((O=g.peerconnection)===null||O===void 0||O.updateStatsForSEI(U,D.type),D.type!=="pub"){if(U.length){for(var k=void 0,w=0;w<U.length;w++)if(U[w].url===(0,p.pruneSubUrl)(g.noParsePullStreamUrl,!0)){k=U[w];break}if(k){g.lastMeidaEventData=k;var N=k.video,H=k.audio;N&&g.monitorStatsHistory?g.monitorStatsHistory.push({rtt:N.transportStats.rtt,packetsLost:N.inboundRtpStats.packetsLost}):H&&g.monitorStatsHistory&&g.monitorStatsHistory.push({rtt:H.transportStats.rtt,packetsLost:H.inboundRtpStats.packetsLost}),c.Requesting===g.state?k.video?k.video.inboundRtpStatsPerSec.framesDecodedPerSecond>1&&(g.state=c.Playing):k.audio&&k.audio.inboundRtpStatsPerSec.bytesReceivedPerSecond>0&&(g.state=c.Playing):g.state!==c.Playing&&g.state!==c.Waiting||(++g.playTimeIndex,k.video&&(k.video.inboundRtpStatsPerSec.framesDecodedPerSecond<=1?(++g.playCatonIndex,c.Waiting!==g.state&&(g.state=c.Waiting,g.emit("onPlayEvent",new x.PlayEvent(x.PlayType.PLAY_WAITING)))):c.Waiting===g.state&&(g.state=c.Playing,g.emit("onPlayEvent",new x.PlayEvent(x.PlayType.PLAY_PLAYING)))),h.default.HEARTHEAT_INTERVAL===g.playTimeIndex&&(g.reportPubFlag=!0,U.forEach(function(P){g.doReportPullStats(P)}),g.playTimeIndex=0,g.playCatonIndex=0))}var F=new x.PlayEvent(x.PlayType.PLAY_MEDIA);F.data=[],U.forEach(function(P){var B={};B.url=P.url;var W=g.calcStreamPullStats(P);if(P.audio&&(B.audio={bytesReceivedPerSecond:P.audio.inboundRtpStatsPerSec.bytesReceivedPerSecond,rtt:P.audio.transportStats.rtt,lossRate:W.aloss,jitterBufferDelayAvg:P.audio.inboundRtpStatsPerSec.jitterBufferDelayAvg},B.aMsid=P.aMsid),P.video){var z=P.video,G=z.inboundRtpStats,J=z.inboundRtpStatsPerSec,re=z.transportStats;B.video={bytesReceivedPerSecond:J.bytesReceivedPerSecond,fps:G.framesPerSecond||J.framesDecodedPerSecond,framesDecodedPerSecond:J.framesDecodedPerSecond,rtt:re.rtt,width:G.frameWidth,height:G.frameHeight,lossRate:W.vloss,jitterBufferDelayAvg:J.jitterBufferDelayAvg},B.vMsid=P.vMsid}B.networkQuality=W.net_qual||0,F.data.push(B)}),F.data&&F.data.length&&(F.data.forEach(function(P){var B;(B=g.mediaObserver)===null||B===void 0||B.check({audio:P.audio,video:P.video},P.url,P.vMsid,P.aMsid)}),F.data.length===1&&(F.data[0].audio||F.data[0].video)&&(F.data=f({},F.data[0])),g.emit("onPlayEvent",F))}}else g.reportPubFlag&&(g.reportPubFlag=!1)}),g.playTimer=0,g._cpstart=0,g._cpend=0,g._hrend=0,g._cnend=0,g.subscribeConfig={},g}return d(A,l),A.prototype.getPeerConnection=function(){return this.peerconnection},A.prototype.subscribe=function(R,C,g){var D=this;return new Promise(function(O,U){return y(D,void 0,void 0,function(){var k,w,N=this;return v(this,function(H){switch(H.label){case 0:return this.monitorStatsHistory=[],this.unsubscribe(),C?.cumuDelay&&(C.encodedInsertableStreams=!0),this.subscribeConfig=C||{},this.state=c.Requesting,this.noParsePullStreamUrl=R,this.parseUrl(R),(w=this.mediaObserver)===null||w===void 0||w.updateConfig({timeout:C?.mediaTimeout}),k=C?.signalUrl,this.signalingUrl=k||this.signalingUrl,this.checkPullUrl()?[3,1]:(U(new t.RtsError(r.ErrorCode.ERROR_PLAY_URL,"url need artc://","")),[3,8]);case 1:return this.subscribeAudio||this.subscribeVideo?[3,2]:(U(new t.RtsError(r.ErrorCode.ERROR_SUBSCRIBE_NOTHING,"subscribe nothing","")),[3,8]);case 2:if(this._cpstart=new Date().getTime(),!this.subscribeVideo||C?.isH264Checked)return[3,7];H.label=3;case 3:return H.trys.push([3,5,,6]),[4,new n.SupportUtil().loadH264(3)];case 4:return H.sent(),[3,6];case 5:return H.sent(),[3,6];case 6:H.label=7;case 7:this.peerconnection.createOffer(this.subscribeAudio,this.subscribeVideo,void 0,{offerSdpHook:C?.offerSdpHook,answerSdpHook:C?.answerSdpHook,encodedInsertableStreams:C?.encodedInsertableStreams,disableStereo:C?.disableStereo,disableHeartbeat:C?.disableHeartbeat,cumuDelay:C?.cumuDelay}).then(function(F){var P=F.desp;N._cpend=new Date().getTime(),N.reporter.reportSubscribeStart(N.noParsePullStreamUrl,N.signalingUrl,C?.vMsid,C?.aMsid),N.excuteSignal(P,{innerTcpOnly:!!g?.innerTcpOnly}).then(function(B){var W;N.remoteStream.traceId=B,O(N.remoteStream);try{(W=N.peerconnection.getPeerCore())===null||W===void 0||W.patchSubscribeStreamManagerRecord(N.noParsePullStreamUrl,f(f({},N.subscribeConfig),{stream:N.remoteStream}))}catch(z){console.log(z)}N.peerconnection.getSubMonitor().updateTranceiversController()}).catch(function(B){N._hrend=new Date().getTime();var W=new t.RtsError(B.errorCode?B.errorCode:r.ErrorCode.ERROR_HTTPREQUEST_ERROR,B.message,B?B.traceid:"",{response:B.response,sdp:B.sdp});U(W)})}).catch(function(F){N._cpend=new Date().getTime();var P=new t.RtsError(r.ErrorCode.ERROR_CREATEOFFER,F.message,"");U(P)}),H.label=8;case 8:return[2]}})})})},A.prototype.unsubscribe=function(){var R;this.lastMeidaEventData&&this.doReportPullStats(this.lastMeidaEventData),this.stopPlayTimer(),this.peerconnection.reset(),this.remoteStream.stop(),this.subscribeVideo=!0,this.subscribeAudio=!0,this.state=c.Init,this.signalingUrl="",this.pullStreamUrl="",this.noParsePullStreamUrl="",this.onTrackFunction=void 0,this.playTimer=0,this._cpstart=0,this._cpend=0,this._hrend=0,this._cnend=0,this.monitorStatsHistory=[],(R=this.mediaObserver)===null||R===void 0||R.reset()},A.prototype.startLiveStream=function(R,C,g){var D=this;return console.error("\u6B64API\u53EF\u80FD\u5B58\u5728\u7A33\u5B9A\u6027\u95EE\u9898\uFF0C\u5E76\u5C06\u5728\u672A\u6765\u7684\u7248\u672C\u79FB\u9664\u3002\u8BF7\u4F7F\u7528subscribe\u66FF\u4EE3\uFF0C\u8BE6\u7EC6\u7528\u6CD5\u8BF7\u53C2\u8003\u5B98\u65B9\u6587\u6863\u3002"),new Promise(function(O,U){D.unsubscribe(),D.state=c.Requesting,D.noParsePullStreamUrl=R,D.parseUrl(R);var k=g?.signalUrl;D.signalingUrl=k||D.signalingUrl,D.pullStreamUrl===""?U(new t.RtsError(r.ErrorCode.ERROR_PLAY_URL,"url need artc://","")):D.subscribeAudio||D.subscribeVideo?!C||C.nodeName!=="AUDIO"&&C.nodeName!=="VIDEO"?U(new t.RtsError(r.ErrorCode.ERROR_HTMLELEMENT_ERROR,"need htmlaudioelement or htmlvideoelement","")):(D.subscribeAudio&&D.subscribeVideo?C.nodeName!=="VIDEO"&&D.emit("onError",new t.RtsError(r.ErrorCode.ERROR_HEMLELEMENT_NOTMATCH,"need htmlvideoelement","")):D.subscribeAudio?C.nodeName!=="AUDIO"&&D.emit("onError",new t.RtsError(r.ErrorCode.ERROR_HEMLELEMENT_NOTMATCH,"need htmlaudioelement","")):C.nodeName!=="VIDEO"&&D.emit("onError",new t.RtsError(r.ErrorCode.ERROR_HEMLELEMENT_NOTMATCH,"need htmlvieoelement","")),D._cpstart=new Date().getTime(),D.reporter.updateTid(),D.peerconnection.createOffer(D.subscribeAudio,D.subscribeVideo).then(function(w){var N=w.desp;D._cpend=new Date().getTime(),D.excuteSignal(N).then(function(H){D.remoteStream.traceId=H,D._hrend=new Date().getTime(),D.remoteStream.play(C),O(H)}).catch(function(H){D._hrend=new Date().getTime(),D.reporter.reportFirstFrameTime(D.noParsePullStreamUrl,H?H.traceid:"",D._cpend-D._cpstart,D._hrend-D._cpend,-1,-1,D._cnend-D._hrend),U(new t.RtsError(H.errorCode?H.errorCode:r.ErrorCode.ERROR_HTTPREQUEST_ERROR,H.message,""))})}).catch(function(w){D._cpend=new Date().getTime(),D.reporter.reportFirstFrameTime(D.noParsePullStreamUrl,w?w.traceid:"",D._cpend-D._cpstart,-1,-1,-1,D._cnend-D._hrend),U(new t.RtsError(r.ErrorCode.ERROR_CREATEOFFER,w.message,""))})):U(new t.RtsError(r.ErrorCode.ERROR_SUBSCRIBE_NOTHING,"subscribe nothing",""))})},A.prototype.stopLiveStream=function(){this.unsubscribe()},A.prototype.muteLiveStream=function(R){return this.remoteStream.muted=R,!0},A.prototype.excuteSignal=function(R,C){var g=this,D={type:R.type,sdp:R.sdp};return new Promise(function(O,U){var k,w,N,H,F,P={url:g.pullStreamUrl,amsid:((k=g.subscribeConfig)===null||k===void 0?void 0:k.aMsid)||["rts audio"],vmsid:((w=g.subscribeConfig)===null||w===void 0?void 0:w.vMsid)||["rts video"]};g.subscribeAudio||delete P.amsid,g.subscribeVideo||delete P.vmsid,!((N=g.subscribeConfig)===null||N===void 0)&&N.cumuDelay&&(D.sdp=D.sdp.replace(/(m=video[^\n]*\n)/,`$1a=cumudelay
153
- `)),i.default.post(g.signalingUrl,{version:((H=g.subscribeConfig)===null||H===void 0?void 0:H.signalVersion)||S.default.protocol_version,sdk_version:S.default.sdk_version,mode:((F=g.subscribeConfig)===null||F===void 0?void 0:F.signalMode)||"live",pull_streams:[P],jsep:D}).then(function(B){var W,z,G,J,re,te,ie,ce,se;if(B&&B.status===200){g._hrend=new Date().getTime();try{!((W=g.subscribeConfig)===null||W===void 0)&&W.cumuDelay&&!(!((G=(z=B.data)===null||z===void 0?void 0:z.jsep)===null||G===void 0)&&G.sdp.includes("a=cumudelay"))&&(console.warn("Not found cumudelay in server sdp"),(J=g.reporter)===null||J===void 0||J.reportCumuDelayAnswerNotFound())}catch{}var ue=(re=B.data)===null||re===void 0?void 0:re.trace_id;g.reporter.reportSubscribeOk({vurl:g.noParsePullStreamUrl,surl:g.signalingUrl,traceId:ue,hrct:g._hrend-g._cpend,rslt:(te=B.data)===null||te===void 0?void 0:te.code});var pe=typeof((ie=g.subscribeConfig)===null||ie===void 0?void 0:ie.tcpOnly)=="boolean"?g.subscribeConfig.tcpOnly:C?.innerTcpOnly;g.peerconnection.recvAnswer(B.data,{answerSdpHook:(ce=g.subscribeConfig)===null||ce===void 0?void 0:ce.answerSdpHook,tcpOnly:pe}).then(function(){O(ue)}).catch(function(de){de.traceid=B.data?B.data.trace_id:"",U({errorCode:r.ErrorCode.ERROR_ANSWER_ERROR,message:de.message?de.message:"set answer error",traceid:de.traceid,sdp:de.sdp})})}else U({message:B?"response status:"+B.status:"response is null",traceid:(se=B?.data)===null||se===void 0?void 0:se.trace_id,sdp:R.sdp})}).catch(function(B){return y(g,void 0,void 0,function(){var W,z;return v(this,function(G){switch(G.label){case 0:if(![400,500].includes((z=B.response)===null||z===void 0?void 0:z.status))return[3,4];B.sdp=R.sdp,G.label=1;case 1:return G.trys.push([1,3,,4]),[4,new n.SupportUtil().isSupport({isReceiveVideo:!0})];case 2:return G.sent(),[3,4];case 3:return W=G.sent(),B.errorCode=W?.errorCode,B.message=W?.message,this.subReconnectTimes=1/0,[3,4];case 4:return U(B),[2]}})})})})},A.prototype.checkPullUrl=function(){return!!this.noParsePullStreamUrl&&this.noParsePullStreamUrl.indexOf("artc://")===0},A.prototype.parseUrl=function(R){if(R===void 0&&(R=""),R?.indexOf("artc://")===0){var C=R.indexOf("@");if(C>-1){var g=R.substring(C+1,R.length);this.pullStreamUrl=R.substring(0,C);for(var D=g.split("&"),O=0;O<D.length;++O)D[O]==="subaudio=no"&&(this.subscribeAudio=!1),D[O]==="subvideo=no"&&(this.subscribeVideo=!1)}else this.pullStreamUrl=R;var U=window.location.protocol,k=(["http:","https:"].indexOf(U)>-1?U:"https:")+"//";this.signalingUrl=this.pullStreamUrl.replace("artc://",k)}},A.prototype.stopPlayTimer=function(){this.playTimer&&clearTimeout(this.playTimer),this.playTimer=0},A.prototype.calcStreamPullStats=function(R){var C={},g=R.video,D=R.audio;if(g){var O=g.transportStats,U=g.inboundRtpStats,k=g.inboundRtpStatsPerSec,w=g.localCandidate,N=g.remoteCandidate;C=f(f({},C),{rtt:O?.rtt!==-1?1e3*(O?.rtt||0):-1,cand_re_prot:N.protocol,cand_lo_prot:w.protocol,cand_re_addr:"".concat(N.ip||N.address,":").concat(N.port),cand_lo_addr:"".concat(w.ip||w.address,":").concat(w.port),w:U?.frameWidth,h:U?.frameHeight,vbps:Math.floor(8*k.bytesReceivedPerSecond),fps:U?.framesPerSecond,dfps:Math.floor(k?.framesDecodedPerSecond),vjb:Math.floor((0,p.getJitterBufferDelayAvg)(U?.jitterBufferDelay,U?.jitterBufferEmittedCount)),vMsid:R.vMsid,vloss:k.packetsLostRate})}return D&&(O=D.transportStats,U=D.inboundRtpStats,k=D.inboundRtpStatsPerSec,w=D.localCandidate,N=D.remoteCandidate,C=f(f({},C),{rtt:O?.rtt!==-1?1e3*(O?.rtt||0):-1,cand_re_prot:N.protocol,cand_lo_prot:w.protocol,cand_re_addr:"".concat(N.ip||N.address,":").concat(N.port),cand_lo_addr:"".concat(w.ip||w.address,":").concat(w.port),abps:Math.floor(8*k.bytesReceivedPerSecond),ajb:Math.floor((0,p.getJitterBufferDelayAvg)(U?.jitterBufferDelay,U.jitterBufferEmittedCount)),aMsid:R.aMsid,aloss:k.packetsLostRate})),C=f(f({},C),{net_qual:(0,p.evaluateNetworkCondition)(C.rtt,C.aloss,C.vloss,C.ajb,C.vjb)})},A.prototype.doReportPullStats=function(R){var C=this.calcStreamPullStats(R),g={ct:1e3*this.playCatonIndex,tt:1e3*this.playTimeIndex,url:R.url};g.tt&&(g=f(f({},g),C),this.reporter.reportPullStats(g),this.lastMeidaEventData=void 0)},A.prototype.retrySubscribe=function(R,C){return y(this,void 0,void 0,function(){var g,D,O,U,k,w,N;return v(this,function(H){switch(H.label){case 0:if(R.extraInfo=f(f({},R.extraInfo),{retryTimes:this.subReconnectTimes}),!this.hasRetries())return[2,!1];if(typeof((g=this.subscribeConfig)==null?void 0:g.beforeRetry)!="function")return[3,4];H.label=1;case 1:return H.trys.push([1,3,,4]),[4,g.beforeRetry({url:this.noParsePullStreamUrl,vMsid:g.vMsid,aMsid:g.aMsid,useTcp:C?.innerTcpOnly})];case 2:return(D=H.sent())?(O=D.url,U=D.vMsid,k=D.aMsid,w=D.useTcp,this.reporter.reportReconnectParams("sub",O,U,k,w),this.noParsePullStreamUrl=O,this.subscribeConfig.vMsid=U,this.subscribeConfig.aMsid=k,typeof w=="boolean"&&(C=f(f({},C),{innerTcpOnly:w})),console.log(`retry with:
154
- [URL] `.concat(O,`
155
- [VMSID]`).concat(U," [AMSID]").concat(k,`
156
- [PROTOCOL] `).concat(w?"TCP":"UDP"))):(this.reporter.reportReconnectParams("sub"),this.subReconnectTimes=1/0),[3,4];case 3:return N=H.sent(),console.error("Error in beforeRetry",N),[3,4];case 4:return this.hasRetries()?(this.emit("connectStatusChange",{status:e.EConnectStatus.CONNECT_STATUS_RECONNECTING}),this.incrementReconnectTimes(),R.extraInfo.retryTimes=this.subReconnectTimes,R.extraInfo.tcpOnly=C?.innerTcpOnly,this.subscribeWithReconnect(this.noParsePullStreamUrl,f({innerTcpOnly:C?.innerTcpOnly},this.subscribeConfig)).catch(function(F){}),[2,!0]):(R.extraInfo.retryTimes=this.subReconnectTimes,[2,!1])}})})},A.prototype.subscribeWithReconnect=function(R,C,g,D){var O=this;return new Promise(function(U,k){U=g||U,k=D||k,O.isConnecting=!0;var w=(C||{}).innerTcpOnly;C==null||delete C.innerTcpOnly,O.subscribe(R,C,{innerTcpOnly:w}).then(function(N){O.isConnecting=!1,U(N)}).catch(function(N){var H;if(O.peerconnection.reset(),!O.isConnecting)return k(N);if(!r.RECONNECT_ERROR_EXCLUDE_LIST.includes(N.errorCode)&&O.hasRetries(!0)){var F=((H=O.subscribeConfig)===null||H===void 0?void 0:H.retryInterval)||e.DEFAULT_RETRY_SUBSCRIBE_INTERVAL;O.reconnectTimerHandle=setTimeout(function(){N.extraInfo=f(f({},N.extraInfo),{retryTimes:O.subReconnectTimes}),O.emit("reconnect",N),O.subscribeWithReconnect(R,C,U,k)},F)}else k(N),N.extraInfo=f(f({},N.extraInfo),{retryTimes:O.subReconnectTimes}),O.isConnecting=!1,O.emit("onError",N)})})},A.prototype.hasRetries=function(R){var C,g,D=e.DEFAULT_RETRY_SUBSCRIBE_LIMIT;typeof((C=this.subscribeConfig)===null||C===void 0?void 0:C.retryTimes)=="number"&&(D=Math.floor((g=this.subscribeConfig)===null||g===void 0?void 0:g.retryTimes));var O=this.subReconnectTimes<D;return R&&O&&this.incrementReconnectTimes(),O},A.prototype.resetResubscribeStatus=function(){this.subReconnectTimes=0,this.isConnecting=!1,this.reporter.updateTid(),this.reconnectTimerHandle!==null&&(clearTimeout(this.reconnectTimerHandle),this.reconnectTimerHandle=null)},A.prototype.handlePubMonitorEvent=function(R){var C=this;R.forEach(function(g){C.reporter.reportPushStats(g)})},A.prototype.incrementReconnectTimes=function(){this.subReconnectTimes++},A.prototype.getSubscribeConfig=function(){return this.subscribeConfig},A}(o.default);T.Subscriber=b},6901:function(j,T,_){var m,d=this&&this.__extends||(m=function(v,s){return m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,a){c.__proto__=a}||function(c,a){for(var e in a)Object.prototype.hasOwnProperty.call(a,e)&&(c[e]=a[e])},m(v,s)},function(v,s){if(typeof s!="function"&&s!==null)throw new TypeError("Class extends value "+String(s)+" is not a constructor or null");function c(){this.constructor=v}m(v,s),v.prototype=s===null?Object.create(s):(c.prototype=s.prototype,new c)});Object.defineProperty(T,"__esModule",{value:!0}),T.AudioReceiverMonitorData=void 0;var f=_(1353),y=function(v){function s(){return v.call(this,f.ReceiverMonitorType.AUDIO)||this}return d(s,v),s}(f.ReceiverMonitorData);T.AudioReceiverMonitorData=y},1353:function(j,T,_){var m,d=this&&this.__extends||(m=function(r,i){return m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,t){o.__proto__=t}||function(o,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(o[n]=t[n])},m(r,i)},function(r,i){if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function o(){this.constructor=r}m(r,i),r.prototype=i===null?Object.create(i):(o.prototype=i.prototype,new o)}),f=this&&this.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(T,"__esModule",{value:!0}),T.ReceiverMonitorData=T.ReceiverMonitorType=void 0;var y,v=_(233),s=f(_(102)),c=_(2688),a=_(2718);(function(r){r.AUDIO="audio",r.VIDEO="video"})(y||(T.ReceiverMonitorType=y={}));var e=function(r){function i(o){var t=r.call(this)||this;return t.streamEnded=!1,t.currentTimeGap=0,t.lastTimeStamp=0,t.transportStats={},t.remoteCandidate={},t.localCandidate={},t.inboundRtpStreamStats={},t.inboundRtpStreamStatsDiff={},t.receiver=null,t.pc=null,t.canplay=!1,t.type=o,t}return d(i,r),Object.defineProperty(i.prototype,"rtpReceiver",{set:function(o){this.receiver=o},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"RTCPeerconnection",{set:function(o){this.pc=o},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isExist",{get:function(){return this.receiver!=null},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isPlaying",{get:function(){return this.canplay},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isStreamEnded",{get:function(){return this.streamEnded},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"monitorData",{get:function(){var o=this.inboundRtpStreamStatsDiff||{},t=(this.inboundRtpStreamStats,this.currentTimeGap),n=0;return o.nackCount!==void 0&&o.packetsReceived!==void 0&&(n=Math.round(o.nackCount/(o.packetsReceived+o.nackCount)*1e3)/1e3),{inboundRtpStats:this.inboundRtpStreamStats,inboundRtpStatsPerSec:{bytesReceivedPerSecond:o.bytesReceived/t||0,framesDecodedPerSecond:o.framesDecoded/t||0,packetsLostRate:n>0?n:0,decodeTimeAvg:o.totalDecodeTime&&o.framesDecoded?1e3*(o.totalDecodeTime/o.framesDecoded||0):0,jitterBufferDelayAvg:o.jitterBufferDelay&&o.jitterBufferEmittedCount?(0,a.getJitterBufferDelayAvg)(o.jitterBufferDelay,o.jitterBufferEmittedCount):0,totalProcessingDelayAvg:o.totalProcessingDelay&&o.framesDecoded?o.totalProcessingDelay/o.framesDecoded*1e3:0,totalAssemblyTimeAvg:o.totalAssemblyTime&&o.framesAssembledFromMultiplePackets?o.totalAssemblyTime/o.framesAssembledFromMultiplePackets*1e3:0},transportStats:this.transportStats,remoteCandidate:this.remoteCandidate,localCandidate:this.localCandidate}},enumerable:!1,configurable:!0}),i.prototype.getInfo=function(){var o=this;if(this.receiver&&this.receiver.transport&&this.receiver.transport.state==="closed"&&this.canplay&&(this.streamEnded=!0,this.emit("streamEnded"),this.canplay=!1),this.receiver&&"getStats"in this.receiver||this.pc&&"getStats"in this.pc)return new Promise(function(t,n){var u=null,h=!1;o.receiver&&"getStats"in o.receiver?u=o.receiver.getStats():o.pc&&"getStats"in o.pc&&(u=o.pc.getStats(),h=!0),u?.then(function(S){S.forEach(function(x){var E,p;if(x)switch(x.type){case c.RTCStatsType.CandidatePair:o.onCandidatePair(x);break;case c.RTCStatsType.InboundRtp:v.SystemUtil.isIos&&h?!((E=x.id)===null||E===void 0)&&E.toLowerCase().includes(o.type)&&o.onInBoundRtp(x):v.BrowserUtil.isFirefox?x.kind===o.type&&o.onInBoundRtp(x):o.onInBoundRtp(x);break;case c.RTCStatsType.RemoteCandidate:o.onRemoteCandidate(x);break;case c.RTCStatsType.LocalCandidate:o.onLocalCandidate(x);break;case c.RTCStatsType.Track:if(o.type!==y.VIDEO)break;v.SystemUtil.isIos&&h?(!((p=x.id)===null||p===void 0)&&p.toLowerCase().includes(o.type)||x.trackIdentifier.toLowerCase()===o.type)&&o.onTrack(x):o.onTrack(x)}}),t("")}).catch(function(S){n(S)})})},i.prototype.dispose=function(){this.reset()},i.prototype.onCandidatePair=function(o){(o.state==="succeeded"||o.bytesReceived)&&(this.transportStats={timestamp:Math.floor(o.timestamp),rtt:o.currentRoundTripTime||-1,bytesReceived:o.bytesReceived,bytesSent:o.bytesSent})},i.prototype.onInBoundRtp=function(o){this.currentTimeGap=(o.timestamp-this.lastTimeStamp)/1e3,this.lastTimeStamp=o.timestamp,this.inboundRtpStreamStatsDiff=this.calcDiff(o,this.inboundRtpStreamStats,["bytesReceived","framesDecoded","packetsReceived","nackCount","totalDecodeTime","jitterBufferDelay","jitterBufferEmittedCount","totalProcessingDelay","totalAssemblyTime","framesAssembledFromMultiplePackets"]),this.inboundRtpStreamStats=o,!this.canplay&&Number(o.bytesReceived)>0&&(this.canplay=!0,this.emit("canPlay"))},i.prototype.calcDiff=function(o,t,n){var u={};return n.forEach(function(h){u[h]=Number(o[h]||0)-Number(t[h]||0)}),u},i.prototype.onRemoteCandidate=function(o){this.remoteCandidate=o||{}},i.prototype.onLocalCandidate=function(o){this.localCandidate=o||{}},i.prototype.onTrack=function(o){o.frameWidth&&(this.inboundRtpStreamStats.frameWidth=o.frameWidth,this.inboundRtpStreamStats.frameHeight=o.frameHeight)},i.prototype.reset=function(){this.currentTimeGap=0,this.lastTimeStamp=0,this.transportStats={},this.remoteCandidate={},this.localCandidate={},this.inboundRtpStreamStats={},this.inboundRtpStreamStatsDiff={},this.receiver=null,this.canplay=!1,this.streamEnded=!1},i}(s.default);T.ReceiverMonitorData=e},5250:function(j,T,_){var m,d=this&&this.__extends||(m=function(v,s){return m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,a){c.__proto__=a}||function(c,a){for(var e in a)Object.prototype.hasOwnProperty.call(a,e)&&(c[e]=a[e])},m(v,s)},function(v,s){if(typeof s!="function"&&s!==null)throw new TypeError("Class extends value "+String(s)+" is not a constructor or null");function c(){this.constructor=v}m(v,s),v.prototype=s===null?Object.create(s):(c.prototype=s.prototype,new c)});Object.defineProperty(T,"__esModule",{value:!0}),T.VideoReceiverMonitorData=void 0;var f=_(1353),y=function(v){function s(){return v.call(this,f.ReceiverMonitorType.VIDEO)||this}return d(s,v),s}(f.ReceiverMonitorData);T.VideoReceiverMonitorData=y},2688:(j,T)=>{Object.defineProperty(T,"__esModule",{value:!0}),T.RTCStatsType=void 0;var _=function(){function m(){}return m.CandidatePair="candidate-pair",m.Certificate="certificate",m.Codec="codec",m.Csrc="csrc",m.DataCahnnel="data-channel",m.InboundRtp="inbound-rtp",m.LocalCandidate="local-candidate",m.OutboundRtp="outbound-rtp",m.PeerConnection="peer-connection",m.Receiver="receiver",m.RemoteCandidate="remote-candidate",m.RemoteInboundRtp="remote-inbound-rtp",m.RemoteOutboundRtp="remote-outbound-rtp",m.Sender="sender",m.Stream="stream",m.Track="track",m.Transport="transport",m.MediaSource="media-source",m}();T.RTCStatsType=_},5657:(j,T,_)=>{Object.defineProperty(T,"__esModule",{value:!0}),T.SenderMonitorData=void 0;var m=_(2688),d=function(){function f(){this._audiosender=null,this._videosender=null,this.timeStamp=0,this.curTimeStamp=0,this.audioBytesSent=0,this.curAudioBytesSent=0,this.videoBytesSent=0,this.curVideoBytesSent=0,this.audioRetransmittedBytesSent=0,this.curAudioRetransmittedBytesSent=0,this.videoRetransmiitedBytesSent=0,this.curVideoRetransmiitedBytesSent=0,this.framesSent=0,this.curFramesSent=0,this.framesEncoded=0,this.curFramesEncoded=0,this.totalEncodeTime=0,this.curTotalEncodeTime=0,this.totalPacketSendDelay=0,this.curTotalPacketSendDelay=0,this.packetsSent=0,this.curPacketsSent=0,this.rtt=0,this.localProtocol="",this.remoteProtocol="",this.localTransportAddr="",this.remoteTransportAddr="",this.frameHeight=0,this.frameWidth=0,this.efps=0,this.sfps=0,this.timeGap=0,this.abps=0,this.vbps=0,this.rt_abps=0,this.rt_vbps=0,this.encodeTimeAvg=0,this.packetSendDelayAvg=0,this.stashedData={}}return Object.defineProperty(f.prototype,"videoSender",{set:function(y){this._videosender=y},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"audioSender",{set:function(y){this._audiosender=y},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"monitorData",{get:function(){return this.doCalc(),{tt:parseFloat(this.timeGap.toFixed(0)),rtt:this.rtt,cand_re_prot:this.remoteProtocol,cand_lo_prot:this.localProtocol,cand_re_addr:this.remoteTransportAddr,cand_lo_addr:this.localTransportAddr,w:this.frameWidth,h:this.frameHeight,efps:parseFloat(this.efps.toFixed(0)),fps:parseFloat(this.sfps.toFixed(0)),abps:parseFloat(this.abps.toFixed(0)),vbps:parseFloat(this.vbps.toFixed(0)),rt_abps:parseFloat(this.rt_abps.toFixed(0)),rt_vbps:parseFloat(this.rt_vbps.toFixed(0)),v_encode_time_avg:parseFloat(this.encodeTimeAvg.toFixed(2)),v_packet_send_delay_avg:parseFloat(this.packetSendDelayAvg.toFixed(2))}},enumerable:!1,configurable:!0}),f.prototype.doCalc=function(){this.timeStamp!==0&&(this.timeGap=this.curTimeStamp-this.timeStamp,this.timeGap>0&&(this.efps=1e3*(this.curFramesEncoded-this.framesEncoded)/this.timeGap,this.sfps=1e3*(this.curFramesSent-this.framesSent)/this.timeGap,this.abps=1e3*(this.curAudioBytesSent-this.audioBytesSent)/this.timeGap,this.vbps=1e3*(this.curVideoBytesSent-this.videoBytesSent)/this.timeGap,this.rt_abps=1e3*(this.curAudioRetransmittedBytesSent-this.audioRetransmittedBytesSent)/this.timeGap,this.rt_vbps=1e3*(this.curVideoRetransmiitedBytesSent-this.videoRetransmiitedBytesSent)/this.timeGap,this.encodeTimeAvg=(this.curTotalEncodeTime-this.totalEncodeTime)/(this.curFramesEncoded-this.framesEncoded)*1e3,this.packetSendDelayAvg=(this.curTotalPacketSendDelay-this.totalPacketSendDelay)/(this.curPacketsSent-this.packetsSent)*1e3)),this.timeStamp=this.curTimeStamp,this.audioBytesSent=this.curAudioBytesSent,this.videoBytesSent=this.curVideoBytesSent,this.audioRetransmittedBytesSent=this.curAudioRetransmittedBytesSent,this.videoRetransmiitedBytesSent=this.curVideoRetransmiitedBytesSent,this.framesSent=this.curFramesSent,this.framesEncoded=this.curFramesEncoded,this.totalEncodeTime=this.curTotalEncodeTime,this.packetsSent=this.curPacketsSent,this.totalPacketSendDelay=this.curTotalPacketSendDelay},f.prototype.getInfo=function(){var y=this,v=new Promise(function(c,a){y._videosender&&y._videosender.getStats?y._videosender.getStats().then(function(e){e.forEach(function(r){if(r)switch(r.type){case m.RTCStatsType.CandidatePair:y.onCandidatePair(r);break;case m.RTCStatsType.OutboundRtp:y.onOutBoundRtp(r,"video");break;case m.RTCStatsType.RemoteCandidate:y.onRemoteCandidate(r);break;case m.RTCStatsType.LocalCandidate:y.onLocalCandidate(r)}}),c()}).catch(function(e){a(e)}):a("no video sender")}),s=new Promise(function(c,a){y._audiosender&&y._audiosender.getStats?y._audiosender.getStats().then(function(e){e.forEach(function(r){if(r)switch(r.type){case m.RTCStatsType.CandidatePair:y.onCandidatePair(r);break;case m.RTCStatsType.OutboundRtp:y.onOutBoundRtp(r,"audio");break;case m.RTCStatsType.RemoteCandidate:y.onRemoteCandidate(r);break;case m.RTCStatsType.LocalCandidate:y.onLocalCandidate(r)}}),c()}).catch(function(e){a(e)}):a("no audio sender")});return Promise.all([v,s])},f.prototype.onCandidatePair=function(y){this.curTimeStamp=y.timestamp,this.rtt=y.currentRoundTripTime},f.prototype.onOutBoundRtp=function(y,v){this.curTimeStamp=y.timestamp,v==="video"?(this.curVideoBytesSent=y.bytesSent,this.curVideoRetransmiitedBytesSent=y.retransmittedBytesSent,this.curFramesEncoded=y.framesEncoded,this.curFramesSent=y.framesSent,this.frameWidth=y.frameWidth,this.frameHeight=y.frameHeight,this.curTotalEncodeTime=y.totalEncodeTime,this.curTotalPacketSendDelay=y.totalPacketSendDelay,this.curPacketsSent=y.packetsSent):v==="audio"&&(this.curAudioBytesSent=y.bytesSent,this.curAudioRetransmittedBytesSent=y.retransmittedBytesSent)},f.prototype.onRemoteCandidate=function(y){this.curTimeStamp=y.timestamp,this.remoteProtocol=y.protocol,this.remoteTransportAddr=(y.ip||y.address)+(y.port?":"+y.port.toFixed(0):"")},f.prototype.onLocalCandidate=function(y){this.curTimeStamp=y.timestamp,this.localProtocol=y.protocol,this.localTransportAddr=(y.ip||y.address)+(y.port?":"+y.port.toFixed(0):"")},f}();T.SenderMonitorData=d},9752:function(j,T,_){var m,d=this&&this.__extends||(m=function(e,r){return m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,o){i.__proto__=o}||function(i,o){for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&(i[t]=o[t])},m(e,r)},function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}m(e,r),e.prototype=r===null?Object.create(r):(i.prototype=r.prototype,new i)}),f=this&&this.__assign||function(){return f=Object.assign||function(e){for(var r,i=1,o=arguments.length;i<o;i++)for(var t in r=arguments[i])Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e},f.apply(this,arguments)},y=this&&this.__spreadArray||function(e,r,i){if(i||arguments.length===2)for(var o,t=0,n=r.length;t<n;t++)!o&&t in r||(o||(o=Array.prototype.slice.call(r,0,t)),o[t]=r[t]);return e.concat(o||Array.prototype.slice.call(r))},v=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(T,"__esModule",{value:!0}),T.PubMonitor=void 0;var s=v(_(102)),c=_(5657),a=function(e){function r(){var i=e.call(this)||this;return i.heartbeatHandle=null,i.pc=null,i.pcCore=null,i.senderMonitorDataList=[],i}return d(r,e),r.prototype.startHeartbeat=function(i,o,t){var n=this;this.pc=i,this.pcCore=o,this.updateSenders(),this.stopHeartbeat(),this.heartbeatHandle=setInterval(function(){n.emitHeartBeat()},t||1e3)},r.prototype.stopHeartbeat=function(){this.heartbeatHandle!==null&&clearInterval(this.heartbeatHandle),this.heartbeatHandle=null},r.prototype.addTrackPair=function(i,o,t,n,u){var h=this;if(i){var S=new c.SenderMonitorData;if(o){S.videoSender=o;var x=o.transport;x&&(x.onstatechange=function(){var p,b,l,A;h.emit("onTransportStateEvent",{url:i,type:"pub",kind:"video",state:x.state,protocol:(A=(l=(b=(p=x.iceTransport)===null||p===void 0?void 0:p.getSelectedCandidatePair)===null||b===void 0?void 0:b.call(p))===null||l===void 0?void 0:l.local)===null||A===void 0?void 0:A.protocol})})}if(t){S.audioSender=t;var E=t.transport;E&&(E.onstatechange=function(){var p,b,l,A;h.emit("onTransportStateEvent",{url:i,type:"pub",kind:"audio",state:E.state,protocol:(A=(l=(b=(p=E.iceTransport)===null||p===void 0?void 0:p.getSelectedCandidatePair)===null||b===void 0?void 0:b.call(p))===null||l===void 0?void 0:l.local)===null||A===void 0?void 0:A.protocol})})}this.senderMonitorDataList.push({url:i,vMsid:n,aMsid:u,senderData:S})}},r.prototype.updateSenders=function(){var i,o=this,t=(i=this.pcCore)===null||i===void 0?void 0:i.getStreamManager().getAllTrackPairList("pub");this.senderMonitorDataList=[],t?.forEach(function(n){o.addTrackPair(n.url,n.vTransceiver,n.aTransceiver,n.vMsid,n.aMsid)})},r.prototype.emitHeartBeat=function(){var i=this;Promise.all(this.senderMonitorDataList.reduce(function(o,t){return y(y([],o,!0),[t.senderData.getInfo()],!1)},[])).then(function(){}).catch(function(o){}).finally(function(){var o=i.senderMonitorDataList.map(function(t){return f(f({},t.senderData.monitorData),{url:t.url,vMsid:t.vMsid,aMsid:t.aMsid})});i.emit("onMonitorEvent",{eventList:o,type:"pub"})})},r}(s.default);T.PubMonitor=a},4699:function(j,T,_){var m,d=this&&this.__extends||(m=function(o,t){return m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,u){n.__proto__=u}||function(n,u){for(var h in u)Object.prototype.hasOwnProperty.call(u,h)&&(n[h]=u[h])},m(o,t)},function(o,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=o}m(o,t),o.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}),f=this&&this.__awaiter||function(o,t,n,u){return new(n||(n=Promise))(function(h,S){function x(b){try{p(u.next(b))}catch(l){S(l)}}function E(b){try{p(u.throw(b))}catch(l){S(l)}}function p(b){var l;b.done?h(b.value):(l=b.value,l instanceof n?l:new n(function(A){A(l)})).then(x,E)}p((u=u.apply(o,t||[])).next())})},y=this&&this.__generator||function(o,t){var n,u,h,S,x={label:0,sent:function(){if(1&h[0])throw h[1];return h[1]},trys:[],ops:[]};return S={next:E(0),throw:E(1),return:E(2)},typeof Symbol=="function"&&(S[Symbol.iterator]=function(){return this}),S;function E(p){return function(b){return function(l){if(n)throw new TypeError("Generator is already executing.");for(;S&&(S=0,l[0]&&(x=0)),x;)try{if(n=1,u&&(h=2&l[0]?u.return:l[0]?u.throw||((h=u.return)&&h.call(u),0):u.next)&&!(h=h.call(u,l[1])).done)return h;switch(u=0,h&&(l=[2&l[0],h.value]),l[0]){case 0:case 1:h=l;break;case 4:return x.label++,{value:l[1],done:!1};case 5:x.label++,u=l[1],l=[0];continue;case 7:l=x.ops.pop(),x.trys.pop();continue;default:if(h=x.trys,!((h=h.length>0&&h[h.length-1])||l[0]!==6&&l[0]!==2)){x=0;continue}if(l[0]===3&&(!h||l[1]>h[0]&&l[1]<h[3])){x.label=l[1];break}if(l[0]===6&&x.label<h[1]){x.label=h[1],h=l;break}if(h&&x.label<h[2]){x.label=h[2],x.ops.push(l);break}h[2]&&x.ops.pop(),x.trys.pop();continue}l=t.call(o,x)}catch(A){l=[6,A],u=0}finally{n=h=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([p,b])}}},v=this&&this.__spreadArray||function(o,t,n){if(n||arguments.length===2)for(var u,h=0,S=t.length;h<S;h++)!u&&h in t||(u||(u=Array.prototype.slice.call(t,0,h)),u[h]=t[h]);return o.concat(u||Array.prototype.slice.call(t))},s=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(T,"__esModule",{value:!0}),T.SubMonitor=void 0;var c=_(6901),a=_(5250),e=s(_(102)),r=function(){function o(){this.trackPairDataList=[]}return o.prototype.reset=function(){this.trackPairDataList=[]},o.prototype.addTrackPair=function(t,n,u,h,S,x){var E=new c.AudioReceiverMonitorData,p=new a.VideoReceiverMonitorData;h&&(p.rtpReceiver=h),S&&(E.rtpReceiver=S),x&&(p.RTCPeerconnection=x,E.RTCPeerconnection=x),this.trackPairDataList.push({url:t,vMsid:n,aMsid:u,audioReceiverMonitorData:E,videoReceiverMonitorData:p})},o}(),i=function(o){function t(){var n=o.call(this)||this;return n.canplay=!1,n.pc=null,n.pcCore=null,n.monitorTimerId=null,n.audioReceiverMonitorData=new c.AudioReceiverMonitorData,n.videoReceiverMonitorData=new a.VideoReceiverMonitorData,n.receiverMonitorController=new r,n}return d(t,o),t.prototype.start=function(n,u){this.pc=n,this.pcCore=u,this.updateTranceiversController(),this.startMonitorTimer(200)},t.prototype.updateTranceiversController=function(){var n=this;if(this.pc&&this.pcCore){var u=this.pcCore.getStreamManager().getAllTrackPairList("sub");this.receiverMonitorController.reset(),u.forEach(function(h){h.url&&n.receiverMonitorController.addTrackPair(h.url,h.vMsid,h.aMsid,h.vTransceiver,h.aTransceiver,n.pc)}),this.receiverMonitorController.trackPairDataList.forEach(function(h){n.initEvent(h)})}},t.prototype.resetTimer=function(n){this.updateTranceiversController(),this.stopMonitorTimer(),this.startMonitorTimer(n)},t.prototype.stop=function(){this.canplay=!1,this.stopMonitorTimer(),this.audioReceiverMonitorData.dispose(),this.videoReceiverMonitorData.dispose()},t.prototype.startMonitorTimer=function(n){var u=this;this.monitorTimerId||(this.monitorTimerId=window.setInterval(function(){u.onMonitorTimer()},n))},t.prototype.stopMonitorTimer=function(){this.monitorTimerId&&clearInterval(this.monitorTimerId),this.monitorTimerId=null},t.prototype.onMonitorTimer=function(){return f(this,void 0,void 0,function(){var n;return y(this,function(u){switch(u.label){case 0:return[4,this.updateMonitorData()];case 1:return u.sent(),n=[],this.receiverMonitorController.trackPairDataList.forEach(function(h){var S,x;if(h.url){var E={url:h.url};h.audioReceiverMonitorData.isExist&&(E.audio=(S=h.audioReceiverMonitorData)===null||S===void 0?void 0:S.monitorData,E.aMsid=h.aMsid),h.videoReceiverMonitorData.isExist&&(E.video=(x=h.videoReceiverMonitorData)===null||x===void 0?void 0:x.monitorData,E.vMsid=h.vMsid),n.push(E)}}),this.emit("onMonitorEvent",{eventList:n,type:"sub"}),[2]}})})},t.prototype.initEvent=function(n){var u=this,h={url:n.url||"url unknown",vMsid:n.vMsid||"vMsid unknown",aMsid:n.aMsid||"aMsid unknown"};n.audioReceiverMonitorData.isExist&&(n.audioReceiverMonitorData.on("streamEnded",function(){n.videoReceiverMonitorData&&!n.videoReceiverMonitorData.isStreamEnded||(u.emit("streamEnded",h),u.stopMonitorTimer())}),n.audioReceiverMonitorData.on("canPlay",function(){u.emitCanPlay()})),n.videoReceiverMonitorData.isExist&&(n.videoReceiverMonitorData.on("streamEnded",function(){n.audioReceiverMonitorData&&!n.audioReceiverMonitorData.isStreamEnded||(u.emit("streamEnded",h),u.stopMonitorTimer())}),n.videoReceiverMonitorData.on("canPlay",function(){u.emitCanPlay()}))},t.prototype.updateMonitorData=function(){return Promise.all(this.receiverMonitorController.trackPairDataList.reduce(function(n,u){var h,S;return v(v([],n,!0),[(h=u.audioReceiverMonitorData)===null||h===void 0?void 0:h.getInfo(),(S=u.videoReceiverMonitorData)===null||S===void 0?void 0:S.getInfo()],!1)},[]))},t.prototype.emitCanPlay=function(){this.canplay||(this.canplay=!0,this.emit("canPlay"))},t.prototype.copyMonitorData=function(){var n,u;!((u=(n=this.receiverMonitorController)===null||n===void 0?void 0:n.trackPairDataList)===null||u===void 0)&&u.length&&(this.audioReceiverMonitorData=this.receiverMonitorController.trackPairDataList[0].audioReceiverMonitorData,this.videoReceiverMonitorData=this.receiverMonitorController.trackPairDataList[0].videoReceiverMonitorData)},t.prototype.getTransportStats=function(){return f(this,void 0,void 0,function(){var n;return y(this,function(u){switch(u.label){case 0:return[4,this.updateMonitorData()];case 1:return u.sent(),this.copyMonitorData(),n={},this.videoReceiverMonitorData.isExist?n=this.videoReceiverMonitorData.monitorData.transportStats:this.audioReceiverMonitorData.isExist&&(n=this.audioReceiverMonitorData.monitorData.transportStats),[2,n]}})})},t.prototype.getRemoteVideoStats=function(){return f(this,void 0,void 0,function(){var n,u;return y(this,function(h){switch(h.label){case 0:return[4,this.updateMonitorData()];case 1:return h.sent(),this.copyMonitorData(),n={},this.videoReceiverMonitorData.isExist&&(u=this.videoReceiverMonitorData.monitorData.inboundRtpStats,n={timestamp:Math.floor(u.timestamp||0),framesDecodedPerSecond:u.framesPerSecond,framesDecoded:u.framesDecoded,frameWidth:u.frameWidth,frameHeight:u.frameHeight,bytesReceived:u.bytesReceived,jitter:u.jitter,jitterBufferDelayAvg:Number(u.jitterBufferDelay)/Number(u.jitterBufferEmittedCount),packetsLost:u.packetsLost,packetsReceived:u.packetsReceived}),[2,n]}})})},t.prototype.getRemoteAudioStats=function(){return f(this,void 0,void 0,function(){var n,u;return y(this,function(h){switch(h.label){case 0:return[4,this.updateMonitorData()];case 1:return h.sent(),this.copyMonitorData(),n={},this.audioReceiverMonitorData.isExist&&(u=this.audioReceiverMonitorData.monitorData.inboundRtpStats,n={timestamp:Math.floor(u.timestamp||0),bytesReceived:u.bytesReceived,jitter:u.jitter,jitterBufferDelayAvg:Number(u.jitterBufferDelay)/Number(u.jitterBufferEmittedCount),packetsLost:u.packetsLost,packetsReceived:u.packetsReceived}),[2,n]}})})},t}(e.default);T.SubMonitor=i},5259:(j,T)=>{Object.defineProperty(T,"__esModule",{value:!0}),T.AudioProfileMap=T.VideoProfileMap=T.ScreenProfileMap=void 0,T.ScreenProfileMap=new Map,T.ScreenProfileMap.set("480p_1",{width:640,height:480,frameRate:5,maxBitrate:300}),T.ScreenProfileMap.set("480p_2",{width:640,height:480,frameRate:30,maxBitrate:1e3}),T.ScreenProfileMap.set("720p_1",{width:1280,height:720,frameRate:5,maxBitrate:800}),T.ScreenProfileMap.set("720p_2",{width:1280,height:720,frameRate:30,maxBitrate:2e3}),T.ScreenProfileMap.set("1080p_1",{width:1920,height:1080,frameRate:5,maxBitrate:1e3}),T.ScreenProfileMap.set("1080p_2",{width:1920,height:1080,frameRate:30,maxBitrate:3e3}),T.VideoProfileMap=new Map,T.VideoProfileMap.set("120p_1",{width:160,height:120,frameRate:15,maxBitrate:65}),T.VideoProfileMap.set("120p_3",{width:120,height:120,frameRate:15,maxBitrate:50}),T.VideoProfileMap.set("180p_1",{width:320,height:180,frameRate:15,maxBitrate:140}),T.VideoProfileMap.set("180p_3",{width:180,height:180,frameRate:15,maxBitrate:100}),T.VideoProfileMap.set("180p_4",{width:240,height:180,frameRate:15,maxBitrate:120}),T.VideoProfileMap.set("240p_1",{width:320,height:240,frameRate:15,maxBitrate:200}),T.VideoProfileMap.set("240p_3",{width:240,height:240,frameRate:15,maxBitrate:140}),T.VideoProfileMap.set("240p_4",{width:424,height:240,frameRate:15,maxBitrate:220}),T.VideoProfileMap.set("360p_1",{width:640,height:360,frameRate:15,maxBitrate:400}),T.VideoProfileMap.set("360p_3",{width:360,height:360,frameRate:15,maxBitrate:260}),T.VideoProfileMap.set("360p_4",{width:640,height:360,frameRate:30,maxBitrate:600}),T.VideoProfileMap.set("360p_6",{width:360,height:360,frameRate:30,maxBitrate:400}),T.VideoProfileMap.set("360p_7",{width:480,height:360,frameRate:15,maxBitrate:320}),T.VideoProfileMap.set("360p_8",{width:480,height:360,frameRate:30,maxBitrate:490}),T.VideoProfileMap.set("360p_9",{width:640,height:360,frameRate:15,maxBitrate:800}),T.VideoProfileMap.set("360p_10",{width:640,height:360,frameRate:24,maxBitrate:800}),T.VideoProfileMap.set("360p_11",{width:640,height:360,frameRate:24,maxBitrate:1e3}),T.VideoProfileMap.set("480p_1",{width:640,height:480,frameRate:15,maxBitrate:500}),T.VideoProfileMap.set("480p_2",{width:640,height:480,frameRate:30,maxBitrate:1e3}),T.VideoProfileMap.set("480p_3",{width:480,height:480,frameRate:15,maxBitrate:400}),T.VideoProfileMap.set("480p_4",{width:640,height:480,frameRate:30,maxBitrate:750}),T.VideoProfileMap.set("480p_6",{width:480,height:480,frameRate:30,maxBitrate:600}),T.VideoProfileMap.set("480p_8",{width:848,height:480,frameRate:15,maxBitrate:610}),T.VideoProfileMap.set("480p_9",{width:848,height:480,frameRate:30,maxBitrate:930}),T.VideoProfileMap.set("480p_10",{width:640,height:480,frameRate:10,maxBitrate:400}),T.VideoProfileMap.set("720p_1",{width:1280,height:720,frameRate:15,maxBitrate:1130}),T.VideoProfileMap.set("720p_2",{width:1280,height:720,frameRate:30,maxBitrate:2e3}),T.VideoProfileMap.set("720p_3",{width:1280,height:720,frameRate:30,maxBitrate:1710}),T.VideoProfileMap.set("720p_5",{width:960,height:720,frameRate:15,maxBitrate:910}),T.VideoProfileMap.set("720p_6",{width:960,height:720,frameRate:30,maxBitrate:1380}),T.VideoProfileMap.set("1080p_1",{width:1920,height:1080,frameRate:15,maxBitrate:2080}),T.VideoProfileMap.set("1080p_2",{width:1920,height:1080,frameRate:30,maxBitrate:3e3}),T.VideoProfileMap.set("1080p_3",{width:1920,height:1080,frameRate:30,maxBitrate:3150}),T.VideoProfileMap.set("1080p_5",{width:1920,height:1080,frameRate:60,maxBitrate:4780}),T.VideoProfileMap.set("1440p_1",{width:2560,height:1440,frameRate:30,maxBitrate:4850}),T.VideoProfileMap.set("1440p_2",{width:2560,height:1440,frameRate:60,maxBitrate:7350}),T.VideoProfileMap.set("4K_1",{width:3840,height:2160,frameRate:30,maxBitrate:8910}),T.VideoProfileMap.set("4K_3",{width:3840,height:2160,frameRate:60,maxBitrate:13500}),T.AudioProfileMap=new Map,T.AudioProfileMap.set("standard",{sampleRate:48e3,channelCount:1,maxBitrate:64}),T.AudioProfileMap.set("high",{sampleRate:48e3,channelCount:1,maxBitrate:128}),T.AudioProfileMap.set("standard-stereo",{sampleRate:48e3,channelCount:2,maxBitrate:80}),T.AudioProfileMap.set("high-stereo",{sampleRate:48e3,channelCount:2,maxBitrate:192})},5553:(j,T)=>{Object.defineProperty(T,"__esModule",{value:!0}),T.Datachannel=void 0;var _=function(){function m(d){this.pc=d,this.messageId=1,this.dataChannel=this.pc.createDataChannel("GRTNDataChannel"),this.dataChannel.onopen=function(f){},this.dataChannel.onmessage=function(f){f.data},this.dataChannel.onclose=function(f){},this.dataChannel.onerror=function(f){}}return m.prototype.addTrack=function(d,f){return new Promise(function(y,v){})},m.prototype.removeTrack=function(d,f){return new Promise(function(y,v){})},m.prototype.createPublishPacket=function(){var d={type:"pub",version:1,msg_id:this.messageId,streams:[]};return++this.messageId,d},m}();T.Datachannel=_},2470:function(j,T,_){var m,d=this&&this.__extends||(m=function(t,n){return m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,h){u.__proto__=h}||function(u,h){for(var S in h)Object.prototype.hasOwnProperty.call(h,S)&&(u[S]=h[S])},m(t,n)},function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function u(){this.constructor=t}m(t,n),t.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}),f=this&&this.__assign||function(){return f=Object.assign||function(t){for(var n,u=1,h=arguments.length;u<h;u++)for(var S in n=arguments[u])Object.prototype.hasOwnProperty.call(n,S)&&(t[S]=n[S]);return t},f.apply(this,arguments)},y=this&&this.__awaiter||function(t,n,u,h){return new(u||(u=Promise))(function(S,x){function E(l){try{b(h.next(l))}catch(A){x(A)}}function p(l){try{b(h.throw(l))}catch(A){x(A)}}function b(l){var A;l.done?S(l.value):(A=l.value,A instanceof u?A:new u(function(R){R(A)})).then(E,p)}b((h=h.apply(t,n||[])).next())})},v=this&&this.__generator||function(t,n){var u,h,S,x,E={label:0,sent:function(){if(1&S[0])throw S[1];return S[1]},trys:[],ops:[]};return x={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(x[Symbol.iterator]=function(){return this}),x;function p(b){return function(l){return function(A){if(u)throw new TypeError("Generator is already executing.");for(;x&&(x=0,A[0]&&(E=0)),E;)try{if(u=1,h&&(S=2&A[0]?h.return:A[0]?h.throw||((S=h.return)&&S.call(h),0):h.next)&&!(S=S.call(h,A[1])).done)return S;switch(h=0,S&&(A=[2&A[0],S.value]),A[0]){case 0:case 1:S=A;break;case 4:return E.label++,{value:A[1],done:!1};case 5:E.label++,h=A[1],A=[0];continue;case 7:A=E.ops.pop(),E.trys.pop();continue;default:if(S=E.trys,!((S=S.length>0&&S[S.length-1])||A[0]!==6&&A[0]!==2)){E=0;continue}if(A[0]===3&&(!S||A[1]>S[0]&&A[1]<S[3])){E.label=A[1];break}if(A[0]===6&&E.label<S[1]){E.label=S[1],S=A;break}if(S&&E.label<S[2]){E.label=S[2],E.ops.push(A);break}S[2]&&E.ops.pop(),E.trys.pop();continue}A=n.call(t,E)}catch(R){A=[6,R],h=0}finally{u=S=0}if(5&A[0])throw A[1];return{value:A[0]?A[1]:void 0,done:!0}}([b,l])}}},s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(T,"__esModule",{value:!0}),T.PcRestorer=void 0;var c=s(_(102)),a=_(5917),e=_(280),r=_(9428),i=_(5044),o=function(t){function n(u){var h=t.call(this)||this;return h.restoring=!1,h.subscriber=u.subscriber,h.publisher=u.publisher,h.commonController=u.commonController,h}return d(n,t),n.prototype.isReconnecting=function(){return this.restoring},n.prototype.restore=function(u){var h,S=this;if(!this.restoring)return new Promise(function(x,E){return y(S,void 0,void 0,function(){var p,b,l,A,R,C,g,D,O,U,k,w,N=this;return v(this,function(H){switch(H.label){case 0:if(this.restoring=!0,!(p=this.restructureStreams())||!p.length)return[3,9];switch(this.subscriber.unsubscribe(),this.publisher.unpublish(),b=Promise.reject().catch(function(){}),l=p[0],A={retryTimes:a.DEFAULT_RETRY_SUBSCRIBE_LIMIT,retryInterval:a.DEFAULT_RETRY_SUBSCRIBE_INTERVAL},R=l.url,u&&(R=this.makeIpQuery(R,u,l.type)),l.type){case"sub":this.commonController.setPeerconnection(this.subscriber.getPeerConnection()),this.subscriber.incrementReconnectTimes(),A.retryTimes=this.subscriber.getSubscribeConfig().retryTimes||a.DEFAULT_RETRY_SUBSCRIBE_LIMIT,A.retryInterval=this.subscriber.getSubscribeConfig().retryInterval||a.DEFAULT_RETRY_SUBSCRIBE_INTERVAL,b=this.subscriber.subscribeWithReconnect(R,f(f({},this.subscriber.getSubscribeConfig()),{vMsid:l.vMsid,aMsid:l.aMsid}));break;case"pub":l.targetStream&&(this.commonController.setPeerconnection(this.publisher.getPeerConnection()),this.publisher.incrementReconnectTimes(),A.retryTimes=this.publisher.getPublishConfig().retryTimes||a.DEFAULT_RETRY_PUBLISH_LIMIT,A.retryInterval=this.publisher.getPublishConfig().retryInterval||a.DEFAULT_RETRY_PUBLISH_INTERVAL,b=this.publisher.publishWithReconnect(R,l.targetStream,f(f({},this.publisher.getPublishConfig()),{vMsid:l.vMsid,aMsid:l.aMsid})));break;case"sub-data":l.msid&&l.label&&(b=this.commonController.subscribeAddDatachannel({signalUrl:R,url:R,label:l.label,msid:l.msid}));break;case"pub-data":l.msid&&l.label&&(b=this.commonController.publishAddDatachannel({signalUrl:l.url,url:l.url,label:l.label,msid:l.msid}));break;default:console.log("RTS [PC RESTORER] unknown http reconnect type",l.type)}H.label=1;case 1:return H.trys.push([1,3,,4]),[4,b];case 2:return C=H.sent(),h=typeof C=="string"?C:C?.traceId,[3,4];case 3:return g=H.sent(),E(g),this.restoring=!1,[2];case 4:D=new Promise(function(F,P){clearTimeout(N.dcOpenTimer),N.dcOpenTimer=setTimeout(function(){var B=new i.RtsError(r.ErrorCode.ERROR_DATACHANNEL_OPEN,"reconnect pc datachannel open timeout after ".concat(a.DEFAULT_RETRY_DATACHANNEL_TIMEOUT,"ms"),"",{});P(B)},a.DEFAULT_RETRY_DATACHANNEL_TIMEOUT),N.commonController.on("datachannelStatusChange",function(B){B.status===e.EDatachannelStatus.DATACHANNEL_STATUS_OPEN&&(clearTimeout(N.dcOpenTimer),F())})}),H.label=5;case 5:return H.trys.push([5,7,,8]),[4,D];case 6:return H.sent(),[3,8];case 7:return O=H.sent(),E(O),this.restoring=!1,[2];case 8:for(U=[],k=1;k<p.length;k++)if(w=p[k])switch(w.type){case"sub":U.push(this.commonController.subscribeAdd([{url:w.url,vMsid:w.vMsid,aMsid:w.aMsid,targetStream:w.targetStream,subAudio:!(!w.aMsid||!w.aMsid.length),subVideo:!(!w.vMsid||!w.vMsid.length)}],!0).catch(function(F){N.emit("onError",N.makeSingleStreamReconnectError(F))}));break;case"pub":U.push(this.commonController.publishAdd([{url:w.url,stream:w.targetStream,vMsid:w.vMsid,aMsid:w.aMsid}]).catch(function(F){N.emit("onError",N.makeSingleStreamReconnectError(F))}));break;case"sub-data":w.label&&w.msid&&U.push(this.commonController.subscribeAddDatachannel({signalUrl:w.url,url:w.url,label:w.label,msid:w.msid}).catch(function(F){N.emit("onError",N.makeSingleStreamReconnectError(F))}));break;case"pub-data":w.label&&w.msid&&U.push(this.commonController.publishAddDatachannel({signalUrl:w.url,url:w.url,label:w.label,msid:w.msid}).catch(function(F){N.emit("onError",N.makeSingleStreamReconnectError(F))}));break;default:console.log("RTS [PC RESTORER] unknown pc reconnect type")}Promise.allSettled(U).then(function(F){var P,B,W=F.find(function(z){return z.status==="fulfilled"});h=((B=(P=W?.value)===null||P===void 0?void 0:P[0])===null||B===void 0?void 0:B.traceId)||h,x({traceId:h,latestUrl:R})}),H.label=9;case 9:return this.restoring=!1,[2]}})})})},n.prototype.restructureStreams=function(){var u,h=(u=this.commonController.peerCore)===null||u===void 0?void 0:u.getStreamManager(),S=h?.getAllStreamListWithMsids(),x=h?.getAllDatachannelList(),E=[];return S?.forEach(function(p){var b;(b=p.streams)===null||b===void 0||b.forEach(function(l){var A=[],R=[],C=p.type,g=p.latestUrl,D=l;p.msids.forEach(function(O){O.streamId===l.id&&(O.type==="video"?R.push(O.name):O.type==="audio"&&A.push(O.name))}),E.push({aMsid:A,vMsid:R,type:C,url:g,targetStream:D})})}),x?.forEach(function(p){p.msids.forEach(function(b){if(b.name&&b.label){var l=b.name,A=b.label,R=p.type,C=p.latestUrl;E.push({msid:l,type:R,label:A,url:C})}})}),E},n.prototype.makeSingleStreamReconnectError=function(u){return new i.RtsError(r.ErrorCode.ERROR_SINGLE_PC_STREAM_RECONNECT_FAILED,"single stream reconnect failed","",{originError:u})},n.prototype.makeIpQuery=function(u,h,S){var x,E,p,b="ali_prefer_media_server",l="ip_migration",A=u,R="";if(S.indexOf("sub")===0&&(!((E=h.pull)===null||E===void 0)&&E.length)?R=h.pull[0]:S.indexOf("pub")===0&&(!((p=h.push)===null||p===void 0)&&p.length)&&(R=h.push[0]),R){var C=u.split("?"),g=C[0],D=C[1],O=void 0;D?((O=new URLSearchParams(D)).has(b)?O.set(b,R):O.append(b,R),!O.has(l)&&O.append(l,"on")):O=new URLSearchParams(((x={})[b]=R,x[l]="on",x)),A="".concat(g,"?").concat(O.toString())}return A},n}(c.default);T.PcRestorer=o},4865:function(j,T,_){var m,d=this&&this.__extends||(m=function(C,g){return m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(D,O){D.__proto__=O}||function(D,O){for(var U in O)Object.prototype.hasOwnProperty.call(O,U)&&(D[U]=O[U])},m(C,g)},function(C,g){if(typeof g!="function"&&g!==null)throw new TypeError("Class extends value "+String(g)+" is not a constructor or null");function D(){this.constructor=C}m(C,g),C.prototype=g===null?Object.create(g):(D.prototype=g.prototype,new D)}),f=this&&this.__assign||function(){return f=Object.assign||function(C){for(var g,D=1,O=arguments.length;D<O;D++)for(var U in g=arguments[D])Object.prototype.hasOwnProperty.call(g,U)&&(C[U]=g[U]);return C},f.apply(this,arguments)},y=this&&this.__awaiter||function(C,g,D,O){return new(D||(D=Promise))(function(U,k){function w(F){try{H(O.next(F))}catch(P){k(P)}}function N(F){try{H(O.throw(F))}catch(P){k(P)}}function H(F){var P;F.done?U(F.value):(P=F.value,P instanceof D?P:new D(function(B){B(P)})).then(w,N)}H((O=O.apply(C,g||[])).next())})},v=this&&this.__generator||function(C,g){var D,O,U,k,w={label:0,sent:function(){if(1&U[0])throw U[1];return U[1]},trys:[],ops:[]};return k={next:N(0),throw:N(1),return:N(2)},typeof Symbol=="function"&&(k[Symbol.iterator]=function(){return this}),k;function N(H){return function(F){return function(P){if(D)throw new TypeError("Generator is already executing.");for(;k&&(k=0,P[0]&&(w=0)),w;)try{if(D=1,O&&(U=2&P[0]?O.return:P[0]?O.throw||((U=O.return)&&U.call(O),0):O.next)&&!(U=U.call(O,P[1])).done)return U;switch(O=0,U&&(P=[2&P[0],U.value]),P[0]){case 0:case 1:U=P;break;case 4:return w.label++,{value:P[1],done:!1};case 5:w.label++,O=P[1],P=[0];continue;case 7:P=w.ops.pop(),w.trys.pop();continue;default:if(U=w.trys,!((U=U.length>0&&U[U.length-1])||P[0]!==6&&P[0]!==2)){w=0;continue}if(P[0]===3&&(!U||P[1]>U[0]&&P[1]<U[3])){w.label=P[1];break}if(P[0]===6&&w.label<U[1]){w.label=U[1],U=P;break}if(U&&w.label<U[2]){w.label=U[2],w.ops.push(P);break}U[2]&&w.ops.pop(),w.trys.pop();continue}P=g.call(C,w)}catch(B){P=[6,B],O=0}finally{D=U=0}if(5&P[0])throw P[1];return{value:P[0]?P[1]:void 0,done:!0}}([H,F])}}},s=this&&this.__importDefault||function(C){return C&&C.__esModule?C:{default:C}};Object.defineProperty(T,"__esModule",{value:!0}),T.RtsPeerconnection=void 0;var c,a=_(280),e=_(233),r=_(4315),i=_(2718),o=s(_(102)),t=_(1698),n=_(5917),u=_(4699),h=_(9752),S=_(5553),x=_(9428),E=_(5044),p=s(_(6834));(function(C){C.Subscribe="sub",C.Publish="pub"})(c||(c={}));var b=window.RTCRtpReceiver&&"createEncodedStreams"in RTCRtpReceiver.prototype,l=window.RTCRtpReceiver&&"transform"in RTCRtpReceiver.prototype&&"RTCRtpScriptTransform"in window,A=function(C){function g(){var D=C.call(this)||this;return D.connectingEventSent=!1,D.reused=!1,D.transformWorkerList=new R,D.receiverCodecPreferences={},D.senderCodecPreferences={},D.heartbeatTimeoutHandler=null,D.noHeartbeatCount=0,D.subMonitor=new u.SubMonitor,D.subMonitor.on("onMonitorEvent",function(O){D.emit("onMonitorEvent",O)}),D.subMonitor.on("streamEnded",function(){D.emit("streamEnded")}),D.subMonitor.on("canPlay",function(){}),D.pubMonitor=new h.PubMonitor,D.pubMonitor.on("onMonitorEvent",function(O){D.emit("onMonitorEvent",O)}),D.pubMonitor.on("onTransportStateEvent",function(O){D.emit("onTransportStateEvent",O)}),D}return d(g,C),Object.defineProperty(g.prototype,"isConnected",{get:function(){var D;return((D=this.pc)===null||D===void 0?void 0:D.connectionState)==="connected"},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"isReused",{get:function(){return this.reused},set:function(D){this.reused=!!D},enumerable:!1,configurable:!0}),g.prototype.getWorkerManager=function(){return this.transformWorkerList},g.prototype.getPc=function(){return this.pc},g.prototype.getPeerCore=function(){return this.peerCore},g.prototype.getSubMonitor=function(){return this.subMonitor},g.prototype.getPubMonitor=function(){return this.pubMonitor},g.prototype.playStart=function(){this.subMonitor.resetTimer(1e3)},g.prototype.pushStart=function(){this.pc&&this.peerCore&&this.pubMonitor.startHeartbeat(this.pc,this.peerCore)},g.prototype.sample=function(){return y(this,void 0,void 0,function(){return v(this,function(D){switch(D.label){case 0:return[4,this.subMonitor.onMonitorTimer()];case 1:return D.sent(),[2]}})})},g.prototype.subAdd=function(D,O){var U;return(U=this.peerCore)===null||U===void 0?void 0:U.subscribeAdd(D,O)},g.prototype.subActive=function(D){var O;return(O=this.peerCore)===null||O===void 0?void 0:O.subscribeActive(D)},g.prototype.subStop=function(D){var O;return(O=this.peerCore)===null||O===void 0?void 0:O.subscribeStop(D)},g.prototype.subDeleteTracks=function(D){var O;return(O=this.peerCore)===null||O===void 0?void 0:O.subscribeDeleteTracks(D)},g.prototype.pubAdd=function(D){var O;return(O=this.peerCore)===null||O===void 0?void 0:O.publishAdd(D)},g.prototype.pubDeleteTracks=function(D){var O;return(O=this.peerCore)===null||O===void 0?void 0:O.publishDeleteTracks(D)},g.prototype.pubReplaceTracks=function(D){var O;return(O=this.peerCore)===null||O===void 0?void 0:O.publishReplaceTracks(D)},g.prototype.pubStop=function(D){var O;return(O=this.peerCore)===null||O===void 0?void 0:O.publishStop(D)},g.prototype.createOffer=function(D,O,U,k){var w=this;return k===void 0&&(k={publishUrl:""}),new Promise(function(N,H){var F;(F=w.cancelable)===null||F===void 0||F.cancel();var P={googCpuOveruseDetection:!1,sdpSemantics:"unified-plan",encodedInsertableStreams:k.encodedInsertableStreams,bundlePolicy:"max-bundle",rtcpMuxPolicy:"require"};if(e.BrowserUtil.isChrome&&Number(e.BrowserUtil.browserMainVersion)<=55&&(P.iceServers=[]),w.pc=new RTCPeerConnection(P),w.encodedInsertableStreams=k.encodedInsertableStreams,w.peerCore=new a.PeerConnectionCore({pc:w.pc,onDatachannelEvent:function(G){var J,re;w.emit("datachannelStatusChange",{status:G}),k.disableHeartbeat||(G===a.EDatachannelStatus.DATACHANNEL_STATUS_OPEN?((0,i.hebtLog)("DATACHANNEL OPEN"," heartbeat send scheduler started"),(J=w.peerCore)===null||J===void 0||J.startSignalHeartbeatTimer()):G===a.EDatachannelStatus.DATACHANNEL_STATUS_CLOSE&&((0,i.hebtLog)("DATACHANNEL CLOSE"," heartbeats from now on will fail"),(re=w.peerCore)===null||re===void 0||re.stopSignalHeartbeatTimer()))},onInnerSubscribeDelete:function(G){w.emit("innerSubscribeDeleteTracks",G)},offerSdpHook:k.offerSdpHook,answerSdpHook:k.answerSdpHook,delayOpen:t.configProvider.getContext().datachannelDelayOpen}),w.registerPeerCoreListeners(k),w.peerCore.setReceiverCodecPreferences(w.receiverCodecPreferences),w.peerCore.setSenderCodecPreferences(w.senderCodecPreferences),w.pc.onconnectionstatechange=function(){var G=(w.pc||{}).connectionState;switch(w.connectingEventSent||(w.connectingEventSent=!0,w.emit("connectStatusChange",{status:n.EConnectStatus.CONNECT_STATUS_CONNECTING})),G!=="connecting"&&w.clearStatusTimer(),G){case"connected":w.emit("onConnected"),w.emit("connectStatusChange",{status:n.EConnectStatus.CONNECT_STATUS_CONNECTED});break;case"disconnected":w.emit("connectStatusChange",{status:n.EConnectStatus.CONNECT_STATUS_RECONNECTING});break;case"failed":case"closed":w.handleClosed()}},w.clearStatusTimer(),w.statusTimer=window.setTimeout(function(){w.handleClosed()},g.CONNECT_TIMEOUT),U){w.localStream=U,w.sdpUtil=new r.SdpUtil(w.localStream);var B=w.addStream();if(B!==0)return w.pc=void 0,void H(new E.RtsError(B,B===x.ErrorCode.ERROR_MEDIASTREAMTRACK_AUDIO_NONE?"need audio track":"",""))}else w.sdpUtil=new r.SdpUtil;var W={};U||(W=w.handleSubTransceiver(D,O).added?{}:{offerToReceiveAudio:D,offerToReceiveVideo:O});var z=w.pc.createOffer(W);w.cancelable=(0,i.makeCancelable)(z),w.cancelable.promise.then(function(G){var J,re,te,ie,ce,se,ue;if(w.cancelable=void 0,w.sdpUtil){if(w.sdpUtil.init(String(G.sdp)),w.sdpUtil.addNack(),w.sdpUtil.addSps(),k.disableStereo||w.sdpUtil.addStereo(),k.cumuDelay&&(w.sdpUtil.setSingleNaluPackMode()||w.emit("cumuDelayNotSupported")),U&&w.sdpUtil.modifyTrackName({vMsid:k.vMsid&&k.vMsid[0],aMsid:k.aMsid&&k.aMsid[0]}),w.pc){if(G.sdp=w.sdpUtil.sdp,U&&U.sdpHook&&typeof U.sdpHook=="function")try{G.sdp=U.sdpHook(G.sdp)}catch(ve){console.log("Error in sdp hook",ve)}(J=w.peerCore)===null||J===void 0||J.setPrevOfferSdp(G.sdp||"");var pe=[];if(U)try{(re=w.peerCore)===null||re===void 0||re.patchPublishStreamManagerRecord(k.publishUrl||"",f(f({},k),{stream:U,cumuDelay:k.cumuDelay}));var de=(te=w.peerCore)===null||te===void 0?void 0:te.parseSdp(G.sdp||"");pe=(ie=w.peerCore)===null||ie===void 0?void 0:ie.updateTrackInfoList({url:k.publishUrl||"",stream:U,vMsid:(ce=w.peerCore)===null||ce===void 0?void 0:ce.unifyMsid(k.vMsid,"video"),aMsid:(se=w.peerCore)===null||se===void 0?void 0:se.unifyMsid(k.aMsid,"audio"),sdpMediaList:(ue=de?.detail)===null||ue===void 0?void 0:ue.media})}catch(ve){console.log(ve)}if(k.offerSdpHook&&typeof k.offerSdpHook=="function")try{G.sdp=k.offerSdpHook(G.sdp||"")}catch(ve){console.log("Error in offerSdpHook",ve)}w.pc.setLocalDescription(G).then(function(){w.pc?N({desp:w.pc.localDescription,publishTrackInfoList:pe}):H(new E.RtsError(x.ErrorCode.ERROR_CREATEOFFER,"no pc",""))}).catch(function(ve){H(new E.RtsError(x.ErrorCode.ERROR_CREATEOFFER,"setLocalDescription error "+ve.message,""))})}}else H(new E.RtsError(x.ErrorCode.ERROR_CREATEOFFER,"no sdp",""))}).catch(function(G){G.isCanceled||H(new E.RtsError(x.ErrorCode.ERROR_CREATEOFFER,G.message?G.message:"create offer error",""))})})},g.prototype.recvAnswer=function(D,O){var U,k,w=this;return O===void 0&&(O={}),(U=this.peerCore)===null||U===void 0||U.setPrevAnswerSdp((k=D?.jsep)===null||k===void 0?void 0:k.sdp),new Promise(function(N,H){var F,P,B,W,z,G;if(w.pc){if(w.pc.ontrack=function(re){w.pc&&w.peerCore&&w.subMonitor.start(w.pc,w.peerCore),setTimeout(function(){w.handleEncodedInsertableStreams({receiver:re.receiver})}),w.isReused||w.emit("onTrackEvent",re)},w.pc.signalingState==="closed")return void H({message:"PeerConnection signalingState is closed"});if(!((F=D.jsep)===null||F===void 0)&&F.sdp){var J=new r.SdpUtil;J.init(String((P=D.jsep)===null||P===void 0?void 0:P.sdp)),w.localStream&&(w.localStream.audioTrack&&!w.localStream.videoTrack&&(J.removeTwccRtcpFb(),(B=w.peerCore)===null||B===void 0||B.setRemoveTwcc(!0)),J.setDirection()),O.tcpOnly&&J.hasTcpCandidate&&J.removeUdpCandidate(),D.jsep.sdp=J.sdp,(W=w.peerCore)===null||W===void 0||W.setPrevAnswerSdp((z=D?.jsep)===null||z===void 0?void 0:z.sdp)}if(!((G=D.jsep)===null||G===void 0)&&G.sdp&&O.answerSdpHook&&typeof O.answerSdpHook=="function")try{D.jsep.sdp=O.answerSdpHook(D.jsep.sdp)}catch(re){console.log("Error in answerSdpHook",re)}w.pc.setRemoteDescription(new RTCSessionDescription(D.jsep)).then(function(re){var te;w.pc&&w.localStream&&(w.localStream.setEncodeParam(w.pc),(te=w.pc)===null||te===void 0||te.getSenders().forEach(function(ie){w.handleEncodedInsertableStreams({sender:ie})})),N(re)}).catch(function(re){re.sdp=D.jsep.sdp,H(re)})}else H({message:"no PeerConnection"})})},g.prototype.setReceiverCodecPreferences=function(D){var O;this.receiverCodecPreferences=f({},D),(O=this.peerCore)===null||O===void 0||O.setReceiverCodecPreferences(this.receiverCodecPreferences)},g.prototype.setSenderCodecPreferences=function(D){var O;this.senderCodecPreferences=f({},D),(O=this.peerCore)===null||O===void 0||O.setSenderCodecPreferences(this.senderCodecPreferences)},g.prototype.removeTrack=function(D,O){var U=this;return new Promise(function(k,w){U.pc&&U.dataChannel&&U.dataChannel.removeTrack(D,O).then(function(){}).catch(function(N){w(N)})})},g.prototype.replaceTrack=function(D,O,U){var k=this;return new Promise(function(w,N){U||k.pc&&k.dataChannel&&k.dataChannel.removeTrack(D,O).then(function(){}).catch(function(H){N(H)})})},g.prototype.sendSEI=function(D){var O;if(!D.data)throw new Error("No data to send, please check your params.");if(!(D.data instanceof ArrayBuffer))throw new Error("data should be ArrayBuffer, please check your params.");if(!D.url)throw new Error("url is required, please check your params.");if(!D.vMsid)throw new Error("vMsid is required, please check your params.");if(b||l){var U=this.transformWorkerList.findByMsid({url:D.url,kind:n.TrackType.VIDEO,source:n.EWorkerSource.Sender,msid:D.vMsid});if(!U)throw new Error("No published stream found, please check your url: "+D.url);(O=U?.worker)===null||O===void 0||O.postMessage({operation:n.EWorkerAction.InserSEI,payloadType:D.payloadType,repeatCount:D.repeatCount,keyframeOnly:D.keyframeOnly,sei:D.data})}},g.prototype.updateStatsForSEI=function(D,O){var U=this,k=O==="pub";this.encodedInsertableStreams&&(b||l)&&D.forEach(function(w){var N,H=U.transformWorkerList.findByMsid({url:w.url,kind:n.TrackType.VIDEO,source:k?n.EWorkerSource.Sender:n.EWorkerSource.Receiver,msid:w.vMsid});H&&((N=H?.worker)===null||N===void 0||N.postMessage({operation:k?n.EWorkerAction.UpdatePubStats:n.EWorkerAction.UpdateSubStats,stats:w}))})},g.prototype.reset=function(){this.cancelable&&(this.cancelable.cancel(),this.cancelable=void 0),this.peerCore&&(this.peerCore.dispose(),this.peerCore=void 0),this.pc&&(this.pc.onconnectionstatechange=function(){},this.pc.ontrack=function(){},this.pc.close(),this.pc=void 0,this.clearStatusTimer()),this.sdpUtil&&(this.sdpUtil.dispose(),this.sdpUtil=void 0),this.localStream&&(this.localStream=void 0),this.transformWorkerList.dispose(),this.subMonitor.stop(),this.pubMonitor.stopHeartbeat(),this.isReused=!1,this.encodedInsertableStreams=void 0,this.stopHeartbeatTimeoutChecker()},g.prototype.addStream=function(){if(this.localStream){if(this.pc){if(this.localStream.audioTrack){var D=this.pc.addTransceiver(this.localStream.audioTrack,{direction:"sendonly",streams:[this.localStream.mediaStream]});if(this.senderCodecPreferences.audio)try{D.setCodecPreferences(this.senderCodecPreferences.audio)}catch(U){console.warn("setCodecPreferences error",U)}}if(this.localStream.videoTrack){var O=this.pc.addTransceiver(this.localStream.videoTrack,{direction:"sendonly",streams:[this.localStream.mediaStream]});if(this.senderCodecPreferences.video)try{O.setCodecPreferences(this.senderCodecPreferences.video)}catch(U){console.warn("setCodecPreferences error",U)}}return 0}return x.ErrorCode.ERROR_PREERCONNECTION_UNKNOWN}return x.ErrorCode.ERROR_MEDIASTREAMTRACK_AUDIO_NONE},g.prototype.handleEncodedInsertableStreams=function(D){var O,U,k=this;if(this.encodedInsertableStreams){var w=D.receiver,N=D.sender,H=w?n.EWorkerSource.Receiver:n.EWorkerSource.Sender,F=w||N,P=F.track;if(!P)return console.warn("no track in senderReceiver!");var B=P.kind,W=(U=(O=this.peerCore)===null||O===void 0?void 0:O.getStreamManager())===null||U===void 0?void 0:U.getAllTrackPairList(H===n.EWorkerSource.Receiver?c.Subscribe:c.Publish),z=W?.find(function(se){var ue,pe;return((pe=(ue=se[B===n.TrackType.VIDEO?"vTransceiver":"aTransceiver"])===null||ue===void 0?void 0:ue.track)===null||pe===void 0?void 0:pe.id)===P.id});if(!z)return console.warn("no existing stream info found");var G=new p.default;if(!this.transformWorkerList.add({worker:G,kind:B,source:H,info:z,receiver:w,sender:N}))return console.log("worker existing, skip.");var J=n.EWorkerAction.Setup,re=performance.timeOrigin;if(b){var te=F.createEncodedStreams(),ie=te.readable,ce=te.writable;G.postMessage({source:H,readable:ie,writable:ce,operation:J},[ie,ce])}else l&&(F.transform=new RTCRtpScriptTransform(G,{source:H,operation:J,windowTimeOrigin:re}));z.cumuDelay&&B==="video"&&(G.postMessage({operation:n.EWorkerAction.SwitchCumuDelay,enable:!0,windowTimeOrigin:re}),b||l||this.emit("cumuDelayNotSupported")),G.onmessage=function(se){var ue=se.data,pe=ue.type,de=ue.data,ve=ue.frameInfo;pe==="encodedFrame"&&k.emit("encodedFrame",{kind:B,url:z.originUrl,vMsid:B==="video"?z?.vMsid:void 0,aMsid:B==="audio"?z?.aMsid:void 0,frame:f({data:de},ve),subStats:se.data.subStats})}}},g.prototype.handleSubTransceiver=function(D,O){var U,k,w,N=!1;if(!((U=this.pc)===null||U===void 0)&&U.addTransceiver){if(D&&(k=this.pc.addTransceiver("audio",{direction:"recvonly"}),this.receiverCodecPreferences.audio))try{k.setCodecPreferences(this.receiverCodecPreferences.audio)}catch(H){console.warn("setCodecPreferences error",H)}if(O&&(w=this.pc.addTransceiver("video",{direction:"recvonly"}),this.receiverCodecPreferences.video))try{w.setCodecPreferences(this.receiverCodecPreferences.video)}catch(H){console.warn("setCodecPreferences error",H)}N=!0}return{added:N,aTransceiver:k,vTransceiver:w}},g.prototype.initDataChannel=function(){!this.dataChannel&&this.pc&&(this.dataChannel=new S.Datachannel(this.pc))},g.prototype.handleClosed=function(){this.subMonitor.stop(),this.emit("connectStatusChange",{status:n.EConnectStatus.CONNECT_STATUS_DISCONNECTED}),this.emit("onEnd")},g.prototype.clearStatusTimer=function(){this.statusTimer&&clearTimeout(this.statusTimer),this.statusTimer=void 0},g.prototype.registerPeerCoreListeners=function(D){var O=this;this.peerCore?(D.disableHeartbeat||((0,i.hebtLog)("heartbeat [timeout checker] started"),this.startHeartbeatTimeoutChecker()),this.peerCore.on("message",function(U){O.emit("message",U)}),this.peerCore.on("hebtReceived",function(U){(0,i.hebtLog)("EVENT: HEBT RECV",U),O.noHeartbeatCount=0,O.emit("hebtReceived",U)}),this.peerCore.on("streamError",function(U){(0,i.hebtLog)("EVENT: \u5355\u8DEF\u6D41\u9519\u8BEF",U),O.emit("streamError",U)}),this.peerCore.on("streamReconnect",function(U){(0,i.hebtLog)("EVENT: \u5355\u8DEF\u6D41\u91CD\u8FDE",U),O.emit("streamReconnect",U)}),this.peerCore.on("traceIdUpdate",function(U){O.emit("traceIdUpdate",U)}),this.peerCore.on("pcReconnect",function(U){(0,i.hebtLog)("EVENT: PC\u91CD\u8FDE",U),O.emit("pcReconnect",U)}),this.peerCore.on("datachannelNotEnabled",function(){var U;(0,i.hebtLog)("EVENT: \u6570\u636E\u901A\u9053\u672A\u5F00\u542F"),O.stopHeartbeatTimeoutChecker(),(U=O.peerCore)===null||U===void 0||U.stopSignalHeartbeatTimer()})):(0,i.hebtLog)("PeerCore listeners registration failed.")},g.prototype.startHeartbeatTimeoutChecker=function(){var D=this;this.stopHeartbeatTimeoutChecker(),this.heartbeatTimeoutHandler=setInterval(function(){D.noHeartbeatCount++,D.noHeartbeatCount>=n.DEFAULT_HEARTBEAT_TIMEOUT&&((0,i.hebtLog)("EVENT: \u5FC3\u8DF3\u8D85\u65F6, PC\u91CD\u8FDE"),D.stopHeartbeatTimeoutChecker(),D.emit("pcReconnect",{recode:"",reMsg:"heartbeat timeout"}))},1e3)},g.prototype.stopHeartbeatTimeoutChecker=function(){this.heartbeatTimeoutHandler!==null&&clearInterval(this.heartbeatTimeoutHandler),this.heartbeatTimeoutHandler=null,this.noHeartbeatCount=0},g.CONNECT_TIMEOUT=1e4,g}(o.default);T.RtsPeerconnection=A;var R=function(){function C(){this.workerList=[]}return C.prototype.add=function(g){return!this.findByMsid({url:g.info.url,source:g.source,kind:g.kind,msid:g.kind===n.TrackType.VIDEO?g.info.vMsid:g.info.aMsid})&&(this.workerList.push(g),!0)},C.prototype.removeByUrl=function(g){var D=this;this.workerList.filter(function(O){return O.info.url.split("?")[0]===g.url.split("?")[0]&&O.source===g.source}).forEach(function(O){O.worker.terminate(),D.workerList=D.workerList.filter(function(U){return U!==O})})},C.prototype.removeByMsid=function(g){var D=this.findByMsid(g);D?(D.worker.terminate(),this.workerList=this.workerList.filter(function(O){return O!==D})):console.warn("no worker to remove")},C.prototype.findByUrl=function(g,D){return this.workerList.find(function(O){return O.info.url.split("?")[0]===g.split("?")[0]&&O.kind===D})},C.prototype.findByMsid=function(g){var D=g.url,O=g.kind,U=g.source,k=g.msid,w=O===n.TrackType.VIDEO?"vMsid":"aMsid";return this.workerList.find(function(N){return N.info.url.split("?")[0]===D.split("?")[0]&&N.source===U&&N.kind===O&&N.info[w]===k})},C.prototype.dispose=function(){this.workerList.forEach(function(g){g.worker.terminate()}),this.workerList=[]},C}()},2825:(j,T)=>{Object.defineProperty(T,"__esModule",{value:!0})},8156:function(j,T,_){var m=this&&this.__createBinding||(Object.create?function(s,c,a,e){e===void 0&&(e=a);var r=Object.getOwnPropertyDescriptor(c,a);r&&!("get"in r?!c.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return c[a]}}),Object.defineProperty(s,e,r)}:function(s,c,a,e){e===void 0&&(e=a),s[e]=c[a]}),d=this&&this.__exportStar||function(s,c){for(var a in s)a==="default"||Object.prototype.hasOwnProperty.call(c,a)||m(c,s,a)};Object.defineProperty(T,"__esModule",{value:!0}),T.EDatachannelStatus=T.EConnectStatus=T.AliRTS=void 0,_(9543);var f=_(4845);Object.defineProperty(T,"AliRTS",{enumerable:!0,get:function(){return f.AliRTS}}),window&&(window.AliRTS=f.AliRTS);var y=_(5917);Object.defineProperty(T,"EConnectStatus",{enumerable:!0,get:function(){return y.EConnectStatus}});var v=_(280);Object.defineProperty(T,"EDatachannelStatus",{enumerable:!0,get:function(){return v.EDatachannelStatus}}),d(_(2825),T)},2672:(j,T)=>{var _;Object.defineProperty(T,"__esModule",{value:!0}),T.EN=void 0,function(m){m.MESSAGE_NOTSUPPORT_WEBRTC="not support webrtc",m.MESSAGE_BROWSER_NOTSUPPORT="browser not support",m.MESSAGE_BROWSER_VERSIONLOW="browser version too low",m.MESSAGE_NOTSUPPORT_H264="not support h264",m.MESSAGE_CREATEOFFER="create offer error"}(_||(T.EN=_={}))},2818:function(j,T,_){var m=this&&this.__assign||function(){return m=Object.assign||function(e){for(var r,i=1,o=arguments.length;i<o;i++)for(var t in r=arguments[i])Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e},m.apply(this,arguments)},d=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(T,"__esModule",{value:!0});var f,y=_(233),v=d(_(7028)),s=_(9428),c=d(_(2632));(function(e){e[e.UA=101]="UA",e[e.SUB_STATS=107]="SUB_STATS",e[e.PUB_STATS=108]="PUB_STATS",e[e.CONNECT_STATE_CHANGE=109]="CONNECT_STATE_CHANGE",e[e.START_PLAY=120]="START_PLAY",e[e.STOP_PLAY=121]="STOP_PLAY",e[e.SUBSCRIBE_START=125]="SUBSCRIBE_START",e[e.SUBSCRIBE_OK=126]="SUBSCRIBE_OK",e[e.FIRST_FRAME_TIME=137]="FIRST_FRAME_TIME",e[e.DC_HTTP_CONNECT=140]="DC_HTTP_CONNECT",e[e.DC_HTTP_CONNECT_OK=141]="DC_HTTP_CONNECT_OK",e[e.DC_SUB_ADD=142]="DC_SUB_ADD",e[e.DC_SUB_ADD_OK=143]="DC_SUB_ADD_OK",e[e.DC_CONNECT_STATE_CHANGE=144]="DC_CONNECT_STATE_CHANGE",e[e.DC_SUB_STOP=145]="DC_SUB_STOP",e[e.DC_SUB_STOP_OK=146]="DC_SUB_STOP_OK",e[e.DC_DISPOSE=147]="DC_DISPOSE",e[e.ERROR_INFO=150]="ERROR_INFO",e[e.DC_PUB_ADD=152]="DC_PUB_ADD",e[e.DC_PUB_ADD_OK=153]="DC_PUB_ADD_OK",e[e.DC_PUB_STOP=155]="DC_PUB_STOP",e[e.DC_PUB_STOP_OK=156]="DC_PUB_STOP_OK",e[e.RECONNECT=160]="RECONNECT",e[e.RECONNECT_PARAMS=161]="RECONNECT_PARAMS",e[e.RECONNECT_FINISH=162]="RECONNECT_FINISH",e[e.NOTIFY_MESSAGE=170]="NOTIFY_MESSAGE",e[e.CUMU_DELAY_NOT_SUPPORTED=180]="CUMU_DELAY_NOT_SUPPORTED",e[e.CUMU_DELAY_ANSWER_NOT_FOUND=181]="CUMU_DELAY_ANSWER_NOT_FOUND",e[e.CREATE_CLIENT=200]="CREATE_CLIENT",e[e.LOCALSTREAM_INITED=201]="LOCALSTREAM_INITED",e[e.START_PUBLISH=220]="START_PUBLISH",e[e.STOP_PUBLISH=221]="STOP_PUBLISH",e[e.PUBLISH_OK=222]="PUBLISH_OK",e[e.SET_VIDEOPROFILE=230]="SET_VIDEOPROFILE",e[e.SET_SCREENPROFILE=231]="SET_SCREENPROFILE",e[e.SET_AUDIOPROFILE=238]="SET_AUDIOPROFILE",e[e.ENABLE_AUDIO=232]="ENABLE_AUDIO",e[e.DISABLE_AUDIO=233]="DISABLE_AUDIO",e[e.ENABLE_VIDEO=234]="ENABLE_VIDEO",e[e.DISABLE_VIDEO=235]="DISABLE_VIDEO",e[e.STOP=236]="STOP",e[e.PLAY=237]="PLAY"})(f||(f={}));var a=function(){function e(r){this.customReporter=r?.customReporter,this.ct=r&&r.customTag?r.customTag:"",this.enableLog=!r||r.trackLog!=0,this._initParam(),this.slsTracker=new c.default({host:"cn-hangzhou.log.aliyuncs.com",project:"videocloud",logstore:"live-client-log",time:10,count:10})}return e.prototype.updateTid=function(){this.param?this.param.tid=y.Guid.create(32):this._initParam()},e.prototype.updateUrl=function(r){this.param&&(this.param.pu=r)},e.prototype.reportUA=function(r){this.reporter({msgid:f.UA,args:JSON.stringify({ua:r})})},e.prototype.reportPullStats=function(r){var i,o=m(m({},r),{cumu:""});if(this.cumuDelayInfo)try{i=JSON.parse(this.cumuDelayInfo)}catch{}i&&(this.cumuDelayInfo=void 0,o.cumu=i),this.reporter({msgid:f.SUB_STATS,args:JSON.stringify(m({},o))})},e.prototype.reportPushStats=function(r){this.reporter({msgid:f.PUB_STATS,args:JSON.stringify(m({},r))})},e.prototype.reportStartPlay=function(r){this.reporter({msgid:f.START_PLAY,args:JSON.stringify({vurl:r})})},e.prototype.reportStopPlay=function(){this.reporter({msgid:f.STOP_PLAY})},e.prototype.reportSubscribeStart=function(r,i,o,t,n){this.reporter({msgid:f.SUBSCRIBE_START,args:JSON.stringify({vurl:r,surl:i,vMsid:o?o.join(", "):"",aMsid:t?t.join(", "):"",isSubAdd:!!n})})},e.prototype.reportSubscribeOk=function(r){r===void 0&&(r={}),this.reporter({msgid:f.SUBSCRIBE_OK,args:JSON.stringify({vurl:r.vurl||"",surl:r.surl||"",hrct:r.hrct,tcid:r.traceId,rslt:r.rslt,isSubAdd:!!r.isSubAdd})})},e.prototype.reportFirstFrameTime=function(r,i,o,t,n,u,h,S,x,E,p,b,l,A){this.reporter({msgid:f.FIRST_FRAME_TIME,args:JSON.stringify({vurl:r,cpct:o,hrct:t,tcid:i,ffct:n,rslt:u,cnct:h,stats:S,delct:x,addct:E,actct:p,vMsid:b?b.join(", "):"",aMsid:l?l.join(", "):"",isSubAdd:!!A})})},e.prototype.reportErrorInfo=function(r,i,o,t){r!==s.ErrorCode.ERROR_AUTOPLAY_ERROR&&this.reporter({msgid:f.ERROR_INFO,args:JSON.stringify({errorCode:r,message:i,tcid:o,extraInfo:t})})},e.prototype.reportReconnect=function(r,i,o,t,n){this.reporter({msgid:f.RECONNECT,args:JSON.stringify({errorCode:r,message:i,tcid:o,retryTimes:t,useTcp:n})})},e.prototype.reportReconnectParams=function(r,i,o,t,n,u){this.reporter({msgid:f.RECONNECT_PARAMS,args:JSON.stringify({type:r,url:i,vMsid:(o||[]).join(","),aMsid:(t||[]).join(","),useTcp:n,streamId:u})})},e.prototype.reportReconnectFinish=function(r){r===void 0&&(r={}),this.reporter({msgid:f.RECONNECT_FINISH,args:JSON.stringify(m({},r))})},e.prototype.reportCreateClient=function(){this.reporter({msgid:f.CREATE_CLIENT})},e.prototype.reportStartPublish=function(r,i,o){this.reporter({msgid:f.START_PUBLISH,args:JSON.stringify({purl:r,surl:i,isPubAdd:!!o})})},e.prototype.reportPublishOk=function(r,i,o,t,n,u,h,S){this.reporter({msgid:f.PUBLISH_OK,args:JSON.stringify({purl:r,surl:i,coct:o,hrct:t,act:n,tcid:u,totalct:h||o+t+n,isPubAdd:!!S})})},e.prototype.reportStopPublish=function(r,i){this.reporter({msgid:f.STOP_PUBLISH,args:JSON.stringify({url:r,isPubStop:!!i})})},e.prototype.reportVideoProfile=function(r){this.reporter({msgid:f.SET_VIDEOPROFILE,args:JSON.stringify({vp:r})})},e.prototype.reportScreenProfile=function(r){this.reporter({msgid:f.SET_SCREENPROFILE,args:JSON.stringify({sp:r})})},e.prototype.reportAudioProfile=function(r){this.reporter({msgid:f.SET_AUDIOPROFILE,args:JSON.stringify({vp:r})})},e.prototype.reportEnableAudio=function(){this.reporter({msgid:f.ENABLE_AUDIO})},e.prototype.reportDisableAudio=function(){this.reporter({msgid:f.DISABLE_AUDIO})},e.prototype.reportEnableVideo=function(){this.reporter({msgid:f.ENABLE_VIDEO})},e.prototype.reportDisableVideo=function(){this.reporter({msgid:f.DISABLE_VIDEO})},e.prototype.reportStop=function(r){this.reporter({msgid:f.STOP,args:JSON.stringify({tp:r})})},e.prototype.reportPlay=function(r){this.reporter({msgid:f.PLAY,args:JSON.stringify({tp:r})})},e.prototype.reportStreamCreated=function(r,i){this.reporter({msgid:f.LOCALSTREAM_INITED,args:JSON.stringify({userConfig:r,localStreamInfo:i})})},e.prototype.reportConnectionChange=function(r,i){this.reporter({msgid:f.CONNECT_STATE_CHANGE,args:JSON.stringify({connectionState:r,direction:i})})},e.prototype.reportDatachannelHttpConnect=function(r){this.reporter({msgid:f.DC_HTTP_CONNECT,args:JSON.stringify({url:r})})},e.prototype.reportDatachannelHttpConnectOk=function(r){this.reporter({msgid:f.DC_HTTP_CONNECT_OK,args:JSON.stringify(m({},r))})},e.prototype.reportDatachannelSubAdd=function(r){this.reporter({msgid:f.DC_SUB_ADD,args:JSON.stringify(m({},r))})},e.prototype.reportDatachannelPubAdd=function(r){this.reporter({msgid:f.DC_PUB_ADD,args:JSON.stringify(m({},r))})},e.prototype.reportDatachannelSubAddOk=function(r){this.reporter({msgid:f.DC_SUB_ADD_OK,args:JSON.stringify(m({},r))})},e.prototype.reportDatachannelPubAddOk=function(r){this.reporter({msgid:f.DC_PUB_ADD_OK,args:JSON.stringify(m({},r))})},e.prototype.reportDatachannelStatusChange=function(r){this.reporter({msgid:f.DC_CONNECT_STATE_CHANGE,args:JSON.stringify(m({},r))})},e.prototype.reportDatachannelSubStop=function(r){this.reporter({msgid:f.DC_SUB_STOP,args:JSON.stringify(m({},r))})},e.prototype.reportDatachannelPubStop=function(r){this.reporter({msgid:f.DC_PUB_STOP,args:JSON.stringify(m({},r))})},e.prototype.reportDatachannelSubStopOk=function(r){this.reporter({msgid:f.DC_SUB_STOP_OK,args:JSON.stringify(m({},r))})},e.prototype.reportDatachannelPubStopOk=function(r){this.reporter({msgid:f.DC_PUB_STOP_OK,args:JSON.stringify(m({},r))})},e.prototype.reportDatachannelDispose=function(r){this.reporter({msgid:f.DC_DISPOSE,args:JSON.stringify(m({},r))})},e.prototype.reportNotifyMessage=function(r){this.reporter({msgid:f.NOTIFY_MESSAGE,args:JSON.stringify(m({},r))})},e.prototype.reportCumuDelayNotSupported=function(){this.reporter({msgid:f.CUMU_DELAY_NOT_SUPPORTED})},e.prototype.reportCumuDelayAnswerNotFound=function(){this.reporter({msgid:f.CUMU_DELAY_ANSWER_NOT_FOUND})},e.prototype.updateCumuDelayInfo=function(r){this.cumuDelayInfo=r.json},e.prototype._initParam=function(){this.param||(this.param={APIVersion:"0.6.0",os:y.SystemUtil.platform,osv:y.SystemUtil.systemVersion,bt:y.BrowserUtil.browserName,bv:y.BrowserUtil.browserVersion,host:window.location.origin,page:window.location.href,uid:y.LocalStorage.uuid,tid:y.Guid.create(32),ver:v.default.version,ct:this.ct,dt:"",lv:"1.0.0",ua:navigator&&navigator.userAgent||"",pu:""})},e.prototype.reporter=function(r){var i=m(m(m(m({},this.param||{}),{tm:new Date().getTime()}),r||{}),{msgname:f[r.msgid]});if(this.customReporter&&typeof this.customReporter=="function")try{this.customReporter(i)}catch(o){console.error("[Error in customReporter] ",o)}this.enableLog&&this.slsTracker.send(i)},e.prototype.data2String=function(r){var i="";for(var o in r)r.hasOwnProperty(o)&&(i.length&&(i+="&"),i+=o+"="+r[o]);return i},e.HEARTHEAT_INTERVAL=4,e}();T.default=a},7668:function(j,T,_){var m,d=this&&this.__extends||(m=function(b,l){return m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,R){A.__proto__=R}||function(A,R){for(var C in R)Object.prototype.hasOwnProperty.call(R,C)&&(A[C]=R[C])},m(b,l)},function(b,l){if(typeof l!="function"&&l!==null)throw new TypeError("Class extends value "+String(l)+" is not a constructor or null");function A(){this.constructor=b}m(b,l),b.prototype=l===null?Object.create(l):(A.prototype=l.prototype,new A)}),f=this&&this.__assign||function(){return f=Object.assign||function(b){for(var l,A=1,R=arguments.length;A<R;A++)for(var C in l=arguments[A])Object.prototype.hasOwnProperty.call(l,C)&&(b[C]=l[C]);return b},f.apply(this,arguments)},y=this&&this.__awaiter||function(b,l,A,R){return new(A||(A=Promise))(function(C,g){function D(k){try{U(R.next(k))}catch(w){g(w)}}function O(k){try{U(R.throw(k))}catch(w){g(w)}}function U(k){var w;k.done?C(k.value):(w=k.value,w instanceof A?w:new A(function(N){N(w)})).then(D,O)}U((R=R.apply(b,l||[])).next())})},v=this&&this.__generator||function(b,l){var A,R,C,g,D={label:0,sent:function(){if(1&C[0])throw C[1];return C[1]},trys:[],ops:[]};return g={next:O(0),throw:O(1),return:O(2)},typeof Symbol=="function"&&(g[Symbol.iterator]=function(){return this}),g;function O(U){return function(k){return function(w){if(A)throw new TypeError("Generator is already executing.");for(;g&&(g=0,w[0]&&(D=0)),D;)try{if(A=1,R&&(C=2&w[0]?R.return:w[0]?R.throw||((C=R.return)&&C.call(R),0):R.next)&&!(C=C.call(R,w[1])).done)return C;switch(R=0,C&&(w=[2&w[0],C.value]),w[0]){case 0:case 1:C=w;break;case 4:return D.label++,{value:w[1],done:!1};case 5:D.label++,R=w[1],w=[0];continue;case 7:w=D.ops.pop(),D.trys.pop();continue;default:if(C=D.trys,!((C=C.length>0&&C[C.length-1])||w[0]!==6&&w[0]!==2)){D=0;continue}if(w[0]===3&&(!C||w[1]>C[0]&&w[1]<C[3])){D.label=w[1];break}if(w[0]===6&&D.label<C[1]){D.label=C[1],C=w;break}if(C&&D.label<C[2]){D.label=C[2],D.ops.push(w);break}C[2]&&D.ops.pop(),D.trys.pop();continue}w=l.call(b,D)}catch(N){w=[6,N],R=0}finally{A=C=0}if(5&w[0])throw w[1];return{value:w[0]?w[1]:void 0,done:!0}}([U,k])}}},s=this&&this.__rest||function(b,l){var A={};for(var R in b)Object.prototype.hasOwnProperty.call(b,R)&&l.indexOf(R)<0&&(A[R]=b[R]);if(b!=null&&typeof Object.getOwnPropertySymbols=="function"){var C=0;for(R=Object.getOwnPropertySymbols(b);C<R.length;C++)l.indexOf(R[C])<0&&Object.prototype.propertyIsEnumerable.call(b,R[C])&&(A[R[C]]=b[R[C]])}return A},c=this&&this.__importDefault||function(b){return b&&b.__esModule?b:{default:b}};Object.defineProperty(T,"__esModule",{value:!0}),T.RtsClient=void 0;var a=c(_(102)),e=_(5917),r=_(5676),i=_(9796),o=_(6600),t=c(_(2818)),n=c(_(7028)),u=_(7989),h=_(280),S=_(9428),x=_(5044),E=_(2470),p=function(b){function l(A){var R,C=b.call(this)||this;return C.pullH264Checked=!1,C.lastProtocol="udp",C.usePcReconnect=!1,C.reporter=new t.default(A),C.subscriber=new r.Subscriber(C.reporter,A?A.playConfig:void 0),C.publisher=new i.Publisher(C.reporter),C.commonController=new o.CommonController(C.reporter),C.pcRestorer=new E.PcRestorer({subscriber:C.subscriber,publisher:C.publisher,commonController:C.commonController}),C.usePcReconnect=!!(!((R=A?.singlePcConfig)===null||R===void 0)&&R.usePcReconnect),C.subscriber.on("onError",function(g){return y(C,void 0,void 0,function(){var D,O,U,k,w,N,H,F,P,B,W=this;return v(this,function(z){switch(z.label){case 0:return D=(U=g.extraInfo)===null||U===void 0?void 0:U.response,this.reporter.reportErrorInfo(g.errorCode,g.message,g.traceId,{sdp:(k=g.extraInfo)===null||k===void 0?void 0:k.sdp,response:{status:D?.status,data:D?.data},pcErrorInfo:(w=g.extraInfo)===null||w===void 0?void 0:w.pcErrorInfo}),this.usePcReconnect?[3,5]:S.SUB_RECONNECT_ERROR_LIST.includes(g.errorCode)?this.subscriber.isConnecting?[3,2]:(O=this.lastProtocol==="udp",this.lastProtocol=O?"tcp":"udp",console.log("retrying with",this.lastProtocol),[4,this.subscriber.retrySubscribe(g,{innerTcpOnly:O})]):[3,3];case 1:z.sent()?(this.reporter.reportReconnect(g.errorCode,g.message,g.traceId,(N=g.extraInfo)===null||N===void 0?void 0:N.retryTimes,O),this.emit("reconnect",this.makeReconnectEvent("sub",g))):this.emit("onError",g),z.label=2;case 2:return[3,4];case 3:this.emit("onError",g),z.label=4;case 4:return[3,6];case 5:[S.ErrorCode.ERROR_PC_DISCONNECTED,S.ErrorCode.ERROR_IP_MIGRATE].includes(g.errorCode)&&(this.pcRestorer.isReconnecting()||(g.extraInfo=f(f({},g.extraInfo),{retryTimes:1}),this.reporter.reportReconnect(g.errorCode,g.message,g.traceId,(H=g.extraInfo)===null||H===void 0?void 0:H.retryTimes),this.emit("reconnect",this.makeReconnectEvent("sub",g)),this.emit("connectStatusChange",{status:e.EConnectStatus.CONNECT_STATUS_RECONNECTING}),(B=(P=this.pcRestorer.restore((F=g.extraInfo.pcErrorInfo)===null||F===void 0?void 0:F.ips))===null||P===void 0?void 0:P.then(function(G){W.reporter.reportReconnectFinish({level:"pc"}),W.emit("reconnectFinish",{type:"all",traceId:G.traceId,latestUrl:G.latestUrl})}))===null||B===void 0||B.catch(function(G){var J=new x.RtsError(S.ErrorCode.ERROR_SINGLE_PC_FULL_RECONNECT_HTTP_FAILED,"pc full reconnect failed","",{originError:G});W.emit("onError",J),W.reporter.reportErrorInfo(J.errorCode,J.message)}))),z.label=6;case 6:return[2]}})})}),C.subscriber.on("reconnect",function(g){var D;C.reporter.reportReconnect(g.errorCode,g.message,g.traceId,(D=g.extraInfo)===null||D===void 0?void 0:D.retryTimes),C.emit("reconnect",C.makeReconnectEvent("sub",g))}),C.subscriber.on("onPlayEvent",function(g){C.emit("onPlayEvent",g)}),C.subscriber.on("connectStatusChange",function(g){C.emit("connectStatusChange",g),C.reporter.reportConnectionChange(e.EConnectStatus[g.status],"sub")}),C.publisher.on("connectStatusChange",function(g){C.emit("connectStatusChange",g),C.reporter.reportConnectionChange(e.EConnectStatus[g.status],"pub")}),C.publisher.on("onError",function(g){return y(C,void 0,void 0,function(){var D,O,U,k,w,N,H,F,P,B,W,z=this;return v(this,function(G){switch(G.label){case 0:return D=(U=g.extraInfo)===null||U===void 0?void 0:U.response,this.reporter.reportErrorInfo(g.errorCode,g.message,g.traceId,{sdp:(k=g.extraInfo)===null||k===void 0?void 0:k.sdp,response:{status:D?.status,data:D?.data},pcErrorInfo:(w=g.extraInfo)===null||w===void 0?void 0:w.pcErrorInfo}),this.usePcReconnect?[3,5]:S.PUB_RECONNECT_ERROR_LIST.includes(g.errorCode)?this.publisher.isConnecting?[3,2]:(O=g.errorCode===S.ErrorCode.ERROR_TRANSPORT_CLOSED&&((N=g.extraInfo)===null||N===void 0?void 0:N.protocol)!=="tcp",console.log("Retrying with ",O?"TCP":"UDP"),[4,this.publisher.retryPublish(g,O)]):[3,3];case 1:G.sent()?(this.reporter.reportReconnect(g.errorCode,g.message,g.traceId,(H=g.extraInfo)===null||H===void 0?void 0:H.retryTimes,O),this.emit("reconnect",this.makeReconnectEvent("pub",g))):this.emit("onError",g),G.label=2;case 2:return[3,4];case 3:this.emit("onError",g),G.label=4;case 4:return[3,6];case 5:[S.ErrorCode.ERROR_PC_DISCONNECTED,S.ErrorCode.ERROR_IP_MIGRATE].includes(g.errorCode)&&(this.pcRestorer.isReconnecting()||(g.extraInfo=f(f({},g.extraInfo),{retryTimes:1}),this.reporter.reportReconnect(g.errorCode,g.message,g.traceId,(F=g.extraInfo)===null||F===void 0?void 0:F.retryTimes),this.emit("reconnect",this.makeReconnectEvent("pub",g)),this.emit("connectStatusChange",{status:e.EConnectStatus.CONNECT_STATUS_RECONNECTING}),(W=(B=this.pcRestorer.restore((P=g.extraInfo.pcErrorInfo)===null||P===void 0?void 0:P.ips))===null||B===void 0?void 0:B.then(function(J){z.reporter.reportReconnectFinish({level:"pc"}),z.emit("reconnectFinish",{type:"all",traceId:J.traceId,latestUrl:J.latestUrl})}))===null||W===void 0||W.catch(function(J){var re=new x.RtsError(S.ErrorCode.ERROR_SINGLE_PC_FULL_RECONNECT_HTTP_FAILED,"pc full reconnect failed","",{originError:J});z.emit("onError",re),z.reporter.reportErrorInfo(re.errorCode,re.message)}))),G.label=6;case 6:return[2]}})})}),C.publisher.on("reconnect",function(g){var D;C.reporter.reportReconnect(g.errorCode,g.message,g.traceId,(D=g.extraInfo)===null||D===void 0?void 0:D.retryTimes),C.emit("reconnect",C.makeReconnectEvent("pub",g))}),C.commonController.on("connectStatusChange",function(g){C.emit("connectStatusChange",g),C.reporter.reportConnectionChange(e.EConnectStatus[g.status],"signalChannel")}),C.commonController.on("onError",function(g){C.reporter.reportErrorInfo(g.errorCode,g.message,g.traceId),C.emit("onError",g)}),C.commonController.on("datachannelStatusChange",function(g){C.emit("datachannelStatusChange",g),C.reporter.reportDatachannelStatusChange({state:h.EDatachannelStatus[g.status],url:"",label:"SIGNAL",id:-1,msid:""})}),C.commonController.on("encodedFrame",function(g){C.emit("encodedFrame",g)}),C.commonController.on("receivedSEI",function(g){C.emit("receivedSEI",g)}),C.commonController.on("onPlayEvent",function(g){C.emit("onPlayEvent",g)}),C.commonController.on("reconnect",function(g){g.type!=="pc"&&C.emit("reconnect",g)}),C.commonController.on("reconnectFinish",function(g){C.reporter.reportReconnectFinish(g),C.emit("reconnectFinish",g)}),C.commonController.on("traceId",function(g){C.emit("traceId",g)}),C.commonController.on("heartbeat",function(g){C.emit("heartbeat",g)}),C.commonController.on("cumuDelayNotSupported",function(){C.emit("cumuDelayNotSupported")}),C.reporter.reportCreateClient(),C}return d(l,b),l.prototype.getVersion=function(){return n.default.version},l.prototype.isSupport=function(A){var R=new u.SupportUtil;return this.pullH264Checked=!0,R.isSupport(A)},l.prototype.checkPublishSupport=function(){return new u.SupportUtil().checkPublishSupport()},l.prototype.checkEncodedTransformSupport=function(){return new u.SupportUtil().checkEncodedTransformSupport()},l.prototype.subscribe=function(A,R){return this.reporter.updateUrl(A),this.commonController.setConfig(R),this.commonController.setPeerconnection(this.subscriber.getPeerConnection()),this.subscriber.resetResubscribeStatus(),this.subscriber.subscribeWithReconnect(A,f(f({},R),{isH264Checked:this.pullH264Checked}))},l.prototype.subscribeAdd=function(A){return this.commonController.subscribeAdd(A)},l.prototype.subscribeActive=function(A){return this.commonController.subscribeActive(A)},l.prototype.subscribeDeleteTracks=function(A){return this.commonController.subscribeDeleteTracks(A)},l.prototype.subscribeStop=function(A){return this.commonController.subscribeStop(A)},l.prototype.publishAdd=function(A){return this.commonController.publishAdd(A)},l.prototype.publishDeleteTracks=function(A){return this.commonController.publishDeleteTracks(A)},l.prototype.publishReplaceTracks=function(A){return this.commonController.publishReplaceTracks(A)},l.prototype.publishStop=function(A){return this.commonController.publishStop(A)},l.prototype.subscribeAddDatachannel=function(A){return this.commonController.subscribeAddDatachannel(A)},l.prototype.subscribeStopDatachannel=function(A){return this.commonController.subscribeStopDatachannel(A)},l.prototype.publishAddDatachannel=function(A){return this.commonController.publishAddDatachannel(A)},l.prototype.publishStopDatachannel=function(A){return this.commonController.publishStopDatachannel(A)},l.prototype.unsubscribe=function(){this.subscriber.resetResubscribeStatus(),this.subscriber.unsubscribe()},l.prototype.startLiveStream=function(A,R,C){return this.reporter.reportStartPlay(A),this.subscriber.startLiveStream(A,R,C)},l.prototype.stopLiveStream=function(){this.reporter.reportStopPlay(),this.subscriber.stopLiveStream()},l.prototype.muteLiveStream=function(A){this.subscriber.muteLiveStream(A)},l.prototype.publish=function(A,R,C){return y(this,void 0,void 0,function(){return v(this,function(g){return this.reporter.updateUrl(A),this.commonController.setConfig(C),this.commonController.setPeerconnection(this.publisher.getPeerConnection()),this.publisher.resetRepublishStatus(),[2,this.publisher.publishWithReconnect(A,R,C)]})})},l.prototype.unpublish=function(){return this.publisher.resetRepublishStatus(),this.publisher.unpublish()},l.prototype.sendSEI=function(A){this.publisher.sendSEI(A),this.commonController.sendSEI(A)},l.prototype.getPublishTrackInfoList=function(){return this.publisher.getTrackInfoList()},l.prototype.getTransportStats=function(){return this.subscriber.getPeerConnection().getSubMonitor().getTransportStats()},l.prototype.getRemoteVideoStats=function(){return this.subscriber.getPeerConnection().getSubMonitor().getRemoteVideoStats()},l.prototype.getRemoteAudioStats=function(){return this.subscriber.getPeerConnection().getSubMonitor().getRemoteAudioStats()},l.prototype.getSubscribeVideoStats=function(A,R){return this.commonController.getSubscribeVideoStats(A,R)},l.prototype.getSubscribeAudioStats=function(A,R){return this.commonController.getSubscribeAudioStats(A,R)},l.prototype.getPublishVideoStats=function(A,R){return this.commonController.getPublishVideoStats(A,R)},l.prototype.getPublishAudioStats=function(A,R){return this.commonController.getPublishAudioStats(A,R)},l.prototype.setReceiverCodecPreferences=function(A){return this.commonController.setReceiverCodecPreferences(A)},l.prototype.setSenderCodecPreferences=function(A){return this.commonController.setSenderCodecPreferences(A)},l.prototype.makeReconnectEvent=function(A,R){var C=R||{},g=C.extraInfo,D=s(C,["extraInfo"]),O=g||{},U=O.retryTimes,k=s(O,["retryTimes"]),w=A;return{type:this.usePcReconnect?"pc":w,reason:D,retryTimes:U,extraInfo:k}},l.prototype.heartbeat=function(A){var R;(R=this.commonController.peerCore)===null||R===void 0||R.sendOnceHeartbeat(A)},l.prototype.setAutoHeartbeat=function(A){var R;(R=this.commonController.peerCore)===null||R===void 0||R.startSignalHeartbeatTimer(A)},l.prototype.clearAutoHeartbeat=function(){var A;(A=this.commonController.peerCore)===null||A===void 0||A.stopSignalHeartbeatTimer()},l.prototype.sendFalseHeartbeat=function(A){var R;(R=this.commonController.peerCore)===null||R===void 0||R.sendFalseHeartbeat(A)},l.prototype.updateAuth=function(A){return this.commonController.updateAuth(A)},l}(a.default);T.RtsClient=p},335:(j,T)=>{Object.defineProperty(T,"__esModule",{value:!0});var _=function(){function m(d){this.useGainNode=!0,this.audioContext=new AudioContext,this.audioDestination=this.audioContext.createMediaStreamDestination(),this.audioSource=[],this.gainNode=null,this.audioTrack=null,this.audioTrackArr=d.trackList||[],this.useGainNode=typeof d.useGainNode!="boolean"||d.useGainNode,this.useGainNode&&(this.gainNode=this.audioContext.createGain(),this.gainNode.connect(this.audioContext.destination),this.gainNode.gain.value=0),this.getMixedAudioTrack()}return m.prototype.destroy=function(){var d;(d=this.getMixedAudioTrack())===null||d===void 0||d.stop(),this.disconnectSourceNode(),this.audioContext.close(),this.audioTrackArr=[]},m.prototype.updateTrackList=function(d){d.length&&(this.disconnectSourceNode(),this.audioTrackArr=d,this.connectNode())},m.prototype.getMixedAudioTrack=function(){return this.audioTrack||(this.connectNode(),this.audioTrack=this.audioDestination.stream.getAudioTracks()[0]),this.audioTrack},m.prototype.connectNode=function(){var d=this;this.audioTrackArr.forEach(function(f){var y=new MediaStream;y.addTrack(f);var v=d.audioContext.createMediaStreamSource(y);d.gainNode&&v.connect(d.gainNode),d.audioSource.push(v)}),this.audioSource.forEach(function(f){f.connect(d.audioDestination)})},m.prototype.disconnectSourceNode=function(){var d=this;this.audioSource.forEach(function(f){d.gainNode&&f.disconnect(d.gainNode),f.disconnect(d.audioDestination)}),this.audioSource=[]},m}();T.default=_},1893:(j,T)=>{Object.defineProperty(T,"__esModule",{value:!0}),T.TwoDRenderer=void 0;var _=function(){function m(d){this.video=d.video,this.canvas=d.canvas,this.ctx=this.canvas.getContext("2d")}return m.prototype.render=function(){var d,f,y=this.video,v=this.canvas;y&&v&&((d=this.ctx)===null||d===void 0||d.clearRect(0,0,v.width,v.height),(f=this.ctx)===null||f===void 0||f.drawImage(y,0,0,1*y.videoWidth,1*y.videoHeight),this.requestId=requestAnimationFrame(this.render.bind(this)))},m.prototype.stop=function(){this.requestId&&cancelAnimationFrame(this.requestId)},m}();T.TwoDRenderer=_},6295:(j,T,_)=>{Object.defineProperty(T,"__esModule",{value:!0}),T.CanvasRenderer=void 0;var m=_(1893),d=function(){function f(y){this.video=y.video,this.canvas=this.initCanvas(),this.activeRenderer=this.initRenderer()}return Object.defineProperty(f.prototype,"mediaStream",{get:function(){var y;return this.ms||(this.ms=((y=this.canvas)===null||y===void 0?void 0:y.captureStream())||void 0),this.ms},enumerable:!1,configurable:!0}),f.prototype.start=function(){this.render()},f.prototype.stop=function(){this.activeRenderer.stop()},f.prototype.initCanvas=function(){var y=document.createElement("canvas"),v=this.video;return y.width=1*v.videoWidth,y.height=1*v.videoHeight,y},f.prototype.initRenderer=function(){return new m.TwoDRenderer({video:this.video,canvas:this.canvas})},f.prototype.render=function(){this.activeRenderer.render()},f.prototype.resize=function(y,v){this.canvas&&(this.canvas.width=y,this.canvas.height=v)},f}();T.CanvasRenderer=d},6420:function(j,T,_){var m=this&&this.__awaiter||function(s,c,a,e){return new(a||(a=Promise))(function(r,i){function o(u){try{n(e.next(u))}catch(h){i(h)}}function t(u){try{n(e.throw(u))}catch(h){i(h)}}function n(u){var h;u.done?r(u.value):(h=u.value,h instanceof a?h:new a(function(S){S(h)})).then(o,t)}n((e=e.apply(s,c||[])).next())})},d=this&&this.__generator||function(s,c){var a,e,r,i,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:t(0),throw:t(1),return:t(2)},typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function t(n){return function(u){return function(h){if(a)throw new TypeError("Generator is already executing.");for(;i&&(i=0,h[0]&&(o=0)),o;)try{if(a=1,e&&(r=2&h[0]?e.return:h[0]?e.throw||((r=e.return)&&r.call(e),0):e.next)&&!(r=r.call(e,h[1])).done)return r;switch(e=0,r&&(h=[2&h[0],r.value]),h[0]){case 0:case 1:r=h;break;case 4:return o.label++,{value:h[1],done:!1};case 5:o.label++,e=h[1],h=[0];continue;case 7:h=o.ops.pop(),o.trys.pop();continue;default:if(r=o.trys,!((r=r.length>0&&r[r.length-1])||h[0]!==6&&h[0]!==2)){o=0;continue}if(h[0]===3&&(!r||h[1]>r[0]&&h[1]<r[3])){o.label=h[1];break}if(h[0]===6&&o.label<r[1]){o.label=r[1],r=h;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(h);break}r[2]&&o.ops.pop(),o.trys.pop();continue}h=c.call(s,o)}catch(S){h=[6,S],e=0}finally{a=r=0}if(5&h[0])throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}([n,u])}}},f=this&&this.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(T,"__esModule",{value:!0}),T.Clock=void 0;var y=f(_(2505)),v=function(){function s(){this.request=y.default.create({timeout:6e4}),this.offset=0,this.nextAttemptMs=s.DEFAULT_ATTEMPT_INTERVAL,this.attemptCount=0,this.random=Math.random(),this.startSyncClock()}return s.prototype.now=function(){if(this.offset&&!Number.isNaN(this.offset)){var c=Date.now()+this.offset;return Math.round(c)}return Date.now()},s.prototype.syncClock=function(){return m(this,void 0,void 0,function(){var c,a,e,r,i;return d(this,function(o){switch(o.label){case 0:return c=!1,a=Date.now(),[4,this.fetchServerTime()];case 1:return e=o.sent(),r=Date.now(),e?(i=new Date(e).getTime(),Number.isNaN(i)||(this.offset=this.calculateOffset(a+this.fixRequestStartTime(),r,i),c=!0)):console.warn("Failed to fetch server time, should try again"),[2,c]}})})},s.prototype.startSyncClock=function(){return m(this,void 0,void 0,function(){var c,a=this;return d(this,function(e){switch(e.label){case 0:return[4,this.syncClock()];case 1:return c=e.sent(),this.nextAttemptMs=c?s.DEFAULT_ATTEMPT_INTERVAL:s.DEFAULT_ATTEMPT_RETRY_INTERVAL,this.stopSyncClock(),this.attemptTimer=setTimeout(function(){a.startSyncClock()},this.nextAttemptMs),[2]}})})},s.prototype.stopSyncClock=function(){this.attemptTimer&&clearTimeout(this.attemptTimer),this.attemptTimer=void 0},s.prototype.fetchServerTime=function(){return m(this,void 0,void 0,function(){var c,a,e;return d(this,function(r){switch(r.label){case 0:this.attemptCount++,r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.request.get(this.attachCount(s.DEFAULT_TIME_SOURCE))];case 2:return c=(e=r.sent())===null||e===void 0?void 0:e.data,[3,4];case 3:return a=r.sent(),console.log("GetServerTime error",a),[3,4];case 4:return[2,c]}})})},s.prototype.calculateOffset=function(c,a,e){return e-(a-(a-c)/2)},s.prototype.fixRequestStartTime=function(){var c=0,a=performance.getEntriesByName(this.attachCount(s.DEFAULT_TIME_SOURCE),"resource");if(a?.length)if(a.length>1)console.warn("multiple resource entries found");else try{var e=a[0];c=e.requestStart-e.startTime,e.domainLookupEnd,e.domainLookupStart,e.secureConnectionStart,e.connectStart,e.requestStart,e.secureConnectionStart}catch(r){console.log(r)}else console.warn("no resource entry found"),window.RTS_DISABLE_CLEAR_RESOURCE_TIMINGS||performance.clearResourceTimings();return Math.max(0,c||0)},s.prototype.attachCount=function(c){return"".concat(c,"&count=").concat(this.random,"_").concat(this.attemptCount)},s.DEFAULT_TIME_SOURCE="https://time.akamai.com/?iso&ms",s.DEFAULT_ATTEMPT_INTERVAL=3e4,s.DEFAULT_ATTEMPT_RETRY_INTERVAL=5e3,s}();T.Clock=v},1698:function(j,T){var _=this&&this.__assign||function(){return _=Object.assign||function(d){for(var f,y=1,v=arguments.length;y<v;y++)for(var s in f=arguments[y])Object.prototype.hasOwnProperty.call(f,s)&&(d[s]=f[s]);return d},_.apply(this,arguments)};Object.defineProperty(T,"__esModule",{value:!0}),T.configProvider=void 0;var m=function(){function d(){this.context={},this.subscribers=new Set}return d.prototype.setContext=function(f){this.context=_(_({},this.context),f),this.notifySubscribers()},d.prototype.getContext=function(){return this.context},d.prototype.subscribe=function(f){var y=this;return this.subscribers.add(f),function(){return y.subscribers.delete(f)}},d.prototype.notifySubscribers=function(){var f=this;this.subscribers.forEach(function(y){return y(f.context)})},d}();T.configProvider=new m},5649:function(j,T,_){var m,d,f=this&&this.__assign||function(){return f=Object.assign||function(l){for(var A,R=1,C=arguments.length;R<C;R++)for(var g in A=arguments[R])Object.prototype.hasOwnProperty.call(A,g)&&(l[g]=A[g]);return l},f.apply(this,arguments)},y=this&&this.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(T,"__esModule",{value:!0}),T.CumuDelaySeiPayloadParser=T.CumuDelaySeiPayload=T.ECumuDelayGrtnKey=T.ECumuDelayPubSdkKey=T.ECumuDelayAVCommonKey=T.ECumuDelayVideoKey=T.ECumuDelayGrtnExportKey=T.ECumuDelaySubKey=T.CUMU_DELAY_UUID=T.CUMU_DELAY_SEI_PAYLOAD_TYPE=void 0;var v,s,c,a,e=y(_(7028));T.CUMU_DELAY_SEI_PAYLOAD_TYPE=99,T.CUMU_DELAY_UUID=[32,36,16,9,16,23,7,1,150,117,25,212,25,129,3,7],function(l){l.SophonAudioDual="sophon_audio_dual",l.SophonVideoCamera="sophon_video_camera",l.SophonVideoCameraSmall="sophon_video_camera_small",l.SophonVideoCameraSuper="sophon_video_camera_super",l.SophonVideoScreenShare="sophon_video_screen_share",l.SophonAudio="sophon_audio",l.SophonVideoCameraLarge="sophon_video_camera_large",l.RtsAudio="rts audio",l.RtsVideo="rts video"}(v||(v={})),function(l){l[l.Web=0]="Web",l[l.iOS=1]="iOS",l[l.Android=2]="Android"}(s||(s={})),function(l){l.VTotalCost="VTotalCost",l.VAssemblyCost="VAssemblyCost",l.VJitterBufferDelay="VJitterBufferDelay",l.VDecPlugCost="VDecPlugCost",l.DownRTTHalf="DownRTTHalf"}(c||(T.ECumuDelaySubKey=c={})),function(l){l.TOTAL_COST="TOTAL_COST",l.ENTER_GRTN_TIMESTAMP="ENTER_GRTN_TIMESTAMP",l.LEAVE_GRTN_TIMESTAMP="LEAVE_GRTN_TIMESTAMP"}(a||(T.ECumuDelayGrtnExportKey=a={}));var r,i,o,t,n,u,h,S=((m={})[v.SophonAudioDual]=4,m[v.SophonVideoCamera]=5,m[v.SophonVideoCameraSmall]=6,m[v.SophonVideoCameraSuper]=7,m[v.SophonVideoScreenShare]=8,m[v.SophonAudio]=9,m[v.SophonVideoCameraLarge]=10,m[v.RtsAudio]=11,m[v.RtsVideo]=12,m);(d={})[S[v.SophonAudioDual]]=v.SophonAudioDual,d[S[v.SophonVideoCamera]]=v.SophonVideoCamera,d[S[v.SophonVideoCameraSmall]]=v.SophonVideoCameraSmall,d[S[v.SophonVideoCameraSuper]]=v.SophonVideoCameraSuper,d[S[v.SophonVideoScreenShare]]=v.SophonVideoScreenShare,d[S[v.SophonAudio]]=v.SophonAudio,d[S[v.SophonVideoCameraLarge]]=v.SophonVideoCameraLarge,d[S[v.RtsAudio]]=v.RtsAudio,d[S[v.RtsVideo]]=v.RtsVideo,function(l){l[l.VTotalCost=4]="VTotalCost",l[l.CapDeviceCost=5]="CapDeviceCost",l[l.PushExtCost=6]="PushExtCost",l[l.CapPlugCost=7]="CapPlugCost",l[l.PrepThrCost=8]="PrepThrCost",l[l.PrepPlugCost=9]="PrepPlugCost",l[l.DispThrCost=10]="DispThrCost",l[l.DispPlugCost=11]="DispPlugCost",l[l.VEncThrCost=12]="VEncThrCost",l[l.VEncPlugCost=13]="VEncPlugCost"}(r||(T.ECumuDelayVideoKey=r={})),function(l){l[l.ATotalCost=24]="ATotalCost",l[l.ASourceCCost=25]="ASourceCCost",l[l.AMixerCost=26]="AMixerCost",l[l.AEncodeCCost=27]="AEncodeCCost",l[l.AAIClientQuestionTimestampHEAD=28]="AAIClientQuestionTimestampHEAD",l[l.AAIClientQuestionTimestampTAIL=29]="AAIClientQuestionTimestampTAIL",l[l.AAIClientAnswerTimestampHEAD=30]="AAIClientAnswerTimestampHEAD",l[l.AAIClientAnswerTimestampTAIL=31]="AAIClientAnswerTimestampTAIL",l[l.AAIClientScentenceId=32]="AAIClientScentenceId",l[l.AAIClientSourceCost=33]="AAIClientSourceCost",l[l.AAIClientMixerCost=34]="AAIClientMixerCost",l[l.AAIClientEncoderCost=35]="AAIClientEncoderCost",l[l.AAILinuxReceiveCost=36]="AAILinuxReceiveCost",l[l.AAILinuxNeteqCost=37]="AAILinuxNeteqCost",l[l.AAILinuxRemoteSourceCost=38]="AAILinuxRemoteSourceCost",l[l.AAILinuxPlayMixerCost=39]="AAILinuxPlayMixerCost",l[l.AAILinuxPlayCost=40]="AAILinuxPlayCost",l[l.AAIClientQuestionUidDigestHEAD=41]="AAIClientQuestionUidDigestHEAD",l[l.AAIClientQuestionUidDigestTAIL=42]="AAIClientQuestionUidDigestTAIL",l[l.AIClinetSmartDenoise=43]="AIClinetSmartDenoise"}(i||(i={})),function(l){l[l.NetsdkThrCost=44]="NetsdkThrCost",l[l.QosThrCost=45]="QosThrCost",l[l.PacerCost=46]="PacerCost",l[l.UpRTTHalf=47]="UpRTTHalf",l[l.AIClientNetsdkThrCost=48]="AIClientNetsdkThrCost",l[l.AIClientQosThrCost=49]="AIClientQosThrCost",l[l.AIClientPacerCost=50]="AIClientPacerCost",l[l.AIClientUpRTTHalf=51]="AIClientUpRTTHalf"}(o||(T.ECumuDelayAVCommonKey=o={})),function(l){l[l.AIAsrCost=64]="AIAsrCost",l[l.AILlmCost=65]="AILlmCost",l[l.AITtsCost=66]="AITtsCost",l[l.AIMuteCost=67]="AIMuteCost",l[l.AIAgentTotalCost=68]="AIAgentTotalCost",l[l.AIAgentExtraAvatarCost=69]="AIAgentExtraAvatarCost"}(t||(t={})),function(l){l[l.PubSdkType=100]="PubSdkType",l[l.PubSdkVersion=101]="PubSdkVersion"}(n||(T.ECumuDelayPubSdkKey=n={})),function(l){l[l.NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_INTERNAL_RTT_HALF=121]="NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_INTERNAL_RTT_HALF",l[l.NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_GRTN_NODE_BEF_PACER=122]="NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_GRTN_NODE_BEF_PACER",l[l.NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_GRTN_NODE_PACER_COST=123]="NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_GRTN_NODE_PACER_COST",l[l.NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_DOWN_RTT_HALF=124]="NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_DOWN_RTT_HALF"}(u||(T.ECumuDelayGrtnKey=u={})),function(l){l[l.AIGRTNInternalRTTHalf=104]="AIGRTNInternalRTTHalf",l[l.AIGRTNBeforePacer=105]="AIGRTNBeforePacer",l[l.AIGRTNPacerCost=106]="AIGRTNPacerCost",l[l.AIGRTNDownRTTHalf=107]="AIGRTNDownRTTHalf"}(h||(h={}));var x=function(l){l.msid=v.SophonAudio;var A=S[l.msid];A||console.warn("No mapped msid for cumuDelay",l.msid);var R=new ArrayBuffer(l.sendTs?8:4);if(l.sendTs){var C=Math.floor(performance.now()+performance.timeOrigin-l.windowTimeOrigin);C>=Math.pow(2,32)-1&&(C=0);var g=new DataView(R);g.setUint8(0,8),g.setUint8(1,0),g.setUint8(2,A),g.setUint8(3,5),g.setUint32(4,C)}else new Uint8Array(R).set([0,0,A,1]);l.kv[n.PubSdkType]=s.Web,l.kv[n.PubSdkVersion]=Number(e.default.version.split(".").join("").split("-")[0]);var D=Object.keys(l.kv).length;D>256&&console.warn("Too much kv");var O,U,k,w,N=1+3*D+1,H=new ArrayBuffer(N),F=new DataView(H);F.setInt8(0,D),Object.keys(l.kv).forEach(function(P,B){P in f(f(f({},r),o),n)||console.warn("Unknown CumuDelay key: ".concat(P));var W=l.kv[P],z=1+3*B;F.setUint8(z,parseInt(P)),F.setUint16(z+1,W)}),F.setUint8(N-1,128),this.buffer=(O=R,U=H,k=new ArrayBuffer(O.byteLength+U.byteLength),(w=new Uint8Array(k)).set(new Uint8Array(O),0),w.set(new Uint8Array(U),O.byteLength),k)};T.CumuDelaySeiPayload=x;var E=function(l){var A;this.pub={},this.grtn={},this.AIPub={},this.AISub={},this.AIAgent={},this.AIGrtn={},this.other={};var R,C,g=new b(l),D=(g.readBits(3),g.readBits()),O=g.readBits(),U=g.readBits(),k=g.readBits(),w=g.readBits();if(g.readBits(8),g.readBits(8),g.readBits(8),D===1&&g.readBits(16),O===1){var N=g.readBits(32);this.pub.timestamp=N,this.pub.timestampRecv=Math.floor(performance.now())}U===1&&g.readBits(16),k===1&&(R=g.readBits(32)),w===1&&(C=g.readBits(32)),R&&C&&(this.grtn=((A={})[a.TOTAL_COST]=C-R,A[a.ENTER_GRTN_TIMESTAMP]=R,A[a.LEAVE_GRTN_TIMESTAMP]=C,A));for(var H=g.readBits(8),F=0;F<H;F++){var P=g.readBits(8),B=g.readBits(16);if(p(P,[r.VTotalCost,r.VEncPlugCost])||p(P,[i.ATotalCost,i.AEncodeCCost])||p(P,[o.NetsdkThrCost,o.UpRTTHalf])||p(P,[n.PubSdkType,n.PubSdkVersion])){var W=r[P]||i[P]||o[P]||n[P];this.pub[W]=B}else if(p(P,[i.AAIClientQuestionTimestampHEAD,i.AAIClientEncoderCost])||p(P,[o.AIClientNetsdkThrCost,o.AIClientUpRTTHalf]))W=i[P]||o[P],this.AIPub[W]=B;else if(p(P,[i.AAILinuxReceiveCost,i.AIClinetSmartDenoise]))W=i[P],this.AISub[W]=B;else if(p(P,[t.AIAsrCost,t.AIAgentExtraAvatarCost]))W=t[P],this.AIAgent[W]=B;else if(p(P,[h.AIGRTNInternalRTTHalf,h.AIGRTNDownRTTHalf])){W=h[P];for(var z=0,G="".concat(W,"_").concat(z);this.AIGrtn.hasOwnProperty(G);)G="".concat(W,"_").concat(z++);this.AIGrtn[G]=B}else if(p(P,[u.NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_INTERNAL_RTT_HALF,u.NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_DOWN_RTT_HALF])){for(W=u[P],z=0,G="".concat(W,"_").concat(z);this.grtn.hasOwnProperty(G);)G="".concat(W,"_").concat(z++);this.grtn[G]=B}else this.other[P]=B}};function p(l,A){return l>=A[0]&&l<=A[1]}T.CumuDelaySeiPayloadParser=E;var b=function(){function l(A){this.byteOffset=0,this.bitOffset=0;var R=new Uint8Array(A);this.buffer=R}return l.prototype.readBits=function(A){A===void 0&&(A=1);for(var R=0,C=0;C<A;){if(this.byteOffset>=this.buffer.byteLength)throw new Error("readBits out of range");var g=8-this.bitOffset,D=Math.min(g,A-C);R=R<<D|this.getBitsFromByte(this.buffer,this.byteOffset,this.bitOffset,this.bitOffset+D-1),this.bitOffset+=D,C+=D,this.bitOffset===8&&(this.byteOffset++,this.bitOffset=0)}return A===32&&(R>>>=0),R},l.prototype.hasNext=function(){return this.byteOffset<this.buffer.byteLength},l.prototype.getBitsFromByte=function(A,R,C,g){if(R<0||R>=A.byteLength||C<0||g>7||C>g)throw new Error("Invalid parameters");return A[R]>>7-g&(1<<g-C+1)-1},l}()},102:(j,T)=>{Object.defineProperty(T,"__esModule",{value:!0});var _=function(){function m(){this._eventMap={}}return m.prototype.listeners=function(d){return this._eventMap[d]||[]},m.prototype.emit=function(d){for(var f=this,y=[],v=1;v<arguments.length;v++)y[v-1]=arguments[v];var s=this._eventMap[d];return!!Array.isArray(s)&&(s.forEach(function(c){return c.apply(f,y)}),!0)},m.prototype.off=function(d,f){var y=this._eventMap[d];return Array.isArray(y)&&(this._eventMap[d]=y.filter(function(v){return v!==f})),this},m.prototype.removeAllListeners=function(d){return d===void 0?this._eventMap={}:this._eventMap[d]&&(this._eventMap[d]=[]),this},m.prototype.on=function(d,f){return this._eventMap[d]?this._eventMap[d].push(f):this._eventMap[d]=[f],this},m.prototype.once=function(d,f){var y=this,v=function(){for(var s=[],c=0;c<arguments.length;c++)s[c]=arguments[c];y.off(d,v),f.apply(y,s)};return this.on(d,v),this},m}();T.default=_},492:(j,T)=>{Object.defineProperty(T,"__esModule",{value:!0}),T.MediaObserver=void 0;var _=function(){function m(d){this.timeout=d.timeout||m.DEFAULT_TIMEOUT,this.handler=d.handler||function(){},this.watchTimer=null}return Object.defineProperty(m.prototype,"actTimeout",{get:function(){return this.timeout},enumerable:!1,configurable:!0}),m.prototype.check=function(d,f,y,v){var s=this;this.hasNoData(d)?this.watchTimer||(this.watchTimer=window.setTimeout(function(){s.handler(f,y,v)},this.timeout)):this.watchTimer&&(clearTimeout(this.watchTimer),this.watchTimer=null)},m.prototype.hasNoData=function(d){return!d||(d.video?!(Number(d.video.bytesReceivedPerSecond)>0):!d.audio||!(Number(d.audio.bytesReceivedPerSecond)>0))},m.prototype.updateConfig=function(d){this.timeout=d.timeout||this.timeout,this.handler=d.handler||this.handler},m.prototype.reset=function(){this.watchTimer&&(clearTimeout(this.watchTimer),this.watchTimer=null)},m.prototype.dispose=function(){this.timeout=m.DEFAULT_TIMEOUT,this.handler=function(){},this.watchTimer&&(clearTimeout(this.watchTimer),this.watchTimer=null)},m.DEFAULT_TIMEOUT=6e3,m}();T.MediaObserver=_},9594:(j,T,_)=>{Object.defineProperty(T,"__esModule",{value:!0}),T.readUUID=T.discardEPB=T.insertEPB=T.SODBtoRBSP=T.convertPayloadSize=T.NALU=T.SEI=T.parseSei=T.insertSei=void 0;var m=_(5649);T.insertSei=function(v,s,c,a){c===void 0&&(c=5);for(var e=v.data,r=new DataView(e),i=0;;){if(r.getUint32(i)===1){r.getUint8(i+4);var o=new d(s,c,a).buffer,t=new f(o).buffer,n=new ArrayBuffer(t.byteLength+e.byteLength),u=new Uint8Array(n),h=new Uint8Array(t);u.set(h);var S=new Uint8Array(e);u.set(S,t.byteLength),v.data=n,i+=1;break}if((i+=1)+4>=r.byteLength)break}},T.parseSei=function(v){for(var s=[],c=new DataView(v),a=0;;){var e=a,r=c.getUint32(e);if(e+=4,r===1){if((31&c.getUint8(e++))===6){for(var i=c.getUint8(e++),o=y(i)?16:0,t=0;c.getUint8(e)==255;)e++,t+=255;if((t+=c.getUint8(e++))>0&&c.byteLength>e+t){var n=new Uint8Array(c.buffer),u="";if(y(i)){var h=n.slice(e,e+o);u=(0,T.readUUID)((0,T.discardEPB)(h))}var S=n.slice(e+o,e+t);e+=t,s.push({payloadType:i,uuid:u,data:S.buffer})}}a=e}else a+=1;if(a+4>=c.byteLength)break}return s};var d=function(v,s,c){s===void 0&&(s=5);var a=y(s)?16:0,e=v.byteLength+a,r=(0,T.convertPayloadSize)(e),i=r.buffer.byteLength,o=new ArrayBuffer(1+i+a+v.byteLength),t=new Uint8Array(o),n=0;if(t[n++]=s,t.set(r,n),n+=r.byteLength,y(s)){c=(c||"00000000-0000-0000-0000-000000000000").replace(/-/g,"");for(var u=0;u<16;u++)t[n+u]=parseInt(c.substr(2*u,2),16);n+=16}var h=new Uint8Array(v);t.set(h,n);var S=(0,T.SODBtoRBSP)(t);this.buffer=S.buffer};T.SEI=d;var f=function(v){var s=new Uint8Array([0,0,0,1]),c=new Uint8Array([6]),a=new ArrayBuffer(s.byteLength+c.byteLength+v.byteLength),e=new Uint8Array(a);e.set(s),e.set(c,s.byteLength),e.set(new Uint8Array(v),s.byteLength+c.byteLength),this.buffer=a};T.NALU=f,T.convertPayloadSize=function(v){if(v<=0)throw new Error("payloadSize must be a positive integer.");for(var s=Math.ceil(v/255),c=new ArrayBuffer(s),a=new DataView(c),e=0;e<s-1;e++)a.setUint8(e,255);return a.setUint8(s-1,v%255&255),new Uint8Array(c)},T.SODBtoRBSP=function(v){for(var s=new Uint8Array(v),c="",a=0;a<s.length;a++)c+=s[a].toString(2).padStart(8,"0");for(c+="1";c.length%8!=0;)c+="0";var e=c.length/8,r=new Uint8Array(e);for(a=0;a<e;a++)r[a]=parseInt(c.slice(8*a,8*a+8),2);return(0,T.insertEPB)(r)},T.insertEPB=function(v){for(var s=[],c=0,a=0;a<v.length;a++)s.push(v[a]),v[a]===0?++c===2&&a<v.length-1&&v[a+1]<=3&&(s.push(3),c=0):c=0;return new Uint8Array(s)},T.discardEPB=function(v){for(var s=v.byteLength,c=[],a=1;a<s-2;)v[a]===0&&v[a+1]===0&&v[a+2]===3?(c.push(a+2),a+=2):a++;if(c.length===0)return v;var e=s-c.length,r=new Uint8Array(e),i=0;for(a=0;a<e;i++,a++)i===c[0]&&(i++,c.shift()),r[a]=v[i];return r},T.readUUID=function(v){if(v.length!==16)throw new Error("UUID must be 16 bytes long.");var s=v.reduce(function(c,a){return c+a.toString(16).padStart(2,"0")},"");return"".concat(s.slice(0,8),"-").concat(s.slice(8,12),"-").concat(s.slice(12,16),"-").concat(s.slice(16,20),"-").concat(s.slice(20))};var y=function(v){return v===5||v===m.CUMU_DELAY_SEI_PAYLOAD_TYPE}},8219:function(j,T,_){var m=this&&this.__importDefault||function(f){return f&&f.__esModule?f:{default:f}};Object.defineProperty(T,"__esModule",{value:!0});var d=m(_(2505));T.default=d.default.create({baseURL:"",timeout:5e3,headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}})},4315:function(j,T,_){var m=this&&this.__spreadArray||function(v,s,c){if(c||arguments.length===2)for(var a,e=0,r=s.length;e<r;e++)!a&&e in s||(a||(a=Array.prototype.slice.call(s,0,e)),a[e]=s[e]);return v.concat(a||Array.prototype.slice.call(s))};Object.defineProperty(T,"__esModule",{value:!0}),T.SdpUtil=void 0;var d=_(233),f=function(){this.stramId="",this.audioTrackId="",this.videoTrackId="",this.screenTrackId="",this.customTrackId=""},y=function(){function v(s){this.sdpLines=new Array,this.localStream=s,this.publishStreamInfo=new f}return Object.defineProperty(v.prototype,"sdp",{get:function(){return this.sdpLines.join(`\r
157
- `)},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"videoTrackId",{get:function(){return this.publishStreamInfo.videoTrackId},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"screenTrackId",{get:function(){return this.publishStreamInfo.videoTrackId},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"videoName",{get:function(){return"rts video"},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"screenName",{get:function(){return"rts screen"},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"hasTcpCandidate",{get:function(){return this.sdpLines.some(function(s){return s.indexOf("tcptype")!==-1})},enumerable:!1,configurable:!0}),v.prototype.init=function(s){this.sdpLines=s.split(`\r
158
- `)},v.prototype.addNack=function(){for(var s=0;s<this.sdpLines.length;++s)if(this.sdpLines[s].indexOf("opus")!=-1&&this.sdpLines[s+1].indexOf("rtcp-fb")!=-1){var c=this.sdpLines[s+1].split(" ");c.length==2&&(this.sdpLines[s+2].indexOf("rtcp-fb")!=-1?this.sdpLines.splice(s+3,0,c[0]+" nack"):this.sdpLines.splice(s+2,0,c[0]+" nack"))}},v.prototype.parseCustomMsid=function(s){var c={stream:"",track:""};if(!s)return c;var a=s.trim().split(" ");return a.length==2?(c.stream=a[0],c.track=a[1]):c.track=a[0],c},v.prototype.modifyTrackName=function(s){s===void 0&&(s={});var c=s.vMsid,a=s.aMsid,e=c?this.parseCustomMsid(c):{stream:"rts",track:"video"},r=a?this.parseCustomMsid(a):{stream:"rts",track:"audio"},i="";if(this.localStream){this.publishStreamInfo.stramId=this.localStream.mediaStream.id,this.localStream.audioTrack&&(this.publishStreamInfo.audioTrackId=this.localStream.audioTrack.id,i=r.stream||"-"),this.localStream.videoTrack&&(this.publishStreamInfo.videoTrackId=this.localStream.videoTrack.id,i=e.stream||"-");for(var o=!1,t=!1,n=0;n<this.sdpLines.length;++n){var u=this.sdpLines[n],h=u.indexOf(this.publishStreamInfo.stramId);this.publishStreamInfo.stramId&&h!=-1&&(this.sdpLines[n]=this.sdpLines[n].replace(this.publishStreamInfo.stramId,i),d.BrowserUtil.isFirefox&&(o?this.sdpLines[n]=this.sdpLines[n].substring(0,h+i.length+1)+r.track:t&&(this.sdpLines[n]=this.sdpLines[n].substring(0,h+i.length+1)+e.track))),this.publishStreamInfo.audioTrackId&&u.indexOf(this.publishStreamInfo.audioTrackId)!=-1?this.sdpLines[n]=this.sdpLines[n].replace(this.publishStreamInfo.audioTrackId,r.track):this.publishStreamInfo.videoTrackId&&u.indexOf(this.publishStreamInfo.videoTrackId)!=-1&&(this.sdpLines[n]=this.sdpLines[n].replace(this.publishStreamInfo.videoTrackId,e.track)),u.indexOf("m=audio")!=-1?(o=!0,t=!1):u.indexOf("m=video")!=-1&&(t=!0,o=!1),u.indexOf("a=ssrc")!=-1&&(h=u.indexOf("cname:"))!==-1&&(o?this.sdpLines[n]=u.substr(0,h+6)+r.track:t&&(this.sdpLines[n]=u.substr(0,h+6)+e.track))}}},v.prototype.getPublishVideoSdp=function(){for(var s=-1,c=-1,a=!1,e=0;e<this.sdpLines.length;++e){if(a&&this.sdpLines[e].indexOf("m=application")>-1){c=e-1;break}if(this.sdpLines[e].indexOf("m=video")>-1){if(a){c=e-1;break}s=e}this.sdpLines[e].indexOf("rts video")>-1&&(a=!0)}return a?(c===-1&&(c=this.sdpLines.length-1),this.sdpLines.splice(s,c-s).join(`\r
159
- `)):""},v.prototype.removeVideoTrack=function(s){for(var c="rts "+s,a=-1,e=-1,r=!1,i=0;i<this.sdpLines.length;++i){if(r&&this.sdpLines[i].indexOf("m=application")>-1){e=i-1;break}if(this.sdpLines[i].indexOf("m=video")>-1){if(r){e=i-1;break}a=i}this.sdpLines[i].indexOf(c)>-1&&(r=!0)}return!!r&&(e===-1&&(e=this.sdpLines.length-1),this.sdpLines.splice(a,e-a),!0)},v.prototype.ios15PushHack=function(){var s=!1,c=-1;if(this.sdpLines.forEach(function(r,i){r.includes("m=video")&&(s=!0),s&&c===-1&&r.includes("a=")&&(c=i)}),c!==-1){var a=this.getExtmapIds(),e=Math.max.apply(Math,a)+1;this.sdpLines.splice(c,0,"a=extmap:".concat(e," urn:3gpp:video-orientation"))}},v.prototype.addSps=function(){this.sdpLines=this.sdpLines.map(function(s){return s.includes("a=fmtp:")&&s.includes("level-asymmetry-allowed")?s+=";sps-pps-idr-in-keyframe=1":s})},v.prototype.removeTwccRtcpFb=function(){this.sdpLines=this.sdpLines.filter(function(s){return!s.includes("http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01")})},v.prototype.removeUdpCandidate=function(){this.sdpLines=this.sdpLines.filter(function(s){return!s.includes("a=candidate:")||!s.includes("UDP")})},v.prototype.setDirection=function(s){s===void 0&&(s={direction:"recvonly"});var c=["sendonly","recvonly","sendrecv"].filter(function(r){return r!==s.direction}),a=!1,e=!1;this.sdpLines=this.sdpLines.map(function(r,i){if(r.includes("m=video"))a=!0,e=!1;else if(r.includes("m=audio"))e=!0,a=!1;else if(r.includes("m=application"))a=!1,e=!1;else if(a||e){var o;if(c.some(function(t){if(r.includes(t))return o=t,!0})&&o)return r.replace(o,s.direction)}return r})},v.prototype.removeSDES=function(){var s=["urn:ietf:params:rtp-hdrext:sdes:mid","urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id","urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id"];this.sdpLines=this.sdpLines.filter(function(c){return!s.some(function(a){return c.includes(a)})})},v.prototype.addStereo=function(){var s=this;this.getPayloadType("opus").map(this.getFmtpIndex.bind(this)).filter(function(c){return c!==void 0}).forEach(function(c){s.sdpLines[c].indexOf("stereo=1")>-1||(s.sdpLines[c]=s.sdpLines[c]+";stereo=1")})},v.prototype.setSingleNaluPackMode__legacy=function(){this.sdpLines=this.sdpLines.filter(function(s){return!s.includes("a=fmtp:")||!s.includes("packetization-mode=1")})},v.prototype.setSingleNaluPackMode=function(){var s=this,c=[],a=[],e=!1;if(this.sdpLines.forEach(function(u){if(u.includes("packetization-mode=0")&&(e=!0),u.includes("packetization-mode=1")){var h=s.parseFmtpValue(u);c.push(h||"NULL")}c.length&&new RegExp("apt=(".concat(c.join("|"),")")).test(u)&&(h=s.parseFmtpValue(u),a.push(h||"NULL"))}),!e)return!1;var r=m(m([],c,!0),a,!0).join("|"),i=new RegExp("(rtpmap|rtcp-fb|fmtp):.*?(".concat(r,")"));this.sdpLines=this.sdpLines.filter(function(u){return!i.test(u)});for(var o=0;o<this.sdpLines.length;o++){var t=this.sdpLines[o];if(t.includes("m=video")){var n=new RegExp("( ".concat(m(m([],c,!0),a,!0).join("| "),")"),"g");this.sdpLines[o]=t.replace(n,"");break}}return!0},v.prototype.dispose=function(){this.localStream&&(this.localStream=void 0),this.sdpLines=new Array,this.publishStreamInfo=new f},v.prototype.getExtmapIds=function(){return this.sdpLines.reduce(function(s,c){if(c.includes("a=extmap")){var a=Number(c.replace("a=extmap:","").split(" ")[0]);return m(m([],s,!0),[a],!1)}return s},[]).filter(function(s){return s})},v.prototype.getPayloadType=function(s){for(var c=[],a=new RegExp("a\\=rtpmap\\:(\\d+) ".concat(s,".*"),"i"),e=0;e<this.sdpLines.length;e++){var r=this.sdpLines[e],i=a.exec(r);i?.length&&c.push(i[1])}return c},v.prototype.getFmtpIndex=function(s){for(var c=new RegExp("a\\=fmtp\\:".concat(s," .*"),"i"),a=0;a<this.sdpLines.length;a++){var e=this.sdpLines[a];if(c.test(e))return a}},v.prototype.parseFmtpValue=function(s){var c=s.match(/a=fmtp:(\d+)/);return c?c[1]:null},v}();T.SdpUtil=y},7989:function(j,T,_){var m=this&&this.__awaiter||function(e,r,i,o){return new(i||(i=Promise))(function(t,n){function u(x){try{S(o.next(x))}catch(E){n(E)}}function h(x){try{S(o.throw(x))}catch(E){n(E)}}function S(x){var E;x.done?t(x.value):(E=x.value,E instanceof i?E:new i(function(p){p(E)})).then(u,h)}S((o=o.apply(e,r||[])).next())})},d=this&&this.__generator||function(e,r){var i,o,t,n,u={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return n={next:h(0),throw:h(1),return:h(2)},typeof Symbol=="function"&&(n[Symbol.iterator]=function(){return this}),n;function h(S){return function(x){return function(E){if(i)throw new TypeError("Generator is already executing.");for(;n&&(n=0,E[0]&&(u=0)),u;)try{if(i=1,o&&(t=2&E[0]?o.return:E[0]?o.throw||((t=o.return)&&t.call(o),0):o.next)&&!(t=t.call(o,E[1])).done)return t;switch(o=0,t&&(E=[2&E[0],t.value]),E[0]){case 0:case 1:t=E;break;case 4:return u.label++,{value:E[1],done:!1};case 5:u.label++,o=E[1],E=[0];continue;case 7:E=u.ops.pop(),u.trys.pop();continue;default:if(t=u.trys,!((t=t.length>0&&t[t.length-1])||E[0]!==6&&E[0]!==2)){u=0;continue}if(E[0]===3&&(!t||E[1]>t[0]&&E[1]<t[3])){u.label=E[1];break}if(E[0]===6&&u.label<t[1]){u.label=t[1],t=E;break}if(t&&u.label<t[2]){u.label=t[2],u.ops.push(E);break}t[2]&&u.ops.pop(),u.trys.pop();continue}E=r.call(e,u)}catch(p){E=[6,p],o=0}finally{i=t=0}if(5&E[0])throw E[1];return{value:E[0]?E[1]:void 0,done:!0}}([S,x])}}};Object.defineProperty(T,"__esModule",{value:!0}),T.SupportUtil=void 0;var f=_(233),y=_(3412),v=_(9428),s=_(2672),c=function(){this.errorCode=0,this.message=""},a=function(){function e(){this.deviceManager=new y.BrowserDeviceManager}return e.prototype.isSupport=function(r){var i=this;return new Promise(function(o,t){return m(i,void 0,void 0,function(){var n,u,h,S;return d(this,function(x){switch(x.label){case 0:return n=new c,this.checkWebRtcSupport()?r.onlyCheckUA?this.checkBrowser(n)?[3,3]:[2,t(n)]:[3,1]:(n.errorCode=v.ErrorCode.ERROR_NOTSUPPORT_WEBRTC,n.message=s.EN.MESSAGE_NOTSUPPORT_WEBRTC,[2,t(n)]);case 1:return[4,this.checkWebrtcAbilities()];case 2:if(u=x.sent(),h=u[0],u[1],u[2],S=u[3],!h)return n.errorCode=v.ErrorCode.ERROR_NOTSUPPORT_WEBRTC,n.message=s.EN.MESSAGE_NOTSUPPORT_WEBRTC,[2,t(n)];if(S)return n.errorCode=v.ErrorCode.ERROR_BROWSER_NOTSUPPORT,n.message=s.EN.MESSAGE_BROWSER_NOTSUPPORT,[2,t(n)];x.label=3;case 3:return r.isReceiveVideo?this.checkH264Decode(n).then(function(){o(n)}).catch(function(){t(n)}):o(n),[2]}})})})},e.prototype.checkEncodedTransformSupport=function(){var r=window.RTCRtpReceiver&&"createEncodedStreams"in RTCRtpReceiver.prototype,i=window.RTCRtpReceiver&&"transform"in RTCRtpReceiver.prototype&&"RTCRtpScriptTransform"in window;return r||i},e.prototype.checkWebrtcAbilities=function(r){return m(this,void 0,void 0,function(){var i,o,t,n,u,h,S,x,E;return d(this,function(p){switch(p.label){case 0:i=window.RTCPeerConnection,o=!1,t=!1,n=null,u=!1,p.label=1;case 1:return p.trys.push([1,4,,5]),i?(h=new i,t="createDataChannel"in h,r&&(S=this.createBlankStream()).getTracks().forEach(function(b){h?.addTrack(b,S)}),[4,h.createOffer({offerToReceiveAudio:!0,offerToReceiveVideo:!0,iceRestart:!0})]):[3,3];case 2:x=p.sent(),E=(x||{}).sdp,n=r?!!(E&&E.indexOf("a=sendrecv")>-1):null,h.close(),h=void 0,o=!0,p.label=3;case 3:return[3,5];case 4:return p.sent(),o=!1,t=!1,n=!1,[3,5];case 5:return u=this.checkBlackList(),[2,[o,t,n,u]]}})})},e.prototype.checkPublishSupport=function(){return m(this,void 0,void 0,function(){var r,i,o,t,n,u,h,S;return d(this,function(x){switch(x.label){case 0:return r={isWebRTCSupported:!1,isH264EncodeSupported:!1,isMediaDevicesSupported:!1,isScreenCaptureSupported:!1,isAudioMixSupported:!1,cameraList:[],micList:[],speakerList:[]},this.checkWebRtcSupport()?[3,1]:(r.isWebRTCSupported=!1,r.isH264EncodeSupported=!1,[3,5]);case 1:return[4,this.checkWebrtcAbilities(!0)];case 2:return i=x.sent(),o=i[0],i[1],t=i[2],r.isWebRTCSupported=!(!o||!t),r.isWebRTCSupported?[3,3]:(r.isH264EncodeSupported=!1,[3,5]);case 3:return n=r,[4,this.checkH264Encode()];case 4:n.isH264EncodeSupported=x.sent(),x.label=5;case 5:if(r.isMediaDevicesSupported=this.checkMediaDevices(),r.isScreenCaptureSupported=this.checkScreenCapture(),r.isAudioMixSupported=this.checkAudioMix(),!r.isMediaDevicesSupported)return[3,11];x.label=6;case 6:return x.trys.push([6,10,,11]),u=r,[4,this.deviceManager.getCameraList()];case 7:return u.cameraList=x.sent().filter(function(E){return E.deviceId}),h=r,[4,this.deviceManager.getMicList()];case 8:return h.micList=x.sent().filter(function(E){return E.deviceId}),S=r,[4,this.deviceManager.getSpeakerList()];case 9:return S.speakerList=x.sent().filter(function(E){return E.deviceId}),[3,11];case 10:return x.sent(),[3,11];case 11:return[2,r]}})})},e.prototype.checkWebRtcSupport=function(){return!!window.RTCPeerConnection},e.prototype.checkMediaDevices=function(){return!(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)},e.prototype.checkScreenCapture=function(){return!(!navigator.mediaDevices||!navigator.mediaDevices.getDisplayMedia)},e.prototype.checkAudioMix=function(){if(!window.AudioContext)return!1;var r=new AudioContext;return!!r.createMediaStreamDestination&&!!r.createMediaStreamSource},e.prototype.checkBlackList=function(){var r=!1;if(f.BrowserUtil.isOppoBrowser&&f.SystemUtil.isAndroid){var i=(this.getUa().toLowerCase().match(/heytapbrowser\/([\d.]+)/)||[])[1]||"";r=!this.compareVersion(i,"40.7.39.1")}else(f.BrowserUtil.isUCBrowser||f.BrowserUtil.isQuarkBrowser)&&f.SystemUtil.isIos?r=!0:f.BrowserUtil.isWebView&&f.SystemUtil.isAndroid&&(r=!(f.BrowserUtil.browserMainVersion>=79));return r},e.prototype.checkBrowser=function(r){if(f.SystemUtil.isIos){if(f.BrowserUtil.isUCBrowser||f.BrowserUtil.isQuarkBrowser)return r.errorCode=v.ErrorCode.ERROR_BROWSER_NOTSUPPORT,r.message=s.EN.MESSAGE_BROWSER_NOTSUPPORT,!1;if(f.BrowserUtil.isSafari||f.BrowserUtil.isQQBrowser)return f.BrowserUtil.browserMainVersion>=11||(r.errorCode=v.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=s.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(f.BrowserUtil.isEdge||f.BrowserUtil.isChrome)return f.BrowserUtil.browserMainVersion>=79||(r.errorCode=v.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=s.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(f.BrowserUtil.isMicroMessenger)return!!this.compareVersion(f.SystemUtil.systemVersion,"12.1.4")||(r.errorCode=v.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=s.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(f.BrowserUtil.isDingTalk)return!!f.SystemUtil.compareVersion("11.2.5")||(r.errorCode=v.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=s.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(f.BrowserUtil.isWebView)return!!this.compareVersion(f.SystemUtil.systemVersion,"14.3")||(r.errorCode=v.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=s.EN.MESSAGE_BROWSER_VERSIONLOW,!1)}else if(f.SystemUtil.isAndroid){if(this.checkPrivateUcWebview())return!0;if(f.BrowserUtil.isChrome||f.BrowserUtil.isQQBrowser||f.BrowserUtil.isHuaweiBrowser||f.BrowserUtil.isSamsungBrowser)return f.BrowserUtil.browserMainVersion>=63||(r.errorCode=v.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=s.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(f.BrowserUtil.isEdge)return f.BrowserUtil.browserMainVersion>=79||(r.errorCode=v.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=s.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(f.BrowserUtil.isMicroMessenger)return!!this.compareVersion(this.getChromeCoreVersion(),"63")||(r.errorCode=v.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=s.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(f.BrowserUtil.isDingTalk)return!!this.compareVersion(this.getChromeCoreVersion(),"69")||(r.errorCode=v.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=s.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(f.BrowserUtil.isOppoBrowser){var i=(this.getUa().toLowerCase().match(/heytapbrowser\/([\d.]+)/)||[])[1]||"";return!!this.compareVersion(i,"40.7.39.1")||(r.errorCode=v.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=s.EN.MESSAGE_BROWSER_VERSIONLOW,!1)}if(f.BrowserUtil.isX5Core)return!0;if(f.BrowserUtil.isWebView)return f.BrowserUtil.browserMainVersion>=79||(r.errorCode=v.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=s.EN.MESSAGE_BROWSER_VERSIONLOW,!1)}else if(f.SystemUtil.isMacOS){if(f.BrowserUtil.isElectron)return!0;if(f.BrowserUtil.isSafari)return f.BrowserUtil.browserMainVersion>=11||(r.errorCode=v.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=s.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(f.BrowserUtil.isChrome)return f.BrowserUtil.browserMainVersion>=63||(r.errorCode=v.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=s.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(f.BrowserUtil.isEdge)return f.BrowserUtil.browserMainVersion>=79||(r.errorCode=v.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=s.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(f.BrowserUtil.isFirefox)return f.BrowserUtil.browserMainVersion>=62||(r.errorCode=v.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=s.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(f.BrowserUtil.isOpera)return f.BrowserUtil.browserMainVersion>=15||(r.errorCode=v.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=s.EN.MESSAGE_BROWSER_VERSIONLOW,!1)}else if(f.SystemUtil.isWindows){if(f.BrowserUtil.isElectron||f.BrowserUtil.isMicroMessenger)return!0;if(f.BrowserUtil.isChrome||f.BrowserUtil.isQQBrowser)return f.BrowserUtil.browserMainVersion>=63||(r.errorCode=v.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=s.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(f.BrowserUtil.isEdge)return f.BrowserUtil.browserMainVersion>=79||(r.errorCode=v.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=s.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(f.BrowserUtil.isFirefox)return f.BrowserUtil.browserMainVersion>=62||(r.errorCode=v.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=s.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(f.BrowserUtil.isOpera)return f.BrowserUtil.browserMainVersion>=15||(r.errorCode=v.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=s.EN.MESSAGE_BROWSER_VERSIONLOW,!1)}else if(f.SystemUtil.isLinux){if(f.BrowserUtil.isChrome)return f.BrowserUtil.browserMainVersion>=63||(r.errorCode=v.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=s.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(f.BrowserUtil.isEdge)return f.BrowserUtil.browserMainVersion>=79||(r.errorCode=v.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=s.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(f.BrowserUtil.isFirefox)return f.BrowserUtil.browserMainVersion>=62||(r.errorCode=v.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=s.EN.MESSAGE_BROWSER_VERSIONLOW,!1)}return r.errorCode===0&&(r.errorCode=v.ErrorCode.ERROR_BROWSER_NOTSUPPORT,r.message=s.EN.MESSAGE_BROWSER_NOTSUPPORT),!1},e.prototype.checkH264Decode=function(r){var i=this;return new Promise(function(o,t){return m(i,void 0,void 0,function(){var n;return d(this,function(u){switch(u.label){case 0:return[4,this.tryFindH264FromSdp(r)];case 1:if(n=u.sent())return o(!0),[2];u.label=2;case 2:return u.trys.push([2,4,,5]),[4,this.loadH264(3)];case 3:return n=u.sent(),[3,5];case 4:return u.sent(),[3,5];case 5:return n?o(!0):(r&&r.errorCode===0&&(r.errorCode=v.ErrorCode.ERROR_NOTSUPPORT_H264,r.message=s.EN.MESSAGE_NOTSUPPORT_H264),t(!1)),[2]}})})})},e.prototype.checkSDPSupportH264=function(r){return r.indexOf("H264")>0||r.indexOf("h264")>0||r.indexOf("H.264")>0||r.indexOf("h.264")>0},e.prototype.checkPrivateUcWebview=function(){return this.getUa().indexOf("UniqueCode")>0},e.prototype.getUa=function(){return navigator&&navigator.userAgent||""},e.prototype.getChromeCoreVersion=function(){return(this.getUa().toLowerCase().match(/chrome\/([\d.]+)/)||[])[1]||""},e.prototype.compareVersion=function(r,i){r===void 0&&(r=""),i===void 0&&(i="");for(var o=(r||"").split("."),t=(i||"").split("."),n=0,u=0,h=0;h<o.length&&h<t.length;++h){if((n=isNaN(parseInt(o[h],10))?0:parseInt(o[h],10))<(u=isNaN(parseInt(t[h],10))?0:parseInt(t[h],10)))return!1;if(n>u)return!0}return!0},e.prototype.tryFindH264FromSdp=function(r){return m(this,void 0,void 0,function(){var i,o,t;return d(this,function(n){switch(n.label){case 0:if(i=!1,!RTCPeerConnection)return[2,i];o=new RTCPeerConnection,t=void 0,n.label=1;case 1:return n.trys.push([1,3,,4]),[4,o.createOffer({offerToReceiveVideo:!0,offerToReceiveAudio:!0})];case 2:return(t=n.sent())&&t.sdp&&(i=this.checkSDPSupportH264(t.sdp)),[3,4];case 3:return n.sent(),i=!1,r&&(r.errorCode=v.ErrorCode.ERROR_CREATEOFFER,r.message=s.EN.MESSAGE_CREATEOFFER),[3,4];case 4:return o.close(),o=void 0,[2,i]}})})},e.prototype.loadH264=function(r){var i=this;return new Promise(function(o,t){return m(i,void 0,void 0,function(){var n,u,h,S,x=this;return d(this,function(E){if(!f.SystemUtil.isAndroid||!f.BrowserUtil.isChrome&&!f.BrowserUtil.isWebView)return o(!1),[2];for(n=0,u=[],h=0;n<r;)S=setTimeout(function(){return m(x,void 0,void 0,function(){return d(this,function(p){switch(p.label){case 0:return h++,[4,this.tryFindH264FromSdp()];case 1:return p.sent()?(u.forEach(function(b){clearTimeout(b)}),u=[],o(!0),[2]):(h===r&&o(!1),[2])}})})},1e3*n),u.push(S),n++;return[2]})})})},e.prototype.checkH264Encode=function(){return m(this,void 0,void 0,function(){var r,i,o;return d(this,function(t){switch(t.label){case 0:return[4,this.loadH264(3)];case 1:return!(r=t.sent())&&RTCRtpSender&&RTCRtpSender.getCapabilities&&(i=JSON.stringify((o=RTCRtpSender.getCapabilities("video"))===null||o===void 0?void 0:o.codecs),r=i.toLowerCase().includes("video/h264")),[2,!!r]}})})},e.prototype.createBlankStream=function(){var r,i,o,t=(r=new AudioContext,i=r.createOscillator(),o=i.connect(r.createMediaStreamDestination()),i.start(),Object.assign(o.stream.getAudioTracks()[0],{enabled:!1}));t.stop();var n=function(u){var h,S={},x=S.width,E=x===void 0?160:x,p=S.height,b=p===void 0?90:p,l=document.createElement("canvas");l.width=E,l.height=b,(h=l.getContext("2d"))===null||h===void 0||h.fillRect(0,0,E,b);var A=l.captureStream();return Object.assign(A.getVideoTracks()[0],{enabled:!1})}();return n.stop(),new MediaStream([t,n])},e}();T.SupportUtil=a},2718:function(j,T){var _=this&&this.__spreadArray||function(m,d,f){if(f||arguments.length===2)for(var y,v=0,s=d.length;v<s;v++)!y&&v in d||(y||(y=Array.prototype.slice.call(d,0,v)),y[v]=d[v]);return m.concat(y||Array.prototype.slice.call(d))};Object.defineProperty(T,"__esModule",{value:!0}),T.hebtLog=T.createUUID=T.evaluateNetworkCondition=T.makeCancelable=T.hasVideoTrack=T.hasAudioTrack=T.getVideoTrack=T.getAudioTrack=T.pruneSubUrl=T.getJitterBufferDelayAvg=void 0,T.lowercaseFirstLetter=function(m){return m.replace(/([A-Za-z])/,function(d){return d.toLowerCase()})},T.underlineToCamelCase=function(m){return m.replace(/_([a-z])/g,function(d,f){return f.toUpperCase()})},T.getJitterBufferDelayAvg=function(m,d){return m&&d?Number(m)/Number(d)*1e3:-1},T.pruneSubUrl=function(m,d){var f=m||"";return f=f.replace("@subaudio=no","").replace("@subvideo=no",""),d&&(f=f.split("?")[0]),f},T.getAudioTrack=function(m){return m.getAudioTracks()[0]},T.getVideoTrack=function(m){return m.getVideoTracks()[0]},T.hasAudioTrack=function(m){return m.getAudioTracks().length>0},T.hasVideoTrack=function(m){return m.getVideoTracks().length>0},T.makeCancelable=function(m){var d=!1;return{promise:new Promise(function(f,y){m.then(function(v){return d?y({isCanceled:!0}):f(v)}),m.catch(function(v){return y(d?{isCanceled:!0}:v)})}),cancel:function(){d=!0}}},T.evaluateNetworkCondition=function(m,d,f,y,v){var s=0;if(!navigator.onLine)return s=6;var c=[{loss:0,rtt:0,jbd:1},{loss:0,rtt:1,jbd:0},{loss:0,rtt:.5,jbd:.5},{loss:1,rtt:0,jbd:0},{loss:.8,rtt:0,jbd:.2},{loss:.8,rtt:.2,jbd:0},{loss:.6,rtt:.2,jbd:.2}],a=-1,e=-1,r=-1;if(typeof d=="number"&&d>=0||typeof f=="number"&&f>=0){a=0;var i=!1,o=!1;typeof d=="number"&&d>=0&&(a+=d,i=!0),typeof f=="number"&&f>=0&&(a+=f,o=!0),i&&!o&&(a*=2),o&&!i&&(a*=1.8)}typeof m=="number"&&m>=0&&(r=m),(typeof y=="number"&&y>=0||typeof v=="number"&&v>=0)&&(e=0,typeof y=="number"&&y>=0&&(e+=y),typeof v=="number"&&v>=0&&(e+=v));var t;if((t=4*(a!==-1?1:0)+2*(r!==-1?1:0)+(e!==-1?1:0))>0){var n=1.2*a*c[t-1].loss+r/1500*c[t-1].rtt+e/3e3*c[t-1].jbd;s=n<=.1?1:n<=.23?2:n<=.36?3:n<=.49?4:5}else s=0;return s},T.createUUID=function(m,d){var f,y="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),v=[];if(d=d||y.length,m)for(f=0;f<m;f++)v[f]=y[0|Math.random()*d];else{var s=void 0;for(v[8]=v[13]=v[18]=v[23]="-",v[14]="4",f=0;f<36;f++)v[f]||(s=0|16*Math.random(),v[f]=y[f==19?3&s|8:s])}return v.join("")},T.hebtLog=function(){for(var m=[],d=0;d<arguments.length;d++)m[d]=arguments[d];window.RTS_HEBT_DEBUG&&console.log.apply(console,_(["[rts hebt]"],m,!1))}},233:j=>{/*! useragent-util - ver 1.3.1 created:9/4/2024, 4:31:28 PM */j.exports=(()=>{var T={622:(f,y,v)=>{Object.defineProperty(y,"__esModule",{value:!0}),y.BrowserUtil=y.BrowserType=void 0;var s,c=v(101);(function(e){e.IE="IE",e.Chrome="Chrome",e.Safari="Safari",e.Firefox="Firefox",e.Opera="Opera",e.Edge="Edge",e.MicroMessenger="MicroMessenger",e.X5Core="X5Core",e.Quark="Quark",e.QQ="QQ",e.QQBrowser="QQBrowser",e.DingTalk="DingTalk",e.Electron="Electron",e.Sogou="Sogou",e.Vivo="VivoBrowser",e.Oppo="OppoBrowser",e.UC="UCBrowser",e.MI="MiBrowser",e.Lenovo="SLBrowser",e.Maxthon="Maxthon",e.Liebao="Liebao",e.Huawei="Huawei",e.Meizu="MZBrowser",e.Finger="FingerBrowser",e.Samsung="SamsungBrowser",e.WebVeiw="WebVeiw",e.Unknown="unknown"})(s=y.BrowserType||(y.BrowserType={}));var a=function(){function e(){}return Object.defineProperty(e,"isBrowser",{get:function(){return typeof document<"u"},enumerable:!1,configurable:!0}),Object.defineProperty(e,"domain",{get:function(){return window.location.protocol+window.location.host},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isHttps",{get:function(){return this.isBrowser&&document.location&&(document.location.protocol=="https:"||document.location.host.indexOf("127.0.0.1:")===0||document.location.host.indexOf("localhost:")===0)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isSupportScreenShare",{get:function(){return!!(navigator&&navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isChrome",{get:function(){return e._getBrowserInfo(),s.Chrome===e._browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isSafari",{get:function(){return e._getBrowserInfo(),s.Safari===e._browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isIE",{get:function(){return e._getBrowserInfo(),s.IE===e._browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isFirefox",{get:function(){return e._getBrowserInfo(),s.Firefox===e._browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isEdge",{get:function(){return e._getBrowserInfo(),s.Edge===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isSogou",{get:function(){return e._getBrowserInfo(),s.Sogou===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isVivoBroswer",{get:function(){return e._getBrowserInfo(),s.Vivo===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isOppoBrowser",{get:function(){return e._getBrowserInfo(),s.Oppo===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isMiBrowser",{get:function(){return e._getBrowserInfo(),s.MI===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isLenovoBrowser",{get:function(){return e._getBrowserInfo(),s.Lenovo===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isMaxthonBrowser",{get:function(){return e._getBrowserInfo(),s.Maxthon===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isLiebaoBrowser",{get:function(){return e._getBrowserInfo(),s.Liebao===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isHuaweiBrowser",{get:function(){return e._getBrowserInfo(),s.Huawei===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isMZBrowser",{get:function(){return e._getBrowserInfo(),s.Meizu===e._browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isSamsungBrowser",{get:function(){return e._getBrowserInfo(),s.Samsung===e._browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isOpera",{get:function(){return e._getBrowserInfo(),s.Opera===e._browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isMicroMessenger",{get:function(){return e._getBrowserInfo(),e._browserName===s.MicroMessenger},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isQQ",{get:function(){return e._getBrowserInfo(),s.QQ===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isQQBrowser",{get:function(){return e._getBrowserInfo(),s.QQBrowser===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isX5Core",{get:function(){return e._getBrowserInfo(),e._browserName===s.X5Core},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isUCBrowser",{get:function(){return e._getBrowserInfo(),e._browserName===s.UC},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isQuarkBrowser",{get:function(){return e._getBrowserInfo(),e._browserName===s.Quark},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isFingerBrowser",{get:function(){return e._getBrowserInfo(),e._browserName===s.Finger},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isChromeCore",{get:function(){return e._getBrowserInfo(),e._core==="Chrome"},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isWebView",{get:function(){return e._getBrowserInfo(),e._browserName===s.WebVeiw},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isDingTalk",{get:function(){return e._getBrowserInfo(),e._browserName===s.DingTalk},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isUnknown",{get:function(){return e._getBrowserInfo(),s.Unknown===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"browserName",{get:function(){return e._getBrowserInfo(),e._browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"browserVersion",{get:function(){return e._getBrowserInfo(),e._browserVersion},enumerable:!1,configurable:!0}),Object.defineProperty(e,"browserMainVersion",{get:function(){return e._getBrowserInfo(),e._browserVersion?parseInt(e._browserVersion.split(".")[0],10):0},enumerable:!1,configurable:!0}),Object.defineProperty(e,"browserCoreVersion",{get:function(){return navigator.userAgent.toLowerCase(),c.SystemUtil.isIos||c.SystemUtil.isMacOS,e.browserMainVersion},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isElectron",{get:function(){return e._getBrowserInfo(),s.Electron===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"userAgent",{get:function(){var r=navigator.userAgent.toLowerCase(),i=r.indexOf("gecko");if(i>-1){i=r.indexOf(" ",i);var o=(r=r.substring(i+1,r.length)).split(" ");r="";for(var t=0;t<o.length;++t){var n=o[t].split("/");n&&n.length&&(r+=n[0]+" ")}}return r},enumerable:!1,configurable:!0}),e.compareVersion=function(r){if(e._getBrowserInfo(),e._browserVersion){for(var i=e._browserVersion.split("."),o=r.split("."),t=0,n=0,u=0;u<i.length&&u<o.length;++u){if((t=isNaN(parseInt(i[u],10))?0:parseInt(i[u],10))<(n=isNaN(parseInt(o[u],10))?0:parseInt(o[u],10)))return!1;if(t>n)return!0}return!0}return!0},e._getBrowserInfo=function(){if(!e._browserName||!e._browserVersion)if(navigator&&navigator.userAgent){var r=navigator.userAgent.toLowerCase(),i=void 0;(i=r.match(/edg[e|a]?\/([\d.]+)/))||(i=r.match(/edgios\/([\d.]+)/))?e._updateBrowserInfo(s.Edge,r,i[1]):(i=r.match(/rv:([\d.]+)\) like gecko/))||(i=r.match(/msie ([\d.]+)/))?e._updateBrowserInfo(s.IE,r,i[1]):(i=r.match(/vivobrowser\/([\d.]+)/))?e._updateBrowserInfo(s.Vivo,r,i[1]):(i=r.match(/miuibrowser\/([\d.]+)/))?e._updateBrowserInfo(s.MI,r,i[1]):(i=r.match(/samsungbrowser\/([\d.]+)/))?e._updateBrowserInfo(s.Samsung,r,i[1]):(i=r.match(/heytapbrowser\/([\d.]+)/))?e._updateBrowserInfo(s.Oppo,r,i[1]):(i=r.match(/mzbrowser\/([\d.]+)/))?e._updateBrowserInfo(s.Meizu,r,i[1]):(i=r.match(/ucbrowser\/([\d.]+)/))?e._updateBrowserInfo(s.UC,r,i[1]):(i=r.match(/quark\/([\d.]+)/))?e._updateBrowserInfo(s.Quark,r,i[1]):(i=r.match(/slbrowser\/([\d.]+)/))?e._updateBrowserInfo(s.Lenovo,r,i[1]):(i=r.match(/lbbrowser\/([\d.]+)/))?e._updateBrowserInfo(s.Liebao,r,i[1]):(i=r.match(/fingerbrowser\/([\d.]+)/))?e._updateBrowserInfo(s.Finger,r,i[1]):(i=r.match(/huaweibrowser\/([\d.]+)/))?e._updateBrowserInfo(s.Huawei,r,i[1]):(i=r.match(/maxthon\/([\d.]+)/))?e._updateBrowserInfo(s.Maxthon,r,i[1]):(i=r.match(/firefox\/([\d.]+)/))?e._updateBrowserInfo(s.Firefox,r,i[1]):(i=r.match(/electron\/([\d.]+)/))?e._updateBrowserInfo(s.Electron,r,i[1]):(i=r.match(/chrome\/([\d.]+)/))&&this._isChrome(r)||(i=r.match(/crios\/([\d.]+)/))&&this._isChrome(r)?e._updateBrowserInfo(s.Chrome,r,i[1]):(i=r.match(/metasr\s([\d.]+)/))||(i=r.match(/sogoumobilebrowser\/([\d.]+)/))?e._updateBrowserInfo(s.Sogou,r,i[1]):(i=r.match(/opr.([\d.]+)/))?e._updateBrowserInfo(s.Opera,r,i[1]):(i=r.match(/micromessenger.([\d.]+)/))?e._updateBrowserInfo(s.MicroMessenger,r,i[1]):(i=r.match(/qq\/([\d.]+)/))?e._updateBrowserInfo(s.QQ,r,i[1]):(i=r.match(/m?qqbrowser\/([\d.]+)/))||(i=r.match(/qqbrowserlite\/([\d.]+)/))?e._updateBrowserInfo(s.QQBrowser,r,i[1]):(i=r.match(/dingtalk.([\d.]+)/))?e._updateBrowserInfo(s.DingTalk,r,i[1]):(i=r.match(/tbs\/([\d.]+)/))?e._updateBrowserInfo(s.X5Core,r,i[1]):(i=r.match(/version\/([\d.]+).*safari/))&&this._isSafari(r)&&e._updateBrowserInfo(s.Safari,r,i[1]),e._browserName===s.Unknown&&e._isWebview(r)&&e._updateBrowserInfo(s.WebVeiw,r,"")}else e._browserName=s.Unknown,e._browserVersion="0.0"},e._isChrome=function(r){var i=r.split(/\(|\)/);if(e._core="Chrome",i.length===5){var o=i[4].trim().split(" ");if(o.length===2){if(o[0].indexOf("chrome")>-1&&o[1].indexOf("safari")>-1)return!0}else if(o.length===3){if(o[1].indexOf("mobile")>-1&&o[2].indexOf("safari")>-1&&(o[0].indexOf("chrome")>-1||o[0].indexOf("crios")>-1))return!0}else if(r.indexOf("qianniu")>-1)return!0}return!1},e._isSafari=function(r){var i=r.split(/\(|\)/);if(i.length===5){var o=i[4].trim().split(" ");if(o.length===2){if(o[0].indexOf("version")>-1&&o[1].indexOf("safari")>-1)return!0}else if(o.length===3&&o[0].indexOf("version")>-1&&o[1].indexOf("mobile")>-1&&o[2].indexOf("safari")>-1)return!0}return!1},e._isWebview=function(r){if(r){var i=new RegExp("("+["WebView","(iPhone|iPod|iPad)(?!.*Safari)","Android.*(wv|.0.0.0)","Linux; U; Android"].join("|")+")","ig"),o=new RegExp("("+["VivoBrowser","MZBrowser","MiuiBrowser"].join("|")+")","ig");return!!r.match(i)&&!r.match(o)}},e._updateBrowserInfo=function(r,i,o){e._browserName=r;var t=null;switch(r){case s.QQBrowser:c.SystemUtil.isIos||c.SystemUtil.isMacOS?(t=i.match(/version\/([\d.]+).*safari/),e._browserVersion=t?t[1]:"0.0"):(t=i.match(/chrome\/([\d.]+)/),e._browserVersion=t?t[1]:"0.0");break;case s.Vivo:case s.Oppo:case s.Meizu:case s.Huawei:case s.Sogou:case s.Samsung:t=i.match(/chrome\/([\d.]+)/),e._browserVersion=t?t[1]:"0.0";break;case s.WebVeiw:c.SystemUtil.isAndroid?(t=i.match(/chrome\/([\d.]+)/),e._browserVersion=t?t[1]:"0.0"):c.SystemUtil.isIos&&(e._browserVersion=c.SystemUtil.systemVersion);break;default:e._browserVersion=o}},e._browserName=s.Unknown,e._browserVersion="",e._core="",e}();y.BrowserUtil=a},864:(f,y)=>{Object.defineProperty(y,"__esModule",{value:!0}),y.Guid=void 0;var v=function(){function s(){}return s.create=function(c,a){a===void 0&&(a=16);var e,r,i="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),o=[];if(a=a||i.length,c)for(e=0;e<c;e++)o[e]=i[0|Math.random()*a];else for(o[8]=o[13]=o[18]=o[23]="-",o[14]="4",e=0;e<36;e++)o[e]||(r=0|16*Math.random(),o[e]=i[e==19?3&r|8:r]);return o.join("")},s}();y.Guid=v},442:(f,y,v)=>{Object.defineProperty(y,"__esModule",{value:!0}),y.LocalStorage=void 0;var s=v(864),c=function(){function a(){}return Object.defineProperty(a,"uuid",{get:function(){var e="alirtc_uuid",r=a.get(e);return r||(r=s.Guid.create(32),a.set(e,r)),r},enumerable:!1,configurable:!0}),a.get=function(e){var r="";return window&&window.localStorage&&(r=window.localStorage.getItem(e)||""),r},a.set=function(e,r){e&&window&&window.localStorage&&window.localStorage.setItem(e,r)},a}();y.LocalStorage=c},72:(f,y)=>{Object.defineProperty(y,"__esModule",{value:!0}),y.ApiRequest=void 0;var v=function(){function s(){}return s.postBody=function(c,a,e){c=s._getUrl(c,a);var r,i={};return i.headers||(i.headers={}),i.headers.Accept="application/json",i.headers["Content-Type"]="application/json",new Promise(function(o,t){s.requestBody("POST",c,e).then(function(n){return r=n,n.ok?n.json():n.text()}).then(function(n){r.ok?n.code?(n=s._intercept(n),t(n)):o(n.data):t(s._httpErrorMessage(r,n))}).catch(function(n){n=s._httpErrorMessage(n),t(n)})})},s.get=function(c,a,e){var r;return e===void 0&&(e={}),c=s._getUrl(c,a),e.headers||(e.headers={}),e.headers["Content-Type"]="application/json",new Promise(function(i,o){s.request("GET",c,e).then(function(t){return r=t,t.ok?t.json():t.text()}).then(function(t){r.ok?t.code?(t=s._intercept(t),o(t)):i(t.data):o(s._httpErrorMessage(r,t))}).catch(function(t){t=s._httpErrorMessage(t),o(t)})})},s.post=function(c,a,e,r){var i;return r===void 0&&(r={}),c=s._getUrl(c,a),r.headers||(r.headers={}),r.body=e,r.headers.Accept="application/json",r.headers["Content-Type"]="application/json",new Promise(function(o,t){s.request("POST",c,r).then(function(n){return i=n,n.ok?n.json():n.text()}).then(function(n){i.ok?n.code?(n=s._intercept(n),t(n)):o(n.data):t(s._httpErrorMessage(i,n))}).catch(function(n){n=s._httpErrorMessage(n),t(n)})})},s.request=function(c,a,e){c===void 0&&(c="GET");var r=new Headers(e.headers),i=new Request(a,{method:c,headers:r});return fetch(i)},s.requestBody=function(c,a,e){return c===void 0&&(c="GET"),fetch(a,{method:c,body:e,headers:new Headers({"Content-Type":"application/json"})})},s.ajaxPost=function(c,a,e,r){return r===void 0&&(r={}),c=s._getUrl(c,a),r.headers||(r.headers={}),r.headers.Accept="application/json",r.headers["Content-Type"]="application/json",s.ajax("POST",c,e,r)},s.ajax=function(c,a,e,r){c===void 0&&(c="GET"),r===void 0&&(r={});var i=new XMLHttpRequest;return new Promise(function(o,t){i.onreadystatechange=function(){if(i.readyState===4)if(i.status===200){var u=JSON.parse(i.responseText);u.code?(u=s._intercept(u),t(u)):o(u)}else t({message:i.responseText||"\u8BF7\u6C42\u5931\u8D25:"+a})},i.open(c,a,!0);try{if(r.withCredentials&&(i.withCredentials=!0),r.headers)for(var n in r.headers)i.setRequestHeader(n,r.headers[n])}catch(u){return void t(u)}try{i.send(e)}catch(u){t(u)}})},s._getUrl=function(c,a){var e=[];if(a)for(var r in a)e.push(r+"="+a[r]);var i=e.join("&");return(c.indexOf("?")!=-1?c:c+"?")+i},s._httpErrorMessage=function(c,a){return c.message||(c.message="HTTP "+c.status+"("+c.statusText+") : "+a),c},s._intercept=function(c){var a=c.data;return c.code&&((a=a||{}).data=c.data,a.code=c.code,a.description=c.description,a.message="0x"+Number(c.code).toString(16)+", "+c.description,a.tid&&(a.message+=", tid="+a.tid)),a},s}();y.ApiRequest=v},101:(f,y)=>{var v,s;Object.defineProperty(y,"__esModule",{value:!0}),y.SystemUtil=y.WindowsType=y.SystemType=void 0,function(a){a.Unknown="Unknown",a.MacOS="Mac",a.Windows="Windows",a.Android="Android",a.Iphone="iphone",a.Ipad="ipad",a.iOS="iOS",a.Linux="Linux",a.ChromeOS="ChromeOS"}(v=y.SystemType||(y.SystemType={})),function(a){a.Windows10="Windows 10",a.Windows7="Windows 7",a.WindowsVista="Windows vista",a.WindowsXP="Windows xp"}(s=y.WindowsType||(y.WindowsType={}));var c=function(){function a(){}return Object.defineProperty(a,"isMacOS",{get:function(){return v.MacOS===a.systemName},enumerable:!1,configurable:!0}),Object.defineProperty(a,"isWindows",{get:function(){return a.systemName.indexOf(v.Windows)>-1},enumerable:!1,configurable:!0}),Object.defineProperty(a,"isIos",{get:function(){return v.Iphone===a.systemName||v.Ipad===a.systemName},enumerable:!1,configurable:!0}),Object.defineProperty(a,"isAndroid",{get:function(){return v.Android===a.systemName},enumerable:!1,configurable:!0}),Object.defineProperty(a,"isLinux",{get:function(){return v.Linux===a.systemName||v.Linux===a._platform},enumerable:!1,configurable:!0}),Object.defineProperty(a,"systemName",{get:function(){return a._getSystemInfo(),a._systemName},enumerable:!1,configurable:!0}),Object.defineProperty(a,"systemVersion",{get:function(){return a._getSystemInfo(),a._systemVersion},enumerable:!1,configurable:!0}),Object.defineProperty(a,"platform",{get:function(){return a._getSystemInfo(),a._platform},enumerable:!1,configurable:!0}),Object.defineProperty(a,"isUnknown",{get:function(){return!a.platform||a.platform===v.Unknown},enumerable:!1,configurable:!0}),a.compareVersion=function(e){if(a._getSystemInfo(),a._systemVersion){for(var r=a._systemVersion.split("."),i=e.split("."),o=0,t=0,n=0;n<r.length&&n<i.length;++n){if((o=isNaN(parseInt(r[n],10))?0:parseInt(r[n],10))<(t=isNaN(parseInt(i[n],10))?0:parseInt(i[n],10)))return!1;if(o>t)return!0}return!0}return!0},a._getSystemInfo=function(){if(!a._systemName||!a._systemVersion||!a._platform)if(navigator&&navigator.userAgent){var e=navigator.userAgent.toLowerCase();e.indexOf("ipad")>-1?(a._systemName=v.Ipad,a._platform=v.iOS,a._systemVersion=a._getIosSystemVersion(e)):e.indexOf("iphone")>-1?(a._systemName=v.Iphone,a._platform=v.iOS,a._systemVersion=a._getIosSystemVersion(e)):e.indexOf("android")>-1?(a._platform=v.Android,a._systemName=v.Android,a._systemVersion=a._getAndroidSystemVersion(e)):e.indexOf("win")>-1?e.indexOf("windwos nt 10")>-1||e.indexOf("windows 10")?(a._systemName=s.Windows10,a._platform=v.Windows,a._systemVersion="10"):e.indexOf("windows nt 6.1")>-1||e.indexOf("windows 7")>-1?(a._systemName=s.Windows7,a._platform=v.Windows,a._systemVersion="7"):e.indexOf("windows nt 6.0")>-1||e.indexOf("windows vista")>-1?(a._systemName=s.WindowsVista,a._platform=v.Windows,a._systemVersion="vista"):e.indexOf("widows nt 5.1")>-1||e.indexOf("windows xp")>-1?(a._systemName=s.WindowsXP,a._platform=v.Windows,a._systemVersion="xp"):(a._platform=v.Windows,a._systemName=v.Windows,a._systemVersion="0.0"):e.indexOf("mac")>-1?navigator&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0?(a._systemName=v.Ipad,a._platform=v.iOS,a._systemVersion=a._getIosSystemVersion(e)):(a._platform=v.MacOS,a._systemName=v.MacOS,a._systemVersion=a._getMacSystemVersion(e)):e.indexOf("linux")>-1?(a._platform=v.Linux,a._systemName=v.Linux,a._systemVersion="0.0"):e.indexOf("cros")>-1?(a._platform=v.Linux,a._systemName=v.ChromeOS,a._systemVersion="0.0"):(a._systemName=v.Unknown,a._platform=v.Windows,a._systemVersion="0.0")}else a._systemName=v.Unknown,a._platform=v.Unknown,a._systemVersion="0.0"},a._getIosSystemVersion=function(e){return(e.match(/OS [\d._]*/gi)+"").replace(/[^0-9|_.]/gi,"").replace(/_/gi,".")},a._getMacSystemVersion=function(e){return(e.match(/OS X [\d._]*/gi)+"").replace(/[^0-9|_.]/gi,"").replace(/_/gi,".")},a._getAndroidSystemVersion=function(e){return e.substr(e.indexOf("android")+8,e.indexOf(";",e.indexOf("android"))-e.indexOf("android")-8)},a._systemName="",a._systemVersion="",a._platform=v.Unknown,a}();y.SystemUtil=c}},_={};function m(f){if(_[f])return _[f].exports;var y=_[f]={exports:{}};return T[f](y,y.exports,m),y.exports}var d={};return(()=>{var f=d;Object.defineProperty(f,"__esModule",{value:!0}),f.ApiRequest=f.LocalStorage=f.Guid=f.BrowserUtil=f.SystemUtil=void 0;var y=m(101);Object.defineProperty(f,"SystemUtil",{enumerable:!0,get:function(){return y.SystemUtil}});var v=m(622);Object.defineProperty(f,"BrowserUtil",{enumerable:!0,get:function(){return v.BrowserUtil}});var s=m(864);Object.defineProperty(f,"Guid",{enumerable:!0,get:function(){return s.Guid}});var c=m(442);Object.defineProperty(f,"LocalStorage",{enumerable:!0,get:function(){return c.LocalStorage}});var a=m(72);Object.defineProperty(f,"ApiRequest",{enumerable:!0,get:function(){return a.ApiRequest}}),window&&(window.SystemUtil=y.SystemUtil,window.BrowserUtil=v.BrowserUtil,window.Guid=s.Guid,window.LocalStorage=c.LocalStorage,window.ApiRequest=a.ApiRequest)})(),d})()},9543:(j,T,_)=>{_.r(T),_.d(T,{default:()=>Ae});var m={};_.r(m),_.d(m,{fixNegotiationNeeded:()=>U,shimAddTrackRemoveTrack:()=>D,shimAddTrackRemoveTrackWithNative:()=>g,shimGetDisplayMedia:()=>p,shimGetSendersWithDtmf:()=>A,shimGetStats:()=>R,shimGetUserMedia:()=>E,shimMediaStream:()=>b,shimOnTrack:()=>l,shimPeerConnection:()=>O,shimSenderReceiverGetStats:()=>C});var d={};_.r(d),_.d(d,{shimGetDisplayMedia:()=>H,shimGetUserMedia:()=>N,shimPeerConnection:()=>F,shimReplaceTrack:()=>P});var f={};_.r(f),_.d(f,{shimAddTransceiver:()=>ce,shimCreateAnswer:()=>pe,shimCreateOffer:()=>ue,shimGetDisplayMedia:()=>W,shimGetParameters:()=>se,shimGetUserMedia:()=>B,shimOnTrack:()=>z,shimPeerConnection:()=>G,shimRTCDataChannel:()=>ie,shimReceiverGetStats:()=>re,shimRemoveStream:()=>te,shimSenderGetStats:()=>J});var y={};_.r(y),_.d(y,{shimAudioContext:()=>Te,shimCallbacksAPI:()=>Ee,shimConstraints:()=>me,shimCreateOfferLegacy:()=>Re,shimGetUserMedia:()=>fe,shimLocalStreamsAPI:()=>de,shimRTCIceServerUrls:()=>ge,shimRemoteStreamsAPI:()=>ve,shimTrackEventTransceiver:()=>be});var v={};_.r(v),_.d(v,{removeExtmapAllowMixed:()=>Pe,shimAddIceCandidateNullOrEmpty:()=>ke,shimConnectionState:()=>Me,shimMaxMessageSize:()=>Ce,shimRTCIceCandidate:()=>De,shimSendThrowTypeError:()=>Oe});let s=!0,c=!0;function a(I,K,q){const X=I.match(K);return X&&X.length>=q&&parseInt(X[q],10)}function e(I,K,q){if(!I.RTCPeerConnection)return;const X=I.RTCPeerConnection.prototype,Z=X.addEventListener;X.addEventListener=function($,oe){if($!==K)return Z.apply(this,arguments);const ne=ae=>{const le=q(ae);le&&(oe.handleEvent?oe.handleEvent(le):oe(le))};return this._eventMap=this._eventMap||{},this._eventMap[K]||(this._eventMap[K]=new Map),this._eventMap[K].set(oe,ne),Z.apply(this,[$,ne])};const ee=X.removeEventListener;X.removeEventListener=function($,oe){if($!==K||!this._eventMap||!this._eventMap[K])return ee.apply(this,arguments);if(!this._eventMap[K].has(oe))return ee.apply(this,arguments);const ne=this._eventMap[K].get(oe);return this._eventMap[K].delete(oe),this._eventMap[K].size===0&&delete this._eventMap[K],Object.keys(this._eventMap).length===0&&delete this._eventMap,ee.apply(this,[$,ne])},Object.defineProperty(X,"on"+K,{get(){return this["_on"+K]},set($){this["_on"+K]&&(this.removeEventListener(K,this["_on"+K]),delete this["_on"+K]),$&&this.addEventListener(K,this["_on"+K]=$)},enumerable:!0,configurable:!0})}function r(I){return typeof I!="boolean"?new Error("Argument type: "+typeof I+". Please use a boolean."):(s=I,I?"adapter.js logging disabled":"adapter.js logging enabled")}function i(I){return typeof I!="boolean"?new Error("Argument type: "+typeof I+". Please use a boolean."):(c=!I,"adapter.js deprecation warnings "+(I?"disabled":"enabled"))}function o(){if(typeof window=="object"){if(s)return;typeof console<"u"&&typeof console.log=="function"&&console.log.apply(console,arguments)}}function t(I,K){c&&console.warn(I+" is deprecated, please use "+K+" instead.")}function n(I){return Object.prototype.toString.call(I)==="[object Object]"}function u(I){return n(I)?Object.keys(I).reduce(function(K,q){const X=n(I[q]),Z=X?u(I[q]):I[q],ee=X&&!Object.keys(Z).length;return Z===void 0||ee?K:Object.assign(K,{[q]:Z})},{}):I}function h(I,K,q){K&&!q.has(K.id)&&(q.set(K.id,K),Object.keys(K).forEach(X=>{X.endsWith("Id")?h(I,I.get(K[X]),q):X.endsWith("Ids")&&K[X].forEach(Z=>{h(I,I.get(Z),q)})}))}function S(I,K,q){const X=q?"outbound-rtp":"inbound-rtp",Z=new Map;if(K===null)return Z;const ee=[];return I.forEach($=>{$.type==="track"&&$.trackIdentifier===K.id&&ee.push($)}),ee.forEach($=>{I.forEach(oe=>{oe.type===X&&oe.trackId===$.id&&h(I,oe,Z)})}),Z}const x=o;function E(I,K){const q=I&&I.navigator;if(!q.mediaDevices)return;const X=function($){if(typeof $!="object"||$.mandatory||$.optional)return $;const oe={};return Object.keys($).forEach(ne=>{if(ne==="require"||ne==="advanced"||ne==="mediaSource")return;const ae=typeof $[ne]=="object"?$[ne]:{ideal:$[ne]};ae.exact!==void 0&&typeof ae.exact=="number"&&(ae.min=ae.max=ae.exact);const le=function(he,Se){return he?he+Se.charAt(0).toUpperCase()+Se.slice(1):Se==="deviceId"?"sourceId":Se};if(ae.ideal!==void 0){oe.optional=oe.optional||[];let he={};typeof ae.ideal=="number"?(he[le("min",ne)]=ae.ideal,oe.optional.push(he),he={},he[le("max",ne)]=ae.ideal,oe.optional.push(he)):(he[le("",ne)]=ae.ideal,oe.optional.push(he))}ae.exact!==void 0&&typeof ae.exact!="number"?(oe.mandatory=oe.mandatory||{},oe.mandatory[le("",ne)]=ae.exact):["min","max"].forEach(he=>{ae[he]!==void 0&&(oe.mandatory=oe.mandatory||{},oe.mandatory[le(he,ne)]=ae[he])})}),$.advanced&&(oe.optional=(oe.optional||[]).concat($.advanced)),oe},Z=function($,oe){if(K.version>=61)return oe($);if(($=JSON.parse(JSON.stringify($)))&&typeof $.audio=="object"){const ne=function(ae,le,he){le in ae&&!(he in ae)&&(ae[he]=ae[le],delete ae[le])};ne(($=JSON.parse(JSON.stringify($))).audio,"autoGainControl","googAutoGainControl"),ne($.audio,"noiseSuppression","googNoiseSuppression"),$.audio=X($.audio)}if($&&typeof $.video=="object"){let ne=$.video.facingMode;ne=ne&&(typeof ne=="object"?ne:{ideal:ne});const ae=K.version<66;if(ne&&(ne.exact==="user"||ne.exact==="environment"||ne.ideal==="user"||ne.ideal==="environment")&&(!q.mediaDevices.getSupportedConstraints||!q.mediaDevices.getSupportedConstraints().facingMode||ae)){let le;if(delete $.video.facingMode,ne.exact==="environment"||ne.ideal==="environment"?le=["back","rear"]:ne.exact!=="user"&&ne.ideal!=="user"||(le=["front"]),le)return q.mediaDevices.enumerateDevices().then(he=>{let Se=(he=he.filter(We=>We.kind==="videoinput")).find(We=>le.some(Fe=>We.label.toLowerCase().includes(Fe)));return!Se&&he.length&&le.includes("back")&&(Se=he[he.length-1]),Se&&($.video.deviceId=ne.exact?{exact:Se.deviceId}:{ideal:Se.deviceId}),$.video=X($.video),x("chrome: "+JSON.stringify($)),oe($)})}$.video=X($.video)}return x("chrome: "+JSON.stringify($)),oe($)},ee=function($){return K.version>=64?$:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[$.name]||$.name,message:$.message,constraint:$.constraint||$.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(q.getUserMedia=function($,oe,ne){Z($,ae=>{q.webkitGetUserMedia(ae,oe,le=>{ne&&ne(ee(le))})})}.bind(q),q.mediaDevices.getUserMedia){const $=q.mediaDevices.getUserMedia.bind(q.mediaDevices);q.mediaDevices.getUserMedia=function(oe){return Z(oe,ne=>$(ne).then(ae=>{if(ne.audio&&!ae.getAudioTracks().length||ne.video&&!ae.getVideoTracks().length)throw ae.getTracks().forEach(le=>{le.stop()}),new DOMException("","NotFoundError");return ae},ae=>Promise.reject(ee(ae))))}}}function p(I,K){I.navigator.mediaDevices&&"getDisplayMedia"in I.navigator.mediaDevices||I.navigator.mediaDevices&&(typeof K=="function"?I.navigator.mediaDevices.getDisplayMedia=function(q){return K(q).then(X=>{const Z=q.video&&q.video.width,ee=q.video&&q.video.height,$=q.video&&q.video.frameRate;return q.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:X,maxFrameRate:$||3}},Z&&(q.video.mandatory.maxWidth=Z),ee&&(q.video.mandatory.maxHeight=ee),I.navigator.mediaDevices.getUserMedia(q)})}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}function b(I){I.MediaStream=I.MediaStream||I.webkitMediaStream}function l(I){if(typeof I=="object"&&I.RTCPeerConnection&&!("ontrack"in I.RTCPeerConnection.prototype)){Object.defineProperty(I.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(q){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=q)},enumerable:!0,configurable:!0});const K=I.RTCPeerConnection.prototype.setRemoteDescription;I.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=q=>{q.stream.addEventListener("addtrack",X=>{let Z;Z=I.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find($=>$.track&&$.track.id===X.track.id):{track:X.track};const ee=new Event("track");ee.track=X.track,ee.receiver=Z,ee.transceiver={receiver:Z},ee.streams=[q.stream],this.dispatchEvent(ee)}),q.stream.getTracks().forEach(X=>{let Z;Z=I.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find($=>$.track&&$.track.id===X.id):{track:X};const ee=new Event("track");ee.track=X,ee.receiver=Z,ee.transceiver={receiver:Z},ee.streams=[q.stream],this.dispatchEvent(ee)})},this.addEventListener("addstream",this._ontrackpoly)),K.apply(this,arguments)}}else e(I,"track",K=>(K.transceiver||Object.defineProperty(K,"transceiver",{value:{receiver:K.receiver}}),K))}function A(I){if(typeof I=="object"&&I.RTCPeerConnection&&!("getSenders"in I.RTCPeerConnection.prototype)&&"createDTMFSender"in I.RTCPeerConnection.prototype){const K=function(Z,ee){return{track:ee,get dtmf(){return this._dtmf===void 0&&(ee.kind==="audio"?this._dtmf=Z.createDTMFSender(ee):this._dtmf=null),this._dtmf},_pc:Z}};if(!I.RTCPeerConnection.prototype.getSenders){I.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const Z=I.RTCPeerConnection.prototype.addTrack;I.RTCPeerConnection.prototype.addTrack=function($,oe){let ne=Z.apply(this,arguments);return ne||(ne=K(this,$),this._senders.push(ne)),ne};const ee=I.RTCPeerConnection.prototype.removeTrack;I.RTCPeerConnection.prototype.removeTrack=function($){ee.apply(this,arguments);const oe=this._senders.indexOf($);oe!==-1&&this._senders.splice(oe,1)}}const q=I.RTCPeerConnection.prototype.addStream;I.RTCPeerConnection.prototype.addStream=function(Z){this._senders=this._senders||[],q.apply(this,[Z]),Z.getTracks().forEach(ee=>{this._senders.push(K(this,ee))})};const X=I.RTCPeerConnection.prototype.removeStream;I.RTCPeerConnection.prototype.removeStream=function(Z){this._senders=this._senders||[],X.apply(this,[Z]),Z.getTracks().forEach(ee=>{const $=this._senders.find(oe=>oe.track===ee);$&&this._senders.splice(this._senders.indexOf($),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 K=I.RTCPeerConnection.prototype.getSenders;I.RTCPeerConnection.prototype.getSenders=function(){const q=K.apply(this,[]);return q.forEach(X=>X._pc=this),q},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 R(I){if(!I.RTCPeerConnection)return;const K=I.RTCPeerConnection.prototype.getStats;I.RTCPeerConnection.prototype.getStats=function(){const[q,X,Z]=arguments;if(arguments.length>0&&typeof q=="function")return K.apply(this,arguments);if(K.length===0&&(arguments.length===0||typeof q!="function"))return K.apply(this,[]);const ee=function(oe){const ne={};return oe.result().forEach(ae=>{const le={id:ae.id,timestamp:ae.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[ae.type]||ae.type};ae.names().forEach(he=>{le[he]=ae.stat(he)}),ne[le.id]=le}),ne},$=function(oe){return new Map(Object.keys(oe).map(ne=>[ne,oe[ne]]))};if(arguments.length>=2){const oe=function(ne){X($(ee(ne)))};return K.apply(this,[oe,q])}return new Promise((oe,ne)=>{K.apply(this,[function(ae){oe($(ee(ae)))},ne])}).then(X,Z)}}function C(I){if(!(typeof I=="object"&&I.RTCPeerConnection&&I.RTCRtpSender&&I.RTCRtpReceiver))return;if(!("getStats"in I.RTCRtpSender.prototype)){const q=I.RTCPeerConnection.prototype.getSenders;q&&(I.RTCPeerConnection.prototype.getSenders=function(){const Z=q.apply(this,[]);return Z.forEach(ee=>ee._pc=this),Z});const X=I.RTCPeerConnection.prototype.addTrack;X&&(I.RTCPeerConnection.prototype.addTrack=function(){const Z=X.apply(this,arguments);return Z._pc=this,Z}),I.RTCRtpSender.prototype.getStats=function(){const Z=this;return this._pc.getStats().then(ee=>S(ee,Z.track,!0))}}if(!("getStats"in I.RTCRtpReceiver.prototype)){const q=I.RTCPeerConnection.prototype.getReceivers;q&&(I.RTCPeerConnection.prototype.getReceivers=function(){const X=q.apply(this,[]);return X.forEach(Z=>Z._pc=this),X}),e(I,"track",X=>(X.receiver._pc=X.srcElement,X)),I.RTCRtpReceiver.prototype.getStats=function(){const X=this;return this._pc.getStats().then(Z=>S(Z,X.track,!1))}}if(!("getStats"in I.RTCRtpSender.prototype)||!("getStats"in I.RTCRtpReceiver.prototype))return;const K=I.RTCPeerConnection.prototype.getStats;I.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof I.MediaStreamTrack){const q=arguments[0];let X,Z,ee;return this.getSenders().forEach($=>{$.track===q&&(X?ee=!0:X=$)}),this.getReceivers().forEach($=>($.track===q&&(Z?ee=!0:Z=$),$.track===q)),ee||X&&Z?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):X?X.getStats():Z?Z.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return K.apply(this,arguments)}}function g(I){I.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(ee=>this._shimmedLocalStreams[ee][0])};const K=I.RTCPeerConnection.prototype.addTrack;I.RTCPeerConnection.prototype.addTrack=function(ee,$){if(!$)return K.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const oe=K.apply(this,arguments);return this._shimmedLocalStreams[$.id]?this._shimmedLocalStreams[$.id].indexOf(oe)===-1&&this._shimmedLocalStreams[$.id].push(oe):this._shimmedLocalStreams[$.id]=[$,oe],oe};const q=I.RTCPeerConnection.prototype.addStream;I.RTCPeerConnection.prototype.addStream=function(ee){this._shimmedLocalStreams=this._shimmedLocalStreams||{},ee.getTracks().forEach(ne=>{if(this.getSenders().find(ae=>ae.track===ne))throw new DOMException("Track already exists.","InvalidAccessError")});const $=this.getSenders();q.apply(this,arguments);const oe=this.getSenders().filter(ne=>$.indexOf(ne)===-1);this._shimmedLocalStreams[ee.id]=[ee].concat(oe)};const X=I.RTCPeerConnection.prototype.removeStream;I.RTCPeerConnection.prototype.removeStream=function(ee){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[ee.id],X.apply(this,arguments)};const Z=I.RTCPeerConnection.prototype.removeTrack;I.RTCPeerConnection.prototype.removeTrack=function(ee){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},ee&&Object.keys(this._shimmedLocalStreams).forEach($=>{const oe=this._shimmedLocalStreams[$].indexOf(ee);oe!==-1&&this._shimmedLocalStreams[$].splice(oe,1),this._shimmedLocalStreams[$].length===1&&delete this._shimmedLocalStreams[$]}),Z.apply(this,arguments)}}function D(I,K){if(!I.RTCPeerConnection)return;if(I.RTCPeerConnection.prototype.addTrack&&K.version>=65)return g(I);const q=I.RTCPeerConnection.prototype.getLocalStreams;I.RTCPeerConnection.prototype.getLocalStreams=function(){const ne=q.apply(this);return this._reverseStreams=this._reverseStreams||{},ne.map(ae=>this._reverseStreams[ae.id])};const X=I.RTCPeerConnection.prototype.addStream;I.RTCPeerConnection.prototype.addStream=function(ne){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},ne.getTracks().forEach(ae=>{if(this.getSenders().find(le=>le.track===ae))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[ne.id]){const ae=new I.MediaStream(ne.getTracks());this._streams[ne.id]=ae,this._reverseStreams[ae.id]=ne,ne=ae}X.apply(this,[ne])};const Z=I.RTCPeerConnection.prototype.removeStream;function ee(ne,ae){let le=ae.sdp;return Object.keys(ne._reverseStreams||[]).forEach(he=>{const Se=ne._reverseStreams[he],We=ne._streams[Se.id];le=le.replace(new RegExp(We.id,"g"),Se.id)}),new RTCSessionDescription({type:ae.type,sdp:le})}I.RTCPeerConnection.prototype.removeStream=function(ne){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},Z.apply(this,[this._streams[ne.id]||ne]),delete this._reverseStreams[this._streams[ne.id]?this._streams[ne.id].id:ne.id],delete this._streams[ne.id]},I.RTCPeerConnection.prototype.addTrack=function(ne,ae){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const le=[].slice.call(arguments,1);if(le.length!==1||!le[0].getTracks().find(Se=>Se===ne))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(Se=>Se.track===ne))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const he=this._streams[ae.id];if(he)he.addTrack(ne),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const Se=new I.MediaStream([ne]);this._streams[ae.id]=Se,this._reverseStreams[Se.id]=ae,this.addStream(Se)}return this.getSenders().find(Se=>Se.track===ne)},["createOffer","createAnswer"].forEach(function(ne){const ae=I.RTCPeerConnection.prototype[ne],le={[ne](){const he=arguments;return arguments.length&&typeof arguments[0]=="function"?ae.apply(this,[Se=>{const We=ee(this,Se);he[0].apply(null,[We])},Se=>{he[1]&&he[1].apply(null,Se)},arguments[2]]):ae.apply(this,arguments).then(Se=>ee(this,Se))}};I.RTCPeerConnection.prototype[ne]=le[ne]});const $=I.RTCPeerConnection.prototype.setLocalDescription;I.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=function(ne,ae){let le=ae.sdp;return Object.keys(ne._reverseStreams||[]).forEach(he=>{const Se=ne._reverseStreams[he],We=ne._streams[Se.id];le=le.replace(new RegExp(Se.id,"g"),We.id)}),new RTCSessionDescription({type:ae.type,sdp:le})}(this,arguments[0]),$.apply(this,arguments)):$.apply(this,arguments)};const oe=Object.getOwnPropertyDescriptor(I.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(I.RTCPeerConnection.prototype,"localDescription",{get(){const ne=oe.get.apply(this);return ne.type===""?ne:ee(this,ne)}}),I.RTCPeerConnection.prototype.removeTrack=function(ne){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!ne._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(ne._pc!==this)throw new DOMException("Sender was not created by this connection.","InvalidAccessError");let ae;this._streams=this._streams||{},Object.keys(this._streams).forEach(le=>{this._streams[le].getTracks().find(he=>ne.track===he)&&(ae=this._streams[le])}),ae&&(ae.getTracks().length===1?this.removeStream(this._reverseStreams[ae.id]):ae.removeTrack(ne.track),this.dispatchEvent(new Event("negotiationneeded")))}}function O(I,K){!I.RTCPeerConnection&&I.webkitRTCPeerConnection&&(I.RTCPeerConnection=I.webkitRTCPeerConnection),I.RTCPeerConnection&&K.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(q){const X=I.RTCPeerConnection.prototype[q],Z={[q](){return arguments[0]=new(q==="addIceCandidate"?I.RTCIceCandidate:I.RTCSessionDescription)(arguments[0]),X.apply(this,arguments)}};I.RTCPeerConnection.prototype[q]=Z[q]})}function U(I,K){e(I,"negotiationneeded",q=>{const X=q.target;if(!(K.version<72||X.getConfiguration&&X.getConfiguration().sdpSemantics==="plan-b")||X.signalingState==="stable")return q})}var k=_(6677),w=_.n(k);function N(I){const K=I&&I.navigator,q=K.mediaDevices.getUserMedia.bind(K.mediaDevices);K.mediaDevices.getUserMedia=function(X){return q(X).catch(Z=>Promise.reject(function(ee){return{name:{PermissionDeniedError:"NotAllowedError"}[ee.name]||ee.name,message:ee.message,constraint:ee.constraint,toString(){return this.name}}}(Z)))}}function H(I){"getDisplayMedia"in I.navigator&&I.navigator.mediaDevices&&(I.navigator.mediaDevices&&"getDisplayMedia"in I.navigator.mediaDevices||(I.navigator.mediaDevices.getDisplayMedia=I.navigator.getDisplayMedia.bind(I.navigator)))}function F(I,K){if(I.RTCIceGatherer&&(I.RTCIceCandidate||(I.RTCIceCandidate=function(X){return X}),I.RTCSessionDescription||(I.RTCSessionDescription=function(X){return X}),K.version<15025)){const X=Object.getOwnPropertyDescriptor(I.MediaStreamTrack.prototype,"enabled");Object.defineProperty(I.MediaStreamTrack.prototype,"enabled",{set(Z){X.set.call(this,Z);const ee=new Event("enabled");ee.enabled=Z,this.dispatchEvent(ee)}})}I.RTCRtpSender&&!("dtmf"in I.RTCRtpSender.prototype)&&Object.defineProperty(I.RTCRtpSender.prototype,"dtmf",{get(){return this._dtmf===void 0&&(this.track.kind==="audio"?this._dtmf=new I.RTCDtmfSender(this):this.track.kind==="video"&&(this._dtmf=null)),this._dtmf}}),I.RTCDtmfSender&&!I.RTCDTMFSender&&(I.RTCDTMFSender=I.RTCDtmfSender);const q=w()(I,K.version);I.RTCPeerConnection=function(X){return X&&X.iceServers&&(X.iceServers=function(Z){let ee=!1;return(Z=JSON.parse(JSON.stringify(Z))).filter($=>{if($&&($.urls||$.url)){let oe=$.urls||$.url;$.url&&!$.urls&&t("RTCIceServer.url","RTCIceServer.urls");const ne=typeof oe=="string";return ne&&(oe=[oe]),oe=oe.filter(ae=>{if(ae.indexOf("stun:")===0)return!1;const le=ae.startsWith("turn")&&!ae.startsWith("turn:[")&&ae.includes("transport=udp");return le&&!ee?(ee=!0,!0):le&&!ee}),delete $.url,$.urls=ne?oe[0]:oe,!!oe.length}})}(X.iceServers,K.version),o("ICE servers after filtering:",X.iceServers)),new q(X)},I.RTCPeerConnection.prototype=q.prototype}function P(I){I.RTCRtpSender&&!("replaceTrack"in I.RTCRtpSender.prototype)&&(I.RTCRtpSender.prototype.replaceTrack=I.RTCRtpSender.prototype.setTrack)}function B(I,K){const q=I&&I.navigator,X=I&&I.MediaStreamTrack;if(q.getUserMedia=function(Z,ee,$){t("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),q.mediaDevices.getUserMedia(Z).then(ee,$)},!(K.version>55&&"autoGainControl"in q.mediaDevices.getSupportedConstraints())){const Z=function($,oe,ne){oe in $&&!(ne in $)&&($[ne]=$[oe],delete $[oe])},ee=q.mediaDevices.getUserMedia.bind(q.mediaDevices);if(q.mediaDevices.getUserMedia=function($){return typeof $=="object"&&typeof $.audio=="object"&&($=JSON.parse(JSON.stringify($)),Z($.audio,"autoGainControl","mozAutoGainControl"),Z($.audio,"noiseSuppression","mozNoiseSuppression")),ee($)},X&&X.prototype.getSettings){const $=X.prototype.getSettings;X.prototype.getSettings=function(){const oe=$.apply(this,arguments);return Z(oe,"mozAutoGainControl","autoGainControl"),Z(oe,"mozNoiseSuppression","noiseSuppression"),oe}}if(X&&X.prototype.applyConstraints){const $=X.prototype.applyConstraints;X.prototype.applyConstraints=function(oe){return this.kind==="audio"&&typeof oe=="object"&&(oe=JSON.parse(JSON.stringify(oe)),Z(oe,"autoGainControl","mozAutoGainControl"),Z(oe,"noiseSuppression","mozNoiseSuppression")),$.apply(this,[oe])}}}}function W(I,K){I.navigator.mediaDevices&&"getDisplayMedia"in I.navigator.mediaDevices||I.navigator.mediaDevices&&(I.navigator.mediaDevices.getDisplayMedia=function(q){if(!q||!q.video){const X=new DOMException("getDisplayMedia without video constraints is undefined");return X.name="NotFoundError",X.code=8,Promise.reject(X)}return q.video===!0?q.video={mediaSource:K}:q.video.mediaSource=K,I.navigator.mediaDevices.getUserMedia(q)})}function z(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 G(I,K){if(typeof I!="object"||!I.RTCPeerConnection&&!I.mozRTCPeerConnection)return;!I.RTCPeerConnection&&I.mozRTCPeerConnection&&(I.RTCPeerConnection=I.mozRTCPeerConnection),K.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(Z){const ee=I.RTCPeerConnection.prototype[Z],$={[Z](){return arguments[0]=new(Z==="addIceCandidate"?I.RTCIceCandidate:I.RTCSessionDescription)(arguments[0]),ee.apply(this,arguments)}};I.RTCPeerConnection.prototype[Z]=$[Z]});const q={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},X=I.RTCPeerConnection.prototype.getStats;I.RTCPeerConnection.prototype.getStats=function(){const[Z,ee,$]=arguments;return X.apply(this,[Z||null]).then(oe=>{if(K.version<53&&!ee)try{oe.forEach(ne=>{ne.type=q[ne.type]||ne.type})}catch(ne){if(ne.name!=="TypeError")throw ne;oe.forEach((ae,le)=>{oe.set(le,Object.assign({},ae,{type:q[ae.type]||ae.type}))})}return oe}).then(ee,$)}}function J(I){if(typeof I!="object"||!I.RTCPeerConnection||!I.RTCRtpSender||I.RTCRtpSender&&"getStats"in I.RTCRtpSender.prototype)return;const K=I.RTCPeerConnection.prototype.getSenders;K&&(I.RTCPeerConnection.prototype.getSenders=function(){const X=K.apply(this,[]);return X.forEach(Z=>Z._pc=this),X});const q=I.RTCPeerConnection.prototype.addTrack;q&&(I.RTCPeerConnection.prototype.addTrack=function(){const X=q.apply(this,arguments);return X._pc=this,X}),I.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function re(I){if(typeof I!="object"||!I.RTCPeerConnection||!I.RTCRtpSender||I.RTCRtpSender&&"getStats"in I.RTCRtpReceiver.prototype)return;const K=I.RTCPeerConnection.prototype.getReceivers;K&&(I.RTCPeerConnection.prototype.getReceivers=function(){const q=K.apply(this,[]);return q.forEach(X=>X._pc=this),q}),e(I,"track",q=>(q.receiver._pc=q.srcElement,q)),I.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function te(I){I.RTCPeerConnection&&!("removeStream"in I.RTCPeerConnection.prototype)&&(I.RTCPeerConnection.prototype.removeStream=function(K){t("removeStream","removeTrack"),this.getSenders().forEach(q=>{q.track&&K.getTracks().includes(q.track)&&this.removeTrack(q)})})}function ie(I){I.DataChannel&&!I.RTCDataChannel&&(I.RTCDataChannel=I.DataChannel)}function ce(I){if(typeof I!="object"||!I.RTCPeerConnection)return;const K=I.RTCPeerConnection.prototype.addTransceiver;K&&(I.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];const q=arguments[1],X=q&&"sendEncodings"in q;X&&q.sendEncodings.forEach(ee=>{if("rid"in ee&&!/^[a-z0-9]{0,16}$/i.test(ee.rid))throw new TypeError("Invalid RID value provided.");if("scaleResolutionDownBy"in ee&&!(parseFloat(ee.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in ee&&!(parseFloat(ee.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")});const Z=K.apply(this,arguments);if(X){const{sender:ee}=Z,$=ee.getParameters();(!("encodings"in $)||$.encodings.length===1&&Object.keys($.encodings[0]).length===0)&&($.encodings=q.sendEncodings,ee.sendEncodings=q.sendEncodings,this.setParametersPromises.push(ee.setParameters($).then(()=>{delete ee.sendEncodings}).catch(()=>{delete ee.sendEncodings})))}return Z})}function se(I){if(typeof I!="object"||!I.RTCRtpSender)return;const K=I.RTCRtpSender.prototype.getParameters;K&&(I.RTCRtpSender.prototype.getParameters=function(){const q=K.apply(this,arguments);return"encodings"in q||(q.encodings=[].concat(this.sendEncodings||[{}])),q})}function ue(I){if(typeof I!="object"||!I.RTCPeerConnection)return;const K=I.RTCPeerConnection.prototype.createOffer;I.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>K.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):K.apply(this,arguments)}}function pe(I){if(typeof I!="object"||!I.RTCPeerConnection)return;const K=I.RTCPeerConnection.prototype.createAnswer;I.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>K.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):K.apply(this,arguments)}}function de(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 K=I.RTCPeerConnection.prototype.addTrack;I.RTCPeerConnection.prototype.addStream=function(q){this._localStreams||(this._localStreams=[]),this._localStreams.includes(q)||this._localStreams.push(q),q.getAudioTracks().forEach(X=>K.call(this,X,q)),q.getVideoTracks().forEach(X=>K.call(this,X,q))},I.RTCPeerConnection.prototype.addTrack=function(q,...X){return X&&X.forEach(Z=>{this._localStreams?this._localStreams.includes(Z)||this._localStreams.push(Z):this._localStreams=[Z]}),K.apply(this,arguments)}}"removeStream"in I.RTCPeerConnection.prototype||(I.RTCPeerConnection.prototype.removeStream=function(K){this._localStreams||(this._localStreams=[]);const q=this._localStreams.indexOf(K);if(q===-1)return;this._localStreams.splice(q,1);const X=K.getTracks();this.getSenders().forEach(Z=>{X.includes(Z.track)&&this.removeTrack(Z)})})}}function ve(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(q){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=q),this.addEventListener("track",this._onaddstreampoly=X=>{X.streams.forEach(Z=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(Z))return;this._remoteStreams.push(Z);const ee=new Event("addstream");ee.stream=Z,this.dispatchEvent(ee)})})}});const K=I.RTCPeerConnection.prototype.setRemoteDescription;I.RTCPeerConnection.prototype.setRemoteDescription=function(){const q=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(X){X.streams.forEach(Z=>{if(q._remoteStreams||(q._remoteStreams=[]),q._remoteStreams.indexOf(Z)>=0)return;q._remoteStreams.push(Z);const ee=new Event("addstream");ee.stream=Z,q.dispatchEvent(ee)})}),K.apply(q,arguments)}}}function Ee(I){if(typeof I!="object"||!I.RTCPeerConnection)return;const K=I.RTCPeerConnection.prototype,q=K.createOffer,X=K.createAnswer,Z=K.setLocalDescription,ee=K.setRemoteDescription,$=K.addIceCandidate;K.createOffer=function(ne,ae){const le=arguments.length>=2?arguments[2]:arguments[0],he=q.apply(this,[le]);return ae?(he.then(ne,ae),Promise.resolve()):he},K.createAnswer=function(ne,ae){const le=arguments.length>=2?arguments[2]:arguments[0],he=X.apply(this,[le]);return ae?(he.then(ne,ae),Promise.resolve()):he};let oe=function(ne,ae,le){const he=Z.apply(this,[ne]);return le?(he.then(ae,le),Promise.resolve()):he};K.setLocalDescription=oe,oe=function(ne,ae,le){const he=ee.apply(this,[ne]);return le?(he.then(ae,le),Promise.resolve()):he},K.setRemoteDescription=oe,oe=function(ne,ae,le){const he=$.apply(this,[ne]);return le?(he.then(ae,le),Promise.resolve()):he},K.addIceCandidate=oe}function fe(I){const K=I&&I.navigator;if(K.mediaDevices&&K.mediaDevices.getUserMedia){const q=K.mediaDevices,X=q.getUserMedia.bind(q);K.mediaDevices.getUserMedia=Z=>X(me(Z))}!K.getUserMedia&&K.mediaDevices&&K.mediaDevices.getUserMedia&&(K.getUserMedia=function(q,X,Z){K.mediaDevices.getUserMedia(q).then(X,Z)}.bind(K))}function me(I){return I&&I.video!==void 0?Object.assign({},I,{video:u(I.video)}):I}function ge(I){if(!I.RTCPeerConnection)return;const K=I.RTCPeerConnection;I.RTCPeerConnection=function(q,X){if(q&&q.iceServers){const Z=[];for(let ee=0;ee<q.iceServers.length;ee++){let $=q.iceServers[ee];!$.hasOwnProperty("urls")&&$.hasOwnProperty("url")?(t("RTCIceServer.url","RTCIceServer.urls"),$=JSON.parse(JSON.stringify($)),$.urls=$.url,delete $.url,Z.push($)):Z.push(q.iceServers[ee])}q.iceServers=Z}return new K(q,X)},I.RTCPeerConnection.prototype=K.prototype,"generateCertificate"in K&&Object.defineProperty(I.RTCPeerConnection,"generateCertificate",{get:()=>K.generateCertificate})}function be(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 Re(I){const K=I.RTCPeerConnection.prototype.createOffer;I.RTCPeerConnection.prototype.createOffer=function(q){if(q){q.offerToReceiveAudio!==void 0&&(q.offerToReceiveAudio=!!q.offerToReceiveAudio);const X=this.getTransceivers().find(ee=>ee.receiver.track.kind==="audio");q.offerToReceiveAudio===!1&&X?X.direction==="sendrecv"?X.setDirection?X.setDirection("sendonly"):X.direction="sendonly":X.direction==="recvonly"&&(X.setDirection?X.setDirection("inactive"):X.direction="inactive"):q.offerToReceiveAudio!==!0||X||this.addTransceiver("audio"),q.offerToReceiveVideo!==void 0&&(q.offerToReceiveVideo=!!q.offerToReceiveVideo);const Z=this.getTransceivers().find(ee=>ee.receiver.track.kind==="video");q.offerToReceiveVideo===!1&&Z?Z.direction==="sendrecv"?Z.setDirection?Z.setDirection("sendonly"):Z.direction="sendonly":Z.direction==="recvonly"&&(Z.setDirection?Z.setDirection("inactive"):Z.direction="inactive"):q.offerToReceiveVideo!==!0||Z||this.addTransceiver("video")}return K.apply(this,arguments)}}function Te(I){typeof I!="object"||I.AudioContext||(I.AudioContext=I.webkitAudioContext)}var Ie=_(7963),xe=_.n(Ie);function De(I){if(!I.RTCIceCandidate||I.RTCIceCandidate&&"foundation"in I.RTCIceCandidate.prototype)return;const K=I.RTCIceCandidate;I.RTCIceCandidate=function(q){if(typeof q=="object"&&q.candidate&&q.candidate.indexOf("a=")===0&&((q=JSON.parse(JSON.stringify(q))).candidate=q.candidate.substr(2)),q.candidate&&q.candidate.length){const X=new K(q),Z=xe().parseCandidate(q.candidate),ee=Object.assign(X,Z);return ee.toJSON=function(){return{candidate:ee.candidate,sdpMid:ee.sdpMid,sdpMLineIndex:ee.sdpMLineIndex,usernameFragment:ee.usernameFragment}},ee}return new K(q)},I.RTCIceCandidate.prototype=K.prototype,e(I,"icecandidate",q=>(q.candidate&&Object.defineProperty(q,"candidate",{value:new I.RTCIceCandidate(q.candidate),writable:"false"}),q))}function Ce(I,K){if(!I.RTCPeerConnection)return;"sctp"in I.RTCPeerConnection.prototype||Object.defineProperty(I.RTCPeerConnection.prototype,"sctp",{get(){return this._sctp===void 0?null:this._sctp}});const q=I.RTCPeerConnection.prototype.setRemoteDescription;I.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,K.browser==="chrome"&&K.version>=76){const{sdpSemantics:X}=this.getConfiguration();X==="plan-b"&&Object.defineProperty(this,"sctp",{get(){return this._sctp===void 0?null:this._sctp},enumerable:!0,configurable:!0})}if(function(X){if(!X||!X.sdp)return!1;const Z=xe().splitSections(X.sdp);return Z.shift(),Z.some(ee=>{const $=xe().parseMLine(ee);return $&&$.kind==="application"&&$.protocol.indexOf("SCTP")!==-1})}(arguments[0])){const X=function(ne){const ae=ne.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(ae===null||ae.length<2)return-1;const le=parseInt(ae[1],10);return le!=le?-1:le}(arguments[0]),Z=function(ne){let ae=65536;return K.browser==="firefox"&&(ae=K.version<57?ne===-1?16384:2147483637:K.version<60?K.version===57?65535:65536:2147483637),ae}(X),ee=function(ne,ae){let le=65536;K.browser==="firefox"&&K.version===57&&(le=65535);const he=xe().matchPrefix(ne.sdp,"a=max-message-size:");return he.length>0?le=parseInt(he[0].substr(19),10):K.browser==="firefox"&&ae!==-1&&(le=2147483637),le}(arguments[0],X);let $;$=Z===0&&ee===0?Number.POSITIVE_INFINITY:Z===0||ee===0?Math.max(Z,ee):Math.min(Z,ee);const oe={};Object.defineProperty(oe,"maxMessageSize",{get:()=>$}),this._sctp=oe}return q.apply(this,arguments)}}function Oe(I){if(!I.RTCPeerConnection||!("createDataChannel"in I.RTCPeerConnection.prototype))return;function K(X,Z){const ee=X.send;X.send=function(){const $=arguments[0],oe=$.length||$.size||$.byteLength;if(X.readyState==="open"&&Z.sctp&&oe>Z.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+Z.sctp.maxMessageSize+" bytes)");return ee.apply(X,arguments)}}const q=I.RTCPeerConnection.prototype.createDataChannel;I.RTCPeerConnection.prototype.createDataChannel=function(){const X=q.apply(this,arguments);return K(X,this),X},e(I,"datachannel",X=>(K(X.channel,X.target),X))}function Me(I){if(!I.RTCPeerConnection||"connectionState"in I.RTCPeerConnection.prototype)return;const K=I.RTCPeerConnection.prototype;Object.defineProperty(K,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(K,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(q){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),q&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=q)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(q=>{const X=K[q];K[q]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=Z=>{const ee=Z.target;if(ee._lastConnectionState!==ee.connectionState){ee._lastConnectionState=ee.connectionState;const $=new Event("connectionstatechange",Z);ee.dispatchEvent($)}return Z},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),X.apply(this,arguments)}})}function Pe(I,K){if(!I.RTCPeerConnection||K.browser==="chrome"&&K.version>=71||K.browser==="safari"&&K.version>=605)return;const q=I.RTCPeerConnection.prototype.setRemoteDescription;I.RTCPeerConnection.prototype.setRemoteDescription=function(X){if(X&&X.sdp&&X.sdp.indexOf(`
160
- a=extmap-allow-mixed`)!==-1){const Z=X.sdp.split(`
137
+ `},T.writeMediaSection=function(_,f,l,m){var h=T.writeRtpDescription(_.kind,f);if(h+=T.writeIceParameters(_.iceGatherer.getLocalParameters()),h+=T.writeDtlsParameters(_.dtlsTransport.getLocalParameters(),l==="offer"?"actpass":"active"),h+="a=mid:"+_.mid+`\r
138
+ `,_.direction?h+="a="+_.direction+`\r
139
+ `:_.rtpSender&&_.rtpReceiver?h+=`a=sendrecv\r
140
+ `:_.rtpSender?h+=`a=sendonly\r
141
+ `:_.rtpReceiver?h+=`a=recvonly\r
142
+ `:h+=`a=inactive\r
143
+ `,_.rtpSender){var v="msid:"+m.id+" "+_.rtpSender.track.id+`\r
144
+ `;h+="a="+v,h+="a=ssrc:"+_.sendEncodingParameters[0].ssrc+" "+v,_.sendEncodingParameters[0].rtx&&(h+="a=ssrc:"+_.sendEncodingParameters[0].rtx.ssrc+" "+v,h+="a=ssrc-group:FID "+_.sendEncodingParameters[0].ssrc+" "+_.sendEncodingParameters[0].rtx.ssrc+`\r
145
+ `)}return h+="a=ssrc:"+_.sendEncodingParameters[0].ssrc+" cname:"+T.localCName+`\r
146
+ `,_.rtpSender&&_.sendEncodingParameters[0].rtx&&(h+="a=ssrc:"+_.sendEncodingParameters[0].rtx.ssrc+" cname:"+T.localCName+`\r
147
+ `),h},T.getDirection=function(_,f){for(var l=T.splitLines(_),m=0;m<l.length;m++)switch(l[m]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return l[m].substr(2)}return f?T.getDirection(f):"sendrecv"},T.getKind=function(_){return T.splitLines(_)[0].split(" ")[0].substr(2)},T.isRejected=function(_){return _.split(" ",2)[1]==="0"},T.parseMLine=function(_){var f=T.splitLines(_)[0].substr(2).split(" ");return{kind:f[0],port:parseInt(f[1],10),protocol:f[2],fmt:f.slice(3).join(" ")}},T.parseOLine=function(_){var f=T.matchPrefix(_,"o=")[0].substr(2).split(" ");return{username:f[0],sessionId:f[1],sessionVersion:parseInt(f[2],10),netType:f[3],addressType:f[4],address:f[5]}},T.isValidSDP=function(_){if(typeof _!="string"||_.length===0)return!1;for(var f=T.splitLines(_),l=0;l<f.length;l++)if(f[l].length<2||f[l].charAt(1)!=="=")return!1;return!0},H.exports=T},4845:function(H,T,_){var f=this&&this.__assign||function(){return f=Object.assign||function(n){for(var c,p=1,C=arguments.length;p<C;p++)for(var x in c=arguments[p])Object.prototype.hasOwnProperty.call(c,x)&&(n[x]=c[x]);return n},f.apply(this,arguments)},l=this&&this.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(T,"__esModule",{value:!0}),T.AliRTS=void 0;var m=_(2550),h=_(9428),v=_(3412),u=_(7668),s=_(233),i=l(_(2818)),e=_(5259),o=_(7989),r=_(6420),a=_(1698),t=function(){function n(){}return n.createClient=function(c){var p=c||{};return p.customReporter||(p.customReporter=n.customReporter),p.trackLog===void 0&&(p.trackLog=n.trackLog),a.configProvider.setContext(p),new u.RtsClient(p)},n.getMicList=function(){var c=this;return new Promise(function(p,C){c.deviceManager.getMicList().then(function(x){p(x)}).catch(function(x){C(x)})})},n.getCameraList=function(){var c=this;return new Promise(function(p,C){c.deviceManager.getCameraList().then(function(x){p(x)}).catch(function(x){C(x)})})},n.getSpeakerList=function(){var c=this;return new Promise(function(p,C){c.deviceManager.getSpeakerList().then(function(x){p(x)}).catch(function(x){C(x)})})},n.createStream=function(c){return new Promise(function(p,C){var x=new m.LocalStream,y=new i.default({customReporter:n.customReporter,trackLog:n.trackLog});x.init(c).then(function(){p(x),y.reportStreamCreated(c,{videoTrack:!!x.videoTrack,audioTrack:!!x.audioTrack,screenAudio:!!x.screenAudioTrack,surface:x.screenSurfaceType})}).catch(function(E){var S=f(f({},E),{relatedLink:E.extraInfo});delete S.extraInfo,C(S),y.reportErrorInfo(h.ErrorCode.ERROR_INIT_LOCAL_FAIL,E.message,E.traceId,{config:c,originErr:E})})})},n.deviceManager=new v.BrowserDeviceManager,n.BrowserUtil=s.BrowserUtil,n.SystenUtil=s.SystemUtil,n.SupportUtil=o.SupportUtil,n.Clock=r.Clock,n.VideoProfileMap=e.VideoProfileMap,n.ScreenProfileMap=e.ScreenProfileMap,n.AudioProfileMap=e.AudioProfileMap,n.ErrorCode=h.ErrorCode,n.customReporter=function(){},n.trackLog=!0,n}();T.AliRTS=t},7028:(H,T)=>{Object.defineProperty(T,"__esModule",{value:!0}),T.default={version:"2.13.2",protocol_version:2,sdk_version:"0.0.1"}},9428:(H,T)=>{var _,f;Object.defineProperty(T,"__esModule",{value:!0}),T.PUB_RECONNECT_ERROR_LIST=T.RECONNECT_ERROR_EXCLUDE_LIST=T.SUB_RECONNECT_ERROR_LIST=T.DeviceErrorCode=T.ErrorCode=void 0,function(l){l[l.ERROR_DEVICE_UNKNOWNERROR=1e4]="ERROR_DEVICE_UNKNOWNERROR",l[l.ERROR_DEVICE_AUDIODEVICE_NOTFOUND=10001]="ERROR_DEVICE_AUDIODEVICE_NOTFOUND",l[l.ERROR_DEVICE_VIDEODEVICE_NOTFOUND=10002]="ERROR_DEVICE_VIDEODEVICE_NOTFOUND",l[l.ERROR_DEVICE_NOTFOUND=10020]="ERROR_DEVICE_NOTFOUND",l[l.ERROR_DEVICE_AUDIODEVICE_NOTALLOWED=10003]="ERROR_DEVICE_AUDIODEVICE_NOTALLOWED",l[l.ERROR_DEVICE_VIDEODEVICE_NOTALLOWED=10004]="ERROR_DEVICE_VIDEODEVICE_NOTALLOWED",l[l.ERROR_DEVICE_NOTALLOWED=10021]="ERROR_DEVICE_NOTALLOWED",l[l.ERROR_DEVICE_AUDIODEVICE_NOTREADABLE=10005]="ERROR_DEVICE_AUDIODEVICE_NOTREADABLE",l[l.ERROR_DEVICE_VIDEODEVICE_NOTREADABLE=10006]="ERROR_DEVICE_VIDEODEVICE_NOTREADABLE",l[l.ERROR_DEVICE_NOTREADABLE=10022]="ERROR_DEVICE_NOTREADABLE",l[l.ERROR_DEIVCE_CONSTRAINEDERROR=10007]="ERROR_DEIVCE_CONSTRAINEDERROR",l[l.ERROR_SCREENSHARE_UNKNOWNERRO=10010]="ERROR_SCREENSHARE_UNKNOWNERRO",l[l.ERROR_SCREENSHARE_NOTALLOWED=10011]="ERROR_SCREENSHARE_NOTALLOWED",l[l.ERROR_SCREENSHARE_ENDED=10012]="ERROR_SCREENSHARE_ENDED",l[l.ERROR_SCREENSHARE_NOPERMISSION=10013]="ERROR_SCREENSHARE_NOPERMISSION",l[l.ERROR_SCREENSHARE_INVALIDACCESS=10014]="ERROR_SCREENSHARE_INVALIDACCESS",l[l.ERROR_SCREENSHARE_NOTSUPPORT=10018]="ERROR_SCREENSHARE_NOTSUPPORT",l[l.ERROR_DEVICE_NOTSUPPORT=10019]="ERROR_DEVICE_NOTSUPPORT",l[l.ERROR_SIGNAL_ERROR=10101]="ERROR_SIGNAL_ERROR",l[l.ERROR_PLAY_FAILED=10102]="ERROR_PLAY_FAILED",l[l.ERROR_NOTSUPPORT_WEBRTC=10110]="ERROR_NOTSUPPORT_WEBRTC",l[l.ERROR_BROWSER_NOTSUPPORT=10111]="ERROR_BROWSER_NOTSUPPORT",l[l.ERROR_BROWSER_VERSIONLOW=10112]="ERROR_BROWSER_VERSIONLOW",l[l.ERROR_NOTSUPPORT_H264=10113]="ERROR_NOTSUPPORT_H264",l[l.ERROR_CREATEOFFER=10114]="ERROR_CREATEOFFER",l[l.ERROR_NO_DATACHANNEL=10115]="ERROR_NO_DATACHANNEL",l[l.ERROR_INIT_LOCAL_FAIL=10116]="ERROR_INIT_LOCAL_FAIL",l[l.ERROR_HEMLELEMENT_NOTMATCH=10125]="ERROR_HEMLELEMENT_NOTMATCH",l[l.ERROR_AUTOPLAY_ERROR=10201]="ERROR_AUTOPLAY_ERROR",l[l.ERROR_PLAY_URL=10202]="ERROR_PLAY_URL",l[l.ERROR_SUBSCRIBE_NOTHING=10203]="ERROR_SUBSCRIBE_NOTHING",l[l.ERROR_HTMLELEMENT_ERROR=10204]="ERROR_HTMLELEMENT_ERROR",l[l.ERROR_HTTPREQUEST_ERROR=10205]="ERROR_HTTPREQUEST_ERROR",l[l.ERROR_ANSWER_ERROR=10206]="ERROR_ANSWER_ERROR",l[l.ERROR_INBOUND_TIMEOUT=10207]="ERROR_INBOUND_TIMEOUT",l[l.ERROR_STREAM_ENDED=10208]="ERROR_STREAM_ENDED",l[l.ERROR_PC_DISCONNECTED=10209]="ERROR_PC_DISCONNECTED",l[l.ERROR_TRANSPORT_CLOSED=10210]="ERROR_TRANSPORT_CLOSED",l[l.ERROR_SIGNAL_URL=10211]="ERROR_SIGNAL_URL",l[l.ERROR_IP_MIGRATE=10212]="ERROR_IP_MIGRATE",l[l.ERROR_PUBLISH_URL=10300]="ERROR_PUBLISH_URL",l[l.ERROR_PUBLISH_NOAUDIO=10301]="ERROR_PUBLISH_NOAUDIO",l[l.ERROR_PUBLISH_NOSTREAM=10302]="ERROR_PUBLISH_NOSTREAM",l[l.ERROR_DATACHANNEL_PARAM=10500]="ERROR_DATACHANNEL_PARAM",l[l.ERROR_DATACHANNEL_OPEN=10501]="ERROR_DATACHANNEL_OPEN",l[l.ERROR_MEDIASTREAMTRACK_TYPE_ERROR=11e3]="ERROR_MEDIASTREAMTRACK_TYPE_ERROR",l[l.ERROR_MEDIASTREAMTRACK_KIND_ERROR=11001]="ERROR_MEDIASTREAMTRACK_KIND_ERROR",l[l.ERROR_MEDIASTREAMTRACK_AUDIO_NONE=11002]="ERROR_MEDIASTREAMTRACK_AUDIO_NONE",l[l.ERROR_CUSTOMSTREAM_NONE=11003]="ERROR_CUSTOMSTREAM_NONE",l[l.ERROR_CUSTOMSTREAM_INVALID=11004]="ERROR_CUSTOMSTREAM_INVALID",l[l.ERROR_CUSTOMSTREAM_TRACK_NONE=11005]="ERROR_CUSTOMSTREAM_TRACK_NONE",l[l.ERROR_PREERCONNECTION_UNKNOWN=12e3]="ERROR_PREERCONNECTION_UNKNOWN",l[l.ERROR_SUBADD_NO_RESULT=13e3]="ERROR_SUBADD_NO_RESULT",l[l.ERROR_PUBADD_NO_RESULT=13001]="ERROR_PUBADD_NO_RESULT",l[l.ERROR_SINGLE_PC_STREAM_ERROR=13100]="ERROR_SINGLE_PC_STREAM_ERROR",l[l.ERROR_SINGLE_PC_STREAM_RECONNECT_FAILED=13101]="ERROR_SINGLE_PC_STREAM_RECONNECT_FAILED",l[l.ERROR_SINGLE_PC_FULL_RECONNECT=13102]="ERROR_SINGLE_PC_FULL_RECONNECT",l[l.ERROR_SINGLE_PC_FULL_RECONNECT_HTTP_FAILED=13103]="ERROR_SINGLE_PC_FULL_RECONNECT_HTTP_FAILED"}(_||(T.ErrorCode=_={})),function(l){l[l.ERROR_DEVICE_UNKNOWNERROR=1e4]="ERROR_DEVICE_UNKNOWNERROR",l[l.ERROR_DEVICE_AUDIODEVICE_NOTFOUND=10001]="ERROR_DEVICE_AUDIODEVICE_NOTFOUND",l[l.ERROR_DEVICE_VIDEODEVICE_NOTFOUND=10002]="ERROR_DEVICE_VIDEODEVICE_NOTFOUND",l[l.ERROR_DEVICE_AUDIODEVICE_NOTALLOWED=10003]="ERROR_DEVICE_AUDIODEVICE_NOTALLOWED",l[l.ERROR_DEVICE_VIDEODEVICE_NOTALLOWED=10004]="ERROR_DEVICE_VIDEODEVICE_NOTALLOWED",l[l.ERROR_DEVICE_AUDIODEVICE_NOTREADABLE=10005]="ERROR_DEVICE_AUDIODEVICE_NOTREADABLE",l[l.ERROR_DEVICE_VIDEODEVICE_NOTREADABLE=10006]="ERROR_DEVICE_VIDEODEVICE_NOTREADABLE",l[l.ERROR_SCREENSHARE_NOTSUPPORT=10010]="ERROR_SCREENSHARE_NOTSUPPORT",l[l.ERROR_SCREENSHARE_NOTALLOWED=10011]="ERROR_SCREENSHARE_NOTALLOWED",l[l.ERROR_SCREENSHARE_ENDED=10012]="ERROR_SCREENSHARE_ENDED",l[l.ERROR_SCREENSHARE_NOPERMISSION=10013]="ERROR_SCREENSHARE_NOPERMISSION",l[l.ERROR_SCREENSHARE_SAFARI_INVALIDACCESS=10014]="ERROR_SCREENSHARE_SAFARI_INVALIDACCESS",l[l.ERROR_SCREENSHARE_UNKNOWNERRO=10019]="ERROR_SCREENSHARE_UNKNOWNERRO",l[l.ERROR_DEVICE_NOTSUPPORT=2e4]="ERROR_DEVICE_NOTSUPPORT"}(f||(T.DeviceErrorCode=f={})),T.SUB_RECONNECT_ERROR_LIST=[_.ERROR_INBOUND_TIMEOUT,_.ERROR_STREAM_ENDED,_.ERROR_PC_DISCONNECTED],T.RECONNECT_ERROR_EXCLUDE_LIST=[_.ERROR_AUTOPLAY_ERROR,_.ERROR_PLAY_URL,_.ERROR_SUBSCRIBE_NOTHING,_.ERROR_HTMLELEMENT_ERROR,_.ERROR_HEMLELEMENT_NOTMATCH,_.ERROR_PUBLISH_URL,_.ERROR_PUBLISH_NOAUDIO,_.ERROR_PUBLISH_NOSTREAM],T.PUB_RECONNECT_ERROR_LIST=[_.ERROR_PC_DISCONNECTED,_.ERROR_TRANSPORT_CLOSED]},5044:(H,T,_)=>{Object.defineProperty(T,"__esModule",{value:!0}),T.RtsError=void 0;var f=_(9428),l=function(){function m(h,v,u,s){this.errorCode=h,this.errorCodeName=f.ErrorCode[h],this.message=v,this.traceId=u,s&&(this.extraInfo=s)}return m.prototype.renameCode=function(h){this.errorCode=h,this.errorCodeName=f.ErrorCode[h]},m}();T.RtsError=l},6091:(H,T)=>{Object.defineProperty(T,"__esModule",{value:!0}),T.PlayEvent=T.PlayType=void 0,T.PlayType={PLAY_CANPLAY:"canplay",PLAY_WAITING:"waiting",PLAY_PLAYING:"playing",PLAY_MEDIA:"media",PLAY_ENDED:"ended",PLAY_TIMEOUT:"timeout"};var _=function(f){this.event=f};T.PlayEvent=_},5917:(H,T)=>{var _,f,l,m;Object.defineProperty(T,"__esModule",{value:!0}),T.DEFAULT_RETRY_DATACHANNEL_TIMEOUT=T.DEFAULT_HEARTBEAT_TIMEOUT=T.DEFAULT_RETRY_PUBLISH_INTERVAL=T.DEFAULT_RETRY_SUBSCRIBE_INTERVAL=T.DEFAULT_RETRY_PUBLISH_LIMIT=T.DEFAULT_RETRY_SUBSCRIBE_LIMIT=T.EWorkerAction=T.EWorkerSource=T.EConnectStatus=T.TrackType=void 0,function(h){h.AUDIO="audio",h.VIDEO="video"}(_||(T.TrackType=_={})),function(h){h[h.CONNECT_STATUS_DISCONNECTED=0]="CONNECT_STATUS_DISCONNECTED",h[h.CONNECT_STATUS_CONNECTING=1]="CONNECT_STATUS_CONNECTING",h[h.CONNECT_STATUS_CONNECTED=2]="CONNECT_STATUS_CONNECTED",h[h.CONNECT_STATUS_RECONNECTING=3]="CONNECT_STATUS_RECONNECTING"}(f||(T.EConnectStatus=f={})),function(h){h.Sender="sender",h.Receiver="receiver"}(l||(T.EWorkerSource=l={})),function(h){h.Setup="setup",h.InserSEI="insertSEI",h.UpdatePubStats="updatePubStats",h.UpdateSubStats="updateSubStats",h.SwitchCumuDelay="switchCumuDelay"}(m||(T.EWorkerAction=m={})),T.DEFAULT_RETRY_SUBSCRIBE_LIMIT=5,T.DEFAULT_RETRY_PUBLISH_LIMIT=5,T.DEFAULT_RETRY_SUBSCRIBE_INTERVAL=2e3,T.DEFAULT_RETRY_PUBLISH_INTERVAL=2e3,T.DEFAULT_HEARTBEAT_TIMEOUT=8,T.DEFAULT_RETRY_DATACHANNEL_TIMEOUT=8e3},6600:function(H,T,_){var f,l=this&&this.__extends||(f=function(R,D){return f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,b){A.__proto__=b}||function(A,b){for(var g in b)Object.prototype.hasOwnProperty.call(b,g)&&(A[g]=b[g])},f(R,D)},function(R,D){if(typeof D!="function"&&D!==null)throw new TypeError("Class extends value "+String(D)+" is not a constructor or null");function A(){this.constructor=R}f(R,D),R.prototype=D===null?Object.create(D):(A.prototype=D.prototype,new A)}),m=this&&this.__assign||function(){return m=Object.assign||function(R){for(var D,A=1,b=arguments.length;A<b;A++)for(var g in D=arguments[A])Object.prototype.hasOwnProperty.call(D,g)&&(R[g]=D[g]);return R},m.apply(this,arguments)},h=this&&this.__awaiter||function(R,D,A,b){return new(A||(A=Promise))(function(g,O){function k(W){try{w(b.next(W))}catch(M){O(M)}}function U(W){try{w(b.throw(W))}catch(M){O(M)}}function w(W){var M;W.done?g(W.value):(M=W.value,M instanceof A?M:new A(function(N){N(M)})).then(k,U)}w((b=b.apply(R,D||[])).next())})},v=this&&this.__generator||function(R,D){var A,b,g,O,k={label:0,sent:function(){if(1&g[0])throw g[1];return g[1]},trys:[],ops:[]};return O={next:U(0),throw:U(1),return:U(2)},typeof Symbol=="function"&&(O[Symbol.iterator]=function(){return this}),O;function U(w){return function(W){return function(M){if(A)throw new TypeError("Generator is already executing.");for(;O&&(O=0,M[0]&&(k=0)),k;)try{if(A=1,b&&(g=2&M[0]?b.return:M[0]?b.throw||((g=b.return)&&g.call(b),0):b.next)&&!(g=g.call(b,M[1])).done)return g;switch(b=0,g&&(M=[2&M[0],g.value]),M[0]){case 0:case 1:g=M;break;case 4:return k.label++,{value:M[1],done:!1};case 5:k.label++,b=M[1],M=[0];continue;case 7:M=k.ops.pop(),k.trys.pop();continue;default:if(g=k.trys,!((g=g.length>0&&g[g.length-1])||M[0]!==6&&M[0]!==2)){k=0;continue}if(M[0]===3&&(!g||M[1]>g[0]&&M[1]<g[3])){k.label=M[1];break}if(M[0]===6&&k.label<g[1]){k.label=g[1],g=M;break}if(g&&k.label<g[2]){k.label=g[2],k.ops.push(M);break}g[2]&&k.ops.pop(),k.trys.pop();continue}M=D.call(R,k)}catch(N){M=[6,N],b=0}finally{A=g=0}if(5&M[0])throw M[1];return{value:M[0]?M[1]:void 0,done:!0}}([w,W])}}},u=this&&this.__importDefault||function(R){return R&&R.__esModule?R:{default:R}};Object.defineProperty(T,"__esModule",{value:!0}),T.CommonController=void 0;var s=_(771),i=_(5917),e=u(_(102)),o=_(9594),r=_(2718),a=_(1698),t=_(5044),n=_(9428),c=_(6091),p=_(5788),C=_(280),x=u(_(1401)),y=_(5649),E=function(R){function D(A){var b=R.call(this)||this;return b.datachannelList=new S,b.receiverCodecPreferences={},b.senderCodecPreferences={},b.canAutoAssignDcId=!0,b.reporter=A,b.signalChannel=new p.SignalChannel({reporter:A}),b.proxySignalChannelEvents(),b}return l(D,R),D.prototype.setConfig=function(A){this.config=A},D.prototype.setPeerconnection=function(A){var b=this;A!==this.peerconnection&&(this.peerconnection&&this.peerconnection.removeAllListeners(),this.peerconnection=A,this.signalChannel.isOpen||(this.waitForOpenPms=new Promise(function(g,O){b.peerconnection.on("datachannelStatusChange",function(k){var U;b.emit("datachannelStatusChange",k),k.status===C.EDatachannelStatus.DATACHANNEL_STATUS_OPEN&&(b.signalChannel.setPeerConnection(A),b.canAutoAssignDcId=typeof((U=b.signalChannel.datachannelCore)===null||U===void 0?void 0:U.id)=="number",g())})})),this.peerconnection.on("cumuDelayNotSupported",function(){var g;b.emit("cumuDelayNotSupported"),(g=b.reporter)===null||g===void 0||g.reportCumuDelayNotSupported()}),this.peerconnection.on("innerSubscribeDeleteTracks",function(g){b.handleWorkerSubDelete(g)}),this.peerconnection.on("encodedFrame",function(g){var O;b.emit("encodedFrame",g),g.kind==="video"&&(0,o.parseSei)((O=g.frame)===null||O===void 0?void 0:O.data).forEach(function(k){var U;if(k.payloadType===y.CUMU_DELAY_SEI_PAYLOAD_TYPE){var w={pub:{},sub:{},grtn:{},AIPub:{},AISub:{},AIAgent:{},AIGrtn:{},other:{}},W=new y.CumuDelaySeiPayloadParser(k.data);w.pub=W.pub||{},w.sub=g.subStats||{},w.grtn=W.grtn||{},w.AIPub=W.AIPub||{},w.AISub=W.AISub||{},w.AIAgent=W.AIAgent||{},w.AIGrtn=W.AIGrtn||{},w.other=W.other||{},Object.keys(w.pub).forEach(function(N){var P=w.pub[N];delete w.pub[N],w.pub[(0,r.lowercaseFirstLetter)(N)]=P}),Object.keys(w.sub).forEach(function(N){var P=w.sub[N];delete w.sub[N],w.sub[(0,r.lowercaseFirstLetter)(N)]=P}),Object.keys(w.AIPub).forEach(function(N){var P=w.AIPub[N];delete w.AIPub[N],w.AIPub[(0,r.lowercaseFirstLetter)(N)]=P}),Object.keys(w.AISub).forEach(function(N){var P=w.AISub[N];delete w.AISub[N],w.AISub[(0,r.lowercaseFirstLetter)(N)]=P}),Object.keys(w.AIAgent).forEach(function(N){var P=w.AIAgent[N];delete w.AIAgent[N],w.AIAgent[(0,r.underlineToCamelCase)(N.toLowerCase())]=P}),Object.keys(w.AIGrtn).forEach(function(N){var P=w.AIGrtn[N];delete w.AIGrtn[N],w.AIGrtn[(0,r.underlineToCamelCase)(N.toLowerCase())]=P}),Object.keys(w.grtn).forEach(function(N){var P=w.grtn[N];delete w.grtn[N],w.grtn[(0,r.underlineToCamelCase)(N.toLowerCase())]=P});var M=void 0;try{M=(0,x.default)(w)}catch(N){console.warn(N,w)}M&&(k.data=new TextEncoder().encode(M),(U=b.reporter)===null||U===void 0||U.updateCumuDelayInfo({json:M}))}b.emit("receivedSEI",{url:g.url,vMsid:g.vMsid,sei:k})})}),this.peerconnection.on("message",function(g){var O;(O=b.reporter)===null||O===void 0||O.reportNotifyMessage(g)}),this.peerconnection.on("hebtReceived",function(g){b.emit("heartbeat",g)}),this.peerconnection.on("streamError",function(g){b.emit("onError",new t.RtsError(n.ErrorCode.ERROR_SINGLE_PC_STREAM_ERROR,g.resMsg,"",m({},g)))}),this.peerconnection.on("streamReconnect",function(g){b.emit("reconnect",{type:g.type,reason:new t.RtsError(n.ErrorCode.ERROR_SINGLE_PC_STREAM_ERROR,g.resMsg,"",m({},g)),retryTimes:1,extraInfo:m({},g)}),b.singleStreamReconnect(g).then(function(){b.emit("reconnectFinish",{type:g.type,latestUrl:g.latestUrl,msids:g.msids})}).catch(function(O){b.emit("onError",new t.RtsError(n.ErrorCode.ERROR_SINGLE_PC_STREAM_RECONNECT_FAILED,"single stream reconnect failed","",{originError:O}))})}),this.peerconnection.on("traceIdUpdate",function(g){b.emit("traceId",g)}),this.peerconnection.on("pcReconnect",function(g){b.emit("reconnect",{type:"pc",reason:new t.RtsError(n.ErrorCode.ERROR_SINGLE_PC_FULL_RECONNECT,g.reMsg,"",m({},g)),retryTimes:1,extraInfo:m({},g)})}),(this.receiverCodecPreferences.video||this.receiverCodecPreferences.audio)&&this.peerconnection.setReceiverCodecPreferences(this.receiverCodecPreferences),(this.senderCodecPreferences.video||this.senderCodecPreferences.audio)&&this.peerconnection.setSenderCodecPreferences(this.senderCodecPreferences))},Object.defineProperty(D.prototype,"peerCore",{get:function(){var A;return(A=this.peerconnection)===null||A===void 0?void 0:A.getPeerCore()},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"streamManager",{get:function(){var A;return(A=this.peerCore)===null||A===void 0?void 0:A.getStreamManager()},enumerable:!1,configurable:!0}),D.prototype.subscribeAdd=function(A,b){return h(this,void 0,void 0,function(){var g,O,k,U,w,W,M,N,P=this;return v(this,function(V){switch(V.label){case 0:if(A.forEach(function(j){var z;(z=P.reporter)===null||z===void 0||z.reportSubscribeStart(j.url,"",j.vMsid,j.aMsid,!0)}),!this.peerconnection)throw this.makeRtsError("subscribeAdd");this.peerconnection.isReused=!0,g=new Date().getTime(),V.label=1;case 1:return V.trys.push([1,3,,4]),[4,this.peerconnection.subAdd(A,b)];case 2:if(!(O=V.sent()).streamList)throw new t.RtsError(n.ErrorCode.ERROR_SUBADD_NO_RESULT,"subAdd streamList not found","",{api:"subscribeAdd",configList:A,response:O});return[3,4];case 3:throw k=V.sent(),U=k,(N=this.reporter)===null||N===void 0||N.reportErrorInfo(U.errorCode,U.message,U.traceId,U.extraInfo),U;case 4:return w=O.deleteRspTime-g,W=O.subAddRspTime-O.deleteRspTime,M=O.activeRspTime-O.subAddRspTime,O.streamList.forEach(function(j,z){var G,X,re,te;(G=P.reporter)===null||G===void 0||G.reportSubscribeOk({vurl:j.url||void 0,isSubAdd:!0});var oe,ue=A[z]||{},se=ue.targetStream,ce=ue.vMsid,de=ue.aMsid,pe=j.stream;if(se)return se.mergeStream(pe),(X=P.streamManager)===null||X===void 0||X.update(j.url,{stream:se,vMsid:ce?.[0],aMsid:de?.[0]}),void(j.stream=se);var he=(re=P.streamManager)===null||re===void 0?void 0:re.getStreamByMsid({url:j.url,vMsid:ce?.[0],aMsid:de?.[0]});if(he)he.mergeStream(pe),oe=he;else{(oe=new s.RemoteStream).updateMediaStream(pe),(te=P.streamManager)===null||te===void 0||te.update(j.url,{stream:oe,vMsid:ce?.[0],aMsid:de?.[0]}),oe.on("onCanPlay",function(){var fe,me,ge=new Date().getTime();(fe=P.reporter)===null||fe===void 0||fe.reportFirstFrameTime(j.url,j.traceId,-1,-1,ge-g,0,-1,{},w,W,M,ce,de,!0),(me=P.peerconnection)===null||me===void 0||me.playStart()});var Ee=new c.PlayEvent(c.PlayType.PLAY_CANPLAY);Ee.data={url:j.url,vMsid:ce?.[0]||"vMsid unknown",aMsid:de?.[0]||"aMsid unknown"},P.emit("onPlayEvent",Ee)}j.stream=oe}),[2,O.streamList]}})})},D.prototype.subscribeActive=function(A){return h(this,void 0,void 0,function(){var b;return v(this,function(g){if(!this.peerconnection)throw this.makeRtsError("subscribeActive");return[2,(b=this.peerconnection)===null||b===void 0?void 0:b.subActive(A)]})})},D.prototype.subscribeStop=function(A){return h(this,void 0,void 0,function(){var b,g,O,k,U;return v(this,function(w){switch(w.label){case 0:if(!this.peerconnection)throw this.makeRtsError("subscribeStop");w.label=1;case 1:return w.trys.push([1,3,,4]),[4,this.peerconnection.subStop(A)];case 2:return b=w.sent(),this.peerconnection.getSubMonitor().updateTranceiversController(),g=this.peerconnection.getWorkerManager(),A.forEach(function(W){g.removeByUrl({url:W.url,source:i.EWorkerSource.Receiver})}),[3,4];case 3:throw O=w.sent(),k=O,(U=this.reporter)===null||U===void 0||U.reportErrorInfo(k.errorCode,k.message,k.traceId,k.extraInfo),O;case 4:return[2,b]}})})},D.prototype.subscribeDeleteTracks=function(A){return h(this,void 0,void 0,function(){var b,g,O,k;return v(this,function(U){switch(U.label){case 0:if(!this.peerconnection)throw this.makeRtsError("subscribeDeleteTracks");U.label=1;case 1:return U.trys.push([1,3,,4]),[4,this.peerconnection.subDeleteTracks(A)];case 2:if(!(b=U.sent()))throw this.makeRtsError("subscribeDeleteTracks");return this.peerconnection.getSubMonitor().updateTranceiversController(),this.handleWorkerSubDelete(A),[3,4];case 3:throw g=U.sent(),O=g,(k=this.reporter)===null||k===void 0||k.reportErrorInfo(O.errorCode,O.message,O.traceId,O.extraInfo),g;case 4:return[2,b]}})})},D.prototype.handleWorkerSubDelete=function(A){if(this.peerconnection){var b=this.peerconnection.getWorkerManager();A.forEach(function(g){var O,k;!((O=g.vMsid)===null||O===void 0)&&O.length&&b.removeByMsid({url:g.url,source:i.EWorkerSource.Receiver,kind:"video",msid:g.vMsid[0]}),!((k=g.aMsid)===null||k===void 0)&&k.length&&b.removeByMsid({url:g.url,source:i.EWorkerSource.Receiver,kind:"audio",msid:g.aMsid[0]})})}},D.prototype.publishAdd=function(A){return h(this,void 0,void 0,function(){var b,g,O,k,U,w,W,M,N,P,V,j=this;return v(this,function(z){switch(z.label){case 0:if(A.forEach(function(G){var X;(X=j.reporter)===null||X===void 0||X.reportStartPublish(G.url,"",!0)}),b=new Date().getTime(),!this.peerconnection)throw this.makeRtsError("publishAdd");z.label=1;case 1:return z.trys.push([1,3,,4]),[4,(M=this.peerconnection)===null||M===void 0?void 0:M.pubAdd(A)];case 2:if(!(g=z.sent()))throw new t.RtsError(n.ErrorCode.ERROR_PUBADD_NO_RESULT,"pubAdd streamList not found","",{api:"publishAdd",publishInfoList:A});return[3,4];case 3:throw O=z.sent(),k=O,(N=this.reporter)===null||N===void 0||N.reportErrorInfo(k.errorCode,k.message,k.traceId,k.extraInfo),k;case 4:return this.peerconnection.isReused=!0,U=new Date().getTime(),w=U-b,g.forEach(function(G){var X;(X=j.reporter)===null||X===void 0||X.reportPublishOk(G.url||"","",-1,-1,-1,G.traceId||"",w,!0)}),(W=(P=this.peerconnection)===null||P===void 0?void 0:P.getPc())&&(A.forEach(function(G){j.peerconnection&&G.stream.setEncodeParam(W)}),this.peerCore&&((V=this.peerconnection)===null||V===void 0||V.getPubMonitor().startHeartbeat(W,this.peerCore)),W.getSenders().forEach(function(G){var X;G.track&&((X=j.peerconnection)===null||X===void 0||X.handleEncodedInsertableStreams({sender:G}))})),[2,g]}})})},D.prototype.publishDeleteTracks=function(A){return h(this,void 0,void 0,function(){var b,g,O,k,U;return v(this,function(w){switch(w.label){case 0:if(!this.peerconnection)throw this.makeRtsError("publishDeleteTracks");w.label=1;case 1:return w.trys.push([1,3,,4]),[4,this.peerconnection.pubDeleteTracks(A)];case 2:if(!(b=w.sent()))throw this.makeRtsError("publishDeleteTracks");return this.peerconnection.getPubMonitor().updateSenders(),g=this.peerconnection.getWorkerManager(),A.forEach(function(W){var M,N;!((M=W.vMsid)===null||M===void 0)&&M.length&&g.removeByMsid({url:W.url,source:i.EWorkerSource.Sender,kind:"video",msid:W.vMsid[0]}),!((N=W.aMsid)===null||N===void 0)&&N.length&&g.removeByMsid({url:W.url,source:i.EWorkerSource.Sender,kind:"audio",msid:W.aMsid[0]})}),[3,4];case 3:throw O=w.sent(),k=O,(U=this.reporter)===null||U===void 0||U.reportErrorInfo(k.errorCode,k.message,k.traceId,k.extraInfo),O;case 4:return[2,b]}})})},D.prototype.publishReplaceTracks=function(A){return h(this,void 0,void 0,function(){var b,g,O,k;return v(this,function(U){switch(U.label){case 0:if(!this.peerconnection)throw this.makeRtsError("publishReplaceTracks");U.label=1;case 1:return U.trys.push([1,3,,4]),[4,this.peerconnection.pubReplaceTracks(A)];case 2:if(!(b=U.sent()))throw this.makeRtsError("publishReplaceTracks");return this.peerconnection.getPubMonitor().updateSenders(),[3,4];case 3:throw g=U.sent(),O=g,(k=this.reporter)===null||k===void 0||k.reportErrorInfo(O.errorCode,O.message,O.traceId,O.extraInfo),g;case 4:return[2,b]}})})},D.prototype.publishStop=function(A){return h(this,void 0,void 0,function(){var b,g,O,k,U,w=this;return v(this,function(W){switch(W.label){case 0:if(A.forEach(function(M){var N;(N=w.reporter)===null||N===void 0||N.reportStopPublish(M.url,!0)}),!this.peerconnection)throw this.makeRtsError("publishStop");W.label=1;case 1:return W.trys.push([1,3,,4]),[4,this.peerconnection.pubStop(A)];case 2:return b=W.sent(),this.peerconnection.getPubMonitor().updateSenders(),g=this.peerconnection.getWorkerManager(),A.forEach(function(M){g.removeByUrl({url:M.url,source:i.EWorkerSource.Sender})}),[3,4];case 3:throw O=W.sent(),k=O,(U=this.reporter)===null||U===void 0||U.reportErrorInfo(k.errorCode,k.message,k.traceId,k.extraInfo),O;case 4:return[2,b]}})})},D.prototype.handleAddDatachannel=function(A){return h(this,void 0,void 0,function(){var b,g,O,k,U,w,W,M,N,P,V,j,z=this;return v(this,function(G){switch(G.label){case 0:if(!A.url||!A.signalUrl||!A.msid)throw g=new t.RtsError(n.ErrorCode.ERROR_DATACHANNEL_PARAM,"url, signalUrl, msid is required by subscribe(publish)AddDatachannel",""),(W=this.reporter)===null||W===void 0||W.reportErrorInfo(g.errorCode,g.message,g.traceId,g.extraInfo),g;return b=A.type==="sub",this.waitForOpenPms?[4,this.waitForOpenPms]:[3,2];case 1:G.sent(),this.waitForOpenPms=void 0,G.label=2;case 2:if(this.signalChannel.isOpen)return[3,4];if(console.warn("Creating a new signal channel"),!A.signalUrl)throw g=new t.RtsError(n.ErrorCode.ERROR_SIGNAL_URL,"signal url is required",""),(M=this.reporter)===null||M===void 0||M.reportErrorInfo(g.errorCode,g.message,g.traceId,g.extraInfo),g;return[4,this.initSignalChannel(A)];case 3:G.sent(),this.setPeerconnection(this.signalChannel.getPeerConnection()),this.canAutoAssignDcId=typeof((N=this.signalChannel.datachannelCore)===null||N===void 0?void 0:N.id)=="number",G.label=4;case 4:if(O=performance.now(),k={url:A.url,label:A.label,surl:A.signalUrl,msid:A.msid},b?(P=this.reporter)===null||P===void 0||P.reportDatachannelSubAdd(k):(V=this.reporter)===null||V===void 0||V.reportDatachannelPubAdd(k),!(U=(j=this.peerconnection)===null||j===void 0?void 0:j.getPc()))throw new Error("No avaliable peerconnection");return w=new C.DataChannelCore({pc:U,label:A.label,datachannelList:this.datachannelList.list,assignId:!this.canAutoAssignDcId,delayOpen:a.configProvider.getContext().datachannelDelayOpen}),this.datachannelList.update(w),[2,new Promise(function(X,re){return h(z,void 0,void 0,function(){var te,oe,ue,se,ce,de,pe,he,Ee,fe,me,ge,be,Re,Te,Pe,Oe=this;return v(this,function(Ae){switch(Ae.label){case 0:te="",oe=!1,ue=!1,w.on("statusChange",function(_e){var xe;(xe=Oe.reporter)===null||xe===void 0||xe.reportDatachannelStatusChange({state:C.EDatachannelStatus[_e],url:A.url,label:w.label,id:w.id,msid:A.msid}),_e===C.EDatachannelStatus.DATACHANNEL_STATUS_OPEN&&(oe=!0,ue&&X({datachannel:w,traceId:te}))}),w.on("dispose",function(){var _e;(_e=Oe.reporter)===null||_e===void 0||_e.reportDatachannelDispose({url:A.url,label:w.label,id:w.id,msid:A.msid})}),Ae.label=1;case 1:return Ae.trys.push([1,6,,7]),se=[{url:A.url,msid:A.msid,datachannelId:w.id,label:A.label,datachannel:w}],b?[4,(fe=this.peerCore)===null||fe===void 0?void 0:fe.subscribeAddDatachannel(se)]:[3,3];case 2:return de=Ae.sent(),[3,5];case 3:return[4,(me=this.peerCore)===null||me===void 0?void 0:me.publishAddDatachannel(se)];case 4:de=Ae.sent(),Ae.label=5;case 5:return te=(be=(ge=(ce=de)==null?void 0:ce.streams)===null||ge===void 0?void 0:ge[0])===null||be===void 0?void 0:be.traceid,[3,7];case 6:return pe=Ae.sent(),he=pe,(Re=this.reporter)===null||Re===void 0||Re.reportErrorInfo(he.errorCode,he.message||"datachannel ".concat(b?"sub":"pub"," add error"),he.traceId,he.extraInfo),[2,re(pe)];case 7:return Ee={url:A.url,drct:Math.floor(performance.now()-O),tcid:te,label:w.label,id:w.id,msid:A.msid},b?(Te=this.reporter)===null||Te===void 0||Te.reportDatachannelSubAddOk(Ee):(Pe=this.reporter)===null||Pe===void 0||Pe.reportDatachannelPubAddOk(Ee),ue=!0,oe&&X({datachannel:w,traceId:te}),[2]}})})})]}})})},D.prototype.handleStopDatachannel=function(A){return h(this,void 0,void 0,function(){var b,g,O,k,U,w,W,M,N,P,V,j;return v(this,function(z){switch(z.label){case 0:if(!A.url||!A.datachannel)throw b=new t.RtsError(n.ErrorCode.ERROR_DATACHANNEL_PARAM,"url, datachannel is required by subscribe(publish)StopDatachannel",""),(U=this.reporter)===null||U===void 0||U.reportErrorInfo(b.errorCode,b.message,b.traceId,b.extraInfo),b;if(!this.signalChannel.isOpen)throw b=new t.RtsError(n.ErrorCode.ERROR_NO_DATACHANNEL,"Signal channel is closed",""),(w=this.reporter)===null||w===void 0||w.reportErrorInfo(b.errorCode,b.message,b.traceId,b.extraInfo),b;g=A.type==="sub",O=[{url:A.url}],k={url:A.url,label:A.datachannel.label,id:A.datachannel.id},g?(W=this.reporter)===null||W===void 0||W.reportDatachannelSubStop(k):(M=this.reporter)===null||M===void 0||M.reportDatachannelPubStop(k),z.label=1;case 1:return z.trys.push([1,6,,7]),g?[4,(N=this.peerCore)===null||N===void 0?void 0:N.subscribeStopDatachannel(O)]:[3,3];case 2:return z.sent(),[3,5];case 3:return[4,(P=this.peerCore)===null||P===void 0?void 0:P.publishStopDatachannel(O)];case 4:z.sent(),z.label=5;case 5:return[3,7];case 6:throw z.sent();case 7:return g?(V=this.reporter)===null||V===void 0||V.reportDatachannelSubStopOk(k):(j=this.reporter)===null||j===void 0||j.reportDatachannelPubStopOk(k),A.datachannel.dispose(),[2]}})})},D.prototype.subscribeAddDatachannel=function(A){return h(this,void 0,void 0,function(){return v(this,function(b){return[2,this.handleAddDatachannel(m(m({},A),{type:"sub"}))]})})},D.prototype.publishAddDatachannel=function(A){return h(this,void 0,void 0,function(){return v(this,function(b){return[2,this.handleAddDatachannel(m(m({},A),{type:"pub"}))]})})},D.prototype.subscribeStopDatachannel=function(A){return h(this,void 0,void 0,function(){return v(this,function(b){return[2,this.handleStopDatachannel(m(m({},A),{type:"sub"}))]})})},D.prototype.publishStopDatachannel=function(A){return h(this,void 0,void 0,function(){return v(this,function(b){return[2,this.handleStopDatachannel(m(m({},A),{type:"pub"}))]})})},D.prototype.getSubscribeVideoStats=function(A,b){return this.getSubscribeMediaStats(A,"video",b)},D.prototype.getSubscribeAudioStats=function(A,b){return this.getSubscribeMediaStats(A,"audio",b)},D.prototype.getPublishVideoStats=function(A,b){return this.getPublishMediaStats(A,"video",b)},D.prototype.getPublishAudioStats=function(A,b){return this.getPublishMediaStats(A,"audio",b)},D.prototype.sendSEI=function(A){var b,g;if(!((b=this.peerconnection)===null||b===void 0)&&b.isReused)return(g=this.peerconnection)===null||g===void 0?void 0:g.sendSEI(A)},D.prototype.setReceiverCodecPreferences=function(A){this.receiverCodecPreferences=m({},A)},D.prototype.setSenderCodecPreferences=function(A){this.senderCodecPreferences=m({},A)},D.prototype.getSubscribeMediaStats=function(A,b,g){var O=this;return new Promise(function(k){return h(O,void 0,void 0,function(){var U,w,W,M,N;return v(this,function(P){switch(P.label){case 0:return this.streamManager?(U=void 0,w=this.streamManager.getAllMediaInfoList(A,!0),g?w.forEach(function(V){var j,z,G,X=(z=(j=V.transceiver)===null||j===void 0?void 0:j.receiver)===null||z===void 0?void 0:z.track;X?.kind===b&&V.msid===g&&(U=(G=V.transceiver)===null||G===void 0?void 0:G.receiver)}):U=(N=(M=w?.find(function(V){var j,z,G;return((G=(z=(j=V.transceiver)===null||j===void 0?void 0:j.receiver)===null||z===void 0?void 0:z.track)===null||G===void 0?void 0:G.kind)===b}))===null||M===void 0?void 0:M.transceiver)===null||N===void 0?void 0:N.receiver,U?(W=!1,[4,U.getStats()]):[2,k({})]):[2,k({})];case 1:return P.sent().forEach(function(V){V.type==="inbound-rtp"&&(W=!0,k(V))}),W||k({}),[2]}})})})},D.prototype.getPublishMediaStats=function(A,b,g){var O=this;return new Promise(function(k){return h(O,void 0,void 0,function(){var U,w,W,M,N;return v(this,function(P){switch(P.label){case 0:return this.streamManager?(U=void 0,w=this.streamManager.getAllMediaInfoList(A,!0),g?w.forEach(function(V){var j,z,G,X=(z=(j=V.transceiver)===null||j===void 0?void 0:j.sender)===null||z===void 0?void 0:z.track;X?.kind===b&&V.msid===g&&(U=(G=V.transceiver)===null||G===void 0?void 0:G.sender)}):U=(N=(M=w?.find(function(V){var j,z,G;return((G=(z=(j=V.transceiver)===null||j===void 0?void 0:j.sender)===null||z===void 0?void 0:z.track)===null||G===void 0?void 0:G.kind)===b}))===null||M===void 0?void 0:M.transceiver)===null||N===void 0?void 0:N.sender,U?(W=!1,[4,U.getStats()]):[2,k({})]):[2,k({})];case 1:return P.sent().forEach(function(V){V.type==="outbound-rtp"&&k(V)}),W||k({}),[2]}})})})},D.prototype.proxySignalChannelEvents=function(){var A=this;this.signalChannel.on("connectStatusChange",function(b){A.emit("connectStatusChange",b)}),this.signalChannel.on("onError",function(b){A.emit("onError",b)})},D.prototype.initSignalChannel=function(A){return this.signalChannel.createDatachannel(A)},D.prototype.makeRtsError=function(A){var b,g=new t.RtsError(n.ErrorCode.ERROR_NO_DATACHANNEL,"No avaliable datachannel, you should subscribe/publish first.","",{api:A});return(b=this.reporter)===null||b===void 0||b.reportErrorInfo(g.errorCode,g.message,g.traceId,g.extraInfo),g},D.prototype.singleStreamReconnect=function(A){var b=this;return new Promise(function(g,O){var k,U,w=A.type,W=void 0,M=void 0;switch(w){case"sub":(k=A.streams)===null||k===void 0||k.forEach(function(P){var V=[],j=[],z=!0,G=!0;A.msids.forEach(function(X){X.streamId===P.id&&(X.type==="video"?j.push(X.name):X.type==="audio"&&V.push(X.name))}),V.length||(z=!1),j.length||(G=!1),b.subscribeAddWithRetry({url:A.latestUrl,subAudio:z,subVideo:G,vMsid:j,aMsid:V,targetStream:P}).then(g).catch(O)});break;case"pub":(U=A.streams)===null||U===void 0||U.forEach(function(P){var V=[],j=[];A.msids.forEach(function(z){z.streamId===P.id&&(z.type==="video"?j.push(z.name):z.type==="audio"&&V.push(z.name))}),b.publishAddWithRetry([{url:A.latestUrl,vMsid:j,aMsid:V,stream:P}]).then(g).catch(O)});break;case"pub-data":if(A.msids.forEach(function(P){W=P.name,M=P.label}),W&&M){var N=A.latestUrl;b.publishAddDatachannelWithRetry({url:N,signalUrl:N,msid:W,label:M}).then(g).catch(O)}break;case"sub-data":A.msids.forEach(function(P){W=P.name,M=P.label}),W&&M&&(N=A.latestUrl,b.subscribeAddDatachannelWithRetry({url:N,signalUrl:N,msid:W,label:M}).then(g).catch(O));break;default:console.warn("RTS PC STREAM RECONNECT: Unknown signal")}})},D.prototype.updateAuth=function(A){var b;return!!(!((b=this.streamManager)===null||b===void 0)&&b.updateLatestUrl(A))},D.prototype.subscribeAddWithRetry=function(A,b){var g=this;return b===void 0&&(b=0),new Promise(function(O,k){g.subscribeAdd([A],!0).then(function(){O()}).catch(function(U){return h(g,void 0,void 0,function(){var w,W;return v(this,function(M){switch(M.label){case 0:return b<(((w=this.config)===null||w===void 0?void 0:w.retryTimes)||0)?[4,d(((W=this.config)===null||W===void 0?void 0:W.retryInterval)||0)]:[3,2];case 1:return M.sent(),[2,this.subscribeAddWithRetry(A,b+1).then(O).catch(k)];case 2:k(U),M.label=3;case 3:return[2]}})})})})},D.prototype.publishAddWithRetry=function(A,b){var g=this;return b===void 0&&(b=0),new Promise(function(O,k){g.publishAdd(A).then(function(){O()}).catch(function(U){return h(g,void 0,void 0,function(){var w,W;return v(this,function(M){switch(M.label){case 0:return b<(((w=this.config)===null||w===void 0?void 0:w.retryTimes)||0)?[4,d(((W=this.config)===null||W===void 0?void 0:W.retryInterval)||0)]:[3,2];case 1:return M.sent(),[2,this.publishAddWithRetry(A,b+1).then(O).catch(k)];case 2:k(U),M.label=3;case 3:return[2]}})})})})},D.prototype.subscribeAddDatachannelWithRetry=function(A,b){var g=this;return b===void 0&&(b=0),new Promise(function(O,k){g.subscribeAddDatachannel(A).then(function(){O()}).catch(function(U){return h(g,void 0,void 0,function(){var w,W;return v(this,function(M){switch(M.label){case 0:return b<(((w=this.config)===null||w===void 0?void 0:w.retryTimes)||0)?[4,d(((W=this.config)===null||W===void 0?void 0:W.retryInterval)||0)]:[3,2];case 1:return M.sent(),[2,this.subscribeAddDatachannelWithRetry(A,b+1).then(O).catch(k)];case 2:k(U),M.label=3;case 3:return[2]}})})})})},D.prototype.publishAddDatachannelWithRetry=function(A,b){var g=this;return b===void 0&&(b=0),new Promise(function(O,k){g.publishAddDatachannel(A).then(function(){O()}).catch(function(U){return h(g,void 0,void 0,function(){var w,W;return v(this,function(M){switch(M.label){case 0:return b<(((w=this.config)===null||w===void 0?void 0:w.retryTimes)||0)?[4,d(((W=this.config)===null||W===void 0?void 0:W.retryInterval)||0)]:[3,2];case 1:return M.sent(),[2,this.publishAddDatachannelWithRetry(A,b+1).then(O).catch(k)];case 2:k(U),M.label=3;case 3:return[2]}})})})})},D}(e.default);T.CommonController=E;var S=function(){function R(){this._list=[]}return Object.defineProperty(R.prototype,"list",{get:function(){return this._list},enumerable:!1,configurable:!0}),R.prototype.update=function(D){var A=this._list.findIndex(function(b){return b.id===D.id});A!==-1?this._list.splice(A,1,D):this._list.push(D)},R}();function d(R){return R===void 0&&(R=1e3),new Promise(function(D){setTimeout(D,R)})}},9796:function(H,T,_){var f,l=this&&this.__extends||(f=function(x,y){return f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(E,S){E.__proto__=S}||function(E,S){for(var d in S)Object.prototype.hasOwnProperty.call(S,d)&&(E[d]=S[d])},f(x,y)},function(x,y){if(typeof y!="function"&&y!==null)throw new TypeError("Class extends value "+String(y)+" is not a constructor or null");function E(){this.constructor=x}f(x,y),x.prototype=y===null?Object.create(y):(E.prototype=y.prototype,new E)}),m=this&&this.__assign||function(){return m=Object.assign||function(x){for(var y,E=1,S=arguments.length;E<S;E++)for(var d in y=arguments[E])Object.prototype.hasOwnProperty.call(y,d)&&(x[d]=y[d]);return x},m.apply(this,arguments)},h=this&&this.__awaiter||function(x,y,E,S){return new(E||(E=Promise))(function(d,R){function D(g){try{b(S.next(g))}catch(O){R(O)}}function A(g){try{b(S.throw(g))}catch(O){R(O)}}function b(g){var O;g.done?d(g.value):(O=g.value,O instanceof E?O:new E(function(k){k(O)})).then(D,A)}b((S=S.apply(x,y||[])).next())})},v=this&&this.__generator||function(x,y){var E,S,d,R,D={label:0,sent:function(){if(1&d[0])throw d[1];return d[1]},trys:[],ops:[]};return R={next:A(0),throw:A(1),return:A(2)},typeof Symbol=="function"&&(R[Symbol.iterator]=function(){return this}),R;function A(b){return function(g){return function(O){if(E)throw new TypeError("Generator is already executing.");for(;R&&(R=0,O[0]&&(D=0)),D;)try{if(E=1,S&&(d=2&O[0]?S.return:O[0]?S.throw||((d=S.return)&&d.call(S),0):S.next)&&!(d=d.call(S,O[1])).done)return d;switch(S=0,d&&(O=[2&O[0],d.value]),O[0]){case 0:case 1:d=O;break;case 4:return D.label++,{value:O[1],done:!1};case 5:D.label++,S=O[1],O=[0];continue;case 7:O=D.ops.pop(),D.trys.pop();continue;default:if(d=D.trys,!((d=d.length>0&&d[d.length-1])||O[0]!==6&&O[0]!==2)){D=0;continue}if(O[0]===3&&(!d||O[1]>d[0]&&O[1]<d[3])){D.label=O[1];break}if(O[0]===6&&D.label<d[1]){D.label=d[1],d=O;break}if(d&&D.label<d[2]){D.label=d[2],D.ops.push(O);break}d[2]&&D.ops.pop(),D.trys.pop();continue}O=y.call(x,D)}catch(k){O=[6,k],S=0}finally{E=d=0}if(5&O[0])throw O[1];return{value:O[0]?O[1]:void 0,done:!0}}([b,g])}}},u=this&&this.__importDefault||function(x){return x&&x.__esModule?x:{default:x}};Object.defineProperty(T,"__esModule",{value:!0}),T.Publisher=void 0;var s=_(5917),i=_(4865),e=u(_(7028)),o=_(9428),r=_(5044),a=_(7989),t=u(_(102)),n=u(_(8219)),c=_(2718),p=u(_(1401)),C=function(x){function y(E){var S=x.call(this)||this;return S.publishStartTimeStamp=0,S.pubReconnectTimes=0,S.isConnecting=!1,S.reconnectTimerHandle=null,S.reportMonitorTimes=0,S.reportSubFlag=!1,S.reporter=E,S.peerconnection=new i.RtsPeerconnection,S.peerconnection.on("connectStatusChange",function(d){d.status!==s.EConnectStatus.CONNECT_STATUS_DISCONNECTED&&d.status!==s.EConnectStatus.CONNECT_STATUS_RECONNECTING||!S.hasRetries()?S.emit("connectStatusChange",d):S.emit("onError",new r.RtsError(o.ErrorCode.ERROR_PC_DISCONNECTED,"PC disconnected",""))}),S.peerconnection.on("onMonitorEvent",function(d){var R,D=d.eventList;(R=S.peerconnection)===null||R===void 0||R.updateStatsForSEI(D,d.type),d.type==="pub"?(S.reportMonitorTimes++,S.reportMonitorTimes%4==0&&(D.forEach(function(A){S.reporter.reportPushStats(A)}),S.reportSubFlag=!0,S.reportMonitorTimes=0)):d.type==="sub"&&S.reportSubFlag&&(S.handleSubMonitorEvent(D),S.reportSubFlag=!1)}),S.peerconnection.on("onTransportStateEvent",function(d){var R;S.peerconnection.isReused||((R=S.peerconnection.getPc())===null||R===void 0?void 0:R.connectionState)!=="closed"&&d.state==="closed"&&S.hasRetries()&&S.emit("onError",new r.RtsError(o.ErrorCode.ERROR_TRANSPORT_CLOSED,"Transport has been closed. ".concat(d.kind,"|").concat(d.type,"|").concat(d.url),"",{protocol:d.protocol}))}),S.peerconnection.on("pcReconnect",function(d){var R,D;d.ips?(R="Migrate with ips: ".concat((0,p.default)(d.ips)),D=o.ErrorCode.ERROR_IP_MIGRATE):(R="PC disconnected",D=o.ErrorCode.ERROR_PC_DISCONNECTED),S.emit("onError",new r.RtsError(D,R,"",{pcErrorInfo:d}))}),S.signalingUrl="",S.publishUrl="",S.publishConfig={},S}return l(y,x),y.prototype.publish=function(E,S,d){var R=this;return new Promise(function(D,A){if(R.unpublish(),d?.cumuDelay&&(d.encodedInsertableStreams=!0),R.localStream=S,R.publishUrl=E,R.publishConfig=d||{},R.checkPublishUrl())if(S)if(S.audioTrack===null)A(new r.RtsError(o.ErrorCode.ERROR_PUBLISH_NOAUDIO,"publish need audiotrack",""));else{var b=d?.signalUrl;R.signalingUrl=b||R.signalingUrl,R.publishStartTimeStamp=new Date().getTime(),S.setReporter(R.reporter),R.peerconnection.createOffer(S.hasAudio,S.hasVideo||S.hasScreen,S,m(m({},d),{publishUrl:E})).then(function(g){var O=g.desp,k=g.publishTrackInfoList;R.publishTrackInfoList=k;var U=new Date().getTime();R.reporter.reportStartPublish(R.publishUrl,R.signalingUrl),R.excuteSignal(O).then(function(w){var W=new Date().getTime();R.peerconnection.recvAnswer(w.data,{answerSdpHook:d?.answerSdpHook,tcpOnly:d?.tcpOnly}).then(function(){R.reporter.reportPublishOk(R.publishUrl,R.signalingUrl,U-R.publishStartTimeStamp,W-U,new Date().getTime()-W,w.data.trace_id),D(w.data.trace_id),R.pubReconnectTimes=0,R.peerconnection.pushStart()}).catch(function(M){M.traceid=w.data?w.data.trace_id:"";var N=new r.RtsError(M.errorCode||o.ErrorCode.ERROR_ANSWER_ERROR,M.message||"set answer error",M.traceid,{sdp:M.sdp});A(N)})}).catch(function(w){var W=new r.RtsError(w.errorCode||o.ErrorCode.ERROR_HTTPREQUEST_ERROR,w.message||"","",{response:w.response,sdp:w.sdp});A(W)})}).catch(function(g){var O=new r.RtsError(g.errorCode||o.ErrorCode.ERROR_CREATEOFFER,g.message||"","");A(O)})}else A(new r.RtsError(o.ErrorCode.ERROR_PUBLISH_NOSTREAM,"publish stream not found",""));else A(new r.RtsError(o.ErrorCode.ERROR_PUBLISH_URL,"url need artc://",""))})},y.prototype.unpublish=function(){this.peerconnection.reset(),this.reporter.reportStopPublish(),this.signalingUrl="",this.publishUrl="",this.publishTrackInfoList=null},y.prototype.getTrackInfoList=function(){return this.publishTrackInfoList||[]},y.prototype.getPeerConnection=function(){return this.peerconnection},y.prototype.replaceTrack=function(E,S){return this.peerconnection.replaceTrack(this.publishUrl,E,S)},y.prototype.excuteSignal=function(E){var S,d=this,R={type:E.type,sdp:E.sdp};return this.isSingleMsid()&&(R.sdp=R.sdp.replace(/msid\:-? /g,"msid:")),!((S=this.publishConfig)===null||S===void 0)&&S.cumuDelay&&(R.sdp=R.sdp.replace(/(m=video[^\n]*\n)/,`$1a=cumudelay
148
+ `)),new Promise(function(D,A){n.default.post(d.signalingUrl,{version:e.default.protocol_version,sdk_version:e.default.sdk_version,mode:"rtc",push_stream:d.publishUrl,jsep:R}).then(function(b){var g,O,k,U;if(b&&b.status===200){D(b);try{!((g=d.publishConfig)===null||g===void 0)&&g.cumuDelay&&!(!((k=(O=b.data)===null||O===void 0?void 0:O.jsep)===null||k===void 0)&&k.sdp.includes("a=cumudelay"))&&(console.warn("Not found cumudelay in server sdp"),(U=d.reporter)===null||U===void 0||U.reportCumuDelayAnswerNotFound())}catch{}}else A({message:b?"response status:"+b.status:"response is null",sdp:R.sdp})}).catch(function(b){return h(d,void 0,void 0,function(){var g,O;return v(this,function(k){switch(k.label){case 0:if(![400,500].includes((O=b.response)===null||O===void 0?void 0:O.status))return[3,4];b.sdp=E.sdp,k.label=1;case 1:return k.trys.push([1,3,,4]),[4,new a.SupportUtil().isSupport({isReceiveVideo:!0})];case 2:return k.sent(),[3,4];case 3:return g=k.sent(),b.errorCode=g?.errorCode,b.message=g?.message,this.pubReconnectTimes=1/0,[3,4];case 4:return A(b),[2]}})})})})},y.prototype.checkPublishUrl=function(){if(!this.publishUrl||this.publishUrl.indexOf("artc://")!==0)return!1;var E=window.location.protocol,S=(["http:","https:"].indexOf(E)>-1?E:"https:")+"//";return this.signalingUrl=this.publishUrl.replace("artc://",S),!0},y.prototype.isSingleMsid=function(){if(!this.publishConfig)return!1;var E=this.publishConfig,S=E.vMsid,d=E.aMsid;return!(!S||!S[0]||S[0].indexOf(" ")!==-1)||!(!d||!d[0]||d[0].indexOf(" ")!==-1)},y.prototype.retryPublish=function(E,S){return h(this,void 0,void 0,function(){var d,R,D,A,b,g,O;return v(this,function(k){switch(k.label){case 0:if(E.extraInfo=m(m({},E.extraInfo),{retryTimes:this.pubReconnectTimes}),!this.hasRetries())return[2,!1];if(typeof(d=this.publishConfig).beforeRetry!="function")return[3,4];k.label=1;case 1:return k.trys.push([1,3,,4]),[4,d.beforeRetry({url:this.publishUrl,stream:this.localStream,vMsid:d.vMsid,aMsid:d.aMsid,useTcp:S})];case 2:return(R=k.sent())?(D=R.url,A=R.stream,b=R.vMsid,g=R.aMsid,A||(console.error("Stream is not returned by beforeRetry function."),this.pubReconnectTimes=1/0),this.reporter.reportReconnectParams("pub",D,b,g,R.useTcp,A?.id),this.publishUrl=D,this.localStream=A,this.publishConfig.vMsid=b,this.publishConfig.aMsid=g,typeof R.useTcp=="boolean"&&(S=R.useTcp),console.log(`Retry with:
149
+ [URL] `.concat(D,`
150
+ [STREAM] `).concat(A?.id,`
151
+ [VMSID]`).concat(b," [AMSID]").concat(g,`
152
+ [PROTOCOL] `).concat(S?"TCP":"UDP"))):(this.reporter.reportReconnectParams("pub"),this.pubReconnectTimes=1/0),[3,4];case 3:return O=k.sent(),console.error("Error in beforeRetry",O),[3,4];case 4:return this.hasRetries()&&this.localStream?(this.emit("connectStatusChange",{status:s.EConnectStatus.CONNECT_STATUS_RECONNECTING}),this.incrementReconnectTimes(),E.extraInfo.retryTimes=this.pubReconnectTimes,E.extraInfo.tcpOnly=!!S,this.publishWithReconnect(this.publishUrl,this.localStream,m(m({},this.publishConfig),{tcpOnly:!!S})).catch(function(U){}),[2,!0]):(E.extraInfo.retryTimes=this.pubReconnectTimes,[2,!1])}})})},y.prototype.publishWithReconnect=function(E,S,d,R,D){var A=this;return new Promise(function(b,g){b=R||b,g=D||g,A.isConnecting=!0,A.publish(E,S,d).then(function(O){A.isConnecting=!1,b(O)}).catch(function(O){var k;if(A.peerconnection.reset(),!A.isConnecting)return g(O);if(!o.RECONNECT_ERROR_EXCLUDE_LIST.includes(O.errorCode)&&A.hasRetries(!0)){var U=((k=A.publishConfig)===null||k===void 0?void 0:k.retryInterval)||s.DEFAULT_RETRY_PUBLISH_INTERVAL;A.reconnectTimerHandle=setTimeout(function(){O.extraInfo=m(m({},O.extraInfo),{retryTimes:A.pubReconnectTimes}),A.emit("reconnect",O),A.publishWithReconnect(E,S,d,b,g)},U)}else g(O),O.extraInfo=m(m({},O.extraInfo),{retryTimes:A.pubReconnectTimes}),A.isConnecting=!1,A.emit("onError",O)})})},y.prototype.sendSEI=function(E){var S;(S=this.peerconnection)===null||S===void 0||S.sendSEI(E)},y.prototype.hasRetries=function(E){var S,d,R=s.DEFAULT_RETRY_PUBLISH_LIMIT;typeof((S=this.publishConfig)===null||S===void 0?void 0:S.retryTimes)=="number"&&(R=Math.floor((d=this.publishConfig)===null||d===void 0?void 0:d.retryTimes));var D=this.pubReconnectTimes<R;return E&&D&&this.incrementReconnectTimes(),D},y.prototype.resetRepublishStatus=function(){this.pubReconnectTimes=0,this.isConnecting=!1,this.reporter.updateTid(),this.reconnectTimerHandle!==null&&(clearTimeout(this.reconnectTimerHandle),this.reconnectTimerHandle=null)},y.prototype.handleSubMonitorEvent=function(E){var S=this;E.forEach(function(d){var R={ct:0,tt:4e3,url:d.url},D=d.video,A=d.audio;if(D){var b=D.transportStats,g=D.inboundRtpStats,O=D.inboundRtpStatsPerSec,k=D.localCandidate,U=D.remoteCandidate;R=m(m({},R),{rtt:b?.rtt!==-1?1e3*(b?.rtt||0):-1,cand_re_prot:U.protocol,cand_lo_prot:k.protocol,cand_re_addr:"".concat(U.ip||U.address,":").concat(U.port),cand_lo_addr:"".concat(k.ip||k.address,":").concat(k.port),w:g?.frameWidth,h:g?.frameHeight,vbps:Math.floor(8*O.bytesReceivedPerSecond),fps:g?.framesPerSecond,dfps:Math.floor(O?.framesDecodedPerSecond),vjb:Math.floor((0,c.getJitterBufferDelayAvg)(g?.jitterBufferDelay,g?.jitterBufferEmittedCount)),vMsid:d.vMsid})}A&&(b=A.transportStats,g=A.inboundRtpStats,O=A.inboundRtpStatsPerSec,k=A.localCandidate,U=A.remoteCandidate,R=m(m({},R),{rtt:b?.rtt!==-1?1e3*(b?.rtt||0):-1,cand_re_prot:U.protocol,cand_lo_prot:k.protocol,cand_re_addr:"".concat(U.ip||U.address,":").concat(U.port),cand_lo_addr:"".concat(k.ip||k.address,":").concat(k.port),abps:Math.floor(8*O.bytesReceivedPerSecond),ajb:Math.floor((0,c.getJitterBufferDelayAvg)(g?.jitterBufferDelay,g.jitterBufferEmittedCount)),aMsid:d.aMsid})),S.reporter.reportPullStats(R)})},y.prototype.incrementReconnectTimes=function(){this.pubReconnectTimes++},y.prototype.getPublishConfig=function(){return this.publishConfig},y}(t.default);T.Publisher=C},5788:function(H,T,_){var f,l=this&&this.__extends||(f=function(n,c){return f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(p,C){p.__proto__=C}||function(p,C){for(var x in C)Object.prototype.hasOwnProperty.call(C,x)&&(p[x]=C[x])},f(n,c)},function(n,c){if(typeof c!="function"&&c!==null)throw new TypeError("Class extends value "+String(c)+" is not a constructor or null");function p(){this.constructor=n}f(n,c),n.prototype=c===null?Object.create(c):(p.prototype=c.prototype,new p)}),m=this&&this.__awaiter||function(n,c,p,C){return new(p||(p=Promise))(function(x,y){function E(R){try{d(C.next(R))}catch(D){y(D)}}function S(R){try{d(C.throw(R))}catch(D){y(D)}}function d(R){var D;R.done?x(R.value):(D=R.value,D instanceof p?D:new p(function(A){A(D)})).then(E,S)}d((C=C.apply(n,c||[])).next())})},h=this&&this.__generator||function(n,c){var p,C,x,y,E={label:0,sent:function(){if(1&x[0])throw x[1];return x[1]},trys:[],ops:[]};return y={next:S(0),throw:S(1),return:S(2)},typeof Symbol=="function"&&(y[Symbol.iterator]=function(){return this}),y;function S(d){return function(R){return function(D){if(p)throw new TypeError("Generator is already executing.");for(;y&&(y=0,D[0]&&(E=0)),E;)try{if(p=1,C&&(x=2&D[0]?C.return:D[0]?C.throw||((x=C.return)&&x.call(C),0):C.next)&&!(x=x.call(C,D[1])).done)return x;switch(C=0,x&&(D=[2&D[0],x.value]),D[0]){case 0:case 1:x=D;break;case 4:return E.label++,{value:D[1],done:!1};case 5:E.label++,C=D[1],D=[0];continue;case 7:D=E.ops.pop(),E.trys.pop();continue;default:if(x=E.trys,!((x=x.length>0&&x[x.length-1])||D[0]!==6&&D[0]!==2)){E=0;continue}if(D[0]===3&&(!x||D[1]>x[0]&&D[1]<x[3])){E.label=D[1];break}if(D[0]===6&&E.label<x[1]){E.label=x[1],x=D;break}if(x&&E.label<x[2]){E.label=x[2],E.ops.push(D);break}x[2]&&E.ops.pop(),E.trys.pop();continue}D=c.call(n,E)}catch(A){D=[6,A],C=0}finally{p=x=0}if(5&D[0])throw D[1];return{value:D[0]?D[1]:void 0,done:!0}}([d,R])}}},v=this&&this.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(T,"__esModule",{value:!0}),T.SignalChannel=void 0;var u=v(_(7028)),s=_(4865),i=v(_(102)),e=v(_(8219)),o=_(9428),r=_(5044),a=_(280),t=function(n){function c(p){var C=n.call(this)||this;return C.reporter=p.reporter,C}return l(c,n),Object.defineProperty(c.prototype,"isOpen",{get:function(){return this.readyState==="open"},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"readyState",{get:function(){var p,C;return((p=this.peerconnection)===null||p===void 0?void 0:p.isConnected)&&((C=this.datachannelCore)===null||C===void 0?void 0:C.readyState)},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"datachannelCore",{get:function(){var p,C,x;return(x=(C=(p=this.peerconnection)===null||p===void 0?void 0:p.getPeerCore())===null||C===void 0?void 0:C.getSignal())===null||x===void 0?void 0:x.getDatachannelCore()},enumerable:!1,configurable:!0}),c.prototype.getPeerConnection=function(){return this.peerconnection},c.prototype.setPeerConnection=function(p){this.peerconnection=p},c.prototype.createDatachannel=function(p){return m(this,void 0,void 0,function(){var C,x,y,E,S,d,R,D,A,b,g,O;return h(this,function(k){switch(k.label){case 0:if(C=p.signalUrl,!this.checkUrl(C))throw new r.RtsError(o.ErrorCode.ERROR_DATACHANNEL_PARAM,"url need artc://","");this.closeDatachannel(),this.createPC(),this.reporter.updateUrl(C),this.reporter.reportDatachannelHttpConnect(C),x=performance.now(),k.label=1;case 1:return k.trys.push([1,3,,4]),[4,(b=this.peerconnection)===null||b===void 0?void 0:b.createOffer(!1,!1,void 0,p)];case 2:return y=k.sent(),[3,4];case 3:return E=k.sent(),this.throwRtsError(new r.RtsError(E.errorCode||o.ErrorCode.ERROR_CREATEOFFER,E.message||"","")),[3,4];case 4:d="",k.label=5;case 5:return k.trys.push([5,7,,8]),[4,this.excuteSignal(y.desp)];case 6:return S=k.sent(),d=((g=S?.data)===null||g===void 0?void 0:g.trace_id)||"",this.reporter.reportDatachannelHttpConnectOk({url:C,hrct:Math.floor(performance.now()-x),tcid:d}),[3,8];case 7:return R=k.sent(),this.throwRtsError(new r.RtsError(R.errorCode||o.ErrorCode.ERROR_HTTPREQUEST_ERROR,R.message||"",d)),[3,8];case 8:return k.trys.push([8,10,,11]),[4,(O=this.peerconnection)===null||O===void 0?void 0:O.recvAnswer(S?.data,{answerSdpHook:p.answerSdpHook})];case 9:return k.sent(),[3,11];case 10:return D=k.sent(),this.throwRtsError(new r.RtsError(D.errorCode||o.ErrorCode.ERROR_ANSWER_ERROR,D.message||"set answer error",d)),[3,11];case 11:return k.trys.push([11,13,,14]),[4,this.waitForOpen()];case 12:return k.sent(),[3,14];case 13:return A=k.sent(),this.throwRtsError(new r.RtsError(o.ErrorCode.ERROR_DATACHANNEL_OPEN,"datachannel open failed: ".concat(A),d)),[3,14];case 14:return[2,d]}})})},c.prototype.waitForOpen=function(){var p,C=this;return new Promise(function(x,y){var E;p=window.setTimeout(function(){var d;(d=C.peerconnection)===null||d===void 0||d.off("datachannelStatusChange",S),p=void 0,y("timeout")},5e3);var S=function(d){p&&(clearTimeout(p),p=void 0),d.status===a.EDatachannelStatus.DATACHANNEL_STATUS_OPEN?x(!0):y("status is ".concat(d.status))};(E=C.peerconnection)===null||E===void 0||E.once("datachannelStatusChange",S)})},c.prototype.excuteSignal=function(p){return m(this,void 0,void 0,function(){var C;return h(this,function(x){switch(x.label){case 0:return[4,e.default.post(this.signalUrl,{version:u.default.protocol_version,sdk_version:u.default.sdk_version,mode:"live",jsep:p})];case 1:if(((C=x.sent())==null?void 0:C.status)!==200)throw new r.RtsError(o.ErrorCode.ERROR_SIGNAL_ERROR,C?"response status:"+C.status:"response is null","");return[2,C]}})})},c.prototype.closeDatachannel=function(){var p;(p=this.peerconnection)===null||p===void 0||p.reset()},c.prototype.checkUrl=function(p){var C="artc://";if(p&&p.indexOf(C)===0){var x=window.location.protocol,y=(["http:","https:"].indexOf(x)>-1?x:"https:")+"//";return this.signalUrl=p.replace(C,y),!0}},c.prototype.throwRtsError=function(p){throw this.emit("onError",p),p},c.prototype.createPC=function(){var p=this;this.peerconnection=new s.RtsPeerconnection,this.peerconnection.on("connectStatusChange",function(C){p.emit("connectStatusChange",C)})},c}(i.default);T.SignalChannel=t},2550:function(H,T,_){var f,l=this&&this.__extends||(f=function(x,y){return f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(E,S){E.__proto__=S}||function(E,S){for(var d in S)Object.prototype.hasOwnProperty.call(S,d)&&(E[d]=S[d])},f(x,y)},function(x,y){if(typeof y!="function"&&y!==null)throw new TypeError("Class extends value "+String(y)+" is not a constructor or null");function E(){this.constructor=x}f(x,y),x.prototype=y===null?Object.create(y):(E.prototype=y.prototype,new E)}),m=this&&this.__assign||function(){return m=Object.assign||function(x){for(var y,E=1,S=arguments.length;E<S;E++)for(var d in y=arguments[E])Object.prototype.hasOwnProperty.call(y,d)&&(x[d]=y[d]);return x},m.apply(this,arguments)},h=this&&this.__awaiter||function(x,y,E,S){return new(E||(E=Promise))(function(d,R){function D(g){try{b(S.next(g))}catch(O){R(O)}}function A(g){try{b(S.throw(g))}catch(O){R(O)}}function b(g){var O;g.done?d(g.value):(O=g.value,O instanceof E?O:new E(function(k){k(O)})).then(D,A)}b((S=S.apply(x,y||[])).next())})},v=this&&this.__generator||function(x,y){var E,S,d,R,D={label:0,sent:function(){if(1&d[0])throw d[1];return d[1]},trys:[],ops:[]};return R={next:A(0),throw:A(1),return:A(2)},typeof Symbol=="function"&&(R[Symbol.iterator]=function(){return this}),R;function A(b){return function(g){return function(O){if(E)throw new TypeError("Generator is already executing.");for(;R&&(R=0,O[0]&&(D=0)),D;)try{if(E=1,S&&(d=2&O[0]?S.return:O[0]?S.throw||((d=S.return)&&d.call(S),0):S.next)&&!(d=d.call(S,O[1])).done)return d;switch(S=0,d&&(O=[2&O[0],d.value]),O[0]){case 0:case 1:d=O;break;case 4:return D.label++,{value:O[1],done:!1};case 5:D.label++,S=O[1],O=[0];continue;case 7:O=D.ops.pop(),D.trys.pop();continue;default:if(d=D.trys,!((d=d.length>0&&d[d.length-1])||O[0]!==6&&O[0]!==2)){D=0;continue}if(O[0]===3&&(!d||O[1]>d[0]&&O[1]<d[3])){D.label=O[1];break}if(O[0]===6&&D.label<d[1]){D.label=d[1],d=O;break}if(d&&D.label<d[2]){D.label=d[2],D.ops.push(O);break}d[2]&&D.ops.pop(),D.trys.pop();continue}O=y.call(x,D)}catch(k){O=[6,k],S=0}finally{E=d=0}if(5&O[0])throw O[1];return{value:O[0]?O[1]:void 0,done:!0}}([b,g])}}},u=this&&this.__rest||function(x,y){var E={};for(var S in x)Object.prototype.hasOwnProperty.call(x,S)&&y.indexOf(S)<0&&(E[S]=x[S]);if(x!=null&&typeof Object.getOwnPropertySymbols=="function"){var d=0;for(S=Object.getOwnPropertySymbols(x);d<S.length;d++)y.indexOf(S[d])<0&&Object.prototype.propertyIsEnumerable.call(x,S[d])&&(E[S[d]]=x[S[d]])}return E},s=this&&this.__importDefault||function(x){return x&&x.__esModule?x:{default:x}};Object.defineProperty(T,"__esModule",{value:!0}),T.LocalStream=void 0;var i=_(5805),e=_(3412),o=_(5044),r=_(9428),a=_(5259),t=_(233),n=s(_(335)),c=_(6295),p=_(2718),C=function(x){function y(){var E=x.call(this)||this;return E.screenSurfaceType="",E.VideoProfileMap=new Map(a.VideoProfileMap),E.ScreenProfileMap=new Map(a.ScreenProfileMap),E.AudioProfileMap=new Map(a.AudioProfileMap),E.deviceManager=new e.BrowserDeviceManager,E.mediastream=new MediaStream,E.hasVideo=!1,E.hasScreen=!1,E.videoProfile="360p_1",E.screenProfile="720p_1",E.audioProfile="standard",E.isCustomStream=!1,E.handleVideoTrackEnded=E.handleVideoTrackEnded.bind(E),E.handleAudioTrackEnded=E.handleAudioTrackEnded.bind(E),E}return l(y,x),Object.defineProperty(y.prototype,"mediaStream",{get:function(){return this.mediastream},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"audioTrack",{get:function(){return this.audiotrack},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"videoTrack",{get:function(){return this.videotrack},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"hasAudio",{get:function(){return!!this.audioTrack},enumerable:!1,configurable:!0}),y.prototype.getVideoProfile=function(){if(this.hasVideo)return this.videoProfile},y.prototype.getScreenProfile=function(){if(this.hasScreen)return this.screenProfile},y.prototype.getAudioProfile=function(){if(this.hasAudio)return this.audioProfile},y.prototype.init=function(E){return E.custom?this.createCustomStream(E.mediaStream):this.initWithRetry(E)},y.prototype.initWithRetry=function(E,S,d){var R=this;return new Promise(function(D,A){D=S||D,A=d||A;var b=[];E.audio&&E.video?b.push(R.initMicCamera(E)):(b.push(R.initMicAudio(E)),b.push(R.initCameraVideo(E))),E.video||b.push(R.initScreenVideoAudio(E)),Promise.all(b).then(function(){R.tryMixMicAndScreenAudio(E),R.initTracks(E),E.skipProfile?D():R.tryToSetProfile(E).then(function(){D()}).catch(function(g){console.log(g),R.resetLocalStream(),R.initWithRetry(m(m({},E),{skipProfile:!0}),D,A)})}).catch(function(g){R.stopAllTracks(),A(g)})})},y.prototype.initMicAudio=function(E){var S=this;return new Promise(function(d,R){if(!E||!E.audio)return d();var D=typeof E.audio=="boolean"?{}:E.audio;S.deviceManager.getAudioTrack(D).then(function(A){S.micAudioTrack=A,S.audiotrack=A,d()}).catch(function(A){R(new o.RtsError(A.code,A.reason,"",A.relatedLink))})})},y.prototype.initCameraVideo=function(E){var S=this;return new Promise(function(d,R){if(!E||!E.video)return d();var D=typeof E.video=="boolean"?{}:E.video;S.deviceManager.getVideoTrack(D).then(function(A){S.videotrack=A,S.hasVideo=!0,d()}).catch(function(A){R(new o.RtsError(A.code,A.reason,"",A.relatedLink))})})},y.prototype.initMicCamera=function(E){var S=this;return new Promise(function(d,R){var D={video:E.video,audio:E.audio};S.deviceManager.getAudioVideoTracks(D).then(function(A){S.videotrack=A.find(function(b){return b.kind==="video"}),S.hasVideo=!!S.videotrack,S.audiotrack=S.micAudioTrack=A.find(function(b){return b.kind==="audio"}),d()}).catch(function(A){R(new o.RtsError(A.code,A.reason,"",A.relatedLink))})})},y.prototype.initScreenVideoAudio=function(E){var S=this;return new Promise(function(d,R){if(!E||!E.screen)return d();var D=!0,A=!1,b={};if(typeof E.screen!="boolean"){var g=E.screen,O=g.video,k=g.audio;b=u(g,["video","audio"]),D=typeof O!="object"||O,typeof k!="boolean"&&typeof k!="object"||(A=k)}t.SystemUtil.isMacOS&&t.BrowserUtil.isSafari&&["16.1","16.2","16.3"].indexOf(t.BrowserUtil.browserVersion)>-1&&typeof D=="object"&&(typeof D.width=="number"&&(D.width={max:D.width}),typeof D.height=="number"&&(D.height={max:D.height})),S.deviceManager.getScreenStream(m({video:D,audio:A},b)).then(function(U){S.videotrack=U.getVideoTracks()[0],S.videotrack&&S.videotrack.getSettings&&(S.screenSurfaceType=S.videotrack.getSettings().displaySurface),S.hasScreen=!0;var w=U.getAudioTracks()[0];w&&(S.screenAudioTrack=w),d()}).catch(function(U){R(new o.RtsError(U.code,U.reason,"",U.relatedLink))})})},y.prototype.tryMixMicAndScreenAudio=function(E){E.audio&&this.micAudioTrack&&this.hasScreenAudioConfig(E)&&this.screenAudioTrack?(this.audioMixer||(this.audioMixer=new n.default({useGainNode:!1,trackList:[]})),this.audioMixer.updateTrackList([this.screenAudioTrack,this.micAudioTrack]),this.audiotrack=this.audioMixer.getMixedAudioTrack()):E.audio&&this.micAudioTrack?this.audiotrack=this.micAudioTrack:this.hasScreenAudioConfig(E)&&this.screenAudioTrack&&(this.audiotrack=this.screenAudioTrack)},y.prototype.initTracks=function(E){this.hasAudioTrackReady(E)&&this.audiotrack&&this.mediastream.addTrack(this.audiotrack),this.hasVideoTrackReady(E)&&this.videotrack&&this.mediastream.addTrack(this.videotrack),this.addTrackListener()},y.prototype.tryToSetProfile=function(E){var S=this;return new Promise(function(d,R){return h(S,void 0,void 0,function(){var D;return v(this,function(A){switch(A.label){case 0:return A.trys.push([0,4,,5]),E.video?[4,this.setVideoProfile(this.videoProfile)]:[3,2];case 1:return A.sent(),[3,3];case 2:E.screen&&this.setScreenProfile(this.screenProfile).catch(function(b){console.log(b)}),A.label=3;case 3:return d(),[3,5];case 4:return D=A.sent(),R(new o.RtsError(r.ErrorCode.ERROR_DEIVCE_CONSTRAINEDERROR,"apply constraint failed","",{originErr:D,config:E})),[3,5];case 5:return[2]}})})})},y.prototype.stopAllTracks=function(){this.screenAudioTrack&&(this.screenAudioTrack.stop(),this.screenAudioTrack=void 0),this.micAudioTrack&&(this.micAudioTrack.stop(),this.micAudioTrack=void 0),this.audioTrack&&(this.audioTrack.stop(),this.audiotrack=void 0),this.videoTrack&&(this.videoTrack.stop(),this.videotrack=void 0)},y.prototype.resetLocalStream=function(){this.deviceManager=new e.BrowserDeviceManager,this.mediastream=new MediaStream,this.hasVideo=!1,this.hasScreen=!1,this.videoProfile="360p_1",this.screenProfile="720p_1",this.isCustomStream=!1,this.stopAllTracks(),this.audioMixer=void 0,this.screenSurfaceType=""},y.prototype.setEncodeParam=function(E,S){var d=this;this.pc=E;var R=!1,D=!1;S?S==="video"?R=!0:S==="audio"&&(D=!0):R=D=!0,E.getSenders().forEach(function(A){var b=A.track;!b||b.kind!=="video"&&b.kind!=="audio"||(b.kind==="video"&&R&&d.setVideoEncodeParams(A),b.kind==="audio"&&D&&d.setAudioEncodeParams(A))})},y.prototype.setVideoEncodeParams=function(E){var S,d,R;if(((S=E.track)===null||S===void 0?void 0:S.id)===((d=this.videoTrack)===null||d===void 0?void 0:d.id)&&(this.hasVideo?R=this.VideoProfileMap.get(this.videoProfile):this.hasScreen&&(R=this.ScreenProfileMap.get(this.screenProfile)),R&&E.setParameters&&E.getParameters)){var D=E.getParameters();D.degradationPreference="maintain-resolution",D.encodings.forEach(function(A){R?.maxBitrate&&(A.maxBitrate=1024*R.maxBitrate),R?.frameRate&&(A.maxFramerate=R.frameRate)}),E.setParameters(D)}},y.prototype.setAudioEncodeParams=function(E){var S,d;if(((S=E.track)===null||S===void 0?void 0:S.id)===((d=this.audioTrack)===null||d===void 0?void 0:d.id)){var R=this.AudioProfileMap.get(this.audioProfile);if(R&&E.setParameters&&E.getParameters){var D=E.getParameters();D.encodings.forEach(function(A){R.maxBitrate&&(A.maxBitrate=1024*R.maxBitrate)}),E.setParameters(D)}}},y.prototype.play=function(E,S){var d,R=this;if((d=this.reporter)===null||d===void 0||d.reportPlay(E?E.nodeName:String(E)),E&&(this.element=E,this.mediastream)){if(this.element.srcObject=this.mediastream,(t.SystemUtil.isIos&&t.SystemUtil.systemVersion.indexOf("15.1")===0&&(t.BrowserUtil.isSafari||t.BrowserUtil.isChrome||t.BrowserUtil.isMicroMessenger)||S?.canvasStream)&&this.hasVideo){if(this.canvasRenderer)return;this.canvasRenderer=new c.CanvasRenderer({video:this.element});var D=this;this.element.addEventListener("loadeddata",function A(){if(D.element&&(D.element.removeEventListener("loadeddata",A),D.canvasRenderer)){D.canvasRenderer.start();var b=D.canvasRenderer.mediaStream;b&&(D.mediastream=b,D.videotrack=b.getVideoTracks()[0])}}),this.element.addEventListener("resize",function(){var A;if(R){var b=R.element;b&&((A=R.canvasRenderer)===null||A===void 0||A.resize(b.videoWidth,b.videoHeight))}})}if(S&&S.autoplay===!1)return;this.element.play()}},y.prototype.setVideoProfile=function(E){var S=this;return new Promise(function(d,R){return h(S,void 0,void 0,function(){var D,A,b;return v(this,function(g){switch(g.label){case 0:if((b=this.reporter)===null||b===void 0||b.reportVideoProfile(E),!(D=this.VideoProfileMap.get(E)))return[3,5];if(this.isCustomStream||!this.hasVideo||!this.videotrack||!this.videotrack.applyConstraints)return[3,4];g.label=1;case 1:return g.trys.push([1,3,,4]),[4,this.videotrack.applyConstraints(D)];case 2:return g.sent(),[3,4];case 3:return A=g.sent(),[2,R(A)];case 4:return this.videoProfile=E,this.pc&&this.setEncodeParam(this.pc,"video"),d(this.videoProfile),[3,6];case 5:R("Profile not found"),g.label=6;case 6:return[2]}})})})},y.prototype.setScreenProfile=function(E){var S=this;return new Promise(function(d,R){return h(S,void 0,void 0,function(){var D,A,b;return v(this,function(g){switch(g.label){case 0:if((b=this.reporter)===null||b===void 0||b.reportScreenProfile(E),!(D=this.ScreenProfileMap.get(E)))return[3,5];if(!(this.hasScreen&&this.videotrack&&this.videotrack.applyConstraints))return[3,4];g.label=1;case 1:return g.trys.push([1,3,,4]),[4,this.videotrack.applyConstraints(D)];case 2:return g.sent(),[3,4];case 3:return A=g.sent(),[2,R(A)];case 4:return this.screenProfile=E,this.pc&&this.setEncodeParam(this.pc,"video"),d(this.screenProfile),[3,6];case 5:R("Profile not found"),g.label=6;case 6:return[2]}})})})},y.prototype.setAudioProfile=function(E){var S=this;return new Promise(function(d,R){return h(S,void 0,void 0,function(){var D,A,b;return v(this,function(g){switch(g.label){case 0:if((b=this.reporter)===null||b===void 0||b.reportAudioProfile(E),!(D=this.AudioProfileMap.get(E)))return[3,5];if(this.isCustomStream||!this.hasAudio||!this.audioTrack||!this.audioTrack.applyConstraints)return[3,4];g.label=1;case 1:return g.trys.push([1,3,,4]),[4,this.audioTrack.applyConstraints(D)];case 2:return g.sent(),[3,4];case 3:return A=g.sent(),[2,R(A)];case 4:return this.audioProfile=E,this.pc&&this.setEncodeParam(this.pc,"audio"),d(this.audioProfile),[3,6];case 5:R("Profile not found"),g.label=6;case 6:return[2]}})})})},y.prototype.enableAudio=function(){var E;return(E=this.reporter)===null||E===void 0||E.reportEnableAudio(),!!this.audiotrack&&(this.audiotrack.enabled=!0,!0)},y.prototype.disableAudio=function(){var E;return(E=this.reporter)===null||E===void 0||E.reportDisableAudio(),!!this.audiotrack&&(this.audiotrack.enabled=!1,!0)},y.prototype.enableVideo=function(){var E;return(E=this.reporter)===null||E===void 0||E.reportEnableVideo(),!!this.videotrack&&(this.videotrack.enabled=!0,!0)},y.prototype.disableVideo=function(){var E;return(E=this.reporter)===null||E===void 0||E.reportDisableVideo(),!!this.videotrack&&(this.videotrack.enabled=!1,!0)},y.prototype.stop=function(){var E;x.prototype.stop.call(this),this.hasVideo=!1,this.hasScreen=!1,this.isCustomStream=!1,this.canvasRenderer&&(this.canvasRenderer.stop(),this.canvasRenderer=void 0),this.audiotrack&&(this.audiotrack.stop(),this.audiotrack=void 0),this.videotrack&&(this.videotrack.stop(),this.videotrack=void 0),this.micAudioTrack&&(this.micAudioTrack.stop(),this.micAudioTrack=void 0),this.screenAudioTrack&&(this.screenAudioTrack.stop(),this.screenAudioTrack=void 0),(E=this.reporter)===null||E===void 0||E.reportStop(0)},y.prototype.mergeStream=function(E){var S=E.videoTrack,d=E.audioTrack;S&&(this.videoTrack&&(this.videoTrack.removeEventListener("ended",this.handleVideoTrackEnded),this.mediaStream.removeTrack(this.videoTrack)),this.mediaStream.addTrack(S),this.videotrack=S,this.listenVideoEnded(),this.hasVideo=E.hasVideo,this.hasScreen=E.hasScreen,this.isCustomStream=E.isCustomStream,this.hasVideo&&(this.videoProfile=E.videoProfile),this.hasScreen&&(this.screenProfile=E.screenProfile)),d&&(this.audioTrack&&(this.audioTrack.removeEventListener("ended",this.handleAudioTrackEnded),this.mediaStream.removeTrack(this.audioTrack)),this.mediaStream.addTrack(d),this.audiotrack=d,this.listenAudioEnded())},y.prototype.deleteTracks=function(E){E.audio&&this.audioTrack&&(this.mediaStream.removeTrack(this.audioTrack),this.audiotrack=void 0),E.video&&this.videoTrack&&(this.mediaStream.removeTrack(this.videoTrack),this.videotrack=void 0,this.hasScreen=!1,this.hasVideo=!1)},y.prototype.createCustomStream=function(E){var S=this;return new Promise(function(d,R){if(!E)return R(new o.RtsError(r.ErrorCode.ERROR_CUSTOMSTREAM_NONE,"MediaStream is required.",""));if(!(E instanceof MediaStream))return R(new o.RtsError(r.ErrorCode.ERROR_CUSTOMSTREAM_INVALID,"MediaStream is invalid.",""));if(E.getTracks().length===0)return R(new o.RtsError(r.ErrorCode.ERROR_CUSTOMSTREAM_TRACK_NONE,"MediaStream has no track.",""));var D=(0,p.getVideoTrack)(E),A=(0,p.getAudioTrack)(E);D&&(S.hasVideo=!0,S.videotrack=D,S.mediastream.addTrack(D)),A&&(S.audiotrack=A,S.mediastream.addTrack(A)),S.isCustomStream=!0,S.setVideoProfile(S.videoProfile),S.addTrackListener(),d()})},y.prototype.releaseMediaStream=function(){var E=this;this.mediastream.getTracks().forEach(function(S){S.stop(),E.mediastream.removeTrack(S)})},y.prototype.hasVideoTrackReady=function(E){return!(!E.video&&!E.screen||!this.videotrack)||!E.video&&!E.screen},y.prototype.hasScreenAudioConfig=function(E){return typeof E.screen=="object"&&E.screen.audio},y.prototype.hasAudioTrackReady=function(E){return!(E.audio&&(!this.hasMicAudioAndReady(E)&&!this.hasScreenAudioAndReady(E)||!this.audiotrack))},y.prototype.hasMicAudioAndReady=function(E){return E.audio&&this.micAudioTrack},y.prototype.hasScreenAudioAndReady=function(E){return this.hasScreenAudioConfig(E)&&this.screenAudioTrack},y.prototype.addTrackListener=function(){this.listenVideoEnded(),this.listenAudioEnded()},y.prototype.listenVideoEnded=function(){var E=this;this.videotrack&&this.videotrack.addEventListener("ended",this.handleVideoTrackEnded),this.micAudioTrack&&this.micAudioTrack.addEventListener("ended",function(){var S;E.emit("micAudioTrackEnded"),E.screenAudioTrack&&E.screenAudioTrack.readyState==="ended"&&((S=E.audioMixer)===null||S===void 0||S.destroy(),E.emit("audioTrackEnded"))}),this.screenAudioTrack&&this.screenAudioTrack.addEventListener("ended",function(){var S;E.emit("screenAudioTrackEnded"),E.micAudioTrack&&E.micAudioTrack.readyState==="ended"&&((S=E.audioMixer)===null||S===void 0||S.destroy(),E.emit("audioTrackEnded"))})},y.prototype.listenAudioEnded=function(){this.audiotrack&&this.audiotrack.addEventListener("ended",this.handleAudioTrackEnded)},y.prototype.handleVideoTrackEnded=function(){this.hasScreen=!1,this.hasVideo=!1,this.emit("videoTrackEnded")},y.prototype.handleAudioTrackEnded=function(){this.emit("audioTrackEnded")},y}(i.Stream);T.LocalStream=C},771:function(H,T,_){var f,l=this&&this.__extends||(f=function(i,e){return f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(o[a]=r[a])},f(i,e)},function(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function o(){this.constructor=i}f(i,e),i.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)});Object.defineProperty(T,"__esModule",{value:!0}),T.RemoteStream=void 0;var m=_(5805),h=_(233),v=_(5044),u=_(9428),s=function(i){function e(){var o=i.call(this)||this;return o.recvCanPlay=!1,o.autoplay=!0,o.onCanPlay=o.onCanPlay.bind(o),o}return l(e,i),Object.defineProperty(e.prototype,"muted",{get:function(){return!!this.element&&this.element.muted},set:function(o){this.element&&(this.element.muted=o)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"audioTrack",{get:function(){var o;return(o=this.mediastream)===null||o===void 0?void 0:o.getAudioTracks()[0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"videoTrack",{get:function(){var o;return(o=this.mediastream)===null||o===void 0?void 0:o.getVideoTracks()[0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasVideo",{get:function(){return!!this.videoTrack},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasAudio",{get:function(){return!!this.audioTrack},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mediaStream",{get:function(){return this.mediastream},enumerable:!1,configurable:!0}),e.prototype.updateMediaStream=function(o){var r=this.mediastream||new MediaStream;o.getTracks().forEach(function(a){return r.addTrack(a)}),this.mediastream=r,this.element&&this.play(this.element)},e.prototype.getMediaStream=function(){return this.mediastream},e.prototype.mergeStream=function(o){if(this.mediaStream){var r=o.getVideoTracks()[0],a=o.getAudioTracks()[0];r&&(this.videoTrack&&this.mediaStream.removeTrack(this.videoTrack),this.mediaStream.addTrack(r),this.videotrack=r),a&&(this.audioTrack&&this.mediaStream.removeTrack(this.audioTrack),this.mediaStream.addTrack(a),this.audiotrack=a)}},e.prototype.play=function(o,r){if(this.autoplay=!!(!r||r.autoplay),o){if(!(o instanceof HTMLMediaElement))throw new v.RtsError(u.ErrorCode.ERROR_HTMLELEMENT_ERROR,"Param is not a HTMLMediaElement","",{element:o});this.recvCanPlay=!1,this.emit("mediaElementBinded"),this.element=o,this.element.addEventListener("canplay",this.onCanPlay);var a=this.mediaStream;this.element.addEventListener("playing",function t(){o.removeEventListener("playing",t),h.SystemUtil.isIos&&parseInt(h.SystemUtil.systemVersion)<=13&&!o.muted&&a?.getAudioTracks().length&&(o.pause(),o.play())}),this.element.nodeName==="VIDEO"&&(this.element.setAttribute("playsinline",""),h.BrowserUtil.isMicroMessenger&&(this.element.setAttribute("x5-video-player-type","h5-page"),this.element.setAttribute("x5-playsinline",""),h.SystemUtil.isAndroid||h.SystemUtil.isIos&&this.element.setAttribute("x-webkit-airplay","allow"))),this.autoplay&&h.BrowserUtil.isSafari&&this.element.setAttribute("autoplay",""),this.mediastream&&this.bindMediaStream(this.mediastream)}else this.release()},e.prototype.disableVideo=function(){var o=this.getMediaStream();o&&o.getVideoTracks().forEach(function(r){r.enabled&&(r.enabled=!1)})},e.prototype.enableVideo=function(){var o=this.getMediaStream();o&&o.getVideoTracks().forEach(function(r){r.enabled||(r.enabled=!0)})},e.prototype.disableAudio=function(){var o=this.getMediaStream();o&&o.getAudioTracks().forEach(function(r){r.enabled&&(r.enabled=!1)})},e.prototype.enableAudio=function(){var o=this.getMediaStream();o&&o.getAudioTracks().forEach(function(r){r.enabled||(r.enabled=!0)})},e.prototype.stop=function(){i.prototype.stop.call(this),this.release()},e.prototype.onCanPlay=function(){var o=this;if(!this.recvCanPlay&&(this.emit("onCanPlay"),this.recvCanPlay=!0,this.autoplay))if(this.element)if(h.BrowserUtil.isMicroMessenger){var r=window.top!==window.self,a=window.WeixinJSBridge||window.top.WeixinJSBridge;a?a.invoke("getNetworkType",{},function(){o.tryToPlay()}):(r?window.top.document:document).addEventListener("WeixinJSBridgeReady",function(){a.invoke("getNetworkType",{},function(){o.tryToPlay()})})}else this.tryToPlay();else this.tryToPlay()},e.prototype.release=function(){this.element&&(this.element.pause(),this.element.srcObject=null,this.element.load(),this.element.removeEventListener("canplay",this.onCanPlay)),this.recvCanPlay=!1,this.mediastream=void 0},e.prototype.bindMediaStream=function(o){this.element&&(this.element.nodeName==="AUDIO"&&o.getVideoTracks()[0]&&o.removeTrack(o.getVideoTracks()[0]),this.element.srcObject=o),this.mediastream=o},e.prototype.tryToPlay=function(){var o=this;if(this.element){var r=this.element.play();r!==void 0&&r.then(function(){}).catch(function(a){console.log("playPromise err",a),o.element&&o.element.srcObject&&o.emit("onAutoPlayError")})}},e}(m.Stream);T.RemoteStream=s},5805:function(H,T,_){var f,l=this&&this.__extends||(f=function(u,s){return f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,e){i.__proto__=e}||function(i,e){for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(i[o]=e[o])},f(u,s)},function(u,s){if(typeof s!="function"&&s!==null)throw new TypeError("Class extends value "+String(s)+" is not a constructor or null");function i(){this.constructor=u}f(u,s),u.prototype=s===null?Object.create(s):(i.prototype=s.prototype,new i)}),m=this&&this.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(T,"__esModule",{value:!0}),T.Stream=void 0;var h=_(233),v=function(u){function s(){var i=u.call(this)||this;return i.traceid="",i.id=h.Guid.create(32),i}return l(s,u),Object.defineProperty(s.prototype,"traceId",{get:function(){return this.traceid},set:function(i){this.traceid=i},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"mediaElement",{get:function(){return this.element},enumerable:!1,configurable:!0}),s.prototype.setReporter=function(i){this.reporter=i},s.prototype.play=function(i){},s.prototype.stop=function(){this.traceid="",this.reporter=void 0},s}(m(_(102)).default);T.Stream=v},5676:function(H,T,_){var f,l=this&&this.__extends||(f=function(R,D){return f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,b){A.__proto__=b}||function(A,b){for(var g in b)Object.prototype.hasOwnProperty.call(b,g)&&(A[g]=b[g])},f(R,D)},function(R,D){if(typeof D!="function"&&D!==null)throw new TypeError("Class extends value "+String(D)+" is not a constructor or null");function A(){this.constructor=R}f(R,D),R.prototype=D===null?Object.create(D):(A.prototype=D.prototype,new A)}),m=this&&this.__assign||function(){return m=Object.assign||function(R){for(var D,A=1,b=arguments.length;A<b;A++)for(var g in D=arguments[A])Object.prototype.hasOwnProperty.call(D,g)&&(R[g]=D[g]);return R},m.apply(this,arguments)},h=this&&this.__awaiter||function(R,D,A,b){return new(A||(A=Promise))(function(g,O){function k(W){try{w(b.next(W))}catch(M){O(M)}}function U(W){try{w(b.throw(W))}catch(M){O(M)}}function w(W){var M;W.done?g(W.value):(M=W.value,M instanceof A?M:new A(function(N){N(M)})).then(k,U)}w((b=b.apply(R,D||[])).next())})},v=this&&this.__generator||function(R,D){var A,b,g,O,k={label:0,sent:function(){if(1&g[0])throw g[1];return g[1]},trys:[],ops:[]};return O={next:U(0),throw:U(1),return:U(2)},typeof Symbol=="function"&&(O[Symbol.iterator]=function(){return this}),O;function U(w){return function(W){return function(M){if(A)throw new TypeError("Generator is already executing.");for(;O&&(O=0,M[0]&&(k=0)),k;)try{if(A=1,b&&(g=2&M[0]?b.return:M[0]?b.throw||((g=b.return)&&g.call(b),0):b.next)&&!(g=g.call(b,M[1])).done)return g;switch(b=0,g&&(M=[2&M[0],g.value]),M[0]){case 0:case 1:g=M;break;case 4:return k.label++,{value:M[1],done:!1};case 5:k.label++,b=M[1],M=[0];continue;case 7:M=k.ops.pop(),k.trys.pop();continue;default:if(g=k.trys,!((g=g.length>0&&g[g.length-1])||M[0]!==6&&M[0]!==2)){k=0;continue}if(M[0]===3&&(!g||M[1]>g[0]&&M[1]<g[3])){k.label=M[1];break}if(M[0]===6&&k.label<g[1]){k.label=g[1],g=M;break}if(g&&k.label<g[2]){k.label=g[2],k.ops.push(M);break}g[2]&&k.ops.pop(),k.trys.pop();continue}M=D.call(R,k)}catch(N){M=[6,N],b=0}finally{A=g=0}if(5&M[0])throw M[1];return{value:M[0]?M[1]:void 0,done:!0}}([w,W])}}},u=this&&this.__importDefault||function(R){return R&&R.__esModule?R:{default:R}};Object.defineProperty(T,"__esModule",{value:!0}),T.Subscriber=void 0;var s,i=_(4865),e=_(5917),o=_(9428),r=u(_(8219)),a=u(_(102)),t=_(5044),n=_(7989),c=_(492),p=u(_(2818)),C=u(_(7028)),x=_(6091),y=_(771),E=_(2718),S=u(_(1401));(function(R){R[R.Init=0]="Init",R[R.Requesting=1]="Requesting",R[R.Playing=2]="Playing",R[R.Waiting=3]="Waiting"})(s||(s={}));var d=function(R){function D(A,b){var g=R.call(this)||this;return g.monitorStatsHistory=[],g.playTimeIndex=0,g.playCatonIndex=0,g.reportPubFlag=!1,g.state=s.Init,g.subscribeAudio=!0,g.subscribeVideo=!0,g.signalingUrl="",g.pullStreamUrl="",g.noParsePullStreamUrl="",g.subReconnectTimes=0,g.isConnecting=!1,g.reconnectTimerHandle=null,g.reporter=A,g.playTimer=0,g.config=b||{playTimeOut:5e3},g.remoteStream=new y.RemoteStream,g.remoteStream.on("onAutoPlayError",function(){g.emit("onError",new t.RtsError(o.ErrorCode.ERROR_AUTOPLAY_ERROR,"auto play failed",""))}),g.remoteStream.on("onCanPlay",function(){return h(g,void 0,void 0,function(){var O,k,U,w,W,M,N,P,V,j,z;return v(this,function(G){switch(G.label){case 0:return O=new Date().getTime(),[4,this.peerconnection.sample()];case 1:return G.sent(),k=-1,U=[],w=-1,this.monitorStatsHistory&&this.monitorStatsHistory.length&&(W=this.monitorStatsHistory[this.monitorStatsHistory.length-1],this.monitorStatsHistory.forEach(function(X){var re=X.rtt;re&&re>0&&U.push(re)}),k=Number((U.reduce(function(X,re){return X+re},0)/U.length).toFixed(3)),w=W.packetsLost,this.monitorStatsHistory=null),this.stopPlayTimer(),this.peerconnection.playStart(),this.subReconnectTimes=0,M=this._cnend||O,this.reporter.reportFirstFrameTime(this.noParsePullStreamUrl,this.remoteStream.traceId,this._cpend-this._cpstart,this._hrend-this._cpend,O-this._cpstart,0,M-this._hrend,{rttAvg:k,packetsLost:w},-1,-1,-1,(P=this.subscribeConfig)===null||P===void 0?void 0:P.vMsid,(V=this.subscribeConfig)===null||V===void 0?void 0:V.aMsid),(N=new x.PlayEvent(x.PlayType.PLAY_CANPLAY)).data={url:this.noParsePullStreamUrl,vMsid:(j=this.subscribeConfig)===null||j===void 0?void 0:j.vMsid,aMsid:(z=this.subscribeConfig)===null||z===void 0?void 0:z.aMsid},this.emit("onPlayEvent",N),[2]}})})}),g.peerconnection=new i.RtsPeerconnection,g.peerconnection.on("onConnected",function(){g._cnend=new Date().getTime()}),g.peerconnection.on("streamEnded",function(O){var k=new x.PlayEvent(x.PlayType.PLAY_ENDED);k.data=m({},O),g.emit("onPlayEvent",k),g.emit("onError",new t.RtsError(o.ErrorCode.ERROR_STREAM_ENDED,"Stream Receiver Transport is Closed",g.remoteStream.traceId))}),g.peerconnection.on("onTrackEvent",function(O){O.streams&&O.streams.length&&(g.remoteStream.updateMediaStream(O.streams[0]),g.onTrackFunction&&g.onTrackFunction())}),g.peerconnection.on("connectStatusChange",function(O){O.status!==e.EConnectStatus.CONNECT_STATUS_DISCONNECTED&&O.status!==e.EConnectStatus.CONNECT_STATUS_RECONNECTING||!g.hasRetries()?g.emit("connectStatusChange",O):g.emit("onError",new t.RtsError(o.ErrorCode.ERROR_PC_DISCONNECTED,"PC disconnected",g.remoteStream.traceId))}),g.peerconnection.on("pcReconnect",function(O){var k,U;O.ips?(k="Migrate with ips: ".concat((0,S.default)(O.ips)),U=o.ErrorCode.ERROR_IP_MIGRATE):(k="PC disconnected",U=o.ErrorCode.ERROR_PC_DISCONNECTED),g.emit("onError",new t.RtsError(U,k,"",{pcErrorInfo:O}))}),g.mediaObserver=new c.MediaObserver({handler:function(O,k,U){var w,W=new x.PlayEvent(x.PlayType.PLAY_TIMEOUT),M={url:O};k&&(M.vMsid=k),U&&(M.aMsid=U),W.data=M,g.emit("onPlayEvent",W);var N=new t.RtsError(o.ErrorCode.ERROR_INBOUND_TIMEOUT,"Media data timeout after ".concat((w=g.mediaObserver)===null||w===void 0?void 0:w.actTimeout," ms."),g.remoteStream.traceId);g.emit("onError",N)}}),g.peerconnection.on("onMonitorEvent",function(O){var k,U=O.eventList;if((k=g.peerconnection)===null||k===void 0||k.updateStatsForSEI(U,O.type),O.type!=="pub"){if(U.length){for(var w=void 0,W=0;W<U.length;W++)if(U[W].url===(0,E.pruneSubUrl)(g.noParsePullStreamUrl,!0)){w=U[W];break}if(w){g.lastMeidaEventData=w;var M=w.video,N=w.audio;M&&g.monitorStatsHistory?g.monitorStatsHistory.push({rtt:M.transportStats.rtt,packetsLost:M.inboundRtpStats.packetsLost}):N&&g.monitorStatsHistory&&g.monitorStatsHistory.push({rtt:N.transportStats.rtt,packetsLost:N.inboundRtpStats.packetsLost}),s.Requesting===g.state?w.video?w.video.inboundRtpStatsPerSec.framesDecodedPerSecond>1&&(g.state=s.Playing):w.audio&&w.audio.inboundRtpStatsPerSec.bytesReceivedPerSecond>0&&(g.state=s.Playing):g.state!==s.Playing&&g.state!==s.Waiting||(++g.playTimeIndex,w.video&&(w.video.inboundRtpStatsPerSec.framesDecodedPerSecond<=1?(++g.playCatonIndex,s.Waiting!==g.state&&(g.state=s.Waiting,g.emit("onPlayEvent",new x.PlayEvent(x.PlayType.PLAY_WAITING)))):s.Waiting===g.state&&(g.state=s.Playing,g.emit("onPlayEvent",new x.PlayEvent(x.PlayType.PLAY_PLAYING)))),p.default.HEARTHEAT_INTERVAL===g.playTimeIndex&&(g.reportPubFlag=!0,U.forEach(function(V){g.doReportPullStats(V)}),g.playTimeIndex=0,g.playCatonIndex=0))}var P=new x.PlayEvent(x.PlayType.PLAY_MEDIA);P.data=[],U.forEach(function(V){var j={};j.url=V.url;var z=g.calcStreamPullStats(V);if(V.audio&&(j.audio={bytesReceivedPerSecond:V.audio.inboundRtpStatsPerSec.bytesReceivedPerSecond,rtt:V.audio.transportStats.rtt,lossRate:z.aloss,jitterBufferDelayAvg:V.audio.inboundRtpStatsPerSec.jitterBufferDelayAvg},j.aMsid=V.aMsid),V.video){var G=V.video,X=G.inboundRtpStats,re=G.inboundRtpStatsPerSec,te=G.transportStats;j.video={bytesReceivedPerSecond:re.bytesReceivedPerSecond,fps:X.framesPerSecond||re.framesDecodedPerSecond,framesDecodedPerSecond:re.framesDecodedPerSecond,rtt:te.rtt,width:X.frameWidth,height:X.frameHeight,lossRate:z.vloss,jitterBufferDelayAvg:re.jitterBufferDelayAvg},j.vMsid=V.vMsid}j.networkQuality=z.net_qual||0,P.data.push(j)}),P.data&&P.data.length&&(P.data.forEach(function(V){var j;(j=g.mediaObserver)===null||j===void 0||j.check({audio:V.audio,video:V.video},V.url,V.vMsid,V.aMsid)}),P.data.length===1&&(P.data[0].audio||P.data[0].video)&&(P.data=m({},P.data[0])),g.emit("onPlayEvent",P))}}else g.reportPubFlag&&(g.reportPubFlag=!1)}),g.playTimer=0,g._cpstart=0,g._cpend=0,g._hrend=0,g._cnend=0,g.subscribeConfig={},g}return l(D,R),D.prototype.getPeerConnection=function(){return this.peerconnection},D.prototype.subscribe=function(A,b,g){var O=this;return new Promise(function(k,U){return h(O,void 0,void 0,function(){var w,W,M=this;return v(this,function(N){switch(N.label){case 0:return this.monitorStatsHistory=[],this.unsubscribe(),b?.cumuDelay&&(b.encodedInsertableStreams=!0),this.subscribeConfig=b||{},this.state=s.Requesting,this.noParsePullStreamUrl=A,this.parseUrl(A),(W=this.mediaObserver)===null||W===void 0||W.updateConfig({timeout:b?.mediaTimeout}),w=b?.signalUrl,this.signalingUrl=w||this.signalingUrl,this.checkPullUrl()?[3,1]:(U(new t.RtsError(o.ErrorCode.ERROR_PLAY_URL,"url need artc://","")),[3,8]);case 1:return this.subscribeAudio||this.subscribeVideo?[3,2]:(U(new t.RtsError(o.ErrorCode.ERROR_SUBSCRIBE_NOTHING,"subscribe nothing","")),[3,8]);case 2:if(this._cpstart=new Date().getTime(),!this.subscribeVideo||b?.isH264Checked)return[3,7];N.label=3;case 3:return N.trys.push([3,5,,6]),[4,new n.SupportUtil().loadH264(3)];case 4:return N.sent(),[3,6];case 5:return N.sent(),[3,6];case 6:N.label=7;case 7:this.peerconnection.createOffer(this.subscribeAudio,this.subscribeVideo,void 0,{offerSdpHook:b?.offerSdpHook,answerSdpHook:b?.answerSdpHook,encodedInsertableStreams:b?.encodedInsertableStreams,disableStereo:b?.disableStereo,disableHeartbeat:b?.disableHeartbeat,cumuDelay:b?.cumuDelay}).then(function(P){var V=P.desp;M._cpend=new Date().getTime(),M.reporter.reportSubscribeStart(M.noParsePullStreamUrl,M.signalingUrl,b?.vMsid,b?.aMsid),M.excuteSignal(V,{innerTcpOnly:!!g?.innerTcpOnly}).then(function(j){var z;M.remoteStream.traceId=j,k(M.remoteStream);try{(z=M.peerconnection.getPeerCore())===null||z===void 0||z.patchSubscribeStreamManagerRecord(M.noParsePullStreamUrl,m(m({},M.subscribeConfig),{stream:M.remoteStream}))}catch(G){console.log(G)}M.peerconnection.getSubMonitor().updateTranceiversController()}).catch(function(j){M._hrend=new Date().getTime();var z=new t.RtsError(j.errorCode?j.errorCode:o.ErrorCode.ERROR_HTTPREQUEST_ERROR,j.message,j?j.traceid:"",{response:j.response,sdp:j.sdp});U(z)})}).catch(function(P){M._cpend=new Date().getTime();var V=new t.RtsError(o.ErrorCode.ERROR_CREATEOFFER,P.message,"");U(V)}),N.label=8;case 8:return[2]}})})})},D.prototype.unsubscribe=function(){var A;this.lastMeidaEventData&&this.doReportPullStats(this.lastMeidaEventData),this.stopPlayTimer(),this.peerconnection.reset(),this.remoteStream.stop(),this.subscribeVideo=!0,this.subscribeAudio=!0,this.state=s.Init,this.signalingUrl="",this.pullStreamUrl="",this.noParsePullStreamUrl="",this.onTrackFunction=void 0,this.playTimer=0,this._cpstart=0,this._cpend=0,this._hrend=0,this._cnend=0,this.monitorStatsHistory=[],(A=this.mediaObserver)===null||A===void 0||A.reset()},D.prototype.startLiveStream=function(A,b,g){var O=this;return console.error("\u6B64API\u53EF\u80FD\u5B58\u5728\u7A33\u5B9A\u6027\u95EE\u9898\uFF0C\u5E76\u5C06\u5728\u672A\u6765\u7684\u7248\u672C\u79FB\u9664\u3002\u8BF7\u4F7F\u7528subscribe\u66FF\u4EE3\uFF0C\u8BE6\u7EC6\u7528\u6CD5\u8BF7\u53C2\u8003\u5B98\u65B9\u6587\u6863\u3002"),new Promise(function(k,U){O.unsubscribe(),O.state=s.Requesting,O.noParsePullStreamUrl=A,O.parseUrl(A);var w=g?.signalUrl;O.signalingUrl=w||O.signalingUrl,O.pullStreamUrl===""?U(new t.RtsError(o.ErrorCode.ERROR_PLAY_URL,"url need artc://","")):O.subscribeAudio||O.subscribeVideo?!b||b.nodeName!=="AUDIO"&&b.nodeName!=="VIDEO"?U(new t.RtsError(o.ErrorCode.ERROR_HTMLELEMENT_ERROR,"need htmlaudioelement or htmlvideoelement","")):(O.subscribeAudio&&O.subscribeVideo?b.nodeName!=="VIDEO"&&O.emit("onError",new t.RtsError(o.ErrorCode.ERROR_HEMLELEMENT_NOTMATCH,"need htmlvideoelement","")):O.subscribeAudio?b.nodeName!=="AUDIO"&&O.emit("onError",new t.RtsError(o.ErrorCode.ERROR_HEMLELEMENT_NOTMATCH,"need htmlaudioelement","")):b.nodeName!=="VIDEO"&&O.emit("onError",new t.RtsError(o.ErrorCode.ERROR_HEMLELEMENT_NOTMATCH,"need htmlvieoelement","")),O._cpstart=new Date().getTime(),O.reporter.updateTid(),O.peerconnection.createOffer(O.subscribeAudio,O.subscribeVideo).then(function(W){var M=W.desp;O._cpend=new Date().getTime(),O.excuteSignal(M).then(function(N){O.remoteStream.traceId=N,O._hrend=new Date().getTime(),O.remoteStream.play(b),k(N)}).catch(function(N){O._hrend=new Date().getTime(),O.reporter.reportFirstFrameTime(O.noParsePullStreamUrl,N?N.traceid:"",O._cpend-O._cpstart,O._hrend-O._cpend,-1,-1,O._cnend-O._hrend),U(new t.RtsError(N.errorCode?N.errorCode:o.ErrorCode.ERROR_HTTPREQUEST_ERROR,N.message,""))})}).catch(function(W){O._cpend=new Date().getTime(),O.reporter.reportFirstFrameTime(O.noParsePullStreamUrl,W?W.traceid:"",O._cpend-O._cpstart,-1,-1,-1,O._cnend-O._hrend),U(new t.RtsError(o.ErrorCode.ERROR_CREATEOFFER,W.message,""))})):U(new t.RtsError(o.ErrorCode.ERROR_SUBSCRIBE_NOTHING,"subscribe nothing",""))})},D.prototype.stopLiveStream=function(){this.unsubscribe()},D.prototype.muteLiveStream=function(A){return this.remoteStream.muted=A,!0},D.prototype.excuteSignal=function(A,b){var g=this,O={type:A.type,sdp:A.sdp};return new Promise(function(k,U){var w,W,M,N,P,V={url:g.pullStreamUrl,amsid:((w=g.subscribeConfig)===null||w===void 0?void 0:w.aMsid)||["rts audio"],vmsid:((W=g.subscribeConfig)===null||W===void 0?void 0:W.vMsid)||["rts video"]};g.subscribeAudio||delete V.amsid,g.subscribeVideo||delete V.vmsid,!((M=g.subscribeConfig)===null||M===void 0)&&M.cumuDelay&&(O.sdp=O.sdp.replace(/(m=video[^\n]*\n)/,`$1a=cumudelay
153
+ `)),r.default.post(g.signalingUrl,{version:((N=g.subscribeConfig)===null||N===void 0?void 0:N.signalVersion)||C.default.protocol_version,sdk_version:C.default.sdk_version,mode:((P=g.subscribeConfig)===null||P===void 0?void 0:P.signalMode)||"live",pull_streams:[V],jsep:O}).then(function(j){var z,G,X,re,te,oe,ue,se,ce;if(j&&j.status===200){g._hrend=new Date().getTime();try{!((z=g.subscribeConfig)===null||z===void 0)&&z.cumuDelay&&!(!((X=(G=j.data)===null||G===void 0?void 0:G.jsep)===null||X===void 0)&&X.sdp.includes("a=cumudelay"))&&(console.warn("Not found cumudelay in server sdp"),(re=g.reporter)===null||re===void 0||re.reportCumuDelayAnswerNotFound())}catch{}var de=(te=j.data)===null||te===void 0?void 0:te.trace_id;g.reporter.reportSubscribeOk({vurl:g.noParsePullStreamUrl,surl:g.signalingUrl,traceId:de,hrct:g._hrend-g._cpend,rslt:(oe=j.data)===null||oe===void 0?void 0:oe.code});var pe=typeof((ue=g.subscribeConfig)===null||ue===void 0?void 0:ue.tcpOnly)=="boolean"?g.subscribeConfig.tcpOnly:b?.innerTcpOnly;g.peerconnection.recvAnswer(j.data,{answerSdpHook:(se=g.subscribeConfig)===null||se===void 0?void 0:se.answerSdpHook,tcpOnly:pe}).then(function(){k(de)}).catch(function(he){he.traceid=j.data?j.data.trace_id:"",U({errorCode:o.ErrorCode.ERROR_ANSWER_ERROR,message:he.message?he.message:"set answer error",traceid:he.traceid,sdp:he.sdp})})}else U({message:j?"response status:"+j.status:"response is null",traceid:(ce=j?.data)===null||ce===void 0?void 0:ce.trace_id,sdp:A.sdp})}).catch(function(j){return h(g,void 0,void 0,function(){var z,G;return v(this,function(X){switch(X.label){case 0:if(![400,500].includes((G=j.response)===null||G===void 0?void 0:G.status))return[3,4];j.sdp=A.sdp,X.label=1;case 1:return X.trys.push([1,3,,4]),[4,new n.SupportUtil().isSupport({isReceiveVideo:!0})];case 2:return X.sent(),[3,4];case 3:return z=X.sent(),j.errorCode=z?.errorCode,j.message=z?.message,this.subReconnectTimes=1/0,[3,4];case 4:return U(j),[2]}})})})})},D.prototype.checkPullUrl=function(){return!!this.noParsePullStreamUrl&&this.noParsePullStreamUrl.indexOf("artc://")===0},D.prototype.parseUrl=function(A){if(A===void 0&&(A=""),A?.indexOf("artc://")===0){var b=A.indexOf("@");if(b>-1){var g=A.substring(b+1,A.length);this.pullStreamUrl=A.substring(0,b);for(var O=g.split("&"),k=0;k<O.length;++k)O[k]==="subaudio=no"&&(this.subscribeAudio=!1),O[k]==="subvideo=no"&&(this.subscribeVideo=!1)}else this.pullStreamUrl=A;var U=window.location.protocol,w=(["http:","https:"].indexOf(U)>-1?U:"https:")+"//";this.signalingUrl=this.pullStreamUrl.replace("artc://",w)}},D.prototype.stopPlayTimer=function(){this.playTimer&&clearTimeout(this.playTimer),this.playTimer=0},D.prototype.calcStreamPullStats=function(A){var b={},g=A.video,O=A.audio;if(g){var k=g.transportStats,U=g.inboundRtpStats,w=g.inboundRtpStatsPerSec,W=g.localCandidate,M=g.remoteCandidate;b=m(m({},b),{rtt:k?.rtt!==-1?1e3*(k?.rtt||0):-1,cand_re_prot:M.protocol,cand_lo_prot:W.protocol,cand_re_addr:"".concat(M.ip||M.address,":").concat(M.port),cand_lo_addr:"".concat(W.ip||W.address,":").concat(W.port),w:U?.frameWidth,h:U?.frameHeight,vbps:Math.floor(8*w.bytesReceivedPerSecond),fps:U?.framesPerSecond,dfps:Math.floor(w?.framesDecodedPerSecond),vjb:Math.floor((0,E.getJitterBufferDelayAvg)(U?.jitterBufferDelay,U?.jitterBufferEmittedCount)),vMsid:A.vMsid,vloss:w.packetsLostRate})}return O&&(k=O.transportStats,U=O.inboundRtpStats,w=O.inboundRtpStatsPerSec,W=O.localCandidate,M=O.remoteCandidate,b=m(m({},b),{rtt:k?.rtt!==-1?1e3*(k?.rtt||0):-1,cand_re_prot:M.protocol,cand_lo_prot:W.protocol,cand_re_addr:"".concat(M.ip||M.address,":").concat(M.port),cand_lo_addr:"".concat(W.ip||W.address,":").concat(W.port),abps:Math.floor(8*w.bytesReceivedPerSecond),ajb:Math.floor((0,E.getJitterBufferDelayAvg)(U?.jitterBufferDelay,U.jitterBufferEmittedCount)),aMsid:A.aMsid,aloss:w.packetsLostRate})),b=m(m({},b),{net_qual:(0,E.evaluateNetworkCondition)(b.rtt,b.aloss,b.vloss,b.ajb,b.vjb)})},D.prototype.doReportPullStats=function(A){var b=this.calcStreamPullStats(A),g={ct:1e3*this.playCatonIndex,tt:1e3*this.playTimeIndex,url:A.url};g.tt&&(g=m(m({},g),b),this.reporter.reportPullStats(g),this.lastMeidaEventData=void 0)},D.prototype.retrySubscribe=function(A,b){return h(this,void 0,void 0,function(){var g,O,k,U,w,W,M;return v(this,function(N){switch(N.label){case 0:if(A.extraInfo=m(m({},A.extraInfo),{retryTimes:this.subReconnectTimes}),!this.hasRetries())return[2,!1];if(typeof((g=this.subscribeConfig)==null?void 0:g.beforeRetry)!="function")return[3,4];N.label=1;case 1:return N.trys.push([1,3,,4]),[4,g.beforeRetry({url:this.noParsePullStreamUrl,vMsid:g.vMsid,aMsid:g.aMsid,useTcp:b?.innerTcpOnly})];case 2:return(O=N.sent())?(k=O.url,U=O.vMsid,w=O.aMsid,W=O.useTcp,this.reporter.reportReconnectParams("sub",k,U,w,W),this.noParsePullStreamUrl=k,this.subscribeConfig.vMsid=U,this.subscribeConfig.aMsid=w,typeof W=="boolean"&&(b=m(m({},b),{innerTcpOnly:W})),console.log(`retry with:
154
+ [URL] `.concat(k,`
155
+ [VMSID]`).concat(U," [AMSID]").concat(w,`
156
+ [PROTOCOL] `).concat(W?"TCP":"UDP"))):(this.reporter.reportReconnectParams("sub"),this.subReconnectTimes=1/0),[3,4];case 3:return M=N.sent(),console.error("Error in beforeRetry",M),[3,4];case 4:return this.hasRetries()?(this.emit("connectStatusChange",{status:e.EConnectStatus.CONNECT_STATUS_RECONNECTING}),this.incrementReconnectTimes(),A.extraInfo.retryTimes=this.subReconnectTimes,A.extraInfo.tcpOnly=b?.innerTcpOnly,this.subscribeWithReconnect(this.noParsePullStreamUrl,m({innerTcpOnly:b?.innerTcpOnly},this.subscribeConfig)).catch(function(P){}),[2,!0]):(A.extraInfo.retryTimes=this.subReconnectTimes,[2,!1])}})})},D.prototype.subscribeWithReconnect=function(A,b,g,O){var k=this;return new Promise(function(U,w){U=g||U,w=O||w,k.isConnecting=!0;var W=(b||{}).innerTcpOnly;b==null||delete b.innerTcpOnly,k.subscribe(A,b,{innerTcpOnly:W}).then(function(M){k.isConnecting=!1,U(M)}).catch(function(M){var N;if(k.peerconnection.reset(),!k.isConnecting)return w(M);if(!o.RECONNECT_ERROR_EXCLUDE_LIST.includes(M.errorCode)&&k.hasRetries(!0)){var P=((N=k.subscribeConfig)===null||N===void 0?void 0:N.retryInterval)||e.DEFAULT_RETRY_SUBSCRIBE_INTERVAL;k.reconnectTimerHandle=setTimeout(function(){M.extraInfo=m(m({},M.extraInfo),{retryTimes:k.subReconnectTimes}),k.emit("reconnect",M),k.subscribeWithReconnect(A,b,U,w)},P)}else w(M),M.extraInfo=m(m({},M.extraInfo),{retryTimes:k.subReconnectTimes}),k.isConnecting=!1,k.emit("onError",M)})})},D.prototype.hasRetries=function(A){var b,g,O=e.DEFAULT_RETRY_SUBSCRIBE_LIMIT;typeof((b=this.subscribeConfig)===null||b===void 0?void 0:b.retryTimes)=="number"&&(O=Math.floor((g=this.subscribeConfig)===null||g===void 0?void 0:g.retryTimes));var k=this.subReconnectTimes<O;return A&&k&&this.incrementReconnectTimes(),k},D.prototype.resetResubscribeStatus=function(){this.subReconnectTimes=0,this.isConnecting=!1,this.reporter.updateTid(),this.reconnectTimerHandle!==null&&(clearTimeout(this.reconnectTimerHandle),this.reconnectTimerHandle=null)},D.prototype.handlePubMonitorEvent=function(A){var b=this;A.forEach(function(g){b.reporter.reportPushStats(g)})},D.prototype.incrementReconnectTimes=function(){this.subReconnectTimes++},D.prototype.getSubscribeConfig=function(){return this.subscribeConfig},D}(a.default);T.Subscriber=d},6901:function(H,T,_){var f,l=this&&this.__extends||(f=function(v,u){return f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,i){s.__proto__=i}||function(s,i){for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&(s[e]=i[e])},f(v,u)},function(v,u){if(typeof u!="function"&&u!==null)throw new TypeError("Class extends value "+String(u)+" is not a constructor or null");function s(){this.constructor=v}f(v,u),v.prototype=u===null?Object.create(u):(s.prototype=u.prototype,new s)});Object.defineProperty(T,"__esModule",{value:!0}),T.AudioReceiverMonitorData=void 0;var m=_(1353),h=function(v){function u(){return v.call(this,m.ReceiverMonitorType.AUDIO)||this}return l(u,v),u}(m.ReceiverMonitorData);T.AudioReceiverMonitorData=h},1353:function(H,T,_){var f,l=this&&this.__extends||(f=function(o,r){return f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,t){a.__proto__=t}||function(a,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(a[n]=t[n])},f(o,r)},function(o,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function a(){this.constructor=o}f(o,r),o.prototype=r===null?Object.create(r):(a.prototype=r.prototype,new a)}),m=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(T,"__esModule",{value:!0}),T.ReceiverMonitorData=T.ReceiverMonitorType=void 0;var h,v=_(233),u=m(_(102)),s=_(2688),i=_(2718);(function(o){o.AUDIO="audio",o.VIDEO="video"})(h||(T.ReceiverMonitorType=h={}));var e=function(o){function r(a){var t=o.call(this)||this;return t.streamEnded=!1,t.currentTimeGap=0,t.lastTimeStamp=0,t.transportStats={},t.remoteCandidate={},t.localCandidate={},t.inboundRtpStreamStats={},t.inboundRtpStreamStatsDiff={},t.receiver=null,t.pc=null,t.canplay=!1,t.type=a,t}return l(r,o),Object.defineProperty(r.prototype,"rtpReceiver",{set:function(a){this.receiver=a},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"RTCPeerconnection",{set:function(a){this.pc=a},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"isExist",{get:function(){return this.receiver!=null},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"isPlaying",{get:function(){return this.canplay},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"isStreamEnded",{get:function(){return this.streamEnded},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"monitorData",{get:function(){var a=this.inboundRtpStreamStatsDiff||{},t=(this.inboundRtpStreamStats,this.currentTimeGap),n=0;return a.nackCount!==void 0&&a.packetsReceived!==void 0&&(n=Math.round(a.nackCount/(a.packetsReceived+a.nackCount)*1e3)/1e3),{inboundRtpStats:this.inboundRtpStreamStats,inboundRtpStatsPerSec:{bytesReceivedPerSecond:a.bytesReceived/t||0,framesDecodedPerSecond:a.framesDecoded/t||0,packetsLostRate:n>0?n:0,decodeTimeAvg:a.totalDecodeTime&&a.framesDecoded?1e3*(a.totalDecodeTime/a.framesDecoded||0):0,jitterBufferDelayAvg:a.jitterBufferDelay&&a.jitterBufferEmittedCount?(0,i.getJitterBufferDelayAvg)(a.jitterBufferDelay,a.jitterBufferEmittedCount):0,totalProcessingDelayAvg:a.totalProcessingDelay&&a.framesDecoded?a.totalProcessingDelay/a.framesDecoded*1e3:0,totalAssemblyTimeAvg:a.totalAssemblyTime&&a.framesAssembledFromMultiplePackets?a.totalAssemblyTime/a.framesAssembledFromMultiplePackets*1e3:0},transportStats:this.transportStats,remoteCandidate:this.remoteCandidate,localCandidate:this.localCandidate}},enumerable:!1,configurable:!0}),r.prototype.getInfo=function(){var a=this;if(this.receiver&&this.receiver.transport&&this.receiver.transport.state==="closed"&&this.canplay&&(this.streamEnded=!0,this.emit("streamEnded"),this.canplay=!1),this.receiver&&"getStats"in this.receiver||this.pc&&"getStats"in this.pc)return new Promise(function(t,n){var c=null,p=!1;a.receiver&&"getStats"in a.receiver?c=a.receiver.getStats():a.pc&&"getStats"in a.pc&&(c=a.pc.getStats(),p=!0),c?.then(function(C){C.forEach(function(x){var y,E;if(x)switch(x.type){case s.RTCStatsType.CandidatePair:a.onCandidatePair(x);break;case s.RTCStatsType.InboundRtp:v.SystemUtil.isIos&&p?!((y=x.id)===null||y===void 0)&&y.toLowerCase().includes(a.type)&&a.onInBoundRtp(x):v.BrowserUtil.isFirefox?x.kind===a.type&&a.onInBoundRtp(x):a.onInBoundRtp(x);break;case s.RTCStatsType.RemoteCandidate:a.onRemoteCandidate(x);break;case s.RTCStatsType.LocalCandidate:a.onLocalCandidate(x);break;case s.RTCStatsType.Track:if(a.type!==h.VIDEO)break;v.SystemUtil.isIos&&p?(!((E=x.id)===null||E===void 0)&&E.toLowerCase().includes(a.type)||x.trackIdentifier.toLowerCase()===a.type)&&a.onTrack(x):a.onTrack(x)}}),t("")}).catch(function(C){n(C)})})},r.prototype.dispose=function(){this.reset()},r.prototype.onCandidatePair=function(a){(a.state==="succeeded"||a.bytesReceived)&&(this.transportStats={timestamp:Math.floor(a.timestamp),rtt:a.currentRoundTripTime||-1,bytesReceived:a.bytesReceived,bytesSent:a.bytesSent})},r.prototype.onInBoundRtp=function(a){this.currentTimeGap=(a.timestamp-this.lastTimeStamp)/1e3,this.lastTimeStamp=a.timestamp,this.inboundRtpStreamStatsDiff=this.calcDiff(a,this.inboundRtpStreamStats,["bytesReceived","framesDecoded","packetsReceived","nackCount","totalDecodeTime","jitterBufferDelay","jitterBufferEmittedCount","totalProcessingDelay","totalAssemblyTime","framesAssembledFromMultiplePackets"]),this.inboundRtpStreamStats=a,!this.canplay&&Number(a.bytesReceived)>0&&(this.canplay=!0,this.emit("canPlay"))},r.prototype.calcDiff=function(a,t,n){var c={};return n.forEach(function(p){c[p]=Number(a[p]||0)-Number(t[p]||0)}),c},r.prototype.onRemoteCandidate=function(a){this.remoteCandidate=a||{}},r.prototype.onLocalCandidate=function(a){this.localCandidate=a||{}},r.prototype.onTrack=function(a){a.frameWidth&&(this.inboundRtpStreamStats.frameWidth=a.frameWidth,this.inboundRtpStreamStats.frameHeight=a.frameHeight)},r.prototype.reset=function(){this.currentTimeGap=0,this.lastTimeStamp=0,this.transportStats={},this.remoteCandidate={},this.localCandidate={},this.inboundRtpStreamStats={},this.inboundRtpStreamStatsDiff={},this.receiver=null,this.canplay=!1,this.streamEnded=!1},r}(u.default);T.ReceiverMonitorData=e},5250:function(H,T,_){var f,l=this&&this.__extends||(f=function(v,u){return f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,i){s.__proto__=i}||function(s,i){for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&(s[e]=i[e])},f(v,u)},function(v,u){if(typeof u!="function"&&u!==null)throw new TypeError("Class extends value "+String(u)+" is not a constructor or null");function s(){this.constructor=v}f(v,u),v.prototype=u===null?Object.create(u):(s.prototype=u.prototype,new s)});Object.defineProperty(T,"__esModule",{value:!0}),T.VideoReceiverMonitorData=void 0;var m=_(1353),h=function(v){function u(){return v.call(this,m.ReceiverMonitorType.VIDEO)||this}return l(u,v),u}(m.ReceiverMonitorData);T.VideoReceiverMonitorData=h},2688:(H,T)=>{Object.defineProperty(T,"__esModule",{value:!0}),T.RTCStatsType=void 0;var _=function(){function f(){}return f.CandidatePair="candidate-pair",f.Certificate="certificate",f.Codec="codec",f.Csrc="csrc",f.DataCahnnel="data-channel",f.InboundRtp="inbound-rtp",f.LocalCandidate="local-candidate",f.OutboundRtp="outbound-rtp",f.PeerConnection="peer-connection",f.Receiver="receiver",f.RemoteCandidate="remote-candidate",f.RemoteInboundRtp="remote-inbound-rtp",f.RemoteOutboundRtp="remote-outbound-rtp",f.Sender="sender",f.Stream="stream",f.Track="track",f.Transport="transport",f.MediaSource="media-source",f}();T.RTCStatsType=_},5657:(H,T,_)=>{Object.defineProperty(T,"__esModule",{value:!0}),T.SenderMonitorData=void 0;var f=_(2688),l=function(){function m(){this._audiosender=null,this._videosender=null,this.timeStamp=0,this.curTimeStamp=0,this.audioBytesSent=0,this.curAudioBytesSent=0,this.videoBytesSent=0,this.curVideoBytesSent=0,this.audioRetransmittedBytesSent=0,this.curAudioRetransmittedBytesSent=0,this.videoRetransmiitedBytesSent=0,this.curVideoRetransmiitedBytesSent=0,this.framesSent=0,this.curFramesSent=0,this.framesEncoded=0,this.curFramesEncoded=0,this.totalEncodeTime=0,this.curTotalEncodeTime=0,this.totalPacketSendDelay=0,this.curTotalPacketSendDelay=0,this.packetsSent=0,this.curPacketsSent=0,this.rtt=0,this.localProtocol="",this.remoteProtocol="",this.localTransportAddr="",this.remoteTransportAddr="",this.frameHeight=0,this.frameWidth=0,this.efps=0,this.sfps=0,this.timeGap=0,this.abps=0,this.vbps=0,this.rt_abps=0,this.rt_vbps=0,this.encodeTimeAvg=0,this.packetSendDelayAvg=0,this.stashedData={}}return Object.defineProperty(m.prototype,"videoSender",{set:function(h){this._videosender=h},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"audioSender",{set:function(h){this._audiosender=h},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"monitorData",{get:function(){return this.doCalc(),{tt:parseFloat(this.timeGap.toFixed(0)),rtt:this.rtt,cand_re_prot:this.remoteProtocol,cand_lo_prot:this.localProtocol,cand_re_addr:this.remoteTransportAddr,cand_lo_addr:this.localTransportAddr,w:this.frameWidth,h:this.frameHeight,efps:parseFloat(this.efps.toFixed(0)),fps:parseFloat(this.sfps.toFixed(0)),abps:parseFloat(this.abps.toFixed(0)),vbps:parseFloat(this.vbps.toFixed(0)),rt_abps:parseFloat(this.rt_abps.toFixed(0)),rt_vbps:parseFloat(this.rt_vbps.toFixed(0)),v_encode_time_avg:parseFloat(this.encodeTimeAvg.toFixed(2)),v_packet_send_delay_avg:parseFloat(this.packetSendDelayAvg.toFixed(2))}},enumerable:!1,configurable:!0}),m.prototype.doCalc=function(){this.timeStamp!==0&&(this.timeGap=this.curTimeStamp-this.timeStamp,this.timeGap>0&&(this.efps=1e3*(this.curFramesEncoded-this.framesEncoded)/this.timeGap,this.sfps=1e3*(this.curFramesSent-this.framesSent)/this.timeGap,this.abps=1e3*(this.curAudioBytesSent-this.audioBytesSent)/this.timeGap,this.vbps=1e3*(this.curVideoBytesSent-this.videoBytesSent)/this.timeGap,this.rt_abps=1e3*(this.curAudioRetransmittedBytesSent-this.audioRetransmittedBytesSent)/this.timeGap,this.rt_vbps=1e3*(this.curVideoRetransmiitedBytesSent-this.videoRetransmiitedBytesSent)/this.timeGap,this.encodeTimeAvg=(this.curTotalEncodeTime-this.totalEncodeTime)/(this.curFramesEncoded-this.framesEncoded)*1e3,this.packetSendDelayAvg=(this.curTotalPacketSendDelay-this.totalPacketSendDelay)/(this.curPacketsSent-this.packetsSent)*1e3)),this.timeStamp=this.curTimeStamp,this.audioBytesSent=this.curAudioBytesSent,this.videoBytesSent=this.curVideoBytesSent,this.audioRetransmittedBytesSent=this.curAudioRetransmittedBytesSent,this.videoRetransmiitedBytesSent=this.curVideoRetransmiitedBytesSent,this.framesSent=this.curFramesSent,this.framesEncoded=this.curFramesEncoded,this.totalEncodeTime=this.curTotalEncodeTime,this.packetsSent=this.curPacketsSent,this.totalPacketSendDelay=this.curTotalPacketSendDelay},m.prototype.getInfo=function(){var h=this,v=new Promise(function(s,i){h._videosender&&h._videosender.getStats?h._videosender.getStats().then(function(e){e.forEach(function(o){if(o)switch(o.type){case f.RTCStatsType.CandidatePair:h.onCandidatePair(o);break;case f.RTCStatsType.OutboundRtp:h.onOutBoundRtp(o,"video");break;case f.RTCStatsType.RemoteCandidate:h.onRemoteCandidate(o);break;case f.RTCStatsType.LocalCandidate:h.onLocalCandidate(o)}}),s()}).catch(function(e){i(e)}):i("no video sender")}),u=new Promise(function(s,i){h._audiosender&&h._audiosender.getStats?h._audiosender.getStats().then(function(e){e.forEach(function(o){if(o)switch(o.type){case f.RTCStatsType.CandidatePair:h.onCandidatePair(o);break;case f.RTCStatsType.OutboundRtp:h.onOutBoundRtp(o,"audio");break;case f.RTCStatsType.RemoteCandidate:h.onRemoteCandidate(o);break;case f.RTCStatsType.LocalCandidate:h.onLocalCandidate(o)}}),s()}).catch(function(e){i(e)}):i("no audio sender")});return Promise.all([v,u])},m.prototype.onCandidatePair=function(h){this.curTimeStamp=h.timestamp,this.rtt=h.currentRoundTripTime},m.prototype.onOutBoundRtp=function(h,v){this.curTimeStamp=h.timestamp,v==="video"?(this.curVideoBytesSent=h.bytesSent,this.curVideoRetransmiitedBytesSent=h.retransmittedBytesSent,this.curFramesEncoded=h.framesEncoded,this.curFramesSent=h.framesSent,this.frameWidth=h.frameWidth,this.frameHeight=h.frameHeight,this.curTotalEncodeTime=h.totalEncodeTime,this.curTotalPacketSendDelay=h.totalPacketSendDelay,this.curPacketsSent=h.packetsSent):v==="audio"&&(this.curAudioBytesSent=h.bytesSent,this.curAudioRetransmittedBytesSent=h.retransmittedBytesSent)},m.prototype.onRemoteCandidate=function(h){this.curTimeStamp=h.timestamp,this.remoteProtocol=h.protocol,this.remoteTransportAddr=(h.ip||h.address)+(h.port?":"+h.port.toFixed(0):"")},m.prototype.onLocalCandidate=function(h){this.curTimeStamp=h.timestamp,this.localProtocol=h.protocol,this.localTransportAddr=(h.ip||h.address)+(h.port?":"+h.port.toFixed(0):"")},m}();T.SenderMonitorData=l},9752:function(H,T,_){var f,l=this&&this.__extends||(f=function(e,o){return f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,a){r.__proto__=a}||function(r,a){for(var t in a)Object.prototype.hasOwnProperty.call(a,t)&&(r[t]=a[t])},f(e,o)},function(e,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function r(){this.constructor=e}f(e,o),e.prototype=o===null?Object.create(o):(r.prototype=o.prototype,new r)}),m=this&&this.__assign||function(){return m=Object.assign||function(e){for(var o,r=1,a=arguments.length;r<a;r++)for(var t in o=arguments[r])Object.prototype.hasOwnProperty.call(o,t)&&(e[t]=o[t]);return e},m.apply(this,arguments)},h=this&&this.__spreadArray||function(e,o,r){if(r||arguments.length===2)for(var a,t=0,n=o.length;t<n;t++)!a&&t in o||(a||(a=Array.prototype.slice.call(o,0,t)),a[t]=o[t]);return e.concat(a||Array.prototype.slice.call(o))},v=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(T,"__esModule",{value:!0}),T.PubMonitor=void 0;var u=v(_(102)),s=_(5657),i=function(e){function o(){var r=e.call(this)||this;return r.heartbeatHandle=null,r.pc=null,r.pcCore=null,r.senderMonitorDataList=[],r}return l(o,e),o.prototype.startHeartbeat=function(r,a,t){var n=this;this.pc=r,this.pcCore=a,this.updateSenders(),this.stopHeartbeat(),this.heartbeatHandle=setInterval(function(){n.emitHeartBeat()},t||1e3)},o.prototype.stopHeartbeat=function(){this.heartbeatHandle!==null&&clearInterval(this.heartbeatHandle),this.heartbeatHandle=null},o.prototype.addTrackPair=function(r,a,t,n,c){var p=this;if(r){var C=new s.SenderMonitorData;if(a){C.videoSender=a;var x=a.transport;x&&(x.onstatechange=function(){var E,S,d,R;p.emit("onTransportStateEvent",{url:r,type:"pub",kind:"video",state:x.state,protocol:(R=(d=(S=(E=x.iceTransport)===null||E===void 0?void 0:E.getSelectedCandidatePair)===null||S===void 0?void 0:S.call(E))===null||d===void 0?void 0:d.local)===null||R===void 0?void 0:R.protocol})})}if(t){C.audioSender=t;var y=t.transport;y&&(y.onstatechange=function(){var E,S,d,R;p.emit("onTransportStateEvent",{url:r,type:"pub",kind:"audio",state:y.state,protocol:(R=(d=(S=(E=y.iceTransport)===null||E===void 0?void 0:E.getSelectedCandidatePair)===null||S===void 0?void 0:S.call(E))===null||d===void 0?void 0:d.local)===null||R===void 0?void 0:R.protocol})})}this.senderMonitorDataList.push({url:r,vMsid:n,aMsid:c,senderData:C})}},o.prototype.updateSenders=function(){var r,a=this,t=(r=this.pcCore)===null||r===void 0?void 0:r.getStreamManager().getAllTrackPairList("pub");this.senderMonitorDataList=[],t?.forEach(function(n){a.addTrackPair(n.url,n.vTransceiver,n.aTransceiver,n.vMsid,n.aMsid)})},o.prototype.emitHeartBeat=function(){var r=this;Promise.all(this.senderMonitorDataList.reduce(function(a,t){return h(h([],a,!0),[t.senderData.getInfo()],!1)},[])).then(function(){}).catch(function(a){}).finally(function(){var a=r.senderMonitorDataList.map(function(t){return m(m({},t.senderData.monitorData),{url:t.url,vMsid:t.vMsid,aMsid:t.aMsid})});r.emit("onMonitorEvent",{eventList:a,type:"pub"})})},o}(u.default);T.PubMonitor=i},4699:function(H,T,_){var f,l=this&&this.__extends||(f=function(a,t){return f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,c){n.__proto__=c}||function(n,c){for(var p in c)Object.prototype.hasOwnProperty.call(c,p)&&(n[p]=c[p])},f(a,t)},function(a,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=a}f(a,t),a.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}),m=this&&this.__awaiter||function(a,t,n,c){return new(n||(n=Promise))(function(p,C){function x(S){try{E(c.next(S))}catch(d){C(d)}}function y(S){try{E(c.throw(S))}catch(d){C(d)}}function E(S){var d;S.done?p(S.value):(d=S.value,d instanceof n?d:new n(function(R){R(d)})).then(x,y)}E((c=c.apply(a,t||[])).next())})},h=this&&this.__generator||function(a,t){var n,c,p,C,x={label:0,sent:function(){if(1&p[0])throw p[1];return p[1]},trys:[],ops:[]};return C={next:y(0),throw:y(1),return:y(2)},typeof Symbol=="function"&&(C[Symbol.iterator]=function(){return this}),C;function y(E){return function(S){return function(d){if(n)throw new TypeError("Generator is already executing.");for(;C&&(C=0,d[0]&&(x=0)),x;)try{if(n=1,c&&(p=2&d[0]?c.return:d[0]?c.throw||((p=c.return)&&p.call(c),0):c.next)&&!(p=p.call(c,d[1])).done)return p;switch(c=0,p&&(d=[2&d[0],p.value]),d[0]){case 0:case 1:p=d;break;case 4:return x.label++,{value:d[1],done:!1};case 5:x.label++,c=d[1],d=[0];continue;case 7:d=x.ops.pop(),x.trys.pop();continue;default:if(p=x.trys,!((p=p.length>0&&p[p.length-1])||d[0]!==6&&d[0]!==2)){x=0;continue}if(d[0]===3&&(!p||d[1]>p[0]&&d[1]<p[3])){x.label=d[1];break}if(d[0]===6&&x.label<p[1]){x.label=p[1],p=d;break}if(p&&x.label<p[2]){x.label=p[2],x.ops.push(d);break}p[2]&&x.ops.pop(),x.trys.pop();continue}d=t.call(a,x)}catch(R){d=[6,R],c=0}finally{n=p=0}if(5&d[0])throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}([E,S])}}},v=this&&this.__spreadArray||function(a,t,n){if(n||arguments.length===2)for(var c,p=0,C=t.length;p<C;p++)!c&&p in t||(c||(c=Array.prototype.slice.call(t,0,p)),c[p]=t[p]);return a.concat(c||Array.prototype.slice.call(t))},u=this&&this.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(T,"__esModule",{value:!0}),T.SubMonitor=void 0;var s=_(6901),i=_(5250),e=u(_(102)),o=function(){function a(){this.trackPairDataList=[]}return a.prototype.reset=function(){this.trackPairDataList=[]},a.prototype.addTrackPair=function(t,n,c,p,C,x){var y=new s.AudioReceiverMonitorData,E=new i.VideoReceiverMonitorData;p&&(E.rtpReceiver=p),C&&(y.rtpReceiver=C),x&&(E.RTCPeerconnection=x,y.RTCPeerconnection=x),this.trackPairDataList.push({url:t,vMsid:n,aMsid:c,audioReceiverMonitorData:y,videoReceiverMonitorData:E})},a}(),r=function(a){function t(){var n=a.call(this)||this;return n.canplay=!1,n.pc=null,n.pcCore=null,n.monitorTimerId=null,n.audioReceiverMonitorData=new s.AudioReceiverMonitorData,n.videoReceiverMonitorData=new i.VideoReceiverMonitorData,n.receiverMonitorController=new o,n}return l(t,a),t.prototype.start=function(n,c){this.pc=n,this.pcCore=c,this.updateTranceiversController(),this.startMonitorTimer(200)},t.prototype.updateTranceiversController=function(){var n=this;if(this.pc&&this.pcCore){var c=this.pcCore.getStreamManager().getAllTrackPairList("sub");this.receiverMonitorController.reset(),c.forEach(function(p){p.url&&n.receiverMonitorController.addTrackPair(p.url,p.vMsid,p.aMsid,p.vTransceiver,p.aTransceiver,n.pc)}),this.receiverMonitorController.trackPairDataList.forEach(function(p){n.initEvent(p)})}},t.prototype.resetTimer=function(n){this.updateTranceiversController(),this.stopMonitorTimer(),this.startMonitorTimer(n)},t.prototype.stop=function(){this.canplay=!1,this.stopMonitorTimer(),this.audioReceiverMonitorData.dispose(),this.videoReceiverMonitorData.dispose()},t.prototype.startMonitorTimer=function(n){var c=this;this.monitorTimerId||(this.monitorTimerId=window.setInterval(function(){c.onMonitorTimer()},n))},t.prototype.stopMonitorTimer=function(){this.monitorTimerId&&clearInterval(this.monitorTimerId),this.monitorTimerId=null},t.prototype.onMonitorTimer=function(){return m(this,void 0,void 0,function(){var n;return h(this,function(c){switch(c.label){case 0:return[4,this.updateMonitorData()];case 1:return c.sent(),n=[],this.receiverMonitorController.trackPairDataList.forEach(function(p){var C,x;if(p.url){var y={url:p.url};p.audioReceiverMonitorData.isExist&&(y.audio=(C=p.audioReceiverMonitorData)===null||C===void 0?void 0:C.monitorData,y.aMsid=p.aMsid),p.videoReceiverMonitorData.isExist&&(y.video=(x=p.videoReceiverMonitorData)===null||x===void 0?void 0:x.monitorData,y.vMsid=p.vMsid),n.push(y)}}),this.emit("onMonitorEvent",{eventList:n,type:"sub"}),[2]}})})},t.prototype.initEvent=function(n){var c=this,p={url:n.url||"url unknown",vMsid:n.vMsid||"vMsid unknown",aMsid:n.aMsid||"aMsid unknown"};n.audioReceiverMonitorData.isExist&&(n.audioReceiverMonitorData.on("streamEnded",function(){n.videoReceiverMonitorData&&!n.videoReceiverMonitorData.isStreamEnded||(c.emit("streamEnded",p),c.stopMonitorTimer())}),n.audioReceiverMonitorData.on("canPlay",function(){c.emitCanPlay()})),n.videoReceiverMonitorData.isExist&&(n.videoReceiverMonitorData.on("streamEnded",function(){n.audioReceiverMonitorData&&!n.audioReceiverMonitorData.isStreamEnded||(c.emit("streamEnded",p),c.stopMonitorTimer())}),n.videoReceiverMonitorData.on("canPlay",function(){c.emitCanPlay()}))},t.prototype.updateMonitorData=function(){return Promise.all(this.receiverMonitorController.trackPairDataList.reduce(function(n,c){var p,C;return v(v([],n,!0),[(p=c.audioReceiverMonitorData)===null||p===void 0?void 0:p.getInfo(),(C=c.videoReceiverMonitorData)===null||C===void 0?void 0:C.getInfo()],!1)},[]))},t.prototype.emitCanPlay=function(){this.canplay||(this.canplay=!0,this.emit("canPlay"))},t.prototype.copyMonitorData=function(){var n,c;!((c=(n=this.receiverMonitorController)===null||n===void 0?void 0:n.trackPairDataList)===null||c===void 0)&&c.length&&(this.audioReceiverMonitorData=this.receiverMonitorController.trackPairDataList[0].audioReceiverMonitorData,this.videoReceiverMonitorData=this.receiverMonitorController.trackPairDataList[0].videoReceiverMonitorData)},t.prototype.getTransportStats=function(){return m(this,void 0,void 0,function(){var n;return h(this,function(c){switch(c.label){case 0:return[4,this.updateMonitorData()];case 1:return c.sent(),this.copyMonitorData(),n={},this.videoReceiverMonitorData.isExist?n=this.videoReceiverMonitorData.monitorData.transportStats:this.audioReceiverMonitorData.isExist&&(n=this.audioReceiverMonitorData.monitorData.transportStats),[2,n]}})})},t.prototype.getRemoteVideoStats=function(){return m(this,void 0,void 0,function(){var n,c;return h(this,function(p){switch(p.label){case 0:return[4,this.updateMonitorData()];case 1:return p.sent(),this.copyMonitorData(),n={},this.videoReceiverMonitorData.isExist&&(c=this.videoReceiverMonitorData.monitorData.inboundRtpStats,n={timestamp:Math.floor(c.timestamp||0),framesDecodedPerSecond:c.framesPerSecond,framesDecoded:c.framesDecoded,frameWidth:c.frameWidth,frameHeight:c.frameHeight,bytesReceived:c.bytesReceived,jitter:c.jitter,jitterBufferDelayAvg:Number(c.jitterBufferDelay)/Number(c.jitterBufferEmittedCount),packetsLost:c.packetsLost,packetsReceived:c.packetsReceived}),[2,n]}})})},t.prototype.getRemoteAudioStats=function(){return m(this,void 0,void 0,function(){var n,c;return h(this,function(p){switch(p.label){case 0:return[4,this.updateMonitorData()];case 1:return p.sent(),this.copyMonitorData(),n={},this.audioReceiverMonitorData.isExist&&(c=this.audioReceiverMonitorData.monitorData.inboundRtpStats,n={timestamp:Math.floor(c.timestamp||0),bytesReceived:c.bytesReceived,jitter:c.jitter,jitterBufferDelayAvg:Number(c.jitterBufferDelay)/Number(c.jitterBufferEmittedCount),packetsLost:c.packetsLost,packetsReceived:c.packetsReceived}),[2,n]}})})},t}(e.default);T.SubMonitor=r},5259:(H,T)=>{Object.defineProperty(T,"__esModule",{value:!0}),T.AudioProfileMap=T.VideoProfileMap=T.ScreenProfileMap=void 0,T.ScreenProfileMap=new Map,T.ScreenProfileMap.set("480p_1",{width:640,height:480,frameRate:5,maxBitrate:300}),T.ScreenProfileMap.set("480p_2",{width:640,height:480,frameRate:30,maxBitrate:1e3}),T.ScreenProfileMap.set("720p_1",{width:1280,height:720,frameRate:5,maxBitrate:800}),T.ScreenProfileMap.set("720p_2",{width:1280,height:720,frameRate:30,maxBitrate:2e3}),T.ScreenProfileMap.set("1080p_1",{width:1920,height:1080,frameRate:5,maxBitrate:1e3}),T.ScreenProfileMap.set("1080p_2",{width:1920,height:1080,frameRate:30,maxBitrate:3e3}),T.VideoProfileMap=new Map,T.VideoProfileMap.set("120p_1",{width:160,height:120,frameRate:15,maxBitrate:65}),T.VideoProfileMap.set("120p_3",{width:120,height:120,frameRate:15,maxBitrate:50}),T.VideoProfileMap.set("180p_1",{width:320,height:180,frameRate:15,maxBitrate:140}),T.VideoProfileMap.set("180p_3",{width:180,height:180,frameRate:15,maxBitrate:100}),T.VideoProfileMap.set("180p_4",{width:240,height:180,frameRate:15,maxBitrate:120}),T.VideoProfileMap.set("240p_1",{width:320,height:240,frameRate:15,maxBitrate:200}),T.VideoProfileMap.set("240p_3",{width:240,height:240,frameRate:15,maxBitrate:140}),T.VideoProfileMap.set("240p_4",{width:424,height:240,frameRate:15,maxBitrate:220}),T.VideoProfileMap.set("360p_1",{width:640,height:360,frameRate:15,maxBitrate:400}),T.VideoProfileMap.set("360p_3",{width:360,height:360,frameRate:15,maxBitrate:260}),T.VideoProfileMap.set("360p_4",{width:640,height:360,frameRate:30,maxBitrate:600}),T.VideoProfileMap.set("360p_6",{width:360,height:360,frameRate:30,maxBitrate:400}),T.VideoProfileMap.set("360p_7",{width:480,height:360,frameRate:15,maxBitrate:320}),T.VideoProfileMap.set("360p_8",{width:480,height:360,frameRate:30,maxBitrate:490}),T.VideoProfileMap.set("360p_9",{width:640,height:360,frameRate:15,maxBitrate:800}),T.VideoProfileMap.set("360p_10",{width:640,height:360,frameRate:24,maxBitrate:800}),T.VideoProfileMap.set("360p_11",{width:640,height:360,frameRate:24,maxBitrate:1e3}),T.VideoProfileMap.set("480p_1",{width:640,height:480,frameRate:15,maxBitrate:500}),T.VideoProfileMap.set("480p_2",{width:640,height:480,frameRate:30,maxBitrate:1e3}),T.VideoProfileMap.set("480p_3",{width:480,height:480,frameRate:15,maxBitrate:400}),T.VideoProfileMap.set("480p_4",{width:640,height:480,frameRate:30,maxBitrate:750}),T.VideoProfileMap.set("480p_6",{width:480,height:480,frameRate:30,maxBitrate:600}),T.VideoProfileMap.set("480p_8",{width:848,height:480,frameRate:15,maxBitrate:610}),T.VideoProfileMap.set("480p_9",{width:848,height:480,frameRate:30,maxBitrate:930}),T.VideoProfileMap.set("480p_10",{width:640,height:480,frameRate:10,maxBitrate:400}),T.VideoProfileMap.set("720p_1",{width:1280,height:720,frameRate:15,maxBitrate:1130}),T.VideoProfileMap.set("720p_2",{width:1280,height:720,frameRate:30,maxBitrate:2e3}),T.VideoProfileMap.set("720p_3",{width:1280,height:720,frameRate:30,maxBitrate:1710}),T.VideoProfileMap.set("720p_5",{width:960,height:720,frameRate:15,maxBitrate:910}),T.VideoProfileMap.set("720p_6",{width:960,height:720,frameRate:30,maxBitrate:1380}),T.VideoProfileMap.set("1080p_1",{width:1920,height:1080,frameRate:15,maxBitrate:2080}),T.VideoProfileMap.set("1080p_2",{width:1920,height:1080,frameRate:30,maxBitrate:3e3}),T.VideoProfileMap.set("1080p_3",{width:1920,height:1080,frameRate:30,maxBitrate:3150}),T.VideoProfileMap.set("1080p_5",{width:1920,height:1080,frameRate:60,maxBitrate:4780}),T.VideoProfileMap.set("1440p_1",{width:2560,height:1440,frameRate:30,maxBitrate:4850}),T.VideoProfileMap.set("1440p_2",{width:2560,height:1440,frameRate:60,maxBitrate:7350}),T.VideoProfileMap.set("4K_1",{width:3840,height:2160,frameRate:30,maxBitrate:8910}),T.VideoProfileMap.set("4K_3",{width:3840,height:2160,frameRate:60,maxBitrate:13500}),T.AudioProfileMap=new Map,T.AudioProfileMap.set("standard",{sampleRate:48e3,channelCount:1,maxBitrate:64}),T.AudioProfileMap.set("high",{sampleRate:48e3,channelCount:1,maxBitrate:128}),T.AudioProfileMap.set("standard-stereo",{sampleRate:48e3,channelCount:2,maxBitrate:80}),T.AudioProfileMap.set("high-stereo",{sampleRate:48e3,channelCount:2,maxBitrate:192})},5553:(H,T)=>{Object.defineProperty(T,"__esModule",{value:!0}),T.Datachannel=void 0;var _=function(){function f(l){this.pc=l,this.messageId=1,this.dataChannel=this.pc.createDataChannel("GRTNDataChannel"),this.dataChannel.onopen=function(m){},this.dataChannel.onmessage=function(m){m.data},this.dataChannel.onclose=function(m){},this.dataChannel.onerror=function(m){}}return f.prototype.addTrack=function(l,m){return new Promise(function(h,v){})},f.prototype.removeTrack=function(l,m){return new Promise(function(h,v){})},f.prototype.createPublishPacket=function(){var l={type:"pub",version:1,msg_id:this.messageId,streams:[]};return++this.messageId,l},f}();T.Datachannel=_},2470:function(H,T,_){var f,l=this&&this.__extends||(f=function(t,n){return f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,p){c.__proto__=p}||function(c,p){for(var C in p)Object.prototype.hasOwnProperty.call(p,C)&&(c[C]=p[C])},f(t,n)},function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function c(){this.constructor=t}f(t,n),t.prototype=n===null?Object.create(n):(c.prototype=n.prototype,new c)}),m=this&&this.__assign||function(){return m=Object.assign||function(t){for(var n,c=1,p=arguments.length;c<p;c++)for(var C in n=arguments[c])Object.prototype.hasOwnProperty.call(n,C)&&(t[C]=n[C]);return t},m.apply(this,arguments)},h=this&&this.__awaiter||function(t,n,c,p){return new(c||(c=Promise))(function(C,x){function y(d){try{S(p.next(d))}catch(R){x(R)}}function E(d){try{S(p.throw(d))}catch(R){x(R)}}function S(d){var R;d.done?C(d.value):(R=d.value,R instanceof c?R:new c(function(D){D(R)})).then(y,E)}S((p=p.apply(t,n||[])).next())})},v=this&&this.__generator||function(t,n){var c,p,C,x,y={label:0,sent:function(){if(1&C[0])throw C[1];return C[1]},trys:[],ops:[]};return x={next:E(0),throw:E(1),return:E(2)},typeof Symbol=="function"&&(x[Symbol.iterator]=function(){return this}),x;function E(S){return function(d){return function(R){if(c)throw new TypeError("Generator is already executing.");for(;x&&(x=0,R[0]&&(y=0)),y;)try{if(c=1,p&&(C=2&R[0]?p.return:R[0]?p.throw||((C=p.return)&&C.call(p),0):p.next)&&!(C=C.call(p,R[1])).done)return C;switch(p=0,C&&(R=[2&R[0],C.value]),R[0]){case 0:case 1:C=R;break;case 4:return y.label++,{value:R[1],done:!1};case 5:y.label++,p=R[1],R=[0];continue;case 7:R=y.ops.pop(),y.trys.pop();continue;default:if(C=y.trys,!((C=C.length>0&&C[C.length-1])||R[0]!==6&&R[0]!==2)){y=0;continue}if(R[0]===3&&(!C||R[1]>C[0]&&R[1]<C[3])){y.label=R[1];break}if(R[0]===6&&y.label<C[1]){y.label=C[1],C=R;break}if(C&&y.label<C[2]){y.label=C[2],y.ops.push(R);break}C[2]&&y.ops.pop(),y.trys.pop();continue}R=n.call(t,y)}catch(D){R=[6,D],p=0}finally{c=C=0}if(5&R[0])throw R[1];return{value:R[0]?R[1]:void 0,done:!0}}([S,d])}}},u=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(T,"__esModule",{value:!0}),T.PcRestorer=void 0;var s=u(_(102)),i=_(5917),e=_(280),o=_(9428),r=_(5044),a=function(t){function n(c){var p=t.call(this)||this;return p.restoring=!1,p.subscriber=c.subscriber,p.publisher=c.publisher,p.commonController=c.commonController,p}return l(n,t),n.prototype.isReconnecting=function(){return this.restoring},n.prototype.restore=function(c){var p,C=this;if(!this.restoring)return new Promise(function(x,y){return h(C,void 0,void 0,function(){var E,S,d,R,D,A,b,g,O,k,U,w,W=this;return v(this,function(M){switch(M.label){case 0:if(this.restoring=!0,!(E=this.restructureStreams())||!E.length)return[3,9];switch(this.subscriber.unsubscribe(),this.publisher.unpublish(),S=Promise.reject().catch(function(){}),d=E[0],R={retryTimes:i.DEFAULT_RETRY_SUBSCRIBE_LIMIT,retryInterval:i.DEFAULT_RETRY_SUBSCRIBE_INTERVAL},D=d.url,c&&(D=this.makeIpQuery(D,c,d.type)),d.type){case"sub":this.commonController.setPeerconnection(this.subscriber.getPeerConnection()),this.subscriber.incrementReconnectTimes(),R.retryTimes=this.subscriber.getSubscribeConfig().retryTimes||i.DEFAULT_RETRY_SUBSCRIBE_LIMIT,R.retryInterval=this.subscriber.getSubscribeConfig().retryInterval||i.DEFAULT_RETRY_SUBSCRIBE_INTERVAL,S=this.subscriber.subscribeWithReconnect(D,m(m({},this.subscriber.getSubscribeConfig()),{vMsid:d.vMsid,aMsid:d.aMsid}));break;case"pub":d.targetStream&&(this.commonController.setPeerconnection(this.publisher.getPeerConnection()),this.publisher.incrementReconnectTimes(),R.retryTimes=this.publisher.getPublishConfig().retryTimes||i.DEFAULT_RETRY_PUBLISH_LIMIT,R.retryInterval=this.publisher.getPublishConfig().retryInterval||i.DEFAULT_RETRY_PUBLISH_INTERVAL,S=this.publisher.publishWithReconnect(D,d.targetStream,m(m({},this.publisher.getPublishConfig()),{vMsid:d.vMsid,aMsid:d.aMsid})));break;case"sub-data":d.msid&&d.label&&(S=this.commonController.subscribeAddDatachannel({signalUrl:D,url:D,label:d.label,msid:d.msid}));break;case"pub-data":d.msid&&d.label&&(S=this.commonController.publishAddDatachannel({signalUrl:d.url,url:d.url,label:d.label,msid:d.msid}));break;default:console.log("RTS [PC RESTORER] unknown http reconnect type",d.type)}M.label=1;case 1:return M.trys.push([1,3,,4]),[4,S];case 2:return A=M.sent(),p=typeof A=="string"?A:A?.traceId,[3,4];case 3:return b=M.sent(),y(b),this.restoring=!1,[2];case 4:g=new Promise(function(N,P){clearTimeout(W.dcOpenTimer),W.dcOpenTimer=setTimeout(function(){var V=new r.RtsError(o.ErrorCode.ERROR_DATACHANNEL_OPEN,"reconnect pc datachannel open timeout after ".concat(i.DEFAULT_RETRY_DATACHANNEL_TIMEOUT,"ms"),"",{});P(V)},i.DEFAULT_RETRY_DATACHANNEL_TIMEOUT),W.commonController.on("datachannelStatusChange",function(V){V.status===e.EDatachannelStatus.DATACHANNEL_STATUS_OPEN&&(clearTimeout(W.dcOpenTimer),N())})}),M.label=5;case 5:return M.trys.push([5,7,,8]),[4,g];case 6:return M.sent(),[3,8];case 7:return O=M.sent(),y(O),this.restoring=!1,[2];case 8:for(k=[],U=1;U<E.length;U++)if(w=E[U])switch(w.type){case"sub":k.push(this.commonController.subscribeAdd([{url:w.url,vMsid:w.vMsid,aMsid:w.aMsid,targetStream:w.targetStream,subAudio:!(!w.aMsid||!w.aMsid.length),subVideo:!(!w.vMsid||!w.vMsid.length)}],!0).catch(function(N){W.emit("onError",W.makeSingleStreamReconnectError(N))}));break;case"pub":k.push(this.commonController.publishAdd([{url:w.url,stream:w.targetStream,vMsid:w.vMsid,aMsid:w.aMsid}]).catch(function(N){W.emit("onError",W.makeSingleStreamReconnectError(N))}));break;case"sub-data":w.label&&w.msid&&k.push(this.commonController.subscribeAddDatachannel({signalUrl:w.url,url:w.url,label:w.label,msid:w.msid}).catch(function(N){W.emit("onError",W.makeSingleStreamReconnectError(N))}));break;case"pub-data":w.label&&w.msid&&k.push(this.commonController.publishAddDatachannel({signalUrl:w.url,url:w.url,label:w.label,msid:w.msid}).catch(function(N){W.emit("onError",W.makeSingleStreamReconnectError(N))}));break;default:console.log("RTS [PC RESTORER] unknown pc reconnect type")}Promise.allSettled(k).then(function(N){var P,V,j=N.find(function(z){return z.status==="fulfilled"});p=((V=(P=j?.value)===null||P===void 0?void 0:P[0])===null||V===void 0?void 0:V.traceId)||p,x({traceId:p,latestUrl:D})}),M.label=9;case 9:return this.restoring=!1,[2]}})})})},n.prototype.restructureStreams=function(){var c,p=(c=this.commonController.peerCore)===null||c===void 0?void 0:c.getStreamManager(),C=p?.getAllStreamListWithMsids(),x=p?.getAllDatachannelList(),y=[];return C?.forEach(function(E){var S;(S=E.streams)===null||S===void 0||S.forEach(function(d){var R=[],D=[],A=E.type,b=E.latestUrl,g=d;E.msids.forEach(function(O){O.streamId===d.id&&(O.type==="video"?D.push(O.name):O.type==="audio"&&R.push(O.name))}),y.push({aMsid:R,vMsid:D,type:A,url:b,targetStream:g})})}),x?.forEach(function(E){E.msids.forEach(function(S){if(S.name&&S.label){var d=S.name,R=S.label,D=E.type,A=E.latestUrl;y.push({msid:d,type:D,label:R,url:A})}})}),y},n.prototype.makeSingleStreamReconnectError=function(c){return new r.RtsError(o.ErrorCode.ERROR_SINGLE_PC_STREAM_RECONNECT_FAILED,"single stream reconnect failed","",{originError:c})},n.prototype.makeIpQuery=function(c,p,C){var x,y,E,S="ali_prefer_media_server",d="ip_migration",R=c,D="";if(C.indexOf("sub")===0&&(!((y=p.pull)===null||y===void 0)&&y.length)?D=p.pull[0]:C.indexOf("pub")===0&&(!((E=p.push)===null||E===void 0)&&E.length)&&(D=p.push[0]),D){var A=c.split("?"),b=A[0],g=A[1],O=void 0;g?((O=new URLSearchParams(g)).has(S)?O.set(S,D):O.append(S,D),!O.has(d)&&O.append(d,"on")):O=new URLSearchParams(((x={})[S]=D,x[d]="on",x)),R="".concat(b,"?").concat(O.toString())}return R},n}(s.default);T.PcRestorer=a},4865:function(H,T,_){var f,l=this&&this.__extends||(f=function(A,b){return f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(g,O){g.__proto__=O}||function(g,O){for(var k in O)Object.prototype.hasOwnProperty.call(O,k)&&(g[k]=O[k])},f(A,b)},function(A,b){if(typeof b!="function"&&b!==null)throw new TypeError("Class extends value "+String(b)+" is not a constructor or null");function g(){this.constructor=A}f(A,b),A.prototype=b===null?Object.create(b):(g.prototype=b.prototype,new g)}),m=this&&this.__assign||function(){return m=Object.assign||function(A){for(var b,g=1,O=arguments.length;g<O;g++)for(var k in b=arguments[g])Object.prototype.hasOwnProperty.call(b,k)&&(A[k]=b[k]);return A},m.apply(this,arguments)},h=this&&this.__awaiter||function(A,b,g,O){return new(g||(g=Promise))(function(k,U){function w(N){try{M(O.next(N))}catch(P){U(P)}}function W(N){try{M(O.throw(N))}catch(P){U(P)}}function M(N){var P;N.done?k(N.value):(P=N.value,P instanceof g?P:new g(function(V){V(P)})).then(w,W)}M((O=O.apply(A,b||[])).next())})},v=this&&this.__generator||function(A,b){var g,O,k,U,w={label:0,sent:function(){if(1&k[0])throw k[1];return k[1]},trys:[],ops:[]};return U={next:W(0),throw:W(1),return:W(2)},typeof Symbol=="function"&&(U[Symbol.iterator]=function(){return this}),U;function W(M){return function(N){return function(P){if(g)throw new TypeError("Generator is already executing.");for(;U&&(U=0,P[0]&&(w=0)),w;)try{if(g=1,O&&(k=2&P[0]?O.return:P[0]?O.throw||((k=O.return)&&k.call(O),0):O.next)&&!(k=k.call(O,P[1])).done)return k;switch(O=0,k&&(P=[2&P[0],k.value]),P[0]){case 0:case 1:k=P;break;case 4:return w.label++,{value:P[1],done:!1};case 5:w.label++,O=P[1],P=[0];continue;case 7:P=w.ops.pop(),w.trys.pop();continue;default:if(k=w.trys,!((k=k.length>0&&k[k.length-1])||P[0]!==6&&P[0]!==2)){w=0;continue}if(P[0]===3&&(!k||P[1]>k[0]&&P[1]<k[3])){w.label=P[1];break}if(P[0]===6&&w.label<k[1]){w.label=k[1],k=P;break}if(k&&w.label<k[2]){w.label=k[2],w.ops.push(P);break}k[2]&&w.ops.pop(),w.trys.pop();continue}P=b.call(A,w)}catch(V){P=[6,V],O=0}finally{g=k=0}if(5&P[0])throw P[1];return{value:P[0]?P[1]:void 0,done:!0}}([M,N])}}},u=this&&this.__importDefault||function(A){return A&&A.__esModule?A:{default:A}};Object.defineProperty(T,"__esModule",{value:!0}),T.RtsPeerconnection=void 0;var s,i=_(280),e=_(233),o=_(4315),r=_(2718),a=u(_(102)),t=_(1698),n=_(5917),c=_(4699),p=_(9752),C=_(5553),x=_(9428),y=_(5044),E=u(_(6834));(function(A){A.Subscribe="sub",A.Publish="pub"})(s||(s={}));var S=window.RTCRtpReceiver&&"createEncodedStreams"in RTCRtpReceiver.prototype,d=window.RTCRtpReceiver&&"transform"in RTCRtpReceiver.prototype&&"RTCRtpScriptTransform"in window,R=function(A){function b(){var g=A.call(this)||this;return g.connectingEventSent=!1,g.reused=!1,g.transformWorkerList=new D,g.receiverCodecPreferences={},g.senderCodecPreferences={},g.heartbeatTimeoutHandler=null,g.noHeartbeatCount=0,g.subMonitor=new c.SubMonitor,g.subMonitor.on("onMonitorEvent",function(O){g.emit("onMonitorEvent",O)}),g.subMonitor.on("streamEnded",function(){g.emit("streamEnded")}),g.subMonitor.on("canPlay",function(){}),g.pubMonitor=new p.PubMonitor,g.pubMonitor.on("onMonitorEvent",function(O){g.emit("onMonitorEvent",O)}),g.pubMonitor.on("onTransportStateEvent",function(O){g.emit("onTransportStateEvent",O)}),g}return l(b,A),Object.defineProperty(b.prototype,"isConnected",{get:function(){var g;return((g=this.pc)===null||g===void 0?void 0:g.connectionState)==="connected"},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"isReused",{get:function(){return this.reused},set:function(g){this.reused=!!g},enumerable:!1,configurable:!0}),b.prototype.getWorkerManager=function(){return this.transformWorkerList},b.prototype.getPc=function(){return this.pc},b.prototype.getPeerCore=function(){return this.peerCore},b.prototype.getSubMonitor=function(){return this.subMonitor},b.prototype.getPubMonitor=function(){return this.pubMonitor},b.prototype.playStart=function(){this.subMonitor.resetTimer(1e3)},b.prototype.pushStart=function(){this.pc&&this.peerCore&&this.pubMonitor.startHeartbeat(this.pc,this.peerCore)},b.prototype.sample=function(){return h(this,void 0,void 0,function(){return v(this,function(g){switch(g.label){case 0:return[4,this.subMonitor.onMonitorTimer()];case 1:return g.sent(),[2]}})})},b.prototype.subAdd=function(g,O){var k;return(k=this.peerCore)===null||k===void 0?void 0:k.subscribeAdd(g,O)},b.prototype.subActive=function(g){var O;return(O=this.peerCore)===null||O===void 0?void 0:O.subscribeActive(g)},b.prototype.subStop=function(g){var O;return(O=this.peerCore)===null||O===void 0?void 0:O.subscribeStop(g)},b.prototype.subDeleteTracks=function(g){var O;return(O=this.peerCore)===null||O===void 0?void 0:O.subscribeDeleteTracks(g)},b.prototype.pubAdd=function(g){var O;return(O=this.peerCore)===null||O===void 0?void 0:O.publishAdd(g)},b.prototype.pubDeleteTracks=function(g){var O;return(O=this.peerCore)===null||O===void 0?void 0:O.publishDeleteTracks(g)},b.prototype.pubReplaceTracks=function(g){var O;return(O=this.peerCore)===null||O===void 0?void 0:O.publishReplaceTracks(g)},b.prototype.pubStop=function(g){var O;return(O=this.peerCore)===null||O===void 0?void 0:O.publishStop(g)},b.prototype.createOffer=function(g,O,k,U){var w=this;return U===void 0&&(U={publishUrl:""}),new Promise(function(W,M){var N;(N=w.cancelable)===null||N===void 0||N.cancel();var P={googCpuOveruseDetection:!1,sdpSemantics:"unified-plan",encodedInsertableStreams:U.encodedInsertableStreams,bundlePolicy:"max-bundle",rtcpMuxPolicy:"require"};if(e.BrowserUtil.isChrome&&Number(e.BrowserUtil.browserMainVersion)<=55&&(P.iceServers=[]),w.pc=new RTCPeerConnection(P),w.encodedInsertableStreams=U.encodedInsertableStreams,w.peerCore=new i.PeerConnectionCore({pc:w.pc,onDatachannelEvent:function(G){var X,re;w.emit("datachannelStatusChange",{status:G}),U.disableHeartbeat||(G===i.EDatachannelStatus.DATACHANNEL_STATUS_OPEN?((0,r.hebtLog)("DATACHANNEL OPEN"," heartbeat send scheduler started"),(X=w.peerCore)===null||X===void 0||X.startSignalHeartbeatTimer()):G===i.EDatachannelStatus.DATACHANNEL_STATUS_CLOSE&&((0,r.hebtLog)("DATACHANNEL CLOSE"," heartbeats from now on will fail"),(re=w.peerCore)===null||re===void 0||re.stopSignalHeartbeatTimer()))},onInnerSubscribeDelete:function(G){w.emit("innerSubscribeDeleteTracks",G)},offerSdpHook:U.offerSdpHook,answerSdpHook:U.answerSdpHook,delayOpen:t.configProvider.getContext().datachannelDelayOpen}),w.registerPeerCoreListeners(U),w.peerCore.setReceiverCodecPreferences(w.receiverCodecPreferences),w.peerCore.setSenderCodecPreferences(w.senderCodecPreferences),w.pc.onconnectionstatechange=function(){var G=(w.pc||{}).connectionState;switch(w.connectingEventSent||(w.connectingEventSent=!0,w.emit("connectStatusChange",{status:n.EConnectStatus.CONNECT_STATUS_CONNECTING})),G!=="connecting"&&w.clearStatusTimer(),G){case"connected":w.emit("onConnected"),w.emit("connectStatusChange",{status:n.EConnectStatus.CONNECT_STATUS_CONNECTED});break;case"disconnected":w.emit("connectStatusChange",{status:n.EConnectStatus.CONNECT_STATUS_RECONNECTING});break;case"failed":case"closed":w.handleClosed()}},w.clearStatusTimer(),w.statusTimer=window.setTimeout(function(){w.handleClosed()},b.CONNECT_TIMEOUT),k){w.localStream=k,w.sdpUtil=new o.SdpUtil(w.localStream);var V=w.addStream();if(V!==0)return w.pc=void 0,void M(new y.RtsError(V,V===x.ErrorCode.ERROR_MEDIASTREAMTRACK_AUDIO_NONE?"need audio track":"",""))}else w.sdpUtil=new o.SdpUtil;var j={};k||(j=w.handleSubTransceiver(g,O).added?{}:{offerToReceiveAudio:g,offerToReceiveVideo:O});var z=w.pc.createOffer(j);w.cancelable=(0,r.makeCancelable)(z),w.cancelable.promise.then(function(G){var X,re,te,oe,ue,se,ce;if(w.cancelable=void 0,w.sdpUtil){if(w.sdpUtil.init(String(G.sdp)),w.sdpUtil.addNack(),w.sdpUtil.addSps(),U.disableStereo||w.sdpUtil.addStereo(),U.cumuDelay&&(w.sdpUtil.setSingleNaluPackMode()||w.emit("cumuDelayNotSupported")),k&&w.sdpUtil.modifyTrackName({vMsid:U.vMsid&&U.vMsid[0],aMsid:U.aMsid&&U.aMsid[0]}),w.pc){if(G.sdp=w.sdpUtil.sdp,k&&k.sdpHook&&typeof k.sdpHook=="function")try{G.sdp=k.sdpHook(G.sdp)}catch(he){console.log("Error in sdp hook",he)}(X=w.peerCore)===null||X===void 0||X.setPrevOfferSdp(G.sdp||"");var de=[];if(k)try{(re=w.peerCore)===null||re===void 0||re.patchPublishStreamManagerRecord(U.publishUrl||"",m(m({},U),{stream:k,cumuDelay:U.cumuDelay}));var pe=(te=w.peerCore)===null||te===void 0?void 0:te.parseSdp(G.sdp||"");de=(oe=w.peerCore)===null||oe===void 0?void 0:oe.updateTrackInfoList({url:U.publishUrl||"",stream:k,vMsid:(ue=w.peerCore)===null||ue===void 0?void 0:ue.unifyMsid(U.vMsid,"video"),aMsid:(se=w.peerCore)===null||se===void 0?void 0:se.unifyMsid(U.aMsid,"audio"),sdpMediaList:(ce=pe?.detail)===null||ce===void 0?void 0:ce.media})}catch(he){console.log(he)}if(U.offerSdpHook&&typeof U.offerSdpHook=="function")try{G.sdp=U.offerSdpHook(G.sdp||"")}catch(he){console.log("Error in offerSdpHook",he)}w.pc.setLocalDescription(G).then(function(){w.pc?W({desp:w.pc.localDescription,publishTrackInfoList:de}):M(new y.RtsError(x.ErrorCode.ERROR_CREATEOFFER,"no pc",""))}).catch(function(he){M(new y.RtsError(x.ErrorCode.ERROR_CREATEOFFER,"setLocalDescription error "+he.message,""))})}}else M(new y.RtsError(x.ErrorCode.ERROR_CREATEOFFER,"no sdp",""))}).catch(function(G){G.isCanceled||M(new y.RtsError(x.ErrorCode.ERROR_CREATEOFFER,G.message?G.message:"create offer error",""))})})},b.prototype.recvAnswer=function(g,O){var k,U,w=this;return O===void 0&&(O={}),(k=this.peerCore)===null||k===void 0||k.setPrevAnswerSdp((U=g?.jsep)===null||U===void 0?void 0:U.sdp),new Promise(function(W,M){var N,P,V,j,z,G;if(w.pc){if(w.pc.ontrack=function(re){w.pc&&w.peerCore&&w.subMonitor.start(w.pc,w.peerCore),setTimeout(function(){w.handleEncodedInsertableStreams({receiver:re.receiver})}),w.isReused||w.emit("onTrackEvent",re)},w.pc.signalingState==="closed")return void M({message:"PeerConnection signalingState is closed"});if(!((N=g.jsep)===null||N===void 0)&&N.sdp){var X=new o.SdpUtil;X.init(String((P=g.jsep)===null||P===void 0?void 0:P.sdp)),w.localStream&&(w.localStream.audioTrack&&!w.localStream.videoTrack&&(X.removeTwccRtcpFb(),(V=w.peerCore)===null||V===void 0||V.setRemoveTwcc(!0)),X.setDirection()),O.tcpOnly&&X.hasTcpCandidate&&X.removeUdpCandidate(),g.jsep.sdp=X.sdp,(j=w.peerCore)===null||j===void 0||j.setPrevAnswerSdp((z=g?.jsep)===null||z===void 0?void 0:z.sdp)}if(!((G=g.jsep)===null||G===void 0)&&G.sdp&&O.answerSdpHook&&typeof O.answerSdpHook=="function")try{g.jsep.sdp=O.answerSdpHook(g.jsep.sdp)}catch(re){console.log("Error in answerSdpHook",re)}w.pc.setRemoteDescription(new RTCSessionDescription(g.jsep)).then(function(re){var te;w.pc&&w.localStream&&(w.localStream.setEncodeParam(w.pc),(te=w.pc)===null||te===void 0||te.getSenders().forEach(function(oe){w.handleEncodedInsertableStreams({sender:oe})})),W(re)}).catch(function(re){re.sdp=g.jsep.sdp,M(re)})}else M({message:"no PeerConnection"})})},b.prototype.setReceiverCodecPreferences=function(g){var O;this.receiverCodecPreferences=m({},g),(O=this.peerCore)===null||O===void 0||O.setReceiverCodecPreferences(this.receiverCodecPreferences)},b.prototype.setSenderCodecPreferences=function(g){var O;this.senderCodecPreferences=m({},g),(O=this.peerCore)===null||O===void 0||O.setSenderCodecPreferences(this.senderCodecPreferences)},b.prototype.removeTrack=function(g,O){var k=this;return new Promise(function(U,w){k.pc&&k.dataChannel&&k.dataChannel.removeTrack(g,O).then(function(){}).catch(function(W){w(W)})})},b.prototype.replaceTrack=function(g,O,k){var U=this;return new Promise(function(w,W){k||U.pc&&U.dataChannel&&U.dataChannel.removeTrack(g,O).then(function(){}).catch(function(M){W(M)})})},b.prototype.sendSEI=function(g){var O;if(!g.data)throw new Error("No data to send, please check your params.");if(!(g.data instanceof ArrayBuffer))throw new Error("data should be ArrayBuffer, please check your params.");if(!g.url)throw new Error("url is required, please check your params.");if(!g.vMsid)throw new Error("vMsid is required, please check your params.");if(S||d){var k=this.transformWorkerList.findByMsid({url:g.url,kind:n.TrackType.VIDEO,source:n.EWorkerSource.Sender,msid:g.vMsid});if(!k)throw new Error("No published stream found, please check your url: "+g.url);(O=k?.worker)===null||O===void 0||O.postMessage({operation:n.EWorkerAction.InserSEI,payloadType:g.payloadType,repeatCount:g.repeatCount,keyframeOnly:g.keyframeOnly,sei:g.data})}},b.prototype.updateStatsForSEI=function(g,O){var k=this,U=O==="pub";this.encodedInsertableStreams&&(S||d)&&g.forEach(function(w){var W,M=k.transformWorkerList.findByMsid({url:w.url,kind:n.TrackType.VIDEO,source:U?n.EWorkerSource.Sender:n.EWorkerSource.Receiver,msid:w.vMsid});M&&((W=M?.worker)===null||W===void 0||W.postMessage({operation:U?n.EWorkerAction.UpdatePubStats:n.EWorkerAction.UpdateSubStats,stats:w}))})},b.prototype.reset=function(){this.cancelable&&(this.cancelable.cancel(),this.cancelable=void 0),this.peerCore&&(this.peerCore.dispose(),this.peerCore=void 0),this.pc&&(this.pc.onconnectionstatechange=function(){},this.pc.ontrack=function(){},this.pc.close(),this.pc=void 0,this.clearStatusTimer()),this.sdpUtil&&(this.sdpUtil.dispose(),this.sdpUtil=void 0),this.localStream&&(this.localStream=void 0),this.transformWorkerList.dispose(),this.subMonitor.stop(),this.pubMonitor.stopHeartbeat(),this.isReused=!1,this.encodedInsertableStreams=void 0,this.stopHeartbeatTimeoutChecker()},b.prototype.addStream=function(){if(this.localStream){if(this.pc){if(this.localStream.audioTrack){var g=this.pc.addTransceiver(this.localStream.audioTrack,{direction:"sendonly",streams:[this.localStream.mediaStream]});if(this.senderCodecPreferences.audio)try{g.setCodecPreferences(this.senderCodecPreferences.audio)}catch(k){console.warn("setCodecPreferences error",k)}}if(this.localStream.videoTrack){var O=this.pc.addTransceiver(this.localStream.videoTrack,{direction:"sendonly",streams:[this.localStream.mediaStream]});if(this.senderCodecPreferences.video)try{O.setCodecPreferences(this.senderCodecPreferences.video)}catch(k){console.warn("setCodecPreferences error",k)}}return 0}return x.ErrorCode.ERROR_PREERCONNECTION_UNKNOWN}return x.ErrorCode.ERROR_MEDIASTREAMTRACK_AUDIO_NONE},b.prototype.handleEncodedInsertableStreams=function(g){var O,k,U=this;if(this.encodedInsertableStreams){var w=g.receiver,W=g.sender,M=w?n.EWorkerSource.Receiver:n.EWorkerSource.Sender,N=w||W,P=N.track;if(!P)return console.warn("no track in senderReceiver!");var V=P.kind,j=(k=(O=this.peerCore)===null||O===void 0?void 0:O.getStreamManager())===null||k===void 0?void 0:k.getAllTrackPairList(M===n.EWorkerSource.Receiver?s.Subscribe:s.Publish),z=j?.find(function(se){var ce,de;return((de=(ce=se[V===n.TrackType.VIDEO?"vTransceiver":"aTransceiver"])===null||ce===void 0?void 0:ce.track)===null||de===void 0?void 0:de.id)===P.id});if(!z)return console.warn("no existing stream info found");var G=new E.default;if(this.transformWorkerList.removeByMsid({url:z.url||"",kind:V,source:M,msid:(V===n.TrackType.VIDEO?z.vMsid:z.aMsid)||""}),!this.transformWorkerList.add({worker:G,kind:V,source:M,info:z,receiver:w,sender:W}))return console.log("worker existing, skip.",V);var X=n.EWorkerAction.Setup,re=performance.timeOrigin;if(S){var te=N.createEncodedStreams(),oe=te.readable,ue=te.writable;G.postMessage({source:M,readable:oe,writable:ue,operation:X},[oe,ue])}else d&&(N.transform=new RTCRtpScriptTransform(G,{source:M,operation:X,windowTimeOrigin:re}));z.cumuDelay&&V==="video"&&(G.postMessage({operation:n.EWorkerAction.SwitchCumuDelay,enable:!0,windowTimeOrigin:re}),S||d||this.emit("cumuDelayNotSupported")),G.onmessage=function(se){var ce=se.data,de=ce.type,pe=ce.data,he=ce.frameInfo;de==="encodedFrame"&&U.emit("encodedFrame",{kind:V,url:z.originUrl,vMsid:V==="video"?z?.vMsid:void 0,aMsid:V==="audio"?z?.aMsid:void 0,frame:m({data:pe},he),subStats:se.data.subStats})}}},b.prototype.handleSubTransceiver=function(g,O){var k,U,w,W=!1;if(!((k=this.pc)===null||k===void 0)&&k.addTransceiver){if(g&&(U=this.pc.addTransceiver("audio",{direction:"recvonly"}),this.receiverCodecPreferences.audio))try{U.setCodecPreferences(this.receiverCodecPreferences.audio)}catch(M){console.warn("setCodecPreferences error",M)}if(O&&(w=this.pc.addTransceiver("video",{direction:"recvonly"}),this.receiverCodecPreferences.video))try{w.setCodecPreferences(this.receiverCodecPreferences.video)}catch(M){console.warn("setCodecPreferences error",M)}W=!0}return{added:W,aTransceiver:U,vTransceiver:w}},b.prototype.initDataChannel=function(){!this.dataChannel&&this.pc&&(this.dataChannel=new C.Datachannel(this.pc))},b.prototype.handleClosed=function(){this.subMonitor.stop(),this.emit("connectStatusChange",{status:n.EConnectStatus.CONNECT_STATUS_DISCONNECTED}),this.emit("onEnd")},b.prototype.clearStatusTimer=function(){this.statusTimer&&clearTimeout(this.statusTimer),this.statusTimer=void 0},b.prototype.registerPeerCoreListeners=function(g){var O=this;this.peerCore?(g.disableHeartbeat||((0,r.hebtLog)("heartbeat [timeout checker] started"),this.startHeartbeatTimeoutChecker()),this.peerCore.on("message",function(k){O.emit("message",k)}),this.peerCore.on("hebtReceived",function(k){(0,r.hebtLog)("EVENT: HEBT RECV",k),O.noHeartbeatCount=0,O.emit("hebtReceived",k)}),this.peerCore.on("streamError",function(k){(0,r.hebtLog)("EVENT: \u5355\u8DEF\u6D41\u9519\u8BEF",k),O.emit("streamError",k)}),this.peerCore.on("streamReconnect",function(k){(0,r.hebtLog)("EVENT: \u5355\u8DEF\u6D41\u91CD\u8FDE",k),O.emit("streamReconnect",k)}),this.peerCore.on("traceIdUpdate",function(k){O.emit("traceIdUpdate",k)}),this.peerCore.on("pcReconnect",function(k){(0,r.hebtLog)("EVENT: PC\u91CD\u8FDE",k),O.emit("pcReconnect",k)}),this.peerCore.on("datachannelNotEnabled",function(){var k;(0,r.hebtLog)("EVENT: \u6570\u636E\u901A\u9053\u672A\u5F00\u542F"),O.stopHeartbeatTimeoutChecker(),(k=O.peerCore)===null||k===void 0||k.stopSignalHeartbeatTimer()})):(0,r.hebtLog)("PeerCore listeners registration failed.")},b.prototype.startHeartbeatTimeoutChecker=function(){var g=this;this.stopHeartbeatTimeoutChecker(),this.heartbeatTimeoutHandler=setInterval(function(){g.noHeartbeatCount++,g.noHeartbeatCount>=n.DEFAULT_HEARTBEAT_TIMEOUT&&((0,r.hebtLog)("EVENT: \u5FC3\u8DF3\u8D85\u65F6, PC\u91CD\u8FDE"),g.stopHeartbeatTimeoutChecker(),g.emit("pcReconnect",{recode:"",reMsg:"heartbeat timeout"}))},1e3)},b.prototype.stopHeartbeatTimeoutChecker=function(){this.heartbeatTimeoutHandler!==null&&clearInterval(this.heartbeatTimeoutHandler),this.heartbeatTimeoutHandler=null,this.noHeartbeatCount=0},b.CONNECT_TIMEOUT=1e4,b}(a.default);T.RtsPeerconnection=R;var D=function(){function A(){this.workerList=[]}return A.prototype.add=function(b){return!this.findByMsid({url:b.info.url,source:b.source,kind:b.kind,msid:b.kind===n.TrackType.VIDEO?b.info.vMsid:b.info.aMsid})&&(this.workerList.push(b),!0)},A.prototype.removeByUrl=function(b){var g=this;this.workerList.filter(function(O){return O.info.url.split("?")[0]===b.url.split("?")[0]&&O.source===b.source}).forEach(function(O){O.worker.terminate(),g.workerList=g.workerList.filter(function(k){return k!==O})})},A.prototype.removeByMsid=function(b){var g=this.findByMsid(b);g?(console.warn("removing worker",b.kind),g.worker.terminate(),this.workerList=this.workerList.filter(function(O){return O!==g})):console.warn("no worker to remove",b.kind)},A.prototype.findByUrl=function(b,g){return this.workerList.find(function(O){return O.info.url.split("?")[0]===b.split("?")[0]&&O.kind===g})},A.prototype.findByMsid=function(b){var g=b.url,O=b.kind,k=b.source,U=b.msid,w=O===n.TrackType.VIDEO?"vMsid":"aMsid";return this.workerList.find(function(W){return W.info.url.split("?")[0]===g.split("?")[0]&&W.source===k&&W.kind===O&&W.info[w]===U})},A.prototype.dispose=function(){this.workerList.forEach(function(b){b.worker.terminate()}),this.workerList=[]},A}()},2825:(H,T)=>{Object.defineProperty(T,"__esModule",{value:!0})},8156:function(H,T,_){var f=this&&this.__createBinding||(Object.create?function(u,s,i,e){e===void 0&&(e=i);var o=Object.getOwnPropertyDescriptor(s,i);o&&!("get"in o?!s.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return s[i]}}),Object.defineProperty(u,e,o)}:function(u,s,i,e){e===void 0&&(e=i),u[e]=s[i]}),l=this&&this.__exportStar||function(u,s){for(var i in u)i==="default"||Object.prototype.hasOwnProperty.call(s,i)||f(s,u,i)};Object.defineProperty(T,"__esModule",{value:!0}),T.EDatachannelStatus=T.EConnectStatus=T.AliRTS=void 0,_(9543);var m=_(4845);Object.defineProperty(T,"AliRTS",{enumerable:!0,get:function(){return m.AliRTS}}),window&&(window.AliRTS=m.AliRTS);var h=_(5917);Object.defineProperty(T,"EConnectStatus",{enumerable:!0,get:function(){return h.EConnectStatus}});var v=_(280);Object.defineProperty(T,"EDatachannelStatus",{enumerable:!0,get:function(){return v.EDatachannelStatus}}),l(_(2825),T)},2672:(H,T)=>{var _;Object.defineProperty(T,"__esModule",{value:!0}),T.EN=void 0,function(f){f.MESSAGE_NOTSUPPORT_WEBRTC="not support webrtc",f.MESSAGE_BROWSER_NOTSUPPORT="browser not support",f.MESSAGE_BROWSER_VERSIONLOW="browser version too low",f.MESSAGE_NOTSUPPORT_H264="not support h264",f.MESSAGE_CREATEOFFER="create offer error"}(_||(T.EN=_={}))},2818:function(H,T,_){var f=this&&this.__assign||function(){return f=Object.assign||function(o){for(var r,a=1,t=arguments.length;a<t;a++)for(var n in r=arguments[a])Object.prototype.hasOwnProperty.call(r,n)&&(o[n]=r[n]);return o},f.apply(this,arguments)},l=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(T,"__esModule",{value:!0});var m,h=_(233),v=l(_(7028)),u=_(9428),s=l(_(2632)),i=l(_(1401));(function(o){o[o.UA=101]="UA",o[o.SUB_STATS=107]="SUB_STATS",o[o.PUB_STATS=108]="PUB_STATS",o[o.CONNECT_STATE_CHANGE=109]="CONNECT_STATE_CHANGE",o[o.START_PLAY=120]="START_PLAY",o[o.STOP_PLAY=121]="STOP_PLAY",o[o.SUBSCRIBE_START=125]="SUBSCRIBE_START",o[o.SUBSCRIBE_OK=126]="SUBSCRIBE_OK",o[o.FIRST_FRAME_TIME=137]="FIRST_FRAME_TIME",o[o.DC_HTTP_CONNECT=140]="DC_HTTP_CONNECT",o[o.DC_HTTP_CONNECT_OK=141]="DC_HTTP_CONNECT_OK",o[o.DC_SUB_ADD=142]="DC_SUB_ADD",o[o.DC_SUB_ADD_OK=143]="DC_SUB_ADD_OK",o[o.DC_CONNECT_STATE_CHANGE=144]="DC_CONNECT_STATE_CHANGE",o[o.DC_SUB_STOP=145]="DC_SUB_STOP",o[o.DC_SUB_STOP_OK=146]="DC_SUB_STOP_OK",o[o.DC_DISPOSE=147]="DC_DISPOSE",o[o.ERROR_INFO=150]="ERROR_INFO",o[o.DC_PUB_ADD=152]="DC_PUB_ADD",o[o.DC_PUB_ADD_OK=153]="DC_PUB_ADD_OK",o[o.DC_PUB_STOP=155]="DC_PUB_STOP",o[o.DC_PUB_STOP_OK=156]="DC_PUB_STOP_OK",o[o.RECONNECT=160]="RECONNECT",o[o.RECONNECT_PARAMS=161]="RECONNECT_PARAMS",o[o.RECONNECT_FINISH=162]="RECONNECT_FINISH",o[o.NOTIFY_MESSAGE=170]="NOTIFY_MESSAGE",o[o.CUMU_DELAY_NOT_SUPPORTED=180]="CUMU_DELAY_NOT_SUPPORTED",o[o.CUMU_DELAY_ANSWER_NOT_FOUND=181]="CUMU_DELAY_ANSWER_NOT_FOUND",o[o.CREATE_CLIENT=200]="CREATE_CLIENT",o[o.LOCALSTREAM_INITED=201]="LOCALSTREAM_INITED",o[o.START_PUBLISH=220]="START_PUBLISH",o[o.STOP_PUBLISH=221]="STOP_PUBLISH",o[o.PUBLISH_OK=222]="PUBLISH_OK",o[o.SET_VIDEOPROFILE=230]="SET_VIDEOPROFILE",o[o.SET_SCREENPROFILE=231]="SET_SCREENPROFILE",o[o.SET_AUDIOPROFILE=238]="SET_AUDIOPROFILE",o[o.ENABLE_AUDIO=232]="ENABLE_AUDIO",o[o.DISABLE_AUDIO=233]="DISABLE_AUDIO",o[o.ENABLE_VIDEO=234]="ENABLE_VIDEO",o[o.DISABLE_VIDEO=235]="DISABLE_VIDEO",o[o.STOP=236]="STOP",o[o.PLAY=237]="PLAY"})(m||(m={}));var e=function(){function o(r){this.customReporter=r?.customReporter,this.ct=r&&r.customTag?r.customTag:"",this.enableLog=!r||r.trackLog!=0,this._initParam(),this.slsTracker=new s.default({host:"cn-hangzhou.log.aliyuncs.com",project:"videocloud",logstore:"live-client-log",time:10,count:10})}return o.prototype.updateTid=function(){this.param?this.param.tid=h.Guid.create(32):this._initParam()},o.prototype.updateUrl=function(r){this.param&&(this.param.pu=r)},o.prototype.reportUA=function(r){this.reporter({msgid:m.UA,args:(0,i.default)({ua:r})})},o.prototype.reportPullStats=function(r){var a,t=f(f({},r),{cumu:""});if(this.cumuDelayInfo)try{a=JSON.parse(this.cumuDelayInfo)}catch{}a&&(this.cumuDelayInfo=void 0,t.cumu=a),this.reporter({msgid:m.SUB_STATS,args:(0,i.default)(f({},t))})},o.prototype.reportPushStats=function(r){this.reporter({msgid:m.PUB_STATS,args:(0,i.default)(f({},r))})},o.prototype.reportStartPlay=function(r){this.reporter({msgid:m.START_PLAY,args:(0,i.default)({vurl:r})})},o.prototype.reportStopPlay=function(){this.reporter({msgid:m.STOP_PLAY})},o.prototype.reportSubscribeStart=function(r,a,t,n,c){this.reporter({msgid:m.SUBSCRIBE_START,args:(0,i.default)({vurl:r,surl:a,vMsid:t?t.join(", "):"",aMsid:n?n.join(", "):"",isSubAdd:!!c})})},o.prototype.reportSubscribeOk=function(r){r===void 0&&(r={}),this.reporter({msgid:m.SUBSCRIBE_OK,args:(0,i.default)({vurl:r.vurl||"",surl:r.surl||"",hrct:r.hrct,tcid:r.traceId,rslt:r.rslt,isSubAdd:!!r.isSubAdd})})},o.prototype.reportFirstFrameTime=function(r,a,t,n,c,p,C,x,y,E,S,d,R,D){this.reporter({msgid:m.FIRST_FRAME_TIME,args:(0,i.default)({vurl:r,cpct:t,hrct:n,tcid:a,ffct:c,rslt:p,cnct:C,stats:x,delct:y,addct:E,actct:S,vMsid:d?d.join(", "):"",aMsid:R?R.join(", "):"",isSubAdd:!!D})})},o.prototype.reportErrorInfo=function(r,a,t,n){r!==u.ErrorCode.ERROR_AUTOPLAY_ERROR&&this.reporter({msgid:m.ERROR_INFO,args:(0,i.default)({errorCode:r,message:a,tcid:t,extraInfo:n})})},o.prototype.reportReconnect=function(r,a,t,n,c){this.reporter({msgid:m.RECONNECT,args:(0,i.default)({errorCode:r,message:a,tcid:t,retryTimes:n,useTcp:c})})},o.prototype.reportReconnectParams=function(r,a,t,n,c,p){this.reporter({msgid:m.RECONNECT_PARAMS,args:(0,i.default)({type:r,url:a,vMsid:(t||[]).join(","),aMsid:(n||[]).join(","),useTcp:c,streamId:p})})},o.prototype.reportReconnectFinish=function(r){r===void 0&&(r={}),this.reporter({msgid:m.RECONNECT_FINISH,args:(0,i.default)(f({},r))})},o.prototype.reportCreateClient=function(){this.reporter({msgid:m.CREATE_CLIENT})},o.prototype.reportStartPublish=function(r,a,t){this.reporter({msgid:m.START_PUBLISH,args:(0,i.default)({purl:r,surl:a,isPubAdd:!!t})})},o.prototype.reportPublishOk=function(r,a,t,n,c,p,C,x){this.reporter({msgid:m.PUBLISH_OK,args:(0,i.default)({purl:r,surl:a,coct:t,hrct:n,act:c,tcid:p,totalct:C||t+n+c,isPubAdd:!!x})})},o.prototype.reportStopPublish=function(r,a){this.reporter({msgid:m.STOP_PUBLISH,args:(0,i.default)({url:r,isPubStop:!!a})})},o.prototype.reportVideoProfile=function(r){this.reporter({msgid:m.SET_VIDEOPROFILE,args:(0,i.default)({vp:r})})},o.prototype.reportScreenProfile=function(r){this.reporter({msgid:m.SET_SCREENPROFILE,args:(0,i.default)({sp:r})})},o.prototype.reportAudioProfile=function(r){this.reporter({msgid:m.SET_AUDIOPROFILE,args:(0,i.default)({vp:r})})},o.prototype.reportEnableAudio=function(){this.reporter({msgid:m.ENABLE_AUDIO})},o.prototype.reportDisableAudio=function(){this.reporter({msgid:m.DISABLE_AUDIO})},o.prototype.reportEnableVideo=function(){this.reporter({msgid:m.ENABLE_VIDEO})},o.prototype.reportDisableVideo=function(){this.reporter({msgid:m.DISABLE_VIDEO})},o.prototype.reportStop=function(r){this.reporter({msgid:m.STOP,args:(0,i.default)({tp:r})})},o.prototype.reportPlay=function(r){this.reporter({msgid:m.PLAY,args:(0,i.default)({tp:r})})},o.prototype.reportStreamCreated=function(r,a){this.reporter({msgid:m.LOCALSTREAM_INITED,args:(0,i.default)({userConfig:r,localStreamInfo:a})})},o.prototype.reportConnectionChange=function(r,a){this.reporter({msgid:m.CONNECT_STATE_CHANGE,args:(0,i.default)({connectionState:r,direction:a})})},o.prototype.reportDatachannelHttpConnect=function(r){this.reporter({msgid:m.DC_HTTP_CONNECT,args:(0,i.default)({url:r})})},o.prototype.reportDatachannelHttpConnectOk=function(r){this.reporter({msgid:m.DC_HTTP_CONNECT_OK,args:(0,i.default)(f({},r))})},o.prototype.reportDatachannelSubAdd=function(r){this.reporter({msgid:m.DC_SUB_ADD,args:(0,i.default)(f({},r))})},o.prototype.reportDatachannelPubAdd=function(r){this.reporter({msgid:m.DC_PUB_ADD,args:(0,i.default)(f({},r))})},o.prototype.reportDatachannelSubAddOk=function(r){this.reporter({msgid:m.DC_SUB_ADD_OK,args:(0,i.default)(f({},r))})},o.prototype.reportDatachannelPubAddOk=function(r){this.reporter({msgid:m.DC_PUB_ADD_OK,args:(0,i.default)(f({},r))})},o.prototype.reportDatachannelStatusChange=function(r){this.reporter({msgid:m.DC_CONNECT_STATE_CHANGE,args:(0,i.default)(f({},r))})},o.prototype.reportDatachannelSubStop=function(r){this.reporter({msgid:m.DC_SUB_STOP,args:(0,i.default)(f({},r))})},o.prototype.reportDatachannelPubStop=function(r){this.reporter({msgid:m.DC_PUB_STOP,args:(0,i.default)(f({},r))})},o.prototype.reportDatachannelSubStopOk=function(r){this.reporter({msgid:m.DC_SUB_STOP_OK,args:(0,i.default)(f({},r))})},o.prototype.reportDatachannelPubStopOk=function(r){this.reporter({msgid:m.DC_PUB_STOP_OK,args:(0,i.default)(f({},r))})},o.prototype.reportDatachannelDispose=function(r){this.reporter({msgid:m.DC_DISPOSE,args:(0,i.default)(f({},r))})},o.prototype.reportNotifyMessage=function(r){this.reporter({msgid:m.NOTIFY_MESSAGE,args:(0,i.default)(f({},r))})},o.prototype.reportCumuDelayNotSupported=function(){this.reporter({msgid:m.CUMU_DELAY_NOT_SUPPORTED})},o.prototype.reportCumuDelayAnswerNotFound=function(){this.reporter({msgid:m.CUMU_DELAY_ANSWER_NOT_FOUND})},o.prototype.updateCumuDelayInfo=function(r){this.cumuDelayInfo=r.json},o.prototype._initParam=function(){this.param||(this.param={APIVersion:"0.6.0",os:h.SystemUtil.platform,osv:h.SystemUtil.systemVersion,bt:h.BrowserUtil.browserName,bv:h.BrowserUtil.browserVersion,host:window.location.origin,page:window.location.href,uid:h.LocalStorage.uuid,tid:h.Guid.create(32),ver:v.default.version,ct:this.ct,dt:"",lv:"1.0.0",ua:navigator&&navigator.userAgent||"",pu:""})},o.prototype.reporter=function(r){var a=f(f(f(f({},this.param||{}),{tm:new Date().getTime()}),r||{}),{msgname:m[r.msgid]});if(this.customReporter&&typeof this.customReporter=="function")try{this.customReporter(a)}catch(t){console.error("[Error in customReporter] ",t)}this.enableLog&&this.slsTracker.send(a)},o.prototype.data2String=function(r){var a="";for(var t in r)r.hasOwnProperty(t)&&(a.length&&(a+="&"),a+=t+"="+r[t]);return a},o.HEARTHEAT_INTERVAL=4,o}();T.default=e},7668:function(H,T,_){var f,l=this&&this.__extends||(f=function(S,d){return f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(R,D){R.__proto__=D}||function(R,D){for(var A in D)Object.prototype.hasOwnProperty.call(D,A)&&(R[A]=D[A])},f(S,d)},function(S,d){if(typeof d!="function"&&d!==null)throw new TypeError("Class extends value "+String(d)+" is not a constructor or null");function R(){this.constructor=S}f(S,d),S.prototype=d===null?Object.create(d):(R.prototype=d.prototype,new R)}),m=this&&this.__assign||function(){return m=Object.assign||function(S){for(var d,R=1,D=arguments.length;R<D;R++)for(var A in d=arguments[R])Object.prototype.hasOwnProperty.call(d,A)&&(S[A]=d[A]);return S},m.apply(this,arguments)},h=this&&this.__awaiter||function(S,d,R,D){return new(R||(R=Promise))(function(A,b){function g(U){try{k(D.next(U))}catch(w){b(w)}}function O(U){try{k(D.throw(U))}catch(w){b(w)}}function k(U){var w;U.done?A(U.value):(w=U.value,w instanceof R?w:new R(function(W){W(w)})).then(g,O)}k((D=D.apply(S,d||[])).next())})},v=this&&this.__generator||function(S,d){var R,D,A,b,g={label:0,sent:function(){if(1&A[0])throw A[1];return A[1]},trys:[],ops:[]};return b={next:O(0),throw:O(1),return:O(2)},typeof Symbol=="function"&&(b[Symbol.iterator]=function(){return this}),b;function O(k){return function(U){return function(w){if(R)throw new TypeError("Generator is already executing.");for(;b&&(b=0,w[0]&&(g=0)),g;)try{if(R=1,D&&(A=2&w[0]?D.return:w[0]?D.throw||((A=D.return)&&A.call(D),0):D.next)&&!(A=A.call(D,w[1])).done)return A;switch(D=0,A&&(w=[2&w[0],A.value]),w[0]){case 0:case 1:A=w;break;case 4:return g.label++,{value:w[1],done:!1};case 5:g.label++,D=w[1],w=[0];continue;case 7:w=g.ops.pop(),g.trys.pop();continue;default:if(A=g.trys,!((A=A.length>0&&A[A.length-1])||w[0]!==6&&w[0]!==2)){g=0;continue}if(w[0]===3&&(!A||w[1]>A[0]&&w[1]<A[3])){g.label=w[1];break}if(w[0]===6&&g.label<A[1]){g.label=A[1],A=w;break}if(A&&g.label<A[2]){g.label=A[2],g.ops.push(w);break}A[2]&&g.ops.pop(),g.trys.pop();continue}w=d.call(S,g)}catch(W){w=[6,W],D=0}finally{R=A=0}if(5&w[0])throw w[1];return{value:w[0]?w[1]:void 0,done:!0}}([k,U])}}},u=this&&this.__rest||function(S,d){var R={};for(var D in S)Object.prototype.hasOwnProperty.call(S,D)&&d.indexOf(D)<0&&(R[D]=S[D]);if(S!=null&&typeof Object.getOwnPropertySymbols=="function"){var A=0;for(D=Object.getOwnPropertySymbols(S);A<D.length;A++)d.indexOf(D[A])<0&&Object.prototype.propertyIsEnumerable.call(S,D[A])&&(R[D[A]]=S[D[A]])}return R},s=this&&this.__importDefault||function(S){return S&&S.__esModule?S:{default:S}};Object.defineProperty(T,"__esModule",{value:!0}),T.RtsClient=void 0;var i=s(_(102)),e=_(5917),o=_(5676),r=_(9796),a=_(6600),t=s(_(2818)),n=s(_(7028)),c=_(7989),p=_(280),C=_(9428),x=_(5044),y=_(2470),E=function(S){function d(R){var D,A=S.call(this)||this;return A.pullH264Checked=!1,A.lastProtocol="udp",A.usePcReconnect=!1,A.reporter=new t.default(R),A.subscriber=new o.Subscriber(A.reporter,R?R.playConfig:void 0),A.publisher=new r.Publisher(A.reporter),A.commonController=new a.CommonController(A.reporter),A.pcRestorer=new y.PcRestorer({subscriber:A.subscriber,publisher:A.publisher,commonController:A.commonController}),A.usePcReconnect=!!(!((D=R?.singlePcConfig)===null||D===void 0)&&D.usePcReconnect),A.subscriber.on("onError",function(b){return h(A,void 0,void 0,function(){var g,O,k,U,w,W,M,N,P,V,j=this;return v(this,function(z){switch(z.label){case 0:return g=(k=b.extraInfo)===null||k===void 0?void 0:k.response,this.reporter.reportErrorInfo(b.errorCode,b.message,b.traceId,{sdp:(U=b.extraInfo)===null||U===void 0?void 0:U.sdp,response:{status:g?.status,data:g?.data},pcErrorInfo:(w=b.extraInfo)===null||w===void 0?void 0:w.pcErrorInfo}),this.usePcReconnect?[3,5]:C.SUB_RECONNECT_ERROR_LIST.includes(b.errorCode)?this.subscriber.isConnecting?[3,2]:(O=this.lastProtocol==="udp",this.lastProtocol=O?"tcp":"udp",console.log("retrying with",this.lastProtocol),[4,this.subscriber.retrySubscribe(b,{innerTcpOnly:O})]):[3,3];case 1:z.sent()?(this.reporter.reportReconnect(b.errorCode,b.message,b.traceId,(W=b.extraInfo)===null||W===void 0?void 0:W.retryTimes,O),this.emit("reconnect",this.makeReconnectEvent("sub",b))):this.emit("onError",b),z.label=2;case 2:return[3,4];case 3:this.emit("onError",b),z.label=4;case 4:return[3,6];case 5:[C.ErrorCode.ERROR_PC_DISCONNECTED,C.ErrorCode.ERROR_IP_MIGRATE].includes(b.errorCode)&&(this.pcRestorer.isReconnecting()||(b.extraInfo=m(m({},b.extraInfo),{retryTimes:1}),this.reporter.reportReconnect(b.errorCode,b.message,b.traceId,(M=b.extraInfo)===null||M===void 0?void 0:M.retryTimes),this.emit("reconnect",this.makeReconnectEvent("sub",b)),this.emit("connectStatusChange",{status:e.EConnectStatus.CONNECT_STATUS_RECONNECTING}),(V=(P=this.pcRestorer.restore((N=b.extraInfo.pcErrorInfo)===null||N===void 0?void 0:N.ips))===null||P===void 0?void 0:P.then(function(G){j.reporter.reportReconnectFinish({level:"pc"}),j.emit("reconnectFinish",{type:"all",traceId:G.traceId,latestUrl:G.latestUrl})}))===null||V===void 0||V.catch(function(G){var X=new x.RtsError(C.ErrorCode.ERROR_SINGLE_PC_FULL_RECONNECT_HTTP_FAILED,"pc full reconnect failed","",{originError:G});j.emit("onError",X),j.reporter.reportErrorInfo(X.errorCode,X.message)}))),z.label=6;case 6:return[2]}})})}),A.subscriber.on("reconnect",function(b){var g;A.reporter.reportReconnect(b.errorCode,b.message,b.traceId,(g=b.extraInfo)===null||g===void 0?void 0:g.retryTimes),A.emit("reconnect",A.makeReconnectEvent("sub",b))}),A.subscriber.on("onPlayEvent",function(b){A.emit("onPlayEvent",b)}),A.subscriber.on("connectStatusChange",function(b){A.emit("connectStatusChange",b),A.reporter.reportConnectionChange(e.EConnectStatus[b.status],"sub")}),A.publisher.on("connectStatusChange",function(b){A.emit("connectStatusChange",b),A.reporter.reportConnectionChange(e.EConnectStatus[b.status],"pub")}),A.publisher.on("onError",function(b){return h(A,void 0,void 0,function(){var g,O,k,U,w,W,M,N,P,V,j,z=this;return v(this,function(G){switch(G.label){case 0:return g=(k=b.extraInfo)===null||k===void 0?void 0:k.response,this.reporter.reportErrorInfo(b.errorCode,b.message,b.traceId,{sdp:(U=b.extraInfo)===null||U===void 0?void 0:U.sdp,response:{status:g?.status,data:g?.data},pcErrorInfo:(w=b.extraInfo)===null||w===void 0?void 0:w.pcErrorInfo}),this.usePcReconnect?[3,5]:C.PUB_RECONNECT_ERROR_LIST.includes(b.errorCode)?this.publisher.isConnecting?[3,2]:(O=b.errorCode===C.ErrorCode.ERROR_TRANSPORT_CLOSED&&((W=b.extraInfo)===null||W===void 0?void 0:W.protocol)!=="tcp",console.log("Retrying with ",O?"TCP":"UDP"),[4,this.publisher.retryPublish(b,O)]):[3,3];case 1:G.sent()?(this.reporter.reportReconnect(b.errorCode,b.message,b.traceId,(M=b.extraInfo)===null||M===void 0?void 0:M.retryTimes,O),this.emit("reconnect",this.makeReconnectEvent("pub",b))):this.emit("onError",b),G.label=2;case 2:return[3,4];case 3:this.emit("onError",b),G.label=4;case 4:return[3,6];case 5:[C.ErrorCode.ERROR_PC_DISCONNECTED,C.ErrorCode.ERROR_IP_MIGRATE].includes(b.errorCode)&&(this.pcRestorer.isReconnecting()||(b.extraInfo=m(m({},b.extraInfo),{retryTimes:1}),this.reporter.reportReconnect(b.errorCode,b.message,b.traceId,(N=b.extraInfo)===null||N===void 0?void 0:N.retryTimes),this.emit("reconnect",this.makeReconnectEvent("pub",b)),this.emit("connectStatusChange",{status:e.EConnectStatus.CONNECT_STATUS_RECONNECTING}),(j=(V=this.pcRestorer.restore((P=b.extraInfo.pcErrorInfo)===null||P===void 0?void 0:P.ips))===null||V===void 0?void 0:V.then(function(X){z.reporter.reportReconnectFinish({level:"pc"}),z.emit("reconnectFinish",{type:"all",traceId:X.traceId,latestUrl:X.latestUrl})}))===null||j===void 0||j.catch(function(X){var re=new x.RtsError(C.ErrorCode.ERROR_SINGLE_PC_FULL_RECONNECT_HTTP_FAILED,"pc full reconnect failed","",{originError:X});z.emit("onError",re),z.reporter.reportErrorInfo(re.errorCode,re.message)}))),G.label=6;case 6:return[2]}})})}),A.publisher.on("reconnect",function(b){var g;A.reporter.reportReconnect(b.errorCode,b.message,b.traceId,(g=b.extraInfo)===null||g===void 0?void 0:g.retryTimes),A.emit("reconnect",A.makeReconnectEvent("pub",b))}),A.commonController.on("connectStatusChange",function(b){A.emit("connectStatusChange",b),A.reporter.reportConnectionChange(e.EConnectStatus[b.status],"signalChannel")}),A.commonController.on("onError",function(b){A.reporter.reportErrorInfo(b.errorCode,b.message,b.traceId),A.emit("onError",b)}),A.commonController.on("datachannelStatusChange",function(b){A.emit("datachannelStatusChange",b),A.reporter.reportDatachannelStatusChange({state:p.EDatachannelStatus[b.status],url:"",label:"SIGNAL",id:-1,msid:""})}),A.commonController.on("encodedFrame",function(b){A.emit("encodedFrame",b)}),A.commonController.on("receivedSEI",function(b){A.emit("receivedSEI",b)}),A.commonController.on("onPlayEvent",function(b){A.emit("onPlayEvent",b)}),A.commonController.on("reconnect",function(b){b.type!=="pc"&&A.emit("reconnect",b)}),A.commonController.on("reconnectFinish",function(b){A.reporter.reportReconnectFinish(b),A.emit("reconnectFinish",b)}),A.commonController.on("traceId",function(b){A.emit("traceId",b)}),A.commonController.on("heartbeat",function(b){A.emit("heartbeat",b)}),A.commonController.on("cumuDelayNotSupported",function(){A.emit("cumuDelayNotSupported")}),A.reporter.reportCreateClient(),A}return l(d,S),d.prototype.getVersion=function(){return n.default.version},d.prototype.isSupport=function(R){var D=new c.SupportUtil;return this.pullH264Checked=!0,D.isSupport(R)},d.prototype.checkPublishSupport=function(){return new c.SupportUtil().checkPublishSupport()},d.prototype.checkEncodedTransformSupport=function(){return new c.SupportUtil().checkEncodedTransformSupport()},d.prototype.subscribe=function(R,D){return this.reporter.updateUrl(R),this.commonController.setConfig(D),this.commonController.setPeerconnection(this.subscriber.getPeerConnection()),this.subscriber.resetResubscribeStatus(),this.subscriber.subscribeWithReconnect(R,m(m({},D),{isH264Checked:this.pullH264Checked}))},d.prototype.subscribeAdd=function(R){return this.commonController.subscribeAdd(R)},d.prototype.subscribeActive=function(R){return this.commonController.subscribeActive(R)},d.prototype.subscribeDeleteTracks=function(R){return this.commonController.subscribeDeleteTracks(R)},d.prototype.subscribeStop=function(R){return this.commonController.subscribeStop(R)},d.prototype.publishAdd=function(R){return this.commonController.publishAdd(R)},d.prototype.publishDeleteTracks=function(R){return this.commonController.publishDeleteTracks(R)},d.prototype.publishReplaceTracks=function(R){return this.commonController.publishReplaceTracks(R)},d.prototype.publishStop=function(R){return this.commonController.publishStop(R)},d.prototype.subscribeAddDatachannel=function(R){return this.commonController.subscribeAddDatachannel(R)},d.prototype.subscribeStopDatachannel=function(R){return this.commonController.subscribeStopDatachannel(R)},d.prototype.publishAddDatachannel=function(R){return this.commonController.publishAddDatachannel(R)},d.prototype.publishStopDatachannel=function(R){return this.commonController.publishStopDatachannel(R)},d.prototype.unsubscribe=function(){this.subscriber.resetResubscribeStatus(),this.subscriber.unsubscribe()},d.prototype.startLiveStream=function(R,D,A){return this.reporter.reportStartPlay(R),this.subscriber.startLiveStream(R,D,A)},d.prototype.stopLiveStream=function(){this.reporter.reportStopPlay(),this.subscriber.stopLiveStream()},d.prototype.muteLiveStream=function(R){this.subscriber.muteLiveStream(R)},d.prototype.publish=function(R,D,A){return h(this,void 0,void 0,function(){return v(this,function(b){return this.reporter.updateUrl(R),this.commonController.setConfig(A),this.commonController.setPeerconnection(this.publisher.getPeerConnection()),this.publisher.resetRepublishStatus(),[2,this.publisher.publishWithReconnect(R,D,A)]})})},d.prototype.unpublish=function(){return this.publisher.resetRepublishStatus(),this.publisher.unpublish()},d.prototype.sendSEI=function(R){this.publisher.sendSEI(R),this.commonController.sendSEI(R)},d.prototype.getPublishTrackInfoList=function(){return this.publisher.getTrackInfoList()},d.prototype.getTransportStats=function(){return this.subscriber.getPeerConnection().getSubMonitor().getTransportStats()},d.prototype.getRemoteVideoStats=function(){return this.subscriber.getPeerConnection().getSubMonitor().getRemoteVideoStats()},d.prototype.getRemoteAudioStats=function(){return this.subscriber.getPeerConnection().getSubMonitor().getRemoteAudioStats()},d.prototype.getSubscribeVideoStats=function(R,D){return this.commonController.getSubscribeVideoStats(R,D)},d.prototype.getSubscribeAudioStats=function(R,D){return this.commonController.getSubscribeAudioStats(R,D)},d.prototype.getPublishVideoStats=function(R,D){return this.commonController.getPublishVideoStats(R,D)},d.prototype.getPublishAudioStats=function(R,D){return this.commonController.getPublishAudioStats(R,D)},d.prototype.setReceiverCodecPreferences=function(R){return this.commonController.setReceiverCodecPreferences(R)},d.prototype.setSenderCodecPreferences=function(R){return this.commonController.setSenderCodecPreferences(R)},d.prototype.makeReconnectEvent=function(R,D){var A=D||{},b=A.extraInfo,g=u(A,["extraInfo"]),O=b||{},k=O.retryTimes,U=u(O,["retryTimes"]),w=R;return{type:this.usePcReconnect?"pc":w,reason:g,retryTimes:k,extraInfo:U}},d.prototype.heartbeat=function(R){var D;(D=this.commonController.peerCore)===null||D===void 0||D.sendOnceHeartbeat(R)},d.prototype.setAutoHeartbeat=function(R){var D;(D=this.commonController.peerCore)===null||D===void 0||D.startSignalHeartbeatTimer(R)},d.prototype.clearAutoHeartbeat=function(){var R;(R=this.commonController.peerCore)===null||R===void 0||R.stopSignalHeartbeatTimer()},d.prototype.sendFalseHeartbeat=function(R){var D;(D=this.commonController.peerCore)===null||D===void 0||D.sendFalseHeartbeat(R)},d.prototype.updateAuth=function(R){return this.commonController.updateAuth(R)},d}(i.default);T.RtsClient=E},335:(H,T)=>{Object.defineProperty(T,"__esModule",{value:!0});var _=function(){function f(l){this.useGainNode=!0,this.audioContext=new AudioContext,this.audioDestination=this.audioContext.createMediaStreamDestination(),this.audioSource=[],this.gainNode=null,this.audioTrack=null,this.audioTrackArr=l.trackList||[],this.useGainNode=typeof l.useGainNode!="boolean"||l.useGainNode,this.useGainNode&&(this.gainNode=this.audioContext.createGain(),this.gainNode.connect(this.audioContext.destination),this.gainNode.gain.value=0),this.getMixedAudioTrack()}return f.prototype.destroy=function(){var l;(l=this.getMixedAudioTrack())===null||l===void 0||l.stop(),this.disconnectSourceNode(),this.audioContext.close(),this.audioTrackArr=[]},f.prototype.updateTrackList=function(l){l.length&&(this.disconnectSourceNode(),this.audioTrackArr=l,this.connectNode())},f.prototype.getMixedAudioTrack=function(){return this.audioTrack||(this.connectNode(),this.audioTrack=this.audioDestination.stream.getAudioTracks()[0]),this.audioTrack},f.prototype.connectNode=function(){var l=this;this.audioTrackArr.forEach(function(m){var h=new MediaStream;h.addTrack(m);var v=l.audioContext.createMediaStreamSource(h);l.gainNode&&v.connect(l.gainNode),l.audioSource.push(v)}),this.audioSource.forEach(function(m){m.connect(l.audioDestination)})},f.prototype.disconnectSourceNode=function(){var l=this;this.audioSource.forEach(function(m){l.gainNode&&m.disconnect(l.gainNode),m.disconnect(l.audioDestination)}),this.audioSource=[]},f}();T.default=_},1893:(H,T)=>{Object.defineProperty(T,"__esModule",{value:!0}),T.TwoDRenderer=void 0;var _=function(){function f(l){this.video=l.video,this.canvas=l.canvas,this.ctx=this.canvas.getContext("2d")}return f.prototype.render=function(){var l,m,h=this.video,v=this.canvas;h&&v&&((l=this.ctx)===null||l===void 0||l.clearRect(0,0,v.width,v.height),(m=this.ctx)===null||m===void 0||m.drawImage(h,0,0,1*h.videoWidth,1*h.videoHeight),this.requestId=requestAnimationFrame(this.render.bind(this)))},f.prototype.stop=function(){this.requestId&&cancelAnimationFrame(this.requestId)},f}();T.TwoDRenderer=_},6295:(H,T,_)=>{Object.defineProperty(T,"__esModule",{value:!0}),T.CanvasRenderer=void 0;var f=_(1893),l=function(){function m(h){this.video=h.video,this.canvas=this.initCanvas(),this.activeRenderer=this.initRenderer()}return Object.defineProperty(m.prototype,"mediaStream",{get:function(){var h;return this.ms||(this.ms=((h=this.canvas)===null||h===void 0?void 0:h.captureStream())||void 0),this.ms},enumerable:!1,configurable:!0}),m.prototype.start=function(){this.render()},m.prototype.stop=function(){this.activeRenderer.stop()},m.prototype.initCanvas=function(){var h=document.createElement("canvas"),v=this.video;return h.width=1*v.videoWidth,h.height=1*v.videoHeight,h},m.prototype.initRenderer=function(){return new f.TwoDRenderer({video:this.video,canvas:this.canvas})},m.prototype.render=function(){this.activeRenderer.render()},m.prototype.resize=function(h,v){this.canvas&&(this.canvas.width=h,this.canvas.height=v)},m}();T.CanvasRenderer=l},6420:function(H,T,_){var f=this&&this.__awaiter||function(u,s,i,e){return new(i||(i=Promise))(function(o,r){function a(c){try{n(e.next(c))}catch(p){r(p)}}function t(c){try{n(e.throw(c))}catch(p){r(p)}}function n(c){var p;c.done?o(c.value):(p=c.value,p instanceof i?p:new i(function(C){C(p)})).then(a,t)}n((e=e.apply(u,s||[])).next())})},l=this&&this.__generator||function(u,s){var i,e,o,r,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return r={next:t(0),throw:t(1),return:t(2)},typeof Symbol=="function"&&(r[Symbol.iterator]=function(){return this}),r;function t(n){return function(c){return function(p){if(i)throw new TypeError("Generator is already executing.");for(;r&&(r=0,p[0]&&(a=0)),a;)try{if(i=1,e&&(o=2&p[0]?e.return:p[0]?e.throw||((o=e.return)&&o.call(e),0):e.next)&&!(o=o.call(e,p[1])).done)return o;switch(e=0,o&&(p=[2&p[0],o.value]),p[0]){case 0:case 1:o=p;break;case 4:return a.label++,{value:p[1],done:!1};case 5:a.label++,e=p[1],p=[0];continue;case 7:p=a.ops.pop(),a.trys.pop();continue;default:if(o=a.trys,!((o=o.length>0&&o[o.length-1])||p[0]!==6&&p[0]!==2)){a=0;continue}if(p[0]===3&&(!o||p[1]>o[0]&&p[1]<o[3])){a.label=p[1];break}if(p[0]===6&&a.label<o[1]){a.label=o[1],o=p;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(p);break}o[2]&&a.ops.pop(),a.trys.pop();continue}p=s.call(u,a)}catch(C){p=[6,C],e=0}finally{i=o=0}if(5&p[0])throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}([n,c])}}},m=this&&this.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(T,"__esModule",{value:!0}),T.Clock=void 0;var h=m(_(2505)),v=function(){function u(){this.request=h.default.create({timeout:6e4}),this.offset=0,this.nextAttemptMs=u.DEFAULT_ATTEMPT_INTERVAL,this.attemptCount=0,this.random=Math.random(),this.startSyncClock()}return u.prototype.now=function(){if(this.offset&&!Number.isNaN(this.offset)){var s=Date.now()+this.offset;return Math.round(s)}return Date.now()},u.prototype.syncClock=function(){return f(this,void 0,void 0,function(){var s,i,e,o,r;return l(this,function(a){switch(a.label){case 0:return s=!1,i=Date.now(),[4,this.fetchServerTime()];case 1:return e=a.sent(),o=Date.now(),e?(r=new Date(e).getTime(),Number.isNaN(r)||(this.offset=this.calculateOffset(i+this.fixRequestStartTime(),o,r),s=!0)):console.warn("Failed to fetch server time, should try again"),[2,s]}})})},u.prototype.startSyncClock=function(){return f(this,void 0,void 0,function(){var s,i=this;return l(this,function(e){switch(e.label){case 0:return[4,this.syncClock()];case 1:return s=e.sent(),this.nextAttemptMs=s?u.DEFAULT_ATTEMPT_INTERVAL:u.DEFAULT_ATTEMPT_RETRY_INTERVAL,this.stopSyncClock(),this.attemptTimer=setTimeout(function(){i.startSyncClock()},this.nextAttemptMs),[2]}})})},u.prototype.stopSyncClock=function(){this.attemptTimer&&clearTimeout(this.attemptTimer),this.attemptTimer=void 0},u.prototype.fetchServerTime=function(){return f(this,void 0,void 0,function(){var s,i,e;return l(this,function(o){switch(o.label){case 0:this.attemptCount++,o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this.request.get(this.attachCount(u.DEFAULT_TIME_SOURCE))];case 2:return s=(e=o.sent())===null||e===void 0?void 0:e.data,[3,4];case 3:return i=o.sent(),console.log("GetServerTime error",i),[3,4];case 4:return[2,s]}})})},u.prototype.calculateOffset=function(s,i,e){return e-(i-(i-s)/2)},u.prototype.fixRequestStartTime=function(){var s=0,i=performance.getEntriesByName(this.attachCount(u.DEFAULT_TIME_SOURCE),"resource");if(i?.length)if(i.length>1)console.warn("multiple resource entries found");else try{var e=i[0];s=e.requestStart-e.startTime,e.domainLookupEnd,e.domainLookupStart,e.secureConnectionStart,e.connectStart,e.requestStart,e.secureConnectionStart}catch(o){console.log(o)}else console.warn("no resource entry found"),window.RTS_DISABLE_CLEAR_RESOURCE_TIMINGS||performance.clearResourceTimings();return Math.max(0,s||0)},u.prototype.attachCount=function(s){return"".concat(s,"&count=").concat(this.random,"_").concat(this.attemptCount)},u.DEFAULT_TIME_SOURCE="https://time.akamai.com/?iso&ms",u.DEFAULT_ATTEMPT_INTERVAL=3e4,u.DEFAULT_ATTEMPT_RETRY_INTERVAL=5e3,u}();T.Clock=v},1698:function(H,T){var _=this&&this.__assign||function(){return _=Object.assign||function(l){for(var m,h=1,v=arguments.length;h<v;h++)for(var u in m=arguments[h])Object.prototype.hasOwnProperty.call(m,u)&&(l[u]=m[u]);return l},_.apply(this,arguments)};Object.defineProperty(T,"__esModule",{value:!0}),T.configProvider=void 0;var f=function(){function l(){this.context={},this.subscribers=new Set}return l.prototype.setContext=function(m){this.context=_(_({},this.context),m),this.notifySubscribers()},l.prototype.getContext=function(){return this.context},l.prototype.subscribe=function(m){var h=this;return this.subscribers.add(m),function(){return h.subscribers.delete(m)}},l.prototype.notifySubscribers=function(){var m=this;this.subscribers.forEach(function(h){return h(m.context)})},l}();T.configProvider=new f},5649:function(H,T,_){var f,l,m=this&&this.__assign||function(){return m=Object.assign||function(d){for(var R,D=1,A=arguments.length;D<A;D++)for(var b in R=arguments[D])Object.prototype.hasOwnProperty.call(R,b)&&(d[b]=R[b]);return d},m.apply(this,arguments)},h=this&&this.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(T,"__esModule",{value:!0}),T.CumuDelaySeiPayloadParser=T.CumuDelaySeiPayload=T.ECumuDelayGrtnKey=T.ECumuDelayPubSdkKey=T.ECumuDelayAVCommonKey=T.ECumuDelayVideoKey=T.ECumuDelayGrtnExportKey=T.ECumuDelaySubKey=T.CUMU_DELAY_UUID=T.CUMU_DELAY_SEI_PAYLOAD_TYPE=void 0;var v,u,s,i,e=h(_(7028));T.CUMU_DELAY_SEI_PAYLOAD_TYPE=99,T.CUMU_DELAY_UUID=[32,36,16,9,16,23,7,1,150,117,25,212,25,129,3,7],function(d){d.SophonAudioDual="sophon_audio_dual",d.SophonVideoCamera="sophon_video_camera",d.SophonVideoCameraSmall="sophon_video_camera_small",d.SophonVideoCameraSuper="sophon_video_camera_super",d.SophonVideoScreenShare="sophon_video_screen_share",d.SophonAudio="sophon_audio",d.SophonVideoCameraLarge="sophon_video_camera_large",d.RtsAudio="rts audio",d.RtsVideo="rts video"}(v||(v={})),function(d){d[d.Web=0]="Web",d[d.iOS=1]="iOS",d[d.Android=2]="Android"}(u||(u={})),function(d){d.VTotalCost="VTotalCost",d.VAssemblyCost="VAssemblyCost",d.VJitterBufferDelay="VJitterBufferDelay",d.VDecPlugCost="VDecPlugCost",d.DownRTTHalf="DownRTTHalf"}(s||(T.ECumuDelaySubKey=s={})),function(d){d.TOTAL_COST="TOTAL_COST",d.ENTER_GRTN_TIMESTAMP="ENTER_GRTN_TIMESTAMP",d.LEAVE_GRTN_TIMESTAMP="LEAVE_GRTN_TIMESTAMP"}(i||(T.ECumuDelayGrtnExportKey=i={}));var o,r,a,t,n,c,p,C=((f={})[v.SophonAudioDual]=4,f[v.SophonVideoCamera]=5,f[v.SophonVideoCameraSmall]=6,f[v.SophonVideoCameraSuper]=7,f[v.SophonVideoScreenShare]=8,f[v.SophonAudio]=9,f[v.SophonVideoCameraLarge]=10,f[v.RtsAudio]=11,f[v.RtsVideo]=12,f);(l={})[C[v.SophonAudioDual]]=v.SophonAudioDual,l[C[v.SophonVideoCamera]]=v.SophonVideoCamera,l[C[v.SophonVideoCameraSmall]]=v.SophonVideoCameraSmall,l[C[v.SophonVideoCameraSuper]]=v.SophonVideoCameraSuper,l[C[v.SophonVideoScreenShare]]=v.SophonVideoScreenShare,l[C[v.SophonAudio]]=v.SophonAudio,l[C[v.SophonVideoCameraLarge]]=v.SophonVideoCameraLarge,l[C[v.RtsAudio]]=v.RtsAudio,l[C[v.RtsVideo]]=v.RtsVideo,function(d){d[d.VTotalCost=4]="VTotalCost",d[d.CapDeviceCost=5]="CapDeviceCost",d[d.PushExtCost=6]="PushExtCost",d[d.CapPlugCost=7]="CapPlugCost",d[d.PrepThrCost=8]="PrepThrCost",d[d.PrepPlugCost=9]="PrepPlugCost",d[d.DispThrCost=10]="DispThrCost",d[d.DispPlugCost=11]="DispPlugCost",d[d.VEncThrCost=12]="VEncThrCost",d[d.VEncPlugCost=13]="VEncPlugCost"}(o||(T.ECumuDelayVideoKey=o={})),function(d){d[d.ATotalCost=24]="ATotalCost",d[d.ASourceCCost=25]="ASourceCCost",d[d.AMixerCost=26]="AMixerCost",d[d.AEncodeCCost=27]="AEncodeCCost",d[d.AAIClientQuestionTimestampHEAD=28]="AAIClientQuestionTimestampHEAD",d[d.AAIClientQuestionTimestampTAIL=29]="AAIClientQuestionTimestampTAIL",d[d.AAIClientAnswerTimestampHEAD=30]="AAIClientAnswerTimestampHEAD",d[d.AAIClientAnswerTimestampTAIL=31]="AAIClientAnswerTimestampTAIL",d[d.AAIClientScentenceId=32]="AAIClientScentenceId",d[d.AAIClientSourceCost=33]="AAIClientSourceCost",d[d.AAIClientMixerCost=34]="AAIClientMixerCost",d[d.AAIClientEncoderCost=35]="AAIClientEncoderCost",d[d.AAILinuxReceiveCost=36]="AAILinuxReceiveCost",d[d.AAILinuxNeteqCost=37]="AAILinuxNeteqCost",d[d.AAILinuxRemoteSourceCost=38]="AAILinuxRemoteSourceCost",d[d.AAILinuxPlayMixerCost=39]="AAILinuxPlayMixerCost",d[d.AAILinuxPlayCost=40]="AAILinuxPlayCost",d[d.AAIClientQuestionUidDigestHEAD=41]="AAIClientQuestionUidDigestHEAD",d[d.AAIClientQuestionUidDigestTAIL=42]="AAIClientQuestionUidDigestTAIL",d[d.AIClinetSmartDenoise=43]="AIClinetSmartDenoise"}(r||(r={})),function(d){d[d.NetsdkThrCost=44]="NetsdkThrCost",d[d.QosThrCost=45]="QosThrCost",d[d.PacerCost=46]="PacerCost",d[d.UpRTTHalf=47]="UpRTTHalf",d[d.AIClientNetsdkThrCost=48]="AIClientNetsdkThrCost",d[d.AIClientQosThrCost=49]="AIClientQosThrCost",d[d.AIClientPacerCost=50]="AIClientPacerCost",d[d.AIClientUpRTTHalf=51]="AIClientUpRTTHalf"}(a||(T.ECumuDelayAVCommonKey=a={})),function(d){d[d.AIAsrCost=64]="AIAsrCost",d[d.AILlmCost=65]="AILlmCost",d[d.AITtsCost=66]="AITtsCost",d[d.AIMuteCost=67]="AIMuteCost",d[d.AIAgentTotalCost=68]="AIAgentTotalCost",d[d.AIAgentExtraAvatarCost=69]="AIAgentExtraAvatarCost"}(t||(t={})),function(d){d[d.PubSdkType=100]="PubSdkType",d[d.PubSdkVersion=101]="PubSdkVersion"}(n||(T.ECumuDelayPubSdkKey=n={})),function(d){d[d.NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_INTERNAL_RTT_HALF=121]="NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_INTERNAL_RTT_HALF",d[d.NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_GRTN_NODE_BEF_PACER=122]="NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_GRTN_NODE_BEF_PACER",d[d.NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_GRTN_NODE_PACER_COST=123]="NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_GRTN_NODE_PACER_COST",d[d.NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_DOWN_RTT_HALF=124]="NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_DOWN_RTT_HALF"}(c||(T.ECumuDelayGrtnKey=c={})),function(d){d[d.AIGRTNInternalRTTHalf=104]="AIGRTNInternalRTTHalf",d[d.AIGRTNBeforePacer=105]="AIGRTNBeforePacer",d[d.AIGRTNPacerCost=106]="AIGRTNPacerCost",d[d.AIGRTNDownRTTHalf=107]="AIGRTNDownRTTHalf"}(p||(p={}));var x=function(d){d.msid=v.SophonAudio;var R=C[d.msid];R||console.warn("No mapped msid for cumuDelay",d.msid);var D=new ArrayBuffer(d.sendTs?8:4);if(d.sendTs){var A=Math.floor(performance.now()+performance.timeOrigin-d.windowTimeOrigin);A>=Math.pow(2,32)-1&&(A=0);var b=new DataView(D);b.setUint8(0,8),b.setUint8(1,0),b.setUint8(2,R),b.setUint8(3,5),b.setUint32(4,A)}else new Uint8Array(D).set([0,0,R,1]);d.kv[n.PubSdkType]=u.Web,d.kv[n.PubSdkVersion]=Number(e.default.version.split(".").join("").split("-")[0]);var g=Object.keys(d.kv).length;g>256&&console.warn("Too much kv");var O,k,U,w,W=1+3*g+1,M=new ArrayBuffer(W),N=new DataView(M);N.setInt8(0,g),Object.keys(d.kv).forEach(function(P,V){P in m(m(m({},o),a),n)||console.warn("Unknown CumuDelay key: ".concat(P));var j=d.kv[P],z=1+3*V;N.setUint8(z,parseInt(P)),N.setUint16(z+1,j)}),N.setUint8(W-1,128),this.buffer=(O=D,k=M,U=new ArrayBuffer(O.byteLength+k.byteLength),(w=new Uint8Array(U)).set(new Uint8Array(O),0),w.set(new Uint8Array(k),O.byteLength),U)};T.CumuDelaySeiPayload=x;var y=function(d){var R;this.pub={},this.grtn={},this.AIPub={},this.AISub={},this.AIAgent={},this.AIGrtn={},this.other={};var D,A,b=new S(d),g=(b.readBits(3),b.readBits()),O=b.readBits(),k=b.readBits(),U=b.readBits(),w=b.readBits();if(b.readBits(8),b.readBits(8),b.readBits(8),g===1&&b.readBits(16),O===1){var W=b.readBits(32);this.pub.timestamp=W,this.pub.timestampRecv=Math.floor(performance.now())}k===1&&b.readBits(16),U===1&&(D=b.readBits(32)),w===1&&(A=b.readBits(32)),D&&A&&(this.grtn=((R={})[i.TOTAL_COST]=A-D,R[i.ENTER_GRTN_TIMESTAMP]=D,R[i.LEAVE_GRTN_TIMESTAMP]=A,R));for(var M=b.readBits(8),N=0;N<M;N++){var P=b.readBits(8),V=b.readBits(16);if(E(P,[o.VTotalCost,o.VEncPlugCost])||E(P,[r.ATotalCost,r.AEncodeCCost])||E(P,[a.NetsdkThrCost,a.UpRTTHalf])||E(P,[n.PubSdkType,n.PubSdkVersion])){var j=o[P]||r[P]||a[P]||n[P];this.pub[j]=V}else if(E(P,[r.AAIClientQuestionTimestampHEAD,r.AAIClientEncoderCost])||E(P,[a.AIClientNetsdkThrCost,a.AIClientUpRTTHalf]))j=r[P]||a[P],this.AIPub[j]=V;else if(E(P,[r.AAILinuxReceiveCost,r.AIClinetSmartDenoise]))j=r[P],this.AISub[j]=V;else if(E(P,[t.AIAsrCost,t.AIAgentExtraAvatarCost]))j=t[P],this.AIAgent[j]=V;else if(E(P,[p.AIGRTNInternalRTTHalf,p.AIGRTNDownRTTHalf])){j=p[P];for(var z=0,G="".concat(j,"_").concat(z);this.AIGrtn.hasOwnProperty(G);)G="".concat(j,"_").concat(z++);this.AIGrtn[G]=V}else if(E(P,[c.NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_INTERNAL_RTT_HALF,c.NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_DOWN_RTT_HALF])){for(j=c[P],z=0,G="".concat(j,"_").concat(z);this.grtn.hasOwnProperty(G);)G="".concat(j,"_").concat(z++);this.grtn[G]=V}else this.other[P]=V}};function E(d,R){return d>=R[0]&&d<=R[1]}T.CumuDelaySeiPayloadParser=y;var S=function(){function d(R){this.byteOffset=0,this.bitOffset=0;var D=new Uint8Array(R);this.buffer=D}return d.prototype.readBits=function(R){R===void 0&&(R=1);for(var D=0,A=0;A<R;){if(this.byteOffset>=this.buffer.byteLength)throw new Error("readBits out of range");var b=8-this.bitOffset,g=Math.min(b,R-A);D=D<<g|this.getBitsFromByte(this.buffer,this.byteOffset,this.bitOffset,this.bitOffset+g-1),this.bitOffset+=g,A+=g,this.bitOffset===8&&(this.byteOffset++,this.bitOffset=0)}return R===32&&(D>>>=0),D},d.prototype.hasNext=function(){return this.byteOffset<this.buffer.byteLength},d.prototype.getBitsFromByte=function(R,D,A,b){if(D<0||D>=R.byteLength||A<0||b>7||A>b)throw new Error("Invalid parameters");return R[D]>>7-b&(1<<b-A+1)-1},d}()},102:(H,T)=>{Object.defineProperty(T,"__esModule",{value:!0});var _=function(){function f(){this._eventMap={}}return f.prototype.listeners=function(l){return this._eventMap[l]||[]},f.prototype.emit=function(l){for(var m=this,h=[],v=1;v<arguments.length;v++)h[v-1]=arguments[v];var u=this._eventMap[l];return!!Array.isArray(u)&&(u.forEach(function(s){return s.apply(m,h)}),!0)},f.prototype.off=function(l,m){var h=this._eventMap[l];return Array.isArray(h)&&(this._eventMap[l]=h.filter(function(v){return v!==m})),this},f.prototype.removeAllListeners=function(l){return l===void 0?this._eventMap={}:this._eventMap[l]&&(this._eventMap[l]=[]),this},f.prototype.on=function(l,m){return this._eventMap[l]?this._eventMap[l].push(m):this._eventMap[l]=[m],this},f.prototype.once=function(l,m){var h=this,v=function(){for(var u=[],s=0;s<arguments.length;s++)u[s]=arguments[s];h.off(l,v),m.apply(h,u)};return this.on(l,v),this},f}();T.default=_},492:(H,T)=>{Object.defineProperty(T,"__esModule",{value:!0}),T.MediaObserver=void 0;var _=function(){function f(l){this.timeout=l.timeout||f.DEFAULT_TIMEOUT,this.handler=l.handler||function(){},this.watchTimer=null}return Object.defineProperty(f.prototype,"actTimeout",{get:function(){return this.timeout},enumerable:!1,configurable:!0}),f.prototype.check=function(l,m,h,v){var u=this;this.hasNoData(l)?this.watchTimer||(this.watchTimer=window.setTimeout(function(){u.handler(m,h,v)},this.timeout)):this.watchTimer&&(clearTimeout(this.watchTimer),this.watchTimer=null)},f.prototype.hasNoData=function(l){return!l||(l.video?!(Number(l.video.bytesReceivedPerSecond)>0):!l.audio||!(Number(l.audio.bytesReceivedPerSecond)>0))},f.prototype.updateConfig=function(l){this.timeout=l.timeout||this.timeout,this.handler=l.handler||this.handler},f.prototype.reset=function(){this.watchTimer&&(clearTimeout(this.watchTimer),this.watchTimer=null)},f.prototype.dispose=function(){this.timeout=f.DEFAULT_TIMEOUT,this.handler=function(){},this.watchTimer&&(clearTimeout(this.watchTimer),this.watchTimer=null)},f.DEFAULT_TIMEOUT=6e3,f}();T.MediaObserver=_},9594:(H,T,_)=>{Object.defineProperty(T,"__esModule",{value:!0}),T.readUUID=T.discardEPB=T.insertEPB=T.SODBtoRBSP=T.convertPayloadSize=T.NALU=T.SEI=T.parseSei=T.insertSei=void 0;var f=_(5649);T.insertSei=function(v,u,s,i){s===void 0&&(s=5);for(var e=v.data,o=new DataView(e),r=0;;){if(o.getUint32(r)===1){o.getUint8(r+4);var a=new l(u,s,i).buffer,t=new m(a).buffer,n=new ArrayBuffer(t.byteLength+e.byteLength),c=new Uint8Array(n),p=new Uint8Array(t);c.set(p);var C=new Uint8Array(e);c.set(C,t.byteLength),v.data=n,r+=1;break}if((r+=1)+4>=o.byteLength)break}},T.parseSei=function(v){for(var u=[],s=new DataView(v),i=0;;){var e=i,o=s.getUint32(e);if(e+=4,o===1){if((31&s.getUint8(e++))===6){for(var r=s.getUint8(e++),a=h(r)?16:0,t=0;s.getUint8(e)==255;)e++,t+=255;if((t+=s.getUint8(e++))>0&&s.byteLength>e+t){var n=new Uint8Array(s.buffer),c="";if(h(r)){var p=n.slice(e,e+a);c=(0,T.readUUID)((0,T.discardEPB)(p))}var C=n.slice(e+a,e+t);e+=t,u.push({payloadType:r,uuid:c,data:C.buffer})}}i=e}else i+=1;if(i+4>=s.byteLength)break}return u};var l=function(v,u,s){u===void 0&&(u=5);var i=h(u)?16:0,e=v.byteLength+i,o=(0,T.convertPayloadSize)(e),r=o.buffer.byteLength,a=new ArrayBuffer(1+r+i+v.byteLength),t=new Uint8Array(a),n=0;if(t[n++]=u,t.set(o,n),n+=o.byteLength,h(u)){s=(s||"00000000-0000-0000-0000-000000000000").replace(/-/g,"");for(var c=0;c<16;c++)t[n+c]=parseInt(s.substr(2*c,2),16);n+=16}var p=new Uint8Array(v);t.set(p,n);var C=(0,T.SODBtoRBSP)(t);this.buffer=C.buffer};T.SEI=l;var m=function(v){var u=new Uint8Array([0,0,0,1]),s=new Uint8Array([6]),i=new ArrayBuffer(u.byteLength+s.byteLength+v.byteLength),e=new Uint8Array(i);e.set(u),e.set(s,u.byteLength),e.set(new Uint8Array(v),u.byteLength+s.byteLength),this.buffer=i};T.NALU=m,T.convertPayloadSize=function(v){if(v<=0)throw new Error("payloadSize must be a positive integer.");for(var u=Math.ceil(v/255),s=new ArrayBuffer(u),i=new DataView(s),e=0;e<u-1;e++)i.setUint8(e,255);return i.setUint8(u-1,v%255&255),new Uint8Array(s)},T.SODBtoRBSP=function(v){for(var u=new Uint8Array(v),s="",i=0;i<u.length;i++)s+=u[i].toString(2).padStart(8,"0");for(s+="1";s.length%8!=0;)s+="0";var e=s.length/8,o=new Uint8Array(e);for(i=0;i<e;i++)o[i]=parseInt(s.slice(8*i,8*i+8),2);return(0,T.insertEPB)(o)},T.insertEPB=function(v){for(var u=[],s=0,i=0;i<v.length;i++)u.push(v[i]),v[i]===0?++s===2&&i<v.length-1&&v[i+1]<=3&&(u.push(3),s=0):s=0;return new Uint8Array(u)},T.discardEPB=function(v){for(var u=v.byteLength,s=[],i=1;i<u-2;)v[i]===0&&v[i+1]===0&&v[i+2]===3?(s.push(i+2),i+=2):i++;if(s.length===0)return v;var e=u-s.length,o=new Uint8Array(e),r=0;for(i=0;i<e;r++,i++)r===s[0]&&(r++,s.shift()),o[i]=v[r];return o},T.readUUID=function(v){if(v.length!==16)throw new Error("UUID must be 16 bytes long.");var u=v.reduce(function(s,i){return s+i.toString(16).padStart(2,"0")},"");return"".concat(u.slice(0,8),"-").concat(u.slice(8,12),"-").concat(u.slice(12,16),"-").concat(u.slice(16,20),"-").concat(u.slice(20))};var h=function(v){return v===5||v===f.CUMU_DELAY_SEI_PAYLOAD_TYPE}},8219:function(H,T,_){var f=this&&this.__importDefault||function(m){return m&&m.__esModule?m:{default:m}};Object.defineProperty(T,"__esModule",{value:!0});var l=f(_(2505));T.default=l.default.create({baseURL:"",timeout:5e3,headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}})},4315:function(H,T,_){var f=this&&this.__spreadArray||function(v,u,s){if(s||arguments.length===2)for(var i,e=0,o=u.length;e<o;e++)!i&&e in u||(i||(i=Array.prototype.slice.call(u,0,e)),i[e]=u[e]);return v.concat(i||Array.prototype.slice.call(u))};Object.defineProperty(T,"__esModule",{value:!0}),T.SdpUtil=void 0;var l=_(233),m=function(){this.stramId="",this.audioTrackId="",this.videoTrackId="",this.screenTrackId="",this.customTrackId=""},h=function(){function v(u){this.sdpLines=new Array,this.localStream=u,this.publishStreamInfo=new m}return Object.defineProperty(v.prototype,"sdp",{get:function(){return this.sdpLines.join(`\r
157
+ `)},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"videoTrackId",{get:function(){return this.publishStreamInfo.videoTrackId},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"screenTrackId",{get:function(){return this.publishStreamInfo.videoTrackId},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"videoName",{get:function(){return"rts video"},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"screenName",{get:function(){return"rts screen"},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"hasTcpCandidate",{get:function(){return this.sdpLines.some(function(u){return u.indexOf("tcptype")!==-1})},enumerable:!1,configurable:!0}),v.prototype.init=function(u){this.sdpLines=u.split(`\r
158
+ `)},v.prototype.addNack=function(){for(var u=0;u<this.sdpLines.length;++u)if(this.sdpLines[u].indexOf("opus")!=-1&&this.sdpLines[u+1].indexOf("rtcp-fb")!=-1){var s=this.sdpLines[u+1].split(" ");s.length==2&&(this.sdpLines[u+2].indexOf("rtcp-fb")!=-1?this.sdpLines.splice(u+3,0,s[0]+" nack"):this.sdpLines.splice(u+2,0,s[0]+" nack"))}},v.prototype.parseCustomMsid=function(u){var s={stream:"",track:""};if(!u)return s;var i=u.trim().split(" ");return i.length==2?(s.stream=i[0],s.track=i[1]):s.track=i[0],s},v.prototype.modifyTrackName=function(u){u===void 0&&(u={});var s=u.vMsid,i=u.aMsid,e=s?this.parseCustomMsid(s):{stream:"rts",track:"video"},o=i?this.parseCustomMsid(i):{stream:"rts",track:"audio"},r="";if(this.localStream){this.publishStreamInfo.stramId=this.localStream.mediaStream.id,this.localStream.audioTrack&&(this.publishStreamInfo.audioTrackId=this.localStream.audioTrack.id,r=o.stream||"-"),this.localStream.videoTrack&&(this.publishStreamInfo.videoTrackId=this.localStream.videoTrack.id,r=e.stream||"-");for(var a=!1,t=!1,n=0;n<this.sdpLines.length;++n){var c=this.sdpLines[n],p=c.indexOf(this.publishStreamInfo.stramId);this.publishStreamInfo.stramId&&p!=-1&&(this.sdpLines[n]=this.sdpLines[n].replace(this.publishStreamInfo.stramId,r),l.BrowserUtil.isFirefox&&(a?this.sdpLines[n]=this.sdpLines[n].substring(0,p+r.length+1)+o.track:t&&(this.sdpLines[n]=this.sdpLines[n].substring(0,p+r.length+1)+e.track))),this.publishStreamInfo.audioTrackId&&c.indexOf(this.publishStreamInfo.audioTrackId)!=-1?this.sdpLines[n]=this.sdpLines[n].replace(this.publishStreamInfo.audioTrackId,o.track):this.publishStreamInfo.videoTrackId&&c.indexOf(this.publishStreamInfo.videoTrackId)!=-1&&(this.sdpLines[n]=this.sdpLines[n].replace(this.publishStreamInfo.videoTrackId,e.track)),c.indexOf("m=audio")!=-1?(a=!0,t=!1):c.indexOf("m=video")!=-1&&(t=!0,a=!1),c.indexOf("a=ssrc")!=-1&&(p=c.indexOf("cname:"))!==-1&&(a?this.sdpLines[n]=c.substr(0,p+6)+o.track:t&&(this.sdpLines[n]=c.substr(0,p+6)+e.track))}}},v.prototype.getPublishVideoSdp=function(){for(var u=-1,s=-1,i=!1,e=0;e<this.sdpLines.length;++e){if(i&&this.sdpLines[e].indexOf("m=application")>-1){s=e-1;break}if(this.sdpLines[e].indexOf("m=video")>-1){if(i){s=e-1;break}u=e}this.sdpLines[e].indexOf("rts video")>-1&&(i=!0)}return i?(s===-1&&(s=this.sdpLines.length-1),this.sdpLines.splice(u,s-u).join(`\r
159
+ `)):""},v.prototype.removeVideoTrack=function(u){for(var s="rts "+u,i=-1,e=-1,o=!1,r=0;r<this.sdpLines.length;++r){if(o&&this.sdpLines[r].indexOf("m=application")>-1){e=r-1;break}if(this.sdpLines[r].indexOf("m=video")>-1){if(o){e=r-1;break}i=r}this.sdpLines[r].indexOf(s)>-1&&(o=!0)}return!!o&&(e===-1&&(e=this.sdpLines.length-1),this.sdpLines.splice(i,e-i),!0)},v.prototype.ios15PushHack=function(){var u=!1,s=-1;if(this.sdpLines.forEach(function(o,r){o.includes("m=video")&&(u=!0),u&&s===-1&&o.includes("a=")&&(s=r)}),s!==-1){var i=this.getExtmapIds(),e=Math.max.apply(Math,i)+1;this.sdpLines.splice(s,0,"a=extmap:".concat(e," urn:3gpp:video-orientation"))}},v.prototype.addSps=function(){this.sdpLines=this.sdpLines.map(function(u){return u.includes("a=fmtp:")&&u.includes("level-asymmetry-allowed")?u+=";sps-pps-idr-in-keyframe=1":u})},v.prototype.removeTwccRtcpFb=function(){this.sdpLines=this.sdpLines.filter(function(u){return!u.includes("http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01")})},v.prototype.removeUdpCandidate=function(){this.sdpLines=this.sdpLines.filter(function(u){return!u.includes("a=candidate:")||!u.includes("UDP")})},v.prototype.setDirection=function(u){u===void 0&&(u={direction:"recvonly"});var s=["sendonly","recvonly","sendrecv"].filter(function(o){return o!==u.direction}),i=!1,e=!1;this.sdpLines=this.sdpLines.map(function(o,r){if(o.includes("m=video"))i=!0,e=!1;else if(o.includes("m=audio"))e=!0,i=!1;else if(o.includes("m=application"))i=!1,e=!1;else if(i||e){var a;if(s.some(function(t){if(o.includes(t))return a=t,!0})&&a)return o.replace(a,u.direction)}return o})},v.prototype.removeSDES=function(){var u=["urn:ietf:params:rtp-hdrext:sdes:mid","urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id","urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id"];this.sdpLines=this.sdpLines.filter(function(s){return!u.some(function(i){return s.includes(i)})})},v.prototype.addStereo=function(){var u=this;this.getPayloadType("opus").map(this.getFmtpIndex.bind(this)).filter(function(s){return s!==void 0}).forEach(function(s){u.sdpLines[s].indexOf("stereo=1")>-1||(u.sdpLines[s]=u.sdpLines[s]+";stereo=1")})},v.prototype.setSingleNaluPackMode__legacy=function(){this.sdpLines=this.sdpLines.filter(function(u){return!u.includes("a=fmtp:")||!u.includes("packetization-mode=1")})},v.prototype.setSingleNaluPackMode=function(){var u=this,s=[],i=[],e=!1;if(this.sdpLines.forEach(function(c){if(c.includes("packetization-mode=0")&&(e=!0),c.includes("packetization-mode=1")){var p=u.parseFmtpValue(c);s.push(p||"NULL")}s.length&&new RegExp("apt=(".concat(s.join("|"),")")).test(c)&&(p=u.parseFmtpValue(c),i.push(p||"NULL"))}),!e)return!1;var o=f(f([],s,!0),i,!0).join("|"),r=new RegExp("(rtpmap|rtcp-fb|fmtp):.*?(".concat(o,")"));this.sdpLines=this.sdpLines.filter(function(c){return!r.test(c)});for(var a=0;a<this.sdpLines.length;a++){var t=this.sdpLines[a];if(t.includes("m=video")){var n=new RegExp("( ".concat(f(f([],s,!0),i,!0).join("| "),")"),"g");this.sdpLines[a]=t.replace(n,"");break}}return!0},v.prototype.dispose=function(){this.localStream&&(this.localStream=void 0),this.sdpLines=new Array,this.publishStreamInfo=new m},v.prototype.getExtmapIds=function(){return this.sdpLines.reduce(function(u,s){if(s.includes("a=extmap")){var i=Number(s.replace("a=extmap:","").split(" ")[0]);return f(f([],u,!0),[i],!1)}return u},[]).filter(function(u){return u})},v.prototype.getPayloadType=function(u){for(var s=[],i=new RegExp("a\\=rtpmap\\:(\\d+) ".concat(u,".*"),"i"),e=0;e<this.sdpLines.length;e++){var o=this.sdpLines[e],r=i.exec(o);r?.length&&s.push(r[1])}return s},v.prototype.getFmtpIndex=function(u){for(var s=new RegExp("a\\=fmtp\\:".concat(u," .*"),"i"),i=0;i<this.sdpLines.length;i++){var e=this.sdpLines[i];if(s.test(e))return i}},v.prototype.parseFmtpValue=function(u){var s=u.match(/a=fmtp:(\d+)/);return s?s[1]:null},v}();T.SdpUtil=h},7989:function(H,T,_){var f=this&&this.__awaiter||function(r,a,t,n){return new(t||(t=Promise))(function(c,p){function C(E){try{y(n.next(E))}catch(S){p(S)}}function x(E){try{y(n.throw(E))}catch(S){p(S)}}function y(E){var S;E.done?c(E.value):(S=E.value,S instanceof t?S:new t(function(d){d(S)})).then(C,x)}y((n=n.apply(r,a||[])).next())})},l=this&&this.__generator||function(r,a){var t,n,c,p,C={label:0,sent:function(){if(1&c[0])throw c[1];return c[1]},trys:[],ops:[]};return p={next:x(0),throw:x(1),return:x(2)},typeof Symbol=="function"&&(p[Symbol.iterator]=function(){return this}),p;function x(y){return function(E){return function(S){if(t)throw new TypeError("Generator is already executing.");for(;p&&(p=0,S[0]&&(C=0)),C;)try{if(t=1,n&&(c=2&S[0]?n.return:S[0]?n.throw||((c=n.return)&&c.call(n),0):n.next)&&!(c=c.call(n,S[1])).done)return c;switch(n=0,c&&(S=[2&S[0],c.value]),S[0]){case 0:case 1:c=S;break;case 4:return C.label++,{value:S[1],done:!1};case 5:C.label++,n=S[1],S=[0];continue;case 7:S=C.ops.pop(),C.trys.pop();continue;default:if(c=C.trys,!((c=c.length>0&&c[c.length-1])||S[0]!==6&&S[0]!==2)){C=0;continue}if(S[0]===3&&(!c||S[1]>c[0]&&S[1]<c[3])){C.label=S[1];break}if(S[0]===6&&C.label<c[1]){C.label=c[1],c=S;break}if(c&&C.label<c[2]){C.label=c[2],C.ops.push(S);break}c[2]&&C.ops.pop(),C.trys.pop();continue}S=a.call(r,C)}catch(d){S=[6,d],n=0}finally{t=c=0}if(5&S[0])throw S[1];return{value:S[0]?S[1]:void 0,done:!0}}([y,E])}}},m=this&&this.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(T,"__esModule",{value:!0}),T.SupportUtil=void 0;var h=_(233),v=_(3412),u=m(_(1401)),s=_(9428),i=_(2672),e=function(){this.errorCode=0,this.message=""},o=function(){function r(){this.deviceManager=new v.BrowserDeviceManager}return r.prototype.isSupport=function(a){var t=this;return new Promise(function(n,c){return f(t,void 0,void 0,function(){var p,C,x,y;return l(this,function(E){switch(E.label){case 0:return p=new e,this.checkWebRtcSupport()?a.onlyCheckUA?this.checkBrowser(p)?[3,3]:[2,c(p)]:[3,1]:(p.errorCode=s.ErrorCode.ERROR_NOTSUPPORT_WEBRTC,p.message=i.EN.MESSAGE_NOTSUPPORT_WEBRTC,[2,c(p)]);case 1:return[4,this.checkWebrtcAbilities()];case 2:if(C=E.sent(),x=C[0],C[1],C[2],y=C[3],!x)return p.errorCode=s.ErrorCode.ERROR_NOTSUPPORT_WEBRTC,p.message=i.EN.MESSAGE_NOTSUPPORT_WEBRTC,[2,c(p)];if(y)return p.errorCode=s.ErrorCode.ERROR_BROWSER_NOTSUPPORT,p.message=i.EN.MESSAGE_BROWSER_NOTSUPPORT,[2,c(p)];E.label=3;case 3:return a.isReceiveVideo?this.checkH264Decode(p).then(function(){n(p)}).catch(function(){c(p)}):n(p),[2]}})})})},r.prototype.checkEncodedTransformSupport=function(){var a=window.RTCRtpReceiver&&"createEncodedStreams"in RTCRtpReceiver.prototype,t=window.RTCRtpReceiver&&"transform"in RTCRtpReceiver.prototype&&"RTCRtpScriptTransform"in window;return a||t},r.prototype.checkWebrtcAbilities=function(a){return f(this,void 0,void 0,function(){var t,n,c,p,C,x,y,E,S;return l(this,function(d){switch(d.label){case 0:t=window.RTCPeerConnection,n=!1,c=!1,p=null,C=!1,d.label=1;case 1:return d.trys.push([1,4,,5]),t?(x=new t,c="createDataChannel"in x,a&&(y=this.createBlankStream()).getTracks().forEach(function(R){x?.addTrack(R,y)}),[4,x.createOffer({offerToReceiveAudio:!0,offerToReceiveVideo:!0,iceRestart:!0})]):[3,3];case 2:E=d.sent(),S=(E||{}).sdp,p=a?!!(S&&S.indexOf("a=sendrecv")>-1):null,x.close(),x=void 0,n=!0,d.label=3;case 3:return[3,5];case 4:return d.sent(),n=!1,c=!1,p=!1,[3,5];case 5:return C=this.checkBlackList(),[2,[n,c,p,C]]}})})},r.prototype.checkPublishSupport=function(){return f(this,void 0,void 0,function(){var a,t,n,c,p,C,x,y;return l(this,function(E){switch(E.label){case 0:return a={isWebRTCSupported:!1,isH264EncodeSupported:!1,isMediaDevicesSupported:!1,isScreenCaptureSupported:!1,isAudioMixSupported:!1,cameraList:[],micList:[],speakerList:[]},this.checkWebRtcSupport()?[3,1]:(a.isWebRTCSupported=!1,a.isH264EncodeSupported=!1,[3,5]);case 1:return[4,this.checkWebrtcAbilities(!0)];case 2:return t=E.sent(),n=t[0],t[1],c=t[2],a.isWebRTCSupported=!(!n||!c),a.isWebRTCSupported?[3,3]:(a.isH264EncodeSupported=!1,[3,5]);case 3:return p=a,[4,this.checkH264Encode()];case 4:p.isH264EncodeSupported=E.sent(),E.label=5;case 5:if(a.isMediaDevicesSupported=this.checkMediaDevices(),a.isScreenCaptureSupported=this.checkScreenCapture(),a.isAudioMixSupported=this.checkAudioMix(),!a.isMediaDevicesSupported)return[3,11];E.label=6;case 6:return E.trys.push([6,10,,11]),C=a,[4,this.deviceManager.getCameraList()];case 7:return C.cameraList=E.sent().filter(function(S){return S.deviceId}),x=a,[4,this.deviceManager.getMicList()];case 8:return x.micList=E.sent().filter(function(S){return S.deviceId}),y=a,[4,this.deviceManager.getSpeakerList()];case 9:return y.speakerList=E.sent().filter(function(S){return S.deviceId}),[3,11];case 10:return E.sent(),[3,11];case 11:return[2,a]}})})},r.prototype.checkWebRtcSupport=function(){return!!window.RTCPeerConnection},r.prototype.checkMediaDevices=function(){return!(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)},r.prototype.checkScreenCapture=function(){return!(!navigator.mediaDevices||!navigator.mediaDevices.getDisplayMedia)},r.prototype.checkAudioMix=function(){if(!window.AudioContext)return!1;var a=new AudioContext;return!!a.createMediaStreamDestination&&!!a.createMediaStreamSource},r.prototype.checkBlackList=function(){var a=!1;if(h.BrowserUtil.isOppoBrowser&&h.SystemUtil.isAndroid){var t=(this.getUa().toLowerCase().match(/heytapbrowser\/([\d.]+)/)||[])[1]||"";a=!this.compareVersion(t,"40.7.39.1")}else(h.BrowserUtil.isUCBrowser||h.BrowserUtil.isQuarkBrowser)&&h.SystemUtil.isIos?a=!0:h.BrowserUtil.isWebView&&h.SystemUtil.isAndroid&&(a=!(h.BrowserUtil.browserMainVersion>=79));return a},r.prototype.checkBrowser=function(a){if(h.SystemUtil.isIos){if(h.BrowserUtil.isUCBrowser||h.BrowserUtil.isQuarkBrowser)return a.errorCode=s.ErrorCode.ERROR_BROWSER_NOTSUPPORT,a.message=i.EN.MESSAGE_BROWSER_NOTSUPPORT,!1;if(h.BrowserUtil.isSafari||h.BrowserUtil.isQQBrowser)return h.BrowserUtil.browserMainVersion>=11||(a.errorCode=s.ErrorCode.ERROR_BROWSER_VERSIONLOW,a.message=i.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(h.BrowserUtil.isEdge||h.BrowserUtil.isChrome)return h.BrowserUtil.browserMainVersion>=79||(a.errorCode=s.ErrorCode.ERROR_BROWSER_VERSIONLOW,a.message=i.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(h.BrowserUtil.isMicroMessenger)return!!this.compareVersion(h.SystemUtil.systemVersion,"12.1.4")||(a.errorCode=s.ErrorCode.ERROR_BROWSER_VERSIONLOW,a.message=i.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(h.BrowserUtil.isDingTalk)return!!h.SystemUtil.compareVersion("11.2.5")||(a.errorCode=s.ErrorCode.ERROR_BROWSER_VERSIONLOW,a.message=i.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(h.BrowserUtil.isWebView)return!!this.compareVersion(h.SystemUtil.systemVersion,"14.3")||(a.errorCode=s.ErrorCode.ERROR_BROWSER_VERSIONLOW,a.message=i.EN.MESSAGE_BROWSER_VERSIONLOW,!1)}else if(h.SystemUtil.isAndroid){if(this.checkPrivateUcWebview())return!0;if(h.BrowserUtil.isChrome||h.BrowserUtil.isQQBrowser||h.BrowserUtil.isHuaweiBrowser||h.BrowserUtil.isSamsungBrowser)return h.BrowserUtil.browserMainVersion>=63||(a.errorCode=s.ErrorCode.ERROR_BROWSER_VERSIONLOW,a.message=i.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(h.BrowserUtil.isEdge)return h.BrowserUtil.browserMainVersion>=79||(a.errorCode=s.ErrorCode.ERROR_BROWSER_VERSIONLOW,a.message=i.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(h.BrowserUtil.isMicroMessenger)return!!this.compareVersion(this.getChromeCoreVersion(),"63")||(a.errorCode=s.ErrorCode.ERROR_BROWSER_VERSIONLOW,a.message=i.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(h.BrowserUtil.isDingTalk)return!!this.compareVersion(this.getChromeCoreVersion(),"69")||(a.errorCode=s.ErrorCode.ERROR_BROWSER_VERSIONLOW,a.message=i.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(h.BrowserUtil.isOppoBrowser){var t=(this.getUa().toLowerCase().match(/heytapbrowser\/([\d.]+)/)||[])[1]||"";return!!this.compareVersion(t,"40.7.39.1")||(a.errorCode=s.ErrorCode.ERROR_BROWSER_VERSIONLOW,a.message=i.EN.MESSAGE_BROWSER_VERSIONLOW,!1)}if(h.BrowserUtil.isX5Core)return!0;if(h.BrowserUtil.isWebView)return h.BrowserUtil.browserMainVersion>=79||(a.errorCode=s.ErrorCode.ERROR_BROWSER_VERSIONLOW,a.message=i.EN.MESSAGE_BROWSER_VERSIONLOW,!1)}else if(h.SystemUtil.isMacOS){if(h.BrowserUtil.isElectron)return!0;if(h.BrowserUtil.isSafari)return h.BrowserUtil.browserMainVersion>=11||(a.errorCode=s.ErrorCode.ERROR_BROWSER_VERSIONLOW,a.message=i.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(h.BrowserUtil.isChrome)return h.BrowserUtil.browserMainVersion>=63||(a.errorCode=s.ErrorCode.ERROR_BROWSER_VERSIONLOW,a.message=i.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(h.BrowserUtil.isEdge)return h.BrowserUtil.browserMainVersion>=79||(a.errorCode=s.ErrorCode.ERROR_BROWSER_VERSIONLOW,a.message=i.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(h.BrowserUtil.isFirefox)return h.BrowserUtil.browserMainVersion>=62||(a.errorCode=s.ErrorCode.ERROR_BROWSER_VERSIONLOW,a.message=i.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(h.BrowserUtil.isOpera)return h.BrowserUtil.browserMainVersion>=15||(a.errorCode=s.ErrorCode.ERROR_BROWSER_VERSIONLOW,a.message=i.EN.MESSAGE_BROWSER_VERSIONLOW,!1)}else if(h.SystemUtil.isWindows){if(h.BrowserUtil.isElectron||h.BrowserUtil.isMicroMessenger)return!0;if(h.BrowserUtil.isChrome||h.BrowserUtil.isQQBrowser)return h.BrowserUtil.browserMainVersion>=63||(a.errorCode=s.ErrorCode.ERROR_BROWSER_VERSIONLOW,a.message=i.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(h.BrowserUtil.isEdge)return h.BrowserUtil.browserMainVersion>=79||(a.errorCode=s.ErrorCode.ERROR_BROWSER_VERSIONLOW,a.message=i.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(h.BrowserUtil.isFirefox)return h.BrowserUtil.browserMainVersion>=62||(a.errorCode=s.ErrorCode.ERROR_BROWSER_VERSIONLOW,a.message=i.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(h.BrowserUtil.isOpera)return h.BrowserUtil.browserMainVersion>=15||(a.errorCode=s.ErrorCode.ERROR_BROWSER_VERSIONLOW,a.message=i.EN.MESSAGE_BROWSER_VERSIONLOW,!1)}else if(h.SystemUtil.isLinux){if(h.BrowserUtil.isChrome)return h.BrowserUtil.browserMainVersion>=63||(a.errorCode=s.ErrorCode.ERROR_BROWSER_VERSIONLOW,a.message=i.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(h.BrowserUtil.isEdge)return h.BrowserUtil.browserMainVersion>=79||(a.errorCode=s.ErrorCode.ERROR_BROWSER_VERSIONLOW,a.message=i.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(h.BrowserUtil.isFirefox)return h.BrowserUtil.browserMainVersion>=62||(a.errorCode=s.ErrorCode.ERROR_BROWSER_VERSIONLOW,a.message=i.EN.MESSAGE_BROWSER_VERSIONLOW,!1)}return a.errorCode===0&&(a.errorCode=s.ErrorCode.ERROR_BROWSER_NOTSUPPORT,a.message=i.EN.MESSAGE_BROWSER_NOTSUPPORT),!1},r.prototype.checkH264Decode=function(a){var t=this;return new Promise(function(n,c){return f(t,void 0,void 0,function(){var p;return l(this,function(C){switch(C.label){case 0:return[4,this.tryFindH264FromSdp(a)];case 1:if(p=C.sent())return n(!0),[2];C.label=2;case 2:return C.trys.push([2,4,,5]),[4,this.loadH264(3)];case 3:return p=C.sent(),[3,5];case 4:return C.sent(),[3,5];case 5:return p?n(!0):(a&&a.errorCode===0&&(a.errorCode=s.ErrorCode.ERROR_NOTSUPPORT_H264,a.message=i.EN.MESSAGE_NOTSUPPORT_H264),c(!1)),[2]}})})})},r.prototype.checkSDPSupportH264=function(a){return a.indexOf("H264")>0||a.indexOf("h264")>0||a.indexOf("H.264")>0||a.indexOf("h.264")>0},r.prototype.checkPrivateUcWebview=function(){return this.getUa().indexOf("UniqueCode")>0},r.prototype.getUa=function(){return navigator&&navigator.userAgent||""},r.prototype.getChromeCoreVersion=function(){return(this.getUa().toLowerCase().match(/chrome\/([\d.]+)/)||[])[1]||""},r.prototype.compareVersion=function(a,t){a===void 0&&(a=""),t===void 0&&(t="");for(var n=(a||"").split("."),c=(t||"").split("."),p=0,C=0,x=0;x<n.length&&x<c.length;++x){if((p=isNaN(parseInt(n[x],10))?0:parseInt(n[x],10))<(C=isNaN(parseInt(c[x],10))?0:parseInt(c[x],10)))return!1;if(p>C)return!0}return!0},r.prototype.tryFindH264FromSdp=function(a){return f(this,void 0,void 0,function(){var t,n,c;return l(this,function(p){switch(p.label){case 0:if(t=!1,!RTCPeerConnection)return[2,t];n=new RTCPeerConnection,c=void 0,p.label=1;case 1:return p.trys.push([1,3,,4]),[4,n.createOffer({offerToReceiveVideo:!0,offerToReceiveAudio:!0})];case 2:return(c=p.sent())&&c.sdp&&(t=this.checkSDPSupportH264(c.sdp)),[3,4];case 3:return p.sent(),t=!1,a&&(a.errorCode=s.ErrorCode.ERROR_CREATEOFFER,a.message=i.EN.MESSAGE_CREATEOFFER),[3,4];case 4:return n.close(),n=void 0,[2,t]}})})},r.prototype.loadH264=function(a){var t=this;return new Promise(function(n,c){return f(t,void 0,void 0,function(){var p,C,x,y,E=this;return l(this,function(S){if(!h.SystemUtil.isAndroid||!h.BrowserUtil.isChrome&&!h.BrowserUtil.isWebView)return n(!1),[2];for(p=0,C=[],x=0;p<a;)y=setTimeout(function(){return f(E,void 0,void 0,function(){return l(this,function(d){switch(d.label){case 0:return x++,[4,this.tryFindH264FromSdp()];case 1:return d.sent()?(C.forEach(function(R){clearTimeout(R)}),C=[],n(!0),[2]):(x===a&&n(!1),[2])}})})},1e3*p),C.push(y),p++;return[2]})})})},r.prototype.checkH264Encode=function(){return f(this,void 0,void 0,function(){var a,t,n;return l(this,function(c){switch(c.label){case 0:return[4,this.loadH264(3)];case 1:return!(a=c.sent())&&RTCRtpSender&&RTCRtpSender.getCapabilities&&(t=(0,u.default)((n=RTCRtpSender.getCapabilities("video"))===null||n===void 0?void 0:n.codecs),a=t.toLowerCase().includes("video/h264")),[2,!!a]}})})},r.prototype.createBlankStream=function(){var a,t,n,c=(a=new AudioContext,t=a.createOscillator(),n=t.connect(a.createMediaStreamDestination()),t.start(),Object.assign(n.stream.getAudioTracks()[0],{enabled:!1}));c.stop();var p=function(C){var x,y={},E=y.width,S=E===void 0?160:E,d=y.height,R=d===void 0?90:d,D=document.createElement("canvas");D.width=S,D.height=R,(x=D.getContext("2d"))===null||x===void 0||x.fillRect(0,0,S,R);var A=D.captureStream();return Object.assign(A.getVideoTracks()[0],{enabled:!1})}();return p.stop(),new MediaStream([c,p])},r}();T.SupportUtil=o},2718:function(H,T){var _=this&&this.__spreadArray||function(f,l,m){if(m||arguments.length===2)for(var h,v=0,u=l.length;v<u;v++)!h&&v in l||(h||(h=Array.prototype.slice.call(l,0,v)),h[v]=l[v]);return f.concat(h||Array.prototype.slice.call(l))};Object.defineProperty(T,"__esModule",{value:!0}),T.hebtLog=T.createUUID=T.evaluateNetworkCondition=T.makeCancelable=T.hasVideoTrack=T.hasAudioTrack=T.getVideoTrack=T.getAudioTrack=T.pruneSubUrl=T.getJitterBufferDelayAvg=void 0,T.lowercaseFirstLetter=function(f){return f.replace(/([A-Za-z])/,function(l){return l.toLowerCase()})},T.underlineToCamelCase=function(f){return f.replace(/_([a-z])/g,function(l,m){return m.toUpperCase()})},T.getJitterBufferDelayAvg=function(f,l){return f&&l?Number(f)/Number(l)*1e3:-1},T.pruneSubUrl=function(f,l){var m=f||"";return m=m.replace("@subaudio=no","").replace("@subvideo=no",""),l&&(m=m.split("?")[0]),m},T.getAudioTrack=function(f){return f.getAudioTracks()[0]},T.getVideoTrack=function(f){return f.getVideoTracks()[0]},T.hasAudioTrack=function(f){return f.getAudioTracks().length>0},T.hasVideoTrack=function(f){return f.getVideoTracks().length>0},T.makeCancelable=function(f){var l=!1;return{promise:new Promise(function(m,h){f.then(function(v){return l?h({isCanceled:!0}):m(v)}),f.catch(function(v){return h(l?{isCanceled:!0}:v)})}),cancel:function(){l=!0}}},T.evaluateNetworkCondition=function(f,l,m,h,v){var u=0;if(!navigator.onLine)return u=6;var s=[{loss:0,rtt:0,jbd:1},{loss:0,rtt:1,jbd:0},{loss:0,rtt:.5,jbd:.5},{loss:1,rtt:0,jbd:0},{loss:.8,rtt:0,jbd:.2},{loss:.8,rtt:.2,jbd:0},{loss:.6,rtt:.2,jbd:.2}],i=-1,e=-1,o=-1;if(typeof l=="number"&&l>=0||typeof m=="number"&&m>=0){i=0;var r=!1,a=!1;typeof l=="number"&&l>=0&&(i+=l,r=!0),typeof m=="number"&&m>=0&&(i+=m,a=!0),r&&!a&&(i*=2),a&&!r&&(i*=1.8)}typeof f=="number"&&f>=0&&(o=f),(typeof h=="number"&&h>=0||typeof v=="number"&&v>=0)&&(e=0,typeof h=="number"&&h>=0&&(e+=h),typeof v=="number"&&v>=0&&(e+=v));var t;if((t=4*(i!==-1?1:0)+2*(o!==-1?1:0)+(e!==-1?1:0))>0){var n=1.2*i*s[t-1].loss+o/1500*s[t-1].rtt+e/3e3*s[t-1].jbd;u=n<=.1?1:n<=.23?2:n<=.36?3:n<=.49?4:5}else u=0;return u},T.createUUID=function(f,l){var m,h="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),v=[];if(l=l||h.length,f)for(m=0;m<f;m++)v[m]=h[0|Math.random()*l];else{var u=void 0;for(v[8]=v[13]=v[18]=v[23]="-",v[14]="4",m=0;m<36;m++)v[m]||(u=0|16*Math.random(),v[m]=h[m==19?3&u|8:u])}return v.join("")},T.hebtLog=function(){for(var f=[],l=0;l<arguments.length;l++)f[l]=arguments[l];window.RTS_HEBT_DEBUG&&console.log.apply(console,_(["[rts hebt]"],f,!1))}},233:H=>{/*! useragent-util - ver 1.3.1 created:9/4/2024, 4:31:28 PM */H.exports=(()=>{var T={622:(m,h,v)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.BrowserUtil=h.BrowserType=void 0;var u,s=v(101);(function(e){e.IE="IE",e.Chrome="Chrome",e.Safari="Safari",e.Firefox="Firefox",e.Opera="Opera",e.Edge="Edge",e.MicroMessenger="MicroMessenger",e.X5Core="X5Core",e.Quark="Quark",e.QQ="QQ",e.QQBrowser="QQBrowser",e.DingTalk="DingTalk",e.Electron="Electron",e.Sogou="Sogou",e.Vivo="VivoBrowser",e.Oppo="OppoBrowser",e.UC="UCBrowser",e.MI="MiBrowser",e.Lenovo="SLBrowser",e.Maxthon="Maxthon",e.Liebao="Liebao",e.Huawei="Huawei",e.Meizu="MZBrowser",e.Finger="FingerBrowser",e.Samsung="SamsungBrowser",e.WebVeiw="WebVeiw",e.Unknown="unknown"})(u=h.BrowserType||(h.BrowserType={}));var i=function(){function e(){}return Object.defineProperty(e,"isBrowser",{get:function(){return typeof document<"u"},enumerable:!1,configurable:!0}),Object.defineProperty(e,"domain",{get:function(){return window.location.protocol+window.location.host},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isHttps",{get:function(){return this.isBrowser&&document.location&&(document.location.protocol=="https:"||document.location.host.indexOf("127.0.0.1:")===0||document.location.host.indexOf("localhost:")===0)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isSupportScreenShare",{get:function(){return!!(navigator&&navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isChrome",{get:function(){return e._getBrowserInfo(),u.Chrome===e._browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isSafari",{get:function(){return e._getBrowserInfo(),u.Safari===e._browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isIE",{get:function(){return e._getBrowserInfo(),u.IE===e._browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isFirefox",{get:function(){return e._getBrowserInfo(),u.Firefox===e._browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isEdge",{get:function(){return e._getBrowserInfo(),u.Edge===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isSogou",{get:function(){return e._getBrowserInfo(),u.Sogou===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isVivoBroswer",{get:function(){return e._getBrowserInfo(),u.Vivo===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isOppoBrowser",{get:function(){return e._getBrowserInfo(),u.Oppo===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isMiBrowser",{get:function(){return e._getBrowserInfo(),u.MI===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isLenovoBrowser",{get:function(){return e._getBrowserInfo(),u.Lenovo===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isMaxthonBrowser",{get:function(){return e._getBrowserInfo(),u.Maxthon===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isLiebaoBrowser",{get:function(){return e._getBrowserInfo(),u.Liebao===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isHuaweiBrowser",{get:function(){return e._getBrowserInfo(),u.Huawei===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isMZBrowser",{get:function(){return e._getBrowserInfo(),u.Meizu===e._browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isSamsungBrowser",{get:function(){return e._getBrowserInfo(),u.Samsung===e._browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isOpera",{get:function(){return e._getBrowserInfo(),u.Opera===e._browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isMicroMessenger",{get:function(){return e._getBrowserInfo(),e._browserName===u.MicroMessenger},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isQQ",{get:function(){return e._getBrowserInfo(),u.QQ===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isQQBrowser",{get:function(){return e._getBrowserInfo(),u.QQBrowser===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isX5Core",{get:function(){return e._getBrowserInfo(),e._browserName===u.X5Core},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isUCBrowser",{get:function(){return e._getBrowserInfo(),e._browserName===u.UC},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isQuarkBrowser",{get:function(){return e._getBrowserInfo(),e._browserName===u.Quark},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isFingerBrowser",{get:function(){return e._getBrowserInfo(),e._browserName===u.Finger},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isChromeCore",{get:function(){return e._getBrowserInfo(),e._core==="Chrome"},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isWebView",{get:function(){return e._getBrowserInfo(),e._browserName===u.WebVeiw},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isDingTalk",{get:function(){return e._getBrowserInfo(),e._browserName===u.DingTalk},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isUnknown",{get:function(){return e._getBrowserInfo(),u.Unknown===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"browserName",{get:function(){return e._getBrowserInfo(),e._browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"browserVersion",{get:function(){return e._getBrowserInfo(),e._browserVersion},enumerable:!1,configurable:!0}),Object.defineProperty(e,"browserMainVersion",{get:function(){return e._getBrowserInfo(),e._browserVersion?parseInt(e._browserVersion.split(".")[0],10):0},enumerable:!1,configurable:!0}),Object.defineProperty(e,"browserCoreVersion",{get:function(){return navigator.userAgent.toLowerCase(),s.SystemUtil.isIos||s.SystemUtil.isMacOS,e.browserMainVersion},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isElectron",{get:function(){return e._getBrowserInfo(),u.Electron===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"userAgent",{get:function(){var o=navigator.userAgent.toLowerCase(),r=o.indexOf("gecko");if(r>-1){r=o.indexOf(" ",r);var a=(o=o.substring(r+1,o.length)).split(" ");o="";for(var t=0;t<a.length;++t){var n=a[t].split("/");n&&n.length&&(o+=n[0]+" ")}}return o},enumerable:!1,configurable:!0}),e.compareVersion=function(o){if(e._getBrowserInfo(),e._browserVersion){for(var r=e._browserVersion.split("."),a=o.split("."),t=0,n=0,c=0;c<r.length&&c<a.length;++c){if((t=isNaN(parseInt(r[c],10))?0:parseInt(r[c],10))<(n=isNaN(parseInt(a[c],10))?0:parseInt(a[c],10)))return!1;if(t>n)return!0}return!0}return!0},e._getBrowserInfo=function(){if(!e._browserName||!e._browserVersion)if(navigator&&navigator.userAgent){var o=navigator.userAgent.toLowerCase(),r=void 0;(r=o.match(/edg[e|a]?\/([\d.]+)/))||(r=o.match(/edgios\/([\d.]+)/))?e._updateBrowserInfo(u.Edge,o,r[1]):(r=o.match(/rv:([\d.]+)\) like gecko/))||(r=o.match(/msie ([\d.]+)/))?e._updateBrowserInfo(u.IE,o,r[1]):(r=o.match(/vivobrowser\/([\d.]+)/))?e._updateBrowserInfo(u.Vivo,o,r[1]):(r=o.match(/miuibrowser\/([\d.]+)/))?e._updateBrowserInfo(u.MI,o,r[1]):(r=o.match(/samsungbrowser\/([\d.]+)/))?e._updateBrowserInfo(u.Samsung,o,r[1]):(r=o.match(/heytapbrowser\/([\d.]+)/))?e._updateBrowserInfo(u.Oppo,o,r[1]):(r=o.match(/mzbrowser\/([\d.]+)/))?e._updateBrowserInfo(u.Meizu,o,r[1]):(r=o.match(/ucbrowser\/([\d.]+)/))?e._updateBrowserInfo(u.UC,o,r[1]):(r=o.match(/quark\/([\d.]+)/))?e._updateBrowserInfo(u.Quark,o,r[1]):(r=o.match(/slbrowser\/([\d.]+)/))?e._updateBrowserInfo(u.Lenovo,o,r[1]):(r=o.match(/lbbrowser\/([\d.]+)/))?e._updateBrowserInfo(u.Liebao,o,r[1]):(r=o.match(/fingerbrowser\/([\d.]+)/))?e._updateBrowserInfo(u.Finger,o,r[1]):(r=o.match(/huaweibrowser\/([\d.]+)/))?e._updateBrowserInfo(u.Huawei,o,r[1]):(r=o.match(/maxthon\/([\d.]+)/))?e._updateBrowserInfo(u.Maxthon,o,r[1]):(r=o.match(/firefox\/([\d.]+)/))?e._updateBrowserInfo(u.Firefox,o,r[1]):(r=o.match(/electron\/([\d.]+)/))?e._updateBrowserInfo(u.Electron,o,r[1]):(r=o.match(/chrome\/([\d.]+)/))&&this._isChrome(o)||(r=o.match(/crios\/([\d.]+)/))&&this._isChrome(o)?e._updateBrowserInfo(u.Chrome,o,r[1]):(r=o.match(/metasr\s([\d.]+)/))||(r=o.match(/sogoumobilebrowser\/([\d.]+)/))?e._updateBrowserInfo(u.Sogou,o,r[1]):(r=o.match(/opr.([\d.]+)/))?e._updateBrowserInfo(u.Opera,o,r[1]):(r=o.match(/micromessenger.([\d.]+)/))?e._updateBrowserInfo(u.MicroMessenger,o,r[1]):(r=o.match(/qq\/([\d.]+)/))?e._updateBrowserInfo(u.QQ,o,r[1]):(r=o.match(/m?qqbrowser\/([\d.]+)/))||(r=o.match(/qqbrowserlite\/([\d.]+)/))?e._updateBrowserInfo(u.QQBrowser,o,r[1]):(r=o.match(/dingtalk.([\d.]+)/))?e._updateBrowserInfo(u.DingTalk,o,r[1]):(r=o.match(/tbs\/([\d.]+)/))?e._updateBrowserInfo(u.X5Core,o,r[1]):(r=o.match(/version\/([\d.]+).*safari/))&&this._isSafari(o)&&e._updateBrowserInfo(u.Safari,o,r[1]),e._browserName===u.Unknown&&e._isWebview(o)&&e._updateBrowserInfo(u.WebVeiw,o,"")}else e._browserName=u.Unknown,e._browserVersion="0.0"},e._isChrome=function(o){var r=o.split(/\(|\)/);if(e._core="Chrome",r.length===5){var a=r[4].trim().split(" ");if(a.length===2){if(a[0].indexOf("chrome")>-1&&a[1].indexOf("safari")>-1)return!0}else if(a.length===3){if(a[1].indexOf("mobile")>-1&&a[2].indexOf("safari")>-1&&(a[0].indexOf("chrome")>-1||a[0].indexOf("crios")>-1))return!0}else if(o.indexOf("qianniu")>-1)return!0}return!1},e._isSafari=function(o){var r=o.split(/\(|\)/);if(r.length===5){var a=r[4].trim().split(" ");if(a.length===2){if(a[0].indexOf("version")>-1&&a[1].indexOf("safari")>-1)return!0}else if(a.length===3&&a[0].indexOf("version")>-1&&a[1].indexOf("mobile")>-1&&a[2].indexOf("safari")>-1)return!0}return!1},e._isWebview=function(o){if(o){var r=new RegExp("("+["WebView","(iPhone|iPod|iPad)(?!.*Safari)","Android.*(wv|.0.0.0)","Linux; U; Android"].join("|")+")","ig"),a=new RegExp("("+["VivoBrowser","MZBrowser","MiuiBrowser"].join("|")+")","ig");return!!o.match(r)&&!o.match(a)}},e._updateBrowserInfo=function(o,r,a){e._browserName=o;var t=null;switch(o){case u.QQBrowser:s.SystemUtil.isIos||s.SystemUtil.isMacOS?(t=r.match(/version\/([\d.]+).*safari/),e._browserVersion=t?t[1]:"0.0"):(t=r.match(/chrome\/([\d.]+)/),e._browserVersion=t?t[1]:"0.0");break;case u.Vivo:case u.Oppo:case u.Meizu:case u.Huawei:case u.Sogou:case u.Samsung:t=r.match(/chrome\/([\d.]+)/),e._browserVersion=t?t[1]:"0.0";break;case u.WebVeiw:s.SystemUtil.isAndroid?(t=r.match(/chrome\/([\d.]+)/),e._browserVersion=t?t[1]:"0.0"):s.SystemUtil.isIos&&(e._browserVersion=s.SystemUtil.systemVersion);break;default:e._browserVersion=a}},e._browserName=u.Unknown,e._browserVersion="",e._core="",e}();h.BrowserUtil=i},864:(m,h)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.Guid=void 0;var v=function(){function u(){}return u.create=function(s,i){i===void 0&&(i=16);var e,o,r="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),a=[];if(i=i||r.length,s)for(e=0;e<s;e++)a[e]=r[0|Math.random()*i];else for(a[8]=a[13]=a[18]=a[23]="-",a[14]="4",e=0;e<36;e++)a[e]||(o=0|16*Math.random(),a[e]=r[e==19?3&o|8:o]);return a.join("")},u}();h.Guid=v},442:(m,h,v)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.LocalStorage=void 0;var u=v(864),s=function(){function i(){}return Object.defineProperty(i,"uuid",{get:function(){var e="alirtc_uuid",o=i.get(e);return o||(o=u.Guid.create(32),i.set(e,o)),o},enumerable:!1,configurable:!0}),i.get=function(e){var o="";return window&&window.localStorage&&(o=window.localStorage.getItem(e)||""),o},i.set=function(e,o){e&&window&&window.localStorage&&window.localStorage.setItem(e,o)},i}();h.LocalStorage=s},72:(m,h)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.ApiRequest=void 0;var v=function(){function u(){}return u.postBody=function(s,i,e){s=u._getUrl(s,i);var o,r={};return r.headers||(r.headers={}),r.headers.Accept="application/json",r.headers["Content-Type"]="application/json",new Promise(function(a,t){u.requestBody("POST",s,e).then(function(n){return o=n,n.ok?n.json():n.text()}).then(function(n){o.ok?n.code?(n=u._intercept(n),t(n)):a(n.data):t(u._httpErrorMessage(o,n))}).catch(function(n){n=u._httpErrorMessage(n),t(n)})})},u.get=function(s,i,e){var o;return e===void 0&&(e={}),s=u._getUrl(s,i),e.headers||(e.headers={}),e.headers["Content-Type"]="application/json",new Promise(function(r,a){u.request("GET",s,e).then(function(t){return o=t,t.ok?t.json():t.text()}).then(function(t){o.ok?t.code?(t=u._intercept(t),a(t)):r(t.data):a(u._httpErrorMessage(o,t))}).catch(function(t){t=u._httpErrorMessage(t),a(t)})})},u.post=function(s,i,e,o){var r;return o===void 0&&(o={}),s=u._getUrl(s,i),o.headers||(o.headers={}),o.body=e,o.headers.Accept="application/json",o.headers["Content-Type"]="application/json",new Promise(function(a,t){u.request("POST",s,o).then(function(n){return r=n,n.ok?n.json():n.text()}).then(function(n){r.ok?n.code?(n=u._intercept(n),t(n)):a(n.data):t(u._httpErrorMessage(r,n))}).catch(function(n){n=u._httpErrorMessage(n),t(n)})})},u.request=function(s,i,e){s===void 0&&(s="GET");var o=new Headers(e.headers),r=new Request(i,{method:s,headers:o});return fetch(r)},u.requestBody=function(s,i,e){return s===void 0&&(s="GET"),fetch(i,{method:s,body:e,headers:new Headers({"Content-Type":"application/json"})})},u.ajaxPost=function(s,i,e,o){return o===void 0&&(o={}),s=u._getUrl(s,i),o.headers||(o.headers={}),o.headers.Accept="application/json",o.headers["Content-Type"]="application/json",u.ajax("POST",s,e,o)},u.ajax=function(s,i,e,o){s===void 0&&(s="GET"),o===void 0&&(o={});var r=new XMLHttpRequest;return new Promise(function(a,t){r.onreadystatechange=function(){if(r.readyState===4)if(r.status===200){var c=JSON.parse(r.responseText);c.code?(c=u._intercept(c),t(c)):a(c)}else t({message:r.responseText||"\u8BF7\u6C42\u5931\u8D25:"+i})},r.open(s,i,!0);try{if(o.withCredentials&&(r.withCredentials=!0),o.headers)for(var n in o.headers)r.setRequestHeader(n,o.headers[n])}catch(c){return void t(c)}try{r.send(e)}catch(c){t(c)}})},u._getUrl=function(s,i){var e=[];if(i)for(var o in i)e.push(o+"="+i[o]);var r=e.join("&");return(s.indexOf("?")!=-1?s:s+"?")+r},u._httpErrorMessage=function(s,i){return s.message||(s.message="HTTP "+s.status+"("+s.statusText+") : "+i),s},u._intercept=function(s){var i=s.data;return s.code&&((i=i||{}).data=s.data,i.code=s.code,i.description=s.description,i.message="0x"+Number(s.code).toString(16)+", "+s.description,i.tid&&(i.message+=", tid="+i.tid)),i},u}();h.ApiRequest=v},101:(m,h)=>{var v,u;Object.defineProperty(h,"__esModule",{value:!0}),h.SystemUtil=h.WindowsType=h.SystemType=void 0,function(i){i.Unknown="Unknown",i.MacOS="Mac",i.Windows="Windows",i.Android="Android",i.Iphone="iphone",i.Ipad="ipad",i.iOS="iOS",i.Linux="Linux",i.ChromeOS="ChromeOS"}(v=h.SystemType||(h.SystemType={})),function(i){i.Windows10="Windows 10",i.Windows7="Windows 7",i.WindowsVista="Windows vista",i.WindowsXP="Windows xp"}(u=h.WindowsType||(h.WindowsType={}));var s=function(){function i(){}return Object.defineProperty(i,"isMacOS",{get:function(){return v.MacOS===i.systemName},enumerable:!1,configurable:!0}),Object.defineProperty(i,"isWindows",{get:function(){return i.systemName.indexOf(v.Windows)>-1},enumerable:!1,configurable:!0}),Object.defineProperty(i,"isIos",{get:function(){return v.Iphone===i.systemName||v.Ipad===i.systemName},enumerable:!1,configurable:!0}),Object.defineProperty(i,"isAndroid",{get:function(){return v.Android===i.systemName},enumerable:!1,configurable:!0}),Object.defineProperty(i,"isLinux",{get:function(){return v.Linux===i.systemName||v.Linux===i._platform},enumerable:!1,configurable:!0}),Object.defineProperty(i,"systemName",{get:function(){return i._getSystemInfo(),i._systemName},enumerable:!1,configurable:!0}),Object.defineProperty(i,"systemVersion",{get:function(){return i._getSystemInfo(),i._systemVersion},enumerable:!1,configurable:!0}),Object.defineProperty(i,"platform",{get:function(){return i._getSystemInfo(),i._platform},enumerable:!1,configurable:!0}),Object.defineProperty(i,"isUnknown",{get:function(){return!i.platform||i.platform===v.Unknown},enumerable:!1,configurable:!0}),i.compareVersion=function(e){if(i._getSystemInfo(),i._systemVersion){for(var o=i._systemVersion.split("."),r=e.split("."),a=0,t=0,n=0;n<o.length&&n<r.length;++n){if((a=isNaN(parseInt(o[n],10))?0:parseInt(o[n],10))<(t=isNaN(parseInt(r[n],10))?0:parseInt(r[n],10)))return!1;if(a>t)return!0}return!0}return!0},i._getSystemInfo=function(){if(!i._systemName||!i._systemVersion||!i._platform)if(navigator&&navigator.userAgent){var e=navigator.userAgent.toLowerCase();e.indexOf("ipad")>-1?(i._systemName=v.Ipad,i._platform=v.iOS,i._systemVersion=i._getIosSystemVersion(e)):e.indexOf("iphone")>-1?(i._systemName=v.Iphone,i._platform=v.iOS,i._systemVersion=i._getIosSystemVersion(e)):e.indexOf("android")>-1?(i._platform=v.Android,i._systemName=v.Android,i._systemVersion=i._getAndroidSystemVersion(e)):e.indexOf("win")>-1?e.indexOf("windwos nt 10")>-1||e.indexOf("windows 10")?(i._systemName=u.Windows10,i._platform=v.Windows,i._systemVersion="10"):e.indexOf("windows nt 6.1")>-1||e.indexOf("windows 7")>-1?(i._systemName=u.Windows7,i._platform=v.Windows,i._systemVersion="7"):e.indexOf("windows nt 6.0")>-1||e.indexOf("windows vista")>-1?(i._systemName=u.WindowsVista,i._platform=v.Windows,i._systemVersion="vista"):e.indexOf("widows nt 5.1")>-1||e.indexOf("windows xp")>-1?(i._systemName=u.WindowsXP,i._platform=v.Windows,i._systemVersion="xp"):(i._platform=v.Windows,i._systemName=v.Windows,i._systemVersion="0.0"):e.indexOf("mac")>-1?navigator&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0?(i._systemName=v.Ipad,i._platform=v.iOS,i._systemVersion=i._getIosSystemVersion(e)):(i._platform=v.MacOS,i._systemName=v.MacOS,i._systemVersion=i._getMacSystemVersion(e)):e.indexOf("linux")>-1?(i._platform=v.Linux,i._systemName=v.Linux,i._systemVersion="0.0"):e.indexOf("cros")>-1?(i._platform=v.Linux,i._systemName=v.ChromeOS,i._systemVersion="0.0"):(i._systemName=v.Unknown,i._platform=v.Windows,i._systemVersion="0.0")}else i._systemName=v.Unknown,i._platform=v.Unknown,i._systemVersion="0.0"},i._getIosSystemVersion=function(e){return(e.match(/OS [\d._]*/gi)+"").replace(/[^0-9|_.]/gi,"").replace(/_/gi,".")},i._getMacSystemVersion=function(e){return(e.match(/OS X [\d._]*/gi)+"").replace(/[^0-9|_.]/gi,"").replace(/_/gi,".")},i._getAndroidSystemVersion=function(e){return e.substr(e.indexOf("android")+8,e.indexOf(";",e.indexOf("android"))-e.indexOf("android")-8)},i._systemName="",i._systemVersion="",i._platform=v.Unknown,i}();h.SystemUtil=s}},_={};function f(m){if(_[m])return _[m].exports;var h=_[m]={exports:{}};return T[m](h,h.exports,f),h.exports}var l={};return(()=>{var m=l;Object.defineProperty(m,"__esModule",{value:!0}),m.ApiRequest=m.LocalStorage=m.Guid=m.BrowserUtil=m.SystemUtil=void 0;var h=f(101);Object.defineProperty(m,"SystemUtil",{enumerable:!0,get:function(){return h.SystemUtil}});var v=f(622);Object.defineProperty(m,"BrowserUtil",{enumerable:!0,get:function(){return v.BrowserUtil}});var u=f(864);Object.defineProperty(m,"Guid",{enumerable:!0,get:function(){return u.Guid}});var s=f(442);Object.defineProperty(m,"LocalStorage",{enumerable:!0,get:function(){return s.LocalStorage}});var i=f(72);Object.defineProperty(m,"ApiRequest",{enumerable:!0,get:function(){return i.ApiRequest}}),window&&(window.SystemUtil=h.SystemUtil,window.BrowserUtil=v.BrowserUtil,window.Guid=u.Guid,window.LocalStorage=s.LocalStorage,window.ApiRequest=i.ApiRequest)})(),l})()},9543:(H,T,_)=>{_.r(T),_.d(T,{default:()=>De});var f={};_.r(f),_.d(f,{fixNegotiationNeeded:()=>k,shimAddTrackRemoveTrack:()=>g,shimAddTrackRemoveTrackWithNative:()=>b,shimGetDisplayMedia:()=>E,shimGetSendersWithDtmf:()=>R,shimGetStats:()=>D,shimGetUserMedia:()=>y,shimMediaStream:()=>S,shimOnTrack:()=>d,shimPeerConnection:()=>O,shimSenderReceiverGetStats:()=>A});var l={};_.r(l),_.d(l,{shimGetDisplayMedia:()=>M,shimGetUserMedia:()=>W,shimPeerConnection:()=>N,shimReplaceTrack:()=>P});var m={};_.r(m),_.d(m,{shimAddTransceiver:()=>ue,shimCreateAnswer:()=>de,shimCreateOffer:()=>ce,shimGetDisplayMedia:()=>j,shimGetParameters:()=>se,shimGetUserMedia:()=>V,shimOnTrack:()=>z,shimPeerConnection:()=>G,shimRTCDataChannel:()=>oe,shimReceiverGetStats:()=>re,shimRemoveStream:()=>te,shimSenderGetStats:()=>X});var h={};_.r(h),_.d(h,{shimAudioContext:()=>Te,shimCallbacksAPI:()=>Ee,shimConstraints:()=>me,shimCreateOfferLegacy:()=>Re,shimGetUserMedia:()=>fe,shimLocalStreamsAPI:()=>pe,shimRTCIceServerUrls:()=>ge,shimRemoteStreamsAPI:()=>he,shimTrackEventTransceiver:()=>be});var v={};_.r(v),_.d(v,{removeExtmapAllowMixed:()=>Ie,shimAddIceCandidateNullOrEmpty:()=>ke,shimConnectionState:()=>Me,shimMaxMessageSize:()=>_e,shimRTCIceCandidate:()=>Ae,shimSendThrowTypeError:()=>xe});let u=!0,s=!0;function i(I,K,q){const Q=I.match(K);return Q&&Q.length>=q&&parseInt(Q[q],10)}function e(I,K,q){if(!I.RTCPeerConnection)return;const Q=I.RTCPeerConnection.prototype,Z=Q.addEventListener;Q.addEventListener=function(J,ie){if(J!==K)return Z.apply(this,arguments);const ne=ae=>{const le=q(ae);le&&(ie.handleEvent?ie.handleEvent(le):ie(le))};return this._eventMap=this._eventMap||{},this._eventMap[K]||(this._eventMap[K]=new Map),this._eventMap[K].set(ie,ne),Z.apply(this,[J,ne])};const ee=Q.removeEventListener;Q.removeEventListener=function(J,ie){if(J!==K||!this._eventMap||!this._eventMap[K])return ee.apply(this,arguments);if(!this._eventMap[K].has(ie))return ee.apply(this,arguments);const ne=this._eventMap[K].get(ie);return this._eventMap[K].delete(ie),this._eventMap[K].size===0&&delete this._eventMap[K],Object.keys(this._eventMap).length===0&&delete this._eventMap,ee.apply(this,[J,ne])},Object.defineProperty(Q,"on"+K,{get(){return this["_on"+K]},set(J){this["_on"+K]&&(this.removeEventListener(K,this["_on"+K]),delete this["_on"+K]),J&&this.addEventListener(K,this["_on"+K]=J)},enumerable:!0,configurable:!0})}function o(I){return typeof I!="boolean"?new Error("Argument type: "+typeof I+". Please use a boolean."):(u=I,I?"adapter.js logging disabled":"adapter.js logging enabled")}function r(I){return typeof I!="boolean"?new Error("Argument type: "+typeof I+". Please use a boolean."):(s=!I,"adapter.js deprecation warnings "+(I?"disabled":"enabled"))}function a(){if(typeof window=="object"){if(u)return;typeof console<"u"&&typeof console.log=="function"&&console.log.apply(console,arguments)}}function t(I,K){s&&console.warn(I+" is deprecated, please use "+K+" instead.")}function n(I){return Object.prototype.toString.call(I)==="[object Object]"}function c(I){return n(I)?Object.keys(I).reduce(function(K,q){const Q=n(I[q]),Z=Q?c(I[q]):I[q],ee=Q&&!Object.keys(Z).length;return Z===void 0||ee?K:Object.assign(K,{[q]:Z})},{}):I}function p(I,K,q){K&&!q.has(K.id)&&(q.set(K.id,K),Object.keys(K).forEach(Q=>{Q.endsWith("Id")?p(I,I.get(K[Q]),q):Q.endsWith("Ids")&&K[Q].forEach(Z=>{p(I,I.get(Z),q)})}))}function C(I,K,q){const Q=q?"outbound-rtp":"inbound-rtp",Z=new Map;if(K===null)return Z;const ee=[];return I.forEach(J=>{J.type==="track"&&J.trackIdentifier===K.id&&ee.push(J)}),ee.forEach(J=>{I.forEach(ie=>{ie.type===Q&&ie.trackId===J.id&&p(I,ie,Z)})}),Z}const x=a;function y(I,K){const q=I&&I.navigator;if(!q.mediaDevices)return;const Q=function(J){if(typeof J!="object"||J.mandatory||J.optional)return J;const ie={};return Object.keys(J).forEach(ne=>{if(ne==="require"||ne==="advanced"||ne==="mediaSource")return;const ae=typeof J[ne]=="object"?J[ne]:{ideal:J[ne]};ae.exact!==void 0&&typeof ae.exact=="number"&&(ae.min=ae.max=ae.exact);const le=function(ve,Ce){return ve?ve+Ce.charAt(0).toUpperCase()+Ce.slice(1):Ce==="deviceId"?"sourceId":Ce};if(ae.ideal!==void 0){ie.optional=ie.optional||[];let ve={};typeof ae.ideal=="number"?(ve[le("min",ne)]=ae.ideal,ie.optional.push(ve),ve={},ve[le("max",ne)]=ae.ideal,ie.optional.push(ve)):(ve[le("",ne)]=ae.ideal,ie.optional.push(ve))}ae.exact!==void 0&&typeof ae.exact!="number"?(ie.mandatory=ie.mandatory||{},ie.mandatory[le("",ne)]=ae.exact):["min","max"].forEach(ve=>{ae[ve]!==void 0&&(ie.mandatory=ie.mandatory||{},ie.mandatory[le(ve,ne)]=ae[ve])})}),J.advanced&&(ie.optional=(ie.optional||[]).concat(J.advanced)),ie},Z=function(J,ie){if(K.version>=61)return ie(J);if((J=JSON.parse(JSON.stringify(J)))&&typeof J.audio=="object"){const ne=function(ae,le,ve){le in ae&&!(ve in ae)&&(ae[ve]=ae[le],delete ae[le])};ne((J=JSON.parse(JSON.stringify(J))).audio,"autoGainControl","googAutoGainControl"),ne(J.audio,"noiseSuppression","googNoiseSuppression"),J.audio=Q(J.audio)}if(J&&typeof J.video=="object"){let ne=J.video.facingMode;ne=ne&&(typeof ne=="object"?ne:{ideal:ne});const ae=K.version<66;if(ne&&(ne.exact==="user"||ne.exact==="environment"||ne.ideal==="user"||ne.ideal==="environment")&&(!q.mediaDevices.getSupportedConstraints||!q.mediaDevices.getSupportedConstraints().facingMode||ae)){let le;if(delete J.video.facingMode,ne.exact==="environment"||ne.ideal==="environment"?le=["back","rear"]:ne.exact!=="user"&&ne.ideal!=="user"||(le=["front"]),le)return q.mediaDevices.enumerateDevices().then(ve=>{let Ce=(ve=ve.filter(We=>We.kind==="videoinput")).find(We=>le.some(Fe=>We.label.toLowerCase().includes(Fe)));return!Ce&&ve.length&&le.includes("back")&&(Ce=ve[ve.length-1]),Ce&&(J.video.deviceId=ne.exact?{exact:Ce.deviceId}:{ideal:Ce.deviceId}),J.video=Q(J.video),x("chrome: "+JSON.stringify(J)),ie(J)})}J.video=Q(J.video)}return x("chrome: "+JSON.stringify(J)),ie(J)},ee=function(J){return K.version>=64?J:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[J.name]||J.name,message:J.message,constraint:J.constraint||J.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(q.getUserMedia=function(J,ie,ne){Z(J,ae=>{q.webkitGetUserMedia(ae,ie,le=>{ne&&ne(ee(le))})})}.bind(q),q.mediaDevices.getUserMedia){const J=q.mediaDevices.getUserMedia.bind(q.mediaDevices);q.mediaDevices.getUserMedia=function(ie){return Z(ie,ne=>J(ne).then(ae=>{if(ne.audio&&!ae.getAudioTracks().length||ne.video&&!ae.getVideoTracks().length)throw ae.getTracks().forEach(le=>{le.stop()}),new DOMException("","NotFoundError");return ae},ae=>Promise.reject(ee(ae))))}}}function E(I,K){I.navigator.mediaDevices&&"getDisplayMedia"in I.navigator.mediaDevices||I.navigator.mediaDevices&&(typeof K=="function"?I.navigator.mediaDevices.getDisplayMedia=function(q){return K(q).then(Q=>{const Z=q.video&&q.video.width,ee=q.video&&q.video.height,J=q.video&&q.video.frameRate;return q.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:Q,maxFrameRate:J||3}},Z&&(q.video.mandatory.maxWidth=Z),ee&&(q.video.mandatory.maxHeight=ee),I.navigator.mediaDevices.getUserMedia(q)})}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}function S(I){I.MediaStream=I.MediaStream||I.webkitMediaStream}function d(I){if(typeof I=="object"&&I.RTCPeerConnection&&!("ontrack"in I.RTCPeerConnection.prototype)){Object.defineProperty(I.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(q){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=q)},enumerable:!0,configurable:!0});const K=I.RTCPeerConnection.prototype.setRemoteDescription;I.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=q=>{q.stream.addEventListener("addtrack",Q=>{let Z;Z=I.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(J=>J.track&&J.track.id===Q.track.id):{track:Q.track};const ee=new Event("track");ee.track=Q.track,ee.receiver=Z,ee.transceiver={receiver:Z},ee.streams=[q.stream],this.dispatchEvent(ee)}),q.stream.getTracks().forEach(Q=>{let Z;Z=I.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(J=>J.track&&J.track.id===Q.id):{track:Q};const ee=new Event("track");ee.track=Q,ee.receiver=Z,ee.transceiver={receiver:Z},ee.streams=[q.stream],this.dispatchEvent(ee)})},this.addEventListener("addstream",this._ontrackpoly)),K.apply(this,arguments)}}else e(I,"track",K=>(K.transceiver||Object.defineProperty(K,"transceiver",{value:{receiver:K.receiver}}),K))}function R(I){if(typeof I=="object"&&I.RTCPeerConnection&&!("getSenders"in I.RTCPeerConnection.prototype)&&"createDTMFSender"in I.RTCPeerConnection.prototype){const K=function(Z,ee){return{track:ee,get dtmf(){return this._dtmf===void 0&&(ee.kind==="audio"?this._dtmf=Z.createDTMFSender(ee):this._dtmf=null),this._dtmf},_pc:Z}};if(!I.RTCPeerConnection.prototype.getSenders){I.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const Z=I.RTCPeerConnection.prototype.addTrack;I.RTCPeerConnection.prototype.addTrack=function(J,ie){let ne=Z.apply(this,arguments);return ne||(ne=K(this,J),this._senders.push(ne)),ne};const ee=I.RTCPeerConnection.prototype.removeTrack;I.RTCPeerConnection.prototype.removeTrack=function(J){ee.apply(this,arguments);const ie=this._senders.indexOf(J);ie!==-1&&this._senders.splice(ie,1)}}const q=I.RTCPeerConnection.prototype.addStream;I.RTCPeerConnection.prototype.addStream=function(Z){this._senders=this._senders||[],q.apply(this,[Z]),Z.getTracks().forEach(ee=>{this._senders.push(K(this,ee))})};const Q=I.RTCPeerConnection.prototype.removeStream;I.RTCPeerConnection.prototype.removeStream=function(Z){this._senders=this._senders||[],Q.apply(this,[Z]),Z.getTracks().forEach(ee=>{const J=this._senders.find(ie=>ie.track===ee);J&&this._senders.splice(this._senders.indexOf(J),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 K=I.RTCPeerConnection.prototype.getSenders;I.RTCPeerConnection.prototype.getSenders=function(){const q=K.apply(this,[]);return q.forEach(Q=>Q._pc=this),q},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 D(I){if(!I.RTCPeerConnection)return;const K=I.RTCPeerConnection.prototype.getStats;I.RTCPeerConnection.prototype.getStats=function(){const[q,Q,Z]=arguments;if(arguments.length>0&&typeof q=="function")return K.apply(this,arguments);if(K.length===0&&(arguments.length===0||typeof q!="function"))return K.apply(this,[]);const ee=function(ie){const ne={};return ie.result().forEach(ae=>{const le={id:ae.id,timestamp:ae.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[ae.type]||ae.type};ae.names().forEach(ve=>{le[ve]=ae.stat(ve)}),ne[le.id]=le}),ne},J=function(ie){return new Map(Object.keys(ie).map(ne=>[ne,ie[ne]]))};if(arguments.length>=2){const ie=function(ne){Q(J(ee(ne)))};return K.apply(this,[ie,q])}return new Promise((ie,ne)=>{K.apply(this,[function(ae){ie(J(ee(ae)))},ne])}).then(Q,Z)}}function A(I){if(!(typeof I=="object"&&I.RTCPeerConnection&&I.RTCRtpSender&&I.RTCRtpReceiver))return;if(!("getStats"in I.RTCRtpSender.prototype)){const q=I.RTCPeerConnection.prototype.getSenders;q&&(I.RTCPeerConnection.prototype.getSenders=function(){const Z=q.apply(this,[]);return Z.forEach(ee=>ee._pc=this),Z});const Q=I.RTCPeerConnection.prototype.addTrack;Q&&(I.RTCPeerConnection.prototype.addTrack=function(){const Z=Q.apply(this,arguments);return Z._pc=this,Z}),I.RTCRtpSender.prototype.getStats=function(){const Z=this;return this._pc.getStats().then(ee=>C(ee,Z.track,!0))}}if(!("getStats"in I.RTCRtpReceiver.prototype)){const q=I.RTCPeerConnection.prototype.getReceivers;q&&(I.RTCPeerConnection.prototype.getReceivers=function(){const Q=q.apply(this,[]);return Q.forEach(Z=>Z._pc=this),Q}),e(I,"track",Q=>(Q.receiver._pc=Q.srcElement,Q)),I.RTCRtpReceiver.prototype.getStats=function(){const Q=this;return this._pc.getStats().then(Z=>C(Z,Q.track,!1))}}if(!("getStats"in I.RTCRtpSender.prototype)||!("getStats"in I.RTCRtpReceiver.prototype))return;const K=I.RTCPeerConnection.prototype.getStats;I.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof I.MediaStreamTrack){const q=arguments[0];let Q,Z,ee;return this.getSenders().forEach(J=>{J.track===q&&(Q?ee=!0:Q=J)}),this.getReceivers().forEach(J=>(J.track===q&&(Z?ee=!0:Z=J),J.track===q)),ee||Q&&Z?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):Q?Q.getStats():Z?Z.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return K.apply(this,arguments)}}function b(I){I.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(ee=>this._shimmedLocalStreams[ee][0])};const K=I.RTCPeerConnection.prototype.addTrack;I.RTCPeerConnection.prototype.addTrack=function(ee,J){if(!J)return K.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const ie=K.apply(this,arguments);return this._shimmedLocalStreams[J.id]?this._shimmedLocalStreams[J.id].indexOf(ie)===-1&&this._shimmedLocalStreams[J.id].push(ie):this._shimmedLocalStreams[J.id]=[J,ie],ie};const q=I.RTCPeerConnection.prototype.addStream;I.RTCPeerConnection.prototype.addStream=function(ee){this._shimmedLocalStreams=this._shimmedLocalStreams||{},ee.getTracks().forEach(ne=>{if(this.getSenders().find(ae=>ae.track===ne))throw new DOMException("Track already exists.","InvalidAccessError")});const J=this.getSenders();q.apply(this,arguments);const ie=this.getSenders().filter(ne=>J.indexOf(ne)===-1);this._shimmedLocalStreams[ee.id]=[ee].concat(ie)};const Q=I.RTCPeerConnection.prototype.removeStream;I.RTCPeerConnection.prototype.removeStream=function(ee){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[ee.id],Q.apply(this,arguments)};const Z=I.RTCPeerConnection.prototype.removeTrack;I.RTCPeerConnection.prototype.removeTrack=function(ee){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},ee&&Object.keys(this._shimmedLocalStreams).forEach(J=>{const ie=this._shimmedLocalStreams[J].indexOf(ee);ie!==-1&&this._shimmedLocalStreams[J].splice(ie,1),this._shimmedLocalStreams[J].length===1&&delete this._shimmedLocalStreams[J]}),Z.apply(this,arguments)}}function g(I,K){if(!I.RTCPeerConnection)return;if(I.RTCPeerConnection.prototype.addTrack&&K.version>=65)return b(I);const q=I.RTCPeerConnection.prototype.getLocalStreams;I.RTCPeerConnection.prototype.getLocalStreams=function(){const ne=q.apply(this);return this._reverseStreams=this._reverseStreams||{},ne.map(ae=>this._reverseStreams[ae.id])};const Q=I.RTCPeerConnection.prototype.addStream;I.RTCPeerConnection.prototype.addStream=function(ne){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},ne.getTracks().forEach(ae=>{if(this.getSenders().find(le=>le.track===ae))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[ne.id]){const ae=new I.MediaStream(ne.getTracks());this._streams[ne.id]=ae,this._reverseStreams[ae.id]=ne,ne=ae}Q.apply(this,[ne])};const Z=I.RTCPeerConnection.prototype.removeStream;function ee(ne,ae){let le=ae.sdp;return Object.keys(ne._reverseStreams||[]).forEach(ve=>{const Ce=ne._reverseStreams[ve],We=ne._streams[Ce.id];le=le.replace(new RegExp(We.id,"g"),Ce.id)}),new RTCSessionDescription({type:ae.type,sdp:le})}I.RTCPeerConnection.prototype.removeStream=function(ne){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},Z.apply(this,[this._streams[ne.id]||ne]),delete this._reverseStreams[this._streams[ne.id]?this._streams[ne.id].id:ne.id],delete this._streams[ne.id]},I.RTCPeerConnection.prototype.addTrack=function(ne,ae){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const le=[].slice.call(arguments,1);if(le.length!==1||!le[0].getTracks().find(Ce=>Ce===ne))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(Ce=>Ce.track===ne))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const ve=this._streams[ae.id];if(ve)ve.addTrack(ne),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const Ce=new I.MediaStream([ne]);this._streams[ae.id]=Ce,this._reverseStreams[Ce.id]=ae,this.addStream(Ce)}return this.getSenders().find(Ce=>Ce.track===ne)},["createOffer","createAnswer"].forEach(function(ne){const ae=I.RTCPeerConnection.prototype[ne],le={[ne](){const ve=arguments;return arguments.length&&typeof arguments[0]=="function"?ae.apply(this,[Ce=>{const We=ee(this,Ce);ve[0].apply(null,[We])},Ce=>{ve[1]&&ve[1].apply(null,Ce)},arguments[2]]):ae.apply(this,arguments).then(Ce=>ee(this,Ce))}};I.RTCPeerConnection.prototype[ne]=le[ne]});const J=I.RTCPeerConnection.prototype.setLocalDescription;I.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=function(ne,ae){let le=ae.sdp;return Object.keys(ne._reverseStreams||[]).forEach(ve=>{const Ce=ne._reverseStreams[ve],We=ne._streams[Ce.id];le=le.replace(new RegExp(Ce.id,"g"),We.id)}),new RTCSessionDescription({type:ae.type,sdp:le})}(this,arguments[0]),J.apply(this,arguments)):J.apply(this,arguments)};const ie=Object.getOwnPropertyDescriptor(I.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(I.RTCPeerConnection.prototype,"localDescription",{get(){const ne=ie.get.apply(this);return ne.type===""?ne:ee(this,ne)}}),I.RTCPeerConnection.prototype.removeTrack=function(ne){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!ne._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(ne._pc!==this)throw new DOMException("Sender was not created by this connection.","InvalidAccessError");let ae;this._streams=this._streams||{},Object.keys(this._streams).forEach(le=>{this._streams[le].getTracks().find(ve=>ne.track===ve)&&(ae=this._streams[le])}),ae&&(ae.getTracks().length===1?this.removeStream(this._reverseStreams[ae.id]):ae.removeTrack(ne.track),this.dispatchEvent(new Event("negotiationneeded")))}}function O(I,K){!I.RTCPeerConnection&&I.webkitRTCPeerConnection&&(I.RTCPeerConnection=I.webkitRTCPeerConnection),I.RTCPeerConnection&&K.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(q){const Q=I.RTCPeerConnection.prototype[q],Z={[q](){return arguments[0]=new(q==="addIceCandidate"?I.RTCIceCandidate:I.RTCSessionDescription)(arguments[0]),Q.apply(this,arguments)}};I.RTCPeerConnection.prototype[q]=Z[q]})}function k(I,K){e(I,"negotiationneeded",q=>{const Q=q.target;if(!(K.version<72||Q.getConfiguration&&Q.getConfiguration().sdpSemantics==="plan-b")||Q.signalingState==="stable")return q})}var U=_(6677),w=_.n(U);function W(I){const K=I&&I.navigator,q=K.mediaDevices.getUserMedia.bind(K.mediaDevices);K.mediaDevices.getUserMedia=function(Q){return q(Q).catch(Z=>Promise.reject(function(ee){return{name:{PermissionDeniedError:"NotAllowedError"}[ee.name]||ee.name,message:ee.message,constraint:ee.constraint,toString(){return this.name}}}(Z)))}}function M(I){"getDisplayMedia"in I.navigator&&I.navigator.mediaDevices&&(I.navigator.mediaDevices&&"getDisplayMedia"in I.navigator.mediaDevices||(I.navigator.mediaDevices.getDisplayMedia=I.navigator.getDisplayMedia.bind(I.navigator)))}function N(I,K){if(I.RTCIceGatherer&&(I.RTCIceCandidate||(I.RTCIceCandidate=function(Q){return Q}),I.RTCSessionDescription||(I.RTCSessionDescription=function(Q){return Q}),K.version<15025)){const Q=Object.getOwnPropertyDescriptor(I.MediaStreamTrack.prototype,"enabled");Object.defineProperty(I.MediaStreamTrack.prototype,"enabled",{set(Z){Q.set.call(this,Z);const ee=new Event("enabled");ee.enabled=Z,this.dispatchEvent(ee)}})}I.RTCRtpSender&&!("dtmf"in I.RTCRtpSender.prototype)&&Object.defineProperty(I.RTCRtpSender.prototype,"dtmf",{get(){return this._dtmf===void 0&&(this.track.kind==="audio"?this._dtmf=new I.RTCDtmfSender(this):this.track.kind==="video"&&(this._dtmf=null)),this._dtmf}}),I.RTCDtmfSender&&!I.RTCDTMFSender&&(I.RTCDTMFSender=I.RTCDtmfSender);const q=w()(I,K.version);I.RTCPeerConnection=function(Q){return Q&&Q.iceServers&&(Q.iceServers=function(Z){let ee=!1;return(Z=JSON.parse(JSON.stringify(Z))).filter(J=>{if(J&&(J.urls||J.url)){let ie=J.urls||J.url;J.url&&!J.urls&&t("RTCIceServer.url","RTCIceServer.urls");const ne=typeof ie=="string";return ne&&(ie=[ie]),ie=ie.filter(ae=>{if(ae.indexOf("stun:")===0)return!1;const le=ae.startsWith("turn")&&!ae.startsWith("turn:[")&&ae.includes("transport=udp");return le&&!ee?(ee=!0,!0):le&&!ee}),delete J.url,J.urls=ne?ie[0]:ie,!!ie.length}})}(Q.iceServers,K.version),a("ICE servers after filtering:",Q.iceServers)),new q(Q)},I.RTCPeerConnection.prototype=q.prototype}function P(I){I.RTCRtpSender&&!("replaceTrack"in I.RTCRtpSender.prototype)&&(I.RTCRtpSender.prototype.replaceTrack=I.RTCRtpSender.prototype.setTrack)}function V(I,K){const q=I&&I.navigator,Q=I&&I.MediaStreamTrack;if(q.getUserMedia=function(Z,ee,J){t("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),q.mediaDevices.getUserMedia(Z).then(ee,J)},!(K.version>55&&"autoGainControl"in q.mediaDevices.getSupportedConstraints())){const Z=function(J,ie,ne){ie in J&&!(ne in J)&&(J[ne]=J[ie],delete J[ie])},ee=q.mediaDevices.getUserMedia.bind(q.mediaDevices);if(q.mediaDevices.getUserMedia=function(J){return typeof J=="object"&&typeof J.audio=="object"&&(J=JSON.parse(JSON.stringify(J)),Z(J.audio,"autoGainControl","mozAutoGainControl"),Z(J.audio,"noiseSuppression","mozNoiseSuppression")),ee(J)},Q&&Q.prototype.getSettings){const J=Q.prototype.getSettings;Q.prototype.getSettings=function(){const ie=J.apply(this,arguments);return Z(ie,"mozAutoGainControl","autoGainControl"),Z(ie,"mozNoiseSuppression","noiseSuppression"),ie}}if(Q&&Q.prototype.applyConstraints){const J=Q.prototype.applyConstraints;Q.prototype.applyConstraints=function(ie){return this.kind==="audio"&&typeof ie=="object"&&(ie=JSON.parse(JSON.stringify(ie)),Z(ie,"autoGainControl","mozAutoGainControl"),Z(ie,"noiseSuppression","mozNoiseSuppression")),J.apply(this,[ie])}}}}function j(I,K){I.navigator.mediaDevices&&"getDisplayMedia"in I.navigator.mediaDevices||I.navigator.mediaDevices&&(I.navigator.mediaDevices.getDisplayMedia=function(q){if(!q||!q.video){const Q=new DOMException("getDisplayMedia without video constraints is undefined");return Q.name="NotFoundError",Q.code=8,Promise.reject(Q)}return q.video===!0?q.video={mediaSource:K}:q.video.mediaSource=K,I.navigator.mediaDevices.getUserMedia(q)})}function z(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 G(I,K){if(typeof I!="object"||!I.RTCPeerConnection&&!I.mozRTCPeerConnection)return;!I.RTCPeerConnection&&I.mozRTCPeerConnection&&(I.RTCPeerConnection=I.mozRTCPeerConnection),K.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(Z){const ee=I.RTCPeerConnection.prototype[Z],J={[Z](){return arguments[0]=new(Z==="addIceCandidate"?I.RTCIceCandidate:I.RTCSessionDescription)(arguments[0]),ee.apply(this,arguments)}};I.RTCPeerConnection.prototype[Z]=J[Z]});const q={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},Q=I.RTCPeerConnection.prototype.getStats;I.RTCPeerConnection.prototype.getStats=function(){const[Z,ee,J]=arguments;return Q.apply(this,[Z||null]).then(ie=>{if(K.version<53&&!ee)try{ie.forEach(ne=>{ne.type=q[ne.type]||ne.type})}catch(ne){if(ne.name!=="TypeError")throw ne;ie.forEach((ae,le)=>{ie.set(le,Object.assign({},ae,{type:q[ae.type]||ae.type}))})}return ie}).then(ee,J)}}function X(I){if(typeof I!="object"||!I.RTCPeerConnection||!I.RTCRtpSender||I.RTCRtpSender&&"getStats"in I.RTCRtpSender.prototype)return;const K=I.RTCPeerConnection.prototype.getSenders;K&&(I.RTCPeerConnection.prototype.getSenders=function(){const Q=K.apply(this,[]);return Q.forEach(Z=>Z._pc=this),Q});const q=I.RTCPeerConnection.prototype.addTrack;q&&(I.RTCPeerConnection.prototype.addTrack=function(){const Q=q.apply(this,arguments);return Q._pc=this,Q}),I.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function re(I){if(typeof I!="object"||!I.RTCPeerConnection||!I.RTCRtpSender||I.RTCRtpSender&&"getStats"in I.RTCRtpReceiver.prototype)return;const K=I.RTCPeerConnection.prototype.getReceivers;K&&(I.RTCPeerConnection.prototype.getReceivers=function(){const q=K.apply(this,[]);return q.forEach(Q=>Q._pc=this),q}),e(I,"track",q=>(q.receiver._pc=q.srcElement,q)),I.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function te(I){I.RTCPeerConnection&&!("removeStream"in I.RTCPeerConnection.prototype)&&(I.RTCPeerConnection.prototype.removeStream=function(K){t("removeStream","removeTrack"),this.getSenders().forEach(q=>{q.track&&K.getTracks().includes(q.track)&&this.removeTrack(q)})})}function oe(I){I.DataChannel&&!I.RTCDataChannel&&(I.RTCDataChannel=I.DataChannel)}function ue(I){if(typeof I!="object"||!I.RTCPeerConnection)return;const K=I.RTCPeerConnection.prototype.addTransceiver;K&&(I.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];const q=arguments[1],Q=q&&"sendEncodings"in q;Q&&q.sendEncodings.forEach(ee=>{if("rid"in ee&&!/^[a-z0-9]{0,16}$/i.test(ee.rid))throw new TypeError("Invalid RID value provided.");if("scaleResolutionDownBy"in ee&&!(parseFloat(ee.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in ee&&!(parseFloat(ee.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")});const Z=K.apply(this,arguments);if(Q){const{sender:ee}=Z,J=ee.getParameters();(!("encodings"in J)||J.encodings.length===1&&Object.keys(J.encodings[0]).length===0)&&(J.encodings=q.sendEncodings,ee.sendEncodings=q.sendEncodings,this.setParametersPromises.push(ee.setParameters(J).then(()=>{delete ee.sendEncodings}).catch(()=>{delete ee.sendEncodings})))}return Z})}function se(I){if(typeof I!="object"||!I.RTCRtpSender)return;const K=I.RTCRtpSender.prototype.getParameters;K&&(I.RTCRtpSender.prototype.getParameters=function(){const q=K.apply(this,arguments);return"encodings"in q||(q.encodings=[].concat(this.sendEncodings||[{}])),q})}function ce(I){if(typeof I!="object"||!I.RTCPeerConnection)return;const K=I.RTCPeerConnection.prototype.createOffer;I.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>K.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):K.apply(this,arguments)}}function de(I){if(typeof I!="object"||!I.RTCPeerConnection)return;const K=I.RTCPeerConnection.prototype.createAnswer;I.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>K.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):K.apply(this,arguments)}}function pe(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 K=I.RTCPeerConnection.prototype.addTrack;I.RTCPeerConnection.prototype.addStream=function(q){this._localStreams||(this._localStreams=[]),this._localStreams.includes(q)||this._localStreams.push(q),q.getAudioTracks().forEach(Q=>K.call(this,Q,q)),q.getVideoTracks().forEach(Q=>K.call(this,Q,q))},I.RTCPeerConnection.prototype.addTrack=function(q,...Q){return Q&&Q.forEach(Z=>{this._localStreams?this._localStreams.includes(Z)||this._localStreams.push(Z):this._localStreams=[Z]}),K.apply(this,arguments)}}"removeStream"in I.RTCPeerConnection.prototype||(I.RTCPeerConnection.prototype.removeStream=function(K){this._localStreams||(this._localStreams=[]);const q=this._localStreams.indexOf(K);if(q===-1)return;this._localStreams.splice(q,1);const Q=K.getTracks();this.getSenders().forEach(Z=>{Q.includes(Z.track)&&this.removeTrack(Z)})})}}function he(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(q){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=q),this.addEventListener("track",this._onaddstreampoly=Q=>{Q.streams.forEach(Z=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(Z))return;this._remoteStreams.push(Z);const ee=new Event("addstream");ee.stream=Z,this.dispatchEvent(ee)})})}});const K=I.RTCPeerConnection.prototype.setRemoteDescription;I.RTCPeerConnection.prototype.setRemoteDescription=function(){const q=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(Q){Q.streams.forEach(Z=>{if(q._remoteStreams||(q._remoteStreams=[]),q._remoteStreams.indexOf(Z)>=0)return;q._remoteStreams.push(Z);const ee=new Event("addstream");ee.stream=Z,q.dispatchEvent(ee)})}),K.apply(q,arguments)}}}function Ee(I){if(typeof I!="object"||!I.RTCPeerConnection)return;const K=I.RTCPeerConnection.prototype,q=K.createOffer,Q=K.createAnswer,Z=K.setLocalDescription,ee=K.setRemoteDescription,J=K.addIceCandidate;K.createOffer=function(ne,ae){const le=arguments.length>=2?arguments[2]:arguments[0],ve=q.apply(this,[le]);return ae?(ve.then(ne,ae),Promise.resolve()):ve},K.createAnswer=function(ne,ae){const le=arguments.length>=2?arguments[2]:arguments[0],ve=Q.apply(this,[le]);return ae?(ve.then(ne,ae),Promise.resolve()):ve};let ie=function(ne,ae,le){const ve=Z.apply(this,[ne]);return le?(ve.then(ae,le),Promise.resolve()):ve};K.setLocalDescription=ie,ie=function(ne,ae,le){const ve=ee.apply(this,[ne]);return le?(ve.then(ae,le),Promise.resolve()):ve},K.setRemoteDescription=ie,ie=function(ne,ae,le){const ve=J.apply(this,[ne]);return le?(ve.then(ae,le),Promise.resolve()):ve},K.addIceCandidate=ie}function fe(I){const K=I&&I.navigator;if(K.mediaDevices&&K.mediaDevices.getUserMedia){const q=K.mediaDevices,Q=q.getUserMedia.bind(q);K.mediaDevices.getUserMedia=Z=>Q(me(Z))}!K.getUserMedia&&K.mediaDevices&&K.mediaDevices.getUserMedia&&(K.getUserMedia=function(q,Q,Z){K.mediaDevices.getUserMedia(q).then(Q,Z)}.bind(K))}function me(I){return I&&I.video!==void 0?Object.assign({},I,{video:c(I.video)}):I}function ge(I){if(!I.RTCPeerConnection)return;const K=I.RTCPeerConnection;I.RTCPeerConnection=function(q,Q){if(q&&q.iceServers){const Z=[];for(let ee=0;ee<q.iceServers.length;ee++){let J=q.iceServers[ee];!J.hasOwnProperty("urls")&&J.hasOwnProperty("url")?(t("RTCIceServer.url","RTCIceServer.urls"),J=JSON.parse(JSON.stringify(J)),J.urls=J.url,delete J.url,Z.push(J)):Z.push(q.iceServers[ee])}q.iceServers=Z}return new K(q,Q)},I.RTCPeerConnection.prototype=K.prototype,"generateCertificate"in K&&Object.defineProperty(I.RTCPeerConnection,"generateCertificate",{get:()=>K.generateCertificate})}function be(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 Re(I){const K=I.RTCPeerConnection.prototype.createOffer;I.RTCPeerConnection.prototype.createOffer=function(q){if(q){q.offerToReceiveAudio!==void 0&&(q.offerToReceiveAudio=!!q.offerToReceiveAudio);const Q=this.getTransceivers().find(ee=>ee.receiver.track.kind==="audio");q.offerToReceiveAudio===!1&&Q?Q.direction==="sendrecv"?Q.setDirection?Q.setDirection("sendonly"):Q.direction="sendonly":Q.direction==="recvonly"&&(Q.setDirection?Q.setDirection("inactive"):Q.direction="inactive"):q.offerToReceiveAudio!==!0||Q||this.addTransceiver("audio"),q.offerToReceiveVideo!==void 0&&(q.offerToReceiveVideo=!!q.offerToReceiveVideo);const Z=this.getTransceivers().find(ee=>ee.receiver.track.kind==="video");q.offerToReceiveVideo===!1&&Z?Z.direction==="sendrecv"?Z.setDirection?Z.setDirection("sendonly"):Z.direction="sendonly":Z.direction==="recvonly"&&(Z.setDirection?Z.setDirection("inactive"):Z.direction="inactive"):q.offerToReceiveVideo!==!0||Z||this.addTransceiver("video")}return K.apply(this,arguments)}}function Te(I){typeof I!="object"||I.AudioContext||(I.AudioContext=I.webkitAudioContext)}var Pe=_(7963),Oe=_.n(Pe);function Ae(I){if(!I.RTCIceCandidate||I.RTCIceCandidate&&"foundation"in I.RTCIceCandidate.prototype)return;const K=I.RTCIceCandidate;I.RTCIceCandidate=function(q){if(typeof q=="object"&&q.candidate&&q.candidate.indexOf("a=")===0&&((q=JSON.parse(JSON.stringify(q))).candidate=q.candidate.substr(2)),q.candidate&&q.candidate.length){const Q=new K(q),Z=Oe().parseCandidate(q.candidate),ee=Object.assign(Q,Z);return ee.toJSON=function(){return{candidate:ee.candidate,sdpMid:ee.sdpMid,sdpMLineIndex:ee.sdpMLineIndex,usernameFragment:ee.usernameFragment}},ee}return new K(q)},I.RTCIceCandidate.prototype=K.prototype,e(I,"icecandidate",q=>(q.candidate&&Object.defineProperty(q,"candidate",{value:new I.RTCIceCandidate(q.candidate),writable:"false"}),q))}function _e(I,K){if(!I.RTCPeerConnection)return;"sctp"in I.RTCPeerConnection.prototype||Object.defineProperty(I.RTCPeerConnection.prototype,"sctp",{get(){return this._sctp===void 0?null:this._sctp}});const q=I.RTCPeerConnection.prototype.setRemoteDescription;I.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,K.browser==="chrome"&&K.version>=76){const{sdpSemantics:Q}=this.getConfiguration();Q==="plan-b"&&Object.defineProperty(this,"sctp",{get(){return this._sctp===void 0?null:this._sctp},enumerable:!0,configurable:!0})}if(function(Q){if(!Q||!Q.sdp)return!1;const Z=Oe().splitSections(Q.sdp);return Z.shift(),Z.some(ee=>{const J=Oe().parseMLine(ee);return J&&J.kind==="application"&&J.protocol.indexOf("SCTP")!==-1})}(arguments[0])){const Q=function(ne){const ae=ne.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(ae===null||ae.length<2)return-1;const le=parseInt(ae[1],10);return le!=le?-1:le}(arguments[0]),Z=function(ne){let ae=65536;return K.browser==="firefox"&&(ae=K.version<57?ne===-1?16384:2147483637:K.version<60?K.version===57?65535:65536:2147483637),ae}(Q),ee=function(ne,ae){let le=65536;K.browser==="firefox"&&K.version===57&&(le=65535);const ve=Oe().matchPrefix(ne.sdp,"a=max-message-size:");return ve.length>0?le=parseInt(ve[0].substr(19),10):K.browser==="firefox"&&ae!==-1&&(le=2147483637),le}(arguments[0],Q);let J;J=Z===0&&ee===0?Number.POSITIVE_INFINITY:Z===0||ee===0?Math.max(Z,ee):Math.min(Z,ee);const ie={};Object.defineProperty(ie,"maxMessageSize",{get:()=>J}),this._sctp=ie}return q.apply(this,arguments)}}function xe(I){if(!I.RTCPeerConnection||!("createDataChannel"in I.RTCPeerConnection.prototype))return;function K(Q,Z){const ee=Q.send;Q.send=function(){const J=arguments[0],ie=J.length||J.size||J.byteLength;if(Q.readyState==="open"&&Z.sctp&&ie>Z.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+Z.sctp.maxMessageSize+" bytes)");return ee.apply(Q,arguments)}}const q=I.RTCPeerConnection.prototype.createDataChannel;I.RTCPeerConnection.prototype.createDataChannel=function(){const Q=q.apply(this,arguments);return K(Q,this),Q},e(I,"datachannel",Q=>(K(Q.channel,Q.target),Q))}function Me(I){if(!I.RTCPeerConnection||"connectionState"in I.RTCPeerConnection.prototype)return;const K=I.RTCPeerConnection.prototype;Object.defineProperty(K,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(K,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(q){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),q&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=q)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(q=>{const Q=K[q];K[q]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=Z=>{const ee=Z.target;if(ee._lastConnectionState!==ee.connectionState){ee._lastConnectionState=ee.connectionState;const J=new Event("connectionstatechange",Z);ee.dispatchEvent(J)}return Z},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),Q.apply(this,arguments)}})}function Ie(I,K){if(!I.RTCPeerConnection||K.browser==="chrome"&&K.version>=71||K.browser==="safari"&&K.version>=605)return;const q=I.RTCPeerConnection.prototype.setRemoteDescription;I.RTCPeerConnection.prototype.setRemoteDescription=function(Q){if(Q&&Q.sdp&&Q.sdp.indexOf(`
160
+ a=extmap-allow-mixed`)!==-1){const Z=Q.sdp.split(`
161
161
  `).filter(ee=>ee.trim()!=="a=extmap-allow-mixed").join(`
162
- `);I.RTCSessionDescription&&X instanceof I.RTCSessionDescription?arguments[0]=new I.RTCSessionDescription({type:X.type,sdp:Z}):X.sdp=Z}return q.apply(this,arguments)}}function ke(I,K){if(!I.RTCPeerConnection||!I.RTCPeerConnection.prototype)return;const q=I.RTCPeerConnection.prototype.addIceCandidate;q&&q.length!==0&&(I.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?(K.browser==="chrome"&&K.version<78||K.browser==="firefox"&&K.version<68||K.browser==="safari")&&arguments[0]&&arguments[0].candidate===""?Promise.resolve():q.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}const Ue=function({window:I}={},K={shimChrome:!0,shimFirefox:!0,shimEdge:!0,shimSafari:!0}){const q=o,X=function(ee){const $={browser:null,version:null};if(ee===void 0||!ee.navigator)return $.browser="Not a browser.",$;const{navigator:oe}=ee;if(oe.mozGetUserMedia)$.browser="firefox",$.version=a(oe.userAgent,/Firefox\/(\d+)\./,1);else if(oe.webkitGetUserMedia||ee.isSecureContext===!1&&ee.webkitRTCPeerConnection&&!ee.RTCIceGatherer)$.browser="chrome",$.version=a(oe.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(oe.mediaDevices&&oe.userAgent.match(/Edge\/(\d+).(\d+)$/))$.browser="edge",$.version=a(oe.userAgent,/Edge\/(\d+).(\d+)$/,2);else{if(!ee.RTCPeerConnection||!oe.userAgent.match(/AppleWebKit\/(\d+)\./))return $.browser="Not a supported browser.",$;$.browser="safari",$.version=a(oe.userAgent,/AppleWebKit\/(\d+)\./,1),$.supportsUnifiedPlan=ee.RTCRtpTransceiver&&"currentDirection"in ee.RTCRtpTransceiver.prototype}return $}(I),Z={browserDetails:X,commonShim:v,extractVersion:a,disableLog:r,disableWarnings:i};switch(X.browser){case"chrome":if(!m||!O||!K.shimChrome)return q("Chrome shim is not included in this adapter release."),Z;if(X.version===null)return q("Chrome shim can not determine version, not shimming."),Z;q("adapter.js shimming chrome."),Z.browserShim=m,ke(I,X),E(I,X),b(I),O(I,X),l(I),D(I,X),A(I),R(I),C(I),U(I,X),De(I),Me(I),Ce(I,X),Oe(I),Pe(I,X);break;case"firefox":if(!f||!G||!K.shimFirefox)return q("Firefox shim is not included in this adapter release."),Z;q("adapter.js shimming firefox."),Z.browserShim=f,ke(I,X),B(I,X),G(I,X),z(I),te(I),J(I),re(I),ie(I),ce(I),se(I),ue(I),pe(I),De(I),Me(I),Ce(I,X),Oe(I);break;case"edge":if(!d||!F||!K.shimEdge)return q("MS edge shim is not included in this adapter release."),Z;q("adapter.js shimming edge."),Z.browserShim=d,N(I),H(I),F(I,X),P(I),Ce(I,X),Oe(I);break;case"safari":if(!y||!K.shimSafari)return q("Safari shim is not included in this adapter release."),Z;q("adapter.js shimming safari."),Z.browserShim=y,ke(I,X),ge(I),Re(I),Ee(I),de(I),ve(I),be(I),fe(I),Te(I),De(I),Ce(I,X),Oe(I),Pe(I,X);break;default:q("Unsupported browser!")}return Z}({window:typeof window>"u"?void 0:window}),Ae=Ue},6834:(j,T,_)=>{_.r(T),_.d(T,{default:()=>f});var m=_(5512),d=_.n(m);function f(){return d()('/*! aliyun rts sdk - ver2.13.0 created:2025/7/24 20:19:04 */(()=>{"use strict";var e={28:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.default={version:"2.13.0",protocol_version:2,sdk_version:"0.0.1"}},917:(e,t)=>{var r,o,n,i;Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_RETRY_DATACHANNEL_TIMEOUT=t.DEFAULT_HEARTBEAT_TIMEOUT=t.DEFAULT_RETRY_PUBLISH_INTERVAL=t.DEFAULT_RETRY_SUBSCRIBE_INTERVAL=t.DEFAULT_RETRY_PUBLISH_LIMIT=t.DEFAULT_RETRY_SUBSCRIBE_LIMIT=t.EWorkerAction=t.EWorkerSource=t.EConnectStatus=t.TrackType=void 0,function(e){e.AUDIO="audio",e.VIDEO="video"}(r||(t.TrackType=r={})),function(e){e[e.CONNECT_STATUS_DISCONNECTED=0]="CONNECT_STATUS_DISCONNECTED",e[e.CONNECT_STATUS_CONNECTING=1]="CONNECT_STATUS_CONNECTING",e[e.CONNECT_STATUS_CONNECTED=2]="CONNECT_STATUS_CONNECTED",e[e.CONNECT_STATUS_RECONNECTING=3]="CONNECT_STATUS_RECONNECTING"}(o||(t.EConnectStatus=o={})),function(e){e.Sender="sender",e.Receiver="receiver"}(n||(t.EWorkerSource=n={})),function(e){e.Setup="setup",e.InserSEI="insertSEI",e.UpdatePubStats="updatePubStats",e.UpdateSubStats="updateSubStats",e.SwitchCumuDelay="switchCumuDelay"}(i||(t.EWorkerAction=i={})),t.DEFAULT_RETRY_SUBSCRIBE_LIMIT=5,t.DEFAULT_RETRY_PUBLISH_LIMIT=5,t.DEFAULT_RETRY_SUBSCRIBE_INTERVAL=2e3,t.DEFAULT_RETRY_PUBLISH_INTERVAL=2e3,t.DEFAULT_HEARTBEAT_TIMEOUT=8,t.DEFAULT_RETRY_DATACHANNEL_TIMEOUT=8e3},649:function(e,t,r){var o,n,i=this&&this.__assign||function(){return i=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},i.apply(this,arguments)},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.CumuDelaySeiPayloadParser=t.CumuDelaySeiPayload=t.ECumuDelayGrtnKey=t.ECumuDelayPubSdkKey=t.ECumuDelayAVCommonKey=t.ECumuDelayVideoKey=t.ECumuDelayGrtnExportKey=t.ECumuDelaySubKey=t.CUMU_DELAY_UUID=t.CUMU_DELAY_SEI_PAYLOAD_TYPE=void 0;var s,u,l,A,C=a(r(28));t.CUMU_DELAY_SEI_PAYLOAD_TYPE=99,t.CUMU_DELAY_UUID=[32,36,16,9,16,23,7,1,150,117,25,212,25,129,3,7],function(e){e.SophonAudioDual="sophon_audio_dual",e.SophonVideoCamera="sophon_video_camera",e.SophonVideoCameraSmall="sophon_video_camera_small",e.SophonVideoCameraSuper="sophon_video_camera_super",e.SophonVideoScreenShare="sophon_video_screen_share",e.SophonAudio="sophon_audio",e.SophonVideoCameraLarge="sophon_video_camera_large",e.RtsAudio="rts audio",e.RtsVideo="rts video"}(s||(s={})),function(e){e[e.Web=0]="Web",e[e.iOS=1]="iOS",e[e.Android=2]="Android"}(u||(u={})),function(e){e.VTotalCost="VTotalCost",e.VAssemblyCost="VAssemblyCost",e.VJitterBufferDelay="VJitterBufferDelay",e.VDecPlugCost="VDecPlugCost",e.DownRTTHalf="DownRTTHalf"}(l||(t.ECumuDelaySubKey=l={})),function(e){e.TOTAL_COST="TOTAL_COST",e.ENTER_GRTN_TIMESTAMP="ENTER_GRTN_TIMESTAMP",e.LEAVE_GRTN_TIMESTAMP="LEAVE_GRTN_TIMESTAMP"}(A||(t.ECumuDelayGrtnExportKey=A={}));var c,T,f,d,E,_,y,S=((o={})[s.SophonAudioDual]=4,o[s.SophonVideoCamera]=5,o[s.SophonVideoCameraSmall]=6,o[s.SophonVideoCameraSuper]=7,o[s.SophonVideoScreenShare]=8,o[s.SophonAudio]=9,o[s.SophonVideoCameraLarge]=10,o[s.RtsAudio]=11,o[s.RtsVideo]=12,o);(n={})[S[s.SophonAudioDual]]=s.SophonAudioDual,n[S[s.SophonVideoCamera]]=s.SophonVideoCamera,n[S[s.SophonVideoCameraSmall]]=s.SophonVideoCameraSmall,n[S[s.SophonVideoCameraSuper]]=s.SophonVideoCameraSuper,n[S[s.SophonVideoScreenShare]]=s.SophonVideoScreenShare,n[S[s.SophonAudio]]=s.SophonAudio,n[S[s.SophonVideoCameraLarge]]=s.SophonVideoCameraLarge,n[S[s.RtsAudio]]=s.RtsAudio,n[S[s.RtsVideo]]=s.RtsVideo;!function(e){e[e.VTotalCost=4]="VTotalCost",e[e.CapDeviceCost=5]="CapDeviceCost",e[e.PushExtCost=6]="PushExtCost",e[e.CapPlugCost=7]="CapPlugCost",e[e.PrepThrCost=8]="PrepThrCost",e[e.PrepPlugCost=9]="PrepPlugCost",e[e.DispThrCost=10]="DispThrCost",e[e.DispPlugCost=11]="DispPlugCost",e[e.VEncThrCost=12]="VEncThrCost",e[e.VEncPlugCost=13]="VEncPlugCost"}(c||(t.ECumuDelayVideoKey=c={})),function(e){e[e.ATotalCost=24]="ATotalCost",e[e.ASourceCCost=25]="ASourceCCost",e[e.AMixerCost=26]="AMixerCost",e[e.AEncodeCCost=27]="AEncodeCCost",e[e.AAIClientQuestionTimestampHEAD=28]="AAIClientQuestionTimestampHEAD",e[e.AAIClientQuestionTimestampTAIL=29]="AAIClientQuestionTimestampTAIL",e[e.AAIClientAnswerTimestampHEAD=30]="AAIClientAnswerTimestampHEAD",e[e.AAIClientAnswerTimestampTAIL=31]="AAIClientAnswerTimestampTAIL",e[e.AAIClientScentenceId=32]="AAIClientScentenceId",e[e.AAIClientSourceCost=33]="AAIClientSourceCost",e[e.AAIClientMixerCost=34]="AAIClientMixerCost",e[e.AAIClientEncoderCost=35]="AAIClientEncoderCost",e[e.AAILinuxReceiveCost=36]="AAILinuxReceiveCost",e[e.AAILinuxNeteqCost=37]="AAILinuxNeteqCost",e[e.AAILinuxRemoteSourceCost=38]="AAILinuxRemoteSourceCost",e[e.AAILinuxPlayMixerCost=39]="AAILinuxPlayMixerCost",e[e.AAILinuxPlayCost=40]="AAILinuxPlayCost",e[e.AAIClientQuestionUidDigestHEAD=41]="AAIClientQuestionUidDigestHEAD",e[e.AAIClientQuestionUidDigestTAIL=42]="AAIClientQuestionUidDigestTAIL",e[e.AIClinetSmartDenoise=43]="AIClinetSmartDenoise"}(T||(T={})),function(e){e[e.NetsdkThrCost=44]="NetsdkThrCost",e[e.QosThrCost=45]="QosThrCost",e[e.PacerCost=46]="PacerCost",e[e.UpRTTHalf=47]="UpRTTHalf",e[e.AIClientNetsdkThrCost=48]="AIClientNetsdkThrCost",e[e.AIClientQosThrCost=49]="AIClientQosThrCost",e[e.AIClientPacerCost=50]="AIClientPacerCost",e[e.AIClientUpRTTHalf=51]="AIClientUpRTTHalf"}(f||(t.ECumuDelayAVCommonKey=f={})),function(e){e[e.AIAsrCost=64]="AIAsrCost",e[e.AILlmCost=65]="AILlmCost",e[e.AITtsCost=66]="AITtsCost",e[e.AIMuteCost=67]="AIMuteCost",e[e.AIAgentTotalCost=68]="AIAgentTotalCost",e[e.AIAgentExtraAvatarCost=69]="AIAgentExtraAvatarCost"}(d||(d={})),function(e){e[e.PubSdkType=100]="PubSdkType",e[e.PubSdkVersion=101]="PubSdkVersion"}(E||(t.ECumuDelayPubSdkKey=E={})),function(e){e[e.NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_INTERNAL_RTT_HALF=121]="NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_INTERNAL_RTT_HALF",e[e.NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_GRTN_NODE_BEF_PACER=122]="NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_GRTN_NODE_BEF_PACER",e[e.NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_GRTN_NODE_PACER_COST=123]="NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_GRTN_NODE_PACER_COST",e[e.NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_DOWN_RTT_HALF=124]="NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_DOWN_RTT_HALF"}(_||(t.ECumuDelayGrtnKey=_={})),function(e){e[e.AIGRTNInternalRTTHalf=104]="AIGRTNInternalRTTHalf",e[e.AIGRTNBeforePacer=105]="AIGRTNBeforePacer",e[e.AIGRTNPacerCost=106]="AIGRTNPacerCost",e[e.AIGRTNDownRTTHalf=107]="AIGRTNDownRTTHalf"}(y||(y={}));var p=function(e){e.msid=s.SophonAudio;var t=S[e.msid];t||console.warn("No mapped msid for cumuDelay",e.msid);var r=new ArrayBuffer(e.sendTs?8:4);if(e.sendTs){var o=Math.floor(performance.now()+performance.timeOrigin-e.windowTimeOrigin);o>=Math.pow(2,32)-1&&(o=0);var n=new DataView(r);n.setUint8(0,8),n.setUint8(1,0),n.setUint8(2,t),n.setUint8(3,5),n.setUint32(4,o)}else new Uint8Array(r).set([0,0,t,1]);e.kv[E.PubSdkType]=u.Web,e.kv[E.PubSdkVersion]=Number(C.default.version.split(".").join("").split("-")[0]);var a=Object.keys(e.kv).length;a>256&&console.warn("Too much kv");var l,A,T,d,_=1+3*a+1,y=new ArrayBuffer(_),p=new DataView(y);p.setInt8(0,a),Object.keys(e.kv).forEach((function(t,r){t in i(i(i({},c),f),E)||console.warn("Unknown CumuDelay key: ".concat(t));var o=e.kv[t],n=1+3*r;p.setUint8(n,parseInt(t)),p.setUint16(n+1,o)})),p.setUint8(_-1,128),this.buffer=(l=r,A=y,T=new ArrayBuffer(l.byteLength+A.byteLength),(d=new Uint8Array(T)).set(new Uint8Array(l),0),d.set(new Uint8Array(A),l.byteLength),T)};t.CumuDelaySeiPayload=p;var h=function(e){var t;this.pub={},this.grtn={},this.AIPub={},this.AISub={},this.AIAgent={},this.AIGrtn={},this.other={};var r,o,n=new v(e),i=(n.readBits(3),n.readBits()),a=n.readBits(),s=n.readBits(),u=n.readBits(),l=n.readBits();n.readBits(8),n.readBits(8),n.readBits(8),1===i&&n.readBits(16);if(1===a){var C=n.readBits(32);this.pub.timestamp=C,this.pub.timestampRecv=Math.floor(performance.now())}1===s&&n.readBits(16);1===u&&(r=n.readBits(32)),1===l&&(o=n.readBits(32)),r&&o&&(this.grtn=((t={})[A.TOTAL_COST]=o-r,t[A.ENTER_GRTN_TIMESTAMP]=r,t[A.LEAVE_GRTN_TIMESTAMP]=o,t));for(var S=n.readBits(8),p=0;p<S;p++){var h=n.readBits(8),m=n.readBits(16);if(I(h,[c.VTotalCost,c.VEncPlugCost])||I(h,[T.ATotalCost,T.AEncodeCCost])||I(h,[f.NetsdkThrCost,f.UpRTTHalf])||I(h,[E.PubSdkType,E.PubSdkVersion])){var b=c[h]||T[h]||f[h]||E[h];this.pub[b]=m}else if(I(h,[T.AAIClientQuestionTimestampHEAD,T.AAIClientEncoderCost])||I(h,[f.AIClientNetsdkThrCost,f.AIClientUpRTTHalf]))b=T[h]||f[h],this.AIPub[b]=m;else if(I(h,[T.AAILinuxReceiveCost,T.AIClinetSmartDenoise]))b=T[h],this.AISub[b]=m;else if(I(h,[d.AIAsrCost,d.AIAgentExtraAvatarCost]))b=d[h],this.AIAgent[b]=m;else if(I(h,[y.AIGRTNInternalRTTHalf,y.AIGRTNDownRTTHalf])){b=y[h];for(var D=0,U="".concat(b,"_").concat(D);this.AIGrtn.hasOwnProperty(U);)U="".concat(b,"_").concat(D++);this.AIGrtn[U]=m}else if(I(h,[_.NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_INTERNAL_RTT_HALF,_.NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_DOWN_RTT_HALF])){for(b=_[h],D=0,U="".concat(b,"_").concat(D);this.grtn.hasOwnProperty(U);)U="".concat(b,"_").concat(D++);this.grtn[U]=m}else this.other[h]=m}};function I(e,t){return e>=t[0]&&e<=t[1]}t.CumuDelaySeiPayloadParser=h;var v=function(){function e(e){this.byteOffset=0,this.bitOffset=0;var t=new Uint8Array(e);this.buffer=t}return e.prototype.readBits=function(e){void 0===e&&(e=1);for(var t=0,r=0;r<e;){if(this.byteOffset>=this.buffer.byteLength)throw new Error("readBits out of range");var o=8-this.bitOffset,n=Math.min(o,e-r);t=t<<n|this.getBitsFromByte(this.buffer,this.byteOffset,this.bitOffset,this.bitOffset+n-1),this.bitOffset+=n,r+=n,8===this.bitOffset&&(this.byteOffset++,this.bitOffset=0)}return 32===e&&(t>>>=0),t},e.prototype.hasNext=function(){return this.byteOffset<this.buffer.byteLength},e.prototype.getBitsFromByte=function(e,t,r,o){if(t<0||t>=e.byteLength||r<0||o>7||r>o)throw new Error("Invalid parameters");return e[t]>>7-o&(1<<o-r+1)-1},e}()},594:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.readUUID=t.discardEPB=t.insertEPB=t.SODBtoRBSP=t.convertPayloadSize=t.NALU=t.SEI=t.parseSei=t.insertSei=void 0;var o=r(649);t.insertSei=function(e,t,r,o){void 0===r&&(r=5);for(var a=e.data,s=new DataView(a),u=0;;){if(1===s.getUint32(u)){s.getUint8(u+4);var l=new n(t,r,o).buffer,A=new i(l).buffer,C=new ArrayBuffer(A.byteLength+a.byteLength),c=new Uint8Array(C),T=new Uint8Array(A);c.set(T);var f=new Uint8Array(a);c.set(f,A.byteLength),e.data=C,u+=1;break}if((u+=1)+4>=s.byteLength)break}};t.parseSei=function(e){for(var r=[],o=new DataView(e),n=0;;){var i=n,s=o.getUint32(i);if(i+=4,1===s){if(6===(31&o.getUint8(i++))){for(var u=o.getUint8(i++),l=a(u)?16:0,A=0;255==o.getUint8(i);)i++,A+=255;if((A+=o.getUint8(i++))>0&&o.byteLength>i+A){var C=new Uint8Array(o.buffer),c="";if(a(u)){var T=C.slice(i,i+l);c=(0,t.readUUID)((0,t.discardEPB)(T))}var f=C.slice(i+l,i+A);i+=A,r.push({payloadType:u,uuid:c,data:f.buffer})}}n=i}else n+=1;if(n+4>=o.byteLength)break}return r};var n=function(e,r,o){void 0===r&&(r=5);var n=a(r)?16:0,i=e.byteLength+n,s=(0,t.convertPayloadSize)(i),u=s.buffer.byteLength,l=new ArrayBuffer(1+u+n+e.byteLength),A=new Uint8Array(l),C=0;if(A[C++]=r,A.set(s,C),C+=s.byteLength,a(r)){o=(o||"00000000-0000-0000-0000-000000000000").replace(/-/g,"");for(var c=0;c<16;c++)A[C+c]=parseInt(o.substr(2*c,2),16);C+=16}var T=new Uint8Array(e);A.set(T,C);var f=(0,t.SODBtoRBSP)(A);this.buffer=f.buffer};t.SEI=n;var i=function(e){var t=new Uint8Array([0,0,0,1]),r=new Uint8Array([6]),o=new ArrayBuffer(t.byteLength+r.byteLength+e.byteLength),n=new Uint8Array(o);n.set(t),n.set(r,t.byteLength),n.set(new Uint8Array(e),t.byteLength+r.byteLength),this.buffer=o};t.NALU=i;t.convertPayloadSize=function(e){if(e<=0)throw new Error("payloadSize must be a positive integer.");for(var t=Math.ceil(e/255),r=new ArrayBuffer(t),o=new DataView(r),n=0;n<t-1;n++)o.setUint8(n,255);return o.setUint8(t-1,e%255&255),new Uint8Array(r)};t.SODBtoRBSP=function(e){for(var r=new Uint8Array(e),o="",n=0;n<r.length;n++)o+=r[n].toString(2).padStart(8,"0");for(o+="1";o.length%8!=0;)o+="0";var i=o.length/8,a=new Uint8Array(i);for(n=0;n<i;n++)a[n]=parseInt(o.slice(8*n,8*n+8),2);return(0,t.insertEPB)(a)};t.insertEPB=function(e){for(var t=[],r=0,o=0;o<e.length;o++)t.push(e[o]),0===e[o]?2===++r&&o<e.length-1&&e[o+1]<=3&&(t.push(3),r=0):r=0;return new Uint8Array(t)};t.discardEPB=function(e){for(var t=e.byteLength,r=[],o=1;o<t-2;)0===e[o]&&0===e[o+1]&&3===e[o+2]?(r.push(o+2),o+=2):o++;if(0===r.length)return e;var n=t-r.length,i=new Uint8Array(n),a=0;for(o=0;o<n;a++,o++)a===r[0]&&(a++,r.shift()),i[o]=e[a];return i};t.readUUID=function(e){if(16!==e.length)throw new Error("UUID must be 16 bytes long.");var t=e.reduce((function(e,t){return e+t.toString(16).padStart(2,"0")}),"");return"".concat(t.slice(0,8),"-").concat(t.slice(8,12),"-").concat(t.slice(12,16),"-").concat(t.slice(16,20),"-").concat(t.slice(20))};var a=function(e){return 5===e||e===o.CUMU_DELAY_SEI_PAYLOAD_TYPE}},718:function(e,t){var r=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var o,n=0,i=t.length;n<i;n++)!o&&n in t||(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.hebtLog=t.createUUID=t.evaluateNetworkCondition=t.makeCancelable=t.hasVideoTrack=t.hasAudioTrack=t.getVideoTrack=t.getAudioTrack=t.pruneSubUrl=t.getJitterBufferDelayAvg=void 0,t.lowercaseFirstLetter=function(e){return e.replace(/([A-Za-z])/,(function(e){return e.toLowerCase()}))},t.underlineToCamelCase=function(e){return e.replace(/_([a-z])/g,(function(e,t){return t.toUpperCase()}))};t.getJitterBufferDelayAvg=function(e,t){return e&&t?Number(e)/Number(t)*1e3:-1};t.pruneSubUrl=function(e,t){var r=e||"";return r=r.replace("@subaudio=no","").replace("@subvideo=no",""),t&&(r=r.split("?")[0]),r};t.getAudioTrack=function(e){return e.getAudioTracks()[0]};t.getVideoTrack=function(e){return e.getVideoTracks()[0]};t.hasAudioTrack=function(e){return e.getAudioTracks().length>0};t.hasVideoTrack=function(e){return e.getVideoTracks().length>0};t.makeCancelable=function(e){var t=!1;return{promise:new Promise((function(r,o){e.then((function(e){return t?o({isCanceled:!0}):r(e)})),e.catch((function(e){return o(t?{isCanceled:!0}:e)}))})),cancel:function(){t=!0}}};t.evaluateNetworkCondition=function(e,t,r,o,n){var i=0;if(!navigator.onLine)return i=6;var a=[{loss:0,rtt:0,jbd:1},{loss:0,rtt:1,jbd:0},{loss:0,rtt:.5,jbd:.5},{loss:1,rtt:0,jbd:0},{loss:.8,rtt:0,jbd:.2},{loss:.8,rtt:.2,jbd:0},{loss:.6,rtt:.2,jbd:.2}],s=-1,u=-1,l=-1;if("number"==typeof t&&t>=0||"number"==typeof r&&r>=0){s=0;var A=!1,C=!1;"number"==typeof t&&t>=0&&(s+=t,A=!0),"number"==typeof r&&r>=0&&(s+=r,C=!0),A&&!C&&(s*=2),C&&!A&&(s*=1.8)}if("number"==typeof e&&e>=0&&(l=e),"number"==typeof o&&o>=0||"number"==typeof n&&n>=0){u=0;"number"==typeof o&&o>=0&&(u+=o),"number"==typeof n&&n>=0&&(u+=n)}var c;if((c=4*(-1!==s?1:0)+2*(-1!==l?1:0)+(-1!==u?1:0))>0){var T=1.2*s*a[c-1].loss+l/1500*a[c-1].rtt+u/3e3*a[c-1].jbd;i=T<=.1?1:T<=.23?2:T<=.36?3:T<=.49?4:5}else i=0;return i};t.createUUID=function(e,t){var r,o="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),n=[];if(t=t||o.length,e)for(r=0;r<e;r++)n[r]=o[0|Math.random()*t];else{var i=void 0;for(n[8]=n[13]=n[18]=n[23]="-",n[14]="4",r=0;r<36;r++)n[r]||(i=0|16*Math.random(),n[r]=o[19==r?3&i|8:i])}return n.join("")};t.hebtLog=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];window.RTS_HEBT_DEBUG&&console.log.apply(console,r(["[rts hebt]"],e,!1))}}},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var i=t[o]={exports:{}};return e[o].call(i.exports,i,i.exports,r),i.exports}var o,n,i,a,s,u,l,A,C,c,T,f;a=r(594),s=r(718),u=r(649),l=r(917),A=self,C=!1,c=0,T=function(e,t,r,s){if(e===l.EWorkerSource.Sender){var A=new TransformStream({transform:function(e,t){var r=e;if(e.type){if(o)try{(!o.keyframeOnly||o.keyframeOnly&&"key"===e.type)&&((0,a.insertSei)(e,o.sei,o.payloadType,o.uuid),void 0===o.repeatCount?o=null:-1!==o.repeatCount&&(o.repeatCount--,o.repeatCount<0&&(o=null)))}catch(t){e=r,console.log("error in inserting user SEI",t)}else if(C)try{if("key"===e.type&&n){var i={};n.v_encode_time_avg&&(i[u.ECumuDelayVideoKey.VEncPlugCost]=Math.ceil(n.v_encode_time_avg)),n.v_packet_send_delay_avg&&(i[u.ECumuDelayAVCommonKey.PacerCost]=Math.ceil(n.v_packet_send_delay_avg)),n.rtt&&(i[u.ECumuDelayAVCommonKey.UpRTTHalf]=Math.ceil(n.rtt/2*1e3)),i[u.ECumuDelayVideoKey.VTotalCost]=Math.ceil((i[u.ECumuDelayVideoKey.VEncPlugCost]||0)+(i[u.ECumuDelayAVCommonKey.PacerCost]||0)),(0,a.insertSei)(e,new u.CumuDelaySeiPayload({msid:n.vMsid||"",kv:i,sendTs:!0,windowTimeOrigin:c}).buffer,u.CUMU_DELAY_SEI_PAYLOAD_TYPE,(0,a.readUUID)(new Uint8Array(u.CUMU_DELAY_UUID)))}}catch(t){e=r,console.log("error in inserting cumuDelay SEI",t)}r=null,s&&s(e)}t.enqueue(e)}});t.pipeThrough(A).pipeTo(r)}else e===l.EWorkerSource.Receiver&&(A=new TransformStream({transform:function(e,t){var r,o,n,a,l,A,C,c,T,f,d,E=e;if(e.type){try{if(i){var _=((r={})[u.ECumuDelaySubKey.DownRTTHalf]=Math.ceil(((null===(n=null===(o=i.video)||void 0===o?void 0:o.transportStats)||void 0===n?void 0:n.rtt)||0)/2*1e3),r[u.ECumuDelaySubKey.VAssemblyCost]=Math.ceil((null===(l=null===(a=i.video)||void 0===a?void 0:a.inboundRtpStatsPerSec)||void 0===l?void 0:l.totalAssemblyTimeAvg)||0),r[u.ECumuDelaySubKey.VJitterBufferDelay]=Math.ceil((null===(C=null===(A=i.video)||void 0===A?void 0:A.inboundRtpStatsPerSec)||void 0===C?void 0:C.jitterBufferDelayAvg)||0),r[u.ECumuDelaySubKey.VDecPlugCost]=Math.ceil((null===(T=null===(c=i.video)||void 0===c?void 0:c.inboundRtpStatsPerSec)||void 0===T?void 0:T.decodeTimeAvg)||0),r[u.ECumuDelaySubKey.VTotalCost]=Math.ceil((null===(d=null===(f=i.video)||void 0===f?void 0:f.inboundRtpStatsPerSec)||void 0===d?void 0:d.totalProcessingDelayAvg)||0),r);_[u.ECumuDelaySubKey.VTotalCost]||(_[u.ECumuDelaySubKey.VTotalCost]=Math.ceil((_[u.ECumuDelaySubKey.VAssemblyCost]||0)+(_[u.ECumuDelaySubKey.VJitterBufferDelay]||0)+(_[u.ECumuDelaySubKey.VDecPlugCost]||0))),e.subStats=_}}catch(t){console.log("error in parsing SEI",t),e=E}E=null,s&&s(e)}delete e.subStats,t.enqueue(e)}}),t.pipeThrough(A).pipeTo(r))},f=function(e){var t=e.data.slice(0);A.postMessage({type:"encodedFrame",data:t,frameInfo:{type:e.type,timestamp:e.timestamp},subStats:e.subStats},[t]),t=null},A.RTCTransformEvent&&(A.onrtctransform=function(e){var t=e.transformer,r=t.options.source,o=t.readable,n=t.writable;T(r,o,n,(function(e){r===l.EWorkerSource.Receiver&&f(e)}))}),onmessage=function(e){switch(e.data.operation){case l.EWorkerAction.Setup:t=e.data,r=t.source,a=t.readable,u=t.writable,T(r,a,u,(function(e){r===l.EWorkerSource.Receiver&&f(e)}));break;case l.EWorkerAction.InserSEI:!function(e){(o=e)&&(o.uuid=(0,s.createUUID)().toLowerCase(),o.repeatCount=o.repeatCount||0)}(e.data);break;case l.EWorkerAction.UpdatePubStats:!function(e){n=e.stats}(e.data);break;case l.EWorkerAction.UpdateSubStats:!function(e){i=e.stats}(e.data);break;case l.EWorkerAction.SwitchCumuDelay:!function(e){C=e.enable,c=e.windowTimeOrigin}(e.data)}var t,r,a,u}})();',"Worker",void 0,void 0)}},5512:j=>{j.exports=function(T,_,m,d){var f=self||window;try{try{var y;try{y=new f.Blob([T])}catch{(y=new(f.BlobBuilder||f.WebKitBlobBuilder||f.MozBlobBuilder||f.MSBlobBuilder)).append(T),y=y.getBlob()}var v=f.URL||f.webkitURL,s=v.createObjectURL(y),c=new f[_](s,m);return v.revokeObjectURL(s),c}catch{return new f[_]("data:application/javascript,".concat(encodeURIComponent(T)),m)}}catch{if(!d)throw Error("Inline worker is not supported");return new f[_](d,m)}}},2632:(j,T,_)=>{_.r(T),_.d(T,{default:()=>a});function m(e,r,i){Object.defineProperty(e,r,{writable:!0,enumerable:!0,configurable:!0,value:i})}Array(32);var d,f,y;class v{constructor(r){var i,o;this.timer=null,this.time=10,this.count=10,this.arr=[],this.time=(i=r.time)!=null?i:10,this.count=(o=r.count)!=null?o:10,r.host.startsWith("http://")||r.host.startsWith("https://")?this.url=r.host+"/logstores/"+r.logstore+"/track":this.url="https://"+r.project+"."+r.host+"/logstores/"+r.logstore+"/track",this.opt=r,r.installUnloadHook&&typeof r.installUnloadHook=="function"&&r.installUnloadHook(()=>{this.sendImmediateInner()})}assemblePayload(r=this.arr){const i={__logs__:r};return this.opt.tags&&(i.__tags__=this.opt.tags),this.opt.topic&&(i.__topic__=this.opt.topic),this.opt.source&&(i.__source__=this.opt.source),JSON.stringify(i)}platformSend(){if(this.opt.sendPayload&&typeof this.opt.sendPayload=="function"){const r=this.assemblePayload();this.opt.sendPayload(this.url,r)}}transString(r){let i={};for(let o in r)typeof r[o]=="object"?i[o]=JSON.stringify(r[o]):i[o]=String(r[o]);return i}sendImmediateInner(){this.arr&&this.arr.length>0&&(this.platformSend(),this.timer!=null&&(clearTimeout(this.timer),this.timer=null),this.arr=[])}sendInner(){if(this.timer)this.arr.length>=this.count&&(clearTimeout(this.timer),this.timer=null,this.sendImmediateInner());else{const r=this;this.arr.length>=this.count||this.time<=0?this.sendImmediateInner():this.timer=setTimeout(function(){r.sendImmediateInner()},1e3*this.time)}}send(r){const i=this.transString(r);this.arr.push(i),this.sendInner()}sendImmediate(r){const i=this.transString(r);this.arr.push(i),this.sendImmediateInner()}sendBatchLogs(r){const i=r.map(o=>this.transString(o));this.arr.push(...i),this.sendInner()}sendBatchLogsImmediate(r){const i=r.map(o=>this.transString(o));this.arr.push(...i),this.sendImmediateInner()}}function s(e,r){const i=new window.XMLHttpRequest;i.open("POST",`${e}?APIVersion=0.6.0`,!0),i.send(r)}function c(e,r){try{if(r.length>=32768)return void s(e,r);(function(i,o){return!(!navigator||!navigator.sendBeacon)&&navigator.sendBeacon(`${i}?APIVersion=0.6.0`,o)})(e,r)||s(e,r)}catch(i){window&&window.console&&typeof window.console.error=="function"&&(console.error(`Failed to log to ali log service because of this exception:
163
- `+i),console.error("Failed log data:",e))}}class a extends v{constructor(r){super(Object.assign({},r,{installUnloadHook:i=>{window.addEventListener("beforeunload",()=>{i()})},sendPayload:(i,o)=>{c(i,o)}}))}}d=window,f="SLS_Tracker",y=a,m(d,f,y)},4198:j=>{j.exports=JSON.parse('{"name":"axios","version":"0.21.4","description":"Promise based HTTP client for the browser and node.js","main":"index.js","scripts":{"test":"grunt test","start":"node ./sandbox/server.js","build":"NODE_ENV=production grunt build","preversion":"npm test","version":"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json","postversion":"git push && git push --tags","examples":"node ./examples/server.js","coveralls":"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js","fix":"eslint --fix lib/**/*.js"},"repository":{"type":"git","url":"https://github.com/axios/axios.git"},"keywords":["xhr","http","ajax","promise","node"],"author":"Matt Zabriskie","license":"MIT","bugs":{"url":"https://github.com/axios/axios/issues"},"homepage":"https://axios-http.com","devDependencies":{"coveralls":"^3.0.0","es6-promise":"^4.2.4","grunt":"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1","karma":"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2","minimist":"^1.2.0","mocha":"^8.2.1","sinon":"^4.5.0","terser-webpack-plugin":"^4.2.3","typescript":"^4.0.5","url-search-params":"^0.10.0","webpack":"^4.44.2","webpack-dev-server":"^3.11.0"},"browser":{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},"jsdelivr":"dist/axios.min.js","unpkg":"dist/axios.min.js","typings":"./index.d.ts","dependencies":{"follow-redirects":"^1.14.0"},"bundlesize":[{"path":"./dist/axios.min.js","threshold":"5kB"}]}')}},V={};function Q(j){var T=V[j];if(T!==void 0)return T.exports;var _=V[j]={exports:{}};return M[j].call(_.exports,_,_.exports,Q),_.exports}return Q.n=j=>{var T=j&&j.__esModule?()=>j.default:()=>j;return Q.d(T,{a:T}),T},Q.d=(j,T)=>{for(var _ in T)Q.o(T,_)&&!Q.o(j,_)&&Object.defineProperty(j,_,{enumerable:!0,get:T[_]})},Q.o=(j,T)=>Object.prototype.hasOwnProperty.call(j,T),Q.r=j=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(j,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(j,"__esModule",{value:!0})},Q(8156)})())})(Vr);for(var jn=Vr.exports,Le=[],Gt=0;Gt<256;++Gt)Le.push((Gt+256).toString(16).slice(1));function Wn(Y,L=0){return(Le[Y[L+0]]+Le[Y[L+1]]+Le[Y[L+2]]+Le[Y[L+3]]+"-"+Le[Y[L+4]]+Le[Y[L+5]]+"-"+Le[Y[L+6]]+Le[Y[L+7]]+"-"+Le[Y[L+8]]+Le[Y[L+9]]+"-"+Le[Y[L+10]]+Le[Y[L+11]]+Le[Y[L+12]]+Le[Y[L+13]]+Le[Y[L+14]]+Le[Y[L+15]]).toLowerCase()}var nt,Gn=new Uint8Array(16);function zn(){if(!nt&&(nt=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!nt))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return nt(Gn)}var Yn=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Hr={randomUUID:Yn};function it(Y,L,M){if(Hr.randomUUID&&!L&&!Y)return Hr.randomUUID();Y=Y||{};var V=Y.random||(Y.rng||zn)();return V[6]=V[6]&15|64,V[8]=V[8]&63|128,Wn(V)}var qn=/d{1,4}|D{3,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|W{1,2}|[LlopSZN]|"[^"]*"|'[^']*'/g,Kn=/\b(?:[A-Z]{1,3}[A-Z][TC])(?:[-+]\d{4})?|((?:Australian )?(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time)\b/g,Xn=/[^-+\dA-Z]/g;function zt(Y,L,M,V){if(arguments.length===1&&typeof Y=="string"&&!/\d/.test(Y)&&(L=Y,Y=void 0),Y=Y||Y===0?Y:new Date,Y instanceof Date||(Y=new Date(Y)),isNaN(Y))throw TypeError("Invalid date");L=String(jr[L]||L||jr.default);var Q=L.slice(0,4);(Q==="UTC:"||Q==="GMT:")&&(L=L.slice(4),M=!0,Q==="GMT:"&&(V=!0));var j=function(){return M?"getUTC":"get"},T=function(){return Y[j()+"Date"]()},_=function(){return Y[j()+"Day"]()},m=function(){return Y[j()+"Month"]()},d=function(){return Y[j()+"FullYear"]()},f=function(){return Y[j()+"Hours"]()},y=function(){return Y[j()+"Minutes"]()},v=function(){return Y[j()+"Seconds"]()},s=function(){return Y[j()+"Milliseconds"]()},c=function(){return M?0:Y.getTimezoneOffset()},a=function(){return Qn(Y)},e=function(){return Jn(Y)},r={d:function(){return T()},dd:function(){return je(T())},ddd:function(){return Ve.dayNames[_()]},DDD:function(){return Wr({y:d(),m:m(),d:T(),_:j(),dayName:Ve.dayNames[_()],short:!0})},dddd:function(){return Ve.dayNames[_()+7]},DDDD:function(){return Wr({y:d(),m:m(),d:T(),_:j(),dayName:Ve.dayNames[_()+7]})},m:function(){return m()+1},mm:function(){return je(m()+1)},mmm:function(){return Ve.monthNames[m()]},mmmm:function(){return Ve.monthNames[m()+12]},yy:function(){return String(d()).slice(2)},yyyy:function(){return je(d(),4)},h:function(){return f()%12||12},hh:function(){return je(f()%12||12)},H:function(){return f()},HH:function(){return je(f())},M:function(){return y()},MM:function(){return je(y())},s:function(){return v()},ss:function(){return je(v())},l:function(){return je(s(),3)},L:function(){return je(Math.floor(s()/10))},t:function(){return f()<12?Ve.timeNames[0]:Ve.timeNames[1]},tt:function(){return f()<12?Ve.timeNames[2]:Ve.timeNames[3]},T:function(){return f()<12?Ve.timeNames[4]:Ve.timeNames[5]},TT:function(){return f()<12?Ve.timeNames[6]:Ve.timeNames[7]},Z:function(){return V?"GMT":M?"UTC":$n(Y)},o:function(){return(c()>0?"-":"+")+je(Math.floor(Math.abs(c())/60)*100+Math.abs(c())%60,4)},p:function(){return(c()>0?"-":"+")+je(Math.floor(Math.abs(c())/60),2)+":"+je(Math.floor(Math.abs(c())%60),2)},S:function(){return["th","st","nd","rd"][T()%10>3?0:(T()%100-T()%10!=10)*T()%10]},W:function(){return a()},WW:function(){return je(a())},N:function(){return e()}};return L.replace(qn,function(i){return i in r?r[i]():i.slice(1,i.length-1)})}var jr={default:"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",paddedShortDate:"mm/dd/yyyy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:sso",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'",expiresHeaderFormat:"ddd, dd mmm yyyy HH:MM:ss Z"},Ve={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"],timeNames:["a","p","am","pm","A","P","AM","PM"]},je=function(L){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;return String(L).padStart(M,"0")},Wr=function(L){var M=L.y,V=L.m,Q=L.d,j=L._,T=L.dayName,_=L.short,m=_===void 0?!1:_,d=new Date,f=new Date;f.setDate(f[j+"Date"]()-1);var y=new Date;y.setDate(y[j+"Date"]()+1);var v=function(){return d[j+"Date"]()},s=function(){return d[j+"Month"]()},c=function(){return d[j+"FullYear"]()},a=function(){return f[j+"Date"]()},e=function(){return f[j+"Month"]()},r=function(){return f[j+"FullYear"]()},i=function(){return y[j+"Date"]()},o=function(){return y[j+"Month"]()},t=function(){return y[j+"FullYear"]()};return c()===M&&s()===V&&v()===Q?m?"Tdy":"Today":r()===M&&e()===V&&a()===Q?m?"Ysd":"Yesterday":t()===M&&o()===V&&i()===Q?m?"Tmw":"Tomorrow":T},Qn=function(L){var M=new Date(L.getFullYear(),L.getMonth(),L.getDate());M.setDate(M.getDate()-(M.getDay()+6)%7+3);var V=new Date(M.getFullYear(),0,4);V.setDate(V.getDate()-(V.getDay()+6)%7+3);var Q=M.getTimezoneOffset()-V.getTimezoneOffset();M.setHours(M.getHours()-Q);var j=(M-V)/(864e5*7);return 1+Math.floor(j)},Jn=function(L){var M=L.getDay();return M===0&&(M=7),M},$n=function(L){return(String(L).match(Kn)||[""]).pop().replace(Xn,"").replace(/GMT\+0000/g,"UTC")},Yt;(function(Y){Y.prod="rs.rtn.aliyuncs.com",Y.pre="prs.rtn.aliyuncs.com"})(Yt||(Yt={}));var Gr;(function(Y){Y[Y.ByClient=0]="ByClient",Y[Y.KickOut=1]="KickOut",Y[Y.ChannelClosed=2]="ChannelClosed",Y[Y.Restore=3]="Restore",Y[Y.Expired=4]="Expired",Y[Y.Reconnect=5]="Reconnect",Y[Y.ReconnectExhausted=6]="ReconnectExhausted"})(Gr||(Gr={}));const zr="7.1.5";class Kt{static getVersionNumber(){let L=zr.split("."),M="";return L.forEach(V=>{V.length===1?M+="0"+V:M+=V}),parseInt(M)}static queryingParam(L){let M=[];if(L)for(let V in L)M.push(V+"="+L[V]);return M.join("&")}static getQueryParams(L){const M=window.location.search.substring(1).split("&");for(let V=0;V<M.length;V++){const Q=M[V].split("=");if(decodeURIComponent(Q[0])===L)return decodeURIComponent(Q[1])}}static createCallid(L=""){const M=it();return L&&M&&M.length>L.length?`${L}${M.substring(L.length)}`:M}static checkSubOptionsValid(L){if(L){const{audio:M,video:V,screen:Q}=L;if(M===!1&&V===!1&&Q===!1)return!1}return!0}static async isNetworkAvailable(){const L=Yt.prod,{onLine:M}=navigator;if(!M)return!1;try{return await fetch(`https://${L}/roomserver/v1/ws/version`),!0}catch{return!1}}static toString(L){let M;if(L instanceof Error)M=L.message;else if(typeof L=="string")M=L;else try{M=JSON.stringify(L)}catch{M="undefined"}return M}static paramArrayToString(L){let M="";for(let V=0;V<L.length;V++){M!==""&&(M+=" ");let Q=Kt.toString(L[V]);M+=Q}return M}}const Zn=(Y,L)=>Y.find(M=>{if(typeof M.test=="function")return M.test(L);if(Array.isArray(M.test))return M.test.some(V=>typeof V=="string"?L.indexOf(V)>-1:V instanceof RegExp?V.test(L):!1)}),ei=[{test:["wow64","win64","x64"],describe(){return"amd64"}},{test:["i686","x86"],describe(){return"x86"}},{test:["aarch64","arm64"],describe(){return"arm64"}},{test:["arm"],describe(){return"arm"}}],ti=()=>{let Y="unknown";try{const L=navigator.userAgent||"",M=Zn(ei,L);if(!M)return Y;Y=M.describe(L)}catch{}return Y};var ri=Object.defineProperty,ni=(Y,L,M)=>L in Y?ri(Y,L,{enumerable:!0,configurable:!0,writable:!0,value:M}):Y[L]=M,we=(Y,L,M)=>ni(Y,typeof L!="symbol"?L+"":L,M);const{BrowserUtil:Yr,SystenUtil:qr}=jn.AliRTS,ii=ti(),oi="woMMssV6jmyol9fr",ai=200,ot=10*60*1e3,at={host:"cn-hangzhou.log.aliyuncs.com",project:"alivc-aio",logstore:"logger",time:10,count:10};function qt(){return zt(new Date,"HH:MM:ss.l")}function Kr(){return zt(new Date,"isoDate")}var He;(function(Y){Y[Y.DEBUG=0]="DEBUG",Y[Y.INFO=1]="INFO",Y[Y.API=2]="API",Y[Y.WARNING=3]="WARNING",Y[Y.ERROR=4]="ERROR",Y[Y.NONE=5]="NONE"})(He||(He={}));var Ke;(function(Y){Y[Y.TASK_UPLOAD_BEGIN=710201]="TASK_UPLOAD_BEGIN",Y[Y.SESSION_UPLOAD_BEGIN=710202]="SESSION_UPLOAD_BEGIN",Y[Y.SESSION_UPLOAD_ING=710203]="SESSION_UPLOAD_ING",Y[Y.SESSION_UPLOAD_END=710204]="SESSION_UPLOAD_END",Y[Y.TASK_UPLOAD_END=710205]="TASK_UPLOAD_END"})(Ke||(Ke={}));class si{constructor(){we(this,"tracker"),we(this,"slsPlugin"),we(this,"stsData"),we(this,"stsExpiration",Date.now()),we(this,"clientId",it()),we(this,"bSesid",it()),we(this,"logLevel",He.WARNING),we(this,"appId",""),we(this,"sessionId",""),we(this,"logCache",[]),we(this,"updateTaskTimer"),we(this,"endReported",!0),we(this,"logSequence",0),we(this,"sendLogBeforeUnload",async L=>{if(!this.slsPlugin)return;this.logSequence+=1,L.unshift(this.getLogParams(Ke.SESSION_UPLOAD_ING,{log:`[${Kr()} ${qt()}] [INF] beforeunload`,stat_log_seq:this.logSequence}));const M=`https://${at.project}.${at.host}/logstores/${at.logstore}`,V={__logs__:L.map(T=>this.slsPlugin.transString(T))},{data:Q,header:j}=await this.slsPlugin.process(M,JSON.stringify(V));fetch(M,{keepalive:!0,method:"POST",headers:j,body:Q})}),we(this,"logMethod",(L,M=console.log)=>(...V)=>{let Q=qt();this.logLevel<=L&&M(Q,...V);let j=Kt.paramArrayToString(V);L>He.DEBUG&&this.addLog(j)}),we(this,"d",this.logMethod(He.DEBUG,console.debug)),we(this,"i",this.logMethod(He.INFO)),we(this,"w",this.logMethod(He.WARNING,console.warn)),we(this,"e",this.logMethod(He.ERROR,(...L)=>{const[M,...V]=L;console.error(M,"<error>",V)})),we(this,"ev",this.logMethod(He.API)),we(this,"a",this.logMethod(He.API,(...L)=>{const[M,...V]=L;if(V.length>2){const Q=`${V[1]}`;Q.startsWith("__g__")&&console.group(`${Q.substring(5)}_${V[2]}`)}console.log(M,...V)})),we(this,"ar",this.logMethod(He.API,(...L)=>{const[M,...V]=L;console.log(M,...V),V.length>2&&`${V[1]}`.startsWith("__g__")&&console.groupEnd()})),we(this,"ae",this.logMethod(He.API,(...L)=>{const[M,...V]=L;console.error(M,"<error>",...V),V.length>2&&`${V[1]}`.startsWith("__g__")&&console.groupEnd()})),window.addEventListener("beforeunload",()=>{this.reportEnd(!0)})}init(){this.reset(),this.startSTSUpdateTask()}destroy(){this.updateTaskTimer&&clearTimeout(this.updateTaskTimer)}reset(){this.bSesid=it(),this.endReported=!0,this.logSequence=0,this.appId="",this.sessionId=""}async startSTSUpdateTask(){this.updateTaskTimer&&clearTimeout(this.updateTaskTimer);try{const L=await this.refreshSTSToken();this.createTracker(L)}catch{}this.updateTaskTimer=setTimeout(()=>{this.startSTSUpdateTask()},ot)}async refreshSTSToken(){if(!this.stsData||this.stsExpiration<=Date.now()-ot){const L=await this.requestSTSToken(),M=new Date(L?.Expiration).getTime()||0,V=Date.now()+ot;this.stsExpiration=Math.max(M,V),this.stsData=L}return this.stsData}requestSTSToken(){const L=Date.now(),M=`${this.clientId}|${oi}|${L}`,V={Action:"AssumeSlsRoleV2",AuthInfo:et.MD5(M).toString(et.enc.Hex),ClientId:this.clientId,BusinessType:"logger",AppVersion:"1.0",Version:"2017-03-14",AuthTimestamp:`${L}`,TerminalType:"web",DeviceModel:"",Format:"JSON",SignatureMethod:"HMAC-SHA1",SignatureVersion:"1.0",Timestamp:zt(L,"isoUtcDateTime")},Q=`https://slsrole.alicdn.com/?${new URLSearchParams(V).toString()}`;return fetch(Q).then(j=>j.json()).then(j=>JSON.parse(window.atob(j.SlsAuthResult)))}createTracker(L){if(!this.tracker){const M={accessKeyId:L.AccessKeyId,accessKeySecret:L.AccessKeySecret,securityToken:L.SecurityToken,refreshSTSTokenInterval:ot,stsTokenFreshTime:void 0,refreshSTSToken:()=>{this.refreshSTSToken().then(j=>{M.accessKeyId=j.AccessKeyId,M.accessKeySecret=j.AccessKeySecret,M.securityToken=j.SecurityToken}).catch(()=>{})}},V=new er(at),Q=Fr(M);V.useStsPlugin(Q),this.slsPlugin=Q,this.tracker=V,this.reportStartAndCache()}}changeConfig(L){L.logLevel!==void 0&&L.logLevel>=He.DEBUG&&L.logLevel<=He.NONE&&(this.logLevel=L.logLevel)}setSessionID(L,M){!L||!M||(this.appId=L,this.sessionId=M,this.reportStartAndCache())}reportStartAndCache(){if(!this.tracker||!this.sessionId)return;this.endReported=!1;const L={task_btm_sec:0,task_duration:0,task_etm_sec:0,task_type:"session"},M=[this.getLogParams(Ke.TASK_UPLOAD_BEGIN,L),this.getLogParams(Ke.SESSION_UPLOAD_BEGIN,L)];this.tracker.sendBatchLogsImmediate(M),this.logCache.forEach(V=>{this.sendLog(V)})}reportEnd(L=!1){if(!this.tracker||!this.sessionId||this.endReported){this.reset();return}const M={task_btm_sec:0,task_duration:0,task_etm_sec:0,task_type:"session"},V=[this.getLogParams(Ke.SESSION_UPLOAD_END,M),this.getLogParams(Ke.TASK_UPLOAD_END,M)];L?this.sendLogBeforeUnload(V):(this.tracker.sendBatchLogsImmediate(V),this.endReported=!0),this.reset()}getLogParams(L,M){return{appid:`${window.location.host}`,appid_list:this.appId,appver:"",b_sesid:this.bSesid,biz_type:"rtc",cpu_info:ii,db:Yr.browserName,dm:Yr.browserVersion,install_uuid:this.clientId,logger_v:"0.0.1",os:qr.systemName,osv:qr.systemVersion,p_sesid:this.bSesid,sdk_version:zr,sdkname:"AliRTCSdk",stm:Date.now(),tar_pf:"web",traceid:this.sessionId,event_id:L,...M||{}}}sendLog(L){if(!this.tracker||!this.sessionId)return;this.logSequence+=1;const M=this.getLogParams(Ke.SESSION_UPLOAD_ING,{log:L,stat_log_seq:this.logSequence});this.tracker.send(M)}addLog(L){const M=qt(),V=`[${Kr()} ${M}] ${L}`;!this.sessionId||!this.tracker?(this.logCache.push(V),this.logCache.length>=ai&&this.logCache.shift()):this.sendLog(V)}}var ci=Object.defineProperty,ui=(Y,L,M)=>L in Y?ci(Y,L,{enumerable:!0,configurable:!0,writable:!0,value:M}):Y[L]=M,di=(Y,L,M)=>ui(Y,L+"",M);class Ze{static getLogger(){return this.logger||(this.logger=new si),this.logger}static init(){this.getLogger().init()}static destroy(){this.getLogger().destroy()}static setLogLevel(L){this.getLogger().changeConfig({logLevel:L})}static setSessionID(L,M){this.getLogger().setSessionID(L,M)}static reportEnd(){this.getLogger().reportEnd()}static interface(...L){this.getLogger().a("[API]",...L)}static interfaceResult(L,M,V,...Q){V?this.getLogger().ar("[ARE]",L,M,...Q):this.getLogger().ae("[ARE]",L,M,...Q)}static event(...L){this.getLogger().ev("[EVT]",...L)}static debug(...L){this.getLogger().d("[DBG]",...L)}static info(...L){this.getLogger().i("[INF]",...L)}static warn(...L){this.getLogger().w("[WARN]",...L)}static error(...L){this.getLogger().e("[ERR]",...L)}}di(Ze,"logger");var li=Object.defineProperty,pi=(Y,L,M)=>L in Y?li(Y,L,{enumerable:!0,configurable:!0,writable:!0,value:M}):Y[L]=M,Xe=(Y,L,M)=>pi(Y,typeof L!="symbol"?L+"":L,M);const Xr=48e3,tt="[AliyunAudio3A] ";class fi extends Jr{constructor(L){super("AliRtcAudioProcessPlugin",$r.AliRtcSdkStreamTypeCapture,Zr.AUDIO),Xe(this,"audioProcessor"),Xe(this,"slsReporter"),Xe(this,"enableSoft3ACheck",!1),Xe(this,"useHardOnly",!1),Xe(this,"lastDiffOutputLog",""),Xe(this,"audioContext",new AudioContext({sampleRate:Xr})),Xe(this,"farNode"),Xe(this,"createNode",M=>this.audioContext.createMediaStreamSource(new MediaStream([M]))),this.options=L,this.slsReporter=L?.slsReporter,this.enableSoft3ACheck=L?.enableSoft3ACheck||!1,this.useHardOnly=L?.useHardOnly||!1,this.zIndex=7,document.addEventListener("click",this.activeAudioContext)}activeAudioContext(){this.audioContext.resume(),document.removeEventListener("click",this.activeAudioContext)}audioUpdated(L){return this.lastInputAudioTrack?.id!==L.currentAudioTrack?.id}videoUpdated(L){return console.log("videoUpdated",L),!1}setOptions(L){this.farNode||!L.farMediaStream||(this.farNode=this.audioContext.createMediaStreamSource(L.farMediaStream),this.audioProcessor&&this.audioProcessor?.addFarNode(this.farNode),this.options={...this.options,...L})}isSupported(){return Jt.isSupported()}shouldUpdate(L){return!!(L.originAudioTrack&&!this.audioProcessor||!L.originAudioTrack&&this.audioProcessor)}async process(L){if(!L.currentAudioTrack){L.updateAudioTrack(),this.clear(L);return}if(!this.audioProcessor){Ze.info(tt,"create audio processor this.options:",this.options),this.audioProcessor=new Jt({aecOn:!0,ansOn:!0,agcOn:!0,dumpOn:this.options?.dumpAudioData||!1,aiaecOn:this.options.aiaecOn||!1,useHardOnly:this.useHardOnly,wasmCdnPath:this.options.wasmCdnPath||"https://g.alicdn.com/code/npm/@ali/aliyun-audio-3a/0.0.6/"}),this.audioProcessor.on("dumpdata",(V,Q)=>{let j=3e3;Q.includes("far")?j=5e3:Q.includes("output")?j=1e4:Q.includes("meta")&&(j=8e3),setTimeout(()=>{const T=URL.createObjectURL(V),_=document.createElement("a");_.href=T,_.download=Q,document.body.appendChild(_),_.click(),document.body.removeChild(_)},j)}),this.audioProcessor.on("loadsuccess",()=>{Ze.info(tt,"loadsuccess"),this.enableSoft3ACheck||L.updateAudioTrack(this.audioProcessor?.targetMediaTrack),this.options.dumpAudioData&&this.audioProcessor?.startDump()}),this.audioProcessor.on("loaderror",V=>{Ze.error(tt,"loaderror:",V?.message),this.emit("error",V)}),this.audioProcessor.on("outputlog",V=>{Ze.info(tt,"outputlog:",V),V?.includes("diff")&&(this.lastDiffOutputLog=V||"")}),this.audioProcessor.on("statdata",V=>{if(V)try{let Q=V;if(this.lastDiffOutputLog){const j=this.extractDiffValue(this.lastDiffOutputLog),T=JSON.parse(V);j!==null&&(T.diff=j);const _=this.extractLeakValue(this.lastDiffOutputLog);_!==null&&(T.leak=_),Q=JSON.stringify(T)}this.slsReporter?.reportPublishAudio3A("","","",Q)}catch(Q){Ze.error(tt,"statdata error:",Q)}});const M=this.createNode(L.currentAudioTrack);await this.audioProcessor.createProcessor(this.audioContext,M,1,Xr,this.farNode)}}extractDiffValue(L){if(!L)return null;const M=L.match(/diff\s*=\s*(-?\d+\.?\d*)/);return M?parseFloat(M[1]):null}extractLeakValue(L){if(!L)return null;const M=L.match(/leak\s*=\s*(-?\d+\.?\d*)/);return M?parseFloat(M[1]):null}clear(L){this.options.dumpAudioData&&this.audioProcessor?.stopDump(),super.clear(L),this.audioProcessor?.destroy(),this.audioProcessor=void 0,document.removeEventListener("click",this.activeAudioContext),this.farNode?.disconnect(),this.farNode=void 0}dump(){this.audioProcessor?.stopDump()}}export{fi as default};
162
+ `);I.RTCSessionDescription&&Q instanceof I.RTCSessionDescription?arguments[0]=new I.RTCSessionDescription({type:Q.type,sdp:Z}):Q.sdp=Z}return q.apply(this,arguments)}}function ke(I,K){if(!I.RTCPeerConnection||!I.RTCPeerConnection.prototype)return;const q=I.RTCPeerConnection.prototype.addIceCandidate;q&&q.length!==0&&(I.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?(K.browser==="chrome"&&K.version<78||K.browser==="firefox"&&K.version<68||K.browser==="safari")&&arguments[0]&&arguments[0].candidate===""?Promise.resolve():q.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}const Ue=function({window:I}={},K={shimChrome:!0,shimFirefox:!0,shimEdge:!0,shimSafari:!0}){const q=a,Q=function(ee){const J={browser:null,version:null};if(ee===void 0||!ee.navigator)return J.browser="Not a browser.",J;const{navigator:ie}=ee;if(ie.mozGetUserMedia)J.browser="firefox",J.version=i(ie.userAgent,/Firefox\/(\d+)\./,1);else if(ie.webkitGetUserMedia||ee.isSecureContext===!1&&ee.webkitRTCPeerConnection&&!ee.RTCIceGatherer)J.browser="chrome",J.version=i(ie.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(ie.mediaDevices&&ie.userAgent.match(/Edge\/(\d+).(\d+)$/))J.browser="edge",J.version=i(ie.userAgent,/Edge\/(\d+).(\d+)$/,2);else{if(!ee.RTCPeerConnection||!ie.userAgent.match(/AppleWebKit\/(\d+)\./))return J.browser="Not a supported browser.",J;J.browser="safari",J.version=i(ie.userAgent,/AppleWebKit\/(\d+)\./,1),J.supportsUnifiedPlan=ee.RTCRtpTransceiver&&"currentDirection"in ee.RTCRtpTransceiver.prototype}return J}(I),Z={browserDetails:Q,commonShim:v,extractVersion:i,disableLog:o,disableWarnings:r};switch(Q.browser){case"chrome":if(!f||!O||!K.shimChrome)return q("Chrome shim is not included in this adapter release."),Z;if(Q.version===null)return q("Chrome shim can not determine version, not shimming."),Z;q("adapter.js shimming chrome."),Z.browserShim=f,ke(I,Q),y(I,Q),S(I),O(I,Q),d(I),g(I,Q),R(I),D(I),A(I),k(I,Q),Ae(I),Me(I),_e(I,Q),xe(I),Ie(I,Q);break;case"firefox":if(!m||!G||!K.shimFirefox)return q("Firefox shim is not included in this adapter release."),Z;q("adapter.js shimming firefox."),Z.browserShim=m,ke(I,Q),V(I,Q),G(I,Q),z(I),te(I),X(I),re(I),oe(I),ue(I),se(I),ce(I),de(I),Ae(I),Me(I),_e(I,Q),xe(I);break;case"edge":if(!l||!N||!K.shimEdge)return q("MS edge shim is not included in this adapter release."),Z;q("adapter.js shimming edge."),Z.browserShim=l,W(I),M(I),N(I,Q),P(I),_e(I,Q),xe(I);break;case"safari":if(!h||!K.shimSafari)return q("Safari shim is not included in this adapter release."),Z;q("adapter.js shimming safari."),Z.browserShim=h,ke(I,Q),ge(I),Re(I),Ee(I),pe(I),he(I),be(I),fe(I),Te(I),Ae(I),_e(I,Q),xe(I),Ie(I,Q);break;default:q("Unsupported browser!")}return Z}({window:typeof window>"u"?void 0:window}),De=Ue},6834:(H,T,_)=>{_.r(T),_.d(T,{default:()=>m});var f=_(5512),l=_.n(f);function m(){return l()('/*! aliyun rts sdk - ver2.13.2 created:2025/10/14 11:48:41 */(()=>{"use strict";var e={28:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.default={version:"2.13.2",protocol_version:2,sdk_version:"0.0.1"}},917:(e,t)=>{var r,o,n,i;Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_RETRY_DATACHANNEL_TIMEOUT=t.DEFAULT_HEARTBEAT_TIMEOUT=t.DEFAULT_RETRY_PUBLISH_INTERVAL=t.DEFAULT_RETRY_SUBSCRIBE_INTERVAL=t.DEFAULT_RETRY_PUBLISH_LIMIT=t.DEFAULT_RETRY_SUBSCRIBE_LIMIT=t.EWorkerAction=t.EWorkerSource=t.EConnectStatus=t.TrackType=void 0,function(e){e.AUDIO="audio",e.VIDEO="video"}(r||(t.TrackType=r={})),function(e){e[e.CONNECT_STATUS_DISCONNECTED=0]="CONNECT_STATUS_DISCONNECTED",e[e.CONNECT_STATUS_CONNECTING=1]="CONNECT_STATUS_CONNECTING",e[e.CONNECT_STATUS_CONNECTED=2]="CONNECT_STATUS_CONNECTED",e[e.CONNECT_STATUS_RECONNECTING=3]="CONNECT_STATUS_RECONNECTING"}(o||(t.EConnectStatus=o={})),function(e){e.Sender="sender",e.Receiver="receiver"}(n||(t.EWorkerSource=n={})),function(e){e.Setup="setup",e.InserSEI="insertSEI",e.UpdatePubStats="updatePubStats",e.UpdateSubStats="updateSubStats",e.SwitchCumuDelay="switchCumuDelay"}(i||(t.EWorkerAction=i={})),t.DEFAULT_RETRY_SUBSCRIBE_LIMIT=5,t.DEFAULT_RETRY_PUBLISH_LIMIT=5,t.DEFAULT_RETRY_SUBSCRIBE_INTERVAL=2e3,t.DEFAULT_RETRY_PUBLISH_INTERVAL=2e3,t.DEFAULT_HEARTBEAT_TIMEOUT=8,t.DEFAULT_RETRY_DATACHANNEL_TIMEOUT=8e3},649:function(e,t,r){var o,n,i=this&&this.__assign||function(){return i=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},i.apply(this,arguments)},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.CumuDelaySeiPayloadParser=t.CumuDelaySeiPayload=t.ECumuDelayGrtnKey=t.ECumuDelayPubSdkKey=t.ECumuDelayAVCommonKey=t.ECumuDelayVideoKey=t.ECumuDelayGrtnExportKey=t.ECumuDelaySubKey=t.CUMU_DELAY_UUID=t.CUMU_DELAY_SEI_PAYLOAD_TYPE=void 0;var s,u,l,A,C=a(r(28));t.CUMU_DELAY_SEI_PAYLOAD_TYPE=99,t.CUMU_DELAY_UUID=[32,36,16,9,16,23,7,1,150,117,25,212,25,129,3,7],function(e){e.SophonAudioDual="sophon_audio_dual",e.SophonVideoCamera="sophon_video_camera",e.SophonVideoCameraSmall="sophon_video_camera_small",e.SophonVideoCameraSuper="sophon_video_camera_super",e.SophonVideoScreenShare="sophon_video_screen_share",e.SophonAudio="sophon_audio",e.SophonVideoCameraLarge="sophon_video_camera_large",e.RtsAudio="rts audio",e.RtsVideo="rts video"}(s||(s={})),function(e){e[e.Web=0]="Web",e[e.iOS=1]="iOS",e[e.Android=2]="Android"}(u||(u={})),function(e){e.VTotalCost="VTotalCost",e.VAssemblyCost="VAssemblyCost",e.VJitterBufferDelay="VJitterBufferDelay",e.VDecPlugCost="VDecPlugCost",e.DownRTTHalf="DownRTTHalf"}(l||(t.ECumuDelaySubKey=l={})),function(e){e.TOTAL_COST="TOTAL_COST",e.ENTER_GRTN_TIMESTAMP="ENTER_GRTN_TIMESTAMP",e.LEAVE_GRTN_TIMESTAMP="LEAVE_GRTN_TIMESTAMP"}(A||(t.ECumuDelayGrtnExportKey=A={}));var c,T,f,d,E,_,y,S=((o={})[s.SophonAudioDual]=4,o[s.SophonVideoCamera]=5,o[s.SophonVideoCameraSmall]=6,o[s.SophonVideoCameraSuper]=7,o[s.SophonVideoScreenShare]=8,o[s.SophonAudio]=9,o[s.SophonVideoCameraLarge]=10,o[s.RtsAudio]=11,o[s.RtsVideo]=12,o);(n={})[S[s.SophonAudioDual]]=s.SophonAudioDual,n[S[s.SophonVideoCamera]]=s.SophonVideoCamera,n[S[s.SophonVideoCameraSmall]]=s.SophonVideoCameraSmall,n[S[s.SophonVideoCameraSuper]]=s.SophonVideoCameraSuper,n[S[s.SophonVideoScreenShare]]=s.SophonVideoScreenShare,n[S[s.SophonAudio]]=s.SophonAudio,n[S[s.SophonVideoCameraLarge]]=s.SophonVideoCameraLarge,n[S[s.RtsAudio]]=s.RtsAudio,n[S[s.RtsVideo]]=s.RtsVideo;!function(e){e[e.VTotalCost=4]="VTotalCost",e[e.CapDeviceCost=5]="CapDeviceCost",e[e.PushExtCost=6]="PushExtCost",e[e.CapPlugCost=7]="CapPlugCost",e[e.PrepThrCost=8]="PrepThrCost",e[e.PrepPlugCost=9]="PrepPlugCost",e[e.DispThrCost=10]="DispThrCost",e[e.DispPlugCost=11]="DispPlugCost",e[e.VEncThrCost=12]="VEncThrCost",e[e.VEncPlugCost=13]="VEncPlugCost"}(c||(t.ECumuDelayVideoKey=c={})),function(e){e[e.ATotalCost=24]="ATotalCost",e[e.ASourceCCost=25]="ASourceCCost",e[e.AMixerCost=26]="AMixerCost",e[e.AEncodeCCost=27]="AEncodeCCost",e[e.AAIClientQuestionTimestampHEAD=28]="AAIClientQuestionTimestampHEAD",e[e.AAIClientQuestionTimestampTAIL=29]="AAIClientQuestionTimestampTAIL",e[e.AAIClientAnswerTimestampHEAD=30]="AAIClientAnswerTimestampHEAD",e[e.AAIClientAnswerTimestampTAIL=31]="AAIClientAnswerTimestampTAIL",e[e.AAIClientScentenceId=32]="AAIClientScentenceId",e[e.AAIClientSourceCost=33]="AAIClientSourceCost",e[e.AAIClientMixerCost=34]="AAIClientMixerCost",e[e.AAIClientEncoderCost=35]="AAIClientEncoderCost",e[e.AAILinuxReceiveCost=36]="AAILinuxReceiveCost",e[e.AAILinuxNeteqCost=37]="AAILinuxNeteqCost",e[e.AAILinuxRemoteSourceCost=38]="AAILinuxRemoteSourceCost",e[e.AAILinuxPlayMixerCost=39]="AAILinuxPlayMixerCost",e[e.AAILinuxPlayCost=40]="AAILinuxPlayCost",e[e.AAIClientQuestionUidDigestHEAD=41]="AAIClientQuestionUidDigestHEAD",e[e.AAIClientQuestionUidDigestTAIL=42]="AAIClientQuestionUidDigestTAIL",e[e.AIClinetSmartDenoise=43]="AIClinetSmartDenoise"}(T||(T={})),function(e){e[e.NetsdkThrCost=44]="NetsdkThrCost",e[e.QosThrCost=45]="QosThrCost",e[e.PacerCost=46]="PacerCost",e[e.UpRTTHalf=47]="UpRTTHalf",e[e.AIClientNetsdkThrCost=48]="AIClientNetsdkThrCost",e[e.AIClientQosThrCost=49]="AIClientQosThrCost",e[e.AIClientPacerCost=50]="AIClientPacerCost",e[e.AIClientUpRTTHalf=51]="AIClientUpRTTHalf"}(f||(t.ECumuDelayAVCommonKey=f={})),function(e){e[e.AIAsrCost=64]="AIAsrCost",e[e.AILlmCost=65]="AILlmCost",e[e.AITtsCost=66]="AITtsCost",e[e.AIMuteCost=67]="AIMuteCost",e[e.AIAgentTotalCost=68]="AIAgentTotalCost",e[e.AIAgentExtraAvatarCost=69]="AIAgentExtraAvatarCost"}(d||(d={})),function(e){e[e.PubSdkType=100]="PubSdkType",e[e.PubSdkVersion=101]="PubSdkVersion"}(E||(t.ECumuDelayPubSdkKey=E={})),function(e){e[e.NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_INTERNAL_RTT_HALF=121]="NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_INTERNAL_RTT_HALF",e[e.NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_GRTN_NODE_BEF_PACER=122]="NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_GRTN_NODE_BEF_PACER",e[e.NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_GRTN_NODE_PACER_COST=123]="NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_GRTN_NODE_PACER_COST",e[e.NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_DOWN_RTT_HALF=124]="NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_DOWN_RTT_HALF"}(_||(t.ECumuDelayGrtnKey=_={})),function(e){e[e.AIGRTNInternalRTTHalf=104]="AIGRTNInternalRTTHalf",e[e.AIGRTNBeforePacer=105]="AIGRTNBeforePacer",e[e.AIGRTNPacerCost=106]="AIGRTNPacerCost",e[e.AIGRTNDownRTTHalf=107]="AIGRTNDownRTTHalf"}(y||(y={}));var p=function(e){e.msid=s.SophonAudio;var t=S[e.msid];t||console.warn("No mapped msid for cumuDelay",e.msid);var r=new ArrayBuffer(e.sendTs?8:4);if(e.sendTs){var o=Math.floor(performance.now()+performance.timeOrigin-e.windowTimeOrigin);o>=Math.pow(2,32)-1&&(o=0);var n=new DataView(r);n.setUint8(0,8),n.setUint8(1,0),n.setUint8(2,t),n.setUint8(3,5),n.setUint32(4,o)}else new Uint8Array(r).set([0,0,t,1]);e.kv[E.PubSdkType]=u.Web,e.kv[E.PubSdkVersion]=Number(C.default.version.split(".").join("").split("-")[0]);var a=Object.keys(e.kv).length;a>256&&console.warn("Too much kv");var l,A,T,d,_=1+3*a+1,y=new ArrayBuffer(_),p=new DataView(y);p.setInt8(0,a),Object.keys(e.kv).forEach((function(t,r){t in i(i(i({},c),f),E)||console.warn("Unknown CumuDelay key: ".concat(t));var o=e.kv[t],n=1+3*r;p.setUint8(n,parseInt(t)),p.setUint16(n+1,o)})),p.setUint8(_-1,128),this.buffer=(l=r,A=y,T=new ArrayBuffer(l.byteLength+A.byteLength),(d=new Uint8Array(T)).set(new Uint8Array(l),0),d.set(new Uint8Array(A),l.byteLength),T)};t.CumuDelaySeiPayload=p;var h=function(e){var t;this.pub={},this.grtn={},this.AIPub={},this.AISub={},this.AIAgent={},this.AIGrtn={},this.other={};var r,o,n=new v(e),i=(n.readBits(3),n.readBits()),a=n.readBits(),s=n.readBits(),u=n.readBits(),l=n.readBits();n.readBits(8),n.readBits(8),n.readBits(8),1===i&&n.readBits(16);if(1===a){var C=n.readBits(32);this.pub.timestamp=C,this.pub.timestampRecv=Math.floor(performance.now())}1===s&&n.readBits(16);1===u&&(r=n.readBits(32)),1===l&&(o=n.readBits(32)),r&&o&&(this.grtn=((t={})[A.TOTAL_COST]=o-r,t[A.ENTER_GRTN_TIMESTAMP]=r,t[A.LEAVE_GRTN_TIMESTAMP]=o,t));for(var S=n.readBits(8),p=0;p<S;p++){var h=n.readBits(8),m=n.readBits(16);if(I(h,[c.VTotalCost,c.VEncPlugCost])||I(h,[T.ATotalCost,T.AEncodeCCost])||I(h,[f.NetsdkThrCost,f.UpRTTHalf])||I(h,[E.PubSdkType,E.PubSdkVersion])){var b=c[h]||T[h]||f[h]||E[h];this.pub[b]=m}else if(I(h,[T.AAIClientQuestionTimestampHEAD,T.AAIClientEncoderCost])||I(h,[f.AIClientNetsdkThrCost,f.AIClientUpRTTHalf]))b=T[h]||f[h],this.AIPub[b]=m;else if(I(h,[T.AAILinuxReceiveCost,T.AIClinetSmartDenoise]))b=T[h],this.AISub[b]=m;else if(I(h,[d.AIAsrCost,d.AIAgentExtraAvatarCost]))b=d[h],this.AIAgent[b]=m;else if(I(h,[y.AIGRTNInternalRTTHalf,y.AIGRTNDownRTTHalf])){b=y[h];for(var D=0,U="".concat(b,"_").concat(D);this.AIGrtn.hasOwnProperty(U);)U="".concat(b,"_").concat(D++);this.AIGrtn[U]=m}else if(I(h,[_.NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_INTERNAL_RTT_HALF,_.NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_DOWN_RTT_HALF])){for(b=_[h],D=0,U="".concat(b,"_").concat(D);this.grtn.hasOwnProperty(U);)U="".concat(b,"_").concat(D++);this.grtn[U]=m}else this.other[h]=m}};function I(e,t){return e>=t[0]&&e<=t[1]}t.CumuDelaySeiPayloadParser=h;var v=function(){function e(e){this.byteOffset=0,this.bitOffset=0;var t=new Uint8Array(e);this.buffer=t}return e.prototype.readBits=function(e){void 0===e&&(e=1);for(var t=0,r=0;r<e;){if(this.byteOffset>=this.buffer.byteLength)throw new Error("readBits out of range");var o=8-this.bitOffset,n=Math.min(o,e-r);t=t<<n|this.getBitsFromByte(this.buffer,this.byteOffset,this.bitOffset,this.bitOffset+n-1),this.bitOffset+=n,r+=n,8===this.bitOffset&&(this.byteOffset++,this.bitOffset=0)}return 32===e&&(t>>>=0),t},e.prototype.hasNext=function(){return this.byteOffset<this.buffer.byteLength},e.prototype.getBitsFromByte=function(e,t,r,o){if(t<0||t>=e.byteLength||r<0||o>7||r>o)throw new Error("Invalid parameters");return e[t]>>7-o&(1<<o-r+1)-1},e}()},594:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.readUUID=t.discardEPB=t.insertEPB=t.SODBtoRBSP=t.convertPayloadSize=t.NALU=t.SEI=t.parseSei=t.insertSei=void 0;var o=r(649);t.insertSei=function(e,t,r,o){void 0===r&&(r=5);for(var a=e.data,s=new DataView(a),u=0;;){if(1===s.getUint32(u)){s.getUint8(u+4);var l=new n(t,r,o).buffer,A=new i(l).buffer,C=new ArrayBuffer(A.byteLength+a.byteLength),c=new Uint8Array(C),T=new Uint8Array(A);c.set(T);var f=new Uint8Array(a);c.set(f,A.byteLength),e.data=C,u+=1;break}if((u+=1)+4>=s.byteLength)break}};t.parseSei=function(e){for(var r=[],o=new DataView(e),n=0;;){var i=n,s=o.getUint32(i);if(i+=4,1===s){if(6===(31&o.getUint8(i++))){for(var u=o.getUint8(i++),l=a(u)?16:0,A=0;255==o.getUint8(i);)i++,A+=255;if((A+=o.getUint8(i++))>0&&o.byteLength>i+A){var C=new Uint8Array(o.buffer),c="";if(a(u)){var T=C.slice(i,i+l);c=(0,t.readUUID)((0,t.discardEPB)(T))}var f=C.slice(i+l,i+A);i+=A,r.push({payloadType:u,uuid:c,data:f.buffer})}}n=i}else n+=1;if(n+4>=o.byteLength)break}return r};var n=function(e,r,o){void 0===r&&(r=5);var n=a(r)?16:0,i=e.byteLength+n,s=(0,t.convertPayloadSize)(i),u=s.buffer.byteLength,l=new ArrayBuffer(1+u+n+e.byteLength),A=new Uint8Array(l),C=0;if(A[C++]=r,A.set(s,C),C+=s.byteLength,a(r)){o=(o||"00000000-0000-0000-0000-000000000000").replace(/-/g,"");for(var c=0;c<16;c++)A[C+c]=parseInt(o.substr(2*c,2),16);C+=16}var T=new Uint8Array(e);A.set(T,C);var f=(0,t.SODBtoRBSP)(A);this.buffer=f.buffer};t.SEI=n;var i=function(e){var t=new Uint8Array([0,0,0,1]),r=new Uint8Array([6]),o=new ArrayBuffer(t.byteLength+r.byteLength+e.byteLength),n=new Uint8Array(o);n.set(t),n.set(r,t.byteLength),n.set(new Uint8Array(e),t.byteLength+r.byteLength),this.buffer=o};t.NALU=i;t.convertPayloadSize=function(e){if(e<=0)throw new Error("payloadSize must be a positive integer.");for(var t=Math.ceil(e/255),r=new ArrayBuffer(t),o=new DataView(r),n=0;n<t-1;n++)o.setUint8(n,255);return o.setUint8(t-1,e%255&255),new Uint8Array(r)};t.SODBtoRBSP=function(e){for(var r=new Uint8Array(e),o="",n=0;n<r.length;n++)o+=r[n].toString(2).padStart(8,"0");for(o+="1";o.length%8!=0;)o+="0";var i=o.length/8,a=new Uint8Array(i);for(n=0;n<i;n++)a[n]=parseInt(o.slice(8*n,8*n+8),2);return(0,t.insertEPB)(a)};t.insertEPB=function(e){for(var t=[],r=0,o=0;o<e.length;o++)t.push(e[o]),0===e[o]?2===++r&&o<e.length-1&&e[o+1]<=3&&(t.push(3),r=0):r=0;return new Uint8Array(t)};t.discardEPB=function(e){for(var t=e.byteLength,r=[],o=1;o<t-2;)0===e[o]&&0===e[o+1]&&3===e[o+2]?(r.push(o+2),o+=2):o++;if(0===r.length)return e;var n=t-r.length,i=new Uint8Array(n),a=0;for(o=0;o<n;a++,o++)a===r[0]&&(a++,r.shift()),i[o]=e[a];return i};t.readUUID=function(e){if(16!==e.length)throw new Error("UUID must be 16 bytes long.");var t=e.reduce((function(e,t){return e+t.toString(16).padStart(2,"0")}),"");return"".concat(t.slice(0,8),"-").concat(t.slice(8,12),"-").concat(t.slice(12,16),"-").concat(t.slice(16,20),"-").concat(t.slice(20))};var a=function(e){return 5===e||e===o.CUMU_DELAY_SEI_PAYLOAD_TYPE}},718:function(e,t){var r=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var o,n=0,i=t.length;n<i;n++)!o&&n in t||(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.hebtLog=t.createUUID=t.evaluateNetworkCondition=t.makeCancelable=t.hasVideoTrack=t.hasAudioTrack=t.getVideoTrack=t.getAudioTrack=t.pruneSubUrl=t.getJitterBufferDelayAvg=void 0,t.lowercaseFirstLetter=function(e){return e.replace(/([A-Za-z])/,(function(e){return e.toLowerCase()}))},t.underlineToCamelCase=function(e){return e.replace(/_([a-z])/g,(function(e,t){return t.toUpperCase()}))};t.getJitterBufferDelayAvg=function(e,t){return e&&t?Number(e)/Number(t)*1e3:-1};t.pruneSubUrl=function(e,t){var r=e||"";return r=r.replace("@subaudio=no","").replace("@subvideo=no",""),t&&(r=r.split("?")[0]),r};t.getAudioTrack=function(e){return e.getAudioTracks()[0]};t.getVideoTrack=function(e){return e.getVideoTracks()[0]};t.hasAudioTrack=function(e){return e.getAudioTracks().length>0};t.hasVideoTrack=function(e){return e.getVideoTracks().length>0};t.makeCancelable=function(e){var t=!1;return{promise:new Promise((function(r,o){e.then((function(e){return t?o({isCanceled:!0}):r(e)})),e.catch((function(e){return o(t?{isCanceled:!0}:e)}))})),cancel:function(){t=!0}}};t.evaluateNetworkCondition=function(e,t,r,o,n){var i=0;if(!navigator.onLine)return i=6;var a=[{loss:0,rtt:0,jbd:1},{loss:0,rtt:1,jbd:0},{loss:0,rtt:.5,jbd:.5},{loss:1,rtt:0,jbd:0},{loss:.8,rtt:0,jbd:.2},{loss:.8,rtt:.2,jbd:0},{loss:.6,rtt:.2,jbd:.2}],s=-1,u=-1,l=-1;if("number"==typeof t&&t>=0||"number"==typeof r&&r>=0){s=0;var A=!1,C=!1;"number"==typeof t&&t>=0&&(s+=t,A=!0),"number"==typeof r&&r>=0&&(s+=r,C=!0),A&&!C&&(s*=2),C&&!A&&(s*=1.8)}if("number"==typeof e&&e>=0&&(l=e),"number"==typeof o&&o>=0||"number"==typeof n&&n>=0){u=0;"number"==typeof o&&o>=0&&(u+=o),"number"==typeof n&&n>=0&&(u+=n)}var c;if((c=4*(-1!==s?1:0)+2*(-1!==l?1:0)+(-1!==u?1:0))>0){var T=1.2*s*a[c-1].loss+l/1500*a[c-1].rtt+u/3e3*a[c-1].jbd;i=T<=.1?1:T<=.23?2:T<=.36?3:T<=.49?4:5}else i=0;return i};t.createUUID=function(e,t){var r,o="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),n=[];if(t=t||o.length,e)for(r=0;r<e;r++)n[r]=o[0|Math.random()*t];else{var i=void 0;for(n[8]=n[13]=n[18]=n[23]="-",n[14]="4",r=0;r<36;r++)n[r]||(i=0|16*Math.random(),n[r]=o[19==r?3&i|8:i])}return n.join("")};t.hebtLog=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];window.RTS_HEBT_DEBUG&&console.log.apply(console,r(["[rts hebt]"],e,!1))}}},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var i=t[o]={exports:{}};return e[o].call(i.exports,i,i.exports,r),i.exports}var o,n,i,a,s,u,l,A,C,c,T,f;a=r(594),s=r(718),u=r(649),l=r(917),A=self,C=!1,c=0,T=function(e,t,r,s){if(e===l.EWorkerSource.Sender){var A=new TransformStream({transform:function(e,t){var r=e;if(e.type){if(o)try{(!o.keyframeOnly||o.keyframeOnly&&"key"===e.type)&&((0,a.insertSei)(e,o.sei,o.payloadType,o.uuid),void 0===o.repeatCount?o=null:-1!==o.repeatCount&&(o.repeatCount--,o.repeatCount<0&&(o=null)))}catch(t){e=r,console.log("error in inserting user SEI",t)}else if(C)try{if("key"===e.type&&n){var i={};n.v_encode_time_avg&&(i[u.ECumuDelayVideoKey.VEncPlugCost]=Math.ceil(n.v_encode_time_avg)),n.v_packet_send_delay_avg&&(i[u.ECumuDelayAVCommonKey.PacerCost]=Math.ceil(n.v_packet_send_delay_avg)),n.rtt&&(i[u.ECumuDelayAVCommonKey.UpRTTHalf]=Math.ceil(n.rtt/2*1e3)),i[u.ECumuDelayVideoKey.VTotalCost]=Math.ceil((i[u.ECumuDelayVideoKey.VEncPlugCost]||0)+(i[u.ECumuDelayAVCommonKey.PacerCost]||0)),(0,a.insertSei)(e,new u.CumuDelaySeiPayload({msid:n.vMsid||"",kv:i,sendTs:!0,windowTimeOrigin:c}).buffer,u.CUMU_DELAY_SEI_PAYLOAD_TYPE,(0,a.readUUID)(new Uint8Array(u.CUMU_DELAY_UUID)))}}catch(t){e=r,console.log("error in inserting cumuDelay SEI",t)}r=null,s&&s(e)}t.enqueue(e)}});t.pipeThrough(A).pipeTo(r)}else e===l.EWorkerSource.Receiver&&(A=new TransformStream({transform:function(e,t){var r,o,n,a,l,A,C,c,T,f,d,E=e;if(e.type){try{if(i){var _=((r={})[u.ECumuDelaySubKey.DownRTTHalf]=Math.ceil(((null===(n=null===(o=i.video)||void 0===o?void 0:o.transportStats)||void 0===n?void 0:n.rtt)||0)/2*1e3),r[u.ECumuDelaySubKey.VAssemblyCost]=Math.ceil((null===(l=null===(a=i.video)||void 0===a?void 0:a.inboundRtpStatsPerSec)||void 0===l?void 0:l.totalAssemblyTimeAvg)||0),r[u.ECumuDelaySubKey.VJitterBufferDelay]=Math.ceil((null===(C=null===(A=i.video)||void 0===A?void 0:A.inboundRtpStatsPerSec)||void 0===C?void 0:C.jitterBufferDelayAvg)||0),r[u.ECumuDelaySubKey.VDecPlugCost]=Math.ceil((null===(T=null===(c=i.video)||void 0===c?void 0:c.inboundRtpStatsPerSec)||void 0===T?void 0:T.decodeTimeAvg)||0),r[u.ECumuDelaySubKey.VTotalCost]=Math.ceil((null===(d=null===(f=i.video)||void 0===f?void 0:f.inboundRtpStatsPerSec)||void 0===d?void 0:d.totalProcessingDelayAvg)||0),r);_[u.ECumuDelaySubKey.VTotalCost]||(_[u.ECumuDelaySubKey.VTotalCost]=Math.ceil((_[u.ECumuDelaySubKey.VAssemblyCost]||0)+(_[u.ECumuDelaySubKey.VJitterBufferDelay]||0)+(_[u.ECumuDelaySubKey.VDecPlugCost]||0))),e.subStats=_}}catch(t){console.log("error in parsing SEI",t),e=E}E=null,s&&s(e)}delete e.subStats,t.enqueue(e)}}),t.pipeThrough(A).pipeTo(r))},f=function(e){var t=e.data.slice(0);A.postMessage({type:"encodedFrame",data:t,frameInfo:{type:e.type,timestamp:e.timestamp},subStats:e.subStats},[t]),t=null},A.RTCTransformEvent&&(A.onrtctransform=function(e){var t=e.transformer,r=t.options.source,o=t.readable,n=t.writable;T(r,o,n,(function(e){r===l.EWorkerSource.Receiver&&f(e)}))}),onmessage=function(e){switch(e.data.operation){case l.EWorkerAction.Setup:t=e.data,r=t.source,a=t.readable,u=t.writable,T(r,a,u,(function(e){r===l.EWorkerSource.Receiver&&f(e)}));break;case l.EWorkerAction.InserSEI:!function(e){(o=e)&&(o.uuid=(0,s.createUUID)().toLowerCase(),o.repeatCount=o.repeatCount||0)}(e.data);break;case l.EWorkerAction.UpdatePubStats:!function(e){n=e.stats}(e.data);break;case l.EWorkerAction.UpdateSubStats:!function(e){i=e.stats}(e.data);break;case l.EWorkerAction.SwitchCumuDelay:!function(e){C=e.enable,c=e.windowTimeOrigin}(e.data)}var t,r,a,u}})();',"Worker",void 0,void 0)}},5512:H=>{H.exports=function(T,_,f,l){var m=self||window;try{try{var h;try{h=new m.Blob([T])}catch{(h=new(m.BlobBuilder||m.WebKitBlobBuilder||m.MozBlobBuilder||m.MSBlobBuilder)).append(T),h=h.getBlob()}var v=m.URL||m.webkitURL,u=v.createObjectURL(h),s=new m[_](u,f);return v.revokeObjectURL(u),s}catch{return new m[_]("data:application/javascript,".concat(encodeURIComponent(T)),f)}}catch{if(!l)throw Error("Inline worker is not supported");return new m[_](l,f)}}},2632:(H,T,_)=>{_.r(T),_.d(T,{default:()=>i});function f(e,o,r){Object.defineProperty(e,o,{writable:!0,enumerable:!0,configurable:!0,value:r})}Array(32);var l,m,h;class v{constructor(o){var r,a;this.timer=null,this.time=10,this.count=10,this.arr=[],this.time=(r=o.time)!=null?r:10,this.count=(a=o.count)!=null?a:10,o.host.startsWith("http://")||o.host.startsWith("https://")?this.url=o.host+"/logstores/"+o.logstore+"/track":this.url="https://"+o.project+"."+o.host+"/logstores/"+o.logstore+"/track",this.opt=o,o.installUnloadHook&&typeof o.installUnloadHook=="function"&&o.installUnloadHook(()=>{this.sendImmediateInner()})}assemblePayload(o=this.arr){const r={__logs__:o};return this.opt.tags&&(r.__tags__=this.opt.tags),this.opt.topic&&(r.__topic__=this.opt.topic),this.opt.source&&(r.__source__=this.opt.source),JSON.stringify(r)}platformSend(){if(this.opt.sendPayload&&typeof this.opt.sendPayload=="function"){const o=this.assemblePayload();this.opt.sendPayload(this.url,o)}}transString(o){let r={};for(let a in o)typeof o[a]=="object"?r[a]=JSON.stringify(o[a]):r[a]=String(o[a]);return r}sendImmediateInner(){this.arr&&this.arr.length>0&&(this.platformSend(),this.timer!=null&&(clearTimeout(this.timer),this.timer=null),this.arr=[])}sendInner(){if(this.timer)this.arr.length>=this.count&&(clearTimeout(this.timer),this.timer=null,this.sendImmediateInner());else{const o=this;this.arr.length>=this.count||this.time<=0?this.sendImmediateInner():this.timer=setTimeout(function(){o.sendImmediateInner()},1e3*this.time)}}send(o){const r=this.transString(o);this.arr.push(r),this.sendInner()}sendImmediate(o){const r=this.transString(o);this.arr.push(r),this.sendImmediateInner()}sendBatchLogs(o){const r=o.map(a=>this.transString(a));this.arr.push(...r),this.sendInner()}sendBatchLogsImmediate(o){const r=o.map(a=>this.transString(a));this.arr.push(...r),this.sendImmediateInner()}}function u(e,o){const r=new window.XMLHttpRequest;r.open("POST",`${e}?APIVersion=0.6.0`,!0),r.send(o)}function s(e,o){try{if(o.length>=32768)return void u(e,o);(function(r,a){return!(!navigator||!navigator.sendBeacon)&&navigator.sendBeacon(`${r}?APIVersion=0.6.0`,a)})(e,o)||u(e,o)}catch(r){window&&window.console&&typeof window.console.error=="function"&&(console.error(`Failed to log to ali log service because of this exception:
163
+ `+r),console.error("Failed log data:",e))}}class i extends v{constructor(o){super(Object.assign({},o,{installUnloadHook:r=>{window.addEventListener("beforeunload",()=>{r()})},sendPayload:(r,a)=>{s(r,a)}}))}}l=window,m="SLS_Tracker",h=i,f(l,m,h)},4198:H=>{H.exports=JSON.parse('{"name":"axios","version":"0.21.4","description":"Promise based HTTP client for the browser and node.js","main":"index.js","scripts":{"test":"grunt test","start":"node ./sandbox/server.js","build":"NODE_ENV=production grunt build","preversion":"npm test","version":"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json","postversion":"git push && git push --tags","examples":"node ./examples/server.js","coveralls":"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js","fix":"eslint --fix lib/**/*.js"},"repository":{"type":"git","url":"https://github.com/axios/axios.git"},"keywords":["xhr","http","ajax","promise","node"],"author":"Matt Zabriskie","license":"MIT","bugs":{"url":"https://github.com/axios/axios/issues"},"homepage":"https://axios-http.com","devDependencies":{"coveralls":"^3.0.0","es6-promise":"^4.2.4","grunt":"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1","karma":"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2","minimist":"^1.2.0","mocha":"^8.2.1","sinon":"^4.5.0","terser-webpack-plugin":"^4.2.3","typescript":"^4.0.5","url-search-params":"^0.10.0","webpack":"^4.44.2","webpack-dev-server":"^3.11.0"},"browser":{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},"jsdelivr":"dist/axios.min.js","unpkg":"dist/axios.min.js","typings":"./index.d.ts","dependencies":{"follow-redirects":"^1.14.0"},"bundlesize":[{"path":"./dist/axios.min.js","threshold":"5kB"}]}')}},F={};function $(H){var T=F[H];if(T!==void 0)return T.exports;var _=F[H]={exports:{}};return B[H].call(_.exports,_,_.exports,$),_.exports}return $.n=H=>{var T=H&&H.__esModule?()=>H.default:()=>H;return $.d(T,{a:T}),T},$.d=(H,T)=>{for(var _ in T)$.o(T,_)&&!$.o(H,_)&&Object.defineProperty(H,_,{enumerable:!0,get:T[_]})},$.o=(H,T)=>Object.prototype.hasOwnProperty.call(H,T),$.r=H=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(H,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(H,"__esModule",{value:!0})},$(8156)})())})(Vr);for(var jn=Vr.exports,Le=[],Gt=0;Gt<256;++Gt)Le.push((Gt+256).toString(16).slice(1));function Wn(Y,L=0){return(Le[Y[L+0]]+Le[Y[L+1]]+Le[Y[L+2]]+Le[Y[L+3]]+"-"+Le[Y[L+4]]+Le[Y[L+5]]+"-"+Le[Y[L+6]]+Le[Y[L+7]]+"-"+Le[Y[L+8]]+Le[Y[L+9]]+"-"+Le[Y[L+10]]+Le[Y[L+11]]+Le[Y[L+12]]+Le[Y[L+13]]+Le[Y[L+14]]+Le[Y[L+15]]).toLowerCase()}var nt,Gn=new Uint8Array(16);function zn(){if(!nt&&(nt=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!nt))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return nt(Gn)}var Yn=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Hr={randomUUID:Yn};function ot(Y,L,B){if(Hr.randomUUID&&!L&&!Y)return Hr.randomUUID();Y=Y||{};var F=Y.random||(Y.rng||zn)();return F[6]=F[6]&15|64,F[8]=F[8]&63|128,Wn(F)}var qn=/d{1,4}|D{3,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|W{1,2}|[LlopSZN]|"[^"]*"|'[^']*'/g,Kn=/\b(?:[A-Z]{1,3}[A-Z][TC])(?:[-+]\d{4})?|((?:Australian )?(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time)\b/g,Xn=/[^-+\dA-Z]/g;function zt(Y,L,B,F){if(arguments.length===1&&typeof Y=="string"&&!/\d/.test(Y)&&(L=Y,Y=void 0),Y=Y||Y===0?Y:new Date,Y instanceof Date||(Y=new Date(Y)),isNaN(Y))throw TypeError("Invalid date");L=String(jr[L]||L||jr.default);var $=L.slice(0,4);($==="UTC:"||$==="GMT:")&&(L=L.slice(4),B=!0,$==="GMT:"&&(F=!0));var H=function(){return B?"getUTC":"get"},T=function(){return Y[H()+"Date"]()},_=function(){return Y[H()+"Day"]()},f=function(){return Y[H()+"Month"]()},l=function(){return Y[H()+"FullYear"]()},m=function(){return Y[H()+"Hours"]()},h=function(){return Y[H()+"Minutes"]()},v=function(){return Y[H()+"Seconds"]()},u=function(){return Y[H()+"Milliseconds"]()},s=function(){return B?0:Y.getTimezoneOffset()},i=function(){return Qn(Y)},e=function(){return $n(Y)},o={d:function(){return T()},dd:function(){return je(T())},ddd:function(){return Ve.dayNames[_()]},DDD:function(){return Wr({y:l(),m:f(),d:T(),_:H(),dayName:Ve.dayNames[_()],short:!0})},dddd:function(){return Ve.dayNames[_()+7]},DDDD:function(){return Wr({y:l(),m:f(),d:T(),_:H(),dayName:Ve.dayNames[_()+7]})},m:function(){return f()+1},mm:function(){return je(f()+1)},mmm:function(){return Ve.monthNames[f()]},mmmm:function(){return Ve.monthNames[f()+12]},yy:function(){return String(l()).slice(2)},yyyy:function(){return je(l(),4)},h:function(){return m()%12||12},hh:function(){return je(m()%12||12)},H:function(){return m()},HH:function(){return je(m())},M:function(){return h()},MM:function(){return je(h())},s:function(){return v()},ss:function(){return je(v())},l:function(){return je(u(),3)},L:function(){return je(Math.floor(u()/10))},t:function(){return m()<12?Ve.timeNames[0]:Ve.timeNames[1]},tt:function(){return m()<12?Ve.timeNames[2]:Ve.timeNames[3]},T:function(){return m()<12?Ve.timeNames[4]:Ve.timeNames[5]},TT:function(){return m()<12?Ve.timeNames[6]:Ve.timeNames[7]},Z:function(){return F?"GMT":B?"UTC":Jn(Y)},o:function(){return(s()>0?"-":"+")+je(Math.floor(Math.abs(s())/60)*100+Math.abs(s())%60,4)},p:function(){return(s()>0?"-":"+")+je(Math.floor(Math.abs(s())/60),2)+":"+je(Math.floor(Math.abs(s())%60),2)},S:function(){return["th","st","nd","rd"][T()%10>3?0:(T()%100-T()%10!=10)*T()%10]},W:function(){return i()},WW:function(){return je(i())},N:function(){return e()}};return L.replace(qn,function(r){return r in o?o[r]():r.slice(1,r.length-1)})}var jr={default:"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",paddedShortDate:"mm/dd/yyyy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:sso",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'",expiresHeaderFormat:"ddd, dd mmm yyyy HH:MM:ss Z"},Ve={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"],timeNames:["a","p","am","pm","A","P","AM","PM"]},je=function(L){var B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;return String(L).padStart(B,"0")},Wr=function(L){var B=L.y,F=L.m,$=L.d,H=L._,T=L.dayName,_=L.short,f=_===void 0?!1:_,l=new Date,m=new Date;m.setDate(m[H+"Date"]()-1);var h=new Date;h.setDate(h[H+"Date"]()+1);var v=function(){return l[H+"Date"]()},u=function(){return l[H+"Month"]()},s=function(){return l[H+"FullYear"]()},i=function(){return m[H+"Date"]()},e=function(){return m[H+"Month"]()},o=function(){return m[H+"FullYear"]()},r=function(){return h[H+"Date"]()},a=function(){return h[H+"Month"]()},t=function(){return h[H+"FullYear"]()};return s()===B&&u()===F&&v()===$?f?"Tdy":"Today":o()===B&&e()===F&&i()===$?f?"Ysd":"Yesterday":t()===B&&a()===F&&r()===$?f?"Tmw":"Tomorrow":T},Qn=function(L){var B=new Date(L.getFullYear(),L.getMonth(),L.getDate());B.setDate(B.getDate()-(B.getDay()+6)%7+3);var F=new Date(B.getFullYear(),0,4);F.setDate(F.getDate()-(F.getDay()+6)%7+3);var $=B.getTimezoneOffset()-F.getTimezoneOffset();B.setHours(B.getHours()-$);var H=(B-F)/(864e5*7);return 1+Math.floor(H)},$n=function(L){var B=L.getDay();return B===0&&(B=7),B},Jn=function(L){return(String(L).match(Kn)||[""]).pop().replace(Xn,"").replace(/GMT\+0000/g,"UTC")},Yt;(function(Y){Y.prod="rs.rtn.aliyuncs.com",Y.pre="prs.rtn.aliyuncs.com"})(Yt||(Yt={}));var Gr;(function(Y){Y[Y.ByClient=0]="ByClient",Y[Y.KickOut=1]="KickOut",Y[Y.ChannelClosed=2]="ChannelClosed",Y[Y.Restore=3]="Restore",Y[Y.Expired=4]="Expired",Y[Y.Reconnect=5]="Reconnect",Y[Y.ReconnectExhausted=6]="ReconnectExhausted"})(Gr||(Gr={}));const zr="7.1.7";class Kt{static getVersionNumber(){let L=zr.split("."),B="";return L.forEach(F=>{F.length===1?B+="0"+F:B+=F}),parseInt(B)}static queryingParam(L){let B=[];if(L)for(let F in L)B.push(F+"="+L[F]);return B.join("&")}static getQueryParams(L){const B=window.location.search.substring(1).split("&");for(let F=0;F<B.length;F++){const $=B[F].split("=");if(decodeURIComponent($[0])===L)return decodeURIComponent($[1])}}static createCallid(L=""){const B=ot();return L&&B&&B.length>L.length?`${L}${B.substring(L.length)}`:B}static checkSubOptionsValid(L){if(L){const{audio:B,video:F,screen:$}=L;if(B===!1&&F===!1&&$===!1)return!1}return!0}static async isNetworkAvailable(){const L=Yt.prod,{onLine:B}=navigator;if(!B)return!1;try{return await fetch(`https://${L}/roomserver/v1/ws/version`),!0}catch{return!1}}static toString(L){let B;if(L instanceof Error)B=L.message;else if(typeof L=="string")B=L;else try{B=JSON.stringify(L)}catch{B="undefined"}return B}static paramArrayToString(L){let B="";for(let F=0;F<L.length;F++){B!==""&&(B+=" ");let $=Kt.toString(L[F]);B+=$}return B}}const Zn=(Y,L)=>Y.find(B=>{if(typeof B.test=="function")return B.test(L);if(Array.isArray(B.test))return B.test.some(F=>typeof F=="string"?L.indexOf(F)>-1:F instanceof RegExp?F.test(L):!1)}),eo=[{test:["wow64","win64","x64"],describe(){return"amd64"}},{test:["i686","x86"],describe(){return"x86"}},{test:["aarch64","arm64"],describe(){return"arm64"}},{test:["arm"],describe(){return"arm"}}],to=()=>{let Y="unknown";try{const L=navigator.userAgent||"",B=Zn(eo,L);if(!B)return Y;Y=B.describe(L)}catch{}return Y};var ro=Object.defineProperty,no=(Y,L,B)=>L in Y?ro(Y,L,{enumerable:!0,configurable:!0,writable:!0,value:B}):Y[L]=B,we=(Y,L,B)=>no(Y,typeof L!="symbol"?L+"":L,B);const{BrowserUtil:Yr,SystenUtil:qr}=jn.AliRTS,oo=to(),io="woMMssV6jmyol9fr",ao=200,it=10*60*1e3,at={host:"cn-hangzhou.log.aliyuncs.com",project:"alivc-aio",logstore:"logger",time:10,count:10};function qt(){return zt(new Date,"HH:MM:ss.l")}function Kr(){return zt(new Date,"isoDate")}var He;(function(Y){Y[Y.DEBUG=0]="DEBUG",Y[Y.INFO=1]="INFO",Y[Y.API=2]="API",Y[Y.WARNING=3]="WARNING",Y[Y.ERROR=4]="ERROR",Y[Y.NONE=5]="NONE"})(He||(He={}));var Ke;(function(Y){Y[Y.TASK_UPLOAD_BEGIN=710201]="TASK_UPLOAD_BEGIN",Y[Y.SESSION_UPLOAD_BEGIN=710202]="SESSION_UPLOAD_BEGIN",Y[Y.SESSION_UPLOAD_ING=710203]="SESSION_UPLOAD_ING",Y[Y.SESSION_UPLOAD_END=710204]="SESSION_UPLOAD_END",Y[Y.TASK_UPLOAD_END=710205]="TASK_UPLOAD_END"})(Ke||(Ke={}));class so{constructor(){we(this,"tracker"),we(this,"slsPlugin"),we(this,"stsData"),we(this,"stsExpiration",Date.now()),we(this,"clientId",ot()),we(this,"bSesid",ot()),we(this,"logLevel",He.WARNING),we(this,"appId",""),we(this,"sessionId",""),we(this,"logCache",[]),we(this,"updateTaskTimer"),we(this,"endReported",!0),we(this,"logSequence",0),we(this,"sendLogBeforeUnload",async L=>{if(!this.slsPlugin)return;this.logSequence+=1,L.unshift(this.getLogParams(Ke.SESSION_UPLOAD_ING,{log:`[${Kr()} ${qt()}] [INF] beforeunload`,stat_log_seq:this.logSequence}));const B=`https://${at.project}.${at.host}/logstores/${at.logstore}`,F={__logs__:L.map(T=>this.slsPlugin.transString(T))},{data:$,header:H}=await this.slsPlugin.process(B,JSON.stringify(F));fetch(B,{keepalive:!0,method:"POST",headers:H,body:$})}),we(this,"logMethod",(L,B=console.log)=>(...F)=>{let $=qt();this.logLevel<=L&&B($,...F);let H=Kt.paramArrayToString(F);L>He.DEBUG&&this.addLog(H)}),we(this,"d",this.logMethod(He.DEBUG,console.debug)),we(this,"i",this.logMethod(He.INFO)),we(this,"w",this.logMethod(He.WARNING,console.warn)),we(this,"e",this.logMethod(He.ERROR,(...L)=>{const[B,...F]=L;console.error(B,"<error>",F)})),we(this,"ev",this.logMethod(He.API)),we(this,"a",this.logMethod(He.API,(...L)=>{const[B,...F]=L;if(F.length>2){const $=`${F[1]}`;$.startsWith("__g__")&&console.group(`${$.substring(5)}_${F[2]}`)}console.log(B,...F)})),we(this,"ar",this.logMethod(He.API,(...L)=>{const[B,...F]=L;console.log(B,...F),F.length>2&&`${F[1]}`.startsWith("__g__")&&console.groupEnd()})),we(this,"ae",this.logMethod(He.API,(...L)=>{const[B,...F]=L;console.error(B,"<error>",...F),F.length>2&&`${F[1]}`.startsWith("__g__")&&console.groupEnd()})),window.addEventListener("beforeunload",()=>{this.reportEnd(!0)})}init(){this.reset(),this.startSTSUpdateTask()}destroy(){this.updateTaskTimer&&clearTimeout(this.updateTaskTimer)}reset(){this.bSesid=ot(),this.endReported=!0,this.logSequence=0,this.appId="",this.sessionId=""}async startSTSUpdateTask(){this.updateTaskTimer&&clearTimeout(this.updateTaskTimer);try{const L=await this.refreshSTSToken();this.createTracker(L)}catch{}this.updateTaskTimer=setTimeout(()=>{this.startSTSUpdateTask()},it)}async refreshSTSToken(){if(!this.stsData||this.stsExpiration<=Date.now()-it){const L=await this.requestSTSToken(),B=new Date(L?.Expiration).getTime()||0,F=Date.now()+it;this.stsExpiration=Math.max(B,F),this.stsData=L}return this.stsData}requestSTSToken(){const L=Date.now(),B=`${this.clientId}|${io}|${L}`,F={Action:"AssumeSlsRoleV2",AuthInfo:et.MD5(B).toString(et.enc.Hex),ClientId:this.clientId,BusinessType:"logger",AppVersion:"1.0",Version:"2017-03-14",AuthTimestamp:`${L}`,TerminalType:"web",DeviceModel:"",Format:"JSON",SignatureMethod:"HMAC-SHA1",SignatureVersion:"1.0",Timestamp:zt(L,"isoUtcDateTime")},$=`https://slsrole.alicdn.com/?${new URLSearchParams(F).toString()}`;return fetch($).then(H=>H.json()).then(H=>JSON.parse(window.atob(H.SlsAuthResult)))}createTracker(L){if(!this.tracker){const B={accessKeyId:L.AccessKeyId,accessKeySecret:L.AccessKeySecret,securityToken:L.SecurityToken,refreshSTSTokenInterval:it,stsTokenFreshTime:void 0,refreshSTSToken:()=>{this.refreshSTSToken().then(H=>{B.accessKeyId=H.AccessKeyId,B.accessKeySecret=H.AccessKeySecret,B.securityToken=H.SecurityToken}).catch(()=>{})}},F=new er(at),$=Fr(B);F.useStsPlugin($),this.slsPlugin=$,this.tracker=F,this.reportStartAndCache()}}changeConfig(L){L.logLevel!==void 0&&L.logLevel>=He.DEBUG&&L.logLevel<=He.NONE&&(this.logLevel=L.logLevel)}setSessionID(L,B){!L||!B||(this.appId=L,this.sessionId=B,this.reportStartAndCache())}reportStartAndCache(){if(!this.tracker||!this.sessionId)return;this.endReported=!1;const L={task_btm_sec:0,task_duration:0,task_etm_sec:0,task_type:"session"},B=[this.getLogParams(Ke.TASK_UPLOAD_BEGIN,L),this.getLogParams(Ke.SESSION_UPLOAD_BEGIN,L)];this.tracker.sendBatchLogsImmediate(B),this.logCache.forEach(F=>{this.sendLog(F)})}reportEnd(L=!1){if(!this.tracker||!this.sessionId||this.endReported){this.reset();return}const B={task_btm_sec:0,task_duration:0,task_etm_sec:0,task_type:"session"},F=[this.getLogParams(Ke.SESSION_UPLOAD_END,B),this.getLogParams(Ke.TASK_UPLOAD_END,B)];L?this.sendLogBeforeUnload(F):(this.tracker.sendBatchLogsImmediate(F),this.endReported=!0),this.reset()}getLogParams(L,B){return{appid:`${window.location.host}`,appid_list:this.appId,appver:"",b_sesid:this.bSesid,biz_type:"rtc",cpu_info:oo,db:Yr.browserName,dm:Yr.browserVersion,install_uuid:this.clientId,logger_v:"0.0.1",os:qr.systemName,osv:qr.systemVersion,p_sesid:this.bSesid,sdk_version:zr,sdkname:"AliRTCSdk",stm:Date.now(),tar_pf:"web",traceid:this.sessionId,event_id:L,...B||{}}}sendLog(L){if(!this.tracker||!this.sessionId)return;this.logSequence+=1;const B=this.getLogParams(Ke.SESSION_UPLOAD_ING,{log:L,stat_log_seq:this.logSequence});this.tracker.send(B)}addLog(L){const B=qt(),F=`[${Kr()} ${B}] ${L}`;!this.sessionId||!this.tracker?(this.logCache.push(F),this.logCache.length>=ao&&this.logCache.shift()):this.sendLog(F)}}var co=Object.defineProperty,uo=(Y,L,B)=>L in Y?co(Y,L,{enumerable:!0,configurable:!0,writable:!0,value:B}):Y[L]=B,lo=(Y,L,B)=>uo(Y,L+"",B);class Ze{static getLogger(){return this.logger||(this.logger=new so),this.logger}static init(){this.getLogger().init()}static destroy(){this.getLogger().destroy()}static setLogLevel(L){this.getLogger().changeConfig({logLevel:L})}static setSessionID(L,B){this.getLogger().setSessionID(L,B)}static reportEnd(){this.getLogger().reportEnd()}static interface(...L){this.getLogger().a("[API]",...L)}static interfaceResult(L,B,F,...$){F?this.getLogger().ar("[ARE]",L,B,...$):this.getLogger().ae("[ARE]",L,B,...$)}static event(...L){this.getLogger().ev("[EVT]",...L)}static debug(...L){this.getLogger().d("[DBG]",...L)}static info(...L){this.getLogger().i("[INF]",...L)}static warn(...L){this.getLogger().w("[WARN]",...L)}static error(...L){this.getLogger().e("[ERR]",...L)}}lo(Ze,"logger");var po=Object.defineProperty,fo=(Y,L,B)=>L in Y?po(Y,L,{enumerable:!0,configurable:!0,writable:!0,value:B}):Y[L]=B,Xe=(Y,L,B)=>fo(Y,typeof L!="symbol"?L+"":L,B);const Xr=48e3,tt="[AliyunAudio3A] ";class ho extends $r{constructor(L){super("AliRtcAudioProcessPlugin",Jr.AliRtcSdkStreamTypeCapture,Zr.AUDIO),Xe(this,"audioProcessor"),Xe(this,"slsReporter"),Xe(this,"enableSoft3ACheck",!1),Xe(this,"useHardOnly",!1),Xe(this,"lastDiffOutputLog",""),Xe(this,"audioContext",new AudioContext({sampleRate:Xr})),Xe(this,"farNode"),Xe(this,"createNode",B=>this.audioContext.createMediaStreamSource(new MediaStream([B]))),this.options=L,this.slsReporter=L?.slsReporter,this.enableSoft3ACheck=L?.enableSoft3ACheck||!1,this.useHardOnly=L?.useHardOnly||!1,this.zIndex=7,document.addEventListener("click",this.activeAudioContext)}activeAudioContext(){this.audioContext.resume(),document.removeEventListener("click",this.activeAudioContext)}audioUpdated(L){return this.lastInputAudioTrack?.id!==L.currentAudioTrack?.id}videoUpdated(L){return console.log("videoUpdated",L),!1}setOptions(L){this.farNode||!L.farMediaStream||(this.farNode=this.audioContext.createMediaStreamSource(L.farMediaStream),this.audioProcessor&&this.audioProcessor?.addFarNode(this.farNode),this.options={...this.options,...L})}isSupported(){return $t.isSupported()}shouldUpdate(L){return!!(L.originAudioTrack&&!this.audioProcessor||!L.originAudioTrack&&this.audioProcessor)}async process(L){if(!L.currentAudioTrack){L.updateAudioTrack(),this.clear(L);return}if(!this.audioProcessor){Ze.info(tt,"create audio processor this.options:",this.options),this.audioProcessor=new $t({aecOn:!0,ansOn:!0,agcOn:!0,dumpOn:this.options?.dumpAudioData||!1,aiaecOn:this.options.aiaecOn||!1,useHardOnly:this.useHardOnly,wasmCdnPath:this.options.wasmCdnPath||"https://g.alicdn.com/code/npm/@ali/aliyun-audio-3a/0.0.6/"}),this.audioProcessor.on("dumpdata",(F,$)=>{let H=3e3;$.includes("far")?H=5e3:$.includes("output")?H=1e4:$.includes("meta")&&(H=8e3),setTimeout(()=>{const T=URL.createObjectURL(F),_=document.createElement("a");_.href=T,_.download=$,document.body.appendChild(_),_.click(),document.body.removeChild(_)},H)}),this.audioProcessor.on("loadsuccess",()=>{Ze.info(tt,"loadsuccess"),this.enableSoft3ACheck||L.updateAudioTrack(this.audioProcessor?.targetMediaTrack),this.options.dumpAudioData&&this.audioProcessor?.startDump()}),this.audioProcessor.on("loaderror",F=>{Ze.error(tt,"loaderror:",F?.message),this.emit("error",F)}),this.audioProcessor.on("outputlog",F=>{Ze.info(tt,"outputlog:",F),F?.includes("diff")&&(this.lastDiffOutputLog=F||"")}),this.audioProcessor.on("statdata",F=>{if(F)try{let $=F;if(this.lastDiffOutputLog){const H=this.extractDiffValue(this.lastDiffOutputLog),T=JSON.parse(F);H!==null&&(T.diff=H);const _=this.extractLeakValue(this.lastDiffOutputLog);_!==null&&(T.leak=_),$=JSON.stringify(T)}this.slsReporter?.reportPublishAudio3A("","","",$)}catch($){Ze.error(tt,"statdata error:",$)}});const B=this.createNode(L.currentAudioTrack);await this.audioProcessor.createProcessor(this.audioContext,B,1,Xr,this.farNode)}}extractDiffValue(L){if(!L)return null;const B=L.match(/diff\s*=\s*(-?\d+\.?\d*)/);return B?parseFloat(B[1]):null}extractLeakValue(L){if(!L)return null;const B=L.match(/leak\s*=\s*(-?\d+\.?\d*)/);return B?parseFloat(B[1]):null}clear(L){this.options.dumpAudioData&&this.audioProcessor?.stopDump(),super.clear(L),this.audioProcessor?.destroy(),this.audioProcessor=void 0,document.removeEventListener("click",this.activeAudioContext),this.farNode?.disconnect(),this.farNode=void 0}dump(){this.audioProcessor?.stopDump()}}export{ho as default};