UNPKG

trtc-sdk-v5

Version:
5 lines 914 kB
var iT=Object.create;var pn=Object.defineProperty,rT=Object.defineProperties,np=Object.getOwnPropertyDescriptor,sT=Object.getOwnPropertyDescriptors,oT=Object.getOwnPropertyNames,Qa=Object.getOwnPropertySymbols,ap=Object.getPrototypeOf,Vl=Object.prototype.hasOwnProperty,cp=Object.prototype.propertyIsEnumerable,nT=Reflect.get;var Or=Math.pow,Ul=(s,i,e)=>i in s?pn(s,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[i]=e,N=(s,i)=>{for(var e in i||(i={}))Vl.call(i,e)&&Ul(s,e,i[e]);if(Qa)for(var e of Qa(i))cp.call(i,e)&&Ul(s,e,i[e]);return s},x=(s,i)=>rT(s,sT(i));var Xa=(s,i)=>{var e={};for(var t in s)Vl.call(s,t)&&i.indexOf(t)<0&&(e[t]=s[t]);if(s!=null&&Qa)for(var t of Qa(s))i.indexOf(t)<0&&cp.call(s,t)&&(e[t]=s[t]);return e};var Ki=(s,i)=>()=>(i||s((i={exports:{}}).exports,i),i.exports),er=(s,i)=>{for(var e in i)pn(s,e,{get:i[e],enumerable:!0})},aT=(s,i,e,t)=>{if(i&&typeof i=="object"||typeof i=="function")for(let r of oT(i))!Vl.call(s,r)&&r!==e&&pn(s,r,{get:()=>i[r],enumerable:!(t=np(i,r))||t.enumerable});return s};var Ze=(s,i,e)=>(e=s!=null?iT(ap(s)):{},aT(i||!s||!s.__esModule?pn(e,"default",{value:s,enumerable:!0}):e,s));var w=(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&&pn(i,e,r),r};var d=(s,i,e)=>Ul(s,typeof i!="symbol"?i+"":i,e);var We=(s,i,e)=>nT(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 lt=Ki((hA,Fl)=>{"use strict";var cT=Object.prototype.hasOwnProperty,Rt="~";function fn(){}Object.create&&(fn.prototype=Object.create(null),new fn().__proto__||(Rt=!1));function dT(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 dT(e,t||s,r),n=Rt?Rt+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 Ya(s,i){--s._eventsCount===0?s._events=new fn:delete s._events[i]}function _t(){this._events=new fn,this._eventsCount=0}_t.prototype.eventNames=function(){var i=[],e,t;if(this._eventsCount===0)return i;for(t in e=this._events)cT.call(e,t)&&i.push(Rt?t.slice(1):t);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i};_t.prototype.listeners=function(i){var e=Rt?Rt+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};_t.prototype.listenerCount=function(i){var e=Rt?Rt+i:i,t=this._events[e];return t?t.fn?1:t.length:0};_t.prototype.emit=function(i,e,t,r,o,n){var a=Rt?Rt+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};_t.prototype.on=function(i,e,t){return dp(this,i,e,t,!1)};_t.prototype.once=function(i,e,t){return dp(this,i,e,t,!0)};_t.prototype.removeListener=function(i,e,t,r){var o=Rt?Rt+i:i;if(!this._events[o])return this;if(!e)return Ya(this,o),this;var n=this._events[o];if(n.fn)n.fn===e&&(!r||n.once)&&(!t||n.context===t)&&Ya(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:Ya(this,o)}return this};_t.prototype.removeAllListeners=function(i){var e;return i?(e=Rt?Rt+i:i,this._events[e]&&Ya(this,e)):(this._events=new fn,this._eventsCount=0),this};_t.prototype.off=_t.prototype.removeListener;_t.prototype.addListener=_t.prototype.on;_t.prefixed=Rt;_t.EventEmitter=_t;typeof Fl!="undefined"&&(Fl.exports=_t)});var id=Ki((VC,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=Ki(_r=>{"use strict";var Oo=function(s){return String(Number(s))===s?Number(s):s},SS=function(s,i,e,t){if(t&&!e)i[t]=Oo(s[1]);else for(var r=0;r<e.length;r+=1)s[r+1]!=null&&(i[e[r]]=Oo(s[r+1]))},ES=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;SS(e.match(s.reg),r,s.names,s.name),s.push&&i[s.push].push(r)},df=id(),IS=RegExp.prototype.test.bind(/^([a-z])=(.*)/);_r.parse=function(s){var i={},e=[],t=i;return s.split(/(\r\n|\r|\n)/).filter(IS).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 ES(c,t,n)}}),i.media=e,i};var lf=function(s,i){var e=i.split(/=(.+)/,2);return e.length===2?s[e[0]]=Oo(e[1]):e.length===1&&i.length>1&&(s[e[0]]=void 0),s};_r.parseParams=function(s){return s.split(/;\s?/).reduce(lf,{})};_r.parseFmtpConfig=_r.parseParams;_r.parsePayloads=function(s){return s.toString().split(" ").map(Number)};_r.parseRemoteCandidates=function(s){for(var i=[],e=s.split(" ").map(Oo),t=0;t<e.length;t+=3)i.push({component:e[t],ip:e[t+1],port:e[t+2]});return i};_r.parseImageAttributes=function(s){return s.split(" ").map(function(i){return i.substring(1,i.length-1).split(",").reduce(lf,{})})};_r.parseSimulcastStreamList=function(s){return s.split(";").map(function(i){return i.split(",").map(function(e){var t,r=!1;return e[0]!=="~"?t=Oo(e):(t=Oo(e.substring(1,e.length)),r=!0),{scid:t,paused:r}})})}});var mf=Ki((BC,hf)=>{"use strict";var ju=id(),RS=/%[sdv%]/g,AS=function(s){var i=1,e=arguments,t=e.length;return s.replace(RS,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 AS.apply(null,r)},CS=["v","o","s","i","u","e","p","c","b","t","r","z","a"],yS=["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||CS,t=i.innerOrder||yS,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=Ki(Hi=>{"use strict";var Ds=uf(),bS=mf(),vS=id();Hi.grammar=vS;Hi.write=bS;Hi.parse=Ds.parse;Hi.parseParams=Ds.parseParams;Hi.parseFmtpConfig=Ds.parseFmtpConfig;Hi.parsePayloads=Ds.parsePayloads;Hi.parseRemoteCandidates=Ds.parseRemoteCandidates;Hi.parseImageAttributes=Ds.parseImageAttributes;Hi.parseSimulcastStreamList=Ds.parseSimulcastStreamList});var Vm=Ki((K$,_g)=>{"use strict";var fg=_g.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(fg).forEach(function(s){var i=fg[s];i.forEach(function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")})})});var Sg=Ki(Mr=>{"use strict";var nn=function(s){return String(Number(s))===s?Number(s):s},yR=function(s,i,e,t){if(t&&!e)i[t]=nn(s[1]);else for(var r=0;r<e.length;r+=1)s[r+1]!=null&&(i[e[r]]=nn(s[r+1]))},bR=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;yR(e.match(s.reg),r,s.names,s.name),s.push&&i[s.push].push(r)},gg=Vm(),vR=RegExp.prototype.test.bind(/^([a-z])=(.*)/);Mr.parse=function(s){var i={},e=[],t=i;return s.split(/(\r\n|\r|\n)/).filter(vR).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<(gg[o]||[]).length;a+=1){var c=gg[o][a];if(c.reg.test(n))return bR(c,t,n)}}),i.media=e,i};var Tg=function(s,i){var e=i.split(/=(.+)/,2);return e.length===2?s[e[0]]=nn(e[1]):e.length===1&&i.length>1&&(s[e[0]]=void 0),s};Mr.parseParams=function(s){return s.split(/;\s?/).reduce(Tg,{})};Mr.parseFmtpConfig=Mr.parseParams;Mr.parsePayloads=function(s){return s.toString().split(" ").map(Number)};Mr.parseRemoteCandidates=function(s){for(var i=[],e=s.split(" ").map(nn),t=0;t<e.length;t+=3)i.push({component:e[t],ip:e[t+1],port:e[t+2]});return i};Mr.parseImageAttributes=function(s){return s.split(" ").map(function(i){return i.substring(1,i.length-1).split(",").reduce(Tg,{})})};Mr.parseSimulcastStreamList=function(s){return s.split(";").map(function(i){return i.split(",").map(function(e){var t,r=!1;return e[0]!=="~"?t=nn(e):(t=nn(e.substring(1,e.length)),r=!0),{scid:t,paused:r}})})}});var Ig=Ki((tH,Eg)=>{"use strict";var Fm=Vm(),DR=/%[sdv%]/g,NR=function(s){var i=1,e=arguments,t=e.length;return s.replace(DR,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""}})},Va=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 NR.apply(null,r)},MR=["v","o","s","i","u","e","p","c","b","t","r","z","a"],kR=["i","c","b","a"];Eg.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||MR,t=i.innerOrder||kR,r=[];return e.forEach(function(o){Fm[o].forEach(function(n){n.name in s&&s[n.name]!=null?r.push(Va(o,n,s)):n.push in s&&s[n.push]!=null&&s[n.push].forEach(function(a){r.push(Va(o,n,a))})})}),s.media.forEach(function(o){r.push(Va("m",Fm.m[0],o)),t.forEach(function(n){Fm[n].forEach(function(a){a.name in o&&o[a.name]!=null?r.push(Va(n,a,o)):a.push in o&&o[a.push]!=null&&o[a.push].forEach(function(c){r.push(Va(n,a,c))})})})}),r.join(`\r `)+`\r `}});var Bm=Ki(kr=>{"use strict";var Zs=Sg(),wR=Ig();kr.write=wR;kr.parse=Zs.parse;kr.parseParams=Zs.parseParams;kr.parseFmtpConfig=Zs.parseFmtpConfig;kr.parsePayloads=Zs.parsePayloads;kr.parseRemoteCandidates=Zs.parseRemoteCandidates;kr.parseImageAttributes=Zs.parseImageAttributes;kr.parseSimulcastStreamList=Zs.parseSimulcastStreamList});import G8 from"webrtc-adapter";var ng=Ze(lt());var lp=(q=>(q[q.INVALID_PARAMETER=4096]="INVALID_PARAMETER",q[q.INVALID_OPERATION=4097]="INVALID_OPERATION",q[q.NOT_SUPPORTED=4098]="NOT_SUPPORTED",q[q.DEVICE_NOT_FOUND=4099]="DEVICE_NOT_FOUND",q[q.INITIALIZE_FAILED=4100]="INITIALIZE_FAILED",q[q.SIGNAL_CHANNEL_SETUP_FAILED=16385]="SIGNAL_CHANNEL_SETUP_FAILED",q[q.SIGNAL_CHANNEL_ERROR=16386]="SIGNAL_CHANNEL_ERROR",q[q.ICE_TRANSPORT_ERROR=16387]="ICE_TRANSPORT_ERROR",q[q.JOIN_ROOM_FAILED=16388]="JOIN_ROOM_FAILED",q[q.CREATE_OFFER_FAILED=16389]="CREATE_OFFER_FAILED",q[q.SIGNAL_CHANNEL_RECONNECTION_FAILED=16390]="SIGNAL_CHANNEL_RECONNECTION_FAILED",q[q.UPLINK_RECONNECTION_FAILED=16391]="UPLINK_RECONNECTION_FAILED",q[q.DOWNLINK_RECONNECTION_FAILED=16392]="DOWNLINK_RECONNECTION_FAILED",q[q.REMOTE_STREAM_NOT_EXIST=16400]="REMOTE_STREAM_NOT_EXIST",q[q.CLIENT_BANNED=16448]="CLIENT_BANNED",q[q.SERVER_TIMEOUT=16449]="SERVER_TIMEOUT",q[q.SUBSCRIPTION_TIMEOUT=16450]="SUBSCRIPTION_TIMEOUT",q[q.PLAY_NOT_ALLOWED=16451]="PLAY_NOT_ALLOWED",q[q.DEVICE_AUTO_RECOVER_FAILED=16452]="DEVICE_AUTO_RECOVER_FAILED",q[q.START_PUBLISH_CDN_FAILED=16453]="START_PUBLISH_CDN_FAILED",q[q.STOP_PUBLISH_CDN_FAILED=16454]="STOP_PUBLISH_CDN_FAILED",q[q.START_MIX_TRANSCODE_FAILED=16455]="START_MIX_TRANSCODE_FAILED",q[q.STOP_MIX_TRANSCODE_FAILED=16456]="STOP_MIX_TRANSCODE_FAILED",q[q.NOT_SUPPORTED_H264=16457]="NOT_SUPPORTED_H264",q[q.SWITCH_ROLE_FAILED=16458]="SWITCH_ROLE_FAILED",q[q.API_CALL_TIMEOUT=16459]="API_CALL_TIMEOUT",q[q.SCHEDULE_FAILED=16460]="SCHEDULE_FAILED",q[q.API_CALL_ABORTED=16461]="API_CALL_ABORTED",q[q.SPC_INITIALIZED_FAILED=16462]="SPC_INITIALIZED_FAILED",q[q.VIDEO_MANAGER_ERROR=16463]="VIDEO_MANAGER_ERROR",q[q.SWITCH_ROOM_FAILED=16464]="SWITCH_ROOM_FAILED",q[q.VIDEO_ENCODE_FAILED=16465]="VIDEO_ENCODE_FAILED",q[q.AUDIO_ENCODE_FAILED=16466]="AUDIO_ENCODE_FAILED",q[q.WHIP_REQUEST_FAILED=16467]="WHIP_REQUEST_FAILED",q[q.UNKNOWN=65535]="UNKNOWN",q))(lp||{}),I=lp;var lT=function(s){for(let i in I)if(I[i]===s)return i;return"UNKNOWN"},ls=class extends Error{constructor({name:e="RtcError",message:t,code:r=I.UNKNOWN,extraCode:o=0,constraint:n}){let a=`<${lT(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}},y=ls;var Za=0,up=!0,_n=function(s){Za=s;let i=new Date;i.setTime(i.getTime()+s),D[up?"info":"debug"](`baseTime from server: ${i} offset: ${s}`),up=!1},hp=function(){return Za},hi=function(){return Date.now()+Za},Ka=function(){let s=new Date;return s.setTime(hi()),s.toLocaleString()},tr=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}`},Bl=function(s){let i=new Date(performance.timeOrigin+s+Za);return tr(i)};var St={};er(St,{REPORT_TYPE:()=>So,buildSSOPackage:()=>ar,bytes2ms:()=>Cp,calculateScaleResolutionDownNumber:()=>To,concatArrayBuffers:()=>xp,convertObjectNumberToInt:()=>vn,copyProperties:()=>Ap,deepClone:()=>fs,deepCloneBasic:()=>pc,deepMerge:()=>Ti,delay:()=>rt,detectImageType:()=>Rc,fibonacci:()=>gs,formatedTime:()=>Op,getConstructorName:()=>mo,getContainerFromElement:()=>Pp,getEnv:()=>Sp,getFirst16Bits:()=>Vp,getInternalVersion:()=>Mp,getLast16Bits:()=>Up,getLoggerUrl:()=>nr,getMediaStreamTrackInfo:()=>Ic,getMuteStateFromFlag:()=>Lt,getNetworkType:()=>_c,getNumNetworkType:()=>_s,getReconnectionTimeout:()=>gi,getStringByteLength:()=>bn,getTestSignalDomain:()=>Ep,getTurnServer:()=>wp,getUint32Version:()=>Tc,getValueType:()=>Ue,getVersionFromInternalVersion:()=>kp,getViewListFromView:()=>_o,glog:()=>pu,ipv4ToUint32:()=>fo,isArray:()=>ve,isAudioWorkletSupported:()=>Dp,isBoolean:()=>fe,isConstructor:()=>Ts,isEmpty:()=>po,isFunction:()=>Te,isLangChinese:()=>_i,isMediaStreamTrack:()=>bp,isNumber:()=>ie,isObject:()=>At,isOverseaSdkAppId:()=>Ot,isPlainObject:()=>Tt,isPortrait:()=>fu,isPromise:()=>Br,isRemoteTrack:()=>vp,isRotate90Or270:()=>$t,isSameSubnet:()=>fc,isSetSinkIdSupported:()=>Np,isString:()=>le,isUndefined:()=>E,isValidIP:()=>ho,isVideoMixerOutputTrack:()=>cr,loadImage:()=>go,loadVideo:()=>Lp,ms2bytes:()=>yp,ms2samples:()=>mu,normalizeUrl:()=>Ec,performanceNow:()=>O,promiseAny:()=>Ss,samples2ms:()=>hu,setNetworkTypeFromWebRTC:()=>gc,stringify:()=>Pt,stringifyIncludeValue:()=>yn,throttlePromise:()=>Sc});var iu={};er(iu,{ASR_ROBOT_FROM_TYPE:()=>ao,AUDIO_MUTE_BIT:()=>nc,AUDIO_STAT_BIT:()=>Vr,AUX_STAT_BIT:()=>hs,AUX_STREAM_MSID:()=>zl,BACKEND_ENV:()=>oc,BASE_DOC_URL:()=>wt,BASE_HOST:()=>mp,CAPABILITIES_KEYS:()=>lc,CLASS_NAME:()=>wT,CLOUD_CONSOLE_URL:()=>pT,CROSS_ROOM_BIT:()=>Jl,DATA_CHANNEL_FROM_TYPE_BIT:()=>jl,DATA_FREEZE_TIMING:()=>cc,DOC_BILLING_CN:()=>ec,DOC_BILLING_OVERSEA:()=>tc,DOC_URL:()=>fT,DTLS_STATE_UNKNOWN:()=>fi,ENV_NAME:()=>ir,EXCHANGE_SDP_TIMEOUT:()=>Kl,IS_WORKER:()=>io,IS_WORKLET:()=>gn,KIBANA_EVENT:()=>Ae,LOCAL_STREAM_PUBLISH_STATE:()=>fp,LOGGER_CMD_TYPE:()=>Lr,LOGGER_DOMAIN:()=>Hl,LOGGER_DOMAIN_OVERSEA:()=>Wl,LOG_LEVEL:()=>mi,LOG_LEVEL_NAME:()=>OT,MAIN_STREAM_MSID:()=>En,MAX_RTT:()=>An,MICROPHONE_COMMUNICATIONS:()=>PT,MICROPHONE_DEFAULT:()=>ps,MUTE_ALL_BIT:()=>TT,NAME:()=>_,NETWORK_TYPE:()=>ic,NOT_SUPPORTED_H264:()=>ms,PAUSED_RETRY_COUNT:()=>or,PEERCONNECTION_CONNECTING_TIMEOUT:()=>In,PEER_CONNECTION_STATE:()=>Me,PEER_LEAVE_REASON:()=>eu,RECOVER_CAPTURE_INTERVAL:()=>no,REMOTE_STREAM_TYPE_AUX:()=>Xl,REMOTE_STREAM_TYPE_MAIN:()=>Ql,RENDER_FREEZE_TIMING:()=>DT,SCHEDULE_DOMAIN:()=>sr,SCHEDULE_TIMEOUT:()=>kT,SDP_SEMANTICS_PLAN_B:()=>so,SDP_SEMANTICS_UNIFIED_PLAN:()=>Fr,SECOND_HOST:()=>hT,SIGNAL_DOMAIN:()=>dc,SIGNAL_PING_PONG_INTERVAL:()=>gT,SIGNAL_PING_TIMEOUT:()=>_T,SIGNAL_RECONNECTION_COUNT:()=>bT,SMALL_STAT_BIT:()=>Sn,SPEAKER_DEFAULT:()=>Rn,STORAGE_EXPIRES_TIME:()=>rc,STREAM_TYPE_BIG:()=>NT,STREAM_TYPE_SMALL:()=>MT,SUBSCRIBE_SMALL_RETRY_COUNT:()=>oo,SYNC_USER_LIST_INTERVAL:()=>vT,Scene:()=>Ui,THIRD_HOST:()=>mT,TRANSPORT_DIRECTION:()=>ue,TRTC_ERROR_ASSISTANCE:()=>Gl,TRTC_QUALITY_BAD:()=>AT,TRTC_QUALITY_DISCONNECTED:()=>yT,TRTC_QUALITY_EXCELLENT:()=>ET,TRTC_QUALITY_GOOD:()=>IT,TRTC_QUALITY_POOR:()=>RT,TRTC_QUALITY_UNKNOWN:()=>ST,TRTC_QUALITY_VERY_BAD:()=>CT,UPDATE_OFFER_TIMEOUT:()=>Zl,VIDEO_MUTE_BIT:()=>ac,VIDEO_STAT_BIT:()=>Ur,WEBGL_ATTRIBUTES:()=>tu,audioProfileMap:()=>sc,defaultBigVideoProfile:()=>xr,defaultSmallVideoProfile:()=>ql,getRetryCount:()=>rr,getScriptDir:()=>uT,innerVersion:()=>to,loggerProxy:()=>Tn,screenProfileMap:()=>ro,setLoggerProxy:()=>us,setRetryCount:()=>Yl,setVersion:()=>$l,version:()=>Ke,videoProfileMap:()=>pi});var to="4.15.00.1600",Ke="5.0.0";function $l(s){Ke=s;let[i,e,t]=s.split(".").map(r=>parseInt(r,10));to=`${i}.${Math.min(15,e)}.${Math.min(15,t)}.${e.toString().padStart(2,"0")}${t.toString().padStart(2,"0")}`}var io=typeof importScripts!="undefined",gn=typeof registerProcessor!="undefined",uT=()=>{let s=io?self.location.href:document.currentScript.src;return s.substring(0,s.lastIndexOf("/")+1)},Tn="",us=s=>Tn=s,mp="web.sdk.qcloud.com",hT="web.sdk.tencent.cn",mT="web.sdk.cloud.tencent.cn",pT="https://console.cloud.tencent.com/trtc",wt=`https://${mp}/trtc/webrtc/doc`,fT=`${wt}/zh-cn/`,ec="https://cloud.tencent.com/document/product/647/85386",tc="https://trtc.io/document/56025",Hl="https://yun.tim.qq.com",Wl="https://apisgp.my-imcloud.com",Gl="trtc_error_assistance",Lr={LOG:"jssdk_log",EVENT:"jssdk_event",KEY_POINT:"jssdk_new_endreport",KV_STAT:"jssdk_key_metrics_report"},ir={QCLOUD:"qcloud",OLD_CLOUD_LADDER:"trtc",WEBRTC:"webrtc"},mi=(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))(mi||{}),_T=18e3,gT=2e3,ic={unknown:0,wifi:1,"4g":2,"3g":3,"2g":4,wired:5,"5g":6},rc=168*3600*1e3,sc={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}},pi={"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}},xr=pi["480p_2"],ql=pi["120p_2"],ro={"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"},ue={INACTIVE:"inactive",SENDONLY:"sendonly",RECVONLY:"recvonly"},oc={OLD_CLOUD_LADDER:"wss://trtc.rtc.qq.com",WEBRTC:"wss://webrtc.qq.com"},Ui=(e=>(e.LIVE="live",e.RTC="rtc",e))(Ui||{}),Ur=1,Sn=2,hs=4,Vr=8,nc=64,ac=16,TT=112,Jl=128,jl=256,En="5Y2wZK8nANNAoVw6dSAHVjNxrD1ObBM2kBPV",zl="224d130c-7b5c-415b-aaa2-79c2eb5a6df2",Ql=_.MAIN,Xl=_.AUXILIARY,ST=0,ET=1,IT=2,RT=3,AT=4,CT=5,yT=6,fi="unknown",Me={NEW:"new",CONNECTING:"connecting",FAILED:"failed",CLOSED:"closed",DISCONNECTED:"disconnected",CONNECTED:"connected",COMPLETED:"completed"},pp=1/0;function Yl(s){pp=s}function rr(){return pp}var bT=30,Ae={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",AUDIO_COMBINE_FAILED_DURING_CALL:"audio-combine-failed-during-call",AUDIO_COMBINE_RESUME_DURING_CALL:"audio-combine-resume-during-call",VIDEO_COMBINE_FAILED_DURING_CALL:"video-combine-failed-during-call",VIDEO_COMBINE_RESUME_DURING_CALL:"video-combine-resume-during-call",AUDIO_UPLINK_SILENT_DURING_CALL:"audio-uplink-silent-during-call",AUDIO_UPLINK_SILENT_RESUME_DURING_CALL:"audio-uplink-silent-resume-during-call"},vT=1e4,Zl=1e4,Kl=1e4,Fr="unified-plan",so="plan-b",ms=1028,fp=(t=>(t[t.UNPUBLISH=-1]="UNPUBLISH",t[t.PUBLISHING=0]="PUBLISHING",t[t.PUBLISHED=1]="PUBLISHED",t))(fp||{}),cc=500,DT=1e3,NT=_.BIG,MT=_.SMALL,In=10*1e3,sr={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"},dc={MAIN_OVERSEA:"signaling.rtc-web.com",BACKUP_OVERSEA:"signaling.rtc-web.io"},kT=2e3,wT={TRTC:"TRTC",CLIENT:"Client",LOCAL_STREAM:"LocalStream",REMOTE_STREAM:"RemoteStream",STREAM:"Stream"},or=5,ps="default",Rn=ps,PT="communications",OT=Object.keys(mi),eu=["normal leave","timeout leave","kick","role change"],oo=10,no=2e3,lc=["width","height","frameRate","facingMode","sampleRate","sampleSize","channelCount","deviceId","min","max"],An=10*1e3,ao=14,tu={alpha:!0,antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:!1,depth:!1,stencil:!1,failIfMajorPerformanceCaveat:!0,powerPreference:"low-power"};var LT=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())})},ru=Symbol(32),su=Symbol(16),ou=Symbol(8),Vi=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 LT(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(ru)}readU16(){return this.read(su)}readU8(){return this.read(ou)}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===ru){if(r(4))return;i=e[0]<<24|e[1]<<16|e[2]<<8|e[3]}else if(this.need===su){if(r(2))return;i=e[0]<<8|e[1]}else if(this.need===ou){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}};Vi.U32=ru;Vi.U16=su;Vi.U8=ou;var xT=128,UT=127,IA=~UT,RA=Math.pow(2,31);function nu(s){let i=new Vi;for(;s>=128;)i.malloc(1)[0]=s&255|xT,s>>>=7;return i.malloc(1)[0]=s&255,i.buffer||new Uint8Array(0)}function uc(s,i=0){let e=new Vi,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(nu(s));break;case"string":e.malloc(1)[0]=t|2;let o=new TextEncoder().encode(s);e.write(nu(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 Vi;if(Array.isArray(s))for(let c=0;c<s.length;c++){let l=uc(s[c],c+1);l&&a.write(l)}else{let c=1;for(let l in s){let u=uc(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(nu(a.buffer.length)),e.write(a.buffer)))}return e.buffer||new Uint8Array(0)}var Cn=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 au(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 gt(s,i){return s[i]<<24|s[i+1]<<16|s[i+2]<<8|s[i+3]}function cu(s,i){return s[i]}function co(s,i,e){return new TextDecoder().decode(VT(s,i,e))}function VT(s,i,e){return s.slice(i,i+e)}var du=0,hc=2654435769,mc=16,uu=4,lo=2,uo=7;function FT(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 Cn,t=FT(i,s,du);du=du+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 Cn;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 L=4;L<16;L++)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,le(s)&&(s=new TextEncoder().encode(s)),n.writeInt32(s.length+4),s.length&&n.writeBytes(s);let T=new Uint8Array(n.data),S=null;t.encryption===1?S=new TextEncoder().encode(t.uin):t.encryption===2&&(S=new Uint8Array(16)),S&&(T=BT(T,S)),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 BT(s,i){let e=s.length,r=(e+1+lo+uo)%8;r&&(r=8-r);let o=e+1+lo+uo+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<lo;)if(h<8&&(c[h]=Math.floor(Math.random()*256)&255,h+=1,p+=1),h===8){lu(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){lu(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<uo;)if(h<8&&(c[h]=0,h+=1,p+=1),h===8){lu(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 lu(s,i,e,t,r,o){for(let n=0;n<8;n++)s[n]^=t[n];$T(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 $T(s,i,e,t){let r=gt(s,0),o=gt(s,4),n=[];for(let c=0;c<4;c++)n[c]=gt(i,c*4);let a=0;for(let c=0;c<mc;c++)a+=hc,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;au(e,r,t),au(e,o,t+4)}function ho(s){return s?!!(/^\d{1,3}(\.\d{1,3}){3}$/.test(s)||s.includes(":")&&/^[0-9a-fA-F:]+$/.test(s)):!1}function fc(s,i){if(!ho(s)||!ho(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")||""},HT=".rtc.qq.com",Ep=function(s){return s.includes(".")?s:`${s}${HT}`},Ot=s=>Number(s)<14e8,nr=function(s,i){let e;Tn?e=Tn:e=Ot(s)?Wl:Hl;let t=Math.floor(Math.random()*Or(2,31));return`${e}/v5/AVQualityReportSvc/C2S?random=${t}&sdkappid=${s}&cmdtype=${i}`},Ip="unknown";function _c(){GT();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 WT(){D.warn("netType changed",_c())}var gp=!1;function GT(){var s;if(!gp){gp=!0;try{(s=navigator.connection)==null||s.addEventListener("typechange",WT)}catch(i){}}}function Rp(s,i){if(ic[s])return s;switch(s){case"cellular":case"wimax":return i||"unknown";case"ethernet":return"wired";case"none":case"other":default:return"unknown"}}function gc(s){Ip=Rp(s)}function _s(){return ic[_c()]}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 hu(s/4,i)}function hu(s,i=48e3){return s*1e3/i}function yp(s,i=48e3){return mu(s,i)*4}function mu(s,i=48e3){return s*i/1e3}var pu=typeof window!="undefined"&&typeof window.glog=="function"?window.glog:()=>{},_i=()=>{let s=navigator.language;return s=s.substring(0,2),s==="zh"},Tt=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 gs(s,i=1,e=1){return s<=1?e:gs(s-1,e,i+e)}function gi(s){return s>8?30*1e3:gs(s)*1e3}function Ue(s){return Reflect.apply(Object.prototype.toString,s,[]).replace(/^\[object\s(\w+)\]$/,"$1").toLowerCase()}var Te=s=>typeof s=="function",E=s=>typeof s=="undefined",le=s=>typeof s=="string",ie=s=>typeof s=="number",fe=s=>typeof s=="boolean",At=s=>Ue(s)==="object",ve=s=>Ue(s)==="array",bp=s=>Ue(s)==="MediaStreamTrack".toLowerCase(),vp=s=>s.isRemote,Br=s=>Ue(s)==="promise",Ts=s=>Te(s)&&s.prototype.constructor===s,mo=s=>Ts(s)?s.prototype.constructor.name:"",Dp=typeof AudioWorkletNode!="undefined",Np=typeof HTMLMediaElement!="undefined"&&"setSinkId"in HTMLMediaElement.prototype;function Ss(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 O(){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];i