UNPKG

nertc-web-sdk

Version:

NeRTC SDK for web

2 lines 1.25 MB
/*! NeRTC 5.8.31|BUILD v5.8.31-0-g25fea891 production 20250911 */ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.NERTC=t():e.NERTC=t()}(window,(function(){return function(e){var t={};function i(r){if(t[r])return t[r].exports;var s=t[r]={i:r,l:!1,exports:{}};return e[r].call(s.exports,s,s.exports,i),s.l=!0,s.exports}return i.m=e,i.c=t,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)i.d(r,s,function(t){return e[t]}.bind(null,s));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=211)}([function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getParameters=void 0;const r=i(84);let s={tracks:{audio:[],video:[]},logUpload:!1,reportWS:null,shimVideoOrientation:"never",shimCanvas:"ios151",clients:[],localStreams:[],debugG2:!1,passEnvCheck:!1,enableAlerter:"never",videoLowMaxWidth:320,videoLowMaxHeight:180,videoLowFramerate:15,videoLowCheckCanvasBlank:"ios",screenLowMaxWidth:320,screenLowMaxHeight:180,screenLowFramerate:15,controlOnPaused:!0,hideControlOnResume:!0,maxTransportRebuildCnt:Number.MAX_SAFE_INTEGER,logLevel:r.loglevels.INFO,forceLogLevel:-1,forceLogUpload:"default",forceGeofenceArea:"NONE",forceListenDeviceChange:!0,codecOptions:{audio:{opusStereo:!0,opusDtx:!0}},videoHighStartBitrate:1e3,videoHighMinBitrate:0,videoLowStartBitrate:500,videoLowMinBitrate:0,screenHighStartBitrate:2e3,screenHighMinBitrate:0,screenLowStartBitrate:500,screenLowMinBitrate:0,screenFocus:"no-focus-change",screenSurfaceSwitching:"default",screenDisplaySurface:"default",screenPreferCurrentTab:!1,screenSelfBrowserSurface:"default",allowEmptyMedia:!0,keepLocalstreamOnLeave:!1,joinFirstTimeout:2e3,joinMaxRetry:3,reconnectionFirstTimeout:2e3,reconnectionMaxRetry:3,signalProbeEnabled:!0,peerLeaveEventOnReconnect:!0,leaveOnUnload:!0,trustOnOnline:!0,trustOnOffline:!1,trustUnhandledrejection:!1,h264Wait:1e3,encoderWatermarkLimit:1,encoderWatermarkFontFamily:"Verdana",forceEncodedInsertableStreams:!1,forceCustomEncryptionOff:!1,h264StrictHigh:!1,disableH264Send:!1,disableVP8Send:!1,enableTcpCandidate:!0,enableUdpCandidate:!0,maxEventLoopLagWarning:3,enableCompatAudio:!1,audioInputcompatMode:"auto",fireBackupDelay:5e3,audioAslFlag:!0,keepAspectRatio:!1,disableLBSService:!1,lbsUseBuiltinOnly:!1,protooMessageTimeout:3e4,reuseMid:!0,playMediaTimeout:3e3,playMediaTimeoutForAutoplay:6e3,disableWebAudio:!1,disable2dContext:!1,disableWebGLContext:!1,disableAllReports:!1,reportPageBrowserId:!0,doHeartbeatInterval:1e3,deviceChangeInterval:0,h264ProfileLevel:"42e01f",h264ProfileLevelSignal:"42e01f",enableSdpRrtr:"chrome",forceBWE:"no",forceAGC:"no",forceANS:"no",forceAEC:"no",forceChannelCount:-1,forceLatency:-1,forceSampleRate:-1,revertSubstreamProduceType:!1,moreNotAllowedError:!1,replaceIdealConstraint:"safari16_screen",shimLocalCanvas:"safari",enableVSkip:!0,statsLogMaxCnt:3,showStatsLog:!1,chromeLegacyDefault:"unknown",audioLevelFittingAlgorithm:"log2",audioLevelRatioRemote:1,statsHistoryInterval:3e3,signalingMessageDelay:0,reconnectionMaxTimeout:0,reconnectionWaitTimeout:5e3,activeSpeakerMin:10,audioPlayoutDelayHint:0,videoPlayoutDelayHint:0,userType:3,forceDisplaySurface:"default",enableMixerVolumeIndicator:!1,disableIPV6:!1};try{if(location.search&&"function"==typeof URLSearchParams){const e=new URLSearchParams(location.search);let t;for(t in s){const i=s[t],r=e.get(t);if(r){let e=null;"string"==typeof i?e=r:"boolean"==typeof i?"true"!==r&&"false"!==r||(e="true"===r):"number"==typeof i&&(e=Number(r),Number(r)>Number.MIN_SAFE_INTEGER&&(e=Number(r))),null!==e&&i!==e&&(console.warn(`NERTC 通过URL改变了私有化变量:${t}:`,i,"=>",e),s[t]=e)}}}}catch(e){}t.getParameters=()=>s},function(e,t){var i=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=i)},function(e,t,i){var r=i(37)("wks"),s=i(24),a=i(1).Symbol,o="function"==typeof a;(e.exports=function(e){return r[e]||(r[e]=o&&a[e]||(o?a:s)("Symbol."+e))}).store=r},function(e,t,i){"use strict";var r=Object.prototype.hasOwnProperty,s="~";function a(){}function o(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function n(){this._events=new a,this._eventsCount=0}Object.create&&(a.prototype=Object.create(null),(new a).__proto__||(s=!1)),n.prototype.eventNames=function(){var e,t,i=[];if(0===this._eventsCount)return i;for(t in e=this._events)r.call(e,t)&&i.push(s?t.slice(1):t);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},n.prototype.listeners=function(e,t){var i=s?s+e:e,r=this._events[i];if(t)return!!r;if(!r)return[];if(r.fn)return[r.fn];for(var a=0,o=r.length,n=new Array(o);a<o;a++)n[a]=r[a].fn;return n},n.prototype.emit=function(e,t,i,r,a,o){var n=s?s+e:e;if(!this._events[n])return!1;var d,c,l=this._events[n],u=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),u){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,i),!0;case 4:return l.fn.call(l.context,t,i,r),!0;case 5:return l.fn.call(l.context,t,i,r,a),!0;case 6:return l.fn.call(l.context,t,i,r,a,o),!0}for(c=1,d=new Array(u-1);c<u;c++)d[c-1]=arguments[c];l.fn.apply(l.context,d)}else{var h,p=l.length;for(c=0;c<p;c++)switch(l[c].once&&this.removeListener(e,l[c].fn,void 0,!0),u){case 1:l[c].fn.call(l[c].context);break;case 2:l[c].fn.call(l[c].context,t);break;case 3:l[c].fn.call(l[c].context,t,i);break;case 4:l[c].fn.call(l[c].context,t,i,r);break;default:if(!d)for(h=1,d=new Array(u-1);h<u;h++)d[h-1]=arguments[h];l[c].fn.apply(l[c].context,d)}}return!0},n.prototype.on=function(e,t,i){var r=new o(t,i||this),a=s?s+e:e;return this._events[a]?this._events[a].fn?this._events[a]=[this._events[a],r]:this._events[a].push(r):(this._events[a]=r,this._eventsCount++),this},n.prototype.once=function(e,t,i){var r=new o(t,i||this,!0),a=s?s+e:e;return this._events[a]?this._events[a].fn?this._events[a]=[this._events[a],r]:this._events[a].push(r):(this._events[a]=r,this._eventsCount++),this},n.prototype.removeListener=function(e,t,i,r){var o=s?s+e:e;if(!this._events[o])return this;if(!t)return 0==--this._eventsCount?this._events=new a:delete this._events[o],this;var n=this._events[o];if(n.fn)n.fn!==t||r&&!n.once||i&&n.context!==i||(0==--this._eventsCount?this._events=new a:delete this._events[o]);else{for(var d=0,c=[],l=n.length;d<l;d++)(n[d].fn!==t||r&&!n[d].once||i&&n[d].context!==i)&&c.push(n[d]);c.length?this._events[o]=1===c.length?c[0]:c:0==--this._eventsCount?this._events=new a:delete this._events[o]}return this},n.prototype.removeAllListeners=function(e){var t;return e?(t=s?s+e:e,this._events[t]&&(0==--this._eventsCount?this._events=new a:delete this._events[t])):(this._events=new a,this._eventsCount=0),this},n.prototype.off=n.prototype.removeListener,n.prototype.addListener=n.prototype.on,n.prototype.setMaxListeners=function(){return this},n.prefixed=s,n.EventEmitter=n,e.exports=n},function(e,t){var i=e.exports={version:"2.6.12"};"number"==typeof __e&&(__e=i)},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ELECTRON_VERSION=t.IS_ELECTRON=t.IS_UCBROWSER=t.IS_WX=t.IS_LINUX=t.MACOS_VERSION=t.IS_MAC=t.WIN_VERSION=t.IS_WIN=t.IPADQQB_VERSION=t.IS_IPADQQB=t.MACQQB_VERSION=t.IS_MACQQB=t.WQQB_VERSION=t.IS_WQQB=t.MQQB_VERSION=t.IS_MQQB=t.IS_X5MQQB=t.WECHAT_MAJOR_VERSION=t.WECHAT_VERSION=t.IS_WECHAT=t.IE_VERSION=t.IS_IE=t.IS_IE8=t.XWEB_VERSION=t.IS_XWEB=t.TBS_VERSION=t.IS_TBS=t.SOGOU_VERSION=t.IS_SOGOU=t.SOGOUM_VERSION=t.IS_SOGOUM=t.EDG_VERSION=t.EDG_MAJOR_VERSION=t.IS_EDG=t.EDGE_VERSION=t.IS_EDGE=t.FIREFOX_MAJOR_VERSION=t.FIREFOX_VERSION=t.IS_FIREFOX=t.ANDROID_VERSION=t.IS_ANDROID=t.IOS_MAJOR_VERSION=t.IOS_VERSION=t.IS_IOS=t.IS_IPOD=t.IS_IPHONE=t.IS_IPAD=t.USER_LANGUAGE=t.USER_AGENT=void 0,t.IS_EN=t.IS_ZH=t.IS_LOCAL=t.IS_IOS_SAFARI=t.IS_MAC_SAFARI=t.SAFARI_VERSION=t.SAFARI_MAJOR_VERSION=t.IS_ANY_SAFARI=t.IS_SAFARI=t.IOS_FIREFOX_MAJOR_VERSION=t.IOS_FIREFOX_VERSION=t.IS_IOS_FIREFOX=t.IOS_EDGE_MAJOR_VERSION=t.IOS_EDGE_VERSION=t.IS_IOS_EDGE=t.IOS_CHROME_MAJOR_VERSION=t.IOS_CHROME_VERSION=t.IS_IOS_CHROME=t.ANY_CHROME_MAJOR_VERSION=t.CHROME_VERSION=t.CHROME_MAJOR_VERSION=t.IS_CHROME=t.IS_CHROME_ONLY=t.VIVO_VERSION=t.IS_VIVOBROWSER=t.OPPO_VERSION=t.IS_OPPOBROWSER=t.SAMSUNG_VERSION=t.IS_SAMSUNGBROWSER=t.HUAWEI_VERSION=t.IS_HUAWEIBROWSER=t.MI_VERSION=t.IS_MIBROWSER=void 0,t.USER_AGENT=window.navigator&&window.navigator.userAgent||"",t.USER_LANGUAGE=window.navigator&&window.navigator.language,t.IS_IPAD=/iPad/i.test(t.USER_AGENT),t.IS_IPHONE=/iPhone/i.test(t.USER_AGENT)&&!t.IS_IPAD,t.IS_IPOD=/iPod/i.test(t.USER_AGENT),t.IS_IOS=t.IS_IPHONE||t.IS_IPAD||t.IS_IPOD,t.IOS_VERSION=t.IS_IOS&&function(){const e=t.USER_AGENT.match(/\b[0-9]+_[0-9]+(?:_[0-9]+)?\b/)||[""];return e&&e[0]?e[0].replace(/_/g,"."):null}(),t.IOS_MAJOR_VERSION=t.IOS_VERSION&&function(){const e=t.IOS_VERSION.match(/\d+.?\d/);return e&&e[0]?parseFloat(e[0]):null}(),t.IS_ANDROID=/Android/i.test(t.USER_AGENT),t.ANDROID_VERSION=t.IS_ANDROID&&function(){const e=t.USER_AGENT.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;const i=e[1],r=e[2],s=e[3];return i&&r&&s?i+"."+r+"."+s:i&&r?i+"."+r:i||null}(),t.IS_FIREFOX=/Firefox/i.test(t.USER_AGENT),t.FIREFOX_VERSION=t.IS_FIREFOX&&function(){const e=navigator.userAgent.match(/Firefox\/([\d.]+)/);return e&&e[1]?e[1]:null}(),t.FIREFOX_MAJOR_VERSION=t.IS_FIREFOX&&function(){const e=t.USER_AGENT.match(/Firefox\/(\d+)/);return e&&e[1]?parseFloat(e[1]):null}(),t.IS_EDGE=/Edge\//i.test(t.USER_AGENT),t.EDGE_VERSION=t.IS_EDGE&&function(){var e=t.USER_AGENT.match(/Edge\/(\d+)/i);if(e&&e[1])return e[1]}(),t.IS_EDG=/Edg\//i.test(t.USER_AGENT),t.EDG_MAJOR_VERSION=t.IS_EDG&&function(){const e=t.USER_AGENT.match(/Edg\/(\d+)/);return e&&e[1]?parseFloat(e[1]):null}(),t.EDG_VERSION=t.IS_EDG&&function(){const e=t.USER_AGENT.match(/Edg\/([\d.]+)/);return e&&e[1]?e[1]:null}(),t.IS_SOGOUM=/SogouMobileBrowser\//i.test(t.USER_AGENT),t.SOGOUM_VERSION=t.IS_SOGOUM&&function(){const e=t.USER_AGENT.match(/SogouMobileBrowser\/(\d+)/);return e&&e[1]?parseFloat(e[1]):null}(),t.IS_SOGOU=/MetaSr\s/i.test(t.USER_AGENT),t.SOGOU_VERSION=t.IS_SOGOU&&function(){const e=t.USER_AGENT.match(/MetaSr(\s\d+(\.\d+)+)/);return e&&e[1]?parseFloat(e[1]):null}(),t.IS_TBS=/TBS\/\d+/i.test(t.USER_AGENT),t.TBS_VERSION=t.IS_TBS&&function(){var e=t.USER_AGENT.match(/TBS\/(\d+)/i);if(e&&e[1])return e[1]}(),t.IS_XWEB=/XWEB\/\d+/i.test(t.USER_AGENT),t.XWEB_VERSION=t.IS_XWEB&&function(){var e=t.USER_AGENT.match(/XWEB\/(\d+)/i);if(e&&e[1])return e[1]}(),t.IS_IE8=/MSIE\s8\.0/.test(t.USER_AGENT),t.IS_IE=/MSIE\/\d+/i.test(t.USER_AGENT),t.IE_VERSION=t.IS_IE&&function(){const e=/MSIE\s(\d+)\.\d/.exec(t.USER_AGENT);let i=e&&parseFloat(e[1]);return!i&&/Trident\/7.0/i.test(t.USER_AGENT)&&/rv:11.0/.test(t.USER_AGENT)&&(i=11),i}(),t.IS_WECHAT=/(micromessenger|webbrowser)/i.test(t.USER_AGENT),t.WECHAT_VERSION=t.IS_WECHAT&&function(){var e=navigator.userAgent.match(/MicroMessenger\/([\d.]+)/);if(e&&e[1])return e[1]}(),t.WECHAT_MAJOR_VERSION=t.IS_WECHAT&&function(){var e=t.USER_AGENT.match(/MicroMessenger\/(\d+)/i);if(e&&e[1])return parseFloat(e[1])}(),t.IS_X5MQQB=!t.IS_TBS&&/MQQBrowser\/\d+/i.test(t.USER_AGENT)&&/COVC\/\d+/i.test(t.USER_AGENT),t.IS_MQQB=!t.IS_TBS&&/MQQBrowser\/\d+/i.test(t.USER_AGENT)&&!/COVC\/\d+/i.test(t.USER_AGENT),t.MQQB_VERSION=(t.IS_MQQB||t.IS_X5MQQB)&&function(){const e=t.USER_AGENT.match(/ MQQBrowser\/([\d.]+)/);return e&&e[1]?e[1]:null}(),t.IS_WQQB=!t.IS_TBS&&/ QQBrowser\/\d+/i.test(t.USER_AGENT),t.WQQB_VERSION=t.IS_WQQB&&function(){const e=t.USER_AGENT.match(/ QQBrowser\/([\d.]+)/);return e&&e[1]?e[1]:null}(),t.IS_MACQQB=!t.IS_TBS&&/QQBrowserLite\/\d+/i.test(t.USER_AGENT),t.MACQQB_VERSION=t.IS_MACQQB&&function(){const e=t.USER_AGENT.match(/QQBrowserLite\/([\d.]+)/);return e&&e[1]?e[1]:null}(),t.IS_IPADQQB=!t.IS_TBS&&/MQBHD\/\d+/i.test(t.USER_AGENT),t.IPADQQB_VERSION=t.IS_IPADQQB&&function(){const e=t.USER_AGENT.match(/MQBHD\/([\d.]+)/);return e&&e[1]?e[1]:null}(),t.IS_WIN=/Windows/i.test(t.USER_AGENT),t.WIN_VERSION=t.IS_WIN&&function(){const e=t.USER_AGENT.match(/Windows NT (\d+)(?:\.(\d+))?(?:\.(\d+))*/i),i=e&&e[1],r=e&&e[2];return i&&r?i+"."+r:i||null}(),t.IS_MAC=!t.IS_IOS&&/MAC OS X/i.test(t.USER_AGENT),t.MACOS_VERSION=t.IS_MAC&&function(){const e=t.USER_AGENT.match(/\b[0-9]+_[0-9]+(?:_[0-9]+)?\b/)||[""];return e&&e[0]?e[0].replace(/_/g,"."):null}(),t.IS_LINUX=!t.IS_ANDROID&&/Linux/i.test(t.USER_AGENT),t.IS_WX=/MicroMessenger/i.test(t.USER_AGENT),t.IS_UCBROWSER=/UCBrowser/i.test(t.USER_AGENT),t.IS_ELECTRON=/Electron/i.test(t.USER_AGENT),t.ELECTRON_VERSION=t.IS_ELECTRON&&function(){const e=t.USER_AGENT.match(/Electron\/([\d.]+)/);return e&&e[1]?e[1]:null}(),t.IS_MIBROWSER=/MiuiBrowser/i.test(t.USER_AGENT),t.MI_VERSION=t.IS_MIBROWSER&&function(){const e=t.USER_AGENT.match(/MiuiBrowser\/([\d.]+)/);return e&&e[1]?e[1]:null}(),t.IS_HUAWEIBROWSER=/HuaweiBrowser/i.test(t.USER_AGENT),t.HUAWEI_VERSION=t.IS_HUAWEIBROWSER&&function(){const e=t.USER_AGENT.match(/HuaweiBrowser\/([\d.]+)/);return e&&e[1]?e[1]:null}(),t.IS_SAMSUNGBROWSER=/SamsungBrowser/i.test(t.USER_AGENT),t.SAMSUNG_VERSION=t.IS_SAMSUNGBROWSER&&function(){const e=t.USER_AGENT.match(/SamsungBrowser\/([\d.]+)/);return e&&e[1]?e[1]:null}(),t.IS_OPPOBROWSER=/HeyTapBrowser/i.test(t.USER_AGENT),t.OPPO_VERSION=t.IS_OPPOBROWSER&&function(){const e=t.USER_AGENT.match(/HeyTapBrowser\/([\d.]+)/);return e&&e[1]?e[1]:null}(),t.IS_VIVOBROWSER=/VivoBrowser/i.test(t.USER_AGENT),t.VIVO_VERSION=t.IS_VIVOBROWSER&&function(){const e=t.USER_AGENT.match(/VivoBrowser\/([\d.]+)/);return e&&e[1]?e[1]:null}(),t.IS_CHROME_ONLY=/Chrome/i.test(t.USER_AGENT),t.IS_CHROME=!t.IS_EDGE&&!t.IS_SOGOU&&!t.IS_SOGOUM&&!t.IS_TBS&&!t.IS_XWEB&&!t.IS_EDG&&!t.IS_WQQB&&!t.IS_MIBROWSER&&!t.IS_HUAWEIBROWSER&&!t.IS_SAMSUNGBROWSER&&!t.IS_OPPOBROWSER&&!t.IS_VIVOBROWSER&&/Chrome/i.test(t.USER_AGENT),t.CHROME_MAJOR_VERSION=t.IS_CHROME&&function(){const e=t.USER_AGENT.match(/Chrome\/(\d+)/);return e&&e[1]?parseFloat(e[1]):null}(),t.CHROME_VERSION=t.IS_CHROME&&function(){const e=t.USER_AGENT.match(/Chrome\/([\d.]+)/);return e&&e[1]?e[1]:null}(),t.ANY_CHROME_MAJOR_VERSION=function(){const e=t.USER_AGENT.match(/Chrome\/(\d+)/);return e&&e[1]?parseFloat(e[1]):null}(),t.IS_IOS_CHROME=/CriOS/i.test(t.USER_AGENT),t.IOS_CHROME_VERSION=t.IS_IOS_CHROME&&function(){const e=t.USER_AGENT.match(/CriOS\/([\d.]+)/);return e&&e[1]?e[1]:null}(),t.IOS_CHROME_MAJOR_VERSION=t.IS_IOS_CHROME&&function(){const e=t.USER_AGENT.match(/CriOS\/(\d+)/);return e&&e[1]?parseFloat(e[1]):null}(),t.IS_IOS_EDGE=/EdgiOS/i.test(t.USER_AGENT),t.IOS_EDGE_VERSION=t.IS_IOS_EDGE&&function(){const e=t.USER_AGENT.match(/EdgiOS\/([\d.]+)/);return e&&e[1]?e[1]:null}(),t.IOS_EDGE_MAJOR_VERSION=t.IS_IOS_EDGE&&function(){const e=t.USER_AGENT.match(/EdgiOS\/(\d+)/);return e&&e[1]?parseFloat(e[1]):null}(),t.IS_IOS_FIREFOX=/FxiOS/i.test(t.USER_AGENT),t.IOS_FIREFOX_VERSION=t.IS_IOS_FIREFOX&&function(){const e=t.USER_AGENT.match(/FxiOS\/([\d.]+)/);return e&&e[1]?e[1]:null}(),t.IOS_FIREFOX_MAJOR_VERSION=t.IS_IOS_FIREFOX&&function(){const e=t.USER_AGENT.match(/FxiOS\/(\d+)/);return e&&e[1]?parseFloat(e[1]):null}(),t.IS_SAFARI=!t.IS_CHROME_ONLY&&!t.IS_MQQB&&!t.IS_X5MQQB&&!t.IS_MACQQB&&!t.IS_IPADQQB&&/Safari/i.test(t.USER_AGENT),t.IS_ANY_SAFARI=t.IS_SAFARI||t.IS_IOS,t.SAFARI_MAJOR_VERSION=t.IS_SAFARI&&function(){const e=t.USER_AGENT.match(/Version\/(\d+)/);return e&&e[1]?parseFloat(e[1]):null}(),t.SAFARI_VERSION=t.IS_SAFARI&&function(){const e=t.USER_AGENT.match(/Version\/([\d.]+)/);return e&&e[1]?e[1]:null}(),t.IS_MAC_SAFARI=t.IS_SAFARI&&t.IS_MAC,t.IS_IOS_SAFARI=t.IS_SAFARI&&t.IS_IOS,t.IS_LOCAL="file:"===window.location.protocol||"localhost"===window.location.hostname||/^\d+\.\d+\.\d+\.\d+$/.test(window.location.hostname),t.IS_ZH=/zh/i.test(t.USER_LANGUAGE),t.IS_EN=/en/i.test(t.USER_LANGUAGE)},function(e,t,i){var r=i(11);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default={PAGE_UNLOAD:3e4,LOGIN_FAILED:30001,MEDIA_CONNECTION_DISCONNECTED:30204,SIGNAL_CONNECTION_DISCONNECTED:30205,CLIENT_BANNED:30206,CHANNEL_CLOSED:30207,UID_DUPLICATE:30209,PERMKEY_TIMEOUT:30902,AUTO_PLAY_NOT_ALLOWED:41030,INVALID_PARAMETER_ERROR:1e4,NOT_SUPPORT_ERROR:10001,NETWORK_ERROR:10002,NETWORK_REQUEST_ERROR:10003,INVALID_OPERATION_ERROR:10008,API_CALL_SEQUENCE_BEFORE_ERROR:10009,API_CALL_SEQUENCE_AFTER_ERROR:10010,LOCALSTREAM_NOT_FOUND_ERROR:10011,UNKNOWN_TYPE_ERROR:10012,LOGIN_REQUEST_ERROR:10017,RECONNECTING:10020,SERVER_UNKNOWN_ERROR:10099,JOIN_FAILED:10100,REPEAT_JOIN_ERROR:10101,USER_NOT_IN_CHANNEL_ERROR:10104,JOIN_PERMKEY_ERROR:10109,JOIN_WITHOUT_CHANNEL_NAME:10110,JOIN_RECORD_TYPE_ERROR:10111,JOIN_UID_TYPE_ERROR:10112,SERVER_AUTH_ERROR:10119,SET_CHANNEL_PROFILE_INVALID_PARAMETER_ERROR:10121,TASKS_ROLE_ERROR:10131,ADD_TASK_PARAMETER_ERROR:10132,ADD_TASK_FAILED_ERROR:10133,DELETE_TASK_PARAMETER_ERROR:10134,DELETE_TASK_FAILED_ERROR:10135,UPDATE_TASK_PARAMETER_ERROR:10136,UPDATE_TASKS_FAILED_ERROR:10137,STREAM_UID_ERROR:10210,STREAM_PROFILE_ERROR:10211,MEDIA_DEVICE_ERROR:10212,STREAM_PLAY_ARGUMENT_ERROR:10215,STREAM_RENDER_ARGUMENT_ERROR:10216,STREAM_ISPLAYING_ARGUMENT_ERROR:10218,STREAM_OPTN_NO_TYPE_ERROR:10220,REPEAT_OPEN_MIC_ERROR:10221,REPEAT_OPEN_AUDIO_SLAVE_ERROR:10222,REPEAT_OPEN_CAMERA_ERROR:10223,REPEAT_OPEN_SCREEN_ERROR:10224,STREAM_CLOSE_ARGUMENT_ERROR:10228,STREAM_CLOSE_AUDIO_ERROR:10229,STREAM_CLOSE_AUDIO_SLAVE_ERROR:10230,STREAM_CLOSE_CAMERA_ERROR:10231,STREAM_CLOSE_SCREEN_ERROR:10232,STREAM_NOT_SUBSCRIBE_AUDIO:10240,STREAM_NOT_SUBSCRIBE_AUDIO_SLAVE:10241,STREAM_SET_CAPTURE_VOLUME_ARGUMENT_ERROR:10242,STREAM_TAKE_SNAPSHOT_ERROR:10247,STREAM_TAKE_SNAPSHOT_NO_CANVAS_ERROR:10248,SET_AUDIO_VOLUME_ARGUMENTS_ERROR:10250,SET_AUDIO_VOLUME_ERROR:10251,SET_CAPTURE_VOLUME_ARGUMENTS_ERROR:10252,SET_AUDIO_OUTPUT_ERROR:10253,SWITCH_DEVICE_REPEAT_ARGUMENTS_ERROR:10254,SWITCH_DEVICE_REPEAT_ERROR:10255,SWITCH_DEVICE_NO_MIC_ERROR:10256,SWITCH_DEVICE_NO_SUPPORT_AUDIO:10257,SWITCH_DEVICE_NO_CAMERA_ERROR:10258,SWITCH_DEVICE_NO_SUPPORT_VIDEO:10259,STREAM_MUTE_AUDIO_ERROR:10265,STREAM_NOT_MUTE_AUDIO_YET:10266,STREAM_UNMUTE_AUDIO_WITHOUT_STREAM:10267,STREAM_MUTE_AUDIO_SLAVE_ERROR:10270,STREAM_NOT_MUTE_AUDIO_SLAVE_YET:10271,STREAM_UNMUTE_AUDIO_SLAVE_WITHOUT_STREAM:10272,STREAM_MUTE_VIDEO_ERROR:10275,STREAM_NOT_MUTE_VIDEO_YET:10276,STREAM_UNMUTE_VIDEO_WITHOUT_STREAM:10277,STREAM_MUTE_SCREEN_ERROR:10280,STREAM_NOT_MUTE_SCREEN_YET:10281,STREAM_UNMUTE_SCREEN_WITHOUT_STREAM:10282,STREAM_MUTE_VIDEO_THIRD_ERROR:10284,STREAM_NOT_MUTE_VIDEO_THIRD_YET:10285,STREAM_UNMUTE_VIDEO_THIRD_WITHOUT_STREAM:10286,STREAM_MUTE_VIDEO_FOURTH_ERROR:10287,STREAM_NOT_MUTE_VIDEO_FOURTH_YET:10288,STREAM_UNMUTE_VIDEO_FOURTH_WITHOUT_STREAM:10289,ASR_CAPTIONS_ERROR:10283,NOT_PUBLISHED:10340,NOT_SUBSCRIBED:10341,CONSUME_START:10342,NOT_OPENED:10345,ENDED:10346,PAUSED:10347,PLAYING:10348,MUTED:10347,INVALID_STATE:10349,PUBLISH_NO_STREAM:10350,PUBLISH_ROLE_ERROR:10351,PUBLISH_SERVER_ERROR:10355,SUBSCRIBE_SERVER_ERROR:10360,WEBGL_NOT_SUPPORT_ERROR:10401,WEBGL_LOSE_CONTEXT_ERROR:10402,WEBGL_RESTORED_FAILD_ERROR:10403,BASIC_BEAUTY_RES_ERROR:10404,ADV_BEAUTY_RES_ERROR:10405,PLUGIN_LOADED_ERROR:10406,PLUGIN_ERROR:10407,PLUGIN_REGISTER_ERROR:10408,PLUGIN_NOT_REGISTER:10409,PLUGIN_NOT_SUPPORT:10410,PLUGIN_NOT_SUPPORT_BROWSER:10411,WEBGL_NOT_INIT:10412,PLUGIN_VERSION_ERROR:10413,AUDIO_MIX_NO_AUDIO:10420,AUDIO_MIX_FILE_ERROR:10421,AUDIO_MIX_NO_SUPPORT:10422,AUDIO_MIX_NOT_STATE_ERROR:10423,AUDIO_MIX_NOT_PAUSE:10424,AUDIO_MIX_VOLUME_ERROR:10425,AUDIO_MIX_PLAY_START_TIME_ERROR:10426,AUDIO_EFFECT_NO_SUPPORT:10430,AUDIO_EFFECT_FILE_ERROR:10431,AUDIO_EFFECT_NO_AUDIO:10432,AUDIO_EFFECT_NOT_STATE_ERROR:10433,AUDIO_EFFECT_FILE_LOST_ERROR:10434,AUDIO_EFFECT_NOT_PAUSE:10435,AUDIO_EFFECT_PLAY_ALREADY:10436,AUDIO_EFFECT_ERROR:10437,SET_LOCAL_MEDIA_PRIORITY_ARGUMENT_ERROR:10445,UPDATE_PERMKEY_ERROR:10446,RECORDING_NOT_SUPPORT:10450,REPEAT_RECORDING_ERROR:10451,RECORDING_CACHE_ERROR:10452,RECORDING_ERROR:10453,RECORDING_NOT_START_ERROR:10454,WATERMARKS_EXCEEDED_ERROR:10460,LBS_REQUEST_ERROR:10461,LBS_JSON_ERROR:10462,CUSTOM_TRANSFOR_NOT_SUPPORT_ERROR:10471,SET_ENCRYPTION_MODE_ERROR:10472,SET_ENCRYPTION_SECRET_INVALID_OPERATION_ERROR:10473,ROLE_TYPE_ERROR:10477,GET_SYSTEM_STATS_NOT_SUPPORT_ERROR:10480,SET_CLIENT_ROLE_ERROR:10490,CLIENT_ALREADY_IN_CHANNEL_ERROR:10500}},function(e,t,i){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=r(i(7));class a extends Error{constructor(e){let t=e.url?e.url:"https://doc.yunxin.163.com/jcyOTA0ODM/docs/zU2MDQ4MjU?platform=web",i=e.advice?` advice: ${e.advice} `:"";super(e.message+` <${function(e){for(let t in s.default)if(s.default[t]===e)return t;return"UNKNOWN"}(e.code)} ${e.code.toString()}> `+i+t),this.code_=e.code||0,this.message_=e.message||null,this.advice_=e.advice||null,this.extraCode_=e.extraCode||null}get code(){return this.code_}get message(){return this.message_}get extraCode(){return this.extraCode_}get advice(){return this.advice_}getCode(){return this.code_}getMessage(){return this.message_}getProposal(){return this.advice_}getExtraCode(){return this.extraCode_}}t.default=a},function(e,t,i){var r=i(10),s=i(23);e.exports=i(12)?function(e,t,i){return r.f(e,t,s(1,i))}:function(e,t,i){return e[t]=i,e}},function(e,t,i){var r=i(6),s=i(55),a=i(34),o=Object.defineProperty;t.f=i(12)?Object.defineProperty:function(e,t,i){if(r(e),t=a(t,!0),r(i),s)try{return o(e,t,i)}catch(e){}if("get"in i||"set"in i)throw TypeError("Accessors not supported!");return"value"in i&&(e[t]=i.value),e}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t,i){e.exports=!i(22)((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},function(e,t){var i={}.hasOwnProperty;e.exports=function(e,t){return i.call(e,t)}},function(e,t,i){var r=i(101),s=i(32);e.exports=function(e){return r(s(e))}},function(e,t){e.exports=!0},function(e,t,i){var r=i(1),s=i(4),a=i(20),o=i(9),n=i(13),d=function(e,t,i){var c,l,u,h=e&d.F,p=e&d.G,m=e&d.S,g=e&d.P,f=e&d.B,v=e&d.W,S=p?s:s[t]||(s[t]={}),y=S.prototype,_=p?r:m?r[t]:(r[t]||{}).prototype;for(c in p&&(i=t),i)(l=!h&&_&&void 0!==_[c])&&n(S,c)||(u=l?_[c]:i[c],S[c]=p&&"function"!=typeof _[c]?i[c]:f&&l?a(u,r):v&&_[c]==u?function(e){var t=function(t,i,r){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,i)}return new e(t,i,r)}return e.apply(this,arguments)};return t.prototype=e.prototype,t}(u):g&&"function"==typeof u?a(Function.call,u):u,g&&((S.virtual||(S.virtual={}))[c]=u,e&d.R&&y&&!y[c]&&o(y,c,u)))};d.F=1,d.G=2,d.S=4,d.P=8,d.B=16,d.W=32,d.U=64,d.R=128,e.exports=d},function(e,t){e.exports={}},function(e,t){var i={}.toString;e.exports=function(e){return i.call(e).slice(8,-1)}},function(e,t,i){"use strict";var r,s,a=e.exports=i(45),o=i(186);a.codegen=i(273),a.fetch=i(274),a.path=i(275),a.fs=a.inquire("fs"),a.toArray=function(e){if(e){for(var t=Object.keys(e),i=new Array(t.length),r=0;r<t.length;)i[r]=e[t[r++]];return i}return[]},a.toObject=function(e){for(var t={},i=0;i<e.length;){var r=e[i++],s=e[i++];void 0!==s&&(t[r]=s)}return t};var n=/\\/g,d=/"/g;a.isReserved=function(e){return/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(e)},a.safeProp=function(e){return!/^[$\w_]+$/.test(e)||a.isReserved(e)?'["'+e.replace(n,"\\\\").replace(d,'\\"')+'"]':"."+e},a.ucFirst=function(e){return e.charAt(0).toUpperCase()+e.substring(1)};var c=/_([a-z])/g;a.camelCase=function(e){return e.substring(0,1)+e.substring(1).replace(c,(function(e,t){return t.toUpperCase()}))},a.compareFieldsById=function(e,t){return e.id-t.id},a.decorateType=function(e,t){if(e.$type)return t&&e.$type.name!==t&&(a.decorateRoot.remove(e.$type),e.$type.name=t,a.decorateRoot.add(e.$type)),e.$type;r||(r=i(188));var s=new r(t||e.name);return a.decorateRoot.add(s),s.ctor=e,Object.defineProperty(e,"$type",{value:s,enumerable:!1}),Object.defineProperty(e.prototype,"$type",{value:s,enumerable:!1}),s};var l=0;a.decorateEnum=function(e){if(e.$type)return e.$type;s||(s=i(46));var t=new s("Enum"+l++,e);return a.decorateRoot.add(t),Object.defineProperty(e,"$type",{value:t,enumerable:!1}),t},a.setProperty=function(e,t,i){if("object"!=typeof e)throw TypeError("dst must be an object");if(!t)throw TypeError("path must be specified");return function e(t,i,r){var s=i.shift();if("__proto__"===s||"prototype"===s)return t;if(i.length>0)t[s]=e(t[s]||{},i,r);else{var a=t[s];a&&(r=[].concat(a).concat(r)),t[s]=r}return t}(e,t=t.split("."),i)},Object.defineProperty(a,"decorateRoot",{get:function(){return o.decorated||(o.decorated=new(i(196)))}})},function(e,t,i){var r=i(21);e.exports=function(e,t,i){if(r(e),void 0===t)return e;switch(i){case 1:return function(i){return e.call(t,i)};case 2:return function(i,r){return e.call(t,i,r)};case 3:return function(i,r,s){return e.call(t,i,r,s)}}return function(){return e.apply(t,arguments)}}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t){var i=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++i+r).toString(36))}},function(e,t,i){var r=i(10).f,s=i(13),a=i(2)("toStringTag");e.exports=function(e,t,i){e&&!s(e=i?e:e.prototype,a)&&r(e,a,{configurable:!0,value:t})}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SDK_VERSION=t.roomsTaskUrl=t.lbsUrl=t.TAGS_TO_MAIN_DOMAIN=t.LBS_REGION_CONFIG=t.getCloudProxyInfoUrl=t.getChannelInfoUrl=t.ENV=t.ENGINE_VERSION=t.createChannelUrl=t.checkSumUrl=t.BUILD=void 0;t.SDK_VERSION="5.8.31";t.ENGINE_VERSION="5.8.31";t.BUILD="v5.8.31-0-g25fea891";const r=i(213);Object.defineProperty(t,"ENV",{enumerable:!0,get:function(){return r.ENV}}),Object.defineProperty(t,"LBS_REGION_CONFIG",{enumerable:!0,get:function(){return r.LBS_REGION_CONFIG}}),Object.defineProperty(t,"TAGS_TO_MAIN_DOMAIN",{enumerable:!0,get:function(){return r.TAGS_TO_MAIN_DOMAIN}});const s=r.Config.checkSumUrl;t.checkSumUrl=s;const a=r.Config.createChannelUrl;t.createChannelUrl=a;const o=r.Config.getChannelInfoUrl;t.getChannelInfoUrl=o;const n=r.Config.roomsTaskUrl;t.roomsTaskUrl=n;const d=r.Config.getCloudProxyInfoUrl;t.getCloudProxyInfoUrl=d;const c=r.Config.lbsUrl;t.lbsUrl=c},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.generateRandomNumber=t.clone=void 0,t.clone=function(e,t={}){return void 0===e?t:JSON.parse(JSON.stringify(e))},t.generateRandomNumber=function(){return Math.round(1e7*Math.random())}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getDefaultLogger=t.Logger=t.updateLogIndex=void 0;const r=i(0),s=i(84),a=i(71),o=i(29),n=i(26);let d=0,c=[];function l(){return d++,(""+d).padStart(4,"0")}t.updateLogIndex=l;class u{constructor(e){this.style="color:#1cb977;",this.options=e,this.tagGen=e.tagGen,this.supportedBrowsers=["Chrome","Safari","Firefox","Chrome Mobile","Electron"],this.cs=console}getChild(e){const t=Object.assign({},this.options),i=new u(t);return i.tagGen=e,i.parent=this,i}debug(){var e=this.formatArgs("DEBUG",[].slice.call(arguments,0));r.getParameters().logLevel<=s.loglevels.DEBUG&&this._log("debug",e),m(e)}log(){var e=this.formatArgs("LOG",[].slice.call(arguments,0));if(-1!==this.supportedBrowsers.indexOf(a.getBrowserInfo().browserName)&&"string"==typeof e[0]){e[0]="%c"+e[0],e.splice(1,0,this.style);for(let t=2;t<e.length&&"string"==typeof e[t];t++)e[0]+="%c"+e[t],e[t]=""}r.getParameters().logLevel<=s.loglevels.INFO&&this._log("log",e),m(e)}info(){var e=this.formatArgs("INFO",[].slice.call(arguments,0));-1!==this.supportedBrowsers.indexOf(a.getBrowserInfo().browserName)&&"string"==typeof e[0]&&(e[0]="%c"+e[0],e.splice(1,0,this.style)),r.getParameters().logLevel<=s.loglevels.INFO&&this._log("info",e),m(e)}warn(){var e=this.formatArgs("WARN",[].slice.call(arguments,0));-1!==this.supportedBrowsers.indexOf(a.getBrowserInfo().browserName)&&"string"==typeof e[0]&&(e[0]="%c"+e[0],e.splice(1,0,this.style)),r.getParameters().logLevel<=s.loglevels.WARNING&&this._log("warn",e),m(e)}error(){var e=this.formatArgs("ERROR",[].slice.call(arguments,0));-1!==this.supportedBrowsers.indexOf(a.getBrowserInfo().browserName)&&"string"==typeof e[0]&&(e[0]="%c"+e[0],e.splice(1,0,this.style)),r.getParameters().logLevel<=s.loglevels.ERROR&&this._log("error",e),m(e)}_log(e,t){let i=this.options.logFunc,r=null;if(i&&(i[e]&&(r=i[e]),"function"==typeof r))r.apply(i,t);else if(this.cs[e])try{this.cs[e].apply?this.chrome(e,t):this.ie(e,t)}catch(e){}}chrome(e,t){a.getBrowserInfo().browserName;this.cs[e]?this.cs[e].apply(this.cs,t):this.cs.log?this.cs.log.apply(this.cs,t):this.ie(e,t)}ie(e,t){var i=this;t.forEach((function(t){i.cs[e](JSON.stringify(t,null,4))}))}formatArgs(e,t){var i=new Date,r=p(""+(i.getMonth()+1))+"-"+p(""+i.getDate())+" "+p(""+i.getHours())+":"+p(""+i.getMinutes())+":"+p(""+i.getSeconds())+":"+p(""+i.getMilliseconds(),3);let s=this,a="";for(let e=0;e<3&&(s.tagGen&&(a=`[${s.tagGen()}]`+a),s.parent);e++)s=s.parent;return a=`[NERTC:${e}:${l()} ${r}]${a}`,t.splice(0,0,a),t.forEach((function(e,i){e=o.formatSingleArg(e),t[i]="object"==typeof e?function e(t,i=[]){if(!(t=o.formatSingleArg(t))||"object"!=typeof t)return t;let r={};for(let s in t)t.hasOwnProperty&&!t.hasOwnProperty(s)||(t[s]&&"object"==typeof t[s]?-1!==i.indexOf(t[s])?r[s]="[Circular obj]":(i.push(t[s]),r[s]=e(t[s],i)):r[s]=t[s]);return r}(e):e})),t}}t.Logger=u;let h=null;t.getDefaultLogger=function(){return h||(h=new u({tagGen:()=>""+n.BUILD})),h};var p=function(e,t){t=t||2;for(var i=""+e;i.length<t;)i="0"+i;return i};function m(e){if(r.getParameters().logUpload&&!r.getParameters().disableAllReports){const t=r.getParameters().reportWS;if(t)c.length&&(c.forEach(e=>{t.sendLog(e.args)}),c=[]),t.sendLog(e);else{let t=Date.now();try{c.length&&c[c.length-1].args[0].replace("[NERTC","[缓存][NERTC")}catch(e){}c.push({time:t,args:e})}}}},function(e,t,i){"use strict";function r(e,t=1,i=1){return e<=1?i:r(e-1,i,t+i)}Object.defineProperty(t,"__esModule",{value:!0}),t.replaceDomain=t.getDomInfo=t.makePrintable=t.formatSingleArg=t.deepCopy=t.randomString=t.randomId=t.generateUUID=t.getReconnectionTimeout=t.fibonacci=t.checkVideoHiddenReason=void 0,t.checkVideoHiddenReason=function(e){let t=e;for(;t;){const e=window.getComputedStyle(t);if("none"===e.display)return{hidden:!0,reason:"display: none",element:t};if("hidden"===e.visibility)return{hidden:!0,reason:"visibility: hidden",element:t};t=t.parentElement}const i=window.getComputedStyle(e);if(0===parseFloat(i.opacity))return{hidden:!0,reason:"opacity: 0",element:e};if(0===e.offsetWidth||0===e.offsetHeight)return{hidden:!0,reason:"width/height is 0",element:e};const r=e.getBoundingClientRect();return r.bottom<0||r.top>window.innerHeight||r.right<0||r.left>window.innerWidth?{hidden:!0,reason:"out of viewport",element:e}:{hidden:!1,reason:"visible",element:e}},t.fibonacci=r,t.getReconnectionTimeout=function(e){const t=Math.round(e/2)+1;return t>6?13e3:1e3*r(t)};t.generateUUID=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}))};t.randomId=function(){return"xxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}))};function s(e){if(window.RTCRtpSender&&e instanceof RTCRtpSender){return`[RTCRtpSender track: ${s(e.track)}]`}if(e instanceof MediaStreamTrack){const t=e;return`[MediaStreamTrack kind:${t.kind} label:${t.label} readyState:${t.readyState} id: ${t.id} enabled:${t.enabled} muted: ${t.muted}]`}if(e instanceof HTMLElement){const t=e;return`[${t.tagName}.${t.className} ${t.clientWidth}x${t.clientHeight}]`}if(e instanceof MediaStream){const t=e;return`[MediaStream active:${t.active} a:${t.getAudioTracks().length} v:${t.getVideoTracks().length}]`}if(window.DOMException&&e instanceof DOMException){return`[Error name:${e.name} code:${e.code} message:${e.message}]`}return e}t.randomString=(e,t)=>{if(!e||!t)return"";let i="";for(var r=t;r>0;--r)i+=e[Math.floor(Math.random()*e.length)];return i},t.deepCopy=function e(t){var i=Array.isArray(t)?[]:{};for(var r in t)t.hasOwnProperty(r)&&("object"==typeof t[r]&&null!==t[r]?i[r]=e(t[r]):i[r]=t[r]);return i},t.formatSingleArg=s,t.makePrintable=function e(t,i,r=[]){if("object"!=typeof t||!(null==t?void 0:t.hasOwnProperty))return t;var a=Array.isArray(t)?[]:{};for(var o in t)if(t.hasOwnProperty(o)){const n=s(t[o]);n&&("client"===o&&n.adapterRef||["adapterRef","sdkRef","logger","_events"].indexOf(o)>-1||(n&&"object"==typeof n?r.indexOf(n)>-1?a[o]="[Circular obj]":(r.push(a[o]),i>=1?a[o]=e(n,i-1,r):(null==n?void 0:n.toString)?a[o]=n.toString():a[o]=typeof n):a[o]=n))}return a},t.getDomInfo=function(e){if(!e)return""+e;let t=e.tagName;return e.id&&(t+="#"+e.id),e.className&&(t+="."+e.className),(e.offsetWidth||e.offsetHeight)&&(t+=` ${e.offsetWidth}x${e.offsetHeight}`),t},t.replaceDomain=function(e,t){const i=e.match(/^([a-zA-Z][a-zA-Z0-9+.-]*:)\/\//);let r=e,s="";i?s=i[1]||"":(r="http://"+e,s="");try{const e=new URL(r);let i=t;if(/^([a-zA-Z][a-zA-Z0-9+.-]*:)\/\//.test(t)){i=new URL(t).host}e.host=i;let a=e.toString();return s?s!==e.protocol&&(a=a.replace(/^https?:/,s)):a=a.replace(/^https?:\/\//,""),a}catch(t){return e}}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Logger=void 0;const r=new(i(28).Logger)({tagGen:void 0});t.Logger={debug(e,...t){try{r.log(`[${e}] ${t.join(" ")}`)}catch(e){}},warn(e,...t){try{r.warn(`[${e}] ${t.join(" ")}`)}catch(e){}},error(e,...t){try{r.error(`[${e}] ${t.join(" ")}`)}catch(e){}}}},function(e,t){var i=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?r:i)(e)}},function(e,t){e.exports=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,i){var r=i(11),s=i(1).document,a=r(s)&&r(s.createElement);e.exports=function(e){return a?s.createElement(e):{}}},function(e,t,i){var r=i(11);e.exports=function(e,t){if(!r(e))return e;var i,s;if(t&&"function"==typeof(i=e.toString)&&!r(s=i.call(e)))return s;if("function"==typeof(i=e.valueOf)&&!r(s=i.call(e)))return s;if(!t&&"function"==typeof(i=e.toString)&&!r(s=i.call(e)))return s;throw TypeError("Can't convert object to primitive value")}},function(e,t,i){var r=i(58),s=i(38);e.exports=Object.keys||function(e){return r(e,s)}},function(e,t,i){var r=i(37)("keys"),s=i(24);e.exports=function(e){return r[e]||(r[e]=s(e))}},function(e,t,i){var r=i(4),s=i(1),a=s["__core-js_shared__"]||(s["__core-js_shared__"]={});(e.exports=function(e,t){return a[e]||(a[e]=void 0!==t?t:{})})("versions",[]).push({version:r.version,mode:i(15)?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t,i){"use strict";var r=i(21);function s(e){var t,i;this.promise=new e((function(e,r){if(void 0!==t||void 0!==i)throw TypeError("Bad Promise constructor");t=e,i=r})),this.resolve=r(t),this.reject=r(i)}e.exports.f=function(e){return new s(e)}},function(e,t,i){t.f=i(2)},function(e,t,i){var r=i(1),s=i(4),a=i(15),o=i(40),n=i(10).f;e.exports=function(e){var t=s.Symbol||(s.Symbol=a?{}:r.Symbol||{});"_"==e.charAt(0)||e in t||n(t,e,{value:o.f(e)})}},function(e,t){t.f={}.propertyIsEnumerable},function(e,t,i){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.WebAudio=t.getAudioLevelDestination=t.getAudioContext=t.tryResumeAudioContext=void 0;const s=i(3),a=i(168),o=r(i(7)),n=r(i(8)),d=i(145),c=i(0),l=r(i(214)),u=d.RtcSupport.checkWebAudio();let h;class p{constructor(e){this.id=e.id,this.label=e.label,this.audioNode=e.audioNode,this.gainNode=e.context.createGain(),this.type=e.type,this.audioNode.connect(this.gainNode)}connect(e){this.gainNode.connect(e)}disconnect(){try{this.audioNode.disconnect(this.gainNode)}catch(e){}this.gainNode.disconnect()}}function m(){return h?"suspended"===h.state&&(h.resume().catch(e=>{}),!0):null}function g(){return h?(m(),h):c.getParameters().disableWebAudio?null:u.WebAudio&&u.MediaStream?(h=new window.AudioContext,h):null}t.tryResumeAudioContext=m,t.getAudioContext=g;let f=null;function v(){if(!f){const e=g();e&&(f=e.createMediaStreamDestination())}return f}t.getAudioLevelDestination=v;class S extends s.EventEmitter{constructor(e){super(),this.JungleNode=null;const{logger:t,isAnalyze:i=!1,isRemote:r=!1}=e;this.support=u.WebAudio&&u.MediaStream,this.gain=1,this.logger=t,this.audioInArr=[],this.isAnalyze=i,this.isRemote=r||!1,this.instant=0,this.slow=0,this.clip=0,this.mediaHelper=e.mediaHelper,this.mixAudioConf={state:a.AuidoMixingState.UNSTART,audioSource:null,gainFilter:null,replace:!1,cycle:0,pauseTime:0,startTime:0,totalTime:0,volume:1,playStartTime:0,setPlayStartTime:0,auidoMixingEnd:null},this.context=g(),this.context?(this.destination=this.createDestination(),this.musicDestination=this.createDestination(),this.analyzeDestination=this.createDestination()):(this.destination=null,this.musicDestination=null,this.analyzeDestination=null),this.support&&(this.resetMixConf(),this.init())}createDestination(){if(!this.context)throw new Error("AudioContextRequired");try{return new MediaStreamAudioDestinationNode(this.context)}catch(e){if("TypeError"===e.name)return this.context.createMediaStreamDestination();throw e}}createSource(e){if(!this.context)throw new Error("AudioContextRequired");try{return new MediaStreamAudioSourceNode(this.context,e)}catch(t){if("TypeError"===t.name)return this.context.createMediaStreamSource(e.mediaStream);throw t}}init(){this.isAnalyze&&this.initMonitor(),this.initWebAudio(),this.initAudioIn()}initMonitor(){var e=this;this.context?(this.script=this.context.createScriptProcessor(0,1,1)).onaudioprocess=function(t){var i,r=t.inputBuffer.getChannelData(0),s=0,a=0;for(i=0;i<r.length;++i)s+=Math.abs(r[i]),Math.abs(r[i])>.99&&(a+=1);e.instant=Math.sqrt(s/r.length),e.slow=.95*e.slow+.05*e.instant,e.clip=a/r.length;let o=t.inputBuffer,n=t.outputBuffer;n.copyToChannel&&n.copyToChannel(o.getChannelData(0),0,0)}:e.logger.error("initMonitor:参数不够")}initWebAudio(){this.context&&this.destination?(this.gainFilter=this.context.createGain(),this.gainFilter.gain.value=this.gain):this.logger.error("initMonitor:参数不够")}initAudioIn(){var e,t,i,r,s,o,n;const d=this;if(!d.context||!d.gainFilter||!d.destination)return this.logger.error("initAudioIn:参数不够"),null;let c=(null===(t=null===(e=this.mediaHelper.audio.stageAIProcessing)||void 0===e?void 0:e.node)||void 0===t?void 0:t.audioNode)||null,l=null===(i=this.mediaHelper.audio.stageAIProcessing)||void 0===i?void 0:i.enabled;const u="MIX_PLAYING"===this.mixAudioConf.state&&this.mixAudioConf.replace;if(c&&!u)if(l)c.connect(d.gainFilter);else try{c.disconnect(d.gainFilter)}catch(e){}for(var h=0;h<d.audioInArr.length;h++){const e=d.audioInArr[h];if(c&&!u)if(l){try{e.gainNode.disconnect(d.gainFilter)}catch(e){}e.connect(c)}else{try{e.gainNode.disconnect(c)}catch(e){}e.connect(d.gainFilter)}else u?this.logger.log("当前正在以Replace模式播放伴音,暂不接入"):e.connect(d.gainFilter);let t=(null===(s=null===(r=this.mediaHelper.audio.stageAIProcessing)||void 0===r?void 0:r.howlingNode)||void 0===s?void 0:s.audioNode)||null;if(t)if(l){e.connect(t);const i=v();i&&t.connect(i)}else try{e.gainNode.disconnect(t)}catch(e){}}d.mixAudioConf.state===a.AuidoMixingState.UNSTART&&(d.script&&d.analyzeDestination&&(d.gainFilter.connect(d.script),d.script.connect(d.analyzeDestination)),d.gainFilter.connect(d.destination)),(null===(n=null===(o=this.JungleNode)||void 0===o?void 0:o.Jungle)||void 0===n?void 0:n.connected)&&this.JungleNode.connect(),this.logger.log("WebAudio: initAudioIn: 初始化音频 state: ",d.context.state),"running"!==d.context.state&&d.context.resume().then(()=>{this.context&&this.logger.log("WebAudio: addMs: 状态变更成功 state: ",this.context.state)}).catch(e=>{this.logger.log("WebAudio: addMs: 状态变更出错: ",e.name,e.message,e),this.context&&this.context.resume()})}updateTracks(e){for(let t=this.audioInArr.length-1;t>=0;t--){const i=this.audioInArr[t];e.find(e=>e.track&&i&&e.track.id===i.id)||(this.logger.log("updateTracks,删除",i.label,i.id),this.audioInArr.splice(t,1),i.disconnect())}for(let t=e.length-1;t>=0;t--){const i=e[t];if(!this.audioInArr.find(e=>i.track&&i.track.id===e.id)&&i.track)if(this.context){const e=new MediaStream;e.addTrack(i.track);const t={context:this.context,id:i.track.id,label:i.track.label,audioNode:this.createSource({mediaStream:e}),type:i.type},r=new p(t);r.gainNode.gain.value=this.gain,this.audioInArr.push(r)}else this.logger.error("updateTracks:没有audioContext")}this.initAudioIn()}removeTrack(e){for(let t=this.audioInArr.length-1;t>=0;t--){const i=this.audioInArr[t];i.id===e.id&&(this.logger.log("removeTrack,删除track",e.id,e.label),this.audioInArr.splice(t,1),i.disconnect())}}setGain(e,t){for(let i=0;i<this.audioInArr.length;i++){const r=this.audioInArr[i];t&&t!==r.type||(this.logger.log("WebAudio.setGain",t,e,r.type,r.label,r.id),r.gainNode.gain.value=0,r.gainNode.gain.setValueAtTime(e,this.context.currentTime))}t||(this.gain=e)}getGain(){if(this.gainFilter)return this.gain}getMicrophoneGain(){for(let e=0;e<this.audioInArr.length;e++){const t=this.audioInArr[e];if("microphone"==t.type)return t.gainNode.gain.value}return 1}getGainMin(){let e=1;for(let t=0;t<this.audioInArr.length;t++){const i=this.audioInArr[t];i.gainNode.gain.value<e&&(e=i.gainNode.gain.value)}return e}stop(){this.gainFilter&&(this.script?this.script.disconnect(0):this.gainFilter.disconnect(0),this.instant=0)}start(){this.gainFilter&&this.destination&&(this.script&&this.analyzeDestination&&(this.gainFilter.connect(this.script),this.script.connect(this.analyzeDestination)),this.gainFilter.connect(this.destination))}setAudioEffectLite(e,t){var i;switch(e){case"Pitch":this.setPitch(t);break;case"close":null===(i=this.JungleNode)||void 0===i||i.disconnect();break;default:this.logger.warn("暂不支持的类型:",e)}}setPitch(e){var t,i,r,s;this.context&&this.destination&&this.gainFilter&&(this.JungleNode||this._initJungleNode(),(null===(i=null===(t=this.JungleNode)||void 0===t?void 0:t.Jungle)||void 0===i?void 0:i.connected)||null===(r=this.JungleNode)||void 0===r||r.connect(),this.logger.log("setPitch: ",e),null===(s=this.JungleNode)||void 0===s||s.setPitchOffset(e))}_initJungleNode(){this.context&&this.destination&&this.gainFilter?(this.JungleNode=new l.default({context:this.context,logger:this.logger}),this.JungleNode.input=this.gainFilter,this.JungleNode.output=this.destination):this.logger.error("_initJungle: contxt is null")}resetMixConf(){var e,t,i;if(null===(e=this.mixAudioConf.audioSource)||void 0===e||e.disconnect(0),null===(t=this.mixAudioConf.gainFilter)||void 0===t||t.disconnect(0),this.mixAudioConf.replace){this.logger.log("伴音停止了,恢复mic");if(null===(i=this.mediaHelper.audio.stageAIProcessing)||void 0===i?void 0:i.enabled)this.connectAiNode();else if(this.gainFilter&&this.destination){for(var r=0;r<this.audioInArr.length;r++){this.audioInArr[r].gainNode.connect(this.gainFilter)}this.script&&this.analyzeDestination&&(this.gainFilter.connect(this.script),this.script.connect(this.analyzeDestination)),this.gainFilter.connect(this.destination)}}this.mixAudioConf={state:a.AuidoMixingState.UNSTART,audioSource:null,gainFilter:null,replace:!1,cycle:0,pauseTime:0,startTime:0,totalTime:0,volume:1,playStartTime:0,setPlayStartTime:0,auidoMixingEnd:null},this.gainFilter&&1===this.gainFilter.gain.value&&this.emit("audioFilePlaybackCompleted")}startMix(e){var t;if(!this.context||!this.destination||!this.gainFilter)return this.logger.error("startMix: 不支持伴音"),Promise.reject(new n.default({code:o.default.AUDIO_MIX_NO_SUPPORT,message:"startMix:不支持伴音"}));if(this.logger.log("开始混音: ",JSON.stringify(e)),this.mixAudioConf.audioSource=this.context.createBufferSource(),this.mixAudioConf.gainFilter=this.context.createGain(),this.mixAudioConf.audioSource.buffer=e.buffer,this.mixAudioConf.replace=e.replace,this.mixAudioConf.cycle=e.cycle,this.mixAudioConf.playStartTime=e.playStartTime,this.mixAudioConf.volume=e.volume?e.volume/100:1,this.mixAudioConf.auidoMixingEnd=e.auidoMixingEnd,this.mixAudioConf.audioSource.connect(this.mixAudioConf.gainFilter),this.mixAudioConf.gainFilter.connect(this.gainFilter),this.musicDestination&&this.mixAudioConf.gainFilter.connect(this.musicDestination),e.replace){for(var i=0;i<this.audioInArr.length;i++){const e=this.audioInArr[i];try{e.gainNode.disconnect(this.gainFilter),this.logger.log(`已断开音频:【${e.label}】`)}catch(t){"InvalidAccessError"===t.name?this.logger.log(`音频断开前未连接:【${e.label}】`):this.logger.error(`无法断开音频:【${e.label}】${t.name}`,t.message)}}(null===(t=this.mediaHelper.audio.stageAIProcessing)||void 0===t?void 0:t.enabled)&&this.disconnectAiNode()}if(this.mixAudioConf.audioSource.onended=e=>{this.audioEnd(e)},this.mixAudioConf.totalTime=e.buffer.duration,(this.mixAudioConf.playStartTime<0||this.mixAudioConf.playStartTime>=this.mixAudioConf.totalTime)&&(this.mixAudioConf.playStartTime=0),this.logger.log("设置音量:",this.mixAudioConf.volume),this.mixAudioConf.gainFilter.gain.value=this.mixAudioConf.volume,e.loopback&&e.cycle>1){this.mixAudioConf.audioSource.loop=e.loopback;const t=e.cycle*this.mixAudioConf.totalTime-this.mixAudioConf.playStartTime;this.logger.log("循环播放: options.playStartTime: ",this.mixAudioConf.playStartTime),this.logger.log("循环播放: totalTime: ",t),this.mixAudioConf.audioSource.start(0,this.mixAudioConf.playStartTime,t-1)}else e.loopback&&1==e.cycle?(this.mixAudioConf.audioSource.loop=!1,this.mixAudioConf.audioSource.start(0,this.mixAudioConf.playStartTime)):(this.logger.log("无限循环播放 loop: ",e.loopback),this.mixAudioConf.audioSource.loop=e.loopback,this.mixAudioConf.audioSource.start(0,this.mixAudioConf.playStartTime));return this.mixAudioConf.state=a.AuidoMixingState.PLAYED,this.mixAudioConf.startTime=Date.now(),Promise.resolve()}pauseAudioMixing(){if(!this.mixAudioConf.audioSource||!this.mixAudioConf.gainFilter)return void this.logger.error("pauseAudioMixing: 缺失audioSource/gainFilter");this.logger.log("暂停混音"),this.mixAudioConf.audioSource.onended=null,this.mixAudioConf.audioSource.disconnect(0),this.mixAudioConf.gainFilter.disconnect(0),this.mixAudioConf.audioSource.stop(),this.mixAudioConf.pauseTime=Date.now(),this.mixAudioConf.state=a.AuidoMixingState.PAUSED;let e=(this.mixAudioConf.pauseTime-this.mixAudioConf.startTime)/1e3+this.mixAudioConf.playStartTime;return this.logger.log("已经播放的时间: ",e),e>this.mixAudioConf.totalTime&&(e%=this.mixAudioConf.totalTime),this.logger.log("暂停位置:",e),Promise.resolve()}resumeAudioMixing(e){return this.logger.log("恢复混音"),this.mixAudioConf.pauseTime=0,e.volume=100*this.mixAudioConf.volume,this.startMix(e)}stopAudioMixing(e=!0){return this.mixAudioConf.audioSource&&this.mixAudioConf.gainFilter?(this.logger.log("开始停止混音, isFinished: ",e),this.mixAudioConf.audioSource.onended=null,this.mixAudioConf.audioSource.disconnect(0),this.mixAudioConf.gainFilter.disconnect(0),this.mixAudioConf.audioSource.stop(),this.mixAudioConf.state=a.AuidoMixingState.STOPED,e&&this.resetMixConf(),this.logger.log("混音已停止"),Promise.resolve()):Promise.reject(new n.default({code:o.default.AUDIO_MIX_NOT_STATE_ERROR,message:"stopAudioMixing() 当前没有开启伴音"}))}audioEnd(e){if(this.mixAudioConf.state===a.AuidoMixingState.PLAYED){if(!(this.mixAudioConf.audioSource&&this.mixAudioConf.audioSource.loop&&this.mixAudioConf.cycle<=0))return this.logger.log("伴音播放完成: ",this.mixAudioConf),this.mixAudioConf.audioSource&&(this.mixAudioConf.audioSource.onended=null),this.mixAudioConf.auidoMixingEnd&&(this.mixAudioConf.auidoMixingEnd(e),this.mixAudioConf.auidoMixingEnd=null),this.resetMixConf(),Promise.resolve();this.logger.log("无限循环时, 伴音播放完成event: ",e)}else this.logger.error("audioEnd:参数不够")}setAudioMixingVolume(e){if(this.mixAudioConf.gainFilter)return this.mixAudioConf.gainFilter.gain.value=e/100,this.mixAudioConf.volume=this.mixAudioConf.gainFilter.gain.value,Promise.resolve();this.logger.error("setAudioMixingVolume: 参数缺失gainFilter")}setAudioMixingPlayTime(e){return this.mixAudioConf.state===a.AuidoMixingState.PLAYED&&(this.mixAudioConf.setPlayStartTime=e.playStartTime),e.volume=100*this.mixAudioConf.volume,this.startMix(e)}getAudioMixingPlayedTime(){let e=Date.now();this.mixAudioConf.state==a.AuidoMixingState.PAUSED&&this.mixAudioConf.pauseTime&&(this.logger.log("当前是暂停状态"),e=this.mixAudioConf.pauseTime);let t=(e-this.mixAudioConf.startTime)/1e3+this.mixAudioConf.playStartTime;return t>this.mixAudioConf.totalTime&&(t%=this.mixAudioConf.totalTime),{playedTime:t}}getAudioMixingTotalTime(){return{totalTime:this.mixAudioConf.totalTime