@flowplayer/player 3.5.2 → 3.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core.js +1 -1
- package/default.js +1 -1
- package/embed.js +3 -3
- package/package.json +1 -1
- package/plugins/ads.js +2 -2
- package/plugins/analytics.js +1 -1
- package/plugins/health.js +1 -1
- package/plugins/hls.js +1 -1
- package/plugins/rts.js +2 -2
- package/plugins/subtitles.js +1 -1
package/plugins/rts.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.rts=t())}(this,(function(){"use strict";var e="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function t(e,t){const r=function(){try{return localStorage.getItem("flowplayer/debug")}catch(e){return""}}(),n=(n,...i)=>{try{const o=(null==t?void 0:t.debug)||r;o&&e.match(o)&&console.log(`flowplayer/${e} -- ${n}`,...i)}catch(e){console.warn(e)}};return n.log=n,n}function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}var i=r,o=n;function s(e){if(i===setTimeout)return setTimeout(e,0);if((i===r||!i)&&setTimeout)return i=setTimeout,setTimeout(e,0);try{return i(e,0)}catch(t){try{return i.call(null,e,0)}catch(t){return i.call(this,e,0)}}}"function"==typeof e.setTimeout&&(i=setTimeout),"function"==typeof e.clearTimeout&&(o=clearTimeout);var a,c=[],u=!1,l=-1;function d(){u&&a&&(u=!1,a.length?c=a.concat(c):l=-1,c.length&&f())}function f(){if(!u){var e=s(d);u=!0;for(var t=c.length;t;){for(a=c,c=[];++l<t;)a&&a[l].run();l=-1,t=c.length}a=null,u=!1,function(e){if(o===clearTimeout)return clearTimeout(e);if((o===n||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(e);try{o(e)}catch(t){try{return o.call(null,e)}catch(t){return o.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}p.prototype.run=function(){this.fun.apply(null,this.array)};function h(){}var m=h,g=h,v=h,y=h,w=h,E=h,T=h;var I=e.performance||{},R=I.now||I.mozNow||I.msNow||I.oNow||I.webkitNow||function(){return(new Date).getTime()};var P=new Date;var A={nextTick:function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];c.push(new p(e,t)),1!==c.length||u||s(f)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:m,addListener:g,once:v,off:y,removeListener:w,removeAllListeners:E,emit:T,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*R.call(I),r=Math.floor(t),n=Math.floor(t%1*1e9);return e&&(r-=e[0],(n-=e[1])<0&&(r--,n+=1e9)),[r,n]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-P)/1e3}};function k(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function O(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?k(Object(r),!0).forEach((function(t){M(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):k(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function L(e,t,r,n,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,i)}function D(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function s(e){L(o,n,i,s,a,"next",e)}function a(e){L(o,n,i,s,a,"throw",e)}s(void 0)}))}}function M(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function N(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o=[],s=!0,a=!1;try{for(r=r.call(e);!(s=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);s=!0);}catch(e){a=!0,i=e}finally{try{s||null==r.return||r.return()}finally{if(a)throw i}}return o}}(e,t)||j(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 j(e,t){if(e){if("string"==typeof e)return _(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_(e,t):void 0}}function _(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function B(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=j(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},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 o,s=!0,a=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){a=!0,o=e},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw o}}}}var U="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{};function V(e){var t={exports:{}};return e(t,t.exports),t.exports}var F,z,G=function(e){return e&&e.Math==Math&&e},W=G("object"==typeof globalThis&&globalThis)||G("object"==typeof window&&window)||G("object"==typeof self&&self)||G("object"==typeof U&&U)||function(){return this}()||Function("return this")(),q=function(e){try{return!!e()}catch(e){return!0}},H=!q((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),X=!q((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),Y=Function.prototype.call,K=X?Y.bind(Y):function(){return Y.apply(Y,arguments)},Q={}.propertyIsEnumerable,J=Object.getOwnPropertyDescriptor,Z={f:J&&!Q.call({1:2},1)?function(e){var t=J(this,e);return!!t&&t.enumerable}:Q},ee=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},te=Function.prototype,re=te.bind,ne=te.call,ie=X&&re.bind(ne,ne),oe=X?function(e){return e&&ie(e)}:function(e){return e&&function(){return ne.apply(e,arguments)}},se=oe({}.toString),ae=oe("".slice),ce=function(e){return ae(se(e),8,-1)},ue=Object,le=oe("".split),de=q((function(){return!ue("z").propertyIsEnumerable(0)}))?function(e){return"String"==ce(e)?le(e,""):ue(e)}:ue,fe=function(e){return null==e},pe=TypeError,he=function(e){if(fe(e))throw pe("Can't call method on "+e);return e},me=function(e){return de(he(e))},ge="object"==typeof document&&document.all,ve={all:ge,IS_HTMLDDA:void 0===ge&&void 0!==ge},ye=ve.all,we=ve.IS_HTMLDDA?function(e){return"function"==typeof e||e===ye}:function(e){return"function"==typeof e},be=ve.all,Se=ve.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:we(e)||e===be}:function(e){return"object"==typeof e?null!==e:we(e)},Ce=function(e){return we(e)?e:void 0},xe=function(e,t){return arguments.length<2?Ce(W[e]):W[e]&&W[e][t]},Ee=oe({}.isPrototypeOf),Te=xe("navigator","userAgent")||"",Ie=W.process,Re=W.Deno,Pe=Ie&&Ie.versions||Re&&Re.version,Ae=Pe&&Pe.v8;Ae&&(z=(F=Ae.split("."))[0]>0&&F[0]<4?1:+(F[0]+F[1])),!z&&Te&&(!(F=Te.match(/Edge\/(\d+)/))||F[1]>=74)&&(F=Te.match(/Chrome\/(\d+)/))&&(z=+F[1]);var ke=z,Oe=!!Object.getOwnPropertySymbols&&!q((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&ke&&ke<41})),Le=Oe&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,De=Object,Me=Le?function(e){return"symbol"==typeof e}:function(e){var t=xe("Symbol");return we(t)&&Ee(t.prototype,De(e))},Ne=String,je=function(e){try{return Ne(e)}catch(e){return"Object"}},_e=TypeError,Be=function(e){if(we(e))return e;throw _e(je(e)+" is not a function")},Ue=function(e,t){var r=e[t];return fe(r)?void 0:Be(r)},Ve=TypeError,Fe=Object.defineProperty,ze=function(e,t){try{Fe(W,e,{value:t,configurable:!0,writable:!0})}catch(r){W[e]=t}return t},$e=W["__core-js_shared__"]||ze("__core-js_shared__",{}),Ge=V((function(e){(e.exports=function(e,t){return $e[e]||($e[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.25.2",mode:"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.25.2/LICENSE",source:"https://github.com/zloirock/core-js"})})),We=Object,qe=function(e){return We(he(e))},He=oe({}.hasOwnProperty),Xe=Object.hasOwn||function(e,t){return He(qe(e),t)},Ye=0,Ke=Math.random(),Qe=oe(1..toString),Je=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Qe(++Ye+Ke,36)},Ze=Ge("wks"),et=W.Symbol,tt=et&&et.for,rt=Le?et:et&&et.withoutSetter||Je,nt=function(e){if(!Xe(Ze,e)||!Oe&&"string"!=typeof Ze[e]){var t="Symbol."+e;Oe&&Xe(et,e)?Ze[e]=et[e]:Ze[e]=Le&&tt?tt(t):rt(t)}return Ze[e]},it=TypeError,ot=nt("toPrimitive"),st=function(e){var t=function(e,t){if(!Se(e)||Me(e))return e;var r,n=Ue(e,ot);if(n){if(void 0===t&&(t="default"),r=K(n,e,t),!Se(r)||Me(r))return r;throw it("Can't convert object to primitive value")}return void 0===t&&(t="number"),function(e,t){var r,n;if("string"===t&&we(r=e.toString)&&!Se(n=K(r,e)))return n;if(we(r=e.valueOf)&&!Se(n=K(r,e)))return n;if("string"!==t&&we(r=e.toString)&&!Se(n=K(r,e)))return n;throw Ve("Can't convert object to primitive value")}(e,t)}(e,"string");return Me(t)?t:t+""},at=W.document,ct=Se(at)&&Se(at.createElement),ut=function(e){return ct?at.createElement(e):{}},lt=!H&&!q((function(){return 7!=Object.defineProperty(ut("div"),"a",{get:function(){return 7}}).a})),dt=Object.getOwnPropertyDescriptor,ft={f:H?dt:function(e,t){if(e=me(e),t=st(t),lt)try{return dt(e,t)}catch(e){}if(Xe(e,t))return ee(!K(Z.f,e,t),e[t])}},pt=H&&q((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),ht=String,mt=TypeError,gt=function(e){if(Se(e))return e;throw mt(ht(e)+" is not an object")},vt=TypeError,yt=Object.defineProperty,wt=Object.getOwnPropertyDescriptor,bt={f:H?pt?function(e,t,r){if(gt(e),t=st(t),gt(r),"function"==typeof e&&"prototype"===t&&"value"in r&&"writable"in r&&!r.writable){var n=wt(e,t);n&&n.writable&&(e[t]=r.value,r={configurable:"configurable"in r?r.configurable:n.configurable,enumerable:"enumerable"in r?r.enumerable:n.enumerable,writable:!1})}return yt(e,t,r)}:yt:function(e,t,r){if(gt(e),t=st(t),gt(r),lt)try{return yt(e,t,r)}catch(e){}if("get"in r||"set"in r)throw vt("Accessors not supported");return"value"in r&&(e[t]=r.value),e}},St=H?function(e,t,r){return bt.f(e,t,ee(1,r))}:function(e,t,r){return e[t]=r,e},Ct=Function.prototype,xt=H&&Object.getOwnPropertyDescriptor,Et=Xe(Ct,"name"),Tt={EXISTS:Et,PROPER:Et&&"something"===function(){}.name,CONFIGURABLE:Et&&(!H||H&&xt(Ct,"name").configurable)},It=oe(Function.toString);we($e.inspectSource)||($e.inspectSource=function(e){return It(e)});var Rt,Pt,At,kt=$e.inspectSource,Ot=W.WeakMap,Lt=we(Ot)&&/native code/.test(String(Ot)),Dt=Ge("keys"),Mt=function(e){return Dt[e]||(Dt[e]=Je(e))},Nt={},jt=W.TypeError,_t=W.WeakMap;if(Lt||$e.state){var Bt=$e.state||($e.state=new _t),Ut=oe(Bt.get),Vt=oe(Bt.has),Ft=oe(Bt.set);Rt=function(e,t){if(Vt(Bt,e))throw jt("Object already initialized");return t.facade=e,Ft(Bt,e,t),t},Pt=function(e){return Ut(Bt,e)||{}},At=function(e){return Vt(Bt,e)}}else{var zt=Mt("state");Nt[zt]=!0,Rt=function(e,t){if(Xe(e,zt))throw jt("Object already initialized");return t.facade=e,St(e,zt,t),t},Pt=function(e){return Xe(e,zt)?e[zt]:{}},At=function(e){return Xe(e,zt)}}var $t={set:Rt,get:Pt,has:At,enforce:function(e){return At(e)?Pt(e):Rt(e,{})},getterFor:function(e){return function(t){var r;if(!Se(t)||(r=Pt(t)).type!==e)throw jt("Incompatible receiver, "+e+" required");return r}}},Gt=V((function(e){var t=Tt.CONFIGURABLE,r=$t.enforce,n=$t.get,i=Object.defineProperty,o=H&&!q((function(){return 8!==i((function(){}),"length",{value:8}).length})),s=String(String).split("String"),a=e.exports=function(e,n,a){"Symbol("===String(n).slice(0,7)&&(n="["+String(n).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),a&&a.getter&&(n="get "+n),a&&a.setter&&(n="set "+n),(!Xe(e,"name")||t&&e.name!==n)&&(H?i(e,"name",{value:n,configurable:!0}):e.name=n),o&&a&&Xe(a,"arity")&&e.length!==a.arity&&i(e,"length",{value:a.arity});try{a&&Xe(a,"constructor")&&a.constructor?H&&i(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var c=r(e);return Xe(c,"source")||(c.source=s.join("string"==typeof n?n:"")),e};Function.prototype.toString=a((function(){return we(this)&&n(this).source||kt(this)}),"toString")})),Wt=function(e,t,r,n){n||(n={});var i=n.enumerable,o=void 0!==n.name?n.name:t;if(we(r)&&Gt(r,o,n),n.global)i?e[t]=r:ze(t,r);else{try{n.unsafe?e[t]&&(i=!0):delete e[t]}catch(e){}i?e[t]=r:bt.f(e,t,{value:r,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return e},qt=Math.ceil,Ht=Math.floor,Xt=Math.trunc||function(e){var t=+e;return(t>0?Ht:qt)(t)},Yt=function(e){var t=+e;return t!=t||0===t?0:Xt(t)},Kt=Math.max,Qt=Math.min,Jt=function(e,t){var r=Yt(e);return r<0?Kt(r+t,0):Qt(r,t)},Zt=Math.min,er=function(e){return e>0?Zt(Yt(e),9007199254740991):0},tr=function(e){return er(e.length)},rr=function(e){return function(t,r,n){var i,o=me(t),s=tr(o),a=Jt(n,s);if(e&&r!=r){for(;s>a;)if((i=o[a++])!=i)return!0}else for(;s>a;a++)if((e||a in o)&&o[a]===r)return e||a||0;return!e&&-1}},nr={includes:rr(!0),indexOf:rr(!1)},ir=nr.indexOf,or=oe([].push),sr=function(e,t){var r,n=me(e),i=0,o=[];for(r in n)!Xe(Nt,r)&&Xe(n,r)&&or(o,r);for(;t.length>i;)Xe(n,r=t[i++])&&(~ir(o,r)||or(o,r));return o},ar=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],cr=ar.concat("length","prototype"),ur={f:Object.getOwnPropertyNames||function(e){return sr(e,cr)}},lr={f:Object.getOwnPropertySymbols},dr=oe([].concat),fr=xe("Reflect","ownKeys")||function(e){var t=ur.f(gt(e)),r=lr.f;return r?dr(t,r(e)):t},pr=function(e,t,r){for(var n=fr(t),i=bt.f,o=ft.f,s=0;s<n.length;s++){var a=n[s];Xe(e,a)||r&&Xe(r,a)||i(e,a,o(t,a))}},hr=/#|\.prototype\./,mr=function(e,t){var r=vr[gr(e)];return r==wr||r!=yr&&(we(t)?q(t):!!t)},gr=mr.normalize=function(e){return String(e).replace(hr,".").toLowerCase()},vr=mr.data={},yr=mr.NATIVE="N",wr=mr.POLYFILL="P",br=mr,Sr=ft.f,Cr=function(e,t){var r,n,i,o,s,a=e.target,c=e.global,u=e.stat;if(r=c?W:u?W[a]||ze(a,{}):(W[a]||{}).prototype)for(n in t){if(o=t[n],i=e.dontCallGetSet?(s=Sr(r,n))&&s.value:r[n],!br(c?n:a+(u?".":"#")+n,e.forced)&&void 0!==i){if(typeof o==typeof i)continue;pr(o,i)}(e.sham||i&&i.sham)&&St(o,"sham",!0),Wt(r,n,o,e)}},xr=Array.isArray||function(e){return"Array"==ce(e)},Er=TypeError,Tr=function(e){if(e>9007199254740991)throw Er("Maximum allowed index exceeded");return e},Ir=function(e,t,r){var n=st(t);n in e?bt.f(e,n,ee(0,r)):e[n]=r},Rr={};Rr[nt("toStringTag")]="z";var Pr="[object z]"===String(Rr),Ar=nt("toStringTag"),kr=Object,Or="Arguments"==ce(function(){return arguments}()),Lr=Pr?ce:function(e){var t,r,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(e){}}(t=kr(e),Ar))?r:Or?ce(t):"Object"==(n=ce(t))&&we(t.callee)?"Arguments":n},Dr=function(){},Mr=[],Nr=xe("Reflect","construct"),jr=/^\s*(?:class|function)\b/,_r=oe(jr.exec),Br=!jr.exec(Dr),Ur=function(e){if(!we(e))return!1;try{return Nr(Dr,Mr,e),!0}catch(e){return!1}},Vr=function(e){if(!we(e))return!1;switch(Lr(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Br||!!_r(jr,kt(e))}catch(e){return!0}};Vr.sham=!0;var Fr=!Nr||q((function(){var e;return Ur(Ur.call)||!Ur(Object)||!Ur((function(){e=!0}))||e}))?Vr:Ur,zr=nt("species"),$r=Array,Gr=function(e,t){return new(function(e){var t;return xr(e)&&(t=e.constructor,(Fr(t)&&(t===$r||xr(t.prototype))||Se(t)&&null===(t=t[zr]))&&(t=void 0)),void 0===t?$r:t}(e))(0===t?0:t)},Wr=nt("species"),qr=function(e){return ke>=51||!q((function(){var t=[];return(t.constructor={})[Wr]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},Hr=nt("isConcatSpreadable"),Xr=ke>=51||!q((function(){var e=[];return e[Hr]=!1,e.concat()[0]!==e})),Yr=qr("concat"),Kr=function(e){if(!Se(e))return!1;var t=e[Hr];return void 0!==t?!!t:xr(e)};Cr({target:"Array",proto:!0,arity:1,forced:!Xr||!Yr},{concat:function(e){var t,r,n,i,o,s=qe(this),a=Gr(s,0),c=0;for(t=-1,n=arguments.length;t<n;t++)if(Kr(o=-1===t?s:arguments[t]))for(i=tr(o),Tr(c+i),r=0;r<i;r++,c++)r in o&&Ir(a,c,o[r]);else Tr(c+1),Ir(a,c++,o);return a.length=c,a}});var Qr=oe([].slice),Jr=qr("slice"),Zr=nt("species"),en=Array,tn=Math.max;Cr({target:"Array",proto:!0,forced:!Jr},{slice:function(e,t){var r,n,i,o=me(this),s=tr(o),a=Jt(e,s),c=Jt(void 0===t?s:t,s);if(xr(o)&&(r=o.constructor,(Fr(r)&&(r===en||xr(r.prototype))||Se(r)&&null===(r=r[Zr]))&&(r=void 0),r===en||void 0===r))return Qr(o,a,c);for(n=new(void 0===r?en:r)(tn(c-a,0)),i=0;a<c;a++,i++)a in o&&Ir(n,i,o[a]);return n.length=i,n}});var rn=oe(oe.bind),nn=function(e,t){return Be(e),void 0===t?e:X?rn(e,t):function(){return e.apply(t,arguments)}},on=oe([].push),sn=function(e){var t=1==e,r=2==e,n=3==e,i=4==e,o=6==e,s=7==e,a=5==e||o;return function(c,u,l,d){for(var f,p,h=qe(c),m=de(h),g=nn(u,l),v=tr(m),y=0,w=d||Gr,E=t?w(c,v):r||s?w(c,0):void 0;v>y;y++)if((a||y in m)&&(p=g(f=m[y],y,h),e))if(t)E[y]=p;else if(p)switch(e){case 3:return!0;case 5:return f;case 6:return y;case 2:on(E,f)}else switch(e){case 4:return!1;case 7:on(E,f)}return o?-1:n||i?i:E}},an={forEach:sn(0),map:sn(1),filter:sn(2),some:sn(3),every:sn(4),find:sn(5),findIndex:sn(6),filterReject:sn(7)},cn=an.map,un=qr("map");Cr({target:"Array",proto:!0,forced:!un},{map:function(e){return cn(this,e,arguments.length>1?arguments[1]:void 0)}});var ln=Function.prototype,dn=ln.apply,fn=ln.call,pn="object"==typeof Reflect&&Reflect.apply||(X?fn.bind(dn):function(){return fn.apply(dn,arguments)}),hn=xe("JSON","stringify"),mn=oe(/./.exec),gn=oe("".charAt),vn=oe("".charCodeAt),yn=oe("".replace),wn=oe(1..toString),bn=/[\uD800-\uDFFF]/g,Sn=/^[\uD800-\uDBFF]$/,Cn=/^[\uDC00-\uDFFF]$/,xn=!Oe||q((function(){var e=xe("Symbol")();return"[null]"!=hn([e])||"{}"!=hn({a:e})||"{}"!=hn(Object(e))})),En=q((function(){return'"\\udf06\\ud834"'!==hn("\udf06\ud834")||'"\\udead"'!==hn("\udead")})),Tn=function(e,t){var r=Qr(arguments),n=t;if((Se(t)||void 0!==e)&&!Me(e))return xr(t)||(t=function(e,t){if(we(n)&&(t=K(n,this,e,t)),!Me(t))return t}),r[1]=t,pn(hn,null,r)},In=function(e,t,r){var n=gn(r,t-1),i=gn(r,t+1);return mn(Sn,e)&&!mn(Cn,i)||mn(Cn,e)&&!mn(Sn,n)?"\\u"+wn(vn(e,0),16):e};hn&&Cr({target:"JSON",stat:!0,arity:3,forced:xn||En},{stringify:function(e,t,r){var n=Qr(arguments),i=pn(xn?Tn:hn,null,n);return En&&"string"==typeof i?yn(i,bn,In):i}});var Rn=V((function(e){!function(t){var r,n={VERSION:"1.6.1"},i={},o=function(e,t){return function(){return t.apply(e,arguments)}},s=function(){var e,t,r=arguments,n=r[0];for(t=1;t<r.length;t++)for(e in r[t])!(e in n)&&r[t].hasOwnProperty(e)&&(n[e]=r[t][e]);return n},a=function(e,t){return{value:e,name:t}};n.TRACE=a(1,"TRACE"),n.DEBUG=a(2,"DEBUG"),n.INFO=a(3,"INFO"),n.TIME=a(4,"TIME"),n.WARN=a(5,"WARN"),n.ERROR=a(8,"ERROR"),n.OFF=a(99,"OFF");var c=function(e){this.context=e,this.setLevel(e.filterLevel),this.log=this.info};c.prototype={setLevel:function(e){e&&"value"in e&&(this.context.filterLevel=e)},getLevel:function(){return this.context.filterLevel},enabledFor:function(e){var t=this.context.filterLevel;return e.value>=t.value},trace:function(){this.invoke(n.TRACE,arguments)},debug:function(){this.invoke(n.DEBUG,arguments)},info:function(){this.invoke(n.INFO,arguments)},warn:function(){this.invoke(n.WARN,arguments)},error:function(){this.invoke(n.ERROR,arguments)},time:function(e){"string"==typeof e&&e.length>0&&this.invoke(n.TIME,[e,"start"])},timeEnd:function(e){"string"==typeof e&&e.length>0&&this.invoke(n.TIME,[e,"end"])},invoke:function(e,t){r&&this.enabledFor(e)&&r(t,s({level:e},this.context))}};var u,l=new c({filterLevel:n.OFF});(u=n).enabledFor=o(l,l.enabledFor),u.trace=o(l,l.trace),u.debug=o(l,l.debug),u.time=o(l,l.time),u.timeEnd=o(l,l.timeEnd),u.info=o(l,l.info),u.warn=o(l,l.warn),u.error=o(l,l.error),u.log=u.info,n.setHandler=function(e){r=e},n.setLevel=function(e){for(var t in l.setLevel(e),i)i.hasOwnProperty(t)&&i[t].setLevel(e)},n.getLevel=function(){return l.getLevel()},n.get=function(e){return i[e]||(i[e]=new c(s({name:e},l.context)))},n.createDefaultHandler=function(e){(e=e||{}).formatter=e.formatter||function(e,t){t.name&&e.unshift("["+t.name+"]")};var t={},r=function(e,t){Function.prototype.apply.call(e,console,t)};return"undefined"==typeof console?function(){}:function(i,o){i=Array.prototype.slice.call(i);var s,a=console.log;o.level===n.TIME?(s=(o.name?"["+o.name+"] ":"")+i[0],"start"===i[1]?console.time?console.time(s):t[s]=(new Date).getTime():console.timeEnd?console.timeEnd(s):r(a,[s+": "+((new Date).getTime()-t[s])+"ms"])):(o.level===n.WARN&&console.warn?a=console.warn:o.level===n.ERROR&&console.error?a=console.error:o.level===n.INFO&&console.info?a=console.info:o.level===n.DEBUG&&console.debug?a=console.debug:o.level===n.TRACE&&console.trace&&(a=console.trace),e.formatter(i,o),r(a,i))}},n.useDefaults=function(e){n.setLevel(e&&e.defaultLevel||n.DEBUG),n.setHandler(n.createDefaultHandler(e))},n.setDefaults=n.useDefaults,e.exports?e.exports=n:(n._prevLogger=t.Logger,n.noConflict=function(){return t.Logger=n._prevLogger,n},t.Logger=n)}(U)}));Rn.useDefaults({defaultLevel:Rn.TRACE});const Pn=(e,t)=>{e.unshift("[".concat(t.name||"Global","] ").concat((new Date).toISOString()," - ").concat(t.level.name," -"))},An=(e,t)=>t?e.value>=Mn[t].value:e.value>=Dn.value,kn=Rn.createDefaultHandler({formatter:Pn});Rn.setHandler((e,t)=>{((e,t)=>{e=(e=Array.prototype.slice.call(e)).map(e=>"object"==typeof e?JSON.stringify(e):e),Pn(e,t),0!==On?(Ln.push(e.join(" ")),Ln.length>=On&&(Ln=Ln.slice(-On))):Ln=[]})(e,t),An(t.level,t.name)&&kn(e,t);var r,n=B(Nn);try{for(n.s();!(r=n.n()).done;){const n=r.value,i=n.handler,o=n.level;t.level.value>=o.value&&i(e,t)}}catch(e){n.e(e)}finally{n.f()}});let On=1e4,Ln=[],Dn=Rn.OFF;const Mn={},Nn=[],jn=O(O({},Rn),{},{enabledFor:An,getHistory:()=>Ln,getHistoryMaxSize:()=>On,setHistoryMaxSize:e=>{On=e},setLevel:e=>{Dn=e;for(const t in Mn)Mn[t]=e},getLevel:()=>Dn,get:e=>{Mn[e]||(Mn[e]=Dn);const t=Rn.get(e);return t.setLevel=t=>{Mn[e]=t},t.getLevel=()=>Mn[e],t},setHandler:(e,t)=>{Nn.push({handler:e,level:t})}});var _n,Bn,Un,Vn,Fn="process"==ce(W.process),zn=String,$n=TypeError,Gn=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=oe(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(r,[]),t=r instanceof Array}catch(e){}return function(r,n){return gt(r),function(e){if("object"==typeof e||we(e))return e;throw $n("Can't set "+zn(e)+" as a prototype")}(n),t?e(r,n):r.__proto__=n,r}}():void 0),Wn=bt.f,qn=nt("toStringTag"),Hn=function(e,t,r){e&&!r&&(e=e.prototype),e&&!Xe(e,qn)&&Wn(e,qn,{configurable:!0,value:t})},Xn=nt("species"),Yn=function(e){var t=xe(e),r=bt.f;H&&t&&!t[Xn]&&r(t,Xn,{configurable:!0,get:function(){return this}})},Kn=TypeError,Qn=function(e,t){if(Ee(t,e))return e;throw Kn("Incorrect invocation")},Jn=TypeError,Zn=nt("species"),ei=function(e,t){var r,n=gt(e).constructor;return void 0===n||fe(r=gt(n)[Zn])?t:function(e){if(Fr(e))return e;throw Jn(je(e)+" is not a constructor")}(r)},ti=xe("document","documentElement"),ri=TypeError,ni=function(e,t){if(e<t)throw ri("Not enough arguments");return e},ii=/(?:ipad|iphone|ipod).*applewebkit/i.test(Te),oi=W.setImmediate,si=W.clearImmediate,ai=W.process,ci=W.Dispatch,ui=W.Function,li=W.MessageChannel,di=W.String,fi=0,pi={};try{_n=W.location}catch(wf){}var hi=function(e){if(Xe(pi,e)){var t=pi[e];delete pi[e],t()}},mi=function(e){return function(){hi(e)}},gi=function(e){hi(e.data)},vi=function(e){W.postMessage(di(e),_n.protocol+"//"+_n.host)};oi&&si||(oi=function(e){ni(arguments.length,1);var t=we(e)?e:ui(e),r=Qr(arguments,1);return pi[++fi]=function(){pn(t,void 0,r)},Bn(fi),fi},si=function(e){delete pi[e]},Fn?Bn=function(e){ai.nextTick(mi(e))}:ci&&ci.now?Bn=function(e){ci.now(mi(e))}:li&&!ii?(Vn=(Un=new li).port2,Un.port1.onmessage=gi,Bn=nn(Vn.postMessage,Vn)):W.addEventListener&&we(W.postMessage)&&!W.importScripts&&_n&&"file:"!==_n.protocol&&!q(vi)?(Bn=vi,W.addEventListener("message",gi,!1)):Bn="onreadystatechange"in ut("script")?function(e){ti.appendChild(ut("script")).onreadystatechange=function(){ti.removeChild(this),hi(e)}}:function(e){setTimeout(mi(e),0)});var yi,wi,bi,Si,Ci,xi,Ei,Ti,Ii={set:oi,clear:si},Ri=/ipad|iphone|ipod/i.test(Te)&&void 0!==W.Pebble,Pi=/web0s(?!.*chrome)/i.test(Te),Ai=ft.f,ki=Ii.set,Oi=W.MutationObserver||W.WebKitMutationObserver,Li=W.document,Di=W.process,Mi=W.Promise,Ni=Ai(W,"queueMicrotask"),ji=Ni&&Ni.value;ji||(yi=function(){var e,t;for(Fn&&(e=Di.domain)&&e.exit();wi;){t=wi.fn,wi=wi.next;try{t()}catch(e){throw wi?Si():bi=void 0,e}}bi=void 0,e&&e.enter()},ii||Fn||Pi||!Oi||!Li?!Ri&&Mi&&Mi.resolve?((Ei=Mi.resolve(void 0)).constructor=Mi,Ti=nn(Ei.then,Ei),Si=function(){Ti(yi)}):Fn?Si=function(){Di.nextTick(yi)}:(ki=nn(ki,W),Si=function(){ki(yi)}):(Ci=!0,xi=Li.createTextNode(""),new Oi(yi).observe(xi,{characterData:!0}),Si=function(){xi.data=Ci=!Ci}));var _i=ji||function(e){var t={fn:e,next:void 0};bi&&(bi.next=t),wi||(wi=t,Si()),bi=t},Bi=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},Ui=function(){this.head=null,this.tail=null};Ui.prototype={add:function(e){var t={item:e,next:null};this.head?this.tail.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return this.head=e.next,this.tail===e&&(this.tail=null),e.item}};var Vi=Ui,Fi=W.Promise,zi="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,$i=!zi&&!Fn&&"object"==typeof window&&"object"==typeof document;Fi&&Fi.prototype;var Gi,Wi,qi,Hi=nt("species"),Xi=!1,Yi=we(W.PromiseRejectionEvent),Ki={CONSTRUCTOR:br("Promise",(function(){var e=kt(Fi),t=e!==String(Fi);if(!t&&66===ke)return!0;if(!ke||ke<51||!/native code/.test(e)){var r=new Fi((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};if((r.constructor={})[Hi]=n,!(Xi=r.then((function(){}))instanceof n))return!0}return!t&&($i||zi)&&!Yi})),REJECTION_EVENT:Yi,SUBCLASSING:Xi},Qi=TypeError,Ji=function(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw Qi("Bad Promise constructor");t=e,r=n})),this.resolve=Be(t),this.reject=Be(r)},Zi={f:function(e){return new Ji(e)}},eo=Ii.set,to=Ki.CONSTRUCTOR,ro=Ki.REJECTION_EVENT,no=Ki.SUBCLASSING,io=$t.getterFor("Promise"),oo=$t.set,so=Fi&&Fi.prototype,ao=Fi,co=so,uo=W.TypeError,lo=W.document,fo=W.process,po=Zi.f,ho=po,mo=!!(lo&&lo.createEvent&&W.dispatchEvent),go=function(e){var t;return!(!Se(e)||!we(t=e.then))&&t},vo=function(e,t){var r,n,i,o=t.value,s=1==t.state,a=s?e.ok:e.fail,c=e.resolve,u=e.reject,l=e.domain;try{a?(s||(2===t.rejection&&Co(t),t.rejection=1),!0===a?r=o:(l&&l.enter(),r=a(o),l&&(l.exit(),i=!0)),r===e.promise?u(uo("Promise-chain cycle")):(n=go(r))?K(n,r,c,u):c(r)):u(o)}catch(e){l&&!i&&l.exit(),u(e)}},yo=function(e,t){e.notified||(e.notified=!0,_i((function(){for(var r,n=e.reactions;r=n.get();)vo(r,e);e.notified=!1,t&&!e.rejection&&bo(e)})))},wo=function(e,t,r){var n,i;mo?((n=lo.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),W.dispatchEvent(n)):n={promise:t,reason:r},!ro&&(i=W["on"+e])?i(n):"unhandledrejection"===e&&function(e,t){var r=W.console;r&&r.error&&(1==arguments.length?r.error(e):r.error(e,t))}("Unhandled promise rejection",r)},bo=function(e){K(eo,W,(function(){var t,r=e.facade,n=e.value;if(So(e)&&(t=Bi((function(){Fn?fo.emit("unhandledRejection",n,r):wo("unhandledrejection",r,n)})),e.rejection=Fn||So(e)?2:1,t.error))throw t.value}))},So=function(e){return 1!==e.rejection&&!e.parent},Co=function(e){K(eo,W,(function(){var t=e.facade;Fn?fo.emit("rejectionHandled",t):wo("rejectionhandled",t,e.value)}))},xo=function(e,t,r){return function(n){e(t,n,r)}},Eo=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,yo(e,!0))},To=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw uo("Promise can't be resolved itself");var n=go(t);n?_i((function(){var r={done:!1};try{K(n,t,xo(To,r,e),xo(Eo,r,e))}catch(t){Eo(r,t,e)}})):(e.value=t,e.state=1,yo(e,!1))}catch(t){Eo({done:!1},t,e)}}};if(to&&(co=(ao=function(e){Qn(this,co),Be(e),K(Gi,this);var t=io(this);try{e(xo(To,t),xo(Eo,t))}catch(e){Eo(t,e)}}).prototype,(Gi=function(e){oo(this,{type:"Promise",done:!1,notified:!1,parent:!1,reactions:new Vi,rejection:!1,state:0,value:void 0})}).prototype=Wt(co,"then",(function(e,t){var r=io(this),n=po(ei(this,ao));return r.parent=!0,n.ok=!we(e)||e,n.fail=we(t)&&t,n.domain=Fn?fo.domain:void 0,0==r.state?r.reactions.add(n):_i((function(){vo(n,r)})),n.promise})),Wi=function(){var e=new Gi,t=io(e);this.promise=e,this.resolve=xo(To,t),this.reject=xo(Eo,t)},Zi.f=po=function(e){return e===ao||void 0===e?new Wi(e):ho(e)},we(Fi)&&so!==Object.prototype)){qi=so.then,no||Wt(so,"then",(function(e,t){var r=this;return new ao((function(e,t){K(qi,r,e,t)})).then(e,t)}),{unsafe:!0});try{delete so.constructor}catch(wf){}Gn&&Gn(so,co)}Cr({global:!0,constructor:!0,wrap:!0,forced:to},{Promise:ao}),Hn(ao,"Promise",!1),Yn("Promise");var Io={},Ro=nt("iterator"),Po=Array.prototype,Ao=function(e){return void 0!==e&&(Io.Array===e||Po[Ro]===e)},ko=nt("iterator"),Oo=function(e){if(!fe(e))return Ue(e,ko)||Ue(e,"@@iterator")||Io[Lr(e)]},Lo=TypeError,Do=function(e,t){var r=arguments.length<2?Oo(e):t;if(Be(r))return gt(K(r,e));throw Lo(je(e)+" is not iterable")},Mo=function(e,t,r){var n,i;gt(e);try{if(!(n=Ue(e,"return"))){if("throw"===t)throw r;return r}n=K(n,e)}catch(e){i=!0,n=e}if("throw"===t)throw r;if(i)throw n;return gt(n),r},No=TypeError,jo=function(e,t){this.stopped=e,this.result=t},_o=jo.prototype,Bo=function(e,t,r){var n,i,o,s,a,c,u,l=r&&r.that,d=!(!r||!r.AS_ENTRIES),f=!(!r||!r.IS_RECORD),p=!(!r||!r.IS_ITERATOR),h=!(!r||!r.INTERRUPTED),m=nn(t,l),g=function(e){return n&&Mo(n,"normal",e),new jo(!0,e)},v=function(e){return d?(gt(e),h?m(e[0],e[1],g):m(e[0],e[1])):h?m(e,g):m(e)};if(f)n=e.iterator;else if(p)n=e;else{if(!(i=Oo(e)))throw No(je(e)+" is not iterable");if(Ao(i)){for(o=0,s=tr(e);s>o;o++)if((a=v(e[o]))&&Ee(_o,a))return a;return new jo(!1)}n=Do(e,i)}for(c=f?e.next:n.next;!(u=K(c,n)).done;){try{a=v(u.value)}catch(e){Mo(n,"throw",e)}if("object"==typeof a&&a&&Ee(_o,a))return a}return new jo(!1)},Uo=nt("iterator"),Vo=!1;try{var Fo=0,zo={next:function(){return{done:!!Fo++}},return:function(){Vo=!0}};zo[Uo]=function(){return this},Array.from(zo,(function(){throw 2}))}catch(wf){}var $o=function(e,t){if(!t&&!Vo)return!1;var r=!1;try{var n={};n[Uo]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(e){}return r},Go=Ki.CONSTRUCTOR||!$o((function(e){Fi.all(e).then(void 0,(function(){}))}));Cr({target:"Promise",stat:!0,forced:Go},{all:function(e){var t=this,r=Zi.f(t),n=r.resolve,i=r.reject,o=Bi((function(){var r=Be(t.resolve),o=[],s=0,a=1;Bo(e,(function(e){var c=s++,u=!1;a++,K(r,t,e).then((function(e){u||(u=!0,o[c]=e,--a||n(o))}),i)})),--a||n(o)}));return o.error&&i(o.value),r.promise}});var Wo=Ki.CONSTRUCTOR,qo=Fi&&Fi.prototype;if(Cr({target:"Promise",proto:!0,forced:Wo,real:!0},{catch:function(e){return this.then(void 0,e)}}),we(Fi)){var Ho=xe("Promise").prototype.catch;qo.catch!==Ho&&Wt(qo,"catch",Ho,{unsafe:!0})}Cr({target:"Promise",stat:!0,forced:Go},{race:function(e){var t=this,r=Zi.f(t),n=r.reject,i=Bi((function(){var i=Be(t.resolve);Bo(e,(function(e){K(i,t,e).then(r.resolve,n)}))}));return i.error&&n(i.value),r.promise}}),Cr({target:"Promise",stat:!0,forced:Ki.CONSTRUCTOR},{reject:function(e){var t=Zi.f(this);return K(t.reject,void 0,e),t.promise}});var Xo=Ki.CONSTRUCTOR;xe("Promise"),Cr({target:"Promise",stat:!0,forced:Xo},{resolve:function(e){return function(e,t){if(gt(e),Se(t)&&t.constructor===e)return t;var r=Zi.f(e);return(0,r.resolve)(t),r.promise}(this,e)}});var Yo=bt.f,Ko=function(e,t,r){r in e||Yo(e,r,{configurable:!0,get:function(){return t[r]},set:function(e){t[r]=e}})},Qo=function(e,t,r){var n,i;return Gn&&we(n=t.constructor)&&n!==r&&Se(i=n.prototype)&&i!==r.prototype&&Gn(e,i),e},Jo=String,Zo=function(e){if("Symbol"===Lr(e))throw TypeError("Cannot convert a Symbol value to a string");return Jo(e)},es=function(e,t){return void 0===e?arguments.length<2?"":t:Zo(e)},ts=function(e,t){Se(t)&&"cause"in t&&St(e,"cause",t.cause)},rs=Error,ns=oe("".replace),is=String(rs("zxcasd").stack),os=/\n\s*at [^:]*:[^\n]*/,ss=os.test(is),as=function(e,t){if(ss&&"string"==typeof e&&!rs.prepareStackTrace)for(;t--;)e=ns(e,os,"");return e},cs=!q((function(){var e=Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",ee(1,7)),7!==e.stack)})),us=function(e,t,r,n){var i="stackTraceLimit",o=n?2:1,s=e.split("."),a=s[s.length-1],c=xe.apply(null,s);if(c){var u=c.prototype;if(Xe(u,"cause")&&delete u.cause,!r)return c;var l=xe("Error"),d=t((function(e,t){var r=es(n?t:e,void 0),i=n?new c(e):new c;return void 0!==r&&St(i,"message",r),cs&&St(i,"stack",as(i.stack,2)),this&&Ee(u,this)&&Qo(i,this,d),arguments.length>o&&ts(i,arguments[o]),i}));d.prototype=u,"Error"!==a?Gn?Gn(d,l):pr(d,l,{name:!0}):H&&i in c&&(Ko(d,c,i),Ko(d,c,"prepareStackTrace")),pr(d,c);try{u.name!==a&&St(u,"name",a),u.constructor=d}catch(e){}return d}},ls=W.WebAssembly,ds=7!==Error("e",{cause:7}).cause,fs=function(e,t){var r={};r[e]=us(e,t,ds),Cr({global:!0,constructor:!0,arity:1,forced:ds},r)},ps=function(e,t){if(ls&&ls[e]){var r={};r[e]=us("WebAssembly."+e,t,ds),Cr({target:"WebAssembly",stat:!0,constructor:!0,arity:1,forced:ds},r)}};fs("Error",(function(e){return function(t){return pn(e,this,arguments)}})),fs("EvalError",(function(e){return function(t){return pn(e,this,arguments)}})),fs("RangeError",(function(e){return function(t){return pn(e,this,arguments)}})),fs("ReferenceError",(function(e){return function(t){return pn(e,this,arguments)}})),fs("SyntaxError",(function(e){return function(t){return pn(e,this,arguments)}})),fs("TypeError",(function(e){return function(t){return pn(e,this,arguments)}})),fs("URIError",(function(e){return function(t){return pn(e,this,arguments)}})),ps("CompileError",(function(e){return function(t){return pn(e,this,arguments)}})),ps("LinkError",(function(e){return function(t){return pn(e,this,arguments)}})),ps("RuntimeError",(function(e){return function(t){return pn(e,this,arguments)}}));var hs=nt("match"),ms=function(e){var t;return Se(e)&&(void 0!==(t=e[hs])?!!t:"RegExp"==ce(e))},gs=function(){var e=gt(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t},vs=RegExp.prototype,ys=function(e){var t=e.flags;return void 0!==t||"flags"in vs||Xe(e,"flags")||!Ee(vs,e)?t:K(gs,e)},ws=W.RegExp,bs=q((function(){var e=ws("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),Ss=bs||q((function(){return!ws("a","y").sticky})),Cs={BROKEN_CARET:bs||q((function(){var e=ws("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),MISSED_STICKY:Ss,UNSUPPORTED_Y:bs},xs=W.RegExp,Es=q((function(){var e=xs(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),Ts=W.RegExp,Is=q((function(){var e=Ts("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),Rs=ur.f,Ps=$t.enforce,As=nt("match"),ks=W.RegExp,Os=ks.prototype,Ls=W.SyntaxError,Ds=oe(Os.exec),Ms=oe("".charAt),Ns=oe("".replace),js=oe("".indexOf),_s=oe("".slice),Bs=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,Us=/a/g,Vs=/a/g,Fs=new ks(Us)!==Us,zs=Cs.MISSED_STICKY,$s=Cs.UNSUPPORTED_Y,Gs=H&&(!Fs||zs||Es||Is||q((function(){return Vs[As]=!1,ks(Us)!=Us||ks(Vs)==Vs||"/a/i"!=ks(Us,"i")})));if(br("RegExp",Gs)){for(var Ws=function(e,t){var r,n,i,o,s,a,c=Ee(Os,this),u=ms(e),l=void 0===t,d=[],f=e;if(!c&&u&&l&&e.constructor===Ws)return e;if((u||Ee(Os,e))&&(e=e.source,l&&(t=ys(f))),e=void 0===e?"":Zo(e),t=void 0===t?"":Zo(t),f=e,Es&&"dotAll"in Us&&(n=!!t&&js(t,"s")>-1)&&(t=Ns(t,/s/g,"")),r=t,zs&&"sticky"in Us&&(i=!!t&&js(t,"y")>-1)&&$s&&(t=Ns(t,/y/g,"")),Is&&(e=(o=function(e){for(var t,r=e.length,n=0,i="",o=[],s={},a=!1,c=!1,u=0,l="";n<=r;n++){if("\\"===(t=Ms(e,n)))t+=Ms(e,++n);else if("]"===t)a=!1;else if(!a)switch(!0){case"["===t:a=!0;break;case"("===t:Ds(Bs,_s(e,n+1))&&(n+=2,c=!0),i+=t,u++;continue;case">"===t&&c:if(""===l||Xe(s,l))throw new Ls("Invalid capture group name");s[l]=!0,o[o.length]=[l,u],c=!1,l="";continue}c?l+=t:i+=t}return[i,o]}(e))[0],d=o[1]),s=Qo(ks(e,t),c?this:Os,Ws),(n||i||d.length)&&(a=Ps(s),n&&(a.dotAll=!0,a.raw=Ws(function(e){for(var t,r=e.length,n=0,i="",o=!1;n<=r;n++)"\\"!==(t=Ms(e,n))?o||"."!==t?("["===t?o=!0:"]"===t&&(o=!1),i+=t):i+="[\\s\\S]":i+=t+Ms(e,++n);return i}(e),r)),i&&(a.sticky=!0),d.length&&(a.groups=d)),e!==f)try{St(s,"source",""===f?"(?:)":f)}catch(e){}return s},qs=Rs(ks),Hs=0;qs.length>Hs;)Ko(Ws,ks,qs[Hs++]);Os.constructor=Ws,Ws.prototype=Os,Wt(W,"RegExp",Ws,{constructor:!0})}Yn("RegExp");var Xs,Ys,Ks,Qs=$t.get,Js=RegExp.prototype,Zs=TypeError;H&&Es&&(Xs=Js,Ys="dotAll",(Ks={configurable:!0,get:function(){if(this!==Js){if("RegExp"===ce(this))return!!Qs(this).dotAll;throw Zs("Incompatible receiver, RegExp required")}}}).get&&Gt(Ks.get,Ys,{getter:!0}),Ks.set&&Gt(Ks.set,Ys,{setter:!0}),bt.f(Xs,Ys,Ks));var ea,ta=Object.keys||function(e){return sr(e,ar)},ra={f:H&&!pt?Object.defineProperties:function(e,t){gt(e);for(var r,n=me(t),i=ta(t),o=i.length,s=0;o>s;)bt.f(e,r=i[s++],n[r]);return e}},na=Mt("IE_PROTO"),ia=function(){},oa=function(e){return"<script>"+e+"<\/script>"},sa=function(e){e.write(oa("")),e.close();var t=e.parentWindow.Object;return e=null,t},aa=function(){try{ea=new ActiveXObject("htmlfile")}catch(e){}var e,t;aa="undefined"!=typeof document?document.domain&&ea?sa(ea):((t=ut("iframe")).style.display="none",ti.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(oa("document.F=Object")),e.close(),e.F):sa(ea);for(var r=ar.length;r--;)delete aa.prototype[ar[r]];return aa()};Nt[na]=!0;var ca=Object.create||function(e,t){var r;return null!==e?(ia.prototype=gt(e),r=new ia,ia.prototype=null,r[na]=e):r=aa(),void 0===t?r:ra.f(r,t)},ua=$t.get,la=Ge("native-string-replace",String.prototype.replace),da=RegExp.prototype.exec,fa=da,pa=oe("".charAt),ha=oe("".indexOf),ma=oe("".replace),ga=oe("".slice),va=function(){var e=/a/,t=/b*/g;return K(da,e,"a"),K(da,t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),ya=Cs.BROKEN_CARET,wa=void 0!==/()??/.exec("")[1];(va||wa||ya||Es||Is)&&(fa=function(e){var t,r,n,i,o,s,a,c=this,u=ua(c),l=Zo(e),d=u.raw;if(d)return d.lastIndex=c.lastIndex,t=K(fa,d,l),c.lastIndex=d.lastIndex,t;var f=u.groups,p=ya&&c.sticky,h=K(gs,c),m=c.source,g=0,v=l;if(p&&(h=ma(h,"y",""),-1===ha(h,"g")&&(h+="g"),v=ga(l,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==pa(l,c.lastIndex-1))&&(m="(?: "+m+")",v=" "+v,g++),r=new RegExp("^(?:"+m+")",h)),wa&&(r=new RegExp("^"+m+"$(?!\\s)",h)),va&&(n=c.lastIndex),i=K(da,p?r:c,v),p?i?(i.input=ga(i.input,g),i[0]=ga(i[0],g),i.index=c.lastIndex,c.lastIndex+=i[0].length):c.lastIndex=0:va&&i&&(c.lastIndex=c.global?i.index+i[0].length:n),wa&&i&&i.length>1&&K(la,i[0],r,(function(){for(o=1;o<arguments.length-2;o++)void 0===arguments[o]&&(i[o]=void 0)})),i&&f)for(i.groups=s=ca(null),o=0;o<f.length;o++)s[(a=f[o])[0]]=i[a[1]];return i});var ba=fa;Cr({target:"RegExp",proto:!0,forced:/./.exec!==ba},{exec:ba});var Sa=oe(Z.f),Ca=oe([].push),xa=function(e){return function(t){for(var r,n=me(t),i=ta(n),o=i.length,s=0,a=[];o>s;)r=i[s++],H&&!Sa(n,r)||Ca(a,e?[r,n[r]]:n[r]);return a}},Ea=(xa(!0),xa(!1));Cr({target:"Object",stat:!0},{values:function(e){return Ea(e)}});var Ta=nt("species"),Ia=RegExp.prototype,Ra=function(e,t,r,n){var i=nt(e),o=!q((function(){var t={};return t[i]=function(){return 7},7!=""[e](t)})),s=o&&!q((function(){var t=!1,r=/a/;return"split"===e&&((r={}).constructor={},r.constructor[Ta]=function(){return r},r.flags="",r[i]=/./[i]),r.exec=function(){return t=!0,null},r[i](""),!t}));if(!o||!s||r){var a=oe(/./[i]),c=t(i,""[e],(function(e,t,r,n,i){var s=oe(e),c=t.exec;return c===ba||c===Ia.exec?o&&!i?{done:!0,value:a(t,r,n)}:{done:!0,value:s(r,t,n)}:{done:!1}}));Wt(String.prototype,e,c[0]),Wt(Ia,i,c[1])}n&&St(Ia[i],"sham",!0)},Pa=oe("".charAt),Aa=oe("".charCodeAt),ka=oe("".slice),Oa=function(e){return function(t,r){var n,i,o=Zo(he(t)),s=Yt(r),a=o.length;return s<0||s>=a?e?"":void 0:(n=Aa(o,s))<55296||n>56319||s+1===a||(i=Aa(o,s+1))<56320||i>57343?e?Pa(o,s):n:e?ka(o,s,s+2):i-56320+(n-55296<<10)+65536}},La=(Oa(!1),Oa(!0)),Da=function(e,t,r){return t+(r?La(e,t).length:1)},Ma=TypeError,Na=function(e,t){var r=e.exec;if(we(r)){var n=K(r,e,t);return null!==n&>(n),n}if("RegExp"===ce(e))return K(ba,e,t);throw Ma("RegExp#exec called on incompatible receiver")};Ra("match",(function(e,t,r){return[function(t){var r=he(this),n=fe(t)?void 0:Ue(t,e);return n?K(n,t,r):new RegExp(t)[e](Zo(r))},function(e){var n=gt(this),i=Zo(e),o=r(t,n,i);if(o.done)return o.value;if(!n.global)return Na(n,i);var s=n.unicode;n.lastIndex=0;for(var a,c=[],u=0;null!==(a=Na(n,i));){var l=Zo(a[0]);c[u]=l,""===l&&(n.lastIndex=Da(i,er(n.lastIndex),s)),u++}return 0===u?null:c}]}));var ja=bt.f,_a=nt("unscopables"),Ba=Array.prototype;null==Ba[_a]&&ja(Ba,_a,{configurable:!0,value:ca(null)});var Ua,Va,Fa,za=function(e){Ba[_a][e]=!0},$a=!q((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),Ga=Mt("IE_PROTO"),Wa=Object,qa=Wa.prototype,Ha=$a?Wa.getPrototypeOf:function(e){var t=qe(e);if(Xe(t,Ga))return t[Ga];var r=t.constructor;return we(r)&&t instanceof r?r.prototype:t instanceof Wa?qa:null},Xa=nt("iterator"),Ya=!1;[].keys&&("next"in(Fa=[].keys())?(Va=Ha(Ha(Fa)))!==Object.prototype&&(Ua=Va):Ya=!0),(!Se(Ua)||q((function(){var e={};return Ua[Xa].call(e)!==e})))&&(Ua={}),we(Ua[Xa])||Wt(Ua,Xa,(function(){return this}));var Ka={IteratorPrototype:Ua,BUGGY_SAFARI_ITERATORS:Ya},Qa=Ka.IteratorPrototype,Ja=function(){return this},Za=function(e,t,r,n){var i=t+" Iterator";return e.prototype=ca(Qa,{next:ee(+!n,r)}),Hn(e,i,!1),Io[i]=Ja,e},ec=Tt.PROPER,tc=Tt.CONFIGURABLE,rc=Ka.IteratorPrototype,nc=Ka.BUGGY_SAFARI_ITERATORS,ic=nt("iterator"),oc=function(){return this},sc=function(e,t,r,n,i,o,s){Za(r,t,n);var a,c,u,l=function(e){if(e===i&&m)return m;if(!nc&&e in p)return p[e];switch(e){case"keys":case"values":case"entries":return function(){return new r(this,e)}}return function(){return new r(this)}},d=t+" Iterator",f=!1,p=e.prototype,h=p[ic]||p["@@iterator"]||i&&p[i],m=!nc&&h||l(i),g="Array"==t&&p.entries||h;if(g&&(a=Ha(g.call(new e)))!==Object.prototype&&a.next&&(Ha(a)!==rc&&(Gn?Gn(a,rc):we(a[ic])||Wt(a,ic,oc)),Hn(a,d,!0)),ec&&"values"==i&&h&&"values"!==h.name&&(tc?St(p,"name","values"):(f=!0,m=function(){return K(h,this)})),i)if(c={values:l("values"),keys:o?m:l("keys"),entries:l("entries")},s)for(u in c)(nc||f||!(u in p))&&Wt(p,u,c[u]);else Cr({target:t,proto:!0,forced:nc||f},c);return p[ic]!==m&&Wt(p,ic,m,{name:i}),Io[t]=m,c},ac=function(e,t){return{value:e,done:t}},cc=bt.f,uc=$t.set,lc=$t.getterFor("Array Iterator"),dc=sc(Array,"Array",(function(e,t){uc(this,{type:"Array Iterator",target:me(e),index:0,kind:t})}),(function(){var e=lc(this),t=e.target,r=e.kind,n=e.index++;return!t||n>=t.length?(e.target=void 0,ac(void 0,!0)):ac("keys"==r?n:"values"==r?t[n]:[n,t[n]],!1)}),"values"),fc=Io.Arguments=Io.Array;if(za("keys"),za("values"),za("entries"),H&&"values"!==fc.name)try{cc(fc,"name",{value:"values"})}catch(wf){}var pc={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},hc=ut("span").classList,mc=hc&&hc.constructor&&hc.constructor.prototype,gc=mc===Object.prototype?void 0:mc,vc=nt("iterator"),yc=nt("toStringTag"),wc=dc.values,bc=function(e,t){if(e){if(e[vc]!==wc)try{St(e,vc,wc)}catch(t){e[vc]=wc}if(e[yc]||St(e,yc,t),pc[t])for(var r in dc)if(e[r]!==dc[r])try{St(e,r,dc[r])}catch(t){e[r]=dc[r]}}};for(var Sc in pc)bc(W[Sc]&&W[Sc].prototype,Sc);bc(gc,"DOMTokenList");var Cc=Array,xc=Math.max,Ec=ur.f,Tc="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],Ic={f:function(e){return Tc&&"Window"==ce(e)?function(e){try{return Ec(e)}catch(e){return function(e,t,r){for(var n=tr(e),i=Jt(void 0,n),o=Jt(n,n),s=Cc(xc(o-i,0)),a=0;i<o;i++,a++)Ir(s,a,e[i]);return s.length=a,s}(Tc)}}(e):Ec(me(e))}},Rc=q((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),Pc=Object.isExtensible,Ac=q((function(){Pc(1)}))||Rc?function(e){return!!Se(e)&&(!Rc||"ArrayBuffer"!=ce(e))&&(!Pc||Pc(e))}:Pc,kc=!q((function(){return Object.isExtensible(Object.preventExtensions({}))})),Oc=V((function(e){var t=bt.f,r=!1,n=Je("meta"),i=0,o=function(e){t(e,n,{value:{objectID:"O"+i++,weakData:{}}})},s=e.exports={enable:function(){s.enable=function(){},r=!0;var e=ur.f,t=oe([].splice),i={};i[n]=1,e(i).length&&(ur.f=function(r){for(var i=e(r),o=0,s=i.length;o<s;o++)if(i[o]===n){t(i,o,1);break}return i},Cr({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:Ic.f}))},fastKey:function(e,t){if(!Se(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!Xe(e,n)){if(!Ac(e))return"F";if(!t)return"E";o(e)}return e[n].objectID},getWeakData:function(e,t){if(!Xe(e,n)){if(!Ac(e))return!0;if(!t)return!1;o(e)}return e[n].weakData},onFreeze:function(e){return kc&&r&&Ac(e)&&!Xe(e,n)&&o(e),e}};Nt[n]=!0})),Lc=function(e,t,r){for(var n in t)Wt(e,n,t[n],r);return e},Dc=bt.f,Mc=Oc.fastKey,Nc=$t.set,jc=$t.getterFor;!function(e,t,r){var n=-1!==e.indexOf("Map"),i=-1!==e.indexOf("Weak"),o=n?"set":"add",s=W.Set,a=s&&s.prototype,c=s,u={},l=function(e){var t=oe(a[e]);Wt(a,e,"add"==e?function(e){return t(this,0===e?0:e),this}:"delete"==e?function(e){return!(i&&!Se(e))&&t(this,0===e?0:e)}:"get"==e?function(e){return i&&!Se(e)?void 0:t(this,0===e?0:e)}:"has"==e?function(e){return!(i&&!Se(e))&&t(this,0===e?0:e)}:function(e,r){return t(this,0===e?0:e,r),this})};if(br(e,!we(s)||!(i||a.forEach&&!q((function(){(new s).entries().next()})))))c=r.getConstructor(t,e,n,o),Oc.enable();else if(br(e,!0)){var d=new c,f=d[o](i?{}:-0,1)!=d,p=q((function(){d.has(1)})),h=$o((function(e){new s(e)})),m=!i&&q((function(){for(var e=new s,t=5;t--;)e[o](t,t);return!e.has(-0)}));h||((c=t((function(e,t){Qn(e,a);var r=Qo(new s,e,c);return fe(t)||Bo(t,r[o],{that:r,AS_ENTRIES:n}),r}))).prototype=a,a.constructor=c),(p||m)&&(l("delete"),l("has"),n&&l("get")),(m||f)&&l(o),i&&a.clear&&delete a.clear}u.Set=c,Cr({global:!0,constructor:!0,forced:c!=s},u),Hn(c,e),i||r.setStrong(c,e,n)}("Set",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),{getConstructor:function(e,t,r,n){var i=e((function(e,i){Qn(e,o),Nc(e,{type:t,index:ca(null),first:void 0,last:void 0,size:0}),H||(e.size=0),fe(i)||Bo(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,s=jc(t),a=function(e,t,r){var n,i,o=s(e),a=c(e,t);return a?a.value=r:(o.last=a={index:i=Mc(t,!0),key:t,value:r,previous:n=o.last,next:void 0,removed:!1},o.first||(o.first=a),n&&(n.next=a),H?o.size++:e.size++,"F"!==i&&(o.index[i]=a)),e},c=function(e,t){var r,n=s(e),i=Mc(t);if("F"!==i)return n.index[i];for(r=n.first;r;r=r.next)if(r.key==t)return r};return Lc(o,{clear:function(){for(var e=s(this),t=e.index,r=e.first;r;)r.removed=!0,r.previous&&(r.previous=r.previous.next=void 0),delete t[r.index],r=r.next;e.first=e.last=void 0,H?e.size=0:this.size=0},delete:function(e){var t=this,r=s(t),n=c(t,e);if(n){var i=n.next,o=n.previous;delete r.index[n.index],n.removed=!0,o&&(o.next=i),i&&(i.previous=o),r.first==n&&(r.first=i),r.last==n&&(r.last=o),H?r.size--:t.size--}return!!n},forEach:function(e){for(var t,r=s(this),n=nn(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:r.first;)for(n(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!c(this,e)}}),Lc(o,r?{get:function(e){var t=c(this,e);return t&&t.value},set:function(e,t){return a(this,0===e?0:e,t)}}:{add:function(e){return a(this,e=0===e?0:e,e)}}),H&&Dc(o,"size",{get:function(){return s(this).size}}),i},setStrong:function(e,t,r){var n=t+" Iterator",i=jc(t),o=jc(n);sc(e,t,(function(e,t){Nc(this,{type:n,target:e,state:i(e),kind:t,last:void 0})}),(function(){for(var e=o(this),t=e.kind,r=e.last;r&&r.removed;)r=r.previous;return e.target&&(e.last=r=r?r.next:e.state.first)?ac("keys"==t?r.key:"values"==t?r.value:[r.key,r.value],!1):(e.target=void 0,ac(void 0,!0))}),r?"entries":"values",!r,!0),Yn(t)}});var _c,Bc="object"==typeof Reflect?Reflect:null,Uc=Bc&&"function"==typeof Bc.apply?Bc.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};_c=Bc&&"function"==typeof Bc.ownKeys?Bc.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var Vc=Number.isNaN||function(e){return e!=e};function Fc(){Fc.init.call(this)}var zc=Fc;Fc.EventEmitter=Fc,Fc.prototype._events=void 0,Fc.prototype._eventsCount=0,Fc.prototype._maxListeners=void 0;var $c=10;function Wc(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function qc(e){return void 0===e._maxListeners?Fc.defaultMaxListeners:e._maxListeners}function Hc(e,t,r,n){var i,o,s,a;if(Wc(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),s=o[t]),void 0===s)s=o[t]=r,++e._eventsCount;else if("function"==typeof s?s=o[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(i=qc(e))>0&&s.length>i&&!s.warned){s.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=s.length,a=c,console&&console.warn&&console.warn(a)}return e}function Xc(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Yc(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=Xc.bind(n);return i.listener=r,n.wrapFn=i,i}function Kc(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(i):Jc(i,i.length)}function Qc(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function Jc(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function Zc(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function i(o){n.once&&e.removeEventListener(t,i),r(o)}))}}Object.defineProperty(Fc,"defaultMaxListeners",{enumerable:!0,get:function(){return $c},set:function(e){if("number"!=typeof e||e<0||Vc(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");$c=e}}),Fc.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Fc.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||Vc(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},Fc.prototype.getMaxListeners=function(){return qc(this)},Fc.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,i=this._events;if(void 0!==i)n=n&&void 0===i.error;else if(!n)return!1;if(n){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var a=i[e];if(void 0===a)return!1;if("function"==typeof a)Uc(a,this,t);else{var c=a.length,u=Jc(a,c);for(r=0;r<c;++r)Uc(u[r],this,t)}return!0},Fc.prototype.addListener=function(e,t){return Hc(this,e,t,!1)},Fc.prototype.on=Fc.prototype.addListener,Fc.prototype.prependListener=function(e,t){return Hc(this,e,t,!0)},Fc.prototype.once=function(e,t){return Wc(t),this.on(e,Yc(this,e,t)),this},Fc.prototype.prependOnceListener=function(e,t){return Wc(t),this.prependListener(e,Yc(this,e,t)),this},Fc.prototype.removeListener=function(e,t){var r,n,i,o,s;if(Wc(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){s=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,s||t)}return this},Fc.prototype.off=Fc.prototype.removeListener,Fc.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var i,o=Object.keys(r);for(n=0;n<o.length;++n)"removeListener"!==(i=o[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},Fc.prototype.listeners=function(e){return Kc(this,e,!0)},Fc.prototype.rawListeners=function(e){return Kc(this,e,!1)},Fc.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):Qc.call(e,t)},Fc.prototype.listenerCount=Qc,Fc.prototype.eventNames=function(){return this._eventsCount>0?_c(this._events):[]},zc.once=function(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,o),n(r)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}Zc(e,t,o,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&Zc(e,"error",t,{once:!0})}(e,i)}))};var eu=ru,tu=zc.EventEmitter;function ru(e,t,r){Array.isArray(r)||(r=[r]);var n=[];return r.forEach((function(r){var i=function(){var e=[].slice.call(arguments);e.unshift(r),t.emit.apply(t,e)};n.push(i),e.on(r,i)})),function(){r.forEach((function(t,r){e.removeListener(t,n[r])}))}}eu.filter=function(e,t){var r=new tu;return ru(e,r,t),r};var nu=nr.includes,iu=q((function(){return!Array(1).includes()}));Cr({target:"Array",proto:!0,forced:iu},{includes:function(e){return nu(this,e,arguments.length>1?arguments[1]:void 0)}}),za("includes");var ou=TypeError,su=function(e){if(ms(e))throw ou("The method doesn't accept regular expressions");return e},au=nt("match"),cu=oe("".indexOf);Cr({target:"String",proto:!0,forced:!function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[au]=!1,"/./"[e](t)}catch(e){}}return!1}("includes")},{includes:function(e){return!!~cu(Zo(he(this)),Zo(su(e)),arguments.length>1?arguments[1]:void 0)}});const uu=jn.get("PeerConnectionStats");class Gc extends zc{constructor(e){super(),this.peer=e,this.stats=null,this.emitInterval=null,this.previousStats=null}init(){var e=this;uu.info("Initializing peer connection stats"),this.emitInterval=setInterval(D((function*(){const t=yield e.peer.getStats();e.parseStats(t),e.emit("stats",e.stats)})),1e3)}parseStats(e){this.previousStats=this.stats;const t={audio:{inbounds:[],outbounds:[]},video:{inbounds:[],outbounds:[]},raw:e};var r,n=B(e.values());try{for(n.s();!(r=n.n()).done;){const e=r.value;switch(e.type){case"outbound-rtp":lu(e,this.previousStats,t);break;case"inbound-rtp":du(e,this.previousStats,t);break;case"candidate-pair":e.nominated&&fu(e,t)}}}catch(e){n.e(e)}finally{n.f()}this.stats=t}stop(){uu.info("Stopping peer connection stats"),clearInterval(this.emitInterval)}}const lu=(e,t,r)=>{var n,i;const o=pu(e),s=hu(e.codecId,r.raw),a=mu(e,o);a.totalBytesSent=e.bytesSent,a.id=e.id,a.mid=e.mid;const c=t?null!==(n=null===(i=t[o].outbounds.find(e=>e.id===a.id))||void 0===i?void 0:i.totalBytesSent)&&void 0!==n?n:0:null;a.bitrate=c?8*(e.bytesSent-c):0,"video"===o&&(a.qualityLimitationReason=e.qualityLimitationReason),r[o].outbounds.push(O(O({},s),a))},du=(e,t,r)=>{let n=pu(e);const i=hu(e.codecId,r.raw);["audio","video"].includes(n)||(n=e.id.includes("Video")?"video":"audio");const o=mu(e,n);if(o.totalBytesReceived=e.bytesReceived,o.totalPacketsReceived=e.packetsReceived,o.totalPacketsLost=e.packetsLost,o.jitter=e.jitter,o.id=e.id,o.mid=e.mid,o.bitrate=0,o.packetsLostRatioPerSecond=0,o.packetsLostDeltaPerSecond=0,t){const r=t[n].inbounds.find(e=>e.id===o.id);if(r){const t=r.totalBytesReceived;o.bitrate=8*(e.bytesReceived-t),o.packetsLostRatioPerSecond=gu(o,r),o.packetsLostDeltaPerSecond=vu(o,r)}}r[n].inbounds.push(O(O({},i),o))},fu=(e,t)=>{t.totalRoundTripTime=e.totalRoundTripTime,t.currentRoundTripTime=e.currentRoundTripTime,t.availableOutgoingBitrate=e.availableOutgoingBitrate,t.candidateType=t.raw.get(e.localCandidateId).candidateType},pu=e=>e.mediaType||e.kind,hu=(e,t)=>{var r;return{mimeType:(e&&null!==(r=t.get(e))&&void 0!==r?r:{}).mimeType}},mu=(e,t)=>{const r={};return"video"===t&&(r.framesPerSecond=e.framesPerSecond,r.frameHeight=e.frameHeight,r.frameWidth=e.frameWidth),r.timestamp=e.timestamp,r},gu=(e,t)=>vu(e,t)/(e.totalPacketsReceived-t.totalPacketsReceived),vu=(e,t)=>e.totalPacketsLost-t.totalPacketsLost;var yu=function(e,t,r,n){try{return n?t(gt(r)[0],r[1]):t(r)}catch(t){Mo(e,"throw",t)}},wu=Array,bu=!$o((function(e){Array.from(e)}));Cr({target:"Array",stat:!0,forced:bu},{from:function(e){var t=qe(e),r=Fr(this),n=arguments.length,i=n>1?arguments[1]:void 0,o=void 0!==i;o&&(i=nn(i,n>2?arguments[2]:void 0));var s,a,c,u,l,d,f=Oo(t),p=0;if(!f||this===wu&&Ao(f))for(s=tr(t),a=r?new this(s):wu(s);s>p;p++)d=o?i(t[p],p):t[p],Ir(a,p,d);else for(l=(u=Do(t,f)).next,a=r?new this:[];!(c=K(l,u)).done;p++)d=o?yu(u,i,[c.value,p],!0):c.value,Ir(a,p,d);return a.length=p,a}});var Su=Math.floor,Cu=oe("".charAt),xu=oe("".replace),Eu=oe("".slice),Tu=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,Iu=/\$([$&'`]|\d{1,2})/g,Ru=function(e,t,r,n,i,o){var s=r+e.length,a=n.length,c=Iu;return void 0!==i&&(i=qe(i),c=Tu),xu(o,c,(function(o,c){var u;switch(Cu(c,0)){case"$":return"$";case"&":return e;case"`":return Eu(t,0,r);case"'":return Eu(t,s);case"<":u=i[Eu(c,1,-1)];break;default:var l=+c;if(0===l)return o;if(l>a){var d=Su(l/10);return 0===d?o:d<=a?void 0===n[d-1]?Cu(c,1):n[d-1]+Cu(c,1):o}u=n[l-1]}return void 0===u?"":u}))},Pu=nt("replace"),Au=Math.max,ku=Math.min,Ou=oe([].concat),Lu=oe([].push),Du=oe("".indexOf),Mu=oe("".slice),Nu="$0"==="a".replace(/./,"$0"),ju=!!/./[Pu]&&""===/./[Pu]("a","$0");Ra("replace",(function(e,t,r){var n=ju?"$":"$0";return[function(e,r){var n=he(this),i=fe(e)?void 0:Ue(e,Pu);return i?K(i,e,n,r):K(t,Zo(n),e,r)},function(e,i){var o=gt(this),s=Zo(e);if("string"==typeof i&&-1===Du(i,n)&&-1===Du(i,"$<")){var a=r(t,o,s,i);if(a.done)return a.value}var c=we(i);c||(i=Zo(i));var u=o.global;if(u){var l=o.unicode;o.lastIndex=0}for(var d=[];;){var f=Na(o,s);if(null===f)break;if(Lu(d,f),!u)break;""===Zo(f[0])&&(o.lastIndex=Da(s,er(o.lastIndex),l))}for(var p,h="",m=0,g=0;g<d.length;g++){for(var v=Zo((f=d[g])[0]),y=Au(ku(Yt(f.index),s.length),0),w=[],E=1;E<f.length;E++)Lu(w,void 0===(p=f[E])?p:String(p));var T=f.groups;if(c){var I=Ou([v],w,y,s);void 0!==T&&Lu(I,T);var R=Zo(pn(i,void 0,I))}else R=Ru(v,s,y,w,T,i);y>=m&&(h+=Mu(s,m,y)+R,m=y+v.length)}return h+Mu(s,m)}]}),!!q((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}))||!Nu||ju);var _u=an.filter,Bu=qr("filter");Cr({target:"Array",proto:!0,forced:!Bu},{filter:function(e){return _u(this,e,arguments.length>1?arguments[1]:void 0)}});var Uu,Vu="\t\n\v\f\r \u2028\u2029\ufeff",Fu=oe("".replace),zu="["+Vu+"]",$u=RegExp("^"+zu+zu+"*"),Gu=RegExp(zu+zu+"*$"),Wu=function(e){return function(t){var r=Zo(he(t));return 1&e&&(r=Fu(r,$u,"")),2&e&&(r=Fu(r,Gu,"")),r}},qu={start:Wu(1),end:Wu(2),trim:Wu(3)},Hu=Tt.PROPER,Xu=qu.trim;Cr({target:"String",proto:!0,forced:(Uu="trim",q((function(){return!!Vu[Uu]()||"
"!=="
"[Uu]()||Hu&&Vu[Uu].name!==Uu})))},{trim:function(){return Xu(this)}});var Yu=nt("matchAll"),Ju=$t.set,Zu=$t.getterFor("RegExp String Iterator"),el=RegExp.prototype,rl=TypeError,nl=oe("".indexOf),il=oe("".matchAll),ol=!!il&&!q((function(){il("a",/./)})),al=Za((function(e,t,r,n){Ju(this,{type:"RegExp String Iterator",regexp:e,string:t,global:r,unicode:n,done:!1})}),"RegExp String",(function(){var e=Zu(this);if(e.done)return ac(void 0,!0);var t=e.regexp,r=e.string,n=Na(t,r);return null===n?(e.done=!0,ac(void 0,!0)):e.global?(""===Zo(n[0])&&(t.lastIndex=Da(r,er(t.lastIndex),e.unicode)),ac(n,!1)):(e.done=!0,ac(n,!1))}));Cr({target:"String",proto:!0,forced:ol},{matchAll:function(e){var t,r,n,i=he(this);if(fe(e)){if(ol)return il(i,e)}else{if(ms(e)&&(t=Zo(he(ys(e))),!~nl(t,"g")))throw rl("`.matchAll` does not allow non-global regexes");if(ol)return il(i,e);if(n=Ue(e,Yu))return K(n,e,i)}return r=Zo(i),new RegExp(e,"g")[Yu](r)}}),Yu in el||Wt(el,Yu,(function(e){var t,r,n,i=gt(this),o=Zo(e),s=ei(i,RegExp),a=Zo(ys(i));return t=new s(s===RegExp?i.source:i,a),r=!!~nl(a,"g"),n=!!~nl(a,"u"),t.lastIndex=er(i.lastIndex),new al(t,o,r,n)}));var ul=oe([].reverse),ll=[1,2];Cr({target:"Array",proto:!0,forced:String(ll)===String(ll.reverse())},{reverse:function(){return xr(this)&&(this.length=this.length),ul(this)}});var dl=V((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")+(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":"")+(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")}))}))})),fl=V((function(e,t){var r=function(e){return String(Number(e))===e?Number(e):e},n=function(e,t,n){var i=e.name&&e.names;e.push&&!t[e.push]?t[e.push]=[]:i&&!t[e.name]&&(t[e.name]={});var o=e.push?{}:i?t[e.name]:t;!function(e,t,n,i){if(i&&!n)t[i]=r(e[1]);else for(var o=0;o<n.length;o+=1)null!=e[o+1]&&(t[n[o]]=r(e[o+1]))}(n.match(e.reg),o,e.names,e.name),e.push&&t[e.push].push(o)},i=RegExp.prototype.test.bind(/^([a-z])=(.*)/);t.parse=function(e){var t={},r=[],o=t;return e.split(/(\r\n|\r|\n)/).filter(i).forEach((function(e){var t=e[0],i=e.slice(2);"m"===t&&(r.push({rtp:[],fmtp:[]}),o=r[r.length-1]);for(var s=0;s<(dl[t]||[]).length;s+=1){var a=dl[t][s];if(a.reg.test(i))return n(a,o,i)}})),t.media=r,t};var o=function(e,t){var n=t.split(/=(.+)/,2);return 2===n.length?e[n[0]]=r(n[1]):1===n.length&&t.length>1&&(e[n[0]]=void 0),e};t.parseParams=function(e){return e.split(/;\s?/).reduce(o,{})},t.parseFmtpConfig=t.parseParams,t.parsePayloads=function(e){return e.toString().split(" ").map(Number)},t.parseRemoteCandidates=function(e){for(var t=[],n=e.split(" ").map(r),i=0;i<n.length;i+=3)t.push({component:n[i],ip:n[i+1],port:n[i+2]});return t},t.parseImageAttributes=function(e){return e.split(" ").map((function(e){return e.substring(1,e.length-1).split(",").reduce(o,{})}))},t.parseSimulcastStreamList=function(e){return e.split(";").map((function(e){return e.split(",").map((function(e){var t,n=!1;return"~"!==e[0]?t=r(e):(t=r(e.substring(1,e.length)),n=!0),{scid:t,paused:n}}))}))}})),pl=/%[sdv%]/g,hl=function(e){var t=1,r=arguments,n=r.length;return e.replace(pl,(function(e){if(t>=n)return e;var i=r[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(i);case"%d":return Number(i);case"%v":return""}}))},ml=function(e,t,r){var n=[e+"="+(t.format instanceof Function?t.format(t.push?r:r[t.name]):t.format)];if(t.names)for(var i=0;i<t.names.length;i+=1){var o=t.names[i];t.name?n.push(r[t.name][o]):n.push(r[t.names[i]])}else n.push(r[t.name]);return hl.apply(null,n)},gl=["v","o","s","i","u","e","p","c","b","t","r","z","a"],vl=["i","c","b","a"],yl={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 r=t.outerOrder||gl,n=t.innerOrder||vl,i=[];return r.forEach((function(t){dl[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(ml(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(ml(t,r,e))}))}))})),e.media.forEach((function(e){i.push(ml("m",dl.m[0],e)),n.forEach((function(t){dl[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(ml(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(ml(t,r,e))}))}))}))})),i.join("\r\n")+"\r\n"},parse:fl.parse,parseParams:fl.parseParams,parseFmtpConfig:fl.parseFmtpConfig,parsePayloads:fl.parsePayloads,parseRemoteCandidates:fl.parseRemoteCandidates,parseImageAttributes:fl.parseImageAttributes,parseSimulcastStreamList:fl.parseSimulcastStreamList};class Ku{constructor(e,t,r,n,i,o,s,a,c){this.foundation=e,this.componentId=t,this.transport=r,this.priority=n,this.address=i,this.port=o,this.type=s,this.relAddr=a,this.relPort=c}equals(e){return e.foundation===this.foundation&&e.componentId===this.componentId&&e.transport===this.transport&&e.priority===this.priority&&e.address===this.address&&e.port===this.port&&e.type===this.type&&e.relAddr===this.relAddr&&e.relPort===this.relPort}clone(){return new Ku(this.foundation,this.componentId,this.transport,this.priority,this.address,this.port,this.type,this.relAddr,this.relPort)}plain(){const e={foundation:this.foundation,componentId:this.componentId,transport:this.transport,priority:this.priority,address:this.address,port:this.port,type:this.type};return this.relAddr&&(e.relAddr=this.relAddr),this.relPort&&(e.relPort=this.relPort),e}getFoundation(){return this.foundation}getComponentId(){return this.componentId}getTransport(){return this.transport}getPriority(){return this.priority}getAddress(){return this.address}getPort(){return this.port}getType(){return this.type}getRelAddr(){return this.relAddr}getRelPort(){return this.relPort}}Ku.expand=function(e){return new Ku(e.foundation,e.componentId,e.transport,e.priority,e.address,e.port,e.type,e.relAddr,e.relPort)};var wl=Ku;class Qu{constructor(e,t){this.id=e,this.params=t||[]}clone(){return new Qu(this.id,this.params)}plain(){return this.params.length?{id:this.id,params:this.params}:{id:this.id}}getId(){return this.id}getParams(){return this.params}}Qu.expand=function(e){return new Qu(e.id,e.params)};var bl=Qu;class tl{constructor(e,t,r){this.codec=e,this.type=t,this.params={},this.rtcpfbs=new Set,r&&this.addParams(r)}clone(){const e=new tl(this.codec,this.type,this.params);this.hasRTX()&&e.setRTX(this.getRTX());for(const t of this.rtcpfbs)e.addRTCPFeedback(t.clone());return this.hasChannels()&&e.setChannels(this.getChannels()),e}plain(){const e={codec:this.codec,type:this.type};this.rtx&&(e.rtx=this.rtx),this.channels&&(e.channels=this.channels),Object.keys(this.params).length&&(e.params=this.params);for(const t of this.rtcpfbs)e.rtcpfbs||(e.rtcpfbs=[]),e.rtcpfbs.push(t.plain());return e}setRTX(e){this.rtx=e}getType(){return this.type}setType(e){this.type=e}getCodec(){return this.codec}getParams(){return this.params}addParams(e){for(const t in e)this.params[t]=e[t]}addParam(e,t){this.params[e]=t}hasParam(e){return this.params.hasOwnProperty(e)}getParam(e,t){return this.hasParam(e)?this.params[e]:""+t}hasRTX(){return this.rtx}getRTX(){return this.rtx}hasChannels(){return this.channels}getChannels(){return this.channels}setChannels(e){this.channels=e}addRTCPFeedback(e){this.rtcpfbs.add(e)}getRTCPFeedbacks(){return this.rtcpfbs}}tl.expand=function(e){const t=new tl(e.codec,e.type,e.params);e.rtx&&t.setRTX(e.rtx),e.channels&&t.setChannels(e.channels);for(let r=0;e.rtcpfbs&&r<e.rtcpfbs.length;++r){const n=bl.expand(e.rtcpfbs[r]);t.addRTCPFeedback(n)}return t},tl.MapFromNames=function(e,t,r){const n=new Map;let i=96;for(let o=0;o<e.length;++o){let s;const a=e[o].split(";"),c=a[0].toLowerCase().trim();s="pcmu"===c?0:"pcma"===c?8:++i;const u=new tl(c,s);"opus"===c?u.setChannels(2):"multiopus"===c&&u.setChannels(6),t&&"ulpfec"!==c&&"flexfec-03"!==c&&"red"!==c&&u.setRTX(++i);for(let e=0;r&&e<r.length;++e)u.addRTCPFeedback(new bl(r[e].id,r[e].params));for(let e=1;e<a.length;++e){let t=a[e].split("=");u.addParam(t[0].trim(),t[1].trim())}n.set(u.getCodec().toLowerCase(),u)}return n};var Sl=tl,Cl=function e(){var t=this;if(!(this instanceof e))return new(Function.prototype.bind.apply(e,[null].concat(Array.prototype.slice.call(arguments))));Array.from(arguments).forEach((function(e){t[e]=Symbol.for("MEDOOZE_SEMANTIC_SDP_"+e)}))};const xl=Cl("ACTIVE","PASSIVE","ACTPASS","INACTIVE");xl.byValue=function(e){switch(e){case xl.ACTIVE:case xl.PASSIVE:case xl.ACTPASS:case xl.INACTIVE:return e}return xl[e.toUpperCase()]},xl.toString=function(e){switch(e){case xl.ACTIVE:return"active";case xl.PASSIVE:return"passive";case xl.ACTPASS:return"actpass";case xl.INACTIVE:return"inactive"}},xl.reverse=function(e){switch(e){case xl.ACTIVE:return xl.PASSIVE;case xl.PASSIVE:return xl.ACTIVE;case xl.ACTPASS:return xl.PASSIVE;case xl.INACTIVE:return xl.INACTIVE}};var El=xl;class sl{constructor(e,t,r){this.setup=e,this.hash=t,this.fingerprint=r}clone(){return new sl(this.setup,this.hash,this.fingerprint)}plain(){return{setup:El.toString(this.setup),hash:this.hash,fingerprint:this.fingerprint}}getFingerprint(){return this.fingerprint}getHash(){return this.hash}getSetup(){return this.setup}setSetup(e){this.setup=e}}sl.expand=function(e){return new sl(e.setup?El.byValue(e.setup):El.ACTPASS,e.hash,e.fingerprint)};var Tl=sl;class cl{constructor(e,t,r,n){this.tag=e,this.suite=t,this.keyParams=r,this.sessionParams=n}clone(){return new cl(this.tag,this.suite,this.keyParams,this.sessionParams)}plain(){return{tag:this.tag,suite:this.suite,keyParams:this.keyParams,sessionParams:this.sessionParams}}getSessionParams(){return this.sessionParams}getKeyParams(){return this.keyParams}getSuite(){return this.suite}getTag(){return this.tag}}cl.expand=function(e){return new cl(e.tag,e.suite,e.keyParams,e.sessionParams)};for(var Il=cl,Pl=[],Al=[],kl="undefined"!=typeof Uint8Array?Uint8Array:Array,Ll="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ml=0,jl=Ll.length;Ml<jl;++Ml)Pl[Ml]=Ll[Ml],Al[Ll.charCodeAt(Ml)]=Ml;function _l(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function Bl(e,t,r){for(var n,i,o=[],s=t;s<r;s+=3)n=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+2]),o.push(Pl[(i=n)>>18&63]+Pl[i>>12&63]+Pl[i>>6&63]+Pl[63&i]);return o.join("")}Al["-".charCodeAt(0)]=62,Al["_".charCodeAt(0)]=63;var Fl=function(e){var t,r,n=_l(e),i=n[0],o=n[1],s=new kl(function(e,t,r){return 3*(t+r)/4-r}(0,i,o)),a=0,c=o>0?i-4:i;for(r=0;r<c;r+=4)t=Al[e.charCodeAt(r)]<<18|Al[e.charCodeAt(r+1)]<<12|Al[e.charCodeAt(r+2)]<<6|Al[e.charCodeAt(r+3)],s[a++]=t>>16&255,s[a++]=t>>8&255,s[a++]=255&t;return 2===o&&(t=Al[e.charCodeAt(r)]<<2|Al[e.charCodeAt(r+1)]>>4,s[a++]=255&t),1===o&&(t=Al[e.charCodeAt(r)]<<10|Al[e.charCodeAt(r+1)]<<4|Al[e.charCodeAt(r+2)]>>2,s[a++]=t>>8&255,s[a++]=255&t),s},zl=function(e){for(var t,r=e.length,n=r%3,i=[],o=16383,s=0,a=r-n;s<a;s+=o)i.push(Bl(e,s,s+o>a?a:s+o));return 1===n?(t=e[r-1],i.push(Pl[t>>2]+Pl[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],i.push(Pl[t>>10]+Pl[t>>4&63]+Pl[t<<2&63]+"=")),i.join("")},Gl=function(e,t,r,n,i){var o,s,a=8*i-n-1,c=(1<<a)-1,u=c>>1,l=-7,d=r?i-1:0,f=r?-1:1,p=e[t+d];for(d+=f,o=p&(1<<-l)-1,p>>=-l,l+=a;l>0;o=256*o+e[t+d],d+=f,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=n;l>0;s=256*s+e[t+d],d+=f,l-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),o-=u}return(p?-1:1)*s*Math.pow(2,o-n)},Wl=function(e,t,r,n,i,o){var s,a,c,u=8*o-i-1,l=(1<<u)-1,d=l>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,h=n?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+d>=1?f/c:f*Math.pow(2,1-d))*c>=2&&(s++,c/=2),s+d>=l?(a=0,s=l):s+d>=1?(a=(t*c-1)*Math.pow(2,i),s+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,i),s=0));i>=8;e[r+p]=255&a,p+=h,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;e[r+p]=255&s,p+=h,s/=256,u-=8);e[r+p-h]|=128*m},Hl=V((function(e,t){const r="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=o,t.SlowBuffer=function(e){return+e!=e&&(e=0),o.alloc(+e)},t.INSPECT_MAX_BYTES=50;const n=2147483647;function i(e){if(e>n)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,o.prototype),t}function o(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return c(e)}return s(e,t,r)}function s(e,t,r){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!o.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|f(e,t);let n=i(r);const s=n.write(e,t);return s!==r&&(n=n.slice(0,s)),n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(K(e,Uint8Array)){const t=new Uint8Array(e);return l(t.buffer,t.byteOffset,t.byteLength)}return u(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(K(e,ArrayBuffer)||e&&K(e.buffer,ArrayBuffer))return l(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(K(e,SharedArrayBuffer)||e&&K(e.buffer,SharedArrayBuffer)))return l(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return o.from(n,t,r);const s=function(e){if(o.isBuffer(e)){const t=0|d(e.length),r=i(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||Q(e.length)?i(0):u(e):"Buffer"===e.type&&Array.isArray(e.data)?u(e.data):void 0}(e);if(s)return s;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return o.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function a(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function c(e){return a(e),i(e<0?0:0|d(e))}function u(e){const t=e.length<0?0:0|d(e.length),r=i(t);for(let n=0;n<t;n+=1)r[n]=255&e[n];return r}function l(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),Object.setPrototypeOf(n,o.prototype),n}function d(e){if(e>=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return 0|e}function f(e,t){if(o.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||K(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return H(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return X(e).length;default:if(i)return n?-1:H(e).length;t=(""+t).toLowerCase(),i=!0}}function p(e,t,r){let n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return O(this,t,r);case"utf8":case"utf-8":return R(this,t,r);case"ascii":return A(this,t,r);case"latin1":case"binary":return k(this,t,r);case"base64":return I(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function h(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function m(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),Q(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=o.from(t,n)),o.isBuffer(t))return 0===t.length?-1:g(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):g(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function g(e,t,r,n,i){let o,s=1,a=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,r/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){let n=-1;for(o=r;o<a;o++)if(u(e,o)===u(t,-1===n?0:o-n)){if(-1===n&&(n=o),o-n+1===c)return n*s}else-1!==n&&(o-=o-n),n=-1}else for(r+c>a&&(r=a-c),o=r;o>=0;o--){let r=!0;for(let n=0;n<c;n++)if(u(e,o+n)!==u(t,n)){r=!1;break}if(r)return o}return-1}function v(e,t,r,n){r=Number(r)||0;const i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;const o=t.length;let s;for(n>o/2&&(n=o/2),s=0;s<n;++s){const n=parseInt(t.substr(2*s,2),16);if(Q(n))return s;e[r+s]=n}return s}function y(e,t,r,n){return Y(H(t,e.length-r),e,r,n)}function w(e,t,r,n){return Y(function(e){const t=[];for(let r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function E(e,t,r,n){return Y(X(t),e,r,n)}function T(e,t,r,n){return Y(function(e,t){let r,n,i;const o=[];for(let s=0;s<e.length&&!((t-=2)<0);++s)r=e.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function I(e,t,r){return 0===t&&r===e.length?zl(e):zl(e.slice(t,r))}function R(e,t,r){r=Math.min(e.length,r);const n=[];let i=t;for(;i<r;){const t=e[i];let o=null,s=t>239?4:t>223?3:t>191?2:1;if(i+s<=r){let r,n,a,c;switch(s){case 1:t<128&&(o=t);break;case 2:r=e[i+1],128==(192&r)&&(c=(31&t)<<6|63&r,c>127&&(o=c));break;case 3:r=e[i+1],n=e[i+2],128==(192&r)&&128==(192&n)&&(c=(15&t)<<12|(63&r)<<6|63&n,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:r=e[i+1],n=e[i+2],a=e[i+3],128==(192&r)&&128==(192&n)&&128==(192&a)&&(c=(15&t)<<18|(63&r)<<12|(63&n)<<6|63&a,c>65535&&c<1114112&&(o=c))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=s}return function(e){const t=e.length;if(t<=P)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=P));return r}(n)}t.kMaxLength=n,o.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),o.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}}),o.poolSize=8192,o.from=function(e,t,r){return s(e,t,r)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array),o.alloc=function(e,t,r){return function(e,t,r){return a(e),e<=0?i(e):void 0!==t?"string"==typeof r?i(e).fill(t,r):i(e).fill(t):i(e)}(e,t,r)},o.allocUnsafe=function(e){return c(e)},o.allocUnsafeSlow=function(e){return c(e)},o.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==o.prototype},o.compare=function(e,t){if(K(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),K(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(e)||!o.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let r=e.length,n=t.length;for(let i=0,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},o.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return o.alloc(0);let r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;const n=o.allocUnsafe(t);let i=0;for(r=0;r<e.length;++r){let t=e[r];if(K(t,Uint8Array))i+t.length>n.length?(o.isBuffer(t)||(t=o.from(t)),t.copy(n,i)):Uint8Array.prototype.set.call(n,t,i);else{if(!o.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(n,i)}i+=t.length}return n},o.byteLength=f,o.prototype._isBuffer=!0,o.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)h(this,t,t+1);return this},o.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)h(this,t,t+3),h(this,t+1,t+2);return this},o.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)h(this,t,t+7),h(this,t+1,t+6),h(this,t+2,t+5),h(this,t+3,t+4);return this},o.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?R(this,0,e):p.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(e){if(!o.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===o.compare(this,e)},o.prototype.inspect=function(){let e="";const r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},r&&(o.prototype[r]=o.prototype.inspect),o.prototype.compare=function(e,t,r,n,i){if(K(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),!o.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;let s=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(t>>>=0);const c=Math.min(s,a),u=this.slice(n,i),l=e.slice(t,r);for(let e=0;e<c;++e)if(u[e]!==l[e]){s=u[e],a=l[e];break}return s<a?-1:a<s?1:0},o.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},o.prototype.indexOf=function(e,t,r){return m(this,e,t,r,!0)},o.prototype.lastIndexOf=function(e,t,r){return m(this,e,t,r,!1)},o.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return v(this,e,t,r);case"utf8":case"utf-8":return y(this,e,t,r);case"ascii":case"latin1":case"binary":return w(this,e,t,r);case"base64":return E(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const P=4096;function A(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function k(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function O(e,t,r){const n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);let i="";for(let n=t;n<r;++n)i+=J[e[n]];return i}function L(e,t,r){const n=e.slice(t,r);let i="";for(let e=0;e<n.length-1;e+=2)i+=String.fromCharCode(n[e]+256*n[e+1]);return i}function D(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function M(e,t,r,n,i,s){if(!o.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<s)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function N(e,t,r,n,i){$(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,r}function j(e,t,r,n,i){$(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r+7]=o,o>>=8,e[r+6]=o,o>>=8,e[r+5]=o,o>>=8,e[r+4]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=s,s>>=8,e[r+2]=s,s>>=8,e[r+1]=s,s>>=8,e[r]=s,r+8}function _(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function B(e,t,r,n,i){return t=+t,r>>>=0,i||_(e,0,r,4),Wl(e,t,r,n,23,4),r+4}function U(e,t,r,n,i){return t=+t,r>>>=0,i||_(e,0,r,8),Wl(e,t,r,n,52,8),r+8}o.prototype.slice=function(e,t){const r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);const n=this.subarray(e,t);return Object.setPrototypeOf(n,o.prototype),n},o.prototype.readUintLE=o.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||D(e,t,this.length);let n=this[e],i=1,o=0;for(;++o<t&&(i*=256);)n+=this[e+o]*i;return n},o.prototype.readUintBE=o.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||D(e,t,this.length);let n=this[e+--t],i=1;for(;t>0&&(i*=256);)n+=this[e+--t]*i;return n},o.prototype.readUint8=o.prototype.readUInt8=function(e,t){return e>>>=0,t||D(e,1,this.length),this[e]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(e,t){return e>>>=0,t||D(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(e,t){return e>>>=0,t||D(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(e,t){return e>>>=0,t||D(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(e,t){return e>>>=0,t||D(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readBigUInt64LE=Z((function(e){G(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||W(e,this.length-8);const n=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(n)+(BigInt(i)<<BigInt(32))})),o.prototype.readBigUInt64BE=Z((function(e){G(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||W(e,this.length-8);const n=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(n)<<BigInt(32))+BigInt(i)})),o.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||D(e,t,this.length);let n=this[e],i=1,o=0;for(;++o<t&&(i*=256);)n+=this[e+o]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*t)),n},o.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||D(e,t,this.length);let n=t,i=1,o=this[e+--n];for(;n>0&&(i*=256);)o+=this[e+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},o.prototype.readInt8=function(e,t){return e>>>=0,t||D(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},o.prototype.readInt16LE=function(e,t){e>>>=0,t||D(e,2,this.length);const r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt16BE=function(e,t){e>>>=0,t||D(e,2,this.length);const r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt32LE=function(e,t){return e>>>=0,t||D(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return e>>>=0,t||D(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readBigInt64LE=Z((function(e){G(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||W(e,this.length-8);const n=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),o.prototype.readBigInt64BE=Z((function(e){G(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||W(e,this.length-8);const n=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(n)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+r)})),o.prototype.readFloatLE=function(e,t){return e>>>=0,t||D(e,4,this.length),Gl(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return e>>>=0,t||D(e,4,this.length),Gl(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return e>>>=0,t||D(e,8,this.length),Gl(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return e>>>=0,t||D(e,8,this.length),Gl(this,e,!1,52,8)},o.prototype.writeUintLE=o.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||M(this,e,t,r,Math.pow(2,8*r)-1,0);let i=1,o=0;for(this[t]=255&e;++o<r&&(i*=256);)this[t+o]=e/i&255;return t+r},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||M(this,e,t,r,Math.pow(2,8*r)-1,0);let i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},o.prototype.writeUint8=o.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,1,255,0),this[t]=255&e,t+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeBigUInt64LE=Z((function(e,t=0){return N(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),o.prototype.writeBigUInt64BE=Z((function(e,t=0){return j(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),o.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);M(this,e,t,r,n-1,-n)}let i=0,o=1,s=0;for(this[t]=255&e;++i<r&&(o*=256);)e<0&&0===s&&0!==this[t+i-1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+r},o.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);M(this,e,t,r,n-1,-n)}let i=r-1,o=1,s=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+r},o.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},o.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeBigInt64LE=Z((function(e,t=0){return N(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),o.prototype.writeBigInt64BE=Z((function(e,t=0){return j(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),o.prototype.writeFloatLE=function(e,t,r){return B(this,e,t,!0,r)},o.prototype.writeFloatBE=function(e,t,r){return B(this,e,t,!1,r)},o.prototype.writeDoubleLE=function(e,t,r){return U(this,e,t,!0,r)},o.prototype.writeDoubleBE=function(e,t,r){return U(this,e,t,!1,r)},o.prototype.copy=function(e,t,r,n){if(!o.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);const i=n-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,n):Uint8Array.prototype.set.call(e,this.subarray(r,n),t),i},o.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!o.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){const t=e.charCodeAt(0);("utf8"===n&&t<128||"latin1"===n)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;let i;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{const s=o.isBuffer(e)?e:o.from(e,n),a=s.length;if(0===a)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=s[i%a]}return this};const V={};function F(e,t,r){V[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function z(e){let t="",r=e.length;const n="-"===e[0]?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function $(e,t,r,n,i,o){if(e>r||e<t){const n="bigint"==typeof t?"n":"";let i;throw i=o>3?0===t||t===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(o+1)}${n}`:`>= -(2${n} ** ${8*(o+1)-1}${n}) and < 2 ** ${8*(o+1)-1}${n}`:`>= ${t}${n} and <= ${r}${n}`,new V.ERR_OUT_OF_RANGE("value",i,e)}!function(e,t,r){G(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||W(t,e.length-(r+1))}(n,i,o)}function G(e,t){if("number"!=typeof e)throw new V.ERR_INVALID_ARG_TYPE(t,"number",e)}function W(e,t,r){if(Math.floor(e)!==e)throw G(e,r),new V.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new V.ERR_BUFFER_OUT_OF_BOUNDS;throw new V.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}F("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?e+" is outside of buffer bounds":"Attempt to access memory outside buffer bounds"}),RangeError),F("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),F("ERR_OUT_OF_RANGE",(function(e,t,r){let n=`The value of "${e}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=z(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=z(i)),i+="n"),n+=` It must be ${t}. Received ${i}`,n}),RangeError);const q=/[^+/0-9A-Za-z-_]/g;function H(e,t){let r;t=t||1/0;const n=e.length;let i=null;const o=[];for(let s=0;s<n;++s){if(r=e.charCodeAt(s),r>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function X(e){return Fl(function(e){if((e=(e=e.split("=")[0]).trim().replace(q,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Y(e,t,r,n){let i;for(i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function K(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Q(e){return e!=e}const J=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let i=0;i<16;++i)t[n+i]=e[r]+e[i]}return t}();function Z(e){return"undefined"==typeof BigInt?ee:e}function ee(){throw new Error("BigInt not supported")}})),Jl=V((function(e,t){var r=Hl.Buffer;function n(e,t){for(var r in e)t[r]=e[r]}function i(e,t,n){return r(e,t,n)}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?e.exports=Hl:(n(Hl,t),t.Buffer=i),i.prototype=Object.create(r.prototype),n(r,i),i.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return r(e,t,n)},i.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=r(e);return void 0!==t?"string"==typeof n?i.fill(t,n):i.fill(t):i.fill(0),i},i.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r(e)},i.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return Hl.SlowBuffer(e)}})),Zl=V((function(e){var t=65536,r=Jl.Buffer,n=U.crypto||U.msCrypto;n&&n.getRandomValues?e.exports=function(e,i){if(e>4294967295)throw new RangeError("requested too many random bytes");var o=r.allocUnsafe(e);if(e>0)if(e>t)for(var s=0;s<e;s+=t)n.getRandomValues(o.slice(s,s+t));else n.getRandomValues(o);return"function"==typeof i?A.nextTick((function(){i(null,o)})):o}:e.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}}));class Rl{constructor(e,t){this.ufrag=e,this.pwd=t,this.lite=!1,this.endOfCandidates=!1}clone(){const e=new Rl(this.ufrag,this.pwd);return e.setLite(this.lite),e.setEndOfCandidates(this.endOfCandidates),e}plain(){const e={ufrag:this.ufrag,pwd:this.pwd};return this.lite&&(e.lite=this.lite),this.endOfCandidates&&(e.endOfCandidates=this.endOfCandidates),e}getUfrag(){return this.ufrag}getPwd(){return this.pwd}isLite(){return this.lite}setLite(e){this.lite=e}isEndOfCandidates(){return this.endOfCandidates}setEndOfCandidates(e){this.endOfCandidates=e}}Rl.generate=function(e){const t=new Rl,r=Zl(8),n=Zl(24);return t.ufrag=r.toString("hex"),t.pwd=n.toString("hex"),t.lite=e,t},Rl.expand=function(e){const t=new Rl(e.ufrag,e.pwd);return t.setLite(e.lite),t.setEndOfCandidates(e.endOfCandidates),t};var ed=Rl;const td=Cl("SEND","RECV");td.byValue=function(e){return td[e.toUpperCase()]},td.toString=function(e){switch(e){case td.SEND:return"send";case td.RECV:return"recv"}},td.reverse=function(e){switch(e){case td.SEND:return td.RECV;case td.RECV:return td.SEND}};var rd=td;class Ol{constructor(e,t){this.id=e,this.direction=t,this.formats=[],this.params=new Map}clone(){var e=new Ol(this.id,this.direction);return e.setFormats(this.formats),e.setParams(this.params),e}plain(){var e={id:this.id,direction:rd.toString(this.direction)};for(var[t,r]of(this.formats&&(e.formats=this.formats),this.params.entries()))e.params||(e.params={}),e.params[t]=r;return e}getId(){return this.id}getDirection(){return this.direction}setDirection(e){this.direction=e}getFormats(){return this.formats}setFormats(e){this.formats=[];for(let t=0;t<e.length;++t)this.formats.push(parseInt(e[t]))}getParams(){return this.params}setParams(e){this.params=new Map(e)}addParam(e,t){this.params.set(e,t)}getDirection(){return this.direction}setDirection(e){this.direction=e}}Ol.expand=function(e){const t=new Ol(e.id,rd.byValue(e.direction));for(let r in e.params)t.addParam(r,e.params[r]);return e.formats&&t.setFormats(e.formats),t};var nd=Ol;class Dl{constructor(e,t){this.paused=t,this.id=e}clone(){return new Dl(this.id,this.paused)}plain(){return{id:this.id,paused:this.paused}}isPaused(){return this.paused}getId(){return this.id}}Dl.expand=function(e){return new Dl(e.id,e.paused)};var id=Dl;class Nl{constructor(){this.send=[],this.recv=[]}clone(){const e=new Nl;for(let t=0;t<this.send.length;++t){let r=[];for(let e=0;t<this.send[e].length;++t)r.push(this.send[t][e].clone());e.addSimulcastAlternativeStreams(rd.SEND,r)}for(let t=0;t<this.recv.length;++t){let r=[];for(let e=0;t<this.recv[e].length;++t)r.push(this.recv[t][e].clone());e.addSimulcastAlternativeStreams(rd.RECV,r)}return e}plain(){const e={send:[],recv:[]};for(let t=0;t<this.send.length;++t){let r=[];for(let e=0;e<this.send[t].length;++e)r.push(this.send[t][e].plain());e.send.push(r)}for(let t=0;t<this.recv.length;++t){let r=[];for(let e=0;e<this.recv[t].length;++e)r.push(this.recv[t][e].plain());e.recv.push(r)}return e}addSimulcastAlternativeStreams(e,t){return e===rd.SEND?this.send.push(t):this.recv.push(t)}addSimulcastStream(e,t){return e===rd.SEND?this.send.push([t]):this.recv.push([t])}getSimulcastStreams(e){return e===rd.SEND?this.send:this.recv}}Nl.expand=function(e){const t=new Nl;for(let r=0;r<e.send.length;++r){let n=[];for(let t=0;t<e.send[r].length;++t)n.push(id.expand(e.send[r][t]));t.addSimulcastAlternativeStreams(rd.SEND,n)}for(let r=0;r<e.recv.length;++r){let n=[];for(let t=0;t<e.recv[r].length;++t)n.push(id.expand(e.recv[r][t]));t.addSimulcastAlternativeStreams(rd.RECV,n)}return t};var od=Nl;const sd=Cl("SENDRECV","SENDONLY","RECVONLY","INACTIVE");sd.byValue=function(e){return sd[e.toUpperCase()]},sd.toString=function(e){switch(e){case sd.SENDRECV:return"sendrecv";case sd.SENDONLY:return"sendonly";case sd.RECVONLY:return"recvonly";case sd.INACTIVE:return"inactive"}},sd.reverse=function(e){switch(e){case sd.SENDRECV:return sd.SENDRECV;case sd.SENDONLY:return sd.RECVONLY;case sd.RECVONLY:return sd.SENDONLY;case sd.INACTIVE:return sd.INACTIVE}};var cd=sd;class Ul{constructor(e,t){this.port=e,this.maxMessageSize=t}clone(){return new Ul(this.port,this.maxMessageSize)}plain(){return{port:this.port,maxMessageSize:this.maxMessageSize}}getPort(){return this.port}getMaxMessageSize(){return this.maxMessageSize}}Ul.expand=function(e){return new Ul(e.port,e.maxMessageSize)};var ud=Ul;class Vl{constructor(e,t){this.id=e,this.type=t,this.direction=cd.SENDRECV,this.extensions=new Map,this.codecs=new Map,this.rids=new Map,this.simulcast=null,this.bitrate=0,this.control=null,this.dataChannel=null}clone(){const e=new Vl(this.id,this.type);e.setDirection(this.direction),e.setBitrate(this.bitrate);for(const t of this.codecs.values())e.addCodec(t.clone());for(const[t,r]of this.extensions.entries())e.addExtension(t,r);for(const t of this.rids.values())e.addRID(t.clone());return this.simulcast&&e.setSimulcast(this.simulcast.clone()),this.control&&e.setControl(this.control),this.dataChannel&&e.setDatachannel(this.dataChannel.clone()),e}plain(){const e={id:this.id,type:this.type,direction:cd.toString(this.direction),codecs:[]};this.dataChannel&&(e.dataChannel=this.dataChannel.plain()),this.bitrate&&(e.bitrate=this.bitrate);for(const t of this.codecs.values())e.codecs.push(t.plain());for(const[t,r]of this.extensions.entries())e.extensions||(e.extensions={}),e.extensions[t]=r;for(const t of this.rids.values())e.rids||(e.rids=[]),e.rids.push(t.plain());return this.simulcast&&(e.simulcast=this.simulcast.plain()),this.control&&(e.control=this.control),e}getType(){return this.type}getId(){return this.id}setId(e){this.id=e}addExtension(e,t){this.extensions.set(e,t)}addRID(e){this.rids.set(e.getId(),e)}addCodec(e){this.codecs.set(e.getType(),e)}setCodecs(e){this.codecs=e}getCodecForType(e){return this.codecs.get(e)}getCodec(e){for(const t of this.codecs.values())if(t.getCodec().toLowerCase()===e.toLowerCase())return t;return null}hasCodec(e){return null!==this.getCodec(e)}getCodecs(){return this.codecs}hasRTX(){for(const e of this.codecs.values())if(e.hasRTX())return!0;return!1}getExtensions(){return this.extensions}getRIDs(){return this.rids}getRID(e){return this.rids.get(e)}getBitrate(){return this.bitrate}setBitrate(e){this.bitrate=e}getDirection(){return this.direction}setDirection(e){this.direction=e}hasControl(){return!!this.control}getControl(){return this.control}setControl(e){this.control=e}hasDataChannel(){return!!this.dataChannel}getDataChannel(){return this.dataChannel}setDataChannel(e){this.dataChannel=e}answer(e){const t=new Vl(this.id,this.type);if(e){if(t.setDirection(cd.reverse(this.direction)),e.codecs){let r;r=Array.isArray(e.codecs)?Sl.MapFromNames(e.codecs,e.rtx,e.rtcpfbs):e.codecs;for(let e of this.codecs.values())if(r.has(e.getCodec().toLowerCase())){const n=r.get(e.getCodec().toLowerCase());if("h264"===n.getCodec()&&n.hasParam("packetization-mode")&&n.getParam("packetization-mode")!=e.getParam("packetization-mode","0"))continue;if("h264"===n.getCodec()&&n.hasParam("profile-level-id")&&e.hasParam("profile-level-id")&&n.getParam("profile-level-id")!=e.getParam("profile-level-id"))continue;if("multiopus"===n.getCodec()&&n.hasParam("num_streams")&&e.hasParam("num_streams")&&n.getParam("num_streams")!=e.getParam("num_streams"))continue;const i=n.clone();i.setType(e.getType()),i.hasRTX()&&i.setRTX(e.getRTX()),e.hasChannels()&&i.setChannels(e.getChannels()),i.addParams(e.getParams()),t.addCodec(i)}}const n=new Set(e.extensions);for(let[e,r]of this.extensions)n.has(r)&&t.addExtension(e,r);if(e.simulcast&&this.simulcast){const e=new od,n=this.simulcast.getSimulcastStreams(rd.SEND);if(n)for(let t=0;t<n.length;++t){var r=[];for(let e=0;e<n[t].length;++e)r.push(n[t][e].clone());e.addSimulcastAlternativeStreams(rd.RECV,r)}const i=this.simulcast.getSimulcastStreams(rd.RECV);if(i)for(let t=0;t<i.length;++t){r=[];for(let e=0;e<i[t].length;++e)r.push(i[t][e].clone());e.addSimulcastAlternativeStreams(rd.SEND,r)}for(const e of this.rids.values()){const r=e.clone();r.setDirection(rd.reverse(e.getDirection())),t.addRID(r)}t.setSimulcast(e)}if(e.dataChannel&&this.dataChannel){const r=new ud(this.dataChannel.getPort(),e.dataChannel.maxMessageSize?e.dataChannel.maxMessageSize:this.dataChannel.getMaxMessageSize());t.setDataChannel(r)}}else t.setDirection(cd.INACTIVE);return t}getSimulcast(){return this.simulcast}setSimulcast(e){this.simulcast=e}}Vl.create=function(e,t){const r=new Vl(e,e);return t?t.codecs&&(Array.isArray(t.codecs)?r.setCodecs(Sl.MapFromNames(t.codecs,t.rtx,t.rtcpfbs)):r.setCodecs(t.codecs)):r.setDirection(cd.INACTIVE),r},Vl.expand=function(e){const t=new Vl(e.id,e.type);if(e.direction&&t.setDirection(cd.byValue(e.direction)),t.setBitrate(e.bitrate),e.dataChannel){const r=ud.expand(e.dataChannel);r&&t.setDataChannel(r)}for(let r in e.extensions)t.addExtension(r,e.extensions[r]);for(let r=0;e.codecs&&r<e.codecs.length;++r){const n=Sl.expand(e.codecs[r]);n&&t.addCodec(n)}for(let r=0;e.rids&&r<e.rids.length;++r){const n=nd.expand(e.rids[r]);t.addRID(n)}return e.simulcast&&t.setSimulcast(od.expand(e.simulcast)),e.control&&t.setControl(e.control),t};var ld=Vl;class $l{constructor(e,t){this.semantics=e,this.ssrcs=[];for(let e=0;e<t.length;++e)this.ssrcs.push(parseInt(t[e]))}clone(){return new $l(this.semantics,this.ssrcs)}plain(){const e={semantics:this.semantics,ssrcs:[]};for(let t=0;t<this.ssrcs.length;++t)e.ssrcs.push(this.ssrcs[t]);return e}getSemantics(){return this.semantics}getSSRCs(){return this.ssrcs}}$l.expand=function(e){return new $l(e.semantics,e.ssrcs)};var dd=$l;class ql{constructor(e){this.ssrc=e}clone(){const e=new ql(this.ssrc);e.setCName(this.cname),e.setStreamId(this.streamId),e.setTrackId(this.trackId)}plain(){const e={ssrc:this.ssrc};return this.cname&&(e.cname=this.cname),this.streamId&&(e.streamId=this.streamId),this.trackId&&(e.trackid=this.trackId),e}getCName(){return this.cname}setCName(e){this.cname=e}getStreamId(){return this.streamId}setStreamId(e){this.streamId=e}getTrackId(){return this.trackId}setTrackId(e){this.trackId=e}getSSRC(){return this.ssrc}}ql.expand=function(e){const t=new ql(e.ssrc);return t.setCName(e.cname),t.setStreamId(e.streamId),t.setTrackId(e.trackId),t};var fd=ql;class Xl{constructor(e,t){this.id=e,this.paused=t,this.codecs=new Map,this.params=new Map}clone(){var e=new Xl(this.id,this.paused);for(let t of this.codecs.values())e.addCodec(t.clone());return e.setParams(this.params),e}plain(){var e={id:this.id,paused:this.paused,codecs:{},params:{}};for(var[t,r]of this.codecs.entries())e.codecs[t]=r.plain();for(var[t,n]of this.params.entries())e.params[t]=n;return e}getId(){return this.id}getCodecs(){return this.codecs}addCodec(e){this.codecs.set(e.getType(),e)}getParams(){return this.params}setParams(e){this.params=new Map(e)}addParam(e,t){this.params.set(e,t)}isPaused(){return this.paused}}Xl.expand=function(e){const t=new Xl(e.id,e.paused);for(let r in e.codecs)t.addCodec(Sl.expand(e.codecs[r]));for(let r in e.params)t.addParam(r,e.params[r]);return t};var hd=Xl;class Yl{constructor(e,t){this.media=e,this.id=t,this.ssrcs=[],this.groups=[],this.encodings=[]}clone(){const e=new Yl(this.media,this.id);this.mediaId&&e.setMediaId(this.mediaId);for(let t=0;t<this.ssrcs.length;++t)e.addSSRC(this.ssrcs[t]);for(let t=0;t<this.groups.length;++t)e.addSourceGroup(this.groups[t].clone());for(let t=0;t<this.encodings.length;++t){const r=[];for(let e=0;e<this.encodings[t].length;++e)r.push(this.encodings[t][e].clone());e.addAlternativeEncodings(r)}return e}plain(){const e={media:this.media,id:this.id,ssrcs:[]};this.mediaId&&(e.mediaId=this.mediaId);for(let t=0;t<this.ssrcs.length;++t)e.ssrcs.push(this.ssrcs[t]);for(let t=0;t<this.groups.length;++t)e.groups||(e.groups=[]),e.groups.push(this.groups[t].plain());for(let t=0;t<this.encodings.length;++t){const r=[];for(let e=0;e<this.encodings[t].length;++e)r.push(this.encodings[t][e].plain());r.length&&(e.encodings||(e.encodings=[]),e.encodings.push(r))}return e}getMedia(){return this.media}setMediaId(e){this.mediaId=e}getMediaId(){return this.mediaId}getId(){return this.id}addSSRC(e){this.ssrcs.push(e)}getSSRCs(){return this.ssrcs}addSourceGroup(e){this.groups.push(e)}getSourceGroup(e){for(const t of this.groups)if(t.getSemantics().toLowerCase()===e.toLowerCase())return t;return null}getSourceGroups(){return this.groups}hasSourceGroup(e){for(const t of this.groups)if(t.getSemantics().toLowerCase()===e.toLowerCase())return!0;return!1}getEncodings(){return this.encodings}addEncoding(e){this.encodings.push([e])}addAlternativeEncodings(e){this.encodings.push(e)}setEncodings(e){this.encodings=e}}Yl.expand=function(e){const t=new Yl(e.media,e.id);e.mediaId&&t.setMediaId(e.mediaId);for(let r=0;e.ssrcs&&r<e.ssrcs.length;++r)t.addSSRC(e.ssrcs[r]);for(let r=0;e.groups&&r<e.groups.length;++r)t.addSourceGroup(dd.expand(e.groups[r]));for(let r=0;e.encodings&&r<e.encodings.length;++r){const n=[];for(let t=0;t<e.encodings[r].length;++t)n.push(hd.expand(e.encodings[r][t]));t.addAlternativeEncodings(n)}return t};var md=Yl;class Kl{constructor(e){this.id=e,this.tracks=new Map}clone(){const e=new Kl(this.id);for(const t of this.tracks.values())e.addTrack(t.clone());return e}plain(){const e={id:this.id,tracks:[]};for(const t of this.tracks.values())e.tracks.push(t.plain());return e}getId(){return this.id}addTrack(e){this.tracks.set(e.getId(),e)}removeTrack(e){return this.tracks.delete(e.getId())}removeTrackById(e){return this.tracks.delete(e)}getFirstTrack(e){for(let t of this.tracks.values())if(t.getMedia().toLowerCase()===e.toLowerCase())return t;return null}getTracks(){return this.tracks}removeAllTracks(){this.tracks.clear()}getTrack(e){return this.tracks.get(e)}}Kl.expand=function(e){const t=new Kl(e.id,e.paused);for(let r=0;r<e.tracks.length;++r){const n=md.expand(e.tracks[r]);n&&t.addTrack(n)}return t};var gd=Kl;class Ql{constructor(e){this.version=e||1,this.streams=new Map,this.medias=new Array,this.candidates=new Array,this.ice=null,this.dtls=null,this.crypto=null,this.extmapAllowMixed=!0}clone(){const e=new Ql(this.version);for(let t=0;t<this.medias.length;++t)e.addMedia(this.medias[t].clone());for(const t of this.streams.values())e.addStream(t.clone());for(let t=0;t<this.candidates.length;++t)e.addCandidate(this.candidates[t].clone());return e.setICE(this.ice.clone()),this.dtls&&e.setDTLS(this.dtls.clone()),this.crypto&&e.setCrypto(this.crypto.clone()),e.setExmapAllowMixed(this.extmapAllowMixed),e}plain(){const e={version:this.version,streams:[],medias:[],candidates:[]};for(let t=0;t<this.medias.length;++t)e.medias.push(this.medias[t].plain());for(const t of this.streams.values())e.streams.push(t.plain());for(let t=0;t<this.candidates.length;++t)e.candidates.push(this.candidates[t].plain());return this.ice&&(e.ice=this.ice.plain()),this.dtls&&(e.dtls=this.dtls.plain()),this.crypto&&(e.crypto=this.crypto.plain()),this.extmapAllowMixed||(e.extmapAllowMixedNotSupported=!this.extmapAllowMixed),e}unify(){const e=new Ql(this.version);for(let t=0;t<this.medias.length;++t)e.addMedia(this.medias[t].clone());const t={audio:e.getMediasByType("audio"),video:e.getMediasByType("video")};for(const r of this.streams.values()){const n=r.clone();for(const r of n.getTracks().values()){let n=t[r.getMedia()].pop();n||(n=this.getMedia(r.getMedia()).clone(),n.setId(r.getId()),e.addMedia(n)),r.setMediaId(n.getId())}e.addStream(n)}for(let t=0;t<this.candidates.length;++t)e.addCandidate(this.candidates[t].clone());return this.ice&&e.setICE(this.ice.clone()),this.dtls&&e.setDTLS(this.dtls.clone()),this.crypto&&e.setCrypto(this.crypto.clone()),e}setVersion(e){this.version=e}addMedia(e){this.medias.push(e)}getMedia(e){for(let t in this.medias){let r=this.medias[t];if(r.getType().toLowerCase()===e.toLowerCase())return r}return null}getMediasByType(e){var t=[];for(let r in this.medias){let n=this.medias[r];n.getType().toLowerCase()===e.toLowerCase()&&t.push(n)}return t}getMediaById(e){for(let t in this.medias){let r=this.medias[t];if(r.getId().toLowerCase()===e.toLowerCase())return r}return null}replaceMedia(e){for(let t in this.medias)if(this.medias[t].getId()==e.getId())return this.medias[t]=e,!0;return!1}getMedias(){return this.medias}getVersion(){return this.version}getDTLS(){return this.dtls}setDTLS(e){this.dtls=e}hasCrypto(){return!!this.crypto}getCrypto(){return this.crypto}setCrypto(e){this.crypto=e}hasICE(){return!!this.ice}getICE(){return this.ice}setICE(e){this.ice=e}addCandidate(e){for(let t=0;t<this.candidates.length;++t)if(this.candidates[t].equals(e))return;this.candidates.push(e)}addCandidates(e){for(let t=0;t<e.length;++t)this.addCandidate(e[t])}getCandidates(){return this.candidates}getStream(e){return this.streams.get(e)}getStreams(){return this.streams}getFirstStream(){for(let e of this.streams.values())return e;return null}addStream(e){this.streams.set(e.getId(),e)}removeStream(e){return this.streams.delete(e.getId())}removeAllStreams(){this.streams.clear()}getTrackByMediaId(e){for(let t of this.streams.values())for(let[r,n]of t.getTracks())if(n.getMediaId()==e)return n;return null}getStreamByMediaId(e){for(let t of this.streams.values())for(let[r,n]of t.getTracks())if(n.getMediaId()==e)return t;return null}getExtmapAllowMixed(){return this.extmapAllowMixed}setExtmapAllowMixed(e){this.extmapAllowMixed=e}answer(e){const t=new Ql;e.ice&&(e.ice instanceof ed?t.setICE(e.ice.clone()):t.setICE(ed.expand(e.ice))),e.dtls&&(e.dtls instanceof Tl?t.setDTLS(e.dtls):t.setDTLS(Tl.expand(e.dtls))),e.crypto&&(e.crypto instanceof Il?t.setCrypto(e.crypto):t.setCrypto(Il.expand(e.crypto)));for(let r=0;e.candidates&&r<e.candidates.length;++r)e.candidates[r]instanceof wl?t.addCandidate(e.candidates[r].clone()):t.addCandidate(wl.expand(e.candidates[r]));for(const r of this.medias){const n=e&&e.capabilities&&e.capabilities[r.getType()];t.addMedia(r.answer(n))}return t.setExtmapAllowMixed(this.extmapAllowMixed),t}toString(){let e={version:0,media:[]};e.version=0,e.origin={username:"-",sessionId:(new Date).getTime(),sessionVersion:this.version,netType:"IN",ipVer:4,address:"127.0.0.1"},e.name="semantic-sdp",e.connection={version:4,ip:"0.0.0.0"},e.timing={start:0,stop:0},this.hasICE()&&this.getICE().isLite()&&(e.icelite="ice-lite"),e.msidSemantic={semantic:"WMS",token:"*"},e.groups=[],this.extmapAllowMixed&&(e.extmapAllowMixed="extmap-allow-mixed");let t={type:"BUNDLE",mids:[]};for(let r in this.medias){let n=this.medias[r],i={type:n.getType(),port:9,protocol:"",fmtp:[],rtp:[],rtcpFb:[],ext:[],bandwidth:[],candidates:[],ssrcGroups:[],ssrcs:[],rids:[]};i.direction=cd.toString(n.getDirection()),this.extmapAllowMixed&&(i.extmapAllowMixed="extmap-allow-mixed"),i.mid=n.getId(),t.mids.push(n.getId()),n.hasControl()&&(i.control=n.getControl()),n.getBitrate()>0&&(i.bandwidth.push({type:"AS",limit:n.getBitrate()}),i.bandwidth.push({type:"TIAS",limit:1e3*n.getBitrate()}));let o=this.getCandidates();for(let e=0;e<o.length;++e){let t=o[e];i.candidates.push({foundation:t.getFoundation(),component:t.getComponentId(),transport:t.getTransport(),priority:t.getPriority(),ip:t.getAddress(),port:t.getPort(),type:t.getType(),raddr:t.getRelAddr(),rport:t.getRelPort()})}if(this.getICE()&&(i.iceUfrag=this.getICE().getUfrag(),i.icePwd=this.getICE().getPwd()),["audio","video"].includes(n.getType().toLowerCase())){i.rtcpMux="rtcp-mux",i.rtcpRsize="rtcp-rsize",this.getDTLS()?(i.protocol="UDP/TLS/RTP/SAVPF",i.fingerprint={type:this.getDTLS().getHash(),hash:this.getDTLS().getFingerprint()},i.setup=El.toString(this.getDTLS().getSetup())):this.getCrypto()?(i.protocol="RTP/SAVPF",i.crypto=[{id:this.getCrypto().getTag(),suite:this.getCrypto().getSuite(),config:this.getCrypto().getKeyParams()}]):i.protocol="RTP/AVP";for(let e of n.getCodecs().values()){"video"===n.getType().toLowerCase()?i.rtp.push({payload:e.getType(),codec:e.getCodec().toUpperCase(),rate:9e4}):"opus"===e.getCodec().toLowerCase()||"multiopus"===e.getCodec().toLowerCase()?i.rtp.push({payload:e.getType(),codec:e.getCodec(),rate:48e3,encoding:e.getChannels()}):i.rtp.push({payload:e.getType(),codec:e.getCodec(),rate:8e3});for(const t of e.getRTCPFeedbacks())i.rtcpFb.push({payload:e.getType(),type:t.getId(),subtype:t.getParams().join(" ")});e.hasRTX()&&(i.rtp.push({payload:e.getRTX(),codec:"rtx",rate:9e4}),i.fmtp.push({payload:e.getRTX(),config:"apt="+e.getType()}));const t=e.getParams();if(Object.keys(t).length){const r={payload:e.getType(),config:""};for(const e in t)r.config.length&&(r.config+=";"),t.hasOwnProperty(e)?r.config+=e+"="+t[e]:r.config+=e;i.fmtp.push(r)}}const e=[];for(let t=0;t<i.rtp.length;++t)e.push(i.rtp[t].payload);i.payloads=e.join(" ");for(let[e,t]of n.getExtensions().entries())i.ext.push({value:e,uri:t});for(let e of n.getRIDs().values()){let t={id:e.getId(),direction:rd.toString(e.getDirection()),params:""};e.getFormats().length&&(t.params="pt="+e.getFormats().join(","));for(let[r,n]of e.getParams().entries())t.params+=(t.params.length?";":"")+r+"="+n;i.rids.push(t)}const t=n.getSimulcast();if(t){let e=1;i.simulcast={};const r=t.getSimulcastStreams(rd.SEND),n=t.getSimulcastStreams(rd.RECV);if(r&&r.length){let t="";for(let e=0;e<r.length;++e){let n="";for(let t=0;t<r[e].length;++t)n+=(n.length?",":"")+(r[e][t].isPaused()?"~":"")+r[e][t].getId();t+=(t.length?";":"")+n}i.simulcast["dir"+e]="send",i.simulcast["list"+e]=t,e++}if(n&&n.length){let t=[];for(let e=0;e<n.length;++e){let r="";for(let t=0;t<n[e].length;++t)r+=(r.length?",":"")+(n[e][t].isPaused()?"~":"")+n[e][t].getId();t+=(t.length?";":"")+r}i.simulcast["dir"+e]="recv",i.simulcast["list"+e]=t,e++}}}else if(n.hasDataChannel()){i.protocol="UDP/DTLS/SCTP",i.payloads="webrtc-datachannel";const e=n.getDataChannel();i.sctpPort=e.getPort(),i.maxMessageSize=e.getMaxMessageSize()}e.media.push(i)}for(let t of this.streams.values())for(let r of t.getTracks().values())for(let n in e.media){let i=e.media[n];if(r.getMediaId()){if(r.getMediaId()==i.mid){let e=r.getSourceGroups();for(let t in e){let r=e[t];i.ssrcGroups.push({semantics:r.getSemantics(),ssrcs:r.getSSRCs().join(" ")})}let n=r.getSSRCs();for(let e in n)i.ssrcs.push({id:n[e],attribute:"cname",value:t.getId()}),i.ssrcs.push({id:n[e],attribute:"msid",value:t.getId()+" "+r.getId()});i.msid=t.getId()+" "+r.getId();break}}else if(i.type.toLowerCase()===r.getMedia().toLowerCase()){let e=r.getSourceGroups();for(let t in e){let r=e[t];i.ssrcGroups.push({semantics:r.getSemantics(),ssrcs:r.getSSRCs().join(" ")})}let n=r.getSSRCs();for(let e in n)i.ssrcs.push({id:n[e],attribute:"cname",value:t.getId()}),i.ssrcs.push({id:n[e],attribute:"msid",value:t.getId()+" "+r.getId()});break}}return t.mids=t.mids.join(" "),e.groups.push(t),yl.write(e)}toIceFragmentString(){let e={version:0,media:[],candidates:[]};this.hasICE()&&this.getICE().isLite()&&(e.icelite="ice-lite"),this.getICE()&&(e.iceUfrag=this.getICE().getUfrag(),e.icePwd=this.getICE().getPwd());for(const t of this.getCandidates())e.candidates.push({foundation:t.getFoundation(),component:t.getComponentId(),transport:t.getTransport(),priority:t.getPriority(),ip:t.getAddress(),port:t.getPort(),type:t.getType(),raddr:t.getRelAddr(),rport:t.getRelPort()});return yl.write(e).slice(10)}}Ql.create=function(e){const t=new Ql;e.ice&&(e.ice instanceof ed?t.setICE(e.ice.clone()):t.setICE(ed.expand(e.ice))),e.dtls&&(e.dtls instanceof Tl?t.setDTLS(e.dtls):t.setDTLS(Tl.expand(e.dtls))),e.crypto&&(e.crypto instanceof Il?t.setCrypto(e.crypto):t.setCrypto(Il.expand(e.crypto)));for(let r=0;e.candidates&&r<e.candidates.length;++r)e.candidates[r]instanceof wl?t.addCandidate(e.candidates[r].clone()):t.addCandidate(wl.expand(e.candidates[r]));let r=96,n=1;for(let i in e.capabilities){const o=ld.create(i,e.capabilities[i]);for(const[e,t]of o.getCodecs())t.getType()>=96&&t.setType(r++),t.getRTX()&&t.setRTX(r++);if(e.capabilities[i].extensions)for(let t of e.capabilities[i].extensions)15===n&&n++,o.addExtension(n++,t);t.addMedia(o)}return t},Ql.expand=function(e){const t=new Ql(e.version);for(let r=0;e.medias&&r<e.medias.length;++r){const n=ld.expand(e.medias[r]);n&&t.addMedia(n)}for(let r=0;e.streams&&r<e.streams.length;++r){const n=gd.expand(e.streams[r]);n&&t.addStream(n)}for(let r=0;e.candidates&&r<e.candidates.length;++r){const n=wl.expand(e.candidates[r]);n&&t.addCandidate(n)}return e.ice&&t.setICE(ed.expand(e.ice)),e.dtls&&t.setDTLS(Tl.expand(e.dtls)),e.crypto&&t.setCrypto(Tl.expand(e.crypto)),e.extmapAllowMixedNotSupported&&(this.extmapAllowMixed=!e.extmapAllowMixedNotSupported),t},Ql.process=function(e){return Ql.parse(e)},Ql.parse=function(e){const t=yl.parse(e),r=new Ql;if(r.setVersion(t.version),t.iceUfrag&&t.icePwd){const e=String(t.iceUfrag),n=String(t.icePwd),i=new ed(e,n);i.setLite("ice-lite"==t.icelite),i.setEndOfCandidates("end-of-candidates"==t.endOfCandidates),r.setICE(i)}for(let e in t.media){const n=t.media[e],i=n.type,o=n.mid?n.mid.toString():e,s=new ld(o,i);if(n.iceUfrag&&n.icePwd){const e=String(n.iceUfrag),i=String(n.icePwd),o=new ed(e,i);o.setLite("ice-lite"==t.icelite),o.setEndOfCandidates("end-of-candidates"==n.endOfCandidates),r.setICE(o)}for(let e=0;n.candidates&&e<n.candidates.length;++e){const t=n.candidates[e],i=new wl(t.foundation,t.component,t.transport,t.priority,t.ip,t.port,t.type,t.raddr,t.rport);r.addCandidate(i)}const a=n.fingerprint||t.fingerprint;if(a){const e=a.type,t=a.hash;let i=El.ACTPASS;n.setup&&(i=El.byValue(n.setup)),r.setDTLS(new Tl(i,e,t))}if(n.crypto){const e=n.crypto[0];r.setCrypto(new Il(e.id,e.suite,e.config,e.sessionConfig))}let c=cd.SENDRECV;n.direction&&(c=cd.byValue(n.direction),s.setDirection(c)),n.control&&s.setControl(n.control),r.setExtmapAllowMixed("extmap-allow-mixed"==n.extmapAllowMixed||"extmap-allow-mixed"==t.extmapAllowMixed);const u=new Map;for(let e in n.rtp){const t=n.rtp[e],r=t.payload,i=t.codec;if("RED"===i.toUpperCase()||"ULPFEC"===i.toUpperCase())continue;let o={};for(let e in n.fmtp){const t=n.fmtp[e];if(t.payload===r){const e=t.config.split(";");for(let t in e){const r=e[t].split("="),n=r[0].trim(),i=r.splice(1).join("=").trim();o[n]=i}}}if("RTX"===i.toUpperCase())u.set(parseInt(o.apt),r);else{const e=new Sl(i,r,o);t.encoding>1&&e.setChannels(t.encoding),s.addCodec(e)}}for(let e of u.entries()){const t=s.getCodecForType(e[0]);t&&t.setRTX(e[1])}for(let e=0;n.rtcpFb&&e<n.rtcpFb.length;++e){const t=s.getCodecForType(n.rtcpFb[e].payload);if(t){const r=n.rtcpFb[e].type,i=n.rtcpFb[e].subtype?n.rtcpFb[e].subtype.split(" "):null;t.addRTCPFeedback(new bl(r,i))}}const l=n.ext;for(let e in l){const t=l[e];s.addExtension(t.value,t.uri)}const d=n.rids;for(let e in d){const t=d[e],r=new nd(t.id,rd.byValue(t.direction));let n=[];const i=new Map;if(t.params){const e=yl.parseParams(t.params);for(let t in e)"pt"===t?n=e[t].split(","):i.set(t,e[t]);r.setFormats(n),r.setParams(i)}s.addRID(r)}const f=[];if(n.simulcast){const e=new od;if(n.simulcast.dir1){const t=rd.byValue(n.simulcast.dir1),r=yl.parseSimulcastStreamList(n.simulcast.list1);for(let n=0;n<r.length;++n){const i=[];for(let e=0;e<r[n].length;++e)i.push(new id(r[n][e].scid,r[n][e].paused));e.addSimulcastAlternativeStreams(t,i)}}if(n.simulcast.dir2){const t=rd.byValue(n.simulcast.dir2),r=yl.parseSimulcastStreamList(n.simulcast.list2);for(let n=0;n<r.length;++n){const i=[];for(let e=0;e<r[n].length;++e)i.push(new id(r[n][e].scid,r[n][e].paused));e.addSimulcastAlternativeStreams(t,i)}}for(let t of e.getSimulcastStreams(rd.SEND)){const e=[];for(let r=0;r<t.length;r++){const n=new hd(t[r].getId(),t[r].isPaused()),i=s.getRID(n.getId());if(i){const t=i.getFormats();for(let e=0;t&&e<t.length;++e){const r=s.getCodecForType(t[e]);r&&n.addCodec(r)}n.setParams(i.getParams()),e.push(n)}}e.length&&f.push(e)}s.setSimulcast(e)}const p=new Map;if(n.ssrcs)for(let e in n.ssrcs){let t=n.ssrcs[e],s=t.id,a=t.attribute,c=t.value,u=p.get(s);if(u||(u=new fd(s),p.set(u.getSSRC(),u)),"cname"===a.toLowerCase())u.setCName(c);else if("msid"===a.toLowerCase()){let e=c.split(" "),t=e[0],n=e[1];u.setStreamId(t),u.setTrackId(n);let a=r.getStream(t);a||(a=new gd(t),r.addStream(a));let l=a.getTrack(n);l||(l=new md(i,n),l.setMediaId(o),l.setEncodings(f),a.addTrack(l)),l.addSSRC(s)}}if(n.msid){let e=n.msid.split(" "),t=e[0],s=e[1],a=r.getStream(t);a||(a=new gd(t),r.addStream(a));let c=a.getTrack(s);c||(c=new md(i,s),c.setMediaId(o),c.setEncodings(f),a.addTrack(c));for(let[e,r]of p.entries())r.getStreamId()||(r.setStreamId(t),r.setTrackId(s),c.addSSRC(e))}for(let[e,t]of p.entries())if(!t.getStreamId()){let n=t.getCName(),s=o;t.setStreamId(n),t.setTrackId(s);let a=r.getStream(n);a||(a=new gd(n),r.addStream(a));let c=a.getTrack(s);c||(c=new md(i,s),c.setMediaId(o),c.setEncodings(f),a.addTrack(c)),c.addSSRC(e)}if(n.ssrcGroups)for(let e in n.ssrcGroups){let t=n.ssrcGroups[e],i=t.ssrcs.split(" "),o=new dd(t.semantics,i),s=p.get(parseInt(i[0]));s&&r.getStream(s.getStreamId()).getTrack(s.getTrackId()).addSourceGroup(o)}if("application"==n.type&&"webrtc-datachannel"==n.payloads){const e=new ud(n.sctpPort,n.maxMessageSize);s.setDataChannel(e)}r.addMedia(s)}return r};var vd,yd,wd={SDPInfo:Ql,CandidateInfo:wl,CodecInfo:Sl,DTLSInfo:Tl,CryptoInfo:Il,ICEInfo:ed,MediaInfo:ld,Setup:El,SourceGroupInfo:dd,SourceInfo:fd,StreamInfo:gd,TrackInfo:md,RTCPFeedbackInfo:bl,TrackEncodingInfo:hd,Direction:cd},Sd=(vd=!1,(yd=/[ac]/).exec=function(){return vd=!0,/./.exec.apply(this,arguments)},!0===yd.test("abc")&&vd),Cd=/./.test;Cr({target:"RegExp",proto:!0,forced:!Sd},{test:function(e){var t=gt(this),r=Zo(e),n=t.exec;if(!we(n))return K(Cd,t,r);var i=K(n,t,r);return null!==i&&(gt(i),!0)}});var xd=V((function(e,t){!function(r,n){var i="function",o="undefined",s="object",a="string",c="model",u="name",l="type",d="vendor",f="version",p="architecture",h="console",m="mobile",g="tablet",v="smarttv",y="wearable",w="embedded",E="Amazon",T="Apple",I="ASUS",R="BlackBerry",P="Google",A="Huawei",k="LG",O="Microsoft",L="Motorola",D="Samsung",M="Sony",N="Xiaomi",j="Zebra",_="Facebook",B=function(e){for(var t={},r=0;r<e.length;r++)t[e[r].toUpperCase()]=e[r];return t},U=function(e,t){return typeof e===a&&-1!==V(t).indexOf(V(e))},V=function(e){return e.toLowerCase()},F=function(e,t){if(typeof e===a)return e=e.replace(/^\s\s*/,"").replace(/\s\s*$/,""),typeof t===o?e:e.substring(0,255)},z=function(e,t){for(var r,o,a,c,u,l,d=0;d<t.length&&!u;){var f=t[d],p=t[d+1];for(r=o=0;r<f.length&&!u;)if(u=f[r++].exec(e))for(a=0;a<p.length;a++)l=u[++o],typeof(c=p[a])===s&&c.length>0?2===c.length?typeof c[1]==i?this[c[0]]=c[1].call(this,l):this[c[0]]=c[1]:3===c.length?typeof c[1]!==i||c[1].exec&&c[1].test?this[c[0]]=l?l.replace(c[1],c[2]):n:this[c[0]]=l?c[1].call(this,l,c[2]):n:4===c.length&&(this[c[0]]=l?c[3].call(this,l.replace(c[1],c[2])):n):this[c]=l||n;d+=2}},$=function(e,t){for(var r in t)if(typeof t[r]===s&&t[r].length>0){for(var i=0;i<t[r].length;i++)if(U(t[r][i],e))return"?"===r?n:r}else if(U(t[r],e))return"?"===r?n:r;return e},G={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},W={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[f,[u,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[f,[u,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[u,f],[/opios[\/ ]+([\w\.]+)/i],[f,[u,"Opera Mini"]],[/\bopr\/([\w\.]+)/i],[f,[u,"Opera"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq)\/([-\w\.]+)/i,/(weibo)__([\d\.]+)/i],[u,f],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[f,[u,"UCBrowser"]],[/\bqbcore\/([\w\.]+)/i],[f,[u,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[f,[u,"WeChat"]],[/konqueror\/([\w\.]+)/i],[f,[u,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[f,[u,"IE"]],[/yabrowser\/([\w\.]+)/i],[f,[u,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[u,/(.+)/,"$1 Secure Browser"],f],[/\bfocus\/([\w\.]+)/i],[f,[u,"Firefox Focus"]],[/\bopt\/([\w\.]+)/i],[f,[u,"Opera Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[f,[u,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[f,[u,"Dolphin"]],[/coast\/([\w\.]+)/i],[f,[u,"Opera Coast"]],[/miuibrowser\/([\w\.]+)/i],[f,[u,"MIUI Browser"]],[/fxios\/([-\w\.]+)/i],[f,[u,"Firefox"]],[/\bqihu|(qi?ho?o?|360)browser/i],[[u,"360 Browser"]],[/(oculus|samsung|sailfish)browser\/([\w\.]+)/i],[[u,/(.+)/,"$1 Browser"],f],[/(comodo_dragon)\/([\w\.]+)/i],[[u,/_/g," "],f],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[u,f],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i],[u],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[u,_],f],[/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[u,f],[/\bgsa\/([\w\.]+) .*safari\//i],[f,[u,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[f,[u,"Chrome Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[u,"Chrome WebView"],f],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[f,[u,"Android Browser"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[u,f],[/version\/([\w\.]+) .*mobile\/\w+ (safari)/i],[f,[u,"Mobile Safari"]],[/version\/([\w\.]+) .*(mobile ?safari|safari)/i],[f,u],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[u,[f,$,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[u,f],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[u,"Netscape"],f],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[f,[u,"Firefox Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[u,f]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[p,"amd64"]],[/(ia32(?=;))/i],[[p,V]],[/((?:i[346]|x)86)[;\)]/i],[[p,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[p,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[p,"armhf"]],[/windows (ce|mobile); ppc;/i],[[p,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[p,/ower/,"",V]],[/(sun4\w)[;\)]/i],[[p,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[p,V]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[pt]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[c,[d,D],[l,g]],[/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[c,[d,D],[l,m]],[/\((ip(?:hone|od)[\w ]*);/i],[c,[d,T],[l,m]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[c,[d,T],[l,g]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[c,[d,A],[l,g]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}-[atu]?[ln][01259x][012359][an]?)\b(?!.+d\/s)/i],[c,[d,A],[l,m]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[c,/_/g," "],[d,N],[l,m]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[c,/_/g," "],[d,N],[l,g]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[c,[d,"OPPO"],[l,m]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[c,[d,"Vivo"],[l,m]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[c,[d,"Realme"],[l,m]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[c,[d,L],[l,m]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[c,[d,L],[l,g]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[c,[d,k],[l,g]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[c,[d,k],[l,m]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[c,[d,"Lenovo"],[l,g]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[c,/_/g," "],[d,"Nokia"],[l,m]],[/(pixel c)\b/i],[c,[d,P],[l,g]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[c,[d,P],[l,m]],[/droid.+ ([c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[c,[d,M],[l,m]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[c,"Xperia Tablet"],[d,M],[l,g]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[c,[d,"OnePlus"],[l,m]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[c,[d,E],[l,g]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[c,/(.+)/g,"Fire Phone $1"],[d,E],[l,m]],[/(playbook);[-\w\),; ]+(rim)/i],[c,d,[l,g]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[c,[d,R],[l,m]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[c,[d,I],[l,g]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[c,[d,I],[l,m]],[/(nexus 9)/i],[c,[d,"HTC"],[l,g]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic|sony)[-_ ]?([-\w]*)/i],[d,[c,/_/g," "],[l,m]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[c,[d,"Acer"],[l,g]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[c,[d,"Meizu"],[l,m]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[c,[d,"Sharp"],[l,m]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[d,c,[l,m]],[/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[d,c,[l,g]],[/(surface duo)/i],[c,[d,O],[l,g]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[c,[d,"Fairphone"],[l,m]],[/(u304aa)/i],[c,[d,"AT&T"],[l,m]],[/\bsie-(\w*)/i],[c,[d,"Siemens"],[l,m]],[/\b(rct\w+) b/i],[c,[d,"RCA"],[l,g]],[/\b(venue[\d ]{2,7}) b/i],[c,[d,"Dell"],[l,g]],[/\b(q(?:mv|ta)\w+) b/i],[c,[d,"Verizon"],[l,g]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[c,[d,"Barnes & Noble"],[l,g]],[/\b(tm\d{3}\w+) b/i],[c,[d,"NuVision"],[l,g]],[/\b(k88) b/i],[c,[d,"ZTE"],[l,g]],[/\b(nx\d{3}j) b/i],[c,[d,"ZTE"],[l,m]],[/\b(gen\d{3}) b.+49h/i],[c,[d,"Swiss"],[l,m]],[/\b(zur\d{3}) b/i],[c,[d,"Swiss"],[l,g]],[/\b((zeki)?tb.*\b) b/i],[c,[d,"Zeki"],[l,g]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[d,"Dragon Touch"],c,[l,g]],[/\b(ns-?\w{0,9}) b/i],[c,[d,"Insignia"],[l,g]],[/\b((nxa|next)-?\w{0,9}) b/i],[c,[d,"NextBook"],[l,g]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[d,"Voice"],c,[l,m]],[/\b(lvtel\-)?(v1[12]) b/i],[[d,"LvTel"],c,[l,m]],[/\b(ph-1) /i],[c,[d,"Essential"],[l,m]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[c,[d,"Envizen"],[l,g]],[/\b(trio[-\w\. ]+) b/i],[c,[d,"MachSpeed"],[l,g]],[/\btu_(1491) b/i],[c,[d,"Rotor"],[l,g]],[/(shield[\w ]+) b/i],[c,[d,"Nvidia"],[l,g]],[/(sprint) (\w+)/i],[d,c,[l,m]],[/(kin\.[onetw]{3})/i],[[c,/\./g," "],[d,O],[l,m]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[c,[d,j],[l,g]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[c,[d,j],[l,m]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[d,c,[l,h]],[/droid.+; (shield) bui/i],[c,[d,"Nvidia"],[l,h]],[/(playstation [345portablevi]+)/i],[c,[d,M],[l,h]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[c,[d,O],[l,h]],[/smart-tv.+(samsung)/i],[d,[l,v]],[/hbbtv.+maple;(\d+)/i],[[c,/^/,"SmartTV"],[d,D],[l,v]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[d,k],[l,v]],[/(apple) ?tv/i],[d,[c,"Apple TV"],[l,v]],[/crkey/i],[[c,"Chromecast"],[d,P],[l,v]],[/droid.+aft(\w)( bui|\))/i],[c,[d,E],[l,v]],[/\(dtv[\);].+(aquos)/i],[c,[d,"Sharp"],[l,v]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i],[[d,F],[c,F],[l,v]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[l,v]],[/((pebble))app/i],[d,c,[l,y]],[/droid.+; (glass) \d/i],[c,[d,P],[l,y]],[/droid.+; (wt63?0{2,3})\)/i],[c,[d,j],[l,y]],[/(quest( 2)?)/i],[c,[d,_],[l,y]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[d,[l,w]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[c,[l,m]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[c,[l,g]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[l,g]],[/(phone|mobile(?:[;\/]| safari)|pda(?=.+windows ce))/i],[[l,m]],[/(android[-\w\. ]{0,9});.+buil/i],[c,[d,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[f,[u,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[f,[u,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i],[u,f],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[f,u]],os:[[/microsoft (windows) (vista|xp)/i],[u,f],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[u,[f,$,G]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[u,"Windows"],[f,$,G]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[f,/_/g,"."],[u,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[u,"Mac OS"],[f,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[f,u],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[u,f],[/\(bb(10);/i],[f,[u,R]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[f,[u,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[f,[u,"Firefox OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[f,[u,"webOS"]],[/crkey\/([\d\.]+)/i],[f,[u,"Chromecast"]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[u,"Chromium OS"],f],[/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[u,f],[/(sunos) ?([\w\.\d]*)/i],[[u,"Solaris"],f],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[u,f]]},q=function(e,t){if(typeof e===s&&(t=e,e=n),!(this instanceof q))return new q(e,t).getResult();var i=e||(typeof r!==o&&r.navigator&&r.navigator.userAgent?r.navigator.userAgent:""),c=t?function(e,t){var r={};for(var n in e)t[n]&&t[n].length%2==0?r[n]=t[n].concat(e[n]):r[n]=e[n];return r}(W,t):W;return this.getBrowser=function(){var e={};return e.name=n,e.version=n,z.call(e,i,c.browser),e.major=function(e){return typeof e===a?e.replace(/[^\d\.]/g,"").split(".")[0]:n}(e.version),e},this.getCPU=function(){var e={};return e.architecture=n,z.call(e,i,c.cpu),e},this.getDevice=function(){var e={};return e.vendor=n,e.model=n,e.type=n,z.call(e,i,c.device),e},this.getEngine=function(){var e={};return e.name=n,e.version=n,z.call(e,i,c.engine),e},this.getOS=function(){var e={};return e.name=n,e.version=n,z.call(e,i,c.os),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return i},this.setUA=function(e){return i=typeof e===a&&e.length>255?F(e,255):e,this},this.setUA(i),this};q.VERSION="0.7.31",q.BROWSER=B([u,f,"major"]),q.CPU=B([p]),q.DEVICE=B([c,d,l,h,m,v,g,y,w]),q.ENGINE=q.OS=B([u,f]),e.exports&&(t=e.exports=q),t.UAParser=q;var H=typeof r!==o&&(r.jQuery||r.Zepto);if(H&&!H.ua){var X=new q;H.ua=X.getResult(),H.ua.get=function(){return X.getUA()},H.ua.set=function(e){X.setUA(e);var t=X.getResult();for(var r in t)H.ua[r]=t[r]}}}("object"==typeof window?window:U)}));const Ed=["iOS"];class ad extends xd{constructor(){super(window.navigator.userAgent)}isChrome(){const e=this.getBrowser();if(!e.name)return!1;const t=this.getOS();let r=!0;return r=!new RegExp(Ed.join("|"),"i").test(t.name),e.name.match(/Chrome/i)&&r}isFirefox(){const e=this.getBrowser();return!!e.name&&e.name.match(/Firefox/i)}}const Td=jn.get("SdpParser"),Id=Array.from({length:31},(e,t)=>t+35),Rd=Array.from({length:32},(e,t)=>t+96),Ad=Array.from({length:14},(e,t)=>t+1),kd=Array.from({length:240},(e,t)=>t+16);class pd{static setSimulcast(e,t){if(Td.info("Setting simulcast. Codec: ",t),!(new ad).isChrome())return Td.warn("Simulcast is only available in Google Chrome browser"),e;if("h264"!==t&&"vp8"!==t)return Td.warn("Simulcast is only available in h264 and vp8 codecs"),e;try{const t=/m=video[\s\S]*?a=ssrc:(\d*) msid:([\s\S]+?)\r\n/,r=/m=video[\s\S]*?a=ssrc:(\d*) cname:([\s\S]+?)\r\n/.exec(e),n=r[1],i=r[2],o=t.exec(e)[2],s=2,a=[n];for(let t=0;t<s;++t){const r=100+2*t,n=r+1;a.push(r),e+="a=ssrc-group:FID "+r+" "+n+"\r\na=ssrc:"+r+" cname:"+i+"\r\na=ssrc:"+r+" msid:"+o+"\r\na=ssrc:"+n+" cname:"+i+"\r\na=ssrc:"+n+" msid:"+o+"\r\n"}return e+="a=ssrc-group:SIM "+a.join(" ")+"\r\n",Td.info("Simulcast setted"),Td.debug("Simulcast SDP: ",e),e}catch(e){throw Td.error("Error setting SDP for simulcast: ",e),e}}static setStereo(e){return Td.info("Replacing SDP response for support stereo"),e=e.replace(/useinbandfec=1/g,"useinbandfec=1; stereo=1"),Td.info("Replaced SDP response for support stereo"),Td.debug("New SDP value: ",e),e}static setDTX(e){return Td.info("Replacing SDP response for support dtx"),e=e.replace("useinbandfec=1","useinbandfec=1; usedtx=1"),Td.info("Replaced SDP response for support dtx"),Td.debug("New SDP value: ",e),e}static setAbsoluteCaptureTime(e){const t="a=extmap:"+pd.getAvailableHeaderExtensionIdRange(e)[0]+" http://www.webrtc.org/experiments/rtp-hdrext/abs-capture-time\r\n";return e=e.replace(/(m=.*\r\n(?:.*\r\n)*?)(a=extmap.*\r\n)/gm,(e,r,n)=>r+t+n),Td.info("Replaced SDP response for setting absolute capture time"),Td.debug("New SDP value: ",e),e}static setDependencyDescriptor(e){const t="a=extmap:"+pd.getAvailableHeaderExtensionIdRange(e)[0]+" https://aomediacodec.github.io/av1-rtp-spec/#dependency-descriptor-rtp-header-extension\r\n";return e=e.replace(/(m=.*\r\n(?:.*\r\n)*?)(a=extmap.*\r\n)/gm,(e,r,n)=>r+t+n),Td.info("Replaced SDP response for setting depency descriptor"),Td.debug("New SDP value: ",e),e}static setVideoBitrate(e,t){if(t<1)Td.info("Remove bitrate restrictions"),e=e.replace(/b=AS:.*\r\n/,"").replace(/b=TIAS:.*\r\n/,"");else{const r=wd.SDPInfo.parse(e),n=r.getMedia("video");Td.info("Setting video bitrate"),n.setBitrate(t),e=r.toString()}return e}static removeSdpLine(e,t){return Td.debug("SDP before trimming: ",e),e=e.split("\n").filter(e=>e.trim()!==t).join("\n"),Td.debug("SDP trimmed result: ",e),e}static adaptCodecName(e,t,r){if(!e)return e;const n=new RegExp("".concat(t),"i");return e.replace(n,r)}static setMultiopus(e,t){if(!(new ad).isFirefox()&&(!t||Od(t)))if(e.includes("multiopus/48000/6"))Td.info("Multiopus already setted");else{Td.info("Setting multiopus");const t=/m=audio 9 UDP\/TLS\/RTP\/SAVPF (.*)\r\n/.exec(e)[0],r=pd.getAvailablePayloadTypeRange(e)[0],n=t.replace("\r\n"," ")+r+"\r\na=rtpmap:"+r+" multiopus/48000/6\r\na=fmtp:"+r+" channel_mapping=0,4,1,2,3,5;coupled_streams=2;minptime=10;num_streams=4;useinbandfec=1\r\n";e=e.replace(t,n),Td.info("Multiopus offer created"),Td.debug("SDP parsed for multioups: ",e)}return e}static getAvailablePayloadTypeRange(e){const t=e.matchAll(/m=(?:.*) (?:.*) UDP\/TLS\/RTP\/SAVPF (.*)\r\n/gm);let r=Rd.concat(Id);var n,i=B(t);try{for(i.s();!(n=i.n()).done;){const e=n.value[1].split(" ").map(e=>parseInt(e));r=r.filter(t=>!e.includes(t))}}catch(e){i.e(e)}finally{i.f()}return r}static getAvailableHeaderExtensionIdRange(e){const t=e.matchAll(/a=extmap:(\d+)(?:.*)\r\n/gm);let r=Ad.concat(kd);var n,i=B(t);try{for(i.s();!(n=i.n()).done;){const e=n.value[1].split(" ").map(e=>parseInt(e));r=r.filter(t=>!e.includes(t))}}catch(e){i.e(e)}finally{i.f()}return r}static renegotiate(e,t){const r=wd.SDPInfo.parse(e),n=wd.SDPInfo.parse(t);var i,o=B(r.getMedias());try{for(o.s();!(i=o.n()).done;){const t=i.value;let r=n.getMediaById(t.getId());if(!r){r=new wd.MediaInfo(t.getId(),t.getType()),r.setDirection(wd.Direction.reverse(t.getDirection()));const i=n.getMedia(t.getType());if(i){r.setCodecs(i.getCodecs());var s,a=B(i.getExtensions());try{for(a.s();!(s=a.n()).done;){const e=N(s.value,2),t=e[0],n=e[1];r.addExtension(t,n)}}catch(e){a.e(e)}finally{a.f()}}n.addMedia(r)}}}catch(e){o.e(e)}finally{o.f()}return n.toString()}static updateMissingVideoExtensions(e,t){var r;const n=wd.SDPInfo.parse(e),i=null===(r=wd.SDPInfo.parse(t).getMediasByType("video")[0])||void 0===r?void 0:r.getExtensions();if(i||i.length){var o,s=B(n.getMediasByType("video"));try{for(s.s();!(o=s.n()).done;){const t=o.value,r=t.getExtensions();i.forEach((n,i)=>{if(!r.get(i)){const r=t.getId(),o="a=extmap:"+i+" "+n+"\r\n",s=new RegExp("(a=mid:"+r+"\r\n(?:.*\r\n)*?)","g");e=e.replace(s,(e,t,r)=>t+o)}})}}catch(e){s.e(e)}finally{s.f()}return e}}}const Od=e=>e.getAudioTracks().some(e=>e.getSettings().channelCount>2);var Ld=nr.indexOf,Dd=oe([].indexOf),Nd=!!Dd&&1/Dd([1],1,-0)<0,jd=function(e,t){var r=[].indexOf;return!!r&&q((function(){r.call(null,(function(){return 1}),1)}))}();Cr({target:"Array",proto:!0,forced:Nd||!jd},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return Nd?Dd(this,e,t)||0:Ld(this,e,t)}});class bd extends zc{constructor(e,t){super(),this.namespace=e,this.tm=t}cmd(e,t){return this.tm.cmd(e,t,this.namespace)}event(e,t){return this.tm.event(e,t,this.namespace)}close(){return this.tm.namespaces.delete(this.namespace)}}var _d=class extends zc{constructor(e){super(),this.maxId=0,this.namespaces=new Map,this.transactions=new Map,this.transport=e,this.listener=t=>{let r;try{r=JSON.parse(t.utf8Data||t.data||t)}catch(e){return}switch(r.type){case"cmd":const t={name:r.name,data:r.data,namespace:r.namespace,accept:t=>{e.send(JSON.stringify({type:"response",transId:r.transId,data:t}))},reject:t=>{e.send(JSON.stringify({type:"error",transId:r.transId,data:t}))}};if(t.namespace){const e=this.namespaces.get(t.namespace);e?e.emit("cmd",t):this.emit("cmd",t)}else this.emit("cmd",t);break;case"response":{const e=this.transactions.get(r.transId);if(!e)return;this.transactions.delete(r.transId),e.resolve(r.data);break}case"error":{const e=this.transactions.get(r.transId);if(!e)return;this.transactions.delete(r.transId),e.reject(r.data);break}case"event":const i={name:r.name,data:r.data,namespace:r.namespace};if(i.namespace){var n=this.namespaces.get(i.namespace);n?n.emit("event",i):this.emit("event",i)}else this.emit("event",i)}},this.transport.addListener?this.transport.addListener("message",this.listener):this.transport.addEventListener("message",this.listener)}cmd(e,t,r){return new Promise((n,i)=>{if(!e||0===e.length)throw new Error("Bad command name");const o={type:"cmd",transId:this.maxId++,name:e,data:t};r&&(o.namespace=r);const s=JSON.stringify(o);o.resolve=n,o.reject=i,this.transactions.set(o.transId,o);try{this.transport.send(s)}catch(e){throw this.transactions.delete(o.transId),e}})}event(e,t,r){if(!e||0===e.length)throw new Error("Bad event name");const n={type:"event",name:e,data:t};r&&(n.namespace=r);const i=JSON.stringify(n);this.transport.send(i)}namespace(e){let t=this.namespaces.get(e);return t||(t=new bd(e,this),this.namespaces.set(e,t),t)}close(){for(const e of this.namespaces.values())e.close();this.transport.removeListener?this.transport.removeListener("message",this.listener):this.transport.removeEventListener("message",this.listener)}};const Bd=jn.get("Signaling"),Ud="wsConnectionSuccess",Vd="wsConnectionError",Fd="broadcastEvent",zd={VP8:"vp8",VP9:"vp9",H264:"h264",AV1:"av1"},$d={OPUS:"opus",MULTIOPUS:"multiopus"};class Pd extends zc{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{streamName:null,url:"ws://localhost:8080/"};super(),this.streamName=e.streamName,this.wsUrl=e.url,this.webSocket=null,this.transactionManager=null,this.serverId=null,this.clusterId=null}connect(){var e=this;return D((function*(){var t;return Bd.info("Connecting to Signaling Server"),e.transactionManager&&(null===(t=e.webSocket)||void 0===t?void 0:t.readyState)===WebSocket.OPEN?(Bd.info("Connected to server: ",e.webSocket.url),Bd.debug("WebSocket value: ",{url:e.webSocket.url,protocol:e.webSocket.protocol,readyState:e.webSocket.readyState,binaryType:e.webSocket.binaryType,extensions:e.webSocket.extensions}),e.emit(Ud,{ws:e.webSocket,tm:e.transactionManager}),e.webSocket):new Promise((t,r)=>{e.webSocket=new WebSocket(e.wsUrl),e.transactionManager=new _d(e.webSocket),e.webSocket.onopen=()=>{Bd.info("WebSocket opened"),e.transactionManager.on("event",t=>{e.emit(Fd,t)}),Bd.info("Connected to server: ",e.webSocket.url),Bd.debug("WebSocket value: ",{url:e.webSocket.url,protocol:e.webSocket.protocol,readyState:e.webSocket.readyState,binaryType:e.webSocket.binaryType,extensions:e.webSocket.extensions}),e.emit(Ud,{ws:e.webSocket,tm:e.transactionManager}),t(e.webSocket)},e.webSocket.onerror=()=>{Bd.error("WebSocket not connected: ",e.webSocket.url),e.emit(Vd,e.webSocket.url),r(e.webSocket.url)},e.webSocket.onclose=()=>{e.webSocket=null,e.transactionManager=null,Bd.info("Connection closed with Signaling Server."),e.emit("wsConnectionClose")}})}))()}close(){var e;Bd.info("Closing connection with Signaling Server."),null===(e=this.webSocket)||void 0===e||e.close()}subscribe(e,t){var r=arguments,n=this;return D((function*(){let i=r.length>2&&void 0!==r[2]?r[2]:null,o=r.length>3&&void 0!==r[3]?r[3]:null;Bd.info("Starting subscription to streamName: ",n.streamName),Bd.debug("Subcription local description: ",e);const s=Gd(t,i,o),a={sdp:e=pd.adaptCodecName(e,"AV1X",zd.AV1),streamId:n.streamName,pinnedSourceId:s.pinnedSourceId,excludedSourceIds:s.excludedSourceIds};s.vad&&(a.vad=!0),Array.isArray(s.events)&&(a.events=s.events);try{var c,u,l,d,f;yield n.connect(),Bd.info("Sending view command");const e=yield n.transactionManager.cmd("view",a),t=null===(c=(u=RTCRtpReceiver).getCapabilities)||void 0===c||null===(l=c.call(u,"video"))||void 0===l||null===(d=l.codecs)||void 0===d||null===(f=d.find)||void 0===f?void 0:f.call(d,e=>"video/AV1X"===e.mimeType);return e.sdp=t?pd.adaptCodecName(e.sdp,zd.AV1,"AV1X"):e.sdp,Bd.info("Command sent, subscriberId: ",e.subscriberId),Bd.debug("Command result: ",e),n.serverId=e.subscriberId,n.clusterId=e.clusterId,e.sdp}catch(e){throw Bd.error("Error sending view command, error: ",e),e}}))()}publish(e,t){var r=arguments,n=this;return D((function*(){const i=Wd(t,r.length>2&&void 0!==r[2]?r[2]:null,r.length>3&&void 0!==r[3]?r[3]:null);Bd.info("Starting publishing to streamName: ".concat(n.streamName,", codec: ").concat(i.codec)),Bd.debug("Publishing local description: ",e);const o=Object.values(zd);if(-1===o.indexOf(i.codec))throw Bd.error("Invalid codec. Possible values are: ",o),new Error("Invalid codec. Possible values are: ".concat(o));i.codec===zd.AV1&&(e=pd.adaptCodecName(e,"AV1X",zd.AV1));const s={name:n.streamName,sdp:e,codec:i.codec,sourceId:i.sourceId};null!==i.record&&(s.record=i.record),Array.isArray(i.events)&&(s.events=i.events);try{yield n.connect(),Bd.info("Sending publish command");const e=yield n.transactionManager.cmd("publish",s);if(i.codec===zd.AV1){var a,c,u,l,d;const t=null===(a=(c=RTCRtpSender).getCapabilities)||void 0===a||null===(u=a.call(c,"video"))||void 0===u||null===(l=u.codecs)||void 0===l||null===(d=l.find)||void 0===d?void 0:d.call(l,e=>"video/AV1X"===e.mimeType);e.sdp=t?pd.adaptCodecName(e.sdp,zd.AV1,"AV1X"):e.sdp}return Bd.info("Command sent, publisherId: ",e.publisherId),Bd.debug("Command result: ",e),n.serverId=e.publisherId,n.clusterId=e.clusterId,e.sdp}catch(e){throw Bd.error("Error sending publish command, error: ",e),e}}))()}cmd(e,t){var r=this;return D((function*(){return Bd.info("Sending cmd: ".concat(e)),r.transactionManager.cmd(e,t)}))()}}const Gd=(e,t,r)=>{let n="object"==typeof e?e:{};return 0===Object.keys(n).length&&(n={vad:e,pinnedSourceId:t,excludedSourceIds:r}),n},Wd=(e,t,r)=>{let n="object"==typeof e?e:{};if(0===Object.keys(n).length){const i=zd.H264;n={codec:null!=e?e:i,record:t,sourceId:r}}return n},qd=jn.get("PeerConnection"),Xd={track:"track",connectionStateChange:"connectionStateChange"},Yd={stereo:!1,mediaStream:null,codec:"h264",simulcast:!1,scalabilityMode:null,disableAudio:!1,disableVideo:!1,setSDPToPeer:!0};class Md extends zc{constructor(){super(),this.sessionDescription=null,this.peer=null,this.peerConnectionStats=null}createRTCPeer(){var e=arguments,t=this;return D((function*(){let r=e.length>0&&void 0!==e[0]?e[0]:null;qd.info("Creating new RTCPeerConnection"),qd.debug("RTC configuration provided by user: ",r),t.peer=Jd(t,r)}))()}getRTCPeer(){return qd.info("Getting RTC Peer"),this.peer}closeRTCPeer(){var e=this;return D((function*(){var t;qd.info("Closing RTCPeerConnection"),null===(t=e.peer)||void 0===t||t.close(),e.peer=null,e.stopStats(),e.emit(Xd.connectionStateChange,"closed")}))()}setRTCRemoteSDP(e){var t=this;return D((function*(){qd.info("Setting RTC Remote SDP");const r={type:"answer",sdp:e};try{yield t.peer.setRemoteDescription(r),qd.info("RTC Remote SDP was set successfully."),qd.debug("RTC Remote SDP new value: ",e)}catch(e){throw qd.error("Error while setting RTC Remote SDP: ",e),e}}))()}getRTCLocalSDP(){var e=arguments,t=this;return D((function*(){let r=e.length>0&&void 0!==e[0]?e[0]:Yd;qd.info("Getting RTC Local SDP"),r=O(O({},Yd),r),qd.debug("Options: ",r);const n=Qd(r.mediaStream);n?ef(t.peer,n,r):tf(t.peer,r),qd.info("Creating peer offer");const i=yield t.peer.createOffer();return qd.info("Peer offer created"),qd.debug("Peer offer response: ",i.sdp),t.sessionDescription=i,r.disableAudio||(r.stereo&&(t.sessionDescription.sdp=pd.setStereo(t.sessionDescription.sdp)),r.dtx&&(t.sessionDescription.sdp=pd.setDTX(t.sessionDescription.sdp)),t.sessionDescription.sdp=pd.setMultiopus(t.sessionDescription.sdp,n)),!r.disableVideo&&r.simulcast&&(t.sessionDescription.sdp=pd.setSimulcast(t.sessionDescription.sdp,r.codec)),r.absCaptureTime&&(t.sessionDescription.sdp=pd.setAbsoluteCaptureTime(t.sessionDescription.sdp)),r.dependencyDescriptor&&(t.sessionDescription.sdp=pd.setDependencyDescriptor(t.sessionDescription.sdp)),r.setSDPToPeer&&(yield t.peer.setLocalDescription(t.sessionDescription),qd.info("Peer local description set")),t.sessionDescription.sdp}))()}addRemoteTrack(e,t){var r=this;return D((function*(){const n=yield new Promise((n,i)=>{try{const i=r.peer.addTransceiver(e,{direction:"recvonly"});i.resolve=n,i.streams=t}catch(e){i(e)}});var i,o=B(t);try{for(o.s();!(i=o.n()).done;)i.value.addTrack(n.receiver.track)}catch(e){o.e(e)}finally{o.f()}return n}))()}updateBandwidthRestriction(e,t){return qd.info("Updating bandwidth restriction, bitrate value: ",t),qd.debug("SDP value: ",e),pd.setVideoBitrate(e,t)}updateBitrate(){var e=arguments,t=this;return D((function*(){let r=e.length>0&&void 0!==e[0]?e[0]:0;if(!t.peer)throw qd.error("Cannot update bitrate. No peer found."),new Error("Cannot update bitrate. No peer found.");qd.info("Updating bitrate to value: ",r),t.sessionDescription=yield t.peer.createOffer(),yield t.peer.setLocalDescription(t.sessionDescription);const n=t.updateBandwidthRestriction(t.peer.remoteDescription.sdp,r);yield t.setRTCRemoteSDP(n),qd.info("Bitrate restirctions updated: ","".concat(r>0?r:"unlimited"," kbps"))}))()}getRTCPeerStatus(){if(qd.info("Getting RTC peer status"),!this.peer)return null;const e=rf(this.peer);return qd.info("RTC peer status getted, value: ",e),e}replaceTrack(e){if(!this.peer)return void qd.error("Could not change track if there is not an active connection.");const t=this.peer.getSenders().find(t=>t.track.kind===e.kind);t?t.replaceTrack(e):qd.error("There is no ".concat(e.kind," track in active broadcast."))}static getCapabilities(e){const t=new ad;if(t.isFirefox())return(e=>"video"===e?{codecs:[{codec:"vp8",mimeType:"video/VP8"},{codec:"vp9",mimeType:"video/VP9"},{codec:"h264",mimeType:"video/H264"}],headerExtensions:[]}:"audio"===e?{codecs:[{codec:"opus",mimeType:"audio/opus",channels:2}],headerExtensions:[]}:null)(e);const r=RTCRtpSender.getCapabilities(e);if(r){const o={};let s=new RegExp("^video/(".concat(Object.values(zd).join("|"),")x?$"),"i");"audio"===e&&(s=new RegExp("^audio/(".concat(Object.values($d).join("|"),")$"),"i"),t.isChrome()&&(o.multiopus={mimeType:"audio/multiopus",channels:6}));var n,i=B(r.codecs);try{for(i.s();!(n=i.n()).done;){const e=n.value,t=e.mimeType.match(s);if(t){const r=t[1].toLowerCase();if(o[r]=O(O({},o[r]),{},{mimeType:e.mimeType}),e.scalabilityModes){let t=o[r].scalabilityModes||[];t=[...t,...e.scalabilityModes],o[r].scalabilityModes=[...new Set(t)]}e.channels&&(o[r].channels=e.channels)}}}catch(e){i.e(e)}finally{i.f()}r.codecs=Object.keys(o).map(e=>O({codec:e},o[e]))}return r}getTracks(){var e,t;return null===(e=this.peer)||void 0===e||null===(t=e.getSenders())||void 0===t?void 0:t.map(e=>e.track)}initStats(){this.peerConnectionStats?qd.warn("Cannot init peer stats: Already initialized"):this.peer?(this.peerConnectionStats=new Gc(this.peer),this.peerConnectionStats.init(),eu(this.peerConnectionStats,this,["stats"])):qd.warn("Cannot init peer stats: RTCPeerConnection not initialized")}stopStats(){var e;null===(e=this.peerConnectionStats)||void 0===e||e.stop(),this.peerConnectionStats=null}}const Kd=e=>(null==e?void 0:e.getAudioTracks().length)<=1&&(null==e?void 0:e.getVideoTracks().length)<=1,Qd=e=>{if(!e)return null;if(e instanceof MediaStream&&Kd(e))return e;if(!(e instanceof MediaStream)){qd.info("Creating MediaStream to add received tracks.");const n=new MediaStream;var t,r=B(e);try{for(r.s();!(t=r.n()).done;){const e=t.value;n.addTrack(e)}}catch(e){r.e(e)}finally{r.f()}if(Kd(n))return n}throw qd.error("MediaStream must have 1 audio track and 1 video track, or at least one of them."),new Error("MediaStream must have 1 audio track and 1 video track, or at least one of them.")},Jd=(e,t)=>{const r=new RTCPeerConnection(t);return Zd(e,r),r},Zd=(e,t)=>{var r;t.ontrack=t=>{var r;if(qd.info("New track from peer."),qd.debug("Track event value: ",t),null!=t&&null!==(r=t.transceiver)&&void 0!==r&&r.resolve){const e=t.transceiver.resolve;delete t.transceiver.resolve,e(t.transceiver)}e.emit(Xd.track,t)},t.connectionState?t.onconnectionstatechange=r=>{qd.info("Peer connection state change: ",t.connectionState),e.emit(Xd.connectionStateChange,t.connectionState)}:t.oniceconnectionstatechange=r=>{qd.info("Peer ICE connection state change: ",t.iceConnectionState),e.emit(Xd.connectionStateChange,t.iceConnectionState)},t.onnegotiationneeded=(r=D((function*(e){if(!t.remoteDescription)return;qd.info("Peer onnegotiationneeded, updating local description");const r=yield t.createOffer();qd.info("Peer onnegotiationneeded, got local offer",r.sdp),r.sdp=pd.updateMissingVideoExtensions(r.sdp,t.remoteDescription.sdp),yield t.setLocalDescription(r);const n=pd.renegotiate(r.sdp,t.remoteDescription.sdp);qd.info("Peer onnegotiationneeded, updating remote description",n),yield t.setRemoteDescription({type:"answer",sdp:n}),qd.info("Peer onnegotiationneeded, renegotiation done")})),function(e){return r.apply(this,arguments)})},ef=(e,t,r)=>{qd.info("Adding mediaStream tracks to RTCPeerConnection");var n,i=B(t.getTracks());try{for(i.s();!(n=i.n()).done;){const i=n.value,o={streams:[t]};"audio"===i.kind&&(o.direction=r.disableAudio?"inactive":"sendonly"),"video"===i.kind&&(o.direction=r.disableVideo?"inactive":"sendonly",r.scalabilityMode&&(new ad).isChrome()?(qd.debug("Video track with scalability mode: ".concat(r.scalabilityMode,".")),o.sendEncodings=[{scalabilityMode:r.scalabilityMode}]):r.scalabilityMode&&qd.warn("SVC is only supported in Google Chrome")),e.addTransceiver(i,o),qd.info("Track '".concat(i.label,"' added: "),"id: ".concat(i.id),"kind: ".concat(i.kind))}}catch(e){i.e(e)}finally{i.f()}},tf=(e,t)=>{t.disableVideo||e.addTransceiver("video",{direction:"recvonly"}),t.disableAudio||e.addTransceiver("audio",{direction:"recvonly"});for(let r=0;r<t.multiplexedAudioTracks;r++)e.addTransceiver("audio",{direction:"recvonly"})},rf=e=>{var t;const r=null!==(t=e.connectionState)&&void 0!==t?t:e.iceConnectionState;switch(r){case"checking":return"connecting";case"completed":return"connected";default:return r}},nf=jn.get("Director");let sf="",af="https://realtime1.wowza.com";class Hd{static setEndpoint(e){af=e.replace(/\/$/,"")}static getEndpoint(){return af}static setLiveDomain(e){sf=e.replace(/\/$/,"")}static getLiveDomain(){return sf}static getPublisher(e){var t=arguments,r=this;return D((function*(){const n=cf(e,t.length>1&&void 0!==t[1]?t[1]:null,t.length>2&&void 0!==t[2]?t[2]:"WebRtc");nf.info("Getting publisher connection path for stream name: ",n.streamName);const i={streamName:n.streamName,streamType:n.streamType},o={"Content-Type":"application/json",Authorization:"Bearer ".concat(n.token)},s="".concat(r.getEndpoint(),"/api/director/publish");try{let e=yield fetch(s,{method:"POST",headers:o,body:JSON.stringify(i)});if(e=yield e.json(),"fail"===e.status)throw new Error(e.data.message);return e=lf(e),nf.debug("Getting publisher response: ",e),e.data}catch(e){throw nf.error("Error while getting publisher connection path. ",e),e}}))()}static getSubscriber(e){var t=arguments,r=this;return D((function*(){const n=uf(e,t.length>1&&void 0!==t[1]?t[1]:null,t.length>2&&void 0!==t[2]?t[2]:null);nf.info("Getting subscriber connection data for stream name: ".concat(n.streamName," and account id: ").concat(n.streamAccountId));const i={streamAccountId:n.streamAccountId,streamName:n.streamName};let o={"Content-Type":"application/json"};n.subscriberToken&&(o=O(O({},o),{},{Authorization:"Bearer ".concat(n.subscriberToken)}));const s="".concat(r.getEndpoint(),"/api/director/subscribe");try{let e=yield fetch(s,{method:"POST",headers:o,body:JSON.stringify(i)});if(e=yield e.json(),"fail"===e.status)throw new Error(e.data.message);return e=lf(e),nf.debug("Getting subscriber response: ",e),e.data}catch(e){throw nf.error("Error while getting subscriber connection path. ",e),e}}))()}}const cf=(e,t,r)=>{let n="object"==typeof e?e:{};return 0===Object.keys(n).length&&(n={token:e,streamName:t,streamType:r}),n},uf=(e,t,r)=>{let n="object"==typeof e?e:{};return 0===Object.keys(n).length&&(n={streamName:e,streamAccountId:t,subscriberToken:r}),n=O(O({},n),{},{streamAccountId:"bUEzT6"}),n},lf=e=>{if(Hd.getLiveDomain()){const t=/\/\/(.*?)\//,r=e.data.urls.map(e=>{const r=t.exec(e);return e.replace(r[1],Hd.getLiveDomain())});e.data.urls=r}return e};function df(e){this.message=e}function pf(e){this.message=e}let hf;df.prototype=new Error,df.prototype.name="InvalidCharacterError","undefined"!=typeof window&&window.atob&&window.atob.bind(window),pf.prototype=new Error,pf.prototype.name="InvalidTokenError",V((function(e,t){!function(r){if(null!=t&&"number"!=typeof t.nodeType)e.exports=r();else{var n=r(),i="undefined"!=typeof self?self:$.global;"function"!=typeof i.btoa&&(i.btoa=n.btoa),"function"!=typeof i.atob&&(i.atob=n.atob)}}((function(){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function t(e){this.message=e}return t.prototype=new Error,t.prototype.name="InvalidCharacterError",{btoa:function(r){for(var n,i,o=String(r),s=0,a=e,c="";o.charAt(0|s)||(a="=",s%1);c+=a.charAt(63&n>>8-s%1*8)){if((i=o.charCodeAt(s+=3/4))>255)throw new t("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");n=n<<8|i}return c},atob:function(r){var n=String(r).replace(/[=]+$/,"");if(n.length%4==1)throw new t("'atob' failed: The string to be decoded is not correctly encoded.");for(var i,o,s=0,a=0,c="";o=n.charAt(a++);~o&&(i=s%4?64*i+o:o,s++%4)?c+=String.fromCharCode(255&i>>(-2*s&6)):0)o=e.indexOf(o);return c}}}))}));class of extends zc{constructor(e,t,r,n){if(super(),hf=r,!e)throw hf.error("Stream Name is required to construct this module."),new Error("Stream Name is required to construct this module.");if(!t)throw hf.error("Token generator is required to construct this module."),new Error("Token generator is required to construct this module.");this.webRTCPeer=new Md,this.signaling=null,this.streamName=e,this.autoReconnect=n,this.reconnectionInterval=1e3,this.alreadyDisconnected=!1,this.firstReconnection=!0,this.stopReconnection=!1,this.tokenGenerator=t,this.options=null}getRTCPeerConnection(){return this.webRTCPeer?this.webRTCPeer.getRTCPeer():null}stop(){var e;hf.info("Stopping"),this.webRTCPeer.closeRTCPeer(),null===(e=this.signaling)||void 0===e||e.close(),this.signaling=null,this.stopReconnection=!0,this.webRTCPeer=new Md}isActive(){const e=this.webRTCPeer.getRTCPeerStatus();return hf.info("Broadcast status: ",e||"not_established"),"connected"===e}setReconnect(){this.signaling.on("migrate",()=>this.replaceConnection()),this.autoReconnect&&(this.signaling.on(Vd,()=>{!this.firstReconnection&&this.alreadyDisconnected||(this.firstReconnection=!1,this.reconnect())}),this.webRTCPeer.on(Xd.connectionStateChange,e=>{("failed"===e||"disconnected"===e&&this.alreadyDisconnected)&&this.firstReconnection?(this.firstReconnection=!1,this.reconnect()):"disconnected"===e?(this.alreadyDisconnected=!0,setTimeout(()=>this.reconnect(),1500)):this.alreadyDisconnected=!1}))}reconnect(){var e=this;return D((function*(){try{e.isActive()||e.stopReconnection||(e.stop(),yield e.connect(e.options),e.alreadyDisconnected=!1,e.reconnectionInterval=1e3,e.firstReconnection=!0)}catch(t){e.reconnectionInterval=mf(e.reconnectionInterval),hf.error("Reconnection failed, retrying in ".concat(e.reconnectionInterval,"ms. "),t),e.emit("reconnect",{timeout:e.reconnectionInterval,error:t}),setTimeout(()=>e.reconnect(),e.reconnectionInterval)}}))()}}const mf=e=>e<32e3?2*e:e;jn.get("Publish");const gf=jn.get("View"),vf={disableVideo:!1,disableAudio:!1,peerConfig:{}};class ff extends of{constructor(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;super(e,t,gf,!(arguments.length>3&&void 0!==arguments[3])||arguments[3]),r&&this.on(Xd.track,e=>{r.srcObject=e.streams[0]})}connect(){var e=arguments,t=this;return D((function*(){let r=e.length>0&&void 0!==e[0]?e[0]:vf;t.options=O(O(O({},vf),r),{},{setSDPToPeer:!1}),yield t.initConnection({migrate:!1})}))()}select(){var e=arguments,t=this;return D((function*(){let r=e.length>0&&void 0!==e[0]?e[0]:{};gf.debug("Viewer select layer values: ",r),yield t.signaling.cmd("select",{layer:r}),gf.info("Connected to streamName: ",t.streamName)}))()}addRemoteTrack(e,t){var r=this;return D((function*(){return gf.info("Viewer adding remote % track",e),r.webRTCPeer.addRemoteTrack(e,t)}))()}project(e,t){var r=this;return D((function*(){var n,i=B(t);try{for(i.s();!(n=i.n()).done;){const e=n.value;if(!e.trackId&&!e.media)throw gf.error("Error in projection mapping, trackId or mediaId must be set"),new Error("Error in projection mapping, trackId or mediaId must be set");const t=r.webRTCPeer.getRTCPeer();if(e.mediaId&&!t.getTransceivers().find(t=>t.mid===e.mediaId.toString()))throw gf.error("Error in projection mapping, ".concat(e.mediaId," mid not found in local transceivers")),new Error("Error in projection mapping, ".concat(e.mediaId," mid not found in local transceivers"))}}catch(e){i.e(e)}finally{i.f()}gf.debug("Viewer project source: layer mappings: ",e,t),yield r.signaling.cmd("project",{sourceId:e,mapping:t}),gf.info("Projection done")}))()}unproject(e){var t=this;return D((function*(){gf.debug("Viewer unproject mediaIds: ",e),yield t.signaling.cmd("unproject",{mediaIds:e}),gf.info("Unprojection done")}))()}replaceConnection(){var e=this;return D((function*(){gf.info("Migrating current connection"),yield e.initConnection({migrate:!0})}))()}initConnection(e){var t=this;return D((function*(){var r,n;let i,o;if(gf.debug("Viewer connect options values: ",t.options),t.stopReconnection=!1,!e.migrate&&t.isActive())throw gf.warn("Viewer currently subscribed"),new Error("Viewer currently subscribed");try{var s;o=yield t.tokenGenerator(),t.options.peerConfig.iceServers=null===(s=o)||void 0===s?void 0:s.iceServers}catch(e){throw gf.error("Error generating token."),e}if(!o)throw gf.error("Error while subscribing. Subscriber data required"),new Error("Subscriber data required");const a=new Pd({streamName:t.streamName,url:"".concat(o.urls[0],"?token=").concat(o.jwt)}),c=e.migrate?new Md:t.webRTCPeer;yield c.createRTCPeer(t.options.peerConfig),null===(r=t.stopReemitingWebRTCPeerInstanceEvents)||void 0===r||r.call(t),null===(n=t.stopReemitingSignalingInstanceEvents)||void 0===n||n.call(t),t.stopReemitingWebRTCPeerInstanceEvents=eu(c,t,Object.values(Xd)),t.stopReemitingSignalingInstanceEvents=eu(a,t,[Fd]);const u=c.getRTCLocalSDP(O(O({},t.options),{},{stereo:!0})),l=a.connect();i=yield Promise.all([u,l]);const d=i[0];let f=t.signaling;t.signaling=a;const p=t.signaling.subscribe(d,O(O({},t.options),{},{vad:t.options.multiplexedAudioTracks>0})),h=c.peer.setLocalDescription(c.sessionDescription);i=yield Promise.all([p,h]);const m=i[0];yield c.setRTCRemoteSDP(m),gf.info("Connected to streamName: ",t.streamName);let g=t.webRTCPeer;t.webRTCPeer=c,t.setReconnect(),e.migrate&&t.webRTCPeer.on(Xd.connectionStateChange,e=>{if("connected"===e)setTimeout(()=>{var e,t,r,n;null===(e=f)||void 0===e||null===(t=e.close)||void 0===t||t.call(e),null===(r=g)||void 0===r||null===(n=r.closeRTCPeer)||void 0===n||n.call(r),f=g=null,gf.info("Current connection migrated")},1e3);else if(["disconnected","failed","closed"].includes(e)){var t,r,n,i;null===(t=f)||void 0===t||null===(r=t.close)||void 0===r||r.call(t),null===(n=g)||void 0===n||null===(i=n.closeRTCPeer)||void 0===i||i.call(n),f=g=null}})}))()}}var yf;!function(e){e[e.Err=0]="Err",e[e.Idle=1]="Idle",e[e.Receiving=2]="Receiving",e[e.Broadcasting=3]="Broadcasting"}(yf||(yf={}));class MillicastAdapter{constructor(e,r,n=t("rts/millicast")){this.player=e,this.src=r,this.log=n}static wants(e){return e.type==MillicastAdapter.Type}async load(){this.log("loading",this.src.streamName);(this.engine=new ff(this.src.streamName,()=>Hd.getSubscriber(this.src),this.player)).on("broadcastEvent",e=>{switch(e.name){case"active":return this.handleActive(e);case"inactive":return this.handleInactive(e)}}),await this.connect()}handleActive(e){return this.player.hasState("is-error")&&this.player.emit("recover"),this.player.emit("rts/status",{status:yf.Receiving})}handleInactive(e){const t={status:yf.Idle,message:this.player.i18n("rts.millicast.inactive","broadcast has become inactive")};this.player.emit("rts/status",t),this.player.emit("error",Object.assign({fatal:!1},t))}async connect(){try{await this._connect()}catch(e){this.log("Connection failed",e),this.player.emit("error",e),setTimeout(()=>{0==this.player.reaper||this.player.currentSrc||(this.player.emit("recover"),this.connect())},3e3)}}async _connect(){var e;const t=this.engine;t&&(await t.connect(),null===(e=t.webRTCPeer)||void 0===e||e.initStats())}stop(){var e;null===(e=this.engine)||void 0===e||e.stop()}}
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.rts=t())}(this,(function(){"use strict";var e="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function t(e,t){const r=function(){try{return localStorage.getItem("flowplayer/debug")}catch(e){return""}}(),n=(n,...i)=>{try{const o=(null==t?void 0:t.debug)||r;o&&e.match(o)&&console.log(`flowplayer/${e} -- ${n}`,...i)}catch(e){console.warn(e)}};return n.log=n,n}function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}var i=r,o=n;function s(e){if(i===setTimeout)return setTimeout(e,0);if((i===r||!i)&&setTimeout)return i=setTimeout,setTimeout(e,0);try{return i(e,0)}catch(t){try{return i.call(null,e,0)}catch(t){return i.call(this,e,0)}}}"function"==typeof e.setTimeout&&(i=setTimeout),"function"==typeof e.clearTimeout&&(o=clearTimeout);var a,c=[],u=!1,l=-1;function d(){u&&a&&(u=!1,a.length?c=a.concat(c):l=-1,c.length&&f())}function f(){if(!u){var e=s(d);u=!0;for(var t=c.length;t;){for(a=c,c=[];++l<t;)a&&a[l].run();l=-1,t=c.length}a=null,u=!1,function(e){if(o===clearTimeout)return clearTimeout(e);if((o===n||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(e);try{o(e)}catch(t){try{return o.call(null,e)}catch(t){return o.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}p.prototype.run=function(){this.fun.apply(null,this.array)};function h(){}var m=h,g=h,v=h,y=h,w=h,E=h,T=h;var I=e.performance||{},R=I.now||I.mozNow||I.msNow||I.oNow||I.webkitNow||function(){return(new Date).getTime()};var P=new Date;var k={nextTick:function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];c.push(new p(e,t)),1!==c.length||u||s(f)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:m,addListener:g,once:v,off:y,removeListener:w,removeAllListeners:E,emit:T,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*R.call(I),r=Math.floor(t),n=Math.floor(t%1*1e9);return e&&(r-=e[0],(n-=e[1])<0&&(r--,n+=1e9)),[r,n]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-P)/1e3}};function A(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function O(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?A(Object(r),!0).forEach((function(t){M(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):A(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function L(e,t,r,n,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,i)}function D(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function s(e){L(o,n,i,s,a,"next",e)}function a(e){L(o,n,i,s,a,"throw",e)}s(void 0)}))}}function M(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function N(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,s,a=[],c=!0,u=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(a.push(n.value),a.length!==t);c=!0);}catch(e){u=!0,i=e}finally{try{if(!c&&null!=r.return&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw i}}return a}}(e,t)||j(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 j(e,t){if(e){if("string"==typeof e)return B(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?B(e,t):void 0}}function B(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=j(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},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 o,s=!0,a=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){a=!0,o=e},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw o}}}}var U="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{};function V(e){var t={exports:{}};return e(t,t.exports),t.exports}var F,z,G=function(e){return e&&e.Math==Math&&e},W=G("object"==typeof globalThis&&globalThis)||G("object"==typeof window&&window)||G("object"==typeof self&&self)||G("object"==typeof U&&U)||function(){return this}()||Function("return this")(),q=function(e){try{return!!e()}catch(e){return!0}},H=!q((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),X=!q((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),Y=Function.prototype.call,J=X?Y.bind(Y):function(){return Y.apply(Y,arguments)},K={}.propertyIsEnumerable,Z=Object.getOwnPropertyDescriptor,Q={f:Z&&!K.call({1:2},1)?function(e){var t=Z(this,e);return!!t&&t.enumerable}:K},ee=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},te=Function.prototype,re=te.call,ne=X&&te.bind.bind(re,re),ie=X?ne:function(e){return function(){return re.apply(e,arguments)}},oe=ie({}.toString),se=ie("".slice),ae=function(e){return se(oe(e),8,-1)},ce=Object,ue=ie("".split),le=q((function(){return!ce("z").propertyIsEnumerable(0)}))?function(e){return"String"==ae(e)?ue(e,""):ce(e)}:ce,de=function(e){return null==e},fe=TypeError,pe=function(e){if(de(e))throw fe("Can't call method on "+e);return e},he=function(e){return le(pe(e))},me="object"==typeof document&&document.all,ge={all:me,IS_HTMLDDA:void 0===me&&void 0!==me},ve=ge.all,ye=ge.IS_HTMLDDA?function(e){return"function"==typeof e||e===ve}:function(e){return"function"==typeof e},we=ge.all,be=ge.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:ye(e)||e===we}:function(e){return"object"==typeof e?null!==e:ye(e)},Se=function(e){return ye(e)?e:void 0},Ce=function(e,t){return arguments.length<2?Se(W[e]):W[e]&&W[e][t]},xe=ie({}.isPrototypeOf),Ee=Ce("navigator","userAgent")||"",Te=W.process,Ie=W.Deno,Re=Te&&Te.versions||Ie&&Ie.version,Pe=Re&&Re.v8;Pe&&(z=(F=Pe.split("."))[0]>0&&F[0]<4?1:+(F[0]+F[1])),!z&&Ee&&(!(F=Ee.match(/Edge\/(\d+)/))||F[1]>=74)&&(F=Ee.match(/Chrome\/(\d+)/))&&(z=+F[1]);var ke=z,Ae=!!Object.getOwnPropertySymbols&&!q((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&ke&&ke<41})),Oe=Ae&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Le=Object,De=Oe?function(e){return"symbol"==typeof e}:function(e){var t=Ce("Symbol");return ye(t)&&xe(t.prototype,Le(e))},Me=String,Ne=function(e){try{return Me(e)}catch(e){return"Object"}},je=TypeError,Be=function(e){if(ye(e))return e;throw je(Ne(e)+" is not a function")},_e=function(e,t){var r=e[t];return de(r)?void 0:Be(r)},Ue=TypeError,Ve=Object.defineProperty,Fe=function(e,t){try{Ve(W,e,{value:t,configurable:!0,writable:!0})}catch(r){W[e]=t}return t},ze="__core-js_shared__",$e=W[ze]||Fe(ze,{}),Ge=V((function(e){(e.exports=function(e,t){return $e[e]||($e[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.26.1",mode:"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.26.1/LICENSE",source:"https://github.com/zloirock/core-js"})})),We=Object,qe=function(e){return We(pe(e))},He=ie({}.hasOwnProperty),Xe=Object.hasOwn||function(e,t){return He(qe(e),t)},Ye=0,Je=Math.random(),Ke=ie(1..toString),Ze=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Ke(++Ye+Je,36)},Qe=Ge("wks"),et=W.Symbol,tt=et&&et.for,rt=Oe?et:et&&et.withoutSetter||Ze,nt=function(e){if(!Xe(Qe,e)||!Ae&&"string"!=typeof Qe[e]){var t="Symbol."+e;Ae&&Xe(et,e)?Qe[e]=et[e]:Qe[e]=Oe&&tt?tt(t):rt(t)}return Qe[e]},it=TypeError,ot=nt("toPrimitive"),st=function(e){var t=function(e,t){if(!be(e)||De(e))return e;var r,n=_e(e,ot);if(n){if(void 0===t&&(t="default"),r=J(n,e,t),!be(r)||De(r))return r;throw it("Can't convert object to primitive value")}return void 0===t&&(t="number"),function(e,t){var r,n;if("string"===t&&ye(r=e.toString)&&!be(n=J(r,e)))return n;if(ye(r=e.valueOf)&&!be(n=J(r,e)))return n;if("string"!==t&&ye(r=e.toString)&&!be(n=J(r,e)))return n;throw Ue("Can't convert object to primitive value")}(e,t)}(e,"string");return De(t)?t:t+""},at=W.document,ct=be(at)&&be(at.createElement),ut=function(e){return ct?at.createElement(e):{}},lt=!H&&!q((function(){return 7!=Object.defineProperty(ut("div"),"a",{get:function(){return 7}}).a})),dt=Object.getOwnPropertyDescriptor,ft={f:H?dt:function(e,t){if(e=he(e),t=st(t),lt)try{return dt(e,t)}catch(e){}if(Xe(e,t))return ee(!J(Q.f,e,t),e[t])}},pt=H&&q((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),ht=String,mt=TypeError,gt=function(e){if(be(e))return e;throw mt(ht(e)+" is not an object")},vt=TypeError,yt=Object.defineProperty,wt=Object.getOwnPropertyDescriptor,bt="enumerable",St="configurable",Ct="writable",xt={f:H?pt?function(e,t,r){if(gt(e),t=st(t),gt(r),"function"==typeof e&&"prototype"===t&&"value"in r&&Ct in r&&!r[Ct]){var n=wt(e,t);n&&n[Ct]&&(e[t]=r.value,r={configurable:St in r?r[St]:n[St],enumerable:bt in r?r[bt]:n[bt],writable:!1})}return yt(e,t,r)}:yt:function(e,t,r){if(gt(e),t=st(t),gt(r),lt)try{return yt(e,t,r)}catch(e){}if("get"in r||"set"in r)throw vt("Accessors not supported");return"value"in r&&(e[t]=r.value),e}},Et=H?function(e,t,r){return xt.f(e,t,ee(1,r))}:function(e,t,r){return e[t]=r,e},Tt=Function.prototype,It=H&&Object.getOwnPropertyDescriptor,Rt=Xe(Tt,"name"),Pt={EXISTS:Rt,PROPER:Rt&&"something"===function(){}.name,CONFIGURABLE:Rt&&(!H||H&&It(Tt,"name").configurable)},kt=ie(Function.toString);ye($e.inspectSource)||($e.inspectSource=function(e){return kt(e)});var At,Ot,Lt,Dt=$e.inspectSource,Mt=W.WeakMap,Nt=ye(Mt)&&/native code/.test(String(Mt)),jt=Ge("keys"),Bt=function(e){return jt[e]||(jt[e]=Ze(e))},_t={},Ut="Object already initialized",Vt=W.TypeError,Ft=W.WeakMap;if(Nt||$e.state){var zt=$e.state||($e.state=new Ft);zt.get=zt.get,zt.has=zt.has,zt.set=zt.set,At=function(e,t){if(zt.has(e))throw Vt(Ut);return t.facade=e,zt.set(e,t),t},Ot=function(e){return zt.get(e)||{}},Lt=function(e){return zt.has(e)}}else{var $t=Bt("state");_t[$t]=!0,At=function(e,t){if(Xe(e,$t))throw Vt(Ut);return t.facade=e,Et(e,$t,t),t},Ot=function(e){return Xe(e,$t)?e[$t]:{}},Lt=function(e){return Xe(e,$t)}}var Gt={set:At,get:Ot,has:Lt,enforce:function(e){return Lt(e)?Ot(e):At(e,{})},getterFor:function(e){return function(t){var r;if(!be(t)||(r=Ot(t)).type!==e)throw Vt("Incompatible receiver, "+e+" required");return r}}},Wt=V((function(e){var t=Pt.CONFIGURABLE,r=Gt.enforce,n=Gt.get,i=Object.defineProperty,o=H&&!q((function(){return 8!==i((function(){}),"length",{value:8}).length})),s=String(String).split("String"),a=e.exports=function(e,n,a){"Symbol("===String(n).slice(0,7)&&(n="["+String(n).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),a&&a.getter&&(n="get "+n),a&&a.setter&&(n="set "+n),(!Xe(e,"name")||t&&e.name!==n)&&(H?i(e,"name",{value:n,configurable:!0}):e.name=n),o&&a&&Xe(a,"arity")&&e.length!==a.arity&&i(e,"length",{value:a.arity});try{a&&Xe(a,"constructor")&&a.constructor?H&&i(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var c=r(e);return Xe(c,"source")||(c.source=s.join("string"==typeof n?n:"")),e};Function.prototype.toString=a((function(){return ye(this)&&n(this).source||Dt(this)}),"toString")})),qt=function(e,t,r,n){n||(n={});var i=n.enumerable,o=void 0!==n.name?n.name:t;if(ye(r)&&Wt(r,o,n),n.global)i?e[t]=r:Fe(t,r);else{try{n.unsafe?e[t]&&(i=!0):delete e[t]}catch(e){}i?e[t]=r:xt.f(e,t,{value:r,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return e},Ht=Math.ceil,Xt=Math.floor,Yt=Math.trunc||function(e){var t=+e;return(t>0?Xt:Ht)(t)},Jt=function(e){var t=+e;return t!=t||0===t?0:Yt(t)},Kt=Math.max,Zt=Math.min,Qt=function(e,t){var r=Jt(e);return r<0?Kt(r+t,0):Zt(r,t)},er=Math.min,tr=function(e){return e>0?er(Jt(e),9007199254740991):0},rr=function(e){return tr(e.length)},nr=function(e){return function(t,r,n){var i,o=he(t),s=rr(o),a=Qt(n,s);if(e&&r!=r){for(;s>a;)if((i=o[a++])!=i)return!0}else for(;s>a;a++)if((e||a in o)&&o[a]===r)return e||a||0;return!e&&-1}},ir={includes:nr(!0),indexOf:nr(!1)},or=ir.indexOf,sr=ie([].push),ar=function(e,t){var r,n=he(e),i=0,o=[];for(r in n)!Xe(_t,r)&&Xe(n,r)&&sr(o,r);for(;t.length>i;)Xe(n,r=t[i++])&&(~or(o,r)||sr(o,r));return o},cr=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],ur=cr.concat("length","prototype"),lr={f:Object.getOwnPropertyNames||function(e){return ar(e,ur)}},dr={f:Object.getOwnPropertySymbols},fr=ie([].concat),pr=Ce("Reflect","ownKeys")||function(e){var t=lr.f(gt(e)),r=dr.f;return r?fr(t,r(e)):t},hr=function(e,t,r){for(var n=pr(t),i=xt.f,o=ft.f,s=0;s<n.length;s++){var a=n[s];Xe(e,a)||r&&Xe(r,a)||i(e,a,o(t,a))}},mr=/#|\.prototype\./,gr=function(e,t){var r=yr[vr(e)];return r==br||r!=wr&&(ye(t)?q(t):!!t)},vr=gr.normalize=function(e){return String(e).replace(mr,".").toLowerCase()},yr=gr.data={},wr=gr.NATIVE="N",br=gr.POLYFILL="P",Sr=gr,Cr=ft.f,xr=function(e,t){var r,n,i,o,s,a=e.target,c=e.global,u=e.stat;if(r=c?W:u?W[a]||Fe(a,{}):(W[a]||{}).prototype)for(n in t){if(o=t[n],i=e.dontCallGetSet?(s=Cr(r,n))&&s.value:r[n],!Sr(c?n:a+(u?".":"#")+n,e.forced)&&void 0!==i){if(typeof o==typeof i)continue;hr(o,i)}(e.sham||i&&i.sham)&&Et(o,"sham",!0),qt(r,n,o,e)}},Er=Array.isArray||function(e){return"Array"==ae(e)},Tr=TypeError,Ir=function(e){if(e>9007199254740991)throw Tr("Maximum allowed index exceeded");return e},Rr=function(e,t,r){var n=st(t);n in e?xt.f(e,n,ee(0,r)):e[n]=r},Pr={};Pr[nt("toStringTag")]="z";var kr="[object z]"===String(Pr),Ar=nt("toStringTag"),Or=Object,Lr="Arguments"==ae(function(){return arguments}()),Dr=kr?ae:function(e){var t,r,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(e){}}(t=Or(e),Ar))?r:Lr?ae(t):"Object"==(n=ae(t))&&ye(t.callee)?"Arguments":n},Mr=function(){},Nr=[],jr=Ce("Reflect","construct"),Br=/^\s*(?:class|function)\b/,_r=ie(Br.exec),Ur=!Br.exec(Mr),Vr=function(e){if(!ye(e))return!1;try{return jr(Mr,Nr,e),!0}catch(e){return!1}},Fr=function(e){if(!ye(e))return!1;switch(Dr(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Ur||!!_r(Br,Dt(e))}catch(e){return!0}};Fr.sham=!0;var zr=!jr||q((function(){var e;return Vr(Vr.call)||!Vr(Object)||!Vr((function(){e=!0}))||e}))?Fr:Vr,$r=nt("species"),Gr=Array,Wr=function(e,t){return new(function(e){var t;return Er(e)&&(t=e.constructor,(zr(t)&&(t===Gr||Er(t.prototype))||be(t)&&null===(t=t[$r]))&&(t=void 0)),void 0===t?Gr:t}(e))(0===t?0:t)},qr=nt("species"),Hr=function(e){return ke>=51||!q((function(){var t=[];return(t.constructor={})[qr]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},Xr=nt("isConcatSpreadable"),Yr=ke>=51||!q((function(){var e=[];return e[Xr]=!1,e.concat()[0]!==e})),Jr=Hr("concat"),Kr=function(e){if(!be(e))return!1;var t=e[Xr];return void 0!==t?!!t:Er(e)};xr({target:"Array",proto:!0,arity:1,forced:!Yr||!Jr},{concat:function(e){var t,r,n,i,o,s=qe(this),a=Wr(s,0),c=0;for(t=-1,n=arguments.length;t<n;t++)if(Kr(o=-1===t?s:arguments[t]))for(i=rr(o),Ir(c+i),r=0;r<i;r++,c++)r in o&&Rr(a,c,o[r]);else Ir(c+1),Rr(a,c++,o);return a.length=c,a}});var Zr=ie([].slice),Qr=Hr("slice"),en=nt("species"),tn=Array,rn=Math.max;xr({target:"Array",proto:!0,forced:!Qr},{slice:function(e,t){var r,n,i,o=he(this),s=rr(o),a=Qt(e,s),c=Qt(void 0===t?s:t,s);if(Er(o)&&(r=o.constructor,(zr(r)&&(r===tn||Er(r.prototype))||be(r)&&null===(r=r[en]))&&(r=void 0),r===tn||void 0===r))return Zr(o,a,c);for(n=new(void 0===r?tn:r)(rn(c-a,0)),i=0;a<c;a++,i++)a in o&&Rr(n,i,o[a]);return n.length=i,n}});var nn=function(e){if("Function"===ae(e))return ie(e)},on=nn(nn.bind),sn=function(e,t){return Be(e),void 0===t?e:X?on(e,t):function(){return e.apply(t,arguments)}},an=ie([].push),cn=function(e){var t=1==e,r=2==e,n=3==e,i=4==e,o=6==e,s=7==e,a=5==e||o;return function(c,u,l,d){for(var f,p,h=qe(c),m=le(h),g=sn(u,l),v=rr(m),y=0,w=d||Wr,E=t?w(c,v):r||s?w(c,0):void 0;v>y;y++)if((a||y in m)&&(p=g(f=m[y],y,h),e))if(t)E[y]=p;else if(p)switch(e){case 3:return!0;case 5:return f;case 6:return y;case 2:an(E,f)}else switch(e){case 4:return!1;case 7:an(E,f)}return o?-1:n||i?i:E}},un={forEach:cn(0),map:cn(1),filter:cn(2),some:cn(3),every:cn(4),find:cn(5),findIndex:cn(6),filterReject:cn(7)},ln=un.map,dn=Hr("map");xr({target:"Array",proto:!0,forced:!dn},{map:function(e){return ln(this,e,arguments.length>1?arguments[1]:void 0)}});var fn=Function.prototype,pn=fn.apply,hn=fn.call,mn="object"==typeof Reflect&&Reflect.apply||(X?hn.bind(pn):function(){return hn.apply(pn,arguments)}),gn=Ce("JSON","stringify"),vn=ie(/./.exec),yn=ie("".charAt),wn=ie("".charCodeAt),bn=ie("".replace),Sn=ie(1..toString),Cn=/[\uD800-\uDFFF]/g,xn=/^[\uD800-\uDBFF]$/,En=/^[\uDC00-\uDFFF]$/,Tn=!Ae||q((function(){var e=Ce("Symbol")();return"[null]"!=gn([e])||"{}"!=gn({a:e})||"{}"!=gn(Object(e))})),In=q((function(){return'"\\udf06\\ud834"'!==gn("\udf06\ud834")||'"\\udead"'!==gn("\udead")})),Rn=function(e,t){var r=Zr(arguments),n=t;if((be(t)||void 0!==e)&&!De(e))return Er(t)||(t=function(e,t){if(ye(n)&&(t=J(n,this,e,t)),!De(t))return t}),r[1]=t,mn(gn,null,r)},Pn=function(e,t,r){var n=yn(r,t-1),i=yn(r,t+1);return vn(xn,e)&&!vn(En,i)||vn(En,e)&&!vn(xn,n)?"\\u"+Sn(wn(e,0),16):e};gn&&xr({target:"JSON",stat:!0,arity:3,forced:Tn||In},{stringify:function(e,t,r){var n=Zr(arguments),i=mn(Tn?Rn:gn,null,n);return In&&"string"==typeof i?bn(i,Cn,Pn):i}});var kn=V((function(e){!function(t){var r,n={VERSION:"1.6.1"},i={},o=function(e,t){return function(){return t.apply(e,arguments)}},s=function(){var e,t,r=arguments,n=r[0];for(t=1;t<r.length;t++)for(e in r[t])!(e in n)&&r[t].hasOwnProperty(e)&&(n[e]=r[t][e]);return n},a=function(e,t){return{value:e,name:t}};n.TRACE=a(1,"TRACE"),n.DEBUG=a(2,"DEBUG"),n.INFO=a(3,"INFO"),n.TIME=a(4,"TIME"),n.WARN=a(5,"WARN"),n.ERROR=a(8,"ERROR"),n.OFF=a(99,"OFF");var c=function(e){this.context=e,this.setLevel(e.filterLevel),this.log=this.info};c.prototype={setLevel:function(e){e&&"value"in e&&(this.context.filterLevel=e)},getLevel:function(){return this.context.filterLevel},enabledFor:function(e){var t=this.context.filterLevel;return e.value>=t.value},trace:function(){this.invoke(n.TRACE,arguments)},debug:function(){this.invoke(n.DEBUG,arguments)},info:function(){this.invoke(n.INFO,arguments)},warn:function(){this.invoke(n.WARN,arguments)},error:function(){this.invoke(n.ERROR,arguments)},time:function(e){"string"==typeof e&&e.length>0&&this.invoke(n.TIME,[e,"start"])},timeEnd:function(e){"string"==typeof e&&e.length>0&&this.invoke(n.TIME,[e,"end"])},invoke:function(e,t){r&&this.enabledFor(e)&&r(t,s({level:e},this.context))}};var u,l=new c({filterLevel:n.OFF});(u=n).enabledFor=o(l,l.enabledFor),u.trace=o(l,l.trace),u.debug=o(l,l.debug),u.time=o(l,l.time),u.timeEnd=o(l,l.timeEnd),u.info=o(l,l.info),u.warn=o(l,l.warn),u.error=o(l,l.error),u.log=u.info,n.setHandler=function(e){r=e},n.setLevel=function(e){for(var t in l.setLevel(e),i)i.hasOwnProperty(t)&&i[t].setLevel(e)},n.getLevel=function(){return l.getLevel()},n.get=function(e){return i[e]||(i[e]=new c(s({name:e},l.context)))},n.createDefaultHandler=function(e){(e=e||{}).formatter=e.formatter||function(e,t){t.name&&e.unshift("["+t.name+"]")};var t={},r=function(e,t){Function.prototype.apply.call(e,console,t)};return"undefined"==typeof console?function(){}:function(i,o){i=Array.prototype.slice.call(i);var s,a=console.log;o.level===n.TIME?(s=(o.name?"["+o.name+"] ":"")+i[0],"start"===i[1]?console.time?console.time(s):t[s]=(new Date).getTime():console.timeEnd?console.timeEnd(s):r(a,[s+": "+((new Date).getTime()-t[s])+"ms"])):(o.level===n.WARN&&console.warn?a=console.warn:o.level===n.ERROR&&console.error?a=console.error:o.level===n.INFO&&console.info?a=console.info:o.level===n.DEBUG&&console.debug?a=console.debug:o.level===n.TRACE&&console.trace&&(a=console.trace),e.formatter(i,o),r(a,i))}},n.useDefaults=function(e){n.setLevel(e&&e.defaultLevel||n.DEBUG),n.setHandler(n.createDefaultHandler(e))},n.setDefaults=n.useDefaults,e.exports?e.exports=n:(n._prevLogger=t.Logger,n.noConflict=function(){return t.Logger=n._prevLogger,n},t.Logger=n)}(U)}));kn.useDefaults({defaultLevel:kn.TRACE});const An=(e,t)=>{e.unshift("[".concat(t.name||"Global","] ").concat((new Date).toISOString()," - ").concat(t.level.name," -"))},On=(e,t)=>t?e.value>=jn[t].value:e.value>=Nn.value,Ln=kn.createDefaultHandler({formatter:An});kn.setHandler((e,t)=>{((e,t)=>{e=(e=Array.prototype.slice.call(e)).map(e=>"object"==typeof e?JSON.stringify(e):e),An(e,t),0!==Dn?(Mn.push(e.join(" ")),Mn.length>=Dn&&(Mn=Mn.slice(-Dn))):Mn=[]})(e,t),On(t.level,t.name)&&Ln(e,t);var r,n=_(Bn);try{for(n.s();!(r=n.n()).done;){const n=r.value,i=n.handler,o=n.level;t.level.value>=o.value&&i(e,t)}}catch(e){n.e(e)}finally{n.f()}});let Dn=1e4,Mn=[],Nn=kn.OFF;const jn={},Bn=[],_n=O(O({},kn),{},{enabledFor:On,getHistory:()=>Mn,getHistoryMaxSize:()=>Dn,setHistoryMaxSize:e=>{Dn=e},setLevel:e=>{Nn=e;for(const t in jn)jn[t]=e},getLevel:()=>Nn,get:e=>{jn[e]||(jn[e]=Nn);const t=kn.get(e);return t.setLevel=t=>{jn[e]=t},t.getLevel=()=>jn[e],t},setHandler:(e,t)=>{Bn.push({handler:e,level:t})}});var Un,Vn,Fn,zn,$n="process"==ae(W.process),Gn=String,Wn=TypeError,qn=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=ie(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(r,[]),t=r instanceof Array}catch(e){}return function(r,n){return gt(r),function(e){if("object"==typeof e||ye(e))return e;throw Wn("Can't set "+Gn(e)+" as a prototype")}(n),t?e(r,n):r.__proto__=n,r}}():void 0),Hn=xt.f,Xn=nt("toStringTag"),Yn=function(e,t,r){e&&!r&&(e=e.prototype),e&&!Xe(e,Xn)&&Hn(e,Xn,{configurable:!0,value:t})},Jn=nt("species"),Kn=function(e){var t=Ce(e),r=xt.f;H&&t&&!t[Jn]&&r(t,Jn,{configurable:!0,get:function(){return this}})},Zn=TypeError,Qn=function(e,t){if(xe(t,e))return e;throw Zn("Incorrect invocation")},ei=TypeError,ti=nt("species"),ri=function(e,t){var r,n=gt(e).constructor;return void 0===n||de(r=gt(n)[ti])?t:function(e){if(zr(e))return e;throw ei(Ne(e)+" is not a constructor")}(r)},ni=Ce("document","documentElement"),ii=TypeError,oi=function(e,t){if(e<t)throw ii("Not enough arguments");return e},si=/(?:ipad|iphone|ipod).*applewebkit/i.test(Ee),ai=W.setImmediate,ci=W.clearImmediate,ui=W.process,li=W.Dispatch,di=W.Function,fi=W.MessageChannel,pi=W.String,hi=0,mi={},gi="onreadystatechange";try{Un=W.location}catch(Lf){}var vi=function(e){if(Xe(mi,e)){var t=mi[e];delete mi[e],t()}},yi=function(e){return function(){vi(e)}},wi=function(e){vi(e.data)},bi=function(e){W.postMessage(pi(e),Un.protocol+"//"+Un.host)};ai&&ci||(ai=function(e){oi(arguments.length,1);var t=ye(e)?e:di(e),r=Zr(arguments,1);return mi[++hi]=function(){mn(t,void 0,r)},Vn(hi),hi},ci=function(e){delete mi[e]},$n?Vn=function(e){ui.nextTick(yi(e))}:li&&li.now?Vn=function(e){li.now(yi(e))}:fi&&!si?(zn=(Fn=new fi).port2,Fn.port1.onmessage=wi,Vn=sn(zn.postMessage,zn)):W.addEventListener&&ye(W.postMessage)&&!W.importScripts&&Un&&"file:"!==Un.protocol&&!q(bi)?(Vn=bi,W.addEventListener("message",wi,!1)):Vn=gi in ut("script")?function(e){ni.appendChild(ut("script"))[gi]=function(){ni.removeChild(this),vi(e)}}:function(e){setTimeout(yi(e),0)});var Si,Ci,xi,Ei,Ti,Ii,Ri,Pi,ki={set:ai,clear:ci},Ai=/ipad|iphone|ipod/i.test(Ee)&&void 0!==W.Pebble,Oi=/web0s(?!.*chrome)/i.test(Ee),Li=ft.f,Di=ki.set,Mi=W.MutationObserver||W.WebKitMutationObserver,Ni=W.document,ji=W.process,Bi=W.Promise,_i=Li(W,"queueMicrotask"),Ui=_i&&_i.value;Ui||(Si=function(){var e,t;for($n&&(e=ji.domain)&&e.exit();Ci;){t=Ci.fn,Ci=Ci.next;try{t()}catch(e){throw Ci?Ei():xi=void 0,e}}xi=void 0,e&&e.enter()},si||$n||Oi||!Mi||!Ni?!Ai&&Bi&&Bi.resolve?((Ri=Bi.resolve(void 0)).constructor=Bi,Pi=sn(Ri.then,Ri),Ei=function(){Pi(Si)}):$n?Ei=function(){ji.nextTick(Si)}:(Di=sn(Di,W),Ei=function(){Di(Si)}):(Ti=!0,Ii=Ni.createTextNode(""),new Mi(Si).observe(Ii,{characterData:!0}),Ei=function(){Ii.data=Ti=!Ti}));var Vi=Ui||function(e){var t={fn:e,next:void 0};xi&&(xi.next=t),Ci||(Ci=t,Ei()),xi=t},Fi=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},zi=function(){this.head=null,this.tail=null};zi.prototype={add:function(e){var t={item:e,next:null};this.head?this.tail.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return this.head=e.next,this.tail===e&&(this.tail=null),e.item}};var $i=zi,Gi=W.Promise,Wi="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,qi=!Wi&&!$n&&"object"==typeof window&&"object"==typeof document;Gi&&Gi.prototype;var Hi,Xi,Yi,Ji=nt("species"),Ki=!1,Zi=ye(W.PromiseRejectionEvent),Qi={CONSTRUCTOR:Sr("Promise",(function(){var e=Dt(Gi),t=e!==String(Gi);if(!t&&66===ke)return!0;if(!ke||ke<51||!/native code/.test(e)){var r=new Gi((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};if((r.constructor={})[Ji]=n,!(Ki=r.then((function(){}))instanceof n))return!0}return!t&&(qi||Wi)&&!Zi})),REJECTION_EVENT:Zi,SUBCLASSING:Ki},eo=TypeError,to=function(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw eo("Bad Promise constructor");t=e,r=n})),this.resolve=Be(t),this.reject=Be(r)},ro={f:function(e){return new to(e)}},no=ki.set,io="Promise",oo=Qi.CONSTRUCTOR,so=Qi.REJECTION_EVENT,ao=Qi.SUBCLASSING,co=Gt.getterFor(io),uo=Gt.set,lo=Gi&&Gi.prototype,fo=Gi,po=lo,ho=W.TypeError,mo=W.document,go=W.process,vo=ro.f,yo=vo,wo=!!(mo&&mo.createEvent&&W.dispatchEvent),bo="unhandledrejection",So=function(e){var t;return!(!be(e)||!ye(t=e.then))&&t},Co=function(e,t){var r,n,i,o=t.value,s=1==t.state,a=s?e.ok:e.fail,c=e.resolve,u=e.reject,l=e.domain;try{a?(s||(2===t.rejection&&Ro(t),t.rejection=1),!0===a?r=o:(l&&l.enter(),r=a(o),l&&(l.exit(),i=!0)),r===e.promise?u(ho("Promise-chain cycle")):(n=So(r))?J(n,r,c,u):c(r)):u(o)}catch(e){l&&!i&&l.exit(),u(e)}},xo=function(e,t){e.notified||(e.notified=!0,Vi((function(){for(var r,n=e.reactions;r=n.get();)Co(r,e);e.notified=!1,t&&!e.rejection&&To(e)})))},Eo=function(e,t,r){var n,i;wo?((n=mo.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),W.dispatchEvent(n)):n={promise:t,reason:r},!so&&(i=W["on"+e])?i(n):e===bo&&function(e,t){var r=W.console;r&&r.error&&(1==arguments.length?r.error(e):r.error(e,t))}("Unhandled promise rejection",r)},To=function(e){J(no,W,(function(){var t,r=e.facade,n=e.value;if(Io(e)&&(t=Fi((function(){$n?go.emit("unhandledRejection",n,r):Eo(bo,r,n)})),e.rejection=$n||Io(e)?2:1,t.error))throw t.value}))},Io=function(e){return 1!==e.rejection&&!e.parent},Ro=function(e){J(no,W,(function(){var t=e.facade;$n?go.emit("rejectionHandled",t):Eo("rejectionhandled",t,e.value)}))},Po=function(e,t,r){return function(n){e(t,n,r)}},ko=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,xo(e,!0))},Ao=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw ho("Promise can't be resolved itself");var n=So(t);n?Vi((function(){var r={done:!1};try{J(n,t,Po(Ao,r,e),Po(ko,r,e))}catch(t){ko(r,t,e)}})):(e.value=t,e.state=1,xo(e,!1))}catch(t){ko({done:!1},t,e)}}};if(oo&&(po=(fo=function(e){Qn(this,po),Be(e),J(Hi,this);var t=co(this);try{e(Po(Ao,t),Po(ko,t))}catch(e){ko(t,e)}}).prototype,(Hi=function(e){uo(this,{type:io,done:!1,notified:!1,parent:!1,reactions:new $i,rejection:!1,state:0,value:void 0})}).prototype=qt(po,"then",(function(e,t){var r=co(this),n=vo(ri(this,fo));return r.parent=!0,n.ok=!ye(e)||e,n.fail=ye(t)&&t,n.domain=$n?go.domain:void 0,0==r.state?r.reactions.add(n):Vi((function(){Co(n,r)})),n.promise})),Xi=function(){var e=new Hi,t=co(e);this.promise=e,this.resolve=Po(Ao,t),this.reject=Po(ko,t)},ro.f=vo=function(e){return e===fo||void 0===e?new Xi(e):yo(e)},ye(Gi)&&lo!==Object.prototype)){Yi=lo.then,ao||qt(lo,"then",(function(e,t){var r=this;return new fo((function(e,t){J(Yi,r,e,t)})).then(e,t)}),{unsafe:!0});try{delete lo.constructor}catch(Lf){}qn&&qn(lo,po)}xr({global:!0,constructor:!0,wrap:!0,forced:oo},{Promise:fo}),Yn(fo,io,!1),Kn(io);var Oo={},Lo=nt("iterator"),Do=Array.prototype,Mo=function(e){return void 0!==e&&(Oo.Array===e||Do[Lo]===e)},No=nt("iterator"),jo=function(e){if(!de(e))return _e(e,No)||_e(e,"@@iterator")||Oo[Dr(e)]},Bo=TypeError,_o=function(e,t){var r=arguments.length<2?jo(e):t;if(Be(r))return gt(J(r,e));throw Bo(Ne(e)+" is not iterable")},Uo=function(e,t,r){var n,i;gt(e);try{if(!(n=_e(e,"return"))){if("throw"===t)throw r;return r}n=J(n,e)}catch(e){i=!0,n=e}if("throw"===t)throw r;if(i)throw n;return gt(n),r},Vo=TypeError,Fo=function(e,t){this.stopped=e,this.result=t},zo=Fo.prototype,$o=function(e,t,r){var n,i,o,s,a,c,u,l=r&&r.that,d=!(!r||!r.AS_ENTRIES),f=!(!r||!r.IS_RECORD),p=!(!r||!r.IS_ITERATOR),h=!(!r||!r.INTERRUPTED),m=sn(t,l),g=function(e){return n&&Uo(n,"normal",e),new Fo(!0,e)},v=function(e){return d?(gt(e),h?m(e[0],e[1],g):m(e[0],e[1])):h?m(e,g):m(e)};if(f)n=e.iterator;else if(p)n=e;else{if(!(i=jo(e)))throw Vo(Ne(e)+" is not iterable");if(Mo(i)){for(o=0,s=rr(e);s>o;o++)if((a=v(e[o]))&&xe(zo,a))return a;return new Fo(!1)}n=_o(e,i)}for(c=f?e.next:n.next;!(u=J(c,n)).done;){try{a=v(u.value)}catch(e){Uo(n,"throw",e)}if("object"==typeof a&&a&&xe(zo,a))return a}return new Fo(!1)},Go=nt("iterator"),Wo=!1;try{var qo=0,Ho={next:function(){return{done:!!qo++}},return:function(){Wo=!0}};Ho[Go]=function(){return this},Array.from(Ho,(function(){throw 2}))}catch(Lf){}var Xo=function(e,t){if(!t&&!Wo)return!1;var r=!1;try{var n={};n[Go]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(e){}return r},Yo=Qi.CONSTRUCTOR||!Xo((function(e){Gi.all(e).then(void 0,(function(){}))}));xr({target:"Promise",stat:!0,forced:Yo},{all:function(e){var t=this,r=ro.f(t),n=r.resolve,i=r.reject,o=Fi((function(){var r=Be(t.resolve),o=[],s=0,a=1;$o(e,(function(e){var c=s++,u=!1;a++,J(r,t,e).then((function(e){u||(u=!0,o[c]=e,--a||n(o))}),i)})),--a||n(o)}));return o.error&&i(o.value),r.promise}});var Jo=Qi.CONSTRUCTOR,Ko=Gi&&Gi.prototype;if(xr({target:"Promise",proto:!0,forced:Jo,real:!0},{catch:function(e){return this.then(void 0,e)}}),ye(Gi)){var Zo=Ce("Promise").prototype.catch;Ko.catch!==Zo&&qt(Ko,"catch",Zo,{unsafe:!0})}xr({target:"Promise",stat:!0,forced:Yo},{race:function(e){var t=this,r=ro.f(t),n=r.reject,i=Fi((function(){var i=Be(t.resolve);$o(e,(function(e){J(i,t,e).then(r.resolve,n)}))}));return i.error&&n(i.value),r.promise}}),xr({target:"Promise",stat:!0,forced:Qi.CONSTRUCTOR},{reject:function(e){var t=ro.f(this);return J(t.reject,void 0,e),t.promise}});var Qo=Qi.CONSTRUCTOR;Ce("Promise"),xr({target:"Promise",stat:!0,forced:Qo},{resolve:function(e){return function(e,t){if(gt(e),be(t)&&t.constructor===e)return t;var r=ro.f(e);return(0,r.resolve)(t),r.promise}(this,e)}});var es=xt.f,ts=function(e,t,r){r in e||es(e,r,{configurable:!0,get:function(){return t[r]},set:function(e){t[r]=e}})},rs=function(e,t,r){var n,i;return qn&&ye(n=t.constructor)&&n!==r&&be(i=n.prototype)&&i!==r.prototype&&qn(e,i),e},ns=String,is=function(e){if("Symbol"===Dr(e))throw TypeError("Cannot convert a Symbol value to a string");return ns(e)},os=function(e,t){return void 0===e?arguments.length<2?"":t:is(e)},ss=function(e,t){be(t)&&"cause"in t&&Et(e,"cause",t.cause)},as=Error,cs=ie("".replace),us=String(as("zxcasd").stack),ls=/\n\s*at [^:]*:[^\n]*/,ds=ls.test(us),fs=function(e,t){if(ds&&"string"==typeof e&&!as.prepareStackTrace)for(;t--;)e=cs(e,ls,"");return e},ps=!q((function(){var e=Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",ee(1,7)),7!==e.stack)})),hs=function(e,t,r,n){var i="stackTraceLimit",o=n?2:1,s=e.split("."),a=s[s.length-1],c=Ce.apply(null,s);if(c){var u=c.prototype;if(Xe(u,"cause")&&delete u.cause,!r)return c;var l=Ce("Error"),d=t((function(e,t){var r=os(n?t:e,void 0),i=n?new c(e):new c;return void 0!==r&&Et(i,"message",r),ps&&Et(i,"stack",fs(i.stack,2)),this&&xe(u,this)&&rs(i,this,d),arguments.length>o&&ss(i,arguments[o]),i}));d.prototype=u,"Error"!==a?qn?qn(d,l):hr(d,l,{name:!0}):H&&i in c&&(ts(d,c,i),ts(d,c,"prepareStackTrace")),hr(d,c);try{u.name!==a&&Et(u,"name",a),u.constructor=d}catch(e){}return d}},ms="WebAssembly",gs=W[ms],vs=7!==Error("e",{cause:7}).cause,ys=function(e,t){var r={};r[e]=hs(e,t,vs),xr({global:!0,constructor:!0,arity:1,forced:vs},r)},ws=function(e,t){if(gs&&gs[e]){var r={};r[e]=hs(ms+"."+e,t,vs),xr({target:ms,stat:!0,constructor:!0,arity:1,forced:vs},r)}};ys("Error",(function(e){return function(t){return mn(e,this,arguments)}})),ys("EvalError",(function(e){return function(t){return mn(e,this,arguments)}})),ys("RangeError",(function(e){return function(t){return mn(e,this,arguments)}})),ys("ReferenceError",(function(e){return function(t){return mn(e,this,arguments)}})),ys("SyntaxError",(function(e){return function(t){return mn(e,this,arguments)}})),ys("TypeError",(function(e){return function(t){return mn(e,this,arguments)}})),ys("URIError",(function(e){return function(t){return mn(e,this,arguments)}})),ws("CompileError",(function(e){return function(t){return mn(e,this,arguments)}})),ws("LinkError",(function(e){return function(t){return mn(e,this,arguments)}})),ws("RuntimeError",(function(e){return function(t){return mn(e,this,arguments)}}));var bs=nt("match"),Ss=function(e){var t;return be(e)&&(void 0!==(t=e[bs])?!!t:"RegExp"==ae(e))},Cs=function(){var e=gt(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t},xs=RegExp.prototype,Es=function(e){var t=e.flags;return void 0!==t||"flags"in xs||Xe(e,"flags")||!xe(xs,e)?t:J(Cs,e)},Ts=W.RegExp,Is=q((function(){var e=Ts("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),Rs=Is||q((function(){return!Ts("a","y").sticky})),Ps={BROKEN_CARET:Is||q((function(){var e=Ts("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),MISSED_STICKY:Rs,UNSUPPORTED_Y:Is},ks=W.RegExp,As=q((function(){var e=ks(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),Os=W.RegExp,Ls=q((function(){var e=Os("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),Ds=lr.f,Ms=Gt.enforce,Ns=nt("match"),js=W.RegExp,Bs=js.prototype,_s=W.SyntaxError,Us=ie(Bs.exec),Vs=ie("".charAt),Fs=ie("".replace),zs=ie("".indexOf),$s=ie("".slice),Gs=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,Ws=/a/g,qs=/a/g,Hs=new js(Ws)!==Ws,Xs=Ps.MISSED_STICKY,Ys=Ps.UNSUPPORTED_Y,Js=H&&(!Hs||Xs||As||Ls||q((function(){return qs[Ns]=!1,js(Ws)!=Ws||js(qs)==qs||"/a/i"!=js(Ws,"i")})));if(Sr("RegExp",Js)){for(var Ks=function(e,t){var r,n,i,o,s,a,c=xe(Bs,this),u=Ss(e),l=void 0===t,d=[],f=e;if(!c&&u&&l&&e.constructor===Ks)return e;if((u||xe(Bs,e))&&(e=e.source,l&&(t=Es(f))),e=void 0===e?"":is(e),t=void 0===t?"":is(t),f=e,As&&"dotAll"in Ws&&(n=!!t&&zs(t,"s")>-1)&&(t=Fs(t,/s/g,"")),r=t,Xs&&"sticky"in Ws&&(i=!!t&&zs(t,"y")>-1)&&Ys&&(t=Fs(t,/y/g,"")),Ls&&(e=(o=function(e){for(var t,r=e.length,n=0,i="",o=[],s={},a=!1,c=!1,u=0,l="";n<=r;n++){if("\\"===(t=Vs(e,n)))t+=Vs(e,++n);else if("]"===t)a=!1;else if(!a)switch(!0){case"["===t:a=!0;break;case"("===t:Us(Gs,$s(e,n+1))&&(n+=2,c=!0),i+=t,u++;continue;case">"===t&&c:if(""===l||Xe(s,l))throw new _s("Invalid capture group name");s[l]=!0,o[o.length]=[l,u],c=!1,l="";continue}c?l+=t:i+=t}return[i,o]}(e))[0],d=o[1]),s=rs(js(e,t),c?this:Bs,Ks),(n||i||d.length)&&(a=Ms(s),n&&(a.dotAll=!0,a.raw=Ks(function(e){for(var t,r=e.length,n=0,i="",o=!1;n<=r;n++)"\\"!==(t=Vs(e,n))?o||"."!==t?("["===t?o=!0:"]"===t&&(o=!1),i+=t):i+="[\\s\\S]":i+=t+Vs(e,++n);return i}(e),r)),i&&(a.sticky=!0),d.length&&(a.groups=d)),e!==f)try{Et(s,"source",""===f?"(?:)":f)}catch(e){}return s},Zs=Ds(js),Qs=0;Zs.length>Qs;)ts(Ks,js,Zs[Qs++]);Bs.constructor=Ks,Ks.prototype=Bs,qt(W,"RegExp",Ks,{constructor:!0})}Kn("RegExp");var ea,ta,ra,na=Gt.get,ia=RegExp.prototype,oa=TypeError;H&&As&&(ea=ia,ta="dotAll",(ra={configurable:!0,get:function(){if(this!==ia){if("RegExp"===ae(this))return!!na(this).dotAll;throw oa("Incompatible receiver, RegExp required")}}}).get&&Wt(ra.get,ta,{getter:!0}),ra.set&&Wt(ra.set,ta,{setter:!0}),xt.f(ea,ta,ra));var sa,aa=Object.keys||function(e){return ar(e,cr)},ca={f:H&&!pt?Object.defineProperties:function(e,t){gt(e);for(var r,n=he(t),i=aa(t),o=i.length,s=0;o>s;)xt.f(e,r=i[s++],n[r]);return e}},ua="prototype",la="script",da=Bt("IE_PROTO"),fa=function(){},pa=function(e){return"<script>"+e+"</"+la+">"},ha=function(e){e.write(pa("")),e.close();var t=e.parentWindow.Object;return e=null,t},ma=function(){try{sa=new ActiveXObject("htmlfile")}catch(e){}var e,t;ma="undefined"!=typeof document?document.domain&&sa?ha(sa):("javascript:",(t=ut("iframe")).style.display="none",ni.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(pa("document.F=Object")),e.close(),e.F):ha(sa);for(var r=cr.length;r--;)delete ma[ua][cr[r]];return ma()};_t[da]=!0;var ga=Object.create||function(e,t){var r;return null!==e?(fa[ua]=gt(e),r=new fa,fa[ua]=null,r[da]=e):r=ma(),void 0===t?r:ca.f(r,t)},va=Gt.get,ya=Ge("native-string-replace",String.prototype.replace),wa=RegExp.prototype.exec,ba=wa,Sa=ie("".charAt),Ca=ie("".indexOf),xa=ie("".replace),Ea=ie("".slice),Ta=function(){var e=/a/,t=/b*/g;return J(wa,e,"a"),J(wa,t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),Ia=Ps.BROKEN_CARET,Ra=void 0!==/()??/.exec("")[1];(Ta||Ra||Ia||As||Ls)&&(ba=function(e){var t,r,n,i,o,s,a,c=this,u=va(c),l=is(e),d=u.raw;if(d)return d.lastIndex=c.lastIndex,t=J(ba,d,l),c.lastIndex=d.lastIndex,t;var f=u.groups,p=Ia&&c.sticky,h=J(Cs,c),m=c.source,g=0,v=l;if(p&&(h=xa(h,"y",""),-1===Ca(h,"g")&&(h+="g"),v=Ea(l,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==Sa(l,c.lastIndex-1))&&(m="(?: "+m+")",v=" "+v,g++),r=new RegExp("^(?:"+m+")",h)),Ra&&(r=new RegExp("^"+m+"$(?!\\s)",h)),Ta&&(n=c.lastIndex),i=J(wa,p?r:c,v),p?i?(i.input=Ea(i.input,g),i[0]=Ea(i[0],g),i.index=c.lastIndex,c.lastIndex+=i[0].length):c.lastIndex=0:Ta&&i&&(c.lastIndex=c.global?i.index+i[0].length:n),Ra&&i&&i.length>1&&J(ya,i[0],r,(function(){for(o=1;o<arguments.length-2;o++)void 0===arguments[o]&&(i[o]=void 0)})),i&&f)for(i.groups=s=ga(null),o=0;o<f.length;o++)s[(a=f[o])[0]]=i[a[1]];return i});var Pa=ba;xr({target:"RegExp",proto:!0,forced:/./.exec!==Pa},{exec:Pa});var ka=ie(Q.f),Aa=ie([].push),Oa=function(e){return function(t){for(var r,n=he(t),i=aa(n),o=i.length,s=0,a=[];o>s;)r=i[s++],H&&!ka(n,r)||Aa(a,e?[r,n[r]]:n[r]);return a}},La=(Oa(!0),Oa(!1));xr({target:"Object",stat:!0},{values:function(e){return La(e)}});var Da=nt("species"),Ma=RegExp.prototype,Na=function(e,t,r,n){var i=nt(e),o=!q((function(){var t={};return t[i]=function(){return 7},7!=""[e](t)})),s=o&&!q((function(){var t=!1,r=/a/;return"split"===e&&((r={}).constructor={},r.constructor[Da]=function(){return r},r.flags="",r[i]=/./[i]),r.exec=function(){return t=!0,null},r[i](""),!t}));if(!o||!s||r){var a=nn(/./[i]),c=t(i,""[e],(function(e,t,r,n,i){var s=nn(e),c=t.exec;return c===Pa||c===Ma.exec?o&&!i?{done:!0,value:a(t,r,n)}:{done:!0,value:s(r,t,n)}:{done:!1}}));qt(String.prototype,e,c[0]),qt(Ma,i,c[1])}n&&Et(Ma[i],"sham",!0)},ja=ie("".charAt),Ba=ie("".charCodeAt),_a=ie("".slice),Ua=function(e){return function(t,r){var n,i,o=is(pe(t)),s=Jt(r),a=o.length;return s<0||s>=a?e?"":void 0:(n=Ba(o,s))<55296||n>56319||s+1===a||(i=Ba(o,s+1))<56320||i>57343?e?ja(o,s):n:e?_a(o,s,s+2):i-56320+(n-55296<<10)+65536}},Va=(Ua(!1),Ua(!0)),Fa=function(e,t,r){return t+(r?Va(e,t).length:1)},za=TypeError,$a=function(e,t){var r=e.exec;if(ye(r)){var n=J(r,e,t);return null!==n&>(n),n}if("RegExp"===ae(e))return J(Pa,e,t);throw za("RegExp#exec called on incompatible receiver")};Na("match",(function(e,t,r){return[function(t){var r=pe(this),n=de(t)?void 0:_e(t,e);return n?J(n,t,r):new RegExp(t)[e](is(r))},function(e){var n=gt(this),i=is(e),o=r(t,n,i);if(o.done)return o.value;if(!n.global)return $a(n,i);var s=n.unicode;n.lastIndex=0;for(var a,c=[],u=0;null!==(a=$a(n,i));){var l=is(a[0]);c[u]=l,""===l&&(n.lastIndex=Fa(i,tr(n.lastIndex),s)),u++}return 0===u?null:c}]}));var Ga=xt.f,Wa=nt("unscopables"),qa=Array.prototype;null==qa[Wa]&&Ga(qa,Wa,{configurable:!0,value:ga(null)});var Ha,Xa,Ya,Ja=function(e){qa[Wa][e]=!0},Ka=!q((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),Za=Bt("IE_PROTO"),Qa=Object,ec=Qa.prototype,tc=Ka?Qa.getPrototypeOf:function(e){var t=qe(e);if(Xe(t,Za))return t[Za];var r=t.constructor;return ye(r)&&t instanceof r?r.prototype:t instanceof Qa?ec:null},rc=nt("iterator"),nc=!1;[].keys&&("next"in(Ya=[].keys())?(Xa=tc(tc(Ya)))!==Object.prototype&&(Ha=Xa):nc=!0),(!be(Ha)||q((function(){var e={};return Ha[rc].call(e)!==e})))&&(Ha={}),ye(Ha[rc])||qt(Ha,rc,(function(){return this}));var ic={IteratorPrototype:Ha,BUGGY_SAFARI_ITERATORS:nc},oc=ic.IteratorPrototype,sc=function(){return this},ac=function(e,t,r,n){var i=t+" Iterator";return e.prototype=ga(oc,{next:ee(+!n,r)}),Yn(e,i,!1),Oo[i]=sc,e},cc=Pt.PROPER,uc=Pt.CONFIGURABLE,lc=ic.IteratorPrototype,dc=ic.BUGGY_SAFARI_ITERATORS,fc=nt("iterator"),pc="values",hc="entries",mc=function(){return this},gc=function(e,t,r,n,i,o,s){ac(r,t,n);var a,c,u,l=function(e){if(e===i&&m)return m;if(!dc&&e in p)return p[e];switch(e){case"keys":case pc:case hc:return function(){return new r(this,e)}}return function(){return new r(this)}},d=t+" Iterator",f=!1,p=e.prototype,h=p[fc]||p["@@iterator"]||i&&p[i],m=!dc&&h||l(i),g="Array"==t&&p.entries||h;if(g&&(a=tc(g.call(new e)))!==Object.prototype&&a.next&&(tc(a)!==lc&&(qn?qn(a,lc):ye(a[fc])||qt(a,fc,mc)),Yn(a,d,!0)),cc&&i==pc&&h&&h.name!==pc&&(uc?Et(p,"name",pc):(f=!0,m=function(){return J(h,this)})),i)if(c={values:l(pc),keys:o?m:l("keys"),entries:l(hc)},s)for(u in c)(dc||f||!(u in p))&&qt(p,u,c[u]);else xr({target:t,proto:!0,forced:dc||f},c);return p[fc]!==m&&qt(p,fc,m,{name:i}),Oo[t]=m,c},vc=function(e,t){return{value:e,done:t}},yc=xt.f,wc="Array Iterator",bc=Gt.set,Sc=Gt.getterFor(wc),Cc=gc(Array,"Array",(function(e,t){bc(this,{type:wc,target:he(e),index:0,kind:t})}),(function(){var e=Sc(this),t=e.target,r=e.kind,n=e.index++;return!t||n>=t.length?(e.target=void 0,vc(void 0,!0)):vc("keys"==r?n:"values"==r?t[n]:[n,t[n]],!1)}),"values"),xc=Oo.Arguments=Oo.Array;if(Ja("keys"),Ja("values"),Ja("entries"),H&&"values"!==xc.name)try{yc(xc,"name",{value:"values"})}catch(Lf){}var Ec={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},Tc=ut("span").classList,Ic=Tc&&Tc.constructor&&Tc.constructor.prototype,Rc=Ic===Object.prototype?void 0:Ic,Pc=nt("iterator"),kc=nt("toStringTag"),Ac=Cc.values,Oc=function(e,t){if(e){if(e[Pc]!==Ac)try{Et(e,Pc,Ac)}catch(t){e[Pc]=Ac}if(e[kc]||Et(e,kc,t),Ec[t])for(var r in Cc)if(e[r]!==Cc[r])try{Et(e,r,Cc[r])}catch(t){e[r]=Cc[r]}}};for(var Lc in Ec)Oc(W[Lc]&&W[Lc].prototype,Lc);Oc(Rc,"DOMTokenList");var Dc=Array,Mc=Math.max,Nc=lr.f,jc="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],Bc={f:function(e){return jc&&"Window"==ae(e)?function(e){try{return Nc(e)}catch(e){return function(e,t,r){for(var n=rr(e),i=Qt(void 0,n),o=Qt(n,n),s=Dc(Mc(o-i,0)),a=0;i<o;i++,a++)Rr(s,a,e[i]);return s.length=a,s}(jc)}}(e):Nc(he(e))}},_c=q((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),Uc=Object.isExtensible,Vc=q((function(){Uc(1)}))||_c?function(e){return!!be(e)&&(!_c||"ArrayBuffer"!=ae(e))&&(!Uc||Uc(e))}:Uc,Fc=!q((function(){return Object.isExtensible(Object.preventExtensions({}))})),zc=V((function(e){var t=xt.f,r=!1,n=Ze("meta"),i=0,o=function(e){t(e,n,{value:{objectID:"O"+i++,weakData:{}}})},s=e.exports={enable:function(){s.enable=function(){},r=!0;var e=lr.f,t=ie([].splice),i={};i[n]=1,e(i).length&&(lr.f=function(r){for(var i=e(r),o=0,s=i.length;o<s;o++)if(i[o]===n){t(i,o,1);break}return i},xr({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:Bc.f}))},fastKey:function(e,t){if(!be(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!Xe(e,n)){if(!Vc(e))return"F";if(!t)return"E";o(e)}return e[n].objectID},getWeakData:function(e,t){if(!Xe(e,n)){if(!Vc(e))return!0;if(!t)return!1;o(e)}return e[n].weakData},onFreeze:function(e){return Fc&&r&&Vc(e)&&!Xe(e,n)&&o(e),e}};_t[n]=!0})),$c=function(e,t,r){for(var n in t)qt(e,n,t[n],r);return e},Gc=xt.f,Wc=zc.fastKey,qc=Gt.set,Hc=Gt.getterFor;!function(e,t,r){var n=-1!==e.indexOf("Map"),i=-1!==e.indexOf("Weak"),o=n?"set":"add",s=W.Set,a=s&&s.prototype,c=s,u={},l=function(e){var t=ie(a[e]);qt(a,e,"add"==e?function(e){return t(this,0===e?0:e),this}:"delete"==e?function(e){return!(i&&!be(e))&&t(this,0===e?0:e)}:"get"==e?function(e){return i&&!be(e)?void 0:t(this,0===e?0:e)}:"has"==e?function(e){return!(i&&!be(e))&&t(this,0===e?0:e)}:function(e,r){return t(this,0===e?0:e,r),this})};if(Sr(e,!ye(s)||!(i||a.forEach&&!q((function(){(new s).entries().next()})))))c=r.getConstructor(t,e,n,o),zc.enable();else if(Sr(e,!0)){var d=new c,f=d[o](i?{}:-0,1)!=d,p=q((function(){d.has(1)})),h=Xo((function(e){new s(e)})),m=!i&&q((function(){for(var e=new s,t=5;t--;)e[o](t,t);return!e.has(-0)}));h||((c=t((function(e,t){Qn(e,a);var r=rs(new s,e,c);return de(t)||$o(t,r[o],{that:r,AS_ENTRIES:n}),r}))).prototype=a,a.constructor=c),(p||m)&&(l("delete"),l("has"),n&&l("get")),(m||f)&&l(o),i&&a.clear&&delete a.clear}u.Set=c,xr({global:!0,constructor:!0,forced:c!=s},u),Yn(c,e),i||r.setStrong(c,e,n)}("Set",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),{getConstructor:function(e,t,r,n){var i=e((function(e,i){Qn(e,o),qc(e,{type:t,index:ga(null),first:void 0,last:void 0,size:0}),H||(e.size=0),de(i)||$o(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,s=Hc(t),a=function(e,t,r){var n,i,o=s(e),a=c(e,t);return a?a.value=r:(o.last=a={index:i=Wc(t,!0),key:t,value:r,previous:n=o.last,next:void 0,removed:!1},o.first||(o.first=a),n&&(n.next=a),H?o.size++:e.size++,"F"!==i&&(o.index[i]=a)),e},c=function(e,t){var r,n=s(e),i=Wc(t);if("F"!==i)return n.index[i];for(r=n.first;r;r=r.next)if(r.key==t)return r};return $c(o,{clear:function(){for(var e=s(this),t=e.index,r=e.first;r;)r.removed=!0,r.previous&&(r.previous=r.previous.next=void 0),delete t[r.index],r=r.next;e.first=e.last=void 0,H?e.size=0:this.size=0},delete:function(e){var t=this,r=s(t),n=c(t,e);if(n){var i=n.next,o=n.previous;delete r.index[n.index],n.removed=!0,o&&(o.next=i),i&&(i.previous=o),r.first==n&&(r.first=i),r.last==n&&(r.last=o),H?r.size--:t.size--}return!!n},forEach:function(e){for(var t,r=s(this),n=sn(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:r.first;)for(n(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!c(this,e)}}),$c(o,r?{get:function(e){var t=c(this,e);return t&&t.value},set:function(e,t){return a(this,0===e?0:e,t)}}:{add:function(e){return a(this,e=0===e?0:e,e)}}),H&&Gc(o,"size",{get:function(){return s(this).size}}),i},setStrong:function(e,t,r){var n=t+" Iterator",i=Hc(t),o=Hc(n);gc(e,t,(function(e,t){qc(this,{type:n,target:e,state:i(e),kind:t,last:void 0})}),(function(){for(var e=o(this),t=e.kind,r=e.last;r&&r.removed;)r=r.previous;return e.target&&(e.last=r=r?r.next:e.state.first)?vc("keys"==t?r.key:"values"==t?r.value:[r.key,r.value],!1):(e.target=void 0,vc(void 0,!0))}),r?"entries":"values",!r,!0),Kn(t)}});var Xc=un.filter,Yc=Hr("filter");xr({target:"Array",proto:!0,forced:!Yc},{filter:function(e){return Xc(this,e,arguments.length>1?arguments[1]:void 0)}});var Jc=ir.includes,Kc=q((function(){return!Array(1).includes()}));xr({target:"Array",proto:!0,forced:Kc},{includes:function(e){return Jc(this,e,arguments.length>1?arguments[1]:void 0)}}),Ja("includes");var Zc=TypeError,Qc=function(e){if(Ss(e))throw Zc("The method doesn't accept regular expressions");return e},eu=nt("match"),tu=ie("".indexOf);xr({target:"String",proto:!0,forced:!function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[eu]=!1,"/./"[e](t)}catch(e){}}return!1}("includes")},{includes:function(e){return!!~tu(is(pe(this)),is(Qc(e)),arguments.length>1?arguments[1]:void 0)}});var ru,nu="object"==typeof Reflect?Reflect:null,ou=nu&&"function"==typeof nu.apply?nu.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};ru=nu&&"function"==typeof nu.ownKeys?nu.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var su=Number.isNaN||function(e){return e!=e};function au(){au.init.call(this)}var cu=au;au.EventEmitter=au,au.prototype._events=void 0,au.prototype._eventsCount=0,au.prototype._maxListeners=void 0;var uu=10;function lu(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function du(e){return void 0===e._maxListeners?au.defaultMaxListeners:e._maxListeners}function fu(e,t,r,n){var i,o,s,a;if(lu(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),s=o[t]),void 0===s)s=o[t]=r,++e._eventsCount;else if("function"==typeof s?s=o[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(i=du(e))>0&&s.length>i&&!s.warned){s.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=s.length,a=c,console&&console.warn&&console.warn(a)}return e}function pu(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function hu(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=pu.bind(n);return i.listener=r,n.wrapFn=i,i}function mu(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(i):vu(i,i.length)}function gu(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function vu(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function yu(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function i(o){n.once&&e.removeEventListener(t,i),r(o)}))}}Object.defineProperty(au,"defaultMaxListeners",{enumerable:!0,get:function(){return uu},set:function(e){if("number"!=typeof e||e<0||su(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");uu=e}}),au.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},au.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||su(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},au.prototype.getMaxListeners=function(){return du(this)},au.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,i=this._events;if(void 0!==i)n=n&&void 0===i.error;else if(!n)return!1;if(n){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var a=i[e];if(void 0===a)return!1;if("function"==typeof a)ou(a,this,t);else{var c=a.length,u=vu(a,c);for(r=0;r<c;++r)ou(u[r],this,t)}return!0},au.prototype.addListener=function(e,t){return fu(this,e,t,!1)},au.prototype.on=au.prototype.addListener,au.prototype.prependListener=function(e,t){return fu(this,e,t,!0)},au.prototype.once=function(e,t){return lu(t),this.on(e,hu(this,e,t)),this},au.prototype.prependOnceListener=function(e,t){return lu(t),this.prependListener(e,hu(this,e,t)),this},au.prototype.removeListener=function(e,t){var r,n,i,o,s;if(lu(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){s=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,s||t)}return this},au.prototype.off=au.prototype.removeListener,au.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var i,o=Object.keys(r);for(n=0;n<o.length;++n)"removeListener"!==(i=o[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},au.prototype.listeners=function(e){return mu(this,e,!0)},au.prototype.rawListeners=function(e){return mu(this,e,!1)},au.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):gu.call(e,t)},au.prototype.listenerCount=gu,au.prototype.eventNames=function(){return this._eventsCount>0?ru(this._events):[]},cu.once=function(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,o),n(r)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}yu(e,t,o,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&yu(e,"error",t,{once:!0})}(e,i)}))};var wu=Su,bu=cu.EventEmitter;function Su(e,t,r){Array.isArray(r)||(r=[r]);var n=[];return r.forEach((function(r){var i=function(){var e=[].slice.call(arguments);e.unshift(r),t.emit.apply(t,e)};n.push(i),e.on(r,i)})),function(){r.forEach((function(t,r){e.removeListener(t,n[r])}))}}wu.filter=function(e,t){var r=new bu;return Su(e,r,t),r};const Cu=_n.get("PeerConnectionStats");class iu extends cu{constructor(e){super(),this.peer=e,this.stats=null,this.emitInterval=null,this.previousStats=null}init(){var e=this;Cu.info("Initializing peer connection stats"),this.emitInterval=setInterval(D((function*(){const t=yield e.peer.getStats();e.parseStats(t),e.emit("stats",e.stats)})),1e3)}parseStats(e){this.previousStats=this.stats;const t={audio:{inbounds:[],outbounds:[]},video:{inbounds:[],outbounds:[]},raw:e};var r,n=_(e.values());try{for(n.s();!(r=n.n()).done;){const e=r.value;switch(e.type){case"outbound-rtp":xu(e,this.previousStats,t);break;case"inbound-rtp":Eu(e,this.previousStats,t);break;case"candidate-pair":e.nominated&&Tu(e,t)}}}catch(e){n.e(e)}finally{n.f()}this.stats=t}stop(){Cu.info("Stopping peer connection stats"),clearInterval(this.emitInterval)}}const xu=(e,t,r)=>{var n,i;const o=Iu(e),s=Ru(e.codecId,r.raw),a=Pu(e,o);a.totalBytesSent=e.bytesSent,a.id=e.id,a.mid=e.mid;const c=t?null!==(n=null===(i=t[o].outbounds.find(e=>e.id===a.id))||void 0===i?void 0:i.totalBytesSent)&&void 0!==n?n:0:null;a.bitrate=c?8*(e.bytesSent-c):0,"video"===o&&(a.qualityLimitationReason=e.qualityLimitationReason),r[o].outbounds.push(O(O({},s),a))},Eu=(e,t,r)=>{let n=Iu(e);const i=Ru(e.codecId,r.raw);["audio","video"].includes(n)||(n=e.id.includes("Video")?"video":"audio");const o=Pu(e,n);if(o.totalBytesReceived=e.bytesReceived,o.totalPacketsReceived=e.packetsReceived,o.totalPacketsLost=e.packetsLost,o.jitter=e.jitter,o.id=e.id,o.mid=e.mid,o.bitrate=0,o.packetsLostRatioPerSecond=0,o.packetsLostDeltaPerSecond=0,t){const r=t[n].inbounds.find(e=>e.id===o.id);if(r){const t=r.totalBytesReceived;o.bitrate=8*(e.bytesReceived-t),o.packetsLostRatioPerSecond=ku(o,r),o.packetsLostDeltaPerSecond=Au(o,r)}}r[n].inbounds.push(O(O({},i),o))},Tu=(e,t)=>{t.totalRoundTripTime=e.totalRoundTripTime,t.currentRoundTripTime=e.currentRoundTripTime,t.availableOutgoingBitrate=e.availableOutgoingBitrate,t.candidateType=t.raw.get(e.localCandidateId).candidateType},Iu=e=>e.mediaType||e.kind,Ru=(e,t)=>{var r;return{mimeType:(e&&null!==(r=t.get(e))&&void 0!==r?r:{}).mimeType}},Pu=(e,t)=>{const r={};return"video"===t&&(r.framesPerSecond=e.framesPerSecond,r.frameHeight=e.frameHeight,r.frameWidth=e.frameWidth),r.timestamp=e.timestamp,r},ku=(e,t)=>Au(e,t)/(e.totalPacketsReceived-t.totalPacketsReceived),Au=(e,t)=>e.totalPacketsLost-t.totalPacketsLost;var Ou=function(e,t,r,n){try{return n?t(gt(r)[0],r[1]):t(r)}catch(t){Uo(e,"throw",t)}},Lu=Array,Du=!Xo((function(e){Array.from(e)}));xr({target:"Array",stat:!0,forced:Du},{from:function(e){var t=qe(e),r=zr(this),n=arguments.length,i=n>1?arguments[1]:void 0,o=void 0!==i;o&&(i=sn(i,n>2?arguments[2]:void 0));var s,a,c,u,l,d,f=jo(t),p=0;if(!f||this===Lu&&Mo(f))for(s=rr(t),a=r?new this(s):Lu(s);s>p;p++)d=o?i(t[p],p):t[p],Rr(a,p,d);else for(l=(u=_o(t,f)).next,a=r?new this:[];!(c=J(l,u)).done;p++)d=o?Ou(u,i,[c.value,p],!0):c.value,Rr(a,p,d);return a.length=p,a}});var Mu=Math.floor,Nu=ie("".charAt),ju=ie("".replace),Bu=ie("".slice),_u=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,Uu=/\$([$&'`]|\d{1,2})/g,Vu=function(e,t,r,n,i,o){var s=r+e.length,a=n.length,c=Uu;return void 0!==i&&(i=qe(i),c=_u),ju(o,c,(function(o,c){var u;switch(Nu(c,0)){case"$":return"$";case"&":return e;case"`":return Bu(t,0,r);case"'":return Bu(t,s);case"<":u=i[Bu(c,1,-1)];break;default:var l=+c;if(0===l)return o;if(l>a){var d=Mu(l/10);return 0===d?o:d<=a?void 0===n[d-1]?Nu(c,1):n[d-1]+Nu(c,1):o}u=n[l-1]}return void 0===u?"":u}))},Fu=nt("replace"),zu=Math.max,$u=Math.min,Gu=ie([].concat),Wu=ie([].push),qu=ie("".indexOf),Hu=ie("".slice),Xu="$0"==="a".replace(/./,"$0"),Yu=!!/./[Fu]&&""===/./[Fu]("a","$0");Na("replace",(function(e,t,r){var n=Yu?"$":"$0";return[function(e,r){var n=pe(this),i=de(e)?void 0:_e(e,Fu);return i?J(i,e,n,r):J(t,is(n),e,r)},function(e,i){var o=gt(this),s=is(e);if("string"==typeof i&&-1===qu(i,n)&&-1===qu(i,"$<")){var a=r(t,o,s,i);if(a.done)return a.value}var c=ye(i);c||(i=is(i));var u=o.global;if(u){var l=o.unicode;o.lastIndex=0}for(var d=[];;){var f=$a(o,s);if(null===f)break;if(Wu(d,f),!u)break;""===is(f[0])&&(o.lastIndex=Fa(s,tr(o.lastIndex),l))}for(var p,h="",m=0,g=0;g<d.length;g++){for(var v=is((f=d[g])[0]),y=zu($u(Jt(f.index),s.length),0),w=[],E=1;E<f.length;E++)Wu(w,void 0===(p=f[E])?p:String(p));var T=f.groups;if(c){var I=Gu([v],w,y,s);void 0!==T&&Wu(I,T);var R=is(mn(i,void 0,I))}else R=Vu(v,s,y,w,T,i);y>=m&&(h+=Hu(s,m,y)+R,m=y+v.length)}return h+Hu(s,m)}]}),!!q((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}))||!Xu||Yu);var Ju,Ku="\t\n\v\f\r \u2028\u2029\ufeff",Zu=ie("".replace),Qu="["+Ku+"]",el=RegExp("^"+Qu+Qu+"*"),tl=RegExp(Qu+Qu+"*$"),rl=function(e){return function(t){var r=is(pe(t));return 1&e&&(r=Zu(r,el,"")),2&e&&(r=Zu(r,tl,"")),r}},nl={start:rl(1),end:rl(2),trim:rl(3)},il=Pt.PROPER,ol=nl.trim;xr({target:"String",proto:!0,forced:(Ju="trim",q((function(){return!!Ku[Ju]()||"
"!=="
"[Ju]()||il&&Ku[Ju].name!==Ju})))},{trim:function(){return ol(this)}});var sl=nt("matchAll"),al="RegExp String",cl=al+" Iterator",ul=Gt.set,ll=Gt.getterFor(cl),fl=RegExp.prototype,hl=TypeError,ml=nn("".indexOf),vl=nn("".matchAll),yl=!!vl&&!q((function(){vl("a",/./)})),bl=ac((function(e,t,r,n){ul(this,{type:cl,regexp:e,string:t,global:r,unicode:n,done:!1})}),al,(function(){var e=ll(this);if(e.done)return vc(void 0,!0);var t=e.regexp,r=e.string,n=$a(t,r);return null===n?(e.done=!0,vc(void 0,!0)):e.global?(""===is(n[0])&&(t.lastIndex=Fa(r,tr(t.lastIndex),e.unicode)),vc(n,!1)):(e.done=!0,vc(n,!1))}));xr({target:"String",proto:!0,forced:yl},{matchAll:function(e){var t,r,n,i=pe(this);if(de(e)){if(yl)return vl(i,e)}else{if(Ss(e)&&(t=is(pe(Es(e))),!~ml(t,"g")))throw hl("`.matchAll` does not allow non-global regexes");if(yl)return vl(i,e);if(n=_e(e,sl))return J(n,e,i)}return r=is(i),new RegExp(e,"g")[sl](r)}}),sl in fl||qt(fl,sl,(function(e){var t,r,n,i=gt(this),o=is(e),s=ri(i,RegExp),a=is(Es(i));return t=new s(s===RegExp?i.source:i,a),r=!!~ml(a,"g"),n=!!~ml(a,"u"),t.lastIndex=tr(i.lastIndex),new bl(t,o,r,n)}));var Sl=ie([].reverse),xl=[1,2];xr({target:"Array",proto:!0,forced:String(xl)===String(xl.reverse())},{reverse:function(){return Er(this)&&(this.length=this.length),Sl(this)}});var El=V((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")+(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":"")+(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")}))}))})),Tl=V((function(e,t){var r=function(e){return String(Number(e))===e?Number(e):e},n=function(e,t,n){var i=e.name&&e.names;e.push&&!t[e.push]?t[e.push]=[]:i&&!t[e.name]&&(t[e.name]={});var o=e.push?{}:i?t[e.name]:t;!function(e,t,n,i){if(i&&!n)t[i]=r(e[1]);else for(var o=0;o<n.length;o+=1)null!=e[o+1]&&(t[n[o]]=r(e[o+1]))}(n.match(e.reg),o,e.names,e.name),e.push&&t[e.push].push(o)},i=RegExp.prototype.test.bind(/^([a-z])=(.*)/);t.parse=function(e){var t={},r=[],o=t;return e.split(/(\r\n|\r|\n)/).filter(i).forEach((function(e){var t=e[0],i=e.slice(2);"m"===t&&(r.push({rtp:[],fmtp:[]}),o=r[r.length-1]);for(var s=0;s<(El[t]||[]).length;s+=1){var a=El[t][s];if(a.reg.test(i))return n(a,o,i)}})),t.media=r,t};var o=function(e,t){var n=t.split(/=(.+)/,2);return 2===n.length?e[n[0]]=r(n[1]):1===n.length&&t.length>1&&(e[n[0]]=void 0),e};t.parseParams=function(e){return e.split(/;\s?/).reduce(o,{})},t.parseFmtpConfig=t.parseParams,t.parsePayloads=function(e){return e.toString().split(" ").map(Number)},t.parseRemoteCandidates=function(e){for(var t=[],n=e.split(" ").map(r),i=0;i<n.length;i+=3)t.push({component:n[i],ip:n[i+1],port:n[i+2]});return t},t.parseImageAttributes=function(e){return e.split(" ").map((function(e){return e.substring(1,e.length-1).split(",").reduce(o,{})}))},t.parseSimulcastStreamList=function(e){return e.split(";").map((function(e){return e.split(",").map((function(e){var t,n=!1;return"~"!==e[0]?t=r(e):(t=r(e.substring(1,e.length)),n=!0),{scid:t,paused:n}}))}))}})),Il=/%[sdv%]/g,Rl=function(e){var t=1,r=arguments,n=r.length;return e.replace(Il,(function(e){if(t>=n)return e;var i=r[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(i);case"%d":return Number(i);case"%v":return""}}))},Pl=function(e,t,r){var n=[e+"="+(t.format instanceof Function?t.format(t.push?r:r[t.name]):t.format)];if(t.names)for(var i=0;i<t.names.length;i+=1){var o=t.names[i];t.name?n.push(r[t.name][o]):n.push(r[t.names[i]])}else n.push(r[t.name]);return Rl.apply(null,n)},kl=["v","o","s","i","u","e","p","c","b","t","r","z","a"],Al=["i","c","b","a"],Ol={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 r=t.outerOrder||kl,n=t.innerOrder||Al,i=[];return r.forEach((function(t){El[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(Pl(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(Pl(t,r,e))}))}))})),e.media.forEach((function(e){i.push(Pl("m",El.m[0],e)),n.forEach((function(t){El[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(Pl(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(Pl(t,r,e))}))}))}))})),i.join("\r\n")+"\r\n"},parse:Tl.parse,parseParams:Tl.parseParams,parseFmtpConfig:Tl.parseFmtpConfig,parsePayloads:Tl.parsePayloads,parseRemoteCandidates:Tl.parseRemoteCandidates,parseImageAttributes:Tl.parseImageAttributes,parseSimulcastStreamList:Tl.parseSimulcastStreamList};class dl{constructor(e,t,r,n,i,o,s,a,c){this.foundation=e,this.componentId=t,this.transport=r,this.priority=n,this.address=i,this.port=o,this.type=s,this.relAddr=a,this.relPort=c}equals(e){return e.foundation===this.foundation&&e.componentId===this.componentId&&e.transport===this.transport&&e.priority===this.priority&&e.address===this.address&&e.port===this.port&&e.type===this.type&&e.relAddr===this.relAddr&&e.relPort===this.relPort}clone(){return new dl(this.foundation,this.componentId,this.transport,this.priority,this.address,this.port,this.type,this.relAddr,this.relPort)}plain(){const e={foundation:this.foundation,componentId:this.componentId,transport:this.transport,priority:this.priority,address:this.address,port:this.port,type:this.type};return this.relAddr&&(e.relAddr=this.relAddr),this.relPort&&(e.relPort=this.relPort),e}getFoundation(){return this.foundation}getComponentId(){return this.componentId}getTransport(){return this.transport}getPriority(){return this.priority}getAddress(){return this.address}getPort(){return this.port}getType(){return this.type}getRelAddr(){return this.relAddr}getRelPort(){return this.relPort}}dl.expand=function(e){return new dl(e.foundation,e.componentId,e.transport,e.priority,e.address,e.port,e.type,e.relAddr,e.relPort)};var Ll=dl;class pl{constructor(e,t){this.id=e,this.params=t||[]}clone(){return new pl(this.id,this.params)}plain(){return this.params.length?{id:this.id,params:this.params}:{id:this.id}}getId(){return this.id}getParams(){return this.params}}pl.expand=function(e){return new pl(e.id,e.params)};var Dl=pl;class gl{constructor(e,t,r){this.codec=e,this.type=t,this.params={},this.rtcpfbs=new Set,r&&this.addParams(r)}clone(){const e=new gl(this.codec,this.type,this.params);this.hasRTX()&&e.setRTX(this.getRTX());for(const t of this.rtcpfbs)e.addRTCPFeedback(t.clone());return this.hasChannels()&&e.setChannels(this.getChannels()),e}plain(){const e={codec:this.codec,type:this.type};this.rtx&&(e.rtx=this.rtx),this.channels&&(e.channels=this.channels),Object.keys(this.params).length&&(e.params=this.params);for(const t of this.rtcpfbs)e.rtcpfbs||(e.rtcpfbs=[]),e.rtcpfbs.push(t.plain());return e}setRTX(e){this.rtx=e}getType(){return this.type}setType(e){this.type=e}getCodec(){return this.codec}getParams(){return this.params}addParams(e){for(const t in e)this.params[t]=e[t]}addParam(e,t){this.params[e]=t}hasParam(e){return this.params.hasOwnProperty(e)}getParam(e,t){return this.hasParam(e)?this.params[e]:""+t}hasRTX(){return this.rtx}getRTX(){return this.rtx}hasChannels(){return this.channels}getChannels(){return this.channels}setChannels(e){this.channels=e}addRTCPFeedback(e){this.rtcpfbs.add(e)}getRTCPFeedbacks(){return this.rtcpfbs}}gl.expand=function(e){const t=new gl(e.codec,e.type,e.params);e.rtx&&t.setRTX(e.rtx),e.channels&&t.setChannels(e.channels);for(let r=0;e.rtcpfbs&&r<e.rtcpfbs.length;++r){const n=Dl.expand(e.rtcpfbs[r]);t.addRTCPFeedback(n)}return t},gl.MapFromNames=function(e,t,r){const n=new Map;let i=96;for(let o=0;o<e.length;++o){let s;const a=e[o].split(";"),c=a[0].toLowerCase().trim();s="pcmu"===c?0:"pcma"===c?8:++i;const u=new gl(c,s);"opus"===c?u.setChannels(2):"multiopus"===c&&u.setChannels(6),t&&"ulpfec"!==c&&"flexfec-03"!==c&&"red"!==c&&u.setRTX(++i);for(let e=0;r&&e<r.length;++e)u.addRTCPFeedback(new Dl(r[e].id,r[e].params));for(let e=1;e<a.length;++e){let t=a[e].split("=");u.addParam(t[0].trim(),t[1].trim())}n.set(u.getCodec().toLowerCase(),u)}return n};var Ml=gl,Nl=function e(){var t=this;if(!(this instanceof e))return new(Function.prototype.bind.apply(e,[null].concat(Array.prototype.slice.call(arguments))));Array.from(arguments).forEach((function(e){t[e]=Symbol.for("MEDOOZE_SEMANTIC_SDP_"+e)}))};const jl=Nl("ACTIVE","PASSIVE","ACTPASS","INACTIVE");jl.byValue=function(e){switch(e){case jl.ACTIVE:case jl.PASSIVE:case jl.ACTPASS:case jl.INACTIVE:return e}return jl[e.toUpperCase()]},jl.toString=function(e){switch(e){case jl.ACTIVE:return"active";case jl.PASSIVE:return"passive";case jl.ACTPASS:return"actpass";case jl.INACTIVE:return"inactive"}},jl.reverse=function(e){switch(e){case jl.ACTIVE:return jl.PASSIVE;case jl.PASSIVE:return jl.ACTIVE;case jl.ACTPASS:return jl.PASSIVE;case jl.INACTIVE:return jl.INACTIVE}};var Bl=jl;class wl{constructor(e,t,r){this.setup=e,this.hash=t,this.fingerprint=r}clone(){return new wl(this.setup,this.hash,this.fingerprint)}plain(){return{setup:Bl.toString(this.setup),hash:this.hash,fingerprint:this.fingerprint}}getFingerprint(){return this.fingerprint}getHash(){return this.hash}getSetup(){return this.setup}setSetup(e){this.setup=e}}wl.expand=function(e){return new wl(e.setup?Bl.byValue(e.setup):Bl.ACTPASS,e.hash,e.fingerprint)};var _l=wl;class Cl{constructor(e,t,r,n){this.tag=e,this.suite=t,this.keyParams=r,this.sessionParams=n}clone(){return new Cl(this.tag,this.suite,this.keyParams,this.sessionParams)}plain(){return{tag:this.tag,suite:this.suite,keyParams:this.keyParams,sessionParams:this.sessionParams}}getSessionParams(){return this.sessionParams}getKeyParams(){return this.keyParams}getSuite(){return this.suite}getTag(){return this.tag}}Cl.expand=function(e){return new Cl(e.tag,e.suite,e.keyParams,e.sessionParams)};for(var Ul=Cl,Fl=[],zl=[],$l="undefined"!=typeof Uint8Array?Uint8Array:Array,Gl="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Wl=0,Hl=Gl.length;Wl<Hl;++Wl)Fl[Wl]=Gl[Wl],zl[Gl.charCodeAt(Wl)]=Wl;function Jl(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function Kl(e,t,r){for(var n,i,o=[],s=t;s<r;s+=3)n=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+2]),o.push(Fl[(i=n)>>18&63]+Fl[i>>12&63]+Fl[i>>6&63]+Fl[63&i]);return o.join("")}zl["-".charCodeAt(0)]=62,zl["_".charCodeAt(0)]=63;var Zl=function(e){var t,r,n=Jl(e),i=n[0],o=n[1],s=new $l(function(e,t,r){return 3*(t+r)/4-r}(0,i,o)),a=0,c=o>0?i-4:i;for(r=0;r<c;r+=4)t=zl[e.charCodeAt(r)]<<18|zl[e.charCodeAt(r+1)]<<12|zl[e.charCodeAt(r+2)]<<6|zl[e.charCodeAt(r+3)],s[a++]=t>>16&255,s[a++]=t>>8&255,s[a++]=255&t;return 2===o&&(t=zl[e.charCodeAt(r)]<<2|zl[e.charCodeAt(r+1)]>>4,s[a++]=255&t),1===o&&(t=zl[e.charCodeAt(r)]<<10|zl[e.charCodeAt(r+1)]<<4|zl[e.charCodeAt(r+2)]>>2,s[a++]=t>>8&255,s[a++]=255&t),s},ed=function(e){for(var t,r=e.length,n=r%3,i=[],o=16383,s=0,a=r-n;s<a;s+=o)i.push(Kl(e,s,s+o>a?a:s+o));return 1===n?(t=e[r-1],i.push(Fl[t>>2]+Fl[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],i.push(Fl[t>>10]+Fl[t>>4&63]+Fl[t<<2&63]+"=")),i.join("")},rd=function(e,t,r,n,i){var o,s,a=8*i-n-1,c=(1<<a)-1,u=c>>1,l=-7,d=r?i-1:0,f=r?-1:1,p=e[t+d];for(d+=f,o=p&(1<<-l)-1,p>>=-l,l+=a;l>0;o=256*o+e[t+d],d+=f,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=n;l>0;s=256*s+e[t+d],d+=f,l-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),o-=u}return(p?-1:1)*s*Math.pow(2,o-n)},id=function(e,t,r,n,i,o){var s,a,c,u=8*o-i-1,l=(1<<u)-1,d=l>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,h=n?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+d>=1?f/c:f*Math.pow(2,1-d))*c>=2&&(s++,c/=2),s+d>=l?(a=0,s=l):s+d>=1?(a=(t*c-1)*Math.pow(2,i),s+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,i),s=0));i>=8;e[r+p]=255&a,p+=h,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;e[r+p]=255&s,p+=h,s/=256,u-=8);e[r+p-h]|=128*m},sd=V((function(e,t){const r="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=o,t.SlowBuffer=function(e){return+e!=e&&(e=0),o.alloc(+e)},t.INSPECT_MAX_BYTES=50;const n=2147483647;function i(e){if(e>n)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,o.prototype),t}function o(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return c(e)}return s(e,t,r)}function s(e,t,r){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!o.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|f(e,t);let n=i(r);const s=n.write(e,t);return s!==r&&(n=n.slice(0,s)),n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(J(e,Uint8Array)){const t=new Uint8Array(e);return l(t.buffer,t.byteOffset,t.byteLength)}return u(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(J(e,ArrayBuffer)||e&&J(e.buffer,ArrayBuffer))return l(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(J(e,SharedArrayBuffer)||e&&J(e.buffer,SharedArrayBuffer)))return l(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return o.from(n,t,r);const s=function(e){if(o.isBuffer(e)){const t=0|d(e.length),r=i(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||K(e.length)?i(0):u(e):"Buffer"===e.type&&Array.isArray(e.data)?u(e.data):void 0}(e);if(s)return s;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return o.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function a(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function c(e){return a(e),i(e<0?0:0|d(e))}function u(e){const t=e.length<0?0:0|d(e.length),r=i(t);for(let n=0;n<t;n+=1)r[n]=255&e[n];return r}function l(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),Object.setPrototypeOf(n,o.prototype),n}function d(e){if(e>=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return 0|e}function f(e,t){if(o.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||J(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return H(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return X(e).length;default:if(i)return n?-1:H(e).length;t=(""+t).toLowerCase(),i=!0}}function p(e,t,r){let n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return O(this,t,r);case"utf8":case"utf-8":return R(this,t,r);case"ascii":return k(this,t,r);case"latin1":case"binary":return A(this,t,r);case"base64":return I(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function h(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function m(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),K(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=o.from(t,n)),o.isBuffer(t))return 0===t.length?-1:g(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):g(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function g(e,t,r,n,i){let o,s=1,a=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,r/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){let n=-1;for(o=r;o<a;o++)if(u(e,o)===u(t,-1===n?0:o-n)){if(-1===n&&(n=o),o-n+1===c)return n*s}else-1!==n&&(o-=o-n),n=-1}else for(r+c>a&&(r=a-c),o=r;o>=0;o--){let r=!0;for(let n=0;n<c;n++)if(u(e,o+n)!==u(t,n)){r=!1;break}if(r)return o}return-1}function v(e,t,r,n){r=Number(r)||0;const i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;const o=t.length;let s;for(n>o/2&&(n=o/2),s=0;s<n;++s){const n=parseInt(t.substr(2*s,2),16);if(K(n))return s;e[r+s]=n}return s}function y(e,t,r,n){return Y(H(t,e.length-r),e,r,n)}function w(e,t,r,n){return Y(function(e){const t=[];for(let r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function E(e,t,r,n){return Y(X(t),e,r,n)}function T(e,t,r,n){return Y(function(e,t){let r,n,i;const o=[];for(let s=0;s<e.length&&!((t-=2)<0);++s)r=e.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function I(e,t,r){return 0===t&&r===e.length?ed(e):ed(e.slice(t,r))}function R(e,t,r){r=Math.min(e.length,r);const n=[];let i=t;for(;i<r;){const t=e[i];let o=null,s=t>239?4:t>223?3:t>191?2:1;if(i+s<=r){let r,n,a,c;switch(s){case 1:t<128&&(o=t);break;case 2:r=e[i+1],128==(192&r)&&(c=(31&t)<<6|63&r,c>127&&(o=c));break;case 3:r=e[i+1],n=e[i+2],128==(192&r)&&128==(192&n)&&(c=(15&t)<<12|(63&r)<<6|63&n,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:r=e[i+1],n=e[i+2],a=e[i+3],128==(192&r)&&128==(192&n)&&128==(192&a)&&(c=(15&t)<<18|(63&r)<<12|(63&n)<<6|63&a,c>65535&&c<1114112&&(o=c))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=s}return function(e){const t=e.length;if(t<=P)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=P));return r}(n)}t.kMaxLength=n,o.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),o.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}}),o.poolSize=8192,o.from=function(e,t,r){return s(e,t,r)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array),o.alloc=function(e,t,r){return function(e,t,r){return a(e),e<=0?i(e):void 0!==t?"string"==typeof r?i(e).fill(t,r):i(e).fill(t):i(e)}(e,t,r)},o.allocUnsafe=function(e){return c(e)},o.allocUnsafeSlow=function(e){return c(e)},o.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==o.prototype},o.compare=function(e,t){if(J(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),J(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(e)||!o.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let r=e.length,n=t.length;for(let i=0,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},o.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return o.alloc(0);let r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;const n=o.allocUnsafe(t);let i=0;for(r=0;r<e.length;++r){let t=e[r];if(J(t,Uint8Array))i+t.length>n.length?(o.isBuffer(t)||(t=o.from(t)),t.copy(n,i)):Uint8Array.prototype.set.call(n,t,i);else{if(!o.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(n,i)}i+=t.length}return n},o.byteLength=f,o.prototype._isBuffer=!0,o.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)h(this,t,t+1);return this},o.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)h(this,t,t+3),h(this,t+1,t+2);return this},o.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)h(this,t,t+7),h(this,t+1,t+6),h(this,t+2,t+5),h(this,t+3,t+4);return this},o.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?R(this,0,e):p.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(e){if(!o.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===o.compare(this,e)},o.prototype.inspect=function(){let e="";const r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},r&&(o.prototype[r]=o.prototype.inspect),o.prototype.compare=function(e,t,r,n,i){if(J(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),!o.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;let s=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(t>>>=0);const c=Math.min(s,a),u=this.slice(n,i),l=e.slice(t,r);for(let e=0;e<c;++e)if(u[e]!==l[e]){s=u[e],a=l[e];break}return s<a?-1:a<s?1:0},o.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},o.prototype.indexOf=function(e,t,r){return m(this,e,t,r,!0)},o.prototype.lastIndexOf=function(e,t,r){return m(this,e,t,r,!1)},o.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return v(this,e,t,r);case"utf8":case"utf-8":return y(this,e,t,r);case"ascii":case"latin1":case"binary":return w(this,e,t,r);case"base64":return E(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const P=4096;function k(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function A(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function O(e,t,r){const n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);let i="";for(let n=t;n<r;++n)i+=Z[e[n]];return i}function L(e,t,r){const n=e.slice(t,r);let i="";for(let e=0;e<n.length-1;e+=2)i+=String.fromCharCode(n[e]+256*n[e+1]);return i}function D(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function M(e,t,r,n,i,s){if(!o.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<s)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function N(e,t,r,n,i){$(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,r}function j(e,t,r,n,i){$(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r+7]=o,o>>=8,e[r+6]=o,o>>=8,e[r+5]=o,o>>=8,e[r+4]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=s,s>>=8,e[r+2]=s,s>>=8,e[r+1]=s,s>>=8,e[r]=s,r+8}function B(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function _(e,t,r,n,i){return t=+t,r>>>=0,i||B(e,0,r,4),id(e,t,r,n,23,4),r+4}function U(e,t,r,n,i){return t=+t,r>>>=0,i||B(e,0,r,8),id(e,t,r,n,52,8),r+8}o.prototype.slice=function(e,t){const r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);const n=this.subarray(e,t);return Object.setPrototypeOf(n,o.prototype),n},o.prototype.readUintLE=o.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||D(e,t,this.length);let n=this[e],i=1,o=0;for(;++o<t&&(i*=256);)n+=this[e+o]*i;return n},o.prototype.readUintBE=o.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||D(e,t,this.length);let n=this[e+--t],i=1;for(;t>0&&(i*=256);)n+=this[e+--t]*i;return n},o.prototype.readUint8=o.prototype.readUInt8=function(e,t){return e>>>=0,t||D(e,1,this.length),this[e]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(e,t){return e>>>=0,t||D(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(e,t){return e>>>=0,t||D(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(e,t){return e>>>=0,t||D(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(e,t){return e>>>=0,t||D(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readBigUInt64LE=Q((function(e){G(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||W(e,this.length-8);const n=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(n)+(BigInt(i)<<BigInt(32))})),o.prototype.readBigUInt64BE=Q((function(e){G(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||W(e,this.length-8);const n=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(n)<<BigInt(32))+BigInt(i)})),o.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||D(e,t,this.length);let n=this[e],i=1,o=0;for(;++o<t&&(i*=256);)n+=this[e+o]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*t)),n},o.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||D(e,t,this.length);let n=t,i=1,o=this[e+--n];for(;n>0&&(i*=256);)o+=this[e+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},o.prototype.readInt8=function(e,t){return e>>>=0,t||D(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},o.prototype.readInt16LE=function(e,t){e>>>=0,t||D(e,2,this.length);const r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt16BE=function(e,t){e>>>=0,t||D(e,2,this.length);const r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt32LE=function(e,t){return e>>>=0,t||D(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return e>>>=0,t||D(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readBigInt64LE=Q((function(e){G(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||W(e,this.length-8);const n=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),o.prototype.readBigInt64BE=Q((function(e){G(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||W(e,this.length-8);const n=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(n)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+r)})),o.prototype.readFloatLE=function(e,t){return e>>>=0,t||D(e,4,this.length),rd(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return e>>>=0,t||D(e,4,this.length),rd(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return e>>>=0,t||D(e,8,this.length),rd(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return e>>>=0,t||D(e,8,this.length),rd(this,e,!1,52,8)},o.prototype.writeUintLE=o.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||M(this,e,t,r,Math.pow(2,8*r)-1,0);let i=1,o=0;for(this[t]=255&e;++o<r&&(i*=256);)this[t+o]=e/i&255;return t+r},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||M(this,e,t,r,Math.pow(2,8*r)-1,0);let i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},o.prototype.writeUint8=o.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,1,255,0),this[t]=255&e,t+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeBigUInt64LE=Q((function(e,t=0){return N(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),o.prototype.writeBigUInt64BE=Q((function(e,t=0){return j(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),o.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);M(this,e,t,r,n-1,-n)}let i=0,o=1,s=0;for(this[t]=255&e;++i<r&&(o*=256);)e<0&&0===s&&0!==this[t+i-1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+r},o.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);M(this,e,t,r,n-1,-n)}let i=r-1,o=1,s=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+r},o.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},o.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeBigInt64LE=Q((function(e,t=0){return N(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),o.prototype.writeBigInt64BE=Q((function(e,t=0){return j(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),o.prototype.writeFloatLE=function(e,t,r){return _(this,e,t,!0,r)},o.prototype.writeFloatBE=function(e,t,r){return _(this,e,t,!1,r)},o.prototype.writeDoubleLE=function(e,t,r){return U(this,e,t,!0,r)},o.prototype.writeDoubleBE=function(e,t,r){return U(this,e,t,!1,r)},o.prototype.copy=function(e,t,r,n){if(!o.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);const i=n-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,n):Uint8Array.prototype.set.call(e,this.subarray(r,n),t),i},o.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!o.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){const t=e.charCodeAt(0);("utf8"===n&&t<128||"latin1"===n)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;let i;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{const s=o.isBuffer(e)?e:o.from(e,n),a=s.length;if(0===a)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=s[i%a]}return this};const V={};function F(e,t,r){V[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function z(e){let t="",r=e.length;const n="-"===e[0]?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function $(e,t,r,n,i,o){if(e>r||e<t){const n="bigint"==typeof t?"n":"";let i;throw i=o>3?0===t||t===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(o+1)}${n}`:`>= -(2${n} ** ${8*(o+1)-1}${n}) and < 2 ** ${8*(o+1)-1}${n}`:`>= ${t}${n} and <= ${r}${n}`,new V.ERR_OUT_OF_RANGE("value",i,e)}!function(e,t,r){G(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||W(t,e.length-(r+1))}(n,i,o)}function G(e,t){if("number"!=typeof e)throw new V.ERR_INVALID_ARG_TYPE(t,"number",e)}function W(e,t,r){if(Math.floor(e)!==e)throw G(e,r),new V.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new V.ERR_BUFFER_OUT_OF_BOUNDS;throw new V.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}F("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?e+" is outside of buffer bounds":"Attempt to access memory outside buffer bounds"}),RangeError),F("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),F("ERR_OUT_OF_RANGE",(function(e,t,r){let n=`The value of "${e}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=z(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=z(i)),i+="n"),n+=` It must be ${t}. Received ${i}`,n}),RangeError);const q=/[^+/0-9A-Za-z-_]/g;function H(e,t){let r;t=t||1/0;const n=e.length;let i=null;const o=[];for(let s=0;s<n;++s){if(r=e.charCodeAt(s),r>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function X(e){return Zl(function(e){if((e=(e=e.split("=")[0]).trim().replace(q,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Y(e,t,r,n){let i;for(i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function J(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function K(e){return e!=e}const Z=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let i=0;i<16;++i)t[n+i]=e[r]+e[i]}return t}();function Q(e){return"undefined"==typeof BigInt?ee:e}function ee(){throw new Error("BigInt not supported")}})),cd=V((function(e,t){var r=sd.Buffer;function n(e,t){for(var r in e)t[r]=e[r]}function i(e,t,n){return r(e,t,n)}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?e.exports=sd:(n(sd,t),t.Buffer=i),n(r,i),i.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return r(e,t,n)},i.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=r(e);return void 0!==t?"string"==typeof n?i.fill(t,n):i.fill(t):i.fill(0),i},i.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r(e)},i.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return sd.SlowBuffer(e)}})),ld=V((function(e){var t=65536,r=cd.Buffer,n=U.crypto||U.msCrypto;n&&n.getRandomValues?e.exports=function(e,i){if(e>4294967295)throw new RangeError("requested too many random bytes");var o=r.allocUnsafe(e);if(e>0)if(e>t)for(var s=0;s<e;s+=t)n.getRandomValues(o.slice(s,s+t));else n.getRandomValues(o);return"function"==typeof i?k.nextTick((function(){i(null,o)})):o}:e.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}}));class Vl{constructor(e,t){this.ufrag=e,this.pwd=t,this.lite=!1,this.endOfCandidates=!1}clone(){const e=new Vl(this.ufrag,this.pwd);return e.setLite(this.lite),e.setEndOfCandidates(this.endOfCandidates),e}plain(){const e={ufrag:this.ufrag,pwd:this.pwd};return this.lite&&(e.lite=this.lite),this.endOfCandidates&&(e.endOfCandidates=this.endOfCandidates),e}getUfrag(){return this.ufrag}getPwd(){return this.pwd}isLite(){return this.lite}setLite(e){this.lite=e}isEndOfCandidates(){return this.endOfCandidates}setEndOfCandidates(e){this.endOfCandidates=e}}Vl.generate=function(e){const t=new Vl,r=ld(8),n=ld(24);return t.ufrag=r.toString("hex"),t.pwd=n.toString("hex"),t.lite=e,t},Vl.expand=function(e){const t=new Vl(e.ufrag,e.pwd);return t.setLite(e.lite),t.setEndOfCandidates(e.endOfCandidates),t};var fd=Vl;const hd=Nl("SEND","RECV");hd.byValue=function(e){return hd[e.toUpperCase()]},hd.toString=function(e){switch(e){case hd.SEND:return"send";case hd.RECV:return"recv"}},hd.reverse=function(e){switch(e){case hd.SEND:return hd.RECV;case hd.RECV:return hd.SEND}};var md=hd;class ql{constructor(e,t){this.id=e,this.direction=t,this.formats=[],this.params=new Map}clone(){var e=new ql(this.id,this.direction);return e.setFormats(this.formats),e.setParams(this.params),e}plain(){var e={id:this.id,direction:md.toString(this.direction)};for(var[t,r]of(this.formats&&(e.formats=this.formats),this.params.entries()))e.params||(e.params={}),e.params[t]=r;return e}getId(){return this.id}getDirection(){return this.direction}setDirection(e){this.direction=e}getFormats(){return this.formats}setFormats(e){this.formats=[];for(let t=0;t<e.length;++t)this.formats.push(parseInt(e[t]))}getParams(){return this.params}setParams(e){this.params=new Map(e)}addParam(e,t){this.params.set(e,t)}getDirection(){return this.direction}setDirection(e){this.direction=e}}ql.expand=function(e){const t=new ql(e.id,md.byValue(e.direction));for(let r in e.params)t.addParam(r,e.params[r]);return e.formats&&t.setFormats(e.formats),t};var gd=ql;class Xl{constructor(e,t){this.paused=t,this.id=e}clone(){return new Xl(this.id,this.paused)}plain(){return{id:this.id,paused:this.paused}}isPaused(){return this.paused}getId(){return this.id}}Xl.expand=function(e){return new Xl(e.id,e.paused)};var vd=Xl;class Yl{constructor(){this.send=[],this.recv=[]}clone(){const e=new Yl;for(let t=0;t<this.send.length;++t){let r=[];for(let e=0;t<this.send[e].length;++t)r.push(this.send[t][e].clone());e.addSimulcastAlternativeStreams(md.SEND,r)}for(let t=0;t<this.recv.length;++t){let r=[];for(let e=0;t<this.recv[e].length;++t)r.push(this.recv[t][e].clone());e.addSimulcastAlternativeStreams(md.RECV,r)}return e}plain(){const e={send:[],recv:[]};for(let t=0;t<this.send.length;++t){let r=[];for(let e=0;e<this.send[t].length;++e)r.push(this.send[t][e].plain());e.send.push(r)}for(let t=0;t<this.recv.length;++t){let r=[];for(let e=0;e<this.recv[t].length;++e)r.push(this.recv[t][e].plain());e.recv.push(r)}return e}addSimulcastAlternativeStreams(e,t){return e===md.SEND?this.send.push(t):this.recv.push(t)}addSimulcastStream(e,t){return e===md.SEND?this.send.push([t]):this.recv.push([t])}getSimulcastStreams(e){return e===md.SEND?this.send:this.recv}}Yl.expand=function(e){const t=new Yl;for(let r=0;r<e.send.length;++r){let n=[];for(let t=0;t<e.send[r].length;++t)n.push(vd.expand(e.send[r][t]));t.addSimulcastAlternativeStreams(md.SEND,n)}for(let r=0;r<e.recv.length;++r){let n=[];for(let t=0;t<e.recv[r].length;++t)n.push(vd.expand(e.recv[r][t]));t.addSimulcastAlternativeStreams(md.RECV,n)}return t};var yd=Yl;const wd=Nl("SENDRECV","SENDONLY","RECVONLY","INACTIVE");wd.byValue=function(e){return wd[e.toUpperCase()]},wd.toString=function(e){switch(e){case wd.SENDRECV:return"sendrecv";case wd.SENDONLY:return"sendonly";case wd.RECVONLY:return"recvonly";case wd.INACTIVE:return"inactive"}},wd.reverse=function(e){switch(e){case wd.SENDRECV:return wd.SENDRECV;case wd.SENDONLY:return wd.RECVONLY;case wd.RECVONLY:return wd.SENDONLY;case wd.INACTIVE:return wd.INACTIVE}};var bd=wd;class Ql{constructor(e,t){this.port=e,this.maxMessageSize=t}clone(){return new Ql(this.port,this.maxMessageSize)}plain(){return{port:this.port,maxMessageSize:this.maxMessageSize}}getPort(){return this.port}getMaxMessageSize(){return this.maxMessageSize}}Ql.expand=function(e){return new Ql(e.port,e.maxMessageSize)};var Cd=Ql;class td{constructor(e,t){this.id=e,this.type=t,this.direction=bd.SENDRECV,this.extensions=new Map,this.codecs=new Map,this.rids=new Map,this.simulcast=null,this.bitrate=0,this.control=null,this.dataChannel=null}clone(){const e=new td(this.id,this.type);e.setDirection(this.direction),e.setBitrate(this.bitrate);for(const t of this.codecs.values())e.addCodec(t.clone());for(const[t,r]of this.extensions.entries())e.addExtension(t,r);for(const t of this.rids.values())e.addRID(t.clone());return this.simulcast&&e.setSimulcast(this.simulcast.clone()),this.control&&e.setControl(this.control),this.dataChannel&&e.setDatachannel(this.dataChannel.clone()),e}plain(){const e={id:this.id,type:this.type,direction:bd.toString(this.direction),codecs:[]};this.dataChannel&&(e.dataChannel=this.dataChannel.plain()),this.bitrate&&(e.bitrate=this.bitrate);for(const t of this.codecs.values())e.codecs.push(t.plain());for(const[t,r]of this.extensions.entries())e.extensions||(e.extensions={}),e.extensions[t]=r;for(const t of this.rids.values())e.rids||(e.rids=[]),e.rids.push(t.plain());return this.simulcast&&(e.simulcast=this.simulcast.plain()),this.control&&(e.control=this.control),e}getType(){return this.type}getId(){return this.id}setId(e){this.id=e}addExtension(e,t){this.extensions.set(e,t)}addRID(e){this.rids.set(e.getId(),e)}addCodec(e){this.codecs.set(e.getType(),e)}setCodecs(e){this.codecs=e}getCodecForType(e){return this.codecs.get(e)}getCodec(e){for(const t of this.codecs.values())if(t.getCodec().toLowerCase()===e.toLowerCase())return t;return null}hasCodec(e){return null!==this.getCodec(e)}getCodecs(){return this.codecs}hasRTX(){for(const e of this.codecs.values())if(e.hasRTX())return!0;return!1}getExtensions(){return this.extensions}getRIDs(){return this.rids}getRID(e){return this.rids.get(e)}getBitrate(){return this.bitrate}setBitrate(e){this.bitrate=e}getDirection(){return this.direction}setDirection(e){this.direction=e}hasControl(){return!!this.control}getControl(){return this.control}setControl(e){this.control=e}hasDataChannel(){return!!this.dataChannel}getDataChannel(){return this.dataChannel}setDataChannel(e){this.dataChannel=e}answer(e){const t=new td(this.id,this.type);if(e){if(t.setDirection(bd.reverse(this.direction)),e.codecs){let r;r=Array.isArray(e.codecs)?Ml.MapFromNames(e.codecs,e.rtx,e.rtcpfbs):e.codecs;for(let e of this.codecs.values())if(r.has(e.getCodec().toLowerCase())){const n=r.get(e.getCodec().toLowerCase());if("h264"===n.getCodec()&&n.hasParam("packetization-mode")&&n.getParam("packetization-mode")!=e.getParam("packetization-mode","0"))continue;if("h264"===n.getCodec()&&n.hasParam("profile-level-id")&&e.hasParam("profile-level-id")&&n.getParam("profile-level-id")!=e.getParam("profile-level-id"))continue;if("multiopus"===n.getCodec()&&n.hasParam("num_streams")&&e.hasParam("num_streams")&&n.getParam("num_streams")!=e.getParam("num_streams"))continue;const i=n.clone();i.setType(e.getType()),i.hasRTX()&&i.setRTX(e.getRTX()),e.hasChannels()&&i.setChannels(e.getChannels()),i.addParams(e.getParams()),t.addCodec(i)}}const n=new Set(e.extensions);for(let[e,r]of this.extensions)n.has(r)&&t.addExtension(e,r);if(e.simulcast&&this.simulcast){const e=new yd,n=this.simulcast.getSimulcastStreams(md.SEND);if(n)for(let t=0;t<n.length;++t){var r=[];for(let e=0;e<n[t].length;++e)r.push(n[t][e].clone());e.addSimulcastAlternativeStreams(md.RECV,r)}const i=this.simulcast.getSimulcastStreams(md.RECV);if(i)for(let t=0;t<i.length;++t){r=[];for(let e=0;e<i[t].length;++e)r.push(i[t][e].clone());e.addSimulcastAlternativeStreams(md.SEND,r)}for(const e of this.rids.values()){const r=e.clone();r.setDirection(md.reverse(e.getDirection())),t.addRID(r)}t.setSimulcast(e)}if(e.dataChannel&&this.dataChannel){const r=new Cd(this.dataChannel.getPort(),e.dataChannel.maxMessageSize?e.dataChannel.maxMessageSize:this.dataChannel.getMaxMessageSize());t.setDataChannel(r)}}else t.setDirection(bd.INACTIVE);return t}getSimulcast(){return this.simulcast}setSimulcast(e){this.simulcast=e}}td.create=function(e,t){const r=new td(e,e);return t?t.codecs&&(Array.isArray(t.codecs)?r.setCodecs(Ml.MapFromNames(t.codecs,t.rtx,t.rtcpfbs)):r.setCodecs(t.codecs)):r.setDirection(bd.INACTIVE),r},td.expand=function(e){const t=new td(e.id,e.type);if(e.direction&&t.setDirection(bd.byValue(e.direction)),t.setBitrate(e.bitrate),e.dataChannel){const r=Cd.expand(e.dataChannel);r&&t.setDataChannel(r)}for(let r in e.extensions)t.addExtension(r,e.extensions[r]);for(let r=0;e.codecs&&r<e.codecs.length;++r){const n=Ml.expand(e.codecs[r]);n&&t.addCodec(n)}for(let r=0;e.rids&&r<e.rids.length;++r){const n=gd.expand(e.rids[r]);t.addRID(n)}return e.simulcast&&t.setSimulcast(yd.expand(e.simulcast)),e.control&&t.setControl(e.control),t};var xd=td;class nd{constructor(e,t){this.semantics=e,this.ssrcs=[];for(let e=0;e<t.length;++e)this.ssrcs.push(parseInt(t[e]))}clone(){return new nd(this.semantics,this.ssrcs)}plain(){const e={semantics:this.semantics,ssrcs:[]};for(let t=0;t<this.ssrcs.length;++t)e.ssrcs.push(this.ssrcs[t]);return e}getSemantics(){return this.semantics}getSSRCs(){return this.ssrcs}}nd.expand=function(e){return new nd(e.semantics,e.ssrcs)};var Ed=nd;class od{constructor(e){this.ssrc=e}clone(){const e=new od(this.ssrc);e.setCName(this.cname),e.setStreamId(this.streamId),e.setTrackId(this.trackId)}plain(){const e={ssrc:this.ssrc};return this.cname&&(e.cname=this.cname),this.streamId&&(e.streamId=this.streamId),this.trackId&&(e.trackid=this.trackId),e}getCName(){return this.cname}setCName(e){this.cname=e}getStreamId(){return this.streamId}setStreamId(e){this.streamId=e}getTrackId(){return this.trackId}setTrackId(e){this.trackId=e}getSSRC(){return this.ssrc}}od.expand=function(e){const t=new od(e.ssrc);return t.setCName(e.cname),t.setStreamId(e.streamId),t.setTrackId(e.trackId),t};var Td=od;class ad{constructor(e,t){this.id=e,this.paused=t,this.codecs=new Map,this.params=new Map}clone(){var e=new ad(this.id,this.paused);for(let t of this.codecs.values())e.addCodec(t.clone());return e.setParams(this.params),e}plain(){var e={id:this.id,paused:this.paused,codecs:{},params:{}};for(var[t,r]of this.codecs.entries())e.codecs[t]=r.plain();for(var[t,n]of this.params.entries())e.params[t]=n;return e}getId(){return this.id}getCodecs(){return this.codecs}addCodec(e){this.codecs.set(e.getType(),e)}getParams(){return this.params}setParams(e){this.params=new Map(e)}addParam(e,t){this.params.set(e,t)}isPaused(){return this.paused}}ad.expand=function(e){const t=new ad(e.id,e.paused);for(let r in e.codecs)t.addCodec(Ml.expand(e.codecs[r]));for(let r in e.params)t.addParam(r,e.params[r]);return t};var Id=ad;class ud{constructor(e,t){this.media=e,this.id=t,this.ssrcs=[],this.groups=[],this.encodings=[]}clone(){const e=new ud(this.media,this.id);this.mediaId&&e.setMediaId(this.mediaId);for(let t=0;t<this.ssrcs.length;++t)e.addSSRC(this.ssrcs[t]);for(let t=0;t<this.groups.length;++t)e.addSourceGroup(this.groups[t].clone());for(let t=0;t<this.encodings.length;++t){const r=[];for(let e=0;e<this.encodings[t].length;++e)r.push(this.encodings[t][e].clone());e.addAlternativeEncodings(r)}return e}plain(){const e={media:this.media,id:this.id,ssrcs:[]};this.mediaId&&(e.mediaId=this.mediaId);for(let t=0;t<this.ssrcs.length;++t)e.ssrcs.push(this.ssrcs[t]);for(let t=0;t<this.groups.length;++t)e.groups||(e.groups=[]),e.groups.push(this.groups[t].plain());for(let t=0;t<this.encodings.length;++t){const r=[];for(let e=0;e<this.encodings[t].length;++e)r.push(this.encodings[t][e].plain());r.length&&(e.encodings||(e.encodings=[]),e.encodings.push(r))}return e}getMedia(){return this.media}setMediaId(e){this.mediaId=e}getMediaId(){return this.mediaId}getId(){return this.id}addSSRC(e){this.ssrcs.push(e)}getSSRCs(){return this.ssrcs}addSourceGroup(e){this.groups.push(e)}getSourceGroup(e){for(const t of this.groups)if(t.getSemantics().toLowerCase()===e.toLowerCase())return t;return null}getSourceGroups(){return this.groups}hasSourceGroup(e){for(const t of this.groups)if(t.getSemantics().toLowerCase()===e.toLowerCase())return!0;return!1}getEncodings(){return this.encodings}addEncoding(e){this.encodings.push([e])}addAlternativeEncodings(e){this.encodings.push(e)}setEncodings(e){this.encodings=e}}ud.expand=function(e){const t=new ud(e.media,e.id);e.mediaId&&t.setMediaId(e.mediaId);for(let r=0;e.ssrcs&&r<e.ssrcs.length;++r)t.addSSRC(e.ssrcs[r]);for(let r=0;e.groups&&r<e.groups.length;++r)t.addSourceGroup(Ed.expand(e.groups[r]));for(let r=0;e.encodings&&r<e.encodings.length;++r){const n=[];for(let t=0;t<e.encodings[r].length;++t)n.push(Id.expand(e.encodings[r][t]));t.addAlternativeEncodings(n)}return t};var Pd=ud;class dd{constructor(e){this.id=e,this.tracks=new Map}clone(){const e=new dd(this.id);for(const t of this.tracks.values())e.addTrack(t.clone());return e}plain(){const e={id:this.id,tracks:[]};for(const t of this.tracks.values())e.tracks.push(t.plain());return e}getId(){return this.id}addTrack(e){this.tracks.set(e.getId(),e)}removeTrack(e){return this.tracks.delete(e.getId())}removeTrackById(e){return this.tracks.delete(e)}getFirstTrack(e){for(let t of this.tracks.values())if(t.getMedia().toLowerCase()===e.toLowerCase())return t;return null}getTracks(){return this.tracks}removeAllTracks(){this.tracks.clear()}getTrack(e){return this.tracks.get(e)}}dd.expand=function(e){const t=new dd(e.id,e.paused);for(let r=0;r<e.tracks.length;++r){const n=Pd.expand(e.tracks[r]);n&&t.addTrack(n)}return t};var kd=dd;class pd{constructor(e){this.version=e||1,this.streams=new Map,this.medias=new Array,this.candidates=new Array,this.ice=null,this.dtls=null,this.crypto=null,this.extmapAllowMixed=!0}clone(){const e=new pd(this.version);for(let t=0;t<this.medias.length;++t)e.addMedia(this.medias[t].clone());for(const t of this.streams.values())e.addStream(t.clone());for(let t=0;t<this.candidates.length;++t)e.addCandidate(this.candidates[t].clone());return e.setICE(this.ice.clone()),this.dtls&&e.setDTLS(this.dtls.clone()),this.crypto&&e.setCrypto(this.crypto.clone()),e.setExmapAllowMixed(this.extmapAllowMixed),e}plain(){const e={version:this.version,streams:[],medias:[],candidates:[]};for(let t=0;t<this.medias.length;++t)e.medias.push(this.medias[t].plain());for(const t of this.streams.values())e.streams.push(t.plain());for(let t=0;t<this.candidates.length;++t)e.candidates.push(this.candidates[t].plain());return this.ice&&(e.ice=this.ice.plain()),this.dtls&&(e.dtls=this.dtls.plain()),this.crypto&&(e.crypto=this.crypto.plain()),this.extmapAllowMixed||(e.extmapAllowMixedNotSupported=!this.extmapAllowMixed),e}unify(){const e=new pd(this.version);for(let t=0;t<this.medias.length;++t)e.addMedia(this.medias[t].clone());const t={audio:e.getMediasByType("audio"),video:e.getMediasByType("video")};for(const r of this.streams.values()){const n=r.clone();for(const r of n.getTracks().values()){let n=t[r.getMedia()].pop();n||(n=this.getMedia(r.getMedia()).clone(),n.setId(r.getId()),e.addMedia(n)),r.setMediaId(n.getId())}e.addStream(n)}for(let t=0;t<this.candidates.length;++t)e.addCandidate(this.candidates[t].clone());return this.ice&&e.setICE(this.ice.clone()),this.dtls&&e.setDTLS(this.dtls.clone()),this.crypto&&e.setCrypto(this.crypto.clone()),e}setVersion(e){this.version=e}addMedia(e){this.medias.push(e)}getMedia(e){for(let t in this.medias){let r=this.medias[t];if(r.getType().toLowerCase()===e.toLowerCase())return r}return null}getMediasByType(e){var t=[];for(let r in this.medias){let n=this.medias[r];n.getType().toLowerCase()===e.toLowerCase()&&t.push(n)}return t}getMediaById(e){for(let t in this.medias){let r=this.medias[t];if(r.getId().toLowerCase()===e.toLowerCase())return r}return null}replaceMedia(e){for(let t in this.medias)if(this.medias[t].getId()==e.getId())return this.medias[t]=e,!0;return!1}getMedias(){return this.medias}getVersion(){return this.version}getDTLS(){return this.dtls}setDTLS(e){this.dtls=e}hasCrypto(){return!!this.crypto}getCrypto(){return this.crypto}setCrypto(e){this.crypto=e}hasICE(){return!!this.ice}getICE(){return this.ice}setICE(e){this.ice=e}addCandidate(e){for(let t=0;t<this.candidates.length;++t)if(this.candidates[t].equals(e))return;this.candidates.push(e)}addCandidates(e){for(let t=0;t<e.length;++t)this.addCandidate(e[t])}getCandidates(){return this.candidates}getStream(e){return this.streams.get(e)}getStreams(){return this.streams}getFirstStream(){for(let e of this.streams.values())return e;return null}addStream(e){this.streams.set(e.getId(),e)}removeStream(e){return this.streams.delete(e.getId())}removeAllStreams(){this.streams.clear()}getTrackByMediaId(e){for(let t of this.streams.values())for(let[r,n]of t.getTracks())if(n.getMediaId()==e)return n;return null}getStreamByMediaId(e){for(let t of this.streams.values())for(let[r,n]of t.getTracks())if(n.getMediaId()==e)return t;return null}getExtmapAllowMixed(){return this.extmapAllowMixed}setExtmapAllowMixed(e){this.extmapAllowMixed=e}answer(e){const t=new pd;e.ice&&(e.ice instanceof fd?t.setICE(e.ice.clone()):t.setICE(fd.expand(e.ice))),e.dtls&&(e.dtls instanceof _l?t.setDTLS(e.dtls):t.setDTLS(_l.expand(e.dtls))),e.crypto&&(e.crypto instanceof Ul?t.setCrypto(e.crypto):t.setCrypto(Ul.expand(e.crypto)));for(let r=0;e.candidates&&r<e.candidates.length;++r)e.candidates[r]instanceof Ll?t.addCandidate(e.candidates[r].clone()):t.addCandidate(Ll.expand(e.candidates[r]));for(const r of this.medias){const n=e&&e.capabilities&&e.capabilities[r.getType()];t.addMedia(r.answer(n))}return t.setExtmapAllowMixed(this.extmapAllowMixed),t}toString(){let e={version:0,media:[]};e.version=0,e.origin={username:"-",sessionId:(new Date).getTime(),sessionVersion:this.version,netType:"IN",ipVer:4,address:"127.0.0.1"},e.name="semantic-sdp",e.connection={version:4,ip:"0.0.0.0"},e.timing={start:0,stop:0},this.hasICE()&&this.getICE().isLite()&&(e.icelite="ice-lite"),e.msidSemantic={semantic:"WMS",token:"*"},e.groups=[],this.extmapAllowMixed&&(e.extmapAllowMixed="extmap-allow-mixed");let t={type:"BUNDLE",mids:[]};for(let r in this.medias){let n=this.medias[r],i={type:n.getType(),port:9,protocol:"",fmtp:[],rtp:[],rtcpFb:[],ext:[],bandwidth:[],candidates:[],ssrcGroups:[],ssrcs:[],rids:[]};i.direction=bd.toString(n.getDirection()),this.extmapAllowMixed&&(i.extmapAllowMixed="extmap-allow-mixed"),i.mid=n.getId(),t.mids.push(n.getId()),n.hasControl()&&(i.control=n.getControl()),n.getBitrate()>0&&(i.bandwidth.push({type:"AS",limit:n.getBitrate()}),i.bandwidth.push({type:"TIAS",limit:1e3*n.getBitrate()}));let o=this.getCandidates();for(let e=0;e<o.length;++e){let t=o[e];i.candidates.push({foundation:t.getFoundation(),component:t.getComponentId(),transport:t.getTransport(),priority:t.getPriority(),ip:t.getAddress(),port:t.getPort(),type:t.getType(),raddr:t.getRelAddr(),rport:t.getRelPort()})}if(this.getICE()&&(i.iceUfrag=this.getICE().getUfrag(),i.icePwd=this.getICE().getPwd()),["audio","video"].includes(n.getType().toLowerCase())){i.rtcpMux="rtcp-mux",i.rtcpRsize="rtcp-rsize",this.getDTLS()?(i.protocol="UDP/TLS/RTP/SAVPF",i.fingerprint={type:this.getDTLS().getHash(),hash:this.getDTLS().getFingerprint()},i.setup=Bl.toString(this.getDTLS().getSetup())):this.getCrypto()?(i.protocol="RTP/SAVPF",i.crypto=[{id:this.getCrypto().getTag(),suite:this.getCrypto().getSuite(),config:this.getCrypto().getKeyParams()}]):i.protocol="RTP/AVP";for(let e of n.getCodecs().values()){"video"===n.getType().toLowerCase()?i.rtp.push({payload:e.getType(),codec:e.getCodec().toUpperCase(),rate:9e4}):"opus"===e.getCodec().toLowerCase()||"multiopus"===e.getCodec().toLowerCase()?i.rtp.push({payload:e.getType(),codec:e.getCodec(),rate:48e3,encoding:e.getChannels()}):i.rtp.push({payload:e.getType(),codec:e.getCodec(),rate:8e3});for(const t of e.getRTCPFeedbacks())i.rtcpFb.push({payload:e.getType(),type:t.getId(),subtype:t.getParams().join(" ")});e.hasRTX()&&(i.rtp.push({payload:e.getRTX(),codec:"rtx",rate:9e4}),i.fmtp.push({payload:e.getRTX(),config:"apt="+e.getType()}));const t=e.getParams();if(Object.keys(t).length){const r={payload:e.getType(),config:""};for(const e in t)r.config.length&&(r.config+=";"),t.hasOwnProperty(e)?r.config+=e+"="+t[e]:r.config+=e;i.fmtp.push(r)}}const e=[];for(let t=0;t<i.rtp.length;++t)e.push(i.rtp[t].payload);i.payloads=e.join(" ");for(let[e,t]of n.getExtensions().entries())i.ext.push({value:e,uri:t});for(let e of n.getRIDs().values()){let t={id:e.getId(),direction:md.toString(e.getDirection()),params:""};e.getFormats().length&&(t.params="pt="+e.getFormats().join(","));for(let[r,n]of e.getParams().entries())t.params+=(t.params.length?";":"")+r+"="+n;i.rids.push(t)}const t=n.getSimulcast();if(t){let e=1;i.simulcast={};const r=t.getSimulcastStreams(md.SEND),n=t.getSimulcastStreams(md.RECV);if(r&&r.length){let t="";for(let e=0;e<r.length;++e){let n="";for(let t=0;t<r[e].length;++t)n+=(n.length?",":"")+(r[e][t].isPaused()?"~":"")+r[e][t].getId();t+=(t.length?";":"")+n}i.simulcast["dir"+e]="send",i.simulcast["list"+e]=t,e++}if(n&&n.length){let t=[];for(let e=0;e<n.length;++e){let r="";for(let t=0;t<n[e].length;++t)r+=(r.length?",":"")+(n[e][t].isPaused()?"~":"")+n[e][t].getId();t+=(t.length?";":"")+r}i.simulcast["dir"+e]="recv",i.simulcast["list"+e]=t,e++}}}else if(n.hasDataChannel()){i.protocol="UDP/DTLS/SCTP",i.payloads="webrtc-datachannel";const e=n.getDataChannel();i.sctpPort=e.getPort(),i.maxMessageSize=e.getMaxMessageSize()}e.media.push(i)}for(let t of this.streams.values())for(let r of t.getTracks().values())for(let n in e.media){let i=e.media[n];if(r.getMediaId()){if(r.getMediaId()==i.mid){let e=r.getSourceGroups();for(let t in e){let r=e[t];i.ssrcGroups.push({semantics:r.getSemantics(),ssrcs:r.getSSRCs().join(" ")})}let n=r.getSSRCs();for(let e in n)i.ssrcs.push({id:n[e],attribute:"cname",value:t.getId()}),i.ssrcs.push({id:n[e],attribute:"msid",value:t.getId()+" "+r.getId()});i.msid=t.getId()+" "+r.getId();break}}else if(i.type.toLowerCase()===r.getMedia().toLowerCase()){let e=r.getSourceGroups();for(let t in e){let r=e[t];i.ssrcGroups.push({semantics:r.getSemantics(),ssrcs:r.getSSRCs().join(" ")})}let n=r.getSSRCs();for(let e in n)i.ssrcs.push({id:n[e],attribute:"cname",value:t.getId()}),i.ssrcs.push({id:n[e],attribute:"msid",value:t.getId()+" "+r.getId()});break}}return t.mids=t.mids.join(" "),e.groups.push(t),Ol.write(e)}toIceFragmentString(){let e={version:0,media:[],candidates:[]};this.hasICE()&&this.getICE().isLite()&&(e.icelite="ice-lite"),this.getICE()&&(e.iceUfrag=this.getICE().getUfrag(),e.icePwd=this.getICE().getPwd());for(const t of this.getCandidates())e.candidates.push({foundation:t.getFoundation(),component:t.getComponentId(),transport:t.getTransport(),priority:t.getPriority(),ip:t.getAddress(),port:t.getPort(),type:t.getType(),raddr:t.getRelAddr(),rport:t.getRelPort()});return Ol.write(e).slice(10)}}pd.create=function(e){const t=new pd;e.ice&&(e.ice instanceof fd?t.setICE(e.ice.clone()):t.setICE(fd.expand(e.ice))),e.dtls&&(e.dtls instanceof _l?t.setDTLS(e.dtls):t.setDTLS(_l.expand(e.dtls))),e.crypto&&(e.crypto instanceof Ul?t.setCrypto(e.crypto):t.setCrypto(Ul.expand(e.crypto)));for(let r=0;e.candidates&&r<e.candidates.length;++r)e.candidates[r]instanceof Ll?t.addCandidate(e.candidates[r].clone()):t.addCandidate(Ll.expand(e.candidates[r]));let r=96,n=1;for(let i in e.capabilities){const o=xd.create(i,e.capabilities[i]);for(const[e,t]of o.getCodecs())t.getType()>=96&&t.setType(r++),t.getRTX()&&t.setRTX(r++);if(e.capabilities[i].extensions)for(let t of e.capabilities[i].extensions)15===n&&n++,o.addExtension(n++,t);t.addMedia(o)}return t},pd.expand=function(e){const t=new pd(e.version);for(let r=0;e.medias&&r<e.medias.length;++r){const n=xd.expand(e.medias[r]);n&&t.addMedia(n)}for(let r=0;e.streams&&r<e.streams.length;++r){const n=kd.expand(e.streams[r]);n&&t.addStream(n)}for(let r=0;e.candidates&&r<e.candidates.length;++r){const n=Ll.expand(e.candidates[r]);n&&t.addCandidate(n)}return e.ice&&t.setICE(fd.expand(e.ice)),e.dtls&&t.setDTLS(_l.expand(e.dtls)),e.crypto&&t.setCrypto(_l.expand(e.crypto)),e.extmapAllowMixedNotSupported&&(this.extmapAllowMixed=!e.extmapAllowMixedNotSupported),t},pd.process=function(e){return pd.parse(e)},pd.parse=function(e){const t=Ol.parse(e),r=new pd;if(r.setVersion(t.version),t.iceUfrag&&t.icePwd){const e=String(t.iceUfrag),n=String(t.icePwd),i=new fd(e,n);i.setLite("ice-lite"==t.icelite),i.setEndOfCandidates("end-of-candidates"==t.endOfCandidates),r.setICE(i)}for(let e in t.media){const n=t.media[e],i=n.type,o=n.mid?n.mid.toString():e,s=new xd(o,i);if(n.iceUfrag&&n.icePwd){const e=String(n.iceUfrag),i=String(n.icePwd),o=new fd(e,i);o.setLite("ice-lite"==t.icelite),o.setEndOfCandidates("end-of-candidates"==n.endOfCandidates),r.setICE(o)}for(let e=0;n.candidates&&e<n.candidates.length;++e){const t=n.candidates[e],i=new Ll(t.foundation,t.component,t.transport,t.priority,t.ip,t.port,t.type,t.raddr,t.rport);r.addCandidate(i)}const a=n.fingerprint||t.fingerprint;if(a){const e=a.type,t=a.hash;let i=Bl.ACTPASS;n.setup&&(i=Bl.byValue(n.setup)),r.setDTLS(new _l(i,e,t))}if(n.crypto){const e=n.crypto[0];r.setCrypto(new Ul(e.id,e.suite,e.config,e.sessionConfig))}let c=bd.SENDRECV;n.direction&&(c=bd.byValue(n.direction),s.setDirection(c)),n.control&&s.setControl(n.control),r.setExtmapAllowMixed("extmap-allow-mixed"==n.extmapAllowMixed||"extmap-allow-mixed"==t.extmapAllowMixed);const u=new Map;for(let e in n.rtp){const t=n.rtp[e],r=t.payload,i=t.codec;if("RED"===i.toUpperCase()||"ULPFEC"===i.toUpperCase())continue;let o={};for(let e in n.fmtp){const t=n.fmtp[e];if(t.payload===r){const e=t.config.split(";");for(let t in e){const r=e[t].split("="),n=r[0].trim(),i=r.splice(1).join("=").trim();o[n]=i}}}if("RTX"===i.toUpperCase())u.set(parseInt(o.apt),r);else{const e=new Ml(i,r,o);t.encoding>1&&e.setChannels(t.encoding),s.addCodec(e)}}for(let e of u.entries()){const t=s.getCodecForType(e[0]);t&&t.setRTX(e[1])}for(let e=0;n.rtcpFb&&e<n.rtcpFb.length;++e){const t=s.getCodecForType(n.rtcpFb[e].payload);if(t){const r=n.rtcpFb[e].type,i=n.rtcpFb[e].subtype?n.rtcpFb[e].subtype.split(" "):null;t.addRTCPFeedback(new Dl(r,i))}}const l=n.ext;for(let e in l){const t=l[e];s.addExtension(t.value,t.uri)}const d=n.rids;for(let e in d){const t=d[e],r=new gd(t.id,md.byValue(t.direction));let n=[];const i=new Map;if(t.params){const e=Ol.parseParams(t.params);for(let t in e)"pt"===t?n=e[t].split(","):i.set(t,e[t]);r.setFormats(n),r.setParams(i)}s.addRID(r)}const f=[];if(n.simulcast){const e=new yd;if(n.simulcast.dir1){const t=md.byValue(n.simulcast.dir1),r=Ol.parseSimulcastStreamList(n.simulcast.list1);for(let n=0;n<r.length;++n){const i=[];for(let e=0;e<r[n].length;++e)i.push(new vd(r[n][e].scid,r[n][e].paused));e.addSimulcastAlternativeStreams(t,i)}}if(n.simulcast.dir2){const t=md.byValue(n.simulcast.dir2),r=Ol.parseSimulcastStreamList(n.simulcast.list2);for(let n=0;n<r.length;++n){const i=[];for(let e=0;e<r[n].length;++e)i.push(new vd(r[n][e].scid,r[n][e].paused));e.addSimulcastAlternativeStreams(t,i)}}for(let t of e.getSimulcastStreams(md.SEND)){const e=[];for(let r=0;r<t.length;r++){const n=new Id(t[r].getId(),t[r].isPaused()),i=s.getRID(n.getId());if(i){const t=i.getFormats();for(let e=0;t&&e<t.length;++e){const r=s.getCodecForType(t[e]);r&&n.addCodec(r)}n.setParams(i.getParams()),e.push(n)}}e.length&&f.push(e)}s.setSimulcast(e)}const p=new Map;if(n.ssrcs)for(let e in n.ssrcs){let t=n.ssrcs[e],s=t.id,a=t.attribute,c=t.value,u=p.get(s);if(u||(u=new Td(s),p.set(u.getSSRC(),u)),"cname"===a.toLowerCase())u.setCName(c);else if("msid"===a.toLowerCase()){let e=c.split(" "),t=e[0],n=e[1];u.setStreamId(t),u.setTrackId(n);let a=r.getStream(t);a||(a=new kd(t),r.addStream(a));let l=a.getTrack(n);l||(l=new Pd(i,n),l.setMediaId(o),l.setEncodings(f),a.addTrack(l)),l.addSSRC(s)}}if(n.msid){let e=n.msid.split(" "),t=e[0],s=e[1],a=r.getStream(t);a||(a=new kd(t),r.addStream(a));let c=a.getTrack(s);c||(c=new Pd(i,s),c.setMediaId(o),c.setEncodings(f),a.addTrack(c));for(let[e,r]of p.entries())r.getStreamId()||(r.setStreamId(t),r.setTrackId(s),c.addSSRC(e))}for(let[e,t]of p.entries())if(!t.getStreamId()){let n=t.getCName(),s=o;t.setStreamId(n),t.setTrackId(s);let a=r.getStream(n);a||(a=new kd(n),r.addStream(a));let c=a.getTrack(s);c||(c=new Pd(i,s),c.setMediaId(o),c.setEncodings(f),a.addTrack(c)),c.addSSRC(e)}if(n.ssrcGroups)for(let e in n.ssrcGroups){let t=n.ssrcGroups[e],i=t.ssrcs.split(" "),o=new Ed(t.semantics,i),s=p.get(parseInt(i[0]));s&&r.getStream(s.getStreamId()).getTrack(s.getTrackId()).addSourceGroup(o)}if("application"==n.type&&"webrtc-datachannel"==n.payloads){const e=new Cd(n.sctpPort,n.maxMessageSize);s.setDataChannel(e)}r.addMedia(s)}return r};var Ad,Od,Ld={SDPInfo:pd,CandidateInfo:Ll,CodecInfo:Ml,DTLSInfo:_l,CryptoInfo:Ul,ICEInfo:fd,MediaInfo:xd,Setup:Bl,SourceGroupInfo:Ed,SourceInfo:Td,StreamInfo:kd,TrackInfo:Pd,RTCPFeedbackInfo:Dl,TrackEncodingInfo:Id,Direction:bd},Md=(Ad=!1,(Od=/[ac]/).exec=function(){return Ad=!0,/./.exec.apply(this,arguments)},!0===Od.test("abc")&&Ad),Nd=/./.test;xr({target:"RegExp",proto:!0,forced:!Md},{test:function(e){var t=gt(this),r=is(e),n=t.exec;if(!ye(n))return J(Nd,t,r);var i=J(n,t,r);return null!==i&&(gt(i),!0)}});var jd=V((function(e,t){!function(r,n){var i="function",o="undefined",s="object",a="string",c="model",u="name",l="type",d="vendor",f="version",p="architecture",h="console",m="mobile",g="tablet",v="smarttv",y="wearable",w="embedded",E="Amazon",T="Apple",I="ASUS",R="BlackBerry",P="Browser",k="Chrome",A="Firefox",O="Google",L="Huawei",D="LG",M="Microsoft",N="Motorola",j="Opera",B="Samsung",_="Sharp",U="Sony",V="Xiaomi",F="Zebra",z="Facebook",$=function(e){for(var t={},r=0;r<e.length;r++)t[e[r].toUpperCase()]=e[r];return t},G=function(e,t){return typeof e===a&&-1!==W(t).indexOf(W(e))},W=function(e){return e.toLowerCase()},q=function(e,t){if(typeof e===a)return e=e.replace(/^\s\s*/,"").replace(/\s\s*$/,""),typeof t===o?e:e.substring(0,350)},H=function(e,t){for(var r,o,a,c,u,l,d=0;d<t.length&&!u;){var f=t[d],p=t[d+1];for(r=o=0;r<f.length&&!u;)if(u=f[r++].exec(e))for(a=0;a<p.length;a++)l=u[++o],typeof(c=p[a])===s&&c.length>0?2===c.length?typeof c[1]==i?this[c[0]]=c[1].call(this,l):this[c[0]]=c[1]:3===c.length?typeof c[1]!==i||c[1].exec&&c[1].test?this[c[0]]=l?l.replace(c[1],c[2]):n:this[c[0]]=l?c[1].call(this,l,c[2]):n:4===c.length&&(this[c[0]]=l?c[3].call(this,l.replace(c[1],c[2])):n):this[c]=l||n;d+=2}},X=function(e,t){for(var r in t)if(typeof t[r]===s&&t[r].length>0){for(var i=0;i<t[r].length;i++)if(G(t[r][i],e))return"?"===r?n:r}else if(G(t[r],e))return"?"===r?n:r;return e},Y={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},J={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[f,[u,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[f,[u,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[u,f],[/opios[\/ ]+([\w\.]+)/i],[f,[u,j+" Mini"]],[/\bopr\/([\w\.]+)/i],[f,[u,j]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(weibo)__([\d\.]+)/i],[u,f],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[f,[u,"UC"+P]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[f,[u,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[f,[u,"WeChat"]],[/konqueror\/([\w\.]+)/i],[f,[u,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[f,[u,"IE"]],[/yabrowser\/([\w\.]+)/i],[f,[u,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[u,/(.+)/,"$1 Secure "+P],f],[/\bfocus\/([\w\.]+)/i],[f,[u,A+" Focus"]],[/\bopt\/([\w\.]+)/i],[f,[u,j+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[f,[u,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[f,[u,"Dolphin"]],[/coast\/([\w\.]+)/i],[f,[u,j+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[f,[u,"MIUI "+P]],[/fxios\/([-\w\.]+)/i],[f,[u,A]],[/\bqihu|(qi?ho?o?|360)browser/i],[[u,"360 "+P]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[u,/(.+)/,"$1 "+P],f],[/(comodo_dragon)\/([\w\.]+)/i],[[u,/_/g," "],f],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[u,f],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[u],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[u,z],f],[/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[u,f],[/\bgsa\/([\w\.]+) .*safari\//i],[f,[u,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[f,[u,k+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[u,k+" WebView"],f],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[f,[u,"Android "+P]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[u,f],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[f,[u,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[f,u],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[u,[f,X,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[u,f],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[u,"Netscape"],f],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[f,[u,A+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[u,f]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[p,"amd64"]],[/(ia32(?=;))/i],[[p,W]],[/((?:i[346]|x)86)[;\)]/i],[[p,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[p,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[p,"armhf"]],[/windows (ce|mobile); ppc;/i],[[p,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[p,/ower/,"",W]],[/(sun4\w)[;\)]/i],[[p,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[p,W]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[c,[d,B],[l,g]],[/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[c,[d,B],[l,m]],[/\((ip(?:hone|od)[\w ]*);/i],[c,[d,T],[l,m]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[c,[d,T],[l,g]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[c,[d,L],[l,g]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[c,[d,L],[l,m]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[c,/_/g," "],[d,V],[l,m]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[c,/_/g," "],[d,V],[l,g]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[c,[d,"OPPO"],[l,m]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[c,[d,"Vivo"],[l,m]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[c,[d,"Realme"],[l,m]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[c,[d,N],[l,m]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[c,[d,N],[l,g]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[c,[d,D],[l,g]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[c,[d,D],[l,m]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[c,[d,"Lenovo"],[l,g]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[c,/_/g," "],[d,"Nokia"],[l,m]],[/(pixel c)\b/i],[c,[d,O],[l,g]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[c,[d,O],[l,m]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[c,[d,U],[l,m]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[c,"Xperia Tablet"],[d,U],[l,g]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[c,[d,"OnePlus"],[l,m]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[c,[d,E],[l,g]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[c,/(.+)/g,"Fire Phone $1"],[d,E],[l,m]],[/(playbook);[-\w\),; ]+(rim)/i],[c,d,[l,g]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[c,[d,R],[l,m]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[c,[d,I],[l,g]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[c,[d,I],[l,m]],[/(nexus 9)/i],[c,[d,"HTC"],[l,g]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic|sony(?!-bra))[-_ ]?([-\w]*)/i],[d,[c,/_/g," "],[l,m]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[c,[d,"Acer"],[l,g]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[c,[d,"Meizu"],[l,m]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[c,[d,_],[l,m]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[d,c,[l,m]],[/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[d,c,[l,g]],[/(surface duo)/i],[c,[d,M],[l,g]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[c,[d,"Fairphone"],[l,m]],[/(u304aa)/i],[c,[d,"AT&T"],[l,m]],[/\bsie-(\w*)/i],[c,[d,"Siemens"],[l,m]],[/\b(rct\w+) b/i],[c,[d,"RCA"],[l,g]],[/\b(venue[\d ]{2,7}) b/i],[c,[d,"Dell"],[l,g]],[/\b(q(?:mv|ta)\w+) b/i],[c,[d,"Verizon"],[l,g]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[c,[d,"Barnes & Noble"],[l,g]],[/\b(tm\d{3}\w+) b/i],[c,[d,"NuVision"],[l,g]],[/\b(k88) b/i],[c,[d,"ZTE"],[l,g]],[/\b(nx\d{3}j) b/i],[c,[d,"ZTE"],[l,m]],[/\b(gen\d{3}) b.+49h/i],[c,[d,"Swiss"],[l,m]],[/\b(zur\d{3}) b/i],[c,[d,"Swiss"],[l,g]],[/\b((zeki)?tb.*\b) b/i],[c,[d,"Zeki"],[l,g]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[d,"Dragon Touch"],c,[l,g]],[/\b(ns-?\w{0,9}) b/i],[c,[d,"Insignia"],[l,g]],[/\b((nxa|next)-?\w{0,9}) b/i],[c,[d,"NextBook"],[l,g]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[d,"Voice"],c,[l,m]],[/\b(lvtel\-)?(v1[12]) b/i],[[d,"LvTel"],c,[l,m]],[/\b(ph-1) /i],[c,[d,"Essential"],[l,m]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[c,[d,"Envizen"],[l,g]],[/\b(trio[-\w\. ]+) b/i],[c,[d,"MachSpeed"],[l,g]],[/\btu_(1491) b/i],[c,[d,"Rotor"],[l,g]],[/(shield[\w ]+) b/i],[c,[d,"Nvidia"],[l,g]],[/(sprint) (\w+)/i],[d,c,[l,m]],[/(kin\.[onetw]{3})/i],[[c,/\./g," "],[d,M],[l,m]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[c,[d,F],[l,g]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[c,[d,F],[l,m]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[d,c,[l,h]],[/droid.+; (shield) bui/i],[c,[d,"Nvidia"],[l,h]],[/(playstation [345portablevi]+)/i],[c,[d,U],[l,h]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[c,[d,M],[l,h]],[/smart-tv.+(samsung)/i],[d,[l,v]],[/hbbtv.+maple;(\d+)/i],[[c,/^/,"SmartTV"],[d,B],[l,v]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[d,D],[l,v]],[/(apple) ?tv/i],[d,[c,T+" TV"],[l,v]],[/crkey/i],[[c,k+"cast"],[d,O],[l,v]],[/droid.+aft(\w)( bui|\))/i],[c,[d,E],[l,v]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[c,[d,_],[l,v]],[/(bravia[\w ]+)( bui|\))/i],[c,[d,U],[l,v]],[/(mitv-\w{5}) bui/i],[c,[d,V],[l,v]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i],[[d,q],[c,q],[l,v]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[l,v]],[/((pebble))app/i],[d,c,[l,y]],[/droid.+; (glass) \d/i],[c,[d,O],[l,y]],[/droid.+; (wt63?0{2,3})\)/i],[c,[d,F],[l,y]],[/(quest( 2)?)/i],[c,[d,z],[l,y]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[d,[l,w]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[c,[l,m]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[c,[l,g]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[l,g]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[l,m]],[/(android[-\w\. ]{0,9});.+buil/i],[c,[d,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[f,[u,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[f,[u,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i],[u,f],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[f,u]],os:[[/microsoft (windows) (vista|xp)/i],[u,f],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[u,[f,X,Y]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[u,"Windows"],[f,X,Y]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[f,/_/g,"."],[u,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[u,"Mac OS"],[f,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[f,u],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[u,f],[/\(bb(10);/i],[f,[u,R]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[f,[u,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[f,[u,A+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[f,[u,"webOS"]],[/crkey\/([\d\.]+)/i],[f,[u,k+"cast"]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[u,"Chromium OS"],f],[/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[u,f],[/(sunos) ?([\w\.\d]*)/i],[[u,"Solaris"],f],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[u,f]]},K=function(e,t){if(typeof e===s&&(t=e,e=n),!(this instanceof K))return new K(e,t).getResult();var i=e||(typeof r!==o&&r.navigator&&r.navigator.userAgent?r.navigator.userAgent:""),h=t?function(e,t){var r={};for(var n in e)t[n]&&t[n].length%2==0?r[n]=t[n].concat(e[n]):r[n]=e[n];return r}(J,t):J;return this.getBrowser=function(){var e={};return e[u]=n,e[f]=n,H.call(e,i,h.browser),e.major=function(e){return typeof e===a?e.replace(/[^\d\.]/g,"").split(".")[0]:n}(e.version),e},this.getCPU=function(){var e={};return e[p]=n,H.call(e,i,h.cpu),e},this.getDevice=function(){var e={};return e[d]=n,e[c]=n,e[l]=n,H.call(e,i,h.device),e},this.getEngine=function(){var e={};return e[u]=n,e[f]=n,H.call(e,i,h.engine),e},this.getOS=function(){var e={};return e[u]=n,e[f]=n,H.call(e,i,h.os),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return i},this.setUA=function(e){return i=typeof e===a&&e.length>350?q(e,350):e,this},this.setUA(i),this};K.VERSION="0.7.32",K.BROWSER=$([u,f,"major"]),K.CPU=$([p]),K.DEVICE=$([c,d,l,h,m,v,g,y,w]),K.ENGINE=K.OS=$([u,f]),e.exports&&(t=e.exports=K),t.UAParser=K;var Z=typeof r!==o&&(r.jQuery||r.Zepto);if(Z&&!Z.ua){var Q=new K;Z.ua=Q.getResult(),Z.ua.get=function(){return Q.getUA()},Z.ua.set=function(e){Q.setUA(e);var t=Q.getResult();for(var r in t)Z.ua[r]=t[r]}}}("object"==typeof window?window:U)}));const Bd=["iOS"];class Sd extends jd{constructor(){super(window.navigator.userAgent)}isChrome(){const e=this.getBrowser();if(!e.name)return!1;const t=this.getOS();let r=!0;return r=!new RegExp(Bd.join("|"),"i").test(t.name),e.name.match(/Chrome/i)&&r}isFirefox(){const e=this.getBrowser();return!!e.name&&e.name.match(/Firefox/i)}isOpera(){const e=this.getBrowser();return!!e.name&&e.name.match(/Opera/i)}isSafari(){const e=this.getBrowser();return!!e.name&&e.name.match(/Safari/i)}}const _d=_n.get("SdpParser"),Ud=Array.from({length:31},(e,t)=>t+35),Vd=Array.from({length:32},(e,t)=>t+96),Fd=Array.from({length:14},(e,t)=>t+1),$d=Array.from({length:240},(e,t)=>t+16);class Rd{static setSimulcast(e,t){if(_d.info("Setting simulcast. Codec: ",t),!(new Sd).isChrome())return _d.warn("Simulcast is only available in Google Chrome browser"),e;if("h264"!==t&&"vp8"!==t)return _d.warn("Simulcast is only available in h264 and vp8 codecs"),e;try{const t=/m=video[\s\S]*?a=ssrc:(\d*) msid:([\s\S]+?)\r\n/,r=/m=video[\s\S]*?a=ssrc:(\d*) cname:([\s\S]+?)\r\n/.exec(e),n=r[1],i=r[2],o=t.exec(e)[2],s=2,a=[n];for(let t=0;t<s;++t){const r=100+2*t,n=r+1;a.push(r),e+="a=ssrc-group:FID "+r+" "+n+"\r\na=ssrc:"+r+" cname:"+i+"\r\na=ssrc:"+r+" msid:"+o+"\r\na=ssrc:"+n+" cname:"+i+"\r\na=ssrc:"+n+" msid:"+o+"\r\n"}return e+="a=ssrc-group:SIM "+a.join(" ")+"\r\n",_d.info("Simulcast setted"),_d.debug("Simulcast SDP: ",e),e}catch(e){throw _d.error("Error setting SDP for simulcast: ",e),e}}static setStereo(e){return _d.info("Replacing SDP response for support stereo"),e=e.replace(/useinbandfec=1/g,"useinbandfec=1; stereo=1"),_d.info("Replaced SDP response for support stereo"),_d.debug("New SDP value: ",e),e}static setDTX(e){return _d.info("Replacing SDP response for support dtx"),e=e.replace("useinbandfec=1","useinbandfec=1; usedtx=1"),_d.info("Replaced SDP response for support dtx"),_d.debug("New SDP value: ",e),e}static setAbsoluteCaptureTime(e){const t="a=extmap:"+Rd.getAvailableHeaderExtensionIdRange(e)[0]+" http://www.webrtc.org/experiments/rtp-hdrext/abs-capture-time\r\n";return e=e.replace(/(m=.*\r\n(?:.*\r\n)*?)(a=extmap.*\r\n)/gm,(e,r,n)=>r+t+n),_d.info("Replaced SDP response for setting absolute capture time"),_d.debug("New SDP value: ",e),e}static setDependencyDescriptor(e){const t="a=extmap:"+Rd.getAvailableHeaderExtensionIdRange(e)[0]+" https://aomediacodec.github.io/av1-rtp-spec/#dependency-descriptor-rtp-header-extension\r\n";return e=e.replace(/(m=.*\r\n(?:.*\r\n)*?)(a=extmap.*\r\n)/gm,(e,r,n)=>r+t+n),_d.info("Replaced SDP response for setting depency descriptor"),_d.debug("New SDP value: ",e),e}static setVideoBitrate(e,t){if(t<1)_d.info("Remove bitrate restrictions"),e=e.replace(/b=AS:.*\r\n/,"").replace(/b=TIAS:.*\r\n/,"");else{const r=Ld.SDPInfo.parse(e),n=r.getMedia("video");_d.info("Setting video bitrate"),n.setBitrate(t),e=r.toString()}return e}static removeSdpLine(e,t){return _d.debug("SDP before trimming: ",e),e=e.split("\n").filter(e=>e.trim()!==t).join("\n"),_d.debug("SDP trimmed result: ",e),e}static adaptCodecName(e,t,r){if(!e)return e;const n=new RegExp("".concat(t),"i");return e.replace(n,r)}static setMultiopus(e,t){if(!(new Sd).isFirefox()&&(!t||Gd(t)))if(e.includes("multiopus/48000/6"))_d.info("Multiopus already setted");else{_d.info("Setting multiopus");const t=/m=audio 9 UDP\/TLS\/RTP\/SAVPF (.*)\r\n/.exec(e)[0],r=Rd.getAvailablePayloadTypeRange(e)[0],n=t.replace("\r\n"," ")+r+"\r\na=rtpmap:"+r+" multiopus/48000/6\r\na=fmtp:"+r+" channel_mapping=0,4,1,2,3,5;coupled_streams=2;minptime=10;num_streams=4;useinbandfec=1\r\n";e=e.replace(t,n),_d.info("Multiopus offer created"),_d.debug("SDP parsed for multioups: ",e)}return e}static getAvailablePayloadTypeRange(e){const t=e.matchAll(/m=(?:.*) (?:.*) UDP\/TLS\/RTP\/SAVPF (.*)\r\n/gm);let r=Vd.concat(Ud);var n,i=_(t);try{for(i.s();!(n=i.n()).done;){const e=n.value[1].split(" ").map(e=>parseInt(e));r=r.filter(t=>!e.includes(t))}}catch(e){i.e(e)}finally{i.f()}return r}static getAvailableHeaderExtensionIdRange(e){const t=e.matchAll(/a=extmap:(\d+)(?:.*)\r\n/gm);let r=Fd.concat($d);var n,i=_(t);try{for(i.s();!(n=i.n()).done;){const e=n.value[1].split(" ").map(e=>parseInt(e));r=r.filter(t=>!e.includes(t))}}catch(e){i.e(e)}finally{i.f()}return r}static renegotiate(e,t){const r=Ld.SDPInfo.parse(e),n=Ld.SDPInfo.parse(t);var i,o=_(r.getMedias());try{for(o.s();!(i=o.n()).done;){const t=i.value;let r=n.getMediaById(t.getId());if(!r){r=new Ld.MediaInfo(t.getId(),t.getType()),r.setDirection(Ld.Direction.reverse(t.getDirection()));const i=n.getMedia(t.getType());if(i){r.setCodecs(i.getCodecs());var s,a=_(i.getExtensions());try{for(a.s();!(s=a.n()).done;){const e=N(s.value,2),t=e[0],n=e[1];r.addExtension(t,n)}}catch(e){a.e(e)}finally{a.f()}}n.addMedia(r)}}}catch(e){o.e(e)}finally{o.f()}return n.toString()}static updateMissingVideoExtensions(e,t){var r;const n=Ld.SDPInfo.parse(e),i=null===(r=Ld.SDPInfo.parse(t).getMediasByType("video")[0])||void 0===r?void 0:r.getExtensions();if(i||i.length){var o,s=_(n.getMediasByType("video"));try{for(s.s();!(o=s.n()).done;){const t=o.value,r=t.getExtensions();i.forEach((n,i)=>{if(!r.get(i)){const r=t.getId(),o="a=extmap:"+i+" "+n+"\r\n",s=new RegExp("(a=mid:"+r+"\r\n(?:.*\r\n)*?)","g");e=e.replace(s,(e,t,r)=>t+o)}})}}catch(e){s.e(e)}finally{s.f()}return e}}}const Gd=e=>e.getAudioTracks().some(e=>e.getSettings().channelCount>2);var Wd=ir.indexOf,qd=nn([].indexOf),Xd=!!qd&&1/qd([1],1,-0)<0,Yd=function(e,t){var r=[].indexOf;return!!r&&q((function(){r.call(null,(function(){return 1}),1)}))}();xr({target:"Array",proto:!0,forced:Xd||!Yd},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return Xd?qd(this,e,t)||0:Wd(this,e,t)}});class Dd extends cu{constructor(e,t){super(),this.namespace=e,this.tm=t}cmd(e,t){return this.tm.cmd(e,t,this.namespace)}event(e,t){return this.tm.event(e,t,this.namespace)}close(){return this.tm.namespaces.delete(this.namespace)}}var Jd=class extends cu{constructor(e){super(),this.maxId=0,this.namespaces=new Map,this.transactions=new Map,this.transport=e,this.listener=t=>{let r;try{r=JSON.parse(t.utf8Data||t.data||t)}catch(e){return}switch(r.type){case"cmd":const t={name:r.name,data:r.data,namespace:r.namespace,accept:t=>{e.send(JSON.stringify({type:"response",transId:r.transId,data:t}))},reject:t=>{e.send(JSON.stringify({type:"error",transId:r.transId,data:t}))}};if(t.namespace){const e=this.namespaces.get(t.namespace);e?e.emit("cmd",t):this.emit("cmd",t)}else this.emit("cmd",t);break;case"response":{const e=this.transactions.get(r.transId);if(!e)return;this.transactions.delete(r.transId),e.resolve(r.data);break}case"error":{const e=this.transactions.get(r.transId);if(!e)return;this.transactions.delete(r.transId),e.reject(r.data);break}case"event":const i={name:r.name,data:r.data,namespace:r.namespace};if(i.namespace){var n=this.namespaces.get(i.namespace);n?n.emit("event",i):this.emit("event",i)}else this.emit("event",i)}},this.transport.addListener?this.transport.addListener("message",this.listener):this.transport.addEventListener("message",this.listener)}cmd(e,t,r){return new Promise((n,i)=>{if(!e||0===e.length)throw new Error("Bad command name");const o={type:"cmd",transId:this.maxId++,name:e,data:t};r&&(o.namespace=r);const s=JSON.stringify(o);o.resolve=n,o.reject=i,this.transactions.set(o.transId,o);try{this.transport.send(s)}catch(e){throw this.transactions.delete(o.transId),e}})}event(e,t,r){if(!e||0===e.length)throw new Error("Bad event name");const n={type:"event",name:e,data:t};r&&(n.namespace=r);const i=JSON.stringify(n);this.transport.send(i)}namespace(e){let t=this.namespaces.get(e);return t||(t=new Dd(e,this),this.namespaces.set(e,t),t)}close(){for(const e of this.namespaces.values())e.close();this.transport.removeListener?this.transport.removeListener("message",this.listener):this.transport.removeEventListener("message",this.listener)}};const Kd=_n.get("Signaling"),Zd="wsConnectionSuccess",Qd="wsConnectionError",ef="broadcastEvent",tf={VP8:"vp8",VP9:"vp9",H264:"h264",AV1:"av1"},rf={OPUS:"opus",MULTIOPUS:"multiopus"};class zd extends cu{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{streamName:null,url:"ws://localhost:8080/"};super(),this.streamName=e.streamName,this.wsUrl=e.url,this.webSocket=null,this.transactionManager=null,this.serverId=null,this.clusterId=null,(new Sd).isSafari()&&(tf.H265="h265")}connect(){var e=this;return D((function*(){var t;return Kd.info("Connecting to Signaling Server"),e.transactionManager&&(null===(t=e.webSocket)||void 0===t?void 0:t.readyState)===WebSocket.OPEN?(Kd.info("Connected to server: ",e.webSocket.url),Kd.debug("WebSocket value: ",{url:e.webSocket.url,protocol:e.webSocket.protocol,readyState:e.webSocket.readyState,binaryType:e.webSocket.binaryType,extensions:e.webSocket.extensions}),e.emit(Zd,{ws:e.webSocket,tm:e.transactionManager}),e.webSocket):new Promise((t,r)=>{e.webSocket=new WebSocket(e.wsUrl),e.transactionManager=new Jd(e.webSocket),e.webSocket.onopen=()=>{Kd.info("WebSocket opened"),e.transactionManager.on("event",t=>{e.emit(ef,t)}),Kd.info("Connected to server: ",e.webSocket.url),Kd.debug("WebSocket value: ",{url:e.webSocket.url,protocol:e.webSocket.protocol,readyState:e.webSocket.readyState,binaryType:e.webSocket.binaryType,extensions:e.webSocket.extensions}),e.emit(Zd,{ws:e.webSocket,tm:e.transactionManager}),t(e.webSocket)},e.webSocket.onerror=()=>{Kd.error("WebSocket not connected: ",e.webSocket.url),e.emit(Qd,e.webSocket.url),r(e.webSocket.url)},e.webSocket.onclose=()=>{e.webSocket=null,e.transactionManager=null,Kd.info("Connection closed with Signaling Server."),e.emit("wsConnectionClose")}})}))()}close(){var e;Kd.info("Closing connection with Signaling Server."),null===(e=this.webSocket)||void 0===e||e.close()}subscribe(e,t){var r=arguments,n=this;return D((function*(){let i=r.length>2&&void 0!==r[2]?r[2]:null,o=r.length>3&&void 0!==r[3]?r[3]:null;Kd.info("Starting subscription to streamName: ",n.streamName),Kd.debug("Subcription local description: ",e);const s=nf(t,i,o),a={sdp:e=Rd.adaptCodecName(e,"AV1X",tf.AV1),streamId:n.streamName,pinnedSourceId:s.pinnedSourceId,excludedSourceIds:s.excludedSourceIds};s.vad&&(a.vad=!0),Array.isArray(s.events)&&(a.events=s.events),s.forcePlayoutDelay&&(a.forcePlayoutDelay=s.forcePlayoutDelay);try{var c,u,l,d,f;yield n.connect(),Kd.info("Sending view command");const e=yield n.transactionManager.cmd("view",a),t=null===(c=(u=RTCRtpReceiver).getCapabilities)||void 0===c||null===(l=c.call(u,"video"))||void 0===l||null===(d=l.codecs)||void 0===d||null===(f=d.find)||void 0===f?void 0:f.call(d,e=>"video/AV1X"===e.mimeType);return e.sdp=t?Rd.adaptCodecName(e.sdp,tf.AV1,"AV1X"):e.sdp,Kd.info("Command sent, subscriberId: ",e.subscriberId),Kd.debug("Command result: ",e),n.serverId=e.subscriberId,n.clusterId=e.clusterId,e.sdp}catch(e){throw Kd.error("Error sending view command, error: ",e),e}}))()}publish(e,t){var r=arguments,n=this;return D((function*(){const i=of(t,r.length>2&&void 0!==r[2]?r[2]:null,r.length>3&&void 0!==r[3]?r[3]:null);Kd.info("Starting publishing to streamName: ".concat(n.streamName,", codec: ").concat(i.codec)),Kd.debug("Publishing local description: ",e);const o=Object.values(tf);if(-1===o.indexOf(i.codec))throw Kd.error("Invalid codec. Possible values are: ",o),new Error("Invalid codec. Possible values are: ".concat(o));i.codec===tf.AV1&&(e=Rd.adaptCodecName(e,"AV1X",tf.AV1));const s={name:n.streamName,sdp:e,codec:i.codec,sourceId:i.sourceId};null!==i.record&&(s.record=i.record),Array.isArray(i.events)&&(s.events=i.events);try{yield n.connect(),Kd.info("Sending publish command");const e=yield n.transactionManager.cmd("publish",s);if(i.codec===tf.AV1){var a,c,u,l,d;const t=null===(a=(c=RTCRtpSender).getCapabilities)||void 0===a||null===(u=a.call(c,"video"))||void 0===u||null===(l=u.codecs)||void 0===l||null===(d=l.find)||void 0===d?void 0:d.call(l,e=>"video/AV1X"===e.mimeType);e.sdp=t?Rd.adaptCodecName(e.sdp,tf.AV1,"AV1X"):e.sdp}return Kd.info("Command sent, publisherId: ",e.publisherId),Kd.debug("Command result: ",e),n.serverId=e.publisherId,n.clusterId=e.clusterId,e.sdp}catch(e){throw Kd.error("Error sending publish command, error: ",e),e}}))()}cmd(e,t){var r=this;return D((function*(){return Kd.info("Sending cmd: ".concat(e)),r.transactionManager.cmd(e,t)}))()}}const nf=(e,t,r)=>{let n="object"==typeof e?e:{};return 0===Object.keys(n).length&&(n={vad:e,pinnedSourceId:t,excludedSourceIds:r}),n},of=(e,t,r)=>{let n="object"==typeof e?e:{};if(0===Object.keys(n).length){const i=tf.H264;n={codec:null!=e?e:i,record:t,sourceId:r}}return n},sf=_n.get("PeerConnection"),af={track:"track",connectionStateChange:"connectionStateChange"},cf={stereo:!1,mediaStream:null,codec:"h264",simulcast:!1,scalabilityMode:null,disableAudio:!1,disableVideo:!1,setSDPToPeer:!0};class Hd extends cu{constructor(){super(),this.sessionDescription=null,this.peer=null,this.peerConnectionStats=null}createRTCPeer(){var e=arguments,t=this;return D((function*(){let r=e.length>0&&void 0!==e[0]?e[0]:null;sf.info("Creating new RTCPeerConnection"),sf.debug("RTC configuration provided by user: ",r),t.peer=ff(t,r)}))()}getRTCPeer(){return sf.info("Getting RTC Peer"),this.peer}closeRTCPeer(){var e=this;return D((function*(){var t;sf.info("Closing RTCPeerConnection"),null===(t=e.peer)||void 0===t||t.close(),e.peer=null,e.stopStats(),e.emit(af.connectionStateChange,"closed")}))()}setRTCRemoteSDP(e){var t=this;return D((function*(){sf.info("Setting RTC Remote SDP");const r={type:"answer",sdp:e};try{yield t.peer.setRemoteDescription(r),sf.info("RTC Remote SDP was set successfully."),sf.debug("RTC Remote SDP new value: ",e)}catch(e){throw sf.error("Error while setting RTC Remote SDP: ",e),e}}))()}getRTCLocalSDP(){var e=arguments,t=this;return D((function*(){let r=e.length>0&&void 0!==e[0]?e[0]:cf;sf.info("Getting RTC Local SDP"),r=O(O({},cf),r),sf.debug("Options: ",r);const n=df(r.mediaStream);n?hf(t.peer,n,r):mf(t.peer,r),sf.info("Creating peer offer");const i=yield t.peer.createOffer();return sf.info("Peer offer created"),sf.debug("Peer offer response: ",i.sdp),t.sessionDescription=i,r.disableAudio||(r.stereo&&(t.sessionDescription.sdp=Rd.setStereo(t.sessionDescription.sdp)),r.dtx&&(t.sessionDescription.sdp=Rd.setDTX(t.sessionDescription.sdp)),t.sessionDescription.sdp=Rd.setMultiopus(t.sessionDescription.sdp,n)),!r.disableVideo&&r.simulcast&&(t.sessionDescription.sdp=Rd.setSimulcast(t.sessionDescription.sdp,r.codec)),r.absCaptureTime&&(t.sessionDescription.sdp=Rd.setAbsoluteCaptureTime(t.sessionDescription.sdp)),r.dependencyDescriptor&&(t.sessionDescription.sdp=Rd.setDependencyDescriptor(t.sessionDescription.sdp)),r.setSDPToPeer&&(yield t.peer.setLocalDescription(t.sessionDescription),sf.info("Peer local description set")),t.sessionDescription.sdp}))()}addRemoteTrack(e,t){var r=this;return D((function*(){const n=yield new Promise((n,i)=>{try{const i=r.peer.addTransceiver(e,{direction:"recvonly"});i.resolve=n,i.streams=t}catch(e){i(e)}});var i,o=_(t);try{for(o.s();!(i=o.n()).done;)i.value.addTrack(n.receiver.track)}catch(e){o.e(e)}finally{o.f()}return n}))()}updateBandwidthRestriction(e,t){return sf.info("Updating bandwidth restriction, bitrate value: ",t),sf.debug("SDP value: ",e),Rd.setVideoBitrate(e,t)}updateBitrate(){var e=arguments,t=this;return D((function*(){let r=e.length>0&&void 0!==e[0]?e[0]:0;if(!t.peer)throw sf.error("Cannot update bitrate. No peer found."),new Error("Cannot update bitrate. No peer found.");sf.info("Updating bitrate to value: ",r),t.sessionDescription=yield t.peer.createOffer(),yield t.peer.setLocalDescription(t.sessionDescription);const n=t.updateBandwidthRestriction(t.peer.remoteDescription.sdp,r);yield t.setRTCRemoteSDP(n),sf.info("Bitrate restirctions updated: ","".concat(r>0?r:"unlimited"," kbps"))}))()}getRTCPeerStatus(){if(sf.info("Getting RTC peer status"),!this.peer)return null;const e=gf(this.peer);return sf.info("RTC peer status getted, value: ",e),e}replaceTrack(e){if(!this.peer)return void sf.error("Could not change track if there is not an active connection.");const t=this.peer.getSenders().find(t=>t.track.kind===e.kind);t?t.replaceTrack(e):sf.error("There is no ".concat(e.kind," track in active broadcast."))}static getCapabilities(e){const t=new Sd;if(t.isFirefox())return(e=>"video"===e?{codecs:[{codec:"vp8",mimeType:"video/VP8"},{codec:"vp9",mimeType:"video/VP9"},{codec:"h264",mimeType:"video/H264"}],headerExtensions:[]}:"audio"===e?{codecs:[{codec:"opus",mimeType:"audio/opus",channels:2}],headerExtensions:[]}:null)(e);const r=RTCRtpSender.getCapabilities(e);if(r){const o={};let s=new RegExp("^video/(".concat(Object.values(tf).join("|"),")x?$"),"i");"audio"===e&&(s=new RegExp("^audio/(".concat(Object.values(rf).join("|"),")$"),"i"),t.isChrome()&&(o.multiopus={mimeType:"audio/multiopus",channels:6}));var n,i=_(r.codecs);try{for(i.s();!(n=i.n()).done;){const e=n.value,t=e.mimeType.match(s);if(t){const r=t[1].toLowerCase();if(o[r]=O(O({},o[r]),{},{mimeType:e.mimeType}),e.scalabilityModes){let t=o[r].scalabilityModes||[];t=[...t,...e.scalabilityModes],o[r].scalabilityModes=[...new Set(t)]}e.channels&&(o[r].channels=e.channels)}}}catch(e){i.e(e)}finally{i.f()}r.codecs=Object.keys(o).map(e=>O({codec:e},o[e]))}return r}getTracks(){var e,t;return null===(e=this.peer)||void 0===e||null===(t=e.getSenders())||void 0===t?void 0:t.map(e=>e.track)}initStats(){this.peerConnectionStats?sf.warn("Cannot init peer stats: Already initialized"):this.peer?(this.peerConnectionStats=new iu(this.peer),this.peerConnectionStats.init(),wu(this.peerConnectionStats,this,["stats"])):sf.warn("Cannot init peer stats: RTCPeerConnection not initialized")}stopStats(){var e;null===(e=this.peerConnectionStats)||void 0===e||e.stop(),this.peerConnectionStats=null}}const lf=e=>(null==e?void 0:e.getAudioTracks().length)<=1&&(null==e?void 0:e.getVideoTracks().length)<=1,df=e=>{if(!e)return null;if(e instanceof MediaStream&&lf(e))return e;if(!(e instanceof MediaStream)){sf.info("Creating MediaStream to add received tracks.");const n=new MediaStream;var t,r=_(e);try{for(r.s();!(t=r.n()).done;){const e=t.value;n.addTrack(e)}}catch(e){r.e(e)}finally{r.f()}if(lf(n))return n}throw sf.error("MediaStream must have 1 audio track and 1 video track, or at least one of them."),new Error("MediaStream must have 1 audio track and 1 video track, or at least one of them.")},ff=(e,t)=>{const r=new RTCPeerConnection(t);return pf(e,r),r},pf=(e,t)=>{var r;t.ontrack=t=>{var r;if(sf.info("New track from peer."),sf.debug("Track event value: ",t),null!=t&&null!==(r=t.transceiver)&&void 0!==r&&r.resolve){const e=t.transceiver.resolve;delete t.transceiver.resolve,e(t.transceiver)}e.emit(af.track,t)},t.connectionState?t.onconnectionstatechange=r=>{sf.info("Peer connection state change: ",t.connectionState),e.emit(af.connectionStateChange,t.connectionState)}:t.oniceconnectionstatechange=r=>{sf.info("Peer ICE connection state change: ",t.iceConnectionState),e.emit(af.connectionStateChange,t.iceConnectionState)},t.onnegotiationneeded=(r=D((function*(e){if(!t.remoteDescription)return;sf.info("Peer onnegotiationneeded, updating local description");const r=yield t.createOffer();sf.info("Peer onnegotiationneeded, got local offer",r.sdp),r.sdp=Rd.updateMissingVideoExtensions(r.sdp,t.remoteDescription.sdp),yield t.setLocalDescription(r);const n=Rd.renegotiate(r.sdp,t.remoteDescription.sdp);sf.info("Peer onnegotiationneeded, updating remote description",n),yield t.setRemoteDescription({type:"answer",sdp:n}),sf.info("Peer onnegotiationneeded, renegotiation done")})),function(e){return r.apply(this,arguments)})},hf=(e,t,r)=>{sf.info("Adding mediaStream tracks to RTCPeerConnection");var n,i=_(t.getTracks());try{for(i.s();!(n=i.n()).done;){const i=n.value,o={streams:[t]};"audio"===i.kind&&(o.direction=r.disableAudio?"inactive":"sendonly"),"video"===i.kind&&(o.direction=r.disableVideo?"inactive":"sendonly",r.scalabilityMode&&(new Sd).isChrome()?(sf.debug("Video track with scalability mode: ".concat(r.scalabilityMode,".")),o.sendEncodings=[{scalabilityMode:r.scalabilityMode}]):r.scalabilityMode&&sf.warn("SVC is only supported in Google Chrome")),e.addTransceiver(i,o),sf.info("Track '".concat(i.label,"' added: "),"id: ".concat(i.id),"kind: ".concat(i.kind))}}catch(e){i.e(e)}finally{i.f()}},mf=(e,t)=>{const r=new Sd;if(!t.disableVideo){const t=e.addTransceiver("video",{direction:"recvonly"});r.isOpera()&&t.setCodecPreferences(RTCRtpReceiver.getCapabilities("video").codecs.filter(e=>"video/H264"!==e.mimeType||e.sdpFmtpLine.includes("profile-level-id=4")))}t.disableAudio||e.addTransceiver("audio",{direction:"recvonly"});for(let r=0;r<t.multiplexedAudioTracks;r++)e.addTransceiver("audio",{direction:"recvonly"})},gf=e=>{var t;const r=null!==(t=e.connectionState)&&void 0!==t?t:e.iceConnectionState;switch(r){case"checking":return"connecting";case"completed":return"connected";default:return r}},vf=_n.get("Director");let yf="",wf="https://realtime1.wowza.com";class uf{static setEndpoint(e){wf=e.replace(/\/$/,"")}static getEndpoint(){return wf}static setLiveDomain(e){yf=e.replace(/\/$/,"")}static getLiveDomain(){return yf}static getPublisher(e){var t=arguments,r=this;return D((function*(){const n=Sf(e,t.length>1&&void 0!==t[1]?t[1]:null,t.length>2&&void 0!==t[2]?t[2]:"WebRtc");vf.info("Getting publisher connection path for stream name: ",n.streamName);const i={streamName:n.streamName,streamType:n.streamType},o={"Content-Type":"application/json",Authorization:"Bearer ".concat(n.token)},s="".concat(r.getEndpoint(),"/api/director/publish");try{let e=yield fetch(s,{method:"POST",headers:o,body:JSON.stringify(i)});if(e=yield e.json(),"fail"===e.status)throw new Error(e.data.message);return e=xf(e),vf.debug("Getting publisher response: ",e),e.data}catch(e){throw vf.error("Error while getting publisher connection path. ",e),e}}))()}static getSubscriber(e){var t=arguments,r=this;return D((function*(){const n=Cf(e,t.length>1&&void 0!==t[1]?t[1]:null,t.length>2&&void 0!==t[2]?t[2]:null);vf.info("Getting subscriber connection data for stream name: ".concat(n.streamName," and account id: ").concat(n.streamAccountId));const i={streamAccountId:n.streamAccountId,streamName:n.streamName};let o={"Content-Type":"application/json"};n.subscriberToken&&(o=O(O({},o),{},{Authorization:"Bearer ".concat(n.subscriberToken)}));const s="".concat(r.getEndpoint(),"/api/director/subscribe");try{let e=yield fetch(s,{method:"POST",headers:o,body:JSON.stringify(i)});if(e=yield e.json(),"fail"===e.status)throw new Error(e.data.message);return e=xf(e),vf.debug("Getting subscriber response: ",e),e.data}catch(e){throw vf.error("Error while getting subscriber connection path. ",e),e}}))()}}const Sf=(e,t,r)=>{let n="object"==typeof e?e:{};return 0===Object.keys(n).length&&(n={token:e,streamName:t,streamType:r}),n},Cf=(e,t,r)=>{let n="object"==typeof e?e:{};return 0===Object.keys(n).length&&(n={streamName:e,streamAccountId:t,subscriberToken:r}),n=O(O({},n),{},{streamAccountId:"bUEzT6"}),n},xf=e=>{if(uf.getLiveDomain()){const t=/\/\/(.*?)\//,r=e.data.urls.map(e=>{const r=t.exec(e);return e.replace(r[1],uf.getLiveDomain())});e.data.urls=r}return e};function Ef(e){this.message=e}function If(e){this.message=e}let Rf;Ef.prototype=new Error,Ef.prototype.name="InvalidCharacterError","undefined"!=typeof window&&window.atob&&window.atob.bind(window),If.prototype=new Error,If.prototype.name="InvalidTokenError",V((function(e,t){!function(r){if(null!=t&&"number"!=typeof t.nodeType)e.exports=r();else{var n=r(),i="undefined"!=typeof self?self:$.global;"function"!=typeof i.btoa&&(i.btoa=n.btoa),"function"!=typeof i.atob&&(i.atob=n.atob)}}((function(){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function t(e){this.message=e}return t.prototype=new Error,t.prototype.name="InvalidCharacterError",{btoa:function(r){for(var n,i,o=String(r),s=0,a=e,c="";o.charAt(0|s)||(a="=",s%1);c+=a.charAt(63&n>>8-s%1*8)){if((i=o.charCodeAt(s+=3/4))>255)throw new t("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");n=n<<8|i}return c},atob:function(r){var n=String(r).replace(/[=]+$/,"");if(n.length%4==1)throw new t("'atob' failed: The string to be decoded is not correctly encoded.");for(var i,o,s=0,a=0,c="";o=n.charAt(a++);~o&&(i=s%4?64*i+o:o,s++%4)?c+=String.fromCharCode(255&i>>(-2*s&6)):0)o=e.indexOf(o);return c}}}))}));class bf extends cu{constructor(e,t,r,n){if(super(),Rf=r,!e)throw Rf.error("Stream Name is required to construct this module."),new Error("Stream Name is required to construct this module.");if(!t)throw Rf.error("Token generator is required to construct this module."),new Error("Token generator is required to construct this module.");this.webRTCPeer=new Hd,this.signaling=null,this.streamName=e,this.autoReconnect=n,this.reconnectionInterval=1e3,this.alreadyDisconnected=!1,this.firstReconnection=!0,this.stopReconnection=!1,this.tokenGenerator=t,this.options=null}getRTCPeerConnection(){return this.webRTCPeer?this.webRTCPeer.getRTCPeer():null}stop(){var e;Rf.info("Stopping"),this.webRTCPeer.closeRTCPeer(),null===(e=this.signaling)||void 0===e||e.close(),this.signaling=null,this.stopReconnection=!0,this.webRTCPeer=new Hd}isActive(){const e=this.webRTCPeer.getRTCPeerStatus();return Rf.info("Broadcast status: ",e||"not_established"),"connected"===e}setReconnect(){this.signaling.on("migrate",()=>this.replaceConnection()),this.autoReconnect&&(this.signaling.on(Qd,()=>{!this.firstReconnection&&this.alreadyDisconnected||(this.firstReconnection=!1,this.reconnect({error:new Error("Signaling error: wsConnectionError")}))}),this.webRTCPeer.on(af.connectionStateChange,e=>{("failed"===e||"disconnected"===e&&this.alreadyDisconnected)&&this.firstReconnection?(this.firstReconnection=!1,this.reconnect({error:new Error("Connection state change: RTCPeerConnectionState disconnected")})):"disconnected"===e?(this.alreadyDisconnected=!0,setTimeout(()=>this.reconnect({error:new Error("Connection state change: RTCPeerConnectionState disconnected")}),1500)):this.alreadyDisconnected=!1}))}reconnect(e){var t=this;return D((function*(){try{t.isActive()||t.stopReconnection||(t.stop(),t.emit("reconnect",{timeout:Pf(t.reconnectionInterval),error:null!=e&&e.error?null==e?void 0:e.error:new Error("Attempting to reconnect")}),yield t.connect(t.options),t.alreadyDisconnected=!1,t.reconnectionInterval=1e3,t.firstReconnection=!0)}catch(e){t.reconnectionInterval=Pf(t.reconnectionInterval),Rf.error("Reconnection failed, retrying in ".concat(t.reconnectionInterval,"ms. "),e),setTimeout(()=>t.reconnect({error:e}),t.reconnectionInterval)}}))()}}const Pf=e=>e<32e3?2*e:e;_n.get("Publish"),tf.H264;const kf=_n.get("View"),Af={disableVideo:!1,disableAudio:!1,peerConfig:{}};class Tf extends bf{constructor(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;super(e,t,kf,!(arguments.length>3&&void 0!==arguments[3])||arguments[3]),r&&this.on(af.track,e=>{r.srcObject=e.streams[0]})}connect(){var e=arguments,t=this;return D((function*(){let r=e.length>0&&void 0!==e[0]?e[0]:Af;t.options=O(O(O({},Af),r),{},{setSDPToPeer:!1}),yield t.initConnection({migrate:!1})}))()}select(){var e=arguments,t=this;return D((function*(){let r=e.length>0&&void 0!==e[0]?e[0]:{};kf.debug("Viewer select layer values: ",r),yield t.signaling.cmd("select",{layer:r}),kf.info("Connected to streamName: ",t.streamName)}))()}addRemoteTrack(e,t){var r=this;return D((function*(){return kf.info("Viewer adding remote % track",e),r.webRTCPeer.addRemoteTrack(e,t)}))()}project(e,t){var r=this;return D((function*(){var n,i=_(t);try{for(i.s();!(n=i.n()).done;){const e=n.value;if(!e.trackId&&!e.media)throw kf.error("Error in projection mapping, trackId or mediaId must be set"),new Error("Error in projection mapping, trackId or mediaId must be set");const t=r.webRTCPeer.getRTCPeer();if(e.mediaId&&!t.getTransceivers().find(t=>t.mid===e.mediaId.toString()))throw kf.error("Error in projection mapping, ".concat(e.mediaId," mid not found in local transceivers")),new Error("Error in projection mapping, ".concat(e.mediaId," mid not found in local transceivers"))}}catch(e){i.e(e)}finally{i.f()}kf.debug("Viewer project source: layer mappings: ",e,t),yield r.signaling.cmd("project",{sourceId:e,mapping:t}),kf.info("Projection done")}))()}unproject(e){var t=this;return D((function*(){kf.debug("Viewer unproject mediaIds: ",e),yield t.signaling.cmd("unproject",{mediaIds:e}),kf.info("Unprojection done")}))()}replaceConnection(){var e=this;return D((function*(){kf.info("Migrating current connection"),yield e.initConnection({migrate:!0})}))()}initConnection(e){var t=this;return D((function*(){var r,n;let i,o;if(kf.debug("Viewer connect options values: ",t.options),t.stopReconnection=!1,!e.migrate&&t.isActive())throw kf.warn("Viewer currently subscribed"),new Error("Viewer currently subscribed");try{var s;o=yield t.tokenGenerator(),t.options.peerConfig.iceServers=null===(s=o)||void 0===s?void 0:s.iceServers}catch(e){throw kf.error("Error generating token."),e}if(!o)throw kf.error("Error while subscribing. Subscriber data required"),new Error("Subscriber data required");const a=new zd({streamName:t.streamName,url:"".concat(o.urls[0],"?token=").concat(o.jwt)}),c=e.migrate?new Hd:t.webRTCPeer;yield c.createRTCPeer(t.options.peerConfig),null===(r=t.stopReemitingWebRTCPeerInstanceEvents)||void 0===r||r.call(t),null===(n=t.stopReemitingSignalingInstanceEvents)||void 0===n||n.call(t),t.stopReemitingWebRTCPeerInstanceEvents=wu(c,t,Object.values(af)),t.stopReemitingSignalingInstanceEvents=wu(a,t,[ef]);const u=c.getRTCLocalSDP(O(O({},t.options),{},{stereo:!0})),l=a.connect();i=yield Promise.all([u,l]);const d=i[0];let f=t.signaling;t.signaling=a;const p=t.signaling.subscribe(d,O(O({},t.options),{},{vad:t.options.multiplexedAudioTracks>0})),h=c.peer.setLocalDescription(c.sessionDescription);i=yield Promise.all([p,h]);const m=i[0];yield c.setRTCRemoteSDP(m),kf.info("Connected to streamName: ",t.streamName);let g=t.webRTCPeer;t.webRTCPeer=c,t.setReconnect(),e.migrate&&t.webRTCPeer.on(af.connectionStateChange,e=>{if("connected"===e)setTimeout(()=>{var e,t,r,n;null===(e=f)||void 0===e||null===(t=e.close)||void 0===t||t.call(e),null===(r=g)||void 0===r||null===(n=r.closeRTCPeer)||void 0===n||n.call(r),f=g=null,kf.info("Current connection migrated")},1e3);else if(["disconnected","failed","closed"].includes(e)){var t,r,n,i;null===(t=f)||void 0===t||null===(r=t.close)||void 0===r||r.call(t),null===(n=g)||void 0===n||null===(i=n.closeRTCPeer)||void 0===i||i.call(n),f=g=null}})}))()}}var Of;!function(e){e[e.Err=0]="Err",e[e.Idle=1]="Idle",e[e.Receiving=2]="Receiving",e[e.Broadcasting=3]="Broadcasting"}(Of||(Of={}));class MillicastAdapter{constructor(e,r,n=t("rts/millicast")){this.player=e,this.src=r,this.log=n}static wants(e){return e.type==MillicastAdapter.Type}async load(){this.log("loading",this.src.streamName);(this.engine=new Tf(this.src.streamName,()=>uf.getSubscriber(this.src),this.player)).on("broadcastEvent",e=>{switch(e.name){case"active":return this.handleActive(e);case"inactive":return this.handleInactive(e)}}),await this.connect()}handleActive(e){return this.player.hasState("is-error")&&this.player.emit("recover"),this.player.emit("rts/status",{status:Of.Receiving})}handleInactive(e){const t={status:Of.Idle,message:this.player.i18n("rts.millicast.inactive","broadcast has become inactive")};this.player.emit("rts/status",t),this.player.emit("error",Object.assign({fatal:!1},t))}async connect(){try{await this._connect()}catch(e){this.log("Connection failed",e),this.player.emit("error",e),setTimeout(()=>{0==this.player.reaper||this.player.currentSrc||(this.player.emit("recover"),this.connect())},3e3)}}async _connect(){var e;const t=this.engine;t&&(await t.connect(),null===(e=t.webRTCPeer)||void 0===e||e.initStats())}stop(){var e;null===(e=this.engine)||void 0===e||e.stop()}}
|
|
2
2
|
/**
|
|
3
3
|
* @license wowza-webrtc-player 1.0.5
|
|
4
4
|
* Copyright (c) 2018-2022 Koala Interactive, Inc.
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
7
|
-
function wf(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function bf(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?wf(Object(r),!0).forEach((function(t){xf(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):wf(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Sf(e,t,r,n,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,i)}function Cf(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function s(e){Sf(o,n,i,s,a,"next",e)}function a(e){Sf(o,n,i,s,a,"throw",e)}s(void 0)}))}}function xf(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ef(){}function Tf(){Tf.init.call(this)}function If(e){return void 0===e._maxListeners?Tf.defaultMaxListeners:e._maxListeners}function Rf(e,t,r){if(t)e.call(r);else for(var n=e.length,i=Nf(e,n),o=0;o<n;++o)i[o].call(r)}function Pf(e,t,r,n){if(t)e.call(r,n);else for(var i=e.length,o=Nf(e,i),s=0;s<i;++s)o[s].call(r,n)}function Af(e,t,r,n,i){if(t)e.call(r,n,i);else for(var o=e.length,s=Nf(e,o),a=0;a<o;++a)s[a].call(r,n,i)}function kf(e,t,r,n,i,o){if(t)e.call(r,n,i,o);else for(var s=e.length,a=Nf(e,s),c=0;c<s;++c)a[c].call(r,n,i,o)}function Of(e,t,r,n){if(t)e.apply(r,n);else for(var i=e.length,o=Nf(e,i),s=0;s<i;++s)o[s].apply(r,n)}function Lf(e,t,r,n){var i,o,s,a;if("function"!=typeof r)throw new TypeError('"listener" argument must be a function');if((o=e._events)?(o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),s=o[t]):(o=e._events=new Ef,e._eventsCount=0),s){if("function"==typeof s?s=o[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),!s.warned&&(i=If(e))&&i>0&&s.length>i){s.warned=!0;var c=Error("Possible EventEmitter memory leak detected. "+s.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=s.length,a=c,"function"==typeof console.warn?console.warn(a):console.log(a)}}else s=o[t]=r,++e._eventsCount;return e}function Df(e,t,r){var n=!1;function i(){e.removeListener(t,i),n||(n=!0,r.apply(e,arguments))}return i.listener=r,i}function Mf(e){var t=this._events;if(t){var r=t[e];if("function"==typeof r)return 1;if(r)return r.length}return 0}function Nf(e,t){for(var r=Array(t);t--;)r[t]=e[t];return r}MillicastAdapter.Events={ACTIVE:"rts/millicast/active",INACTIVE:"rts/millicast/inactive"},MillicastAdapter.Type="wowza/rts",Ef.prototype=Object.create(null),Tf.EventEmitter=Tf,Tf.usingDomains=!1,Tf.prototype.domain=void 0,Tf.prototype._events=void 0,Tf.prototype._maxListeners=void 0,Tf.defaultMaxListeners=10,Tf.init=function(){this.domain=null,Tf.usingDomains&&(void 0).active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new Ef,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Tf.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},Tf.prototype.getMaxListeners=function(){return If(this)},Tf.prototype.emit=function(e){var t,r,n,i,o,s,a,c="error"===e;if(s=this._events)c=c&&null==s.error;else if(!c)return!1;if(a=this.domain,c){if(t=arguments[1],!a){if(t instanceof Error)throw t;var u=Error('Uncaught, unspecified "error" event. ('+t+")");throw u.context=t,u}return t||(t=Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=a,t.domainThrown=!1,a.emit("error",t),!1}if(!(r=s[e]))return!1;var l="function"==typeof r;switch(n=arguments.length){case 1:Rf(r,l,this);break;case 2:Pf(r,l,this,arguments[1]);break;case 3:Af(r,l,this,arguments[1],arguments[2]);break;case 4:kf(r,l,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=Array(n-1),o=1;o<n;o++)i[o-1]=arguments[o];Of(r,l,this,i)}return!0},Tf.prototype.addListener=function(e,t){return Lf(this,e,t,!1)},Tf.prototype.on=Tf.prototype.addListener,Tf.prototype.prependListener=function(e,t){return Lf(this,e,t,!0)},Tf.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,Df(this,e,t)),this},Tf.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,Df(this,e,t)),this},Tf.prototype.removeListener=function(e,t){var r,n,i,o,s;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(n=this._events))return this;if(!(r=n[e]))return this;if(r===t||r.listener&&r.listener===t)0==--this._eventsCount?this._events=new Ef:(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,o=r.length;o-- >0;)if(r[o]===t||r[o].listener&&r[o].listener===t){s=r[o].listener,i=o;break}if(i<0)return this;if(1===r.length){if(r[0]=void 0,0==--this._eventsCount)return this._events=new Ef,this;delete n[e]}else!function(e,t){for(var r=t,n=r+1,i=e.length;n<i;r+=1,n+=1)e[r]=e[n];e.pop()}(r,i);n.removeListener&&this.emit("removeListener",e,s||t)}return this},Tf.prototype.removeAllListeners=function(e){var t,r;if(!(r=this._events))return this;if(!r.removeListener)return 0===arguments.length?(this._events=new Ef,this._eventsCount=0):r[e]&&(0==--this._eventsCount?this._events=new Ef:delete r[e]),this;if(0===arguments.length){for(var n,i=Object.keys(r),o=0;o<i.length;++o)"removeListener"!==(n=i[o])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=new Ef,this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(t)do{this.removeListener(e,t[t.length-1])}while(t[0]);return this},Tf.prototype.listeners=function(e){var t,r=this._events;return r&&(t=r[e])?"function"==typeof t?[t.listener||t]:function(e){for(var t=Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(t):[]},Tf.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):Mf.call(e,t)},Tf.prototype.listenerCount=Mf,Tf.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};var jf=window.RTCPeerConnection,_f=window.RTCIceCandidate,Bf=window.RTCSessionDescription;class b extends Tf{constructor(e){super(),xf(this,"pc",void 0),this.pc=new jf({iceServers:e}),"ontrack"in this.pc?this.pc.ontrack=this.handleTrackEvent.bind(this):this.pc.onaddstream=this.handleNewStreamEvent.bind(this)}getPeerConnection(){return this.pc}close(){this.pc.close()}setRemoteDescription(e){return this.pc.setRemoteDescription(new Bf(e))}setLocalDescription(e){return this.pc.setLocalDescription(new Bf(e))}createAnswer(){var e=this;return Cf((function*(){return e.pc.createAnswer()}))()}createOffer(){var e=this;return Cf((function*(){return e.pc.createOffer()}))()}attachIceCandidate(e){return this.pc.addIceCandidate(new _f(e))}attachMediaStream(e){var t=this.pc,r=t.getSenders(),n=e.getTracks();r.length?n.forEach(e=>{r.filter(t=>{var r;return(null===(r=t.track)||void 0===r?void 0:r.kind)===e.kind}).forEach(t=>{t.replaceTrack(e)})}):n.forEach(r=>{t.addTrack(r,e)})}handleNewStreamEvent(e){var{stream:t}=e;this.emit("addstream",t)}handleTrackEvent(e){e.streams.forEach(e=>{this.emit("addstream",e)})}}class C{constructor(e,t,r){this.url=e,this.streamInfo=t,this.userData=r,xf(this,"ws",null),xf(this,"pendingCommands",new Map)}connect(){return this.ws?Promise.resolve(this.ws):new Promise((e,t)=>{var r=new WebSocket(this.url);r.binaryType="arraybuffer",r.onopen=()=>e(r),r.onerror=()=>t(),r.onclose=()=>t(),r.onmessage=this.handleSocketData.bind(this),this.ws=r})}disconnect(){this.ws&&(this.ws.close(),this.ws=null)}getOffer(){var e={direction:"play",command:"getOffer"};return this.streamInfo.secureToken&&(e.secureToken=this.streamInfo.secureToken),this.send(e)}sendOffer(e){return this.send({direction:"publish",command:"sendOffer",sdp:e})}sendResponse(e){return this.send({direction:"play",command:"sendResponse",sdp:e})}getAvailableStreams(){return this.send({direction:"play",command:"getAvailableStreams"})}send(e){var t=this;return Cf((function*(){var r,n=t.ws||(yield t.connect());return t.pendingCommands.has(e.command)||t.pendingCommands.set(e.command,((r={}).promise=new Promise((e,t)=>{r.resolve=e,r.reject=t}),r)),n.send(JSON.stringify(bf(bf({},e),{},{streamInfo:t.streamInfo,userData:t.userData}))),t.pendingCommands.get(e.command).promise}))()}handleSocketData(e){var t,r=JSON.parse(e.data);200===r.status?(null!==(t=r.streamInfo)&&void 0!==t&&t.sessionId&&(this.streamInfo.sessionId=r.streamInfo.sessionId),this.pendingCommands.has(r.command)&&(this.pendingCommands.get(r.command).resolve(r),this.pendingCommands.delete(r.command))):this.pendingCommands.has(r.command)&&(this.pendingCommands.get(r.command).reject(r),this.pendingCommands.delete(r.command))}}var Uf="mozGetUserMedia"in navigator?"firefox":"webkitGetUserMedia"in navigator||!1===window.isSecureContext&&"webkitRTCPeerConnection"in window&&!("RTCIceGatherer"in window)?"chrome":navigator.mediaDevices&&navigator.userAgent.match(/Edge\/(\d+).(\d+)$/)?"edge":window.RTCPeerConnection&&navigator.userAgent.match(/AppleWebKit\/(\d+)\./)?"safari":"unknown",Vf=["vp9","vp8","h264","red","ulpfec","rtx"],Ff=["opus","isac","g722","pcmu","pcma","cn"];class S{constructor(e,t){this.videoOptions=e,this.audioOptions=t,xf(this,"audioIndex",-1),xf(this,"videoIndex",-1)}transformPlay(e){return e.sdp?(e.sdp=e.sdp.replace(/profile-level-id=(\w+)/gi,(e,t)=>{var r=parseInt(t,16),n=r>>16&255,i=r>>8&255,o=255&r;return n>66?(n=66,i=224,o=31):0===i&&(i=224),"profile-level-id=".concat((n<<16|i<<8|o).toString(16))}),e):e}transformPublish(e){var t=this.prepareSDP(e),r=this.videoOptions,n=this.audioOptions,i=null,o=()=>"m=audio"===i?n:"m=video"===i?r:null,s=t.filter(Boolean).map(e=>{var[t]=e.split(/\s|:/,1);switch(t){case"m=audio":case"m=video":var s="m=audio"===t?this.audioIndex:this.videoIndex;if(-1!==s&&"chrome"===Uf){var[a,c,u]=e.split(" ");return"".concat(a," ").concat(c," ").concat(u," ").concat(s)}i=t;break;case"a=rtpmap":var l=/^a=rtpmap:(\d+)\s+(\w+)\/(\d+)/.exec(e);if(!l||"chrome"!==Uf)break;var d=l[2].toLowerCase();r.bitRate&&Vf.includes(d)&&(e+="\r\na=fmtp:".concat(l[1]," x-google-min-bitrate=").concat(r.bitRate,";x-google-max-bitrate=").concat(r.bitRate)),n.bitRate&&Ff.includes(d)&&(e+="\r\na=fmtp:".concat(l[1]," x-google-min-bitrate=").concat(n.bitRate,";x-google-max-bitrate=").concat(n.bitRate));break;case"c=IN":var f=o();if(null!=f&&f.bitRate&&["firefox","safari"].includes(Uf)){var p=1e3*f.bitRate;e+="\r\nb=TIAS:".concat(.95*p-16e3),e+="\r\nb=AS:".concat(p),e+="\r\nb=CT:".concat(p)}break;case"a=mid":var h=o();h&&"chrome"===Uf&&(h.bitRate&&(e+="\r\nb=CT:".concat(h.bitRate),e+="\r\nb=AS:".concat(h.bitRate),"frameRate"in h&&h.frameRate&&(e+="\r\na=framerate:".concat(h.frameRate.toFixed(2)))),i=null)}return e}).join("\r\n")+"\r\n";return{type:e.type,sdp:s}}checkLine(e,t){if(/^a=(rtpmap|rtcp-fb|fmtp)/.test(e)){var r=e.split(":");if(r.length>1){var[n,i]=r[1].split(" ");if(!i.startsWith("http")&&!i.startsWith("ur")){var o=parseInt(n,10),s=t.get(o)||[];return s.push(e),t.set(o,s),!1}}}return!0}deliverCheckLine(e,t,r){var n=Array.from(r).find(t=>{var[,r]=t;return r.join("\r\n").includes(e)});if(!n)return[];var[i,o]=n;return"audio"===t?this.audioIndex=i:this.videoIndex=i,"VP8"!==e&&"VP9"!==e?o:o.filter(e=>!e.includes("transport-cc")&&!e.includes("goog-remb")&&!e.includes("nack"))}addAudio(e,t){for(var r="",n=0,i=e.length;n<i;++n){var o=e[n];if(o.startsWith("m=audio"))r="audio";else if(o.startsWith("m=video"))r="video";else if("a=rtcp-mux"===o&&"audio"===r){var s=this.deliverCheckLine(this.audioOptions.codec,"audio",t);e.splice(n+1,0,...s);break}}return e}addVideo(e,t){var r=e.includes("a=rtcp-rsize"),n=e.includes("a=rtcp-mux"),i=!1;if(!r&&!n)return e;var o=this.deliverCheckLine(this.videoOptions.codec,"video",t);return e.map(e=>{if(r){if(!i&&"a=rtcp-rsize"===e)return i=!0,[e].concat(o).join("\r\n")}else if("a=rtcp-mux"===e){if(i)return[e].concat(o).join("\r\n");i=!0}return e})}flattenLines(e){return e.join("\r\n").split("\r\n")}prepareSDP(e){var t=new Map,r=(e.sdp||"").split(/\r\n/);return r=r.filter(e=>e&&this.checkLine(e,t)),r=this.flattenLines(this.addAudio(r,t)),this.flattenLines(this.addVideo(r,t))}}class x extends Tf{constructor(e,t){super(),this.video=e,xf(this,"sdpUrl",""),xf(this,"applicationName",""),xf(this,"streamName",""),xf(this,"userData",null),xf(this,"sdpHandler",void 0),xf(this,"secureToken",void 0),xf(this,"constraints",{audio:!0,video:!0}),xf(this,"videoConfigs",{bitRate:360,codec:"42e01f",frameRate:29.97}),xf(this,"audioConfigs",{codec:"opus",bitRate:64}),xf(this,"iceServers",[]),xf(this,"mediaStream",null),xf(this,"pc",null),t&&this.setConfigurations(t)}setConfigurations(e){e.constraints&&(this.constraints=e.constraints),e.videoConfigs&&(this.videoConfigs=e.videoConfigs),e.audioConfigs&&(this.audioConfigs=e.audioConfigs),e.applicationName&&(this.applicationName=e.applicationName),e.streamName&&(this.streamName=e.streamName),e.sdpUrl&&(this.sdpUrl=e.sdpUrl),void 0!==e.userData&&(this.userData=e.userData),e.iceServers&&(this.iceServers=e.iceServers),e.sdpHandler&&(this.sdpHandler=e.sdpHandler),e.secureToken&&(this.secureToken=e.secureToken)}stop(){this.pc&&(this.pc.close(),this.pc=null)}getMediaStream(){return this.mediaStream}getPeerConnection(){return this.pc?this.pc.getPeerConnection():null}playLocal(e){var t=this;return Cf((function*(){e&&(t.constraints=e);var r=yield function(e){var t;return null!==(t=navigator.mediaDevices)&&void 0!==t&&t.getUserMedia?navigator.mediaDevices.getUserMedia(e):"getUserMedia"in navigator?new Promise((t,r)=>{navigator.getUserMedia(e,t,r)}):Promise.reject("Your browser does not support getUserMedia API")}(t.constraints);return t.attachStream(r),r}))()}stopLocal(){this.stop(),this.mediaStream&&(this.mediaStream.getTracks().forEach(e=>{e.stop()}),this.mediaStream=null)}playRemote(e){var t=this;return Cf((function*(){e&&t.setConfigurations(e);var r=t.createWowzaInstance();try{var{sdp:n}=yield r.getOffer(),i=t.createPeerConnection();i.on("addstream",t.attachStream.bind(t)),yield i.setRemoteDescription(n);var o=yield i.createAnswer(),s=new S(t.videoConfigs,t.audioConfigs),a=t.sdpHandler?t.sdpHandler(o,e=>s.transformPlay(e),"play"):s.transformPlay(o);yield i.setLocalDescription(a);var{iceCandidates:c}=yield r.sendResponse(a);c.forEach(e=>{i.attachIceCandidate(e)})}finally{r.disconnect()}}))()}publish(e){var t=this;return Cf((function*(){e&&t.setConfigurations(e);var r=t.createWowzaInstance();try{var n=t.mediaStream||(yield t.playLocal()),i=t.createPeerConnection();i.attachMediaStream(n);var o=new S(t.videoConfigs,t.audioConfigs),s=yield i.createOffer(),a=t.sdpHandler?t.sdpHandler(s,e=>o.transformPublish(e),"publish"):o.transformPublish(s);yield i.setLocalDescription(a);var{sdp:c,iceCandidates:u}=yield r.sendOffer(a);yield i.setRemoteDescription(c),u.forEach(e=>{i.attachIceCandidate(e)})}finally{r.disconnect()}}))()}getAvailableStreams(){var e=this;return Cf((function*(){var t=e.createWowzaInstance();try{var{availableStreams:r}=yield t.getAvailableStreams();return r||[]}catch(e){return[]}finally{t.disconnect()}}))()}createWowzaInstance(){return new C(this.sdpUrl,{applicationName:this.applicationName,sessionId:"[empty]",streamName:this.streamName,secureToken:this.secureToken},this.userData)}createPeerConnection(){return this.pc=new b(this.iceServers),this.pc}attachStream(e){this.mediaStream=e;try{var t=this.video.srcObject instanceof MediaStream&&this.video.srcObject;t&&t.id===e.id||(this.video.srcObject=e)}catch(t){this.video.src=window.URL.createObjectURL(e)}this.pc&&this.pc.attachMediaStream(e),this.video.play()}}class WowzaWebRTCAdapter{constructor(e,r,n=t("rts/webrtc")){this.player=e,this.src=r,this.log=n}static wants(e){return e.type==WowzaWebRTCAdapter.Type}async load(){this.log("loading",this.src.streamName),this.engine=new x(this.player,this.src),await this.engine.playRemote()}async stop(){var e;await(null===(e=this.engine)||void 0===e?void 0:e.stop())}}WowzaWebRTCAdapter.Events={ACTIVE:"rts/wowza-webrtc/active",INACTIVE:"rts/webrtc/inactive"},WowzaWebRTCAdapter.Type="wowza/webrtc";class RTSLoader{constructor(){this.log=t("rts"),console.log("warning / the realtime plugin is in beta release")}init(e,t,r){r.on("reap",()=>{var e;return null===(e=this.engine)||void 0===e?void 0:e.stop()})}onload(e,t,r,n){var i;switch(n.type){case MillicastAdapter.Type:this.engine=new MillicastAdapter(r,n);break;case WowzaWebRTCAdapter.Type:this.engine=new WowzaWebRTCAdapter(r,n)}null===(i=this.engine)||void 0===i||i.load()}wants(e,t,r){return"string"==typeof t.type&&(MillicastAdapter.wants(t)||WowzaWebRTCAdapter.wants(t))}}return RTSLoader.events={},function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;if(null===document.currentScript)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});const r=e.flowplayer;"function"==typeof r?r(t):(Array.isArray(r.extensions)||(r.extensions=[]),~r.extensions.indexOf(t)||r.extensions.push(t))}(window,RTSLoader),RTSLoader}));
|
|
7
|
+
function Lf(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Df(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Lf(Object(r),!0).forEach((function(t){jf(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Lf(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Mf(e,t,r,n,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,i)}function Nf(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function s(e){Mf(o,n,i,s,a,"next",e)}function a(e){Mf(o,n,i,s,a,"throw",e)}s(void 0)}))}}function jf(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Bf(){}function _f(){_f.init.call(this)}function Uf(e){return void 0===e._maxListeners?_f.defaultMaxListeners:e._maxListeners}function Vf(e,t,r){if(t)e.call(r);else for(var n=e.length,i=Xf(e,n),o=0;o<n;++o)i[o].call(r)}function Ff(e,t,r,n){if(t)e.call(r,n);else for(var i=e.length,o=Xf(e,i),s=0;s<i;++s)o[s].call(r,n)}function zf(e,t,r,n,i){if(t)e.call(r,n,i);else for(var o=e.length,s=Xf(e,o),a=0;a<o;++a)s[a].call(r,n,i)}function $f(e,t,r,n,i,o){if(t)e.call(r,n,i,o);else for(var s=e.length,a=Xf(e,s),c=0;c<s;++c)a[c].call(r,n,i,o)}function Gf(e,t,r,n){if(t)e.apply(r,n);else for(var i=e.length,o=Xf(e,i),s=0;s<i;++s)o[s].apply(r,n)}function Wf(e,t,r,n){var i,o,s,a;if("function"!=typeof r)throw new TypeError('"listener" argument must be a function');if((o=e._events)?(o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),s=o[t]):(o=e._events=new Bf,e._eventsCount=0),s){if("function"==typeof s?s=o[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),!s.warned&&(i=Uf(e))&&i>0&&s.length>i){s.warned=!0;var c=Error("Possible EventEmitter memory leak detected. "+s.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=s.length,a=c,"function"==typeof console.warn?console.warn(a):console.log(a)}}else s=o[t]=r,++e._eventsCount;return e}function qf(e,t,r){var n=!1;function i(){e.removeListener(t,i),n||(n=!0,r.apply(e,arguments))}return i.listener=r,i}function Hf(e){var t=this._events;if(t){var r=t[e];if("function"==typeof r)return 1;if(r)return r.length}return 0}function Xf(e,t){for(var r=Array(t);t--;)r[t]=e[t];return r}MillicastAdapter.Events={ACTIVE:"rts/millicast/active",INACTIVE:"rts/millicast/inactive"},MillicastAdapter.Type="wowza/rts",Bf.prototype=Object.create(null),_f.EventEmitter=_f,_f.usingDomains=!1,_f.prototype.domain=void 0,_f.prototype._events=void 0,_f.prototype._maxListeners=void 0,_f.defaultMaxListeners=10,_f.init=function(){this.domain=null,_f.usingDomains&&(void 0).active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new Bf,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},_f.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},_f.prototype.getMaxListeners=function(){return Uf(this)},_f.prototype.emit=function(e){var t,r,n,i,o,s,a,c="error"===e;if(s=this._events)c=c&&null==s.error;else if(!c)return!1;if(a=this.domain,c){if(t=arguments[1],!a){if(t instanceof Error)throw t;var u=Error('Uncaught, unspecified "error" event. ('+t+")");throw u.context=t,u}return t||(t=Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=a,t.domainThrown=!1,a.emit("error",t),!1}if(!(r=s[e]))return!1;var l="function"==typeof r;switch(n=arguments.length){case 1:Vf(r,l,this);break;case 2:Ff(r,l,this,arguments[1]);break;case 3:zf(r,l,this,arguments[1],arguments[2]);break;case 4:$f(r,l,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=Array(n-1),o=1;o<n;o++)i[o-1]=arguments[o];Gf(r,l,this,i)}return!0},_f.prototype.addListener=function(e,t){return Wf(this,e,t,!1)},_f.prototype.on=_f.prototype.addListener,_f.prototype.prependListener=function(e,t){return Wf(this,e,t,!0)},_f.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,qf(this,e,t)),this},_f.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,qf(this,e,t)),this},_f.prototype.removeListener=function(e,t){var r,n,i,o,s;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(n=this._events))return this;if(!(r=n[e]))return this;if(r===t||r.listener&&r.listener===t)0==--this._eventsCount?this._events=new Bf:(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,o=r.length;o-- >0;)if(r[o]===t||r[o].listener&&r[o].listener===t){s=r[o].listener,i=o;break}if(i<0)return this;if(1===r.length){if(r[0]=void 0,0==--this._eventsCount)return this._events=new Bf,this;delete n[e]}else!function(e,t){for(var r=t,n=r+1,i=e.length;n<i;r+=1,n+=1)e[r]=e[n];e.pop()}(r,i);n.removeListener&&this.emit("removeListener",e,s||t)}return this},_f.prototype.removeAllListeners=function(e){var t,r;if(!(r=this._events))return this;if(!r.removeListener)return 0===arguments.length?(this._events=new Bf,this._eventsCount=0):r[e]&&(0==--this._eventsCount?this._events=new Bf:delete r[e]),this;if(0===arguments.length){for(var n,i=Object.keys(r),o=0;o<i.length;++o)"removeListener"!==(n=i[o])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=new Bf,this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(t)do{this.removeListener(e,t[t.length-1])}while(t[0]);return this},_f.prototype.listeners=function(e){var t,r=this._events;return r&&(t=r[e])?"function"==typeof t?[t.listener||t]:function(e){for(var t=Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(t):[]},_f.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):Hf.call(e,t)},_f.prototype.listenerCount=Hf,_f.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};var Yf=window.RTCPeerConnection,Jf=window.RTCIceCandidate,Kf=window.RTCSessionDescription;class b extends _f{constructor(e){super(),jf(this,"pc",void 0),this.pc=new Yf({iceServers:e}),"ontrack"in this.pc?this.pc.ontrack=this.handleTrackEvent.bind(this):this.pc.onaddstream=this.handleNewStreamEvent.bind(this)}getPeerConnection(){return this.pc}close(){this.pc.close()}setRemoteDescription(e){return this.pc.setRemoteDescription(new Kf(e))}setLocalDescription(e){return this.pc.setLocalDescription(new Kf(e))}createAnswer(){var e=this;return Nf((function*(){return e.pc.createAnswer()}))()}createOffer(){var e=this;return Nf((function*(){return e.pc.createOffer()}))()}attachIceCandidate(e){return this.pc.addIceCandidate(new Jf(e))}attachMediaStream(e){var t=this.pc,r=t.getSenders(),n=e.getTracks();r.length?n.forEach(e=>{r.filter(t=>{var r;return(null===(r=t.track)||void 0===r?void 0:r.kind)===e.kind}).forEach(t=>{t.replaceTrack(e)})}):n.forEach(r=>{t.addTrack(r,e)})}handleNewStreamEvent(e){var{stream:t}=e;this.emit("addstream",t)}handleTrackEvent(e){e.streams.forEach(e=>{this.emit("addstream",e)})}}class C{constructor(e,t,r){this.url=e,this.streamInfo=t,this.userData=r,jf(this,"ws",null),jf(this,"pendingCommands",new Map)}connect(){return this.ws?Promise.resolve(this.ws):new Promise((e,t)=>{var r=new WebSocket(this.url);r.binaryType="arraybuffer",r.onopen=()=>e(r),r.onerror=()=>t(),r.onclose=()=>t(),r.onmessage=this.handleSocketData.bind(this),this.ws=r})}disconnect(){this.ws&&(this.ws.close(),this.ws=null)}getOffer(){var e={direction:"play",command:"getOffer"};return this.streamInfo.secureToken&&(e.secureToken=this.streamInfo.secureToken),this.send(e)}sendOffer(e){return this.send({direction:"publish",command:"sendOffer",sdp:e})}sendResponse(e){return this.send({direction:"play",command:"sendResponse",sdp:e})}getAvailableStreams(){return this.send({direction:"play",command:"getAvailableStreams"})}send(e){var t=this;return Nf((function*(){var r,n=t.ws||(yield t.connect());return t.pendingCommands.has(e.command)||t.pendingCommands.set(e.command,((r={}).promise=new Promise((e,t)=>{r.resolve=e,r.reject=t}),r)),n.send(JSON.stringify(Df(Df({},e),{},{streamInfo:t.streamInfo,userData:t.userData}))),t.pendingCommands.get(e.command).promise}))()}handleSocketData(e){var t,r=JSON.parse(e.data);200===r.status?(null!==(t=r.streamInfo)&&void 0!==t&&t.sessionId&&(this.streamInfo.sessionId=r.streamInfo.sessionId),this.pendingCommands.has(r.command)&&(this.pendingCommands.get(r.command).resolve(r),this.pendingCommands.delete(r.command))):this.pendingCommands.has(r.command)&&(this.pendingCommands.get(r.command).reject(r),this.pendingCommands.delete(r.command))}}var Zf="mozGetUserMedia"in navigator?"firefox":"webkitGetUserMedia"in navigator||!1===window.isSecureContext&&"webkitRTCPeerConnection"in window&&!("RTCIceGatherer"in window)?"chrome":navigator.mediaDevices&&navigator.userAgent.match(/Edge\/(\d+).(\d+)$/)?"edge":window.RTCPeerConnection&&navigator.userAgent.match(/AppleWebKit\/(\d+)\./)?"safari":"unknown",Qf=["vp9","vp8","h264","red","ulpfec","rtx"],ep=["opus","isac","g722","pcmu","pcma","cn"];class S{constructor(e,t){this.videoOptions=e,this.audioOptions=t,jf(this,"audioIndex",-1),jf(this,"videoIndex",-1)}transformPlay(e){return e.sdp?(e.sdp=e.sdp.replace(/profile-level-id=(\w+)/gi,(e,t)=>{var r=parseInt(t,16),n=r>>16&255,i=r>>8&255,o=255&r;return n>66?(n=66,i=224,o=31):0===i&&(i=224),"profile-level-id=".concat((n<<16|i<<8|o).toString(16))}),e):e}transformPublish(e){var t=this.prepareSDP(e),r=this.videoOptions,n=this.audioOptions,i=null,o=()=>"m=audio"===i?n:"m=video"===i?r:null,s=t.filter(Boolean).map(e=>{var[t]=e.split(/\s|:/,1);switch(t){case"m=audio":case"m=video":var s="m=audio"===t?this.audioIndex:this.videoIndex;if(-1!==s&&"chrome"===Zf){var[a,c,u]=e.split(" ");return"".concat(a," ").concat(c," ").concat(u," ").concat(s)}i=t;break;case"a=rtpmap":var l=/^a=rtpmap:(\d+)\s+(\w+)\/(\d+)/.exec(e);if(!l||"chrome"!==Zf)break;var d=l[2].toLowerCase();r.bitRate&&Qf.includes(d)&&(e+="\r\na=fmtp:".concat(l[1]," x-google-min-bitrate=").concat(r.bitRate,";x-google-max-bitrate=").concat(r.bitRate)),n.bitRate&&ep.includes(d)&&(e+="\r\na=fmtp:".concat(l[1]," x-google-min-bitrate=").concat(n.bitRate,";x-google-max-bitrate=").concat(n.bitRate));break;case"c=IN":var f=o();if(null!=f&&f.bitRate&&["firefox","safari"].includes(Zf)){var p=1e3*f.bitRate;e+="\r\nb=TIAS:".concat(.95*p-16e3),e+="\r\nb=AS:".concat(p),e+="\r\nb=CT:".concat(p)}break;case"a=mid":var h=o();h&&"chrome"===Zf&&(h.bitRate&&(e+="\r\nb=CT:".concat(h.bitRate),e+="\r\nb=AS:".concat(h.bitRate),"frameRate"in h&&h.frameRate&&(e+="\r\na=framerate:".concat(h.frameRate.toFixed(2)))),i=null)}return e}).join("\r\n")+"\r\n";return{type:e.type,sdp:s}}checkLine(e,t){if(/^a=(rtpmap|rtcp-fb|fmtp)/.test(e)){var r=e.split(":");if(r.length>1){var[n,i]=r[1].split(" ");if(!i.startsWith("http")&&!i.startsWith("ur")){var o=parseInt(n,10),s=t.get(o)||[];return s.push(e),t.set(o,s),!1}}}return!0}deliverCheckLine(e,t,r){var n=Array.from(r).find(t=>{var[,r]=t;return r.join("\r\n").includes(e)});if(!n)return[];var[i,o]=n;return"audio"===t?this.audioIndex=i:this.videoIndex=i,"VP8"!==e&&"VP9"!==e?o:o.filter(e=>!e.includes("transport-cc")&&!e.includes("goog-remb")&&!e.includes("nack"))}addAudio(e,t){for(var r="",n=0,i=e.length;n<i;++n){var o=e[n];if(o.startsWith("m=audio"))r="audio";else if(o.startsWith("m=video"))r="video";else if("a=rtcp-mux"===o&&"audio"===r){var s=this.deliverCheckLine(this.audioOptions.codec,"audio",t);e.splice(n+1,0,...s);break}}return e}addVideo(e,t){var r=e.includes("a=rtcp-rsize"),n=e.includes("a=rtcp-mux"),i=!1;if(!r&&!n)return e;var o=this.deliverCheckLine(this.videoOptions.codec,"video",t);return e.map(e=>{if(r){if(!i&&"a=rtcp-rsize"===e)return i=!0,[e].concat(o).join("\r\n")}else if("a=rtcp-mux"===e){if(i)return[e].concat(o).join("\r\n");i=!0}return e})}flattenLines(e){return e.join("\r\n").split("\r\n")}prepareSDP(e){var t=new Map,r=(e.sdp||"").split(/\r\n/);return r=r.filter(e=>e&&this.checkLine(e,t)),r=this.flattenLines(this.addAudio(r,t)),this.flattenLines(this.addVideo(r,t))}}class x extends _f{constructor(e,t){super(),this.video=e,jf(this,"sdpUrl",""),jf(this,"applicationName",""),jf(this,"streamName",""),jf(this,"userData",null),jf(this,"sdpHandler",void 0),jf(this,"secureToken",void 0),jf(this,"constraints",{audio:!0,video:!0}),jf(this,"videoConfigs",{bitRate:360,codec:"42e01f",frameRate:29.97}),jf(this,"audioConfigs",{codec:"opus",bitRate:64}),jf(this,"iceServers",[]),jf(this,"mediaStream",null),jf(this,"pc",null),t&&this.setConfigurations(t)}setConfigurations(e){e.constraints&&(this.constraints=e.constraints),e.videoConfigs&&(this.videoConfigs=e.videoConfigs),e.audioConfigs&&(this.audioConfigs=e.audioConfigs),e.applicationName&&(this.applicationName=e.applicationName),e.streamName&&(this.streamName=e.streamName),e.sdpUrl&&(this.sdpUrl=e.sdpUrl),void 0!==e.userData&&(this.userData=e.userData),e.iceServers&&(this.iceServers=e.iceServers),e.sdpHandler&&(this.sdpHandler=e.sdpHandler),e.secureToken&&(this.secureToken=e.secureToken)}stop(){this.pc&&(this.pc.close(),this.pc=null)}getMediaStream(){return this.mediaStream}getPeerConnection(){return this.pc?this.pc.getPeerConnection():null}playLocal(e){var t=this;return Nf((function*(){e&&(t.constraints=e);var r=yield function(e){var t;return null!==(t=navigator.mediaDevices)&&void 0!==t&&t.getUserMedia?navigator.mediaDevices.getUserMedia(e):"getUserMedia"in navigator?new Promise((t,r)=>{navigator.getUserMedia(e,t,r)}):Promise.reject("Your browser does not support getUserMedia API")}(t.constraints);return t.attachStream(r),r}))()}stopLocal(){this.stop(),this.mediaStream&&(this.mediaStream.getTracks().forEach(e=>{e.stop()}),this.mediaStream=null)}playRemote(e){var t=this;return Nf((function*(){e&&t.setConfigurations(e);var r=t.createWowzaInstance();try{var{sdp:n}=yield r.getOffer(),i=t.createPeerConnection();i.on("addstream",t.attachStream.bind(t)),yield i.setRemoteDescription(n);var o=yield i.createAnswer(),s=new S(t.videoConfigs,t.audioConfigs),a=t.sdpHandler?t.sdpHandler(o,e=>s.transformPlay(e),"play"):s.transformPlay(o);yield i.setLocalDescription(a);var{iceCandidates:c}=yield r.sendResponse(a);c.forEach(e=>{i.attachIceCandidate(e)})}finally{r.disconnect()}}))()}publish(e){var t=this;return Nf((function*(){e&&t.setConfigurations(e);var r=t.createWowzaInstance();try{var n=t.mediaStream||(yield t.playLocal()),i=t.createPeerConnection();i.attachMediaStream(n);var o=new S(t.videoConfigs,t.audioConfigs),s=yield i.createOffer(),a=t.sdpHandler?t.sdpHandler(s,e=>o.transformPublish(e),"publish"):o.transformPublish(s);yield i.setLocalDescription(a);var{sdp:c,iceCandidates:u}=yield r.sendOffer(a);yield i.setRemoteDescription(c),u.forEach(e=>{i.attachIceCandidate(e)})}finally{r.disconnect()}}))()}getAvailableStreams(){var e=this;return Nf((function*(){var t=e.createWowzaInstance();try{var{availableStreams:r}=yield t.getAvailableStreams();return r||[]}catch(e){return[]}finally{t.disconnect()}}))()}createWowzaInstance(){return new C(this.sdpUrl,{applicationName:this.applicationName,sessionId:"[empty]",streamName:this.streamName,secureToken:this.secureToken},this.userData)}createPeerConnection(){return this.pc=new b(this.iceServers),this.pc}attachStream(e){this.mediaStream=e;try{var t=this.video.srcObject instanceof MediaStream&&this.video.srcObject;t&&t.id===e.id||(this.video.srcObject=e)}catch(t){this.video.src=window.URL.createObjectURL(e)}this.pc&&this.pc.attachMediaStream(e),this.video.play()}}class WowzaWebRTCAdapter{constructor(e,r,n=t("rts/webrtc")){this.player=e,this.src=r,this.log=n}static wants(e){return e.type==WowzaWebRTCAdapter.Type}async load(){this.log("loading",this.src.streamName),this.engine=new x(this.player,this.src),await this.engine.playRemote()}async stop(){var e;await(null===(e=this.engine)||void 0===e?void 0:e.stop())}}WowzaWebRTCAdapter.Events={ACTIVE:"rts/wowza-webrtc/active",INACTIVE:"rts/webrtc/inactive"},WowzaWebRTCAdapter.Type="wowza/webrtc";class RTSLoader{constructor(){this.log=t("rts"),console.log("warning / the realtime plugin is in beta release")}init(e,t,r){r.on("reap",()=>{var e;return null===(e=this.engine)||void 0===e?void 0:e.stop()})}onload(e,t,r,n){var i;switch(n.type){case MillicastAdapter.Type:this.engine=new MillicastAdapter(r,n);break;case WowzaWebRTCAdapter.Type:this.engine=new WowzaWebRTCAdapter(r,n)}null===(i=this.engine)||void 0===i||i.load()}wants(e,t,r){return"string"==typeof t.type&&(MillicastAdapter.wants(t)||WowzaWebRTCAdapter.wants(t))}}return RTSLoader.events={},function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;if(null===document.currentScript)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});const r=e.flowplayer;"function"==typeof r?r(t):(Array.isArray(r.extensions)||(r.extensions=[]),~r.extensions.indexOf(t)||r.extensions.push(t))}(window,RTSLoader),RTSLoader}));
|