trtc-sdk-v5
Version:
Tencent Cloud RTC SDK for Web
5 lines • 900 kB
JavaScript
var tT=Object.create;var dn=Object.defineProperty,iT=Object.defineProperties,np=Object.getOwnPropertyDescriptor,rT=Object.getOwnPropertyDescriptors,sT=Object.getOwnPropertyNames,ja=Object.getOwnPropertySymbols,ap=Object.getPrototypeOf,xl=Object.prototype.hasOwnProperty,cp=Object.prototype.propertyIsEnumerable,oT=Reflect.get;var Pr=Math.pow,Ll=(s,i,e)=>i in s?dn(s,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[i]=e,N=(s,i)=>{for(var e in i||(i={}))xl.call(i,e)&&Ll(s,e,i[e]);if(ja)for(var e of ja(i))cp.call(i,e)&&Ll(s,e,i[e]);return s},L=(s,i)=>iT(s,rT(i));var Ja=(s,i)=>{var e={};for(var t in s)xl.call(s,t)&&i.indexOf(t)<0&&(e[t]=s[t]);if(s!=null&&ja)for(var t of ja(s))i.indexOf(t)<0&&cp.call(s,t)&&(e[t]=s[t]);return e};var Yi=(s,i)=>()=>(i||s((i={exports:{}}).exports,i),i.exports),Zi=(s,i)=>{for(var e in i)dn(s,e,{get:i[e],enumerable:!0})},nT=(s,i,e,t)=>{if(i&&typeof i=="object"||typeof i=="function")for(let r of sT(i))!xl.call(s,r)&&r!==e&&dn(s,r,{get:()=>i[r],enumerable:!(t=np(i,r))||t.enumerable});return s};var Ye=(s,i,e)=>(e=s!=null?tT(ap(s)):{},nT(i||!s||!s.__esModule?dn(e,"default",{value:s,enumerable:!0}):e,s));var P=(s,i,e,t)=>{for(var r=t>1?void 0:t?np(i,e):i,o=s.length-1,n;o>=0;o--)(n=s[o])&&(r=(t?n(i,e,r):n(r))||r);return t&&r&&dn(i,e,r),r};var d=(s,i,e)=>Ll(s,typeof i!="symbol"?i+"":i,e);var $e=(s,i,e)=>oT(ap(s),e,i);var f=(s,i,e)=>new Promise((t,r)=>{var o=c=>{try{a(e.next(c))}catch(l){r(l)}},n=c=>{try{a(e.throw(c))}catch(l){r(l)}},a=c=>c.done?t(c.value):Promise.resolve(c.value).then(o,n);a((e=e.apply(s,i)).next())});var ct=Yi((cA,Ul)=>{"use strict";var aT=Object.prototype.hasOwnProperty,Et="~";function ln(){}Object.create&&(ln.prototype=Object.create(null),new ln().__proto__||(Et=!1));function cT(s,i,e){this.fn=s,this.context=i,this.once=e||!1}function dp(s,i,e,t,r){if(typeof e!="function")throw new TypeError("The listener must be a function");var o=new cT(e,t||s,r),n=Et?Et+i:i;return s._events[n]?s._events[n].fn?s._events[n]=[s._events[n],o]:s._events[n].push(o):(s._events[n]=o,s._eventsCount++),s}function za(s,i){--s._eventsCount===0?s._events=new ln:delete s._events[i]}function pt(){this._events=new ln,this._eventsCount=0}pt.prototype.eventNames=function(){var i=[],e,t;if(this._eventsCount===0)return i;for(t in e=this._events)aT.call(e,t)&&i.push(Et?t.slice(1):t);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i};pt.prototype.listeners=function(i){var e=Et?Et+i:i,t=this._events[e];if(!t)return[];if(t.fn)return[t.fn];for(var r=0,o=t.length,n=new Array(o);r<o;r++)n[r]=t[r].fn;return n};pt.prototype.listenerCount=function(i){var e=Et?Et+i:i,t=this._events[e];return t?t.fn?1:t.length:0};pt.prototype.emit=function(i,e,t,r,o,n){var a=Et?Et+i:i;if(!this._events[a])return!1;var c=this._events[a],l=arguments.length,u,h;if(c.fn){switch(c.once&&this.removeListener(i,c.fn,void 0,!0),l){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,e),!0;case 3:return c.fn.call(c.context,e,t),!0;case 4:return c.fn.call(c.context,e,t,r),!0;case 5:return c.fn.call(c.context,e,t,r,o),!0;case 6:return c.fn.call(c.context,e,t,r,o,n),!0}for(h=1,u=new Array(l-1);h<l;h++)u[h-1]=arguments[h];c.fn.apply(c.context,u)}else{var m=c.length,p;for(h=0;h<m;h++)switch(c[h].once&&this.removeListener(i,c[h].fn,void 0,!0),l){case 1:c[h].fn.call(c[h].context);break;case 2:c[h].fn.call(c[h].context,e);break;case 3:c[h].fn.call(c[h].context,e,t);break;case 4:c[h].fn.call(c[h].context,e,t,r);break;default:if(!u)for(p=1,u=new Array(l-1);p<l;p++)u[p-1]=arguments[p];c[h].fn.apply(c[h].context,u)}}return!0};pt.prototype.on=function(i,e,t){return dp(this,i,e,t,!1)};pt.prototype.once=function(i,e,t){return dp(this,i,e,t,!0)};pt.prototype.removeListener=function(i,e,t,r){var o=Et?Et+i:i;if(!this._events[o])return this;if(!e)return za(this,o),this;var n=this._events[o];if(n.fn)n.fn===e&&(!r||n.once)&&(!t||n.context===t)&&za(this,o);else{for(var a=0,c=[],l=n.length;a<l;a++)(n[a].fn!==e||r&&!n[a].once||t&&n[a].context!==t)&&c.push(n[a]);c.length?this._events[o]=c.length===1?c[0]:c:za(this,o)}return this};pt.prototype.removeAllListeners=function(i){var e;return i?(e=Et?Et+i:i,this._events[e]&&za(this,e)):(this._events=new ln,this._eventsCount=0),this};pt.prototype.off=pt.prototype.removeListener;pt.prototype.addListener=pt.prototype.on;pt.prefixed=Et;pt.EventEmitter=pt;typeof Ul!="undefined"&&(Ul.exports=pt)});var Kc=Yi((OC,cf)=>{"use strict";var af=cf.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(s){return s.encoding?"rtpmap:%d %s/%s/%s":s.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(s){return s.address!=null?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(s){return s.subtype!=null?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(s){return"extmap:%d"+(s.direction?"/%s":"%v")+(s["encrypt-uri"]?" %s":"%v")+" %s"+(s.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(s){return s.sessionConfig!=null?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(s){var i="candidate:%s %d %s %d %s %d typ %s";return i+=s.raddr!=null?" raddr %s rport %d":"%v%v",i+=s.tcptype!=null?" tcptype %s":"%v",s.generation!=null&&(i+=" generation %d"),i+=s["network-id"]!=null?" network-id %d":"%v",i+=s["network-cost"]!=null?" network-cost %d":"%v",i}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(s){var i="ssrc:%d";return s.attribute!=null&&(i+=" %s",s.value!=null&&(i+=":%s")),i}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(s){return s.maxMessageSize!=null?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(s){return s.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(s){return"imageattr:%s %s %s"+(s.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(s){return"simulcast:%s %s"+(s.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(s){return"ts-refclk:%s"+(s.clksrcExt!=null?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(s){var i="mediaclk:";return i+=s.id!=null?"id=%s %s":"%v%s",i+=s.mediaClockValue!=null?"=%s":"",i+=s.rateNumerator!=null?" rate=%s":"",i+=s.rateDenominator!=null?"/%s":"",i}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]};Object.keys(af).forEach(function(s){var i=af[s];i.forEach(function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")})})});var uf=Yi(pr=>{"use strict";var Do=function(s){return String(Number(s))===s?Number(s):s},gS=function(s,i,e,t){if(t&&!e)i[t]=Do(s[1]);else for(var r=0;r<e.length;r+=1)s[r+1]!=null&&(i[e[r]]=Do(s[r+1]))},TS=function(s,i,e){var t=s.name&&s.names;s.push&&!i[s.push]?i[s.push]=[]:t&&!i[s.name]&&(i[s.name]={});var r=s.push?{}:t?i[s.name]:i;gS(e.match(s.reg),r,s.names,s.name),s.push&&i[s.push].push(r)},df=Kc(),SS=RegExp.prototype.test.bind(/^([a-z])=(.*)/);pr.parse=function(s){var i={},e=[],t=i;return s.split(/(\r\n|\r|\n)/).filter(SS).forEach(function(r){var o=r[0],n=r.slice(2);o==="m"&&(e.push({rtp:[],fmtp:[]}),t=e[e.length-1]);for(var a=0;a<(df[o]||[]).length;a+=1){var c=df[o][a];if(c.reg.test(n))return TS(c,t,n)}}),i.media=e,i};var lf=function(s,i){var e=i.split(/=(.+)/,2);return e.length===2?s[e[0]]=Do(e[1]):e.length===1&&i.length>1&&(s[e[0]]=void 0),s};pr.parseParams=function(s){return s.split(/;\s?/).reduce(lf,{})};pr.parseFmtpConfig=pr.parseParams;pr.parsePayloads=function(s){return s.toString().split(" ").map(Number)};pr.parseRemoteCandidates=function(s){for(var i=[],e=s.split(" ").map(Do),t=0;t<e.length;t+=3)i.push({component:e[t],ip:e[t+1],port:e[t+2]});return i};pr.parseImageAttributes=function(s){return s.split(" ").map(function(i){return i.substring(1,i.length-1).split(",").reduce(lf,{})})};pr.parseSimulcastStreamList=function(s){return s.split(";").map(function(i){return i.split(",").map(function(e){var t,r=!1;return e[0]!=="~"?t=Do(e):(t=Do(e.substring(1,e.length)),r=!0),{scid:t,paused:r}})})}});var mf=Yi((xC,hf)=>{"use strict";var Ju=Kc(),ES=/%[sdv%]/g,IS=function(s){var i=1,e=arguments,t=e.length;return s.replace(ES,function(r){if(i>=t)return r;var o=e[i];switch(i+=1,r){case"%%":return"%";case"%s":return String(o);case"%d":return Number(o);case"%v":return""}})},qn=function(s,i,e){var t=i.format instanceof Function?i.format(i.push?e:e[i.name]):i.format,r=[s+"="+t];if(i.names)for(var o=0;o<i.names.length;o+=1){var n=i.names[o];i.name?r.push(e[i.name][n]):r.push(e[i.names[o]])}else r.push(e[i.name]);return IS.apply(null,r)},RS=["v","o","s","i","u","e","p","c","b","t","r","z","a"],AS=["i","c","b","a"];hf.exports=function(s,i){i=i||{},s.version==null&&(s.version=0),s.name==null&&(s.name=" "),s.media.forEach(function(o){o.payloads==null&&(o.payloads="")});var e=i.outerOrder||RS,t=i.innerOrder||AS,r=[];return e.forEach(function(o){Ju[o].forEach(function(n){n.name in s&&s[n.name]!=null?r.push(qn(o,n,s)):n.push in s&&s[n.push]!=null&&s[n.push].forEach(function(a){r.push(qn(o,n,a))})})}),s.media.forEach(function(o){r.push(qn("m",Ju.m[0],o)),t.forEach(function(n){Ju[n].forEach(function(a){a.name in o&&o[a.name]!=null?r.push(qn(n,a,o)):a.push in o&&o[a.push]!=null&&o[a.push].forEach(function(c){r.push(qn(n,a,c))})})})}),r.join(`\r
`)+`\r
`}});var pf=Yi(Bi=>{"use strict";var As=uf(),CS=mf(),yS=Kc();Bi.grammar=yS;Bi.write=CS;Bi.parse=As.parse;Bi.parseParams=As.parseParams;Bi.parseFmtpConfig=As.parseFmtpConfig;Bi.parsePayloads=As.parsePayloads;Bi.parseRemoteCandidates=As.parseRemoteCandidates;Bi.parseImageAttributes=As.parseImageAttributes;Bi.parseSimulcastStreamList=As.parseSimulcastStreamList});var Vm=Yi((q$,fg)=>{"use strict";var pg=fg.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(s){return s.encoding?"rtpmap:%d %s/%s/%s":s.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(s){return s.address!=null?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(s){return s.subtype!=null?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(s){return"extmap:%d"+(s.direction?"/%s":"%v")+(s["encrypt-uri"]?" %s":"%v")+" %s"+(s.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(s){return s.sessionConfig!=null?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(s){var i="candidate:%s %d %s %d %s %d typ %s";return i+=s.raddr!=null?" raddr %s rport %d":"%v%v",i+=s.tcptype!=null?" tcptype %s":"%v",s.generation!=null&&(i+=" generation %d"),i+=s["network-id"]!=null?" network-id %d":"%v",i+=s["network-cost"]!=null?" network-cost %d":"%v",i}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(s){var i="ssrc:%d";return s.attribute!=null&&(i+=" %s",s.value!=null&&(i+=":%s")),i}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(s){return s.maxMessageSize!=null?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(s){return s.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(s){return"imageattr:%s %s %s"+(s.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(s){return"simulcast:%s %s"+(s.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(s){return"ts-refclk:%s"+(s.clksrcExt!=null?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(s){var i="mediaclk:";return i+=s.id!=null?"id=%s %s":"%v%s",i+=s.mediaClockValue!=null?"=%s":"",i+=s.rateNumerator!=null?" rate=%s":"",i+=s.rateDenominator!=null?"/%s":"",i}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]};Object.keys(pg).forEach(function(s){var i=pg[s];i.forEach(function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")})})});var Tg=Yi(Dr=>{"use strict";var Ko=function(s){return String(Number(s))===s?Number(s):s},IR=function(s,i,e,t){if(t&&!e)i[t]=Ko(s[1]);else for(var r=0;r<e.length;r+=1)s[r+1]!=null&&(i[e[r]]=Ko(s[r+1]))},RR=function(s,i,e){var t=s.name&&s.names;s.push&&!i[s.push]?i[s.push]=[]:t&&!i[s.name]&&(i[s.name]={});var r=s.push?{}:t?i[s.name]:i;IR(e.match(s.reg),r,s.names,s.name),s.push&&i[s.push].push(r)},_g=Vm(),AR=RegExp.prototype.test.bind(/^([a-z])=(.*)/);Dr.parse=function(s){var i={},e=[],t=i;return s.split(/(\r\n|\r|\n)/).filter(AR).forEach(function(r){var o=r[0],n=r.slice(2);o==="m"&&(e.push({rtp:[],fmtp:[]}),t=e[e.length-1]);for(var a=0;a<(_g[o]||[]).length;a+=1){var c=_g[o][a];if(c.reg.test(n))return RR(c,t,n)}}),i.media=e,i};var gg=function(s,i){var e=i.split(/=(.+)/,2);return e.length===2?s[e[0]]=Ko(e[1]):e.length===1&&i.length>1&&(s[e[0]]=void 0),s};Dr.parseParams=function(s){return s.split(/;\s?/).reduce(gg,{})};Dr.parseFmtpConfig=Dr.parseParams;Dr.parsePayloads=function(s){return s.toString().split(" ").map(Number)};Dr.parseRemoteCandidates=function(s){for(var i=[],e=s.split(" ").map(Ko),t=0;t<e.length;t+=3)i.push({component:e[t],ip:e[t+1],port:e[t+2]});return i};Dr.parseImageAttributes=function(s){return s.split(" ").map(function(i){return i.substring(1,i.length-1).split(",").reduce(gg,{})})};Dr.parseSimulcastStreamList=function(s){return s.split(";").map(function(i){return i.split(",").map(function(e){var t,r=!1;return e[0]!=="~"?t=Ko(e):(t=Ko(e.substring(1,e.length)),r=!0),{scid:t,paused:r}})})}});var Eg=Yi((J$,Sg)=>{"use strict";var Fm=Vm(),CR=/%[sdv%]/g,yR=function(s){var i=1,e=arguments,t=e.length;return s.replace(CR,function(r){if(i>=t)return r;var o=e[i];switch(i+=1,r){case"%%":return"%";case"%s":return String(o);case"%d":return Number(o);case"%v":return""}})},La=function(s,i,e){var t=i.format instanceof Function?i.format(i.push?e:e[i.name]):i.format,r=[s+"="+t];if(i.names)for(var o=0;o<i.names.length;o+=1){var n=i.names[o];i.name?r.push(e[i.name][n]):r.push(e[i.names[o]])}else r.push(e[i.name]);return yR.apply(null,r)},bR=["v","o","s","i","u","e","p","c","b","t","r","z","a"],vR=["i","c","b","a"];Sg.exports=function(s,i){i=i||{},s.version==null&&(s.version=0),s.name==null&&(s.name=" "),s.media.forEach(function(o){o.payloads==null&&(o.payloads="")});var e=i.outerOrder||bR,t=i.innerOrder||vR,r=[];return e.forEach(function(o){Fm[o].forEach(function(n){n.name in s&&s[n.name]!=null?r.push(La(o,n,s)):n.push in s&&s[n.push]!=null&&s[n.push].forEach(function(a){r.push(La(o,n,a))})})}),s.media.forEach(function(o){r.push(La("m",Fm.m[0],o)),t.forEach(function(n){Fm[n].forEach(function(a){a.name in o&&o[a.name]!=null?r.push(La(n,a,o)):a.push in o&&o[a.push]!=null&&o[a.push].forEach(function(c){r.push(La(n,a,c))})})})}),r.join(`\r
`)+`\r
`}});var Bm=Yi(Nr=>{"use strict";var Js=Tg(),DR=Eg();Nr.write=DR;Nr.parse=Js.parse;Nr.parseParams=Js.parseParams;Nr.parseFmtpConfig=Js.parseFmtpConfig;Nr.parsePayloads=Js.parsePayloads;Nr.parseRemoteCandidates=Js.parseRemoteCandidates;Nr.parseImageAttributes=Js.parseImageAttributes;Nr.parseSimulcastStreamList=Js.parseSimulcastStreamList});import k8 from"webrtc-adapter";var og=Ye(ct());var lp=(j=>(j[j.INVALID_PARAMETER=4096]="INVALID_PARAMETER",j[j.INVALID_OPERATION=4097]="INVALID_OPERATION",j[j.NOT_SUPPORTED=4098]="NOT_SUPPORTED",j[j.DEVICE_NOT_FOUND=4099]="DEVICE_NOT_FOUND",j[j.INITIALIZE_FAILED=4100]="INITIALIZE_FAILED",j[j.SIGNAL_CHANNEL_SETUP_FAILED=16385]="SIGNAL_CHANNEL_SETUP_FAILED",j[j.SIGNAL_CHANNEL_ERROR=16386]="SIGNAL_CHANNEL_ERROR",j[j.ICE_TRANSPORT_ERROR=16387]="ICE_TRANSPORT_ERROR",j[j.JOIN_ROOM_FAILED=16388]="JOIN_ROOM_FAILED",j[j.CREATE_OFFER_FAILED=16389]="CREATE_OFFER_FAILED",j[j.SIGNAL_CHANNEL_RECONNECTION_FAILED=16390]="SIGNAL_CHANNEL_RECONNECTION_FAILED",j[j.UPLINK_RECONNECTION_FAILED=16391]="UPLINK_RECONNECTION_FAILED",j[j.DOWNLINK_RECONNECTION_FAILED=16392]="DOWNLINK_RECONNECTION_FAILED",j[j.REMOTE_STREAM_NOT_EXIST=16400]="REMOTE_STREAM_NOT_EXIST",j[j.CLIENT_BANNED=16448]="CLIENT_BANNED",j[j.SERVER_TIMEOUT=16449]="SERVER_TIMEOUT",j[j.SUBSCRIPTION_TIMEOUT=16450]="SUBSCRIPTION_TIMEOUT",j[j.PLAY_NOT_ALLOWED=16451]="PLAY_NOT_ALLOWED",j[j.DEVICE_AUTO_RECOVER_FAILED=16452]="DEVICE_AUTO_RECOVER_FAILED",j[j.START_PUBLISH_CDN_FAILED=16453]="START_PUBLISH_CDN_FAILED",j[j.STOP_PUBLISH_CDN_FAILED=16454]="STOP_PUBLISH_CDN_FAILED",j[j.START_MIX_TRANSCODE_FAILED=16455]="START_MIX_TRANSCODE_FAILED",j[j.STOP_MIX_TRANSCODE_FAILED=16456]="STOP_MIX_TRANSCODE_FAILED",j[j.NOT_SUPPORTED_H264=16457]="NOT_SUPPORTED_H264",j[j.SWITCH_ROLE_FAILED=16458]="SWITCH_ROLE_FAILED",j[j.API_CALL_TIMEOUT=16459]="API_CALL_TIMEOUT",j[j.SCHEDULE_FAILED=16460]="SCHEDULE_FAILED",j[j.API_CALL_ABORTED=16461]="API_CALL_ABORTED",j[j.SPC_INITIALIZED_FAILED=16462]="SPC_INITIALIZED_FAILED",j[j.VIDEO_MANAGER_ERROR=16463]="VIDEO_MANAGER_ERROR",j[j.SWITCH_ROOM_FAILED=16464]="SWITCH_ROOM_FAILED",j[j.VIDEO_ENCODE_FAILED=16465]="VIDEO_ENCODE_FAILED",j[j.AUDIO_ENCODE_FAILED=16466]="AUDIO_ENCODE_FAILED",j[j.WHIP_REQUEST_FAILED=16467]="WHIP_REQUEST_FAILED",j[j.UNKNOWN=65535]="UNKNOWN",j))(lp||{}),I=lp;var dT=function(s){for(let i in I)if(I[i]===s)return i;return"UNKNOWN"},un=class extends Error{constructor({name:e="RtcError",message:t,code:r=I.UNKNOWN,extraCode:o=0,constraint:n}){let a=`<${dT(r)} 0x${r.toString(16)}>`,c=`${t}${n?` constraint: ${n}`:""}${t!=null&&t.includes(a)?"":` ${a}`}`;super(c);d(this,"code");d(this,"extraCode");d(this,"message");d(this,"originMessage");d(this,"name");d(this,"constraint");this.code=r,this.extraCode=o,this.name=e,this.message=c,this.constraint=n,this.originMessage=t}getCode(){return this.code}getExtraCode(){return this.extraCode}toString(){return this.originMessage}},b=un;var Qa=0,up=!0,hn=function(s){Qa=s;let i=new Date;i.setTime(i.getTime()+s),v[up?"info":"debug"](`baseTime from server: ${i} offset: ${s}`),up=!1},hp=function(){return Qa},ui=function(){return Date.now()+Qa},Xa=function(){let s=new Date;return s.setTime(ui()),s.toLocaleString()},Ki=function(s){let i=String(s.getMilliseconds());return"padStart"in String.prototype&&(i=i.toString().padStart(3,"0")),`${s.toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/,"$1")}:${i}`},Vl=function(s){let i=new Date(performance.timeOrigin+s+Qa);return Ki(i)};var gt={};Zi(gt,{REPORT_TYPE:()=>mo,buildSSOPackage:()=>or,bytes2ms:()=>Cp,calculateScaleResolutionDownNumber:()=>ho,concatArrayBuffers:()=>xp,convertObjectNumberToInt:()=>An,copyProperties:()=>Ap,deepClone:()=>ls,deepCloneBasic:()=>hc,deepMerge:()=>gi,delay:()=>tt,detectImageType:()=>Ec,fibonacci:()=>hs,formatedTime:()=>Op,getConstructorName:()=>no,getContainerFromElement:()=>wp,getEnv:()=>Sp,getFirst16Bits:()=>Vp,getInternalVersion:()=>Mp,getLast16Bits:()=>Up,getLoggerUrl:()=>sr,getMediaStreamTrackInfo:()=>Sc,getMuteStateFromFlag:()=>Pt,getNetworkType:()=>pc,getNumNetworkType:()=>us,getReconnectionTimeout:()=>_i,getStringByteLength:()=>Rn,getTestSignalDomain:()=>Ep,getTurnServer:()=>Pp,getUint32Version:()=>_c,getValueType:()=>xe,getVersionFromInternalVersion:()=>kp,getViewListFromView:()=>lo,glog:()=>hu,ipv4ToUint32:()=>co,isArray:()=>be,isAudioWorkletSupported:()=>Dp,isBoolean:()=>fe,isConstructor:()=>ms,isEmpty:()=>ao,isFunction:()=>Te,isLangChinese:()=>fi,isMediaStreamTrack:()=>bp,isNumber:()=>ee,isObject:()=>It,isOverseaSdkAppId:()=>kt,isPlainObject:()=>_t,isPortrait:()=>mu,isPromise:()=>Vr,isRemoteTrack:()=>vp,isRotate90Or270:()=>Ft,isSameSubnet:()=>mc,isSetSinkIdSupported:()=>Np,isString:()=>ue,isUndefined:()=>S,isValidIP:()=>oo,isVideoMixerOutputTrack:()=>nr,loadImage:()=>uo,loadVideo:()=>Lp,ms2bytes:()=>yp,ms2samples:()=>uu,normalizeUrl:()=>Tc,performanceNow:()=>x,promiseAny:()=>ps,samples2ms:()=>lu,setNetworkTypeFromWebRTC:()=>fc,stringify:()=>Mt,stringifyIncludeValue:()=>In,throttlePromise:()=>gc});var eu={};Zi(eu,{ASR_ROBOT_FROM_TYPE:()=>to,AUDIO_MUTE_BIT:()=>sc,AUDIO_STAT_BIT:()=>xr,AUX_STAT_BIT:()=>as,AUX_STREAM_MSID:()=>jl,BACKEND_ENV:()=>rc,BASE_DOC_URL:()=>Nt,BASE_HOST:()=>mp,CAPABILITIES_KEYS:()=>cc,CLASS_NAME:()=>kT,CLOUD_CONSOLE_URL:()=>mT,CROSS_ROOM_BIT:()=>Gl,DATA_CHANNEL_FROM_TYPE_BIT:()=>ql,DATA_FREEZE_TIMING:()=>nc,DOC_BILLING_CN:()=>Ya,DOC_BILLING_OVERSEA:()=>Za,DOC_URL:()=>pT,DTLS_STATE_UNKNOWN:()=>pi,ENV_NAME:()=>er,EXCHANGE_SDP_TIMEOUT:()=>Yl,IS_WORKER:()=>Ys,IS_WORKLET:()=>mn,KIBANA_EVENT:()=>Le,LOCAL_STREAM_PUBLISH_STATE:()=>fp,LOGGER_CMD_TYPE:()=>wr,LOGGER_DOMAIN:()=>Bl,LOGGER_DOMAIN_OVERSEA:()=>$l,LOG_LEVEL:()=>hi,LOG_LEVEL_NAME:()=>wT,MAIN_STREAM_MSID:()=>_n,MAX_RTT:()=>Sn,MICROPHONE_COMMUNICATIONS:()=>PT,MICROPHONE_DEFAULT:()=>ds,MUTE_ALL_BIT:()=>gT,NAME:()=>_,NETWORK_TYPE:()=>Ka,NOT_SUPPORTED_H264:()=>cs,PAUSED_RETRY_COUNT:()=>rr,PEERCONNECTION_CONNECTING_TIMEOUT:()=>gn,PEER_CONNECTION_STATE:()=>De,PEER_LEAVE_REASON:()=>Zl,RECOVER_CAPTURE_INTERVAL:()=>eo,REMOTE_STREAM_TYPE_AUX:()=>zl,REMOTE_STREAM_TYPE_MAIN:()=>Jl,RENDER_FREEZE_TIMING:()=>vT,SCHEDULE_DOMAIN:()=>ir,SCHEDULE_TIMEOUT:()=>MT,SDP_SEMANTICS_PLAN_B:()=>Zs,SDP_SEMANTICS_UNIFIED_PLAN:()=>Ur,SECOND_HOST:()=>uT,SIGNAL_DOMAIN:()=>ac,SIGNAL_PING_PONG_INTERVAL:()=>_T,SIGNAL_PING_TIMEOUT:()=>fT,SIGNAL_RECONNECTION_COUNT:()=>yT,SMALL_STAT_BIT:()=>fn,SPEAKER_DEFAULT:()=>Tn,STORAGE_EXPIRES_TIME:()=>ec,STREAM_TYPE_BIG:()=>DT,STREAM_TYPE_SMALL:()=>NT,SUBSCRIBE_SMALL_RETRY_COUNT:()=>Ks,SYNC_USER_LIST_INTERVAL:()=>bT,Scene:()=>Li,THIRD_HOST:()=>hT,TRANSPORT_DIRECTION:()=>he,TRTC_ERROR_ASSISTANCE:()=>Hl,TRTC_QUALITY_BAD:()=>RT,TRTC_QUALITY_DISCONNECTED:()=>CT,TRTC_QUALITY_EXCELLENT:()=>ST,TRTC_QUALITY_GOOD:()=>ET,TRTC_QUALITY_POOR:()=>IT,TRTC_QUALITY_UNKNOWN:()=>TT,TRTC_QUALITY_VERY_BAD:()=>AT,UPDATE_OFFER_TIMEOUT:()=>Xl,VIDEO_MUTE_BIT:()=>oc,VIDEO_STAT_BIT:()=>Lr,WEBGL_ATTRIBUTES:()=>Kl,audioProfileMap:()=>tc,defaultBigVideoProfile:()=>Or,defaultSmallVideoProfile:()=>Wl,getRetryCount:()=>tr,getScriptDir:()=>lT,innerVersion:()=>Xs,loggerProxy:()=>pn,screenProfileMap:()=>ic,setLoggerProxy:()=>ns,setRetryCount:()=>Ql,setVersion:()=>Fl,version:()=>Ze,videoProfileMap:()=>mi});var Xs="4.15.00.1600",Ze="5.0.0";function Fl(s){Ze=s;let[i,e,t]=s.split(".").map(r=>parseInt(r,10));Xs=`${i}.${Math.min(15,e)}.${Math.min(15,t)}.${e.toString().padStart(2,"0")}${t.toString().padStart(2,"0")}`}var Ys=typeof importScripts!="undefined",mn=typeof registerProcessor!="undefined",lT=()=>{let s=Ys?self.location.href:document.currentScript.src;return s.substring(0,s.lastIndexOf("/")+1)},pn="",ns=s=>pn=s,mp="web.sdk.qcloud.com",uT="web.sdk.tencent.cn",hT="web.sdk.cloud.tencent.cn",mT="https://console.cloud.tencent.com/trtc",Nt=`https://${mp}/trtc/webrtc/doc`,pT=`${Nt}/zh-cn/`,Ya="https://cloud.tencent.com/document/product/647/85386",Za="https://trtc.io/document/56025",Bl="https://yun.tim.qq.com",$l="https://apisgp.my-imcloud.com",Hl="trtc_error_assistance",wr={LOG:"jssdk_log",EVENT:"jssdk_event",KEY_POINT:"jssdk_new_endreport",KV_STAT:"jssdk_key_metrics_report"},er={QCLOUD:"qcloud",OLD_CLOUD_LADDER:"trtc",WEBRTC:"webrtc"},hi=(n=>(n[n.TRACE=0]="TRACE",n[n.DEBUG=1]="DEBUG",n[n.INFO=2]="INFO",n[n.WARN=3]="WARN",n[n.ERROR=4]="ERROR",n[n.NONE=5]="NONE",n))(hi||{}),fT=18e3,_T=2e3,Ka={unknown:0,wifi:1,"4g":2,"3g":3,"2g":4,wired:5,"5g":6},ec=168*3600*1e3,tc={standard:{sampleRate:48e3,channelCount:1,bitrate:40},"standard-stereo":{sampleRate:48e3,channelCount:2,bitrate:64},high:{sampleRate:48e3,channelCount:1,bitrate:128},"high-stereo":{sampleRate:48e3,channelCount:2,bitrate:192}},mi={"120p":{width:160,height:120,frameRate:15,bitrate:200},"120p_2":{width:160,height:120,frameRate:15,bitrate:100},"180p":{width:320,height:180,frameRate:15,bitrate:350},"180p_2":{width:320,height:180,frameRate:15,bitrate:150},"240p":{width:320,height:240,frameRate:15,bitrate:400},"240p_2":{width:320,height:240,frameRate:15,bitrate:200},"360p":{width:640,height:360,frameRate:15,bitrate:800},"360p_2":{width:640,height:360,frameRate:15,bitrate:400},"480p":{width:640,height:480,frameRate:15,bitrate:900},"480p_2":{width:640,height:480,frameRate:15,bitrate:500},"720p":{width:1280,height:720,frameRate:15,bitrate:1500},"1080p":{width:1920,height:1080,frameRate:15,bitrate:2e3},"1440p":{width:2560,height:1440,frameRate:30,bitrate:4860},"4K":{width:3840,height:2160,frameRate:30,bitrate:9e3}},Or=mi["480p_2"],Wl=mi["120p_2"],ic={"480p":{width:640,height:480,frameRate:5,bitrate:900},"480p_2":{width:640,height:480,frameRate:30,bitrate:1e3},"720p":{width:1280,height:720,frameRate:5,bitrate:1200},"720p_2":{width:1280,height:720,frameRate:30,bitrate:3e3},"1080p":{width:1920,height:1080,frameRate:5,bitrate:1600},"1080p_2":{width:1920,height:1080,frameRate:30,bitrate:4e3},"1440p":{width:2560,height:1440,frameRate:5,bitrate:2e3},"1440p_2":{width:2560,height:1440,frameRate:30,bitrate:4860},"4K":{width:3840,height:2160,frameRate:5,bitrate:4e3},"4K_2":{width:3840,height:2160,frameRate:30,bitrate:9e3}},_={CANVAS:"canvas",AUDIO:"audio",VIDEO:"video",SCREEN:"screen",SMALL:"small",BIG:"big",AUXILIARY:"auxiliary",SMALL_VIDEO:"smallVideo",FACING_MODE_USER:"user",FACING_MODE_ENVIRONMENT:"environment",MUTE:"mute",UNMUTE:"unmute",ENDED:"ended",PLAYING:"playing",PAUSE:"pause",ERROR:"error",LOADSTART:"loadstart",LOADEDDATA:"loadeddata",LOADEDMETADATA:"loadedmetadata",AUDIO_INPUT:"audioinput",VIDEO_INPUT:"videoinput",DETAIL:"detail",TEXT:"text",MAIN:"main",BACKUP:"backup",BANNED:"banned",KICK:"kick",USER_TIME_OUT:"user_time_out",ROOM_DISBAND:"room_disband",SEI_MESSAGE:"sei-message",ADD:"add",REMOVE:"remove",REPLACE:"replace",TRACK:"track",SUBSCRIBE:"subscribe",UNSUBSCRIBE:"unsubscribe",TRANSCEIVER_DIRECTION_SENDONLY:"sendonly",TRANSCEIVER_DIRECTION_RECVONLY:"recvonly",ENTER_PICTURE_IN_PICTURE:"enterpictureinpicture",LEAVE_PICTURE_IN_PICTURE:"leavepictureinpicture",FULLSCREEN_CHANGE:"fullscreenchange",RESIZE:"resize",TIME_UPDATE:"timeupdate"},he={INACTIVE:"inactive",SENDONLY:"sendonly",RECVONLY:"recvonly"},rc={OLD_CLOUD_LADDER:"wss://trtc.rtc.qq.com",WEBRTC:"wss://webrtc.qq.com"},Li=(e=>(e.LIVE="live",e.RTC="rtc",e))(Li||{}),Lr=1,fn=2,as=4,xr=8,sc=64,oc=16,gT=112,Gl=128,ql=256,_n="5Y2wZK8nANNAoVw6dSAHVjNxrD1ObBM2kBPV",jl="224d130c-7b5c-415b-aaa2-79c2eb5a6df2",Jl=_.MAIN,zl=_.AUXILIARY,TT=0,ST=1,ET=2,IT=3,RT=4,AT=5,CT=6,pi="unknown",De={NEW:"new",CONNECTING:"connecting",FAILED:"failed",CLOSED:"closed",DISCONNECTED:"disconnected",CONNECTED:"connected",COMPLETED:"completed"},pp=1/0;function Ql(s){pp=s}function tr(){return pp}var yT=30,Le={JOIN:"join",DELTA_JOIN:"delta-join",REJOIN:"rejoin",LEAVE:"leave",DELTA_LEAVE:"delta-leave",PUBLISH:"publish",DELTA_PUBLISH:"delta-publish",UNPUBLISH:"unpublish",SUBSCRIBE:"subscribe",UNSUBSCRIBE:"unsubscribe",UPLINK_CONNECTION:"uplink-connection",UPLINK_RECONNECTION:"uplink-reconnection",DOWNLINK_CONNECTION:"downlink-connection",DOWNLINK_RECONNECTION:"downlink-reconnection",ON_TRACK:"ontrack",ICE_CONNECTION_STATE:"iceConnectionState",LOCAL_STREAM_INITIALIZE:"stream-initialize",SIGNAL_CONNECTION:"websocketConnectionState",SIGNAL_RECONNECTION:"websocketReconnectionState",UPDATE_STREAM:"update-stream",RECOVER_LOCAL_AUDIO_TRACK:"recover-local-audio-track",RECOVER_LOCAL_VIDEO_TRACK:"recover-local-video-track",RECOVER_SUBSCRIPTION:"recover-subscription",START_MIX_TRANSCODE:"start-mix-transcode",STOP_MIX_TRANSCODE:"stop-mix-transcode",PLAYER_ERROR:"player-error",SCHEDULE:"schedule",LOAD_WORKLET:"load-worklet",VIDEO_FROZEN_COUNT:"videoFrozenCount",GET_USER_MEDIA_RETRY:"getUserMedia-retry",VIDEO_ENCODE_FAILED_DURING_CALL:"video-encode-failed-during-call",VIDEO_ENCODE_RESUME_DURING_CALL:"video-encode-resume-during-call",AUDIO_ENCODE_FAILED_DURING_CALL:"audio-encode-failed-during-call",AUDIO_ENCODE_RESUME_DURING_CALL:"audio-encode-resume-during-call",VIDEO_DECODE_FAILED_DURING_CALL:"video-decode-failed-during-call",VIDEO_DECODE_RESUME_DURING_CALL:"video-decode-resume-during-call",AUDIO_DECODE_FAILED_DURING_CALL:"audio-decode-failed-during-call",AUDIO_DECODE_RESUME_DURING_CALL:"audio-decode-resume-during-call",VIDEO_HARDWARE_DECODE_FAILED:"video-hardware-decode-failed",VIDEO_HARDWARE_DECODE_RESUME:"video-hardware-decode-resume",VIDEO_FRAME_ASSEMBLE_FAILED_DURING_CALL:"video-frame-assemble-failed-during-call",VIDEO_FRAME_ASSEMBLE_RESUME_DURING_CALL:"video-frame-assemble-resume-during-call"},bT=1e4,Xl=1e4,Yl=1e4,Ur="unified-plan",Zs="plan-b",cs=1028,fp=(t=>(t[t.UNPUBLISH=-1]="UNPUBLISH",t[t.PUBLISHING=0]="PUBLISHING",t[t.PUBLISHED=1]="PUBLISHED",t))(fp||{}),nc=500,vT=1e3,DT=_.BIG,NT=_.SMALL,gn=10*1e3,ir={MAIN:"schedule.cloud-rtc.com",BACKUP:"schedule.cloud-rtc.net",MAIN_OVERSEA:"schedule.rtc-web.com",BACKUP_OVERSEA:"schedule.rtc-web.io",MAIN_OVERSEA_BACKUP:"intl-schedule.cloud-rtc.com"},ac={MAIN_OVERSEA:"signaling.rtc-web.com",BACKUP_OVERSEA:"signaling.rtc-web.io"},MT=2e3,kT={TRTC:"TRTC",CLIENT:"Client",LOCAL_STREAM:"LocalStream",REMOTE_STREAM:"RemoteStream",STREAM:"Stream"},rr=5,ds="default",Tn=ds,PT="communications",wT=Object.keys(hi),Zl=["normal leave","timeout leave","kick","role change"],Ks=10,eo=2e3,cc=["width","height","frameRate","facingMode","sampleRate","sampleSize","channelCount","deviceId","min","max"],Sn=10*1e3,to=14,Kl={alpha:!0,antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:!1,depth:!1,stencil:!1,failIfMajorPerformanceCaveat:!0,powerPreference:"low-power"};var OT=function(s,i,e,t){function r(o){return o instanceof e?o:new e(function(n){n(o)})}return new(e||(e=Promise))(function(o,n){function a(u){try{l(t.next(u))}catch(h){n(h)}}function c(u){try{l(t.throw(u))}catch(h){n(h)}}function l(u){u.done?o(u.value):r(u.value).then(a,c)}l((t=t.apply(s,i||[])).next())})},tu=Symbol(32),iu=Symbol(16),ru=Symbol(8),xi=class{constructor(i){this.g=i,this.consumed=0,i&&(this.need=i.next().value)}setG(i){this.g=i,this.demand(i.next().value,!0)}consume(){this.buffer&&this.consumed&&(this.buffer.copyWithin(0,this.consumed),this.buffer=this.buffer.subarray(0,this.buffer.length-this.consumed),this.consumed=0)}demand(i,e){return e&&this.consume(),this.need=i,this.flush()}read(i){return OT(this,void 0,void 0,function*(){return this.lastReadPromise&&(yield this.lastReadPromise),this.lastReadPromise=new Promise((e,t)=>{var r;this.reject=t,this.resolve=n=>{delete this.lastReadPromise,delete this.resolve,delete this.need,e(n)},this.demand(i,!0)||(r=this.pull)===null||r===void 0||r.call(this,i)})})}readU32(){return this.read(tu)}readU16(){return this.read(iu)}readU8(){return this.read(ru)}close(){var i;this.g&&this.g.return(),this.buffer&&this.buffer.subarray(0,0),(i=this.reject)===null||i===void 0||i.call(this,new Error("EOF")),delete this.lastReadPromise}flush(){if(!this.buffer||!this.need)return;let i=null,e=this.buffer.subarray(this.consumed),t=0,r=o=>e.length<(t=o);if(typeof this.need=="number"){if(r(this.need))return;i=e.subarray(0,t)}else if(this.need===tu){if(r(4))return;i=e[0]<<24|e[1]<<16|e[2]<<8|e[3]}else if(this.need===iu){if(r(2))return;i=e[0]<<8|e[1]}else if(this.need===ru){if(r(1))return;i=e[0]}else if("buffer"in this.need){if("byteOffset"in this.need){if(r(this.need.byteLength-this.need.byteOffset))return;new Uint8Array(this.need.buffer,this.need.byteOffset).set(e.subarray(0,t)),i=this.need}else if(this.g){this.g.throw(new Error("Unsupported type"));return}}else{if(r(this.need.byteLength))return;new Uint8Array(this.need).set(e.subarray(0,t)),i=this.need}return this.consumed+=t,this.g?this.demand(this.g.next(i).value,!0):this.resolve&&this.resolve(i),i}write(i){if(i instanceof Uint8Array?this.malloc(i.length).set(i):"buffer"in i?this.malloc(i.byteLength).set(new Uint8Array(i.buffer,i.byteOffset,i.byteLength)):this.malloc(i.byteLength).set(new Uint8Array(i)),this.g||this.resolve)this.flush();else return new Promise(e=>this.pull=e)}writeU32(i){this.malloc(4).set([i>>24&255,i>>16&255,i>>8&255,i&255]),this.flush()}writeU16(i){this.malloc(2).set([i>>8&255,i&255]),this.flush()}writeU8(i){this.malloc(1)[0]=i,this.flush()}malloc(i){if(this.buffer){let e=this.buffer.length,t=e+i;if(t<=this.buffer.buffer.byteLength-this.buffer.byteOffset)this.buffer=new Uint8Array(this.buffer.buffer,this.buffer.byteOffset,t);else{let r=new Uint8Array(t);r.set(this.buffer),this.buffer=r}return this.buffer.subarray(e,t)}else return this.buffer=new Uint8Array(i),this.buffer}};xi.U32=tu;xi.U16=iu;xi.U8=ru;var LT=128,xT=127,gA=~xT,TA=Math.pow(2,31);function su(s){let i=new xi;for(;s>=128;)i.malloc(1)[0]=s&255|LT,s>>>=7;return i.malloc(1)[0]=s&255,i.buffer||new Uint8Array(0)}function dc(s,i=0){let e=new xi,t=i<<3;switch(typeof s){case"boolean":let r=e.malloc(2);r[0]=t,r[1]=s?1:0;break;case"number":e.malloc(1)[0]=t,e.write(su(s));break;case"string":e.malloc(1)[0]=t|2;let o=new TextEncoder().encode(s);e.write(su(o.length));let n=e.malloc(o.length);for(let c=0;c<o.length;c++)n[c]=o[c];break;case"object":let a=new xi;if(Array.isArray(s))for(let c=0;c<s.length;c++){let l=dc(s[c],c+1);l&&a.write(l)}else{let c=1;for(let l in s){let u=dc(s[l],c++);u&&a.write(u)}}i===0?a.buffer&&e.write(a.buffer):(e.malloc(1)[0]=t|2,a.buffer&&(e.write(su(a.buffer.length)),e.write(a.buffer)))}return e.buffer||new Uint8Array(0)}var En=class{constructor(){d(this,"buffer");this.buffer=[]}get data(){return this.buffer}get length(){return this.buffer.length}writeInt32(i){this.buffer.push(i>>>24&255),this.buffer.push(i>>>16&255),this.buffer.push(i>>>8&255),this.buffer.push(i&255)}writeInt16(i){this.buffer.push(i>>>8&255),this.buffer.push(i&255)}writeByte(i){this.buffer.push(i&255)}writeBytes(i){for(let e=0;e<i.length;e++)this.buffer.push(i[e])}};function ou(s,i,e){s[e]=i>>>24&255,s[e+1]=i>>>16&255,s[e+2]=i>>>8&255,s[e+3]=i&255}function ft(s,i){return s[i]<<24|s[i+1]<<16|s[i+2]<<8|s[i+3]}function nu(s,i){return s[i]}function io(s,i,e){return new TextDecoder().decode(UT(s,i,e))}function UT(s,i,e){return s.slice(i,i+e)}var au=0,lc=2654435769,uc=16,du=4,ro=2,so=7;function VT(s,i,e,t="AVQualityReportSvc.C2S",r=2e3,o=2,n=30){return{version:r,encryption:o,d2:"",d2Len:0,uinType:n,uin:"",uinLen:0,reqHead:{seqNumber:e,appId:s,appidAtThird:new Uint8Array(0),a2:"",a2Len:0,serviceCmd:t,serviceCmdLen:0,cookie:"",cookieLen:0,imei:"",imeiLen:0,ksid:"",ksidLen:0,clientVersionInfo:"",clientVersionInfoLen:0},busiBuff:i}}function _p(s,i){let e=new En,t=VT(i,s,au);au=au+1&2147483647,e.writeInt32(0),e.writeInt32(t.version),e.writeByte(t.encryption);let r=new TextEncoder().encode(t.d2);e.writeInt32(r.length+4),r&&e.writeBytes(r),e.writeByte(t.uinType);let o=new TextEncoder().encode(t.uin);e.writeInt32(o.length+4),o.length&&e.writeBytes(o);let n=new En;n.writeInt32(0),n.writeInt32(t.reqHead.seqNumber),n.writeInt32(t.reqHead.appId),n.writeByte(t.reqHead.appId>>>24&255),n.writeByte(t.reqHead.appId>>>16&255),n.writeByte(t.reqHead.appId>>>8&255),n.writeByte(t.reqHead.appId&255);for(let O=4;O<16;O++)n.writeByte(0);let a=new TextEncoder().encode(t.reqHead.a2);n.writeInt32(a.length+4),a.length&&n.writeBytes(a);let c=new TextEncoder().encode(t.reqHead.serviceCmd);n.writeInt32(c.length+4),c.length&&n.writeBytes(c);let l=new TextEncoder().encode(t.reqHead.cookie);n.writeInt32(l.length+4),l.length&&n.writeBytes(l);let u=new TextEncoder().encode(t.reqHead.imei);n.writeInt32(u.length+4),u.length&&n.writeBytes(u);let h=new TextEncoder().encode(t.reqHead.ksid);n.writeInt32(h.length+4),h.length&&n.writeBytes(h);let m=new TextEncoder().encode(t.reqHead.clientVersionInfo);n.writeInt16(m.length+2),m.length&&n.writeBytes(m);let p=n.length;n.data[0]=p>>>24&255,n.data[1]=p>>>16&255,n.data[2]=p>>>8&255,n.data[3]=p&255,ue(s)&&(s=new TextEncoder().encode(s)),n.writeInt32(s.length+4),s.length&&n.writeBytes(s);let T=new Uint8Array(n.data),E=null;t.encryption===1?E=new TextEncoder().encode(t.uin):t.encryption===2&&(E=new Uint8Array(16)),E&&(T=FT(T,E)),e.writeBytes(T);let g=new Uint8Array(e.data),C=g.length;return g[0]=C>>>24&255,g[1]=C>>>16&255,g[2]=C>>>8&255,g[3]=C&255,g}function FT(s,i){let e=s.length,r=(e+1+ro+so)%8;r&&(r=8-r);let o=e+1+ro+so+r,n=new Uint8Array(o),a=0,c=new Uint8Array(8),l=new Uint8Array(8),u=new Uint8Array(8),h=0;c[0]=Math.floor(Math.random()*256)&248|r,h=1;for(let p=0;p<r;p++)c[h]=Math.floor(Math.random()*256)&255,h+=1;for(let p=0;p<ro;)if(h<8&&(c[h]=Math.floor(Math.random()*256)&255,h+=1,p+=1),h===8){cu(c,i,l,u,n,a),a+=8,h=0;for(let T=0;T<8;T++)u[T]=n[a-8+T]}let m=0;for(;m<e;)if(h<8&&(c[h]=s[m],h+=1,m+=1),h===8){cu(c,i,l,u,n,a),a+=8,h=0;for(let p=0;p<8;p++)u[p]=n[a-8+p]}for(let p=0;p<so;)if(h<8&&(c[h]=0,h+=1,p+=1),h===8){cu(c,i,l,u,n,a),a+=8,h=0;for(let T=0;T<8;T++)u[T]=n[a-8+T]}return n}function cu(s,i,e,t,r,o){for(let n=0;n<8;n++)s[n]^=t[n];BT(s,i,r,o);for(let n=0;n<8;n++)r[o+n]^=e[n];for(let n=0;n<8;n++)e[n]=s[n]}function BT(s,i,e,t){let r=ft(s,0),o=ft(s,4),n=[];for(let c=0;c<4;c++)n[c]=ft(i,c*4);let a=0;for(let c=0;c<uc;c++)a+=lc,a=a>>>0,r+=(o<<4)+n[0]^o+a^(o>>>5)+n[1],r=r>>>0,o+=(r<<4)+n[2]^r+a^(r>>>5)+n[3],o=o>>>0;ou(e,r,t),ou(e,o,t+4)}function oo(s){return s?!!(/^\d{1,3}(\.\d{1,3}){3}$/.test(s)||s.includes(":")&&/^[0-9a-fA-F:]+$/.test(s)):!1}function mc(s,i){if(!oo(s)||!oo(i))return s===i;let e=o=>o.includes(":");if(e(s)!==e(i))return s===i;if(e(s)){let o=s.split(":").slice(0,3).join(":"),n=i.split(":").slice(0,3).join(":");return o===n}let t=s.split(".").slice(0,3).join("."),r=i.split(".").slice(0,3).join(".");return t===r}var Sp=function(){return new URLSearchParams(location.search).get("trtc_env")||""},$T=".rtc.qq.com",Ep=function(s){return s.includes(".")?s:`${s}${$T}`},kt=s=>Number(s)<14e8,sr=function(s,i){let e;pn?e=pn:e=kt(s)?$l:Bl;let t=Math.floor(Math.random()*Pr(2,31));return`${e}/v5/AVQualityReportSvc/C2S?random=${t}&sdkappid=${s}&cmdtype=${i}`},Ip="unknown";function pc(){WT();let{userAgent:s,connection:i}=navigator,e=(s.match(/NetType\/\S+/)||[])[0]||"";e=e.toLowerCase().replace("nettype/",""),e==="3gnet"&&(e="3g");let t=i&&i.type&&i.type.toLowerCase(),r=i&&i.effectiveType&&i.effectiveType.toLowerCase();return r==="slow-2"&&(r="2g"),t?Rp(t,r):Ip}function HT(){v.warn("netType changed",pc())}var gp=!1;function WT(){var s;gp||(gp=!0,(s=navigator.connection)==null||s.addEventListener("typechange",HT))}function Rp(s,i){if(Ka[s])return s;switch(s){case"cellular":case"wimax":return i||"unknown";case"ethernet":return"wired";case"none":case"other":default:return"unknown"}}function fc(s){Ip=Rp(s)}function us(){return Ka[pc()]}function Ap(s,i){for(let e of Reflect.ownKeys(i))if(e!=="constructor"&&e!=="prototype"&&e!=="name"){let t=Object.getOwnPropertyDescriptor(i,e)||"";Object.defineProperty(s,e,t)}return s}function Cp(s,i=48e3){return lu(s/4,i)}function lu(s,i=48e3){return s*1e3/i}function yp(s,i=48e3){return uu(s,i)*4}function uu(s,i=48e3){return s*i/1e3}var hu=typeof window!="undefined"&&typeof window.glog=="function"?window.glog:()=>{},fi=()=>{let s=navigator.language;return s=s.substring(0,2),s==="zh"},_t=function(s){if(!s||typeof s!="object"||Object.prototype.toString.call(s)!="[object Object]")return!1;let i=Object.getPrototypeOf(s);if(i===null)return!0;let e=Object.prototype.hasOwnProperty.call(i,"constructor")&&i.constructor;return typeof e=="function"&&e instanceof e&&Function.prototype.toString.call(e)===Function.prototype.toString.call(Object)};function hs(s,i=1,e=1){return s<=1?e:hs(s-1,e,i+e)}function _i(s){return s>8?30*1e3:hs(s)*1e3}function xe(s){return Reflect.apply(Object.prototype.toString,s,[]).replace(/^\[object\s(\w+)\]$/,"$1").toLowerCase()}var Te=s=>typeof s=="function",S=s=>typeof s=="undefined",ue=s=>typeof s=="string",ee=s=>typeof s=="number",fe=s=>typeof s=="boolean",It=s=>xe(s)==="object",be=s=>xe(s)==="array",bp=s=>xe(s)==="MediaStreamTrack".toLowerCase(),vp=s=>s.isRemote,Vr=s=>xe(s)==="promise",ms=s=>Te(s)&&s.prototype.constructor===s,no=s=>ms(s)?s.prototype.constructor.name:"",Dp=typeof AudioWorkletNode!="undefined",Np=typeof HTMLMediaElement!="undefined"&&"setSinkId"in HTMLMediaElement.prototype;function ps(s){return new Promise((i,e)=>{let t=[];s.forEach(r=>{r.then(i).catch(o=>{t.push(o),t.length===s.length&&e(t)})})})}function x(){return!performance||!performance.now?Date.now():Math.floor(performance.now())}var Tp=s=>+s<10?`0${s}`:s,Mp=s=>{let i=s.match(/^\d+\.\d+\.\d+/)[0];if(!i)return s;let e=i.split("."),t=Tp(e[1])+Tp(e[2]);return e[1]-15>0&&(e[1]="15"),e[2]-15>0&&(e[2]="15"),`${e.join(".")}.${t}`},kp=s=>{let i=s.split(".");if(i.length!==4)return s;let e=i[0],t=i[3];if(t.length<4)return s;let r=parseInt(t.substring(0,t.length-2),10),o=parseInt(t.substring(t.length-2),10);return`${e}.${r}.${o}`},GT=Object.prototype.hasOwnProperty,{toString:kA}=Object.prototype;function ao(s){if(s==null)return!0;if(typeof s=="boolean")return!1;if(typeof s=="number")return s===0;if(typeof s=="string"||typeof s=="function"||Array.isArray(s))return s.length===0;if(s instanceof Error)return s.message==="";if(_t(s))swi