TrtcWrapper.2.0.0-dev.0.0.2.bundle.js 655 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546
  1. (function webpackUniversalModuleDefinition(root, factory) {
  2. if(typeof exports === 'object' && typeof module === 'object')
  3. module.exports = factory();
  4. else if(typeof define === 'function' && define.amd)
  5. define([], factory);
  6. else if(typeof exports === 'object')
  7. exports["TrtcWrapper"] = factory();
  8. else
  9. root["TrtcWrapper"] = factory();
  10. })(self, () => {
  11. return /******/ (() => { // webpackBootstrap
  12. /******/ var __webpack_modules__ = ({
  13. /***/ 134:
  14. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  15. !function(t,e){ true?module.exports=e(__webpack_require__(24)):0}(this,(function(t){function e(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(s){return void r(s)}u.done?e(c):Promise.resolve(c).then(n,o)}function r(t){return function(){var r=this,n=arguments;return new Promise((function(o,i){var a=t.apply(r,n);function u(t){e(a,o,i,u,c,"next",t)}function c(t){e(a,o,i,u,c,"throw",t)}u(void 0)}))}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function i(t,e,r){return e&&o(t.prototype,e),r&&o(t,r),t}t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t;var a=function(t){try{return!!t()}catch(e){return!0}},u={}.toString,c=function(t){return u.call(t).slice(8,-1)},s="".split,f=a((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==c(t)?s.call(t,""):Object(t)}:Object,l=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},d=function(t){return f(l(t))},h="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof __webpack_require__.g?__webpack_require__.g:"undefined"!=typeof self?self:{};function p(t,e){return t(e={exports:{}},e.exports),e.exports}var v,y,g=function(t){return t&&t.Math==Math&&t},m=g("object"==typeof globalThis&&globalThis)||g("object"==typeof window&&window)||g("object"==typeof self&&self)||g("object"==typeof h&&h)||function(){return this}()||Function("return this")(),w=function(t,e){try{Object.defineProperty(m,t,{value:e,configurable:!0,writable:!0})}catch(r){m[t]=e}return e},x=m["__core-js_shared__"]||w("__core-js_shared__",{}),b=p((function(t){(t.exports=function(t,e){return x[t]||(x[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.16.0",mode:"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})})),E=function(t){return Object(l(t))},S={}.hasOwnProperty,k=Object.hasOwn||function(t,e){return S.call(E(t),e)},O=0,T=Math.random(),A=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++O+T).toString(36)},j=function(t){return"function"==typeof t?t:void 0},_=function(t,e){return arguments.length<2?j(m[t]):m[t]&&m[t][e]},L=_("navigator","userAgent")||"",I=m.process,P=m.Deno,M=I&&I.versions||P&&P.version,R=M&&M.v8;R?y=(v=R.split("."))[0]<4?1:v[0]+v[1]:L&&(!(v=L.match(/Edge\/(\d+)/))||v[1]>=74)&&(v=L.match(/Chrome\/(\d+)/))&&(y=v[1]);var C,F=y&&+y,N=!!Object.getOwnPropertySymbols&&!a((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&F&&F<41})),D=N&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,z=b("wks"),G=m.Symbol,W=D?G:G&&G.withoutSetter||A,B=function(t){return k(z,t)&&(N||"string"==typeof z[t])||(N&&k(G,t)?z[t]=G[t]:z[t]=W("Symbol."+t)),z[t]},V=function(t){return"object"==typeof t?null!==t:"function"==typeof t},U=function(t){if(!V(t))throw TypeError(String(t)+" is not an object");return t},Y=!a((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),K=m.document,H=V(K)&&V(K.createElement),Q=function(t){return H?K.createElement(t):{}},$=!Y&&!a((function(){return 7!=Object.defineProperty(Q("div"),"a",{get:function(){return 7}}).a})),q=D?function(t){return"symbol"==typeof t}:function(t){var e=_("Symbol");return"function"==typeof e&&Object(t)instanceof e},X=B("toPrimitive"),J=function(t,e){if(!V(t)||q(t))return t;var r,n=t[X];if(void 0!==n){if(void 0===e&&(e="default"),r=n.call(t,e),!V(r)||q(r))return r;throw TypeError("Can't convert object to primitive value")}return void 0===e&&(e="number"),function(t,e){var r,n;if("string"===e&&"function"==typeof(r=t.toString)&&!V(n=r.call(t)))return n;if("function"==typeof(r=t.valueOf)&&!V(n=r.call(t)))return n;if("string"!==e&&"function"==typeof(r=t.toString)&&!V(n=r.call(t)))return n;throw TypeError("Can't convert object to primitive value")}(t,e)},Z=function(t){var e=J(t,"string");return q(e)?e:String(e)},tt=Object.defineProperty,et={f:Y?tt:function(t,e,r){if(U(t),e=Z(e),U(r),$)try{return tt(t,e,r)}catch(n){}if("get"in r||"set"in r)throw TypeError("Accessors not supported");return"value"in r&&(t[e]=r.value),t}},rt=Math.ceil,nt=Math.floor,ot=function(t){return isNaN(t=+t)?0:(t>0?nt:rt)(t)},it=Math.min,at=function(t){return t>0?it(ot(t),9007199254740991):0},ut=Math.max,ct=Math.min,st=function(t){return function(e,r,n){var o,i=d(e),a=at(i.length),u=function(t,e){var r=ot(t);return r<0?ut(r+e,0):ct(r,e)}(n,a);if(t&&r!=r){for(;a>u;)if((o=i[u++])!=o)return!0}else for(;a>u;u++)if((t||u in i)&&i[u]===r)return t||u||0;return!t&&-1}},ft={includes:st(!0),indexOf:st(!1)},lt={},dt=ft.indexOf,ht=function(t,e){var r,n=d(t),o=0,i=[];for(r in n)!k(lt,r)&&k(n,r)&&i.push(r);for(;e.length>o;)k(n,r=e[o++])&&(~dt(i,r)||i.push(r));return i},pt=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],vt=Object.keys||function(t){return ht(t,pt)},yt=Y?Object.defineProperties:function(t,e){U(t);for(var r,n=vt(e),o=n.length,i=0;o>i;)et.f(t,r=n[i++],e[r]);return t},gt=_("document","documentElement"),mt=b("keys"),wt=function(t){return mt[t]||(mt[t]=A(t))},xt=wt("IE_PROTO"),bt=function(){},Et=function(t){return"<script>"+t+"<\/script>"},St=function(t){t.write(Et("")),t.close();var e=t.parentWindow.Object;return t=null,e},kt=function(){try{C=new ActiveXObject("htmlfile")}catch(e){}kt=document.domain&&C?St(C):function(){var t,e=Q("iframe");if(e.style)return e.style.display="none",gt.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write(Et("document.F=Object")),t.close(),t.F}()||St(C);for(var t=pt.length;t--;)delete kt.prototype[pt[t]];return kt()};lt[xt]=!0;var Ot=Object.create||function(t,e){var r;return null!==t?(bt.prototype=U(t),r=new bt,bt.prototype=null,r[xt]=t):r=kt(),void 0===e?r:yt(r,e)},Tt=B("unscopables"),At=Array.prototype;null==At[Tt]&&et.f(At,Tt,{configurable:!0,value:Ot(null)});var jt=function(t){At[Tt][t]=!0},_t={},Lt=Function.toString;"function"!=typeof x.inspectSource&&(x.inspectSource=function(t){return Lt.call(t)});var It,Pt,Mt,Rt=x.inspectSource,Ct=m.WeakMap,Ft="function"==typeof Ct&&/native code/.test(Rt(Ct)),Nt=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},Dt=Y?function(t,e,r){return et.f(t,e,Nt(1,r))}:function(t,e,r){return t[e]=r,t},zt=m.WeakMap;if(Ft||x.state){var Gt=x.state||(x.state=new zt),Wt=Gt.get,Bt=Gt.has,Vt=Gt.set;It=function(t,e){if(Bt.call(Gt,t))throw new TypeError("Object already initialized");return e.facade=t,Vt.call(Gt,t,e),e},Pt=function(t){return Wt.call(Gt,t)||{}},Mt=function(t){return Bt.call(Gt,t)}}else{var Ut=wt("state");lt[Ut]=!0,It=function(t,e){if(k(t,Ut))throw new TypeError("Object already initialized");return e.facade=t,Dt(t,Ut,e),e},Pt=function(t){return k(t,Ut)?t[Ut]:{}},Mt=function(t){return k(t,Ut)}}var Yt,Kt,Ht,Qt={set:It,get:Pt,has:Mt,enforce:function(t){return Mt(t)?Pt(t):It(t,{})},getterFor:function(t){return function(e){var r;if(!V(e)||(r=Pt(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return r}}},$t={}.propertyIsEnumerable,qt=Object.getOwnPropertyDescriptor,Xt={f:qt&&!$t.call({1:2},1)?function(t){var e=qt(this,t);return!!e&&e.enumerable}:$t},Jt=Object.getOwnPropertyDescriptor,Zt={f:Y?Jt:function(t,e){if(t=d(t),e=Z(e),$)try{return Jt(t,e)}catch(r){}if(k(t,e))return Nt(!Xt.f.call(t,e),t[e])}},te=p((function(t){var e=Qt.get,r=Qt.enforce,n=String(String).split("String");(t.exports=function(t,e,o,i){var a,u=!!i&&!!i.unsafe,c=!!i&&!!i.enumerable,s=!!i&&!!i.noTargetGet;"function"==typeof o&&("string"!=typeof e||k(o,"name")||Dt(o,"name",e),(a=r(o)).source||(a.source=n.join("string"==typeof e?e:""))),t!==m?(u?!s&&t[e]&&(c=!0):delete t[e],c?t[e]=o:Dt(t,e,o)):c?t[e]=o:w(e,o)})(Function.prototype,"toString",(function(){return"function"==typeof this&&e(this).source||Rt(this)}))})),ee=pt.concat("length","prototype"),re={f:Object.getOwnPropertyNames||function(t){return ht(t,ee)}},ne={f:Object.getOwnPropertySymbols},oe=_("Reflect","ownKeys")||function(t){var e=re.f(U(t)),r=ne.f;return r?e.concat(r(t)):e},ie=function(t,e){for(var r=oe(e),n=et.f,o=Zt.f,i=0;i<r.length;i++){var a=r[i];k(t,a)||n(t,a,o(e,a))}},ae=/#|\.prototype\./,ue=function(t,e){var r=se[ce(t)];return r==le||r!=fe&&("function"==typeof e?a(e):!!e)},ce=ue.normalize=function(t){return String(t).replace(ae,".").toLowerCase()},se=ue.data={},fe=ue.NATIVE="N",le=ue.POLYFILL="P",de=ue,he=Zt.f,pe=function(t,e){var r,n,o,i,a,u=t.target,c=t.global,s=t.stat;if(r=c?m:s?m[u]||w(u,{}):(m[u]||{}).prototype)for(n in e){if(i=e[n],o=t.noTargetGet?(a=he(r,n))&&a.value:r[n],!de(c?n:u+(s?".":"#")+n,t.forced)&&void 0!==o){if(typeof i==typeof o)continue;ie(i,o)}(t.sham||o&&o.sham)&&Dt(i,"sham",!0),te(r,n,i,t)}},ve=!a((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})),ye=wt("IE_PROTO"),ge=Object.prototype,me=ve?Object.getPrototypeOf:function(t){return t=E(t),k(t,ye)?t[ye]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?ge:null},we=B("iterator"),xe=!1;[].keys&&("next"in(Ht=[].keys())?(Kt=me(me(Ht)))!==Object.prototype&&(Yt=Kt):xe=!0),(null==Yt||a((function(){var t={};return Yt[we].call(t)!==t})))&&(Yt={}),k(Yt,we)||Dt(Yt,we,(function(){return this}));var be={IteratorPrototype:Yt,BUGGY_SAFARI_ITERATORS:xe},Ee=et.f,Se=B("toStringTag"),ke=function(t,e,r){t&&!k(t=r?t:t.prototype,Se)&&Ee(t,Se,{configurable:!0,value:e})},Oe=be.IteratorPrototype,Te=function(){return this},Ae=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,r={};try{(t=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(r,[]),e=r instanceof Array}catch(n){}return function(r,n){return U(r),function(t){if(!V(t)&&null!==t)throw TypeError("Can't set "+String(t)+" as a prototype")}(n),e?t.call(r,n):r.__proto__=n,r}}():void 0),je=be.IteratorPrototype,_e=be.BUGGY_SAFARI_ITERATORS,Le=B("iterator"),Ie=function(){return this},Pe=function(t,e,r,n,o,i,a){!function(t,e,r){var n=e+" Iterator";t.prototype=Ot(Oe,{next:Nt(1,r)}),ke(t,n,!1),_t[n]=Te}(r,e,n);var u,c,s,f=function(t){if(t===o&&v)return v;if(!_e&&t in h)return h[t];switch(t){case"keys":case"values":case"entries":return function(){return new r(this,t)}}return function(){return new r(this)}},l=e+" Iterator",d=!1,h=t.prototype,p=h[Le]||h["@@iterator"]||o&&h[o],v=!_e&&p||f(o),y="Array"==e&&h.entries||p;if(y&&(u=me(y.call(new t)),je!==Object.prototype&&u.next&&(me(u)!==je&&(Ae?Ae(u,je):"function"!=typeof u[Le]&&Dt(u,Le,Ie)),ke(u,l,!0))),"values"==o&&p&&"values"!==p.name&&(d=!0,v=function(){return p.call(this)}),h[Le]!==v&&Dt(h,Le,v),_t[e]=v,o)if(c={values:f("values"),keys:i?v:f("keys"),entries:f("entries")},a)for(s in c)(_e||d||!(s in h))&&te(h,s,c[s]);else pe({target:e,proto:!0,forced:_e||d},c);return c},Me=Qt.set,Re=Qt.getterFor("Array Iterator"),Ce=Pe(Array,"Array",(function(t,e){Me(this,{type:"Array Iterator",target:d(t),index:0,kind:e})}),(function(){var t=Re(this),e=t.target,r=t.kind,n=t.index++;return!e||n>=e.length?(t.target=void 0,{value:void 0,done:!0}):"keys"==r?{value:n,done:!1}:"values"==r?{value:e[n],done:!1}:{value:[n,e[n]],done:!1}}),"values");_t.Arguments=_t.Array,jt("keys"),jt("values"),jt("entries");var Fe=re.f,Ne={}.toString,De="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],ze={f:function(t){return De&&"[object Window]"==Ne.call(t)?function(t){try{return Fe(t)}catch(e){return De.slice()}}(t):Fe(d(t))}},Ge=!a((function(){return Object.isExtensible(Object.preventExtensions({}))})),We=p((function(t){var e=et.f,r=!1,n=A("meta"),o=0,i=Object.isExtensible||function(){return!0},a=function(t){e(t,n,{value:{objectID:"O"+o++,weakData:{}}})},u=t.exports={enable:function(){u.enable=function(){},r=!0;var t=re.f,e=[].splice,o={};o[n]=1,t(o).length&&(re.f=function(r){for(var o=t(r),i=0,a=o.length;i<a;i++)if(o[i]===n){e.call(o,i,1);break}return o},pe({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:ze.f}))},fastKey:function(t,e){if(!V(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!k(t,n)){if(!i(t))return"F";if(!e)return"E";a(t)}return t[n].objectID},getWeakData:function(t,e){if(!k(t,n)){if(!i(t))return!0;if(!e)return!1;a(t)}return t[n].weakData},onFreeze:function(t){return Ge&&r&&i(t)&&!k(t,n)&&a(t),t}};lt[n]=!0})),Be=(We.enable,We.fastKey,We.getWeakData,We.onFreeze,B("iterator")),Ve=Array.prototype,Ue=function(t,e,r){if(function(t){if("function"!=typeof t)throw TypeError(String(t)+" is not a function")}(t),void 0===e)return t;switch(r){case 0:return function(){return t.call(e)};case 1:return function(r){return t.call(e,r)};case 2:return function(r,n){return t.call(e,r,n)};case 3:return function(r,n,o){return t.call(e,r,n,o)}}return function(){return t.apply(e,arguments)}},Ye={};Ye[B("toStringTag")]="z";var Ke="[object z]"===String(Ye),He=B("toStringTag"),Qe="Arguments"==c(function(){return arguments}()),$e=Ke?c:function(t){var e,r,n;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(r=function(t,e){try{return t[e]}catch(r){}}(e=Object(t),He))?r:Qe?c(e):"Object"==(n=c(e))&&"function"==typeof e.callee?"Arguments":n},qe=B("iterator"),Xe=function(t){var e=t.return;if(void 0!==e)return U(e.call(t)).value},Je=function(t,e){this.stopped=t,this.result=e},Ze=function(t,e,r){var n,o,i,a,u,c,s,f,l=r&&r.that,d=!(!r||!r.AS_ENTRIES),h=!(!r||!r.IS_ITERATOR),p=!(!r||!r.INTERRUPTED),v=Ue(e,l,1+d+p),y=function(t){return n&&Xe(n),new Je(!0,t)},g=function(t){return d?(U(t),p?v(t[0],t[1],y):v(t[0],t[1])):p?v(t,y):v(t)};if(h)n=t;else{if("function"!=typeof(o=function(t){if(null!=t)return t[qe]||t["@@iterator"]||_t[$e(t)]}(t)))throw TypeError("Target is not iterable");if(void 0!==(f=o)&&(_t.Array===f||Ve[Be]===f)){for(i=0,a=at(t.length);a>i;i++)if((u=g(t[i]))&&u instanceof Je)return u;return new Je(!1)}n=o.call(t)}for(c=n.next;!(s=c.call(n)).done;){try{u=g(s.value)}catch(m){throw Xe(n),m}if("object"==typeof u&&u&&u instanceof Je)return u}return new Je(!1)},tr=function(t,e,r){if(!(t instanceof e))throw TypeError("Incorrect "+(r?r+" ":"")+"invocation");return t},er=B("iterator"),rr=!1;try{var nr=0,or={next:function(){return{done:!!nr++}},return:function(){rr=!0}};or[er]=function(){return this},Array.from(or,(function(){throw 2}))}catch(xo){}var ir=function(t,e,r){for(var n in e)te(t,n,e[n],r);return t},ar=B("species"),ur=et.f,cr=We.fastKey,sr=Qt.set,fr=Qt.getterFor,lr=(function(t,e,r){var n=-1!==t.indexOf("Map"),o=-1!==t.indexOf("Weak"),i=n?"set":"add",u=m[t],c=u&&u.prototype,s=u,f={},l=function(t){var e=c[t];te(c,t,"add"==t?function(t){return e.call(this,0===t?0:t),this}:"delete"==t?function(t){return!(o&&!V(t))&&e.call(this,0===t?0:t)}:"get"==t?function(t){return o&&!V(t)?void 0:e.call(this,0===t?0:t)}:"has"==t?function(t){return!(o&&!V(t))&&e.call(this,0===t?0:t)}:function(t,r){return e.call(this,0===t?0:t,r),this})};if(de(t,"function"!=typeof u||!(o||c.forEach&&!a((function(){(new u).entries().next()})))))s=r.getConstructor(e,t,n,i),We.enable();else if(de(t,!0)){var d=new s,h=d[i](o?{}:-0,1)!=d,p=a((function(){d.has(1)})),v=function(t,e){if(!e&&!rr)return!1;var r=!1;try{var n={};n[er]=function(){return{next:function(){return{done:r=!0}}}},t(n)}catch(xo){}return r}((function(t){new u(t)})),y=!o&&a((function(){for(var t=new u,e=5;e--;)t[i](e,e);return!t.has(-0)}));v||((s=e((function(e,r){tr(e,s,t);var o=function(t,e,r){var n,o;return Ae&&"function"==typeof(n=e.constructor)&&n!==r&&V(o=n.prototype)&&o!==r.prototype&&Ae(t,o),t}(new u,e,s);return null!=r&&Ze(r,o[i],{that:o,AS_ENTRIES:n}),o}))).prototype=c,c.constructor=s),(p||y)&&(l("delete"),l("has"),n&&l("get")),(y||h)&&l(i),o&&c.clear&&delete c.clear}f[t]=s,pe({global:!0,forced:s!=u},f),ke(s,t),o||r.setStrong(s,t,n)}("Map",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),{getConstructor:function(t,e,r,n){var o=t((function(t,i){tr(t,o,e),sr(t,{type:e,index:Ot(null),first:void 0,last:void 0,size:0}),Y||(t.size=0),null!=i&&Ze(i,t[n],{that:t,AS_ENTRIES:r})})),i=fr(e),a=function(t,e,r){var n,o,a=i(t),c=u(t,e);return c?c.value=r:(a.last=c={index:o=cr(e,!0),key:e,value:r,previous:n=a.last,next:void 0,removed:!1},a.first||(a.first=c),n&&(n.next=c),Y?a.size++:t.size++,"F"!==o&&(a.index[o]=c)),t},u=function(t,e){var r,n=i(t),o=cr(e);if("F"!==o)return n.index[o];for(r=n.first;r;r=r.next)if(r.key==e)return r};return ir(o.prototype,{clear:function(){for(var t=i(this),e=t.index,r=t.first;r;)r.removed=!0,r.previous&&(r.previous=r.previous.next=void 0),delete e[r.index],r=r.next;t.first=t.last=void 0,Y?t.size=0:this.size=0},delete:function(t){var e=i(this),r=u(this,t);if(r){var n=r.next,o=r.previous;delete e.index[r.index],r.removed=!0,o&&(o.next=n),n&&(n.previous=o),e.first==r&&(e.first=n),e.last==r&&(e.last=o),Y?e.size--:this.size--}return!!r},forEach:function(t){for(var e,r=i(this),n=Ue(t,arguments.length>1?arguments[1]:void 0,3);e=e?e.next:r.first;)for(n(e.value,e.key,this);e&&e.removed;)e=e.previous},has:function(t){return!!u(this,t)}}),ir(o.prototype,r?{get:function(t){var e=u(this,t);return e&&e.value},set:function(t,e){return a(this,0===t?0:t,e)}}:{add:function(t){return a(this,t=0===t?0:t,t)}}),Y&&ur(o.prototype,"size",{get:function(){return i(this).size}}),o},setStrong:function(t,e,r){var n=e+" Iterator",o=fr(e),i=fr(n);Pe(t,e,(function(t,e){sr(this,{type:n,target:t,state:o(t),kind:e,last:void 0})}),(function(){for(var t=i(this),e=t.kind,r=t.last;r&&r.removed;)r=r.previous;return t.target&&(t.last=r=r?r.next:t.state.first)?"keys"==e?{value:r.key,done:!1}:"values"==e?{value:r.value,done:!1}:{value:[r.key,r.value],done:!1}:(t.target=void 0,{value:void 0,done:!0})}),r?"entries":"values",!r,!0),function(t){var e=_(t),r=et.f;Y&&e&&!e[ar]&&r(e,ar,{configurable:!0,get:function(){return this}})}(e)}}),Ke?{}.toString:function(){return"[object "+$e(this)+"]"});Ke||te(Object.prototype,"toString",lr,{unsafe:!0});var dr=function(t){if(q(t))throw TypeError("Cannot convert a Symbol value to a string");return String(t)},hr=function(t){return function(e,r){var n,o,i=dr(l(e)),a=ot(r),u=i.length;return a<0||a>=u?t?"":void 0:(n=i.charCodeAt(a))<55296||n>56319||a+1===u||(o=i.charCodeAt(a+1))<56320||o>57343?t?i.charAt(a):n:t?i.slice(a,a+2):o-56320+(n-55296<<10)+65536}},pr={codeAt:hr(!1),charAt:hr(!0)},vr=pr.charAt,yr=Qt.set,gr=Qt.getterFor("String Iterator");Pe(String,"String",(function(t){yr(this,{type:"String Iterator",string:dr(t),index:0})}),(function(){var t,e=gr(this),r=e.string,n=e.index;return n>=r.length?{value:void 0,done:!0}:(t=vr(r,n),e.index+=t.length,{value:t,done:!1})}));var mr={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},wr=B("iterator"),xr=B("toStringTag"),br=Ce.values;for(var Er in mr){var Sr=m[Er],kr=Sr&&Sr.prototype;if(kr){if(kr[wr]!==br)try{Dt(kr,wr,br)}catch(xo){kr[wr]=br}if(kr[xr]||Dt(kr,xr,Er),mr[Er])for(var Or in Ce)if(kr[Or]!==Ce[Or])try{Dt(kr,Or,Ce[Or])}catch(xo){kr[Or]=Ce[Or]}}}var Tr=Array.isArray||function(t){return"Array"==c(t)},Ar=B("species"),jr=function(t,e){return new(function(t){var e;return Tr(t)&&("function"!=typeof(e=t.constructor)||e!==Array&&!Tr(e.prototype)?V(e)&&null===(e=e[Ar])&&(e=void 0):e=void 0),void 0===e?Array:e}(t))(0===e?0:e)},_r=[].push,Lr=function(t){var e=1==t,r=2==t,n=3==t,o=4==t,i=6==t,a=7==t,u=5==t||i;return function(c,s,l,d){for(var h,p,v=E(c),y=f(v),g=Ue(s,l,3),m=at(y.length),w=0,x=d||jr,b=e?x(c,m):r||a?x(c,0):void 0;m>w;w++)if((u||w in y)&&(p=g(h=y[w],w,v),t))if(e)b[w]=p;else if(p)switch(t){case 3:return!0;case 5:return h;case 6:return w;case 2:_r.call(b,h)}else switch(t){case 4:return!1;case 7:_r.call(b,h)}return i?-1:n||o?o:b}},Ir={forEach:Lr(0),map:Lr(1),filter:Lr(2),some:Lr(3),every:Lr(4),find:Lr(5),findIndex:Lr(6),filterReject:Lr(7)},Pr=function(t,e){var r=[][t];return!!r&&a((function(){r.call(null,e||function(){throw 1},1)}))},Mr=Ir.forEach,Rr=Pr("forEach")?[].forEach:function(t){return Mr(this,t,arguments.length>1?arguments[1]:void 0)};for(var Cr in pe({target:"Array",proto:!0,forced:[].forEach!=Rr},{forEach:Rr}),mr){var Fr=m[Cr],Nr=Fr&&Fr.prototype;if(Nr&&Nr.forEach!==Rr)try{Dt(Nr,"forEach",Rr)}catch(xo){Nr.forEach=Rr}}var Dr=Math.min,zr=[].lastIndexOf,Gr=!!zr&&1/[1].lastIndexOf(1,-0)<0,Wr=Pr("lastIndexOf"),Br=Gr||!Wr?function(t){if(Gr)return zr.apply(this,arguments)||0;var e=d(this),r=at(e.length),n=r-1;for(arguments.length>1&&(n=Dr(n,ot(arguments[1]))),n<0&&(n=r+n);n>=0;n--)if(n in e&&e[n]===t)return n||0;return-1}:zr;pe({target:"Array",proto:!0,forced:Br!==[].lastIndexOf},{lastIndexOf:Br});var Vr=ft.indexOf,Ur=[].indexOf,Yr=!!Ur&&1/[1].indexOf(1,-0)<0,Kr=Pr("indexOf");pe({target:"Array",proto:!0,forced:Yr||!Kr},{indexOf:function(t){return Yr?Ur.apply(this,arguments)||0:Vr(this,t,arguments.length>1?arguments[1]:void 0)}});var Hr,Qr=B("match"),$r=function(t){if(function(t){var e;return V(t)&&(void 0!==(e=t[Qr])?!!e:"RegExp"==c(t))}(t))throw TypeError("The method doesn't accept regular expressions");return t},qr=B("match"),Xr=Zt.f,Jr="".startsWith,Zr=Math.min,tn=function(t){var e=/./;try{"/./"[t](e)}catch(r){try{return e[qr]=!1,"/./"[t](e)}catch(n){}}return!1}("startsWith"),en=!(tn||(Hr=Xr(String.prototype,"startsWith"),!Hr||Hr.writable));pe({target:"String",proto:!0,forced:!en&&!tn},{startsWith:function(t){var e=dr(l(this));$r(t);var r=at(Zr(arguments.length>1?arguments[1]:void 0,e.length)),n=dr(t);return Jr?Jr.call(e,n,r):e.slice(r,r+n.length)===n}}),pe({target:"Array",stat:!0},{isArray:Tr});p((function(t){var e=function(t){var e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(T){u=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o=e&&e.prototype instanceof l?e:l,i=Object.create(o.prototype),a=new S(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return O()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=x(a,r);if(u){if(u===f)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=s(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===f)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(T){return{type:"throw",arg:T}}}t.wrap=c;var f={};function l(){}function d(){}function h(){}var p={};u(p,o,(function(){return this}));var v=Object.getPrototypeOf,y=v&&v(v(k([])));y&&y!==e&&r.call(y,o)&&(p=y);var g=h.prototype=l.prototype=Object.create(p);function m(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){var n;this._invoke=function(o,i){function a(){return new e((function(n,a){!function n(o,i,a,u){var c=s(t[o],t,i);if("throw"!==c.type){var f=c.arg,l=f.value;return l&&"object"==typeof l&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,u)}),(function(t){n("throw",t,a,u)})):e.resolve(l).then((function(t){f.value=t,a(f)}),(function(t){return n("throw",t,a,u)}))}u(c.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}}function x(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,x(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var n=s(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,f;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function b(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(b,this),this.reset(!0)}function k(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:O}}function O(){return{value:void 0,done:!0}}return d.prototype=h,u(g,"constructor",h),u(h,"constructor",d),d.displayName=u(h,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,h):(t.__proto__=h,u(t,a,"GeneratorFunction")),t.prototype=Object.create(g),t},t.awrap=function(t){return{__await:t}},m(w.prototype),u(w.prototype,i,(function(){return this})),t.AsyncIterator=w,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new w(c(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},m(g),u(g,a,"Generator"),u(g,o,(function(){return this})),u(g,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=k,S.prototype={constructor:S,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:k(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}(t.exports);try{regeneratorRuntime=e}catch(r){"object"==typeof globalThis?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}}));var rn=B("species"),nn=function(t){return F>=51||!a((function(){var e=[];return(e.constructor={})[rn]=function(){return{foo:1}},1!==e[t](Boolean).foo}))},on=Ir.map,an=nn("map");pe({target:"Array",proto:!0,forced:!an},{map:function(t){return on(this,t,arguments.length>1?arguments[1]:void 0)}});var un=Ir.filter,cn=nn("filter");pe({target:"Array",proto:!0,forced:!cn},{filter:function(t){return un(this,t,arguments.length>1?arguments[1]:void 0)}});var sn=Ir.findIndex,fn=!0;"findIndex"in[]&&Array(1).findIndex((function(){fn=!1})),pe({target:"Array",proto:!0,forced:fn},{findIndex:function(t){return sn(this,t,arguments.length>1?arguments[1]:void 0)}}),jt("findIndex");var ln,dn,hn=function(){var t=U(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.dotAll&&(e+="s"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e},pn=function(t,e){return RegExp(t,e)},vn={UNSUPPORTED_Y:a((function(){var t=pn("a","y");return t.lastIndex=2,null!=t.exec("abcd")})),BROKEN_CARET:a((function(){var t=pn("^r","gy");return t.lastIndex=2,null!=t.exec("str")}))},yn=a((function(){var t=RegExp(".","string".charAt(0));return!(t.dotAll&&t.exec("\n")&&"s"===t.flags)})),gn=a((function(){var t=RegExp("(?<a>b)","string".charAt(5));return"b"!==t.exec("b").groups.a||"bc"!=="b".replace(t,"$<a>c")})),mn=Qt.get,wn=RegExp.prototype.exec,xn=b("native-string-replace",String.prototype.replace),bn=wn,En=(ln=/a/,dn=/b*/g,wn.call(ln,"a"),wn.call(dn,"a"),0!==ln.lastIndex||0!==dn.lastIndex),Sn=vn.UNSUPPORTED_Y||vn.BROKEN_CARET,kn=void 0!==/()??/.exec("")[1];(En||kn||Sn||yn||gn)&&(bn=function(t){var e,r,n,o,i,a,u,c=this,s=mn(c),f=dr(t),l=s.raw;if(l)return l.lastIndex=c.lastIndex,e=bn.call(l,f),c.lastIndex=l.lastIndex,e;var d=s.groups,h=Sn&&c.sticky,p=hn.call(c),v=c.source,y=0,g=f;if(h&&(-1===(p=p.replace("y","")).indexOf("g")&&(p+="g"),g=f.slice(c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==f.charAt(c.lastIndex-1))&&(v="(?: "+v+")",g=" "+g,y++),r=new RegExp("^(?:"+v+")",p)),kn&&(r=new RegExp("^"+v+"$(?!\\s)",p)),En&&(n=c.lastIndex),o=wn.call(h?r:c,g),h?o?(o.input=o.input.slice(y),o[0]=o[0].slice(y),o.index=c.lastIndex,c.lastIndex+=o[0].length):c.lastIndex=0:En&&o&&(c.lastIndex=c.global?o.index+o[0].length:n),kn&&o&&o.length>1&&xn.call(o[0],r,(function(){for(i=1;i<arguments.length-2;i++)void 0===arguments[i]&&(o[i]=void 0)})),o&&d)for(o.groups=a=Ot(null),i=0;i<d.length;i++)a[(u=d[i])[0]]=o[u[1]];return o});var On=bn;pe({target:"RegExp",proto:!0,forced:/./.exec!==On},{exec:On});var Tn="[\t\n\v\f\r                 \u2028\u2029\ufeff]",An=RegExp("^"+Tn+Tn+"*"),jn=RegExp(Tn+Tn+"*$"),_n=function(t){return function(e){var r=dr(l(e));return 1&t&&(r=r.replace(An,"")),2&t&&(r=r.replace(jn,"")),r}},Ln={start:_n(1),end:_n(2),trim:_n(3)}.trim,In=m.parseFloat,Pn=1/In("\t\n\v\f\r                 \u2028\u2029\ufeff-0")!=-Infinity?function(t){var e=Ln(dr(t)),r=In(e);return 0===r&&"-"==e.charAt(0)?-0:r}:In;pe({global:!0,forced:parseFloat!=Pn},{parseFloat:Pn});var Mn=B("species"),Rn=RegExp.prototype,Cn=pr.charAt,Fn=function(t,e,r){return e+(r?Cn(t,e).length:1)},Nn=function(t,e){var r=t.exec;if("function"==typeof r){var n=r.call(t,e);if("object"!=typeof n)throw TypeError("RegExp exec method returned something other than an Object or null");return n}if("RegExp"!==c(t))throw TypeError("RegExp#exec called on incompatible receiver");return On.call(t,e)};!function(t,e,r,n){var o=B(t),i=!a((function(){var e={};return e[o]=function(){return 7},7!=""[t](e)})),u=i&&!a((function(){var e=!1,r=/a/;return"split"===t&&((r={}).constructor={},r.constructor[Mn]=function(){return r},r.flags="",r[o]=/./[o]),r.exec=function(){return e=!0,null},r[o](""),!e}));if(!i||!u||r){var c=/./[o],s=e(o,""[t],(function(t,e,r,n,o){var a=e.exec;return a===On||a===Rn.exec?i&&!o?{done:!0,value:c.call(e,r,n)}:{done:!0,value:t.call(r,e,n)}:{done:!1}}));te(String.prototype,t,s[0]),te(Rn,o,s[1])}n&&Dt(Rn[o],"sham",!0)}("match",(function(t,e,r){return[function(e){var r=l(this),n=null==e?void 0:e[t];return void 0!==n?n.call(e,r):new RegExp(e)[t](dr(r))},function(t){var n=U(this),o=dr(t),i=r(e,n,o);if(i.done)return i.value;if(!n.global)return Nn(n,o);var a=n.unicode;n.lastIndex=0;for(var u,c=[],s=0;null!==(u=Nn(n,o));){var f=dr(u[0]);c[s]=f,""===f&&(n.lastIndex=Fn(o,at(n.lastIndex),a)),s++}return 0===s?null:c}]}));var Dn=function(t,e,r){var n=Z(e);n in t?et.f(t,n,Nt(0,r)):t[n]=r},zn=B("isConcatSpreadable"),Gn=F>=51||!a((function(){var t=[];return t[zn]=!1,t.concat()[0]!==t})),Wn=nn("concat"),Bn=function(t){if(!V(t))return!1;var e=t[zn];return void 0!==e?!!e:Tr(t)};pe({target:"Array",proto:!0,forced:!Gn||!Wn},{concat:function(t){var e,r,n,o,i,a=E(this),u=jr(a,0),c=0;for(e=-1,n=arguments.length;e<n;e++)if(Bn(i=-1===e?a:arguments[e])){if(c+(o=at(i.length))>9007199254740991)throw TypeError("Maximum allowed index exceeded");for(r=0;r<o;r++,c++)r in i&&Dn(u,c,i[r])}else{if(c>=9007199254740991)throw TypeError("Maximum allowed index exceeded");Dn(u,c++,i)}return u.length=c,u}});var Vn=window.navigator&&window.navigator.userAgent||"",Un=/AppleWebKit\/([\d.]+)/i.exec(Vn),Yn=(Un&&parseFloat(Un.pop()),/iPad/i.test(Vn)),Kn=/iPhone/i.test(Vn)&&!Yn,Hn=/iPod/i.test(Vn),Qn=Kn||Yn||Hn,$n=(function(){var t=Vn.match(/OS (\d+)_/i);t&&t[1]&&t[1]}(),/Android/i.test(Vn)),qn=function(){var t=Vn.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!t)return null;var e=t[1]&&parseFloat(t[1]),r=t[2]&&parseFloat(t[2]);return e&&r?parseFloat("".concat(t[1],".").concat(t[2])):e||null}(),Xn=($n&&/webkit/i.test(Vn),/Firefox/i.test(Vn)),Jn=function(){var t=Vn.match(/Firefox\/(\d+)/);return t&&t[1]?parseFloat(t[1]):null}(),Zn=/Edge\//i.test(Vn),to=/Edg\//i.test(Vn),eo=function(){var t=Vn.match(/Edg\/(\d+)/);return t&&t[1]?parseFloat(t[1]):null}(),ro=!Zn&&/Chrome/i.test(Vn),no=(function(){var t=Vn.match(/Chrome\/(\d+)/);t&&t[1]&&parseFloat(t[1])}(),function(){var t=Vn.match(/Chrome\/([\d.]+)/);return t&&t[1]?t[1]:null}()),oo=(/MSIE\s8\.0/.test(Vn),function(){var t=/MSIE\s(\d+)\.\d/.exec(Vn),e=t&&parseFloat(t[1]);!e&&/Trident\/7.0/i.test(Vn)&&/rv:11.0/.test(Vn)&&(e=11)}(),/Safari/i.test(Vn)&&!ro&&!$n&&!Zn),io=function(){var t=Vn.match(/Version\/([\d.]+)/);return t&&t[1]?t[1]:null}(),ao=/TBS\/\d+/i.test(Vn),uo=(function(){var t=Vn.match(/TBS\/(\d+)/i);if(t&&t[1])t[1]}(),!ao&&/MQQBrowser\/\d+/i.test(Vn),!ao&&/ QQBrowser\/\d+/i.test(Vn),/(micromessenger|webbrowser)/i.test(Vn),/Windows/i.test(Vn),/MAC OS X/i.test(Vn),/Linux/i.test(Vn),/MicroMessenger/i.test(Vn),/UCBrowser/i.test(Vn),/MiuiBrowser/i.test(Vn),/HuaweiBrowser/i.test(Vn),"file:"===location.protocol||"localhost"===location.hostname||/^\d+\.\d+\.\d+\.\d+$/.test(location.hostname)),co=function(){return!(ro&&no<56||oo&&io<11||to&&eo<80||Xn&&Jn<56||Qn&&io<14||("undefined"!=typeof AudioContext&&(t=new AudioContext),void 0!==window.webkitAudioContext&&(t=new window.webkitAudioContext),void 0!==window.mozAudioContext&&(t=new window.mozAudioContext),!(t.createMediaElementSource&&t.createMediaStreamDestination&&t.createMediaStreamSource)));var t},so=function(t){return"string"==typeof t},fo=function(){return"undefined"!=typeof AudioContext?new AudioContext:void 0!==window.webkitAudioContext?new window.webkitAudioContext:void 0!==window.mozAudioContext?new window.mozAudioContext:void 0},lo=function(){var t=r(regeneratorRuntime.mark((function t(){var e;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!po()&&!ho()){t.next=2;break}return t.abrupt("return",[]);case 2:return t.next=4,navigator.mediaDevices.enumerateDevices();case 4:return e=t.sent,t.abrupt("return",e.filter((function(t){return"audioinput"===t.kind})).map((function(t,e){var r=t.label;t.label||(r="microphone_".concat(e));var n={label:r,deviceId:t.deviceId,kind:t.kind};return t.groupId&&(n.groupId=t.groupId),n})));case 6:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),ho=function(){return void 0===navigator.mediaDevices&&(console.error("navigator.mediaDevices is not supported on your browser"),!0)},po=function(){return false},vo=function(){var t=r(regeneratorRuntime.mark((function t(e){var r,n,o;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!("getSettings"in MediaStreamTrack.prototype)){t.next=8;break}if(r=e.getSettings(),n=r.deviceId,!so(n)||!n.startsWith("WebAudio")){t.next=4;break}return t.abrupt("return",!1);case 4:return t.next=6,lo();case 6:return o=t.sent,t.abrupt("return",o.findIndex((function(t){return t.deviceId===n}))>=0);case 8:return t.abrupt("return",!1);case 9:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),yo=p((function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}function o(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function i(t,e,n,i,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var u=new o(n,i||t,a),c=r?r+e:e;return t._events[c]?t._events[c].fn?t._events[c]=[t._events[c],u]:t._events[c].push(u):(t._events[c]=u,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e]}function u(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),u.prototype.eventNames=function(){var t,n,o=[];if(0===this._eventsCount)return o;for(n in t=this._events)e.call(t,n)&&o.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(t)):o},u.prototype.listeners=function(t){var e=r?r+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var o=0,i=n.length,a=new Array(i);o<i;o++)a[o]=n[o].fn;return a},u.prototype.listenerCount=function(t){var e=r?r+t:t,n=this._events[e];return n?n.fn?1:n.length:0},u.prototype.emit=function(t,e,n,o,i,a){var u=r?r+t:t;if(!this._events[u])return!1;var c,s,f=this._events[u],l=arguments.length;if(f.fn){switch(f.once&&this.removeListener(t,f.fn,void 0,!0),l){case 1:return f.fn.call(f.context),!0;case 2:return f.fn.call(f.context,e),!0;case 3:return f.fn.call(f.context,e,n),!0;case 4:return f.fn.call(f.context,e,n,o),!0;case 5:return f.fn.call(f.context,e,n,o,i),!0;case 6:return f.fn.call(f.context,e,n,o,i,a),!0}for(s=1,c=new Array(l-1);s<l;s++)c[s-1]=arguments[s];f.fn.apply(f.context,c)}else{var d,h=f.length;for(s=0;s<h;s++)switch(f[s].once&&this.removeListener(t,f[s].fn,void 0,!0),l){case 1:f[s].fn.call(f[s].context);break;case 2:f[s].fn.call(f[s].context,e);break;case 3:f[s].fn.call(f[s].context,e,n);break;case 4:f[s].fn.call(f[s].context,e,n,o);break;default:if(!c)for(d=1,c=new Array(l-1);d<l;d++)c[d-1]=arguments[d];f[s].fn.apply(f[s].context,c)}}return!0},u.prototype.on=function(t,e,r){return i(this,t,e,r,!1)},u.prototype.once=function(t,e,r){return i(this,t,e,r,!0)},u.prototype.removeListener=function(t,e,n,o){var i=r?r+t:t;if(!this._events[i])return this;if(!e)return a(this,i),this;var u=this._events[i];if(u.fn)u.fn!==e||o&&!u.once||n&&u.context!==n||a(this,i);else{for(var c=0,s=[],f=u.length;c<f;c++)(u[c].fn!==e||o&&!u[c].once||n&&u[c].context!==n)&&s.push(u[c]);s.length?this._events[i]=1===s.length?s[0]:s:a(this,i)}return this},u.prototype.removeAllListeners=function(t){var e;return t?(e=r?r+t:t,this._events[e]&&a(this,e)):(this._events=new n,this._eventsCount=0),this},u.prototype.off=u.prototype.removeListener,u.prototype.addListener=u.prototype.on,u.prefixed=r,u.EventEmitter=u,t.exports=u})),go=["abort","canplay","canplaythrough","durationchange","emptied","ended","error","interruptbegin","interruptend","loadedmetadata","loadstart","mozaudioavailable","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting"],mo=function(){function t(e){n(this,t),this.emitter=new yo,this.audioContext=fo(),this.destination=this.audioContext.createMediaStreamDestination(),this.source=null,this.audio=this.createEl(e)}return i(t,[{key:"createEl",value:function(t){var e=this,r=document.createElement("audio");return this.audio=r,r.crossOrigin="anonymous",r.src=t.url,this.source=this.audioContext.createMediaElementSource(r),this.source.connect(this.destination),go.forEach((function(t){r.addEventListener(t,(function(r){e.emitter.emit(t,r)}))})),"boolean"==typeof t.loop&&(this.audio.loop=t.loop),t.volume&&this.setVolume(t.volume),r}},{key:"getStream",value:function(){return this.destination.stream}},{key:"play",value:function(){var t=this;this.audio&&this.audio.play().then((function(){console.log("Audio ".concat(t.audio.src," play success"))})).catch((function(e){t.emitter.emit("error",e)}))}},{key:"pause",value:function(){this.audio&&this.audio.pause()}},{key:"resume",value:function(){this.audio&&(this.audio.pause(),this.audio.currentTime=0)}},{key:"stop",value:function(){this.audio&&(this.audio.pause(),this.audio.currentTime=0)}},{key:"setPosition",value:function(t){if(t<0&&t>this.duration())throw new Error("时间超出歌曲时长");this.audio&&(this.audio.currentTime=t)}},{key:"getPosition",value:function(){if(this.audio)return this.audio.currentTime}},{key:"setVolume",value:function(t){if(t>1&&t<0)throw new Error("音量超出限制");this.audio&&(this.audio.volume=t)}},{key:"getVolume",value:function(){if(this.audio)return this.audio.volume}},{key:"setPlayBackRate",value:function(t){if(t>8&&t<0)throw new Error("速率超出限制");this.audio&&(this.audio.playbackRate=t)}},{key:"getPlayBackRate",value:function(){if(this.audio)return this.audio.playbackRate}},{key:"duration",value:function(){if(this.audio)return this.audio.duration||0}},{key:"loop",value:function(t){if(void 0===t)return this.audio.loop;"boolean"==typeof t&&(this.audio.loop=t)}},{key:"on",value:function(t,e){this.emitter.on(t,e)}},{key:"off",value:function(t,e){"*"===t?this.emitter.removeAllListeners():this.emitter.off(t,e)}}]),t}(),wo=new(function(){function t(){n(this,t),this.audioTrackMap=new Map}return i(t,[{key:"createAudioSource",value:function(t){return this.checkAudioSourceParams(t),new mo(t)}},{key:"mix",value:function(t){this.checkMixParams(t);var e=t.targetTrack,r=t.sourceList,n=t.trackList,o=fo(),i=o.createMediaStreamDestination();if(e){var a=new MediaStream;a.addTrack(e),o.createMediaStreamSource(a).connect(i)}r&&r.forEach((function(t){var e=document.createElement("audio");e.srcObject=t.getStream(),e.play().then((function(){console.log("".concat(t.audio.src," mix success"))})).catch((function(){throw new Error("".concat(t.audio.src," mix error"))}));var r=o.createMediaStreamSource(t.destination.stream),n=o.createGain();r.connect(n),n.connect(i)})),n&&n.forEach((function(t){var e=new MediaStream;e.addTrack(t);var r=o.createMediaStreamSource(e),n=o.createGain();r.connect(n),n.connect(i)}));var u=i.stream.getAudioTracks()[0];return this.setAudioTrackMap({targetTrack:e,sourceList:r,trackList:n,id:u.id}),u}},{key:"setAudioTrackMap",value:function(t){var e=this,r=t.targetTrack,n=t.sourceList,o=t.id,i=!1,a=null;r?vo(r).then((function(t){if(t)i=t,a=r;else{var n=e.audioTrackMap.get(r.id);if(n){var o=n.hasMicrophone,u=n.microphoneTrack;i=o,a=u}else i=!1,a=null}})):(i=!1,a=null),this.audioTrackMap.set(o,{sourceList:n,targetTrack:r,hasMicrophone:i,microphoneTrack:a})}},{key:"checkAudioSourceParams",value:function(t){var e=t.url,r=t.loop,n=t.volume;if(!so(e))throw new Error("url is invalid.");if(r&&"boolean"!=typeof r)throw new Error("loop is invalid.");if(n&&(!function(t){return"number"==typeof t}(n)||n<0||n>1))throw new Error("volume is invalid.");var o=e.lastIndexOf("."),i=e.substr(o+1),a=["mp3","ogg","wav","flac"].indexOf(i)>=0,u=e.startsWith("blob"),c=e.startsWith("data");if(!(a||u||c))throw new Error("url is invalid.")}},{key:"checkMixParams",value:function(t){if(!co())throw new Error("Your browser is not compatible with AudioMixerPlugin");var e=t.targetTrack,r=t.sourceList,n=t.trackList;if(e&&"audio"!==e.kind)throw new Error("targetTrack is invalid.");if(!r&&!n)throw new Error("params is invalid.");r&&Array.isArray(r)&&r.forEach((function(t){if(!(t instanceof mo))throw new Error("sourceList is invalid.")})),n&&Array.isArray(n)&&n.forEach((function(t){if(!(t instanceof MediaStreamTrack&&"audio"===t.kind))throw new Error("audioTracks is invalid")}))}},{key:"getAudioTrackMap",value:function(){return this.audioTrackMap}}]),t}());if(wo.isSupported=function(){return co()},!t)throw new Error("没有加载 TRTC");return t.AudioMixerPlugin=wo,wo}));
  16. /***/ }),
  17. /***/ 24:
  18. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  19. !function(e,t){ true?module.exports=t():0}(this,(function(){function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function t(t){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?e(Object(r),!0).forEach((function(e){c(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):e(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(u){return void n(u)}s.done?t(c):Promise.resolve(c).then(r,i)}function i(e){return function(){var t=this,n=arguments;return new Promise((function(i,a){var o=e.apply(t,n);function s(e){r(o,i,a,s,c,"next",e)}function c(e){r(o,i,a,s,c,"throw",e)}s(void 0)}))}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function s(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&l(e,t)}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function h(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function p(e,t,n){return(p=h()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&l(i,n.prototype),i}).apply(null,arguments)}function f(e){var t="function"==typeof Map?new Map:void 0;return(f=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return p(e,arguments,d(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),l(r,e)})(e)}function m(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function _(e){var t=h();return function(){var n,r=d(e);if(t){var i=d(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return m(this,n)}}function v(e,t,n){return(v="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=d(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n):i.value}})(e,t,n||e)}function g(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,i,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(c){s=!0,i=c}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}(e,t)||S(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e){return function(e){if(Array.isArray(e))return k(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||S(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function S(e,t){if(e){if("string"==typeof e)return k(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?k(e,t):void 0}}function k(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function b(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=S(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}function I(e,t,n,r,i){var a={};return Object.keys(r).forEach((function(e){a[e]=r[e]})),a.enumerable=!!a.enumerable,a.configurable=!!a.configurable,("value"in a||a.initializer)&&(a.writable=!0),a=n.slice().reverse().reduce((function(n,r){return r(e,t,n)||n}),a),i&&void 0!==a.initializer&&(a.value=a.initializer?a.initializer.call(i):void 0,a.initializer=void 0),void 0===a.initializer&&(Object.defineProperty(e,t,a),a=null),a}var T="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof __webpack_require__.g?__webpack_require__.g:"undefined"!=typeof self?self:{};function R(e,t){return e(t={exports:{}},t.exports),t.exports}var w,E,C=function(e){return e&&e.Math==Math&&e},A=C("object"==typeof globalThis&&globalThis)||C("object"==typeof window&&window)||C("object"==typeof self&&self)||C("object"==typeof T&&T)||function(){return this}()||Function("return this")(),x=function(e){try{return!!e()}catch(t){return!0}},P=!x((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),D={}.propertyIsEnumerable,N=Object.getOwnPropertyDescriptor,L={f:N&&!D.call({1:2},1)?function(e){var t=N(this,e);return!!t&&t.enumerable}:D},O=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},M={}.toString,U=function(e){return M.call(e).slice(8,-1)},V="".split,F=x((function(){return!Object("z").propertyIsEnumerable(0)}))?function(e){return"String"==U(e)?V.call(e,""):Object(e)}:Object,j=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e},B=function(e){return F(j(e))},H=function(e){return"function"==typeof e},G=function(e){return"object"==typeof e?null!==e:H(e)},J=function(e){return H(e)?e:void 0},z=function(e,t){return arguments.length<2?J(A[e]):A[e]&&A[e][t]},W=z("navigator","userAgent")||"",q=A.process,K=A.Deno,Q=q&&q.versions||K&&K.version,X=Q&&Q.v8;X?E=(w=X.split("."))[0]<4?1:w[0]+w[1]:W&&(!(w=W.match(/Edge\/(\d+)/))||w[1]>=74)&&(w=W.match(/Chrome\/(\d+)/))&&(E=w[1]);var $=E&&+E,Y=!!Object.getOwnPropertySymbols&&!x((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&$&&$<41})),Z=Y&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,ee=Z?function(e){return"symbol"==typeof e}:function(e){var t=z("Symbol");return H(t)&&Object(e)instanceof t},te=function(e){try{return String(e)}catch(t){return"Object"}},ne=function(e){if(H(e))return e;throw TypeError(te(e)+" is not a function")},re=function(e,t){var n=e[t];return null==n?void 0:ne(n)},ie=function(e,t){try{Object.defineProperty(A,e,{value:t,configurable:!0,writable:!0})}catch(n){A[e]=t}return t},ae=A["__core-js_shared__"]||ie("__core-js_shared__",{}),oe=R((function(e){(e.exports=function(e,t){return ae[e]||(ae[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.18.2",mode:"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})})),se=function(e){return Object(j(e))},ce={}.hasOwnProperty,ue=Object.hasOwn||function(e,t){return ce.call(se(e),t)},de=0,le=Math.random(),he=function(e){return"Symbol("+String(void 0===e?"":e)+")_"+(++de+le).toString(36)},pe=oe("wks"),fe=A.Symbol,me=Z?fe:fe&&fe.withoutSetter||he,_e=function(e){return ue(pe,e)&&(Y||"string"==typeof pe[e])||(Y&&ue(fe,e)?pe[e]=fe[e]:pe[e]=me("Symbol."+e)),pe[e]},ve=_e("toPrimitive"),ge=function(e,t){if(!G(e)||ee(e))return e;var n,r=re(e,ve);if(r){if(void 0===t&&(t="default"),n=r.call(e,t),!G(n)||ee(n))return n;throw TypeError("Can't convert object to primitive value")}return void 0===t&&(t="number"),function(e,t){var n,r;if("string"===t&&H(n=e.toString)&&!G(r=n.call(e)))return r;if(H(n=e.valueOf)&&!G(r=n.call(e)))return r;if("string"!==t&&H(n=e.toString)&&!G(r=n.call(e)))return r;throw TypeError("Can't convert object to primitive value")}(e,t)},ye=function(e){var t=ge(e,"string");return ee(t)?t:String(t)},Se=A.document,ke=G(Se)&&G(Se.createElement),be=function(e){return ke?Se.createElement(e):{}},Ie=!P&&!x((function(){return 7!=Object.defineProperty(be("div"),"a",{get:function(){return 7}}).a})),Te=Object.getOwnPropertyDescriptor,Re={f:P?Te:function(e,t){if(e=B(e),t=ye(t),Ie)try{return Te(e,t)}catch(n){}if(ue(e,t))return O(!L.f.call(e,t),e[t])}},we=function(e){if(G(e))return e;throw TypeError(String(e)+" is not an object")},Ee=Object.defineProperty,Ce={f:P?Ee:function(e,t,n){if(we(e),t=ye(t),we(n),Ie)try{return Ee(e,t,n)}catch(r){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},Ae=P?function(e,t,n){return Ce.f(e,t,O(1,n))}:function(e,t,n){return e[t]=n,e},xe=Function.toString;H(ae.inspectSource)||(ae.inspectSource=function(e){return xe.call(e)});var Pe,De,Ne,Le=ae.inspectSource,Oe=A.WeakMap,Me=H(Oe)&&/native code/.test(Le(Oe)),Ue=oe("keys"),Ve=function(e){return Ue[e]||(Ue[e]=he(e))},Fe={},je=A.WeakMap;if(Me||ae.state){var Be=ae.state||(ae.state=new je),He=Be.get,Ge=Be.has,Je=Be.set;Pe=function(e,t){if(Ge.call(Be,e))throw new TypeError("Object already initialized");return t.facade=e,Je.call(Be,e,t),t},De=function(e){return He.call(Be,e)||{}},Ne=function(e){return Ge.call(Be,e)}}else{var ze=Ve("state");Fe[ze]=!0,Pe=function(e,t){if(ue(e,ze))throw new TypeError("Object already initialized");return t.facade=e,Ae(e,ze,t),t},De=function(e){return ue(e,ze)?e[ze]:{}},Ne=function(e){return ue(e,ze)}}var We={set:Pe,get:De,has:Ne,enforce:function(e){return Ne(e)?De(e):Pe(e,{})},getterFor:function(e){return function(t){var n;if(!G(t)||(n=De(t)).type!==e)throw TypeError("Incompatible receiver, "+e+" required");return n}}},qe=Function.prototype,Ke=P&&Object.getOwnPropertyDescriptor,Qe=ue(qe,"name"),Xe={EXISTS:Qe,PROPER:Qe&&"something"===function(){}.name,CONFIGURABLE:Qe&&(!P||P&&Ke(qe,"name").configurable)},$e=R((function(e){var t=Xe.CONFIGURABLE,n=We.get,r=We.enforce,i=String(String).split("String");(e.exports=function(e,n,a,o){var s,c=!!o&&!!o.unsafe,u=!!o&&!!o.enumerable,d=!!o&&!!o.noTargetGet,l=o&&void 0!==o.name?o.name:n;H(a)&&("Symbol("===String(l).slice(0,7)&&(l="["+String(l).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!ue(a,"name")||t&&a.name!==l)&&Ae(a,"name",l),(s=r(a)).source||(s.source=i.join("string"==typeof l?l:""))),e!==A?(c?!d&&e[n]&&(u=!0):delete e[n],u?e[n]=a:Ae(e,n,a)):u?e[n]=a:ie(n,a)})(Function.prototype,"toString",(function(){return H(this)&&n(this).source||Le(this)}))})),Ye=Math.ceil,Ze=Math.floor,et=function(e){var t=+e;return t!=t||0===t?0:(t>0?Ze:Ye)(t)},tt=Math.max,nt=Math.min,rt=function(e,t){var n=et(e);return n<0?tt(n+t,0):nt(n,t)},it=Math.min,at=function(e){return e>0?it(et(e),9007199254740991):0},ot=function(e){return at(e.length)},st=function(e){return function(t,n,r){var i,a=B(t),o=ot(a),s=rt(r,o);if(e&&n!=n){for(;o>s;)if((i=a[s++])!=i)return!0}else for(;o>s;s++)if((e||s in a)&&a[s]===n)return e||s||0;return!e&&-1}},ct={includes:st(!0),indexOf:st(!1)},ut=ct.indexOf,dt=function(e,t){var n,r=B(e),i=0,a=[];for(n in r)!ue(Fe,n)&&ue(r,n)&&a.push(n);for(;t.length>i;)ue(r,n=t[i++])&&(~ut(a,n)||a.push(n));return a},lt=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],ht=lt.concat("length","prototype"),pt={f:Object.getOwnPropertyNames||function(e){return dt(e,ht)}},ft={f:Object.getOwnPropertySymbols},mt=z("Reflect","ownKeys")||function(e){var t=pt.f(we(e)),n=ft.f;return n?t.concat(n(e)):t},_t=function(e,t){for(var n=mt(t),r=Ce.f,i=Re.f,a=0;a<n.length;a++){var o=n[a];ue(e,o)||r(e,o,i(t,o))}},vt=/#|\.prototype\./,gt=function(e,t){var n=St[yt(e)];return n==bt||n!=kt&&(H(t)?x(t):!!t)},yt=gt.normalize=function(e){return String(e).replace(vt,".").toLowerCase()},St=gt.data={},kt=gt.NATIVE="N",bt=gt.POLYFILL="P",It=gt,Tt=Re.f,Rt=function(e,t){var n,r,i,a,o,s=e.target,c=e.global,u=e.stat;if(n=c?A:u?A[s]||ie(s,{}):(A[s]||{}).prototype)for(r in t){if(a=t[r],i=e.noTargetGet?(o=Tt(n,r))&&o.value:n[r],!It(c?r:s+(u?".":"#")+r,e.forced)&&void 0!==i){if(typeof a==typeof i)continue;_t(a,i)}(e.sham||i&&i.sham)&&Ae(a,"sham",!0),$e(n,r,a,e)}},wt=function(e,t,n){if(ne(e),void 0===t)return e;switch(n){case 0:return function(){return e.call(t)};case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)}}return function(){return e.apply(t,arguments)}},Et=Array.isArray||function(e){return"Array"==U(e)},Ct={};Ct[_e("toStringTag")]="z";var At="[object z]"===String(Ct),xt=_e("toStringTag"),Pt="Arguments"==U(function(){return arguments}()),Dt=At?U:function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(n){}}(t=Object(e),xt))?n:Pt?U(t):"Object"==(r=U(t))&&H(t.callee)?"Arguments":r},Nt=[],Lt=z("Reflect","construct"),Ot=/^\s*(?:class|function)\b/,Mt=Ot.exec,Ut=!Ot.exec((function(){})),Vt=function(e){if(!H(e))return!1;try{return Lt(Object,Nt,e),!0}catch(t){return!1}},Ft=!Lt||x((function(){var e;return Vt(Vt.call)||!Vt(Object)||!Vt((function(){e=!0}))||e}))?function(e){if(!H(e))return!1;switch(Dt(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}return Ut||!!Mt.call(Ot,Le(e))}:Vt,jt=_e("species"),Bt=function(e,t){return new(function(e){var t;return Et(e)&&(t=e.constructor,(Ft(t)&&(t===Array||Et(t.prototype))||G(t)&&null===(t=t[jt]))&&(t=void 0)),void 0===t?Array:t}(e))(0===t?0:t)},Ht=[].push,Gt=function(e){var t=1==e,n=2==e,r=3==e,i=4==e,a=6==e,o=7==e,s=5==e||a;return function(c,u,d,l){for(var h,p,f=se(c),m=F(f),_=wt(u,d,3),v=ot(m),g=0,y=l||Bt,S=t?y(c,v):n||o?y(c,0):void 0;v>g;g++)if((s||g in m)&&(p=_(h=m[g],g,f),e))if(t)S[g]=p;else if(p)switch(e){case 3:return!0;case 5:return h;case 6:return g;case 2:Ht.call(S,h)}else switch(e){case 4:return!1;case 7:Ht.call(S,h)}return a?-1:r||i?i:S}},Jt={forEach:Gt(0),map:Gt(1),filter:Gt(2),some:Gt(3),every:Gt(4),find:Gt(5),findIndex:Gt(6),filterReject:Gt(7)},zt=_e("species"),Wt=function(e){return $>=51||!x((function(){var t=[];return(t.constructor={})[zt]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},qt=Jt.map,Kt=Wt("map");Rt({target:"Array",proto:!0,forced:!Kt},{map:function(e){return qt(this,e,arguments.length>1?arguments[1]:void 0)}});var Qt=Jt.filter,Xt=Wt("filter");Rt({target:"Array",proto:!0,forced:!Xt},{filter:function(e){return Qt(this,e,arguments.length>1?arguments[1]:void 0)}});var $t=Re.f,Yt=x((function(){$t(1)}));Rt({target:"Object",stat:!0,forced:!P||Yt,sham:!P},{getOwnPropertyDescriptor:function(e,t){return $t(B(e),t)}});R((function(e){var t=function(e){var t=Object.prototype,n=t.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",a=r.asyncIterator||"@@asyncIterator",o=r.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(w){s=function(e,t,n){return e[t]=n}}function c(e,t,n,r){var i=t&&t.prototype instanceof l?t:l,a=Object.create(i.prototype),o=new I(r||[]);return a._invoke=function(e,t,n){var r="suspendedStart";return function(i,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw a;return R()}for(n.method=i,n.arg=a;;){var o=n.delegate;if(o){var s=S(o,n);if(s){if(s===d)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var c=u(e,t,n);if("normal"===c.type){if(r=n.done?"completed":"suspendedYield",c.arg===d)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r="completed",n.method="throw",n.arg=c.arg)}}}(e,n,o),a}function u(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(w){return{type:"throw",arg:w}}}e.wrap=c;var d={};function l(){}function h(){}function p(){}var f={};s(f,i,(function(){return this}));var m=Object.getPrototypeOf,_=m&&m(m(T([])));_&&_!==t&&n.call(_,i)&&(f=_);var v=p.prototype=l.prototype=Object.create(f);function g(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function y(e,t){var r;this._invoke=function(i,a){function o(){return new t((function(r,o){!function r(i,a,o,s){var c=u(e[i],e,a);if("throw"!==c.type){var d=c.arg,l=d.value;return l&&"object"==typeof l&&n.call(l,"__await")?t.resolve(l.__await).then((function(e){r("next",e,o,s)}),(function(e){r("throw",e,o,s)})):t.resolve(l).then((function(e){d.value=e,o(d)}),(function(e){return r("throw",e,o,s)}))}s(c.arg)}(i,a,r,o)}))}return r=r?r.then(o,o):o()}}function S(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,S(e,t),"throw"===t.method))return d;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var r=u(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,d;var i=r.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,d):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,d)}function k(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function b(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(k,this),this.reset(!0)}function T(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,a=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return a.next=a}}return{next:R}}function R(){return{value:void 0,done:!0}}return h.prototype=p,s(v,"constructor",p),s(p,"constructor",h),h.displayName=s(p,o,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,s(e,o,"GeneratorFunction")),e.prototype=Object.create(v),e},e.awrap=function(e){return{__await:e}},g(y.prototype),s(y.prototype,a,(function(){return this})),e.AsyncIterator=y,e.async=function(t,n,r,i,a){void 0===a&&(a=Promise);var o=new y(c(t,n,r,i),a);return e.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},g(v),s(v,o,"Generator"),s(v,i,(function(){return this})),s(v,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=T,I.prototype={constructor:I,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(b),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return o.type="throw",o.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),c=n.call(a,"finallyLoc");if(s&&c){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,d):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),b(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;b(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:T(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),d}},e}(e.exports);try{regeneratorRuntime=t}catch(n){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}}));let Zt=!0,en=!0;function tn(e,t,n){const r=e.match(t);return r&&r.length>=n&&parseInt(r[n],10)}function nn(e,t,n){if(!e.RTCPeerConnection)return;const r=e.RTCPeerConnection.prototype,i=r.addEventListener;r.addEventListener=function(e,r){if(e!==t)return i.apply(this,arguments);const a=e=>{const t=n(e);t&&(r.handleEvent?r.handleEvent(t):r(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(r,a),i.apply(this,[e,a])};const a=r.removeEventListener;r.removeEventListener=function(e,n){if(e!==t||!this._eventMap||!this._eventMap[t])return a.apply(this,arguments);if(!this._eventMap[t].has(n))return a.apply(this,arguments);const r=this._eventMap[t].get(n);return this._eventMap[t].delete(n),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,a.apply(this,[e,r])},Object.defineProperty(r,"on"+t,{get(){return this["_on"+t]},set(e){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),e&&this.addEventListener(t,this["_on"+t]=e)},enumerable:!0,configurable:!0})}function rn(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(Zt=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function an(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(en=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function on(){if("object"==typeof window){if(Zt)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function sn(e,t){en&&console.warn(e+" is deprecated, please use "+t+" instead.")}function cn(e){return"[object Object]"===Object.prototype.toString.call(e)}function un(e){return cn(e)?Object.keys(e).reduce((function(t,n){const r=cn(e[n]),i=r?un(e[n]):e[n],a=r&&!Object.keys(i).length;return void 0===i||a?t:Object.assign(t,{[n]:i})}),{}):e}function dn(e,t,n){const r=n?"outbound-rtp":"inbound-rtp",i=new Map;if(null===t)return i;const a=[];return e.forEach(e=>{"track"===e.type&&e.trackIdentifier===t.id&&a.push(e)}),a.forEach(t=>{e.forEach(n=>{n.type===r&&n.trackId===t.id&&function e(t,n,r){n&&!r.has(n.id)&&(r.set(n.id,n),Object.keys(n).forEach(i=>{i.endsWith("Id")?e(t,t.get(n[i]),r):i.endsWith("Ids")&&n[i].forEach(n=>{e(t,t.get(n),r)})}))}(e,n,i)})}),i}const ln=on;function hn(e,t){const n=e&&e.navigator;if(!n.mediaDevices)return;const r=function(e){if("object"!=typeof e||e.mandatory||e.optional)return e;const t={};return Object.keys(e).forEach(n=>{if("require"===n||"advanced"===n||"mediaSource"===n)return;const r="object"==typeof e[n]?e[n]:{ideal:e[n]};void 0!==r.exact&&"number"==typeof r.exact&&(r.min=r.max=r.exact);const i=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==r.ideal){t.optional=t.optional||[];let e={};"number"==typeof r.ideal?(e[i("min",n)]=r.ideal,t.optional.push(e),e={},e[i("max",n)]=r.ideal,t.optional.push(e)):(e[i("",n)]=r.ideal,t.optional.push(e))}void 0!==r.exact&&"number"!=typeof r.exact?(t.mandatory=t.mandatory||{},t.mandatory[i("",n)]=r.exact):["min","max"].forEach(e=>{void 0!==r[e]&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,n)]=r[e])})}),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},i=function(e,i){if(t.version>=61)return i(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"==typeof e.audio){const t=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])};t((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),t(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=r(e.audio)}if(e&&"object"==typeof e.video){let a=e.video.facingMode;a=a&&("object"==typeof a?a:{ideal:a});const o=t.version<66;if(a&&("user"===a.exact||"environment"===a.exact||"user"===a.ideal||"environment"===a.ideal)&&(!n.mediaDevices.getSupportedConstraints||!n.mediaDevices.getSupportedConstraints().facingMode||o)){let t;if(delete e.video.facingMode,"environment"===a.exact||"environment"===a.ideal?t=["back","rear"]:"user"!==a.exact&&"user"!==a.ideal||(t=["front"]),t)return n.mediaDevices.enumerateDevices().then(n=>{let o=(n=n.filter(e=>"videoinput"===e.kind)).find(e=>t.some(t=>e.label.toLowerCase().includes(t)));return!o&&n.length&&t.includes("back")&&(o=n[n.length-1]),o&&(e.video.deviceId=a.exact?{exact:o.deviceId}:{ideal:o.deviceId}),e.video=r(e.video),ln("chrome: "+JSON.stringify(e)),i(e)})}e.video=r(e.video)}return ln("chrome: "+JSON.stringify(e)),i(e)},a=function(e){return t.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(n.getUserMedia=function(e,t,r){i(e,e=>{n.webkitGetUserMedia(e,t,e=>{r&&r(a(e))})})}.bind(n),n.mediaDevices.getUserMedia){const e=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(t){return i(t,t=>e(t).then(e=>{if(t.audio&&!e.getAudioTracks().length||t.video&&!e.getVideoTracks().length)throw e.getTracks().forEach(e=>{e.stop()}),new DOMException("","NotFoundError");return e},e=>Promise.reject(a(e))))}}}function pn(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function fn(e){if("object"==typeof e&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener("addtrack",n=>{let r;r=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===n.track.id):{track:n.track};const i=new Event("track");i.track=n.track,i.receiver=r,i.transceiver={receiver:r},i.streams=[t.stream],this.dispatchEvent(i)}),t.stream.getTracks().forEach(n=>{let r;r=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===n.id):{track:n};const i=new Event("track");i.track=n,i.receiver=r,i.transceiver={receiver:r},i.streams=[t.stream],this.dispatchEvent(i)})},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else nn(e,"track",e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e))}function mn(e){if("object"==typeof e&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){const t=function(e,t){return{track:t,get dtmf(){return void 0===this._dtmf&&("audio"===t.kind?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const n=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){let i=n.apply(this,arguments);return i||(i=t(this,e),this._senders.push(i)),i};const r=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){r.apply(this,arguments);const t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}const n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._senders=this._senders||[],n.apply(this,[e]),e.getTracks().forEach(e=>{this._senders.push(t(this,e))})};const r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._senders=this._senders||[],r.apply(this,[e]),e.getTracks().forEach(e=>{const t=this._senders.find(t=>t.track===e);t&&this._senders.splice(this._senders.indexOf(t),1)})}}else if("object"==typeof e&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function _n(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,n,r]=arguments;if(arguments.length>0&&"function"==typeof e)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof e))return t.apply(this,[]);const i=function(e){const t={};return e.result().forEach(e=>{const n={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach(t=>{n[t]=e.stat(t)}),t[n.id]=n}),t},a=function(e){return new Map(Object.keys(e).map(t=>[t,e[t]]))};if(arguments.length>=2){const r=function(e){n(a(i(e)))};return t.apply(this,[r,e])}return new Promise((e,n)=>{t.apply(this,[function(t){e(a(i(t)))},n])}).then(n,r)}}function vn(e){if(!("object"==typeof e&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver))return;if(!("getStats"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e});const n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){const e=this;return this._pc.getStats().then(t=>dn(t,e.track,!0))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e}),nn(e,"track",e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){const e=this;return this._pc.getStats().then(t=>dn(t,e.track,!1))}}if(!("getStats"in e.RTCRtpSender.prototype)||!("getStats"in e.RTCRtpReceiver.prototype))return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){const e=arguments[0];let t,n,r;return this.getSenders().forEach(n=>{n.track===e&&(t?r=!0:t=n)}),this.getReceivers().forEach(t=>(t.track===e&&(n?r=!0:n=t),t.track===e)),r||t&&n?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():n?n.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return t.apply(this,arguments)}}function gn(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(e=>this._shimmedLocalStreams[e][0])};const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){if(!n)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const r=t.apply(this,arguments);return this._shimmedLocalStreams[n.id]?-1===this._shimmedLocalStreams[n.id].indexOf(r)&&this._shimmedLocalStreams[n.id].push(r):this._shimmedLocalStreams[n.id]=[n,r],r};const n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach(e=>{if(this.getSenders().find(t=>t.track===e))throw new DOMException("Track already exists.","InvalidAccessError")});const t=this.getSenders();n.apply(this,arguments);const r=this.getSenders().filter(e=>-1===t.indexOf(e));this._shimmedLocalStreams[e.id]=[e].concat(r)};const r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],r.apply(this,arguments)};const i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach(t=>{const n=this._shimmedLocalStreams[t].indexOf(e);-1!==n&&this._shimmedLocalStreams[t].splice(n,1),1===this._shimmedLocalStreams[t].length&&delete this._shimmedLocalStreams[t]}),i.apply(this,arguments)}}function yn(e,t){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return gn(e);const n=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){const e=n.apply(this);return this._reverseStreams=this._reverseStreams||{},e.map(e=>this._reverseStreams[e.id])};const r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach(e=>{if(this.getSenders().find(t=>t.track===e))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[t.id]){const n=new e.MediaStream(t.getTracks());this._streams[t.id]=n,this._reverseStreams[n.id]=t,t=n}r.apply(this,[t])};const i=e.RTCPeerConnection.prototype.removeStream;function a(e,t){let n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(t=>{const r=e._reverseStreams[t],i=e._streams[r.id];n=n.replace(new RegExp(i.id,"g"),r.id)}),new RTCSessionDescription({type:t.type,sdp:n})}function o(e,t){let n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(t=>{const r=e._reverseStreams[t],i=e._streams[r.id];n=n.replace(new RegExp(r.id,"g"),i.id)}),new RTCSessionDescription({type:t.type,sdp:n})}e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,n){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const r=[].slice.call(arguments,1);if(1!==r.length||!r[0].getTracks().find(e=>e===t))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");const i=this.getSenders().find(e=>e.track===t);if(i)throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const a=this._streams[n.id];if(a)a.addTrack(t),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const r=new e.MediaStream([t]);this._streams[n.id]=r,this._reverseStreams[r.id]=n,this.addStream(r)}return this.getSenders().find(e=>e.track===t)},["createOffer","createAnswer"].forEach((function(t){const n=e.RTCPeerConnection.prototype[t],r={[t](){const e=arguments;return arguments.length&&"function"==typeof arguments[0]?n.apply(this,[t=>{const n=a(this,t);e[0].apply(null,[n])},t=>{e[1]&&e[1].apply(null,t)},arguments[2]]):n.apply(this,arguments).then(e=>a(this,e))}};e.RTCPeerConnection.prototype[t]=r[t]}));const s=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=o(this,arguments[0]),s.apply(this,arguments)):s.apply(this,arguments)};const c=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get(){const e=c.get.apply(this);return""===e.type?e:a(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(e._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");let t;this._streams=this._streams||{},Object.keys(this._streams).forEach(n=>{this._streams[n].getTracks().find(t=>e.track===t)&&(t=this._streams[n])}),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function Sn(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const n=e.RTCPeerConnection.prototype[t],r={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=r[t]}))}function kn(e,t){nn(e,"negotiationneeded",e=>{const n=e.target;if(!(t.version<72||n.getConfiguration&&"plan-b"===n.getConfiguration().sdpSemantics)||"stable"===n.signalingState)return e})}var bn=Object.freeze({__proto__:null,shimMediaStream:pn,shimOnTrack:fn,shimGetSendersWithDtmf:mn,shimGetStats:_n,shimSenderReceiverGetStats:vn,shimAddTrackRemoveTrackWithNative:gn,shimAddTrackRemoveTrack:yn,shimPeerConnection:Sn,fixNegotiationNeeded:kn,shimGetUserMedia:hn,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof t?e.navigator.mediaDevices.getDisplayMedia=function(n){return t(n).then(t=>{const r=n.video&&n.video.width,i=n.video&&n.video.height,a=n.video&&n.video.frameRate;return n.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:a||3}},r&&(n.video.mandatory.maxWidth=r),i&&(n.video.mandatory.maxHeight=i),e.navigator.mediaDevices.getUserMedia(n)})}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}});var In=R((function(e){var t={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};t.localCName=t.generateIdentifier(),t.splitLines=function(e){return e.trim().split("\n").map((function(e){return e.trim()}))},t.splitSections=function(e){return e.split("\nm=").map((function(e,t){return(t>0?"m="+e:e).trim()+"\r\n"}))},t.getDescription=function(e){var n=t.splitSections(e);return n&&n[0]},t.getMediaSections=function(e){var n=t.splitSections(e);return n.shift(),n},t.matchPrefix=function(e,n){return t.splitLines(e).filter((function(e){return 0===e.indexOf(n)}))},t.parseCandidate=function(e){for(var t,n={foundation:(t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" "))[0],component:parseInt(t[1],10),protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]},r=8;r<t.length;r+=2)switch(t[r]){case"raddr":n.relatedAddress=t[r+1];break;case"rport":n.relatedPort=parseInt(t[r+1],10);break;case"tcptype":n.tcpType=t[r+1];break;case"ufrag":n.ufrag=t[r+1],n.usernameFragment=t[r+1];break;default:n[t[r]]=t[r+1]}return n},t.writeCandidate=function(e){var t=[];t.push(e.foundation),t.push(e.component),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);var n=e.type;return t.push("typ"),t.push(n),"host"!==n&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},t.parseIceOptions=function(e){return e.substr(14).split(" ")},t.parseRtpMap=function(e){var t=e.substr(9).split(" "),n={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),n.name=t[0],n.clockRate=parseInt(t[1],10),n.channels=3===t.length?parseInt(t[2],10):1,n.numChannels=n.channels,n},t.writeRtpMap=function(e){var t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);var n=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==n?"/"+n:"")+"\r\n"},t.parseExtmap=function(e){var t=e.substr(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1]}},t.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},t.parseFmtp=function(e){for(var t,n={},r=e.substr(e.indexOf(" ")+1).split(";"),i=0;i<r.length;i++)n[(t=r[i].trim().split("="))[0].trim()]=t[1];return n},t.writeFmtp=function(e){var t="",n=e.payloadType;if(void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){var r=[];Object.keys(e.parameters).forEach((function(t){e.parameters[t]?r.push(t+"="+e.parameters[t]):r.push(t)})),t+="a=fmtp:"+n+" "+r.join(";")+"\r\n"}return t},t.parseRtcpFb=function(e){var t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},t.writeRtcpFb=function(e){var t="",n=e.payloadType;return void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach((function(e){t+="a=rtcp-fb:"+n+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"})),t},t.parseSsrcMedia=function(e){var t=e.indexOf(" "),n={ssrc:parseInt(e.substr(7,t-7),10)},r=e.indexOf(":",t);return r>-1?(n.attribute=e.substr(t+1,r-t-1),n.value=e.substr(r+1)):n.attribute=e.substr(t+1),n},t.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((function(e){return parseInt(e,10)}))}},t.getMid=function(e){var n=t.matchPrefix(e,"a=mid:")[0];if(n)return n.substr(6)},t.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1]}},t.getDtlsParameters=function(e,n){return{role:"auto",fingerprints:t.matchPrefix(e+n,"a=fingerprint:").map(t.parseFingerprint)}},t.writeDtlsParameters=function(e,t){var n="a=setup:"+t+"\r\n";return e.fingerprints.forEach((function(e){n+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"})),n},t.parseCryptoLine=function(e){var t=e.substr(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},t.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"==typeof e.keyParams?t.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},t.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;var t=e.substr(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}},t.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},t.getCryptoParameters=function(e,n){return t.matchPrefix(e+n,"a=crypto:").map(t.parseCryptoLine)},t.getIceParameters=function(e,n){var r=t.matchPrefix(e+n,"a=ice-ufrag:")[0],i=t.matchPrefix(e+n,"a=ice-pwd:")[0];return r&&i?{usernameFragment:r.substr(12),password:i.substr(10)}:null},t.writeIceParameters=function(e){return"a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n"},t.parseRtpParameters=function(e){for(var n={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},r=t.splitLines(e)[0].split(" "),i=3;i<r.length;i++){var a=r[i],o=t.matchPrefix(e,"a=rtpmap:"+a+" ")[0];if(o){var s=t.parseRtpMap(o),c=t.matchPrefix(e,"a=fmtp:"+a+" ");switch(s.parameters=c.length?t.parseFmtp(c[0]):{},s.rtcpFeedback=t.matchPrefix(e,"a=rtcp-fb:"+a+" ").map(t.parseRtcpFb),n.codecs.push(s),s.name.toUpperCase()){case"RED":case"ULPFEC":n.fecMechanisms.push(s.name.toUpperCase())}}}return t.matchPrefix(e,"a=extmap:").forEach((function(e){n.headerExtensions.push(t.parseExtmap(e))})),n},t.writeRtpDescription=function(e,n){var r="";r+="m="+e+" ",r+=n.codecs.length>0?"9":"0",r+=" UDP/TLS/RTP/SAVPF ",r+=n.codecs.map((function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType})).join(" ")+"\r\n",r+="c=IN IP4 0.0.0.0\r\n",r+="a=rtcp:9 IN IP4 0.0.0.0\r\n",n.codecs.forEach((function(e){r+=t.writeRtpMap(e),r+=t.writeFmtp(e),r+=t.writeRtcpFb(e)}));var i=0;return n.codecs.forEach((function(e){e.maxptime>i&&(i=e.maxptime)})),i>0&&(r+="a=maxptime:"+i+"\r\n"),r+="a=rtcp-mux\r\n",n.headerExtensions&&n.headerExtensions.forEach((function(e){r+=t.writeExtmap(e)})),r},t.parseRtpEncodingParameters=function(e){var n,r=[],i=t.parseRtpParameters(e),a=-1!==i.fecMechanisms.indexOf("RED"),o=-1!==i.fecMechanisms.indexOf("ULPFEC"),s=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute})),c=s.length>0&&s[0].ssrc,u=t.matchPrefix(e,"a=ssrc-group:FID").map((function(e){return e.substr(17).split(" ").map((function(e){return parseInt(e,10)}))}));u.length>0&&u[0].length>1&&u[0][0]===c&&(n=u[0][1]),i.codecs.forEach((function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var t={ssrc:c,codecPayloadType:parseInt(e.parameters.apt,10)};c&&n&&(t.rtx={ssrc:n}),r.push(t),a&&((t=JSON.parse(JSON.stringify(t))).fec={ssrc:c,mechanism:o?"red+ulpfec":"red"},r.push(t))}})),0===r.length&&c&&r.push({ssrc:c});var d=t.matchPrefix(e,"b=");return d.length&&(d=0===d[0].indexOf("b=TIAS:")?parseInt(d[0].substr(7),10):0===d[0].indexOf("b=AS:")?1e3*parseInt(d[0].substr(5),10)*.95-16e3:void 0,r.forEach((function(e){e.maxBitrate=d}))),r},t.parseRtcpParameters=function(e){var n={},r=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute}))[0];r&&(n.cname=r.value,n.ssrc=r.ssrc);var i=t.matchPrefix(e,"a=rtcp-rsize");n.reducedSize=i.length>0,n.compound=0===i.length;var a=t.matchPrefix(e,"a=rtcp-mux");return n.mux=a.length>0,n},t.parseMsid=function(e){var n,r=t.matchPrefix(e,"a=msid:");if(1===r.length)return{stream:(n=r[0].substr(7).split(" "))[0],track:n[1]};var i=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"msid"===e.attribute}));return i.length>0?{stream:(n=i[0].value.split(" "))[0],track:n[1]}:void 0},t.parseSctpDescription=function(e){var n,r=t.parseMLine(e),i=t.matchPrefix(e,"a=max-message-size:");i.length>0&&(n=parseInt(i[0].substr(19),10)),isNaN(n)&&(n=65536);var a=t.matchPrefix(e,"a=sctp-port:");if(a.length>0)return{port:parseInt(a[0].substr(12),10),protocol:r.fmt,maxMessageSize:n};if(t.matchPrefix(e,"a=sctpmap:").length>0){var o=t.matchPrefix(e,"a=sctpmap:")[0].substr(10).split(" ");return{port:parseInt(o[0],10),protocol:o[1],maxMessageSize:n}}},t.writeSctpDescription=function(e,t){var n=[];return n="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&n.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),n.join("")},t.generateSessionId=function(){return Math.random().toString().substr(2,21)},t.writeSessionBoilerplate=function(e,n,r){var i=void 0!==n?n:2;return"v=0\r\no="+(r||"thisisadapterortc")+" "+(e||t.generateSessionId())+" "+i+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},t.writeMediaSection=function(e,n,r,i){var a=t.writeRtpDescription(e.kind,n);if(a+=t.writeIceParameters(e.iceGatherer.getLocalParameters()),a+=t.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===r?"actpass":"active"),a+="a=mid:"+e.mid+"\r\n",e.direction?a+="a="+e.direction+"\r\n":e.rtpSender&&e.rtpReceiver?a+="a=sendrecv\r\n":e.rtpSender?a+="a=sendonly\r\n":e.rtpReceiver?a+="a=recvonly\r\n":a+="a=inactive\r\n",e.rtpSender){var o="msid:"+i.id+" "+e.rtpSender.track.id+"\r\n";a+="a="+o,a+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+o,e.sendEncodingParameters[0].rtx&&(a+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+o,a+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return a+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+t.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(a+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+t.localCName+"\r\n"),a},t.getDirection=function(e,n){for(var r=t.splitLines(e),i=0;i<r.length;i++)switch(r[i]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return r[i].substr(2)}return n?t.getDirection(n):"sendrecv"},t.getKind=function(e){return t.splitLines(e)[0].split(" ")[0].substr(2)},t.isRejected=function(e){return"0"===e.split(" ",2)[1]},t.parseMLine=function(e){var n=t.splitLines(e)[0].substr(2).split(" ");return{kind:n[0],port:parseInt(n[1],10),protocol:n[2],fmt:n.slice(3).join(" ")}},t.parseOLine=function(e){var n=t.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:n[0],sessionId:n[1],sessionVersion:parseInt(n[2],10),netType:n[3],addressType:n[4],address:n[5]}},t.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var n=t.splitLines(e),r=0;r<n.length;r++)if(n[r].length<2||"="!==n[r].charAt(1))return!1;return!0},e.exports=t}));function Tn(e,t,n,r,i){var a=In.writeRtpDescription(e.kind,t);if(a+=In.writeIceParameters(e.iceGatherer.getLocalParameters()),a+=In.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===n?"actpass":i||"active"),a+="a=mid:"+e.mid+"\r\n",e.rtpSender&&e.rtpReceiver?a+="a=sendrecv\r\n":e.rtpSender?a+="a=sendonly\r\n":e.rtpReceiver?a+="a=recvonly\r\n":a+="a=inactive\r\n",e.rtpSender){var o=e.rtpSender._initialTrackId||e.rtpSender.track.id;e.rtpSender._initialTrackId=o;var s="msid:"+(r?r.id:"-")+" "+o+"\r\n";a+="a="+s,a+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+s,e.sendEncodingParameters[0].rtx&&(a+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+s,a+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return a+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+In.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(a+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+In.localCName+"\r\n"),a}function Rn(e,t){var n={codecs:[],headerExtensions:[],fecMechanisms:[]},r=function(e,t){e=parseInt(e,10);for(var n=0;n<t.length;n++)if(t[n].payloadType===e||t[n].preferredPayloadType===e)return t[n]},i=function(e,t,n,i){var a=r(e.parameters.apt,n),o=r(t.parameters.apt,i);return a&&o&&a.name.toLowerCase()===o.name.toLowerCase()};return e.codecs.forEach((function(r){for(var a=0;a<t.codecs.length;a++){var o=t.codecs[a];if(r.name.toLowerCase()===o.name.toLowerCase()&&r.clockRate===o.clockRate){if("rtx"===r.name.toLowerCase()&&r.parameters&&o.parameters.apt&&!i(r,o,e.codecs,t.codecs))continue;(o=JSON.parse(JSON.stringify(o))).numChannels=Math.min(r.numChannels,o.numChannels),n.codecs.push(o),o.rtcpFeedback=o.rtcpFeedback.filter((function(e){for(var t=0;t<r.rtcpFeedback.length;t++)if(r.rtcpFeedback[t].type===e.type&&r.rtcpFeedback[t].parameter===e.parameter)return!0;return!1}));break}}})),e.headerExtensions.forEach((function(e){for(var r=0;r<t.headerExtensions.length;r++){var i=t.headerExtensions[r];if(e.uri===i.uri){n.headerExtensions.push(i);break}}})),n}function wn(e,t,n){return-1!=={offer:{setLocalDescription:["stable","have-local-offer"],setRemoteDescription:["stable","have-remote-offer"]},answer:{setLocalDescription:["have-remote-offer","have-local-pranswer"],setRemoteDescription:["have-local-offer","have-remote-pranswer"]}}[t][e].indexOf(n)}function En(e,t){var n=e.getRemoteCandidates().find((function(e){return t.foundation===e.foundation&&t.ip===e.ip&&t.port===e.port&&t.priority===e.priority&&t.protocol===e.protocol&&t.type===e.type}));return n||e.addRemoteCandidate(t),!n}function Cn(e,t){var n=new Error(t);return n.name=e,n.code={NotSupportedError:9,InvalidStateError:11,InvalidAccessError:15,TypeError:void 0,OperationError:void 0}[e],n}var An=function(e,t){function n(t,n){n.addTrack(t),n.dispatchEvent(new e.MediaStreamTrackEvent("addtrack",{track:t}))}function r(t,n,r,i){var a=new Event("track");a.track=n,a.receiver=r,a.transceiver={receiver:r},a.streams=i,e.setTimeout((function(){t._dispatchEvent("track",a)}))}var i=function(n){var r=this,i=document.createDocumentFragment();if(["addEventListener","removeEventListener","dispatchEvent"].forEach((function(e){r[e]=i[e].bind(i)})),this.canTrickleIceCandidates=null,this.needNegotiation=!1,this.localStreams=[],this.remoteStreams=[],this._localDescription=null,this._remoteDescription=null,this.signalingState="stable",this.iceConnectionState="new",this.connectionState="new",this.iceGatheringState="new",n=JSON.parse(JSON.stringify(n||{})),this.usingBundle="max-bundle"===n.bundlePolicy,"negotiate"===n.rtcpMuxPolicy)throw Cn("NotSupportedError","rtcpMuxPolicy 'negotiate' is not supported");switch(n.rtcpMuxPolicy||(n.rtcpMuxPolicy="require"),n.iceTransportPolicy){case"all":case"relay":break;default:n.iceTransportPolicy="all"}switch(n.bundlePolicy){case"balanced":case"max-compat":case"max-bundle":break;default:n.bundlePolicy="balanced"}if(n.iceServers=function(e,t){var n=!1;return(e=JSON.parse(JSON.stringify(e))).filter((function(e){if(e&&(e.urls||e.url)){var r=e.urls||e.url;e.url&&!e.urls&&console.warn("RTCIceServer.url is deprecated! Use urls instead.");var i="string"==typeof r;return i&&(r=[r]),r=r.filter((function(e){return 0===e.indexOf("turn:")&&-1!==e.indexOf("transport=udp")&&-1===e.indexOf("turn:[")&&!n?(n=!0,!0):0===e.indexOf("stun:")&&t>=14393&&-1===e.indexOf("?transport=udp")})),delete e.url,e.urls=i?r[0]:r,!!r.length}}))}(n.iceServers||[],t),this._iceGatherers=[],n.iceCandidatePoolSize)for(var a=n.iceCandidatePoolSize;a>0;a--)this._iceGatherers.push(new e.RTCIceGatherer({iceServers:n.iceServers,gatherPolicy:n.iceTransportPolicy}));else n.iceCandidatePoolSize=0;this._config=n,this.transceivers=[],this._sdpSessionId=In.generateSessionId(),this._sdpSessionVersion=0,this._dtlsRole=void 0,this._isClosed=!1};Object.defineProperty(i.prototype,"localDescription",{configurable:!0,get:function(){return this._localDescription}}),Object.defineProperty(i.prototype,"remoteDescription",{configurable:!0,get:function(){return this._remoteDescription}}),i.prototype.onicecandidate=null,i.prototype.onaddstream=null,i.prototype.ontrack=null,i.prototype.onremovestream=null,i.prototype.onsignalingstatechange=null,i.prototype.oniceconnectionstatechange=null,i.prototype.onconnectionstatechange=null,i.prototype.onicegatheringstatechange=null,i.prototype.onnegotiationneeded=null,i.prototype.ondatachannel=null,i.prototype._dispatchEvent=function(e,t){this._isClosed||(this.dispatchEvent(t),"function"==typeof this["on"+e]&&this["on"+e](t))},i.prototype._emitGatheringStateChange=function(){var e=new Event("icegatheringstatechange");this._dispatchEvent("icegatheringstatechange",e)},i.prototype.getConfiguration=function(){return this._config},i.prototype.getLocalStreams=function(){return this.localStreams},i.prototype.getRemoteStreams=function(){return this.remoteStreams},i.prototype._createTransceiver=function(e,t){var n=this.transceivers.length>0,r={track:null,iceGatherer:null,iceTransport:null,dtlsTransport:null,localCapabilities:null,remoteCapabilities:null,rtpSender:null,rtpReceiver:null,kind:e,mid:null,sendEncodingParameters:null,recvEncodingParameters:null,stream:null,associatedRemoteMediaStreams:[],wantReceive:!0};if(this.usingBundle&&n)r.iceTransport=this.transceivers[0].iceTransport,r.dtlsTransport=this.transceivers[0].dtlsTransport;else{var i=this._createIceAndDtlsTransports();r.iceTransport=i.iceTransport,r.dtlsTransport=i.dtlsTransport}return t||this.transceivers.push(r),r},i.prototype.addTrack=function(t,n){if(this._isClosed)throw Cn("InvalidStateError","Attempted to call addTrack on a closed peerconnection.");var r;if(this.transceivers.find((function(e){return e.track===t})))throw Cn("InvalidAccessError","Track already exists.");for(var i=0;i<this.transceivers.length;i++)this.transceivers[i].track||this.transceivers[i].kind!==t.kind||(r=this.transceivers[i]);return r||(r=this._createTransceiver(t.kind)),this._maybeFireNegotiationNeeded(),-1===this.localStreams.indexOf(n)&&this.localStreams.push(n),r.track=t,r.stream=n,r.rtpSender=new e.RTCRtpSender(t,r.dtlsTransport),r.rtpSender},i.prototype.addStream=function(e){var n=this;if(t>=15025)e.getTracks().forEach((function(t){n.addTrack(t,e)}));else{var r=e.clone();e.getTracks().forEach((function(e,t){var n=r.getTracks()[t];e.addEventListener("enabled",(function(e){n.enabled=e.enabled}))})),r.getTracks().forEach((function(e){n.addTrack(e,r)}))}},i.prototype.removeTrack=function(t){if(this._isClosed)throw Cn("InvalidStateError","Attempted to call removeTrack on a closed peerconnection.");if(!(t instanceof e.RTCRtpSender))throw new TypeError("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.");var n=this.transceivers.find((function(e){return e.rtpSender===t}));if(!n)throw Cn("InvalidAccessError","Sender was not created by this connection.");var r=n.stream;n.rtpSender.stop(),n.rtpSender=null,n.track=null,n.stream=null,-1===this.transceivers.map((function(e){return e.stream})).indexOf(r)&&this.localStreams.indexOf(r)>-1&&this.localStreams.splice(this.localStreams.indexOf(r),1),this._maybeFireNegotiationNeeded()},i.prototype.removeStream=function(e){var t=this;e.getTracks().forEach((function(e){var n=t.getSenders().find((function(t){return t.track===e}));n&&t.removeTrack(n)}))},i.prototype.getSenders=function(){return this.transceivers.filter((function(e){return!!e.rtpSender})).map((function(e){return e.rtpSender}))},i.prototype.getReceivers=function(){return this.transceivers.filter((function(e){return!!e.rtpReceiver})).map((function(e){return e.rtpReceiver}))},i.prototype._createIceGatherer=function(t,n){var r=this;if(n&&t>0)return this.transceivers[0].iceGatherer;if(this._iceGatherers.length)return this._iceGatherers.shift();var i=new e.RTCIceGatherer({iceServers:this._config.iceServers,gatherPolicy:this._config.iceTransportPolicy});return Object.defineProperty(i,"state",{value:"new",writable:!0}),this.transceivers[t].bufferedCandidateEvents=[],this.transceivers[t].bufferCandidates=function(e){var n=!e.candidate||0===Object.keys(e.candidate).length;i.state=n?"completed":"gathering",null!==r.transceivers[t].bufferedCandidateEvents&&r.transceivers[t].bufferedCandidateEvents.push(e)},i.addEventListener("localcandidate",this.transceivers[t].bufferCandidates),i},i.prototype._gather=function(t,n){var r=this,i=this.transceivers[n].iceGatherer;if(!i.onlocalcandidate){var a=this.transceivers[n].bufferedCandidateEvents;this.transceivers[n].bufferedCandidateEvents=null,i.removeEventListener("localcandidate",this.transceivers[n].bufferCandidates),i.onlocalcandidate=function(e){if(!(r.usingBundle&&n>0)){var a=new Event("icecandidate");a.candidate={sdpMid:t,sdpMLineIndex:n};var o=e.candidate,s=!o||0===Object.keys(o).length;if(s)"new"!==i.state&&"gathering"!==i.state||(i.state="completed");else{"new"===i.state&&(i.state="gathering"),o.component=1,o.ufrag=i.getLocalParameters().usernameFragment;var c=In.writeCandidate(o);a.candidate=Object.assign(a.candidate,In.parseCandidate(c)),a.candidate.candidate=c,a.candidate.toJSON=function(){return{candidate:a.candidate.candidate,sdpMid:a.candidate.sdpMid,sdpMLineIndex:a.candidate.sdpMLineIndex,usernameFragment:a.candidate.usernameFragment}}}var u=In.getMediaSections(r._localDescription.sdp);u[a.candidate.sdpMLineIndex]+=s?"a=end-of-candidates\r\n":"a="+a.candidate.candidate+"\r\n",r._localDescription.sdp=In.getDescription(r._localDescription.sdp)+u.join("");var d=r.transceivers.every((function(e){return e.iceGatherer&&"completed"===e.iceGatherer.state}));"gathering"!==r.iceGatheringState&&(r.iceGatheringState="gathering",r._emitGatheringStateChange()),s||r._dispatchEvent("icecandidate",a),d&&(r._dispatchEvent("icecandidate",new Event("icecandidate")),r.iceGatheringState="complete",r._emitGatheringStateChange())}},e.setTimeout((function(){a.forEach((function(e){i.onlocalcandidate(e)}))}),0)}},i.prototype._createIceAndDtlsTransports=function(){var t=this,n=new e.RTCIceTransport(null);n.onicestatechange=function(){t._updateIceConnectionState(),t._updateConnectionState()};var r=new e.RTCDtlsTransport(n);return r.ondtlsstatechange=function(){t._updateConnectionState()},r.onerror=function(){Object.defineProperty(r,"state",{value:"failed",writable:!0}),t._updateConnectionState()},{iceTransport:n,dtlsTransport:r}},i.prototype._disposeIceAndDtlsTransports=function(e){var t=this.transceivers[e].iceGatherer;t&&(delete t.onlocalcandidate,delete this.transceivers[e].iceGatherer);var n=this.transceivers[e].iceTransport;n&&(delete n.onicestatechange,delete this.transceivers[e].iceTransport);var r=this.transceivers[e].dtlsTransport;r&&(delete r.ondtlsstatechange,delete r.onerror,delete this.transceivers[e].dtlsTransport)},i.prototype._transceive=function(e,n,r){var i=Rn(e.localCapabilities,e.remoteCapabilities);n&&e.rtpSender&&(i.encodings=e.sendEncodingParameters,i.rtcp={cname:In.localCName,compound:e.rtcpParameters.compound},e.recvEncodingParameters.length&&(i.rtcp.ssrc=e.recvEncodingParameters[0].ssrc),e.rtpSender.send(i)),r&&e.rtpReceiver&&i.codecs.length>0&&("video"===e.kind&&e.recvEncodingParameters&&t<15019&&e.recvEncodingParameters.forEach((function(e){delete e.rtx})),e.recvEncodingParameters.length?i.encodings=e.recvEncodingParameters:i.encodings=[{}],i.rtcp={compound:e.rtcpParameters.compound},e.rtcpParameters.cname&&(i.rtcp.cname=e.rtcpParameters.cname),e.sendEncodingParameters.length&&(i.rtcp.ssrc=e.sendEncodingParameters[0].ssrc),e.rtpReceiver.receive(i))},i.prototype.setLocalDescription=function(e){var t,n,r=this;if(-1===["offer","answer"].indexOf(e.type))return Promise.reject(Cn("TypeError",'Unsupported type "'+e.type+'"'));if(!wn("setLocalDescription",e.type,r.signalingState)||r._isClosed)return Promise.reject(Cn("InvalidStateError","Can not set local "+e.type+" in state "+r.signalingState));if("offer"===e.type)t=In.splitSections(e.sdp),n=t.shift(),t.forEach((function(e,t){var n=In.parseRtpParameters(e);r.transceivers[t].localCapabilities=n})),r.transceivers.forEach((function(e,t){r._gather(e.mid,t)}));else if("answer"===e.type){t=In.splitSections(r._remoteDescription.sdp),n=t.shift();var i=In.matchPrefix(n,"a=ice-lite").length>0;t.forEach((function(e,t){var a=r.transceivers[t],o=a.iceGatherer,s=a.iceTransport,c=a.dtlsTransport,u=a.localCapabilities,d=a.remoteCapabilities;if(!(In.isRejected(e)&&0===In.matchPrefix(e,"a=bundle-only").length)&&!a.rejected){var l=In.getIceParameters(e,n),h=In.getDtlsParameters(e,n);i&&(h.role="server"),r.usingBundle&&0!==t||(r._gather(a.mid,t),"new"===s.state&&s.start(o,l,i?"controlling":"controlled"),"new"===c.state&&c.start(h));var p=Rn(u,d);r._transceive(a,p.codecs.length>0,!1)}}))}return r._localDescription={type:e.type,sdp:e.sdp},"offer"===e.type?r._updateSignalingState("have-local-offer"):r._updateSignalingState("stable"),Promise.resolve()},i.prototype.setRemoteDescription=function(i){var a=this;if(-1===["offer","answer"].indexOf(i.type))return Promise.reject(Cn("TypeError",'Unsupported type "'+i.type+'"'));if(!wn("setRemoteDescription",i.type,a.signalingState)||a._isClosed)return Promise.reject(Cn("InvalidStateError","Can not set remote "+i.type+" in state "+a.signalingState));var o={};a.remoteStreams.forEach((function(e){o[e.id]=e}));var s=[],c=In.splitSections(i.sdp),u=c.shift(),d=In.matchPrefix(u,"a=ice-lite").length>0,l=In.matchPrefix(u,"a=group:BUNDLE ").length>0;a.usingBundle=l;var h=In.matchPrefix(u,"a=ice-options:")[0];return a.canTrickleIceCandidates=!!h&&h.substr(14).split(" ").indexOf("trickle")>=0,c.forEach((function(r,c){var h=In.splitLines(r),p=In.getKind(r),f=In.isRejected(r)&&0===In.matchPrefix(r,"a=bundle-only").length,m=h[0].substr(2).split(" ")[2],_=In.getDirection(r,u),v=In.parseMsid(r),g=In.getMid(r)||In.generateIdentifier();if(f||"application"===p&&("DTLS/SCTP"===m||"UDP/DTLS/SCTP"===m))a.transceivers[c]={mid:g,kind:p,protocol:m,rejected:!0};else{var y,S,k,b,I,T,R,w,E;!f&&a.transceivers[c]&&a.transceivers[c].rejected&&(a.transceivers[c]=a._createTransceiver(p,!0));var C,A,x=In.parseRtpParameters(r);f||(C=In.getIceParameters(r,u),(A=In.getDtlsParameters(r,u)).role="client"),R=In.parseRtpEncodingParameters(r);var P=In.parseRtcpParameters(r),D=In.matchPrefix(r,"a=end-of-candidates",u).length>0,N=In.matchPrefix(r,"a=candidate:").map((function(e){return In.parseCandidate(e)})).filter((function(e){return 1===e.component}));if(("offer"===i.type||"answer"===i.type)&&!f&&l&&c>0&&a.transceivers[c]&&(a._disposeIceAndDtlsTransports(c),a.transceivers[c].iceGatherer=a.transceivers[0].iceGatherer,a.transceivers[c].iceTransport=a.transceivers[0].iceTransport,a.transceivers[c].dtlsTransport=a.transceivers[0].dtlsTransport,a.transceivers[c].rtpSender&&a.transceivers[c].rtpSender.setTransport(a.transceivers[0].dtlsTransport),a.transceivers[c].rtpReceiver&&a.transceivers[c].rtpReceiver.setTransport(a.transceivers[0].dtlsTransport)),"offer"!==i.type||f){if("answer"===i.type&&!f){S=(y=a.transceivers[c]).iceGatherer,k=y.iceTransport,b=y.dtlsTransport,I=y.rtpReceiver,T=y.sendEncodingParameters,w=y.localCapabilities,a.transceivers[c].recvEncodingParameters=R,a.transceivers[c].remoteCapabilities=x,a.transceivers[c].rtcpParameters=P,N.length&&"new"===k.state&&(!d&&!D||l&&0!==c?N.forEach((function(e){En(y.iceTransport,e)})):k.setRemoteCandidates(N)),l&&0!==c||("new"===k.state&&k.start(S,C,"controlling"),"new"===b.state&&b.start(A)),!Rn(y.localCapabilities,y.remoteCapabilities).codecs.filter((function(e){return"rtx"===e.name.toLowerCase()})).length&&y.sendEncodingParameters[0].rtx&&delete y.sendEncodingParameters[0].rtx,a._transceive(y,"sendrecv"===_||"recvonly"===_,"sendrecv"===_||"sendonly"===_),!I||"sendrecv"!==_&&"sendonly"!==_?delete y.rtpReceiver:(E=I.track,v?(o[v.stream]||(o[v.stream]=new e.MediaStream),n(E,o[v.stream]),s.push([E,I,o[v.stream]])):(o.default||(o.default=new e.MediaStream),n(E,o.default),s.push([E,I,o.default])))}}else{(y=a.transceivers[c]||a._createTransceiver(p)).mid=g,y.iceGatherer||(y.iceGatherer=a._createIceGatherer(c,l)),N.length&&"new"===y.iceTransport.state&&(!D||l&&0!==c?N.forEach((function(e){En(y.iceTransport,e)})):y.iceTransport.setRemoteCandidates(N)),w=e.RTCRtpReceiver.getCapabilities(p),t<15019&&(w.codecs=w.codecs.filter((function(e){return"rtx"!==e.name}))),T=y.sendEncodingParameters||[{ssrc:1001*(2*c+2)}];var L,O=!1;if("sendrecv"===_||"sendonly"===_){if(O=!y.rtpReceiver,I=y.rtpReceiver||new e.RTCRtpReceiver(y.dtlsTransport,p),O)E=I.track,v&&"-"===v.stream||(v?(o[v.stream]||(o[v.stream]=new e.MediaStream,Object.defineProperty(o[v.stream],"id",{get:function(){return v.stream}})),Object.defineProperty(E,"id",{get:function(){return v.track}}),L=o[v.stream]):(o.default||(o.default=new e.MediaStream),L=o.default)),L&&(n(E,L),y.associatedRemoteMediaStreams.push(L)),s.push([E,I,L])}else y.rtpReceiver&&y.rtpReceiver.track&&(y.associatedRemoteMediaStreams.forEach((function(t){var n=t.getTracks().find((function(e){return e.id===y.rtpReceiver.track.id}));n&&function(t,n){n.removeTrack(t),n.dispatchEvent(new e.MediaStreamTrackEvent("removetrack",{track:t}))}(n,t)})),y.associatedRemoteMediaStreams=[]);y.localCapabilities=w,y.remoteCapabilities=x,y.rtpReceiver=I,y.rtcpParameters=P,y.sendEncodingParameters=T,y.recvEncodingParameters=R,a._transceive(a.transceivers[c],!1,O)}}})),void 0===a._dtlsRole&&(a._dtlsRole="offer"===i.type?"active":"passive"),a._remoteDescription={type:i.type,sdp:i.sdp},"offer"===i.type?a._updateSignalingState("have-remote-offer"):a._updateSignalingState("stable"),Object.keys(o).forEach((function(t){var n=o[t];if(n.getTracks().length){if(-1===a.remoteStreams.indexOf(n)){a.remoteStreams.push(n);var i=new Event("addstream");i.stream=n,e.setTimeout((function(){a._dispatchEvent("addstream",i)}))}s.forEach((function(e){var t=e[0],i=e[1];n.id===e[2].id&&r(a,t,i,[n])}))}})),s.forEach((function(e){e[2]||r(a,e[0],e[1],[])})),e.setTimeout((function(){a&&a.transceivers&&a.transceivers.forEach((function(e){e.iceTransport&&"new"===e.iceTransport.state&&e.iceTransport.getRemoteCandidates().length>0&&(console.warn("Timeout for addRemoteCandidate. Consider sending an end-of-candidates notification"),e.iceTransport.addRemoteCandidate({}))}))}),4e3),Promise.resolve()},i.prototype.close=function(){this.transceivers.forEach((function(e){e.iceTransport&&e.iceTransport.stop(),e.dtlsTransport&&e.dtlsTransport.stop(),e.rtpSender&&e.rtpSender.stop(),e.rtpReceiver&&e.rtpReceiver.stop()})),this._isClosed=!0,this._updateSignalingState("closed")},i.prototype._updateSignalingState=function(e){this.signalingState=e;var t=new Event("signalingstatechange");this._dispatchEvent("signalingstatechange",t)},i.prototype._maybeFireNegotiationNeeded=function(){var t=this;"stable"===this.signalingState&&!0!==this.needNegotiation&&(this.needNegotiation=!0,e.setTimeout((function(){if(t.needNegotiation){t.needNegotiation=!1;var e=new Event("negotiationneeded");t._dispatchEvent("negotiationneeded",e)}}),0))},i.prototype._updateIceConnectionState=function(){var e,t={new:0,closed:0,checking:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach((function(e){e.iceTransport&&!e.rejected&&t[e.iceTransport.state]++})),e="new",t.failed>0?e="failed":t.checking>0?e="checking":t.disconnected>0?e="disconnected":t.new>0?e="new":t.connected>0?e="connected":t.completed>0&&(e="completed"),e!==this.iceConnectionState){this.iceConnectionState=e;var n=new Event("iceconnectionstatechange");this._dispatchEvent("iceconnectionstatechange",n)}},i.prototype._updateConnectionState=function(){var e,t={new:0,closed:0,connecting:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach((function(e){e.iceTransport&&e.dtlsTransport&&!e.rejected&&(t[e.iceTransport.state]++,t[e.dtlsTransport.state]++)})),t.connected+=t.completed,e="new",t.failed>0?e="failed":t.connecting>0?e="connecting":t.disconnected>0?e="disconnected":t.new>0?e="new":t.connected>0&&(e="connected"),e!==this.connectionState){this.connectionState=e;var n=new Event("connectionstatechange");this._dispatchEvent("connectionstatechange",n)}},i.prototype.createOffer=function(){var n=this;if(n._isClosed)return Promise.reject(Cn("InvalidStateError","Can not call createOffer after close"));var r=n.transceivers.filter((function(e){return"audio"===e.kind})).length,i=n.transceivers.filter((function(e){return"video"===e.kind})).length,a=arguments[0];if(a){if(a.mandatory||a.optional)throw new TypeError("Legacy mandatory/optional constraints not supported.");void 0!==a.offerToReceiveAudio&&(r=!0===a.offerToReceiveAudio?1:!1===a.offerToReceiveAudio?0:a.offerToReceiveAudio),void 0!==a.offerToReceiveVideo&&(i=!0===a.offerToReceiveVideo?1:!1===a.offerToReceiveVideo?0:a.offerToReceiveVideo)}for(n.transceivers.forEach((function(e){"audio"===e.kind?--r<0&&(e.wantReceive=!1):"video"===e.kind&&--i<0&&(e.wantReceive=!1)}));r>0||i>0;)r>0&&(n._createTransceiver("audio"),r--),i>0&&(n._createTransceiver("video"),i--);var o=In.writeSessionBoilerplate(n._sdpSessionId,n._sdpSessionVersion++);n.transceivers.forEach((function(r,i){var a=r.track,o=r.kind,s=r.mid||In.generateIdentifier();r.mid=s,r.iceGatherer||(r.iceGatherer=n._createIceGatherer(i,n.usingBundle));var c=e.RTCRtpSender.getCapabilities(o);t<15019&&(c.codecs=c.codecs.filter((function(e){return"rtx"!==e.name}))),c.codecs.forEach((function(e){"H264"===e.name&&void 0===e.parameters["level-asymmetry-allowed"]&&(e.parameters["level-asymmetry-allowed"]="1"),r.remoteCapabilities&&r.remoteCapabilities.codecs&&r.remoteCapabilities.codecs.forEach((function(t){e.name.toLowerCase()===t.name.toLowerCase()&&e.clockRate===t.clockRate&&(e.preferredPayloadType=t.payloadType)}))})),c.headerExtensions.forEach((function(e){(r.remoteCapabilities&&r.remoteCapabilities.headerExtensions||[]).forEach((function(t){e.uri===t.uri&&(e.id=t.id)}))}));var u=r.sendEncodingParameters||[{ssrc:1001*(2*i+1)}];a&&t>=15019&&"video"===o&&!u[0].rtx&&(u[0].rtx={ssrc:u[0].ssrc+1}),r.wantReceive&&(r.rtpReceiver=new e.RTCRtpReceiver(r.dtlsTransport,o)),r.localCapabilities=c,r.sendEncodingParameters=u})),"max-compat"!==n._config.bundlePolicy&&(o+="a=group:BUNDLE "+n.transceivers.map((function(e){return e.mid})).join(" ")+"\r\n"),o+="a=ice-options:trickle\r\n",n.transceivers.forEach((function(e,t){o+=Tn(e,e.localCapabilities,"offer",e.stream,n._dtlsRole),o+="a=rtcp-rsize\r\n",!e.iceGatherer||"new"===n.iceGatheringState||0!==t&&n.usingBundle||(e.iceGatherer.getLocalCandidates().forEach((function(e){e.component=1,o+="a="+In.writeCandidate(e)+"\r\n"})),"completed"===e.iceGatherer.state&&(o+="a=end-of-candidates\r\n"))}));var s=new e.RTCSessionDescription({type:"offer",sdp:o});return Promise.resolve(s)},i.prototype.createAnswer=function(){var n=this;if(n._isClosed)return Promise.reject(Cn("InvalidStateError","Can not call createAnswer after close"));if("have-remote-offer"!==n.signalingState&&"have-local-pranswer"!==n.signalingState)return Promise.reject(Cn("InvalidStateError","Can not call createAnswer in signalingState "+n.signalingState));var r=In.writeSessionBoilerplate(n._sdpSessionId,n._sdpSessionVersion++);n.usingBundle&&(r+="a=group:BUNDLE "+n.transceivers.map((function(e){return e.mid})).join(" ")+"\r\n"),r+="a=ice-options:trickle\r\n";var i=In.getMediaSections(n._remoteDescription.sdp).length;n.transceivers.forEach((function(e,a){if(!(a+1>i)){if(e.rejected)return"application"===e.kind?"DTLS/SCTP"===e.protocol?r+="m=application 0 DTLS/SCTP 5000\r\n":r+="m=application 0 "+e.protocol+" webrtc-datachannel\r\n":"audio"===e.kind?r+="m=audio 0 UDP/TLS/RTP/SAVPF 0\r\na=rtpmap:0 PCMU/8000\r\n":"video"===e.kind&&(r+="m=video 0 UDP/TLS/RTP/SAVPF 120\r\na=rtpmap:120 VP8/90000\r\n"),void(r+="c=IN IP4 0.0.0.0\r\na=inactive\r\na=mid:"+e.mid+"\r\n");var o;if(e.stream)"audio"===e.kind?o=e.stream.getAudioTracks()[0]:"video"===e.kind&&(o=e.stream.getVideoTracks()[0]),o&&t>=15019&&"video"===e.kind&&!e.sendEncodingParameters[0].rtx&&(e.sendEncodingParameters[0].rtx={ssrc:e.sendEncodingParameters[0].ssrc+1});var s=Rn(e.localCapabilities,e.remoteCapabilities);!s.codecs.filter((function(e){return"rtx"===e.name.toLowerCase()})).length&&e.sendEncodingParameters[0].rtx&&delete e.sendEncodingParameters[0].rtx,r+=Tn(e,s,"answer",e.stream,n._dtlsRole),e.rtcpParameters&&e.rtcpParameters.reducedSize&&(r+="a=rtcp-rsize\r\n")}}));var a=new e.RTCSessionDescription({type:"answer",sdp:r});return Promise.resolve(a)},i.prototype.addIceCandidate=function(e){var t,n=this;return e&&void 0===e.sdpMLineIndex&&!e.sdpMid?Promise.reject(new TypeError("sdpMLineIndex or sdpMid required")):new Promise((function(r,i){if(!n._remoteDescription)return i(Cn("InvalidStateError","Can not add ICE candidate without a remote description"));if(e&&""!==e.candidate){var a=e.sdpMLineIndex;if(e.sdpMid)for(var o=0;o<n.transceivers.length;o++)if(n.transceivers[o].mid===e.sdpMid){a=o;break}var s=n.transceivers[a];if(!s)return i(Cn("OperationError","Can not add ICE candidate"));if(s.rejected)return r();var c=Object.keys(e.candidate).length>0?In.parseCandidate(e.candidate):{};if("tcp"===c.protocol&&(0===c.port||9===c.port))return r();if(c.component&&1!==c.component)return r();if((0===a||a>0&&s.iceTransport!==n.transceivers[0].iceTransport)&&!En(s.iceTransport,c))return i(Cn("OperationError","Can not add ICE candidate"));var u=e.candidate.trim();0===u.indexOf("a=")&&(u=u.substr(2)),(t=In.getMediaSections(n._remoteDescription.sdp))[a]+="a="+(c.type?u:"end-of-candidates")+"\r\n",n._remoteDescription.sdp=In.getDescription(n._remoteDescription.sdp)+t.join("")}else for(var d=0;d<n.transceivers.length&&(n.transceivers[d].rejected||(n.transceivers[d].iceTransport.addRemoteCandidate({}),(t=In.getMediaSections(n._remoteDescription.sdp))[d]+="a=end-of-candidates\r\n",n._remoteDescription.sdp=In.getDescription(n._remoteDescription.sdp)+t.join(""),!n.usingBundle));d++);r()}))},i.prototype.getStats=function(t){if(t&&t instanceof e.MediaStreamTrack){var n=null;if(this.transceivers.forEach((function(e){e.rtpSender&&e.rtpSender.track===t?n=e.rtpSender:e.rtpReceiver&&e.rtpReceiver.track===t&&(n=e.rtpReceiver)})),!n)throw Cn("InvalidAccessError","Invalid selector.");return n.getStats()}var r=[];return this.transceivers.forEach((function(e){["rtpSender","rtpReceiver","iceGatherer","iceTransport","dtlsTransport"].forEach((function(t){e[t]&&r.push(e[t].getStats())}))})),Promise.all(r).then((function(e){var t=new Map;return e.forEach((function(e){e.forEach((function(e){t.set(e.id,e)}))})),t}))};["RTCRtpSender","RTCRtpReceiver","RTCIceGatherer","RTCIceTransport","RTCDtlsTransport"].forEach((function(t){var n=e[t];if(n&&n.prototype&&n.prototype.getStats){var r=n.prototype.getStats;n.prototype.getStats=function(){return r.apply(this).then((function(e){var t=new Map;return Object.keys(e).forEach((function(n){var r;e[n].type={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[(r=e[n]).type]||r.type,t.set(n,e[n])})),t}))}}}));var a=["createOffer","createAnswer"];return a.forEach((function(e){var t=i.prototype[e];i.prototype[e]=function(){var e=arguments;return"function"==typeof e[0]||"function"==typeof e[1]?t.apply(this,[arguments[2]]).then((function(t){"function"==typeof e[0]&&e[0].apply(null,[t])}),(function(t){"function"==typeof e[1]&&e[1].apply(null,[t])})):t.apply(this,arguments)}})),(a=["setLocalDescription","setRemoteDescription","addIceCandidate"]).forEach((function(e){var t=i.prototype[e];i.prototype[e]=function(){var e=arguments;return"function"==typeof e[1]||"function"==typeof e[2]?t.apply(this,arguments).then((function(){"function"==typeof e[1]&&e[1].apply(null)}),(function(t){"function"==typeof e[2]&&e[2].apply(null,[t])})):t.apply(this,arguments)}})),["getStats"].forEach((function(e){var t=i.prototype[e];i.prototype[e]=function(){var e=arguments;return"function"==typeof e[1]?t.apply(this,arguments).then((function(){"function"==typeof e[1]&&e[1].apply(null)})):t.apply(this,arguments)}})),i};function xn(e){const t=e&&e.navigator,n=t.mediaDevices.getUserMedia.bind(t.mediaDevices);t.mediaDevices.getUserMedia=function(e){return n(e).catch(e=>Promise.reject(function(e){return{name:{PermissionDeniedError:"NotAllowedError"}[e.name]||e.name,message:e.message,constraint:e.constraint,toString(){return this.name}}}(e)))}}function Pn(e){"getDisplayMedia"in e.navigator&&e.navigator.mediaDevices&&(e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||(e.navigator.mediaDevices.getDisplayMedia=e.navigator.getDisplayMedia.bind(e.navigator)))}function Dn(e,t){if(e.RTCIceGatherer&&(e.RTCIceCandidate||(e.RTCIceCandidate=function(e){return e}),e.RTCSessionDescription||(e.RTCSessionDescription=function(e){return e}),t.version<15025)){const t=Object.getOwnPropertyDescriptor(e.MediaStreamTrack.prototype,"enabled");Object.defineProperty(e.MediaStreamTrack.prototype,"enabled",{set(e){t.set.call(this,e);const n=new Event("enabled");n.enabled=e,this.dispatchEvent(n)}})}e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)&&Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=new e.RTCDtmfSender(this):"video"===this.track.kind&&(this._dtmf=null)),this._dtmf}}),e.RTCDtmfSender&&!e.RTCDTMFSender&&(e.RTCDTMFSender=e.RTCDtmfSender);const n=An(e,t.version);e.RTCPeerConnection=function(e){return e&&e.iceServers&&(e.iceServers=function(e,t){let n=!1;return(e=JSON.parse(JSON.stringify(e))).filter(e=>{if(e&&(e.urls||e.url)){let t=e.urls||e.url;e.url&&!e.urls&&sn("RTCIceServer.url","RTCIceServer.urls");const r="string"==typeof t;return r&&(t=[t]),t=t.filter(e=>{if(0===e.indexOf("stun:"))return!1;const t=e.startsWith("turn")&&!e.startsWith("turn:[")&&e.includes("transport=udp");return t&&!n?(n=!0,!0):t&&!n}),delete e.url,e.urls=r?t[0]:t,!!t.length}})}(e.iceServers,t.version),on("ICE servers after filtering:",e.iceServers)),new n(e)},e.RTCPeerConnection.prototype=n.prototype}function Nn(e){e.RTCRtpSender&&!("replaceTrack"in e.RTCRtpSender.prototype)&&(e.RTCRtpSender.prototype.replaceTrack=e.RTCRtpSender.prototype.setTrack)}var Ln=Object.freeze({__proto__:null,shimPeerConnection:Dn,shimReplaceTrack:Nn,shimGetUserMedia:xn,shimGetDisplayMedia:Pn});function On(e,t){const n=e&&e.navigator,r=e&&e.MediaStreamTrack;if(n.getUserMedia=function(e,t,r){sn("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),n.mediaDevices.getUserMedia(e).then(t,r)},!(t.version>55&&"autoGainControl"in n.mediaDevices.getSupportedConstraints())){const e=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])},t=n.mediaDevices.getUserMedia.bind(n.mediaDevices);if(n.mediaDevices.getUserMedia=function(n){return"object"==typeof n&&"object"==typeof n.audio&&(n=JSON.parse(JSON.stringify(n)),e(n.audio,"autoGainControl","mozAutoGainControl"),e(n.audio,"noiseSuppression","mozNoiseSuppression")),t(n)},r&&r.prototype.getSettings){const t=r.prototype.getSettings;r.prototype.getSettings=function(){const n=t.apply(this,arguments);return e(n,"mozAutoGainControl","autoGainControl"),e(n,"mozNoiseSuppression","noiseSuppression"),n}}if(r&&r.prototype.applyConstraints){const t=r.prototype.applyConstraints;r.prototype.applyConstraints=function(n){return"audio"===this.kind&&"object"==typeof n&&(n=JSON.parse(JSON.stringify(n)),e(n,"autoGainControl","mozAutoGainControl"),e(n,"noiseSuppression","mozNoiseSuppression")),t.apply(this,[n])}}}}function Mn(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function Un(e,t){if("object"!=typeof e||!e.RTCPeerConnection&&!e.mozRTCPeerConnection)return;!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const n=e.RTCPeerConnection.prototype[t],r={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=r[t]}));const n={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},r=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,i,a]=arguments;return r.apply(this,[e||null]).then(e=>{if(t.version<53&&!i)try{e.forEach(e=>{e.type=n[e.type]||e.type})}catch(r){if("TypeError"!==r.name)throw r;e.forEach((t,r)=>{e.set(r,Object.assign({},t,{type:n[t.type]||t.type}))})}return e}).then(i,a)}}function Vn(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpSender.prototype)return;const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e});const n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function Fn(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpReceiver.prototype)return;const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e}),nn(e,"track",e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function jn(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){sn("removeStream","removeTrack"),this.getSenders().forEach(t=>{t.track&&e.getTracks().includes(t.track)&&this.removeTrack(t)})})}function Bn(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function Hn(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];const e=arguments[1],n=e&&"sendEncodings"in e;n&&e.sendEncodings.forEach(e=>{if("rid"in e){if(!/^[a-z0-9]{0,16}$/i.test(e.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(parseFloat(e.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")});const r=t.apply(this,arguments);if(n){const{sender:t}=r,n=t.getParameters();(!("encodings"in n)||1===n.encodings.length&&0===Object.keys(n.encodings[0]).length)&&(n.encodings=e.sendEncodings,t.sendEncodings=e.sendEncodings,this.setParametersPromises.push(t.setParameters(n).then(()=>{delete t.sendEncodings}).catch(()=>{delete t.sendEncodings})))}return r})}function Gn(e){if("object"!=typeof e||!e.RTCRtpSender)return;const t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){const e=t.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}function Jn(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>t.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):t.apply(this,arguments)}}function zn(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>t.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):t.apply(this,arguments)}}var Wn=Object.freeze({__proto__:null,shimOnTrack:Mn,shimPeerConnection:Un,shimSenderGetStats:Vn,shimReceiverGetStats:Fn,shimRemoveStream:jn,shimRTCDataChannel:Bn,shimAddTransceiver:Hn,shimGetParameters:Gn,shimCreateOffer:Jn,shimCreateAnswer:zn,shimGetUserMedia:On,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(n){if(!n||!n.video){const e=new DOMException("getDisplayMedia without video constraints is undefined");return e.name="NotFoundError",e.code=8,Promise.reject(e)}return!0===n.video?n.video={mediaSource:t}:n.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(n)})}});function shimLocalStreamsAPI(e){if("object"==typeof e&&e.RTCPeerConnection){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in e.RTCPeerConnection.prototype)){const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach(n=>t.call(this,n,e)),e.getVideoTracks().forEach(n=>t.call(this,n,e))},e.RTCPeerConnection.prototype.addTrack=function(e,...n){return n&&n.forEach(e=>{this._localStreams?this._localStreams.includes(e)||this._localStreams.push(e):this._localStreams=[e]}),t.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){this._localStreams||(this._localStreams=[]);const t=this._localStreams.indexOf(e);if(-1===t)return;this._localStreams.splice(t,1);const n=e.getTracks();this.getSenders().forEach(e=>{n.includes(e.track)&&this.removeTrack(e)})})}}function shimRemoteStreamsAPI(e){if("object"==typeof e&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(e){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=e=>{e.streams.forEach(e=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(e))return;this._remoteStreams.push(e);const t=new Event("addstream");t.stream=e,this.dispatchEvent(t)})})}});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){const e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach(t=>{if(e._remoteStreams||(e._remoteStreams=[]),e._remoteStreams.indexOf(t)>=0)return;e._remoteStreams.push(t);const n=new Event("addstream");n.stream=t,e.dispatchEvent(n)})}),t.apply(e,arguments)}}}function qn(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype,n=t.createOffer,r=t.createAnswer,i=t.setLocalDescription,a=t.setRemoteDescription,o=t.addIceCandidate;t.createOffer=function(e,t){const r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return t?(i.then(e,t),Promise.resolve()):i},t.createAnswer=function(e,t){const n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return t?(i.then(e,t),Promise.resolve()):i};let s=function(e,t,n){const r=i.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r};t.setLocalDescription=s,s=function(e,t,n){const r=a.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.setRemoteDescription=s,s=function(e,t,n){const r=o.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.addIceCandidate=s}function Kn(e){const t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){const e=t.mediaDevices,n=e.getUserMedia.bind(e);t.mediaDevices.getUserMedia=e=>n(Qn(e))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,n,r){t.mediaDevices.getUserMedia(e).then(n,r)}.bind(t))}function Qn(e){return e&&void 0!==e.video?Object.assign({},e,{video:un(e.video)}):e}function Xn(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,n){if(e&&e.iceServers){const t=[];for(let n=0;n<e.iceServers.length;n++){let r=e.iceServers[n];!r.hasOwnProperty("urls")&&r.hasOwnProperty("url")?(sn("RTCIceServer.url","RTCIceServer.urls"),r=JSON.parse(JSON.stringify(r)),r.urls=r.url,delete r.url,t.push(r)):t.push(e.iceServers[n])}e.iceServers=t}return new t(e,n)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:()=>t.generateCertificate})}function $n(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function Yn(e){const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);const t=this.getTransceivers().find(e=>"audio"===e.receiver.track.kind);!1===e.offerToReceiveAudio&&t?"sendrecv"===t.direction?t.setDirection?t.setDirection("sendonly"):t.direction="sendonly":"recvonly"===t.direction&&(t.setDirection?t.setDirection("inactive"):t.direction="inactive"):!0!==e.offerToReceiveAudio||t||this.addTransceiver("audio"),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);const n=this.getTransceivers().find(e=>"video"===e.receiver.track.kind);!1===e.offerToReceiveVideo&&n?"sendrecv"===n.direction?n.setDirection?n.setDirection("sendonly"):n.direction="sendonly":"recvonly"===n.direction&&(n.setDirection?n.setDirection("inactive"):n.direction="inactive"):!0!==e.offerToReceiveVideo||n||this.addTransceiver("video")}return t.apply(this,arguments)}}function Zn(e){"object"!=typeof e||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var er=Object.freeze({__proto__:null,shimLocalStreamsAPI:shimLocalStreamsAPI,shimRemoteStreamsAPI:shimRemoteStreamsAPI,shimCallbacksAPI:qn,shimGetUserMedia:Kn,shimConstraints:Qn,shimRTCIceServerUrls:Xn,shimTrackEventTransceiver:$n,shimCreateOfferLegacy:Yn,shimAudioContext:Zn});function tr(e){if(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)return;const t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"==typeof e&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substr(2)),e.candidate&&e.candidate.length){const n=new t(e),r=In.parseCandidate(e.candidate),i=Object.assign(n,r);return i.toJSON=function(){return{candidate:i.candidate,sdpMid:i.sdpMid,sdpMLineIndex:i.sdpMLineIndex,usernameFragment:i.usernameFragment}},i}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,nn(e,"icecandidate",t=>(t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t))}function nr(e,t){if(!e.RTCPeerConnection)return;"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get(){return void 0===this._sctp?null:this._sctp}});const n=function(e){if(!e||!e.sdp)return!1;const t=In.splitSections(e.sdp);return t.shift(),t.some(e=>{const t=In.parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")})},r=function(e){const t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;const n=parseInt(t[1],10);return n!=n?-1:n},i=function(e){let n=65536;return"firefox"===t.browser&&(n=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),n},a=function(e,n){let r=65536;"firefox"===t.browser&&57===t.version&&(r=65535);const i=In.matchPrefix(e.sdp,"a=max-message-size:");return i.length>0?r=parseInt(i[0].substr(19),10):"firefox"===t.browser&&-1!==n&&(r=2147483637),r},o=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){const{sdpSemantics:e}=this.getConfiguration();"plan-b"===e&&Object.defineProperty(this,"sctp",{get(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(n(arguments[0])){const e=r(arguments[0]),t=i(e),n=a(arguments[0],e);let o;o=0===t&&0===n?Number.POSITIVE_INFINITY:0===t||0===n?Math.max(t,n):Math.min(t,n);const s={};Object.defineProperty(s,"maxMessageSize",{get:()=>o}),this._sctp=s}return o.apply(this,arguments)}}function rr(e){if(!e.RTCPeerConnection||!("createDataChannel"in e.RTCPeerConnection.prototype))return;function t(e,t){const n=e.send;e.send=function(){const r=arguments[0],i=r.length||r.size||r.byteLength;if("open"===e.readyState&&t.sctp&&i>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return n.apply(e,arguments)}}const n=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){const e=n.apply(this,arguments);return t(e,this),e},nn(e,"datachannel",e=>(t(e.channel,e.target),e))}function ir(e){if(!e.RTCPeerConnection||"connectionState"in e.RTCPeerConnection.prototype)return;const t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(e=>{const n=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=e=>{const t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;const n=new Event("connectionstatechange",e);t.dispatchEvent(n)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),n.apply(this,arguments)}})}function ar(e,t){if(!e.RTCPeerConnection)return;if("chrome"===t.browser&&t.version>=71)return;if("safari"===t.browser&&t.version>=605)return;const n=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){const n=t.sdp.split("\n").filter(e=>"a=extmap-allow-mixed"!==e.trim()).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:n}):t.sdp=n}return n.apply(this,arguments)}}function or(e,t){if(!e.RTCPeerConnection||!e.RTCPeerConnection.prototype)return;const n=e.RTCPeerConnection.prototype.addIceCandidate;n&&0!==n.length&&(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===t.browser&&t.version<78||"firefox"===t.browser&&t.version<68||"safari"===t.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():n.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}var sr=Object.freeze({__proto__:null,shimRTCIceCandidate:tr,shimMaxMessageSize:nr,shimSendThrowTypeError:rr,shimConnectionState:ir,removeExtmapAllowMixed:ar,shimAddIceCandidateNullOrEmpty:or});!function({window:e}={},t={shimChrome:!0,shimFirefox:!0,shimEdge:!0,shimSafari:!0}){const n=on,r=function(e){const t={browser:null,version:null};if(void 0===e||!e.navigator)return t.browser="Not a browser.",t;const{navigator:n}=e;if(n.mozGetUserMedia)t.browser="firefox",t.version=tn(n.userAgent,/Firefox\/(\d+)\./,1);else if(n.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection&&!e.RTCIceGatherer)t.browser="chrome",t.version=tn(n.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(n.mediaDevices&&n.userAgent.match(/Edge\/(\d+).(\d+)$/))t.browser="edge",t.version=tn(n.userAgent,/Edge\/(\d+).(\d+)$/,2);else{if(!e.RTCPeerConnection||!n.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=tn(n.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}(e),i={browserDetails:r,commonShim:sr,extractVersion:tn,disableLog:rn,disableWarnings:an};switch(r.browser){case"chrome":if(!bn||!Sn||!t.shimChrome)return n("Chrome shim is not included in this adapter release."),i;if(null===r.version)return n("Chrome shim can not determine version, not shimming."),i;n("adapter.js shimming chrome."),i.browserShim=bn,or(e,r),hn(e,r),pn(e),Sn(e,r),fn(e),yn(e,r),mn(e),_n(e),vn(e),kn(e,r),tr(e),ir(e),nr(e,r),rr(e),ar(e,r);break;case"firefox":if(!Wn||!Un||!t.shimFirefox)return n("Firefox shim is not included in this adapter release."),i;n("adapter.js shimming firefox."),i.browserShim=Wn,or(e,r),On(e,r),Un(e,r),Mn(e),jn(e),Vn(e),Fn(e),Bn(e),Hn(e),Gn(e),Jn(e),zn(e),tr(e),ir(e),nr(e,r),rr(e);break;case"edge":if(!Ln||!Dn||!t.shimEdge)return n("MS edge shim is not included in this adapter release."),i;n("adapter.js shimming edge."),i.browserShim=Ln,xn(e),Pn(e),Dn(e,r),Nn(e),nr(e,r),rr(e);break;case"safari":if(!er||!t.shimSafari)return n("Safari shim is not included in this adapter release."),i;n("adapter.js shimming safari."),i.browserShim=er,or(e,r),Xn(e),Yn(e),qn(e),shimLocalStreamsAPI(e),shimRemoteStreamsAPI(e),$n(e),Kn(e),Zn(e),tr(e),nr(e,r),rr(e),ar(e,r);break;default:n("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window});var cr=[].slice,ur=/MSIE .\./.test(W),dr=function(e){return function(t,n){var r=arguments.length>2,i=r?cr.call(arguments,2):void 0;return e(r?function(){(H(t)?t:Function(t)).apply(this,i)}:t,n)}};Rt({global:!0,bind:!0,forced:ur},{setTimeout:dr(A.setTimeout),setInterval:dr(A.setInterval)});var lr,hr=Object.keys||function(e){return dt(e,lt)},pr=P?Object.defineProperties:function(e,t){we(e);for(var n,r=hr(t),i=r.length,a=0;i>a;)Ce.f(e,n=r[a++],t[n]);return e},fr=z("document","documentElement"),mr=Ve("IE_PROTO"),_r=function(){},vr=function(e){return"<script>"+e+"<\/script>"},gr=function(e){e.write(vr("")),e.close();var t=e.parentWindow.Object;return e=null,t},yr=function(){try{lr=new ActiveXObject("htmlfile")}catch(r){}var e,t;yr="undefined"!=typeof document?document.domain&&lr?gr(lr):((t=be("iframe")).style.display="none",fr.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(vr("document.F=Object")),e.close(),e.F):gr(lr);for(var n=lt.length;n--;)delete yr.prototype[lt[n]];return yr()};Fe[mr]=!0;var Sr=Object.create||function(e,t){var n;return null!==e?(_r.prototype=we(e),n=new _r,_r.prototype=null,n[mr]=e):n=yr(),void 0===t?n:pr(n,t)},kr=_e("unscopables"),br=Array.prototype;null==br[kr]&&Ce.f(br,kr,{configurable:!0,value:Sr(null)});var Ir,Tr,Rr,wr=function(e){br[kr][e]=!0},Er={},Cr=!x((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),Ar=Ve("IE_PROTO"),xr=Object.prototype,Pr=Cr?Object.getPrototypeOf:function(e){var t=se(e);if(ue(t,Ar))return t[Ar];var n=t.constructor;return H(n)&&t instanceof n?n.prototype:t instanceof Object?xr:null},Dr=_e("iterator"),Nr=!1;[].keys&&("next"in(Rr=[].keys())?(Tr=Pr(Pr(Rr)))!==Object.prototype&&(Ir=Tr):Nr=!0),(null==Ir||x((function(){var e={};return Ir[Dr].call(e)!==e})))&&(Ir={}),H(Ir[Dr])||$e(Ir,Dr,(function(){return this}));var Lr={IteratorPrototype:Ir,BUGGY_SAFARI_ITERATORS:Nr},Or=Ce.f,Mr=_e("toStringTag"),Ur=function(e,t,n){e&&!ue(e=n?e:e.prototype,Mr)&&Or(e,Mr,{configurable:!0,value:t})},Vr=Lr.IteratorPrototype,Fr=function(){return this},jr=function(e,t,n){var r=t+" Iterator";return e.prototype=Sr(Vr,{next:O(1,n)}),Ur(e,r,!1),Er[r]=Fr,e},Br=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(n,[]),t=n instanceof Array}catch(r){}return function(n,r){return we(n),function(e){if("object"==typeof e||H(e))return e;throw TypeError("Can't set "+String(e)+" as a prototype")}(r),t?e.call(n,r):n.__proto__=r,n}}():void 0),Hr=Xe.PROPER,Gr=Xe.CONFIGURABLE,Jr=Lr.IteratorPrototype,zr=Lr.BUGGY_SAFARI_ITERATORS,Wr=_e("iterator"),qr=function(){return this},Kr=function(e,t,n,r,i,a,o){jr(n,t,r);var s,c,u,d=function(e){if(e===i&&m)return m;if(!zr&&e in p)return p[e];switch(e){case"keys":case"values":case"entries":return function(){return new n(this,e)}}return function(){return new n(this)}},l=t+" Iterator",h=!1,p=e.prototype,f=p[Wr]||p["@@iterator"]||i&&p[i],m=!zr&&f||d(i),_="Array"==t&&p.entries||f;if(_&&(s=Pr(_.call(new e)))!==Object.prototype&&s.next&&(Pr(s)!==Jr&&(Br?Br(s,Jr):H(s[Wr])||$e(s,Wr,qr)),Ur(s,l,!0)),Hr&&"values"==i&&f&&"values"!==f.name&&(Gr?Ae(p,"name","values"):(h=!0,m=function(){return f.call(this)})),i)if(c={values:d("values"),keys:a?m:d("keys"),entries:d("entries")},o)for(u in c)(zr||h||!(u in p))&&$e(p,u,c[u]);else Rt({target:t,proto:!0,forced:zr||h},c);return p[Wr]!==m&&$e(p,Wr,m,{name:i}),Er[t]=m,c},Qr=We.set,Xr=We.getterFor("Array Iterator"),$r=Kr(Array,"Array",(function(e,t){Qr(this,{type:"Array Iterator",target:B(e),index:0,kind:t})}),(function(){var e=Xr(this),t=e.target,n=e.kind,r=e.index++;return!t||r>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==n?{value:r,done:!1}:"values"==n?{value:t[r],done:!1}:{value:[r,t[r]],done:!1}}),"values");Er.Arguments=Er.Array,wr("keys"),wr("values"),wr("entries");var Yr=pt.f,Zr={}.toString,ei="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],ti={f:function(e){return ei&&"[object Window]"==Zr.call(e)?function(e){try{return Yr(e)}catch(t){return ei.slice()}}(e):Yr(B(e))}},ni=!x((function(){return Object.isExtensible(Object.preventExtensions({}))})),ri=R((function(e){var t=Ce.f,n=!1,r=he("meta"),i=0,a=Object.isExtensible||function(){return!0},o=function(e){t(e,r,{value:{objectID:"O"+i++,weakData:{}}})},s=e.exports={enable:function(){s.enable=function(){},n=!0;var e=pt.f,t=[].splice,i={};i[r]=1,e(i).length&&(pt.f=function(n){for(var i=e(n),a=0,o=i.length;a<o;a++)if(i[a]===r){t.call(i,a,1);break}return i},Rt({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:ti.f}))},fastKey:function(e,t){if(!G(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!ue(e,r)){if(!a(e))return"F";if(!t)return"E";o(e)}return e[r].objectID},getWeakData:function(e,t){if(!ue(e,r)){if(!a(e))return!0;if(!t)return!1;o(e)}return e[r].weakData},onFreeze:function(e){return ni&&n&&a(e)&&!ue(e,r)&&o(e),e}};Fe[r]=!0})),ii=(ri.enable,ri.fastKey,ri.getWeakData,ri.onFreeze,_e("iterator")),ai=Array.prototype,oi=function(e){return void 0!==e&&(Er.Array===e||ai[ii]===e)},si=_e("iterator"),ci=function(e){if(null!=e)return re(e,si)||re(e,"@@iterator")||Er[Dt(e)]},ui=function(e,t){var n=arguments.length<2?ci(e):t;if(ne(n))return we(n.call(e));throw TypeError(String(e)+" is not iterable")},di=function(e,t,n){var r,i;we(e);try{if(!(r=re(e,"return"))){if("throw"===t)throw n;return n}r=r.call(e)}catch(a){i=!0,r=a}if("throw"===t)throw n;if(i)throw r;return we(r),n},li=function(e,t){this.stopped=e,this.result=t},hi=function(e,t,n){var r,i,a,o,s,c,u,d=n&&n.that,l=!(!n||!n.AS_ENTRIES),h=!(!n||!n.IS_ITERATOR),p=!(!n||!n.INTERRUPTED),f=wt(t,d,1+l+p),m=function(e){return r&&di(r,"normal",e),new li(!0,e)},_=function(e){return l?(we(e),p?f(e[0],e[1],m):f(e[0],e[1])):p?f(e,m):f(e)};if(h)r=e;else{if(!(i=ci(e)))throw TypeError(String(e)+" is not iterable");if(oi(i)){for(a=0,o=ot(e);o>a;a++)if((s=_(e[a]))&&s instanceof li)return s;return new li(!1)}r=ui(e,i)}for(c=r.next;!(u=c.call(r)).done;){try{s=_(u.value)}catch(v){di(r,"throw",v)}if("object"==typeof s&&s&&s instanceof li)return s}return new li(!1)},pi=function(e,t,n){if(e instanceof t)return e;throw TypeError("Incorrect "+(n?n+" ":"")+"invocation")},fi=_e("iterator"),mi=!1;try{var _i=0,vi={next:function(){return{done:!!_i++}},return:function(){mi=!0}};vi[fi]=function(){return this},Array.from(vi,(function(){throw 2}))}catch(JI){}var gi=function(e,t){if(!t&&!mi)return!1;var n=!1;try{var r={};r[fi]=function(){return{next:function(){return{done:n=!0}}}},e(r)}catch(JI){}return n},yi=function(e,t,n){var r,i;return Br&&H(r=t.constructor)&&r!==n&&G(i=r.prototype)&&i!==n.prototype&&Br(e,i),e},Si=function(e,t,n){var r=-1!==e.indexOf("Map"),i=-1!==e.indexOf("Weak"),a=r?"set":"add",o=A[e],s=o&&o.prototype,c=o,u={},d=function(e){var t=s[e];$e(s,e,"add"==e?function(e){return t.call(this,0===e?0:e),this}:"delete"==e?function(e){return!(i&&!G(e))&&t.call(this,0===e?0:e)}:"get"==e?function(e){return i&&!G(e)?void 0:t.call(this,0===e?0:e)}:"has"==e?function(e){return!(i&&!G(e))&&t.call(this,0===e?0:e)}:function(e,n){return t.call(this,0===e?0:e,n),this})};if(It(e,!H(o)||!(i||s.forEach&&!x((function(){(new o).entries().next()})))))c=n.getConstructor(t,e,r,a),ri.enable();else if(It(e,!0)){var l=new c,h=l[a](i?{}:-0,1)!=l,p=x((function(){l.has(1)})),f=gi((function(e){new o(e)})),m=!i&&x((function(){for(var e=new o,t=5;t--;)e[a](t,t);return!e.has(-0)}));f||((c=t((function(t,n){pi(t,c,e);var i=yi(new o,t,c);return null!=n&&hi(n,i[a],{that:i,AS_ENTRIES:r}),i}))).prototype=s,s.constructor=c),(p||m)&&(d("delete"),d("has"),r&&d("get")),(m||h)&&d(a),i&&s.clear&&delete s.clear}return u[e]=c,Rt({global:!0,forced:c!=o},u),Ur(c,e),i||n.setStrong(c,e,r),c},ki=function(e,t,n){for(var r in t)$e(e,r,t[r],n);return e},bi=_e("species"),Ii=function(e){var t=z(e),n=Ce.f;P&&t&&!t[bi]&&n(t,bi,{configurable:!0,get:function(){return this}})},Ti=Ce.f,Ri=ri.fastKey,wi=We.set,Ei=We.getterFor,Ci={getConstructor:function(e,t,n,r){var i=e((function(e,a){pi(e,i,t),wi(e,{type:t,index:Sr(null),first:void 0,last:void 0,size:0}),P||(e.size=0),null!=a&&hi(a,e[r],{that:e,AS_ENTRIES:n})})),a=Ei(t),o=function(e,t,n){var r,i,o=a(e),c=s(e,t);return c?c.value=n:(o.last=c={index:i=Ri(t,!0),key:t,value:n,previous:r=o.last,next:void 0,removed:!1},o.first||(o.first=c),r&&(r.next=c),P?o.size++:e.size++,"F"!==i&&(o.index[i]=c)),e},s=function(e,t){var n,r=a(e),i=Ri(t);if("F"!==i)return r.index[i];for(n=r.first;n;n=n.next)if(n.key==t)return n};return ki(i.prototype,{clear:function(){for(var e=a(this),t=e.index,n=e.first;n;)n.removed=!0,n.previous&&(n.previous=n.previous.next=void 0),delete t[n.index],n=n.next;e.first=e.last=void 0,P?e.size=0:this.size=0},delete:function(e){var t=a(this),n=s(this,e);if(n){var r=n.next,i=n.previous;delete t.index[n.index],n.removed=!0,i&&(i.next=r),r&&(r.previous=i),t.first==n&&(t.first=r),t.last==n&&(t.last=i),P?t.size--:this.size--}return!!n},forEach:function(e){for(var t,n=a(this),r=wt(e,arguments.length>1?arguments[1]:void 0,3);t=t?t.next:n.first;)for(r(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!s(this,e)}}),ki(i.prototype,n?{get:function(e){var t=s(this,e);return t&&t.value},set:function(e,t){return o(this,0===e?0:e,t)}}:{add:function(e){return o(this,e=0===e?0:e,e)}}),P&&Ti(i.prototype,"size",{get:function(){return a(this).size}}),i},setStrong:function(e,t,n){var r=t+" Iterator",i=Ei(t),a=Ei(r);Kr(e,t,(function(e,t){wi(this,{type:r,target:e,state:i(e),kind:t,last:void 0})}),(function(){for(var e=a(this),t=e.kind,n=e.last;n&&n.removed;)n=n.previous;return e.target&&(e.last=n=n?n.next:e.state.first)?"keys"==t?{value:n.key,done:!1}:"values"==t?{value:n.value,done:!1}:{value:[n.key,n.value],done:!1}:(e.target=void 0,{value:void 0,done:!0})}),n?"entries":"values",!n,!0),Ii(t)}},Ai=(Si("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),Ci),At?{}.toString:function(){return"[object "+Dt(this)+"]"});At||$e(Object.prototype,"toString",Ai,{unsafe:!0});var xi=function(e){if("Symbol"===Dt(e))throw TypeError("Cannot convert a Symbol value to a string");return String(e)},Pi=function(e){return function(t,n){var r,i,a=xi(j(t)),o=et(n),s=a.length;return o<0||o>=s?e?"":void 0:(r=a.charCodeAt(o))<55296||r>56319||o+1===s||(i=a.charCodeAt(o+1))<56320||i>57343?e?a.charAt(o):r:e?a.slice(o,o+2):i-56320+(r-55296<<10)+65536}},Di={codeAt:Pi(!1),charAt:Pi(!0)},Ni=Di.charAt,Li=We.set,Oi=We.getterFor("String Iterator");Kr(String,"String",(function(e){Li(this,{type:"String Iterator",string:xi(e),index:0})}),(function(){var e,t=Oi(this),n=t.string,r=t.index;return r>=n.length?{value:void 0,done:!0}:(e=Ni(n,r),t.index+=e.length,{value:e,done:!1})}));var Mi={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},Ui=be("span").classList,Vi=Ui&&Ui.constructor&&Ui.constructor.prototype,Fi=Vi===Object.prototype?void 0:Vi,ji=_e("iterator"),Bi=_e("toStringTag"),Hi=$r.values,Gi=function(e,t){if(e){if(e[ji]!==Hi)try{Ae(e,ji,Hi)}catch(JI){e[ji]=Hi}if(e[Bi]||Ae(e,Bi,t),Mi[t])for(var n in $r)if(e[n]!==$r[n])try{Ae(e,n,$r[n])}catch(JI){e[n]=$r[n]}}};for(var Ji in Mi)Gi(A[Ji]&&A[Ji].prototype,Ji);Gi(Fi,"DOMTokenList");var zi=function(e,t,n){var r=ye(t);r in e?Ce.f(e,r,O(0,n)):e[r]=n},Wi=Wt("splice"),qi=Math.max,Ki=Math.min;Rt({target:"Array",proto:!0,forced:!Wi},{splice:function(e,t){var n,r,i,a,o,s,c=se(this),u=ot(c),d=rt(e,u),l=arguments.length;if(0===l?n=r=0:1===l?(n=0,r=u-d):(n=l-2,r=Ki(qi(et(t),0),u-d)),u+n-r>9007199254740991)throw TypeError("Maximum allowed length exceeded");for(i=Bt(c,r),a=0;a<r;a++)(o=d+a)in c&&zi(i,a,c[o]);if(i.length=r,n<r){for(a=d;a<u-r;a++)s=a+n,(o=a+r)in c?c[s]=c[o]:delete c[s];for(a=u;a>u-r+n;a--)delete c[a-1]}else if(n>r)for(a=u-r;a>d;a--)s=a+n-1,(o=a+r-1)in c?c[s]=c[o]:delete c[s];for(a=0;a<n;a++)c[a+d]=arguments[a+2];return c.length=u-r+n,i}});var Qi=function(e,t){var n=[][e];return!!n&&x((function(){n.call(null,t||function(){throw 1},1)}))},Xi=Jt.forEach,$i=Qi("forEach")?[].forEach:function(e){return Xi(this,e,arguments.length>1?arguments[1]:void 0)};Rt({target:"Array",proto:!0,forced:[].forEach!=$i},{forEach:$i});var Yi=function(e){if(e&&e.forEach!==$i)try{Ae(e,"forEach",$i)}catch(JI){e.forEach=$i}};for(var Zi in Mi)Mi[Zi]&&Yi(A[Zi]&&A[Zi].prototype);Yi(Fi);var ea=[].join,ta=F!=Object,na=Qi("join",",");Rt({target:"Array",proto:!0,forced:ta||!na},{join:function(e){return ea.call(B(this),void 0===e?",":e)}});var ra=_e("isConcatSpreadable"),ia=$>=51||!x((function(){var e=[];return e[ra]=!1,e.concat()[0]!==e})),aa=Wt("concat"),oa=function(e){if(!G(e))return!1;var t=e[ra];return void 0!==t?!!t:Et(e)};Rt({target:"Array",proto:!0,forced:!ia||!aa},{concat:function(e){var t,n,r,i,a,o=se(this),s=Bt(o,0),c=0;for(t=-1,r=arguments.length;t<r;t++)if(oa(a=-1===t?o:arguments[t])){if(c+(i=ot(a))>9007199254740991)throw TypeError("Maximum allowed index exceeded");for(n=0;n<i;n++,c++)n in a&&zi(s,c,a[n])}else{if(c>=9007199254740991)throw TypeError("Maximum allowed index exceeded");zi(s,c++,a)}return s.length=c,s}});var sa=Date.prototype,ca=sa.toString,ua=sa.getTime;"Invalid Date"!=String(new Date(NaN))&&$e(sa,"toString",(function(){var e=ua.call(this);return e==e?ca.call(this):"Invalid Date"}));var da=function(){var e=we(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t},la=A.RegExp,ha={UNSUPPORTED_Y:x((function(){var e=la("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),BROKEN_CARET:x((function(){var e=la("^r","gy");return e.lastIndex=2,null!=e.exec("str")}))},pa=A.RegExp,fa=x((function(){var e=pa(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),ma=A.RegExp,_a=x((function(){var e=ma("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),va=We.get,ga=RegExp.prototype.exec,ya=oe("native-string-replace",String.prototype.replace),Sa=ga,ka=function(){var e=/a/,t=/b*/g;return ga.call(e,"a"),ga.call(t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),ba=ha.UNSUPPORTED_Y||ha.BROKEN_CARET,Ia=void 0!==/()??/.exec("")[1];(ka||Ia||ba||fa||_a)&&(Sa=function(e){var t,n,r,i,a,o,s,c=this,u=va(c),d=xi(e),l=u.raw;if(l)return l.lastIndex=c.lastIndex,t=Sa.call(l,d),c.lastIndex=l.lastIndex,t;var h=u.groups,p=ba&&c.sticky,f=da.call(c),m=c.source,_=0,v=d;if(p&&(-1===(f=f.replace("y","")).indexOf("g")&&(f+="g"),v=d.slice(c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==d.charAt(c.lastIndex-1))&&(m="(?: "+m+")",v=" "+v,_++),n=new RegExp("^(?:"+m+")",f)),Ia&&(n=new RegExp("^"+m+"$(?!\\s)",f)),ka&&(r=c.lastIndex),i=ga.call(p?n:c,v),p?i?(i.input=i.input.slice(_),i[0]=i[0].slice(_),i.index=c.lastIndex,c.lastIndex+=i[0].length):c.lastIndex=0:ka&&i&&(c.lastIndex=c.global?i.index+i[0].length:r),Ia&&i&&i.length>1&&ya.call(i[0],n,(function(){for(a=1;a<arguments.length-2;a++)void 0===arguments[a]&&(i[a]=void 0)})),i&&h)for(i.groups=o=Sr(null),a=0;a<h.length;a++)o[(s=h[a])[0]]=i[s[1]];return i});var Ta=Sa;Rt({target:"RegExp",proto:!0,forced:/./.exec!==Ta},{exec:Ta});var Ra=_e("species"),wa=RegExp.prototype,Ea=function(e,t,n,r){var i=_e(e),a=!x((function(){var t={};return t[i]=function(){return 7},7!=""[e](t)})),o=a&&!x((function(){var t=!1,n=/a/;return"split"===e&&((n={}).constructor={},n.constructor[Ra]=function(){return n},n.flags="",n[i]=/./[i]),n.exec=function(){return t=!0,null},n[i](""),!t}));if(!a||!o||n){var s=/./[i],c=t(i,""[e],(function(e,t,n,r,i){var o=t.exec;return o===Ta||o===wa.exec?a&&!i?{done:!0,value:s.call(t,n,r)}:{done:!0,value:e.call(n,t,r)}:{done:!1}}));$e(String.prototype,e,c[0]),$e(wa,i,c[1])}r&&Ae(wa[i],"sham",!0)},Ca=Di.charAt,Aa=function(e,t,n){return t+(n?Ca(e,t).length:1)},xa=Math.floor,Pa="".replace,Da=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,Na=/\$([$&'`]|\d{1,2})/g,La=function(e,t,n,r,i,a){var o=n+e.length,s=r.length,c=Na;return void 0!==i&&(i=se(i),c=Da),Pa.call(a,c,(function(a,c){var u;switch(c.charAt(0)){case"$":return"$";case"&":return e;case"`":return t.slice(0,n);case"'":return t.slice(o);case"<":u=i[c.slice(1,-1)];break;default:var d=+c;if(0===d)return a;if(d>s){var l=xa(d/10);return 0===l?a:l<=s?void 0===r[l-1]?c.charAt(1):r[l-1]+c.charAt(1):a}u=r[d-1]}return void 0===u?"":u}))},Oa=function(e,t){var n=e.exec;if(H(n)){var r=n.call(e,t);return null!==r&&we(r),r}if("RegExp"===U(e))return Ta.call(e,t);throw TypeError("RegExp#exec called on incompatible receiver")},Ma=_e("replace"),Ua=Math.max,Va=Math.min,Fa="$0"==="a".replace(/./,"$0"),ja=!!/./[Ma]&&""===/./[Ma]("a","$0");Ea("replace",(function(e,t,n){var r=ja?"$":"$0";return[function(e,n){var r=j(this),i=null==e?void 0:re(e,Ma);return i?i.call(e,r,n):t.call(xi(r),e,n)},function(e,i){var a=we(this),o=xi(e);if("string"==typeof i&&-1===i.indexOf(r)&&-1===i.indexOf("$<")){var s=n(t,a,o,i);if(s.done)return s.value}var c=H(i);c||(i=xi(i));var u=a.global;if(u){var d=a.unicode;a.lastIndex=0}for(var l=[];;){var h=Oa(a,o);if(null===h)break;if(l.push(h),!u)break;""===xi(h[0])&&(a.lastIndex=Aa(o,at(a.lastIndex),d))}for(var p,f="",m=0,_=0;_<l.length;_++){h=l[_];for(var v=xi(h[0]),g=Ua(Va(et(h.index),o.length),0),y=[],S=1;S<h.length;S++)y.push(void 0===(p=h[S])?p:String(p));var k=h.groups;if(c){var b=[v].concat(y,g,o);void 0!==k&&b.push(k);var I=xi(i.apply(void 0,b))}else I=La(v,o,g,y,k,i);g>=m&&(f+=o.slice(m,g)+I,m=g+v.length)}return f+o.slice(m)}]}),!!x((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}))||!Fa||ja);var Ba=_e("iterator"),Ha=!x((function(){var e=new URL("b?a=1&b=2&c=3","http://a"),t=e.searchParams,n="";return e.pathname="c%20d",t.forEach((function(e,r){t.delete("b"),n+=r+e})),!t.sort||"http://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[Ba]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("http://тест").host||"#%D0%B1"!==new URL("http://a#б").hash||"a1c3"!==n||"x"!==new URL("http://x",void 0).host})),Ga=z("fetch"),Ja=z("Request"),za=Ja&&Ja.prototype,Wa=z("Headers"),qa=_e("iterator"),Ka=We.set,Qa=We.getterFor("URLSearchParams"),Xa=We.getterFor("URLSearchParamsIterator"),$a=/\+/g,Ya=Array(4),Za=function(e){return Ya[e-1]||(Ya[e-1]=RegExp("((?:%[\\da-f]{2}){"+e+"})","gi"))},eo=function(e){try{return decodeURIComponent(e)}catch(JI){return e}},to=function(e){var t=e.replace($a," "),n=4;try{return decodeURIComponent(t)}catch(JI){for(;n;)t=t.replace(Za(n--),eo);return t}},no=/[!'()~]|%20/g,ro={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},io=function(e){return ro[e]},ao=function(e){return encodeURIComponent(e).replace(no,io)},oo=function(e,t){if(t)for(var n,r,i=t.split("&"),a=0;a<i.length;)(n=i[a++]).length&&(r=n.split("="),e.push({key:to(r.shift()),value:to(r.join("="))}))},so=function(e){this.entries.length=0,oo(this.entries,e)},co=function(e,t){if(e<t)throw TypeError("Not enough arguments")},uo=jr((function(e,t){Ka(this,{type:"URLSearchParamsIterator",iterator:ui(Qa(e).entries),kind:t})}),"Iterator",(function(){var e=Xa(this),t=e.kind,n=e.iterator.next(),r=n.value;return n.done||(n.value="keys"===t?r.key:"values"===t?r.value:[r.key,r.value]),n})),lo=function(){pi(this,lo,"URLSearchParams");var e,t,n,r,i,a,o,s,c,u=arguments.length>0?arguments[0]:void 0,d=this,l=[];if(Ka(d,{type:"URLSearchParams",entries:l,updateURL:function(){},updateSearchParams:so}),void 0!==u)if(G(u))if(e=ci(u))for(n=(t=ui(u,e)).next;!(r=n.call(t)).done;){if((o=(a=(i=ui(we(r.value))).next).call(i)).done||(s=a.call(i)).done||!a.call(i).done)throw TypeError("Expected sequence with length 2");l.push({key:xi(o.value),value:xi(s.value)})}else for(c in u)ue(u,c)&&l.push({key:c,value:xi(u[c])});else oo(l,"string"==typeof u?"?"===u.charAt(0)?u.slice(1):u:xi(u))},ho=lo.prototype;if(ki(ho,{append:function(e,t){co(arguments.length,2);var n=Qa(this);n.entries.push({key:xi(e),value:xi(t)}),n.updateURL()},delete:function(e){co(arguments.length,1);for(var t=Qa(this),n=t.entries,r=xi(e),i=0;i<n.length;)n[i].key===r?n.splice(i,1):i++;t.updateURL()},get:function(e){co(arguments.length,1);for(var t=Qa(this).entries,n=xi(e),r=0;r<t.length;r++)if(t[r].key===n)return t[r].value;return null},getAll:function(e){co(arguments.length,1);for(var t=Qa(this).entries,n=xi(e),r=[],i=0;i<t.length;i++)t[i].key===n&&r.push(t[i].value);return r},has:function(e){co(arguments.length,1);for(var t=Qa(this).entries,n=xi(e),r=0;r<t.length;)if(t[r++].key===n)return!0;return!1},set:function(e,t){co(arguments.length,1);for(var n,r=Qa(this),i=r.entries,a=!1,o=xi(e),s=xi(t),c=0;c<i.length;c++)(n=i[c]).key===o&&(a?i.splice(c--,1):(a=!0,n.value=s));a||i.push({key:o,value:s}),r.updateURL()},sort:function(){var e,t,n,r=Qa(this),i=r.entries,a=i.slice();for(i.length=0,n=0;n<a.length;n++){for(e=a[n],t=0;t<n;t++)if(i[t].key>e.key){i.splice(t,0,e);break}t===n&&i.push(e)}r.updateURL()},forEach:function(e){for(var t,n=Qa(this).entries,r=wt(e,arguments.length>1?arguments[1]:void 0,3),i=0;i<n.length;)r((t=n[i++]).value,t.key,this)},keys:function(){return new uo(this,"keys")},values:function(){return new uo(this,"values")},entries:function(){return new uo(this,"entries")}},{enumerable:!0}),$e(ho,qa,ho.entries,{name:"entries"}),$e(ho,"toString",(function(){for(var e,t=Qa(this).entries,n=[],r=0;r<t.length;)e=t[r++],n.push(ao(e.key)+"="+ao(e.value));return n.join("&")}),{enumerable:!0}),Ur(lo,"URLSearchParams"),Rt({global:!0,forced:!Ha},{URLSearchParams:lo}),!Ha&&H(Wa)){var po=function(e){if(G(e)){var t,n=e.body;if("URLSearchParams"===Dt(n))return(t=e.headers?new Wa(e.headers):new Wa).has("content-type")||t.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"),Sr(e,{body:O(0,String(n)),headers:O(0,t)})}return e};if(H(Ga)&&Rt({global:!0,enumerable:!0,forced:!0},{fetch:function(e){return Ga(e,arguments.length>1?po(arguments[1]):{})}}),H(Ja)){var fo=function(e){return pi(this,fo,"Request"),new Ja(e,arguments.length>1?po(arguments[1]):{})};za.constructor=fo,fo.prototype=za,Rt({global:!0,forced:!0},{Request:fo})}}var mo={URLSearchParams:lo,getState:Qa},_o=Object.is||function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t};Ea("search",(function(e,t,n){return[function(t){var n=j(this),r=null==t?void 0:re(t,e);return r?r.call(t,n):new RegExp(t)[e](xi(n))},function(e){var r=we(this),i=xi(e),a=n(t,r,i);if(a.done)return a.value;var o=r.lastIndex;_o(o,0)||(r.lastIndex=0);var s=Oa(r,i);return _o(r.lastIndex,o)||(r.lastIndex=o),null===s?-1:s.index}]}));(new Date).getTime();var vo=0,go=function(){return(new Date).getTime()+vo},yo=function(){var e=new Date;return e.setTime(go()),e.toLocaleString()};Ea("match",(function(e,t,n){return[function(t){var n=j(this),r=null==t?void 0:re(t,e);return r?r.call(t,n):new RegExp(t)[e](xi(n))},function(e){var r=we(this),i=xi(e),a=n(t,r,i);if(a.done)return a.value;if(!r.global)return Oa(r,i);var o=r.unicode;r.lastIndex=0;for(var s,c=[],u=0;null!==(s=Oa(r,i));){var d=xi(s[0]);c[u]=d,""===d&&(r.lastIndex=Aa(i,at(r.lastIndex),o)),u++}return 0===u?null:c}]}));var So=_e("match"),ko=function(e){var t;return G(e)&&(void 0!==(t=e[So])?!!t:"RegExp"==U(e))},bo=Ce.f,Io=pt.f,To=We.enforce,Ro=_e("match"),wo=A.RegExp,Eo=wo.prototype,Co=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,Ao=/a/g,xo=/a/g,Po=new wo(Ao)!==Ao,Do=ha.UNSUPPORTED_Y,No=P&&(!Po||Do||fa||_a||x((function(){return xo[Ro]=!1,wo(Ao)!=Ao||wo(xo)==xo||"/a/i"!=wo(Ao,"i")})));if(It("RegExp",No)){for(var Lo=function(e,t){var n,r,i,a,o,s,c=this instanceof Lo,u=ko(e),d=void 0===t,l=[],h=e;if(!c&&u&&d&&e.constructor===Lo)return e;if((u||e instanceof Lo)&&(e=e.source,d&&(t="flags"in h?h.flags:da.call(h))),e=void 0===e?"":xi(e),t=void 0===t?"":xi(t),h=e,fa&&"dotAll"in Ao&&(r=!!t&&t.indexOf("s")>-1)&&(t=t.replace(/s/g,"")),n=t,Do&&"sticky"in Ao&&(i=!!t&&t.indexOf("y")>-1)&&(t=t.replace(/y/g,"")),_a&&(e=(a=function(e){for(var t,n=e.length,r=0,i="",a=[],o={},s=!1,c=!1,u=0,d="";r<=n;r++){if("\\"===(t=e.charAt(r)))t+=e.charAt(++r);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:Co.test(e.slice(r+1))&&(r+=2,c=!0),i+=t,u++;continue;case">"===t&&c:if(""===d||ue(o,d))throw new SyntaxError("Invalid capture group name");o[d]=!0,a.push([d,u]),c=!1,d="";continue}c?d+=t:i+=t}return[i,a]}(e))[0],l=a[1]),o=yi(wo(e,t),c?this:Eo,Lo),(r||i||l.length)&&(s=To(o),r&&(s.dotAll=!0,s.raw=Lo(function(e){for(var t,n=e.length,r=0,i="",a=!1;r<=n;r++)"\\"!==(t=e.charAt(r))?a||"."!==t?("["===t?a=!0:"]"===t&&(a=!1),i+=t):i+="[\\s\\S]":i+=t+e.charAt(++r);return i}(e),n)),i&&(s.sticky=!0),l.length&&(s.groups=l)),e!==h)try{Ae(o,"source",""===h?"(?:)":h)}catch(JI){}return o},Oo=function(e){e in Lo||bo(Lo,e,{configurable:!0,get:function(){return wo[e]},set:function(t){wo[e]=t}})},Mo=Io(wo),Uo=0;Mo.length>Uo;)Oo(Mo[Uo++]);Eo.constructor=Lo,Lo.prototype=Eo,$e(A,"RegExp",Lo)}Ii("RegExp");var Vo=Xe.PROPER,Fo=RegExp.prototype,jo=Fo.toString,Bo=x((function(){return"/a/b"!=jo.call({source:"a",flags:"b"})})),Ho=Vo&&"toString"!=jo.name;(Bo||Ho)&&$e(RegExp.prototype,"toString",(function(){var e=we(this),t=xi(e.source),n=e.flags;return"/"+t+"/"+xi(void 0===n&&e instanceof RegExp&&!("flags"in Fo)?da.call(e):n)}),{unsafe:!0});var Go=1..valueOf,Jo=function(e){return Go.call(e)},zo="\t\n\v\f\r                 \u2028\u2029\ufeff",Wo="["+zo+"]",qo=RegExp("^"+Wo+Wo+"*"),Ko=RegExp(Wo+Wo+"*$"),Qo=function(e){return function(t){var n=xi(j(t));return 1&e&&(n=n.replace(qo,"")),2&e&&(n=n.replace(Ko,"")),n}},Xo={start:Qo(1),end:Qo(2),trim:Qo(3)},$o=pt.f,Yo=Re.f,Zo=Ce.f,es=Xo.trim,ts=A.Number,ns=ts.prototype,rs=function(e){var t=ge(e,"number");return"bigint"==typeof t?t:is(t)},is=function(e){var t,n,r,i,a,o,s,c,u=ge(e,"number");if(ee(u))throw TypeError("Cannot convert a Symbol value to a number");if("string"==typeof u&&u.length>2)if(43===(t=(u=es(u)).charCodeAt(0))||45===t){if(88===(n=u.charCodeAt(2))||120===n)return NaN}else if(48===t){switch(u.charCodeAt(1)){case 66:case 98:r=2,i=49;break;case 79:case 111:r=8,i=55;break;default:return+u}for(o=(a=u.slice(2)).length,s=0;s<o;s++)if((c=a.charCodeAt(s))<48||c>i)return NaN;return parseInt(a,r)}return+u};if(It("Number",!ts(" 0o1")||!ts("0b1")||ts("+0x1"))){for(var as,os=function(e){var t=arguments.length<1?0:ts(rs(e)),n=this;return n instanceof os&&x((function(){Jo(n)}))?yi(Object(t),n,os):t},ss=P?$o(ts):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,fromString,range".split(","),cs=0;ss.length>cs;cs++)ue(ts,as=ss[cs])&&!ue(os,as)&&Zo(os,as,Yo(ts,as));os.prototype=ns,ns.constructor=os,$e(A,"Number",os)}var us=ct.indexOf,ds=[].indexOf,ls=!!ds&&1/[1].indexOf(1,-0)<0,hs=Qi("indexOf");Rt({target:"Array",proto:!0,forced:ls||!hs},{indexOf:function(e){return ls?ds.apply(this,arguments)||0:us(this,e,arguments.length>1?arguments[1]:void 0)}});var ps=x((function(){Pr(1)}));Rt({target:"Object",stat:!0,forced:ps,sham:!Cr},{getPrototypeOf:function(e){return Pr(se(e))}});var fs=z("Reflect","apply"),ms=Function.apply,_s=!x((function(){fs((function(){}))}));Rt({target:"Reflect",stat:!0,forced:_s},{apply:function(e,t,n){return ne(e),we(n),fs?fs(e,t,n):ms.call(e,t,n)}});var vs=Xe.EXISTS,gs=Ce.f,ys=Function.prototype,Ss=ys.toString,ks=/^\s*function ([^ (]*)/;P&&!vs&&gs(ys,"name",{configurable:!0,get:function(){try{return Ss.call(this).match(ks)[1]}catch(JI){return""}}}),Rt({target:"Date",stat:!0},{now:function(){return(new Date).getTime()}});var bs=_e("species"),Is=function(e,t){var n,r=we(e).constructor;return void 0===r||null==(n=we(r)[bs])?t:function(e){if(Ft(e))return e;throw TypeError(te(e)+" is not a constructor")}(n)},Ts=ha.UNSUPPORTED_Y,Rs=[].push,ws=Math.min;Ea("split",(function(e,t,n){var r;return r="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(e,n){var r=xi(j(this)),i=void 0===n?4294967295:n>>>0;if(0===i)return[];if(void 0===e)return[r];if(!ko(e))return t.call(r,e,i);for(var a,o,s,c=[],u=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),d=0,l=new RegExp(e.source,u+"g");(a=Ta.call(l,r))&&!((o=l.lastIndex)>d&&(c.push(r.slice(d,a.index)),a.length>1&&a.index<r.length&&Rs.apply(c,a.slice(1)),s=a[0].length,d=o,c.length>=i));)l.lastIndex===a.index&&l.lastIndex++;return d===r.length?!s&&l.test("")||c.push(""):c.push(r.slice(d)),c.length>i?c.slice(0,i):c}:"0".split(void 0,0).length?function(e,n){return void 0===e&&0===n?[]:t.call(this,e,n)}:t,[function(t,n){var i=j(this),a=null==t?void 0:re(t,e);return a?a.call(t,i,n):r.call(xi(i),t,n)},function(e,i){var a=we(this),o=xi(e),s=n(r,a,o,i,r!==t);if(s.done)return s.value;var c=Is(a,RegExp),u=a.unicode,d=(a.ignoreCase?"i":"")+(a.multiline?"m":"")+(a.unicode?"u":"")+(Ts?"g":"y"),l=new c(Ts?"^(?:"+a.source+")":a,d),h=void 0===i?4294967295:i>>>0;if(0===h)return[];if(0===o.length)return null===Oa(l,o)?[o]:[];for(var p=0,f=0,m=[];f<o.length;){l.lastIndex=Ts?0:f;var _,v=Oa(l,Ts?o.slice(f):o);if(null===v||(_=ws(at(l.lastIndex+(Ts?f:0)),o.length))===p)f=Aa(o,f,u);else{if(m.push(o.slice(p,f)),m.length===h)return m;for(var g=1;g<=v.length-1;g++)if(m.push(v[g]),m.length===h)return m;f=p=_}}return m.push(o.slice(p)),m}]}),!!x((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var n="ab".split(e);return 2!==n.length||"a"!==n[0]||"b"!==n[1]})),Ts);var Es,Cs,As,xs,Ps=A.Promise,Ds=/(?:ipad|iphone|ipod).*applewebkit/i.test(W),Ns="process"==U(A.process),Ls=A.setImmediate,Os=A.clearImmediate,Ms=A.process,Us=A.MessageChannel,Vs=A.Dispatch,Fs=0,js={};try{Es=A.location}catch(JI){}var Bs=function(e){if(js.hasOwnProperty(e)){var t=js[e];delete js[e],t()}},Hs=function(e){return function(){Bs(e)}},Gs=function(e){Bs(e.data)},Js=function(e){A.postMessage(String(e),Es.protocol+"//"+Es.host)};Ls&&Os||(Ls=function(e){for(var t=[],n=arguments.length,r=1;n>r;)t.push(arguments[r++]);return js[++Fs]=function(){(H(e)?e:Function(e)).apply(void 0,t)},Cs(Fs),Fs},Os=function(e){delete js[e]},Ns?Cs=function(e){Ms.nextTick(Hs(e))}:Vs&&Vs.now?Cs=function(e){Vs.now(Hs(e))}:Us&&!Ds?(xs=(As=new Us).port2,As.port1.onmessage=Gs,Cs=wt(xs.postMessage,xs,1)):A.addEventListener&&H(A.postMessage)&&!A.importScripts&&Es&&"file:"!==Es.protocol&&!x(Js)?(Cs=Js,A.addEventListener("message",Gs,!1)):Cs="onreadystatechange"in be("script")?function(e){fr.appendChild(be("script")).onreadystatechange=function(){fr.removeChild(this),Bs(e)}}:function(e){setTimeout(Hs(e),0)});var zs,Ws,qs,Ks,Qs,Xs,$s,Ys,Zs={set:Ls,clear:Os},ec=/ipad|iphone|ipod/i.test(W)&&void 0!==A.Pebble,tc=/web0s(?!.*chrome)/i.test(W),nc=Re.f,rc=Zs.set,ic=A.MutationObserver||A.WebKitMutationObserver,ac=A.document,oc=A.process,sc=A.Promise,cc=nc(A,"queueMicrotask"),uc=cc&&cc.value;uc||(zs=function(){var e,t;for(Ns&&(e=oc.domain)&&e.exit();Ws;){t=Ws.fn,Ws=Ws.next;try{t()}catch(JI){throw Ws?Ks():qs=void 0,JI}}qs=void 0,e&&e.enter()},Ds||Ns||tc||!ic||!ac?!ec&&sc&&sc.resolve?(($s=sc.resolve(void 0)).constructor=sc,Ys=$s.then,Ks=function(){Ys.call($s,zs)}):Ks=Ns?function(){oc.nextTick(zs)}:function(){rc.call(A,zs)}:(Qs=!0,Xs=ac.createTextNode(""),new ic(zs).observe(Xs,{characterData:!0}),Ks=function(){Xs.data=Qs=!Qs}));var dc,lc,hc,pc,fc=uc||function(e){var t={fn:e,next:void 0};qs&&(qs.next=t),Ws||(Ws=t,Ks()),qs=t},mc=function(e){var t,n;this.promise=new e((function(e,r){if(void 0!==t||void 0!==n)throw TypeError("Bad Promise constructor");t=e,n=r})),this.resolve=ne(t),this.reject=ne(n)},_c={f:function(e){return new mc(e)}},vc=function(e){try{return{error:!1,value:e()}}catch(JI){return{error:!0,value:JI}}},gc="object"==typeof window,yc=Zs.set,Sc=_e("species"),kc="Promise",bc=We.get,Ic=We.set,Tc=We.getterFor(kc),Rc=Ps&&Ps.prototype,wc=Ps,Ec=Rc,Cc=A.TypeError,Ac=A.document,xc=A.process,Pc=_c.f,Dc=Pc,Nc=!!(Ac&&Ac.createEvent&&A.dispatchEvent),Lc=H(A.PromiseRejectionEvent),Oc=!1,Mc=It(kc,(function(){var e=Le(wc),t=e!==String(wc);if(!t&&66===$)return!0;if($>=51&&/native code/.test(e))return!1;var n=new wc((function(e){e(1)})),r=function(e){e((function(){}),(function(){}))};return(n.constructor={})[Sc]=r,!(Oc=n.then((function(){}))instanceof r)||!t&&gc&&!Lc})),Uc=Mc||!gi((function(e){wc.all(e).catch((function(){}))})),Vc=function(e){var t;return!(!G(e)||!H(t=e.then))&&t},Fc=function(e,t){if(!e.notified){e.notified=!0;var n=e.reactions;fc((function(){for(var r=e.value,i=1==e.state,a=0;n.length>a;){var o,s,c,u=n[a++],d=i?u.ok:u.fail,l=u.resolve,h=u.reject,p=u.domain;try{d?(i||(2===e.rejection&&Gc(e),e.rejection=1),!0===d?o=r:(p&&p.enter(),o=d(r),p&&(p.exit(),c=!0)),o===u.promise?h(Cc("Promise-chain cycle")):(s=Vc(o))?s.call(o,l,h):l(o)):h(r)}catch(JI){p&&!c&&p.exit(),h(JI)}}e.reactions=[],e.notified=!1,t&&!e.rejection&&Bc(e)}))}},jc=function(e,t,n){var r,i;Nc?((r=Ac.createEvent("Event")).promise=t,r.reason=n,r.initEvent(e,!1,!0),A.dispatchEvent(r)):r={promise:t,reason:n},!Lc&&(i=A["on"+e])?i(r):"unhandledrejection"===e&&function(e,t){var n=A.console;n&&n.error&&(1===arguments.length?n.error(e):n.error(e,t))}("Unhandled promise rejection",n)},Bc=function(e){yc.call(A,(function(){var t,n=e.facade,r=e.value;if(Hc(e)&&(t=vc((function(){Ns?xc.emit("unhandledRejection",r,n):jc("unhandledrejection",n,r)})),e.rejection=Ns||Hc(e)?2:1,t.error))throw t.value}))},Hc=function(e){return 1!==e.rejection&&!e.parent},Gc=function(e){yc.call(A,(function(){var t=e.facade;Ns?xc.emit("rejectionHandled",t):jc("rejectionhandled",t,e.value)}))},Jc=function(e,t,n){return function(r){e(t,r,n)}},zc=function(e,t,n){e.done||(e.done=!0,n&&(e=n),e.value=t,e.state=2,Fc(e,!0))},Wc=function(e,t,n){if(!e.done){e.done=!0,n&&(e=n);try{if(e.facade===t)throw Cc("Promise can't be resolved itself");var r=Vc(t);r?fc((function(){var n={done:!1};try{r.call(t,Jc(Wc,n,e),Jc(zc,n,e))}catch(JI){zc(n,JI,e)}})):(e.value=t,e.state=1,Fc(e,!1))}catch(JI){zc({done:!1},JI,e)}}};if(Mc&&(Ec=(wc=function(e){pi(this,wc,kc),ne(e),dc.call(this);var t=bc(this);try{e(Jc(Wc,t),Jc(zc,t))}catch(JI){zc(t,JI)}}).prototype,(dc=function(e){Ic(this,{type:kc,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0})}).prototype=ki(Ec,{then:function(e,t){var n=Tc(this),r=Pc(Is(this,wc));return r.ok=!H(e)||e,r.fail=H(t)&&t,r.domain=Ns?xc.domain:void 0,n.parent=!0,n.reactions.push(r),0!=n.state&&Fc(n,!1),r.promise},catch:function(e){return this.then(void 0,e)}}),lc=function(){var e=new dc,t=bc(e);this.promise=e,this.resolve=Jc(Wc,t),this.reject=Jc(zc,t)},_c.f=Pc=function(e){return e===wc||e===hc?new lc(e):Dc(e)},H(Ps)&&Rc!==Object.prototype)){pc=Rc.then,Oc||($e(Rc,"then",(function(e,t){var n=this;return new wc((function(e,t){pc.call(n,e,t)})).then(e,t)}),{unsafe:!0}),$e(Rc,"catch",Ec.catch,{unsafe:!0}));try{delete Rc.constructor}catch(JI){}Br&&Br(Rc,Ec)}Rt({global:!0,wrap:!0,forced:Mc},{Promise:wc}),Ur(wc,kc,!1),Ii(kc),hc=z(kc),Rt({target:kc,stat:!0,forced:Mc},{reject:function(e){var t=Pc(this);return t.reject.call(void 0,e),t.promise}}),Rt({target:kc,stat:!0,forced:Mc},{resolve:function(e){return function(e,t){if(we(e),G(t)&&t.constructor===e)return t;var n=_c.f(e);return(0,n.resolve)(t),n.promise}(this,e)}}),Rt({target:kc,stat:!0,forced:Uc},{all:function(e){var t=this,n=Pc(t),r=n.resolve,i=n.reject,a=vc((function(){var n=ne(t.resolve),a=[],o=0,s=1;hi(e,(function(e){var c=o++,u=!1;a.push(void 0),s++,n.call(t,e).then((function(e){u||(u=!0,a[c]=e,--s||r(a))}),i)})),--s||r(a)}));return a.error&&i(a.value),n.promise},race:function(e){var t=this,n=Pc(t),r=n.reject,i=vc((function(){var i=ne(t.resolve);hi(e,(function(e){i.call(t,e).then(n.resolve,r)}))}));return i.error&&r(i.value),n.promise}});var qc=Xo.trim,Kc=A.parseFloat,Qc=A.Symbol,Xc=Qc&&Qc.iterator,$c=1/Kc(zo+"-0")!=-Infinity||Xc&&!x((function(){Kc(Object(Xc))}))?function(e){var t=qc(xi(e)),n=Kc(t);return 0===n&&"-"==t.charAt(0)?-0:n}:Kc;Rt({global:!0,forced:parseFloat!=$c},{parseFloat:$c});var Yc,Zc=window.navigator&&window.navigator.userAgent||"",eu=/AppleWebKit\/([\d.]+)/i.exec(Zc),tu=(eu&&parseFloat(eu.pop()),/iPad/i.test(Zc)),nu=navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/Macintosh/.test(Zc),ru=/iPhone/i.test(Zc)&&!tu,iu=/iPod/i.test(Zc),au=ru||tu||iu||nu,ou=/Android/i.test(Zc),su=ou&&function(){var e=Zc.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;var t=e[1]&&parseFloat(e[1]),n=e[2]&&parseFloat(e[2]);return t&&n?parseFloat(e[1]+"."+e[2]):t||null}(),cu=(ou&&/webkit/i.test(Zc),/Firefox/i.test(Zc)),uu=cu&&function(){var e=Zc.match(/Firefox\/(\d+)/);return e&&e[1]?parseFloat(e[1]):null}(),du=/Edge\//i.test(Zc),lu=du&&function(){var e=Zc.match(/Edge\/(\d+)/i);if(e&&e[1])return e[1]}(),hu=/Edg\//i.test(Zc),pu=hu&&function(){var e=Zc.match(/Edg\/(\d+)/);return e&&e[1]?parseFloat(e[1]):null}(),fu=/SogouMobileBrowser\//i.test(Zc),mu=fu&&function(){var e=Zc.match(/SogouMobileBrowser\/(\d+)/);return e&&e[1]?parseFloat(e[1]):null}(),_u=/MetaSr\s/i.test(Zc),vu=_u&&function(){var e=Zc.match(/MetaSr(\s\d+(\.\d+)+)/);return e&&e[1]?parseFloat(e[1]):null}(),gu=/TBS\/\d+/i.test(Zc),yu=gu&&function(){var e=Zc.match(/TBS\/(\d+)/i);if(e&&e[1])return e[1]}(),Su=/XWEB\/\d+/i.test(Zc),ku=Su&&function(){var e=Zc.match(/XWEB\/(\d+)/i);if(e&&e[1])return e[1]}(),bu=(/MSIE\s8\.0/.test(Zc),/MSIE\/\d+/i.test(Zc)&&function(){var e=/MSIE\s(\d+)\.\d/.exec(Zc),t=e&&parseFloat(e[1]);!t&&/Trident\/7.0/i.test(Zc)&&/rv:11.0/.test(Zc)&&(t=11)}(),/(micromessenger|webbrowser)/i.test(Zc)),Iu=bu&&function(){var e=Zc.match(/MicroMessenger\/(\d+)/i);if(e&&e[1])return e[1]}(),Tu=!gu&&/MQQBrowser\/\d+/i.test(Zc)&&/COVC\/\d+/i.test(Zc),Ru=!gu&&/MQQBrowser\/\d+/i.test(Zc)&&!/COVC\/\d+/i.test(Zc),wu=(Ru||Tu)&&function(){var e=Zc.match(/ MQQBrowser\/([\d.]+)/);return e&&e[1]?e[1]:null}(),Eu=!gu&&/ QQBrowser\/\d+/i.test(Zc),Cu=Eu&&function(){var e=Zc.match(/ QQBrowser\/([\d.]+)/);return e&&e[1]?e[1]:null}(),Au=!gu&&/QQBrowserLite\/\d+/i.test(Zc),xu=Au&&function(){var e=Zc.match(/QQBrowserLite\/([\d.]+)/);return e&&e[1]?e[1]:null}(),Pu=!gu&&/MQBHD\/\d+/i.test(Zc),Du=Pu&&function(){var e=Zc.match(/MQBHD\/([\d.]+)/);return e&&e[1]?e[1]:null}(),Nu=/Windows/i.test(Zc),Lu=!au&&/MAC OS X/i.test(Zc),Ou=!ou&&/Linux/i.test(Zc),Mu=(/MicroMessenger/i.test(Zc),/UCBrowser/i.test(Zc)),Uu=(/Electron/i.test(Zc),/MiuiBrowser/i.test(Zc)),Vu=Uu&&function(){var e=Zc.match(/MiuiBrowser\/([\d.]+)/);return e&&e[1]?e[1]:null}(),Fu=/HuaweiBrowser/i.test(Zc),ju=/Huawei/i.test(Zc),Bu=Fu&&function(){var e=Zc.match(/HuaweiBrowser\/([\d.]+)/);return e&&e[1]?e[1]:null}(),Hu=/SamsungBrowser/i.test(Zc),Gu=Hu&&function(){var e=Zc.match(/SamsungBrowser\/([\d.]+)/);return e&&e[1]?e[1]:null}(),Ju=/HeyTapBrowser/i.test(Zc),zu=Ju&&function(){var e=Zc.match(/HeyTapBrowser\/([\d.]+)/);return e&&e[1]?e[1]:null}(),Wu=/VivoBrowser/i.test(Zc),qu=Wu&&function(){var e=Zc.match(/VivoBrowser\/([\d.]+)/);return e&&e[1]?e[1]:null}(),Ku=function(){var e=Zc.match(/Chrome\/(\d+)/);return e&&e[1]?Number(e[1]):null},Qu=/Chrome/i.test(Zc),Xu=!du&&!_u&&!fu&&!gu&&!Su&&!hu&&!Eu&&!Uu&&!Fu&&!Hu&&!Ju&&!Wu&&/Chrome/i.test(Zc),$u=Xu&&Ku(),Yu=Xu&&function(){var e=Zc.match(/Chrome\/([\d.]+)/);return e&&e[1]?e[1]:null}(),Zu=!Qu&&!Ru&&!Tu&&!Au&&!Pu&&/Safari/i.test(Zc),ed=Zu&&function(){var e=Zc.match(/Version\/([\d.]+)/);return e&&e[1]?e[1]:null}(),td=/Android.*(wv|.0.0.0)/.test(Zc),nd=function(){if(nu)return ed;if(au){var e=Zc.match(/OS (\d+)_(\d+)/i);if(e&&e[1]){var t=e[1];return e[2]&&(t+=".".concat(e[2])),t}}return""}(),rd="15.1"===nd,id="file:"===location.protocol||"localhost"===location.hostname||"127.0.0.1"===location.hostname,ad=function(){if(Sh(Yc))try{Yc=window.localStorage}catch(JI){Bf.warn(JI),Yc=!1}return Yc},od=new Map([[cu,["Firefox",uu]],[hu,["Edg",pu]],[Xu,["Chrome",Yu]],[Zu,["Safari",ed]],[gu,["TBS",yu]],[Su,["XWEB",ku]],[bu&&ru,["WeChat",Iu]],[Eu,["QQ(Win)",Cu]],[Ru,["QQ(Mobile)",wu]],[Tu,["QQ(Mobile X5)",wu]],[Au,["QQ(Mac)",xu]],[Pu,["QQ(iPad)",Du]],[Uu,["MI",Vu]],[Fu,["HW",Bu]],[Hu,["Samsung",Gu]],[Ju,["OPPO",zu]],[Wu,["VIVO",qu]],[du,["EDGE",lu]],[fu,["SogouMobile",mu]],[_u,["Sogou",vu]]]);function sd(){var e="unknown",t="unknown";return od.get(!0)&&(e=od.get(!0)[0],t=od.get(!0)[1]),{name:e,version:t}}var cd=x((function(){hr(1)}));Rt({target:"Object",stat:!0,forced:cd},{keys:function(e){return hr(se(e))}});var ud="canvas",dd="audio",ld="video",hd="auxiliary",pd="user",fd="environment",md="mute",_d="unmute",vd="ended",gd="playing",yd="pause",Sd="error",kd="loadeddata",bd="audioinput",Id="videoinput",Td="detail",Rd="text",wd="main",Ed="backup",Cd="banned",Ad="kick",xd="user_time_out",Pd="wss://trtc.rtc.qq.com",Dd="wss://webrtc.qq.com",Nd="qcloud",Ld="trtc",Od="webrtc",Md="",Ud="jssdk_log",Vd="jssdk_event",Fd="jssdk_new_endreport",jd=function(e){return Md=e},Bd=1,Hd=2,Gd=20,Jd=21,zd="5Y2wZK8nANNAoVw6dSAHVjNxrD1ObBM2kBPV",Wd="224d130c-7b5c-415b-aaa2-79c2eb5a6df2",qd=2,Kd=wd,Qd=hd,Xd="DISCONNECTED",$d="CONNECTING",Yd="RECONNECTING",Zd="CONNECTED",el="new",tl="connecting",nl="failed",rl="closed",il="disconnected",al="connected",ol="completed",sl="join",cl="delta-join",ul="rejoin",dl="leave",ll="delta-leave",hl="publish",pl="delta-publish",fl="unpublish",ml="subscribe",_l="unsubscribe",vl="uplink-connection",gl="uplink-reconnection",yl="downlink-connection",Sl="downlink-reconnection",kl="setLocalDescription",bl="setRemoteDescription",Il="iceConnectionState",Tl="stream-initialize",Rl="websocketConnectionState",wl="websocketReconnectionState",El="update-stream",Cl="recover-subscription",Al="start-mix-transcode",xl="stop-mix-transcode",Pl="player-error",Dl="schedule",Nl="load-worklet",Ll="unsubscribe",Ol="subscribe_change",Ml={MANUAL:"manual",PRESET_LAYOUT:"preset-layout"},Ul={REMOTE:"$PLACE_HOLDER_REMOTE$"},Vl={IT_AUDIO_VIDEO:0,IT_PICTURE:2,IT_CANVAS:3,IT_PURE_AUDIO:4,IT_PURE_VIDEO:5},Fl="string",jl="number",Bl="boolean",Hl="array",Gl="object",Jl="add",zl="remove",Wl={unknown:0,wifi:1,"4g":2,"3g":3,"2g":4,wired:5},ql=-1,Kl=0,Ql=1,Xl="schedule.rtc.qq.com",$l="schedule.rtc.qcloud.com",Yl="intl-schedule.rtc.qq.com",Zl="intl-schedule.rtc.qcloud.com",eh="TRTC",th="Client",nh="LocalStream",rh="RemoteStream",ih="Stream",ah="web.sdk.qcloud.com",oh="web.sdk.tencent.cn",sh="web.sdk.cloud.tencent.cn",ch="https://".concat(ah,"/trtc/webrtc/doc"),uh="".concat(ch,"/zh-cn/"),dh={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,NONE:5},lh=Object.keys(dh),hh=["normal leave","timeout leave","kick","role change"],ph=function(){return function(e){var t=window.location.search.match(new RegExp("(\\?|&)"+e+"=([^&]*)(&|$)"));return t?decodeURIComponent(t[2]):""}("trtc_env")},fh=function(e){return Number(e)<14e8},mh=function(e,t){var n;n=Md||(fh(e)?"https://videoapi-sgp.im.qcloud.com":"https://yun.tim.qq.com");var r=Math.floor(Math.random()*Math.pow(2,31));return"".concat(n,"/v5/AVQualityReportSvc/C2S?random=").concat(r,"&sdkappid=").concat(e,"&cmdtype=").concat(t)};function _h(){var e=navigator.userAgent,t=navigator.connection,n=e.match(/NetType\/\w+/)?e.match(/NetType\/\w+/)[0]:"";"3gnet"===(n=n.toLowerCase().replace("nettype/",""))&&(n="3g");var r=t&&t.type&&t.type.toLowerCase(),i=t&&t.effectiveType&&t.effectiveType.toLowerCase();"slow-2"===i&&(i="2g");var a=n||"unknown";if(r)switch(r){case"cellular":case"wimax":a=i||"unknown";break;case"wifi":a="wifi";break;case"ethernet":a="wired";break;case"none":case"other":case"unknown":a="unknown"}return a}var vh=function(e){if(!e||"object"!==n(e)||"[object Object]"!=Object.prototype.toString.call(e))return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;var r=Object.prototype.hasOwnProperty.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&Function.prototype.toString.call(r)===Function.prototype.toString.call(Object)};function gh(e){var t=Math.round(e/2)+1;return t>6?13e3:1e3*function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return t<=1?r:e(t-1,r,n+r)}(t)}var yh=function(e){return"function"==typeof e},Sh=function(e){return void 0===e},kh=function(e){return"string"==typeof e},bh=function(e){return"number"==typeof e},Ih=function(e){return"boolean"==typeof e},Th=function(e){return"array"===wh(e)},Rh=function(e){return wh(e)==="MediaStreamTrack".toLowerCase()};function wh(e){return Reflect.apply(Object.prototype.toString,e,[]).replace(/^\[object\s(\w+)\]$/,"$1").toLowerCase()}function Eh(e){var t={};return t.urls="turn:".concat(e.url),Sh(e.username)||Sh(e.credential)||(t.username=e.username,t.credential=e.credential,t.credentialType="password",Sh(e.credentialType)||(t.credentialType=e.credentialType)),t}function Ch(){return performance&&performance.now?Math.floor(performance.now()):Date.now()}function Ah(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"big";if(!kh(e))return 0;var n=e.split(".");return"big"===t?(Number(n[0])<<24|Number(n[1])<<16|Number(n[2])<<8|Number(n[3]))>>>0:(Number(n[3])<<24|Number(n[2])<<16|Number(n[1])<<8|Number(n[0]))>>>0}var xh,Ph,Dh=function(){var e=navigator.language||navigator.userLanguage;return"zh"===(e=e.substr(0,2))},Nh=(xh=!1,Ph=document.visibilityState,function(){document.visibilityState!==Ph&&Bf.info("visibility change: ".concat(document.visibilityState)),xh||(document.addEventListener("visibilitychange",(function(){Bf.info("visibility change: "+document.visibilityState),Ph=document.visibilityState})),xh=!0)}),Lh=!!window.AudioWorkletNode,Oh=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return e.apply(t,n)}},Mh=Object.prototype.toString;function Uh(e){return"[object Array]"===Mh.call(e)}function Vh(e){return void 0===e}function Fh(e){return null!==e&&"object"==typeof e}function jh(e){return"[object Function]"===Mh.call(e)}function Bh(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),Uh(e))for(var n=0,r=e.length;n<r;n++)t.call(null,e[n],n,e);else for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.call(null,e[i],i,e)}var Hh={isArray:Uh,isArrayBuffer:function(e){return"[object ArrayBuffer]"===Mh.call(e)},isBuffer:function(e){return null!==e&&!Vh(e)&&null!==e.constructor&&!Vh(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:Fh,isUndefined:Vh,isDate:function(e){return"[object Date]"===Mh.call(e)},isFile:function(e){return"[object File]"===Mh.call(e)},isBlob:function(e){return"[object Blob]"===Mh.call(e)},isFunction:jh,isStream:function(e){return Fh(e)&&jh(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:Bh,merge:function e(){var t={};function n(n,r){"object"==typeof t[r]&&"object"==typeof n?t[r]=e(t[r],n):t[r]=n}for(var r=0,i=arguments.length;r<i;r++)Bh(arguments[r],n);return t},deepMerge:function e(){var t={};function n(n,r){"object"==typeof t[r]&&"object"==typeof n?t[r]=e(t[r],n):t[r]="object"==typeof n?e({},n):n}for(var r=0,i=arguments.length;r<i;r++)Bh(arguments[r],n);return t},extend:function(e,t,n){return Bh(t,(function(t,r){e[r]=n&&"function"==typeof t?Oh(t,n):t})),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}};function Gh(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var Jh=function(e,t,n){if(!t)return e;var r;if(n)r=n(t);else if(Hh.isURLSearchParams(t))r=t.toString();else{var i=[];Hh.forEach(t,(function(e,t){null!=e&&(Hh.isArray(e)?t+="[]":e=[e],Hh.forEach(e,(function(e){Hh.isDate(e)?e=e.toISOString():Hh.isObject(e)&&(e=JSON.stringify(e)),i.push(Gh(t)+"="+Gh(e))})))})),r=i.join("&")}if(r){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),e+=(-1===e.indexOf("?")?"?":"&")+r}return e};function zh(){this.handlers=[]}zh.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},zh.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},zh.prototype.forEach=function(e){Hh.forEach(this.handlers,(function(t){null!==t&&e(t)}))};var Wh=zh,qh=function(e,t,n){return Hh.forEach(n,(function(n){e=n(e,t)})),e},Kh=function(e){return!(!e||!e.__CANCEL__)},Qh="undefined"!=typeof __webpack_require__.g?__webpack_require__.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function Xh(){throw new Error("setTimeout has not been defined")}function $h(){throw new Error("clearTimeout has not been defined")}var Yh=Xh,Zh=$h;function ep(e){if(Yh===setTimeout)return setTimeout(e,0);if((Yh===Xh||!Yh)&&setTimeout)return Yh=setTimeout,setTimeout(e,0);try{return Yh(e,0)}catch(t){try{return Yh.call(null,e,0)}catch(t){return Yh.call(this,e,0)}}}"function"==typeof Qh.setTimeout&&(Yh=setTimeout),"function"==typeof Qh.clearTimeout&&(Zh=clearTimeout);var tp,np=[],rp=!1,ip=-1;function ap(){rp&&tp&&(rp=!1,tp.length?np=tp.concat(np):ip=-1,np.length&&op())}function op(){if(!rp){var e=ep(ap);rp=!0;for(var t=np.length;t;){for(tp=np,np=[];++ip<t;)tp&&tp[ip].run();ip=-1,t=np.length}tp=null,rp=!1,function(e){if(Zh===clearTimeout)return clearTimeout(e);if((Zh===$h||!Zh)&&clearTimeout)return Zh=clearTimeout,clearTimeout(e);try{Zh(e)}catch(t){try{return Zh.call(null,e)}catch(t){return Zh.call(this,e)}}}(e)}}function sp(e,t){this.fun=e,this.array=t}sp.prototype.run=function(){this.fun.apply(null,this.array)};function cp(){}var up=cp,dp=cp,lp=cp,hp=cp,pp=cp,fp=cp,mp=cp;var _p=Qh.performance||{},vp=_p.now||_p.mozNow||_p.msNow||_p.oNow||_p.webkitNow||function(){return(new Date).getTime()};var gp=new Date;var yp={nextTick:function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];np.push(new sp(e,t)),1!==np.length||rp||ep(op)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:up,addListener:dp,once:lp,off:hp,removeListener:pp,removeAllListeners:fp,emit:mp,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*vp.call(_p),n=Math.floor(t),r=Math.floor(t%1*1e9);return e&&(n-=e[0],(r-=e[1])<0&&(n--,r+=1e9)),[n,r]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-gp)/1e3}},Sp=function(e,t){Hh.forEach(e,(function(n,r){r!==t&&r.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[r])}))},kp=function(e,t,n,r,i){return function(e,t,n,r,i){return e.config=t,n&&(e.code=n),e.request=r,e.response=i,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}(new Error(e),t,n,r,i)},bp=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],Ip=Hh.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function r(e){var r=e;return t&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return e=r(window.location.href),function(t){var n=Hh.isString(t)?r(t):t;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0},Tp=Hh.isStandardBrowserEnv()?{write:function(e,t,n,r,i,a){var o=[];o.push(e+"="+encodeURIComponent(t)),Hh.isNumber(n)&&o.push("expires="+new Date(n).toGMTString()),Hh.isString(r)&&o.push("path="+r),Hh.isString(i)&&o.push("domain="+i),!0===a&&o.push("secure"),document.cookie=o.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},Rp=function(e){return new Promise((function(t,n){var r=e.data,i=e.headers;Hh.isFormData(r)&&delete i["Content-Type"];var a=new XMLHttpRequest;if(e.auth){var o=e.auth.username||"",s=e.auth.password||"";i.Authorization="Basic "+btoa(o+":"+s)}var c,u,d=(c=e.baseURL,u=e.url,c&&!/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(u)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(c,u):u);if(a.open(e.method.toUpperCase(),Jh(d,e.params,e.paramsSerializer),!0),a.timeout=e.timeout,a.onreadystatechange=function(){if(a&&4===a.readyState&&(0!==a.status||a.responseURL&&0===a.responseURL.indexOf("file:"))){var r="getAllResponseHeaders"in a?function(e){var t,n,r,i={};return e?(Hh.forEach(e.split("\n"),(function(e){if(r=e.indexOf(":"),t=Hh.trim(e.substr(0,r)).toLowerCase(),n=Hh.trim(e.substr(r+1)),t){if(i[t]&&bp.indexOf(t)>=0)return;i[t]="set-cookie"===t?(i[t]?i[t]:[]).concat([n]):i[t]?i[t]+", "+n:n}})),i):i}(a.getAllResponseHeaders()):null,i={data:e.responseType&&"text"!==e.responseType?a.response:a.responseText,status:a.status,statusText:a.statusText,headers:r,config:e,request:a};!function(e,t,n){var r=n.config.validateStatus;!r||r(n.status)?e(n):t(kp("Request failed with status code "+n.status,n.config,null,n.request,n))}(t,n,i),a=null}},a.onabort=function(){a&&(n(kp("Request aborted",e,"ECONNABORTED",a)),a=null)},a.onerror=function(){n(kp("Network Error",e,null,a)),a=null},a.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(kp(t,e,"ECONNABORTED",a)),a=null},Hh.isStandardBrowserEnv()){var l=Tp,h=(e.withCredentials||Ip(d))&&e.xsrfCookieName?l.read(e.xsrfCookieName):void 0;h&&(i[e.xsrfHeaderName]=h)}if("setRequestHeader"in a&&Hh.forEach(i,(function(e,t){void 0===r&&"content-type"===t.toLowerCase()?delete i[t]:a.setRequestHeader(t,e)})),Hh.isUndefined(e.withCredentials)||(a.withCredentials=!!e.withCredentials),e.responseType)try{a.responseType=e.responseType}catch(p){if("json"!==e.responseType)throw p}"function"==typeof e.onDownloadProgress&&a.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&a.upload&&a.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){a&&(a.abort(),n(e),a=null)})),void 0===r&&(r=null),a.send(r)}))},wp={"Content-Type":"application/x-www-form-urlencoded"};function Ep(e,t){!Hh.isUndefined(e)&&Hh.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var Cp={adapter:function(){var e;return("undefined"!=typeof XMLHttpRequest||void 0!==yp&&"[object process]"===Object.prototype.toString.call(yp))&&(e=Rp),e}(),transformRequest:[function(e,t){return Sp(t,"Accept"),Sp(t,"Content-Type"),Hh.isFormData(e)||Hh.isArrayBuffer(e)||Hh.isBuffer(e)||Hh.isStream(e)||Hh.isFile(e)||Hh.isBlob(e)?e:Hh.isArrayBufferView(e)?e.buffer:Hh.isURLSearchParams(e)?(Ep(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):Hh.isObject(e)?(Ep(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(t){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};Hh.forEach(["delete","get","head"],(function(e){Cp.headers[e]={}})),Hh.forEach(["post","put","patch"],(function(e){Cp.headers[e]=Hh.merge(wp)}));var Ap=Cp;function xp(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var Pp=function(e){return xp(e),e.headers=e.headers||{},e.data=qh(e.data,e.headers,e.transformRequest),e.headers=Hh.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Hh.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||Ap.adapter)(e).then((function(t){return xp(e),t.data=qh(t.data,t.headers,e.transformResponse),t}),(function(t){return Kh(t)||(xp(e),t&&t.response&&(t.response.data=qh(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))},Dp=function(e,t){t=t||{};var n={},r=["url","method","params","data"],i=["headers","auth","proxy"],a=["baseURL","url","transformRequest","transformResponse","paramsSerializer","timeout","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","maxContentLength","validateStatus","maxRedirects","httpAgent","httpsAgent","cancelToken","socketPath"];Hh.forEach(r,(function(e){void 0!==t[e]&&(n[e]=t[e])})),Hh.forEach(i,(function(r){Hh.isObject(t[r])?n[r]=Hh.deepMerge(e[r],t[r]):void 0!==t[r]?n[r]=t[r]:Hh.isObject(e[r])?n[r]=Hh.deepMerge(e[r]):void 0!==e[r]&&(n[r]=e[r])})),Hh.forEach(a,(function(r){void 0!==t[r]?n[r]=t[r]:void 0!==e[r]&&(n[r]=e[r])}));var o=r.concat(i).concat(a),s=Object.keys(t).filter((function(e){return-1===o.indexOf(e)}));return Hh.forEach(s,(function(r){void 0!==t[r]?n[r]=t[r]:void 0!==e[r]&&(n[r]=e[r])})),n};function Np(e){this.defaults=e,this.interceptors={request:new Wh,response:new Wh}}Np.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=Dp(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=[Pp,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach((function(e){t.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function(e){t.push(e.fulfilled,e.rejected)}));t.length;)n=n.then(t.shift(),t.shift());return n},Np.prototype.getUri=function(e){return e=Dp(this.defaults,e),Jh(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},Hh.forEach(["delete","get","head","options"],(function(e){Np.prototype[e]=function(t,n){return this.request(Hh.merge(n||{},{method:e,url:t}))}})),Hh.forEach(["post","put","patch"],(function(e){Np.prototype[e]=function(t,n,r){return this.request(Hh.merge(r||{},{method:e,url:t,data:n}))}}));var Lp=Np;function Op(e){this.message=e}Op.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},Op.prototype.__CANCEL__=!0;var Mp=Op;function Up(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;e((function(e){n.reason||(n.reason=new Mp(e),t(n.reason))}))}Up.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},Up.source=function(){var e;return{token:new Up((function(t){e=t})),cancel:e}};var Vp=Up;function Fp(e){var t=new Lp(e),n=Oh(Lp.prototype.request,t);return Hh.extend(n,Lp.prototype,t),Hh.extend(n,t),n}var jp=Fp(Ap);jp.Axios=Lp,jp.create=function(e){return Fp(Dp(jp.defaults,e))},jp.Cancel=Mp,jp.CancelToken=Vp,jp.isCancel=Kh,jp.all=function(e){return Promise.all(e)},jp.spread=function(e){return function(t){return e.apply(null,t)}};var Bp=jp,Hp=jp;Bp.default=Hp;var Gp=Bp,Jp=R((function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}function i(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function a(e,t,r,a,o){if("function"!=typeof r)throw new TypeError("The listener must be a function");var s=new i(r,a||e,o),c=n?n+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function o(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}function s(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),s.prototype.eventNames=function(){var e,r,i=[];if(0===this._eventsCount)return i;for(r in e=this._events)t.call(e,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},s.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,a=r.length,o=new Array(a);i<a;i++)o[i]=r[i].fn;return o},s.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},s.prototype.emit=function(e,t,r,i,a,o){var s=n?n+e:e;if(!this._events[s])return!1;var c,u,d=this._events[s],l=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),l){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,t),!0;case 3:return d.fn.call(d.context,t,r),!0;case 4:return d.fn.call(d.context,t,r,i),!0;case 5:return d.fn.call(d.context,t,r,i,a),!0;case 6:return d.fn.call(d.context,t,r,i,a,o),!0}for(u=1,c=new Array(l-1);u<l;u++)c[u-1]=arguments[u];d.fn.apply(d.context,c)}else{var h,p=d.length;for(u=0;u<p;u++)switch(d[u].once&&this.removeListener(e,d[u].fn,void 0,!0),l){case 1:d[u].fn.call(d[u].context);break;case 2:d[u].fn.call(d[u].context,t);break;case 3:d[u].fn.call(d[u].context,t,r);break;case 4:d[u].fn.call(d[u].context,t,r,i);break;default:if(!c)for(h=1,c=new Array(l-1);h<l;h++)c[h-1]=arguments[h];d[u].fn.apply(d[u].context,c)}}return!0},s.prototype.on=function(e,t,n){return a(this,e,t,n,!1)},s.prototype.once=function(e,t,n){return a(this,e,t,n,!0)},s.prototype.removeListener=function(e,t,r,i){var a=n?n+e:e;if(!this._events[a])return this;if(!t)return o(this,a),this;var s=this._events[a];if(s.fn)s.fn!==t||i&&!s.once||r&&s.context!==r||o(this,a);else{for(var c=0,u=[],d=s.length;c<d;c++)(s[c].fn!==t||i&&!s[c].once||r&&s[c].context!==r)&&u.push(s[c]);u.length?this._events[a]=1===u.length?u[0]:u:o(this,a)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&o(this,t)):(this._events=new r,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,e.exports=s})),zp=new Jp,Wp=1,qp=2,Kp=3,Qp=4,Xp=5,$p=20,Yp=21,Zp=22,ef=23,tf=24,nf=27,rf=28,af=29,of=30,sf=31,cf=32,uf=100,df=101,lf=102,hf=103,pf=110,ff=111,mf=112,_f=113,vf=114,gf=115,yf=116,Sf=120,kf=121,bf=122,If=123,Tf=130,Rf=131,wf=132,Ef=133,Cf=134,Af=135,xf=136,Pf=137,Df=200,Nf=201,Lf=300,Of=301,Mf=302,Uf=303;function Vf(e){var t=e.retryFunction,n=e.settings,r=e.onError,a=e.onRetrying,o=e.context;return function(){for(var e=this,s=arguments.length,c=new Array(s),u=0;u<s;u++)c[u]=arguments[u];var d=n.retries||5,l=0,h=-1,p=0,f=function(){var s=i(regeneratorRuntime.mark((function i(s,u){var m,_,v,g;return regeneratorRuntime.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.prev=0,m=o||e,i.next=4,t.apply(m,c);case 4:_=i.sent,l=0,s(_),i.next=14;break;case 9:i.prev=9,i.t0=i.catch(0),v=function(){clearTimeout(h),l=0,p=2,u(i.t0)},g=function(){2!==p&&l<d?(l++,p=1,yh(a)&&a(l,v),h=setTimeout((function(){h=-1,f(s,u)}),Sh(n.timeout)?1e3:n.timeout)):v()},yh(r)?r(i.t0,g,u):g();case 14:case"end":return i.stop()}}),i,null,[[0,9]])})));return function(e,t){return s.apply(this,arguments)}}();return new Promise(f)}}var Ff=function e(t){a(this,e),this.log=t.log,this.level=t.level,this.userId=t.userId,this.sdkAppId=t.sdkAppId,this.forAllJoinedClients=t.forAllJoinedClients,this.uploaded=!1},jf=function(){function e(t){a(this,e),this.id_=t.id,this.userId_=t.userId,this.sdkAppId_=t.sdkAppId,this.type_=t.type,this.isLocal_=!Ih(t.isLocal)||t.isLocal}return s(e,[{key:"setUserId",value:function(e){this.userId_=e}},{key:"setSdkAppId",value:function(e){this.sdkAppId_=e}},{key:"log",value:function(e,t){Bf.log({log:"[".concat(this.isLocal_?"":"*").concat(this.id_,"] ").concat(this.type_?this.type_+" ":"").concat(t),level:e,forAllJoinedClients:Sh(this.userId_),userId:this.userId_,sdkAppId:this.sdkAppId_})}},{key:"info",value:function(e){this.log(dh.INFO,e)}},{key:"debug",value:function(e){this.log(dh.DEBUG,e)}},{key:"warn",value:function(e){this.log(dh.WARN,e)}},{key:"error",value:function(e){this.log(dh.ERROR,e)}}]),e}(),Bf=new(function(){function e(){var t=this;a(this,e),this.clients_=[],this.queue_=[],this.timeoutId_=-1,this.logLevel_=dh.DEBUG,this.logLevelToUpload_=dh.INFO,this.enableUploadLog_=!0,this.isAbleToUpload_=!1,this.startUpload(),this.checkURLParam(),zp.on(of,(function(e){var n=e.client;return t.clients_.push(n)})),zp.on(sf,(function(e){e&&vh(e.config)&&lh[e.config.logLevelToUpload]&&(t.logLevelToUpload_=e.config.logLevelToUpload)})),zp.on(Qp,this.setIsAbleToUpload,this),zp.on(Xp,this.setIsAbleToUpload,this)}var t,n;return s(e,[{key:"getIsAbleToUpload",value:function(){return this.isAbleToUpload_}},{key:"setIsAbleToUpload",value:function(){this.isAbleToUpload_=!0,zp.off(Qp,this.setIsAbleToUpload,this),zp.off(Xp,this.setIsAbleToUpload,this)}},{key:"startUpload",value:(n=i(regeneratorRuntime.mark((function e(){var t=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.upload();case 3:e.next=7;break;case 5:e.prev=5,e.t0=e.catch(0);case 7:this.timeoutId_=setTimeout((function(){return t.startUpload()}),2e3);case 8:case"end":return e.stop()}}),e,this,[[0,5]])}))),function(){return n.apply(this,arguments)})},{key:"stopUpload",value:function(){-1!==this.timeoutId_&&(clearTimeout(this.timeoutId_),this.timeoutId_=-1)}},{key:"getLogsToUpload",value:function(){var e=this,t={map:new Map,splicedQueue:[]};if(this.queue_[0].forAllJoinedClients&&0===this.clients_.length)return t;for(var n=0,r=function(){if(50===n)return"break";var r=e.queue_[n];r.forAllJoinedClients?e.clients_.forEach((function(e){if(e.getIsJoined()){var n=e.getUserId(),i=e.getSDKAppId();if(t.map.has(n))t.map.get(n).logs.push(r);else t.map.set(n,{userId:n,sdkAppId:i,logs:[r]})}})):t.map.has(r.userId)?t.map.get(r.userId).logs.push(r):t.map.set(r.userId,{userId:r.userId,sdkAppId:r.sdkAppId,logs:[r]})};n<this.queue_.length;n++){if("break"===r())break}return t.map.size>0&&(t.splicedQueue=this.queue_.splice(0,n)),t}},{key:"upload",value:(t=i(regeneratorRuntime.mark((function e(){var t,n,r,i,a,o,s,c,u,d;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==this.queue_.length&&this.isAbleToUpload_){e.next=2;break}return e.abrupt("return");case 2:if(t=this.getLogsToUpload(),n=t.map,r=t.splicedQueue,0!==n.size){e.next=5;break}return e.abrupt("return");case 5:e.prev=5,i=y(n.values()),a=0;case 8:if(!(a<i.length)){e.next=16;break}return o=i[a],s=o.userId,c=o.sdkAppId,u=o.logs,e.next=12,this.uploadLogWithRetry(JSON.stringify({timestamp:yo(),sdkAppId:String(c),userId:s,version:"4.12.2",log:u.map((function(e){return e.log})).join("\n")}),c);case 12:u.forEach((function(e){return e.uploaded=!0}));case 13:a++,e.next=8;break;case 16:e.next=20;break;case 18:e.prev=18,e.t0=e.catch(5);case 20:(d=r.filter((function(e){return!e.uploaded}))).length>0&&(this.queue_=d.concat(this.queue_));case 22:case"end":return e.stop()}}),e,this,[[5,18]])}))),function(){return t.apply(this,arguments)})},{key:"uploadLogWithRetry",value:function(e,t){return Vf({retryFunction:function(){return Gp.post(mh(t,Ud),e,{timeout:5e3})},settings:{retries:3,timeout:1e3},onError:function(e,t){t()}})()}},{key:"getPrefix",value:function(e){var t=new Date;return t.setTime(go()),"[".concat(t.toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/,"$1"),":").concat(t.getMilliseconds(),"] <").concat(lh[e],">")}},{key:"getLogLevel",value:function(){return this.logLevel_}},{key:"setLogLevel",value:function(e){Sh(lh[e])||(this.logLevel_!==e&&this.info("setLogLevel ".concat(e)),this.logLevel_=e)}},{key:"enableUploadLog",value:function(){this.enableUploadLog_=!0}},{key:"disableUploadLog",value:function(){this.enableUploadLog_=!1}},{key:"log",value:function(e){var t=e.log,n=e.level,r=e.forAllJoinedClients,i=void 0===r||r,a=e.userId,o=e.sdkAppId;if(t="".concat(this.getPrefix(n)," ").concat(t),this.enableUploadLog_&&n>=this.logLevelToUpload_&&this.queue_.push(new Ff({log:t,level:n,userId:a,sdkAppId:o,forAllJoinedClients:i})),!(n<this.logLevel_))switch(n){case dh.ERROR:console.error(t);break;case dh.WARN:console.warn(t);break;case dh.INFO:console.log(t);break;case dh.DEBUG:console.debug(t)}}},{key:"debug",value:function(e){this.log({log:e,level:dh.DEBUG})}},{key:"info",value:function(e){this.log({log:e,level:dh.INFO})}},{key:"warn",value:function(e){this.log({log:e,level:dh.WARN})}},{key:"error",value:function(e){this.log({log:e,level:dh.ERROR})}},{key:"createLogger",value:function(e){return new jf(e)}},{key:"checkURLParam",value:function(){var e=new URLSearchParams(location.search).get("logLevelToUpload");lh[e]&&(this.logLevelToUpload_=e)}}]),e}()),Hf=!0,Gf=Math.floor,Jf=Number.isInteger||function(e){return!G(e)&&isFinite(e)&&Gf(e)===e};Rt({target:"Number",stat:!0},{isInteger:Jf});var zf,Wf=function(e){if(ko(e))throw TypeError("The method doesn't accept regular expressions");return e},qf=_e("match"),Kf=function(e){var t=/./;try{"/./"[e](t)}catch(n){try{return t[qf]=!1,"/./"[e](t)}catch(r){}}return!1},Qf=Re.f,Xf="".startsWith,$f=Math.min,Yf=Kf("startsWith"),Zf=!(Yf||(zf=Qf(String.prototype,"startsWith"),!zf||zf.writable));Rt({target:"String",proto:!0,forced:!Zf&&!Yf},{startsWith:function(e){var t=xi(j(this));Wf(e);var n=at($f(arguments.length>1?arguments[1]:void 0,t.length)),r=xi(e);return Xf?Xf.call(t,r,n):t.slice(n,n+r.length)===r}}),Rt({target:"Array",stat:!0},{isArray:Et});var em=Xo.trim,tm=A.parseInt,nm=A.Symbol,rm=nm&&nm.iterator,im=/^[+-]?0[Xx]/,am=8!==tm(zo+"08")||22!==tm(zo+"0x16")||rm&&!x((function(){tm(Object(rm))}))?function(e,t){var n=em(xi(e));return tm(n,t>>>0||(im.test(n)?16:10))}:tm;Rt({global:!0,forced:parseInt!=am},{parseInt:am});var om=[].slice,sm={},cm=function(e,t,n){if(!(t in sm)){for(var r=[],i=0;i<t;i++)r[i]="a["+i+"]";sm[t]=Function("C,a","return new C("+r.join(",")+")")}return sm[t](e,n)},um=Function.bind||function(e){var t=ne(this),n=om.call(arguments,1),r=function(){var i=n.concat(om.call(arguments));return this instanceof r?cm(t,i.length,i):t.apply(e,i)};return G(t.prototype)&&(r.prototype=t.prototype),r};Rt({target:"Function",proto:!0},{bind:um});var dm=Jt.findIndex,lm=!0;"findIndex"in[]&&Array(1).findIndex((function(){lm=!1})),Rt({target:"Array",proto:!0,forced:lm},{findIndex:function(e){return dm(this,e,arguments.length>1?arguments[1]:void 0)}}),wr("findIndex");var hm=L.f,pm=function(e){return function(t){for(var n,r=B(t),i=hr(r),a=i.length,o=0,s=[];a>o;)n=i[o++],P&&!hm.call(r,n)||s.push(e?[n,r[n]]:r[n]);return s}},fm={entries:pm(!0),values:pm(!1)}.values;Rt({target:"Object",stat:!0},{values:function(e){return fm(e)}});var mm=ct.includes;Rt({target:"Array",proto:!0},{includes:function(e){return mm(this,e,arguments.length>1?arguments[1]:void 0)}}),wr("includes"),Rt({target:"String",proto:!0,forced:!Kf("includes")},{includes:function(e){return!!~xi(j(this)).indexOf(xi(Wf(e)),arguments.length>1?arguments[1]:void 0)}});var _m=1,vm=2,gm=3,ym=4,Sm="DISCONNECTED",km="CONNECTING",bm="RECONNECTING",Im="CONNECTED",Tm={CLINET_BANNED:9,CHANNEL_SETUP_RESULT:19,CHANNEL_RECONNECT_RESULT:514,JOIN_ROOM_RESULT:20,PEER_JOIN:4134,PEER_LEAVE:4135,STREAM_ADDED:16,STREAM_REMOVED:18,UPLINK_NETWORK_STATS:22,UPDATE_REMOTE_MUTE_STAT:23,PUBLISH_RESULT:4098,UNPUBLISH_RESULT:4100,SUBSCRIBE_RESULT:4102,UNSUBSCRIBE_RESULT:4104,SUBSCRIBE_CHANGE_RESULT:4106,MUTE_RESULT:4108,UPDATE_OFFER_RESULT:4128,START_PUBLISH_TENCENT_CDN_RES:1286,STOP_PUBLISH_TENCENT_CDN_RES:1288,START_PUBLISH_GIVEN_CDN_RES:777,STOP_PUBLISH_GIVEN_CDN_RES:779,START_MIX_TRANSCODE_RES:781,STOP_MIX_TRANSCODE_RES:783,USER_LIST_RES:4137,SWITCH_ROLE_RES:4110},Rm=[Tm.UPDATE_REMOTE_MUTE_STAT,Tm.UPLINK_NETWORK_STATS,Tm.USER_LIST_RES,Tm.MUTE_RESULT],wm={CLINET_BANNED:"client-banned",CHANNEL_SETUP_RESULT:"channel-setup-result",CHANNEL_RECONNECT_RESULT:"channel-reconnect-result",JOIN_ROOM_RESULT:"join-room-result",PEER_JOIN:"peer-join",PEER_LEAVE:"peer-leave",STREAM_ADDED:"stream-added",STREAM_REMOVED:"stream-removed",UPLINK_NETWORK_STATS:"uplink-network-stats",UPDATE_REMOTE_MUTE_STAT:"update-remote-mute-stat",PUBLISH_RESULT:"publish-result",UNPUBLISH_RESULT:"unpublish-result",SUBSCRIBE_RESULT:"subscribe-result",SUBSCRIBE_CHANGE_RESULT:"subscribe-change-result",UNSUBSCRIBE_RESULT:"unsubscribe-result",UPDATE_OFFER_RESULT:"update-offer-result",START_PUBLISH_TENCENT_CDN_RES:"start-publish-tencent-cdn-res",STOP_PUBLISH_TENCENT_CDN_RES:"stop-publish-tencent-cdn-res",START_PUBLISH_GIVEN_CDN_RES:"start-publish-given-cdn-res",STOP_PUBLISH_GIVEN_CDN_RES:"stop-publish-given-cdn-res",START_MIX_TRANSCODE_RES:"start-mix-transcode-res",STOP_MIX_TRANSCODE_RES:"stop-mix-transcode-res",USER_LIST_RES:"user-list-res",SWITCH_ROLE_RES:"switch_role_res",MUTE_RESULT:"mute-result"},Em="publish_change",Cm="join",Am="leave",xm="quality_report",Pm="mute_uplink",Dm="publish",Nm="unpublish",Lm="subscribe",Om="unsubscribe",Mm="subscribe_change",Um="start_publishing",Vm="stop_publishing",Fm="start_push_user_cdn",jm="stop_push_user_cdn",Bm="start_mcu_mix",Hm="stop_mcu_mix",Gm="get_user_list",Jm="change_role",zm={INVALID_PARAMETER:4096,INVALID_OPERATION:4097,NOT_SUPPORTED:4098,DEVICE_NOT_FOUND:4099,INITIALIZE_FAILED:4100,SIGNAL_CHANNEL_SETUP_FAILED:16385,SIGNAL_CHANNEL_ERROR:16386,ICE_TRANSPORT_ERROR:16387,JOIN_ROOM_FAILED:16388,CREATE_OFFER_FAILED:16389,SIGNAL_CHANNEL_RECONNECTION_FAILED:16390,UPLINK_RECONNECTION_FAILED:16391,DOWNLINK_RECONNECTION_FAILED:16392,REMOTE_STREAM_NOT_EXIST:16400,CLIENT_BANNED:16448,SERVER_TIMEOUT:16449,SUBSCRIPTION_TIMEOUT:16450,PLAY_NOT_ALLOWED:16451,DEVICE_AUTO_RECOVER_FAILED:16452,START_PUBLISH_CDN_FAILED:16453,STOP_PUBLISH_CDN_FAILED:16454,START_MIX_TRANSCODE_FAILED:16455,STOP_MIX_TRANSCODE_FAILED:16456,NOT_SUPPORTED_H264:16457,SWITCH_ROLE_FAILED:16458,API_CALL_TIMEOUT:16459,SCHEDULE_FAILED:16460,UNKNOWN:65535},Wm=function(e){u(n,e);var t=_(n);function n(e){var r,i=e.name,o=void 0===i?"RtcError":i,s=e.message,c=e.code,u=void 0===c?zm.UNKNOWN:c,d=e.extraCode,l=void 0===d?0:d,h=e.constraint;return a(this,n),(r=t.call(this,s+"".concat(h?" constraint: ".concat(h):"")+" <".concat(function(e){for(var t in zm)if(zm[t]===e)return t;return"UNKNOWN"}(u)," 0x").concat(u.toString(16),">"))).code_=u,r.extraCode_=l,r.name=o,r.message_=s,h&&(r.constraint=h),r}return s(n,[{key:"getCode",value:function(){return this.code_}},{key:"getExtraCode",value:function(){return this.extraCode_}}]),n}(f(Error)),qm=32768,Km=32769,Qm=32770,Xm=32771,$m=32772,Ym=32773,Zm=32774,e_=32775,t_=32777,n_=32778,r_=32779,i_=32780,a_=32781,o_=32782,s_=32783,c_=32784,u_=32785,d_=32786,l_=32787,h_=32788,p_=32789,f_=32790,m_=32791,__=32792,v_=32793,g_=32794,y_=32795,S_=32796,k_=32797,b_=32798,I_=32799,T_=32800,R_=32801,w_=32802,E_=32803,C_=32804,A_=new Map,x_=function(e,t){var n=A_.get(e);n||(A_.set(e,[]),n=A_.get(e)),n.push(t)},P_=function(e){var t=A_.get(e),n=[];return t?(A_.delete(e),n=t.map((function(e){return{uint32_event_id:e.eventId,uint64_date:e.timestamp,str_userid:e.remoteUserId,str_event_json:e.eventDesc}}))):n=[],n},D_=Object.prototype.hasOwnProperty;function N_(e){if(null==e)return!0;if("boolean"==typeof e)return!1;if("number"==typeof e)return 0===e;if("string"==typeof e)return 0===e.length;if("function"==typeof e)return 0===e.length;if(Array.isArray(e))return 0===e.length;if(e instanceof Error)return""===e.message;if(vh(e))switch(Object.prototype.toString.call(e)){case"[object File]":case"[object Map]":case"[object Set]":return 0===e.size;case"[object Object]":for(var t in e)if(D_.call(e,t))return!1;return!0}return!1}var L_=/"/g,O_=function(e,t,n,r){var i=xi(j(e)),a="<"+t;return""!==n&&(a+=" "+n+'="'+xi(r).replace(L_,"&quot;")+'"'),a+">"+i+"</"+t+">"},M_=function(e){return x((function(){var t=""[e]('"');return t!==t.toLowerCase()||t.split('"').length>3}))};Rt({target:"String",proto:!0,forced:M_("link")},{link:function(e){return O_(this,"a","href",e)}});var U_="AVOID_REPEATED_CALL",V_="INVALID_PARAMETER_REQUIRED",F_="INVALID_PARAMETER_TYPE",j_="INVALID_PARAMETER_EMPTY",B_="INVALID_PARAMETER_INSTANCE",H_="INVALID_PARAMETER_RANGE",G_="API_CALL_TIMEOUT",J_="SIGNAL_CHANNEL_RECONNECTION_FAILED",z_="SIGNAL_CHANNEL_SETUP_FAILED",W_="ERROR_MESSAGE",q_="SUBSCRIPTION_TIMEOUT",K_="EXCHANGE_SDP_TIMEOUT",Q_="DOWNLINK_RECONNECTION_FAILED",X_="EXCHANGE_SDP_FAILED",$_="UPLINK_RECONNECTION_FAILED",Y_="AUDIO",Z_="VIDEO",ev="INVALID_RECORDID",tv="INVALID_PURE_AUDIO",nv="INVALID_STREAMID",rv="INVALID_USER_DEFINE_RECORDID",iv="INVALID_USER_DEFINE_PUSH_ARGS",av="INVALID_PROXY",ov="INVALID_JOIN",sv="INVALID_ROOMID_STRING",cv="INVALID_ROOMID_INTEGER",uv="INVALID_SIGNAL_CHANNEL",dv="JOIN_ROOM_TIMEOUT",lv="JOIN_ROOM_FAILED",hv="REJOIN_ROOM_FAILED",pv="INVALID_LEAVE",fv="INVALID_PUBLISH",mv="INVALID_UNPUBLISH",_v="INVALID_AUDIENCE",vv="INVALID_INITIALIZE",gv="INVALID_DUPLICATE_PUBLISHING",yv="INVALID_REMOTE_STREAM",Sv="SUBSCRIBE_FAILED",kv="INVALID_ROLE",bv="INVALID_OPERATION_SWITCH_ROLE",Iv="SWITCH_ROLE_TIMEOUT",Tv="SWITCH_ROLE_FAILED",Rv="CLIENT_BANNED",wv="INVALID_OPERATION_START_PUBLISH_CDN",Ev="INVALID_OPERATION_STOP_PUBLISH_CDN",Cv="INVALID_STREAM_ID",Av="START_PUBLISH_CDN_FAILED",xv="STOP_PUBLISH_CDN_FAILED",Pv="START_MIX_TRANSCODE",Dv="STOP_MIX_TRANSCODE",Nv="INVALID_AUDIO_VOLUME",Lv="ENABLE_SMALL_STREAM_PUBLISHED",Ov="DISABLE_SMALL_STREAM_PUBLISHED",Mv="NOT_SUPPORTED_SMALL_STREAM",Uv="INVALID_SMALL_STREAM_PROFILE",Vv="INVALID_PARAMETER_REMOTE_STREAM",Fv="INVALID_OPERATION_CHANGE_SMALL",jv="REMOTE_NOT_PUBLISH_SMALL_STREAM",Bv="INVALID_SWITCH_DEVICE",Hv="INVALID_SWITCH_DEVICE_PUBLISHING",Gv="INVALID_REPLACE_TRACK",Jv="INVALID_INITIALIZE_LOCAL_STREAM",zv="INVALID_ADD_TRACK_REPETITIVE",Wv="INVALID_ADD_TRACK_REMOVING",qv="INVALID_ADD_TRACK_PUBLISHING",Kv="INVALID_STREAM_INITIALIZED",Qv="INVALID_ADD_TRACK_NUMBER",Xv="INVALID_REMOVE_AUDIO_TRACK",$v="INVALID_REMOVE_AUDIO_ADDING",Yv="INVALID_REMOVE_AUDIO_ON",Zv="INVALID_REMOVE_TRACK_PUBLISHING",eg="INVALID_REMOVE_TRACK_NOT_PUBLISHING",tg="INVALID_REMOVE_TRACK_NUMBER",ng="INVALID_REMOVE_TRACK_NOT_PUBLISHED",rg="START_MIX_TRANSCODE_FAILED",ig="STOP_MIX_TRANSCODE_FAILED",ag="MIX_TRANSCODE_NOT_STARTED",og="CANNOT_LESS_THAN_ZERO",sg="MIX_PARAMS_VIDEO_FRAMERATE",cg="MIX_PARAMS_VIDEO_GOP",ug="MIX_PARAMS_AUDIO_BITRATE",dg="MIX_PARAMS_USER_Z_ORDER",lg="MIX_PARAMS_NOT_SELF",hg="MIX_PARAMS_USER_STREAM",pg="INVALID_ELEMENT_ID",fg="INVALID_ELEMENT_ID_TYPE",mg="INVALID_CREATE_STREAM_SOURCE",_g="INVALID_CREATE_STREAM_SCREEN",vg="INVALID_CREATE_STREAM_AUDIO",gg="INVALID_CREATE_STREAM_SCREEN_AUDIO",yg="NOT_SUPPORTED_HTTP",Sg="NOT_SUPPORTED_WEBRTC",kg="NOT_SUPPORTED_PROFILE",bg="NOT_SUPPORTED_H264ENCODE",Ig="NOT_SUPPORTED_H264DECODE",Tg="NOT_SUPPORTED_REPLACE_TRACK",Rg="NOT_SUPPORTED_CAPTURE",wg="MICROPHONE_NOT_FOUND",Eg="CAMERA_NOT_FOUND",Cg="SIGNAL_RESPONSE_FAILED",Ag={AVOID_REPEATED_CALL:function(e){return"previous ".concat(e.name,"() is ongoing, please avoid repeated calls.")},INVALID_PARAMETER_REQUIRED:function(e){var t=e.key,n=e.rule,r=e.fnName,i=e.value;return"'".concat(t||n.name,"' is a required param when calling ").concat(r,"(), received: ").concat(i,".")},INVALID_PARAMETER_TYPE:function(e){var t=e.key,n=e.rule,r=e.fnName,i=e.value,a="".concat(t||n.name),o="";return o=Array.isArray(n.type)?n.type.join("|"):n.type,"'".concat(a,"' must be type of ").concat(o," when calling ").concat(r,"(), received type: ").concat(wh(i),".")},INVALID_PARAMETER_EMPTY:function(e){var t=e.key,n=e.rule,r=e.fnName,i=e.value;return"'".concat(t||n.name,"' cannot be '").concat(i,"' when calling ").concat(r,"().")},INVALID_PARAMETER_INSTANCE:function(e){var t=e.key,n=e.rule,r=e.fnName,i=e.value,a="".concat(t||n.name),o="".concat(n.instanceOf.name||n.instanceOf);return"'".concat(a,"' must be instanceof ").concat(o," when calling ").concat(r,"(), received type: ").concat(wh(i),".")},INVALID_PARAMETER_RANGE:function(e){var t=e.key,n=e.rule,r=e.fnName,i=e.value;return"'".concat(t||n.name,"' must be one of ").concat(n.values.join("|")," when calling ").concat(r,"(), received: ").concat(i,".")},API_CALL_TIMEOUT:function(e){return"".concat(e.commandDesc||e.command," timeout observed.")},SIGNAL_CHANNEL_RECONNECTION_FAILED:"signal channel reconnection failed, please check your network.",SIGNAL_CHANNEL_SETUP_FAILED:function(e){return"SignalChannel setup failure: (errorCode: ".concat(e.errorCode,", errorMsg: ").concat(e.errorMsg," }).")},ERROR_MESSAGE:function(e){var t="".concat(e.type," failed");return e.message&&(t="".concat(t,": ").concat(e.message,".")),t},SUBSCRIPTION_TIMEOUT:"remote server does not respond to the subscription.",EXCHANGE_SDP_TIMEOUT:"exchange sdp timeout.",DOWNLINK_RECONNECTION_FAILED:"downlink reconnection failed, please check your network and re-join room.",EXCHANGE_SDP_FAILED:function(e){return"exchange sdp failed ".concat(e.errMsg,".")},UPDATE_OFFER_TIMEOUT:"update offer timeout observed.",UPLINK_RECONNECTION_FAILED:"uplink reconnection failed, please check your network and publish again.",AUDIO:function(e){return e.error.toString()+" <audio>"},VIDEO:function(e){return e.error.toString()+" <video>"},INVALID_RECORDID:"recordId must be an integer number.",INVALID_PURE_AUDIO:"pureAudioPushMode must be 1 or 2.",INVALID_STREAMID:"streamId must be a sting literal within 64 bytes, and not be empty.",INVALID_USER_DEFINE_RECORDID:"userDefineRecordId must be a sting literal contains (a-zA-Z),(0-9), underline and hyphen, within 64 bytes, and not be empty.",INVALID_USER_DEFINE_PUSH_ARGS:"userDefinePushArgs must be a sting literal within 256 bytes, and not be empty.",INVALID_PROXY:'proxy server url must start with "wss://".',INVALID_JOIN:"duplicate join() called.",INVALID_ROOMID_STRING:function(e){return"'".concat(e,"' must be validate string when useStringRoomId is true.")},INVALID_ROOMID_INTEGER:function(e){return"'".concat(e,"' must be an integer between [1, 4294967294] when useStringRoomId is false.")},INVALID_SIGNAL_CHANNEL:"SignalChannel is not ready yet.",JOIN_ROOM_TIMEOUT:"join room timeout.",JOIN_ROOM_FAILED:function(e){var t=e.error,n=e.code;return"Failed to join room - ".concat(t," code: ").concat(n)},REJOIN_ROOM_FAILED:function(e){return"reJoin room: ".concat(e.roomId," failed, please check your network.")},INVALID_LEAVE:"please call leave() before destroy().",INVALID_PUBLISH:"please call join() before publish().",INVALID_UNPUBLISH:"stream has not been published yet.",INVALID_AUDIENCE:"no permission to publish() under live/".concat("audience",', please call switchRole("').concat("anchor",'") firstly before publish().'),INVALID_INITIALIZE:"cannot publish stream because stream is not initialized or is switching device.",INVALID_DUPLICATE_PUBLISHING:"duplicate publishing, please unpublish and then re-publish.",INVALID_SUBSCRIBE_UNDEFINED:"stream is undefined or null.",INVALID_SUBSCRIBE_LOCAL:"stream cannot be LocalStream.",INVALID_REMOTE_STREAM:"remoteStream does not exist because it has been unpublished by remote peer.",SUBSCRIBE_FAILED:function(e){return"failed to subscribe stream, reason: ".concat(e.message,".")},INVALID_ROLE:"switchRole can only be called in live mode.",INVALID_PARAMETER_SWITCH_ROLE:"role could only be set to a value as ".concat("anchor"," or ").concat("audience","."),INVALID_OPERATION_SWITCH_ROLE:"please call join() before switchRole().",SWITCH_ROLE_TIMEOUT:"switchRole timeout.",SWITCH_ROLE_FAILED:function(e){return"switchRole failed, errCode: ".concat(e.errCode," errMsg: ").concat(e.errMsg,".")},CLIENT_BANNED:function(e){return"client was banned because of "+e.reason+"."},INVALID_OPERATION_START_PUBLISH_CDN:"please call publish() before startPublishCDNStream().",INVALID_OPERATION_STOP_PUBLISH_CDN:"please call startPublishCDNStream() before stopPublishCDNStream().",START_PUBLISH_CDN_FAILED:function(e){return"startPublishCDNStream failed, errMsg: ".concat(e.message,".")},STOP_PUBLISH_CDN_FAILED:function(e){return"stopPublishCDNStream failed, errMsg: ".concat(e.message,".")},INVALID_STREAM_ID:function(e){return"'".concat(e,"' can only consist of uppercase and lowercase english letters (a-zA-Z), numbers (0-9), hyphens and underscores.")},START_MIX_TRANSCODE:"please call startMixTranscode() after join().",STOP_MIX_TRANSCODE:"please call stopMixTranscode() after startMixTranscode().",INVALID_AUDIO_VOLUME:"interval must be a number.",ENABLE_SMALL_STREAM_PUBLISHED:"Cannot enable small stream after localStream published.",DISABLE_SMALL_STREAM_PUBLISHED:"Cannot disable small stream after localStream published.",NOT_SUPPORTED_SMALL_STREAM:"your browser does not support opening small stream.",INVALID_SMALL_STREAM_PROFILE:"small stream profile is invalid.",INVALID_PARAMETER_REMOTE_STREAM:"remoteStream is invalid.",INVALID_OPERATION_CHANGE_SMALL:"cannot switch to the small stream without subscribing to the video of remoteStream.",REMOTE_NOT_PUBLISH_SMALL_STREAM:"remote peer does not publish small stream.",INVALID_SWITCH_DEVICE:"cannot switch device on current stream.",INVALID_SWITCH_DEVICE_PUBLISHING:"cannot switch device when publishing localStream.",INVALID_REPLACE_TRACK:"cannot replace track when publishing localStream.",INVALID_INITIALIZE_LOCAL_STREAM:"local stream has not initialized yet.",INVALID_ADD_TRACK_REPETITIVE:"previous addTrack is ongoing, please avoid repetitive execution.",INVALID_ADD_TRACK_REMOVING:"cannot add track when a track is removing.",INVALID_ADD_TRACK_PUBLISHING:"cannot add track when publishing localStream.",INVALID_STREAM_INITIALIZED:"your local stream haven't been initialized yet.",INVALID_ADD_TRACK_NUMBER:"a Stream has at most one audio track and one video track.",INVALID_REMOVE_AUDIO_TRACK:"remove audio track is not supported.",INVALID_REMOVE_AUDIO_ADDING:"cannot remove track when a track is adding.",INVALID_REMOVE_AUDIO_ON:"previous removeTrack is ongoing, please avoid repetitive execution.",INVALID_REMOVE_TRACK_PUBLISHING:"cannot remove track when publishing localStream.",INVALID_REMOVE_TRACK_NOT_PUBLISHING:"the track to be removed is not being publishing.",INVALID_REMOVE_TRACK_NUMBER:"remove the only video track is not supported, please use replaceTrack or muteVideo.",INVALID_REMOVE_TRACK_NOT_PUBLISHED:function(e){return"try to replace ".concat(e.kind," track but there's no previous ").concat(e.kind," being published.")},START_MIX_TRANSCODE_FAILED:function(e){return"startMixTranscode failed, errMsg: ".concat(e.message,".")},STOP_MIX_TRANSCODE_FAILED:function(e){return"stopMixTranscode failed, errMsg: ".concat(e.message,".")},MIX_TRANSCODE_NOT_STARTED:"mixTranscode has not been started.",CANNOT_LESS_THAN_ZERO:function(e){var t=e.key,n=e.rule,r=e.fnName;e.value;return"'".concat(t||n.name,"' cannot be less than 0 when calling ").concat(r,"().")},MIX_PARAMS_VIDEO_FRAMERATE:"'config.videoFramerate' should be an integer between 0 and 30, excluding 0.",MIX_PARAMS_VIDEO_GOP:"'config.videoGOP' should be an integer between 1 and 8.",MIX_PARAMS_AUDIO_BITRATE:"'config.audioBitrate' should be an integer between 32 and 192.",MIX_PARAMS_USER_Z_ORDER:function(e){return"'".concat(e,"' is required and must be between 1 and 15.")},MIX_PARAMS_NOT_SELF:"'config.mixUsers' must contain self.",MIX_PARAMS_USER_STREAM:"'config.videoWidth' and 'config.videoHeight' of output stream should be contain all mix stream.",INVALID_PLAY:"duplicate play() call observed, please stop() firstly.",INVALID_ELEMENT_ID:function(e){var t=e.key,n=e.fnName;return"'".concat(t,"' is not found in the document object when calling ").concat(n,"().")},INVALID_ELEMENT_ID_TYPE:function(e){var t=e.key,n=e.fnName,r=e.type;return"the element corresponding to '".concat(t,"' must be instanceof HTMLDivElement when calling ").concat(n,"(), received: ").concat(r,".")},INVALID_USERID:"userId cannot be all spaces.",INVALID_CREATE_STREAM_SOURCE:"LocalStream must be created by createStream() with either audio/video or audioSource/videoSource, but can not be mixed with audio/video and audioSource/videoSource.",INVALID_CREATE_STREAM_SCREEN:"screen/video cannot be both true.",INVALID_CREATE_STREAM_AUDIO:"audio/screenAudio cannot be both true.",INVALID_CREATE_STREAM_SCREEN_AUDIO:"when screen is true, screenAudio can be configured.",NOT_SUPPORTED_HTTP:"not supported in http protocol, please use https protocol.",NOT_SUPPORTED_WEBRTC:"your browser does NOT support WebRTC!",NOT_SUPPORTED_PROFILE:"your browser does not support setVideoProfile.",NOT_SUPPORTED_MEDIA:"your browser does not support navigator.mediaDevices.",NOT_SUPPORTED_H264ENCODE:"your device does not support H.264 encoding.",NOT_SUPPORTED_H264DECODE:"your device does not support H.264 decoding.",NOT_SUPPORTED_REPLACE_TRACK:"replaceTrack is not supported in this browser, please use switchDevice or addTrack instead.",NOT_SUPPORTED_CAPTURE:"captureScreen is not supported, please use chrome.",MICROPHONE_NOT_FOUND:"no microphone detected, please check your microphone and the configuration on TRTC.createStream.",CAMERA_NOT_FOUND:"no camera detected, please check your camera and the configuration on TRTC.createStream.",SIGNAL_RESPONSE_FAILED:function(e){return"".concat(e.signalResponse," failed, response code is ").concat(e.code," , errMsg: ").concat(e.message,".")}},xg=uh+"module-ErrorCode.html",Pg=function(){if(!ad())return!1;var e=localStorage.getItem("trtc_error_assistance");e&&!function(e){var t=e.saveTime&&(new Date).getTime()-e.saveTime>=6048e5,n=!e.saveVersion||"4.12.2"!==e.saveVersion;return t||n}(JSON.parse(e))||(Bf.log("request error info"),function(){var e=new XMLHttpRequest;if(e.open("GET","https://web.sdk.qcloud.com/trtc/webrtc/download/error-message/0.0.1/script.js",!1),e.send(null),4===e.readyState&&200===e.status){var t=document.createElement("script");t.type="text/javascript",t.text=e.responseText,document.body.appendChild(t),localStorage.setItem("trtc_error_assistance",JSON.stringify({message:e.responseText,saveTime:(new Date).getTime(),saveVersion:"4.12.2"})),document.body.removeChild(t)}}())};function Dg(e){var t=e.key,n=e.data,r=e.link,i="",a="",o="";yh(Ag[t])?i=Ag[t](n):kh(Ag[t])&&(i=Ag[t]);var s=function(){if(window.TRTC_ERROR_INFO&&window.TRTC_ERROR_LINK)return{TRTC_ERROR_INFO:window.TRTC_ERROR_INFO,TRTC_ERROR_LINK:window.TRTC_ERROR_LINK};var e=localStorage.getItem("trtc_error_assistance");if(e){e=JSON.parse(e);var t=document.createElement("script");t.type="text/javascript",t.text=e.message,document.body.appendChild(t);var n=window.TRTC_ERROR_INFO,r=window.TRTC_ERROR_LINK;return document.body.removeChild(t),{TRTC_ERROR_INFO:n,TRTC_ERROR_LINK:r}}return{}}(),c=s.TRTC_ERROR_INFO,u=s.TRTC_ERROR_LINK;c&&c[t]&&(yh(c[t])?a=c[t](n):kh(c[t])&&(a=c[t])),r?o=uh+"".concat(r.className,".html#").concat(r.className===eh?".":"").concat(r.fnName):u&&u[t]&&(o=uh+u[t]);var d=i;return d+=" "+a,d+=a?o?"查看文档:"+o:"查看文档:"+xg:o?"Refer to:"+o:"Refer to:"+xg}var Ng=new(function(){function e(){a(this,e);var t=sd(),n=t.name,r=t.version;this.roomIdMap_=new Map,this.configs_={sdkAppId:"",userId:"",version:"4.12.2",env:Nd,browserVersion:n+r,ua:navigator.userAgent}}return s(e,[{key:"setConfig",value:function(e){var t=e.sdkAppId,n=e.env,r=e.userId,i=e.roomId;t!==this.configs_.sdkAppId&&(this.configs_.sdkAppId=String(t)),this.configs_.env=n,this.configs_.userId=r,this.roomIdMap_.set(r,String(i))}},{key:"logEvent",value:function(e){if(!id){var n=t(t(t({},e),this.configs_),{},{userId:e.userId||this.configs_.userId});Sh(n.code)&&(n.code="failed"===n.result?zm.UNKNOWN:0),this.sendRequest(mh(this.configs_.sdkAppId,Vd),n)}}},{key:"logSuccessEvent",value:function(e){id||(this.logEvent(t(t({},e),{},{result:"success",roomId:this.roomIdMap_.get(e.userId)})),this.configs_.env===Nd&&this.uploadEventToKibana(t(t({},e),{},{result:"success"})))}},{key:"logFailedEvent",value:function(e){if(!id){var n=e.eventType,r=e.code,i=e.error,a=e.userId,o={roomId:this.roomIdMap_.get(a),userId:a,eventType:n,result:"failed",code:r||(i instanceof Wm?i.getExtraCode()||i.getCode():zm.UNKNOWN)};this.logEvent(o),this.configs_.env===Nd&&this.uploadEventToKibana(t(t({},o),{},{error:i}))}}},{key:"uploadEventToKibana",value:function(e){var t="stat-".concat(e.eventType,"-").concat(e.result);"delta-join"!==e.eventType&&"delta-leave"!==e.eventType&&"delta-publish"!==e.eventType||(t="".concat(e.eventType,":").concat(e.delta)),this.uploadEvent({log:t,userId:e.userId}),"failed"===e.result&&(t="stat-".concat(e.eventType,"-").concat(e.result,"-").concat(e.code),this.uploadEvent({log:t,userId:e.userId,error:e.error}))}},{key:"uploadEvent",value:function(e){var t=e.log,n=e.userId,r=e.error,i={timestamp:yo(),sdkAppId:this.configs_.sdkAppId,userId:n||this.configs_.userId,version:this.configs_.version,log:t};r&&(i.errorInfo=r.message),this.sendRequest(mh(this.configs_.sdkAppId,Ud),i)}},{key:"sendRequest",value:function(e,t){var n=this;Bf.getIsAbleToUpload()?Gp.post(e,JSON.stringify(t)).catch((function(){})):setTimeout((function(){n.sendRequest(e,t)}),1e3)}}]),e}()),Lg=function(){function e(t){a(this,e),this.client_=t.client,this.sdkAppId_=t.sdkAppId,this.userId_=t.userId,this.userSig_=t.userSig,this.url_=t.url,this.backupUrl_=t.backupUrl,this.version_=t.version;var n="?sdkAppId=".concat(encodeURIComponent(this.sdkAppId_),"&userId=").concat(encodeURIComponent(this.userId_),"&userSig=").concat(encodeURIComponent(this.userSig_));this.urlWithParam_="".concat(this.url_).concat(n),this.backupUrlWithParam_="".concat(this.backupUrl_).concat(n),this.isConnected_=!1,this.isConnecting_=!1,this.socketInUse_=null,this.socket_=null,this.backupSocket_=null,this.backupTimer_=-1,this.signalInfo_={},this.currentState_=Sm,this.reconnectionCount_=0,this.reconnectionTimer_=-1,this.seq_=0,this.log_=Bf.createLogger({id:"ws|"+this.userId_,userId:this.userId_,sdkAppId:this.sdkAppId_}),this.emitter_=new Jp}return s(e,[{key:"connect",value:function(){var e=this;this.log_.info("connect to url: ".concat(this.urlWithParam_)),this.emitConnectionStateChanged(km),this.socket_=new WebSocket(this.urlWithParam_),this.bindSocket(this.socket_),this.backupTimer_=setTimeout((function(){e.isConnected_||(e.log_.info("trying to connect to backupUrl"),e.tryConnectBackup())}),5e3)}},{key:"tryConnectBackup",value:function(){this.backupSocket_||(this.unbindAndCloseSocket(wd),this.log_.debug("try to connect to url: ".concat(this.backupUrlWithParam_)),this.backupSocket_=new WebSocket(this.backupUrlWithParam_),this.bindSocket(this.backupSocket_))}},{key:"bindSocket",value:function(e){e.onopen=this.onopen.bind(this),e.onclose=this.onclose.bind(this),e.onerror=this.onerror.bind(this),e.onmessage=this.onmessage.bind(this)}},{key:"unbindSocket",value:function(e){e.onopen=function(){},e.onclose=function(){},e.onerror=function(){},e.onmessage=function(){}}},{key:"unbindAndCloseSocket",value:function(e){if(e===wd){if(this.socket_){this.unbindSocket(this.socket_);try{this.socket_.close(1e3)}catch(JI){}this.socket_=null}}else if(this.backupSocket_){this.unbindSocket(this.backupSocket_);try{this.backupSocket_.close(1e3)}catch(JI){}this.backupSocket_=null}}},{key:"clearBackupTimer",value:function(){-1!==this.backupTimer_&&(clearTimeout(this.backupTimer_),this.backupTimer_=-1)}},{key:"clearReconnectionTimer",value:function(){-1!==this.reconnectionTimer_&&(clearTimeout(this.reconnectionTimer_),this.reconnectionTimer_=-1)}},{key:"onopen",value:function(e){if(!this.isConnected_){this.isConnected_=!0,this.isConnecting_=!1,this.clearBackupTimer(),e.target===this.socket_?(this.unbindAndCloseSocket(Ed),this.socketInUse_=this.socket_):(this.unbindAndCloseSocket(wd),this.socketInUse_=this.backupSocket_);var t=e.target.url;this.log_.info("websocket[".concat(t,"] is connected")),this.currentState_===km?this.addSignalEvent(m_,"signal channel is connected"):this.currentState_===bm&&this.addSignalEvent(y_,"signal channel reconnect success"),this.emitConnectionStateChanged(Im),this.emitter_.emit(gm)}}},{key:"onclose",value:function(e){var t=e.target.url,n=e.target===this.socketInUse_;this.log_.info("websocket[".concat(t," InUse: ").concat(n,"] is closed with code: ").concat(e.code)),e.target===this.socketInUse_&&(this.isConnected_=!1,this.emitConnectionStateChanged(Sm),this.addSignalEvent(f_,"signal channel is disconnected"),e.wasClean&&1e3===e.code||(this.log_.warn("onclose code:".concat(e.code," reason:").concat(e.reason)),this.log_.warn("close current websocket and schedule a reconnect timeout"),this.socketInUse_.onclose=function(){},this.socketInUse_.close(4011),this.socket_=this.backupSocket_=this.socketInUse_=null,this.reconnect(wd)))}},{key:"onerror",value:function(e){var t=e.target.url;this.log_.error("websocket[".concat(t,"] error observed")),this.isConnected_?e.target===this.socketInUse_&&(this.isConnected_=!1,this.unbindAndCloseSocket(wd),this.unbindAndCloseSocket(Ed),this.socketInUse_=null,this.reconnect(wd)):(this.isReconnecting_||Ng.logFailedEvent({userId:this.client_.getUserId(),eventType:Rl,code:zm.UNKNOWN}),e.target==this.socket_?(this.unbindAndCloseSocket(wd),this.reconnect(Ed)):(this.unbindAndCloseSocket(Ed),this.reconnect(wd))),this.isConnecting_=!1,this.isConnected_=!1}},{key:"onmessage",value:function(e){if(this.isConnected_){var t=JSON.parse(e.data),n=t.cmd,r=t.data,i=Object.values(Tm),a=Object.keys(Tm)[i.indexOf(n)],o=wm[a];if(!Rm.includes(n)){var s=e.target==this.socket_?this.url_:this.backupUrl_;this.log_.debug("websocket[".concat(s,"] received message: ").concat(e.data)),this.log_.info("Received event: [ ".concat(o||"unknown cmd: "+n," ]"))}switch(n){case Tm.CHANNEL_SETUP_RESULT:if(0===t.code)this.signalInfo_.clientIp=r.clientIp,this.signalInfo_.signalIp=r.signalInnerIp,this.signalInfo_.tinyId=t.tinyId,r.svrTime&&function(e){vo=e-(new Date).getTime();var t=new Date;t.setTime(e),Bf.info("baseTime from server: "+t+" offset: "+vo)}(r.svrTime),this.log_.info("ChannelSetup Success"),Ng.logSuccessEvent({userId:this.userId_,eventType:Rl}),this.emitter_.emit(_m,{signalInfo:this.signalInfo_});else{var c=new Wm({code:zm.SIGNAL_CHANNEL_SETUP_FAILED,extraCode:t.code,message:Dg({key:z_,data:{errorCode:t.code,errorMsg:t.message}})});this.close(),Ng.logFailedEvent({userId:this.userId_,eventType:Rl,error:c}),this.emitter_.emit(ym,c)}break;case Tm.JOIN_ROOM_RESULT:0===t.code&&(this.signalInfo_.relayIp=r.relayOuterIp,this.signalInfo_.relayInnerIp=r.relayInnerIp,this.signalInfo_.relayPort=r.relayPort,this.log_.info("signalIp:".concat(this.signalInfo_.signalIp," clientIp:").concat(this.signalInfo_.clientIp," relayIp: ").concat(this.signalInfo_.relayIp))),this.emitter_.emit(o,{data:t});break;case Tm.CHANNEL_RECONNECT_RESULT:0===t.code?(this.log_.warn("reconnect success"),this.stopReconnection(),Ng.logSuccessEvent({userId:this.userId_,eventType:wl}),this.client_.syncUserList(),this.client_.checkConnectionsToReconnect()):(this.log_.warn("reconnect failed, ".concat(t.code," ").concat(t.message)),this.client_.reJoin());break;default:this.emitter_.emit(o,{data:t})}}}},{key:"addSignalEvent",value:function(e,t){x_(this.userId_,{eventId:e,eventDesc:t,timestamp:go(),userId:this.userId_,tinyId:this.signalInfo_.tinyId})}},{key:"reconnect",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:wd;if(this.isConnecting_||-1!==this.reconnectionTimer_)this.log_.info("signal channel is reconnecting, ignoring current reconnection");else{if(this.reconnectionCount_>=30){this.log_.warn("SDK has tried reconnect signal channel for ".concat(30," times, but all failed. please check your network"));var n=new Wm({code:zm.SIGNAL_CHANNEL_RECONNECTION_FAILED,message:Dg({key:J_})});return Ng.logFailedEvent({userId:this.client_.getUserId(),eventType:wl,error:n}),this.addSignalEvent(S_,"signal channel reconnect fail"),void this.emitter_.emit(ym,n)}this.isConnecting_=!0,this.reconnectionCount_++,this.currentState_!==bm&&(this.emitConnectionStateChanged(bm),this.addSignalEvent(g_,"signal channel is reconnecting")),this.log_.warn("reconnecting to ".concat(t," signal channel [").concat(this.reconnectionCount_,"/").concat(30,"]"));var r=this.getReconnectionUrl(t);t===wd?(this.socket_=new WebSocket(r),this.bindSocket(this.socket_)):(this.backupSocket_=new WebSocket(r),this.bindSocket(this.backupSocket_));var i=gh(this.reconnectionCount_);this.reconnectionTimer_=setTimeout((function(){e.log_.warn("reconnect ".concat(t," signal channel timeout(").concat(i/1e3,"s), close and try again")),e.isConnecting_=!1,e.clearReconnectionTimer(),e.unbindAndCloseSocket(t),e.reconnect(t===wd?Ed:wd)}),i)}}},{key:"isConnected",value:function(){return this.isConnected_}},{key:"isReconnecting_",get:function(){return-1!==this.reconnectionTimer_}},{key:"getReconnectionUrl",value:function(e){var t=e===wd?this.urlWithParam_:this.backupUrlWithParam_;if(!N_(this.signalInfo_)&&-1===t.indexOf("&rc=1")){var n=this.client_.getRoomId(),r=this.client_.getUseStringRoomId();t+="&rc=1&relayInnerIp=".concat(this.signalInfo_.relayInnerIp,"&relayOuterIp=").concat(this.signalInfo_.relayIp,"&relayPort=").concat(this.signalInfo_.relayPort,"&roomId=").concat(n,"&useStringRoomId=").concat(r)}return t}},{key:"send",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.isConnected_){var n={cmd:e,data:t,userId:this.userId_,tinyId:this.signalInfo_.tinyId,seq:++this.seq_};return this.socketInUse_.send(JSON.stringify(n)),n.seq}}},{key:"sendWaitForResponse",value:function(e){var t=this,n=e.command,r=e.data,i=e.timeout,a=void 0===i?5e3:i,o=e.responseCommand,s=e.commandDesc;return new Promise((function(e,i){var c=setTimeout((function(){t.off(o,u);var e=new Wm({code:zm.API_CALL_TIMEOUT,message:Dg({key:G_,data:{commandDesc:s,command:n}})});t.log_.warn(e),i(e)}),a),u=function n(r){r.data.seq===d&&(clearTimeout(c),t.off(o,n),e(r))};t.on(o,u);var d=t.send(n,r)}))}},{key:"sendWaitForResponseWithRetry",value:function(){var e=this,t=arguments.length<=0?void 0:arguments[0],n=t.commandDesc,r=t.retries,i=void 0===r?0:r,a=t.retryTimeout,o=void 0===a?0:a;return Vf({retryFunction:this.sendWaitForResponse,onRetrying:function(t){e.log_.warn("".concat(n," timeout observed, retrying [").concat(t,"/").concat(i,"]"))},settings:{retries:i,timeout:o},context:this}).apply(void 0,arguments)}},{key:"getCurrentState",value:function(){return this.currentState_}},{key:"getSignalInfo",value:function(){return this.signalInfo_}},{key:"stopReconnection",value:function(){this.isReconnecting_&&(this.reconnectionCount_=0,this.clearReconnectionTimer())}},{key:"close",value:function(){this.log_.info("close SignalChannel"),this.clearBackupTimer(),this.stopReconnection(),this.isConnecting_=!1,this.isConnected_=!1,this.socketInUse_=null,this.unbindAndCloseSocket(wd),this.unbindAndCloseSocket(Ed),this.emitConnectionStateChanged(Sm)}},{key:"on",value:function(e,t,n){this.emitter_.on(e,t,n)}},{key:"removeListener",value:function(e,t,n){this.emitter_.removeListener(e,t,n)}},{key:"once",value:function(e,t,n){this.emitter_.once(e,t,n)}},{key:"off",value:function(e,t,n){this.emitter_.off(e,t,n)}},{key:"emitConnectionStateChanged",value:function(e){e!==this.currentState_&&(this.emitter_.emit(vm,{prevState:this.currentState_,state:e}),this.currentState_=e)}}]),e}(),Og=Jt.find,Mg=!0;"find"in[]&&Array(1).find((function(){Mg=!1})),Rt({target:"Array",proto:!0,forced:Mg},{find:function(e){return Og(this,e,arguments.length>1?arguments[1]:void 0)}}),wr("find");Si("Set",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),Ci);var Ug=R((function(e){var t=e.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(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.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(e){return null!=e.address?"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(e){return null!=e.subtype?"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(e){return"extmap:%d"+(e.direction?"/%s":"%v")+(e["encrypt-uri"]?" %s":"%v")+" %s"+(e.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return null!=e.sessionConfig?"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(e){var t="candidate:%s %d %s %d %s %d typ %s";return t+=null!=e.raddr?" raddr %s rport %d":"%v%v",t+=null!=e.tcptype?" tcptype %s":"%v",null!=e.generation&&(t+=" generation %d"),t+=null!=e["network-id"]?" network-id %d":"%v",t+=null!=e["network-cost"]?" network-cost %d":"%v"}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(e){var t="ssrc:%d";return null!=e.attribute&&(t+=" %s",null!=e.value&&(t+=":%s")),t}},{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(e){return null!=e.maxMessageSize?"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(e){return e.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(e){return"imageattr:%s %s %s"+(e.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(e){return"simulcast:%s %s"+(e.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(e){return"ts-refclk:%s"+(null!=e.clksrcExt?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(e){var t="mediaclk:";return t+=null!=e.id?"id=%s %s":"%v%s",t+=null!=e.mediaClockValue?"=%s":"",t+=null!=e.rateNumerator?" rate=%s":"",t+=null!=e.rateDenominator?"/%s":""}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]};Object.keys(t).forEach((function(e){t[e].forEach((function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")}))}))})),Vg=(Ug.v,Ug.o,Ug.s,Ug.i,Ug.u,Ug.e,Ug.p,Ug.z,Ug.r,Ug.t,Ug.c,Ug.b,Ug.m,Ug.a,R((function(e,t){var n=function(e){return String(Number(e))===e?Number(e):e},r=function(e,t,r){var i=e.name&&e.names;e.push&&!t[e.push]?t[e.push]=[]:i&&!t[e.name]&&(t[e.name]={});var a=e.push?{}:i?t[e.name]:t;!function(e,t,r,i){if(i&&!r)t[i]=n(e[1]);else for(var a=0;a<r.length;a+=1)null!=e[a+1]&&(t[r[a]]=n(e[a+1]))}(r.match(e.reg),a,e.names,e.name),e.push&&t[e.push].push(a)},i=RegExp.prototype.test.bind(/^([a-z])=(.*)/);t.parse=function(e){var t={},n=[],a=t;return e.split(/(\r\n|\r|\n)/).filter(i).forEach((function(e){var t=e[0],i=e.slice(2);"m"===t&&(n.push({rtp:[],fmtp:[]}),a=n[n.length-1]);for(var o=0;o<(Ug[t]||[]).length;o+=1){var s=Ug[t][o];if(s.reg.test(i))return r(s,a,i)}})),t.media=n,t};var a=function(e,t){var r=t.split(/=(.+)/,2);return 2===r.length?e[r[0]]=n(r[1]):1===r.length&&t.length>1&&(e[r[0]]=void 0),e};t.parseParams=function(e){return e.split(/;\s?/).reduce(a,{})},t.parseFmtpConfig=t.parseParams,t.parsePayloads=function(e){return e.toString().split(" ").map(Number)},t.parseRemoteCandidates=function(e){for(var t=[],r=e.split(" ").map(n),i=0;i<r.length;i+=3)t.push({component:r[i],ip:r[i+1],port:r[i+2]});return t},t.parseImageAttributes=function(e){return e.split(" ").map((function(e){return e.substring(1,e.length-1).split(",").reduce(a,{})}))},t.parseSimulcastStreamList=function(e){return e.split(";").map((function(e){return e.split(",").map((function(e){var t,r=!1;return"~"!==e[0]?t=n(e):(t=n(e.substring(1,e.length)),r=!0),{scid:t,paused:r}}))}))}}))),Fg=(Vg.parse,Vg.parseParams,Vg.parseFmtpConfig,Vg.parsePayloads,Vg.parseRemoteCandidates,Vg.parseImageAttributes,Vg.parseSimulcastStreamList,/%[sdv%]/g),jg=function(e){var t=1,n=arguments,r=n.length;return e.replace(Fg,(function(e){if(t>=r)return e;var i=n[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(i);case"%d":return Number(i);case"%v":return""}}))},Bg=function(e,t,n){var r=[e+"="+(t.format instanceof Function?t.format(t.push?n:n[t.name]):t.format)];if(t.names)for(var i=0;i<t.names.length;i+=1){var a=t.names[i];t.name?r.push(n[t.name][a]):r.push(n[t.names[i]])}else r.push(n[t.name]);return jg.apply(null,r)},Hg=["v","o","s","i","u","e","p","c","b","t","r","z","a"],Gg=["i","c","b","a"],Jg={write:function(e,t){t=t||{},null==e.version&&(e.version=0),null==e.name&&(e.name=" "),e.media.forEach((function(e){null==e.payloads&&(e.payloads="")}));var n=t.outerOrder||Hg,r=t.innerOrder||Gg,i=[];return n.forEach((function(t){Ug[t].forEach((function(n){n.name in e&&null!=e[n.name]?i.push(Bg(t,n,e)):n.push in e&&null!=e[n.push]&&e[n.push].forEach((function(e){i.push(Bg(t,n,e))}))}))})),e.media.forEach((function(e){i.push(Bg("m",Ug.m[0],e)),r.forEach((function(t){Ug[t].forEach((function(n){n.name in e&&null!=e[n.name]?i.push(Bg(t,n,e)):n.push in e&&null!=e[n.push]&&e[n.push].forEach((function(e){i.push(Bg(t,n,e))}))}))}))})),i.join("\r\n")+"\r\n"},parse:Vg.parse,parseParams:Vg.parseParams,parseFmtpConfig:Vg.parseFmtpConfig,parsePayloads:Vg.parsePayloads,parseRemoteCandidates:Vg.parseRemoteCandidates,parseImageAttributes:Vg.parseImageAttributes,parseSimulcastStreamList:Vg.parseSimulcastStreamList},zg=function(e){return Jg.parse(e)},Wg=function(e){return Jg.write(e)},qg=function(e){var t=zg(e);return t.media.forEach((function(e){e.type===dd&&e.fmtp.forEach((function(e){e.config+=";sprop-stereo=1;stereo=1"}))})),Wg(t)};function Kg(e){var t=zg(e);return t.media.forEach((function(e){if(e.type===ld){var t=new Set;e.rtp.forEach((function(e){var n=e.payload;return"H264"===e.codec&&t.add(n)})),e.fmtp.forEach((function(e){var n=e.payload,r=e.config.match(/apt=(\d+)/);r&&r[1]&&t.has(Number(r[1]))&&t.add(n)}));var n=function(e){var n=e.payload;return!t.has(n)};e.rtp=e.rtp.filter(n),e.rtcpFb=e.rtcpFb.filter(n),e.fmtp=e.fmtp.filter(n),e.payloads=e.payloads.split(" ").filter((function(e){return!t.has(Number(e))})).join(" ")}})),Wg(t)}var Qg,Xg=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}))},$g=new(function(){function e(){a(this,e),this.intervalMap_=new Map}return s(e,[{key:"setInterval",value:function(e){function t(t,n){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(e,t){var n=this,r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!window||!window.requestAnimationFrame)return setInterval(e,t);var i=Xg(),a=Ch(),o=a;this.intervalMap_.set(i,{rafId:null,timeoutId:null,onVisibilityChange:null});var s=function s(){if(r&&document.hidden){if(e(),!n.intervalMap_.has(i))return;var c=setTimeout(s,t);n.setTimeoutId(i,c),a=Ch(),o=a}else{if((o=Ch())-a>=t&&(a=o,e(),!n.intervalMap_.has(i)))return;var u=requestAnimationFrame(s);n.setRafId(i,u)}},c=requestAnimationFrame(s);if(this.setRafId(i,c),r){var u=function(){if(document.hidden){var e=Ch()-a;if(e>=t)s();else{var r=setTimeout(s,t-e);n.setTimeoutId(i,r)}}};document.addEventListener("visibilitychange",u),this.setOnVisibilityChange(i,u),document.hidden&&u()}return i}))},{key:"clearInterval",value:function(e){if(this.intervalMap_.has(e)){var t=this.intervalMap_.get(e),n=t.rafId,r=t.timeoutId,i=t.onVisibilityChange;cancelAnimationFrame(n),clearTimeout(r),document.removeEventListener("visibilitychange",i),this.intervalMap_.delete(e)}}},{key:"setTimeoutId",value:function(e,t){if(this.intervalMap_.has(e)){var n=this.intervalMap_.get(e);n.timeoutId&&clearTimeout(n.timeoutId),n.timeoutId=t}}},{key:"setRafId",value:function(e,t){if(this.intervalMap_.has(e)){var n=this.intervalMap_.get(e);n.rafId&&cancelAnimationFrame(n.rafId),n.rafId=t}}},{key:"setOnVisibilityChange",value:function(e,t){this.intervalMap_.has(e)&&(this.intervalMap_.get(e).onVisibilityChange=t)}}]),e}()),Yg=new(function(){function e(){a(this,e),this.prefix_="TRTC",this.queue_=new Map,this.intervalId_=$g.setInterval(this.doFlush.bind(this),2e4),this.checkStorage()}return s(e,[{key:"getRealKey",value:function(e){return"".concat(this.prefix_,"_").concat(e)}},{key:"checkStorage",value:function(){var e=this;ad()&&Object.keys(localStorage).filter((function(t){if(t.startsWith(e.prefix_)){var n=JSON.parse(localStorage.getItem(t));if(n&&n.expiresIn<Date.now())return!0}return!1})).forEach((function(e){return localStorage.removeItem(e)}))}},{key:"doFlush",value:function(){if(ad())try{var e,t=b(this.queue_);try{for(t.s();!(e=t.n()).done;){var n=g(e.value,2),r=n[0],i=n[1];localStorage.setItem(r,JSON.stringify(i))}}catch(a){t.e(a)}finally{t.f()}}catch(JI){Bf.warn(JI)}}},{key:"getItem",value:function(e){if(!ad())return null;try{var t=JSON.parse(localStorage.getItem(this.getRealKey(e)));return t&&t.expiresIn>=Date.now()?t.value:null}catch(JI){Bf.warn(JI)}}},{key:"setItem",value:function(e,t){if(ad())try{var n={expiresIn:Date.now()+6048e5,value:t};this.queue_.set(this.getRealKey(e),n)}catch(JI){Bf.warn(JI)}}},{key:"deleteItem",value:function(e){if(!ad())return!1;try{return e=this.getRealKey(e),this.queue_.delete(e),localStorage.removeItem(e),!0}catch(JI){return Bf.warn(JI),!1}}},{key:"clear",value:function(){if(ad())try{localStorage.clear()}catch(JI){Bf.warn(JI)}}}]),e}()),Zg={result:!1,detail:{isBrowserSupported:!1,isWebRTCSupported:!1,isMediaDevicesSupported:!1,isH264EncodeSupported:!1,isVp8EncodeSupported:!1,isH264DecodeSupported:!1,isVp8DecodeSupported:!1}};(Qg=Yg.getItem("checkResult"))&&Qg.ua===navigator.userAgent&&(Zg=Qg.checkResult,cy());var ey=function(){return!Mu&&!du&&(!(hu&&pu<80)&&!(cu&&uu<56))},ty=function(){return["RTCPeerConnection","webkitRTCPeerConnection","RTCIceGatherer"].filter((function(e){return e in window})).length>0},ny=function(){if(!navigator.mediaDevices)return!1;var e=["getUserMedia","enumerateDevices"];return e.filter((function(e){return e in navigator.mediaDevices})).length===e.length},ry=function(){var e=i(regeneratorRuntime.mark((function e(){var t,n,r,i,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Zg.detail.isH264EncodeSupported&&!Zg.detail.isVp8EncodeSupported){e.next=2;break}return e.abrupt("return",{isH264EncodeSupported:Zg.detail.isH264EncodeSupported,isVp8EncodeSupported:Zg.detail.isVp8EncodeSupported});case 2:return t="",n=!1,r=!1,e.prev=5,i=new RTCPeerConnection,(a=document.createElement("canvas")).getContext("2d"),o=a.captureStream(0),i.addTrack(o.getVideoTracks()[0],o),e.next=13,i.createOffer();case 13:return-1!==(t=e.sent).sdp.toLowerCase().indexOf("h264")&&(n=!0),-1!==t.sdp.toLowerCase().indexOf("vp8")&&(r=!0),i.close(),Zg.detail.isH264EncodeSupported=n,Zg.detail.isVp8EncodeSupported=r,e.abrupt("return",{isH264EncodeSupported:Zg.detail.isH264EncodeSupported,isVp8EncodeSupported:Zg.detail.isVp8EncodeSupported});case 22:return e.prev=22,e.t0=e.catch(5),e.abrupt("return",{isH264EncodeSupported:!1,isVp8EncodeSupported:!1});case 25:case"end":return e.stop()}}),e,null,[[5,22]])})));return function(){return e.apply(this,arguments)}}();function iy(){return ay.apply(this,arguments)}function ay(){return(ay=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(){var e=i(regeneratorRuntime.mark((function e(t){var n,r,a,o,s,c,u,d,l,h,p,f,m,_;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n={encode:!1,decode:!1},r=null,e.prev=2,a=document.createElement("canvas"),o=a.getContext("2d"),a.width=640,a.height=480,s=setInterval((function(){o.fillText("test",Math.floor(640*Math.random()),Math.floor(480*Math.random()))}),33),c=-1,u=-1,r=function(){clearInterval(c),clearInterval(s),clearTimeout(u),l.close(),h.close(),d.getTracks().forEach((function(e){return e.stop()}))},u=setTimeout((function(){r(),t(n)}),3e3),d=a.captureStream(),l=new RTCPeerConnection({}),h=new RTCPeerConnection({offerToReceiveAudio:!0,offerToReceiveVideo:!0}),l.addEventListener("icecandidate",(function(e){return h.addIceCandidate(e.candidate)})),h.addEventListener("icecandidate",(function(e){return l.addIceCandidate(e.candidate)})),l.addTrack(d.getVideoTracks()[0],d),e.next=20,l.createOffer();case 20:return p=e.sent,e.next=23,l.setLocalDescription(p);case 23:return e.next=25,h.setRemoteDescription(p);case 25:return e.next=27,h.createAnswer();case 27:return f=e.sent,m=zg(f.sdp),_=m.media[0].rtp.findIndex((function(e){return"H264"===e.codec})),m.media[0].rtp=[m.media[0].rtp[_]],m.media[0].fmtp=m.media[0].fmtp.filter((function(e){return e.payload===m.media[0].rtp[0].payload})),m.media[0].rtcpFb=m.media[0].rtcpFb.filter((function(e){return e.payload===m.media[0].rtp[0].payload})),f.sdp=Wg(m),e.next=36,h.setLocalDescription(f);case 36:return e.next=38,l.setRemoteDescription(f);case 38:c=setInterval(i(regeneratorRuntime.mark((function e(){var i,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.encode&&n.decode&&(r(),t(n)),e.next=3,l.getStats();case 3:return i=e.sent,e.next=6,h.getStats();case 6:a=e.sent,n.encode||i.forEach((function(e){"outbound-rtp"===e.type&&e.mediaType===ld&&e.framesEncoded>0&&(n.encode=!0)})),n.decode||a.forEach((function(e){"inbound-rtp"===e.type&&e.mediaType===ld&&e.framesDecoded>0&&(n.decode=!0)}));case 9:case"end":return e.stop()}}),e)}))),500),e.next=46;break;case 41:e.prev=41,e.t0=e.catch(2),r(),Bf.warn(e.t0),t(n);case 46:case"end":return e.stop()}}),e,null,[[2,41]])})));return function(t){return e.apply(this,arguments)}}()));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var oy=function(){var e=i(regeneratorRuntime.mark((function e(){var t,n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Zg.detail.isH264DecodeSupported&&!Zg.detail.isVp8DecodeSupported){e.next=2;break}return e.abrupt("return",{isH264DecodeSupported:Zg.detail.isH264DecodeSupported,isVp8DecodeSupported:Zg.detail.isVp8DecodeSupported});case 2:return t="",n=!1,r=!1,e.prev=5,i=new RTCPeerConnection,e.next=9,i.createOffer({offerToReceiveAudio:1,offerToReceiveVideo:1});case 9:return-1!==(t=e.sent).sdp.toLowerCase().indexOf("h264")&&(n=!0),-1!==t.sdp.toLowerCase().indexOf("vp8")&&(r=!0),i.close(),e.abrupt("return",{isH264DecodeSupported:n,isVp8DecodeSupported:r});case 16:return e.prev=16,e.t0=e.catch(5),e.abrupt("return",{isH264DecodeSupported:!1,isVp8DecodeSupported:!1});case 19:case"end":return e.stop()}}),e,null,[[5,16]])})));return function(){return e.apply(this,arguments)}}(),sy=function(e,t){var n=null;return function(){if(n)return n;for(var r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];return(n=e.apply(t||this,i)).then((function(e){return n=null,e})).catch((function(e){throw n=null,e})),n}}(function(){var e=i(regeneratorRuntime.mark((function e(){var t,n,r,i,a,o,s,c,u,d,l,h;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Zg.result){e.next=2;break}return e.abrupt("return",Zg);case 2:return t=ey(),n=ty(),r=ny(),e.next=7,ry();case 7:return i=e.sent,a=i.isH264EncodeSupported,o=i.isVp8EncodeSupported,e.next=12,oy();case 12:if(s=e.sent,c=s.isH264DecodeSupported,u=s.isVp8DecodeSupported,!(a&&c&&(Ju||Wu||td)&&!gu&&Ku()<79)){e.next=23;break}return e.next=18,iy();case 18:d=e.sent,l=d.encode,h=d.decode,a=l,c=h;case 23:return Zg.result=t&&n&&r&&(a||o)&&(c||u),Zg.detail.isBrowserSupported=t,Zg.detail.isWebRTCSupported=n,Zg.detail.isMediaDevicesSupported=r,Zg.detail.isH264EncodeSupported=a,Zg.detail.isVp8EncodeSupported=o,Zg.detail.isH264DecodeSupported=c,Zg.detail.isVp8DecodeSupported=u,cy(),Yg.setItem("checkResult",{ua:navigator.userAgent,checkResult:Zg}),e.abrupt("return",Zg);case 34:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}());function cy(){Object.keys(Zg.detail).findIndex((function(e){return!Zg.detail[e]}))>=0&&Bf.error("".concat(navigator.userAgent," ").concat(JSON.stringify(Zg.detail)))}var uy=function(){return!(!navigator.mediaDevices||!navigator.mediaDevices.getDisplayMedia)},dy=function(){return"RTCPeerConnection"in window&&"getReceivers"in window.RTCPeerConnection.prototype},ly=function(){return"RTCPeerConnection"in window&&"getSenders"in window.RTCPeerConnection.prototype},hy=function(){return"RTCPeerConnection"in window&&"getTransceivers"in window.RTCPeerConnection.prototype},py=function(){return"RTCRtpTransceiver"in window&&"stop"in window.RTCRtpTransceiver.prototype},fy=function(){return"RTCRtpSender"in window&&"setParameters"in window.RTCRtpSender.prototype&&ly()},my=function(){return!!Sh(navigator.mediaDevices)&&(Bf.error(Ag.NOT_SUPPORTED_MEDIA),!0)},_y=function(){return false},vy=function(e){return!("candidate-pair"!==e.type||!e.nominated||"in-progress"!==e.state&&"succeeded"!==e.state)&&!(Ih(e.selected)&&!e.selected)},gy=new Map([[ou,"Android"],[au,"iOS"],[Nu,"Windows"],[Lu,"MacOS"],[Ou,"Linux"]]),yy=function(){var e="unknown";return gy.get(!0)&&(e=gy.get(!0)),e};function Sy(){var e="";screen.width&&(e+=(screen.width?screen.width*window.devicePixelRatio:"")+" * "+(screen.height?screen.height*window.devicePixelRatio:""));return e}function ky(){var e=!1;return(navigator.getUserMedia||navigator.mediaDevices&&navigator.mediaDevices.getUserMedia)&&(e=!0),e}function by(){for(var e={isSupported:!1},t=["AudioContext","webkitAudioContext","mozAudioContext","msAudioContext"],n=0;n<t.length;n++)if(t[n]in window){e.isSupported=!0;break}return e.isSupported}function Iy(){return!bu&&!au&&!(!ey()||!("captureStream"in HTMLCanvasElement.prototype))}var Ty="getSettings"in MediaStreamTrack.prototype,Ry="getCapabilities"in MediaStreamTrack.prototype;sy();var wy="stream-added",Ey="stream-removed",Cy="stream-updated",Ay="stream-subscribed",xy="error",Py="connection-state-changed",Dy="stream-added",Ny="stream-removed",Ly="stream-updated",Oy="stream-subscribed",My="connection-state-changed",Uy="peer-join",Vy="peer-leave",Fy="mute-audio",jy="mute-video",By="unmute-audio",Hy="unmute-video",Gy="client-banned",Jy="network-quality",zy="audio-volume",Wy="error",qy="player-state-changed",Ky="screen-sharing-stopped",Qy="connection-state-changed",Xy="error",$y="player-state-changed",Yy=function(){function e(t){a(this,e);var n=t.getUserId();this.log_=Bf.createLogger({id:n,userId:n,sdkAppId:t.getSDKAppId()}),this.prevReport_={},this.prevEncoderImplementation_="",this.prevQualityLimitationReason_="",this.prevDecoderImplementationMap_=new Map}var t,n,r,o;return s(e,[{key:"getSenderStats",value:(o=i(regeneratorRuntime.mark((function e(t){var n,r,i,a=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n={audio:{bytesSent:0,packetsSent:0,audioLevel:0,totalAudioEnergy:0},video:{bytesSent:0,packetsSent:0,framesEncoded:0,frameWidth:0,frameHeight:0,framesSent:0,fpsCapture:0,smallFramesEncoded:0,smallFPSCapture:0,smallFramesSent:0},rtt:0},r=t.getPeerConnection(),i=t.getSSRC(),!r){e.next=14;break}return e.prev=4,e.next=7,r.getStats();case 7:e.sent.forEach((function(e){if("outbound-rtp"===e.type)if(e.mediaType===ld){if(!cu&&Sh(e.trackId))return;e.ssrc!==i.video||Sh(e.encoderImplementation)||a.prevEncoderImplementation_===e.encoderImplementation||(a.log_.info("encoderImplementation change to ".concat(e.encoderImplementation)),a.prevEncoderImplementation_=e.encoderImplementation),e.ssrc!==i.video||Sh(e.qualityLimitationReason)||a.prevQualityLimitationReason_===e.qualityLimitationReason||(a.log_.info("qualityLimitationReason change to ".concat(e.qualityLimitationReason)),a.prevQualityLimitationReason_=e.qualityLimitationReason);var r=t.getSSRC();e.ssrc===r.video?(n.video.bytesSent=e.bytesSent,n.video.packetsSent=e.packetsSent,n.video.framesEncoded=e.framesEncoded):(n.video.smallBytesSent=e.bytesSent,n.video.smallFramesEncoded=e.framesEncoded)}else e.mediaType===dd&&(n.audio.bytesSent=e.bytesSent,n.audio.packetsSent=e.packetsSent);else"candidate-pair"===e.type?vy(e)&&bh(e.currentRoundTripTime)&&(n.rtt=Math.floor(1e3*e.currentRoundTripTime)):"track"===e.type?(Sh(e.frameWidth)||(e.trackIdentifier===t.getLocalStreamVideoTrackId()?(n.video.frameWidth=e.frameWidth,n.video.frameHeight=e.frameHeight,n.video.framesSent=e.framesSent):(n.video.smallFrameWidth=e.frameWidth,n.video.smallFrameHeight=e.frameHeight,n.video.smallFramesSent=e.framesSent)),Sh(e.audioLevel)||(n.audio.audioLevel=e.audioLevel||0)):"media-source"===e.type&&(e.kind===dd?(n.audio.audioLevel=e.audioLevel||0,n.audio.totalAudioEnergy=e.totalAudioEnergy||0):e.kind===ld&&(e.trackIdentifier===t.getLocalStreamVideoTrackId()?n.video.fpsCapture=e.framesPerSecond:n.video.smallFPSCapture=e.framesPerSecond))})),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(4),this.log_.warn("failed to getStats on sender connection");case 14:return e.abrupt("return",n);case 15:case"end":return e.stop()}}),e,this,[[4,11]])}))),function(e){return o.apply(this,arguments)})},{key:"getReceiverStats",value:(r=i(regeneratorRuntime.mark((function e(t){var n,r,i=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n={tinyId:t.getTinyId(),userId:t.getUserId(),rtt:0,hasAudio:!1,hasVideo:!1,hasAuxiliary:!1,audio:{bytesReceived:0,packetsReceived:0,packetsLost:0,jitter:0,audioLevel:0,totalAudioEnergy:0},video:{bytesReceived:0,packetsReceived:0,packetsLost:0,framesReceived:0,framesDecoded:0,frameWidth:0,frameHeight:0},auxiliary:{bytesReceived:0,packetsReceived:0,packetsLost:0,framesReceived:0,framesDecoded:0,frameWidth:0,frameHeight:0}},!(r=t.getPeerConnection())){e.next=13;break}return e.prev=3,e.next=6,r.getStats();case 6:e.sent.forEach((function(e){if("inbound-rtp"===e.type){if(e.mediaType===dd)n.audio.packetsReceived=e.packetsReceived,n.audio.bytesReceived=e.bytesReceived,n.audio.packetsLost=e.packetsLost,n.audio.jitter=e.jitter,n.hasAudio=!0;else if(e.mediaType===ld){if(cu&&0===e.bytesReceived)return;var r=t.getSSRC();e.ssrc===r.video&&(n.video.packetsReceived=e.packetsReceived,n.video.bytesReceived=e.bytesReceived,n.video.packetsLost=e.packetsLost,n.video.framesReceived=e.framesReceived,n.video.framesDecoded=e.framesDecoded,n.video.fpsDecoded=e.framesPerSecond,n.hasVideo=!0,!e.decoderImplementation||i.prevDecoderImplementationMap_.has(n.userId)&&i.prevDecoderImplementationMap_.get(n.userId)===e.decoderImplementation||(Bf.info("[".concat(n.userId,"] decoderImplementation change to ").concat(e.decoderImplementation)),i.prevDecoderImplementationMap_.set(n.userId,e.decoderImplementation))),e.ssrc===r.auxiliary&&(n.auxiliary.packetsReceived=e.packetsReceived,n.auxiliary.bytesReceived=e.bytesReceived,n.auxiliary.packetsLost=e.packetsLost,n.auxiliary.framesReceived=e.framesReceived,n.auxiliary.framesDecoded=e.framesDecoded,n.auxiliary.fpsDecoded=e.framesPerSecond,n.hasAuxiliary=!0)}}else"track"===e.type?(Sh(e.frameWidth)||(e.trackIdentifier===t.getMainStreamVideoTrackId()&&(n.video.frameWidth=e.frameWidth,n.video.frameHeight=e.frameHeight),e.trackIdentifier===t.getAuxStreamVideoTrackId()&&(n.auxiliary.frameWidth=e.frameWidth,n.auxiliary.frameHeight=e.frameHeight)),e.kind===dd&&(n.audio.audioLevel=e.audioLevel||0,n.audio.totalAudioEnergy=e.totalAudioEnergy||0)):"candidate-pair"===e.type&&vy(e)&&bh(e.currentRoundTripTime)&&(n.rtt=Math.floor(1e3*e.currentRoundTripTime))})),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(3),this.log_.warn("failed to getStats on receiver connection");case 13:return e.abrupt("return",n);case 14:case"end":return e.stop()}}),e,this,[[3,10]])}))),function(e){return r.apply(this,arguments)})},{key:"getStats",value:(n=i(regeneratorRuntime.mark((function e(t,n){var r,i,a,o,s,c,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r={},!t){e.next=5;break}return e.next=4,this.getSenderStats(t);case 4:r=e.sent;case 5:i=[],a=b(n),e.prev=7,a.s();case 9:if((o=a.n()).done){e.next=17;break}return(s=g(o.value,2))[0],c=s[1],e.next=13,this.getReceiverStats(c);case 13:u=e.sent,i.push(u);case 15:e.next=9;break;case 17:e.next=22;break;case 19:e.prev=19,e.t0=e.catch(7),a.e(e.t0);case 22:return e.prev=22,a.f(),e.finish(22);case 25:return e.abrupt("return",{senderStats:r,receiverStats:i});case 26:case"end":return e.stop()}}),e,this,[[7,19,22,25]])}))),function(e,t){return n.apply(this,arguments)})},{key:"getDifferenceValue",value:function(e,t){if(N_(e))return t;var n=t-e;return n<0?0:n}},{key:"prepareReport",value:function(e){var t=this,n=e.stats,r=e.report,i=e.freezeMap;if(!N_(n.senderStats)){var a={uint32_audio_level:1e8*n.senderStats.audio.audioLevel,uint32_audio_energy:1e6*n.senderStats.audio.totalAudioEnergy,uint32_audio_codec_bitrate:n.senderStats.audio.bytesSent,audioLevel:n.senderStats.audio.audioLevel},o=[],s={uint32_video_stream_type:2,uint32_video_codec_fps:n.senderStats.video.framesSent,uint32_video_capture_fps:n.senderStats.video.fpsCapture,uint32_video_width:n.senderStats.video.frameWidth,uint32_video_height:n.senderStats.video.frameHeight,uint32_video_codec_bitrate:n.senderStats.video.bytesSent,uint32_video_enc_fps:n.senderStats.video.framesEncoded};if(o.push(s),n.senderStats.video.smallBytesSent){var c={uint32_video_stream_type:3,uint32_video_codec_fps:n.senderStats.video.smallFramesSent||0,uint32_video_capture_fps:n.senderStats.video.smallFPSCapture||0,uint32_video_width:n.senderStats.video.smallFrameWidth||0,uint32_video_height:n.senderStats.video.smallFrameHeight||0,uint32_video_codec_bitrate:n.senderStats.video.smallBytesSent,uint32_video_enc_fps:n.senderStats.video.smallFramesEncoded||0};o.push(c)}var u={uint32_bitrate:"",uint32_rtt:n.senderStats.rtt};r.msg_up_stream_info={msg_audio_status:a,msg_video_status:o,msg_network_status:u}}r.msg_down_stream_info=[],n.receiverStats.forEach((function(e){var t={};if(t.msg_user_info={str_identifier:e.userId,uint64_tinyid:e.tinyId},t.msg_network_status={uint32_rtt:e.rtt},t.msg_video_status={},e.hasAudio){var n={uint32_audio_codec_bitrate:e.audio.bytesReceived,uint32_audio_total_bitrate:e.audio.bytesReceived,uint32_audio_level:1e8*e.audio.audioLevel,uint32_audio_energy:1e6*e.audio.totalAudioEnergy,uint32_audio_receive:e.audio.packetsReceived,uint32_audio_origin_lost:e.audio.packetsLost,audioLevel:e.audio.audioLevel};t.msg_audio_status=n}if(t.msg_video_status=[],e.hasVideo){var a=i.get(e.userId+"_"+Kd),o=a?a.duration:0,s={uint32_video_stream_type:2,uint32_video_receive_fps:e.video.framesReceived,uint32_video_width:e.video.frameWidth,uint32_video_height:e.video.frameHeight,uint32_video_codec_bitrate:e.video.bytesReceived,uint32_video_receive:e.video.packetsReceived,uint32_video_origin_lost:e.video.packetsLost,uint32_video_block_time:o,uint32_video_dec_fps:e.video.fpsDecoded};t.msg_video_status.push(s)}if(e.hasAuxiliary){var c=i.get(e.userId+"_"+Qd),u=c?c.duration:0,d={uint32_video_stream_type:7,uint32_video_receive_fps:e.auxiliary.framesReceived,uint32_video_width:e.auxiliary.frameWidth,uint32_video_height:e.auxiliary.frameHeight,uint32_video_codec_bitrate:e.auxiliary.bytesReceived,uint32_video_receive:e.auxiliary.packetsReceived+e.auxiliary.packetsLost,uint32_video_origin_lost:e.auxiliary.packetsLost,uint32_video_block_time:u,uint32_video_dec_fps:e.auxiliary.fpsDecoded};t.msg_video_status.push(d)}r.msg_down_stream_info.push(t)}));var d=this.prevReport_;this.prevReport_=JSON.parse(JSON.stringify(r));var l=d.msg_up_stream_info.msg_audio_status,h=r.msg_up_stream_info.msg_audio_status,p=this.getDifferenceValue(l.uint32_audio_codec_bitrate,h.uint32_audio_codec_bitrate);h.uint32_audio_codec_bitrate=8*p/2;var f=d.msg_up_stream_info.msg_video_status;r.msg_up_stream_info.msg_video_status.forEach((function(e,n){var r=f[n],i=0,a=0,o=0;r&&(i=r.uint32_video_codec_bitrate,a=r.uint32_video_enc_fps,o=r.uint32_video_codec_fps);var s=t.getDifferenceValue(i,e.uint32_video_codec_bitrate);e.uint32_video_codec_bitrate=8*s/2,e.uint32_video_enc_fps=t.getDifferenceValue(a,e.uint32_video_enc_fps)/2,e.uint32_video_codec_fps=t.getDifferenceValue(o,e.uint32_video_codec_fps)/2}));var m=r.msg_down_stream_info,_=d.msg_down_stream_info;return m.forEach((function(e){var n=_.find((function(t){return t.msg_user_info.uint64_tinyid===e.msg_user_info.uint64_tinyid}));if(n){if(e.msg_audio_status&&n.msg_audio_status){var r=e.msg_audio_status,i=n.msg_audio_status;r.uint32_audio_origin_lost=t.getDifferenceValue(i.uint32_audio_origin_lost,r.uint32_audio_origin_lost),r.uint32_audio_receive=t.getDifferenceValue(i.uint32_audio_receive,r.uint32_audio_receive),r.uint32_audio_receive+=r.uint32_audio_origin_lost;var a=t.getDifferenceValue(i.uint32_audio_codec_bitrate,r.uint32_audio_codec_bitrate);r.uint32_audio_codec_bitrate=8*a/2,r.uint32_audio_total_bitrate=8*a/2}if(e.msg_video_status&&n.msg_video_status){var o=e.msg_video_status,s=n.msg_video_status;o.forEach((function(e,n){var r=s[n],i=0,a=0,o=0,c=0;r&&(i=r.uint32_video_receive,a=r.uint32_video_origin_lost,o=r.uint32_video_codec_bitrate,c=r.uint32_video_receive_fps),e.uint32_video_origin_lost=t.getDifferenceValue(a,e.uint32_video_origin_lost),e.uint32_video_receive=t.getDifferenceValue(i,e.uint32_video_receive)+e.uint32_video_origin_lost;var u=t.getDifferenceValue(o,e.uint32_video_codec_bitrate);e.uint32_video_codec_bitrate=8*u/2;var d=t.getDifferenceValue(c,e.uint32_video_receive_fps);e.uint32_video_receive_fps=d/2}))}}})),r.msg_up_stream_info.msg_network_status.uint32_bitrate=r.msg_up_stream_info.msg_audio_status.uint32_audio_codec_bitrate+r.msg_up_stream_info.msg_video_status[0].uint32_video_codec_bitrate,r}},{key:"getStatsReport",value:(t=i(regeneratorRuntime.mark((function e(t){var n,r,i,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.uplinkConnection,r=t.downlinkConnections,i=t.freezeMap,a={msg_up_stream_info:{msg_audio_status:{uint32_audio_format:0,uint32_audio_sample_rate:0,uint32_audio_codec_bitrate:0,uint32_audio_receive:0,uint32_audio_origin_lost:0,uint32_audio_level:0,uint32_audio_energy:0,audioLevel:0},msg_video_status:[{uint32_video_stream_type:0,uint32_video_codec_fps:0,uint32_video_capture_fps:0,uint32_video_width:0,uint32_video_height:0,uint32_video_codec_bitrate:0,uint32_video_receive:0,uint32_video_origin_lost:0,uint32_video_final_lost:0,uint32_video_enc_fps:0}],msg_network_status:{uint32_bitrate:0,uint32_rtt:0,uint32_lost:0},msg_qos:[{uint32_video_fps:0,uint32_video_width:0,uint32_video_height:0,uint32_video_bitrate:0,uint32_audio_bitrate:0,uint32_video_stream_type:0}]},msg_down_stream_info:[{msg_user_info:{str_identifier:"",uint64_tinyid:""},msg_audio_status:{uint32_audio_format:0,uint32_audio_sample_rate:0,uint32_audio_codec_bitrate:0,uint32_audio_total_bitrate:0,uint32_audio_level:0,uint32_audio_energy:0,uint32_audio_receive:0,uint32_audio_origin_lost:0,uint32_audio_final_lost:0,audioLevel:0},msg_video_status:[{uint32_video_stream_type:0,uint32_video_receive_fps:0,uint32_video_width:0,uint32_video_height:0,uint32_video_codec_bitrate:0,uint32_video_receive:0,uint32_video_origin_lost:0,uint32_video_block_time:0,uint32_video_dec_fps:0}],msg_network_status:{uint32_bitrate:0,uint32_rtt:0,uint32_lost:0,uint32_jitter:0},msg_qos:[{uint32_video_fps:0,uint32_video_width:0,uint32_video_height:0,uint32_video_bitrate:0,uint32_audio_bitrate:0,uint32_video_stream_type:0}]}]},"{}"===JSON.stringify(this.prevReport_)&&(this.prevReport_=JSON.parse(JSON.stringify(a))),e.next=5,this.getStats(n,r);case 5:return o=e.sent,this.prepareReport({stats:o,report:a,freezeMap:i}),e.abrupt("return",a);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})}]),e}(),Zy=function(){function e(t){var n=t.signalChannel,r=t.connections,i=t.client;a(this,e),this.client_=i,this.signalChannel_=n,this.connections_=r,this.client_=i,this.log_=Bf.createLogger({id:"q|"+this.client_.getUserId(),userId:this.client_.getUserId(),sdkAppId:this.client_.getSDKAppId()}),this.uplinkConnection_=null,this.uplinkNetworkQuality_=0,this.uplinkRTT_=0,this.uplinkLoss_=0,this.downlinkNetworkQuality_=0,this.downlinkRTT_=0,this.downlinkLoss_=0,this.downlinkPrevStatMap_=new Map,this.downlinkLossAndRTTMap_=new Map,this.interval_=-1,this.emitter_=new Jp,this.initialize()}var t,n;return s(e,[{key:"uplinkNetworkQuality",get:function(){return this.uplinkNetworkQuality_},set:function(e){e!==this.uplinkNetworkQuality_&&this.log_.info("uplink network quality change ".concat(this.uplinkNetworkQuality," -> ").concat(e,", rtt: ").concat(this.uplinkRTT_,", loss: ").concat(this.uplinkLoss_)),this.uplinkNetworkQuality_=e}},{key:"downlinkNetworkQuality",get:function(){return this.downlinkNetworkQuality_},set:function(e){if(e!==this.downlinkNetworkQuality_){var t=this.getAverageLossAndRTT(y(this.downlinkLossAndRTTMap_.values())),n=t.rtt,r=t.loss;this.log_.info("downlink network quality change ".concat(this.downlinkNetworkQuality," -> ").concat(e,", rtt: ").concat(n,", loss: ").concat(r))}this.downlinkNetworkQuality_=e}},{key:"initialize",value:function(){var e=this;this.signalChannel_.on(wm.UPLINK_NETWORK_STATS,(function(t){e.handleUplinkNetworkQuality(t)})),this.signalChannel_.on(vm,this.handleSignalConnectionStateChange.bind(this)),this.start()}},{key:"handleUplinkNetworkQuality",value:function(e){if(!this.uplinkConnection_)return this.uplinkNetworkQuality=0,this.uplinkLoss_=0,void(this.uplinkRTT_=0);var t=this.uplinkConnection_.getPeerConnection();if(t&&this.isPeerConnectionDisconnected(t))return this.uplinkNetworkQuality=6,this.uplinkLoss_=0,void(this.uplinkRTT_=0);if(0===e.data.code){var n=e.data.data,r=n.expectAudPkg+n.expectVidPkg,i=n.recvAudPkg+n.recvVidPkg,a=r-i,o=n.delay;if(o&&this.updateDelay(o),0===r&&0===i)return;this.uplinkLoss_=a<=0?0:Math.round(a/r*100),this.uplinkRTT_=n.rtt,this.uplinkNetworkQuality=this.getNetworkQuality(this.uplinkLoss_,this.uplinkRTT_)}}},{key:"handleDownlinkNetworkQuality",value:(n=i(regeneratorRuntime.mark((function e(){var t,n,r,i,a,o,s,c,u,d,l,h,p,f,m,_=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.connections_&&0!==this.connections_.size){e.next=3;break}return this.downlinkNetworkQuality=0,e.abrupt("return");case 3:if(t=y(this.connections_.values()),n=t.filter((function(e){return e.getPeerConnection()&&e.getPeerConnection().connectionState===al})),t.filter((function(e){return e.getPeerConnection()&&_.isPeerConnectionDisconnected(e.getPeerConnection())})).length!==t.length){e.next=9;break}return this.downlinkNetworkQuality=6,e.abrupt("return");case 9:r=0;case 10:if(!(r<n.length)){e.next=31;break}return i=n[r].getPeerConnection(),e.next=14,this.getStat(i);case 14:if(a=e.sent,o=a.rtt,s=a.totalPacketsLost,c=a.totalPacketsReceived,this.downlinkPrevStatMap_.has(i)){e.next=21;break}return this.downlinkPrevStatMap_.set(i,{totalPacketsLost:s,totalPacketsReceived:c}),e.abrupt("continue",28);case 21:u=0,d=this.downlinkPrevStatMap_.get(i),l=s-d.totalPacketsLost,h=c-d.totalPacketsReceived,u=l<=0||h<0?0:Math.round(l/(l+h)*100),this.downlinkPrevStatMap_.set(i,{totalPacketsLost:s,totalPacketsReceived:c}),this.downlinkLossAndRTTMap_.set(i,{rtt:o,loss:u,userId:n[r].getUserId()});case 28:r++,e.next=10;break;case 31:if(y(this.downlinkPrevStatMap_.keys()).forEach((function(e){_.isPeerConnectionDisconnected(e)&&(_.downlinkPrevStatMap_.delete(e),_.downlinkLossAndRTTMap_.delete(e))})),0!==this.downlinkLossAndRTTMap_.size){e.next=34;break}return e.abrupt("return");case 34:p=this.getAverageLossAndRTT(y(this.downlinkLossAndRTTMap_.values())),f=p.rtt,m=p.loss,this.downlinkRTT_=f,this.downlinkLoss_=m,this.downlinkNetworkQuality=this.getNetworkQuality(m,f);case 38:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"getStat",value:(t=i(regeneratorRuntime.mark((function e(t){var n,r,i,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n={rtt:0,totalPacketsLost:0,totalPacketsReceived:0},t&&dy()){e.next=3;break}return e.abrupt("return",n);case 3:r=t.getReceivers(),e.prev=4,i=0;case 6:if(!(i<r.length)){e.next=15;break}return a=r[i],e.next=10,a.getStats();case 10:e.sent.forEach((function(e){"candidate-pair"===e.type&&bh(e.currentRoundTripTime)&&(n.rtt=Math.round(1e3*e.currentRoundTripTime)),"inbound-rtp"!==e.type||e.mediaType!==dd&&e.mediaType!==ld||(n.totalPacketsLost+=e.packetsLost,n.totalPacketsReceived+=e.packetsReceived)}));case 12:i++,e.next=6;break;case 15:return e.abrupt("return",n);case 18:return e.prev=18,e.t0=e.catch(4),e.abrupt("return",n);case 21:case"end":return e.stop()}}),e,null,[[4,18]])}))),function(e){return t.apply(this,arguments)})},{key:"getAverageLossAndRTT",value:function(e){var t={rtt:0,loss:0};return Array.isArray(e)&&e.length>0&&(e.forEach((function(e){t.rtt+=e.rtt,t.loss+=e.loss})),Object.keys(t).forEach((function(n){t[n]=Math.round(t[n]/e.length)}))),t}},{key:"getNetworkQuality",value:function(e,t){return e>50||t>500?5:e>30||t>350?4:e>20||t>200?3:e>10||t>100?2:e>=0||t>=0?1:0}},{key:"handleSignalConnectionStateChange",value:function(e){e.state===Sm?(this.uplinkRTT_=0,this.uplinkLoss_=0,this.uplinkNetworkQuality=6):e.state===Im&&6===this.uplinkNetworkQuality&&(this.uplinkNetworkQuality=5)}},{key:"handleUplinkConnectionStateChange",value:function(e){var t=e.state;t===Xd?(this.uplinkLoss_=0,this.uplinkRTT_=0,this.uplinkNetworkQuality=6):t===Zd&&6===this.uplinkNetworkQuality&&(this.uplinkNetworkQuality=5)}},{key:"isPeerConnectionDisconnected",value:function(e){return!(!e||e.connectionState!==il&&e.connectionState!==nl&&e.connectionState!==rl)}},{key:"setUplinkConnection",value:function(e){this.uplinkConnection_=e,this.uplinkConnection_?this.uplinkConnection_.on(Py,this.handleUplinkConnectionStateChange.bind(this)):(this.uplinkNetworkQuality=0,this.uplinkRTT_=0,this.uplinkLoss_=0)}},{key:"start",value:function(){var e=this;-1===this.interval_?(this.log_.info("start network quality calculating"),this.interval_=$g.setInterval((function(){e.handleDownlinkNetworkQuality(),zp.emit(Lf,{client:e.client_,uplinkNetworkQuality:e.uplinkNetworkQuality,downlinkNetworkQuality:e.downlinkNetworkQuality,uplinkRTT:e.uplinkRTT_,uplinkLoss:e.uplinkLoss_,downlinkRTT:e.downlinkRTT_,downlinkLoss:e.downlinkLoss_,downlinkLossAndRTTMap:e.downlinkLossAndRTTMap_}),e.emitter_.emit(Jy,{uplinkNetworkQuality:e.uplinkNetworkQuality,downlinkNetworkQuality:e.downlinkNetworkQuality,uplinkRTT:e.uplinkRTT_,uplinkLoss:e.uplinkLoss_,downlinkRTT:e.downlinkRTT_,downlinkLoss:e.downlinkLoss_})}),2e3)):this.log_.info("network quality calculating is already started")}},{key:"stop",value:function(){this.log_.info("stop network quality calculating"),-1!==this.interval_&&($g.clearInterval(this.interval_),this.interval_=-1)}},{key:"on",value:function(e,t){this.emitter_.on(e,t)}},{key:"updateDelay",value:function(e){var t=this;e.forEach((function(e){var n=e.srcTinyId,r=e.videoDelay,i=e.audioDelay,a=t.connections_.get(n);a&&a.setDelay({videoDelay:r,audioDelay:i})}))}}]),e}(),eS=function(){function e(t){a(this,e),this.log_=Bf.createLogger({id:t.client.getUserId(),userId:t.client.getUserId(),sdkAppId:t.client.getSDKAppId()}),this.localStream_=null,this.prevDevices_=[],this.initialize()}var t,n,r;return s(e,[{key:"initialize",value:(r=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:navigator.mediaDevices&&navigator.mediaDevices.addEventListener("devicechange",this.onDeviceChange.bind(this));case 1:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"onDeviceChange",value:(n=i(regeneratorRuntime.mark((function e(){var t,n,r,i=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.localStream_&&this.localStream_.getMediaStream()&&!this.localStream_.getScreen()){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,GI.getDevices();case 4:t=e.sent,n=t.filter((function(e){return i.prevDevices_.findIndex((function(t){var n=t.deviceId;return e.deviceId===n}))<0})),r=this.prevDevices_.filter((function(e){return t.findIndex((function(t){var n=t.deviceId;return e.deviceId===n}))<0})),n.length>0&&this.handleDeviceAdded(this.prevDevices_,n),r.length>0&&this.handleDeviceRemoved(t,r),this.prevDevices_=t;case 10:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"setLocalStream",value:(t=i(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t){e.next=4;break}return e.next=3,GI.getDevices();case 3:this.prevDevices_=e.sent;case 4:this.localStream_=t;case 5:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"handleDeviceAdded",value:function(e,t){this.log_.warn("devicesAdded: ".concat(JSON.stringify(t))),this.localStream_.updateDeviceIdInUse();var n=t.filter((function(e){return e.kind===Id})),r=t.filter((function(e){return e.kind===bd})),i=e.filter((function(e){return e.kind===Id})),a=e.filter((function(e){return e.kind===bd})),o=n.length>0&&0===i.length&&this.localStream_.getVideo(),s=r.length>0&&0===a.length&&this.localStream_.getAudio();if(s&&o)return this.log_.info("new microphone and camera detected, but there was no device before."),void this.localStream_.updateStream({audio:!0,video:!0,cameraId:n[0].deviceId,microphoneId:r[0].deviceId});o&&(this.log_.info("new camera detected, but there was no camera before."),this.localStream_.updateStream({audio:!1,video:!0,cameraId:n[0].deviceId})),s&&(this.log_.info("new microphone detected, but there was no microphone before."),this.localStream_.updateStream({audio:!0,video:!1,microphoneId:r[0].deviceId}))}},{key:"handleDeviceRemoved",value:function(e,t){this.log_.warn("devicesRemoved: ".concat(JSON.stringify(t))),this.localStream_.updateDeviceIdInUse();var n=!1,r=!1,i=this.localStream_.getCameraId(),a=this.localStream_.getMicrophoneId();if("default"===a){var o=this.localStream_.getMicrophoneGroupId(),s=e.filter((function(e){return"default"===e.deviceId&&e.kind===bd}))[0];s&&s.groupId!==o&&(r=!0)}if(t.forEach((function(e){var t=e.deviceId;i.length>0&&t===i?n=!0:a.length>0&&t===a&&(r=!0)})),n&&r)return this.log_.warn("current camera and microphone in use is lost, cameraId: ".concat(i,", microphoneId: ").concat(a)),void((this.localStream_.getAudio()||this.localStream_.getVideo())&&this.localStream_.updateStream({video:!0,audio:!0}));n&&(this.log_.warn("current camera in use is lost, deviceId: ".concat(i)),this.localStream_.getVideo()&&this.localStream_.updateStream({video:!0,audio:!1})),r&&(this.log_.warn("current microphone in use is lost, deviceId: ".concat(a)),this.localStream_.getAudio()&&this.localStream_.updateStream({video:!1,audio:!0}))}}]),e}(),tS=function(e){var t=xi(j(this)),n="",r=et(e);if(r<0||Infinity==r)throw RangeError("Wrong number of repetitions");for(;r>0;(r>>>=1)&&(t+=t))1&r&&(n+=t);return n},nS=1..toFixed,rS=Math.floor,iS=function(e,t,n){return 0===t?n:t%2==1?iS(e,t-1,n*e):iS(e*e,t/2,n)},aS=function(e,t,n){for(var r=-1,i=n;++r<6;)i+=t*e[r],e[r]=i%1e7,i=rS(i/1e7)},oS=function(e,t){for(var n=6,r=0;--n>=0;)r+=e[n],e[n]=rS(r/t),r=r%t*1e7},sS=function(e){for(var t=6,n="";--t>=0;)if(""!==n||0===t||0!==e[t]){var r=String(e[t]);n=""===n?r:n+tS.call("0",7-r.length)+r}return n},cS=nS&&("0.000"!==8e-5.toFixed(3)||"1"!==.9.toFixed(0)||"1.25"!==1.255.toFixed(2)||"1000000000000000128"!==(0xde0b6b3a7640080).toFixed(0))||!x((function(){nS.call({})}));Rt({target:"Number",proto:!0,forced:cS},{toFixed:function(e){var t,n,r,i,a=Jo(this),o=et(e),s=[0,0,0,0,0,0],c="",u="0";if(o<0||o>20)throw RangeError("Incorrect fraction digits");if(a!=a)return"NaN";if(a<=-1e21||a>=1e21)return String(a);if(a<0&&(c="-",a=-a),a>1e-21)if(n=(t=function(e){for(var t=0,n=e;n>=4096;)t+=12,n/=4096;for(;n>=2;)t+=1,n/=2;return t}(a*iS(2,69,1))-69)<0?a*iS(2,-t,1):a/iS(2,t,1),n*=4503599627370496,(t=52-t)>0){for(aS(s,0,n),r=o;r>=7;)aS(s,1e7,0),r-=7;for(aS(s,iS(10,r,1),0),r=t-1;r>=23;)oS(s,1<<23),r-=23;oS(s,1<<r),aS(s,1,1),oS(s,2),u=sS(s)}else aS(s,0,n),aS(s,1<<-t,0),u=sS(s)+tS.call("0",o);return u=o>0?c+((i=u.length)<=o?"0."+tS.call("0",o-i)+u:u.slice(0,i-o)+"."+u.slice(i-o)):c+u}});var uS,dS=Object.assign,lS=Object.defineProperty,hS=!dS||x((function(){if(P&&1!==dS({b:1},dS(lS({},"a",{enumerable:!0,get:function(){lS(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},n=Symbol();return e[n]=7,"abcdefghijklmnopqrst".split("").forEach((function(e){t[e]=e})),7!=dS({},e)[n]||"abcdefghijklmnopqrst"!=hr(dS({},t)).join("")}))?function(e,t){for(var n=se(e),r=arguments.length,i=1,a=ft.f,o=L.f;r>i;)for(var s,c=F(arguments[i++]),u=a?hr(c).concat(a(c)):hr(c),d=u.length,l=0;d>l;)s=u[l++],P&&!o.call(c,s)||(n[s]=c[s]);return n}:dS,pS=function(e,t,n,r){try{return r?t(we(n)[0],n[1]):t(n)}catch(JI){di(e,"throw",JI)}},fS=function(e){var t=se(e),n=Ft(this),r=arguments.length,i=r>1?arguments[1]:void 0,a=void 0!==i;a&&(i=wt(i,r>2?arguments[2]:void 0,2));var o,s,c,u,d,l,h=ci(t),p=0;if(!h||this==Array&&oi(h))for(o=ot(t),s=n?new this(o):Array(o);o>p;p++)l=a?i(t[p],p):t[p],zi(s,p,l);else for(d=(u=ui(t,h)).next,s=n?new this:[];!(c=d.call(u)).done;p++)l=a?pS(u,i,[c.value,p],!0):c.value,zi(s,p,l);return s.length=p,s},mS=/[^\0-\u007E]/,_S=/[.\u3002\uFF0E\uFF61]/g,vS="Overflow: input needs wider integers to process",gS=Math.floor,yS=String.fromCharCode,SS=function(e){return e+22+75*(e<26)},kS=function(e,t,n){var r=0;for(e=n?gS(e/700):e>>1,e+=gS(e/t);e>455;r+=36)e=gS(e/35);return gS(r+36*e/(e+38))},bS=function(e){var t,n,r=[],i=(e=function(e){for(var t=[],n=0,r=e.length;n<r;){var i=e.charCodeAt(n++);if(i>=55296&&i<=56319&&n<r){var a=e.charCodeAt(n++);56320==(64512&a)?t.push(((1023&i)<<10)+(1023&a)+65536):(t.push(i),n--)}else t.push(i)}return t}(e)).length,a=128,o=0,s=72;for(t=0;t<e.length;t++)(n=e[t])<128&&r.push(yS(n));var c=r.length,u=c;for(c&&r.push("-");u<i;){var d=2147483647;for(t=0;t<e.length;t++)(n=e[t])>=a&&n<d&&(d=n);var l=u+1;if(d-a>gS((2147483647-o)/l))throw RangeError(vS);for(o+=(d-a)*l,a=d,t=0;t<e.length;t++){if((n=e[t])<a&&++o>2147483647)throw RangeError(vS);if(n==a){for(var h=o,p=36;;p+=36){var f=p<=s?1:p>=s+26?26:p-s;if(h<f)break;var m=h-f,_=36-f;r.push(yS(SS(f+m%_))),h=gS(m/_)}r.push(yS(SS(h))),s=kS(o,l,u==c),o=0,++u}}++o,++a}return r.join("")},IS=Di.codeAt,TS=A.URL,RS=mo.URLSearchParams,wS=mo.getState,ES=We.set,CS=We.getterFor("URL"),AS=Math.floor,xS=Math.pow,PS=/[A-Za-z]/,DS=/[\d+-.A-Za-z]/,NS=/\d/,LS=/^0x/i,OS=/^[0-7]+$/,MS=/^\d+$/,US=/^[\dA-Fa-f]+$/,VS=/[\0\t\n\r #%/:<>?@[\\\]^|]/,FS=/[\0\t\n\r #/:<>?@[\\\]^|]/,jS=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,BS=/[\t\n\r]/g,HS=function(e,t){var n,r,i;if("["==t.charAt(0)){if("]"!=t.charAt(t.length-1))return"Invalid host";if(!(n=JS(t.slice(1,-1))))return"Invalid host";e.host=n}else if(YS(e)){if(t=function(e){var t,n,r=[],i=e.toLowerCase().replace(_S,".").split(".");for(t=0;t<i.length;t++)n=i[t],r.push(mS.test(n)?"xn--"+bS(n):n);return r.join(".")}(t),VS.test(t))return"Invalid host";if(null===(n=GS(t)))return"Invalid host";e.host=n}else{if(FS.test(t))return"Invalid host";for(n="",r=fS(t),i=0;i<r.length;i++)n+=XS(r[i],WS);e.host=n}},GS=function(e){var t,n,r,i,a,o,s,c=e.split(".");if(c.length&&""==c[c.length-1]&&c.pop(),(t=c.length)>4)return e;for(n=[],r=0;r<t;r++){if(""==(i=c[r]))return e;if(a=10,i.length>1&&"0"==i.charAt(0)&&(a=LS.test(i)?16:8,i=i.slice(8==a?1:2)),""===i)o=0;else{if(!(10==a?MS:8==a?OS:US).test(i))return e;o=parseInt(i,a)}n.push(o)}for(r=0;r<t;r++)if(o=n[r],r==t-1){if(o>=xS(256,5-t))return null}else if(o>255)return null;for(s=n.pop(),r=0;r<n.length;r++)s+=n[r]*xS(256,3-r);return s},JS=function(e){var t,n,r,i,a,o,s,c=[0,0,0,0,0,0,0,0],u=0,d=null,l=0,h=function(){return e.charAt(l)};if(":"==h()){if(":"!=e.charAt(1))return;l+=2,d=++u}for(;h();){if(8==u)return;if(":"!=h()){for(t=n=0;n<4&&US.test(h());)t=16*t+parseInt(h(),16),l++,n++;if("."==h()){if(0==n)return;if(l-=n,u>6)return;for(r=0;h();){if(i=null,r>0){if(!("."==h()&&r<4))return;l++}if(!NS.test(h()))return;for(;NS.test(h());){if(a=parseInt(h(),10),null===i)i=a;else{if(0==i)return;i=10*i+a}if(i>255)return;l++}c[u]=256*c[u]+i,2!=++r&&4!=r||u++}if(4!=r)return;break}if(":"==h()){if(l++,!h())return}else if(h())return;c[u++]=t}else{if(null!==d)return;l++,d=++u}}if(null!==d)for(o=u-d,u=7;0!=u&&o>0;)s=c[u],c[u--]=c[d+o-1],c[d+--o]=s;else if(8!=u)return;return c},zS=function(e){var t,n,r,i;if("number"==typeof e){for(t=[],n=0;n<4;n++)t.unshift(e%256),e=AS(e/256);return t.join(".")}if("object"==typeof e){for(t="",r=function(e){for(var t=null,n=1,r=null,i=0,a=0;a<8;a++)0!==e[a]?(i>n&&(t=r,n=i),r=null,i=0):(null===r&&(r=a),++i);return i>n&&(t=r,n=i),t}(e),n=0;n<8;n++)i&&0===e[n]||(i&&(i=!1),r===n?(t+=n?":":"::",i=!0):(t+=e[n].toString(16),n<7&&(t+=":")));return"["+t+"]"}return e},WS={},qS=hS({},WS,{" ":1,'"':1,"<":1,">":1,"`":1}),KS=hS({},qS,{"#":1,"?":1,"{":1,"}":1}),QS=hS({},KS,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),XS=function(e,t){var n=IS(e,0);return n>32&&n<127&&!ue(t,e)?e:encodeURIComponent(e)},$S={ftp:21,file:null,http:80,https:443,ws:80,wss:443},YS=function(e){return ue($S,e.scheme)},ZS=function(e){return""!=e.username||""!=e.password},ek=function(e){return!e.host||e.cannotBeABaseURL||"file"==e.scheme},tk=function(e,t){var n;return 2==e.length&&PS.test(e.charAt(0))&&(":"==(n=e.charAt(1))||!t&&"|"==n)},nk=function(e){var t;return e.length>1&&tk(e.slice(0,2))&&(2==e.length||"/"===(t=e.charAt(2))||"\\"===t||"?"===t||"#"===t)},rk=function(e){var t=e.path,n=t.length;!n||"file"==e.scheme&&1==n&&tk(t[0],!0)||t.pop()},ik=function(e){return"."===e||"%2e"===e.toLowerCase()},ak={},ok={},sk={},ck={},uk={},dk={},lk={},hk={},pk={},fk={},mk={},_k={},vk={},gk={},yk={},Sk={},kk={},bk={},Ik={},Tk={},Rk={},wk=function(e,t,n,r){var i,a,o,s,c,u=n||ak,d=0,l="",h=!1,p=!1,f=!1;for(n||(e.scheme="",e.username="",e.password="",e.host=null,e.port=null,e.path=[],e.query=null,e.fragment=null,e.cannotBeABaseURL=!1,t=t.replace(jS,"")),t=t.replace(BS,""),i=fS(t);d<=i.length;){switch(a=i[d],u){case ak:if(!a||!PS.test(a)){if(n)return"Invalid scheme";u=sk;continue}l+=a.toLowerCase(),u=ok;break;case ok:if(a&&(DS.test(a)||"+"==a||"-"==a||"."==a))l+=a.toLowerCase();else{if(":"!=a){if(n)return"Invalid scheme";l="",u=sk,d=0;continue}if(n&&(YS(e)!=ue($S,l)||"file"==l&&(ZS(e)||null!==e.port)||"file"==e.scheme&&!e.host))return;if(e.scheme=l,n)return void(YS(e)&&$S[e.scheme]==e.port&&(e.port=null));l="","file"==e.scheme?u=gk:YS(e)&&r&&r.scheme==e.scheme?u=ck:YS(e)?u=hk:"/"==i[d+1]?(u=uk,d++):(e.cannotBeABaseURL=!0,e.path.push(""),u=Ik)}break;case sk:if(!r||r.cannotBeABaseURL&&"#"!=a)return"Invalid scheme";if(r.cannotBeABaseURL&&"#"==a){e.scheme=r.scheme,e.path=r.path.slice(),e.query=r.query,e.fragment="",e.cannotBeABaseURL=!0,u=Rk;break}u="file"==r.scheme?gk:dk;continue;case ck:if("/"!=a||"/"!=i[d+1]){u=dk;continue}u=pk,d++;break;case uk:if("/"==a){u=fk;break}u=bk;continue;case dk:if(e.scheme=r.scheme,a==uS)e.username=r.username,e.password=r.password,e.host=r.host,e.port=r.port,e.path=r.path.slice(),e.query=r.query;else if("/"==a||"\\"==a&&YS(e))u=lk;else if("?"==a)e.username=r.username,e.password=r.password,e.host=r.host,e.port=r.port,e.path=r.path.slice(),e.query="",u=Tk;else{if("#"!=a){e.username=r.username,e.password=r.password,e.host=r.host,e.port=r.port,e.path=r.path.slice(),e.path.pop(),u=bk;continue}e.username=r.username,e.password=r.password,e.host=r.host,e.port=r.port,e.path=r.path.slice(),e.query=r.query,e.fragment="",u=Rk}break;case lk:if(!YS(e)||"/"!=a&&"\\"!=a){if("/"!=a){e.username=r.username,e.password=r.password,e.host=r.host,e.port=r.port,u=bk;continue}u=fk}else u=pk;break;case hk:if(u=pk,"/"!=a||"/"!=l.charAt(d+1))continue;d++;break;case pk:if("/"!=a&&"\\"!=a){u=fk;continue}break;case fk:if("@"==a){h&&(l="%40"+l),h=!0,o=fS(l);for(var m=0;m<o.length;m++){var _=o[m];if(":"!=_||f){var v=XS(_,QS);f?e.password+=v:e.username+=v}else f=!0}l=""}else if(a==uS||"/"==a||"?"==a||"#"==a||"\\"==a&&YS(e)){if(h&&""==l)return"Invalid authority";d-=fS(l).length+1,l="",u=mk}else l+=a;break;case mk:case _k:if(n&&"file"==e.scheme){u=Sk;continue}if(":"!=a||p){if(a==uS||"/"==a||"?"==a||"#"==a||"\\"==a&&YS(e)){if(YS(e)&&""==l)return"Invalid host";if(n&&""==l&&(ZS(e)||null!==e.port))return;if(s=HS(e,l))return s;if(l="",u=kk,n)return;continue}"["==a?p=!0:"]"==a&&(p=!1),l+=a}else{if(""==l)return"Invalid host";if(s=HS(e,l))return s;if(l="",u=vk,n==_k)return}break;case vk:if(!NS.test(a)){if(a==uS||"/"==a||"?"==a||"#"==a||"\\"==a&&YS(e)||n){if(""!=l){var g=parseInt(l,10);if(g>65535)return"Invalid port";e.port=YS(e)&&g===$S[e.scheme]?null:g,l=""}if(n)return;u=kk;continue}return"Invalid port"}l+=a;break;case gk:if(e.scheme="file","/"==a||"\\"==a)u=yk;else{if(!r||"file"!=r.scheme){u=bk;continue}if(a==uS)e.host=r.host,e.path=r.path.slice(),e.query=r.query;else if("?"==a)e.host=r.host,e.path=r.path.slice(),e.query="",u=Tk;else{if("#"!=a){nk(i.slice(d).join(""))||(e.host=r.host,e.path=r.path.slice(),rk(e)),u=bk;continue}e.host=r.host,e.path=r.path.slice(),e.query=r.query,e.fragment="",u=Rk}}break;case yk:if("/"==a||"\\"==a){u=Sk;break}r&&"file"==r.scheme&&!nk(i.slice(d).join(""))&&(tk(r.path[0],!0)?e.path.push(r.path[0]):e.host=r.host),u=bk;continue;case Sk:if(a==uS||"/"==a||"\\"==a||"?"==a||"#"==a){if(!n&&tk(l))u=bk;else if(""==l){if(e.host="",n)return;u=kk}else{if(s=HS(e,l))return s;if("localhost"==e.host&&(e.host=""),n)return;l="",u=kk}continue}l+=a;break;case kk:if(YS(e)){if(u=bk,"/"!=a&&"\\"!=a)continue}else if(n||"?"!=a)if(n||"#"!=a){if(a!=uS&&(u=bk,"/"!=a))continue}else e.fragment="",u=Rk;else e.query="",u=Tk;break;case bk:if(a==uS||"/"==a||"\\"==a&&YS(e)||!n&&("?"==a||"#"==a)){if(".."===(c=(c=l).toLowerCase())||"%2e."===c||".%2e"===c||"%2e%2e"===c?(rk(e),"/"==a||"\\"==a&&YS(e)||e.path.push("")):ik(l)?"/"==a||"\\"==a&&YS(e)||e.path.push(""):("file"==e.scheme&&!e.path.length&&tk(l)&&(e.host&&(e.host=""),l=l.charAt(0)+":"),e.path.push(l)),l="","file"==e.scheme&&(a==uS||"?"==a||"#"==a))for(;e.path.length>1&&""===e.path[0];)e.path.shift();"?"==a?(e.query="",u=Tk):"#"==a&&(e.fragment="",u=Rk)}else l+=XS(a,KS);break;case Ik:"?"==a?(e.query="",u=Tk):"#"==a?(e.fragment="",u=Rk):a!=uS&&(e.path[0]+=XS(a,WS));break;case Tk:n||"#"!=a?a!=uS&&("'"==a&&YS(e)?e.query+="%27":e.query+="#"==a?"%23":XS(a,WS)):(e.fragment="",u=Rk);break;case Rk:a!=uS&&(e.fragment+=XS(a,qS))}d++}},Ek=function(e){var t,n,r=pi(this,Ek,"URL"),i=arguments.length>1?arguments[1]:void 0,a=xi(e),o=ES(r,{type:"URL"});if(void 0!==i)if(i instanceof Ek)t=CS(i);else if(n=wk(t={},xi(i)))throw TypeError(n);if(n=wk(o,a,null,t))throw TypeError(n);var s=o.searchParams=new RS,c=wS(s);c.updateSearchParams(o.query),c.updateURL=function(){o.query=String(s)||null},P||(r.href=Ak.call(r),r.origin=xk.call(r),r.protocol=Pk.call(r),r.username=Dk.call(r),r.password=Nk.call(r),r.host=Lk.call(r),r.hostname=Ok.call(r),r.port=Mk.call(r),r.pathname=Uk.call(r),r.search=Vk.call(r),r.searchParams=Fk.call(r),r.hash=jk.call(r))},Ck=Ek.prototype,Ak=function(){var e=CS(this),t=e.scheme,n=e.username,r=e.password,i=e.host,a=e.port,o=e.path,s=e.query,c=e.fragment,u=t+":";return null!==i?(u+="//",ZS(e)&&(u+=n+(r?":"+r:"")+"@"),u+=zS(i),null!==a&&(u+=":"+a)):"file"==t&&(u+="//"),u+=e.cannotBeABaseURL?o[0]:o.length?"/"+o.join("/"):"",null!==s&&(u+="?"+s),null!==c&&(u+="#"+c),u},xk=function(){var e=CS(this),t=e.scheme,n=e.port;if("blob"==t)try{return new Ek(t.path[0]).origin}catch(JI){return"null"}return"file"!=t&&YS(e)?t+"://"+zS(e.host)+(null!==n?":"+n:""):"null"},Pk=function(){return CS(this).scheme+":"},Dk=function(){return CS(this).username},Nk=function(){return CS(this).password},Lk=function(){var e=CS(this),t=e.host,n=e.port;return null===t?"":null===n?zS(t):zS(t)+":"+n},Ok=function(){var e=CS(this).host;return null===e?"":zS(e)},Mk=function(){var e=CS(this).port;return null===e?"":String(e)},Uk=function(){var e=CS(this),t=e.path;return e.cannotBeABaseURL?t[0]:t.length?"/"+t.join("/"):""},Vk=function(){var e=CS(this).query;return e?"?"+e:""},Fk=function(){return CS(this).searchParams},jk=function(){var e=CS(this).fragment;return e?"#"+e:""},Bk=function(e,t){return{get:e,set:t,configurable:!0,enumerable:!0}};if(P&&pr(Ck,{href:Bk(Ak,(function(e){var t=CS(this),n=xi(e),r=wk(t,n);if(r)throw TypeError(r);wS(t.searchParams).updateSearchParams(t.query)})),origin:Bk(xk),protocol:Bk(Pk,(function(e){var t=CS(this);wk(t,xi(e)+":",ak)})),username:Bk(Dk,(function(e){var t=CS(this),n=fS(xi(e));if(!ek(t)){t.username="";for(var r=0;r<n.length;r++)t.username+=XS(n[r],QS)}})),password:Bk(Nk,(function(e){var t=CS(this),n=fS(xi(e));if(!ek(t)){t.password="";for(var r=0;r<n.length;r++)t.password+=XS(n[r],QS)}})),host:Bk(Lk,(function(e){var t=CS(this);t.cannotBeABaseURL||wk(t,xi(e),mk)})),hostname:Bk(Ok,(function(e){var t=CS(this);t.cannotBeABaseURL||wk(t,xi(e),_k)})),port:Bk(Mk,(function(e){var t=CS(this);ek(t)||(""==(e=xi(e))?t.port=null:wk(t,e,vk))})),pathname:Bk(Uk,(function(e){var t=CS(this);t.cannotBeABaseURL||(t.path=[],wk(t,xi(e),kk))})),search:Bk(Vk,(function(e){var t=CS(this);""==(e=xi(e))?t.query=null:("?"==e.charAt(0)&&(e=e.slice(1)),t.query="",wk(t,e,Tk)),wS(t.searchParams).updateSearchParams(t.query)})),searchParams:Bk(Fk),hash:Bk(jk,(function(e){var t=CS(this);""!=(e=xi(e))?("#"==e.charAt(0)&&(e=e.slice(1)),t.fragment="",wk(t,e,Rk)):t.fragment=null}))}),$e(Ck,"toJSON",(function(){return Ak.call(this)}),{enumerable:!0}),$e(Ck,"toString",(function(){return Ak.call(this)}),{enumerable:!0}),TS){var Hk=TS.createObjectURL,Gk=TS.revokeObjectURL;Hk&&$e(Ek,"createObjectURL",(function(e){return Hk.apply(TS,arguments)})),Gk&&$e(Ek,"revokeObjectURL",(function(e){return Gk.apply(TS,arguments)}))}Ur(Ek,"URL"),Rt({global:!0,forced:!Ha,sham:!P},{URL:Ek});var Jk,zk,Wk,qk=new Blob(["class VolumeMeter extends AudioWorkletProcessor{constructor(){super();this.volume=0;this.intervalTime=200;this.tick=this.intervalTime;this.isStop=false;this.port.onmessage=event=>{const{data}=event;switch(data.name){case'setIntervalTime':this.intervalTime=data.intervalTime;break;case'stop':this.isStop=true;break}}}process(inputs){const input=inputs[0];if(this.isStop){return false}if(input.length>0){const firstChannel=input[0];let sum=0;let rms;for(let i=0;i<firstChannel.length;++i){sum+=firstChannel[i]*firstChannel[i]}rms=Math.sqrt(sum/firstChannel.length);this.volume=Math.max(rms,this.volume*0.95);this.tick-=firstChannel.length;if(this.tick<0){this.tick+=(this.intervalTime/1000)*sampleRate;this.port.postMessage({volume:this.volume})}}return true}}registerProcessor('volume-meter',VolumeMeter);"],{type:"application/javascript"}),Kk=!1,Qk=function(){function e(t){a(this,e),this.context_=t.context,this.addModuleToContext()}var t;return s(e,[{key:"addModuleToContext",value:(t=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.context_.audioWorklet.addModule(URL.createObjectURL(qk));case 3:Bf.info("worklet addModule success"),zp.emit(Mf),Kk=!0,e.next=12;break;case 8:e.prev=8,e.t0=e.catch(0),Bf.info("worklet addModule catch error. ".concat(e.t0.message)),zp.emit(Uf);case 12:case"end":return e.stop()}}),e,this,[[0,8]])}))),function(){return t.apply(this,arguments)})},{key:"initWorkletSuccess",get:function(){return Kk}}]),e}(),Xk=function(){function e(t){a(this,e);var n=t.track,r=t.log,i=t.stream;this.volume_=0,this.log_=r,this.track_=n,this.stream_=i,Jk||(window.AudioContext=window.AudioContext||window.webkitAudioContext||window.mozAudioContext,Jk=new window.AudioContext),this.audioCtx_=Jk,this.destination_=this.audioCtx_.destination;var o=new MediaStream;o.addTrack(this.track_),this.streamSource_=this.audioCtx_.createMediaStreamSource(o),this.audioWorkletNode_=null,this.scriptProcessorNode_=null,this.interval_=200,zp.on(Of,this.resume,this),zp.on(cf,this.handleAudioLevelInterval,this),Lh?(zp.on(Mf,this.initAudioWorklet,this),zp.on(Uf,this.initScriptProcessor,this),this.preload()):this.initScriptProcessor()}return s(e,[{key:"preload",value:function(){zk?zk.initWorkletSuccess&&this.initAudioWorklet():zk=new Qk({context:Jk})}},{key:"initAudioWorklet",value:function(){var e=this;if(!this.audioWorkletNode_)try{this.audioWorkletNode_=new AudioWorkletNode(this.audioCtx_,"volume-meter"),this.audioWorkletNode_.port.onmessage=function(t){e.volume_=t.data.volume.toFixed(2)||0},this.streamSource_.connect(this.audioWorkletNode_).connect(this.destination_),this.handleAudioLevelInterval({interval:this.interval_}),Ng.logSuccessEvent({userId:this.stream_.getUserId(),eventType:Nl})}catch(JI){Ng.logFailedEvent({userId:this.stream_.getUserId(),eventType:Nl}),this.initScriptProcessor()}}},{key:"initScriptProcessor",value:function(){var e=this;if(!this.scriptProcessorNode_)try{this.scriptProcessorNode_=this.audioCtx_.createScriptProcessor(2048,1,1),this.scriptProcessorNode_.onaudioprocess=function(t){for(var n=t.inputBuffer.getChannelData(0),r=0,i=0;i<n.length;++i)r+=n[i]*n[i];e.volume_=Math.sqrt(r/n.length).toFixed(2)||0},this.streamSource_.connect(this.scriptProcessorNode_).connect(this.destination_)}catch(JI){this.log_.error("volumeMeter init script processor error: "+JI)}}},{key:"destroy",value:function(){this.streamSource_&&this.streamSource_.disconnect(),this.scriptProcessorNode_&&this.scriptProcessorNode_.disconnect(),this.audioWorkletNode_&&(this.audioWorkletNode_.port.postMessage({name:"stop"}),this.audioWorkletNode_.disconnect()),this.audioWorkletNode_=null,this.scriptProcessorNode_=null,this.audioCtx_=null,zp.off(Of,this.resume,this),zp.off(cf,this.handleAudioLevelInterval,this),zp.off(Mf,this.initAudioWorklet,this),zp.off(Uf,this.initScriptProcessor,this)}},{key:"resume",value:function(){this.audioCtx_&&this.audioCtx_.resume()}},{key:"getCalculatedVolume",value:function(){return this.volume_}},{key:"handleAudioLevelInterval",value:function(e){var t=e.interval;this.interval_=t,this.audioWorkletNode_&&this.audioWorkletNode_.port.postMessage({name:"setIntervalTime",intervalTime:t})}}]),e}(),$k=function(){function e(t){a(this,e),this.stream_=t.stream,this.userId_=t.stream.getUserId(),this.log_=this.stream_.getLogger(),this.track_=t.track,this.div_=t.div,this.muted_=t.muted,this.outputDeviceId_=t.outputDeviceId,this.volume_=t.volume,this.emitter_=new Jp,this.initializeElement(),this.state_="NONE",this.volumeMeter_=new Xk({stream:this.stream_,track:this.track_,log:this.log_})}var t,n,r,o;return s(e,[{key:"isPlaying",get:function(){return"PLAYING"===this.state_}},{key:"initializeElement",value:function(){if(this.isAudioElementInit()){var e=new MediaStream;e.addTrack(this.track_);var t=document.createElement(dd);t.srcObject=e,t.muted=this.muted_,t.setAttribute("id","audio_".concat(this.stream_.getId())),t.setAttribute("autoplay","autoplay"),t.setAttribute("playsinline","playsinline"),this.div_.appendChild(t),this.element_=t}this.handleEvents()}},{key:"setMuted",value:function(e){this.element_&&(this.element_.muted=e,this.muted_=e)}},{key:"play",value:(o=i(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.outputDeviceId_||!this.element_){e.next=3;break}return e.next=3,this.element_.setSinkId(this.outputDeviceId_);case 3:if(this.setVolume(this.volume_),e.prev=4,!this.element_){e.next=8;break}return e.next=8,this.element_.play();case 8:e.next=16;break;case 10:if(e.prev=10,e.t0=e.catch(4),this.log_.warn("<audio> play() error: "+e.t0),!(t=e.t0.toString()+" <audio>").startsWith("NotAllowedError")){e.next=16;break}throw new Wm({code:zm.PLAY_NOT_ALLOWED,message:t});case 16:case"end":return e.stop()}}),e,this,[[4,10]])}))),function(){return o.apply(this,arguments)})},{key:"handleEvents",value:function(){this.handleElementEvent=this.handleElementEvent.bind(this),this.handleTrackEvent=this.handleTrackEvent.bind(this),this.element_&&(this.element_.addEventListener(gd,this.handleElementEvent),this.element_.addEventListener(vd,this.handleElementEvent),this.element_.addEventListener(yd,this.handleElementEvent),this.element_.addEventListener(Sd,this.handleElementEvent)),this.track_.addEventListener(vd,this.handleTrackEvent),this.track_.addEventListener(md,this.handleTrackEvent),this.track_.addEventListener(_d,this.handleTrackEvent),this.track_.readyState===vd&&this.handleTrackEvent({type:vd}),this.track_.muted&&this.handleTrackEvent({type:md})}},{key:"handleElementEvent",value:(r=i(regeneratorRuntime.mark((function e(t){var n,r,i,a,o,s=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=t.type,e.t0=n,e.next=e.t0===gd?4:e.t0===vd?9:e.t0===yd?12:e.t0===Sd?16:27;break;case 4:return this.log_.info("stream - audio player is starting playing"),this.state_="PLAYING",zp.emit(hf,{stream:this.stream_}),this.emitter_.emit($y,{state:this.state_,reason:gd}),e.abrupt("break",27);case 9:return this.log_.info("stream - audio player is ended"),"STOPPED"!==this.state_&&(this.state_="STOPPED",this.emitter_.emit($y,{state:this.state_,reason:vd})),e.abrupt("break",27);case 12:return this.log_.info("stream - audio player is paused"),this.state_="PAUSED",this.emitter_.emit($y,{state:this.state_,reason:yd}),e.abrupt("break",27);case 16:if(!this.element_||!this.element_.error){e.next=26;break}return r="".concat(yy(),"/").concat(sd().name,"/").concat(sd().version),e.next=20,GI.getSpeakers();case 20:i=e.sent,a=i[0].label,(o=i.find((function(e){return e.deviceId===s.outputDeviceId_})))&&(a=o.label),this.log_.error("stream - audio player error observed. code: ".concat(this.element_.error.code," message: ").concat(this.element_.error.message," deviceInfo: ").concat(r," speaker: ").concat(a)),Ng.uploadEvent("stat-".concat(this.stream_.getType(),"-audio-").concat(Pl,"-").concat(this.element_.error.code,"-").concat(r,"-").concat(a),this.element_.error);case 26:return e.abrupt("break",27);case 27:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"handleTrackEvent",value:function(e){var t=e.type;switch(t){case vd:this.log_.info("stream - audio player track is ended"),"STOPPED"!==this.state_&&(this.state_="STOPPED",this.emitter_.emit($y,{state:this.state_,reason:vd})),zp.emit(Pf,{stream:this.stream_,type:t});break;case md:this.log_.info("stream - audio track is unable to provide media output"),this.stream_.isRemote()||Nh(),"PAUSED"!==this.state_&&(this.state_="PAUSED",this.emitter_.emit($y,{state:this.state_,reason:md})),zp.emit(xf,{stream:this.stream_,type:t});break;case _d:this.log_.info("stream - audio track is able to provide media output"),"PAUSED"===this.state_&&(this.state_="PLAYING",this.emitter_.emit($y,{state:this.state_,reason:_d}))}}},{key:"unbindEvents",value:function(){this.element_&&(this.element_.removeEventListener(gd,this.handleElementEvent),this.element_.removeEventListener(vd,this.handleElementEvent),this.element_.removeEventListener(yd,this.handleElementEvent),this.element_.removeEventListener(Sd,this.handleElementEvent)),this.track_&&(this.track_.removeEventListener(vd,this.handleTrackEvent),this.track_.removeEventListener(md,this.handleTrackEvent),this.track_.removeEventListener(_d,this.handleTrackEvent))}},{key:"setSinkId",value:(n=i(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.outputDeviceId_===t){e.next=5;break}if(!this.element_){e.next=4;break}return e.next=4,this.element_.setSinkId(t);case 4:this.outputDeviceId_=t;case 5:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"setVolume",value:function(e){this.element_&&(this.log_.info("stream - audioElement setVolume to : ".concat(e)),this.element_.volume=e)}},{key:"getAudioLevel",value:function(){return this.volumeMeter_.getCalculatedVolume()}},{key:"stop",value:function(){this.unbindEvents(),this.element_&&(this.div_.removeChild(this.element_),this.element_.srcObject=null,this.element_=null),this.volumeMeter_&&(this.volumeMeter_.destroy(),this.volumeMeter_=null)}},{key:"resume",value:(t=i(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,this.volumeMeter_&&this.volumeMeter_.resume(),!this.element_){e.next=5;break}return e.next=5,this.element_.play();case 5:e.next=13;break;case 7:if(e.prev=7,e.t0=e.catch(0),this.log_.warn("<audio> play() error: "+e.t0),!(t=Dg({key:Y_,data:{error:e.t0}})).startsWith("NotAllowedError")){e.next=13;break}throw new Wm({code:zm.PLAY_NOT_ALLOWED,message:t});case 13:case"end":return e.stop()}}),e,this,[[0,7]])}))),function(){return t.apply(this,arguments)})},{key:"on",value:function(e,t){this.emitter_.on(e,t)}},{key:"isAudioElementInit",value:function(){return!("15.2"===nd||"15.3"===nd||"15.4"===nd)||"local"!==this.stream_.getType()||!this.muted_||(this.log_.info("audioElement is muted."),!1)}}]),e}(),Yk=Xe.PROPER,Zk=Xo.trim;Rt({target:"String",proto:!0,forced:(Wk="trim",x((function(){return!!zo[Wk]()||"​…᠎"!=="​…᠎"[Wk]()||Yk&&zo[Wk].name!==Wk})))},{trim:function(){return Zk(this)}});var eb="".concat("trtc_autoplay","_mask"),tb="".concat("trtc_autoplay","_wrapper"),nb="".concat("trtc_autoplay","_header"),rb="".concat("trtc_autoplay","_content"),ib="".concat("trtc_autoplay","_action_wrapper"),ab="".concat("trtc_autoplay","_question"),ob="".concat("trtc_autoplay","_collapse"),sb="".concat("trtc_autoplay","_action_confirm"),cb="".concat("trtc_autoplay","_detail"),ub="".concat("dialog","-show"),db="".concat("dialog","-1"),lb="".concat("dialog","-2"),hb=!1,pb=function(){return!!document.querySelector(".".concat(tb))},fb="".concat(ch,"/").concat(Dh()?"zh-cn":"en","/tutorial-21-advanced-auto-play-policy.html"),mb="<br><a href='".concat(fb,"' target='_blank'>").concat(Dh()?"其他方案?":"Any other solution?","</a>"),_b="".concat(Dh()?"浏览器自动播放策略:在用户与页面产生交互(点击、触摸)之前,浏览器禁止播放有声媒体。该弹窗用于帮助用户恢复音视频播放。".concat(mb):"Autoplay Policy: Before user interacts with the web page (clicking, touching), page will not be allowed to play media with sound. This Dialog is used to help users resume playback. ".concat(mb)),vb=function(){function e(){if(a(this,e),this.dialogNode_=null,this.bodyPosition_="",this.content="音视频播放被浏览器拦截,请点击“恢复播放”。",Dh()||(this.content='Media playback failed. Click the "Resume" to resume playback.'),!hb){var t=document.createElement("style");t.innerHTML=".".concat(eb,"{position:fixed;top:0;left:0;right:0;bottom:0;width:100vw;height:100vh;display:flex;justify-content:center;align-items:center;background:rgba(0,0,0,0.5);z-index:1500;}.").concat(eb," div:not(.").concat(ib,"){display:block !important;}.").concat(tb,"{padding:14px;background:#fff;border-radius:3px;box-shadow:0px 3px 15px #434343;border:1px solid #d1cfcf;max-width:500px;}.").concat(tb," a{color:").concat("#2473E8",";}.").concat(nb,"{overflow:hidden;text-overflow:ellipsis;font-size:16px;font-weight:600;}.").concat(rb,"{margin:8px 0;}.").concat(ib,"{width:100%;display:flex !important;align-items:center;justify-content:right;float:right;}.").concat(ob,"{margin-right:auto;cursor:pointer}.").concat(ab,"{height:100%;line-height:16px;cursor:pointer;}.").concat(sb,"{margin-left:8px;color:#fff;background:").concat("#2473E8",";padding:4px 12px;outline:none;border:1px solid;border-radius:3px;font-weight:bold;}.").concat(sb,":hover{opacity:0.9;}.").concat(ob,",.").concat(sb,",.").concat(rb,",.").concat(ab,"{font-size:14px;}@media screen and (max-width:750px){.").concat(tb,"{width:80vw;}}"),document.head.appendChild(t),hb=!0}this.showDetail_=!1,this.isCollapseClicked_=!1,this.isQuestionClicked_=!1,this.addDiaLog()}return s(e,[{key:"createDiaLog",value:function(){var e=document.createElement("template");e.innerHTML='<div class="'.concat(eb,"\"><div class='").concat(tb,"'><div class='").concat(nb,"'>").concat(location.host,"</div><div class='").concat(rb,"'>").concat(this.content,"</div><div class='").concat(cb,'\' style="visibility:hidden;width:100%;height:0;font-size:12px;color:gray;">').concat(_b,"</div><div class='").concat(ib,"'></div></div></div>").trim();var t=document.createElement("button");t.className=sb,t.innerText=Dh()?"恢复播放":"Resume",t.onclick=this.onConfirm.bind(this);var n=document.createElement("div");n.className=ab,n.innerHTML='<?xml version="1.0" encoding="UTF-8"?>\n <svg class="icon" width="18" height="18" p-id="2030" t="1639646523624" version="1.1" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">\n <path d="m464 784.35c0 26.51 21.49 48 48 48s48-21.49 48-48-21.49-48-48-48-48 21.49-48 48z" p-id="2031"/>\n <path d="m512 960c-247.04 0-448-200.96-448-448s200.96-448 448-448 448 200.96 448 448-200.96 448-448 448zm0-831.71c-211.58 0-383.71 172.13-383.71 383.71 0 211.55 172.13 383.71 383.71 383.71 211.55 0 383.71-172.16 383.71-383.71 0-211.58-172.16-383.71-383.71-383.71z" p-id="2032"/>\n <path d="m512 673.7c-17.665 0-32.001-14.336-32.001-31.999v-54.112c0-52.353 40-92.352 75.328-127.65 25.887-25.92 52.672-52.672 52.672-74.017 0-53.343-43.072-96.735-95.999-96.735-53.823 0-95.999 41.536-95.999 94.559 0 17.665-14.336 31.999-32.001 31.999s-32.001-14.336-32.001-31.999c0-87.424 71.775-158.56 160-158.56s160 72.095 160 160.74c0 47.904-36.32 84.192-71.424 119.3-27.84 27.776-56.576 56.512-56.576 82.336v54.112c0 17.665-14.336 32.032-32.001 32.032z" p-id="2033"/>\n </svg>\n ',n.onclick=this.onQuestionClick.bind(this);var r=document.createElement("div");r.className=ob,r.innerText="".concat(Dh()?"详情 >":"Detail >"),r.onclick=this.onCollapseClick.bind(this);var i=e.content.firstChild,a=i.querySelector(".".concat(ib));return a.appendChild(r),a.appendChild(n),a.appendChild(t),i}},{key:"addDiaLog",value:function(){pb()||(this.dialogNode_=this.createDiaLog(),document.body.appendChild(this.dialogNode_),this.dialogNode_.onclick=this.onConfirm.bind(this),this.dialogNode_.querySelector(".".concat(tb)).onclick=function(e){return e.stopPropagation()},this.bodyPosition_=document.body.style.position,document.body.style.position="fixed",Bf.warn("show autoplay dialog"),Ng.uploadEvent({log:ub}))}},{key:"deleteDiaLog",value:function(){this.dialogNode_&&(document.body.removeChild(this.dialogNode_),document.body.style.position=this.bodyPosition_,this.dialogNode_=null)}},{key:"onConfirm",value:function(){Bf.warn("confirm clicked, try resume stream"),zp.emit(Of),this.deleteDiaLog()}},{key:"onCollapseClick",value:function(){var e=this.dialogNode_.querySelector(".".concat(cb));e.style.visibility="".concat(this.showDetail_?"hidden":"visible"),e.style.height="".concat(this.showDetail_?0:"fit-content"),this.showDetail_=!this.showDetail_,this.isCollapseClicked_||Ng.uploadEvent({log:db}),this.isCollapseClicked_=!0}},{key:"onQuestionClick",value:function(){window.open(fb,"_blank"),this.isQuestionClicked_||Ng.uploadEvent({log:lb}),this.isQuestionClicked_=!0}}]),e}(),gb=function(){function e(t){a(this,e),this.stream_=t.stream,this.userId_=t.stream.getUserId(),this.log_=this.stream_.getLogger(),this.track_=t.track,this.div_=t.div,this.muted_=t.muted,this.objectFit_=t.objectFit,this.mirror_=t.mirror,this.emitter_=new Jp,this.initializeElement(),this.state_="NONE",this.pausedRetryCount_=5}var t,n;return s(e,[{key:"isPlaying",get:function(){return"PLAYING"===this.state_}},{key:"initializeElement",value:function(){var e=new MediaStream;e.addTrack(this.track_);var t=document.createElement(ld);t.srcObject=e,t.muted=!0;var n="width: 100%; height: 100%; object-fit: ".concat(this.objectFit_,";");this.mirror_&&(n+="transform: rotateY(180deg);"),t.setAttribute("id","video_".concat(this.stream_.getId())),t.setAttribute("style",n),t.setAttribute("autoplay","autoplay"),t.setAttribute("playsinline","playsinline"),this.div_&&this.div_.appendChild(t),this.element_=t,this.handleEvents()}},{key:"setRect",value:function(e){var t=e.width,n=e.height;this.element_&&(this.element_.style.width=t+"px",this.element_.style.height=n+"px")}},{key:"setMirror",value:function(e){this.element_&&(this.element_.style.transform=e?"rotateY(180deg)":"",this.mirror_=e)}},{key:"setObjectFit",value:function(e){this.element_&&(this.element_.style.objectFit="".concat(e),this.objectFit_=e)}},{key:"play",value:(n=i(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.element_.play();case 3:e.next=11;break;case 5:if(e.prev=5,e.t0=e.catch(0),this.log_.warn("<video> play() error: "+e.t0),!(t=e.t0.toString()+" <video>").startsWith("NotAllowedError")){e.next=11;break}throw new Wm({code:zm.PLAY_NOT_ALLOWED,message:t});case 11:case"end":return e.stop()}}),e,this,[[0,5]])}))),function(){return n.apply(this,arguments)})},{key:"handleEvents",value:function(){this.handleElementEvent=this.handleElementEvent.bind(this),this.handleTrackEvent=this.handleTrackEvent.bind(this),this.element_.addEventListener(gd,this.handleElementEvent),this.element_.addEventListener(vd,this.handleElementEvent),this.element_.addEventListener(yd,this.handleElementEvent),this.element_.addEventListener(Sd,this.handleElementEvent),this.element_.addEventListener(kd,this.handleElementEvent),this.track_.addEventListener(vd,this.handleTrackEvent),this.track_.addEventListener(md,this.handleTrackEvent),this.track_.addEventListener(_d,this.handleTrackEvent),this.track_.readyState===vd&&this.handleTrackEvent({type:vd}),this.track_.muted&&this.handleTrackEvent({type:md})}},{key:"handleElementEvent",value:function(e){switch(e.type){case gd:this.log_.info("stream - video player is starting playing"),this.state_="PLAYING",zp.emit(lf,{stream:this.stream_}),this.emitter_.emit($y,{state:this.state_,reason:gd});break;case vd:this.log_.info("stream - video player is ended"),"STOPPED"!==this.state_&&(this.state_="STOPPED",this.emitter_.emit($y,{state:this.state_,reason:vd}));break;case yd:this.log_.info("stream - video player is paused"),this.div_&&!document.getElementById(this.div_.id)&&this.log_.warn("video container is not in DOM"),this.state_="PAUSED",this.emitter_.emit($y,{state:this.state_,reason:yd}),this.pausedRetryCount_>0&&!pb()&&(this.log_.info("auto resume when video paused"),this.resume(),this.pausedRetryCount_--);break;case Sd:if(this.element_&&this.element_.error){var t="".concat(yy(),"/").concat(sd().name,"/").concat(sd().version);this.log_.error("stream - video player error observed. code: ".concat(this.element_.error.code," message: ").concat(this.element_.error.message," deviceInfo: ").concat(t)),Ng.uploadEvent("stat-".concat(this.stream_.getType(),"-video-").concat(Pl,"-").concat(this.element_.error.code,"-").concat(t),this.element_.error)}break;case kd:zp.emit(Ef,{stream:this.stream_})}}},{key:"handleTrackEvent",value:function(e){var t=e.type;switch(t){case vd:this.log_.info("stream - video player track is ended"),zp.emit(Af,{stream:this.stream_,type:t}),"STOPPED"!==this.state_&&(this.state_="STOPPED",this.emitter_.emit($y,{state:this.state_,reason:vd}));break;case md:this.log_.info("stream - video track is unable to provide media output"),this.stream_.isRemote()||Nh(),zp.emit(Tf,{stream:this.stream_,type:t}),"PAUSED"!==this.state_&&(this.state_="PAUSED",this.emitter_.emit($y,{state:this.state_,reason:md}));break;case _d:this.log_.info("stream - video track is able to provide media output"),zp.emit(Rf,{stream:this.stream_}),"PAUSED"===this.state_&&(this.state_="PLAYING",this.emitter_.emit($y,{state:this.state_,reason:_d}))}}},{key:"unbindEvents",value:function(){this.element_&&(this.element_.removeEventListener(gd,this.handleElementEvent),this.element_.removeEventListener(vd,this.handleElementEvent),this.element_.removeEventListener(yd,this.handleElementEvent),this.element_.removeEventListener(Sd,this.handleElementEvent),this.element_.removeEventListener(kd,this.handleElementEvent)),this.track_&&(this.track_.removeEventListener(vd,this.handleTrackEvent),this.track_.removeEventListener(md,this.handleTrackEvent),this.track_.removeEventListener(_d,this.handleTrackEvent))}},{key:"stop",value:function(){this.unbindEvents(),this.div_&&this.div_.removeChild(this.element_),this.element_.srcObject=null,this.element_=null}},{key:"resume",value:(t=i(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.element_.play();case 3:e.next=11;break;case 5:if(e.prev=5,e.t0=e.catch(0),this.log_.warn("<video> play() error: "+e.t0),!(t=Dg({key:Z_,data:{error:e.t0}})).startsWith("NotAllowedError")){e.next=11;break}throw new Wm({code:zm.PLAY_NOT_ALLOWED,message:t});case 11:case"end":return e.stop()}}),e,this,[[0,5]])}))),function(){return t.apply(this,arguments)})},{key:"getVideoFrame",value:function(){var e=document.createElement("canvas");return e.width=this.element_.videoWidth,e.height=this.element_.videoHeight,e.getContext("2d").drawImage(this.element_,0,0),e.toDataURL("image/png")}},{key:"on",value:function(e,t){this.emitter_.on(e,t)}},{key:"getElement",value:function(){return this.element_?this.element_:null}}]),e}(),yb=function(){function e(t){a(this,e),this.userId_=t.userId,this.tinyId_=t.tinyId,this.client_=t.client,this.sdpSemantics_=t.client.getSdpSemantics(),this.isUplink_=t.isUplink,this.log_=Bf.createLogger({id:"n|"+this.userId_,userId:this.client_.getUserId(),sdkAppId:this.client_.getSDKAppId(),isLocal:this.isUplink_}),this.signalChannel_=t.signalChannel,this.peerConnection_=null,this.connectTimer_=-1,this.isErrorObserved_=!1,this.emitter_=new Jp,this.currentState_=Xd,this.waitForPeerConnectionConnectedPromise_=null,this.isReconnecting_=!1,this.reconnectionCount_=0,this.reconnectionTimer_=-1,this.isFirstConnection_=!0,this.delay_={audioDelay:0,videoDelay:0}}var t;return s(e,[{key:"initialize",value:function(){var e={iceServers:this.client_.getIceServers(),iceTransportPolicy:this.client_.getIceTransportPolicy(),sdpSemantics:this.sdpSemantics_,bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",tcpCandidatePolicy:"disable",IceTransportsType:"nohost"};this.peerConnection_=new RTCPeerConnection(e),this.peerConnection_.onconnectionstatechange=this.onConnectionStateChange.bind(this)}},{key:"close",value:function(){this.log_.info("closing connection"),this.closePeerConnection()}},{key:"closePeerConnection",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.peerConnection_&&(this.peerConnection_.onconnectionstatechange=function(){},this.peerConnection_.close(),this.peerConnection_=null,e&&this.emitConnectionStateChangedEvent(Xd))}},{key:"getDTLSTransportState",value:function(){if(!this.peerConnection_)return"unknown";var e=null;if(this.isUplink_){if(!ly()||0===this.peerConnection_.getSenders().length)return"unknown";e=this.peerConnection_.getSenders()[0].transport}else{if(!dy()||0===this.peerConnection_.getReceivers().length)return"unknown";e=this.peerConnection_.getReceivers()[0].transport}return e?e.state:"unknown"}},{key:"onConnectionStateChange",value:function(e){var t=this.peerConnection_.iceConnectionState,n=this.getDTLSTransportState();if(this.log_.info("onConnectionStateChange() connectionState: "+e.target.connectionState),this.log_.info("ICE Transport state: ".concat(t,", DTLS Transport state: ").concat(n)),e.target.connectionState===tl&&this.emitConnectionStateChangedEvent($d),e.target.connectionState===nl||e.target.connectionState===rl){var r="".concat(this.isUplink_?"uplink":"downlink"," ICE/DTLS Transport connection ").concat(e.target.connectionState,". ICE Transport state: ").concat(t,", DTLS Transport state: ").concat(n),i=new Wm({message:r,code:zm.ICE_TRANSPORT_ERROR});Ng.logFailedEvent({userId:this.client_.getUserId(),eventType:Il,error:i}),this.emitConnectionStateChangedEvent(Xd),this.isErrorObserved_||this.emitter_.emit(xy,i)}e.target.connectionState!==al&&e.target.connectionState!==ol||(this.logSelectedCandidate(),Ng.logSuccessEvent({userId:this.client_.getUserId(),eventType:Il}),this.emitConnectionStateChangedEvent(Zd))}},{key:"emitConnectionStateChangedEvent",value:function(e){e!==this.currentState_&&(this.currentState_===Yd&&e===$d||(zp.emit(Df,{client:this.client_,connection:this,prevState:this.currentState_,state:e}),this.emitter_.emit(Py,{prevState:this.currentState_,state:e}),this.currentState_=e))}},{key:"hitTest",value:function(e){return(0===e||"0"===e)&&this.isUplink_||e===this.tinyId_}},{key:"addEventInternal",value:function(e,t){var n=this.client_.getUserId(),r={eventId:e,eventDesc:t,timestamp:go(),userId:n,tinyId:this.client_.getTinyId()};this.isUplink_||(r.remoteUserId=this.userId_,r.remoteTinyId=this.tinyId_),x_(n,r)}},{key:"getPeerConnection",value:function(){return this.peerConnection_}},{key:"getClient",value:function(){return this.client_}},{key:"getUserId",value:function(){return this.userId_}},{key:"getTinyId",value:function(){return this.tinyId_}},{key:"logSelectedCandidate",value:(t=i(regeneratorRuntime.mark((function e(){var t,n,r,i,a,o,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.peerConnection_){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,this.peerConnection_.getStats();case 4:t=e.sent,n=b(t),e.prev=6,n.s();case 8:if((r=n.n()).done){e.next=18;break}if((i=g(r.value,2))[0],a=i[1],!vy(a)){e.next=16;break}return o=t.get(a.localCandidateId),s=t.get(a.remoteCandidateId),o&&this.log_.info("local candidate: ".concat(o.candidateType," ").concat(o.protocol,":").concat(o.ip||o.address,":").concat(o.port," ").concat(o.networkType||""," ").concat("relay"===o.candidateType?"relayProtocol:"+o.relayProtocol:"")),s&&this.log_.info("remote candidate: ".concat(s.candidateType," ").concat(s.protocol,":").concat(s.ip||s.address,":").concat(s.port)),e.abrupt("break",18);case 16:e.next=8;break;case 18:e.next=23;break;case 20:e.prev=20,e.t0=e.catch(6),n.e(e.t0);case 23:return e.prev=23,n.f(),e.finish(23);case 26:case"end":return e.stop()}}),e,this,[[6,20,23,26]])}))),function(){return t.apply(this,arguments)})},{key:"getCurrentState",value:function(){return this.currentState_}},{key:"waitForPeerConnectionConnected",value:function(){var e=this;return this.waitForPeerConnectionConnectedPromise_||(this.waitForPeerConnectionConnectedPromise_=new Promise((function(t,n){if(e.currentState_===Zd)return t();var r=-1,i=function n(i){i.state===Zd&&(clearTimeout(r),e.emitter_.off(Py,n,e),t())};r=setTimeout((function(){e.emitter_.off(Py,i,e);var t=new Wm({code:zm.API_CALL_TIMEOUT,message:"connection timeout"});e.peerConnection_||e.isUplink_||(t=e.genRemoteStreamNotExistError()),n(t)}),1e4),e.emitter_.on(Py,i,e)})),this.waitForPeerConnectionConnectedPromise_=this.waitForPeerConnectionConnectedPromise_.then((function(t){return e.waitForPeerConnectionConnectedPromise_=null,t})).catch((function(t){throw e.waitForPeerConnectionConnectedPromise_=null,t}))),this.waitForPeerConnectionConnectedPromise_}},{key:"getReconnectionCount",value:function(){return this.reconnectionCount_}},{key:"startReconnection",value:function(){this.isReconnecting_=!0,this.emitConnectionStateChangedEvent(Yd),this.reconnect(),this.addEventInternal(this.isUplink_?k_:T_,"".concat(this.isUplink_?"uplink":"downlink","-connection is reconnecting"))}},{key:"stopReconnection",value:function(){this.log_.info("stop reconnection"),this.isReconnecting_=!1,this.reconnectionCount_=0,this.clearReconnectionTimer(),this.signalChannel_.off(gm,this.reconnect,this)}},{key:"on",value:function(e,t,n){this.emitter_.on(e,t,n)}},{key:"off",value:function(e,t,n){this.emitter_.off(e,t,n)}},{key:"genRemoteStreamNotExistError",value:function(){return new Wm({code:zm.REMOTE_STREAM_NOT_EXIST,message:"because the remote user ".concat(this.userId_," unpublished stream")})}},{key:"setDelay",value:function(e){var t=e.audioDelay,n=e.videoDelay;this.delay_={audioDelay:t,videoDelay:n}}},{key:"getDelay",value:function(){return this.delay_}}]),e}();function Sb(e,t,n,r){if(this.useStringRoomId_){if(!(kh(e)&&/^[A-Za-z\d\s!#$%&()+\-:;<=.>?@[\]^_{}|~,]{1,64}$/.test(e)))throw new Wm({code:zm.INVALID_PARAMETER,message:Dg({key:sv,data:t,link:{className:r,fnName:n}})})}else if(!(bh(e)&&/^[1-9]\d*$/.test(String(e))&&e<4294967295))throw new Wm({code:zm.INVALID_PARAMETER,message:Dg({key:cv,data:t,link:{className:r,fnName:n}})})}function kb(e,t,n,r){if(!/^[A-Za-z\d_-]*$/.test(e))throw new Wm({code:zm.INVALID_PARAMETER,message:Dg({key:Cv,data:t,link:{className:r,fnName:n}})})}var bb,Ib,Tb={TRTC:{createClient:{name:"clientConfig",required:!0,type:Gl,properties:{sdkAppId:{required:!0,type:jl,allowEmpty:!1},userId:{required:!0,type:Fl,allowEmpty:!1},userSig:{required:!0,type:Fl,allowEmpty:!1},mode:{required:!0,type:Fl,values:["rtc","live"]},useStringRoomId:{type:Bl},autoSubscribe:{type:Bl},enableAutoPlayDialog:{type:Bl},streamId:{type:Fl},userDefineRecordId:{type:Fl},pureAudioPushMode:{type:jl,values:[1,2]}}},createStream:{name:"streamConfig",required:!0,type:Gl,properties:{userId:{type:Fl},audio:{type:Bl},video:{type:Bl},screen:{type:Bl},screenAudio:{type:Bl},microphoneId:{type:Fl},cameraId:{type:Fl},facingMode:{type:Fl,values:[pd,fd]},audioSource:{instanceOf:MediaStreamTrack},videoSource:{instanceOf:MediaStreamTrack}},validate:function(e){if(!Sh(e.screen)&&e.screen&&Sh(e.audio)&&(e.audio=!1),!(Sh(e.audio)&&Sh(e.video)||Sh(e.audioSource)&&Sh(e.videoSource)))throw new Wm({code:zm.INVALID_PARAMETER,message:Dg({key:mg})});if(!Sh(e.screen)&&!0===e.screen&&!0===e.video)throw new Wm({code:zm.INVALID_PARAMETER,message:Dg({key:_g})});if(e.audio&&e.screenAudio)throw new Wm({code:zm.INVALID_PARAMETER,message:Dg({key:vg})});if(!0!==e.screen&&!0===e.screenAudio)throw new Wm({code:zm.INVALID_PARAMETER,message:Dg({key:gg})});if(!Sh(e.screen)&&!0===e.screen&&!this.isScreenShareSupported())throw new Wm({code:zm.INVALID_OPERATION,message:Dg({key:Rg})})}}},CLIENT:{join:{name:"options",required:!0,properties:{roomId:{required:!0,type:[jl,Fl],allowEmpty:!1,validate:Sb},role:{type:[Fl],values:["anchor","audience"]}}},publish:{name:"stream",required:!0,instanceOf:nh,validate:function(e){if(!this.isJoined_)throw new Wm({code:zm.INVALID_OPERATION,message:Dg({key:fv})});if("live"===this.mode_&&"audience"===this.role_)throw new Wm({code:zm.INVALID_OPERATION,message:Dg({key:_v})});if(this.localStream_)throw new Wm({code:zm.INVALID_OPERATION,message:Dg({key:gv})});if(!e.getIsReadyToPublish())throw new Wm({code:zm.INVALID_OPERATION,message:Dg({key:vv})});if(this.notPublishWithoutH264Supported_)throw new Wm({code:zm.NOT_SUPPORTED_H264,message:Dg({key:bg})})}},unpublish:{name:"stream",required:!0,instanceOf:nh,validate:function(e){if(e!==this.localStream_)throw new Wm({code:zm.INVALID_PARAMETER,message:Dg({key:mv})})}},subscribe:[{name:"stream",required:!0,instanceOf:rh,validate:function(e){if(!e.getConnection())throw new Wm({code:zm.INVALID_OPERATION,message:Dg({key:yv})});if(this.notSubscribeWithoutH264Supported_)throw new Wm({code:zm.NOT_SUPPORTED_H264,message:Dg({key:Ig})})}},{name:"options",type:Gl,properties:{audio:{type:Bl},video:{type:Bl}}}],unsubscribe:{name:"stream",required:!0,instanceOf:rh,validate:function(e){if(!e.getConnection())throw new Wm({code:zm.INVALID_OPERATION,message:Dg({key:yv})})}},switchRole:{name:"role",required:!0,values:["anchor","audience"],validate:function(){if("live"!==this.mode_)throw new Wm({code:zm.INVALID_PARAMETER,message:Dg({key:kv})});if(!this.isJoined_)throw new Wm({code:zm.INVALID_OPERATION,message:Dg({key:bv})})}},startPublishCDNStream:{name:"options",required:!1,properties:{streamId:{type:Fl,validate:kb},appId:{type:jl,allowEmpty:!1},bizId:{type:jl,allowEmpty:!1},url:{type:Fl,allowEmpty:!1}}},startMixTranscode:{name:"config",required:!0,type:Gl,properties:{mode:{type:Fl,values:["preset-layout","manual"]},streamId:{type:Fl,validate:kb},videoWidth:{type:jl,notLessThanZero:!0},videoHeight:{type:jl,notLessThanZero:!0},videoBitrate:{type:jl,notLessThanZero:!0,allowEmpty:!1},videoFramerate:{type:jl,validate:function(e,t,n,r){if(e<=0||e>30)throw new Wm({code:zm.INVALID_PARAMETER,message:Dg({key:sg,link:{className:r,fnName:n}})})}},videoGop:{type:jl,validate:function(e,t,n,r){if(e<1||e>8)throw new Wm({code:zm.INVALID_PARAMETER,message:Dg({key:cg,link:{className:r,fnName:n}})})}},audioSampleRate:{type:jl,notLessThanZero:!0},audioBitrate:{type:jl,validate:function(e,t,n,r){if(e<32||e>192)throw new Wm({code:zm.INVALID_PARAMETER,message:Dg({key:ug,link:{className:r,fnName:n}})})}},audioChannels:{type:jl,values:[1,2]},backgroundColor:{type:jl},backgroundImage:{type:Fl},mixUsers:{required:!0,type:Hl,arrayItem:{require:!0,type:Gl,properties:{userId:{required:!0,type:Fl},roomId:{type:[Fl,jl],validate:Sb},pureAudio:{type:Bl},width:{type:jl,notLessThanZero:!0},height:{type:jl,notLessThanZero:!0},locationX:{type:jl,notLessThanZero:!0},locationY:{type:jl,notLessThanZero:!0},zOrder:{type:jl},streamType:{type:Fl,values:["main","auxiliary"]}}}}},validate:function(e,t,n,r,i){var a=0,o=0,s=e.mixUsers,c=[];if(s.forEach((function(e,t){if(c.push(e.userId),!e.pureAudio){if(!e.zOrder||e.zOrder<1||e>15)throw new Wm({code:zm.INVALID_PARAMETER,message:Dg({key:dg,data:"config.mixUsers[".concat(t,"].zOrder"),link:{className:r,fnName:n}})});e.width+e.locationX>a&&(a=e.width+e.locationX),e.height+e.locationY>o&&(o=e.height+e.locationY)}})),c.indexOf(this.getUserId())<0)throw new Wm({code:zm.INVALID_PARAMETER,message:Dg({key:lg,link:{className:r,fnName:n}})});if(e.videoWidth<a||e.videoHeight<o)throw new Wm({code:zm.INVALID_PARAMETER,message:Dg({key:hg,link:{className:r,fnName:n}})})}}},LOCAL_STREAM:{switchDevice:[{name:"type",required:!0,type:Fl,values:[dd,ld]},{name:"deviceId",required:!0,type:Fl,validate:function(){if(this.screen_&&!this.audio_||this.audioSource_||this.videoSource_)throw new Wm({code:zm.INVALID_OPERATION,message:Dg({key:Bv})});if(this.publishState_===Kl)throw new Wm({code:zm.INVALID_OPERATION,message:Dg({key:Hv})})}}]},STREAM:{play:[{name:"elementId",required:!0,type:[Fl,"HTMLDivElement"],validate:function(e,t,n){if(kh(e)){var r=document.getElementById(e);if(!r)throw new Wm({code:zm.INVALID_PARAMETER,message:Dg({key:pg,data:{key:t,fnName:n}})});if(!(r instanceof HTMLDivElement))throw new Wm({code:zm.INVALID_PARAMETER,message:Dg({key:fg,data:{key:t,fnName:n,type:wh(r)}})})}}},{name:"options",type:Gl,properties:{objectFit:{type:Fl,values:["contain","cover","fill"]},muted:{type:Bl},mirror:{type:Bl}}}]}};function Rb(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e,n,r){var i=r.value;return r.value=function(){for(var e=arguments.length,r=new Array(e),a=0;a<e;a++)r[a]=arguments[a];return Eb.call(this,t,r,n,this.name_),i.apply(this,r)},r}}function wb(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e,n,r){var a=r.value;return r.value=i(regeneratorRuntime.mark((function e(){var r,i,o,s=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(r=s.length,i=new Array(r),o=0;o<r;o++)i[o]=s[o];return Eb.call(this,t,i,n,this.name_),e.abrupt("return",a.apply(this,i));case 3:case"end":return e.stop()}}),e,this)}))),r}}function Eb(e,t,n,r){try{for(var i=0;i<e.length;i++)Cb.call(this,{rule:e[i],value:t[i],key:e[i].name,fnName:n,className:r})}catch(JI){throw Bf.error(JI),JI}}function Cb(e){var t=this,n=e.rule,r=e.value,i=e.key,a=e.fnName,o=e.className;if(Sh(r)){if(n.required)throw new Wm({code:zm.INVALID_PARAMETER,message:Dg({key:V_,data:{key:i,rule:n,fnName:a,value:r},link:{className:o,fnName:a}})})}else{if(Array.isArray(n.type)){if(!n.type.map((function(e){return e.toLowerCase()})).includes(wh(r)))throw new Wm({code:zm.INVALID_PARAMETER,message:Dg({key:F_,data:{key:i,rule:n,fnName:a,value:r},link:{className:o,fnName:a}})})}else if(!Sh(n.type)&&wh(r)!==n.type)throw new Wm({code:zm.INVALID_PARAMETER,message:Dg({key:F_,data:{key:i,rule:n,fnName:a,value:r},link:{className:o,fnName:a}})});if(!1===n.allowEmpty){var s=bh(r)&&(0===r||Number.isNaN(r)),c=kh(r)&&""===r.trim();if(s||c)throw new Wm({code:zm.INVALID_PARAMETER,message:Dg({key:j_,data:{key:i,rule:n,fnName:a,value:r},link:{className:o,fnName:a}})})}if(n.notLessThanZero&&bh(r)&&r<0)throw new Wm({code:zm.INVALID_PARAMETER,message:Dg({key:og,data:{key:i,rule:n,fnName:a,value:r},link:{className:o,fnName:a}})});if(kh(n.instanceOf)){if(!r||r.name_!==n.instanceOf)throw new Wm({code:zm.INVALID_PARAMETER,message:Dg({key:B_,data:{key:i,rule:n,fnName:a,value:r},link:{className:o,fnName:a}})})}else if(yh(n.instanceOf)&&!(r instanceof n.instanceOf))throw new Wm({code:zm.INVALID_PARAMETER,message:Dg({key:B_,data:{key:i,rule:n,fnName:a,value:r},link:{className:o,fnName:a}})});if(n.values&&!n.values.includes(r))throw new Wm({code:zm.INVALID_PARAMETER,message:Dg({key:H_,data:{key:i,rule:n,fnName:a,value:r},link:{className:o,fnName:a}})});var u=n.properties;vh(u)&&"object"===wh(r)&&Object.keys(u).forEach((function(e){Cb.call(t,{rule:u[e],value:r&&r[e],key:"".concat(i,".").concat(e),fnName:a,className:o})}));var d=n.arrayItem;vh(d)&&Th(r)&&r.forEach((function(e,n){Cb.call(t,{rule:d,value:e,key:"".concat(i,"[").concat(n,"]"),fnName:a,className:o})})),yh(n.validate)&&n.validate.call(this,r,i,a,o,this)}}Rt({target:"Number",stat:!0},{isNaN:function(e){return e!=e}});var Ab=(bb=wb.apply(void 0,y(Tb.STREAM.play)),I((Ib=function(){function e(t){a(this,e),this.name_=ih,this.userId_=t.userId,this.isRemote_=t.isRemote,this.type_=t.type,this.log_=Bf.createLogger({id:"s".concat(t.seq?t.seq:"","|").concat(this.userId_),userId:Sh(t.client)?void 0:t.client.getUserId(),sdkAppId:Sh(t.client)?void 0:t.client.getSDKAppId(),isLocal:!this.isRemote_,type:this.isRemote_?this.type_:""}),this.client_=null,Sh(t.client)||(this.client_=t.client),this.mediaStream_=null,this.div_=null,this.isPlaying_=!1,this.connection_=null,this.audioPlayer_=null,this.videoPlayer_=null,this.muted_=!1,this.objectFit_="cover",this.mirror_=!1,this.id_=Xg(),this.audioOutputDeviceId_=0,this.audioVolume_=1,this.emitter_=new Jp,this.connectionState_=Xd,this.installEvents(),Sh(t.mirror)||this.log_.warn('TRTC.createStream "mirror" option was deprecated since v4.12.1,please use localStream.play to set up preview mirror. refer to '.concat(ch,"/en/LocalStream.html#play. TRTC.createStream 接口的 mirror 选项从 v4.12.1 开始被废弃,请使用 localStream.play 设置本地流预览镜像,参考文档:").concat(ch,"/zh-cn/LocalStream.html#play。"))}var n,r,o,c,u;return s(e,[{key:"installEvents",value:function(){zp.on(Of,this.restartPlayback,this)}},{key:"uninstallEvents",value:function(){zp.off(Of,this.restartPlayback,this)}},{key:"getType",value:function(){return this.type_}},{key:"getLogger",value:function(){return this.log_}},{key:"isSubscribed",get:function(){return this.type_===Kd&&this.connection_.isMainStreamSubscribed||this.type_===Qd&&this.connection_.isAuxStreamSubscribed}},{key:"isMainVideoSubscribed",get:function(){var e=this.getSubscribedState();return this.type_===Kd&&e&&e.video}},{key:"isMainAudioSubscribed",get:function(){var e=this.getSubscribedState();return this.type_===Kd&&e&&e.audio}},{key:"isAuxVideoSubscribed",get:function(){var e=this.getSubscribedState();return this.type_===Qd&&e&&e.auxiliary}},{key:"isSmallVideoSubscribed",get:function(){var e=this.getSubscribedState();return this.type_===Kd&&e&&e.smallVideo}},{key:"emitConnectionStateChanged",value:function(e){e.state!==this.connectionState_&&(e.state!==Xd&&this.isRemote_&&!this.isSubscribed||(this.emitter_.emit(Qy,e),this.connectionState_=e.state))}},{key:"setConnection",value:function(e){this.connection_!==e&&(e instanceof yb?(null!==this.connection_&&this.connection_.off(Py,this.emitConnectionStateChanged,this),e.on(Py,this.emitConnectionStateChanged,this)):null===e&&this.connection_.off(Py,this.emitConnectionStateChanged,this),this.connection_=e)}},{key:"getConnection",value:function(){return this.connection_}},{key:"play",value:(u=i(regeneratorRuntime.mark((function e(t,n){var r,i,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.log_.info("stream ".concat(this.isPlaying_?"update":"start to"," play with elementId: ").concat(t," and options: ").concat(JSON.stringify(n),".")),!this.isPlaying_){e.next=9;break}return n&&!Sh(n.muted)&&(this.muted_=n.muted),n&&!Sh(n.objectFit)&&(this.objectFit_=n.objectFit),this.isScreenShare()?this.mirror_=!1:n&&!Sh(n.mirror)&&(this.mirror_=n.mirror),this.audioPlayer_&&this.audioPlayer_.setMuted(this.muted_),this.videoPlayer_&&(this.videoPlayer_.setObjectFit(this.objectFit_),this.videoPlayer_.setMirror(this.mirror_)),this.elementId_!==t&&(r=t,kh(t)&&(r=document.getElementById(t)),r.appendChild(this.div_),this.elementId_=t),e.abrupt("return");case 9:return this.isPlaying_=!0,(i=document.createElement("div")).setAttribute("id","player_".concat(this.id_)),i.setAttribute("style","width: 100%; height: 100%; position: relative; background-color: black; overflow: hidden;"),a=t,kh(t)&&(a=document.getElementById(t)),a.appendChild(i),this.elementId_=t,this.div_=i,this.isRemote_||(this.muted_=!0),n&&!Sh(n.muted)&&(this.muted_=n.muted),this.isScreenShare()&&(this.objectFit_="contain"),n&&!Sh(n.objectFit)&&(this.objectFit_=n.objectFit),this.isScreenShare()?this.mirror_=!1:(this.isRemote_||(this.mirror_=!0),n&&!Sh(n.mirror)&&(this.mirror_=n.mirror)),zp.emit(wf,{stream:this}),e.next=26,Promise.all([this.playAudio(),this.playVideo()]);case 26:zp.emit(uf,{stream:this});case 27:case"end":return e.stop()}}),e,this)}))),function(e,t){return u.apply(this,arguments)})},{key:"playAudio",value:(c=i(regeneratorRuntime.mark((function e(){var n,r=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.hasAudio()&&(!this.isRemote_||this.isMainAudioSubscribed)){e.next=2;break}return e.abrupt("return");case 2:if(n=this.getAudioTrack(),this.audioPlayer_||!n){e.next=17;break}return this.log_.info("stream - create AudioPlayer and play"),this.audioPlayer_=new $k({stream:this,track:n,div:this.div_,muted:this.muted_,outputDeviceId:this.audioOutputDeviceId_,volume:this.audioVolume_}),this.audioPlayer_.on($y,(function(e){var n={type:dd,state:e.state,reason:e.reason};zp.emit(df,t({stream:r},n)),r.emitter_.emit(qy,n)})),e.prev=7,e.next=10,this.audioPlayer_.play();case 10:e.next=17;break;case 12:throw e.prev=12,e.t0=e.catch(7),this.client_&&this.client_.getEnableAutoPlayDialog()&&new vb,this.emitter_.emit(Xy,e.t0),e.t0;case 17:case"end":return e.stop()}}),e,this,[[7,12]])}))),function(){return c.apply(this,arguments)})},{key:"playVideo",value:(o=i(regeneratorRuntime.mark((function e(){var n,r=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.hasVideo()&&(!this.isRemote_||this.isMainVideoSubscribed||this.isAuxVideoSubscribed||this.isSmallVideoSubscribed)){e.next=2;break}return e.abrupt("return");case 2:if(n=this.getVideoTrack(),this.videoPlayer_||!n){e.next=18;break}return zp.emit(Cf,{stream:this}),this.log_.info("stream - create VideoPlayer and play"),this.videoPlayer_=new gb({stream:this,track:n,div:this.div_,muted:this.muted_,objectFit:this.objectFit_,mirror:this.mirror_}),this.videoPlayer_.on($y,(function(e){var n={type:ld,state:e.state,reason:e.reason};zp.emit(df,t({stream:r},n)),r.emitter_.emit(qy,n)})),e.prev=8,e.next=11,this.videoPlayer_.play();case 11:e.next=18;break;case 13:throw e.prev=13,e.t0=e.catch(8),this.client_&&this.client_.getEnableAutoPlayDialog()&&new vb,this.emitter_.emit(Xy,e.t0),e.t0;case 18:case"end":return e.stop()}}),e,this,[[8,13]])}))),function(){return o.apply(this,arguments)})},{key:"stopAudio",value:function(){this.audioPlayer_&&(this.log_.info("stream - stop AudioPlayer"),this.audioPlayer_.stop(),this.audioPlayer_=null)}},{key:"stopVideo",value:function(){this.videoPlayer_&&(this.log_.info("stream - stop VideoPlayer"),this.videoPlayer_.stop(),this.videoPlayer_=null)}},{key:"restartPlayback",value:function(){this.audioPlayer_&&!this.audioPlayer_.isPlaying&&this.restartAudio(),this.videoPlayer_&&!this.videoPlayer_.isPlaying&&this.restartVideo()}},{key:"restartAudio",value:function(){this.isPlaying_&&(this.stopAudio(),this.playAudio().catch((function(e){})))}},{key:"restartVideo",value:function(){this.isPlaying_&&(this.stopVideo(),this.playVideo().catch((function(e){})))}},{key:"stop",value:function(){this.isPlaying_&&(this.isPlaying_=!1,this.stopAudio(),this.stopVideo(),this.div_.parentNode.removeChild(this.div_))}},{key:"resume",value:(r=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isPlaying_){e.next=2;break}return e.abrupt("return");case 2:if(this.log_.info("stream - resume"),!this.audioPlayer_){e.next=6;break}return e.next=6,this.audioPlayer_.resume();case 6:if(!this.videoPlayer_){e.next=9;break}return e.next=9,this.videoPlayer_.resume();case 9:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"close",value:function(){this.isPlaying_&&this.stop(),this.isRemote_||(this.mediaStream_&&(this.mediaStream_.preventEvent=1,this.mediaStream_.getTracks().forEach((function(e){e.stop()})),this.mediaStream_=null),this.uninstallEvents())}},{key:"muteAudio",value:function(){return this.addRemoteEvent(!0,dd),this.doEnableTrack(dd,!1)}},{key:"muteVideo",value:function(){return this.addRemoteEvent(!0,ld),this.doEnableTrack(ld,!1)}},{key:"unmuteAudio",value:function(){return this.addRemoteEvent(!1,dd),this.doEnableTrack(dd,!0)}},{key:"unmuteVideo",value:function(){return this.addRemoteEvent(!1,ld),this.doEnableTrack(ld,!0)}},{key:"addRemoteEvent",value:function(e,t){if(this.isRemote_&&this.client_){var n=this.client_.getUserId(),r="".concat(e?md:_d," remote ").concat(t);x_(n,{eventId:t===dd?e?u_:l_:e?c_:d_,eventDesc:r,timestamp:(new Date).getTime(),userId:n,tinyId:this.client_.getTinyId(),remoteUserId:this.userId_,remoteTinyId:this.connection_.getTinyId()})}}},{key:"doEnableTrack",value:function(e,t){var n=!1;return e===dd?this.mediaStream_.getAudioTracks().forEach((function(e){n=!0,e.enabled=t})):this.mediaStream_.getVideoTracks().forEach((function(e){n=!0,e.enabled=t})),n}},{key:"getId",value:function(){return this.id_}},{key:"getUserId",value:function(){return this.userId_}},{key:"getTinyId",value:function(){return this.connection_?this.connection_.getTinyId():""}},{key:"isPlaying",value:function(){return this.isPlaying_}},{key:"setAudioOutput",value:(n=i(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.audioOutputDeviceId_=t,!this.audioPlayer_){e.next=4;break}return e.next=4,this.audioPlayer_.setSinkId(t);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"setAudioVolume",value:function(e){this.audioVolume_=e,this.log_.info("setAudioVolume to ".concat(e)),this.audioPlayer_&&this.audioPlayer_.setVolume(e)}},{key:"getAudioLevel",value:function(){var e=0;return this.audioPlayer_&&(e=this.audioPlayer_.getAudioLevel()),e}},{key:"hasAudio",value:function(){if(this.isRemote_){if(!this.connection_)return!1;var e=this.connection_.getTrackState();return this.type_===Kd&&e.audio}return!!this.getAudioTrack()}},{key:"hasVideo",value:function(){if(this.isRemote_){if(!this.connection_)return!1;var e=this.connection_.getTrackState();return this.type_===Qd?e.auxiliary:e.video}return!!this.getVideoTrack()}},{key:"getSubscribedState",value:function(){return this.isRemote_&&this.connection_?this.connection_.getSubscribeState():null}},{key:"getAudioTrack",value:function(){var e=null;if(this.mediaStream_){var t=this.mediaStream_.getAudioTracks();t.length>0&&(e=t[0])}return e}},{key:"getVideoTrack",value:function(){var e=null;if(this.mediaStream_){var t=this.mediaStream_.getVideoTracks();t.length>0&&(e=t[0])}return e}},{key:"getVideoFrame",value:function(){return this.videoPlayer_?this.videoPlayer_.getVideoFrame():null}},{key:"getMediaStream",value:function(){return this.mediaStream_}},{key:"setMediaStream",value:function(e){e!==this.mediaStream_&&(this.mediaStream_&&this.mediaStream_.getTracks().forEach((function(e){return e.stop()})),this.mediaStream_=e)}},{key:"updateVideoPlayingState",value:function(e){this.isPlaying_&&(e?(this.log_.info("playing state updated, play video"),this.playVideo().catch((function(e){}))):(this.log_.info("playing state updated, stop video"),this.stopVideo()))}},{key:"updateAudioPlayingState",value:function(e){this.isPlaying_&&(e?(this.log_.info("playing state updated, play audio"),this.playAudio().catch((function(e){}))):(this.log_.info("playing state updated, stop audio"),this.stopAudio()))}},{key:"on",value:function(e,t,n){this.emitter_.on(e,t,n)}},{key:"off",value:function(e,t,n){"*"===e?this.emitter_.removeAllListeners():this.emitter_.off(e,t,n)}},{key:"isRemote",value:function(){return this.isRemote_}},{key:"isScreenShare",value:function(){return!this.isRemote_&&this.screen_||this.isRemote_&&this.getType()===hd}},{key:"getDiv",value:function(){return this.div_}},{key:"getObjectFit",value:function(){return this.objectFit_}},{key:"getMuted",value:function(){return this.muted_}},{key:"getClient",value:function(){return this.client_}}]),e}()).prototype,"play",[bb],Object.getOwnPropertyDescriptor(Ib.prototype,"play"),Ib.prototype),Ib),xb=function(e){u(RemoteStream,e);var n=_(RemoteStream);function RemoteStream(e){var r;a(this,RemoteStream);var i={isRemote:!0,type:e.type},o=t(t({},e),i);return(r=n.call(this,o)).name_=rh,r.isInSubscriptionCycle_=!1,r.isStreamAddedEventEmitted_=!1,r.isAbleToCallSubscription_=!0,r}return s(RemoteStream,[{key:"installEvents",value:function(){v(d(RemoteStream.prototype),"installEvents",this).call(this),zp.on(_f,this.handleStreamSubscribed,this),zp.on(vf,this.handleStreamUnsubscribed,this)}},{key:"uninstallEvents",value:function(){v(d(RemoteStream.prototype),"uninstallEvents",this).call(this),zp.off(_f,this.handleStreamSubscribed,this),zp.off(vf,this.handleStreamUnsubscribed,this)}},{key:"handleStreamSubscribed",value:function(e){e.client===this.client_&&e.stream===this&&this.connection_.getCurrentState()===Zd&&this.emitConnectionStateChanged({prevState:Xd,state:Zd})}},{key:"handleStreamUnsubscribed",value:function(e){e.client===this.client_&&e.stream===this&&this.emitConnectionStateChanged({prevState:Zd,state:Xd})}},{key:"getType",value:function(){return v(d(RemoteStream.prototype),"getType",this).call(this)}},{key:"getIsAbleToCallSubscription",value:function(){return this.isAbleToCallSubscription_}},{key:"setIsAbleToCallSubscription",value:function(e){this.isAbleToCallSubscription_=e}},{key:"setInSubscriptionCycle",value:function(e){this.isInSubscriptionCycle_=e}},{key:"isInSubscriptionCycle",value:function(){return this.isInSubscriptionCycle_}},{key:"setIsStreamAddedEventEmitted",value:function(e){this.isStreamAddedEventEmitted_=e}},{key:"getIsStreamAddedEventEmitted",value:function(){return this.isStreamAddedEventEmitted_}},{key:"getAudioTrack",value:function(){return this.connection_&&this.connection_.getTrackState().audio?v(d(RemoteStream.prototype),"getAudioTrack",this).call(this):null}},{key:"getVideoTrack",value:function(){if(!this.connection_)return null;var e=this.connection_.getTrackState();return(this.type_!==Kd||e.video)&&(this.type_!==Qd||e.auxiliary)?v(d(RemoteStream.prototype),"getVideoTrack",this).call(this):null}},{key:"close",value:function(){v(d(RemoteStream.prototype),"close",this).call(this)}}]),RemoteStream}(Ab),Pb=function(){function e(t){a(this,e),this.client_=t.client,this.subscribedStreams_=new Map,this.unsubscribedStreams_=new Map,this.subscriptedOptions_=new Map,this.autoRecoveryFlags_=new Map}var t,n,r;return s(e,[{key:"isEnabled",get:function(){return"webrtc"!==this.client_.getEnv()}},{key:"recover",value:(r=i(regeneratorRuntime.mark((function e(t){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.getUserId(),r=t.getType(),this.hasAutoRecoveryFlag(n,r)){e.next=5;break}return e.abrupt("return");case 5:if(i=this.getUnsubscribedStream(n,r)?"unsubscribe":"subscribe",e.prev=6,Bf.warn("recover() try to recover subscription [".concat(i,"][").concat(n,"][").concat(r,"]")),"subscribe"!==i){e.next=13;break}return e.next=11,this.recoverSubscription(n,t);case 11:e.next=15;break;case 13:return e.next=15,this.recoverUnsubscription(n,t);case 15:Ng.logSuccessEvent({userId:this.client_.getUserId(),eventType:Cl}),Bf.warn("recover() recover successfully [".concat(i,"][").concat(n,"][").concat(r,"]")),e.next=23;break;case 19:e.prev=19,e.t0=e.catch(6),Bf.error("recover() recover failed [".concat(i,"][").concat(n,"][").concat(r,"]"),e.t0),Ng.logFailedEvent({userId:this.client_.getUserId(),eventType:Cl,error:e.t0});case 23:this.deleteAutoRecoveryFlag(n,r);case 24:case"end":return e.stop()}}),e,this,[[6,19]])}))),function(e){return r.apply(this,arguments)})},{key:"recoverSubscription",value:(n=i(regeneratorRuntime.mark((function e(t,n){var r,i,a,o,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this.getOptions(t,n.getType()),i=this.getSubscribedStream(t,n.getType()),r&&i){e.next=4;break}return e.abrupt("return");case 4:a=this.getStreamMuteState(i),o=a.isAudioMuted,s=a.isVideoMuted,this.mergeStream(i,n),this.recoverPlayingState(i),o&&i.doEnableTrack(dd,!1),s&&i.doEnableTrack(ld,!1);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"recoverUnsubscription",value:(t=i(regeneratorRuntime.mark((function e(t,n){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this.getUnsubscribedStream(t,n.getType())){e.next=3;break}return e.abrupt("return");case 3:this.mergeStream(r,n);case 4:case"end":return e.stop()}}),e,this)}))),function(e,n){return t.apply(this,arguments)})},{key:"getStreamMuteState",value:function(e){var t={isAudioMuted:!1,isVideoMuted:!1},n=e.getMediaStream();return n&&(t.isAudioMuted=n.getAudioTracks().map((function(e){return e.enabled})).includes(!1),t.isVideoMuted=n.getVideoTracks().map((function(e){return e.enabled})).includes(!1)),t}},{key:"recoverPlayingState",value:function(e){var t=e.isPlaying(),n=e.getDiv();if(t&&n){var r=n.parentNode;e.stop(),e.play(r,{objectFit:e.getObjectFit(),muted:e.getMuted()})}}},{key:"mergeStream",value:function(e,t){var n=t.getConnection(),r=t.getMediaStream();e.setConnection(n),n.setRemoteStream(r.id,e),e.setMediaStream(r),e.updateAudioPlayingState(t.hasAudio()),e.updateVideoPlayingState(t.hasVideo())}},{key:"addSubscriptionRecord",value:function(e,t,n){var r=t.getType();if(this.subscribedStreams_.has(e))this.subscribedStreams_.get(e).set(r,t);else{var i=new Map;i.set(t.getType(),t),this.subscribedStreams_.set(e,i)}if(this.subscriptedOptions_.has(e))this.subscriptedOptions_.get(e).set(r,n);else{var a=new Map;a.set(t.getType(),n),this.subscriptedOptions_.set(e,a)}this.deleteUnsubscriptionRecord(e,r)}},{key:"addUnsubscriptionRecord",value:function(e,t){if(this.unsubscribedStreams_.has(e))this.unsubscribedStreams_.get(e).set(t.getType(),t);else{var n=new Map;n.set(t.getType(),t),this.unsubscribedStreams_.set(e,n)}this.deleteSubscriptionRecord(e,t.getType())}},{key:"getSubscribedStream",value:function(e,t){return this.subscribedStreams_.has(e)&&this.subscribedStreams_.get(e).has(t)?this.subscribedStreams_.get(e).get(t):null}},{key:"getOptions",value:function(e,t){return this.subscriptedOptions_.has(e)&&this.subscriptedOptions_.get(e).has(t)?this.subscriptedOptions_.get(e).get(t):null}},{key:"getUnsubscribedStream",value:function(e,t){return this.unsubscribedStreams_.has(e)&&this.unsubscribedStreams_.get(e).has(t)?this.unsubscribedStreams_.get(e).get(t):null}},{key:"deleteSubscriptionRecord",value:function(e,t){this.subscribedStreams_.has(e)&&this.subscribedStreams_.get(e).delete(t),this.subscriptedOptions_.has(e)&&this.subscriptedOptions_.get(e).delete(t)}},{key:"deleteUnsubscriptionRecord",value:function(e,t){this.unsubscribedStreams_.has(e)&&this.unsubscribedStreams_.get(e).delete(t)}},{key:"markAllStream",value:function(){for(var e=0,t=y(this.subscribedStreams_.entries());e<t.length;e++)for(var n=g(t[e],2),r=n[0],i=0,a=y(n[1].entries());i<a.length;i++){var o=g(a[i],1)[0];this.setAutoRecoveryFlag(r,o)}for(var s=0,c=y(this.unsubscribedStreams_.entries());s<c.length;s++)for(var u=g(c[s],2),d=u[0],l=0,h=y(u[1].entries());l<h.length;l++){var p=g(h[l],1)[0];this.setAutoRecoveryFlag(d,p)}}},{key:"setAutoRecoveryFlag",value:function(e,t){if(Bf.info("setAutoRecoveryFlag() mark [".concat(e,"][").concat(t,"]")),this.autoRecoveryFlags_.has(e))this.autoRecoveryFlags_.get(e).set(t);else{var n=new Map;n.set(t),this.autoRecoveryFlags_.set(e,n)}}},{key:"hasAutoRecoveryFlag",value:function(e,t){return!!this.isEnabled&&(this.autoRecoveryFlags_.has(e)&&this.autoRecoveryFlags_.get(e).has(t))}},{key:"deleteAutoRecoveryFlag",value:function(e,t){this.autoRecoveryFlags_.has(e)&&this.autoRecoveryFlags_.get(e).delete(t)}},{key:"delete",value:function(e){this.unsubscribedStreams_.delete(e),this.subscribedStreams_.delete(e),this.subscriptedOptions_.delete(e),this.autoRecoveryFlags_.delete(e)}}]),e}(),Db=Wt("slice"),Nb=_e("species"),Lb=[].slice,Ob=Math.max;Rt({target:"Array",proto:!0,forced:!Db},{slice:function(e,t){var n,r,i,a=B(this),o=ot(a),s=rt(e,o),c=rt(void 0===t?o:t,o);if(Et(a)&&(n=a.constructor,(Ft(n)&&(n===Array||Et(n.prototype))||G(n)&&null===(n=n[Nb]))&&(n=void 0),n===Array||void 0===n))return Lb.call(a,s,c);for(r=new(void 0===n?Array:n)(Ob(c-s,0)),i=0;s<c;s++,i++)s in a&&zi(r,i,a[s]);return r.length=i,r}}),Rt({target:"String",proto:!0,forced:M_("small")},{small:function(){return O_(this,"small","","")}});var Mb=function(){function e(t){a(this,e),this.player_=t,this.canvas_=document.createElement(ud),this.canvasCtx_=this.canvas_.getContext("2d")}return s(e,[{key:"setCanvasRect",value:function(e,t){this.canvas_.width=e,this.canvas_.height=t}},{key:"drawVideoToCanvas",value:function(){var e=this.player_.getElement();this.canvasCtx_.drawImage(e,0,0,this.canvas_.width,this.canvas_.height)}},{key:"generateVideoTrackFromCanvasCapture",value:function(e){return this.canvas_.captureStream(e).getVideoTracks()[0]}},{key:"generateStreamFromTrack",value:function(e){var t=new MediaStream;return t.addTrack(e),t}},{key:"destroy",value:function(){this.player_.stop(),this.canvas_=null,this.canvasCtx_=null}},{key:"canvas",get:function(){return this.canvas_}},{key:"canvasCtx",get:function(){return this.canvasCtx_}},{key:"canDrawVideoToCanvas",get:function(){if(this.player_){var e=this.player_.getElement();if(e)return e.readyState===e.HAVE_ENOUGH_DATA}return!1}}]),e}(),Ub=function(){function e(t){a(this,e),this.localStream_=t,this.player_=new gb({stream:t,track:t.getVideoTrack(),muted:!0,objectFit:"cover",mirror:!1}),this.player_.play().then((function(){Bf.info("VideoGenerator: play local video success")})).catch((function(){Bf.error("VideoGenerator: Failed to play local video")})),this.processor_=new Mb(this.player_)}return s(e,[{key:"generateSmallVideoTrack",value:function(e){var t=this.getSmallVideoProfile(e);this.processor_.setCanvasRect(t.width,t.height),this.player_.setRect({width:t.width,height:t.height});var n=this.processor_.generateVideoTrackFromCanvasCapture(t.frameRate);return this.interval_=$g.setInterval(this.render.bind(this),Math.ceil(1e3/t.frameRate)),n}},{key:"render",value:function(){this.processor_.canDrawVideoToCanvas&&this.processor_.drawVideoToCanvas()}},{key:"destroy",value:function(){$g.clearInterval(this.interval_),this.processor_&&this.processor_.destroy()}},{key:"getSmallVideoProfile",value:function(e){var t,n=this.localStream_.getVideoTrack(),r=this.localStream_.getVideoProfile(),i=n.getSettings(),a=i&&i.width&&i.height?{width:i.width,height:i.height}:r,o=a.width*a.height,s=e.width*e.height;return Bf.log("big stream resolution: ".concat(a.height,"*").concat(a.width," small stream resolution: ").concat(e.height,"*").concat(e.width," ")),o>s?t=o/s:(Bf.warn("Small stream resolution is larger than big stream, which is invalid. big: ".concat(a.width," * ").concat(a.height," small: ").concat(e.width," * ").concat(e.height)),t=o/19200),{width:parseInt(a.width/Math.sqrt(t)),height:parseInt(a.height/Math.sqrt(t)),frameRate:e.frameRate}}}]),e}(),Vb={voiceActivityDetection:!1},Fb=function(e){u(b,e);var t,n,r,o,c,l,h,p,f,m,g,y,S,k=_(b);function b(e){var t;return a(this,b),(t=k.call(this,e)).localStream_=null,t.exchangeSDPTimeout_=-1,t.smallGenerator_=null,t.isSDPExchanging_=!1,t.ssrc_={audio:0,video:0,small:0},t.canvasTrack_=null,t}return s(b,[{key:"initialize",value:function(){v(d(b.prototype),"initialize",this).call(this),this.installEvents()}},{key:"reset",value:function(){v(d(b.prototype),"close",this).call(this),this.uninstallEvents(),this.clearExchangeSDPTimeout(),this.canvasTrack_=null,this.localStream_&&this.localStream_.clearCanvas()}},{key:"close",value:function(){this.reset(),this.emitConnectionStateChangedEvent(Xd),this.smallGenerator_&&(this.smallGenerator_.destroy(),this.smallGenerator_=null)}},{key:"installEvents",value:function(){this.emitter_.on(xy,this.handleError,this),this.emitter_.on(Py,this.handleConnectionStateChange,this)}},{key:"uninstallEvents",value:function(){this.emitter_.off(xy,this.handleError,this),this.emitter_.off(Py,this.handleConnectionStateChange,this)}},{key:"publish",value:(S=i(regeneratorRuntime.mark((function e(t){var n,r,i,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.localStream_=t,n=t.getMediaStream(),this.log_.info("is publishing stream: ".concat(t.getId())),r=this.localStream_.getAudioTrack(),i=this.localStream_.getVideoTrack(),r&&this.peerConnection_.addTrack(r,n),i&&(rd&&Rh(i)?(this.canvasTrack_=this.localStream_.genCanvasTrack(i),this.peerConnection_.addTrack(this.canvasTrack_,n)):this.peerConnection_.addTrack(i,n),this.client_.getIsEnableSmallStream()&&(this.smallGenerator_=new Ub(this.localStream_),a=this.smallGenerator_.generateSmallVideoTrack(this.client_.smallStreamConfig_),this.peerConnection_.addTrack(a,n))),e.next=9,this.connect();case 9:return e.abrupt("return",t);case 10:case"end":return e.stop()}}),e,this)}))),function(e){return S.apply(this,arguments)})},{key:"updateMediaSettings",value:function(e){var t=this,n=this.client_.getSystemResult().detail,r=n.isH264EncodeSupported,i=n.isVp8EncodeSupported,a="";r?a="H264":i&&(a="VP8");var o={videoCodec:a,videoWidth:0,videoHeight:0,videoBps:0,videoFps:0,audioCodec:"opus",audioFs:0,audioChannel:0,audioBps:0};return Ty?e.getTracks().forEach((function(e){var n=e.getSettings();if(e.kind===dd){var r=1;n.channelCount&&(r=n.channelCount),o.audioChannel=r,o.audioBps=1e3*t.localStream_.getAudioBitrate(),o.audioFs=n.sampleRate}else e.kind===ld&&(t.client_.getIsEnableSmallStream()&&(o.smallVideoWidth=t.client_.smallStreamConfig.width,o.smallVideoHeight=t.client_.smallStreamConfig.height,o.smallVideoFps=t.client_.smallStreamConfig.framerate,o.smallVideoBps=1e3*t.client_.smallStreamConfig.bitrate),o.videoWidth=n.width,o.videoHeight=n.height,o.videoFps=n.frameRate,o.videoBps=1e3*t.localStream_.getVideoBitrate())})):o=this.getMediaSettingsFromProfile(o),this.log_.info("updateMediaSettings: "+JSON.stringify(o)),o}},{key:"getMediaSettingsFromProfile",value:function(e){var t=this.localStream_;if(t){if(t.getAudioTrack()){var n=t.getAudioProfile();e.audioChannel=n.channelCount,e.audioBps=1e3*n.bitrate,e.audioFs=n.sampleRate}if(t.getVideoTrack()){var r=t.getVideoProfile();e.videoWidth=r.width,e.videoHeight=r.height,e.videoFps=r.frameRate,e.videoBps=1e3*r.bitrate}}return e}},{key:"addTrack",value:(y=i(regeneratorRuntime.mark((function e(t){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.peerConnection_){e.next=19;break}if(t.kind===ld&&rd&&Rh(t)&&(t=this.canvasTrack_=this.localStream_.genCanvasTrack(t)),this.log_.info("is adding ".concat(t.kind," track to current published local stream")),!(hy()&&this.peerConnection_.getTransceivers().findIndex((function(e){return"stopped"===e.direction}))>=0)){e.next=7;break}return this.log_.warn("transceiver is stopping, negotiate sdp first"),e.next=7,this.updateOffer(zl,t);case 7:if(!(n=this.peerConnection_.getSenders().find((function(e){return e.track&&e.track.kind===t.kind})))){e.next=14;break}return this.log_.warn("sender already exists, remove sender first"),r=n.track,this.removeSender(n),e.next=14,this.updateOffer(zl,r);case 14:return i=this.localStream_.getMediaStream(),this.peerConnection_.addTrack(t,i),e.next=18,this.updateOffer(Jl,t);case 18:x_(this.userId_,{eventId:t.kind===dd?Km:qm,eventDesc:"add ".concat(t.kind," track to current published stream"),timestamp:go(),userId:this.userId_,tinyId:this.tinyId_});case 19:case"end":return e.stop()}}),e,this)}))),function(e){return y.apply(this,arguments)})},{key:"isNeedToResetOfferOrder",value:function(){if("plan-b"===this.sdpSemantics_||!this.peerConnection_||!this.peerConnection_.localDescription)return!1;for(var e=this.peerConnection_.localDescription.sdp,t=zg(e),n=0;n<t.media.length;n++)if(0===t.media[n].mid&&t.media[n].type===ld)return!0;return!1}},{key:"removeSender",value:function(e){var t=null;hy()&&(t=this.peerConnection_.getTransceivers().find((function(t){return t.sender&&t.sender.track===e.track}))),this.peerConnection_.removeTrack(e),t&&yh(t.stop)&&(this.log_.info("stop transceiver"),t.stop())}},{key:"removeTrack",value:(g=i(regeneratorRuntime.mark((function e(t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.peerConnection_||!ly()){e.next=14;break}if(t.kind===ld&&rd&&this.canvasTrack_&&(t=this.canvasTrack_,this.localStream_.clearCanvas()),this.log_.info("is removing ".concat(t.kind," track from current published local stream")),t.kind!==ld||!this.isNeedToResetOfferOrder()){e.next=9;break}return this.reset(),this.initialize(),e.next=8,this.publish(this.localStream_);case 8:return e.abrupt("return");case 9:return(n=this.peerConnection_.getSenders().find((function(e){return e.track===t})))&&this.removeSender(n),e.next=13,this.updateOffer(zl,t);case 13:x_(this.userId_,{eventId:t.kind===dd?Xm:Qm,eventDesc:"remove ".concat(t.kind," track from current published stream"),timestamp:go(),userId:this.userId_,tinyId:this.tinyId_});case 14:case"end":return e.stop()}}),e,this)}))),function(e){return g.apply(this,arguments)})},{key:"isReplaceTrackAvailable",value:function(){return"RTCRtpSender"in window&&"replaceTrack"in window.RTCRtpSender.prototype}},{key:"replaceTrack",value:(m=i(regeneratorRuntime.mark((function e(t){var n,r=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.kind!==ld||!rd||!this.canvasTrack_){e.next=2;break}return e.abrupt("return");case 2:if(this.isReplaceTrackAvailable()&&ly()){e.next=4;break}throw new Wm({code:zm.INVALID_OPERATION,message:Dg({key:Tg})});case 4:if(this.peerConnection_){e.next=6;break}throw new Wm({code:zm.INVALID_OPERATION,message:Dg({key:Gv})});case 6:if(0!==(n=this.peerConnection_.getSenders()).length){e.next=9;break}throw new Wm({code:zm.INVALID_OPERATION,message:Dg({key:Gv})});case 9:n.forEach((function(e){e.track&&e.track.kind===t.kind&&(r.log_.info("is replacing ".concat(t.kind," track to current published local stream")),e.replaceTrack(t))})),x_(this.userId_,{eventId:t.kind===dd?s_:o_,eventDesc:"replace ".concat(t.kind," track from current published stream"),timestamp:go(),userId:this.userId_,tinyId:this.tinyId_});case 11:case"end":return e.stop()}}),e,this)}))),function(e){return m.apply(this,arguments)})},{key:"setBandwidth",value:(f=i(regeneratorRuntime.mark((function e(t,n,r){var i,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isUplink_){e.next=2;break}return e.abrupt("return",r);case 2:if(fy()){e.next=4;break}return e.abrupt("return",n===ld?this.updateVideoBandwidthRestriction(r,t):this.updateAudioBandwidthRestriction(r,t));case 4:if(!(i=this.peerConnection_.getSenders().find((function(e){return e.track&&e.track.kind===n})))){e.next=20;break}return(a=i.getParameters()).encodings&&0!==a.encodings.length||(a.encodings=[{}]),"unlimited"===t?delete a.encodings[0].maxBitrate:a.encodings[0].maxBitrate=1e3*t,e.prev=9,e.next=12,i.setParameters(a);case 12:return this.log_.info(n+" bandwidth was set to "+t+" kbps"),e.abrupt("return",r);case 16:return e.prev=16,e.t0=e.catch(9),this.log_.info("failed to set bandwidth by setting maxBitrate: "+e.t0),e.abrupt("return",n===ld?this.updateVideoBandwidthRestriction(r,t):this.updateAudioBandwidthRestriction(r,t));case 20:return e.abrupt("return",r);case 21:case"end":return e.stop()}}),e,this,[[9,16]])}))),function(e,t,n){return f.apply(this,arguments)})},{key:"setSmallStreamBandwidth",value:(p=i(regeneratorRuntime.mark((function e(t,n){var r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isUplink_){e.next=2;break}return e.abrupt("return",n);case 2:if(fy()){e.next=4;break}return e.abrupt("return",this.updateSmallVideoBandwidthRestriction(n,t));case 4:if(!(r=this.peerConnection_.getSenders().filter((function(e){return e.track&&e.track.kind===ld}))[1])){e.next=20;break}return(i=r.getParameters()).encodings&&0!==i.encodings.length||(i.encodings=[{}]),"unlimited"===t?delete i.encodings[0].maxBitrate:i.encodings[0].maxBitrate=1e3*t,e.prev=9,e.next=12,r.setParameters(i);case 12:return this.log_.info("small stream bandwidth was set to "+t+" kbps"),e.abrupt("return",n);case 16:return e.prev=16,e.t0=e.catch(9),this.log_.info("failed to set small stream bandwidth by setting maxBitrate: "+e.t0),e.abrupt("return",this.updateSmallVideoBandwidthRestriction(n,t));case 20:return e.abrupt("return",n);case 21:case"end":return e.stop()}}),e,this,[[9,16]])}))),function(e,t){return p.apply(this,arguments)})},{key:"updateVideoBandwidthRestriction",value:function(e,t){var n="AS";return cu&&(n="TIAS",t*=1e3),e=-1===e.indexOf("b="+n+":")?e.replace(/m=video (.*)\r\nc=IN (.*)\r\n/,"m=video $1\r\nc=IN $2\r\nb="+n+":"+t+"\r\n"):e.replace(new RegExp("b="+n+":.*\r\n"),"b="+n+":"+t+"\r\n")}},{key:"updateAudioBandwidthRestriction",value:function(e,t){var n="AS";return cu&&(n="TIAS",t*=1e3),e=e.replace(/m=audio (.*)\r\nc=IN (.*)\r\n/,"m=audio $1\r\nc=IN $2\r\nb="+n+":"+t+"\r\n")}},{key:"updateSmallVideoBandwidthRestriction",value:function(e,t){var n="AS";cu&&(n="TIAS",t*=1e3);var r=/m=video (.*)\r\nc=IN (.*)\r\n/g,i=[],a=r.exec(e);for(i.push(a);null!==a;)a=r.exec(e),i.push(a);var o=i[i.length-2],s=e.slice(0,o.index),c=e.slice(o.index);return e=-1===e.indexOf("b="+n+":")?s+(c=c.replace(/m=video (.*)\r\nc=IN (.*)\r\n/,"m=video $1\r\nc=IN $2\r\nb="+n+":"+t+"\r\n")):s+(c=c.replace(new RegExp("b="+n+":.*\r\n"),"b="+n+":"+t+"\r\n"))}},{key:"removeBandwidthRestriction",value:function(e){return e.replace(/b=AS:.*\r\n/,"").replace(/b=TIAS:.*\r\n/,"")}},{key:"removeVideoOrientation",value:function(e){return e.replace(/urn:3gpp:video-orientation/,"")}},{key:"connect",value:(h=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.exchangeSDP();case 3:return e.next=5,this.waitForPeerConnectionConnected();case 5:e.next=11;break;case 7:throw e.prev=7,e.t0=e.catch(0),this.closePeerConnection(!0),e.t0;case 11:case"end":return e.stop()}}),e,this,[[0,7]])}))),function(){return h.apply(this,arguments)})},{key:"exchangeSDP",value:(l=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,this.isSDPExchanging_=!0,e.next=4,this.createOffer();case 4:return this.log_.info("createOffer success, sending offer to remote server"),e.next=7,this.doExchangeSDP();case 7:this.isSDPExchanging_=!1,e.next=14;break;case 10:throw e.prev=10,e.t0=e.catch(0),this.isSDPExchanging_=!1,e.t0;case 14:case"end":return e.stop()}}),e,this,[[0,10]])}))),function(){return l.apply(this,arguments)})},{key:"createOffer",value:(c=i(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.peerConnection_.createOffer(Vb);case 3:return t=e.sent,e.next=6,this.peerConnection_.setLocalDescription(t);case 6:this.updateSSRC(t.sdp),Ng.logSuccessEvent({userId:this.client_.getUserId(),eventType:kl,kind:"offer"}),e.next=14;break;case 10:throw e.prev=10,e.t0=e.catch(0),Ng.logFailedEvent({userId:this.client_.getUserId(),eventType:kl,kind:"offer",error:e.t0}),e.t0;case 14:case"end":return e.stop()}}),e,this,[[0,10]])}))),function(){return c.apply(this,arguments)})},{key:"doExchangeSDP",value:function(){var e=this;return new Promise((function(t,n){e.exchangeSDPTimeout_=setTimeout((function(){e.signalChannel_.off(wm.PUBLISH_RESULT,r),e.clearExchangeSDPTimeout();var t=new Wm({code:zm.API_CALL_TIMEOUT,message:Dg({key:K_})});n(t)}),5e3);var r=function(){var r=i(regeneratorRuntime.mark((function r(i){var a,o,s;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(r.prev=0,e.clearExchangeSDPTimeout(),a=i.data,o=a.code,s=a.message,0!==o){r.next=9;break}return r.next=6,e.acceptAnswer(i.data.data);case 6:t(),r.next=10;break;case 9:e.checkPublishResultCode(o,s);case 10:r.next=15;break;case 12:r.prev=12,r.t0=r.catch(0),n(r.t0);case 15:case"end":return r.stop()}}),r,null,[[0,12]])})));return function(e){return r.apply(this,arguments)}}(),a=e.updateMediaSettings(e.localStream_.getMediaStream()),o={type:e.peerConnection_.localDescription.type,sdp:e.removeVideoOrientation(e.peerConnection_.localDescription.sdp),screen:e.localStream_.hasScreenTrack(),constraintConfig:a};e.signalChannel_.once(wm.PUBLISH_RESULT,r),e.log_.debug("sending sdp offer: "+o.sdp),e.signalChannel_.send(Dm,o)}))}},{key:"setSDPDirection",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"all",r=zg(e);return r.media.forEach((function(e){"all"!==n&&e.type!==n||(e.direction=t)})),Wg(r)}},{key:"updateOffer",value:(o=i(regeneratorRuntime.mark((function e(t,n){var r,i,a,o,s,c,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.peerConnection_.createOffer(Vb);case 3:return r=e.sent,cu&&(r.sdp=this.setSDPDirection(r.sdp,"sendrecv")),e.next=7,this.peerConnection_.setLocalDescription(r);case 7:return i=this.updateMediaSettings(this.localStream_.getMediaStream()),a={action:t,trackId:n.id,kind:n.kind===ld?"bigVideo":n.kind,type:"offer",sdp:this.peerConnection_.localDescription.sdp,constraintConfig:i},this.log_.info("createOffer success, sending updated offer to remote server"),this.log_.debug("updatedOffer: "+a.sdp),e.next=13,this.signalChannel_.sendWaitForResponse({command:Em,data:a,responseCommand:wm.UPDATE_OFFER_RESULT,timeout:1e4,commandDesc:"update offer"});case 13:return o=e.sent,s=o.data,c=s.code,u=s.message,0!==c&&this.checkPublishResultCode(c,u),e.next=18,this.acceptAnswer(o.data.data);case 18:this.updateSSRC(r.sdp),Ng.logSuccessEvent({userId:this.client_.getUserId(),eventType:kl,kind:"offer"}),e.next=27;break;case 22:throw e.prev=22,e.t0=e.catch(0),this.log_.error(e.t0),Ng.logFailedEvent({userId:this.client_.getUserId(),eventType:kl,kind:"offer",error:e.t0}),e.t0;case 27:case"end":return e.stop()}}),e,this,[[0,22]])}))),function(e,t){return o.apply(this,arguments)})},{key:"acceptAnswer",value:(r=i(regeneratorRuntime.mark((function e(t){var n,r,i,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=this.localStream_.getVideoBitrate(),r=this.localStream_.getAudioBitrate(),e.prev=2,i=this.removeVideoOrientation(t.sdp),e.next=6,this.setBandwidth(n,ld,i);case 6:return i=e.sent,e.next=9,this.setBandwidth(r,dd,i);case 9:if(i=e.sent,!this.client_.getIsEnableSmallStream()){e.next=15;break}return a=this.client_.smallStreamConfig,e.next=14,this.setSmallStreamBandwidth(a.bitrate,i);case 14:i=e.sent;case 15:return o={type:t.type,sdp:i},e.next=18,this.peerConnection_.setRemoteDescription(o);case 18:this.log_.debug("accepted answer: "+i),Ng.logSuccessEvent({userId:this.client_.getUserId(),eventType:bl,kind:"answer"}),e.next=27;break;case 22:throw e.prev=22,e.t0=e.catch(2),Ng.logFailedEvent({userId:this.client_.getUserId(),eventType:bl,kind:"answer",error:e.t0}),this.log_.error("failed to accept remote answer "+e.t0),e.t0;case 27:case"end":return e.stop()}}),e,this,[[2,22]])}))),function(e){return r.apply(this,arguments)})},{key:"sendMutedFlag",value:function(e){var t={audio:e.audio,bigVideo:e.video,auxVideo:e.auxVideo};this.log_.info("send muted state: ".concat(JSON.stringify(t))),this.signalChannel_.send(Pm,t)}},{key:"getIsReconnecting",value:function(){return this.isReconnecting_}},{key:"reconnect",value:(n=i(regeneratorRuntime.mark((function e(){var t,n,r=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(-1===this.reconnectionTimer_){e.next=3;break}return this.log_.warn("reconnect() uplink is reconnecting, ignore current reconnection"),e.abrupt("return");case 3:if(!(this.reconnectionCount_>=30)){e.next=12;break}return this.log_.warn("SDK has tried reconnect uplink for ".concat(30," times, but all failed, please check your network")),this.stopReconnection(),t=new Wm({code:zm.UPLINK_RECONNECTION_FAILED,message:Dg({key:$_})}),Ng.logFailedEvent({userId:this.client_.getUserId(),eventType:gl,error:t}),this.addEventInternal(I_,"uplink-connection reconnect fail"),this.emitConnectionStateChangedEvent(Xd),this.emitter_.emit(xy,t),e.abrupt("return");case 12:if(this.signalChannel_.getCurrentState()===Im){e.next=16;break}return this.log_.warn("reconnect() signal channel is not connected, suspend reconnection until signal is connected"),this.signalChannel_.once(gm,this.reconnect,this),e.abrupt("return");case 16:if(this.reconnectionCount_++,e.prev=17,this.log_.warn("reconnect() try to reconnect uplink [".concat(this.reconnectionCount_,"/").concat(30,"]")),n=gh(this.reconnectionCount_),this.reconnectionTimer_=setTimeout((function(){r.log_.warn("reconnect() uplink reconnect timeout(".concat(n/1e3,"s), try again")),r.signalChannel_.off(wm.UNPUBLISH_RESULT,r.onUnpublishResult,r),r.clearReconnectionTimer(),r.reconnect()}),n),!(this.isSDPExchanging_||this.peerConnection_&&this.peerConnection_.connectionState===tl)){e.next=23;break}return e.abrupt("return");case 23:this.signalChannel_.send(Nm),this.signalChannel_.once(wm.UNPUBLISH_RESULT,this.onUnpublishResult,this),e.next=29;break;case 27:e.prev=27,e.t0=e.catch(17);case 29:case"end":return e.stop()}}),e,this,[[17,27]])}))),function(){return n.apply(this,arguments)})},{key:"onUnpublishResult",value:(t=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,this.reset(),this.initialize(),e.next=5,this.publish(this.localStream_);case 5:e.next=9;break;case 7:e.prev=7,e.t0=e.catch(0);case 9:case"end":return e.stop()}}),e,this,[[0,7]])}))),function(){return t.apply(this,arguments)})},{key:"clearExchangeSDPTimeout",value:function(){-1!==this.exchangeSDPTimeout_&&(clearTimeout(this.exchangeSDPTimeout_),this.exchangeSDPTimeout_=-1)}},{key:"clearReconnectionTimer",value:function(){-1!==this.reconnectionTimer_&&(clearTimeout(this.reconnectionTimer_),this.reconnectionTimer_=-1)}},{key:"handleError",value:function(e){e.getCode()===zm.ICE_TRANSPORT_ERROR&&(this.isFirstConnection_&&(this.isFirstConnection_=!1,Ng.logFailedEvent({userId:this.client_.getUserId(),eventType:vl,error:e})),this.isReconnecting_||this.startReconnection())}},{key:"handleConnectionStateChange",value:function(e){e.state===Zd&&(this.isFirstConnection_&&(this.isFirstConnection_=!1,Ng.logSuccessEvent({userId:this.client_.getUserId(),eventType:vl}),this.addEventInternal(__,"uplink-connection is connected")),this.isReconnecting_&&(Ng.logSuccessEvent({userId:this.client_.getUserId(),eventType:gl}),this.log_.warn("reconnect() uplink reconnect successfully"),this.addEventInternal(b_,"uplink-connection reconnect success"),this.stopReconnection()))}},{key:"updateSSRC",value:function(e){var t=this;try{var n=0;zg(e).media.forEach((function(e){if(e.type===dd){var r=e.ssrcs[0];r&&(t.ssrc_.audio=r.id)}else{var i=e.ssrcs[0];switch(n+=1){case 1:i&&(t.ssrc_.video=i.id);break;case 2:i&&(t.ssrc_.small=i.id)}}}))}catch(JI){}}},{key:"getLocalStreamVideoTrackId",value:function(){if(this.peerConnection_){var e=this.peerConnection_.getSenders().filter((function(e){return e.track&&e.track.kind===ld}));if(e[0])return e[0].track.id}if(this.localStream_){var t=this.localStream_.getVideoTrack();if(t)return t.id}return""}},{key:"getSSRC",value:function(){return this.ssrc_}},{key:"checkPublishResultCode",value:function(e,t){if(0!==e)throw 1028===e?(this.log_.error(Ag.NOT_SUPPORTED_H264ENCODE),new Wm({code:zm.NOT_SUPPORTED_H264,message:Dg({key:bg})})):new Wm({code:zm.UNKNOWN,message:Dg({key:Cg,data:{signalResponse:wm.PUBLISH_RESULT,code:e,message:t}})})}}]),b}(yb),jb=function(e){u(f,e);var t,n,r,o,c,l,h,p=_(f);function f(e){var t;return a(this,f),(t=p.call(this,e)).remoteStreams_=new Map,t.autoSubscribe=e.autoSubscribe,t.trackState_={audio:e.trackState.audio,video:e.trackState.video,auxiliary:e.trackState.auxiliary,smallVideo:e.trackState.smallVideo},t.ssrc_={audio:0,video:0,auxiliary:0},t.subscribeState_={audio:e.autoSubscribe,video:e.autoSubscribe,auxiliary:e.autoSubscribe,smallVideo:!1},t.pendingSubscription_=[],t.pendingStreams_=[],t.subscriptionTimeout_=-1,t.subscriptionRetryCount_=0,t.isSubscriptionPending_=!1,t.isSDPExchanging_=!1,t.installEvents(),t}return s(f,[{key:"isMainStreamSubscribed",get:function(){return(this.subscribeState_.audio||this.subscribeState_.video||this.subscribeState_.smallVideo)&&(this.trackState_.audio||this.trackState_.video||this.trackState_.smallVideo)}},{key:"isAuxStreamSubscribed",get:function(){return this.subscribeState_.auxiliary&&this.trackState_.auxiliary}},{key:"initialize",value:function(){v(d(f.prototype),"initialize",this).call(this),this.peerConnection_.ontrack=this.onTrack.bind(this)}},{key:"close",value:function(){var e=this;v(d(f.prototype),"close",this).call(this),this.trackState_.audio=!1,this.trackState_.video=!1,this.trackState_.auxiliary=!1,this.emitConnectionStateChangedEvent(Xd),-1!==this.subscriptionTimeout_&&(clearTimeout(this.subscriptionTimeout_),this.subscriptionTimeout_=-1),this.remoteStreams_.forEach((function(t){var n=t;n.setConnection(null),n.getIsStreamAddedEventEmitted()&&e.emitter_.emit(Ey,{stream:n})})),this.remoteStreams_.clear(),this.uninstallEvents()}},{key:"installEvents",value:function(){var e=this;zp.on(pf,this.onRemoteStreamUpdate,this),this.signalChannel_.on(wm.SUBSCRIBE_CHANGE_RESULT,this.onSubscribeChangeResult,this),this.signalChannel_.on(wm.UNSUBSCRIBE_RESULT,this.onUnsubscribeResult,this),this.emitter_.on(xy,(function(t){t.getCode()===zm.ICE_TRANSPORT_ERROR&&(e.isFirstConnection_&&(e.isFirstConnection_=!1,Ng.logFailedEvent({userId:e.client_.getUserId(),eventType:yl,error:t})),e.isReconnecting_||e.startReconnection())})),this.emitter_.on(Py,(function(t){t.state===Zd&&e.isFirstConnection_&&(e.isFirstConnection_=!1,Ng.logSuccessEvent({userId:e.client_.getUserId(),eventType:yl}),e.addEventInternal(v_,"downlink-connection is connected"))}))}},{key:"uninstallEvents",value:function(){zp.removeListener(pf,this.onRemoteStreamUpdate,this),this.signalChannel_.removeListener(wm.SUBSCRIBE_CHANGE_RESULT,this.onSubscribeChangeResult,this),this.signalChannel_.removeListener(wm.UNSUBSCRIBE_RESULT,this.onUnsubscribeResult,this)}},{key:"onRemoteStreamUpdate",value:function(e){if(this.hitTest(e.tinyId)&&e.client===this.client_){this.updateTrackState(e.action,e.kind);var t=e.kind===hd?Wd:zd,n=this.remoteStreams_.get(t);if(!n)return;e.action===Jl?this.handleRemoteAddTrack(e.kind,n):this.handleRemoteRemoveTrack(e.kind,n)}}},{key:"handleRemoteAddTrack",value:function(e,t){this.log_.info("remote add ".concat(e," track")),e===dd?t.updateAudioPlayingState(this.subscribeState_.audio):t.updateVideoPlayingState(e===hd?this.subscribeState_.auxiliary:this.subscribeState_.video||this.subscribeState_.smallVideo),t.getIsStreamAddedEventEmitted()?this.emitter_.emit(Cy,{stream:t}):(this.emitter_.emit(wy,{stream:t}),this.currentState_===Zd&&t.emitConnectionStateChanged({prevState:Xd,state:Zd}))}},{key:"handleRemoteRemoveTrack",value:function(e,t){t.getIsStreamAddedEventEmitted()&&(this.log_.info("remote remove ".concat(e," track")),e!==hd&&(this.trackState_.audio||this.trackState_.video)||t.isInSubscriptionCycle()?(e===dd?t.updateAudioPlayingState(!1):t.updateVideoPlayingState(!1),this.emitter_.emit(Cy,{stream:t})):(this.log_.info("remote stream ".concat(t.getType()," removed")),this.currentState_===Zd&&t.emitConnectionStateChanged({prevState:Zd,state:Xd}),this.emitter_.emit(Ey,{stream:t})))}},{key:"updateTrackState",value:function(e,t){var n=e===Jl;switch(t){case dd:this.trackState_.audio=n;break;case ld:this.trackState_.video=n;break;case hd:this.trackState_.auxiliary=n}this.log_.info("trackState updated: ".concat(JSON.stringify(this.trackState_)))}},{key:"onTrack",value:function(e){var t=e.streams[0],n=e.track;if(this.log_.info("ontrack() kind: ".concat(n.kind," id: ").concat(n.id," streamId: ").concat(t.id)),"unified-plan"===this.sdpSemantics_){var r=function(e){var t=Jg.parse(e),n={audio:[],video:[]};return t.media.forEach((function(e){if(e.ssrcs){var t=e.ssrcs[0].id>>16&255;if(e.type===dd)n.audio.push(zd);else if(e.type==ld){var r=t===qd?zd:Wd;n.video.push(r)}}})),n}(this.peerConnection_.remoteDescription.sdp);if(n.kind===dd){if(0===r.audio.length||t.id!==zd)return void this.log_.debug("skip this invalid audio track")}else if(-1===r.video.indexOf(t.id))return void this.log_.debug("skip this invalid video track: ".concat(n.id," msid: ").concat(t.id))}Ng.logEvent({eventType:"ontrack",kind:n.kind});var i=!1,a=this.remoteStreams_.get(t.id),o=t.id===zd?Kd:Qd;if(Sh(a)&&((a=new xb({type:o,userId:this.userId_,client:this.client_})).setConnection(this),this.remoteStreams_.set(t.id,a),i=!0),a.setMediaStream(t),n.kind===dd?a.updateAudioPlayingState(this.subscribeState_.audio):o===Kd?a.updateVideoPlayingState(this.subscribeState_.video||this.subscribeState_.smallVideo):a.updateVideoPlayingState(this.subscribeState_.auxiliary),(o!==Qd||this.trackState_.auxiliary)&&(o!==Kd||this.trackState_.audio||this.trackState_.video)){var s=this.client_.getSubscriptionManager();s&&s.hasAutoRecoveryFlag(this.userId_,o)||(i?this.emitter_.emit(wy,{stream:a}):this.emitter_.emit(Cy,{stream:a}))}}},{key:"addRRTRLine",value:function(e){var t=e.split("\r\n"),n=new Map;t.forEach((function(e,r){/^a=rtcp-fb:/.test(e)&&t[r+1]&&!/^a=rtcp-fb:/.test(t[r+1])&&n.set(r+1,e.match(/^a=rtcp-fb:\d+/)[0]+" rrtr")}));for(var r=y(n),i=0;i<r.length;i++){var a=g(r[i],2),o=a[0],s=a[1];t.splice(o+i,0,s)}return t.join("\r\n")}},{key:"addSPSDescription",value:function(e){var t=zg(e);return t.media.forEach((function(e){e.type===ld&&e.fmtp.forEach((function(e){e.config+=";sps-pps-idr-in-keyframe=1"}))})),Wg(t)}},{key:"removeSDESDescription",value:function(e){var t=["urn:ietf:params:rtp-hdrext:sdes:mid","urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id","urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id"],n=zg(e);return n.media.forEach((function(e){e.ext=e.ext.filter((function(e){return!t.includes(e.uri)}))})),Wg(n)}},{key:"isSubscriptionStateNotChanged",value:function(e,t){return e.getType()===Kd?!Sh(t.audio)&&!Sh(t.video)&&t.audio===this.subscribeState_.audio&&t.video===this.subscribeState_.video:e.getType()===Qd?!Sh(t.video)&&this.subscribeState_.auxiliary===t.video:void 0}},{key:"subscribe",value:(h=i(regeneratorRuntime.mark((function e(t,n){var r,i,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=n.emitEvent,i=void 0===r||r,a=t.getType(),!this.peerConnection_||this.peerConnection_.connectionState!==el&&this.peerConnection_.connectionState!==tl){e.next=5;break}return e.next=5,this.waitForPeerConnectionConnected();case 5:if(!this.isSubscriptionStateNotChanged(t,n)){e.next=12;break}if(this.peerConnection_){e.next=10;break}return this.initialize(),e.next=10,this.connect();case 10:return i&&Sh(n.smallVideo)&&this.emitter_.emit(Ay,{stream:t,result:!0}),e.abrupt("return",t);case 12:if(a===wd?(Sh(n.audio)||(this.subscribeState_.audio=n.audio),Sh(n.video)||(this.subscribeState_.video=n.video),Sh(n.smallVideo)||(this.subscribeState_.smallVideo=n.smallVideo),this.addEventInternal(this.subscribeState_.audio?t_:r_,this.subscribeState_.audio?"subscribe audio":"unsubscribe audio"),this.addEventInternal(this.subscribeState_.video?t_:r_,this.subscribeState_.video?"subscribe video":"unsubscribe video"),this.addEventInternal(this.subscribeState_.smallVideo?E_:C_,this.subscribeState_.smallVideo?"subscribe smallVideo":"unsubscribe smallVideo")):Sh(n.video)||(this.subscribeState_.auxiliary=n.video),this.log_.info("subscribe ".concat(a," stream with options ").concat(JSON.stringify(n)," current state: ").concat(JSON.stringify(this.subscribeState_))),!this.peerConnection_&&!this.isSDPExchanging_){e.next=22;break}return o=Ol,this.isMainStreamSubscribed||this.isAuxStreamSubscribed||(o=Ll),e.next=19,this.sendSubscription(t,o);case 19:a===wd?(t.updateAudioPlayingState(this.subscribeState_.audio),t.updateVideoPlayingState(this.subscribeState_.video||this.subscribeState_.smallVideo)):t.updateVideoPlayingState(this.subscribeState_.auxiliary),e.next=25;break;case 22:return this.initialize(),e.next=25,this.connect();case 25:return i&&Sh(n.smallVideo)&&this.emitter_.emit(Ay,{stream:t,result:!0}),e.abrupt("return",t);case 27:case"end":return e.stop()}}),e,this)}))),function(e,t){return h.apply(this,arguments)})},{key:"unsubscribe",value:(l=i(regeneratorRuntime.mark((function e(t){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((n=t.getType())!==wd){e.next=10;break}if(this.isMainStreamSubscribed){e.next=5;break}return this.log_.info("main stream already unsubscribed"),e.abrupt("return",t);case 5:this.subscribeState_.audio=!1,this.subscribeState_.video=!1,this.subscribeState_.smallVideo=!1,e.next=14;break;case 10:if(this.isAuxStreamSubscribed){e.next=13;break}return this.log_.info("auxiliary stream already unsubscribed"),e.abrupt("return",t);case 13:this.subscribeState_.auxiliary=!1;case 14:return r=Ll,(n===Kd&&this.isAuxStreamSubscribed||n===Qd&&this.isMainStreamSubscribed)&&(r=Ol),this.log_.info("unsubscribe ".concat(n," stream with ").concat(JSON.stringify(this.subscribeState_))),e.next=19,this.sendSubscription(t,r);case 19:return t.updateVideoPlayingState(!1),t.updateAudioPlayingState(!1),r===Ll&&((i=t.getMediaStream())&&i.getTracks().forEach((function(e){return i.removeTrack(e)})),this.closePeerConnection(),this.emitConnectionStateChangedEvent(Xd)),this.addEventInternal(r_,"unsubscribe audio"),this.addEventInternal(n_,"unsubscribe video"),e.abrupt("return",t);case 25:case"end":return e.stop()}}),e,this)}))),function(e){return l.apply(this,arguments)})},{key:"sendSubscription",value:function(e,t){var n=this;return new Promise((function(r,i){var a={srcTinyId:n.tinyId_,srcUserId:n.userId_};t===Ol&&(a={audio:n.subscribeState_.audio,bigVideo:n.subscribeState_.video,auxVideo:n.subscribeState_.auxiliary,smallVideo:n.subscribeState_.smallVideo,srcTinyId:n.tinyId_}),n.pendingSubscription_.length>0?n.log_.debug("queue the subscription for later handling"):n.doSendSubscription(a,e,t),n.pendingSubscription_.push({stream:e,type:t,data:a,callback:function(e){var a=e.code,o=e.message;if(0===a)r();else{var s=new Wm({code:a,message:Dg({key:W_,data:{type:t,message:o}})});n.log_.error(s),i(s)}}}),e.setInSubscriptionCycle(!0)}))}},{key:"doSendSubscription",value:function(e,t,n){var r=this;t&&this.pendingStreams_.push(t),this.log_.debug("doSendSubscription() send SUBSCRIBE command with data: ".concat(JSON.stringify(e))),n===Ol?this.signalChannel_.send(Mm,e):n===Ll&&this.signalChannel_.send(Om,e),this.isSubscriptionPending_=!0,this.subscriptionTimeout_=setTimeout((function(){if(r.isSubscriptionPending_)if(r.log_.debug("subscription timeout"),r.subscriptionRetryCount_+=1,r.subscriptionRetryCount_<=3){r.log_.debug("resend subscription");var e=r.pendingSubscription_[0].data;r.doSendSubscription(e,t,n)}else r.log_.error(Ag.SUBSCRIPTION_TIMEOUT),r.pendingSubscription_.shift(),r.pendingStreams_.shift(),r.isSubscriptionPending_=!1,r.subscriptionRetryCount_=0,r.emitter_.emit(xy,new Wm({code:zm.SUBSCRIPTION_TIMEOUT,message:Dg({key:q_})}))}),5e3)}},{key:"onSubscribeChangeResult",value:function(e){var t=e&&e.data||{},n=t.code,r=t.message,i=t.data.srcTinyId;if(this.hitTest(i)){var a=this.pendingSubscription_[0];a&&a.type===Ol&&a.callback({code:n,message:r}),this.sendNextSubscription()}}},{key:"onUnsubscribeResult",value:function(e){var t=e&&e.data||{},n=t.code,r=t.message,i=t.data.srcTinyId;if(this.hitTest(i)){var a=this.pendingSubscription_[0];a&&a.type===Ll&&a.callback({code:n,message:r}),this.sendNextSubscription()}}},{key:"connect",value:(c=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.exchangeSDP();case 3:return e.next=5,this.waitForPeerConnectionConnected();case 5:e.next=11;break;case 7:throw e.prev=7,e.t0=e.catch(0),this.closePeerConnection(!0),e.t0;case 11:case"end":return e.stop()}}),e,this,[[0,7]])}))),function(){return c.apply(this,arguments)})},{key:"exchangeSDP",value:(o=i(regeneratorRuntime.mark((function e(){var t,n,r,i,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,this.isSDPExchanging_=!0,e.next=4,this.createOffer();case 4:return this.log_.info("createOffer success, sending offer to remote server"),t=this.peerConnection_.localDescription,n=t.type,r=t.sdp,i={type:n,sdp:r,srcUserId:this.userId_,srcTinyId:this.tinyId_,audio:this.subscribeState_.audio,bigVideo:this.subscribeState_.video,auxVideo:this.subscribeState_.auxiliary,smallVideo:this.subscribeState_.smallVideo},zp.emit(Nf,{client:this.client_,connection:this,userId:this.userId_,tinyId:this.tinyId_,role:Gd,subscribeState:this.subscribeState_,trackState:this.trackState_}),e.next=10,this.signalChannel_.sendWaitForResponse({command:Lm,commandDesc:"exchange sdp",data:i,responseCommand:wm.SUBSCRIBE_RESULT});case 10:if(a=e.sent,this.peerConnection_){e.next=15;break}throw o=this.genRemoteStreamNotExistError(),this.log_.warn(o),o;case 15:return e.next=17,this.onSubscribeResult(a);case 17:this.isSDPExchanging_=!1,e.next=24;break;case 20:throw e.prev=20,e.t0=e.catch(0),this.isSDPExchanging_=!1,e.t0;case 24:case"end":return e.stop()}}),e,this,[[0,20]])}))),function(){return o.apply(this,arguments)})},{key:"createOffer",value:(r=i(regeneratorRuntime.mark((function e(){var t,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t={voiceActivityDetection:!1},"RTCPeerConnection"in window&&"addTransceiver"in window.RTCPeerConnection.prototype&&"unified-plan"===this.sdpSemantics_?(this.peerConnection_.addTransceiver(dd,{direction:"recvonly"}),this.peerConnection_.addTransceiver(ld,{direction:"recvonly"}),this.peerConnection_.addTransceiver(ld,{direction:"recvonly"})):(t.offerToReceiveAudio=!0,t.offerToReceiveVideo=!0),e.next=4,this.peerConnection_.createOffer(t);case 4:return n=e.sent,e.next=7,oy();case 7:return e.sent.isH264DecodeSupported||(this.log_.warn("remove h264 desc from sdp"),n.sdp=Kg(n.sdp)),n.sdp=this.addRRTRLine(n.sdp),n.sdp=this.addSPSDescription(n.sdp),n.sdp=qg(n.sdp),"unified-plan"===this.sdpSemantics_&&(n.sdp=this.removeSDESDescription(n.sdp)),e.next=16,this.peerConnection_.setLocalDescription(n);case 16:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"onSubscribeResult",value:(n=i(regeneratorRuntime.mark((function e(t){var n,r,i,a,o,s,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t&&t.data||{},r=n.code,i=n.message,a=void 0===i?"":i,o=t&&t.data&&t.data.data||{},s=o.type,c=o.sdp,77393!==r){e.next=5;break}throw this.log_.error(Ag.NOT_SUPPORTED_H264DECODE),new Wm({code:zm.NOT_SUPPORTED_H264,message:Dg({key:Ig})});case 5:if(e.prev=5,0===r){e.next=8;break}throw new Wm({code:r,message:Dg({key:X_,data:{errMsg:a}})});case 8:return this.log_.debug("accept remote answer: "+c),e.next=11,this.peerConnection_.setRemoteDescription({type:s,sdp:c});case 11:this.updateSSRC(c),e.next=18;break;case 14:throw e.prev=14,e.t0=e.catch(5),this.log_.error(e.t0),e.t0;case 18:case"end":return e.stop()}}),e,this,[[5,14]])}))),function(e){return n.apply(this,arguments)})},{key:"updateSSRC",value:function(e){var t=this;try{zg(e).media.forEach((function(e){if(e.type===dd){var n=e.ssrcs.find((function(e){return e.value.includes(zd)}));n&&(t.ssrc_.audio=n.id)}else{var r=e.ssrcs.find((function(e){return e.value.includes(zd)})),i=e.ssrcs.find((function(e){return e.value.includes(Wd)}));r&&(t.ssrc_.video=r.id),i&&(t.ssrc_.auxiliary=i.id)}}))}catch(JI){}}},{key:"sendNextSubscription",value:function(){void 0!==this.pendingSubscription_.shift()&&(this.subscriptionRetryCount_=0,this.isSubscriptionPending_=!1,-1!==this.subscriptionTimeout_&&(clearTimeout(this.subscriptionTimeout_),this.subscriptionTimeout_=-1));var e=this.pendingStreams_.shift();if(e&&(this.log_.debug("mark ".concat(e.getType()," stream exit subscription cycle")),e.setInSubscriptionCycle(!1)),this.pendingSubscription_.length>0){var t=this.pendingSubscription_[0];this.log_.info("schedule a pending subscription"),this.doSendSubscription(t.data,t.stream,t.type)}}},{key:"setRemoteStream",value:function(e,t){this.remoteStreams_.set(e,t)}},{key:"getSubscribeState",value:function(){return this.subscribeState_}},{key:"getTrackState",value:function(){return this.trackState_}},{key:"getSSRC",value:function(){return this.ssrc_}},{key:"getMainStream",value:function(){return this.remoteStreams_.get(zd)}},{key:"getAuxStream",value:function(){return this.remoteStreams_.get(Wd)}},{key:"getMainStreamVideoTrackId",value:function(){var e=this.getMainStream();if(e){var t=e.getVideoTrack();if(t)return t.id}return""}},{key:"getAuxStreamVideoTrackId",value:function(){var e=this.getAuxStream();if(e){var t=e.getVideoTrack();if(t)return t.id}return""}},{key:"reconnect",value:(t=i(regeneratorRuntime.mark((function e(){var t,n,r=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(-1===this.reconnectionTimer_){e.next=3;break}return this.log_.warn("reconnect() downlink is reconnecting, ignore current reconnection"),e.abrupt("return");case 3:if(!(this.reconnectionCount_>=30)){e.next=12;break}return this.log_.warn("SDK has tried reconnect downlink [".concat(this.userId_,"] for ").concat(30," times, but all failed, please check your network")),this.stopReconnection(),t=new Wm({code:zm.DOWNLINK_RECONNECTION_FAILED,message:Dg({key:Q_})}),Ng.logFailedEvent({userId:this.client_.getUserId(),eventType:Sl,error:t}),this.addEventInternal(w_,"downlink-connection reconnect fail"),this.emitConnectionStateChangedEvent(Xd),this.emitter_.emit(xy,t),e.abrupt("return");case 12:if(this.signalChannel_.getCurrentState()===Im){e.next=16;break}return this.log_.warn("reconnect() signal channel is not connected, suspend reconnection until signal is connected"),this.signalChannel_.once(gm,this.reconnect,this),e.abrupt("return");case 16:if(this.reconnectionCount_++,this.log_.warn("reconnect() try to reconnect downlink [".concat(this.reconnectionCount_,"/").concat(30,"]")),n=gh(this.reconnectionCount_),this.reconnectionTimer_=setTimeout((function(){r.log_.warn("reconnect() downlink [".concat(r.userId_,"] reconnect timeout(").concat(n/1e3,"s), try again")),r.clearReconnectionTimer(),r.reconnect()}),n),!(this.isSDPExchanging_||this.peerConnection_&&this.peerConnection_.connectionState===tl)){e.next=22;break}return e.abrupt("return");case 22:return e.prev=22,this.closePeerConnection(),this.initialize(),e.next=27,this.connect();case 27:this.stopReconnection(),this.log_.warn("reconnect() downlink reconnect successfully"),Ng.logSuccessEvent({userId:this.client_.getUserId(),eventType:Sl}),this.addEventInternal(R_,"downlink-connection reconnect success"),this.recoverSubscription(),e.next=36;break;case 34:e.prev=34,e.t0=e.catch(22);case 36:case"end":return e.stop()}}),e,this,[[22,34]])}))),function(){return t.apply(this,arguments)})},{key:"recoverSubscription",value:function(){var e=this,t=this.client_.getSubscriptionManager();t&&y(this.remoteStreams_.values()).forEach((function(n){t.hasAutoRecoveryFlag(e.userId_,n.getType())&&t.recover(n)}))}},{key:"getIsReconnecting",value:function(){return this.isReconnecting_}},{key:"getSubscribedMainStream",value:function(){var e=null;return this.isMainStreamSubscribed&&(e=this.remoteStreams_.get(zd)),e}},{key:"clearReconnectionTimer",value:function(){-1!==this.reconnectionTimer_&&(clearTimeout(this.reconnectionTimer_),this.reconnectionTimer_=-1)}},{key:"startReconnection",value:function(){var e=this.client_.getSubscriptionManager();if(e){var t,n=b(this.remoteStreams_.values());try{for(n.s();!(t=n.n()).done;){var r=t.value,i=r.getType();(i===Kd&&(this.trackState_.audio||this.trackState_.video)||i===Qd&&this.trackState_.auxiliary)&&e.setAutoRecoveryFlag(this.userId_,r.getType())}}catch(a){n.e(a)}finally{n.f()}}v(d(f.prototype),"startReconnection",this).call(this)}},{key:"getCurrentState",value:function(){return this.currentState_}}]),f}(yb),Bb=function(e){return function(t,n,r,i){ne(n);var a=se(t),o=F(a),s=ot(a),c=e?s-1:0,u=e?-1:1;if(r<2)for(;;){if(c in o){i=o[c],c+=u;break}if(c+=u,e?c<0:s<=c)throw TypeError("Reduce of empty array with no initial value")}for(;e?c>=0:s>c;c+=u)c in o&&(i=n(i,o[c],c,a));return i}},Hb={left:Bb(!1),right:Bb(!0)}.left,Gb=Qi("reduce");Rt({target:"Array",proto:!0,forced:!Gb||!Ns&&$>79&&$<83},{reduce:function(e){return Hb(this,e,arguments.length,arguments.length>1?arguments[1]:void 0)}});var Jb=function(){function e(){a(this,e),this.startTime=0,this.endTime=0,this.start()}return s(e,[{key:"start",value:function(){0===this.startTime&&(this.startTime=Ch())}},{key:"stop",value:function(){0===this.endTime&&(this.endTime=Ch())}},{key:"getDuration",value:function(){return 0===this.endTime?Ch()-this.startTime:this.endTime-this.startTime}}]),e}(),zb=function(){function e(t){a(this,e),this.client_=t.client,this.intervalId_=-1,this.statsCalculator_=t.stats,this.prevStats_=null,this.renderFreezeMap_=new Map,this.remoteStreamMap_=new Map,this.dataFreezeMap_=new Map,this.monitorFreezeData_=new Map}var t,n,r;return s(e,[{key:"installEvents",value:function(){zp.on(Cf,this.handlePlayVideoStart,this),zp.on(Tf,this.onVideoTrackMuted,this),zp.on(Rf,this.onVideoTrackUnmuted,this),zp.on(yf,this.handleStreamStopped,this),zp.on(vf,this.handleStreamStopped,this),zp.on(lf,this.handleVideoPlaying,this)}},{key:"uninstallEvents",value:function(){zp.off(Cf,this.handlePlayVideoStart,this),zp.off(Tf,this.onVideoTrackMuted,this),zp.off(Rf,this.onVideoTrackUnmuted,this),zp.off(yf,this.handleStreamStopped,this),zp.off(vf,this.handleStreamStopped,this),zp.off(lf,this.handleVideoPlaying,this)}},{key:"start",value:function(){var e=this;-1===this.intervalId_&&(this.installEvents(),this.intervalId_=$g.setInterval(i(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e.detectFPS();case 3:t.next=7;break;case 5:t.prev=5,t.t0=t.catch(0);case 7:case"end":return t.stop()}}),t,null,[[0,5]])}))),1e3))}},{key:"stop",value:function(){-1!==this.intervalId_&&(this.uninstallEvents(),$g.clearInterval(this.intervalId_),this.intervalId_=-1,this.renderFreezeMap_.clear(),this.dataFreezeMap_.clear(),this.remoteStreamMap_.clear())}},{key:"onVideoTrackMuted",value:function(e){var t=e.stream;if(t.getClient()===this.client_&&t.isRemote()){var n=t.userId_,r=t.type_,i="".concat(n,"_").concat(r),a=this.dataFreezeMap_.get(i),o=new Jb;a?a.durationItemList.push(o):this.dataFreezeMap_.set(i,{userId:n,type:r,durationItemList:[o],isFreezing:function(){var e=this.durationItemList[this.durationItemList.length-1];return e&&0===e.endTime}})}}},{key:"onVideoTrackUnmuted",value:function(e){var t=e.stream;if(t.getClient()===this.client_&&t.isRemote()){var n=t.userId_,r=t.type_,i="".concat(n,"_").concat(r);this.stopDataFreeze({key:i,userId:n,type:r})}}},{key:"handleStreamStopped",value:function(e){var t=e.client,n=e.stream;if(t===this.client_){var r=n.getUserId(),i=n.getType(),a="".concat(r,"_").concat(i);this.stopDataFreeze({key:a,userId:r,type:i})}}},{key:"stopDataFreeze",value:function(e){var t=e.key,n=e.userId,r=e.type,i=this.dataFreezeMap_.get(t);if(i&&i.isFreezing()){var a=i.durationItemList[i.durationItemList.length-1];a.stop();var o=a.getDuration();o>500?(Ng.logEvent({eventType:"videoFrozenCount",delta:o}),this.monitorFreezeData_.set(t,{userId:n,type:r,duration:o})):i.durationItemList.pop()}}},{key:"getTotalDuration",value:function(e){return e.reduce((function(e,t){var n=t.getDuration();return e+Math.min(n,5e3)}),0)}},{key:"getStats",value:(r=i(regeneratorRuntime.mark((function e(){var t,n,r,i,a,o,s,c,u,d,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=this.client_.getConnections(),n={},r=b(t),e.prev=3,r.s();case 5:if((i=r.n()).done){e.next=20;break}if(a=g(i.value,2),o=a[0],(s=a[1]).getPeerConnection()){e.next=9;break}return e.abrupt("continue",18);case 9:return c=s.getSubscribeState(),u=s.getTrackState(),e.next=13,this.statsCalculator_.getReceiverStats(s);case 13:d=e.sent,(l={userId:d.userId,tinyId:o,hasVideo:u.video&&c.video,hasAuxiliary:u.auxiliary&&c.auxiliary,video:{framesDecoded:0},auxiliary:{framesDecoded:0}}).hasVideo&&(l.video.framesDecoded=d.video.framesDecoded),l.hasAuxiliary&&(l.auxiliary.framesDecoded=d.auxiliary.framesDecoded),n[d.userId]=l;case 18:e.next=5;break;case 20:e.next=25;break;case 22:e.prev=22,e.t0=e.catch(3),r.e(e.t0);case 25:return e.prev=25,r.f(),e.finish(25);case 28:return e.abrupt("return",n);case 29:case"end":return e.stop()}}),e,this,[[3,22,25,28]])}))),function(){return r.apply(this,arguments)})},{key:"detectFPS",value:(n=i(regeneratorRuntime.mark((function e(){var t,n,r,i,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getStats();case 2:if(t=e.sent,this.prevStats_){e.next=6;break}return this.prevStats_=t,e.abrupt("return");case 6:e.t0=regeneratorRuntime.keys(t);case 7:if((e.t1=e.t0()).done){e.next=17;break}if(n=e.t1.value,this.prevStats_[n]){e.next=11;break}return e.abrupt("continue",7);case 11:r=t[n].tinyId,i=this.client_.getMutedStates(),t[n].hasVideo&&this.prevStats_[n].hasVideo&&i.has(r)&&!i.get(r).videoMuted&&(a=t[n].video.framesDecoded-this.prevStats_[n].video.framesDecoded,this.handleRenderFreeze({userId:n,type:Kd,fps:a})),t[n].hasAuxiliary&&this.prevStats_[n].hasAuxiliary&&(o=t[n].auxiliary.framesDecoded-this.prevStats_[n].auxiliary.framesDecoded,this.handleRenderFreeze({userId:n,type:Qd,fps:o})),e.next=7;break;case 17:this.prevStats_=t;case 18:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"handleRenderFreeze",value:(t=i(regeneratorRuntime.mark((function e(t){var n,r,i,a,o,s,c,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=t.userId,r=t.fps,i=t.type,a="".concat(n,"_").concat(i),o=this.renderFreezeMap_.get(a),r<=2?(s=Ch(),o&&!o.isFreeze&&(o.freezeTimeline.push({startTime:s,endTime:void 0}),o.isFreeze=!0),o||this.renderFreezeMap_.set(a,{userId:n,type:i,isFreeze:!0,freezeTimeline:[{startTime:s,endTime:void 0}],renderFreezeTotal:0})):o&&o.isFreeze&&(o.isFreeze=!1,(c=o.freezeTimeline.pop()).endTime=Ch(),u=c.endTime-c.startTime,o.freezeTimeline.push(c),o.renderFreezeTotal+=Math.min(5e3,u));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"handlePlayVideoStart",value:function(e){var t=e.stream;if(t.getClient()===this.client_&&t.isRemote()&&t.hasVideo()){var n="".concat(t.getUserId(),"_").concat(t.getType());if(this.remoteStreamMap_.has(n))this.remoteStreamMap_.get(n).remoteStream=t;else this.remoteStreamMap_.set(n,{isPlayingFired:!1,remoteStream:t})}}},{key:"handleVideoPlaying",value:function(e){var t=e.stream;if(t.isRemote()&&t.getClient()===this.client_){var n="".concat(t.getUserId(),"_").concat(t.getType());if(this.remoteStreamMap_.has(n))this.remoteStreamMap_.get(n).isPlayingFired=!0}}},{key:"getDataFreezeDuration",value:function(e){var t={dataFreeze:0,count:0},n=this.dataFreezeMap_.get(e);if(n){if(n.isFreezing()){var r=n.durationItemList[n.durationItemList.length-1];r.stop(),r.getDuration()<500&&n.durationItemList.pop()}t.dataFreeze=this.getTotalDuration(n.durationItemList),t.count=n.durationItemList.length}return t}},{key:"getRenderFreezeDuration",value:function(e){var t=this.renderFreezeMap_.get(e),n=0,r=0;if(t)if(t.isFreeze){var i=Ch()-t.freezeTimeline[t.freezeTimeline.length-1].startTime;n=t.renderFreezeTotal+Math.min(i,5e3),r=t.freezeTimeline.length}else n=t.renderFreezeTotal;return{renderFreeze:n,count:r}}},{key:"getMonitorFreeze",value:function(){return this.monitorFreezeData_}},{key:"isBlackStream",value:function(e){return!!this.remoteStreamMap_.has(e)&&!this.remoteStreamMap_.get(e).isPlayingFired}},{key:"resetMonitor",value:function(){this.monitorFreezeData_.clear()}}]),e}(),Wb=function e(t){a(this,e),this.userId=t.userId,this.tinyId=t.tinyId,this.role=t.role===Gd?"anchor":"audience"},qb=R((function(e){!function(t){function n(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function r(e,t,r,i,a,o){return n((s=n(n(t,e),n(i,o)))<<(c=a)|s>>>32-c,r);var s,c}function i(e,t,n,i,a,o,s){return r(t&n|~t&i,e,t,a,o,s)}function a(e,t,n,i,a,o,s){return r(t&i|n&~i,e,t,a,o,s)}function o(e,t,n,i,a,o,s){return r(t^n^i,e,t,a,o,s)}function s(e,t,n,i,a,o,s){return r(n^(t|~i),e,t,a,o,s)}function c(e,t){var r,c,u,d,l;e[t>>5]|=128<<t%32,e[14+(t+64>>>9<<4)]=t;var h=1732584193,p=-271733879,f=-1732584194,m=271733878;for(r=0;r<e.length;r+=16)c=h,u=p,d=f,l=m,h=i(h,p,f,m,e[r],7,-680876936),m=i(m,h,p,f,e[r+1],12,-389564586),f=i(f,m,h,p,e[r+2],17,606105819),p=i(p,f,m,h,e[r+3],22,-1044525330),h=i(h,p,f,m,e[r+4],7,-176418897),m=i(m,h,p,f,e[r+5],12,1200080426),f=i(f,m,h,p,e[r+6],17,-1473231341),p=i(p,f,m,h,e[r+7],22,-45705983),h=i(h,p,f,m,e[r+8],7,1770035416),m=i(m,h,p,f,e[r+9],12,-1958414417),f=i(f,m,h,p,e[r+10],17,-42063),p=i(p,f,m,h,e[r+11],22,-1990404162),h=i(h,p,f,m,e[r+12],7,1804603682),m=i(m,h,p,f,e[r+13],12,-40341101),f=i(f,m,h,p,e[r+14],17,-1502002290),h=a(h,p=i(p,f,m,h,e[r+15],22,1236535329),f,m,e[r+1],5,-165796510),m=a(m,h,p,f,e[r+6],9,-1069501632),f=a(f,m,h,p,e[r+11],14,643717713),p=a(p,f,m,h,e[r],20,-373897302),h=a(h,p,f,m,e[r+5],5,-701558691),m=a(m,h,p,f,e[r+10],9,38016083),f=a(f,m,h,p,e[r+15],14,-660478335),p=a(p,f,m,h,e[r+4],20,-405537848),h=a(h,p,f,m,e[r+9],5,568446438),m=a(m,h,p,f,e[r+14],9,-1019803690),f=a(f,m,h,p,e[r+3],14,-187363961),p=a(p,f,m,h,e[r+8],20,1163531501),h=a(h,p,f,m,e[r+13],5,-1444681467),m=a(m,h,p,f,e[r+2],9,-51403784),f=a(f,m,h,p,e[r+7],14,1735328473),h=o(h,p=a(p,f,m,h,e[r+12],20,-1926607734),f,m,e[r+5],4,-378558),m=o(m,h,p,f,e[r+8],11,-2022574463),f=o(f,m,h,p,e[r+11],16,1839030562),p=o(p,f,m,h,e[r+14],23,-35309556),h=o(h,p,f,m,e[r+1],4,-1530992060),m=o(m,h,p,f,e[r+4],11,1272893353),f=o(f,m,h,p,e[r+7],16,-155497632),p=o(p,f,m,h,e[r+10],23,-1094730640),h=o(h,p,f,m,e[r+13],4,681279174),m=o(m,h,p,f,e[r],11,-358537222),f=o(f,m,h,p,e[r+3],16,-722521979),p=o(p,f,m,h,e[r+6],23,76029189),h=o(h,p,f,m,e[r+9],4,-640364487),m=o(m,h,p,f,e[r+12],11,-421815835),f=o(f,m,h,p,e[r+15],16,530742520),h=s(h,p=o(p,f,m,h,e[r+2],23,-995338651),f,m,e[r],6,-198630844),m=s(m,h,p,f,e[r+7],10,1126891415),f=s(f,m,h,p,e[r+14],15,-1416354905),p=s(p,f,m,h,e[r+5],21,-57434055),h=s(h,p,f,m,e[r+12],6,1700485571),m=s(m,h,p,f,e[r+3],10,-1894986606),f=s(f,m,h,p,e[r+10],15,-1051523),p=s(p,f,m,h,e[r+1],21,-2054922799),h=s(h,p,f,m,e[r+8],6,1873313359),m=s(m,h,p,f,e[r+15],10,-30611744),f=s(f,m,h,p,e[r+6],15,-1560198380),p=s(p,f,m,h,e[r+13],21,1309151649),h=s(h,p,f,m,e[r+4],6,-145523070),m=s(m,h,p,f,e[r+11],10,-1120210379),f=s(f,m,h,p,e[r+2],15,718787259),p=s(p,f,m,h,e[r+9],21,-343485551),h=n(h,c),p=n(p,u),f=n(f,d),m=n(m,l);return[h,p,f,m]}function u(e){var t,n="",r=32*e.length;for(t=0;t<r;t+=8)n+=String.fromCharCode(e[t>>5]>>>t%32&255);return n}function d(e){var t,n=[];for(n[(e.length>>2)-1]=void 0,t=0;t<n.length;t+=1)n[t]=0;var r=8*e.length;for(t=0;t<r;t+=8)n[t>>5]|=(255&e.charCodeAt(t/8))<<t%32;return n}function l(e){var t,n,r="";for(n=0;n<e.length;n+=1)t=e.charCodeAt(n),r+="0123456789abcdef".charAt(t>>>4&15)+"0123456789abcdef".charAt(15&t);return r}function h(e){return unescape(encodeURIComponent(e))}function p(e){return function(e){return u(c(d(e),8*e.length))}(h(e))}function f(e,t){return function(e,t){var n,r,i=d(e),a=[],o=[];for(a[15]=o[15]=void 0,i.length>16&&(i=c(i,8*e.length)),n=0;n<16;n+=1)a[n]=909522486^i[n],o[n]=1549556828^i[n];return r=c(a.concat(d(t)),512+8*t.length),u(c(o.concat(r),640))}(h(e),h(t))}function m(e,t,n){return t?n?f(t,e):l(f(t,e)):n?p(e):l(p(e))}e.exports?e.exports=m:t.md5=m}(T)})),Kb=function(){function e(t){a(this,e),this.client_=t.client,this.signalChannel_=t.signalChannel,this.log_=Bf.createLogger({id:"mix|"+this.client_.getUserId(),userId:t.client.getUserId(),sdkAppId:t.client.getSDKAppId()}),this.isMixing_=!1,this.config_=null,this.data_=null,this.remoteStreamMap_=new Map,this.installEvents()}var t,n,r,o;return s(e,[{key:"isPresetLayoutMode",get:function(){return this.config_&&this.config_.mode===Ml.PRESET_LAYOUT}},{key:"installEvents",value:function(){zp.on(_f,this.onStreamSubscribed,this),zp.on(vf,this.onStreamUnsubscribed,this),this.client_.on("stream-removed",this.onStreamRemoved,this)}},{key:"uninstallEvents",value:function(){zp.off(_f,this.onStreamSubscribed,this),zp.off(vf,this.onStreamUnsubscribed,this),this.client_.off("stream-removed",this.onStreamRemoved,this)}},{key:"stop",value:function(){this.uninstallEvents()}},{key:"onStreamSubscribed",value:function(e){var t=e.client,n=e.stream;t===this.client_&&(this.remoteStreamMap_.set(n.getId(),{remoteStream:n,isUsed:!1}),this.isMixing_&&this.hasAvailablePlaceHolder()&&this.startMixTranscode(this.config_))}},{key:"onStreamUnsubscribed",value:function(e){var t=e.client,n=e.stream;t===this.client_&&this.onStreamRemoved({stream:n})}},{key:"onStreamRemoved",value:function(e){var t=e.stream;if(this.remoteStreamMap_.has(t.getId())){var n=this.remoteStreamMap_.get(t.getId()).isUsed;this.remoteStreamMap_.delete(t.getId()),this.isMixing_&&this.isPresetLayoutMode&&n&&this.startMixTranscode(this.config_)}}},{key:"startMixTranscode",value:(o=i(regeneratorRuntime.mark((function e(t){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,this.resetIsUsedFlag(),this.config_=t,n=this.getInputParam(t,this.remoteStreamMap_),r=this.getOutputParam(t),i=this.getOutputSessionId({config:t,roomId:this.client_.getRoomId(),userId:this.client_.getUserId()}),!this.isMixing_||!this.data_||i===this.data_.outputSessionId){e.next=10;break}return this.log_.info("startMixTranscode() streamId changed, stop mixing before start"),e.next=10,this.doStopMixTranscode();case 10:return e.next=12,this.doStartMixTranscode({outputSessionId:i,inputParam:n,outputParam:r});case 12:e.next=18;break;case 14:throw e.prev=14,e.t0=e.catch(0),this.resetIsUsedFlag(),e.t0;case 18:case"end":return e.stop()}}),e,this,[[0,14]])}))),function(e){return o.apply(this,arguments)})},{key:"doStartMixTranscode",value:(r=i(regeneratorRuntime.mark((function e(t){var n,r,i,a,o,s,c,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.outputSessionId,r=t.inputParam,i=t.outputParam,a={roomId:String(this.client_.getRoomId()),mcuRequestTime:Date.now(),outputSessionId:n,inputParam:r,outputParam:i},this.data_=a,this.log_.info("startMixTranscode: ".concat(JSON.stringify(a))),this.isMixing_=!0,e.prev=5,e.next=8,this.signalChannel_.sendWaitForResponse({command:Bm,data:a,timeout:5e3,responseCommand:wm.START_MIX_TRANSCODE_RES,commandDesc:"startMixTranscode"});case 8:if(o=e.sent,s=o.data,c=s.code,u=s.message,0===c){e.next=15;break}throw-102083===c&&(u="Please enable relayed-push in ".concat("https://console.cloud.tencent.com/trtc"," and try later, refer to ").concat(uh,"tutorial-26-advanced-publish-cdn-stream.html")),this.log_.error("startMixTranscode failed, errCode: ".concat(c," errMsg: ").concat(u)),this.isMixing_=!1,new Wm({code:zm.START_MIX_TRANSCODE_FAILED,message:Dg({key:rg,data:{message:u},link:{className:"Client",fnName:"startMixTranscode"}})});case 15:e.next=21;break;case 17:throw e.prev=17,e.t0=e.catch(5),this.isMixing_=!1,e.t0;case 21:case"end":return e.stop()}}),e,this,[[5,17]])}))),function(e){return r.apply(this,arguments)})},{key:"stopMixTranscode",value:(n=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isMixing_){e.next=2;break}throw new Wm({code:zm.INVALID_OPERATION,message:Dg({key:ag})});case 2:return e.next=4,this.doStopMixTranscode();case 4:this.resetIsUsedFlag();case 5:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"doStopMixTranscode",value:(t=i(regeneratorRuntime.mark((function e(){var t,n,r,i,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t={mcuRequestTime:Date.now(),outputSessionId:this.data_.outputSessionId,streamType:this.data_.outputParam.streamType},this.log_.info("stopMixTranscode: ".concat(JSON.stringify(t))),e.next=4,this.signalChannel_.sendWaitForResponse({command:Hm,data:t,timeout:5e3,responseCommand:wm.STOP_MIX_TRANSCODE_RES,commandDesc:"stopMixTranscode"});case 4:if(n=e.sent,r=n.data,i=r.code,a=r.message,0!==i){e.next=10;break}this.isMixing_=!1,e.next=12;break;case 10:throw this.log_.error("stopMixTranscode failed, errCode: ".concat(i," errMsg: ").concat(a)),new Wm({code:zm.STOP_MIX_TRANSCODE_FAILED,message:Dg({key:ig,data:{message:a},link:{className:"Client",fnName:"stopMixTranscode"}})});case 12:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"getOutputSessionId",value:function(e){var t=e.config,n=e.userId,r=e.roomId;return kh(t.streamId)&&t.streamId.length>0?t.streamId:qb("".concat(r,"_").concat(n,"_main"))}},{key:"getInputParam",value:function(e,t){var n=this,r=e.mixUsers.map((function(e){return{userId:e.userId,roomId:String(e.roomId||n.client_.getRoomId()),width:e.width||0,height:e.height||0,locationX:e.locationX||0,locationY:e.locationY||0,zOrder:e.zOrder,streamType:Sh(e.streamType)||e.streamType!==Qd?0:1,inputType:e.pureAudio?Vl.IT_PURE_AUDIO:Vl.IT_AUDIO_VIDEO}}));return e.mode===Ml.PRESET_LAYOUT&&(r.forEach((function(e){if(e.userId===Ul.REMOTE){var n=y(t.values()).find((function(e){return!e.isUsed}));n&&(e.userId=n.remoteStream.getUserId(),e.streamType=n.remoteStream.getType()===Qd?1:0,n.isUsed=!0)}})),r=r.filter((function(e){return e.userId!==Ul.REMOTE}))),r}},{key:"getOutputParam",value:function(e){var t=e.streamId||"";return{streamId:t,streamType:t.length>0?1:0,width:Sh(e.videoWidth)?640:e.videoWidth,height:Sh(e.videoHeight)?480:e.videoHeight,videoBps:e.videoBitrate||0,fps:e.videoFramerate||15,gop:e.videoGOP||2,audioSampleRate:e.audioSampleRate||48e3,audioBps:e.audioBitrate||64,audioChannels:e.audioChannels||1,backgroundColor:e.backgroundColor||0,backgroundImg:e.backgroundImage||"",extraInfo:"",videoCodec:2,audioCodec:0}}},{key:"hasAvailablePlaceHolder",value:function(){return!!this.isPresetLayoutMode&&this.data_.inputParam.length!==this.config_.mixUsers.length}},{key:"resetIsUsedFlag",value:function(){this.remoteStreamMap_.forEach((function(e){return e.isUsed=!1}))}}]),e}(),Qb=function(){function e(t){a(this,e),this.client_=t.client,this.signalChannel_=t.signalChannel,this.isPublishingTencentCDN_=!1,this.publishTencentStreamRetryCount_=0,this.publishGivenCDNData_=null,this.isPublishingGivenCDN_=!1}var t,n,r,o,c;return s(e,[{key:"getIsPublishingTencentCDN",value:function(){return this.isPublishingTencentCDN_}},{key:"getIsPublishingGivenCDN",value:function(){return this.isPublishingGivenCDN_}},{key:"startPublishTencentCDN",value:(c=i(regeneratorRuntime.mark((function e(t){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=t.streamId)||(r="".concat(this.client_.getRoomId(),"_").concat(this.client_.getUserId(),"_main"),/^[A-Za-z\d_-]*$/.test(r)||(r=qb(r)),n="".concat(this.client_.getSDKAppId(),"_").concat(r)),i={requestTime:Date.now(),sessionId:qb("".concat(this.client_.getRoomId(),"_").concat(this.client_.getUserId(),"_main")),streamId:n,streamType:0},this.isPublishingTencentCDN_=!0,this.publishTencentStreamRetryCount_=0,e.next=7,this.doStartPublishTencentCDN(i);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"doStartPublishTencentCDN",value:(o=i(regeneratorRuntime.mark((function e(t){var n,r,i,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,Bf.info("startPublishTencentCDN: "+JSON.stringify(t)),e.next=4,this.signalChannel_.sendWaitForResponseWithRetry({command:Um,data:t,timeout:2e3,responseCommand:wm.START_PUBLISH_TENCENT_CDN_RES,commandDesc:"startPublishCDNStream",retries:2});case 4:if(n=e.sent,r=n.data,i=r.code,a=r.message,0===i){e.next=11;break}throw this.isPublishingTencentCDN_=!1,-102083===i&&(a="Please enable relayed-push in ".concat("https://console.cloud.tencent.com/trtc"," and try later, refer to ").concat(uh,"tutorial-26-advanced-publish-cdn-stream.html")),Bf.error("startPublishTencentCDN failed, errCode: ".concat(i,", errMsg: ").concat(a)),new Wm({code:zm.START_PUBLISH_CDN_FAILED,message:Dg({key:Av,data:{message:a},link:{className:"Client",fnName:"startPublishCDNStream"}})});case 11:e.next=17;break;case 13:throw e.prev=13,e.t0=e.catch(0),this.isPublishingTencentCDN_=!1,e.t0;case 17:case"end":return e.stop()}}),e,this,[[0,13]])}))),function(e){return o.apply(this,arguments)})},{key:"stopPublishTencentCDN",value:(r=i(regeneratorRuntime.mark((function e(){var t,n,r,i,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t={requestTime:Date.now(),sessionId:qb("".concat(this.client_.getRoomId(),"_").concat(this.client_.getUserId(),"_main"))},Bf.info("stopPublishTencentCDN: "+JSON.stringify(t)),e.next=4,this.signalChannel_.sendWaitForResponse({command:Vm,data:t,timeout:5e3,responseCommand:wm.STOP_PUBLISH_TENCENT_CDN_RES,commandDesc:"stopPublishCDNStream"});case 4:if(n=e.sent,r=n.data,i=r.code,a=r.message,0!==i){e.next=10;break}this.isPublishingTencentCDN_=!1,e.next=17;break;case 10:if(-102069!==i){e.next=15;break}Bf.warn("stopPublishTencentCDN failed, can not stopPublishTencentCDN in auto relayed-push mode"),this.isPublishingTencentCDN_=!1,e.next=17;break;case 15:throw Bf.error("stopPublishTencentCDN failed, errCode: ".concat(i," errMsg: ").concat(a)),new Wm({code:zm.STOP_PUBLISH_CDN_FAILED,message:Dg({key:xv,data:{message:a},link:{className:"Client",fnName:"stopPublishCDNStream"}})});case 17:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"startPublishGivenCDN",value:(n=i(regeneratorRuntime.mark((function e(t){var n,r,i,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n={pushRequestTime:Date.now(),pushAppId:t.appId,pushBizId:t.bizId,pushCdnUrl:t.url,pushStreamType:"main"},Bf.info("startPublishGivenCDN: "+JSON.stringify(n)),this.publishGivenCDNData_=n,this.isPublishingGivenCDN_=!0,e.prev=4,e.next=7,this.signalChannel_.sendWaitForResponse({command:Fm,data:n,timeout:5e3,responseCommand:wm.START_PUBLISH_GIVEN_CDN_RES,commandDesc:"startPublishCDNStream"});case 7:if(r=e.sent,i=r.data,a=i.code,o=i.message,0===a){e.next=13;break}throw Bf.error("startPublishGivenCDN failed, errCode: ".concat(a,", errMsg: ").concat(o)),this.isPublishingGivenCDN_=!1,new Wm({code:zm.START_PUBLISH_CDN_FAILED,message:Dg({key:Av,data:{message:o},link:{className:"Client",fnName:"startPublishCDNStream"}})});case 13:e.next=19;break;case 15:throw e.prev=15,e.t0=e.catch(4),this.isPublishingGivenCDN_=!1,e.t0;case 19:case"end":return e.stop()}}),e,this,[[4,15]])}))),function(e){return n.apply(this,arguments)})},{key:"stopPublishGivenCDN",value:(t=i(regeneratorRuntime.mark((function e(){var t,n,r,i,a,o,s,c,u,d;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this.publishGivenCDNData_,n=t.pushAppId,r=t.pushBizId,i=t.pushCdnUrl,a=t.pushStreamType,o={pushRequestTime:Date.now(),pushAppId:n,pushBizId:r,pushCdnUrl:i,pushStreamType:a},Bf.info("stopPublishGivenCDN: "+JSON.stringify(o)),e.next=5,this.signalChannel_.sendWaitForResponse({command:jm,data:o,timeout:5e3,responseCommand:wm.STOP_PUBLISH_GIVEN_CDN_RES,commandDesc:"stopPublishCDNStream"});case 5:if(s=e.sent,c=s.data,u=c.code,d=c.message,0!==u){e.next=11;break}this.isPublishingGivenCDN_=!1,e.next=13;break;case 11:throw Bf.error("stopPublishGivenCDN failed, errCode: ".concat(u," errMsg: ").concat(d)),new Wm({code:zm.STOP_PUBLISH_CDN_FAILED,message:Dg({key:xv,data:{message:d},link:{className:"Client",fnName:"stopPublishCDNStream"}})});case 13:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),e}(),Xb=function(){function e(t){a(this,e),this.client_=t.client,this.durationMap_=new Map,this.installEvents()}return s(e,[{key:"installEvents",value:function(){zp.on(_f,this.handleSubscribed,this),zp.on(pf,this.handleStreamTrackUpdated,this),zp.on(vf,this.handleStreamStopped,this),zp.on(yf,this.handleStreamStopped,this)}},{key:"uninstallEvents",value:function(){zp.off(_f,this.handleSubscribed,this),zp.off(gf,this.handleStreamTrackUpdated,this),zp.off(vf,this.handleStreamStopped,this),zp.off(yf,this.handleStreamStopped,this)}},{key:"handleSubscribed",value:function(e){var t=e.client,n=e.stream;if(t===this.client_){var r=n.getUserId(),i=n.getType(),a="".concat(r,"_").concat(i);if(n.hasAudio())if(n.isMainAudioSubscribed){var o=new Jb,s=this.durationMap_.get(a);s?this.isRecording(s.audio)||s.audio.push(o):this.durationMap_.set(a,{userId:r,type:i,audio:[o],video:[]})}else this.stopDurationItem(a,dd);if(n.hasVideo())if(i===Kd&&n.isMainVideoSubscribed||i===Qd&&n.isAuxVideoSubscribed){var c=new Jb,u=this.durationMap_.get(a);u?this.isRecording(u.video)||u.video.push(c):this.durationMap_.set(a,{userId:r,type:i,audio:[],video:[c]})}else this.stopDurationItem(a,ld)}}},{key:"handleStreamStopped",value:function(e){var t=e.client,n=e.stream;if(this.clientHitTest(t)){var r=n.getUserId(),i=n.getType(),a="".concat(r,"_").concat(i);this.stopDurationItem(a,dd),this.stopDurationItem(a,ld)}}},{key:"handleStreamTrackUpdated",value:function(e){var t=e.client,n=e.userId,r=e.tinyId,i=e.kind,a=e.action;if(this.clientHitTest(t)&&this.client_.getConnections().has(r)){var o=i===hd?i:Kd,s="".concat(n,"_").concat(o);if(a===Jl){var c=this.client_.getConnections().get(r).getSubscribeState();if(i===dd&&!c.audio||i===ld&&!c.video||i===hd&&!c.auxiliary)return;var u=new Jb,d=this.durationMap_.get(s);d?(i!==dd||this.isRecording(d.audio)||d.audio.push(u),i===dd||this.isRecording(d.video)||d.video.push(u)):this.durationMap_.set(s,{userId:n,type:o,audio:i===dd?[u]:[],video:i===dd?[]:[u]})}else this.stopDurationItem(s,i===dd?dd:ld)}}},{key:"isRecording",value:function(e){return e.findIndex((function(e){return 0===e.endTime}))>=0}},{key:"stopDurationItem",value:function(e,t){if(this.durationMap_.has(e)){var n=this.durationMap_.get(e)[t].find((function(e){return 0===e.endTime}));n&&n.stop()}}},{key:"clientHitTest",value:function(e){return this.client_===e}},{key:"getDuration",value:function(e,t){return this.durationMap_.has(e)?this.durationMap_.get(e)[t].reduce((function(e,t){return e+t.getDuration()}),0):0}},{key:"getDurationMap",value:function(){return this.durationMap_}},{key:"reset",value:function(){this.durationMap_.clear()}}]),e}(),$b=ti.f,Yb=x((function(){return!Object.getOwnPropertyNames(1)}));Rt({target:"Object",stat:!0,forced:Yb},{getOwnPropertyNames:$b});var Zb={msg_user_info:0,uint32_video_avg_fps:0,uint32_video_width:0,uint32_video_height:0,uint32_video_avg_bitrate:0,uint32_video_block_time:0,uint32_video_play_time:0,uint32_audio_block_time:0,uint32_audio_play_time:0,uint32_audio_play_db:0,uint32_avg_down_loss:0,uint32_stream_type:0,uint32_video_render_first:0,uint32_video_block_count:0,uint32_audio_block_count:0,uint32_audio_bitrate:0,uint32_video_black_screen_subjective:0,uint32_audio_recv_bitrate:0,uint32_video_external_block_time:0},eI=function e(t){a(this,e),this.str_identifier=String(t.userId),this.uint64_tinyid=Number(t.tinyId),this.uint32_role=t.role},tI=function(){function e(t){var n=this;a(this,e),this.frameWorkType_=t.frameWorkType||30,this.client_=t.client,this.keyPrefix_="key_point",this.storageKey_="".concat(this.keyPrefix_,"_").concat(this.client_.getUserId()),this.log_=Bf.createLogger({id:"kpm|"+this.client_.getUserId(),userId:this.client_.getUserId(),sdkAppId:this.client_.getSDKAppId()}),this.upload=Vf({retryFunction:this.upload,settings:{timeout:500,retries:3},onError:function(e,t){return t()}}),Object.getOwnPropertyNames(this.__proto__).forEach((function(e){e.startsWith("handle")&&yh(n[e])&&(n[e]=function(e){var t=e.fn,n=e.context;return i(regeneratorRuntime.mark((function e(){var r,i,a,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(e.prev=0,r=o.length,i=new Array(r),a=0;a<r;a++)i[a]=o[a];return e.next=4,t.apply(n||this,i);case 4:return e.abrupt("return",e.sent);case 7:e.prev=7,e.t0=e.catch(0),Bf.error("".concat(t.name,"() error observed ")+e.t0);case 10:case"end":return e.stop()}}),e,this,[[0,7]])})))}({fn:n[e],context:n}))})),this.initData(),this.installEvents(),this.intervalId_=$g.setInterval(this.setStorage.bind(this),2e4)}var n,r,o;return s(e,[{key:"initData",value:function(){this.firstPublishedUserList_=[],this.networkQuality_={totalUplinkRTT:0,totalUplinkLoss:0,count:0,totalDownlinkRTTAndLossMap:new Map},this.basicInfo={string_sdk_version:"4.12.2",uint32_os_type:15,string_device_name:"",string_http_user_agent:navigator.userAgent,string_os_version:"",uint32_avg_rtt:0,uint32_avg_up_loss:0,uint32_scene:"live"===this.client_.getMode()?1:0,uint32_joining_duration:0,uint32_networkType:Wl[_h()],uint32_framework:this.frameWorkType_},this.pathJoinRoom_={uint64_start_time:0,uint64_init_audio_start_time:0,uint64_init_audio_end_time:0,uint64_init_camera_start_time:0,uint64_init_camera_end_time:0,uint64_send_request_acc_ip_cmd_start_time:0,uint64_send_request_acc_ip_cmd_end_time:0,uint64_send_request_enter_room_cmd_start_time:0,uint64_send_request_enter_room_cmd_end_time:0,uint64_send_first_video_frame_time:0,uint64_recv_userlist_time:0,uint64_end_time:0,int32_init_audio_ret:0,int32_init_camera_ret:0,int32_send_request_acc_ip_cmd_ret:0,int32_send_request_enter_room_cmd_ret:0,int32_end_ret:0},this.pathLeaveRoom_={uint64_start_time:0,uint64_send_request_exit_room_cmd_start_time:0,uint64_send_request_exit_room_cmd_end_time:0,uint64_end_time:0,int32_send_request_exit_room_cmd_ret:0,int32_end_ret:0},this.pathMainVideoMap_=new Map,this.pathMainAudioMap_=new Map,this.pathAuxiliaryMap_=new Map,this.localStreamStats_={totalVideoBitrate:0,totalVideoFPS:0,totalVideoHeight:0,totalVideoWidth:0,totalAudioLevel:0,videoCount:0,audioLevelCount:0,publishStartTime:0,statsToReport:{uint32_audio_capture_db:0,uint32_video_big_capture_fps:0,uint32_video_big_bitrate:0,uint32_video_big_resolution:0}},this.remoteStreamStatsMap_=new Map}},{key:"installEvents",value:function(){zp.on(Wp,this.handleJoinStart,this),zp.on(rf,this.handleWSStart,this),zp.on(af,this.handleWSEnd,this),zp.on(qp,this.handleJoinSendCMD,this),zp.on(Kp,this.handleJoinReceivedCMDResponce,this),zp.on(Qp,this.handleJoinSuccess,this),zp.on(Xp,this.handleJoinFailed,this),zp.on(tf,this.handleReceivedPublishUserList,this),zp.on(Df,this.handleConnectionStateChanged,this),zp.on($p,this.handleLeaveStart,this),zp.on(Zp,this.handleLeaveSuccess,this),zp.on(Yp,this.handleLeaveSendCMD,this),zp.on(Nf,this.handleSendSubscribeCMD,this),zp.on(lf,this.handleVideoPlaying,this),zp.on(hf,this.handleAudioPlaying,this),zp.on(Lf,this.handleNetworkQuality,this),zp.on(ef,this.handleHeartbeatStats,this),zp.on(ff,this.handleRemoteStreamAdded,this),zp.on(mf,this.handleRemoteStreamSubscribeStart,this),zp.on(_f,this.handleRemoteStreamSubscribed,this),zp.on(Ef,this.handleVideoLoadedData,this),zp.on(wf,this.handlePlayStream,this),zp.on(nf,this.handlePublishStart,this),zp.on(kf,this.handleLocalStreamInitStart,this),zp.on(bf,this.handleLocalStreamInitEnd,this),zp.on(If,this.handleLocalStreamInitFailed,this)}},{key:"uninstallEvents",value:function(){zp.off(Wp,this.handleJoinStart,this),zp.off(rf,this.handleWSStart,this),zp.off(af,this.handleWSEnd,this),zp.off(qp,this.handleJoinSendCMD,this),zp.off(Kp,this.handleJoinReceivedCMDResponce,this),zp.off(tf,this.handleReceivedPublishUserList,this),zp.off(Df,this.handleConnectionStateChanged,this),zp.off($p,this.handleLeaveStart,this),zp.off(Zp,this.handleLeaveSuccess,this),zp.off(Qp,this.handleJoinSuccess,this),zp.off(Xp,this.handleJoinFailed,this),zp.off(Yp,this.handleLeaveSendCMD,this),zp.off(Nf,this.handleSendSubscribeCMD,this),zp.off(lf,this.handleVideoPlaying,this),zp.off(hf,this.handleAudioPlaying,this),zp.off(Lf,this.handleNetworkQuality,this),zp.off(ef,this.handleHeartbeatStats,this),zp.off(ff,this.handleRemoteStreamAdded,this),zp.off(mf,this.handleRemoteStreamSubscribeStart,this),zp.off(_f,this.handleRemoteStreamSubscribed,this),zp.off(Ef,this.handleVideoLoadedData,this),zp.off(wf,this.handlePlayStream,this),zp.off(nf,this.handlePublishStart,this),zp.off(kf,this.handleLocalStreamInitStart,this),zp.off(bf,this.handleLocalStreamInitEnd,this),zp.off(If,this.handleLocalStreamInitFailed,this)}},{key:"handleJoinStart",value:function(e){this.hitTest(e.client)&&0===this.pathJoinRoom_.uint64_start_time&&(this.pathJoinRoom_.uint64_start_time=Date.now(),this.checkStorage())}},{key:"handleWSStart",value:function(e){var t=e.client;this.hitTest(t)&&0===this.pathJoinRoom_.uint64_send_request_acc_ip_cmd_start_time&&(this.pathJoinRoom_.uint64_send_request_acc_ip_cmd_start_time=Date.now())}},{key:"handleWSEnd",value:function(e){var t=e.client,n=e.error;this.hitTest(t)&&0===this.pathJoinRoom_.uint64_send_request_acc_ip_cmd_end_time&&(this.pathJoinRoom_.uint64_send_request_acc_ip_cmd_end_time=Date.now(),n&&(this.pathJoinRoom_.int32_send_request_acc_ip_cmd_ret=n instanceof Wm?Number(n.getExtraCode()||n.getCode()):zm.UNKNOWN,this.pathJoinRoom_.int32_end_ret=2))}},{key:"handleJoinSendCMD",value:function(e){this.hitTest(e.client)&&0===this.pathJoinRoom_.uint64_send_request_enter_room_cmd_start_time&&(this.pathJoinRoom_.uint64_send_request_enter_room_cmd_start_time=Date.now())}},{key:"handleJoinReceivedCMDResponce",value:function(e){this.hitTest(e.client)&&0===this.pathJoinRoom_.uint64_send_request_enter_room_cmd_end_time&&(this.pathJoinRoom_.uint64_send_request_enter_room_cmd_end_time=Date.now(),this.pathJoinRoom_.int32_send_request_enter_room_cmd_ret=e.code,0!==e.code&&(this.pathJoinRoom_.int32_end_ret=3))}},{key:"handleJoinSuccess",value:function(e){this.hitTest(e.client)&&0===this.pathJoinRoom_.uint64_end_time&&(this.pathJoinRoom_.uint64_end_time=Date.now(),this.pathJoinRoom_.int32_end_ret=0)}},{key:"handleJoinFailed",value:function(e){var t=e.client;this.hitTest(t)&&(this.pathJoinRoom_.uint64_end_time=Date.now(),0===this.pathJoinRoom_.int32_end_ret&&(this.pathJoinRoom_.int32_end_ret=3),this.prepareReport(),this.report())}},{key:"handleReceivedPublishUserList",value:function(e){this.hitTest(e.client)&&0===this.pathJoinRoom_.uint64_recv_userlist_time&&(this.pathJoinRoom_.uint64_recv_userlist_time=Date.now(),this.firstPublishedUserList_=e.data.data&&e.data.data.userList||[])}},{key:"handleConnectionStateChanged",value:function(e){var t=e.client,n=e.state,r=e.connection;if(this.hitTest(t)&&n===Zd){this.client_.getUplinkConnection()===r&&0===this.pathJoinRoom_.uint64_send_first_video_frame_time&&this.localStreamStats_.publishStartTime>this.pathJoinRoom_.uint64_end_time&&this.localStreamStats_.publishStartTime-this.pathJoinRoom_.uint64_end_time<=100&&(this.pathJoinRoom_.uint64_send_first_video_frame_time=Date.now());var i=this.pathMainVideoMap_.get("".concat(r.getUserId(),"_").concat(Kd));i&&0===i.statsToReport.uint64_pc_connected_time&&(i.statsToReport.uint64_pc_connected_time=Date.now())}}},{key:"handleLeaveStart",value:function(e){this.hitTest(e.client)&&(this.pathLeaveRoom_.uint64_start_time=Date.now())}},{key:"handleLeaveSuccess",value:function(e){this.hitTest(e.client)&&0===this.pathLeaveRoom_.uint64_end_time&&(this.pathLeaveRoom_.uint64_end_time=Date.now(),0!==this.pathJoinRoom_.uint64_end_time?this.basicInfo.uint32_joining_duration=this.pathLeaveRoom_.uint64_end_time-this.pathJoinRoom_.uint64_end_time:this.log_.warn("pathJoinRoom endTime is 0"),this.report())}},{key:"handleLeaveSendCMD",value:function(e){this.hitTest(e.client)&&(this.pathLeaveRoom_.uint64_send_request_exit_room_cmd_start_time=Date.now(),this.pathLeaveRoom_.uint64_send_request_exit_room_cmd_end_time=Date.now())}},{key:"handleRemoteStreamAdded",value:function(e){var n=e.client,r=e.stream;if(this.hitTest(n)){var i=r.getUserId(),a=r.getType(),o="".concat(i,"_").concat(a),s=this.remoteStreamStatsMap_.get(o);if(s)s.stream=r;else{var c={userId:i,totalVideoFPS:0,totalVideoBitrate:0,totalAudioLevel:0,totalAudioBitrate:0,totalLoss:0,audioCount:0,audioLevelCount:0,videoCount:0,networkQualityCount:0,streamAddedTime:Date.now(),subscribeStartTime:0,subscribedTime:0,playStreamTime:0,statsToReport:t({},Zb),stream:r};c.statsToReport.msg_user_info=new eI({userId:i,tinyId:r.getTinyId(),role:Gd}),c.statsToReport.uint32_stream_type=a===Kd?2:7,this.remoteStreamStatsMap_.set(o,c)}}}},{key:"handleRemoteStreamSubscribeStart",value:function(e){var t=e.client,n=e.stream;if(this.hitTest(t)){var r=n.getUserId(),i=n.getType(),a="".concat(r,"_").concat(i),o=this.remoteStreamStatsMap_.get(a);o&&0===o.subscribeStartTime&&(o.subscribeStartTime=Date.now())}}},{key:"handleSendSubscribeCMD",value:function(e){if(this.hitTest(e.client)){var t=new eI(e),n=Date.now(),r="".concat(e.userId,"_").concat(Kd);e.trackState.video&&e.subscribeState.video&&!this.pathMainVideoMap_.has(r)&&this.pathMainVideoMap_.set(r,{statsToReport:{msg_user_info:t,uint64_start_enter_time:this.pathJoinRoom_.uint64_start_time,uint64_render_first_frame_time:0,uint64_combine_first_frame_time:0,uint64_pc_connected_time:0},userId:e.userId,sendSubscribeCMDTime:n}),e.trackState.audio&&e.subscribeState.audio&&!this.pathMainAudioMap_.has(r)&&this.pathMainAudioMap_.set(r,{statsToReport:{msg_user_info:t,uint64_start_enter_time:this.pathJoinRoom_.uint64_start_time,uint64_play_first_frame_time:0},userId:e.userId,sendSubscribeCMDTime:n});var i="".concat(e.userId,"_").concat(Qd);e.trackState.auxiliary&&e.subscribeState.auxiliary&&!this.pathAuxiliaryMap_.has(i)&&this.pathAuxiliaryMap_.set(i,{sendSubscribeCMDTime:n})}}},{key:"handleRemoteStreamSubscribed",value:function(e){var t=e.client,n=e.stream;if(this.hitTest(t)){var r=n.getUserId(),i=n.getType(),a="".concat(r,"_").concat(i),o=this.remoteStreamStatsMap_.get(a);o&&0===o.subscribedTime&&(o.subscribedTime=Date.now(),o.stream=n)}}},{key:"handlePlayStream",value:function(e){var t=e.stream;if(t.isRemote()&&t.getConnection()&&this.hitTest(t.getConnection().getClient())){var n=t.getConnection().getUserId(),r="".concat(n,"_").concat(t.getType());if(this.remoteStreamStatsMap_.has(r)){var i=this.remoteStreamStatsMap_.get(r);0===i.playStreamTime&&(i.playStreamTime=Date.now())}}}},{key:"handleVideoLoadedData",value:function(e){var t=e.stream;if(t.isRemote()&&t.getConnection()&&this.hitTest(t.getConnection().getClient())){var n=t.getConnection().getUserId(),r="".concat(n,"_").concat(t.getType());if(this.pathMainVideoMap_.has(r)){var i=this.pathMainVideoMap_.get(r);0===i.statsToReport.uint64_combine_first_frame_time&&(i.statsToReport.uint64_combine_first_frame_time=Date.now())}}}},{key:"handleVideoPlaying",value:function(e){var t=e.stream;if(t.isRemote()&&t.getConnection()&&this.hitTest(t.getConnection().getClient())){var n=t.getConnection().getUserId(),r="".concat(n,"_").concat(t.getType()),i=Date.now();if(this.pathMainVideoMap_.has(r)){var a=this.pathMainVideoMap_.get(r);if(0===a.statsToReport.uint64_render_first_frame_time&&(a.statsToReport.uint64_render_first_frame_time=i),this.remoteStreamStatsMap_.has(r)){var o=this.remoteStreamStatsMap_.get(r),s=o.statsToReport,c=o.playStreamTime,u=o.subscribedTime;0===s.uint32_video_render_first&&c-u<=100&&(s.uint32_video_render_first=i-a.sendSubscribeCMDTime)}}if(t.getType()===Qd&&this.pathAuxiliaryMap_.has(r)&&this.remoteStreamStatsMap_.has(r)){var d=this.remoteStreamStatsMap_.get(r),l=d.statsToReport,h=d.playStreamTime,p=d.subscribedTime;0===l.uint32_video_render_first&&h-p<=100&&(l.uint32_video_render_first=i-this.pathAuxiliaryMap_.get(r).sendSubscribeCMDTime)}}}},{key:"handleAudioPlaying",value:function(e){if(e.stream.isRemote()&&e.stream.getConnection()&&this.hitTest(e.stream.getConnection().getClient())){var t=e.stream.getConnection().getUserId(),n="".concat(t,"_").concat(e.stream.getType());if(this.pathMainAudioMap_.has(n)){var r=this.pathMainAudioMap_.get(n);0===r.statsToReport.uint64_play_first_frame_time&&(r.statsToReport.uint64_play_first_frame_time=Date.now())}}}},{key:"handleNetworkQuality",value:function(e){var t=this;this.hitTest(e.client)&&(this.networkQuality_.totalUplinkLoss+=e.uplinkLoss,this.networkQuality_.totalUplinkRTT+=e.uplinkRTT,this.networkQuality_.count++,e.downlinkLossAndRTTMap.forEach((function(e){var n=e.rtt,r=e.loss,i=e.userId,a=t.networkQuality_.totalDownlinkRTTAndLossMap.get(i);a?(a.totalRTT+=n,a.totalLoss+=r,a.count++):t.networkQuality_.totalDownlinkRTTAndLossMap.set(i,{totalRTT:n,totalLoss:r,count:1})})))}},{key:"handleHeartbeatStats",value:function(e){var t=this;if(this.hitTest(e.client)){var n=e.stats,r=n.msg_up_stream_info,i=n.msg_down_stream_info;if(r.msg_video_status[0]){var a=r.msg_video_status[0],o=a.uint32_video_codec_bitrate,s=a.uint32_video_enc_fps,c=a.uint32_video_width,u=a.uint32_video_height;this.localStreamStats_.totalVideoBitrate+=o,this.localStreamStats_.totalVideoFPS+=s,this.localStreamStats_.totalVideoWidth+=c,this.localStreamStats_.totalVideoHeight+=u,this.localStreamStats_.videoCount++}var d=r.msg_audio_status.audioLevel;Math.floor(100*d)>0&&(this.localStreamStats_.totalAudioLevel+=d,this.localStreamStats_.audioLevelCount++),i.forEach((function(e){var n=e.msg_user_info,r=e.msg_audio_status,i=e.msg_video_status,a=n.str_identifier;if(i.forEach((function(e){var n=2===e.uint32_video_stream_type,r=7===e.uint32_video_stream_type,i="".concat(a,"_").concat(n?Kd:Qd);if(t.remoteStreamStatsMap_.has(i)){var o=t.remoteStreamStatsMap_.get(i);(n&&o.stream.isMainVideoSubscribed||r&&o.stream.isAuxVideoSubscribed)&&(o.totalVideoFPS+=e.uint32_video_receive_fps,o.totalVideoBitrate+=e.uint32_video_codec_bitrate,o.videoCount++,0===o.statsToReport.uint32_video_width&&(o.statsToReport.uint32_video_width=e.uint32_video_width),0===o.statsToReport.uint32_video_height&&(o.statsToReport.uint32_video_height=e.uint32_video_height))}})),r){var o="".concat(a,"_").concat(Kd);if(t.remoteStreamStatsMap_.has(o)){var s=t.remoteStreamStatsMap_.get(o);s.stream.isMainAudioSubscribed&&(s.totalAudioBitrate+=r.uint32_audio_codec_bitrate,s.audioCount++,Math.floor(100*r.audioLevel)>0&&(s.totalAudioLevel+=r.audioLevel,s.audioLevelCount++))}}}))}}},{key:"handlePublishStart",value:function(e){var t=e.client;this.hitTest(t)&&0===this.localStreamStats_.publishStartTime&&(this.localStreamStats_.publishStartTime=Date.now())}},{key:"handleLocalStreamInitStart",value:function(e){var t=e.audio,n=e.video;t&&0===this.pathJoinRoom_.uint64_init_audio_start_time&&(this.pathJoinRoom_.uint64_init_audio_start_time=Date.now()),n&&0===this.pathJoinRoom_.uint64_init_camera_start_time&&(this.pathJoinRoom_.uint64_init_camera_start_time=Date.now())}},{key:"handleLocalStreamInitEnd",value:function(e){var t=e.audio,n=e.video;t&&0===this.pathJoinRoom_.uint64_init_audio_end_time&&(this.pathJoinRoom_.uint64_init_audio_end_time=Date.now()),n&&0===this.pathJoinRoom_.uint64_init_camera_end_time&&(this.pathJoinRoom_.uint64_init_camera_end_time=Date.now())}},{key:"handleLocalStreamInitFailed",value:function(e){var t=e.audio,n=e.video,r=e.error,i=r instanceof Wm?r.getExtraCode()||r.getCode():{NotFoundError:1,NotAllowedError:2,NotReadableError:3,OverConstrainedError:4,AbortError:5}[r.name]||zm.UNKNOWN;t&&0===this.pathJoinRoom_.uint64_init_audio_end_time&&(this.pathJoinRoom_.int32_init_audio_ret=i,this.pathJoinRoom_.uint64_init_audio_end_time=Date.now()),n&&0===this.pathJoinRoom_.uint64_init_camera_end_time&&(this.pathJoinRoom_.int32_init_camera_ret=i,this.pathJoinRoom_.uint64_init_camera_end_time=Date.now())}},{key:"hasVideoFlag",value:function(e){return this.firstPublishedUserList_.findIndex((function(t){return t.userId===e&&1&t.flag}))>=0}},{key:"hasAudioFlag",value:function(e){return this.firstPublishedUserList_.findIndex((function(t){return t.userId===e&&8&t.flag}))>=0}},{key:"hasAuxFlag",value:function(e){return this.firstPublishedUserList_.findIndex((function(t){return t.userId===e&&4&t.flag}))>=0}},{key:"hitTest",value:function(e){return e===this.client_}},{key:"checkStorage",value:(o=i(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!(t=Yg.getItem(this.storageKey_))){e.next=6;break}return e.next=5,this.upload(t);case 5:Yg.deleteItem(this.storageKey_);case 6:e.next=11;break;case 8:e.prev=8,e.t0=e.catch(0),this.log_.warn(e.t0);case 11:case"end":return e.stop()}}),e,this,[[0,8]])}))),function(){return o.apply(this,arguments)})},{key:"setStorage",value:function(){this.prepareReport();var e=this.getReportData();0!==e.msg_path_enter_room.uint64_start_time&&Yg.setItem(this.storageKey_,e)}},{key:"prepareReport",value:function(){var e=this;if(this.networkQuality_.count>0&&(this.basicInfo.uint32_avg_rtt=Math.floor(this.networkQuality_.totalUplinkRTT/this.networkQuality_.count),this.basicInfo.uint32_avg_up_loss=Math.floor(this.networkQuality_.totalUplinkLoss/this.networkQuality_.count)),this.localStreamStats_.videoCount>0){this.localStreamStats_.statsToReport.uint32_video_big_capture_fps=Math.floor(this.localStreamStats_.totalVideoFPS/this.localStreamStats_.videoCount),this.localStreamStats_.statsToReport.uint32_video_big_bitrate=Math.floor(this.localStreamStats_.totalVideoBitrate/this.localStreamStats_.videoCount);var t=Math.floor(this.localStreamStats_.totalVideoWidth/this.localStreamStats_.videoCount),n=Math.floor(this.localStreamStats_.totalVideoHeight/this.localStreamStats_.videoCount);this.localStreamStats_.statsToReport.uint32_video_big_resolution=t<<16|n}this.localStreamStats_.audioLevelCount>0&&(this.localStreamStats_.statsToReport.uint32_audio_capture_db=Math.floor(this.localStreamStats_.totalAudioLevel/this.localStreamStats_.audioLevelCount*100)),this.remoteStreamStatsMap_.forEach((function(t,n){var r=t.userId;if(e.networkQuality_.totalDownlinkRTTAndLossMap.has(r)){var i=e.networkQuality_.totalDownlinkRTTAndLossMap.get(r),a=i.totalLoss,o=i.count;t.statsToReport.uint32_avg_down_loss=Math.floor(a/o)}t.videoCount>0&&(t.statsToReport.uint32_video_avg_fps=Math.floor(t.totalVideoFPS/t.videoCount),t.statsToReport.uint32_video_avg_bitrate=Math.floor(t.totalVideoBitrate/t.videoCount)),t.audioCount>0&&(t.statsToReport.uint32_audio_recv_bitrate=t.statsToReport.uint32_audio_bitrate=Math.floor(t.totalAudioBitrate/t.audioCount)),t.audioLevelCount>0&&(t.statsToReport.uint32_audio_play_db=Math.floor(t.totalAudioLevel/t.audioLevelCount*100));var s=e.client_.getCallDurationCalculator();s&&(t.statsToReport.uint32_audio_play_time=s.getDuration(n,dd),t.statsToReport.uint32_video_play_time=s.getDuration(n,ld)),t.statsToReport.uint32_video_render_first=Math.min(t.statsToReport.uint32_video_render_first,5e3);var c=e.client_.getBadCaseDetector();if(c){var u=c.getDataFreezeDuration(n),d=u.dataFreeze,l=u.count,h=c.getRenderFreezeDuration(n).renderFreeze;t.statsToReport.uint32_video_block_count=l,t.statsToReport.uint32_video_block_time=Math.min(d,t.statsToReport.uint32_video_play_time),t.statsToReport.uint32_video_external_block_time=Math.min(h,t.statsToReport.uint32_video_play_time),c.isBlackStream(n)&&0===t.statsToReport.uint32_video_avg_fps?t.statsToReport.uint32_video_black_screen_subjective=1:t.statsToReport.uint32_video_black_screen_subjective=0}(0===t.subscribeStartTime||t.subscribeStartTime-t.streamAddedTime>100||0===t.playStreamTime)&&(e.pathMainAudioMap_.delete(n),e.pathMainVideoMap_.delete(n),t.statsToReport.uint32_video_render_first=0)})),this.pathMainAudioMap_.forEach((function(t,n){e.hasAudioFlag(t.userId)?t.statsToReport.uint64_play_first_frame_time-t.statsToReport.uint64_start_enter_time>5e3&&(t.statsToReport.uint64_play_first_frame_time=t.statsToReport.uint64_start_enter_time+5e3):e.pathMainAudioMap_.delete(n)})),this.pathMainVideoMap_.forEach((function(t,n){e.hasVideoFlag(t.userId)?t.statsToReport.uint64_render_first_frame_time-t.statsToReport.uint64_start_enter_time>5e3&&(t.statsToReport.uint64_render_first_frame_time=t.statsToReport.uint64_start_enter_time+5e3):e.pathMainVideoMap_.delete(n)})),this.pathJoinRoom_.uint64_end_time-this.pathJoinRoom_.uint64_start_time>5e3&&(this.pathJoinRoom_.uint64_end_time=this.pathJoinRoom_.uint64_start_time+5e3)}},{key:"getReportData",value:function(){var e=this.client_.getSignalInfo();return{uint32_sdk_app_id:Number(this.client_.getSDKAppId()),msg_user_info:new eI({userId:this.client_.getUserId(),tinyId:this.client_.getTinyId(),role:"anchor"===this.client_.getRole()?Gd:Jd}),msg_basic_info:this.basicInfo,uint32_acc_ip:Ah(e.relayIp),uint32_client_ip:Ah(e.clientIp,"small"),uint32_acc_port:0,uint64_timestamp:Date.now(),uint32_seq:Math.floor(Math.random()*Math.pow(2,31)),msg_path_enter_room:this.pathJoinRoom_,msg_path_exit_room:this.pathLeaveRoom_,msg_path_recv_video:y(this.pathMainVideoMap_.values()).map((function(e){return e.statsToReport})),msg_quality_statistics:y(this.remoteStreamStatsMap_.values()).map((function(e){return e.statsToReport})),str_room_name:String(this.client_.getRoomId()),msg_path_recv_audio:y(this.pathMainAudioMap_.values()).map((function(e){return e.statsToReport})),uint32_info_client_ip:Ah(e.clientIp,"small"),error_code:[],msg_local_statistics:this.localStreamStats_.statsToReport}}},{key:"report",value:(r=i(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,t=this.getReportData(),e.next=4,this.upload(t);case 4:Yg.deleteItem(this.storageKey_),this.initData(),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(0),this.log_.warn(e.t0);case 11:case"end":return e.stop()}}),e,this,[[0,8]])}))),function(){return r.apply(this,arguments)})},{key:"upload",value:(n=i(regeneratorRuntime.mark((function e(t){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(id||0===t.msg_path_enter_room.uint64_start_time||[ah,oh,sh].findIndex((function(e){return e===location.host}))>=0)){e.next=2;break}return e.abrupt("return");case 2:return n=Number(this.client_.getSDKAppId()),r=mh(n,Fd),e.next=6,Gp.post(r,JSON.stringify(t));case 6:if("ok"===(i=e.sent).data){e.next=9;break}throw"key point upload failed: ".concat(i.data);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})}]),e}();function nI(){return function(e,t,n){var r=n.value,a=new Map;return n.value=i(regeneratorRuntime.mark((function e(){var n,i,o,s,c=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!a.get(this)){e.next=2;break}throw new Wm({code:zm.INVALID_OPERATION,message:Dg({key:U_,data:{name:t}})});case 2:for(e.prev=2,a.set(this,!0),n=c.length,i=new Array(n),o=0;o<n;o++)i[o]=c[o];return e.next=7,r.apply(this,i);case 7:return s=e.sent,a.set(this,!1),e.abrupt("return",s);case 12:throw e.prev=12,e.t0=e.catch(2),a.set(this,!1),e.t0;case 16:case"end":return e.stop()}}),e,this,[[2,12]])}))),n}}function rI(e){return iI.apply(this,arguments)}function iI(){return(iI=i(regeneratorRuntime.mark((function e(t){var n,r,i,a,o,s,c,u,d,l,h,p,f;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.userId,r=t.sdkAppId,i=t.useStringRoomId,a=t.roomId,o=t.userSig,s={delta:0,count:[1,1],msg:[]},e.prev=2,(c=new FormData).append("userId",String(n)),c.append("sdkAppId",String(r)),c.append("isStrGroupId",i),c.append("groupId",String(a)),c.append("sdkVersion","4.12.2"),c.append("userSig",String(o)),u=Ch(),e.next=13,II(c,s,r);case 13:return d=e.sent,s.delta=Ch()-u,aI({stat:s,userId:n}),e.abrupt("return",d);case 19:throw e.prev=19,e.t0=e.catch(2),l=Th(e.t0)?e.t0[0]:e.t0,h=bh(l.code)?l.code:0,p="get websocket url failed: ".concat(l.message.includes("timeout")?"timeout":l.message),f=new Wm({code:zm.SCHEDULE_FAILED,extraCode:h,message:Dg({key:lv,data:{error:p,code:h}})}),Bf.error(f),aI({stat:s,userId:n,roomId:a,error:f}),f;case 28:case"end":return e.stop()}}),e,null,[[2,19]])})))).apply(this,arguments)}function aI(e){var t=e.stat,n=e.userId,r=e.error;r?Ng.logFailedEvent({eventType:Dl,error:r,userId:n}):Ng.logSuccessEvent({eventType:Dl,delta:t.delta,userId:n}),Ng.uploadEvent({log:"stat-schedule:"+JSON.stringify(t),userId:n})}function oI(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:wd;return t=fh(e)?n===wd?Yl:Zl:n===wd?Xl:$l,"https://".concat(t,"/api/v1/config")}function sI(e,t,n){return new Promise((function(r,i){Gp.post(e,t,n).then((function(e){0===e.data.code?r(e.data.data):i({code:e.data.code,message:e.data.msg})})).catch(i)}))}var cI,uI,dI,lI,hI,pI,fI,mI,_I,vI,gI,yI,SI,kI,bI=function(e,t){return Vf({retryFunction:sI,settings:{retries:3,timeout:0},onError:t,onRetrying:e})};function II(e,t,n){return new Promise((function(r,i){var a,o=null;(a=[bI((function(e){return t.count[0]=e+1}),(function(e,n){t.msg[0]=e.message,o||n()}))(oI(n,wd),e,{timeout:2e3}),bI((function(e){return t.count[1]=e+1}),(function(e,n){t.msg[1]=e.message,o||n()}))(oI(n,Ed),e,{timeout:2e3})],new Promise((function(e,t){var n=[];a.forEach((function(r){r.then(e).catch((function(e){n.push(e),n.length===a.length&&t(n)}))}))}))).then((function(e){r(o=e)})).catch(i)}))}var TI=(cI=nI(),uI=wb(Tb.CLIENT.join),dI=nI(),lI=nI(),hI=wb(Tb.CLIENT.publish),pI=nI(),fI=wb(Tb.CLIENT.unpublish),mI=wb.apply(void 0,y(Tb.CLIENT.subscribe)),_I=wb(Tb.CLIENT.unsubscribe),vI=nI(),gI=wb(Tb.CLIENT.switchRole),yI=wb(Tb.CLIENT.startPublishCDNStream),SI=wb(Tb.CLIENT.startMixTranscode),I((kI=function(){function Client(e){if(a(this,Client),this.name_=th,this.mode_=e.mode,this.sdpSemantics_="plan-b",Sh(e.sdpSemantics)?function(){if(!py())return!1;if(Sh(window.RTCRtpTransceiver))return!1;if(!("currentDirection"in RTCRtpTransceiver.prototype))return!1;var e=new RTCPeerConnection,t=!1;try{e.addTransceiver(dd),t=!0}catch(JI){}return e.close(),t}()&&(this.sdpSemantics_="unified-plan"):this.sdpSemantics_=e.sdpSemantics,this.sdkAppId_=e.sdkAppId,this.userId_=e.userId,this.log_=Bf.createLogger({id:"c".concat(e.seq,"|").concat(this.userId_),userId:this.userId_,sdkAppId:this.sdkAppId_}),this.userSig_=e.userSig,this.roomId_=0,this.useStringRoomId_=e.useStringRoomId||!1,this.recordId_=null,this.pureAudioPushMode_=null,this.version_=e.version,this.log_.info("using sdpSemantics: "+this.sdpSemantics_),!Sh(e.recordId)){if(!Number.isInteger(Number(e.recordId)))throw new Wm({code:zm.INVALID_PARAMETER,message:Dg({key:ev})});this.recordId_=e.recordId}var t;this.signalChannel_=null,this.isScreenShareOnly_=0,Sh(e.isScreenShareOnly)||(this.isScreenShareOnly_=e.isScreenShareOnly?1:0),this.role_="anchor",this.privateMapKey_="",this.tinyId_=0,this.env_="",this.proxy_=null,this.connections_=new Map,this.mutedStates_=new Map,this.userMap_=new Map,this.syncUserListInterval_=-1,this.localStream_=null,this.uplinkConnection_=null,this.emitter_=new Jp,this.isSignalReady_=!1,this.isJoined_=!1,this.heartbeat_=-1,this.lastHeartBeatTime_=-1,this.stats_=new Yy(this),this.joinTimeout_=-1,this.networkQuality_=null,this.badCaseDetector_=null,this.networkType_=_h(),this.autoSubscribe_=!!Sh(e.autoSubscribe)||e.autoSubscribe,this.startJoinTimestamp_=0,this.joinedTimestamp_=0,this.joinOptions_={},this.basis_={browser:sd().name+"/"+sd().version,os:yy(),displayResolution:Sy(),isScreenShareSupported:uy(),isWebRTCSupported:ty(),isGetUserMediaSupported:ky(),isWebAudioSupported:by(),isWebSocketsSupported:"WebSocket"in window&&2===window.WebSocket.CLOSING,isWebCodecSupported:(t={AudioDecoder:!1,AudioEncoder:!1,VideoDecoder:!1,VideoEncoder:!1,ImageDecoder:!1},Sh(window.AudioDecoder)||(t.AudioDecoder=!0),Sh(window.AudioEncoder)||(t.AudioEncoder=!0),Sh(window.VideoDecoder)||(t.VideoDecoder=!0),Sh(window.VideoEncoder)||(t.VideoEncoder=!0),Sh(window.ImageDecoder)||(t.ImageDecoder=!0),t),isMediaSessionSupported:"mediaSession"in navigator&&!Sh(navigator.mediaSession.setActionHandler),isWebTransportSupported:!Sh(window.WebTransport)},this.initBussinessInfo_(e),this.publishedCDN_=!1,this.publishCDNData_=null,this.mixedMCU_=!1,this.mixTranscodeData_=null,this.checkSystemResult_=null,this.enableAudioVolumeEvaluation_=!1,this.audioVolumeIntervalId_=null,this.mixTranscodeManager_=null,this.publishCDNManager_=null,this.keyPointManager_=new tI({client:this,frameWorkType:e.frameWorkType}),this.getUserList=Vf({retryFunction:this.getUserList,settings:{retries:3},onError:function(e,t){return t()}}),this.isPublishing_=!1,this.isEnableSmallStream_=!1,this.smallStreamConfig_={bitrate:100,frameRate:15,height:120,width:160},this.turnServers_=[],this.iceTransportPolicy_=e.iceTransportPolicy,this.schedule_={domains:null,iceServers:null,iceTransportPolicy:null},this.enableAutoPlayDialog_=!!Sh(e.enableAutoPlayDialog)||e.enableAutoPlayDialog,this.signalInfo_={}}var e,n,r,o,c,u,d,l,h,p,f,m,_,v,S,k,I,T,R,w,E,C,A,x,P,D;return s(Client,[{key:"initBussinessInfo_",value:function(e){this.bussinessInfo_=e.bussinessInfo;var t={};if(kh(e.bussinessInfo)&&(t=JSON.parse(e.bussinessInfo)),!Sh(e.pureAudioPushMode)){if(!Number.isInteger(Number(e.pureAudioPushMode)))throw new Wm({code:zm.INVALID_PARAMETER,message:Dg({key:tv})});this.pureAudioPushMode_=e.pureAudioPushMode,t.Str_uc_params||(t.Str_uc_params={}),t.Str_uc_params.pure_audio_push_mod=this.pureAudioPushMode_}if(!Sh(e.streamId)){if(!(kh(e.streamId)&&String(e.streamId)&&String(e.streamId).length<=64))throw new Wm({code:zm.INVALID_PARAMETER,message:Dg({key:nv})});t.Str_uc_params||(t.Str_uc_params={}),t.Str_uc_params.userdefine_streamid_main=e.streamId}if(!Sh(e.userDefineRecordId)){if(null===e.userDefineRecordId.match(/^[A-Za-z0-9_-]{1,64}$/gi))throw new Wm({code:zm.INVALID_PARAMETER,message:Dg({key:rv})});t.Str_uc_params||(t.Str_uc_params={}),t.Str_uc_params.userdefine_record_id=e.userDefineRecordId}if(!Sh(e.userDefinePushArgs)){if(!(kh(e.userDefinePushArgs)&&String(e.userDefinePushArgs)&&String(e.userDefinePushArgs).length<=256))throw new Wm({code:zm.INVALID_PARAMETER,message:Dg({key:iv})});t.Str_uc_params||(t.Str_uc_params={}),t.Str_uc_params.userdefine_push_args=e.userDefinePushArgs}N_(t)||(this.bussinessInfo_=JSON.stringify(t))}},{key:"setProxyServer",value:function(e){if(this.log_.info("set proxy server: ".concat(JSON.stringify(e))),kh(e)){if(!e.startsWith("wss://"))throw new Wm({code:zm.INVALID_PARAMETER,message:Dg({key:av})});this.proxy_=e}else if(vh(e)){var t=e.websocketProxy,n=e.loggerProxy;t&&(this.proxy_=t),n&&jd(n)}}},{key:"schedule",value:(D=i(regeneratorRuntime.mark((function e(n){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,rI({userId:this.userId_,sdkAppId:this.sdkAppId_,roomId:n,useStringRoomId:this.useStringRoomId_,version:this.version_,userSig:this.userSig_});case 2:(r=e.sent)&&(this.log_.info("schedule: ".concat(JSON.stringify(r))),this.schedule_=t(t({},this.schedule_),r),zp.emit(sf,this.schedule_));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return D.apply(this,arguments)})},{key:"getSignalChannelUrl",value:function(){var e={mainUrl:"",backupUrl:""},t=ph();return t?e.mainUrl=e.backupUrl="wss://".concat(t,".rtc.qq.com"):this.proxy_?e.mainUrl=e.backupUrl=this.proxy_:Array.isArray(this.schedule_.domains)&&this.schedule_.domains.length>0&&(e.mainUrl=e.backupUrl="wss://".concat(this.schedule_.domains[0]),this.schedule_.domains[1]&&(e.backupUrl="wss://".concat(this.schedule_.domains[1]))),e}},{key:"getUserId",value:function(){return this.userId_}},{key:"getUserSig",value:function(){return this.userSig_}},{key:"getRole",value:function(){return this.role_}},{key:"getSignalInfo",value:function(){return this.signalInfo_}},{key:"getRoomId",value:function(){return this.roomId_}},{key:"getSDKAppId",value:function(){return this.sdkAppId_}},{key:"getTinyId",value:function(){return this.tinyId_}},{key:"setTurnServer",value:function(e){this.log_.info("set turn server: "+JSON.stringify(e));var t=[];Array.isArray(e)?e.forEach((function(e){return t.push(Eh(e))})):vh(e)&&t.push(Eh(e)),this.turnServers_=t}},{key:"getIceTransportPolicy",value:function(){return this.iceTransportPolicy_||this.schedule_.iceTransportPolicy||"all"}},{key:"initialize",value:function(){var e=this;return new Promise((function(t,n){e.log_.info("setup signal channel");var r=e.getSignalChannelUrl(),i=r.mainUrl,a=r.backupUrl;e.signalChannel_=new Lg({sdkAppId:e.sdkAppId_,userId:e.userId_,userSig:e.userSig_,url:i,backupUrl:a,version:e.version_,client:e}),e.networkQuality_||(e.networkQuality_=new Zy({connections:e.connections_,signalChannel:e.signalChannel_,userId:e.userId_,client:e}),e.networkQuality_.on(Jy,(function(t){e.emitter_.emit(Jy,t)}))),e.deviceDetector_||(e.deviceDetector_=new eS({client:e})),e.subscriptionManager_||(e.subscriptionManager_=new Pb({client:e})),e.badCaseDetector_||(e.badCaseDetector_=new zb({client:e,stats:e.stats_})),e.callDurationCalculator_||(e.callDurationCalculator_=new Xb({client:e})),e.mixTranscodeManager_||(e.mixTranscodeManager_=new Kb({client:e,signalChannel:e.signalChannel_})),e.publishCDNManager_||(e.publishCDNManager_=new Qb({client:e,signalChannel:e.signalChannel_})),e.signalChannel_.on(vm,(function(t){e.log_.info("SignalChannel state changed from ".concat(t.prevState," to ").concat(t.state)),e.emitter_.emit(My,t)})),e.signalChannel_.on(ym,(function(t){e.isSignalReady_?(e.reset(),e.emitter_.emit(Wy,t)):(zp.emit(af,{client:e,error:t}),n(t))})),e.signalChannel_.on(_m,(function(n){e.tinyId_=n.signalInfo.tinyId,e.isSignalReady_||(e.isSignalReady_=!0,zp.emit(af,{client:e}),t())})),e.signalChannel_.on(wm.PEER_JOIN,e.onPeerJoin,e),e.signalChannel_.on(wm.PEER_LEAVE,e.onPeerLeave,e),e.signalChannel_.on(wm.UPDATE_REMOTE_MUTE_STAT,(function(t){Date.now()-e.lastHeartBeatTime_>=1e4&&e.doHeartbeat(),zp.emit(tf,{client:e,data:t.data}),e.onPublishedUserList(t.data),e.onUpdateRemoteMuteStat(t.data)})),e.signalChannel_.on(wm.CLINET_BANNED,(function(t){var n=t.data.data,r=n.reason;if(Ng.uploadEvent({log:"stat-banned:".concat(r),userId:e.userId_}),r===Cd)r="you got banned by account admin";else if(r===Ad)r="duplicated userId joining the room";else if(r===xd)return e.log_.warn("".concat(r," last heart beat time: ").concat(e.lastHeartBeatTime_," interval: ").concat(Date.now()-e.lastHeartBeatTime_,", visibility: ").concat(document.visibilityState)),void e.reJoin();e.log_.error("user was banned because of [".concat(n.reason,"]")),e.reset(),e.onClientBanned(r)})),zp.emit(rf,{client:e}),e.signalChannel_.connect()}))}},{key:"join",value:(P=i(regeneratorRuntime.mark((function e(t){var n,r,i,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.isJoined_){e.next=2;break}throw new Wm({code:zm.INVALID_OPERATION,message:Dg({key:ov})});case 2:return e.next=4,sy();case 4:if(this.checkSystemResult_=e.sent,(n=ph())||(n=Nd,this.proxy_&&(this.proxy_.startsWith(Pd)?n=Ld:this.proxy_.startsWith(Dd)&&(n=Od))),this.env_=n,Ng.setConfig({env:n,sdkAppId:this.sdkAppId_,userId:this.userId_,roomId:t.roomId}),this.uploadTrtcStats(),r=this.checkSystemResult_.detail,i=r.isH264EncodeSupported,a=r.isVp8EncodeSupported,ty()&&(i||a)){e.next=13;break}throw new Wm({code:zm.NOT_SUPPORTED,message:Dg({key:Sg})});case 13:if(this.joinOptions_=t,this.startJoinTimestamp_=Ch(),zp.emit(Wp,{client:this}),x_(this.userId_,{eventId:h_,eventDesc:"joining room",timestamp:go(),userId:this.userId_,tinyId:this.tinyId_}),e.prev=17,this.proxy_||this.schedule_.domains){e.next=21;break}return e.next=21,this.schedule(t.roomId);case 21:return e.next=23,this.initialize(t);case 23:return e.next=25,this.doJoin(t);case 25:this.signalInfo_=this.signalChannel_.getSignalInfo(),zp.emit(Qp,{client:this}),this.joinedTimestamp_=Ch(),o=this.joinedTimestamp_-this.startJoinTimestamp_,Ng.logSuccessEvent({userId:this.userId_,eventType:cl,delta:o}),Ng.logSuccessEvent({userId:this.userId_,eventType:sl}),Ng.uploadEvent({log:"stat-autoplay-dialog:".concat(this.enableAutoPlayDialog_),userId:this.userId_}),Ng.uploadEvent({log:"stat-conv-".concat(id,"-").concat(location.hostname),userId:this.userId_}),e.next=41;break;case 35:throw e.prev=35,e.t0=e.catch(17),zp.emit(Xp,{client:this,error:e.t0}),Ng.logFailedEvent({userId:this.userId_,eventType:sl,error:e.t0}),this.reset(),e.t0;case 41:case"end":return e.stop()}}),e,this,[[17,35]])}))),function(e){return P.apply(this,arguments)})},{key:"uploadTrtcStats",value:(x=i(regeneratorRuntime.mark((function e(){var t,n,r,i,a,o,s,c,u,d,l,h,p;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,GI.getMicrophones();case 3:r=e.sent,t=r&&r.length,e.next=9;break;case 7:e.prev=7,e.t0=e.catch(0);case 9:return e.prev=9,e.next=12,GI.getCameras();case 12:i=e.sent,n=i&&i.length,e.next=18;break;case 16:e.prev=16,e.t1=e.catch(9);case 18:a={microphone:t,camera:n},o=this.checkSystemResult_.detail,s=o.isH264EncodeSupported,c=o.isVp8EncodeSupported,u=o.isH264DecodeSupported,d=o.isVp8DecodeSupported,l={webRTC:this.basis_.isWebRTCSupported,getUserMedia:this.basis_.isGetUserMediaSupported,webSocket:this.basis_.isWebSocketsSupported,screenShare:this.basis_.isScreenShareSupported,webAudio:this.basis_.isWebAudioSupported,h264Encode:s,h264Decode:u,vp8Encode:c,vp8Decode:d},h={browser:this.basis_.browser,os:this.basis_.os,trtc:l,devices:a},p={isWebCodecSupported:this.basis_.isWebCodecSupported,isMediaSessionSupported:this.basis_.isMediaSessionSupported,isWebTransportSupported:this.basis_.isWebTransportSupported},Ng.uploadEvent({log:"trtcstats-"+JSON.stringify(h),userId:this.userId_}),this.log_.info("TrtcStats-"+JSON.stringify(h)),Ng.uploadEvent({log:"trtcadvancedstats-"+JSON.stringify(p),userId:this.userId_});case 26:case"end":return e.stop()}}),e,this,[[0,7],[9,16]])}))),function(){return x.apply(this,arguments)})},{key:"getVersion",value:function(){var e=this.version_.split(".");return 1e3*parseInt(e[0])+100*parseInt(e[1])+parseInt(e[2])}},{key:"doJoin",value:function(e){var t=this;return new Promise((function(n,r){if(!t.isSignalReady_)throw new Wm({code:zm.INVALID_OPERATION,message:Dg({key:uv})});t.roomId_=e.roomId,Sh(e.role)||(t.role_=e.role);var i="";Sh(e.privateMapKey)||(i=e.privateMapKey),t.privateMapKey_=i,t.log_.info("Join() => joining room: ".concat(e.roomId," useStringRoomId: ").concat(t.useStringRoomId_," mode: ").concat(t.mode_," role: ").concat(t.role_));var a={roomId:String(e.roomId),useStringRoomId:t.useStringRoomId_,privateMapKey:i,trtcRole:"anchor"===t.role_?Gd:Jd,trtcScene:"live"===t.mode_?Hd:Bd,sdpSemantics:t.sdpSemantics_,version:t.version_,ua:navigator&&navigator.userAgent||"",autoSubscribe:t.autoSubscribe_,terminalType:ou?4:ru?2:tu?3:Lu?12:Nu?5:Ou?13:1,netType:Wl[_h()],bussinessInfo:t.bussinessInfo_};t.joinTimeout_=setTimeout((function(){t.log_.error("join room timeout observed"),r(new Wm({code:zm.JOIN_ROOM_FAILED,message:Dg({key:dv})}))}),5e3),zp.emit(qp,{client:t}),t.signalChannel_.send(Cm,a),t.signalChannel_.once(wm.JOIN_ROOM_RESULT,(function(e){clearTimeout(t.joinTimeout_),t.joinTimeout_=-1;var i=e.data,a=i.code,o=i.message;zp.emit(Kp,{client:t,code:a}),0===a?(t.isJoined_=!0,t.log_.info("Join room success, start heartbeat"),t.startHeartbeat(),t.badCaseDetector_&&t.badCaseDetector_.start(),t.syncUserList(),t.startSyncUserListInterval(),n()):(t.log_.error("Join room failed result: "+a+" error: "+o),r(new Wm({code:zm.JOIN_ROOM_FAILED,extraCode:a,message:Dg({key:lv,data:{error:o,code:a}})})))}))}))}},{key:"connectSignalBeforeReJoin",value:function(){var e=this;return new Promise((function(t,n){e.log_.warn("connectSignalBeforeReJoin() try to connect signal before reJoin"),e.isSignalReady_=!1,e.signalChannel_.close(),e.signalChannel_.once(_m,(function(n){e.log_.warn("connectSignalBeforeReJoin() signal setup successfully"),t()})),e.signalChannel_.once(ym,(function(t){e.log_.warn("connectSignalBeforeReJoin() signal setup failed"),n(t)})),e.signalChannel_.connect()}))}},{key:"reJoin",value:(A=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isJoined_){e.next=3;break}return this.log_.warn("reJoin() you haven't join room yet, abort reJoin"),e.abrupt("return");case 3:return this.isJoined_=!1,e.prev=4,this.log_.warn("reJoin() try to reJoin room: ".concat(this.joinOptions_.roomId)),this.subscriptionManager_&&this.subscriptionManager_.markAllStream(),e.next=9,this.connectSignalBeforeReJoin();case 9:return e.next=11,this.doJoin(this.joinOptions_);case 11:if(this.log_.warn("reJoin() reJoin successfully"),Ng.logSuccessEvent({userId:this.userId_,eventType:ul}),this.checkConnectionsToReconnect(),e.prev=14,!this.uplinkConnection_||!this.localStream_||this.uplinkConnection_.getIsReconnecting()){e.next=18;break}return e.next=18,this.republish();case 18:e.next=22;break;case 20:e.prev=20,e.t0=e.catch(14);case 22:e.next=29;break;case 24:e.prev=24,e.t1=e.catch(4),this.log_.warn("reJoin() reJoin failed"+e.t1),Ng.logFailedEvent({userId:this.userId_,eventType:ul,error:e.t1}),this.emitter_.emit(Wy,new Wm({code:zm.JOIN_ROOM_FAILED,message:Dg({key:hv,data:{roomId:this.joinOptions_.roomId}})}));case 29:case"end":return e.stop()}}),e,this,[[4,24],[14,20]])}))),function(){return A.apply(this,arguments)})},{key:"republish",value:(C=i(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,this.log_.warn("republish() try to re-publish localStream"),t=this.localStream_,e.next=5,this.doUnpublish(t);case 5:return e.next=7,this.publish(t);case 7:this.log_.warn("republish() re-publish localStream successfully"),e.next=14;break;case 10:throw e.prev=10,e.t0=e.catch(0),this.log_.warn("republish() re-publish localStream failed "+e.t0),e.t0;case 14:case"end":return e.stop()}}),e,this,[[0,10]])}))),function(){return C.apply(this,arguments)})},{key:"leave",value:(E=i(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return zp.emit($p,{client:this}),x_(this.userId_,{eventId:p_,eventDesc:"leaving room",timestamp:go(),userId:this.userId_,tinyId:this.tinyId_}),e.prev=2,e.next=5,this.doHeartbeat();case 5:e.next=9;break;case 7:e.prev=7,e.t0=e.catch(2);case 9:this.doLeave(),zp.emit(Zp,{client:this}),Ng.logSuccessEvent({userId:this.userId_,eventType:dl}),t=Math.floor((Ch()-this.joinedTimestamp_)/1e3),Ng.logSuccessEvent({userId:this.userId_,eventType:ll,delta:t});case 14:case"end":return e.stop()}}),e,this,[[2,7]])}))),function(){return E.apply(this,arguments)})},{key:"doLeave",value:function(){this.isJoined_&&(zp.emit(Yp,{client:this}),this.log_.info("leave() => leaving room"),this.signalChannel_.send(Am),this.reset())}},{key:"clearNetworkQuality",value:function(){this.networkQuality_&&(this.networkQuality_.stop(),this.networkQuality_=null)}},{key:"closeConnections",value:function(){var e=this;this.connections_.forEach((function(t){e.closeDownLink(t.getTinyId())}))}},{key:"destroy",value:function(){if(this.isJoined_)throw this.log_.warn("please call leave() before destroy() client"),new Wm({code:zm.INVALID_OPERATION,message:Dg({key:pv})});this.log_.info("destroying SignalChannel"),this.signalChannel_&&(this.signalChannel_.close(),this.signalChannel_=null)}},{key:"reset",value:function(){this.keyPointManager_&&this.keyPointManager_.prepareReport(),this.mixTranscodeManager_&&(this.mixTranscodeManager_.stop(),this.mixTranscodeManager_=null),this.publishCDNManager_&&(this.publishCDNManager_=null),this.userMap_.clear(),this.stopSyncUserListInterval(),this.stopHeartbeat(),this.closeConnections(),this.mutedStates_.clear(),this.clearNetworkQuality(),this.badCaseDetector_&&this.callDurationCalculator_&&this.uploadAllCallStats(),this.closeUplink(),this.isJoined_=!1,this.isSignalReady_=!1,this.destroy()}},{key:"startSyncUserListInterval",value:function(){-1===this.syncUserListInterval_&&(this.syncUserListInterval_=$g.setInterval(this.syncUserList.bind(this),1e4))}},{key:"stopSyncUserListInterval",value:function(){$g.clearInterval(this.syncUserListInterval_),this.syncUserListInterval_=-1}},{key:"syncUserList",value:(w=i(regeneratorRuntime.mark((function e(){var t,n=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.getUserList();case 3:t=e.sent,0!==this.userMap_.size&&this.userMap_.forEach((function(e){t.findIndex((function(t){return t.userId===e.userId}))<0&&(n.log_.info("peer leave detected: ".concat(e.userId)),n.cleanUser({userId:e.userId,tinyId:e.tinyId}))})),t.forEach((function(e){var t=e.userId;n.userMap_.has(t)||t===n.userId_||(n.userMap_.set(t,e),n.emitter_.emit(Uy,{userId:t}))})),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(0),this.log_.warn("sync user list failed: "+e.t0);case 11:case"end":return e.stop()}}),e,this,[[0,8]])}))),function(){return w.apply(this,arguments)})},{key:"getUserList",value:function(){var e=this;return new Promise((function(t,n){e.signalChannel_.send(Gm),e.signalChannel_.once(wm.USER_LIST_RES,(function(e){var r=e.data,i=r.code,a=r.message;if(0!==i){var o=Dg({key:Cg,data:{signalResponse:wm.USER_LIST_RES,code:i,message:a}});n(o)}else{var s=(e.data.data&&e.data.data.userList||[]).map((function(e){var t=e.userId,n=e.srcTinyId,r=e.role;return new Wb({userId:t,tinyId:n,role:r})}));t(s)}})),setTimeout(n,2e3)}))}},{key:"publish",value:(R=i(regeneratorRuntime.mark((function e(t){var n,r,i,a,o=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.setPublishState(Kl),this.isPublishing_=!0,n=Ch(),zp.emit(nf,{client:this,stream:t}),this.log_.info("publish() => publishing local stream"),r=new Fb({userId:this.userId_,tinyId:this.tinyId_,client:this,isUplink:!0,signalChannel:this.signalChannel_}),t.setConnection(r),r.initialize(),r.on(xy,(function(e){var t=e.getCode();t!==zm.ICE_TRANSPORT_ERROR&&(t===zm.UPLINK_RECONNECTION_FAILED&&o.closeUplink(),o.emitter_.emit(Wy,e))})),e.prev=9,e.next=12,r.publish(t);case 12:this.localStream_=e.sent,this.localStream_.getBeautyStatus()&&this.log_.info("beauty stream is published successfully"),this.log_.info("local stream is published successfully"),this.isPublishing_=!1,t.setPublishState(Ql),this.uplinkConnection_=r,i=Ch(),a=i-n,Ng.logSuccessEvent({userId:this.userId_,eventType:hl}),Ng.logSuccessEvent({userId:this.userId_,eventType:pl,delta:a}),t.hasAudio()&&x_(this.userId_,{eventId:Km,eventDesc:"publish audio track",timestamp:go(),userId:this.userId_,tinyId:this.tinyId_}),t.hasVideo()&&x_(this.userId_,{eventId:qm,eventDesc:"publish video track",timestamp:go(),userId:this.userId_,tinyId:this.tinyId_}),this.networkQuality_&&this.networkQuality_.setUplinkConnection(this.uplinkConnection_),this.deviceDetector_&&this.deviceDetector_.setLocalStream(this.localStream_),zp.emit(Sf,{localStream:this.localStream_,client:this}),this.notPublishWithoutH264Supported_=!1,e.next=39;break;case 30:throw e.prev=30,e.t0=e.catch(9),e.t0 instanceof Wm&&e.t0.getCode()===zm.NOT_SUPPORTED_H264&&(this.notPublishWithoutH264Supported_=!0),t.setPublishState(ql),r.close(),this.log_.error("failed to publish stream "+e.t0),this.isPublishing_=!1,Ng.logFailedEvent({userId:this.userId_,eventType:hl,error:e.t0}),e.t0;case 39:case"end":return e.stop()}}),e,this,[[9,30]])}))),function(e){return R.apply(this,arguments)})},{key:"unpublish",value:(T=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.log_.info("unpublish() => unpublishing local stream"),e.prev=1,e.next=4,this.doUnpublish();case 4:Ng.logSuccessEvent({userId:this.userId_,eventType:fl}),e.next=11;break;case 7:throw e.prev=7,e.t0=e.catch(1),Ng.logFailedEvent({userId:this.userId_,eventType:fl,error:e.t0}),e.t0;case 11:case"end":return e.stop()}}),e,this,[[1,7]])}))),function(){return T.apply(this,arguments)})},{key:"doUnpublish",value:function(){var e=this;return this.signalChannel_.sendWaitForResponse({command:Nm,commandDesc:"unpublish",responseCommand:wm.UNPUBLISH_RESULT}).then((function(){e.closeUplink()})).catch((function(){e.closeUplink()}))}},{key:"closeUplink",value:function(){this.uplinkConnection_&&(this.uplinkConnection_.getIsReconnecting()&&this.uplinkConnection_.stopReconnection(),this.uplinkConnection_.close(),this.uplinkConnection_=null,this.networkQuality_&&this.networkQuality_.setUplinkConnection(null),this.localStream_.hasAudio()&&x_(this.userId_,{eventId:Xm,eventDesc:"unpublish audio track",timestamp:go(),userId:this.userId_,tinyId:this.tinyId_}),this.localStream_.hasVideo()&&x_(this.userId_,{eventId:Qm,eventDesc:"unpublish video track",timestamp:go(),userId:this.userId_,tinyId:this.tinyId_}),this.localStream_.setConnection(null),this.localStream_=null,this.deviceDetector_&&this.deviceDetector_.setLocalStream(null))}},{key:"closeDownLink",value:function(e){var t=this.connections_.get(e);t&&(t.getIsReconnecting()&&t.stopReconnection(),this.subscriptionManager_&&this.subscriptionManager_.delete(t.getUserId()),t.close(),this.connections_.delete(e),this.mutedStates_.delete(e))}},{key:"subscribe",value:(I=i(regeneratorRuntime.mark((function e(t,n){var r,i,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.log_.info("subscribe() => subscribe to [".concat(t.getUserId(),"] ").concat(t.getType()," stream with options: ").concat(JSON.stringify(n))),Sh(n)&&(n={audio:!0,video:!0}),Sh(n.video)&&(n.video=!0),Sh(n.audio)&&(n.audio=!0),e.prev=4,r=t.getConnection(),zp.emit(mf,{client:this,stream:t}),e.next=9,r.subscribe(t,n);case 9:this.subscriptionManager_&&this.subscriptionManager_.addSubscriptionRecord(t.getUserId(),t,n),this.notSubscribeWithoutH264Supported_=!1,Ng.logSuccessEvent({userId:this.userId_,eventType:ml}),e.next=22;break;case 14:throw e.prev=14,e.t0=e.catch(4),(i=e.t0 instanceof Wm?e.t0.getCode():zm.UNKNOWN)===zm.NOT_SUPPORTED_H264&&(this.notSubscribeWithoutH264Supported_=!0),a=new Wm({code:i,message:Dg({key:Sv,data:{message:e.t0.message}})}),Ng.logFailedEvent({userId:this.userId_,eventType:ml,error:a}),this.log_.error(a),a;case 22:case"end":return e.stop()}}),e,this,[[4,14]])}))),function(e,t){return I.apply(this,arguments)})},{key:"unsubscribe",value:(k=i(regeneratorRuntime.mark((function e(t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.log_.info("unsubscribe() => unsubscribe to [".concat(t.getUserId(),"] ").concat(t.getType()," stream")),e.prev=1,n=t.getConnection(),e.next=5,n.unsubscribe(t);case 5:this.subscriptionManager_&&this.subscriptionManager_.addUnsubscriptionRecord(t.getUserId(),t),zp.emit(vf,{client:this,stream:t}),Ng.logSuccessEvent({userId:this.userId_,eventType:_l}),e.next=14;break;case 10:throw e.prev=10,e.t0=e.catch(1),Ng.logFailedEvent({userId:this.userId_,eventType:_l,error:e.t0}),e.t0;case 14:case"end":return e.stop()}}),e,this,[[1,10]])}))),function(e){return k.apply(this,arguments)})},{key:"switchRole",value:(S=i(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.role_!==t){e.next=2;break}return e.abrupt("return");case 2:if("audience"!==t||!this.localStream_){e.next=5;break}return e.next=5,this.unpublish(this.localStream_);case 5:return this.log_.info("switchRole() => switch role to: "+t),e.next=8,this.doSwitchRole(t);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return S.apply(this,arguments)})},{key:"doSwitchRole",value:function(e){var t=this;return new Promise((function(n,r){var i={role:"anchor"===e?Gd:Jd};t.log_.info("switchRole signal data: "+JSON.stringify(i));var a=setTimeout((function(){t.log_.error("switchRole timeout observed"),t.signalChannel_.off(wm.SWITCH_ROLE_RES,o),r(new Wm({code:zm.SWITCH_ROLE_FAILED,message:Dg({key:Iv})}))}),5e3),o=function(i){clearTimeout(a);var o=i.data,s=o.code,c=o.message;0===s?(t.role_=e,n()):(t.log_.error("switchRole failed, errCode: ".concat(s,", errMsg: ").concat(c)),r(new Wm({code:zm.SWITCH_ROLE_FAILED,message:Dg({key:Tv,data:{errMsg:c,errCode:s}})})))};t.signalChannel_.once(wm.SWITCH_ROLE_RES,o),t.signalChannel_.send(Jm,i)}))}},{key:"on",value:function(e,t,n){this.emitter_.on(e,t,n)}},{key:"off",value:function(e,t,n){"*"===e?this.emitter_.removeAllListeners():this.emitter_.off(e,t,n)}},{key:"getRemoteMutedState",value:function(){var e=this,n=[];return this.mutedStates_.forEach((function(r,i,a){var o=e.connections_.get(i);o&&n.push(t({userId:o.getUserId()},r))})),n}},{key:"getTransportStats",value:(v=i(regeneratorRuntime.mark((function e(){var t,n,r,i,a,o,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t={rtt:0,downlinksRTT:{}},!this.uplinkConnection_){e.next=6;break}return e.next=4,this.stats_.getSenderStats(this.uplinkConnection_);case 4:n=e.sent,t.rtt=n.rtt;case 6:r=b(this.connections_),e.prev=7,r.s();case 9:if((i=r.n()).done){e.next=17;break}return(a=g(i.value,2))[0],o=a[1],e.next=13,this.stats_.getReceiverStats(o);case 13:s=e.sent,t.downlinksRTT[s.userId]=s.rtt;case 15:e.next=9;break;case 17:e.next=22;break;case 19:e.prev=19,e.t0=e.catch(7),r.e(e.t0);case 22:return e.prev=22,r.f(),e.finish(22);case 25:return e.abrupt("return",t);case 26:case"end":return e.stop()}}),e,this,[[7,19,22,25]])}))),function(){return v.apply(this,arguments)})},{key:"getLocalAudioStats",value:(_=i(regeneratorRuntime.mark((function e(){var t,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((t={})[this.userId_]={bytesSent:0,packetsSent:0},!this.uplinkConnection_){e.next=7;break}return e.next=5,this.stats_.getSenderStats(this.uplinkConnection_);case 5:n=e.sent,t[this.userId_]={bytesSent:n.audio.bytesSent,packetsSent:n.audio.packetsSent};case 7:return e.abrupt("return",t);case 8:case"end":return e.stop()}}),e,this)}))),function(){return _.apply(this,arguments)})},{key:"getLocalVideoStats",value:(m=i(regeneratorRuntime.mark((function e(){var t,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((t={})[this.userId_]={bytesSent:0,packetsSent:0,framesEncoded:0,framesSent:0,frameWidth:0,frameHeight:0},!this.uplinkConnection_){e.next=7;break}return e.next=5,this.stats_.getSenderStats(this.uplinkConnection_);case 5:n=e.sent,t[this.userId_]={bytesSent:n.video.bytesSent,packetsSent:n.video.packetsSent,framesEncoded:n.video.framesEncoded,framesSent:n.video.framesSent,frameWidth:n.video.frameWidth,frameHeight:n.video.frameHeight};case 7:return e.abrupt("return",t);case 8:case"end":return e.stop()}}),e,this)}))),function(){return m.apply(this,arguments)})},{key:"getRemoteAudioStats",value:(f=i(regeneratorRuntime.mark((function e(){var t,n,r,i,a,o,s,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t={},n=b(this.connections_),e.prev=2,n.s();case 4:if((r=n.n()).done){e.next=13;break}return(i=g(r.value,2))[0],a=i[1],o=a.getDelay(),s=o.audioDelay,e.next=9,this.stats_.getReceiverStats(a);case 9:(c=e.sent).hasAudio&&(t[c.userId]={bytesReceived:c.audio.bytesReceived,packetsReceived:c.audio.packetsReceived,packetsLost:c.audio.packetsLost,end2EndDelay:s});case 11:e.next=4;break;case 13:e.next=18;break;case 15:e.prev=15,e.t0=e.catch(2),n.e(e.t0);case 18:return e.prev=18,n.f(),e.finish(18);case 21:return e.abrupt("return",t);case 22:case"end":return e.stop()}}),e,this,[[2,15,18,21]])}))),function(){return f.apply(this,arguments)})},{key:"getRemoteVideoStats",value:(p=i(regeneratorRuntime.mark((function e(){var t,n,r,i,a,o,s,c,u,d=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=d.length>0&&void 0!==d[0]?d[0]:Kd,n={},r=b(this.connections_),e.prev=3,r.s();case 5:if((i=r.n()).done){e.next=15;break}return(a=g(i.value,2))[0],o=a[1],e.next=9,this.stats_.getReceiverStats(o);case 9:s=e.sent,c=o.getDelay(),u=c.videoDelay,t===Kd&&s.hasVideo&&(n[s.userId]={bytesReceived:s.video.bytesReceived,packetsReceived:s.video.packetsReceived,packetsLost:s.video.packetsLost,framesDecoded:s.video.framesDecoded,frameWidth:s.video.frameWidth,frameHeight:s.video.frameHeight,end2EndDelay:u}),t===Qd&&s.hasAuxiliary&&(n[s.userId]={bytesReceived:s.auxiliary.bytesReceived,packetsReceived:s.auxiliary.packetsReceived,packetsLost:s.auxiliary.packetsLost,framesDecoded:s.auxiliary.framesDecoded,frameWidth:s.auxiliary.frameWidth,frameHeight:s.auxiliary.frameHeight,end2EndDelay:u});case 13:e.next=5;break;case 15:e.next=20;break;case 17:e.prev=17,e.t0=e.catch(3),r.e(e.t0);case 20:return e.prev=20,r.f(),e.finish(20);case 23:return e.abrupt("return",n);case 24:case"end":return e.stop()}}),e,this,[[3,17,20,23]])}))),function(){return p.apply(this,arguments)})},{key:"getSdpSemantics",value:function(){return this.sdpSemantics_}},{key:"getIceServers",value:function(){return 0===this.turnServers_.length&&this.schedule_.iceServers?this.schedule_.iceServers:this.turnServers_}},{key:"getConnections",value:function(){return this.connections_}},{key:"getMutedStates",value:function(){return this.mutedStates_}},{key:"startHeartbeat",value:function(){if(-1===this.heartbeat_){this.log_.info("startHeartbeat..."),this.heartbeat_=$g.setInterval(this.doHeartbeat.bind(this),2e3)}}},{key:"stopHeartbeat",value:function(){-1!==this.heartbeat_&&(this.log_.info("stopHeartbeat"),$g.clearInterval(this.heartbeat_),this.heartbeat_=-1,this.lastHeartBeatTime_=-1)}},{key:"doHeartbeat",value:(h=i(regeneratorRuntime.mark((function e(){var n,r,i,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=this.badCaseDetector_.getMonitorFreeze(),e.next=3,this.stats_.getStatsReport({uplinkConnection:this.uplinkConnection_,downlinkConnections:this.connections_,freezeMap:n});case 3:if(r=e.sent,zp.emit(ef,{client:this,stats:r}),this.badCaseDetector_.resetMonitor(),this.signalChannel_){e.next=8;break}return e.abrupt("return");case 8:i=this.signalChannel_.isConnected()?P_(this.userId_):[],a=t(t({str_sdk_version:"4.12.2",uint64_datetime:(new Date).getTime(),msg_user_info:{str_identifier:this.userId_,uint64_tinyid:this.tinyId_},msg_device_info:{uint32_terminal_type:15,str_device_name:navigator.platform,str_os_version:"",uint32_net_type:Wl[this.networkType_]}},r),{},{msg_event_msg:i}),this.signalChannel_.send(xm,a),o=Date.now(),this.lastHeartBeatTime_>0&&o-this.lastHeartBeatTime_>1e4&&this.log_.warn("heartbeat took ".concat(o-this.lastHeartBeatTime_)),this.lastHeartBeatTime_=o,this.isRelayMaybeFailed()&&this.reJoin();case 15:case"end":return e.stop()}}),e,this)}))),function(){return h.apply(this,arguments)})},{key:"onRemoteStreamAdded",value:function(e){var t=e.content,n=t.userId,r=t.tinyId,i=t.audio,a=t.bigVideo,o=t.auxVideo,s=t.smallVideo;if(null!==n){this.userMap_.has(n)||(this.userMap_.set(n,new Wb({userId:n,tinyId:r,role:"anchor"})),this.emitter_.emit(Uy,{userId:n}));var c=this.connections_.get(r);if(c){if(c.getIsReconnecting())return;this.log_.warn("duplicated stream-added observed, rebuild the connection"),c.close(),this.connections_.delete(r)}var u={audio:i,video:a,auxiliary:o,smallVideo:s};this.log_.info("remote peer [".concat(n,"] published stream. trackState: ").concat(JSON.stringify(u))),this.createDownlinkConnection({userId:n,tinyId:r,trackState:u})}else this.log_.warn("received null userId on stream added")}},{key:"createDownlinkConnection",value:function(e){var t=this,n=e.userId,r=e.tinyId,i=e.trackState,a=new jb({userId:n,tinyId:r,client:this,isUplink:!1,signalChannel:this.signalChannel_,autoSubscribe:this.autoSubscribe_,trackState:i});this.connections_.set(r,a),this.installDownlinkEvents(a,n,r),this.autoSubscribe_?(a.initialize(),a.connect().catch((function(){var e=a.getTrackState();a.getMainStream()||!e.audio&&!e.video||t.initRemoteStream({type:Kd,userId:n,downlinkConnection:a}),!a.getAuxStream()&&e.auxiliary&&t.initRemoteStream({type:Qd,userId:n,downlinkConnection:a})}))):((i.audio||i.video)&&this.initRemoteStream({type:Kd,userId:n,downlinkConnection:a}),i.auxiliary&&this.initRemoteStream({type:Qd,userId:n,downlinkConnection:a}))}},{key:"initRemoteStream",value:function(e){var t=e.type,n=e.userId,r=e.downlinkConnection,i=new xb({type:t,userId:n,client:this});i.setConnection(r),r.setRemoteStream(t===Kd?zd:Wd,i),i.setIsStreamAddedEventEmitted(!0),zp.emit(ff,{client:this,stream:i}),this.emitter_.emit(Dy,{stream:i})}},{key:"installDownlinkEvents",value:function(e,t,n){var r=this;e.on(wy,(function(e){e.stream.setIsStreamAddedEventEmitted(!0),zp.emit(ff,{client:r,stream:e.stream}),r.emitter_.emit(Dy,{stream:e.stream})})),e.on(Ey,(function(e){e.stream.stop(),e.stream.setIsStreamAddedEventEmitted(!1),r.subscriptionManager_&&r.subscriptionManager_.deleteAutoRecoveryFlag(e.stream.getUserId(),e.stream.getType()),zp.emit(yf,{client:r,stream:e.stream}),r.emitter_.emit(Ny,{stream:e.stream})})),e.on(Cy,(function(e){zp.emit(gf,{client:r,stream:e.stream}),r.emitter_.emit(Ly,{stream:e.stream})})),e.on(Ay,(function(e){zp.emit(_f,{client:r,stream:e.stream}),r.emitter_.emit(Oy,{stream:e.stream})})),e.on(xy,(function(e){var t=e.getCode();t!==zm.ICE_TRANSPORT_ERROR&&(t===zm.DOWNLINK_RECONNECTION_FAILED&&r.closeDownLink(n),r.emitter_.emit(Wy,e))}))}},{key:"onPeerJoin",value:function(e){var t=e.data.data,n=t.srcTinyId,r=t.userId,i=t.role;this.userMap_.has(r)||(this.userMap_.set(r,new Wb({userId:r,tinyId:n,role:i})),this.emitter_.emit(Uy,{userId:r}))}},{key:"onPeerLeave",value:function(e){var t=e.data.data,n=t.srcTinyId,r=t.userId,i=t.reason,a=void 0===i?0:i;this.log_.info("peer leave [".concat(r,"]: ").concat(hh[a])),this.cleanUser({userId:r,tinyId:n})}},{key:"cleanUser",value:function(e){var t=e.userId,n=e.tinyId;this.userMap_.delete(t),this.closeDownLink(n),this.emitter_.emit(Vy,{userId:t})}},{key:"onPublishedUserList",value:function(e){var t=this;try{var n=e.data.userList.map((function(e){return e.userId}));this.connections_.forEach((function(e){var r=e.getUserId(),i=e.getTinyId();n.findIndex((function(e){return e===r}))<0&&(t.log_.info("peer unpublished detected [".concat(r,"]")),t.closeDownLink(i))})),e.data.userList.forEach((function(e){var n=e.userId,r=e.srcTinyId,i=e.flag;if(n!==t.userId_){var a=!!(1&i),o=!!(8&i),s=!!(4&i),c=!!(2&i);if(t.connections_.has(r)){var u=t.connections_.get(r).getTrackState(),d=u.audio,l=u.video,h=u.auxiliary;!l&&a&&zp.emit(pf,{client:t,tinyId:r,userId:n,action:Jl,kind:ld}),!d&&o&&zp.emit(pf,{client:t,tinyId:r,userId:n,action:Jl,kind:dd}),!h&&s&&zp.emit(pf,{client:t,tinyId:r,userId:n,action:Jl,kind:hd}),l&&!a&&zp.emit(pf,{client:t,tinyId:r,userId:n,action:zl,kind:ld}),d&&!o&&zp.emit(pf,{client:t,tinyId:r,userId:n,action:zl,kind:dd}),h&&!s&&zp.emit(pf,{client:t,tinyId:r,userId:n,action:zl,kind:hd})}else t.log_.info("peer published detected [".concat(n,"]")),t.onRemoteStreamAdded({content:{audio:o,bigVideo:a,auxVideo:s,smallVideo:c,userId:n,tinyId:r}})}}))}catch(JI){}}},{key:"onUpdateRemoteMuteStat",value:function(e){var t=this,n=e.data;(n&&n.userList||[]).forEach((function(e){var n=e.srcTinyId,r=e.userId;if(0!==n&&n!==t.tinyId_){var i=t.connections_.get(n);if(i){var a=i.getMainStream();if(a&&a.getIsStreamAddedEventEmitted()){var o=!!(1&e.flag),s=!!(8&e.flag),c=!!(2&e.flag),u=!!(64&e.flag),d=!!(16&e.flag),l=t.mutedStates_.get(n);if(void 0===l)return t.mutedStates_.set(n,{hasAudio:s,hasVideo:o,hasSmall:c,audioMuted:u,videoMuted:d}),o?d?t.emitter_.emit(jy,{userId:r}):t.emitter_.emit(Hy,{userId:r}):t.emitter_.emit(jy,{userId:r}),void(s?u?t.emitter_.emit(Fy,{userId:r}):t.emitter_.emit(By,{userId:r}):t.emitter_.emit(Fy,{userId:r}));var h=!u&&s;(!l.audioMuted&&l.hasAudio)!==h&&(h?t.emitter_.emit(By,{userId:r}):t.emitter_.emit(Fy,{userId:r}));var p=!d&&o;(!l.videoMuted&&l.hasVideo)!==p&&(p?t.emitter_.emit(Hy,{userId:r}):t.emitter_.emit(jy,{userId:r})),t.mutedStates_.set(n,{hasAudio:s,hasVideo:o,hasSmall:c,audioMuted:u,videoMuted:d})}}else t.mutedStates_.delete(n)}}))}},{key:"onClientBanned",value:function(e){this.emitter_.emit(Gy,new Wm({code:zm.CLIENT_BANNED,message:Dg({key:Rv,data:{reason:e}})}))}},{key:"getEnv",value:function(){return this.env_}},{key:"getSubscriptionManager",value:function(){return this.subscriptionManager_}},{key:"startPublishCDNStream",value:(l=i(regeneratorRuntime.mark((function e(){var t,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=n.length>0&&void 0!==n[0]?n[0]:{},this.localStream_){e.next=3;break}throw new Wm({code:zm.INVALID_OPERATION,message:Dg({key:wv})});case 3:return this.log_.info("startPublishCDNStream params: ".concat(JSON.stringify(t))),e.next=6,this.publishCDNManager_.startPublishTencentCDN(t);case 6:if(!(t.appId&&t.bizId&&t.url)){e.next=9;break}return e.next=9,this.publishCDNManager_.startPublishGivenCDN(t);case 9:case"end":return e.stop()}}),e,this)}))),function(){return l.apply(this,arguments)})},{key:"stopPublishCDNStream",value:(d=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.publishCDNManager_.getIsPublishingTencentCDN()){e.next=2;break}throw new Wm({code:zm.INVALID_OPERATION,message:Dg({key:Ev})});case 2:return this.log_.info("stopPublishCDNStream"),e.next=5,this.publishCDNManager_.stopPublishTencentCDN();case 5:if(!this.publishCDNManager_.getIsPublishingGivenCDN()){e.next=8;break}return e.next=8,this.publishCDNManager_.stopPublishGivenCDN();case 8:case"end":return e.stop()}}),e,this)}))),function(){return d.apply(this,arguments)})},{key:"startMixTranscode",value:(u=i(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isJoined_&&this.mixTranscodeManager_){e.next=2;break}throw new Wm({code:zm.INVALID_OPERATION,message:Dg({key:Pv})});case 2:return Sh(t.mode)&&(t.mode=Ml.MANUAL),e.prev=3,this.log_.info("startMixTranscode with config ".concat(JSON.stringify(t))),Ng.uploadEvent({log:"mix-transcode-mode:".concat(t.mode),userId:this.userId_}),e.next=8,this.mixTranscodeManager_.startMixTranscode(t);case 8:Ng.logSuccessEvent({userId:this.userId_,eventType:Al}),e.next=15;break;case 11:throw e.prev=11,e.t0=e.catch(3),Ng.logFailedEvent({userId:this.userId_,eventType:Al,error:e.t0}),e.t0;case 15:case"end":return e.stop()}}),e,this,[[3,11]])}))),function(e){return u.apply(this,arguments)})},{key:"stopMixTranscode",value:(c=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isJoined_&&this.mixTranscodeManager_){e.next=2;break}throw new Wm({code:zm.INVALID_OPERATION,message:Dg({key:Dv})});case 2:return e.prev=2,e.next=5,this.mixTranscodeManager_.stopMixTranscode();case 5:Ng.logSuccessEvent({userId:this.userId_,eventType:xl}),e.next=12;break;case 8:throw e.prev=8,e.t0=e.catch(2),Ng.logFailedEvent({userId:this.userId_,eventType:xl,error:e.t0}),e.t0;case 12:case"end":return e.stop()}}),e,this,[[2,8]])}))),function(){return c.apply(this,arguments)})},{key:"getSystemResult",value:function(){return this.checkSystemResult_}},{key:"enableAudioVolumeEvaluation",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:2e3,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!bh(t))throw new Wm({code:zm.INVALID_PARAMETER,message:Dg({key:Nv})});if(this.log_.info("enableAudioVolumeEvaluation with interval: "+t),t<=0)return this.enableAudioVolumeEvaluation_=!1,$g.clearInterval(this.audioVolumeIntervalId_),void(this.audioVolumeIntervalId_=null);t=Math.floor(Math.max(t,16)),zp.emit(cf,{interval:t}),this.audioVolumeIntervalId_&&($g.clearInterval(this.audioVolumeIntervalId_),this.audioVolumeIntervalId_=null),this.enableAudioVolumeEvaluation_=!0,this.audioVolumeIntervalId_=$g.setInterval((function(){var t=[];if(e.localStream_){var n=Math.floor(100*e.localStream_.getAudioLevel());t.push({userId:e.userId_,audioVolume:n,stream:e.localStream_})}e.connections_.forEach((function(e){var n=e.getSubscribedMainStream();if(n){var r=Math.floor(100*n.getAudioLevel());t.push({userId:e.getUserId(),audioVolume:r,stream:n})}})),e.emitter_.emit(zy,{result:t})}),t,n)}},{key:"uploadAllCallStats",value:function(){var e=this;this.callDurationCalculator_.getDurationMap().forEach((function(t,n){var r={userId:t.userId,type:t.type,duration:e.callDurationCalculator_.getDuration(n,ld),dataFreeze:e.badCaseDetector_.getDataFreezeDuration(n).dataFreeze,renderFreeze:e.badCaseDetector_.getRenderFreezeDuration(n).renderFreeze};Ng.uploadEvent({log:"callStats-"+JSON.stringify(r),userId:e.userId_})})),this.badCaseDetector_.stop(),this.callDurationCalculator_.reset()}},{key:"enableSmallStream",value:(o=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.isPublished()&&!this.isPublishing_){e.next=2;break}throw new Wm({code:zm.INVALID_OPERATION,message:Dg({key:Lv})});case 2:if(!Iy()){e.next=7;break}this.setIsEnableSmallStream(!0),this.log_.info("SmallStream successfully enabled"),e.next=8;break;case 7:throw new Wm({code:zm.INVALID_OPERATION,message:Dg({key:Mv})});case 8:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"disableSmallStream",value:(r=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.isPublished()&&!this.isPublishing_){e.next=2;break}throw new Wm({code:zm.INVALID_OPERATION,message:Dg({key:Ov})});case 2:this.setIsEnableSmallStream(!1),this.log_.info("SmallStream successfully disabled");case 4:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"setSmallStreamProfile",value:function(e){var t=this;e&&e.framerate&&(e.frameRate=e.framerate),Object.keys(this.smallStreamConfig_).forEach((function(n){e[n]&&(t.smallStreamConfig_[n]=e[n])})),this.log_.info("setSmallStreamProfile: bitrate=".concat(this.smallStreamConfig_.bitrate,", frameRate=").concat(this.smallStreamConfig_.frameRate,", height=").concat(this.smallStreamConfig_.height,", width=").concat(this.smallStreamConfig_.width));var n=this.smallStreamConfig_,r=n.width,i=n.height,a=n.bitrate,o=n.frameRate;if(r<0||i<0||a<0||o<0)throw new Wm({code:zm.INVALID_PARAMETER,message:Dg({key:Uv})})}},{key:"setRemoteVideoStreamType",value:(n=i(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=n,e.next="big"===e.t0||"small"===e.t0?3:6;break;case 3:return e.next=5,this.changeVideoType(t,n);case 5:case 6:return e.abrupt("break",7);case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"changeVideoType",value:(e=i(regeneratorRuntime.mark((function e(t,n){var r,i,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t instanceof xb){e.next=2;break}throw new Wm({code:zm.INVALID_PARAMETER,message:Dg({key:Vv})});case 2:if(t.getConnection()){e.next=4;break}throw new Wm({code:zm.INVALID_OPERATION,message:Dg({key:yv})});case 4:if((r=t.getConnection().getSubscribeState()).video){e.next=8;break}if(r.smallVideo){e.next=8;break}throw new Wm({code:zm.INVALID_OPERATION,message:Dg({key:Fv})});case 8:if(i=this.getRemoteMutedState().filter((function(e){return e.userId===t.getUserId()}))[0],"small"!==n||i&&i.hasSmall){e.next=11;break}throw new Wm({code:zm.INVALID_OPERATION,message:Dg({key:jv})});case 11:return this.log_.info("change video type: streamType=".concat(t.getType(),", set ").concat(n)),a=t.getConnection(),o={video:"big"===n,smallVideo:"small"===n},e.next=16,a.subscribe(t,o);case 16:case"end":return e.stop()}}),e,this)}))),function(t,n){return e.apply(this,arguments)})},{key:"setIsEnableSmallStream",value:function(e){this.isEnableSmallStream_=e}},{key:"getIsEnableSmallStream",value:function(){return this.isEnableSmallStream_}},{key:"smallStreamConfig",get:function(){return this.smallStreamConfig_}},{key:"isPublished",value:function(){return!!this.localStream_}},{key:"getUplinkConnection",value:function(){return this.uplinkConnection_}},{key:"getLocalStream",value:function(){return this.localStream_}},{key:"getMode",value:function(){return this.mode_}},{key:"getBadCaseDetector",value:function(){return this.badCaseDetector_}},{key:"getCallDurationCalculator",value:function(){return this.callDurationCalculator_}},{key:"getIsJoined",value:function(){return this.isJoined_}},{key:"getAllConnections",value:function(){var e=y(this.connections_.values());return this.uplinkConnection_&&e.push(this.uplinkConnection_),e}},{key:"isRelayMaybeFailed",value:function(){var e=this.getAllConnections();if(0===e.length)return!1;for(var t=0;t<e.length;t++)if(e[t].getReconnectionCount()<6)return!1;return!0}},{key:"getUseStringRoomId",value:function(){return this.useStringRoomId_}},{key:"checkConnectionsToReconnect",value:function(){var e=this;this.getAllConnections().forEach((function(t){if(!t.getIsReconnecting()){var n=t.getPeerConnection();n&&n.connectionState===rl&&(e.log_.warn("[".concat(t.getUserId(),"] pc is closed but not reconnect")),t.startReconnection())}}))}},{key:"getEnableAutoPlayDialog",value:function(){return this.enableAutoPlayDialog_}}]),Client}()).prototype,"join",[cI,uI],Object.getOwnPropertyDescriptor(kI.prototype,"join"),kI.prototype),I(kI.prototype,"leave",[dI],Object.getOwnPropertyDescriptor(kI.prototype,"leave"),kI.prototype),I(kI.prototype,"publish",[lI,hI],Object.getOwnPropertyDescriptor(kI.prototype,"publish"),kI.prototype),I(kI.prototype,"unpublish",[pI,fI],Object.getOwnPropertyDescriptor(kI.prototype,"unpublish"),kI.prototype),I(kI.prototype,"subscribe",[mI],Object.getOwnPropertyDescriptor(kI.prototype,"subscribe"),kI.prototype),I(kI.prototype,"unsubscribe",[_I],Object.getOwnPropertyDescriptor(kI.prototype,"unsubscribe"),kI.prototype),I(kI.prototype,"switchRole",[vI,gI],Object.getOwnPropertyDescriptor(kI.prototype,"switchRole"),kI.prototype),I(kI.prototype,"startPublishCDNStream",[yI],Object.getOwnPropertyDescriptor(kI.prototype,"startPublishCDNStream"),kI.prototype),I(kI.prototype,"startMixTranscode",[SI],Object.getOwnPropertyDescriptor(kI.prototype,"startMixTranscode"),kI.prototype),kI),RI=Vf({retryFunction:function(){var e=i(regeneratorRuntime.mark((function e(t){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!my()){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,wI(t);case 4:if(n=e.sent,Bf.info("getUserMedia with constraints: "+JSON.stringify(n)),!n.audio){e.next=11;break}return e.next=9,GI.getMicrophones();case 9:r=e.sent,Bf.info("microphones: ".concat(JSON.stringify(r)));case 11:if(!n.video){e.next=16;break}return e.next=14,GI.getCameras();case 14:i=e.sent,Bf.info("cameras: ".concat(JSON.stringify(i)));case 16:return e.prev=16,e.next=19,navigator.mediaDevices.getUserMedia(n);case 19:return e.abrupt("return",e.sent);case 22:if(e.prev=22,e.t0=e.catch(16),"NotFoundError"!==e.t0.name){e.next=29;break}if(!i||0!==i.length){e.next=27;break}throw new Wm({code:zm.DEVICE_NOT_FOUND,message:Dg({key:Eg})});case 27:if(!r||0!==r.length){e.next=29;break}throw new Wm({code:zm.DEVICE_NOT_FOUND,message:Dg({key:wg})});case 29:throw new Wm({code:zm.INITIALIZE_FAILED,name:e.t0.name,message:e.t0.message,constraint:e.t0.constraint});case 30:case"end":return e.stop()}}),e,null,[[16,22]])})));return function(t){return e.apply(this,arguments)}}(),settings:{retries:3,timeout:500},onError:function(e,t,n){"NotReadableError"===e.name?t():n(e)},onRetrying:function(e){Bf.warn("getUserMedia NotReadableError observed, retrying [".concat(e,"/3]"))}});function wI(e){return EI.apply(this,arguments)}function EI(){return(EI=i(regeneratorRuntime.mark((function e(n){var r,i,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r={echoCancellation:n.echoCancellation,autoGainControl:n.autoGainControl,noiseSuppression:n.noiseSuppression},n.audio){e.next=5;break}r=!1,e.next=15;break;case 5:if(N_(n.microphoneId)){e.next=9;break}r=t({deviceId:{exact:n.microphoneId},sampleRate:n.sampleRate,channelCount:n.channelCount},r),e.next=15;break;case 9:return r=t({sampleRate:n.sampleRate,channelCount:n.channelCount},r),e.next=12,GI.getMicrophones();case 12:i=e.sent,(a=i.filter((function(e){return e.deviceId.length>0}))).length>0&&(r.deviceId={exact:a[0].deviceId});case 15:return o={},o=!Sh(n.facingMode)&&n.video?{facingMode:n.facingMode,width:n.width,height:n.height,frameRate:n.frameRate}:!N_(n.cameraId)&&n.video?{deviceId:{exact:n.cameraId},width:n.width,height:n.height,frameRate:n.frameRate}:!!n.video&&(!!Sh(n.width)||{width:n.width,height:n.height,frameRate:n.frameRate}),e.abrupt("return",{audio:r,video:o});case 18:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var CI=function(){var e=i(regeneratorRuntime.mark((function e(t){var n,r,i,a,o,s,c,u,d;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!my()){e.next=2;break}return e.abrupt("return");case 2:if(n=null,!(Xu&&$u<74||Zu)){e.next=27;break}return r=xI(t),Bf.info("getDisplayMedia with constraints: "+JSON.stringify(r)),e.next=8,navigator.mediaDevices.getDisplayMedia(r);case 8:if(i=e.sent,!t.screenAudio){e.next=14;break}return Bf.warn("Your browser not support capture system audio"),e.abrupt("return",i);case 14:if(!t.audio){e.next=24;break}return a=AI(t),Bf.info("getUserMedia with constraints: "+JSON.stringify(a)),e.next=19,navigator.mediaDevices.getUserMedia(a);case 19:return n=e.sent,i.addTrack(n.getAudioTracks()[0]),e.abrupt("return",i);case 24:return e.abrupt("return",i);case 25:e.next=53;break;case 27:if(!t.screenAudio){e.next=37;break}return t.audioConstraints={echoCancellation:!0,noiseSuppression:!0,sampleRate:44100},o=xI(t),Bf.info("getDisplayMedia with constraints: "+JSON.stringify(o)),e.next=33,navigator.mediaDevices.getDisplayMedia(o);case 33:return s=e.sent,e.abrupt("return",s);case 37:return c=xI(t),Bf.info("getDisplayMedia with constraints: "+JSON.stringify(c)),e.next=41,navigator.mediaDevices.getDisplayMedia(c);case 41:if(u=e.sent,!t.audio){e.next=52;break}return d=AI(t),Bf.info("getUserMedia with constraints: "+JSON.stringify(d)),e.next=47,navigator.mediaDevices.getUserMedia(d);case 47:return n=e.sent,u.addTrack(n.getAudioTracks()[0]),e.abrupt("return",u);case 52:return e.abrupt("return",u);case 53:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();function AI(e){var t={echoCancellation:e.echoCancellation,autoGainControl:e.autoGainControl,noiseSuppression:e.noiseSuppression,sampleRate:e.sampleRate,channelCount:e.channelCount};return Sh(e.microphoneId)||(t.deviceId={exact:e.microphoneId}),{audio:t,video:!1}}function xI(e){var t={},n={width:e.width,height:e.height,frameRate:e.frameRate};return Sh(e.screenSource)||(n.displaySurface=e.screenSource),t.video=n,Sh(e.audioConstraints)||(t.audio=e.audioConstraints),t}var PI=new Map;PI.set("120p",{width:160,height:120,frameRate:15,bitrate:200}),PI.set("180p",{width:320,height:180,frameRate:15,bitrate:350}),PI.set("240p",{width:320,height:240,frameRate:15,bitrate:400}),PI.set("360p",{width:640,height:360,frameRate:15,bitrate:800}),PI.set("480p",{width:640,height:480,frameRate:15,bitrate:900}),PI.set("720p",{width:1280,height:720,frameRate:15,bitrate:1500}),PI.set("1080p",{width:1920,height:1080,frameRate:15,bitrate:2e3}),PI.set("1440p",{width:2560,height:1440,frameRate:30,bitrate:4860}),PI.set("4K",{width:3840,height:2160,frameRate:30,bitrate:9e3});var DI=new Map;DI.set("480p",{width:640,height:480,frameRate:5,bitrate:900}),DI.set("480p_2",{width:640,height:480,frameRate:30,bitrate:1e3}),DI.set("720p",{width:1280,height:720,frameRate:5,bitrate:1200}),DI.set("720p_2",{width:1280,height:720,frameRate:30,bitrate:3e3}),DI.set("1080p",{width:1920,height:1080,frameRate:5,bitrate:1600}),DI.set("1080p_2",{width:1920,height:1080,frameRate:30,bitrate:4e3});var NI,LI,OI=new Map;OI.set("standard",{sampleRate:48e3,channelCount:1,bitrate:40}),OI.set("standard-stereo",{sampleRate:48e3,channelCount:2,bitrate:64}),OI.set("high",{sampleRate:48e3,channelCount:1,bitrate:128}),OI.set("high-stereo",{sampleRate:48e3,channelCount:2,bitrate:192});var MI,UI,VI,FI=(NI=wb.apply(void 0,y(Tb.LOCAL_STREAM.switchDevice)),I((LI=function(e){u(LocalStream,e);var r,o,c,l,h,p,f,m,g,y=_(LocalStream);function LocalStream(e){var n;a(this,LocalStream);var r=t(t({},e),{isRemote:!1,type:"local"});return(n=y.call(this,r)).name_=nh,n.client_=null,n.video_=e.video,n.audio_=e.audio,n.cameraId_=e.cameraId,n.cameraGroupId_="",n.facingMode_=e.facingMode,n.microphoneId_=e.microphoneId,n.microphoneGroupId_="",n.videoSource_=e.videoSource,n.audioSource_=e.audioSource,n.screen_=e.screen,n.screenSource_=e.screenSource,n.screenAudio_=e.screenAudio,n.audioProfile_={echoCancellation:!!Sh(e.echoCancellation)||e.echoCancellation,autoGainControl:!!Sh(e.autoGainControl)||e.autoGainControl,noiseSuppression:!!Sh(e.noiseSuppression)||e.noiseSuppression,sampleRate:48e3,channelCount:1,bitrate:40},n.videoProfile_={width:640,height:480,frameRate:15,bitrate:900},n.screenProfile_={width:1920,height:1080,frameRate:5,bitrate:1600},n.videoBitrate_=n.screen_?1600:900,n.videoSetting_=null,n.muteState_={video:!1,audio:!1,auxVideo:!1},n.beautyStatus_=!1,n.recoverCaptureCount_=0,n.initState(),n.canvas_=null,n.canvasInterval_=-1,n.log_.info("stream created: "+n.id_),n}return s(LocalStream,[{key:"initState",value:function(){this.isAddingTrack_=!1,this.isRemovingTrack_=!1,this.setIsReadyToPublish(!1),this.setPublishState(ql)}},{key:"installEvents",value:function(){v(d(LocalStream.prototype),"installEvents",this).call(this),zp.on(Sf,this.onStreamPublished,this),zp.on(Af,this.onVideoTrackStopped,this),zp.on(Tf,this.onVideoTrackStopped,this),zp.on(Pf,this.onAudioTrackStopped,this),zp.on(xf,this.onAudioTrackStopped,this)}},{key:"uninstallEvents",value:function(){v(d(LocalStream.prototype),"uninstallEvents",this).call(this),zp.off(Sf,this.onStreamPublished,this),zp.off(Af,this.onVideoTrackStopped,this),zp.off(Tf,this.onVideoTrackStopped,this),zp.off(Pf,this.onAudioTrackStopped,this),zp.off(xf,this.onAudioTrackStopped,this)}},{key:"initialize",value:function(){var e=this;return new Promise((function(t,n){if(_y())n(new Wm({code:zm.INVALID_OPERATION,message:Dg({key:yg})}));else{if(Sh(e.audio_)){var r=new MediaStream;return Sh(e.audioSource_)||(r.addTrack(e.audioSource_),e.updateAudioPlayingState(!0)),Sh(e.videoSource_)||(r.addTrack(e.videoSource_),e.updateVideoPlayingState(!0)),e.setMediaStream(r),Ng.logSuccessEvent({userId:e.client_?e.client_.getUserId():e.userId_,eventType:Tl,kind:"custom"}),e.setIsReadyToPublish(!0),t()}e.screen_?(e.log_.info("initialize stream audio: "+e.audio_+" screenAudio: "+e.screenAudio_+" screen: "+e.screen_),CI({audio:e.audio_,screenAudio:e.screenAudio_,microphoneId:e.microphoneId_,screenSource:e.screenSource_,width:e.screenProfile_.width,height:e.screenProfile_.height,frameRate:e.screenProfile_.frameRate,sampleRate:e.audioProfile_.sampleRate,channelCount:e.audioProfile_.channelCount,autoGainControl:e.audioProfile_.autoGainControl,noiseSuppression:e.audioProfile_.noiseSuppression,echoCancellation:e.audioProfile_.echoCancellation}).then((function(n){e.setMediaStream(n),e.updateAudioPlayingState(e.audio_||e.screenAudio_),e.updateVideoPlayingState(!0);var r=e.getVideoTrack();return e.listenForScreenSharingStopped(r),e.setVideoContentHint(Td),e.updateDeviceIdInUse(),e.setIsReadyToPublish(!0),e.log_.info(JSON.stringify(r.getSettings())),Ng.logSuccessEvent({userId:e.client_?e.client_.getUserId():e.userId_,eventType:Tl,kind:"getDisplayMedia"}),t()})).catch((function(t){Ng.logFailedEvent({userId:e.client_?e.client_.getUserId():e.userId_,eventType:Tl,kind:"getDisplayMedia",error:t}),e.log_.error("getDisplayMedia error observed "+t),n(t instanceof Wm?t:new Wm({code:zm.INITIALIZE_FAILED,name:t.name,message:t.message}))}))):(zp.emit(kf,{stream:e,audio:e.audio_,video:e.video_}),e.log_.info("initialize stream audio: "+e.audio_+" video: "+e.video_),RI({audio:e.audio_,video:e.video_,facingMode:e.facingMode_,cameraId:e.cameraId_,microphoneId:e.microphoneId_,width:e.videoProfile_.width,height:e.videoProfile_.height,frameRate:e.videoProfile_.frameRate,sampleRate:e.audioProfile_.sampleRate,channelCount:e.audioProfile_.channelCount,autoGainControl:e.audioProfile_.autoGainControl,noiseSuppression:e.audioProfile_.noiseSuppression,echoCancellation:e.audioProfile_.echoCancellation}).then((function(n){zp.emit(bf,{stream:e,audio:e.audio_,video:e.video_}),e.setMediaStream(n);var r=e.getVideoTrack();return r&&(Ty&&(e.videoSetting_=r.getSettings()),Ry&&e.log_.info("video capabilities: "+JSON.stringify(r.getCapabilities()))),e.updateAudioPlayingState(e.audio_),e.updateVideoPlayingState(e.video_),e.updateDeviceIdInUse(),e.log_.info("gotStream hasAudio: "+e.hasAudio()+" hasVideo: "+e.hasVideo()),e.setIsReadyToPublish(!0),Ng.logSuccessEvent({userId:e.client_?e.client_.getUserId():e.userId_,eventType:Tl,kind:"getUserMedia"}),t()})).catch((function(t){zp.emit(If,{stream:e,audio:e.audio_,video:e.video_,error:t}),Ng.logFailedEvent({userId:e.client_?e.client_.getUserId():e.userId_,eventType:Tl,kind:"getUserMedia",error:t}),e.log_.error("getUserMedia error observed "+t),n(t)})))}}))}},{key:"listenForScreenSharingStopped",value:function(e){var t=this;e.addEventListener("ended",(function(e){t.log_.info("screen sharing was stopped because the video track is ended"),t.emitter_.emit(Ky)}))}},{key:"muteAudio",value:function(){var e=v(d(LocalStream.prototype),"muteAudio",this).call(this);return e&&(this.log_.info("localStream mute audio"),this.sendMutedFlag(dd,!0)),e}},{key:"muteVideo",value:function(){var e=v(d(LocalStream.prototype),"muteVideo",this).call(this);return e&&(this.log_.info("localStream mute video"),this.sendMutedFlag(ld,!0)),e}},{key:"unmuteAudio",value:function(){var e=v(d(LocalStream.prototype),"unmuteAudio",this).call(this);return e&&(this.log_.info("localStream unmute audio"),this.sendMutedFlag(dd,!1)),e}},{key:"unmuteVideo",value:function(){var e=v(d(LocalStream.prototype),"unmuteVideo",this).call(this);return e&&(this.log_.info("localStream unmute video"),this.sendMutedFlag(ld,!1)),e}},{key:"sendMutedFlag",value:function(e,t){this.setMuteState(e,t);var n=this.getConnection();if(n){n.sendMutedFlag(this.muteState_);var r=n.getUserId(),i=n.getTinyId(),a="".concat(t?md:_d," local ").concat(e," track");x_(r,{eventId:e===dd?t?$m:Zm:t?Ym:e_,eventDesc:a,timestamp:go(),userId:r,tinyId:i})}}},{key:"setMuteState",value:function(e,t){this.muteState_[e]=t,this.log_.info("set ".concat(e," muted state: [").concat(t?"mute":"unmute","]"))}},{key:"setAudioProfile",value:function(e){var r;"object"===n(e)?r=e:void 0===(r=OI.get(e))&&(r=OI.get("standard")),this.log_.info("setAudioProfile: "+JSON.stringify(r)),this.audioProfile_=t(t({},this.audioProfile_),r)}},{key:"setVideoProfile",value:(g=i(regeneratorRuntime.mark((function e(n){var r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.connection_||fy()){e.next=2;break}throw new Wm({code:zm.NOT_SUPPORTED,message:Dg({key:kg})});case 2:if(vh(n)?r=t(t({},this.videoProfile_),n):kh(n)&&(r=PI.get(n),Sh(r)&&(r=PI.get("480p"))),this.log_.info("setVideoProfile "+JSON.stringify(r)),!(i=this.getVideoTrack())){e.next=8;break}return e.next=8,i.applyConstraints(r);case 8:if(this.videoBitrate_===r.bitrate){e.next=13;break}if(!this.connection_){e.next=12;break}return e.next=12,this.connection_.setBandwidth(r.bitrate,ld);case 12:this.videoBitrate_=r.bitrate;case 13:this.videoProfile_=r;case 14:case"end":return e.stop()}}),e,this)}))),function(e){return g.apply(this,arguments)})},{key:"getVideoBitrate",value:function(){return this.videoBitrate_}},{key:"getAudioBitrate",value:function(){return this.audioProfile_.bitrate}},{key:"setScreenProfile",value:function(e){var t=e;"object"!==n(e)&&void 0===(t=DI.get(e))&&(t=DI.get("1080p")),this.log_.info("setScreenProfile "+JSON.stringify(e)),this.screenProfile_=t,this.videoBitrate_=t.bitrate}},{key:"getVideoProfile",value:function(){return this.screen_?this.screenProfile_:this.videoProfile_}},{key:"getAudioProfile",value:function(){return this.audioProfile_}},{key:"setVideoContentHint",value:function(e){var t=this.getVideoTrack();t&&"contentHint"in t&&(this.log_.info("set video track contentHint to: "+e),t.contentHint=e,t.contentHint!==e&&this.log_.warn("Invalid video track contentHint: "+e))}},{key:"switchDevice",value:(m=i(regeneratorRuntime.mark((function e(t,n){var r,i,a,o,s,c,u,d,l,h,p,f,m,_,v,g,y;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r=t===dd)){e.next=8;break}if(this.microphoneId_!==n){e.next=4;break}return e.abrupt("return");case 4:this.microphoneId_=n,this.audio_=!0,e.next=12;break;case 8:if(this.cameraId_!==n){e.next=10;break}return e.abrupt("return");case 10:n===pd||n===fd?this.facingMode_=n:this.cameraId_=n,this.video_=!0;case 12:if(this.getMediaStream()){e.next=14;break}return e.abrupt("return");case 14:return this.setIsReadyToPublish(!1),this.log_.info("switchDevice "+t+" to: "+n),r||((i=this.getVideoTrack())&&i.stop(),ju&&(a=this.getAudioTrack())&&(this.log_.info("stop audio track first in huawei env"),a.stop())),r&&(o=this.getAudioTrack(),s=this.getMicrophoneTrackMixed(),o&&o.stop(),s&&s.stop()),e.next=20,RI({audio:this.audio_&&t===dd||ju,video:this.video_&&t===ld,facingMode:n===pd||n===fd?n:void 0,cameraId:this.cameraId_,microphoneId:this.microphoneId_,width:this.videoProfile_.width,height:this.videoProfile_.height,frameRate:this.videoProfile_.frameRate,sampleRate:this.audioProfile_.sampleRate,channelCount:this.audioProfile_.channelCount});case 20:if(c=e.sent,u=null,!r){e.next=27;break}(d=c.getAudioTracks()[0])&&this.isAudioTrackMixed()?(l=this.getAudioTrack(),h=GI.AudioMixerPlugin.getAudioTrackMap(),p=GI.AudioMixerPlugin.mix({targetTrack:d,sourceList:h.get(l.id).sourceList,trackList:h.get(l.id).trackList}),u=p):u=d,e.next=36;break;case 27:if(!(u=c.getVideoTracks()[0])||!this.isVideoTrackBeautified()){e.next=32;break}return e.next=31,this.generateBeautyTrack(u);case 31:u=e.sent;case 32:if(!(f=c.getAudioTracks()[0])||!ju){e.next=36;break}return e.next=36,this.replaceTrack_(f);case 36:return e.next=38,this.replaceTrack_(u);case 38:this.updateDeviceIdInUse(),(m=this.getConnection())&&(_=m.getUserId(),v=m.getTinyId(),g=i_,y="switch camera",r&&(g=a_,y="switch microphone"),x_(_,{eventId:g,eventDesc:y,timestamp:go(),userId:_,tinyId:v})),this.log_.info("switch ".concat(r?"microphone":"camera"," success ")),this.setIsReadyToPublish(!0);case 43:case"end":return e.stop()}}),e,this)}))),function(e,t){return m.apply(this,arguments)})},{key:"addTrack",value:(f=i(regeneratorRuntime.mark((function e(t){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.isAddingTrack_){e.next=2;break}throw new Wm({code:zm.INVALID_OPERATION,message:Dg({key:zv})});case 2:if(!this.isRemovingTrack_){e.next=4;break}throw new Wm({code:zm.INVALID_OPERATION,message:Dg({key:Wv})});case 4:if(this.publishState_!==Kl){e.next=6;break}throw new Wm({code:zm.INVALID_OPERATION,message:Dg({key:qv})});case 6:if(n=this.getMediaStream()){e.next=9;break}throw new Wm({code:zm.INVALID_OPERATION,message:Dg({key:Kv})});case 9:if(!(t.kind===dd&&n.getAudioTracks().length>0||t.kind===ld&&n.getVideoTracks().length>0)){e.next=11;break}throw new Wm({code:zm.INVALID_OPERATION,message:Dg({key:Qv})});case 11:if(t.kind===ld&&Ty&&(r=t.getSettings(),!this.videoSetting_||r.width===this.videoSetting_.width&&r.height===this.videoSetting_.height||this.log_.warn("video resolution of the track (".concat(r.width," x ").concat(r.height,") shall be kept the same as the previous: ").concat(this.videoSetting_.width," x ").concat(this.videoSetting_.height,". It may cause abnormal Cloud Recording."))),e.prev=12,this.isAddingTrack_=!0,this.keepMuteState(t),n.addTrack(t),!(i=this.getConnection())){e.next=20;break}return e.next=20,i.addTrack(t);case 20:t.kind===dd?(this.audio_=!0,this.updateAudioPlayingState(!0)):(this.video_=!0,this.updateVideoPlayingState(!0)),this.isAddingTrack_=!1,e.next=29;break;case 24:throw e.prev=24,e.t0=e.catch(12),n.removeTrack(t),this.isAddingTrack_=!1,e.t0;case 29:case"end":return e.stop()}}),e,this,[[12,24]])}))),function(e){return f.apply(this,arguments)})},{key:"removeTrack",value:(p=i(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.kind!==dd){e.next=2;break}throw new Wm({code:zm.INVALID_PARAMETER,message:Dg({key:Xv})});case 2:if(!this.isAddingTrack_){e.next=4;break}throw new Wm({code:zm.INVALID_OPERATION,message:Dg({key:$v})});case 4:if(!this.isRemovingTrack_){e.next=6;break}throw new Wm({code:zm.INVALID_OPERATION,message:Dg({key:Yv})});case 6:if(this.publishState_!==Kl){e.next=8;break}throw new Wm({code:zm.INVALID_OPERATION,message:Dg({key:Zv})});case 8:if(n=this.getMediaStream()){e.next=11;break}throw new Wm({code:zm.INVALID_OPERATION,message:Dg({key:Kv})});case 11:if(-1!==n.getTracks().indexOf(t)){e.next=13;break}throw new Wm({code:zm.INVALID_PARAMETER,message:Dg({key:eg})});case 13:if(1!==n.getTracks().length){e.next=15;break}throw new Wm({code:zm.INVALID_OPERATION,message:Dg({key:tg})});case 15:if(e.prev=15,this.isRemovingTrack_=!0,!(r=this.getConnection())){e.next=21;break}return e.next=21,r.removeTrack(t);case 21:n.removeTrack(t),t.kind===dd?(this.audio_=!1,this.updateAudioPlayingState(!1)):(this.video_=!1,this.updateVideoPlayingState(!1)),this.isRemovingTrack_=!1,e.next=30;break;case 26:throw e.prev=26,e.t0=e.catch(15),this.isRemovingTrack_=!1,e.t0;case 30:case"end":return e.stop()}}),e,this,[[15,26]])}))),function(e){return p.apply(this,arguments)})},{key:"replaceTrack",value:(h=i(regeneratorRuntime.mark((function e(t){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this.getMediaStream()){e.next=3;break}throw new Wm({code:zm.INVALID_OPERATION,message:Dg({key:Jv})});case 3:if(this.publishState_!==Kl){e.next=5;break}throw new Wm({code:zm.INVALID_OPERATION,message:Dg({key:Gv})});case 5:if(!(t.kind===dd&&n.getAudioTracks().length<=0||t.kind===ld&&n.getVideoTracks().length<=0)){e.next=7;break}throw new Wm({code:zm.INVALID_PARAMETER,message:Dg({key:ng,data:t})});case 7:if(t.kind===ld&&Ty&&(r=t.getSettings(),!this.videoSetting_||r.width===this.videoSetting_.width&&r.height===this.videoSetting_.height||this.log_.warn("video resolution of the track (".concat(r.width," x ").concat(r.height,") shall be kept the same as the previous: ").concat(this.videoSetting_.width," x ").concat(this.videoSetting_.height,". It may cause abnormal Cloud Recording."))),this.keepMuteState(t),t.kind===dd?(n.removeTrack(n.getAudioTracks()[0]),n.addTrack(t),v(d(LocalStream.prototype),"restartAudio",this).call(this)):(n.removeTrack(n.getVideoTracks()[0]),n.addTrack(t),v(d(LocalStream.prototype),"restartVideo",this).call(this)),!(i=this.getConnection())){e.next=14;break}return e.next=14,i.replaceTrack(t);case 14:case"end":return e.stop()}}),e,this)}))),function(e){return h.apply(this,arguments)})},{key:"updateStream",value:(l=i(regeneratorRuntime.mark((function e(t){var n,r,i,a,o,s,c,u,d,l,h,p,f,m,_;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.mediaStream_){e.next=2;break}return e.abrupt("return");case 2:return this.log_.info("updateStream() try to recover local stream"),e.prev=3,e.next=6,GI.getCameras();case 6:return n=e.sent,e.next=9,GI.getMicrophones();case 9:if(r=e.sent,i=this.audio_&&t.audio,(a=this.video_&&t.video)&&0===n.length&&(a=!1,this.log_.info("updateStream() video flag is true, but no camera detected, set video to false")),i&&0===r.length&&(i=!1,this.log_.info("updateStream() audio flag is true, but no microphone detected, set audio to false")),!1!==i||!1!==a){e.next=17;break}return this.log_.info("updateStream() both audio and video are false, recover stream aborted"),e.abrupt("return");case 17:return o=t&&n.findIndex((function(e){return e.deviceId===t.cameraId}))>=0,s=t&&r.findIndex((function(e){return e.deviceId===t.microphoneId}))>=0,e.next=21,RI({audio:i,video:a,cameraId:o?t.cameraId:void 0,microphoneId:s?t.microphoneId:void 0,facingMode:this.facingMode_,width:this.videoProfile_.width,height:this.videoProfile_.height,frameRate:this.videoProfile_.frameRate,sampleRate:this.audioProfile_.sampleRate,channelCount:this.audioProfile_.channelCount});case 21:c=e.sent,u=c.getTracks(),d=0;case 24:if(!(d<u.length)){e.next=49;break}if((l=u[d]).kind!==dd||!this.isAudioTrackMixed()){e.next=37;break}if(h=this.getAudioTrack(),p=GI.AudioMixerPlugin.getAudioTrackMap(),(f=p.get(h.id)).hasMicrophone){e.next=33;break}return l.stop(),e.abrupt("continue",46);case 33:return m=GI.AudioMixerPlugin.mix({targetTrack:l,sourceList:f.sourceList,trackList:f.trackList}),e.next=36,this.replaceTrack_(m);case 36:return e.abrupt("continue",46);case 37:if(l.kind!==ld||!this.isVideoTrackBeautified()){e.next=44;break}return e.next=40,this.generateBeautyTrack(l);case 40:return _=e.sent,e.next=43,this.replaceTrack_(_);case 43:return e.abrupt("continue",46);case 44:return e.next=46,this.replaceTrack_(l);case 46:d++,e.next=24;break;case 49:this.updateDeviceIdInUse(),Ng.logSuccessEvent({userId:this.client_?this.client_.getUserId():this.userId_,eventType:El}),this.log_.info("updateStream() recover local stream successfully"),e.next=59;break;case 54:e.prev=54,e.t0=e.catch(3),Ng.logFailedEvent({userId:this.client_?this.client_.getUserId():this.userId_,eventType:El,error:e.t0}),this.log_.error("updateStream() failed to recover local stream, "+e.t0),this.emitter_.emit(Xy,new Wm({code:zm.DEVICE_AUTO_RECOVER_FAILED,message:e.t0.message}));case 59:case"end":return e.stop()}}),e,this,[[3,54]])}))),function(e){return l.apply(this,arguments)})},{key:"replaceTrack_",value:(c=i(regeneratorRuntime.mark((function e(t){var n,r,i,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this.mediaStream_.getAudioTracks(),r=this.mediaStream_.getVideoTracks(),!(t.kind===dd&&n.length<=0||t.kind===ld&&r.length<=0)){e.next=5;break}return this.log_.info("there is no previous ".concat(t.kind," track, replacement ignored")),e.abrupt("return");case 5:if(this.keepMuteState(t),t.kind===dd?(this.mediaStream_.removeTrack(n[0]),this.mediaStream_.addTrack(t),v(d(LocalStream.prototype),"restartAudio",this).call(this)):(Ty&&(i=t.getSettings(),!this.videoSetting_||i.width===this.videoSetting_.width&&i.height===this.videoSetting_.height||this.log_.warn("the resolution of video track to be replaced (".concat(i.width," x ").concat(i.height,") is different from the previous video settings (").concat(this.videoSetting_.width," x ").concat(this.videoSetting_.height,"). It may cause a cloud recording exception"))),this.mediaStream_.removeTrack(r[0]),this.mediaStream_.addTrack(t),v(d(LocalStream.prototype),"restartVideo",this).call(this)),!(a=this.getConnection())){e.next=11;break}return e.next=11,a.replaceTrack(t);case 11:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"updateDeviceIdInUse",value:function(){var e=this;if(!this.mediaStream_)return this.cameraId_="",this.cameraGroupId_="",this.microphoneId_="",void(this.microphoneGroupId_="");Ty&&this.mediaStream_.getTracks().forEach((function(t){if(t.kind===dd&&e.isAudioTrackMixed()){var n=e.getMicrophoneTrackMixed();if(n){var r=n.getSettings(),i=r.deviceId,a=r.groupId;i&&(e.microphoneId_=i,e.microphoneGroupId_=a)}}else if(t.kind===ld&&e.isVideoTrackBeautified()){var o=e.getBeautyOriginTrack();if(o){var s=o.getSettings(),c=s.deviceId,u=s.groupId;c&&(e.cameraId_=c,e.cameraGroupId_=u)}}else{var d=t.getSettings(),l=d.deviceId,h=d.groupId;l&&(t.kind===dd?(e.microphoneId_=l,e.microphoneGroupId_=h):t.kind!==ld||e.screen_||(e.cameraId_=l,e.cameraGroupId_=h))}}));var t=this.mediaStream_.getAudioTracks(),n=this.mediaStream_.getVideoTracks();t&&0===t.length&&(this.microphoneId_="",this.microphoneGroupId_=""),n&&0===n.length&&(this.cameraId_="",this.cameraGroupId_="")}},{key:"isAudioTrackMixed",value:function(){if(GI.AudioMixerPlugin){var e=GI.AudioMixerPlugin.getAudioTrackMap(),t=this.getAudioTrack();if(e&&t&&e.has(t.id))return!0}return!1}},{key:"getMicrophoneTrackMixed",value:function(){if(GI.AudioMixerPlugin){var e=GI.AudioMixerPlugin.getAudioTrackMap(),t=this.getAudioTrack();if(e&&t&&e.has(t.id)){var n=e.get(t.id);return n.hasMicrophone?n.microphoneTrack:null}}return null}},{key:"isVideoTrackBeautified",value:function(){if(GI.beautyTrackMap){var e=GI.beautyTrackMap,t=this.getVideoTrack();if(t&&e.has(t.id))return!0}return!1}},{key:"getBeautyOriginTrack",value:function(){if(GI.beautyTrackMap){var e=GI.beautyTrackMap,t=this.getVideoTrack();if(t&&e.has(t.id)){var n=e.get(t.id);if(n.originTrack)return n.originTrack}}return null}},{key:"generateBeautyTrack",value:(o=i(regeneratorRuntime.mark((function e(t){var n,r,i,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=null,r=this.getVideoTrack(),i=GI.beautyTrackMap.get(r.id),a=i.param,i.type){e.next=8;break}n=i.pluginInstance.generateBeautyTrack(t),e.next=22;break;case 8:e.t0=i.type,e.next="beauty"===e.t0?11:"virtual"===e.t0?13:"mixed"===e.t0?17:21;break;case 11:return n=i.pluginInstance.generateBeautyTrack(t),e.abrupt("break",22);case 13:return e.next=15,i.pluginInstance.generateVirtualTrack({videoTrack:t,type:a.type,img:a.img});case 15:return n=e.sent,e.abrupt("break",22);case 17:return e.next=19,i.pluginInstance.generateMixedTrack({videoTrack:t,type:a.type,img:a.img});case 19:return n=e.sent,e.abrupt("break",22);case 21:return e.abrupt("break",22);case 22:return i.pluginInstance.deleteSource(r.id),this.log_.info("regenerate beauty track, track id = ".concat(t.id)),e.abrupt("return",n);case 25:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"getScreen",value:function(){return this.screen_}},{key:"hasScreenTrack",value:function(){if(this.screen_)return!0;var e=this.getVideoTrack();return!!e&&(e.contentHint===Td||e.contentHint===Rd)}},{key:"getVideo",value:function(){return this.video_}},{key:"getAudio",value:function(){return this.audio_}},{key:"getCameraId",value:function(){return this.cameraId_}},{key:"getMicrophoneId",value:function(){return this.microphoneId_}},{key:"getMicrophoneGroupId",value:function(){return this.microphoneGroupId_}},{key:"getIsReadyToPublish",value:function(){return this.isReadyToPublish_}},{key:"setIsReadyToPublish",value:function(e){this.isReadyToPublish_=e}},{key:"setPublishState",value:function(e){this.publishState_=e}},{key:"setBeautyStatus",value:function(e){this.beautyStatus_=!!e}},{key:"getBeautyStatus",value:function(){return this.beautyStatus_}},{key:"onStreamPublished",value:function(e){var t=e.localStream,n=e.client;if(t===this){this.client_=n,this.log_.setUserId(n.getUserId()),this.log_.setSdkAppId(n.getSDKAppId());var r=this.getAudioTrack(),i=this.getVideoTrack();if(r){var a=!r.enabled;this.setMuteState(dd,a)}if(i){var o=!i.enabled;this.setMuteState(ld,o)}this.connection_&&this.connection_.sendMutedFlag(this.muteState_)}}},{key:"keepMuteState",value:function(e){e instanceof MediaStreamTrack&&this.muteState_[e.kind]&&(e.enabled=!1,this.log_.warn("prev ".concat(e.kind," track is muted, keep mute state")))}},{key:"onVideoTrackStopped",value:(r=i(regeneratorRuntime.mark((function e(t){var n,r,i,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.stream,r=t.type,!(n!==this||!this.video_||!this.cameraId_||this.recoverCaptureCount_>10||(au||ou)&&r===md)){e.next=3;break}return e.abrupt("return");case 3:if(!(i=this.getVideoTrack())){e.next=11;break}return a=i.getSettings().deviceId,e.next=8,GI.getCameras();case 8:if(!(e.sent.findIndex((function(e){return e.deviceId===a}))<0)){e.next=11;break}return e.abrupt("return");case 11:this.recoverCaptureCount_+=1,Ng.uploadEvent({log:"stat-local-video-".concat(r),userId:this.userId_}),this.updateStream({audio:!1,video:!0,cameraId:this.cameraId_});case 14:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"onAudioTrackStopped",value:function(e){var t=e.stream,n=e.type;t!==this||!this.audio_||!this.microphoneId_||this.recoverCaptureCount_>10||(au||ou)&&n===md||(this.recoverCaptureCount_+=1,Ng.uploadEvent({log:"stat-local-audio-".concat(n),userId:this.userId_}),this.updateStream({audio:!0,video:!1,microphoneId:this.microphoneId_}))}},{key:"setAudioVolume",value:function(e){v(d(LocalStream.prototype),"setAudioVolume",this).call(this,e)}},{key:"clearCanvas",value:function(){this.canvasInterval_&&($g.clearInterval(this.canvasInterval_),this.canvasInterval_=-1,this.canvas_=null)}},{key:"genCanvasTrack",value:function(e){var t=this;this.log_.info("gen canvas track");var n=e.getSettings(),r=n.width,i=n.height,a=n.frameRate;this.canvas_=document.createElement("canvas");var o=this.canvas_.getContext("2d");return this.canvas_.width=r,this.canvas_.height=i,this.canvasInterval_=$g.setInterval((function(){if(t.hasVideo()){var e=t.getVideoTrack().getSettings();e.width===t.canvas_.width&&e.height===t.canvas_.height||(t.canvas_.width=e.width,t.canvas_.height=e.height)}t.videoPlayer_&&t.videoPlayer_.element_&&o.drawImage(t.videoPlayer_.element_,0,0,t.canvas_.width,t.canvas_.height)}),Math.max(66,Math.floor(1e3/a))),this.canvas_.captureStream().getVideoTracks()[0]}}]),LocalStream}(Ab)).prototype,"switchDevice",[NI],Object.getOwnPropertyDescriptor(LI.prototype,"switchDevice"),LI.prototype),LI),jI=0,BI=0,HI=(MI=Rb(Tb.TRTC.createClient),UI=Rb(Tb.TRTC.createStream),I((VI=function(){function e(){a(this,e),this.name_=eh,this.VERSION="4.12.2",this.Logger={loggerManager:Bf,LogLevel:{TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,NONE:5},setLogLevel:function(e){Bf.setLogLevel(e),Dh()&&e<=1&&Pg()},enableUploadLog:function(){Bf.enableUploadLog()},disableUploadLog:function(){Bf.disableUploadLog()}}}var n,r,o,c,u;return s(e,[{key:"checkSystemRequirements",value:(u=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,sy();case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)}))),function(){return u.apply(this,arguments)})},{key:"isScreenShareSupported",value:function(){return uy()}},{key:"isSmallStreamSupported",value:function(){return Iy()}},{key:"getDevices",value:(c=i(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!_y()&&!my()){e.next=2;break}return e.abrupt("return",[]);case 2:return e.next=4,navigator.mediaDevices.enumerateDevices();case 4:return t=e.sent,e.abrupt("return",t.filter((function(e){return e.kind!==bd||"communications"!=e.deviceId})).map((function(e,t){var n=e.label;e.label||(n=e.kind+"_"+t);var r={label:n,deviceId:e.deviceId,kind:e.kind};return e.groupId&&(r.groupId=e.groupId),r})));case 6:case"end":return e.stop()}}),e)}))),function(){return c.apply(this,arguments)})},{key:"getCameras",value:(o=i(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!_y()&&!my()){e.next=2;break}return e.abrupt("return",[]);case 2:return e.next=4,navigator.mediaDevices.enumerateDevices();case 4:return t=e.sent,e.abrupt("return",t.filter((function(e){return e.kind===Id})).map((function(e,t){var n=e.label;e.label||(n="camera_"+t);var r={label:n,deviceId:e.deviceId,kind:e.kind};return e.groupId&&(r.groupId=e.groupId),r})));case 6:case"end":return e.stop()}}),e)}))),function(){return o.apply(this,arguments)})},{key:"getMicrophones",value:(r=i(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!_y()&&!my()){e.next=2;break}return e.abrupt("return",[]);case 2:return e.next=4,navigator.mediaDevices.enumerateDevices();case 4:return t=e.sent,e.abrupt("return",t.filter((function(e){return e.kind===bd&&"communications"!==e.deviceId})).map((function(e,t){var n=e.label;e.label||(n="microphone_"+t);var r={label:n,deviceId:e.deviceId,kind:e.kind};return e.groupId&&(r.groupId=e.groupId),r})));case 6:case"end":return e.stop()}}),e)}))),function(){return r.apply(this,arguments)})},{key:"getSpeakers",value:(n=i(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!_y()&&!my()){e.next=2;break}return e.abrupt("return",[]);case 2:return e.next=4,navigator.mediaDevices.enumerateDevices();case 4:return t=e.sent,e.abrupt("return",t.filter((function(e){return"audiooutput"===e.kind})).map((function(e,t){var n=e.label;e.label||(n="speaker_"+t);var r={label:n,deviceId:e.deviceId,kind:e.kind};return e.groupId&&(r.groupId=e.groupId),r})));case 6:case"end":return e.stop()}}),e)}))),function(){return n.apply(this,arguments)})},{key:"createClient",value:function(e){Hf&&(Hf=!1,Bf.getLogLevel()!=GI.Logger.LogLevel.NONE&&(console.info("******************************************************************************"),console.info("* TRTC Web SDK"),console.info("* API Document: "+"".concat(uh,"index.html")),console.info("* Changelog: https://cloud.tencent.com/document/product/647/38958"),console.info("* Report issues: https://github.com/LiteAVSDK/TRTC_Web/issues"),console.info("******************************************************************************")),Bf.info("TRTC Web SDK Version: 4.12.2"),Bf.info("UserAgent: "+navigator.userAgent),Bf.info("URL of current page: "+location.href));var n={version:this.VERSION},r=new TI(t(t(t({},n),e),{},{seq:++jI}));return zp.emit(of,{client:r}),r}},{key:"createStream",value:function(e){return new FI(t(t({},e),{},{seq:++BI}))}}]),e}()).prototype,"createClient",[MI],Object.getOwnPropertyDescriptor(VI.prototype,"createClient"),VI.prototype),I(VI.prototype,"createStream",[UI],Object.getOwnPropertyDescriptor(VI.prototype,"createStream"),VI.prototype),VI);_y();var GI=new HI;return GI}));
  20. /***/ }),
  21. /***/ 809:
  22. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  23. "use strict";
  24. var __importDefault = (this && this.__importDefault) || function (mod) {
  25. return (mod && mod.__esModule) ? mod : { "default": mod };
  26. };
  27. Object.defineProperty(exports, "__esModule", ({ value: true }));
  28. var TXUntils_1 = __webpack_require__(802);
  29. var rtc_audio_mixer_1 = __importDefault(__webpack_require__(134));
  30. var AudioMixMusic = /** @class */ (function () {
  31. function AudioMixMusic(localStream) {
  32. this.localStream = localStream;
  33. this.lowMix = null;
  34. this.already = [];
  35. }
  36. AudioMixMusic.prototype.createMusic = function (url) {
  37. this.lowMix = rtc_audio_mixer_1.default.createAudioSource({
  38. url: url,
  39. volume: 0.2,
  40. loop: true,
  41. });
  42. this.lowMix.on('play', function (event) {
  43. (0, TXUntils_1.logInfo)('event: play' + event);
  44. });
  45. this.lowMix.on('end', function (event) {
  46. (0, TXUntils_1.logInfo)('event: end' + event);
  47. });
  48. this.lowMix.on('error', function (event) {
  49. (0, TXUntils_1.logInfo)('event: error' + event);
  50. });
  51. };
  52. AudioMixMusic.prototype.addLowMix = function () {
  53. if (this.lowMix) {
  54. this.already.push(this.lowMix);
  55. (0, TXUntils_1.logInfo)('already mix' + this.already);
  56. var origin_1 = this.localStream.getAudioTrack();
  57. var lowAudioTrack = rtc_audio_mixer_1.default.mix({
  58. targetTrack: origin_1,
  59. sourceList: this.already,
  60. });
  61. this.localStream.replaceTrack(lowAudioTrack);
  62. this.updateAlready();
  63. }
  64. };
  65. AudioMixMusic.prototype.leaveRoom = function () {
  66. this.lowMixStop();
  67. this.lowMix = null;
  68. };
  69. AudioMixMusic.prototype.lowMixStart = function () {
  70. this.lowMix && this.lowMix.play();
  71. };
  72. AudioMixMusic.prototype.lowMixPause = function () {
  73. this.lowMix && this.lowMix.pause();
  74. };
  75. AudioMixMusic.prototype.lowMixStop = function () {
  76. this.lowMix && this.lowMix.stop();
  77. };
  78. AudioMixMusic.prototype.lowMixResume = function () {
  79. this.lowMix && this.lowMix.resume();
  80. this.lowMix && this.lowMix.play();
  81. };
  82. AudioMixMusic.prototype.updateAlready = function () {
  83. (0, TXUntils_1.logInfo)('already mixed audio: ' + (this.already || []).length);
  84. };
  85. return AudioMixMusic;
  86. }());
  87. exports["default"] = AudioMixMusic;
  88. /***/ }),
  89. /***/ 996:
  90. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  91. "use strict";
  92. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  93. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  94. return new (P || (P = Promise))(function (resolve, reject) {
  95. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  96. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  97. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  98. step((generator = generator.apply(thisArg, _arguments || [])).next());
  99. });
  100. };
  101. var __generator = (this && this.__generator) || function (thisArg, body) {
  102. var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
  103. return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
  104. function verb(n) { return function (v) { return step([n, v]); }; }
  105. function step(op) {
  106. if (f) throw new TypeError("Generator is already executing.");
  107. while (_) try {
  108. if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
  109. if (y = 0, t) op = [op[0] & 2, t.value];
  110. switch (op[0]) {
  111. case 0: case 1: t = op; break;
  112. case 4: _.label++; return { value: op[1], done: false };
  113. case 5: _.label++; y = op[1]; op = [0]; continue;
  114. case 7: op = _.ops.pop(); _.trys.pop(); continue;
  115. default:
  116. if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
  117. if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
  118. if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
  119. if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
  120. if (t[2]) _.ops.pop();
  121. _.trys.pop(); continue;
  122. }
  123. op = body.call(thisArg, _);
  124. } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
  125. if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
  126. }
  127. };
  128. var __importDefault = (this && this.__importDefault) || function (mod) {
  129. return (mod && mod.__esModule) ? mod : { "default": mod };
  130. };
  131. Object.defineProperty(exports, "__esModule", ({ value: true }));
  132. // import { logError } from './common/TXUntils';
  133. // @ts-nocheck
  134. var TXUntils_1 = __webpack_require__(802);
  135. var trtc_js_sdk_1 = __importDefault(__webpack_require__(24));
  136. var DeviceManage = /** @class */ (function () {
  137. function DeviceManage() {
  138. this._currentDevice = new Map();
  139. }
  140. // 桌面端设备操作接口
  141. DeviceManage.prototype.getDevicesList = function (_args) {
  142. return __awaiter(this, void 0, void 0, function () {
  143. var type, devicesls;
  144. return __generator(this, function (_a) {
  145. switch (_a.label) {
  146. case 0:
  147. type = (0, TXUntils_1.getFlutterArgs)(_args, 'type');
  148. devicesls = [];
  149. if (!(type === 0)) return [3 /*break*/, 2];
  150. return [4 /*yield*/, trtc_js_sdk_1.default.getMicrophones()];
  151. case 1:
  152. devicesls = _a.sent();
  153. return [3 /*break*/, 6];
  154. case 2:
  155. if (!(type === 1)) return [3 /*break*/, 4];
  156. return [4 /*yield*/, trtc_js_sdk_1.default.getSpeakers()];
  157. case 3:
  158. devicesls = _a.sent();
  159. return [3 /*break*/, 6];
  160. case 4:
  161. if (!(type === 2)) return [3 /*break*/, 6];
  162. return [4 /*yield*/, trtc_js_sdk_1.default.getCameras()];
  163. case 5:
  164. devicesls = _a.sent();
  165. _a.label = 6;
  166. case 6: return [2 /*return*/, JSON.stringify(devicesls)];
  167. }
  168. });
  169. });
  170. };
  171. //
  172. DeviceManage.prototype.setCurrentDevice = function (_localStream, _args) {
  173. return __awaiter(this, void 0, void 0, function () {
  174. var type, deviceId, _a, error_1;
  175. return __generator(this, function (_b) {
  176. switch (_b.label) {
  177. case 0:
  178. type = (0, TXUntils_1.getFlutterArgs)(_args, 'type');
  179. deviceId = (0, TXUntils_1.getFlutterArgs)(_args, 'deviceId');
  180. _b.label = 1;
  181. case 1:
  182. _b.trys.push([1, 4, , 5]);
  183. _a = _localStream;
  184. if (!_a) return [3 /*break*/, 3];
  185. return [4 /*yield*/, _localStream.switchDevice(type === 2 ? 'video' : 'audio', deviceId)];
  186. case 2:
  187. _a = (_b.sent());
  188. _b.label = 3;
  189. case 3:
  190. _a;
  191. this._currentDevice[type] = deviceId;
  192. return [3 /*break*/, 5];
  193. case 4:
  194. error_1 = _b.sent();
  195. (0, TXUntils_1.logError)('setCurrentDevice failed ' + error_1);
  196. return [3 /*break*/, 5];
  197. case 5: return [2 /*return*/, 0];
  198. }
  199. });
  200. });
  201. };
  202. DeviceManage.prototype.getCurrentDevice = function (_args) {
  203. return __awaiter(this, void 0, void 0, function () {
  204. var type, deviceId, devicesls, obj;
  205. return __generator(this, function (_a) {
  206. switch (_a.label) {
  207. case 0:
  208. type = (0, TXUntils_1.getFlutterArgs)(_args, 'type');
  209. if (this._currentDevice[type]) {
  210. deviceId = this._currentDevice[type];
  211. }
  212. devicesls = [];
  213. if (!(type === 0)) return [3 /*break*/, 2];
  214. return [4 /*yield*/, trtc_js_sdk_1.default.getMicrophones()];
  215. case 1:
  216. devicesls = _a.sent();
  217. return [3 /*break*/, 6];
  218. case 2:
  219. if (!(type === 1)) return [3 /*break*/, 4];
  220. return [4 /*yield*/, trtc_js_sdk_1.default.getSpeakers()];
  221. case 3:
  222. devicesls = _a.sent();
  223. return [3 /*break*/, 6];
  224. case 4:
  225. if (!(type === 2)) return [3 /*break*/, 6];
  226. return [4 /*yield*/, trtc_js_sdk_1.default.getCameras()];
  227. case 5:
  228. devicesls = _a.sent();
  229. _a.label = 6;
  230. case 6:
  231. if (deviceId && deviceId !== '') {
  232. obj = devicesls.find(function (item) {
  233. // eslint-disable-next-line eqeqeq
  234. return item.deviceId == deviceId ? true : false;
  235. });
  236. if (obj) {
  237. return [2 /*return*/, JSON.stringify(obj)];
  238. }
  239. }
  240. return [2 /*return*/, JSON.stringify(devicesls[0])];
  241. }
  242. });
  243. });
  244. };
  245. DeviceManage.prototype.setCurrentDeviceVolume = function (_args) {
  246. return __awaiter(this, void 0, void 0, function () {
  247. return __generator(this, function (_a) {
  248. (0, TXUntils_1.noSupportFunction)('setCurrentDeviceVolume');
  249. return [2 /*return*/, 0];
  250. });
  251. });
  252. };
  253. DeviceManage.prototype.getCurrentDeviceVolume = function (_args) {
  254. return __awaiter(this, void 0, void 0, function () {
  255. return __generator(this, function (_a) {
  256. (0, TXUntils_1.noSupportFunction)('getCurrentDeviceVolume');
  257. return [2 /*return*/, 0];
  258. });
  259. });
  260. };
  261. DeviceManage.prototype.setCurrentDeviceMute = function (_args) {
  262. return __awaiter(this, void 0, void 0, function () {
  263. return __generator(this, function (_a) {
  264. (0, TXUntils_1.noSupportFunction)('setCurrentDeviceMute');
  265. return [2 /*return*/, 0];
  266. });
  267. });
  268. };
  269. DeviceManage.prototype.getCurrentDeviceMute = function (_args) {
  270. return __awaiter(this, void 0, void 0, function () {
  271. return __generator(this, function (_a) {
  272. (0, TXUntils_1.noSupportFunction)('getCurrentDeviceMute');
  273. return [2 /*return*/, true];
  274. });
  275. });
  276. };
  277. DeviceManage.prototype.startCameraDeviceTest = function (_args) {
  278. return __awaiter(this, void 0, void 0, function () {
  279. return __generator(this, function (_a) {
  280. (0, TXUntils_1.noSupportFunction)('startCameraDeviceTest');
  281. return [2 /*return*/, 0];
  282. });
  283. });
  284. };
  285. DeviceManage.prototype.stopCameraDeviceTest = function (_args) {
  286. return __awaiter(this, void 0, void 0, function () {
  287. return __generator(this, function (_a) {
  288. (0, TXUntils_1.noSupportFunction)('stopCameraDeviceTest');
  289. return [2 /*return*/, 0];
  290. });
  291. });
  292. };
  293. DeviceManage.prototype.startMicDeviceTest = function (_args) {
  294. return __awaiter(this, void 0, void 0, function () {
  295. return __generator(this, function (_a) {
  296. (0, TXUntils_1.noSupportFunction)('startMicDeviceTest');
  297. return [2 /*return*/, 0];
  298. });
  299. });
  300. };
  301. DeviceManage.prototype.stopMicDeviceTest = function (_args) {
  302. return __awaiter(this, void 0, void 0, function () {
  303. return __generator(this, function (_a) {
  304. (0, TXUntils_1.noSupportFunction)('stopMicDeviceTest');
  305. return [2 /*return*/, 0];
  306. });
  307. });
  308. };
  309. DeviceManage.prototype.startSpeakerDeviceTest = function (_args) {
  310. return __awaiter(this, void 0, void 0, function () {
  311. return __generator(this, function (_a) {
  312. (0, TXUntils_1.noSupportFunction)('startSpeakerDeviceTest');
  313. return [2 /*return*/, 0];
  314. });
  315. });
  316. };
  317. DeviceManage.prototype.stopSpeakerDeviceTest = function (_args) {
  318. return __awaiter(this, void 0, void 0, function () {
  319. return __generator(this, function (_a) {
  320. (0, TXUntils_1.noSupportFunction)('stopSpeakerDeviceTest');
  321. return [2 /*return*/, 0];
  322. });
  323. });
  324. };
  325. return DeviceManage;
  326. }());
  327. exports["default"] = DeviceManage;
  328. /***/ }),
  329. /***/ 627:
  330. /***/ ((__unused_webpack_module, exports) => {
  331. "use strict";
  332. Object.defineProperty(exports, "__esModule", ({ value: true }));
  333. var ListenerType;
  334. (function (ListenerType) {
  335. /// 错误回调,表示 SDK 不可恢复的错误,一定要监听并分情况给用户适当的界面提示
  336. ///
  337. /// 参数param:
  338. ///
  339. /// errCode 错误码
  340. ///
  341. /// errMsg 错误信息
  342. ///
  343. /// extraInfo 扩展信息字段,个别错误码可能会带额外的信息帮助定位问题
  344. ListenerType["onError"] = "onError";
  345. /// 警告回调,用于告知您一些非严重性问题,例如出现卡顿或者可恢复的解码失败。
  346. ///
  347. /// 参数param:
  348. ///
  349. /// warningCode 错误码
  350. ///
  351. /// warningMsg 警告信息
  352. ///
  353. /// extraInfo 扩展信息字段,个别警告码可能会带额外的信息帮助定位问题
  354. ListenerType["onWarning"] = "onWarning";
  355. /// 已加入房间的回调
  356. ///
  357. /// 调用 TRTCCloud 中的 enterRoom() 接口执行进房操作后,会收到来自 SDK 的 onEnterRoom(result) 回调:
  358. ///
  359. /// 如果加入成功,result 会是一个正数(result > 0),代表加入房间的时间消耗,单位是毫秒(ms)。
  360. ///
  361. /// 如果加入失败,result 会是一个负数(result < 0),代表进房失败的错误码。
  362. ///
  363. /// 参数param:
  364. ///
  365. /// result > 0 时为进房耗时(ms),result < 0 时为进房错误码
  366. ListenerType["onEnterRoom"] = "onEnterRoom";
  367. /// 离开房间的事件回调
  368. ///
  369. /// 调用 TRTCCloud 中的 exitRoom() 接口会执行退出房间的相关逻辑,例如释放音视频设备资源和编解码器资源等。 待资源释放完毕,SDK 会通过 onExitRoom() 回调通知到您。
  370. ///
  371. /// 如果您要再次调用 enterRoom() 或者切换到其他的音视频 SDK,请等待 onExitRoom() 回调到来之后再执行相关操作。 否则可能会遇到音频设备被占用等各种异常问题。
  372. ///
  373. /// 参数param:
  374. ///
  375. /// reason 离开房间原因,0:主动调用 exitRoom 退房;1:被服务器踢出当前房间;2:当前房间整个被解散。
  376. ListenerType["onExitRoom"] = "onExitRoom";
  377. /// 切换角色的事件回调
  378. ///
  379. /// 调用 TRTCCloud 中的 switchRole() 接口会切换主播和观众的角色,该操作会伴随一个线路切换的过程, 待 SDK 切换完成后,会抛出 onSwitchRole() 事件回调。
  380. ///
  381. /// 参数param:
  382. ///
  383. /// errCode 错误码,0代表切换成功
  384. ///
  385. /// errMsg 错误信息。
  386. ListenerType["onSwitchRole"] = "onSwitchRole";
  387. /// 有用户加入当前房间。
  388. ///
  389. /// 出于性能方面的考虑,在两种不同的应用场景下,该通知的行为会有差别:
  390. ///
  391. /// 通话场景(TRTCCloudDef.TRTC_APP_SCENE_VIDEOCALL 和 TRTCCloudDef.TRTC_APP_SCENE_AUDIOCALL):该场景下用户没有角色的区别,任何用户进入房间都会触发该通知。
  392. ///
  393. /// 直播场景(TRTCCloudDef.TRTC_APP_SCENE_LIVE 和 TRTCCloudDef.TRTC_APP_SCENE_VOICE_CHATROOM):该场景不限制观众的数量,如果任何用户进出都抛出回调会引起很大的性能损耗,所以该场景下只有主播进入房间时才会触发该通知,观众进入房间不会触发该通知。
  394. ///
  395. /// 参数param:
  396. ///
  397. /// userId 用户标识
  398. ListenerType["onRemoteUserEnterRoom"] = "onRemoteUserEnterRoom";
  399. /// 有用户离开当前房间。
  400. ///
  401. /// 与 onRemoteUserEnterRoom 相对应,在两种不同的应用场景下,该通知的行为会有差别:
  402. ///
  403. /// 通话场景(TRTCCloudDef.TRTC_APP_SCENE_VIDEOCALL 和 TRTCCloudDef.TRTC_APP_SCENE_AUDIOCALL):该场景下用户没有角色的区别,任何用户的离开都会触发该通知。
  404. ///
  405. /// 直播场景(TRTCCloudDef.TRTC_APP_SCENE_LIVE 和 TRTCCloudDef.TRTC_APP_SCENE_VOICE_CHATROOM):只有主播离开房间时才会触发该通知,观众离开房间不会触发该通知。
  406. ///
  407. /// 参数param:
  408. ///
  409. /// userId 用户标识
  410. ///
  411. /// reason 离开原因,0表示用户主动退出房间,1表示用户超时退出,2表示被踢出房间。
  412. ListenerType["onRemoteUserLeaveRoom"] = "onRemoteUserLeaveRoom";
  413. /// 请求跨房通话(主播 PK)的结果回调
  414. ///
  415. /// 调用 TRTCCloud 中的 connectOtherRoom() 接口会将两个不同房间中的主播拉通视频通话,也就是所谓的“主播PK”功能。 调用者会收到 onConnectOtherRoom() 回调来获知跨房通话是否成功, 如果成功,两个房间中的所有用户都会收到 PK 主播的 onUserVideoAvailable() 回调。
  416. ///
  417. /// 参数param:
  418. ///
  419. /// userId 要 PK 的目标主播 userid。
  420. ///
  421. /// errCode 错误码,ERR_NULL 代表切换成功,其他请参见[错误码](https://cloud.tencent.com/document/product/647/32257)。
  422. ///
  423. /// errMsg 错误信息
  424. ListenerType["onConnectOtherRoom"] = "onConnectOtherRoom";
  425. /// 结束跨房通话(主播 PK)的结果回调
  426. ListenerType["onDisConnectOtherRoom"] = "onDisConnectOtherRoom";
  427. /// 切换房间 (switchRoom) 的结果回调
  428. ///
  429. /// 参数param:
  430. ///
  431. /// errCode 错误码
  432. ///
  433. /// errMsg 错误信息
  434. ListenerType["onSwitchRoom"] = "onSwitchRoom";
  435. /// 远端用户是否存在可播放的主路画面(一般用于摄像头)
  436. ///
  437. /// 当您收到 onUserVideoAvailable(userId, true) 通知时,表示该路画面已经有可用的视频数据帧到达。 此时,您需要调用 startRemoteView(userid) 接口加载该用户的远程画面。 然后,您会收到名为 onFirstVideoFrame(userid) 的首帧画面渲染回调。
  438. ///
  439. /// 当您收到 onUserVideoAvailable(userId, false) 通知时,表示该路远程画面已经被关闭,可能由于该用户调用了 muteLocalVideo() 或 stopLocalPreview()。
  440. ///
  441. /// 参数param:
  442. ///
  443. /// userId 用户标识
  444. ///
  445. /// available 画面是否开启
  446. ListenerType["onUserVideoAvailable"] = "onUserVideoAvailable";
  447. /// 远端用户是否存在可播放的辅路画面(一般用于屏幕分享)
  448. ///
  449. /// 参数param:
  450. ///
  451. /// userId 用户标识
  452. ///
  453. /// available 屏幕分享是否开启
  454. ListenerType["onUserSubStreamAvailable"] = "onUserSubStreamAvailable";
  455. /// 远端用户是否存在可播放的音频数据
  456. ///
  457. /// 参数param:
  458. ///
  459. /// userId 用户标识
  460. ///
  461. /// available 声音是否开启
  462. ListenerType["onUserAudioAvailable"] = "onUserAudioAvailable";
  463. /// 开始渲染本地或远程用户的首帧画面
  464. ///
  465. /// 如果 userId 为 null,代表开始渲染本地采集的摄像头画面,需要您先调用 startLocalPreview 触发。 如果 userId 不为 null,代表开始渲染远程用户的首帧画面,需要您先调用 startRemoteView 触发。
  466. ///
  467. /// 只有当您调用 startLocalPreview()、startRemoteView() 或 startRemoteSubStreamView() 之后,才会触发该回调。
  468. ///
  469. /// 参数param:
  470. ///
  471. /// userId 本地或远程用户 ID,如果 userId == null 代表本地,userId != null 代表远程。
  472. ///
  473. /// streamType 视频流类型:摄像头或屏幕分享。
  474. ///
  475. /// width 画面宽度
  476. ///
  477. /// height 画面高度
  478. ListenerType["onFirstVideoFrame"] = "onFirstVideoFrame";
  479. /// 开始播放远程用户的首帧音频(本地声音暂不通知)。
  480. ///
  481. /// 参数param:
  482. ///
  483. /// userId 远程用户 ID。
  484. ListenerType["onFirstAudioFrame"] = "onFirstAudioFrame";
  485. /// 首帧本地音频数据已经被送出。
  486. ///
  487. /// SDK 会在 enterRoom() 并 startLocalPreview() 成功后开始摄像头采集,并将采集到的画面进行编码。 当 SDK 成功向云端送出第一帧视频数据后,会抛出这个回调事件。
  488. ///
  489. /// 参数param:
  490. ///
  491. /// streamType 视频流类型,大画面、小画面或辅流画面(屏幕分享)
  492. ListenerType["onSendFirstLocalVideoFrame"] = "onSendFirstLocalVideoFrame";
  493. /// 首帧本地音频数据已经被送出
  494. ///
  495. /// SDK 会在 enterRoom() 并 startLocalAudio() 成功后开始麦克风采集,并将采集到的声音进行编码。 当 SDK 成功向云端送出第一帧音频数据后,会抛出这个回调事件。
  496. ListenerType["onSendFirstLocalAudioFrame"] = "onSendFirstLocalAudioFrame";
  497. /// 网络质量:该回调每2秒触发一次,统计当前网络的上行和下行质量。
  498. ///
  499. /// userId 为本地用户 ID 代表自己当前的视频质量
  500. ///
  501. /// 参数param:
  502. ///
  503. /// localQuality 上行网络质量
  504. ///
  505. /// remoteQuality 下行网络质量
  506. ListenerType["onNetworkQuality"] = "onNetworkQuality";
  507. /// 技术指标统计回调
  508. ///
  509. /// 如果您是熟悉音视频领域相关术语,可以通过这个回调获取 SDK 的所有技术指标。 如果您是首次开发音视频相关项目,可以只关注 onNetworkQuality 回调。
  510. ///
  511. /// 注意:每2秒回调一次
  512. ///
  513. /// 参数param:
  514. ///
  515. /// statics 状态数据
  516. ListenerType["onStatistics"] = "onStatistics";
  517. /// SDK 跟服务器的连接断开
  518. ListenerType["onConnectionLost"] = "onConnectionLost";
  519. /// SDK 尝试重新连接到服务器。
  520. ListenerType["onTryToReconnect"] = "onTryToReconnect";
  521. /// SDK 跟服务器的连接恢复。
  522. ListenerType["onConnectionRecovery"] = "onConnectionRecovery";
  523. /// 服务器测速的回调,SDK 对多个服务器 IP 做测速,每个 IP 的测速结果通过这个回调通知。
  524. ///
  525. /// 参数param:
  526. ///
  527. /// currentResult 当前完成的测速结果
  528. ///
  529. /// finishedCount 已完成测速的服务器数量
  530. ///
  531. /// totalCount 需要测速的服务器总数量
  532. ListenerType["onSpeedTest"] = "onSpeedTest";
  533. /// 摄像头准备就绪。
  534. ListenerType["onCameraDidReady"] = "onCameraDidReady";
  535. /// 麦克风准备就绪
  536. ListenerType["onMicDidReady"] = "onMicDidReady";
  537. /// 用于提示音量大小的回调,包括每个 userId 的音量和远端总音量。
  538. ///
  539. /// 您可以通过调用 TRTCCloud 中的 enableAudioVolumeEvaluation 接口来开关这个回调或者设置它的触发间隔。 需要注意的是,调用 enableAudioVolumeEvaluation 开启音量回调后,无论频道内是否有人说话,都会按设置的时间间隔调用这个回调; 如果没有人说话,则 userVolumes 为空,totalVolume 为0。
  540. ///
  541. /// 注意:userId 为本地用户 ID 时表示自己的音量,userVolumes 内仅包含正在说话(音量不为0)的用户音量信息。
  542. ///
  543. /// 参数param:
  544. ///
  545. /// userVolumes 所有正在说话的房间成员的音量,取值范围0 - 100。
  546. ///
  547. /// totalVolume 所有远端成员的总音量, 取值范围0 - 100。
  548. ListenerType["onUserVoiceVolume"] = "onUserVoiceVolume";
  549. /// 收到自定义消息回调
  550. ///
  551. /// 当房间中的某个用户使用 sendCustomCmdMsg 发送自定义消息时,房间中的其它用户可以通过 onRecvCustomCmdMsg 接口接收消息
  552. ///
  553. /// 参数param:
  554. ///
  555. /// userId 用户标识
  556. ///
  557. /// cmdID 命令 ID
  558. ///
  559. /// seq 消息序号
  560. ///
  561. /// message 消息数据
  562. ListenerType["onRecvCustomCmdMsg"] = "onRecvCustomCmdMsg";
  563. /// 自定义消息丢失回调
  564. ///
  565. /// 实时音视频使用 UDP 通道,即使设置了可靠传输(reliable)也无法确保100%不丢失,只是丢消息概率极低,能满足常规可靠性要求。 在发送端设置了可靠传输(reliable)后,SDK 都会通过此回调通知过去时间段内(通常为5s)传输途中丢失的自定义消息数量统计信息。
  566. ///
  567. /// 注意:
  568. ///
  569. /// 只有在发送端设置了可靠传输(reliable),接收方才能收到消息的丢失回调
  570. ///
  571. /// 参数param:
  572. ///
  573. /// userId 用户标识
  574. ///
  575. /// cmdID 数据流 ID
  576. ///
  577. /// errCode 错误码,当前版本为-1
  578. ///
  579. /// missed 丢失的消息数量
  580. ListenerType["onMissCustomCmdMsg"] = "onMissCustomCmdMsg";
  581. /// 收到 SEI 消息的回调
  582. ///
  583. /// 当房间中的某个用户使用 sendSEIMsg 发送数据时,房间中的其它用户可以通过 onRecvSEIMsg 接口接收数据。
  584. ///
  585. /// 参数param:
  586. ///
  587. /// userId 用户标识
  588. ///
  589. /// message 数据
  590. ListenerType["onRecvSEIMsg"] = "onRecvSEIMsg";
  591. /// 开始向腾讯云的直播 CDN 推流的回调,对应于 TRTCCloud 中的 startPublishing() 接口
  592. ///
  593. /// 参数param:
  594. ///
  595. /// errCode 0表示成功,其余值表示失败
  596. ///
  597. /// errMsg 具体错误原因
  598. ListenerType["onStartPublishing"] = "onStartPublishing";
  599. /// 停止向腾讯云的直播 CDN 推流的回调,对应于 TRTCCloud 中的 stopPublishing() 接口
  600. ///
  601. /// 参数param:
  602. ///
  603. /// errCode 0表示成功,其余值表示失败
  604. ///
  605. /// errMsg 具体错误原因
  606. ListenerType["onStopPublishing"] = "onStopPublishing";
  607. /// 启动旁路推流到 CDN 完成的回调
  608. ///
  609. /// 对应于 TRTCCloud 中的 startPublishCDNStream() 接口
  610. ///
  611. /// 注意:Start 回调如果成功,只能说明转推请求已经成功告知给腾讯云,如果目标 CDN 有异常,还是有可能会转推失败。
  612. ///
  613. /// 参数param:
  614. ///
  615. /// errCode 0表示成功,其余值表示失败
  616. ///
  617. /// errMsg 具体错误原因
  618. ListenerType["onStartPublishCDNStream"] = "onStartPublishCDNStream";
  619. /// 停止旁路推流到 CDN 完成的回调
  620. ///
  621. /// 对应于 TRTCCloud 中的 stopPublishCDNStream() 接口
  622. ///
  623. /// 参数param:
  624. ///
  625. /// errCode 0表示成功,其余值表示失败
  626. ///
  627. /// errMsg 具体错误原因
  628. ListenerType["onStopPublishCDNStream"] = "onStopPublishCDNStream";
  629. /// 设置云端的混流转码参数的回调,对应于 TRTCCloud 中的 setMixTranscodingConfig() 接口。
  630. ///
  631. /// 参数param:
  632. ///
  633. /// errCode 0表示成功,其余值表示失败
  634. ///
  635. /// errMsg 具体错误原因
  636. ListenerType["onSetMixTranscodingConfig"] = "onSetMixTranscodingConfig";
  637. /// 背景音乐开始播放
  638. ListenerType["onMusicObserverStart"] = "onMusicObserverStart";
  639. /// 背景音乐的播放进度
  640. ListenerType["onMusicObserverPlayProgress"] = "onMusicObserverPlayProgress";
  641. /// 背景音乐已播放完毕
  642. ListenerType["onMusicObserverComplete"] = "onMusicObserverComplete";
  643. /// 截图完成时回调
  644. ///
  645. /// 参数
  646. ///
  647. /// errorCode为0表示截图成功,其他值表示失败
  648. ListenerType["onSnapshotComplete"] = "onSnapshotComplete";
  649. ///当屏幕分享开始时,SDK 会通过此回调通知
  650. ListenerType["onScreenCaptureStarted"] = "onScreenCaptureStarted";
  651. ///当屏幕分享暂停时,SDK 会通过此回调通知
  652. ///
  653. ///参数
  654. ///
  655. /// reason 原因,0:用户主动暂停;1:屏幕窗口不可见暂停
  656. ///
  657. /// 注意:回调的值只针对ios生效
  658. ListenerType["onScreenCapturePaused"] = "onScreenCapturePaused";
  659. ///当屏幕分享恢复时,SDK 会通过此回调通知
  660. ///
  661. ///参数
  662. ///
  663. /// reason 恢复原因,0:用户主动恢复;1:屏幕窗口恢复可见从而恢复分享
  664. ///
  665. /// 注意:回调的值只针对ios生效
  666. ListenerType["onScreenCaptureResumed"] = "onScreenCaptureResumed";
  667. ///当屏幕分享停止时,SDK 会通过此回调通知
  668. ///
  669. ///参数
  670. ///
  671. ///reason 停止原因,0:用户主动停止;1:屏幕窗口关闭导致停止
  672. ListenerType["onScreenCaptureStoped"] = "onScreenCaptureStoped";
  673. /// 本地设备通断回调
  674. ///
  675. /// 注意:该回调仅支持windows和Mac平台
  676. ///
  677. /// 参数
  678. ///
  679. /// deviceId 设备 ID
  680. ///
  681. /// type 设备类型
  682. ///
  683. /// state 事件类型
  684. ListenerType["onDeviceChange"] = "onDeviceChange";
  685. /// 麦克风测试音量回调
  686. ///
  687. /// 麦克风测试接口 startMicDeviceTest 会触发这个回调
  688. ///
  689. /// 注意:该回调仅支持windows和Mac平台
  690. ///
  691. /// 参数:
  692. ///
  693. /// volume 音量值,取值范围0 - 100
  694. ListenerType["onTestMicVolume"] = "onTestMicVolume";
  695. /// 扬声器测试音量回调
  696. ///
  697. /// 扬声器测试接口 startSpeakerDeviceTest 会触发这个回调
  698. ///
  699. /// 注意:该回调仅支持windows和Mac平台
  700. ///
  701. /// 参数:
  702. ///
  703. /// volume 音量值,取值范围0 - 100
  704. ListenerType["onTestSpeakerVolume"] = "onTestSpeakerVolume";
  705. /// 推流操作回调
  706. ///
  707. /// 0表示成功 其他失败
  708. ListenerType["onStreamPublish"] = "onStreamPublish";
  709. })(ListenerType || (ListenerType = {}));
  710. exports["default"] = ListenerType;
  711. /***/ }),
  712. /***/ 935:
  713. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  714. "use strict";
  715. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  716. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  717. return new (P || (P = Promise))(function (resolve, reject) {
  718. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  719. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  720. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  721. step((generator = generator.apply(thisArg, _arguments || [])).next());
  722. });
  723. };
  724. var __generator = (this && this.__generator) || function (thisArg, body) {
  725. var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
  726. return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
  727. function verb(n) { return function (v) { return step([n, v]); }; }
  728. function step(op) {
  729. if (f) throw new TypeError("Generator is already executing.");
  730. while (_) try {
  731. if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
  732. if (y = 0, t) op = [op[0] & 2, t.value];
  733. switch (op[0]) {
  734. case 0: case 1: t = op; break;
  735. case 4: _.label++; return { value: op[1], done: false };
  736. case 5: _.label++; y = op[1]; op = [0]; continue;
  737. case 7: op = _.ops.pop(); _.trys.pop(); continue;
  738. default:
  739. if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
  740. if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
  741. if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
  742. if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
  743. if (t[2]) _.ops.pop();
  744. _.trys.pop(); continue;
  745. }
  746. op = body.call(thisArg, _);
  747. } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
  748. if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
  749. }
  750. };
  751. var __importDefault = (this && this.__importDefault) || function (mod) {
  752. return (mod && mod.__esModule) ? mod : { "default": mod };
  753. };
  754. Object.defineProperty(exports, "__esModule", ({ value: true }));
  755. var TXUntils_1 = __webpack_require__(802);
  756. var ListenerType_1 = __importDefault(__webpack_require__(627));
  757. var trtc_js_sdk_1 = __importDefault(__webpack_require__(24));
  758. var ShareScreenManage = /** @class */ (function () {
  759. function ShareScreenManage(_eventCallback, _roomId, _strRoomId, _sdkAppId) {
  760. this._roomId = '0';
  761. this._emitEvent = _eventCallback;
  762. this._roomId = _roomId;
  763. this._strRoomId = _strRoomId;
  764. this._sdkAppId = _sdkAppId;
  765. }
  766. ShareScreenManage.prototype.startScreenCapture = function (_args) {
  767. return __awaiter(this, void 0, void 0, function () {
  768. var shareUserId, shareUserSig, shareStream, e_1, e_2, e_3;
  769. var _this = this;
  770. return __generator(this, function (_a) {
  771. switch (_a.label) {
  772. case 0:
  773. shareUserId = (0, TXUntils_1.getFlutterArgs)(_args, 'shareUserId');
  774. shareUserSig = (0, TXUntils_1.getFlutterArgs)(_args, 'shareUserSig');
  775. this._shareClient = trtc_js_sdk_1.default.createClient({
  776. mode: 'rtc',
  777. sdkAppId: this._sdkAppId,
  778. userId: shareUserId,
  779. userSig: shareUserSig,
  780. frameWorkType: 7,
  781. useStringRoomId: this._strRoomId && this._strRoomId !== '' ? true : false,
  782. });
  783. shareStream = trtc_js_sdk_1.default.createStream({
  784. audio: false,
  785. screen: true,
  786. userId: shareUserId,
  787. });
  788. // 屏幕分享流监听屏幕分享停止事件
  789. shareStream.on('screen-sharing-stopped', function () {
  790. _this.stopScreenCapture({});
  791. });
  792. this._shareStream = shareStream;
  793. _a.label = 1;
  794. case 1:
  795. _a.trys.push([1, 3, , 4]);
  796. return [4 /*yield*/, shareStream.initialize()];
  797. case 2:
  798. _a.sent();
  799. (0, TXUntils_1.logSuccess)('shareStream initialize success');
  800. return [3 /*break*/, 4];
  801. case 3:
  802. e_1 = _a.sent();
  803. (0, TXUntils_1.logError)('shareStream.initialize error: ' + e_1.name);
  804. // 当屏幕分享流初始化失败时, 提醒用户并停止后续进房发布流程
  805. switch (e_1.name) {
  806. case 'NotReadableError':
  807. // 提醒用户确保系统允许当前浏览器获取屏幕内容
  808. return [2 /*return*/];
  809. case 'NotAllowedError':
  810. if (e_1.message === 'Permission denied by system') {
  811. // 提醒用户确保系统允许当前浏览器获取屏幕内容
  812. }
  813. else {
  814. // 用户拒绝/取消屏幕分享
  815. }
  816. return [2 /*return*/];
  817. default:
  818. // 初始化屏幕分享流时遇到了未知错误,提醒用户重试
  819. return [2 /*return*/];
  820. }
  821. return [3 /*break*/, 4];
  822. case 4:
  823. _a.trys.push([4, 6, , 7]);
  824. return [4 /*yield*/, this._shareClient.join({
  825. roomId: this._strRoomId && this._strRoomId !== ''
  826. ? this._strRoomId
  827. : parseInt(this._roomId, 10),
  828. })];
  829. case 5:
  830. _a.sent();
  831. (0, TXUntils_1.logSuccess)('ShareClient join room success');
  832. this._emitEvent(ListenerType_1.default.onScreenCaptureStarted, 0);
  833. return [3 /*break*/, 7];
  834. case 6:
  835. e_2 = _a.sent();
  836. (0, TXUntils_1.logError)(e_2);
  837. return [3 /*break*/, 7];
  838. case 7:
  839. _a.trys.push([7, 9, , 10]);
  840. return [4 /*yield*/, this._shareClient.publish(this._shareStream)];
  841. case 8:
  842. _a.sent();
  843. (0, TXUntils_1.logSuccess)('ShareClient publish success');
  844. return [3 /*break*/, 10];
  845. case 9:
  846. e_3 = _a.sent();
  847. (0, TXUntils_1.logError)('ShareClient publish failed' + e_3);
  848. return [3 /*break*/, 10];
  849. case 10: return [2 /*return*/];
  850. }
  851. });
  852. });
  853. };
  854. // 停止屏幕分享
  855. ShareScreenManage.prototype.stopScreenCapture = function (_args) {
  856. return __awaiter(this, void 0, void 0, function () {
  857. var error_1;
  858. return __generator(this, function (_a) {
  859. switch (_a.label) {
  860. case 0:
  861. if (!this._shareStream)
  862. return [2 /*return*/];
  863. _a.label = 1;
  864. case 1:
  865. _a.trys.push([1, 3, , 4]);
  866. // 屏幕分享客户端停止推流
  867. return [4 /*yield*/, this._shareClient.unpublish(this._shareStream)];
  868. case 2:
  869. // 屏幕分享客户端停止推流
  870. _a.sent();
  871. (0, TXUntils_1.logSuccess)('shareClient.unpublish success');
  872. return [3 /*break*/, 4];
  873. case 3:
  874. error_1 = _a.sent();
  875. (0, TXUntils_1.logError)('shareClient.unpublish failed' + error_1);
  876. return [3 /*break*/, 4];
  877. case 4:
  878. try {
  879. // 关闭屏幕分享流
  880. this._shareStream.close();
  881. (0, TXUntils_1.logSuccess)('shareClient.close success');
  882. }
  883. catch (error) {
  884. (0, TXUntils_1.logError)('shareClient.close failed' + error);
  885. }
  886. // 屏幕分享客户端退房
  887. return [4 /*yield*/, this._shareClient.leave()];
  888. case 5:
  889. // 屏幕分享客户端退房
  890. _a.sent();
  891. this._emitEvent(ListenerType_1.default.onScreenCaptureStoped, 0);
  892. this._shareStream = null;
  893. this._shareClient = null;
  894. return [2 /*return*/];
  895. }
  896. });
  897. });
  898. };
  899. // 暂停屏幕分享
  900. ShareScreenManage.prototype.pauseScreenCapture = function (_args) {
  901. return __awaiter(this, void 0, void 0, function () {
  902. return __generator(this, function (_a) {
  903. switch (_a.label) {
  904. case 0:
  905. if (!this._shareStream)
  906. return [2 /*return*/];
  907. // 屏幕分享客户端停止推流
  908. return [4 /*yield*/, this._shareClient.unpublish(this._shareStream)];
  909. case 1:
  910. // 屏幕分享客户端停止推流
  911. _a.sent();
  912. this._emitEvent(ListenerType_1.default.onScreenCapturePaused, 0);
  913. return [2 /*return*/];
  914. }
  915. });
  916. });
  917. };
  918. // 恢复屏幕分享
  919. ShareScreenManage.prototype.resumeScreenCapture = function (_args) {
  920. return __awaiter(this, void 0, void 0, function () {
  921. return __generator(this, function (_a) {
  922. switch (_a.label) {
  923. case 0:
  924. if (!this._shareStream)
  925. return [2 /*return*/];
  926. // 屏幕分享客户端停止推流
  927. return [4 /*yield*/, this._shareClient.publish(this._shareStream)];
  928. case 1:
  929. // 屏幕分享客户端停止推流
  930. _a.sent();
  931. this._emitEvent(ListenerType_1.default.onScreenCaptureResumed, 0);
  932. return [2 /*return*/];
  933. }
  934. });
  935. });
  936. };
  937. return ShareScreenManage;
  938. }());
  939. exports["default"] = ShareScreenManage;
  940. /***/ }),
  941. /***/ 315:
  942. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  943. "use strict";
  944. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  945. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  946. return new (P || (P = Promise))(function (resolve, reject) {
  947. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  948. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  949. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  950. step((generator = generator.apply(thisArg, _arguments || [])).next());
  951. });
  952. };
  953. var __generator = (this && this.__generator) || function (thisArg, body) {
  954. var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
  955. return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
  956. function verb(n) { return function (v) { return step([n, v]); }; }
  957. function step(op) {
  958. if (f) throw new TypeError("Generator is already executing.");
  959. while (_) try {
  960. if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
  961. if (y = 0, t) op = [op[0] & 2, t.value];
  962. switch (op[0]) {
  963. case 0: case 1: t = op; break;
  964. case 4: _.label++; return { value: op[1], done: false };
  965. case 5: _.label++; y = op[1]; op = [0]; continue;
  966. case 7: op = _.ops.pop(); _.trys.pop(); continue;
  967. default:
  968. if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
  969. if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
  970. if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
  971. if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
  972. if (t[2]) _.ops.pop();
  973. _.trys.pop(); continue;
  974. }
  975. op = body.call(thisArg, _);
  976. } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
  977. if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
  978. }
  979. };
  980. var __importDefault = (this && this.__importDefault) || function (mod) {
  981. return (mod && mod.__esModule) ? mod : { "default": mod };
  982. };
  983. Object.defineProperty(exports, "__esModule", ({ value: true }));
  984. var AudioMixMusic_1 = __importDefault(__webpack_require__(809));
  985. var TXUntils_1 = __webpack_require__(802);
  986. var DeviceManage_1 = __importDefault(__webpack_require__(996));
  987. var ListenerType_1 = __importDefault(__webpack_require__(627));
  988. var ShareScreenManage_1 = __importDefault(__webpack_require__(935));
  989. var trtc_js_sdk_1 = __importDefault(__webpack_require__(24));
  990. var TrtcWrapper = /** @class */ (function () {
  991. function TrtcWrapper() {
  992. this._joinCallList = new Map();
  993. this._remoteStream = new Map();
  994. this._remoteHtml = new Map();
  995. this._roomId = '0';
  996. this._muteInitLocalAudio = false;
  997. this._muteInitLocalVideo = false;
  998. (0, TXUntils_1.logSuccess)('TrtcWrapper new come');
  999. this._deviceManage = new DeviceManage_1.default();
  1000. this._muteInitLocalAudio = false;
  1001. this._muteInitLocalVideo = false;
  1002. this._isHadJoined = false;
  1003. this._joinCallList.clear();
  1004. }
  1005. TrtcWrapper.prototype.getSDKVersion = function () {
  1006. return trtc_js_sdk_1.default.VERSION;
  1007. };
  1008. /// 房间start
  1009. TrtcWrapper.prototype.enterRoom = function (param) {
  1010. return __awaiter(this, void 0, void 0, function () {
  1011. var userId, sdkAppId, userSig, roomId, strRoomId, role, streamId, userDefineRecordId, privateMapKey, clientOpt;
  1012. return __generator(this, function (_a) {
  1013. switch (_a.label) {
  1014. case 0:
  1015. (0, TXUntils_1.logSuccess)('begin enterRoom');
  1016. userId = (0, TXUntils_1.getFlutterArgs)(param, 'userId');
  1017. sdkAppId = (0, TXUntils_1.getFlutterArgs)(param, 'sdkAppId');
  1018. userSig = (0, TXUntils_1.getFlutterArgs)(param, 'userSig');
  1019. roomId = (0, TXUntils_1.getFlutterArgs)(param, 'roomId');
  1020. strRoomId = (0, TXUntils_1.getFlutterArgs)(param, 'strRoomId');
  1021. role = (0, TXUntils_1.getFlutterArgs)(param, 'role');
  1022. streamId = (0, TXUntils_1.getFlutterArgs)(param, 'streamId');
  1023. userDefineRecordId = (0, TXUntils_1.getFlutterArgs)(param, 'userDefineRecordId');
  1024. privateMapKey = (0, TXUntils_1.getFlutterArgs)(param, 'privateMapKey');
  1025. // const businessInfo = _getFlutterArgs(param, 'businessInfo');
  1026. // const scene = _getFlutterArgs(param, 'scene');
  1027. this._userId = userId;
  1028. this._sdkAppId = sdkAppId;
  1029. this._roomId = roomId;
  1030. this._strRoomId = strRoomId;
  1031. clientOpt = {
  1032. sdkAppId: sdkAppId,
  1033. userId: userId,
  1034. userSig: userSig,
  1035. mode: 'rtc',
  1036. autoSubscribe: true,
  1037. frameWorkType: 7,
  1038. useStringRoomId: strRoomId && strRoomId !== '' ? true : false,
  1039. };
  1040. if (streamId !== '') {
  1041. clientOpt.streamId = streamId;
  1042. }
  1043. if (userDefineRecordId !== '') {
  1044. clientOpt.userDefineRecordId = userDefineRecordId;
  1045. }
  1046. return [4 /*yield*/, this._initClient(clientOpt, strRoomId, roomId, role, privateMapKey)];
  1047. case 1:
  1048. _a.sent();
  1049. return [2 /*return*/];
  1050. }
  1051. });
  1052. });
  1053. };
  1054. TrtcWrapper.prototype.exitRoom = function () {
  1055. return __awaiter(this, void 0, void 0, function () {
  1056. var _a, _b, _c, _d;
  1057. return __generator(this, function (_e) {
  1058. switch (_e.label) {
  1059. case 0: return [4 /*yield*/, this.stopScreenCapture({})];
  1060. case 1:
  1061. _e.sent();
  1062. _a = this._localStream;
  1063. if (!_a) return [3 /*break*/, 3];
  1064. return [4 /*yield*/, this._client.unpublish(this._localStream)];
  1065. case 2:
  1066. _a = (_e.sent());
  1067. _e.label = 3;
  1068. case 3:
  1069. _a;
  1070. _b = this._localStream;
  1071. if (!_b) return [3 /*break*/, 5];
  1072. return [4 /*yield*/, this._localStream.stop()];
  1073. case 4:
  1074. _b = (_e.sent());
  1075. _e.label = 5;
  1076. case 5:
  1077. _b;
  1078. _c = this._localStream;
  1079. if (!_c) return [3 /*break*/, 7];
  1080. return [4 /*yield*/, this._localStream.close()];
  1081. case 6:
  1082. _c = (_e.sent());
  1083. _e.label = 7;
  1084. case 7:
  1085. _c;
  1086. (0, TXUntils_1.logSuccess)('localStream stop & close success');
  1087. _d = this._client;
  1088. if (!_d) return [3 /*break*/, 9];
  1089. return [4 /*yield*/, this._client.leave()];
  1090. case 8:
  1091. _d = (_e.sent());
  1092. _e.label = 9;
  1093. case 9:
  1094. _d;
  1095. window.DestoryLocalStreamCallBack();
  1096. this._client && this._client.off('*');
  1097. this._remoteStream.clear();
  1098. this._remoteHtml.forEach(function (item) {
  1099. item.remove();
  1100. });
  1101. this._remoteHtml.clear();
  1102. this._muteInitLocalAudio = false;
  1103. this._muteInitLocalVideo = false;
  1104. this._isHadJoined = false;
  1105. this._joinCallList.clear();
  1106. this._localStream = null;
  1107. this._client = null;
  1108. (0, TXUntils_1.logSuccess)('exitRoom success');
  1109. return [2 /*return*/];
  1110. }
  1111. });
  1112. });
  1113. };
  1114. // 切换角色
  1115. TrtcWrapper.prototype.switchRole = function (_args) {
  1116. return __awaiter(this, void 0, void 0, function () {
  1117. var role;
  1118. return __generator(this, function (_a) {
  1119. switch (_a.label) {
  1120. case 0:
  1121. role = (0, TXUntils_1.getFlutterArgs)(_args, 'role');
  1122. if (!(role === 21)) return [3 /*break*/, 2];
  1123. return [4 /*yield*/, this._client.switchRole('anchor')];
  1124. case 1:
  1125. _a.sent();
  1126. return [3 /*break*/, 5];
  1127. case 2:
  1128. if (!(role === 20)) return [3 /*break*/, 4];
  1129. return [4 /*yield*/, this._client.switchRole('audience')];
  1130. case 3:
  1131. _a.sent();
  1132. return [3 /*break*/, 5];
  1133. case 4:
  1134. (0, TXUntils_1.logError)("switchRole role ".concat(role, " not supper "));
  1135. _a.label = 5;
  1136. case 5: return [2 /*return*/];
  1137. }
  1138. });
  1139. });
  1140. };
  1141. TrtcWrapper.prototype.switchRoom = function (_args) {
  1142. return __awaiter(this, void 0, void 0, function () {
  1143. return __generator(this, function (_a) {
  1144. (0, TXUntils_1.noSupportFunction)('switchRoom');
  1145. return [2 /*return*/];
  1146. });
  1147. });
  1148. };
  1149. // 请求跨房通话
  1150. TrtcWrapper.prototype.connectOtherRoom = function (_args) {
  1151. return __awaiter(this, void 0, void 0, function () {
  1152. return __generator(this, function (_a) {
  1153. (0, TXUntils_1.noSupportFunction)('connectOtherRoom');
  1154. return [2 /*return*/];
  1155. });
  1156. });
  1157. };
  1158. // 退出跨房通话
  1159. TrtcWrapper.prototype.disconnectOtherRoom = function (_args) {
  1160. return __awaiter(this, void 0, void 0, function () {
  1161. return __generator(this, function (_a) {
  1162. (0, TXUntils_1.noSupportFunction)('disconnectOtherRoom');
  1163. return [2 /*return*/];
  1164. });
  1165. });
  1166. };
  1167. // 设置订阅模式(需要在进入房前设置才能生效)
  1168. TrtcWrapper.prototype.setDefaultStreamRecvMode = function (_args) {
  1169. return __awaiter(this, void 0, void 0, function () {
  1170. return __generator(this, function (_a) {
  1171. (0, TXUntils_1.noSupportFunction)('setDefaultStreamRecvMode');
  1172. return [2 /*return*/];
  1173. });
  1174. });
  1175. };
  1176. // 创建子房间示例(用于多房间并发观看)
  1177. TrtcWrapper.prototype.createSubCloud = function (_args) {
  1178. return __awaiter(this, void 0, void 0, function () {
  1179. return __generator(this, function (_a) {
  1180. (0, TXUntils_1.noSupportFunction)('createSubCloud');
  1181. return [2 /*return*/];
  1182. });
  1183. });
  1184. };
  1185. TrtcWrapper.prototype.destroySubCloud = function (_args) {
  1186. return __awaiter(this, void 0, void 0, function () {
  1187. return __generator(this, function (_a) {
  1188. (0, TXUntils_1.noSupportFunction)('destroySubCloud');
  1189. return [2 /*return*/];
  1190. });
  1191. });
  1192. };
  1193. /// 房间 end
  1194. /// 本地start
  1195. // 开启本地音频的采集和发布
  1196. TrtcWrapper.prototype.startLocalAudio = function () {
  1197. return __awaiter(this, void 0, void 0, function () {
  1198. var audioStream, audioTrack, _a;
  1199. return __generator(this, function (_b) {
  1200. switch (_b.label) {
  1201. case 0:
  1202. this._muteInitLocalAudio = true;
  1203. return [4 /*yield*/, this._createNPublishLocalStream()];
  1204. case 1:
  1205. _b.sent();
  1206. if (!!this._localStream.hasAudio()) return [3 /*break*/, 5];
  1207. audioStream = trtc_js_sdk_1.default.createStream({ audio: true, video: false });
  1208. return [4 /*yield*/, audioStream.initialize()];
  1209. case 2:
  1210. _b.sent();
  1211. audioTrack = audioStream.getAudioTrack();
  1212. _a = this._localStream;
  1213. if (!_a) return [3 /*break*/, 4];
  1214. return [4 /*yield*/, this._localStream.addTrack(audioTrack)];
  1215. case 3:
  1216. _a = (_b.sent());
  1217. _b.label = 4;
  1218. case 4:
  1219. _a;
  1220. _b.label = 5;
  1221. case 5:
  1222. this._localStream && this._localStream.unmuteAudio();
  1223. return [2 /*return*/];
  1224. }
  1225. });
  1226. });
  1227. };
  1228. // 停止本地音频的采集和发布
  1229. TrtcWrapper.prototype.stopLocalAudio = function (_args) {
  1230. return __awaiter(this, void 0, void 0, function () {
  1231. return __generator(this, function (_a) {
  1232. this._localStream && this._localStream.muteAudio();
  1233. return [2 /*return*/];
  1234. });
  1235. });
  1236. };
  1237. // 暂停/恢复发布本地的音频流
  1238. TrtcWrapper.prototype.muteLocalAudio = function (_args) {
  1239. return __awaiter(this, void 0, void 0, function () {
  1240. var mute;
  1241. return __generator(this, function (_a) {
  1242. switch (_a.label) {
  1243. case 0:
  1244. if (!this._localStream)
  1245. return [2 /*return*/];
  1246. mute = (0, TXUntils_1.getFlutterArgs)(_args, 'mute');
  1247. if (!mute) return [3 /*break*/, 2];
  1248. return [4 /*yield*/, this._localStream.muteAudio()];
  1249. case 1:
  1250. _a.sent();
  1251. return [3 /*break*/, 4];
  1252. case 2: return [4 /*yield*/, this._localStream.unmuteAudio()];
  1253. case 3:
  1254. _a.sent();
  1255. _a.label = 4;
  1256. case 4: return [2 /*return*/];
  1257. }
  1258. });
  1259. });
  1260. };
  1261. // 暂停/恢复发布本地的视频流
  1262. TrtcWrapper.prototype.muteLocalVideo = function (_args) {
  1263. return __awaiter(this, void 0, void 0, function () {
  1264. var mute;
  1265. return __generator(this, function (_a) {
  1266. switch (_a.label) {
  1267. case 0:
  1268. if (!this._localStream)
  1269. return [2 /*return*/];
  1270. mute = (0, TXUntils_1.getFlutterArgs)(_args, 'mute');
  1271. if (!mute) return [3 /*break*/, 2];
  1272. return [4 /*yield*/, this._localStream.muteVideo()];
  1273. case 1:
  1274. _a.sent();
  1275. return [3 /*break*/, 4];
  1276. case 2: return [4 /*yield*/, this._localStream.unmuteVideo()];
  1277. case 3:
  1278. _a.sent();
  1279. _a.label = 4;
  1280. case 4: return [2 /*return*/];
  1281. }
  1282. });
  1283. });
  1284. };
  1285. // 停止摄像头预览
  1286. TrtcWrapper.prototype.stopLocalPreview = function (_args) {
  1287. return __awaiter(this, void 0, void 0, function () {
  1288. return __generator(this, function (_a) {
  1289. switch (_a.label) {
  1290. case 0:
  1291. if (!this._localStream)
  1292. return [2 /*return*/];
  1293. // 本地的只会关闭视频,音频不会一起关闭。而远端的流stop就会音视频流都关闭
  1294. return [4 /*yield*/, this._localStream.stop()];
  1295. case 1:
  1296. // 本地的只会关闭视频,音频不会一起关闭。而远端的流stop就会音视频流都关闭
  1297. _a.sent();
  1298. return [4 /*yield*/, this._localStream.muteVideo()];
  1299. case 2:
  1300. _a.sent();
  1301. return [2 /*return*/];
  1302. }
  1303. });
  1304. });
  1305. };
  1306. // 开启本地摄像头的预览画面
  1307. TrtcWrapper.prototype.startLocalPreview = function (_element, viewId, _args) {
  1308. return __awaiter(this, void 0, void 0, function () {
  1309. var videoStream, videoTrack;
  1310. return __generator(this, function (_a) {
  1311. switch (_a.label) {
  1312. case 0:
  1313. this._muteInitLocalVideo = true;
  1314. return [4 /*yield*/, this._createNPublishLocalStream()];
  1315. case 1:
  1316. _a.sent();
  1317. if (!!this._localStream.hasVideo()) return [3 /*break*/, 4];
  1318. videoStream = trtc_js_sdk_1.default.createStream({ audio: false, video: true });
  1319. if (this._videoProfile) {
  1320. videoStream.setVideoProfile(this._videoProfile);
  1321. }
  1322. return [4 /*yield*/, videoStream.initialize()];
  1323. case 2:
  1324. _a.sent();
  1325. videoTrack = videoStream.getVideoTrack();
  1326. return [4 /*yield*/, this._localStream.addTrack(videoTrack)];
  1327. case 3:
  1328. _a.sent();
  1329. _a.label = 4;
  1330. case 4: return [4 /*yield*/, this._localStream.unmuteVideo()];
  1331. case 5:
  1332. _a.sent();
  1333. return [4 /*yield*/, this._localStream.play(viewId, {
  1334. objectFit: 'cover',
  1335. muted: true,
  1336. })];
  1337. case 6:
  1338. _a.sent();
  1339. this._localPreviewId = viewId;
  1340. return [4 /*yield*/, this._localStream.resume()];
  1341. case 7:
  1342. _a.sent();
  1343. return [2 /*return*/];
  1344. }
  1345. });
  1346. });
  1347. };
  1348. // 设定本地音频的采集音量
  1349. TrtcWrapper.prototype.setAudioCaptureVolume = function (_args) {
  1350. return __awaiter(this, void 0, void 0, function () {
  1351. return __generator(this, function (_a) {
  1352. (0, TXUntils_1.noSupportFunction)('setAudioCaptureVolume');
  1353. return [2 /*return*/];
  1354. });
  1355. });
  1356. };
  1357. // 获取本地音频的采集音量
  1358. TrtcWrapper.prototype.getAudioCaptureVolume = function (_args) {
  1359. var level = this._localStream.getAudioLevel();
  1360. return level * 100;
  1361. };
  1362. // 设定SDK音频的播放音量
  1363. TrtcWrapper.prototype.setAudioPlayoutVolume = function (_args) {
  1364. return __awaiter(this, void 0, void 0, function () {
  1365. var volume;
  1366. return __generator(this, function (_a) {
  1367. volume = (0, TXUntils_1.getFlutterArgs)(_args, 'volume');
  1368. if (this._localStream) {
  1369. this._localStream.setAudioVolume(volume / 100);
  1370. }
  1371. return [2 /*return*/];
  1372. });
  1373. });
  1374. };
  1375. // 获取SDK音频的播放音量
  1376. TrtcWrapper.prototype.getAudioPlayoutVolume = function (_args) {
  1377. if (this._localStream) {
  1378. return this._localStream.getAudioLevel() * 100;
  1379. }
  1380. return 0;
  1381. };
  1382. // 设置音频路由
  1383. TrtcWrapper.prototype.setAudioRoute = function (_args) {
  1384. return __awaiter(this, void 0, void 0, function () {
  1385. return __generator(this, function (_a) {
  1386. (0, TXUntils_1.noSupportFunction)('setAudioRoute');
  1387. return [2 /*return*/];
  1388. });
  1389. });
  1390. };
  1391. TrtcWrapper.prototype.switchCamera = function (_args) {
  1392. return __awaiter(this, void 0, void 0, function () {
  1393. return __generator(this, function (_a) {
  1394. (0, TXUntils_1.noSupportFunction)('switchCamera');
  1395. return [2 /*return*/];
  1396. });
  1397. });
  1398. };
  1399. // 设置本地画面的渲染参数
  1400. TrtcWrapper.prototype.setLocalRenderParams = function (_args) {
  1401. return __awaiter(this, void 0, void 0, function () {
  1402. return __generator(this, function (_a) {
  1403. (0, TXUntils_1.noSupportFunction)('setLocalRenderParams');
  1404. return [2 /*return*/];
  1405. });
  1406. });
  1407. };
  1408. //设置视频编码器的编码参数
  1409. TrtcWrapper.prototype.setVideoEncoderParam = function (_args) {
  1410. return __awaiter(this, void 0, void 0, function () {
  1411. var config, videoResolution, usePortrait, height, width;
  1412. return __generator(this, function (_a) {
  1413. config = JSON.parse(_args);
  1414. videoResolution = (0, TXUntils_1.getVideoResolution)(config.videoResolution).split('*');
  1415. usePortrait = config.videoResolutionMode == 1;
  1416. height = usePortrait ? videoResolution[0] : videoResolution[1];
  1417. width = usePortrait ? videoResolution[1] : videoResolution[0];
  1418. this._videoProfile = {
  1419. width: parseFloat(width),
  1420. height: parseFloat(height),
  1421. frameRate: config.videoFps,
  1422. bitrate: config.videoBitrate, // 比特率 kbps
  1423. };
  1424. if (this._localStream) {
  1425. this._localStream.setVideoProfile(this._videoProfile);
  1426. }
  1427. return [2 /*return*/];
  1428. });
  1429. });
  1430. };
  1431. // 开启大小画面双路编码模式. 请在enterroom之后,开启摄像头之前调用
  1432. TrtcWrapper.prototype.enableEncSmallVideoStream = function (_args) {
  1433. if (!this._client)
  1434. return -1;
  1435. var enable = (0, TXUntils_1.getFlutterArgs)(_args, 'enable');
  1436. enable
  1437. ? this._client.enableSmallStream()
  1438. : this._client.disableSmallStream();
  1439. return 0;
  1440. };
  1441. // 切换指定远端用户的大小画面
  1442. TrtcWrapper.prototype.setRemoteVideoStreamType = function (_args) {
  1443. // {userId: 345, streamType: 1}
  1444. var userId = (0, TXUntils_1.getFlutterArgs)(_args, 'userId');
  1445. var streamType = (0, TXUntils_1.getFlutterArgs)(_args, 'streamType');
  1446. if (this._remoteStream && this._remoteStream.has(userId)) {
  1447. var userRemoteStream = this._remoteStream.get(userId);
  1448. this._client &&
  1449. this._client.setRemoteVideoStreamType(userRemoteStream, streamType === 1 ? 'small' : 'big');
  1450. }
  1451. return 0;
  1452. };
  1453. // 启用音量大小提示
  1454. TrtcWrapper.prototype.enableAudioVolumeEvaluation = function (_args) {
  1455. var intervalMs = (0, TXUntils_1.getFlutterArgs)(_args, 'intervalMs');
  1456. this._client && this._client.enableAudioVolumeEvaluation(intervalMs);
  1457. return 0;
  1458. };
  1459. /// 本地end
  1460. /// 远端 start
  1461. // 订阅远端用户的视频流,并绑定视频渲染控件
  1462. TrtcWrapper.prototype.startRemoteView = function (_element, _viewId, _args) {
  1463. return __awaiter(this, void 0, void 0, function () {
  1464. var userId, userRemoteStream, oDiv, pDom;
  1465. return __generator(this, function (_a) {
  1466. switch (_a.label) {
  1467. case 0:
  1468. userId = (0, TXUntils_1.getFlutterArgs)(_args, 'userId');
  1469. if (!(this._remoteStream && this._remoteStream.has(userId))) return [3 /*break*/, 4];
  1470. userRemoteStream = this._remoteStream.get(userId);
  1471. return [4 /*yield*/, userRemoteStream.unmuteVideo()];
  1472. case 1:
  1473. _a.sent();
  1474. oDiv = this._remoteHtml.get(userId);
  1475. if (!oDiv) return [3 /*break*/, 3];
  1476. try {
  1477. (0, TXUntils_1.logInfo)("startRemoteView ".concat(_viewId, " removeChild ").concat(userId, " view"));
  1478. document.body &&
  1479. document.body.removeChild &&
  1480. document.body.removeChild(oDiv);
  1481. }
  1482. catch (ex) {
  1483. (0, TXUntils_1.logInfo)("startRemoteView removeChild failed, It does not affect the use of ".concat(ex));
  1484. }
  1485. pDom = document.getElementById(_viewId);
  1486. if (pDom)
  1487. pDom.appendChild(oDiv);
  1488. else {
  1489. _element.appendChild(oDiv);
  1490. console.error(_element);
  1491. (0, TXUntils_1.logError)("startRemoteView ".concat(_viewId, " not find "));
  1492. }
  1493. oDiv.style.visibility = 'visible';
  1494. (0, TXUntils_1.logInfo)("startRemoteView ".concat(_viewId, " appendChild ").concat(userId, " view"));
  1495. return [4 /*yield*/, userRemoteStream.resume()];
  1496. case 2:
  1497. _a.sent();
  1498. return [3 /*break*/, 4];
  1499. case 3:
  1500. (0, TXUntils_1.logError)("startRemoteView ".concat(_viewId, " oDiv not find ").concat(userId, " view"));
  1501. _a.label = 4;
  1502. case 4: return [2 /*return*/];
  1503. }
  1504. });
  1505. });
  1506. };
  1507. // 停止订阅远端用户的视频流,并释放渲染控件
  1508. TrtcWrapper.prototype.stopRemoteView = function (_args) {
  1509. return __awaiter(this, void 0, void 0, function () {
  1510. var userId, userRemoteStream, oDiv;
  1511. return __generator(this, function (_a) {
  1512. switch (_a.label) {
  1513. case 0:
  1514. userId = (0, TXUntils_1.getFlutterArgs)(_args, 'userId');
  1515. if (!(this._remoteStream && this._remoteStream.has(userId))) return [3 /*break*/, 2];
  1516. userRemoteStream = this._remoteStream.get(userId);
  1517. return [4 /*yield*/, userRemoteStream.muteVideo()];
  1518. case 1:
  1519. _a.sent();
  1520. oDiv = this._remoteHtml.get(userId);
  1521. if (oDiv)
  1522. oDiv.style.visibility = 'hidden';
  1523. _a.label = 2;
  1524. case 2: return [2 /*return*/];
  1525. }
  1526. });
  1527. });
  1528. };
  1529. // 停止订阅所有远端用户的视频流,并释放全部渲染资源
  1530. TrtcWrapper.prototype.stopAllRemoteView = function (_args) {
  1531. return __awaiter(this, void 0, void 0, function () {
  1532. var _this = this;
  1533. return __generator(this, function (_a) {
  1534. if (this._remoteStream) {
  1535. this._remoteStream.forEach(function (item, key) { return __awaiter(_this, void 0, void 0, function () {
  1536. var userRemoteStream, oDiv;
  1537. return __generator(this, function (_a) {
  1538. switch (_a.label) {
  1539. case 0:
  1540. userRemoteStream = item;
  1541. return [4 /*yield*/, userRemoteStream.muteVideo()];
  1542. case 1:
  1543. _a.sent();
  1544. oDiv = this._remoteHtml.get(key);
  1545. if (oDiv)
  1546. oDiv.style.visibility = 'hidden';
  1547. return [2 /*return*/];
  1548. }
  1549. });
  1550. }); });
  1551. }
  1552. return [2 /*return*/];
  1553. });
  1554. });
  1555. };
  1556. // 暂停/恢复订阅远端用户的视频流
  1557. TrtcWrapper.prototype.muteRemoteVideoStream = function (_args) {
  1558. return __awaiter(this, void 0, void 0, function () {
  1559. var mute, userId, userRemoteStream, _a;
  1560. return __generator(this, function (_b) {
  1561. switch (_b.label) {
  1562. case 0:
  1563. mute = (0, TXUntils_1.getFlutterArgs)(_args, 'mute');
  1564. userId = (0, TXUntils_1.getFlutterArgs)(_args, 'userId');
  1565. if (!(this._remoteStream && this._remoteStream.has(userId))) return [3 /*break*/, 5];
  1566. userRemoteStream = this._remoteStream.get(userId);
  1567. if (!mute) return [3 /*break*/, 2];
  1568. return [4 /*yield*/, userRemoteStream.muteVideo()];
  1569. case 1:
  1570. _a = _b.sent();
  1571. return [3 /*break*/, 4];
  1572. case 2: return [4 /*yield*/, userRemoteStream.unmuteVideo()];
  1573. case 3:
  1574. _a = _b.sent();
  1575. _b.label = 4;
  1576. case 4:
  1577. _a;
  1578. if (!mute)
  1579. userRemoteStream.resume();
  1580. _b.label = 5;
  1581. case 5: return [2 /*return*/];
  1582. }
  1583. });
  1584. });
  1585. };
  1586. // 暂停/恢复订阅所有远端用户的视频流
  1587. TrtcWrapper.prototype.muteAllRemoteVideoStreams = function (_args) {
  1588. return __awaiter(this, void 0, void 0, function () {
  1589. var mute;
  1590. var _this = this;
  1591. return __generator(this, function (_a) {
  1592. mute = (0, TXUntils_1.getFlutterArgs)(_args, 'mute');
  1593. if (this._remoteStream) {
  1594. this._remoteStream.forEach(function (item) { return __awaiter(_this, void 0, void 0, function () {
  1595. var userRemoteStream, _a;
  1596. return __generator(this, function (_b) {
  1597. switch (_b.label) {
  1598. case 0:
  1599. userRemoteStream = item;
  1600. if (!mute) return [3 /*break*/, 2];
  1601. return [4 /*yield*/, userRemoteStream.muteVideo()];
  1602. case 1:
  1603. _a = _b.sent();
  1604. return [3 /*break*/, 4];
  1605. case 2: return [4 /*yield*/, userRemoteStream.unmuteVideo()];
  1606. case 3:
  1607. _a = _b.sent();
  1608. _b.label = 4;
  1609. case 4:
  1610. _a;
  1611. if (!mute)
  1612. userRemoteStream.resume();
  1613. return [2 /*return*/];
  1614. }
  1615. });
  1616. }); });
  1617. }
  1618. return [2 /*return*/];
  1619. });
  1620. });
  1621. };
  1622. // 暂停/恢复播放远端的音频流
  1623. TrtcWrapper.prototype.muteRemoteAudio = function (_args) {
  1624. return __awaiter(this, void 0, void 0, function () {
  1625. var userId, mute, userRemoteStream, _a;
  1626. return __generator(this, function (_b) {
  1627. switch (_b.label) {
  1628. case 0:
  1629. userId = (0, TXUntils_1.getFlutterArgs)(_args, 'userId');
  1630. mute = (0, TXUntils_1.getFlutterArgs)(_args, 'mute');
  1631. if (!(this._remoteStream && this._remoteStream.has(userId))) return [3 /*break*/, 5];
  1632. userRemoteStream = this._remoteStream.get(userId);
  1633. if (!mute) return [3 /*break*/, 2];
  1634. return [4 /*yield*/, userRemoteStream.muteAudio()];
  1635. case 1:
  1636. _a = _b.sent();
  1637. return [3 /*break*/, 4];
  1638. case 2: return [4 /*yield*/, userRemoteStream.unmuteAudio()];
  1639. case 3:
  1640. _a = _b.sent();
  1641. _b.label = 4;
  1642. case 4:
  1643. _a;
  1644. if (!mute)
  1645. userRemoteStream.resume();
  1646. _b.label = 5;
  1647. case 5: return [2 /*return*/];
  1648. }
  1649. });
  1650. });
  1651. };
  1652. // 暂停/恢复播放所有远端用户的音频流
  1653. TrtcWrapper.prototype.muteAllRemoteAudio = function (_args) {
  1654. return __awaiter(this, void 0, void 0, function () {
  1655. var mute;
  1656. var _this = this;
  1657. return __generator(this, function (_a) {
  1658. mute = (0, TXUntils_1.getFlutterArgs)(_args, 'mute');
  1659. if (this._remoteStream) {
  1660. this._remoteStream.forEach(function (item) { return __awaiter(_this, void 0, void 0, function () {
  1661. var userRemoteStream, _a;
  1662. return __generator(this, function (_b) {
  1663. switch (_b.label) {
  1664. case 0:
  1665. userRemoteStream = item;
  1666. if (!mute) return [3 /*break*/, 2];
  1667. return [4 /*yield*/, userRemoteStream.muteAudio()];
  1668. case 1:
  1669. _a = _b.sent();
  1670. return [3 /*break*/, 4];
  1671. case 2: return [4 /*yield*/, userRemoteStream.unmuteAudio()];
  1672. case 3:
  1673. _a = _b.sent();
  1674. _b.label = 4;
  1675. case 4:
  1676. _a;
  1677. if (!mute)
  1678. userRemoteStream.resume();
  1679. return [2 /*return*/];
  1680. }
  1681. });
  1682. }); });
  1683. }
  1684. return [2 /*return*/];
  1685. });
  1686. });
  1687. };
  1688. // 设定某一个远端用户的声音播放音量
  1689. TrtcWrapper.prototype.setRemoteAudioVolume = function (_args) {
  1690. return __awaiter(this, void 0, void 0, function () {
  1691. var userId, volume, userRemoteStream;
  1692. return __generator(this, function (_a) {
  1693. userId = (0, TXUntils_1.getFlutterArgs)(_args, 'userId');
  1694. volume = (0, TXUntils_1.getFlutterArgs)(_args, 'volume');
  1695. if (this._remoteStream && this._remoteStream.has(userId)) {
  1696. userRemoteStream = this._remoteStream.get(userId);
  1697. userRemoteStream.setAudioVolume(volume / 100);
  1698. }
  1699. return [2 /*return*/];
  1700. });
  1701. });
  1702. };
  1703. /// 远端end
  1704. /// 录音相关start
  1705. TrtcWrapper.prototype.startAudioRecording = function (_args) {
  1706. return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {
  1707. return [2 /*return*/];
  1708. }); });
  1709. };
  1710. TrtcWrapper.prototype.stopAudioRecording = function (_args) {
  1711. return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {
  1712. return [2 /*return*/];
  1713. }); });
  1714. };
  1715. TrtcWrapper.prototype.startLocalRecording = function (_args) {
  1716. return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {
  1717. return [2 /*return*/];
  1718. }); });
  1719. };
  1720. TrtcWrapper.prototype.stopLocalRecording = function (_args) {
  1721. return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {
  1722. return [2 /*return*/];
  1723. }); });
  1724. };
  1725. /// 录音相关end
  1726. // 暂时不实现
  1727. TrtcWrapper.prototype.updateLocalView = function (_element, _viewId, _args) {
  1728. return __awaiter(this, void 0, void 0, function () {
  1729. return __generator(this, function (_a) {
  1730. (0, TXUntils_1.noSupportFunction)('updateLocalView');
  1731. return [2 /*return*/];
  1732. });
  1733. });
  1734. };
  1735. TrtcWrapper.prototype.updateRemoteView = function (_element, _viewId, _args) {
  1736. return __awaiter(this, void 0, void 0, function () {
  1737. return __generator(this, function (_a) {
  1738. (0, TXUntils_1.noSupportFunction)('updateLocalView');
  1739. return [2 /*return*/];
  1740. });
  1741. });
  1742. };
  1743. /// 日志start
  1744. // 设置 Log 输出级别
  1745. TrtcWrapper.prototype.setLogLevel = function (_args) {
  1746. return __awaiter(this, void 0, void 0, function () {
  1747. var level;
  1748. return __generator(this, function (_a) {
  1749. level = (0, TXUntils_1.getFlutterArgs)(_args, 'level');
  1750. trtc_js_sdk_1.default.Logger.setLogLevel(level);
  1751. return [2 /*return*/];
  1752. });
  1753. });
  1754. };
  1755. // 启用/禁用控制台日志打印
  1756. TrtcWrapper.prototype.setConsoleEnabled = function (_args) {
  1757. return __awaiter(this, void 0, void 0, function () {
  1758. var enabled;
  1759. return __generator(this, function (_a) {
  1760. enabled = (0, TXUntils_1.getFlutterArgs)(_args, 'enabled');
  1761. enabled ? trtc_js_sdk_1.default.Logger.enableUploadLog() : trtc_js_sdk_1.default.Logger.disableUploadLog();
  1762. return [2 /*return*/];
  1763. });
  1764. });
  1765. };
  1766. // 启用/禁用日志的本地压缩
  1767. TrtcWrapper.prototype.setLogCompressEnabled = function (_args) {
  1768. return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {
  1769. return [2 /*return*/];
  1770. }); });
  1771. };
  1772. // 设置本地日志的保存路径
  1773. TrtcWrapper.prototype.setLogDirPath = function (_args) {
  1774. return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {
  1775. return [2 /*return*/];
  1776. }); });
  1777. };
  1778. // 设置日志回调
  1779. TrtcWrapper.prototype.setLogDelegate = function (_args) {
  1780. return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {
  1781. return [2 /*return*/];
  1782. }); });
  1783. };
  1784. // 显示仪表盘
  1785. TrtcWrapper.prototype.showDebugView = function (_args) {
  1786. return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {
  1787. return [2 /*return*/];
  1788. }); });
  1789. };
  1790. // 设置仪表盘的边距
  1791. TrtcWrapper.prototype.setDebugViewMargin = function (_args) {
  1792. return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {
  1793. return [2 /*return*/];
  1794. }); });
  1795. };
  1796. // 调用实验性接口
  1797. TrtcWrapper.prototype.callExperimentalAPI = function (_args) {
  1798. return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {
  1799. return [2 /*return*/];
  1800. }); });
  1801. };
  1802. /// 日志end
  1803. /// CDN 相关接口函数 start
  1804. // 开始向腾讯云直播 CDN 上发布音视频流
  1805. TrtcWrapper.prototype.startPublishing = function (_args) {
  1806. return __awaiter(this, void 0, void 0, function () {
  1807. var error_1;
  1808. return __generator(this, function (_a) {
  1809. switch (_a.label) {
  1810. case 0:
  1811. if (!this._client)
  1812. return [2 /*return*/];
  1813. _a.label = 1;
  1814. case 1:
  1815. _a.trys.push([1, 3, , 4]);
  1816. return [4 /*yield*/, this._client.startPublishCDNStream({
  1817. streamId: (0, TXUntils_1.getFlutterArgs)(_args, 'streamId'),
  1818. })];
  1819. case 2:
  1820. _a.sent();
  1821. (0, TXUntils_1.logSuccess)('startPublishing Success');
  1822. return [3 /*break*/, 4];
  1823. case 3:
  1824. error_1 = _a.sent();
  1825. (0, TXUntils_1.logError)(error_1);
  1826. return [3 /*break*/, 4];
  1827. case 4: return [2 /*return*/];
  1828. }
  1829. });
  1830. });
  1831. };
  1832. // 停止向腾讯云直播 CDN 上发布音视频流
  1833. TrtcWrapper.prototype.stopPublishing = function (_args) {
  1834. return __awaiter(this, void 0, void 0, function () {
  1835. return __generator(this, function (_a) {
  1836. switch (_a.label) {
  1837. case 0:
  1838. if (!this._client)
  1839. return [2 /*return*/];
  1840. return [4 /*yield*/, this._client.stopPublishCDNStream()];
  1841. case 1:
  1842. _a.sent();
  1843. return [2 /*return*/];
  1844. }
  1845. });
  1846. });
  1847. };
  1848. // 开始向非腾讯云 CDN 上发布音视频流
  1849. TrtcWrapper.prototype.startPublishCDNStream = function (_args) {
  1850. return __awaiter(this, void 0, void 0, function () {
  1851. var error_2;
  1852. return __generator(this, function (_a) {
  1853. switch (_a.label) {
  1854. case 0:
  1855. if (!this._client)
  1856. return [2 /*return*/];
  1857. _a.label = 1;
  1858. case 1:
  1859. _a.trys.push([1, 3, , 4]);
  1860. return [4 /*yield*/, this._client.startPublishCDNStream({
  1861. appId: (0, TXUntils_1.getFlutterArgs)(_args, 'appId'),
  1862. bizId: (0, TXUntils_1.getFlutterArgs)(_args, 'bizId'),
  1863. url: (0, TXUntils_1.getFlutterArgs)(_args, 'url'),
  1864. })];
  1865. case 2:
  1866. _a.sent();
  1867. (0, TXUntils_1.logSuccess)('startPublishCDNStream Success');
  1868. return [3 /*break*/, 4];
  1869. case 3:
  1870. error_2 = _a.sent();
  1871. (0, TXUntils_1.logError)(error_2);
  1872. return [3 /*break*/, 4];
  1873. case 4: return [2 /*return*/];
  1874. }
  1875. });
  1876. });
  1877. };
  1878. // 停止向非腾讯云 CDN 上发布音视频流
  1879. TrtcWrapper.prototype.stopPublishCDNStream = function (_args) {
  1880. return __awaiter(this, void 0, void 0, function () {
  1881. return __generator(this, function (_a) {
  1882. switch (_a.label) {
  1883. case 0:
  1884. if (!this._client)
  1885. return [2 /*return*/];
  1886. return [4 /*yield*/, this._client.stopPublishCDNStream()];
  1887. case 1:
  1888. _a.sent();
  1889. return [2 /*return*/];
  1890. }
  1891. });
  1892. });
  1893. };
  1894. // 设置云端混流的排版布局和转码参数
  1895. TrtcWrapper.prototype.setMixTranscodingConfig = function (_args) {
  1896. return __awaiter(this, void 0, void 0, function () {
  1897. var error_3;
  1898. return __generator(this, function (_a) {
  1899. switch (_a.label) {
  1900. case 0:
  1901. if (!this._client)
  1902. return [2 /*return*/];
  1903. _a.label = 1;
  1904. case 1:
  1905. _a.trys.push([1, 3, , 4]);
  1906. return [4 /*yield*/, this._client.startMixTranscode(JSON.parse(_args
  1907. .replace('"backgroundImage":null', '"backgroundImage":""')
  1908. .replace('"streamId":null', '"streamId":""')))];
  1909. case 2:
  1910. _a.sent();
  1911. (0, TXUntils_1.logSuccess)('startMixTranscode Success');
  1912. return [3 /*break*/, 4];
  1913. case 3:
  1914. error_3 = _a.sent();
  1915. (0, TXUntils_1.logError)(error_3);
  1916. return [3 /*break*/, 4];
  1917. case 4: return [2 /*return*/];
  1918. }
  1919. });
  1920. });
  1921. };
  1922. /// CDN 相关接口函数 end
  1923. /// 屏幕分享相关接口start
  1924. // 开始桌面端屏幕分享
  1925. TrtcWrapper.prototype.startScreenCapture = function (_args) {
  1926. return __awaiter(this, void 0, void 0, function () {
  1927. return __generator(this, function (_a) {
  1928. this._shareScreenManage = new ShareScreenManage_1.default(this._emitEvent, this._roomId, this._strRoomId, this._sdkAppId);
  1929. this._shareScreenManage.startScreenCapture(_args);
  1930. return [2 /*return*/];
  1931. });
  1932. });
  1933. };
  1934. // 停止屏幕分享
  1935. TrtcWrapper.prototype.stopScreenCapture = function (_args) {
  1936. return __awaiter(this, void 0, void 0, function () {
  1937. return __generator(this, function (_a) {
  1938. this._shareScreenManage && this._shareScreenManage.stopScreenCapture(_args);
  1939. return [2 /*return*/];
  1940. });
  1941. });
  1942. };
  1943. // 暂停屏幕分享
  1944. TrtcWrapper.prototype.pauseScreenCapture = function (_args) {
  1945. return __awaiter(this, void 0, void 0, function () {
  1946. return __generator(this, function (_a) {
  1947. this._shareScreenManage &&
  1948. this._shareScreenManage.pauseScreenCapture(_args);
  1949. return [2 /*return*/];
  1950. });
  1951. });
  1952. };
  1953. // 恢复屏幕分享
  1954. TrtcWrapper.prototype.resumeScreenCapture = function (_args) {
  1955. return __awaiter(this, void 0, void 0, function () {
  1956. return __generator(this, function (_a) {
  1957. this._shareScreenManage &&
  1958. this._shareScreenManage.resumeScreenCapture(_args);
  1959. return [2 /*return*/];
  1960. });
  1961. });
  1962. };
  1963. /// 屏幕分享相关接口end
  1964. // setNetworkQosParam 设置网络质量控制的相关参数
  1965. // setLocalRenderParams 设置本地画面的渲染参数
  1966. // setRemoteRenderParams 设置远端画面的渲染模式
  1967. // setVideoEncoderRotation 设置视频编码器输出的画面方向
  1968. // setVideoEncoderMirror 设置编码器输出的画面镜像模式
  1969. // setGSensorMode 设置重力感应的适配模式
  1970. // snapshotVideo 视频画面截图
  1971. /// 设备管理start
  1972. TrtcWrapper.prototype.getDevicesList = function (_args) {
  1973. return __awaiter(this, void 0, void 0, function () {
  1974. return __generator(this, function (_a) {
  1975. return [2 /*return*/, this._deviceManage.getDevicesList(_args)];
  1976. });
  1977. });
  1978. };
  1979. TrtcWrapper.prototype.setCurrentDevice = function (_args) {
  1980. return __awaiter(this, void 0, void 0, function () {
  1981. return __generator(this, function (_a) {
  1982. return [2 /*return*/, this._deviceManage.setCurrentDevice(this._localStream, _args)];
  1983. });
  1984. });
  1985. };
  1986. TrtcWrapper.prototype.getCurrentDevice = function (_args) {
  1987. return __awaiter(this, void 0, void 0, function () {
  1988. return __generator(this, function (_a) {
  1989. return [2 /*return*/, this._deviceManage.getCurrentDevice(_args)];
  1990. });
  1991. });
  1992. };
  1993. TrtcWrapper.prototype.setCurrentDeviceVolume = function (_args) {
  1994. return __awaiter(this, void 0, void 0, function () {
  1995. return __generator(this, function (_a) {
  1996. return [2 /*return*/, this._deviceManage.setCurrentDeviceVolume(_args)];
  1997. });
  1998. });
  1999. };
  2000. TrtcWrapper.prototype.getCurrentDeviceVolume = function (_args) {
  2001. return __awaiter(this, void 0, void 0, function () {
  2002. return __generator(this, function (_a) {
  2003. return [2 /*return*/, this._deviceManage.getCurrentDeviceVolume(_args)];
  2004. });
  2005. });
  2006. };
  2007. TrtcWrapper.prototype.setCurrentDeviceMute = function (_args) {
  2008. return __awaiter(this, void 0, void 0, function () {
  2009. return __generator(this, function (_a) {
  2010. return [2 /*return*/, this._deviceManage.setCurrentDeviceMute(_args)];
  2011. });
  2012. });
  2013. };
  2014. TrtcWrapper.prototype.getCurrentDeviceMute = function (_args) {
  2015. return __awaiter(this, void 0, void 0, function () {
  2016. return __generator(this, function (_a) {
  2017. return [2 /*return*/, this._deviceManage.getCurrentDeviceMute(_args)];
  2018. });
  2019. });
  2020. };
  2021. TrtcWrapper.prototype.startCameraDeviceTest = function (_args) {
  2022. return __awaiter(this, void 0, void 0, function () {
  2023. return __generator(this, function (_a) {
  2024. return [2 /*return*/, this._deviceManage.startCameraDeviceTest(_args)];
  2025. });
  2026. });
  2027. };
  2028. TrtcWrapper.prototype.stopCameraDeviceTest = function (_args) {
  2029. return __awaiter(this, void 0, void 0, function () {
  2030. return __generator(this, function (_a) {
  2031. return [2 /*return*/, this._deviceManage.stopCameraDeviceTest(_args)];
  2032. });
  2033. });
  2034. };
  2035. TrtcWrapper.prototype.startMicDeviceTest = function (_args) {
  2036. return __awaiter(this, void 0, void 0, function () {
  2037. return __generator(this, function (_a) {
  2038. return [2 /*return*/, this._deviceManage.startMicDeviceTest(_args)];
  2039. });
  2040. });
  2041. };
  2042. TrtcWrapper.prototype.stopMicDeviceTest = function (_args) {
  2043. return __awaiter(this, void 0, void 0, function () {
  2044. return __generator(this, function (_a) {
  2045. return [2 /*return*/, this._deviceManage.stopMicDeviceTest(_args)];
  2046. });
  2047. });
  2048. };
  2049. TrtcWrapper.prototype.startSpeakerDeviceTest = function (_args) {
  2050. return __awaiter(this, void 0, void 0, function () {
  2051. return __generator(this, function (_a) {
  2052. return [2 /*return*/, this._deviceManage.startSpeakerDeviceTest(_args)];
  2053. });
  2054. });
  2055. };
  2056. TrtcWrapper.prototype.stopSpeakerDeviceTest = function (_args) {
  2057. return __awaiter(this, void 0, void 0, function () {
  2058. return __generator(this, function (_a) {
  2059. return [2 /*return*/, this._deviceManage.stopSpeakerDeviceTest(_args)];
  2060. });
  2061. });
  2062. };
  2063. /// 设备管理end
  2064. // 开启水印
  2065. TrtcWrapper.prototype.setWatermark = function (_args) {
  2066. return __awaiter(this, void 0, void 0, function () {
  2067. return __generator(this, function (_a) {
  2068. (0, TXUntils_1.noSupportFunction)('setWatermark');
  2069. return [2 /*return*/];
  2070. });
  2071. });
  2072. };
  2073. /// 背景音乐相关start
  2074. TrtcWrapper.prototype.startPlayMusic = function (_args) {
  2075. return __awaiter(this, void 0, void 0, function () {
  2076. var path;
  2077. return __generator(this, function (_a) {
  2078. path = JSON.parse((0, TXUntils_1.getFlutterArgs)(_args, 'musicParam')).path;
  2079. // const path = './media/daoxiang.mp3';
  2080. this._audioMixMusic.createMusic(path);
  2081. this._audioMixMusic.addLowMix();
  2082. this._audioMixMusic.lowMixStart();
  2083. return [2 /*return*/];
  2084. });
  2085. });
  2086. };
  2087. TrtcWrapper.prototype.stopPlayMusic = function () {
  2088. return __awaiter(this, void 0, void 0, function () {
  2089. return __generator(this, function (_a) {
  2090. this._audioMixMusic.lowMixStop();
  2091. return [2 /*return*/];
  2092. });
  2093. });
  2094. };
  2095. TrtcWrapper.prototype.resumePlayMusic = function (_args) {
  2096. return __awaiter(this, void 0, void 0, function () {
  2097. return __generator(this, function (_a) {
  2098. this._audioMixMusic.lowMixResume();
  2099. return [2 /*return*/];
  2100. });
  2101. });
  2102. };
  2103. TrtcWrapper.prototype.pausePlayMusic = function (_args) {
  2104. return __awaiter(this, void 0, void 0, function () {
  2105. return __generator(this, function (_a) {
  2106. this._audioMixMusic.lowMixPause();
  2107. return [2 /*return*/];
  2108. });
  2109. });
  2110. };
  2111. /// 背景音乐相关end
  2112. TrtcWrapper.prototype.setEventHandler = function (handler) {
  2113. this.handler = handler;
  2114. };
  2115. TrtcWrapper.prototype.sharedInstance = function () {
  2116. return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {
  2117. return [2 /*return*/];
  2118. }); });
  2119. };
  2120. TrtcWrapper.prototype.destroySharedInstance = function () {
  2121. return __awaiter(this, void 0, void 0, function () {
  2122. return __generator(this, function (_a) {
  2123. switch (_a.label) {
  2124. case 0:
  2125. if (!this._client) return [3 /*break*/, 2];
  2126. return [4 /*yield*/, this.exitRoom()];
  2127. case 1:
  2128. _a.sent();
  2129. (0, TXUntils_1.logSuccess)('destroySharedInstance success');
  2130. _a.label = 2;
  2131. case 2: return [2 /*return*/];
  2132. }
  2133. });
  2134. });
  2135. };
  2136. TrtcWrapper.prototype.getDeviceManager = function () { };
  2137. TrtcWrapper.prototype.getBeautyManager = function () { };
  2138. TrtcWrapper.prototype.getAudioEffectManager = function () { };
  2139. TrtcWrapper.prototype._createNPublishLocalStream = function () {
  2140. return __awaiter(this, void 0, void 0, function () {
  2141. var promise;
  2142. var _this = this;
  2143. return __generator(this, function (_a) {
  2144. if (this._localStream) {
  2145. return [2 /*return*/];
  2146. }
  2147. (0, TXUntils_1.logSuccess)("begin create ".concat(this._userId, " Stream"));
  2148. this._localStream = trtc_js_sdk_1.default.createStream({
  2149. userId: this._userId,
  2150. audio: this._muteInitLocalAudio,
  2151. video: this._muteInitLocalVideo,
  2152. // facingMode:'user',//environment
  2153. });
  2154. if (this._videoProfile) {
  2155. this._localStream.setVideoProfile(this._videoProfile);
  2156. }
  2157. promise = new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
  2158. var error_4, publishFun;
  2159. var _this = this;
  2160. return __generator(this, function (_a) {
  2161. switch (_a.label) {
  2162. case 0:
  2163. _a.trys.push([0, 2, , 3]);
  2164. (0, TXUntils_1.logSuccess)('begin LocalStream initialize');
  2165. return [4 /*yield*/, this._localStream.initialize()];
  2166. case 1:
  2167. _a.sent();
  2168. // this._muteInitLocalVideo &&
  2169. // window.InitLocalStreamCallBack(this._localStream);
  2170. this._audioMixMusic = new AudioMixMusic_1.default(this._localStream);
  2171. (0, TXUntils_1.logSuccess)('LocalStream initialize success');
  2172. return [3 /*break*/, 3];
  2173. case 2:
  2174. error_4 = _a.sent();
  2175. (0, TXUntils_1.logError)('failed initialize localStream ' + error_4);
  2176. return [3 /*break*/, 3];
  2177. case 3:
  2178. try {
  2179. publishFun = function () { return __awaiter(_this, void 0, void 0, function () {
  2180. return __generator(this, function (_a) {
  2181. switch (_a.label) {
  2182. case 0:
  2183. if (!window.LocalBeautyStream) return [3 /*break*/, 2];
  2184. return [4 /*yield*/, this._client.publish(window.LocalBeautyStream)];
  2185. case 1:
  2186. _a.sent();
  2187. return [3 /*break*/, 4];
  2188. case 2: return [4 /*yield*/, this._client.publish(this._localStream)];
  2189. case 3:
  2190. _a.sent();
  2191. _a.label = 4;
  2192. case 4:
  2193. this._emitEvent(ListenerType_1.default.onStreamPublish, 0);
  2194. (0, TXUntils_1.logSuccess)('success initialize localStream & publish success');
  2195. return [2 /*return*/];
  2196. }
  2197. });
  2198. }); };
  2199. if (this._isHadJoined) {
  2200. publishFun();
  2201. }
  2202. else {
  2203. this._joinCallList.set('publish', publishFun);
  2204. }
  2205. resolve();
  2206. }
  2207. catch (publishError) {
  2208. this._emitEvent(ListenerType_1.default.onStreamPublish, 1);
  2209. (0, TXUntils_1.logError)('failed publish localStream ' + publishError);
  2210. reject();
  2211. }
  2212. return [2 /*return*/];
  2213. }
  2214. });
  2215. }); });
  2216. return [2 /*return*/, promise];
  2217. });
  2218. });
  2219. };
  2220. TrtcWrapper.prototype._emitEvent = function (methodName, data) {
  2221. var _a;
  2222. if (data instanceof Array || typeof data === 'object') {
  2223. data = JSON.stringify(data);
  2224. }
  2225. (_a = this.handler) === null || _a === void 0 ? void 0 : _a.call(this, methodName.toString(), data);
  2226. };
  2227. TrtcWrapper.prototype._addListener = function () {
  2228. var _this = this;
  2229. if (!this._client)
  2230. return;
  2231. this._client.on('error', function (error) {
  2232. _this._emitEvent(ListenerType_1.default.onError, {
  2233. errCode: error.getCode(),
  2234. errMsg: error.getMessage(),
  2235. });
  2236. });
  2237. this._client.on('client-banned', function (error) {
  2238. _this._emitEvent(ListenerType_1.default.onWarning, {
  2239. errCode: error.getCode(),
  2240. errMsg: '同名用户登录或者是被账户管理员主动踢出房间',
  2241. });
  2242. });
  2243. this._client.on('network-quality', function (event) {
  2244. _this._emitEvent(ListenerType_1.default.onNetworkQuality, event);
  2245. });
  2246. this._client.on('peer-join', function (event) {
  2247. var userId = event.userId;
  2248. _this._emitEvent(ListenerType_1.default.onRemoteUserEnterRoom, userId);
  2249. });
  2250. this._client.on('peer-leave', function (event) {
  2251. var userId = event.userId;
  2252. _this._emitEvent(ListenerType_1.default.onRemoteUserLeaveRoom, {
  2253. userId: userId,
  2254. reason: 0,
  2255. });
  2256. });
  2257. this._client.on('stream-added', function (event) {
  2258. var remoteStream = event.stream;
  2259. var remoteUserId = remoteStream.getUserId();
  2260. _this._remoteStream.set(remoteUserId, remoteStream);
  2261. if (_this._remoteHtml.has(remoteUserId)) {
  2262. (0, TXUntils_1.logInfo)("user ".concat(remoteUserId, " div had exist"));
  2263. }
  2264. else {
  2265. var oDiv = document.createElement('div');
  2266. oDiv.id = 'stream-added-stream_' + remoteUserId;
  2267. oDiv.style.visibility = 'hidden';
  2268. oDiv.style.height = '100%';
  2269. oDiv.style.width = '100%';
  2270. // document.body.appendChild(oDiv);
  2271. (0, TXUntils_1.logInfo)("stream-added ".concat(remoteUserId));
  2272. _this._remoteHtml.set(remoteUserId, oDiv);
  2273. }
  2274. remoteStream.play(_this._remoteHtml.get(remoteUserId), {
  2275. objectFit: 'cover',
  2276. muted: false,
  2277. });
  2278. remoteStream.resume();
  2279. });
  2280. this._client.on('stream-removed', function (event) {
  2281. var remoteStream = event.stream;
  2282. var remoteUserId = remoteStream.getUserId();
  2283. _this._remoteStream.delete(remoteUserId);
  2284. (0, TXUntils_1.logInfo)("user ".concat(remoteUserId, " stream-removed"));
  2285. _this._emitEvent(ListenerType_1.default.onUserVideoAvailable, {
  2286. userId: remoteUserId,
  2287. available: false,
  2288. });
  2289. _this._emitEvent(ListenerType_1.default.onUserAudioAvailable, {
  2290. userId: remoteUserId,
  2291. available: false,
  2292. });
  2293. remoteStream.stop();
  2294. });
  2295. this._client.on('mute-audio', function (event) {
  2296. var userId = event.userId;
  2297. _this._emitEvent(ListenerType_1.default.onUserAudioAvailable, {
  2298. userId: userId,
  2299. available: false,
  2300. });
  2301. });
  2302. this._client.on('mute-video', function (event) {
  2303. var userId = event.userId;
  2304. _this._emitEvent(ListenerType_1.default.onUserVideoAvailable, {
  2305. userId: userId,
  2306. available: false,
  2307. });
  2308. });
  2309. this._client.on('unmute-audio', function (event) {
  2310. var userId = event.userId;
  2311. _this._emitEvent(ListenerType_1.default.onUserAudioAvailable, {
  2312. userId: userId,
  2313. available: true,
  2314. });
  2315. });
  2316. this._client.on('unmute-video', function (event) {
  2317. var userId = event.userId;
  2318. (0, TXUntils_1.logInfo)("user ".concat(userId, " unmute-video"));
  2319. _this._emitEvent(ListenerType_1.default.onUserVideoAvailable, {
  2320. userId: userId,
  2321. available: true,
  2322. });
  2323. });
  2324. this._client.on('stream-subscribed', function (event) {
  2325. var remoteStream = event.stream;
  2326. var remoteUserId = remoteStream.getUserId();
  2327. _this._emitEvent(ListenerType_1.default.onUserSubStreamAvailable, {
  2328. userId: remoteUserId,
  2329. available: true,
  2330. });
  2331. });
  2332. this._client.on('audio-volume', function (event) {
  2333. var volumeList = [];
  2334. var totalVolume = 0;
  2335. event.result.forEach(function (_a) {
  2336. var userId = _a.userId, audioVolume = _a.audioVolume;
  2337. volumeList.push({
  2338. userId: userId,
  2339. volume: audioVolume,
  2340. });
  2341. totalVolume += audioVolume;
  2342. });
  2343. _this._emitEvent(ListenerType_1.default.onUserVoiceVolume, {
  2344. userVolumes: volumeList,
  2345. totalVolume: totalVolume,
  2346. });
  2347. });
  2348. };
  2349. TrtcWrapper.prototype._initClient = function (clientOpt, strRoomId, roomId, role, privateMapKey) {
  2350. return __awaiter(this, void 0, void 0, function () {
  2351. var promise;
  2352. var _this = this;
  2353. return __generator(this, function (_a) {
  2354. this._client = trtc_js_sdk_1.default.createClient(clientOpt);
  2355. promise = new Promise(function (resolve, reject) {
  2356. (0, TXUntils_1.logSuccess)('begin join room');
  2357. _this._client
  2358. .join({
  2359. roomId: strRoomId && strRoomId !== '' ? strRoomId : parseInt(roomId, 10),
  2360. role: role == 21 ? 'audience' : 'anchor',
  2361. privateMapKey: privateMapKey,
  2362. })
  2363. .then(function () {
  2364. (0, TXUntils_1.logSuccess)('join room success');
  2365. _this._addListener();
  2366. resolve();
  2367. _this._isHadJoined = true;
  2368. // 在登录后执行缓存的函数
  2369. if (_this._joinCallList.size > 0) {
  2370. var mapping = _this._joinCallList;
  2371. mapping.forEach(function (value, key) {
  2372. (0, TXUntils_1.logInfo)("after join room call ".concat(key, " func"));
  2373. value();
  2374. });
  2375. _this._joinCallList.clear();
  2376. }
  2377. })
  2378. .catch(function (error) {
  2379. (0, TXUntils_1.logError)('Join room failed: ' + error);
  2380. reject();
  2381. });
  2382. });
  2383. return [2 /*return*/, promise];
  2384. });
  2385. });
  2386. };
  2387. return TrtcWrapper;
  2388. }());
  2389. exports["default"] = TrtcWrapper;
  2390. /***/ }),
  2391. /***/ 802:
  2392. /***/ ((__unused_webpack_module, exports) => {
  2393. "use strict";
  2394. Object.defineProperty(exports, "__esModule", ({ value: true }));
  2395. exports.getVideoResolution = exports.logError = exports.logInfo = exports.logSuccess = exports.noSupportFunction = exports.getFlutterArgs = void 0;
  2396. var sdkName = '<TRTC Wrapper>';
  2397. function getNowTime() {
  2398. var date = new Date();
  2399. var fmt = 'hh:mm:ss:S';
  2400. var o = {
  2401. 'M+': date.getMonth() + 1,
  2402. 'd+': date.getDate(),
  2403. 'h+': date.getHours(),
  2404. 'm+': date.getMinutes(),
  2405. 's+': date.getSeconds(),
  2406. 'q+': Math.floor((date.getMonth() + 3) / 3),
  2407. 'S': date.getMilliseconds(), //毫秒
  2408. };
  2409. if (/(y+)/.test(fmt))
  2410. fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length));
  2411. for (var k in o)
  2412. if (new RegExp('(' + k + ')').test(fmt))
  2413. fmt = fmt.replace(RegExp.$1,
  2414. // eslint-disable-next-line eqeqeq
  2415. RegExp.$1.length == 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length));
  2416. return fmt;
  2417. }
  2418. function getFlutterArgs(_args, key) {
  2419. try {
  2420. return JSON.parse(_args)[key];
  2421. }
  2422. catch (ex) {
  2423. logError("_getFlutterArgs error _args: ".concat(_args, " ,key:").concat(key));
  2424. }
  2425. }
  2426. exports.getFlutterArgs = getFlutterArgs;
  2427. function noSupportFunction(funName) {
  2428. console.warn("[".concat(getNowTime(), "] ").concat(sdkName, " web sdk not supper ").concat(funName));
  2429. }
  2430. exports.noSupportFunction = noSupportFunction;
  2431. function logSuccess(line) {
  2432. console.info("%c [".concat(getNowTime(), "] ").concat(sdkName, " ").concat(line), 'color:green;font-size:18px;');
  2433. }
  2434. exports.logSuccess = logSuccess;
  2435. function logInfo(line) {
  2436. console.info("%c [".concat(getNowTime(), "] ").concat(sdkName, " ").concat(line), 'font-size:18px;color:blue;');
  2437. }
  2438. exports.logInfo = logInfo;
  2439. function logError(line) {
  2440. console.error("%c [".concat(getNowTime(), "] ").concat(sdkName, " ").concat(line), 'color:red;font-size:18px');
  2441. }
  2442. exports.logError = logError;
  2443. function getVideoResolution(_videoResolution) {
  2444. var line = "120*120 = 1;\n 160*160 = 3;\n 270*270 = 5;\n 480*480 = 7;\n 160*120 = 50;\n 240*180 = 52;\n 280*210 = 54;\n 320*240 = 56;\n 400*300 = 58;\n 480*360 = 60;\n 640*480 = 62;\n 960*720 = 64;\n 160*90 = 100;\n 256*144 = 102;\n 320*180 = 104;\n 480*270 = 106;\n 640*360 = 108;\n 960*540 = 110;\n 1280*720 = 112;\n 1920*1080 = 114;";
  2445. var ls = line.split(';');
  2446. var v = '360*360';
  2447. ls.forEach(function (item) {
  2448. if (item.indexOf('=') >= 0 && item.endsWith("= ".concat(_videoResolution))) {
  2449. v = item.split('=')[0].trim().replace(/\n/g, '');
  2450. return v;
  2451. }
  2452. });
  2453. return v;
  2454. }
  2455. exports.getVideoResolution = getVideoResolution;
  2456. /***/ })
  2457. /******/ });
  2458. /************************************************************************/
  2459. /******/ // The module cache
  2460. /******/ var __webpack_module_cache__ = {};
  2461. /******/
  2462. /******/ // The require function
  2463. /******/ function __webpack_require__(moduleId) {
  2464. /******/ // Check if module is in cache
  2465. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  2466. /******/ if (cachedModule !== undefined) {
  2467. /******/ return cachedModule.exports;
  2468. /******/ }
  2469. /******/ // Create a new module (and put it into the cache)
  2470. /******/ var module = __webpack_module_cache__[moduleId] = {
  2471. /******/ // no module.id needed
  2472. /******/ // no module.loaded needed
  2473. /******/ exports: {}
  2474. /******/ };
  2475. /******/
  2476. /******/ // Execute the module function
  2477. /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  2478. /******/
  2479. /******/ // Return the exports of the module
  2480. /******/ return module.exports;
  2481. /******/ }
  2482. /******/
  2483. /************************************************************************/
  2484. /******/ /* webpack/runtime/global */
  2485. /******/ (() => {
  2486. /******/ __webpack_require__.g = (function() {
  2487. /******/ if (typeof globalThis === 'object') return globalThis;
  2488. /******/ try {
  2489. /******/ return this || new Function('return this')();
  2490. /******/ } catch (e) {
  2491. /******/ if (typeof window === 'object') return window;
  2492. /******/ }
  2493. /******/ })();
  2494. /******/ })();
  2495. /******/
  2496. /************************************************************************/
  2497. /******/
  2498. /******/ // startup
  2499. /******/ // Load entry module and return exports
  2500. /******/ // This entry module is referenced by other modules so it can't be inlined
  2501. /******/ var __webpack_exports__ = __webpack_require__(315);
  2502. /******/ __webpack_exports__ = __webpack_exports__["default"];
  2503. /******/
  2504. /******/ return __webpack_exports__;
  2505. /******/ })()
  2506. ;
  2507. });