@flowplayer/player 3.4.3 → 3.4.4-rc.1

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/plugins/id3.js CHANGED
@@ -1 +1 @@
1
- !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.id3=n())}(this,(function(){"use strict";var e=Object.freeze({__proto__:null,ID3:"ID3"});class ID3{init(e,n,t){t.textTracks.addEventListener("addtrack",({track:e})=>{if(e&&"metadata"===e.kind)return"id3"==e.id||"id3"==e.label?function(e,n){n.addEventListener("cuechange",async()=>{Array.from(n.activeCues||[]).forEach(async n=>{(function(e){return"object"==typeof e.value&&"string"==typeof e.value.info&&"string"==typeof e.value.key&&!!e.value.data})(n)&&e.emit("ID3",{cue:n})})})}(t,e):void 0})}}return ID3.events=e,function(e,n){if("object"==typeof exports&&"undefined"!=typeof module)return n;"flowplayer"in e||(e.flowplayer={extensions:[]});const t=e.flowplayer;"function"==typeof t?t(n):(Array.isArray(t.extensions)||(t.extensions=[]),~t.extensions.indexOf(n)||t.extensions.push(n))}(window,ID3),ID3}));
1
+ !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.id3=n())}(this,(function(){"use strict";var e=Object.freeze({__proto__:null,ID3:"ID3"});class ID3{init(e,n,t){t.textTracks.addEventListener("addtrack",({track:e})=>{if(e&&"metadata"===e.kind)return"id3"==e.id||"id3"==e.label?function(e,n){n.addEventListener("cuechange",async()=>{Array.from(n.activeCues||[]).forEach(async n=>{(function(e){return"object"==typeof e.value&&"string"==typeof e.value.key&&!!e.value.data})(n)&&e.emit("ID3",{cue:n})})})}(t,e):void 0})}}return ID3.events=e,function(e,n){if("object"==typeof exports&&"undefined"!=typeof module)return n;"flowplayer"in e||(e.flowplayer={extensions:[]});const t=e.flowplayer;"function"==typeof t?t(n):(Array.isArray(t.extensions)||(t.extensions=[]),~t.extensions.indexOf(n)||t.extensions.push(n))}(window,ID3),ID3}));
@@ -0,0 +1 @@
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.millicast=t())}(this,(function(){"use strict";var e="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function t(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}var n=t,i=r;function o(e){if(n===setTimeout)return setTimeout(e,0);if((n===t||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}"function"==typeof e.setTimeout&&(n=setTimeout),"function"==typeof e.clearTimeout&&(i=clearTimeout);var s,a=[],c=!1,u=-1;function l(){c&&s&&(c=!1,s.length?a=s.concat(a):u=-1,a.length&&d())}function d(){if(!c){var e=o(l);c=!0;for(var t=a.length;t;){for(s=a,a=[];++u<t;)s&&s[u].run();u=-1,t=a.length}s=null,c=!1,function(e){if(i===clearTimeout)return clearTimeout(e);if((i===r||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(e);try{i(e)}catch(t){try{return i.call(null,e)}catch(t){return i.call(this,e)}}}(e)}}function f(e,t){this.fun=e,this.array=t}f.prototype.run=function(){this.fun.apply(null,this.array)};function p(){}var h=p,m=p,g=p,v=p,y=p,b=p,w=p;var S=e.performance||{},x=S.now||S.mozNow||S.msNow||S.oNow||S.webkitNow||function(){return(new Date).getTime()};var C=new Date;var E={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];a.push(new f(e,t)),1!==a.length||c||o(d)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:h,addListener:m,once:g,off:v,removeListener:y,removeAllListeners:b,emit:w,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*x.call(S),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-C)/1e3}};function I(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 T(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?I(Object(r),!0).forEach((function(t){A(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):I(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function R(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 P(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function s(e){R(o,n,i,s,a,"next",e)}function a(e){R(o,n,i,s,a,"throw",e)}s(void 0)}))}}function A(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function k(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)||O(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 O(e,t){if(e){if("string"==typeof e)return L(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)?L(e,t):void 0}}function L(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 D(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=O(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 M="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{};function N(e){var t={exports:{}};return e(t,t.exports),t.exports}var j,B,_=function(e){return e&&e.Math==Math&&e},U=_("object"==typeof globalThis&&globalThis)||_("object"==typeof window&&window)||_("object"==typeof self&&self)||_("object"==typeof M&&M)||function(){return this}()||Function("return this")(),F=function(e){try{return!!e()}catch(e){return!0}},V=!F((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),z=!F((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),G=Function.prototype.call,q=z?G.bind(G):function(){return G.apply(G,arguments)},X={}.propertyIsEnumerable,W=Object.getOwnPropertyDescriptor,H={f:W&&!X.call({1:2},1)?function(e){var t=W(this,e);return!!t&&t.enumerable}:X},Y=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},K=Function.prototype,Q=K.bind,J=K.call,Z=z&&Q.bind(J,J),ee=z?function(e){return e&&Z(e)}:function(e){return e&&function(){return J.apply(e,arguments)}},te=ee({}.toString),re=ee("".slice),ne=function(e){return re(te(e),8,-1)},ie=Object,oe=ee("".split),se=F((function(){return!ie("z").propertyIsEnumerable(0)}))?function(e){return"String"==ne(e)?oe(e,""):ie(e)}:ie,ae=function(e){return null==e},ce=TypeError,ue=function(e){if(ae(e))throw ce("Can't call method on "+e);return e},le=function(e){return se(ue(e))},de="object"==typeof document&&document.all,fe={all:de,IS_HTMLDDA:void 0===de&&void 0!==de},pe=fe.all,he=fe.IS_HTMLDDA?function(e){return"function"==typeof e||e===pe}:function(e){return"function"==typeof e},me=fe.all,ge=fe.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:he(e)||e===me}:function(e){return"object"==typeof e?null!==e:he(e)},ve=function(e){return he(e)?e:void 0},ye=function(e,t){return arguments.length<2?ve(U[e]):U[e]&&U[e][t]},be=ee({}.isPrototypeOf),we=ye("navigator","userAgent")||"",Se=U.process,xe=U.Deno,Ce=Se&&Se.versions||xe&&xe.version,Ee=Ce&&Ce.v8;Ee&&(B=(j=Ee.split("."))[0]>0&&j[0]<4?1:+(j[0]+j[1])),!B&&we&&(!(j=we.match(/Edge\/(\d+)/))||j[1]>=74)&&(j=we.match(/Chrome\/(\d+)/))&&(B=+j[1]);var Ie=B,Te=!!Object.getOwnPropertySymbols&&!F((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&Ie&&Ie<41})),Re=Te&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Pe=Object,Ae=Re?function(e){return"symbol"==typeof e}:function(e){var t=ye("Symbol");return he(t)&&be(t.prototype,Pe(e))},ke=String,Oe=function(e){try{return ke(e)}catch(e){return"Object"}},Le=TypeError,De=function(e){if(he(e))return e;throw Le(Oe(e)+" is not a function")},Me=function(e,t){var r=e[t];return ae(r)?void 0:De(r)},Ne=TypeError,je=Object.defineProperty,Be=function(e,t){try{je(U,e,{value:t,configurable:!0,writable:!0})}catch(r){U[e]=t}return t},_e=U["__core-js_shared__"]||Be("__core-js_shared__",{}),Ue=N((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"})})),Fe=Object,Ve=function(e){return Fe(ue(e))},ze=ee({}.hasOwnProperty),$e=Object.hasOwn||function(e,t){return ze(Ve(e),t)},Ge=0,qe=Math.random(),Xe=ee(1..toString),We=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Xe(++Ge+qe,36)},He=Ue("wks"),Ye=U.Symbol,Ke=Ye&&Ye.for,Qe=Re?Ye:Ye&&Ye.withoutSetter||We,Je=function(e){if(!$e(He,e)||!Te&&"string"!=typeof He[e]){var t="Symbol."+e;Te&&$e(Ye,e)?He[e]=Ye[e]:He[e]=Re&&Ke?Ke(t):Qe(t)}return He[e]},Ze=TypeError,et=Je("toPrimitive"),tt=function(e){var t=function(e,t){if(!ge(e)||Ae(e))return e;var r,n=Me(e,et);if(n){if(void 0===t&&(t="default"),r=q(n,e,t),!ge(r)||Ae(r))return r;throw Ze("Can't convert object to primitive value")}return void 0===t&&(t="number"),function(e,t){var r,n;if("string"===t&&he(r=e.toString)&&!ge(n=q(r,e)))return n;if(he(r=e.valueOf)&&!ge(n=q(r,e)))return n;if("string"!==t&&he(r=e.toString)&&!ge(n=q(r,e)))return n;throw Ne("Can't convert object to primitive value")}(e,t)}(e,"string");return Ae(t)?t:t+""},rt=U.document,nt=ge(rt)&&ge(rt.createElement),it=function(e){return nt?rt.createElement(e):{}},ot=!V&&!F((function(){return 7!=Object.defineProperty(it("div"),"a",{get:function(){return 7}}).a})),st=Object.getOwnPropertyDescriptor,at={f:V?st:function(e,t){if(e=le(e),t=tt(t),ot)try{return st(e,t)}catch(e){}if($e(e,t))return Y(!q(H.f,e,t),e[t])}},ct=V&&F((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),ut=String,lt=TypeError,dt=function(e){if(ge(e))return e;throw lt(ut(e)+" is not an object")},ft=TypeError,pt=Object.defineProperty,ht=Object.getOwnPropertyDescriptor,mt={f:V?ct?function(e,t,r){if(dt(e),t=tt(t),dt(r),"function"==typeof e&&"prototype"===t&&"value"in r&&"writable"in r&&!r.writable){var n=ht(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 pt(e,t,r)}:pt:function(e,t,r){if(dt(e),t=tt(t),dt(r),ot)try{return pt(e,t,r)}catch(e){}if("get"in r||"set"in r)throw ft("Accessors not supported");return"value"in r&&(e[t]=r.value),e}},gt=V?function(e,t,r){return mt.f(e,t,Y(1,r))}:function(e,t,r){return e[t]=r,e},vt=Function.prototype,yt=V&&Object.getOwnPropertyDescriptor,bt=$e(vt,"name"),wt={EXISTS:bt,PROPER:bt&&"something"===function(){}.name,CONFIGURABLE:bt&&(!V||V&&yt(vt,"name").configurable)},St=ee(Function.toString);he(_e.inspectSource)||(_e.inspectSource=function(e){return St(e)});var xt,Ct,Et,It=_e.inspectSource,Tt=U.WeakMap,Rt=he(Tt)&&/native code/.test(String(Tt)),Pt=Ue("keys"),At=function(e){return Pt[e]||(Pt[e]=We(e))},kt={},Ot=U.TypeError,Lt=U.WeakMap;if(Rt||_e.state){var Dt=_e.state||(_e.state=new Lt),Mt=ee(Dt.get),Nt=ee(Dt.has),jt=ee(Dt.set);xt=function(e,t){if(Nt(Dt,e))throw Ot("Object already initialized");return t.facade=e,jt(Dt,e,t),t},Ct=function(e){return Mt(Dt,e)||{}},Et=function(e){return Nt(Dt,e)}}else{var Bt=At("state");kt[Bt]=!0,xt=function(e,t){if($e(e,Bt))throw Ot("Object already initialized");return t.facade=e,gt(e,Bt,t),t},Ct=function(e){return $e(e,Bt)?e[Bt]:{}},Et=function(e){return $e(e,Bt)}}var _t={set:xt,get:Ct,has:Et,enforce:function(e){return Et(e)?Ct(e):xt(e,{})},getterFor:function(e){return function(t){var r;if(!ge(t)||(r=Ct(t)).type!==e)throw Ot("Incompatible receiver, "+e+" required");return r}}},Ut=N((function(e){var t=wt.CONFIGURABLE,r=_t.enforce,n=_t.get,i=Object.defineProperty,o=V&&!F((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),(!$e(e,"name")||t&&e.name!==n)&&(V?i(e,"name",{value:n,configurable:!0}):e.name=n),o&&a&&$e(a,"arity")&&e.length!==a.arity&&i(e,"length",{value:a.arity});try{a&&$e(a,"constructor")&&a.constructor?V&&i(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var c=r(e);return $e(c,"source")||(c.source=s.join("string"==typeof n?n:"")),e};Function.prototype.toString=a((function(){return he(this)&&n(this).source||It(this)}),"toString")})),Ft=function(e,t,r,n){n||(n={});var i=n.enumerable,o=void 0!==n.name?n.name:t;if(he(r)&&Ut(r,o,n),n.global)i?e[t]=r:Be(t,r);else{try{n.unsafe?e[t]&&(i=!0):delete e[t]}catch(e){}i?e[t]=r:mt.f(e,t,{value:r,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return e},Vt=Math.ceil,zt=Math.floor,$t=Math.trunc||function(e){var t=+e;return(t>0?zt:Vt)(t)},Gt=function(e){var t=+e;return t!=t||0===t?0:$t(t)},qt=Math.max,Xt=Math.min,Wt=function(e,t){var r=Gt(e);return r<0?qt(r+t,0):Xt(r,t)},Ht=Math.min,Yt=function(e){return e>0?Ht(Gt(e),9007199254740991):0},Kt=function(e){return Yt(e.length)},Qt=function(e){return function(t,r,n){var i,o=le(t),s=Kt(o),a=Wt(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}},Jt={includes:Qt(!0),indexOf:Qt(!1)},Zt=Jt.indexOf,er=ee([].push),tr=function(e,t){var r,n=le(e),i=0,o=[];for(r in n)!$e(kt,r)&&$e(n,r)&&er(o,r);for(;t.length>i;)$e(n,r=t[i++])&&(~Zt(o,r)||er(o,r));return o},rr=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],nr=rr.concat("length","prototype"),ir={f:Object.getOwnPropertyNames||function(e){return tr(e,nr)}},or={f:Object.getOwnPropertySymbols},sr=ee([].concat),ar=ye("Reflect","ownKeys")||function(e){var t=ir.f(dt(e)),r=or.f;return r?sr(t,r(e)):t},cr=function(e,t,r){for(var n=ar(t),i=mt.f,o=at.f,s=0;s<n.length;s++){var a=n[s];$e(e,a)||r&&$e(r,a)||i(e,a,o(t,a))}},ur=/#|\.prototype\./,lr=function(e,t){var r=fr[dr(e)];return r==hr||r!=pr&&(he(t)?F(t):!!t)},dr=lr.normalize=function(e){return String(e).replace(ur,".").toLowerCase()},fr=lr.data={},pr=lr.NATIVE="N",hr=lr.POLYFILL="P",mr=lr,gr=at.f,vr=function(e,t){var r,n,i,o,s,a=e.target,c=e.global,u=e.stat;if(r=c?U:u?U[a]||Be(a,{}):(U[a]||{}).prototype)for(n in t){if(o=t[n],i=e.dontCallGetSet?(s=gr(r,n))&&s.value:r[n],!mr(c?n:a+(u?".":"#")+n,e.forced)&&void 0!==i){if(typeof o==typeof i)continue;cr(o,i)}(e.sham||i&&i.sham)&&gt(o,"sham",!0),Ft(r,n,o,e)}},yr=Array.isArray||function(e){return"Array"==ne(e)},br=TypeError,wr=function(e){if(e>9007199254740991)throw br("Maximum allowed index exceeded");return e},Sr=function(e,t,r){var n=tt(t);n in e?mt.f(e,n,Y(0,r)):e[n]=r},xr={};xr[Je("toStringTag")]="z";var Cr="[object z]"===String(xr),Er=Je("toStringTag"),Ir=Object,Tr="Arguments"==ne(function(){return arguments}()),Rr=Cr?ne: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=Ir(e),Er))?r:Tr?ne(t):"Object"==(n=ne(t))&&he(t.callee)?"Arguments":n},Pr=function(){},Ar=[],kr=ye("Reflect","construct"),Or=/^\s*(?:class|function)\b/,Lr=ee(Or.exec),Dr=!Or.exec(Pr),Mr=function(e){if(!he(e))return!1;try{return kr(Pr,Ar,e),!0}catch(e){return!1}},Nr=function(e){if(!he(e))return!1;switch(Rr(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Dr||!!Lr(Or,It(e))}catch(e){return!0}};Nr.sham=!0;var jr=!kr||F((function(){var e;return Mr(Mr.call)||!Mr(Object)||!Mr((function(){e=!0}))||e}))?Nr:Mr,Br=Je("species"),_r=Array,Ur=function(e,t){return new(function(e){var t;return yr(e)&&(t=e.constructor,(jr(t)&&(t===_r||yr(t.prototype))||ge(t)&&null===(t=t[Br]))&&(t=void 0)),void 0===t?_r:t}(e))(0===t?0:t)},Fr=Je("species"),Vr=function(e){return Ie>=51||!F((function(){var t=[];return(t.constructor={})[Fr]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},zr=Je("isConcatSpreadable"),$r=Ie>=51||!F((function(){var e=[];return e[zr]=!1,e.concat()[0]!==e})),Gr=Vr("concat"),qr=function(e){if(!ge(e))return!1;var t=e[zr];return void 0!==t?!!t:yr(e)};vr({target:"Array",proto:!0,arity:1,forced:!$r||!Gr},{concat:function(e){var t,r,n,i,o,s=Ve(this),a=Ur(s,0),c=0;for(t=-1,n=arguments.length;t<n;t++)if(qr(o=-1===t?s:arguments[t]))for(i=Kt(o),wr(c+i),r=0;r<i;r++,c++)r in o&&Sr(a,c,o[r]);else wr(c+1),Sr(a,c++,o);return a.length=c,a}});var Xr=ee([].slice),Wr=Vr("slice"),Hr=Je("species"),Yr=Array,Kr=Math.max;vr({target:"Array",proto:!0,forced:!Wr},{slice:function(e,t){var r,n,i,o=le(this),s=Kt(o),a=Wt(e,s),c=Wt(void 0===t?s:t,s);if(yr(o)&&(r=o.constructor,(jr(r)&&(r===Yr||yr(r.prototype))||ge(r)&&null===(r=r[Hr]))&&(r=void 0),r===Yr||void 0===r))return Xr(o,a,c);for(n=new(void 0===r?Yr:r)(Kr(c-a,0)),i=0;a<c;a++,i++)a in o&&Sr(n,i,o[a]);return n.length=i,n}});var Qr=ee(ee.bind),Jr=function(e,t){return De(e),void 0===t?e:z?Qr(e,t):function(){return e.apply(t,arguments)}},Zr=ee([].push),en=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=Ve(c),m=se(h),g=Jr(u,l),v=Kt(m),y=0,b=d||Ur,w=t?b(c,v):r||s?b(c,0):void 0;v>y;y++)if((a||y in m)&&(p=g(f=m[y],y,h),e))if(t)w[y]=p;else if(p)switch(e){case 3:return!0;case 5:return f;case 6:return y;case 2:Zr(w,f)}else switch(e){case 4:return!1;case 7:Zr(w,f)}return o?-1:n||i?i:w}},tn={forEach:en(0),map:en(1),filter:en(2),some:en(3),every:en(4),find:en(5),findIndex:en(6),filterReject:en(7)},rn=tn.map,nn=Vr("map");vr({target:"Array",proto:!0,forced:!nn},{map:function(e){return rn(this,e,arguments.length>1?arguments[1]:void 0)}});var on=Function.prototype,sn=on.apply,an=on.call,cn="object"==typeof Reflect&&Reflect.apply||(z?an.bind(sn):function(){return an.apply(sn,arguments)}),un=ye("JSON","stringify"),ln=ee(/./.exec),dn=ee("".charAt),fn=ee("".charCodeAt),pn=ee("".replace),hn=ee(1..toString),mn=/[\uD800-\uDFFF]/g,gn=/^[\uD800-\uDBFF]$/,vn=/^[\uDC00-\uDFFF]$/,yn=!Te||F((function(){var e=ye("Symbol")();return"[null]"!=un([e])||"{}"!=un({a:e})||"{}"!=un(Object(e))})),bn=F((function(){return'"\\udf06\\ud834"'!==un("\udf06\ud834")||'"\\udead"'!==un("\udead")})),wn=function(e,t){var r=Xr(arguments),n=t;if((ge(t)||void 0!==e)&&!Ae(e))return yr(t)||(t=function(e,t){if(he(n)&&(t=q(n,this,e,t)),!Ae(t))return t}),r[1]=t,cn(un,null,r)},Sn=function(e,t,r){var n=dn(r,t-1),i=dn(r,t+1);return ln(gn,e)&&!ln(vn,i)||ln(vn,e)&&!ln(gn,n)?"\\u"+hn(fn(e,0),16):e};un&&vr({target:"JSON",stat:!0,arity:3,forced:yn||bn},{stringify:function(e,t,r){var n=Xr(arguments),i=cn(yn?wn:un,null,n);return bn&&"string"==typeof i?pn(i,mn,Sn):i}});var xn=N((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)}(M)}));xn.useDefaults({defaultLevel:xn.TRACE});const Cn=(e,t)=>{e.unshift("[".concat(t.name||"Global","] ").concat((new Date).toISOString()," - ").concat(t.level.name," -"))},En=(e,t)=>t?e.value>=An[t].value:e.value>=Pn.value,In=xn.createDefaultHandler({formatter:Cn});xn.setHandler((e,t)=>{((e,t)=>{e=(e=Array.prototype.slice.call(e)).map(e=>"object"==typeof e?JSON.stringify(e):e),Cn(e,t),0!==Tn?(Rn.push(e.join(" ")),Rn.length>=Tn&&(Rn=Rn.slice(-Tn))):Rn=[]})(e,t),En(t.level,t.name)&&In(e,t);var r,n=D(kn);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 Tn=1e4,Rn=[],Pn=xn.OFF;const An={},kn=[],On=T(T({},xn),{},{enabledFor:En,getHistory:()=>Rn,getHistoryMaxSize:()=>Tn,setHistoryMaxSize:e=>{Tn=e},setLevel:e=>{Pn=e;for(const t in An)An[t]=e},getLevel:()=>Pn,get:e=>{An[e]||(An[e]=Pn);const t=xn.get(e);return t.setLevel=t=>{An[e]=t},t.getLevel=()=>An[e],t},setHandler:(e,t)=>{kn.push({handler:e,level:t})}});var Ln,Dn,Mn,Nn,jn="process"==ne(U.process),Bn=String,_n=TypeError,Un=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=ee(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(r,[]),t=r instanceof Array}catch(e){}return function(r,n){return dt(r),function(e){if("object"==typeof e||he(e))return e;throw _n("Can't set "+Bn(e)+" as a prototype")}(n),t?e(r,n):r.__proto__=n,r}}():void 0),Fn=mt.f,Vn=Je("toStringTag"),zn=function(e,t,r){e&&!r&&(e=e.prototype),e&&!$e(e,Vn)&&Fn(e,Vn,{configurable:!0,value:t})},$n=Je("species"),Gn=function(e){var t=ye(e),r=mt.f;V&&t&&!t[$n]&&r(t,$n,{configurable:!0,get:function(){return this}})},qn=TypeError,Xn=function(e,t){if(be(t,e))return e;throw qn("Incorrect invocation")},Wn=TypeError,Hn=Je("species"),Yn=function(e,t){var r,n=dt(e).constructor;return void 0===n||ae(r=dt(n)[Hn])?t:function(e){if(jr(e))return e;throw Wn(Oe(e)+" is not a constructor")}(r)},Kn=ye("document","documentElement"),Qn=TypeError,Jn=function(e,t){if(e<t)throw Qn("Not enough arguments");return e},Zn=/(?:ipad|iphone|ipod).*applewebkit/i.test(we),ei=U.setImmediate,ti=U.clearImmediate,ri=U.process,ni=U.Dispatch,ii=U.Function,oi=U.MessageChannel,si=U.String,ai=0,ci={};try{Ln=U.location}catch(I){}var ui=function(e){if($e(ci,e)){var t=ci[e];delete ci[e],t()}},li=function(e){return function(){ui(e)}},di=function(e){ui(e.data)},fi=function(e){U.postMessage(si(e),Ln.protocol+"//"+Ln.host)};ei&&ti||(ei=function(e){Jn(arguments.length,1);var t=he(e)?e:ii(e),r=Xr(arguments,1);return ci[++ai]=function(){cn(t,void 0,r)},Dn(ai),ai},ti=function(e){delete ci[e]},jn?Dn=function(e){ri.nextTick(li(e))}:ni&&ni.now?Dn=function(e){ni.now(li(e))}:oi&&!Zn?(Nn=(Mn=new oi).port2,Mn.port1.onmessage=di,Dn=Jr(Nn.postMessage,Nn)):U.addEventListener&&he(U.postMessage)&&!U.importScripts&&Ln&&"file:"!==Ln.protocol&&!F(fi)?(Dn=fi,U.addEventListener("message",di,!1)):Dn="onreadystatechange"in it("script")?function(e){Kn.appendChild(it("script")).onreadystatechange=function(){Kn.removeChild(this),ui(e)}}:function(e){setTimeout(li(e),0)});var pi,hi,mi,gi,vi,yi,bi,wi,Si={set:ei,clear:ti},xi=/ipad|iphone|ipod/i.test(we)&&void 0!==U.Pebble,Ci=/web0s(?!.*chrome)/i.test(we),Ei=at.f,Ii=Si.set,Ti=U.MutationObserver||U.WebKitMutationObserver,Ri=U.document,Pi=U.process,Ai=U.Promise,ki=Ei(U,"queueMicrotask"),Oi=ki&&ki.value;Oi||(pi=function(){var e,t;for(jn&&(e=Pi.domain)&&e.exit();hi;){t=hi.fn,hi=hi.next;try{t()}catch(e){throw hi?gi():mi=void 0,e}}mi=void 0,e&&e.enter()},Zn||jn||Ci||!Ti||!Ri?!xi&&Ai&&Ai.resolve?((bi=Ai.resolve(void 0)).constructor=Ai,wi=Jr(bi.then,bi),gi=function(){wi(pi)}):jn?gi=function(){Pi.nextTick(pi)}:(Ii=Jr(Ii,U),gi=function(){Ii(pi)}):(vi=!0,yi=Ri.createTextNode(""),new Ti(pi).observe(yi,{characterData:!0}),gi=function(){yi.data=vi=!vi}));var Li=Oi||function(e){var t={fn:e,next:void 0};mi&&(mi.next=t),hi||(hi=t,gi()),mi=t},Di=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},Mi=function(){this.head=null,this.tail=null};Mi.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 Ni=Mi,ji=U.Promise,Bi="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,_i=!Bi&&!jn&&"object"==typeof window&&"object"==typeof document;ji&&ji.prototype;var Ui,Fi,Vi,zi=Je("species"),$i=!1,Gi=he(U.PromiseRejectionEvent),qi={CONSTRUCTOR:mr("Promise",(function(){var e=It(ji),t=e!==String(ji);if(!t&&66===Ie)return!0;if(!Ie||Ie<51||!/native code/.test(e)){var r=new ji((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};if((r.constructor={})[zi]=n,!($i=r.then((function(){}))instanceof n))return!0}return!t&&(_i||Bi)&&!Gi})),REJECTION_EVENT:Gi,SUBCLASSING:$i},Xi=TypeError,Wi=function(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw Xi("Bad Promise constructor");t=e,r=n})),this.resolve=De(t),this.reject=De(r)},Hi={f:function(e){return new Wi(e)}},Yi=Si.set,Ki=qi.CONSTRUCTOR,Qi=qi.REJECTION_EVENT,Ji=qi.SUBCLASSING,Zi=_t.getterFor("Promise"),eo=_t.set,to=ji&&ji.prototype,ro=ji,no=to,io=U.TypeError,oo=U.document,so=U.process,ao=Hi.f,co=ao,uo=!!(oo&&oo.createEvent&&U.dispatchEvent),lo=function(e){var t;return!(!ge(e)||!he(t=e.then))&&t},fo=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&&vo(t),t.rejection=1),!0===a?r=o:(l&&l.enter(),r=a(o),l&&(l.exit(),i=!0)),r===e.promise?u(io("Promise-chain cycle")):(n=lo(r))?q(n,r,c,u):c(r)):u(o)}catch(e){l&&!i&&l.exit(),u(e)}},po=function(e,t){e.notified||(e.notified=!0,Li((function(){for(var r,n=e.reactions;r=n.get();)fo(r,e);e.notified=!1,t&&!e.rejection&&mo(e)})))},ho=function(e,t,r){var n,i;uo?((n=oo.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),U.dispatchEvent(n)):n={promise:t,reason:r},!Qi&&(i=U["on"+e])?i(n):"unhandledrejection"===e&&function(e,t){var r=U.console;r&&r.error&&(1==arguments.length?r.error(e):r.error(e,t))}("Unhandled promise rejection",r)},mo=function(e){q(Yi,U,(function(){var t,r=e.facade,n=e.value;if(go(e)&&(t=Di((function(){jn?so.emit("unhandledRejection",n,r):ho("unhandledrejection",r,n)})),e.rejection=jn||go(e)?2:1,t.error))throw t.value}))},go=function(e){return 1!==e.rejection&&!e.parent},vo=function(e){q(Yi,U,(function(){var t=e.facade;jn?so.emit("rejectionHandled",t):ho("rejectionhandled",t,e.value)}))},yo=function(e,t,r){return function(n){e(t,n,r)}},bo=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,po(e,!0))},wo=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw io("Promise can't be resolved itself");var n=lo(t);n?Li((function(){var r={done:!1};try{q(n,t,yo(wo,r,e),yo(bo,r,e))}catch(t){bo(r,t,e)}})):(e.value=t,e.state=1,po(e,!1))}catch(t){bo({done:!1},t,e)}}};if(Ki&&(no=(ro=function(e){Xn(this,no),De(e),q(Ui,this);var t=Zi(this);try{e(yo(wo,t),yo(bo,t))}catch(e){bo(t,e)}}).prototype,(Ui=function(e){eo(this,{type:"Promise",done:!1,notified:!1,parent:!1,reactions:new Ni,rejection:!1,state:0,value:void 0})}).prototype=Ft(no,"then",(function(e,t){var r=Zi(this),n=ao(Yn(this,ro));return r.parent=!0,n.ok=!he(e)||e,n.fail=he(t)&&t,n.domain=jn?so.domain:void 0,0==r.state?r.reactions.add(n):Li((function(){fo(n,r)})),n.promise})),Fi=function(){var e=new Ui,t=Zi(e);this.promise=e,this.resolve=yo(wo,t),this.reject=yo(bo,t)},Hi.f=ao=function(e){return e===ro||void 0===e?new Fi(e):co(e)},he(ji)&&to!==Object.prototype)){Vi=to.then,Ji||Ft(to,"then",(function(e,t){var r=this;return new ro((function(e,t){q(Vi,r,e,t)})).then(e,t)}),{unsafe:!0});try{delete to.constructor}catch(I){}Un&&Un(to,no)}vr({global:!0,constructor:!0,wrap:!0,forced:Ki},{Promise:ro}),zn(ro,"Promise",!1),Gn("Promise");var So={},xo=Je("iterator"),Co=Array.prototype,Eo=function(e){return void 0!==e&&(So.Array===e||Co[xo]===e)},Io=Je("iterator"),To=function(e){if(!ae(e))return Me(e,Io)||Me(e,"@@iterator")||So[Rr(e)]},Ro=TypeError,Po=function(e,t){var r=arguments.length<2?To(e):t;if(De(r))return dt(q(r,e));throw Ro(Oe(e)+" is not iterable")},Ao=function(e,t,r){var n,i;dt(e);try{if(!(n=Me(e,"return"))){if("throw"===t)throw r;return r}n=q(n,e)}catch(e){i=!0,n=e}if("throw"===t)throw r;if(i)throw n;return dt(n),r},ko=TypeError,Oo=function(e,t){this.stopped=e,this.result=t},Lo=Oo.prototype,Do=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=Jr(t,l),g=function(e){return n&&Ao(n,"normal",e),new Oo(!0,e)},v=function(e){return d?(dt(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=To(e)))throw ko(Oe(e)+" is not iterable");if(Eo(i)){for(o=0,s=Kt(e);s>o;o++)if((a=v(e[o]))&&be(Lo,a))return a;return new Oo(!1)}n=Po(e,i)}for(c=f?e.next:n.next;!(u=q(c,n)).done;){try{a=v(u.value)}catch(e){Ao(n,"throw",e)}if("object"==typeof a&&a&&be(Lo,a))return a}return new Oo(!1)},Mo=Je("iterator"),No=!1;try{var jo=0,Bo={next:function(){return{done:!!jo++}},return:function(){No=!0}};Bo[Mo]=function(){return this},Array.from(Bo,(function(){throw 2}))}catch(I){}var _o=function(e,t){if(!t&&!No)return!1;var r=!1;try{var n={};n[Mo]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(e){}return r},Uo=qi.CONSTRUCTOR||!_o((function(e){ji.all(e).then(void 0,(function(){}))}));vr({target:"Promise",stat:!0,forced:Uo},{all:function(e){var t=this,r=Hi.f(t),n=r.resolve,i=r.reject,o=Di((function(){var r=De(t.resolve),o=[],s=0,a=1;Do(e,(function(e){var c=s++,u=!1;a++,q(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 Fo=qi.CONSTRUCTOR,Vo=ji&&ji.prototype;if(vr({target:"Promise",proto:!0,forced:Fo,real:!0},{catch:function(e){return this.then(void 0,e)}}),he(ji)){var zo=ye("Promise").prototype.catch;Vo.catch!==zo&&Ft(Vo,"catch",zo,{unsafe:!0})}vr({target:"Promise",stat:!0,forced:Uo},{race:function(e){var t=this,r=Hi.f(t),n=r.reject,i=Di((function(){var i=De(t.resolve);Do(e,(function(e){q(i,t,e).then(r.resolve,n)}))}));return i.error&&n(i.value),r.promise}}),vr({target:"Promise",stat:!0,forced:qi.CONSTRUCTOR},{reject:function(e){var t=Hi.f(this);return q(t.reject,void 0,e),t.promise}});var $o=qi.CONSTRUCTOR;ye("Promise"),vr({target:"Promise",stat:!0,forced:$o},{resolve:function(e){return function(e,t){if(dt(e),ge(t)&&t.constructor===e)return t;var r=Hi.f(e);return(0,r.resolve)(t),r.promise}(this,e)}});var Go=mt.f,qo=function(e,t,r){r in e||Go(e,r,{configurable:!0,get:function(){return t[r]},set:function(e){t[r]=e}})},Xo=function(e,t,r){var n,i;return Un&&he(n=t.constructor)&&n!==r&&ge(i=n.prototype)&&i!==r.prototype&&Un(e,i),e},Wo=String,Ho=function(e){if("Symbol"===Rr(e))throw TypeError("Cannot convert a Symbol value to a string");return Wo(e)},Yo=function(e,t){return void 0===e?arguments.length<2?"":t:Ho(e)},Ko=function(e,t){ge(t)&&"cause"in t&&gt(e,"cause",t.cause)},Qo=Error,Jo=ee("".replace),Zo=String(Qo("zxcasd").stack),es=/\n\s*at [^:]*:[^\n]*/,ts=es.test(Zo),rs=function(e,t){if(ts&&"string"==typeof e&&!Qo.prepareStackTrace)for(;t--;)e=Jo(e,es,"");return e},ns=!F((function(){var e=Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",Y(1,7)),7!==e.stack)})),is=function(e,t,r,n){var i="stackTraceLimit",o=n?2:1,s=e.split("."),a=s[s.length-1],c=ye.apply(null,s);if(c){var u=c.prototype;if($e(u,"cause")&&delete u.cause,!r)return c;var l=ye("Error"),d=t((function(e,t){var r=Yo(n?t:e,void 0),i=n?new c(e):new c;return void 0!==r&&gt(i,"message",r),ns&&gt(i,"stack",rs(i.stack,2)),this&&be(u,this)&&Xo(i,this,d),arguments.length>o&&Ko(i,arguments[o]),i}));d.prototype=u,"Error"!==a?Un?Un(d,l):cr(d,l,{name:!0}):V&&i in c&&(qo(d,c,i),qo(d,c,"prepareStackTrace")),cr(d,c);try{u.name!==a&&gt(u,"name",a),u.constructor=d}catch(e){}return d}},os=U.WebAssembly,ss=7!==Error("e",{cause:7}).cause,as=function(e,t){var r={};r[e]=is(e,t,ss),vr({global:!0,constructor:!0,arity:1,forced:ss},r)},cs=function(e,t){if(os&&os[e]){var r={};r[e]=is("WebAssembly."+e,t,ss),vr({target:"WebAssembly",stat:!0,constructor:!0,arity:1,forced:ss},r)}};as("Error",(function(e){return function(t){return cn(e,this,arguments)}})),as("EvalError",(function(e){return function(t){return cn(e,this,arguments)}})),as("RangeError",(function(e){return function(t){return cn(e,this,arguments)}})),as("ReferenceError",(function(e){return function(t){return cn(e,this,arguments)}})),as("SyntaxError",(function(e){return function(t){return cn(e,this,arguments)}})),as("TypeError",(function(e){return function(t){return cn(e,this,arguments)}})),as("URIError",(function(e){return function(t){return cn(e,this,arguments)}})),cs("CompileError",(function(e){return function(t){return cn(e,this,arguments)}})),cs("LinkError",(function(e){return function(t){return cn(e,this,arguments)}})),cs("RuntimeError",(function(e){return function(t){return cn(e,this,arguments)}}));var us=Je("match"),ls=function(e){var t;return ge(e)&&(void 0!==(t=e[us])?!!t:"RegExp"==ne(e))},ds=function(){var e=dt(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},fs=RegExp.prototype,ps=function(e){var t=e.flags;return void 0!==t||"flags"in fs||$e(e,"flags")||!be(fs,e)?t:q(ds,e)},hs=U.RegExp,ms=F((function(){var e=hs("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),gs=ms||F((function(){return!hs("a","y").sticky})),vs={BROKEN_CARET:ms||F((function(){var e=hs("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),MISSED_STICKY:gs,UNSUPPORTED_Y:ms},ys=U.RegExp,bs=F((function(){var e=ys(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),ws=U.RegExp,Ss=F((function(){var e=ws("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),xs=ir.f,Cs=_t.enforce,Es=Je("match"),Is=U.RegExp,Ts=Is.prototype,Rs=U.SyntaxError,Ps=ee(Ts.exec),As=ee("".charAt),ks=ee("".replace),Os=ee("".indexOf),Ls=ee("".slice),Ds=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,Ms=/a/g,Ns=/a/g,js=new Is(Ms)!==Ms,Bs=vs.MISSED_STICKY,_s=vs.UNSUPPORTED_Y,Us=V&&(!js||Bs||bs||Ss||F((function(){return Ns[Es]=!1,Is(Ms)!=Ms||Is(Ns)==Ns||"/a/i"!=Is(Ms,"i")})));if(mr("RegExp",Us)){for(var Fs=function(e,t){var r,n,i,o,s,a,c=be(Ts,this),u=ls(e),l=void 0===t,d=[],f=e;if(!c&&u&&l&&e.constructor===Fs)return e;if((u||be(Ts,e))&&(e=e.source,l&&(t=ps(f))),e=void 0===e?"":Ho(e),t=void 0===t?"":Ho(t),f=e,bs&&"dotAll"in Ms&&(n=!!t&&Os(t,"s")>-1)&&(t=ks(t,/s/g,"")),r=t,Bs&&"sticky"in Ms&&(i=!!t&&Os(t,"y")>-1)&&_s&&(t=ks(t,/y/g,"")),Ss&&(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=As(e,n)))t+=As(e,++n);else if("]"===t)a=!1;else if(!a)switch(!0){case"["===t:a=!0;break;case"("===t:Ps(Ds,Ls(e,n+1))&&(n+=2,c=!0),i+=t,u++;continue;case">"===t&&c:if(""===l||$e(s,l))throw new Rs("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=Xo(Is(e,t),c?this:Ts,Fs),(n||i||d.length)&&(a=Cs(s),n&&(a.dotAll=!0,a.raw=Fs(function(e){for(var t,r=e.length,n=0,i="",o=!1;n<=r;n++)"\\"!==(t=As(e,n))?o||"."!==t?("["===t?o=!0:"]"===t&&(o=!1),i+=t):i+="[\\s\\S]":i+=t+As(e,++n);return i}(e),r)),i&&(a.sticky=!0),d.length&&(a.groups=d)),e!==f)try{gt(s,"source",""===f?"(?:)":f)}catch(e){}return s},Vs=xs(Is),zs=0;Vs.length>zs;)qo(Fs,Is,Vs[zs++]);Ts.constructor=Fs,Fs.prototype=Ts,Ft(U,"RegExp",Fs,{constructor:!0})}Gn("RegExp");var $s,Gs,qs,Xs=_t.get,Ws=RegExp.prototype,Hs=TypeError;V&&bs&&($s=Ws,Gs="dotAll",(qs={configurable:!0,get:function(){if(this!==Ws){if("RegExp"===ne(this))return!!Xs(this).dotAll;throw Hs("Incompatible receiver, RegExp required")}}}).get&&Ut(qs.get,Gs,{getter:!0}),qs.set&&Ut(qs.set,Gs,{setter:!0}),mt.f($s,Gs,qs));var Ys,Ks=Object.keys||function(e){return tr(e,rr)},Qs={f:V&&!ct?Object.defineProperties:function(e,t){dt(e);for(var r,n=le(t),i=Ks(t),o=i.length,s=0;o>s;)mt.f(e,r=i[s++],n[r]);return e}},Js=At("IE_PROTO"),Zs=function(){},ea=function(e){return"<script>"+e+"<\/script>"},ta=function(e){e.write(ea("")),e.close();var t=e.parentWindow.Object;return e=null,t},ra=function(){try{Ys=new ActiveXObject("htmlfile")}catch(e){}var e,t;ra="undefined"!=typeof document?document.domain&&Ys?ta(Ys):((t=it("iframe")).style.display="none",Kn.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(ea("document.F=Object")),e.close(),e.F):ta(Ys);for(var r=rr.length;r--;)delete ra.prototype[rr[r]];return ra()};kt[Js]=!0;var na=Object.create||function(e,t){var r;return null!==e?(Zs.prototype=dt(e),r=new Zs,Zs.prototype=null,r[Js]=e):r=ra(),void 0===t?r:Qs.f(r,t)},ia=_t.get,oa=Ue("native-string-replace",String.prototype.replace),sa=RegExp.prototype.exec,aa=sa,ca=ee("".charAt),ua=ee("".indexOf),la=ee("".replace),da=ee("".slice),fa=function(){var e=/a/,t=/b*/g;return q(sa,e,"a"),q(sa,t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),pa=vs.BROKEN_CARET,ha=void 0!==/()??/.exec("")[1];(fa||ha||pa||bs||Ss)&&(aa=function(e){var t,r,n,i,o,s,a,c=this,u=ia(c),l=Ho(e),d=u.raw;if(d)return d.lastIndex=c.lastIndex,t=q(aa,d,l),c.lastIndex=d.lastIndex,t;var f=u.groups,p=pa&&c.sticky,h=q(ds,c),m=c.source,g=0,v=l;if(p&&(h=la(h,"y",""),-1===ua(h,"g")&&(h+="g"),v=da(l,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==ca(l,c.lastIndex-1))&&(m="(?: "+m+")",v=" "+v,g++),r=new RegExp("^(?:"+m+")",h)),ha&&(r=new RegExp("^"+m+"$(?!\\s)",h)),fa&&(n=c.lastIndex),i=q(sa,p?r:c,v),p?i?(i.input=da(i.input,g),i[0]=da(i[0],g),i.index=c.lastIndex,c.lastIndex+=i[0].length):c.lastIndex=0:fa&&i&&(c.lastIndex=c.global?i.index+i[0].length:n),ha&&i&&i.length>1&&q(oa,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=na(null),o=0;o<f.length;o++)s[(a=f[o])[0]]=i[a[1]];return i});var ma=aa;vr({target:"RegExp",proto:!0,forced:/./.exec!==ma},{exec:ma});var ga=ee(H.f),va=ee([].push),ya=function(e){return function(t){for(var r,n=le(t),i=Ks(n),o=i.length,s=0,a=[];o>s;)r=i[s++],V&&!ga(n,r)||va(a,e?[r,n[r]]:n[r]);return a}},ba=(ya(!0),ya(!1));vr({target:"Object",stat:!0},{values:function(e){return ba(e)}});var wa=Je("species"),Sa=RegExp.prototype,xa=function(e,t,r,n){var i=Je(e),o=!F((function(){var t={};return t[i]=function(){return 7},7!=""[e](t)})),s=o&&!F((function(){var t=!1,r=/a/;return"split"===e&&((r={}).constructor={},r.constructor[wa]=function(){return r},r.flags="",r[i]=/./[i]),r.exec=function(){return t=!0,null},r[i](""),!t}));if(!o||!s||r){var a=ee(/./[i]),c=t(i,""[e],(function(e,t,r,n,i){var s=ee(e),c=t.exec;return c===ma||c===Sa.exec?o&&!i?{done:!0,value:a(t,r,n)}:{done:!0,value:s(r,t,n)}:{done:!1}}));Ft(String.prototype,e,c[0]),Ft(Sa,i,c[1])}n&&gt(Sa[i],"sham",!0)},Ca=ee("".charAt),Ea=ee("".charCodeAt),Ia=ee("".slice),Ta=function(e){return function(t,r){var n,i,o=Ho(ue(t)),s=Gt(r),a=o.length;return s<0||s>=a?e?"":void 0:(n=Ea(o,s))<55296||n>56319||s+1===a||(i=Ea(o,s+1))<56320||i>57343?e?Ca(o,s):n:e?Ia(o,s,s+2):i-56320+(n-55296<<10)+65536}},Ra=(Ta(!1),Ta(!0)),Pa=function(e,t,r){return t+(r?Ra(e,t).length:1)},Aa=TypeError,ka=function(e,t){var r=e.exec;if(he(r)){var n=q(r,e,t);return null!==n&&dt(n),n}if("RegExp"===ne(e))return q(ma,e,t);throw Aa("RegExp#exec called on incompatible receiver")};xa("match",(function(e,t,r){return[function(t){var r=ue(this),n=ae(t)?void 0:Me(t,e);return n?q(n,t,r):new RegExp(t)[e](Ho(r))},function(e){var n=dt(this),i=Ho(e),o=r(t,n,i);if(o.done)return o.value;if(!n.global)return ka(n,i);var s=n.unicode;n.lastIndex=0;for(var a,c=[],u=0;null!==(a=ka(n,i));){var l=Ho(a[0]);c[u]=l,""===l&&(n.lastIndex=Pa(i,Yt(n.lastIndex),s)),u++}return 0===u?null:c}]}));var Oa=mt.f,La=Je("unscopables"),Da=Array.prototype;null==Da[La]&&Oa(Da,La,{configurable:!0,value:na(null)});var Ma,Na,ja,Ba=function(e){Da[La][e]=!0},_a=!F((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),Ua=At("IE_PROTO"),Fa=Object,Va=Fa.prototype,za=_a?Fa.getPrototypeOf:function(e){var t=Ve(e);if($e(t,Ua))return t[Ua];var r=t.constructor;return he(r)&&t instanceof r?r.prototype:t instanceof Fa?Va:null},$a=Je("iterator"),Ga=!1;[].keys&&("next"in(ja=[].keys())?(Na=za(za(ja)))!==Object.prototype&&(Ma=Na):Ga=!0),(!ge(Ma)||F((function(){var e={};return Ma[$a].call(e)!==e})))&&(Ma={}),he(Ma[$a])||Ft(Ma,$a,(function(){return this}));var qa={IteratorPrototype:Ma,BUGGY_SAFARI_ITERATORS:Ga},Xa=qa.IteratorPrototype,Wa=function(){return this},Ha=function(e,t,r,n){var i=t+" Iterator";return e.prototype=na(Xa,{next:Y(+!n,r)}),zn(e,i,!1),So[i]=Wa,e},Ya=wt.PROPER,Ka=wt.CONFIGURABLE,Qa=qa.IteratorPrototype,Ja=qa.BUGGY_SAFARI_ITERATORS,Za=Je("iterator"),ec=function(){return this},tc=function(e,t,r,n,i,o,s){Ha(r,t,n);var a,c,u,l=function(e){if(e===i&&m)return m;if(!Ja&&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[Za]||p["@@iterator"]||i&&p[i],m=!Ja&&h||l(i),g="Array"==t&&p.entries||h;if(g&&(a=za(g.call(new e)))!==Object.prototype&&a.next&&(za(a)!==Qa&&(Un?Un(a,Qa):he(a[Za])||Ft(a,Za,ec)),zn(a,d,!0)),Ya&&"values"==i&&h&&"values"!==h.name&&(Ka?gt(p,"name","values"):(f=!0,m=function(){return q(h,this)})),i)if(c={values:l("values"),keys:o?m:l("keys"),entries:l("entries")},s)for(u in c)(Ja||f||!(u in p))&&Ft(p,u,c[u]);else vr({target:t,proto:!0,forced:Ja||f},c);return p[Za]!==m&&Ft(p,Za,m,{name:i}),So[t]=m,c},rc=function(e,t){return{value:e,done:t}},nc=mt.f,ic=_t.set,oc=_t.getterFor("Array Iterator"),sc=tc(Array,"Array",(function(e,t){ic(this,{type:"Array Iterator",target:le(e),index:0,kind:t})}),(function(){var e=oc(this),t=e.target,r=e.kind,n=e.index++;return!t||n>=t.length?(e.target=void 0,rc(void 0,!0)):rc("keys"==r?n:"values"==r?t[n]:[n,t[n]],!1)}),"values"),ac=So.Arguments=So.Array;if(Ba("keys"),Ba("values"),Ba("entries"),V&&"values"!==ac.name)try{nc(ac,"name",{value:"values"})}catch(I){}var cc={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},uc=it("span").classList,lc=uc&&uc.constructor&&uc.constructor.prototype,dc=lc===Object.prototype?void 0:lc,fc=Je("iterator"),pc=Je("toStringTag"),hc=sc.values,mc=function(e,t){if(e){if(e[fc]!==hc)try{gt(e,fc,hc)}catch(t){e[fc]=hc}if(e[pc]||gt(e,pc,t),cc[t])for(var r in sc)if(e[r]!==sc[r])try{gt(e,r,sc[r])}catch(t){e[r]=sc[r]}}};for(var gc in cc)mc(U[gc]&&U[gc].prototype,gc);mc(dc,"DOMTokenList");var vc=Array,yc=Math.max,bc=ir.f,wc="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],Sc={f:function(e){return wc&&"Window"==ne(e)?function(e){try{return bc(e)}catch(e){return function(e,t,r){for(var n=Kt(e),i=Wt(void 0,n),o=Wt(n,n),s=vc(yc(o-i,0)),a=0;i<o;i++,a++)Sr(s,a,e[i]);return s.length=a,s}(wc)}}(e):bc(le(e))}},xc=F((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),Cc=Object.isExtensible,Ec=F((function(){Cc(1)}))||xc?function(e){return!!ge(e)&&(!xc||"ArrayBuffer"!=ne(e))&&(!Cc||Cc(e))}:Cc,Ic=!F((function(){return Object.isExtensible(Object.preventExtensions({}))})),Tc=N((function(e){var t=mt.f,r=!1,n=We("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=ir.f,t=ee([].splice),i={};i[n]=1,e(i).length&&(ir.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},vr({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:Sc.f}))},fastKey:function(e,t){if(!ge(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!$e(e,n)){if(!Ec(e))return"F";if(!t)return"E";o(e)}return e[n].objectID},getWeakData:function(e,t){if(!$e(e,n)){if(!Ec(e))return!0;if(!t)return!1;o(e)}return e[n].weakData},onFreeze:function(e){return Ic&&r&&Ec(e)&&!$e(e,n)&&o(e),e}};kt[n]=!0})),Rc=function(e,t,r){for(var n in t)Ft(e,n,t[n],r);return e},Pc=mt.f,Ac=Tc.fastKey,kc=_t.set,Oc=_t.getterFor;!function(e,t,r){var n=-1!==e.indexOf("Map"),i=-1!==e.indexOf("Weak"),o=n?"set":"add",s=U.Set,a=s&&s.prototype,c=s,u={},l=function(e){var t=ee(a[e]);Ft(a,e,"add"==e?function(e){return t(this,0===e?0:e),this}:"delete"==e?function(e){return!(i&&!ge(e))&&t(this,0===e?0:e)}:"get"==e?function(e){return i&&!ge(e)?void 0:t(this,0===e?0:e)}:"has"==e?function(e){return!(i&&!ge(e))&&t(this,0===e?0:e)}:function(e,r){return t(this,0===e?0:e,r),this})};if(mr(e,!he(s)||!(i||a.forEach&&!F((function(){(new s).entries().next()})))))c=r.getConstructor(t,e,n,o),Tc.enable();else if(mr(e,!0)){var d=new c,f=d[o](i?{}:-0,1)!=d,p=F((function(){d.has(1)})),h=_o((function(e){new s(e)})),m=!i&&F((function(){for(var e=new s,t=5;t--;)e[o](t,t);return!e.has(-0)}));h||((c=t((function(e,t){Xn(e,a);var r=Xo(new s,e,c);return ae(t)||Do(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,vr({global:!0,constructor:!0,forced:c!=s},u),zn(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){Xn(e,o),kc(e,{type:t,index:na(null),first:void 0,last:void 0,size:0}),V||(e.size=0),ae(i)||Do(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,s=Oc(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=Ac(t,!0),key:t,value:r,previous:n=o.last,next:void 0,removed:!1},o.first||(o.first=a),n&&(n.next=a),V?o.size++:e.size++,"F"!==i&&(o.index[i]=a)),e},c=function(e,t){var r,n=s(e),i=Ac(t);if("F"!==i)return n.index[i];for(r=n.first;r;r=r.next)if(r.key==t)return r};return Rc(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,V?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),V?r.size--:t.size--}return!!n},forEach:function(e){for(var t,r=s(this),n=Jr(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)}}),Rc(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)}}),V&&Pc(o,"size",{get:function(){return s(this).size}}),i},setStrong:function(e,t,r){var n=t+" Iterator",i=Oc(t),o=Oc(n);tc(e,t,(function(e,t){kc(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)?rc("keys"==t?r.key:"values"==t?r.value:[r.key,r.value],!1):(e.target=void 0,rc(void 0,!0))}),r?"entries":"values",!r,!0),Gn(t)}});var Lc,Dc="object"==typeof Reflect?Reflect:null,Mc=Dc&&"function"==typeof Dc.apply?Dc.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};Lc=Dc&&"function"==typeof Dc.ownKeys?Dc.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var Nc=Number.isNaN||function(e){return e!=e};function jc(){jc.init.call(this)}var Bc=jc;jc.EventEmitter=jc,jc.prototype._events=void 0,jc.prototype._eventsCount=0,jc.prototype._maxListeners=void 0;var _c=10;function Uc(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function Fc(e){return void 0===e._maxListeners?jc.defaultMaxListeners:e._maxListeners}function Vc(e,t,r,n){var i,o,s,a;if(Uc(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=Fc(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 zc(){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 $c(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=zc.bind(n);return i.listener=r,n.wrapFn=i,i}function qc(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):Wc(i,i.length)}function Xc(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 Wc(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function Hc(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(jc,"defaultMaxListeners",{enumerable:!0,get:function(){return _c},set:function(e){if("number"!=typeof e||e<0||Nc(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");_c=e}}),jc.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},jc.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||Nc(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},jc.prototype.getMaxListeners=function(){return Fc(this)},jc.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)Mc(a,this,t);else{var c=a.length,u=Wc(a,c);for(r=0;r<c;++r)Mc(u[r],this,t)}return!0},jc.prototype.addListener=function(e,t){return Vc(this,e,t,!1)},jc.prototype.on=jc.prototype.addListener,jc.prototype.prependListener=function(e,t){return Vc(this,e,t,!0)},jc.prototype.once=function(e,t){return Uc(t),this.on(e,$c(this,e,t)),this},jc.prototype.prependOnceListener=function(e,t){return Uc(t),this.prependListener(e,$c(this,e,t)),this},jc.prototype.removeListener=function(e,t){var r,n,i,o,s;if(Uc(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},jc.prototype.off=jc.prototype.removeListener,jc.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},jc.prototype.listeners=function(e){return qc(this,e,!0)},jc.prototype.rawListeners=function(e){return qc(this,e,!1)},jc.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):Xc.call(e,t)},jc.prototype.listenerCount=Xc,jc.prototype.eventNames=function(){return this._eventsCount>0?Lc(this._events):[]},Bc.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))}Hc(e,t,o,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&Hc(e,"error",t,{once:!0})}(e,i)}))};var Yc=Qc,Kc=Bc.EventEmitter;function Qc(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])}))}}Yc.filter=function(e,t){var r=new Kc;return Qc(e,r,t),r};var Jc=Jt.includes,Zc=F((function(){return!Array(1).includes()}));vr({target:"Array",proto:!0,forced:Zc},{includes:function(e){return Jc(this,e,arguments.length>1?arguments[1]:void 0)}}),Ba("includes");var eu=TypeError,tu=function(e){if(ls(e))throw eu("The method doesn't accept regular expressions");return e},ru=Je("match"),nu=ee("".indexOf);vr({target:"String",proto:!0,forced:!function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[ru]=!1,"/./"[e](t)}catch(e){}}return!1}("includes")},{includes:function(e){return!!~nu(Ho(ue(this)),Ho(tu(e)),arguments.length>1?arguments[1]:void 0)}});const iu=On.get("PeerConnectionStats");class Gc extends Bc{constructor(e){super(),this.peer=e,this.stats=null,this.emitInterval=null,this.previousStats=null}init(){var e=this;iu.info("Initializing peer connection stats"),this.emitInterval=setInterval(P((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=D(e.values());try{for(n.s();!(r=n.n()).done;){const e=r.value;switch(e.type){case"outbound-rtp":ou(e,this.previousStats,t);break;case"inbound-rtp":su(e,this.previousStats,t);break;case"candidate-pair":e.nominated&&au(e,t)}}}catch(e){n.e(e)}finally{n.f()}this.stats=t}stop(){iu.info("Stopping peer connection stats"),clearInterval(this.emitInterval)}}const ou=(e,t,r)=>{var n,i;const o=cu(e),s=uu(e.codecId,r.raw),a=lu(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(T(T({},s),a))},su=(e,t,r)=>{let n=cu(e);const i=uu(e.codecId,r.raw);["audio","video"].includes(n)||(n=e.id.includes("Video")?"video":"audio");const o=lu(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=du(o,r),o.packetsLostDeltaPerSecond=fu(o,r)}}r[n].inbounds.push(T(T({},i),o))},au=(e,t)=>{t.totalRoundTripTime=e.totalRoundTripTime,t.currentRoundTripTime=e.currentRoundTripTime,t.availableOutgoingBitrate=e.availableOutgoingBitrate,t.candidateType=t.raw.get(e.localCandidateId).candidateType},cu=e=>e.mediaType||e.kind,uu=(e,t)=>{var r;return{mimeType:(e&&null!==(r=t.get(e))&&void 0!==r?r:{}).mimeType}},lu=(e,t)=>{const r={};return"video"===t&&(r.framesPerSecond=e.framesPerSecond,r.frameHeight=e.frameHeight,r.frameWidth=e.frameWidth),r.timestamp=e.timestamp,r},du=(e,t)=>fu(e,t)/(e.totalPacketsReceived-t.totalPacketsReceived),fu=(e,t)=>e.totalPacketsLost-t.totalPacketsLost;var pu=function(e,t,r,n){try{return n?t(dt(r)[0],r[1]):t(r)}catch(t){Ao(e,"throw",t)}},hu=Array,mu=!_o((function(e){Array.from(e)}));vr({target:"Array",stat:!0,forced:mu},{from:function(e){var t=Ve(e),r=jr(this),n=arguments.length,i=n>1?arguments[1]:void 0,o=void 0!==i;o&&(i=Jr(i,n>2?arguments[2]:void 0));var s,a,c,u,l,d,f=To(t),p=0;if(!f||this===hu&&Eo(f))for(s=Kt(t),a=r?new this(s):hu(s);s>p;p++)d=o?i(t[p],p):t[p],Sr(a,p,d);else for(l=(u=Po(t,f)).next,a=r?new this:[];!(c=q(l,u)).done;p++)d=o?pu(u,i,[c.value,p],!0):c.value,Sr(a,p,d);return a.length=p,a}});var gu=Math.floor,vu=ee("".charAt),yu=ee("".replace),bu=ee("".slice),wu=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,Su=/\$([$&'`]|\d{1,2})/g,xu=function(e,t,r,n,i,o){var s=r+e.length,a=n.length,c=Su;return void 0!==i&&(i=Ve(i),c=wu),yu(o,c,(function(o,c){var u;switch(vu(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=gu(l/10);return 0===d?o:d<=a?void 0===n[d-1]?vu(c,1):n[d-1]+vu(c,1):o}u=n[l-1]}return void 0===u?"":u}))},Cu=Je("replace"),Eu=Math.max,Iu=Math.min,Tu=ee([].concat),Ru=ee([].push),Pu=ee("".indexOf),Au=ee("".slice),ku="$0"==="a".replace(/./,"$0"),Ou=!!/./[Cu]&&""===/./[Cu]("a","$0");xa("replace",(function(e,t,r){var n=Ou?"$":"$0";return[function(e,r){var n=ue(this),i=ae(e)?void 0:Me(e,Cu);return i?q(i,e,n,r):q(t,Ho(n),e,r)},function(e,i){var o=dt(this),s=Ho(e);if("string"==typeof i&&-1===Pu(i,n)&&-1===Pu(i,"$<")){var a=r(t,o,s,i);if(a.done)return a.value}var c=he(i);c||(i=Ho(i));var u=o.global;if(u){var l=o.unicode;o.lastIndex=0}for(var d=[];;){var f=ka(o,s);if(null===f)break;if(Ru(d,f),!u)break;""===Ho(f[0])&&(o.lastIndex=Pa(s,Yt(o.lastIndex),l))}for(var p,h="",m=0,g=0;g<d.length;g++){for(var v=Ho((f=d[g])[0]),y=Eu(Iu(Gt(f.index),s.length),0),b=[],w=1;w<f.length;w++)Ru(b,void 0===(p=f[w])?p:String(p));var S=f.groups;if(c){var x=Tu([v],b,y,s);void 0!==S&&Ru(x,S);var C=Ho(cn(i,void 0,x))}else C=xu(v,s,y,b,S,i);y>=m&&(h+=Au(s,m,y)+C,m=y+v.length)}return h+Au(s,m)}]}),!!F((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}))||!ku||Ou);var Lu=tn.filter,Du=Vr("filter");vr({target:"Array",proto:!0,forced:!Du},{filter:function(e){return Lu(this,e,arguments.length>1?arguments[1]:void 0)}});var Mu,Nu="\t\n\v\f\r                 \u2028\u2029\ufeff",ju=ee("".replace),Bu="["+Nu+"]",_u=RegExp("^"+Bu+Bu+"*"),Uu=RegExp(Bu+Bu+"*$"),Fu=function(e){return function(t){var r=Ho(ue(t));return 1&e&&(r=ju(r,_u,"")),2&e&&(r=ju(r,Uu,"")),r}},Vu={start:Fu(1),end:Fu(2),trim:Fu(3)},zu=wt.PROPER,$u=Vu.trim;vr({target:"String",proto:!0,forced:(Mu="trim",F((function(){return!!Nu[Mu]()||"​…᠎"!=="​…᠎"[Mu]()||zu&&Nu[Mu].name!==Mu})))},{trim:function(){return $u(this)}});var Gu=Je("matchAll"),qu=_t.set,Xu=_t.getterFor("RegExp String Iterator"),Wu=RegExp.prototype,Hu=TypeError,Yu=ee("".indexOf),Ju=ee("".matchAll),Zu=!!Ju&&!F((function(){Ju("a",/./)})),el=Ha((function(e,t,r,n){qu(this,{type:"RegExp String Iterator",regexp:e,string:t,global:r,unicode:n,done:!1})}),"RegExp String",(function(){var e=Xu(this);if(e.done)return rc(void 0,!0);var t=e.regexp,r=e.string,n=ka(t,r);return null===n?(e.done=!0,rc(void 0,!0)):e.global?(""===Ho(n[0])&&(t.lastIndex=Pa(r,Yt(t.lastIndex),e.unicode)),rc(n,!1)):(e.done=!0,rc(n,!1))}));vr({target:"String",proto:!0,forced:Zu},{matchAll:function(e){var t,r,n,i=ue(this);if(ae(e)){if(Zu)return Ju(i,e)}else{if(ls(e)&&(t=Ho(ue(ps(e))),!~Yu(t,"g")))throw Hu("`.matchAll` does not allow non-global regexes");if(Zu)return Ju(i,e);if(n=Me(e,Gu))return q(n,e,i)}return r=Ho(i),new RegExp(e,"g")[Gu](r)}}),Gu in Wu||Ft(Wu,Gu,(function(e){var t,r,n,i=dt(this),o=Ho(e),s=Yn(i,RegExp),a=Ho(ps(i));return t=new s(s===RegExp?i.source:i,a),r=!!~Yu(a,"g"),n=!!~Yu(a,"u"),t.lastIndex=Yt(i.lastIndex),new el(t,o,r,n)}));var rl=ee([].reverse),nl=[1,2];vr({target:"Array",proto:!0,forced:String(nl)===String(nl.reverse())},{reverse:function(){return yr(this)&&(this.length=this.length),rl(this)}});var il=N((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")}))}))})),ol=N((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<(il[t]||[]).length;s+=1){var a=il[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}}))}))}})),al=/%[sdv%]/g,ul=function(e){var t=1,r=arguments,n=r.length;return e.replace(al,(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""}}))},ll=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 ul.apply(null,n)},dl=["v","o","s","i","u","e","p","c","b","t","r","z","a"],fl=["i","c","b","a"],pl={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||dl,n=t.innerOrder||fl,i=[];return r.forEach((function(t){il[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(ll(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(ll(t,r,e))}))}))})),e.media.forEach((function(e){i.push(ll("m",il.m[0],e)),n.forEach((function(t){il[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(ll(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(ll(t,r,e))}))}))}))})),i.join("\r\n")+"\r\n"},parse:ol.parse,parseParams:ol.parseParams,parseFmtpConfig:ol.parseFmtpConfig,parsePayloads:ol.parsePayloads,parseRemoteCandidates:ol.parseRemoteCandidates,parseImageAttributes:ol.parseImageAttributes,parseSimulcastStreamList:ol.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 hl=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 ml=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=ml.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 ml(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 gl=tl,vl=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 yl=vl("ACTIVE","PASSIVE","ACTPASS","INACTIVE");yl.byValue=function(e){switch(e){case yl.ACTIVE:case yl.PASSIVE:case yl.ACTPASS:case yl.INACTIVE:return e}return yl[e.toUpperCase()]},yl.toString=function(e){switch(e){case yl.ACTIVE:return"active";case yl.PASSIVE:return"passive";case yl.ACTPASS:return"actpass";case yl.INACTIVE:return"inactive"}},yl.reverse=function(e){switch(e){case yl.ACTIVE:return yl.PASSIVE;case yl.PASSIVE:return yl.ACTIVE;case yl.ACTPASS:return yl.PASSIVE;case yl.INACTIVE:return yl.INACTIVE}};var bl=yl;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: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}}sl.expand=function(e){return new sl(e.setup?bl.byValue(e.setup):bl.ACTPASS,e.hash,e.fingerprint)};var wl=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 Sl=cl,xl=[],Cl=[],El="undefined"!=typeof Uint8Array?Uint8Array:Array,Il="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Tl=0,Pl=Il.length;Tl<Pl;++Tl)xl[Tl]=Il[Tl],Cl[Il.charCodeAt(Tl)]=Tl;function Al(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(xl[(i=n)>>18&63]+xl[i>>12&63]+xl[i>>6&63]+xl[63&i]);return o.join("")}Cl["-".charCodeAt(0)]=62,Cl["_".charCodeAt(0)]=63;var Ll=function(e){var t,r,n=Al(e),i=n[0],o=n[1],s=new El(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=Cl[e.charCodeAt(r)]<<18|Cl[e.charCodeAt(r+1)]<<12|Cl[e.charCodeAt(r+2)]<<6|Cl[e.charCodeAt(r+3)],s[a++]=t>>16&255,s[a++]=t>>8&255,s[a++]=255&t;return 2===o&&(t=Cl[e.charCodeAt(r)]<<2|Cl[e.charCodeAt(r+1)]>>4,s[a++]=255&t),1===o&&(t=Cl[e.charCodeAt(r)]<<10|Cl[e.charCodeAt(r+1)]<<4|Cl[e.charCodeAt(r+2)]>>2,s[a++]=t>>8&255,s[a++]=255&t),s},Ml=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(xl[t>>2]+xl[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],i.push(xl[t>>10]+xl[t>>4&63]+xl[t<<2&63]+"=")),i.join("")},jl=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)},Bl=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},_l=N((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(X(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(X(e,ArrayBuffer)||e&&X(e.buffer,ArrayBuffer))return l(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(X(e,SharedArrayBuffer)||e&&X(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||W(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)||X(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 $(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return G(e).length;default:if(i)return n?-1:$(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 R(this,t,r);case"utf8":case"utf-8":return C(this,t,r);case"ascii":return I(this,t,r);case"latin1":case"binary":return T(this,t,r);case"base64":return x(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(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),W(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(W(n))return s;e[r+s]=n}return s}function y(e,t,r,n){return q($(t,e.length-r),e,r,n)}function b(e,t,r,n){return q(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 w(e,t,r,n){return q(G(t),e,r,n)}function S(e,t,r,n){return q(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 x(e,t,r){return 0===t&&r===e.length?Ml(e):Ml(e.slice(t,r))}function C(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<=E)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=E));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(X(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),X(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(X(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?C(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(X(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 b(this,e,t,r);case"base64":return w(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(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 E=4096;function I(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 T(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 R(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+=H[e[n]];return i}function P(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 A(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 k(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 O(e,t,r,n,i){U(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 L(e,t,r,n,i){U(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 D(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 M(e,t,r,n,i){return t=+t,r>>>=0,i||D(e,0,r,4),Bl(e,t,r,n,23,4),r+4}function N(e,t,r,n,i){return t=+t,r>>>=0,i||D(e,0,r,8),Bl(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||A(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||A(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||A(e,1,this.length),this[e]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(e,t){return e>>>=0,t||A(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(e,t){return e>>>=0,t||A(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(e,t){return e>>>=0,t||A(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||A(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readBigUInt64LE=Y((function(e){F(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||V(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=Y((function(e){F(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||V(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||A(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||A(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||A(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},o.prototype.readInt16LE=function(e,t){e>>>=0,t||A(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||A(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||A(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||A(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readBigInt64LE=Y((function(e){F(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||V(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=Y((function(e){F(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||V(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||A(e,4,this.length),jl(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return e>>>=0,t||A(e,4,this.length),jl(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return e>>>=0,t||A(e,8,this.length),jl(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return e>>>=0,t||A(e,8,this.length),jl(this,e,!1,52,8)},o.prototype.writeUintLE=o.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||k(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||k(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||k(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||k(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||k(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||k(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||k(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=Y((function(e,t=0){return O(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),o.prototype.writeBigUInt64BE=Y((function(e,t=0){return L(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);k(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);k(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||k(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||k(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||k(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||k(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||k(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=Y((function(e,t=0){return O(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),o.prototype.writeBigInt64BE=Y((function(e,t=0){return L(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),o.prototype.writeFloatLE=function(e,t,r){return M(this,e,t,!0,r)},o.prototype.writeFloatBE=function(e,t,r){return M(this,e,t,!1,r)},o.prototype.writeDoubleLE=function(e,t,r){return N(this,e,t,!0,r)},o.prototype.writeDoubleBE=function(e,t,r){return N(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 j={};function B(e,t,r){j[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 _(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 U(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 j.ERR_OUT_OF_RANGE("value",i,e)}!function(e,t,r){F(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||V(t,e.length-(r+1))}(n,i,o)}function F(e,t){if("number"!=typeof e)throw new j.ERR_INVALID_ARG_TYPE(t,"number",e)}function V(e,t,r){if(Math.floor(e)!==e)throw F(e,r),new j.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new j.ERR_BUFFER_OUT_OF_BOUNDS;throw new j.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}B("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?e+" is outside of buffer bounds":"Attempt to access memory outside buffer bounds"}),RangeError),B("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),B("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=_(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=_(i)),i+="n"),n+=` It must be ${t}. Received ${i}`,n}),RangeError);const z=/[^+/0-9A-Za-z-_]/g;function $(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 G(e){return Ll(function(e){if((e=(e=e.split("=")[0]).trim().replace(z,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function q(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 X(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function W(e){return e!=e}const H=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 Y(e){return"undefined"==typeof BigInt?K:e}function K(){throw new Error("BigInt not supported")}})),Fl=N((function(e,t){var r=_l.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=_l:(n(_l,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 _l.SlowBuffer(e)}})),zl=N((function(e){var t=65536,r=Fl.Buffer,n=M.crypto||M.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?E.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 Gl=Rl;const Wl=vl("SEND","RECV");Wl.byValue=function(e){return Wl[e.toUpperCase()]},Wl.toString=function(e){switch(e){case Wl.SEND:return"send";case Wl.RECV:return"recv"}},Wl.reverse=function(e){switch(e){case Wl.SEND:return Wl.RECV;case Wl.RECV:return Wl.SEND}};var Hl=Wl;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:Hl.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,Hl.byValue(e.direction));for(let r in e.params)t.addParam(r,e.params[r]);return e.formats&&t.setFormats(e.formats),t};var Jl=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 Zl=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(Hl.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(Hl.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===Hl.SEND?this.send.push(t):this.recv.push(t)}addSimulcastStream(e,t){return e===Hl.SEND?this.send.push([t]):this.recv.push([t])}getSimulcastStreams(e){return e===Hl.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(Zl.expand(e.send[r][t]));t.addSimulcastAlternativeStreams(Hl.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(Zl.expand(e.recv[r][t]));t.addSimulcastAlternativeStreams(Hl.RECV,n)}return t};var ed=Nl;const td=vl("SENDRECV","SENDONLY","RECVONLY","INACTIVE");td.byValue=function(e){return td[e.toUpperCase()]},td.toString=function(e){switch(e){case td.SENDRECV:return"sendrecv";case td.SENDONLY:return"sendonly";case td.RECVONLY:return"recvonly";case td.INACTIVE:return"inactive"}},td.reverse=function(e){switch(e){case td.SENDRECV:return td.SENDRECV;case td.SENDONLY:return td.RECVONLY;case td.RECVONLY:return td.SENDONLY;case td.INACTIVE:return td.INACTIVE}};var rd=td;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 nd=Ul;class Vl{constructor(e,t){this.id=e,this.type=t,this.direction=rd.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:rd.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(rd.reverse(this.direction)),e.codecs){let r;r=Array.isArray(e.codecs)?gl.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 ed,n=this.simulcast.getSimulcastStreams(Hl.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(Hl.RECV,r)}const i=this.simulcast.getSimulcastStreams(Hl.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(Hl.SEND,r)}for(const e of this.rids.values()){const r=e.clone();r.setDirection(Hl.reverse(e.getDirection())),t.addRID(r)}t.setSimulcast(e)}if(e.dataChannel&&this.dataChannel){const r=new nd(this.dataChannel.getPort(),e.dataChannel.maxMessageSize?e.dataChannel.maxMessageSize:this.dataChannel.getMaxMessageSize());t.setDataChannel(r)}}else t.setDirection(rd.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(gl.MapFromNames(t.codecs,t.rtx,t.rtcpfbs)):r.setCodecs(t.codecs)):r.setDirection(rd.INACTIVE),r},Vl.expand=function(e){const t=new Vl(e.id,e.type);if(e.direction&&t.setDirection(rd.byValue(e.direction)),t.setBitrate(e.bitrate),e.dataChannel){const r=nd.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=gl.expand(e.codecs[r]);n&&t.addCodec(n)}for(let r=0;e.rids&&r<e.rids.length;++r){const n=Jl.expand(e.rids[r]);t.addRID(n)}return e.simulcast&&t.setSimulcast(ed.expand(e.simulcast)),e.control&&t.setControl(e.control),t};var id=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 od=$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 sd=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(gl.expand(e.codecs[r]));for(let r in e.params)t.addParam(r,e.params[r]);return t};var cd=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(od.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(cd.expand(e.encodings[r][t]));t.addAlternativeEncodings(n)}return t};var ud=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=ud.expand(e.tracks[r]);n&&t.addTrack(n)}return t};var ld=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 Gl?t.setICE(e.ice.clone()):t.setICE(Gl.expand(e.ice))),e.dtls&&(e.dtls instanceof wl?t.setDTLS(e.dtls):t.setDTLS(wl.expand(e.dtls))),e.crypto&&(e.crypto instanceof Sl?t.setCrypto(e.crypto):t.setCrypto(Sl.expand(e.crypto)));for(let r=0;e.candidates&&r<e.candidates.length;++r)e.candidates[r]instanceof hl?t.addCandidate(e.candidates[r].clone()):t.addCandidate(hl.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=rd.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:Hl.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(Hl.SEND),n=t.getSimulcastStreams(Hl.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),pl.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 pl.write(e).slice(10)}}Ql.create=function(e){const t=new Ql;e.ice&&(e.ice instanceof Gl?t.setICE(e.ice.clone()):t.setICE(Gl.expand(e.ice))),e.dtls&&(e.dtls instanceof wl?t.setDTLS(e.dtls):t.setDTLS(wl.expand(e.dtls))),e.crypto&&(e.crypto instanceof Sl?t.setCrypto(e.crypto):t.setCrypto(Sl.expand(e.crypto)));for(let r=0;e.candidates&&r<e.candidates.length;++r)e.candidates[r]instanceof hl?t.addCandidate(e.candidates[r].clone()):t.addCandidate(hl.expand(e.candidates[r]));let r=96,n=1;for(let i in e.capabilities){const o=id.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=id.expand(e.medias[r]);n&&t.addMedia(n)}for(let r=0;e.streams&&r<e.streams.length;++r){const n=ld.expand(e.streams[r]);n&&t.addStream(n)}for(let r=0;e.candidates&&r<e.candidates.length;++r){const n=hl.expand(e.candidates[r]);n&&t.addCandidate(n)}return e.ice&&t.setICE(Gl.expand(e.ice)),e.dtls&&t.setDTLS(wl.expand(e.dtls)),e.crypto&&t.setCrypto(wl.expand(e.crypto)),e.extmapAllowMixedNotSupported&&(this.extmapAllowMixed=!e.extmapAllowMixedNotSupported),t},Ql.process=function(e){return Ql.parse(e)},Ql.parse=function(e){const t=pl.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 Gl(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 id(o,i);if(n.iceUfrag&&n.icePwd){const e=String(n.iceUfrag),i=String(n.icePwd),o=new Gl(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 hl(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 wl(i,e,t))}if(n.crypto){const e=n.crypto[0];r.setCrypto(new Sl(e.id,e.suite,e.config,e.sessionConfig))}let c=rd.SENDRECV;n.direction&&(c=rd.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 gl(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 ml(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 Jl(t.id,Hl.byValue(t.direction));let n=[];const i=new Map;if(t.params){const e=pl.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 ed;if(n.simulcast.dir1){const t=Hl.byValue(n.simulcast.dir1),r=pl.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 Zl(r[n][e].scid,r[n][e].paused));e.addSimulcastAlternativeStreams(t,i)}}if(n.simulcast.dir2){const t=Hl.byValue(n.simulcast.dir2),r=pl.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 Zl(r[n][e].scid,r[n][e].paused));e.addSimulcastAlternativeStreams(t,i)}}for(let t of e.getSimulcastStreams(Hl.SEND)){const e=[];for(let r=0;r<t.length;r++){const n=new cd(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 sd(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 ld(t),r.addStream(a));let l=a.getTrack(n);l||(l=new ud(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 ld(t),r.addStream(a));let c=a.getTrack(s);c||(c=new ud(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 ld(n),r.addStream(a));let c=a.getTrack(s);c||(c=new ud(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 od(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 nd(n.sctpPort,n.maxMessageSize);s.setDataChannel(e)}r.addMedia(s)}return r};var dd,fd,hd={SDPInfo:Ql,CandidateInfo:hl,CodecInfo:gl,DTLSInfo:wl,CryptoInfo:Sl,ICEInfo:Gl,MediaInfo:id,Setup:bl,SourceGroupInfo:od,SourceInfo:sd,StreamInfo:ld,TrackInfo:ud,RTCPFeedbackInfo:ml,TrackEncodingInfo:cd,Direction:rd},md=(dd=!1,(fd=/[ac]/).exec=function(){return dd=!0,/./.exec.apply(this,arguments)},!0===fd.test("abc")&&dd),gd=/./.test;vr({target:"RegExp",proto:!0,forced:!md},{test:function(e){var t=dt(this),r=Ho(e),n=t.exec;if(!he(n))return q(gd,t,r);var i=q(n,t,r);return null!==i&&(dt(i),!0)}});var vd=N((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",b="embedded",w="Amazon",S="Apple",x="ASUS",C="BlackBerry",E="Google",I="Huawei",T="LG",R="Microsoft",P="Motorola",A="Samsung",k="Sony",O="Xiaomi",L="Zebra",D="Facebook",M=function(e){for(var t={},r=0;r<e.length;r++)t[e[r].toUpperCase()]=e[r];return t},N=function(e,t){return typeof e===a&&-1!==j(t).indexOf(j(e))},j=function(e){return e.toLowerCase()},B=function(e,t){if(typeof e===a)return e=e.replace(/^\s\s*/,"").replace(/\s\s*$/,""),typeof t===o?e:e.substring(0,255)},_=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}},U=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(N(t[r][i],e))return"?"===r?n:r}else if(N(t[r],e))return"?"===r?n:r;return e},F={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"},V={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,D],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,U,{"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,j]],[/((?: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/,"",j]],[/(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,j]]],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,A],[l,g]],[/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[c,[d,A],[l,m]],[/\((ip(?:hone|od)[\w ]*);/i],[c,[d,S],[l,m]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[c,[d,S],[l,g]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[c,[d,I],[l,g]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}-[atu]?[ln][01259x][012359][an]?)\b(?!.+d\/s)/i],[c,[d,I],[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,O],[l,m]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[c,/_/g," "],[d,O],[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,P],[l,m]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[c,[d,P],[l,g]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[c,[d,T],[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,T],[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,E],[l,g]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[c,[d,E],[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,k],[l,m]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[c,"Xperia Tablet"],[d,k],[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,w],[l,g]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[c,/(.+)/g,"Fire Phone $1"],[d,w],[l,m]],[/(playbook);[-\w\),; ]+(rim)/i],[c,d,[l,g]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[c,[d,C],[l,m]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[c,[d,x],[l,g]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[c,[d,x],[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,R],[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,R],[l,m]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[c,[d,L],[l,g]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[c,[d,L],[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,k],[l,h]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[c,[d,R],[l,h]],[/smart-tv.+(samsung)/i],[d,[l,v]],[/hbbtv.+maple;(\d+)/i],[[c,/^/,"SmartTV"],[d,A],[l,v]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[d,T],[l,v]],[/(apple) ?tv/i],[d,[c,"Apple TV"],[l,v]],[/crkey/i],[[c,"Chromecast"],[d,E],[l,v]],[/droid.+aft(\w)( bui|\))/i],[c,[d,w],[l,v]],[/\(dtv[\);].+(aquos)/i],[c,[d,"Sharp"],[l,v]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i],[[d,B],[c,B],[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,E],[l,y]],[/droid.+; (wt63?0{2,3})\)/i],[c,[d,L],[l,y]],[/(quest( 2)?)/i],[c,[d,D],[l,y]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[d,[l,b]],[/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,U,F]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[u,"Windows"],[f,U,F]],[/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,C]],[/(?: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]]},z=function(e,t){if(typeof e===s&&(t=e,e=n),!(this instanceof z))return new z(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}(V,t):V;return this.getBrowser=function(){var e={};return e.name=n,e.version=n,_.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,_.call(e,i,c.cpu),e},this.getDevice=function(){var e={};return e.vendor=n,e.model=n,e.type=n,_.call(e,i,c.device),e},this.getEngine=function(){var e={};return e.name=n,e.version=n,_.call(e,i,c.engine),e},this.getOS=function(){var e={};return e.name=n,e.version=n,_.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?B(e,255):e,this},this.setUA(i),this};z.VERSION="0.7.31",z.BROWSER=M([u,f,"major"]),z.CPU=M([p]),z.DEVICE=M([c,d,l,h,m,v,g,y,b]),z.ENGINE=z.OS=M([u,f]),e.exports&&(t=e.exports=z),t.UAParser=z;var $=typeof r!==o&&(r.jQuery||r.Zepto);if($&&!$.ua){var G=new z;$.ua=G.getResult(),$.ua.get=function(){return G.getUA()},$.ua.set=function(e){G.setUA(e);var t=G.getResult();for(var r in t)$.ua[r]=t[r]}}}("object"==typeof window?window:M)}));const yd=["iOS"];class ad extends vd{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(yd.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 wd=On.get("SdpParser"),Sd=Array.from({length:31},(e,t)=>t+35),xd=Array.from({length:32},(e,t)=>t+96),Cd=Array.from({length:14},(e,t)=>t+1),Ed=Array.from({length:240},(e,t)=>t+16);class pd{static setSimulcast(e,t){if(wd.info("Setting simulcast. Codec: ",t),!(new ad).isChrome())return wd.warn("Simulcast is only available in Google Chrome browser"),e;if("h264"!==t&&"vp8"!==t)return wd.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",wd.info("Simulcast setted"),wd.debug("Simulcast SDP: ",e),e}catch(e){throw wd.error("Error setting SDP for simulcast: ",e),e}}static setStereo(e){return wd.info("Replacing SDP response for support stereo"),e=e.replace(/useinbandfec=1/g,"useinbandfec=1; stereo=1"),wd.info("Replaced SDP response for support stereo"),wd.debug("New SDP value: ",e),e}static setDTX(e){return wd.info("Replacing SDP response for support dtx"),e=e.replace("useinbandfec=1","useinbandfec=1; usedtx=1"),wd.info("Replaced SDP response for support dtx"),wd.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),wd.info("Replaced SDP response for setting absolute capture time"),wd.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),wd.info("Replaced SDP response for setting depency descriptor"),wd.debug("New SDP value: ",e),e}static setVideoBitrate(e,t){if(t<1)wd.info("Remove bitrate restrictions"),e=e.replace(/b=AS:.*\r\n/,"").replace(/b=TIAS:.*\r\n/,"");else{const r=hd.SDPInfo.parse(e),n=r.getMedia("video");wd.info("Setting video bitrate"),n.setBitrate(t),e=r.toString()}return e}static removeSdpLine(e,t){return wd.debug("SDP before trimming: ",e),e=e.split("\n").filter(e=>e.trim()!==t).join("\n"),wd.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||Id(t)))if(e.includes("multiopus/48000/6"))wd.info("Multiopus already setted");else{wd.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),wd.info("Multiopus offer created"),wd.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=xd.concat(Sd);var n,i=D(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=Cd.concat(Ed);var n,i=D(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=hd.SDPInfo.parse(e),n=hd.SDPInfo.parse(t);var i,o=D(r.getMedias());try{for(o.s();!(i=o.n()).done;){const t=i.value;let r=n.getMediaById(t.getId());if(!r){r=new hd.MediaInfo(t.getId(),t.getType()),r.setDirection(hd.Direction.reverse(t.getDirection()));const i=n.getMedia(t.getType());if(i){r.setCodecs(i.getCodecs());var s,a=D(i.getExtensions());try{for(a.s();!(s=a.n()).done;){const e=k(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=hd.SDPInfo.parse(e),i=null===(r=hd.SDPInfo.parse(t).getMediasByType("video")[0])||void 0===r?void 0:r.getExtensions();if(i||i.length){var o,s=D(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 Id=e=>e.getAudioTracks().some(e=>e.getSettings().channelCount>2);var Td=Jt.indexOf,Rd=ee([].indexOf),Ad=!!Rd&&1/Rd([1],1,-0)<0,kd=function(e,t){var r=[].indexOf;return!!r&&F((function(){r.call(null,(function(){return 1}),1)}))}();vr({target:"Array",proto:!0,forced:Ad||!kd},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return Ad?Rd(this,e,t)||0:Td(this,e,t)}});class bd extends Bc{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 Od=class extends Bc{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 Ld=On.get("Signaling"),Dd="wsConnectionSuccess",Nd="wsConnectionError",jd="broadcastEvent",Bd={VP8:"vp8",VP9:"vp9",H264:"h264",AV1:"av1"},_d={OPUS:"opus",MULTIOPUS:"multiopus"};class Pd extends Bc{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 P((function*(){var t;return Ld.info("Connecting to Signaling Server"),e.transactionManager&&(null===(t=e.webSocket)||void 0===t?void 0:t.readyState)===WebSocket.OPEN?(Ld.info("Connected to server: ",e.webSocket.url),Ld.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(Dd,{ws:e.webSocket,tm:e.transactionManager}),e.webSocket):new Promise((t,r)=>{e.webSocket=new WebSocket(e.wsUrl),e.transactionManager=new Od(e.webSocket),e.webSocket.onopen=()=>{Ld.info("WebSocket opened"),e.transactionManager.on("event",t=>{e.emit(jd,t)}),Ld.info("Connected to server: ",e.webSocket.url),Ld.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(Dd,{ws:e.webSocket,tm:e.transactionManager}),t(e.webSocket)},e.webSocket.onerror=()=>{Ld.error("WebSocket not connected: ",e.webSocket.url),e.emit(Nd,e.webSocket.url),r(e.webSocket.url)},e.webSocket.onclose=()=>{e.webSocket=null,e.transactionManager=null,Ld.info("Connection closed with Signaling Server."),e.emit("wsConnectionClose")}})}))()}close(){var e;Ld.info("Closing connection with Signaling Server."),null===(e=this.webSocket)||void 0===e||e.close()}subscribe(e,t){var r=arguments,n=this;return P((function*(){let i=r.length>2&&void 0!==r[2]?r[2]:null,o=r.length>3&&void 0!==r[3]?r[3]:null;Ld.info("Starting subscription to streamName: ",n.streamName),Ld.debug("Subcription local description: ",e);const s=Ud(t,i,o),a={sdp:e=pd.adaptCodecName(e,"AV1X",Bd.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(),Ld.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,Bd.AV1,"AV1X"):e.sdp,Ld.info("Command sent, subscriberId: ",e.subscriberId),Ld.debug("Command result: ",e),n.serverId=e.subscriberId,n.clusterId=e.clusterId,e.sdp}catch(e){throw Ld.error("Error sending view command, error: ",e),e}}))()}publish(e,t){var r=arguments,n=this;return P((function*(){const i=Fd(t,r.length>2&&void 0!==r[2]?r[2]:null,r.length>3&&void 0!==r[3]?r[3]:null);Ld.info("Starting publishing to streamName: ".concat(n.streamName,", codec: ").concat(i.codec)),Ld.debug("Publishing local description: ",e);const o=Object.values(Bd);if(-1===o.indexOf(i.codec))throw Ld.error("Invalid codec. Possible values are: ",o),new Error("Invalid codec. Possible values are: ".concat(o));i.codec===Bd.AV1&&(e=pd.adaptCodecName(e,"AV1X",Bd.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(),Ld.info("Sending publish command");const e=yield n.transactionManager.cmd("publish",s);if(i.codec===Bd.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,Bd.AV1,"AV1X"):e.sdp}return Ld.info("Command sent, publisherId: ",e.publisherId),Ld.debug("Command result: ",e),n.serverId=e.publisherId,n.clusterId=e.clusterId,e.sdp}catch(e){throw Ld.error("Error sending publish command, error: ",e),e}}))()}cmd(e,t){var r=this;return P((function*(){return Ld.info("Sending cmd: ".concat(e)),r.transactionManager.cmd(e,t)}))()}}const Ud=(e,t,r)=>{let n="object"==typeof e?e:{};return 0===Object.keys(n).length&&(n={vad:e,pinnedSourceId:t,excludedSourceIds:r}),n},Fd=(e,t,r)=>{let n="object"==typeof e?e:{};if(0===Object.keys(n).length){const i=Bd.H264;n={codec:null!=e?e:i,record:t,sourceId:r}}return n},Vd=On.get("PeerConnection"),zd={track:"track",connectionStateChange:"connectionStateChange"},$d={stereo:!1,mediaStream:null,codec:"h264",simulcast:!1,scalabilityMode:null,disableAudio:!1,disableVideo:!1,setSDPToPeer:!0};class Md extends Bc{constructor(){super(),this.sessionDescription=null,this.peer=null,this.peerConnectionStats=null}createRTCPeer(){var e=arguments,t=this;return P((function*(){let r=e.length>0&&void 0!==e[0]?e[0]:null;Vd.info("Creating new RTCPeerConnection"),Vd.debug("RTC configuration provided by user: ",r),t.peer=Xd(t,r)}))()}getRTCPeer(){return Vd.info("Getting RTC Peer"),this.peer}closeRTCPeer(){var e=this;return P((function*(){var t;Vd.info("Closing RTCPeerConnection"),null===(t=e.peer)||void 0===t||t.close(),e.peer=null,e.stopStats(),e.emit(zd.connectionStateChange,"closed")}))()}setRTCRemoteSDP(e){var t=this;return P((function*(){Vd.info("Setting RTC Remote SDP");const r={type:"answer",sdp:e};try{yield t.peer.setRemoteDescription(r),Vd.info("RTC Remote SDP was set successfully."),Vd.debug("RTC Remote SDP new value: ",e)}catch(e){throw Vd.error("Error while setting RTC Remote SDP: ",e),e}}))()}getRTCLocalSDP(){var e=arguments,t=this;return P((function*(){let r=e.length>0&&void 0!==e[0]?e[0]:$d;Vd.info("Getting RTC Local SDP"),r=T(T({},$d),r),Vd.debug("Options: ",r);const n=qd(r.mediaStream);n?Yd(t.peer,n,r):Kd(t.peer,r),Vd.info("Creating peer offer");const i=yield t.peer.createOffer();return Vd.info("Peer offer created"),Vd.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),Vd.info("Peer local description set")),t.sessionDescription.sdp}))()}addRemoteTrack(e,t){var r=this;return P((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=D(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 Vd.info("Updating bandwidth restriction, bitrate value: ",t),Vd.debug("SDP value: ",e),pd.setVideoBitrate(e,t)}updateBitrate(){var e=arguments,t=this;return P((function*(){let r=e.length>0&&void 0!==e[0]?e[0]:0;if(!t.peer)throw Vd.error("Cannot update bitrate. No peer found."),new Error("Cannot update bitrate. No peer found.");Vd.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),Vd.info("Bitrate restirctions updated: ","".concat(r>0?r:"unlimited"," kbps"))}))()}getRTCPeerStatus(){if(Vd.info("Getting RTC peer status"),!this.peer)return null;const e=Qd(this.peer);return Vd.info("RTC peer status getted, value: ",e),e}replaceTrack(e){if(!this.peer)return void Vd.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):Vd.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(Bd).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=D(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]=T(T({},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=>T({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?Vd.warn("Cannot init peer stats: Already initialized"):this.peer?(this.peerConnectionStats=new Gc(this.peer),this.peerConnectionStats.init(),Yc(this.peerConnectionStats,this,["stats"])):Vd.warn("Cannot init peer stats: RTCPeerConnection not initialized")}stopStats(){var e;null===(e=this.peerConnectionStats)||void 0===e||e.stop(),this.peerConnectionStats=null}}const Gd=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&&Gd(e))return e;if(!(e instanceof MediaStream)){Vd.info("Creating MediaStream to add received tracks.");const n=new MediaStream;var t,r=D(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(Gd(n))return n}throw Vd.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.")},Xd=(e,t)=>{const r=new RTCPeerConnection(t);return Wd(e,r),r},Wd=(e,t)=>{var r;t.ontrack=t=>{var r;if(Vd.info("New track from peer."),Vd.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(zd.track,t)},t.connectionState?t.onconnectionstatechange=r=>{Vd.info("Peer connection state change: ",t.connectionState),e.emit(zd.connectionStateChange,t.connectionState)}:t.oniceconnectionstatechange=r=>{Vd.info("Peer ICE connection state change: ",t.iceConnectionState),e.emit(zd.connectionStateChange,t.iceConnectionState)},t.onnegotiationneeded=(r=P((function*(e){if(!t.remoteDescription)return;Vd.info("Peer onnegotiationneeded, updating local description");const r=yield t.createOffer();Vd.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);Vd.info("Peer onnegotiationneeded, updating remote description",n),yield t.setRemoteDescription({type:"answer",sdp:n}),Vd.info("Peer onnegotiationneeded, renegotiation done")})),function(e){return r.apply(this,arguments)})},Yd=(e,t,r)=>{Vd.info("Adding mediaStream tracks to RTCPeerConnection");var n,i=D(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()?(Vd.debug("Video track with scalability mode: ".concat(r.scalabilityMode,".")),o.sendEncodings=[{scalabilityMode:r.scalabilityMode}]):r.scalabilityMode&&Vd.warn("SVC is only supported in Google Chrome")),e.addTransceiver(i,o),Vd.info("Track '".concat(i.label,"' added: "),"id: ".concat(i.id),"kind: ".concat(i.kind))}}catch(e){i.e(e)}finally{i.f()}},Kd=(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"})},Qd=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}},Jd=On.get("Director");let Zd="",ef="https://realtime1.wowza.com";class Hd{static setEndpoint(e){ef=e.replace(/\/$/,"")}static getEndpoint(){return ef}static setLiveDomain(e){Zd=e.replace(/\/$/,"")}static getLiveDomain(){return Zd}static getPublisher(e){var t=arguments,r=this;return P((function*(){const n=tf(e,t.length>1&&void 0!==t[1]?t[1]:null,t.length>2&&void 0!==t[2]?t[2]:"WebRtc");Jd.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=nf(e),Jd.debug("Getting publisher response: ",e),e.data}catch(e){throw Jd.error("Error while getting publisher connection path. ",e),e}}))()}static getSubscriber(e){var t=arguments,r=this;return P((function*(){const n=rf(e,t.length>1&&void 0!==t[1]?t[1]:null,t.length>2&&void 0!==t[2]?t[2]:null);Jd.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=T(T({},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=nf(e),Jd.debug("Getting subscriber response: ",e),e.data}catch(e){throw Jd.error("Error while getting subscriber connection path. ",e),e}}))()}}const tf=(e,t,r)=>{let n="object"==typeof e?e:{};return 0===Object.keys(n).length&&(n={token:e,streamName:t,streamType:r}),n},rf=(e,t,r)=>{let n="object"==typeof e?e:{};return 0===Object.keys(n).length&&(n={streamName:e,streamAccountId:t,subscriberToken:r}),n=T(T({},n),{},{streamAccountId:"bUEzT6"}),n},nf=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 sf(e){this.message=e}function af(e){this.message=e}let cf;sf.prototype=new Error,sf.prototype.name="InvalidCharacterError","undefined"!=typeof window&&window.atob&&window.atob.bind(window),af.prototype=new Error,af.prototype.name="InvalidTokenError",N((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 Bc{constructor(e,t,r,n){if(super(),cf=r,!e)throw cf.error("Stream Name is required to construct this module."),new Error("Stream Name is required to construct this module.");if(!t)throw cf.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;cf.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 cf.info("Broadcast status: ",e||"not_established"),"connected"===e}setReconnect(){this.signaling.on("migrate",()=>this.replaceConnection()),this.autoReconnect&&(this.signaling.on(Nd,()=>{!this.firstReconnection&&this.alreadyDisconnected||(this.firstReconnection=!1,this.reconnect())}),this.webRTCPeer.on(zd.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 P((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=uf(e.reconnectionInterval),cf.error("Reconnection failed, retrying in ".concat(e.reconnectionInterval,"ms. "),t),e.emit("reconnect",{timeout:e.reconnectionInterval,error:t}),setTimeout(()=>e.reconnect(),e.reconnectionInterval)}}))()}}const uf=e=>e<32e3?2*e:e;On.get("Publish");const lf=On.get("View"),df={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,lf,!(arguments.length>3&&void 0!==arguments[3])||arguments[3]),r&&this.on(zd.track,e=>{r.srcObject=e.streams[0]})}connect(){var e=arguments,t=this;return P((function*(){let r=e.length>0&&void 0!==e[0]?e[0]:df;t.options=T(T(T({},df),r),{},{setSDPToPeer:!1}),yield t.initConnection({migrate:!1})}))()}select(){var e=arguments,t=this;return P((function*(){let r=e.length>0&&void 0!==e[0]?e[0]:{};lf.debug("Viewer select layer values: ",r),yield t.signaling.cmd("select",{layer:r}),lf.info("Connected to streamName: ",t.streamName)}))()}addRemoteTrack(e,t){var r=this;return P((function*(){return lf.info("Viewer adding remote % track",e),r.webRTCPeer.addRemoteTrack(e,t)}))()}project(e,t){var r=this;return P((function*(){var n,i=D(t);try{for(i.s();!(n=i.n()).done;){const e=n.value;if(!e.trackId&&!e.media)throw lf.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 lf.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()}lf.debug("Viewer project source: layer mappings: ",e,t),yield r.signaling.cmd("project",{sourceId:e,mapping:t}),lf.info("Projection done")}))()}unproject(e){var t=this;return P((function*(){lf.debug("Viewer unproject mediaIds: ",e),yield t.signaling.cmd("unproject",{mediaIds:e}),lf.info("Unprojection done")}))()}replaceConnection(){var e=this;return P((function*(){lf.info("Migrating current connection"),yield e.initConnection({migrate:!0})}))()}initConnection(e){var t=this;return P((function*(){var r,n;let i,o;if(lf.debug("Viewer connect options values: ",t.options),t.stopReconnection=!1,!e.migrate&&t.isActive())throw lf.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 lf.error("Error generating token."),e}if(!o)throw lf.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=Yc(c,t,Object.values(zd)),t.stopReemitingSignalingInstanceEvents=Yc(a,t,[jd]);const u=c.getRTCLocalSDP(T(T({},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,T(T({},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),lf.info("Connected to streamName: ",t.streamName);let g=t.webRTCPeer;t.webRTCPeer=c,t.setReconnect(),e.migrate&&t.webRTCPeer.on(zd.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,lf.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}})}))()}}function pf(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}class Millicast{constructor(){this.log=pf("millicast"),console.log("warning / the millicast plugin is in alpha release")}init(e,t,r){r.on("reap",()=>{var e;return null===(e=r.millicast)||void 0===e?void 0:e.stop()})}onload(e,t,r,{streamName:n}){this.log("loading",n);const i=r.millicast=new ff(n,()=>Hd.getSubscriber({streamName:n}),r);try{i.connect()}catch(e){this.log("Connection failed",e),r.emit("error",e)}}wants(e,{type:t,streamName:r},n){return"wowza/millicast"==t&&"string"==typeof r}}return Millicast.events={},function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)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,Millicast),Millicast}));
package/plugins/share.js CHANGED
@@ -1 +1 @@
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.share=t())}(this,(function(){"use strict";const e={name:"fp-facebook"},t={name:"fp-link"},n={name:"fp-share"},s={name:"fp-embed"},o={name:"fp-twitter"};function i(e,t,n){const s=function(e){return Array.isArray(e)?e.slice(0):e.split(".")}(t);for(;s.length;){if(null==e)return n;const t=s.shift();if("string"!=typeof t)return n;e=e[t]}return null==e?n:e}function r(){try{return(document.querySelector("meta[name='description']")||{content:""}).content}catch(e){return""}}function l(e){if("string"==typeof e.link)return e.link;const t=document.querySelector("link[rel=canonical]");return t?t.href:window.location.toString()}class FlowplayerComponent extends HTMLElement{constructor(e){super(),this.player=e}}class FlowplayerIcon extends FlowplayerComponent{constructor(e,t){super(e),this.classList.add("fp-icon",t.name),t.title&&this.setAttribute("title",t.title),t.title&&this.setAttribute("aria-label",t.title),t.translation_key&&this.setAttribute("aria-label",e.i18n(t.translation_key)),this.setAttribute("tabindex","0"),this.setAttribute("focusable","true")}}const a=(e,t)=>new(((e,t)=>{const n=e.get(t);if(!n)throw new Error(`no flowplayer component with the name ${t} exists`);const s=window.customElements.get(t);if(!s)throw new Error(`no default flowplayer component with the name ${t} exists`);const o=window.customElements.get(n);return"function"!=typeof o?s:o})(e._customElements,t))(e),c=(e,t,n)=>{window.customElements.get(t)||window.customElements.define(t,n),e.customElements.get(t)||e.customElements.set(t,t)},u="flowplayer-share-menu",m="fp-on",d="fp-invis";class FlowplayerMenu extends FlowplayerComponent{constructor(e){super(e),this.player=e,this.menuContainer=document.createElement("details"),this.summaryEle=document.createElement("summary"),this.olEle=document.createElement("ol"),this.olEle.id=h(),this.menu=document.createElement("div"),this.closeEle=document.createElement("span"),this.menu.classList.add("fp-menu"),this.menu.append(this.closeEle,this.olEle),this.closeEle.classList.add("fp-close"),this.closeEle.textContent="×",this.menuContainer.append(this.summaryEle,this.menu),this.menuContainer.addEventListener("click",t=>{t.preventDefault();const n=this.menuContainer.open;n||(p(),document.active_menu=this.menuContainer),this.menuContainer.open=!n,e.root.classList.toggle("has-menu-opened",!n),this.olEle.setAttribute("aria-expanded",n?"false":"true")}),this.append(this.menuContainer),this.summaryEle.setAttribute("aria-haspopup","true"),this.summaryEle.setAttribute("aria-controls",this.olEle.id),this.summaryEle.setAttribute("tabindex","0"),this.summaryEle.setAttribute("role","button")}get options(){return this.olEle.querySelectorAll("li")}setMenuAttrs(e){if(this.summaryEle.id||(this.summaryEle.id=e.id||h()),this.className=`${e.class} ${d}`,this.menuContainer.classList.add("fp-menu-container"),this.olEle.setAttribute("aria-labelledby",this.summaryEle.id),this.olEle.setAttribute("role","menu"),this.summaryEle.setAttribute("aria-label",e.menuTitle||"Menu"),e.summaryTitle&&(this.summaryEle.textContent=e.summaryTitle),e.summaryIcon){const t=a(this.player,e.summaryIcon);t.setAttribute("tabindex",""),this.summaryEle.append(t)}if(e.menuTitle){const t=document.createElement("h3");t.textContent=e.menuTitle,this.menu.prepend(t)}this.menu.classList.toggle("fp-icons",!!e.icons),this.addEventListener(e.options_event,e=>{this.render(e.data)}),e.item_selected_event&&this.addEventListener(e.item_selected_event,e=>{void 0!==e.data&&this.select_item(e.data.selected_index)})}render(e){this.olEle&&(this.olEle.innerHTML="",e&&e.forEach(this.menuOption,this),this.classList.toggle(d,!(null==e?void 0:e.length)))}menuOption(e,t){const n=document.createElement("li");n.setAttribute("role","menuitem"),n.setAttribute("tabindex","0"),e.icon&&n.append(e.icon);const s=document.createElement("span");s.textContent=e.text,n.append(s),n.addEventListener("click",()=>{this.select_item(t),"function"==typeof e.onclick&&e.onclick()}),this.olEle.appendChild(n)}select_item(e){this.options.forEach((t,n)=>{t.classList.toggle(m,n===e&&("flowplayer-subtitles-menu"!==this.localName||!t.classList.contains(m)))})}unselect_item(){this.options.forEach(e=>{e.classList.remove(m)})}}function p(){Array.from(document.querySelectorAll(".fp-engine")).forEach(e=>{var t;const n=e.root.querySelector("details[open].fp-menu-container");n&&(n.open=!1,null===(t=n.querySelector("summary"))||void 0===t||t.removeAttribute("aria-expanded"),e.root.classList.toggle("has-menu-opened",!1))})}function h(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function f(e,t,n){const s=function(e,t){const n=new CustomEvent(e,{detail:t,cancelable:!0});return t&&Object.defineProperty(n,"data",{get:()=>t}),n}(t,n);return e.dispatchEvent(s),e}function y(e,t){const n=e._customElements.get(t);return n&&e.root.querySelector(n)||void 0}document.addEventListener("click",(function(e){this.active_menu&&!e.composedPath().includes(this.active_menu)&&(p(),this.active_menu=void 0)})),function(){let e=!1;try{const t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("testPassive",null,t),window.removeEventListener("testPassive",null,t)}catch(e){}}();class Share{constructor(i){this.umd=i,this.share_options=[],c(i,u,FlowplayerMenu),c(this.umd,"flowplayer-facebook-icon",class extends FlowplayerIcon{constructor(t){super(t,e)}}),c(this.umd,"flowplayer-twitter-icon",class extends FlowplayerIcon{constructor(e){super(e,o)}}),c(this.umd,"flowplayer-link-icon",class extends FlowplayerIcon{constructor(e){super(e,t)}}),c(this.umd,"flowplayer-embed-icon",class extends FlowplayerIcon{constructor(e){super(e,s)}}),c(this.umd,"flowplayer-share-icon",class extends FlowplayerIcon{constructor(e){super(e,n)}})}init(e,t,n){const s=a(n,u);s instanceof FlowplayerMenu&&s.setMenuAttrs({menuTitle:n.i18n("share.menu_title"),class:"fp-share-menu fp-togglable",summaryIcon:"flowplayer-share-icon",icons:!0,options_event:Share.events.OPTIONS});const o={prev_config:0,webshare_listener:0};n.on("mount",(function(){var e;null===(e=y(n,t.classList.contains("logo-on-right")?"flowplayer-header-right-zone":"flowplayer-header-left-zone"))||void 0===e||e.append(s),s instanceof FlowplayerMenu&&s.menuContainer.addEventListener("toggle",(function(){t.classList.toggle("is-share-menu",this.open);const e=y(n,"flowplayer-control");this.open&&(t.classList.contains("is-small")?n.pause():e&&function(e,t){if(!t)return;e.menu.style.maxHeight=t.getBoundingClientRect().top+parseFloat(window.getComputedStyle(t).getPropertyValue("padding"))-e.menuContainer.getBoundingClientRect().bottom+"px"}(s,e))}))})),n.on("config",t=>{const c=i(t,"data.share",{});if(!1===c)return s instanceof FlowplayerMenu&&void s.classList.remove("webshare-enabled");if(o.prev_config===c)return;if(o.prev_config=c,s instanceof FlowplayerMenu&&function(){try{return"https:"===window.location.protocol&&"function"==typeof navigator.share}catch(e){return!1}}()&&i(c,"web_share",!0))return function(e){e.classList.add("webshare-enabled")}(s),o.webshare_listener||function(e,t,n){n.webshare_listener=!0,t.addEventListener("click",(function(){if(!t.classList.contains("webshare-enabled"))return;t.menuContainer.open=!1;navigator.share({title:i(e,"share.title",document.title),text:i(e,"share.text",r()),url:l(i(e,"share",{}))}).catch((function(){}))}))}(e,s,o);this.share_options=[];const u="string"==typeof c.link?c.link:window.location.toString();if(c.iframe){const e="string"==typeof c.iframe?c.iframe:u;this.share_options.push(w(n,s,"share.embed",E.bind(null,e,n),a(n,"flowplayer-embed-icon")))}c.link&&this.share_options.push(w(n,s,"share.link",_.bind(null,u),a(n,"flowplayer-link-icon"))),c.facebook&&this.share_options.push(w(n,s,"Facebook",v.bind(null,u),a(n,"flowplayer-facebook-icon"))),c.twitter&&this.share_options.push(w(n,s,"Twitter",x.bind(null,u),a(n,"flowplayer-twitter-icon"))),f(s,Share.events.OPTIONS,this.share_options)})}add_options(e,...t){const n=e.root.querySelector(u);n&&t.forEach(t=>{const s=w(e,n,t.text,t.onclick,t.icon);n.menuOption(s,n.options.length)})}}function w(e,t,n,s,o){return{text:b(e,n),icon:o,onclick:g.bind(null,e,t,s)}}function b(e,t){return 0===t.indexOf("share.")?e.i18n(t):t}function g(e,t,n){t instanceof FlowplayerMenu&&t.unselect_item();const s=n();s.success&&s.message&&e.message&&e.emit(e.message.events.SHOW_MESSAGE,{message:s.message})}function E(e,t){const n=t.videoHeight/t.videoWidth;return _('<div style="position:relative;width:100%;display:inline-block;"><iframe src="__IFRAME_SRC__" allowfullscreen style="border:none;position:absolute;top:0;left:0;width:100%;height:100%;"></iframe><div style="padding-top: __RATIO__%;"></div></div>'.replace("__IFRAME_SRC__",encodeURI(e)).replace("__RATIO__",""+100*n))}function _(e){const t=document.createElement("textarea");t.setAttribute("style","position:absolute;opacity:0"),t.value=e;const n=document.body;n.append(t),t.select();const s=document.execCommand("copy");return n.removeChild(t),{success:s,message:s?"<trans share.clipboard_success trans>":"<trans share.clipboard_failure trans>"}}function v(e){return A("https://www.facebook.com/sharer.php?u="+encodeURIComponent(e)),{success:!0}}function x(e){return A("https://twitter.com/intent/tweet?url="+encodeURIComponent(e)),{success:!0}}function A(e){let t;const n=screen.height,s=screen.width,o=Math.round(s/2-275);t=0,n>420&&(t=Math.round(n/2-210)),window.open(e,"sharer","scrollbars=yes,resizable=yes,toolbar=no,location=yes,width=550,height=420,left="+o+",top="+t)}return Share.events={OPTIONS:"share:options"},function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});const n=e.flowplayer;"function"==typeof n?n(t):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(t)||n.extensions.push(t))}(window,Share),Share}));
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.share=t())}(this,(function(){"use strict";const e={name:"fp-facebook"},t={name:"fp-link"},n={name:"fp-share"},s={name:"fp-embed"},o={name:"fp-twitter"};function i(e,t,n){const s=function(e){return Array.isArray(e)?e.slice(0):e.split(".")}(t);for(;s.length;){if(null==e)return n;const t=s.shift();if("string"!=typeof t)return n;e=e[t]}return null==e?n:e}function r(){try{return(document.querySelector("meta[name='description']")||{content:""}).content}catch(e){return""}}function l(e){if("string"==typeof e.link)return e.link;const t=document.querySelector("link[rel=canonical]");return t?t.href:window.location.toString()}class FlowplayerComponent extends HTMLElement{constructor(e){super(),this.player=e}}class FlowplayerIcon extends FlowplayerComponent{constructor(e,t){super(e),this.classList.add("fp-icon",t.name),t.title&&this.setAttribute("title",t.title),t.title&&this.setAttribute("aria-label",t.title),t.translation_key&&this.setAttribute("aria-label",e.i18n(t.translation_key)),this.setAttribute("tabindex","0"),this.setAttribute("focusable","true")}}const a=(e,t)=>new(((e,t)=>{const n=e.get(t);if(!n)throw new Error(`no flowplayer component with the name ${t} exists`);const s=window.customElements.get(t);if(!s)throw new Error(`no default flowplayer component with the name ${t} exists`);const o=window.customElements.get(n);return"function"!=typeof o?s:o})(e._customElements,t))(e),c=(e,t,n)=>{window.customElements.get(t)||window.customElements.define(t,n),e.customElements.get(t)||e.customElements.set(t,t)},u="flowplayer-share-menu",m="fp-on",d="fp-invis";class FlowplayerMenu extends FlowplayerComponent{constructor(e){super(e),this.player=e,this.menuContainer=document.createElement("details"),this.summaryEle=document.createElement("summary"),this.olEle=document.createElement("ol"),this.olEle.id=h(),this.menu=document.createElement("div"),this.closeEle=document.createElement("span"),this.menu.classList.add("fp-menu"),this.menu.append(this.closeEle,this.olEle),this.closeEle.classList.add("fp-close"),this.closeEle.textContent="×",this.menuContainer.append(this.summaryEle,this.menu),this.menuContainer.addEventListener("click",t=>{t.preventDefault();const n=this.menuContainer.open;n||(p(),document.active_menu=this.menuContainer),this.menuContainer.open=!n,e.root.classList.toggle("has-menu-opened",!n),this.olEle.setAttribute("aria-expanded",n?"false":"true")}),this.append(this.menuContainer),this.summaryEle.setAttribute("aria-haspopup","true"),this.summaryEle.setAttribute("aria-controls",this.olEle.id),this.summaryEle.setAttribute("tabindex","0"),this.summaryEle.setAttribute("role","button")}get options(){return this.olEle.querySelectorAll("li")}setMenuAttrs(e){if(this.summaryEle.id||(this.summaryEle.id=e.id||h()),this.className=`${e.class} ${d}`,this.menuContainer.classList.add("fp-menu-container"),this.olEle.setAttribute("aria-labelledby",this.summaryEle.id),this.olEle.setAttribute("role","menu"),this.summaryEle.setAttribute("aria-label",e.menuTitle||"Menu"),e.summaryTitle&&(this.summaryEle.textContent=e.summaryTitle),e.summaryIcon){const t=a(this.player,e.summaryIcon);t.setAttribute("tabindex",""),this.summaryEle.append(t)}if(e.menuTitle){const t=document.createElement("h3");t.textContent=e.menuTitle,this.menu.prepend(t)}this.menu.classList.toggle("fp-icons",!!e.icons),this.addEventListener(e.options_event,e=>{this.render(e.data)}),e.item_selected_event&&this.addEventListener(e.item_selected_event,e=>{void 0!==e.data&&this.select_item(e.data.selected_index)})}render(e){this.olEle&&(this.olEle.innerHTML="",e&&e.forEach(this.menuOption,this),this.classList.toggle(d,!(null==e?void 0:e.length)))}menuOption(e,t){const n=document.createElement("li");n.setAttribute("role","menuitem"),n.setAttribute("tabindex","0"),e.icon&&n.append(e.icon);const s=document.createElement("span");s.textContent=e.text,n.append(s),n.addEventListener("click",()=>{this.select_item(t),"function"==typeof e.onclick&&e.onclick()}),this.olEle.appendChild(n)}select_item(e){this.options.forEach((t,n)=>{t.classList.toggle(m,n===e&&("flowplayer-subtitles-menu"!==this.localName||!t.classList.contains(m)))})}unselect_item(){this.options.forEach(e=>{e.classList.remove(m)})}}function p(){Array.from(document.querySelectorAll(".fp-engine")).forEach(e=>{var t;const n=e.root.querySelector("details[open].fp-menu-container");n&&(n.open=!1,null===(t=n.querySelector("summary"))||void 0===t||t.removeAttribute("aria-expanded"),e.root.classList.toggle("has-menu-opened",!1))})}function h(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function f(e,t,n){const s=function(e,t){const n=new CustomEvent(e,{detail:t,cancelable:!0});return t&&Object.defineProperty(n,"data",{get:()=>t}),n}(t,n);return e.dispatchEvent(s),e}function y(e,t){const n=e._customElements.get(t);return n&&e.root.querySelector(n)||void 0}document.addEventListener("click",(function(e){this.active_menu&&!e.composedPath().includes(this.active_menu)&&(p(),this.active_menu=void 0)})),function(){let e=!1;try{const t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("testPassive",null,t),window.removeEventListener("testPassive",null,t)}catch(e){}}();class Share{constructor(i){this.umd=i,this.share_options=[],c(i,u,FlowplayerMenu),c(this.umd,"flowplayer-facebook-icon",class extends FlowplayerIcon{constructor(t){super(t,e)}}),c(this.umd,"flowplayer-twitter-icon",class extends FlowplayerIcon{constructor(e){super(e,o)}}),c(this.umd,"flowplayer-link-icon",class extends FlowplayerIcon{constructor(e){super(e,t)}}),c(this.umd,"flowplayer-embed-icon",class extends FlowplayerIcon{constructor(e){super(e,s)}}),c(this.umd,"flowplayer-share-icon",class extends FlowplayerIcon{constructor(e){super(e,n)}})}init(e,t,n){const s=a(n,u);s instanceof FlowplayerMenu&&s.setMenuAttrs({menuTitle:n.i18n("share.menu_title"),class:"fp-share-menu fp-togglable",summaryIcon:"flowplayer-share-icon",icons:!0,options_event:Share.events.OPTIONS});const o={prev_config:0,webshare_listener:0};n.on("mount",(function(){var e;null===(e=y(n,"flowplayer-header-left-zone"))||void 0===e||e.append(s),s instanceof FlowplayerMenu&&s.menuContainer.addEventListener("toggle",(function(){t.classList.toggle("is-share-menu",this.open);const e=y(n,"flowplayer-control");this.open&&(t.classList.contains("is-small")?n.pause():e&&function(e,t){if(!t)return;e.menu.style.maxHeight=t.getBoundingClientRect().top+parseFloat(window.getComputedStyle(t).getPropertyValue("padding"))-e.menuContainer.getBoundingClientRect().bottom+"px"}(s,e))}))})),n.on("config",t=>{const c=i(t,"data.share",{});if(!1===c)return s instanceof FlowplayerMenu&&void s.classList.remove("webshare-enabled");if(o.prev_config===c)return;if(o.prev_config=c,s instanceof FlowplayerMenu&&function(){try{return"https:"===window.location.protocol&&"function"==typeof navigator.share}catch(e){return!1}}()&&i(c,"web_share",!0))return function(e){e.classList.add("webshare-enabled")}(s),o.webshare_listener||function(e,t,n){n.webshare_listener=!0,t.addEventListener("click",(function(){if(!t.classList.contains("webshare-enabled"))return;t.menuContainer.open=!1;navigator.share({title:i(e,"share.title",document.title),text:i(e,"share.text",r()),url:l(i(e,"share",{}))}).catch((function(){}))}))}(e,s,o);this.share_options=[];const u="string"==typeof c.link?c.link:window.location.toString();if(c.iframe){const e="string"==typeof c.iframe?c.iframe:u;this.share_options.push(w(n,s,"share.embed",g.bind(null,e,n),a(n,"flowplayer-embed-icon")))}c.link&&this.share_options.push(w(n,s,"share.link",_.bind(null,u),a(n,"flowplayer-link-icon"))),c.facebook&&this.share_options.push(w(n,s,"Facebook",v.bind(null,u),a(n,"flowplayer-facebook-icon"))),c.twitter&&this.share_options.push(w(n,s,"Twitter",x.bind(null,u),a(n,"flowplayer-twitter-icon"))),f(s,Share.events.OPTIONS,this.share_options)})}add_options(e,...t){const n=e.root.querySelector(u);n&&t.forEach(t=>{const s=w(e,n,t.text,t.onclick,t.icon);n.menuOption(s,n.options.length)})}}function w(e,t,n,s,o){return{text:b(e,n),icon:o,onclick:E.bind(null,e,t,s)}}function b(e,t){return 0===t.indexOf("share.")?e.i18n(t):t}function E(e,t,n){t instanceof FlowplayerMenu&&t.unselect_item();const s=n();s.success&&s.message&&e.message&&e.emit(e.message.events.SHOW_MESSAGE,{message:s.message})}function g(e,t){const n=t.videoHeight/t.videoWidth;return _('<div style="position:relative;width:100%;display:inline-block;"><iframe src="__IFRAME_SRC__" allowfullscreen style="border:none;position:absolute;top:0;left:0;width:100%;height:100%;"></iframe><div style="padding-top: __RATIO__%;"></div></div>'.replace("__IFRAME_SRC__",encodeURI(e)).replace("__RATIO__",""+100*n))}function _(e){const t=document.createElement("textarea");t.setAttribute("style","position:absolute;opacity:0"),t.value=e;const n=document.body;n.append(t),t.select();const s=document.execCommand("copy");return n.removeChild(t),{success:s,message:s?"<trans share.clipboard_success trans>":"<trans share.clipboard_failure trans>"}}function v(e){return A("https://www.facebook.com/sharer.php?u="+encodeURIComponent(e)),{success:!0}}function x(e){return A("https://twitter.com/intent/tweet?url="+encodeURIComponent(e)),{success:!0}}function A(e){let t;const n=screen.height,s=screen.width,o=Math.round(s/2-275);t=0,n>420&&(t=Math.round(n/2-210)),window.open(e,"sharer","scrollbars=yes,resizable=yes,toolbar=no,location=yes,width=550,height=420,left="+o+",top="+t)}return Share.events={OPTIONS:"share:options"},function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});const n=e.flowplayer;"function"==typeof n?n(t):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(t)||n.extensions.push(t))}(window,Share),Share}));