aliyun-rtc-sdk 7.1.1-beta.1 → 7.1.1-beta.2
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.
|
@@ -157,4 +157,4 @@ t=0 0\r
|
|
|
157
157
|
a=extmap-allow-mixed`)!==-1){const Z=X.sdp.split(`
|
|
158
158
|
`).filter(te=>te.trim()!=="a=extmap-allow-mixed").join(`
|
|
159
159
|
`);w.RTCSessionDescription&&X instanceof w.RTCSessionDescription?arguments[0]=new w.RTCSessionDescription({type:X.type,sdp:Z}):X.sdp=Z}return Y.apply(this,arguments)}}function He(w,K){if(!w.RTCPeerConnection||!w.RTCPeerConnection.prototype)return;const Y=w.RTCPeerConnection.prototype.addIceCandidate;Y&&Y.length!==0&&(w.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():Y.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}const We=function({window:w}={},K={shimChrome:!0,shimFirefox:!0,shimEdge:!0,shimSafari:!0}){const Y=s,X=function(te){const Q={browser:null,version:null};if(te===void 0||!te.navigator)return Q.browser="Not a browser.",Q;const{navigator:oe}=te;if(oe.mozGetUserMedia)Q.browser="firefox",Q.version=p(oe.userAgent,/Firefox\/(\d+)\./,1);else if(oe.webkitGetUserMedia||te.isSecureContext===!1&&te.webkitRTCPeerConnection&&!te.RTCIceGatherer)Q.browser="chrome",Q.version=p(oe.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(oe.mediaDevices&&oe.userAgent.match(/Edge\/(\d+).(\d+)$/))Q.browser="edge",Q.version=p(oe.userAgent,/Edge\/(\d+).(\d+)$/,2);else{if(!te.RTCPeerConnection||!oe.userAgent.match(/AppleWebKit\/(\d+)\./))return Q.browser="Not a supported browser.",Q;Q.browser="safari",Q.version=p(oe.userAgent,/AppleWebKit\/(\d+)\./,1),Q.supportsUnifiedPlan=te.RTCRtpTransceiver&&"currentDirection"in te.RTCRtpTransceiver.prototype}return Q}(w),Z={browserDetails:X,commonShim:f,extractVersion:p,disableLog:r,disableWarnings:n};switch(X.browser){case"chrome":if(!v||!O||!K.shimChrome)return Y("Chrome shim is not included in this adapter release."),Z;if(X.version===null)return Y("Chrome shim can not determine version, not shimming."),Z;Y("adapter.js shimming chrome."),Z.browserShim=v,He(w,X),h(w,X),g(w),O(w,X),m(w),A(w,X),T(w),C(w),D(w),j(w,X),Oe(w),Pe(w),Ce(w,X),Ae(w),we(w,X);break;case"firefox":if(!u||!z||!K.shimFirefox)return Y("Firefox shim is not included in this adapter release."),Z;Y("adapter.js shimming firefox."),Z.browserShim=u,He(w,X),V(w,X),z(w,X),q(w),ee(w),$(w),re(w),ie(w),se(w),ce(w),ue(w),de(w),Oe(w),Pe(w),Ce(w,X),Ae(w);break;case"edge":if(!c||!B||!K.shimEdge)return Y("MS edge shim is not included in this adapter release."),Z;Y("adapter.js shimming edge."),Z.browserShim=c,F(w),U(w),B(w,X),M(w),Ce(w,X),Ae(w);break;case"safari":if(!S||!K.shimSafari)return Y("Safari shim is not included in this adapter release."),Z;Y("adapter.js shimming safari."),Z.browserShim=S,He(w,X),ge(w),Re(w),he(w),pe(w),Ee(w),_e(w),fe(w),Te(w),Oe(w),Ce(w,X),Ae(w),we(w,X);break;default:Y("Unsupported browser!")}return Z}({window:typeof window>"u"?void 0:window}),xe=We},6834:(L,R,x)=>{x.r(R),x.d(R,{default:()=>u});var v=x(5512),c=x.n(v);function u(){return c()('/*! aliyun rts sdk - ver2.12.5 created:2025/6/6 14:17:23 */(()=>{"use strict";var e={917:(e,r)=>{var t,n,a,o;Object.defineProperty(r,"__esModule",{value:!0}),r.DEFAULT_RETRY_DATACHANNEL_TIMEOUT=r.DEFAULT_HEARTBEAT_TIMEOUT=r.DEFAULT_RETRY_PUBLISH_INTERVAL=r.DEFAULT_RETRY_SUBSCRIBE_INTERVAL=r.DEFAULT_RETRY_PUBLISH_LIMIT=r.DEFAULT_RETRY_SUBSCRIBE_LIMIT=r.EWorkerAction=r.EWorkerSource=r.EConnectStatus=r.TrackType=void 0,function(e){e.AUDIO="audio",e.VIDEO="video"}(t||(r.TrackType=t={})),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"}(n||(r.EConnectStatus=n={})),function(e){e.Sender="sender",e.Receiver="receiver"}(a||(r.EWorkerSource=a={})),function(e){e.Setup="setup",e.InserSEI="insertSEI"}(o||(r.EWorkerAction=o={})),r.DEFAULT_RETRY_SUBSCRIBE_LIMIT=5,r.DEFAULT_RETRY_PUBLISH_LIMIT=5,r.DEFAULT_RETRY_SUBSCRIBE_INTERVAL=2e3,r.DEFAULT_RETRY_PUBLISH_INTERVAL=2e3,r.DEFAULT_HEARTBEAT_TIMEOUT=8,r.DEFAULT_RETRY_DATACHANNEL_TIMEOUT=8e3},594:(e,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.readUUID=r.discardEPB=r.insertEPB=r.SODBtoRBSP=r.convertPayloadSize=r.NALU=r.SEI=r.parseSei=r.insertSei=void 0;r.insertSei=function(e,r,a,o){void 0===a&&(a=5);for(var i=e.data,u=new DataView(i),c=0;;){if(1===u.getUint32(c)){u.getUint8(c+4);var s=new t(r,a,o).buffer,f=new n(s).buffer,T=new ArrayBuffer(f.byteLength+i.byteLength),E=new Uint8Array(T),l=new Uint8Array(f);E.set(l);var d=new Uint8Array(i);E.set(d,f.byteLength),e.data=T,c+=1;break}if((c+=1)+4>=u.byteLength)break}};r.parseSei=function(e){for(var t=[],n=new DataView(e),a=0;;){var o=a,i=n.getUint32(o);if(o+=4,1===i){if(6===(31&n.getUint8(o++))){for(var u=n.getUint8(o++),c=5===u?16:0,s=0;255==n.getUint8(o);)o++,s+=255;if((s+=n.getUint8(o++))>0&&n.byteLength>o+s){var f=new Uint8Array(n.buffer),T="";if(5===u){var E=f.slice(o,o+c);T=(0,r.readUUID)((0,r.discardEPB)(E))}var l=f.slice(o+c,o+s);o+=s,t.push({payloadType:u,uuid:T,data:l.buffer})}}a=o}else a+=1;if(a+4>=n.byteLength)break}return t};var t=function(e,t,n){void 0===t&&(t=5);var a=5===t?16:0,o=e.byteLength+a,i=(0,r.convertPayloadSize)(o),u=i.buffer.byteLength,c=new ArrayBuffer(1+u+a+e.byteLength),s=new Uint8Array(c),f=0;if(s[f++]=t,s.set(i,f),f+=i.byteLength,5===t){n=(n||"00000000-0000-0000-0000-000000000000").replace(/-/g,"");for(var T=0;T<16;T++)s[f+T]=parseInt(n.substr(2*T,2),16);f+=16}var E=new Uint8Array(e);s.set(E,f);var l=(0,r.SODBtoRBSP)(s);this.buffer=l.buffer};r.SEI=t;var n=function(e){var r=new Uint8Array([0,0,0,1]),t=new Uint8Array([6]),n=new ArrayBuffer(r.byteLength+t.byteLength+e.byteLength),a=new Uint8Array(n);a.set(r),a.set(t,r.byteLength),a.set(new Uint8Array(e),r.byteLength+t.byteLength),this.buffer=n};r.NALU=n;r.convertPayloadSize=function(e){if(e<=0)throw new Error("payloadSize must be a positive integer.");for(var r=Math.ceil(e/255),t=new ArrayBuffer(r),n=new DataView(t),a=0;a<r-1;a++)n.setUint8(a,255);return n.setUint8(r-1,e%255&255),new Uint8Array(t)};r.SODBtoRBSP=function(e){for(var t=new Uint8Array(e),n="",a=0;a<t.length;a++)n+=t[a].toString(2).padStart(8,"0");for(n+="1";n.length%8!=0;)n+="0";var o=n.length/8,i=new Uint8Array(o);for(a=0;a<o;a++)i[a]=parseInt(n.slice(8*a,8*a+8),2);return(0,r.insertEPB)(i)};r.insertEPB=function(e){for(var r=[],t=0,n=0;n<e.length;n++)r.push(e[n]),0===e[n]?2===++t&&n<e.length-1&&e[n+1]<=3&&(r.push(3),t=0):t=0;return new Uint8Array(r)};r.discardEPB=function(e){for(var r=e.byteLength,t=[],n=1;n<r-2;)0===e[n]&&0===e[n+1]&&3===e[n+2]?(t.push(n+2),n+=2):n++;if(0===t.length)return e;var a=r-t.length,o=new Uint8Array(a),i=0;for(n=0;n<a;i++,n++)i===t[0]&&(i++,t.shift()),o[n]=e[i];return o};r.readUUID=function(e){if(16!==e.length)throw new Error("UUID must be 16 bytes long.");var r=e.reduce((function(e,r){return e+r.toString(16).padStart(2,"0")}),"");return"".concat(r.slice(0,8),"-").concat(r.slice(8,12),"-").concat(r.slice(12,16),"-").concat(r.slice(16,20),"-").concat(r.slice(20))}},718:function(e,r){var t=this&&this.__spreadArray||function(e,r,t){if(t||2===arguments.length)for(var n,a=0,o=r.length;a<o;a++)!n&&a in r||(n||(n=Array.prototype.slice.call(r,0,a)),n[a]=r[a]);return e.concat(n||Array.prototype.slice.call(r))};Object.defineProperty(r,"__esModule",{value:!0}),r.hebtLog=r.createUUID=r.evaluateNetworkCondition=r.makeCancelable=r.hasVideoTrack=r.hasAudioTrack=r.getVideoTrack=r.getAudioTrack=r.pruneSubUrl=r.getJitterBufferDelayAvg=void 0;r.getJitterBufferDelayAvg=function(e,r){return e&&r?Number(e)/Number(r)*1e3:-1};r.pruneSubUrl=function(e,r){var t=e||"";return t=t.replace("@subaudio=no","").replace("@subvideo=no",""),r&&(t=t.split("?")[0]),t};r.getAudioTrack=function(e){return e.getAudioTracks()[0]};r.getVideoTrack=function(e){return e.getVideoTracks()[0]};r.hasAudioTrack=function(e){return e.getAudioTracks().length>0};r.hasVideoTrack=function(e){return e.getVideoTracks().length>0};r.makeCancelable=function(e){var r=!1;return{promise:new Promise((function(t,n){e.then((function(e){return r?n({isCanceled:!0}):t(e)})),e.catch((function(e){return n(r?{isCanceled:!0}:e)}))})),cancel:function(){r=!0}}};r.evaluateNetworkCondition=function(e,r,t,n,a){var o=0;if(!navigator.onLine)return o=6;var i=[{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}],u=-1,c=-1,s=-1;if("number"==typeof r&&r>=0||"number"==typeof t&&t>=0){u=0;var f=!1,T=!1;"number"==typeof r&&r>=0&&(u+=r,f=!0),"number"==typeof t&&t>=0&&(u+=t,T=!0),f&&!T&&(u*=2),T&&!f&&(u*=1.8)}if("number"==typeof e&&e>=0&&(s=e),"number"==typeof n&&n>=0||"number"==typeof a&&a>=0){c=0;"number"==typeof n&&n>=0&&(c+=n),"number"==typeof a&&a>=0&&(c+=a)}var E;if((E=4*(-1!==u?1:0)+2*(-1!==s?1:0)+(-1!==c?1:0))>0){var l=1.2*u*i[E-1].loss+s/1500*i[E-1].rtt+c/3e3*i[E-1].jbd;o=l<=.1?1:l<=.23?2:l<=.36?3:l<=.49?4:5}else o=0;return o};r.createUUID=function(e,r){var t,n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),a=[];if(r=r||n.length,e)for(t=0;t<e;t++)a[t]=n[0|Math.random()*r];else{var o=void 0;for(a[8]=a[13]=a[18]=a[23]="-",a[14]="4",t=0;t<36;t++)a[t]||(o=0|16*Math.random(),a[t]=n[19==t?3&o|8:o])}return a.join("")};r.hebtLog=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];window.RTS_HEBT_DEBUG&&console.log.apply(console,t(["[rts hebt]"],e,!1))}}},r={};function t(n){var a=r[n];if(void 0!==a)return a.exports;var o=r[n]={exports:{}};return e[n].call(o.exports,o,o.exports,t),o.exports}var n,a,o,i,u,c,s;a=t(594),o=t(718),i=t(917),u=self,c=function(e,r,t,o){if(e===i.EWorkerSource.Sender){var u=new TransformStream({transform:function(e,r){e.type&&(n&&((0,a.insertSei)(e,n.sei,n.payloadType,n.uuid),void 0===n.repeatCount?n=null:-1!==n.repeatCount&&(n.repeatCount--,n.repeatCount<0&&(n=null))),o&&o(e)),r.enqueue(e)}});r.pipeThrough(u).pipeTo(t)}else e===i.EWorkerSource.Receiver&&(u=new TransformStream({transform:function(e,r){e.type&&o&&o(e),r.enqueue(e)}}),r.pipeThrough(u).pipeTo(t))},s=function(e){var r=e.data.slice(0);u.postMessage({type:"encodedFrame",data:r,frameInfo:{type:e.type,timestamp:e.timestamp}},[r]),r=null},u.RTCTransformEvent&&(u.onrtctransform=function(e){var r=e.transformer,t=r.options.source,n=r.readable,a=r.writable;c(t,n,a,(function(e){t===i.EWorkerSource.Receiver&&s(e)}))}),onmessage=function(e){switch(e.data.operation){case i.EWorkerAction.Setup:r=e.data,t=r.source,a=r.readable,u=r.writable,c(t,a,u,(function(e){t===i.EWorkerSource.Receiver&&s(e)}));break;case i.EWorkerAction.InserSEI:!function(e){(n=e)&&(n.uuid=(0,o.createUUID)().toLowerCase(),n.repeatCount=n.repeatCount||0)}(e.data)}var r,t,a,u}})();',"Worker",void 0,void 0)}},5512:L=>{L.exports=function(R,x,v,c){var u=self||window;try{try{var S;try{S=new u.Blob([R])}catch{(S=new(u.BlobBuilder||u.WebKitBlobBuilder||u.MozBlobBuilder||u.MSBlobBuilder)).append(R),S=S.getBlob()}var f=u.URL||u.webkitURL,a=f.createObjectURL(S),d=new u[x](a,v);return f.revokeObjectURL(a),d}catch{return new u[x]("data:application/javascript,".concat(encodeURIComponent(R)),v)}}catch{if(!c)throw Error("Inline worker is not supported");return new u[x](c,v)}}},2632:(L,R,x)=>{x.r(R),x.d(R,{default:()=>p});function v(e,r,n){Object.defineProperty(e,r,{writable:!0,enumerable:!0,configurable:!0,value:n})}Array(32);var c,u,S;class f{constructor(r){var n,s;this.timer=null,this.time=10,this.count=10,this.arr=[],this.time=(n=r.time)!=null?n:10,this.count=(s=r.count)!=null?s: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 n={__logs__:r};return this.opt.tags&&(n.__tags__=this.opt.tags),this.opt.topic&&(n.__topic__=this.opt.topic),this.opt.source&&(n.__source__=this.opt.source),JSON.stringify(n)}platformSend(){if(this.opt.sendPayload&&typeof this.opt.sendPayload=="function"){const r=this.assemblePayload();this.opt.sendPayload(this.url,r)}}transString(r){let n={};for(let s in r)typeof r[s]=="object"?n[s]=JSON.stringify(r[s]):n[s]=String(r[s]);return n}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 n=this.transString(r);this.arr.push(n),this.sendInner()}sendImmediate(r){const n=this.transString(r);this.arr.push(n),this.sendImmediateInner()}sendBatchLogs(r){const n=r.map(s=>this.transString(s));this.arr.push(...n),this.sendInner()}sendBatchLogsImmediate(r){const n=r.map(s=>this.transString(s));this.arr.push(...n),this.sendImmediateInner()}}function a(e,r){const n=new window.XMLHttpRequest;n.open("POST",`${e}?APIVersion=0.6.0`,!0),n.send(r)}function d(e,r){try{if(r.length>=32768)return void a(e,r);(function(n,s){return!(!navigator||!navigator.sendBeacon)&&navigator.sendBeacon(`${n}?APIVersion=0.6.0`,s)})(e,r)||a(e,r)}catch(n){window&&window.console&&typeof window.console.error=="function"&&(console.error(`Failed to log to ali log service because of this exception:
|
|
160
|
-
`+n),console.error("Failed log data:",e))}}class p extends f{constructor(r){super(Object.assign({},r,{installUnloadHook:n=>{window.addEventListener("beforeunload",()=>{n()})},sendPayload:(n,s)=>{d(n,s)}}))}}c=window,u="SLS_Tracker",S=p,v(c,u,S)},4198:L=>{L.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"}]}')}},N={};function J(L){var R=N[L];if(R!==void 0)return R.exports;var x=N[L]={exports:{}};return P[L].call(x.exports,x,x.exports,J),x.exports}return J.n=L=>{var R=L&&L.__esModule?()=>L.default:()=>L;return J.d(R,{a:R}),R},J.d=(L,R)=>{for(var x in R)J.o(R,x)&&!J.o(L,x)&&Object.defineProperty(L,x,{enumerable:!0,get:R[x]})},J.o=(L,R)=>Object.prototype.hasOwnProperty.call(L,R),J.r=L=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(L,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(L,"__esModule",{value:!0})},J(8156)})())})(Hr);for(var jn=Hr.exports,Be=[],Gt=0;Gt<256;++Gt)Be.push((Gt+256).toString(16).slice(1));function Wn(W,k=0){return(Be[W[k+0]]+Be[W[k+1]]+Be[W[k+2]]+Be[W[k+3]]+"-"+Be[W[k+4]]+Be[W[k+5]]+"-"+Be[W[k+6]]+Be[W[k+7]]+"-"+Be[W[k+8]]+Be[W[k+9]]+"-"+Be[W[k+10]]+Be[W[k+11]]+Be[W[k+12]]+Be[W[k+13]]+Be[W[k+14]]+Be[W[k+15]]).toLowerCase()}var rt,Gn=new Uint8Array(16);function zn(){if(!rt&&(rt=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!rt))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return rt(Gn)}var qn=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Vr={randomUUID:qn};function nt(W,k,P){if(Vr.randomUUID&&!k&&!W)return Vr.randomUUID();W=W||{};var N=W.random||(W.rng||zn)();return N[6]=N[6]&15|64,N[8]=N[8]&63|128,Wn(N)}var Yn=/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(W,k,P,N){if(arguments.length===1&&typeof W=="string"&&!/\d/.test(W)&&(k=W,W=void 0),W=W||W===0?W:new Date,W instanceof Date||(W=new Date(W)),isNaN(W))throw TypeError("Invalid date");k=String(jr[k]||k||jr.default);var J=k.slice(0,4);(J==="UTC:"||J==="GMT:")&&(k=k.slice(4),P=!0,J==="GMT:"&&(N=!0));var L=function(){return P?"getUTC":"get"},R=function(){return W[L()+"Date"]()},x=function(){return W[L()+"Day"]()},v=function(){return W[L()+"Month"]()},c=function(){return W[L()+"FullYear"]()},u=function(){return W[L()+"Hours"]()},S=function(){return W[L()+"Minutes"]()},f=function(){return W[L()+"Seconds"]()},a=function(){return W[L()+"Milliseconds"]()},d=function(){return P?0:W.getTimezoneOffset()},p=function(){return Jn(W)},e=function(){return Qn(W)},r={d:function(){return R()},dd:function(){return Ve(R())},ddd:function(){return Ue.dayNames[x()]},DDD:function(){return Wr({y:c(),m:v(),d:R(),_:L(),dayName:Ue.dayNames[x()],short:!0})},dddd:function(){return Ue.dayNames[x()+7]},DDDD:function(){return Wr({y:c(),m:v(),d:R(),_:L(),dayName:Ue.dayNames[x()+7]})},m:function(){return v()+1},mm:function(){return Ve(v()+1)},mmm:function(){return Ue.monthNames[v()]},mmmm:function(){return Ue.monthNames[v()+12]},yy:function(){return String(c()).slice(2)},yyyy:function(){return Ve(c(),4)},h:function(){return u()%12||12},hh:function(){return Ve(u()%12||12)},H:function(){return u()},HH:function(){return Ve(u())},M:function(){return S()},MM:function(){return Ve(S())},s:function(){return f()},ss:function(){return Ve(f())},l:function(){return Ve(a(),3)},L:function(){return Ve(Math.floor(a()/10))},t:function(){return u()<12?Ue.timeNames[0]:Ue.timeNames[1]},tt:function(){return u()<12?Ue.timeNames[2]:Ue.timeNames[3]},T:function(){return u()<12?Ue.timeNames[4]:Ue.timeNames[5]},TT:function(){return u()<12?Ue.timeNames[6]:Ue.timeNames[7]},Z:function(){return N?"GMT":P?"UTC":$n(W)},o:function(){return(d()>0?"-":"+")+Ve(Math.floor(Math.abs(d())/60)*100+Math.abs(d())%60,4)},p:function(){return(d()>0?"-":"+")+Ve(Math.floor(Math.abs(d())/60),2)+":"+Ve(Math.floor(Math.abs(d())%60),2)},S:function(){return["th","st","nd","rd"][R()%10>3?0:(R()%100-R()%10!=10)*R()%10]},W:function(){return p()},WW:function(){return Ve(p())},N:function(){return e()}};return k.replace(Yn,function(n){return n in r?r[n]():n.slice(1,n.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"},Ue={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"]},Ve=function(k){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;return String(k).padStart(P,"0")},Wr=function(k){var P=k.y,N=k.m,J=k.d,L=k._,R=k.dayName,x=k.short,v=x===void 0?!1:x,c=new Date,u=new Date;u.setDate(u[L+"Date"]()-1);var S=new Date;S.setDate(S[L+"Date"]()+1);var f=function(){return c[L+"Date"]()},a=function(){return c[L+"Month"]()},d=function(){return c[L+"FullYear"]()},p=function(){return u[L+"Date"]()},e=function(){return u[L+"Month"]()},r=function(){return u[L+"FullYear"]()},n=function(){return S[L+"Date"]()},s=function(){return S[L+"Month"]()},t=function(){return S[L+"FullYear"]()};return d()===P&&a()===N&&f()===J?v?"Tdy":"Today":r()===P&&e()===N&&p()===J?v?"Ysd":"Yesterday":t()===P&&s()===N&&n()===J?v?"Tmw":"Tomorrow":R},Jn=function(k){var P=new Date(k.getFullYear(),k.getMonth(),k.getDate());P.setDate(P.getDate()-(P.getDay()+6)%7+3);var N=new Date(P.getFullYear(),0,4);N.setDate(N.getDate()-(N.getDay()+6)%7+3);var J=P.getTimezoneOffset()-N.getTimezoneOffset();P.setHours(P.getHours()-J);var L=(P-N)/(864e5*7);return 1+Math.floor(L)},Qn=function(k){var P=k.getDay();return P===0&&(P=7),P},$n=function(k){return(String(k).match(Kn)||[""]).pop().replace(Xn,"").replace(/GMT\+0000/g,"UTC")},qt;(function(W){W.prod="rs.rtn.aliyuncs.com",W.pre="prs.rtn.aliyuncs.com"})(qt||(qt={}));var Gr;(function(W){W[W.ByClient=0]="ByClient",W[W.KickOut=1]="KickOut",W[W.ChannelClosed=2]="ChannelClosed",W[W.Restore=3]="Restore",W[W.Expired=4]="Expired",W[W.Reconnect=5]="Reconnect",W[W.ReconnectExhausted=6]="ReconnectExhausted"})(Gr||(Gr={}));const zr="7.1.1-beta.1";class Kt{static getVersionNumber(){let k=zr.split("."),P="";return k.forEach(N=>{N.length===1?P+="0"+N:P+=N}),parseInt(P)}static queryingParam(k){let P=[];if(k)for(let N in k)P.push(N+"="+k[N]);return P.join("&")}static getQueryParams(k){const P=window.location.search.substring(1).split("&");for(let N=0;N<P.length;N++){const J=P[N].split("=");if(decodeURIComponent(J[0])===k)return decodeURIComponent(J[1])}}static createCallid(k=""){const P=nt();return k&&P&&P.length>k.length?`${k}${P.substring(k.length)}`:P}static checkSubOptionsValid(k){if(k){const{audio:P,video:N,screen:J}=k;if(P===!1&&N===!1&&J===!1)return!1}return!0}static async isNetworkAvailable(){const k=qt.prod,{onLine:P}=navigator;if(!P)return!1;try{return await fetch(`https://${k}/roomserver/v1/ws/version`),!0}catch{return!1}}static toString(k){let P;if(k instanceof Error)P=k.message;else if(typeof k=="string")P=k;else try{P=JSON.stringify(k)}catch{P="undefined"}return P}static paramArrayToString(k){let P="";for(let N=0;N<k.length;N++){P!==""&&(P+=" ");let J=Kt.toString(k[N]);P+=J}return P}}const Zn=(W,k)=>W.find(P=>{if(typeof P.test=="function")return P.test(k);if(Array.isArray(P.test))return P.test.some(N=>typeof N=="string"?k.indexOf(N)>-1:N instanceof RegExp?N.test(k):!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 W="unknown";try{const k=navigator.userAgent||"",P=Zn(ei,k);if(!P)return W;W=P.describe(k)}catch{}return W};var ri=Object.defineProperty,ni=(W,k,P)=>k in W?ri(W,k,{enumerable:!0,configurable:!0,writable:!0,value:P}):W[k]=P,De=(W,k,P)=>ni(W,typeof k!="symbol"?k+"":k,P);const{BrowserUtil:qr,SystenUtil:Yr}=jn.AliRTS,ii=ti(),oi="woMMssV6jmyol9fr",ai=200,it=10*60*1e3,ot={host:"cn-hangzhou.log.aliyuncs.com",project:"alivc-aio",logstore:"logger",time:10,count:10};function Yt(){return zt(new Date,"HH:MM:ss.l")}function Kr(){return zt(new Date,"isoDate")}var Fe;(function(W){W[W.DEBUG=0]="DEBUG",W[W.INFO=1]="INFO",W[W.API=2]="API",W[W.WARNING=3]="WARNING",W[W.ERROR=4]="ERROR",W[W.NONE=5]="NONE"})(Fe||(Fe={}));var Ke;(function(W){W[W.TASK_UPLOAD_BEGIN=710201]="TASK_UPLOAD_BEGIN",W[W.SESSION_UPLOAD_BEGIN=710202]="SESSION_UPLOAD_BEGIN",W[W.SESSION_UPLOAD_ING=710203]="SESSION_UPLOAD_ING",W[W.SESSION_UPLOAD_END=710204]="SESSION_UPLOAD_END",W[W.TASK_UPLOAD_END=710205]="TASK_UPLOAD_END"})(Ke||(Ke={}));class si{constructor(){De(this,"tracker"),De(this,"slsPlugin"),De(this,"stsData"),De(this,"stsExpiration",Date.now()),De(this,"clientId",nt()),De(this,"bSesid",nt()),De(this,"logLevel",Fe.WARNING),De(this,"appId",""),De(this,"sessionId",""),De(this,"logCache",[]),De(this,"updateTaskTimer"),De(this,"endReported",!0),De(this,"logSequence",0),De(this,"sendLogBeforeUnload",async k=>{if(!this.slsPlugin)return;this.logSequence+=1,k.unshift(this.getLogParams(Ke.SESSION_UPLOAD_ING,{log:`[${Kr()} ${Yt()}] [INF] beforeunload`,stat_log_seq:this.logSequence}));const P=`https://${ot.project}.${ot.host}/logstores/${ot.logstore}`,N={__logs__:k.map(R=>this.slsPlugin.transString(R))},{data:J,header:L}=await this.slsPlugin.process(P,JSON.stringify(N));fetch(P,{keepalive:!0,method:"POST",headers:L,body:J})}),De(this,"logMethod",(k,P=console.log)=>(...N)=>{let J=Yt();this.logLevel<=k&&P(J,...N);let L=Kt.paramArrayToString(N);k>Fe.DEBUG&&this.addLog(L)}),De(this,"d",this.logMethod(Fe.DEBUG,console.debug)),De(this,"i",this.logMethod(Fe.INFO)),De(this,"w",this.logMethod(Fe.WARNING,console.warn)),De(this,"e",this.logMethod(Fe.ERROR,(...k)=>{const[P,...N]=k;console.error(P,"<error>",N)})),De(this,"ev",this.logMethod(Fe.API)),De(this,"a",this.logMethod(Fe.API,(...k)=>{const[P,...N]=k;if(N.length>2){const J=`${N[1]}`;J.startsWith("__g__")&&console.group(`${J.substring(5)}_${N[2]}`)}console.log(P,...N)})),De(this,"ar",this.logMethod(Fe.API,(...k)=>{const[P,...N]=k;console.log(P,...N),N.length>2&&`${N[1]}`.startsWith("__g__")&&console.groupEnd()})),De(this,"ae",this.logMethod(Fe.API,(...k)=>{const[P,...N]=k;console.error(P,"<error>",...N),N.length>2&&`${N[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=nt(),this.endReported=!0,this.logSequence=0,this.appId="",this.sessionId=""}async startSTSUpdateTask(){this.updateTaskTimer&&clearTimeout(this.updateTaskTimer);try{const k=await this.refreshSTSToken();this.createTracker(k)}catch{}this.updateTaskTimer=setTimeout(()=>{this.startSTSUpdateTask()},it)}async refreshSTSToken(){if(!this.stsData||this.stsExpiration<=Date.now()-it){const k=await this.requestSTSToken(),P=new Date(k?.Expiration).getTime()||0,N=Date.now()+it;this.stsExpiration=Math.max(P,N),this.stsData=k}return this.stsData}requestSTSToken(){const k=Date.now(),P=`${this.clientId}|${oi}|${k}`,N={Action:"AssumeSlsRoleV2",AuthInfo:$e.MD5(P).toString($e.enc.Hex),ClientId:this.clientId,BusinessType:"logger",AppVersion:"1.0",Version:"2017-03-14",AuthTimestamp:`${k}`,TerminalType:"web",DeviceModel:"",Format:"JSON",SignatureMethod:"HMAC-SHA1",SignatureVersion:"1.0",Timestamp:zt(k,"isoUtcDateTime")},J=`https://slsrole.alicdn.com/?${new URLSearchParams(N).toString()}`;return fetch(J).then(L=>L.json()).then(L=>JSON.parse(window.atob(L.SlsAuthResult)))}createTracker(k){if(!this.tracker){const P={accessKeyId:k.AccessKeyId,accessKeySecret:k.AccessKeySecret,securityToken:k.SecurityToken,refreshSTSTokenInterval:it,stsTokenFreshTime:void 0,refreshSTSToken:()=>{this.refreshSTSToken().then(L=>{P.accessKeyId=L.AccessKeyId,P.accessKeySecret=L.AccessKeySecret,P.securityToken=L.SecurityToken}).catch(()=>{})}},N=new er(ot),J=Fr(P);N.useStsPlugin(J),this.slsPlugin=J,this.tracker=N,this.reportStartAndCache()}}changeConfig(k){k.logLevel!==void 0&&k.logLevel>=Fe.DEBUG&&k.logLevel<=Fe.NONE&&(this.logLevel=k.logLevel)}setSessionID(k,P){!k||!P||(this.appId=k,this.sessionId=P,this.reportStartAndCache())}reportStartAndCache(){if(!this.tracker||!this.sessionId)return;this.endReported=!1;const k={task_btm_sec:0,task_duration:0,task_etm_sec:0,task_type:"session"},P=[this.getLogParams(Ke.TASK_UPLOAD_BEGIN,k),this.getLogParams(Ke.SESSION_UPLOAD_BEGIN,k)];this.tracker.sendBatchLogsImmediate(P),this.logCache.forEach(N=>{this.sendLog(N)})}reportEnd(k=!1){if(!this.tracker||!this.sessionId||this.endReported){this.reset();return}const P={task_btm_sec:0,task_duration:0,task_etm_sec:0,task_type:"session"},N=[this.getLogParams(Ke.SESSION_UPLOAD_END,P),this.getLogParams(Ke.TASK_UPLOAD_END,P)];k?this.sendLogBeforeUnload(N):(this.tracker.sendBatchLogsImmediate(N),this.endReported=!0),this.reset()}getLogParams(k,P){return{appid:`${window.location.host}`,appid_list:this.appId,appver:"",b_sesid:this.bSesid,biz_type:"rtc",cpu_info:ii,db:qr.browserName,dm:qr.browserVersion,install_uuid:this.clientId,logger_v:"0.0.1",os:Yr.systemName,osv:Yr.systemVersion,p_sesid:this.bSesid,sdk_version:zr,sdkname:"AliRTCSdk",stm:Date.now(),tar_pf:"web",traceid:this.sessionId,event_id:k,...P||{}}}sendLog(k){if(!this.tracker||!this.sessionId)return;this.logSequence+=1;const P=this.getLogParams(Ke.SESSION_UPLOAD_ING,{log:k,stat_log_seq:this.logSequence});this.tracker.send(P)}addLog(k){const P=Yt(),N=`[${Kr()} ${P}] ${k}`;!this.sessionId||!this.tracker?(this.logCache.push(N),this.logCache.length>=ai&&this.logCache.shift()):this.sendLog(N)}}var ci=Object.defineProperty,ui=(W,k,P)=>k in W?ci(W,k,{enumerable:!0,configurable:!0,writable:!0,value:P}):W[k]=P,di=(W,k,P)=>ui(W,k+"",P);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(k){this.getLogger().changeConfig({logLevel:k})}static setSessionID(k,P){this.getLogger().setSessionID(k,P)}static reportEnd(){this.getLogger().reportEnd()}static interface(...k){this.getLogger().a("[API]",...k)}static interfaceResult(k,P,N,...J){N?this.getLogger().ar("[ARE]",k,P,...J):this.getLogger().ae("[ARE]",k,P,...J)}static event(...k){this.getLogger().ev("[EVT]",...k)}static debug(...k){this.getLogger().d("[DBG]",...k)}static info(...k){this.getLogger().i("[INF]",...k)}static warn(...k){this.getLogger().w("[WARN]",...k)}static error(...k){this.getLogger().e("[ERR]",...k)}}di(Ze,"logger");var li=Object.defineProperty,pi=(W,k,P)=>k in W?li(W,k,{enumerable:!0,configurable:!0,writable:!0,value:P}):W[k]=P,et=(W,k,P)=>pi(W,typeof k!="symbol"?k+"":k,P);const Xr=48e3,at="[AliyunAudio3A] ";class fi extends Qr{constructor(k){super("AliRtcAudioProcessPlugin",$r.AliRtcSdkStreamTypeCapture,Zr.AUDIO),et(this,"audioProcessor"),et(this,"slsReporter"),et(this,"audioContext",new AudioContext({sampleRate:Xr})),et(this,"farNode"),et(this,"createNode",P=>this.audioContext.createMediaStreamSource(new MediaStream([P]))),this.options=k,this.slsReporter=k?.slsReporter,this.zIndex=7,document.addEventListener("click",this.activeAudioContext)}activeAudioContext(){this.audioContext.resume(),document.removeEventListener("click",this.activeAudioContext)}audioUpdated(k){return this.lastInputAudioTrack?.id!==k.currentAudioTrack?.id}videoUpdated(k){return console.log("videoUpdated",k),!1}setOptions(k){this.farNode||!k.farMediaStream||(this.farNode=this.audioContext.createMediaStreamSource(k.farMediaStream),this.audioProcessor&&this.audioProcessor?.addFarNode(this.farNode),this.options={...this.options,...k})}isSupported(){return Qt.isSupported()}shouldUpdate(k){return!!(k.originAudioTrack&&!this.audioProcessor||!k.originAudioTrack&&this.audioProcessor)}async process(k){if(!k.currentAudioTrack){k.updateAudioTrack(),this.clear(k);return}if(!this.audioProcessor){Ze.info(at,"create audio processor this.options:",this.options),this.audioProcessor=new Qt({aecOn:!0,ansOn:!0,agcOn:!0,dumpOn:this.options?.dumpAudioData||!1,aiaecOn:this.options.aiaecOn||!1,wasmCdnPath:this.options.wasmCdnPath||"https://g.alicdn.com/code/npm/@ali/aliyun-audio-3a/0.0.5/"});const P=this.createNode(k.currentAudioTrack);await this.audioProcessor.createProcessor(this.audioContext,P,1,Xr,this.farNode),this.audioProcessor.on("dumpdata",(N,J)=>{let L=3e3;J.includes("far")?L=5e3:J.includes("output")?L=1e4:J.includes("meta")&&(L=8e3),setTimeout(()=>{const R=URL.createObjectURL(N),x=document.createElement("a");x.href=R,x.download=J,document.body.appendChild(x),x.click(),document.body.removeChild(x)},L)}),this.audioProcessor.on("loadsuccess",()=>{Ze.info(at,"loadsuccess"),this.options.dumpAudioData&&this.audioProcessor?.startDump()}),this.audioProcessor.on("loaderror",N=>{Ze.info(at,"loaderror:",N?.message)}),this.audioProcessor.on("outputlog",N=>{Ze.info(at,"outputlog:",N)}),this.audioProcessor.on("statdata",N=>{N&&this.slsReporter?.reportPublishAudio3A("","","",N||"")}),k.updateAudioTrack(this.audioProcessor.targetMediaTrack)}}clear(k){this.options.dumpAudioData&&this.audioProcessor?.stopDump(),super.clear(k),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};
|
|
160
|
+
`+n),console.error("Failed log data:",e))}}class p extends f{constructor(r){super(Object.assign({},r,{installUnloadHook:n=>{window.addEventListener("beforeunload",()=>{n()})},sendPayload:(n,s)=>{d(n,s)}}))}}c=window,u="SLS_Tracker",S=p,v(c,u,S)},4198:L=>{L.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"}]}')}},N={};function J(L){var R=N[L];if(R!==void 0)return R.exports;var x=N[L]={exports:{}};return P[L].call(x.exports,x,x.exports,J),x.exports}return J.n=L=>{var R=L&&L.__esModule?()=>L.default:()=>L;return J.d(R,{a:R}),R},J.d=(L,R)=>{for(var x in R)J.o(R,x)&&!J.o(L,x)&&Object.defineProperty(L,x,{enumerable:!0,get:R[x]})},J.o=(L,R)=>Object.prototype.hasOwnProperty.call(L,R),J.r=L=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(L,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(L,"__esModule",{value:!0})},J(8156)})())})(Hr);for(var jn=Hr.exports,Be=[],Gt=0;Gt<256;++Gt)Be.push((Gt+256).toString(16).slice(1));function Wn(W,k=0){return(Be[W[k+0]]+Be[W[k+1]]+Be[W[k+2]]+Be[W[k+3]]+"-"+Be[W[k+4]]+Be[W[k+5]]+"-"+Be[W[k+6]]+Be[W[k+7]]+"-"+Be[W[k+8]]+Be[W[k+9]]+"-"+Be[W[k+10]]+Be[W[k+11]]+Be[W[k+12]]+Be[W[k+13]]+Be[W[k+14]]+Be[W[k+15]]).toLowerCase()}var rt,Gn=new Uint8Array(16);function zn(){if(!rt&&(rt=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!rt))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return rt(Gn)}var qn=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Vr={randomUUID:qn};function nt(W,k,P){if(Vr.randomUUID&&!k&&!W)return Vr.randomUUID();W=W||{};var N=W.random||(W.rng||zn)();return N[6]=N[6]&15|64,N[8]=N[8]&63|128,Wn(N)}var Yn=/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(W,k,P,N){if(arguments.length===1&&typeof W=="string"&&!/\d/.test(W)&&(k=W,W=void 0),W=W||W===0?W:new Date,W instanceof Date||(W=new Date(W)),isNaN(W))throw TypeError("Invalid date");k=String(jr[k]||k||jr.default);var J=k.slice(0,4);(J==="UTC:"||J==="GMT:")&&(k=k.slice(4),P=!0,J==="GMT:"&&(N=!0));var L=function(){return P?"getUTC":"get"},R=function(){return W[L()+"Date"]()},x=function(){return W[L()+"Day"]()},v=function(){return W[L()+"Month"]()},c=function(){return W[L()+"FullYear"]()},u=function(){return W[L()+"Hours"]()},S=function(){return W[L()+"Minutes"]()},f=function(){return W[L()+"Seconds"]()},a=function(){return W[L()+"Milliseconds"]()},d=function(){return P?0:W.getTimezoneOffset()},p=function(){return Jn(W)},e=function(){return Qn(W)},r={d:function(){return R()},dd:function(){return Ve(R())},ddd:function(){return Ue.dayNames[x()]},DDD:function(){return Wr({y:c(),m:v(),d:R(),_:L(),dayName:Ue.dayNames[x()],short:!0})},dddd:function(){return Ue.dayNames[x()+7]},DDDD:function(){return Wr({y:c(),m:v(),d:R(),_:L(),dayName:Ue.dayNames[x()+7]})},m:function(){return v()+1},mm:function(){return Ve(v()+1)},mmm:function(){return Ue.monthNames[v()]},mmmm:function(){return Ue.monthNames[v()+12]},yy:function(){return String(c()).slice(2)},yyyy:function(){return Ve(c(),4)},h:function(){return u()%12||12},hh:function(){return Ve(u()%12||12)},H:function(){return u()},HH:function(){return Ve(u())},M:function(){return S()},MM:function(){return Ve(S())},s:function(){return f()},ss:function(){return Ve(f())},l:function(){return Ve(a(),3)},L:function(){return Ve(Math.floor(a()/10))},t:function(){return u()<12?Ue.timeNames[0]:Ue.timeNames[1]},tt:function(){return u()<12?Ue.timeNames[2]:Ue.timeNames[3]},T:function(){return u()<12?Ue.timeNames[4]:Ue.timeNames[5]},TT:function(){return u()<12?Ue.timeNames[6]:Ue.timeNames[7]},Z:function(){return N?"GMT":P?"UTC":$n(W)},o:function(){return(d()>0?"-":"+")+Ve(Math.floor(Math.abs(d())/60)*100+Math.abs(d())%60,4)},p:function(){return(d()>0?"-":"+")+Ve(Math.floor(Math.abs(d())/60),2)+":"+Ve(Math.floor(Math.abs(d())%60),2)},S:function(){return["th","st","nd","rd"][R()%10>3?0:(R()%100-R()%10!=10)*R()%10]},W:function(){return p()},WW:function(){return Ve(p())},N:function(){return e()}};return k.replace(Yn,function(n){return n in r?r[n]():n.slice(1,n.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"},Ue={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"]},Ve=function(k){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;return String(k).padStart(P,"0")},Wr=function(k){var P=k.y,N=k.m,J=k.d,L=k._,R=k.dayName,x=k.short,v=x===void 0?!1:x,c=new Date,u=new Date;u.setDate(u[L+"Date"]()-1);var S=new Date;S.setDate(S[L+"Date"]()+1);var f=function(){return c[L+"Date"]()},a=function(){return c[L+"Month"]()},d=function(){return c[L+"FullYear"]()},p=function(){return u[L+"Date"]()},e=function(){return u[L+"Month"]()},r=function(){return u[L+"FullYear"]()},n=function(){return S[L+"Date"]()},s=function(){return S[L+"Month"]()},t=function(){return S[L+"FullYear"]()};return d()===P&&a()===N&&f()===J?v?"Tdy":"Today":r()===P&&e()===N&&p()===J?v?"Ysd":"Yesterday":t()===P&&s()===N&&n()===J?v?"Tmw":"Tomorrow":R},Jn=function(k){var P=new Date(k.getFullYear(),k.getMonth(),k.getDate());P.setDate(P.getDate()-(P.getDay()+6)%7+3);var N=new Date(P.getFullYear(),0,4);N.setDate(N.getDate()-(N.getDay()+6)%7+3);var J=P.getTimezoneOffset()-N.getTimezoneOffset();P.setHours(P.getHours()-J);var L=(P-N)/(864e5*7);return 1+Math.floor(L)},Qn=function(k){var P=k.getDay();return P===0&&(P=7),P},$n=function(k){return(String(k).match(Kn)||[""]).pop().replace(Xn,"").replace(/GMT\+0000/g,"UTC")},qt;(function(W){W.prod="rs.rtn.aliyuncs.com",W.pre="prs.rtn.aliyuncs.com"})(qt||(qt={}));var Gr;(function(W){W[W.ByClient=0]="ByClient",W[W.KickOut=1]="KickOut",W[W.ChannelClosed=2]="ChannelClosed",W[W.Restore=3]="Restore",W[W.Expired=4]="Expired",W[W.Reconnect=5]="Reconnect",W[W.ReconnectExhausted=6]="ReconnectExhausted"})(Gr||(Gr={}));const zr="7.1.1-beta.2";class Kt{static getVersionNumber(){let k=zr.split("."),P="";return k.forEach(N=>{N.length===1?P+="0"+N:P+=N}),parseInt(P)}static queryingParam(k){let P=[];if(k)for(let N in k)P.push(N+"="+k[N]);return P.join("&")}static getQueryParams(k){const P=window.location.search.substring(1).split("&");for(let N=0;N<P.length;N++){const J=P[N].split("=");if(decodeURIComponent(J[0])===k)return decodeURIComponent(J[1])}}static createCallid(k=""){const P=nt();return k&&P&&P.length>k.length?`${k}${P.substring(k.length)}`:P}static checkSubOptionsValid(k){if(k){const{audio:P,video:N,screen:J}=k;if(P===!1&&N===!1&&J===!1)return!1}return!0}static async isNetworkAvailable(){const k=qt.prod,{onLine:P}=navigator;if(!P)return!1;try{return await fetch(`https://${k}/roomserver/v1/ws/version`),!0}catch{return!1}}static toString(k){let P;if(k instanceof Error)P=k.message;else if(typeof k=="string")P=k;else try{P=JSON.stringify(k)}catch{P="undefined"}return P}static paramArrayToString(k){let P="";for(let N=0;N<k.length;N++){P!==""&&(P+=" ");let J=Kt.toString(k[N]);P+=J}return P}}const Zn=(W,k)=>W.find(P=>{if(typeof P.test=="function")return P.test(k);if(Array.isArray(P.test))return P.test.some(N=>typeof N=="string"?k.indexOf(N)>-1:N instanceof RegExp?N.test(k):!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 W="unknown";try{const k=navigator.userAgent||"",P=Zn(ei,k);if(!P)return W;W=P.describe(k)}catch{}return W};var ri=Object.defineProperty,ni=(W,k,P)=>k in W?ri(W,k,{enumerable:!0,configurable:!0,writable:!0,value:P}):W[k]=P,De=(W,k,P)=>ni(W,typeof k!="symbol"?k+"":k,P);const{BrowserUtil:qr,SystenUtil:Yr}=jn.AliRTS,ii=ti(),oi="woMMssV6jmyol9fr",ai=200,it=10*60*1e3,ot={host:"cn-hangzhou.log.aliyuncs.com",project:"alivc-aio",logstore:"logger",time:10,count:10};function Yt(){return zt(new Date,"HH:MM:ss.l")}function Kr(){return zt(new Date,"isoDate")}var Fe;(function(W){W[W.DEBUG=0]="DEBUG",W[W.INFO=1]="INFO",W[W.API=2]="API",W[W.WARNING=3]="WARNING",W[W.ERROR=4]="ERROR",W[W.NONE=5]="NONE"})(Fe||(Fe={}));var Ke;(function(W){W[W.TASK_UPLOAD_BEGIN=710201]="TASK_UPLOAD_BEGIN",W[W.SESSION_UPLOAD_BEGIN=710202]="SESSION_UPLOAD_BEGIN",W[W.SESSION_UPLOAD_ING=710203]="SESSION_UPLOAD_ING",W[W.SESSION_UPLOAD_END=710204]="SESSION_UPLOAD_END",W[W.TASK_UPLOAD_END=710205]="TASK_UPLOAD_END"})(Ke||(Ke={}));class si{constructor(){De(this,"tracker"),De(this,"slsPlugin"),De(this,"stsData"),De(this,"stsExpiration",Date.now()),De(this,"clientId",nt()),De(this,"bSesid",nt()),De(this,"logLevel",Fe.WARNING),De(this,"appId",""),De(this,"sessionId",""),De(this,"logCache",[]),De(this,"updateTaskTimer"),De(this,"endReported",!0),De(this,"logSequence",0),De(this,"sendLogBeforeUnload",async k=>{if(!this.slsPlugin)return;this.logSequence+=1,k.unshift(this.getLogParams(Ke.SESSION_UPLOAD_ING,{log:`[${Kr()} ${Yt()}] [INF] beforeunload`,stat_log_seq:this.logSequence}));const P=`https://${ot.project}.${ot.host}/logstores/${ot.logstore}`,N={__logs__:k.map(R=>this.slsPlugin.transString(R))},{data:J,header:L}=await this.slsPlugin.process(P,JSON.stringify(N));fetch(P,{keepalive:!0,method:"POST",headers:L,body:J})}),De(this,"logMethod",(k,P=console.log)=>(...N)=>{let J=Yt();this.logLevel<=k&&P(J,...N);let L=Kt.paramArrayToString(N);k>Fe.DEBUG&&this.addLog(L)}),De(this,"d",this.logMethod(Fe.DEBUG,console.debug)),De(this,"i",this.logMethod(Fe.INFO)),De(this,"w",this.logMethod(Fe.WARNING,console.warn)),De(this,"e",this.logMethod(Fe.ERROR,(...k)=>{const[P,...N]=k;console.error(P,"<error>",N)})),De(this,"ev",this.logMethod(Fe.API)),De(this,"a",this.logMethod(Fe.API,(...k)=>{const[P,...N]=k;if(N.length>2){const J=`${N[1]}`;J.startsWith("__g__")&&console.group(`${J.substring(5)}_${N[2]}`)}console.log(P,...N)})),De(this,"ar",this.logMethod(Fe.API,(...k)=>{const[P,...N]=k;console.log(P,...N),N.length>2&&`${N[1]}`.startsWith("__g__")&&console.groupEnd()})),De(this,"ae",this.logMethod(Fe.API,(...k)=>{const[P,...N]=k;console.error(P,"<error>",...N),N.length>2&&`${N[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=nt(),this.endReported=!0,this.logSequence=0,this.appId="",this.sessionId=""}async startSTSUpdateTask(){this.updateTaskTimer&&clearTimeout(this.updateTaskTimer);try{const k=await this.refreshSTSToken();this.createTracker(k)}catch{}this.updateTaskTimer=setTimeout(()=>{this.startSTSUpdateTask()},it)}async refreshSTSToken(){if(!this.stsData||this.stsExpiration<=Date.now()-it){const k=await this.requestSTSToken(),P=new Date(k?.Expiration).getTime()||0,N=Date.now()+it;this.stsExpiration=Math.max(P,N),this.stsData=k}return this.stsData}requestSTSToken(){const k=Date.now(),P=`${this.clientId}|${oi}|${k}`,N={Action:"AssumeSlsRoleV2",AuthInfo:$e.MD5(P).toString($e.enc.Hex),ClientId:this.clientId,BusinessType:"logger",AppVersion:"1.0",Version:"2017-03-14",AuthTimestamp:`${k}`,TerminalType:"web",DeviceModel:"",Format:"JSON",SignatureMethod:"HMAC-SHA1",SignatureVersion:"1.0",Timestamp:zt(k,"isoUtcDateTime")},J=`https://slsrole.alicdn.com/?${new URLSearchParams(N).toString()}`;return fetch(J).then(L=>L.json()).then(L=>JSON.parse(window.atob(L.SlsAuthResult)))}createTracker(k){if(!this.tracker){const P={accessKeyId:k.AccessKeyId,accessKeySecret:k.AccessKeySecret,securityToken:k.SecurityToken,refreshSTSTokenInterval:it,stsTokenFreshTime:void 0,refreshSTSToken:()=>{this.refreshSTSToken().then(L=>{P.accessKeyId=L.AccessKeyId,P.accessKeySecret=L.AccessKeySecret,P.securityToken=L.SecurityToken}).catch(()=>{})}},N=new er(ot),J=Fr(P);N.useStsPlugin(J),this.slsPlugin=J,this.tracker=N,this.reportStartAndCache()}}changeConfig(k){k.logLevel!==void 0&&k.logLevel>=Fe.DEBUG&&k.logLevel<=Fe.NONE&&(this.logLevel=k.logLevel)}setSessionID(k,P){!k||!P||(this.appId=k,this.sessionId=P,this.reportStartAndCache())}reportStartAndCache(){if(!this.tracker||!this.sessionId)return;this.endReported=!1;const k={task_btm_sec:0,task_duration:0,task_etm_sec:0,task_type:"session"},P=[this.getLogParams(Ke.TASK_UPLOAD_BEGIN,k),this.getLogParams(Ke.SESSION_UPLOAD_BEGIN,k)];this.tracker.sendBatchLogsImmediate(P),this.logCache.forEach(N=>{this.sendLog(N)})}reportEnd(k=!1){if(!this.tracker||!this.sessionId||this.endReported){this.reset();return}const P={task_btm_sec:0,task_duration:0,task_etm_sec:0,task_type:"session"},N=[this.getLogParams(Ke.SESSION_UPLOAD_END,P),this.getLogParams(Ke.TASK_UPLOAD_END,P)];k?this.sendLogBeforeUnload(N):(this.tracker.sendBatchLogsImmediate(N),this.endReported=!0),this.reset()}getLogParams(k,P){return{appid:`${window.location.host}`,appid_list:this.appId,appver:"",b_sesid:this.bSesid,biz_type:"rtc",cpu_info:ii,db:qr.browserName,dm:qr.browserVersion,install_uuid:this.clientId,logger_v:"0.0.1",os:Yr.systemName,osv:Yr.systemVersion,p_sesid:this.bSesid,sdk_version:zr,sdkname:"AliRTCSdk",stm:Date.now(),tar_pf:"web",traceid:this.sessionId,event_id:k,...P||{}}}sendLog(k){if(!this.tracker||!this.sessionId)return;this.logSequence+=1;const P=this.getLogParams(Ke.SESSION_UPLOAD_ING,{log:k,stat_log_seq:this.logSequence});this.tracker.send(P)}addLog(k){const P=Yt(),N=`[${Kr()} ${P}] ${k}`;!this.sessionId||!this.tracker?(this.logCache.push(N),this.logCache.length>=ai&&this.logCache.shift()):this.sendLog(N)}}var ci=Object.defineProperty,ui=(W,k,P)=>k in W?ci(W,k,{enumerable:!0,configurable:!0,writable:!0,value:P}):W[k]=P,di=(W,k,P)=>ui(W,k+"",P);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(k){this.getLogger().changeConfig({logLevel:k})}static setSessionID(k,P){this.getLogger().setSessionID(k,P)}static reportEnd(){this.getLogger().reportEnd()}static interface(...k){this.getLogger().a("[API]",...k)}static interfaceResult(k,P,N,...J){N?this.getLogger().ar("[ARE]",k,P,...J):this.getLogger().ae("[ARE]",k,P,...J)}static event(...k){this.getLogger().ev("[EVT]",...k)}static debug(...k){this.getLogger().d("[DBG]",...k)}static info(...k){this.getLogger().i("[INF]",...k)}static warn(...k){this.getLogger().w("[WARN]",...k)}static error(...k){this.getLogger().e("[ERR]",...k)}}di(Ze,"logger");var li=Object.defineProperty,pi=(W,k,P)=>k in W?li(W,k,{enumerable:!0,configurable:!0,writable:!0,value:P}):W[k]=P,et=(W,k,P)=>pi(W,typeof k!="symbol"?k+"":k,P);const Xr=48e3,at="[AliyunAudio3A] ";class fi extends Qr{constructor(k){super("AliRtcAudioProcessPlugin",$r.AliRtcSdkStreamTypeCapture,Zr.AUDIO),et(this,"audioProcessor"),et(this,"slsReporter"),et(this,"audioContext",new AudioContext({sampleRate:Xr})),et(this,"farNode"),et(this,"createNode",P=>this.audioContext.createMediaStreamSource(new MediaStream([P]))),this.options=k,this.slsReporter=k?.slsReporter,this.zIndex=7,document.addEventListener("click",this.activeAudioContext)}activeAudioContext(){this.audioContext.resume(),document.removeEventListener("click",this.activeAudioContext)}audioUpdated(k){return this.lastInputAudioTrack?.id!==k.currentAudioTrack?.id}videoUpdated(k){return console.log("videoUpdated",k),!1}setOptions(k){this.farNode||!k.farMediaStream||(this.farNode=this.audioContext.createMediaStreamSource(k.farMediaStream),this.audioProcessor&&this.audioProcessor?.addFarNode(this.farNode),this.options={...this.options,...k})}isSupported(){return Qt.isSupported()}shouldUpdate(k){return!!(k.originAudioTrack&&!this.audioProcessor||!k.originAudioTrack&&this.audioProcessor)}async process(k){if(!k.currentAudioTrack){k.updateAudioTrack(),this.clear(k);return}if(!this.audioProcessor){Ze.info(at,"create audio processor this.options:",this.options),this.audioProcessor=new Qt({aecOn:!0,ansOn:!0,agcOn:!0,dumpOn:this.options?.dumpAudioData||!1,aiaecOn:this.options.aiaecOn||!1,wasmCdnPath:this.options.wasmCdnPath||"https://g.alicdn.com/code/npm/@ali/aliyun-audio-3a/0.0.5/"});const P=this.createNode(k.currentAudioTrack);await this.audioProcessor.createProcessor(this.audioContext,P,1,Xr,this.farNode),this.audioProcessor.on("dumpdata",(N,J)=>{let L=3e3;J.includes("far")?L=5e3:J.includes("output")?L=1e4:J.includes("meta")&&(L=8e3),setTimeout(()=>{const R=URL.createObjectURL(N),x=document.createElement("a");x.href=R,x.download=J,document.body.appendChild(x),x.click(),document.body.removeChild(x)},L)}),this.audioProcessor.on("loadsuccess",()=>{Ze.info(at,"loadsuccess"),this.options.dumpAudioData&&this.audioProcessor?.startDump()}),this.audioProcessor.on("loaderror",N=>{Ze.info(at,"loaderror:",N?.message)}),this.audioProcessor.on("outputlog",N=>{Ze.info(at,"outputlog:",N)}),this.audioProcessor.on("statdata",N=>{N&&this.slsReporter?.reportPublishAudio3A("","","",N||"")}),k.updateAudioTrack(this.audioProcessor.targetMediaTrack)}}clear(k){this.options.dumpAudioData&&this.audioProcessor?.stopDump(),super.clear(k),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};
|