@flowplayer/player 3.26.0 → 3.27.0-rc

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/rts.js CHANGED
@@ -1,25 +1,25 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.rts=t())}(this,(function(){"use strict";var e="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function t(e,t){const r=function(){try{return localStorage.getItem("flowplayer/debug")}catch(e){return""}}(),n=(n,...s)=>{try{const i=(null==t?void 0:t.debug)||r;i&&e.match(i)&&console.log(`flowplayer/${e} -- ${n}`,...s)}catch(e){console.warn(e)}};return n.log=n,n}function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}var s=r,i=n;function o(e){if(s===setTimeout)return setTimeout(e,0);if((s===r||!s)&&setTimeout)return s=setTimeout,setTimeout(e,0);try{return s(e,0)}catch(t){try{return s.call(null,e,0)}catch(t){return s.call(this,e,0)}}}"function"==typeof e.setTimeout&&(s=setTimeout),"function"==typeof e.clearTimeout&&(i=clearTimeout);var a,c=[],l=!1,u=-1;function d(){l&&a&&(l=!1,a.length?c=a.concat(c):u=-1,c.length&&h())}function h(){if(!l){var e=o(d);l=!0;for(var t=c.length;t;){for(a=c,c=[];++u<t;)a&&a[u].run();u=-1,t=c.length}a=null,l=!1,function(e){if(i===clearTimeout)return clearTimeout(e);if((i===n||!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 m=p,g=p,y=p,v=p,w=p,R=p,k=p;var _=e.performance||{},I=_.now||_.mozNow||_.msNow||_.oNow||_.webkitNow||function(){return(new Date).getTime()};var E=new Date;var T={nextTick:function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];c.push(new f(e,t)),1!==c.length||l||o(h)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:m,addListener:g,once:y,off:v,removeListener:w,removeAllListeners:R,emit:k,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*I.call(_),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-E)/1e3}},L=Object.defineProperty,A=Object.defineProperties,M=Object.getOwnPropertyDescriptors,O=Object.getOwnPropertySymbols,D=Object.prototype.hasOwnProperty,j=Object.prototype.propertyIsEnumerable,Z=(e,t,r)=>t in e?L(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,N=(e,t)=>{for(var r in t||(t={}))D.call(t,r)&&Z(e,r,t[r]);if(O)for(var r of O(t))j.call(t,r)&&Z(e,r,t[r]);return e},V=(e,t)=>A(e,M(t)),U=(e,t)=>{var r={};for(var n in e)D.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&O)for(var n of O(e))t.indexOf(n)<0&&j.call(e,n)&&(r[n]=e[n]);return r},W=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof e<"u"?e:typeof self<"u"?self:{};function G(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var B={exports:{}};
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.rts=t())}(this,(function(){"use strict";var e="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function t(e,t){const n=function(){try{return localStorage.getItem("flowplayer/debug")}catch(e){return""}}(),r=(r,...s)=>{try{const i=(null==t?void 0:t.debug)||n;i&&e.match(i)&&console.log(`flowplayer/${e} -- ${r}`,...s)}catch(e){console.warn(e)}};return r.log=r,r}const n="retry",r="fullscreenenter",s="fullscreenexit",i="loadedmetadata",o="loadeddata",a="progress",c="loadstart",l="pause",u="playing",d="waiting",p="canplay",f="ended",h="seeked",m="seeking",g="reap",y="recover",v="content:loadstart";var w=Object.freeze({__proto__:null,MOUNT:"mount",RETRY:n,ERROR:"error",CONTEXT_MENU:"contextmenu",CLICK:"click",DBL_CLICK:"dblclick",KEYUP:"keyup",KEYDOWN:"keydown",LOAD:"load",MOUSE_ENTER:"mouseenter",MOUSE_LEAVE:"mouseleave",MOUSE_UP:"mouseup",MOUSE_DOWN:"mousedown",MOUSE_MOVE:"mousemove",TOUCH_START:"touchstart",TOUCH_MOVE:"touchmove",TOUCH_END:"touchend",TOUCH_CANCEL:"touchcancel",RESIZE:"resize",SCROLL:"scroll",FULLSCREEN_ENTER:r,FULLSCREEN_EXIT:s,FULLSCREEN_CHANGE:"fullscreenchange",METADATA:i,DATA:o,PROGRESS:a,TIME_UPDATE:"timeupdate",LOAD_START:c,VOLUME_CHANGE:"volumechange",PAUSE:l,PLAYING:u,PLAY:"play",WAITING:d,CAN_PLAY:p,ENDED:f,SEEKED:h,SEEKING:m,DURATION_CHANGE:"durationchange",VIEW_ENTER:"viewenter",VIEW_LEAVE:"viewleave",SOURCE:"src",REAP:g,QUALITIES:"qualities",QUALITY_CHANGE:"qualitychange",VIDEO_TRACKS:"videoTracks",SET_QUALITY:"quality:set",VIDEO_TRACK_SELECT:"tracks:video:select",RECOMMENDATIONS_READY:"recommendationsready",LANDSCAPE:"landscape",PORTRAIT:"portrait",DVR:"dvr",LIVE:"live",RECOVER:y,SEEK_QUEUED:"seek:queued",SEEK_CANCEL:"seek:cancel",PLUGIN_REGISTERED:"plugin:registered",REMOTE_SESSION_STARTED:"remotesession:started",REMOTE_SESSION_ENDED:"remotesession:ended",INTERSECTIONCHANGE:"intersectionchange",WEBKIT_NEEDKEY:"webkitneedkey",RENDER_PLUGIN:"renderplugin",AUDIO_ONLY_SOURCE:"audioonlysource",NON_RECOVERABLE_ERROR:"error:fatal",CONFIG:"config",STATE:"state",BEFORE_PLAY:"beforeplay",BEFORE_PAUSE:"beforepause",CONTENT_REAL_LOAD_START:v,CUEPOINTS:"cuepoints",CUEPOINT_START:"cuepointstart",CUEPOINT_END:"cuepointend"});function _(){throw new Error("setTimeout has not been defined")}function R(){throw new Error("clearTimeout has not been defined")}var E=_,I=R;function k(e){if(E===setTimeout)return setTimeout(e,0);if((E===_||!E)&&setTimeout)return E=setTimeout,setTimeout(e,0);try{return E(e,0)}catch(t){try{return E.call(null,e,0)}catch(t){return E.call(this,e,0)}}}"function"==typeof e.setTimeout&&(E=setTimeout),"function"==typeof e.clearTimeout&&(I=clearTimeout);var T,L=[],A=!1,O=-1;function N(){A&&T&&(A=!1,T.length?L=T.concat(L):O=-1,L.length&&D())}function D(){if(!A){var e=k(N);A=!0;for(var t=L.length;t;){for(T=L,L=[];++O<t;)T&&T[O].run();O=-1,t=L.length}T=null,A=!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 M(e,t){this.fun=e,this.array=t}M.prototype.run=function(){this.fun.apply(null,this.array)};function U(){}var j=U,W=U,Z=U,V=U,G=U,B=U,Y=U;var z=e.performance||{},K=z.now||z.mozNow||z.msNow||z.oNow||z.webkitNow||function(){return(new Date).getTime()};var H=new Date;var J={nextTick:function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];L.push(new M(e,t)),1!==L.length||A||k(D)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:j,addListener:W,once:Z,off:V,removeListener:G,removeAllListeners:B,emit:Y,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*K.call(z),n=Math.floor(t),r=Math.floor(t%1*1e9);return e&&(n-=e[0],(r-=e[1])<0&&(n--,r+=1e9)),[n,r]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-H)/1e3}},Q=Object.defineProperty,q=Object.defineProperties,ee=Object.getOwnPropertyDescriptors,te=Object.getOwnPropertySymbols,ne=Object.prototype.hasOwnProperty,re=Object.prototype.propertyIsEnumerable,se=(e,t,n)=>t in e?Q(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ie=(e,t)=>{for(var n in t||(t={}))ne.call(t,n)&&se(e,n,t[n]);if(te)for(var n of te(t))re.call(t,n)&&se(e,n,t[n]);return e},oe=(e,t)=>q(e,ee(t)),ae=(e,t)=>{var n={};for(var r in e)ne.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&te)for(var r of te(e))t.indexOf(r)<0&&re.call(e,r)&&(n[r]=e[r]);return n},le=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof e<"u"?e:typeof self<"u"?self:{};function ue(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var de={exports:{}};
2
2
  /*!
3
3
  * js-logger - http://github.com/jonnyreeves/js-logger
4
4
  * Jonny Reeves, http://jonnyreeves.co.uk/
5
5
  * js-logger may be freely distributed under the MIT license.
6
- */!function(e){!function(t){var r,n={VERSION:"1.6.1"},s={},i=function(e,t){return function(){return t.apply(e,arguments)}},o=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,o({level:e},this.context))}};var l=new c({filterLevel:n.OFF});(function(){var e=n;e.enabledFor=i(l,l.enabledFor),e.trace=i(l,l.trace),e.debug=i(l,l.debug),e.time=i(l,l.time),e.timeEnd=i(l,l.timeEnd),e.info=i(l,l.info),e.warn=i(l,l.warn),e.error=i(l,l.error),e.log=e.info})(),n.setHandler=function(e){r=e},n.setLevel=function(e){for(var t in l.setLevel(e),s)s.hasOwnProperty(t)&&s[t].setLevel(e)},n.getLevel=function(){return l.getLevel()},n.get=function(e){return s[e]||(s[e]=new c(o({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 typeof console>"u"?function(){}:function(s,i){s=Array.prototype.slice.call(s);var o,a=console.log;i.level===n.TIME?(o=(i.name?"["+i.name+"] ":"")+s[0],"start"===s[1]?console.time?console.time(o):t[o]=(new Date).getTime():console.timeEnd?console.timeEnd(o):r(a,[o+": "+((new Date).getTime()-t[o])+"ms"])):(i.level===n.WARN&&console.warn?a=console.warn:i.level===n.ERROR&&console.error?a=console.error:i.level===n.INFO&&console.info?a=console.info:i.level===n.DEBUG&&console.debug?a=console.debug:i.level===n.TRACE&&console.trace&&(a=console.trace),e.formatter(s,i),r(a,s))}},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)}(W)}(B);const z=G(B.exports);var Y;const K=(null==(Y=null==window?void 0:window.navigator)?void 0:Y.userAgent)||"No user agent available";let H="",J="",Q="",q="",ee="",te="",re="",ne=0;const se=[];const ie=e=>{H=""===H?e:H},oe=e=>{J=""===J?e:J},ae=e=>{Q=""===Q?e:Q},le=e=>{q=""===q?e:q},ue=e=>{ee=""===ee?e:ee},de=e=>{ne=0===ne?e:ne},he=e=>{te=e},fe=e=>{re=""===re?e:re},pe=e=>{60===se.length&&se.shift(),se.push(e)},me=(e=60,t="JSON")=>{let r;r=!Number.isInteger(e)||e>60||e<=0?60:e;const n={client:"@millicast/millicast-sdk",version:"0.3.2",timestamp:(new Date).toISOString(),userAgent:K,clusterId:re,accountId:H,streamName:J,subscriberId:Q,connection:te,stats:se.slice(-r),connectionDurationMs:(new Date).getTime()-ne};return""!==ee?n.feedId=ee:""!==q&&(n.streamViewId=q),"CMCD"===t?function(e){function t(e,t){return{ts:Math.round(t.timestamp)||"",ot:"audio"===e?"a":"v",bl:t.jitterBufferDelay||0,br:Math.round(t.bitrateBitsPerSecond||0),pld:t.packetsLostDeltaPerSecond||0,j:t.jitter||0,mtp:t.packetRate||0,mid:t.mid||"",mimeType:t.mimeType||""}}return e.stats=e.stats.reduce((e,r)=>{const n=0!==r.audio.inbounds.length?r.audio.inbounds.map(e=>t("audio",e)):r.audio.outbounds.map(e=>t("audio",e)),s=0!==r.video.inbounds.length?r.video.inbounds.map(e=>t("video",e)):r.video.outbounds.map(e=>t("video",e));return e.concat([...n,...s])},[]),e}(n):n};z.useDefaults({defaultLevel:z.TRACE});const ge=["TRACE","DEBUG","INFO","WARN","ERROR"],ye=(e,t)=>{e.unshift("[".concat(t.name||"Global","] ").concat((new Date).toISOString()," - ").concat(t.level.name," -"))},be=(e,t)=>t?e.value>=xe[t].value:e.value>=Re.value,ve=z.createDefaultHandler({formatter:ye});z.setHandler((e,t)=>{((e,t)=>{e=(e=Array.prototype.slice.call(e)).map(e=>"object"==typeof e?JSON.stringify(e):e),ye(e,t),0!==we?(Se.push(e.join(" ")),Se.length>=we&&(Se=Se.slice(-we))):Se=[]})(e,t),be(t.level,t.name)&&ve(e,t);for(const{handler:r,level:n}of ke)t.level.value>=n.value&&r(e,t)});let we=1e4,Se=[],Re=z.OFF;const xe={},ke=[],_e=V(N({},z),{enabledFor:be,getHistory:()=>Se,getHistoryMaxSize:()=>we,setHistoryMaxSize:e=>{we=e},setLevel:e=>{Re=e;for(const t in xe)xe[t]=e},getLevel:()=>Re,get:e=>{xe[e]||(xe[e]=Re);const t=z.get(e);return t.setLevel=t=>{xe[e]=t},t.getLevel=()=>xe[e],t},setHandler:(e,t)=>{ke.push({handler:e,level:t})},diagnose:(e={})=>{let t;const r={statsCount:60,historySize:1e3,minLogLevel:"TRACE",statsFormat:"JSON"};"number"==typeof e?(r.statsCount=e,t=r):t=N(N({},r),e);const{statsCount:n,historySize:s,minLogLevel:i,statsFormat:o}=t,a=me(n,o),c=_e.getHistory();if(!Number.isInteger(s)||s<=0)throw new Error("Invalid Argument Exception : historySize must be a positive integer.");if(!ge.includes(i.toUpperCase()))throw new Error('Invalid Argument Exception : the minLogLevel parameter only excepts "trace", "debug", "info", "warn", and "error" as arguments.');if(ge.includes(i.toUpperCase())){const e=ge.slice(ge.indexOf(i.toUpperCase())),t=c.filter(t=>e.some(e=>t.includes(e)));a.history=t.slice(-s)}return a},JSON:"JSON",CMCD:"CMCD",VERSION:"0.3.2"});var Ce,Ie={exports:{}},Ee="object"==typeof Reflect?Reflect:null,Te=Ee&&"function"==typeof Ee.apply?Ee.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};Ce=Ee&&"function"==typeof Ee.ownKeys?Ee.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var Le=Number.isNaN||function(e){return e!=e};function Ae(){Ae.init.call(this)}Ie.exports=Ae,Ie.exports.once=function(e,t){return new Promise((function(r,n){function s(r){e.removeListener(t,i),n(r)}function i(){"function"==typeof e.removeListener&&e.removeListener("error",s),r([].slice.call(arguments))}We(e,t,i,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&We(e,"error",t,r)}(e,s,{once:!0})}))},Ae.EventEmitter=Ae,Ae.prototype._events=void 0,Ae.prototype._eventsCount=0,Ae.prototype._maxListeners=void 0;var Me=10;function Pe(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function Oe(e){return void 0===e._maxListeners?Ae.defaultMaxListeners:e._maxListeners}function Fe(e,t,r,n){var s,i,o;if(Pe(r),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),i=e._events),o=i[t]),void 0===o)o=i[t]=r,++e._eventsCount;else if("function"==typeof o?o=i[t]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),(s=Oe(e))>0&&o.length>s&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=e,a.type=t,a.count=o.length,function(e){console&&console.warn&&console.warn(e)}(a)}return e}function je(){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 Ze(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},s=je.bind(n);return s.listener=r,n.wrapFn=s,s}function Ne(e,t,r){var n=e._events;if(void 0===n)return[];var s=n[t];return void 0===s?[]:"function"==typeof s?r?[s.listener||s]:[s]: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}(s):Ue(s,s.length)}function Ve(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 Ue(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function We(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 s(i){n.once&&e.removeEventListener(t,s),r(i)}))}}Object.defineProperty(Ae,"defaultMaxListeners",{enumerable:!0,get:function(){return Me},set:function(e){if("number"!=typeof e||e<0||Le(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");Me=e}}),Ae.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},Ae.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||Le(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},Ae.prototype.getMaxListeners=function(){return Oe(this)},Ae.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,s=this._events;if(void 0!==s)n=n&&void 0===s.error;else if(!n)return!1;if(n){var i;if(t.length>0&&(i=t[0]),i instanceof Error)throw i;var o=new Error("Unhandled error."+(i?" ("+i.message+")":""));throw o.context=i,o}var a=s[e];if(void 0===a)return!1;if("function"==typeof a)Te(a,this,t);else{var c=a.length,l=Ue(a,c);for(r=0;r<c;++r)Te(l[r],this,t)}return!0},Ae.prototype.addListener=function(e,t){return Fe(this,e,t,!1)},Ae.prototype.on=Ae.prototype.addListener,Ae.prototype.prependListener=function(e,t){return Fe(this,e,t,!0)},Ae.prototype.once=function(e,t){return Pe(t),this.on(e,Ze(this,e,t)),this},Ae.prototype.prependOnceListener=function(e,t){return Pe(t),this.prependListener(e,Ze(this,e,t)),this},Ae.prototype.removeListener=function(e,t){var r,n,s,i,o;if(Pe(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(s=-1,i=r.length-1;i>=0;i--)if(r[i]===t||r[i].listener===t){o=r[i].listener,s=i;break}if(s<0)return this;0===s?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,s),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,o||t)}return this},Ae.prototype.off=Ae.prototype.removeListener,Ae.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 s,i=Object.keys(r);for(n=0;n<i.length;++n)"removeListener"!==(s=i[n])&&this.removeAllListeners(s);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},Ae.prototype.listeners=function(e){return Ne(this,e,!0)},Ae.prototype.rawListeners=function(e){return Ne(this,e,!1)},Ae.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):Ve.call(e,t)},Ae.prototype.listenerCount=Ve,Ae.prototype.eventNames=function(){return this._eventsCount>0?Ce(this._events):[]};var Ge=Ie.exports;const Be=G(Ge);var Xe={exports:{}};Xe.exports=Ye,Xe.exports.filter=function(e,t){var r=new ze;return Ye(e,r,t),r};var ze=Ge.EventEmitter;function Ye(e,t,r){Array.isArray(r)||(r=[r]);var n=[];return r.forEach((function(r){var s=function(){var e=[].slice.call(arguments);e.unshift(r),t.emit.apply(t,e)};n.push(s),e.on(r,s)})),function(){r.forEach((function(t,r){e.removeListener(t,n[r])}))}}const $e=G(Xe.exports);var Ke={exports:{}};
7
- /*! For license information please see webrtc-stats.js.LICENSE.txt */!function(e,t){!function(t,r){e.exports=r()}(self,()=>{return e={7:e=>{var t,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var s=Number.isNaN||function(e){return e!=e};function i(){i.init.call(this)}e.exports=i,e.exports.once=function(e,t){return new Promise((function(r,n){function s(r){e.removeListener(t,i),n(r)}function i(){"function"==typeof e.removeListener&&e.removeListener("error",s),r([].slice.call(arguments))}m(e,t,i,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&m(e,"error",t,{once:!0})}(e,s)}))},i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var o=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?i.defaultMaxListeners:e._maxListeners}function l(e,t,r,n){var s,i,o,l;if(a(r),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),i=e._events),o=i[t]),void 0===o)o=i[t]=r,++e._eventsCount;else if("function"==typeof o?o=i[t]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),(s=c(e))>0&&o.length>s&&!o.warned){o.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=o.length,l=u,console&&console.warn&&console.warn(l)}return e}function u(){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 d(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},s=u.bind(n);return s.listener=r,n.wrapFn=s,s}function h(e,t,r){var n=e._events;if(void 0===n)return[];var s=n[t];return void 0===s?[]:"function"==typeof s?r?[s.listener||s]:[s]: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}(s):p(s,s.length)}function f(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 p(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function m(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 s(i){n.once&&e.removeEventListener(t,s),r(i)}))}}Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(e){if("number"!=typeof e||e<0||s(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");o=e}}),i.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},i.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||s(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},i.prototype.getMaxListeners=function(){return c(this)},i.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var s="error"===e,i=this._events;if(void 0!==i)s=s&&void 0===i.error;else if(!s)return!1;if(s){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var c=i[e];if(void 0===c)return!1;if("function"==typeof c)n(c,this,t);else{var l=c.length,u=p(c,l);for(r=0;r<l;++r)n(u[r],this,t)}return!0},i.prototype.addListener=function(e,t){return l(this,e,t,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(e,t){return l(this,e,t,!0)},i.prototype.once=function(e,t){return a(t),this.on(e,d(this,e,t)),this},i.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,d(this,e,t)),this},i.prototype.removeListener=function(e,t){var r,n,s,i,o;if(a(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(s=-1,i=r.length-1;i>=0;i--)if(r[i]===t||r[i].listener===t){o=r[i].listener,s=i;break}if(s<0)return this;0===s?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,s),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,o||t)}return this},i.prototype.off=i.prototype.removeListener,i.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 s,i=Object.keys(r);for(n=0;n<i.length;++n)"removeListener"!==(s=i[n])&&this.removeAllListeners(s);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},i.prototype.listeners=function(e){return h(this,e,!0)},i.prototype.rawListeners=function(e){return h(this,e,!1)},i.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):f.call(e,t)},i.prototype.listenerCount=f,i.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},586:function(e,t,r){var n,s;!function(i){var o,a={VERSION:"1.6.1"},c={},l=function(e,t){return function(){return t.apply(e,arguments)}},u=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},d=function(e,t){return{value:e,name:t}};a.TRACE=d(1,"TRACE"),a.DEBUG=d(2,"DEBUG"),a.INFO=d(3,"INFO"),a.TIME=d(4,"TIME"),a.WARN=d(5,"WARN"),a.ERROR=d(8,"ERROR"),a.OFF=d(99,"OFF");var h=function(e){this.context=e,this.setLevel(e.filterLevel),this.log=this.info};h.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(a.TRACE,arguments)},debug:function(){this.invoke(a.DEBUG,arguments)},info:function(){this.invoke(a.INFO,arguments)},warn:function(){this.invoke(a.WARN,arguments)},error:function(){this.invoke(a.ERROR,arguments)},time:function(e){"string"==typeof e&&e.length>0&&this.invoke(a.TIME,[e,"start"])},timeEnd:function(e){"string"==typeof e&&e.length>0&&this.invoke(a.TIME,[e,"end"])},invoke:function(e,t){o&&this.enabledFor(e)&&o(t,u({level:e},this.context))}};var f,p=new h({filterLevel:a.OFF});(f=a).enabledFor=l(p,p.enabledFor),f.trace=l(p,p.trace),f.debug=l(p,p.debug),f.time=l(p,p.time),f.timeEnd=l(p,p.timeEnd),f.info=l(p,p.info),f.warn=l(p,p.warn),f.error=l(p,p.error),f.log=f.info,a.setHandler=function(e){o=e},a.setLevel=function(e){for(var t in p.setLevel(e),c)c.hasOwnProperty(t)&&c[t].setLevel(e)},a.getLevel=function(){return p.getLevel()},a.get=function(e){return c[e]||(c[e]=new h(u({name:e},p.context)))},a.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 typeof console>"u"?function(){}:function(n,s){n=Array.prototype.slice.call(n);var i,o=console.log;s.level===a.TIME?(i=(s.name?"["+s.name+"] ":"")+n[0],"start"===n[1]?console.time?console.time(i):t[i]=(new Date).getTime():console.timeEnd?console.timeEnd(i):r(o,[i+": "+((new Date).getTime()-t[i])+"ms"])):(s.level===a.WARN&&console.warn?o=console.warn:s.level===a.ERROR&&console.error?o=console.error:s.level===a.INFO&&console.info?o=console.info:s.level===a.DEBUG&&console.debug?o=console.debug:s.level===a.TRACE&&console.trace&&(o=console.trace),e.formatter(n,s),r(o,n))}},a.useDefaults=function(e){a.setLevel(e&&e.defaultLevel||a.DEBUG),a.setHandler(a.createDefaultHandler(e))},a.setDefaults=a.useDefaults,void 0===(s="function"==typeof(n=a)?n.call(t,r,t,e):n)||(e.exports=s)}()},156:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Logger=void 0;var o=r(586);Object.defineProperty(t,"Logger",{enumerable:!0,get:function(){return i(o).default}}),s(r(284),t),s(r(280),t),s(r(738),t),s(r(767),t)},738:(e,t)=>{var r;Object.defineProperty(t,"__esModule",{value:!0}),t.QualityLimitationReason=void 0,function(e){e[e.none=0]="none",e[e.cpu=1]="cpu",e[e.bandwidth=2]="bandwidth",e[e.other=3]="other"}(r||(t.QualityLimitationReason=r={}))},280:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},767:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},185:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.calculatePacketsLostRatio=t.calculateRate=t.getMediaKind=void 0,t.getMediaKind=e=>{let t=e.kind||e.mediaType;return["audio","video"].includes(t)||"inbound-rtp"!==e.type||(t=e.id.toLocaleLowerCase().includes("video")?"video":"audio"),t},t.calculateRate=(e,t,r,n)=>r&&n?(t-n)/((e-r)/1e3):0,t.calculatePacketsLostRatio=(e,t,r,n)=>0==t?0:(e-(null!=r?r:0))/(t-(null!=n?n:0))},284:function(e,t,r){var n,s,i,o,a,c,l,u,d,h,f,p,m,g,y,v,w=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(s,i){function o(e){try{c(n.next(e))}catch(e){i(e)}}function a(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))},R=this&&this.__classPrivateFieldSet||function(e,t,r,n,s){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?s.call(e,r):s?s.value=r:t.set(e,r),r},k=this&&this.__classPrivateFieldGet||function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)},_=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.WebRTCStats=void 0;const I=r(7),E=_(r(586)),T=r(738),L=r(185);class X extends I.EventEmitter{constructor(e){super(),n.add(this),s.set(this,void 0),i.set(this,void 0),o.set(this,void 0),a.set(this,null),c.set(this,void 0),l.set(this,null),this.start=()=>{k(this,c,"f").info("WebRTC statistics collection is starting..."),R(this,l,null,"f"),R(this,a,setInterval(k(this,u,"f"),k(this,i,"f")),"f")},this.stop=()=>{k(this,a,"f")&&(clearInterval(k(this,a,"f")),R(this,a,null,"f"),k(this,c,"f").info("WebRTC statistics collection has stopped."))},u.set(this,()=>w(this,void 0,void 0,(function*(){let e,t;try{k(this,c,"f").trace("Requesting WebRTC statistics..."),e=yield k(this,s,"f").call(this),t=(new Date).toISOString()}catch(e){return k(this,c,"f").error("Problem collecting the WebRTC statistics.",e),void this.emit("error","Problem collecting the WebRTC statistics - ".concat(e))}const r=Array.from(e.values()),i={timestamp:t,input:{audio:[],video:[]},output:{audio:[],video:[]}};k(this,o,"f")&&(i.rawStats=e);for(let t=0;t<Object.keys(r).length;t++){const s=r[t];switch(s.type){case"outbound-rtp":const t=s,r=(0,L.getMediaKind)(t);"audio"===r?yield k(this,n,"m",f).call(this,e,t,i):"video"===r&&(yield k(this,n,"m",p).call(this,e,t,i));break;case"inbound-rtp":const o=s;let a=(0,L.getMediaKind)(o);"audio"===a?yield k(this,n,"m",g).call(this,e,o,i):"video"===a&&(yield k(this,n,"m",y).call(this,e,o,i));break;case"candidate-pair":const c=s;c.nominated&&k(this,n,"m",v).call(this,c,i)}}R(this,l,i,"f"),this.emit("stats",i)}))),R(this,c,E.default.get("WebRTCStats"),"f"),R(this,s,e.getStats,"f"),R(this,i,e.getStatsInterval||1e3,"f"),R(this,o,!!e.includeRawStats,"f")}}t.WebRTCStats=X,s=new WeakMap,i=new WeakMap,o=new WeakMap,a=new WeakMap,c=new WeakMap,l=new WeakMap,u=new WeakMap,n=new WeakSet,d=function(e,t){if(t){const r=e.get(t);if(r)return{mimeType:r.mimeType}}return{}},h=function(e,t,r){return w(this,void 0,void 0,(function*(){var s,i,o,a;const c=(0,L.calculateRate)(t.timestamp,t.bytesSent,null==r?void 0:r.timestamp,null==r?void 0:r.totalBytesSent),l=(0,L.calculateRate)(t.timestamp,t.packetsSent,null==r?void 0:r.timestamp,null==r?void 0:r.totalPacketsSent),u=k(this,n,"m",d).call(this,e,t.codecId);return Object.assign({id:t.id,timestamp:t.timestamp,mid:t.mid,totalBytesSent:t.bytesSent,bytesSentDelta:t.bytesSent-(null!==(s=null==r?void 0:r.totalBytesSent)&&void 0!==s?s:0),totalPacketsSent:t.packetsSent,packetsSentDelta:t.packetsSent-(null!==(i=null==r?void 0:r.totalPacketsSent)&&void 0!==i?i:0),bitrate:c,packetRate:l,targetBitrate:t.targetBitrate,retransmittedPacketsSent:t.retransmittedPacketsSent,retransmittedPacketsSentDelta:t.retransmittedPacketsSent-(null!==(o=null==r?void 0:r.retransmittedPacketsSent)&&void 0!==o?o:0),retransmittedBytesSent:t.retransmittedBytesSent,retransmittedBytesSentDelta:t.retransmittedBytesSent-(null!==(a=null==r?void 0:r.retransmittedBytesSent)&&void 0!==a?a:0)},u)}))},f=function(e,t,r){return w(this,void 0,void 0,(function*(){var s;const i=null===(s=k(this,l,"f"))||void 0===s?void 0:s.output.audio.find(e=>e.id===t.id);if(i&&t.timestamp-i.timestamp<=0)return;const o=yield k(this,n,"m",h).call(this,e,t,i),a=Object.assign({},o);r.output.audio.push(a)}))},p=function(e,t,r){return w(this,void 0,void 0,(function*(){var s;const i=null===(s=k(this,l,"f"))||void 0===s?void 0:s.output.video.find(e=>e.id===t.id);if(i&&t.timestamp-i.timestamp<=0)return;const o=yield k(this,n,"m",h).call(this,e,t,i);let a=T.QualityLimitationReason.none;t.qualityLimitationReason&&(a=t.qualityLimitationReason);const c=Object.assign(Object.assign({},o),{frameWidth:t.frameWidth,frameHeight:t.frameHeight,framesPerSecond:t.framesPerSecond,framesSent:t.framesSent,qualityLimitationReason:a,qualityLimitationDurations:t.qualityLimitationDurations});r.output.video.push(c)}))},m=function(e,t,r){return w(this,void 0,void 0,(function*(){var s,i;const o=(0,L.calculateRate)(t.timestamp,t.bytesReceived,null==r?void 0:r.timestamp,null==r?void 0:r.totalBytesReceived),a=(0,L.calculateRate)(t.timestamp,t.packetsReceived,null==r?void 0:r.timestamp,null==r?void 0:r.totalPacketsReceived),c=(0,L.calculatePacketsLostRatio)(t.packetsReceived,t.packetsLost,null==r?void 0:r.totalPacketsReceived,null==r?void 0:r.totalPacketsLost),l=(null!==(s=t.packetsLost)&&void 0!==s?s:0)-(null!==(i=null==r?void 0:r.totalPacketsLost)&&void 0!==i?i:0),u=k(this,n,"m",d).call(this,e,t.codecId);return Object.assign({id:t.id,timestamp:t.timestamp,mid:t.mid,trackIdentifier:t.trackIdentifier,jitter:t.jitter,jitterBufferDelay:t.jitterBufferDelay,jitterBufferEmittedCount:t.jitterBufferEmittedCount,totalBytesReceived:t.bytesReceived,totalPacketsReceived:t.packetsReceived,totalPacketsLost:t.packetsLost,bitrate:o,packetRate:a,packetLossRatio:c,packetLossDelta:l},u)}))},g=function(e,t,r){return w(this,void 0,void 0,(function*(){var s;const i=null===(s=k(this,l,"f"))||void 0===s?void 0:s.input.audio.find(e=>e.id===t.id);if(i&&t.timestamp-i.timestamp<=0)return;const o=yield k(this,n,"m",m).call(this,e,t,i);r.input.audio.push(o)}))},y=function(e,t,r){return w(this,void 0,void 0,(function*(){var s;const i=null===(s=k(this,l,"f"))||void 0===s?void 0:s.input.video.find(e=>e.id===t.id);if(i&&t.timestamp-i.timestamp<=0)return;const o=yield k(this,n,"m",m).call(this,e,t,i),a=Object.assign(Object.assign({},o),{keyFramesDecoded:t.keyFramesDecoded,frameHeight:t.frameHeight,frameWidth:t.frameWidth,framesDecoded:t.framesDecoded,framesDropped:t.framesDropped,framesPerSecond:t.framesPerSecond,framesReceived:t.framesReceived});r.input.video.push(a)}))},v=function(e,t){t.totalRoundTripTime=e.totalRoundTripTime,t.currentRoundTripTime=e.currentRoundTripTime,t.responsesReceived=e.responsesReceived,t.availableOutgoingBitrate=e.availableOutgoingBitrate,t.availableIncomingBitrate=e.availableIncomingBitrate}}},t={},function r(n){var s=t[n];if(void 0!==s)return s.exports;var i=t[n]={exports:{}};return e[n].call(i.exports,i,i.exports,r),i.exports}(156);var e,t})}(Ke);var He=Ke.exports;const Je=_e.get("PeerConnectionStats"),Qe="stats";class Ji extends Be{constructor(e,t={statsIntervalMs:1e3,autoInitStats:!0}){super(),this.peer=e,this.collection=null,this.initialized=!1,t.autoInitStats&&this.init(t.statsIntervalMs)}init(e){if(this.initialized)return void Je.warn("PeerConnectionStats.init() has already been called. Automatic initialization occurs when the PeerConnectionStats object is constructed.");Je.info("Initializing peer connection stats");const t=this.peer;try{this.collection=new He.WebRTCStats({getStatsInterval:e,getStats:()=>t.getStats(),includeRawStats:!0}),this.collection.on("stats",e=>{const t=(e=>{const t=U(e,["input","output","rawStats"]);return V(N({},t),{audio:{inbounds:e.input.audio.map(e=>{var t=e,{packetLossRatio:r,packetLossDelta:n,bitrate:s}=t,i=U(t,["packetLossRatio","packetLossDelta","bitrate"]);return N({packetsLostRatioPerSecond:r,packetsLostDeltaPerSecond:n,bitrateBitsPerSecond:8*s,bitrate:s},i)}),outbounds:e.output.audio.map(e=>{var t=e,{packetLossRatio:r,packetLossDelta:n,bitrate:s}=t,i=U(t,["packetLossRatio","packetLossDelta","bitrate"]);return N({packetsLostRatioPerSecond:r,packetsLostDeltaPerSecond:n,bitrateBitsPerSecond:8*s,bitrate:s},i)})},video:{inbounds:e.input.video.map(e=>{var t=e,{packetLossRatio:r,packetLossDelta:n,bitrate:s}=t,i=U(t,["packetLossRatio","packetLossDelta","bitrate"]);return N({packetsLostRatioPerSecond:r,packetsLostDeltaPerSecond:n,bitrateBitsPerSecond:8*s,bitrate:s},i)}),outbounds:e.output.video.map(e=>{var t=e,{packetLossRatio:r,packetLossDelta:n,bitrate:s}=t,i=U(t,["packetLossRatio","packetLossDelta","bitrate"]);return N({packetsLostRatioPerSecond:r,packetsLostDeltaPerSecond:n,bitrateBitsPerSecond:8*s,bitrate:s},i)})},raw:e.rawStats})})(e);pe(t),this.emit(Qe,t)}),this.collection.start(),this.initialized=!0}catch(e){Je.error(e)}}parseStats(e){return Je.warn("The parseStats method is deprecated and will be removed in future releases."),null}stop(){Je.info("Stopping peer connection stats"),this.collection.stop()}}var qe={},et={},nt={},st={exports:{}},it=st.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(e){return null!=e.address?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(e){return null!=e.subtype?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(e){return"extmap:%d"+(e.direction?"/%s":"%v")+(e["encrypt-uri"]?" %s":"%v")+" %s"+(e.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return null!=e.sessionConfig?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(e){var t="candidate:%s %d %s %d %s %d typ %s";return t+=null!=e.raddr?" raddr %s rport %d":"%v%v",t+=null!=e.tcptype?" tcptype %s":"%v",null!=e.generation&&(t+=" generation %d"),t+=null!=e["network-id"]?" network-id %d":"%v",t+=null!=e["network-cost"]?" network-cost %d":"%v"}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(e){var t="ssrc:%d";return null!=e.attribute&&(t+=" %s",null!=e.value&&(t+=":%s")),t}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(e){return null!=e.maxMessageSize?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(e){return e.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(e){return"imageattr:%s %s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(e){return"simulcast:%s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(e){return"ts-refclk:%s"+(null!=e.clksrcExt?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(e){var t="mediaclk:";return t+=null!=e.id?"id=%s %s":"%v%s",t+=null!=e.mediaClockValue?"=%s":"",t+=null!=e.rateNumerator?" rate=%s":"",t+=null!=e.rateDenominator?"/%s":""}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]};Object.keys(it).forEach((function(e){it[e].forEach((function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")}))}));var ot=st.exports;!function(e){var t=function(e){return String(Number(e))===e?Number(e):e},r=function(e,r,n){var s=e.name&&e.names;e.push&&!r[e.push]?r[e.push]=[]:s&&!r[e.name]&&(r[e.name]={});var i=e.push?{}:s?r[e.name]:r;(function(e,r,n,s){if(s&&!n)r[s]=t(e[1]);else for(var i=0;i<n.length;i+=1)null!=e[i+1]&&(r[n[i]]=t(e[i+1]))})(n.match(e.reg),i,e.names,e.name),e.push&&r[e.push].push(i)},n=ot,s=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t={},i=[],o=t;return e.split(/(\r\n|\r|\n)/).filter(s).forEach((function(e){var t=e[0],s=e.slice(2);"m"===t&&(i.push({rtp:[],fmtp:[]}),o=i[i.length-1]);for(var a=0;a<(n[t]||[]).length;a+=1){var c=n[t][a];if(c.reg.test(s))return r(c,o,s)}})),t.media=i,t};var i=function(e,r){var n=r.split(/=(.+)/,2);return 2===n.length?e[n[0]]=t(n[1]):1===n.length&&r.length>1&&(e[n[0]]=void 0),e};e.parseParams=function(e){return e.split(/;\s?/).reduce(i,{})},e.parseFmtpConfig=e.parseParams,e.parsePayloads=function(e){return e.toString().split(" ").map(Number)},e.parseRemoteCandidates=function(e){for(var r=[],n=e.split(" ").map(t),s=0;s<n.length;s+=3)r.push({component:n[s],ip:n[s+1],port:n[s+2]});return r},e.parseImageAttributes=function(e){return e.split(" ").map((function(e){return e.substring(1,e.length-1).split(",").reduce(i,{})}))},e.parseSimulcastStreamList=function(e){return e.split(";").map((function(e){return e.split(",").map((function(e){var r,n=!1;return"~"!==e[0]?r=t(e):(r=t(e.substring(1,e.length)),n=!0),{scid:r,paused:n}}))}))}}(nt);var at=ot,ct=/%[sdv%]/g,lt=function(e){var t=1,r=arguments,n=r.length;return e.replace(ct,(function(e){if(t>=n)return e;var s=r[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(s);case"%d":return Number(s);case"%v":return""}}))},ut=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 s=0;s<t.names.length;s+=1){var i=t.names[s];t.name?n.push(r[t.name][i]):n.push(r[t.names[s]])}else n.push(r[t.name]);return lt.apply(null,n)},dt=["v","o","s","i","u","e","p","c","b","t","r","z","a"],ht=["i","c","b","a"],ft=nt,pt=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||dt,n=t.innerOrder||ht,s=[];return r.forEach((function(t){at[t].forEach((function(r){r.name in e&&null!=e[r.name]?s.push(ut(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){s.push(ut(t,r,e))}))}))})),e.media.forEach((function(e){s.push(ut("m",at.m[0],e)),n.forEach((function(t){at[t].forEach((function(r){r.name in e&&null!=e[r.name]?s.push(ut(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){s.push(ut(t,r,e))}))}))}))})),s.join("\r\n")+"\r\n"};et.write=pt,et.parse=ft.parse,et.parseParams=ft.parseParams,et.parseFmtpConfig=ft.parseFmtpConfig,et.parsePayloads=ft.parsePayloads,et.parseRemoteCandidates=ft.parseRemoteCandidates,et.parseImageAttributes=ft.parseImageAttributes,et.parseSimulcastStreamList=ft.parseSimulcastStreamList;let mt=class Us{constructor(e,t,r,n,s,i,o,a,c){this.foundation=e,this.componentId=t,this.transport=r,this.priority=n,this.address=s,this.port=i,this.type=o,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 Us(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}};mt.expand=function(e){return"CandidateInfo"===e.constructor.name?e:new mt((e=e).foundation,e.componentId,e.transport,e.priority,e.address,e.port,e.type,e.relAddr,e.relPort)},mt.clone=function(e){return"CandidateInfo"===e.constructor.name?e.clone():mt.expand(e)};var gt=mt;let yt=class $s{constructor(e,t){this.id=e,this.params=t||[]}clone(){return new $s(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}};yt.expand=function(e){return"RTCPFeedbackInfo"===e.constructor.name?e:new yt((e=e).id,e.params)},yt.clone=function(e){return"RTCPFeedbackInfo"===e.constructor.name?e.clone():yt.expand(e)};var bt=yt;const vt=bt;let wt=class Bs{constructor(e,t,r){this.codec=e,this.type=t,this.params={},this.rtcpfbs=new Set,r&&this.addParams(r)}clone(){const e=new Bs(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 Object.hasOwnProperty.call(this.params,e)}getParam(e,t){if(this.hasParam(e))return this.params[e];if(void 0===t)throw new Error("param ".concat(e," not found and no default value provided"));return""+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}};wt.expand=function(e){if("CodecInfo"===e.constructor.name)return e;const t=new wt((e=e).codec,e.type,e.params);e.rtx&&t.setRTX(e.rtx),e.channels&&t.setChannels(e.channels);for(const r of e.rtcpfbs||[]){const e=vt.expand(r);t.addRTCPFeedback(e)}return t},wt.clone=function(e){return"CodecInfo"===e.constructor.name?e.clone():wt.expand(e)},wt.MapFromNames=function(e,t,r){var n;const s=new Map;let i=96;for(const o of e){let e;const a=o.split(";"),c=a.shift().toLowerCase().trim();e="pcmu"===c?0:"pcma"===c?8:++i;const l=new wt(c,e);"opus"===c?l.setChannels(2):"multiopus"===c&&l.setChannels(6),t&&"ulpfec"!==c&&"flexfec-03"!==c&&"red"!==c&&l.setRTX(++i);for(const e of r||[])l.addRTCPFeedback(new vt(e.id,e.params));for(const e of a){let t=e.split("=");l.addParam(t[0].trim(),null===(n=t[1])||void 0===n?void 0:n.trim())}s.set(e,l)}return s};var St=wt;var Rt=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 xt=Rt("ACTIVE","PASSIVE","ACTPASS","INACTIVE");xt.byValue=function(e){switch(e){case xt.ACTIVE:case xt.PASSIVE:case xt.ACTPASS:case xt.INACTIVE:return e}return xt[e.toUpperCase()]},xt.toString=function(e){switch(e){case xt.ACTIVE:return"active";case xt.PASSIVE:return"passive";case xt.ACTPASS:return"actpass";case xt.INACTIVE:return"inactive"}},xt.reverse=function(e,t){switch(e){case xt.ACTIVE:return xt.PASSIVE;case xt.PASSIVE:return xt.ACTIVE;case xt.ACTPASS:return t?xt.ACTIVE:xt.PASSIVE;case xt.INACTIVE:return xt.INACTIVE}};var kt=xt;const _t=kt;let Ct=class Gs{constructor(e,t,r){this.setup=e,this.hash=t,this.fingerprint=r}clone(){return new Gs(this.setup,this.hash,this.fingerprint)}plain(){return{setup:_t.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}};Ct.expand=function(e){return"DTLSInfo"===e.constructor.name?e:new Ct((e=e).setup?_t.byValue(e.setup):_t.ACTPASS,e.hash,e.fingerprint)},Ct.clone=function(e){return"DTLSInfo"===e.constructor.name?e.clone():Ct.expand(e)};var It=Ct;let Et=class Ys{constructor(e,t,r,n){this.tag=e,this.suite=t,this.keyParams=r,this.sessionParams=n}clone(){return new Ys(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}};Et.expand=function(e){return"CryptoInfo"===e.constructor.name?e:new Et((e=e).tag,e.suite,e.keyParams,e.sessionParams)},Et.clone=function(e){return"CryptoInfo"===e.constructor.name?e.clone():Et.expand(e)};for(var Tt=Et,Lt={exports:{}},At={exports:{}},Mt={},Pt={byteLength:function(e){var t=Vt(e),r=t[0],n=t[1];return 3*(r+n)/4-n},toByteArray:function(e){var t,r,n=Vt(e),s=n[0],i=n[1],o=new Ft(function(e,t,r){return 3*(t+r)/4-r}(0,s,i)),a=0,c=i>0?s-4:s;for(r=0;r<c;r+=4)t=Dt[e.charCodeAt(r)]<<18|Dt[e.charCodeAt(r+1)]<<12|Dt[e.charCodeAt(r+2)]<<6|Dt[e.charCodeAt(r+3)],o[a++]=t>>16&255,o[a++]=t>>8&255,o[a++]=255&t;return 2===i&&(t=Dt[e.charCodeAt(r)]<<2|Dt[e.charCodeAt(r+1)]>>4,o[a++]=255&t),1===i&&(t=Dt[e.charCodeAt(r)]<<10|Dt[e.charCodeAt(r+1)]<<4|Dt[e.charCodeAt(r+2)]>>2,o[a++]=t>>8&255,o[a++]=255&t),o},fromByteArray:function(e){for(var t,r=e.length,n=r%3,s=[],i=16383,o=0,a=r-n;o<a;o+=i)s.push(Wt(e,o,o+i>a?a:o+i));return 1===n?(t=e[r-1],s.push(Ot[t>>2]+Ot[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],s.push(Ot[t>>10]+Ot[t>>4&63]+Ot[t<<2&63]+"=")),s.join("")}},Ot=[],Dt=[],Ft=typeof Uint8Array<"u"?Uint8Array:Array,jt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Zt=0,Nt=jt.length;Zt<Nt;++Zt)Ot[Zt]=jt[Zt],Dt[jt.charCodeAt(Zt)]=Zt;function Vt(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 Ut(e){return Ot[e>>18&63]+Ot[e>>12&63]+Ot[e>>6&63]+Ot[63&e]}function Wt(e,t,r){for(var n,s=[],i=t;i<r;i+=3)n=(e[i]<<16&16711680)+(e[i+1]<<8&65280)+(255&e[i+2]),s.push(Ut(n));return s.join("")}Dt[45]=62,Dt[95]=63;var Gt={
6
+ */!function(e){!function(t){var n,r={VERSION:"1.6.1"},s={},i=function(e,t){return function(){return t.apply(e,arguments)}},o=function(){var e,t,n=arguments,r=n[0];for(t=1;t<n.length;t++)for(e in n[t])!(e in r)&&n[t].hasOwnProperty(e)&&(r[e]=n[t][e]);return r},a=function(e,t){return{value:e,name:t}};r.TRACE=a(1,"TRACE"),r.DEBUG=a(2,"DEBUG"),r.INFO=a(3,"INFO"),r.TIME=a(4,"TIME"),r.WARN=a(5,"WARN"),r.ERROR=a(8,"ERROR"),r.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(r.TRACE,arguments)},debug:function(){this.invoke(r.DEBUG,arguments)},info:function(){this.invoke(r.INFO,arguments)},warn:function(){this.invoke(r.WARN,arguments)},error:function(){this.invoke(r.ERROR,arguments)},time:function(e){"string"==typeof e&&e.length>0&&this.invoke(r.TIME,[e,"start"])},timeEnd:function(e){"string"==typeof e&&e.length>0&&this.invoke(r.TIME,[e,"end"])},invoke:function(e,t){n&&this.enabledFor(e)&&n(t,o({level:e},this.context))}};var l=new c({filterLevel:r.OFF});(function(){var e=r;e.enabledFor=i(l,l.enabledFor),e.trace=i(l,l.trace),e.debug=i(l,l.debug),e.time=i(l,l.time),e.timeEnd=i(l,l.timeEnd),e.info=i(l,l.info),e.warn=i(l,l.warn),e.error=i(l,l.error),e.log=e.info})(),r.setHandler=function(e){n=e},r.setLevel=function(e){for(var t in l.setLevel(e),s)s.hasOwnProperty(t)&&s[t].setLevel(e)},r.getLevel=function(){return l.getLevel()},r.get=function(e){return s[e]||(s[e]=new c(o({name:e},l.context)))},r.createDefaultHandler=function(e){(e=e||{}).formatter=e.formatter||function(e,t){t.name&&e.unshift("["+t.name+"]")};var t={},n=function(e,t){Function.prototype.apply.call(e,console,t)};return typeof console>"u"?function(){}:function(s,i){s=Array.prototype.slice.call(s);var o,a=console.log;i.level===r.TIME?(o=(i.name?"["+i.name+"] ":"")+s[0],"start"===s[1]?console.time?console.time(o):t[o]=(new Date).getTime():console.timeEnd?console.timeEnd(o):n(a,[o+": "+((new Date).getTime()-t[o])+"ms"])):(i.level===r.WARN&&console.warn?a=console.warn:i.level===r.ERROR&&console.error?a=console.error:i.level===r.INFO&&console.info?a=console.info:i.level===r.DEBUG&&console.debug?a=console.debug:i.level===r.TRACE&&console.trace&&(a=console.trace),e.formatter(s,i),n(a,s))}},r.useDefaults=function(e){r.setLevel(e&&e.defaultLevel||r.DEBUG),r.setHandler(r.createDefaultHandler(e))},r.setDefaults=r.useDefaults,e.exports?e.exports=r:(r._prevLogger=t.Logger,r.noConflict=function(){return t.Logger=r._prevLogger,r},t.Logger=r)}(le)}(de);const pe=ue(de.exports);var fe;const he=(null==(fe=null==window?void 0:window.navigator)?void 0:fe.userAgent)||"No user agent available";let me="",ge="",ye="",ve="",be="",we="",Se="",_e=0;const Re=[];const Ee=e=>{me=""===me?e:me},Ie=e=>{ge=""===ge?e:ge},ke=e=>{ye=""===ye?e:ye},xe=e=>{ve=""===ve?e:ve},Te=e=>{be=""===be?e:be},Ce=e=>{_e=0===_e?e:_e},Le=e=>{we=e},Ae=e=>{Se=""===Se?e:Se},Oe=e=>{60===Re.length&&Re.shift(),Re.push(e)},Pe=(e=60,t="JSON")=>{let n;n=!Number.isInteger(e)||e>60||e<=0?60:e;const r={client:"@millicast/millicast-sdk",version:"0.3.2",timestamp:(new Date).toISOString(),userAgent:he,clusterId:Se,accountId:me,streamName:ge,subscriberId:ye,connection:we,stats:Re.slice(-n),connectionDurationMs:(new Date).getTime()-_e};return""!==be?r.feedId=be:""!==ve&&(r.streamViewId=ve),"CMCD"===t?function(e){function t(e,t){return{ts:Math.round(t.timestamp)||"",ot:"audio"===e?"a":"v",bl:t.jitterBufferDelay||0,br:Math.round(t.bitrateBitsPerSecond||0),pld:t.packetsLostDeltaPerSecond||0,j:t.jitter||0,mtp:t.packetRate||0,mid:t.mid||"",mimeType:t.mimeType||""}}return e.stats=e.stats.reduce((e,n)=>{const r=0!==n.audio.inbounds.length?n.audio.inbounds.map(e=>t("audio",e)):n.audio.outbounds.map(e=>t("audio",e)),s=0!==n.video.inbounds.length?n.video.inbounds.map(e=>t("video",e)):n.video.outbounds.map(e=>t("video",e));return e.concat([...r,...s])},[]),e}(r):r};pe.useDefaults({defaultLevel:pe.TRACE});const Ne=["TRACE","DEBUG","INFO","WARN","ERROR"],Me=(e,t)=>{e.unshift("[".concat(t.name||"Global","] ").concat((new Date).toISOString()," - ").concat(t.level.name," -"))},Fe=(e,t)=>t?e.value>=Ve[t].value:e.value>=Ze.value,Ue=pe.createDefaultHandler({formatter:Me});pe.setHandler((e,t)=>{((e,t)=>{e=(e=Array.prototype.slice.call(e)).map(e=>"object"==typeof e?JSON.stringify(e):e),Me(e,t),0!==je?(We.push(e.join(" ")),We.length>=je&&(We=We.slice(-je))):We=[]})(e,t),Fe(t.level,t.name)&&Ue(e,t);for(const{handler:n,level:r}of Ge)t.level.value>=r.value&&n(e,t)});let je=1e4,We=[],Ze=pe.OFF;const Ve={},Ge=[],Be=oe(ie({},pe),{enabledFor:Fe,getHistory:()=>We,getHistoryMaxSize:()=>je,setHistoryMaxSize:e=>{je=e},setLevel:e=>{Ze=e;for(const t in Ve)Ve[t]=e},getLevel:()=>Ze,get:e=>{Ve[e]||(Ve[e]=Ze);const t=pe.get(e);return t.setLevel=t=>{Ve[e]=t},t.getLevel=()=>Ve[e],t},setHandler:(e,t)=>{Ge.push({handler:e,level:t})},diagnose:(e={})=>{let t;const n={statsCount:60,historySize:1e3,minLogLevel:"TRACE",statsFormat:"JSON"};"number"==typeof e?(n.statsCount=e,t=n):t=ie(ie({},n),e);const{statsCount:r,historySize:s,minLogLevel:i,statsFormat:o}=t,a=Pe(r,o),c=Be.getHistory();if(!Number.isInteger(s)||s<=0)throw new Error("Invalid Argument Exception : historySize must be a positive integer.");if(!Ne.includes(i.toUpperCase()))throw new Error('Invalid Argument Exception : the minLogLevel parameter only excepts "trace", "debug", "info", "warn", and "error" as arguments.');if(Ne.includes(i.toUpperCase())){const e=Ne.slice(Ne.indexOf(i.toUpperCase())),t=c.filter(t=>e.some(e=>t.includes(e)));a.history=t.slice(-s)}return a},JSON:"JSON",CMCD:"CMCD",VERSION:"0.3.2"});var Ye,Xe={exports:{}},ze="object"==typeof Reflect?Reflect:null,Ke=ze&&"function"==typeof ze.apply?ze.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};Ye=ze&&"function"==typeof ze.ownKeys?ze.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var $e=Number.isNaN||function(e){return e!=e};function He(){He.init.call(this)}Xe.exports=He,Xe.exports.once=function(e,t){return new Promise((function(n,r){function s(n){e.removeListener(t,i),r(n)}function i(){"function"==typeof e.removeListener&&e.removeListener("error",s),n([].slice.call(arguments))}ct(e,t,i,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&ct(e,"error",t,n)}(e,s,{once:!0})}))},He.EventEmitter=He,He.prototype._events=void 0,He.prototype._eventsCount=0,He.prototype._maxListeners=void 0;var Je=10;function Qe(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function qe(e){return void 0===e._maxListeners?He.defaultMaxListeners:e._maxListeners}function et(e,t,n,r){var s,i,o;if(Qe(n),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),i=e._events),o=i[t]),void 0===o)o=i[t]=n,++e._eventsCount;else if("function"==typeof o?o=i[t]=r?[n,o]:[o,n]:r?o.unshift(n):o.push(n),(s=qe(e))>0&&o.length>s&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=e,a.type=t,a.count=o.length,function(e){console&&console.warn&&console.warn(e)}(a)}return e}function nt(){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 st(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},s=nt.bind(r);return s.listener=n,r.wrapFn=s,s}function it(e,t,n){var r=e._events;if(void 0===r)return[];var s=r[t];return void 0===s?[]:"function"==typeof s?n?[s.listener||s]:[s]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(s):at(s,s.length)}function ot(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function at(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}function ct(e,t,n,r){if("function"==typeof e.on)r.once?e.once(t,n):e.on(t,n);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 s(i){r.once&&e.removeEventListener(t,s),n(i)}))}}Object.defineProperty(He,"defaultMaxListeners",{enumerable:!0,get:function(){return Je},set:function(e){if("number"!=typeof e||e<0||$e(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");Je=e}}),He.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},He.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||$e(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},He.prototype.getMaxListeners=function(){return qe(this)},He.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var r="error"===e,s=this._events;if(void 0!==s)r=r&&void 0===s.error;else if(!r)return!1;if(r){var i;if(t.length>0&&(i=t[0]),i instanceof Error)throw i;var o=new Error("Unhandled error."+(i?" ("+i.message+")":""));throw o.context=i,o}var a=s[e];if(void 0===a)return!1;if("function"==typeof a)Ke(a,this,t);else{var c=a.length,l=at(a,c);for(n=0;n<c;++n)Ke(l[n],this,t)}return!0},He.prototype.addListener=function(e,t){return et(this,e,t,!1)},He.prototype.on=He.prototype.addListener,He.prototype.prependListener=function(e,t){return et(this,e,t,!0)},He.prototype.once=function(e,t){return Qe(t),this.on(e,st(this,e,t)),this},He.prototype.prependOnceListener=function(e,t){return Qe(t),this.prependListener(e,st(this,e,t)),this},He.prototype.removeListener=function(e,t){var n,r,s,i,o;if(Qe(t),void 0===(r=this._events))return this;if(void 0===(n=r[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(s=-1,i=n.length-1;i>=0;i--)if(n[i]===t||n[i].listener===t){o=n[i].listener,s=i;break}if(s<0)return this;0===s?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,s),1===n.length&&(r[e]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",e,o||t)}return this},He.prototype.off=He.prototype.removeListener,He.prototype.removeAllListeners=function(e){var t,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var s,i=Object.keys(n);for(r=0;r<i.length;++r)"removeListener"!==(s=i[r])&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},He.prototype.listeners=function(e){return it(this,e,!0)},He.prototype.rawListeners=function(e){return it(this,e,!1)},He.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):ot.call(e,t)},He.prototype.listenerCount=ot,He.prototype.eventNames=function(){return this._eventsCount>0?Ye(this._events):[]};var lt=Xe.exports;const ut=ue(lt);var dt={exports:{}};dt.exports=ft,dt.exports.filter=function(e,t){var n=new pt;return ft(e,n,t),n};var pt=lt.EventEmitter;function ft(e,t,n){Array.isArray(n)||(n=[n]);var r=[];return n.forEach((function(n){var s=function(){var e=[].slice.call(arguments);e.unshift(n),t.emit.apply(t,e)};r.push(s),e.on(n,s)})),function(){n.forEach((function(t,n){e.removeListener(t,r[n])}))}}const ht=ue(dt.exports);var mt={exports:{}};
7
+ /*! For license information please see webrtc-stats.js.LICENSE.txt */!function(e,t){!function(t,n){e.exports=n()}(self,()=>{return e={7:e=>{var t,n="object"==typeof Reflect?Reflect:null,r=n&&"function"==typeof n.apply?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};t=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var s=Number.isNaN||function(e){return e!=e};function i(){i.init.call(this)}e.exports=i,e.exports.once=function(e,t){return new Promise((function(n,r){function s(n){e.removeListener(t,i),r(n)}function i(){"function"==typeof e.removeListener&&e.removeListener("error",s),n([].slice.call(arguments))}m(e,t,i,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&m(e,"error",t,{once:!0})}(e,s)}))},i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var o=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?i.defaultMaxListeners:e._maxListeners}function l(e,t,n,r){var s,i,o,l;if(a(n),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),i=e._events),o=i[t]),void 0===o)o=i[t]=n,++e._eventsCount;else if("function"==typeof o?o=i[t]=r?[n,o]:[o,n]:r?o.unshift(n):o.push(n),(s=c(e))>0&&o.length>s&&!o.warned){o.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=o.length,l=u,console&&console.warn&&console.warn(l)}return e}function u(){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 d(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},s=u.bind(r);return s.listener=n,r.wrapFn=s,s}function p(e,t,n){var r=e._events;if(void 0===r)return[];var s=r[t];return void 0===s?[]:"function"==typeof s?n?[s.listener||s]:[s]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(s):h(s,s.length)}function f(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function h(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}function m(e,t,n,r){if("function"==typeof e.on)r.once?e.once(t,n):e.on(t,n);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 s(i){r.once&&e.removeEventListener(t,s),n(i)}))}}Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(e){if("number"!=typeof e||e<0||s(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");o=e}}),i.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},i.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||s(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},i.prototype.getMaxListeners=function(){return c(this)},i.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var s="error"===e,i=this._events;if(void 0!==i)s=s&&void 0===i.error;else if(!s)return!1;if(s){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var c=i[e];if(void 0===c)return!1;if("function"==typeof c)r(c,this,t);else{var l=c.length,u=h(c,l);for(n=0;n<l;++n)r(u[n],this,t)}return!0},i.prototype.addListener=function(e,t){return l(this,e,t,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(e,t){return l(this,e,t,!0)},i.prototype.once=function(e,t){return a(t),this.on(e,d(this,e,t)),this},i.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,d(this,e,t)),this},i.prototype.removeListener=function(e,t){var n,r,s,i,o;if(a(t),void 0===(r=this._events))return this;if(void 0===(n=r[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(s=-1,i=n.length-1;i>=0;i--)if(n[i]===t||n[i].listener===t){o=n[i].listener,s=i;break}if(s<0)return this;0===s?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,s),1===n.length&&(r[e]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",e,o||t)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(e){var t,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var s,i=Object.keys(n);for(r=0;r<i.length;++r)"removeListener"!==(s=i[r])&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},i.prototype.listeners=function(e){return p(this,e,!0)},i.prototype.rawListeners=function(e){return p(this,e,!1)},i.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):f.call(e,t)},i.prototype.listenerCount=f,i.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},586:function(e,t,n){var r,s;!function(i){var o,a={VERSION:"1.6.1"},c={},l=function(e,t){return function(){return t.apply(e,arguments)}},u=function(){var e,t,n=arguments,r=n[0];for(t=1;t<n.length;t++)for(e in n[t])!(e in r)&&n[t].hasOwnProperty(e)&&(r[e]=n[t][e]);return r},d=function(e,t){return{value:e,name:t}};a.TRACE=d(1,"TRACE"),a.DEBUG=d(2,"DEBUG"),a.INFO=d(3,"INFO"),a.TIME=d(4,"TIME"),a.WARN=d(5,"WARN"),a.ERROR=d(8,"ERROR"),a.OFF=d(99,"OFF");var p=function(e){this.context=e,this.setLevel(e.filterLevel),this.log=this.info};p.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(a.TRACE,arguments)},debug:function(){this.invoke(a.DEBUG,arguments)},info:function(){this.invoke(a.INFO,arguments)},warn:function(){this.invoke(a.WARN,arguments)},error:function(){this.invoke(a.ERROR,arguments)},time:function(e){"string"==typeof e&&e.length>0&&this.invoke(a.TIME,[e,"start"])},timeEnd:function(e){"string"==typeof e&&e.length>0&&this.invoke(a.TIME,[e,"end"])},invoke:function(e,t){o&&this.enabledFor(e)&&o(t,u({level:e},this.context))}};var f,h=new p({filterLevel:a.OFF});(f=a).enabledFor=l(h,h.enabledFor),f.trace=l(h,h.trace),f.debug=l(h,h.debug),f.time=l(h,h.time),f.timeEnd=l(h,h.timeEnd),f.info=l(h,h.info),f.warn=l(h,h.warn),f.error=l(h,h.error),f.log=f.info,a.setHandler=function(e){o=e},a.setLevel=function(e){for(var t in h.setLevel(e),c)c.hasOwnProperty(t)&&c[t].setLevel(e)},a.getLevel=function(){return h.getLevel()},a.get=function(e){return c[e]||(c[e]=new p(u({name:e},h.context)))},a.createDefaultHandler=function(e){(e=e||{}).formatter=e.formatter||function(e,t){t.name&&e.unshift("["+t.name+"]")};var t={},n=function(e,t){Function.prototype.apply.call(e,console,t)};return typeof console>"u"?function(){}:function(r,s){r=Array.prototype.slice.call(r);var i,o=console.log;s.level===a.TIME?(i=(s.name?"["+s.name+"] ":"")+r[0],"start"===r[1]?console.time?console.time(i):t[i]=(new Date).getTime():console.timeEnd?console.timeEnd(i):n(o,[i+": "+((new Date).getTime()-t[i])+"ms"])):(s.level===a.WARN&&console.warn?o=console.warn:s.level===a.ERROR&&console.error?o=console.error:s.level===a.INFO&&console.info?o=console.info:s.level===a.DEBUG&&console.debug?o=console.debug:s.level===a.TRACE&&console.trace&&(o=console.trace),e.formatter(r,s),n(o,r))}},a.useDefaults=function(e){a.setLevel(e&&e.defaultLevel||a.DEBUG),a.setHandler(a.createDefaultHandler(e))},a.setDefaults=a.useDefaults,void 0===(s="function"==typeof(r=a)?r.call(t,n,t,e):r)||(e.exports=s)}()},156:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var s=Object.getOwnPropertyDescriptor(t,n);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,s)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),s=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Logger=void 0;var o=n(586);Object.defineProperty(t,"Logger",{enumerable:!0,get:function(){return i(o).default}}),s(n(284),t),s(n(280),t),s(n(738),t),s(n(767),t)},738:(e,t)=>{var n;Object.defineProperty(t,"__esModule",{value:!0}),t.QualityLimitationReason=void 0,function(e){e[e.none=0]="none",e[e.cpu=1]="cpu",e[e.bandwidth=2]="bandwidth",e[e.other=3]="other"}(n||(t.QualityLimitationReason=n={}))},280:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},767:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},185:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.calculatePacketsLostRatio=t.calculateRate=t.getMediaKind=void 0,t.getMediaKind=e=>{let t=e.kind||e.mediaType;return["audio","video"].includes(t)||"inbound-rtp"!==e.type||(t=e.id.toLocaleLowerCase().includes("video")?"video":"audio"),t},t.calculateRate=(e,t,n,r)=>n&&r?(t-r)/((e-n)/1e3):0,t.calculatePacketsLostRatio=(e,t,n,r)=>0==t?0:(e-(null!=n?n:0))/(t-(null!=r?r:0))},284:function(e,t,n){var r,s,i,o,a,c,l,u,d,p,f,h,m,g,y,v,w=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(s,i){function o(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))},_=this&&this.__classPrivateFieldSet||function(e,t,n,r,s){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?s.call(e,n):s?s.value=n:t.set(e,n),n},R=this&&this.__classPrivateFieldGet||function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)},E=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.WebRTCStats=void 0;const I=n(7),k=E(n(586)),T=n(738),L=n(185);class X extends I.EventEmitter{constructor(e){super(),r.add(this),s.set(this,void 0),i.set(this,void 0),o.set(this,void 0),a.set(this,null),c.set(this,void 0),l.set(this,null),this.start=()=>{R(this,c,"f").info("WebRTC statistics collection is starting..."),_(this,l,null,"f"),_(this,a,setInterval(R(this,u,"f"),R(this,i,"f")),"f")},this.stop=()=>{R(this,a,"f")&&(clearInterval(R(this,a,"f")),_(this,a,null,"f"),R(this,c,"f").info("WebRTC statistics collection has stopped."))},u.set(this,()=>w(this,void 0,void 0,(function*(){let e,t;try{R(this,c,"f").trace("Requesting WebRTC statistics..."),e=yield R(this,s,"f").call(this),t=(new Date).toISOString()}catch(e){return R(this,c,"f").error("Problem collecting the WebRTC statistics.",e),void this.emit("error","Problem collecting the WebRTC statistics - ".concat(e))}const n=Array.from(e.values()),i={timestamp:t,input:{audio:[],video:[]},output:{audio:[],video:[]}};R(this,o,"f")&&(i.rawStats=e);for(let t=0;t<Object.keys(n).length;t++){const s=n[t];switch(s.type){case"outbound-rtp":const t=s,n=(0,L.getMediaKind)(t);"audio"===n?yield R(this,r,"m",f).call(this,e,t,i):"video"===n&&(yield R(this,r,"m",h).call(this,e,t,i));break;case"inbound-rtp":const o=s;let a=(0,L.getMediaKind)(o);"audio"===a?yield R(this,r,"m",g).call(this,e,o,i):"video"===a&&(yield R(this,r,"m",y).call(this,e,o,i));break;case"candidate-pair":const c=s;c.nominated&&R(this,r,"m",v).call(this,c,i)}}_(this,l,i,"f"),this.emit("stats",i)}))),_(this,c,k.default.get("WebRTCStats"),"f"),_(this,s,e.getStats,"f"),_(this,i,e.getStatsInterval||1e3,"f"),_(this,o,!!e.includeRawStats,"f")}}t.WebRTCStats=X,s=new WeakMap,i=new WeakMap,o=new WeakMap,a=new WeakMap,c=new WeakMap,l=new WeakMap,u=new WeakMap,r=new WeakSet,d=function(e,t){if(t){const n=e.get(t);if(n)return{mimeType:n.mimeType}}return{}},p=function(e,t,n){return w(this,void 0,void 0,(function*(){var s,i,o,a;const c=(0,L.calculateRate)(t.timestamp,t.bytesSent,null==n?void 0:n.timestamp,null==n?void 0:n.totalBytesSent),l=(0,L.calculateRate)(t.timestamp,t.packetsSent,null==n?void 0:n.timestamp,null==n?void 0:n.totalPacketsSent),u=R(this,r,"m",d).call(this,e,t.codecId);return Object.assign({id:t.id,timestamp:t.timestamp,mid:t.mid,totalBytesSent:t.bytesSent,bytesSentDelta:t.bytesSent-(null!==(s=null==n?void 0:n.totalBytesSent)&&void 0!==s?s:0),totalPacketsSent:t.packetsSent,packetsSentDelta:t.packetsSent-(null!==(i=null==n?void 0:n.totalPacketsSent)&&void 0!==i?i:0),bitrate:c,packetRate:l,targetBitrate:t.targetBitrate,retransmittedPacketsSent:t.retransmittedPacketsSent,retransmittedPacketsSentDelta:t.retransmittedPacketsSent-(null!==(o=null==n?void 0:n.retransmittedPacketsSent)&&void 0!==o?o:0),retransmittedBytesSent:t.retransmittedBytesSent,retransmittedBytesSentDelta:t.retransmittedBytesSent-(null!==(a=null==n?void 0:n.retransmittedBytesSent)&&void 0!==a?a:0)},u)}))},f=function(e,t,n){return w(this,void 0,void 0,(function*(){var s;const i=null===(s=R(this,l,"f"))||void 0===s?void 0:s.output.audio.find(e=>e.id===t.id);if(i&&t.timestamp-i.timestamp<=0)return;const o=yield R(this,r,"m",p).call(this,e,t,i),a=Object.assign({},o);n.output.audio.push(a)}))},h=function(e,t,n){return w(this,void 0,void 0,(function*(){var s;const i=null===(s=R(this,l,"f"))||void 0===s?void 0:s.output.video.find(e=>e.id===t.id);if(i&&t.timestamp-i.timestamp<=0)return;const o=yield R(this,r,"m",p).call(this,e,t,i);let a=T.QualityLimitationReason.none;t.qualityLimitationReason&&(a=t.qualityLimitationReason);const c=Object.assign(Object.assign({},o),{frameWidth:t.frameWidth,frameHeight:t.frameHeight,framesPerSecond:t.framesPerSecond,framesSent:t.framesSent,qualityLimitationReason:a,qualityLimitationDurations:t.qualityLimitationDurations});n.output.video.push(c)}))},m=function(e,t,n){return w(this,void 0,void 0,(function*(){var s,i;const o=(0,L.calculateRate)(t.timestamp,t.bytesReceived,null==n?void 0:n.timestamp,null==n?void 0:n.totalBytesReceived),a=(0,L.calculateRate)(t.timestamp,t.packetsReceived,null==n?void 0:n.timestamp,null==n?void 0:n.totalPacketsReceived),c=(0,L.calculatePacketsLostRatio)(t.packetsReceived,t.packetsLost,null==n?void 0:n.totalPacketsReceived,null==n?void 0:n.totalPacketsLost),l=(null!==(s=t.packetsLost)&&void 0!==s?s:0)-(null!==(i=null==n?void 0:n.totalPacketsLost)&&void 0!==i?i:0),u=R(this,r,"m",d).call(this,e,t.codecId);return Object.assign({id:t.id,timestamp:t.timestamp,mid:t.mid,trackIdentifier:t.trackIdentifier,jitter:t.jitter,jitterBufferDelay:t.jitterBufferDelay,jitterBufferEmittedCount:t.jitterBufferEmittedCount,totalBytesReceived:t.bytesReceived,totalPacketsReceived:t.packetsReceived,totalPacketsLost:t.packetsLost,bitrate:o,packetRate:a,packetLossRatio:c,packetLossDelta:l},u)}))},g=function(e,t,n){return w(this,void 0,void 0,(function*(){var s;const i=null===(s=R(this,l,"f"))||void 0===s?void 0:s.input.audio.find(e=>e.id===t.id);if(i&&t.timestamp-i.timestamp<=0)return;const o=yield R(this,r,"m",m).call(this,e,t,i);n.input.audio.push(o)}))},y=function(e,t,n){return w(this,void 0,void 0,(function*(){var s;const i=null===(s=R(this,l,"f"))||void 0===s?void 0:s.input.video.find(e=>e.id===t.id);if(i&&t.timestamp-i.timestamp<=0)return;const o=yield R(this,r,"m",m).call(this,e,t,i),a=Object.assign(Object.assign({},o),{keyFramesDecoded:t.keyFramesDecoded,frameHeight:t.frameHeight,frameWidth:t.frameWidth,framesDecoded:t.framesDecoded,framesDropped:t.framesDropped,framesPerSecond:t.framesPerSecond,framesReceived:t.framesReceived});n.input.video.push(a)}))},v=function(e,t){t.totalRoundTripTime=e.totalRoundTripTime,t.currentRoundTripTime=e.currentRoundTripTime,t.responsesReceived=e.responsesReceived,t.availableOutgoingBitrate=e.availableOutgoingBitrate,t.availableIncomingBitrate=e.availableIncomingBitrate}}},t={},function n(r){var s=t[r];if(void 0!==s)return s.exports;var i=t[r]={exports:{}};return e[r].call(i.exports,i,i.exports,n),i.exports}(156);var e,t})}(mt);var gt=mt.exports;const yt=Be.get("PeerConnectionStats"),vt="stats";class Ji extends ut{constructor(e,t={statsIntervalMs:1e3,autoInitStats:!0}){super(),this.peer=e,this.collection=null,this.initialized=!1,t.autoInitStats&&this.init(t.statsIntervalMs)}init(e){if(this.initialized)return void yt.warn("PeerConnectionStats.init() has already been called. Automatic initialization occurs when the PeerConnectionStats object is constructed.");yt.info("Initializing peer connection stats");const t=this.peer;try{this.collection=new gt.WebRTCStats({getStatsInterval:e,getStats:()=>t.getStats(),includeRawStats:!0}),this.collection.on("stats",e=>{const t=(e=>{const t=ae(e,["input","output","rawStats"]);return oe(ie({},t),{audio:{inbounds:e.input.audio.map(e=>{var t=e,{packetLossRatio:n,packetLossDelta:r,bitrate:s}=t,i=ae(t,["packetLossRatio","packetLossDelta","bitrate"]);return ie({packetsLostRatioPerSecond:n,packetsLostDeltaPerSecond:r,bitrateBitsPerSecond:8*s,bitrate:s},i)}),outbounds:e.output.audio.map(e=>{var t=e,{packetLossRatio:n,packetLossDelta:r,bitrate:s}=t,i=ae(t,["packetLossRatio","packetLossDelta","bitrate"]);return ie({packetsLostRatioPerSecond:n,packetsLostDeltaPerSecond:r,bitrateBitsPerSecond:8*s,bitrate:s},i)})},video:{inbounds:e.input.video.map(e=>{var t=e,{packetLossRatio:n,packetLossDelta:r,bitrate:s}=t,i=ae(t,["packetLossRatio","packetLossDelta","bitrate"]);return ie({packetsLostRatioPerSecond:n,packetsLostDeltaPerSecond:r,bitrateBitsPerSecond:8*s,bitrate:s},i)}),outbounds:e.output.video.map(e=>{var t=e,{packetLossRatio:n,packetLossDelta:r,bitrate:s}=t,i=ae(t,["packetLossRatio","packetLossDelta","bitrate"]);return ie({packetsLostRatioPerSecond:n,packetsLostDeltaPerSecond:r,bitrateBitsPerSecond:8*s,bitrate:s},i)})},raw:e.rawStats})})(e);Oe(t),this.emit(vt,t)}),this.collection.start(),this.initialized=!0}catch(e){yt.error(e)}}parseStats(e){return yt.warn("The parseStats method is deprecated and will be removed in future releases."),null}stop(){yt.info("Stopping peer connection stats"),this.collection.stop()}}var bt={},wt={},St={},_t={exports:{}},Rt=_t.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(e){return null!=e.address?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(e){return null!=e.subtype?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(e){return"extmap:%d"+(e.direction?"/%s":"%v")+(e["encrypt-uri"]?" %s":"%v")+" %s"+(e.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return null!=e.sessionConfig?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(e){var t="candidate:%s %d %s %d %s %d typ %s";return t+=null!=e.raddr?" raddr %s rport %d":"%v%v",t+=null!=e.tcptype?" tcptype %s":"%v",null!=e.generation&&(t+=" generation %d"),t+=null!=e["network-id"]?" network-id %d":"%v",t+=null!=e["network-cost"]?" network-cost %d":"%v"}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(e){var t="ssrc:%d";return null!=e.attribute&&(t+=" %s",null!=e.value&&(t+=":%s")),t}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(e){return null!=e.maxMessageSize?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(e){return e.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(e){return"imageattr:%s %s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(e){return"simulcast:%s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(e){return"ts-refclk:%s"+(null!=e.clksrcExt?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(e){var t="mediaclk:";return t+=null!=e.id?"id=%s %s":"%v%s",t+=null!=e.mediaClockValue?"=%s":"",t+=null!=e.rateNumerator?" rate=%s":"",t+=null!=e.rateDenominator?"/%s":""}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]};Object.keys(Rt).forEach((function(e){Rt[e].forEach((function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")}))}));var Et=_t.exports;!function(e){var t=function(e){return String(Number(e))===e?Number(e):e},n=function(e,n,r){var s=e.name&&e.names;e.push&&!n[e.push]?n[e.push]=[]:s&&!n[e.name]&&(n[e.name]={});var i=e.push?{}:s?n[e.name]:n;(function(e,n,r,s){if(s&&!r)n[s]=t(e[1]);else for(var i=0;i<r.length;i+=1)null!=e[i+1]&&(n[r[i]]=t(e[i+1]))})(r.match(e.reg),i,e.names,e.name),e.push&&n[e.push].push(i)},r=Et,s=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t={},i=[],o=t;return e.split(/(\r\n|\r|\n)/).filter(s).forEach((function(e){var t=e[0],s=e.slice(2);"m"===t&&(i.push({rtp:[],fmtp:[]}),o=i[i.length-1]);for(var a=0;a<(r[t]||[]).length;a+=1){var c=r[t][a];if(c.reg.test(s))return n(c,o,s)}})),t.media=i,t};var i=function(e,n){var r=n.split(/=(.+)/,2);return 2===r.length?e[r[0]]=t(r[1]):1===r.length&&n.length>1&&(e[r[0]]=void 0),e};e.parseParams=function(e){return e.split(/;\s?/).reduce(i,{})},e.parseFmtpConfig=e.parseParams,e.parsePayloads=function(e){return e.toString().split(" ").map(Number)},e.parseRemoteCandidates=function(e){for(var n=[],r=e.split(" ").map(t),s=0;s<r.length;s+=3)n.push({component:r[s],ip:r[s+1],port:r[s+2]});return n},e.parseImageAttributes=function(e){return e.split(" ").map((function(e){return e.substring(1,e.length-1).split(",").reduce(i,{})}))},e.parseSimulcastStreamList=function(e){return e.split(";").map((function(e){return e.split(",").map((function(e){var n,r=!1;return"~"!==e[0]?n=t(e):(n=t(e.substring(1,e.length)),r=!0),{scid:n,paused:r}}))}))}}(St);var It=Et,kt=/%[sdv%]/g,xt=function(e){var t=1,n=arguments,r=n.length;return e.replace(kt,(function(e){if(t>=r)return e;var s=n[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(s);case"%d":return Number(s);case"%v":return""}}))},Tt=function(e,t,n){var r=[e+"="+(t.format instanceof Function?t.format(t.push?n:n[t.name]):t.format)];if(t.names)for(var s=0;s<t.names.length;s+=1){var i=t.names[s];t.name?r.push(n[t.name][i]):r.push(n[t.names[s]])}else r.push(n[t.name]);return xt.apply(null,r)},Ct=["v","o","s","i","u","e","p","c","b","t","r","z","a"],Lt=["i","c","b","a"],At=St,Ot=function(e,t){t=t||{},null==e.version&&(e.version=0),null==e.name&&(e.name=" "),e.media.forEach((function(e){null==e.payloads&&(e.payloads="")}));var n=t.outerOrder||Ct,r=t.innerOrder||Lt,s=[];return n.forEach((function(t){It[t].forEach((function(n){n.name in e&&null!=e[n.name]?s.push(Tt(t,n,e)):n.push in e&&null!=e[n.push]&&e[n.push].forEach((function(e){s.push(Tt(t,n,e))}))}))})),e.media.forEach((function(e){s.push(Tt("m",It.m[0],e)),r.forEach((function(t){It[t].forEach((function(n){n.name in e&&null!=e[n.name]?s.push(Tt(t,n,e)):n.push in e&&null!=e[n.push]&&e[n.push].forEach((function(e){s.push(Tt(t,n,e))}))}))}))})),s.join("\r\n")+"\r\n"};wt.write=Ot,wt.parse=At.parse,wt.parseParams=At.parseParams,wt.parseFmtpConfig=At.parseFmtpConfig,wt.parsePayloads=At.parsePayloads,wt.parseRemoteCandidates=At.parseRemoteCandidates,wt.parseImageAttributes=At.parseImageAttributes,wt.parseSimulcastStreamList=At.parseSimulcastStreamList;let Pt=class Us{constructor(e,t,n,r,s,i,o,a,c){this.foundation=e,this.componentId=t,this.transport=n,this.priority=r,this.address=s,this.port=i,this.type=o,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 Us(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}};Pt.expand=function(e){return"CandidateInfo"===e.constructor.name?e:new Pt((e=e).foundation,e.componentId,e.transport,e.priority,e.address,e.port,e.type,e.relAddr,e.relPort)},Pt.clone=function(e){return"CandidateInfo"===e.constructor.name?e.clone():Pt.expand(e)};var Nt=Pt;let Dt=class $s{constructor(e,t){this.id=e,this.params=t||[]}clone(){return new $s(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}};Dt.expand=function(e){return"RTCPFeedbackInfo"===e.constructor.name?e:new Dt((e=e).id,e.params)},Dt.clone=function(e){return"RTCPFeedbackInfo"===e.constructor.name?e.clone():Dt.expand(e)};var Mt=Dt;const Ft=Mt;let Ut=class Bs{constructor(e,t,n){this.codec=e,this.type=t,this.params={},this.rtcpfbs=new Set,n&&this.addParams(n)}clone(){const e=new Bs(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 Object.hasOwnProperty.call(this.params,e)}getParam(e,t){if(this.hasParam(e))return this.params[e];if(void 0===t)throw new Error("param ".concat(e," not found and no default value provided"));return""+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}};Ut.expand=function(e){if("CodecInfo"===e.constructor.name)return e;const t=new Ut((e=e).codec,e.type,e.params);e.rtx&&t.setRTX(e.rtx),e.channels&&t.setChannels(e.channels);for(const n of e.rtcpfbs||[]){const e=Ft.expand(n);t.addRTCPFeedback(e)}return t},Ut.clone=function(e){return"CodecInfo"===e.constructor.name?e.clone():Ut.expand(e)},Ut.MapFromNames=function(e,t,n){var r;const s=new Map;let i=96;for(const o of e){let e;const a=o.split(";"),c=a.shift().toLowerCase().trim();e="pcmu"===c?0:"pcma"===c?8:++i;const l=new Ut(c,e);"opus"===c?l.setChannels(2):"multiopus"===c&&l.setChannels(6),t&&"ulpfec"!==c&&"flexfec-03"!==c&&"red"!==c&&l.setRTX(++i);for(const e of n||[])l.addRTCPFeedback(new Ft(e.id,e.params));for(const e of a){let t=e.split("=");l.addParam(t[0].trim(),null===(r=t[1])||void 0===r?void 0:r.trim())}s.set(e,l)}return s};var jt=Ut;var Wt=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 Zt=Wt("ACTIVE","PASSIVE","ACTPASS","INACTIVE");Zt.byValue=function(e){switch(e){case Zt.ACTIVE:case Zt.PASSIVE:case Zt.ACTPASS:case Zt.INACTIVE:return e}return Zt[e.toUpperCase()]},Zt.toString=function(e){switch(e){case Zt.ACTIVE:return"active";case Zt.PASSIVE:return"passive";case Zt.ACTPASS:return"actpass";case Zt.INACTIVE:return"inactive"}},Zt.reverse=function(e,t){switch(e){case Zt.ACTIVE:return Zt.PASSIVE;case Zt.PASSIVE:return Zt.ACTIVE;case Zt.ACTPASS:return t?Zt.ACTIVE:Zt.PASSIVE;case Zt.INACTIVE:return Zt.INACTIVE}};var Vt=Zt;const Gt=Vt;let Bt=class Gs{constructor(e,t,n){this.setup=e,this.hash=t,this.fingerprint=n}clone(){return new Gs(this.setup,this.hash,this.fingerprint)}plain(){return{setup:Gt.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}};Bt.expand=function(e){return"DTLSInfo"===e.constructor.name?e:new Bt((e=e).setup?Gt.byValue(e.setup):Gt.ACTPASS,e.hash,e.fingerprint)},Bt.clone=function(e){return"DTLSInfo"===e.constructor.name?e.clone():Bt.expand(e)};var Xt=Bt;let zt=class Ys{constructor(e,t,n,r){this.tag=e,this.suite=t,this.keyParams=n,this.sessionParams=r}clone(){return new Ys(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}};zt.expand=function(e){return"CryptoInfo"===e.constructor.name?e:new zt((e=e).tag,e.suite,e.keyParams,e.sessionParams)},zt.clone=function(e){return"CryptoInfo"===e.constructor.name?e.clone():zt.expand(e)};for(var Kt=zt,$t={exports:{}},Ht={exports:{}},Jt={},Qt={byteLength:function(e){var t=on(e),n=t[0],r=t[1];return 3*(n+r)/4-r},toByteArray:function(e){var t,n,r=on(e),s=r[0],i=r[1],o=new tn(function(e,t,n){return 3*(t+n)/4-n}(0,s,i)),a=0,c=i>0?s-4:s;for(n=0;n<c;n+=4)t=en[e.charCodeAt(n)]<<18|en[e.charCodeAt(n+1)]<<12|en[e.charCodeAt(n+2)]<<6|en[e.charCodeAt(n+3)],o[a++]=t>>16&255,o[a++]=t>>8&255,o[a++]=255&t;return 2===i&&(t=en[e.charCodeAt(n)]<<2|en[e.charCodeAt(n+1)]>>4,o[a++]=255&t),1===i&&(t=en[e.charCodeAt(n)]<<10|en[e.charCodeAt(n+1)]<<4|en[e.charCodeAt(n+2)]>>2,o[a++]=t>>8&255,o[a++]=255&t),o},fromByteArray:function(e){for(var t,n=e.length,r=n%3,s=[],i=16383,o=0,a=n-r;o<a;o+=i)s.push(cn(e,o,o+i>a?a:o+i));return 1===r?(t=e[n-1],s.push(qt[t>>2]+qt[t<<4&63]+"==")):2===r&&(t=(e[n-2]<<8)+e[n-1],s.push(qt[t>>10]+qt[t>>4&63]+qt[t<<2&63]+"=")),s.join("")}},qt=[],en=[],tn=typeof Uint8Array<"u"?Uint8Array:Array,nn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",rn=0,sn=nn.length;rn<sn;++rn)qt[rn]=nn[rn],en[nn.charCodeAt(rn)]=rn;function on(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function an(e){return qt[e>>18&63]+qt[e>>12&63]+qt[e>>6&63]+qt[63&e]}function cn(e,t,n){for(var r,s=[],i=t;i<n;i+=3)r=(e[i]<<16&16711680)+(e[i+1]<<8&65280)+(255&e[i+2]),s.push(an(r));return s.join("")}en[45]=62,en[95]=63;var ln={
8
8
  /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
9
- read:function(e,t,r,n,s){var i,o,a=8*s-n-1,c=(1<<a)-1,l=c>>1,u=-7,d=r?s-1:0,h=r?-1:1,f=e[t+d];for(d+=h,i=f&(1<<-u)-1,f>>=-u,u+=a;u>0;i=256*i+e[t+d],d+=h,u-=8);for(o=i&(1<<-u)-1,i>>=-u,u+=n;u>0;o=256*o+e[t+d],d+=h,u-=8);if(0===i)i=1-l;else{if(i===c)return o?NaN:1/0*(f?-1:1);o+=Math.pow(2,n),i-=l}return(f?-1:1)*o*Math.pow(2,i-n)},write:function(e,t,r,n,s,i){var o,a,c,l=8*i-s-1,u=(1<<l)-1,d=u>>1,h=23===s?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:i-1,p=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,o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-o))<1&&(o--,c*=2),(t+=o+d>=1?h/c:h*Math.pow(2,1-d))*c>=2&&(o++,c/=2),o+d>=u?(a=0,o=u):o+d>=1?(a=(t*c-1)*Math.pow(2,s),o+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,s),o=0));s>=8;e[r+f]=255&a,f+=p,a/=256,s-=8);for(o=o<<s|a,l+=s;l>0;e[r+f]=255&o,f+=p,o/=256,l-=8);e[r+f-p]|=128*m}};
9
+ read:function(e,t,n,r,s){var i,o,a=8*s-r-1,c=(1<<a)-1,l=c>>1,u=-7,d=n?s-1:0,p=n?-1:1,f=e[t+d];for(d+=p,i=f&(1<<-u)-1,f>>=-u,u+=a;u>0;i=256*i+e[t+d],d+=p,u-=8);for(o=i&(1<<-u)-1,i>>=-u,u+=r;u>0;o=256*o+e[t+d],d+=p,u-=8);if(0===i)i=1-l;else{if(i===c)return o?NaN:1/0*(f?-1:1);o+=Math.pow(2,r),i-=l}return(f?-1:1)*o*Math.pow(2,i-r)},write:function(e,t,n,r,s,i){var o,a,c,l=8*i-s-1,u=(1<<l)-1,d=u>>1,p=23===s?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:i-1,h=r?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,o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-o))<1&&(o--,c*=2),(t+=o+d>=1?p/c:p*Math.pow(2,1-d))*c>=2&&(o++,c/=2),o+d>=u?(a=0,o=u):o+d>=1?(a=(t*c-1)*Math.pow(2,s),o+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,s),o=0));s>=8;e[n+f]=255&a,f+=h,a/=256,s-=8);for(o=o<<s|a,l+=s;l>0;e[n+f]=255&o,f+=h,o/=256,l-=8);e[n+f-h]|=128*m}};
10
10
  /*!
11
11
  * The buffer module from node.js, for the browser.
12
12
  *
13
13
  * @author Feross Aboukhadijeh <https://feross.org>
14
14
  * @license MIT
15
15
  */
16
- (function(e){const t=Pt,r=Gt,n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=o,e.SlowBuffer=function(e){return+e!=e&&(e=0),o.alloc(+e)},e.INSPECT_MAX_BYTES=50;const s=2147483647;function i(e){if(e>s)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 l(e)}return a(e,t,r)}function a(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(q(e,Uint8Array)){const t=new Uint8Array(e);return d(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(q(e,ArrayBuffer)||e&&q(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(q(e,SharedArrayBuffer)||e&&q(e.buffer,SharedArrayBuffer)))return d(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|h(e.length),r=i(t);return 0===r.length||e.copy(r,0,0,t),r}if(void 0!==e.length)return"number"!=typeof e.length||ee(e.length)?i(0):u(e);if("Buffer"===e.type&&Array.isArray(e.data))return u(e.data)}(e);if(s)return s;if(typeof Symbol<"u"&&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 c(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 l(e){return c(e),i(e<0?0:0|h(e))}function u(e){const t=e.length<0?0:0|h(e.length),r=i(t);for(let n=0;n<t;n+=1)r[n]=255&e[n];return r}function d(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 h(e){if(e>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function f(e,t){if(o.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||q(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 s=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return H(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return J(e).length;default:if(s)return n?-1:H(e).length;t=(""+t).toLowerCase(),s=!0}}function p(e,t,r){let n=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0)||(r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return A(this,t,r);case"utf8":case"utf-8":return E(this,t,r);case"ascii":return T(this,t,r);case"latin1":case"binary":return L(this,t,r);case"base64":return I(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function m(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function g(e,t,r,n,s){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),ee(r=+r)&&(r=s?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(s)return-1;r=e.length-1}else if(r<0){if(!s)return-1;r=0}if("string"==typeof t&&(t=o.from(t,n)),o.isBuffer(t))return 0===t.length?-1:y(e,t,r,n,s);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?s?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):y(e,[t],r,n,s);throw new TypeError("val must be string, number or Buffer")}function y(e,t,r,n,s){let i,o=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;o=2,a/=2,c/=2,r/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(s){let n=-1;for(i=r;i<a;i++)if(l(e,i)===l(t,-1===n?0:i-n)){if(-1===n&&(n=i),i-n+1===c)return n*o}else-1!==n&&(i-=i-n),n=-1}else for(r+c>a&&(r=a-c),i=r;i>=0;i--){let r=!0;for(let n=0;n<c;n++)if(l(e,i+n)!==l(t,n)){r=!1;break}if(r)return i}return-1}function v(e,t,r,n){r=Number(r)||0;const s=e.length-r;n?(n=Number(n))>s&&(n=s):n=s;const i=t.length;let o;for(n>i/2&&(n=i/2),o=0;o<n;++o){const n=parseInt(t.substr(2*o,2),16);if(ee(n))return o;e[r+o]=n}return o}function w(e,t,r,n){return Q(H(t,e.length-r),e,r,n)}function R(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 k(e,t,r,n){return Q(J(t),e,r,n)}function _(e,t,r,n){return Q(function(e,t){let r,n,s;const i=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)r=e.charCodeAt(o),n=r>>8,s=r%256,i.push(s),i.push(n);return i}(t,e.length-r),e,r,n)}function I(e,r,n){return 0===r&&n===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(r,n))}function E(e,t,r){r=Math.min(e.length,r);const n=[];let s=t;for(;s<r;){const t=e[s];let i=null,o=t>239?4:t>223?3:t>191?2:1;if(s+o<=r){let r,n,a,c;switch(o){case 1:t<128&&(i=t);break;case 2:r=e[s+1],128==(192&r)&&(c=(31&t)<<6|63&r,c>127&&(i=c));break;case 3:r=e[s+1],n=e[s+2],128==(192&r)&&128==(192&n)&&(c=(15&t)<<12|(63&r)<<6|63&n,c>2047&&(c<55296||c>57343)&&(i=c));break;case 4:r=e[s+1],n=e[s+2],a=e[s+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&&(i=c))}}null===i?(i=65533,o=1):i>65535&&(i-=65536,n.push(i>>>10&1023|55296),i=56320|1023&i),n.push(i),s+=o}return function(e){const t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=4096));return r}(n)}e.kMaxLength=s,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&&typeof console<"u"&&"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 a(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 c(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 l(e)},o.allocUnsafeSlow=function(e){return l(e)},o.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==o.prototype},o.compare=function(e,t){if(q(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),q(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 s=0,i=Math.min(r,n);s<i;++s)if(e[s]!==t[s]){r=e[s],n=t[s];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 s=0;for(r=0;r<e.length;++r){let t=e[r];if(q(t,Uint8Array))s+t.length>n.length?(o.isBuffer(t)||(t=o.from(t)),t.copy(n,s)):Uint8Array.prototype.set.call(n,t,s);else{if(!o.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(n,s)}s+=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)m(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)m(this,t,t+3),m(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)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},o.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?E(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 t="";const r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},n&&(o.prototype[n]=o.prototype.inspect),o.prototype.compare=function(e,t,r,n,s){if(q(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===s&&(s=this.length),t<0||r>e.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&t>=r)return 0;if(n>=s)return-1;if(t>=r)return 1;if(this===e)return 0;let i=(s>>>=0)-(n>>>=0),a=(r>>>=0)-(t>>>=0);const c=Math.min(i,a),l=this.slice(n,s),u=e.slice(t,r);for(let e=0;e<c;++e)if(l[e]!==u[e]){i=l[e],a=u[e];break}return i<a?-1:a<i?1:0},o.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},o.prototype.indexOf=function(e,t,r){return g(this,e,t,r,!0)},o.prototype.lastIndexOf=function(e,t,r){return g(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 s=this.length-t;if((void 0===r||r>s)&&(r=s),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let i=!1;for(;;)switch(n){case"hex":return v(this,e,t,r);case"utf8":case"utf-8":return w(this,e,t,r);case"ascii":case"latin1":case"binary":return R(this,e,t,r);case"base64":return k(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function T(e,t,r){let n="";r=Math.min(e.length,r);for(let s=t;s<r;++s)n+=String.fromCharCode(127&e[s]);return n}function L(e,t,r){let n="";r=Math.min(e.length,r);for(let s=t;s<r;++s)n+=String.fromCharCode(e[s]);return n}function A(e,t,r){const n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);let s="";for(let n=t;n<r;++n)s+=te[e[n]];return s}function M(e,t,r){const n=e.slice(t,r);let s="";for(let e=0;e<n.length-1;e+=2)s+=String.fromCharCode(n[e]+256*n[e+1]);return s}function O(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 D(e,t,r,n,s,i){if(!o.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>s||t<i)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function j(e,t,r,n,s){z(t,n,s,e,r,7);let i=Number(t&BigInt(4294967295));e[r++]=i,i>>=8,e[r++]=i,i>>=8,e[r++]=i,i>>=8,e[r++]=i;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,r}function Z(e,t,r,n,s){z(t,n,s,e,r,7);let i=Number(t&BigInt(4294967295));e[r+7]=i,i>>=8,e[r+6]=i,i>>=8,e[r+5]=i,i>>=8,e[r+4]=i;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=o,o>>=8,e[r+2]=o,o>>=8,e[r+1]=o,o>>=8,e[r]=o,r+8}function N(e,t,r,n,s,i){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function V(e,t,n,s,i){return t=+t,n>>>=0,i||N(e,0,n,4),r.write(e,t,n,s,23,4),n+4}function U(e,t,n,s,i){return t=+t,n>>>=0,i||N(e,0,n,8),r.write(e,t,n,s,52,8),n+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||O(e,t,this.length);let n=this[e],s=1,i=0;for(;++i<t&&(s*=256);)n+=this[e+i]*s;return n},o.prototype.readUintBE=o.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||O(e,t,this.length);let n=this[e+--t],s=1;for(;t>0&&(s*=256);)n+=this[e+--t]*s;return n},o.prototype.readUint8=o.prototype.readUInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),this[e]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(e,t){return e>>>=0,t||O(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||O(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readBigUInt64LE=re((function(e){Y(e>>>=0,"offset");const t=this[e],r=this[e+7];(void 0===t||void 0===r)&&$(e,this.length-8);const n=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,s=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(n)+(BigInt(s)<<BigInt(32))})),o.prototype.readBigUInt64BE=re((function(e){Y(e>>>=0,"offset");const t=this[e],r=this[e+7];(void 0===t||void 0===r)&&$(e,this.length-8);const n=t*2**24+65536*this[++e]+256*this[++e]+this[++e],s=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(n)<<BigInt(32))+BigInt(s)})),o.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||O(e,t,this.length);let n=this[e],s=1,i=0;for(;++i<t&&(s*=256);)n+=this[e+i]*s;return s*=128,n>=s&&(n-=Math.pow(2,8*t)),n},o.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||O(e,t,this.length);let n=t,s=1,i=this[e+--n];for(;n>0&&(s*=256);)i+=this[e+--n]*s;return s*=128,i>=s&&(i-=Math.pow(2,8*t)),i},o.prototype.readInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},o.prototype.readInt16LE=function(e,t){e>>>=0,t||O(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||O(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||O(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||O(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readBigInt64LE=re((function(e){Y(e>>>=0,"offset");const t=this[e],r=this[e+7];(void 0===t||void 0===r)&&$(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=re((function(e){Y(e>>>=0,"offset");const t=this[e],r=this[e+7];(void 0===t||void 0===r)&&$(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||O(e,4,this.length),r.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return e>>>=0,t||O(e,4,this.length),r.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return e>>>=0,t||O(e,8,this.length),r.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return e>>>=0,t||O(e,8,this.length),r.read(this,e,!1,52,8)},o.prototype.writeUintLE=o.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){D(this,e,t,r,Math.pow(2,8*r)-1,0)}let s=1,i=0;for(this[t]=255&e;++i<r&&(s*=256);)this[t+i]=e/s&255;return t+r},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){D(this,e,t,r,Math.pow(2,8*r)-1,0)}let s=r-1,i=1;for(this[t+s]=255&e;--s>=0&&(i*=256);)this[t+s]=e/i&255;return t+r},o.prototype.writeUint8=o.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||D(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||D(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||D(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||D(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||D(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=re((function(e,t=0){return j(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),o.prototype.writeBigUInt64BE=re((function(e,t=0){return Z(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);D(this,e,t,r,n-1,-n)}let s=0,i=1,o=0;for(this[t]=255&e;++s<r&&(i*=256);)e<0&&0===o&&0!==this[t+s-1]&&(o=1),this[t+s]=(e/i>>0)-o&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);D(this,e,t,r,n-1,-n)}let s=r-1,i=1,o=0;for(this[t+s]=255&e;--s>=0&&(i*=256);)e<0&&0===o&&0!==this[t+s+1]&&(o=1),this[t+s]=(e/i>>0)-o&255;return t+r},o.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||D(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||D(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||D(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||D(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||D(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=re((function(e,t=0){return j(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),o.prototype.writeBigInt64BE=re((function(e,t=0){return Z(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),o.prototype.writeFloatLE=function(e,t,r){return V(this,e,t,!0,r)},o.prototype.writeFloatBE=function(e,t,r){return V(this,e,t,!1,r)},o.prototype.writeDoubleLE=function(e,t,r){return U(this,e,t,!0,r)},o.prototype.writeDoubleBE=function(e,t,r){return U(this,e,t,!1,r)},o.prototype.copy=function(e,t,r,n){if(!o.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),!n&&0!==n&&(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r||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 s=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),s},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 s;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(s=t;s<r;++s)this[s]=e;else{const i=o.isBuffer(e)?e:o.from(e,n),a=i.length;if(0===a)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(s=0;s<r-t;++s)this[s+t]=i[s%a]}return this};const W={};function G(e,t,r){W[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name="".concat(this.name," [").concat(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"".concat(this.name," [").concat(e,"]: ").concat(this.message)}}}function B(e){let t="",r=e.length;const n="-"===e[0]?1:0;for(;r>=n+4;r-=3)t="_".concat(e.slice(r-3,r)).concat(t);return"".concat(e.slice(0,r)).concat(t)}function z(e,t,r,n,s,i){if(e>r||e<t){const r="bigint"==typeof t?"n":"";let n;throw n=0===t||t===BigInt(0)?">= 0".concat(r," and < 2").concat(r," ** ").concat(8*(i+1)).concat(r):">= -(2".concat(r," ** ").concat(8*(i+1)-1).concat(r,") and < 2 ** ")+"".concat(8*(i+1)-1).concat(r),new W.ERR_OUT_OF_RANGE("value",n,e)}!function(e,t,r){Y(t,"offset"),(void 0===e[t]||void 0===e[t+r])&&$(t,e.length-(r+1))}(n,s,i)}function Y(e,t){if("number"!=typeof e)throw new W.ERR_INVALID_ARG_TYPE(t,"number",e)}function $(e,t,r){throw Math.floor(e)!==e?(Y(e,r),new W.ERR_OUT_OF_RANGE("offset","an integer",e)):t<0?new W.ERR_BUFFER_OUT_OF_BOUNDS:new W.ERR_OUT_OF_RANGE("offset",">= 0 and <= ".concat(t),e)}G("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?"".concat(e," is outside of buffer bounds"):"Attempt to access memory outside buffer bounds"}),RangeError),G("ERR_INVALID_ARG_TYPE",(function(e,t){return'The "'.concat(e,'" argument must be of type number. Received type ').concat(typeof t)}),TypeError),G("ERR_OUT_OF_RANGE",(function(e,t,r){let n='The value of "'.concat(e,'" is out of range.'),s=r;return Number.isInteger(r)&&Math.abs(r)>2**32?s=B(String(r)):"bigint"==typeof r&&(s=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(s=B(s)),s+="n"),n+=" It must be ".concat(t,". Received ").concat(s),n}),RangeError);const K=/[^+/0-9A-Za-z-_]/g;function H(e,t){let r;t=t||1/0;const n=e.length;let s=null;const i=[];for(let o=0;o<n;++o){if(r=e.charCodeAt(o),r>55295&&r<57344){if(!s){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(o+1===n){(t-=3)>-1&&i.push(239,191,189);continue}s=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),s=r;continue}r=65536+(s-55296<<10|r-56320)}else s&&(t-=3)>-1&&i.push(239,191,189);if(s=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.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;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function J(e){return t.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(K,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Q(e,t,r,n){let s;for(s=0;s<n&&!(s+r>=t.length||s>=e.length);++s)t[s+r]=e[s];return s}function q(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function ee(e){return e!=e}const te=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let s=0;s<16;++s)t[n+s]=e[r]+e[s]}return t}();function re(e){return typeof BigInt>"u"?ne:e}function ne(){throw new Error("BigInt not supported")}})(Mt),
16
+ (function(e){const t=Qt,n=ln,r="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=o,e.SlowBuffer=function(e){return+e!=e&&(e=0),o.alloc(+e)},e.INSPECT_MAX_BYTES=50;const s=2147483647;function i(e){if(e>s)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,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return l(e)}return a(e,t,n)}function a(e,t,n){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 n=0|f(e,t);let r=i(n);const s=r.write(e,t);return s!==n&&(r=r.slice(0,s)),r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(q(e,Uint8Array)){const t=new Uint8Array(e);return d(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(q(e,ArrayBuffer)||e&&q(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(q(e,SharedArrayBuffer)||e&&q(e.buffer,SharedArrayBuffer)))return d(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return o.from(r,t,n);const s=function(e){if(o.isBuffer(e)){const t=0|p(e.length),n=i(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return"number"!=typeof e.length||ee(e.length)?i(0):u(e);if("Buffer"===e.type&&Array.isArray(e.data))return u(e.data)}(e);if(s)return s;if(typeof Symbol<"u"&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return o.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function c(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 l(e){return c(e),i(e<0?0:0|p(e))}function u(e){const t=e.length<0?0:0|p(e.length),n=i(t);for(let r=0;r<t;r+=1)n[r]=255&e[r];return n}function d(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');let r;return r=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,o.prototype),r}function p(e){if(e>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function f(e,t){if(o.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||q(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 n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let s=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return H(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return J(e).length;default:if(s)return r?-1:H(e).length;t=(""+t).toLowerCase(),s=!0}}function h(e,t,n){let r=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===n||n>this.length)&&(n=this.length),n<=0)||(n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return A(this,t,n);case"utf8":case"utf-8":return k(this,t,n);case"ascii":return T(this,t,n);case"latin1":case"binary":return L(this,t,n);case"base64":return I(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function m(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function g(e,t,n,r,s){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),ee(n=+n)&&(n=s?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(s)return-1;n=e.length-1}else if(n<0){if(!s)return-1;n=0}if("string"==typeof t&&(t=o.from(t,r)),o.isBuffer(t))return 0===t.length?-1:y(e,t,n,r,s);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?s?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):y(e,[t],n,r,s);throw new TypeError("val must be string, number or Buffer")}function y(e,t,n,r,s){let i,o=1,a=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o=2,a/=2,c/=2,n/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(s){let r=-1;for(i=n;i<a;i++)if(l(e,i)===l(t,-1===r?0:i-r)){if(-1===r&&(r=i),i-r+1===c)return r*o}else-1!==r&&(i-=i-r),r=-1}else for(n+c>a&&(n=a-c),i=n;i>=0;i--){let n=!0;for(let r=0;r<c;r++)if(l(e,i+r)!==l(t,r)){n=!1;break}if(n)return i}return-1}function v(e,t,n,r){n=Number(n)||0;const s=e.length-n;r?(r=Number(r))>s&&(r=s):r=s;const i=t.length;let o;for(r>i/2&&(r=i/2),o=0;o<r;++o){const r=parseInt(t.substr(2*o,2),16);if(ee(r))return o;e[n+o]=r}return o}function w(e,t,n,r){return Q(H(t,e.length-n),e,n,r)}function _(e,t,n,r){return Q(function(e){const t=[];for(let n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function R(e,t,n,r){return Q(J(t),e,n,r)}function E(e,t,n,r){return Q(function(e,t){let n,r,s;const i=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),r=n>>8,s=n%256,i.push(s),i.push(r);return i}(t,e.length-n),e,n,r)}function I(e,n,r){return 0===n&&r===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,r))}function k(e,t,n){n=Math.min(e.length,n);const r=[];let s=t;for(;s<n;){const t=e[s];let i=null,o=t>239?4:t>223?3:t>191?2:1;if(s+o<=n){let n,r,a,c;switch(o){case 1:t<128&&(i=t);break;case 2:n=e[s+1],128==(192&n)&&(c=(31&t)<<6|63&n,c>127&&(i=c));break;case 3:n=e[s+1],r=e[s+2],128==(192&n)&&128==(192&r)&&(c=(15&t)<<12|(63&n)<<6|63&r,c>2047&&(c<55296||c>57343)&&(i=c));break;case 4:n=e[s+1],r=e[s+2],a=e[s+3],128==(192&n)&&128==(192&r)&&128==(192&a)&&(c=(15&t)<<18|(63&n)<<12|(63&r)<<6|63&a,c>65535&&c<1114112&&(i=c))}}null===i?(i=65533,o=1):i>65535&&(i-=65536,r.push(i>>>10&1023|55296),i=56320|1023&i),r.push(i),s+=o}return function(e){const t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);let n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=4096));return n}(r)}e.kMaxLength=s,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&&typeof console<"u"&&"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,n){return a(e,t,n)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array),o.alloc=function(e,t,n){return function(e,t,n){return c(e),e<=0?i(e):void 0!==t?"string"==typeof n?i(e).fill(t,n):i(e).fill(t):i(e)}(e,t,n)},o.allocUnsafe=function(e){return l(e)},o.allocUnsafeSlow=function(e){return l(e)},o.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==o.prototype},o.compare=function(e,t){if(q(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),q(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 n=e.length,r=t.length;for(let s=0,i=Math.min(n,r);s<i;++s)if(e[s]!==t[s]){n=e[s],r=t[s];break}return n<r?-1:r<n?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 n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;const r=o.allocUnsafe(t);let s=0;for(n=0;n<e.length;++n){let t=e[n];if(q(t,Uint8Array))s+t.length>r.length?(o.isBuffer(t)||(t=o.from(t)),t.copy(r,s)):Uint8Array.prototype.set.call(r,t,s);else{if(!o.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(r,s)}s+=t.length}return r},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)m(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)m(this,t,t+3),m(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)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},o.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?k(this,0,e):h.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 t="";const n=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(t+=" ... "),"<Buffer "+t+">"},r&&(o.prototype[r]=o.prototype.inspect),o.prototype.compare=function(e,t,n,r,s){if(q(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===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===s&&(s=this.length),t<0||n>e.length||r<0||s>this.length)throw new RangeError("out of range index");if(r>=s&&t>=n)return 0;if(r>=s)return-1;if(t>=n)return 1;if(this===e)return 0;let i=(s>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0);const c=Math.min(i,a),l=this.slice(r,s),u=e.slice(t,n);for(let e=0;e<c;++e)if(l[e]!==u[e]){i=l[e],a=u[e];break}return i<a?-1:a<i?1:0},o.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},o.prototype.indexOf=function(e,t,n){return g(this,e,t,n,!0)},o.prototype.lastIndexOf=function(e,t,n){return g(this,e,t,n,!1)},o.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const s=this.length-t;if((void 0===n||n>s)&&(n=s),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let i=!1;for(;;)switch(r){case"hex":return v(this,e,t,n);case"utf8":case"utf-8":return w(this,e,t,n);case"ascii":case"latin1":case"binary":return _(this,e,t,n);case"base64":return R(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function T(e,t,n){let r="";n=Math.min(e.length,n);for(let s=t;s<n;++s)r+=String.fromCharCode(127&e[s]);return r}function L(e,t,n){let r="";n=Math.min(e.length,n);for(let s=t;s<n;++s)r+=String.fromCharCode(e[s]);return r}function A(e,t,n){const r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let s="";for(let r=t;r<n;++r)s+=te[e[r]];return s}function O(e,t,n){const r=e.slice(t,n);let s="";for(let e=0;e<r.length-1;e+=2)s+=String.fromCharCode(r[e]+256*r[e+1]);return s}function N(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function D(e,t,n,r,s,i){if(!o.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>s||t<i)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function M(e,t,n,r,s){Y(t,r,s,e,n,7);let i=Number(t&BigInt(4294967295));e[n++]=i,i>>=8,e[n++]=i,i>>=8,e[n++]=i,i>>=8,e[n++]=i;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,n}function U(e,t,n,r,s){Y(t,r,s,e,n,7);let i=Number(t&BigInt(4294967295));e[n+7]=i,i>>=8,e[n+6]=i,i>>=8,e[n+5]=i,i>>=8,e[n+4]=i;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=o,o>>=8,e[n+2]=o,o>>=8,e[n+1]=o,o>>=8,e[n]=o,n+8}function j(e,t,n,r,s,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function W(e,t,r,s,i){return t=+t,r>>>=0,i||j(e,0,r,4),n.write(e,t,r,s,23,4),r+4}function Z(e,t,r,s,i){return t=+t,r>>>=0,i||j(e,0,r,8),n.write(e,t,r,s,52,8),r+8}o.prototype.slice=function(e,t){const n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e);const r=this.subarray(e,t);return Object.setPrototypeOf(r,o.prototype),r},o.prototype.readUintLE=o.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||N(e,t,this.length);let r=this[e],s=1,i=0;for(;++i<t&&(s*=256);)r+=this[e+i]*s;return r},o.prototype.readUintBE=o.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||N(e,t,this.length);let r=this[e+--t],s=1;for(;t>0&&(s*=256);)r+=this[e+--t]*s;return r},o.prototype.readUint8=o.prototype.readUInt8=function(e,t){return e>>>=0,t||N(e,1,this.length),this[e]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(e,t){return e>>>=0,t||N(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(e,t){return e>>>=0,t||N(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(e,t){return e>>>=0,t||N(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||N(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readBigUInt64LE=ne((function(e){z(e>>>=0,"offset");const t=this[e],n=this[e+7];(void 0===t||void 0===n)&&K(e,this.length-8);const r=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,s=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(r)+(BigInt(s)<<BigInt(32))})),o.prototype.readBigUInt64BE=ne((function(e){z(e>>>=0,"offset");const t=this[e],n=this[e+7];(void 0===t||void 0===n)&&K(e,this.length-8);const r=t*2**24+65536*this[++e]+256*this[++e]+this[++e],s=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(r)<<BigInt(32))+BigInt(s)})),o.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||N(e,t,this.length);let r=this[e],s=1,i=0;for(;++i<t&&(s*=256);)r+=this[e+i]*s;return s*=128,r>=s&&(r-=Math.pow(2,8*t)),r},o.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||N(e,t,this.length);let r=t,s=1,i=this[e+--r];for(;r>0&&(s*=256);)i+=this[e+--r]*s;return s*=128,i>=s&&(i-=Math.pow(2,8*t)),i},o.prototype.readInt8=function(e,t){return e>>>=0,t||N(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},o.prototype.readInt16LE=function(e,t){e>>>=0,t||N(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt16BE=function(e,t){e>>>=0,t||N(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt32LE=function(e,t){return e>>>=0,t||N(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||N(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readBigInt64LE=ne((function(e){z(e>>>=0,"offset");const t=this[e],n=this[e+7];(void 0===t||void 0===n)&&K(e,this.length-8);const r=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),o.prototype.readBigInt64BE=ne((function(e){z(e>>>=0,"offset");const t=this[e],n=this[e+7];(void 0===t||void 0===n)&&K(e,this.length-8);const r=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+n)})),o.prototype.readFloatLE=function(e,t){return e>>>=0,t||N(e,4,this.length),n.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return e>>>=0,t||N(e,4,this.length),n.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return e>>>=0,t||N(e,8,this.length),n.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return e>>>=0,t||N(e,8,this.length),n.read(this,e,!1,52,8)},o.prototype.writeUintLE=o.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){D(this,e,t,n,Math.pow(2,8*n)-1,0)}let s=1,i=0;for(this[t]=255&e;++i<n&&(s*=256);)this[t+i]=e/s&255;return t+n},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){D(this,e,t,n,Math.pow(2,8*n)-1,0)}let s=n-1,i=1;for(this[t+s]=255&e;--s>=0&&(i*=256);)this[t+s]=e/i&255;return t+n},o.prototype.writeUint8=o.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,1,255,0),this[t]=255&e,t+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||D(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,n){return e=+e,t>>>=0,n||D(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,n){return e=+e,t>>>=0,n||D(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,n){return e=+e,t>>>=0,n||D(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=ne((function(e,t=0){return M(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),o.prototype.writeBigUInt64BE=ne((function(e,t=0){return U(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),o.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);D(this,e,t,n,r-1,-r)}let s=0,i=1,o=0;for(this[t]=255&e;++s<n&&(i*=256);)e<0&&0===o&&0!==this[t+s-1]&&(o=1),this[t+s]=(e/i>>0)-o&255;return t+n},o.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);D(this,e,t,n,r-1,-r)}let s=n-1,i=1,o=0;for(this[t+s]=255&e;--s>=0&&(i*=256);)e<0&&0===o&&0!==this[t+s+1]&&(o=1),this[t+s]=(e/i>>0)-o&255;return t+n},o.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||D(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,n){return e=+e,t>>>=0,n||D(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=ne((function(e,t=0){return M(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),o.prototype.writeBigInt64BE=ne((function(e,t=0){return U(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),o.prototype.writeFloatLE=function(e,t,n){return W(this,e,t,!0,n)},o.prototype.writeFloatBE=function(e,t,n){return W(this,e,t,!1,n)},o.prototype.writeDoubleLE=function(e,t,n){return Z(this,e,t,!0,n)},o.prototype.writeDoubleBE=function(e,t,n){return Z(this,e,t,!1,n)},o.prototype.copy=function(e,t,n,r){if(!o.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!r&&0!==r&&(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n||0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);const s=r-n;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),s},o.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!o.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===e.length){const t=e.charCodeAt(0);("utf8"===r&&t<128||"latin1"===r)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;let s;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(s=t;s<n;++s)this[s]=e;else{const i=o.isBuffer(e)?e:o.from(e,r),a=i.length;if(0===a)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(s=0;s<n-t;++s)this[s+t]=i[s%a]}return this};const V={};function G(e,t,n){V[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name="".concat(this.name," [").concat(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"".concat(this.name," [").concat(e,"]: ").concat(this.message)}}}function B(e){let t="",n=e.length;const r="-"===e[0]?1:0;for(;n>=r+4;n-=3)t="_".concat(e.slice(n-3,n)).concat(t);return"".concat(e.slice(0,n)).concat(t)}function Y(e,t,n,r,s,i){if(e>n||e<t){const n="bigint"==typeof t?"n":"";let r;throw r=0===t||t===BigInt(0)?">= 0".concat(n," and < 2").concat(n," ** ").concat(8*(i+1)).concat(n):">= -(2".concat(n," ** ").concat(8*(i+1)-1).concat(n,") and < 2 ** ")+"".concat(8*(i+1)-1).concat(n),new V.ERR_OUT_OF_RANGE("value",r,e)}!function(e,t,n){z(t,"offset"),(void 0===e[t]||void 0===e[t+n])&&K(t,e.length-(n+1))}(r,s,i)}function z(e,t){if("number"!=typeof e)throw new V.ERR_INVALID_ARG_TYPE(t,"number",e)}function K(e,t,n){throw Math.floor(e)!==e?(z(e,n),new V.ERR_OUT_OF_RANGE("offset","an integer",e)):t<0?new V.ERR_BUFFER_OUT_OF_BOUNDS:new V.ERR_OUT_OF_RANGE("offset",">= 0 and <= ".concat(t),e)}G("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?"".concat(e," is outside of buffer bounds"):"Attempt to access memory outside buffer bounds"}),RangeError),G("ERR_INVALID_ARG_TYPE",(function(e,t){return'The "'.concat(e,'" argument must be of type number. Received type ').concat(typeof t)}),TypeError),G("ERR_OUT_OF_RANGE",(function(e,t,n){let r='The value of "'.concat(e,'" is out of range.'),s=n;return Number.isInteger(n)&&Math.abs(n)>2**32?s=B(String(n)):"bigint"==typeof n&&(s=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(s=B(s)),s+="n"),r+=" It must be ".concat(t,". Received ").concat(s),r}),RangeError);const $=/[^+/0-9A-Za-z-_]/g;function H(e,t){let n;t=t||1/0;const r=e.length;let s=null;const i=[];for(let o=0;o<r;++o){if(n=e.charCodeAt(o),n>55295&&n<57344){if(!s){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(o+1===r){(t-=3)>-1&&i.push(239,191,189);continue}s=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),s=n;continue}n=65536+(s-55296<<10|n-56320)}else s&&(t-=3)>-1&&i.push(239,191,189);if(s=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function J(e){return t.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace($,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Q(e,t,n,r){let s;for(s=0;s<r&&!(s+n>=t.length||s>=e.length);++s)t[s+n]=e[s];return s}function q(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function ee(e){return e!=e}const te=function(){const e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let s=0;s<16;++s)t[r+s]=e[n]+e[s]}return t}();function ne(e){return typeof BigInt>"u"?re:e}function re(){throw new Error("BigInt not supported")}})(Jt),
17
17
  /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
18
- function(e,t){var r=Mt,n=r.Buffer;function s(e,t){for(var r in e)t[r]=e[r]}function i(e,t,r){return n(e,t,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=r:(s(r,t),t.Buffer=i),i.prototype=Object.create(n.prototype),s(n,i),i.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return n(e,t,r)},i.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var s=n(e);return void 0!==t?"string"==typeof r?s.fill(t,r):s.fill(t):s.fill(0),s},i.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n(e)},i.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}}(At,At.exports);var Bt=At.exports.Buffer,Xt=W.crypto||W.msCrypto;Xt&&Xt.getRandomValues?Lt.exports=function(e,t){if(e>4294967295)throw new RangeError("requested too many random bytes");var r=Bt.allocUnsafe(e);if(e>0)if(e>65536)for(var n=0;n<e;n+=65536)Xt.getRandomValues(r.slice(n,n+65536));else Xt.getRandomValues(r);return"function"==typeof t?T.nextTick((function(){t(null,r)})):r}:Lt.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")};const zt=Lt.exports;let $t=class Js{constructor(e,t){this.ufrag=e,this.pwd=t,this.lite=!1,this.endOfCandidates=!1}clone(){const e=new Js(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}};$t.generate=function(e){const t=new $t,r=zt(8),n=zt(24);return t.ufrag=r.toString("hex"),t.pwd=n.toString("hex"),t.lite=e,t},$t.expand=function(e){if("ICEInfo"===e.constructor.name)return e;const t=new $t((e=e).ufrag,e.pwd);return t.setLite(e.lite),t.setEndOfCandidates(e.endOfCandidates),t},$t.clone=function(e){return"ICEInfo"===e.constructor.name?e.clone():$t.expand(e)};var Kt=$t;const Ht=Rt("SEND","RECV");Ht.byValue=function(e){return Ht[e.toUpperCase()]},Ht.toString=function(e){switch(e){case Ht.SEND:return"send";case Ht.RECV:return"recv"}},Ht.reverse=function(e){switch(e){case Ht.SEND:return Ht.RECV;case Ht.RECV:return Ht.SEND}};var Jt=Ht;const Qt=Jt;let qt=class ei{constructor(e,t){this.id=e,this.direction=t,this.formats=[],this.params=new Map}clone(){var e=new ei(this.id,this.direction);return e.setFormats(this.formats),e.setParams(this.params),e}plain(){var e={id:this.id,direction:Qt.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)}};qt.expand=function(e){if("RIDInfo"===e.constructor.name)return e;const t=new qt((e=e).id,Qt.byValue(e.direction));for(const[r,n]of Object.entries(e.params||{}))t.addParam(r,n);return e.formats&&t.setFormats(e.formats),t},qt.clone=function(e){return"RIDInfo"===e.constructor.name?e.clone():qt.expand(e)};var er=qt;let tr=class ti{constructor(e,t){this.paused=t,this.id=e}clone(){return new ti(this.id,this.paused)}plain(){return{id:this.id,paused:this.paused}}isPaused(){return this.paused}getId(){return this.id}};tr.expand=function(e){return"SimulcastStreamInfo"===e.constructor.name?e:new tr((e=e).id,e.paused)},tr.clone=function(e){return"SimulcastStreamInfo"===e.constructor.name?e.clone():tr.expand(e)};var rr=tr;const nr=rr,sr=Jt;let ir=class ri{constructor(){this.send=[],this.recv=[]}clone(){const e=new ri;for(const t of this.send)e.addSimulcastAlternativeStreams(sr.SEND,t.map(e=>e.clone()));for(const t of this.recv)e.addSimulcastAlternativeStreams(sr.RECV,t.map(e=>e.clone()));return e}plain(){const e={send:[],recv:[]};for(const t of this.send)e.send.push(t.map(e=>e.plain()));for(const t of this.recv)e.recv.push(t.map(e=>e.plain()));return e}addSimulcastAlternativeStreams(e,t){return e===sr.SEND?this.send.push(t):this.recv.push(t)}addSimulcastStream(e,t){return e===sr.SEND?this.send.push([t]):this.recv.push([t])}getSimulcastStreams(e){return e===sr.SEND?this.send:this.recv}};ir.expand=function(e){if("SimulcastInfo"===e.constructor.name)return e;e=e;const t=new ir;for(const r of e.send||[])t.addSimulcastAlternativeStreams(sr.SEND,r.map(nr.expand));for(const r of e.recv||[])t.addSimulcastAlternativeStreams(sr.RECV,r.map(nr.expand));return t},ir.clone=function(e){return"SimulcastInfo"===e.constructor.name?e.clone():ir.expand(e)};var or=ir;const ar=Rt("SENDRECV","SENDONLY","RECVONLY","INACTIVE");ar.byValue=function(e){return ar[e.toUpperCase()]},ar.toString=function(e){switch(e){case ar.SENDRECV:return"sendrecv";case ar.SENDONLY:return"sendonly";case ar.RECVONLY:return"recvonly";case ar.INACTIVE:return"inactive"}},ar.reverse=function(e){switch(e){case ar.SENDRECV:return ar.SENDRECV;case ar.SENDONLY:return ar.RECVONLY;case ar.RECVONLY:return ar.SENDONLY;case ar.INACTIVE:return ar.INACTIVE}};var cr=ar;let ur=class ni{constructor(e,t){this.port=e,this.maxMessageSize=t}clone(){return new ni(this.port,this.maxMessageSize)}plain(){return{port:this.port,maxMessageSize:this.maxMessageSize}}getPort(){return this.port}getMaxMessageSize(){return this.maxMessageSize}};ur.expand=function(e){return"DataChannelInfo"===e.constructor.name?e:new ur((e=e).port,e.maxMessageSize)},ur.clone=function(e){return"DataChannelInfo"===e.constructor.name?e.clone():ur.expand(e)};var dr=ur;const hr=St,fr=er,pr=or,gr=cr,br=Jt,vr=dr;let wr=class Wr{constructor(e,t){this.id=e,this.type=t,this.direction=gr.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 Wr(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:gr.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 Wr(this.id,this.type);if(e){t.setDirection(gr.reverse(this.direction));const{codecs:r,dataChannel:n}=e;if(r){let n;n=Array.isArray(r)?hr.MapFromNames(r,e.rtx,e.rtcpfbs):r;for(let e of this.codecs.values())for(let r of n.values()){if(r.getCodec().toLowerCase()!==e.getCodec().toLowerCase()||"h264"===r.getCodec()&&r.hasParam("packetization-mode")&&r.getParam("packetization-mode")!=e.getParam("packetization-mode","0")||"h264"===r.getCodec()&&r.hasParam("profile-level-id")&&e.hasParam("profile-level-id")&&r.getParam("profile-level-id")!=e.getParam("profile-level-id")||"multiopus"===r.getCodec()&&r.hasParam("num_streams")&&e.hasParam("num_streams")&&r.getParam("num_streams")!=e.getParam("num_streams"))continue;const n=r.clone();n.setType(e.getType()),n.hasRTX()&&n.setRTX(e.getRTX()),e.hasChannels()&&n.setChannels(e.getChannels()),n.addParams(e.getParams()),t.addCodec(n);break}}const s=new Set(e.extensions);for(let[e,r]of this.extensions)s.has(r)&&t.addExtension(e,r);if(e.simulcast&&this.simulcast){const e=new pr,r=this.simulcast.getSimulcastStreams(br.SEND);if(r)for(const t of r){const r=t.map(e=>e.clone());e.addSimulcastAlternativeStreams(br.RECV,r)}const n=this.simulcast.getSimulcastStreams(br.RECV);if(n)for(const t of n){const r=t.map(e=>e.clone());e.addSimulcastAlternativeStreams(br.SEND,r)}for(const e of this.rids.values()){const r=e.clone();r.setDirection(br.reverse(e.getDirection())),t.addRID(r)}t.setSimulcast(e)}if(n&&this.dataChannel){const e=new vr(this.dataChannel.getPort(),n.maxMessageSize?n.maxMessageSize:this.dataChannel.getMaxMessageSize());t.setDataChannel(e)}}else t.setDirection(gr.INACTIVE);return t}getSimulcast(){return this.simulcast}setSimulcast(e){this.simulcast=e}};function Sr(e){const t=e.toString();if(!/^\d+$/.test(t))throw new Error("invalid integer ".concat(t));return parseInt(t)}wr.create=function(e,t,r){!r&&"string"!=typeof t&&(r=t,t=e);const n=new wr(e,t);if(r){const{codecs:e}=r;e&&(Array.isArray(e)?n.setCodecs(hr.MapFromNames(e,r.rtx,r.rtcpfbs)):n.setCodecs(e))}else n.setDirection(gr.INACTIVE);return n},wr.expand=function(e){if("MediaInfo"===e.constructor.name)return e;const t=new wr((e=e).id,e.type);if(e.direction&&t.setDirection(gr.byValue(e.direction)),t.setBitrate(e.bitrate),e.dataChannel){const r=vr.expand(e.dataChannel);r&&t.setDataChannel(r)}for(const[r,n]of Object.entries(e.extensions))t.addExtension(Sr(r),n);for(const r of e.codecs){const e=hr.expand(r);e&&t.addCodec(e)}for(const r of e.rids||[]){const e=fr.expand(r);t.addRID(e)}return e.simulcast&&t.setSimulcast(pr.expand(e.simulcast)),e.control&&t.setControl(e.control),t},wr.clone=function(e){return"MediaInfo"===e.constructor.name?e.clone():wr.expand(e)};var Rr=wr;let xr=class ai{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 ai(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}};xr.expand=function(e){return"SourceGroupInfo"===e.constructor.name?e:new xr((e=e).semantics,e.ssrcs)},xr.clone=function(e){return"SourceGroupInfo"===e.constructor.name?e.clone():xr.expand(e)};var kr=xr;let _r=class ci{constructor(e){this.ssrc=e}clone(){const e=new ci(this.ssrc);return e.setCName(this.cname),e.setStreamId(this.streamId),e.setTrackId(this.trackId),e}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}};_r.expand=function(e){if("SourceInfo"===e.constructor.name)return e;const t=new _r((e=e).ssrc);return t.setCName(e.cname),t.setStreamId(e.streamId),t.setTrackId(e.trackId),t},_r.clone=function(e){return"SourceInfo"===e.constructor.name?e.clone():_r.expand(e)};var Cr=_r;const Ir=St;let Er=class ui{constructor(e,t=!1){this.id=e,this.paused=t,this.codecs=new Map,this.params=new Map}clone(){var e=new ui(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}};Er.expand=function(e){if("TrackEncodingInfo"===e.constructor.name)return e;const t=new Er((e=e).id,e.paused);for(const r of Object.values(e.codecs||{}))t.addCodec(Ir.expand(r));for(const[r,n]of Object.entries(e.params||{}))t.addParam(r,n);return t},Er.clone=function(e){return"TrackEncodingInfo"===e.constructor.name?e.clone():Er.expand(e)};var Tr=Er;const Lr=kr,Ar=Tr;let Mr=class di{constructor(e,t){this.media=e,this.id=t,this.ssrcs=[],this.groups=[],this.encodings=[]}clone(){const e=new di(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}getSourceGroupsForMediaSSRC(e){return this.groups.filter(t=>t.getSSRCs()[0]===e)}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}getEncodingSources(){const e=[];if(this.encodings.length)for(const t of this.encodings)for(const r of t){const t={id:r.getId(),rid:r.getId()},n=r.getParams(),s=null==n?void 0:n.get("ssrc");if(void 0!==s){t.media=parseInt(s);for(const e of this.getSourceGroupsForMediaSSRC(t.media))switch(e.getSemantics()){case"FID":t.rtx=e.getSSRCs()[1];break;case"FEC-FR":t.fec=e.getSSRCs()[1]}}e.push(t)}else if(this.hasSourceGroup("SIM")){const t=this.getSourceGroup("SIM").getSSRCs();this.getSourceGroups();for(const r of t){const t={id:String(r),media:r};for(const e of this.getSourceGroupsForMediaSSRC(t.media))switch(e.getSemantics()){case"FID":t.rtx=e.getSSRCs()[1];break;case"FEC-FR":t.fec=e.getSSRCs()[1]}e.push(t)}}else{const t={id:""};if(this.ssrcs.length){t.media=this.ssrcs[0];for(const e of this.getSourceGroupsForMediaSSRC(t.media))switch(e.getSemantics()){case"FID":t.rtx=e.getSSRCs()[1];break;case"FEC-FR":t.fec=e.getSSRCs()[1]}}e.push(t)}return e}};Mr.expand=function(e){var t,r;if("TrackInfo"===e.constructor.name)return e;const n=new Mr((e=e).media,e.id);if(e.mediaId&&n.setMediaId(e.mediaId),Array.isArray(e.ssrcs))for(const t of e.ssrcs)n.addSSRC(t);else if(void 0!==(null===(t=e.ssrcs)||void 0===t?void 0:t.media)){const t=e.ssrcs.media;if(n.addSSRC(t),void 0!==e.ssrcs.rtx){const r=e.ssrcs.rtx;n.addSSRC(r),n.addSourceGroup(new Lr("FID",[t,r]))}if(void 0!==e.ssrcs.fec){const r=e.ssrcs.fec;n.addSSRC(r),n.addSourceGroup(new Lr("FEC-FR",[t,r]))}}if(e.rid){const t=new Ar(e.rid);void 0!==(null===(r=e.ssrcs)||void 0===r?void 0:r.media)&&t.addParam("ssrc",e.ssrcs.media),n.addAlternativeEncodings([t])}for(const t of e.groups||[])n.addSourceGroup(Lr.expand(t));for(const t of e.encodings||[]){const e=[];for(const r of t)e.push(Ar.expand(r));n.addAlternativeEncodings(e)}return n},Mr.clone=function(e){return"TrackInfo"===e.constructor.name?e.clone():Mr.expand(e)};var Pr=Mr;const Or=Pr;let Dr=class fi{constructor(e){this.id=e,this.tracks=new Map}clone(){const e=new fi(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)}};Dr.expand=function(e){if("StreamInfo"===e.constructor.name)return e;const t=new Dr((e=e).id);for(const r of e.tracks||[]){const e=Or.expand(r);e&&t.addTrack(e)}return t},Dr.clone=function(e){return"StreamInfo"===e.constructor.name?e.clone():Dr.expand(e)};var Fr=Dr;const jr=et,Zr=function(e){const t=new Intl.Collator(e,{sensitivity:"base"});return(e,r)=>0==t.compare(e,r)}("en-US"),Nr=gt,Vr=St,Ur=bt,Gr=It,Br=Tt,Xr=Kt,zr=Rr,Yr=kt,$r=cr,Kr=Jt,Hr=kr,Jr=Cr,Qr=Fr,qr=Pr,en=Tr,tn=or,rn=rr,nn=er,sn=dr;let on=class lr{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 lr(this.version);for(const t of this.medias)e.addMedia(t.clone());for(const t of this.streams.values())e.addStream(t.clone());for(const t of this.candidates)e.addCandidate(t.clone());return e.setICE(this.ice.clone()),this.dtls&&e.setDTLS(this.dtls.clone()),this.crypto&&e.setCrypto(this.crypto.clone()),e.setExtmapAllowMixed(this.extmapAllowMixed),e}plain(){const e={version:this.version,streams:[],medias:[],candidates:[]};for(const t of this.medias)e.medias.push(t.plain());for(const t of this.streams.values())e.streams.push(t.plain());for(const t of this.candidates)e.candidates.push(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 lr(this.version);for(const t of this.medias)e.addMedia(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(const t of this.candidates)e.addCandidate(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(Zr(r.getType(),e))return r}return null}getMediasByType(e){let t=[];for(let r in this.medias){let n=this.medias[r];Zr(n.getType(),e)&&t.push(n)}return t}getMediaById(e){for(const t of this.medias)if(Zr(t.getId(),e))return t;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(const t of this.candidates)if(t.equals(e))return;this.candidates.push(e)}addCandidates(e){for(const t of e)this.addCandidate(t)}getCandidates(){return this.candidates}getStream(e){return this.streams.get(e)}getStreams(){return this.streams}getFirstStream(){for(const 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()}getTracksByMediaType(e){let t=[];for(const r of this.streams.values())for(const[n,s]of r.getTracks())Zr(s.getMedia(),e)&&t.push(s);return t}getTrackByMediaId(e){for(const t of this.streams.values())for(const[r,n]of t.getTracks())if(n.getMediaId()==e)return n;return null}getStreamByMediaId(e){for(const t of this.streams.values())for(const[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 lr;e.ice&&(e.ice instanceof Xr?t.setICE(e.ice.clone()):t.setICE(Xr.expand(e.ice))),e.dtls&&(e.dtls instanceof Gr?t.setDTLS(e.dtls):t.setDTLS(Gr.expand(e.dtls))),e.crypto&&(e.crypto instanceof Br?t.setCrypto(e.crypto):t.setCrypto(Br.expand(e.crypto)));for(let r=0;e.candidates&&r<e.candidates.length;++r)e.candidates[r]instanceof Nr?t.addCandidate(e.candidates[r].clone()):t.addCandidate(Nr.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");const t=[];for(const r of this.medias){let n={type:r.getType(),port:9,protocol:"",fmtp:[],rtp:[],rtcpFb:[],ext:[],bandwidth:[],candidates:[],ssrcGroups:[],ssrcs:[],rids:[]};n.direction=$r.toString(r.getDirection()),this.extmapAllowMixed&&(n.extmapAllowMixed="extmap-allow-mixed"),n.mid=r.getId(),t.push(r.getId()),r.hasControl()&&(n.control=r.getControl()),r.getBitrate()>0&&(n.bandwidth.push({type:"AS",limit:r.getBitrate()}),n.bandwidth.push({type:"TIAS",limit:1e3*r.getBitrate()}));let s=this.getCandidates();for(const e of s)n.candidates.push({foundation:e.getFoundation(),component:e.getComponentId(),transport:e.getTransport(),priority:e.getPriority(),ip:e.getAddress(),port:e.getPort(),type:e.getType(),raddr:e.getRelAddr(),rport:e.getRelPort()});if(this.getICE()&&(n.iceUfrag=this.getICE().getUfrag(),n.icePwd=this.getICE().getPwd()),Zr("audio",r.getType())||Zr("video",r.getType())){n.rtcpMux="rtcp-mux",n.rtcpRsize="rtcp-rsize",this.getDTLS()?(n.protocol="UDP/TLS/RTP/SAVPF",n.fingerprint={type:this.getDTLS().getHash(),hash:this.getDTLS().getFingerprint()},n.setup=Yr.toString(this.getDTLS().getSetup())):this.getCrypto()?(n.protocol="RTP/SAVPF",n.crypto=[{id:this.getCrypto().getTag(),suite:this.getCrypto().getSuite(),config:this.getCrypto().getKeyParams()}]):n.protocol="RTP/AVP";for(const e of r.getCodecs().values()){Zr("video",r.getType())?n.rtp.push({payload:e.getType(),codec:e.getCodec().toUpperCase(),rate:9e4}):Zr("opus",e.getCodec())||Zr("multiopus",e.getCodec())?n.rtp.push({payload:e.getType(),codec:e.getCodec(),rate:48e3,encoding:e.getChannels()}):n.rtp.push({payload:e.getType(),codec:e.getCodec(),rate:8e3});for(const t of e.getRTCPFeedbacks())n.rtcpFb.push({payload:e.getType(),type:t.getId(),subtype:t.getParams().join(" ")});e.hasRTX()&&(n.rtp.push({payload:e.getRTX(),codec:"rtx",rate:9e4}),n.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+=";"),Object.hasOwnProperty.call(t,e)?r.config+=e+"="+t[e]:r.config+=e;n.fmtp.push(r)}}const e=[];for(const t of n.rtp)e.push(t.payload);n.payloads=e.join(" ");for(let[e,t]of r.getExtensions().entries())n.ext.push({value:e,uri:t});for(let e of r.getRIDs().values()){let t={id:e.getId(),direction:Kr.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;n.rids.push(t)}const t=r.getSimulcast();if(t){let e=1;n.simulcast={};const r=t.getSimulcastStreams(Kr.SEND),s=t.getSimulcastStreams(Kr.RECV);if(r&&r.length){let t="";for(const e of r){let r="";for(const t of e)r+=(r.length?",":"")+(t.isPaused()?"~":"")+t.getId();t+=(t.length?";":"")+r}n.simulcast["dir"+e]="send",n.simulcast["list"+e]=t,e++}if(s&&s.length){let t="";for(const e of s){let r="";for(const t of e)r+=(r.length?",":"")+(t.isPaused()?"~":"")+t.getId();t+=(t.length?";":"")+r}n.simulcast["dir"+e]="recv",n.simulcast["list"+e]=t,e++}}}else if(r.hasDataChannel()){n.protocol="UDP/DTLS/SCTP",n.payloads="webrtc-datachannel";const e=r.getDataChannel();n.sctpPort=e.getPort(),n.maxMessageSize=e.getMaxMessageSize()}e.media.push(n)}for(let t of this.streams.values())for(let r of t.getTracks().values())for(let n in e.media){let s=e.media[n];if(r.getMediaId()){if(r.getMediaId()==s.mid){let e=r.getSourceGroups();for(let t in e){let r=e[t];s.ssrcGroups.push({semantics:r.getSemantics(),ssrcs:r.getSSRCs().join(" ")})}let n=r.getSSRCs();for(let e in n)s.ssrcs.push({id:n[e],attribute:"cname",value:t.getId()}),s.ssrcs.push({id:n[e],attribute:"msid",value:t.getId()+" "+r.getId()});s.msid=t.getId()+" "+r.getId();break}}else if(Zr(s.type,r.getMedia())){let e=r.getSourceGroups();for(let t in e){let r=e[t];s.ssrcGroups.push({semantics:r.getSemantics(),ssrcs:r.getSSRCs().join(" ")})}let n=r.getSSRCs();for(let e in n)s.ssrcs.push({id:n[e],attribute:"cname",value:t.getId()}),s.ssrcs.push({id:n[e],attribute:"msid",value:t.getId()+" "+r.getId()});break}}const r={type:"BUNDLE",mids:t.join(" ")};return e.groups.push(r),jr.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 jr.write(e).slice(10)}};on.create=function(e){var t;const r=new on;if(e.streams)for(const t of e.streams)r.addStream(Qr.expand(t));e.ice&&(e.ice instanceof Xr?r.setICE(e.ice.clone()):r.setICE(Xr.expand(e.ice))),e.dtls&&(e.dtls instanceof Gr?r.setDTLS(e.dtls):r.setDTLS(Gr.expand(e.dtls))),e.crypto&&(e.crypto instanceof Br?r.setCrypto(e.crypto):r.setCrypto(Br.expand(e.crypto)));for(const t of e.candidates||[])t instanceof Nr?r.addCandidate(t.clone()):r.addCandidate(Nr.expand(t));let n=96,s=1,i=0;for(const[o,a]of Object.entries(e.capabilities||{}))if(e.unified&&null!==(t=e.streams)&&void 0!==t&&t.length)for(const e of r.getTracksByMediaType(o)){const t=zr.create(e.getMediaId(),o,a);for(const[e,r]of t.getCodecs())r.getType()>=96&&r.setType(n++),r.getRTX()&&r.setRTX(n++);if(a.extensions)for(let e of a.extensions)15===s&&s++,t.addExtension(s++,e);r.addMedia(t)}else{const t=zr.create(e.unified?String(i++):o,o,a);for(const[e,r]of t.getCodecs())r.getType()>=96&&r.setType(n++),r.getRTX()&&r.setRTX(n++);if(a.extensions)for(let e of a.extensions)15===s&&s++,t.addExtension(s++,e);r.addMedia(t)}return r},on.expand=function(e){if("SDPInfo"===e.constructor.name)return e;const t=new on((e=e).version);for(const r of e.medias||[]){const e=zr.expand(r);e&&t.addMedia(e)}for(const r of e.streams||[]){const e=Qr.expand(r);e&&t.addStream(e)}for(const r of e.candidates||[]){const e=Nr.expand(r);e&&t.addCandidate(e)}return e.ice&&t.setICE(Xr.expand(e.ice)),e.dtls&&t.setDTLS(Gr.expand(e.dtls)),e.crypto&&t.setCrypto(Br.expand(e.crypto)),e.extmapAllowMixedNotSupported&&(this.extmapAllowMixed=!e.extmapAllowMixedNotSupported),t},on.clone=function(e){return"SDPInfo"===e.constructor.name?e.clone():on.expand(e)},on.process=function(e){return on.parse(e)},on.parse=function(e){const t=jr.parse(e),r=new on;if(r.setVersion(t.version),t.iceUfrag&&t.icePwd){const e=String(t.iceUfrag),n=String(t.icePwd),s=new Xr(e,n);s.setLite("ice-lite"==t.icelite),s.setEndOfCandidates("end-of-candidates"==t.endOfCandidates),r.setICE(s)}for(let e in t.media){const n=t.media[e],s=n.type,i=n.mid?n.mid.toString():e,o=new zr(i,s);if(n.iceUfrag&&n.icePwd){const e=String(n.iceUfrag),s=String(n.icePwd),i=new Xr(e,s);i.setLite("ice-lite"==t.icelite),i.setEndOfCandidates("end-of-candidates"==n.endOfCandidates),r.setICE(i)}for(let e=0;n.candidates&&e<n.candidates.length;++e){const t=n.candidates[e],s=new Nr(t.foundation,t.component,t.transport,t.priority,t.ip,t.port,t.type,t.raddr,t.rport);r.addCandidate(s)}const a=n.fingerprint||t.fingerprint;if(a){const e=a.type,t=a.hash;let s=Yr.ACTPASS;n.setup&&(s=Yr.byValue(n.setup)),r.setDTLS(new Gr(s,e,t))}if(n.crypto){const e=n.crypto[0];r.setCrypto(new Br(e.id,e.suite,e.config,e.sessionConfig))}let c=$r.SENDRECV;n.direction&&(c=$r.byValue(n.direction),o.setDirection(c)),n.control&&o.setControl(n.control),r.setExtmapAllowMixed("extmap-allow-mixed"==n.extmapAllowMixed||"extmap-allow-mixed"==t.extmapAllowMixed);const l=new Map;for(let e in n.rtp){const t=n.rtp[e],r=t.payload,s=t.codec;if("RED"===s.toUpperCase()||"ULPFEC"===s.toUpperCase())continue;let i={};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(),s=r.splice(1).join("=").trim();i[n]=s}}}if("RTX"===s.toUpperCase())l.set(parseInt(i.apt),r);else{const e=new Vr(s,r,i);t.encoding>1&&e.setChannels(t.encoding),o.addCodec(e)}}for(let e of l.entries()){const t=o.getCodecForType(e[0]);t&&t.setRTX(e[1])}for(let e=0;n.rtcpFb&&e<n.rtcpFb.length;++e){const t=o.getCodecForType(n.rtcpFb[e].payload);if(t){const r=n.rtcpFb[e].type,s=n.rtcpFb[e].subtype?n.rtcpFb[e].subtype.split(" "):null;t.addRTCPFeedback(new Ur(r,s))}}const u=n.ext;for(let e in u){const t=u[e];o.addExtension(t.value,t.uri)}const d=n.rids;for(let e in d){const t=d[e],r=new nn(t.id,Kr.byValue(t.direction));let n=[];const s=new Map;if(t.params){const e=jr.parseParams(t.params);for(let t in e)"pt"===t?n=e[t].split(","):s.set(t,e[t]);r.setFormats(n),r.setParams(s)}o.addRID(r)}const h=[];if(n.simulcast){const e=new tn;if(n.simulcast.dir1){const t=Kr.byValue(n.simulcast.dir1),r=jr.parseSimulcastStreamList(n.simulcast.list1);for(let n=0;n<r.length;++n){const s=[];for(let e=0;e<r[n].length;++e)s.push(new rn(r[n][e].scid,r[n][e].paused));e.addSimulcastAlternativeStreams(t,s)}}if(n.simulcast.dir2){const t=Kr.byValue(n.simulcast.dir2),r=jr.parseSimulcastStreamList(n.simulcast.list2);for(let n=0;n<r.length;++n){const s=[];for(let e=0;e<r[n].length;++e)s.push(new rn(r[n][e].scid,r[n][e].paused));e.addSimulcastAlternativeStreams(t,s)}}for(let t of e.getSimulcastStreams(Kr.SEND)){const e=[];for(let r=0;r<t.length;r++){const n=new en(t[r].getId(),t[r].isPaused()),s=o.getRID(n.getId());if(s){const t=s.getFormats();for(let e=0;t&&e<t.length;++e){const r=o.getCodecForType(t[e]);r&&n.addCodec(r)}n.setParams(s.getParams()),e.push(n)}}e.length&&h.push(e)}o.setSimulcast(e)}const f=new Map;if(n.ssrcs)for(let e in n.ssrcs){let t=n.ssrcs[e],o=t.id,a=t.attribute,c=t.value,l=f.get(o);if(l||(l=new Jr(o),f.set(l.getSSRC(),l)),Zr("cname",a))l.setCName(c);else if(Zr("msid",a)){let e=c.split(" "),t=e[0],n=e[1];l.setStreamId(t),l.setTrackId(n);let a=r.getStream(t);a||(a=new Qr(t),r.addStream(a));let u=a.getTrack(n);u||(u=new qr(s,n),u.setMediaId(i),u.setEncodings(h),a.addTrack(u)),u.addSSRC(o)}}if(n.msid){let e=n.msid.split(" "),t=e[0],o=e[1],a=r.getStream(t);a||(a=new Qr(t),r.addStream(a));let c=a.getTrack(o);c||(c=new qr(s,o),c.setMediaId(i),c.setEncodings(h),a.addTrack(c));for(let[e,r]of f.entries())r.getStreamId()||(r.setStreamId(t),r.setTrackId(o),c.addSSRC(e))}for(let[e,t]of f.entries())if(!t.getStreamId()){let n=t.getCName(),o=i;t.setStreamId(n),t.setTrackId(o);let a=r.getStream(n);a||(a=new Qr(n),r.addStream(a));let c=a.getTrack(o);c||(c=new qr(s,o),c.setMediaId(i),c.setEncodings(h),a.addTrack(c)),c.addSSRC(e)}if(n.ssrcGroups)for(let e in n.ssrcGroups){let t=n.ssrcGroups[e],s=t.ssrcs.split(" "),i=new Hr(t.semantics,s),o=f.get(parseInt(s[0]));o&&r.getStream(o.getStreamId()).getTrack(o.getTrackId()).addSourceGroup(i)}if("application"==n.type&&"webrtc-datachannel"==n.payloads){const e=new sn(n.sctpPort,n.maxMessageSize);o.setDataChannel(e)}r.addMedia(o)}return r};var an=on;Object.defineProperty(qe,"__esModule",{value:!0});var cn=qe.SDPInfo=an;qe.CandidateInfo=gt,qe.CodecInfo=St,qe.DTLSInfo=It,qe.CryptoInfo=Tt,qe.ICEInfo=Kt;var ln=qe.MediaInfo=Rr;qe.Setup=kt,qe.SourceGroupInfo=kr,qe.SourceInfo=Cr,qe.StreamInfo=Fr,qe.TrackInfo=Pr,qe.RTCPFeedbackInfo=bt,qe.TrackEncodingInfo=Tr,qe.RIDInfo=er,qe.SimulcastInfo=or,qe.SimulcastStreamInfo=rr,qe.DataChannelInfo=dr;var un=qe.Direction=cr,dn={exports:{}};!function(e,t){!function(r,n){var s="function",i="undefined",o="object",a="string",c="major",l="model",u="name",d="type",h="vendor",f="version",p="architecture",m="console",g="mobile",y="tablet",v="smarttv",w="wearable",R="embedded",k="Amazon",_="Apple",I="ASUS",E="BlackBerry",T="Browser",L="Chrome",A="Firefox",M="Google",O="Huawei",D="LG",j="Microsoft",Z="Motorola",N="Opera",V="Samsung",U="Sony",W="Xiaomi",G="Zebra",B="Facebook",z="Chromium OS",Y=" Browser",$=function(e){for(var t={},r=0;r<e.length;r++)t[e[r].toUpperCase()]=e[r];return t},K=function(e,t){return typeof e===a&&-1!==H(t).indexOf(H(e))},H=function(e){return e.toLowerCase()},J=function(e,t){if(typeof e===a)return e=e.replace(/^\s\s*/,""),typeof t===i?e:e.substring(0,500)},Q=function(e,t){for(var r,i,a,c,l,u,d=0;d<t.length&&!l;){var h=t[d],f=t[d+1];for(r=i=0;r<h.length&&!l&&h[r];)if(l=h[r++].exec(e))for(a=0;a<f.length;a++)u=l[++i],typeof(c=f[a])===o&&c.length>0?2===c.length?typeof c[1]==s?this[c[0]]=c[1].call(this,u):this[c[0]]=c[1]:3===c.length?typeof c[1]!==s||c[1].exec&&c[1].test?this[c[0]]=u?u.replace(c[1],c[2]):n:this[c[0]]=u?c[1].call(this,u,c[2]):n:4===c.length&&(this[c[0]]=u?c[3].call(this,u.replace(c[1],c[2])):n):this[c]=u||n;d+=2}},q=function(e,t){for(var r in t)if(typeof t[r]===o&&t[r].length>0){for(var s=0;s<t[r].length;s++)if(K(t[r][s],e))return"?"===r?n:r}else if(K(t[r],e))return"?"===r?n:r;return t.hasOwnProperty("*")?t["*"]:e},ee={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"},te={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,N+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[f,[u,N+" GX"]],[/\bopr\/([\w\.]+)/i],[f,[u,N]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[f,[u,"Baidu"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim)\s?(?:browser)?[\/ ]?([\w\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio)\/([-\w\.]+)/i,/(heytap|ovi)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[u,f],[/quark(?:pc)?\/([-\w\.]+)/i],[f,[u,"Quark"]],[/\bddg\/([\w\.]+)/i],[f,[u,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[f,[u,"UC"+T]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[f,[u,"WeChat"]],[/konqueror\/([\w\.]+)/i],[f,[u,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[f,[u,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[f,[u,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[f,[u,"Smart Lenovo "+T]],[/(avast|avg)\/([\w\.]+)/i],[[u,/(.+)/,"$1 Secure "+T],f],[/\bfocus\/([\w\.]+)/i],[f,[u,A+" Focus"]],[/\bopt\/([\w\.]+)/i],[f,[u,N+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[f,[u,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[f,[u,"Dolphin"]],[/coast\/([\w\.]+)/i],[f,[u,N+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[f,[u,"MIUI "+T]],[/fxios\/([-\w\.]+)/i],[f,[u,A]],[/\bqihu|(qi?ho?o?|360)browser/i],[[u,"360"+Y]],[/\b(qq)\/([\w\.]+)/i],[[u,/(.+)/,"$1Browser"],f],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[u,/(.+)/,"$1"+Y],f],[/samsungbrowser\/([\w\.]+)/i],[f,[u,V+" Internet"]],[/(comodo_dragon)\/([\w\.]+)/i],[[u,/_/g," "],f],[/metasr[\/ ]?([\d\.]+)/i],[f,[u,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[u,"Sogou Mobile"],f],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345Explorer)[\/ ]?([\w\.]+)/i],[u,f],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[u],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[u,B],f],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[u,f],[/\bgsa\/([\w\.]+) .*safari\//i],[f,[u,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[f,[u,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[f,[u,L+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[u,L+" WebView"],f],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[f,[u,"Android "+T]],[/(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,q,{"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],[/(wolvic)\/([\w\.]+)/i],[u,f],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[f,[u,A+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\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|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[u,[f,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[u,[f,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[p,"amd64"]],[/(ia32(?=;))/i],[[p,H]],[/((?: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/,"",H]],[/(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,H]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[l,[h,V],[d,y]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[l,[h,V],[d,g]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[l,[h,_],[d,g]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[l,[h,_],[d,y]],[/(macintosh);/i],[l,[h,_]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[l,[h,"Sharp"],[d,g]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[l,[h,O],[d,y]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[l,[h,O],[d,g]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i],[[l,/_/g," "],[h,W],[d,g]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[l,/_/g," "],[h,W],[d,y]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[l,[h,"OPPO"],[d,g]],[/\b(opd2\d{3}a?) bui/i],[l,[h,"OPPO"],[d,y]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[l,[h,"Vivo"],[d,g]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[l,[h,"Realme"],[d,g]],[/\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],[l,[h,Z],[d,g]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[l,[h,Z],[d,y]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[l,[h,D],[d,y]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[l,[h,D],[d,g]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[l,[h,"Lenovo"],[d,y]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[l,/_/g," "],[h,"Nokia"],[d,g]],[/(pixel c)\b/i],[l,[h,M],[d,y]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[l,[h,M],[d,g]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[l,[h,U],[d,g]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[l,"Xperia Tablet"],[h,U],[d,y]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[l,[h,"OnePlus"],[d,g]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[l,[h,k],[d,y]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[l,/(.+)/g,"Fire Phone $1"],[h,k],[d,g]],[/(playbook);[-\w\),; ]+(rim)/i],[l,h,[d,y]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[l,[h,E],[d,g]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[l,[h,I],[d,y]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[l,[h,I],[d,g]],[/(nexus 9)/i],[l,[h,"HTC"],[d,y]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[h,[l,/_/g," "],[d,g]],[/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])\w*(\)| bui)/i],[l,[h,"TCL"],[d,y]],[/(itel) ((\w+))/i],[[h,H],l,[d,q,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[l,[h,"Acer"],[d,y]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[l,[h,"Meizu"],[d,g]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[l,[h,"Ulefone"],[d,g]],[/droid.+; (a(?:015|06[35]|142p?))/i],[l,[h,"Nothing"],[d,g]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[h,l,[d,g]],[/(kobo)\s(ereader|touch)/i,/(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],[h,l,[d,y]],[/(surface duo)/i],[l,[h,j],[d,y]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[l,[h,"Fairphone"],[d,g]],[/(u304aa)/i],[l,[h,"AT&T"],[d,g]],[/\bsie-(\w*)/i],[l,[h,"Siemens"],[d,g]],[/\b(rct\w+) b/i],[l,[h,"RCA"],[d,y]],[/\b(venue[\d ]{2,7}) b/i],[l,[h,"Dell"],[d,y]],[/\b(q(?:mv|ta)\w+) b/i],[l,[h,"Verizon"],[d,y]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[l,[h,"Barnes & Noble"],[d,y]],[/\b(tm\d{3}\w+) b/i],[l,[h,"NuVision"],[d,y]],[/\b(k88) b/i],[l,[h,"ZTE"],[d,y]],[/\b(nx\d{3}j) b/i],[l,[h,"ZTE"],[d,g]],[/\b(gen\d{3}) b.+49h/i],[l,[h,"Swiss"],[d,g]],[/\b(zur\d{3}) b/i],[l,[h,"Swiss"],[d,y]],[/\b((zeki)?tb.*\b) b/i],[l,[h,"Zeki"],[d,y]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[h,"Dragon Touch"],l,[d,y]],[/\b(ns-?\w{0,9}) b/i],[l,[h,"Insignia"],[d,y]],[/\b((nxa|next)-?\w{0,9}) b/i],[l,[h,"NextBook"],[d,y]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[h,"Voice"],l,[d,g]],[/\b(lvtel\-)?(v1[12]) b/i],[[h,"LvTel"],l,[d,g]],[/\b(ph-1) /i],[l,[h,"Essential"],[d,g]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[l,[h,"Envizen"],[d,y]],[/\b(trio[-\w\. ]+) b/i],[l,[h,"MachSpeed"],[d,y]],[/\btu_(1491) b/i],[l,[h,"Rotor"],[d,y]],[/(shield[\w ]+) b/i],[l,[h,"Nvidia"],[d,y]],[/(sprint) (\w+)/i],[h,l,[d,g]],[/(kin\.[onetw]{3})/i],[[l,/\./g," "],[h,j],[d,g]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[l,[h,G],[d,y]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[l,[h,G],[d,g]],[/smart-tv.+(samsung)/i],[h,[d,v]],[/hbbtv.+maple;(\d+)/i],[[l,/^/,"SmartTV"],[h,V],[d,v]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[h,D],[d,v]],[/(apple) ?tv/i],[h,[l,_+" TV"],[d,v]],[/crkey/i],[[l,L+"cast"],[h,M],[d,v]],[/droid.+aft(\w+)( bui|\))/i],[l,[h,k],[d,v]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[l,[h,"Sharp"],[d,v]],[/(bravia[\w ]+)( bui|\))/i],[l,[h,U],[d,v]],[/(mitv-\w{5}) bui/i],[l,[h,W],[d,v]],[/Hbbtv.*(technisat) (.*);/i],[h,l,[d,v]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[h,J],[l,J],[d,v]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[d,v]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[h,l,[d,m]],[/droid.+; (shield) bui/i],[l,[h,"Nvidia"],[d,m]],[/(playstation [345portablevi]+)/i],[l,[h,U],[d,m]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[l,[h,j],[d,m]],[/\b(sm-[lr]\d\d[05][fnuw]?s?)\b/i],[l,[h,V],[d,w]],[/((pebble))app/i],[h,l,[d,w]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[l,[h,_],[d,w]],[/droid.+; (glass) \d/i],[l,[h,M],[d,w]],[/droid.+; (wt63?0{2,3})\)/i],[l,[h,G],[d,w]],[/(quest( \d| pro)?)/i],[l,[h,B],[d,w]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[h,[d,R]],[/(aeobc)\b/i],[l,[h,k],[d,R]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[l,[d,g]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[l,[d,y]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[d,y]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[d,g]],[/(android[-\w\. ]{0,9});.+buil/i],[l,[h,"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,/\b(libweb)/i],[u,f],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[f,u]],os:[[/microsoft (windows) (vista|xp)/i],[u,f],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[u,[f,q,ee]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[f,q,ee],[u,"Windows"]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[f,/_/g,"."],[u,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[u,"Mac OS"],[f,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[f,u],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[u,f],[/\(bb(10);/i],[f,[u,E]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[f,[u,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[f,[u,A+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[f,[u,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[f,[u,"watchOS"]],[/crkey\/([\d\.]+)/i],[f,[u,L+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[u,z],f],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(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|serenityos)/i,/(unix) ?([\w\.]*)/i],[u,f]]},re=function(e,t){if(typeof e===o&&(t=e,e=n),!(this instanceof re))return new re(e,t).getResult();var m=typeof r!==i&&r.navigator?r.navigator:n,v=e||(m&&m.userAgent?m.userAgent:""),w=m&&m.userAgentData?m.userAgentData:n,R=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}(te,t):te,k=m&&m.userAgent==v;return this.getBrowser=function(){var e={};return e[u]=n,e[f]=n,Q.call(e,v,R.browser),e[c]=function(e){return typeof e===a?e.replace(/[^\d\.]/g,"").split(".")[0]:n}(e[f]),k&&m&&m.brave&&typeof m.brave.isBrave==s&&(e[u]="Brave"),e},this.getCPU=function(){var e={};return e[p]=n,Q.call(e,v,R.cpu),e},this.getDevice=function(){var e={};return e[h]=n,e[l]=n,e[d]=n,Q.call(e,v,R.device),k&&!e[d]&&w&&w.mobile&&(e[d]=g),k&&"Macintosh"==e[l]&&m&&typeof m.standalone!==i&&m.maxTouchPoints&&m.maxTouchPoints>2&&(e[l]="iPad",e[d]=y),e},this.getEngine=function(){var e={};return e[u]=n,e[f]=n,Q.call(e,v,R.engine),e},this.getOS=function(){var e={};return e[u]=n,e[f]=n,Q.call(e,v,R.os),k&&!e[u]&&w&&w.platform&&"Unknown"!=w.platform&&(e[u]=w.platform.replace(/chrome os/i,z).replace(/macos/i,"Mac 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 v},this.setUA=function(e){return v=typeof e===a&&e.length>500?J(e,500):e,this},this.setUA(v),this};re.VERSION="0.7.39",re.BROWSER=$([u,f,c]),re.CPU=$([p]),re.DEVICE=$([l,h,d,m,g,v,y,w,R]),re.ENGINE=re.OS=$([u,f]),e.exports&&(t=e.exports=re),t.UAParser=re;var ne=typeof r!==i&&(r.jQuery||r.Zepto);if(ne&&!ne.ua){var se=new re;ne.ua=se.getResult(),ne.ua.get=function(){return se.getUA()},ne.ua.set=function(e){se.setUA(e);var t=se.getResult();for(var r in t)ne.ua[r]=t[r]}}}("object"==typeof window?window:W)}(dn,dn.exports);const hn=G(dn.exports),fn=["iOS"];class Yt extends hn{constructor(){super(window.navigator.userAgent)}isChromium(){return this.getUA().match(/Chrome/i)}isChrome(){const e=this.getBrowser();if(!e.name)return!1;const t=this.getOS();let r=!0;return r=!new RegExp(fn.join("|"),"i").test(t.name),e.name.match(/Chrome/i)&&r}isFirefox(){const e=this.getBrowser();return!!e.name&&e.name.match(/Firefox/i)}isOpera(){const e=this.getBrowser();return!!e.name&&e.name.match(/Opera/i)}isSafari(){const e=this.getBrowser();return!!e.name&&e.name.match(/Safari/i)}}const pn=_e.get("SdpParser"),mn=Array.from({length:31},(e,t)=>t+35),gn=Array.from({length:32},(e,t)=>t+96),yn=Array.from({length:14},(e,t)=>t+1),bn=Array.from({length:240},(e,t)=>t+16),vn={setSimulcast(e,t){if(pn.info("Setting simulcast. Codec: ",t),!(new Yt).isChromium())return pn.warn("Your browser does not appear to support Simulcast. For a better experience, use a Chromium based browser."),e;if("h264"!==t&&"vp8"!==t)return pn.warn("Your selected codec ".concat(t," does not appear to support Simulcast. To broadcast using simulcast, please use H.264 or VP8.")),e;if(!/m=video/.test(e))return pn.warn("There is no available video for simulcast to be enabled."),e;try{const t=new RegExp("m=video.*?a=ssrc:(\\d*) cname:(.+?)\\r\\n","s"),r=new RegExp("m=video.*?a=ssrc:(\\d*) msid:(.+?)\\r\\n","s"),n=t.exec(e),s=n[1],i=n[2],o=r.exec(e)[2],a=2,c=[s];for(let t=0;t<a;++t){const r=100+2*t,n=r+1;c.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 "+c.join(" ")+"\r\n",pn.info("Simulcast setted"),pn.debug("Simulcast SDP: ",e),e}catch(e){throw pn.error("Error setting SDP for simulcast: ",e),e}},setStereo:e=>(pn.info("Replacing SDP response for support stereo"),e=e.replace(/useinbandfec=1/g,"useinbandfec=1; stereo=1"),pn.info("Replaced SDP response for support stereo"),pn.debug("New SDP value: ",e),e),setDTX:e=>(pn.info("Replacing SDP response for support dtx"),e=e.replace("useinbandfec=1","useinbandfec=1; usedtx=1"),pn.info("Replaced SDP response for support dtx"),pn.debug("New SDP value: ",e),e),setAbsoluteCaptureTime(e){const t="a=extmap:"+vn.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),pn.info("Replaced SDP response for setting absolute capture time"),pn.debug("New SDP value: ",e),e},setDependencyDescriptor(e){const t="a=extmap:"+vn.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),pn.info("Replaced SDP response for setting depency descriptor"),pn.debug("New SDP value: ",e),e},setVideoBitrate(e,t){if(t<1)pn.info("Remove bitrate restrictions"),e=e.replace(/b=AS:.*\r\n/,"").replace(/b=TIAS:.*\r\n/,"");else{const r=cn.parse(e),n=r.getMedia("video");pn.info("Setting video bitrate"),n.setBitrate(t),e=r.toString()}return e},removeSdpLine:(e,t)=>(pn.debug("SDP before trimming: ",e),e=e.split("\n").filter(e=>e.trim()!==t).join("\n"),pn.debug("SDP trimmed result: ",e),e),adaptCodecName(e,t,r){if(!e)return e;const n=new RegExp("".concat(t),"i");return e.replace(n,r)},setMultiopus(e,t){if(!(new Yt).isFirefox()&&(!t||wn(t)))if(e.includes("multiopus/48000/6"))pn.info("Multiopus already setted");else{pn.info("Setting multiopus");const t=/m=audio 9 UDP\/TLS\/RTP\/SAVPF (.*)\r\n/.exec(e)[0],r=vn.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),pn.info("Multiopus offer created"),pn.debug("SDP parsed for multioups: ",e)}return e},getAvailablePayloadTypeRange(e){const t=e.matchAll(/m=(?:.*) (?:.*) UDP\/TLS\/RTP\/SAVPF (.*)\r\n/gm);let r=gn.concat(mn);for(const e of t){const t=e[1].split(" ").map(e=>parseInt(e));r=r.filter(e=>!t.includes(e))}return r},getAvailableHeaderExtensionIdRange(e){const t=e.matchAll(/a=extmap:(\d+)(?:.*)\r\n/gm);let r=yn.concat(bn);for(const e of t){const t=e[1].split(" ").map(e=>parseInt(e));r=r.filter(e=>!t.includes(e))}return r},renegotiate(e,t){const r=cn.parse(e),n=cn.parse(t);for(const e of r.getMedias()){let t=n.getMediaById(e.getId());if(!t){t=new ln(e.getId(),e.getType()),t.setDirection(un.reverse(e.getDirection()));const r=n.getMedia(e.getType());if(r){t.setCodecs(r.getCodecs());for(const[e,n]of r.getExtensions())t.addExtension(e,n)}n.addMedia(t)}}return n.toString()},updateMissingVideoExtensions(e,t){var r;const n=cn.parse(e),s=null==(r=cn.parse(t).getMediasByType("video")[0])?void 0:r.getExtensions();if(s||s.length){for(const t of n.getMediasByType("video")){const r=t.getExtensions();s.forEach((n,s)=>{if(!r.get(s)){const r=t.getId(),i="a=extmap:"+s+" "+n+"\r\n",o=new RegExp("(a=mid:"+r+"\r\n(?:.*\r\n)*?)","g");e=e.replace(o,(e,t,r)=>t+i)}})}return e}},getCodecPayloadType(e){const t=e.matchAll(/a=rtpmap:(\d+) (\w+)\/\d+/g),r={};for(const e of t)r[e[1]]=e[2];return r}},wn=e=>e.getAudioTracks().some(e=>e.getSettings().channelCount>2),Sn={VP8:"vp8",VP9:"vp9",H264:"h264",AV1:"av1",H265:"h265"},Rn={OPUS:"opus",MULTIOPUS:"multiopus"},xn=_e.get("PeerConnection"),kn="Viewer",Cn={track:"track",connectionStateChange:"connectionStateChange"},In={stereo:!1,mediaStream:null,codec:"h264",simulcast:!1,scalabilityMode:null,disableAudio:!1,disableVideo:!1,setSDPToPeer:!0};class tt extends Be{constructor(){super(),this.mode=null,this.sessionDescription=null,this.peer=null,this.peerConnectionStats=null,this.transceiverMap=new Map}async createRTCPeer(e={autoInitStats:!0,statsIntervalMs:1e3},t=kn){xn.info("Creating new RTCPeerConnection"),xn.debug("RTC configuration provided by user: ",e),this.peer=An(this,e),this.mode=t,e.autoInitStats&&this.initStats(e)}getRTCPeer(){return xn.info("Getting RTC Peer"),this.peer}async closeRTCPeer(){var e;xn.info("Closing RTCPeerConnection"),null==(e=this.peer)||e.close(),this.peer=null,this.stopStats(),this.emit(Cn.connectionStateChange,"closed")}async setRTCRemoteSDP(e){xn.info("Setting RTC Remote SDP");const t={type:"answer",sdp:e};try{await this.peer.setRemoteDescription(t),xn.info("RTC Remote SDP was set successfully."),xn.debug("RTC Remote SDP new value: ",e)}catch(e){throw xn.error("Error while setting RTC Remote SDP: ",e),e}}async getRTCLocalSDP(e=In){xn.info("Getting RTC Local SDP"),e=N(N({},In),e),xn.debug("Options: ",e);const t=Ln(e.mediaStream);t?On(this.peer,t,e):Dn(this.peer,e),xn.info("Creating peer offer");const r=await this.peer.createOffer();return xn.info("Peer offer created"),xn.debug("Peer offer response: ",r.sdp),this.sessionDescription=r,e.disableAudio||(e.stereo&&(this.sessionDescription.sdp=vn.setStereo(this.sessionDescription.sdp)),e.dtx&&(this.sessionDescription.sdp=vn.setDTX(this.sessionDescription.sdp)),this.sessionDescription.sdp=vn.setMultiopus(this.sessionDescription.sdp,t)),!e.disableVideo&&e.simulcast&&(this.sessionDescription.sdp=vn.setSimulcast(this.sessionDescription.sdp,e.codec)),e.absCaptureTime&&(this.sessionDescription.sdp=vn.setAbsoluteCaptureTime(this.sessionDescription.sdp)),e.dependencyDescriptor&&(this.sessionDescription.sdp=vn.setDependencyDescriptor(this.sessionDescription.sdp)),e.setSDPToPeer&&(await this.peer.setLocalDescription(this.sessionDescription),xn.info("Peer local description set")),this.sessionDescription.sdp}async addRemoteTrack(e,t){return new Promise((r,n)=>{try{const n=this.peer.addTransceiver(e,{direction:"recvonly",streams:t});this.transceiverMap.set(n,r)}catch(e){n(e)}})}updateBandwidthRestriction(e,t){if(this.mode===kn)throw xn.error("Viewer attempting to update bitrate, this is not allowed"),new Error("It is not possible for a viewer to update the bitrate.");return xn.info("Updating bandwidth restriction, bitrate value: ",t),xn.debug("SDP value: ",e),vn.setVideoBitrate(e,t)}async updateBitrate(e=0){if(this.mode===kn)throw xn.error("Viewer attempting to update bitrate, this is not allowed"),new Error("It is not possible for a viewer to update the bitrate.");if(!this.peer)throw xn.error("Cannot update bitrate. No peer found."),new Error("Cannot update bitrate. No peer found.");xn.info("Updating bitrate to value: ",e),this.sessionDescription=await this.peer.createOffer(),await this.peer.setLocalDescription(this.sessionDescription);const t=this.updateBandwidthRestriction(this.peer.remoteDescription.sdp,e);await this.setRTCRemoteSDP(t),xn.info("Bitrate restrictions updated: ","".concat(e>0?e:"unlimited"," kbps"))}getRTCPeerStatus(){if(xn.info("Getting RTC peer status"),!this.peer)return null;const e=Fn(this.peer);return xn.info("RTC peer status getted, value: ",e),e}replaceTrack(e){if(!this.peer)return void xn.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):xn.error("There is no ".concat(e.kind," track in active broadcast."))}static getCapabilities(e){const t=new Yt,r=RTCRtpSender.getCapabilities(e);if(r){const n={};let s=new RegExp("^video/(".concat(Object.values(Sn).join("|"),")x?$"),"i");"audio"===e&&(s=new RegExp("^audio/(".concat(Object.values(Rn).join("|"),")$"),"i"),t.isChrome()&&(n.multiopus={mimeType:"audio/multiopus",channels:6}));for(const e of r.codecs){const t=e.mimeType.match(s);if(t){const r=t[1].toLowerCase();if(n[r]=V(N({},n[r]),{mimeType:e.mimeType}),e.scalabilityModes){let t=n[r].scalabilityModes||[];t=[...t,...e.scalabilityModes],n[r].scalabilityModes=[...new Set(t)]}e.channels&&(n[r].channels=e.channels)}}r.codecs=Object.keys(n).map(e=>N({codec:e},n[e]))}return r}getTracks(){var e,t;return null==(t=null==(e=this.peer)?void 0:e.getSenders())?void 0:t.map(e=>e.track)}initStats(e){this.peerConnectionStats?xn.warn("PeerConnection.initStats() has already been called. Automatic initialization occurs via View.connect(), Publish.connect() or this.createRTCPeer(). See options"):this.peer?(this.peerConnectionStats=new Ji(this.peer,e),$e(this.peerConnectionStats,this,[Qe])):xn.warn("Cannot init peer stats: RTCPeerConnection not initialized")}stopStats(){var e;null==(e=this.peerConnectionStats)||e.stop(),this.peerConnectionStats=null}}const En=e=>(null==e?void 0:e.getAudioTracks().length)<=1&&(null==e?void 0:e.getVideoTracks().length)<=1,Ln=e=>{if(!e)return null;if(e instanceof MediaStream&&En(e))return e;if(!(e instanceof MediaStream)){xn.info("Creating MediaStream to add received tracks.");const t=new MediaStream;for(const r of e)t.addTrack(r);if(En(t))return t}throw xn.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.")},An=(e,t)=>{const r=new RTCPeerConnection(t);return Pn(e,r),r};async function Mn(e){return new Promise(t=>setTimeout(t,e))}const Pn=(e,t)=>{t.ontrack=async t=>{xn.info("New track from peer."),xn.debug("Track event value: ",t);const r=e.transceiverMap.get(t.transceiver);if(r){for(;!t.transceiver.mid;)await Mn(100);r(t.transceiver),e.transceiverMap.delete(t.transceiver)}setTimeout(()=>{e.emit(Cn.track,t)},0)},t.connectionState?t.onconnectionstatechange=r=>{xn.info("Peer connection state change: ",t.connectionState),e.emit(Cn.connectionStateChange,t.connectionState)}:t.oniceconnectionstatechange=r=>{xn.info("Peer ICE connection state change: ",t.iceConnectionState),e.emit(Cn.connectionStateChange,t.iceConnectionState)},t.onnegotiationneeded=async e=>{if(!t.remoteDescription)return;xn.info("Peer onnegotiationneeded, updating local description");const r=await t.createOffer();xn.info("Peer onnegotiationneeded, got local offer",r.sdp),r.sdp=vn.updateMissingVideoExtensions(r.sdp,t.remoteDescription.sdp),await t.setLocalDescription(r);const n=vn.renegotiate(r.sdp,t.remoteDescription.sdp);xn.info("Peer onnegotiationneeded, updating remote description",n),await t.setRemoteDescription({type:"answer",sdp:n}),xn.info("Peer onnegotiationneeded, renegotiation done")}},On=(e,t,r)=>{xn.info("Adding mediaStream tracks to RTCPeerConnection");for(const n of t.getTracks()){const s={streams:[t]};"audio"===n.kind&&(s.direction=r.disableAudio?"inactive":"sendonly"),"video"===n.kind&&(s.direction=r.disableVideo?"inactive":"sendonly",r.scalabilityMode&&(new Yt).isChrome()?(xn.debug("Video track with scalability mode: ".concat(r.scalabilityMode,".")),s.sendEncodings=[{scalabilityMode:r.scalabilityMode}]):r.scalabilityMode&&xn.warn("SVC is only supported in Google Chrome")),e.addTransceiver(n,s),xn.info("Track '".concat(n.label,"' added: "),"id: ".concat(n.id),"kind: ".concat(n.kind))}},Dn=(e,t)=>{const r=new Yt;if(!t.disableVideo){const t=e.addTransceiver("video",{direction:"recvonly"});r.isOpera()&&t.setCodecPreferences(RTCRtpReceiver.getCapabilities("video").codecs.filter(e=>"video/H264"!==e.mimeType||e.sdpFmtpLine.includes("profile-level-id=4")))}t.disableAudio||e.addTransceiver("audio",{direction:"recvonly"});for(let r=0;r<t.multiplexedAudioTracks;r++)e.addTransceiver("audio",{direction:"recvonly"})},Fn=e=>{var t;const r=null!=(t=e.connectionState)?t:e.iceConnectionState;switch(r){case"checking":return"connecting";case"completed":return"connected";default:return r}};var jn={};Object.defineProperty(jn,"__esModule",{value:!0}),jn.TypedEmitter=Ge.EventEmitter;const{TypedEmitter:Zn}=jn;class ia extends Zn{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)}}const Nn=G(class oa extends Zn{constructor(e){super(),this.maxId=0,this.namespaces=new Map,this.transactions=new Map,this.transport=e,this.listener=e=>{let t;try{t=JSON.parse(e.utf8Data||e.data||e)}catch(e){return}switch(t.type){case"cmd":const{transId:e}=t,n={name:t.name,data:t.data,namespace:t.namespace,accept:t=>{this._send({type:"response",transId:e,data:t})},reject:t=>{this._send({type:"error",transId:e,data:t})}};if(n.namespace){const e=this.namespaces.get(n.namespace);e?e.emit("cmd",n):this.emit("cmd",n)}else this.emit("cmd",n);break;case"response":{const e=this.transactions.get(t.transId);if(!e)return;this.transactions.delete(t.transId),e.resolve(t.data);break}case"error":{const e=this.transactions.get(t.transId);if(!e)return;this.transactions.delete(t.transId),e.reject(t.data);break}case"event":const s={name:t.name,data:t.data,namespace:t.namespace};if(s.namespace){var r=this.namespaces.get(s.namespace);r?r.emit("event",s):this.emit("event",s)}else this.emit("event",s)}},this.transport.addListener?this.transport.addListener("message",this.listener):this.transport.addEventListener("message",this.listener)}_send(e){this.transport.send(JSON.stringify(e))}cmd(e,t,r){return new Promise((n,s)=>{if(!e||0===e.length)throw new Error("Bad command name");const i={type:"cmd",transId:this.maxId++,name:e,data:t};r&&(i.namespace=r),this.transactions.set(i.transId,V(N({},i),{resolve:n,reject:s}));try{this._send(i)}catch(e){throw this.transactions.delete(i.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),this._send(n)}namespace(e){let t=this.namespaces.get(e);return t||(t=new ia(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)}}),Vn=_e.get("Signaling"),Un="wsConnectionSuccess",Wn="wsConnectionError",Gn="wsConnectionClose",Bn="broadcastEvent";class mi extends Be{constructor(e={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,this.streamViewId=null}async connect(){var e;return Vn.info("Connecting to Signaling Server"),this.transactionManager&&(null==(e=this.webSocket)?void 0:e.readyState)===WebSocket.OPEN?(Vn.info("Connected to server: ",this.webSocket.url),Vn.debug("WebSocket value: ",{url:this.webSocket.url,protocol:this.webSocket.protocol,readyState:this.webSocket.readyState,binaryType:this.webSocket.binaryType,extensions:this.webSocket.extensions}),this.emit(Un,{ws:this.webSocket,tm:this.transactionManager}),this.webSocket):new Promise((e,t)=>{this.webSocket=new WebSocket(this.wsUrl),this.transactionManager=new Nn(this.webSocket),this.webSocket.onopen=()=>{Vn.info("WebSocket opened"),this.transactionManager.on("event",e=>{this.emit(Bn,e)}),Vn.info("Connected to server: ",this.webSocket.url),Vn.debug("WebSocket value: ",{url:this.webSocket.url,protocol:this.webSocket.protocol,readyState:this.webSocket.readyState,binaryType:this.webSocket.binaryType,extensions:this.webSocket.extensions}),this.emit(Un,{ws:this.webSocket,tm:this.transactionManager}),e(this.webSocket)},this.webSocket.onerror=()=>{Vn.error("WebSocket not connected: ",this.webSocket.url),this.emit(Wn,this.webSocket.url),t(this.webSocket.url)},this.webSocket.onclose=()=>{this.webSocket=null,this.transactionManager=null,Vn.info("Connection closed with Signaling Server."),this.emit(Gn)}})}close(){var e;Vn.info("Closing connection with Signaling Server."),null==(e=this.webSocket)||e.close()}async subscribe(e,t,r=null,n=null){var s,i,o,a;Vn.info("Starting subscription to streamName: ",this.streamName),Vn.debug("Subcription local description: ",e);const c=Xn(t,r,n),l={sdp:e=vn.adaptCodecName(e,"AV1X",Sn.AV1),streamId:this.streamName,pinnedSourceId:c.pinnedSourceId,excludedSourceIds:c.excludedSourceIds,events:["active","inactive","layers","viewercount","vad","updated","migrate","stopped"]};c.vad&&(l.vad=!0),Array.isArray(c.events)&&(l.events=c.events),c.forcePlayoutDelay&&(l.forcePlayoutDelay=c.forcePlayoutDelay),c.layer&&(l.layer=c.layer);try{if(c.disableVideo&&c.disableAudio)throw new Error("Not attempting to connect as video and audio are disabled");await this.connect(),Vn.info("Sending view command");const e=await this.transactionManager.cmd("view",l),t=null==(a=null==(o=null==(i=null==(s=RTCRtpReceiver.getCapabilities)?void 0:s.call(RTCRtpReceiver,"video"))?void 0:i.codecs)?void 0:o.find)?void 0:a.call(o,e=>"video/AV1X"===e.mimeType);return e.sdp=t?vn.adaptCodecName(e.sdp,Sn.AV1,"AV1X"):e.sdp,Vn.info("Command sent, subscriberId: ",e.subscriberId),Vn.debug("Command result: ",e),this.serverId=e.subscriberId,this.clusterId=e.clusterId,this.streamViewId=e.streamViewId,oe(this.streamName),ae(this.serverId),le(e.streamViewId),fe(this.clusterId),e.sdp}catch(e){throw Vn.error("Error sending view command, error: ",e),e}}async publish(e,t,r=null,n=null){var s,i,o,a,c,l,u,d;const h=zn(t,r,n);Vn.info("Starting publishing to streamName: ".concat(this.streamName,", codec: ").concat(h.codec)),Vn.debug("Publishing local description: ",e);const f=null!=(a=null==(o=null==(i=null==(s=tt.getCapabilities)?void 0:s.call(tt,"video"))?void 0:i.codecs)?void 0:o.map(e=>e.codec))?a:[],p=Object.values(Sn);if(-1===p.indexOf(h.codec))throw Vn.error("Invalid codec ".concat(h.codec,". Possible values are: "),p),new Error("Invalid codec ".concat(h.codec,". Possible values are: ").concat(p));if(f.length>0&&-1===f.indexOf(h.codec))throw Vn.error("Unsupported codec ".concat(h.codec,". Possible values are: "),f),new Error("Unsupported codec ".concat(h.codec,". Possible values are: ").concat(f));h.codec===Sn.AV1&&(e=vn.adaptCodecName(e,"AV1X",Sn.AV1));const m={name:this.streamName,sdp:e,codec:h.codec,sourceId:h.sourceId};if(h.priority){if(!(Number.isInteger(h.priority)&&h.priority>=-2147483648&&h.priority<=2147483647))throw new Error("Invalid value for priority option. It should be a decimal integer between the range [-2^31, +2^31 - 1]");m.priority=h.priority}null!==h.record&&(m.record=h.record),Array.isArray(h.events)&&(m.events=h.events);try{if(h.disableVideo&&h.disableAudio)throw new Error("Not attempting to connect as video and audio are disabled");await this.connect(),Vn.info("Sending publish command");const e=await this.transactionManager.cmd("publish",m);if(h.codec===Sn.AV1){const t=null==(d=null==(u=null==(l=null==(c=RTCRtpSender.getCapabilities)?void 0:c.call(RTCRtpSender,"video"))?void 0:l.codecs)?void 0:u.find)?void 0:d.call(u,e=>"video/AV1X"===e.mimeType);e.sdp=t?vn.adaptCodecName(e.sdp,Sn.AV1,"AV1X"):e.sdp}return Vn.info("Command sent, publisherId: ",e.publisherId),Vn.debug("Command result: ",e),this.serverId=e.publisherId,this.clusterId=e.clusterId,oe(this.streamName),ae(this.serverId),ue(e.feedId),fe(this.clusterId),e.sdp}catch(e){throw Vn.error("Error sending publish command, error: ",e),e}}async cmd(e,t){return Vn.info("Sending cmd: ".concat(e)),this.transactionManager.cmd(e,t)}}const Xn=(e,t,r)=>{let n="object"==typeof e?e:{};return 0===Object.keys(n).length&&(n={vad:e,pinnedSourceId:t,excludedSourceIds:r}),n},zn=(e,t,r)=>{let n="object"==typeof e?e:{};if(0===Object.keys(n).length){const s=Sn.H264;n={codec:null!=e?e:s,record:t,sourceId:r}}return n};class mr extends Error{constructor(e,t){super(e),this.name="FetchError",this.status=t}}const Yn=_e.get("Director"),$n="WebRtc";let Kn="";let Hn="https://director.millicast.com";const Jn={setEndpoint:e=>{Hn=e.replace(/\/$/,"")},getEndpoint:()=>Hn,setLiveDomain:e=>{Kn=e.replace(/\/$/,"")},getLiveDomain:()=>Kn,getPublisher:async(e,t=null,r=$n)=>{const n=Qn(e,t,r);Yn.info("Getting publisher connection path for stream name: ",n.streamName);const s={streamName:n.streamName,streamType:n.streamType},i={"Content-Type":"application/json",Authorization:"Bearer ".concat(n.token)},o="".concat(Jn.getEndpoint(),"/api/director/publish");try{const e=await fetch(o,{method:"POST",headers:i,body:JSON.stringify(s)});let t=await e.json();if("fail"===t.status)throw new mr(t.data.message,e.status);return t=es(t),Yn.debug("Getting publisher response: ",t),ie(t.data.streamAccountId),t.data}catch(e){throw Yn.error("Error while getting publisher connection path. ",e),e}},getSubscriber:async(e,t=null,r=null)=>{const n=qn(e,t,r);ie(n.streamAccountId),Yn.info("Getting subscriber connection data for stream name: ".concat(n.streamName," and account id: ").concat(n.streamAccountId));const s={streamAccountId:n.streamAccountId,streamName:n.streamName};let i={"Content-Type":"application/json"};n.subscriberToken&&(i=V(N({},i),{Authorization:"Bearer ".concat(n.subscriberToken)}));const o="".concat(Jn.getEndpoint(),"/api/director/subscribe");try{const e=await fetch(o,{method:"POST",headers:i,body:JSON.stringify(s)});let t=await e.json();if("fail"===t.status)throw new mr(t.data.message,e.status);return t=es(t),Yn.debug("Getting subscriber response: ",t),n.subscriberToken&&(t.data.subscriberToken=n.subscriberToken),t.data}catch(e){throw Yn.error("Error while getting subscriber connection path. ",e),e}}},Qn=(e,t,r)=>{let n="object"==typeof e?e:{};return 0===Object.keys(n).length&&(n={token:e,streamName:t,streamType:r}),n},qn=(e,t,r)=>{let n="object"==typeof e?e:{};return 0===Object.keys(n).length&&(n={streamName:e,streamAccountId:t,subscriberToken:r}),n},es=e=>{if(Jn.getLiveDomain()){const t=/\/\/(.*?)\//,r=e.data.urls.map(e=>{const r=t.exec(e);return e.replace(r[1],Jn.getLiveDomain())});e.data.urls=r}if(e.data.drmObject){const t=e.data.drmObject.playReadyUrl;t&&(e.data.drmObject.playReadyUrl="".concat(Jn.getEndpoint()).concat(t));const r=e.data.drmObject.widevineUrl;r&&(e.data.drmObject.widevineUrl="".concat(Jn.getEndpoint()).concat(r));const n=e.data.drmObject.fairPlayUrl;n&&(e.data.drmObject.fairPlayUrl="".concat(Jn.getEndpoint()).concat(n));const s=e.data.drmObject.fairPlayCertUrl;s&&(e.data.drmObject.fairPlayCertUrl="".concat(Jn.getEndpoint()).concat(s))}return e};function ts(e){this.message=e}ts.prototype=new Error,ts.prototype.name="InvalidCharacterError";var rs=typeof window<"u"&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new ts("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,n,s=0,i=0,o="";n=t.charAt(i++);~n&&(r=s%4?64*r+n:n,s++%4)?o+=String.fromCharCode(255&r>>(-2*s&6)):0)n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(n);return o};function ns(e){this.message=e}function ss(e,t){if("string"!=typeof e)throw new ns("Invalid token specified");var r=!0===(t=t||{}).header?0:1;try{return JSON.parse(function(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(rs(e).replace(/(.)/g,(function(e,t){var r=t.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r})))}(t)}catch(e){return rs(t)}}(e.split(".")[r]))}catch(e){throw new ns("Invalid token specified: "+e.message)}}ns.prototype=new Error,ns.prototype.name="InvalidTokenError";var is={exports:{}};!function(e,t){!function(r){if(null!=t&&"number"!=typeof t.nodeType)e.exports=r();else{var n=r(),s=typeof self<"u"?self:$.global;"function"!=typeof s.btoa&&(s.btoa=n.btoa),"function"!=typeof s.atob&&(s.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,s,i,o,a=String(r),c=0,l="";c<a.length;){if(n=a.charCodeAt(c++),s=a.charCodeAt(c++),i=a.charCodeAt(c++),n>255||s>255||i>255)throw new t("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");l+=e.charAt((o=n<<16|s<<8|i)>>18&63)+e.charAt(o>>12&63)+e.charAt(o>>6&63)+e.charAt(63&o)}switch(a.length%3){case 0:return l;case 1:return l.slice(0,-2)+"==";case 2:return l.slice(0,-1)+"="}},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 s,i,o=0,a=0,c="";i=n.charAt(a++);~i&&(s=o%4?64*s+i:i,o++%4)?c+=String.fromCharCode(255&s>>(-2*o&6)):0)i=e.indexOf(i);return c}}}))}(is,is.exports);var os={exports:{}};let as;!function(e,t){!function(t,r){e.exports=r()}(self,()=>{return e={7629:(e,t,r)=>{const n=r(375),s=r(8571),i=r(9474),o=r(1687),a=r(8652),c=r(8160),l=r(3292),u=r(6354),d=r(8901),h=r(9708),f=r(6914),p=r(2294),m=r(6133),g=r(1152),y=r(8863),v=r(2036),w={Base:class{constructor(e){this.type=e,this.$_root=null,this._definition={},this._reset()}_reset(){this._ids=new p.Ids,this._preferences=null,this._refs=new m.Manager,this._cache=null,this._valids=null,this._invalids=null,this._flags={},this._rules=[],this._singleRules=new Map,this.$_terms={},this.$_temp={ruleset:null,whens:{}}}describe(){return n("function"==typeof h.describe,"Manifest functionality disabled"),h.describe(this)}allow(...e){return c.verifyFlat(e,"allow"),this._values(e,"_valids")}alter(e){n(e&&"object"==typeof e&&!Array.isArray(e),"Invalid targets argument"),n(!this._inRuleset(),"Cannot set alterations inside a ruleset");const t=this.clone();t.$_terms.alterations=t.$_terms.alterations||[];for(const r in e){const s=e[r];n("function"==typeof s,"Alteration adjuster for",r,"must be a function"),t.$_terms.alterations.push({target:r,adjuster:s})}return t.$_temp.ruleset=!1,t}artifact(e){return n(void 0!==e,"Artifact cannot be undefined"),n(!this._cache,"Cannot set an artifact with a rule cache"),this.$_setFlag("artifact",e)}cast(e){return n(!1===e||"string"==typeof e,"Invalid to value"),n(!1===e||this._definition.cast[e],"Type",this.type,"does not support casting to",e),this.$_setFlag("cast",!1===e?void 0:e)}default(e,t){return this._default("default",e,t)}description(e){return n(e&&"string"==typeof e,"Description must be a non-empty string"),this.$_setFlag("description",e)}empty(e){const t=this.clone();return void 0!==e&&(e=t.$_compile(e,{override:!1})),t.$_setFlag("empty",e,{clone:!1})}error(e){return n(e,"Missing error"),n(e instanceof Error||"function"==typeof e,"Must provide a valid Error object or a function"),this.$_setFlag("error",e)}example(e,t={}){return n(void 0!==e,"Missing example"),c.assertOptions(t,["override"]),this._inner("examples",e,{single:!0,override:t.override})}external(e,t){return"object"==typeof e&&(n(!t,"Cannot combine options with description"),t=e.description,e=e.method),n("function"==typeof e,"Method must be a function"),n(void 0===t||t&&"string"==typeof t,"Description must be a non-empty string"),this._inner("externals",{method:e,description:t},{single:!0})}failover(e,t){return this._default("failover",e,t)}forbidden(){return this.presence("forbidden")}id(e){return e?(n("string"==typeof e,"id must be a non-empty string"),n(/^[^\.]+$/.test(e),"id cannot contain period character"),this.$_setFlag("id",e)):this.$_setFlag("id",void 0)}invalid(...e){return this._values(e,"_invalids")}label(e){return n(e&&"string"==typeof e,"Label name must be a non-empty string"),this.$_setFlag("label",e)}meta(e){return n(void 0!==e,"Meta cannot be undefined"),this._inner("metas",e,{single:!0})}note(...e){n(e.length,"Missing notes");for(const t of e)n(t&&"string"==typeof t,"Notes must be non-empty strings");return this._inner("notes",e)}only(e=!0){return n("boolean"==typeof e,"Invalid mode:",e),this.$_setFlag("only",e)}optional(){return this.presence("optional")}prefs(e){n(e,"Missing preferences"),n(void 0===e.context,"Cannot override context"),n(void 0===e.externals,"Cannot override externals"),n(void 0===e.warnings,"Cannot override warnings"),n(void 0===e.debug,"Cannot override debug"),c.checkPreferences(e);const t=this.clone();return t._preferences=c.preferences(t._preferences,e),t}presence(e){return n(["optional","required","forbidden"].includes(e),"Unknown presence mode",e),this.$_setFlag("presence",e)}raw(e=!0){return this.$_setFlag("result",e?"raw":void 0)}result(e){return n(["raw","strip"].includes(e),"Unknown result mode",e),this.$_setFlag("result",e)}required(){return this.presence("required")}strict(e){const t=this.clone(),r=void 0!==e&&!e;return t._preferences=c.preferences(t._preferences,{convert:r}),t}strip(e=!0){return this.$_setFlag("result",e?"strip":void 0)}tag(...e){n(e.length,"Missing tags");for(const t of e)n(t&&"string"==typeof t,"Tags must be non-empty strings");return this._inner("tags",e)}unit(e){return n(e&&"string"==typeof e,"Unit name must be a non-empty string"),this.$_setFlag("unit",e)}valid(...e){c.verifyFlat(e,"valid");const t=this.allow(...e);return t.$_setFlag("only",!!t._valids,{clone:!1}),t}when(e,t){const r=this.clone();r.$_terms.whens||(r.$_terms.whens=[]);const s=l.when(r,e,t);if(!["any","link"].includes(r.type)){const e=s.is?[s]:s.switch;for(const t of e)n(!t.then||"any"===t.then.type||t.then.type===r.type,"Cannot combine",r.type,"with",t.then&&t.then.type),n(!t.otherwise||"any"===t.otherwise.type||t.otherwise.type===r.type,"Cannot combine",r.type,"with",t.otherwise&&t.otherwise.type)}return r.$_terms.whens.push(s),r.$_mutateRebuild()}cache(e){n(!this._inRuleset(),"Cannot set caching inside a ruleset"),n(!this._cache,"Cannot override schema cache"),n(void 0===this._flags.artifact,"Cannot cache a rule with an artifact");const t=this.clone();return t._cache=e||a.provider.provision(),t.$_temp.ruleset=!1,t}clone(){const e=Object.create(Object.getPrototypeOf(this));return this._assign(e)}concat(e){n(c.isSchema(e),"Invalid schema object"),n("any"===this.type||"any"===e.type||e.type===this.type,"Cannot merge type",this.type,"with another type:",e.type),n(!this._inRuleset(),"Cannot concatenate onto a schema with open ruleset"),n(!e._inRuleset(),"Cannot concatenate a schema with open ruleset");let t=this.clone();if("any"===this.type&&"any"!==e.type){const r=e.clone();for(const e of Object.keys(t))"type"!==e&&(r[e]=t[e]);t=r}t._ids.concat(e._ids),t._refs.register(e,m.toSibling),t._preferences=t._preferences?c.preferences(t._preferences,e._preferences):e._preferences,t._valids=v.merge(t._valids,e._valids,e._invalids),t._invalids=v.merge(t._invalids,e._invalids,e._valids);for(const r of e._singleRules.keys())t._singleRules.has(r)&&(t._rules=t._rules.filter(e=>e.keep||e.name!==r),t._singleRules.delete(r));for(const r of e._rules)e._definition.rules[r.method].multi||t._singleRules.set(r.name,r),t._rules.push(r);if(t._flags.empty&&e._flags.empty){t._flags.empty=t._flags.empty.concat(e._flags.empty);const r=Object.assign({},e._flags);delete r.empty,o(t._flags,r)}else if(e._flags.empty){t._flags.empty=e._flags.empty;const r=Object.assign({},e._flags);delete r.empty,o(t._flags,r)}else o(t._flags,e._flags);for(const r in e.$_terms){const n=e.$_terms[r];n?t.$_terms[r]?t.$_terms[r]=t.$_terms[r].concat(n):t.$_terms[r]=n.slice():t.$_terms[r]||(t.$_terms[r]=n)}return this.$_root._tracer&&this.$_root._tracer._combine(t,[this,e]),t.$_mutateRebuild()}extend(e){return n(!e.base,"Cannot extend type with another base"),d.type(this,e)}extract(e){return e=Array.isArray(e)?e:e.split("."),this._ids.reach(e)}fork(e,t){n(!this._inRuleset(),"Cannot fork inside a ruleset");let r=this;for(let n of[].concat(e))n=Array.isArray(n)?n:n.split("."),r=r._ids.fork(n,t,r);return r.$_temp.ruleset=!1,r}rule(e){const t=this._definition;c.assertOptions(e,Object.keys(t.modifiers)),n(!1!==this.$_temp.ruleset,"Cannot apply rules to empty ruleset or the last rule added does not support rule properties");const r=null===this.$_temp.ruleset?this._rules.length-1:this.$_temp.ruleset;n(r>=0&&r<this._rules.length,"Cannot apply rules to empty ruleset");const i=this.clone();for(let o=r;o<i._rules.length;++o){const r=i._rules[o],a=s(r);for(const s in e)t.modifiers[s](a,e[s]),n(a.name===r.name,"Cannot change rule name");i._rules[o]=a,i._singleRules.get(a.name)===r&&i._singleRules.set(a.name,a)}return i.$_temp.ruleset=!1,i.$_mutateRebuild()}get ruleset(){n(!this._inRuleset(),"Cannot start a new ruleset without closing the previous one");const e=this.clone();return e.$_temp.ruleset=e._rules.length,e}get $(){return this.ruleset}tailor(e){e=[].concat(e),n(!this._inRuleset(),"Cannot tailor inside a ruleset");let t=this;if(this.$_terms.alterations)for(const{target:r,adjuster:s}of this.$_terms.alterations)e.includes(r)&&(t=s(t),n(c.isSchema(t),"Alteration adjuster for",r,"failed to return a schema object"));return t=t.$_modify({each:t=>t.tailor(e),ref:!1}),t.$_temp.ruleset=!1,t.$_mutateRebuild()}tracer(){return g.location?g.location(this):this}validate(e,t){return y.entry(e,this,t)}validateAsync(e,t){return y.entryAsync(e,this,t)}$_addRule(e){"string"==typeof e&&(e={name:e}),n(e&&"object"==typeof e,"Invalid options"),n(e.name&&"string"==typeof e.name,"Invalid rule name");for(const t in e)n("_"!==t[0],"Cannot set private rule properties");const t=Object.assign({},e);t._resolve=[],t.method=t.method||t.name;const r=this._definition.rules[t.method],s=t.args;n(r,"Unknown rule",t.method);const i=this.clone();if(s){n(1===Object.keys(s).length||Object.keys(s).length===this._definition.rules[t.name].args.length,"Invalid rule definition for",this.type,t.name);for(const e in s){let o=s[e];if(r.argsByName){const a=r.argsByName.get(e);if(a.ref&&c.isResolvable(o))t._resolve.push(e),i.$_mutateRegister(o);else if(a.normalize&&(o=a.normalize(o),s[e]=o),a.assert){const t=c.validateArg(o,e,a);n(!t,t,"or reference")}}void 0!==o?s[e]=o:delete s[e]}}return r.multi||(i._ruleRemove(t.name,{clone:!1}),i._singleRules.set(t.name,t)),!1===i.$_temp.ruleset&&(i.$_temp.ruleset=null),r.priority?i._rules.unshift(t):i._rules.push(t),i}$_compile(e,t){return l.schema(this.$_root,e,t)}$_createError(e,t,r,n,s,i={}){const o=!1!==i.flags?this._flags:{},a=i.messages?f.merge(this._definition.messages,i.messages):this._definition.messages;return new u.Report(e,t,r,o,a,n,s)}$_getFlag(e){return this._flags[e]}$_getRule(e){return this._singleRules.get(e)}$_mapLabels(e){return e=Array.isArray(e)?e:e.split("."),this._ids.labels(e)}$_match(e,t,r,n){(r=Object.assign({},r)).abortEarly=!0,r._externals=!1,t.snapshot();const s=!y.validate(e,this,t,r,n).errors;return t.restore(),s}$_modify(e){return c.assertOptions(e,["each","once","ref","schema"]),p.schema(this,e)||this}$_mutateRebuild(){return n(!this._inRuleset(),"Cannot add this rule inside a ruleset"),this._refs.reset(),this._ids.reset(),this.$_modify({each:(e,{source:t,name:r,path:n,key:s})=>{const i=this._definition[t][r]&&this._definition[t][r].register;!1!==i&&this.$_mutateRegister(e,{family:i,key:s})}}),this._definition.rebuild&&this._definition.rebuild(this),this.$_temp.ruleset=!1,this}$_mutateRegister(e,{family:t,key:r}={}){this._refs.register(e,t),this._ids.register(e,{key:r})}$_property(e){return this._definition.properties[e]}$_reach(e){return this._ids.reach(e)}$_rootReferences(){return this._refs.roots()}$_setFlag(e,t,r={}){n("_"===e[0]||!this._inRuleset(),"Cannot set flag inside a ruleset");const s=this._definition.flags[e]||{};if(i(t,s.default)&&(t=void 0),i(t,this._flags[e]))return this;const o=!1!==r.clone?this.clone():this;return void 0!==t?(o._flags[e]=t,o.$_mutateRegister(t)):delete o._flags[e],"_"!==e[0]&&(o.$_temp.ruleset=!1),o}$_parent(e,...t){return this[e][c.symbols.parent].call(this,...t)}$_validate(e,t,r){return y.validate(e,this,t,r)}_assign(e){e.type=this.type,e.$_root=this.$_root,e.$_temp=Object.assign({},this.$_temp),e.$_temp.whens={},e._ids=this._ids.clone(),e._preferences=this._preferences,e._valids=this._valids&&this._valids.clone(),e._invalids=this._invalids&&this._invalids.clone(),e._rules=this._rules.slice(),e._singleRules=s(this._singleRules,{shallow:!0}),e._refs=this._refs.clone(),e._flags=Object.assign({},this._flags),e._cache=null,e.$_terms={};for(const t in this.$_terms)e.$_terms[t]=this.$_terms[t]?this.$_terms[t].slice():null;e.$_super={};for(const t in this.$_super)e.$_super[t]=this._super[t].bind(e);return e}_bare(){const e=this.clone();e._reset();const t=e._definition.terms;for(const r in t){const n=t[r];e.$_terms[r]=n.init}return e.$_mutateRebuild()}_default(e,t,r={}){return c.assertOptions(r,"literal"),n(void 0!==t,"Missing",e,"value"),n("function"==typeof t||!r.literal,"Only function value supports literal option"),"function"==typeof t&&r.literal&&(t={[c.symbols.literal]:!0,literal:t}),this.$_setFlag(e,t)}_generate(e,t,r){if(!this.$_terms.whens)return{schema:this};const n=[],s=[];for(let i=0;i<this.$_terms.whens.length;++i){const o=this.$_terms.whens[i];if(o.concat){n.push(o.concat),s.push("".concat(i,".concat"));continue}const a=o.ref?o.ref.resolve(e,t,r):e,c=o.is?[o]:o.switch,l=s.length;for(let l=0;l<c.length;++l){const{is:u,then:d,otherwise:h}=c[l],f="".concat(i).concat(o.switch?"."+l:"");if(u.$_match(a,t.nest(u,"".concat(f,".is")),r)){if(d){const i=t.localize([...t.path,"".concat(f,".then")],t.ancestors,t.schemas),{schema:o,id:a}=d._generate(e,i,r);n.push(o),s.push("".concat(f,".then").concat(a?"(".concat(a,")"):""));break}}else if(h){const i=t.localize([...t.path,"".concat(f,".otherwise")],t.ancestors,t.schemas),{schema:o,id:a}=h._generate(e,i,r);n.push(o),s.push("".concat(f,".otherwise").concat(a?"(".concat(a,")"):""));break}}if(o.break&&s.length>l)break}const i=s.join(", ");if(t.mainstay.tracer.debug(t,"rule","when",i),!i)return{schema:this};if(!t.mainstay.tracer.active&&this.$_temp.whens[i])return{schema:this.$_temp.whens[i],id:i};let o=this;this._definition.generate&&(o=this._definition.generate(this,e,t,r));for(const e of n)o=o.concat(e);return this.$_root._tracer&&this.$_root._tracer._combine(o,[this,...n]),this.$_temp.whens[i]=o,{schema:o,id:i}}_inner(e,t,r={}){n(!this._inRuleset(),"Cannot set ".concat(e," inside a ruleset"));const s=this.clone();return s.$_terms[e]&&!r.override||(s.$_terms[e]=[]),r.single?s.$_terms[e].push(t):s.$_terms[e].push(...t),s.$_temp.ruleset=!1,s}_inRuleset(){return null!==this.$_temp.ruleset&&!1!==this.$_temp.ruleset}_ruleRemove(e,t={}){if(!this._singleRules.has(e))return this;const r=!1!==t.clone?this.clone():this;r._singleRules.delete(e);const n=[];for(let t=0;t<r._rules.length;++t){const s=r._rules[t];s.name!==e||s.keep?n.push(s):r._inRuleset()&&t<r.$_temp.ruleset&&--r.$_temp.ruleset}return r._rules=n,r}_values(e,t){c.verifyFlat(e,t.slice(1,-1));const r=this.clone(),s=e[0]===c.symbols.override;if(s&&(e=e.slice(1)),!r[t]&&e.length?r[t]=new v:s&&(r[t]=e.length?new v:null,r.$_mutateRebuild()),!r[t])return r;s&&r[t].override();for(const s of e){n(void 0!==s,"Cannot call allow/valid/invalid with undefined"),n(s!==c.symbols.override,"Override must be the first value");const e="_invalids"===t?"_valids":"_invalids";r[e]&&(r[e].remove(s),r[e].length||(n("_valids"===t||!r._flags.only,"Setting invalid value",s,"leaves schema rejecting all values due to previous valid rule"),r[e]=null)),r[t].add(s,r._refs)}return r}}};w.Base.prototype[c.symbols.any]={version:c.version,compile:l.compile,root:"$_root"},w.Base.prototype.isImmutable=!0,w.Base.prototype.deny=w.Base.prototype.invalid,w.Base.prototype.disallow=w.Base.prototype.invalid,w.Base.prototype.equal=w.Base.prototype.valid,w.Base.prototype.exist=w.Base.prototype.required,w.Base.prototype.not=w.Base.prototype.invalid,w.Base.prototype.options=w.Base.prototype.prefs,w.Base.prototype.preferences=w.Base.prototype.prefs,e.exports=new w.Base},8652:(e,t,r)=>{const n=r(375),s=r(8571),i=r(8160),o={max:1e3,supported:new Set(["undefined","boolean","number","string"])};t.provider={provision:e=>new o.Cache(e)},o.Cache=class{constructor(e={}){i.assertOptions(e,["max"]),n(void 0===e.max||e.max&&e.max>0&&isFinite(e.max),"Invalid max cache size"),this._max=e.max||o.max,this._map=new Map,this._list=new o.List}get length(){return this._map.size}set(e,t){if(null!==e&&!o.supported.has(typeof e))return;let r=this._map.get(e);if(r)return r.value=t,void this._list.first(r);r=this._list.unshift({key:e,value:t}),this._map.set(e,r),this._compact()}get(e){const t=this._map.get(e);if(t)return this._list.first(t),s(t.value)}_compact(){if(this._map.size>this._max){const e=this._list.pop();this._map.delete(e.key)}}},o.List=class{constructor(){this.tail=null,this.head=null}unshift(e){return e.next=null,e.prev=this.head,this.head&&(this.head.next=e),this.head=e,this.tail||(this.tail=e),e}first(e){e!==this.head&&(this._remove(e),this.unshift(e))}pop(){return this._remove(this.tail)}_remove(e){const{next:t,prev:r}=e;return t.prev=r,r&&(r.next=t),e===this.tail&&(this.tail=t),e.prev=null,e.next=null,e}}},8160:(e,t,r)=>{const n=r(375),s=r(7916),i=r(5934);let o,a;const c={isoDate:/^(?:[-+]\d{2})?(?:\d{4}(?!\d{2}\b))(?:(-?)(?:(?:0[1-9]|1[0-2])(?:\1(?:[12]\d|0[1-9]|3[01]))?|W(?:[0-4]\d|5[0-2])(?:-?[1-7])?|(?:00[1-9]|0[1-9]\d|[12]\d{2}|3(?:[0-5]\d|6[1-6])))(?![T]$|[T][\d]+Z$)(?:[T\s](?:(?:(?:[01]\d|2[0-3])(?:(:?)[0-5]\d)?|24\:?00)(?:[.,]\d+(?!:))?)(?:\2[0-5]\d(?:[.,]\d+)?)?(?:[Z]|(?:[+-])(?:[01]\d|2[0-3])(?::?[0-5]\d)?)?)?)?$/};t.version=i.version,t.defaults={abortEarly:!0,allowUnknown:!1,artifacts:!1,cache:!0,context:null,convert:!0,dateFormat:"iso",errors:{escapeHtml:!1,label:"path",language:null,render:!0,stack:!1,wrap:{label:'"',array:"[]"}},externals:!0,messages:{},nonEnumerables:!1,noDefaults:!1,presence:"optional",skipFunctions:!1,stripUnknown:!1,warnings:!1},t.symbols={any:Symbol.for("@hapi/joi/schema"),arraySingle:Symbol("arraySingle"),deepDefault:Symbol("deepDefault"),errors:Symbol("errors"),literal:Symbol("literal"),override:Symbol("override"),parent:Symbol("parent"),prefs:Symbol("prefs"),ref:Symbol("ref"),template:Symbol("template"),values:Symbol("values")},t.assertOptions=function(e,t,r="Options"){n(e&&"object"==typeof e&&!Array.isArray(e),"Options must be of type object");const s=Object.keys(e).filter(e=>!t.includes(e));n(0===s.length,"".concat(r," contain unknown keys: ").concat(s))},t.checkPreferences=function(e){a=a||r(3378);const t=a.preferences.validate(e);if(t.error)throw new s([t.error.details[0].message])},t.compare=function(e,t,r){switch(r){case"=":return e===t;case">":return e>t;case"<":return e<t;case">=":return e>=t;case"<=":return e<=t}},t.default=function(e,t){return void 0===e?t:e},t.isIsoDate=function(e){return c.isoDate.test(e)},t.isNumber=function(e){return"number"==typeof e&&!isNaN(e)},t.isResolvable=function(e){return!!e&&(e[t.symbols.ref]||e[t.symbols.template])},t.isSchema=function(e,r={}){const s=e&&e[t.symbols.any];return!!s&&(n(r.legacy||s.version===t.version,"Cannot mix different versions of joi schemas"),!0)},t.isValues=function(e){return e[t.symbols.values]},t.limit=function(e){return Number.isSafeInteger(e)&&e>=0},t.preferences=function(e,n){o=o||r(6914),e=e||{},n=n||{};const s=Object.assign({},e,n);return n.errors&&e.errors&&(s.errors=Object.assign({},e.errors,n.errors),s.errors.wrap=Object.assign({},e.errors.wrap,n.errors.wrap)),n.messages&&(s.messages=o.compile(n.messages,e.messages)),delete s[t.symbols.prefs],s},t.tryWithPath=function(e,t,r={}){try{return e()}catch(e){throw void 0!==e.path?e.path=t+"."+e.path:e.path=t,r.append&&(e.message="".concat(e.message," (").concat(e.path,")")),e}},t.validateArg=function(e,r,{assert:n,message:s}){if(t.isSchema(n)){const t=n.validate(e);return t.error?t.error.message:void 0}if(!n(e))return r?"".concat(r," ").concat(s):s},t.verifyFlat=function(e,t){for(const r of e)n(!Array.isArray(r),"Method no longer accepts array arguments:",t)}},3292:(e,t,r)=>{const n=r(375),s=r(8160),i=r(6133),o={};t.schema=function(e,t,r={}){s.assertOptions(r,["appendPath","override"]);try{return o.schema(e,t,r)}catch(e){throw r.appendPath&&void 0!==e.path&&(e.message="".concat(e.message," (").concat(e.path,")")),e}},o.schema=function(e,t,r){n(void 0!==t,"Invalid undefined schema"),Array.isArray(t)&&(n(t.length,"Invalid empty array schema"),1===t.length&&(t=t[0]));const i=(t,...n)=>!1!==r.override?t.valid(e.override,...n):t.valid(...n);if(o.simple(t))return i(e,t);if("function"==typeof t)return e.custom(t);if(n("object"==typeof t,"Invalid schema content:",typeof t),s.isResolvable(t))return i(e,t);if(s.isSchema(t))return t;if(Array.isArray(t)){for(const r of t)if(!o.simple(r))return e.alternatives().try(...t);return i(e,...t)}return t instanceof RegExp?e.string().regex(t):t instanceof Date?i(e.date(),t):(n(Object.getPrototypeOf(t)===Object.getPrototypeOf({}),"Schema can only contain plain objects"),e.object().keys(t))},t.ref=function(e,t){return i.isRef(e)?e:i.create(e,t)},t.compile=function(e,r,i={}){s.assertOptions(i,["legacy"]);const a=r&&r[s.symbols.any];if(a)return n(i.legacy||a.version===s.version,"Cannot mix different versions of joi schemas:",a.version,s.version),r;if("object"!=typeof r||!i.legacy)return t.schema(e,r,{appendPath:!0});const c=o.walk(r);return c?c.compile(c.root,r):t.schema(e,r,{appendPath:!0})},o.walk=function(e){if("object"!=typeof e)return null;if(Array.isArray(e)){for(const t of e){const e=o.walk(t);if(e)return e}return null}const t=e[s.symbols.any];if(t)return{root:e[t.root],compile:t.compile};n(Object.getPrototypeOf(e)===Object.getPrototypeOf({}),"Schema can only contain plain objects");for(const t in e){const r=o.walk(e[t]);if(r)return r}return null},o.simple=function(e){return null===e||["boolean","string","number"].includes(typeof e)},t.when=function(e,r,a){if(void 0===a&&(n(r&&"object"==typeof r,"Missing options"),a=r,r=i.create(".")),Array.isArray(a)&&(a={switch:a}),s.assertOptions(a,["is","not","then","otherwise","switch","break"]),s.isSchema(r))return n(void 0===a.is,'"is" can not be used with a schema condition'),n(void 0===a.not,'"not" can not be used with a schema condition'),n(void 0===a.switch,'"switch" can not be used with a schema condition'),o.condition(e,{is:r,then:a.then,otherwise:a.otherwise,break:a.break});if(n(i.isRef(r)||"string"==typeof r,"Invalid condition:",r),n(void 0===a.not||void 0===a.is,'Cannot combine "is" with "not"'),void 0===a.switch){let c=a;void 0!==a.not&&(c={is:a.not,then:a.otherwise,otherwise:a.then,break:a.break});let l=void 0!==c.is?e.$_compile(c.is):e.$_root.invalid(null,!1,0,"").required();return n(void 0!==c.then||void 0!==c.otherwise,'options must have at least one of "then", "otherwise", or "switch"'),n(void 0===c.break||void 0===c.then||void 0===c.otherwise,"Cannot specify then, otherwise, and break all together"),void 0===a.is||i.isRef(a.is)||s.isSchema(a.is)||(l=l.required()),o.condition(e,{ref:t.ref(r),is:l,then:c.then,otherwise:c.otherwise,break:c.break})}n(Array.isArray(a.switch),'"switch" must be an array'),n(void 0===a.is,'Cannot combine "switch" with "is"'),n(void 0===a.not,'Cannot combine "switch" with "not"'),n(void 0===a.then,'Cannot combine "switch" with "then"');const c={ref:t.ref(r),switch:[],break:a.break};for(let t=0;t<a.switch.length;++t){const r=a.switch[t],o=t===a.switch.length-1;s.assertOptions(r,o?["is","then","otherwise"]:["is","then"]),n(void 0!==r.is,'Switch statement missing "is"'),n(void 0!==r.then,'Switch statement missing "then"');const l={is:e.$_compile(r.is),then:e.$_compile(r.then)};if(i.isRef(r.is)||s.isSchema(r.is)||(l.is=l.is.required()),o){n(void 0===a.otherwise||void 0===r.otherwise,'Cannot specify "otherwise" inside and outside a "switch"');const t=void 0!==a.otherwise?a.otherwise:r.otherwise;void 0!==t&&(n(void 0===c.break,"Cannot specify both otherwise and break"),l.otherwise=e.$_compile(t))}c.switch.push(l)}return c},o.condition=function(e,t){for(const r of["then","otherwise"])void 0===t[r]?delete t[r]:t[r]=e.$_compile(t[r]);return t}},6354:(e,t,r)=>{const n=r(5688),s=r(8160),i=r(3328);t.Report=class{constructor(e,r,n,s,i,o,a){if(this.code=e,this.flags=s,this.messages=i,this.path=o.path,this.prefs=a,this.state=o,this.value=r,this.message=null,this.template=null,this.local=n||{},this.local.label=t.label(this.flags,this.state,this.prefs,this.messages),void 0===this.value||this.local.hasOwnProperty("value")||(this.local.value=this.value),this.path.length){const e=this.path[this.path.length-1];"object"!=typeof e&&(this.local.key=e)}}_setTemplate(e){if(this.template=e,!this.flags.label&&0===this.path.length){const e=this._template(this.template,"root");e&&(this.local.label=e)}}toString(){if(this.message)return this.message;const e=this.code;if(!this.prefs.errors.render)return this.code;const t=this._template(this.template)||this._template(this.prefs.messages)||this._template(this.messages);return void 0===t?'Error code "'.concat(e,'" is not defined, your custom type is missing the correct messages definition'):(this.message=t.render(this.value,this.state,this.prefs,this.local,{errors:this.prefs.errors,messages:[this.prefs.messages,this.messages]}),this.prefs.errors.label||(this.message=this.message.replace(/^"" /,"").trim()),this.message)}_template(e,r){return t.template(this.value,e,r||this.code,this.state,this.prefs)}},t.path=function(e){let t="";for(const r of e)"object"!=typeof r&&("string"==typeof r?(t&&(t+="."),t+=r):t+="[".concat(r,"]"));return t},t.template=function(e,t,r,n,o){if(!t)return;if(i.isTemplate(t))return"root"!==r?t:null;let a=o.errors.language;if(s.isResolvable(a)&&(a=a.resolve(e,n,o)),a&&t[a]){if(void 0!==t[a][r])return t[a][r];if(void 0!==t[a]["*"])return t[a]["*"]}return t[r]?t[r]:t["*"]},t.label=function(e,r,n,s){if(!n.errors.label)return"";if(e.label)return e.label;let i=r.path;return"key"===n.errors.label&&r.path.length>1&&(i=r.path.slice(-1)),t.path(i)||t.template(null,n.messages,"root",r,n)||s&&t.template(null,s,"root",r,n)||"value"},t.process=function(e,r,n){if(!e)return null;const{override:s,message:i,details:o}=t.details(e);if(s)return s;if(n.errors.stack)return new t.ValidationError(i,o,r);const a=Error.stackTraceLimit;Error.stackTraceLimit=0;const c=new t.ValidationError(i,o,r);return Error.stackTraceLimit=a,c},t.details=function(e,t={}){let r=[];const n=[];for(const s of e){if(s instanceof Error){if(!1!==t.override)return{override:s};const e=s.toString();r.push(e),n.push({message:e,type:"override",context:{error:s}});continue}const e=s.toString();r.push(e),n.push({message:e,path:s.path.filter(e=>"object"!=typeof e),type:s.code,context:s.local})}return r.length>1&&(r=[...new Set(r)]),{message:r.join(". "),details:n}},t.ValidationError=class extends Error{constructor(e,t,r){super(e),this._original=r,this.details=t}static isError(e){return e instanceof t.ValidationError}},t.ValidationError.prototype.isJoi=!0,t.ValidationError.prototype.name="ValidationError",t.ValidationError.prototype.annotate=n.error},8901:(e,t,r)=>{const n=r(375),s=r(8571),i=r(8160),o=r(6914),a={};t.type=function(e,t){const r=Object.getPrototypeOf(e),c=s(r),l=e._assign(Object.create(c)),u=Object.assign({},t);delete u.base,c._definition=u;const d=r._definition||{};u.messages=o.merge(d.messages,u.messages),u.properties=Object.assign({},d.properties,u.properties),l.type=u.type,u.flags=Object.assign({},d.flags,u.flags);const h=Object.assign({},d.terms);if(u.terms)for(const e in u.terms){const t=u.terms[e];n(void 0===l.$_terms[e],"Invalid term override for",u.type,e),l.$_terms[e]=t.init,h[e]=t}u.terms=h,u.args||(u.args=d.args),u.prepare=a.prepare(u.prepare,d.prepare),u.coerce&&("function"==typeof u.coerce&&(u.coerce={method:u.coerce}),u.coerce.from&&!Array.isArray(u.coerce.from)&&(u.coerce={method:u.coerce.method,from:[].concat(u.coerce.from)})),u.coerce=a.coerce(u.coerce,d.coerce),u.validate=a.validate(u.validate,d.validate);const f=Object.assign({},d.rules);if(u.rules)for(const e in u.rules){const t=u.rules[e];n("object"==typeof t,"Invalid rule definition for",u.type,e);let r=t.method;if(void 0===r&&(r=function(){return this.$_addRule(e)}),r&&(n(!c[e],"Rule conflict in",u.type,e),c[e]=r),n(!f[e],"Rule conflict in",u.type,e),f[e]=t,t.alias){const e=[].concat(t.alias);for(const r of e)c[r]=t.method}t.args&&(t.argsByName=new Map,t.args=t.args.map(e=>("string"==typeof e&&(e={name:e}),n(!t.argsByName.has(e.name),"Duplicated argument name",e.name),i.isSchema(e.assert)&&(e.assert=e.assert.strict().label(e.name)),t.argsByName.set(e.name,e),e)))}u.rules=f;const p=Object.assign({},d.modifiers);if(u.modifiers)for(const e in u.modifiers){n(!c[e],"Rule conflict in",u.type,e);const t=u.modifiers[e];n("function"==typeof t,"Invalid modifier definition for",u.type,e);const r=function(t){return this.rule({[e]:t})};c[e]=r,p[e]=t}if(u.modifiers=p,u.overrides){c._super=r,l.$_super={};for(const e in u.overrides)n(r[e],"Cannot override missing",e),u.overrides[e][i.symbols.parent]=r[e],l.$_super[e]=r[e].bind(l);Object.assign(c,u.overrides)}u.cast=Object.assign({},d.cast,u.cast);const m=Object.assign({},d.manifest,u.manifest);return m.build=a.build(u.manifest&&u.manifest.build,d.manifest&&d.manifest.build),u.manifest=m,u.rebuild=a.rebuild(u.rebuild,d.rebuild),l},a.build=function(e,t){return e&&t?function(r,n){return t(e(r,n),n)}:e||t},a.coerce=function(e,t){return e&&t?{from:e.from&&t.from?[...new Set([...e.from,...t.from])]:null,method(r,n){let s;if((!t.from||t.from.includes(typeof r))&&(s=t.method(r,n),s)){if(s.errors||void 0===s.value)return s;r=s.value}if(!e.from||e.from.includes(typeof r)){const t=e.method(r,n);if(t)return t}return s}}:e||t},a.prepare=function(e,t){return e&&t?function(r,n){const s=e(r,n);if(s){if(s.errors||void 0===s.value)return s;r=s.value}return t(r,n)||s}:e||t},a.rebuild=function(e,t){return e&&t?function(r){t(r),e(r)}:e||t},a.validate=function(e,t){return e&&t?function(r,n){const s=t(r,n);if(s){if(s.errors&&(!Array.isArray(s.errors)||s.errors.length))return s;r=s.value}return e(r,n)||s}:e||t}},5107:(e,t,r)=>{const n=r(375),s=r(8571),i=r(8652),o=r(8160),a=r(3292),c=r(6354),l=r(8901),u=r(9708),d=r(6133),h=r(3328),f=r(1152);let p;const m={types:{alternatives:r(4946),any:r(8068),array:r(546),boolean:r(4937),date:r(7500),function:r(390),link:r(8785),number:r(3832),object:r(8966),string:r(7417),symbol:r(8826)},aliases:{alt:"alternatives",bool:"boolean",func:"function"},root:function(){const e={_types:new Set(Object.keys(m.types))};for(const t of e._types)e[t]=function(...e){return n(!e.length||["alternatives","link","object"].includes(t),"The",t,"type does not allow arguments"),m.generate(this,m.types[t],e)};for(const t of["allow","custom","disallow","equal","exist","forbidden","invalid","not","only","optional","options","prefs","preferences","required","strip","valid","when"])e[t]=function(...e){return this.any()[t](...e)};Object.assign(e,m.methods);for(const t in m.aliases){const r=m.aliases[t];e[t]=e[r]}return e.x=e.expression,f.setup&&f.setup(e),e}};m.methods={ValidationError:c.ValidationError,version:o.version,cache:i.provider,assert(e,t,...r){m.assert(e,t,!0,r)},attempt:(e,t,...r)=>m.assert(e,t,!1,r),build(e){return n("function"==typeof u.build,"Manifest functionality disabled"),u.build(this,e)},checkPreferences(e){o.checkPreferences(e)},compile(e,t){return a.compile(this,e,t)},defaults(e){n("function"==typeof e,"modifier must be a function");const t=Object.assign({},this);for(const r of t._types){const s=e(t[r]());n(o.isSchema(s),"modifier must return a valid schema object"),t[r]=function(...e){return m.generate(this,s,e)}}return t},expression:(...e)=>new h(...e),extend(...e){o.verifyFlat(e,"extend"),p=p||r(3378),n(e.length,"You need to provide at least one extension"),this.assert(e,p.extensions);const t=Object.assign({},this);t._types=new Set(t._types);for(let r of e){"function"==typeof r&&(r=r(t)),this.assert(r,p.extension);const e=m.expandExtension(r,t);for(const r of e){n(void 0===t[r.type]||t._types.has(r.type),"Cannot override name",r.type);const e=r.base||this.any(),s=l.type(e,r);t._types.add(r.type),t[r.type]=function(...e){return m.generate(this,s,e)}}}return t},isError:c.ValidationError.isError,isExpression:h.isTemplate,isRef:d.isRef,isSchema:o.isSchema,in:(...e)=>d.in(...e),override:o.symbols.override,ref:(...e)=>d.create(...e),types(){const e={};for(const t of this._types)e[t]=this[t]();for(const t in m.aliases)e[t]=this[t]();return e}},m.assert=function(e,t,r,n){const i=n[0]instanceof Error||"string"==typeof n[0]?n[0]:null,a=null!==i?n[1]:n[0],l=t.validate(e,o.preferences({errors:{stack:!0}},a||{}));let u=l.error;if(!u)return l.value;if(i instanceof Error)throw i;const d=r&&"function"==typeof u.annotate?u.annotate():u.message;throw u instanceof c.ValidationError==0&&(u=s(u)),u.message=i?"".concat(i," ").concat(d):d,u},m.generate=function(e,t,r){return n(e,"Must be invoked on a Joi instance."),t.$_root=e,t._definition.args&&r.length?t._definition.args(t,...r):t},m.expandExtension=function(e,t){if("string"==typeof e.type)return[e];const r=[];for(const n of t._types)if(e.type.test(n)){const s=Object.assign({},e);s.type=n,s.base=t[n](),r.push(s)}return r},e.exports=m.root()},6914:(e,t,r)=>{const n=r(375),s=r(8571),i=r(3328);t.compile=function(e,t){if("string"==typeof e)return n(!t,"Cannot set single message string"),new i(e);if(i.isTemplate(e))return n(!t,"Cannot set single message template"),e;n("object"==typeof e&&!Array.isArray(e),"Invalid message options"),t=t?s(t):{};for(let r in e){const s=e[r];if("root"===r||i.isTemplate(s)){t[r]=s;continue}if("string"==typeof s){t[r]=new i(s);continue}n("object"==typeof s&&!Array.isArray(s),"Invalid message for",r);const o=r;for(r in t[o]=t[o]||{},s){const e=s[r];"root"===r||i.isTemplate(e)?t[o][r]=e:(n("string"==typeof e,"Invalid message for",r,"in",o),t[o][r]=new i(e))}}return t},t.decompile=function(e){const t={};for(let r in e){const n=e[r];if("root"===r){t.root=n;continue}if(i.isTemplate(n)){t[r]=n.describe({compact:!0});continue}const s=r;for(r in t[s]={},n){const e=n[r];"root"!==r?t[s][r]=e.describe({compact:!0}):t[s].root=e}}return t},t.merge=function(e,r){if(!e)return t.compile(r);if(!r)return e;if("string"==typeof r)return new i(r);if(i.isTemplate(r))return r;const o=s(e);for(let e in r){const t=r[e];if("root"===e||i.isTemplate(t)){o[e]=t;continue}if("string"==typeof t){o[e]=new i(t);continue}n("object"==typeof t&&!Array.isArray(t),"Invalid message for",e);const s=e;for(e in o[s]=o[s]||{},t){const r=t[e];"root"===e||i.isTemplate(r)?o[s][e]=r:(n("string"==typeof r,"Invalid message for",e,"in",s),o[s][e]=new i(r))}}return o}},2294:(e,t,r)=>{const n=r(375),s=r(8160),i=r(6133),o={};t.Ids=o.Ids=class{constructor(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}clone(){const e=new o.Ids;return e._byId=new Map(this._byId),e._byKey=new Map(this._byKey),e._schemaChain=this._schemaChain,e}concat(e){e._schemaChain&&(this._schemaChain=!0);for(const[t,r]of e._byId.entries())n(!this._byKey.has(t),"Schema id conflicts with existing key:",t),this._byId.set(t,r);for(const[t,r]of e._byKey.entries())n(!this._byId.has(t),"Schema key conflicts with existing id:",t),this._byKey.set(t,r)}fork(e,t,r){const i=this._collect(e);i.push({schema:r});const a=i.shift();let c={id:a.id,schema:t(a.schema)};n(s.isSchema(c.schema),"adjuster function failed to return a joi schema type");for(const e of i)c={id:e.id,schema:o.fork(e.schema,c.id,c.schema)};return c.schema}labels(e,t=[]){const r=e[0],n=this._get(r);if(!n)return[...t,...e].join(".");const s=e.slice(1);return t=[...t,n.schema._flags.label||r],s.length?n.schema._ids.labels(s,t):t.join(".")}reach(e,t=[]){const r=e[0],s=this._get(r);n(s,"Schema does not contain path",[...t,...e].join("."));const i=e.slice(1);return i.length?s.schema._ids.reach(i,[...t,r]):s.schema}register(e,{key:t}={}){if(!e||!s.isSchema(e))return;(e.$_property("schemaChain")||e._ids._schemaChain)&&(this._schemaChain=!0);const r=e._flags.id;if(r){const t=this._byId.get(r);n(!t||t.schema===e,"Cannot add different schemas with the same id:",r),n(!this._byKey.has(r),"Schema id conflicts with existing key:",r),this._byId.set(r,{schema:e,id:r})}t&&(n(!this._byKey.has(t),"Schema already contains key:",t),n(!this._byId.has(t),"Schema key conflicts with existing id:",t),this._byKey.set(t,{schema:e,id:t}))}reset(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}_collect(e,t=[],r=[]){const s=e[0],i=this._get(s);n(i,"Schema does not contain path",[...t,...e].join(".")),r=[i,...r];const o=e.slice(1);return o.length?i.schema._ids._collect(o,[...t,s],r):r}_get(e){return this._byId.get(e)||this._byKey.get(e)}},o.fork=function(e,r,n){const s=t.schema(e,{each:(e,{key:t})=>{if(r===(e._flags.id||t))return n},ref:!1});return s?s.$_mutateRebuild():e},t.schema=function(e,t){let r;for(const n in e._flags){if("_"===n[0])continue;const s=o.scan(e._flags[n],{source:"flags",name:n},t);void 0!==s&&(r=r||e.clone(),r._flags[n]=s)}for(let n=0;n<e._rules.length;++n){const s=e._rules[n],i=o.scan(s.args,{source:"rules",name:s.name},t);if(void 0!==i){r=r||e.clone();const t=Object.assign({},s);t.args=i,r._rules[n]=t,r._singleRules.get(s.name)===s&&r._singleRules.set(s.name,t)}}for(const n in e.$_terms){if("_"===n[0])continue;const s=o.scan(e.$_terms[n],{source:"terms",name:n},t);void 0!==s&&(r=r||e.clone(),r.$_terms[n]=s)}return r},o.scan=function(e,t,r,n,a){const c=n||[];if(null===e||"object"!=typeof e)return;let l;if(Array.isArray(e)){for(let n=0;n<e.length;++n){const s="terms"===t.source&&"keys"===t.name&&e[n].key,i=o.scan(e[n],t,r,[n,...c],s);void 0!==i&&(l=l||e.slice(),l[n]=i)}return l}if(!1!==r.schema&&s.isSchema(e)||!1!==r.ref&&i.isRef(e)){const n=r.each(e,V(N({},t),{path:c,key:a}));return n===e?void 0:n}for(const n in e){if("_"===n[0])continue;const s=o.scan(e[n],t,r,[n,...c],a);void 0!==s&&(l=l||Object.assign({},e),l[n]=s)}return l}},6133:(e,t,r)=>{const n=r(375),s=r(8571),i=r(9621),o=r(8160);let a;const c={symbol:Symbol("ref"),defaults:{adjust:null,in:!1,iterables:null,map:null,separator:".",type:"value"}};t.create=function(e,t={}){n("string"==typeof e,"Invalid reference key:",e),o.assertOptions(t,["adjust","ancestor","in","iterables","map","prefix","render","separator"]),n(!t.prefix||"object"==typeof t.prefix,"options.prefix must be of type object");const r=Object.assign({},c.defaults,t);delete r.prefix;const s=r.separator,i=c.context(e,s,t.prefix);if(r.type=i.type,e=i.key,"value"===r.type)if(i.root&&(n(!s||e[0]!==s,"Cannot specify relative path with root prefix"),r.ancestor="root",e||(e=null)),s&&s===e)e=null,r.ancestor=0;else if(void 0!==r.ancestor)n(!s||!e||e[0]!==s,"Cannot combine prefix with ancestor option");else{const[t,n]=c.ancestor(e,s);n&&""===(e=e.slice(n))&&(e=null),r.ancestor=t}return r.path=s?null===e?[]:e.split(s):[e],new c.Ref(r)},t.in=function(e,r={}){return t.create(e,V(N({},r),{in:!0}))},t.isRef=function(e){return!!e&&!!e[o.symbols.ref]},c.Ref=class{constructor(e){n("object"==typeof e,"Invalid reference construction"),o.assertOptions(e,["adjust","ancestor","in","iterables","map","path","render","separator","type","depth","key","root","display"]),n([!1,void 0].includes(e.separator)||"string"==typeof e.separator&&1===e.separator.length,"Invalid separator"),n(!e.adjust||"function"==typeof e.adjust,"options.adjust must be a function"),n(!e.map||Array.isArray(e.map),"options.map must be an array"),n(!e.map||!e.adjust,"Cannot set both map and adjust options"),Object.assign(this,c.defaults,e),n("value"===this.type||void 0===this.ancestor,"Non-value references cannot reference ancestors"),Array.isArray(this.map)&&(this.map=new Map(this.map)),this.depth=this.path.length,this.key=this.path.length?this.path.join(this.separator):null,this.root=this.path[0],this.updateDisplay()}resolve(e,t,r,s,i={}){return n(!this.in||i.in,"Invalid in() reference usage"),"global"===this.type?this._resolve(r.context,t,i):"local"===this.type?this._resolve(s,t,i):this.ancestor?"root"===this.ancestor?this._resolve(t.ancestors[t.ancestors.length-1],t,i):(n(this.ancestor<=t.ancestors.length,"Invalid reference exceeds the schema root:",this.display),this._resolve(t.ancestors[this.ancestor-1],t,i)):this._resolve(e,t,i)}_resolve(e,t,r){let n;if("value"===this.type&&t.mainstay.shadow&&!1!==r.shadow&&(n=t.mainstay.shadow.get(this.absolute(t))),void 0===n&&(n=i(e,this.path,{iterables:this.iterables,functions:!0})),this.adjust&&(n=this.adjust(n)),this.map){const e=this.map.get(n);void 0!==e&&(n=e)}return t.mainstay&&t.mainstay.tracer.resolve(t,this,n),n}toString(){return this.display}absolute(e){return[...e.path.slice(0,-this.ancestor),...this.path]}clone(){return new c.Ref(this)}describe(){const e={path:this.path};"value"!==this.type&&(e.type=this.type),"."!==this.separator&&(e.separator=this.separator),"value"===this.type&&1!==this.ancestor&&(e.ancestor=this.ancestor),this.map&&(e.map=[...this.map]);for(const t of["adjust","iterables","render"])null!==this[t]&&void 0!==this[t]&&(e[t]=this[t]);return!1!==this.in&&(e.in=!0),{ref:e}}updateDisplay(){const e=null!==this.key?this.key:"";if("value"!==this.type)return void(this.display="ref:".concat(this.type,":").concat(e));if(!this.separator)return void(this.display="ref:".concat(e));if(!this.ancestor)return void(this.display="ref:".concat(this.separator).concat(e));if("root"===this.ancestor)return void(this.display="ref:root:".concat(e));if(1===this.ancestor)return void(this.display="ref:".concat(e||".."));const t=new Array(this.ancestor+1).fill(this.separator).join("");this.display="ref:".concat(t).concat(e||"")}},c.Ref.prototype[o.symbols.ref]=!0,t.build=function(e){return"value"===(e=Object.assign({},c.defaults,e)).type&&void 0===e.ancestor&&(e.ancestor=1),new c.Ref(e)},c.context=function(e,t,r={}){if(e=e.trim(),r){const n=void 0===r.global?"$":r.global;if(n!==t&&e.startsWith(n))return{key:e.slice(n.length),type:"global"};const s=void 0===r.local?"#":r.local;if(s!==t&&e.startsWith(s))return{key:e.slice(s.length),type:"local"};const i=void 0===r.root?"/":r.root;if(i!==t&&e.startsWith(i))return{key:e.slice(i.length),type:"value",root:!0}}return{key:e,type:"value"}},c.ancestor=function(e,t){if(!t)return[1,0];if(e[0]!==t)return[1,0];if(e[1]!==t)return[0,1];let r=2;for(;e[r]===t;)++r;return[r-1,r]},t.toSibling=0,t.toParent=1,t.Manager=class{constructor(){this.refs=[]}register(e,n){if(e)if(n=void 0===n?t.toParent:n,Array.isArray(e))for(const t of e)this.register(t,n);else if(o.isSchema(e))for(const t of e._refs.refs)t.ancestor-n>=0&&this.refs.push({ancestor:t.ancestor-n,root:t.root});else t.isRef(e)&&"value"===e.type&&e.ancestor-n>=0&&this.refs.push({ancestor:e.ancestor-n,root:e.root}),a=a||r(3328),a.isTemplate(e)&&this.register(e.refs(),n)}get length(){return this.refs.length}clone(){const e=new t.Manager;return e.refs=s(this.refs),e}reset(){this.refs=[]}roots(){return this.refs.filter(e=>!e.ancestor).map(e=>e.root)}}},3378:(e,t,r)=>{const n=r(5107),s={};s.wrap=n.string().min(1).max(2).allow(!1),t.preferences=n.object({allowUnknown:n.boolean(),abortEarly:n.boolean(),artifacts:n.boolean(),cache:n.boolean(),context:n.object(),convert:n.boolean(),dateFormat:n.valid("date","iso","string","time","utc"),debug:n.boolean(),errors:{escapeHtml:n.boolean(),label:n.valid("path","key",!1),language:[n.string(),n.object().ref()],render:n.boolean(),stack:n.boolean(),wrap:{label:s.wrap,array:s.wrap,string:s.wrap}},externals:n.boolean(),messages:n.object(),noDefaults:n.boolean(),nonEnumerables:n.boolean(),presence:n.valid("required","optional","forbidden"),skipFunctions:n.boolean(),stripUnknown:n.object({arrays:n.boolean(),objects:n.boolean()}).or("arrays","objects").allow(!0,!1),warnings:n.boolean()}).strict(),s.nameRx=/^[a-zA-Z0-9]\w*$/,s.rule=n.object({alias:n.array().items(n.string().pattern(s.nameRx)).single(),args:n.array().items(n.string(),n.object({name:n.string().pattern(s.nameRx).required(),ref:n.boolean(),assert:n.alternatives([n.function(),n.object().schema()]).conditional("ref",{is:!0,then:n.required()}),normalize:n.function(),message:n.string().when("assert",{is:n.function(),then:n.required()})})),convert:n.boolean(),manifest:n.boolean(),method:n.function().allow(!1),multi:n.boolean(),validate:n.function()}),t.extension=n.object({type:n.alternatives([n.string(),n.object().regex()]).required(),args:n.function(),cast:n.object().pattern(s.nameRx,n.object({from:n.function().maxArity(1).required(),to:n.function().minArity(1).maxArity(2).required()})),base:n.object().schema().when("type",{is:n.object().regex(),then:n.forbidden()}),coerce:[n.function().maxArity(3),n.object({method:n.function().maxArity(3).required(),from:n.array().items(n.string()).single()})],flags:n.object().pattern(s.nameRx,n.object({setter:n.string(),default:n.any()})),manifest:{build:n.function().arity(2)},messages:[n.object(),n.string()],modifiers:n.object().pattern(s.nameRx,n.function().minArity(1).maxArity(2)),overrides:n.object().pattern(s.nameRx,n.function()),prepare:n.function().maxArity(3),rebuild:n.function().arity(1),rules:n.object().pattern(s.nameRx,s.rule),terms:n.object().pattern(s.nameRx,n.object({init:n.array().allow(null).required(),manifest:n.object().pattern(/.+/,[n.valid("schema","single"),n.object({mapped:n.object({from:n.string().required(),to:n.string().required()}).required()})])})),validate:n.function().maxArity(3)}).strict(),t.extensions=n.array().items(n.object(),n.function().arity(1)).strict(),s.desc={buffer:n.object({buffer:n.string()}),func:n.object({function:n.function().required(),options:{literal:!0}}),override:n.object({override:!0}),ref:n.object({ref:n.object({type:n.valid("value","global","local"),path:n.array().required(),separator:n.string().length(1).allow(!1),ancestor:n.number().min(0).integer().allow("root"),map:n.array().items(n.array().length(2)).min(1),adjust:n.function(),iterables:n.boolean(),in:n.boolean(),render:n.boolean()}).required()}),regex:n.object({regex:n.string().min(3)}),special:n.object({special:n.valid("deep").required()}),template:n.object({template:n.string().required(),options:n.object()}),value:n.object({value:n.alternatives([n.object(),n.array()]).required()})},s.desc.entity=n.alternatives([n.array().items(n.link("...")),n.boolean(),n.function(),n.number(),n.string(),s.desc.buffer,s.desc.func,s.desc.ref,s.desc.regex,s.desc.special,s.desc.template,s.desc.value,n.link("/")]),s.desc.values=n.array().items(null,n.boolean(),n.function(),n.number().allow(1/0,-1/0),n.string().allow(""),n.symbol(),s.desc.buffer,s.desc.func,s.desc.override,s.desc.ref,s.desc.regex,s.desc.template,s.desc.value),s.desc.messages=n.object().pattern(/.+/,[n.string(),s.desc.template,n.object().pattern(/.+/,[n.string(),s.desc.template])]),t.description=n.object({type:n.string().required(),flags:n.object({cast:n.string(),default:n.any(),description:n.string(),empty:n.link("/"),failover:s.desc.entity,id:n.string(),label:n.string(),only:!0,presence:["optional","required","forbidden"],result:["raw","strip"],strip:n.boolean(),unit:n.string()}).unknown(),preferences:{allowUnknown:n.boolean(),abortEarly:n.boolean(),artifacts:n.boolean(),cache:n.boolean(),convert:n.boolean(),dateFormat:["date","iso","string","time","utc"],errors:{escapeHtml:n.boolean(),label:["path","key"],language:[n.string(),s.desc.ref],wrap:{label:s.wrap,array:s.wrap}},externals:n.boolean(),messages:s.desc.messages,noDefaults:n.boolean(),nonEnumerables:n.boolean(),presence:["required","optional","forbidden"],skipFunctions:n.boolean(),stripUnknown:n.object({arrays:n.boolean(),objects:n.boolean()}).or("arrays","objects").allow(!0,!1),warnings:n.boolean()},allow:s.desc.values,invalid:s.desc.values,rules:n.array().min(1).items({name:n.string().required(),args:n.object().min(1),keep:n.boolean(),message:[n.string(),s.desc.messages],warn:n.boolean()}),keys:n.object().pattern(/.*/,n.link("/")),link:s.desc.ref}).pattern(/^[a-z]\w*$/,n.any())},493:(e,t,r)=>{const n=r(8571),s=r(9621),i=r(8160),o={value:Symbol("value")};e.exports=o.State=class{constructor(e,t,r){this.path=e,this.ancestors=t,this.mainstay=r.mainstay,this.schemas=r.schemas,this.debug=null}localize(e,t=null,r=null){const n=new o.State(e,t,this);return r&&n.schemas&&(n.schemas=[o.schemas(r),...n.schemas]),n}nest(e,t){const r=new o.State(this.path,this.ancestors,this);return r.schemas=r.schemas&&[o.schemas(e),...r.schemas],r.debug=t,r}shadow(e,t){this.mainstay.shadow=this.mainstay.shadow||new o.Shadow,this.mainstay.shadow.set(this.path,e,t)}snapshot(){this.mainstay.shadow&&(this._snapshot=n(this.mainstay.shadow.node(this.path))),this.mainstay.snapshot()}restore(){this.mainstay.shadow&&(this.mainstay.shadow.override(this.path,this._snapshot),this._snapshot=void 0),this.mainstay.restore()}commit(){this.mainstay.shadow&&(this.mainstay.shadow.override(this.path,this._snapshot),this._snapshot=void 0),this.mainstay.commit()}},o.schemas=function(e){return i.isSchema(e)?{schema:e}:e},o.Shadow=class{constructor(){this._values=null}set(e,t,r){if(!e.length||"strip"===r&&"number"==typeof e[e.length-1])return;this._values=this._values||new Map;let n=this._values;for(let t=0;t<e.length;++t){const r=e[t];let s=n.get(r);s||(s=new Map,n.set(r,s)),n=s}n[o.value]=t}get(e){const t=this.node(e);if(t)return t[o.value]}node(e){if(this._values)return s(this._values,e,{iterables:!0})}override(e,t){if(!this._values)return;const r=e.slice(0,-1),n=e[e.length-1],i=s(this._values,r,{iterables:!0});t?i.set(n,t):i&&i.delete(n)}}},3328:(e,t,r)=>{const n=r(375),s=r(8571),i=r(5277),o=r(1447),a=r(8160),c=r(6354),l=r(6133),u={symbol:Symbol("template"),opens:new Array(1e3).join("\0"),closes:new Array(1e3).join(""),dateFormat:{date:Date.prototype.toDateString,iso:Date.prototype.toISOString,string:Date.prototype.toString,time:Date.prototype.toTimeString,utc:Date.prototype.toUTCString}};e.exports=u.Template=class{constructor(e,t){if(n("string"==typeof e,"Template source must be a string"),n(!e.includes("\0")&&!e.includes(""),"Template source cannot contain reserved control characters"),this.source=e,this.rendered=e,this._template=null,t){const e=t,{functions:r}=e,i=U(e,["functions"]);this._settings=Object.keys(i).length?s(i):void 0,this._functions=r,this._functions&&(n(Object.keys(this._functions).every(e=>"string"==typeof e),"Functions keys must be strings"),n(Object.values(this._functions).every(e=>"function"==typeof e),"Functions values must be functions"))}else this._settings=void 0,this._functions=void 0;this._parse()}_parse(){if(!this.source.includes("{"))return;const e=u.encode(this.source),t=u.split(e);let r=!1;const n=[],s=t.shift();s&&n.push(s);for(const e of t){const t="{"!==e[0],s=t?"}":"}}",i=e.indexOf(s);if(-1===i||"{"===e[1]){n.push("{".concat(u.decode(e)));continue}let o=e.slice(t?0:1,i);const a=":"===o[0];a&&(o=o.slice(1));const c=this._ref(u.decode(o),{raw:t,wrapped:a});n.push(c),"string"!=typeof c&&(r=!0);const l=e.slice(i+s.length);l&&n.push(u.decode(l))}r?this._template=n:this.rendered=n.join("")}static date(e,t){return u.dateFormat[t.dateFormat].call(e)}describe(e={}){if(!this._settings&&e.compact)return this.source;const t={template:this.source};return this._settings&&(t.options=this._settings),this._functions&&(t.functions=this._functions),t}static build(e){return new u.Template(e.template,e.options||e.functions?V(N({},e.options),{functions:e.functions}):void 0)}isDynamic(){return!!this._template}static isTemplate(e){return!!e&&!!e[a.symbols.template]}refs(){if(!this._template)return;const e=[];for(const t of this._template)"string"!=typeof t&&e.push(...t.refs);return e}resolve(e,t,r,n){return this._template&&1===this._template.length?this._part(this._template[0],e,t,r,n,{}):this.render(e,t,r,n)}_part(e,...t){return e.ref?e.ref.resolve(...t):e.formula.evaluate(t)}render(e,t,r,n,s={}){if(!this.isDynamic())return this.rendered;const o=[];for(const a of this._template)if("string"==typeof a)o.push(a);else{const c=this._part(a,e,t,r,n,s),l=u.stringify(c,e,t,r,n,s);if(void 0!==l){const e=a.raw||!1===(s.errors&&s.errors.escapeHtml)?l:i(l);o.push(u.wrap(e,a.wrapped&&r.errors.wrap.label))}}return o.join("")}_ref(e,{raw:t,wrapped:r}){const n=[],s=e=>{const t=l.create(e,this._settings);return n.push(t),e=>{const r=t.resolve(...e);return void 0!==r?r:null}};try{const t=this._functions?N(N({},u.functions),this._functions):u.functions;var i=new o.Parser(e,{reference:s,functions:t,constants:u.constants})}catch(t){throw t.message='Invalid template variable "'.concat(e,'" fails due to: ').concat(t.message),t}if(i.single){if("reference"===i.single.type){const e=n[0];return{ref:e,raw:t,refs:n,wrapped:r||"local"===e.type&&"label"===e.key}}return u.stringify(i.single.value)}return{formula:i,raw:t,refs:n}}toString(){return this.source}},u.Template.prototype[a.symbols.template]=!0,u.Template.prototype.isImmutable=!0,u.encode=function(e){return e.replace(/\\(\{+)/g,(e,t)=>u.opens.slice(0,t.length)).replace(/\\(\}+)/g,(e,t)=>u.closes.slice(0,t.length))},u.decode=function(e){return e.replace(/\u0000/g,"{").replace(/\u0001/g,"}")},u.split=function(e){const t=[];let r="";for(let n=0;n<e.length;++n){const s=e[n];if("{"===s){let s="";for(;n+1<e.length&&"{"===e[n+1];)s+="{",++n;t.push(r),r=s}else r+=s}return t.push(r),t},u.wrap=function(e,t){return t?1===t.length?"".concat(t).concat(e).concat(t):"".concat(t[0]).concat(e).concat(t[1]):e},u.stringify=function(e,t,r,n,s,i={}){const o=typeof e,a=n&&n.errors&&n.errors.wrap||{};let c=!1;if(l.isRef(e)&&e.render&&(c=e.in,e=e.resolve(t,r,n,s,N({in:e.in},i))),null===e)return"null";if("string"===o)return u.wrap(e,i.arrayItems&&a.string);if("number"===o||"function"===o||"symbol"===o)return e.toString();if("object"!==o)return JSON.stringify(e);if(e instanceof Date)return u.Template.date(e,n);if(e instanceof Map){const t=[];for(const[r,n]of e.entries())t.push("".concat(r.toString()," -> ").concat(n.toString()));e=t}if(!Array.isArray(e))return e.toString();const d=[];for(const o of e)d.push(u.stringify(o,t,r,n,s,N({arrayItems:!0},i)));return u.wrap(d.join(", "),!c&&a.array)},u.constants={true:!0,false:!1,null:null,second:1e3,minute:6e4,hour:36e5,day:864e5},u.functions={if:(e,t,r)=>e?t:r,length:e=>"string"==typeof e?e.length:e&&"object"==typeof e?Array.isArray(e)?e.length:Object.keys(e).length:null,msg(e){const[t,r,n,s,i]=this,o=i.messages;if(!o)return"";const a=c.template(t,o[0],e,r,n)||c.template(t,o[1],e,r,n);return a?a.render(t,r,n,s,i):""},number:e=>"number"==typeof e?e:"string"==typeof e?parseFloat(e):"boolean"==typeof e?e?1:0:e instanceof Date?e.getTime():null}},4946:(e,t,r)=>{const n=r(375),s=r(1687),i=r(8068),o=r(8160),a=r(3292),c=r(6354),l=r(6133),u={};e.exports=i.extend({type:"alternatives",flags:{match:{default:"any"}},terms:{matches:{init:[],register:l.toSibling}},args:(e,...t)=>1===t.length&&Array.isArray(t[0])?e.try(...t[0]):e.try(...t),validate(e,t){const{schema:r,error:n,state:i,prefs:o}=t;if(r._flags.match){const t=[],a=[];for(let n=0;n<r.$_terms.matches.length;++n){const s=r.$_terms.matches[n],c=i.nest(s.schema,"match.".concat(n));c.snapshot();const l=s.schema.$_validate(e,c,o);l.errors?(a.push(l.errors),c.restore()):(t.push(l.value),c.commit())}if(0===t.length)return{errors:n("alternatives.any",{details:a.map(e=>c.details(e,{override:!1}))})};if("one"===r._flags.match)return 1===t.length?{value:t[0]}:{errors:n("alternatives.one")};if(t.length!==r.$_terms.matches.length)return{errors:n("alternatives.all",{details:a.map(e=>c.details(e,{override:!1}))})};const l=e=>e.$_terms.matches.some(e=>"object"===e.schema.type||"alternatives"===e.schema.type&&l(e.schema));return l(r)?{value:t.reduce((e,t)=>s(e,t,{mergeArrays:!1}))}:{value:t[t.length-1]}}const a=[];for(let t=0;t<r.$_terms.matches.length;++t){const n=r.$_terms.matches[t];if(n.schema){const r=i.nest(n.schema,"match.".concat(t));r.snapshot();const s=n.schema.$_validate(e,r,o);if(!s.errors)return r.commit(),s;r.restore(),a.push({schema:n.schema,reports:s.errors});continue}const s=n.ref?n.ref.resolve(e,i,o):e,c=n.is?[n]:n.switch;for(let r=0;r<c.length;++r){const a=c[r],{is:l,then:u,otherwise:d}=a,h="match.".concat(t).concat(n.switch?"."+r:"");if(l.$_match(s,i.nest(l,"".concat(h,".is")),o)){if(u)return u.$_validate(e,i.nest(u,"".concat(h,".then")),o)}else if(d)return d.$_validate(e,i.nest(d,"".concat(h,".otherwise")),o)}}return u.errors(a,t)},rules:{conditional:{method(e,t){n(!this._flags._endedSwitch,"Unreachable condition"),n(!this._flags.match,"Cannot combine match mode",this._flags.match,"with conditional rule"),n(void 0===t.break,"Cannot use break option with alternatives conditional");const r=this.clone(),s=a.when(r,e,t),i=s.is?[s]:s.switch;for(const e of i)if(e.then&&e.otherwise){r.$_setFlag("_endedSwitch",!0,{clone:!1});break}return r.$_terms.matches.push(s),r.$_mutateRebuild()}},match:{method(e){if(n(["any","one","all"].includes(e),"Invalid alternatives match mode",e),"any"!==e)for(const t of this.$_terms.matches)n(t.schema,"Cannot combine match mode",e,"with conditional rules");return this.$_setFlag("match",e)}},try:{method(...e){n(e.length,"Missing alternative schemas"),o.verifyFlat(e,"try"),n(!this._flags._endedSwitch,"Unreachable condition");const t=this.clone();for(const r of e)t.$_terms.matches.push({schema:t.$_compile(r)});return t.$_mutateRebuild()}}},overrides:{label(e){return this.$_parent("label",e).$_modify({each:(t,r)=>"is"!==r.path[0]&&"string"!=typeof t._flags.label?t.label(e):void 0,ref:!1})}},rebuild(e){e.$_modify({each:t=>{o.isSchema(t)&&"array"===t.type&&e.$_setFlag("_arrayItems",!0,{clone:!1})}})},manifest:{build(e,t){if(t.matches)for(const r of t.matches){const{schema:t,ref:n,is:s,not:i,then:o,otherwise:a}=r;e=t?e.try(t):n?e.conditional(n,{is:s,then:o,not:i,otherwise:a,switch:r.switch}):e.conditional(s,{then:o,otherwise:a})}return e}},messages:{"alternatives.all":"{{#label}} does not match all of the required types","alternatives.any":"{{#label}} does not match any of the allowed types","alternatives.match":"{{#label}} does not match any of the allowed types","alternatives.one":"{{#label}} matches more than one allowed type","alternatives.types":"{{#label}} must be one of {{#types}}"}}),u.errors=function(e,{error:t,state:r}){if(!e.length)return{errors:t("alternatives.any")};if(1===e.length)return{errors:e[0].reports};const n=new Set,s=[];for(const{reports:i,schema:o}of e){if(i.length>1)return u.unmatched(e,t);const a=i[0];if(a instanceof c.Report==0)return u.unmatched(e,t);if(a.state.path.length!==r.path.length){s.push({type:o.type,report:a});continue}if("any.only"===a.code){for(const e of a.local.valids)n.add(e);continue}const[l,d]=a.code.split(".");"base"!==d?s.push({type:o.type,report:a}):"object.base"===a.code?n.add(a.local.type):n.add(l)}return s.length?1===s.length?{errors:s[0].report}:u.unmatched(e,t):{errors:t("alternatives.types",{types:[...n]})}},u.unmatched=function(e,t){const r=[];for(const t of e)r.push(...t.reports);return{errors:t("alternatives.match",c.details(r,{override:!1}))}}},8068:(e,t,r)=>{const n=r(375),s=r(7629),i=r(8160),o=r(6914);e.exports=s.extend({type:"any",flags:{only:{default:!1}},terms:{alterations:{init:null},examples:{init:null},externals:{init:null},metas:{init:[]},notes:{init:[]},shared:{init:null},tags:{init:[]},whens:{init:null}},rules:{custom:{method(e,t){return n("function"==typeof e,"Method must be a function"),n(void 0===t||t&&"string"==typeof t,"Description must be a non-empty string"),this.$_addRule({name:"custom",args:{method:e,description:t}})},validate(e,t,{method:r}){try{return r(e,t)}catch(e){return t.error("any.custom",{error:e})}},args:["method","description"],multi:!0},messages:{method(e){return this.prefs({messages:e})}},shared:{method(e){n(i.isSchema(e)&&e._flags.id,"Schema must be a schema with an id");const t=this.clone();return t.$_terms.shared=t.$_terms.shared||[],t.$_terms.shared.push(e),t.$_mutateRegister(e),t}},warning:{method(e,t){return n(e&&"string"==typeof e,"Invalid warning code"),this.$_addRule({name:"warning",args:{code:e,local:t},warn:!0})},validate:(e,t,{code:r,local:n})=>t.error(r,n),args:["code","local"],multi:!0}},modifiers:{keep(e,t=!0){e.keep=t},message(e,t){e.message=o.compile(t)},warn(e,t=!0){e.warn=t}},manifest:{build(e,t){for(const r in t){const n=t[r];if(["examples","externals","metas","notes","tags"].includes(r))for(const t of n)e=e[r.slice(0,-1)](t);else if("alterations"!==r)if("whens"!==r){if("shared"===r)for(const t of n)e=e.shared(t)}else for(const t of n){const{ref:r,is:n,not:s,then:i,otherwise:o,concat:a}=t;e=a?e.concat(a):r?e.when(r,{is:n,not:s,then:i,otherwise:o,switch:t.switch,break:t.break}):e.when(n,{then:i,otherwise:o,break:t.break})}else{const t={};for(const{target:e,adjuster:r}of n)t[e]=r;e=e.alter(t)}}return e}},messages:{"any.custom":"{{#label}} failed custom validation because {{#error.message}}","any.default":"{{#label}} threw an error when running default method","any.failover":"{{#label}} threw an error when running failover method","any.invalid":"{{#label}} contains an invalid value","any.only":'{{#label}} must be {if(#valids.length == 1, "", "one of ")}{{#valids}}',"any.ref":"{{#label}} {{#arg}} references {{:#ref}} which {{#reason}}","any.required":"{{#label}} is required","any.unknown":"{{#label}} is not allowed"}})},546:(e,t,r)=>{const n=r(375),s=r(9474),i=r(9621),o=r(8068),a=r(8160),c=r(3292),l={};e.exports=o.extend({type:"array",flags:{single:{default:!1},sparse:{default:!1}},terms:{items:{init:[],manifest:"schema"},ordered:{init:[],manifest:"schema"},_exclusions:{init:[]},_inclusions:{init:[]},_requireds:{init:[]}},coerce:{from:"object",method(e,{schema:t,state:r,prefs:n}){if(!Array.isArray(e))return;const s=t.$_getRule("sort");return s?l.sort(t,e,s.args.options,r,n):void 0}},validate(e,{schema:t,error:r}){if(!Array.isArray(e)){if(t._flags.single){const t=[e];return t[a.symbols.arraySingle]=!0,{value:t}}return{errors:r("array.base")}}if(t.$_getRule("items")||t.$_terms.externals)return{value:e.slice()}},rules:{has:{method(e){e=this.$_compile(e,{appendPath:!0});const t=this.$_addRule({name:"has",args:{schema:e}});return t.$_mutateRegister(e),t},validate(e,{state:t,prefs:r,error:n},{schema:s}){const i=[e,...t.ancestors];for(let n=0;n<e.length;++n){const o=t.localize([...t.path,n],i,s);if(s.$_match(e[n],o,r))return e}const o=s._flags.label;return o?n("array.hasKnown",{patternLabel:o}):n("array.hasUnknown",null)},multi:!0},items:{method(...e){a.verifyFlat(e,"items");const t=this.$_addRule("items");for(let r=0;r<e.length;++r){const n=a.tryWithPath(()=>this.$_compile(e[r]),r,{append:!0});t.$_terms.items.push(n)}return t.$_mutateRebuild()},validate(e,{schema:t,error:r,state:n,prefs:s,errorsArray:i}){const o=t.$_terms._requireds.slice(),c=t.$_terms.ordered.slice(),u=[...t.$_terms._inclusions,...o],d=!e[a.symbols.arraySingle];delete e[a.symbols.arraySingle];const h=i();let f=e.length;for(let i=0;i<f;++i){const a=e[i];let p=!1,m=!1;const g=d?i:new Number(i),y=[...n.path,g];if(!t._flags.sparse&&void 0===a){if(h.push(r("array.sparse",{key:g,path:y,pos:i,value:void 0},n.localize(y))),s.abortEarly)return h;c.shift();continue}const v=[e,...n.ancestors];for(const e of t.$_terms._exclusions)if(e.$_match(a,n.localize(y,v,e),s,{presence:"ignore"})){if(h.push(r("array.excludes",{pos:i,value:a},n.localize(y))),s.abortEarly)return h;p=!0,c.shift();break}if(p)continue;if(t.$_terms.ordered.length){if(c.length){const o=c.shift(),u=o.$_validate(a,n.localize(y,v,o),s);if(u.errors){if(h.push(...u.errors),s.abortEarly)return h}else if("strip"===o._flags.result)l.fastSplice(e,i),--i,--f;else{if(!t._flags.sparse&&void 0===u.value){if(h.push(r("array.sparse",{key:g,path:y,pos:i,value:void 0},n.localize(y))),s.abortEarly)return h;continue}e[i]=u.value}continue}if(!t.$_terms.items.length){if(h.push(r("array.orderedLength",{pos:i,limit:t.$_terms.ordered.length})),s.abortEarly)return h;break}}const w=[];let R=o.length;for(let c=0;c<R;++c){const u=n.localize(y,v,o[c]);u.snapshot();const d=o[c].$_validate(a,u,s);if(w[c]=d,!d.errors){if(u.commit(),e[i]=d.value,m=!0,l.fastSplice(o,c),--c,--R,!t._flags.sparse&&void 0===d.value&&(h.push(r("array.sparse",{key:g,path:y,pos:i,value:void 0},n.localize(y))),s.abortEarly))return h;break}u.restore()}if(m)continue;const k=s.stripUnknown&&!!s.stripUnknown.arrays||!1;R=u.length;for(const c of u){let u;const d=o.indexOf(c);if(-1!==d)u=w[d];else{const o=n.localize(y,v,c);if(o.snapshot(),u=c.$_validate(a,o,s),!u.errors){o.commit(),"strip"===c._flags.result?(l.fastSplice(e,i),--i,--f):t._flags.sparse||void 0!==u.value?e[i]=u.value:(h.push(r("array.sparse",{key:g,path:y,pos:i,value:void 0},n.localize(y))),p=!0),m=!0;break}o.restore()}if(1===R){if(k){l.fastSplice(e,i),--i,--f,m=!0;break}if(h.push(...u.errors),s.abortEarly)return h;p=!0;break}}if(!p&&(t.$_terms._inclusions.length||t.$_terms._requireds.length)&&!m){if(k){l.fastSplice(e,i),--i,--f;continue}if(h.push(r("array.includes",{pos:i,value:a},n.localize(y))),s.abortEarly)return h}}return o.length&&l.fillMissedErrors(t,h,o,e,n,s),c.length&&(l.fillOrderedErrors(t,h,c,e,n,s),h.length||l.fillDefault(c,e,n,s)),h.length?h:e},priority:!0,manifest:!1},length:{method(e){return this.$_addRule({name:"length",args:{limit:e},operator:"="})},validate:(e,t,{limit:r},{name:n,operator:s,args:i})=>a.compare(e.length,r,s)?e:t.error("array."+n,{limit:i.limit,value:e}),args:[{name:"limit",ref:!0,assert:a.limit,message:"must be a positive integer"}]},max:{method(e){return this.$_addRule({name:"max",method:"length",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"length",args:{limit:e},operator:">="})}},ordered:{method(...e){a.verifyFlat(e,"ordered");const t=this.$_addRule("items");for(let r=0;r<e.length;++r){const n=a.tryWithPath(()=>this.$_compile(e[r]),r,{append:!0});l.validateSingle(n,t),t.$_mutateRegister(n),t.$_terms.ordered.push(n)}return t.$_mutateRebuild()}},single:{method(e){const t=void 0===e||!!e;return n(!t||!this._flags._arrayItems,"Cannot specify single rule when array has array items"),this.$_setFlag("single",t)}},sort:{method(e={}){a.assertOptions(e,["by","order"]);const t={order:e.order||"ascending"};return e.by&&(t.by=c.ref(e.by,{ancestor:0}),n(!t.by.ancestor,"Cannot sort by ancestor")),this.$_addRule({name:"sort",args:{options:t}})},validate(e,{error:t,state:r,prefs:n,schema:s},{options:i}){const{value:o,errors:a}=l.sort(s,e,i,r,n);if(a)return a;for(let r=0;r<e.length;++r)if(e[r]!==o[r])return t("array.sort",{order:i.order,by:i.by?i.by.key:"value"});return e},convert:!0},sparse:{method(e){const t=void 0===e||!!e;return this._flags.sparse===t?this:(t?this.clone():this.$_addRule("items")).$_setFlag("sparse",t,{clone:!1})}},unique:{method(e,t={}){n(!e||"function"==typeof e||"string"==typeof e,"comparator must be a function or a string"),a.assertOptions(t,["ignoreUndefined","separator"]);const r={name:"unique",args:{options:t,comparator:e}};if(e)if("string"==typeof e){const n=a.default(t.separator,".");r.path=n?e.split(n):[e]}else r.comparator=e;return this.$_addRule(r)},validate(e,{state:t,error:r,schema:o},{comparator:a,options:c},{comparator:l,path:u}){const d={string:Object.create(null),number:Object.create(null),undefined:Object.create(null),boolean:Object.create(null),bigint:Object.create(null),object:new Map,function:new Map,custom:new Map},h=l||s,f=c.ignoreUndefined;for(let s=0;s<e.length;++s){const o=u?i(e[s],u):e[s],c=l?d.custom:d[typeof o];if(n(c,"Failed to find unique map container for type",typeof o),c instanceof Map){const n=c.entries();let i;for(;!(i=n.next()).done;)if(h(i.value[0],o)){const n=t.localize([...t.path,s],[e,...t.ancestors]),o={pos:s,value:e[s],dupePos:i.value[1],dupeValue:e[i.value[1]]};return u&&(o.path=a),r("array.unique",o,n)}c.set(o,s)}else{if((!f||void 0!==o)&&void 0!==c[o]){const n={pos:s,value:e[s],dupePos:c[o],dupeValue:e[c[o]]};return u&&(n.path=a),r("array.unique",n,t.localize([...t.path,s],[e,...t.ancestors]))}c[o]=s}}return e},args:["comparator","options"],multi:!0}},cast:{set:{from:Array.isArray,to:(e,t)=>new Set(e)}},rebuild(e){e.$_terms._inclusions=[],e.$_terms._exclusions=[],e.$_terms._requireds=[];for(const t of e.$_terms.items)l.validateSingle(t,e),"required"===t._flags.presence?e.$_terms._requireds.push(t):"forbidden"===t._flags.presence?e.$_terms._exclusions.push(t):e.$_terms._inclusions.push(t);for(const t of e.$_terms.ordered)l.validateSingle(t,e)},manifest:{build:(e,t)=>(t.items&&(e=e.items(...t.items)),t.ordered&&(e=e.ordered(...t.ordered)),e)},messages:{"array.base":"{{#label}} must be an array","array.excludes":"{{#label}} contains an excluded value","array.hasKnown":"{{#label}} does not contain at least one required match for type {:#patternLabel}","array.hasUnknown":"{{#label}} does not contain at least one required match","array.includes":"{{#label}} does not match any of the allowed types","array.includesRequiredBoth":"{{#label}} does not contain {{#knownMisses}} and {{#unknownMisses}} other required value(s)","array.includesRequiredKnowns":"{{#label}} does not contain {{#knownMisses}}","array.includesRequiredUnknowns":"{{#label}} does not contain {{#unknownMisses}} required value(s)","array.length":"{{#label}} must contain {{#limit}} items","array.max":"{{#label}} must contain less than or equal to {{#limit}} items","array.min":"{{#label}} must contain at least {{#limit}} items","array.orderedLength":"{{#label}} must contain at most {{#limit}} items","array.sort":"{{#label}} must be sorted in {#order} order by {{#by}}","array.sort.mismatching":"{{#label}} cannot be sorted due to mismatching types","array.sort.unsupported":"{{#label}} cannot be sorted due to unsupported type {#type}","array.sparse":"{{#label}} must not be a sparse array item","array.unique":"{{#label}} contains a duplicate value"}}),l.fillMissedErrors=function(e,t,r,n,s,i){const o=[];let a=0;for(const e of r){const t=e._flags.label;t?o.push(t):++a}o.length?a?t.push(e.$_createError("array.includesRequiredBoth",n,{knownMisses:o,unknownMisses:a},s,i)):t.push(e.$_createError("array.includesRequiredKnowns",n,{knownMisses:o},s,i)):t.push(e.$_createError("array.includesRequiredUnknowns",n,{unknownMisses:a},s,i))},l.fillOrderedErrors=function(e,t,r,n,s,i){const o=[];for(const e of r)"required"===e._flags.presence&&o.push(e);o.length&&l.fillMissedErrors(e,t,o,n,s,i)},l.fillDefault=function(e,t,r,n){const s=[];let i=!0;for(let o=e.length-1;o>=0;--o){const a=e[o],c=[t,...r.ancestors],l=a.$_validate(void 0,r.localize(r.path,c,a),n).value;if(i){if(void 0===l)continue;i=!1}s.unshift(l)}s.length&&t.push(...s)},l.fastSplice=function(e,t){let r=t;for(;r<e.length;)e[r++]=e[r];--e.length},l.validateSingle=function(e,t){("array"===e.type||e._flags._arrayItems)&&(n(!t._flags.single,"Cannot specify array item with single rule enabled"),t.$_setFlag("_arrayItems",!0,{clone:!1}))},l.sort=function(e,t,r,n,s){const i="ascending"===r.order?1:-1,o=-1*i,a=i,c=(c,u)=>{let d=l.compare(c,u,o,a);if(null!==d||(r.by&&(c=r.by.resolve(c,n,s),u=r.by.resolve(u,n,s)),d=l.compare(c,u,o,a),null!==d))return d;const h=typeof c;if(h!==typeof u)throw e.$_createError("array.sort.mismatching",t,null,n,s);if("number"!==h&&"string"!==h)throw e.$_createError("array.sort.unsupported",t,{type:h},n,s);return"number"===h?(c-u)*i:c<u?o:a};try{return{value:t.slice().sort(c)}}catch(e){return{errors:e}}},l.compare=function(e,t,r,n){return e===t?0:void 0===e?1:void 0===t?-1:null===e?n:null===t?r:null}},4937:(e,t,r)=>{const n=r(375),s=r(8068),i=r(8160),o=r(2036),a={isBool:function(e){return"boolean"==typeof e}};e.exports=s.extend({type:"boolean",flags:{sensitive:{default:!1}},terms:{falsy:{init:null,manifest:"values"},truthy:{init:null,manifest:"values"}},coerce(e,{schema:t}){if("boolean"!=typeof e){if("string"==typeof e){const r=t._flags.sensitive?e:e.toLowerCase();e="true"===r||"false"!==r&&e}return"boolean"!=typeof e&&(e=t.$_terms.truthy&&t.$_terms.truthy.has(e,null,null,!t._flags.sensitive)||(!t.$_terms.falsy||!t.$_terms.falsy.has(e,null,null,!t._flags.sensitive))&&e),{value:e}}},validate(e,{error:t}){if("boolean"!=typeof e)return{value:e,errors:t("boolean.base")}},rules:{truthy:{method(...e){i.verifyFlat(e,"truthy");const t=this.clone();t.$_terms.truthy=t.$_terms.truthy||new o;for(let r=0;r<e.length;++r){const s=e[r];n(void 0!==s,"Cannot call truthy with undefined"),t.$_terms.truthy.add(s)}return t}},falsy:{method(...e){i.verifyFlat(e,"falsy");const t=this.clone();t.$_terms.falsy=t.$_terms.falsy||new o;for(let r=0;r<e.length;++r){const s=e[r];n(void 0!==s,"Cannot call falsy with undefined"),t.$_terms.falsy.add(s)}return t}},sensitive:{method(e=!0){return this.$_setFlag("sensitive",e)}}},cast:{number:{from:a.isBool,to:(e,t)=>e?1:0},string:{from:a.isBool,to:(e,t)=>e?"true":"false"}},manifest:{build:(e,t)=>(t.truthy&&(e=e.truthy(...t.truthy)),t.falsy&&(e=e.falsy(...t.falsy)),e)},messages:{"boolean.base":"{{#label}} must be a boolean"}})},7500:(e,t,r)=>{const n=r(375),s=r(8068),i=r(8160),o=r(3328),a={isDate:function(e){return e instanceof Date}};e.exports=s.extend({type:"date",coerce:{from:["number","string"],method:(e,{schema:t})=>({value:a.parse(e,t._flags.format)||e})},validate(e,{schema:t,error:r,prefs:n}){if(e instanceof Date&&!isNaN(e.getTime()))return;const s=t._flags.format;return n.convert&&s&&"string"==typeof e?{value:e,errors:r("date.format",{format:s})}:{value:e,errors:r("date.base")}},rules:{compare:{method:!1,validate(e,t,{date:r},{name:n,operator:s,args:o}){const a="now"===r?Date.now():r.getTime();return i.compare(e.getTime(),a,s)?e:t.error("date."+n,{limit:o.date,value:e})},args:[{name:"date",ref:!0,normalize:e=>"now"===e?e:a.parse(e),assert:e=>null!==e,message:"must have a valid date format"}]},format:{method(e){return n(["iso","javascript","unix"].includes(e),"Unknown date format",e),this.$_setFlag("format",e)}},greater:{method(e){return this.$_addRule({name:"greater",method:"compare",args:{date:e},operator:">"})}},iso:{method(){return this.format("iso")}},less:{method(e){return this.$_addRule({name:"less",method:"compare",args:{date:e},operator:"<"})}},max:{method(e){return this.$_addRule({name:"max",method:"compare",args:{date:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"compare",args:{date:e},operator:">="})}},timestamp:{method(e="javascript"){return n(["javascript","unix"].includes(e),'"type" must be one of "javascript, unix"'),this.format(e)}}},cast:{number:{from:a.isDate,to:(e,t)=>e.getTime()},string:{from:a.isDate,to:(e,{prefs:t})=>o.date(e,t)}},messages:{"date.base":"{{#label}} must be a valid date","date.format":'{{#label}} must be in {msg("date.format." + #format) || #format} format',"date.greater":"{{#label}} must be greater than {{:#limit}}","date.less":"{{#label}} must be less than {{:#limit}}","date.max":"{{#label}} must be less than or equal to {{:#limit}}","date.min":"{{#label}} must be greater than or equal to {{:#limit}}","date.format.iso":"ISO 8601 date","date.format.javascript":"timestamp or number of milliseconds","date.format.unix":"timestamp or number of seconds"}}),a.parse=function(e,t){if(e instanceof Date)return e;if("string"!=typeof e&&(isNaN(e)||!isFinite(e))||/^\s*$/.test(e))return null;if("iso"===t)return i.isIsoDate(e)?a.date(e.toString()):null;const r=e;if("string"==typeof e&&/^[+-]?\d+(\.\d+)?$/.test(e)&&(e=parseFloat(e)),t){if("javascript"===t)return a.date(1*e);if("unix"===t)return a.date(1e3*e);if("string"==typeof r)return null}return a.date(e)},a.date=function(e){const t=new Date(e);return isNaN(t.getTime())?null:t}},390:(e,t,r)=>{const n=r(375),s=r(7824);e.exports=s.extend({type:"function",properties:{typeof:"function"},rules:{arity:{method(e){return n(Number.isSafeInteger(e)&&e>=0,"n must be a positive integer"),this.$_addRule({name:"arity",args:{n:e}})},validate:(e,t,{n:r})=>e.length===r?e:t.error("function.arity",{n:r})},class:{method(){return this.$_addRule("class")},validate:(e,t)=>/^\s*class\s/.test(e.toString())?e:t.error("function.class",{value:e})},minArity:{method(e){return n(Number.isSafeInteger(e)&&e>0,"n must be a strict positive integer"),this.$_addRule({name:"minArity",args:{n:e}})},validate:(e,t,{n:r})=>e.length>=r?e:t.error("function.minArity",{n:r})},maxArity:{method(e){return n(Number.isSafeInteger(e)&&e>=0,"n must be a positive integer"),this.$_addRule({name:"maxArity",args:{n:e}})},validate:(e,t,{n:r})=>e.length<=r?e:t.error("function.maxArity",{n:r})}},messages:{"function.arity":"{{#label}} must have an arity of {{#n}}","function.class":"{{#label}} must be a class","function.maxArity":"{{#label}} must have an arity lesser or equal to {{#n}}","function.minArity":"{{#label}} must have an arity greater or equal to {{#n}}"}})},7824:(e,t,r)=>{const n=r(978),s=r(375),i=r(8571),o=r(3652),a=r(8068),c=r(8160),l=r(3292),u=r(6354),d=r(6133),h=r(3328),f={renameDefaults:{alias:!1,multiple:!1,override:!1}};e.exports=a.extend({type:"_keys",properties:{typeof:"object"},flags:{unknown:{default:void 0}},terms:{dependencies:{init:null},keys:{init:null,manifest:{mapped:{from:"schema",to:"key"}}},patterns:{init:null},renames:{init:null}},args:(e,t)=>e.keys(t),validate(e,{schema:t,error:r,state:n,prefs:s}){if(!e||typeof e!==t.$_property("typeof")||Array.isArray(e))return{value:e,errors:r("object.base",{type:t.$_property("typeof")})};if(!(t.$_terms.renames||t.$_terms.dependencies||t.$_terms.keys||t.$_terms.patterns||t.$_terms.externals))return;e=f.clone(e,s);const i=[];if(t.$_terms.renames&&!f.rename(t,e,n,s,i))return{value:e,errors:i};if(!t.$_terms.keys&&!t.$_terms.patterns&&!t.$_terms.dependencies)return{value:e,errors:i};const o=new Set(Object.keys(e));if(t.$_terms.keys){const r=[e,...n.ancestors];for(const a of t.$_terms.keys){const t=a.key,c=e[t];o.delete(t);const l=n.localize([...n.path,t],r,a),u=a.schema.$_validate(c,l,s);if(u.errors){if(s.abortEarly)return{value:e,errors:u.errors};void 0!==u.value&&(e[t]=u.value),i.push(...u.errors)}else"strip"===a.schema._flags.result||void 0===u.value&&void 0!==c?delete e[t]:void 0!==u.value&&(e[t]=u.value)}}if(o.size||t._flags._hasPatternMatch){const r=f.unknown(t,e,o,i,n,s);if(r)return r}if(t.$_terms.dependencies)for(const r of t.$_terms.dependencies){if(null!==r.key&&!1===f.isPresent(r.options)(r.key.resolve(e,n,s,null,{shadow:!1})))continue;const o=f.dependencies[r.rel](t,r,e,n,s);if(o){const r=t.$_createError(o.code,e,o.context,n,s);if(s.abortEarly)return{value:e,errors:r};i.push(r)}}return{value:e,errors:i}},rules:{and:{method(...e){return c.verifyFlat(e,"and"),f.dependency(this,"and",null,e)}},append:{method(e){return null==e||0===Object.keys(e).length?this:this.keys(e)}},assert:{method(e,t,r){h.isTemplate(e)||(e=l.ref(e)),s(void 0===r||"string"==typeof r,"Message must be a string"),t=this.$_compile(t,{appendPath:!0});const n=this.$_addRule({name:"assert",args:{subject:e,schema:t,message:r}});return n.$_mutateRegister(e),n.$_mutateRegister(t),n},validate(e,{error:t,prefs:r,state:n},{subject:s,schema:i,message:o}){const a=s.resolve(e,n,r),c=d.isRef(s)?s.absolute(n):[];return i.$_match(a,n.localize(c,[e,...n.ancestors],i),r)?e:t("object.assert",{subject:s,message:o})},args:["subject","schema","message"],multi:!0},instance:{method(e,t){return s("function"==typeof e,"constructor must be a function"),t=t||e.name,this.$_addRule({name:"instance",args:{constructor:e,name:t}})},validate:(e,t,{constructor:r,name:n})=>e instanceof r?e:t.error("object.instance",{type:n,value:e}),args:["constructor","name"]},keys:{method(e){s(void 0===e||"object"==typeof e,"Object schema must be a valid object"),s(!c.isSchema(e),"Object schema cannot be a joi schema");const t=this.clone();if(e)if(Object.keys(e).length){t.$_terms.keys=t.$_terms.keys?t.$_terms.keys.filter(t=>!e.hasOwnProperty(t.key)):new f.Keys;for(const r in e)c.tryWithPath(()=>t.$_terms.keys.push({key:r,schema:this.$_compile(e[r])}),r)}else t.$_terms.keys=new f.Keys;else t.$_terms.keys=null;return t.$_mutateRebuild()}},length:{method(e){return this.$_addRule({name:"length",args:{limit:e},operator:"="})},validate:(e,t,{limit:r},{name:n,operator:s,args:i})=>c.compare(Object.keys(e).length,r,s)?e:t.error("object."+n,{limit:i.limit,value:e}),args:[{name:"limit",ref:!0,assert:c.limit,message:"must be a positive integer"}]},max:{method(e){return this.$_addRule({name:"max",method:"length",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"length",args:{limit:e},operator:">="})}},nand:{method(...e){return c.verifyFlat(e,"nand"),f.dependency(this,"nand",null,e)}},or:{method(...e){return c.verifyFlat(e,"or"),f.dependency(this,"or",null,e)}},oxor:{method(...e){return f.dependency(this,"oxor",null,e)}},pattern:{method(e,t,r={}){const n=e instanceof RegExp;n||(e=this.$_compile(e,{appendPath:!0})),s(void 0!==t,"Invalid rule"),c.assertOptions(r,["fallthrough","matches"]),n&&s(!e.flags.includes("g")&&!e.flags.includes("y"),"pattern should not use global or sticky mode"),t=this.$_compile(t,{appendPath:!0});const i=this.clone();i.$_terms.patterns=i.$_terms.patterns||[];const o={[n?"regex":"schema"]:e,rule:t};return r.matches&&(o.matches=this.$_compile(r.matches),"array"!==o.matches.type&&(o.matches=o.matches.$_root.array().items(o.matches)),i.$_mutateRegister(o.matches),i.$_setFlag("_hasPatternMatch",!0,{clone:!1})),r.fallthrough&&(o.fallthrough=!0),i.$_terms.patterns.push(o),i.$_mutateRegister(t),i}},ref:{method(){return this.$_addRule("ref")},validate:(e,t)=>d.isRef(e)?e:t.error("object.refType",{value:e})},regex:{method(){return this.$_addRule("regex")},validate:(e,t)=>e instanceof RegExp?e:t.error("object.regex",{value:e})},rename:{method(e,t,r={}){s("string"==typeof e||e instanceof RegExp,"Rename missing the from argument"),s("string"==typeof t||t instanceof h,"Invalid rename to argument"),s(t!==e,"Cannot rename key to same name:",e),c.assertOptions(r,["alias","ignoreUndefined","override","multiple"]);const i=this.clone();i.$_terms.renames=i.$_terms.renames||[];for(const t of i.$_terms.renames)s(t.from!==e,"Cannot rename the same key multiple times");return t instanceof h&&i.$_mutateRegister(t),i.$_terms.renames.push({from:e,to:t,options:n(f.renameDefaults,r)}),i}},schema:{method(e="any"){return this.$_addRule({name:"schema",args:{type:e}})},validate:(e,t,{type:r})=>!c.isSchema(e)||"any"!==r&&e.type!==r?t.error("object.schema",{type:r}):e},unknown:{method(e){return this.$_setFlag("unknown",!1!==e)}},with:{method(e,t,r={}){return f.dependency(this,"with",e,t,r)}},without:{method(e,t,r={}){return f.dependency(this,"without",e,t,r)}},xor:{method(...e){return c.verifyFlat(e,"xor"),f.dependency(this,"xor",null,e)}}},overrides:{default(e,t){return void 0===e&&(e=c.symbols.deepDefault),this.$_parent("default",e,t)}},rebuild(e){if(e.$_terms.keys){const t=new o.Sorter;for(const r of e.$_terms.keys)c.tryWithPath(()=>t.add(r,{after:r.schema.$_rootReferences(),group:r.key}),r.key);e.$_terms.keys=new f.Keys(...t.nodes)}},manifest:{build(e,t){if(t.keys&&(e=e.keys(t.keys)),t.dependencies)for(const{rel:r,key:n=null,peers:s,options:i}of t.dependencies)e=f.dependency(e,r,n,s,i);if(t.patterns)for(const{regex:r,schema:n,rule:s,fallthrough:i,matches:o}of t.patterns)e=e.pattern(r||n,s,{fallthrough:i,matches:o});if(t.renames)for(const{from:r,to:n,options:s}of t.renames)e=e.rename(r,n,s);return e}},messages:{"object.and":"{{#label}} contains {{#presentWithLabels}} without its required peers {{#missingWithLabels}}","object.assert":'{{#label}} is invalid because {if(#subject.key, `"` + #subject.key + `" failed to ` + (#message || "pass the assertion test"), #message || "the assertion failed")}',"object.base":"{{#label}} must be of type {{#type}}","object.instance":"{{#label}} must be an instance of {{:#type}}","object.length":'{{#label}} must have {{#limit}} key{if(#limit == 1, "", "s")}',"object.max":'{{#label}} must have less than or equal to {{#limit}} key{if(#limit == 1, "", "s")}',"object.min":'{{#label}} must have at least {{#limit}} key{if(#limit == 1, "", "s")}',"object.missing":"{{#label}} must contain at least one of {{#peersWithLabels}}","object.nand":"{{:#mainWithLabel}} must not exist simultaneously with {{#peersWithLabels}}","object.oxor":"{{#label}} contains a conflict between optional exclusive peers {{#peersWithLabels}}","object.pattern.match":"{{#label}} keys failed to match pattern requirements","object.refType":"{{#label}} must be a Joi reference","object.regex":"{{#label}} must be a RegExp object","object.rename.multiple":"{{#label}} cannot rename {{:#from}} because multiple renames are disabled and another key was already renamed to {{:#to}}","object.rename.override":"{{#label}} cannot rename {{:#from}} because override is disabled and target {{:#to}} exists","object.schema":"{{#label}} must be a Joi schema of {{#type}} type","object.unknown":"{{#label}} is not allowed","object.with":"{{:#mainWithLabel}} missing required peer {{:#peerWithLabel}}","object.without":"{{:#mainWithLabel}} conflict with forbidden peer {{:#peerWithLabel}}","object.xor":"{{#label}} contains a conflict between exclusive peers {{#peersWithLabels}}"}}),f.clone=function(e,t){if("object"==typeof e){if(t.nonEnumerables)return i(e,{shallow:!0});const r=Object.create(Object.getPrototypeOf(e));return Object.assign(r,e),r}const r=function(...t){return e.apply(this,t)};return r.prototype=i(e.prototype),Object.defineProperty(r,"name",{value:e.name,writable:!1}),Object.defineProperty(r,"length",{value:e.length,writable:!1}),Object.assign(r,e),r},f.dependency=function(e,t,r,n,i){s(null===r||"string"==typeof r,t,"key must be a strings"),i||(i=n.length>1&&"object"==typeof n[n.length-1]?n.pop():{}),c.assertOptions(i,["separator","isPresent"]),n=[].concat(n);const o=c.default(i.separator,"."),a=[];for(const e of n)s("string"==typeof e,t,"peers must be strings"),a.push(l.ref(e,{separator:o,ancestor:0,prefix:!1}));null!==r&&(r=l.ref(r,{separator:o,ancestor:0,prefix:!1}));const u=e.clone();return u.$_terms.dependencies=u.$_terms.dependencies||[],u.$_terms.dependencies.push(new f.Dependency(t,r,a,n,i)),u},f.dependencies={and(e,t,r,n,s){const i=[],o=[],a=t.peers.length,c=f.isPresent(t.options);for(const e of t.peers)!1===c(e.resolve(r,n,s,null,{shadow:!1}))?i.push(e.key):o.push(e.key);if(i.length!==a&&o.length!==a)return{code:"object.and",context:{present:o,presentWithLabels:f.keysToLabels(e,o),missing:i,missingWithLabels:f.keysToLabels(e,i)}}},nand(e,t,r,n,s){const i=[],o=f.isPresent(t.options);for(const e of t.peers)o(e.resolve(r,n,s,null,{shadow:!1}))&&i.push(e.key);if(i.length!==t.peers.length)return;const a=t.paths[0],c=t.paths.slice(1);return{code:"object.nand",context:{main:a,mainWithLabel:f.keysToLabels(e,a),peers:c,peersWithLabels:f.keysToLabels(e,c)}}},or(e,t,r,n,s){const i=f.isPresent(t.options);for(const e of t.peers)if(i(e.resolve(r,n,s,null,{shadow:!1})))return;return{code:"object.missing",context:{peers:t.paths,peersWithLabels:f.keysToLabels(e,t.paths)}}},oxor(e,t,r,n,s){const i=[],o=f.isPresent(t.options);for(const e of t.peers)o(e.resolve(r,n,s,null,{shadow:!1}))&&i.push(e.key);if(!i.length||1===i.length)return;const a={peers:t.paths,peersWithLabels:f.keysToLabels(e,t.paths)};return a.present=i,a.presentWithLabels=f.keysToLabels(e,i),{code:"object.oxor",context:a}},with(e,t,r,n,s){const i=f.isPresent(t.options);for(const o of t.peers)if(!1===i(o.resolve(r,n,s,null,{shadow:!1})))return{code:"object.with",context:{main:t.key.key,mainWithLabel:f.keysToLabels(e,t.key.key),peer:o.key,peerWithLabel:f.keysToLabels(e,o.key)}}},without(e,t,r,n,s){const i=f.isPresent(t.options);for(const o of t.peers)if(i(o.resolve(r,n,s,null,{shadow:!1})))return{code:"object.without",context:{main:t.key.key,mainWithLabel:f.keysToLabels(e,t.key.key),peer:o.key,peerWithLabel:f.keysToLabels(e,o.key)}}},xor(e,t,r,n,s){const i=[],o=f.isPresent(t.options);for(const e of t.peers)o(e.resolve(r,n,s,null,{shadow:!1}))&&i.push(e.key);if(1===i.length)return;const a={peers:t.paths,peersWithLabels:f.keysToLabels(e,t.paths)};return 0===i.length?{code:"object.missing",context:a}:(a.present=i,a.presentWithLabels=f.keysToLabels(e,i),{code:"object.xor",context:a})}},f.keysToLabels=function(e,t){return Array.isArray(t)?t.map(t=>e.$_mapLabels(t)):e.$_mapLabels(t)},f.isPresent=function(e){return"function"==typeof e.isPresent?e.isPresent:e=>void 0!==e},f.rename=function(e,t,r,n,s){const i={};for(const o of e.$_terms.renames){const a=[],c="string"!=typeof o.from;if(c)for(const e in t){if(void 0===t[e]&&o.options.ignoreUndefined||e===o.to)continue;const r=o.from.exec(e);r&&a.push({from:e,to:o.to,match:r})}else!Object.prototype.hasOwnProperty.call(t,o.from)||void 0===t[o.from]&&o.options.ignoreUndefined||a.push(o);for(const l of a){const a=l.from;let u=l.to;if(u instanceof h&&(u=u.render(t,r,n,l.match)),a!==u){if(!o.options.multiple&&i[u]&&(s.push(e.$_createError("object.rename.multiple",t,{from:a,to:u,pattern:c},r,n)),n.abortEarly)||Object.prototype.hasOwnProperty.call(t,u)&&!o.options.override&&!i[u]&&(s.push(e.$_createError("object.rename.override",t,{from:a,to:u,pattern:c},r,n)),n.abortEarly))return!1;void 0===t[a]?delete t[u]:t[u]=t[a],i[u]=!0,o.options.alias||delete t[a]}}}return!0},f.unknown=function(e,t,r,n,s,i){if(e.$_terms.patterns){let o=!1;const a=e.$_terms.patterns.map(e=>{if(e.matches)return o=!0,[]}),c=[t,...s.ancestors];for(const o of r){const l=t[o],u=[...s.path,o];for(let d=0;d<e.$_terms.patterns.length;++d){const h=e.$_terms.patterns[d];if(h.regex){const e=h.regex.test(o);if(s.mainstay.tracer.debug(s,"rule","pattern.".concat(d),e?"pass":"error"),!e)continue}else if(!h.schema.$_match(o,s.nest(h.schema,"pattern.".concat(d)),i))continue;r.delete(o);const f=s.localize(u,c,{schema:h.rule,key:o}),p=h.rule.$_validate(l,f,i);if(p.errors){if(i.abortEarly)return{value:t,errors:p.errors};n.push(...p.errors)}if(h.matches&&a[d].push(o),t[o]=p.value,!h.fallthrough)break}}if(o)for(let r=0;r<a.length;++r){const o=a[r];if(!o)continue;const l=e.$_terms.patterns[r].matches,d=s.localize(s.path,c,l),h=l.$_validate(o,d,i);if(h.errors){const r=u.details(h.errors,{override:!1});r.matches=o;const a=e.$_createError("object.pattern.match",t,r,s,i);if(i.abortEarly)return{value:t,errors:a};n.push(a)}}}if(r.size&&(e.$_terms.keys||e.$_terms.patterns)){if(i.stripUnknown&&void 0===e._flags.unknown||i.skipFunctions){const e=!(!i.stripUnknown||!0!==i.stripUnknown&&!i.stripUnknown.objects);for(const n of r)e?(delete t[n],r.delete(n)):"function"==typeof t[n]&&r.delete(n)}if(!c.default(e._flags.unknown,i.allowUnknown))for(const o of r){const r=s.localize([...s.path,o],[]),a=e.$_createError("object.unknown",t[o],{child:o},r,i,{flags:!1});if(i.abortEarly)return{value:t,errors:a};n.push(a)}}},f.Dependency=class{constructor(e,t,r,n,s){this.rel=e,this.key=t,this.peers=r,this.paths=n,this.options=s}describe(){const e={rel:this.rel,peers:this.paths};return null!==this.key&&(e.key=this.key.key),"."!==this.peers[0].separator&&(e.options=V(N({},e.options),{separator:this.peers[0].separator})),this.options.isPresent&&(e.options=V(N({},e.options),{isPresent:this.options.isPresent})),e}},f.Keys=class extends Array{concat(e){const t=this.slice(),r=new Map;for(let e=0;e<t.length;++e)r.set(t[e].key,e);for(const n of e){const e=n.key,s=r.get(e);void 0!==s?t[s]={key:e,schema:t[s].schema.concat(n.schema)}:t.push(n)}return t}}},8785:(e,t,r)=>{const n=r(375),s=r(8068),i=r(8160),o=r(3292),a=r(6354),c={};e.exports=s.extend({type:"link",properties:{schemaChain:!0},terms:{link:{init:null,manifest:"single",register:!1}},args:(e,t)=>e.ref(t),validate(e,{schema:t,state:r,prefs:s}){n(t.$_terms.link,"Uninitialized link schema");const i=c.generate(t,e,r,s),o=t.$_terms.link[0].ref;return i.$_validate(e,r.nest(i,"link:".concat(o.display,":").concat(i.type)),s)},generate:(e,t,r,n)=>c.generate(e,t,r,n),rules:{ref:{method(e){n(!this.$_terms.link,"Cannot reinitialize schema"),e=o.ref(e),n("value"===e.type||"local"===e.type,"Invalid reference type:",e.type),n("local"===e.type||"root"===e.ancestor||e.ancestor>0,"Link cannot reference itself");const t=this.clone();return t.$_terms.link=[{ref:e}],t}},relative:{method(e=!0){return this.$_setFlag("relative",e)}}},overrides:{concat(e){n(this.$_terms.link,"Uninitialized link schema"),n(i.isSchema(e),"Invalid schema object"),n("link"!==e.type,"Cannot merge type link with another link");const t=this.clone();return t.$_terms.whens||(t.$_terms.whens=[]),t.$_terms.whens.push({concat:e}),t.$_mutateRebuild()}},manifest:{build:(e,t)=>(n(t.link,"Invalid link description missing link"),e.ref(t.link))}}),c.generate=function(e,t,r,n){let s=r.mainstay.links.get(e);if(s)return s._generate(t,r,n).schema;const i=e.$_terms.link[0].ref,{perspective:o,path:a}=c.perspective(i,r);c.assert(o,"which is outside of schema boundaries",i,e,r,n);try{s=a.length?o.$_reach(a):o}catch(t){c.assert(!1,"to non-existing schema",i,e,r,n)}return c.assert("link"!==s.type,"which is another link",i,e,r,n),e._flags.relative||r.mainstay.links.set(e,s),s._generate(t,r,n).schema},c.perspective=function(e,t){if("local"===e.type){for(const{schema:r,key:n}of t.schemas){if((r._flags.id||n)===e.path[0])return{perspective:r,path:e.path.slice(1)};if(r.$_terms.shared)for(const t of r.$_terms.shared)if(t._flags.id===e.path[0])return{perspective:t,path:e.path.slice(1)}}return{perspective:null,path:null}}return"root"===e.ancestor?{perspective:t.schemas[t.schemas.length-1].schema,path:e.path}:{perspective:t.schemas[e.ancestor]&&t.schemas[e.ancestor].schema,path:e.path}},c.assert=function(e,t,r,s,i,o){e||n(!1,'"'.concat(a.label(s._flags,i,o),'" contains link reference "').concat(r.display,'" ').concat(t))}},3832:(e,t,r)=>{const n=r(375),s=r(8068),i=r(8160),o={numberRx:/^\s*[+-]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e([+-]?\d+))?\s*$/i,precisionRx:/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/,exponentialPartRegex:/[eE][+-]?\d+$/,leadingSignAndZerosRegex:/^[+-]?(0*)?/,dotRegex:/\./,trailingZerosRegex:/0+$/,decimalPlaces(e){const t=e.toString(),r=t.indexOf("."),n=t.indexOf("e");return(r<0?0:(n<0?t.length:n)-r-1)+(n<0?0:Math.max(0,-parseInt(t.slice(n+1))))}};e.exports=s.extend({type:"number",flags:{unsafe:{default:!1}},coerce:{from:"string",method(e,{schema:t,error:r}){if(!e.match(o.numberRx))return;e=e.trim();const n={value:parseFloat(e)};if(0===n.value&&(n.value=0),!t._flags.unsafe)if(e.match(/e/i)){if(o.extractSignificantDigits(e)!==o.extractSignificantDigits(String(n.value)))return n.errors=r("number.unsafe"),n}else{const t=n.value.toString();if(t.match(/e/i))return n;if(t!==o.normalizeDecimal(e))return n.errors=r("number.unsafe"),n}return n}},validate(e,{schema:t,error:r,prefs:n}){if(e===1/0||e===-1/0)return{value:e,errors:r("number.infinity")};if(!i.isNumber(e))return{value:e,errors:r("number.base")};const s={value:e};if(n.convert){const e=t.$_getRule("precision");if(e){const t=Math.pow(10,e.args.limit);s.value=Math.round(s.value*t)/t}}return 0===s.value&&(s.value=0),!t._flags.unsafe&&(e>Number.MAX_SAFE_INTEGER||e<Number.MIN_SAFE_INTEGER)&&(s.errors=r("number.unsafe")),s},rules:{compare:{method:!1,validate:(e,t,{limit:r},{name:n,operator:s,args:o})=>i.compare(e,r,s)?e:t.error("number."+n,{limit:o.limit,value:e}),args:[{name:"limit",ref:!0,assert:i.isNumber,message:"must be a number"}]},greater:{method(e){return this.$_addRule({name:"greater",method:"compare",args:{limit:e},operator:">"})}},integer:{method(){return this.$_addRule("integer")},validate:(e,t)=>Math.trunc(e)-e==0?e:t.error("number.integer")},less:{method(e){return this.$_addRule({name:"less",method:"compare",args:{limit:e},operator:"<"})}},max:{method(e){return this.$_addRule({name:"max",method:"compare",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"compare",args:{limit:e},operator:">="})}},multiple:{method(e){const t="number"==typeof e?o.decimalPlaces(e):null,r=Math.pow(10,t);return this.$_addRule({name:"multiple",args:{base:e,baseDecimalPlace:t,pfactor:r}})},validate:(e,t,{base:r,baseDecimalPlace:n,pfactor:s},i)=>o.decimalPlaces(e)>n?t.error("number.multiple",{multiple:i.args.base,value:e}):Math.round(s*e)%Math.round(s*r)==0?e:t.error("number.multiple",{multiple:i.args.base,value:e}),args:[{name:"base",ref:!0,assert:e=>"number"==typeof e&&isFinite(e)&&e>0,message:"must be a positive number"},"baseDecimalPlace","pfactor"],multi:!0},negative:{method(){return this.sign("negative")}},port:{method(){return this.$_addRule("port")},validate:(e,t)=>Number.isSafeInteger(e)&&e>=0&&e<=65535?e:t.error("number.port")},positive:{method(){return this.sign("positive")}},precision:{method(e){return n(Number.isSafeInteger(e),"limit must be an integer"),this.$_addRule({name:"precision",args:{limit:e}})},validate(e,t,{limit:r}){const n=e.toString().match(o.precisionRx);return Math.max((n[1]?n[1].length:0)-(n[2]?parseInt(n[2],10):0),0)<=r?e:t.error("number.precision",{limit:r,value:e})},convert:!0},sign:{method(e){return n(["negative","positive"].includes(e),"Invalid sign",e),this.$_addRule({name:"sign",args:{sign:e}})},validate:(e,t,{sign:r})=>"negative"===r&&e<0||"positive"===r&&e>0?e:t.error("number.".concat(r))},unsafe:{method(e=!0){return n("boolean"==typeof e,"enabled must be a boolean"),this.$_setFlag("unsafe",e)}}},cast:{string:{from:e=>"number"==typeof e,to:(e,t)=>e.toString()}},messages:{"number.base":"{{#label}} must be a number","number.greater":"{{#label}} must be greater than {{#limit}}","number.infinity":"{{#label}} cannot be infinity","number.integer":"{{#label}} must be an integer","number.less":"{{#label}} must be less than {{#limit}}","number.max":"{{#label}} must be less than or equal to {{#limit}}","number.min":"{{#label}} must be greater than or equal to {{#limit}}","number.multiple":"{{#label}} must be a multiple of {{#multiple}}","number.negative":"{{#label}} must be a negative number","number.port":"{{#label}} must be a valid port","number.positive":"{{#label}} must be a positive number","number.precision":"{{#label}} must have no more than {{#limit}} decimal places","number.unsafe":"{{#label}} must be a safe number"}}),o.extractSignificantDigits=function(e){return e.replace(o.exponentialPartRegex,"").replace(o.dotRegex,"").replace(o.trailingZerosRegex,"").replace(o.leadingSignAndZerosRegex,"")},o.normalizeDecimal=function(e){return(e=e.replace(/^\+/,"").replace(/\.0*$/,"").replace(/^(-?)\.([^\.]*)$/,"$10.$2").replace(/^(-?)0+([0-9])/,"$1$2")).includes(".")&&e.endsWith("0")&&(e=e.replace(/0+$/,"")),"-0"===e?"0":e}},8966:(e,t,r)=>{const n=r(7824);e.exports=n.extend({type:"object",cast:{map:{from:e=>e&&"object"==typeof e,to:(e,t)=>new Map(Object.entries(e))}}})},7417:(e,t,r)=>{const n=r(375),s=r(5380),i=r(1745),o=r(9959),a=r(6064),c=r(9926),l=r(5752),u=r(8068),d=r(8160),h={tlds:c instanceof Set&&{tlds:{allow:c,deny:null}},base64Regex:{true:{true:/^(?:[\w\-]{2}[\w\-]{2})*(?:[\w\-]{2}==|[\w\-]{3}=)?$/,false:/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/},false:{true:/^(?:[\w\-]{2}[\w\-]{2})*(?:[\w\-]{2}(==)?|[\w\-]{3}=?)?$/,false:/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}(==)?|[A-Za-z0-9+\/]{3}=?)?$/}},dataUriRegex:/^data:[\w+.-]+\/[\w+.-]+;((charset=[\w-]+|base64),)?(.*)$/,hexRegex:{withPrefix:/^0x[0-9a-f]+$/i,withOptionalPrefix:/^(?:0x)?[0-9a-f]+$/i,withoutPrefix:/^[0-9a-f]+$/i},ipRegex:o.regex({cidr:"forbidden"}).regex,isoDurationRegex:/^P(?!$)(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?$/,guidBrackets:{"{":"}","[":"]","(":")","":""},guidVersions:{uuidv1:"1",uuidv2:"2",uuidv3:"3",uuidv4:"4",uuidv5:"5",uuidv6:"6",uuidv7:"7",uuidv8:"8"},guidSeparators:new Set([void 0,!0,!1,"-",":"]),normalizationForms:["NFC","NFD","NFKC","NFKD"]};e.exports=u.extend({type:"string",flags:{insensitive:{default:!1},truncate:{default:!1}},terms:{replacements:{init:null}},coerce:{from:"string",method(e,{schema:t,state:r,prefs:n}){const s=t.$_getRule("normalize");s&&(e=e.normalize(s.args.form));const i=t.$_getRule("case");i&&(e="upper"===i.args.direction?e.toLocaleUpperCase():e.toLocaleLowerCase());const o=t.$_getRule("trim");if(o&&o.args.enabled&&(e=e.trim()),t.$_terms.replacements)for(const r of t.$_terms.replacements)e=e.replace(r.pattern,r.replacement);const a=t.$_getRule("hex");if(a&&a.args.options.byteAligned&&e.length%2!=0&&(e="0".concat(e)),t.$_getRule("isoDate")){const t=h.isoDate(e);t&&(e=t)}if(t._flags.truncate){const s=t.$_getRule("max");if(s){let i=s.args.limit;if(d.isResolvable(i)&&(i=i.resolve(e,r,n),!d.limit(i)))return{value:e,errors:t.$_createError("any.ref",i,{ref:s.args.limit,arg:"limit",reason:"must be a positive integer"},r,n)};e=e.slice(0,i)}}return{value:e}}},validate(e,{schema:t,error:r}){if("string"!=typeof e)return{value:e,errors:r("string.base")};if(""===e){const n=t.$_getRule("min");return n&&0===n.args.limit?void 0:{value:e,errors:r("string.empty")}}},rules:{alphanum:{method(){return this.$_addRule("alphanum")},validate:(e,t)=>/^[a-zA-Z0-9]+$/.test(e)?e:t.error("string.alphanum")},base64:{method(e={}){return d.assertOptions(e,["paddingRequired","urlSafe"]),e=N({urlSafe:!1,paddingRequired:!0},e),n("boolean"==typeof e.paddingRequired,"paddingRequired must be boolean"),n("boolean"==typeof e.urlSafe,"urlSafe must be boolean"),this.$_addRule({name:"base64",args:{options:e}})},validate:(e,t,{options:r})=>h.base64Regex[r.paddingRequired][r.urlSafe].test(e)?e:t.error("string.base64")},case:{method(e){return n(["lower","upper"].includes(e),"Invalid case:",e),this.$_addRule({name:"case",args:{direction:e}})},validate:(e,t,{direction:r})=>"lower"===r&&e===e.toLocaleLowerCase()||"upper"===r&&e===e.toLocaleUpperCase()?e:t.error("string.".concat(r,"case")),convert:!0},creditCard:{method(){return this.$_addRule("creditCard")},validate(e,t){let r=e.length,n=0,s=1;for(;r--;){const t=e.charAt(r)*s;n+=t-9*(t>9),s^=3}return n>0&&n%10==0?e:t.error("string.creditCard")}},dataUri:{method(e={}){return d.assertOptions(e,["paddingRequired"]),e=N({paddingRequired:!0},e),n("boolean"==typeof e.paddingRequired,"paddingRequired must be boolean"),this.$_addRule({name:"dataUri",args:{options:e}})},validate(e,t,{options:r}){const n=e.match(h.dataUriRegex);return!n||n[2]&&"base64"===n[2]&&!h.base64Regex[r.paddingRequired].false.test(n[3])?t.error("string.dataUri"):e}},domain:{method(e){e&&d.assertOptions(e,["allowFullyQualified","allowUnicode","maxDomainSegments","minDomainSegments","tlds"]);const t=h.addressOptions(e);return this.$_addRule({name:"domain",args:{options:e},address:t})},validate:(e,t,r,{address:n})=>s.isValid(e,n)?e:t.error("string.domain")},email:{method(e={}){d.assertOptions(e,["allowFullyQualified","allowUnicode","ignoreLength","maxDomainSegments","minDomainSegments","multiple","separator","tlds"]),n(void 0===e.multiple||"boolean"==typeof e.multiple,"multiple option must be an boolean");const t=h.addressOptions(e),r=new RegExp("\\s*[".concat(e.separator?a(e.separator):",","]\\s*"));return this.$_addRule({name:"email",args:{options:e},regex:r,address:t})},validate(e,t,{options:r},{regex:n,address:s}){const o=r.multiple?e.split(n):[e],a=[];for(const e of o)i.isValid(e,s)||a.push(e);return a.length?t.error("string.email",{value:e,invalids:a}):e}},guid:{alias:"uuid",method(e={}){d.assertOptions(e,["version","separator"]);let t="";if(e.version){const r=[].concat(e.version);n(r.length>=1,"version must have at least 1 valid version specified");const s=new Set;for(let e=0;e<r.length;++e){const i=r[e];n("string"==typeof i,"version at position "+e+" must be a string");const o=h.guidVersions[i.toLowerCase()];n(o,"version at position "+e+" must be one of "+Object.keys(h.guidVersions).join(", ")),n(!s.has(o),"version at position "+e+" must not be a duplicate"),t+=o,s.add(o)}}n(h.guidSeparators.has(e.separator),'separator must be one of true, false, "-", or ":"');const r=void 0===e.separator?"[:-]?":!0===e.separator?"[:-]":!1===e.separator?"[]?":"\\".concat(e.separator),s=new RegExp("^([\\[{\\(]?)[0-9A-F]{8}(".concat(r,")[0-9A-F]{4}\\2?[").concat(t||"0-9A-F","][0-9A-F]{3}\\2?[").concat(t?"89AB":"0-9A-F","][0-9A-F]{3}\\2?[0-9A-F]{12}([\\]}\\)]?)$"),"i");return this.$_addRule({name:"guid",args:{options:e},regex:s})},validate(e,t,r,{regex:n}){const s=n.exec(e);return s?h.guidBrackets[s[1]]!==s[s.length-1]?t.error("string.guid"):e:t.error("string.guid")}},hex:{method(e={}){return d.assertOptions(e,["byteAligned","prefix"]),e=N({byteAligned:!1,prefix:!1},e),n("boolean"==typeof e.byteAligned,"byteAligned must be boolean"),n("boolean"==typeof e.prefix||"optional"===e.prefix,'prefix must be boolean or "optional"'),this.$_addRule({name:"hex",args:{options:e}})},validate:(e,t,{options:r})=>("optional"===r.prefix?h.hexRegex.withOptionalPrefix:!0===r.prefix?h.hexRegex.withPrefix:h.hexRegex.withoutPrefix).test(e)?r.byteAligned&&e.length%2!=0?t.error("string.hexAlign"):e:t.error("string.hex")},hostname:{method(){return this.$_addRule("hostname")},validate:(e,t)=>s.isValid(e,{minDomainSegments:1})||h.ipRegex.test(e)?e:t.error("string.hostname")},insensitive:{method(){return this.$_setFlag("insensitive",!0)}},ip:{method(e={}){d.assertOptions(e,["cidr","version"]);const{cidr:t,versions:r,regex:n}=o.regex(e),s=e.version?r:void 0;return this.$_addRule({name:"ip",args:{options:{cidr:t,version:s}},regex:n})},validate:(e,t,{options:r},{regex:n})=>n.test(e)?e:r.version?t.error("string.ipVersion",{value:e,cidr:r.cidr,version:r.version}):t.error("string.ip",{value:e,cidr:r.cidr})},isoDate:{method(){return this.$_addRule("isoDate")},validate:(e,{error:t})=>h.isoDate(e)?e:t("string.isoDate")},isoDuration:{method(){return this.$_addRule("isoDuration")},validate:(e,t)=>h.isoDurationRegex.test(e)?e:t.error("string.isoDuration")},length:{method(e,t){return h.length(this,"length",e,"=",t)},validate(e,t,{limit:r,encoding:n},{name:s,operator:i,args:o}){const a=!n&&e.length;return d.compare(a,r,i)?e:t.error("string."+s,{limit:o.limit,value:e,encoding:n})},args:[{name:"limit",ref:!0,assert:d.limit,message:"must be a positive integer"},"encoding"]},lowercase:{method(){return this.case("lower")}},max:{method(e,t){return h.length(this,"max",e,"<=",t)},args:["limit","encoding"]},min:{method(e,t){return h.length(this,"min",e,">=",t)},args:["limit","encoding"]},normalize:{method(e="NFC"){return n(h.normalizationForms.includes(e),"normalization form must be one of "+h.normalizationForms.join(", ")),this.$_addRule({name:"normalize",args:{form:e}})},validate:(e,{error:t},{form:r})=>e===e.normalize(r)?e:t("string.normalize",{value:e,form:r}),convert:!0},pattern:{alias:"regex",method(e,t={}){n(e instanceof RegExp,"regex must be a RegExp"),n(!e.flags.includes("g")&&!e.flags.includes("y"),"regex should not use global or sticky mode"),"string"==typeof t&&(t={name:t}),d.assertOptions(t,["invert","name"]);const r=["string.pattern",t.invert?".invert":"",t.name?".name":".base"].join("");return this.$_addRule({name:"pattern",args:{regex:e,options:t},errorCode:r})},validate:(e,t,{regex:r,options:n},{errorCode:s})=>r.test(e)^n.invert?e:t.error(s,{name:n.name,regex:r,value:e}),args:["regex","options"],multi:!0},replace:{method(e,t){"string"==typeof e&&(e=new RegExp(a(e),"g")),n(e instanceof RegExp,"pattern must be a RegExp"),n("string"==typeof t,"replacement must be a String");const r=this.clone();return r.$_terms.replacements||(r.$_terms.replacements=[]),r.$_terms.replacements.push({pattern:e,replacement:t}),r}},token:{method(){return this.$_addRule("token")},validate:(e,t)=>/^\w+$/.test(e)?e:t.error("string.token")},trim:{method(e=!0){return n("boolean"==typeof e,"enabled must be a boolean"),this.$_addRule({name:"trim",args:{enabled:e}})},validate:(e,t,{enabled:r})=>r&&e!==e.trim()?t.error("string.trim"):e,convert:!0},truncate:{method(e=!0){return n("boolean"==typeof e,"enabled must be a boolean"),this.$_setFlag("truncate",e)}},uppercase:{method(){return this.case("upper")}},uri:{method(e={}){d.assertOptions(e,["allowRelative","allowQuerySquareBrackets","domain","relativeOnly","scheme","encodeUri"]),e.domain&&d.assertOptions(e.domain,["allowFullyQualified","allowUnicode","maxDomainSegments","minDomainSegments","tlds"]);const{regex:t,scheme:r}=l.regex(e),n=e.domain?h.addressOptions(e.domain):null;return this.$_addRule({name:"uri",args:{options:e},regex:t,domain:n,scheme:r})},validate(e,t,{options:r},{regex:n,domain:i,scheme:o}){if(["http:/","https:/"].includes(e))return t.error("string.uri");let a=n.exec(e);if(!a&&t.prefs.convert&&r.encodeUri){const t=encodeURI(e);a=n.exec(t),a&&(e=t)}if(a){const n=a[1]||a[2];return!i||r.allowRelative&&!n||s.isValid(n,i)?e:t.error("string.domain",{value:n})}return r.relativeOnly?t.error("string.uriRelativeOnly"):r.scheme?t.error("string.uriCustomScheme",{scheme:o,value:e}):t.error("string.uri")}}},manifest:{build(e,t){if(t.replacements)for(const{pattern:r,replacement:n}of t.replacements)e=e.replace(r,n);return e}},messages:{"string.alphanum":"{{#label}} must only contain alpha-numeric characters","string.base":"{{#label}} must be a string","string.base64":"{{#label}} must be a valid base64 string","string.creditCard":"{{#label}} must be a credit card","string.dataUri":"{{#label}} must be a valid dataUri string","string.domain":"{{#label}} must contain a valid domain name","string.email":"{{#label}} must be a valid email","string.empty":"{{#label}} is not allowed to be empty","string.guid":"{{#label}} must be a valid GUID","string.hex":"{{#label}} must only contain hexadecimal characters","string.hexAlign":"{{#label}} hex decoded representation must be byte aligned","string.hostname":"{{#label}} must be a valid hostname","string.ip":"{{#label}} must be a valid ip address with a {{#cidr}} CIDR","string.ipVersion":"{{#label}} must be a valid ip address of one of the following versions {{#version}} with a {{#cidr}} CIDR","string.isoDate":"{{#label}} must be in iso format","string.isoDuration":"{{#label}} must be a valid ISO 8601 duration","string.length":"{{#label}} length must be {{#limit}} characters long","string.lowercase":"{{#label}} must only contain lowercase characters","string.max":"{{#label}} length must be less than or equal to {{#limit}} characters long","string.min":"{{#label}} length must be at least {{#limit}} characters long","string.normalize":"{{#label}} must be unicode normalized in the {{#form}} form","string.token":"{{#label}} must only contain alpha-numeric and underscore characters","string.pattern.base":"{{#label}} with value {:[.]} fails to match the required pattern: {{#regex}}","string.pattern.name":"{{#label}} with value {:[.]} fails to match the {{#name}} pattern","string.pattern.invert.base":"{{#label}} with value {:[.]} matches the inverted pattern: {{#regex}}","string.pattern.invert.name":"{{#label}} with value {:[.]} matches the inverted {{#name}} pattern","string.trim":"{{#label}} must not have leading or trailing whitespace","string.uri":"{{#label}} must be a valid uri","string.uriCustomScheme":"{{#label}} must be a valid uri with a scheme matching the {{#scheme}} pattern","string.uriRelativeOnly":"{{#label}} must be a valid relative uri","string.uppercase":"{{#label}} must only contain uppercase characters"}}),h.addressOptions=function(e){if(!e)return h.tlds||e;if(n(void 0===e.minDomainSegments||Number.isSafeInteger(e.minDomainSegments)&&e.minDomainSegments>0,"minDomainSegments must be a positive integer"),n(void 0===e.maxDomainSegments||Number.isSafeInteger(e.maxDomainSegments)&&e.maxDomainSegments>0,"maxDomainSegments must be a positive integer"),!1===e.tlds)return e;if(!0===e.tlds||void 0===e.tlds)return n(h.tlds,"Built-in TLD list disabled"),Object.assign({},e,h.tlds);n("object"==typeof e.tlds,"tlds must be true, false, or an object");const t=e.tlds.deny;if(t)return Array.isArray(t)&&(e=Object.assign({},e,{tlds:{deny:new Set(t)}})),n(e.tlds.deny instanceof Set,"tlds.deny must be an array, Set, or boolean"),n(!e.tlds.allow,"Cannot specify both tlds.allow and tlds.deny lists"),h.validateTlds(e.tlds.deny,"tlds.deny"),e;const r=e.tlds.allow;return r?!0===r?(n(h.tlds,"Built-in TLD list disabled"),Object.assign({},e,h.tlds)):(Array.isArray(r)&&(e=Object.assign({},e,{tlds:{allow:new Set(r)}})),n(e.tlds.allow instanceof Set,"tlds.allow must be an array, Set, or boolean"),h.validateTlds(e.tlds.allow,"tlds.allow"),e):e},h.validateTlds=function(e,t){for(const r of e)n(s.isValid(r,{minDomainSegments:1,maxDomainSegments:1}),"".concat(t," must contain valid top level domain names"))},h.isoDate=function(e){if(!d.isIsoDate(e))return null;/.*T.*[+-]\d\d$/.test(e)&&(e+="00");const t=new Date(e);return isNaN(t.getTime())?null:t.toISOString()},h.length=function(e,t,r,s,i){return n(!i||!1,"Invalid encoding:",i),e.$_addRule({name:t,method:"length",args:{limit:r,encoding:i},operator:s})}},8826:(e,t,r)=>{const n=r(375),s=r(8068),i={};i.Map=class extends Map{slice(){return new i.Map(this)}},e.exports=s.extend({type:"symbol",terms:{map:{init:new i.Map}},coerce:{method(e,{schema:t,error:r}){const n=t.$_terms.map.get(e);return n&&(e=n),t._flags.only&&"symbol"!=typeof e?{value:e,errors:r("symbol.map",{map:t.$_terms.map})}:{value:e}}},validate(e,{error:t}){if("symbol"!=typeof e)return{value:e,errors:t("symbol.base")}},rules:{map:{method(e){e&&!e[Symbol.iterator]&&"object"==typeof e&&(e=Object.entries(e)),n(e&&e[Symbol.iterator],"Iterable must be an iterable or object");const t=this.clone(),r=[];for(const s of e){n(s&&s[Symbol.iterator],"Entry must be an iterable");const[e,i]=s;n("object"!=typeof e&&"function"!=typeof e&&"symbol"!=typeof e,"Key must not be of type object, function, or Symbol"),n("symbol"==typeof i,"Value must be a Symbol"),t.$_terms.map.set(e,i),r.push(i)}return t.valid(...r)}}},manifest:{build:(e,t)=>(t.map&&(e=e.map(t.map)),e)},messages:{"symbol.base":"{{#label}} must be a symbol","symbol.map":"{{#label}} must be one of {{#map}}"}})},8863:(e,t,r)=>{const n=r(375),s=r(8571),i=r(738),o=r(9621),a=r(8160),c=r(6354),l=r(493),u={result:Symbol("result")};t.entry=function(e,t,r){let s=a.defaults;r&&(n(void 0===r.warnings,"Cannot override warnings preference in synchronous validation"),n(void 0===r.artifacts,"Cannot override artifacts preference in synchronous validation"),s=a.preferences(a.defaults,r));const i=u.entry(e,t,s);n(!i.mainstay.externals.length,"Schema with external rules must use validateAsync()");const o={value:i.value};return i.error&&(o.error=i.error),i.mainstay.warnings.length&&(o.warning=c.details(i.mainstay.warnings)),i.mainstay.debug&&(o.debug=i.mainstay.debug),i.mainstay.artifacts&&(o.artifacts=i.mainstay.artifacts),o},t.entryAsync=async function(e,t,r){let n=a.defaults;r&&(n=a.preferences(a.defaults,r));const s=u.entry(e,t,n),i=s.mainstay;if(s.error)throw i.debug&&(s.error.debug=i.debug),s.error;if(i.externals.length){let t=s.value;const l=[];for(const s of i.externals){const d=s.state.path,h="link"===s.schema.type?i.links.get(s.schema):null;let f,p,m=t;const g=d.length?[t]:[],y=d.length?o(e,d):e;if(d.length){f=d[d.length-1];let e=t;for(const t of d.slice(0,-1))e=e[t],g.unshift(e);p=g[0],m=p[f]}try{const e=(e,t)=>(h||s.schema).$_createError(e,m,t,s.state,n),o=await s.method(m,{schema:s.schema,linked:h,state:s.state,prefs:r,original:y,error:e,errorsArray:u.errorsArray,warn:(e,t)=>i.warnings.push((h||s.schema).$_createError(e,m,t,s.state,n)),message:(e,t)=>(h||s.schema).$_createError("external",m,t,s.state,n,{messages:e})});if(void 0===o||o===m)continue;if(o instanceof c.Report){if(i.tracer.log(s.schema,s.state,"rule","external","error"),l.push(o),n.abortEarly)break;continue}if(Array.isArray(o)&&o[a.symbols.errors]){if(i.tracer.log(s.schema,s.state,"rule","external","error"),l.push(...o),n.abortEarly)break;continue}p?(i.tracer.value(s.state,"rule",m,o,"external"),p[f]=o):(i.tracer.value(s.state,"rule",t,o,"external"),t=o)}catch(e){throw n.errors.label&&(e.message+=" (".concat(s.label,")")),e}}if(s.value=t,l.length)throw s.error=c.process(l,e,n),i.debug&&(s.error.debug=i.debug),s.error}if(!n.warnings&&!n.debug&&!n.artifacts)return s.value;const l={value:s.value};return i.warnings.length&&(l.warning=c.details(i.warnings)),i.debug&&(l.debug=i.debug),i.artifacts&&(l.artifacts=i.artifacts),l},u.Mainstay=class{constructor(e,t,r){this.externals=[],this.warnings=[],this.tracer=e,this.debug=t,this.links=r,this.shadow=null,this.artifacts=null,this._snapshots=[]}snapshot(){this._snapshots.push({externals:this.externals.slice(),warnings:this.warnings.slice()})}restore(){const e=this._snapshots.pop();this.externals=e.externals,this.warnings=e.warnings}commit(){this._snapshots.pop()}},u.entry=function(e,r,n){const{tracer:s,cleanup:i}=u.tracer(r,n),o=n.debug?[]:null,a=r._ids._schemaChain?new Map:null,d=new u.Mainstay(s,o,a),h=r._ids._schemaChain?[{schema:r}]:null,f=new l([],[],{mainstay:d,schemas:h}),p=t.validate(e,r,f,n);i&&r.$_root.untrace();const m=c.process(p.errors,e,n);return{value:p.value,error:m,mainstay:d}},u.tracer=function(e,t){return e.$_root._tracer?{tracer:e.$_root._tracer._register(e)}:t.debug?(n(e.$_root.trace,"Debug mode not supported"),{tracer:e.$_root.trace()._register(e),cleanup:!0}):{tracer:u.ignore}},t.validate=function(e,t,r,n,s={}){if(t.$_terms.whens&&(t=t._generate(e,r,n).schema),t._preferences&&(n=u.prefs(t,n)),t._cache&&n.cache){const n=t._cache.get(e);if(r.mainstay.tracer.debug(r,"validate","cached",!!n),n)return n}const i=(s,i,o)=>t.$_createError(s,e,i,o||r,n),o={original:e,prefs:n,schema:t,state:r,error:i,errorsArray:u.errorsArray,warn:(e,t,n)=>r.mainstay.warnings.push(i(e,t,n)),message:(s,i)=>t.$_createError("custom",e,i,r,n,{messages:s})};r.mainstay.tracer.entry(t,r);const c=t._definition;if(c.prepare&&void 0!==e&&n.convert){const t=c.prepare(e,o);if(t){if(r.mainstay.tracer.value(r,"prepare",e,t.value),t.errors)return u.finalize(t.value,[].concat(t.errors),o);e=t.value}}if(c.coerce&&void 0!==e&&n.convert&&(!c.coerce.from||c.coerce.from.includes(typeof e))){const t=c.coerce.method(e,o);if(t){if(r.mainstay.tracer.value(r,"coerced",e,t.value),t.errors)return u.finalize(t.value,[].concat(t.errors),o);e=t.value}}const l=t._flags.empty;l&&l.$_match(u.trim(e,t),r.nest(l),a.defaults)&&(r.mainstay.tracer.value(r,"empty",e,void 0),e=void 0);const d=s.presence||t._flags.presence||(t._flags._endedSwitch?null:n.presence);if(void 0===e){if("forbidden"===d)return u.finalize(e,null,o);if("required"===d)return u.finalize(e,[t.$_createError("any.required",e,null,r,n)],o);if("optional"===d){if(t._flags.default!==a.symbols.deepDefault)return u.finalize(e,null,o);r.mainstay.tracer.value(r,"default",e,{}),e={}}}else if("forbidden"===d)return u.finalize(e,[t.$_createError("any.unknown",e,null,r,n)],o);const h=[];if(t._valids){const s=t._valids.get(e,r,n,t._flags.insensitive);if(s)return n.convert&&(r.mainstay.tracer.value(r,"valids",e,s.value),e=s.value),r.mainstay.tracer.filter(t,r,"valid",s),u.finalize(e,null,o);if(t._flags.only){const s=t.$_createError("any.only",e,{valids:t._valids.values({display:!0})},r,n);if(n.abortEarly)return u.finalize(e,[s],o);h.push(s)}}if(t._invalids){const s=t._invalids.get(e,r,n,t._flags.insensitive);if(s){r.mainstay.tracer.filter(t,r,"invalid",s);const i=t.$_createError("any.invalid",e,{invalids:t._invalids.values({display:!0})},r,n);if(n.abortEarly)return u.finalize(e,[i],o);h.push(i)}}if(c.validate){const t=c.validate(e,o);if(t&&(r.mainstay.tracer.value(r,"base",e,t.value),e=t.value,t.errors)){if(!Array.isArray(t.errors))return h.push(t.errors),u.finalize(e,h,o);if(t.errors.length)return h.push(...t.errors),u.finalize(e,h,o)}}return t._rules.length?u.rules(e,h,o):u.finalize(e,h,o)},u.rules=function(e,t,r){const{schema:n,state:s,prefs:i}=r;for(const o of n._rules){const c=n._definition.rules[o.method];if(c.convert&&i.convert){s.mainstay.tracer.log(n,s,"rule",o.name,"full");continue}let l,d=o.args;if(o._resolve.length){d=Object.assign({},d);for(const t of o._resolve){const r=c.argsByName.get(t),o=d[t].resolve(e,s,i),u=r.normalize?r.normalize(o):o,h=a.validateArg(u,null,r);if(h){l=n.$_createError("any.ref",o,{arg:t,ref:d[t],reason:h},s,i);break}d[t]=u}}l=l||c.validate(e,r,d,o);const h=u.rule(l,o);if(h.errors){if(s.mainstay.tracer.log(n,s,"rule",o.name,"error"),o.warn){s.mainstay.warnings.push(...h.errors);continue}if(i.abortEarly)return u.finalize(e,h.errors,r);t.push(...h.errors)}else s.mainstay.tracer.log(n,s,"rule",o.name,"pass"),s.mainstay.tracer.value(s,"rule",e,h.value,o.name),e=h.value}return u.finalize(e,t,r)},u.rule=function(e,t){return e instanceof c.Report?(u.error(e,t),{errors:[e],value:null}):Array.isArray(e)&&e[a.symbols.errors]?(e.forEach(e=>u.error(e,t)),{errors:e,value:null}):{errors:null,value:e}},u.error=function(e,t){return t.message&&e._setTemplate(t.message),e},u.finalize=function(e,t,r){t=t||[];const{schema:s,state:i,prefs:o}=r;if(t.length){const n=u.default("failover",void 0,t,r);void 0!==n&&(i.mainstay.tracer.value(i,"failover",e,n),e=n,t=[])}if(t.length&&s._flags.error)if("function"==typeof s._flags.error){t=s._flags.error(t),Array.isArray(t)||(t=[t]);for(const e of t)n(e instanceof Error||e instanceof c.Report,"error() must return an Error object")}else t=[s._flags.error];if(void 0===e){const n=u.default("default",e,t,r);i.mainstay.tracer.value(i,"default",e,n),e=n}if(s._flags.cast&&void 0!==e){const t=s._definition.cast[s._flags.cast];if(t.from(e)){const n=t.to(e,r);i.mainstay.tracer.value(i,"cast",e,n,s._flags.cast),e=n}}if(s.$_terms.externals&&o.externals&&!1!==o._externals)for(const{method:e}of s.$_terms.externals)i.mainstay.externals.push({method:e,schema:s,state:i,label:c.label(s._flags,i,o)});const a={value:e,errors:t.length?t:null};return s._flags.result&&(a.value="strip"===s._flags.result?void 0:r.original,i.mainstay.tracer.value(i,s._flags.result,e,a.value),i.shadow(e,s._flags.result)),s._cache&&!1!==o.cache&&!s._refs.length&&s._cache.set(r.original,a),void 0===e||a.errors||void 0===s._flags.artifact||(i.mainstay.artifacts=i.mainstay.artifacts||new Map,i.mainstay.artifacts.has(s._flags.artifact)||i.mainstay.artifacts.set(s._flags.artifact,[]),i.mainstay.artifacts.get(s._flags.artifact).push(i.path)),a},u.prefs=function(e,t){const r=t===a.defaults;return r&&e._preferences[a.symbols.prefs]?e._preferences[a.symbols.prefs]:(t=a.preferences(t,e._preferences),r&&(e._preferences[a.symbols.prefs]=t),t)},u.default=function(e,t,r,n){const{schema:i,state:o,prefs:c}=n,l=i._flags[e];if(c.noDefaults||void 0===l)return t;if(o.mainstay.tracer.log(i,o,"rule",e,"full"),!l)return l;if("function"==typeof l){const t=l.length?[s(o.ancestors[0]),n]:[];try{return l(...t)}catch(t){return void r.push(i.$_createError("any.".concat(e),null,{error:t},o,c))}}return"object"!=typeof l?l:l[a.symbols.literal]?l.literal:a.isResolvable(l)?l.resolve(t,o,c):s(l)},u.trim=function(e,t){if("string"!=typeof e)return e;const r=t.$_getRule("trim");return r&&r.args.enabled?e.trim():e},u.ignore={active:!1,debug:i,entry:i,filter:i,log:i,resolve:i,value:i},u.errorsArray=function(){const e=[];return e[a.symbols.errors]=!0,e}},2036:(e,t,r)=>{const n=r(375),s=r(9474),i=r(8160),o={};e.exports=o.Values=class{constructor(e,t){this._values=new Set(e),this._refs=new Set(t),this._lowercase=o.lowercases(e),this._override=!1}get length(){return this._values.size+this._refs.size}add(e,t){i.isResolvable(e)?this._refs.has(e)||(this._refs.add(e),t&&t.register(e)):this.has(e,null,null,!1)||(this._values.add(e),"string"==typeof e&&this._lowercase.set(e.toLowerCase(),e))}static merge(e,t,r){if(e=e||new o.Values,t){if(t._override)return t.clone();for(const r of[...t._values,...t._refs])e.add(r)}if(r)for(const t of[...r._values,...r._refs])e.remove(t);return e.length?e:null}remove(e){i.isResolvable(e)?this._refs.delete(e):(this._values.delete(e),"string"==typeof e&&this._lowercase.delete(e.toLowerCase()))}has(e,t,r,n){return!!this.get(e,t,r,n)}get(e,t,r,n){if(!this.length)return!1;if(this._values.has(e))return{value:e};if("string"==typeof e&&e&&n){const t=this._lowercase.get(e.toLowerCase());if(t)return{value:t}}if(!this._refs.size&&"object"!=typeof e)return!1;if("object"==typeof e)for(const t of this._values)if(s(t,e))return{value:t};if(t)for(const i of this._refs){const o=i.resolve(e,t,r,null,{in:!0});if(void 0===o)continue;const a=i.in&&"object"==typeof o?Array.isArray(o)?o:Object.keys(o):[o];for(const t of a)if(typeof t==typeof e)if(n&&e&&"string"==typeof e){if(t.toLowerCase()===e.toLowerCase())return{value:t,ref:i}}else if(s(t,e))return{value:t,ref:i}}return!1}override(){this._override=!0}values(e){if(e&&e.display){const e=[];for(const t of[...this._values,...this._refs])void 0!==t&&e.push(t);return e}return Array.from([...this._values,...this._refs])}clone(){const e=new o.Values(this._values,this._refs);return e._override=this._override,e}concat(e){n(!e._override,"Cannot concat override set of values");const t=new o.Values([...this._values,...e._values],[...this._refs,...e._refs]);return t._override=this._override,t}describe(){const e=[];this._override&&e.push({override:!0});for(const t of this._values.values())e.push(t&&"object"==typeof t?{value:t}:t);for(const t of this._refs.values())e.push(t.describe());return e}},o.Values.prototype[i.symbols.values]=!0,o.Values.prototype.slice=o.Values.prototype.clone,o.lowercases=function(e){const t=new Map;if(e)for(const r of e)"string"==typeof r&&t.set(r.toLowerCase(),r);return t}},978:(e,t,r)=>{const n=r(375),s=r(8571),i=r(1687),o=r(9621),a={};e.exports=function(e,t,r={}){if(n(e&&"object"==typeof e,"Invalid defaults value: must be an object"),n(!t||!0===t||"object"==typeof t,"Invalid source value: must be true, falsy or an object"),n("object"==typeof r,"Invalid options: must be an object"),!t)return null;if(r.shallow)return a.applyToDefaultsWithShallow(e,t,r);const o=s(e);if(!0===t)return o;const c=void 0!==r.nullOverride&&r.nullOverride;return i(o,t,{nullOverride:c,mergeArrays:!1})},a.applyToDefaultsWithShallow=function(e,t,r){const c=r.shallow;n(Array.isArray(c),"Invalid keys");const l=new Map,u=!0===t?null:new Set;for(let r of c){r=Array.isArray(r)?r:r.split(".");const n=o(e,r);n&&"object"==typeof n?l.set(n,u&&o(t,r)||n):u&&u.add(r)}const d=s(e,{},l);if(!u)return d;for(const e of u)a.reachCopy(d,t,e);const h=void 0!==r.nullOverride&&r.nullOverride;return i(d,t,{nullOverride:h,mergeArrays:!1})},a.reachCopy=function(e,t,r){for(const e of r){if(!(e in t))return;const r=t[e];if("object"!=typeof r||null===r)return;t=r}const n=t;let s=e;for(let e=0;e<r.length-1;++e){const t=r[e];"object"!=typeof s[t]&&(s[t]={}),s=s[t]}s[r[r.length-1]]=n}},375:(e,t,r)=>{const n=r(7916);e.exports=function(e,...t){if(!e)throw 1===t.length&&t[0]instanceof Error?t[0]:new n(t)}},8571:(e,t,r)=>{const n=r(9621),s=r(4277),i=r(7043),o={needsProtoHack:new Set([s.set,s.map,s.weakSet,s.weakMap])};e.exports=o.clone=function(e,t={},r=null){if("object"!=typeof e||null===e)return e;let n=o.clone,a=r;if(t.shallow){if(!0!==t.shallow)return o.cloneWithShallow(e,t);n=e=>e}else if(a){const t=a.get(e);if(t)return t}else a=new Map;const c=s.getInternalProto(e);if(c===s.buffer)return!1;if(c===s.date)return new Date(e.getTime());if(c===s.regex)return new RegExp(e);const l=o.base(e,c,t);if(l===e)return e;if(a&&a.set(e,l),c===s.set)for(const r of e)l.add(n(r,t,a));else if(c===s.map)for(const[r,s]of e)l.set(r,n(s,t,a));const u=i.keys(e,t);for(const r of u){if("__proto__"===r)continue;if(c===s.array&&"length"===r){l.length=e.length;continue}const i=Object.getOwnPropertyDescriptor(e,r);i?i.get||i.set?Object.defineProperty(l,r,i):i.enumerable?l[r]=n(e[r],t,a):Object.defineProperty(l,r,{enumerable:!1,writable:!0,configurable:!0,value:n(e[r],t,a)}):Object.defineProperty(l,r,{enumerable:!0,writable:!0,configurable:!0,value:n(e[r],t,a)})}return l},o.cloneWithShallow=function(e,t){const r=t.shallow;(t=Object.assign({},t)).shallow=!1;const s=new Map;for(const t of r){const r=n(e,t);"object"!=typeof r&&"function"!=typeof r||s.set(r,r)}return o.clone(e,t,s)},o.base=function(e,t,r){if(!1===r.prototype)return o.needsProtoHack.has(t)?new t.constructor:t===s.array?[]:{};const n=Object.getPrototypeOf(e);if(n&&n.isImmutable)return e;if(t===s.array){const e=[];return n!==t&&Object.setPrototypeOf(e,n),e}if(o.needsProtoHack.has(t)){const e=new n.constructor;return n!==t&&Object.setPrototypeOf(e,n),e}return Object.create(n)}},9474:(e,t,r)=>{const n=r(4277),s={mismatched:null};e.exports=function(e,t,r){return r=Object.assign({prototype:!0},r),!!s.isDeepEqual(e,t,r,[])},s.isDeepEqual=function(e,t,r,i){if(e===t)return 0!==e||1/e==1/t;const o=typeof e;if(o!==typeof t||null===e||null===t)return!1;if("function"===o){if(!r.deepFunction||e.toString()!==t.toString())return!1}else if("object"!==o)return e!=e&&t!=t;const a=s.getSharedType(e,t,!!r.prototype);switch(a){case n.buffer:return!1;case n.promise:return e===t;case n.regex:return e.toString()===t.toString();case s.mismatched:return!1}for(let r=i.length-1;r>=0;--r)if(i[r].isSame(e,t))return!0;i.push(new s.SeenEntry(e,t));try{return!!s.isDeepEqualObj(a,e,t,r,i)}finally{i.pop()}},s.getSharedType=function(e,t,r){if(r)return Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)?s.mismatched:n.getInternalProto(e);const i=n.getInternalProto(e);return i!==n.getInternalProto(t)?s.mismatched:i},s.valueOf=function(e){const t=e.valueOf;if(void 0===t)return e;try{return t.call(e)}catch(e){return e}},s.hasOwnEnumerableProperty=function(e,t){return Object.prototype.propertyIsEnumerable.call(e,t)},s.isSetSimpleEqual=function(e,t){for(const r of Set.prototype.values.call(e))if(!Set.prototype.has.call(t,r))return!1;return!0},s.isDeepEqualObj=function(e,t,r,i,o){const{isDeepEqual:a,valueOf:c,hasOwnEnumerableProperty:l}=s,{keys:u,getOwnPropertySymbols:d}=Object;if(e===n.array){if(!i.part){if(t.length!==r.length)return!1;for(let e=0;e<t.length;++e)if(!a(t[e],r[e],i,o))return!1;return!0}for(const e of t)for(const t of r)if(a(e,t,i,o))return!0}else if(e===n.set){if(t.size!==r.size)return!1;if(!s.isSetSimpleEqual(t,r)){const e=new Set(Set.prototype.values.call(r));for(const r of Set.prototype.values.call(t)){if(e.delete(r))continue;let t=!1;for(const n of e)if(a(r,n,i,o)){e.delete(n),t=!0;break}if(!t)return!1}}}else if(e===n.map){if(t.size!==r.size)return!1;for(const[e,n]of Map.prototype.entries.call(t))if(void 0===n&&!Map.prototype.has.call(r,e)||!a(n,Map.prototype.get.call(r,e),i,o))return!1}else if(e===n.error&&(t.name!==r.name||t.message!==r.message))return!1;const h=c(t),f=c(r);if((t!==h||r!==f)&&!a(h,f,i,o))return!1;const p=u(t);if(!i.part&&p.length!==u(r).length&&!i.skip)return!1;let m=0;for(const e of p)if(i.skip&&i.skip.includes(e))void 0===r[e]&&++m;else if(!l(r,e)||!a(t[e],r[e],i,o))return!1;if(!i.part&&p.length-m!==u(r).length)return!1;if(!1!==i.symbols){const e=d(t),n=new Set(d(r));for(const s of e){if(!i.skip||!i.skip.includes(s))if(l(t,s)){if(!l(r,s)||!a(t[s],r[s],i,o))return!1}else if(l(r,s))return!1;n.delete(s)}for(const e of n)if(l(r,e))return!1}return!0},s.SeenEntry=class{constructor(e,t){this.obj=e,this.ref=t}isSame(e,t){return this.obj===e&&this.ref===t}}},7916:(e,t,r)=>{const n=r(8761);e.exports=class extends Error{constructor(e){super(e.filter(e=>""!==e).map(e=>"string"==typeof e?e:e instanceof Error?e.message:n(e)).join(" ")||"Unknown error"),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,t.assert)}}},5277:e=>{const t={};e.exports=function(e){if(!e)return"";let r="";for(let n=0;n<e.length;++n){const s=e.charCodeAt(n);t.isSafe(s)?r+=e[n]:r+=t.escapeHtmlChar(s)}return r},t.escapeHtmlChar=function(e){return t.namedHtml.get(e)||(e>=256?"&#"+e+";":"&#x".concat(e.toString(16).padStart(2,"0"),";"))},t.isSafe=function(e){return t.safeCharCodes.has(e)},t.namedHtml=new Map([[38,"&amp;"],[60,"&lt;"],[62,"&gt;"],[34,"&quot;"],[160,"&nbsp;"],[162,"&cent;"],[163,"&pound;"],[164,"&curren;"],[169,"&copy;"],[174,"&reg;"]]),t.safeCharCodes=function(){const e=new Set;for(let t=32;t<123;++t)(t>=97||t>=65&&t<=90||t>=48&&t<=57||32===t||46===t||44===t||45===t||58===t||95===t)&&e.add(t);return e}()},6064:e=>{e.exports=function(e){return e.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g,"\\$&")}},738:e=>{e.exports=function(){}},1687:(e,t,r)=>{const n=r(375),s=r(8571),i=r(7043),o={};e.exports=o.merge=function(e,t,r){if(n(e&&"object"==typeof e,"Invalid target value: must be an object"),n(null==t||"object"==typeof t,"Invalid source value: must be null, undefined, or an object"),!t)return e;if(r=Object.assign({nullOverride:!0,mergeArrays:!0},r),Array.isArray(t)){n(Array.isArray(e),"Cannot merge array onto an object"),r.mergeArrays||(e.length=0);for(let n=0;n<t.length;++n)e.push(s(t[n],{symbols:r.symbols}));return e}const a=i.keys(t,r);for(let n=0;n<a.length;++n){const i=a[n];if("__proto__"===i||!Object.prototype.propertyIsEnumerable.call(t,i))continue;const c=t[i];if(c&&"object"==typeof c){if(e[i]===c)continue;!e[i]||"object"!=typeof e[i]||Array.isArray(e[i])!==Array.isArray(c)||c instanceof Date||c instanceof RegExp?e[i]=s(c,{symbols:r.symbols}):o.merge(e[i],c,r)}else(null!=c||r.nullOverride)&&(e[i]=c)}return e}},9621:(e,t,r)=>{const n=r(375),s={};e.exports=function(e,t,r){if(!1===t||null==t)return e;"string"==typeof(r=r||{})&&(r={separator:r});const i=Array.isArray(t);n(!i||!r.separator,"Separator option is not valid for array-based chain");const o=i?t:t.split(r.separator||".");let a=e;for(let e=0;e<o.length;++e){let i=o[e];const c=r.iterables&&s.iterables(a);if(Array.isArray(a)||"set"===c){const e=Number(i);Number.isInteger(e)&&(i=e<0?a.length+e:e)}if(!a||"function"==typeof a&&!1===r.functions||!c&&void 0===a[i]){n(!r.strict||e+1===o.length,"Missing segment",i,"in reach path ",t),n("object"==typeof a||!0===r.functions||"function"!=typeof a,"Invalid segment",i,"in reach path ",t),a=r.default;break}a=c?"set"===c?[...a][i]:a.get(i):a[i]}return a},s.iterables=function(e){return e instanceof Set?"set":e instanceof Map?"map":void 0}},8761:e=>{e.exports=function(...e){try{return JSON.stringify(...e)}catch(e){return"[Cannot display object: "+e.message+"]"}}},4277:(e,t)=>{const r={};t=e.exports={array:Array.prototype,buffer:!1,date:Date.prototype,error:Error.prototype,generic:Object.prototype,map:Map.prototype,promise:Promise.prototype,regex:RegExp.prototype,set:Set.prototype,weakMap:WeakMap.prototype,weakSet:WeakSet.prototype},r.typeMap=new Map([["[object Error]",t.error],["[object Map]",t.map],["[object Promise]",t.promise],["[object Set]",t.set],["[object WeakMap]",t.weakMap],["[object WeakSet]",t.weakSet]]),t.getInternalProto=function(e){if(Array.isArray(e))return t.array;if(e instanceof Date)return t.date;if(e instanceof RegExp)return t.regex;if(e instanceof Error)return t.error;const n=Object.prototype.toString.call(e);return r.typeMap.get(n)||t.generic}},7043:(e,t)=>{t.keys=function(e,t={}){return!1!==t.symbols?Reflect.ownKeys(e):Object.getOwnPropertyNames(e)}},3652:(e,t,r)=>{const n=r(375),s={};t.Sorter=class{constructor(){this._items=[],this.nodes=[]}add(e,t){const r=[].concat((t=t||{}).before||[]),s=[].concat(t.after||[]),i=t.group||"?",o=t.sort||0;n(!r.includes(i),"Item cannot come before itself: ".concat(i)),n(!r.includes("?"),"Item cannot come before unassociated items"),n(!s.includes(i),"Item cannot come after itself: ".concat(i)),n(!s.includes("?"),"Item cannot come after unassociated items"),Array.isArray(e)||(e=[e]);for(const t of e){const e={seq:this._items.length,sort:o,before:r,after:s,group:i,node:t};this._items.push(e)}if(!t.manual){const e=this._sort();n(e,"item","?"!==i?"added into group ".concat(i):"","created a dependencies error")}return this.nodes}merge(e){Array.isArray(e)||(e=[e]);for(const t of e)if(t)for(const e of t._items)this._items.push(Object.assign({},e));this._items.sort(s.mergeSort);for(let e=0;e<this._items.length;++e)this._items[e].seq=e;const t=this._sort();return n(t,"merge created a dependencies error"),this.nodes}sort(){const e=this._sort();return n(e,"sort created a dependencies error"),this.nodes}_sort(){const e={},t=Object.create(null),r=Object.create(null);for(const n of this._items){const s=n.seq,i=n.group;r[i]=r[i]||[],r[i].push(s),e[s]=n.before;for(const e of n.after)t[e]=t[e]||[],t[e].push(s)}for(const t in e){const n=[];for(const s in e[t]){const i=e[t][s];r[i]=r[i]||[],n.push(...r[i])}e[t]=n}for(const n in t)if(r[n])for(const s of r[n])e[s].push(...t[n]);const n={};for(const t in e){const r=e[t];for(const e of r)n[e]=n[e]||[],n[e].push(t)}const s={},i=[];for(let e=0;e<this._items.length;++e){let t=e;if(n[e]){t=null;for(let e=0;e<this._items.length;++e){if(!0===s[e])continue;n[e]||(n[e]=[]);const r=n[e].length;let i=0;for(let t=0;t<r;++t)s[n[e][t]]&&++i;if(i===r){t=e;break}}}null!==t&&(s[t]=!0,i.push(t))}if(i.length!==this._items.length)return!1;const o={};for(const e of this._items)o[e.seq]=e;this._items=[],this.nodes=[];for(const e of i){const t=o[e];this.nodes.push(t.node),this._items.push(t)}return!0}},s.mergeSort=(e,t)=>e.sort===t.sort?0:e.sort<t.sort?-1:1},5380:(e,t,r)=>{const n=r(443),s=r(2178),i={minDomainSegments:2,nonAsciiRx:/[^\x00-\x7f]/,domainControlRx:/[\x00-\x20@\:\/\\#!\$&\'\(\)\*\+,;=\?]/,tldSegmentRx:/^[a-zA-Z](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,domainSegmentRx:/^[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,URL:n.URL||URL};t.analyze=function(e,t={}){if(!e)return s.code("DOMAIN_NON_EMPTY_STRING");if("string"!=typeof e)throw new Error("Invalid input: domain must be a string");if(e.length>256)return s.code("DOMAIN_TOO_LONG");if(i.nonAsciiRx.test(e)){if(!1===t.allowUnicode)return s.code("DOMAIN_INVALID_UNICODE_CHARS");e=e.normalize("NFC")}if(i.domainControlRx.test(e))return s.code("DOMAIN_INVALID_CHARS");e=i.punycode(e),t.allowFullyQualified&&"."===e[e.length-1]&&(e=e.slice(0,-1));const r=t.minDomainSegments||i.minDomainSegments,n=e.split(".");if(n.length<r)return s.code("DOMAIN_SEGMENTS_COUNT");if(t.maxDomainSegments&&n.length>t.maxDomainSegments)return s.code("DOMAIN_SEGMENTS_COUNT_MAX");const o=t.tlds;if(o){const e=n[n.length-1].toLowerCase();if(o.deny&&o.deny.has(e)||o.allow&&!o.allow.has(e))return s.code("DOMAIN_FORBIDDEN_TLDS")}for(let e=0;e<n.length;++e){const t=n[e];if(!t.length)return s.code("DOMAIN_EMPTY_SEGMENT");if(t.length>63)return s.code("DOMAIN_LONG_SEGMENT");if(e<n.length-1){if(!i.domainSegmentRx.test(t))return s.code("DOMAIN_INVALID_CHARS")}else if(!i.tldSegmentRx.test(t))return s.code("DOMAIN_INVALID_TLDS_CHARS")}return null},t.isValid=function(e,r){return!t.analyze(e,r)},i.punycode=function(e){e.includes("%")&&(e=e.replace(/%/g,"%25"));try{return new i.URL("http://".concat(e)).host}catch(t){return e}}},1745:(e,t,r)=>{const n=r(9848),s=r(5380),i=r(2178),o={nonAsciiRx:/[^\x00-\x7f]/,encoder:new(n.TextEncoder||TextEncoder)};t.analyze=function(e,t){return o.email(e,t)},t.isValid=function(e,t){return!o.email(e,t)},o.email=function(e,t={}){if("string"!=typeof e)throw new Error("Invalid input: email must be a string");if(!e)return i.code("EMPTY_STRING");const r=!o.nonAsciiRx.test(e);if(!r){if(!1===t.allowUnicode)return i.code("FORBIDDEN_UNICODE");e=e.normalize("NFC")}const n=e.split("@");if(2!==n.length)return n.length>2?i.code("MULTIPLE_AT_CHAR"):i.code("MISSING_AT_CHAR");const[a,c]=n;if(!a)return i.code("EMPTY_LOCAL");if(!t.ignoreLength){if(e.length>254)return i.code("ADDRESS_TOO_LONG");if(o.encoder.encode(a).length>64)return i.code("LOCAL_TOO_LONG")}return o.local(a,r)||s.analyze(c,t)},o.local=function(e,t){const r=e.split(".");for(const e of r){if(!e.length)return i.code("EMPTY_LOCAL_SEGMENT");if(t){if(!o.atextRx.test(e))return i.code("INVALID_LOCAL_CHARS")}else for(const t of e){if(o.atextRx.test(t))continue;const e=o.binary(t);if(!o.atomRx.test(e))return i.code("INVALID_LOCAL_CHARS")}}},o.binary=function(e){return Array.from(o.encoder.encode(e)).map(e=>String.fromCharCode(e)).join("")},o.atextRx=/^[\w!#\$%&'\*\+\-/=\?\^`\{\|\}~]+$/,o.atomRx=new RegExp(["(?:[\\xc2-\\xdf][\\x80-\\xbf])","(?:\\xe0[\\xa0-\\xbf][\\x80-\\xbf])|(?:[\\xe1-\\xec][\\x80-\\xbf]{2})|(?:\\xed[\\x80-\\x9f][\\x80-\\xbf])|(?:[\\xee-\\xef][\\x80-\\xbf]{2})","(?:\\xf0[\\x90-\\xbf][\\x80-\\xbf]{2})|(?:[\\xf1-\\xf3][\\x80-\\xbf]{3})|(?:\\xf4[\\x80-\\x8f][\\x80-\\xbf]{2})"].join("|"))},2178:(e,t)=>{t.codes={EMPTY_STRING:"Address must be a non-empty string",FORBIDDEN_UNICODE:"Address contains forbidden Unicode characters",MULTIPLE_AT_CHAR:"Address cannot contain more than one @ character",MISSING_AT_CHAR:"Address must contain one @ character",EMPTY_LOCAL:"Address local part cannot be empty",ADDRESS_TOO_LONG:"Address too long",LOCAL_TOO_LONG:"Address local part too long",EMPTY_LOCAL_SEGMENT:"Address local part contains empty dot-separated segment",INVALID_LOCAL_CHARS:"Address local part contains invalid character",DOMAIN_NON_EMPTY_STRING:"Domain must be a non-empty string",DOMAIN_TOO_LONG:"Domain too long",DOMAIN_INVALID_UNICODE_CHARS:"Domain contains forbidden Unicode characters",DOMAIN_INVALID_CHARS:"Domain contains invalid character",DOMAIN_INVALID_TLDS_CHARS:"Domain contains invalid tld character",DOMAIN_SEGMENTS_COUNT:"Domain lacks the minimum required number of segments",DOMAIN_SEGMENTS_COUNT_MAX:"Domain contains too many segments",DOMAIN_FORBIDDEN_TLDS:"Domain uses forbidden TLD",DOMAIN_EMPTY_SEGMENT:"Domain contains empty dot-separated segment",DOMAIN_LONG_SEGMENT:"Domain contains dot-separated segment that is too long"},t.code=function(e){return{code:e,error:t.codes[e]}}},9959:(e,t,r)=>{const n=r(375),s=r(5752);t.regex=function(e={}){n(void 0===e.cidr||"string"==typeof e.cidr,"options.cidr must be a string");const t=e.cidr?e.cidr.toLowerCase():"optional";n(["required","optional","forbidden"].includes(t),"options.cidr must be one of required, optional, forbidden"),n(void 0===e.version||"string"==typeof e.version||Array.isArray(e.version),"options.version must be a string or an array of string");let r=e.version||["ipv4","ipv6","ipvfuture"];Array.isArray(r)||(r=[r]),n(r.length>=1,"options.version must have at least 1 version specified");for(let e=0;e<r.length;++e)n("string"==typeof r[e],"options.version must only contain strings"),r[e]=r[e].toLowerCase(),n(["ipv4","ipv6","ipvfuture"].includes(r[e]),"options.version contains unknown version "+r[e]+" - must be one of ipv4, ipv6, ipvfuture");r=Array.from(new Set(r));const i="(?:".concat(r.map(e=>{if("forbidden"===t)return s.ip[e];const r="\\/".concat("ipv4"===e?s.ip.v4Cidr:s.ip.v6Cidr);return"required"===t?"".concat(s.ip[e]).concat(r):"".concat(s.ip[e],"(?:").concat(r,")?")}).join("|"),")"),o=new RegExp("^".concat(i,"$"));return{cidr:t,versions:r,regex:o,raw:i}}},5752:(e,t,r)=>{const n=r(375),s=r(6064),i={generate:function(){const e={},t="\\dA-Fa-f",r="["+t+"]",n="\\w-\\.~",s="!\\$&'\\(\\)\\*\\+,;=",i="%"+t,o=n+i+s+":@",a="["+o+"]",c="(?:0{0,2}\\d|0?[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])";e.ipv4address="(?:"+c+"\\.){3}"+c;const l=r+"{1,4}",u="(?:"+l+":"+l+"|"+e.ipv4address+")",d="(?:"+l+":){6}"+u,h="::(?:"+l+":){5}"+u,f="(?:"+l+")?::(?:"+l+":){4}"+u,p="(?:(?:"+l+":){0,1}"+l+")?::(?:"+l+":){3}"+u,m="(?:(?:"+l+":){0,2}"+l+")?::(?:"+l+":){2}"+u,g="(?:(?:"+l+":){0,3}"+l+")?::"+l+":"+u,y="(?:(?:"+l+":){0,4}"+l+")?::"+u;e.ipv4Cidr="(?:\\d|[1-2]\\d|3[0-2])",e.ipv6Cidr="(?:0{0,2}\\d|0?[1-9]\\d|1[01]\\d|12[0-8])",e.ipv6address="(?:"+d+"|"+h+"|"+f+"|"+p+"|"+m+"|"+g+"|"+y+"|(?:(?:[\\dA-Fa-f]{1,4}:){0,5}[\\dA-Fa-f]{1,4})?::[\\dA-Fa-f]{1,4}|(?:(?:[\\dA-Fa-f]{1,4}:){0,6}[\\dA-Fa-f]{1,4})?::)",e.ipvFuture="v"+r+"+\\.["+n+s+":]+",e.scheme="[a-zA-Z][a-zA-Z\\d+-\\.]*",e.schemeRegex=new RegExp(e.scheme);const v="["+n+i+s+":]*",w="(?:\\[(?:"+e.ipv6address+"|"+e.ipvFuture+")\\]|"+e.ipv4address+"|[\\w-\\.~%\\dA-Fa-f!\\$&'\\(\\)\\*\\+,;=]{1,255})",R="(?:"+v+"@)?"+w+"(?::\\d*)?",k="(?:"+v+"@)?("+w+")(?::\\d*)?",_=a+"*",I=a+"+",E="(?:\\/"+_+")*",T="\\/(?:"+I+E+")?",L=I+E,A="["+n+i+s+"@]+"+E;return e.hierPart="(?:(?:\\/\\/"+R+E+")|"+T+"|"+L+"|(?:\\/\\/\\/[\\w-\\.~%\\dA-Fa-f!\\$&'\\(\\)\\*\\+,;=:@]*(?:\\/[\\w-\\.~%\\dA-Fa-f!\\$&'\\(\\)\\*\\+,;=:@]*)*))",e.hierPartCapture="(?:(?:\\/\\/"+k+E+")|"+T+"|"+L+")",e.relativeRef="(?:(?:\\/\\/"+R+E+")|"+T+"|"+A+"|)",e.relativeRefCapture="(?:(?:\\/\\/"+k+E+")|"+T+"|"+A+"|)",e.query="["+o+"\\/\\?]*(?=#|$)",e.queryWithSquareBrackets="["+o+"\\[\\]\\/\\?]*(?=#|$)",e.fragment="["+o+"\\/\\?]*",e}};i.rfc3986=i.generate(),t.ip={v4Cidr:i.rfc3986.ipv4Cidr,v6Cidr:i.rfc3986.ipv6Cidr,ipv4:i.rfc3986.ipv4address,ipv6:i.rfc3986.ipv6address,ipvfuture:i.rfc3986.ipvFuture},i.createRegex=function(e){const t=i.rfc3986,r="(?:\\?"+(e.allowQuerySquareBrackets?t.queryWithSquareBrackets:t.query)+")?(?:#"+t.fragment+")?",o=e.domain?t.relativeRefCapture:t.relativeRef;if(e.relativeOnly)return i.wrap(o+r);let a="";if(e.scheme){n(e.scheme instanceof RegExp||"string"==typeof e.scheme||Array.isArray(e.scheme),"scheme must be a RegExp, String, or Array");const r=[].concat(e.scheme);n(r.length>=1,"scheme must have at least 1 scheme specified");const i=[];for(let e=0;e<r.length;++e){const o=r[e];n(o instanceof RegExp||"string"==typeof o,"scheme at position "+e+" must be a RegExp or String"),o instanceof RegExp?i.push(o.source.toString()):(n(t.schemeRegex.test(o),"scheme at position "+e+" must be a valid scheme"),i.push(s(o)))}a=i.join("|")}const c="(?:"+(a?"(?:"+a+")":t.scheme)+":"+(e.domain?t.hierPartCapture:t.hierPart)+")",l=e.allowRelative?"(?:"+c+"|"+o+")":c;return i.wrap(l+r,a)},i.wrap=function(e,t){return{raw:e="(?=.)(?!https?:/(?:$|[^/]))(?!https?:///)(?!https?:[^/])".concat(e),regex:new RegExp("^".concat(e,"$")),scheme:t}},i.uriRegex=i.createRegex({}),t.regex=function(e={}){return e.scheme||e.allowRelative||e.relativeOnly||e.allowQuerySquareBrackets||e.domain?i.createRegex(e):i.uriRegex}},1447:(e,t)=>{const r={operators:["!","^","*","/","%","+","-","<","<=",">",">=","==","!=","&&","||","??"],operatorCharacters:["!","^","*","/","%","+","-","<","=",">","&","|","?"],operatorsOrder:[["^"],["*","/","%"],["+","-"],["<","<=",">",">="],["==","!="],["&&"],["||","??"]],operatorsPrefix:["!","n"],literals:{'"':'"',"`":"`","'":"'","[":"]"},numberRx:/^(?:[0-9]*(\.[0-9]*)?){1}$/,tokenRx:/^[\w\$\#\.\@\:\{\}]+$/,symbol:Symbol("formula"),settings:Symbol("settings")};t.Parser=class{constructor(e,t={}){if(!t[r.settings]&&t.constants)for(const e in t.constants){const r=t.constants[e];if(null!==r&&!["boolean","number","string"].includes(typeof r))throw new Error("Formula constant ".concat(e," contains invalid ").concat(typeof r," value type"))}this.settings=t[r.settings]?t:Object.assign({[r.settings]:!0,constants:{},functions:{}},t),this.single=null,this._parts=null,this._parse(e)}_parse(e){let n=[],s="",i=0,o=!1;const a=e=>{if(i)throw new Error("Formula missing closing parenthesis");const a=n.length?n[n.length-1]:null;if(o||s||e){if(a&&"reference"===a.type&&")"===e)return a.type="function",a.value=this._subFormula(s,a.value),void(s="");if(")"===e){const e=new t.Parser(s,this.settings);n.push({type:"segment",value:e})}else if(o){if("]"===o)return n.push({type:"reference",value:s}),void(s="");n.push({type:"literal",value:s})}else if(r.operatorCharacters.includes(s))a&&"operator"===a.type&&r.operators.includes(a.value+s)?a.value+=s:n.push({type:"operator",value:s});else if(s.match(r.numberRx))n.push({type:"constant",value:parseFloat(s)});else if(void 0!==this.settings.constants[s])n.push({type:"constant",value:this.settings.constants[s]});else{if(!s.match(r.tokenRx))throw new Error("Formula contains invalid token: ".concat(s));n.push({type:"reference",value:s})}s=""}};for(const t of e)o?t===o?(a(),o=!1):s+=t:i?"("===t?(s+=t,++i):")"===t?(--i,i?s+=t:a(t)):s+=t:t in r.literals?o=r.literals[t]:"("===t?(a(),++i):r.operatorCharacters.includes(t)?(a(),s=t,a()):" "!==t?s+=t:a();a(),n=n.map((e,t)=>"operator"!==e.type||"-"!==e.value||t&&"operator"!==n[t-1].type?e:{type:"operator",value:"n"});let c=!1;for(const e of n){if("operator"===e.type){if(r.operatorsPrefix.includes(e.value))continue;if(!c)throw new Error("Formula contains an operator in invalid position");if(!r.operators.includes(e.value))throw new Error("Formula contains an unknown operator ".concat(e.value))}else if(c)throw new Error("Formula missing expected operator");c=!c}if(!c)throw new Error("Formula contains invalid trailing operator");1===n.length&&["reference","literal","constant"].includes(n[0].type)&&(this.single={type:"reference"===n[0].type?"reference":"value",value:n[0].value}),this._parts=n.map(e=>{if("operator"===e.type)return r.operatorsPrefix.includes(e.value)?e:e.value;if("reference"!==e.type)return e.value;if(this.settings.tokenRx&&!this.settings.tokenRx.test(e.value))throw new Error("Formula contains invalid reference ".concat(e.value));return this.settings.reference?this.settings.reference(e.value):r.reference(e.value)})}_subFormula(e,n){const s=this.settings.functions[n];if("function"!=typeof s)throw new Error("Formula contains unknown function ".concat(n));let i=[];if(e){let t="",s=0,o=!1;const a=()=>{if(!t)throw new Error("Formula contains function ".concat(n," with invalid arguments ").concat(e));i.push(t),t=""};for(let n=0;n<e.length;++n){const i=e[n];o?(t+=i,i===o&&(o=!1)):i in r.literals&&!s?(t+=i,o=r.literals[i]):","!==i||s?(t+=i,"("===i?++s:")"===i&&--s):a()}a()}return i=i.map(e=>new t.Parser(e,this.settings)),function(e){const t=[];for(const r of i)t.push(r.evaluate(e));return s.call(e,...t)}}evaluate(e){const t=this._parts.slice();for(let n=t.length-2;n>=0;--n){const s=t[n];if(s&&"operator"===s.type){const i=t[n+1];t.splice(n+1,1);const o=r.evaluate(i,e);t[n]=r.single(s.value,o)}}return r.operatorsOrder.forEach(n=>{for(let s=1;s<t.length-1;)if(n.includes(t[s])){const n=t[s],i=r.evaluate(t[s-1],e),o=r.evaluate(t[s+1],e);t.splice(s,2);const a=r.calculate(n,i,o);t[s-1]=0===a?0:a}else s+=2}),r.evaluate(t[0],e)}},t.Parser.prototype[r.symbol]=!0,r.reference=function(e){return function(t){return t&&void 0!==t[e]?t[e]:null}},r.evaluate=function(e,t){return null===e?null:"function"==typeof e?e(t):e[r.symbol]?e.evaluate(t):e},r.single=function(e,t){if("!"===e)return!t;const r=-t;return 0===r?0:r},r.calculate=function(e,t,n){if("??"===e)return r.exists(t)?t:n;if("string"==typeof t||"string"==typeof n){if("+"===e)return(t=r.exists(t)?t:"")+(r.exists(n)?n:"")}else switch(e){case"^":return Math.pow(t,n);case"*":return t*n;case"/":return t/n;case"%":return t%n;case"+":return t+n;case"-":return t-n}switch(e){case"<":return t<n;case"<=":return t<=n;case">":return t>n;case">=":return t>=n;case"==":return t===n;case"!=":return t!==n;case"&&":return t&&n;case"||":return t||n}return null},r.exists=function(e){return null!=e}},9926:()=>{},5688:()=>{},9708:()=>{},1152:()=>{},443:()=>{},9848:()=>{},5934:e=>{e.exports=JSON.parse('{"version":"17.13.3"}')}},t={},function r(n){var s=t[n];if(void 0!==s)return s.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}(5107);var e,t})}(os);class bi extends Be{constructor(e,t,r,n){if(super(),as=r,!t)throw as.error("Token generator is required to construct this module."),new Error("Token generator is required to construct this module.");this.webRTCPeer=new tt,this.signaling=null,this.autoReconnect=n,this.reconnectionInterval=1e3,this.alreadyDisconnected=!1,this.firstReconnection=!0,this.stopReconnection=!1,this.isReconnecting=!1,this.tokenGenerator=t,this.options=null}getRTCPeerConnection(){return this.webRTCPeer?this.webRTCPeer.getRTCPeer():null}stop(){var e;as.info("Stopping"),this.webRTCPeer.closeRTCPeer(),null==(e=this.signaling)||e.close(),this.signaling=null,this.stopReconnection=!0,this.webRTCPeer=new tt}isActive(){const e=this.webRTCPeer.getRTCPeerStatus();return as.info("Broadcast status: ",e||"not_established"),"connected"===e}setReconnect(){this.signaling.on("migrate",()=>this.replaceConnection()),this.autoReconnect&&(this.signaling.on(Wn,()=>{(this.firstReconnection||!this.alreadyDisconnected)&&(this.firstReconnection=!1,this.reconnect({error:new Error("Signaling error: wsConnectionError")}))}),this.webRTCPeer.on(Cn.connectionStateChange,e=>{he(e),"connected"===e&&de(new Date),("failed"===e||"disconnected"===e&&this.alreadyDisconnected)&&this.firstReconnection?(this.firstReconnection=!1,this.reconnect({error:new Error("Connection state change: RTCPeerConnectionState disconnected")})):"disconnected"===e?(this.alreadyDisconnected=!0,setTimeout(()=>this.reconnect({error:new Error("Connection state change: RTCPeerConnectionState disconnected")}),1500)):this.alreadyDisconnected=!1}))}async reconnect(e){try{as.info("Attempting to reconnect..."),!this.isActive()&&!this.stopReconnection&&!this.isReconnecting&&(this.stop(),this.emit("reconnect",{timeout:cs(this.reconnectionInterval),error:null!=e&&e.error?null==e?void 0:e.error:new Error("Attempting to reconnect")}),this.isReconnecting=!0,await this.connect(this.options),this.alreadyDisconnected=!1,this.reconnectionInterval=1e3,this.firstReconnection=!0,this.isReconnecting=!1)}catch(e){this.isReconnecting=!1,this.reconnectionInterval=cs(this.reconnectionInterval),as.error("Reconnection failed, retrying in ".concat(this.reconnectionInterval,"ms. "),e),setTimeout(()=>this.reconnect({error:e}),this.reconnectionInterval)}}}const cs=e=>e<32e3?2*e:e,ls=window.RTCRtpSender&&!!RTCRtpSender.prototype.createEncodedStreams&&window.RTCRtpReceiver&&!!RTCRtpReceiver.prototype.createEncodedStreams,us="RTCRtpScriptTransform"in window,ds="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO3ZhciBGPXR5cGVvZiBnbG9iYWxUaGlzPCJ1Ij9nbG9iYWxUaGlzOnR5cGVvZiB3aW5kb3c8InUiP3dpbmRvdzp0eXBlb2YgZ2xvYmFsPCJ1Ij9nbG9iYWw6dHlwZW9mIHNlbGY8InUiP3NlbGY6e307ZnVuY3Rpb24gVyhuKXtyZXR1cm4gbiYmbi5fX2VzTW9kdWxlJiZPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwobiwiZGVmYXVsdCIpP24uZGVmYXVsdDpufXZhciBCPXtleHBvcnRzOnt9fTsvKiEKICoganMtbG9nZ2VyIC0gaHR0cDovL2dpdGh1Yi5jb20vam9ubnlyZWV2ZXMvanMtbG9nZ2VyCiAqIEpvbm55IFJlZXZlcywgaHR0cDovL2pvbm55cmVldmVzLmNvLnVrLwogKiBqcy1sb2dnZXIgbWF5IGJlIGZyZWVseSBkaXN0cmlidXRlZCB1bmRlciB0aGUgTUlUIGxpY2Vuc2UuCiAqLyhmdW5jdGlvbihuKXsoZnVuY3Rpb24odCl7dmFyIGU9e307ZS5WRVJTSU9OPSIxLjYuMSI7dmFyIHMscj17fSxvPWZ1bmN0aW9uKGksdSl7cmV0dXJuIGZ1bmN0aW9uKCl7cmV0dXJuIHUuYXBwbHkoaSxhcmd1bWVudHMpfX0sYT1mdW5jdGlvbigpe3ZhciBpPWFyZ3VtZW50cyx1PWlbMF0saCxjO2ZvcihjPTE7YzxpLmxlbmd0aDtjKyspZm9yKGggaW4gaVtjXSkhKGggaW4gdSkmJmlbY10uaGFzT3duUHJvcGVydHkoaCkmJih1W2hdPWlbY11baF0pO3JldHVybiB1fSxkPWZ1bmN0aW9uKGksdSl7cmV0dXJue3ZhbHVlOmksbmFtZTp1fX07ZS5UUkFDRT1kKDEsIlRSQUNFIiksZS5ERUJVRz1kKDIsIkRFQlVHIiksZS5JTkZPPWQoMywiSU5GTyIpLGUuVElNRT1kKDQsIlRJTUUiKSxlLldBUk49ZCg1LCJXQVJOIiksZS5FUlJPUj1kKDgsIkVSUk9SIiksZS5PRkY9ZCg5OSwiT0ZGIik7dmFyIGw9ZnVuY3Rpb24oaSl7dGhpcy5jb250ZXh0PWksdGhpcy5zZXRMZXZlbChpLmZpbHRlckxldmVsKSx0aGlzLmxvZz10aGlzLmluZm99O2wucHJvdG90eXBlPXtzZXRMZXZlbDpmdW5jdGlvbihpKXtpJiYidmFsdWUiaW4gaSYmKHRoaXMuY29udGV4dC5maWx0ZXJMZXZlbD1pKX0sZ2V0TGV2ZWw6ZnVuY3Rpb24oKXtyZXR1cm4gdGhpcy5jb250ZXh0LmZpbHRlckxldmVsfSxlbmFibGVkRm9yOmZ1bmN0aW9uKGkpe3ZhciB1PXRoaXMuY29udGV4dC5maWx0ZXJMZXZlbDtyZXR1cm4gaS52YWx1ZT49dS52YWx1ZX0sdHJhY2U6ZnVuY3Rpb24oKXt0aGlzLmludm9rZShlLlRSQUNFLGFyZ3VtZW50cyl9LGRlYnVnOmZ1bmN0aW9uKCl7dGhpcy5pbnZva2UoZS5ERUJVRyxhcmd1bWVudHMpfSxpbmZvOmZ1bmN0aW9uKCl7dGhpcy5pbnZva2UoZS5JTkZPLGFyZ3VtZW50cyl9LHdhcm46ZnVuY3Rpb24oKXt0aGlzLmludm9rZShlLldBUk4sYXJndW1lbnRzKX0sZXJyb3I6ZnVuY3Rpb24oKXt0aGlzLmludm9rZShlLkVSUk9SLGFyZ3VtZW50cyl9LHRpbWU6ZnVuY3Rpb24oaSl7dHlwZW9mIGk9PSJzdHJpbmciJiZpLmxlbmd0aD4wJiZ0aGlzLmludm9rZShlLlRJTUUsW2ksInN0YXJ0Il0pfSx0aW1lRW5kOmZ1bmN0aW9uKGkpe3R5cGVvZiBpPT0ic3RyaW5nIiYmaS5sZW5ndGg+MCYmdGhpcy5pbnZva2UoZS5USU1FLFtpLCJlbmQiXSl9LGludm9rZTpmdW5jdGlvbihpLHUpe3MmJnRoaXMuZW5hYmxlZEZvcihpKSYmcyh1LGEoe2xldmVsOml9LHRoaXMuY29udGV4dCkpfX07dmFyIGY9bmV3IGwoe2ZpbHRlckxldmVsOmUuT0ZGfSk7KGZ1bmN0aW9uKCl7dmFyIGk9ZTtpLmVuYWJsZWRGb3I9byhmLGYuZW5hYmxlZEZvciksaS50cmFjZT1vKGYsZi50cmFjZSksaS5kZWJ1Zz1vKGYsZi5kZWJ1ZyksaS50aW1lPW8oZixmLnRpbWUpLGkudGltZUVuZD1vKGYsZi50aW1lRW5kKSxpLmluZm89byhmLGYuaW5mbyksaS53YXJuPW8oZixmLndhcm4pLGkuZXJyb3I9byhmLGYuZXJyb3IpLGkubG9nPWkuaW5mb30pKCksZS5zZXRIYW5kbGVyPWZ1bmN0aW9uKGkpe3M9aX0sZS5zZXRMZXZlbD1mdW5jdGlvbihpKXtmLnNldExldmVsKGkpO2Zvcih2YXIgdSBpbiByKXIuaGFzT3duUHJvcGVydHkodSkmJnJbdV0uc2V0TGV2ZWwoaSl9LGUuZ2V0TGV2ZWw9ZnVuY3Rpb24oKXtyZXR1cm4gZi5nZXRMZXZlbCgpfSxlLmdldD1mdW5jdGlvbihpKXtyZXR1cm4gcltpXXx8KHJbaV09bmV3IGwoYSh7bmFtZTppfSxmLmNvbnRleHQpKSl9LGUuY3JlYXRlRGVmYXVsdEhhbmRsZXI9ZnVuY3Rpb24oaSl7aT1pfHx7fSxpLmZvcm1hdHRlcj1pLmZvcm1hdHRlcnx8ZnVuY3Rpb24ocCxfKXtfLm5hbWUmJnAudW5zaGlmdCgiWyIrXy5uYW1lKyJdIil9O3ZhciB1PXt9LGg9ZnVuY3Rpb24oYyxwKXtGdW5jdGlvbi5wcm90b3R5cGUuYXBwbHkuY2FsbChjLGNvbnNvbGUscCl9O3JldHVybiB0eXBlb2YgY29uc29sZT4idSI/ZnVuY3Rpb24oKXt9OmZ1bmN0aW9uKGMscCl7Yz1BcnJheS5wcm90b3R5cGUuc2xpY2UuY2FsbChjKTt2YXIgXz1jb25zb2xlLmxvZyxnO3AubGV2ZWw9PT1lLlRJTUU/KGc9KHAubmFtZT8iWyIrcC5uYW1lKyJdICI6IiIpK2NbMF0sY1sxXT09PSJzdGFydCI/Y29uc29sZS50aW1lP2NvbnNvbGUudGltZShnKTp1W2ddPW5ldyBEYXRlKCkuZ2V0VGltZSgpOmNvbnNvbGUudGltZUVuZD9jb25zb2xlLnRpbWVFbmQoZyk6aChfLFtnKyI6ICIrKG5ldyBEYXRlKCkuZ2V0VGltZSgpLXVbZ10pKyJtcyJdKSk6KHAubGV2ZWw9PT1lLldBUk4mJmNvbnNvbGUud2Fybj9fPWNvbnNvbGUud2FybjpwLmxldmVsPT09ZS5FUlJPUiYmY29uc29sZS5lcnJvcj9fPWNvbnNvbGUuZXJyb3I6cC5sZXZlbD09PWUuSU5GTyYmY29uc29sZS5pbmZvP189Y29uc29sZS5pbmZvOnAubGV2ZWw9PT1lLkRFQlVHJiZjb25zb2xlLmRlYnVnP189Y29uc29sZS5kZWJ1ZzpwLmxldmVsPT09ZS5UUkFDRSYmY29uc29sZS50cmFjZSYmKF89Y29uc29sZS50cmFjZSksaS5mb3JtYXR0ZXIoYyxwKSxoKF8sYykpfX0sZS51c2VEZWZhdWx0cz1mdW5jdGlvbihpKXtlLnNldExldmVsKGkmJmkuZGVmYXVsdExldmVsfHxlLkRFQlVHKSxlLnNldEhhbmRsZXIoZS5jcmVhdGVEZWZhdWx0SGFuZGxlcihpKSl9LGUuc2V0RGVmYXVsdHM9ZS51c2VEZWZhdWx0cyxuLmV4cG9ydHM/bi5leHBvcnRzPWU6KGUuX3ByZXZMb2dnZXI9dC5Mb2dnZXIsZS5ub0NvbmZsaWN0PWZ1bmN0aW9uKCl7cmV0dXJuIHQuTG9nZ2VyPWUuX3ByZXZMb2dnZXIsZX0sdC5Mb2dnZXI9ZSl9KShGKX0pKEIpO3ZhciB6PUIuZXhwb3J0cyxEPVcoeik7Y2xhc3Mgd3tjb25zdHJ1Y3Rvcih0KXt0aGlzLmRhdGE9dCx0aGlzLmJpdE9mZnNldD0wfXJlYWRCaXRzKHQpe2lmKHRoaXMuYml0T2Zmc2V0K3Q+dGhpcy5kYXRhLmxlbmd0aCo4KXRocm93IG5ldyBFcnJvcigiQXR0ZW1wdGVkIHRvIHJlYWQgcGFzdCB0aGUgZW5kIG9mIHRoZSBiaXRzdHJlYW0iKTtsZXQgZT0wO2ZvcihsZXQgcz0wO3M8dDtzKyspe2NvbnN0IHI9TWF0aC5mbG9vcih0aGlzLmJpdE9mZnNldC84KSxvPTctdGhpcy5iaXRPZmZzZXQlOCxhPXRoaXMuZGF0YVtyXT4+byYxO2V8PWE8PHQtMS1zLHRoaXMuYml0T2Zmc2V0Kyt9cmV0dXJuIGV9c2tpcCh0KXt0aGlzLmJpdE9mZnNldCs9dH1yZWFkRXhwR29sb21iVW5zaWduZWQoKXtsZXQgdD0tMTtmb3IobGV0IGU9MDtlPT09MDt0KyspZT10aGlzLnJlYWRCaXRzKDEpO3JldHVybigxPDx0KS0xK3RoaXMucmVhZEJpdHModCl9cmVhZEV4cEdvbG9tYlNpZ25lZCgpe2NvbnN0IHQ9dGhpcy5yZWFkRXhwR29sb21iVW5zaWduZWQoKTtyZXR1cm4gdCUyPT09MD8tKHQvMik6KHQrMSkvMn19Y29uc3QgbT17U0xJQ0VfTk9OX0lEUjoxLFNMSUNFX1BBUlRJVElPTl9BOjIsU0xJQ0VfSURSOjUsU0VJX0gyNjQ6NixTRUlfSDI2NV9QUkVGSVg6MzksU0VJX0gyNjVfU1VGRklYOjQwLFNQU19IMjY0OjcsU1BTX0gyNjU6MzMsUFBTX0gyNjQ6OCxQUFNfSDI2NTozNH0sUj17UElDX1RJTUlORzoxLFVTRVJfREFUQV9VTlJFR0lTVEVSRUQ6NX0sRT17TEVHQUNZOjEsTkVXOjIsVElNRUNPREU6MyxPVEhFUjo0fSxqPSI2ZTljZmQyYS01OTA3LTQ5ZmYtYjM2My04OTc4YTZlODM0MGUiLHE9IjlhMjFmM2JlLTMxZjAtNGI3OC1iMGJlLWM3ZjdkYmI5NzI1MCIsTD0iZDQwZTM4ZWEtZDQxOS00YzYyLTk0ZWQtMjBhYzM3YjRlNGZhIjtjbGFzcyBWe2NvbnN0cnVjdG9yKHQ9IkgyNjQiKXt0aGlzLnNwcz1uZXcgTWFwLHRoaXMucHBzPW5ldyBNYXAsdGhpcy5hY3RpdmVTUFM9bnVsbCx0aGlzLmNvZGVjPXR9Y29sbGVjdFBQUyh0KXt0aGlzLmNvZGVjPT09IkgyNjQiP3RoaXMuY29sbGVjdEgyNjRQUFModCk6dGhpcy5jb2xsZWN0SDI2NVBQUyh0KX1jb2xsZWN0U1BTKHQpe3RoaXMuY29kZWM9PT0iSDI2NCI/dGhpcy5jb2xsZWN0SDI2NFNQUyh0KTp0aGlzLmNvbGxlY3RIMjY1U1BTKHQpfWNvbGxlY3RIMjY0U1BTKHQpe2NvbnN0IGU9bmV3IHcodCkscz1lLnJlYWRCaXRzKDgpLHI9WzEwMCwxMTAsMTIyLDI0NCw0NCw4Myw4NiwxMTgsMTI4LDEzOCwxMzksMTM0LDEzNV07ZS5za2lwKDgpLGUuc2tpcCg4KTtjb25zdCBvPWUucmVhZEV4cEdvbG9tYlVuc2lnbmVkKCk7aWYobz4zMXx8bzwwKXRocm93IG5ldyBFcnJvcigiSW52YWxpZCBzZXFfcGFyYW1ldGVyX3NldF9pZCIpO2lmKHIuaW5jbHVkZXMocykpe2NvbnN0IGw9ZS5yZWFkRXhwR29sb21iVW5zaWduZWQoKTtpZihsPT09MyYmZS5za2lwKDEpLGUucmVhZEV4cEdvbG9tYlVuc2lnbmVkKCksZS5yZWFkRXhwR29sb21iVW5zaWduZWQoKSxlLnNraXAoMSksZS5yZWFkQml0cygxKSl7Y29uc3QgaT1sIT09Mz84OjEyO2ZvcihsZXQgdT0wO3U8aTt1KyspaWYoZS5yZWFkQml0cygxKSl7Y29uc3QgaD11PDY/MTY6NjQ7bGV0IGM9OCxwPTg7Zm9yKGxldCBfPTA7XzxoO18rKyl7aWYocCE9PTApe2NvbnN0IGc9ZS5yZWFkRXhwR29sb21iU2lnbmVkKCk7cD0oYytnKzI1NiklMjU2fWM9cD09PTA/YzpwfX19fWUucmVhZEV4cEdvbG9tYlVuc2lnbmVkKCk7Y29uc3QgYT1lLnJlYWRFeHBHb2xvbWJVbnNpZ25lZCgpO2lmKGE9PT0wKWUucmVhZEV4cEdvbG9tYlVuc2lnbmVkKCk7ZWxzZSBpZihhPT09MSl7ZS5za2lwKDEpLGUucmVhZEV4cEdvbG9tYlNpZ25lZCgpLGUucmVhZEV4cEdvbG9tYlNpZ25lZCgpO2NvbnN0IGw9ZS5yZWFkRXhwR29sb21iVW5zaWduZWQoKTtmb3IobGV0IGY9MDtmPGw7ZisrKWUucmVhZEV4cEdvbG9tYlNpZ25lZCgpfWUucmVhZEV4cEdvbG9tYlVuc2lnbmVkKCksZS5za2lwKDEpLGUucmVhZEV4cEdvbG9tYlVuc2lnbmVkKCksZS5yZWFkRXhwR29sb21iVW5zaWduZWQoKSxlLnJlYWRCaXRzKDEpPT09MCYmZS5za2lwKDEpLGUuc2tpcCgxKSxlLnJlYWRCaXRzKDEpJiYoZS5yZWFkRXhwR29sb21iVW5zaWduZWQoKSxlLnJlYWRFeHBHb2xvbWJVbnNpZ25lZCgpLGUucmVhZEV4cEdvbG9tYlVuc2lnbmVkKCksZS5yZWFkRXhwR29sb21iVW5zaWduZWQoKSk7bGV0IGQ7aWYoZS5yZWFkQml0cygxKSl7bGV0IGY9ZnVuY3Rpb24oYyl7Y29uc3QgcD1jLnJlYWRFeHBHb2xvbWJVbnNpZ25lZCgpO2Muc2tpcCg0KSxjLnNraXAoNCk7Zm9yKGxldCB4PTA7eDw9cDt4KyspYy5yZWFkRXhwR29sb21iVW5zaWduZWQoKSxjLnJlYWRFeHBHb2xvbWJVbnNpZ25lZCgpLGMuc2tpcCgxKTtjLnNraXAoNSk7Y29uc3QgXz1jLnJlYWRCaXRzKDUpLGc9Yy5yZWFkQml0cyg1KSxBPWMucmVhZEJpdHMoNSk7cmV0dXJue2NwYl9yZW1vdmFsX2RlbGF5X2xlbmd0aF9taW51czE6XyxkcGJfb3V0cHV0X2RlbGF5X2xlbmd0aF9taW51czE6Zyx0aW1lX29mZnNldF9sZW5ndGg6QX19O2UucmVhZEJpdHMoMSkmJmUucmVhZEJpdHMoOCk9PT0yNTUmJihlLnNraXAoMTYpLGUuc2tpcCgxNikpLGUucmVhZEJpdHMoMSkmJmUuc2tpcCgxKSxlLnJlYWRCaXRzKDEpJiYoZS5za2lwKDMpLGUuc2tpcCgxKSxlLnJlYWRCaXRzKDEpJiZlLnNraXAoMjQpKSxlLnJlYWRCaXRzKDEpJiYoZS5yZWFkRXhwR29sb21iVW5zaWduZWQoKSxlLnJlYWRFeHBHb2xvbWJVbnNpZ25lZCgpKTtjb25zdCBsPWUucmVhZEJpdHMoMSk/e251bV91bml0c19pbl90aWNrOmUucmVhZEJpdHMoMzIpLHRpbWVfc2NhbGU6ZS5yZWFkQml0cygzMiksZml4ZWRfZnJhbWVfcmF0ZV9mbGFnOmUucmVhZEJpdHMoMSl9OnZvaWQgMCxpPWUucmVhZEJpdHMoMSk/ZihlKTp2b2lkIDAsdT1lLnJlYWRCaXRzKDEpP2YoZSk6dm9pZCAwOyhpfHx1KSYmZS5za2lwKDEpO2NvbnN0IGg9ZS5yZWFkQml0cygxKTtkPXt0aW1pbmdfaW5mbzpsLG5hbF9ocmRfcGFyYW1ldGVyczppLHZjbF9ocmRfcGFyYW1ldGVyczp1LHBpY19zdHJ1Y3RfcHJlc2VudF9mbGFnOmh9fXRoaXMuc3BzLnNldChvLHt2dWlfcGFyYW1ldGVyczpkfSl9Y29sbGVjdEgyNjVTUFModCl7fWNvbGxlY3RIMjY0UFBTKHQpe2NvbnN0IGU9bmV3IHcodCkscz1lLnJlYWRFeHBHb2xvbWJVbnNpZ25lZCgpO2lmKHM+MjU1fHxzPDApdGhyb3cgbmV3IEVycm9yKCJJbnZhbGlkIHBpY19wYXJhbWV0ZXJfc2V0X2lkIik7Y29uc3Qgcj1lLnJlYWRFeHBHb2xvbWJVbnNpZ25lZCgpO3RoaXMucHBzLnNldChzLHtzZXFfcGFyYW1ldGVyX3NldF9pZDpyfSl9Y29sbGVjdEgyNjVQUFModCl7fWZpbmRBY3RpdmVTUFModCl7Y29uc3QgZT1uZXcgdyh0KTtlLnJlYWRFeHBHb2xvbWJVbnNpZ25lZCgpLGUucmVhZEV4cEdvbG9tYlVuc2lnbmVkKCk7Y29uc3Qgcz1lLnJlYWRFeHBHb2xvbWJVbnNpZ25lZCgpLHI9dGhpcy5wcHMuZ2V0KHMpO2lmKHIpe2NvbnN0IG89dGhpcy5zcHMuZ2V0KHIuc2VxX3BhcmFtZXRlcl9zZXRfaWQpO2lmKG8pe3RoaXMuYWN0aXZlU1BTPW87cmV0dXJufX10aHJvdyBuZXcgRXJyb3IoIkNhbm5vdCBmaW5kIHRoZSBhY3RpdmUgU1BTIil9fWNvbnN0IFM9bmV3IFY7ZnVuY3Rpb24gRyhuLHQpe2Zvcig7dDxuLmJ5dGVMZW5ndGgtNDspe2lmKG5bdF09PT0wJiZuW3QrMV09PT0wJiYoblt0KzJdPT09MXx8blt0KzJdPT09MCYmblt0KzNdPT09MSkpcmV0dXJuIHQ7dCs9MX1yZXR1cm4tMX1mdW5jdGlvbiBVKG4pe2NvbnN0IHQ9bmV3IFVpbnQ4QXJyYXkobi5ieXRlTGVuZ3RoKTtsZXQgZT0wLHM9MDtmb3IobGV0IHI9MjtyPG4uYnl0ZUxlbmd0aDtyKyspbltyXT09PTMmJm5bci0xXT09PTAmJm5bci0yXT09PTAmJih0LnNldChuLnN1YmFycmF5KHMsciksZSksZSs9ci1zLHM9cisxKTtyZXR1cm4gczxuLmJ5dGVMZW5ndGgmJnQuc2V0KG4uc3ViYXJyYXkocyksZSksdH1mdW5jdGlvbiBZKG4sdCl7bGV0IGU9MDtjb25zdCBzPXQ9PT0iSDI2NCI/MToyLHI9W107Zm9yKDtlPG4uYnl0ZUxlbmd0aC00Oyl7Y29uc3Qgbz1HKG4sZSk7aWYobz49ZSl7Y29uc3QgYT1uW28rMl09PT0xPzM6NCxkPUcobixvK2Ercyk7aWYoZD5vKXIucHVzaChuLnN1YmFycmF5KG8sZCkpLGU9ZDtlbHNle3IucHVzaChuLnN1YmFycmF5KG8pKTticmVha319ZWxzZSBicmVha31yZXR1cm4gcn1mdW5jdGlvbiBYKG4sdCl7bGV0IGU9ITA7cmV0dXJuIFkobix0KS5maWx0ZXIocz0+e2NvbnN0IHI9c1syXT09PTE/Mzo0LG89dD09PSJIMjY0Ij8xOjIsYT1zW3JdLGQ9dD09PSJIMjY0Ij9hJjMxOmE+PjEmNjM7aWYoZSlzd2l0Y2goZCl7Y2FzZSBtLlBQU19IMjY0OmNhc2UgbS5QUFNfSDI2NTpTLmNvbGxlY3RQUFMoVShzLnN1YmFycmF5KHIrbykpKTticmVhaztjYXNlIG0uU1BTX0gyNjQ6Y2FzZSBtLlNQU19IMjY1OlMuY29sbGVjdFNQUyhVKHMuc3ViYXJyYXkocitvKSkpO2JyZWFrO2Nhc2UgbS5TTElDRV9JRFI6Y2FzZSBtLlNMSUNFX05PTl9JRFI6Y2FzZSBtLlNMSUNFX1BBUlRJVElPTl9BOnRyeXtTLmZpbmRBY3RpdmVTUFMoVShzLnN1YmFycmF5KHIrbykpKSxlPSExfWNhdGNoKGwpe2NvbnNvbGUuaW5mbygiRmFpbGVkIHRvIGZpbmQgYWN0aXZlIFNQUy4gV2lsbCBub3QgYmUgYWJsZSB0byBleHRyYWN0IFBJQyB0aW1pbmcgbWV0YWRhdGEiKX1icmVha31yZXR1cm5bbS5TRUlfSDI2NCxtLlNFSV9IMjY1X1BSRUZJWCxtLlNFSV9IMjY1X1NVRkZJWF0uaW5jbHVkZXMoZCl9KX1mdW5jdGlvbiAkKG4pe2xldCB0PTAsZT0wO2Zvcig7bltlXT09PTI1NTspdCs9MjU1LGUrKzt0Kz1uW2VdLGUrKztsZXQgcz0wO2Zvcig7bltlXT09PTI1NTspcys9MjU1LGUrKztyZXR1cm4gcys9bltlXSxlKysse3R5cGU6dCxjb250ZW50Om4uc3ViYXJyYXkoZSxlK3MpfX1mdW5jdGlvbiBKKG4pe2NvbnN0IHQ9bmV3IFVpbnQ4QXJyYXkoVChxKSksZT1uZXcgVWludDhBcnJheShUKGopKSxzPW5ldyBVaW50OEFycmF5KFQoTCkpO3JldHVybiB0LmV2ZXJ5KChyLG8pPT5yPT09bltvXSk/RS5USU1FQ09ERTplLmV2ZXJ5KChyLG8pPT5yPT09bltvXSk/RS5MRUdBQ1k6cy5ldmVyeSgocixvKT0+cj09PW5bb10pP0UuTkVXOkUuT1RIRVJ9ZnVuY3Rpb24gSyhuLHQpe2xldCBlPTA7bi51dWlkPXQuc3ViYXJyYXkoZSxlKzE2KSxlKz0xNjtjb25zdCBzPUoobi51dWlkKSxyPXQuc3ViYXJyYXkoZSk7c3dpdGNoKHMpe2Nhc2UgRS5MRUdBQ1k6Y2FzZSBFLk9USEVSOm4udW5yZWdpc3RlcmVkPXI7YnJlYWs7Y2FzZSBFLlRJTUVDT0RFOm4udGltZWNvZGU9TyhyKTticmVhaztjYXNlIEUuTkVXOntsZXQgbz0wO2NvbnN0IGE9QyhEYXRlLm5vdygpKS5sZW5ndGgsZD1yLnN1YmFycmF5KG8sYSk7bys9YTtjb25zdCBsPXIuc3ViYXJyYXkobyk7bi50aW1lY29kZT1PKGQpLG4udW5yZWdpc3RlcmVkPWw7YnJlYWt9fX1mdW5jdGlvbiBPKG4pe2NvbnN0IHQ9bi5yZWR1Y2UoKG8sYSk9PihvPDxCaWdJbnQoOCkpK0JpZ0ludChhKSxCaWdJbnQoMCkpLGU9TnVtYmVyKHQpLHM9bmV3IERhdGUoZSk7cmV0dXJuIG5ldyBUZXh0RW5jb2RlcigpLmVuY29kZShzLnRvSVNPU3RyaW5nKCkpfWZ1bmN0aW9uIFoobix0KXt2YXIgZixpLHUsaCxjO2lmKCFTLmFjdGl2ZVNQUyl7Y29uc29sZS53YXJuKCJDYW5ub3QgZmluZCB0aGUgYWN0aXZlIFNQUyIpO3JldHVybn1jb25zdCBlPShmPVMuYWN0aXZlU1BTLnZ1aV9wYXJhbWV0ZXJzLm5hbF9ocmRfcGFyYW1ldGVycykhPW51bGw/ZjpTLmFjdGl2ZVNQUy52dWlfcGFyYW1ldGVycy52Y2xfaHJkX3BhcmFtZXRlcnMscz17Y3BiX2RwYl9kZWxheXNfcHJlc2VudF9mbGFnOmU/MTowLGNwYl9yZW1vdmFsX2RlbGF5X2xlbmd0aF9taW51czE6KGk9ZT09bnVsbD92b2lkIDA6ZS5jcGJfcmVtb3ZhbF9kZWxheV9sZW5ndGhfbWludXMxKSE9bnVsbD9pOjIzLGRwYl9vdXRwdXRfZGVsYXlfbGVuZ3RoX21pbnVzMToodT1lPT1udWxsP3ZvaWQgMDplLmRwYl9vdXRwdXRfZGVsYXlfbGVuZ3RoX21pbnVzMSkhPW51bGw/dToyMyx0aW1lX29mZnNldF9sZW5ndGg6ZT8oaD1lLnRpbWVfb2Zmc2V0X2xlbmd0aCkhPW51bGw/aDoyNDp2b2lkIDAscGljX3N0cnVjdF9wcmVzZW50X2ZsYWc6KGM9Uy5hY3RpdmVTUFMudnVpX3BhcmFtZXRlcnMucGljX3N0cnVjdF9wcmVzZW50X2ZsYWcpIT1udWxsP2M6MH07aWYoIXMucGljX3N0cnVjdF9wcmVzZW50X2ZsYWcpe2NvbnNvbGUud2FybigicGljX3N0cnVjdF9wcmVzZW50X2ZsYWcgaXMgbm90IHByZXNlbnQiKTtyZXR1cm59Y29uc3Qgcj1uZXcgdyh0KTtzLmNwYl9kcGJfZGVsYXlzX3ByZXNlbnRfZmxhZyYmKHIuc2tpcChzLmNwYl9yZW1vdmFsX2RlbGF5X2xlbmd0aF9taW51czErMSksci5za2lwKHMuZHBiX291dHB1dF9kZWxheV9sZW5ndGhfbWludXMxKzEpKTtjb25zdCBvPVsxLDEsMSwyLDIsMywzLDIsM10sYT1yLnJlYWRCaXRzKDQpO2lmKGE+PW8ubGVuZ3RoKXRocm93IG5ldyBFcnJvcigiSW52YWxpZCBwaWNfc3RydWN0Iik7Y29uc3QgZD1vW2FdLGw9W107Zm9yKGxldCBwPTA7cDxkO3ArKylpZihyLnJlYWRCaXRzKDEpKXtjb25zdCBnPXt9O3Iuc2tpcCgyKSxyLnNraXAoMSksci5za2lwKDUpO2NvbnN0IEE9ci5yZWFkQml0cygxKTtpZihyLnNraXAoMiksZy5uX2ZyYW1lcz1yLnJlYWRCaXRzKDgpLEE/KGcuc2Vjb25kc192YWx1ZT1yLnJlYWRCaXRzKDYpLGcubWludXRlc192YWx1ZT1yLnJlYWRCaXRzKDYpLGcuaG91cnNfdmFsdWU9ci5yZWFkQml0cyg1KSk6ci5yZWFkQml0cygxKSYmKGcuc2Vjb25kc192YWx1ZT1yLnJlYWRCaXRzKDYpLHIucmVhZEJpdHMoMSkmJihnLm1pbnV0ZXNfdmFsdWU9ci5yZWFkQml0cyg2KSxyLnJlYWRCaXRzKDEpJiYoZy5ob3Vyc192YWx1ZT1yLnJlYWRCaXRzKDUpKSkpLHMudGltZV9vZmZzZXRfbGVuZ3RoKXRyeXtnLnRpbWVfb2Zmc2V0PXIucmVhZEJpdHMocy50aW1lX29mZnNldF9sZW5ndGgpfWNhdGNoKHgpe2NvbnNvbGUuZXJyb3IoIkZhaWxlZCB0byByZWFkIHRpbWVfb2Zmc2V0Iix4KSxnLnRpbWVfb2Zmc2V0PTB9ZWxzZSBnLnRpbWVfb2Zmc2V0PTA7bC5wdXNoKGcpfW4uc2VpUGljVGltaW5nVGltZUNvZGVBcnJheT1sfWZ1bmN0aW9uIFEobix0KXtpZih0IT09IkgyNjQiJiZ0IT09IkgyNjUiKXRocm93IG5ldyBFcnJvcigiVW5zdXBwb3J0ZWQgY29kZWMgIi5jb25jYXQodCkpO2NvbnN0IGU9e307cmV0dXJuIFMuY29kZWM9dCxYKG5ldyBVaW50OEFycmF5KG4uZGF0YSksdCkuZm9yRWFjaChzPT57Y29uc3Qgcj1zWzJdPT09MT8zOjQsbz10PT09IkgyNjQiPzE6MixhPVUocy5zdWJhcnJheShyK28pKSxkPSQoYSk7c3dpdGNoKGQudHlwZSl7Y2FzZSBSLlBJQ19USU1JTkc6WihlLGQuY29udGVudCk7YnJlYWs7Y2FzZSBSLlVTRVJfREFUQV9VTlJFR0lTVEVSRUQ6SyhlLGQuY29udGVudCk7YnJlYWt9fSksZX1mdW5jdGlvbiBlZShuKXtyZXR1cm4vXlswLTlhLWZBLUZdezh9LVswLTlhLWZBLUZdezR9LVswLTlhLWZBLUZdezR9LVswLTlhLWZBLUZdezR9LVswLTlhLWZBLUZdezEyfSQvLnRlc3Qobil9ZnVuY3Rpb24gVChuKXtyZXR1cm4gbi5yZXBsYWNlKC8tL2csIiIpLm1hdGNoKC8uezEsMn0vZykubWFwKHQ9PnBhcnNlSW50KHQsMTYpKX1mdW5jdGlvbiB0ZShuLHQsZSl7Y29uc3Qgcz1uZXcgVWludDhBcnJheShUKG4pKSxyPUMoZSksbz1uZXcgVGV4dEVuY29kZXIoKS5lbmNvZGUoSlNPTi5zdHJpbmdpZnkodCkpLGE9bmV3IFVpbnQ4QXJyYXkocy5sZW5ndGgrci5sZW5ndGgrby5sZW5ndGgpO3JldHVybiBhLnNldChzKSxhLnNldChyLHMubGVuZ3RoKSxhLnNldChvLHIubGVuZ3RoK3MubGVuZ3RoKSxhfWZ1bmN0aW9uIG5lKG4pe2NvbnN0IHQ9W10sZT1NYXRoLmZsb29yKG4uYnl0ZUxlbmd0aC8yNTUpLHM9bi5ieXRlTGVuZ3RoJTI1NTtmb3IobGV0IHI9MDtyPGU7cisrKXQucHVzaCgyNTUpO3JldHVybiB0LnB1c2gocyksbmV3IFVpbnQ4QXJyYXkoWzUsLi4udF0pfWZ1bmN0aW9uIHJlKG4pe2NvbnN0IHQ9W107Zm9yKGxldCBlPTA7ZTxuLmJ5dGVMZW5ndGg7ZSsrKWUrMjxuLmJ5dGVMZW5ndGgmJlswLDEsMiwzXS5pbmNsdWRlcyhuW2UrMl0pJiZuW2VdPT09MCYmbltlKzFdPT09MD8odC5wdXNoKG5bZV0pLHQucHVzaChuW2UrMV0pLGUrPTIsdC5wdXNoKDMpKTp0LnB1c2gobltlXSk7cmV0dXJuIHQucHVzaCgxMjgpLG5ldyBVaW50OEFycmF5KHQpfWZ1bmN0aW9uIEMobil7Y29uc3QgdD1bXTtpZighaXNOYU4obikpe2NvbnN0IGU9QmlnSW50KG4pO2ZvcihsZXQgcz0wO3M8TWF0aC5jZWlsKE1hdGguZmxvb3IoTWF0aC5sb2cyKG5ldyBOdW1iZXIobikpKzEpLzgpO3MrKyl0LnVuc2hpZnQobmV3IE51bWJlcihlPj5CaWdJbnQoOCpzKSZCaWdJbnQoMjU1KSkpfXJldHVybiBuZXcgVWludDhBcnJheSh0KX1mdW5jdGlvbiBzZSh7dXVpZDpuLHBheWxvYWQ6dCx0aW1lY29kZTplfSl7Y29uc3Qgcz1bMCwwLDAsMV0scj1bMTAyXSxvPXRlKG4sdCxlKSxhPW5lKG8pLGQ9cmUobyksbD1uZXcgVWludDhBcnJheShzLmxlbmd0aCtyLmxlbmd0aCthLmxlbmd0aCtkLmxlbmd0aCk7cmV0dXJuIGwuc2V0KHMpLGwuc2V0KHIscy5sZW5ndGgpLGwuc2V0KGEscy5sZW5ndGgrci5sZW5ndGgpLGwuc2V0KGQscy5sZW5ndGgrci5sZW5ndGgrYS5sZW5ndGgpLGx9ZnVuY3Rpb24gaWUoe3V1aWQ6bixwYXlsb2FkOnQsdGltZWNvZGU6ZX0scyl7aWYobj09PSIifHx0PT09IiIpdGhyb3cgbmV3IEVycm9yKCJ1dWlkIGFuZCBwYXlsb2FkIGNhbm5vdCBiZSBlbXB0eSIpO2VlKG4pfHwoY29uc29sZS53YXJuKCJJbnZhbGlkIFVVSUQuIFVzaW5nIGRlZmF1bHQgVVVJRC4iKSxuPUwsZT1EYXRlLm5vdygpKTtjb25zdCByPXNlKHt1dWlkOm4scGF5bG9hZDp0LHRpbWVjb2RlOmV9KSxvPW5ldyBEYXRhVmlldyhzLmRhdGEpLGE9bmV3IEFycmF5QnVmZmVyKHMuZGF0YS5ieXRlTGVuZ3RoK3IuYnl0ZUxlbmd0aCksZD1uZXcgRGF0YVZpZXcoYSk7Zm9yKGxldCBsPTA7bDxzLmRhdGEuYnl0ZUxlbmd0aDtsKyspZC5zZXRVaW50OChsLG8uZ2V0VWludDgobCkpO2ZvcihsZXQgbD0wO2w8ci5ieXRlTGVuZ3RoO2wrKylkLnNldFVpbnQ4KHMuZGF0YS5ieXRlTGVuZ3RoK2wscltsXSk7cy5kYXRhPWF9RC5nZXQoIlRyYW5zZm9ybVdvcmtlciIpLnNldExldmVsKEQuREVCVUcpO2NvbnN0IG9lPTJlMyxiPVtdO2xldCB5PSIiLFA9e307Y29uc3Qgdj17fTtsZXQgST1bXTtmdW5jdGlvbiBIKG4pe3JldHVybiBuZXcgVHJhbnNmb3JtU3RyZWFtKHtzdGFydCgpe30sZmx1c2goKXt9LGFzeW5jIHRyYW5zZm9ybSh0LGUpe3ZhciBzLHI7aWYodCBpbnN0YW5jZW9mIFJUQ0VuY29kZWRWaWRlb0ZyYW1lKXtjb25zdCBvPSgocz1QW3QuZ2V0TWV0YWRhdGEoKS5wYXlsb2FkVHlwZV0pPT1udWxsP3ZvaWQgMDpzLnRvVXBwZXJDYXNlKCkpfHwoeT09bnVsbD92b2lkIDA6eS50b1VwcGVyQ2FzZSgpKTtpZihvPT09IkgyNjQiKXtjb25zdCBhPVEodCxvKTsoYS50aW1lY29kZXx8YS51bnJlZ2lzdGVyZWR8fCgocj1hLnNlaVBpY1RpbWluZ1RpbWVDb2RlQXJyYXkpPT1udWxsP3ZvaWQgMDpyLmxlbmd0aCk+MCkmJnNlbGYucG9zdE1lc3NhZ2Uoe2V2ZW50OiJtZXRhZGF0YSIsbWlkOm4sbWV0YWRhdGE6YX0pfXNlbGYucG9zdE1lc3NhZ2Uoe2V2ZW50OiJjb21wbGV0ZSIsZnJhbWU6e3R5cGU6dC50eXBlLHRpbWVzdGFtcDp0LnRpbWVzdGFtcCxkYXRhOnQuZGF0YX19KX1lLmVucXVldWUodCl9fSl9ZnVuY3Rpb24gTSgpe09iamVjdC5rZXlzKHYpLnNvcnQoKS5qb2luKCk9PT1JLnNvcnQoKS5qb2luKCkmJihiLnNoaWZ0KCksST1bXSl9ZnVuY3Rpb24gYWUobil7Y29uc3QgdD1uZXcgRGF0ZSgpLmdldFRpbWUoKTt2W25dPXQsT2JqZWN0LmtleXModikuZmlsdGVyKHM9PnQtdltzXT5vZSkuZm9yRWFjaChzPT57ZGVsZXRlIHZbc10sZGVsZXRlIElbc119KSxNKCl9ZnVuY3Rpb24gTigpe3JldHVybiBuZXcgVHJhbnNmb3JtU3RyZWFtKHtzdGFydCgpe30sZmx1c2goKXt9LGFzeW5jIHRyYW5zZm9ybShuLHQpe2lmKG4gaW5zdGFuY2VvZiBSVENFbmNvZGVkVmlkZW9GcmFtZSl7Y29uc3Qgcz1uLmdldE1ldGFkYXRhKCkuc3luY2hyb25pemF0aW9uU291cmNlO2lmKGFlKHMpLCFJLmluY2x1ZGVzKHMpJiZiLmxlbmd0aCl0cnl7aWYoIS8oaDI2WzRdKS8udGVzdCh5KSl0aHJvdyBuZXcgRXJyb3IoIlNlbmRpbmcgbWV0YWRhdGEgaXMgbm90IHN1cHBvcnRlZCB3aXRoIGFueSBvdGhlciBjb2RlYyBvdGhlciB0aGFuIEguMjY0Iik7YlswXS51dWlkPT09TCYmKGJbMF0udGltZWNvZGU9RGF0ZS5ub3coKSksaWUoYlswXSxuKSxJLnB1c2gocyl9Y2F0Y2gocil7Y29uc29sZS5lcnJvcihyKX1maW5hbGx5e00oKX19dC5lbnF1ZXVlKG4pfX0pfWZ1bmN0aW9uIGsoe3JlYWRhYmxlOm4sd3JpdGFibGU6dH0sZSl7bi5waXBlVGhyb3VnaChlKS5waXBlVG8odCl9YWRkRXZlbnRMaXN0ZW5lcigicnRjdHJhbnNmb3JtIixuPT57bGV0IHQ7aWYobi50cmFuc2Zvcm1lci5vcHRpb25zLm5hbWU9PT0ic2VuZGVyVHJhbnNmb3JtIil5PW4udHJhbnNmb3JtZXIub3B0aW9ucy5jb2RlYyx0PU4oKTtlbHNlIGlmKG4udHJhbnNmb3JtZXIub3B0aW9ucy5uYW1lPT09InJlY2VpdmVyVHJhbnNmb3JtIilQPW4udHJhbnNmb3JtZXIub3B0aW9ucy5wYXlsb2FkVHlwZUNvZGVjfHx7fSx5PW4udHJhbnNmb3JtZXIub3B0aW9ucy5jb2RlY3x8IiIsdD1IKG4udHJhbnNmb3JtZXIub3B0aW9ucy5taWQpO2Vsc2UgcmV0dXJuO2sobi50cmFuc2Zvcm1lcix0KX0pLGFkZEV2ZW50TGlzdGVuZXIoIm1lc3NhZ2UiLG49Pntjb25zdHthY3Rpb246dH09bi5kYXRhO3N3aXRjaCh0KXtjYXNlImluc2VydGFibGUtc3RyZWFtcy1zZW5kZXIiOnk9bi5kYXRhLmNvZGVjLGsobi5kYXRhLE4oKSk7YnJlYWs7Y2FzZSJpbnNlcnRhYmxlLXN0cmVhbXMtcmVjZWl2ZXIiOlA9bi5kYXRhLnBheWxvYWRUeXBlQ29kZWN8fHt9LHk9bi5kYXRhLmNvZGVjfHwiIixrKG4uZGF0YSxIKG4uZGF0YS5taWQpKTticmVhaztjYXNlIm1ldGFkYXRhLXNlaS11c2VyLWRhdGEtdW5yZWdpc3RlcmVkIjpiLnB1c2goe3V1aWQ6bi5kYXRhLnV1aWQscGF5bG9hZDpuLmRhdGEucGF5bG9hZH0pO2JyZWFrfX0pfSkoKTsK",hs=typeof self<"u"&&self.Blob&&new Blob([(e=>Uint8Array.from(atob(e),e=>e.charCodeAt(0)))(ds)],{type:"text/javascript;charset=utf-8"});function fs(e){let t;try{if(t=hs&&(self.URL||self.webkitURL).createObjectURL(hs),!t)throw"";const r=new Worker(t,{name:null==e?void 0:e.name});return r.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),r}catch(t){return new Worker("data:text/javascript;base64,"+ds,{name:null==e?void 0:e.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}function ms(e){if(!e)return new Uint8Array;const t=e.length,r=new Uint8Array(t/2);for(let n=0;n<t;n+=2)r[n/2]=parseInt(e.substr(n,2),16);return r}function gs(e,t,r){if(Object.prototype.hasOwnProperty.call(e,r)&&Object.prototype.hasOwnProperty.call(t,r)){const n=e[r];e[r]=t[r],t[r]=n}else console.error('One or both objects do not have the property "'.concat(r,'"'))}function ys(e,t,r,n){return new(r||(r=Promise))((function(s,i){function o(e){try{c(n.next(e))}catch(e){i(e)}}function a(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))}_e.get("Publish");const bs=vs;function vs(e,t){const r=Ts();return(vs=function(e,t){return r[e-=257]})(e,t)}var ws;!function(){const e=vs,t=Ts();for(;;)try{if(parseInt(e(266))/1*(-parseInt(e(261))/2)+parseInt(e(258))/3*(-parseInt(e(264))/4)+-parseInt(e(267))/5*(parseInt(e(274))/6)+parseInt(e(260))/7*(parseInt(e(268))/8)+parseInt(e(270))/9+-parseInt(e(277))/10+parseInt(e(263))/11==303379)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();const Ss=navigator&&navigator[bs(276)]||"",Rs=navigator&&navigator.vendor||"",xs=!(null==window||!window[bs(273)]),ks=Ss[bs(278)](bs(257)),_s=!ks&&Rs[bs(278)](bs(259)),Cs=!ks&&!_s&&Ss.includes(bs(272)),Is=!ks&&!_s&&!Cs&&Ss[bs(278)](bs(275)),Es=(null===(ws=null==navigator?void 0:navigator[bs(262)])||void 0===ws?void 0:ws[bs(271)])||(null==navigator?void 0:navigator[bs(271)])||"";function Ts(){const e=["2403660vsbxKa","includes","Firefox","653511krAkNS","Apple","63eEorAu","2iQvmqu","userAgentData","13393182jRLBxS","4fTXBZP","Win32","74923SyWRbn","1345hVdNEb","21688LwGppn","Windows","132498ZoOcLo","platform","Edg","RTCRtpScriptTransform","9372dNMWWf","Chrome","userAgent"];return(Ts=function(){return e})()}const Ls={supportsRtpScriptTransform:xs,isFirefox:ks,isSafari:_s,isEdge:Cs,isChrome:Is,platform:Es,isWindows:Es===bs(269)||Es===bs(265)},As=Ms;function Ms(e,t){const r=Ds();return(Ms=function(e,t){return r[e-=185]})(e,t)}!function(){const e=Ms,t=Ds();for(;;)try{if(-parseInt(e(380))/1+-parseInt(e(354))/2+-parseInt(e(464))/3*(parseInt(e(486))/4)+-parseInt(e(253))/5+parseInt(e(377))/6+parseInt(e(321))/7*(-parseInt(e(285))/8)+-parseInt(e(444))/9*(-parseInt(e(279))/10)==657542)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();const Ps=Ls[As(496)];function Os(e,t){const r=As;let n=new Uint8Array((0|e.byteLength)+(0|t[r(442)]));return n[r(311)](e,0),n[r(311)](t,0|e.byteLength),n}function Ds(){const e=["[MSE] source buffer error","ManagedMediaSource","BYTES_PER_ELEMENT","types","ready","valid","Num frames in chunk: ","readBits","getTrackID","mvhd","parsePPS","encrypted","dependsOn","payload","len","moov","VMHD","mse","volume","h264","setUint16","tfdt","nextDts","avc1.","audioSampleAuxInfo","message","endMSE","width","hdlr","warn","traf","readBoolean","shift","mseReady","revokeObjectURL","smhd","dts","indexOf","<PROTECTINFO>","webkitsourceclose","onMSEClose","[H264Parser] IDR without SPS/PPS, not suitable for recovery",'VALUE="',"createObjectURL","</KID>","mdhd","SMHD","getFramePayload","tkhd","flush","clRtcDrmDebugLog","getBits","2598770DahMdb","dbgQueue","dispatch","DINF","http://schemas.microsoft.com/DRM/2007/03/PlayReadyHeader","isReady","sps","nalus","endOfStream","toString","UNKNOWN","Opus","minf","onError","stco","STSC","buffered","</KIDS>","initSegment","dinf","org.w3.clearkey","mp4track","keyFrame","units","mseEnded","videoSampleAuxInfo","41695210Plpuuo","splice","ended","bitLength","seq","url","8YyaFaO","com.apple.fps","[MSE] error: ","bitsAvailable","</WRMHEADER>","trex","setData","buffer error","slice","length","readUByte","mp4a","Unsupported DRM type ","mdia","fromCharCode",'<WRMHEADER xmlns="',"index","string","both","NDR","dOps","cenc","getPayload","bind","PPS","sourceBuffer","set","Checking codec","releaseBuffer","tenc","trak","flags",'/mp4; codecs="',"[H264Parser] Both IDR and non-IDR VCL NALUs found in the same frame","clRtcDrmCreateMediaDump","STSD","6352549TgZLxu","initBrowser","IDR","trun"," - ","start","mediaSource","startsWith","stype","readSPS","addEventListener","schi","encv","createElement","getVideoFrames","onReady","href","sourceopen","setUint32","vmhd","FTYP","schm","getData","toISOString","remuxer","track","skipScalingList","STSZ","getSize","addSourceBuffer","[MSE] buffer error:","appendBufferError","off","2392886zJoPkf","destroy","sdtp","audiosamplerate",": NRI: ","reportDiscontinuity","extractNALUs","No A/V data","pps","senc","saio","concat","config","ftyp","parseNAL","esds","error","feed","Browser does not support codec","4.3.0.0","skipUEG","mp4","end","2232924PKvVOf","updating","options","227868XbMqAn","prototype","createBuffer","info","MediaSource","timestamp","mvex","isfmb","opus","max","stsz","POSITIVE_INFINITY","saiz","timescale","call","encryption","height","jmuxer","bufferControllers","open","patchSampleAuxinfo","queue","stsd","onBufferError","frameCounter","ntype","remux","getPayloadSize","isSupported","</LA_URL>","waitingForIdr","box","idr"," samples - expected 1","tracks","stbl","getNri",'<KID ALGID="AESCTR" ',"download","readUInt","join","com.microsoft.playready.recommendation",'" version="',"remuxController","Received ","frma","resetTrack","disableRemotePlayback","</DATA>","mfhd","pssh","charCodeAt","drm","mediaDuration","video","readyToDecode","from","SPS","skipLZ","data","keySystem","[MSE] sourceclose","byteLength","STTS","9mESMVl","Buffered range ","samples","byteOffset","parseHeader","codec","node","audio","Failure: Browser doesn't support MSE/MMS","subarray","replaceAll","downloadToFile","onBuffer","skipBits","mdat","isKeyframe","moof","mode","push","STCO","9ffcUcC","listener","isReset","map","enca","type","<LA_URL>","parseSPS","getElementById","no video element were found to render, provide a valid video element","sinf","doAppend","HDLR_TYPES","videoElement","stts","keyId","trackTypes","TYPES","remove","size","AUD","src","1376748eVkTXq","min","tfhd","initialized","offAll","appendBuffer","buffer","nri","skipEG","isvcl","isSafari","isTypeSupported","readyState","abort","apply","reduce","assign","calculateExpectedSizeFromSai","duration","generatePlayReadyHeader","readUEG","onMSEOpen","sampleAuxInfo","SEI","irrecoverableError","channelCount","saiIvSize","stsc"];return(Ds=function(){return e})()}function Fs(e,t=0,r=1/0){return((e,t,r,n)=>{const s=As,i=n[s(203)]||1;t*=i,r*=i;const o=(l=e)instanceof ArrayBuffer?l:l[As(492)],a=(e[s(447)]||0)+e[s(442)],c=(e[s(447)]||0)+t;var l;let u=Math[s(389)](0,Math[s(487)](c,a)),d=Math[s(487)](u+Math[s(389)](r,0),a);return u/=i,d/=i,new n(o,u,d-u)})(e,t,r,Uint8Array)}function js(e){const t=As,r=Array[t(436)](e)[t(467)](e=>e[t(431)](0));return new Uint8Array(r)}window[As(455)]=(e,t,r="application/octet-stream")=>{const n=As,s=document[n(334)]("a"),i=new Blob([e],{type:r});s[n(337)]=URL[n(244)](i),s[n(418)]=t,s.click(),URL[n(235)](s[n(337)])};class ce{static get[As(304)](){return 1}static get[As(323)](){return 5}static get[As(196)](){return 6}static get SPS(){return 7}static get PPS(){return 8}static get[As(484)](){return 9}static get[As(481)](){const e=As;return{[ce[e(323)]]:e(323),[ce.SEI]:e(196),[ce.SPS]:e(437),[ce[e(309)]]:e(309),[ce[e(304)]]:e(304),[ce[e(484)]]:e(484)}}static type(e){const t=As;return e[t(405)]in ce[t(481)]?ce[t(481)][e[t(405)]]:t(263)}constructor(e){const t=As;this.payload=e,this[t(493)]=(96&this.payload[0])>>5,this[t(405)]=31&this[t(214)][0],this[t(495)]=1==this.ntype||5==this[t(405)],this[t(329)]="",this[t(387)]=!1}toString(){const e=As;return ce[e(469)](this)+e(358)+this[e(416)]()}getNri(){return this[As(493)]}[As(469)](){return this[As(405)]}[As(459)](){const e=As;return this[e(405)]===ce[e(323)]}[As(307)](){return this[As(214)]}[As(407)](){const e=As;return this[e(214)][e(442)]}getSize(){return 4+this[As(407)]()}[As(343)](){const e=As,t=new Uint8Array(this.getSize());return new DataView(t.buffer)[e(339)](0,this.getSize()-4),t[e(311)](this[e(307)](),4),t}}class ps{constructor(e){const t=As;this[t(439)]=e,this[t(301)]=0,this.bitLength=8*e[t(442)]}[As(291)](e){const t=As;this.data=e,this[t(301)]=0,this[t(282)]=8*e[t(442)]}get[As(288)](){const e=As;return this[e(282)]-this[e(301)]}skipBits(e){if(this[As(288)]<e)return!1;this.index+=e}[As(208)](e,t=!0){return this.getBits(e,this.index,t)}[As(252)](e,t,r=!0){const n=As;if(this.bitsAvailable<e)return 0;const s=t%8,i=this[n(439)][t/8|0]&255>>>s,o=8-s;if(o>=e)return r&&(this.index+=e),i>>o-e;{r&&(this.index+=o);const s=e-o;return i<<s|this[n(252)](s,t+o,r)}}[As(438)](){const e=As;let t;for(t=0;t<this.bitLength-this[e(301)];++t)if(0!==this.getBits(1,this[e(301)]+t,!1))return this.index+=t,t;return t}[As(374)](){const e=As;this[e(457)](1+this[e(438)]())}[As(494)](){const e=As;this[e(457)](1+this[e(438)]())}readUEG(){const e=As,t=this[e(438)]();return this[e(208)](t+1)-1}readEG(){const e=this[As(193)]();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return 1===this[As(208)](1)}[As(295)](e=1){return this[As(208)](8*e)}readUShort(){return this[As(208)](16)}[As(419)](){return this[As(208)](32)}}class rt{static[As(360)](e,t){const r=As;let n=[],s=!1,i=!1,o=!1,a=!1,c=0,l=0,u=0,d=[];for(;c<=e.byteLength;){if(c<e.byteLength){const t=e[c++];0!==t?(1===t&&l>1&&(u=l>2?4:3,d.push(c)),l=0):++l}else u=0,d.push(c++);if(d.length>1){const r=d.shift(),h=d[0]-u;if(r<h){let u=!1;const d=31&e[r];if(d===ce.NDR?i=!0:d===ce.IDR?s=!0:d===ce.SPS?(u=o,o=!0):d===ce.PPS&&(u=a,a=!0),!u)if(!t||d!==ce.NDR&&d!==ce.IDR)n.push(e.subarray(r,h));else{const t=new Uint8Array(h-r);let s=0;for(c=r,l=0;c<h;){let r=e[c++];l>1&&3===r&&(l=0,r=e[c++]),0!==r?l=0:++l,t[s++]=r}n.push(t.subarray(0,s))}}}}let h=!0,f=!1;return i||s?i&&s&&(console[r(230)](r(318)),h=!1):(console[r(230)]("[H264Parser] No VCL NALUs found"),h=!1),s&&(o&&a?f=!0:console[r(230)](r(242))),{valid:h,idr:f,nalus:n}}static skipScalingList(e,t){let r,n=8,s=8;for(let i=0;i<t;i++)0!==s&&(r=e.readEG(),s=(n+r+256)%256),n=0===s?n:s}static[As(330)](e){const t=As;let r,n,s,i,o,a,c=new ps(e),l=0,u=0,d=0,h=0,f=1;if(c[t(295)](),r=c.readUByte(),c[t(208)](5),c[t(457)](3),c.readUByte(),c[t(374)](),100===r||110===r||122===r||244===r||44===r||83===r||86===r||118===r||128===r){var p=c[t(193)]();if(3===p&&c[t(457)](1),c.skipUEG(),c[t(374)](),c[t(457)](1),c[t(232)]()){a=3!==p?8:12;for(let e=0;e<a;++e)c[t(232)]()&&(e<6?rt[t(347)](c,16):rt[t(347)](c,64))}}c[t(374)]();var m=c.readUEG();if(0===m)c[t(193)]();else if(1===m){c.skipBits(1),c[t(494)](),c[t(494)](),n=c[t(193)]();for(let e=0;e<n;++e)c.skipEG()}if(c.skipUEG(),c[t(457)](1),s=c[t(193)](),i=c.readUEG(),o=c[t(208)](1),0===o&&c[t(457)](1),c[t(457)](1),c[t(232)]()&&(l=c[t(193)](),u=c[t(193)](),d=c[t(193)](),h=c.readUEG()),c.readBoolean()){if(c[t(232)]()){let e;switch(c[t(295)]()){case 1:e=[1,1];break;case 2:e=[12,11];break;case 3:e=[10,11];break;case 4:e=[16,11];break;case 5:e=[40,33];break;case 6:e=[24,11];break;case 7:e=[20,11];break;case 8:e=[32,11];break;case 9:e=[80,33];break;case 10:e=[18,11];break;case 11:e=[15,11];break;case 12:e=[64,33];break;case 13:e=[160,99];break;case 14:e=[4,3];break;case 15:e=[3,2];break;case 16:e=[2,1];break;case 255:e=[c[t(295)]()<<8|c.readUByte(),c[t(295)]()<<8|c[t(295)]()]}e&&e[0]>0&&e[1]>0&&(f=e[0]/e[1])}c.readBoolean()&&c[t(457)](1),c[t(232)]()&&(c.skipBits(4),c[t(232)]()&&c[t(457)](24)),c.readBoolean()&&(c.skipUEG(),c[t(374)]()),c.readBoolean()&&(c[t(419)](),c[t(419)](),c.readBoolean())}return{width:Math.ceil((16*(s+1)-2*l-2*u)*f),height:(2-o)*(i+1)*16-(o?2:4)*(d+h)}}static[As(448)](e){const t=As;let r=new ps(e[t(307)]());r.readUByte(),e.isfmb=0===r[t(193)](),e.stype=r[t(193)]()}constructor(e){const t=As;this.remuxer=e,this[t(346)]=e[t(274)]}[As(471)](e){const t=As;var r=rt[t(330)](new Uint8Array(e));this[t(346)][t(228)]=r[t(228)],this[t(346)][t(396)]=r[t(396)],this[t(346)].sps=[new Uint8Array(e)],this[t(346)][t(449)]=t(224);let n=new DataView(e.buffer,e[t(447)]+1,4);for(let e=0;e<3;++e){var s=n.getUint8(e)[t(262)](16);s.length<2&&(s="0"+s),this.track[t(449)]+=s}}[As(211)](e){this[As(346)].pps=[new Uint8Array(e)]}[As(368)](e){const t=As;if(!e)return!1;let r=!1;switch(e.type()){case ce[t(323)]:case ce[t(304)]:r=!0;break;case ce[t(309)]:!this[t(346)][t(362)]&&(this.parsePPS(e[t(307)]()),!this[t(345)][t(435)]&&this[t(346)][t(362)]&&this[t(346)][t(259)]&&(this[t(345)][t(435)]=!0)),r=!0;break;case ce[t(437)]:!this[t(346)][t(259)]&&(this[t(471)](e[t(307)]()),!this[t(345)][t(435)]&&this[t(346)][t(362)]&&this.track.sps&&(this[t(345)][t(435)]=!0)),r=!0;break;case ce[t(484)]:break;case ce[t(196)]:r=!0}return r}}class _n{constructor(e){const t=As;this[t(465)]={},this[t(469)]=""|e}on(e,t){const r=As;return!this[r(465)][e]&&(this[r(465)][e]=[]),this[r(465)][e][r(462)](t),!0}[As(353)](e,t){const r=As;if(this[r(465)][e]){var n=this.listener[e][r(238)](t);return n>-1&&this[r(465)][e][r(280)](n,1),!0}return!1}[As(490)](){this[As(465)]={}}[As(255)](e,t){const r=As;return!!this.listener[e]&&(this[r(465)][e][r(467)](e=>{e[r(187)](null,[t])}),!0)}}class F{constructor(e){var t,r;const n=As;this[n(432)]=e,this[n(199)]={video:(null==(t=e[n(366)][n(434)])?void 0:t.encryption)===n(306)?16:0,audio:(null==(r=e[n(366)][n(451)])?void 0:r.encryption)===n(306)?16:0},F.types={avc1:[],encv:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],Opus:[],dOps:[],enca:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],pssh:[],sinf:[],frma:[],schm:[],schi:[],tenc:[],saiz:[],saio:[],senc:[]};for(let e in F[n(204)])F[n(204)][e]=[e[n(431)](0),e[n(431)](1),e.charCodeAt(2),e[n(431)](3)];const s=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),i=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);F[n(476)]={video:s,audio:i};const o=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),a=new Uint8Array([0,0,0,0,0,0,0,0]);F[n(443)]=F[n(268)]=F[n(463)]=a,F[n(348)]=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),F[n(217)]=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),F.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),F[n(320)]=new Uint8Array([0,0,0,0,0,0,0,1]);const c=new Uint8Array([105,115,111,109]),l=new Uint8Array([97,118,99,49]),u=new Uint8Array([0,0,0,1]);F[n(341)]=F[n(411)](F[n(204)][n(367)],c,u,c,l),F.DINF=F[n(411)](F[n(204)][n(272)],F[n(411)](F[n(204)].dref,o))}static[As(411)](e,...t){const r=As;let n,s=8,i=t.length,o=i;for(;i--;)t[i]&&(s+=t[i].byteLength);for(n=new Uint8Array(s),n[0]=s>>>24,n[1]=s>>>16&255,n[2]=s>>>8&255,n[3]=255&s,n[r(311)](e,4),i=0,s=8;i<o;++i)t[i]&&(n[r(311)](t[i],s),s+=t[i][r(442)]);return n}hdlr(e){const t=As;return F[t(411)](F[t(204)][t(229)],F[t(476)][e])}mdat(e){const t=As;return F.box(F.types[t(458)],e)}[As(246)](e,t){const r=As;return F.box(F[r(204)][r(246)],new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,e>>>24,e>>>16&255,e>>>8&255,255&e,0,0,0,0,85,196,0,0]))}[As(298)](e){const t=As;return F[t(411)](F[t(204)][t(298)],this[t(246)](e[t(393)],e.duration),this[t(229)](e[t(469)]),this[t(265)](e))}[As(429)](e){const t=As;return F[t(411)](F.types[t(429)],new Uint8Array([0,0,0,0,e>>>24,e>>>16&255,e>>>8&255,255&e]))}[As(265)](e){const t=As;return e[t(469)]===t(451)?F[t(411)](F[t(204)][t(265)],F.box(F[t(204)][t(236)],F[t(247)]),F.DINF,this[t(415)](e)):F[t(411)](F[t(204)][t(265)],F[t(256)],this[t(415)](e),F[t(411)](F[t(204)][t(340)],F[t(217)]))}[As(460)](e,t,r){const n=As;return F[n(411)](F[n(204)][n(460)],this[n(429)](e),this.traf(r,t))}moov(e,t,r){const n=As;let s=e[n(294)],i=[];for(;s--;)i[s]=this[n(315)](e[s]);return F[n(411)][n(187)](null,[F[n(204)].moov,this[n(210)](r,t),this[n(430)](e)].concat(i)[n(365)](this[n(386)](e)))}mvex(e){const t=As;let r=e[t(294)],n=[];for(;r--;)n[r]=this[t(290)](e[r]);return F.box[t(187)](null,[F[t(204)].mvex].concat(n))}[As(210)](e,t){const r=As;let n=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return F[r(411)](F[r(204)].mvhd,n)}[As(356)](e){const t=As;let r=e[t(446)]||[],n=new Uint8Array(4+r.length);for(let e=0;e<r.length;e++){const s=r[e][t(316)];n[e+4]=s[t(213)]<<4|s.isDependedOn<<2|s.hasRedundancy}return F.box(F.types.sdtp,n)}[As(415)](e){const t=As;return F[t(411)](F.types[t(415)],this[t(402)](e),F.box(F.types[t(478)],F[t(443)]),F.box(F.types[t(200)],F[t(268)]),F[t(411)](F[t(204)][t(390)],F[t(348)]),F[t(411)](F[t(204)][t(267)],F[t(463)]))}[As(333)](e){const t=As;let r,n,s,i=[],o=[];for(r=0;r<e[t(259)][t(294)];r++)n=e[t(259)][r],s=n[t(442)],i.push(s>>>8&255),i[t(462)](255&s),i=i[t(365)](Array[t(381)].slice.call(n));for(r=0;r<e.pps.length;r++)n=e.pps[r],s=n[t(442)],o.push(s>>>8&255),o[t(462)](255&s),o=o[t(365)](Array[t(381)][t(293)][t(394)](n));const a=F[t(411)](F[t(204)].avcC,new Uint8Array([1,i[3],i[4],i[5],255,224|e[t(259)][t(294)]][t(365)](i)[t(365)]([e[t(362)].length]).concat(o))),c=e[t(228)],l=e[t(396)],u=F[t(411)](F[t(204)][t(474)],F[t(411)](F.types[t(425)],new Uint8Array([97,118,99,49])),F[t(411)](F[t(204)][t(342)],new Uint8Array([0,0,0,0,...js(this[t(432)][t(366)].video[t(395)]),0,1,0,0])),F[t(411)](F[t(204)].schi,this[t(314)]("video")));return F[t(411)](F[t(204)][t(333)],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,c>>>8&255,255&c,l>>>8&255,255&l,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,65,86,67,32,67,111,100,105,110,103,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]),a,u)}[As(369)](e){const t=As;let r=e.config[t(442)],n=new Uint8Array(26+r+3);return n[t(311)]([0,0,0,0,3,23+r,0,1,0,4,15+r,64,21,0,0,0,0,0,0,0,0,0,0,0,5,r]),n[t(311)](e[t(366)],26),n[t(311)]([6,1,2],26+r),n}[As(296)](e){const t=As,r=e.audiosamplerate;return F[t(411)](F[t(204)][t(296)],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e[t(198)],0,16,0,0,0,0,r>>>8&255,255&r,0,0]),F[t(411)](F[t(204)][t(369)],this.esds(e)))}dOps(e){const t=As,r=e[t(357)];return new Uint8Array([0,e[t(198)],1,56,0,0,r>>>8&255,255&r,0,0,0])}[As(264)](e){const t=As,r=e[t(357)];return F[t(411)](F[t(204)].Opus,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e[t(198)],0,16,0,0,0,0,r>>>8&255,255&r,0,0]),F[t(411)](F.types[t(305)],this[t(305)](e)))}[As(468)](e){const t=As,r=F[t(411)](F[t(204)].dOps,this[t(305)](e)),n=F[t(411)](F[t(204)].sinf,F[t(411)](F[t(204)].frma,new Uint8Array([79,112,117,115])),F[t(411)](F[t(204)][t(342)],new Uint8Array([0,0,0,0,...js(this.drm[t(366)].audio[t(395)]),0,1,0,0])),F[t(411)](F[t(204)][t(332)],this[t(314)](t(451)))),s=e[t(357)];return F[t(411)](F[t(204)][t(468)],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e[t(198)],0,16,0,0,0,0,s>>>8&255,255&s,0,0]),r,n)}[As(402)](e){const t=As;return e[t(469)]===t(451)?F.box(F[t(204)][t(402)],F[t(320)],e[t(212)]?this[t(468)](e):this[t(264)](e)):F.box(F[t(204)][t(402)],F[t(320)],this.encv(e))}[As(249)](e){const t=As,r=e.id,n=e[t(191)],s=e.width,i=e[t(396)],o=e[t(219)];return F[t(411)](F[t(204)][t(249)],new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,r>>>24,r>>>16&255,r>>>8&255,255&r,0,0,0,0,n>>>24,n>>>16&255,n>>>8&255,255&n,0,0,0,0,0,0,0,0,0,0,0,0,255&o,o%1*10&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,s>>>8&255,255&s,0,0,i>>>8&255,255&i,0,0]))}[As(231)](e,t){var r;const n=As,s=e.id,i=e[n(446)][0][n(483)],o=e[n(446)][0][n(191)],a=e[n(446)][0].flags,c=F[n(411)](F[n(204)][n(488)],new Uint8Array([0,2,0,58,s>>>24,s>>>16&255,s>>>8&255,255&s,0,0,0,1,o>>>24,s>>>16&255,o>>>8&255,255&o,i>>>24,i>>>16&255,i>>>8&255,255&i,0,a.isNonSync,0,0])),l=F[n(411)](F[n(204)][n(222)],new Uint8Array([0,0,0,0,t>>>24,t>>>16&255,t>>>8&255,255&t]));if(e[n(212)]){let t,s;if(e[n(469)]===n(434)?(t=!0,s=this[n(199)][n(434)]+(null==(r=e[n(446)][0].sampleAuxInfo)?void 0:r.byteLength)):(t=!1,s=this[n(199)][n(451)]),s>0){const r=this[n(392)](s),i=this[n(363)](e[n(446)],t),o=r.length+20+i.length+c[n(294)]+l[n(294)]+8+16+8+8,a=this[n(324)](e,o);return F[n(411)](F[n(204)][n(231)],c,l,a,r,this[n(364)](o-i[n(294)]+a[n(294)]+8),i)}{const t=this[n(363)](null,!1),r=t[n(294)]+c[n(294)]+l.length+8+16+8+8,s=this[n(324)](e,r);return F[n(411)](F[n(204)][n(231)],c,l,s,t)}}return F.box(F.types.traf,c,l,this[n(324)](e,c[n(294)]+l[n(294)]+8+16+8+8))}[As(315)](e){const t=As;return e[t(191)]=e[t(191)]||4294967295,F.box(F[t(204)][t(315)],this[t(249)](e),this[t(298)](e))}trex(e){const t=As,r=e.id;return F[t(411)](F[t(204)][t(290)],new Uint8Array([0,0,0,0,r>>>24,r>>>16&255,r>>>8&255,255&r,0,0,0,1,0,0,0,16,0,0,0,0,0,0,0,0]))}trun(e,t){const r=As;let n=(e.samples||[]).length,s=new Uint8Array(12);return t+=20,s[r(311)]([0,0,0,1,n>>>24,n>>>16&255,n>>>8&255,255&n,t>>>24,t>>>16&255,t>>>8&255,255&t],0),F.box(F.types[r(324)],s)}[As(192)](e,t){const r=As,n=r(373),s=r(257),i=function(e){const t=function(e){const t=As;let r="";for(let n=0;n<e.length;n+=16e3){const s=e[t(453)](n,n+16e3);r+=String[t(299)][t(187)](null,s)}return r}(Fs(e));return btoa(t)}(function(e){const t=As,r=[];return r[t(462)](e[3]),r[t(462)](e[2]),r[t(462)](e[1]),r[t(462)](e[0]),r.push(e[5]),r.push(e[4]),r.push(e[7]),r.push(e[6]),(e=Fs(e))[t(311)](r,0),e}(e));return Fs(function(e,t){const r=As,n=new Uint8Array(2*e.length),s=new DataView(n[r(492)]);for(let t=0;t<e[r(294)];++t){const n=e[r(431)](t);s[r(221)](2*t,n,!0)}return n[r(492)]}([r(300)+s+r(422)+n+'">',"<DATA>",r(239),"<KIDS>",r(417),r(243)+i+'"',">",r(245),r(270),"</PROTECTINFO>",t?r(470)+t+r(409):"",r(428),r(289)][r(420)]("")))}[As(430)](e){const t=As;if(this[t(432)][t(440)][t(328)]("com.widevine"))return F[t(411)](F[t(204)][t(430)],new Uint8Array([0,0,0,0,237,239,139,169,121,214,74,206,163,200,39,220,213,29,33,237,0,0,0,18,18,16,...this[t(432)][t(366)][e[0][t(469)]][t(479)]]));if(this[t(432)].keySystem===t(421)){const r=this[t(192)](this[t(432)][t(366)][e[0].type][t(479)],this.drm.licenseUrl),n=r[t(442)];return F[t(411)](F[t(204)][t(430)],new Uint8Array([0,0,0,0,154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149,n>>>24,n>>>16&255,n>>>8&255,255&n,...r]))}return this[t(432)][t(440)]===t(273)?F[t(411)](F[t(204)][t(430)],new Uint8Array([1,0,0,0,16,119,239,236,192,178,77,2,172,227,60,30,82,226,251,75,0,0,0,1,...this.drm.config[e[0][t(469)]][t(479)],0,0,0,0])):this[t(432)][t(440)]===t(286)?null:void console[t(370)](t(297)+this[t(432)].keySystem)}[As(314)](e){const t=As;let r,n,s=this[t(432)][t(366)][e];return"cbcs"===s.encryption?(r=new Uint8Array([16,...s.iv]),n=25):(r=new Uint8Array([]),n=0),F[t(411)](F[t(204)].tenc,new Uint8Array([1,0,0,0,0,n,1,this[t(199)][e],...s[t(479)],...r]))}[As(392)](e){return F[As(411)](F.types.saiz,new Uint8Array([0,0,0,0,e,0,0,0,1]))}[As(364)](e){const t=As;return F[t(411)](F[t(204)][t(364)],new Uint8Array([0,0,0,0,0,0,0,1,e>>>24,e>>>16&255,e>>>8&255,255&e]))}[As(363)](e,t){const r=As;let n=null;return e&&(1!==e[r(294)]&&console[r(370)](r(424)+e[r(294)]+r(413)),n=e[0][r(195)]),n&&n[r(442)]?F[r(411)](F[r(204)][r(363)],new Uint8Array([0,0,0,t?2:0,0,0,0,1,...n])):F[r(411)](F[r(204)][r(363)],new Uint8Array([0,0,0,0,0,0,0,1]))}[As(271)](e,t,r){const n=As,s=this[n(216)](e,t,r);let i=new Uint8Array(F[n(341)][n(442)]+s.byteLength);return i.set(F[n(341)]),i[n(311)](s,F[n(341)].byteLength),i}}let Zs=1;class yr{constructor(){this[As(283)]=1}static[As(209)](){return Zs++}[As(250)](){const e=As;this[e(274)][e(215)]=0,this.mp4track[e(446)]=[]}[As(258)](){const e=As;return!(!this.readyToDecode||!this[e(446)][e(294)])}}class Ea extends yr{constructor(e){const t=As;super(),this[t(435)]=!0,this[t(223)]=0,this[t(237)]=0,this[t(274)]={id:yr[t(209)](),type:"audio",channelCount:2,audiosamplerate:48e3,len:0,fragmented:!0,timescale:e,duration:e,samples:[],codec:t(388),encrypted:!0},this[t(446)]=[]}resetTrack(){const e=As;this[e(283)]=1,this[e(223)]=0,this[e(237)]=0}[As(406)](e,t,r){const n=As;if(e.length>0)for(let s=0;s<e[n(294)];s++){let i=e[s],o=i[n(276)],a=o[n(442)];this.samples.push({units:o,size:a,duration:i.duration,sampleAuxInfo:t,timestamp:r}),this[n(274)][n(215)]+=a}}[As(248)](){const e=As;if(!this[e(446)])return null;let t,r=this[e(274)][e(446)];for(;this.samples[e(294)];){let n=this[e(446)][e(233)](),s=(1e3*n[e(385)]|0)-this.nextDts|0;s<5&&(s=5),this.dts=this.nextDts,this[e(223)]+=s,t={size:n.size,duration:s,cts:0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1},sampleAuxInfo:n[e(195)]};let i=new Uint8Array(n.size);return i[e(311)](n.units,0),r.push(t),new Uint8Array(i.buffer,0,n[e(483)])}return null}}class _a extends yr{constructor(e,t){const r=As;super(),this[r(435)]=!1,this.nextDts=0,this[r(237)]=0,this[r(477)]=t,this.mp4track={id:yr[r(209)](),type:r(434),len:0,fragmented:!0,sps:"",pps:"",width:0,height:0,timescale:e,duration:e,samples:[],encrypted:!0},this[r(446)]=[],this[r(220)]=new rt(this)}[As(426)](){const e=As;this[e(283)]=1,this.readyToDecode=!1,this[e(274)].sps="",this[e(274)][e(362)]="",this[e(223)]=0,this[e(237)]=0}[As(406)](e,t,r){const n=As;for(let s of e){let e=[],i=0;for(let t of s[n(276)])this.h264[n(368)](t)&&(e[n(462)](t),i+=t.getSize());e[n(294)]>0&&this[n(435)]&&(this[n(274)][n(215)]+=i,this[n(446)][n(462)]({units:e,size:i,keyFrame:s.keyFrame,duration:s[n(191)],sampleAuxInfo:t,timestamp:r}))}}[As(248)](){const e=As;if(!this[e(258)]()||!this.samples)return null;let t,r=this[e(274)][e(446)],n=this.samples[e(233)](),s=n[e(276)],i=(1e3*n.timestamp|0)-this[e(223)]|0;i<5&&(i=5),window[e(251)]&&i>5e3&&console[e(383)]("timestamp gap: "+(i/1e3|0)+" s"),this[e(237)]=this[e(223)],this.nextDts+=i,t={size:n[e(483)],duration:i,cts:0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,isNonSync:n[e(275)]?0:1,dependsOn:n.keyFrame?2:1},sampleAuxInfo:n[e(195)]};let o=0;for(const t of s)o+=t[e(349)]();let a=0,c=new Uint8Array(o);for(const t of s)c[e(311)](t[e(343)](),a),a+=t[e(349)]();return r[e(462)](t),new Uint8Array(c[e(492)],0,o)}}class Ta extends _n{constructor(e,t){const r=As;super(r(345)),this.initialized=!1,this.trackTypes=[],this[r(414)]={},this[r(393)]=1e3,this.mediaDuration=0,this[r(477)]=e,this[r(375)]=t}addTrack(e){const t=As;(e===t(434)||"both"===e)&&(this[t(414)][t(434)]=new _a(this[t(393)],this.videoElement),this[t(480)][t(462)](t(434))),(e===t(451)||e===t(303))&&(this[t(414)][t(451)]=new Ea(this.timescale),this[t(480)][t(462)](t(451)))}reset(){const e=As;for(let t of this[e(480)])this[e(414)][t][e(426)]();this[e(489)]=!1}[As(355)](){const e=As;this[e(414)]={},this[e(490)]()}[As(250)](){const e=As;if(this[e(489)])for(let t of this[e(480)]){let r=this[e(414)][t];for(;;){let n=r.getFramePayload();if(!n||!n[e(442)])break;let s={type:t,payload:Os(this[e(375)][e(460)](r[e(283)]++,r[e(237)],r[e(274)]),this[e(375)][e(458)](n)),dts:r[e(237)]};this[e(255)](e(492),s),r[e(250)]()}}else this[e(258)]()&&(this[e(255)](e(205)),this[e(271)](),this[e(489)]=!0,this[e(250)]())}initSegment(){const e=As;for(let t of this[e(480)]){let r=this[e(414)][t],n={type:t,payload:this[e(375)][e(271)]([r[e(274)]],this[e(433)],this[e(393)])};this.dispatch(e(492),n)}}isReady(){const e=As;for(let t of this.trackTypes)if(!this[e(414)][t][e(435)]||!this[e(414)][t].samples[e(294)])return!1;return!0}[As(406)](e){const t=As;for(let r of this[t(480)]){let n=e[r];n.length>0&&this[t(414)][r][t(406)](n,r===t(451)?e[t(225)]:e.videoSampleAuxInfo,e[t(385)])}this.flush()}}class Aa extends _n{constructor(e,t,r){const n=As;super(n(492)),this[n(469)]=t,this.queue=new Uint8Array,window[n(319)]&&(this[n(254)]=new Uint8Array,this[n(404)]=0),this.sourceBuffer=e,this[n(218)]=r,this[n(197)]=!1,this[n(310)].addEventListener(n(370),e=>{const t=n;console.warn(t(201),e,this.type),this[t(197)]=!0,this[t(255)](t(370),{type:this[t(469)],name:"buffer",error:t(292)})})}[As(355)](){const e=As;this[e(401)]=null,this[e(254)]=null;try{this.sourceBuffer&&(this[e(310)][e(186)](),this[e(218)].removeSourceBuffer(this[e(310)]),this[e(310)]=null)}catch(e){}this.offAll()}[As(475)](){const e=As;if(this.queue[e(294)]&&this[e(310)]&&!this[e(310)].updating){if(this[e(310)].buffered[e(294)]>1){for(let t=0;t<this[e(310)].buffered[e(294)];++t){const r=t<this[e(310)].buffered[e(294)]-1;window[e(251)]&&console[e(383)](e(445)+t+(r?" (remove)":"")+": "+this[e(310)][e(269)][e(326)](t)+e(325)+this[e(310)][e(269)][e(376)](t)),r&&this.sourceBuffer[e(482)](this[e(310)][e(269)].start(t),this[e(310)].buffered[e(376)](t))}if(this.sourceBuffer[e(378)])return}try{this[e(310)][e(491)](this[e(401)]),this.queue=new Uint8Array}catch(t){this[e(255)](e(370),{type:this[e(469)],name:e(352),error:t})}}}[As(371)](e){const t=As;if(this[t(254)]&&(this.dbgQueue=Os(this[t(254)],e),100==++this[t(404)])){const e=(new Date)[t(344)]().substring(0,19)[t(454)](":","-"),r=this.type+"-"+e+".mp4";window.downloadToFile(this[t(254)],r),this[t(254)]=null}this[t(197)]||(this[t(401)]=Os(this[t(401)],e)),this.doAppend()}}class Tn extends _n{static isSupported(e){const t=As;return window[t(202)]?window.ManagedMediaSource[t(497)](e):!!window[t(384)]&&window.MediaSource[t(497)](e)}constructor(e){const t=As;super(t(397)),this[t(197)]=!1,this[t(410)]=!0,this[t(466)]=!1,this[t(234)]=!1,this.mseEnded=!1,this[t(379)]=Object[t(189)]({},{node:"",mode:"video",debug:!1,onReady:function(){},onError:function(e){}},e),this[t(450)]=typeof this.options[t(450)]===t(302)?document[t(472)](this.options.node):this[t(379)].node,this[t(432)]=e.drm,this.mp4=new F(this.drm),this[t(423)]=new Ta(this.node,this[t(375)]),this[t(423)].addTrack(this[t(379)][t(461)]),this[t(423)].on(t(492),this[t(456)].bind(this)),this[t(423)].on(t(205),this[t(382)][t(308)](this)),this.initBrowser()}[As(322)](){const e=As;typeof this.options.node===e(302)&&""==this.options[e(450)]&&console[e(370)](e(473)),this[e(234)]=!1,this.setupMSE()}setupMSE(){const e=As;if(!window[e(202)]&&!window[e(384)])throw e(452);window.ManagedMediaSource?(this.node[e(427)]=!0,this[e(327)]=new ManagedMediaSource):this[e(327)]=new MediaSource,this[e(284)]=URL[e(244)](this[e(327)]),this.node[e(485)]=this[e(284)],this[e(277)]=!1,this[e(327)][e(331)](e(338),this.onMSEOpen[e(308)](this)),this.mediaSource.addEventListener("sourceclose",this[e(241)][e(308)](this)),this[e(327)][e(331)]("webkitsourceopen",this[e(194)][e(308)](this)),this.mediaSource[e(331)](e(240),this[e(241)].bind(this)),this[e(327)][e(331)]("error",(function(t){const r=e;console[r(370)](r(287),t[r(226)])}))}[As(227)](){const e=As;if(!this[e(277)])try{this.mseEnded=!0,this[e(327)][e(185)]===e(399)&&this[e(327)][e(261)]()}catch(t){console[e(370)]("mediasource is not available to end: ",t)}}[As(359)](){this[As(410)]=!0}[As(371)](e){const t=As;let r={video:[],audio:[]};if(this[t(197)]||this[t(277)]||!e||!this[t(423)])return-1;if(e[t(434)]){r.timestamp=e.timestamp;const n=this[t(190)](e.videoSampleAuxInfo,this.mp4[t(199)][t(434)]),s=n!=e[t(434)][t(442)];let i=rt[t(360)](e[t(434)],s);if(!i[t(206)]||i[t(260)].length<1)return 0;if(this.waitingForIdr){if(!i[t(412)])return 0;this[t(410)]=!1}if(!Ps&&e[t(278)]){const r=i[t(260)][t(188)]((e,r)=>e+4+r[t(442)],0);r!==n&&this[t(400)](e[t(278)],this.mp4[t(199)][t(434)],r-n)}r[t(434)]=this[t(335)](i[t(260)]),r[t(278)]=e[t(278)]}return e[t(451)]&&(r[t(385)]=e[t(385)],r[t(451)]=[{units:e.audio}],r.audioSampleAuxInfo=e[t(225)]),e[t(434)]||e[t(451)]?(this[t(423)][t(406)](r),0):(console.error(t(361)),0)}[As(335)](e){const t=As;let r=[],n=[],s=!1,i=!1;for(let o of e){let e=new ce(o);e.type()!==ce.IDR&&e[t(469)]()!==ce.NDR||rt[t(448)](e),r[t(294)]&&i&&(e[t(387)]||!e[t(495)])&&(n[t(462)]({units:r,keyFrame:s}),r=[],s=!1,i=!1),r[t(462)](e),s=s||e[t(459)](),i=i||e[t(495)]}if(r[t(294)])if(i)n[t(462)]({units:r,keyFrame:s});else{let e=n[t(294)]-1;e>=0&&(n[e].units=n[e][t(276)].concat(r))}return 1!==n[t(294)]&&console[t(230)](t(207)+n[t(294)]),n}[As(190)](e,t){const r=As;if(!e)return 0;const n=(e[0]<<8)+e[1],s=t+2+4;let i=0,o=2;for(;0<n&&o+s<=e[r(442)];){o+=t;const r=(e[o]<<8)+e[o+1],n=(e[o+2]<<24)+(e[o+3]<<16)+(e[o+4]<<8)+e[o+5];o+=6,i+=r+n}return i}patchSampleAuxinfo(e,t,r){const n=As;let s=2;if(0<(e[0]<<8)+e[1]&&s+(t+2+4)<=e[n(442)]){s+=t;let n=(e[s]<<8)+e[s+1];n+=r,n>=0&&(e[s]=n>>>8&255,e[s+1]=255&n)}return 0}[As(382)](){const e=As;if(this[e(234)]&&this[e(423)]&&this[e(423)].isReady()&&!this.bufferControllers){this.bufferControllers={};for(let t in this[e(423)][e(414)]){let r=this[e(423)][e(414)][t];const n="".concat(t,e(317))[e(365)](r[e(274)][e(449)],'"');if(window.clRtcDrmDebugLog&&console[e(383)](e(312),n),!Tn[e(408)](n))return console[e(370)](e(372)),!1;let s=this[e(327)][e(350)](n);this[e(398)][t]=new Aa(s,t,this[e(327)]),this.bufferControllers[t].on(e(370),this[e(403)][e(308)](this))}}}[As(313)](){const e=As;for(let t in this[e(398)])this[e(398)][t].doAppend()}onBuffer(e){const t=As;this[t(234)]&&this[t(398)]&&this[t(398)][e.type]&&this[t(398)][e[t(469)]][t(371)](e[t(214)])}[As(194)](){const e=As;window[e(251)]&&console.info("[MSE] sourceopen"),this[e(327)][e(185)]!==e(281)&&(this.mediaSource.duration=Number[e(391)],this[e(234)]=!0,"function"==typeof this[e(379)][e(336)]&&this[e(379)].onReady[e(394)](null,this[e(466)]),URL[e(235)](this.url),this[e(382)]())}[As(241)](){const e=As;window.clRtcDrmDebugLog&&console[e(383)](e(441)),this.mseReady=!1,this[e(227)]()}[As(403)](e){const t=As;console.warn(t(351),e),this.irrecoverableError=!0,this[t(227)](),"function"==typeof this[t(379)][t(266)]&&this[t(379)][t(266)][t(394)](null,e)}}function Ns(e,t){const r=Vs();return(Ns=function(e,t){return r[e-=222]})(e,t)}function Vs(){const e=["__dev_time__","1634635aeNfVS","4rWkceo","1051qHPzyB","314juHkBI","7752096GfpyFE","1023208nKrJjX","2137269uUqtNM","303058KNxeBb","1097196nHglzA"];return(Vs=function(){return e})()}!function(){const e=Ns,t=Vs();for(;;)try{if(parseInt(e(228))/1*(-parseInt(e(229))/2)+-parseInt(e(222))/3*(parseInt(e(227))/4)+parseInt(e(226))/5+parseInt(e(224))/6+parseInt(e(223))/7+-parseInt(e(231))/8+parseInt(e(230))/9==409100)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();const Ws=Xs;function Xs(e,t){const r=Hs();return(Xs=function(e,t){return r[e-=460]})(e,t)}!function(){const e=Xs,t=Hs();for(;;)try{if(-parseInt(e(471))/1*(-parseInt(e(474))/2)+parseInt(e(479))/3+parseInt(e(473))/4*(parseInt(e(461))/5)+parseInt(e(487))/6+-parseInt(e(467))/7+-parseInt(e(482))/8+-parseInt(e(464))/9==139726)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();const zs="CrsCCAMSEKDc0WAwLAQT1SB2ogyBJEwYv4Tx7gUijgIwggEKAoIBAQC8Xc/GTRwZDtlnBThq8"+Ws(462)+"wyoYOE+M/t1oIbccwlTQ7o+BpV1X6TB7fxFyx1jsBtRsBWphU65w121zqmSiwzZzJ4xsXVQCJ"+Ws(460)+Ws(476)+Ws(480)+Ws(484)+Ws(485)+"7hyskG5ZLAyJMzTvgnV3D8/I5Y6mCFBPb/+/Ri+9bEvquPF3Ff9ip3yEHu9mcQeEYCeGe9zR/27eI5MATX39gYtCnn7dDXVxo4/rCYK0A4VemC3HRai2X3pSGcsKY7+6we7h4IycjqtuGtYg8A"+Ws(475)+"RL9KsD0v7ysBQVdUXEbJotcFz71tI5qc3jwr6GjYIPA3VzusD17PN6AGQniMwxJV12z/EgnUo"+Ws(477),Ks=Uint8Array[Ws(478)](window[Ws(470)](zs),e=>e.charCodeAt(0));class De{constructor(e){this[Ws(488)]=e}[Ws(469)](){return this[Ws(488)]}[Ws(483)](){const e=Ws;switch(this[e(488)]){case e(489):return"https://lic.staging.drmtoday.com";case e(465):return e(481);default:return e(466)}}certificate(){return Ks}}function Hs(){const e=["development","https://lic.drmtoday.com","462553oMrSQp","Staging","toString","atob","20047HjYCpd","Development","52chMPdC","6mbMcSk","baigovcoURAZcr1d/G0rpREjLdVLG0Gjqk63Gx688W5gh3TKemsK3R1jV0dOfj3e6uV/kTpsN","+vwmV2/NJWxKqHBKdL9JqvOnNiQUF0hDI7Wf8Wb63RYSXKE27Ky31hKgx1wuq7TTWkA+kHnJT","pcFB13osydpD2AaDsgWo5RWJcNf+fzCgtUQx/0Au9+xVm5LQBdv8Ja4f2oiHN3dw","from","146355HhTpSB","UrTEfQxfPR4dJTquE+IDLAi5yeVVxzbAgMBAAE6DGNhc3RsYWJzLmNvbUABEoADMmGXpXg/0q","https://lic.test.drmtoday.com","501688OkVRMl","baseUrl","xUuwokpsqVIHZrJfu62ar+BF8UVUKdK5oYQoiTZd9OzK3kr29kqGGk3lSgM0/p499p/FUL8oH","HzgsJ7Hajdsyzn0Vs3+VysAgaJAkXZ+k+N6Ka0WBiZlCtcunVJDiHQbz1sF9GvcePUUi2fM/h","Production","1063410zFUyaf","name","staging","pQnNI61gzHO42XZOMuxytMm0F6puNHTTqhyY3Z290YqvSDdOB+UY5QJuXJgjhvOUD9+oaLlvT","93365ZJpndd","V382D1oJAM0F/YgCQtNDLz7vTWJ+QskNGi5Dd2qzO4s48Cnx5BLvL4H0xCRSw2Ed6ekHSdrRU","production","2343546YgIYCY"];return(Hs=function(){return e})()}function Qs(e,t){const r=qs();return(Qs=function(e,t){return r[e-=325]})(e,t)}function qs(){const e=["1052499bnJBHn","cenc","4222tSxFth","Unsupported SampleAuxInfo version","12980Tusgux","3160ZwXFcU","40030ewyARR","16lkTHRT","1199124lbwxEr","data","105TSrukA","getUint8","12bBEpge","SampleAuxInfo corrupted (postfix not found)","getUint16","error","85265ZYYyUv","buffer","3616548TKdsLX","subarray","byteLength","SampleAuxInfo corrupted"];return(qs=function(){return e})()}function si(e,t){const r=hi();return(si=function(e,t){return r[e-=295]})(e,t)}De[Ws(468)]=new De(Ws(489)),De[Ws(486)]=new De(Ws(463)),De[Ws(472)]=new De(Ws(465)),function(){const e=Qs,t=qs();for(;;)try{if(parseInt(e(328))/1+-parseInt(e(332))/2*(-parseInt(e(336))/3)+-parseInt(e(338))/4*(-parseInt(e(342))/5)+-parseInt(e(344))/6+-parseInt(e(326))/7*(parseInt(e(333))/8)+parseInt(e(334))/9+parseInt(e(331))/10*(parseInt(e(330))/11)==358550)break;t.push(t.shift())}catch(e){t.push(t.shift())}}(),function(){const e=si,t=hi();for(;;)try{if(parseInt(e(305))/1*(-parseInt(e(297))/2)+-parseInt(e(295))/3+parseInt(e(310))/4*(parseInt(e(309))/5)+-parseInt(e(304))/6*(parseInt(e(296))/7)+parseInt(e(307))/8*(-parseInt(e(298))/9)+-parseInt(e(301))/10*(parseInt(e(302))/11)+-parseInt(e(300))/12*(-parseInt(e(308))/13)==178039)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();const ii=[];let oi=null,li=0;function hi(){const e=["31476hbBsvr","850RxzAPl","4180KczaCN","push","156MUFuvQ","96571jvhWaB","buffer","26232BkewNd","4303YGAqiP","5yhGpFn","1137036pzCnTd","1035942NcoZLh","94073eTaQjy","2bXtEms","414snfiTE","slice"];return(hi=function(){return e})()}const pi=Si;function gi(){const e=["Data does not seem to be UTF-16 encoded!","No init data available!","getElementsByTagName","min","14BFNrBA","keystatuseschange","catch","childNodes","internal-error","Failed to reuse previous EME session: ","output-downscaled","expired","bind","5576688EKOFOG","has","length","License acquisition failed with error ","arrayBuffer","apply","CDM error generating license request: ","<Challenge","No PR challenge data!","then","license","createSession","warn","[PR] License fetched:","text/xml","clRtcDrmDebugLog","push","encode","max","json"," is not ","replace","target","rtcdrmerror","update","fromCharCode","subarray","2993694njpqat","4002692oINhTV","Content-Type","1347492MkzfDC","Data has an incorrect length, must be even.","addEventListener","buffer","onFetch","generateRequest","initData","dispatchEvent","atob","No clear key test key provided!","Challenge","New lic will be requested","oct","BYTES_PER_ELEMENT","sessionId","usable for decryption (status: ","[WV] License fetched:","Key ","5MtuOVr","byteLength","744563CKOUzg","load","floor","error","decode","indexOf","info","isSafari","edef8ba979d64acea3c827dcd51d21ed","mediaKeys","Previous lic will be reused","charCodeAt","licenseUrl","status","Failed to update the session: ","log","keyStatuses","temporary","9a04f07998404286ab92e65be0885f95","output-restricted","nodeValue","btoa","message","EME createSession() failed - no DRM available","5977680uUTwUr","getUint16","[PR] Challenge node not found","A128KW","3974463jrELhf","Failed to update the session","stringify","[EME]","delete","No media keys for media element!","set","2nMQfRz"];return(gi=function(){return e})()}!function(){const e=Si,t=gi();for(;;)try{if(-parseInt(e(419))/1*(parseInt(e(454))/2)+parseInt(e(495))/3+parseInt(e(496))/4*(-parseInt(e(417))/5)+-parseInt(e(498))/6*(-parseInt(e(459))/7)+parseInt(e(468))/8+-parseInt(e(447))/9+parseInt(e(443))/10==555073)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();let yi={licenseUrl:"",onFetch:void 0};const vi={},wi=(e,t=0,r=1/0)=>((e,t,r)=>{const n=Si,s=Uint8Array[n(511)];t*=s,r*=s;const i=(c=e)instanceof ArrayBuffer?c:c[Si(501)],o=e[n(418)],a=t;var c;let l=Math[n(486)](0,Math[n(458)](a,o)),u=Math[n(458)](l+Math[n(486)](r,0),o);return l/=s,u/=s,new Uint8Array(i,l,u-l)})(e,t,r);function Si(e,t){const r=gi();return(Si=function(e,t){return r[e-=417]})(e,t)}const Ri=e=>{const t=Si;let r="";for(const n of e){let e=n.toString(16);1==e[t(470)]&&(e="0"+e),r+=e}return r};let xi=null;const ki=e=>{const t=Si;return window[t(440)](String[t(493)][t(473)](null,e))[t(489)](/\+/g,"-")[t(489)](/\//g,"_")[t(489)](/=*$/,"")},_i=(e,t)=>{const r=Si,n=(e=>{const t=Si,r=JSON.parse((new TextDecoder)[t(423)](e));if(console[t(434)]("CK license request:",r),null===xi)throw new Error(t(507));const n=[];for(const e of r.kids){const r={kty:t(510),alg:t(446),kid:e,k:ki(xi)};n[t(484)](r)}return(new TextEncoder)[t(485)](JSON[t(449)]({keys:n}))})(t.message);t[r(490)][r(492)](n)[r(461)]((function(e){const t=r;console[t(422)](t(448),e)}))},Ci=e=>{const t=Si,r=window[t(506)](e[t(489)](/-/g,"+")[t(489)](/_/g,"/")),n=new Uint8Array(r[t(470)]);for(let e=0;e<r.length;++e)n[e]=r[t(430)](e);return n},Ii=(e,t,...r)=>ys(void 0,[e,t,...r],void 0,(function*(e,t,r=!1){const n=Si,s=new Headers(vi);r&&s.append(n(497),n(482));const i={method:"POST",headers:s,body:t},o=yield yi[n(502)]?yi[n(502)](e,i):fetch(e,i);if(!o.ok)throw new Error(n(471)+o[n(432)]);return o})),Ei=(e,t)=>{const r=Si;Ii(yi[r(431)],t[r(441)])[r(477)](e=>e[r(487)]())[r(477)](e=>{const n=r;window[n(483)]&&console.info(n(514),e.license);const s=Ci(e[n(478)])[n(501)];t[n(490)][n(492)](s)[n(461)](e=>{console[n(422)]("Failed to update the session",e)})})[r(461)](t=>{const n=r;e.dispatchEvent(new CustomEvent(n(491),{detail:{message:""+t}})),console[n(422)](t)})},Ti=(e,t)=>{const r=Si,n=((e,t)=>{const r=Si,n=new DOMParser;try{const e=function(e,t,r=!1){const n=Si;if(!e)return"";let s=e;if(!r&&s.byteLength%2!=0)throw console[n(422)](n(499)),new Error(n(455));const i=wi(s);let o;if((255===i[0]&&254===i[1]||254===i[0]&&255===i[1])&&(s=i[n(494)](2)),s instanceof ArrayBuffer)o=s;else{const e=new Uint8Array(s[n(418)]);e[n(453)](wi(s)),o=e[n(501)]}const a=Math[n(421)](s.byteLength/2),c=new Uint16Array(a),l=new DataView(o);for(let e=0;e<a;e++)c[e]=l[n(444)](2*e,t);return function(e){const t=Si;let r="";for(let n=0;n<e[t(470)];n+=16e3){const s=e[t(494)](n,n+16e3);r+=String[t(493)].apply(null,s)}return r}(c)}(t,!0);if(e[r(424)](r(475))>-1){const t=n.parseFromString(e,r(482))[r(457)](r(508))[0][r(462)][0][r(439)];if(null===t)throw new Error("No PR challenge data!");return Ci(t)}console[r(480)](r(445))}catch(t){e.dispatchEvent(new CustomEvent(r(491),{detail:{message:""+t}})),console.error(t)}return null})(e,t.message);if(null===n)return e[r(505)](new CustomEvent("rtcdrmerror",{detail:{message:"No PR challenge data!"}})),void console.error(r(476));Ii(yi[r(431)],n[r(501)],!0)[r(477)](e=>e[r(472)]())[r(477)](n=>{const s=r;window[s(483)]&&console[s(425)](s(481),n),t[s(490)].update(n)[s(461)]((function(t){const r=s;e[r(505)](new CustomEvent(r(491),{detail:{message:r(433)+t}})),console[r(422)](r(448),t)}))})[r(461)](t=>{const n=r;e.dispatchEvent(new CustomEvent("rtcdrmerror",{detail:{message:""+t}})),console[n(422)](t)})},Li=(e,t)=>{const r=Si;Ii(yi[r(431)],t[r(441)])[r(477)](e=>{const t=r,n=e.text();return window[t(483)]&&console.info("[FPS] License fetched:",e,n),n})[r(477)](e=>{const n=r;t[n(490)][n(492)](Ci(e))})[r(461)](t=>{const n=r;e.dispatchEvent(new CustomEvent(n(491),{detail:{message:""+t}})),console[n(422)](t)})},Ai=(e,t)=>{vi[e]=t},Mi=Ls[pi(426)];let Pi=!Mi;const Oi=new Map;function Di(e){return ys(this,void 0,void 0,(function*(){const t=Si;if(null===e[t(504)])throw new Error(t(456));const r=e[t(490)];if(null===r)throw new Error("No media element available!");const n=r[t(428)];if(null===n)throw new Error(t(452));const s=Ri(new Uint8Array(e[t(504)])),i=s+r.id;let o=null;Oi[t(469)](i)&&(o=Oi.get(i),null!=o&&o.close(),Oi[t(451)](i)),window[t(483)]&&console[t(425)](t(450),t(o?429:509));let a=null;try{a=n[t(479)](Pi?"persistent-license":"temporary")}catch(e){console[t(434)]("EME createSession(persistent) failed:",e)}if(!a&&Pi){Pi=!1;try{a=n[t(479)](t(436))}catch(e){console[t(422)]("EME createSession(temporary) failed:",e)}}if(a)if(a[t(500)](t(460),e=>{const n=t;e[n(490)][n(435)].forEach((e,t)=>{const s=n;(e===s(466)||e===s(438)||e===s(465)||e===s(463))&&r[s(505)](new CustomEvent(s(491),{detail:{message:s(515)+Ri(new Uint8Array(t))+s(488)+(s(513)+e+")"),keyId:t}}))})}),Mi?a.addEventListener(t(441),Li[t(467)](null,r),!1):-1!==s[t(424)](t(427))?a.addEventListener(t(441),Ei[t(467)](null,r),!1):-1!==s[t(424)](t(437))?a[t(500)](t(441),Ti[t(467)](null,r),!1):a.addEventListener("message",_i[t(467)](null,r),!1),o)try{(yield a[t(420)](o[t(512)]))?Oi[t(453)](i,a):r.dispatchEvent(new CustomEvent(t(491),{detail:{message:"Failed to load previous EME session"}}))}catch(e){r[t(505)](new CustomEvent(t(491),{detail:{message:t(464)+e}}))}else a[t(503)](e.initDataType,e[t(504)]).then(()=>{Pi&&Oi[t(453)](i,a)})[t(461)](e=>{const n=t;r[n(505)](new CustomEvent(n(491),{detail:{message:n(474)+e}}))});else r[t(505)](new CustomEvent(t(491),{detail:{message:t(442)}}))}))}const Fi=no;function ji(){const e=[" too close to seek, ","fpsCertificateUrl","9880640TWxZrg","H264","ignoreAudio","Unable to create Worker!","createMediaKeys(",", restart required: ","/license-proxy-headerauth/drmtoday/RightsManager.asmx","6236Nwzlef","worker","serverCertificateUrl","serverCertificate","seq",",255]).buffer,idrFrames.push(new Uint8Array([0,0,0,1,39,100,0,13,172,87,5,6,100,0,0,0,1,40,238,60,176,0,0,0,1,37,","ClearKey","No valid DRM config found, call rtcDrmConfigure first.","sessionId","toISOString","indexOf","robustness","isInteger","info","includes","Development","slice","16niaptx"," frame","video/mp4","isArray","Android","end","PlayReady","streamType","1772WtcYWF","]: ","Frame gap: ","nextKeyFrameAllowedTime","use rtcDrmFeedFrame to push frames manually","Error recovery attempted","merchant","FairPlay","requestMediaKeySystemAccess(","pipeThrough","/license-server-fairplay/","isChrome","type","MSE (re)init","const DUMMY_IDR_FRAME_SLICE_HDR0=new Uint8Array([32,0,203]),DUMMY_IDR_FRAME_SLICE_HDR1=new Uint8Array([16,0,50]);","DRM config env value must be one of: ","length","GOP is getting too long, requesting a new key frame","Worker","let brokenFrame=null,idrFrames=[];function initializeDummyFrames(){brokenFrame=new Uint8Array([0,0,0,1,65,154,255","srcObject","RTCRtpScriptTransform","),idrFrames.push(idrFrames[0].slice());let $=new Uint8Array(idrFrames[1]);$.set([16,0,50],27)}let idrPicIdToggle=","now"," to ","join","setServerCertificate","audioCapabilities","lastKeyFrameTime","prevSeqNum"," seeking from ",".experiment","clRtcDrmDebugLog","Server certificate fetch failed with error ","isFirefox","org.w3.clearkey","x-dt-custom-data","jitterBufferTarget","playbackRate","enabled","keyFrameNeeded","createEncodedStreams","wvCertificateUrl","key","sai","Discarding corrupted video frame (too small)",'gle^=1]}function audioTransformFunction($,e){postMessage({streamType:"audio",frame:{timestamp:$.timestamp,data:$.',"H264 is the only supported video codec.","com.microsoft.playready.recommendation"," will be used","DRM config iv must be an instance of 16-byte long Uint8Array.","encryption","0;function generateDummyFrame($){return(brokenFrame||initializeDummyFrames(),$)?brokenFrame:idrFrames[idrPicIdTog","toString","message","status","bytesSinceKey","currentTime","supportsRtpScriptTransform","1585647fRskxG","audioElement","track","sinf","createObjectURL","enqueue","Invalid videoElement, it must be an instance of HTMLVideoElement.","7302558TqFWae","pipeTo","SampleAuxInfo extraction failed (video)","isEdge","keys","not-allowed","rtcdrmerror","btoa","?audioTransformFunction:videoTransformFunction});e.pipeThrough(a).pipeTo(x)}self.RTCTransformEvent&&(self.onrtctr",", a1d1f1 is recommended).","reportDiscontinuity","onFetch","keyId","sessionTypes","). Edge only supports PlayReady, Widevine and ClearKey.","audioEncrypted","audioStartTimestamp","frame","videoStartTimestamp","184,32,0,203,255,38,29,217,24,192,161,96,0,0,12,229,174,166,6,7,20,3,84,0,247,96,193,181,229,128,0,32,32]).buffer","Duplicate/reordered frame, prev seq: ","ClearKey is not supported by Safari.","bind",") not found in [","DRM config robustness can only be one of: ","persistent-license","postMessage","receiver","get","both","jmuxer","Production","Blob","timestamp","cenc","emeConfig","clear","cbcs-1-9","5iKPdqC","isWindows","PlayReady license acquisition might fail without output protection enabled (sessionId is ","). Chrome only supports Widevine and ClearKey.","mediaBufferMs should be an integer.","size","certificate","prLicenseUrl","fpsLicenseUrl","/license-proxy-widevine/cenc/","4572770OAoUlm","BYTES_PER_ELEMENT","then","SW_SECURE_CRYPTO","ansform=$=>{let e=$.transformer;handleTransform(e.options.operation,e.readable,e.writable)}),onmessage=$=>{keyFra","splice","Safari doesn't support 'cenc'/AES-CTR, use 'cbcs' instead if possible.","videoElement","rtcDrmConfigure did not specify audioElement, audio will be dropped",'audio/mp4; codecs="opus"',"object","Invalid audioElement, it must be an instance of HTMLMediaElement.","keyFrameNeededPosted","debugCreateMediaDump","next","play","6591266VeIbXo","userId","jitterBufferDelayHint",'ame(keyFrameNeeded),e.enqueue($)}function handleTransform($,e,x){let a=new TransformStream({transform:"audio"===$',"dispatchEvent","reduce"," bytes, playback at ","offset","arrayBuffer","waitingForIdr","Widevine","DRM config mediaBufferMs should be an integer.","hwSecurity","authToken","audio"," bytes)","push","licenseUrl","Default transform mode enabled, ","RTCRtpScriptTransform/TransformStream will not be created, ","GET","baseUrl","video","trim","7377TdQrIK","3000","playoutDelayHint","catch","fpsCertificate","POSITIVE_INFINITY","/license-server-fairplay/cert/","DRM config:","streams","mediaBufferMs","log","codec","onmessage","Target video element (","Applying pre-configured certificate (","webkitURL","Discarding corrupted video frame (no Annex B startcode)"," requesting a new key frame (latency ","PlayReady might not support '","No target media element!","URL","set","warn","data","config","isSafari","forEach","setMediaKeys","buffered"," - ","keySystem",'data}}),e.enqueue($)}let keyFrameNeeded=!1;function videoTransformFunction($,e){postMessage({streamType:"video",f',"paused","wvCertificate","a1d1f1","2000","keyFrameRequestInterval","Several DRM configs detected, rtcDrmOnTrack have to be called with target DRM config.","error","238HZxcdH","HW_SECURE_ALL","Invalid DRM type (","buffer","x-dt-auth-token","clRtcDrmCreateMediaDump",'rame:{type:$.type,timestamp:$.timestamp,data:$.data}}),"key"===$.type&&(keyFrameNeeded=!1),$.data=generateDummyFr',"addEventListener",") failed","keyFrameLogCntr","feed","byteLength","kind","purchase","environment","videoCapabilities","requestMediaKeySystemAccess","temporary","). It has to be a string containing a JWT.","value",".. ","string"];return(ji=function(){return e})()}!function(){const e=no,t=ji();for(;;)try{if(parseInt(e(543))/1*(parseInt(e(512))/2)+parseInt(e(473))/3*(parseInt(e(568))/4)+-parseInt(e(672))/5*(-parseInt(e(634))/6)+-parseInt(e(536))/7+parseInt(e(560))/8*(parseInt(e(627))/9)+-parseInt(e(682))/10+-parseInt(e(449))/11==932877)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();const Zi=Ls[Fi(626)],Ni=Ls[Fi(602)],Vi=Ls[Fi(498)],Ui=Ls[Fi(637)],Wi=Ls[Fi(579)],Gi=Ls.platform,Bi=Ls[Fi(673)],Xi=Ui||Wi&&Gi===Fi(564),zi=1e6*(Ni?82:Vi?220:120),Yi=Ni?5e3:2e3,$i=Ni?1.5:.5;class Ya{constructor(e){const t=Fi;this[t(545)]="",this.licenseUrl="",this[t(503)]="",this[t(669)]=[],this[t(497)]=function e(t){const r=Fi;return typeof t!==r(692)||null===t||t instanceof Element||t instanceof De?t:function(e){const t=Fi;return!!((null==e?void 0:e[t(515)])instanceof ArrayBuffer&&null!=e&&e[t(683)])}(t)?t[r(559)]():Array[r(563)](t)?t[r(454)]((t,r,n)=>(t[n]=e(r),t),[]):t instanceof Object?Object[r(638)](t)[r(454)]((r,n)=>(r[n]=e(t[n]),r),{}):t}(e),this[t(664)]=null,this[t(521)]=0,this[t(571)]=Date.now(),this.videoStartTimestamp=0,this.audioStartTimestamp=0,this.prevSeqNum=-1,this[t(596)]=0,this[t(624)]=0,this.keyFrameNeeded=!0,this.keyFrameNeededPosted=!1,this.keyFrameRequestInterval=Yi,this.worker=null}}const Ki=new Map,Hi=new Uint8Array([60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60]),Qi=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1]),qi=new Uint8Array([213,251,214,184,46,217,62,78,249,138,228,9,49,238,51,183]);function eo(e){const t=Fi;let r=!1;if((e[t(497)].video&&"clear"!==e[t(497)].video[t(619)]&&"HW"===e.config[t(471)][t(554)]||e[t(497)][t(463)]&&e[t(497)][t(463)].encryption!==t(670)&&"HW"===e[t(497)][t(463)][t(554)])&&(r=!0),e.hwSecurity=r,function(e,t){const r=Fi;void 0!==t&&(e[r(497)][r(482)]=t),(void 0===e[r(497)][r(482)]||e[r(497)].mediaBufferMs<0)&&(e.config[r(482)]=100,Ni?e[r(497)][r(482)]=350:!Vi&&Bi&&(e[r(497)][r(580)]===r(566)||e[r(461)])&&(e[r(497)][r(482)]=1400))}(e,e[t(497)][t(482)]),void 0===e.config.authToken){void 0===e.config[t(450)]&&(e[t(497)][t(450)]=t(525)),void 0===e[t(497)][t(551)]&&(e.config[t(551)]=t(507));const r=window[t(641)](JSON.stringify({userId:e.config[t(450)],sessionId:e[t(497)][t(551)],merchant:e.config[t(574)]}));Ai(t(604),r)}else Ai(t(516),e.config[t(462)]);for(const r of[e[t(497)].audio,e[t(497)][t(471)]])r&&r[t(619)]!==t(670)&&(r[t(646)]||(r[t(646)]=Qi),r.iv||(r.iv=qi));e[t(546)]=void 0,e[t(545)]="",e[t(466)]="";const n=e.config[t(526)][t(470)]();var s;if(e[t(497)][t(580)]===t(549)?(e.keySystem=t(603),xi=Hi):e.config.type===t(459)?(e[t(503)]="com.widevine.alpha",Bi&&r&&(e[t(503)]+=t(599)),e.config.wvCertificate?e[t(546)]=e[t(497)][t(506)]:e[t(497)][t(610)]?e[t(545)]=e[t(497)][t(610)]:e[t(546)]=e.config[t(526)][t(678)](),e.config.wvLicenseUrl?e[t(466)]=e[t(497)].wvLicenseUrl:e[t(466)]=n+t(681)):e[t(497)][t(580)]===t(566)?(e[t(503)]=t(616),e[t(497)][t(679)]?e.licenseUrl=e[t(497)][t(679)]:e[t(466)]=n+t(542)):e[t(497)].type===t(575)&&(e.keySystem="com.apple.fps",e.config[t(477)]?e[t(546)]=e[t(497)][t(477)]:e[t(497)][t(535)]?e.serverCertificateUrl=e.config[t(535)]:e[t(545)]=n+t(479)+e[t(497)].merchant,e[t(497)][t(680)]?e[t(466)]=e.config.fpsLicenseUrl:e.licenseUrl=n+t(578)),s={licenseUrl:e[t(466)],onFetch:e.config[t(645)]},yi=s,e[t(669)]=[],e.config[t(580)]!==t(575)){e[t(669)][t(465)]({initDataTypes:[t(668)],sessionTypes:["persistent-license",t(529)]});for(const r of[e[t(497)][t(471)],e[t(497)][t(463)]])if(r&&r.encryption!==t(670)){const n=r==e[t(497)][t(471)]?t(471):t(463);let s;e[t(497)][t(580)]===t(459)?s="HW"===r[t(554)]?t(513):t(685):"PlayReady"===e[t(497)][t(580)]&&(s="HW"===r.robustness?t(474):t(508)),n===t(471)?e[t(669)][0][t(527)]=[{contentType:'video/mp4; codecs="avc1.640032"',encryptionScheme:"cenc"===r[t(619)]?t(668):"cbcs-1-9",robustness:s||void 0}]:e[t(669)][0][t(595)]=[{contentType:t(691),encryptionScheme:r[t(619)]===t(668)?"cenc":t(671),robustness:s||void 0}]}}else e[t(669)]=[{initDataTypes:[t(630)],videoCapabilities:[{contentType:t(562),robustness:""}],distinctiveIdentifier:"not-allowed",persistentState:t(639),sessionTypes:["temporary"]}];window[t(600)]&&console.info(t(480),e)}function to(e){const t=Fi;window[t(600)]&&console[t(556)](t(581));let r=e[t(497)].videoElement;(!e[t(497)][t(471)]||e.config[t(471)][t(619)]===t(670))&&(r=e.config.audioElement),e[t(664)]=null;const n=!e.ignoreAudio&&e[t(497)][t(463)]&&"clear"!==e[t(497)].audio[t(619)],s=e[t(497)][t(471)]&&e.config.video[t(619)]!==t(670);e[t(624)]=0,e[t(608)]=!0,e.keyFrameNeededPosted=!1,e[t(509)]=Yi,e[t(652)]=0,e[t(650)]=0,e[t(597)]=-1,e[t(596)]=0,e.jmuxer=new Tn({node:r,mode:n?t(s?663:463):"video",fps:60,drm:e}),Vi&&e[t(497)].videoElement&&e[t(497)][t(689)][t(448)]()[t(684)](()=>{})[t(476)](()=>{})}function ro(e,t,r){const n=Fi;if(e[n(497)][n(471)]&&"clear"===e.config[n(471)][n(619)])return null==r||r[n(632)](t),!1;const s=Date[n(591)]();if(t.type===n(611)){const r=window[n(600)];++e[n(521)]<(r?Number[n(478)]:5)&&(console[n(556)]((new Date)[n(552)]().slice(11,-1)+" "+t[n(580)]+", "+(t[n(496)].byteLength+n(455)+e[n(497)][n(689)][n(625)])),r&&1===e[n(521)]&&function(e,t=64,r=64){const n=Fi,s=new Uint8Array(e[n(496)]);let i="",o=0;for(let e=0;e<t&&e<s[n(584)];++e)i+=(s[e]<16?"0":"")+s[e].toString(16)+" ";if(o<s[n(584)])for(o<s[n(584)]-r&&(i+=n(532),o=s[n(584)]-r);o<s[n(584)];o++)i+=(s[o]<16?"0":"")+s[o][n(621)](16)+" ";console.info("["+((e[n(580)]||n(463))+n(561))+n(569)+i[n(472)]())}(t,128,8)),e[n(608)]=!1,e[n(624)]=0,e[n(571)]=s+e[n(509)]}return e[n(624)]+=t.data[n(523)],!e[n(608)]&&e[n(624)]>zi&&(console[n(556)](n(585)),e[n(608)]=!0),e.jmuxer&&(function(e,t){const r=Fi;0===e[r(652)]&&(e[r(652)]=t[r(667)],e[r(509)]=Yi,e[r(571)]=Date[r(591)]()+2e3);let n=null,s=!1;if(t.data[r(523)]<=4)console[r(495)](r(613)),s=!0;else{const i=new Uint8Array(t[r(496)],0,4);0!=i[0]||0!=i[1]||0!=i[2]||1!=i[3]?(console[r(495)](r(489)),s=!0):(n=function(e,t){const r=Qs,n=new DataView(e[r(335)]),s=e.data[r(346)]-2,i=n[r(340)](s);if(i<s){let e=s-i;if(69!==n[r(337)](s-1))return console[r(341)](r(339)),null;if(n.getUint8(e++)>>>4!=1)return console[r(341)](r(329)),null;const o=new Uint8Array(i-2);let a=0,c=0;for(;e<s-1;){let t=n.getUint8(e++);c>1&&3===t&&(c=0,t=n.getUint8(e++)),0!==t?c=0:++c,o[a++]=t}const l=new DataView(o[r(343)]),u=t===r(327)?16:0,d=u+2+6*l.getUint16(u);return d+2>a?(console.error(r(325)),null):{sai:o[r(345)](0,d),offset:s-i,seq:l.getUint16(d)}}return null}(t,e[r(497)][r(471)][r(619)]),!n&&(console.warn(r(636)),s=!0))}if(n)if(-1===e[r(597)]){if(t[r(580)]!==r(611))return 0;e[r(597)]=n[r(547)]}else{let i=n.seq-e[r(597)];if(i<-32767&&(i+=65536),i<=0)return window[r(600)]&&console[r(495)](r(654)+e[r(597)]+", curr: "+n[r(547)]),0;i>1&&(s=t[r(580)]!==r(611),console[r(495)](r(570)+e[r(597)]+r(502)+n[r(547)]+r(541)+s)),e.prevSeqNum=n[r(547)]}let i=0;s&&!e[r(664)][r(458)]&&(i=-1,e[r(664)][r(644)]());const o=(t[r(667)]-e[r(652)])/9e4;return n&&e[r(664)][r(522)]({video:new Uint8Array(t.data,0,n[r(456)]),videoSampleAuxInfo:n[r(612)],timestamp:o})<0&&(i=-1,console[r(495)](r(573)),to(e)),i>=0&&"key"===t[r(580)]&&(e[r(596)]=o,console[r(483)]((new Date)[r(552)]()[r(559)](11,-1)+" kf at "+o+", playback at "+e[r(497)].videoElement[r(625)])),i}(e,t)<0?e[n(608)]=!0:function(e){const t=Fi,r=e.config[t(689)];if(!r||r[t(501)][t(584)]<1||r[t(505)]||r[t(625)]<$i)return;const n=e[t(497)].mediaBufferMs;if(void 0===n||n<0)throw new Error("targetLatency not set!");const s=r[t(501)][t(565)](r[t(501)][t(584)]-1),i=1e3*(s-r[t(625)])|0;if(!e[t(649)]&&function(e,t,r){const n=Fi;let s;s=t<3*r>>>2?.875:t<=r?1:t<7*r>>>2?1.125:t<9*r>>>2?1.25:t<11*r>>>2?1.375:1.5,s!==e.playbackRate&&(e[n(606)]=s)}(r,i,n),!(i<n+50||i<5*n>>>2))if(e.lastKeyFrameTime>r[t(625)]+.1){const i=1e3*(s-e[t(596)])|0;i>40&&i>n-100?(window[t(600)]&&console.info((new Date).toISOString().slice(11,-1)+t(598)+(r[t(625)]+t(592)+e[t(596)]+" (")+(e.lastKeyFrameTime-r[t(625)])+")"),r[t(625)]=e[t(596)]):console[t(483)]((new Date)[t(552)]().slice(11,-1)+t(534)+i)}else!e[t(608)]&&Date[t(591)]()>e[t(571)]&&i>n+100&&i>3*n>>>1&&(window[t(600)]&&console[t(556)]((new Date).toISOString()[t(559)](11,-1)+t(490)+i+" ms)"),e[t(608)]=!0,e[t(509)]<16e3&&(e[t(509)]<<=1))}(e)),r?(!e[n(608)]||!Xi)&&(t[n(496)]=function(e){return!oi&&function(){const e=si;oi=new Uint8Array([0,0,0,1,65,154,255,255]).buffer,ii[e(303)](new Uint8Array([0,0,0,1,39,100,0,13,172,87,5,6,100,0,0,0,1,40,238,60,176,0,0,0,1,37,184,32,0,203,255,38,29,217,24,192,161,96,0,0,12,229,174,166,6,7,20,3,84,0,247,96,193,181,229,128,0,32,32])[e(306)]),ii[e(303)](ii[0][e(299)](0)),new Uint8Array(ii[1]).set([16,0,50],27)}(),e?oi:(li^=1,ii[li])}(e[n(608)]),r[n(632)](t)):e[n(608)]!=e[n(445)]&&(e.worker&&e[n(544)][n(660)](e[n(608)]),e[n(445)]=e[n(608)]),e[n(608)]}function no(e,t){const r=ji();return(no=function(e,t){return r[e-=445]})(e,t)}function so(e,t,r){const n=Fi;return e[n(497)][n(463)]&&e[n(497)].audio[n(619)]!==n(670)?t[n(496)][n(523)]>0&&function(e,t){const r=Fi;var n;if(!e.jmuxer||e[r(538)])return 0;0===e[r(650)]&&(e[r(650)]=t[r(667)]);const s=(t[r(667)]-e.audioStartTimestamp)/48e3;if("cbcs"===(null===(n=e.config[r(463)])||void 0===n?void 0:n[r(619)]))return e[r(664)][r(522)]({audio:new Uint8Array(t[r(496)]),timestamp:s});const i=function(e){const t=Qs,r=new DataView(e.data),n=e.data[t(346)]-2,s=r.getUint16(n);if(s<n){let e=n-s;if(69!==r[t(337)](n-1))return console[t(341)](t(339)),null;if(r[t(337)](e++)>>>4!=1)return console[t(341)](t(329)),null;const i=new Uint8Array(s-2);let o=0;for(;e<n-1;){const n=r[t(337)](e++);if(i[o++]=n,o>=16)break}return{sai:i,offset:n-s}}return null}(t);i?e[r(664)][r(522)]({audio:new Uint8Array(t[r(496)],0,i[r(456)]),audioSampleAuxInfo:i[r(612)],timestamp:s}):console[r(511)]("SampleAuxInfo extraction failed (audio)")}(e,t):r&&r[n(632)](t),!1}function io(e){const t=Fi;if(!e||typeof e!==t(692))throw new TypeError("Invalid config argument type, DRM config must be an object.");if(!(e[t(689)]instanceof HTMLVideoElement))throw new TypeError(t(633));if(e[t(628)]&&!(e.audioElement instanceof HTMLMediaElement))throw new TypeError(t(693));if(void 0!==e[t(482)]&&!Number[t(555)](e[t(482)]))throw new TypeError(t(460));let r=!1,n=!1,s=!1;const i=["cbcs",t(668),t(670)],o=["SW","HW"];for(const a of[e[t(471)],e[t(463)]])if(a){if(!i[t(557)](a[t(619)]))throw new RangeError("DRM config encryption value must be one of: "+i[t(593)](", "));if(Vi&&"cenc"===a.encryption)throw new RangeError(t(688));if(a[t(619)]!==t(670)){if(n=!0,a.keyId){if(!(a[t(646)]instanceof Uint8Array)||16!==a.keyId[t(584)])throw new TypeError("DRM config keyId must be an instance of 16-byte long Uint8Array.");s=!0}else if(Vi)throw new ReferenceError(t(655));if(a.iv&&(!(a.iv instanceof Uint8Array)||16!==a.iv.length))throw new TypeError(t(618));if(a[t(554)]&&!o[t(557)](a.robustness))throw new RangeError(t(658)+o[t(593)](", "));if(a===e[t(471)]&&a[t(484)]!==t(537))throw new RangeError(t(615));Vi&&a===e.audio&&"opus"===a.codec&&(r=!0,console.warn("Safari does not support Opus, audio will not be rendered.")),"PlayReady"===e[t(580)]&&(a[t(619)]!==t(668)&&console[t(495)](t(491)+a[t(619)]+"', it's safer to use 'cbcs' instead."),void 0===e.sessionId||e.sessionId[t(557)]("f1")||console.warn(t(674)+e.sessionId+t(643)))}}if(n){const r=[De[t(558)],De.Staging,De[t(665)]];if(!r.includes(e[t(526)]))throw new RangeError(t(583)+r.join(", "));if(e[t(462)]&&typeof e[t(462)]!==t(533))throw new TypeError("Invalid authToken type ("+typeof e[t(462)]+t(530));if(e.type)if(Vi){if(e[t(580)]!==t(575))throw new RangeError(t(514)+e[t(580)]+"). Safari only supports FairPlay.")}else if(Wi){if(e.type!==t(459)&&"ClearKey"!==e[t(580)])throw new RangeError("Invalid DRM type ("+e.type+t(675))}else if(Ui&&e[t(580)]!==t(566)&&"Widevine"!==e[t(580)]&&"ClearKey"!==e[t(580)])throw new RangeError(t(514)+e.type+t(648))}void 0!==e.debugLog&&(window[t(600)]=e.debugLog),void 0!==e[t(446)]&&(window[t(517)]=e[t(446)]);let a=Ki.get(e[t(689)]);!a&&(a=new Ya(e),Ki[t(494)](e[t(689)],a)),a.enabled=n,a[t(538)]=r,a[t(649)]=!r&&a[t(497)][t(463)]&&a[t(497)].audio.encryption!==t(670),n&&(a[t(497)].type||(a[t(497)][t(580)]=t(Vi?575:459)),s||a[t(497)][t(580)]===t(549)||(a[t(497)][t(580)]=t(549)),eo(a),function(e){ys(this,void 0,void 0,(function*(){const t=no;var r,n;let s=e[t(497)][t(689)];if((!e[t(497)][t(471)]||e[t(497)][t(471)].encryption===t(670))&&(s=e[t(497)][t(628)]),!s)throw new Error(t(492));s.src="",s[t(588)]=null,yield s.setMediaKeys(null);let i=null;try{i=yield navigator[t(528)](e[t(503)],e.emeConfig)}catch(e){}if(!i&&e[t(669)][0]){const s=null===(r=e[t(669)][0][t(647)])||void 0===r?void 0:r[t(553)](t(659));if(void 0!==s&&s>=0){null===(n=e.emeConfig[0].sessionTypes)||void 0===n||n[t(687)](s,1);try{i=yield navigator[t(528)](e[t(503)],e[t(669)])}catch(e){}}}if(!i){const r=t(576)+e[t(503)]+t(520);return s.dispatchEvent(new CustomEvent(t(640),{detail:{message:r}})),void console[t(511)](r)}let o=null;try{o=yield i.createMediaKeys()}catch(e){}if(!o){const r=t(540)+e[t(503)]+t(520);return s[t(453)](new CustomEvent("rtcdrmerror",{detail:{message:r}})),void console[t(511)](r)}if(e.serverCertificate)window.clRtcDrmDebugLog&&console[t(556)](t(487)+e[t(546)][t(523)]+t(464)),yield o[t(594)](e[t(546)]);else if(e.serverCertificateUrl){const r={method:t(469)},n=e.serverCertificateUrl;try{const i=yield e[t(497)].onFetch?e.config[t(645)](n,r):fetch(n,r);if(!i.ok){const e=t(601)+i[t(623)];return void s[t(453)](new CustomEvent(t(640),{detail:{message:e}}))}const a=yield i[t(457)]();window.clRtcDrmDebugLog&&console[t(556)]("Fetched certificate from "+n+", "+a[t(523)]+" bytes"),yield o[t(594)](a)}catch(e){const r=e.name+": "+e[t(622)];return console.error(r),void s[t(453)](new CustomEvent(t(640),{detail:{message:r}}))}}yield s[t(500)](o),s[t(519)]("encrypted",Di),to(e)}))}(a)),a[t(497)][t(689)][t(519)](t(448),(function(){const e=t;a[e(497)][e(689)][e(625)]>.5&&(a[e(571)]=Date.now())}))}const oo=Fi(582)+Fi(587)+Fi(548)+Fi(653)+Fi(590)+Fi(620)+Fi(614)+Fi(504)+Fi(518)+Fi(452)+Fi(642)+Fi(686)+"meNeeded=$.data};";function ao(e){const t=Fi;if(0===Ki[t(677)])throw new TypeError(t(550));let r;if(e&&e[t(689)])r=e[t(689)];else{if(1!==Ki.size)throw new TypeError(t(510));r=Ki[t(638)]()[t(447)]()[t(531)]}const n=Ki[t(662)](r);if(!n){let e="";throw Ki[t(499)]((t,r)=>{e+=r.id+", "}),e=e.slice(0,-2),new TypeError(t(486)+r.id+t(657)+e+"]")}return n}function co(e,t){const r=Fi;if(e&&e[r(497)][r(689)]){const n=e[r(497)][r(689)];if(n[r(501)].length>0){const e=n.buffered[r(565)](n[r(501)][r(584)]-1)-n[r(625)];t.playoutDelayHint=t.jitterBufferDelayHint=t.jitterBufferTarget=e}setTimeout(co,1e3,e,t)}}const lo=_e.get("View");lo.setLevel(_e.DEBUG);const uo={metadata:!1,enableDRM:!1,disableVideo:!1,disableAudio:!1,peerConfig:{autoInitStats:!0,statsIntervalMs:1e3}};class cc extends bi{constructor(e,t,r=null,n=!0){e&&lo.warn("The streamName property has been deprecated. In a future release, this will be removed. Please do not rely on this value. Instead, set via token generator"),super(null,t,lo,n),this.payloadTypeCodec={},this.tracksMidValues={},this.drmOptionsMap=null,this.eventQueue=[],this.isMainStreamActive=!1,r&&(this.on(Cn.track,e=>{r.srcObject=e.streams[0]}),lo.warn("The mediaElement property has been deprecated. In a future release, this will be removed. Please do not rely on this value. Instead, do this in either the `track` or the `active` broadcast event."))}async connect(e=uo){this.options=V(N(N({},uo),e),{peerConfig:N(N({},uo.peerConfig),e.peerConfig),setSDPToPeer:!1}),this.eventQueue.length=0,await this.initConnection({migrate:!1})}async select(e={}){lo.debug("Viewer select layer values: ",e),await this.signaling.cmd("select",{layer:e}),lo.info("Connected to streamName: ",this.streamName)}async addRemoteTrack(e,t){lo.info("Viewer adding remote track",e);const r=await this.webRTCPeer.addRemoteTrack(e,t);for(const e of t)e.addTrack(r.receiver.track);return r}async project(e,t){for(const e of t){if(!e.trackId&&!e.media)throw lo.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=this.webRTCPeer.getRTCPeer();if(e.mediaId&&!t.getTransceivers().find(t=>t.mid===e.mediaId.toString()))throw lo.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"))}lo.debug("Viewer project source: layer mappings: ",e,t),await this.signaling.cmd("project",{sourceId:e,mapping:t}),lo.info("Projection done")}async unproject(e){lo.debug("Viewer unproject mediaIds: ",e),await this.signaling.cmd("unproject",{mediaIds:e}),lo.info("Unprojection done")}async replaceConnection(){lo.info("Migrating current connection"),await this.initConnection({migrate:!0})}stop(){var e,t;super.stop(),null==(e=this.drmOptionsMap)||e.clear(),this.DRMProfile=null,null==(t=this.worker)||t.terminate(),this.worker=null,this.payloadTypeCodec={},this.tracksMidValues={},this.eventQueue.length=0}async initConnection(e){var t;let r,n;if(lo.debug("Viewer connect options values: ",this.options),this.stopReconnection=!1,!e.migrate&&this.isActive())throw lo.warn("Viewer currently subscribed"),new Error("Viewer currently subscribed");try{n=await this.tokenGenerator(),this.options.peerConfig.iceServers=null==n?void 0:n.iceServers,this.options.peerConfig.encodedInsertableStreams=ls&&(this.options.enableDRM||this.options.metadata)}catch(e){throw lo.error("Error generating token."),e instanceof mr&&(401!==e.status&&this.autoReconnect?this.reconnect():this.stopReconnection=!0),e}if(!n)throw lo.error("Error while subscribing. Subscriber data required"),new Error("Subscriber data required");const s=ss(n.jwt);this.streamName=s.millicast.streamName;const i=new mi({streamName:this.streamName,url:"".concat(n.urls[0],"?token=").concat(n.jwt)});n.subscriberToken&&(this.subscriberToken=n.subscriberToken);const o=e.migrate?new tt:this.webRTCPeer;await o.createRTCPeer(this.options.peerConfig),null==(t=this.stopReemitingWebRTCPeerInstanceEvents)||t.call(this),this.stopReemitingWebRTCPeerInstanceEvents=$e(o,this,Object.values(Cn).filter(e=>e!==Cn.track)),this.options.metadata&&(this.worker||(this.worker=new fs),this.worker.onmessage=e=>{if("metadata"===e.data.event){const t=new TextDecoder,r=e.data.metadata;if(r.mid=e.data.mid,r.track=this.tracksMidValues[e.data.mid],r.uuid){const e=r.uuid;r.uuid=e.reduce((e,t)=>e+t.toString(16).padStart(2,"0"),""),r.uuid=r.uuid.replace(/(.{8})(.{4})(.{4})(.{4})(.{12})/,"$1-$2-$3-$4-$5")}if(r.timecode&&(r.timecode=new Date(t.decode(r.timecode))),r.unregistered){const e=t.decode(r.unregistered);try{const t=JSON.parse(e);r.unregistered=t}catch(e){lo.info("The content could not be converted to JSON, returning raw bytes instead")}}this.emit("metadata",r),this.emit("onMetadata",r)}}),o.on(Cn.track,e=>{this.isMainStreamActive?this.onTrackEvent(e):this.eventQueue.push(e)}),i.on(Bn,async e=>{if(this.isMainStreamActive||"active"!==e.name)"inactive"===e.name&&this.isMainStreamActive&&this.mainSourceId===e.data.sourceId&&(this.isMainStreamActive=!1),this.emit(Bn,e);else{if(this.mainSourceId=e.data.sourceId,!this.DRMProfile&&e.data.encryption){const e=await this.tokenGenerator();e.drmObject&&(this.DRMProfile=e.drmObject)}for(this.emit(Bn,e),this.isMainStreamActive=!0;this.eventQueue.length>0;)this.onTrackEvent(this.eventQueue.shift())}});const a=o.getRTCLocalSDP(V(N({},this.options),{stereo:!0})),c=i.connect();r=await Promise.all([a,c]);const l=r[0];let u=this.signaling;this.signaling=i;const d=this.signaling.subscribe(l,V(N({},this.options),{vad:this.options.multiplexedAudioTracks>0})),h=o.peer.setLocalDescription(o.sessionDescription);r=await Promise.all([d,h]);const f=r[0];this.payloadTypeCodec=vn.getCodecPayloadType(f),await o.setRTCRemoteSDP(f),lo.info("Connected to streamName: ",this.streamName);let p=this.webRTCPeer;this.webRTCPeer=o,this.setReconnect(),e.migrate&&this.webRTCPeer.on(Cn.connectionStateChange,e=>{var t,r;"connected"===e?setTimeout(()=>{var e,t;null==(e=null==u?void 0:u.close)||e.call(u),null==(t=null==p?void 0:p.closeRTCPeer)||t.call(p),u=p=null,lo.info("Current connection migrated")},1e3):["disconnected","failed","closed"].includes(e)&&(null==(t=null==u?void 0:u.close)||t.call(u),null==(r=null==p?void 0:p.closeRTCPeer)||r.call(p),u=p=null)})}onTrackEvent(e){var t,r,n;if(this.tracksMidValues[null==(t=e.transceiver)?void 0:t.mid]=e.track,this.isDRMOn){const t=e.transceiver.mid,r=this.getDRMConfiguration(t);try{!function(e,t){const r=Fi;var n,s;const i=e[r(629)][r(524)];"video"===i&&(e[r(661)][r(475)]=e[r(661)][r(451)]=e[r(661)][r(605)]=0);const o=ao(t),a=o[r(497)].videoElement,c=o[r(497)][r(628)];if(o[r(607)]){if(o[r(497)].customTransform)window.clRtcDrmDebugLog&&console[r(556)](r(468)+r(572));else if(window[r(600)]&&console[r(556)](r(467)+(r(Zi?589:609)+r(617))),Zi){if(o[r(544)]=function(e){const t=Fi,r=window[t(493)]||window[t(488)],n=window[t(666)],s=window[t(586)];if(!(r&&n&&s&&e))return null;const i=new n([e]);return new s(r[t(631)](i))}(oo),null==o[r(544)])throw new Error(r(539));o[r(544)][r(485)]=e=>{const t=r;e[t(496)][t(567)]===t(471)?ro(o,e[t(496)].frame,null):so(o,e[t(496)][t(651)],null)},e[r(661)].transform=new RTCRtpScriptTransform(o.worker,{operation:i})}else{const t=i===r(471)?ro:so,n={drm:o,transform:(e,r)=>{t(o,e,r)}},s=e.receiver.createEncodedStreams(),a=new TransformStream({transform:n.transform[r(656)](n)}),{readable:c,writable:l}=s;c[r(577)](a)[r(635)](l)}if("audio"===i&&(null===(n=o[r(497)][r(463)])||void 0===n?void 0:n.encryption)===r(670)){if(!c)return void console.warn(r(690));c[r(588)]!==e[r(481)][0]&&(c[r(588)]=e[r(481)][0]),o[r(497)].videoElement&&(e[r(661)][r(475)]=e[r(661)].jitterBufferDelayHint=e[r(661)][r(605)]=o[r(497)][r(482)],co(o,e[r(661)]))}else"video"===i&&"clear"===(null===(s=o.config[r(471)])||void 0===s?void 0:s[r(619)])&&a[r(588)]!==e[r(481)][0]&&(a.srcObject=e.streams[0])}else a[r(588)]!==e[r(481)][0]&&(a.srcObject=e[r(481)][0])}(e,r)}catch(e){lo.error("Failed to apply DRM on media Id:",t,"error is: ",e),this.emit("error",new Error("Failed to apply DRM on media Id: "+t+" error is: "+e))}this.worker||(this.worker=new fs),this.worker.addEventListener("message",e=>{"complete"===e.data.event&&function(e,t,r){const n=Fi,s=ao(r);e[n(580)]?ro(s,e,t):so(s,e,t)}(e.data.frame,null,r)})}if(this.options.metadata)if(us)e.receiver.transform=new RTCRtpScriptTransform(this.worker,{name:"receiverTransform",payloadTypeCodec:N({},this.payloadTypeCodec),codec:this.options.metadata&&"h264",mid:null==(r=e.transceiver)?void 0:r.mid});else if(ls){const{readable:t,writable:r}=e.receiver.createEncodedStreams();this.worker.postMessage({action:"insertable-streams-receiver",payloadTypeCodec:N({},this.payloadTypeCodec),codec:this.options.metadata&&"h264",mid:null==(n=e.transceiver)?void 0:n.mid,readable:t,writable:r},[t,r])}this.emit(Cn.track,e)}getDRMConfiguration(e){return this.drmOptionsMap?this.drmOptionsMap.get(e):null}async onRtcDrmFetch(e,t){return t.headers||(t.headers=new Headers),t.headers.get("x-dt-custom-data")&&t.headers.delete("x-dt-custom-data"),this.subscriberToken?t.headers.append("Authorization","Bearer ".concat(this.subscriberToken)):lo.warn("onRtcDrmFetch: no subscriberToken"),fetch(e,t)}configureDRM(e){if(!e)throw new Error("Required DRM options is not provided");this.drmOptionsMap||(this.drmOptionsMap=new Map);const t={merchant:"dolby",environment:De.Production,customTransform:this.options.metadata,videoElement:e.videoElement,audioElement:e.audioElement,video:{codec:"H264",encryption:"cbcs",keyId:ms(e.videoEncryptionParams.keyId),iv:ms(e.videoEncryptionParams.iv)},audio:{codec:"opus",encryption:"clear"},onFetch:this.onRtcDrmFetch.bind(this)};e.mediaBufferMs&&(t.mediaBufferMs=e.mediaBufferMs),this.DRMProfile&&(this.DRMProfile.playReadyUrl&&(t.prLicenseUrl=this.DRMProfile.playReadyUrl),this.DRMProfile.widevineUrl&&(t.wvLicenseUrl=this.DRMProfile.widevineUrl),this.DRMProfile.fairPlayUrl&&(t.fpsLicenseUrl=this.DRMProfile.fairPlayUrl),this.DRMProfile.fairPlayCertUrl&&(t.fpsCertificateUrl=this.DRMProfile.fairPlayCertUrl));try{io(t),this.drmOptionsMap.set(e.videoMid,t),e.audioMid&&this.drmOptionsMap.set(e.audioMid,t),t.videoElement.addEventListener("rtcdrmerror",e=>{lo.error("DRM error: ",e.detail.message,"in video element:",t.videoElement.id),this.emit("error",new Error(e.detail.message))})}catch(t){lo.error("Failed to configure DRM with options:",e,"error is:",t)}}removeDRMConfiguration(e){var t;null==(t=this.drmOptionsMap)||t.delete(e)}get isDRMOn(){return!!this.drmOptionsMap&&this.drmOptionsMap.size>0}exchangeDRMConfiguration(e,t){const r=this.getDRMConfiguration(e),n=this.getDRMConfiguration(t);if(null===r)throw new Error("No DRM configuration found for "+e);if(null===n)throw new Error("No DRM configuration found for "+t);gs(r.video,n.video,"keyId"),gs(r.video,n.video,"iv");try{io(r)}catch(e){lo.error("Failed to configure DRM with options:",r,"error is:",e)}try{io(n)}catch(e){lo.error("Failed to configure DRM with options:",n,"error is:",e)}}}var ho,fo=Object.freeze({__proto__:null,STATUS:"rts/status",VIEWER_COUNT:"rts/viewer-count",STATS:"rts/stats"});!function(e){e[e.Idle=0]="Idle",e[e.Receiving=1]="Receiving",e[e.Starting=2]="Starting"}(ho||(ho={}));class MillicastAdapter{static wants(e){return e.type==MillicastAdapter.Type}constructor(e,r,n=t("rts/millicast"),s=ho.Starting){this.player=e,this.src=r,this.log=n,this.status=s,Jn.setEndpoint("https://realtime1.wowza.com"),this.hasReportedError=!1,this.player.on("quality:set",e=>{var t;if(!this.engine||!this.engine.isActive())return;const r=e.detail;null===(t=this.engine)||void 0===t||t.select(r)}),this.player.on("tracks:video:select",e=>{var t;if(!this.engine||!this.engine.isActive())return;const r=e.detail.track,n=null===(t=this.player.tracks)||void 0===t?void 0:t.find(e=>e.selected&&e!==r);n&&(n.selected=!1),this.engine.project("Main"===r.label?"":r.label,r.data.tracks)})}async load(){this.log("loading",this.src.streamName);this.engine=new cc(this.src.streamName,()=>Jn.getSubscriber(Object.assign(Object.assign({},this.src),{streamAccountId:"dev"in this.src?"3caeCP":"bUEzT6"})),this.player,!1),this.player.original_src=MillicastAdapter.WOWZA_DIRECTOR_ENDPOINT+"/"+this.src.streamName,this._observe(),await this.connect()}retry(){!1!==this.player.opts.retry&&setTimeout(()=>{0!=this.player.reaper&&this.engine&&this.connect()},3e3)}async connect(){try{await this._connect(),this.player.emit("recover")}catch(e){if(this.log("Connection failed",e),this.retry(),this.hasReportedError)return;this.player.emit("error",e),this.hasReportedError=!0}}stop(){var e;null===(e=this.engine)||void 0===e||e.stop(),this.engine=void 0}_handleViewerCount(e){"number"==typeof e&&this.player.emit("rts/viewer-count",{viewerCount:e})}_handleActive(e){this.player.hasState("is-error")&&this.player.emit("recover"),this.status=ho.Receiving,this.player.emit("rts/status",{status:ho.Receiving,data:e})}_handleInactive(){this.status=ho.Idle;const e={status:ho.Idle,message:this.player.i18n("rts.millicast.inactive","broadcast has become inactive")};this.player.emit("rts/status",e),this.player.emit("error",Object.assign({fatal:!1},e))}_handleQualityLayers(e){var t,r;const n=null===(t=e[0])||void 0===t?void 0:t.layers;if(n&&Array.isArray(n)&&n.every(e=>void 0!==e.encodingId)){if(n[0].encodingId===(null===(r=this.layers)||void 0===r?void 0:r[0].encodingId))return;return this.layers=n,this.player.emit("qualities",function(e){const t=e.map((e,t)=>Object.assign(Object.assign({},e),{name:e.height||"Level "+t})).sort((e,t)=>t.width-e.width);t.length>1&&t.push({name:"AUTO",width:0,height:0});return t}
18
+ function(e,t){var n=Jt,r=n.Buffer;function s(e,t){for(var n in e)t[n]=e[n]}function i(e,t,n){return r(e,t,n)}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?e.exports=n:(s(n,t),t.Buffer=i),i.prototype=Object.create(r.prototype),s(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 s=r(e);return void 0!==t?"string"==typeof n?s.fill(t,n):s.fill(t):s.fill(0),s},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 n.SlowBuffer(e)}}(Ht,Ht.exports);var un=Ht.exports.Buffer,dn=le.crypto||le.msCrypto;dn&&dn.getRandomValues?$t.exports=function(e,t){if(e>4294967295)throw new RangeError("requested too many random bytes");var n=un.allocUnsafe(e);if(e>0)if(e>65536)for(var r=0;r<e;r+=65536)dn.getRandomValues(n.slice(r,r+65536));else dn.getRandomValues(n);return"function"==typeof t?J.nextTick((function(){t(null,n)})):n}:$t.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")};const pn=$t.exports;let fn=class Js{constructor(e,t){this.ufrag=e,this.pwd=t,this.lite=!1,this.endOfCandidates=!1}clone(){const e=new Js(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}};fn.generate=function(e){const t=new fn,n=pn(8),r=pn(24);return t.ufrag=n.toString("hex"),t.pwd=r.toString("hex"),t.lite=e,t},fn.expand=function(e){if("ICEInfo"===e.constructor.name)return e;const t=new fn((e=e).ufrag,e.pwd);return t.setLite(e.lite),t.setEndOfCandidates(e.endOfCandidates),t},fn.clone=function(e){return"ICEInfo"===e.constructor.name?e.clone():fn.expand(e)};var hn=fn;const mn=Wt("SEND","RECV");mn.byValue=function(e){return mn[e.toUpperCase()]},mn.toString=function(e){switch(e){case mn.SEND:return"send";case mn.RECV:return"recv"}},mn.reverse=function(e){switch(e){case mn.SEND:return mn.RECV;case mn.RECV:return mn.SEND}};var gn=mn;const yn=gn;let vn=class ei{constructor(e,t){this.id=e,this.direction=t,this.formats=[],this.params=new Map}clone(){var e=new ei(this.id,this.direction);return e.setFormats(this.formats),e.setParams(this.params),e}plain(){var e={id:this.id,direction:yn.toString(this.direction)};for(var[t,n]of(this.formats&&(e.formats=this.formats),this.params.entries()))e.params||(e.params={}),e.params[t]=n;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)}};vn.expand=function(e){if("RIDInfo"===e.constructor.name)return e;const t=new vn((e=e).id,yn.byValue(e.direction));for(const[n,r]of Object.entries(e.params||{}))t.addParam(n,r);return e.formats&&t.setFormats(e.formats),t},vn.clone=function(e){return"RIDInfo"===e.constructor.name?e.clone():vn.expand(e)};var bn=vn;let wn=class ti{constructor(e,t){this.paused=t,this.id=e}clone(){return new ti(this.id,this.paused)}plain(){return{id:this.id,paused:this.paused}}isPaused(){return this.paused}getId(){return this.id}};wn.expand=function(e){return"SimulcastStreamInfo"===e.constructor.name?e:new wn((e=e).id,e.paused)},wn.clone=function(e){return"SimulcastStreamInfo"===e.constructor.name?e.clone():wn.expand(e)};var Sn=wn;const Rn=Sn,En=gn;let In=class ri{constructor(){this.send=[],this.recv=[]}clone(){const e=new ri;for(const t of this.send)e.addSimulcastAlternativeStreams(En.SEND,t.map(e=>e.clone()));for(const t of this.recv)e.addSimulcastAlternativeStreams(En.RECV,t.map(e=>e.clone()));return e}plain(){const e={send:[],recv:[]};for(const t of this.send)e.send.push(t.map(e=>e.plain()));for(const t of this.recv)e.recv.push(t.map(e=>e.plain()));return e}addSimulcastAlternativeStreams(e,t){return e===En.SEND?this.send.push(t):this.recv.push(t)}addSimulcastStream(e,t){return e===En.SEND?this.send.push([t]):this.recv.push([t])}getSimulcastStreams(e){return e===En.SEND?this.send:this.recv}};In.expand=function(e){if("SimulcastInfo"===e.constructor.name)return e;e=e;const t=new In;for(const n of e.send||[])t.addSimulcastAlternativeStreams(En.SEND,n.map(Rn.expand));for(const n of e.recv||[])t.addSimulcastAlternativeStreams(En.RECV,n.map(Rn.expand));return t},In.clone=function(e){return"SimulcastInfo"===e.constructor.name?e.clone():In.expand(e)};var kn=In;const xn=Wt("SENDRECV","SENDONLY","RECVONLY","INACTIVE");xn.byValue=function(e){return xn[e.toUpperCase()]},xn.toString=function(e){switch(e){case xn.SENDRECV:return"sendrecv";case xn.SENDONLY:return"sendonly";case xn.RECVONLY:return"recvonly";case xn.INACTIVE:return"inactive"}},xn.reverse=function(e){switch(e){case xn.SENDRECV:return xn.SENDRECV;case xn.SENDONLY:return xn.RECVONLY;case xn.RECVONLY:return xn.SENDONLY;case xn.INACTIVE:return xn.INACTIVE}};var Cn=xn;let Ln=class ni{constructor(e,t){this.port=e,this.maxMessageSize=t}clone(){return new ni(this.port,this.maxMessageSize)}plain(){return{port:this.port,maxMessageSize:this.maxMessageSize}}getPort(){return this.port}getMaxMessageSize(){return this.maxMessageSize}};Ln.expand=function(e){return"DataChannelInfo"===e.constructor.name?e:new Ln((e=e).port,e.maxMessageSize)},Ln.clone=function(e){return"DataChannelInfo"===e.constructor.name?e.clone():Ln.expand(e)};var An=Ln;const On=jt,Pn=bn,Nn=kn,Dn=Cn,Mn=gn,Fn=An;let Un=class Wr{constructor(e,t){this.id=e,this.type=t,this.direction=Dn.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 Wr(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,n]of this.extensions.entries())e.addExtension(t,n);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:Dn.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,n]of this.extensions.entries())e.extensions||(e.extensions={}),e.extensions[t]=n;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 Wr(this.id,this.type);if(e){t.setDirection(Dn.reverse(this.direction));const{codecs:n,dataChannel:r}=e;if(n){let r;r=Array.isArray(n)?On.MapFromNames(n,e.rtx,e.rtcpfbs):n;for(let e of this.codecs.values())for(let n of r.values()){if(n.getCodec().toLowerCase()!==e.getCodec().toLowerCase()||"h264"===n.getCodec()&&n.hasParam("packetization-mode")&&n.getParam("packetization-mode")!=e.getParam("packetization-mode","0")||"h264"===n.getCodec()&&n.hasParam("profile-level-id")&&e.hasParam("profile-level-id")&&n.getParam("profile-level-id")!=e.getParam("profile-level-id")||"multiopus"===n.getCodec()&&n.hasParam("num_streams")&&e.hasParam("num_streams")&&n.getParam("num_streams")!=e.getParam("num_streams"))continue;const r=n.clone();r.setType(e.getType()),r.hasRTX()&&r.setRTX(e.getRTX()),e.hasChannels()&&r.setChannels(e.getChannels()),r.addParams(e.getParams()),t.addCodec(r);break}}const s=new Set(e.extensions);for(let[e,n]of this.extensions)s.has(n)&&t.addExtension(e,n);if(e.simulcast&&this.simulcast){const e=new Nn,n=this.simulcast.getSimulcastStreams(Mn.SEND);if(n)for(const t of n){const n=t.map(e=>e.clone());e.addSimulcastAlternativeStreams(Mn.RECV,n)}const r=this.simulcast.getSimulcastStreams(Mn.RECV);if(r)for(const t of r){const n=t.map(e=>e.clone());e.addSimulcastAlternativeStreams(Mn.SEND,n)}for(const e of this.rids.values()){const n=e.clone();n.setDirection(Mn.reverse(e.getDirection())),t.addRID(n)}t.setSimulcast(e)}if(r&&this.dataChannel){const e=new Fn(this.dataChannel.getPort(),r.maxMessageSize?r.maxMessageSize:this.dataChannel.getMaxMessageSize());t.setDataChannel(e)}}else t.setDirection(Dn.INACTIVE);return t}getSimulcast(){return this.simulcast}setSimulcast(e){this.simulcast=e}};function jn(e){const t=e.toString();if(!/^\d+$/.test(t))throw new Error("invalid integer ".concat(t));return parseInt(t)}Un.create=function(e,t,n){!n&&"string"!=typeof t&&(n=t,t=e);const r=new Un(e,t);if(n){const{codecs:e}=n;e&&(Array.isArray(e)?r.setCodecs(On.MapFromNames(e,n.rtx,n.rtcpfbs)):r.setCodecs(e))}else r.setDirection(Dn.INACTIVE);return r},Un.expand=function(e){if("MediaInfo"===e.constructor.name)return e;const t=new Un((e=e).id,e.type);if(e.direction&&t.setDirection(Dn.byValue(e.direction)),t.setBitrate(e.bitrate),e.dataChannel){const n=Fn.expand(e.dataChannel);n&&t.setDataChannel(n)}for(const[n,r]of Object.entries(e.extensions))t.addExtension(jn(n),r);for(const n of e.codecs){const e=On.expand(n);e&&t.addCodec(e)}for(const n of e.rids||[]){const e=Pn.expand(n);t.addRID(e)}return e.simulcast&&t.setSimulcast(Nn.expand(e.simulcast)),e.control&&t.setControl(e.control),t},Un.clone=function(e){return"MediaInfo"===e.constructor.name?e.clone():Un.expand(e)};var Wn=Un;let Zn=class ai{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 ai(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}};Zn.expand=function(e){return"SourceGroupInfo"===e.constructor.name?e:new Zn((e=e).semantics,e.ssrcs)},Zn.clone=function(e){return"SourceGroupInfo"===e.constructor.name?e.clone():Zn.expand(e)};var Vn=Zn;let Gn=class ci{constructor(e){this.ssrc=e}clone(){const e=new ci(this.ssrc);return e.setCName(this.cname),e.setStreamId(this.streamId),e.setTrackId(this.trackId),e}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}};Gn.expand=function(e){if("SourceInfo"===e.constructor.name)return e;const t=new Gn((e=e).ssrc);return t.setCName(e.cname),t.setStreamId(e.streamId),t.setTrackId(e.trackId),t},Gn.clone=function(e){return"SourceInfo"===e.constructor.name?e.clone():Gn.expand(e)};var Bn=Gn;const Yn=jt;let Xn=class ui{constructor(e,t=!1){this.id=e,this.paused=t,this.codecs=new Map,this.params=new Map}clone(){var e=new ui(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,n]of this.codecs.entries())e.codecs[t]=n.plain();for(var[t,r]of this.params.entries())e.params[t]=r;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}};Xn.expand=function(e){if("TrackEncodingInfo"===e.constructor.name)return e;const t=new Xn((e=e).id,e.paused);for(const n of Object.values(e.codecs||{}))t.addCodec(Yn.expand(n));for(const[n,r]of Object.entries(e.params||{}))t.addParam(n,r);return t},Xn.clone=function(e){return"TrackEncodingInfo"===e.constructor.name?e.clone():Xn.expand(e)};var zn=Xn;const Kn=Vn,$n=zn;let Hn=class di{constructor(e,t){this.media=e,this.id=t,this.ssrcs=[],this.groups=[],this.encodings=[]}clone(){const e=new di(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 n=[];for(let e=0;e<this.encodings[t].length;++e)n.push(this.encodings[t][e].clone());e.addAlternativeEncodings(n)}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 n=[];for(let e=0;e<this.encodings[t].length;++e)n.push(this.encodings[t][e].plain());n.length&&(e.encodings||(e.encodings=[]),e.encodings.push(n))}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}getSourceGroupsForMediaSSRC(e){return this.groups.filter(t=>t.getSSRCs()[0]===e)}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}getEncodingSources(){const e=[];if(this.encodings.length)for(const t of this.encodings)for(const n of t){const t={id:n.getId(),rid:n.getId()},r=n.getParams(),s=null==r?void 0:r.get("ssrc");if(void 0!==s){t.media=parseInt(s);for(const e of this.getSourceGroupsForMediaSSRC(t.media))switch(e.getSemantics()){case"FID":t.rtx=e.getSSRCs()[1];break;case"FEC-FR":t.fec=e.getSSRCs()[1]}}e.push(t)}else if(this.hasSourceGroup("SIM")){const t=this.getSourceGroup("SIM").getSSRCs();this.getSourceGroups();for(const n of t){const t={id:String(n),media:n};for(const e of this.getSourceGroupsForMediaSSRC(t.media))switch(e.getSemantics()){case"FID":t.rtx=e.getSSRCs()[1];break;case"FEC-FR":t.fec=e.getSSRCs()[1]}e.push(t)}}else{const t={id:""};if(this.ssrcs.length){t.media=this.ssrcs[0];for(const e of this.getSourceGroupsForMediaSSRC(t.media))switch(e.getSemantics()){case"FID":t.rtx=e.getSSRCs()[1];break;case"FEC-FR":t.fec=e.getSSRCs()[1]}}e.push(t)}return e}};Hn.expand=function(e){var t,n;if("TrackInfo"===e.constructor.name)return e;const r=new Hn((e=e).media,e.id);if(e.mediaId&&r.setMediaId(e.mediaId),Array.isArray(e.ssrcs))for(const t of e.ssrcs)r.addSSRC(t);else if(void 0!==(null===(t=e.ssrcs)||void 0===t?void 0:t.media)){const t=e.ssrcs.media;if(r.addSSRC(t),void 0!==e.ssrcs.rtx){const n=e.ssrcs.rtx;r.addSSRC(n),r.addSourceGroup(new Kn("FID",[t,n]))}if(void 0!==e.ssrcs.fec){const n=e.ssrcs.fec;r.addSSRC(n),r.addSourceGroup(new Kn("FEC-FR",[t,n]))}}if(e.rid){const t=new $n(e.rid);void 0!==(null===(n=e.ssrcs)||void 0===n?void 0:n.media)&&t.addParam("ssrc",e.ssrcs.media),r.addAlternativeEncodings([t])}for(const t of e.groups||[])r.addSourceGroup(Kn.expand(t));for(const t of e.encodings||[]){const e=[];for(const n of t)e.push($n.expand(n));r.addAlternativeEncodings(e)}return r},Hn.clone=function(e){return"TrackInfo"===e.constructor.name?e.clone():Hn.expand(e)};var Jn=Hn;const Qn=Jn;let qn=class fi{constructor(e){this.id=e,this.tracks=new Map}clone(){const e=new fi(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)}};qn.expand=function(e){if("StreamInfo"===e.constructor.name)return e;const t=new qn((e=e).id);for(const n of e.tracks||[]){const e=Qn.expand(n);e&&t.addTrack(e)}return t},qn.clone=function(e){return"StreamInfo"===e.constructor.name?e.clone():qn.expand(e)};var er=qn;const tr=wt,nr=function(e){const t=new Intl.Collator(e,{sensitivity:"base"});return(e,n)=>0==t.compare(e,n)}("en-US"),rr=Nt,sr=jt,ir=Mt,or=Xt,ar=Kt,cr=hn,ur=Wn,dr=Vt,pr=Cn,fr=gn,hr=Vn,gr=Bn,vr=er,br=Jn,wr=zn,Sr=kn,_r=Sn,Rr=bn,Er=An;let Ir=class lr{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 lr(this.version);for(const t of this.medias)e.addMedia(t.clone());for(const t of this.streams.values())e.addStream(t.clone());for(const t of this.candidates)e.addCandidate(t.clone());return e.setICE(this.ice.clone()),this.dtls&&e.setDTLS(this.dtls.clone()),this.crypto&&e.setCrypto(this.crypto.clone()),e.setExtmapAllowMixed(this.extmapAllowMixed),e}plain(){const e={version:this.version,streams:[],medias:[],candidates:[]};for(const t of this.medias)e.medias.push(t.plain());for(const t of this.streams.values())e.streams.push(t.plain());for(const t of this.candidates)e.candidates.push(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 lr(this.version);for(const t of this.medias)e.addMedia(t.clone());const t={audio:e.getMediasByType("audio"),video:e.getMediasByType("video")};for(const n of this.streams.values()){const r=n.clone();for(const n of r.getTracks().values()){let r=t[n.getMedia()].pop();r||(r=this.getMedia(n.getMedia()).clone(),r.setId(n.getId()),e.addMedia(r)),n.setMediaId(r.getId())}e.addStream(r)}for(const t of this.candidates)e.addCandidate(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 n=this.medias[t];if(nr(n.getType(),e))return n}return null}getMediasByType(e){let t=[];for(let n in this.medias){let r=this.medias[n];nr(r.getType(),e)&&t.push(r)}return t}getMediaById(e){for(const t of this.medias)if(nr(t.getId(),e))return t;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(const t of this.candidates)if(t.equals(e))return;this.candidates.push(e)}addCandidates(e){for(const t of e)this.addCandidate(t)}getCandidates(){return this.candidates}getStream(e){return this.streams.get(e)}getStreams(){return this.streams}getFirstStream(){for(const 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()}getTracksByMediaType(e){let t=[];for(const n of this.streams.values())for(const[r,s]of n.getTracks())nr(s.getMedia(),e)&&t.push(s);return t}getTrackByMediaId(e){for(const t of this.streams.values())for(const[n,r]of t.getTracks())if(r.getMediaId()==e)return r;return null}getStreamByMediaId(e){for(const t of this.streams.values())for(const[n,r]of t.getTracks())if(r.getMediaId()==e)return t;return null}getExtmapAllowMixed(){return this.extmapAllowMixed}setExtmapAllowMixed(e){this.extmapAllowMixed=e}answer(e){const t=new lr;e.ice&&(e.ice instanceof cr?t.setICE(e.ice.clone()):t.setICE(cr.expand(e.ice))),e.dtls&&(e.dtls instanceof or?t.setDTLS(e.dtls):t.setDTLS(or.expand(e.dtls))),e.crypto&&(e.crypto instanceof ar?t.setCrypto(e.crypto):t.setCrypto(ar.expand(e.crypto)));for(let n=0;e.candidates&&n<e.candidates.length;++n)e.candidates[n]instanceof rr?t.addCandidate(e.candidates[n].clone()):t.addCandidate(rr.expand(e.candidates[n]));for(const n of this.medias){const r=e&&e.capabilities&&e.capabilities[n.getType()];t.addMedia(n.answer(r))}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");const t=[];for(const n of this.medias){let r={type:n.getType(),port:9,protocol:"",fmtp:[],rtp:[],rtcpFb:[],ext:[],bandwidth:[],candidates:[],ssrcGroups:[],ssrcs:[],rids:[]};r.direction=pr.toString(n.getDirection()),this.extmapAllowMixed&&(r.extmapAllowMixed="extmap-allow-mixed"),r.mid=n.getId(),t.push(n.getId()),n.hasControl()&&(r.control=n.getControl()),n.getBitrate()>0&&(r.bandwidth.push({type:"AS",limit:n.getBitrate()}),r.bandwidth.push({type:"TIAS",limit:1e3*n.getBitrate()}));let s=this.getCandidates();for(const e of s)r.candidates.push({foundation:e.getFoundation(),component:e.getComponentId(),transport:e.getTransport(),priority:e.getPriority(),ip:e.getAddress(),port:e.getPort(),type:e.getType(),raddr:e.getRelAddr(),rport:e.getRelPort()});if(this.getICE()&&(r.iceUfrag=this.getICE().getUfrag(),r.icePwd=this.getICE().getPwd()),nr("audio",n.getType())||nr("video",n.getType())){r.rtcpMux="rtcp-mux",r.rtcpRsize="rtcp-rsize",this.getDTLS()?(r.protocol="UDP/TLS/RTP/SAVPF",r.fingerprint={type:this.getDTLS().getHash(),hash:this.getDTLS().getFingerprint()},r.setup=dr.toString(this.getDTLS().getSetup())):this.getCrypto()?(r.protocol="RTP/SAVPF",r.crypto=[{id:this.getCrypto().getTag(),suite:this.getCrypto().getSuite(),config:this.getCrypto().getKeyParams()}]):r.protocol="RTP/AVP";for(const e of n.getCodecs().values()){nr("video",n.getType())?r.rtp.push({payload:e.getType(),codec:e.getCodec().toUpperCase(),rate:9e4}):nr("opus",e.getCodec())||nr("multiopus",e.getCodec())?r.rtp.push({payload:e.getType(),codec:e.getCodec(),rate:48e3,encoding:e.getChannels()}):r.rtp.push({payload:e.getType(),codec:e.getCodec(),rate:8e3});for(const t of e.getRTCPFeedbacks())r.rtcpFb.push({payload:e.getType(),type:t.getId(),subtype:t.getParams().join(" ")});e.hasRTX()&&(r.rtp.push({payload:e.getRTX(),codec:"rtx",rate:9e4}),r.fmtp.push({payload:e.getRTX(),config:"apt="+e.getType()}));const t=e.getParams();if(Object.keys(t).length){const n={payload:e.getType(),config:""};for(const e in t)n.config.length&&(n.config+=";"),Object.hasOwnProperty.call(t,e)?n.config+=e+"="+t[e]:n.config+=e;r.fmtp.push(n)}}const e=[];for(const t of r.rtp)e.push(t.payload);r.payloads=e.join(" ");for(let[e,t]of n.getExtensions().entries())r.ext.push({value:e,uri:t});for(let e of n.getRIDs().values()){let t={id:e.getId(),direction:fr.toString(e.getDirection()),params:""};e.getFormats().length&&(t.params="pt="+e.getFormats().join(","));for(let[n,r]of e.getParams().entries())t.params+=(t.params.length?";":"")+n+"="+r;r.rids.push(t)}const t=n.getSimulcast();if(t){let e=1;r.simulcast={};const n=t.getSimulcastStreams(fr.SEND),s=t.getSimulcastStreams(fr.RECV);if(n&&n.length){let t="";for(const e of n){let n="";for(const t of e)n+=(n.length?",":"")+(t.isPaused()?"~":"")+t.getId();t+=(t.length?";":"")+n}r.simulcast["dir"+e]="send",r.simulcast["list"+e]=t,e++}if(s&&s.length){let t="";for(const e of s){let n="";for(const t of e)n+=(n.length?",":"")+(t.isPaused()?"~":"")+t.getId();t+=(t.length?";":"")+n}r.simulcast["dir"+e]="recv",r.simulcast["list"+e]=t,e++}}}else if(n.hasDataChannel()){r.protocol="UDP/DTLS/SCTP",r.payloads="webrtc-datachannel";const e=n.getDataChannel();r.sctpPort=e.getPort(),r.maxMessageSize=e.getMaxMessageSize()}e.media.push(r)}for(let t of this.streams.values())for(let n of t.getTracks().values())for(let r in e.media){let s=e.media[r];if(n.getMediaId()){if(n.getMediaId()==s.mid){let e=n.getSourceGroups();for(let t in e){let n=e[t];s.ssrcGroups.push({semantics:n.getSemantics(),ssrcs:n.getSSRCs().join(" ")})}let r=n.getSSRCs();for(let e in r)s.ssrcs.push({id:r[e],attribute:"cname",value:t.getId()}),s.ssrcs.push({id:r[e],attribute:"msid",value:t.getId()+" "+n.getId()});s.msid=t.getId()+" "+n.getId();break}}else if(nr(s.type,n.getMedia())){let e=n.getSourceGroups();for(let t in e){let n=e[t];s.ssrcGroups.push({semantics:n.getSemantics(),ssrcs:n.getSSRCs().join(" ")})}let r=n.getSSRCs();for(let e in r)s.ssrcs.push({id:r[e],attribute:"cname",value:t.getId()}),s.ssrcs.push({id:r[e],attribute:"msid",value:t.getId()+" "+n.getId()});break}}const n={type:"BUNDLE",mids:t.join(" ")};return e.groups.push(n),tr.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 tr.write(e).slice(10)}};Ir.create=function(e){var t;const n=new Ir;if(e.streams)for(const t of e.streams)n.addStream(vr.expand(t));e.ice&&(e.ice instanceof cr?n.setICE(e.ice.clone()):n.setICE(cr.expand(e.ice))),e.dtls&&(e.dtls instanceof or?n.setDTLS(e.dtls):n.setDTLS(or.expand(e.dtls))),e.crypto&&(e.crypto instanceof ar?n.setCrypto(e.crypto):n.setCrypto(ar.expand(e.crypto)));for(const t of e.candidates||[])t instanceof rr?n.addCandidate(t.clone()):n.addCandidate(rr.expand(t));let r=96,s=1,i=0;for(const[o,a]of Object.entries(e.capabilities||{}))if(e.unified&&null!==(t=e.streams)&&void 0!==t&&t.length)for(const e of n.getTracksByMediaType(o)){const t=ur.create(e.getMediaId(),o,a);for(const[e,n]of t.getCodecs())n.getType()>=96&&n.setType(r++),n.getRTX()&&n.setRTX(r++);if(a.extensions)for(let e of a.extensions)15===s&&s++,t.addExtension(s++,e);n.addMedia(t)}else{const t=ur.create(e.unified?String(i++):o,o,a);for(const[e,n]of t.getCodecs())n.getType()>=96&&n.setType(r++),n.getRTX()&&n.setRTX(r++);if(a.extensions)for(let e of a.extensions)15===s&&s++,t.addExtension(s++,e);n.addMedia(t)}return n},Ir.expand=function(e){if("SDPInfo"===e.constructor.name)return e;const t=new Ir((e=e).version);for(const n of e.medias||[]){const e=ur.expand(n);e&&t.addMedia(e)}for(const n of e.streams||[]){const e=vr.expand(n);e&&t.addStream(e)}for(const n of e.candidates||[]){const e=rr.expand(n);e&&t.addCandidate(e)}return e.ice&&t.setICE(cr.expand(e.ice)),e.dtls&&t.setDTLS(or.expand(e.dtls)),e.crypto&&t.setCrypto(ar.expand(e.crypto)),e.extmapAllowMixedNotSupported&&(this.extmapAllowMixed=!e.extmapAllowMixedNotSupported),t},Ir.clone=function(e){return"SDPInfo"===e.constructor.name?e.clone():Ir.expand(e)},Ir.process=function(e){return Ir.parse(e)},Ir.parse=function(e){const t=tr.parse(e),n=new Ir;if(n.setVersion(t.version),t.iceUfrag&&t.icePwd){const e=String(t.iceUfrag),r=String(t.icePwd),s=new cr(e,r);s.setLite("ice-lite"==t.icelite),s.setEndOfCandidates("end-of-candidates"==t.endOfCandidates),n.setICE(s)}for(let e in t.media){const r=t.media[e],s=r.type,i=r.mid?r.mid.toString():e,o=new ur(i,s);if(r.iceUfrag&&r.icePwd){const e=String(r.iceUfrag),s=String(r.icePwd),i=new cr(e,s);i.setLite("ice-lite"==t.icelite),i.setEndOfCandidates("end-of-candidates"==r.endOfCandidates),n.setICE(i)}for(let e=0;r.candidates&&e<r.candidates.length;++e){const t=r.candidates[e],s=new rr(t.foundation,t.component,t.transport,t.priority,t.ip,t.port,t.type,t.raddr,t.rport);n.addCandidate(s)}const a=r.fingerprint||t.fingerprint;if(a){const e=a.type,t=a.hash;let s=dr.ACTPASS;r.setup&&(s=dr.byValue(r.setup)),n.setDTLS(new or(s,e,t))}if(r.crypto){const e=r.crypto[0];n.setCrypto(new ar(e.id,e.suite,e.config,e.sessionConfig))}let c=pr.SENDRECV;r.direction&&(c=pr.byValue(r.direction),o.setDirection(c)),r.control&&o.setControl(r.control),n.setExtmapAllowMixed("extmap-allow-mixed"==r.extmapAllowMixed||"extmap-allow-mixed"==t.extmapAllowMixed);const l=new Map;for(let e in r.rtp){const t=r.rtp[e],n=t.payload,s=t.codec;if("RED"===s.toUpperCase()||"ULPFEC"===s.toUpperCase())continue;let i={};for(let e in r.fmtp){const t=r.fmtp[e];if(t.payload===n){const e=t.config.split(";");for(let t in e){const n=e[t].split("="),r=n[0].trim(),s=n.splice(1).join("=").trim();i[r]=s}}}if("RTX"===s.toUpperCase())l.set(parseInt(i.apt),n);else{const e=new sr(s,n,i);t.encoding>1&&e.setChannels(t.encoding),o.addCodec(e)}}for(let e of l.entries()){const t=o.getCodecForType(e[0]);t&&t.setRTX(e[1])}for(let e=0;r.rtcpFb&&e<r.rtcpFb.length;++e){const t=o.getCodecForType(r.rtcpFb[e].payload);if(t){const n=r.rtcpFb[e].type,s=r.rtcpFb[e].subtype?r.rtcpFb[e].subtype.split(" "):null;t.addRTCPFeedback(new ir(n,s))}}const u=r.ext;for(let e in u){const t=u[e];o.addExtension(t.value,t.uri)}const d=r.rids;for(let e in d){const t=d[e],n=new Rr(t.id,fr.byValue(t.direction));let r=[];const s=new Map;if(t.params){const e=tr.parseParams(t.params);for(let t in e)"pt"===t?r=e[t].split(","):s.set(t,e[t]);n.setFormats(r),n.setParams(s)}o.addRID(n)}const p=[];if(r.simulcast){const e=new Sr;if(r.simulcast.dir1){const t=fr.byValue(r.simulcast.dir1),n=tr.parseSimulcastStreamList(r.simulcast.list1);for(let r=0;r<n.length;++r){const s=[];for(let e=0;e<n[r].length;++e)s.push(new _r(n[r][e].scid,n[r][e].paused));e.addSimulcastAlternativeStreams(t,s)}}if(r.simulcast.dir2){const t=fr.byValue(r.simulcast.dir2),n=tr.parseSimulcastStreamList(r.simulcast.list2);for(let r=0;r<n.length;++r){const s=[];for(let e=0;e<n[r].length;++e)s.push(new _r(n[r][e].scid,n[r][e].paused));e.addSimulcastAlternativeStreams(t,s)}}for(let t of e.getSimulcastStreams(fr.SEND)){const e=[];for(let n=0;n<t.length;n++){const r=new wr(t[n].getId(),t[n].isPaused()),s=o.getRID(r.getId());if(s){const t=s.getFormats();for(let e=0;t&&e<t.length;++e){const n=o.getCodecForType(t[e]);n&&r.addCodec(n)}r.setParams(s.getParams()),e.push(r)}}e.length&&p.push(e)}o.setSimulcast(e)}const f=new Map;if(r.ssrcs)for(let e in r.ssrcs){let t=r.ssrcs[e],o=t.id,a=t.attribute,c=t.value,l=f.get(o);if(l||(l=new gr(o),f.set(l.getSSRC(),l)),nr("cname",a))l.setCName(c);else if(nr("msid",a)){let e=c.split(" "),t=e[0],r=e[1];l.setStreamId(t),l.setTrackId(r);let a=n.getStream(t);a||(a=new vr(t),n.addStream(a));let u=a.getTrack(r);u||(u=new br(s,r),u.setMediaId(i),u.setEncodings(p),a.addTrack(u)),u.addSSRC(o)}}if(r.msid){let e=r.msid.split(" "),t=e[0],o=e[1],a=n.getStream(t);a||(a=new vr(t),n.addStream(a));let c=a.getTrack(o);c||(c=new br(s,o),c.setMediaId(i),c.setEncodings(p),a.addTrack(c));for(let[e,n]of f.entries())n.getStreamId()||(n.setStreamId(t),n.setTrackId(o),c.addSSRC(e))}for(let[e,t]of f.entries())if(!t.getStreamId()){let r=t.getCName(),o=i;t.setStreamId(r),t.setTrackId(o);let a=n.getStream(r);a||(a=new vr(r),n.addStream(a));let c=a.getTrack(o);c||(c=new br(s,o),c.setMediaId(i),c.setEncodings(p),a.addTrack(c)),c.addSSRC(e)}if(r.ssrcGroups)for(let e in r.ssrcGroups){let t=r.ssrcGroups[e],s=t.ssrcs.split(" "),i=new hr(t.semantics,s),o=f.get(parseInt(s[0]));o&&n.getStream(o.getStreamId()).getTrack(o.getTrackId()).addSourceGroup(i)}if("application"==r.type&&"webrtc-datachannel"==r.payloads){const e=new Er(r.sctpPort,r.maxMessageSize);o.setDataChannel(e)}n.addMedia(o)}return n};var kr=Ir;Object.defineProperty(bt,"__esModule",{value:!0});var xr=bt.SDPInfo=kr;bt.CandidateInfo=Nt,bt.CodecInfo=jt,bt.DTLSInfo=Xt,bt.CryptoInfo=Kt,bt.ICEInfo=hn;var Tr=bt.MediaInfo=Wn;bt.Setup=Vt,bt.SourceGroupInfo=Vn,bt.SourceInfo=Bn,bt.StreamInfo=er,bt.TrackInfo=Jn,bt.RTCPFeedbackInfo=Mt,bt.TrackEncodingInfo=zn,bt.RIDInfo=bn,bt.SimulcastInfo=kn,bt.SimulcastStreamInfo=Sn,bt.DataChannelInfo=An;var Cr=bt.Direction=Cn,Lr={exports:{}};!function(e,t){!function(n,r){var s="function",i="undefined",o="object",a="string",c="major",l="model",u="name",d="type",p="vendor",f="version",h="architecture",m="console",g="mobile",y="tablet",v="smarttv",w="wearable",_="embedded",R="Amazon",E="Apple",I="ASUS",k="BlackBerry",T="Browser",L="Chrome",A="Firefox",O="Google",N="Huawei",D="LG",M="Microsoft",U="Motorola",j="Opera",W="Samsung",Z="Sony",V="Xiaomi",G="Zebra",B="Facebook",Y="Chromium OS",z=" Browser",K=function(e){for(var t={},n=0;n<e.length;n++)t[e[n].toUpperCase()]=e[n];return t},$=function(e,t){return typeof e===a&&-1!==H(t).indexOf(H(e))},H=function(e){return e.toLowerCase()},J=function(e,t){if(typeof e===a)return e=e.replace(/^\s\s*/,""),typeof t===i?e:e.substring(0,500)},Q=function(e,t){for(var n,i,a,c,l,u,d=0;d<t.length&&!l;){var p=t[d],f=t[d+1];for(n=i=0;n<p.length&&!l&&p[n];)if(l=p[n++].exec(e))for(a=0;a<f.length;a++)u=l[++i],typeof(c=f[a])===o&&c.length>0?2===c.length?typeof c[1]==s?this[c[0]]=c[1].call(this,u):this[c[0]]=c[1]:3===c.length?typeof c[1]!==s||c[1].exec&&c[1].test?this[c[0]]=u?u.replace(c[1],c[2]):r:this[c[0]]=u?c[1].call(this,u,c[2]):r:4===c.length&&(this[c[0]]=u?c[3].call(this,u.replace(c[1],c[2])):r):this[c]=u||r;d+=2}},q=function(e,t){for(var n in t)if(typeof t[n]===o&&t[n].length>0){for(var s=0;s<t[n].length;s++)if($(t[n][s],e))return"?"===n?r:n}else if($(t[n],e))return"?"===n?r:n;return t.hasOwnProperty("*")?t["*"]:e},ee={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"},te={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[f,[u,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[f,[u,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[u,f],[/opios[\/ ]+([\w\.]+)/i],[f,[u,j+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[f,[u,j+" GX"]],[/\bopr\/([\w\.]+)/i],[f,[u,j]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[f,[u,"Baidu"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim)\s?(?:browser)?[\/ ]?([\w\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio)\/([-\w\.]+)/i,/(heytap|ovi)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[u,f],[/quark(?:pc)?\/([-\w\.]+)/i],[f,[u,"Quark"]],[/\bddg\/([\w\.]+)/i],[f,[u,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[f,[u,"UC"+T]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[f,[u,"WeChat"]],[/konqueror\/([\w\.]+)/i],[f,[u,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[f,[u,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[f,[u,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[f,[u,"Smart Lenovo "+T]],[/(avast|avg)\/([\w\.]+)/i],[[u,/(.+)/,"$1 Secure "+T],f],[/\bfocus\/([\w\.]+)/i],[f,[u,A+" Focus"]],[/\bopt\/([\w\.]+)/i],[f,[u,j+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[f,[u,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[f,[u,"Dolphin"]],[/coast\/([\w\.]+)/i],[f,[u,j+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[f,[u,"MIUI "+T]],[/fxios\/([-\w\.]+)/i],[f,[u,A]],[/\bqihu|(qi?ho?o?|360)browser/i],[[u,"360"+z]],[/\b(qq)\/([\w\.]+)/i],[[u,/(.+)/,"$1Browser"],f],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[u,/(.+)/,"$1"+z],f],[/samsungbrowser\/([\w\.]+)/i],[f,[u,W+" Internet"]],[/(comodo_dragon)\/([\w\.]+)/i],[[u,/_/g," "],f],[/metasr[\/ ]?([\d\.]+)/i],[f,[u,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[u,"Sogou Mobile"],f],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345Explorer)[\/ ]?([\w\.]+)/i],[u,f],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[u],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[u,B],f],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[u,f],[/\bgsa\/([\w\.]+) .*safari\//i],[f,[u,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[f,[u,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[f,[u,L+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[u,L+" WebView"],f],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[f,[u,"Android "+T]],[/(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,q,{"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],[/(wolvic)\/([\w\.]+)/i],[u,f],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[f,[u,A+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\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|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[u,[f,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[u,[f,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[h,"amd64"]],[/(ia32(?=;))/i],[[h,H]],[/((?:i[346]|x)86)[;\)]/i],[[h,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[h,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[h,"armhf"]],[/windows (ce|mobile); ppc;/i],[[h,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[h,/ower/,"",H]],[/(sun4\w)[;\)]/i],[[h,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[h,H]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[l,[p,W],[d,y]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[l,[p,W],[d,g]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[l,[p,E],[d,g]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[l,[p,E],[d,y]],[/(macintosh);/i],[l,[p,E]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[l,[p,"Sharp"],[d,g]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[l,[p,N],[d,y]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[l,[p,N],[d,g]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i],[[l,/_/g," "],[p,V],[d,g]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[l,/_/g," "],[p,V],[d,y]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[l,[p,"OPPO"],[d,g]],[/\b(opd2\d{3}a?) bui/i],[l,[p,"OPPO"],[d,y]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[l,[p,"Vivo"],[d,g]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[l,[p,"Realme"],[d,g]],[/\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],[l,[p,U],[d,g]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[l,[p,U],[d,y]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[l,[p,D],[d,y]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[l,[p,D],[d,g]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[l,[p,"Lenovo"],[d,y]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[l,/_/g," "],[p,"Nokia"],[d,g]],[/(pixel c)\b/i],[l,[p,O],[d,y]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[l,[p,O],[d,g]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[l,[p,Z],[d,g]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[l,"Xperia Tablet"],[p,Z],[d,y]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[l,[p,"OnePlus"],[d,g]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[l,[p,R],[d,y]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[l,/(.+)/g,"Fire Phone $1"],[p,R],[d,g]],[/(playbook);[-\w\),; ]+(rim)/i],[l,p,[d,y]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[l,[p,k],[d,g]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[l,[p,I],[d,y]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[l,[p,I],[d,g]],[/(nexus 9)/i],[l,[p,"HTC"],[d,y]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[p,[l,/_/g," "],[d,g]],[/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])\w*(\)| bui)/i],[l,[p,"TCL"],[d,y]],[/(itel) ((\w+))/i],[[p,H],l,[d,q,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[l,[p,"Acer"],[d,y]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[l,[p,"Meizu"],[d,g]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[l,[p,"Ulefone"],[d,g]],[/droid.+; (a(?:015|06[35]|142p?))/i],[l,[p,"Nothing"],[d,g]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[p,l,[d,g]],[/(kobo)\s(ereader|touch)/i,/(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],[p,l,[d,y]],[/(surface duo)/i],[l,[p,M],[d,y]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[l,[p,"Fairphone"],[d,g]],[/(u304aa)/i],[l,[p,"AT&T"],[d,g]],[/\bsie-(\w*)/i],[l,[p,"Siemens"],[d,g]],[/\b(rct\w+) b/i],[l,[p,"RCA"],[d,y]],[/\b(venue[\d ]{2,7}) b/i],[l,[p,"Dell"],[d,y]],[/\b(q(?:mv|ta)\w+) b/i],[l,[p,"Verizon"],[d,y]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[l,[p,"Barnes & Noble"],[d,y]],[/\b(tm\d{3}\w+) b/i],[l,[p,"NuVision"],[d,y]],[/\b(k88) b/i],[l,[p,"ZTE"],[d,y]],[/\b(nx\d{3}j) b/i],[l,[p,"ZTE"],[d,g]],[/\b(gen\d{3}) b.+49h/i],[l,[p,"Swiss"],[d,g]],[/\b(zur\d{3}) b/i],[l,[p,"Swiss"],[d,y]],[/\b((zeki)?tb.*\b) b/i],[l,[p,"Zeki"],[d,y]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[p,"Dragon Touch"],l,[d,y]],[/\b(ns-?\w{0,9}) b/i],[l,[p,"Insignia"],[d,y]],[/\b((nxa|next)-?\w{0,9}) b/i],[l,[p,"NextBook"],[d,y]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[p,"Voice"],l,[d,g]],[/\b(lvtel\-)?(v1[12]) b/i],[[p,"LvTel"],l,[d,g]],[/\b(ph-1) /i],[l,[p,"Essential"],[d,g]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[l,[p,"Envizen"],[d,y]],[/\b(trio[-\w\. ]+) b/i],[l,[p,"MachSpeed"],[d,y]],[/\btu_(1491) b/i],[l,[p,"Rotor"],[d,y]],[/(shield[\w ]+) b/i],[l,[p,"Nvidia"],[d,y]],[/(sprint) (\w+)/i],[p,l,[d,g]],[/(kin\.[onetw]{3})/i],[[l,/\./g," "],[p,M],[d,g]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[l,[p,G],[d,y]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[l,[p,G],[d,g]],[/smart-tv.+(samsung)/i],[p,[d,v]],[/hbbtv.+maple;(\d+)/i],[[l,/^/,"SmartTV"],[p,W],[d,v]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[p,D],[d,v]],[/(apple) ?tv/i],[p,[l,E+" TV"],[d,v]],[/crkey/i],[[l,L+"cast"],[p,O],[d,v]],[/droid.+aft(\w+)( bui|\))/i],[l,[p,R],[d,v]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[l,[p,"Sharp"],[d,v]],[/(bravia[\w ]+)( bui|\))/i],[l,[p,Z],[d,v]],[/(mitv-\w{5}) bui/i],[l,[p,V],[d,v]],[/Hbbtv.*(technisat) (.*);/i],[p,l,[d,v]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[p,J],[l,J],[d,v]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[d,v]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[p,l,[d,m]],[/droid.+; (shield) bui/i],[l,[p,"Nvidia"],[d,m]],[/(playstation [345portablevi]+)/i],[l,[p,Z],[d,m]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[l,[p,M],[d,m]],[/\b(sm-[lr]\d\d[05][fnuw]?s?)\b/i],[l,[p,W],[d,w]],[/((pebble))app/i],[p,l,[d,w]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[l,[p,E],[d,w]],[/droid.+; (glass) \d/i],[l,[p,O],[d,w]],[/droid.+; (wt63?0{2,3})\)/i],[l,[p,G],[d,w]],[/(quest( \d| pro)?)/i],[l,[p,B],[d,w]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[p,[d,_]],[/(aeobc)\b/i],[l,[p,R],[d,_]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[l,[d,g]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[l,[d,y]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[d,y]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[d,g]],[/(android[-\w\. ]{0,9});.+buil/i],[l,[p,"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,/\b(libweb)/i],[u,f],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[f,u]],os:[[/microsoft (windows) (vista|xp)/i],[u,f],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[u,[f,q,ee]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[f,q,ee],[u,"Windows"]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[f,/_/g,"."],[u,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[u,"Mac OS"],[f,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[f,u],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[u,f],[/\(bb(10);/i],[f,[u,k]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[f,[u,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[f,[u,A+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[f,[u,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[f,[u,"watchOS"]],[/crkey\/([\d\.]+)/i],[f,[u,L+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[u,Y],f],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(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|serenityos)/i,/(unix) ?([\w\.]*)/i],[u,f]]},ne=function(e,t){if(typeof e===o&&(t=e,e=r),!(this instanceof ne))return new ne(e,t).getResult();var m=typeof n!==i&&n.navigator?n.navigator:r,v=e||(m&&m.userAgent?m.userAgent:""),w=m&&m.userAgentData?m.userAgentData:r,_=t?function(e,t){var n={};for(var r in e)t[r]&&t[r].length%2==0?n[r]=t[r].concat(e[r]):n[r]=e[r];return n}(te,t):te,R=m&&m.userAgent==v;return this.getBrowser=function(){var e={};return e[u]=r,e[f]=r,Q.call(e,v,_.browser),e[c]=function(e){return typeof e===a?e.replace(/[^\d\.]/g,"").split(".")[0]:r}(e[f]),R&&m&&m.brave&&typeof m.brave.isBrave==s&&(e[u]="Brave"),e},this.getCPU=function(){var e={};return e[h]=r,Q.call(e,v,_.cpu),e},this.getDevice=function(){var e={};return e[p]=r,e[l]=r,e[d]=r,Q.call(e,v,_.device),R&&!e[d]&&w&&w.mobile&&(e[d]=g),R&&"Macintosh"==e[l]&&m&&typeof m.standalone!==i&&m.maxTouchPoints&&m.maxTouchPoints>2&&(e[l]="iPad",e[d]=y),e},this.getEngine=function(){var e={};return e[u]=r,e[f]=r,Q.call(e,v,_.engine),e},this.getOS=function(){var e={};return e[u]=r,e[f]=r,Q.call(e,v,_.os),R&&!e[u]&&w&&w.platform&&"Unknown"!=w.platform&&(e[u]=w.platform.replace(/chrome os/i,Y).replace(/macos/i,"Mac 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 v},this.setUA=function(e){return v=typeof e===a&&e.length>500?J(e,500):e,this},this.setUA(v),this};ne.VERSION="0.7.39",ne.BROWSER=K([u,f,c]),ne.CPU=K([h]),ne.DEVICE=K([l,p,d,m,g,v,y,w,_]),ne.ENGINE=ne.OS=K([u,f]),e.exports&&(t=e.exports=ne),t.UAParser=ne;var re=typeof n!==i&&(n.jQuery||n.Zepto);if(re&&!re.ua){var se=new ne;re.ua=se.getResult(),re.ua.get=function(){return se.getUA()},re.ua.set=function(e){se.setUA(e);var t=se.getResult();for(var n in t)re.ua[n]=t[n]}}}("object"==typeof window?window:le)}(Lr,Lr.exports);const Ar=ue(Lr.exports),Or=["iOS"];class Yt extends Ar{constructor(){super(window.navigator.userAgent)}isChromium(){return this.getUA().match(/Chrome/i)}isChrome(){const e=this.getBrowser();if(!e.name)return!1;const t=this.getOS();let n=!0;return n=!new RegExp(Or.join("|"),"i").test(t.name),e.name.match(/Chrome/i)&&n}isFirefox(){const e=this.getBrowser();return!!e.name&&e.name.match(/Firefox/i)}isOpera(){const e=this.getBrowser();return!!e.name&&e.name.match(/Opera/i)}isSafari(){const e=this.getBrowser();return!!e.name&&e.name.match(/Safari/i)}}const Pr=Be.get("SdpParser"),Nr=Array.from({length:31},(e,t)=>t+35),Dr=Array.from({length:32},(e,t)=>t+96),Mr=Array.from({length:14},(e,t)=>t+1),Fr=Array.from({length:240},(e,t)=>t+16),Ur={setSimulcast(e,t){if(Pr.info("Setting simulcast. Codec: ",t),!(new Yt).isChromium())return Pr.warn("Your browser does not appear to support Simulcast. For a better experience, use a Chromium based browser."),e;if("h264"!==t&&"vp8"!==t)return Pr.warn("Your selected codec ".concat(t," does not appear to support Simulcast. To broadcast using simulcast, please use H.264 or VP8.")),e;if(!/m=video/.test(e))return Pr.warn("There is no available video for simulcast to be enabled."),e;try{const t=new RegExp("m=video.*?a=ssrc:(\\d*) cname:(.+?)\\r\\n","s"),n=new RegExp("m=video.*?a=ssrc:(\\d*) msid:(.+?)\\r\\n","s"),r=t.exec(e),s=r[1],i=r[2],o=n.exec(e)[2],a=2,c=[s];for(let t=0;t<a;++t){const n=100+2*t,r=n+1;c.push(n),e+="a=ssrc-group:FID "+n+" "+r+"\r\na=ssrc:"+n+" cname:"+i+"\r\na=ssrc:"+n+" msid:"+o+"\r\na=ssrc:"+r+" cname:"+i+"\r\na=ssrc:"+r+" msid:"+o+"\r\n"}return e+="a=ssrc-group:SIM "+c.join(" ")+"\r\n",Pr.info("Simulcast setted"),Pr.debug("Simulcast SDP: ",e),e}catch(e){throw Pr.error("Error setting SDP for simulcast: ",e),e}},setStereo:e=>(Pr.info("Replacing SDP response for support stereo"),e=e.replace(/useinbandfec=1/g,"useinbandfec=1; stereo=1"),Pr.info("Replaced SDP response for support stereo"),Pr.debug("New SDP value: ",e),e),setDTX:e=>(Pr.info("Replacing SDP response for support dtx"),e=e.replace("useinbandfec=1","useinbandfec=1; usedtx=1"),Pr.info("Replaced SDP response for support dtx"),Pr.debug("New SDP value: ",e),e),setAbsoluteCaptureTime(e){const t="a=extmap:"+Ur.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,n,r)=>n+t+r),Pr.info("Replaced SDP response for setting absolute capture time"),Pr.debug("New SDP value: ",e),e},setDependencyDescriptor(e){const t="a=extmap:"+Ur.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,n,r)=>n+t+r),Pr.info("Replaced SDP response for setting depency descriptor"),Pr.debug("New SDP value: ",e),e},setVideoBitrate(e,t){if(t<1)Pr.info("Remove bitrate restrictions"),e=e.replace(/b=AS:.*\r\n/,"").replace(/b=TIAS:.*\r\n/,"");else{const n=xr.parse(e),r=n.getMedia("video");Pr.info("Setting video bitrate"),r.setBitrate(t),e=n.toString()}return e},removeSdpLine:(e,t)=>(Pr.debug("SDP before trimming: ",e),e=e.split("\n").filter(e=>e.trim()!==t).join("\n"),Pr.debug("SDP trimmed result: ",e),e),adaptCodecName(e,t,n){if(!e)return e;const r=new RegExp("".concat(t),"i");return e.replace(r,n)},setMultiopus(e,t){if(!(new Yt).isFirefox()&&(!t||jr(t)))if(e.includes("multiopus/48000/6"))Pr.info("Multiopus already setted");else{Pr.info("Setting multiopus");const t=/m=audio 9 UDP\/TLS\/RTP\/SAVPF (.*)\r\n/.exec(e)[0],n=Ur.getAvailablePayloadTypeRange(e)[0],r=t.replace("\r\n"," ")+n+"\r\na=rtpmap:"+n+" multiopus/48000/6\r\na=fmtp:"+n+" channel_mapping=0,4,1,2,3,5;coupled_streams=2;minptime=10;num_streams=4;useinbandfec=1\r\n";e=e.replace(t,r),Pr.info("Multiopus offer created"),Pr.debug("SDP parsed for multioups: ",e)}return e},getAvailablePayloadTypeRange(e){const t=e.matchAll(/m=(?:.*) (?:.*) UDP\/TLS\/RTP\/SAVPF (.*)\r\n/gm);let n=Dr.concat(Nr);for(const e of t){const t=e[1].split(" ").map(e=>parseInt(e));n=n.filter(e=>!t.includes(e))}return n},getAvailableHeaderExtensionIdRange(e){const t=e.matchAll(/a=extmap:(\d+)(?:.*)\r\n/gm);let n=Mr.concat(Fr);for(const e of t){const t=e[1].split(" ").map(e=>parseInt(e));n=n.filter(e=>!t.includes(e))}return n},renegotiate(e,t){const n=xr.parse(e),r=xr.parse(t);for(const e of n.getMedias()){let t=r.getMediaById(e.getId());if(!t){t=new Tr(e.getId(),e.getType()),t.setDirection(Cr.reverse(e.getDirection()));const n=r.getMedia(e.getType());if(n){t.setCodecs(n.getCodecs());for(const[e,r]of n.getExtensions())t.addExtension(e,r)}r.addMedia(t)}}return r.toString()},updateMissingVideoExtensions(e,t){var n;const r=xr.parse(e),s=null==(n=xr.parse(t).getMediasByType("video")[0])?void 0:n.getExtensions();if(s||s.length){for(const t of r.getMediasByType("video")){const n=t.getExtensions();s.forEach((r,s)=>{if(!n.get(s)){const n=t.getId(),i="a=extmap:"+s+" "+r+"\r\n",o=new RegExp("(a=mid:"+n+"\r\n(?:.*\r\n)*?)","g");e=e.replace(o,(e,t,n)=>t+i)}})}return e}},getCodecPayloadType(e){const t=e.matchAll(/a=rtpmap:(\d+) (\w+)\/\d+/g),n={};for(const e of t)n[e[1]]=e[2];return n}},jr=e=>e.getAudioTracks().some(e=>e.getSettings().channelCount>2),Zr={VP8:"vp8",VP9:"vp9",H264:"h264",AV1:"av1",H265:"h265"},Vr={OPUS:"opus",MULTIOPUS:"multiopus"},Gr=Be.get("PeerConnection"),Br="Viewer",Yr={track:"track",connectionStateChange:"connectionStateChange"},Xr={stereo:!1,mediaStream:null,codec:"h264",simulcast:!1,scalabilityMode:null,disableAudio:!1,disableVideo:!1,setSDPToPeer:!0};class tt extends ut{constructor(){super(),this.mode=null,this.sessionDescription=null,this.peer=null,this.peerConnectionStats=null,this.transceiverMap=new Map}async createRTCPeer(e={autoInitStats:!0,statsIntervalMs:1e3},t=Br){Gr.info("Creating new RTCPeerConnection"),Gr.debug("RTC configuration provided by user: ",e),this.peer=$r(this,e),this.mode=t,e.autoInitStats&&this.initStats(e)}getRTCPeer(){return Gr.info("Getting RTC Peer"),this.peer}async closeRTCPeer(){var e;Gr.info("Closing RTCPeerConnection"),null==(e=this.peer)||e.close(),this.peer=null,this.stopStats(),this.emit(Yr.connectionStateChange,"closed")}async setRTCRemoteSDP(e){Gr.info("Setting RTC Remote SDP");const t={type:"answer",sdp:e};try{await this.peer.setRemoteDescription(t),Gr.info("RTC Remote SDP was set successfully."),Gr.debug("RTC Remote SDP new value: ",e)}catch(e){throw Gr.error("Error while setting RTC Remote SDP: ",e),e}}async getRTCLocalSDP(e=Xr){Gr.info("Getting RTC Local SDP"),e=ie(ie({},Xr),e),Gr.debug("Options: ",e);const t=Kr(e.mediaStream);t?Qr(this.peer,t,e):qr(this.peer,e),Gr.info("Creating peer offer");const n=await this.peer.createOffer();return Gr.info("Peer offer created"),Gr.debug("Peer offer response: ",n.sdp),this.sessionDescription=n,e.disableAudio||(e.stereo&&(this.sessionDescription.sdp=Ur.setStereo(this.sessionDescription.sdp)),e.dtx&&(this.sessionDescription.sdp=Ur.setDTX(this.sessionDescription.sdp)),this.sessionDescription.sdp=Ur.setMultiopus(this.sessionDescription.sdp,t)),!e.disableVideo&&e.simulcast&&(this.sessionDescription.sdp=Ur.setSimulcast(this.sessionDescription.sdp,e.codec)),e.absCaptureTime&&(this.sessionDescription.sdp=Ur.setAbsoluteCaptureTime(this.sessionDescription.sdp)),e.dependencyDescriptor&&(this.sessionDescription.sdp=Ur.setDependencyDescriptor(this.sessionDescription.sdp)),e.setSDPToPeer&&(await this.peer.setLocalDescription(this.sessionDescription),Gr.info("Peer local description set")),this.sessionDescription.sdp}async addRemoteTrack(e,t){return new Promise((n,r)=>{try{const r=this.peer.addTransceiver(e,{direction:"recvonly",streams:t});this.transceiverMap.set(r,n)}catch(e){r(e)}})}updateBandwidthRestriction(e,t){if(this.mode===Br)throw Gr.error("Viewer attempting to update bitrate, this is not allowed"),new Error("It is not possible for a viewer to update the bitrate.");return Gr.info("Updating bandwidth restriction, bitrate value: ",t),Gr.debug("SDP value: ",e),Ur.setVideoBitrate(e,t)}async updateBitrate(e=0){if(this.mode===Br)throw Gr.error("Viewer attempting to update bitrate, this is not allowed"),new Error("It is not possible for a viewer to update the bitrate.");if(!this.peer)throw Gr.error("Cannot update bitrate. No peer found."),new Error("Cannot update bitrate. No peer found.");Gr.info("Updating bitrate to value: ",e),this.sessionDescription=await this.peer.createOffer(),await this.peer.setLocalDescription(this.sessionDescription);const t=this.updateBandwidthRestriction(this.peer.remoteDescription.sdp,e);await this.setRTCRemoteSDP(t),Gr.info("Bitrate restrictions updated: ","".concat(e>0?e:"unlimited"," kbps"))}getRTCPeerStatus(){if(Gr.info("Getting RTC peer status"),!this.peer)return null;const e=es(this.peer);return Gr.info("RTC peer status getted, value: ",e),e}replaceTrack(e){if(!this.peer)return void Gr.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):Gr.error("There is no ".concat(e.kind," track in active broadcast."))}static getCapabilities(e){const t=new Yt,n=RTCRtpSender.getCapabilities(e);if(n){const r={};let s=new RegExp("^video/(".concat(Object.values(Zr).join("|"),")x?$"),"i");"audio"===e&&(s=new RegExp("^audio/(".concat(Object.values(Vr).join("|"),")$"),"i"),t.isChrome()&&(r.multiopus={mimeType:"audio/multiopus",channels:6}));for(const e of n.codecs){const t=e.mimeType.match(s);if(t){const n=t[1].toLowerCase();if(r[n]=oe(ie({},r[n]),{mimeType:e.mimeType}),e.scalabilityModes){let t=r[n].scalabilityModes||[];t=[...t,...e.scalabilityModes],r[n].scalabilityModes=[...new Set(t)]}e.channels&&(r[n].channels=e.channels)}}n.codecs=Object.keys(r).map(e=>ie({codec:e},r[e]))}return n}getTracks(){var e,t;return null==(t=null==(e=this.peer)?void 0:e.getSenders())?void 0:t.map(e=>e.track)}initStats(e){this.peerConnectionStats?Gr.warn("PeerConnection.initStats() has already been called. Automatic initialization occurs via View.connect(), Publish.connect() or this.createRTCPeer(). See options"):this.peer?(this.peerConnectionStats=new Ji(this.peer,e),ht(this.peerConnectionStats,this,[vt])):Gr.warn("Cannot init peer stats: RTCPeerConnection not initialized")}stopStats(){var e;null==(e=this.peerConnectionStats)||e.stop(),this.peerConnectionStats=null}}const zr=e=>(null==e?void 0:e.getAudioTracks().length)<=1&&(null==e?void 0:e.getVideoTracks().length)<=1,Kr=e=>{if(!e)return null;if(e instanceof MediaStream&&zr(e))return e;if(!(e instanceof MediaStream)){Gr.info("Creating MediaStream to add received tracks.");const t=new MediaStream;for(const n of e)t.addTrack(n);if(zr(t))return t}throw Gr.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.")},$r=(e,t)=>{const n=new RTCPeerConnection(t);return Jr(e,n),n};async function Hr(e){return new Promise(t=>setTimeout(t,e))}const Jr=(e,t)=>{t.ontrack=async t=>{Gr.info("New track from peer."),Gr.debug("Track event value: ",t);const n=e.transceiverMap.get(t.transceiver);if(n){for(;!t.transceiver.mid;)await Hr(100);n(t.transceiver),e.transceiverMap.delete(t.transceiver)}setTimeout(()=>{e.emit(Yr.track,t)},0)},t.connectionState?t.onconnectionstatechange=n=>{Gr.info("Peer connection state change: ",t.connectionState),e.emit(Yr.connectionStateChange,t.connectionState)}:t.oniceconnectionstatechange=n=>{Gr.info("Peer ICE connection state change: ",t.iceConnectionState),e.emit(Yr.connectionStateChange,t.iceConnectionState)},t.onnegotiationneeded=async e=>{if(!t.remoteDescription)return;Gr.info("Peer onnegotiationneeded, updating local description");const n=await t.createOffer();Gr.info("Peer onnegotiationneeded, got local offer",n.sdp),n.sdp=Ur.updateMissingVideoExtensions(n.sdp,t.remoteDescription.sdp),await t.setLocalDescription(n);const r=Ur.renegotiate(n.sdp,t.remoteDescription.sdp);Gr.info("Peer onnegotiationneeded, updating remote description",r),await t.setRemoteDescription({type:"answer",sdp:r}),Gr.info("Peer onnegotiationneeded, renegotiation done")}},Qr=(e,t,n)=>{Gr.info("Adding mediaStream tracks to RTCPeerConnection");for(const r of t.getTracks()){const s={streams:[t]};"audio"===r.kind&&(s.direction=n.disableAudio?"inactive":"sendonly"),"video"===r.kind&&(s.direction=n.disableVideo?"inactive":"sendonly",n.scalabilityMode&&(new Yt).isChrome()?(Gr.debug("Video track with scalability mode: ".concat(n.scalabilityMode,".")),s.sendEncodings=[{scalabilityMode:n.scalabilityMode}]):n.scalabilityMode&&Gr.warn("SVC is only supported in Google Chrome")),e.addTransceiver(r,s),Gr.info("Track '".concat(r.label,"' added: "),"id: ".concat(r.id),"kind: ".concat(r.kind))}},qr=(e,t)=>{const n=new Yt;if(!t.disableVideo){const t=e.addTransceiver("video",{direction:"recvonly"});n.isOpera()&&t.setCodecPreferences(RTCRtpReceiver.getCapabilities("video").codecs.filter(e=>"video/H264"!==e.mimeType||e.sdpFmtpLine.includes("profile-level-id=4")))}t.disableAudio||e.addTransceiver("audio",{direction:"recvonly"});for(let n=0;n<t.multiplexedAudioTracks;n++)e.addTransceiver("audio",{direction:"recvonly"})},es=e=>{var t;const n=null!=(t=e.connectionState)?t:e.iceConnectionState;switch(n){case"checking":return"connecting";case"completed":return"connected";default:return n}};var ts={};Object.defineProperty(ts,"__esModule",{value:!0}),ts.TypedEmitter=lt.EventEmitter;const{TypedEmitter:ns}=ts;class ia extends ns{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)}}const rs=ue(class oa extends ns{constructor(e){super(),this.maxId=0,this.namespaces=new Map,this.transactions=new Map,this.transport=e,this.listener=e=>{let t;try{t=JSON.parse(e.utf8Data||e.data||e)}catch(e){return}switch(t.type){case"cmd":const{transId:e}=t,r={name:t.name,data:t.data,namespace:t.namespace,accept:t=>{this._send({type:"response",transId:e,data:t})},reject:t=>{this._send({type:"error",transId:e,data:t})}};if(r.namespace){const e=this.namespaces.get(r.namespace);e?e.emit("cmd",r):this.emit("cmd",r)}else this.emit("cmd",r);break;case"response":{const e=this.transactions.get(t.transId);if(!e)return;this.transactions.delete(t.transId),e.resolve(t.data);break}case"error":{const e=this.transactions.get(t.transId);if(!e)return;this.transactions.delete(t.transId),e.reject(t.data);break}case"event":const s={name:t.name,data:t.data,namespace:t.namespace};if(s.namespace){var n=this.namespaces.get(s.namespace);n?n.emit("event",s):this.emit("event",s)}else this.emit("event",s)}},this.transport.addListener?this.transport.addListener("message",this.listener):this.transport.addEventListener("message",this.listener)}_send(e){this.transport.send(JSON.stringify(e))}cmd(e,t,n){return new Promise((r,s)=>{if(!e||0===e.length)throw new Error("Bad command name");const i={type:"cmd",transId:this.maxId++,name:e,data:t};n&&(i.namespace=n),this.transactions.set(i.transId,oe(ie({},i),{resolve:r,reject:s}));try{this._send(i)}catch(e){throw this.transactions.delete(i.transId),e}})}event(e,t,n){if(!e||0===e.length)throw new Error("Bad event name");const r={type:"event",name:e,data:t};n&&(r.namespace=n),this._send(r)}namespace(e){let t=this.namespaces.get(e);return t||(t=new ia(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)}}),ss=Be.get("Signaling"),is="wsConnectionSuccess",os="wsConnectionError",as="wsConnectionClose",cs="broadcastEvent";class mi extends ut{constructor(e={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,this.streamViewId=null}async connect(){var e;return ss.info("Connecting to Signaling Server"),this.transactionManager&&(null==(e=this.webSocket)?void 0:e.readyState)===WebSocket.OPEN?(ss.info("Connected to server: ",this.webSocket.url),ss.debug("WebSocket value: ",{url:this.webSocket.url,protocol:this.webSocket.protocol,readyState:this.webSocket.readyState,binaryType:this.webSocket.binaryType,extensions:this.webSocket.extensions}),this.emit(is,{ws:this.webSocket,tm:this.transactionManager}),this.webSocket):new Promise((e,t)=>{this.webSocket=new WebSocket(this.wsUrl),this.transactionManager=new rs(this.webSocket),this.webSocket.onopen=()=>{ss.info("WebSocket opened"),this.transactionManager.on("event",e=>{this.emit(cs,e)}),ss.info("Connected to server: ",this.webSocket.url),ss.debug("WebSocket value: ",{url:this.webSocket.url,protocol:this.webSocket.protocol,readyState:this.webSocket.readyState,binaryType:this.webSocket.binaryType,extensions:this.webSocket.extensions}),this.emit(is,{ws:this.webSocket,tm:this.transactionManager}),e(this.webSocket)},this.webSocket.onerror=()=>{ss.error("WebSocket not connected: ",this.webSocket.url),this.emit(os,this.webSocket.url),t(this.webSocket.url)},this.webSocket.onclose=()=>{this.webSocket=null,this.transactionManager=null,ss.info("Connection closed with Signaling Server."),this.emit(as)}})}close(){var e;ss.info("Closing connection with Signaling Server."),null==(e=this.webSocket)||e.close()}async subscribe(e,t,n=null,r=null){var s,i,o,a;ss.info("Starting subscription to streamName: ",this.streamName),ss.debug("Subcription local description: ",e);const c=ls(t,n,r),l={sdp:e=Ur.adaptCodecName(e,"AV1X",Zr.AV1),streamId:this.streamName,pinnedSourceId:c.pinnedSourceId,excludedSourceIds:c.excludedSourceIds,events:["active","inactive","layers","viewercount","vad","updated","migrate","stopped"]};c.vad&&(l.vad=!0),Array.isArray(c.events)&&(l.events=c.events),c.forcePlayoutDelay&&(l.forcePlayoutDelay=c.forcePlayoutDelay),c.layer&&(l.layer=c.layer);try{if(c.disableVideo&&c.disableAudio)throw new Error("Not attempting to connect as video and audio are disabled");await this.connect(),ss.info("Sending view command");const e=await this.transactionManager.cmd("view",l),t=null==(a=null==(o=null==(i=null==(s=RTCRtpReceiver.getCapabilities)?void 0:s.call(RTCRtpReceiver,"video"))?void 0:i.codecs)?void 0:o.find)?void 0:a.call(o,e=>"video/AV1X"===e.mimeType);return e.sdp=t?Ur.adaptCodecName(e.sdp,Zr.AV1,"AV1X"):e.sdp,ss.info("Command sent, subscriberId: ",e.subscriberId),ss.debug("Command result: ",e),this.serverId=e.subscriberId,this.clusterId=e.clusterId,this.streamViewId=e.streamViewId,Ie(this.streamName),ke(this.serverId),xe(e.streamViewId),Ae(this.clusterId),e.sdp}catch(e){throw ss.error("Error sending view command, error: ",e),e}}async publish(e,t,n=null,r=null){var s,i,o,a,c,l,u,d;const p=us(t,n,r);ss.info("Starting publishing to streamName: ".concat(this.streamName,", codec: ").concat(p.codec)),ss.debug("Publishing local description: ",e);const f=null!=(a=null==(o=null==(i=null==(s=tt.getCapabilities)?void 0:s.call(tt,"video"))?void 0:i.codecs)?void 0:o.map(e=>e.codec))?a:[],h=Object.values(Zr);if(-1===h.indexOf(p.codec))throw ss.error("Invalid codec ".concat(p.codec,". Possible values are: "),h),new Error("Invalid codec ".concat(p.codec,". Possible values are: ").concat(h));if(f.length>0&&-1===f.indexOf(p.codec))throw ss.error("Unsupported codec ".concat(p.codec,". Possible values are: "),f),new Error("Unsupported codec ".concat(p.codec,". Possible values are: ").concat(f));p.codec===Zr.AV1&&(e=Ur.adaptCodecName(e,"AV1X",Zr.AV1));const m={name:this.streamName,sdp:e,codec:p.codec,sourceId:p.sourceId};if(p.priority){if(!(Number.isInteger(p.priority)&&p.priority>=-2147483648&&p.priority<=2147483647))throw new Error("Invalid value for priority option. It should be a decimal integer between the range [-2^31, +2^31 - 1]");m.priority=p.priority}null!==p.record&&(m.record=p.record),Array.isArray(p.events)&&(m.events=p.events);try{if(p.disableVideo&&p.disableAudio)throw new Error("Not attempting to connect as video and audio are disabled");await this.connect(),ss.info("Sending publish command");const e=await this.transactionManager.cmd("publish",m);if(p.codec===Zr.AV1){const t=null==(d=null==(u=null==(l=null==(c=RTCRtpSender.getCapabilities)?void 0:c.call(RTCRtpSender,"video"))?void 0:l.codecs)?void 0:u.find)?void 0:d.call(u,e=>"video/AV1X"===e.mimeType);e.sdp=t?Ur.adaptCodecName(e.sdp,Zr.AV1,"AV1X"):e.sdp}return ss.info("Command sent, publisherId: ",e.publisherId),ss.debug("Command result: ",e),this.serverId=e.publisherId,this.clusterId=e.clusterId,Ie(this.streamName),ke(this.serverId),Te(e.feedId),Ae(this.clusterId),e.sdp}catch(e){throw ss.error("Error sending publish command, error: ",e),e}}async cmd(e,t){return ss.info("Sending cmd: ".concat(e)),this.transactionManager.cmd(e,t)}}const ls=(e,t,n)=>{let r="object"==typeof e?e:{};return 0===Object.keys(r).length&&(r={vad:e,pinnedSourceId:t,excludedSourceIds:n}),r},us=(e,t,n)=>{let r="object"==typeof e?e:{};if(0===Object.keys(r).length){const s=Zr.H264;r={codec:null!=e?e:s,record:t,sourceId:n}}return r};class mr extends Error{constructor(e,t){super(e),this.name="FetchError",this.status=t}}const ds=Be.get("Director"),fs="WebRtc";let hs="";let ms="https://director.millicast.com";const gs={setEndpoint:e=>{ms=e.replace(/\/$/,"")},getEndpoint:()=>ms,setLiveDomain:e=>{hs=e.replace(/\/$/,"")},getLiveDomain:()=>hs,getPublisher:async(e,t=null,n=fs)=>{const r=ys(e,t,n);ds.info("Getting publisher connection path for stream name: ",r.streamName);const s={streamName:r.streamName,streamType:r.streamType},i={"Content-Type":"application/json",Authorization:"Bearer ".concat(r.token)},o="".concat(gs.getEndpoint(),"/api/director/publish");try{const e=await fetch(o,{method:"POST",headers:i,body:JSON.stringify(s)});let t=await e.json();if("fail"===t.status)throw new mr(t.data.message,e.status);return t=bs(t),ds.debug("Getting publisher response: ",t),Ee(t.data.streamAccountId),t.data}catch(e){throw ds.error("Error while getting publisher connection path. ",e),e}},getSubscriber:async(e,t=null,n=null)=>{const r=vs(e,t,n);Ee(r.streamAccountId),ds.info("Getting subscriber connection data for stream name: ".concat(r.streamName," and account id: ").concat(r.streamAccountId));const s={streamAccountId:r.streamAccountId,streamName:r.streamName};let i={"Content-Type":"application/json"};r.subscriberToken&&(i=oe(ie({},i),{Authorization:"Bearer ".concat(r.subscriberToken)}));const o="".concat(gs.getEndpoint(),"/api/director/subscribe");try{const e=await fetch(o,{method:"POST",headers:i,body:JSON.stringify(s)});let t=await e.json();if("fail"===t.status)throw new mr(t.data.message,e.status);return t=bs(t),ds.debug("Getting subscriber response: ",t),r.subscriberToken&&(t.data.subscriberToken=r.subscriberToken),t.data}catch(e){throw ds.error("Error while getting subscriber connection path. ",e),e}}},ys=(e,t,n)=>{let r="object"==typeof e?e:{};return 0===Object.keys(r).length&&(r={token:e,streamName:t,streamType:n}),r},vs=(e,t,n)=>{let r="object"==typeof e?e:{};return 0===Object.keys(r).length&&(r={streamName:e,streamAccountId:t,subscriberToken:n}),r},bs=e=>{if(gs.getLiveDomain()){const t=/\/\/(.*?)\//,n=e.data.urls.map(e=>{const n=t.exec(e);return e.replace(n[1],gs.getLiveDomain())});e.data.urls=n}if(e.data.drmObject){const t=e.data.drmObject.playReadyUrl;t&&(e.data.drmObject.playReadyUrl="".concat(gs.getEndpoint()).concat(t));const n=e.data.drmObject.widevineUrl;n&&(e.data.drmObject.widevineUrl="".concat(gs.getEndpoint()).concat(n));const r=e.data.drmObject.fairPlayUrl;r&&(e.data.drmObject.fairPlayUrl="".concat(gs.getEndpoint()).concat(r));const s=e.data.drmObject.fairPlayCertUrl;s&&(e.data.drmObject.fairPlayCertUrl="".concat(gs.getEndpoint()).concat(s))}return e};function ws(e){this.message=e}ws.prototype=new Error,ws.prototype.name="InvalidCharacterError";var Ss=typeof window<"u"&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new ws("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,r,s=0,i=0,o="";r=t.charAt(i++);~r&&(n=s%4?64*n+r:r,s++%4)?o+=String.fromCharCode(255&n>>(-2*s&6)):0)r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(r);return o};function _s(e){this.message=e}function Rs(e,t){if("string"!=typeof e)throw new _s("Invalid token specified");var n=!0===(t=t||{}).header?0:1;try{return JSON.parse(function(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(Ss(e).replace(/(.)/g,(function(e,t){var n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n})))}(t)}catch(e){return Ss(t)}}(e.split(".")[n]))}catch(e){throw new _s("Invalid token specified: "+e.message)}}_s.prototype=new Error,_s.prototype.name="InvalidTokenError";var Es={exports:{}};!function(e,t){!function(n){if(null!=t&&"number"!=typeof t.nodeType)e.exports=n();else{var r=n(),s=typeof self<"u"?self:$.global;"function"!=typeof s.btoa&&(s.btoa=r.btoa),"function"!=typeof s.atob&&(s.atob=r.atob)}}((function(){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function t(e){this.message=e}return t.prototype=new Error,t.prototype.name="InvalidCharacterError",{btoa:function(n){for(var r,s,i,o,a=String(n),c=0,l="";c<a.length;){if(r=a.charCodeAt(c++),s=a.charCodeAt(c++),i=a.charCodeAt(c++),r>255||s>255||i>255)throw new t("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");l+=e.charAt((o=r<<16|s<<8|i)>>18&63)+e.charAt(o>>12&63)+e.charAt(o>>6&63)+e.charAt(63&o)}switch(a.length%3){case 0:return l;case 1:return l.slice(0,-2)+"==";case 2:return l.slice(0,-1)+"="}},atob:function(n){var r=String(n).replace(/[=]+$/,"");if(r.length%4==1)throw new t("'atob' failed: The string to be decoded is not correctly encoded.");for(var s,i,o=0,a=0,c="";i=r.charAt(a++);~i&&(s=o%4?64*s+i:i,o++%4)?c+=String.fromCharCode(255&s>>(-2*o&6)):0)i=e.indexOf(i);return c}}}))}(Es,Es.exports);var Is={exports:{}};let ks;!function(e,t){!function(t,n){e.exports=n()}(self,()=>{return e={7629:(e,t,n)=>{const r=n(375),s=n(8571),i=n(9474),o=n(1687),a=n(8652),c=n(8160),l=n(3292),u=n(6354),d=n(8901),p=n(9708),f=n(6914),h=n(2294),m=n(6133),g=n(1152),y=n(8863),v=n(2036),w={Base:class{constructor(e){this.type=e,this.$_root=null,this._definition={},this._reset()}_reset(){this._ids=new h.Ids,this._preferences=null,this._refs=new m.Manager,this._cache=null,this._valids=null,this._invalids=null,this._flags={},this._rules=[],this._singleRules=new Map,this.$_terms={},this.$_temp={ruleset:null,whens:{}}}describe(){return r("function"==typeof p.describe,"Manifest functionality disabled"),p.describe(this)}allow(...e){return c.verifyFlat(e,"allow"),this._values(e,"_valids")}alter(e){r(e&&"object"==typeof e&&!Array.isArray(e),"Invalid targets argument"),r(!this._inRuleset(),"Cannot set alterations inside a ruleset");const t=this.clone();t.$_terms.alterations=t.$_terms.alterations||[];for(const n in e){const s=e[n];r("function"==typeof s,"Alteration adjuster for",n,"must be a function"),t.$_terms.alterations.push({target:n,adjuster:s})}return t.$_temp.ruleset=!1,t}artifact(e){return r(void 0!==e,"Artifact cannot be undefined"),r(!this._cache,"Cannot set an artifact with a rule cache"),this.$_setFlag("artifact",e)}cast(e){return r(!1===e||"string"==typeof e,"Invalid to value"),r(!1===e||this._definition.cast[e],"Type",this.type,"does not support casting to",e),this.$_setFlag("cast",!1===e?void 0:e)}default(e,t){return this._default("default",e,t)}description(e){return r(e&&"string"==typeof e,"Description must be a non-empty string"),this.$_setFlag("description",e)}empty(e){const t=this.clone();return void 0!==e&&(e=t.$_compile(e,{override:!1})),t.$_setFlag("empty",e,{clone:!1})}error(e){return r(e,"Missing error"),r(e instanceof Error||"function"==typeof e,"Must provide a valid Error object or a function"),this.$_setFlag("error",e)}example(e,t={}){return r(void 0!==e,"Missing example"),c.assertOptions(t,["override"]),this._inner("examples",e,{single:!0,override:t.override})}external(e,t){return"object"==typeof e&&(r(!t,"Cannot combine options with description"),t=e.description,e=e.method),r("function"==typeof e,"Method must be a function"),r(void 0===t||t&&"string"==typeof t,"Description must be a non-empty string"),this._inner("externals",{method:e,description:t},{single:!0})}failover(e,t){return this._default("failover",e,t)}forbidden(){return this.presence("forbidden")}id(e){return e?(r("string"==typeof e,"id must be a non-empty string"),r(/^[^\.]+$/.test(e),"id cannot contain period character"),this.$_setFlag("id",e)):this.$_setFlag("id",void 0)}invalid(...e){return this._values(e,"_invalids")}label(e){return r(e&&"string"==typeof e,"Label name must be a non-empty string"),this.$_setFlag("label",e)}meta(e){return r(void 0!==e,"Meta cannot be undefined"),this._inner("metas",e,{single:!0})}note(...e){r(e.length,"Missing notes");for(const t of e)r(t&&"string"==typeof t,"Notes must be non-empty strings");return this._inner("notes",e)}only(e=!0){return r("boolean"==typeof e,"Invalid mode:",e),this.$_setFlag("only",e)}optional(){return this.presence("optional")}prefs(e){r(e,"Missing preferences"),r(void 0===e.context,"Cannot override context"),r(void 0===e.externals,"Cannot override externals"),r(void 0===e.warnings,"Cannot override warnings"),r(void 0===e.debug,"Cannot override debug"),c.checkPreferences(e);const t=this.clone();return t._preferences=c.preferences(t._preferences,e),t}presence(e){return r(["optional","required","forbidden"].includes(e),"Unknown presence mode",e),this.$_setFlag("presence",e)}raw(e=!0){return this.$_setFlag("result",e?"raw":void 0)}result(e){return r(["raw","strip"].includes(e),"Unknown result mode",e),this.$_setFlag("result",e)}required(){return this.presence("required")}strict(e){const t=this.clone(),n=void 0!==e&&!e;return t._preferences=c.preferences(t._preferences,{convert:n}),t}strip(e=!0){return this.$_setFlag("result",e?"strip":void 0)}tag(...e){r(e.length,"Missing tags");for(const t of e)r(t&&"string"==typeof t,"Tags must be non-empty strings");return this._inner("tags",e)}unit(e){return r(e&&"string"==typeof e,"Unit name must be a non-empty string"),this.$_setFlag("unit",e)}valid(...e){c.verifyFlat(e,"valid");const t=this.allow(...e);return t.$_setFlag("only",!!t._valids,{clone:!1}),t}when(e,t){const n=this.clone();n.$_terms.whens||(n.$_terms.whens=[]);const s=l.when(n,e,t);if(!["any","link"].includes(n.type)){const e=s.is?[s]:s.switch;for(const t of e)r(!t.then||"any"===t.then.type||t.then.type===n.type,"Cannot combine",n.type,"with",t.then&&t.then.type),r(!t.otherwise||"any"===t.otherwise.type||t.otherwise.type===n.type,"Cannot combine",n.type,"with",t.otherwise&&t.otherwise.type)}return n.$_terms.whens.push(s),n.$_mutateRebuild()}cache(e){r(!this._inRuleset(),"Cannot set caching inside a ruleset"),r(!this._cache,"Cannot override schema cache"),r(void 0===this._flags.artifact,"Cannot cache a rule with an artifact");const t=this.clone();return t._cache=e||a.provider.provision(),t.$_temp.ruleset=!1,t}clone(){const e=Object.create(Object.getPrototypeOf(this));return this._assign(e)}concat(e){r(c.isSchema(e),"Invalid schema object"),r("any"===this.type||"any"===e.type||e.type===this.type,"Cannot merge type",this.type,"with another type:",e.type),r(!this._inRuleset(),"Cannot concatenate onto a schema with open ruleset"),r(!e._inRuleset(),"Cannot concatenate a schema with open ruleset");let t=this.clone();if("any"===this.type&&"any"!==e.type){const n=e.clone();for(const e of Object.keys(t))"type"!==e&&(n[e]=t[e]);t=n}t._ids.concat(e._ids),t._refs.register(e,m.toSibling),t._preferences=t._preferences?c.preferences(t._preferences,e._preferences):e._preferences,t._valids=v.merge(t._valids,e._valids,e._invalids),t._invalids=v.merge(t._invalids,e._invalids,e._valids);for(const n of e._singleRules.keys())t._singleRules.has(n)&&(t._rules=t._rules.filter(e=>e.keep||e.name!==n),t._singleRules.delete(n));for(const n of e._rules)e._definition.rules[n.method].multi||t._singleRules.set(n.name,n),t._rules.push(n);if(t._flags.empty&&e._flags.empty){t._flags.empty=t._flags.empty.concat(e._flags.empty);const n=Object.assign({},e._flags);delete n.empty,o(t._flags,n)}else if(e._flags.empty){t._flags.empty=e._flags.empty;const n=Object.assign({},e._flags);delete n.empty,o(t._flags,n)}else o(t._flags,e._flags);for(const n in e.$_terms){const r=e.$_terms[n];r?t.$_terms[n]?t.$_terms[n]=t.$_terms[n].concat(r):t.$_terms[n]=r.slice():t.$_terms[n]||(t.$_terms[n]=r)}return this.$_root._tracer&&this.$_root._tracer._combine(t,[this,e]),t.$_mutateRebuild()}extend(e){return r(!e.base,"Cannot extend type with another base"),d.type(this,e)}extract(e){return e=Array.isArray(e)?e:e.split("."),this._ids.reach(e)}fork(e,t){r(!this._inRuleset(),"Cannot fork inside a ruleset");let n=this;for(let r of[].concat(e))r=Array.isArray(r)?r:r.split("."),n=n._ids.fork(r,t,n);return n.$_temp.ruleset=!1,n}rule(e){const t=this._definition;c.assertOptions(e,Object.keys(t.modifiers)),r(!1!==this.$_temp.ruleset,"Cannot apply rules to empty ruleset or the last rule added does not support rule properties");const n=null===this.$_temp.ruleset?this._rules.length-1:this.$_temp.ruleset;r(n>=0&&n<this._rules.length,"Cannot apply rules to empty ruleset");const i=this.clone();for(let o=n;o<i._rules.length;++o){const n=i._rules[o],a=s(n);for(const s in e)t.modifiers[s](a,e[s]),r(a.name===n.name,"Cannot change rule name");i._rules[o]=a,i._singleRules.get(a.name)===n&&i._singleRules.set(a.name,a)}return i.$_temp.ruleset=!1,i.$_mutateRebuild()}get ruleset(){r(!this._inRuleset(),"Cannot start a new ruleset without closing the previous one");const e=this.clone();return e.$_temp.ruleset=e._rules.length,e}get $(){return this.ruleset}tailor(e){e=[].concat(e),r(!this._inRuleset(),"Cannot tailor inside a ruleset");let t=this;if(this.$_terms.alterations)for(const{target:n,adjuster:s}of this.$_terms.alterations)e.includes(n)&&(t=s(t),r(c.isSchema(t),"Alteration adjuster for",n,"failed to return a schema object"));return t=t.$_modify({each:t=>t.tailor(e),ref:!1}),t.$_temp.ruleset=!1,t.$_mutateRebuild()}tracer(){return g.location?g.location(this):this}validate(e,t){return y.entry(e,this,t)}validateAsync(e,t){return y.entryAsync(e,this,t)}$_addRule(e){"string"==typeof e&&(e={name:e}),r(e&&"object"==typeof e,"Invalid options"),r(e.name&&"string"==typeof e.name,"Invalid rule name");for(const t in e)r("_"!==t[0],"Cannot set private rule properties");const t=Object.assign({},e);t._resolve=[],t.method=t.method||t.name;const n=this._definition.rules[t.method],s=t.args;r(n,"Unknown rule",t.method);const i=this.clone();if(s){r(1===Object.keys(s).length||Object.keys(s).length===this._definition.rules[t.name].args.length,"Invalid rule definition for",this.type,t.name);for(const e in s){let o=s[e];if(n.argsByName){const a=n.argsByName.get(e);if(a.ref&&c.isResolvable(o))t._resolve.push(e),i.$_mutateRegister(o);else if(a.normalize&&(o=a.normalize(o),s[e]=o),a.assert){const t=c.validateArg(o,e,a);r(!t,t,"or reference")}}void 0!==o?s[e]=o:delete s[e]}}return n.multi||(i._ruleRemove(t.name,{clone:!1}),i._singleRules.set(t.name,t)),!1===i.$_temp.ruleset&&(i.$_temp.ruleset=null),n.priority?i._rules.unshift(t):i._rules.push(t),i}$_compile(e,t){return l.schema(this.$_root,e,t)}$_createError(e,t,n,r,s,i={}){const o=!1!==i.flags?this._flags:{},a=i.messages?f.merge(this._definition.messages,i.messages):this._definition.messages;return new u.Report(e,t,n,o,a,r,s)}$_getFlag(e){return this._flags[e]}$_getRule(e){return this._singleRules.get(e)}$_mapLabels(e){return e=Array.isArray(e)?e:e.split("."),this._ids.labels(e)}$_match(e,t,n,r){(n=Object.assign({},n)).abortEarly=!0,n._externals=!1,t.snapshot();const s=!y.validate(e,this,t,n,r).errors;return t.restore(),s}$_modify(e){return c.assertOptions(e,["each","once","ref","schema"]),h.schema(this,e)||this}$_mutateRebuild(){return r(!this._inRuleset(),"Cannot add this rule inside a ruleset"),this._refs.reset(),this._ids.reset(),this.$_modify({each:(e,{source:t,name:n,path:r,key:s})=>{const i=this._definition[t][n]&&this._definition[t][n].register;!1!==i&&this.$_mutateRegister(e,{family:i,key:s})}}),this._definition.rebuild&&this._definition.rebuild(this),this.$_temp.ruleset=!1,this}$_mutateRegister(e,{family:t,key:n}={}){this._refs.register(e,t),this._ids.register(e,{key:n})}$_property(e){return this._definition.properties[e]}$_reach(e){return this._ids.reach(e)}$_rootReferences(){return this._refs.roots()}$_setFlag(e,t,n={}){r("_"===e[0]||!this._inRuleset(),"Cannot set flag inside a ruleset");const s=this._definition.flags[e]||{};if(i(t,s.default)&&(t=void 0),i(t,this._flags[e]))return this;const o=!1!==n.clone?this.clone():this;return void 0!==t?(o._flags[e]=t,o.$_mutateRegister(t)):delete o._flags[e],"_"!==e[0]&&(o.$_temp.ruleset=!1),o}$_parent(e,...t){return this[e][c.symbols.parent].call(this,...t)}$_validate(e,t,n){return y.validate(e,this,t,n)}_assign(e){e.type=this.type,e.$_root=this.$_root,e.$_temp=Object.assign({},this.$_temp),e.$_temp.whens={},e._ids=this._ids.clone(),e._preferences=this._preferences,e._valids=this._valids&&this._valids.clone(),e._invalids=this._invalids&&this._invalids.clone(),e._rules=this._rules.slice(),e._singleRules=s(this._singleRules,{shallow:!0}),e._refs=this._refs.clone(),e._flags=Object.assign({},this._flags),e._cache=null,e.$_terms={};for(const t in this.$_terms)e.$_terms[t]=this.$_terms[t]?this.$_terms[t].slice():null;e.$_super={};for(const t in this.$_super)e.$_super[t]=this._super[t].bind(e);return e}_bare(){const e=this.clone();e._reset();const t=e._definition.terms;for(const n in t){const r=t[n];e.$_terms[n]=r.init}return e.$_mutateRebuild()}_default(e,t,n={}){return c.assertOptions(n,"literal"),r(void 0!==t,"Missing",e,"value"),r("function"==typeof t||!n.literal,"Only function value supports literal option"),"function"==typeof t&&n.literal&&(t={[c.symbols.literal]:!0,literal:t}),this.$_setFlag(e,t)}_generate(e,t,n){if(!this.$_terms.whens)return{schema:this};const r=[],s=[];for(let i=0;i<this.$_terms.whens.length;++i){const o=this.$_terms.whens[i];if(o.concat){r.push(o.concat),s.push("".concat(i,".concat"));continue}const a=o.ref?o.ref.resolve(e,t,n):e,c=o.is?[o]:o.switch,l=s.length;for(let l=0;l<c.length;++l){const{is:u,then:d,otherwise:p}=c[l],f="".concat(i).concat(o.switch?"."+l:"");if(u.$_match(a,t.nest(u,"".concat(f,".is")),n)){if(d){const i=t.localize([...t.path,"".concat(f,".then")],t.ancestors,t.schemas),{schema:o,id:a}=d._generate(e,i,n);r.push(o),s.push("".concat(f,".then").concat(a?"(".concat(a,")"):""));break}}else if(p){const i=t.localize([...t.path,"".concat(f,".otherwise")],t.ancestors,t.schemas),{schema:o,id:a}=p._generate(e,i,n);r.push(o),s.push("".concat(f,".otherwise").concat(a?"(".concat(a,")"):""));break}}if(o.break&&s.length>l)break}const i=s.join(", ");if(t.mainstay.tracer.debug(t,"rule","when",i),!i)return{schema:this};if(!t.mainstay.tracer.active&&this.$_temp.whens[i])return{schema:this.$_temp.whens[i],id:i};let o=this;this._definition.generate&&(o=this._definition.generate(this,e,t,n));for(const e of r)o=o.concat(e);return this.$_root._tracer&&this.$_root._tracer._combine(o,[this,...r]),this.$_temp.whens[i]=o,{schema:o,id:i}}_inner(e,t,n={}){r(!this._inRuleset(),"Cannot set ".concat(e," inside a ruleset"));const s=this.clone();return s.$_terms[e]&&!n.override||(s.$_terms[e]=[]),n.single?s.$_terms[e].push(t):s.$_terms[e].push(...t),s.$_temp.ruleset=!1,s}_inRuleset(){return null!==this.$_temp.ruleset&&!1!==this.$_temp.ruleset}_ruleRemove(e,t={}){if(!this._singleRules.has(e))return this;const n=!1!==t.clone?this.clone():this;n._singleRules.delete(e);const r=[];for(let t=0;t<n._rules.length;++t){const s=n._rules[t];s.name!==e||s.keep?r.push(s):n._inRuleset()&&t<n.$_temp.ruleset&&--n.$_temp.ruleset}return n._rules=r,n}_values(e,t){c.verifyFlat(e,t.slice(1,-1));const n=this.clone(),s=e[0]===c.symbols.override;if(s&&(e=e.slice(1)),!n[t]&&e.length?n[t]=new v:s&&(n[t]=e.length?new v:null,n.$_mutateRebuild()),!n[t])return n;s&&n[t].override();for(const s of e){r(void 0!==s,"Cannot call allow/valid/invalid with undefined"),r(s!==c.symbols.override,"Override must be the first value");const e="_invalids"===t?"_valids":"_invalids";n[e]&&(n[e].remove(s),n[e].length||(r("_valids"===t||!n._flags.only,"Setting invalid value",s,"leaves schema rejecting all values due to previous valid rule"),n[e]=null)),n[t].add(s,n._refs)}return n}}};w.Base.prototype[c.symbols.any]={version:c.version,compile:l.compile,root:"$_root"},w.Base.prototype.isImmutable=!0,w.Base.prototype.deny=w.Base.prototype.invalid,w.Base.prototype.disallow=w.Base.prototype.invalid,w.Base.prototype.equal=w.Base.prototype.valid,w.Base.prototype.exist=w.Base.prototype.required,w.Base.prototype.not=w.Base.prototype.invalid,w.Base.prototype.options=w.Base.prototype.prefs,w.Base.prototype.preferences=w.Base.prototype.prefs,e.exports=new w.Base},8652:(e,t,n)=>{const r=n(375),s=n(8571),i=n(8160),o={max:1e3,supported:new Set(["undefined","boolean","number","string"])};t.provider={provision:e=>new o.Cache(e)},o.Cache=class{constructor(e={}){i.assertOptions(e,["max"]),r(void 0===e.max||e.max&&e.max>0&&isFinite(e.max),"Invalid max cache size"),this._max=e.max||o.max,this._map=new Map,this._list=new o.List}get length(){return this._map.size}set(e,t){if(null!==e&&!o.supported.has(typeof e))return;let n=this._map.get(e);if(n)return n.value=t,void this._list.first(n);n=this._list.unshift({key:e,value:t}),this._map.set(e,n),this._compact()}get(e){const t=this._map.get(e);if(t)return this._list.first(t),s(t.value)}_compact(){if(this._map.size>this._max){const e=this._list.pop();this._map.delete(e.key)}}},o.List=class{constructor(){this.tail=null,this.head=null}unshift(e){return e.next=null,e.prev=this.head,this.head&&(this.head.next=e),this.head=e,this.tail||(this.tail=e),e}first(e){e!==this.head&&(this._remove(e),this.unshift(e))}pop(){return this._remove(this.tail)}_remove(e){const{next:t,prev:n}=e;return t.prev=n,n&&(n.next=t),e===this.tail&&(this.tail=t),e.prev=null,e.next=null,e}}},8160:(e,t,n)=>{const r=n(375),s=n(7916),i=n(5934);let o,a;const c={isoDate:/^(?:[-+]\d{2})?(?:\d{4}(?!\d{2}\b))(?:(-?)(?:(?:0[1-9]|1[0-2])(?:\1(?:[12]\d|0[1-9]|3[01]))?|W(?:[0-4]\d|5[0-2])(?:-?[1-7])?|(?:00[1-9]|0[1-9]\d|[12]\d{2}|3(?:[0-5]\d|6[1-6])))(?![T]$|[T][\d]+Z$)(?:[T\s](?:(?:(?:[01]\d|2[0-3])(?:(:?)[0-5]\d)?|24\:?00)(?:[.,]\d+(?!:))?)(?:\2[0-5]\d(?:[.,]\d+)?)?(?:[Z]|(?:[+-])(?:[01]\d|2[0-3])(?::?[0-5]\d)?)?)?)?$/};t.version=i.version,t.defaults={abortEarly:!0,allowUnknown:!1,artifacts:!1,cache:!0,context:null,convert:!0,dateFormat:"iso",errors:{escapeHtml:!1,label:"path",language:null,render:!0,stack:!1,wrap:{label:'"',array:"[]"}},externals:!0,messages:{},nonEnumerables:!1,noDefaults:!1,presence:"optional",skipFunctions:!1,stripUnknown:!1,warnings:!1},t.symbols={any:Symbol.for("@hapi/joi/schema"),arraySingle:Symbol("arraySingle"),deepDefault:Symbol("deepDefault"),errors:Symbol("errors"),literal:Symbol("literal"),override:Symbol("override"),parent:Symbol("parent"),prefs:Symbol("prefs"),ref:Symbol("ref"),template:Symbol("template"),values:Symbol("values")},t.assertOptions=function(e,t,n="Options"){r(e&&"object"==typeof e&&!Array.isArray(e),"Options must be of type object");const s=Object.keys(e).filter(e=>!t.includes(e));r(0===s.length,"".concat(n," contain unknown keys: ").concat(s))},t.checkPreferences=function(e){a=a||n(3378);const t=a.preferences.validate(e);if(t.error)throw new s([t.error.details[0].message])},t.compare=function(e,t,n){switch(n){case"=":return e===t;case">":return e>t;case"<":return e<t;case">=":return e>=t;case"<=":return e<=t}},t.default=function(e,t){return void 0===e?t:e},t.isIsoDate=function(e){return c.isoDate.test(e)},t.isNumber=function(e){return"number"==typeof e&&!isNaN(e)},t.isResolvable=function(e){return!!e&&(e[t.symbols.ref]||e[t.symbols.template])},t.isSchema=function(e,n={}){const s=e&&e[t.symbols.any];return!!s&&(r(n.legacy||s.version===t.version,"Cannot mix different versions of joi schemas"),!0)},t.isValues=function(e){return e[t.symbols.values]},t.limit=function(e){return Number.isSafeInteger(e)&&e>=0},t.preferences=function(e,r){o=o||n(6914),e=e||{},r=r||{};const s=Object.assign({},e,r);return r.errors&&e.errors&&(s.errors=Object.assign({},e.errors,r.errors),s.errors.wrap=Object.assign({},e.errors.wrap,r.errors.wrap)),r.messages&&(s.messages=o.compile(r.messages,e.messages)),delete s[t.symbols.prefs],s},t.tryWithPath=function(e,t,n={}){try{return e()}catch(e){throw void 0!==e.path?e.path=t+"."+e.path:e.path=t,n.append&&(e.message="".concat(e.message," (").concat(e.path,")")),e}},t.validateArg=function(e,n,{assert:r,message:s}){if(t.isSchema(r)){const t=r.validate(e);return t.error?t.error.message:void 0}if(!r(e))return n?"".concat(n," ").concat(s):s},t.verifyFlat=function(e,t){for(const n of e)r(!Array.isArray(n),"Method no longer accepts array arguments:",t)}},3292:(e,t,n)=>{const r=n(375),s=n(8160),i=n(6133),o={};t.schema=function(e,t,n={}){s.assertOptions(n,["appendPath","override"]);try{return o.schema(e,t,n)}catch(e){throw n.appendPath&&void 0!==e.path&&(e.message="".concat(e.message," (").concat(e.path,")")),e}},o.schema=function(e,t,n){r(void 0!==t,"Invalid undefined schema"),Array.isArray(t)&&(r(t.length,"Invalid empty array schema"),1===t.length&&(t=t[0]));const i=(t,...r)=>!1!==n.override?t.valid(e.override,...r):t.valid(...r);if(o.simple(t))return i(e,t);if("function"==typeof t)return e.custom(t);if(r("object"==typeof t,"Invalid schema content:",typeof t),s.isResolvable(t))return i(e,t);if(s.isSchema(t))return t;if(Array.isArray(t)){for(const n of t)if(!o.simple(n))return e.alternatives().try(...t);return i(e,...t)}return t instanceof RegExp?e.string().regex(t):t instanceof Date?i(e.date(),t):(r(Object.getPrototypeOf(t)===Object.getPrototypeOf({}),"Schema can only contain plain objects"),e.object().keys(t))},t.ref=function(e,t){return i.isRef(e)?e:i.create(e,t)},t.compile=function(e,n,i={}){s.assertOptions(i,["legacy"]);const a=n&&n[s.symbols.any];if(a)return r(i.legacy||a.version===s.version,"Cannot mix different versions of joi schemas:",a.version,s.version),n;if("object"!=typeof n||!i.legacy)return t.schema(e,n,{appendPath:!0});const c=o.walk(n);return c?c.compile(c.root,n):t.schema(e,n,{appendPath:!0})},o.walk=function(e){if("object"!=typeof e)return null;if(Array.isArray(e)){for(const t of e){const e=o.walk(t);if(e)return e}return null}const t=e[s.symbols.any];if(t)return{root:e[t.root],compile:t.compile};r(Object.getPrototypeOf(e)===Object.getPrototypeOf({}),"Schema can only contain plain objects");for(const t in e){const n=o.walk(e[t]);if(n)return n}return null},o.simple=function(e){return null===e||["boolean","string","number"].includes(typeof e)},t.when=function(e,n,a){if(void 0===a&&(r(n&&"object"==typeof n,"Missing options"),a=n,n=i.create(".")),Array.isArray(a)&&(a={switch:a}),s.assertOptions(a,["is","not","then","otherwise","switch","break"]),s.isSchema(n))return r(void 0===a.is,'"is" can not be used with a schema condition'),r(void 0===a.not,'"not" can not be used with a schema condition'),r(void 0===a.switch,'"switch" can not be used with a schema condition'),o.condition(e,{is:n,then:a.then,otherwise:a.otherwise,break:a.break});if(r(i.isRef(n)||"string"==typeof n,"Invalid condition:",n),r(void 0===a.not||void 0===a.is,'Cannot combine "is" with "not"'),void 0===a.switch){let c=a;void 0!==a.not&&(c={is:a.not,then:a.otherwise,otherwise:a.then,break:a.break});let l=void 0!==c.is?e.$_compile(c.is):e.$_root.invalid(null,!1,0,"").required();return r(void 0!==c.then||void 0!==c.otherwise,'options must have at least one of "then", "otherwise", or "switch"'),r(void 0===c.break||void 0===c.then||void 0===c.otherwise,"Cannot specify then, otherwise, and break all together"),void 0===a.is||i.isRef(a.is)||s.isSchema(a.is)||(l=l.required()),o.condition(e,{ref:t.ref(n),is:l,then:c.then,otherwise:c.otherwise,break:c.break})}r(Array.isArray(a.switch),'"switch" must be an array'),r(void 0===a.is,'Cannot combine "switch" with "is"'),r(void 0===a.not,'Cannot combine "switch" with "not"'),r(void 0===a.then,'Cannot combine "switch" with "then"');const c={ref:t.ref(n),switch:[],break:a.break};for(let t=0;t<a.switch.length;++t){const n=a.switch[t],o=t===a.switch.length-1;s.assertOptions(n,o?["is","then","otherwise"]:["is","then"]),r(void 0!==n.is,'Switch statement missing "is"'),r(void 0!==n.then,'Switch statement missing "then"');const l={is:e.$_compile(n.is),then:e.$_compile(n.then)};if(i.isRef(n.is)||s.isSchema(n.is)||(l.is=l.is.required()),o){r(void 0===a.otherwise||void 0===n.otherwise,'Cannot specify "otherwise" inside and outside a "switch"');const t=void 0!==a.otherwise?a.otherwise:n.otherwise;void 0!==t&&(r(void 0===c.break,"Cannot specify both otherwise and break"),l.otherwise=e.$_compile(t))}c.switch.push(l)}return c},o.condition=function(e,t){for(const n of["then","otherwise"])void 0===t[n]?delete t[n]:t[n]=e.$_compile(t[n]);return t}},6354:(e,t,n)=>{const r=n(5688),s=n(8160),i=n(3328);t.Report=class{constructor(e,n,r,s,i,o,a){if(this.code=e,this.flags=s,this.messages=i,this.path=o.path,this.prefs=a,this.state=o,this.value=n,this.message=null,this.template=null,this.local=r||{},this.local.label=t.label(this.flags,this.state,this.prefs,this.messages),void 0===this.value||this.local.hasOwnProperty("value")||(this.local.value=this.value),this.path.length){const e=this.path[this.path.length-1];"object"!=typeof e&&(this.local.key=e)}}_setTemplate(e){if(this.template=e,!this.flags.label&&0===this.path.length){const e=this._template(this.template,"root");e&&(this.local.label=e)}}toString(){if(this.message)return this.message;const e=this.code;if(!this.prefs.errors.render)return this.code;const t=this._template(this.template)||this._template(this.prefs.messages)||this._template(this.messages);return void 0===t?'Error code "'.concat(e,'" is not defined, your custom type is missing the correct messages definition'):(this.message=t.render(this.value,this.state,this.prefs,this.local,{errors:this.prefs.errors,messages:[this.prefs.messages,this.messages]}),this.prefs.errors.label||(this.message=this.message.replace(/^"" /,"").trim()),this.message)}_template(e,n){return t.template(this.value,e,n||this.code,this.state,this.prefs)}},t.path=function(e){let t="";for(const n of e)"object"!=typeof n&&("string"==typeof n?(t&&(t+="."),t+=n):t+="[".concat(n,"]"));return t},t.template=function(e,t,n,r,o){if(!t)return;if(i.isTemplate(t))return"root"!==n?t:null;let a=o.errors.language;if(s.isResolvable(a)&&(a=a.resolve(e,r,o)),a&&t[a]){if(void 0!==t[a][n])return t[a][n];if(void 0!==t[a]["*"])return t[a]["*"]}return t[n]?t[n]:t["*"]},t.label=function(e,n,r,s){if(!r.errors.label)return"";if(e.label)return e.label;let i=n.path;return"key"===r.errors.label&&n.path.length>1&&(i=n.path.slice(-1)),t.path(i)||t.template(null,r.messages,"root",n,r)||s&&t.template(null,s,"root",n,r)||"value"},t.process=function(e,n,r){if(!e)return null;const{override:s,message:i,details:o}=t.details(e);if(s)return s;if(r.errors.stack)return new t.ValidationError(i,o,n);const a=Error.stackTraceLimit;Error.stackTraceLimit=0;const c=new t.ValidationError(i,o,n);return Error.stackTraceLimit=a,c},t.details=function(e,t={}){let n=[];const r=[];for(const s of e){if(s instanceof Error){if(!1!==t.override)return{override:s};const e=s.toString();n.push(e),r.push({message:e,type:"override",context:{error:s}});continue}const e=s.toString();n.push(e),r.push({message:e,path:s.path.filter(e=>"object"!=typeof e),type:s.code,context:s.local})}return n.length>1&&(n=[...new Set(n)]),{message:n.join(". "),details:r}},t.ValidationError=class extends Error{constructor(e,t,n){super(e),this._original=n,this.details=t}static isError(e){return e instanceof t.ValidationError}},t.ValidationError.prototype.isJoi=!0,t.ValidationError.prototype.name="ValidationError",t.ValidationError.prototype.annotate=r.error},8901:(e,t,n)=>{const r=n(375),s=n(8571),i=n(8160),o=n(6914),a={};t.type=function(e,t){const n=Object.getPrototypeOf(e),c=s(n),l=e._assign(Object.create(c)),u=Object.assign({},t);delete u.base,c._definition=u;const d=n._definition||{};u.messages=o.merge(d.messages,u.messages),u.properties=Object.assign({},d.properties,u.properties),l.type=u.type,u.flags=Object.assign({},d.flags,u.flags);const p=Object.assign({},d.terms);if(u.terms)for(const e in u.terms){const t=u.terms[e];r(void 0===l.$_terms[e],"Invalid term override for",u.type,e),l.$_terms[e]=t.init,p[e]=t}u.terms=p,u.args||(u.args=d.args),u.prepare=a.prepare(u.prepare,d.prepare),u.coerce&&("function"==typeof u.coerce&&(u.coerce={method:u.coerce}),u.coerce.from&&!Array.isArray(u.coerce.from)&&(u.coerce={method:u.coerce.method,from:[].concat(u.coerce.from)})),u.coerce=a.coerce(u.coerce,d.coerce),u.validate=a.validate(u.validate,d.validate);const f=Object.assign({},d.rules);if(u.rules)for(const e in u.rules){const t=u.rules[e];r("object"==typeof t,"Invalid rule definition for",u.type,e);let n=t.method;if(void 0===n&&(n=function(){return this.$_addRule(e)}),n&&(r(!c[e],"Rule conflict in",u.type,e),c[e]=n),r(!f[e],"Rule conflict in",u.type,e),f[e]=t,t.alias){const e=[].concat(t.alias);for(const n of e)c[n]=t.method}t.args&&(t.argsByName=new Map,t.args=t.args.map(e=>("string"==typeof e&&(e={name:e}),r(!t.argsByName.has(e.name),"Duplicated argument name",e.name),i.isSchema(e.assert)&&(e.assert=e.assert.strict().label(e.name)),t.argsByName.set(e.name,e),e)))}u.rules=f;const h=Object.assign({},d.modifiers);if(u.modifiers)for(const e in u.modifiers){r(!c[e],"Rule conflict in",u.type,e);const t=u.modifiers[e];r("function"==typeof t,"Invalid modifier definition for",u.type,e);const n=function(t){return this.rule({[e]:t})};c[e]=n,h[e]=t}if(u.modifiers=h,u.overrides){c._super=n,l.$_super={};for(const e in u.overrides)r(n[e],"Cannot override missing",e),u.overrides[e][i.symbols.parent]=n[e],l.$_super[e]=n[e].bind(l);Object.assign(c,u.overrides)}u.cast=Object.assign({},d.cast,u.cast);const m=Object.assign({},d.manifest,u.manifest);return m.build=a.build(u.manifest&&u.manifest.build,d.manifest&&d.manifest.build),u.manifest=m,u.rebuild=a.rebuild(u.rebuild,d.rebuild),l},a.build=function(e,t){return e&&t?function(n,r){return t(e(n,r),r)}:e||t},a.coerce=function(e,t){return e&&t?{from:e.from&&t.from?[...new Set([...e.from,...t.from])]:null,method(n,r){let s;if((!t.from||t.from.includes(typeof n))&&(s=t.method(n,r),s)){if(s.errors||void 0===s.value)return s;n=s.value}if(!e.from||e.from.includes(typeof n)){const t=e.method(n,r);if(t)return t}return s}}:e||t},a.prepare=function(e,t){return e&&t?function(n,r){const s=e(n,r);if(s){if(s.errors||void 0===s.value)return s;n=s.value}return t(n,r)||s}:e||t},a.rebuild=function(e,t){return e&&t?function(n){t(n),e(n)}:e||t},a.validate=function(e,t){return e&&t?function(n,r){const s=t(n,r);if(s){if(s.errors&&(!Array.isArray(s.errors)||s.errors.length))return s;n=s.value}return e(n,r)||s}:e||t}},5107:(e,t,n)=>{const r=n(375),s=n(8571),i=n(8652),o=n(8160),a=n(3292),c=n(6354),l=n(8901),u=n(9708),d=n(6133),p=n(3328),f=n(1152);let h;const m={types:{alternatives:n(4946),any:n(8068),array:n(546),boolean:n(4937),date:n(7500),function:n(390),link:n(8785),number:n(3832),object:n(8966),string:n(7417),symbol:n(8826)},aliases:{alt:"alternatives",bool:"boolean",func:"function"},root:function(){const e={_types:new Set(Object.keys(m.types))};for(const t of e._types)e[t]=function(...e){return r(!e.length||["alternatives","link","object"].includes(t),"The",t,"type does not allow arguments"),m.generate(this,m.types[t],e)};for(const t of["allow","custom","disallow","equal","exist","forbidden","invalid","not","only","optional","options","prefs","preferences","required","strip","valid","when"])e[t]=function(...e){return this.any()[t](...e)};Object.assign(e,m.methods);for(const t in m.aliases){const n=m.aliases[t];e[t]=e[n]}return e.x=e.expression,f.setup&&f.setup(e),e}};m.methods={ValidationError:c.ValidationError,version:o.version,cache:i.provider,assert(e,t,...n){m.assert(e,t,!0,n)},attempt:(e,t,...n)=>m.assert(e,t,!1,n),build(e){return r("function"==typeof u.build,"Manifest functionality disabled"),u.build(this,e)},checkPreferences(e){o.checkPreferences(e)},compile(e,t){return a.compile(this,e,t)},defaults(e){r("function"==typeof e,"modifier must be a function");const t=Object.assign({},this);for(const n of t._types){const s=e(t[n]());r(o.isSchema(s),"modifier must return a valid schema object"),t[n]=function(...e){return m.generate(this,s,e)}}return t},expression:(...e)=>new p(...e),extend(...e){o.verifyFlat(e,"extend"),h=h||n(3378),r(e.length,"You need to provide at least one extension"),this.assert(e,h.extensions);const t=Object.assign({},this);t._types=new Set(t._types);for(let n of e){"function"==typeof n&&(n=n(t)),this.assert(n,h.extension);const e=m.expandExtension(n,t);for(const n of e){r(void 0===t[n.type]||t._types.has(n.type),"Cannot override name",n.type);const e=n.base||this.any(),s=l.type(e,n);t._types.add(n.type),t[n.type]=function(...e){return m.generate(this,s,e)}}}return t},isError:c.ValidationError.isError,isExpression:p.isTemplate,isRef:d.isRef,isSchema:o.isSchema,in:(...e)=>d.in(...e),override:o.symbols.override,ref:(...e)=>d.create(...e),types(){const e={};for(const t of this._types)e[t]=this[t]();for(const t in m.aliases)e[t]=this[t]();return e}},m.assert=function(e,t,n,r){const i=r[0]instanceof Error||"string"==typeof r[0]?r[0]:null,a=null!==i?r[1]:r[0],l=t.validate(e,o.preferences({errors:{stack:!0}},a||{}));let u=l.error;if(!u)return l.value;if(i instanceof Error)throw i;const d=n&&"function"==typeof u.annotate?u.annotate():u.message;throw u instanceof c.ValidationError==0&&(u=s(u)),u.message=i?"".concat(i," ").concat(d):d,u},m.generate=function(e,t,n){return r(e,"Must be invoked on a Joi instance."),t.$_root=e,t._definition.args&&n.length?t._definition.args(t,...n):t},m.expandExtension=function(e,t){if("string"==typeof e.type)return[e];const n=[];for(const r of t._types)if(e.type.test(r)){const s=Object.assign({},e);s.type=r,s.base=t[r](),n.push(s)}return n},e.exports=m.root()},6914:(e,t,n)=>{const r=n(375),s=n(8571),i=n(3328);t.compile=function(e,t){if("string"==typeof e)return r(!t,"Cannot set single message string"),new i(e);if(i.isTemplate(e))return r(!t,"Cannot set single message template"),e;r("object"==typeof e&&!Array.isArray(e),"Invalid message options"),t=t?s(t):{};for(let n in e){const s=e[n];if("root"===n||i.isTemplate(s)){t[n]=s;continue}if("string"==typeof s){t[n]=new i(s);continue}r("object"==typeof s&&!Array.isArray(s),"Invalid message for",n);const o=n;for(n in t[o]=t[o]||{},s){const e=s[n];"root"===n||i.isTemplate(e)?t[o][n]=e:(r("string"==typeof e,"Invalid message for",n,"in",o),t[o][n]=new i(e))}}return t},t.decompile=function(e){const t={};for(let n in e){const r=e[n];if("root"===n){t.root=r;continue}if(i.isTemplate(r)){t[n]=r.describe({compact:!0});continue}const s=n;for(n in t[s]={},r){const e=r[n];"root"!==n?t[s][n]=e.describe({compact:!0}):t[s].root=e}}return t},t.merge=function(e,n){if(!e)return t.compile(n);if(!n)return e;if("string"==typeof n)return new i(n);if(i.isTemplate(n))return n;const o=s(e);for(let e in n){const t=n[e];if("root"===e||i.isTemplate(t)){o[e]=t;continue}if("string"==typeof t){o[e]=new i(t);continue}r("object"==typeof t&&!Array.isArray(t),"Invalid message for",e);const s=e;for(e in o[s]=o[s]||{},t){const n=t[e];"root"===e||i.isTemplate(n)?o[s][e]=n:(r("string"==typeof n,"Invalid message for",e,"in",s),o[s][e]=new i(n))}}return o}},2294:(e,t,n)=>{const r=n(375),s=n(8160),i=n(6133),o={};t.Ids=o.Ids=class{constructor(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}clone(){const e=new o.Ids;return e._byId=new Map(this._byId),e._byKey=new Map(this._byKey),e._schemaChain=this._schemaChain,e}concat(e){e._schemaChain&&(this._schemaChain=!0);for(const[t,n]of e._byId.entries())r(!this._byKey.has(t),"Schema id conflicts with existing key:",t),this._byId.set(t,n);for(const[t,n]of e._byKey.entries())r(!this._byId.has(t),"Schema key conflicts with existing id:",t),this._byKey.set(t,n)}fork(e,t,n){const i=this._collect(e);i.push({schema:n});const a=i.shift();let c={id:a.id,schema:t(a.schema)};r(s.isSchema(c.schema),"adjuster function failed to return a joi schema type");for(const e of i)c={id:e.id,schema:o.fork(e.schema,c.id,c.schema)};return c.schema}labels(e,t=[]){const n=e[0],r=this._get(n);if(!r)return[...t,...e].join(".");const s=e.slice(1);return t=[...t,r.schema._flags.label||n],s.length?r.schema._ids.labels(s,t):t.join(".")}reach(e,t=[]){const n=e[0],s=this._get(n);r(s,"Schema does not contain path",[...t,...e].join("."));const i=e.slice(1);return i.length?s.schema._ids.reach(i,[...t,n]):s.schema}register(e,{key:t}={}){if(!e||!s.isSchema(e))return;(e.$_property("schemaChain")||e._ids._schemaChain)&&(this._schemaChain=!0);const n=e._flags.id;if(n){const t=this._byId.get(n);r(!t||t.schema===e,"Cannot add different schemas with the same id:",n),r(!this._byKey.has(n),"Schema id conflicts with existing key:",n),this._byId.set(n,{schema:e,id:n})}t&&(r(!this._byKey.has(t),"Schema already contains key:",t),r(!this._byId.has(t),"Schema key conflicts with existing id:",t),this._byKey.set(t,{schema:e,id:t}))}reset(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}_collect(e,t=[],n=[]){const s=e[0],i=this._get(s);r(i,"Schema does not contain path",[...t,...e].join(".")),n=[i,...n];const o=e.slice(1);return o.length?i.schema._ids._collect(o,[...t,s],n):n}_get(e){return this._byId.get(e)||this._byKey.get(e)}},o.fork=function(e,n,r){const s=t.schema(e,{each:(e,{key:t})=>{if(n===(e._flags.id||t))return r},ref:!1});return s?s.$_mutateRebuild():e},t.schema=function(e,t){let n;for(const r in e._flags){if("_"===r[0])continue;const s=o.scan(e._flags[r],{source:"flags",name:r},t);void 0!==s&&(n=n||e.clone(),n._flags[r]=s)}for(let r=0;r<e._rules.length;++r){const s=e._rules[r],i=o.scan(s.args,{source:"rules",name:s.name},t);if(void 0!==i){n=n||e.clone();const t=Object.assign({},s);t.args=i,n._rules[r]=t,n._singleRules.get(s.name)===s&&n._singleRules.set(s.name,t)}}for(const r in e.$_terms){if("_"===r[0])continue;const s=o.scan(e.$_terms[r],{source:"terms",name:r},t);void 0!==s&&(n=n||e.clone(),n.$_terms[r]=s)}return n},o.scan=function(e,t,n,r,a){const c=r||[];if(null===e||"object"!=typeof e)return;let l;if(Array.isArray(e)){for(let r=0;r<e.length;++r){const s="terms"===t.source&&"keys"===t.name&&e[r].key,i=o.scan(e[r],t,n,[r,...c],s);void 0!==i&&(l=l||e.slice(),l[r]=i)}return l}if(!1!==n.schema&&s.isSchema(e)||!1!==n.ref&&i.isRef(e)){const r=n.each(e,oe(ie({},t),{path:c,key:a}));return r===e?void 0:r}for(const r in e){if("_"===r[0])continue;const s=o.scan(e[r],t,n,[r,...c],a);void 0!==s&&(l=l||Object.assign({},e),l[r]=s)}return l}},6133:(e,t,n)=>{const r=n(375),s=n(8571),i=n(9621),o=n(8160);let a;const c={symbol:Symbol("ref"),defaults:{adjust:null,in:!1,iterables:null,map:null,separator:".",type:"value"}};t.create=function(e,t={}){r("string"==typeof e,"Invalid reference key:",e),o.assertOptions(t,["adjust","ancestor","in","iterables","map","prefix","render","separator"]),r(!t.prefix||"object"==typeof t.prefix,"options.prefix must be of type object");const n=Object.assign({},c.defaults,t);delete n.prefix;const s=n.separator,i=c.context(e,s,t.prefix);if(n.type=i.type,e=i.key,"value"===n.type)if(i.root&&(r(!s||e[0]!==s,"Cannot specify relative path with root prefix"),n.ancestor="root",e||(e=null)),s&&s===e)e=null,n.ancestor=0;else if(void 0!==n.ancestor)r(!s||!e||e[0]!==s,"Cannot combine prefix with ancestor option");else{const[t,r]=c.ancestor(e,s);r&&""===(e=e.slice(r))&&(e=null),n.ancestor=t}return n.path=s?null===e?[]:e.split(s):[e],new c.Ref(n)},t.in=function(e,n={}){return t.create(e,oe(ie({},n),{in:!0}))},t.isRef=function(e){return!!e&&!!e[o.symbols.ref]},c.Ref=class{constructor(e){r("object"==typeof e,"Invalid reference construction"),o.assertOptions(e,["adjust","ancestor","in","iterables","map","path","render","separator","type","depth","key","root","display"]),r([!1,void 0].includes(e.separator)||"string"==typeof e.separator&&1===e.separator.length,"Invalid separator"),r(!e.adjust||"function"==typeof e.adjust,"options.adjust must be a function"),r(!e.map||Array.isArray(e.map),"options.map must be an array"),r(!e.map||!e.adjust,"Cannot set both map and adjust options"),Object.assign(this,c.defaults,e),r("value"===this.type||void 0===this.ancestor,"Non-value references cannot reference ancestors"),Array.isArray(this.map)&&(this.map=new Map(this.map)),this.depth=this.path.length,this.key=this.path.length?this.path.join(this.separator):null,this.root=this.path[0],this.updateDisplay()}resolve(e,t,n,s,i={}){return r(!this.in||i.in,"Invalid in() reference usage"),"global"===this.type?this._resolve(n.context,t,i):"local"===this.type?this._resolve(s,t,i):this.ancestor?"root"===this.ancestor?this._resolve(t.ancestors[t.ancestors.length-1],t,i):(r(this.ancestor<=t.ancestors.length,"Invalid reference exceeds the schema root:",this.display),this._resolve(t.ancestors[this.ancestor-1],t,i)):this._resolve(e,t,i)}_resolve(e,t,n){let r;if("value"===this.type&&t.mainstay.shadow&&!1!==n.shadow&&(r=t.mainstay.shadow.get(this.absolute(t))),void 0===r&&(r=i(e,this.path,{iterables:this.iterables,functions:!0})),this.adjust&&(r=this.adjust(r)),this.map){const e=this.map.get(r);void 0!==e&&(r=e)}return t.mainstay&&t.mainstay.tracer.resolve(t,this,r),r}toString(){return this.display}absolute(e){return[...e.path.slice(0,-this.ancestor),...this.path]}clone(){return new c.Ref(this)}describe(){const e={path:this.path};"value"!==this.type&&(e.type=this.type),"."!==this.separator&&(e.separator=this.separator),"value"===this.type&&1!==this.ancestor&&(e.ancestor=this.ancestor),this.map&&(e.map=[...this.map]);for(const t of["adjust","iterables","render"])null!==this[t]&&void 0!==this[t]&&(e[t]=this[t]);return!1!==this.in&&(e.in=!0),{ref:e}}updateDisplay(){const e=null!==this.key?this.key:"";if("value"!==this.type)return void(this.display="ref:".concat(this.type,":").concat(e));if(!this.separator)return void(this.display="ref:".concat(e));if(!this.ancestor)return void(this.display="ref:".concat(this.separator).concat(e));if("root"===this.ancestor)return void(this.display="ref:root:".concat(e));if(1===this.ancestor)return void(this.display="ref:".concat(e||".."));const t=new Array(this.ancestor+1).fill(this.separator).join("");this.display="ref:".concat(t).concat(e||"")}},c.Ref.prototype[o.symbols.ref]=!0,t.build=function(e){return"value"===(e=Object.assign({},c.defaults,e)).type&&void 0===e.ancestor&&(e.ancestor=1),new c.Ref(e)},c.context=function(e,t,n={}){if(e=e.trim(),n){const r=void 0===n.global?"$":n.global;if(r!==t&&e.startsWith(r))return{key:e.slice(r.length),type:"global"};const s=void 0===n.local?"#":n.local;if(s!==t&&e.startsWith(s))return{key:e.slice(s.length),type:"local"};const i=void 0===n.root?"/":n.root;if(i!==t&&e.startsWith(i))return{key:e.slice(i.length),type:"value",root:!0}}return{key:e,type:"value"}},c.ancestor=function(e,t){if(!t)return[1,0];if(e[0]!==t)return[1,0];if(e[1]!==t)return[0,1];let n=2;for(;e[n]===t;)++n;return[n-1,n]},t.toSibling=0,t.toParent=1,t.Manager=class{constructor(){this.refs=[]}register(e,r){if(e)if(r=void 0===r?t.toParent:r,Array.isArray(e))for(const t of e)this.register(t,r);else if(o.isSchema(e))for(const t of e._refs.refs)t.ancestor-r>=0&&this.refs.push({ancestor:t.ancestor-r,root:t.root});else t.isRef(e)&&"value"===e.type&&e.ancestor-r>=0&&this.refs.push({ancestor:e.ancestor-r,root:e.root}),a=a||n(3328),a.isTemplate(e)&&this.register(e.refs(),r)}get length(){return this.refs.length}clone(){const e=new t.Manager;return e.refs=s(this.refs),e}reset(){this.refs=[]}roots(){return this.refs.filter(e=>!e.ancestor).map(e=>e.root)}}},3378:(e,t,n)=>{const r=n(5107),s={};s.wrap=r.string().min(1).max(2).allow(!1),t.preferences=r.object({allowUnknown:r.boolean(),abortEarly:r.boolean(),artifacts:r.boolean(),cache:r.boolean(),context:r.object(),convert:r.boolean(),dateFormat:r.valid("date","iso","string","time","utc"),debug:r.boolean(),errors:{escapeHtml:r.boolean(),label:r.valid("path","key",!1),language:[r.string(),r.object().ref()],render:r.boolean(),stack:r.boolean(),wrap:{label:s.wrap,array:s.wrap,string:s.wrap}},externals:r.boolean(),messages:r.object(),noDefaults:r.boolean(),nonEnumerables:r.boolean(),presence:r.valid("required","optional","forbidden"),skipFunctions:r.boolean(),stripUnknown:r.object({arrays:r.boolean(),objects:r.boolean()}).or("arrays","objects").allow(!0,!1),warnings:r.boolean()}).strict(),s.nameRx=/^[a-zA-Z0-9]\w*$/,s.rule=r.object({alias:r.array().items(r.string().pattern(s.nameRx)).single(),args:r.array().items(r.string(),r.object({name:r.string().pattern(s.nameRx).required(),ref:r.boolean(),assert:r.alternatives([r.function(),r.object().schema()]).conditional("ref",{is:!0,then:r.required()}),normalize:r.function(),message:r.string().when("assert",{is:r.function(),then:r.required()})})),convert:r.boolean(),manifest:r.boolean(),method:r.function().allow(!1),multi:r.boolean(),validate:r.function()}),t.extension=r.object({type:r.alternatives([r.string(),r.object().regex()]).required(),args:r.function(),cast:r.object().pattern(s.nameRx,r.object({from:r.function().maxArity(1).required(),to:r.function().minArity(1).maxArity(2).required()})),base:r.object().schema().when("type",{is:r.object().regex(),then:r.forbidden()}),coerce:[r.function().maxArity(3),r.object({method:r.function().maxArity(3).required(),from:r.array().items(r.string()).single()})],flags:r.object().pattern(s.nameRx,r.object({setter:r.string(),default:r.any()})),manifest:{build:r.function().arity(2)},messages:[r.object(),r.string()],modifiers:r.object().pattern(s.nameRx,r.function().minArity(1).maxArity(2)),overrides:r.object().pattern(s.nameRx,r.function()),prepare:r.function().maxArity(3),rebuild:r.function().arity(1),rules:r.object().pattern(s.nameRx,s.rule),terms:r.object().pattern(s.nameRx,r.object({init:r.array().allow(null).required(),manifest:r.object().pattern(/.+/,[r.valid("schema","single"),r.object({mapped:r.object({from:r.string().required(),to:r.string().required()}).required()})])})),validate:r.function().maxArity(3)}).strict(),t.extensions=r.array().items(r.object(),r.function().arity(1)).strict(),s.desc={buffer:r.object({buffer:r.string()}),func:r.object({function:r.function().required(),options:{literal:!0}}),override:r.object({override:!0}),ref:r.object({ref:r.object({type:r.valid("value","global","local"),path:r.array().required(),separator:r.string().length(1).allow(!1),ancestor:r.number().min(0).integer().allow("root"),map:r.array().items(r.array().length(2)).min(1),adjust:r.function(),iterables:r.boolean(),in:r.boolean(),render:r.boolean()}).required()}),regex:r.object({regex:r.string().min(3)}),special:r.object({special:r.valid("deep").required()}),template:r.object({template:r.string().required(),options:r.object()}),value:r.object({value:r.alternatives([r.object(),r.array()]).required()})},s.desc.entity=r.alternatives([r.array().items(r.link("...")),r.boolean(),r.function(),r.number(),r.string(),s.desc.buffer,s.desc.func,s.desc.ref,s.desc.regex,s.desc.special,s.desc.template,s.desc.value,r.link("/")]),s.desc.values=r.array().items(null,r.boolean(),r.function(),r.number().allow(1/0,-1/0),r.string().allow(""),r.symbol(),s.desc.buffer,s.desc.func,s.desc.override,s.desc.ref,s.desc.regex,s.desc.template,s.desc.value),s.desc.messages=r.object().pattern(/.+/,[r.string(),s.desc.template,r.object().pattern(/.+/,[r.string(),s.desc.template])]),t.description=r.object({type:r.string().required(),flags:r.object({cast:r.string(),default:r.any(),description:r.string(),empty:r.link("/"),failover:s.desc.entity,id:r.string(),label:r.string(),only:!0,presence:["optional","required","forbidden"],result:["raw","strip"],strip:r.boolean(),unit:r.string()}).unknown(),preferences:{allowUnknown:r.boolean(),abortEarly:r.boolean(),artifacts:r.boolean(),cache:r.boolean(),convert:r.boolean(),dateFormat:["date","iso","string","time","utc"],errors:{escapeHtml:r.boolean(),label:["path","key"],language:[r.string(),s.desc.ref],wrap:{label:s.wrap,array:s.wrap}},externals:r.boolean(),messages:s.desc.messages,noDefaults:r.boolean(),nonEnumerables:r.boolean(),presence:["required","optional","forbidden"],skipFunctions:r.boolean(),stripUnknown:r.object({arrays:r.boolean(),objects:r.boolean()}).or("arrays","objects").allow(!0,!1),warnings:r.boolean()},allow:s.desc.values,invalid:s.desc.values,rules:r.array().min(1).items({name:r.string().required(),args:r.object().min(1),keep:r.boolean(),message:[r.string(),s.desc.messages],warn:r.boolean()}),keys:r.object().pattern(/.*/,r.link("/")),link:s.desc.ref}).pattern(/^[a-z]\w*$/,r.any())},493:(e,t,n)=>{const r=n(8571),s=n(9621),i=n(8160),o={value:Symbol("value")};e.exports=o.State=class{constructor(e,t,n){this.path=e,this.ancestors=t,this.mainstay=n.mainstay,this.schemas=n.schemas,this.debug=null}localize(e,t=null,n=null){const r=new o.State(e,t,this);return n&&r.schemas&&(r.schemas=[o.schemas(n),...r.schemas]),r}nest(e,t){const n=new o.State(this.path,this.ancestors,this);return n.schemas=n.schemas&&[o.schemas(e),...n.schemas],n.debug=t,n}shadow(e,t){this.mainstay.shadow=this.mainstay.shadow||new o.Shadow,this.mainstay.shadow.set(this.path,e,t)}snapshot(){this.mainstay.shadow&&(this._snapshot=r(this.mainstay.shadow.node(this.path))),this.mainstay.snapshot()}restore(){this.mainstay.shadow&&(this.mainstay.shadow.override(this.path,this._snapshot),this._snapshot=void 0),this.mainstay.restore()}commit(){this.mainstay.shadow&&(this.mainstay.shadow.override(this.path,this._snapshot),this._snapshot=void 0),this.mainstay.commit()}},o.schemas=function(e){return i.isSchema(e)?{schema:e}:e},o.Shadow=class{constructor(){this._values=null}set(e,t,n){if(!e.length||"strip"===n&&"number"==typeof e[e.length-1])return;this._values=this._values||new Map;let r=this._values;for(let t=0;t<e.length;++t){const n=e[t];let s=r.get(n);s||(s=new Map,r.set(n,s)),r=s}r[o.value]=t}get(e){const t=this.node(e);if(t)return t[o.value]}node(e){if(this._values)return s(this._values,e,{iterables:!0})}override(e,t){if(!this._values)return;const n=e.slice(0,-1),r=e[e.length-1],i=s(this._values,n,{iterables:!0});t?i.set(r,t):i&&i.delete(r)}}},3328:(e,t,n)=>{const r=n(375),s=n(8571),i=n(5277),o=n(1447),a=n(8160),c=n(6354),l=n(6133),u={symbol:Symbol("template"),opens:new Array(1e3).join("\0"),closes:new Array(1e3).join(""),dateFormat:{date:Date.prototype.toDateString,iso:Date.prototype.toISOString,string:Date.prototype.toString,time:Date.prototype.toTimeString,utc:Date.prototype.toUTCString}};e.exports=u.Template=class{constructor(e,t){if(r("string"==typeof e,"Template source must be a string"),r(!e.includes("\0")&&!e.includes(""),"Template source cannot contain reserved control characters"),this.source=e,this.rendered=e,this._template=null,t){const e=t,{functions:n}=e,i=ae(e,["functions"]);this._settings=Object.keys(i).length?s(i):void 0,this._functions=n,this._functions&&(r(Object.keys(this._functions).every(e=>"string"==typeof e),"Functions keys must be strings"),r(Object.values(this._functions).every(e=>"function"==typeof e),"Functions values must be functions"))}else this._settings=void 0,this._functions=void 0;this._parse()}_parse(){if(!this.source.includes("{"))return;const e=u.encode(this.source),t=u.split(e);let n=!1;const r=[],s=t.shift();s&&r.push(s);for(const e of t){const t="{"!==e[0],s=t?"}":"}}",i=e.indexOf(s);if(-1===i||"{"===e[1]){r.push("{".concat(u.decode(e)));continue}let o=e.slice(t?0:1,i);const a=":"===o[0];a&&(o=o.slice(1));const c=this._ref(u.decode(o),{raw:t,wrapped:a});r.push(c),"string"!=typeof c&&(n=!0);const l=e.slice(i+s.length);l&&r.push(u.decode(l))}n?this._template=r:this.rendered=r.join("")}static date(e,t){return u.dateFormat[t.dateFormat].call(e)}describe(e={}){if(!this._settings&&e.compact)return this.source;const t={template:this.source};return this._settings&&(t.options=this._settings),this._functions&&(t.functions=this._functions),t}static build(e){return new u.Template(e.template,e.options||e.functions?oe(ie({},e.options),{functions:e.functions}):void 0)}isDynamic(){return!!this._template}static isTemplate(e){return!!e&&!!e[a.symbols.template]}refs(){if(!this._template)return;const e=[];for(const t of this._template)"string"!=typeof t&&e.push(...t.refs);return e}resolve(e,t,n,r){return this._template&&1===this._template.length?this._part(this._template[0],e,t,n,r,{}):this.render(e,t,n,r)}_part(e,...t){return e.ref?e.ref.resolve(...t):e.formula.evaluate(t)}render(e,t,n,r,s={}){if(!this.isDynamic())return this.rendered;const o=[];for(const a of this._template)if("string"==typeof a)o.push(a);else{const c=this._part(a,e,t,n,r,s),l=u.stringify(c,e,t,n,r,s);if(void 0!==l){const e=a.raw||!1===(s.errors&&s.errors.escapeHtml)?l:i(l);o.push(u.wrap(e,a.wrapped&&n.errors.wrap.label))}}return o.join("")}_ref(e,{raw:t,wrapped:n}){const r=[],s=e=>{const t=l.create(e,this._settings);return r.push(t),e=>{const n=t.resolve(...e);return void 0!==n?n:null}};try{const t=this._functions?ie(ie({},u.functions),this._functions):u.functions;var i=new o.Parser(e,{reference:s,functions:t,constants:u.constants})}catch(t){throw t.message='Invalid template variable "'.concat(e,'" fails due to: ').concat(t.message),t}if(i.single){if("reference"===i.single.type){const e=r[0];return{ref:e,raw:t,refs:r,wrapped:n||"local"===e.type&&"label"===e.key}}return u.stringify(i.single.value)}return{formula:i,raw:t,refs:r}}toString(){return this.source}},u.Template.prototype[a.symbols.template]=!0,u.Template.prototype.isImmutable=!0,u.encode=function(e){return e.replace(/\\(\{+)/g,(e,t)=>u.opens.slice(0,t.length)).replace(/\\(\}+)/g,(e,t)=>u.closes.slice(0,t.length))},u.decode=function(e){return e.replace(/\u0000/g,"{").replace(/\u0001/g,"}")},u.split=function(e){const t=[];let n="";for(let r=0;r<e.length;++r){const s=e[r];if("{"===s){let s="";for(;r+1<e.length&&"{"===e[r+1];)s+="{",++r;t.push(n),n=s}else n+=s}return t.push(n),t},u.wrap=function(e,t){return t?1===t.length?"".concat(t).concat(e).concat(t):"".concat(t[0]).concat(e).concat(t[1]):e},u.stringify=function(e,t,n,r,s,i={}){const o=typeof e,a=r&&r.errors&&r.errors.wrap||{};let c=!1;if(l.isRef(e)&&e.render&&(c=e.in,e=e.resolve(t,n,r,s,ie({in:e.in},i))),null===e)return"null";if("string"===o)return u.wrap(e,i.arrayItems&&a.string);if("number"===o||"function"===o||"symbol"===o)return e.toString();if("object"!==o)return JSON.stringify(e);if(e instanceof Date)return u.Template.date(e,r);if(e instanceof Map){const t=[];for(const[n,r]of e.entries())t.push("".concat(n.toString()," -> ").concat(r.toString()));e=t}if(!Array.isArray(e))return e.toString();const d=[];for(const o of e)d.push(u.stringify(o,t,n,r,s,ie({arrayItems:!0},i)));return u.wrap(d.join(", "),!c&&a.array)},u.constants={true:!0,false:!1,null:null,second:1e3,minute:6e4,hour:36e5,day:864e5},u.functions={if:(e,t,n)=>e?t:n,length:e=>"string"==typeof e?e.length:e&&"object"==typeof e?Array.isArray(e)?e.length:Object.keys(e).length:null,msg(e){const[t,n,r,s,i]=this,o=i.messages;if(!o)return"";const a=c.template(t,o[0],e,n,r)||c.template(t,o[1],e,n,r);return a?a.render(t,n,r,s,i):""},number:e=>"number"==typeof e?e:"string"==typeof e?parseFloat(e):"boolean"==typeof e?e?1:0:e instanceof Date?e.getTime():null}},4946:(e,t,n)=>{const r=n(375),s=n(1687),i=n(8068),o=n(8160),a=n(3292),c=n(6354),l=n(6133),u={};e.exports=i.extend({type:"alternatives",flags:{match:{default:"any"}},terms:{matches:{init:[],register:l.toSibling}},args:(e,...t)=>1===t.length&&Array.isArray(t[0])?e.try(...t[0]):e.try(...t),validate(e,t){const{schema:n,error:r,state:i,prefs:o}=t;if(n._flags.match){const t=[],a=[];for(let r=0;r<n.$_terms.matches.length;++r){const s=n.$_terms.matches[r],c=i.nest(s.schema,"match.".concat(r));c.snapshot();const l=s.schema.$_validate(e,c,o);l.errors?(a.push(l.errors),c.restore()):(t.push(l.value),c.commit())}if(0===t.length)return{errors:r("alternatives.any",{details:a.map(e=>c.details(e,{override:!1}))})};if("one"===n._flags.match)return 1===t.length?{value:t[0]}:{errors:r("alternatives.one")};if(t.length!==n.$_terms.matches.length)return{errors:r("alternatives.all",{details:a.map(e=>c.details(e,{override:!1}))})};const l=e=>e.$_terms.matches.some(e=>"object"===e.schema.type||"alternatives"===e.schema.type&&l(e.schema));return l(n)?{value:t.reduce((e,t)=>s(e,t,{mergeArrays:!1}))}:{value:t[t.length-1]}}const a=[];for(let t=0;t<n.$_terms.matches.length;++t){const r=n.$_terms.matches[t];if(r.schema){const n=i.nest(r.schema,"match.".concat(t));n.snapshot();const s=r.schema.$_validate(e,n,o);if(!s.errors)return n.commit(),s;n.restore(),a.push({schema:r.schema,reports:s.errors});continue}const s=r.ref?r.ref.resolve(e,i,o):e,c=r.is?[r]:r.switch;for(let n=0;n<c.length;++n){const a=c[n],{is:l,then:u,otherwise:d}=a,p="match.".concat(t).concat(r.switch?"."+n:"");if(l.$_match(s,i.nest(l,"".concat(p,".is")),o)){if(u)return u.$_validate(e,i.nest(u,"".concat(p,".then")),o)}else if(d)return d.$_validate(e,i.nest(d,"".concat(p,".otherwise")),o)}}return u.errors(a,t)},rules:{conditional:{method(e,t){r(!this._flags._endedSwitch,"Unreachable condition"),r(!this._flags.match,"Cannot combine match mode",this._flags.match,"with conditional rule"),r(void 0===t.break,"Cannot use break option with alternatives conditional");const n=this.clone(),s=a.when(n,e,t),i=s.is?[s]:s.switch;for(const e of i)if(e.then&&e.otherwise){n.$_setFlag("_endedSwitch",!0,{clone:!1});break}return n.$_terms.matches.push(s),n.$_mutateRebuild()}},match:{method(e){if(r(["any","one","all"].includes(e),"Invalid alternatives match mode",e),"any"!==e)for(const t of this.$_terms.matches)r(t.schema,"Cannot combine match mode",e,"with conditional rules");return this.$_setFlag("match",e)}},try:{method(...e){r(e.length,"Missing alternative schemas"),o.verifyFlat(e,"try"),r(!this._flags._endedSwitch,"Unreachable condition");const t=this.clone();for(const n of e)t.$_terms.matches.push({schema:t.$_compile(n)});return t.$_mutateRebuild()}}},overrides:{label(e){return this.$_parent("label",e).$_modify({each:(t,n)=>"is"!==n.path[0]&&"string"!=typeof t._flags.label?t.label(e):void 0,ref:!1})}},rebuild(e){e.$_modify({each:t=>{o.isSchema(t)&&"array"===t.type&&e.$_setFlag("_arrayItems",!0,{clone:!1})}})},manifest:{build(e,t){if(t.matches)for(const n of t.matches){const{schema:t,ref:r,is:s,not:i,then:o,otherwise:a}=n;e=t?e.try(t):r?e.conditional(r,{is:s,then:o,not:i,otherwise:a,switch:n.switch}):e.conditional(s,{then:o,otherwise:a})}return e}},messages:{"alternatives.all":"{{#label}} does not match all of the required types","alternatives.any":"{{#label}} does not match any of the allowed types","alternatives.match":"{{#label}} does not match any of the allowed types","alternatives.one":"{{#label}} matches more than one allowed type","alternatives.types":"{{#label}} must be one of {{#types}}"}}),u.errors=function(e,{error:t,state:n}){if(!e.length)return{errors:t("alternatives.any")};if(1===e.length)return{errors:e[0].reports};const r=new Set,s=[];for(const{reports:i,schema:o}of e){if(i.length>1)return u.unmatched(e,t);const a=i[0];if(a instanceof c.Report==0)return u.unmatched(e,t);if(a.state.path.length!==n.path.length){s.push({type:o.type,report:a});continue}if("any.only"===a.code){for(const e of a.local.valids)r.add(e);continue}const[l,d]=a.code.split(".");"base"!==d?s.push({type:o.type,report:a}):"object.base"===a.code?r.add(a.local.type):r.add(l)}return s.length?1===s.length?{errors:s[0].report}:u.unmatched(e,t):{errors:t("alternatives.types",{types:[...r]})}},u.unmatched=function(e,t){const n=[];for(const t of e)n.push(...t.reports);return{errors:t("alternatives.match",c.details(n,{override:!1}))}}},8068:(e,t,n)=>{const r=n(375),s=n(7629),i=n(8160),o=n(6914);e.exports=s.extend({type:"any",flags:{only:{default:!1}},terms:{alterations:{init:null},examples:{init:null},externals:{init:null},metas:{init:[]},notes:{init:[]},shared:{init:null},tags:{init:[]},whens:{init:null}},rules:{custom:{method(e,t){return r("function"==typeof e,"Method must be a function"),r(void 0===t||t&&"string"==typeof t,"Description must be a non-empty string"),this.$_addRule({name:"custom",args:{method:e,description:t}})},validate(e,t,{method:n}){try{return n(e,t)}catch(e){return t.error("any.custom",{error:e})}},args:["method","description"],multi:!0},messages:{method(e){return this.prefs({messages:e})}},shared:{method(e){r(i.isSchema(e)&&e._flags.id,"Schema must be a schema with an id");const t=this.clone();return t.$_terms.shared=t.$_terms.shared||[],t.$_terms.shared.push(e),t.$_mutateRegister(e),t}},warning:{method(e,t){return r(e&&"string"==typeof e,"Invalid warning code"),this.$_addRule({name:"warning",args:{code:e,local:t},warn:!0})},validate:(e,t,{code:n,local:r})=>t.error(n,r),args:["code","local"],multi:!0}},modifiers:{keep(e,t=!0){e.keep=t},message(e,t){e.message=o.compile(t)},warn(e,t=!0){e.warn=t}},manifest:{build(e,t){for(const n in t){const r=t[n];if(["examples","externals","metas","notes","tags"].includes(n))for(const t of r)e=e[n.slice(0,-1)](t);else if("alterations"!==n)if("whens"!==n){if("shared"===n)for(const t of r)e=e.shared(t)}else for(const t of r){const{ref:n,is:r,not:s,then:i,otherwise:o,concat:a}=t;e=a?e.concat(a):n?e.when(n,{is:r,not:s,then:i,otherwise:o,switch:t.switch,break:t.break}):e.when(r,{then:i,otherwise:o,break:t.break})}else{const t={};for(const{target:e,adjuster:n}of r)t[e]=n;e=e.alter(t)}}return e}},messages:{"any.custom":"{{#label}} failed custom validation because {{#error.message}}","any.default":"{{#label}} threw an error when running default method","any.failover":"{{#label}} threw an error when running failover method","any.invalid":"{{#label}} contains an invalid value","any.only":'{{#label}} must be {if(#valids.length == 1, "", "one of ")}{{#valids}}',"any.ref":"{{#label}} {{#arg}} references {{:#ref}} which {{#reason}}","any.required":"{{#label}} is required","any.unknown":"{{#label}} is not allowed"}})},546:(e,t,n)=>{const r=n(375),s=n(9474),i=n(9621),o=n(8068),a=n(8160),c=n(3292),l={};e.exports=o.extend({type:"array",flags:{single:{default:!1},sparse:{default:!1}},terms:{items:{init:[],manifest:"schema"},ordered:{init:[],manifest:"schema"},_exclusions:{init:[]},_inclusions:{init:[]},_requireds:{init:[]}},coerce:{from:"object",method(e,{schema:t,state:n,prefs:r}){if(!Array.isArray(e))return;const s=t.$_getRule("sort");return s?l.sort(t,e,s.args.options,n,r):void 0}},validate(e,{schema:t,error:n}){if(!Array.isArray(e)){if(t._flags.single){const t=[e];return t[a.symbols.arraySingle]=!0,{value:t}}return{errors:n("array.base")}}if(t.$_getRule("items")||t.$_terms.externals)return{value:e.slice()}},rules:{has:{method(e){e=this.$_compile(e,{appendPath:!0});const t=this.$_addRule({name:"has",args:{schema:e}});return t.$_mutateRegister(e),t},validate(e,{state:t,prefs:n,error:r},{schema:s}){const i=[e,...t.ancestors];for(let r=0;r<e.length;++r){const o=t.localize([...t.path,r],i,s);if(s.$_match(e[r],o,n))return e}const o=s._flags.label;return o?r("array.hasKnown",{patternLabel:o}):r("array.hasUnknown",null)},multi:!0},items:{method(...e){a.verifyFlat(e,"items");const t=this.$_addRule("items");for(let n=0;n<e.length;++n){const r=a.tryWithPath(()=>this.$_compile(e[n]),n,{append:!0});t.$_terms.items.push(r)}return t.$_mutateRebuild()},validate(e,{schema:t,error:n,state:r,prefs:s,errorsArray:i}){const o=t.$_terms._requireds.slice(),c=t.$_terms.ordered.slice(),u=[...t.$_terms._inclusions,...o],d=!e[a.symbols.arraySingle];delete e[a.symbols.arraySingle];const p=i();let f=e.length;for(let i=0;i<f;++i){const a=e[i];let h=!1,m=!1;const g=d?i:new Number(i),y=[...r.path,g];if(!t._flags.sparse&&void 0===a){if(p.push(n("array.sparse",{key:g,path:y,pos:i,value:void 0},r.localize(y))),s.abortEarly)return p;c.shift();continue}const v=[e,...r.ancestors];for(const e of t.$_terms._exclusions)if(e.$_match(a,r.localize(y,v,e),s,{presence:"ignore"})){if(p.push(n("array.excludes",{pos:i,value:a},r.localize(y))),s.abortEarly)return p;h=!0,c.shift();break}if(h)continue;if(t.$_terms.ordered.length){if(c.length){const o=c.shift(),u=o.$_validate(a,r.localize(y,v,o),s);if(u.errors){if(p.push(...u.errors),s.abortEarly)return p}else if("strip"===o._flags.result)l.fastSplice(e,i),--i,--f;else{if(!t._flags.sparse&&void 0===u.value){if(p.push(n("array.sparse",{key:g,path:y,pos:i,value:void 0},r.localize(y))),s.abortEarly)return p;continue}e[i]=u.value}continue}if(!t.$_terms.items.length){if(p.push(n("array.orderedLength",{pos:i,limit:t.$_terms.ordered.length})),s.abortEarly)return p;break}}const w=[];let _=o.length;for(let c=0;c<_;++c){const u=r.localize(y,v,o[c]);u.snapshot();const d=o[c].$_validate(a,u,s);if(w[c]=d,!d.errors){if(u.commit(),e[i]=d.value,m=!0,l.fastSplice(o,c),--c,--_,!t._flags.sparse&&void 0===d.value&&(p.push(n("array.sparse",{key:g,path:y,pos:i,value:void 0},r.localize(y))),s.abortEarly))return p;break}u.restore()}if(m)continue;const R=s.stripUnknown&&!!s.stripUnknown.arrays||!1;_=u.length;for(const c of u){let u;const d=o.indexOf(c);if(-1!==d)u=w[d];else{const o=r.localize(y,v,c);if(o.snapshot(),u=c.$_validate(a,o,s),!u.errors){o.commit(),"strip"===c._flags.result?(l.fastSplice(e,i),--i,--f):t._flags.sparse||void 0!==u.value?e[i]=u.value:(p.push(n("array.sparse",{key:g,path:y,pos:i,value:void 0},r.localize(y))),h=!0),m=!0;break}o.restore()}if(1===_){if(R){l.fastSplice(e,i),--i,--f,m=!0;break}if(p.push(...u.errors),s.abortEarly)return p;h=!0;break}}if(!h&&(t.$_terms._inclusions.length||t.$_terms._requireds.length)&&!m){if(R){l.fastSplice(e,i),--i,--f;continue}if(p.push(n("array.includes",{pos:i,value:a},r.localize(y))),s.abortEarly)return p}}return o.length&&l.fillMissedErrors(t,p,o,e,r,s),c.length&&(l.fillOrderedErrors(t,p,c,e,r,s),p.length||l.fillDefault(c,e,r,s)),p.length?p:e},priority:!0,manifest:!1},length:{method(e){return this.$_addRule({name:"length",args:{limit:e},operator:"="})},validate:(e,t,{limit:n},{name:r,operator:s,args:i})=>a.compare(e.length,n,s)?e:t.error("array."+r,{limit:i.limit,value:e}),args:[{name:"limit",ref:!0,assert:a.limit,message:"must be a positive integer"}]},max:{method(e){return this.$_addRule({name:"max",method:"length",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"length",args:{limit:e},operator:">="})}},ordered:{method(...e){a.verifyFlat(e,"ordered");const t=this.$_addRule("items");for(let n=0;n<e.length;++n){const r=a.tryWithPath(()=>this.$_compile(e[n]),n,{append:!0});l.validateSingle(r,t),t.$_mutateRegister(r),t.$_terms.ordered.push(r)}return t.$_mutateRebuild()}},single:{method(e){const t=void 0===e||!!e;return r(!t||!this._flags._arrayItems,"Cannot specify single rule when array has array items"),this.$_setFlag("single",t)}},sort:{method(e={}){a.assertOptions(e,["by","order"]);const t={order:e.order||"ascending"};return e.by&&(t.by=c.ref(e.by,{ancestor:0}),r(!t.by.ancestor,"Cannot sort by ancestor")),this.$_addRule({name:"sort",args:{options:t}})},validate(e,{error:t,state:n,prefs:r,schema:s},{options:i}){const{value:o,errors:a}=l.sort(s,e,i,n,r);if(a)return a;for(let n=0;n<e.length;++n)if(e[n]!==o[n])return t("array.sort",{order:i.order,by:i.by?i.by.key:"value"});return e},convert:!0},sparse:{method(e){const t=void 0===e||!!e;return this._flags.sparse===t?this:(t?this.clone():this.$_addRule("items")).$_setFlag("sparse",t,{clone:!1})}},unique:{method(e,t={}){r(!e||"function"==typeof e||"string"==typeof e,"comparator must be a function or a string"),a.assertOptions(t,["ignoreUndefined","separator"]);const n={name:"unique",args:{options:t,comparator:e}};if(e)if("string"==typeof e){const r=a.default(t.separator,".");n.path=r?e.split(r):[e]}else n.comparator=e;return this.$_addRule(n)},validate(e,{state:t,error:n,schema:o},{comparator:a,options:c},{comparator:l,path:u}){const d={string:Object.create(null),number:Object.create(null),undefined:Object.create(null),boolean:Object.create(null),bigint:Object.create(null),object:new Map,function:new Map,custom:new Map},p=l||s,f=c.ignoreUndefined;for(let s=0;s<e.length;++s){const o=u?i(e[s],u):e[s],c=l?d.custom:d[typeof o];if(r(c,"Failed to find unique map container for type",typeof o),c instanceof Map){const r=c.entries();let i;for(;!(i=r.next()).done;)if(p(i.value[0],o)){const r=t.localize([...t.path,s],[e,...t.ancestors]),o={pos:s,value:e[s],dupePos:i.value[1],dupeValue:e[i.value[1]]};return u&&(o.path=a),n("array.unique",o,r)}c.set(o,s)}else{if((!f||void 0!==o)&&void 0!==c[o]){const r={pos:s,value:e[s],dupePos:c[o],dupeValue:e[c[o]]};return u&&(r.path=a),n("array.unique",r,t.localize([...t.path,s],[e,...t.ancestors]))}c[o]=s}}return e},args:["comparator","options"],multi:!0}},cast:{set:{from:Array.isArray,to:(e,t)=>new Set(e)}},rebuild(e){e.$_terms._inclusions=[],e.$_terms._exclusions=[],e.$_terms._requireds=[];for(const t of e.$_terms.items)l.validateSingle(t,e),"required"===t._flags.presence?e.$_terms._requireds.push(t):"forbidden"===t._flags.presence?e.$_terms._exclusions.push(t):e.$_terms._inclusions.push(t);for(const t of e.$_terms.ordered)l.validateSingle(t,e)},manifest:{build:(e,t)=>(t.items&&(e=e.items(...t.items)),t.ordered&&(e=e.ordered(...t.ordered)),e)},messages:{"array.base":"{{#label}} must be an array","array.excludes":"{{#label}} contains an excluded value","array.hasKnown":"{{#label}} does not contain at least one required match for type {:#patternLabel}","array.hasUnknown":"{{#label}} does not contain at least one required match","array.includes":"{{#label}} does not match any of the allowed types","array.includesRequiredBoth":"{{#label}} does not contain {{#knownMisses}} and {{#unknownMisses}} other required value(s)","array.includesRequiredKnowns":"{{#label}} does not contain {{#knownMisses}}","array.includesRequiredUnknowns":"{{#label}} does not contain {{#unknownMisses}} required value(s)","array.length":"{{#label}} must contain {{#limit}} items","array.max":"{{#label}} must contain less than or equal to {{#limit}} items","array.min":"{{#label}} must contain at least {{#limit}} items","array.orderedLength":"{{#label}} must contain at most {{#limit}} items","array.sort":"{{#label}} must be sorted in {#order} order by {{#by}}","array.sort.mismatching":"{{#label}} cannot be sorted due to mismatching types","array.sort.unsupported":"{{#label}} cannot be sorted due to unsupported type {#type}","array.sparse":"{{#label}} must not be a sparse array item","array.unique":"{{#label}} contains a duplicate value"}}),l.fillMissedErrors=function(e,t,n,r,s,i){const o=[];let a=0;for(const e of n){const t=e._flags.label;t?o.push(t):++a}o.length?a?t.push(e.$_createError("array.includesRequiredBoth",r,{knownMisses:o,unknownMisses:a},s,i)):t.push(e.$_createError("array.includesRequiredKnowns",r,{knownMisses:o},s,i)):t.push(e.$_createError("array.includesRequiredUnknowns",r,{unknownMisses:a},s,i))},l.fillOrderedErrors=function(e,t,n,r,s,i){const o=[];for(const e of n)"required"===e._flags.presence&&o.push(e);o.length&&l.fillMissedErrors(e,t,o,r,s,i)},l.fillDefault=function(e,t,n,r){const s=[];let i=!0;for(let o=e.length-1;o>=0;--o){const a=e[o],c=[t,...n.ancestors],l=a.$_validate(void 0,n.localize(n.path,c,a),r).value;if(i){if(void 0===l)continue;i=!1}s.unshift(l)}s.length&&t.push(...s)},l.fastSplice=function(e,t){let n=t;for(;n<e.length;)e[n++]=e[n];--e.length},l.validateSingle=function(e,t){("array"===e.type||e._flags._arrayItems)&&(r(!t._flags.single,"Cannot specify array item with single rule enabled"),t.$_setFlag("_arrayItems",!0,{clone:!1}))},l.sort=function(e,t,n,r,s){const i="ascending"===n.order?1:-1,o=-1*i,a=i,c=(c,u)=>{let d=l.compare(c,u,o,a);if(null!==d||(n.by&&(c=n.by.resolve(c,r,s),u=n.by.resolve(u,r,s)),d=l.compare(c,u,o,a),null!==d))return d;const p=typeof c;if(p!==typeof u)throw e.$_createError("array.sort.mismatching",t,null,r,s);if("number"!==p&&"string"!==p)throw e.$_createError("array.sort.unsupported",t,{type:p},r,s);return"number"===p?(c-u)*i:c<u?o:a};try{return{value:t.slice().sort(c)}}catch(e){return{errors:e}}},l.compare=function(e,t,n,r){return e===t?0:void 0===e?1:void 0===t?-1:null===e?r:null===t?n:null}},4937:(e,t,n)=>{const r=n(375),s=n(8068),i=n(8160),o=n(2036),a={isBool:function(e){return"boolean"==typeof e}};e.exports=s.extend({type:"boolean",flags:{sensitive:{default:!1}},terms:{falsy:{init:null,manifest:"values"},truthy:{init:null,manifest:"values"}},coerce(e,{schema:t}){if("boolean"!=typeof e){if("string"==typeof e){const n=t._flags.sensitive?e:e.toLowerCase();e="true"===n||"false"!==n&&e}return"boolean"!=typeof e&&(e=t.$_terms.truthy&&t.$_terms.truthy.has(e,null,null,!t._flags.sensitive)||(!t.$_terms.falsy||!t.$_terms.falsy.has(e,null,null,!t._flags.sensitive))&&e),{value:e}}},validate(e,{error:t}){if("boolean"!=typeof e)return{value:e,errors:t("boolean.base")}},rules:{truthy:{method(...e){i.verifyFlat(e,"truthy");const t=this.clone();t.$_terms.truthy=t.$_terms.truthy||new o;for(let n=0;n<e.length;++n){const s=e[n];r(void 0!==s,"Cannot call truthy with undefined"),t.$_terms.truthy.add(s)}return t}},falsy:{method(...e){i.verifyFlat(e,"falsy");const t=this.clone();t.$_terms.falsy=t.$_terms.falsy||new o;for(let n=0;n<e.length;++n){const s=e[n];r(void 0!==s,"Cannot call falsy with undefined"),t.$_terms.falsy.add(s)}return t}},sensitive:{method(e=!0){return this.$_setFlag("sensitive",e)}}},cast:{number:{from:a.isBool,to:(e,t)=>e?1:0},string:{from:a.isBool,to:(e,t)=>e?"true":"false"}},manifest:{build:(e,t)=>(t.truthy&&(e=e.truthy(...t.truthy)),t.falsy&&(e=e.falsy(...t.falsy)),e)},messages:{"boolean.base":"{{#label}} must be a boolean"}})},7500:(e,t,n)=>{const r=n(375),s=n(8068),i=n(8160),o=n(3328),a={isDate:function(e){return e instanceof Date}};e.exports=s.extend({type:"date",coerce:{from:["number","string"],method:(e,{schema:t})=>({value:a.parse(e,t._flags.format)||e})},validate(e,{schema:t,error:n,prefs:r}){if(e instanceof Date&&!isNaN(e.getTime()))return;const s=t._flags.format;return r.convert&&s&&"string"==typeof e?{value:e,errors:n("date.format",{format:s})}:{value:e,errors:n("date.base")}},rules:{compare:{method:!1,validate(e,t,{date:n},{name:r,operator:s,args:o}){const a="now"===n?Date.now():n.getTime();return i.compare(e.getTime(),a,s)?e:t.error("date."+r,{limit:o.date,value:e})},args:[{name:"date",ref:!0,normalize:e=>"now"===e?e:a.parse(e),assert:e=>null!==e,message:"must have a valid date format"}]},format:{method(e){return r(["iso","javascript","unix"].includes(e),"Unknown date format",e),this.$_setFlag("format",e)}},greater:{method(e){return this.$_addRule({name:"greater",method:"compare",args:{date:e},operator:">"})}},iso:{method(){return this.format("iso")}},less:{method(e){return this.$_addRule({name:"less",method:"compare",args:{date:e},operator:"<"})}},max:{method(e){return this.$_addRule({name:"max",method:"compare",args:{date:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"compare",args:{date:e},operator:">="})}},timestamp:{method(e="javascript"){return r(["javascript","unix"].includes(e),'"type" must be one of "javascript, unix"'),this.format(e)}}},cast:{number:{from:a.isDate,to:(e,t)=>e.getTime()},string:{from:a.isDate,to:(e,{prefs:t})=>o.date(e,t)}},messages:{"date.base":"{{#label}} must be a valid date","date.format":'{{#label}} must be in {msg("date.format." + #format) || #format} format',"date.greater":"{{#label}} must be greater than {{:#limit}}","date.less":"{{#label}} must be less than {{:#limit}}","date.max":"{{#label}} must be less than or equal to {{:#limit}}","date.min":"{{#label}} must be greater than or equal to {{:#limit}}","date.format.iso":"ISO 8601 date","date.format.javascript":"timestamp or number of milliseconds","date.format.unix":"timestamp or number of seconds"}}),a.parse=function(e,t){if(e instanceof Date)return e;if("string"!=typeof e&&(isNaN(e)||!isFinite(e))||/^\s*$/.test(e))return null;if("iso"===t)return i.isIsoDate(e)?a.date(e.toString()):null;const n=e;if("string"==typeof e&&/^[+-]?\d+(\.\d+)?$/.test(e)&&(e=parseFloat(e)),t){if("javascript"===t)return a.date(1*e);if("unix"===t)return a.date(1e3*e);if("string"==typeof n)return null}return a.date(e)},a.date=function(e){const t=new Date(e);return isNaN(t.getTime())?null:t}},390:(e,t,n)=>{const r=n(375),s=n(7824);e.exports=s.extend({type:"function",properties:{typeof:"function"},rules:{arity:{method(e){return r(Number.isSafeInteger(e)&&e>=0,"n must be a positive integer"),this.$_addRule({name:"arity",args:{n:e}})},validate:(e,t,{n:n})=>e.length===n?e:t.error("function.arity",{n:n})},class:{method(){return this.$_addRule("class")},validate:(e,t)=>/^\s*class\s/.test(e.toString())?e:t.error("function.class",{value:e})},minArity:{method(e){return r(Number.isSafeInteger(e)&&e>0,"n must be a strict positive integer"),this.$_addRule({name:"minArity",args:{n:e}})},validate:(e,t,{n:n})=>e.length>=n?e:t.error("function.minArity",{n:n})},maxArity:{method(e){return r(Number.isSafeInteger(e)&&e>=0,"n must be a positive integer"),this.$_addRule({name:"maxArity",args:{n:e}})},validate:(e,t,{n:n})=>e.length<=n?e:t.error("function.maxArity",{n:n})}},messages:{"function.arity":"{{#label}} must have an arity of {{#n}}","function.class":"{{#label}} must be a class","function.maxArity":"{{#label}} must have an arity lesser or equal to {{#n}}","function.minArity":"{{#label}} must have an arity greater or equal to {{#n}}"}})},7824:(e,t,n)=>{const r=n(978),s=n(375),i=n(8571),o=n(3652),a=n(8068),c=n(8160),l=n(3292),u=n(6354),d=n(6133),p=n(3328),f={renameDefaults:{alias:!1,multiple:!1,override:!1}};e.exports=a.extend({type:"_keys",properties:{typeof:"object"},flags:{unknown:{default:void 0}},terms:{dependencies:{init:null},keys:{init:null,manifest:{mapped:{from:"schema",to:"key"}}},patterns:{init:null},renames:{init:null}},args:(e,t)=>e.keys(t),validate(e,{schema:t,error:n,state:r,prefs:s}){if(!e||typeof e!==t.$_property("typeof")||Array.isArray(e))return{value:e,errors:n("object.base",{type:t.$_property("typeof")})};if(!(t.$_terms.renames||t.$_terms.dependencies||t.$_terms.keys||t.$_terms.patterns||t.$_terms.externals))return;e=f.clone(e,s);const i=[];if(t.$_terms.renames&&!f.rename(t,e,r,s,i))return{value:e,errors:i};if(!t.$_terms.keys&&!t.$_terms.patterns&&!t.$_terms.dependencies)return{value:e,errors:i};const o=new Set(Object.keys(e));if(t.$_terms.keys){const n=[e,...r.ancestors];for(const a of t.$_terms.keys){const t=a.key,c=e[t];o.delete(t);const l=r.localize([...r.path,t],n,a),u=a.schema.$_validate(c,l,s);if(u.errors){if(s.abortEarly)return{value:e,errors:u.errors};void 0!==u.value&&(e[t]=u.value),i.push(...u.errors)}else"strip"===a.schema._flags.result||void 0===u.value&&void 0!==c?delete e[t]:void 0!==u.value&&(e[t]=u.value)}}if(o.size||t._flags._hasPatternMatch){const n=f.unknown(t,e,o,i,r,s);if(n)return n}if(t.$_terms.dependencies)for(const n of t.$_terms.dependencies){if(null!==n.key&&!1===f.isPresent(n.options)(n.key.resolve(e,r,s,null,{shadow:!1})))continue;const o=f.dependencies[n.rel](t,n,e,r,s);if(o){const n=t.$_createError(o.code,e,o.context,r,s);if(s.abortEarly)return{value:e,errors:n};i.push(n)}}return{value:e,errors:i}},rules:{and:{method(...e){return c.verifyFlat(e,"and"),f.dependency(this,"and",null,e)}},append:{method(e){return null==e||0===Object.keys(e).length?this:this.keys(e)}},assert:{method(e,t,n){p.isTemplate(e)||(e=l.ref(e)),s(void 0===n||"string"==typeof n,"Message must be a string"),t=this.$_compile(t,{appendPath:!0});const r=this.$_addRule({name:"assert",args:{subject:e,schema:t,message:n}});return r.$_mutateRegister(e),r.$_mutateRegister(t),r},validate(e,{error:t,prefs:n,state:r},{subject:s,schema:i,message:o}){const a=s.resolve(e,r,n),c=d.isRef(s)?s.absolute(r):[];return i.$_match(a,r.localize(c,[e,...r.ancestors],i),n)?e:t("object.assert",{subject:s,message:o})},args:["subject","schema","message"],multi:!0},instance:{method(e,t){return s("function"==typeof e,"constructor must be a function"),t=t||e.name,this.$_addRule({name:"instance",args:{constructor:e,name:t}})},validate:(e,t,{constructor:n,name:r})=>e instanceof n?e:t.error("object.instance",{type:r,value:e}),args:["constructor","name"]},keys:{method(e){s(void 0===e||"object"==typeof e,"Object schema must be a valid object"),s(!c.isSchema(e),"Object schema cannot be a joi schema");const t=this.clone();if(e)if(Object.keys(e).length){t.$_terms.keys=t.$_terms.keys?t.$_terms.keys.filter(t=>!e.hasOwnProperty(t.key)):new f.Keys;for(const n in e)c.tryWithPath(()=>t.$_terms.keys.push({key:n,schema:this.$_compile(e[n])}),n)}else t.$_terms.keys=new f.Keys;else t.$_terms.keys=null;return t.$_mutateRebuild()}},length:{method(e){return this.$_addRule({name:"length",args:{limit:e},operator:"="})},validate:(e,t,{limit:n},{name:r,operator:s,args:i})=>c.compare(Object.keys(e).length,n,s)?e:t.error("object."+r,{limit:i.limit,value:e}),args:[{name:"limit",ref:!0,assert:c.limit,message:"must be a positive integer"}]},max:{method(e){return this.$_addRule({name:"max",method:"length",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"length",args:{limit:e},operator:">="})}},nand:{method(...e){return c.verifyFlat(e,"nand"),f.dependency(this,"nand",null,e)}},or:{method(...e){return c.verifyFlat(e,"or"),f.dependency(this,"or",null,e)}},oxor:{method(...e){return f.dependency(this,"oxor",null,e)}},pattern:{method(e,t,n={}){const r=e instanceof RegExp;r||(e=this.$_compile(e,{appendPath:!0})),s(void 0!==t,"Invalid rule"),c.assertOptions(n,["fallthrough","matches"]),r&&s(!e.flags.includes("g")&&!e.flags.includes("y"),"pattern should not use global or sticky mode"),t=this.$_compile(t,{appendPath:!0});const i=this.clone();i.$_terms.patterns=i.$_terms.patterns||[];const o={[r?"regex":"schema"]:e,rule:t};return n.matches&&(o.matches=this.$_compile(n.matches),"array"!==o.matches.type&&(o.matches=o.matches.$_root.array().items(o.matches)),i.$_mutateRegister(o.matches),i.$_setFlag("_hasPatternMatch",!0,{clone:!1})),n.fallthrough&&(o.fallthrough=!0),i.$_terms.patterns.push(o),i.$_mutateRegister(t),i}},ref:{method(){return this.$_addRule("ref")},validate:(e,t)=>d.isRef(e)?e:t.error("object.refType",{value:e})},regex:{method(){return this.$_addRule("regex")},validate:(e,t)=>e instanceof RegExp?e:t.error("object.regex",{value:e})},rename:{method(e,t,n={}){s("string"==typeof e||e instanceof RegExp,"Rename missing the from argument"),s("string"==typeof t||t instanceof p,"Invalid rename to argument"),s(t!==e,"Cannot rename key to same name:",e),c.assertOptions(n,["alias","ignoreUndefined","override","multiple"]);const i=this.clone();i.$_terms.renames=i.$_terms.renames||[];for(const t of i.$_terms.renames)s(t.from!==e,"Cannot rename the same key multiple times");return t instanceof p&&i.$_mutateRegister(t),i.$_terms.renames.push({from:e,to:t,options:r(f.renameDefaults,n)}),i}},schema:{method(e="any"){return this.$_addRule({name:"schema",args:{type:e}})},validate:(e,t,{type:n})=>!c.isSchema(e)||"any"!==n&&e.type!==n?t.error("object.schema",{type:n}):e},unknown:{method(e){return this.$_setFlag("unknown",!1!==e)}},with:{method(e,t,n={}){return f.dependency(this,"with",e,t,n)}},without:{method(e,t,n={}){return f.dependency(this,"without",e,t,n)}},xor:{method(...e){return c.verifyFlat(e,"xor"),f.dependency(this,"xor",null,e)}}},overrides:{default(e,t){return void 0===e&&(e=c.symbols.deepDefault),this.$_parent("default",e,t)}},rebuild(e){if(e.$_terms.keys){const t=new o.Sorter;for(const n of e.$_terms.keys)c.tryWithPath(()=>t.add(n,{after:n.schema.$_rootReferences(),group:n.key}),n.key);e.$_terms.keys=new f.Keys(...t.nodes)}},manifest:{build(e,t){if(t.keys&&(e=e.keys(t.keys)),t.dependencies)for(const{rel:n,key:r=null,peers:s,options:i}of t.dependencies)e=f.dependency(e,n,r,s,i);if(t.patterns)for(const{regex:n,schema:r,rule:s,fallthrough:i,matches:o}of t.patterns)e=e.pattern(n||r,s,{fallthrough:i,matches:o});if(t.renames)for(const{from:n,to:r,options:s}of t.renames)e=e.rename(n,r,s);return e}},messages:{"object.and":"{{#label}} contains {{#presentWithLabels}} without its required peers {{#missingWithLabels}}","object.assert":'{{#label}} is invalid because {if(#subject.key, `"` + #subject.key + `" failed to ` + (#message || "pass the assertion test"), #message || "the assertion failed")}',"object.base":"{{#label}} must be of type {{#type}}","object.instance":"{{#label}} must be an instance of {{:#type}}","object.length":'{{#label}} must have {{#limit}} key{if(#limit == 1, "", "s")}',"object.max":'{{#label}} must have less than or equal to {{#limit}} key{if(#limit == 1, "", "s")}',"object.min":'{{#label}} must have at least {{#limit}} key{if(#limit == 1, "", "s")}',"object.missing":"{{#label}} must contain at least one of {{#peersWithLabels}}","object.nand":"{{:#mainWithLabel}} must not exist simultaneously with {{#peersWithLabels}}","object.oxor":"{{#label}} contains a conflict between optional exclusive peers {{#peersWithLabels}}","object.pattern.match":"{{#label}} keys failed to match pattern requirements","object.refType":"{{#label}} must be a Joi reference","object.regex":"{{#label}} must be a RegExp object","object.rename.multiple":"{{#label}} cannot rename {{:#from}} because multiple renames are disabled and another key was already renamed to {{:#to}}","object.rename.override":"{{#label}} cannot rename {{:#from}} because override is disabled and target {{:#to}} exists","object.schema":"{{#label}} must be a Joi schema of {{#type}} type","object.unknown":"{{#label}} is not allowed","object.with":"{{:#mainWithLabel}} missing required peer {{:#peerWithLabel}}","object.without":"{{:#mainWithLabel}} conflict with forbidden peer {{:#peerWithLabel}}","object.xor":"{{#label}} contains a conflict between exclusive peers {{#peersWithLabels}}"}}),f.clone=function(e,t){if("object"==typeof e){if(t.nonEnumerables)return i(e,{shallow:!0});const n=Object.create(Object.getPrototypeOf(e));return Object.assign(n,e),n}const n=function(...t){return e.apply(this,t)};return n.prototype=i(e.prototype),Object.defineProperty(n,"name",{value:e.name,writable:!1}),Object.defineProperty(n,"length",{value:e.length,writable:!1}),Object.assign(n,e),n},f.dependency=function(e,t,n,r,i){s(null===n||"string"==typeof n,t,"key must be a strings"),i||(i=r.length>1&&"object"==typeof r[r.length-1]?r.pop():{}),c.assertOptions(i,["separator","isPresent"]),r=[].concat(r);const o=c.default(i.separator,"."),a=[];for(const e of r)s("string"==typeof e,t,"peers must be strings"),a.push(l.ref(e,{separator:o,ancestor:0,prefix:!1}));null!==n&&(n=l.ref(n,{separator:o,ancestor:0,prefix:!1}));const u=e.clone();return u.$_terms.dependencies=u.$_terms.dependencies||[],u.$_terms.dependencies.push(new f.Dependency(t,n,a,r,i)),u},f.dependencies={and(e,t,n,r,s){const i=[],o=[],a=t.peers.length,c=f.isPresent(t.options);for(const e of t.peers)!1===c(e.resolve(n,r,s,null,{shadow:!1}))?i.push(e.key):o.push(e.key);if(i.length!==a&&o.length!==a)return{code:"object.and",context:{present:o,presentWithLabels:f.keysToLabels(e,o),missing:i,missingWithLabels:f.keysToLabels(e,i)}}},nand(e,t,n,r,s){const i=[],o=f.isPresent(t.options);for(const e of t.peers)o(e.resolve(n,r,s,null,{shadow:!1}))&&i.push(e.key);if(i.length!==t.peers.length)return;const a=t.paths[0],c=t.paths.slice(1);return{code:"object.nand",context:{main:a,mainWithLabel:f.keysToLabels(e,a),peers:c,peersWithLabels:f.keysToLabels(e,c)}}},or(e,t,n,r,s){const i=f.isPresent(t.options);for(const e of t.peers)if(i(e.resolve(n,r,s,null,{shadow:!1})))return;return{code:"object.missing",context:{peers:t.paths,peersWithLabels:f.keysToLabels(e,t.paths)}}},oxor(e,t,n,r,s){const i=[],o=f.isPresent(t.options);for(const e of t.peers)o(e.resolve(n,r,s,null,{shadow:!1}))&&i.push(e.key);if(!i.length||1===i.length)return;const a={peers:t.paths,peersWithLabels:f.keysToLabels(e,t.paths)};return a.present=i,a.presentWithLabels=f.keysToLabels(e,i),{code:"object.oxor",context:a}},with(e,t,n,r,s){const i=f.isPresent(t.options);for(const o of t.peers)if(!1===i(o.resolve(n,r,s,null,{shadow:!1})))return{code:"object.with",context:{main:t.key.key,mainWithLabel:f.keysToLabels(e,t.key.key),peer:o.key,peerWithLabel:f.keysToLabels(e,o.key)}}},without(e,t,n,r,s){const i=f.isPresent(t.options);for(const o of t.peers)if(i(o.resolve(n,r,s,null,{shadow:!1})))return{code:"object.without",context:{main:t.key.key,mainWithLabel:f.keysToLabels(e,t.key.key),peer:o.key,peerWithLabel:f.keysToLabels(e,o.key)}}},xor(e,t,n,r,s){const i=[],o=f.isPresent(t.options);for(const e of t.peers)o(e.resolve(n,r,s,null,{shadow:!1}))&&i.push(e.key);if(1===i.length)return;const a={peers:t.paths,peersWithLabels:f.keysToLabels(e,t.paths)};return 0===i.length?{code:"object.missing",context:a}:(a.present=i,a.presentWithLabels=f.keysToLabels(e,i),{code:"object.xor",context:a})}},f.keysToLabels=function(e,t){return Array.isArray(t)?t.map(t=>e.$_mapLabels(t)):e.$_mapLabels(t)},f.isPresent=function(e){return"function"==typeof e.isPresent?e.isPresent:e=>void 0!==e},f.rename=function(e,t,n,r,s){const i={};for(const o of e.$_terms.renames){const a=[],c="string"!=typeof o.from;if(c)for(const e in t){if(void 0===t[e]&&o.options.ignoreUndefined||e===o.to)continue;const n=o.from.exec(e);n&&a.push({from:e,to:o.to,match:n})}else!Object.prototype.hasOwnProperty.call(t,o.from)||void 0===t[o.from]&&o.options.ignoreUndefined||a.push(o);for(const l of a){const a=l.from;let u=l.to;if(u instanceof p&&(u=u.render(t,n,r,l.match)),a!==u){if(!o.options.multiple&&i[u]&&(s.push(e.$_createError("object.rename.multiple",t,{from:a,to:u,pattern:c},n,r)),r.abortEarly)||Object.prototype.hasOwnProperty.call(t,u)&&!o.options.override&&!i[u]&&(s.push(e.$_createError("object.rename.override",t,{from:a,to:u,pattern:c},n,r)),r.abortEarly))return!1;void 0===t[a]?delete t[u]:t[u]=t[a],i[u]=!0,o.options.alias||delete t[a]}}}return!0},f.unknown=function(e,t,n,r,s,i){if(e.$_terms.patterns){let o=!1;const a=e.$_terms.patterns.map(e=>{if(e.matches)return o=!0,[]}),c=[t,...s.ancestors];for(const o of n){const l=t[o],u=[...s.path,o];for(let d=0;d<e.$_terms.patterns.length;++d){const p=e.$_terms.patterns[d];if(p.regex){const e=p.regex.test(o);if(s.mainstay.tracer.debug(s,"rule","pattern.".concat(d),e?"pass":"error"),!e)continue}else if(!p.schema.$_match(o,s.nest(p.schema,"pattern.".concat(d)),i))continue;n.delete(o);const f=s.localize(u,c,{schema:p.rule,key:o}),h=p.rule.$_validate(l,f,i);if(h.errors){if(i.abortEarly)return{value:t,errors:h.errors};r.push(...h.errors)}if(p.matches&&a[d].push(o),t[o]=h.value,!p.fallthrough)break}}if(o)for(let n=0;n<a.length;++n){const o=a[n];if(!o)continue;const l=e.$_terms.patterns[n].matches,d=s.localize(s.path,c,l),p=l.$_validate(o,d,i);if(p.errors){const n=u.details(p.errors,{override:!1});n.matches=o;const a=e.$_createError("object.pattern.match",t,n,s,i);if(i.abortEarly)return{value:t,errors:a};r.push(a)}}}if(n.size&&(e.$_terms.keys||e.$_terms.patterns)){if(i.stripUnknown&&void 0===e._flags.unknown||i.skipFunctions){const e=!(!i.stripUnknown||!0!==i.stripUnknown&&!i.stripUnknown.objects);for(const r of n)e?(delete t[r],n.delete(r)):"function"==typeof t[r]&&n.delete(r)}if(!c.default(e._flags.unknown,i.allowUnknown))for(const o of n){const n=s.localize([...s.path,o],[]),a=e.$_createError("object.unknown",t[o],{child:o},n,i,{flags:!1});if(i.abortEarly)return{value:t,errors:a};r.push(a)}}},f.Dependency=class{constructor(e,t,n,r,s){this.rel=e,this.key=t,this.peers=n,this.paths=r,this.options=s}describe(){const e={rel:this.rel,peers:this.paths};return null!==this.key&&(e.key=this.key.key),"."!==this.peers[0].separator&&(e.options=oe(ie({},e.options),{separator:this.peers[0].separator})),this.options.isPresent&&(e.options=oe(ie({},e.options),{isPresent:this.options.isPresent})),e}},f.Keys=class extends Array{concat(e){const t=this.slice(),n=new Map;for(let e=0;e<t.length;++e)n.set(t[e].key,e);for(const r of e){const e=r.key,s=n.get(e);void 0!==s?t[s]={key:e,schema:t[s].schema.concat(r.schema)}:t.push(r)}return t}}},8785:(e,t,n)=>{const r=n(375),s=n(8068),i=n(8160),o=n(3292),a=n(6354),c={};e.exports=s.extend({type:"link",properties:{schemaChain:!0},terms:{link:{init:null,manifest:"single",register:!1}},args:(e,t)=>e.ref(t),validate(e,{schema:t,state:n,prefs:s}){r(t.$_terms.link,"Uninitialized link schema");const i=c.generate(t,e,n,s),o=t.$_terms.link[0].ref;return i.$_validate(e,n.nest(i,"link:".concat(o.display,":").concat(i.type)),s)},generate:(e,t,n,r)=>c.generate(e,t,n,r),rules:{ref:{method(e){r(!this.$_terms.link,"Cannot reinitialize schema"),e=o.ref(e),r("value"===e.type||"local"===e.type,"Invalid reference type:",e.type),r("local"===e.type||"root"===e.ancestor||e.ancestor>0,"Link cannot reference itself");const t=this.clone();return t.$_terms.link=[{ref:e}],t}},relative:{method(e=!0){return this.$_setFlag("relative",e)}}},overrides:{concat(e){r(this.$_terms.link,"Uninitialized link schema"),r(i.isSchema(e),"Invalid schema object"),r("link"!==e.type,"Cannot merge type link with another link");const t=this.clone();return t.$_terms.whens||(t.$_terms.whens=[]),t.$_terms.whens.push({concat:e}),t.$_mutateRebuild()}},manifest:{build:(e,t)=>(r(t.link,"Invalid link description missing link"),e.ref(t.link))}}),c.generate=function(e,t,n,r){let s=n.mainstay.links.get(e);if(s)return s._generate(t,n,r).schema;const i=e.$_terms.link[0].ref,{perspective:o,path:a}=c.perspective(i,n);c.assert(o,"which is outside of schema boundaries",i,e,n,r);try{s=a.length?o.$_reach(a):o}catch(t){c.assert(!1,"to non-existing schema",i,e,n,r)}return c.assert("link"!==s.type,"which is another link",i,e,n,r),e._flags.relative||n.mainstay.links.set(e,s),s._generate(t,n,r).schema},c.perspective=function(e,t){if("local"===e.type){for(const{schema:n,key:r}of t.schemas){if((n._flags.id||r)===e.path[0])return{perspective:n,path:e.path.slice(1)};if(n.$_terms.shared)for(const t of n.$_terms.shared)if(t._flags.id===e.path[0])return{perspective:t,path:e.path.slice(1)}}return{perspective:null,path:null}}return"root"===e.ancestor?{perspective:t.schemas[t.schemas.length-1].schema,path:e.path}:{perspective:t.schemas[e.ancestor]&&t.schemas[e.ancestor].schema,path:e.path}},c.assert=function(e,t,n,s,i,o){e||r(!1,'"'.concat(a.label(s._flags,i,o),'" contains link reference "').concat(n.display,'" ').concat(t))}},3832:(e,t,n)=>{const r=n(375),s=n(8068),i=n(8160),o={numberRx:/^\s*[+-]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e([+-]?\d+))?\s*$/i,precisionRx:/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/,exponentialPartRegex:/[eE][+-]?\d+$/,leadingSignAndZerosRegex:/^[+-]?(0*)?/,dotRegex:/\./,trailingZerosRegex:/0+$/,decimalPlaces(e){const t=e.toString(),n=t.indexOf("."),r=t.indexOf("e");return(n<0?0:(r<0?t.length:r)-n-1)+(r<0?0:Math.max(0,-parseInt(t.slice(r+1))))}};e.exports=s.extend({type:"number",flags:{unsafe:{default:!1}},coerce:{from:"string",method(e,{schema:t,error:n}){if(!e.match(o.numberRx))return;e=e.trim();const r={value:parseFloat(e)};if(0===r.value&&(r.value=0),!t._flags.unsafe)if(e.match(/e/i)){if(o.extractSignificantDigits(e)!==o.extractSignificantDigits(String(r.value)))return r.errors=n("number.unsafe"),r}else{const t=r.value.toString();if(t.match(/e/i))return r;if(t!==o.normalizeDecimal(e))return r.errors=n("number.unsafe"),r}return r}},validate(e,{schema:t,error:n,prefs:r}){if(e===1/0||e===-1/0)return{value:e,errors:n("number.infinity")};if(!i.isNumber(e))return{value:e,errors:n("number.base")};const s={value:e};if(r.convert){const e=t.$_getRule("precision");if(e){const t=Math.pow(10,e.args.limit);s.value=Math.round(s.value*t)/t}}return 0===s.value&&(s.value=0),!t._flags.unsafe&&(e>Number.MAX_SAFE_INTEGER||e<Number.MIN_SAFE_INTEGER)&&(s.errors=n("number.unsafe")),s},rules:{compare:{method:!1,validate:(e,t,{limit:n},{name:r,operator:s,args:o})=>i.compare(e,n,s)?e:t.error("number."+r,{limit:o.limit,value:e}),args:[{name:"limit",ref:!0,assert:i.isNumber,message:"must be a number"}]},greater:{method(e){return this.$_addRule({name:"greater",method:"compare",args:{limit:e},operator:">"})}},integer:{method(){return this.$_addRule("integer")},validate:(e,t)=>Math.trunc(e)-e==0?e:t.error("number.integer")},less:{method(e){return this.$_addRule({name:"less",method:"compare",args:{limit:e},operator:"<"})}},max:{method(e){return this.$_addRule({name:"max",method:"compare",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"compare",args:{limit:e},operator:">="})}},multiple:{method(e){const t="number"==typeof e?o.decimalPlaces(e):null,n=Math.pow(10,t);return this.$_addRule({name:"multiple",args:{base:e,baseDecimalPlace:t,pfactor:n}})},validate:(e,t,{base:n,baseDecimalPlace:r,pfactor:s},i)=>o.decimalPlaces(e)>r?t.error("number.multiple",{multiple:i.args.base,value:e}):Math.round(s*e)%Math.round(s*n)==0?e:t.error("number.multiple",{multiple:i.args.base,value:e}),args:[{name:"base",ref:!0,assert:e=>"number"==typeof e&&isFinite(e)&&e>0,message:"must be a positive number"},"baseDecimalPlace","pfactor"],multi:!0},negative:{method(){return this.sign("negative")}},port:{method(){return this.$_addRule("port")},validate:(e,t)=>Number.isSafeInteger(e)&&e>=0&&e<=65535?e:t.error("number.port")},positive:{method(){return this.sign("positive")}},precision:{method(e){return r(Number.isSafeInteger(e),"limit must be an integer"),this.$_addRule({name:"precision",args:{limit:e}})},validate(e,t,{limit:n}){const r=e.toString().match(o.precisionRx);return Math.max((r[1]?r[1].length:0)-(r[2]?parseInt(r[2],10):0),0)<=n?e:t.error("number.precision",{limit:n,value:e})},convert:!0},sign:{method(e){return r(["negative","positive"].includes(e),"Invalid sign",e),this.$_addRule({name:"sign",args:{sign:e}})},validate:(e,t,{sign:n})=>"negative"===n&&e<0||"positive"===n&&e>0?e:t.error("number.".concat(n))},unsafe:{method(e=!0){return r("boolean"==typeof e,"enabled must be a boolean"),this.$_setFlag("unsafe",e)}}},cast:{string:{from:e=>"number"==typeof e,to:(e,t)=>e.toString()}},messages:{"number.base":"{{#label}} must be a number","number.greater":"{{#label}} must be greater than {{#limit}}","number.infinity":"{{#label}} cannot be infinity","number.integer":"{{#label}} must be an integer","number.less":"{{#label}} must be less than {{#limit}}","number.max":"{{#label}} must be less than or equal to {{#limit}}","number.min":"{{#label}} must be greater than or equal to {{#limit}}","number.multiple":"{{#label}} must be a multiple of {{#multiple}}","number.negative":"{{#label}} must be a negative number","number.port":"{{#label}} must be a valid port","number.positive":"{{#label}} must be a positive number","number.precision":"{{#label}} must have no more than {{#limit}} decimal places","number.unsafe":"{{#label}} must be a safe number"}}),o.extractSignificantDigits=function(e){return e.replace(o.exponentialPartRegex,"").replace(o.dotRegex,"").replace(o.trailingZerosRegex,"").replace(o.leadingSignAndZerosRegex,"")},o.normalizeDecimal=function(e){return(e=e.replace(/^\+/,"").replace(/\.0*$/,"").replace(/^(-?)\.([^\.]*)$/,"$10.$2").replace(/^(-?)0+([0-9])/,"$1$2")).includes(".")&&e.endsWith("0")&&(e=e.replace(/0+$/,"")),"-0"===e?"0":e}},8966:(e,t,n)=>{const r=n(7824);e.exports=r.extend({type:"object",cast:{map:{from:e=>e&&"object"==typeof e,to:(e,t)=>new Map(Object.entries(e))}}})},7417:(e,t,n)=>{const r=n(375),s=n(5380),i=n(1745),o=n(9959),a=n(6064),c=n(9926),l=n(5752),u=n(8068),d=n(8160),p={tlds:c instanceof Set&&{tlds:{allow:c,deny:null}},base64Regex:{true:{true:/^(?:[\w\-]{2}[\w\-]{2})*(?:[\w\-]{2}==|[\w\-]{3}=)?$/,false:/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/},false:{true:/^(?:[\w\-]{2}[\w\-]{2})*(?:[\w\-]{2}(==)?|[\w\-]{3}=?)?$/,false:/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}(==)?|[A-Za-z0-9+\/]{3}=?)?$/}},dataUriRegex:/^data:[\w+.-]+\/[\w+.-]+;((charset=[\w-]+|base64),)?(.*)$/,hexRegex:{withPrefix:/^0x[0-9a-f]+$/i,withOptionalPrefix:/^(?:0x)?[0-9a-f]+$/i,withoutPrefix:/^[0-9a-f]+$/i},ipRegex:o.regex({cidr:"forbidden"}).regex,isoDurationRegex:/^P(?!$)(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?$/,guidBrackets:{"{":"}","[":"]","(":")","":""},guidVersions:{uuidv1:"1",uuidv2:"2",uuidv3:"3",uuidv4:"4",uuidv5:"5",uuidv6:"6",uuidv7:"7",uuidv8:"8"},guidSeparators:new Set([void 0,!0,!1,"-",":"]),normalizationForms:["NFC","NFD","NFKC","NFKD"]};e.exports=u.extend({type:"string",flags:{insensitive:{default:!1},truncate:{default:!1}},terms:{replacements:{init:null}},coerce:{from:"string",method(e,{schema:t,state:n,prefs:r}){const s=t.$_getRule("normalize");s&&(e=e.normalize(s.args.form));const i=t.$_getRule("case");i&&(e="upper"===i.args.direction?e.toLocaleUpperCase():e.toLocaleLowerCase());const o=t.$_getRule("trim");if(o&&o.args.enabled&&(e=e.trim()),t.$_terms.replacements)for(const n of t.$_terms.replacements)e=e.replace(n.pattern,n.replacement);const a=t.$_getRule("hex");if(a&&a.args.options.byteAligned&&e.length%2!=0&&(e="0".concat(e)),t.$_getRule("isoDate")){const t=p.isoDate(e);t&&(e=t)}if(t._flags.truncate){const s=t.$_getRule("max");if(s){let i=s.args.limit;if(d.isResolvable(i)&&(i=i.resolve(e,n,r),!d.limit(i)))return{value:e,errors:t.$_createError("any.ref",i,{ref:s.args.limit,arg:"limit",reason:"must be a positive integer"},n,r)};e=e.slice(0,i)}}return{value:e}}},validate(e,{schema:t,error:n}){if("string"!=typeof e)return{value:e,errors:n("string.base")};if(""===e){const r=t.$_getRule("min");return r&&0===r.args.limit?void 0:{value:e,errors:n("string.empty")}}},rules:{alphanum:{method(){return this.$_addRule("alphanum")},validate:(e,t)=>/^[a-zA-Z0-9]+$/.test(e)?e:t.error("string.alphanum")},base64:{method(e={}){return d.assertOptions(e,["paddingRequired","urlSafe"]),e=ie({urlSafe:!1,paddingRequired:!0},e),r("boolean"==typeof e.paddingRequired,"paddingRequired must be boolean"),r("boolean"==typeof e.urlSafe,"urlSafe must be boolean"),this.$_addRule({name:"base64",args:{options:e}})},validate:(e,t,{options:n})=>p.base64Regex[n.paddingRequired][n.urlSafe].test(e)?e:t.error("string.base64")},case:{method(e){return r(["lower","upper"].includes(e),"Invalid case:",e),this.$_addRule({name:"case",args:{direction:e}})},validate:(e,t,{direction:n})=>"lower"===n&&e===e.toLocaleLowerCase()||"upper"===n&&e===e.toLocaleUpperCase()?e:t.error("string.".concat(n,"case")),convert:!0},creditCard:{method(){return this.$_addRule("creditCard")},validate(e,t){let n=e.length,r=0,s=1;for(;n--;){const t=e.charAt(n)*s;r+=t-9*(t>9),s^=3}return r>0&&r%10==0?e:t.error("string.creditCard")}},dataUri:{method(e={}){return d.assertOptions(e,["paddingRequired"]),e=ie({paddingRequired:!0},e),r("boolean"==typeof e.paddingRequired,"paddingRequired must be boolean"),this.$_addRule({name:"dataUri",args:{options:e}})},validate(e,t,{options:n}){const r=e.match(p.dataUriRegex);return!r||r[2]&&"base64"===r[2]&&!p.base64Regex[n.paddingRequired].false.test(r[3])?t.error("string.dataUri"):e}},domain:{method(e){e&&d.assertOptions(e,["allowFullyQualified","allowUnicode","maxDomainSegments","minDomainSegments","tlds"]);const t=p.addressOptions(e);return this.$_addRule({name:"domain",args:{options:e},address:t})},validate:(e,t,n,{address:r})=>s.isValid(e,r)?e:t.error("string.domain")},email:{method(e={}){d.assertOptions(e,["allowFullyQualified","allowUnicode","ignoreLength","maxDomainSegments","minDomainSegments","multiple","separator","tlds"]),r(void 0===e.multiple||"boolean"==typeof e.multiple,"multiple option must be an boolean");const t=p.addressOptions(e),n=new RegExp("\\s*[".concat(e.separator?a(e.separator):",","]\\s*"));return this.$_addRule({name:"email",args:{options:e},regex:n,address:t})},validate(e,t,{options:n},{regex:r,address:s}){const o=n.multiple?e.split(r):[e],a=[];for(const e of o)i.isValid(e,s)||a.push(e);return a.length?t.error("string.email",{value:e,invalids:a}):e}},guid:{alias:"uuid",method(e={}){d.assertOptions(e,["version","separator"]);let t="";if(e.version){const n=[].concat(e.version);r(n.length>=1,"version must have at least 1 valid version specified");const s=new Set;for(let e=0;e<n.length;++e){const i=n[e];r("string"==typeof i,"version at position "+e+" must be a string");const o=p.guidVersions[i.toLowerCase()];r(o,"version at position "+e+" must be one of "+Object.keys(p.guidVersions).join(", ")),r(!s.has(o),"version at position "+e+" must not be a duplicate"),t+=o,s.add(o)}}r(p.guidSeparators.has(e.separator),'separator must be one of true, false, "-", or ":"');const n=void 0===e.separator?"[:-]?":!0===e.separator?"[:-]":!1===e.separator?"[]?":"\\".concat(e.separator),s=new RegExp("^([\\[{\\(]?)[0-9A-F]{8}(".concat(n,")[0-9A-F]{4}\\2?[").concat(t||"0-9A-F","][0-9A-F]{3}\\2?[").concat(t?"89AB":"0-9A-F","][0-9A-F]{3}\\2?[0-9A-F]{12}([\\]}\\)]?)$"),"i");return this.$_addRule({name:"guid",args:{options:e},regex:s})},validate(e,t,n,{regex:r}){const s=r.exec(e);return s?p.guidBrackets[s[1]]!==s[s.length-1]?t.error("string.guid"):e:t.error("string.guid")}},hex:{method(e={}){return d.assertOptions(e,["byteAligned","prefix"]),e=ie({byteAligned:!1,prefix:!1},e),r("boolean"==typeof e.byteAligned,"byteAligned must be boolean"),r("boolean"==typeof e.prefix||"optional"===e.prefix,'prefix must be boolean or "optional"'),this.$_addRule({name:"hex",args:{options:e}})},validate:(e,t,{options:n})=>("optional"===n.prefix?p.hexRegex.withOptionalPrefix:!0===n.prefix?p.hexRegex.withPrefix:p.hexRegex.withoutPrefix).test(e)?n.byteAligned&&e.length%2!=0?t.error("string.hexAlign"):e:t.error("string.hex")},hostname:{method(){return this.$_addRule("hostname")},validate:(e,t)=>s.isValid(e,{minDomainSegments:1})||p.ipRegex.test(e)?e:t.error("string.hostname")},insensitive:{method(){return this.$_setFlag("insensitive",!0)}},ip:{method(e={}){d.assertOptions(e,["cidr","version"]);const{cidr:t,versions:n,regex:r}=o.regex(e),s=e.version?n:void 0;return this.$_addRule({name:"ip",args:{options:{cidr:t,version:s}},regex:r})},validate:(e,t,{options:n},{regex:r})=>r.test(e)?e:n.version?t.error("string.ipVersion",{value:e,cidr:n.cidr,version:n.version}):t.error("string.ip",{value:e,cidr:n.cidr})},isoDate:{method(){return this.$_addRule("isoDate")},validate:(e,{error:t})=>p.isoDate(e)?e:t("string.isoDate")},isoDuration:{method(){return this.$_addRule("isoDuration")},validate:(e,t)=>p.isoDurationRegex.test(e)?e:t.error("string.isoDuration")},length:{method(e,t){return p.length(this,"length",e,"=",t)},validate(e,t,{limit:n,encoding:r},{name:s,operator:i,args:o}){const a=!r&&e.length;return d.compare(a,n,i)?e:t.error("string."+s,{limit:o.limit,value:e,encoding:r})},args:[{name:"limit",ref:!0,assert:d.limit,message:"must be a positive integer"},"encoding"]},lowercase:{method(){return this.case("lower")}},max:{method(e,t){return p.length(this,"max",e,"<=",t)},args:["limit","encoding"]},min:{method(e,t){return p.length(this,"min",e,">=",t)},args:["limit","encoding"]},normalize:{method(e="NFC"){return r(p.normalizationForms.includes(e),"normalization form must be one of "+p.normalizationForms.join(", ")),this.$_addRule({name:"normalize",args:{form:e}})},validate:(e,{error:t},{form:n})=>e===e.normalize(n)?e:t("string.normalize",{value:e,form:n}),convert:!0},pattern:{alias:"regex",method(e,t={}){r(e instanceof RegExp,"regex must be a RegExp"),r(!e.flags.includes("g")&&!e.flags.includes("y"),"regex should not use global or sticky mode"),"string"==typeof t&&(t={name:t}),d.assertOptions(t,["invert","name"]);const n=["string.pattern",t.invert?".invert":"",t.name?".name":".base"].join("");return this.$_addRule({name:"pattern",args:{regex:e,options:t},errorCode:n})},validate:(e,t,{regex:n,options:r},{errorCode:s})=>n.test(e)^r.invert?e:t.error(s,{name:r.name,regex:n,value:e}),args:["regex","options"],multi:!0},replace:{method(e,t){"string"==typeof e&&(e=new RegExp(a(e),"g")),r(e instanceof RegExp,"pattern must be a RegExp"),r("string"==typeof t,"replacement must be a String");const n=this.clone();return n.$_terms.replacements||(n.$_terms.replacements=[]),n.$_terms.replacements.push({pattern:e,replacement:t}),n}},token:{method(){return this.$_addRule("token")},validate:(e,t)=>/^\w+$/.test(e)?e:t.error("string.token")},trim:{method(e=!0){return r("boolean"==typeof e,"enabled must be a boolean"),this.$_addRule({name:"trim",args:{enabled:e}})},validate:(e,t,{enabled:n})=>n&&e!==e.trim()?t.error("string.trim"):e,convert:!0},truncate:{method(e=!0){return r("boolean"==typeof e,"enabled must be a boolean"),this.$_setFlag("truncate",e)}},uppercase:{method(){return this.case("upper")}},uri:{method(e={}){d.assertOptions(e,["allowRelative","allowQuerySquareBrackets","domain","relativeOnly","scheme","encodeUri"]),e.domain&&d.assertOptions(e.domain,["allowFullyQualified","allowUnicode","maxDomainSegments","minDomainSegments","tlds"]);const{regex:t,scheme:n}=l.regex(e),r=e.domain?p.addressOptions(e.domain):null;return this.$_addRule({name:"uri",args:{options:e},regex:t,domain:r,scheme:n})},validate(e,t,{options:n},{regex:r,domain:i,scheme:o}){if(["http:/","https:/"].includes(e))return t.error("string.uri");let a=r.exec(e);if(!a&&t.prefs.convert&&n.encodeUri){const t=encodeURI(e);a=r.exec(t),a&&(e=t)}if(a){const r=a[1]||a[2];return!i||n.allowRelative&&!r||s.isValid(r,i)?e:t.error("string.domain",{value:r})}return n.relativeOnly?t.error("string.uriRelativeOnly"):n.scheme?t.error("string.uriCustomScheme",{scheme:o,value:e}):t.error("string.uri")}}},manifest:{build(e,t){if(t.replacements)for(const{pattern:n,replacement:r}of t.replacements)e=e.replace(n,r);return e}},messages:{"string.alphanum":"{{#label}} must only contain alpha-numeric characters","string.base":"{{#label}} must be a string","string.base64":"{{#label}} must be a valid base64 string","string.creditCard":"{{#label}} must be a credit card","string.dataUri":"{{#label}} must be a valid dataUri string","string.domain":"{{#label}} must contain a valid domain name","string.email":"{{#label}} must be a valid email","string.empty":"{{#label}} is not allowed to be empty","string.guid":"{{#label}} must be a valid GUID","string.hex":"{{#label}} must only contain hexadecimal characters","string.hexAlign":"{{#label}} hex decoded representation must be byte aligned","string.hostname":"{{#label}} must be a valid hostname","string.ip":"{{#label}} must be a valid ip address with a {{#cidr}} CIDR","string.ipVersion":"{{#label}} must be a valid ip address of one of the following versions {{#version}} with a {{#cidr}} CIDR","string.isoDate":"{{#label}} must be in iso format","string.isoDuration":"{{#label}} must be a valid ISO 8601 duration","string.length":"{{#label}} length must be {{#limit}} characters long","string.lowercase":"{{#label}} must only contain lowercase characters","string.max":"{{#label}} length must be less than or equal to {{#limit}} characters long","string.min":"{{#label}} length must be at least {{#limit}} characters long","string.normalize":"{{#label}} must be unicode normalized in the {{#form}} form","string.token":"{{#label}} must only contain alpha-numeric and underscore characters","string.pattern.base":"{{#label}} with value {:[.]} fails to match the required pattern: {{#regex}}","string.pattern.name":"{{#label}} with value {:[.]} fails to match the {{#name}} pattern","string.pattern.invert.base":"{{#label}} with value {:[.]} matches the inverted pattern: {{#regex}}","string.pattern.invert.name":"{{#label}} with value {:[.]} matches the inverted {{#name}} pattern","string.trim":"{{#label}} must not have leading or trailing whitespace","string.uri":"{{#label}} must be a valid uri","string.uriCustomScheme":"{{#label}} must be a valid uri with a scheme matching the {{#scheme}} pattern","string.uriRelativeOnly":"{{#label}} must be a valid relative uri","string.uppercase":"{{#label}} must only contain uppercase characters"}}),p.addressOptions=function(e){if(!e)return p.tlds||e;if(r(void 0===e.minDomainSegments||Number.isSafeInteger(e.minDomainSegments)&&e.minDomainSegments>0,"minDomainSegments must be a positive integer"),r(void 0===e.maxDomainSegments||Number.isSafeInteger(e.maxDomainSegments)&&e.maxDomainSegments>0,"maxDomainSegments must be a positive integer"),!1===e.tlds)return e;if(!0===e.tlds||void 0===e.tlds)return r(p.tlds,"Built-in TLD list disabled"),Object.assign({},e,p.tlds);r("object"==typeof e.tlds,"tlds must be true, false, or an object");const t=e.tlds.deny;if(t)return Array.isArray(t)&&(e=Object.assign({},e,{tlds:{deny:new Set(t)}})),r(e.tlds.deny instanceof Set,"tlds.deny must be an array, Set, or boolean"),r(!e.tlds.allow,"Cannot specify both tlds.allow and tlds.deny lists"),p.validateTlds(e.tlds.deny,"tlds.deny"),e;const n=e.tlds.allow;return n?!0===n?(r(p.tlds,"Built-in TLD list disabled"),Object.assign({},e,p.tlds)):(Array.isArray(n)&&(e=Object.assign({},e,{tlds:{allow:new Set(n)}})),r(e.tlds.allow instanceof Set,"tlds.allow must be an array, Set, or boolean"),p.validateTlds(e.tlds.allow,"tlds.allow"),e):e},p.validateTlds=function(e,t){for(const n of e)r(s.isValid(n,{minDomainSegments:1,maxDomainSegments:1}),"".concat(t," must contain valid top level domain names"))},p.isoDate=function(e){if(!d.isIsoDate(e))return null;/.*T.*[+-]\d\d$/.test(e)&&(e+="00");const t=new Date(e);return isNaN(t.getTime())?null:t.toISOString()},p.length=function(e,t,n,s,i){return r(!i||!1,"Invalid encoding:",i),e.$_addRule({name:t,method:"length",args:{limit:n,encoding:i},operator:s})}},8826:(e,t,n)=>{const r=n(375),s=n(8068),i={};i.Map=class extends Map{slice(){return new i.Map(this)}},e.exports=s.extend({type:"symbol",terms:{map:{init:new i.Map}},coerce:{method(e,{schema:t,error:n}){const r=t.$_terms.map.get(e);return r&&(e=r),t._flags.only&&"symbol"!=typeof e?{value:e,errors:n("symbol.map",{map:t.$_terms.map})}:{value:e}}},validate(e,{error:t}){if("symbol"!=typeof e)return{value:e,errors:t("symbol.base")}},rules:{map:{method(e){e&&!e[Symbol.iterator]&&"object"==typeof e&&(e=Object.entries(e)),r(e&&e[Symbol.iterator],"Iterable must be an iterable or object");const t=this.clone(),n=[];for(const s of e){r(s&&s[Symbol.iterator],"Entry must be an iterable");const[e,i]=s;r("object"!=typeof e&&"function"!=typeof e&&"symbol"!=typeof e,"Key must not be of type object, function, or Symbol"),r("symbol"==typeof i,"Value must be a Symbol"),t.$_terms.map.set(e,i),n.push(i)}return t.valid(...n)}}},manifest:{build:(e,t)=>(t.map&&(e=e.map(t.map)),e)},messages:{"symbol.base":"{{#label}} must be a symbol","symbol.map":"{{#label}} must be one of {{#map}}"}})},8863:(e,t,n)=>{const r=n(375),s=n(8571),i=n(738),o=n(9621),a=n(8160),c=n(6354),l=n(493),u={result:Symbol("result")};t.entry=function(e,t,n){let s=a.defaults;n&&(r(void 0===n.warnings,"Cannot override warnings preference in synchronous validation"),r(void 0===n.artifacts,"Cannot override artifacts preference in synchronous validation"),s=a.preferences(a.defaults,n));const i=u.entry(e,t,s);r(!i.mainstay.externals.length,"Schema with external rules must use validateAsync()");const o={value:i.value};return i.error&&(o.error=i.error),i.mainstay.warnings.length&&(o.warning=c.details(i.mainstay.warnings)),i.mainstay.debug&&(o.debug=i.mainstay.debug),i.mainstay.artifacts&&(o.artifacts=i.mainstay.artifacts),o},t.entryAsync=async function(e,t,n){let r=a.defaults;n&&(r=a.preferences(a.defaults,n));const s=u.entry(e,t,r),i=s.mainstay;if(s.error)throw i.debug&&(s.error.debug=i.debug),s.error;if(i.externals.length){let t=s.value;const l=[];for(const s of i.externals){const d=s.state.path,p="link"===s.schema.type?i.links.get(s.schema):null;let f,h,m=t;const g=d.length?[t]:[],y=d.length?o(e,d):e;if(d.length){f=d[d.length-1];let e=t;for(const t of d.slice(0,-1))e=e[t],g.unshift(e);h=g[0],m=h[f]}try{const e=(e,t)=>(p||s.schema).$_createError(e,m,t,s.state,r),o=await s.method(m,{schema:s.schema,linked:p,state:s.state,prefs:n,original:y,error:e,errorsArray:u.errorsArray,warn:(e,t)=>i.warnings.push((p||s.schema).$_createError(e,m,t,s.state,r)),message:(e,t)=>(p||s.schema).$_createError("external",m,t,s.state,r,{messages:e})});if(void 0===o||o===m)continue;if(o instanceof c.Report){if(i.tracer.log(s.schema,s.state,"rule","external","error"),l.push(o),r.abortEarly)break;continue}if(Array.isArray(o)&&o[a.symbols.errors]){if(i.tracer.log(s.schema,s.state,"rule","external","error"),l.push(...o),r.abortEarly)break;continue}h?(i.tracer.value(s.state,"rule",m,o,"external"),h[f]=o):(i.tracer.value(s.state,"rule",t,o,"external"),t=o)}catch(e){throw r.errors.label&&(e.message+=" (".concat(s.label,")")),e}}if(s.value=t,l.length)throw s.error=c.process(l,e,r),i.debug&&(s.error.debug=i.debug),s.error}if(!r.warnings&&!r.debug&&!r.artifacts)return s.value;const l={value:s.value};return i.warnings.length&&(l.warning=c.details(i.warnings)),i.debug&&(l.debug=i.debug),i.artifacts&&(l.artifacts=i.artifacts),l},u.Mainstay=class{constructor(e,t,n){this.externals=[],this.warnings=[],this.tracer=e,this.debug=t,this.links=n,this.shadow=null,this.artifacts=null,this._snapshots=[]}snapshot(){this._snapshots.push({externals:this.externals.slice(),warnings:this.warnings.slice()})}restore(){const e=this._snapshots.pop();this.externals=e.externals,this.warnings=e.warnings}commit(){this._snapshots.pop()}},u.entry=function(e,n,r){const{tracer:s,cleanup:i}=u.tracer(n,r),o=r.debug?[]:null,a=n._ids._schemaChain?new Map:null,d=new u.Mainstay(s,o,a),p=n._ids._schemaChain?[{schema:n}]:null,f=new l([],[],{mainstay:d,schemas:p}),h=t.validate(e,n,f,r);i&&n.$_root.untrace();const m=c.process(h.errors,e,r);return{value:h.value,error:m,mainstay:d}},u.tracer=function(e,t){return e.$_root._tracer?{tracer:e.$_root._tracer._register(e)}:t.debug?(r(e.$_root.trace,"Debug mode not supported"),{tracer:e.$_root.trace()._register(e),cleanup:!0}):{tracer:u.ignore}},t.validate=function(e,t,n,r,s={}){if(t.$_terms.whens&&(t=t._generate(e,n,r).schema),t._preferences&&(r=u.prefs(t,r)),t._cache&&r.cache){const r=t._cache.get(e);if(n.mainstay.tracer.debug(n,"validate","cached",!!r),r)return r}const i=(s,i,o)=>t.$_createError(s,e,i,o||n,r),o={original:e,prefs:r,schema:t,state:n,error:i,errorsArray:u.errorsArray,warn:(e,t,r)=>n.mainstay.warnings.push(i(e,t,r)),message:(s,i)=>t.$_createError("custom",e,i,n,r,{messages:s})};n.mainstay.tracer.entry(t,n);const c=t._definition;if(c.prepare&&void 0!==e&&r.convert){const t=c.prepare(e,o);if(t){if(n.mainstay.tracer.value(n,"prepare",e,t.value),t.errors)return u.finalize(t.value,[].concat(t.errors),o);e=t.value}}if(c.coerce&&void 0!==e&&r.convert&&(!c.coerce.from||c.coerce.from.includes(typeof e))){const t=c.coerce.method(e,o);if(t){if(n.mainstay.tracer.value(n,"coerced",e,t.value),t.errors)return u.finalize(t.value,[].concat(t.errors),o);e=t.value}}const l=t._flags.empty;l&&l.$_match(u.trim(e,t),n.nest(l),a.defaults)&&(n.mainstay.tracer.value(n,"empty",e,void 0),e=void 0);const d=s.presence||t._flags.presence||(t._flags._endedSwitch?null:r.presence);if(void 0===e){if("forbidden"===d)return u.finalize(e,null,o);if("required"===d)return u.finalize(e,[t.$_createError("any.required",e,null,n,r)],o);if("optional"===d){if(t._flags.default!==a.symbols.deepDefault)return u.finalize(e,null,o);n.mainstay.tracer.value(n,"default",e,{}),e={}}}else if("forbidden"===d)return u.finalize(e,[t.$_createError("any.unknown",e,null,n,r)],o);const p=[];if(t._valids){const s=t._valids.get(e,n,r,t._flags.insensitive);if(s)return r.convert&&(n.mainstay.tracer.value(n,"valids",e,s.value),e=s.value),n.mainstay.tracer.filter(t,n,"valid",s),u.finalize(e,null,o);if(t._flags.only){const s=t.$_createError("any.only",e,{valids:t._valids.values({display:!0})},n,r);if(r.abortEarly)return u.finalize(e,[s],o);p.push(s)}}if(t._invalids){const s=t._invalids.get(e,n,r,t._flags.insensitive);if(s){n.mainstay.tracer.filter(t,n,"invalid",s);const i=t.$_createError("any.invalid",e,{invalids:t._invalids.values({display:!0})},n,r);if(r.abortEarly)return u.finalize(e,[i],o);p.push(i)}}if(c.validate){const t=c.validate(e,o);if(t&&(n.mainstay.tracer.value(n,"base",e,t.value),e=t.value,t.errors)){if(!Array.isArray(t.errors))return p.push(t.errors),u.finalize(e,p,o);if(t.errors.length)return p.push(...t.errors),u.finalize(e,p,o)}}return t._rules.length?u.rules(e,p,o):u.finalize(e,p,o)},u.rules=function(e,t,n){const{schema:r,state:s,prefs:i}=n;for(const o of r._rules){const c=r._definition.rules[o.method];if(c.convert&&i.convert){s.mainstay.tracer.log(r,s,"rule",o.name,"full");continue}let l,d=o.args;if(o._resolve.length){d=Object.assign({},d);for(const t of o._resolve){const n=c.argsByName.get(t),o=d[t].resolve(e,s,i),u=n.normalize?n.normalize(o):o,p=a.validateArg(u,null,n);if(p){l=r.$_createError("any.ref",o,{arg:t,ref:d[t],reason:p},s,i);break}d[t]=u}}l=l||c.validate(e,n,d,o);const p=u.rule(l,o);if(p.errors){if(s.mainstay.tracer.log(r,s,"rule",o.name,"error"),o.warn){s.mainstay.warnings.push(...p.errors);continue}if(i.abortEarly)return u.finalize(e,p.errors,n);t.push(...p.errors)}else s.mainstay.tracer.log(r,s,"rule",o.name,"pass"),s.mainstay.tracer.value(s,"rule",e,p.value,o.name),e=p.value}return u.finalize(e,t,n)},u.rule=function(e,t){return e instanceof c.Report?(u.error(e,t),{errors:[e],value:null}):Array.isArray(e)&&e[a.symbols.errors]?(e.forEach(e=>u.error(e,t)),{errors:e,value:null}):{errors:null,value:e}},u.error=function(e,t){return t.message&&e._setTemplate(t.message),e},u.finalize=function(e,t,n){t=t||[];const{schema:s,state:i,prefs:o}=n;if(t.length){const r=u.default("failover",void 0,t,n);void 0!==r&&(i.mainstay.tracer.value(i,"failover",e,r),e=r,t=[])}if(t.length&&s._flags.error)if("function"==typeof s._flags.error){t=s._flags.error(t),Array.isArray(t)||(t=[t]);for(const e of t)r(e instanceof Error||e instanceof c.Report,"error() must return an Error object")}else t=[s._flags.error];if(void 0===e){const r=u.default("default",e,t,n);i.mainstay.tracer.value(i,"default",e,r),e=r}if(s._flags.cast&&void 0!==e){const t=s._definition.cast[s._flags.cast];if(t.from(e)){const r=t.to(e,n);i.mainstay.tracer.value(i,"cast",e,r,s._flags.cast),e=r}}if(s.$_terms.externals&&o.externals&&!1!==o._externals)for(const{method:e}of s.$_terms.externals)i.mainstay.externals.push({method:e,schema:s,state:i,label:c.label(s._flags,i,o)});const a={value:e,errors:t.length?t:null};return s._flags.result&&(a.value="strip"===s._flags.result?void 0:n.original,i.mainstay.tracer.value(i,s._flags.result,e,a.value),i.shadow(e,s._flags.result)),s._cache&&!1!==o.cache&&!s._refs.length&&s._cache.set(n.original,a),void 0===e||a.errors||void 0===s._flags.artifact||(i.mainstay.artifacts=i.mainstay.artifacts||new Map,i.mainstay.artifacts.has(s._flags.artifact)||i.mainstay.artifacts.set(s._flags.artifact,[]),i.mainstay.artifacts.get(s._flags.artifact).push(i.path)),a},u.prefs=function(e,t){const n=t===a.defaults;return n&&e._preferences[a.symbols.prefs]?e._preferences[a.symbols.prefs]:(t=a.preferences(t,e._preferences),n&&(e._preferences[a.symbols.prefs]=t),t)},u.default=function(e,t,n,r){const{schema:i,state:o,prefs:c}=r,l=i._flags[e];if(c.noDefaults||void 0===l)return t;if(o.mainstay.tracer.log(i,o,"rule",e,"full"),!l)return l;if("function"==typeof l){const t=l.length?[s(o.ancestors[0]),r]:[];try{return l(...t)}catch(t){return void n.push(i.$_createError("any.".concat(e),null,{error:t},o,c))}}return"object"!=typeof l?l:l[a.symbols.literal]?l.literal:a.isResolvable(l)?l.resolve(t,o,c):s(l)},u.trim=function(e,t){if("string"!=typeof e)return e;const n=t.$_getRule("trim");return n&&n.args.enabled?e.trim():e},u.ignore={active:!1,debug:i,entry:i,filter:i,log:i,resolve:i,value:i},u.errorsArray=function(){const e=[];return e[a.symbols.errors]=!0,e}},2036:(e,t,n)=>{const r=n(375),s=n(9474),i=n(8160),o={};e.exports=o.Values=class{constructor(e,t){this._values=new Set(e),this._refs=new Set(t),this._lowercase=o.lowercases(e),this._override=!1}get length(){return this._values.size+this._refs.size}add(e,t){i.isResolvable(e)?this._refs.has(e)||(this._refs.add(e),t&&t.register(e)):this.has(e,null,null,!1)||(this._values.add(e),"string"==typeof e&&this._lowercase.set(e.toLowerCase(),e))}static merge(e,t,n){if(e=e||new o.Values,t){if(t._override)return t.clone();for(const n of[...t._values,...t._refs])e.add(n)}if(n)for(const t of[...n._values,...n._refs])e.remove(t);return e.length?e:null}remove(e){i.isResolvable(e)?this._refs.delete(e):(this._values.delete(e),"string"==typeof e&&this._lowercase.delete(e.toLowerCase()))}has(e,t,n,r){return!!this.get(e,t,n,r)}get(e,t,n,r){if(!this.length)return!1;if(this._values.has(e))return{value:e};if("string"==typeof e&&e&&r){const t=this._lowercase.get(e.toLowerCase());if(t)return{value:t}}if(!this._refs.size&&"object"!=typeof e)return!1;if("object"==typeof e)for(const t of this._values)if(s(t,e))return{value:t};if(t)for(const i of this._refs){const o=i.resolve(e,t,n,null,{in:!0});if(void 0===o)continue;const a=i.in&&"object"==typeof o?Array.isArray(o)?o:Object.keys(o):[o];for(const t of a)if(typeof t==typeof e)if(r&&e&&"string"==typeof e){if(t.toLowerCase()===e.toLowerCase())return{value:t,ref:i}}else if(s(t,e))return{value:t,ref:i}}return!1}override(){this._override=!0}values(e){if(e&&e.display){const e=[];for(const t of[...this._values,...this._refs])void 0!==t&&e.push(t);return e}return Array.from([...this._values,...this._refs])}clone(){const e=new o.Values(this._values,this._refs);return e._override=this._override,e}concat(e){r(!e._override,"Cannot concat override set of values");const t=new o.Values([...this._values,...e._values],[...this._refs,...e._refs]);return t._override=this._override,t}describe(){const e=[];this._override&&e.push({override:!0});for(const t of this._values.values())e.push(t&&"object"==typeof t?{value:t}:t);for(const t of this._refs.values())e.push(t.describe());return e}},o.Values.prototype[i.symbols.values]=!0,o.Values.prototype.slice=o.Values.prototype.clone,o.lowercases=function(e){const t=new Map;if(e)for(const n of e)"string"==typeof n&&t.set(n.toLowerCase(),n);return t}},978:(e,t,n)=>{const r=n(375),s=n(8571),i=n(1687),o=n(9621),a={};e.exports=function(e,t,n={}){if(r(e&&"object"==typeof e,"Invalid defaults value: must be an object"),r(!t||!0===t||"object"==typeof t,"Invalid source value: must be true, falsy or an object"),r("object"==typeof n,"Invalid options: must be an object"),!t)return null;if(n.shallow)return a.applyToDefaultsWithShallow(e,t,n);const o=s(e);if(!0===t)return o;const c=void 0!==n.nullOverride&&n.nullOverride;return i(o,t,{nullOverride:c,mergeArrays:!1})},a.applyToDefaultsWithShallow=function(e,t,n){const c=n.shallow;r(Array.isArray(c),"Invalid keys");const l=new Map,u=!0===t?null:new Set;for(let n of c){n=Array.isArray(n)?n:n.split(".");const r=o(e,n);r&&"object"==typeof r?l.set(r,u&&o(t,n)||r):u&&u.add(n)}const d=s(e,{},l);if(!u)return d;for(const e of u)a.reachCopy(d,t,e);const p=void 0!==n.nullOverride&&n.nullOverride;return i(d,t,{nullOverride:p,mergeArrays:!1})},a.reachCopy=function(e,t,n){for(const e of n){if(!(e in t))return;const n=t[e];if("object"!=typeof n||null===n)return;t=n}const r=t;let s=e;for(let e=0;e<n.length-1;++e){const t=n[e];"object"!=typeof s[t]&&(s[t]={}),s=s[t]}s[n[n.length-1]]=r}},375:(e,t,n)=>{const r=n(7916);e.exports=function(e,...t){if(!e)throw 1===t.length&&t[0]instanceof Error?t[0]:new r(t)}},8571:(e,t,n)=>{const r=n(9621),s=n(4277),i=n(7043),o={needsProtoHack:new Set([s.set,s.map,s.weakSet,s.weakMap])};e.exports=o.clone=function(e,t={},n=null){if("object"!=typeof e||null===e)return e;let r=o.clone,a=n;if(t.shallow){if(!0!==t.shallow)return o.cloneWithShallow(e,t);r=e=>e}else if(a){const t=a.get(e);if(t)return t}else a=new Map;const c=s.getInternalProto(e);if(c===s.buffer)return!1;if(c===s.date)return new Date(e.getTime());if(c===s.regex)return new RegExp(e);const l=o.base(e,c,t);if(l===e)return e;if(a&&a.set(e,l),c===s.set)for(const n of e)l.add(r(n,t,a));else if(c===s.map)for(const[n,s]of e)l.set(n,r(s,t,a));const u=i.keys(e,t);for(const n of u){if("__proto__"===n)continue;if(c===s.array&&"length"===n){l.length=e.length;continue}const i=Object.getOwnPropertyDescriptor(e,n);i?i.get||i.set?Object.defineProperty(l,n,i):i.enumerable?l[n]=r(e[n],t,a):Object.defineProperty(l,n,{enumerable:!1,writable:!0,configurable:!0,value:r(e[n],t,a)}):Object.defineProperty(l,n,{enumerable:!0,writable:!0,configurable:!0,value:r(e[n],t,a)})}return l},o.cloneWithShallow=function(e,t){const n=t.shallow;(t=Object.assign({},t)).shallow=!1;const s=new Map;for(const t of n){const n=r(e,t);"object"!=typeof n&&"function"!=typeof n||s.set(n,n)}return o.clone(e,t,s)},o.base=function(e,t,n){if(!1===n.prototype)return o.needsProtoHack.has(t)?new t.constructor:t===s.array?[]:{};const r=Object.getPrototypeOf(e);if(r&&r.isImmutable)return e;if(t===s.array){const e=[];return r!==t&&Object.setPrototypeOf(e,r),e}if(o.needsProtoHack.has(t)){const e=new r.constructor;return r!==t&&Object.setPrototypeOf(e,r),e}return Object.create(r)}},9474:(e,t,n)=>{const r=n(4277),s={mismatched:null};e.exports=function(e,t,n){return n=Object.assign({prototype:!0},n),!!s.isDeepEqual(e,t,n,[])},s.isDeepEqual=function(e,t,n,i){if(e===t)return 0!==e||1/e==1/t;const o=typeof e;if(o!==typeof t||null===e||null===t)return!1;if("function"===o){if(!n.deepFunction||e.toString()!==t.toString())return!1}else if("object"!==o)return e!=e&&t!=t;const a=s.getSharedType(e,t,!!n.prototype);switch(a){case r.buffer:return!1;case r.promise:return e===t;case r.regex:return e.toString()===t.toString();case s.mismatched:return!1}for(let n=i.length-1;n>=0;--n)if(i[n].isSame(e,t))return!0;i.push(new s.SeenEntry(e,t));try{return!!s.isDeepEqualObj(a,e,t,n,i)}finally{i.pop()}},s.getSharedType=function(e,t,n){if(n)return Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)?s.mismatched:r.getInternalProto(e);const i=r.getInternalProto(e);return i!==r.getInternalProto(t)?s.mismatched:i},s.valueOf=function(e){const t=e.valueOf;if(void 0===t)return e;try{return t.call(e)}catch(e){return e}},s.hasOwnEnumerableProperty=function(e,t){return Object.prototype.propertyIsEnumerable.call(e,t)},s.isSetSimpleEqual=function(e,t){for(const n of Set.prototype.values.call(e))if(!Set.prototype.has.call(t,n))return!1;return!0},s.isDeepEqualObj=function(e,t,n,i,o){const{isDeepEqual:a,valueOf:c,hasOwnEnumerableProperty:l}=s,{keys:u,getOwnPropertySymbols:d}=Object;if(e===r.array){if(!i.part){if(t.length!==n.length)return!1;for(let e=0;e<t.length;++e)if(!a(t[e],n[e],i,o))return!1;return!0}for(const e of t)for(const t of n)if(a(e,t,i,o))return!0}else if(e===r.set){if(t.size!==n.size)return!1;if(!s.isSetSimpleEqual(t,n)){const e=new Set(Set.prototype.values.call(n));for(const n of Set.prototype.values.call(t)){if(e.delete(n))continue;let t=!1;for(const r of e)if(a(n,r,i,o)){e.delete(r),t=!0;break}if(!t)return!1}}}else if(e===r.map){if(t.size!==n.size)return!1;for(const[e,r]of Map.prototype.entries.call(t))if(void 0===r&&!Map.prototype.has.call(n,e)||!a(r,Map.prototype.get.call(n,e),i,o))return!1}else if(e===r.error&&(t.name!==n.name||t.message!==n.message))return!1;const p=c(t),f=c(n);if((t!==p||n!==f)&&!a(p,f,i,o))return!1;const h=u(t);if(!i.part&&h.length!==u(n).length&&!i.skip)return!1;let m=0;for(const e of h)if(i.skip&&i.skip.includes(e))void 0===n[e]&&++m;else if(!l(n,e)||!a(t[e],n[e],i,o))return!1;if(!i.part&&h.length-m!==u(n).length)return!1;if(!1!==i.symbols){const e=d(t),r=new Set(d(n));for(const s of e){if(!i.skip||!i.skip.includes(s))if(l(t,s)){if(!l(n,s)||!a(t[s],n[s],i,o))return!1}else if(l(n,s))return!1;r.delete(s)}for(const e of r)if(l(n,e))return!1}return!0},s.SeenEntry=class{constructor(e,t){this.obj=e,this.ref=t}isSame(e,t){return this.obj===e&&this.ref===t}}},7916:(e,t,n)=>{const r=n(8761);e.exports=class extends Error{constructor(e){super(e.filter(e=>""!==e).map(e=>"string"==typeof e?e:e instanceof Error?e.message:r(e)).join(" ")||"Unknown error"),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,t.assert)}}},5277:e=>{const t={};e.exports=function(e){if(!e)return"";let n="";for(let r=0;r<e.length;++r){const s=e.charCodeAt(r);t.isSafe(s)?n+=e[r]:n+=t.escapeHtmlChar(s)}return n},t.escapeHtmlChar=function(e){return t.namedHtml.get(e)||(e>=256?"&#"+e+";":"&#x".concat(e.toString(16).padStart(2,"0"),";"))},t.isSafe=function(e){return t.safeCharCodes.has(e)},t.namedHtml=new Map([[38,"&amp;"],[60,"&lt;"],[62,"&gt;"],[34,"&quot;"],[160,"&nbsp;"],[162,"&cent;"],[163,"&pound;"],[164,"&curren;"],[169,"&copy;"],[174,"&reg;"]]),t.safeCharCodes=function(){const e=new Set;for(let t=32;t<123;++t)(t>=97||t>=65&&t<=90||t>=48&&t<=57||32===t||46===t||44===t||45===t||58===t||95===t)&&e.add(t);return e}()},6064:e=>{e.exports=function(e){return e.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g,"\\$&")}},738:e=>{e.exports=function(){}},1687:(e,t,n)=>{const r=n(375),s=n(8571),i=n(7043),o={};e.exports=o.merge=function(e,t,n){if(r(e&&"object"==typeof e,"Invalid target value: must be an object"),r(null==t||"object"==typeof t,"Invalid source value: must be null, undefined, or an object"),!t)return e;if(n=Object.assign({nullOverride:!0,mergeArrays:!0},n),Array.isArray(t)){r(Array.isArray(e),"Cannot merge array onto an object"),n.mergeArrays||(e.length=0);for(let r=0;r<t.length;++r)e.push(s(t[r],{symbols:n.symbols}));return e}const a=i.keys(t,n);for(let r=0;r<a.length;++r){const i=a[r];if("__proto__"===i||!Object.prototype.propertyIsEnumerable.call(t,i))continue;const c=t[i];if(c&&"object"==typeof c){if(e[i]===c)continue;!e[i]||"object"!=typeof e[i]||Array.isArray(e[i])!==Array.isArray(c)||c instanceof Date||c instanceof RegExp?e[i]=s(c,{symbols:n.symbols}):o.merge(e[i],c,n)}else(null!=c||n.nullOverride)&&(e[i]=c)}return e}},9621:(e,t,n)=>{const r=n(375),s={};e.exports=function(e,t,n){if(!1===t||null==t)return e;"string"==typeof(n=n||{})&&(n={separator:n});const i=Array.isArray(t);r(!i||!n.separator,"Separator option is not valid for array-based chain");const o=i?t:t.split(n.separator||".");let a=e;for(let e=0;e<o.length;++e){let i=o[e];const c=n.iterables&&s.iterables(a);if(Array.isArray(a)||"set"===c){const e=Number(i);Number.isInteger(e)&&(i=e<0?a.length+e:e)}if(!a||"function"==typeof a&&!1===n.functions||!c&&void 0===a[i]){r(!n.strict||e+1===o.length,"Missing segment",i,"in reach path ",t),r("object"==typeof a||!0===n.functions||"function"!=typeof a,"Invalid segment",i,"in reach path ",t),a=n.default;break}a=c?"set"===c?[...a][i]:a.get(i):a[i]}return a},s.iterables=function(e){return e instanceof Set?"set":e instanceof Map?"map":void 0}},8761:e=>{e.exports=function(...e){try{return JSON.stringify(...e)}catch(e){return"[Cannot display object: "+e.message+"]"}}},4277:(e,t)=>{const n={};t=e.exports={array:Array.prototype,buffer:!1,date:Date.prototype,error:Error.prototype,generic:Object.prototype,map:Map.prototype,promise:Promise.prototype,regex:RegExp.prototype,set:Set.prototype,weakMap:WeakMap.prototype,weakSet:WeakSet.prototype},n.typeMap=new Map([["[object Error]",t.error],["[object Map]",t.map],["[object Promise]",t.promise],["[object Set]",t.set],["[object WeakMap]",t.weakMap],["[object WeakSet]",t.weakSet]]),t.getInternalProto=function(e){if(Array.isArray(e))return t.array;if(e instanceof Date)return t.date;if(e instanceof RegExp)return t.regex;if(e instanceof Error)return t.error;const r=Object.prototype.toString.call(e);return n.typeMap.get(r)||t.generic}},7043:(e,t)=>{t.keys=function(e,t={}){return!1!==t.symbols?Reflect.ownKeys(e):Object.getOwnPropertyNames(e)}},3652:(e,t,n)=>{const r=n(375),s={};t.Sorter=class{constructor(){this._items=[],this.nodes=[]}add(e,t){const n=[].concat((t=t||{}).before||[]),s=[].concat(t.after||[]),i=t.group||"?",o=t.sort||0;r(!n.includes(i),"Item cannot come before itself: ".concat(i)),r(!n.includes("?"),"Item cannot come before unassociated items"),r(!s.includes(i),"Item cannot come after itself: ".concat(i)),r(!s.includes("?"),"Item cannot come after unassociated items"),Array.isArray(e)||(e=[e]);for(const t of e){const e={seq:this._items.length,sort:o,before:n,after:s,group:i,node:t};this._items.push(e)}if(!t.manual){const e=this._sort();r(e,"item","?"!==i?"added into group ".concat(i):"","created a dependencies error")}return this.nodes}merge(e){Array.isArray(e)||(e=[e]);for(const t of e)if(t)for(const e of t._items)this._items.push(Object.assign({},e));this._items.sort(s.mergeSort);for(let e=0;e<this._items.length;++e)this._items[e].seq=e;const t=this._sort();return r(t,"merge created a dependencies error"),this.nodes}sort(){const e=this._sort();return r(e,"sort created a dependencies error"),this.nodes}_sort(){const e={},t=Object.create(null),n=Object.create(null);for(const r of this._items){const s=r.seq,i=r.group;n[i]=n[i]||[],n[i].push(s),e[s]=r.before;for(const e of r.after)t[e]=t[e]||[],t[e].push(s)}for(const t in e){const r=[];for(const s in e[t]){const i=e[t][s];n[i]=n[i]||[],r.push(...n[i])}e[t]=r}for(const r in t)if(n[r])for(const s of n[r])e[s].push(...t[r]);const r={};for(const t in e){const n=e[t];for(const e of n)r[e]=r[e]||[],r[e].push(t)}const s={},i=[];for(let e=0;e<this._items.length;++e){let t=e;if(r[e]){t=null;for(let e=0;e<this._items.length;++e){if(!0===s[e])continue;r[e]||(r[e]=[]);const n=r[e].length;let i=0;for(let t=0;t<n;++t)s[r[e][t]]&&++i;if(i===n){t=e;break}}}null!==t&&(s[t]=!0,i.push(t))}if(i.length!==this._items.length)return!1;const o={};for(const e of this._items)o[e.seq]=e;this._items=[],this.nodes=[];for(const e of i){const t=o[e];this.nodes.push(t.node),this._items.push(t)}return!0}},s.mergeSort=(e,t)=>e.sort===t.sort?0:e.sort<t.sort?-1:1},5380:(e,t,n)=>{const r=n(443),s=n(2178),i={minDomainSegments:2,nonAsciiRx:/[^\x00-\x7f]/,domainControlRx:/[\x00-\x20@\:\/\\#!\$&\'\(\)\*\+,;=\?]/,tldSegmentRx:/^[a-zA-Z](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,domainSegmentRx:/^[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,URL:r.URL||URL};t.analyze=function(e,t={}){if(!e)return s.code("DOMAIN_NON_EMPTY_STRING");if("string"!=typeof e)throw new Error("Invalid input: domain must be a string");if(e.length>256)return s.code("DOMAIN_TOO_LONG");if(i.nonAsciiRx.test(e)){if(!1===t.allowUnicode)return s.code("DOMAIN_INVALID_UNICODE_CHARS");e=e.normalize("NFC")}if(i.domainControlRx.test(e))return s.code("DOMAIN_INVALID_CHARS");e=i.punycode(e),t.allowFullyQualified&&"."===e[e.length-1]&&(e=e.slice(0,-1));const n=t.minDomainSegments||i.minDomainSegments,r=e.split(".");if(r.length<n)return s.code("DOMAIN_SEGMENTS_COUNT");if(t.maxDomainSegments&&r.length>t.maxDomainSegments)return s.code("DOMAIN_SEGMENTS_COUNT_MAX");const o=t.tlds;if(o){const e=r[r.length-1].toLowerCase();if(o.deny&&o.deny.has(e)||o.allow&&!o.allow.has(e))return s.code("DOMAIN_FORBIDDEN_TLDS")}for(let e=0;e<r.length;++e){const t=r[e];if(!t.length)return s.code("DOMAIN_EMPTY_SEGMENT");if(t.length>63)return s.code("DOMAIN_LONG_SEGMENT");if(e<r.length-1){if(!i.domainSegmentRx.test(t))return s.code("DOMAIN_INVALID_CHARS")}else if(!i.tldSegmentRx.test(t))return s.code("DOMAIN_INVALID_TLDS_CHARS")}return null},t.isValid=function(e,n){return!t.analyze(e,n)},i.punycode=function(e){e.includes("%")&&(e=e.replace(/%/g,"%25"));try{return new i.URL("http://".concat(e)).host}catch(t){return e}}},1745:(e,t,n)=>{const r=n(9848),s=n(5380),i=n(2178),o={nonAsciiRx:/[^\x00-\x7f]/,encoder:new(r.TextEncoder||TextEncoder)};t.analyze=function(e,t){return o.email(e,t)},t.isValid=function(e,t){return!o.email(e,t)},o.email=function(e,t={}){if("string"!=typeof e)throw new Error("Invalid input: email must be a string");if(!e)return i.code("EMPTY_STRING");const n=!o.nonAsciiRx.test(e);if(!n){if(!1===t.allowUnicode)return i.code("FORBIDDEN_UNICODE");e=e.normalize("NFC")}const r=e.split("@");if(2!==r.length)return r.length>2?i.code("MULTIPLE_AT_CHAR"):i.code("MISSING_AT_CHAR");const[a,c]=r;if(!a)return i.code("EMPTY_LOCAL");if(!t.ignoreLength){if(e.length>254)return i.code("ADDRESS_TOO_LONG");if(o.encoder.encode(a).length>64)return i.code("LOCAL_TOO_LONG")}return o.local(a,n)||s.analyze(c,t)},o.local=function(e,t){const n=e.split(".");for(const e of n){if(!e.length)return i.code("EMPTY_LOCAL_SEGMENT");if(t){if(!o.atextRx.test(e))return i.code("INVALID_LOCAL_CHARS")}else for(const t of e){if(o.atextRx.test(t))continue;const e=o.binary(t);if(!o.atomRx.test(e))return i.code("INVALID_LOCAL_CHARS")}}},o.binary=function(e){return Array.from(o.encoder.encode(e)).map(e=>String.fromCharCode(e)).join("")},o.atextRx=/^[\w!#\$%&'\*\+\-/=\?\^`\{\|\}~]+$/,o.atomRx=new RegExp(["(?:[\\xc2-\\xdf][\\x80-\\xbf])","(?:\\xe0[\\xa0-\\xbf][\\x80-\\xbf])|(?:[\\xe1-\\xec][\\x80-\\xbf]{2})|(?:\\xed[\\x80-\\x9f][\\x80-\\xbf])|(?:[\\xee-\\xef][\\x80-\\xbf]{2})","(?:\\xf0[\\x90-\\xbf][\\x80-\\xbf]{2})|(?:[\\xf1-\\xf3][\\x80-\\xbf]{3})|(?:\\xf4[\\x80-\\x8f][\\x80-\\xbf]{2})"].join("|"))},2178:(e,t)=>{t.codes={EMPTY_STRING:"Address must be a non-empty string",FORBIDDEN_UNICODE:"Address contains forbidden Unicode characters",MULTIPLE_AT_CHAR:"Address cannot contain more than one @ character",MISSING_AT_CHAR:"Address must contain one @ character",EMPTY_LOCAL:"Address local part cannot be empty",ADDRESS_TOO_LONG:"Address too long",LOCAL_TOO_LONG:"Address local part too long",EMPTY_LOCAL_SEGMENT:"Address local part contains empty dot-separated segment",INVALID_LOCAL_CHARS:"Address local part contains invalid character",DOMAIN_NON_EMPTY_STRING:"Domain must be a non-empty string",DOMAIN_TOO_LONG:"Domain too long",DOMAIN_INVALID_UNICODE_CHARS:"Domain contains forbidden Unicode characters",DOMAIN_INVALID_CHARS:"Domain contains invalid character",DOMAIN_INVALID_TLDS_CHARS:"Domain contains invalid tld character",DOMAIN_SEGMENTS_COUNT:"Domain lacks the minimum required number of segments",DOMAIN_SEGMENTS_COUNT_MAX:"Domain contains too many segments",DOMAIN_FORBIDDEN_TLDS:"Domain uses forbidden TLD",DOMAIN_EMPTY_SEGMENT:"Domain contains empty dot-separated segment",DOMAIN_LONG_SEGMENT:"Domain contains dot-separated segment that is too long"},t.code=function(e){return{code:e,error:t.codes[e]}}},9959:(e,t,n)=>{const r=n(375),s=n(5752);t.regex=function(e={}){r(void 0===e.cidr||"string"==typeof e.cidr,"options.cidr must be a string");const t=e.cidr?e.cidr.toLowerCase():"optional";r(["required","optional","forbidden"].includes(t),"options.cidr must be one of required, optional, forbidden"),r(void 0===e.version||"string"==typeof e.version||Array.isArray(e.version),"options.version must be a string or an array of string");let n=e.version||["ipv4","ipv6","ipvfuture"];Array.isArray(n)||(n=[n]),r(n.length>=1,"options.version must have at least 1 version specified");for(let e=0;e<n.length;++e)r("string"==typeof n[e],"options.version must only contain strings"),n[e]=n[e].toLowerCase(),r(["ipv4","ipv6","ipvfuture"].includes(n[e]),"options.version contains unknown version "+n[e]+" - must be one of ipv4, ipv6, ipvfuture");n=Array.from(new Set(n));const i="(?:".concat(n.map(e=>{if("forbidden"===t)return s.ip[e];const n="\\/".concat("ipv4"===e?s.ip.v4Cidr:s.ip.v6Cidr);return"required"===t?"".concat(s.ip[e]).concat(n):"".concat(s.ip[e],"(?:").concat(n,")?")}).join("|"),")"),o=new RegExp("^".concat(i,"$"));return{cidr:t,versions:n,regex:o,raw:i}}},5752:(e,t,n)=>{const r=n(375),s=n(6064),i={generate:function(){const e={},t="\\dA-Fa-f",n="["+t+"]",r="\\w-\\.~",s="!\\$&'\\(\\)\\*\\+,;=",i="%"+t,o=r+i+s+":@",a="["+o+"]",c="(?:0{0,2}\\d|0?[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])";e.ipv4address="(?:"+c+"\\.){3}"+c;const l=n+"{1,4}",u="(?:"+l+":"+l+"|"+e.ipv4address+")",d="(?:"+l+":){6}"+u,p="::(?:"+l+":){5}"+u,f="(?:"+l+")?::(?:"+l+":){4}"+u,h="(?:(?:"+l+":){0,1}"+l+")?::(?:"+l+":){3}"+u,m="(?:(?:"+l+":){0,2}"+l+")?::(?:"+l+":){2}"+u,g="(?:(?:"+l+":){0,3}"+l+")?::"+l+":"+u,y="(?:(?:"+l+":){0,4}"+l+")?::"+u;e.ipv4Cidr="(?:\\d|[1-2]\\d|3[0-2])",e.ipv6Cidr="(?:0{0,2}\\d|0?[1-9]\\d|1[01]\\d|12[0-8])",e.ipv6address="(?:"+d+"|"+p+"|"+f+"|"+h+"|"+m+"|"+g+"|"+y+"|(?:(?:[\\dA-Fa-f]{1,4}:){0,5}[\\dA-Fa-f]{1,4})?::[\\dA-Fa-f]{1,4}|(?:(?:[\\dA-Fa-f]{1,4}:){0,6}[\\dA-Fa-f]{1,4})?::)",e.ipvFuture="v"+n+"+\\.["+r+s+":]+",e.scheme="[a-zA-Z][a-zA-Z\\d+-\\.]*",e.schemeRegex=new RegExp(e.scheme);const v="["+r+i+s+":]*",w="(?:\\[(?:"+e.ipv6address+"|"+e.ipvFuture+")\\]|"+e.ipv4address+"|[\\w-\\.~%\\dA-Fa-f!\\$&'\\(\\)\\*\\+,;=]{1,255})",_="(?:"+v+"@)?"+w+"(?::\\d*)?",R="(?:"+v+"@)?("+w+")(?::\\d*)?",E=a+"*",I=a+"+",k="(?:\\/"+E+")*",T="\\/(?:"+I+k+")?",L=I+k,A="["+r+i+s+"@]+"+k;return e.hierPart="(?:(?:\\/\\/"+_+k+")|"+T+"|"+L+"|(?:\\/\\/\\/[\\w-\\.~%\\dA-Fa-f!\\$&'\\(\\)\\*\\+,;=:@]*(?:\\/[\\w-\\.~%\\dA-Fa-f!\\$&'\\(\\)\\*\\+,;=:@]*)*))",e.hierPartCapture="(?:(?:\\/\\/"+R+k+")|"+T+"|"+L+")",e.relativeRef="(?:(?:\\/\\/"+_+k+")|"+T+"|"+A+"|)",e.relativeRefCapture="(?:(?:\\/\\/"+R+k+")|"+T+"|"+A+"|)",e.query="["+o+"\\/\\?]*(?=#|$)",e.queryWithSquareBrackets="["+o+"\\[\\]\\/\\?]*(?=#|$)",e.fragment="["+o+"\\/\\?]*",e}};i.rfc3986=i.generate(),t.ip={v4Cidr:i.rfc3986.ipv4Cidr,v6Cidr:i.rfc3986.ipv6Cidr,ipv4:i.rfc3986.ipv4address,ipv6:i.rfc3986.ipv6address,ipvfuture:i.rfc3986.ipvFuture},i.createRegex=function(e){const t=i.rfc3986,n="(?:\\?"+(e.allowQuerySquareBrackets?t.queryWithSquareBrackets:t.query)+")?(?:#"+t.fragment+")?",o=e.domain?t.relativeRefCapture:t.relativeRef;if(e.relativeOnly)return i.wrap(o+n);let a="";if(e.scheme){r(e.scheme instanceof RegExp||"string"==typeof e.scheme||Array.isArray(e.scheme),"scheme must be a RegExp, String, or Array");const n=[].concat(e.scheme);r(n.length>=1,"scheme must have at least 1 scheme specified");const i=[];for(let e=0;e<n.length;++e){const o=n[e];r(o instanceof RegExp||"string"==typeof o,"scheme at position "+e+" must be a RegExp or String"),o instanceof RegExp?i.push(o.source.toString()):(r(t.schemeRegex.test(o),"scheme at position "+e+" must be a valid scheme"),i.push(s(o)))}a=i.join("|")}const c="(?:"+(a?"(?:"+a+")":t.scheme)+":"+(e.domain?t.hierPartCapture:t.hierPart)+")",l=e.allowRelative?"(?:"+c+"|"+o+")":c;return i.wrap(l+n,a)},i.wrap=function(e,t){return{raw:e="(?=.)(?!https?:/(?:$|[^/]))(?!https?:///)(?!https?:[^/])".concat(e),regex:new RegExp("^".concat(e,"$")),scheme:t}},i.uriRegex=i.createRegex({}),t.regex=function(e={}){return e.scheme||e.allowRelative||e.relativeOnly||e.allowQuerySquareBrackets||e.domain?i.createRegex(e):i.uriRegex}},1447:(e,t)=>{const n={operators:["!","^","*","/","%","+","-","<","<=",">",">=","==","!=","&&","||","??"],operatorCharacters:["!","^","*","/","%","+","-","<","=",">","&","|","?"],operatorsOrder:[["^"],["*","/","%"],["+","-"],["<","<=",">",">="],["==","!="],["&&"],["||","??"]],operatorsPrefix:["!","n"],literals:{'"':'"',"`":"`","'":"'","[":"]"},numberRx:/^(?:[0-9]*(\.[0-9]*)?){1}$/,tokenRx:/^[\w\$\#\.\@\:\{\}]+$/,symbol:Symbol("formula"),settings:Symbol("settings")};t.Parser=class{constructor(e,t={}){if(!t[n.settings]&&t.constants)for(const e in t.constants){const n=t.constants[e];if(null!==n&&!["boolean","number","string"].includes(typeof n))throw new Error("Formula constant ".concat(e," contains invalid ").concat(typeof n," value type"))}this.settings=t[n.settings]?t:Object.assign({[n.settings]:!0,constants:{},functions:{}},t),this.single=null,this._parts=null,this._parse(e)}_parse(e){let r=[],s="",i=0,o=!1;const a=e=>{if(i)throw new Error("Formula missing closing parenthesis");const a=r.length?r[r.length-1]:null;if(o||s||e){if(a&&"reference"===a.type&&")"===e)return a.type="function",a.value=this._subFormula(s,a.value),void(s="");if(")"===e){const e=new t.Parser(s,this.settings);r.push({type:"segment",value:e})}else if(o){if("]"===o)return r.push({type:"reference",value:s}),void(s="");r.push({type:"literal",value:s})}else if(n.operatorCharacters.includes(s))a&&"operator"===a.type&&n.operators.includes(a.value+s)?a.value+=s:r.push({type:"operator",value:s});else if(s.match(n.numberRx))r.push({type:"constant",value:parseFloat(s)});else if(void 0!==this.settings.constants[s])r.push({type:"constant",value:this.settings.constants[s]});else{if(!s.match(n.tokenRx))throw new Error("Formula contains invalid token: ".concat(s));r.push({type:"reference",value:s})}s=""}};for(const t of e)o?t===o?(a(),o=!1):s+=t:i?"("===t?(s+=t,++i):")"===t?(--i,i?s+=t:a(t)):s+=t:t in n.literals?o=n.literals[t]:"("===t?(a(),++i):n.operatorCharacters.includes(t)?(a(),s=t,a()):" "!==t?s+=t:a();a(),r=r.map((e,t)=>"operator"!==e.type||"-"!==e.value||t&&"operator"!==r[t-1].type?e:{type:"operator",value:"n"});let c=!1;for(const e of r){if("operator"===e.type){if(n.operatorsPrefix.includes(e.value))continue;if(!c)throw new Error("Formula contains an operator in invalid position");if(!n.operators.includes(e.value))throw new Error("Formula contains an unknown operator ".concat(e.value))}else if(c)throw new Error("Formula missing expected operator");c=!c}if(!c)throw new Error("Formula contains invalid trailing operator");1===r.length&&["reference","literal","constant"].includes(r[0].type)&&(this.single={type:"reference"===r[0].type?"reference":"value",value:r[0].value}),this._parts=r.map(e=>{if("operator"===e.type)return n.operatorsPrefix.includes(e.value)?e:e.value;if("reference"!==e.type)return e.value;if(this.settings.tokenRx&&!this.settings.tokenRx.test(e.value))throw new Error("Formula contains invalid reference ".concat(e.value));return this.settings.reference?this.settings.reference(e.value):n.reference(e.value)})}_subFormula(e,r){const s=this.settings.functions[r];if("function"!=typeof s)throw new Error("Formula contains unknown function ".concat(r));let i=[];if(e){let t="",s=0,o=!1;const a=()=>{if(!t)throw new Error("Formula contains function ".concat(r," with invalid arguments ").concat(e));i.push(t),t=""};for(let r=0;r<e.length;++r){const i=e[r];o?(t+=i,i===o&&(o=!1)):i in n.literals&&!s?(t+=i,o=n.literals[i]):","!==i||s?(t+=i,"("===i?++s:")"===i&&--s):a()}a()}return i=i.map(e=>new t.Parser(e,this.settings)),function(e){const t=[];for(const n of i)t.push(n.evaluate(e));return s.call(e,...t)}}evaluate(e){const t=this._parts.slice();for(let r=t.length-2;r>=0;--r){const s=t[r];if(s&&"operator"===s.type){const i=t[r+1];t.splice(r+1,1);const o=n.evaluate(i,e);t[r]=n.single(s.value,o)}}return n.operatorsOrder.forEach(r=>{for(let s=1;s<t.length-1;)if(r.includes(t[s])){const r=t[s],i=n.evaluate(t[s-1],e),o=n.evaluate(t[s+1],e);t.splice(s,2);const a=n.calculate(r,i,o);t[s-1]=0===a?0:a}else s+=2}),n.evaluate(t[0],e)}},t.Parser.prototype[n.symbol]=!0,n.reference=function(e){return function(t){return t&&void 0!==t[e]?t[e]:null}},n.evaluate=function(e,t){return null===e?null:"function"==typeof e?e(t):e[n.symbol]?e.evaluate(t):e},n.single=function(e,t){if("!"===e)return!t;const n=-t;return 0===n?0:n},n.calculate=function(e,t,r){if("??"===e)return n.exists(t)?t:r;if("string"==typeof t||"string"==typeof r){if("+"===e)return(t=n.exists(t)?t:"")+(n.exists(r)?r:"")}else switch(e){case"^":return Math.pow(t,r);case"*":return t*r;case"/":return t/r;case"%":return t%r;case"+":return t+r;case"-":return t-r}switch(e){case"<":return t<r;case"<=":return t<=r;case">":return t>r;case">=":return t>=r;case"==":return t===r;case"!=":return t!==r;case"&&":return t&&r;case"||":return t||r}return null},n.exists=function(e){return null!=e}},9926:()=>{},5688:()=>{},9708:()=>{},1152:()=>{},443:()=>{},9848:()=>{},5934:e=>{e.exports=JSON.parse('{"version":"17.13.3"}')}},t={},function n(r){var s=t[r];if(void 0!==s)return s.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}(5107);var e,t})}(Is);class bi extends ut{constructor(e,t,n,r){if(super(),ks=n,!t)throw ks.error("Token generator is required to construct this module."),new Error("Token generator is required to construct this module.");this.webRTCPeer=new tt,this.signaling=null,this.autoReconnect=r,this.reconnectionInterval=1e3,this.alreadyDisconnected=!1,this.firstReconnection=!0,this.stopReconnection=!1,this.isReconnecting=!1,this.tokenGenerator=t,this.options=null}getRTCPeerConnection(){return this.webRTCPeer?this.webRTCPeer.getRTCPeer():null}stop(){var e;ks.info("Stopping"),this.webRTCPeer.closeRTCPeer(),null==(e=this.signaling)||e.close(),this.signaling=null,this.stopReconnection=!0,this.webRTCPeer=new tt}isActive(){const e=this.webRTCPeer.getRTCPeerStatus();return ks.info("Broadcast status: ",e||"not_established"),"connected"===e}setReconnect(){this.signaling.on("migrate",()=>this.replaceConnection()),this.autoReconnect&&(this.signaling.on(os,()=>{(this.firstReconnection||!this.alreadyDisconnected)&&(this.firstReconnection=!1,this.reconnect({error:new Error("Signaling error: wsConnectionError")}))}),this.webRTCPeer.on(Yr.connectionStateChange,e=>{Le(e),"connected"===e&&Ce(new Date),("failed"===e||"disconnected"===e&&this.alreadyDisconnected)&&this.firstReconnection?(this.firstReconnection=!1,this.reconnect({error:new Error("Connection state change: RTCPeerConnectionState disconnected")})):"disconnected"===e?(this.alreadyDisconnected=!0,setTimeout(()=>this.reconnect({error:new Error("Connection state change: RTCPeerConnectionState disconnected")}),1500)):this.alreadyDisconnected=!1}))}async reconnect(e){try{ks.info("Attempting to reconnect..."),!this.isActive()&&!this.stopReconnection&&!this.isReconnecting&&(this.stop(),this.emit("reconnect",{timeout:xs(this.reconnectionInterval),error:null!=e&&e.error?null==e?void 0:e.error:new Error("Attempting to reconnect")}),this.isReconnecting=!0,await this.connect(this.options),this.alreadyDisconnected=!1,this.reconnectionInterval=1e3,this.firstReconnection=!0,this.isReconnecting=!1)}catch(e){this.isReconnecting=!1,this.reconnectionInterval=xs(this.reconnectionInterval),ks.error("Reconnection failed, retrying in ".concat(this.reconnectionInterval,"ms. "),e),setTimeout(()=>this.reconnect({error:e}),this.reconnectionInterval)}}}const xs=e=>e<32e3?2*e:e,Ts=window.RTCRtpSender&&!!RTCRtpSender.prototype.createEncodedStreams&&window.RTCRtpReceiver&&!!RTCRtpReceiver.prototype.createEncodedStreams,Cs="RTCRtpScriptTransform"in window,Ls="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO3ZhciBGPXR5cGVvZiBnbG9iYWxUaGlzPCJ1Ij9nbG9iYWxUaGlzOnR5cGVvZiB3aW5kb3c8InUiP3dpbmRvdzp0eXBlb2YgZ2xvYmFsPCJ1Ij9nbG9iYWw6dHlwZW9mIHNlbGY8InUiP3NlbGY6e307ZnVuY3Rpb24gVyhuKXtyZXR1cm4gbiYmbi5fX2VzTW9kdWxlJiZPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwobiwiZGVmYXVsdCIpP24uZGVmYXVsdDpufXZhciBCPXtleHBvcnRzOnt9fTsvKiEKICoganMtbG9nZ2VyIC0gaHR0cDovL2dpdGh1Yi5jb20vam9ubnlyZWV2ZXMvanMtbG9nZ2VyCiAqIEpvbm55IFJlZXZlcywgaHR0cDovL2pvbm55cmVldmVzLmNvLnVrLwogKiBqcy1sb2dnZXIgbWF5IGJlIGZyZWVseSBkaXN0cmlidXRlZCB1bmRlciB0aGUgTUlUIGxpY2Vuc2UuCiAqLyhmdW5jdGlvbihuKXsoZnVuY3Rpb24odCl7dmFyIGU9e307ZS5WRVJTSU9OPSIxLjYuMSI7dmFyIHMscj17fSxvPWZ1bmN0aW9uKGksdSl7cmV0dXJuIGZ1bmN0aW9uKCl7cmV0dXJuIHUuYXBwbHkoaSxhcmd1bWVudHMpfX0sYT1mdW5jdGlvbigpe3ZhciBpPWFyZ3VtZW50cyx1PWlbMF0saCxjO2ZvcihjPTE7YzxpLmxlbmd0aDtjKyspZm9yKGggaW4gaVtjXSkhKGggaW4gdSkmJmlbY10uaGFzT3duUHJvcGVydHkoaCkmJih1W2hdPWlbY11baF0pO3JldHVybiB1fSxkPWZ1bmN0aW9uKGksdSl7cmV0dXJue3ZhbHVlOmksbmFtZTp1fX07ZS5UUkFDRT1kKDEsIlRSQUNFIiksZS5ERUJVRz1kKDIsIkRFQlVHIiksZS5JTkZPPWQoMywiSU5GTyIpLGUuVElNRT1kKDQsIlRJTUUiKSxlLldBUk49ZCg1LCJXQVJOIiksZS5FUlJPUj1kKDgsIkVSUk9SIiksZS5PRkY9ZCg5OSwiT0ZGIik7dmFyIGw9ZnVuY3Rpb24oaSl7dGhpcy5jb250ZXh0PWksdGhpcy5zZXRMZXZlbChpLmZpbHRlckxldmVsKSx0aGlzLmxvZz10aGlzLmluZm99O2wucHJvdG90eXBlPXtzZXRMZXZlbDpmdW5jdGlvbihpKXtpJiYidmFsdWUiaW4gaSYmKHRoaXMuY29udGV4dC5maWx0ZXJMZXZlbD1pKX0sZ2V0TGV2ZWw6ZnVuY3Rpb24oKXtyZXR1cm4gdGhpcy5jb250ZXh0LmZpbHRlckxldmVsfSxlbmFibGVkRm9yOmZ1bmN0aW9uKGkpe3ZhciB1PXRoaXMuY29udGV4dC5maWx0ZXJMZXZlbDtyZXR1cm4gaS52YWx1ZT49dS52YWx1ZX0sdHJhY2U6ZnVuY3Rpb24oKXt0aGlzLmludm9rZShlLlRSQUNFLGFyZ3VtZW50cyl9LGRlYnVnOmZ1bmN0aW9uKCl7dGhpcy5pbnZva2UoZS5ERUJVRyxhcmd1bWVudHMpfSxpbmZvOmZ1bmN0aW9uKCl7dGhpcy5pbnZva2UoZS5JTkZPLGFyZ3VtZW50cyl9LHdhcm46ZnVuY3Rpb24oKXt0aGlzLmludm9rZShlLldBUk4sYXJndW1lbnRzKX0sZXJyb3I6ZnVuY3Rpb24oKXt0aGlzLmludm9rZShlLkVSUk9SLGFyZ3VtZW50cyl9LHRpbWU6ZnVuY3Rpb24oaSl7dHlwZW9mIGk9PSJzdHJpbmciJiZpLmxlbmd0aD4wJiZ0aGlzLmludm9rZShlLlRJTUUsW2ksInN0YXJ0Il0pfSx0aW1lRW5kOmZ1bmN0aW9uKGkpe3R5cGVvZiBpPT0ic3RyaW5nIiYmaS5sZW5ndGg+MCYmdGhpcy5pbnZva2UoZS5USU1FLFtpLCJlbmQiXSl9LGludm9rZTpmdW5jdGlvbihpLHUpe3MmJnRoaXMuZW5hYmxlZEZvcihpKSYmcyh1LGEoe2xldmVsOml9LHRoaXMuY29udGV4dCkpfX07dmFyIGY9bmV3IGwoe2ZpbHRlckxldmVsOmUuT0ZGfSk7KGZ1bmN0aW9uKCl7dmFyIGk9ZTtpLmVuYWJsZWRGb3I9byhmLGYuZW5hYmxlZEZvciksaS50cmFjZT1vKGYsZi50cmFjZSksaS5kZWJ1Zz1vKGYsZi5kZWJ1ZyksaS50aW1lPW8oZixmLnRpbWUpLGkudGltZUVuZD1vKGYsZi50aW1lRW5kKSxpLmluZm89byhmLGYuaW5mbyksaS53YXJuPW8oZixmLndhcm4pLGkuZXJyb3I9byhmLGYuZXJyb3IpLGkubG9nPWkuaW5mb30pKCksZS5zZXRIYW5kbGVyPWZ1bmN0aW9uKGkpe3M9aX0sZS5zZXRMZXZlbD1mdW5jdGlvbihpKXtmLnNldExldmVsKGkpO2Zvcih2YXIgdSBpbiByKXIuaGFzT3duUHJvcGVydHkodSkmJnJbdV0uc2V0TGV2ZWwoaSl9LGUuZ2V0TGV2ZWw9ZnVuY3Rpb24oKXtyZXR1cm4gZi5nZXRMZXZlbCgpfSxlLmdldD1mdW5jdGlvbihpKXtyZXR1cm4gcltpXXx8KHJbaV09bmV3IGwoYSh7bmFtZTppfSxmLmNvbnRleHQpKSl9LGUuY3JlYXRlRGVmYXVsdEhhbmRsZXI9ZnVuY3Rpb24oaSl7aT1pfHx7fSxpLmZvcm1hdHRlcj1pLmZvcm1hdHRlcnx8ZnVuY3Rpb24ocCxfKXtfLm5hbWUmJnAudW5zaGlmdCgiWyIrXy5uYW1lKyJdIil9O3ZhciB1PXt9LGg9ZnVuY3Rpb24oYyxwKXtGdW5jdGlvbi5wcm90b3R5cGUuYXBwbHkuY2FsbChjLGNvbnNvbGUscCl9O3JldHVybiB0eXBlb2YgY29uc29sZT4idSI/ZnVuY3Rpb24oKXt9OmZ1bmN0aW9uKGMscCl7Yz1BcnJheS5wcm90b3R5cGUuc2xpY2UuY2FsbChjKTt2YXIgXz1jb25zb2xlLmxvZyxnO3AubGV2ZWw9PT1lLlRJTUU/KGc9KHAubmFtZT8iWyIrcC5uYW1lKyJdICI6IiIpK2NbMF0sY1sxXT09PSJzdGFydCI/Y29uc29sZS50aW1lP2NvbnNvbGUudGltZShnKTp1W2ddPW5ldyBEYXRlKCkuZ2V0VGltZSgpOmNvbnNvbGUudGltZUVuZD9jb25zb2xlLnRpbWVFbmQoZyk6aChfLFtnKyI6ICIrKG5ldyBEYXRlKCkuZ2V0VGltZSgpLXVbZ10pKyJtcyJdKSk6KHAubGV2ZWw9PT1lLldBUk4mJmNvbnNvbGUud2Fybj9fPWNvbnNvbGUud2FybjpwLmxldmVsPT09ZS5FUlJPUiYmY29uc29sZS5lcnJvcj9fPWNvbnNvbGUuZXJyb3I6cC5sZXZlbD09PWUuSU5GTyYmY29uc29sZS5pbmZvP189Y29uc29sZS5pbmZvOnAubGV2ZWw9PT1lLkRFQlVHJiZjb25zb2xlLmRlYnVnP189Y29uc29sZS5kZWJ1ZzpwLmxldmVsPT09ZS5UUkFDRSYmY29uc29sZS50cmFjZSYmKF89Y29uc29sZS50cmFjZSksaS5mb3JtYXR0ZXIoYyxwKSxoKF8sYykpfX0sZS51c2VEZWZhdWx0cz1mdW5jdGlvbihpKXtlLnNldExldmVsKGkmJmkuZGVmYXVsdExldmVsfHxlLkRFQlVHKSxlLnNldEhhbmRsZXIoZS5jcmVhdGVEZWZhdWx0SGFuZGxlcihpKSl9LGUuc2V0RGVmYXVsdHM9ZS51c2VEZWZhdWx0cyxuLmV4cG9ydHM/bi5leHBvcnRzPWU6KGUuX3ByZXZMb2dnZXI9dC5Mb2dnZXIsZS5ub0NvbmZsaWN0PWZ1bmN0aW9uKCl7cmV0dXJuIHQuTG9nZ2VyPWUuX3ByZXZMb2dnZXIsZX0sdC5Mb2dnZXI9ZSl9KShGKX0pKEIpO3ZhciB6PUIuZXhwb3J0cyxEPVcoeik7Y2xhc3Mgd3tjb25zdHJ1Y3Rvcih0KXt0aGlzLmRhdGE9dCx0aGlzLmJpdE9mZnNldD0wfXJlYWRCaXRzKHQpe2lmKHRoaXMuYml0T2Zmc2V0K3Q+dGhpcy5kYXRhLmxlbmd0aCo4KXRocm93IG5ldyBFcnJvcigiQXR0ZW1wdGVkIHRvIHJlYWQgcGFzdCB0aGUgZW5kIG9mIHRoZSBiaXRzdHJlYW0iKTtsZXQgZT0wO2ZvcihsZXQgcz0wO3M8dDtzKyspe2NvbnN0IHI9TWF0aC5mbG9vcih0aGlzLmJpdE9mZnNldC84KSxvPTctdGhpcy5iaXRPZmZzZXQlOCxhPXRoaXMuZGF0YVtyXT4+byYxO2V8PWE8PHQtMS1zLHRoaXMuYml0T2Zmc2V0Kyt9cmV0dXJuIGV9c2tpcCh0KXt0aGlzLmJpdE9mZnNldCs9dH1yZWFkRXhwR29sb21iVW5zaWduZWQoKXtsZXQgdD0tMTtmb3IobGV0IGU9MDtlPT09MDt0KyspZT10aGlzLnJlYWRCaXRzKDEpO3JldHVybigxPDx0KS0xK3RoaXMucmVhZEJpdHModCl9cmVhZEV4cEdvbG9tYlNpZ25lZCgpe2NvbnN0IHQ9dGhpcy5yZWFkRXhwR29sb21iVW5zaWduZWQoKTtyZXR1cm4gdCUyPT09MD8tKHQvMik6KHQrMSkvMn19Y29uc3QgbT17U0xJQ0VfTk9OX0lEUjoxLFNMSUNFX1BBUlRJVElPTl9BOjIsU0xJQ0VfSURSOjUsU0VJX0gyNjQ6NixTRUlfSDI2NV9QUkVGSVg6MzksU0VJX0gyNjVfU1VGRklYOjQwLFNQU19IMjY0OjcsU1BTX0gyNjU6MzMsUFBTX0gyNjQ6OCxQUFNfSDI2NTozNH0sUj17UElDX1RJTUlORzoxLFVTRVJfREFUQV9VTlJFR0lTVEVSRUQ6NX0sRT17TEVHQUNZOjEsTkVXOjIsVElNRUNPREU6MyxPVEhFUjo0fSxqPSI2ZTljZmQyYS01OTA3LTQ5ZmYtYjM2My04OTc4YTZlODM0MGUiLHE9IjlhMjFmM2JlLTMxZjAtNGI3OC1iMGJlLWM3ZjdkYmI5NzI1MCIsTD0iZDQwZTM4ZWEtZDQxOS00YzYyLTk0ZWQtMjBhYzM3YjRlNGZhIjtjbGFzcyBWe2NvbnN0cnVjdG9yKHQ9IkgyNjQiKXt0aGlzLnNwcz1uZXcgTWFwLHRoaXMucHBzPW5ldyBNYXAsdGhpcy5hY3RpdmVTUFM9bnVsbCx0aGlzLmNvZGVjPXR9Y29sbGVjdFBQUyh0KXt0aGlzLmNvZGVjPT09IkgyNjQiP3RoaXMuY29sbGVjdEgyNjRQUFModCk6dGhpcy5jb2xsZWN0SDI2NVBQUyh0KX1jb2xsZWN0U1BTKHQpe3RoaXMuY29kZWM9PT0iSDI2NCI/dGhpcy5jb2xsZWN0SDI2NFNQUyh0KTp0aGlzLmNvbGxlY3RIMjY1U1BTKHQpfWNvbGxlY3RIMjY0U1BTKHQpe2NvbnN0IGU9bmV3IHcodCkscz1lLnJlYWRCaXRzKDgpLHI9WzEwMCwxMTAsMTIyLDI0NCw0NCw4Myw4NiwxMTgsMTI4LDEzOCwxMzksMTM0LDEzNV07ZS5za2lwKDgpLGUuc2tpcCg4KTtjb25zdCBvPWUucmVhZEV4cEdvbG9tYlVuc2lnbmVkKCk7aWYobz4zMXx8bzwwKXRocm93IG5ldyBFcnJvcigiSW52YWxpZCBzZXFfcGFyYW1ldGVyX3NldF9pZCIpO2lmKHIuaW5jbHVkZXMocykpe2NvbnN0IGw9ZS5yZWFkRXhwR29sb21iVW5zaWduZWQoKTtpZihsPT09MyYmZS5za2lwKDEpLGUucmVhZEV4cEdvbG9tYlVuc2lnbmVkKCksZS5yZWFkRXhwR29sb21iVW5zaWduZWQoKSxlLnNraXAoMSksZS5yZWFkQml0cygxKSl7Y29uc3QgaT1sIT09Mz84OjEyO2ZvcihsZXQgdT0wO3U8aTt1KyspaWYoZS5yZWFkQml0cygxKSl7Y29uc3QgaD11PDY/MTY6NjQ7bGV0IGM9OCxwPTg7Zm9yKGxldCBfPTA7XzxoO18rKyl7aWYocCE9PTApe2NvbnN0IGc9ZS5yZWFkRXhwR29sb21iU2lnbmVkKCk7cD0oYytnKzI1NiklMjU2fWM9cD09PTA/YzpwfX19fWUucmVhZEV4cEdvbG9tYlVuc2lnbmVkKCk7Y29uc3QgYT1lLnJlYWRFeHBHb2xvbWJVbnNpZ25lZCgpO2lmKGE9PT0wKWUucmVhZEV4cEdvbG9tYlVuc2lnbmVkKCk7ZWxzZSBpZihhPT09MSl7ZS5za2lwKDEpLGUucmVhZEV4cEdvbG9tYlNpZ25lZCgpLGUucmVhZEV4cEdvbG9tYlNpZ25lZCgpO2NvbnN0IGw9ZS5yZWFkRXhwR29sb21iVW5zaWduZWQoKTtmb3IobGV0IGY9MDtmPGw7ZisrKWUucmVhZEV4cEdvbG9tYlNpZ25lZCgpfWUucmVhZEV4cEdvbG9tYlVuc2lnbmVkKCksZS5za2lwKDEpLGUucmVhZEV4cEdvbG9tYlVuc2lnbmVkKCksZS5yZWFkRXhwR29sb21iVW5zaWduZWQoKSxlLnJlYWRCaXRzKDEpPT09MCYmZS5za2lwKDEpLGUuc2tpcCgxKSxlLnJlYWRCaXRzKDEpJiYoZS5yZWFkRXhwR29sb21iVW5zaWduZWQoKSxlLnJlYWRFeHBHb2xvbWJVbnNpZ25lZCgpLGUucmVhZEV4cEdvbG9tYlVuc2lnbmVkKCksZS5yZWFkRXhwR29sb21iVW5zaWduZWQoKSk7bGV0IGQ7aWYoZS5yZWFkQml0cygxKSl7bGV0IGY9ZnVuY3Rpb24oYyl7Y29uc3QgcD1jLnJlYWRFeHBHb2xvbWJVbnNpZ25lZCgpO2Muc2tpcCg0KSxjLnNraXAoNCk7Zm9yKGxldCB4PTA7eDw9cDt4KyspYy5yZWFkRXhwR29sb21iVW5zaWduZWQoKSxjLnJlYWRFeHBHb2xvbWJVbnNpZ25lZCgpLGMuc2tpcCgxKTtjLnNraXAoNSk7Y29uc3QgXz1jLnJlYWRCaXRzKDUpLGc9Yy5yZWFkQml0cyg1KSxBPWMucmVhZEJpdHMoNSk7cmV0dXJue2NwYl9yZW1vdmFsX2RlbGF5X2xlbmd0aF9taW51czE6XyxkcGJfb3V0cHV0X2RlbGF5X2xlbmd0aF9taW51czE6Zyx0aW1lX29mZnNldF9sZW5ndGg6QX19O2UucmVhZEJpdHMoMSkmJmUucmVhZEJpdHMoOCk9PT0yNTUmJihlLnNraXAoMTYpLGUuc2tpcCgxNikpLGUucmVhZEJpdHMoMSkmJmUuc2tpcCgxKSxlLnJlYWRCaXRzKDEpJiYoZS5za2lwKDMpLGUuc2tpcCgxKSxlLnJlYWRCaXRzKDEpJiZlLnNraXAoMjQpKSxlLnJlYWRCaXRzKDEpJiYoZS5yZWFkRXhwR29sb21iVW5zaWduZWQoKSxlLnJlYWRFeHBHb2xvbWJVbnNpZ25lZCgpKTtjb25zdCBsPWUucmVhZEJpdHMoMSk/e251bV91bml0c19pbl90aWNrOmUucmVhZEJpdHMoMzIpLHRpbWVfc2NhbGU6ZS5yZWFkQml0cygzMiksZml4ZWRfZnJhbWVfcmF0ZV9mbGFnOmUucmVhZEJpdHMoMSl9OnZvaWQgMCxpPWUucmVhZEJpdHMoMSk/ZihlKTp2b2lkIDAsdT1lLnJlYWRCaXRzKDEpP2YoZSk6dm9pZCAwOyhpfHx1KSYmZS5za2lwKDEpO2NvbnN0IGg9ZS5yZWFkQml0cygxKTtkPXt0aW1pbmdfaW5mbzpsLG5hbF9ocmRfcGFyYW1ldGVyczppLHZjbF9ocmRfcGFyYW1ldGVyczp1LHBpY19zdHJ1Y3RfcHJlc2VudF9mbGFnOmh9fXRoaXMuc3BzLnNldChvLHt2dWlfcGFyYW1ldGVyczpkfSl9Y29sbGVjdEgyNjVTUFModCl7fWNvbGxlY3RIMjY0UFBTKHQpe2NvbnN0IGU9bmV3IHcodCkscz1lLnJlYWRFeHBHb2xvbWJVbnNpZ25lZCgpO2lmKHM+MjU1fHxzPDApdGhyb3cgbmV3IEVycm9yKCJJbnZhbGlkIHBpY19wYXJhbWV0ZXJfc2V0X2lkIik7Y29uc3Qgcj1lLnJlYWRFeHBHb2xvbWJVbnNpZ25lZCgpO3RoaXMucHBzLnNldChzLHtzZXFfcGFyYW1ldGVyX3NldF9pZDpyfSl9Y29sbGVjdEgyNjVQUFModCl7fWZpbmRBY3RpdmVTUFModCl7Y29uc3QgZT1uZXcgdyh0KTtlLnJlYWRFeHBHb2xvbWJVbnNpZ25lZCgpLGUucmVhZEV4cEdvbG9tYlVuc2lnbmVkKCk7Y29uc3Qgcz1lLnJlYWRFeHBHb2xvbWJVbnNpZ25lZCgpLHI9dGhpcy5wcHMuZ2V0KHMpO2lmKHIpe2NvbnN0IG89dGhpcy5zcHMuZ2V0KHIuc2VxX3BhcmFtZXRlcl9zZXRfaWQpO2lmKG8pe3RoaXMuYWN0aXZlU1BTPW87cmV0dXJufX10aHJvdyBuZXcgRXJyb3IoIkNhbm5vdCBmaW5kIHRoZSBhY3RpdmUgU1BTIil9fWNvbnN0IFM9bmV3IFY7ZnVuY3Rpb24gRyhuLHQpe2Zvcig7dDxuLmJ5dGVMZW5ndGgtNDspe2lmKG5bdF09PT0wJiZuW3QrMV09PT0wJiYoblt0KzJdPT09MXx8blt0KzJdPT09MCYmblt0KzNdPT09MSkpcmV0dXJuIHQ7dCs9MX1yZXR1cm4tMX1mdW5jdGlvbiBVKG4pe2NvbnN0IHQ9bmV3IFVpbnQ4QXJyYXkobi5ieXRlTGVuZ3RoKTtsZXQgZT0wLHM9MDtmb3IobGV0IHI9MjtyPG4uYnl0ZUxlbmd0aDtyKyspbltyXT09PTMmJm5bci0xXT09PTAmJm5bci0yXT09PTAmJih0LnNldChuLnN1YmFycmF5KHMsciksZSksZSs9ci1zLHM9cisxKTtyZXR1cm4gczxuLmJ5dGVMZW5ndGgmJnQuc2V0KG4uc3ViYXJyYXkocyksZSksdH1mdW5jdGlvbiBZKG4sdCl7bGV0IGU9MDtjb25zdCBzPXQ9PT0iSDI2NCI/MToyLHI9W107Zm9yKDtlPG4uYnl0ZUxlbmd0aC00Oyl7Y29uc3Qgbz1HKG4sZSk7aWYobz49ZSl7Y29uc3QgYT1uW28rMl09PT0xPzM6NCxkPUcobixvK2Ercyk7aWYoZD5vKXIucHVzaChuLnN1YmFycmF5KG8sZCkpLGU9ZDtlbHNle3IucHVzaChuLnN1YmFycmF5KG8pKTticmVha319ZWxzZSBicmVha31yZXR1cm4gcn1mdW5jdGlvbiBYKG4sdCl7bGV0IGU9ITA7cmV0dXJuIFkobix0KS5maWx0ZXIocz0+e2NvbnN0IHI9c1syXT09PTE/Mzo0LG89dD09PSJIMjY0Ij8xOjIsYT1zW3JdLGQ9dD09PSJIMjY0Ij9hJjMxOmE+PjEmNjM7aWYoZSlzd2l0Y2goZCl7Y2FzZSBtLlBQU19IMjY0OmNhc2UgbS5QUFNfSDI2NTpTLmNvbGxlY3RQUFMoVShzLnN1YmFycmF5KHIrbykpKTticmVhaztjYXNlIG0uU1BTX0gyNjQ6Y2FzZSBtLlNQU19IMjY1OlMuY29sbGVjdFNQUyhVKHMuc3ViYXJyYXkocitvKSkpO2JyZWFrO2Nhc2UgbS5TTElDRV9JRFI6Y2FzZSBtLlNMSUNFX05PTl9JRFI6Y2FzZSBtLlNMSUNFX1BBUlRJVElPTl9BOnRyeXtTLmZpbmRBY3RpdmVTUFMoVShzLnN1YmFycmF5KHIrbykpKSxlPSExfWNhdGNoKGwpe2NvbnNvbGUuaW5mbygiRmFpbGVkIHRvIGZpbmQgYWN0aXZlIFNQUy4gV2lsbCBub3QgYmUgYWJsZSB0byBleHRyYWN0IFBJQyB0aW1pbmcgbWV0YWRhdGEiKX1icmVha31yZXR1cm5bbS5TRUlfSDI2NCxtLlNFSV9IMjY1X1BSRUZJWCxtLlNFSV9IMjY1X1NVRkZJWF0uaW5jbHVkZXMoZCl9KX1mdW5jdGlvbiAkKG4pe2xldCB0PTAsZT0wO2Zvcig7bltlXT09PTI1NTspdCs9MjU1LGUrKzt0Kz1uW2VdLGUrKztsZXQgcz0wO2Zvcig7bltlXT09PTI1NTspcys9MjU1LGUrKztyZXR1cm4gcys9bltlXSxlKysse3R5cGU6dCxjb250ZW50Om4uc3ViYXJyYXkoZSxlK3MpfX1mdW5jdGlvbiBKKG4pe2NvbnN0IHQ9bmV3IFVpbnQ4QXJyYXkoVChxKSksZT1uZXcgVWludDhBcnJheShUKGopKSxzPW5ldyBVaW50OEFycmF5KFQoTCkpO3JldHVybiB0LmV2ZXJ5KChyLG8pPT5yPT09bltvXSk/RS5USU1FQ09ERTplLmV2ZXJ5KChyLG8pPT5yPT09bltvXSk/RS5MRUdBQ1k6cy5ldmVyeSgocixvKT0+cj09PW5bb10pP0UuTkVXOkUuT1RIRVJ9ZnVuY3Rpb24gSyhuLHQpe2xldCBlPTA7bi51dWlkPXQuc3ViYXJyYXkoZSxlKzE2KSxlKz0xNjtjb25zdCBzPUoobi51dWlkKSxyPXQuc3ViYXJyYXkoZSk7c3dpdGNoKHMpe2Nhc2UgRS5MRUdBQ1k6Y2FzZSBFLk9USEVSOm4udW5yZWdpc3RlcmVkPXI7YnJlYWs7Y2FzZSBFLlRJTUVDT0RFOm4udGltZWNvZGU9TyhyKTticmVhaztjYXNlIEUuTkVXOntsZXQgbz0wO2NvbnN0IGE9QyhEYXRlLm5vdygpKS5sZW5ndGgsZD1yLnN1YmFycmF5KG8sYSk7bys9YTtjb25zdCBsPXIuc3ViYXJyYXkobyk7bi50aW1lY29kZT1PKGQpLG4udW5yZWdpc3RlcmVkPWw7YnJlYWt9fX1mdW5jdGlvbiBPKG4pe2NvbnN0IHQ9bi5yZWR1Y2UoKG8sYSk9PihvPDxCaWdJbnQoOCkpK0JpZ0ludChhKSxCaWdJbnQoMCkpLGU9TnVtYmVyKHQpLHM9bmV3IERhdGUoZSk7cmV0dXJuIG5ldyBUZXh0RW5jb2RlcigpLmVuY29kZShzLnRvSVNPU3RyaW5nKCkpfWZ1bmN0aW9uIFoobix0KXt2YXIgZixpLHUsaCxjO2lmKCFTLmFjdGl2ZVNQUyl7Y29uc29sZS53YXJuKCJDYW5ub3QgZmluZCB0aGUgYWN0aXZlIFNQUyIpO3JldHVybn1jb25zdCBlPShmPVMuYWN0aXZlU1BTLnZ1aV9wYXJhbWV0ZXJzLm5hbF9ocmRfcGFyYW1ldGVycykhPW51bGw/ZjpTLmFjdGl2ZVNQUy52dWlfcGFyYW1ldGVycy52Y2xfaHJkX3BhcmFtZXRlcnMscz17Y3BiX2RwYl9kZWxheXNfcHJlc2VudF9mbGFnOmU/MTowLGNwYl9yZW1vdmFsX2RlbGF5X2xlbmd0aF9taW51czE6KGk9ZT09bnVsbD92b2lkIDA6ZS5jcGJfcmVtb3ZhbF9kZWxheV9sZW5ndGhfbWludXMxKSE9bnVsbD9pOjIzLGRwYl9vdXRwdXRfZGVsYXlfbGVuZ3RoX21pbnVzMToodT1lPT1udWxsP3ZvaWQgMDplLmRwYl9vdXRwdXRfZGVsYXlfbGVuZ3RoX21pbnVzMSkhPW51bGw/dToyMyx0aW1lX29mZnNldF9sZW5ndGg6ZT8oaD1lLnRpbWVfb2Zmc2V0X2xlbmd0aCkhPW51bGw/aDoyNDp2b2lkIDAscGljX3N0cnVjdF9wcmVzZW50X2ZsYWc6KGM9Uy5hY3RpdmVTUFMudnVpX3BhcmFtZXRlcnMucGljX3N0cnVjdF9wcmVzZW50X2ZsYWcpIT1udWxsP2M6MH07aWYoIXMucGljX3N0cnVjdF9wcmVzZW50X2ZsYWcpe2NvbnNvbGUud2FybigicGljX3N0cnVjdF9wcmVzZW50X2ZsYWcgaXMgbm90IHByZXNlbnQiKTtyZXR1cm59Y29uc3Qgcj1uZXcgdyh0KTtzLmNwYl9kcGJfZGVsYXlzX3ByZXNlbnRfZmxhZyYmKHIuc2tpcChzLmNwYl9yZW1vdmFsX2RlbGF5X2xlbmd0aF9taW51czErMSksci5za2lwKHMuZHBiX291dHB1dF9kZWxheV9sZW5ndGhfbWludXMxKzEpKTtjb25zdCBvPVsxLDEsMSwyLDIsMywzLDIsM10sYT1yLnJlYWRCaXRzKDQpO2lmKGE+PW8ubGVuZ3RoKXRocm93IG5ldyBFcnJvcigiSW52YWxpZCBwaWNfc3RydWN0Iik7Y29uc3QgZD1vW2FdLGw9W107Zm9yKGxldCBwPTA7cDxkO3ArKylpZihyLnJlYWRCaXRzKDEpKXtjb25zdCBnPXt9O3Iuc2tpcCgyKSxyLnNraXAoMSksci5za2lwKDUpO2NvbnN0IEE9ci5yZWFkQml0cygxKTtpZihyLnNraXAoMiksZy5uX2ZyYW1lcz1yLnJlYWRCaXRzKDgpLEE/KGcuc2Vjb25kc192YWx1ZT1yLnJlYWRCaXRzKDYpLGcubWludXRlc192YWx1ZT1yLnJlYWRCaXRzKDYpLGcuaG91cnNfdmFsdWU9ci5yZWFkQml0cyg1KSk6ci5yZWFkQml0cygxKSYmKGcuc2Vjb25kc192YWx1ZT1yLnJlYWRCaXRzKDYpLHIucmVhZEJpdHMoMSkmJihnLm1pbnV0ZXNfdmFsdWU9ci5yZWFkQml0cyg2KSxyLnJlYWRCaXRzKDEpJiYoZy5ob3Vyc192YWx1ZT1yLnJlYWRCaXRzKDUpKSkpLHMudGltZV9vZmZzZXRfbGVuZ3RoKXRyeXtnLnRpbWVfb2Zmc2V0PXIucmVhZEJpdHMocy50aW1lX29mZnNldF9sZW5ndGgpfWNhdGNoKHgpe2NvbnNvbGUuZXJyb3IoIkZhaWxlZCB0byByZWFkIHRpbWVfb2Zmc2V0Iix4KSxnLnRpbWVfb2Zmc2V0PTB9ZWxzZSBnLnRpbWVfb2Zmc2V0PTA7bC5wdXNoKGcpfW4uc2VpUGljVGltaW5nVGltZUNvZGVBcnJheT1sfWZ1bmN0aW9uIFEobix0KXtpZih0IT09IkgyNjQiJiZ0IT09IkgyNjUiKXRocm93IG5ldyBFcnJvcigiVW5zdXBwb3J0ZWQgY29kZWMgIi5jb25jYXQodCkpO2NvbnN0IGU9e307cmV0dXJuIFMuY29kZWM9dCxYKG5ldyBVaW50OEFycmF5KG4uZGF0YSksdCkuZm9yRWFjaChzPT57Y29uc3Qgcj1zWzJdPT09MT8zOjQsbz10PT09IkgyNjQiPzE6MixhPVUocy5zdWJhcnJheShyK28pKSxkPSQoYSk7c3dpdGNoKGQudHlwZSl7Y2FzZSBSLlBJQ19USU1JTkc6WihlLGQuY29udGVudCk7YnJlYWs7Y2FzZSBSLlVTRVJfREFUQV9VTlJFR0lTVEVSRUQ6SyhlLGQuY29udGVudCk7YnJlYWt9fSksZX1mdW5jdGlvbiBlZShuKXtyZXR1cm4vXlswLTlhLWZBLUZdezh9LVswLTlhLWZBLUZdezR9LVswLTlhLWZBLUZdezR9LVswLTlhLWZBLUZdezR9LVswLTlhLWZBLUZdezEyfSQvLnRlc3Qobil9ZnVuY3Rpb24gVChuKXtyZXR1cm4gbi5yZXBsYWNlKC8tL2csIiIpLm1hdGNoKC8uezEsMn0vZykubWFwKHQ9PnBhcnNlSW50KHQsMTYpKX1mdW5jdGlvbiB0ZShuLHQsZSl7Y29uc3Qgcz1uZXcgVWludDhBcnJheShUKG4pKSxyPUMoZSksbz1uZXcgVGV4dEVuY29kZXIoKS5lbmNvZGUoSlNPTi5zdHJpbmdpZnkodCkpLGE9bmV3IFVpbnQ4QXJyYXkocy5sZW5ndGgrci5sZW5ndGgrby5sZW5ndGgpO3JldHVybiBhLnNldChzKSxhLnNldChyLHMubGVuZ3RoKSxhLnNldChvLHIubGVuZ3RoK3MubGVuZ3RoKSxhfWZ1bmN0aW9uIG5lKG4pe2NvbnN0IHQ9W10sZT1NYXRoLmZsb29yKG4uYnl0ZUxlbmd0aC8yNTUpLHM9bi5ieXRlTGVuZ3RoJTI1NTtmb3IobGV0IHI9MDtyPGU7cisrKXQucHVzaCgyNTUpO3JldHVybiB0LnB1c2gocyksbmV3IFVpbnQ4QXJyYXkoWzUsLi4udF0pfWZ1bmN0aW9uIHJlKG4pe2NvbnN0IHQ9W107Zm9yKGxldCBlPTA7ZTxuLmJ5dGVMZW5ndGg7ZSsrKWUrMjxuLmJ5dGVMZW5ndGgmJlswLDEsMiwzXS5pbmNsdWRlcyhuW2UrMl0pJiZuW2VdPT09MCYmbltlKzFdPT09MD8odC5wdXNoKG5bZV0pLHQucHVzaChuW2UrMV0pLGUrPTIsdC5wdXNoKDMpKTp0LnB1c2gobltlXSk7cmV0dXJuIHQucHVzaCgxMjgpLG5ldyBVaW50OEFycmF5KHQpfWZ1bmN0aW9uIEMobil7Y29uc3QgdD1bXTtpZighaXNOYU4obikpe2NvbnN0IGU9QmlnSW50KG4pO2ZvcihsZXQgcz0wO3M8TWF0aC5jZWlsKE1hdGguZmxvb3IoTWF0aC5sb2cyKG5ldyBOdW1iZXIobikpKzEpLzgpO3MrKyl0LnVuc2hpZnQobmV3IE51bWJlcihlPj5CaWdJbnQoOCpzKSZCaWdJbnQoMjU1KSkpfXJldHVybiBuZXcgVWludDhBcnJheSh0KX1mdW5jdGlvbiBzZSh7dXVpZDpuLHBheWxvYWQ6dCx0aW1lY29kZTplfSl7Y29uc3Qgcz1bMCwwLDAsMV0scj1bMTAyXSxvPXRlKG4sdCxlKSxhPW5lKG8pLGQ9cmUobyksbD1uZXcgVWludDhBcnJheShzLmxlbmd0aCtyLmxlbmd0aCthLmxlbmd0aCtkLmxlbmd0aCk7cmV0dXJuIGwuc2V0KHMpLGwuc2V0KHIscy5sZW5ndGgpLGwuc2V0KGEscy5sZW5ndGgrci5sZW5ndGgpLGwuc2V0KGQscy5sZW5ndGgrci5sZW5ndGgrYS5sZW5ndGgpLGx9ZnVuY3Rpb24gaWUoe3V1aWQ6bixwYXlsb2FkOnQsdGltZWNvZGU6ZX0scyl7aWYobj09PSIifHx0PT09IiIpdGhyb3cgbmV3IEVycm9yKCJ1dWlkIGFuZCBwYXlsb2FkIGNhbm5vdCBiZSBlbXB0eSIpO2VlKG4pfHwoY29uc29sZS53YXJuKCJJbnZhbGlkIFVVSUQuIFVzaW5nIGRlZmF1bHQgVVVJRC4iKSxuPUwsZT1EYXRlLm5vdygpKTtjb25zdCByPXNlKHt1dWlkOm4scGF5bG9hZDp0LHRpbWVjb2RlOmV9KSxvPW5ldyBEYXRhVmlldyhzLmRhdGEpLGE9bmV3IEFycmF5QnVmZmVyKHMuZGF0YS5ieXRlTGVuZ3RoK3IuYnl0ZUxlbmd0aCksZD1uZXcgRGF0YVZpZXcoYSk7Zm9yKGxldCBsPTA7bDxzLmRhdGEuYnl0ZUxlbmd0aDtsKyspZC5zZXRVaW50OChsLG8uZ2V0VWludDgobCkpO2ZvcihsZXQgbD0wO2w8ci5ieXRlTGVuZ3RoO2wrKylkLnNldFVpbnQ4KHMuZGF0YS5ieXRlTGVuZ3RoK2wscltsXSk7cy5kYXRhPWF9RC5nZXQoIlRyYW5zZm9ybVdvcmtlciIpLnNldExldmVsKEQuREVCVUcpO2NvbnN0IG9lPTJlMyxiPVtdO2xldCB5PSIiLFA9e307Y29uc3Qgdj17fTtsZXQgST1bXTtmdW5jdGlvbiBIKG4pe3JldHVybiBuZXcgVHJhbnNmb3JtU3RyZWFtKHtzdGFydCgpe30sZmx1c2goKXt9LGFzeW5jIHRyYW5zZm9ybSh0LGUpe3ZhciBzLHI7aWYodCBpbnN0YW5jZW9mIFJUQ0VuY29kZWRWaWRlb0ZyYW1lKXtjb25zdCBvPSgocz1QW3QuZ2V0TWV0YWRhdGEoKS5wYXlsb2FkVHlwZV0pPT1udWxsP3ZvaWQgMDpzLnRvVXBwZXJDYXNlKCkpfHwoeT09bnVsbD92b2lkIDA6eS50b1VwcGVyQ2FzZSgpKTtpZihvPT09IkgyNjQiKXtjb25zdCBhPVEodCxvKTsoYS50aW1lY29kZXx8YS51bnJlZ2lzdGVyZWR8fCgocj1hLnNlaVBpY1RpbWluZ1RpbWVDb2RlQXJyYXkpPT1udWxsP3ZvaWQgMDpyLmxlbmd0aCk+MCkmJnNlbGYucG9zdE1lc3NhZ2Uoe2V2ZW50OiJtZXRhZGF0YSIsbWlkOm4sbWV0YWRhdGE6YX0pfXNlbGYucG9zdE1lc3NhZ2Uoe2V2ZW50OiJjb21wbGV0ZSIsZnJhbWU6e3R5cGU6dC50eXBlLHRpbWVzdGFtcDp0LnRpbWVzdGFtcCxkYXRhOnQuZGF0YX19KX1lLmVucXVldWUodCl9fSl9ZnVuY3Rpb24gTSgpe09iamVjdC5rZXlzKHYpLnNvcnQoKS5qb2luKCk9PT1JLnNvcnQoKS5qb2luKCkmJihiLnNoaWZ0KCksST1bXSl9ZnVuY3Rpb24gYWUobil7Y29uc3QgdD1uZXcgRGF0ZSgpLmdldFRpbWUoKTt2W25dPXQsT2JqZWN0LmtleXModikuZmlsdGVyKHM9PnQtdltzXT5vZSkuZm9yRWFjaChzPT57ZGVsZXRlIHZbc10sZGVsZXRlIElbc119KSxNKCl9ZnVuY3Rpb24gTigpe3JldHVybiBuZXcgVHJhbnNmb3JtU3RyZWFtKHtzdGFydCgpe30sZmx1c2goKXt9LGFzeW5jIHRyYW5zZm9ybShuLHQpe2lmKG4gaW5zdGFuY2VvZiBSVENFbmNvZGVkVmlkZW9GcmFtZSl7Y29uc3Qgcz1uLmdldE1ldGFkYXRhKCkuc3luY2hyb25pemF0aW9uU291cmNlO2lmKGFlKHMpLCFJLmluY2x1ZGVzKHMpJiZiLmxlbmd0aCl0cnl7aWYoIS8oaDI2WzRdKS8udGVzdCh5KSl0aHJvdyBuZXcgRXJyb3IoIlNlbmRpbmcgbWV0YWRhdGEgaXMgbm90IHN1cHBvcnRlZCB3aXRoIGFueSBvdGhlciBjb2RlYyBvdGhlciB0aGFuIEguMjY0Iik7YlswXS51dWlkPT09TCYmKGJbMF0udGltZWNvZGU9RGF0ZS5ub3coKSksaWUoYlswXSxuKSxJLnB1c2gocyl9Y2F0Y2gocil7Y29uc29sZS5lcnJvcihyKX1maW5hbGx5e00oKX19dC5lbnF1ZXVlKG4pfX0pfWZ1bmN0aW9uIGsoe3JlYWRhYmxlOm4sd3JpdGFibGU6dH0sZSl7bi5waXBlVGhyb3VnaChlKS5waXBlVG8odCl9YWRkRXZlbnRMaXN0ZW5lcigicnRjdHJhbnNmb3JtIixuPT57bGV0IHQ7aWYobi50cmFuc2Zvcm1lci5vcHRpb25zLm5hbWU9PT0ic2VuZGVyVHJhbnNmb3JtIil5PW4udHJhbnNmb3JtZXIub3B0aW9ucy5jb2RlYyx0PU4oKTtlbHNlIGlmKG4udHJhbnNmb3JtZXIub3B0aW9ucy5uYW1lPT09InJlY2VpdmVyVHJhbnNmb3JtIilQPW4udHJhbnNmb3JtZXIub3B0aW9ucy5wYXlsb2FkVHlwZUNvZGVjfHx7fSx5PW4udHJhbnNmb3JtZXIub3B0aW9ucy5jb2RlY3x8IiIsdD1IKG4udHJhbnNmb3JtZXIub3B0aW9ucy5taWQpO2Vsc2UgcmV0dXJuO2sobi50cmFuc2Zvcm1lcix0KX0pLGFkZEV2ZW50TGlzdGVuZXIoIm1lc3NhZ2UiLG49Pntjb25zdHthY3Rpb246dH09bi5kYXRhO3N3aXRjaCh0KXtjYXNlImluc2VydGFibGUtc3RyZWFtcy1zZW5kZXIiOnk9bi5kYXRhLmNvZGVjLGsobi5kYXRhLE4oKSk7YnJlYWs7Y2FzZSJpbnNlcnRhYmxlLXN0cmVhbXMtcmVjZWl2ZXIiOlA9bi5kYXRhLnBheWxvYWRUeXBlQ29kZWN8fHt9LHk9bi5kYXRhLmNvZGVjfHwiIixrKG4uZGF0YSxIKG4uZGF0YS5taWQpKTticmVhaztjYXNlIm1ldGFkYXRhLXNlaS11c2VyLWRhdGEtdW5yZWdpc3RlcmVkIjpiLnB1c2goe3V1aWQ6bi5kYXRhLnV1aWQscGF5bG9hZDpuLmRhdGEucGF5bG9hZH0pO2JyZWFrfX0pfSkoKTsK",As=typeof self<"u"&&self.Blob&&new Blob([(e=>Uint8Array.from(atob(e),e=>e.charCodeAt(0)))(Ls)],{type:"text/javascript;charset=utf-8"});function Os(e){let t;try{if(t=As&&(self.URL||self.webkitURL).createObjectURL(As),!t)throw"";const n=new Worker(t,{name:null==e?void 0:e.name});return n.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch(t){return new Worker("data:text/javascript;base64,"+Ls,{name:null==e?void 0:e.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}function Ps(e){if(!e)return new Uint8Array;const t=e.length,n=new Uint8Array(t/2);for(let r=0;r<t;r+=2)n[r/2]=parseInt(e.substr(r,2),16);return n}function Ns(e,t,n){if(Object.prototype.hasOwnProperty.call(e,n)&&Object.prototype.hasOwnProperty.call(t,n)){const r=e[n];e[n]=t[n],t[n]=r}else console.error('One or both objects do not have the property "'.concat(n,'"'))}function Ds(e,t,n,r){return new(n||(n=Promise))((function(s,i){function o(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))}Be.get("Publish");const Ms=Fs;function Fs(e,t){const n=qs();return(Fs=function(e,t){return n[e-=257]})(e,t)}var js;!function(){const e=Fs,t=qs();for(;;)try{if(parseInt(e(266))/1*(-parseInt(e(261))/2)+parseInt(e(258))/3*(-parseInt(e(264))/4)+-parseInt(e(267))/5*(parseInt(e(274))/6)+parseInt(e(260))/7*(parseInt(e(268))/8)+parseInt(e(270))/9+-parseInt(e(277))/10+parseInt(e(263))/11==303379)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();const Ws=navigator&&navigator[Ms(276)]||"",Zs=navigator&&navigator.vendor||"",Vs=!(null==window||!window[Ms(273)]),Xs=Ws[Ms(278)](Ms(257)),zs=!Xs&&Zs[Ms(278)](Ms(259)),Ks=!Xs&&!zs&&Ws.includes(Ms(272)),Hs=!Xs&&!zs&&!Ks&&Ws[Ms(278)](Ms(275)),Qs=(null===(js=null==navigator?void 0:navigator[Ms(262)])||void 0===js?void 0:js[Ms(271)])||(null==navigator?void 0:navigator[Ms(271)])||"";function qs(){const e=["2403660vsbxKa","includes","Firefox","653511krAkNS","Apple","63eEorAu","2iQvmqu","userAgentData","13393182jRLBxS","4fTXBZP","Win32","74923SyWRbn","1345hVdNEb","21688LwGppn","Windows","132498ZoOcLo","platform","Edg","RTCRtpScriptTransform","9372dNMWWf","Chrome","userAgent"];return(qs=function(){return e})()}const si={supportsRtpScriptTransform:Vs,isFirefox:Xs,isSafari:zs,isEdge:Ks,isChrome:Hs,platform:Qs,isWindows:Qs===Ms(269)||Qs===Ms(265)},ii=oi;function oi(e,t){const n=hi();return(oi=function(e,t){return n[e-=185]})(e,t)}!function(){const e=oi,t=hi();for(;;)try{if(-parseInt(e(380))/1+-parseInt(e(354))/2+-parseInt(e(464))/3*(parseInt(e(486))/4)+-parseInt(e(253))/5+parseInt(e(377))/6+parseInt(e(321))/7*(-parseInt(e(285))/8)+-parseInt(e(444))/9*(-parseInt(e(279))/10)==657542)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();const li=si[ii(496)];function pi(e,t){const n=ii;let r=new Uint8Array((0|e.byteLength)+(0|t[n(442)]));return r[n(311)](e,0),r[n(311)](t,0|e.byteLength),r}function hi(){const e=["[MSE] source buffer error","ManagedMediaSource","BYTES_PER_ELEMENT","types","ready","valid","Num frames in chunk: ","readBits","getTrackID","mvhd","parsePPS","encrypted","dependsOn","payload","len","moov","VMHD","mse","volume","h264","setUint16","tfdt","nextDts","avc1.","audioSampleAuxInfo","message","endMSE","width","hdlr","warn","traf","readBoolean","shift","mseReady","revokeObjectURL","smhd","dts","indexOf","<PROTECTINFO>","webkitsourceclose","onMSEClose","[H264Parser] IDR without SPS/PPS, not suitable for recovery",'VALUE="',"createObjectURL","</KID>","mdhd","SMHD","getFramePayload","tkhd","flush","clRtcDrmDebugLog","getBits","2598770DahMdb","dbgQueue","dispatch","DINF","http://schemas.microsoft.com/DRM/2007/03/PlayReadyHeader","isReady","sps","nalus","endOfStream","toString","UNKNOWN","Opus","minf","onError","stco","STSC","buffered","</KIDS>","initSegment","dinf","org.w3.clearkey","mp4track","keyFrame","units","mseEnded","videoSampleAuxInfo","41695210Plpuuo","splice","ended","bitLength","seq","url","8YyaFaO","com.apple.fps","[MSE] error: ","bitsAvailable","</WRMHEADER>","trex","setData","buffer error","slice","length","readUByte","mp4a","Unsupported DRM type ","mdia","fromCharCode",'<WRMHEADER xmlns="',"index","string","both","NDR","dOps","cenc","getPayload","bind","PPS","sourceBuffer","set","Checking codec","releaseBuffer","tenc","trak","flags",'/mp4; codecs="',"[H264Parser] Both IDR and non-IDR VCL NALUs found in the same frame","clRtcDrmCreateMediaDump","STSD","6352549TgZLxu","initBrowser","IDR","trun"," - ","start","mediaSource","startsWith","stype","readSPS","addEventListener","schi","encv","createElement","getVideoFrames","onReady","href","sourceopen","setUint32","vmhd","FTYP","schm","getData","toISOString","remuxer","track","skipScalingList","STSZ","getSize","addSourceBuffer","[MSE] buffer error:","appendBufferError","off","2392886zJoPkf","destroy","sdtp","audiosamplerate",": NRI: ","reportDiscontinuity","extractNALUs","No A/V data","pps","senc","saio","concat","config","ftyp","parseNAL","esds","error","feed","Browser does not support codec","4.3.0.0","skipUEG","mp4","end","2232924PKvVOf","updating","options","227868XbMqAn","prototype","createBuffer","info","MediaSource","timestamp","mvex","isfmb","opus","max","stsz","POSITIVE_INFINITY","saiz","timescale","call","encryption","height","jmuxer","bufferControllers","open","patchSampleAuxinfo","queue","stsd","onBufferError","frameCounter","ntype","remux","getPayloadSize","isSupported","</LA_URL>","waitingForIdr","box","idr"," samples - expected 1","tracks","stbl","getNri",'<KID ALGID="AESCTR" ',"download","readUInt","join","com.microsoft.playready.recommendation",'" version="',"remuxController","Received ","frma","resetTrack","disableRemotePlayback","</DATA>","mfhd","pssh","charCodeAt","drm","mediaDuration","video","readyToDecode","from","SPS","skipLZ","data","keySystem","[MSE] sourceclose","byteLength","STTS","9mESMVl","Buffered range ","samples","byteOffset","parseHeader","codec","node","audio","Failure: Browser doesn't support MSE/MMS","subarray","replaceAll","downloadToFile","onBuffer","skipBits","mdat","isKeyframe","moof","mode","push","STCO","9ffcUcC","listener","isReset","map","enca","type","<LA_URL>","parseSPS","getElementById","no video element were found to render, provide a valid video element","sinf","doAppend","HDLR_TYPES","videoElement","stts","keyId","trackTypes","TYPES","remove","size","AUD","src","1376748eVkTXq","min","tfhd","initialized","offAll","appendBuffer","buffer","nri","skipEG","isvcl","isSafari","isTypeSupported","readyState","abort","apply","reduce","assign","calculateExpectedSizeFromSai","duration","generatePlayReadyHeader","readUEG","onMSEOpen","sampleAuxInfo","SEI","irrecoverableError","channelCount","saiIvSize","stsc"];return(hi=function(){return e})()}function gi(e,t=0,n=1/0){return((e,t,n,r)=>{const s=ii,i=r[s(203)]||1;t*=i,n*=i;const o=(l=e)instanceof ArrayBuffer?l:l[ii(492)],a=(e[s(447)]||0)+e[s(442)],c=(e[s(447)]||0)+t;var l;let u=Math[s(389)](0,Math[s(487)](c,a)),d=Math[s(487)](u+Math[s(389)](n,0),a);return u/=i,d/=i,new r(o,u,d-u)})(e,t,n,Uint8Array)}function yi(e){const t=ii,n=Array[t(436)](e)[t(467)](e=>e[t(431)](0));return new Uint8Array(n)}window[ii(455)]=(e,t,n="application/octet-stream")=>{const r=ii,s=document[r(334)]("a"),i=new Blob([e],{type:n});s[r(337)]=URL[r(244)](i),s[r(418)]=t,s.click(),URL[r(235)](s[r(337)])};class ce{static get[ii(304)](){return 1}static get[ii(323)](){return 5}static get[ii(196)](){return 6}static get SPS(){return 7}static get PPS(){return 8}static get[ii(484)](){return 9}static get[ii(481)](){const e=ii;return{[ce[e(323)]]:e(323),[ce.SEI]:e(196),[ce.SPS]:e(437),[ce[e(309)]]:e(309),[ce[e(304)]]:e(304),[ce[e(484)]]:e(484)}}static type(e){const t=ii;return e[t(405)]in ce[t(481)]?ce[t(481)][e[t(405)]]:t(263)}constructor(e){const t=ii;this.payload=e,this[t(493)]=(96&this.payload[0])>>5,this[t(405)]=31&this[t(214)][0],this[t(495)]=1==this.ntype||5==this[t(405)],this[t(329)]="",this[t(387)]=!1}toString(){const e=ii;return ce[e(469)](this)+e(358)+this[e(416)]()}getNri(){return this[ii(493)]}[ii(469)](){return this[ii(405)]}[ii(459)](){const e=ii;return this[e(405)]===ce[e(323)]}[ii(307)](){return this[ii(214)]}[ii(407)](){const e=ii;return this[e(214)][e(442)]}getSize(){return 4+this[ii(407)]()}[ii(343)](){const e=ii,t=new Uint8Array(this.getSize());return new DataView(t.buffer)[e(339)](0,this.getSize()-4),t[e(311)](this[e(307)](),4),t}}class ps{constructor(e){const t=ii;this[t(439)]=e,this[t(301)]=0,this.bitLength=8*e[t(442)]}[ii(291)](e){const t=ii;this.data=e,this[t(301)]=0,this[t(282)]=8*e[t(442)]}get[ii(288)](){const e=ii;return this[e(282)]-this[e(301)]}skipBits(e){if(this[ii(288)]<e)return!1;this.index+=e}[ii(208)](e,t=!0){return this.getBits(e,this.index,t)}[ii(252)](e,t,n=!0){const r=ii;if(this.bitsAvailable<e)return 0;const s=t%8,i=this[r(439)][t/8|0]&255>>>s,o=8-s;if(o>=e)return n&&(this.index+=e),i>>o-e;{n&&(this.index+=o);const s=e-o;return i<<s|this[r(252)](s,t+o,n)}}[ii(438)](){const e=ii;let t;for(t=0;t<this.bitLength-this[e(301)];++t)if(0!==this.getBits(1,this[e(301)]+t,!1))return this.index+=t,t;return t}[ii(374)](){const e=ii;this[e(457)](1+this[e(438)]())}[ii(494)](){const e=ii;this[e(457)](1+this[e(438)]())}readUEG(){const e=ii,t=this[e(438)]();return this[e(208)](t+1)-1}readEG(){const e=this[ii(193)]();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return 1===this[ii(208)](1)}[ii(295)](e=1){return this[ii(208)](8*e)}readUShort(){return this[ii(208)](16)}[ii(419)](){return this[ii(208)](32)}}class rt{static[ii(360)](e,t){const n=ii;let r=[],s=!1,i=!1,o=!1,a=!1,c=0,l=0,u=0,d=[];for(;c<=e.byteLength;){if(c<e.byteLength){const t=e[c++];0!==t?(1===t&&l>1&&(u=l>2?4:3,d.push(c)),l=0):++l}else u=0,d.push(c++);if(d.length>1){const n=d.shift(),p=d[0]-u;if(n<p){let u=!1;const d=31&e[n];if(d===ce.NDR?i=!0:d===ce.IDR?s=!0:d===ce.SPS?(u=o,o=!0):d===ce.PPS&&(u=a,a=!0),!u)if(!t||d!==ce.NDR&&d!==ce.IDR)r.push(e.subarray(n,p));else{const t=new Uint8Array(p-n);let s=0;for(c=n,l=0;c<p;){let n=e[c++];l>1&&3===n&&(l=0,n=e[c++]),0!==n?l=0:++l,t[s++]=n}r.push(t.subarray(0,s))}}}}let p=!0,f=!1;return i||s?i&&s&&(console[n(230)](n(318)),p=!1):(console[n(230)]("[H264Parser] No VCL NALUs found"),p=!1),s&&(o&&a?f=!0:console[n(230)](n(242))),{valid:p,idr:f,nalus:r}}static skipScalingList(e,t){let n,r=8,s=8;for(let i=0;i<t;i++)0!==s&&(n=e.readEG(),s=(r+n+256)%256),r=0===s?r:s}static[ii(330)](e){const t=ii;let n,r,s,i,o,a,c=new ps(e),l=0,u=0,d=0,p=0,f=1;if(c[t(295)](),n=c.readUByte(),c[t(208)](5),c[t(457)](3),c.readUByte(),c[t(374)](),100===n||110===n||122===n||244===n||44===n||83===n||86===n||118===n||128===n){var h=c[t(193)]();if(3===h&&c[t(457)](1),c.skipUEG(),c[t(374)](),c[t(457)](1),c[t(232)]()){a=3!==h?8:12;for(let e=0;e<a;++e)c[t(232)]()&&(e<6?rt[t(347)](c,16):rt[t(347)](c,64))}}c[t(374)]();var m=c.readUEG();if(0===m)c[t(193)]();else if(1===m){c.skipBits(1),c[t(494)](),c[t(494)](),r=c[t(193)]();for(let e=0;e<r;++e)c.skipEG()}if(c.skipUEG(),c[t(457)](1),s=c[t(193)](),i=c.readUEG(),o=c[t(208)](1),0===o&&c[t(457)](1),c[t(457)](1),c[t(232)]()&&(l=c[t(193)](),u=c[t(193)](),d=c[t(193)](),p=c.readUEG()),c.readBoolean()){if(c[t(232)]()){let e;switch(c[t(295)]()){case 1:e=[1,1];break;case 2:e=[12,11];break;case 3:e=[10,11];break;case 4:e=[16,11];break;case 5:e=[40,33];break;case 6:e=[24,11];break;case 7:e=[20,11];break;case 8:e=[32,11];break;case 9:e=[80,33];break;case 10:e=[18,11];break;case 11:e=[15,11];break;case 12:e=[64,33];break;case 13:e=[160,99];break;case 14:e=[4,3];break;case 15:e=[3,2];break;case 16:e=[2,1];break;case 255:e=[c[t(295)]()<<8|c.readUByte(),c[t(295)]()<<8|c[t(295)]()]}e&&e[0]>0&&e[1]>0&&(f=e[0]/e[1])}c.readBoolean()&&c[t(457)](1),c[t(232)]()&&(c.skipBits(4),c[t(232)]()&&c[t(457)](24)),c.readBoolean()&&(c.skipUEG(),c[t(374)]()),c.readBoolean()&&(c[t(419)](),c[t(419)](),c.readBoolean())}return{width:Math.ceil((16*(s+1)-2*l-2*u)*f),height:(2-o)*(i+1)*16-(o?2:4)*(d+p)}}static[ii(448)](e){const t=ii;let n=new ps(e[t(307)]());n.readUByte(),e.isfmb=0===n[t(193)](),e.stype=n[t(193)]()}constructor(e){const t=ii;this.remuxer=e,this[t(346)]=e[t(274)]}[ii(471)](e){const t=ii;var n=rt[t(330)](new Uint8Array(e));this[t(346)][t(228)]=n[t(228)],this[t(346)][t(396)]=n[t(396)],this[t(346)].sps=[new Uint8Array(e)],this[t(346)][t(449)]=t(224);let r=new DataView(e.buffer,e[t(447)]+1,4);for(let e=0;e<3;++e){var s=r.getUint8(e)[t(262)](16);s.length<2&&(s="0"+s),this.track[t(449)]+=s}}[ii(211)](e){this[ii(346)].pps=[new Uint8Array(e)]}[ii(368)](e){const t=ii;if(!e)return!1;let n=!1;switch(e.type()){case ce[t(323)]:case ce[t(304)]:n=!0;break;case ce[t(309)]:!this[t(346)][t(362)]&&(this.parsePPS(e[t(307)]()),!this[t(345)][t(435)]&&this[t(346)][t(362)]&&this[t(346)][t(259)]&&(this[t(345)][t(435)]=!0)),n=!0;break;case ce[t(437)]:!this[t(346)][t(259)]&&(this[t(471)](e[t(307)]()),!this[t(345)][t(435)]&&this[t(346)][t(362)]&&this.track.sps&&(this[t(345)][t(435)]=!0)),n=!0;break;case ce[t(484)]:break;case ce[t(196)]:n=!0}return n}}class _n{constructor(e){const t=ii;this[t(465)]={},this[t(469)]=""|e}on(e,t){const n=ii;return!this[n(465)][e]&&(this[n(465)][e]=[]),this[n(465)][e][n(462)](t),!0}[ii(353)](e,t){const n=ii;if(this[n(465)][e]){var r=this.listener[e][n(238)](t);return r>-1&&this[n(465)][e][n(280)](r,1),!0}return!1}[ii(490)](){this[ii(465)]={}}[ii(255)](e,t){const n=ii;return!!this.listener[e]&&(this[n(465)][e][n(467)](e=>{e[n(187)](null,[t])}),!0)}}class F{constructor(e){var t,n;const r=ii;this[r(432)]=e,this[r(199)]={video:(null==(t=e[r(366)][r(434)])?void 0:t.encryption)===r(306)?16:0,audio:(null==(n=e[r(366)][r(451)])?void 0:n.encryption)===r(306)?16:0},F.types={avc1:[],encv:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],Opus:[],dOps:[],enca:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],pssh:[],sinf:[],frma:[],schm:[],schi:[],tenc:[],saiz:[],saio:[],senc:[]};for(let e in F[r(204)])F[r(204)][e]=[e[r(431)](0),e[r(431)](1),e.charCodeAt(2),e[r(431)](3)];const s=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),i=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);F[r(476)]={video:s,audio:i};const o=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),a=new Uint8Array([0,0,0,0,0,0,0,0]);F[r(443)]=F[r(268)]=F[r(463)]=a,F[r(348)]=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),F[r(217)]=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),F.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),F[r(320)]=new Uint8Array([0,0,0,0,0,0,0,1]);const c=new Uint8Array([105,115,111,109]),l=new Uint8Array([97,118,99,49]),u=new Uint8Array([0,0,0,1]);F[r(341)]=F[r(411)](F[r(204)][r(367)],c,u,c,l),F.DINF=F[r(411)](F[r(204)][r(272)],F[r(411)](F[r(204)].dref,o))}static[ii(411)](e,...t){const n=ii;let r,s=8,i=t.length,o=i;for(;i--;)t[i]&&(s+=t[i].byteLength);for(r=new Uint8Array(s),r[0]=s>>>24,r[1]=s>>>16&255,r[2]=s>>>8&255,r[3]=255&s,r[n(311)](e,4),i=0,s=8;i<o;++i)t[i]&&(r[n(311)](t[i],s),s+=t[i][n(442)]);return r}hdlr(e){const t=ii;return F[t(411)](F[t(204)][t(229)],F[t(476)][e])}mdat(e){const t=ii;return F.box(F.types[t(458)],e)}[ii(246)](e,t){const n=ii;return F.box(F[n(204)][n(246)],new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,e>>>24,e>>>16&255,e>>>8&255,255&e,0,0,0,0,85,196,0,0]))}[ii(298)](e){const t=ii;return F[t(411)](F[t(204)][t(298)],this[t(246)](e[t(393)],e.duration),this[t(229)](e[t(469)]),this[t(265)](e))}[ii(429)](e){const t=ii;return F[t(411)](F.types[t(429)],new Uint8Array([0,0,0,0,e>>>24,e>>>16&255,e>>>8&255,255&e]))}[ii(265)](e){const t=ii;return e[t(469)]===t(451)?F[t(411)](F[t(204)][t(265)],F.box(F[t(204)][t(236)],F[t(247)]),F.DINF,this[t(415)](e)):F[t(411)](F[t(204)][t(265)],F[t(256)],this[t(415)](e),F[t(411)](F[t(204)][t(340)],F[t(217)]))}[ii(460)](e,t,n){const r=ii;return F[r(411)](F[r(204)][r(460)],this[r(429)](e),this.traf(n,t))}moov(e,t,n){const r=ii;let s=e[r(294)],i=[];for(;s--;)i[s]=this[r(315)](e[s]);return F[r(411)][r(187)](null,[F[r(204)].moov,this[r(210)](n,t),this[r(430)](e)].concat(i)[r(365)](this[r(386)](e)))}mvex(e){const t=ii;let n=e[t(294)],r=[];for(;n--;)r[n]=this[t(290)](e[n]);return F.box[t(187)](null,[F[t(204)].mvex].concat(r))}[ii(210)](e,t){const n=ii;let r=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return F[n(411)](F[n(204)].mvhd,r)}[ii(356)](e){const t=ii;let n=e[t(446)]||[],r=new Uint8Array(4+n.length);for(let e=0;e<n.length;e++){const s=n[e][t(316)];r[e+4]=s[t(213)]<<4|s.isDependedOn<<2|s.hasRedundancy}return F.box(F.types.sdtp,r)}[ii(415)](e){const t=ii;return F[t(411)](F.types[t(415)],this[t(402)](e),F.box(F.types[t(478)],F[t(443)]),F.box(F.types[t(200)],F[t(268)]),F[t(411)](F[t(204)][t(390)],F[t(348)]),F[t(411)](F[t(204)][t(267)],F[t(463)]))}[ii(333)](e){const t=ii;let n,r,s,i=[],o=[];for(n=0;n<e[t(259)][t(294)];n++)r=e[t(259)][n],s=r[t(442)],i.push(s>>>8&255),i[t(462)](255&s),i=i[t(365)](Array[t(381)].slice.call(r));for(n=0;n<e.pps.length;n++)r=e.pps[n],s=r[t(442)],o.push(s>>>8&255),o[t(462)](255&s),o=o[t(365)](Array[t(381)][t(293)][t(394)](r));const a=F[t(411)](F[t(204)].avcC,new Uint8Array([1,i[3],i[4],i[5],255,224|e[t(259)][t(294)]][t(365)](i)[t(365)]([e[t(362)].length]).concat(o))),c=e[t(228)],l=e[t(396)],u=F[t(411)](F[t(204)][t(474)],F[t(411)](F.types[t(425)],new Uint8Array([97,118,99,49])),F[t(411)](F[t(204)][t(342)],new Uint8Array([0,0,0,0,...yi(this[t(432)][t(366)].video[t(395)]),0,1,0,0])),F[t(411)](F[t(204)].schi,this[t(314)]("video")));return F[t(411)](F[t(204)][t(333)],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,c>>>8&255,255&c,l>>>8&255,255&l,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,65,86,67,32,67,111,100,105,110,103,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]),a,u)}[ii(369)](e){const t=ii;let n=e.config[t(442)],r=new Uint8Array(26+n+3);return r[t(311)]([0,0,0,0,3,23+n,0,1,0,4,15+n,64,21,0,0,0,0,0,0,0,0,0,0,0,5,n]),r[t(311)](e[t(366)],26),r[t(311)]([6,1,2],26+n),r}[ii(296)](e){const t=ii,n=e.audiosamplerate;return F[t(411)](F[t(204)][t(296)],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e[t(198)],0,16,0,0,0,0,n>>>8&255,255&n,0,0]),F[t(411)](F[t(204)][t(369)],this.esds(e)))}dOps(e){const t=ii,n=e[t(357)];return new Uint8Array([0,e[t(198)],1,56,0,0,n>>>8&255,255&n,0,0,0])}[ii(264)](e){const t=ii,n=e[t(357)];return F[t(411)](F[t(204)].Opus,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e[t(198)],0,16,0,0,0,0,n>>>8&255,255&n,0,0]),F[t(411)](F.types[t(305)],this[t(305)](e)))}[ii(468)](e){const t=ii,n=F[t(411)](F[t(204)].dOps,this[t(305)](e)),r=F[t(411)](F[t(204)].sinf,F[t(411)](F[t(204)].frma,new Uint8Array([79,112,117,115])),F[t(411)](F[t(204)][t(342)],new Uint8Array([0,0,0,0,...yi(this.drm[t(366)].audio[t(395)]),0,1,0,0])),F[t(411)](F[t(204)][t(332)],this[t(314)](t(451)))),s=e[t(357)];return F[t(411)](F[t(204)][t(468)],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e[t(198)],0,16,0,0,0,0,s>>>8&255,255&s,0,0]),n,r)}[ii(402)](e){const t=ii;return e[t(469)]===t(451)?F.box(F[t(204)][t(402)],F[t(320)],e[t(212)]?this[t(468)](e):this[t(264)](e)):F.box(F[t(204)][t(402)],F[t(320)],this.encv(e))}[ii(249)](e){const t=ii,n=e.id,r=e[t(191)],s=e.width,i=e[t(396)],o=e[t(219)];return F[t(411)](F[t(204)][t(249)],new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,n>>>24,n>>>16&255,n>>>8&255,255&n,0,0,0,0,r>>>24,r>>>16&255,r>>>8&255,255&r,0,0,0,0,0,0,0,0,0,0,0,0,255&o,o%1*10&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,s>>>8&255,255&s,0,0,i>>>8&255,255&i,0,0]))}[ii(231)](e,t){var n;const r=ii,s=e.id,i=e[r(446)][0][r(483)],o=e[r(446)][0][r(191)],a=e[r(446)][0].flags,c=F[r(411)](F[r(204)][r(488)],new Uint8Array([0,2,0,58,s>>>24,s>>>16&255,s>>>8&255,255&s,0,0,0,1,o>>>24,s>>>16&255,o>>>8&255,255&o,i>>>24,i>>>16&255,i>>>8&255,255&i,0,a.isNonSync,0,0])),l=F[r(411)](F[r(204)][r(222)],new Uint8Array([0,0,0,0,t>>>24,t>>>16&255,t>>>8&255,255&t]));if(e[r(212)]){let t,s;if(e[r(469)]===r(434)?(t=!0,s=this[r(199)][r(434)]+(null==(n=e[r(446)][0].sampleAuxInfo)?void 0:n.byteLength)):(t=!1,s=this[r(199)][r(451)]),s>0){const n=this[r(392)](s),i=this[r(363)](e[r(446)],t),o=n.length+20+i.length+c[r(294)]+l[r(294)]+8+16+8+8,a=this[r(324)](e,o);return F[r(411)](F[r(204)][r(231)],c,l,a,n,this[r(364)](o-i[r(294)]+a[r(294)]+8),i)}{const t=this[r(363)](null,!1),n=t[r(294)]+c[r(294)]+l.length+8+16+8+8,s=this[r(324)](e,n);return F[r(411)](F[r(204)][r(231)],c,l,s,t)}}return F.box(F.types.traf,c,l,this[r(324)](e,c[r(294)]+l[r(294)]+8+16+8+8))}[ii(315)](e){const t=ii;return e[t(191)]=e[t(191)]||4294967295,F.box(F[t(204)][t(315)],this[t(249)](e),this[t(298)](e))}trex(e){const t=ii,n=e.id;return F[t(411)](F[t(204)][t(290)],new Uint8Array([0,0,0,0,n>>>24,n>>>16&255,n>>>8&255,255&n,0,0,0,1,0,0,0,16,0,0,0,0,0,0,0,0]))}trun(e,t){const n=ii;let r=(e.samples||[]).length,s=new Uint8Array(12);return t+=20,s[n(311)]([0,0,0,1,r>>>24,r>>>16&255,r>>>8&255,255&r,t>>>24,t>>>16&255,t>>>8&255,255&t],0),F.box(F.types[n(324)],s)}[ii(192)](e,t){const n=ii,r=n(373),s=n(257),i=function(e){const t=function(e){const t=ii;let n="";for(let r=0;r<e.length;r+=16e3){const s=e[t(453)](r,r+16e3);n+=String[t(299)][t(187)](null,s)}return n}(gi(e));return btoa(t)}(function(e){const t=ii,n=[];return n[t(462)](e[3]),n[t(462)](e[2]),n[t(462)](e[1]),n[t(462)](e[0]),n.push(e[5]),n.push(e[4]),n.push(e[7]),n.push(e[6]),(e=gi(e))[t(311)](n,0),e}(e));return gi(function(e,t){const n=ii,r=new Uint8Array(2*e.length),s=new DataView(r[n(492)]);for(let t=0;t<e[n(294)];++t){const r=e[n(431)](t);s[n(221)](2*t,r,!0)}return r[n(492)]}([n(300)+s+n(422)+r+'">',"<DATA>",n(239),"<KIDS>",n(417),n(243)+i+'"',">",n(245),n(270),"</PROTECTINFO>",t?n(470)+t+n(409):"",n(428),n(289)][n(420)]("")))}[ii(430)](e){const t=ii;if(this[t(432)][t(440)][t(328)]("com.widevine"))return F[t(411)](F[t(204)][t(430)],new Uint8Array([0,0,0,0,237,239,139,169,121,214,74,206,163,200,39,220,213,29,33,237,0,0,0,18,18,16,...this[t(432)][t(366)][e[0][t(469)]][t(479)]]));if(this[t(432)].keySystem===t(421)){const n=this[t(192)](this[t(432)][t(366)][e[0].type][t(479)],this.drm.licenseUrl),r=n[t(442)];return F[t(411)](F[t(204)][t(430)],new Uint8Array([0,0,0,0,154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149,r>>>24,r>>>16&255,r>>>8&255,255&r,...n]))}return this[t(432)][t(440)]===t(273)?F[t(411)](F[t(204)][t(430)],new Uint8Array([1,0,0,0,16,119,239,236,192,178,77,2,172,227,60,30,82,226,251,75,0,0,0,1,...this.drm.config[e[0][t(469)]][t(479)],0,0,0,0])):this[t(432)][t(440)]===t(286)?null:void console[t(370)](t(297)+this[t(432)].keySystem)}[ii(314)](e){const t=ii;let n,r,s=this[t(432)][t(366)][e];return"cbcs"===s.encryption?(n=new Uint8Array([16,...s.iv]),r=25):(n=new Uint8Array([]),r=0),F[t(411)](F[t(204)].tenc,new Uint8Array([1,0,0,0,0,r,1,this[t(199)][e],...s[t(479)],...n]))}[ii(392)](e){return F[ii(411)](F.types.saiz,new Uint8Array([0,0,0,0,e,0,0,0,1]))}[ii(364)](e){const t=ii;return F[t(411)](F[t(204)][t(364)],new Uint8Array([0,0,0,0,0,0,0,1,e>>>24,e>>>16&255,e>>>8&255,255&e]))}[ii(363)](e,t){const n=ii;let r=null;return e&&(1!==e[n(294)]&&console[n(370)](n(424)+e[n(294)]+n(413)),r=e[0][n(195)]),r&&r[n(442)]?F[n(411)](F[n(204)][n(363)],new Uint8Array([0,0,0,t?2:0,0,0,0,1,...r])):F[n(411)](F[n(204)][n(363)],new Uint8Array([0,0,0,0,0,0,0,1]))}[ii(271)](e,t,n){const r=ii,s=this[r(216)](e,t,n);let i=new Uint8Array(F[r(341)][r(442)]+s.byteLength);return i.set(F[r(341)]),i[r(311)](s,F[r(341)].byteLength),i}}let vi=1;class yr{constructor(){this[ii(283)]=1}static[ii(209)](){return vi++}[ii(250)](){const e=ii;this[e(274)][e(215)]=0,this.mp4track[e(446)]=[]}[ii(258)](){const e=ii;return!(!this.readyToDecode||!this[e(446)][e(294)])}}class Ea extends yr{constructor(e){const t=ii;super(),this[t(435)]=!0,this[t(223)]=0,this[t(237)]=0,this[t(274)]={id:yr[t(209)](),type:"audio",channelCount:2,audiosamplerate:48e3,len:0,fragmented:!0,timescale:e,duration:e,samples:[],codec:t(388),encrypted:!0},this[t(446)]=[]}resetTrack(){const e=ii;this[e(283)]=1,this[e(223)]=0,this[e(237)]=0}[ii(406)](e,t,n){const r=ii;if(e.length>0)for(let s=0;s<e[r(294)];s++){let i=e[s],o=i[r(276)],a=o[r(442)];this.samples.push({units:o,size:a,duration:i.duration,sampleAuxInfo:t,timestamp:n}),this[r(274)][r(215)]+=a}}[ii(248)](){const e=ii;if(!this[e(446)])return null;let t,n=this[e(274)][e(446)];for(;this.samples[e(294)];){let r=this[e(446)][e(233)](),s=(1e3*r[e(385)]|0)-this.nextDts|0;s<5&&(s=5),this.dts=this.nextDts,this[e(223)]+=s,t={size:r.size,duration:s,cts:0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1},sampleAuxInfo:r[e(195)]};let i=new Uint8Array(r.size);return i[e(311)](r.units,0),n.push(t),new Uint8Array(i.buffer,0,r[e(483)])}return null}}class _a extends yr{constructor(e,t){const n=ii;super(),this[n(435)]=!1,this.nextDts=0,this[n(237)]=0,this[n(477)]=t,this.mp4track={id:yr[n(209)](),type:n(434),len:0,fragmented:!0,sps:"",pps:"",width:0,height:0,timescale:e,duration:e,samples:[],encrypted:!0},this[n(446)]=[],this[n(220)]=new rt(this)}[ii(426)](){const e=ii;this[e(283)]=1,this.readyToDecode=!1,this[e(274)].sps="",this[e(274)][e(362)]="",this[e(223)]=0,this[e(237)]=0}[ii(406)](e,t,n){const r=ii;for(let s of e){let e=[],i=0;for(let t of s[r(276)])this.h264[r(368)](t)&&(e[r(462)](t),i+=t.getSize());e[r(294)]>0&&this[r(435)]&&(this[r(274)][r(215)]+=i,this[r(446)][r(462)]({units:e,size:i,keyFrame:s.keyFrame,duration:s[r(191)],sampleAuxInfo:t,timestamp:n}))}}[ii(248)](){const e=ii;if(!this[e(258)]()||!this.samples)return null;let t,n=this[e(274)][e(446)],r=this.samples[e(233)](),s=r[e(276)],i=(1e3*r.timestamp|0)-this[e(223)]|0;i<5&&(i=5),window[e(251)]&&i>5e3&&console[e(383)]("timestamp gap: "+(i/1e3|0)+" s"),this[e(237)]=this[e(223)],this.nextDts+=i,t={size:r[e(483)],duration:i,cts:0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,isNonSync:r[e(275)]?0:1,dependsOn:r.keyFrame?2:1},sampleAuxInfo:r[e(195)]};let o=0;for(const t of s)o+=t[e(349)]();let a=0,c=new Uint8Array(o);for(const t of s)c[e(311)](t[e(343)](),a),a+=t[e(349)]();return n[e(462)](t),new Uint8Array(c[e(492)],0,o)}}class Ta extends _n{constructor(e,t){const n=ii;super(n(345)),this.initialized=!1,this.trackTypes=[],this[n(414)]={},this[n(393)]=1e3,this.mediaDuration=0,this[n(477)]=e,this[n(375)]=t}addTrack(e){const t=ii;(e===t(434)||"both"===e)&&(this[t(414)][t(434)]=new _a(this[t(393)],this.videoElement),this[t(480)][t(462)](t(434))),(e===t(451)||e===t(303))&&(this[t(414)][t(451)]=new Ea(this.timescale),this[t(480)][t(462)](t(451)))}reset(){const e=ii;for(let t of this[e(480)])this[e(414)][t][e(426)]();this[e(489)]=!1}[ii(355)](){const e=ii;this[e(414)]={},this[e(490)]()}[ii(250)](){const e=ii;if(this[e(489)])for(let t of this[e(480)]){let n=this[e(414)][t];for(;;){let r=n.getFramePayload();if(!r||!r[e(442)])break;let s={type:t,payload:pi(this[e(375)][e(460)](n[e(283)]++,n[e(237)],n[e(274)]),this[e(375)][e(458)](r)),dts:n[e(237)]};this[e(255)](e(492),s),n[e(250)]()}}else this[e(258)]()&&(this[e(255)](e(205)),this[e(271)](),this[e(489)]=!0,this[e(250)]())}initSegment(){const e=ii;for(let t of this[e(480)]){let n=this[e(414)][t],r={type:t,payload:this[e(375)][e(271)]([n[e(274)]],this[e(433)],this[e(393)])};this.dispatch(e(492),r)}}isReady(){const e=ii;for(let t of this.trackTypes)if(!this[e(414)][t][e(435)]||!this[e(414)][t].samples[e(294)])return!1;return!0}[ii(406)](e){const t=ii;for(let n of this[t(480)]){let r=e[n];r.length>0&&this[t(414)][n][t(406)](r,n===t(451)?e[t(225)]:e.videoSampleAuxInfo,e[t(385)])}this.flush()}}class Aa extends _n{constructor(e,t,n){const r=ii;super(r(492)),this[r(469)]=t,this.queue=new Uint8Array,window[r(319)]&&(this[r(254)]=new Uint8Array,this[r(404)]=0),this.sourceBuffer=e,this[r(218)]=n,this[r(197)]=!1,this[r(310)].addEventListener(r(370),e=>{const t=r;console.warn(t(201),e,this.type),this[t(197)]=!0,this[t(255)](t(370),{type:this[t(469)],name:"buffer",error:t(292)})})}[ii(355)](){const e=ii;this[e(401)]=null,this[e(254)]=null;try{this.sourceBuffer&&(this[e(310)][e(186)](),this[e(218)].removeSourceBuffer(this[e(310)]),this[e(310)]=null)}catch(e){}this.offAll()}[ii(475)](){const e=ii;if(this.queue[e(294)]&&this[e(310)]&&!this[e(310)].updating){if(this[e(310)].buffered[e(294)]>1){for(let t=0;t<this[e(310)].buffered[e(294)];++t){const n=t<this[e(310)].buffered[e(294)]-1;window[e(251)]&&console[e(383)](e(445)+t+(n?" (remove)":"")+": "+this[e(310)][e(269)][e(326)](t)+e(325)+this[e(310)][e(269)][e(376)](t)),n&&this.sourceBuffer[e(482)](this[e(310)][e(269)].start(t),this[e(310)].buffered[e(376)](t))}if(this.sourceBuffer[e(378)])return}try{this[e(310)][e(491)](this[e(401)]),this.queue=new Uint8Array}catch(t){this[e(255)](e(370),{type:this[e(469)],name:e(352),error:t})}}}[ii(371)](e){const t=ii;if(this[t(254)]&&(this.dbgQueue=pi(this[t(254)],e),100==++this[t(404)])){const e=(new Date)[t(344)]().substring(0,19)[t(454)](":","-"),n=this.type+"-"+e+".mp4";window.downloadToFile(this[t(254)],n),this[t(254)]=null}this[t(197)]||(this[t(401)]=pi(this[t(401)],e)),this.doAppend()}}class Tn extends _n{static isSupported(e){const t=ii;return window[t(202)]?window.ManagedMediaSource[t(497)](e):!!window[t(384)]&&window.MediaSource[t(497)](e)}constructor(e){const t=ii;super(t(397)),this[t(197)]=!1,this[t(410)]=!0,this[t(466)]=!1,this[t(234)]=!1,this.mseEnded=!1,this[t(379)]=Object[t(189)]({},{node:"",mode:"video",debug:!1,onReady:function(){},onError:function(e){}},e),this[t(450)]=typeof this.options[t(450)]===t(302)?document[t(472)](this.options.node):this[t(379)].node,this[t(432)]=e.drm,this.mp4=new F(this.drm),this[t(423)]=new Ta(this.node,this[t(375)]),this[t(423)].addTrack(this[t(379)][t(461)]),this[t(423)].on(t(492),this[t(456)].bind(this)),this[t(423)].on(t(205),this[t(382)][t(308)](this)),this.initBrowser()}[ii(322)](){const e=ii;typeof this.options.node===e(302)&&""==this.options[e(450)]&&console[e(370)](e(473)),this[e(234)]=!1,this.setupMSE()}setupMSE(){const e=ii;if(!window[e(202)]&&!window[e(384)])throw e(452);window.ManagedMediaSource?(this.node[e(427)]=!0,this[e(327)]=new ManagedMediaSource):this[e(327)]=new MediaSource,this[e(284)]=URL[e(244)](this[e(327)]),this.node[e(485)]=this[e(284)],this[e(277)]=!1,this[e(327)][e(331)](e(338),this.onMSEOpen[e(308)](this)),this.mediaSource.addEventListener("sourceclose",this[e(241)][e(308)](this)),this[e(327)][e(331)]("webkitsourceopen",this[e(194)][e(308)](this)),this.mediaSource[e(331)](e(240),this[e(241)].bind(this)),this[e(327)][e(331)]("error",(function(t){const n=e;console[n(370)](n(287),t[n(226)])}))}[ii(227)](){const e=ii;if(!this[e(277)])try{this.mseEnded=!0,this[e(327)][e(185)]===e(399)&&this[e(327)][e(261)]()}catch(t){console[e(370)]("mediasource is not available to end: ",t)}}[ii(359)](){this[ii(410)]=!0}[ii(371)](e){const t=ii;let n={video:[],audio:[]};if(this[t(197)]||this[t(277)]||!e||!this[t(423)])return-1;if(e[t(434)]){n.timestamp=e.timestamp;const r=this[t(190)](e.videoSampleAuxInfo,this.mp4[t(199)][t(434)]),s=r!=e[t(434)][t(442)];let i=rt[t(360)](e[t(434)],s);if(!i[t(206)]||i[t(260)].length<1)return 0;if(this.waitingForIdr){if(!i[t(412)])return 0;this[t(410)]=!1}if(!li&&e[t(278)]){const n=i[t(260)][t(188)]((e,n)=>e+4+n[t(442)],0);n!==r&&this[t(400)](e[t(278)],this.mp4[t(199)][t(434)],n-r)}n[t(434)]=this[t(335)](i[t(260)]),n[t(278)]=e[t(278)]}return e[t(451)]&&(n[t(385)]=e[t(385)],n[t(451)]=[{units:e.audio}],n.audioSampleAuxInfo=e[t(225)]),e[t(434)]||e[t(451)]?(this[t(423)][t(406)](n),0):(console.error(t(361)),0)}[ii(335)](e){const t=ii;let n=[],r=[],s=!1,i=!1;for(let o of e){let e=new ce(o);e.type()!==ce.IDR&&e[t(469)]()!==ce.NDR||rt[t(448)](e),n[t(294)]&&i&&(e[t(387)]||!e[t(495)])&&(r[t(462)]({units:n,keyFrame:s}),n=[],s=!1,i=!1),n[t(462)](e),s=s||e[t(459)](),i=i||e[t(495)]}if(n[t(294)])if(i)r[t(462)]({units:n,keyFrame:s});else{let e=r[t(294)]-1;e>=0&&(r[e].units=r[e][t(276)].concat(n))}return 1!==r[t(294)]&&console[t(230)](t(207)+r[t(294)]),r}[ii(190)](e,t){const n=ii;if(!e)return 0;const r=(e[0]<<8)+e[1],s=t+2+4;let i=0,o=2;for(;0<r&&o+s<=e[n(442)];){o+=t;const n=(e[o]<<8)+e[o+1],r=(e[o+2]<<24)+(e[o+3]<<16)+(e[o+4]<<8)+e[o+5];o+=6,i+=n+r}return i}patchSampleAuxinfo(e,t,n){const r=ii;let s=2;if(0<(e[0]<<8)+e[1]&&s+(t+2+4)<=e[r(442)]){s+=t;let r=(e[s]<<8)+e[s+1];r+=n,r>=0&&(e[s]=r>>>8&255,e[s+1]=255&r)}return 0}[ii(382)](){const e=ii;if(this[e(234)]&&this[e(423)]&&this[e(423)].isReady()&&!this.bufferControllers){this.bufferControllers={};for(let t in this[e(423)][e(414)]){let n=this[e(423)][e(414)][t];const r="".concat(t,e(317))[e(365)](n[e(274)][e(449)],'"');if(window.clRtcDrmDebugLog&&console[e(383)](e(312),r),!Tn[e(408)](r))return console[e(370)](e(372)),!1;let s=this[e(327)][e(350)](r);this[e(398)][t]=new Aa(s,t,this[e(327)]),this.bufferControllers[t].on(e(370),this[e(403)][e(308)](this))}}}[ii(313)](){const e=ii;for(let t in this[e(398)])this[e(398)][t].doAppend()}onBuffer(e){const t=ii;this[t(234)]&&this[t(398)]&&this[t(398)][e.type]&&this[t(398)][e[t(469)]][t(371)](e[t(214)])}[ii(194)](){const e=ii;window[e(251)]&&console.info("[MSE] sourceopen"),this[e(327)][e(185)]!==e(281)&&(this.mediaSource.duration=Number[e(391)],this[e(234)]=!0,"function"==typeof this[e(379)][e(336)]&&this[e(379)].onReady[e(394)](null,this[e(466)]),URL[e(235)](this.url),this[e(382)]())}[ii(241)](){const e=ii;window.clRtcDrmDebugLog&&console[e(383)](e(441)),this.mseReady=!1,this[e(227)]()}[ii(403)](e){const t=ii;console.warn(t(351),e),this.irrecoverableError=!0,this[t(227)](),"function"==typeof this[t(379)][t(266)]&&this[t(379)][t(266)][t(394)](null,e)}}function wi(e,t){const n=Si();return(wi=function(e,t){return n[e-=222]})(e,t)}function Si(){const e=["__dev_time__","1634635aeNfVS","4rWkceo","1051qHPzyB","314juHkBI","7752096GfpyFE","1023208nKrJjX","2137269uUqtNM","303058KNxeBb","1097196nHglzA"];return(Si=function(){return e})()}!function(){const e=wi,t=Si();for(;;)try{if(parseInt(e(228))/1*(-parseInt(e(229))/2)+-parseInt(e(222))/3*(parseInt(e(227))/4)+parseInt(e(226))/5+parseInt(e(224))/6+parseInt(e(223))/7+-parseInt(e(231))/8+parseInt(e(230))/9==409100)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();const _i=Ri;function Ri(e,t){const n=ki();return(Ri=function(e,t){return n[e-=460]})(e,t)}!function(){const e=Ri,t=ki();for(;;)try{if(-parseInt(e(471))/1*(-parseInt(e(474))/2)+parseInt(e(479))/3+parseInt(e(473))/4*(parseInt(e(461))/5)+parseInt(e(487))/6+-parseInt(e(467))/7+-parseInt(e(482))/8+-parseInt(e(464))/9==139726)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();const Ei="CrsCCAMSEKDc0WAwLAQT1SB2ogyBJEwYv4Tx7gUijgIwggEKAoIBAQC8Xc/GTRwZDtlnBThq8"+_i(462)+"wyoYOE+M/t1oIbccwlTQ7o+BpV1X6TB7fxFyx1jsBtRsBWphU65w121zqmSiwzZzJ4xsXVQCJ"+_i(460)+_i(476)+_i(480)+_i(484)+_i(485)+"7hyskG5ZLAyJMzTvgnV3D8/I5Y6mCFBPb/+/Ri+9bEvquPF3Ff9ip3yEHu9mcQeEYCeGe9zR/27eI5MATX39gYtCnn7dDXVxo4/rCYK0A4VemC3HRai2X3pSGcsKY7+6we7h4IycjqtuGtYg8A"+_i(475)+"RL9KsD0v7ysBQVdUXEbJotcFz71tI5qc3jwr6GjYIPA3VzusD17PN6AGQniMwxJV12z/EgnUo"+_i(477),Ii=Uint8Array[_i(478)](window[_i(470)](Ei),e=>e.charCodeAt(0));class De{constructor(e){this[_i(488)]=e}[_i(469)](){return this[_i(488)]}[_i(483)](){const e=_i;switch(this[e(488)]){case e(489):return"https://lic.staging.drmtoday.com";case e(465):return e(481);default:return e(466)}}certificate(){return Ii}}function ki(){const e=["development","https://lic.drmtoday.com","462553oMrSQp","Staging","toString","atob","20047HjYCpd","Development","52chMPdC","6mbMcSk","baigovcoURAZcr1d/G0rpREjLdVLG0Gjqk63Gx688W5gh3TKemsK3R1jV0dOfj3e6uV/kTpsN","+vwmV2/NJWxKqHBKdL9JqvOnNiQUF0hDI7Wf8Wb63RYSXKE27Ky31hKgx1wuq7TTWkA+kHnJT","pcFB13osydpD2AaDsgWo5RWJcNf+fzCgtUQx/0Au9+xVm5LQBdv8Ja4f2oiHN3dw","from","146355HhTpSB","UrTEfQxfPR4dJTquE+IDLAi5yeVVxzbAgMBAAE6DGNhc3RsYWJzLmNvbUABEoADMmGXpXg/0q","https://lic.test.drmtoday.com","501688OkVRMl","baseUrl","xUuwokpsqVIHZrJfu62ar+BF8UVUKdK5oYQoiTZd9OzK3kr29kqGGk3lSgM0/p499p/FUL8oH","HzgsJ7Hajdsyzn0Vs3+VysAgaJAkXZ+k+N6Ka0WBiZlCtcunVJDiHQbz1sF9GvcePUUi2fM/h","Production","1063410zFUyaf","name","staging","pQnNI61gzHO42XZOMuxytMm0F6puNHTTqhyY3Z290YqvSDdOB+UY5QJuXJgjhvOUD9+oaLlvT","93365ZJpndd","V382D1oJAM0F/YgCQtNDLz7vTWJ+QskNGi5Dd2qzO4s48Cnx5BLvL4H0xCRSw2Ed6ekHSdrRU","production","2343546YgIYCY"];return(ki=function(){return e})()}function xi(e,t){const n=Ti();return(xi=function(e,t){return n[e-=325]})(e,t)}function Ti(){const e=["1052499bnJBHn","cenc","4222tSxFth","Unsupported SampleAuxInfo version","12980Tusgux","3160ZwXFcU","40030ewyARR","16lkTHRT","1199124lbwxEr","data","105TSrukA","getUint8","12bBEpge","SampleAuxInfo corrupted (postfix not found)","getUint16","error","85265ZYYyUv","buffer","3616548TKdsLX","subarray","byteLength","SampleAuxInfo corrupted"];return(Ti=function(){return e})()}function Ci(e,t){const n=Pi();return(Ci=function(e,t){return n[e-=295]})(e,t)}De[_i(468)]=new De(_i(489)),De[_i(486)]=new De(_i(463)),De[_i(472)]=new De(_i(465)),function(){const e=xi,t=Ti();for(;;)try{if(parseInt(e(328))/1+-parseInt(e(332))/2*(-parseInt(e(336))/3)+-parseInt(e(338))/4*(-parseInt(e(342))/5)+-parseInt(e(344))/6+-parseInt(e(326))/7*(parseInt(e(333))/8)+parseInt(e(334))/9+parseInt(e(331))/10*(parseInt(e(330))/11)==358550)break;t.push(t.shift())}catch(e){t.push(t.shift())}}(),function(){const e=Ci,t=Pi();for(;;)try{if(parseInt(e(305))/1*(-parseInt(e(297))/2)+-parseInt(e(295))/3+parseInt(e(310))/4*(parseInt(e(309))/5)+-parseInt(e(304))/6*(parseInt(e(296))/7)+parseInt(e(307))/8*(-parseInt(e(298))/9)+-parseInt(e(301))/10*(parseInt(e(302))/11)+-parseInt(e(300))/12*(-parseInt(e(308))/13)==178039)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();const Li=[];let Ai=null,Oi=0;function Pi(){const e=["31476hbBsvr","850RxzAPl","4180KczaCN","push","156MUFuvQ","96571jvhWaB","buffer","26232BkewNd","4303YGAqiP","5yhGpFn","1137036pzCnTd","1035942NcoZLh","94073eTaQjy","2bXtEms","414snfiTE","slice"];return(Pi=function(){return e})()}const Ni=ji;function Di(){const e=["Data does not seem to be UTF-16 encoded!","No init data available!","getElementsByTagName","min","14BFNrBA","keystatuseschange","catch","childNodes","internal-error","Failed to reuse previous EME session: ","output-downscaled","expired","bind","5576688EKOFOG","has","length","License acquisition failed with error ","arrayBuffer","apply","CDM error generating license request: ","<Challenge","No PR challenge data!","then","license","createSession","warn","[PR] License fetched:","text/xml","clRtcDrmDebugLog","push","encode","max","json"," is not ","replace","target","rtcdrmerror","update","fromCharCode","subarray","2993694njpqat","4002692oINhTV","Content-Type","1347492MkzfDC","Data has an incorrect length, must be even.","addEventListener","buffer","onFetch","generateRequest","initData","dispatchEvent","atob","No clear key test key provided!","Challenge","New lic will be requested","oct","BYTES_PER_ELEMENT","sessionId","usable for decryption (status: ","[WV] License fetched:","Key ","5MtuOVr","byteLength","744563CKOUzg","load","floor","error","decode","indexOf","info","isSafari","edef8ba979d64acea3c827dcd51d21ed","mediaKeys","Previous lic will be reused","charCodeAt","licenseUrl","status","Failed to update the session: ","log","keyStatuses","temporary","9a04f07998404286ab92e65be0885f95","output-restricted","nodeValue","btoa","message","EME createSession() failed - no DRM available","5977680uUTwUr","getUint16","[PR] Challenge node not found","A128KW","3974463jrELhf","Failed to update the session","stringify","[EME]","delete","No media keys for media element!","set","2nMQfRz"];return(Di=function(){return e})()}!function(){const e=ji,t=Di();for(;;)try{if(-parseInt(e(419))/1*(parseInt(e(454))/2)+parseInt(e(495))/3+parseInt(e(496))/4*(-parseInt(e(417))/5)+-parseInt(e(498))/6*(-parseInt(e(459))/7)+parseInt(e(468))/8+-parseInt(e(447))/9+parseInt(e(443))/10==555073)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();let Mi={licenseUrl:"",onFetch:void 0};const Fi={},Ui=(e,t=0,n=1/0)=>((e,t,n)=>{const r=ji,s=Uint8Array[r(511)];t*=s,n*=s;const i=(c=e)instanceof ArrayBuffer?c:c[ji(501)],o=e[r(418)],a=t;var c;let l=Math[r(486)](0,Math[r(458)](a,o)),u=Math[r(458)](l+Math[r(486)](n,0),o);return l/=s,u/=s,new Uint8Array(i,l,u-l)})(e,t,n);function ji(e,t){const n=Di();return(ji=function(e,t){return n[e-=417]})(e,t)}const Wi=e=>{const t=ji;let n="";for(const r of e){let e=r.toString(16);1==e[t(470)]&&(e="0"+e),n+=e}return n};let Zi=null;const Vi=e=>{const t=ji;return window[t(440)](String[t(493)][t(473)](null,e))[t(489)](/\+/g,"-")[t(489)](/\//g,"_")[t(489)](/=*$/,"")},Gi=(e,t)=>{const n=ji,r=(e=>{const t=ji,n=JSON.parse((new TextDecoder)[t(423)](e));if(console[t(434)]("CK license request:",n),null===Zi)throw new Error(t(507));const r=[];for(const e of n.kids){const n={kty:t(510),alg:t(446),kid:e,k:Vi(Zi)};r[t(484)](n)}return(new TextEncoder)[t(485)](JSON[t(449)]({keys:r}))})(t.message);t[n(490)][n(492)](r)[n(461)]((function(e){const t=n;console[t(422)](t(448),e)}))},Bi=e=>{const t=ji,n=window[t(506)](e[t(489)](/-/g,"+")[t(489)](/_/g,"/")),r=new Uint8Array(n[t(470)]);for(let e=0;e<n.length;++e)r[e]=n[t(430)](e);return r},Yi=(e,t,...n)=>Ds(void 0,[e,t,...n],void 0,(function*(e,t,n=!1){const r=ji,s=new Headers(Fi);n&&s.append(r(497),r(482));const i={method:"POST",headers:s,body:t},o=yield Mi[r(502)]?Mi[r(502)](e,i):fetch(e,i);if(!o.ok)throw new Error(r(471)+o[r(432)]);return o})),Xi=(e,t)=>{const n=ji;Yi(Mi[n(431)],t[n(441)])[n(477)](e=>e[n(487)]())[n(477)](e=>{const r=n;window[r(483)]&&console.info(r(514),e.license);const s=Bi(e[r(478)])[r(501)];t[r(490)][r(492)](s)[r(461)](e=>{console[r(422)]("Failed to update the session",e)})})[n(461)](t=>{const r=n;e.dispatchEvent(new CustomEvent(r(491),{detail:{message:""+t}})),console[r(422)](t)})},zi=(e,t)=>{const n=ji,r=((e,t)=>{const n=ji,r=new DOMParser;try{const e=function(e,t,n=!1){const r=ji;if(!e)return"";let s=e;if(!n&&s.byteLength%2!=0)throw console[r(422)](r(499)),new Error(r(455));const i=Ui(s);let o;if((255===i[0]&&254===i[1]||254===i[0]&&255===i[1])&&(s=i[r(494)](2)),s instanceof ArrayBuffer)o=s;else{const e=new Uint8Array(s[r(418)]);e[r(453)](Ui(s)),o=e[r(501)]}const a=Math[r(421)](s.byteLength/2),c=new Uint16Array(a),l=new DataView(o);for(let e=0;e<a;e++)c[e]=l[r(444)](2*e,t);return function(e){const t=ji;let n="";for(let r=0;r<e[t(470)];r+=16e3){const s=e[t(494)](r,r+16e3);n+=String[t(493)].apply(null,s)}return n}(c)}(t,!0);if(e[n(424)](n(475))>-1){const t=r.parseFromString(e,n(482))[n(457)](n(508))[0][n(462)][0][n(439)];if(null===t)throw new Error("No PR challenge data!");return Bi(t)}console[n(480)](n(445))}catch(t){e.dispatchEvent(new CustomEvent(n(491),{detail:{message:""+t}})),console.error(t)}return null})(e,t.message);if(null===r)return e[n(505)](new CustomEvent("rtcdrmerror",{detail:{message:"No PR challenge data!"}})),void console.error(n(476));Yi(Mi[n(431)],r[n(501)],!0)[n(477)](e=>e[n(472)]())[n(477)](r=>{const s=n;window[s(483)]&&console[s(425)](s(481),r),t[s(490)].update(r)[s(461)]((function(t){const n=s;e[n(505)](new CustomEvent(n(491),{detail:{message:n(433)+t}})),console[n(422)](n(448),t)}))})[n(461)](t=>{const r=n;e.dispatchEvent(new CustomEvent("rtcdrmerror",{detail:{message:""+t}})),console[r(422)](t)})},Ki=(e,t)=>{const n=ji;Yi(Mi[n(431)],t[n(441)])[n(477)](e=>{const t=n,r=e.text();return window[t(483)]&&console.info("[FPS] License fetched:",e,r),r})[n(477)](e=>{const r=n;t[r(490)][r(492)](Bi(e))})[n(461)](t=>{const r=n;e.dispatchEvent(new CustomEvent(r(491),{detail:{message:""+t}})),console[r(422)](t)})},$i=(e,t)=>{Fi[e]=t},Hi=si[Ni(426)];let Qi=!Hi;const qi=new Map;function eo(e){return Ds(this,void 0,void 0,(function*(){const t=ji;if(null===e[t(504)])throw new Error(t(456));const n=e[t(490)];if(null===n)throw new Error("No media element available!");const r=n[t(428)];if(null===r)throw new Error(t(452));const s=Wi(new Uint8Array(e[t(504)])),i=s+n.id;let o=null;qi[t(469)](i)&&(o=qi.get(i),null!=o&&o.close(),qi[t(451)](i)),window[t(483)]&&console[t(425)](t(450),t(o?429:509));let a=null;try{a=r[t(479)](Qi?"persistent-license":"temporary")}catch(e){console[t(434)]("EME createSession(persistent) failed:",e)}if(!a&&Qi){Qi=!1;try{a=r[t(479)](t(436))}catch(e){console[t(422)]("EME createSession(temporary) failed:",e)}}if(a)if(a[t(500)](t(460),e=>{const r=t;e[r(490)][r(435)].forEach((e,t)=>{const s=r;(e===s(466)||e===s(438)||e===s(465)||e===s(463))&&n[s(505)](new CustomEvent(s(491),{detail:{message:s(515)+Wi(new Uint8Array(t))+s(488)+(s(513)+e+")"),keyId:t}}))})}),Hi?a.addEventListener(t(441),Ki[t(467)](null,n),!1):-1!==s[t(424)](t(427))?a.addEventListener(t(441),Xi[t(467)](null,n),!1):-1!==s[t(424)](t(437))?a[t(500)](t(441),zi[t(467)](null,n),!1):a.addEventListener("message",Gi[t(467)](null,n),!1),o)try{(yield a[t(420)](o[t(512)]))?qi[t(453)](i,a):n.dispatchEvent(new CustomEvent(t(491),{detail:{message:"Failed to load previous EME session"}}))}catch(e){n[t(505)](new CustomEvent(t(491),{detail:{message:t(464)+e}}))}else a[t(503)](e.initDataType,e[t(504)]).then(()=>{Qi&&qi[t(453)](i,a)})[t(461)](e=>{const r=t;n[r(505)](new CustomEvent(r(491),{detail:{message:r(474)+e}}))});else n[t(505)](new CustomEvent(t(491),{detail:{message:t(442)}}))}))}const to=_o;function no(){const e=[" too close to seek, ","fpsCertificateUrl","9880640TWxZrg","H264","ignoreAudio","Unable to create Worker!","createMediaKeys(",", restart required: ","/license-proxy-headerauth/drmtoday/RightsManager.asmx","6236Nwzlef","worker","serverCertificateUrl","serverCertificate","seq",",255]).buffer,idrFrames.push(new Uint8Array([0,0,0,1,39,100,0,13,172,87,5,6,100,0,0,0,1,40,238,60,176,0,0,0,1,37,","ClearKey","No valid DRM config found, call rtcDrmConfigure first.","sessionId","toISOString","indexOf","robustness","isInteger","info","includes","Development","slice","16niaptx"," frame","video/mp4","isArray","Android","end","PlayReady","streamType","1772WtcYWF","]: ","Frame gap: ","nextKeyFrameAllowedTime","use rtcDrmFeedFrame to push frames manually","Error recovery attempted","merchant","FairPlay","requestMediaKeySystemAccess(","pipeThrough","/license-server-fairplay/","isChrome","type","MSE (re)init","const DUMMY_IDR_FRAME_SLICE_HDR0=new Uint8Array([32,0,203]),DUMMY_IDR_FRAME_SLICE_HDR1=new Uint8Array([16,0,50]);","DRM config env value must be one of: ","length","GOP is getting too long, requesting a new key frame","Worker","let brokenFrame=null,idrFrames=[];function initializeDummyFrames(){brokenFrame=new Uint8Array([0,0,0,1,65,154,255","srcObject","RTCRtpScriptTransform","),idrFrames.push(idrFrames[0].slice());let $=new Uint8Array(idrFrames[1]);$.set([16,0,50],27)}let idrPicIdToggle=","now"," to ","join","setServerCertificate","audioCapabilities","lastKeyFrameTime","prevSeqNum"," seeking from ",".experiment","clRtcDrmDebugLog","Server certificate fetch failed with error ","isFirefox","org.w3.clearkey","x-dt-custom-data","jitterBufferTarget","playbackRate","enabled","keyFrameNeeded","createEncodedStreams","wvCertificateUrl","key","sai","Discarding corrupted video frame (too small)",'gle^=1]}function audioTransformFunction($,e){postMessage({streamType:"audio",frame:{timestamp:$.timestamp,data:$.',"H264 is the only supported video codec.","com.microsoft.playready.recommendation"," will be used","DRM config iv must be an instance of 16-byte long Uint8Array.","encryption","0;function generateDummyFrame($){return(brokenFrame||initializeDummyFrames(),$)?brokenFrame:idrFrames[idrPicIdTog","toString","message","status","bytesSinceKey","currentTime","supportsRtpScriptTransform","1585647fRskxG","audioElement","track","sinf","createObjectURL","enqueue","Invalid videoElement, it must be an instance of HTMLVideoElement.","7302558TqFWae","pipeTo","SampleAuxInfo extraction failed (video)","isEdge","keys","not-allowed","rtcdrmerror","btoa","?audioTransformFunction:videoTransformFunction});e.pipeThrough(a).pipeTo(x)}self.RTCTransformEvent&&(self.onrtctr",", a1d1f1 is recommended).","reportDiscontinuity","onFetch","keyId","sessionTypes","). Edge only supports PlayReady, Widevine and ClearKey.","audioEncrypted","audioStartTimestamp","frame","videoStartTimestamp","184,32,0,203,255,38,29,217,24,192,161,96,0,0,12,229,174,166,6,7,20,3,84,0,247,96,193,181,229,128,0,32,32]).buffer","Duplicate/reordered frame, prev seq: ","ClearKey is not supported by Safari.","bind",") not found in [","DRM config robustness can only be one of: ","persistent-license","postMessage","receiver","get","both","jmuxer","Production","Blob","timestamp","cenc","emeConfig","clear","cbcs-1-9","5iKPdqC","isWindows","PlayReady license acquisition might fail without output protection enabled (sessionId is ","). Chrome only supports Widevine and ClearKey.","mediaBufferMs should be an integer.","size","certificate","prLicenseUrl","fpsLicenseUrl","/license-proxy-widevine/cenc/","4572770OAoUlm","BYTES_PER_ELEMENT","then","SW_SECURE_CRYPTO","ansform=$=>{let e=$.transformer;handleTransform(e.options.operation,e.readable,e.writable)}),onmessage=$=>{keyFra","splice","Safari doesn't support 'cenc'/AES-CTR, use 'cbcs' instead if possible.","videoElement","rtcDrmConfigure did not specify audioElement, audio will be dropped",'audio/mp4; codecs="opus"',"object","Invalid audioElement, it must be an instance of HTMLMediaElement.","keyFrameNeededPosted","debugCreateMediaDump","next","play","6591266VeIbXo","userId","jitterBufferDelayHint",'ame(keyFrameNeeded),e.enqueue($)}function handleTransform($,e,x){let a=new TransformStream({transform:"audio"===$',"dispatchEvent","reduce"," bytes, playback at ","offset","arrayBuffer","waitingForIdr","Widevine","DRM config mediaBufferMs should be an integer.","hwSecurity","authToken","audio"," bytes)","push","licenseUrl","Default transform mode enabled, ","RTCRtpScriptTransform/TransformStream will not be created, ","GET","baseUrl","video","trim","7377TdQrIK","3000","playoutDelayHint","catch","fpsCertificate","POSITIVE_INFINITY","/license-server-fairplay/cert/","DRM config:","streams","mediaBufferMs","log","codec","onmessage","Target video element (","Applying pre-configured certificate (","webkitURL","Discarding corrupted video frame (no Annex B startcode)"," requesting a new key frame (latency ","PlayReady might not support '","No target media element!","URL","set","warn","data","config","isSafari","forEach","setMediaKeys","buffered"," - ","keySystem",'data}}),e.enqueue($)}let keyFrameNeeded=!1;function videoTransformFunction($,e){postMessage({streamType:"video",f',"paused","wvCertificate","a1d1f1","2000","keyFrameRequestInterval","Several DRM configs detected, rtcDrmOnTrack have to be called with target DRM config.","error","238HZxcdH","HW_SECURE_ALL","Invalid DRM type (","buffer","x-dt-auth-token","clRtcDrmCreateMediaDump",'rame:{type:$.type,timestamp:$.timestamp,data:$.data}}),"key"===$.type&&(keyFrameNeeded=!1),$.data=generateDummyFr',"addEventListener",") failed","keyFrameLogCntr","feed","byteLength","kind","purchase","environment","videoCapabilities","requestMediaKeySystemAccess","temporary","). It has to be a string containing a JWT.","value",".. ","string"];return(no=function(){return e})()}!function(){const e=_o,t=no();for(;;)try{if(parseInt(e(543))/1*(parseInt(e(512))/2)+parseInt(e(473))/3*(parseInt(e(568))/4)+-parseInt(e(672))/5*(-parseInt(e(634))/6)+-parseInt(e(536))/7+parseInt(e(560))/8*(parseInt(e(627))/9)+-parseInt(e(682))/10+-parseInt(e(449))/11==932877)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();const ro=si[to(626)],so=si[to(602)],io=si[to(498)],oo=si[to(637)],ao=si[to(579)],co=si.platform,lo=si[to(673)],uo=oo||ao&&co===to(564),po=1e6*(so?82:io?220:120),fo=so?5e3:2e3,ho=so?1.5:.5;class Ya{constructor(e){const t=to;this[t(545)]="",this.licenseUrl="",this[t(503)]="",this[t(669)]=[],this[t(497)]=function e(t){const n=to;return typeof t!==n(692)||null===t||t instanceof Element||t instanceof De?t:function(e){const t=to;return!!((null==e?void 0:e[t(515)])instanceof ArrayBuffer&&null!=e&&e[t(683)])}(t)?t[n(559)]():Array[n(563)](t)?t[n(454)]((t,n,r)=>(t[r]=e(n),t),[]):t instanceof Object?Object[n(638)](t)[n(454)]((n,r)=>(n[r]=e(t[r]),n),{}):t}(e),this[t(664)]=null,this[t(521)]=0,this[t(571)]=Date.now(),this.videoStartTimestamp=0,this.audioStartTimestamp=0,this.prevSeqNum=-1,this[t(596)]=0,this[t(624)]=0,this.keyFrameNeeded=!0,this.keyFrameNeededPosted=!1,this.keyFrameRequestInterval=fo,this.worker=null}}const mo=new Map,go=new Uint8Array([60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60]),yo=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1]),vo=new Uint8Array([213,251,214,184,46,217,62,78,249,138,228,9,49,238,51,183]);function bo(e){const t=to;let n=!1;if((e[t(497)].video&&"clear"!==e[t(497)].video[t(619)]&&"HW"===e.config[t(471)][t(554)]||e[t(497)][t(463)]&&e[t(497)][t(463)].encryption!==t(670)&&"HW"===e[t(497)][t(463)][t(554)])&&(n=!0),e.hwSecurity=n,function(e,t){const n=to;void 0!==t&&(e[n(497)][n(482)]=t),(void 0===e[n(497)][n(482)]||e[n(497)].mediaBufferMs<0)&&(e.config[n(482)]=100,so?e[n(497)][n(482)]=350:!io&&lo&&(e[n(497)][n(580)]===n(566)||e[n(461)])&&(e[n(497)][n(482)]=1400))}(e,e[t(497)][t(482)]),void 0===e.config.authToken){void 0===e.config[t(450)]&&(e[t(497)][t(450)]=t(525)),void 0===e[t(497)][t(551)]&&(e.config[t(551)]=t(507));const n=window[t(641)](JSON.stringify({userId:e.config[t(450)],sessionId:e[t(497)][t(551)],merchant:e.config[t(574)]}));$i(t(604),n)}else $i(t(516),e.config[t(462)]);for(const n of[e[t(497)].audio,e[t(497)][t(471)]])n&&n[t(619)]!==t(670)&&(n[t(646)]||(n[t(646)]=yo),n.iv||(n.iv=vo));e[t(546)]=void 0,e[t(545)]="",e[t(466)]="";const r=e.config[t(526)][t(470)]();var s;if(e[t(497)][t(580)]===t(549)?(e.keySystem=t(603),Zi=go):e.config.type===t(459)?(e[t(503)]="com.widevine.alpha",lo&&n&&(e[t(503)]+=t(599)),e.config.wvCertificate?e[t(546)]=e[t(497)][t(506)]:e[t(497)][t(610)]?e[t(545)]=e[t(497)][t(610)]:e[t(546)]=e.config[t(526)][t(678)](),e.config.wvLicenseUrl?e[t(466)]=e[t(497)].wvLicenseUrl:e[t(466)]=r+t(681)):e[t(497)][t(580)]===t(566)?(e[t(503)]=t(616),e[t(497)][t(679)]?e.licenseUrl=e[t(497)][t(679)]:e[t(466)]=r+t(542)):e[t(497)].type===t(575)&&(e.keySystem="com.apple.fps",e.config[t(477)]?e[t(546)]=e[t(497)][t(477)]:e[t(497)][t(535)]?e.serverCertificateUrl=e.config[t(535)]:e[t(545)]=r+t(479)+e[t(497)].merchant,e[t(497)][t(680)]?e[t(466)]=e.config.fpsLicenseUrl:e.licenseUrl=r+t(578)),s={licenseUrl:e[t(466)],onFetch:e.config[t(645)]},Mi=s,e[t(669)]=[],e.config[t(580)]!==t(575)){e[t(669)][t(465)]({initDataTypes:[t(668)],sessionTypes:["persistent-license",t(529)]});for(const n of[e[t(497)][t(471)],e[t(497)][t(463)]])if(n&&n.encryption!==t(670)){const r=n==e[t(497)][t(471)]?t(471):t(463);let s;e[t(497)][t(580)]===t(459)?s="HW"===n[t(554)]?t(513):t(685):"PlayReady"===e[t(497)][t(580)]&&(s="HW"===n.robustness?t(474):t(508)),r===t(471)?e[t(669)][0][t(527)]=[{contentType:'video/mp4; codecs="avc1.640032"',encryptionScheme:"cenc"===n[t(619)]?t(668):"cbcs-1-9",robustness:s||void 0}]:e[t(669)][0][t(595)]=[{contentType:t(691),encryptionScheme:n[t(619)]===t(668)?"cenc":t(671),robustness:s||void 0}]}}else e[t(669)]=[{initDataTypes:[t(630)],videoCapabilities:[{contentType:t(562),robustness:""}],distinctiveIdentifier:"not-allowed",persistentState:t(639),sessionTypes:["temporary"]}];window[t(600)]&&console.info(t(480),e)}function wo(e){const t=to;window[t(600)]&&console[t(556)](t(581));let n=e[t(497)].videoElement;(!e[t(497)][t(471)]||e.config[t(471)][t(619)]===t(670))&&(n=e.config.audioElement),e[t(664)]=null;const r=!e.ignoreAudio&&e[t(497)][t(463)]&&"clear"!==e[t(497)].audio[t(619)],s=e[t(497)][t(471)]&&e.config.video[t(619)]!==t(670);e[t(624)]=0,e[t(608)]=!0,e.keyFrameNeededPosted=!1,e[t(509)]=fo,e[t(652)]=0,e[t(650)]=0,e[t(597)]=-1,e[t(596)]=0,e.jmuxer=new Tn({node:n,mode:r?t(s?663:463):"video",fps:60,drm:e}),io&&e[t(497)].videoElement&&e[t(497)][t(689)][t(448)]()[t(684)](()=>{})[t(476)](()=>{})}function So(e,t,n){const r=to;if(e[r(497)][r(471)]&&"clear"===e.config[r(471)][r(619)])return null==n||n[r(632)](t),!1;const s=Date[r(591)]();if(t.type===r(611)){const n=window[r(600)];++e[r(521)]<(n?Number[r(478)]:5)&&(console[r(556)]((new Date)[r(552)]().slice(11,-1)+" "+t[r(580)]+", "+(t[r(496)].byteLength+r(455)+e[r(497)][r(689)][r(625)])),n&&1===e[r(521)]&&function(e,t=64,n=64){const r=to,s=new Uint8Array(e[r(496)]);let i="",o=0;for(let e=0;e<t&&e<s[r(584)];++e)i+=(s[e]<16?"0":"")+s[e].toString(16)+" ";if(o<s[r(584)])for(o<s[r(584)]-n&&(i+=r(532),o=s[r(584)]-n);o<s[r(584)];o++)i+=(s[o]<16?"0":"")+s[o][r(621)](16)+" ";console.info("["+((e[r(580)]||r(463))+r(561))+r(569)+i[r(472)]())}(t,128,8)),e[r(608)]=!1,e[r(624)]=0,e[r(571)]=s+e[r(509)]}return e[r(624)]+=t.data[r(523)],!e[r(608)]&&e[r(624)]>po&&(console[r(556)](r(585)),e[r(608)]=!0),e.jmuxer&&(function(e,t){const n=to;0===e[n(652)]&&(e[n(652)]=t[n(667)],e[n(509)]=fo,e[n(571)]=Date[n(591)]()+2e3);let r=null,s=!1;if(t.data[n(523)]<=4)console[n(495)](n(613)),s=!0;else{const i=new Uint8Array(t[n(496)],0,4);0!=i[0]||0!=i[1]||0!=i[2]||1!=i[3]?(console[n(495)](n(489)),s=!0):(r=function(e,t){const n=xi,r=new DataView(e[n(335)]),s=e.data[n(346)]-2,i=r[n(340)](s);if(i<s){let e=s-i;if(69!==r[n(337)](s-1))return console[n(341)](n(339)),null;if(r.getUint8(e++)>>>4!=1)return console[n(341)](n(329)),null;const o=new Uint8Array(i-2);let a=0,c=0;for(;e<s-1;){let t=r.getUint8(e++);c>1&&3===t&&(c=0,t=r.getUint8(e++)),0!==t?c=0:++c,o[a++]=t}const l=new DataView(o[n(343)]),u=t===n(327)?16:0,d=u+2+6*l.getUint16(u);return d+2>a?(console.error(n(325)),null):{sai:o[n(345)](0,d),offset:s-i,seq:l.getUint16(d)}}return null}(t,e[n(497)][n(471)][n(619)]),!r&&(console.warn(n(636)),s=!0))}if(r)if(-1===e[n(597)]){if(t[n(580)]!==n(611))return 0;e[n(597)]=r[n(547)]}else{let i=r.seq-e[n(597)];if(i<-32767&&(i+=65536),i<=0)return window[n(600)]&&console[n(495)](n(654)+e[n(597)]+", curr: "+r[n(547)]),0;i>1&&(s=t[n(580)]!==n(611),console[n(495)](n(570)+e[n(597)]+n(502)+r[n(547)]+n(541)+s)),e.prevSeqNum=r[n(547)]}let i=0;s&&!e[n(664)][n(458)]&&(i=-1,e[n(664)][n(644)]());const o=(t[n(667)]-e[n(652)])/9e4;return r&&e[n(664)][n(522)]({video:new Uint8Array(t.data,0,r[n(456)]),videoSampleAuxInfo:r[n(612)],timestamp:o})<0&&(i=-1,console[n(495)](n(573)),wo(e)),i>=0&&"key"===t[n(580)]&&(e[n(596)]=o,console[n(483)]((new Date)[n(552)]()[n(559)](11,-1)+" kf at "+o+", playback at "+e[n(497)].videoElement[n(625)])),i}(e,t)<0?e[r(608)]=!0:function(e){const t=to,n=e.config[t(689)];if(!n||n[t(501)][t(584)]<1||n[t(505)]||n[t(625)]<ho)return;const r=e[t(497)].mediaBufferMs;if(void 0===r||r<0)throw new Error("targetLatency not set!");const s=n[t(501)][t(565)](n[t(501)][t(584)]-1),i=1e3*(s-n[t(625)])|0;if(!e[t(649)]&&function(e,t,n){const r=to;let s;s=t<3*n>>>2?.875:t<=n?1:t<7*n>>>2?1.125:t<9*n>>>2?1.25:t<11*n>>>2?1.375:1.5,s!==e.playbackRate&&(e[r(606)]=s)}(n,i,r),!(i<r+50||i<5*r>>>2))if(e.lastKeyFrameTime>n[t(625)]+.1){const i=1e3*(s-e[t(596)])|0;i>40&&i>r-100?(window[t(600)]&&console.info((new Date).toISOString().slice(11,-1)+t(598)+(n[t(625)]+t(592)+e[t(596)]+" (")+(e.lastKeyFrameTime-n[t(625)])+")"),n[t(625)]=e[t(596)]):console[t(483)]((new Date)[t(552)]().slice(11,-1)+t(534)+i)}else!e[t(608)]&&Date[t(591)]()>e[t(571)]&&i>r+100&&i>3*r>>>1&&(window[t(600)]&&console[t(556)]((new Date).toISOString()[t(559)](11,-1)+t(490)+i+" ms)"),e[t(608)]=!0,e[t(509)]<16e3&&(e[t(509)]<<=1))}(e)),n?(!e[r(608)]||!uo)&&(t[r(496)]=function(e){return!Ai&&function(){const e=Ci;Ai=new Uint8Array([0,0,0,1,65,154,255,255]).buffer,Li[e(303)](new Uint8Array([0,0,0,1,39,100,0,13,172,87,5,6,100,0,0,0,1,40,238,60,176,0,0,0,1,37,184,32,0,203,255,38,29,217,24,192,161,96,0,0,12,229,174,166,6,7,20,3,84,0,247,96,193,181,229,128,0,32,32])[e(306)]),Li[e(303)](Li[0][e(299)](0)),new Uint8Array(Li[1]).set([16,0,50],27)}(),e?Ai:(Oi^=1,Li[Oi])}(e[r(608)]),n[r(632)](t)):e[r(608)]!=e[r(445)]&&(e.worker&&e[r(544)][r(660)](e[r(608)]),e[r(445)]=e[r(608)]),e[r(608)]}function _o(e,t){const n=no();return(_o=function(e,t){return n[e-=445]})(e,t)}function Ro(e,t,n){const r=to;return e[r(497)][r(463)]&&e[r(497)].audio[r(619)]!==r(670)?t[r(496)][r(523)]>0&&function(e,t){const n=to;var r;if(!e.jmuxer||e[n(538)])return 0;0===e[n(650)]&&(e[n(650)]=t[n(667)]);const s=(t[n(667)]-e.audioStartTimestamp)/48e3;if("cbcs"===(null===(r=e.config[n(463)])||void 0===r?void 0:r[n(619)]))return e[n(664)][n(522)]({audio:new Uint8Array(t[n(496)]),timestamp:s});const i=function(e){const t=xi,n=new DataView(e.data),r=e.data[t(346)]-2,s=n.getUint16(r);if(s<r){let e=r-s;if(69!==n[t(337)](r-1))return console[t(341)](t(339)),null;if(n[t(337)](e++)>>>4!=1)return console[t(341)](t(329)),null;const i=new Uint8Array(s-2);let o=0;for(;e<r-1;){const r=n[t(337)](e++);if(i[o++]=r,o>=16)break}return{sai:i,offset:r-s}}return null}(t);i?e[n(664)][n(522)]({audio:new Uint8Array(t[n(496)],0,i[n(456)]),audioSampleAuxInfo:i[n(612)],timestamp:s}):console[n(511)]("SampleAuxInfo extraction failed (audio)")}(e,t):n&&n[r(632)](t),!1}function Eo(e){const t=to;if(!e||typeof e!==t(692))throw new TypeError("Invalid config argument type, DRM config must be an object.");if(!(e[t(689)]instanceof HTMLVideoElement))throw new TypeError(t(633));if(e[t(628)]&&!(e.audioElement instanceof HTMLMediaElement))throw new TypeError(t(693));if(void 0!==e[t(482)]&&!Number[t(555)](e[t(482)]))throw new TypeError(t(460));let n=!1,r=!1,s=!1;const i=["cbcs",t(668),t(670)],o=["SW","HW"];for(const a of[e[t(471)],e[t(463)]])if(a){if(!i[t(557)](a[t(619)]))throw new RangeError("DRM config encryption value must be one of: "+i[t(593)](", "));if(io&&"cenc"===a.encryption)throw new RangeError(t(688));if(a[t(619)]!==t(670)){if(r=!0,a.keyId){if(!(a[t(646)]instanceof Uint8Array)||16!==a.keyId[t(584)])throw new TypeError("DRM config keyId must be an instance of 16-byte long Uint8Array.");s=!0}else if(io)throw new ReferenceError(t(655));if(a.iv&&(!(a.iv instanceof Uint8Array)||16!==a.iv.length))throw new TypeError(t(618));if(a[t(554)]&&!o[t(557)](a.robustness))throw new RangeError(t(658)+o[t(593)](", "));if(a===e[t(471)]&&a[t(484)]!==t(537))throw new RangeError(t(615));io&&a===e.audio&&"opus"===a.codec&&(n=!0,console.warn("Safari does not support Opus, audio will not be rendered.")),"PlayReady"===e[t(580)]&&(a[t(619)]!==t(668)&&console[t(495)](t(491)+a[t(619)]+"', it's safer to use 'cbcs' instead."),void 0===e.sessionId||e.sessionId[t(557)]("f1")||console.warn(t(674)+e.sessionId+t(643)))}}if(r){const n=[De[t(558)],De.Staging,De[t(665)]];if(!n.includes(e[t(526)]))throw new RangeError(t(583)+n.join(", "));if(e[t(462)]&&typeof e[t(462)]!==t(533))throw new TypeError("Invalid authToken type ("+typeof e[t(462)]+t(530));if(e.type)if(io){if(e[t(580)]!==t(575))throw new RangeError(t(514)+e[t(580)]+"). Safari only supports FairPlay.")}else if(ao){if(e.type!==t(459)&&"ClearKey"!==e[t(580)])throw new RangeError("Invalid DRM type ("+e.type+t(675))}else if(oo&&e[t(580)]!==t(566)&&"Widevine"!==e[t(580)]&&"ClearKey"!==e[t(580)])throw new RangeError(t(514)+e.type+t(648))}void 0!==e.debugLog&&(window[t(600)]=e.debugLog),void 0!==e[t(446)]&&(window[t(517)]=e[t(446)]);let a=mo.get(e[t(689)]);!a&&(a=new Ya(e),mo[t(494)](e[t(689)],a)),a.enabled=r,a[t(538)]=n,a[t(649)]=!n&&a[t(497)][t(463)]&&a[t(497)].audio.encryption!==t(670),r&&(a[t(497)].type||(a[t(497)][t(580)]=t(io?575:459)),s||a[t(497)][t(580)]===t(549)||(a[t(497)][t(580)]=t(549)),bo(a),function(e){Ds(this,void 0,void 0,(function*(){const t=_o;var n,r;let s=e[t(497)][t(689)];if((!e[t(497)][t(471)]||e[t(497)][t(471)].encryption===t(670))&&(s=e[t(497)][t(628)]),!s)throw new Error(t(492));s.src="",s[t(588)]=null,yield s.setMediaKeys(null);let i=null;try{i=yield navigator[t(528)](e[t(503)],e.emeConfig)}catch(e){}if(!i&&e[t(669)][0]){const s=null===(n=e[t(669)][0][t(647)])||void 0===n?void 0:n[t(553)](t(659));if(void 0!==s&&s>=0){null===(r=e.emeConfig[0].sessionTypes)||void 0===r||r[t(687)](s,1);try{i=yield navigator[t(528)](e[t(503)],e[t(669)])}catch(e){}}}if(!i){const n=t(576)+e[t(503)]+t(520);return s.dispatchEvent(new CustomEvent(t(640),{detail:{message:n}})),void console[t(511)](n)}let o=null;try{o=yield i.createMediaKeys()}catch(e){}if(!o){const n=t(540)+e[t(503)]+t(520);return s[t(453)](new CustomEvent("rtcdrmerror",{detail:{message:n}})),void console[t(511)](n)}if(e.serverCertificate)window.clRtcDrmDebugLog&&console[t(556)](t(487)+e[t(546)][t(523)]+t(464)),yield o[t(594)](e[t(546)]);else if(e.serverCertificateUrl){const n={method:t(469)},r=e.serverCertificateUrl;try{const i=yield e[t(497)].onFetch?e.config[t(645)](r,n):fetch(r,n);if(!i.ok){const e=t(601)+i[t(623)];return void s[t(453)](new CustomEvent(t(640),{detail:{message:e}}))}const a=yield i[t(457)]();window.clRtcDrmDebugLog&&console[t(556)]("Fetched certificate from "+r+", "+a[t(523)]+" bytes"),yield o[t(594)](a)}catch(e){const n=e.name+": "+e[t(622)];return console.error(n),void s[t(453)](new CustomEvent(t(640),{detail:{message:n}}))}}yield s[t(500)](o),s[t(519)]("encrypted",eo),wo(e)}))}(a)),a[t(497)][t(689)][t(519)](t(448),(function(){const e=t;a[e(497)][e(689)][e(625)]>.5&&(a[e(571)]=Date.now())}))}const Io=to(582)+to(587)+to(548)+to(653)+to(590)+to(620)+to(614)+to(504)+to(518)+to(452)+to(642)+to(686)+"meNeeded=$.data};";function ko(e){const t=to;if(0===mo[t(677)])throw new TypeError(t(550));let n;if(e&&e[t(689)])n=e[t(689)];else{if(1!==mo.size)throw new TypeError(t(510));n=mo[t(638)]()[t(447)]()[t(531)]}const r=mo[t(662)](n);if(!r){let e="";throw mo[t(499)]((t,n)=>{e+=n.id+", "}),e=e.slice(0,-2),new TypeError(t(486)+n.id+t(657)+e+"]")}return r}function xo(e,t){const n=to;if(e&&e[n(497)][n(689)]){const r=e[n(497)][n(689)];if(r[n(501)].length>0){const e=r.buffered[n(565)](r[n(501)][n(584)]-1)-r[n(625)];t.playoutDelayHint=t.jitterBufferDelayHint=t.jitterBufferTarget=e}setTimeout(xo,1e3,e,t)}}const To=Be.get("View");To.setLevel(Be.DEBUG);const Co={metadata:!1,enableDRM:!1,disableVideo:!1,disableAudio:!1,peerConfig:{autoInitStats:!0,statsIntervalMs:1e3}};class cc extends bi{constructor(e,t,n=null,r=!0){e&&To.warn("The streamName property has been deprecated. In a future release, this will be removed. Please do not rely on this value. Instead, set via token generator"),super(null,t,To,r),this.payloadTypeCodec={},this.tracksMidValues={},this.drmOptionsMap=null,this.eventQueue=[],this.isMainStreamActive=!1,n&&(this.on(Yr.track,e=>{n.srcObject=e.streams[0]}),To.warn("The mediaElement property has been deprecated. In a future release, this will be removed. Please do not rely on this value. Instead, do this in either the `track` or the `active` broadcast event."))}async connect(e=Co){this.options=oe(ie(ie({},Co),e),{peerConfig:ie(ie({},Co.peerConfig),e.peerConfig),setSDPToPeer:!1}),this.eventQueue.length=0,await this.initConnection({migrate:!1})}async select(e={}){To.debug("Viewer select layer values: ",e),await this.signaling.cmd("select",{layer:e}),To.info("Connected to streamName: ",this.streamName)}async addRemoteTrack(e,t){To.info("Viewer adding remote track",e);const n=await this.webRTCPeer.addRemoteTrack(e,t);for(const e of t)e.addTrack(n.receiver.track);return n}async project(e,t){for(const e of t){if(!e.trackId&&!e.media)throw To.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=this.webRTCPeer.getRTCPeer();if(e.mediaId&&!t.getTransceivers().find(t=>t.mid===e.mediaId.toString()))throw To.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"))}To.debug("Viewer project source: layer mappings: ",e,t),await this.signaling.cmd("project",{sourceId:e,mapping:t}),To.info("Projection done")}async unproject(e){To.debug("Viewer unproject mediaIds: ",e),await this.signaling.cmd("unproject",{mediaIds:e}),To.info("Unprojection done")}async replaceConnection(){To.info("Migrating current connection"),await this.initConnection({migrate:!0})}stop(){var e,t;super.stop(),null==(e=this.drmOptionsMap)||e.clear(),this.DRMProfile=null,null==(t=this.worker)||t.terminate(),this.worker=null,this.payloadTypeCodec={},this.tracksMidValues={},this.eventQueue.length=0}async initConnection(e){var t;let n,r;if(To.debug("Viewer connect options values: ",this.options),this.stopReconnection=!1,!e.migrate&&this.isActive())throw To.warn("Viewer currently subscribed"),new Error("Viewer currently subscribed");try{r=await this.tokenGenerator(),this.options.peerConfig.iceServers=null==r?void 0:r.iceServers,this.options.peerConfig.encodedInsertableStreams=Ts&&(this.options.enableDRM||this.options.metadata)}catch(e){throw To.error("Error generating token."),e instanceof mr&&(401!==e.status&&this.autoReconnect?this.reconnect():this.stopReconnection=!0),e}if(!r)throw To.error("Error while subscribing. Subscriber data required"),new Error("Subscriber data required");const s=Rs(r.jwt);this.streamName=s.millicast.streamName;const i=new mi({streamName:this.streamName,url:"".concat(r.urls[0],"?token=").concat(r.jwt)});r.subscriberToken&&(this.subscriberToken=r.subscriberToken);const o=e.migrate?new tt:this.webRTCPeer;await o.createRTCPeer(this.options.peerConfig),null==(t=this.stopReemitingWebRTCPeerInstanceEvents)||t.call(this),this.stopReemitingWebRTCPeerInstanceEvents=ht(o,this,Object.values(Yr).filter(e=>e!==Yr.track)),this.options.metadata&&(this.worker||(this.worker=new Os),this.worker.onmessage=e=>{if("metadata"===e.data.event){const t=new TextDecoder,n=e.data.metadata;if(n.mid=e.data.mid,n.track=this.tracksMidValues[e.data.mid],n.uuid){const e=n.uuid;n.uuid=e.reduce((e,t)=>e+t.toString(16).padStart(2,"0"),""),n.uuid=n.uuid.replace(/(.{8})(.{4})(.{4})(.{4})(.{12})/,"$1-$2-$3-$4-$5")}if(n.timecode&&(n.timecode=new Date(t.decode(n.timecode))),n.unregistered){const e=t.decode(n.unregistered);try{const t=JSON.parse(e);n.unregistered=t}catch(e){To.info("The content could not be converted to JSON, returning raw bytes instead")}}this.emit("metadata",n),this.emit("onMetadata",n)}}),o.on(Yr.track,e=>{this.isMainStreamActive?this.onTrackEvent(e):this.eventQueue.push(e)}),i.on(cs,async e=>{if(this.isMainStreamActive||"active"!==e.name)"inactive"===e.name&&this.isMainStreamActive&&this.mainSourceId===e.data.sourceId&&(this.isMainStreamActive=!1),this.emit(cs,e);else{if(this.mainSourceId=e.data.sourceId,!this.DRMProfile&&e.data.encryption){const e=await this.tokenGenerator();e.drmObject&&(this.DRMProfile=e.drmObject)}for(this.emit(cs,e),this.isMainStreamActive=!0;this.eventQueue.length>0;)this.onTrackEvent(this.eventQueue.shift())}});const a=o.getRTCLocalSDP(oe(ie({},this.options),{stereo:!0})),c=i.connect();n=await Promise.all([a,c]);const l=n[0];let u=this.signaling;this.signaling=i;const d=this.signaling.subscribe(l,oe(ie({},this.options),{vad:this.options.multiplexedAudioTracks>0})),p=o.peer.setLocalDescription(o.sessionDescription);n=await Promise.all([d,p]);const f=n[0];this.payloadTypeCodec=Ur.getCodecPayloadType(f),await o.setRTCRemoteSDP(f),To.info("Connected to streamName: ",this.streamName);let h=this.webRTCPeer;this.webRTCPeer=o,this.setReconnect(),e.migrate&&this.webRTCPeer.on(Yr.connectionStateChange,e=>{var t,n;"connected"===e?setTimeout(()=>{var e,t;null==(e=null==u?void 0:u.close)||e.call(u),null==(t=null==h?void 0:h.closeRTCPeer)||t.call(h),u=h=null,To.info("Current connection migrated")},1e3):["disconnected","failed","closed"].includes(e)&&(null==(t=null==u?void 0:u.close)||t.call(u),null==(n=null==h?void 0:h.closeRTCPeer)||n.call(h),u=h=null)})}onTrackEvent(e){var t,n,r;if(this.tracksMidValues[null==(t=e.transceiver)?void 0:t.mid]=e.track,this.isDRMOn){const t=e.transceiver.mid,n=this.getDRMConfiguration(t);try{!function(e,t){const n=to;var r,s;const i=e[n(629)][n(524)];"video"===i&&(e[n(661)][n(475)]=e[n(661)][n(451)]=e[n(661)][n(605)]=0);const o=ko(t),a=o[n(497)].videoElement,c=o[n(497)][n(628)];if(o[n(607)]){if(o[n(497)].customTransform)window.clRtcDrmDebugLog&&console[n(556)](n(468)+n(572));else if(window[n(600)]&&console[n(556)](n(467)+(n(ro?589:609)+n(617))),ro){if(o[n(544)]=function(e){const t=to,n=window[t(493)]||window[t(488)],r=window[t(666)],s=window[t(586)];if(!(n&&r&&s&&e))return null;const i=new r([e]);return new s(n[t(631)](i))}(Io),null==o[n(544)])throw new Error(n(539));o[n(544)][n(485)]=e=>{const t=n;e[t(496)][t(567)]===t(471)?So(o,e[t(496)].frame,null):Ro(o,e[t(496)][t(651)],null)},e[n(661)].transform=new RTCRtpScriptTransform(o.worker,{operation:i})}else{const t=i===n(471)?So:Ro,r={drm:o,transform:(e,n)=>{t(o,e,n)}},s=e.receiver.createEncodedStreams(),a=new TransformStream({transform:r.transform[n(656)](r)}),{readable:c,writable:l}=s;c[n(577)](a)[n(635)](l)}if("audio"===i&&(null===(r=o[n(497)][n(463)])||void 0===r?void 0:r.encryption)===n(670)){if(!c)return void console.warn(n(690));c[n(588)]!==e[n(481)][0]&&(c[n(588)]=e[n(481)][0]),o[n(497)].videoElement&&(e[n(661)][n(475)]=e[n(661)].jitterBufferDelayHint=e[n(661)][n(605)]=o[n(497)][n(482)],xo(o,e[n(661)]))}else"video"===i&&"clear"===(null===(s=o.config[n(471)])||void 0===s?void 0:s[n(619)])&&a[n(588)]!==e[n(481)][0]&&(a.srcObject=e.streams[0])}else a[n(588)]!==e[n(481)][0]&&(a.srcObject=e[n(481)][0])}(e,n)}catch(e){To.error("Failed to apply DRM on media Id:",t,"error is: ",e),this.emit("error",new Error("Failed to apply DRM on media Id: "+t+" error is: "+e))}this.worker||(this.worker=new Os),this.worker.addEventListener("message",e=>{"complete"===e.data.event&&function(e,t,n){const r=to,s=ko(n);e[r(580)]?So(s,e,t):Ro(s,e,t)}(e.data.frame,null,n)})}if(this.options.metadata)if(Cs)e.receiver.transform=new RTCRtpScriptTransform(this.worker,{name:"receiverTransform",payloadTypeCodec:ie({},this.payloadTypeCodec),codec:this.options.metadata&&"h264",mid:null==(n=e.transceiver)?void 0:n.mid});else if(Ts){const{readable:t,writable:n}=e.receiver.createEncodedStreams();this.worker.postMessage({action:"insertable-streams-receiver",payloadTypeCodec:ie({},this.payloadTypeCodec),codec:this.options.metadata&&"h264",mid:null==(r=e.transceiver)?void 0:r.mid,readable:t,writable:n},[t,n])}this.emit(Yr.track,e)}getDRMConfiguration(e){return this.drmOptionsMap?this.drmOptionsMap.get(e):null}async onRtcDrmFetch(e,t){return t.headers||(t.headers=new Headers),t.headers.get("x-dt-custom-data")&&t.headers.delete("x-dt-custom-data"),this.subscriberToken?t.headers.append("Authorization","Bearer ".concat(this.subscriberToken)):To.warn("onRtcDrmFetch: no subscriberToken"),fetch(e,t)}configureDRM(e){if(!e)throw new Error("Required DRM options is not provided");this.drmOptionsMap||(this.drmOptionsMap=new Map);const t={merchant:"dolby",environment:De.Production,customTransform:this.options.metadata,videoElement:e.videoElement,audioElement:e.audioElement,video:{codec:"H264",encryption:"cbcs",keyId:Ps(e.videoEncryptionParams.keyId),iv:Ps(e.videoEncryptionParams.iv)},audio:{codec:"opus",encryption:"clear"},onFetch:this.onRtcDrmFetch.bind(this)};e.mediaBufferMs&&(t.mediaBufferMs=e.mediaBufferMs),this.DRMProfile&&(this.DRMProfile.playReadyUrl&&(t.prLicenseUrl=this.DRMProfile.playReadyUrl),this.DRMProfile.widevineUrl&&(t.wvLicenseUrl=this.DRMProfile.widevineUrl),this.DRMProfile.fairPlayUrl&&(t.fpsLicenseUrl=this.DRMProfile.fairPlayUrl),this.DRMProfile.fairPlayCertUrl&&(t.fpsCertificateUrl=this.DRMProfile.fairPlayCertUrl));try{Eo(t),this.drmOptionsMap.set(e.videoMid,t),e.audioMid&&this.drmOptionsMap.set(e.audioMid,t),t.videoElement.addEventListener("rtcdrmerror",e=>{To.error("DRM error: ",e.detail.message,"in video element:",t.videoElement.id),this.emit("error",new Error(e.detail.message))})}catch(t){To.error("Failed to configure DRM with options:",e,"error is:",t)}}removeDRMConfiguration(e){var t;null==(t=this.drmOptionsMap)||t.delete(e)}get isDRMOn(){return!!this.drmOptionsMap&&this.drmOptionsMap.size>0}exchangeDRMConfiguration(e,t){const n=this.getDRMConfiguration(e),r=this.getDRMConfiguration(t);if(null===n)throw new Error("No DRM configuration found for "+e);if(null===r)throw new Error("No DRM configuration found for "+t);Ns(n.video,r.video,"keyId"),Ns(n.video,r.video,"iv");try{Eo(n)}catch(e){To.error("Failed to configure DRM with options:",n,"error is:",e)}try{Eo(r)}catch(e){To.error("Failed to configure DRM with options:",r,"error is:",e)}}}var Lo,Ao=Object.freeze({__proto__:null,STATUS:"rts/status",VIEWER_COUNT:"rts/viewer-count",STATS:"rts/stats"});!function(e){e[e.Idle=0]="Idle",e[e.Receiving=1]="Receiving",e[e.Starting=2]="Starting"}(Lo||(Lo={}));const Oo="is-playing",Po="is-paused",No="is-loaded",Do="is-loading",Mo="is-starting",Fo="is-seeking",Uo="is-ended",jo="is-live",Wo="is-waiting",Zo="is-live-seeked",Vo="no-timeline",Go="will-play",Bo="will-pause",Yo="is-in-viewport";var Xo=Object.freeze({__proto__:null,PLAYING:Oo,FULLSCREEN:"is-fullscreen",PAUSED:Po,MUTED:"is-muted",LOADED:No,LOADING:Do,STARTING:Mo,SEEKING:Fo,GRABBING:"is-grabbing",DISABLED:"is-disabled",SMALL:"is-small",TINY:"is-tiny",RTL:"is-rtl",TV:"is-tv",ENDED:Uo,LIVE:jo,ERRORED:"is-error",WAITING:Wo,AUTOPLAY:"is-autoplay",SEAMLESS:"is-seamless",TOGGLING:"is-toggling",LIVE_SEEKED:Zo,NO_DVR:Vo,HAS_POSTER:"has-poster",WILL_PLAY:Go,WILL_PAUSE:Bo,MENU_OPENED:"has-menu-opened",TOUCHED:"is-touched",HOVERED:"is-hovered",TOUCH_DEVICE:"is-touch-device",WILL_SEEK:"will-seek",SEEKABLE:"is-seekable",IN_VIEWPORT:Yo,NO_CONTROLS:"no-controls",DESTROYED:"is-destroyed",IS_SOURCE_PROCESSING:"is-source-processing"});const zo=[],Ko=[];function $o(){const e="undefined"!=typeof document&&"undefined"!=typeof window,t=e?navigator.userAgent:"",n=/iP(hone|od)/i.test(t)&&!/iPad/.test(t)&&!/IEMobile/i.test(t),r=/Android/.test(t)&&!/Firefox/.test(t),s=/^((?!chrome|android).)*safari/i.test(t),i=/chrome|crios/i.test(t)&&!/opr|opera|chromium|edg|ucbrowser|googlebot/i.test(t),o=/firefox|fxios/i.test(t)&&!/seamonkey/i.test(t),a=/edg/i.test(t),c=/opr|opera/i.test(t),l=/SamsungBrowser/.test(t),u=l&&/SMART-TV/.test(t);return{controls:!n,video:function(t){return e&&document.createElement("video").canPlayType(t)},lang:e&&window.navigator.language,android:r,iphone:n,safari:s,edge:a,opera:c,chrome:i,firefox:o,ios:e&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,samsung:l,samsung_tv:l&&u,touch:"ontouchstart"in window,tizen:"tizen"in window,webOS:"webos"in window}}var Ho=Object.freeze({__proto__:null,SUBTITLES_MENU:"flowplayer-subtitles-menu",SHARE_MENU:"flowplayer-share-menu",SPEED_MENU:"flowplayer-speed-menu",QUALITY_MENU:"flowplayer-quality-menu",AUDIO_MENU:"flowplayer-audio-menu",VIDEO_MENU:"flowplayer-video-menu",UI:"flowplayer-ui",LOGO:"flowplayer-logo",CONTROL:"flowplayer-control",CONTROL_BUTTONS:"flowplayer-control-buttons",LIVE_STATUS:"flowplayer-live-status",ELAPSED:"flowplayer-elapsed-time",TIMELINE:"flowplayer-timeline-bar",CHAPTERS_TIMELINE:"flowplayer-chapters-timeline-bar",CONTROL_DURATION:"flowplayer-control-duration",VOLUME_CONTROL:"flowplayer-volume-control",VOLUME_BAR:"flowplayer-volume-bar",HEADER:"flowplayer-header",HEADER_LEFT_ZONE:"flowplayer-header-left-zone",HEADER_RIGHT_ZONE:"flowplayer-header-right-zone",HEADER_DURATION:"flowplayer-header-duration",MIDDLE:"flowplayer-middle",MIDDLE_ZONE:"flowplayer-middle-zone",WAIT:"flowplayer-wait",MIDDLE_BUTTONS:"flowplayer-middle-buttons",MIDDLE_LEFT_ZONE:"flowplayer-middle-left-zone",MIDDLE_RIGHT_ZONE:"flowplayer-middle-right-zone",ENDSCREEN_INTERSTITIAL:"flowplayer-endscreen-interstitial",ENDSCREEN_UP_NEXT:"flowplayer-endscreen-up-next",ENDSCREEN_GRID:"flowplayer-endscreen-grid",PLAYLIST_INTERSTITIAL:"flowplayer-playlist-interstitial",AIRPLAY_ICON:"flowplayer-airplay-icon",CHROMECAST_ICON:"flowplayer-chromecast-icon",SMALL_PLAY_ICON:"flowplayer-small-play-icon",SMALL_PAUSE_ICON:"flowplayer-small-pause-icon",PLAY_ICON:"flowplayer-play-icon",PAUSE_ICON:"flowplayer-pause-icon",FULLSCREEN_ENTER_ICON:"flowplayer-fullscreen-enter-icon",FULLSCREEN_EXIT_ICON:"flowplayer-fullscreen-exit-icon",SKIP_NEXT_ICON:"flowplayer-skip-next-icon",SKIP_PREVIOUS_ICON:"flowplayer-skip-previous-icon",FAST_FORWARD_ICON:"flowplayer-fast-forward-icon",REWIND_ICON:"flowplayer-rewind-icon",SHARE_ICON:"flowplayer-share-icon",SUBTITLES_MENU_ICON:"flowplayer-subs-menu-icon",MENU_BACK_ICON:"flowplayer-menu-back",VOLUME_ICON:"flowplayer-volume-icon",MUTE_ICON:"flowplayer-mute-icon",UNMUTE_ICON:"flowplayer-unmute-icon",CLOSE_ICON:"flowplayer-close-icon",FACEBOOK_ICON:"flowplayer-facebook-icon",TWITTER_ICON:"flowplayer-twitter-icon",LINK_ICON:"flowplayer-link-icon",EMBED_ICON:"flowplayer-embed-icon",LIVE_COUNTDOWN:"flowplayer-live-countdown",PLAYLIST_CONTROLS:"flowplayer-playlist-controls",THUMBNAILS_CAROUSEL:"flowplayer-thumbnails-carousel",ERROR_COMPONENT:"flowplayer-error",TV_MENU:"flowplayer-tv-menu",CUE_COMPONENT:"flowplayer-cue",SSAI_UI:"flowplayer-ssai-ui",SSAI_CONTROLS:"flowplayer-ssai-controls",SSAI_TIMELINE:"flowplayer-ssai-timeline",SSAI_INDICATOR:"flowplayer-ssai-indicator"});function Jo(e){this.message=e}Jo.prototype=new Error,Jo.prototype.name="InvalidCharacterError";var Qo="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new Jo("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,r,s=0,i=0,o="";r=t.charAt(i++);~r&&(n=s%4?64*n+r:r,s++%4)?o+=String.fromCharCode(255&n>>(-2*s&6)):0)r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(r);return o};var qo=function(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(Qo(e).replace(/(.)/g,(function(e,t){var n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n})))}(t)}catch(e){return Qo(t)}};function ea(e){this.message=e}ea.prototype=new Error,ea.prototype.name="InvalidTokenError";var ta=function(e,t){if("string"!=typeof e)throw new ea("Invalid token specified");var n=!0===(t=t||{}).header?0:1;try{return JSON.parse(qo(e.split(".")[n]))}catch(e){throw new ea("Invalid token specified: "+e.message)}};ta.InvalidTokenError=ea;const na=new Map,ra=(e,t)=>new(((e,t)=>{const n=e.get(t);if(!n)throw new Error(`no flowplayer component with the name ${t} exists`);const r=window.customElements.get(t);if(!r)throw new Error(`no default flowplayer component with the name ${t} exists`);const s=window.customElements.get(n);return"function"!=typeof s?r:s})(e._customElements,t))(e);var sa,aa;!function(e){e[e.LOW=1]="LOW",e[e.MEDIUM=2]="MEDIUM",e[e.HIGH=4]="HIGH"}(sa||(sa={})),function(e){e[e.OFF=0]="OFF",e[e.ON=1]="ON",e[e.AUDIO_REQUIRED=2]="AUDIO_REQUIRED"}(aa||(aa={}));const ca=e=>{return e.autoplay&&aa.AUDIO_REQUIRED&(!0===(t=e.autoplay)?aa.ON:!1===t?aa.OFF:t);var t};function la(e,t,n){const r="boolean"==typeof n;if("boolean"!=typeof n&&(n=!!e.hasState(Bo)||e.paused),function(e,t,n){const r=e.poll(t?"beforeplay":"beforepause",{forced:n});return r&&r.defaultPrevented}(e,n,r))return Promise.resolve();if(!n)return e.hasState(Go)?(e.setState(Bo,!0),e.setState(Go,!1),Promise.resolve()):Promise.resolve(e.pause());if(0==e.reaper)return Promise.resolve();const s=e.reaper.get("__pending_play");return e.paused||s?s?(s.src!==da(e.original_src)&&ua(e),s):(function(e){return(0==e.networkState||0==e.readyState)&&e.currentSrc==da(e.original_src)}(e)&&ua(e),function(e){const t=e.hasState("is-autoplay"),n=t&&ca(e.opts);n&&(e.muted&&e.toggleMute(!1),0==e.volume&&(e.volume=1));t&&e.setState("is-autoplay",!1);return e.play().then(()=>{e.hasState(Bo)&&e.togglePlay(!1)}).catch(r=>{if(console.warn(t?n?"[flowplayer/play] autoplay audio required\n%s":"[flowplayer/play] attempting muted autoplay\n%s":"",r.message,"\ninstance:",e),t&&!n)return e.muted=!0,e.play()})}(e)):(e.setState(Bo,!1),!e.hasState(Oo)&&e.setState(Go,!0),Promise.resolve())}function ua(e){e.opts.is_native&&(e.hasState(No)||(e.hasState(Do)||e.emit(v),e.setState(Do,!0),e.load()))}function da(e){const t=document.createElement("a");return t.href=e,t.href}function pa(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]])}return n}function fa(e){const t=document.createElement("a");t.href=e;const n=t.pathname&&t.pathname.split(".");return n.length>1&&n[n.length-1]}function ha(e){switch(e){case"video/mpd":return"application/dash+xml";case"video/m3u8":return"application/x-mpegurl";default:return e}}const ma=e=>{var{src:t}=e,n=pa(e,["src"]);return[Object.assign({src:t,type:t?ha("video/"+fa(t)):""},n)]};function ga(e){return ma({src:e})}function ya(e){var{src:t,type:n}=e,r=pa(e,["src","type"]);return t&&n?[Object.assign({src:t,type:n},r)]:n&&!t?[Object.assign({type:n},r)]:ma(Object.assign({src:t},r))}var va;function ba(e,t,n,r={safari:!1}){const s=function(e){return"string"==typeof e?ga(e):Array.isArray(e)||"object"!=typeof e?e.reduce((function(e,t){return"string"==typeof t&&(t=ga(t)),"object"!=typeof t||Array.isArray(t)||(t=ya(t)),e.concat(t)}),[]):ya(e)}(n);return function(e){[Fo,Bo,Go,Oo,Po,Do,No,Zo].forEach(t=>e.setState(t,!1)),e.setState(Mo,!0)}(e),Array(...Array(s.length)).map((e,t)=>t).some(n=>{const i=s[n];if(va.Ok==function(e,t,n){e.emit("src",n),"string"==typeof n.src&&(e.original_src=n.src);const r=function(e,t,n){return e.plugins.filter(e=>function(e){return e&&"wants"in e}(e)).find(e=>e.wants(n.src||"",n,t))}(e,t,n);return e.setOpts({is_native:!r}),r?(r.onload(t,e.root,e,n),va.Ok):va.Err}(e,t,i)||va.Ok==function(e,t,n,r={safari:!1}){var s;/^audio\//.test(n.type||"")&&e.emit("audioonlysource");t.start_time&&(n.src=n.src+"#t="+t.start_time);if(""==e.canPlayType(n.type||""))return va.Err;if(n.drm&&(!n.drm["com.apple.fps.1_0"]||!r.safari))return va.Err;"string"==typeof n.src&&(e.preload=null!==(s=t.preload)&&void 0!==s?s:"auto",e.src=n.src);return va.Ok}(e,t,i,r))return!0;n==s.length-1&&"string"==typeof i.src&&(e.src=i.src)}),e}!function(e){e[e.Err=0]="Err",e[e.Ok=1]="Ok"}(va||(va={}));const wa=[g,m,"src","seek:cancel"];var Sa;function Ra(e,t,n){return isNaN(e.duration)||isNaN(e.currentTime)?{}:(t.offset+=n,0==t.offset?Ia(e,t):(t.timer&&clearTimeout(t.timer),t.timer=setTimeout((function(){0!=e.reaper&&(e.currentTime=function(e,t,n=0){return Math.max(Math.min(t,e),n)}(e.currentTime+t.offset,e.duration),t.timer=0,Ia(e,t))}),1e3),function(e,t){e.setState("will-seek",!0),e.setState(Sa.BACKWARD,t.offset<0),e.setState(Sa.FORWARD,t.offset>0)}(e,t),e.emit("seek:queued",t),t))}function Ia(e,t){t.timer&&clearTimeout(t.timer),t.timer=t.offset=0,function(e){e.setState(Sa.FORWARD,!1),e.setState(Sa.BACKWARD,!1),e.setState("will-seek",!1)}(e)}function ka(){if("undefined"==typeof document)return!1;const e=document.documentElement;return e&&"rtl"==e.getAttribute("dir")}function xa(e,t,n){const r=function(e){return Array.isArray(e)?e.slice(0):e.split(".")}(t);for(;r.length;){if(null==e)return n;const t=r.shift();if("string"!=typeof t)return n;e=e[t]}return null==e?n:e}!function(e){e.FORWARD="forward",e.BACKWARD="backward"}(Sa||(Sa={}));const Ca=[1e7]+""+-1e3+-4e3+-8e3+-1e11,La=()=>"undefined"==typeof crypto?"":Ca.replace(/[018]/g,e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16));let Oa="";!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){}}();const Pa=["touchstart","touchmove"];function Na(e,t){const n=new CustomEvent(e,{detail:t,cancelable:!0});return t&&Object.defineProperty(n,"data",{get:()=>t}),n}function Da(e,t,n){const r=Na(t,n);return e.dispatchEvent(r),e}function Ma(e,t,n){const r=Na(t,n);return e.dispatchEvent(r),r}function Fa(e,t,n,r){Array.isArray(t)?t.forEach(t=>Ua(e,t,n,r)):Ua(e,t,n,r)}function Ua(e,t,n,r){if(s=t,!~Pa.indexOf(s))return e.addEventListener(t,n,r),e;var s;const i=Object.assign(r||{},{passive:!0});return e.addEventListener(t,n,i),e}function ja(e,t,n,r){return Fa(e,t,n,Object.assign(r||{},{once:!0}))}class PlayerStorage{constructor(e,t){this.implementation=e,t&&t.keys().forEach(e=>{"string"==typeof t.implementation[e]&&this.implementation.setItem(e,t.implementation[e])})}keys(){var e;const t=[];for(var n=0;n<this.implementation.length;n++)(null===(e=this.implementation.key(n))||void 0===e?void 0:e.startsWith("flowplayer/"))&&t.push(this.implementation.key(n));return t}removeItem(e){try{this.implementation.removeItem("flowplayer/"+e)}catch(e){}}getItem(e){try{return this.implementation.getItem("flowplayer/"+e)}catch(e){return null}}setItem(e,t){try{this.implementation.setItem("flowplayer/"+e,t)}catch(e){}}clear(){try{this.keys().forEach(e=>this.implementation.removeItem(e))}catch(e){}}get length(){try{return this.keys().length}catch(e){return 0}}key(e){try{return this.implementation.key(e)}catch(e){return null}}}class InMemoryStorage{constructor(){this.pairs=[]}get length(){return this.pairs.length}clear(){this.pairs=[]}getItem(e){var t;return(null===(t=this.pairs.find(t=>t[0]===e))||void 0===t?void 0:t[1])||null}key(e){return this.pairs[e][0]||null}removeItem(e){this.pairs=this.pairs.filter(t=>t[0]!==e)}setItem(e,t){this.removeItem(e),this.pairs.push([e,t])}}const Wa={preload:"auto",rtl:!1,controls:!0},Za=["loop","muted","preload"];function Va(e,t,n){let r;n.live_state={dvr_window:void 0,get dvr(){return r},set dvr(t){r=t;const s=!(!e.live||t);n.hasState(Vo)!=s&&n.setState(Vo,s)}},n._storage=new PlayerStorage(["localStorage","sessionStorage"].map(e=>{try{const t=window[e];return t.getItem(""),t}catch(t){return console.debug(`Access to window.${e} denied, trying next option`),null}}).find(e=>!!e)||new InMemoryStorage),n.toJSON=function(){return{duration:n.duration,volume:n.volume,currentTime:n.currentTime,states:n.root.className}},n.setSrc=function(t){return ba(n,e,t,$o())},n.playerState=n.playerState||{},n.setState=function(e,t){if(n.playerState[e]===!!t)return n;const r=Object.assign({},n.playerState,{[e]:t});return n.playerState=r,Da(n,"state",n.playerState),n},n.createComponents=function(...e){return Array.from({length:e.length}).map((t,n)=>ra(this,e[n]))},n.hasState=function(e){return!!n.playerState[e]},n.transitionState=function(e,t,r){!n.hasState(e)&&n.hasState(t)||(r=0),r&&n.setState("is-toggling",!0),n.setState(t,!1),n.setState(e,!0),r&&setTimeout((function(){n.setState("is-toggling",!1)}),r)},n.emit=(e,t)=>(Da(n,e,t),n),n.on=(e,t)=>(Fa(n,e,t),n),n.once=(e,t)=>(ja(n,e,t),n),n.off=(e,t)=>(function(e,t,n){e.removeEventListener(t,n)}(n,e,t),n),n.poll=(e,t)=>Ma(n,e,t),n.togglePlay=function(e){return la(n,0,e)},n.toggleMute=function(e){e=null==e?!n.muted:!!e,n.muted=e,n.muted||n.volume||(n.volume=1),Da(n,"volumechange")},n.toggleDisable=function(e){e=null==e?!n.disabled:!!e,n.setState("is-disabled",e),n.disabled=e},n.destroy=function(){n.pause();const e=Ko.indexOf(n);~e&&Ko.splice(e,1),setTimeout((function(){n.setSrc([]),n.reaper&&n.reaper.clear(),Da(n,g),n.setState("is-destroyed",!0)}),0)},n.setAttrs=function(e){return Za.forEach(t=>{if(!(t in e))return;const r=e[t];r?n.setAttribute(t,r.toString()):n.removeAttribute(t)}),n},n.opt=function(t,n){return n=void 0===n?xa(Wa,t):n,xa(e,t,n)},n.i18n=function(e,t){if(!n.reaper)return"";const r=n.reaper.get("translations");return r?function e(t,n,r,s){return(s=s||0)>=t.length?r:xa(t[s],n,e(t,n,r,s+1))}(r,e,t||""):t||""},n.setOpts=function(r){Object.assign(e,r),e.live&&!n.hasState(jo)&&(n.setState(Vo,!0),Da(n,"live")),"disabled"in r&&void 0!==r.disabled&&n.toggleDisable(r.disabled),"muted"in r&&void 0!==r.muted&&n.toggleMute(r.muted),"dvr"in e&&(n.live_state.dvr=n.opt("dvr")),n.setState("is-rtl",n.opt("rtl",function(e){if(!e)return ka();const t=e.getAttribute("dir");return t?"rtl"==t:ka()}(t))),n.setState(jo,!!e.live),n.setState("has-poster","string"==typeof e.poster&&e.poster.length>0),n.setState("is-seekable",!!e.seekable),n.setState("no-controls",0==e.controls),t.style.backgroundImage=n.hasState("has-poster")?"url('"+e.poster+"')":"",Da(n,"config",e)},n.renderPlugin=function(e){Ma(n,"renderplugin",e).defaultPrevented||n.root.appendChild(e)};const s={offset:0,timer:0};var i,o;o=s,(i=n).on(wa,(function(){Ia(i,o)})),n.enqueueSeek=function(e){if(0!=n.opts.seekable&&!(1==n.opts.disabled&&e>0))return Ra(n,s,e)},n.deviceId=function(){return function(e){if(Oa)return Oa;try{const t=e.getItem("flowplayer/uuid");if(t)return t;const n=La();return e.setItem("flowplayer/uuid",n),n}catch(e){return Oa=La()}}(n._storage)}}function Ga(e,t){const n=t.querySelector("video"),r=n||(e._video_element_callback?e._video_element_callback(e):document.createElement("video"));return r.classList.add("fp-engine"),r.playsInline=!0,n||t.append(r),r}const Ba=["localhost","127.0.0.1","0.0.0.0","s.codepen.io","cdpn.io","try.flowplayer.com"];function Xa(e,t){return!!~Ba.indexOf(e)||e.indexOf(t)===e.length-t.length}Xa.check_whitelist=function(e){return!!~Ba.indexOf(e)};const za="production";function Ka(e,t){const n={valid_jwt:!1,raw:"",data:{acl:0},exp:0};let r={c:"{}",exp:0};t=t||{};try{r=ta(e),n.valid_jwt=!0}catch(e){}return n.raw=e,n.data=JSON.parse(r.c),n.exp=r.exp,t.require_valid_token&&Ka.validate(n),n}function $a(e){try{return Ka.validate(e),{success:!0,message:""}}catch(e){return{success:!1,message:e.message}}}var Ha;function Ja(e){return{grant:e,is_granted:t=>(e&t)===t}}function Qa({root:e,video:t,data:n}){t&&t.destroy(),console.error(new Error(n.details||n.reason)),e.innerHTML="",e.classList.remove("flowplayer"),e.classList.add("flowplayer-fatal"),e.style.removeProperty("background-image");const r=document.createElement("h2");r.textContent="Playback Error";const s=document.createElement("p");s.textContent="Are you the site owner?";const i=document.createElement("a");i.classList.add("troubleshoot"),i.target="_blank",i.href="https://docs.flowplayer.com/troubleshooting/player#"+n.reason,i.textContent="Troubleshoot?";const o=document.createElement("img");o.src="https://flowplayer.com/user/pages/images/logo-white.png",e.append(r,s,i,o)}Ka.validate=function(e){if("string"==typeof e&&(e=Ka(e)),!e||!e.raw){if(Xa.check_whitelist(window.location.hostname)||"dev"===za.toString())return!0;throw new Error("No token provided in configuration")}if(!e.valid_jwt)throw new Error("Invalid token provided");const t=window.location.hostname,n=Xa.bind(null,t);if("dev"!==za.toString()&&e.data.domain&&e.data.domain.length&&!e.data.domain.some(n))throw new Error("Domain not allowed");if("dev"!==za.toString()&&1e3*e.exp-Date.now()<0)throw new Error("Expired token");return!0},Ka.id=function(e){if(e)return"string"==typeof e&&(e=Ka(e)),e.data.id},function(e){e[e.ADS=2]="ADS",e[e.ANALYTICS=4]="ANALYTICS",e[e.NO_METERING=8]="NO_METERING",e[e.DEVELOPER_PLAN=16]="DEVELOPER_PLAN",e[e.WOWZA_VIDEO=32]="WOWZA_VIDEO"}(Ha||(Ha={})),Ja.of=Ja,Ja.from_token=function(e){const t=Ka(e,{require_valid_token:!0});return Ja.of(t.data.acl)},Ja.permissions=Ha;function qa(e){return function(e,t){const n=e.seekable;if("object"!=typeof e.opts||0==n.length)return{head:0,tail:0};const r=ec(e),s=t||e.live_state.dvr_window;return{head:r,tail:"number"!=typeof s||r-s<0?n.start(0):r-s}}(e).tail}function ec(e){var t;const n=e.seekable;return n.length?e.hasState("is-chromecast-playing")||!(null===(t=e.hls)||void 0===t?void 0:t.liveSyncPosition)?n.end(n.length-1):e.hls.liveSyncPosition:0}function tc(e){try{e.dvr_offset=0,e.currentTime=ec(e)}catch(e){console.warn("failed to seek to now: %j",e)}}function nc(e,t){const n=t.clientWidth;t.classList.toggle("is-small",n<600),t.classList.toggle("is-tiny",n<400)}function rc(e,t,n){let r=!0;t.classList.add("flowplayer"),nc(0,t),Fa(n,c,()=>{if(!n.hasState(Do)&&!n.hasState(No)&&e.is_native&&"none"!==e.preload)return"metadata"===e.preload?(n.setState(Do,!0),n.emit(v)):void ua(n)}),Fa(n,i,()=>{e.is_native&&"metadata"===e.preload&&n.paused&&n.emit(p)}),Fa(n,[c,"resize"],(function(){nc(0,t)})),Fa(n,"state",(function(){Object.entries(n.playerState).forEach((function([e,n]){t.classList.toggle(e,n)}))})),Fa(n,"timeupdate",(function(){n.setState(Wo,!n.hasState("is-casting")&&!n.hasState(Mo)&&n.readyState<3)})),Fa(n,f,(function(t){setTimeout((function(){if(!t.defaultPrevented){if(e.rewind&&!n.loop){const e=n.src;n.setState(Fo,!0),ja(n,h,(function(){e===n.src&&(n.setState(Fo,!1),n.pause(),n.setState(Mo,!0))})),n.currentTime=0}ja(n,"timeupdate",(function(){n.setState(Uo,!1)})),n.transitionState(Uo,Oo,e.loop||e.rewind?0:300)}}),0)})),Fa(n,[m,h],(function(e){n.setState(Fo,e.type==m)})),Fa(n,"remotesession:ended",(function(e){setTimeout(()=>{e.defaultPrevented||(n.currentTime=e.detail.currentTime)},0)})),Fa(n,f,(function(){n.setState(Oo,!1),r=!0})),Fa(n,a,()=>{if(!n.opts.live||!n.opts.is_native)return;const e=n.seekable;0!=e.length&&n.emit("dvr/window",e.end(e.length-1)-e.start(0))}),Fa(n,o,(function(){n.setState(No,!0),n.setState(Do,!1)})),Fa(n,"play",()=>{n.setState(Go,!0)}),Fa(n,[d,p,c],(function(t){if(!n.hasState(Fo)&&(t.type!=p||e.autoplay||n.setState(Wo,!1),t.type!=c||"none"!=n.opt("preload")||e.autoplay)){if(t.type==c&&e.autoplay)return ja(n,u,(function(){n.setState(Wo,!1)}));t.type!=d||n.hasState(No)||n.setState(Do,!0),n.setState(Uo,!1),n.setState(Wo,t.type==d)}})),Fa(n,[u,l],(function(t){setTimeout(()=>{const e=new CustomEvent("flowplayer/"+t.type,{detail:n});document.dispatchEvent(e)},0);const s=t.type==u,i=n.currentTime==n.duration,o=s&&r&&e.autoplay||n.hasState(Wo);if(s&&(n.started=!0,r=!1),n.setState(Wo,!1).setState(Go,!1),!s&&n.setState(Bo,!1),i)return;const a=s?Oo:Po,c=s?Po:Oo;n.transitionState(a,c,o?0:300),!n.hasState(Mo)||n.root.classList.contains("ad-hide-first-frame")||n.root.classList.contains("preroll-ios")||function(e,t){if(!e.hasState(jo)||![void 0,0,-1].includes(t)||!e.seekable.length||e.hasState("has-casted"))return e.setState(Mo,!1);e.once(h,()=>e.setState(Mo,!1)),0===t?function(e){e.currentTime=qa(e)}(e):tc(e)}(n,e.start_time)}))}const sc=[0].concat(Array.from({length:100}).map((e,t)=>(t+1)/100));function ic(e,t,n){if(!window.IntersectionObserver)return;const r={should_resume:!!e.autoplay,locked:!1};Fa(n,"play",(function(){r.locked||(r.should_resume=!0)}));const s=()=>{if(!e.autoplay)return;if(n.hasState(Yo)&&r.should_resume)return n.togglePlay(!0);const t=n.currentSrc;e.autopause||n.hasState(Yo)||!r.should_resume||ja(n,"viewenter",()=>{e.autoplay&&r.should_resume&&t===n.currentSrc&&n.togglePlay(!0)})},i=()=>{if(!e.autoplay)return;if(!e.is_native)return;if("auto"===e.preload)return;if(n.hasState(Yo))return ua(n);const t=n.currentSrc;ja(n,"viewenter",()=>{t!==n.currentSrc||n.readyState>1||!n.paused||ua(n)})};Fa(n,"src",(function(){r.should_resume=!!e.autoplay,n.off(c,i),n.once(c,i),n.off(p,s),n.once(p,s)})),Fa(n,l,(function(){r.locked||(r.should_resume=!1)}));const o=new IntersectionObserver(e=>{e.forEach(e=>{setTimeout(()=>{const t=e.intersectionRatio,r=n.hasState(Yo);if(n.setState(Yo,t>=.2),n.emit("intersectionchange",{ratio:t}),r===n.hasState(Yo))return;const s=n.hasState(Yo)?"viewenter":"viewleave";n.emit(s)},0)})},{threshold:sc});o.observe(t),n.on(g,()=>o.disconnect()),Fa(n,"viewenter",(function(){!r.should_resume||!e.autopause||oc()||n.opts.autoplay&&!n.readyState||n.togglePlay(!0)})),Fa(n,"viewleave",(function(){if(!e.autopause||oc())return;const t=!n.paused;r.locked=!0,n.pause(),setTimeout((function(){r.should_resume=t,r.locked=!1}),0)}))}function oc(){return Ko.find(e=>e.hasState("is-casting"))}function ac(e,t){if(!window.ResizeObserver)return;const n=new ResizeObserver(e=>{const n=e[e.length-1];t.emit("resize",n)});n.observe(e),t.on(g,()=>n.disconnect())}function lc(e){if("number"==typeof e&&!isNaN(e))return Number(e);if("string"==typeof e){const t=e.split(":");return Number(t[1])/Number(t[0])}return e}function uc(e,t,n){const r=!!e.ratio,s=document.createElement("div");s.classList.add("fp-ratio"),t.append(s);let a=lc(e.ratio||.5625);s.style.paddingTop=100*a+"%";const c=[o,i];n.on(c,(function(){if(r)return;const e=n.videoHeight&&n.videoWidth&&n.videoHeight/n.videoWidth;e&&n.setOpts({ratio:e})})),n.on("config",(function(){const t=n.videoHeight&&n.videoWidth&&n.videoHeight/n.videoWidth,r=lc((null==e?void 0:e.ratio)||t||.5625);a!==r&&(a=r,s.style.paddingTop=100*r+"%")}))}class ExplorerPlan{constructor(){this.cleanUp=this.cleanUp.bind(this),this.render=this.render.bind(this),this.wireUp=this.wireUp.bind(this)}init(e,t,n){this.root=t,this.player=n,this.wireUp()}wireUp(){var e,t;this.cleanUp(),null===(e=this.player)||void 0===e||e.once(u,this.render),null===(t=this.player)||void 0===t||t.once(f,this.wireUp)}cleanUp(){var e,t,n,r;null===(t=null===(e=this._logo)||void 0===e?void 0:e.parentElement)||void 0===t||t.removeChild(this._logo),null===(n=this.player)||void 0===n||n.off(u,this.render),null===(r=this.player)||void 0===r||r.off(f,this.wireUp)}render(){var e,t,n;null===(t=null===(e=this._logo)||void 0===e?void 0:e.parentElement)||void 0===t||t.removeChild(this._logo);const r=(null===(n=this.root)||void 0===n?void 0:n.querySelector(".fp-ui"))||this.root;if(!r)return;const s=this._logo=document.createElement("a");s.href="https://explorer.flowplayer.com",s.target="_blank",Object.entries(dc).forEach(([e,t])=>{s.style.setProperty(e,t,"important")}),r.appendChild(s)}}ExplorerPlan.pluginName="explorer-plan";const dc={display:"block",opacity:"1",visibility:"visible",width:"33%","padding-top":"9%",position:"absolute","z-index":"9999",bottom:"25%",left:"10%","background-size":"cover","background-image":"url(https://static.flowplayer.com/explorer/explorer.svg)"},pc="flowplayer/"+u;function fc(e){const t=t=>{t.detail!==e&&!1===e.opt("multiplay")&&e.togglePlay(!1)};e.on(g,()=>document.removeEventListener(pc,t)),document.addEventListener(pc,t)}function hc(e,t){const n=[];e.addEventListener("contextmenu",r=>{const s=r.timeStamp;for(n.push(s);n.length>3;)n.shift();n.length>=3&&n.every(e=>e-s<3e3)&&(console.debug("flowplayer/debug rendering info"),function(e,t){var n;!function(e){const t=e.querySelector(".debug-info");null==t||t.remove()}(e);const r=document.createElement("div");r.classList.add("debug-info");const s=mc("flowplayer.version","3.27.0-rc");r.append(s);const i=null===(n=null==t?void 0:t.hls)||void 0===n?void 0:n.constructor;if(i&&i.version){const e=mc("hls.version",i.version);r.append(e)}e.appendChild(r)}(e,t))})}const mc=(e,t)=>{const n=document.createElement("div");n.classList.add("row",e);const r=document.createElement("span");r.classList.add("attr"),r.textContent=e;const s=document.createElement("span");return s.textContent=t,s.classList.add("value"),n.append(r,s),n};const gc=t("core/retry");function yc(e,t){const r={pending:void 0,count:0};var s;e.on("error",s=>{t.retry&&void 0===r.pending&&(++r.count,r.pending=function(e,t){return setTimeout(()=>{e.hasState("is-destroyed")||(t.pending=void 0,[y,n].forEach(t=>e.emit(t)),gc("%s try",t.count))},3e3*t.count)}(e,r))}),e.on(u,()=>{r.count=0}),e.on(["src",y],()=>{r.pending&&(clearTimeout(r.pending),r.pending=void 0)}),e.on(n,(s=t=>{t.defaultPrevented||e.load()},e=>{setTimeout((function(){if(!e.defaultPrevented)return s(e)}),0)}))}const vc="health:record",bc="rebuffer",wc="rebuffer:ended",Sc="insights:ttff",_c="insights:time_to_first_frag_loaded",Rc="insights:watched_interval";var Ec=Object.freeze({__proto__:null,RECORD:vc,REBUFFER:bc,REBUFFER_ENDED:wc,DISPLAY:"display",TIME_TO_FIRST_FRAME:Sc,TIME_TO_FIRST_FRAGMENT_LOADED:_c,WATCHED_INTERVAL:Rc});const Ic=[v,"error","src"];function kc(e){try{return!!new URL(e)}catch(e){return!1}}const xc=navigator;function Tc(e){var t,n;const r=null===(t=e.hls)||void 0===t?void 0:t.bandwidthEstimate;return r?1e-6*r:(null===(n=xc.connection)||void 0===n?void 0:n.downlink)||-1}function Cc(e,t){return async function(e,t){try{await fetch(e,{body:t,method:"POST",mode:"no-cors"})}catch(e){}}(e,JSON.stringify({events:t}))}const Lc=e=>{switch(e){case!0:return aa.ON;case!1:return aa.OFF;default:return e}};function Ac(){try{const e=window.location!==window.parent.location?document.referrer:document.location.href;return"string"==typeof e&&e.slice(0,200)}catch(e){return!1}}const Oc=[],Pc="https://ihi.flowplayer.com/v1/health/events";function Nc(e){if(e.suspended)return;const t=Oc.slice(0);Oc.length=0,0!=t.length&&(e.logger.log(`:dispatch events={${t.length}}`),Cc(function(){try{return"undefined"==typeof window?Pc:window.__FLOWPLAYER_INSIGHTS_URL?window.__FLOWPLAYER_INSIGHTS_URL:Pc}catch(e){return Pc}}(),t))}async function Dc(e,t,n){const r=await Fc();Oc.push(Object.assign(t,r)),e.logger.log(":enqueue",t.event,t),Oc.length<10&&!n||Nc(e)}const Mc=()=>{var e,t;try{const n=window;return null===(t=null===(e=null==n?void 0:n.google)||void 0===e?void 0:e.ima)||void 0===t?void 0:t.VERSION}catch(e){return}},Fc=async()=>({client_time:Date.now()}),Uc=(e,t)=>Object.assign(e,{detail:t}),jc=(e,{event:t,media_session_id:n,session_id:r,play_range_id:s})=>({event:t,media_session_id:n,session_id:r,play_range_id:s,device_id:e.deviceId(),version:"3.27.0-rc",commit:"bb2e3524cd2159e41f17705e66c9f3b08fe507b1",ima_sdk_version:Mc(),preload:e.opt("preload"),autoplay:Lc(e.opt("autoplay")),live:e.opt("live"),dvr:!!e.live_state.dvr,source:e.original_src,downlink_mbs:Tc(e),page_url:Ac(),player_id:e.opt("metadata.player_id"),media_id:e.opt("metadata.media_id"),site_id:e.opt("metadata.site_id"),category_id:e.opt("metadata.category_id"),sitegroup_id:e.opt("metadata.sitegroup_id"),token:e.token,plugins:e.plugins.map(e=>e.constructor.name).sort((e,t)=>e.localeCompare(t)),current_time:e.currentTime,external_media_id:e.opt("external_media_id")}),Wc=e=>({bitrate:null==e?void 0:e.bitrate,resolution:null==e?void 0:e.attrs.RESOLUTION,frame_rate:null==e?void 0:e.attrs["FRAME-RATE"]});function Zc(e,t,n,r){const s=jc(t,e.eventInfo(n)),{before:i,after:o}=r;Dc(e,((e,t,n)=>Object.assign(e,{state:{before:t,after:n}}))(s,Wc(i),Wc(o)))}var Vc;function Gc(e){switch(e){case Vc.MEDIA_PLAYBACK_ABORTED:return"media playback was aborted";case Vc.MEDIA_ERR_NETWORK:return"a network error occurred";case Vc.MEDIA_ERR_DECODE:return"unable to decode media content";case Vc.MEDIA_ERR_SRC_NOT_SUPPORTED:return"unsupported media type";case Vc.NO_INTERNET:return"no internet connection detected";case Vc.MIXED_CONTENT:return"cannot load insecure content in a secure context";default:return"an unknown error occurred"}}!function(e){e[e.UNKNOWN=-1]="UNKNOWN",e[e.MEDIA_PLAYBACK_ABORTED=1]="MEDIA_PLAYBACK_ABORTED",e[e.MEDIA_ERR_NETWORK=2]="MEDIA_ERR_NETWORK",e[e.MEDIA_ERR_DECODE=3]="MEDIA_ERR_DECODE",e[e.MEDIA_ERR_SRC_NOT_SUPPORTED=4]="MEDIA_ERR_SRC_NOT_SUPPORTED",e[e.MIXED_CONTENT=1001]="MIXED_CONTENT",e[e.NO_INTERNET=1002]="NO_INTERNET"}(Vc||(Vc={}));const Bc=(e,t)=>{let n=null;return(...r)=>{null!==n&&(clearTimeout(n),n=null),n=setTimeout(()=>t(...r),e)}};var Yc;!function(e){e[e.Starting=0]="Starting",e[e.ConfigFinalized=1]="ConfigFinalized",e[e.TimerStartedWithAutoplay=2]="TimerStartedWithAutoplay",e[e.TimerStartedWithUserGesture=3]="TimerStartedWithUserGesture",e[e.MetricReported=4]="MetricReported"}(Yc||(Yc={}));const Xc=["click","touchend"];class TimeToFirstFrame{constructor(e=Yc.Starting,t=!1){this.state=e,this.loadedAd=t}reset(){this.state=Yc.Starting,this.loadedAd=!1,this.start=void 0,this.end=void 0,this.adDetails=void 0}adInfo(){const{ad_tag_id:e,vast_ad_id:t}=this.adDetails||{};return{ad_tag_id:e,vast_ad_id:t}}toJSON(){return Object.assign({ad_was_requested:this.loadedAd,ms_to_first_frame:Math.round(this.end&&this.start?this.end-this.start:-1)},this.adInfo())}startTimer(e){this.state==Yc.ConfigFinalized&&(this.state=e,this.start=performance.now())}hasStarted(){return[Yc.TimerStartedWithAutoplay,Yc.TimerStartedWithUserGesture].includes(this.state)}stopTimer(e){this.hasStarted()&&(this.end||(this.end=performance.now()),this.state=Yc.MetricReported,e())}}function zc(e){return Math.round(1e3*e)/1e3}class EWMA{constructor(e){this.tickInterval=e,this.ewma=0,this.startTime=Date.now()}decay(){const e=Date.now()-this.startTime;return Math.pow(2,-e/(4*this.tickInterval))}update(e){const t=this.decay();return this.ewma=t*this.ewma+(1-t)*e,this.ewma}toJSON(){return this.ewma}}class WatchedState{constructor(e){this.player=e,this.marchingInterval=void 0,this.lastWatchedPoint=void 0,this.watchedSum=0,this.lastReportedSum=0,this.ewmaTickWatched=new EWMA(WatchedState.AccuracyMilliseconds)}reset(){this.onNotWatching(),this.watchedSum=0,this.lastReportedSum=0,this.lastWatchedPoint=void 0}onNotWatching(){this.marchingInterval&&(this.updateWatched(),this.marchingInterval=clearInterval(this.marchingInterval))}onWatching(){this.marchingInterval||(this.lastWatchedPoint=this.createWatchedPoint(),this.marchingInterval=setInterval(()=>{this.updateWatched()},WatchedState.AccuracyMilliseconds))}createWatchedPoint(){return{currentTime:this.player.currentTime,paused:this.player.paused}}updateWatched(){const e=this.createWatchedPoint();this.lastWatchedPoint&&this.calculateTimeWatched(this.lastWatchedPoint,e),this.lastWatchedPoint=e}calculateTimeWatched(e,t){const n=t.currentTime-e.currentTime,r=this.ewmaTickWatched.update(n);if(!(n<0)&&!(1e3*n>1.3*WatchedState.AccuracyMilliseconds)&&(this.watchedSum+=n,this.watchedSum!=this.lastReportedSum&&(this.watchedSum>this.lastReportedSum+WatchedState.ReportingIntervalSeconds||this.player.ended))){const e=zc(r),t={total_watched_seconds:zc(this.watchedSum),tick_watched_seconds:e,batch_watched_seconds:zc(this.watchedSum-this.lastReportedSum)};this.lastReportedSum=this.watchedSum,this.player.emit(Rc,t)}}}WatchedState.ReportingIntervalSeconds=5,WatchedState.AccuracyMilliseconds=160;const Kc=La();class Health{constructor(e,n){let r;this.session_id=Kc,this.suspended=!1,this.logger=t("health",n.opts),this.media_session_id=La(),this.play_range_id=La(),this.analyticsLoop=setInterval(()=>Nc(this),2e3),n.on(g,()=>clearInterval(this.analyticsLoop)),n.on(u,()=>{r!==this.media_session_id&&(r=this.media_session_id,this.first_playing_event_timestamp=Date.now()),this.play_range_id=La()});let s=Date.now()-1e3;n.on("timeupdate",e=>{if(r!==this.media_session_id)return;const t=Date.now();if(t<s)return;s=Date.now()+5e3;const i=jc(n,this.eventInfo(e.type)),o=Uc(i,{duration:(a=n.duration,Number.isFinite(a)?a:a===1/0?-1:void 0)});var a;this.first_playing_event_timestamp&&(Object.assign(o,{ms_since_first_playing:t-this.first_playing_event_timestamp}),this.first_playing_event_timestamp=void 0),Dc(this,o)});const i=this;if(n.health={get media_session_id(){return i.media_session_id},set media_session_id(e){i.media_session_id=e},get session_id(){return i.session_id},set session_id(e){i.session_id=e},toggle(e){e?i.resume():i.suspend()}},!Health._UNLOAD_SUBSCRIBED){Health._UNLOAD_SUBSCRIBED=!0;const t=t=>e.instances.forEach(e=>e.emit(t.type));document.addEventListener("visibilitychange",e=>{"hidden"==document.visibilityState&&t(e)}),window.addEventListener("pagehide",t)}}eventInfo(e){return{event:e,media_session_id:this.media_session_id,session_id:this.session_id,play_range_id:this.play_range_id}}suspend(){this.suspended=!0,clearInterval(this.analyticsLoop)}resume(){this.suspended=!1,this.analyticsLoop=setInterval(()=>Nc(this),2e3)}init(e,t,n){if(Ac().toString().startsWith("data:"))return this.suspend();!function(e){let t=null;const n=()=>{t=null};e.on(d,(function(t){e.seeking||e.networkState===e.NETWORK_LOADING&&(e.readyState<HTMLMediaElement.HAVE_CURRENT_DATA||e.emit(bc))})),e.on(bc,e=>{t=e}),e.on(p,r=>{if(t){const s=r.timeStamp-t.timeStamp;if(n(),s<31)return;if(s>3e5)return;e.emit(wc,{rebuffer_duration:s/1e3})}}),Ic.forEach(t=>e.on(t,n))}(n),function(e){let t;[p,v].forEach(n=>{e.on(n,n=>{const r=Date.now();switch(n.type){case v:return t=r;case p:if(t)return e.emit(_c,{ms_since_loading_started:r-t}),t=null}})})}(n),function(e){if(void 0===window.performance)return;const t=new TimeToFirstFrame;e.on("src",()=>{if(!e.opt("metadata.media_id"))return t.reset();t.reset(),t.state=Yc.ConfigFinalized}),e.on(v,()=>{(e.root.classList.contains("ad-hide-first-frame")||e.opt("autoplay"))&&t.startTimer(Yc.TimerStartedWithAutoplay)}),Xc.forEach(n=>{e.on(n,()=>{e.opt("autoplay")||t.startTimer(Yc.TimerStartedWithUserGesture)})}),e.on("ad-requested",()=>{t.loadedAd=!0}),e.on("timeupdate",()=>{if(!(e.readyState<HTMLMediaElement.HAVE_CURRENT_DATA)){if(e.root.classList.contains("ad-hide-first-frame"))return!t.end&&(t.end=performance.now());switch(t.state){case Yc.TimerStartedWithAutoplay:case Yc.TimerStartedWithUserGesture:return t.stopTimer(()=>e.emit(Sc,t.toJSON()))}}}),e.on("ad-started",n=>{switch(t.end=void 0,t.adDetails=n.detail,t.state){case Yc.TimerStartedWithAutoplay:case Yc.TimerStartedWithUserGesture:return t.stopTimer(()=>e.emit(Sc,t.toJSON()))}})}(n),function(e){const t=new WatchedState(e);e.on(v,()=>t.reset()),e.on(u,()=>t.onWatching()),e.on(l,()=>t.onNotWatching()),e.on(m,()=>t.onNotWatching()),e.on(f,()=>t.updateWatched()),e.on("visibilitychange",()=>t.updateWatched())}(n),n.on("display",e=>{Dc(this,jc(n,this.eventInfo(e.type)),!0)}),n.on(vc,({detail:e})=>{const t=jc(n,this.eventInfo(e.event));Object.assign(t,e.detail||{}),Dc(this,t)}),[c,i,o,a,d,bc].forEach(e=>{n.on(e,e=>{Dc(this,jc(n,this.eventInfo(e.type)))})}),[wc,Sc,_c,Rc].forEach(e=>{n.on(e,e=>{const t=jc(n,this.eventInfo(e.type));Dc(this,Object.assign(t,e.detail))})}),[u,l,m,h,f,r,s,p,v].forEach(e=>{n.on(e,e=>{Dc(this,jc(n,this.eventInfo(e.type)))})}),n.on("volumechange",Bc(800,e=>{const t=jc(n,this.eventInfo(e.type));Dc(this,Uc(t,{volume:parseFloat(n.volume.toFixed(2)),muted:n.muted}))})),n.on("resize",Bc(800,e=>{const r=jc(n,this.eventInfo(e.type));Dc(this,Uc(r,{height:t.clientHeight,width:t.clientWidth}))})),n.on("hls/failover",e=>{const t=jc(n,this.eventInfo(e.type)),r=e.detail,{reason:s,from:i}=r;Dc(this,Uc(t,{reason:s,from:i}))}),n.on("qualitychange",({type:e,detail:t})=>{switch(t.plugin){case"hls":return Zc(this,n,e,t)}}),n.addEventListener("error",e=>{const t=jc(n,this.eventInfo(e.type)),r=e.error||n.error;if(!r)return Dc(this,t,!0);const s=r.code,i={error_message:r.message||Gc(s),error_code:s,error_stack:r.stack||""};return Dc(this,Uc(t,i),!0)}),n.on("src",e=>{var t;const r=null===(t=e.detail)||void 0===t?void 0:t.src;if("string"!=typeof r)return;if(!kc(n.original_src))return;if(!kc(r))return;if(r==n.original_src)return;this.media_session_id=La();Dc(this,jc(n,this.eventInfo(e.type))),Nc(this)}),n.on("visibilitychange",e=>{Dc(this,jc(n,this.eventInfo(e.type))),Nc(this)})}}function $c(e,t){return function(e){return e.extensions.reduce((e,t)=>e.find(e=>e.pluginName===t.pluginName)?(console.warn("flowplayer: duplicate plugin %s detected, plugin names should be unique",t.name),e):(e.push(t),e),[])}(e).map(n=>new n(e,t))}Health.pluginName="health",Health.events=Ec,Health._UNLOAD_SUBSCRIBED=!1;const Hc=function(){const t="undefined"!=typeof window?window:void 0!==e?e:{},n=t.flowplayer?t.flowplayer:{extensions:[]};return Array.isArray(n.extensions)||(n.extensions=[]),n}();function Jc(e,t){if("function"==typeof e)return zo.push(...[...arguments].filter(e=>"function"==typeof e)),Jc;"string"==typeof t&&(t={src:t}),t||(t={}),t.token||"string"!=typeof window.__FLOWPLAYER_TOKEN||(t.token=window.__FLOWPLAYER_TOKEN);const n="string"==typeof e?document.querySelector(e):e;if(!n)return console.error(new Error("Flowplayer: '"+e.toString()+"' not found"));const r=n.querySelector("video.fp-engine");if(r)return r;const s=$a(t.token);if(!s.success)return Qa({root:n,data:{reason:"token",details:s.message}});const o=new Map,a=Ga(t,n);a.reaper=o,a._customElements=na,Object.defineProperty(a,"token",{value:"string"==typeof t.token?Ka.id(t.token):"",writable:!1}),a.addEventListener(g,()=>{o.clear(),a.reaper=0,delete a.root}),a.root=n,t.token&&Ja.from_token(t.token).is_granted(Ja.permissions.DEVELOPER_PLAN)&&zo.push(ExplorerPlan),!~Ko.indexOf(a)&&Ko.push(a),Va(t,n,a),a.setAttrs(t),a.plugins=$c(Jc,a),rc(t,n,a),ic(t,n,a),ac(n,a),uc(t,n,a),fc(a),hc(n,a),yc(a,t),a.plugins.forEach(e=>{try{e.init(t,n,a)}catch(t){console.log("Error(plugin/%s)",e.constructor.name,t)}}),a.setOpts(t),a.opts=t,t.src&&a.setSrc(t.src);const c=a.readyState;return c>0&&a.currentSrc&&a.emit(i),c>2&&a.currentSrc&&a.emit(p),a.emit("mount"),a.on("error:fatal",(function(e){Qa({root:n,video:a,data:e.data||{}})})),setTimeout(Da,0,document,"flowplayer:player:created",a),a}Object.assign(Jc,Hc),function(e){Array.isArray(e.extensions)&&e.extensions.forEach(e=>zo.push(e)),e.customElements=na,e.defaultElements=Ho,e.version="3.27.0-rc",e.commit="bb2e3524cd2159e41f17705e66c9f3b08fe507b1",e.instances=Ko,e.extensions=zo,e.support=$o,e.events=w,e.states=Xo,e.jwt=ta,e.autoplay=aa,e.quality=sa}(Jc),"object"==typeof document&&setTimeout(Da,0,document,"flowplayer:umd",Jc),Jc.extensions.unshift.apply(Jc.extensions,[Health]);class MillicastAdapter{static wants(e){return e.type==MillicastAdapter.Type}constructor(e,n,r=t("rts/millicast"),s=Lo.Starting){this.player=e,this.src=n,this.log=r,this.status=s,gs.setEndpoint(MillicastAdapter.WOWZA_DIRECTOR_ENDPOINT),this.hasReportedError=!1,this.player.on("quality:set",e=>{var t;if(!this.engine||!this.engine.isActive())return;const n=e.detail;null===(t=this.engine)||void 0===t||t.select(n)}),this.player.on("tracks:video:select",e=>{var t;if(!this.engine||!this.engine.isActive())return;const n=e.detail.track,r=null===(t=this.player.tracks)||void 0===t?void 0:t.find(e=>e.selected&&e!==n);r&&(r.selected=!1),this.engine.project("Main"===n.label?"":n.label,n.data.tracks)})}isStreamActive(){return this.status===Lo.Receiving&&this.player.hasState(Jc.states.PLAYING)}async load(){this.log("loading",this.src.streamName);this.engine=new cc(this.src.streamName,()=>this.src.__TEST_STREAM_ACCOUNT_ID__?gs.getSubscriber(this.src):gs.getSubscriber(Object.assign(Object.assign({},this.src),{streamAccountId:"dev"in this.src?"3caeCP":"bUEzT6"})),this.player,!1),this.player.original_src=MillicastAdapter.WOWZA_DIRECTOR_ENDPOINT+"/"+this.src.streamName,this._observe(),await this.connect()}retry(){!1!==this.player.opts.retry&&setTimeout(()=>{0!=this.player.reaper&&this.engine&&this.connect()},3e3)}async connect(){try{await this._connect(),this.player.emit(y)}catch(e){if(this.log("Connection failed",e),this.retry(),this.hasReportedError)return;this.player.emit("error",e),this.hasReportedError=!0}}stop(){var e;null===(e=this.engine)||void 0===e||e.stop(),this.engine=void 0}_handleViewerCount(e){"number"==typeof e&&this.player.emit("rts/viewer-count",{viewerCount:e})}_handleActive(e){this.player.hasState("is-error")&&this.player.emit(y),this.status=Lo.Receiving,this.player.emit("rts/status",{status:Lo.Receiving,data:e})}_handleInactive(){this.status=Lo.Idle;const e={status:Lo.Idle,message:this.player.i18n("rts.millicast.inactive","broadcast has become inactive")};this.player.emit("rts/status",e),this.player.emit("error",Object.assign({fatal:!1},e))}_handleQualityLayers(e){var t,n;const r=null===(t=e[0])||void 0===t?void 0:t.layers;if(r&&Array.isArray(r)&&r.every(e=>void 0!==e.encodingId)){if(r[0].encodingId===(null===(n=this.layers)||void 0===n?void 0:n[0].encodingId))return;return this.layers=r,this.player.emit("qualities",function(e){const t=e.map((e,t)=>Object.assign(Object.assign({},e),{name:e.height||"Level "+t})).sort((e,t)=>t.width-e.width);t.length>1&&t.push({name:"AUTO",width:0,height:0});return t}
19
19
  /**
20
20
  * @license wowza-webrtc-player 1.0.5
21
21
  * Copyright (c) 2018-2022 Koala Interactive, Inc.
22
22
  * License: MIT
23
- */(n))}this.layers=void 0,this.player.emit("qualities",[])}_observe(){var e;null===(e=this.engine)||void 0===e||e.on("broadcastEvent",e=>{const{name:t,data:r}=e;switch(t){case"active":return this._handleActive(r);case"viewercount":return this._handleViewerCount(r.viewercount);case"layers":return this._handleQualityLayers(r.medias);case"inactive":return this._handleInactive()}})}async _connect(){const e=this.engine;e&&await e.connect(MillicastAdapter.Options)}getRTCPeerConnection(){var e;return null===(e=this.engine)||void 0===e?void 0:e.getRTCPeerConnection()}}function po(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 mo(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?po(Object(r),!0).forEach((function(t){bo(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):po(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function go(e,t,r,n,s,i,o){try{var a=e[i](o),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,s)}function yo(e){return function(){var t=this,r=arguments;return new Promise((function(n,s){var i=e.apply(t,r);function o(e){go(i,n,s,o,a,"next",e)}function a(e){go(i,n,s,o,a,"throw",e)}o(void 0)}))}}function bo(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function vo(){}function wo(){wo.init.call(this)}function So(e){return void 0===e._maxListeners?wo.defaultMaxListeners:e._maxListeners}function Ro(e,t,r){if(t)e.call(r);else for(var n=e.length,s=Lo(e,n),i=0;i<n;++i)s[i].call(r)}function xo(e,t,r,n){if(t)e.call(r,n);else for(var s=e.length,i=Lo(e,s),o=0;o<s;++o)i[o].call(r,n)}function ko(e,t,r,n,s){if(t)e.call(r,n,s);else for(var i=e.length,o=Lo(e,i),a=0;a<i;++a)o[a].call(r,n,s)}function _o(e,t,r,n,s,i){if(t)e.call(r,n,s,i);else for(var o=e.length,a=Lo(e,o),c=0;c<o;++c)a[c].call(r,n,s,i)}function Co(e,t,r,n){if(t)e.apply(r,n);else for(var s=e.length,i=Lo(e,s),o=0;o<s;++o)i[o].apply(r,n)}function Io(e,t,r,n){var s,i,o,a;if("function"!=typeof r)throw new TypeError('"listener" argument must be a function');if((i=e._events)?(i.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),i=e._events),o=i[t]):(i=e._events=new vo,e._eventsCount=0),o){if("function"==typeof o?o=i[t]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),!o.warned&&(s=So(e))&&s>0&&o.length>s){o.warned=!0;var c=Error("Possible EventEmitter memory leak detected. "+o.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=o.length,a=c,"function"==typeof console.warn?console.warn(a):console.log(a)}}else o=i[t]=r,++e._eventsCount;return e}function Eo(e,t,r){var n=!1;function s(){e.removeListener(t,s),n||(n=!0,r.apply(e,arguments))}return s.listener=r,s}function To(e){var t=this._events;if(t){var r=t[e];if("function"==typeof r)return 1;if(r)return r.length}return 0}function Lo(e,t){for(var r=Array(t);t--;)r[t]=e[t];return r}MillicastAdapter.Events={ACTIVE:"rts/millicast/active",INACTIVE:"rts/millicast/inactive"},MillicastAdapter.Type="wowza/rts",MillicastAdapter.Options={events:["active","inactive","viewercount","layers"]},MillicastAdapter.WOWZA_DIRECTOR_ENDPOINT="https://realtime1.wowza.com",vo.prototype=Object.create(null),wo.EventEmitter=wo,wo.usingDomains=!1,wo.prototype.domain=void 0,wo.prototype._events=void 0,wo.prototype._maxListeners=void 0,wo.defaultMaxListeners=10,wo.init=function(){this.domain=null,wo.usingDomains&&(void 0).active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new vo,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},wo.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},wo.prototype.getMaxListeners=function(){return So(this)},wo.prototype.emit=function(e){var t,r,n,s,i,o,a,c="error"===e;if(o=this._events)c=c&&null==o.error;else if(!c)return!1;if(a=this.domain,c){if(t=arguments[1],!a){if(t instanceof Error)throw t;var l=Error('Uncaught, unspecified "error" event. ('+t+")");throw l.context=t,l}return t||(t=Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=a,t.domainThrown=!1,a.emit("error",t),!1}if(!(r=o[e]))return!1;var u="function"==typeof r;switch(n=arguments.length){case 1:Ro(r,u,this);break;case 2:xo(r,u,this,arguments[1]);break;case 3:ko(r,u,this,arguments[1],arguments[2]);break;case 4:_o(r,u,this,arguments[1],arguments[2],arguments[3]);break;default:for(s=Array(n-1),i=1;i<n;i++)s[i-1]=arguments[i];Co(r,u,this,s)}return!0},wo.prototype.addListener=function(e,t){return Io(this,e,t,!1)},wo.prototype.on=wo.prototype.addListener,wo.prototype.prependListener=function(e,t){return Io(this,e,t,!0)},wo.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,Eo(this,e,t)),this},wo.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,Eo(this,e,t)),this},wo.prototype.removeListener=function(e,t){var r,n,s,i,o;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(n=this._events))return this;if(!(r=n[e]))return this;if(r===t||r.listener&&r.listener===t)0==--this._eventsCount?this._events=new vo:(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(s=-1,i=r.length;i-- >0;)if(r[i]===t||r[i].listener&&r[i].listener===t){o=r[i].listener,s=i;break}if(s<0)return this;if(1===r.length){if(r[0]=void 0,0==--this._eventsCount)return this._events=new vo,this;delete n[e]}else!function(e,t){for(var r=t,n=r+1,s=e.length;n<s;r+=1,n+=1)e[r]=e[n];e.pop()}(r,s);n.removeListener&&this.emit("removeListener",e,o||t)}return this},wo.prototype.removeAllListeners=function(e){var t,r;if(!(r=this._events))return this;if(!r.removeListener)return 0===arguments.length?(this._events=new vo,this._eventsCount=0):r[e]&&(0==--this._eventsCount?this._events=new vo:delete r[e]),this;if(0===arguments.length){for(var n,s=Object.keys(r),i=0;i<s.length;++i)"removeListener"!==(n=s[i])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=new vo,this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(t)do{this.removeListener(e,t[t.length-1])}while(t[0]);return this},wo.prototype.listeners=function(e){var t,r=this._events;return r&&(t=r[e])?"function"==typeof t?[t.listener||t]:function(e){for(var t=Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(t):[]},wo.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):To.call(e,t)},wo.prototype.listenerCount=To,wo.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};var Ao=window.RTCPeerConnection,Mo=window.RTCIceCandidate,Po=window.RTCSessionDescription;class b extends wo{constructor(e){super(),bo(this,"pc",void 0),this.pc=new Ao({iceServers:e}),"ontrack"in this.pc?this.pc.ontrack=this.handleTrackEvent.bind(this):this.pc.onaddstream=this.handleNewStreamEvent.bind(this)}getPeerConnection(){return this.pc}close(){this.pc.close()}setRemoteDescription(e){return this.pc.setRemoteDescription(new Po(e))}setLocalDescription(e){return this.pc.setLocalDescription(new Po(e))}createAnswer(){var e=this;return yo((function*(){return e.pc.createAnswer()}))()}createOffer(){var e=this;return yo((function*(){return e.pc.createOffer()}))()}attachIceCandidate(e){return this.pc.addIceCandidate(new Mo(e))}attachMediaStream(e){var t=this.pc,r=t.getSenders(),n=e.getTracks();r.length?n.forEach(e=>{r.filter(t=>{var r;return(null===(r=t.track)||void 0===r?void 0:r.kind)===e.kind}).forEach(t=>{t.replaceTrack(e)})}):n.forEach(r=>{t.addTrack(r,e)})}handleNewStreamEvent(e){var{stream:t}=e;this.emit("addstream",t)}handleTrackEvent(e){e.streams.forEach(e=>{this.emit("addstream",e)})}}class C{constructor(e,t,r){this.url=e,this.streamInfo=t,this.userData=r,bo(this,"ws",null),bo(this,"pendingCommands",new Map)}connect(){return this.ws?Promise.resolve(this.ws):new Promise((e,t)=>{var r=new WebSocket(this.url);r.binaryType="arraybuffer",r.onopen=()=>e(r),r.onerror=()=>t(),r.onclose=()=>t(),r.onmessage=this.handleSocketData.bind(this),this.ws=r})}disconnect(){this.ws&&(this.ws.close(),this.ws=null)}getOffer(){var e={direction:"play",command:"getOffer"};return this.streamInfo.secureToken&&(e.secureToken=this.streamInfo.secureToken),this.send(e)}sendOffer(e){return this.send({direction:"publish",command:"sendOffer",sdp:e})}sendResponse(e){return this.send({direction:"play",command:"sendResponse",sdp:e})}getAvailableStreams(){return this.send({direction:"play",command:"getAvailableStreams"})}send(e){var t=this;return yo((function*(){var r,n=t.ws||(yield t.connect());return t.pendingCommands.has(e.command)||t.pendingCommands.set(e.command,((r={}).promise=new Promise((e,t)=>{r.resolve=e,r.reject=t}),r)),n.send(JSON.stringify(mo(mo({},e),{},{streamInfo:t.streamInfo,userData:t.userData}))),t.pendingCommands.get(e.command).promise}))()}handleSocketData(e){var t,r=JSON.parse(e.data);200===r.status?(null!==(t=r.streamInfo)&&void 0!==t&&t.sessionId&&(this.streamInfo.sessionId=r.streamInfo.sessionId),this.pendingCommands.has(r.command)&&(this.pendingCommands.get(r.command).resolve(r),this.pendingCommands.delete(r.command))):this.pendingCommands.has(r.command)&&(this.pendingCommands.get(r.command).reject(r),this.pendingCommands.delete(r.command))}}var Oo="mozGetUserMedia"in navigator?"firefox":"webkitGetUserMedia"in navigator||!1===window.isSecureContext&&"webkitRTCPeerConnection"in window&&!("RTCIceGatherer"in window)?"chrome":navigator.mediaDevices&&navigator.userAgent.match(/Edge\/(\d+).(\d+)$/)?"edge":window.RTCPeerConnection&&navigator.userAgent.match(/AppleWebKit\/(\d+)\./)?"safari":"unknown",Do=["vp9","vp8","h264","red","ulpfec","rtx"],Fo=["opus","isac","g722","pcmu","pcma","cn"];class S{constructor(e,t){this.videoOptions=e,this.audioOptions=t,bo(this,"audioIndex",-1),bo(this,"videoIndex",-1)}transformPlay(e){return e.sdp?(e.sdp=e.sdp.replace(/profile-level-id=(\w+)/gi,(e,t)=>{var r=parseInt(t,16),n=r>>16&255,s=r>>8&255,i=255&r;return n>66?(n=66,s=224,i=31):0===s&&(s=224),"profile-level-id=".concat((n<<16|s<<8|i).toString(16))}),e):e}transformPublish(e){var t=this.prepareSDP(e),r=this.videoOptions,n=this.audioOptions,s=null,i=()=>"m=audio"===s?n:"m=video"===s?r:null,o=t.filter(Boolean).map(e=>{var[t]=e.split(/\s|:/,1);switch(t){case"m=audio":case"m=video":var o="m=audio"===t?this.audioIndex:this.videoIndex;if(-1!==o&&"chrome"===Oo){var[a,c,l]=e.split(" ");return"".concat(a," ").concat(c," ").concat(l," ").concat(o)}s=t;break;case"a=rtpmap":var u=/^a=rtpmap:(\d+)\s+(\w+)\/(\d+)/.exec(e);if(!u||"chrome"!==Oo)break;var d=u[2].toLowerCase();r.bitRate&&Do.includes(d)&&(e+="\r\na=fmtp:".concat(u[1]," x-google-min-bitrate=").concat(r.bitRate,";x-google-max-bitrate=").concat(r.bitRate)),n.bitRate&&Fo.includes(d)&&(e+="\r\na=fmtp:".concat(u[1]," x-google-min-bitrate=").concat(n.bitRate,";x-google-max-bitrate=").concat(n.bitRate));break;case"c=IN":var h=i();if(null!=h&&h.bitRate&&["firefox","safari"].includes(Oo)){var f=1e3*h.bitRate;e+="\r\nb=TIAS:".concat(.95*f-16e3),e+="\r\nb=AS:".concat(f),e+="\r\nb=CT:".concat(f)}break;case"a=mid":var p=i();p&&"chrome"===Oo&&(p.bitRate&&(e+="\r\nb=CT:".concat(p.bitRate),e+="\r\nb=AS:".concat(p.bitRate),"frameRate"in p&&p.frameRate&&(e+="\r\na=framerate:".concat(p.frameRate.toFixed(2)))),s=null)}return e}).join("\r\n")+"\r\n";return{type:e.type,sdp:o}}checkLine(e,t){if(/^a=(rtpmap|rtcp-fb|fmtp)/.test(e)){var r=e.split(":");if(r.length>1){var[n,s]=r[1].split(" ");if(!s.startsWith("http")&&!s.startsWith("ur")){var i=parseInt(n,10),o=t.get(i)||[];return o.push(e),t.set(i,o),!1}}}return!0}deliverCheckLine(e,t,r){var n=Array.from(r).find(t=>{var[,r]=t;return r.join("\r\n").includes(e)});if(!n)return[];var[s,i]=n;return"audio"===t?this.audioIndex=s:this.videoIndex=s,"VP8"!==e&&"VP9"!==e?i:i.filter(e=>!e.includes("transport-cc")&&!e.includes("goog-remb")&&!e.includes("nack"))}addAudio(e,t){for(var r="",n=0,s=e.length;n<s;++n){var i=e[n];if(i.startsWith("m=audio"))r="audio";else if(i.startsWith("m=video"))r="video";else if("a=rtcp-mux"===i&&"audio"===r){var o=this.deliverCheckLine(this.audioOptions.codec,"audio",t);e.splice(n+1,0,...o);break}}return e}addVideo(e,t){var r=e.includes("a=rtcp-rsize"),n=e.includes("a=rtcp-mux"),s=!1;if(!r&&!n)return e;var i=this.deliverCheckLine(this.videoOptions.codec,"video",t);return e.map(e=>{if(r){if(!s&&"a=rtcp-rsize"===e)return s=!0,[e].concat(i).join("\r\n")}else if("a=rtcp-mux"===e){if(s)return[e].concat(i).join("\r\n");s=!0}return e})}flattenLines(e){return e.join("\r\n").split("\r\n")}prepareSDP(e){var t=new Map,r=(e.sdp||"").split(/\r\n/);return r=r.filter(e=>e&&this.checkLine(e,t)),r=this.flattenLines(this.addAudio(r,t)),this.flattenLines(this.addVideo(r,t))}}class x extends wo{constructor(e,t){super(),this.video=e,bo(this,"sdpUrl",""),bo(this,"applicationName",""),bo(this,"streamName",""),bo(this,"userData",null),bo(this,"sdpHandler",void 0),bo(this,"secureToken",void 0),bo(this,"constraints",{audio:!0,video:!0}),bo(this,"videoConfigs",{bitRate:360,codec:"42e01f",frameRate:29.97}),bo(this,"audioConfigs",{codec:"opus",bitRate:64}),bo(this,"iceServers",[]),bo(this,"mediaStream",null),bo(this,"pc",null),t&&this.setConfigurations(t)}setConfigurations(e){e.constraints&&(this.constraints=e.constraints),e.videoConfigs&&(this.videoConfigs=e.videoConfigs),e.audioConfigs&&(this.audioConfigs=e.audioConfigs),e.applicationName&&(this.applicationName=e.applicationName),e.streamName&&(this.streamName=e.streamName),e.sdpUrl&&(this.sdpUrl=e.sdpUrl),void 0!==e.userData&&(this.userData=e.userData),e.iceServers&&(this.iceServers=e.iceServers),e.sdpHandler&&(this.sdpHandler=e.sdpHandler),e.secureToken&&(this.secureToken=e.secureToken)}stop(){this.pc&&(this.pc.close(),this.pc=null)}getMediaStream(){return this.mediaStream}getPeerConnection(){return this.pc?this.pc.getPeerConnection():null}playLocal(e){var t=this;return yo((function*(){e&&(t.constraints=e);var r=yield function(e){var t;return null!==(t=navigator.mediaDevices)&&void 0!==t&&t.getUserMedia?navigator.mediaDevices.getUserMedia(e):"getUserMedia"in navigator?new Promise((t,r)=>{navigator.getUserMedia(e,t,r)}):Promise.reject("Your browser does not support getUserMedia API")}(t.constraints);return t.attachStream(r),r}))()}stopLocal(){this.stop(),this.mediaStream&&(this.mediaStream.getTracks().forEach(e=>{e.stop()}),this.mediaStream=null)}playRemote(e){var t=this;return yo((function*(){e&&t.setConfigurations(e);var r=t.createWowzaInstance();try{var{sdp:n}=yield r.getOffer(),s=t.createPeerConnection();s.on("addstream",t.attachStream.bind(t)),yield s.setRemoteDescription(n);var i=yield s.createAnswer(),o=new S(t.videoConfigs,t.audioConfigs),a=t.sdpHandler?t.sdpHandler(i,e=>o.transformPlay(e),"play"):o.transformPlay(i);yield s.setLocalDescription(a);var{iceCandidates:c}=yield r.sendResponse(a);c.forEach(e=>{s.attachIceCandidate(e)})}finally{r.disconnect()}}))()}publish(e){var t=this;return yo((function*(){e&&t.setConfigurations(e);var r=t.createWowzaInstance();try{var n=t.mediaStream||(yield t.playLocal()),s=t.createPeerConnection();s.attachMediaStream(n);var i=new S(t.videoConfigs,t.audioConfigs),o=yield s.createOffer(),a=t.sdpHandler?t.sdpHandler(o,e=>i.transformPublish(e),"publish"):i.transformPublish(o);yield s.setLocalDescription(a);var{sdp:c,iceCandidates:l}=yield r.sendOffer(a);yield s.setRemoteDescription(c),l.forEach(e=>{s.attachIceCandidate(e)})}finally{r.disconnect()}}))()}getAvailableStreams(){var e=this;return yo((function*(){var t=e.createWowzaInstance();try{var{availableStreams:r}=yield t.getAvailableStreams();return r||[]}catch(e){return[]}finally{t.disconnect()}}))()}createWowzaInstance(){return new C(this.sdpUrl,{applicationName:this.applicationName,sessionId:"[empty]",streamName:this.streamName,secureToken:this.secureToken},this.userData)}createPeerConnection(){return this.pc=new b(this.iceServers),this.pc}attachStream(e){this.mediaStream=e;try{var t=this.video.srcObject instanceof MediaStream&&this.video.srcObject;t&&t.id===e.id||(this.video.srcObject=e)}catch(t){this.video.src=window.URL.createObjectURL(e)}this.pc&&this.pc.attachMediaStream(e),this.video.play()}}class WowzaWebRTCAdapter{static wants(e){return e.type==WowzaWebRTCAdapter.Type}constructor(e,r,n=t("rts/webrtc")){this.player=e,this.src=r,this.log=n,this.hasReportedError=!1}async load(){this.log("loading",this.src.streamName),this.player.original_src=this.src.sdpUrl,this.engine=new x(this.player,this.src),await this.playRemote()}retry(){!1!==this.player.opts.retry&&setTimeout(()=>{0!=this.player.reaper&&this.engine&&this.playRemote()},3e3)}async playRemote(){var e;if(this.engine)try{await this.engine.playRemote(),this.player.emit("recover")}catch(t){if(this.retry(),this.hasReportedError)return;this.player.emit("error",null!==(e=t)&&void 0!==e?e:{fatal:!1,message:"failed to connect to stream"}),this.hasReportedError=!0}}stop(){var e;null===(e=this.engine)||void 0===e||e.stop(),this.engine=void 0}getRTCPeerConnection(){var e;return(null===(e=this.engine)||void 0===e?void 0:e.getPeerConnection())||void 0}}WowzaWebRTCAdapter.Events={ACTIVE:"rts/wowza-webrtc/active",INACTIVE:"rts/webrtc/inactive"},WowzaWebRTCAdapter.Type="wowza/webrtc";
23
+ */(r))}this.layers=void 0,this.player.emit("qualities",[])}_observe(){var e;null===(e=this.engine)||void 0===e||e.on("broadcastEvent",e=>{const{name:t,data:n}=e;switch(t){case"active":return this._handleActive(n);case"viewercount":return this._handleViewerCount(n.viewercount);case"layers":return this._handleQualityLayers(n.medias);case"inactive":return this._handleInactive()}})}async _connect(){const e=this.engine;e&&await e.connect(MillicastAdapter.Options)}getRTCPeerConnection(){var e;return null===(e=this.engine)||void 0===e?void 0:e.getRTCPeerConnection()}}function Qc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function qc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Qc(Object(n),!0).forEach((function(t){nl(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Qc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function el(e,t,n,r,s,i,o){try{var a=e[i](o),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,s)}function tl(e){return function(){var t=this,n=arguments;return new Promise((function(r,s){var i=e.apply(t,n);function o(e){el(i,r,s,o,a,"next",e)}function a(e){el(i,r,s,o,a,"throw",e)}o(void 0)}))}}function nl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function rl(){}function sl(){sl.init.call(this)}function il(e){return void 0===e._maxListeners?sl.defaultMaxListeners:e._maxListeners}function ol(e,t,n){if(t)e.call(n);else for(var r=e.length,s=hl(e,r),i=0;i<r;++i)s[i].call(n)}function al(e,t,n,r){if(t)e.call(n,r);else for(var s=e.length,i=hl(e,s),o=0;o<s;++o)i[o].call(n,r)}function cl(e,t,n,r,s){if(t)e.call(n,r,s);else for(var i=e.length,o=hl(e,i),a=0;a<i;++a)o[a].call(n,r,s)}function ll(e,t,n,r,s,i){if(t)e.call(n,r,s,i);else for(var o=e.length,a=hl(e,o),c=0;c<o;++c)a[c].call(n,r,s,i)}function ul(e,t,n,r){if(t)e.apply(n,r);else for(var s=e.length,i=hl(e,s),o=0;o<s;++o)i[o].apply(n,r)}function dl(e,t,n,r){var s,i,o,a;if("function"!=typeof n)throw new TypeError('"listener" argument must be a function');if((i=e._events)?(i.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),i=e._events),o=i[t]):(i=e._events=new rl,e._eventsCount=0),o){if("function"==typeof o?o=i[t]=r?[n,o]:[o,n]:r?o.unshift(n):o.push(n),!o.warned&&(s=il(e))&&s>0&&o.length>s){o.warned=!0;var c=Error("Possible EventEmitter memory leak detected. "+o.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=o.length,a=c,"function"==typeof console.warn?console.warn(a):console.log(a)}}else o=i[t]=n,++e._eventsCount;return e}function pl(e,t,n){var r=!1;function s(){e.removeListener(t,s),r||(r=!0,n.apply(e,arguments))}return s.listener=n,s}function fl(e){var t=this._events;if(t){var n=t[e];if("function"==typeof n)return 1;if(n)return n.length}return 0}function hl(e,t){for(var n=Array(t);t--;)n[t]=e[t];return n}MillicastAdapter.Events={ACTIVE:"rts/millicast/active",INACTIVE:"rts/millicast/inactive"},MillicastAdapter.Type="wowza/rts",MillicastAdapter.Options={events:["active","inactive","viewercount","layers"]},MillicastAdapter.WOWZA_DIRECTOR_ENDPOINT="https://realtime1.wowza.com",rl.prototype=Object.create(null),sl.EventEmitter=sl,sl.usingDomains=!1,sl.prototype.domain=void 0,sl.prototype._events=void 0,sl.prototype._maxListeners=void 0,sl.defaultMaxListeners=10,sl.init=function(){this.domain=null,sl.usingDomains&&(void 0).active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new rl,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},sl.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},sl.prototype.getMaxListeners=function(){return il(this)},sl.prototype.emit=function(e){var t,n,r,s,i,o,a,c="error"===e;if(o=this._events)c=c&&null==o.error;else if(!c)return!1;if(a=this.domain,c){if(t=arguments[1],!a){if(t instanceof Error)throw t;var l=Error('Uncaught, unspecified "error" event. ('+t+")");throw l.context=t,l}return t||(t=Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=a,t.domainThrown=!1,a.emit("error",t),!1}if(!(n=o[e]))return!1;var u="function"==typeof n;switch(r=arguments.length){case 1:ol(n,u,this);break;case 2:al(n,u,this,arguments[1]);break;case 3:cl(n,u,this,arguments[1],arguments[2]);break;case 4:ll(n,u,this,arguments[1],arguments[2],arguments[3]);break;default:for(s=Array(r-1),i=1;i<r;i++)s[i-1]=arguments[i];ul(n,u,this,s)}return!0},sl.prototype.addListener=function(e,t){return dl(this,e,t,!1)},sl.prototype.on=sl.prototype.addListener,sl.prototype.prependListener=function(e,t){return dl(this,e,t,!0)},sl.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,pl(this,e,t)),this},sl.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,pl(this,e,t)),this},sl.prototype.removeListener=function(e,t){var n,r,s,i,o;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(r=this._events))return this;if(!(n=r[e]))return this;if(n===t||n.listener&&n.listener===t)0==--this._eventsCount?this._events=new rl:(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(s=-1,i=n.length;i-- >0;)if(n[i]===t||n[i].listener&&n[i].listener===t){o=n[i].listener,s=i;break}if(s<0)return this;if(1===n.length){if(n[0]=void 0,0==--this._eventsCount)return this._events=new rl,this;delete r[e]}else!function(e,t){for(var n=t,r=n+1,s=e.length;r<s;n+=1,r+=1)e[n]=e[r];e.pop()}(n,s);r.removeListener&&this.emit("removeListener",e,o||t)}return this},sl.prototype.removeAllListeners=function(e){var t,n;if(!(n=this._events))return this;if(!n.removeListener)return 0===arguments.length?(this._events=new rl,this._eventsCount=0):n[e]&&(0==--this._eventsCount?this._events=new rl:delete n[e]),this;if(0===arguments.length){for(var r,s=Object.keys(n),i=0;i<s.length;++i)"removeListener"!==(r=s[i])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=new rl,this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(t)do{this.removeListener(e,t[t.length-1])}while(t[0]);return this},sl.prototype.listeners=function(e){var t,n=this._events;return n&&(t=n[e])?"function"==typeof t?[t.listener||t]:function(e){for(var t=Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(t):[]},sl.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):fl.call(e,t)},sl.prototype.listenerCount=fl,sl.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};var ml=window.RTCPeerConnection,gl=window.RTCIceCandidate,yl=window.RTCSessionDescription;class b extends sl{constructor(e){super(),nl(this,"pc",void 0),this.pc=new ml({iceServers:e}),"ontrack"in this.pc?this.pc.ontrack=this.handleTrackEvent.bind(this):this.pc.onaddstream=this.handleNewStreamEvent.bind(this)}getPeerConnection(){return this.pc}close(){this.pc.close()}setRemoteDescription(e){return this.pc.setRemoteDescription(new yl(e))}setLocalDescription(e){return this.pc.setLocalDescription(new yl(e))}createAnswer(){var e=this;return tl((function*(){return e.pc.createAnswer()}))()}createOffer(){var e=this;return tl((function*(){return e.pc.createOffer()}))()}attachIceCandidate(e){return this.pc.addIceCandidate(new gl(e))}attachMediaStream(e){var t=this.pc,n=t.getSenders(),r=e.getTracks();n.length?r.forEach(e=>{n.filter(t=>{var n;return(null===(n=t.track)||void 0===n?void 0:n.kind)===e.kind}).forEach(t=>{t.replaceTrack(e)})}):r.forEach(n=>{t.addTrack(n,e)})}handleNewStreamEvent(e){var{stream:t}=e;this.emit("addstream",t)}handleTrackEvent(e){e.streams.forEach(e=>{this.emit("addstream",e)})}}class C{constructor(e,t,n){this.url=e,this.streamInfo=t,this.userData=n,nl(this,"ws",null),nl(this,"pendingCommands",new Map)}connect(){return this.ws?Promise.resolve(this.ws):new Promise((e,t)=>{var n=new WebSocket(this.url);n.binaryType="arraybuffer",n.onopen=()=>e(n),n.onerror=()=>t(),n.onclose=()=>t(),n.onmessage=this.handleSocketData.bind(this),this.ws=n})}disconnect(){this.ws&&(this.ws.close(),this.ws=null)}getOffer(){var e={direction:"play",command:"getOffer"};return this.streamInfo.secureToken&&(e.secureToken=this.streamInfo.secureToken),this.send(e)}sendOffer(e){return this.send({direction:"publish",command:"sendOffer",sdp:e})}sendResponse(e){return this.send({direction:"play",command:"sendResponse",sdp:e})}getAvailableStreams(){return this.send({direction:"play",command:"getAvailableStreams"})}send(e){var t=this;return tl((function*(){var n,r=t.ws||(yield t.connect());return t.pendingCommands.has(e.command)||t.pendingCommands.set(e.command,((n={}).promise=new Promise((e,t)=>{n.resolve=e,n.reject=t}),n)),r.send(JSON.stringify(qc(qc({},e),{},{streamInfo:t.streamInfo,userData:t.userData}))),t.pendingCommands.get(e.command).promise}))()}handleSocketData(e){var t,n=JSON.parse(e.data);200===n.status?(null!==(t=n.streamInfo)&&void 0!==t&&t.sessionId&&(this.streamInfo.sessionId=n.streamInfo.sessionId),this.pendingCommands.has(n.command)&&(this.pendingCommands.get(n.command).resolve(n),this.pendingCommands.delete(n.command))):this.pendingCommands.has(n.command)&&(this.pendingCommands.get(n.command).reject(n),this.pendingCommands.delete(n.command))}}var vl="mozGetUserMedia"in navigator?"firefox":"webkitGetUserMedia"in navigator||!1===window.isSecureContext&&"webkitRTCPeerConnection"in window&&!("RTCIceGatherer"in window)?"chrome":navigator.mediaDevices&&navigator.userAgent.match(/Edge\/(\d+).(\d+)$/)?"edge":window.RTCPeerConnection&&navigator.userAgent.match(/AppleWebKit\/(\d+)\./)?"safari":"unknown",bl=["vp9","vp8","h264","red","ulpfec","rtx"],wl=["opus","isac","g722","pcmu","pcma","cn"];class S{constructor(e,t){this.videoOptions=e,this.audioOptions=t,nl(this,"audioIndex",-1),nl(this,"videoIndex",-1)}transformPlay(e){return e.sdp?(e.sdp=e.sdp.replace(/profile-level-id=(\w+)/gi,(e,t)=>{var n=parseInt(t,16),r=n>>16&255,s=n>>8&255,i=255&n;return r>66?(r=66,s=224,i=31):0===s&&(s=224),"profile-level-id=".concat((r<<16|s<<8|i).toString(16))}),e):e}transformPublish(e){var t=this.prepareSDP(e),n=this.videoOptions,r=this.audioOptions,s=null,i=()=>"m=audio"===s?r:"m=video"===s?n:null,o=t.filter(Boolean).map(e=>{var[t]=e.split(/\s|:/,1);switch(t){case"m=audio":case"m=video":var o="m=audio"===t?this.audioIndex:this.videoIndex;if(-1!==o&&"chrome"===vl){var[a,c,l]=e.split(" ");return"".concat(a," ").concat(c," ").concat(l," ").concat(o)}s=t;break;case"a=rtpmap":var u=/^a=rtpmap:(\d+)\s+(\w+)\/(\d+)/.exec(e);if(!u||"chrome"!==vl)break;var d=u[2].toLowerCase();n.bitRate&&bl.includes(d)&&(e+="\r\na=fmtp:".concat(u[1]," x-google-min-bitrate=").concat(n.bitRate,";x-google-max-bitrate=").concat(n.bitRate)),r.bitRate&&wl.includes(d)&&(e+="\r\na=fmtp:".concat(u[1]," x-google-min-bitrate=").concat(r.bitRate,";x-google-max-bitrate=").concat(r.bitRate));break;case"c=IN":var p=i();if(null!=p&&p.bitRate&&["firefox","safari"].includes(vl)){var f=1e3*p.bitRate;e+="\r\nb=TIAS:".concat(.95*f-16e3),e+="\r\nb=AS:".concat(f),e+="\r\nb=CT:".concat(f)}break;case"a=mid":var h=i();h&&"chrome"===vl&&(h.bitRate&&(e+="\r\nb=CT:".concat(h.bitRate),e+="\r\nb=AS:".concat(h.bitRate),"frameRate"in h&&h.frameRate&&(e+="\r\na=framerate:".concat(h.frameRate.toFixed(2)))),s=null)}return e}).join("\r\n")+"\r\n";return{type:e.type,sdp:o}}checkLine(e,t){if(/^a=(rtpmap|rtcp-fb|fmtp)/.test(e)){var n=e.split(":");if(n.length>1){var[r,s]=n[1].split(" ");if(!s.startsWith("http")&&!s.startsWith("ur")){var i=parseInt(r,10),o=t.get(i)||[];return o.push(e),t.set(i,o),!1}}}return!0}deliverCheckLine(e,t,n){var r=Array.from(n).find(t=>{var[,n]=t;return n.join("\r\n").includes(e)});if(!r)return[];var[s,i]=r;return"audio"===t?this.audioIndex=s:this.videoIndex=s,"VP8"!==e&&"VP9"!==e?i:i.filter(e=>!e.includes("transport-cc")&&!e.includes("goog-remb")&&!e.includes("nack"))}addAudio(e,t){for(var n="",r=0,s=e.length;r<s;++r){var i=e[r];if(i.startsWith("m=audio"))n="audio";else if(i.startsWith("m=video"))n="video";else if("a=rtcp-mux"===i&&"audio"===n){var o=this.deliverCheckLine(this.audioOptions.codec,"audio",t);e.splice(r+1,0,...o);break}}return e}addVideo(e,t){var n=e.includes("a=rtcp-rsize"),r=e.includes("a=rtcp-mux"),s=!1;if(!n&&!r)return e;var i=this.deliverCheckLine(this.videoOptions.codec,"video",t);return e.map(e=>{if(n){if(!s&&"a=rtcp-rsize"===e)return s=!0,[e].concat(i).join("\r\n")}else if("a=rtcp-mux"===e){if(s)return[e].concat(i).join("\r\n");s=!0}return e})}flattenLines(e){return e.join("\r\n").split("\r\n")}prepareSDP(e){var t=new Map,n=(e.sdp||"").split(/\r\n/);return n=n.filter(e=>e&&this.checkLine(e,t)),n=this.flattenLines(this.addAudio(n,t)),this.flattenLines(this.addVideo(n,t))}}class x extends sl{constructor(e,t){super(),this.video=e,nl(this,"sdpUrl",""),nl(this,"applicationName",""),nl(this,"streamName",""),nl(this,"userData",null),nl(this,"sdpHandler",void 0),nl(this,"secureToken",void 0),nl(this,"constraints",{audio:!0,video:!0}),nl(this,"videoConfigs",{bitRate:360,codec:"42e01f",frameRate:29.97}),nl(this,"audioConfigs",{codec:"opus",bitRate:64}),nl(this,"iceServers",[]),nl(this,"mediaStream",null),nl(this,"pc",null),t&&this.setConfigurations(t)}setConfigurations(e){e.constraints&&(this.constraints=e.constraints),e.videoConfigs&&(this.videoConfigs=e.videoConfigs),e.audioConfigs&&(this.audioConfigs=e.audioConfigs),e.applicationName&&(this.applicationName=e.applicationName),e.streamName&&(this.streamName=e.streamName),e.sdpUrl&&(this.sdpUrl=e.sdpUrl),void 0!==e.userData&&(this.userData=e.userData),e.iceServers&&(this.iceServers=e.iceServers),e.sdpHandler&&(this.sdpHandler=e.sdpHandler),e.secureToken&&(this.secureToken=e.secureToken)}stop(){this.pc&&(this.pc.close(),this.pc=null)}getMediaStream(){return this.mediaStream}getPeerConnection(){return this.pc?this.pc.getPeerConnection():null}playLocal(e){var t=this;return tl((function*(){e&&(t.constraints=e);var n=yield function(e){var t;return null!==(t=navigator.mediaDevices)&&void 0!==t&&t.getUserMedia?navigator.mediaDevices.getUserMedia(e):"getUserMedia"in navigator?new Promise((t,n)=>{navigator.getUserMedia(e,t,n)}):Promise.reject("Your browser does not support getUserMedia API")}(t.constraints);return t.attachStream(n),n}))()}stopLocal(){this.stop(),this.mediaStream&&(this.mediaStream.getTracks().forEach(e=>{e.stop()}),this.mediaStream=null)}playRemote(e){var t=this;return tl((function*(){e&&t.setConfigurations(e);var n=t.createWowzaInstance();try{var{sdp:r}=yield n.getOffer(),s=t.createPeerConnection();s.on("addstream",t.attachStream.bind(t)),yield s.setRemoteDescription(r);var i=yield s.createAnswer(),o=new S(t.videoConfigs,t.audioConfigs),a=t.sdpHandler?t.sdpHandler(i,e=>o.transformPlay(e),"play"):o.transformPlay(i);yield s.setLocalDescription(a);var{iceCandidates:c}=yield n.sendResponse(a);c.forEach(e=>{s.attachIceCandidate(e)})}finally{n.disconnect()}}))()}publish(e){var t=this;return tl((function*(){e&&t.setConfigurations(e);var n=t.createWowzaInstance();try{var r=t.mediaStream||(yield t.playLocal()),s=t.createPeerConnection();s.attachMediaStream(r);var i=new S(t.videoConfigs,t.audioConfigs),o=yield s.createOffer(),a=t.sdpHandler?t.sdpHandler(o,e=>i.transformPublish(e),"publish"):i.transformPublish(o);yield s.setLocalDescription(a);var{sdp:c,iceCandidates:l}=yield n.sendOffer(a);yield s.setRemoteDescription(c),l.forEach(e=>{s.attachIceCandidate(e)})}finally{n.disconnect()}}))()}getAvailableStreams(){var e=this;return tl((function*(){var t=e.createWowzaInstance();try{var{availableStreams:n}=yield t.getAvailableStreams();return n||[]}catch(e){return[]}finally{t.disconnect()}}))()}createWowzaInstance(){return new C(this.sdpUrl,{applicationName:this.applicationName,sessionId:"[empty]",streamName:this.streamName,secureToken:this.secureToken},this.userData)}createPeerConnection(){return this.pc=new b(this.iceServers),this.pc}attachStream(e){this.mediaStream=e;try{var t=this.video.srcObject instanceof MediaStream&&this.video.srcObject;t&&t.id===e.id||(this.video.srcObject=e)}catch(t){this.video.src=window.URL.createObjectURL(e)}this.pc&&this.pc.attachMediaStream(e),this.video.play()}}class WowzaWebRTCAdapter{static wants(e){return e.type==WowzaWebRTCAdapter.Type}constructor(e,n,r=t("rts/webrtc")){this.player=e,this.src=n,this.log=r,this.hasReportedError=!1}async load(){this.log("loading",this.src.streamName),this.player.original_src=this.src.sdpUrl,this.engine=new x(this.player,this.src),await this.playRemote()}retry(){!1!==this.player.opts.retry&&setTimeout(()=>{0!=this.player.reaper&&this.engine&&this.playRemote()},3e3)}async playRemote(){var e;if(this.engine)try{await this.engine.playRemote(),this.player.emit(y)}catch(t){if(this.retry(),this.hasReportedError)return;this.player.emit("error",null!==(e=t)&&void 0!==e?e:{fatal:!1,message:"failed to connect to stream"}),this.hasReportedError=!0}}stop(){var e;null===(e=this.engine)||void 0===e||e.stop(),this.engine=void 0}getRTCPeerConnection(){var e;return(null===(e=this.engine)||void 0===e?void 0:e.getPeerConnection())||void 0}}WowzaWebRTCAdapter.Events={ACTIVE:"rts/wowza-webrtc/active",INACTIVE:"rts/webrtc/inactive"},WowzaWebRTCAdapter.Type="wowza/webrtc";
24
24
  /*! For license information please see webrtc-stats.js.LICENSE.txt */
25
- var jo=function(e){var t={exports:{}};return e(t,t.exports),t.exports}((function(e,t){!function(t,r){e.exports=r()}(self,()=>{return e={7:e=>{var t,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var s=Number.isNaN||function(e){return e!=e};function i(){i.init.call(this)}e.exports=i,e.exports.once=function(e,t){return new Promise((function(r,n){function s(r){e.removeListener(t,i),n(r)}function i(){"function"==typeof e.removeListener&&e.removeListener("error",s),r([].slice.call(arguments))}m(e,t,i,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&m(e,"error",t,{once:!0})}(e,s)}))},i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var o=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?i.defaultMaxListeners:e._maxListeners}function l(e,t,r,n){var s,i,o,l;if(a(r),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),i=e._events),o=i[t]),void 0===o)o=i[t]=r,++e._eventsCount;else if("function"==typeof o?o=i[t]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),(s=c(e))>0&&o.length>s&&!o.warned){o.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=o.length,l=u,console&&console.warn&&console.warn(l)}return e}function u(){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 d(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},s=u.bind(n);return s.listener=r,n.wrapFn=s,s}function h(e,t,r){var n=e._events;if(void 0===n)return[];var s=n[t];return void 0===s?[]:"function"==typeof s?r?[s.listener||s]:[s]: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}(s):p(s,s.length)}function f(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 p(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function m(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 s(i){n.once&&e.removeEventListener(t,s),r(i)}))}}Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(e){if("number"!=typeof e||e<0||s(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");o=e}}),i.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},i.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||s(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},i.prototype.getMaxListeners=function(){return c(this)},i.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var s="error"===e,i=this._events;if(void 0!==i)s=s&&void 0===i.error;else if(!s)return!1;if(s){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var c=i[e];if(void 0===c)return!1;if("function"==typeof c)n(c,this,t);else{var l=c.length,u=p(c,l);for(r=0;r<l;++r)n(u[r],this,t)}return!0},i.prototype.addListener=function(e,t){return l(this,e,t,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(e,t){return l(this,e,t,!0)},i.prototype.once=function(e,t){return a(t),this.on(e,d(this,e,t)),this},i.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,d(this,e,t)),this},i.prototype.removeListener=function(e,t){var r,n,s,i,o;if(a(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(s=-1,i=r.length-1;i>=0;i--)if(r[i]===t||r[i].listener===t){o=r[i].listener,s=i;break}if(s<0)return this;0===s?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,s),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,o||t)}return this},i.prototype.off=i.prototype.removeListener,i.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 s,i=Object.keys(r);for(n=0;n<i.length;++n)"removeListener"!==(s=i[n])&&this.removeAllListeners(s);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},i.prototype.listeners=function(e){return h(this,e,!0)},i.prototype.rawListeners=function(e){return h(this,e,!1)},i.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):f.call(e,t)},i.prototype.listenerCount=f,i.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},586:function(e,t,r){var n,s;!function(i){var o,a={VERSION:"1.6.1"},c={},l=function(e,t){return function(){return t.apply(e,arguments)}},u=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},d=function(e,t){return{value:e,name:t}};a.TRACE=d(1,"TRACE"),a.DEBUG=d(2,"DEBUG"),a.INFO=d(3,"INFO"),a.TIME=d(4,"TIME"),a.WARN=d(5,"WARN"),a.ERROR=d(8,"ERROR"),a.OFF=d(99,"OFF");var h=function(e){this.context=e,this.setLevel(e.filterLevel),this.log=this.info};h.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(a.TRACE,arguments)},debug:function(){this.invoke(a.DEBUG,arguments)},info:function(){this.invoke(a.INFO,arguments)},warn:function(){this.invoke(a.WARN,arguments)},error:function(){this.invoke(a.ERROR,arguments)},time:function(e){"string"==typeof e&&e.length>0&&this.invoke(a.TIME,[e,"start"])},timeEnd:function(e){"string"==typeof e&&e.length>0&&this.invoke(a.TIME,[e,"end"])},invoke:function(e,t){o&&this.enabledFor(e)&&o(t,u({level:e},this.context))}};var f,p=new h({filterLevel:a.OFF});(f=a).enabledFor=l(p,p.enabledFor),f.trace=l(p,p.trace),f.debug=l(p,p.debug),f.time=l(p,p.time),f.timeEnd=l(p,p.timeEnd),f.info=l(p,p.info),f.warn=l(p,p.warn),f.error=l(p,p.error),f.log=f.info,a.setHandler=function(e){o=e},a.setLevel=function(e){for(var t in p.setLevel(e),c)c.hasOwnProperty(t)&&c[t].setLevel(e)},a.getLevel=function(){return p.getLevel()},a.get=function(e){return c[e]||(c[e]=new h(u({name:e},p.context)))},a.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(n,s){n=Array.prototype.slice.call(n);var i,o=console.log;s.level===a.TIME?(i=(s.name?"["+s.name+"] ":"")+n[0],"start"===n[1]?console.time?console.time(i):t[i]=(new Date).getTime():console.timeEnd?console.timeEnd(i):r(o,[i+": "+((new Date).getTime()-t[i])+"ms"])):(s.level===a.WARN&&console.warn?o=console.warn:s.level===a.ERROR&&console.error?o=console.error:s.level===a.INFO&&console.info?o=console.info:s.level===a.DEBUG&&console.debug?o=console.debug:s.level===a.TRACE&&console.trace&&(o=console.trace),e.formatter(n,s),r(o,n))}},a.useDefaults=function(e){a.setLevel(e&&e.defaultLevel||a.DEBUG),a.setHandler(a.createDefaultHandler(e))},a.setDefaults=a.useDefaults,void 0===(s="function"==typeof(n=a)?n.call(t,r,t,e):n)||(e.exports=s)}()},156:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Logger=void 0;var o=r(586);Object.defineProperty(t,"Logger",{enumerable:!0,get:function(){return i(o).default}}),s(r(284),t),s(r(280),t),s(r(738),t),s(r(767),t)},738:(e,t)=>{var r;Object.defineProperty(t,"__esModule",{value:!0}),t.QualityLimitationReason=void 0,function(e){e[e.none=0]="none",e[e.cpu=1]="cpu",e[e.bandwidth=2]="bandwidth",e[e.other=3]="other"}(r||(t.QualityLimitationReason=r={}))},280:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},767:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},185:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.calculatePacketsLostRatio=t.calculateRate=t.getMediaKind=void 0,t.getMediaKind=e=>{let t=e.kind||e.mediaType;return["audio","video"].includes(t)||"inbound-rtp"!==e.type||(t=e.id.toLocaleLowerCase().includes("video")?"video":"audio"),t},t.calculateRate=(e,t,r,n)=>r&&n?(t-n)/((e-r)/1e3):0,t.calculatePacketsLostRatio=(e,t,r,n)=>0==t?0:(e-(null!=r?r:0))/(t-(null!=n?n:0))},284:function(e,t,r){var n,s,i,o,a,c,l,u,d,h,f,p,m,g,y,v,w=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(s,i){function o(e){try{c(n.next(e))}catch(e){i(e)}}function a(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))},R=this&&this.__classPrivateFieldSet||function(e,t,r,n,s){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?s.call(e,r):s?s.value=r:t.set(e,r),r},k=this&&this.__classPrivateFieldGet||function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)},_=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.WebRTCStats=void 0;const I=r(7),E=_(r(586)),T=r(738),L=r(185);class P extends I.EventEmitter{constructor(e){super(),n.add(this),s.set(this,void 0),i.set(this,void 0),o.set(this,void 0),a.set(this,null),c.set(this,void 0),l.set(this,null),this.start=()=>{k(this,c,"f").info("WebRTC statistics collection is starting..."),R(this,l,null,"f"),R(this,a,setInterval(k(this,u,"f"),k(this,i,"f")),"f")},this.stop=()=>{k(this,a,"f")&&(clearInterval(k(this,a,"f")),R(this,a,null,"f"),k(this,c,"f").info("WebRTC statistics collection has stopped."))},u.set(this,()=>w(this,void 0,void 0,(function*(){let e,t;try{k(this,c,"f").trace("Requesting WebRTC statistics..."),e=yield k(this,s,"f").call(this),t=(new Date).toISOString()}catch(e){return k(this,c,"f").error("Problem collecting the WebRTC statistics.",e),void this.emit("error","Problem collecting the WebRTC statistics - "+e)}const r=Array.from(e.values()),i={timestamp:t,input:{audio:[],video:[]},output:{audio:[],video:[]}};k(this,o,"f")&&(i.rawStats=e);for(let t=0;t<Object.keys(r).length;t++){const s=r[t];switch(s.type){case"outbound-rtp":const t=s,r=(0,L.getMediaKind)(t);"audio"===r?yield k(this,n,"m",f).call(this,e,t,i):"video"===r&&(yield k(this,n,"m",p).call(this,e,t,i));break;case"inbound-rtp":const o=s;let a=(0,L.getMediaKind)(o);"audio"===a?yield k(this,n,"m",g).call(this,e,o,i):"video"===a&&(yield k(this,n,"m",y).call(this,e,o,i));break;case"candidate-pair":const c=s;c.nominated&&k(this,n,"m",v).call(this,c,i)}}R(this,l,i,"f"),this.emit("stats",i)}))),R(this,c,E.default.get("WebRTCStats"),"f"),R(this,s,e.getStats,"f"),R(this,i,e.getStatsInterval||1e3,"f"),R(this,o,!!e.includeRawStats,"f")}}t.WebRTCStats=P,s=new WeakMap,i=new WeakMap,o=new WeakMap,a=new WeakMap,c=new WeakMap,l=new WeakMap,u=new WeakMap,n=new WeakSet,d=function(e,t){if(t){const r=e.get(t);if(r)return{mimeType:r.mimeType}}return{}},h=function(e,t,r){return w(this,void 0,void 0,(function*(){var s,i,o,a;const c=(0,L.calculateRate)(t.timestamp,t.bytesSent,null==r?void 0:r.timestamp,null==r?void 0:r.totalBytesSent),l=(0,L.calculateRate)(t.timestamp,t.packetsSent,null==r?void 0:r.timestamp,null==r?void 0:r.totalPacketsSent),u=k(this,n,"m",d).call(this,e,t.codecId);return Object.assign({id:t.id,timestamp:t.timestamp,mid:t.mid,totalBytesSent:t.bytesSent,bytesSentDelta:t.bytesSent-(null!==(s=null==r?void 0:r.totalBytesSent)&&void 0!==s?s:0),totalPacketsSent:t.packetsSent,packetsSentDelta:t.packetsSent-(null!==(i=null==r?void 0:r.totalPacketsSent)&&void 0!==i?i:0),bitrate:c,packetRate:l,targetBitrate:t.targetBitrate,retransmittedPacketsSent:t.retransmittedPacketsSent,retransmittedPacketsSentDelta:t.retransmittedPacketsSent-(null!==(o=null==r?void 0:r.retransmittedPacketsSent)&&void 0!==o?o:0),retransmittedBytesSent:t.retransmittedBytesSent,retransmittedBytesSentDelta:t.retransmittedBytesSent-(null!==(a=null==r?void 0:r.retransmittedBytesSent)&&void 0!==a?a:0)},u)}))},f=function(e,t,r){return w(this,void 0,void 0,(function*(){var s;const i=null===(s=k(this,l,"f"))||void 0===s?void 0:s.output.audio.find(e=>e.id===t.id);if(i&&t.timestamp-i.timestamp<=0)return;const o=yield k(this,n,"m",h).call(this,e,t,i),a=Object.assign({},o);r.output.audio.push(a)}))},p=function(e,t,r){return w(this,void 0,void 0,(function*(){var s;const i=null===(s=k(this,l,"f"))||void 0===s?void 0:s.output.video.find(e=>e.id===t.id);if(i&&t.timestamp-i.timestamp<=0)return;const o=yield k(this,n,"m",h).call(this,e,t,i);let a=T.QualityLimitationReason.none;t.qualityLimitationReason&&(a=t.qualityLimitationReason);const c=Object.assign(Object.assign({},o),{frameWidth:t.frameWidth,frameHeight:t.frameHeight,framesPerSecond:t.framesPerSecond,framesSent:t.framesSent,qualityLimitationReason:a,qualityLimitationDurations:t.qualityLimitationDurations});r.output.video.push(c)}))},m=function(e,t,r){return w(this,void 0,void 0,(function*(){var s,i;const o=(0,L.calculateRate)(t.timestamp,t.bytesReceived,null==r?void 0:r.timestamp,null==r?void 0:r.totalBytesReceived),a=(0,L.calculateRate)(t.timestamp,t.packetsReceived,null==r?void 0:r.timestamp,null==r?void 0:r.totalPacketsReceived),c=(0,L.calculatePacketsLostRatio)(t.packetsReceived,t.packetsLost,null==r?void 0:r.totalPacketsReceived,null==r?void 0:r.totalPacketsLost),l=(null!==(s=t.packetsLost)&&void 0!==s?s:0)-(null!==(i=null==r?void 0:r.totalPacketsLost)&&void 0!==i?i:0),u=k(this,n,"m",d).call(this,e,t.codecId);return Object.assign({id:t.id,timestamp:t.timestamp,mid:t.mid,trackIdentifier:t.trackIdentifier,jitter:t.jitter,jitterBufferDelay:t.jitterBufferDelay,jitterBufferEmittedCount:t.jitterBufferEmittedCount,totalBytesReceived:t.bytesReceived,totalPacketsReceived:t.packetsReceived,totalPacketsLost:t.packetsLost,bitrate:o,packetRate:a,packetLossRatio:c,packetLossDelta:l},u)}))},g=function(e,t,r){return w(this,void 0,void 0,(function*(){var s;const i=null===(s=k(this,l,"f"))||void 0===s?void 0:s.input.audio.find(e=>e.id===t.id);if(i&&t.timestamp-i.timestamp<=0)return;const o=yield k(this,n,"m",m).call(this,e,t,i);r.input.audio.push(o)}))},y=function(e,t,r){return w(this,void 0,void 0,(function*(){var s;const i=null===(s=k(this,l,"f"))||void 0===s?void 0:s.input.video.find(e=>e.id===t.id);if(i&&t.timestamp-i.timestamp<=0)return;const o=yield k(this,n,"m",m).call(this,e,t,i),a=Object.assign(Object.assign({},o),{keyFramesDecoded:t.keyFramesDecoded,frameHeight:t.frameHeight,frameWidth:t.frameWidth,framesDecoded:t.framesDecoded,framesDropped:t.framesDropped,framesPerSecond:t.framesPerSecond,framesReceived:t.framesReceived});r.input.video.push(a)}))},v=function(e,t){t.totalRoundTripTime=e.totalRoundTripTime,t.currentRoundTripTime=e.currentRoundTripTime,t.responsesReceived=e.responsesReceived,t.availableOutgoingBitrate=e.availableOutgoingBitrate,t.availableIncomingBitrate=e.availableIncomingBitrate}}},t={},function r(n){var s=t[n];if(void 0!==s)return s.exports;var i=t[n]={exports:{}};return e[n].call(i.exports,i,i.exports,r),i.exports}(156);var e,t})}));class RTSLoader{constructor(){this.log=t("rts"),this.stats=new jo.WebRTCStats({getStatsInterval:5e3,getStats:()=>{var e,t;return(null===(t=null===(e=this.engine)||void 0===e?void 0:e.getRTCPeerConnection())||void 0===t?void 0:t.getStats())||Promise.resolve(new Map)}})}stop(){var e,t;null===(e=this.engine)||void 0===e||e.stop(),null===(t=this.stats)||void 0===t||t.stop()}init(e,t,r){r.on("reap",()=>this.stop()),r.on("src",()=>{this.engine&&(this.stop(),r.srcObject=null,this.engine=void 0)}),this.stats.on("stats",e=>{r.emit(Zo.events.STATS,{stats:e}),r.emit("health:record",{event:"rts/stats",detail:{stats:e}})})}onload(e,t,r,n){var s;switch(n.type){case MillicastAdapter.Type:this.engine=new MillicastAdapter(r,n);break;case WowzaWebRTCAdapter.Type:this.engine=new WowzaWebRTCAdapter(r,n)}null===(s=this.engine)||void 0===s||s.load(),this.stats.start()}wants(e,t,r){return"string"==typeof t.type&&(MillicastAdapter.wants(t)||WowzaWebRTCAdapter.wants(t))}}RTSLoader.pluginName="rts",RTSLoader.events=fo,RTSLoader.state=ho;const Zo=function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;if(null===document.currentScript)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});const r=e.flowplayer;return"function"==typeof r?(r(t),t):(Array.isArray(r.extensions)||(r.extensions=[]),~r.extensions.indexOf(t)||r.extensions.push(t),t)}(window,RTSLoader);return Zo}));
25
+ var Sl=function(e){var t={exports:{}};return e(t,t.exports),t.exports}((function(e,t){!function(t,n){e.exports=n()}(self,()=>{return e={7:e=>{var t,n="object"==typeof Reflect?Reflect:null,r=n&&"function"==typeof n.apply?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};t=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var s=Number.isNaN||function(e){return e!=e};function i(){i.init.call(this)}e.exports=i,e.exports.once=function(e,t){return new Promise((function(n,r){function s(n){e.removeListener(t,i),r(n)}function i(){"function"==typeof e.removeListener&&e.removeListener("error",s),n([].slice.call(arguments))}m(e,t,i,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&m(e,"error",t,{once:!0})}(e,s)}))},i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var o=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?i.defaultMaxListeners:e._maxListeners}function l(e,t,n,r){var s,i,o,l;if(a(n),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),i=e._events),o=i[t]),void 0===o)o=i[t]=n,++e._eventsCount;else if("function"==typeof o?o=i[t]=r?[n,o]:[o,n]:r?o.unshift(n):o.push(n),(s=c(e))>0&&o.length>s&&!o.warned){o.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=o.length,l=u,console&&console.warn&&console.warn(l)}return e}function u(){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 d(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},s=u.bind(r);return s.listener=n,r.wrapFn=s,s}function p(e,t,n){var r=e._events;if(void 0===r)return[];var s=r[t];return void 0===s?[]:"function"==typeof s?n?[s.listener||s]:[s]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(s):h(s,s.length)}function f(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function h(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}function m(e,t,n,r){if("function"==typeof e.on)r.once?e.once(t,n):e.on(t,n);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 s(i){r.once&&e.removeEventListener(t,s),n(i)}))}}Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(e){if("number"!=typeof e||e<0||s(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");o=e}}),i.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},i.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||s(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},i.prototype.getMaxListeners=function(){return c(this)},i.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var s="error"===e,i=this._events;if(void 0!==i)s=s&&void 0===i.error;else if(!s)return!1;if(s){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var c=i[e];if(void 0===c)return!1;if("function"==typeof c)r(c,this,t);else{var l=c.length,u=h(c,l);for(n=0;n<l;++n)r(u[n],this,t)}return!0},i.prototype.addListener=function(e,t){return l(this,e,t,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(e,t){return l(this,e,t,!0)},i.prototype.once=function(e,t){return a(t),this.on(e,d(this,e,t)),this},i.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,d(this,e,t)),this},i.prototype.removeListener=function(e,t){var n,r,s,i,o;if(a(t),void 0===(r=this._events))return this;if(void 0===(n=r[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(s=-1,i=n.length-1;i>=0;i--)if(n[i]===t||n[i].listener===t){o=n[i].listener,s=i;break}if(s<0)return this;0===s?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,s),1===n.length&&(r[e]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",e,o||t)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(e){var t,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var s,i=Object.keys(n);for(r=0;r<i.length;++r)"removeListener"!==(s=i[r])&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},i.prototype.listeners=function(e){return p(this,e,!0)},i.prototype.rawListeners=function(e){return p(this,e,!1)},i.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):f.call(e,t)},i.prototype.listenerCount=f,i.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},586:function(e,t,n){var r,s;!function(i){var o,a={VERSION:"1.6.1"},c={},l=function(e,t){return function(){return t.apply(e,arguments)}},u=function(){var e,t,n=arguments,r=n[0];for(t=1;t<n.length;t++)for(e in n[t])!(e in r)&&n[t].hasOwnProperty(e)&&(r[e]=n[t][e]);return r},d=function(e,t){return{value:e,name:t}};a.TRACE=d(1,"TRACE"),a.DEBUG=d(2,"DEBUG"),a.INFO=d(3,"INFO"),a.TIME=d(4,"TIME"),a.WARN=d(5,"WARN"),a.ERROR=d(8,"ERROR"),a.OFF=d(99,"OFF");var p=function(e){this.context=e,this.setLevel(e.filterLevel),this.log=this.info};p.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(a.TRACE,arguments)},debug:function(){this.invoke(a.DEBUG,arguments)},info:function(){this.invoke(a.INFO,arguments)},warn:function(){this.invoke(a.WARN,arguments)},error:function(){this.invoke(a.ERROR,arguments)},time:function(e){"string"==typeof e&&e.length>0&&this.invoke(a.TIME,[e,"start"])},timeEnd:function(e){"string"==typeof e&&e.length>0&&this.invoke(a.TIME,[e,"end"])},invoke:function(e,t){o&&this.enabledFor(e)&&o(t,u({level:e},this.context))}};var f,h=new p({filterLevel:a.OFF});(f=a).enabledFor=l(h,h.enabledFor),f.trace=l(h,h.trace),f.debug=l(h,h.debug),f.time=l(h,h.time),f.timeEnd=l(h,h.timeEnd),f.info=l(h,h.info),f.warn=l(h,h.warn),f.error=l(h,h.error),f.log=f.info,a.setHandler=function(e){o=e},a.setLevel=function(e){for(var t in h.setLevel(e),c)c.hasOwnProperty(t)&&c[t].setLevel(e)},a.getLevel=function(){return h.getLevel()},a.get=function(e){return c[e]||(c[e]=new p(u({name:e},h.context)))},a.createDefaultHandler=function(e){(e=e||{}).formatter=e.formatter||function(e,t){t.name&&e.unshift("["+t.name+"]")};var t={},n=function(e,t){Function.prototype.apply.call(e,console,t)};return"undefined"==typeof console?function(){}:function(r,s){r=Array.prototype.slice.call(r);var i,o=console.log;s.level===a.TIME?(i=(s.name?"["+s.name+"] ":"")+r[0],"start"===r[1]?console.time?console.time(i):t[i]=(new Date).getTime():console.timeEnd?console.timeEnd(i):n(o,[i+": "+((new Date).getTime()-t[i])+"ms"])):(s.level===a.WARN&&console.warn?o=console.warn:s.level===a.ERROR&&console.error?o=console.error:s.level===a.INFO&&console.info?o=console.info:s.level===a.DEBUG&&console.debug?o=console.debug:s.level===a.TRACE&&console.trace&&(o=console.trace),e.formatter(r,s),n(o,r))}},a.useDefaults=function(e){a.setLevel(e&&e.defaultLevel||a.DEBUG),a.setHandler(a.createDefaultHandler(e))},a.setDefaults=a.useDefaults,void 0===(s="function"==typeof(r=a)?r.call(t,n,t,e):r)||(e.exports=s)}()},156:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var s=Object.getOwnPropertyDescriptor(t,n);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,s)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),s=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Logger=void 0;var o=n(586);Object.defineProperty(t,"Logger",{enumerable:!0,get:function(){return i(o).default}}),s(n(284),t),s(n(280),t),s(n(738),t),s(n(767),t)},738:(e,t)=>{var n;Object.defineProperty(t,"__esModule",{value:!0}),t.QualityLimitationReason=void 0,function(e){e[e.none=0]="none",e[e.cpu=1]="cpu",e[e.bandwidth=2]="bandwidth",e[e.other=3]="other"}(n||(t.QualityLimitationReason=n={}))},280:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},767:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},185:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.calculatePacketsLostRatio=t.calculateRate=t.getMediaKind=void 0,t.getMediaKind=e=>{let t=e.kind||e.mediaType;return["audio","video"].includes(t)||"inbound-rtp"!==e.type||(t=e.id.toLocaleLowerCase().includes("video")?"video":"audio"),t},t.calculateRate=(e,t,n,r)=>n&&r?(t-r)/((e-n)/1e3):0,t.calculatePacketsLostRatio=(e,t,n,r)=>0==t?0:(e-(null!=n?n:0))/(t-(null!=r?r:0))},284:function(e,t,n){var r,s,i,o,a,c,l,u,d,p,f,h,m,g,y,v,w=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(s,i){function o(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))},_=this&&this.__classPrivateFieldSet||function(e,t,n,r,s){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?s.call(e,n):s?s.value=n:t.set(e,n),n},R=this&&this.__classPrivateFieldGet||function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)},E=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.WebRTCStats=void 0;const I=n(7),k=E(n(586)),T=n(738),L=n(185);class P extends I.EventEmitter{constructor(e){super(),r.add(this),s.set(this,void 0),i.set(this,void 0),o.set(this,void 0),a.set(this,null),c.set(this,void 0),l.set(this,null),this.start=()=>{R(this,c,"f").info("WebRTC statistics collection is starting..."),_(this,l,null,"f"),_(this,a,setInterval(R(this,u,"f"),R(this,i,"f")),"f")},this.stop=()=>{R(this,a,"f")&&(clearInterval(R(this,a,"f")),_(this,a,null,"f"),R(this,c,"f").info("WebRTC statistics collection has stopped."))},u.set(this,()=>w(this,void 0,void 0,(function*(){let e,t;try{R(this,c,"f").trace("Requesting WebRTC statistics..."),e=yield R(this,s,"f").call(this),t=(new Date).toISOString()}catch(e){return R(this,c,"f").error("Problem collecting the WebRTC statistics.",e),void this.emit("error","Problem collecting the WebRTC statistics - "+e)}const n=Array.from(e.values()),i={timestamp:t,input:{audio:[],video:[]},output:{audio:[],video:[]}};R(this,o,"f")&&(i.rawStats=e);for(let t=0;t<Object.keys(n).length;t++){const s=n[t];switch(s.type){case"outbound-rtp":const t=s,n=(0,L.getMediaKind)(t);"audio"===n?yield R(this,r,"m",f).call(this,e,t,i):"video"===n&&(yield R(this,r,"m",h).call(this,e,t,i));break;case"inbound-rtp":const o=s;let a=(0,L.getMediaKind)(o);"audio"===a?yield R(this,r,"m",g).call(this,e,o,i):"video"===a&&(yield R(this,r,"m",y).call(this,e,o,i));break;case"candidate-pair":const c=s;c.nominated&&R(this,r,"m",v).call(this,c,i)}}_(this,l,i,"f"),this.emit("stats",i)}))),_(this,c,k.default.get("WebRTCStats"),"f"),_(this,s,e.getStats,"f"),_(this,i,e.getStatsInterval||1e3,"f"),_(this,o,!!e.includeRawStats,"f")}}t.WebRTCStats=P,s=new WeakMap,i=new WeakMap,o=new WeakMap,a=new WeakMap,c=new WeakMap,l=new WeakMap,u=new WeakMap,r=new WeakSet,d=function(e,t){if(t){const n=e.get(t);if(n)return{mimeType:n.mimeType}}return{}},p=function(e,t,n){return w(this,void 0,void 0,(function*(){var s,i,o,a;const c=(0,L.calculateRate)(t.timestamp,t.bytesSent,null==n?void 0:n.timestamp,null==n?void 0:n.totalBytesSent),l=(0,L.calculateRate)(t.timestamp,t.packetsSent,null==n?void 0:n.timestamp,null==n?void 0:n.totalPacketsSent),u=R(this,r,"m",d).call(this,e,t.codecId);return Object.assign({id:t.id,timestamp:t.timestamp,mid:t.mid,totalBytesSent:t.bytesSent,bytesSentDelta:t.bytesSent-(null!==(s=null==n?void 0:n.totalBytesSent)&&void 0!==s?s:0),totalPacketsSent:t.packetsSent,packetsSentDelta:t.packetsSent-(null!==(i=null==n?void 0:n.totalPacketsSent)&&void 0!==i?i:0),bitrate:c,packetRate:l,targetBitrate:t.targetBitrate,retransmittedPacketsSent:t.retransmittedPacketsSent,retransmittedPacketsSentDelta:t.retransmittedPacketsSent-(null!==(o=null==n?void 0:n.retransmittedPacketsSent)&&void 0!==o?o:0),retransmittedBytesSent:t.retransmittedBytesSent,retransmittedBytesSentDelta:t.retransmittedBytesSent-(null!==(a=null==n?void 0:n.retransmittedBytesSent)&&void 0!==a?a:0)},u)}))},f=function(e,t,n){return w(this,void 0,void 0,(function*(){var s;const i=null===(s=R(this,l,"f"))||void 0===s?void 0:s.output.audio.find(e=>e.id===t.id);if(i&&t.timestamp-i.timestamp<=0)return;const o=yield R(this,r,"m",p).call(this,e,t,i),a=Object.assign({},o);n.output.audio.push(a)}))},h=function(e,t,n){return w(this,void 0,void 0,(function*(){var s;const i=null===(s=R(this,l,"f"))||void 0===s?void 0:s.output.video.find(e=>e.id===t.id);if(i&&t.timestamp-i.timestamp<=0)return;const o=yield R(this,r,"m",p).call(this,e,t,i);let a=T.QualityLimitationReason.none;t.qualityLimitationReason&&(a=t.qualityLimitationReason);const c=Object.assign(Object.assign({},o),{frameWidth:t.frameWidth,frameHeight:t.frameHeight,framesPerSecond:t.framesPerSecond,framesSent:t.framesSent,qualityLimitationReason:a,qualityLimitationDurations:t.qualityLimitationDurations});n.output.video.push(c)}))},m=function(e,t,n){return w(this,void 0,void 0,(function*(){var s,i;const o=(0,L.calculateRate)(t.timestamp,t.bytesReceived,null==n?void 0:n.timestamp,null==n?void 0:n.totalBytesReceived),a=(0,L.calculateRate)(t.timestamp,t.packetsReceived,null==n?void 0:n.timestamp,null==n?void 0:n.totalPacketsReceived),c=(0,L.calculatePacketsLostRatio)(t.packetsReceived,t.packetsLost,null==n?void 0:n.totalPacketsReceived,null==n?void 0:n.totalPacketsLost),l=(null!==(s=t.packetsLost)&&void 0!==s?s:0)-(null!==(i=null==n?void 0:n.totalPacketsLost)&&void 0!==i?i:0),u=R(this,r,"m",d).call(this,e,t.codecId);return Object.assign({id:t.id,timestamp:t.timestamp,mid:t.mid,trackIdentifier:t.trackIdentifier,jitter:t.jitter,jitterBufferDelay:t.jitterBufferDelay,jitterBufferEmittedCount:t.jitterBufferEmittedCount,totalBytesReceived:t.bytesReceived,totalPacketsReceived:t.packetsReceived,totalPacketsLost:t.packetsLost,bitrate:o,packetRate:a,packetLossRatio:c,packetLossDelta:l},u)}))},g=function(e,t,n){return w(this,void 0,void 0,(function*(){var s;const i=null===(s=R(this,l,"f"))||void 0===s?void 0:s.input.audio.find(e=>e.id===t.id);if(i&&t.timestamp-i.timestamp<=0)return;const o=yield R(this,r,"m",m).call(this,e,t,i);n.input.audio.push(o)}))},y=function(e,t,n){return w(this,void 0,void 0,(function*(){var s;const i=null===(s=R(this,l,"f"))||void 0===s?void 0:s.input.video.find(e=>e.id===t.id);if(i&&t.timestamp-i.timestamp<=0)return;const o=yield R(this,r,"m",m).call(this,e,t,i),a=Object.assign(Object.assign({},o),{keyFramesDecoded:t.keyFramesDecoded,frameHeight:t.frameHeight,frameWidth:t.frameWidth,framesDecoded:t.framesDecoded,framesDropped:t.framesDropped,framesPerSecond:t.framesPerSecond,framesReceived:t.framesReceived});n.input.video.push(a)}))},v=function(e,t){t.totalRoundTripTime=e.totalRoundTripTime,t.currentRoundTripTime=e.currentRoundTripTime,t.responsesReceived=e.responsesReceived,t.availableOutgoingBitrate=e.availableOutgoingBitrate,t.availableIncomingBitrate=e.availableIncomingBitrate}}},t={},function n(r){var s=t[r];if(void 0!==s)return s.exports;var i=t[r]={exports:{}};return e[r].call(i.exports,i,i.exports,n),i.exports}(156);var e,t})}));class RTSLoader{constructor(){this.log=t("rts"),this.stats=new Sl.WebRTCStats({getStatsInterval:RTSLoader.ANALYTICS_INTERVAL,getStats:()=>{var e,t;return(null===(t=null===(e=this.engine)||void 0===e?void 0:e.getRTCPeerConnection())||void 0===t?void 0:t.getStats())||Promise.resolve(new Map)}})}stop(){var e,t;null===(e=this.engine)||void 0===e||e.stop(),null===(t=this.stats)||void 0===t||t.stop()}init(e,t,n){n.on(g,()=>this.stop()),n.on("src",()=>{this.engine&&(this.stop(),n.srcObject=null,this.engine=void 0)}),this.setupAnalytics(n)}setupAnalytics(e){this.setupAnalyticsRegular(e),this.setupAnalyticsOnClose(e)}setupAnalyticsRegular(e){this.stats.on("stats",t=>{var n;this.engine instanceof MillicastAdapter?(null===(n=this.engine)||void 0===n?void 0:n.isStreamActive())?(e.emit(_l.events.STATS,{stats:t}),e.emit(vc,{event:"rts/stats",detail:{stats:t}})):console.debug("ignoring rts stats when idle"):e.hasState(Jc.states.PLAYING)?(e.emit(_l.events.STATS,{stats:t}),e.emit(_l.events.STATS,{stats:t})):console.debug("ignoring rts stats when idle")})}setupAnalyticsOnClose(e){const t=()=>{const t=new Sl.WebRTCStats({getStatsInterval:100,getStats:()=>{var e,t;return(null===(t=null===(e=this.engine)||void 0===e?void 0:e.getRTCPeerConnection())||void 0===t?void 0:t.getStats())||Promise.resolve(new Map)}});t.start();let n=!1;t.on("stats",r=>{n&&(t.stop(),(r.input.video[0]||r.input.audio[0])&&e.emit(vc,{event:"rts/stats",detail:{stats:r}})),n=!0})};document.addEventListener("visibilitychange",()=>{this.engine instanceof MillicastAdapter&&"hidden"==document.visibilityState&&this.engine.isStreamActive()&&t()})}onload(e,t,n,r){var s;switch(r.type){case MillicastAdapter.Type:this.engine=new MillicastAdapter(n,r);break;case WowzaWebRTCAdapter.Type:this.engine=new WowzaWebRTCAdapter(n,r)}null===(s=this.engine)||void 0===s||s.load(),this.stats.start()}wants(e,t,n){return"string"==typeof t.type&&(MillicastAdapter.wants(t)||WowzaWebRTCAdapter.wants(t))}}RTSLoader.pluginName="rts",RTSLoader.events=Ao,RTSLoader.state=Lo,RTSLoader.ANALYTICS_INTERVAL=5e3;const _l=function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;if(null===document.currentScript)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});const n=e.flowplayer;return"function"==typeof n?(n(t),t):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(t)||n.extensions.push(t),t)}(window,RTSLoader);return _l}));