amazon-ivs-web-broadcast 1.3.0 → 1.3.2

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.
Files changed (41) hide show
  1. package/dist/amazon-ivs-web-broadcast-v1.js +1 -1
  2. package/dist/amazon-ivs-web-broadcast.js +1 -1
  3. package/dist/index.amazon-ivs-web-broadcast-v1.d.ts +1 -2
  4. package/dist/index.amazon-ivs-web-broadcast.d.ts +6 -0
  5. package/dist/src/broadcast/broadcast-canvas-manager.d.ts +326 -0
  6. package/dist/src/broadcast/broadcast-client-errors.d.ts +5 -0
  7. package/dist/src/broadcast/broadcast-client.d.ts +9 -14
  8. package/dist/src/broadcast/configuration.d.ts +1 -1
  9. package/dist/src/broadcast/index.d.ts +1 -1
  10. package/dist/src/broadcast/peer-client.d.ts +4 -1
  11. package/dist/src/client-common/analytics/events/session_video_encoder_configured.event.d.ts +1 -1
  12. package/dist/src/client-common/analytics/peer-stats-tracker.d.ts +5 -4
  13. package/dist/src/client-common/constants.d.ts +0 -8
  14. package/dist/src/client-common/media-stream-manager.d.ts +11 -351
  15. package/dist/src/client-common/utils/media-track-helpers.d.ts +12 -0
  16. package/dist/src/client-common/{test.utils.d.ts → utils/test.utils.d.ts} +3 -3
  17. package/dist/src/injection.d.ts +3 -2
  18. package/dist/src/stage/core-api/analytics/edp.pong.event.d.ts +13 -0
  19. package/dist/src/stage/core-api/analytics/error.event.d.ts +2 -0
  20. package/dist/src/stage/core-api/analytics/event.d.ts +2 -1
  21. package/dist/src/stage/core-api/errors/StageClientError.d.ts +79 -1
  22. package/dist/src/stage/core-api/peer-client.d.ts +23 -11
  23. package/dist/src/stage/core-api/socket.d.ts +6 -1
  24. package/dist/src/stage/core-api/stage-publication.d.ts +5 -2
  25. package/dist/src/stage/core-api/stage-subscription.d.ts +5 -3
  26. package/dist/src/stage/core-api/test-util/test-helpers.d.ts +14 -0
  27. package/dist/src/stage/core-api/token.d.ts +5 -0
  28. package/dist/src/stage/index.d.ts +3 -2
  29. package/dist/src/stage/v1/broadcast-stage-client.d.ts +2 -2
  30. package/dist/src/stage/v2/stage-participant/local-participant.d.ts +2 -1
  31. package/dist/src/stage/v2/stage-participant/remote-participant.d.ts +2 -1
  32. package/dist/src/stage/v2/stage-strategy-wrapper.d.ts +15 -0
  33. package/dist/src/stage/v2/stage-stream.d.ts +1 -4
  34. package/dist/src/stage/v2/stage.d.ts +3 -1
  35. package/dist/src/stage/v2/stage.test.d.ts +1 -0
  36. package/package.json +12 -6
  37. /package/dist/src/{client-common/media-stream-manager.test.d.ts → broadcast/broadcast-canvas-manager.test.d.ts} +0 -0
  38. /package/dist/src/client-common/{sdp-ftmp-line.d.ts → utils/sdp-ftmp-line.d.ts} +0 -0
  39. /package/dist/src/client-common/{sdp-ftmp-line.test.d.ts → utils/sdp-ftmp-line.test.d.ts} +0 -0
  40. /package/dist/src/client-common/{sdp-utils.d.ts → utils/sdp-utils.d.ts} +0 -0
  41. /package/dist/src/client-common/{sdp-utils.test.d.ts → utils/sdp-utils.test.d.ts} +0 -0
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see amazon-ivs-web-broadcast-v1.js.LICENSE.txt */
2
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.IVSBroadcastClient=e():t.IVSBroadcastClient=e()}(self,(()=>(()=>{var t={9669:(t,e,n)=>{t.exports=n(1609)},5448:(t,e,n)=>{"use strict";var r=n(4867),i=n(6026),o=n(4372),s=n(5327),a=n(4097),c=n(4109),u=n(7985),d=n(7874),l=n(2648),h=n(644),p=n(205);t.exports=function(t){return new Promise((function(e,n){var f,g=t.data,v=t.headers,m=t.responseType;function y(){t.cancelToken&&t.cancelToken.unsubscribe(f),t.signal&&t.signal.removeEventListener("abort",f)}r.isFormData(g)&&r.isStandardBrowserEnv()&&delete v["Content-Type"];var _=new XMLHttpRequest;if(t.auth){var b=t.auth.username||"",E=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";v.Authorization="Basic "+btoa(b+":"+E)}var S=a(t.baseURL,t.url);function C(){if(_){var r="getAllResponseHeaders"in _?c(_.getAllResponseHeaders()):null,o={data:m&&"text"!==m&&"json"!==m?_.response:_.responseText,status:_.status,statusText:_.statusText,headers:r,config:t,request:_};i((function(t){e(t),y()}),(function(t){n(t),y()}),o),_=null}}if(_.open(t.method.toUpperCase(),s(S,t.params,t.paramsSerializer),!0),_.timeout=t.timeout,"onloadend"in _?_.onloadend=C:_.onreadystatechange=function(){_&&4===_.readyState&&(0!==_.status||_.responseURL&&0===_.responseURL.indexOf("file:"))&&setTimeout(C)},_.onabort=function(){_&&(n(new l("Request aborted",l.ECONNABORTED,t,_)),_=null)},_.onerror=function(){n(new l("Network Error",l.ERR_NETWORK,t,_,_)),_=null},_.ontimeout=function(){var e=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",r=t.transitional||d;t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),n(new l(e,r.clarifyTimeoutError?l.ETIMEDOUT:l.ECONNABORTED,t,_)),_=null},r.isStandardBrowserEnv()){var w=(t.withCredentials||u(S))&&t.xsrfCookieName?o.read(t.xsrfCookieName):void 0;w&&(v[t.xsrfHeaderName]=w)}"setRequestHeader"in _&&r.forEach(v,(function(t,e){void 0===g&&"content-type"===e.toLowerCase()?delete v[e]:_.setRequestHeader(e,t)})),r.isUndefined(t.withCredentials)||(_.withCredentials=!!t.withCredentials),m&&"json"!==m&&(_.responseType=t.responseType),"function"==typeof t.onDownloadProgress&&_.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&_.upload&&_.upload.addEventListener("progress",t.onUploadProgress),(t.cancelToken||t.signal)&&(f=function(t){_&&(n(!t||t&&t.type?new h:t),_.abort(),_=null)},t.cancelToken&&t.cancelToken.subscribe(f),t.signal&&(t.signal.aborted?f():t.signal.addEventListener("abort",f))),g||(g=null);var T=p(S);T&&-1===["http","https","file"].indexOf(T)?n(new l("Unsupported protocol "+T+":",l.ERR_BAD_REQUEST,t)):_.send(g)}))}},1609:(t,e,n)=>{"use strict";var r=n(4867),i=n(1849),o=n(321),s=n(7185);var a=function t(e){var n=new o(e),a=i(o.prototype.request,n);return r.extend(a,o.prototype,n),r.extend(a,n),a.create=function(n){return t(s(e,n))},a}(n(5546));a.Axios=o,a.CanceledError=n(644),a.CancelToken=n(4972),a.isCancel=n(6502),a.VERSION=n(7288).version,a.toFormData=n(7675),a.AxiosError=n(2648),a.Cancel=a.CanceledError,a.all=function(t){return Promise.all(t)},a.spread=n(8713),a.isAxiosError=n(6268),t.exports=a,t.exports.default=a},4972:(t,e,n)=>{"use strict";var r=n(644);function i(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");var e;this.promise=new Promise((function(t){e=t}));var n=this;this.promise.then((function(t){if(n._listeners){var e,r=n._listeners.length;for(e=0;e<r;e++)n._listeners[e](t);n._listeners=null}})),this.promise.then=function(t){var e,r=new Promise((function(t){n.subscribe(t),e=t})).then(t);return r.cancel=function(){n.unsubscribe(e)},r},t((function(t){n.reason||(n.reason=new r(t),e(n.reason))}))}i.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},i.prototype.subscribe=function(t){this.reason?t(this.reason):this._listeners?this._listeners.push(t):this._listeners=[t]},i.prototype.unsubscribe=function(t){if(this._listeners){var e=this._listeners.indexOf(t);-1!==e&&this._listeners.splice(e,1)}},i.source=function(){var t;return{token:new i((function(e){t=e})),cancel:t}},t.exports=i},644:(t,e,n)=>{"use strict";var r=n(2648);function i(t){r.call(this,null==t?"canceled":t,r.ERR_CANCELED),this.name="CanceledError"}n(4867).inherits(i,r,{__CANCEL__:!0}),t.exports=i},6502:t=>{"use strict";t.exports=function(t){return!(!t||!t.__CANCEL__)}},321:(t,e,n)=>{"use strict";var r=n(4867),i=n(5327),o=n(782),s=n(3572),a=n(7185),c=n(4097),u=n(4875),d=u.validators;function l(t){this.defaults=t,this.interceptors={request:new o,response:new o}}l.prototype.request=function(t,e){"string"==typeof t?(e=e||{}).url=t:e=t||{},(e=a(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var n=e.transitional;void 0!==n&&u.assertOptions(n,{silentJSONParsing:d.transitional(d.boolean),forcedJSONParsing:d.transitional(d.boolean),clarifyTimeoutError:d.transitional(d.boolean)},!1);var r=[],i=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(i=i&&t.synchronous,r.unshift(t.fulfilled,t.rejected))}));var o,c=[];if(this.interceptors.response.forEach((function(t){c.push(t.fulfilled,t.rejected)})),!i){var l=[s,void 0];for(Array.prototype.unshift.apply(l,r),l=l.concat(c),o=Promise.resolve(e);l.length;)o=o.then(l.shift(),l.shift());return o}for(var h=e;r.length;){var p=r.shift(),f=r.shift();try{h=p(h)}catch(t){f(t);break}}try{o=s(h)}catch(t){return Promise.reject(t)}for(;c.length;)o=o.then(c.shift(),c.shift());return o},l.prototype.getUri=function(t){t=a(this.defaults,t);var e=c(t.baseURL,t.url);return i(e,t.params,t.paramsSerializer)},r.forEach(["delete","get","head","options"],(function(t){l.prototype[t]=function(e,n){return this.request(a(n||{},{method:t,url:e,data:(n||{}).data}))}})),r.forEach(["post","put","patch"],(function(t){function e(e){return function(n,r,i){return this.request(a(i||{},{method:t,headers:e?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}l.prototype[t]=e(),l.prototype[t+"Form"]=e(!0)})),t.exports=l},2648:(t,e,n)=>{"use strict";var r=n(4867);function i(t,e,n,r,i){Error.call(this),this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i)}r.inherits(i,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var o=i.prototype,s={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED"].forEach((function(t){s[t]={value:t}})),Object.defineProperties(i,s),Object.defineProperty(o,"isAxiosError",{value:!0}),i.from=function(t,e,n,s,a,c){var u=Object.create(o);return r.toFlatObject(t,u,(function(t){return t!==Error.prototype})),i.call(u,t.message,e,n,s,a),u.name=t.name,c&&Object.assign(u,c),u},t.exports=i},782:(t,e,n)=>{"use strict";var r=n(4867);function i(){this.handlers=[]}i.prototype.use=function(t,e,n){return this.handlers.push({fulfilled:t,rejected:e,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1},i.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},i.prototype.forEach=function(t){r.forEach(this.handlers,(function(e){null!==e&&t(e)}))},t.exports=i},4097:(t,e,n)=>{"use strict";var r=n(1793),i=n(7303);t.exports=function(t,e){return t&&!r(e)?i(t,e):e}},3572:(t,e,n)=>{"use strict";var r=n(4867),i=n(8527),o=n(6502),s=n(5546),a=n(644);function c(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new a}t.exports=function(t){return c(t),t.headers=t.headers||{},t.data=i.call(t,t.data,t.headers,t.transformRequest),t.headers=r.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),r.forEach(["delete","get","head","post","put","patch","common"],(function(e){delete t.headers[e]})),(t.adapter||s.adapter)(t).then((function(e){return c(t),e.data=i.call(t,e.data,e.headers,t.transformResponse),e}),(function(e){return o(e)||(c(t),e&&e.response&&(e.response.data=i.call(t,e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)}))}},7185:(t,e,n)=>{"use strict";var r=n(4867);t.exports=function(t,e){e=e||{};var n={};function i(t,e){return r.isPlainObject(t)&&r.isPlainObject(e)?r.merge(t,e):r.isPlainObject(e)?r.merge({},e):r.isArray(e)?e.slice():e}function o(n){return r.isUndefined(e[n])?r.isUndefined(t[n])?void 0:i(void 0,t[n]):i(t[n],e[n])}function s(t){if(!r.isUndefined(e[t]))return i(void 0,e[t])}function a(n){return r.isUndefined(e[n])?r.isUndefined(t[n])?void 0:i(void 0,t[n]):i(void 0,e[n])}function c(n){return n in e?i(t[n],e[n]):n in t?i(void 0,t[n]):void 0}var u={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:c};return r.forEach(Object.keys(t).concat(Object.keys(e)),(function(t){var e=u[t]||o,i=e(t);r.isUndefined(i)&&e!==c||(n[t]=i)})),n}},6026:(t,e,n)=>{"use strict";var r=n(2648);t.exports=function(t,e,n){var i=n.config.validateStatus;n.status&&i&&!i(n.status)?e(new r("Request failed with status code "+n.status,[r.ERR_BAD_REQUEST,r.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):t(n)}},8527:(t,e,n)=>{"use strict";var r=n(4867),i=n(5546);t.exports=function(t,e,n){var o=this||i;return r.forEach(n,(function(n){t=n.call(o,t,e)})),t}},5546:(t,e,n)=>{"use strict";var r=n(4867),i=n(6016),o=n(2648),s=n(7874),a=n(7675),c={"Content-Type":"application/x-www-form-urlencoded"};function u(t,e){!r.isUndefined(t)&&r.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var d,l={transitional:s,adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(d=n(5448)),d),transformRequest:[function(t,e){if(i(e,"Accept"),i(e,"Content-Type"),r.isFormData(t)||r.isArrayBuffer(t)||r.isBuffer(t)||r.isStream(t)||r.isFile(t)||r.isBlob(t))return t;if(r.isArrayBufferView(t))return t.buffer;if(r.isURLSearchParams(t))return u(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString();var n,o=r.isObject(t),s=e&&e["Content-Type"];if((n=r.isFileList(t))||o&&"multipart/form-data"===s){var c=this.env&&this.env.FormData;return a(n?{"files[]":t}:t,c&&new c)}return o||"application/json"===s?(u(e,"application/json"),function(t,e,n){if(r.isString(t))try{return(e||JSON.parse)(t),r.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(n||JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){var e=this.transitional||l.transitional,n=e&&e.silentJSONParsing,i=e&&e.forcedJSONParsing,s=!n&&"json"===this.responseType;if(s||i&&r.isString(t)&&t.length)try{return JSON.parse(t)}catch(t){if(s){if("SyntaxError"===t.name)throw o.from(t,o.ERR_BAD_RESPONSE,this,null,this.response);throw t}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:n(1623)},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};r.forEach(["delete","get","head"],(function(t){l.headers[t]={}})),r.forEach(["post","put","patch"],(function(t){l.headers[t]=r.merge(c)})),t.exports=l},7874:t=>{"use strict";t.exports={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1}},7288:t=>{t.exports={version:"0.27.2"}},1849:t=>{"use strict";t.exports=function(t,e){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return t.apply(e,n)}}},5327:(t,e,n)=>{"use strict";var r=n(4867);function i(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}t.exports=function(t,e,n){if(!e)return t;var o;if(n)o=n(e);else if(r.isURLSearchParams(e))o=e.toString();else{var s=[];r.forEach(e,(function(t,e){null!=t&&(r.isArray(t)?e+="[]":t=[t],r.forEach(t,(function(t){r.isDate(t)?t=t.toISOString():r.isObject(t)&&(t=JSON.stringify(t)),s.push(i(e)+"="+i(t))})))})),o=s.join("&")}if(o){var a=t.indexOf("#");-1!==a&&(t=t.slice(0,a)),t+=(-1===t.indexOf("?")?"?":"&")+o}return t}},7303:t=>{"use strict";t.exports=function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}},4372:(t,e,n)=>{"use strict";var r=n(4867);t.exports=r.isStandardBrowserEnv()?{write:function(t,e,n,i,o,s){var a=[];a.push(t+"="+encodeURIComponent(e)),r.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),r.isString(i)&&a.push("path="+i),r.isString(o)&&a.push("domain="+o),!0===s&&a.push("secure"),document.cookie=a.join("; ")},read:function(t){var e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},1793:t=>{"use strict";t.exports=function(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}},6268:(t,e,n)=>{"use strict";var r=n(4867);t.exports=function(t){return r.isObject(t)&&!0===t.isAxiosError}},7985:(t,e,n)=>{"use strict";var r=n(4867);t.exports=r.isStandardBrowserEnv()?function(){var t,e=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function i(t){var r=t;return e&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return t=i(window.location.href),function(e){var n=r.isString(e)?i(e):e;return n.protocol===t.protocol&&n.host===t.host}}():function(){return!0}},6016:(t,e,n)=>{"use strict";var r=n(4867);t.exports=function(t,e){r.forEach(t,(function(n,r){r!==e&&r.toUpperCase()===e.toUpperCase()&&(t[e]=n,delete t[r])}))}},1623:t=>{t.exports=null},4109:(t,e,n)=>{"use strict";var r=n(4867),i=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];t.exports=function(t){var e,n,o,s={};return t?(r.forEach(t.split("\n"),(function(t){if(o=t.indexOf(":"),e=r.trim(t.substr(0,o)).toLowerCase(),n=r.trim(t.substr(o+1)),e){if(s[e]&&i.indexOf(e)>=0)return;s[e]="set-cookie"===e?(s[e]?s[e]:[]).concat([n]):s[e]?s[e]+", "+n:n}})),s):s}},205:t=>{"use strict";t.exports=function(t){var e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}},8713:t=>{"use strict";t.exports=function(t){return function(e){return t.apply(null,e)}}},7675:(t,e,n)=>{"use strict";var r=n(4867);t.exports=function(t,e){e=e||new FormData;var n=[];function i(t){return null===t?"":r.isDate(t)?t.toISOString():r.isArrayBuffer(t)||r.isTypedArray(t)?"function"==typeof Blob?new Blob([t]):Buffer.from(t):t}return function t(o,s){if(r.isPlainObject(o)||r.isArray(o)){if(-1!==n.indexOf(o))throw Error("Circular reference detected in "+s);n.push(o),r.forEach(o,(function(n,o){if(!r.isUndefined(n)){var a,c=s?s+"."+o:o;if(n&&!s&&"object"==typeof n)if(r.endsWith(o,"{}"))n=JSON.stringify(n);else if(r.endsWith(o,"[]")&&(a=r.toArray(n)))return void a.forEach((function(t){!r.isUndefined(t)&&e.append(c,i(t))}));t(n,c)}})),n.pop()}else e.append(s,i(o))}(t),e}},4875:(t,e,n)=>{"use strict";var r=n(7288).version,i=n(2648),o={};["object","boolean","number","function","string","symbol"].forEach((function(t,e){o[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}}));var s={};o.transitional=function(t,e,n){function o(t,e){return"[Axios v"+r+"] Transitional option '"+t+"'"+e+(n?". "+n:"")}return function(n,r,a){if(!1===t)throw new i(o(r," has been removed"+(e?" in "+e:"")),i.ERR_DEPRECATED);return e&&!s[r]&&(s[r]=!0,console.warn(o(r," has been deprecated since v"+e+" and will be removed in the near future"))),!t||t(n,r,a)}},t.exports={assertOptions:function(t,e,n){if("object"!=typeof t)throw new i("options must be an object",i.ERR_BAD_OPTION_VALUE);for(var r=Object.keys(t),o=r.length;o-- >0;){var s=r[o],a=e[s];if(a){var c=t[s],u=void 0===c||a(c,s,t);if(!0!==u)throw new i("option "+s+" must be "+u,i.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new i("Unknown option "+s,i.ERR_BAD_OPTION)}},validators:o}},4867:(t,e,n)=>{"use strict";var r,i=n(1849),o=Object.prototype.toString,s=(r=Object.create(null),function(t){var e=o.call(t);return r[e]||(r[e]=e.slice(8,-1).toLowerCase())});function a(t){return t=t.toLowerCase(),function(e){return s(e)===t}}function c(t){return Array.isArray(t)}function u(t){return void 0===t}var d=a("ArrayBuffer");function l(t){return null!==t&&"object"==typeof t}function h(t){if("object"!==s(t))return!1;var e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}var p=a("Date"),f=a("File"),g=a("Blob"),v=a("FileList");function m(t){return"[object Function]"===o.call(t)}var y=a("URLSearchParams");function _(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),c(t))for(var n=0,r=t.length;n<r;n++)e.call(null,t[n],n,t);else for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.call(null,t[i],i,t)}var b,E=(b="undefined"!=typeof Uint8Array&&Object.getPrototypeOf(Uint8Array),function(t){return b&&t instanceof b});t.exports={isArray:c,isArrayBuffer:d,isBuffer:function(t){return null!==t&&!u(t)&&null!==t.constructor&&!u(t.constructor)&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)},isFormData:function(t){var e="[object FormData]";return t&&("function"==typeof FormData&&t instanceof FormData||o.call(t)===e||m(t.toString)&&t.toString()===e)},isArrayBufferView:function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&d(t.buffer)},isString:function(t){return"string"==typeof t},isNumber:function(t){return"number"==typeof t},isObject:l,isPlainObject:h,isUndefined:u,isDate:p,isFile:f,isBlob:g,isFunction:m,isStream:function(t){return l(t)&&m(t.pipe)},isURLSearchParams:y,isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:_,merge:function t(){var e={};function n(n,r){h(e[r])&&h(n)?e[r]=t(e[r],n):h(n)?e[r]=t({},n):c(n)?e[r]=n.slice():e[r]=n}for(var r=0,i=arguments.length;r<i;r++)_(arguments[r],n);return e},extend:function(t,e,n){return _(e,(function(e,r){t[r]=n&&"function"==typeof e?i(e,n):e})),t},trim:function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")},stripBOM:function(t){return 65279===t.charCodeAt(0)&&(t=t.slice(1)),t},inherits:function(t,e,n,r){t.prototype=Object.create(e.prototype,r),t.prototype.constructor=t,n&&Object.assign(t.prototype,n)},toFlatObject:function(t,e,n){var r,i,o,s={};e=e||{};do{for(i=(r=Object.getOwnPropertyNames(t)).length;i-- >0;)s[o=r[i]]||(e[o]=t[o],s[o]=!0);t=Object.getPrototypeOf(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},kindOf:s,kindOfTest:a,endsWith:function(t,e,n){t=String(t),(void 0===n||n>t.length)&&(n=t.length),n-=e.length;var r=t.indexOf(e,n);return-1!==r&&r===n},toArray:function(t){if(!t)return null;var e=t.length;if(u(e))return null;for(var n=new Array(e);e-- >0;)n[e]=t[e];return n},isTypedArray:E,isFileList:v}},1206:function(t){t.exports=function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=90)}({17:function(t,e,n){"use strict";e.__esModule=!0,e.default=void 0;var r=n(18),i=function(){function t(){}return t.getFirstMatch=function(t,e){var n=e.match(t);return n&&n.length>0&&n[1]||""},t.getSecondMatch=function(t,e){var n=e.match(t);return n&&n.length>1&&n[2]||""},t.matchAndReturnConst=function(t,e,n){if(t.test(e))return n},t.getWindowsVersionName=function(t){switch(t){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},t.getMacOSVersionName=function(t){var e=t.split(".").splice(0,2).map((function(t){return parseInt(t,10)||0}));if(e.push(0),10===e[0])switch(e[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},t.getAndroidVersionName=function(t){var e=t.split(".").splice(0,2).map((function(t){return parseInt(t,10)||0}));if(e.push(0),!(1===e[0]&&e[1]<5))return 1===e[0]&&e[1]<6?"Cupcake":1===e[0]&&e[1]>=6?"Donut":2===e[0]&&e[1]<2?"Eclair":2===e[0]&&2===e[1]?"Froyo":2===e[0]&&e[1]>2?"Gingerbread":3===e[0]?"Honeycomb":4===e[0]&&e[1]<1?"Ice Cream Sandwich":4===e[0]&&e[1]<4?"Jelly Bean":4===e[0]&&e[1]>=4?"KitKat":5===e[0]?"Lollipop":6===e[0]?"Marshmallow":7===e[0]?"Nougat":8===e[0]?"Oreo":9===e[0]?"Pie":void 0},t.getVersionPrecision=function(t){return t.split(".").length},t.compareVersions=function(e,n,r){void 0===r&&(r=!1);var i=t.getVersionPrecision(e),o=t.getVersionPrecision(n),s=Math.max(i,o),a=0,c=t.map([e,n],(function(e){var n=s-t.getVersionPrecision(e),r=e+new Array(n+1).join(".0");return t.map(r.split("."),(function(t){return new Array(20-t.length).join("0")+t})).reverse()}));for(r&&(a=s-Math.min(i,o)),s-=1;s>=a;){if(c[0][s]>c[1][s])return 1;if(c[0][s]===c[1][s]){if(s===a)return 0;s-=1}else if(c[0][s]<c[1][s])return-1}},t.map=function(t,e){var n,r=[];if(Array.prototype.map)return Array.prototype.map.call(t,e);for(n=0;n<t.length;n+=1)r.push(e(t[n]));return r},t.find=function(t,e){var n,r;if(Array.prototype.find)return Array.prototype.find.call(t,e);for(n=0,r=t.length;n<r;n+=1){var i=t[n];if(e(i,n))return i}},t.assign=function(t){for(var e,n,r=t,i=arguments.length,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];if(Object.assign)return Object.assign.apply(Object,[t].concat(o));var a=function(){var t=o[e];"object"==typeof t&&null!==t&&Object.keys(t).forEach((function(e){r[e]=t[e]}))};for(e=0,n=o.length;e<n;e+=1)a();return t},t.getBrowserAlias=function(t){return r.BROWSER_ALIASES_MAP[t]},t.getBrowserTypeByAlias=function(t){return r.BROWSER_MAP[t]||""},t}();e.default=i,t.exports=e.default},18:function(t,e,n){"use strict";e.__esModule=!0,e.ENGINE_MAP=e.OS_MAP=e.PLATFORMS_MAP=e.BROWSER_MAP=e.BROWSER_ALIASES_MAP=void 0,e.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},e.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},e.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},e.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},e.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(t,e,n){"use strict";e.__esModule=!0,e.default=void 0;var r,i=(r=n(91))&&r.__esModule?r:{default:r},o=n(18);function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var a=function(){function t(){}var e,n,r;return t.getParser=function(t,e){if(void 0===e&&(e=!1),"string"!=typeof t)throw new Error("UserAgent should be a string");return new i.default(t,e)},t.parse=function(t){return new i.default(t).getResult()},e=t,r=[{key:"BROWSER_MAP",get:function(){return o.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return o.ENGINE_MAP}},{key:"OS_MAP",get:function(){return o.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return o.PLATFORMS_MAP}}],(n=null)&&s(e.prototype,n),r&&s(e,r),t}();e.default=a,t.exports=e.default},91:function(t,e,n){"use strict";e.__esModule=!0,e.default=void 0;var r=c(n(92)),i=c(n(93)),o=c(n(94)),s=c(n(95)),a=c(n(17));function c(t){return t&&t.__esModule?t:{default:t}}var u=function(){function t(t,e){if(void 0===e&&(e=!1),null==t||""===t)throw new Error("UserAgent parameter can't be empty");this._ua=t,this.parsedResult={},!0!==e&&this.parse()}var e=t.prototype;return e.getUA=function(){return this._ua},e.test=function(t){return t.test(this._ua)},e.parseBrowser=function(){var t=this;this.parsedResult.browser={};var e=a.default.find(r.default,(function(e){if("function"==typeof e.test)return e.test(t);if(e.test instanceof Array)return e.test.some((function(e){return t.test(e)}));throw new Error("Browser's test function is not valid")}));return e&&(this.parsedResult.browser=e.describe(this.getUA())),this.parsedResult.browser},e.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},e.getBrowserName=function(t){return t?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},e.getBrowserVersion=function(){return this.getBrowser().version},e.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},e.parseOS=function(){var t=this;this.parsedResult.os={};var e=a.default.find(i.default,(function(e){if("function"==typeof e.test)return e.test(t);if(e.test instanceof Array)return e.test.some((function(e){return t.test(e)}));throw new Error("Browser's test function is not valid")}));return e&&(this.parsedResult.os=e.describe(this.getUA())),this.parsedResult.os},e.getOSName=function(t){var e=this.getOS().name;return t?String(e).toLowerCase()||"":e||""},e.getOSVersion=function(){return this.getOS().version},e.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},e.getPlatformType=function(t){void 0===t&&(t=!1);var e=this.getPlatform().type;return t?String(e).toLowerCase()||"":e||""},e.parsePlatform=function(){var t=this;this.parsedResult.platform={};var e=a.default.find(o.default,(function(e){if("function"==typeof e.test)return e.test(t);if(e.test instanceof Array)return e.test.some((function(e){return t.test(e)}));throw new Error("Browser's test function is not valid")}));return e&&(this.parsedResult.platform=e.describe(this.getUA())),this.parsedResult.platform},e.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},e.getEngineName=function(t){return t?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},e.parseEngine=function(){var t=this;this.parsedResult.engine={};var e=a.default.find(s.default,(function(e){if("function"==typeof e.test)return e.test(t);if(e.test instanceof Array)return e.test.some((function(e){return t.test(e)}));throw new Error("Browser's test function is not valid")}));return e&&(this.parsedResult.engine=e.describe(this.getUA())),this.parsedResult.engine},e.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},e.getResult=function(){return a.default.assign({},this.parsedResult)},e.satisfies=function(t){var e=this,n={},r=0,i={},o=0;if(Object.keys(t).forEach((function(e){var s=t[e];"string"==typeof s?(i[e]=s,o+=1):"object"==typeof s&&(n[e]=s,r+=1)})),r>0){var s=Object.keys(n),c=a.default.find(s,(function(t){return e.isOS(t)}));if(c){var u=this.satisfies(n[c]);if(void 0!==u)return u}var d=a.default.find(s,(function(t){return e.isPlatform(t)}));if(d){var l=this.satisfies(n[d]);if(void 0!==l)return l}}if(o>0){var h=Object.keys(i),p=a.default.find(h,(function(t){return e.isBrowser(t,!0)}));if(void 0!==p)return this.compareVersion(i[p])}},e.isBrowser=function(t,e){void 0===e&&(e=!1);var n=this.getBrowserName().toLowerCase(),r=t.toLowerCase(),i=a.default.getBrowserTypeByAlias(r);return e&&i&&(r=i.toLowerCase()),r===n},e.compareVersion=function(t){var e=[0],n=t,r=!1,i=this.getBrowserVersion();if("string"==typeof i)return">"===t[0]||"<"===t[0]?(n=t.substr(1),"="===t[1]?(r=!0,n=t.substr(2)):e=[],">"===t[0]?e.push(1):e.push(-1)):"="===t[0]?n=t.substr(1):"~"===t[0]&&(r=!0,n=t.substr(1)),e.indexOf(a.default.compareVersions(i,n,r))>-1},e.isOS=function(t){return this.getOSName(!0)===String(t).toLowerCase()},e.isPlatform=function(t){return this.getPlatformType(!0)===String(t).toLowerCase()},e.isEngine=function(t){return this.getEngineName(!0)===String(t).toLowerCase()},e.is=function(t,e){return void 0===e&&(e=!1),this.isBrowser(t,e)||this.isOS(t)||this.isPlatform(t)},e.some=function(t){var e=this;return void 0===t&&(t=[]),t.some((function(t){return e.is(t)}))},t}();e.default=u,t.exports=e.default},92:function(t,e,n){"use strict";e.__esModule=!0,e.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=/version\/(\d+(\.?_?\d+)+)/i,s=[{test:[/googlebot/i],describe:function(t){var e={name:"Googlebot"},n=i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,t)||i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/opera/i],describe:function(t){var e={name:"Opera"},n=i.default.getFirstMatch(o,t)||i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/opr\/|opios/i],describe:function(t){var e={name:"Opera"},n=i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,t)||i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/SamsungBrowser/i],describe:function(t){var e={name:"Samsung Internet for Android"},n=i.default.getFirstMatch(o,t)||i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/Whale/i],describe:function(t){var e={name:"NAVER Whale Browser"},n=i.default.getFirstMatch(o,t)||i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/MZBrowser/i],describe:function(t){var e={name:"MZ Browser"},n=i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,t)||i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/focus/i],describe:function(t){var e={name:"Focus"},n=i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,t)||i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/swing/i],describe:function(t){var e={name:"Swing"},n=i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,t)||i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/coast/i],describe:function(t){var e={name:"Opera Coast"},n=i.default.getFirstMatch(o,t)||i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(t){var e={name:"Opera Touch"},n=i.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,t)||i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/yabrowser/i],describe:function(t){var e={name:"Yandex Browser"},n=i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,t)||i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/ucbrowser/i],describe:function(t){var e={name:"UC Browser"},n=i.default.getFirstMatch(o,t)||i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/Maxthon|mxios/i],describe:function(t){var e={name:"Maxthon"},n=i.default.getFirstMatch(o,t)||i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/epiphany/i],describe:function(t){var e={name:"Epiphany"},n=i.default.getFirstMatch(o,t)||i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/puffin/i],describe:function(t){var e={name:"Puffin"},n=i.default.getFirstMatch(o,t)||i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/sleipnir/i],describe:function(t){var e={name:"Sleipnir"},n=i.default.getFirstMatch(o,t)||i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/k-meleon/i],describe:function(t){var e={name:"K-Meleon"},n=i.default.getFirstMatch(o,t)||i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/micromessenger/i],describe:function(t){var e={name:"WeChat"},n=i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,t)||i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/qqbrowser/i],describe:function(t){var e={name:/qqbrowserlite/i.test(t)?"QQ Browser Lite":"QQ Browser"},n=i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,t)||i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/msie|trident/i],describe:function(t){var e={name:"Internet Explorer"},n=i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/\sedg\//i],describe:function(t){var e={name:"Microsoft Edge"},n=i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/edg([ea]|ios)/i],describe:function(t){var e={name:"Microsoft Edge"},n=i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/vivaldi/i],describe:function(t){var e={name:"Vivaldi"},n=i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/seamonkey/i],describe:function(t){var e={name:"SeaMonkey"},n=i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/sailfish/i],describe:function(t){var e={name:"Sailfish"},n=i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,t);return n&&(e.version=n),e}},{test:[/silk/i],describe:function(t){var e={name:"Amazon Silk"},n=i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/phantom/i],describe:function(t){var e={name:"PhantomJS"},n=i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/slimerjs/i],describe:function(t){var e={name:"SlimerJS"},n=i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(t){var e={name:"BlackBerry"},n=i.default.getFirstMatch(o,t)||i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/(web|hpw)[o0]s/i],describe:function(t){var e={name:"WebOS Browser"},n=i.default.getFirstMatch(o,t)||i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/bada/i],describe:function(t){var e={name:"Bada"},n=i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/tizen/i],describe:function(t){var e={name:"Tizen"},n=i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,t)||i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/qupzilla/i],describe:function(t){var e={name:"QupZilla"},n=i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,t)||i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/firefox|iceweasel|fxios/i],describe:function(t){var e={name:"Firefox"},n=i.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/electron/i],describe:function(t){var e={name:"Electron"},n=i.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/MiuiBrowser/i],describe:function(t){var e={name:"Miui"},n=i.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/chromium/i],describe:function(t){var e={name:"Chromium"},n=i.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,t)||i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/chrome|crios|crmo/i],describe:function(t){var e={name:"Chrome"},n=i.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/GSA/i],describe:function(t){var e={name:"Google Search"},n=i.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:function(t){var e=!t.test(/like android/i),n=t.test(/android/i);return e&&n},describe:function(t){var e={name:"Android Browser"},n=i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/playstation 4/i],describe:function(t){var e={name:"PlayStation 4"},n=i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/safari|applewebkit/i],describe:function(t){var e={name:"Safari"},n=i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/.*/i],describe:function(t){var e=-1!==t.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:i.default.getFirstMatch(e,t),version:i.default.getSecondMatch(e,t)}}}];e.default=s,t.exports=e.default},93:function(t,e,n){"use strict";e.__esModule=!0,e.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:[/Roku\/DVP/],describe:function(t){var e=i.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,t);return{name:o.OS_MAP.Roku,version:e}}},{test:[/windows phone/i],describe:function(t){var e=i.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,t);return{name:o.OS_MAP.WindowsPhone,version:e}}},{test:[/windows /i],describe:function(t){var e=i.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,t),n=i.default.getWindowsVersionName(e);return{name:o.OS_MAP.Windows,version:e,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(t){var e={name:o.OS_MAP.iOS},n=i.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,t);return n&&(e.version=n),e}},{test:[/macintosh/i],describe:function(t){var e=i.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,t).replace(/[_\s]/g,"."),n=i.default.getMacOSVersionName(e),r={name:o.OS_MAP.MacOS,version:e};return n&&(r.versionName=n),r}},{test:[/(ipod|iphone|ipad)/i],describe:function(t){var e=i.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,t).replace(/[_\s]/g,".");return{name:o.OS_MAP.iOS,version:e}}},{test:function(t){var e=!t.test(/like android/i),n=t.test(/android/i);return e&&n},describe:function(t){var e=i.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,t),n=i.default.getAndroidVersionName(e),r={name:o.OS_MAP.Android,version:e};return n&&(r.versionName=n),r}},{test:[/(web|hpw)[o0]s/i],describe:function(t){var e=i.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,t),n={name:o.OS_MAP.WebOS};return e&&e.length&&(n.version=e),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(t){var e=i.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,t)||i.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,t)||i.default.getFirstMatch(/\bbb(\d+)/i,t);return{name:o.OS_MAP.BlackBerry,version:e}}},{test:[/bada/i],describe:function(t){var e=i.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,t);return{name:o.OS_MAP.Bada,version:e}}},{test:[/tizen/i],describe:function(t){var e=i.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,t);return{name:o.OS_MAP.Tizen,version:e}}},{test:[/linux/i],describe:function(){return{name:o.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:o.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(t){var e=i.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,t);return{name:o.OS_MAP.PlayStation4,version:e}}}];e.default=s,t.exports=e.default},94:function(t,e,n){"use strict";e.__esModule=!0,e.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(t){var e=i.default.getFirstMatch(/(can-l01)/i,t)&&"Nova",n={type:o.PLATFORMS_MAP.mobile,vendor:"Huawei"};return e&&(n.model=e),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(t){var e=t.test(/ipod|iphone/i),n=t.test(/like (ipod|iphone)/i);return e&&!n},describe:function(t){var e=i.default.getFirstMatch(/(ipod|iphone)/i,t);return{type:o.PLATFORMS_MAP.mobile,vendor:"Apple",model:e}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(t){return"blackberry"===t.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(t){return"bada"===t.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(t){return"windows phone"===t.getBrowserName()},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(t){var e=Number(String(t.getOSVersion()).split(".")[0]);return"android"===t.getOSName(!0)&&e>=3},describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(t){return"android"===t.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(t){return"macos"===t.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(t){return"windows"===t.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(t){return"linux"===t.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(t){return"playstation 4"===t.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}},{test:function(t){return"roku"===t.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}}];e.default=s,t.exports=e.default},95:function(t,e,n){"use strict";e.__esModule=!0,e.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:function(t){return"microsoft edge"===t.getBrowserName(!0)},describe:function(t){if(/\sedg\//i.test(t))return{name:o.ENGINE_MAP.Blink};var e=i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,t);return{name:o.ENGINE_MAP.EdgeHTML,version:e}}},{test:[/trident/i],describe:function(t){var e={name:o.ENGINE_MAP.Trident},n=i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:function(t){return t.test(/presto/i)},describe:function(t){var e={name:o.ENGINE_MAP.Presto},n=i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:function(t){var e=t.test(/gecko/i),n=t.test(/like gecko/i);return e&&!n},describe:function(t){var e={name:o.ENGINE_MAP.Gecko},n=i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:o.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(t){var e={name:o.ENGINE_MAP.WebKit},n=i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}}];e.default=s,t.exports=e.default}})},6729:t=>{"use strict";var e=Object.prototype.hasOwnProperty,n="~";function r(){}function i(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function o(t,e,r,o,s){if("function"!=typeof r)throw new TypeError("The listener must be a function");var a=new i(r,o||t,s),c=n?n+e:e;return t._events[c]?t._events[c].fn?t._events[c]=[t._events[c],a]:t._events[c].push(a):(t._events[c]=a,t._eventsCount++),t}function s(t,e){0==--t._eventsCount?t._events=new r:delete t._events[e]}function a(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),a.prototype.eventNames=function(){var t,r,i=[];if(0===this._eventsCount)return i;for(r in t=this._events)e.call(t,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(t)):i},a.prototype.listeners=function(t){var e=n?n+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,o=r.length,s=new Array(o);i<o;i++)s[i]=r[i].fn;return s},a.prototype.listenerCount=function(t){var e=n?n+t:t,r=this._events[e];return r?r.fn?1:r.length:0},a.prototype.emit=function(t,e,r,i,o,s){var a=n?n+t:t;if(!this._events[a])return!1;var c,u,d=this._events[a],l=arguments.length;if(d.fn){switch(d.once&&this.removeListener(t,d.fn,void 0,!0),l){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,e),!0;case 3:return d.fn.call(d.context,e,r),!0;case 4:return d.fn.call(d.context,e,r,i),!0;case 5:return d.fn.call(d.context,e,r,i,o),!0;case 6:return d.fn.call(d.context,e,r,i,o,s),!0}for(u=1,c=new Array(l-1);u<l;u++)c[u-1]=arguments[u];d.fn.apply(d.context,c)}else{var h,p=d.length;for(u=0;u<p;u++)switch(d[u].once&&this.removeListener(t,d[u].fn,void 0,!0),l){case 1:d[u].fn.call(d[u].context);break;case 2:d[u].fn.call(d[u].context,e);break;case 3:d[u].fn.call(d[u].context,e,r);break;case 4:d[u].fn.call(d[u].context,e,r,i);break;default:if(!c)for(h=1,c=new Array(l-1);h<l;h++)c[h-1]=arguments[h];d[u].fn.apply(d[u].context,c)}}return!0},a.prototype.on=function(t,e,n){return o(this,t,e,n,!1)},a.prototype.once=function(t,e,n){return o(this,t,e,n,!0)},a.prototype.removeListener=function(t,e,r,i){var o=n?n+t:t;if(!this._events[o])return this;if(!e)return s(this,o),this;var a=this._events[o];if(a.fn)a.fn!==e||i&&!a.once||r&&a.context!==r||s(this,o);else{for(var c=0,u=[],d=a.length;c<d;c++)(a[c].fn!==e||i&&!a[c].once||r&&a[c].context!==r)&&u.push(a[c]);u.length?this._events[o]=1===u.length?u[0]:u:s(this,o)}return this},a.prototype.removeAllListeners=function(t){var e;return t?(e=n?n+t:t,this._events[e]&&s(this,e)):(this._events=new r,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=n,a.EventEmitter=a,t.exports=a},7375:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=Symbol.for("INJECTION");function r(t,e,r,i){Object.defineProperty(t,e,{configurable:!0,enumerable:!0,get:function(){return i&&!Reflect.hasMetadata(n,this,e)&&Reflect.defineMetadata(n,r(),this,e),Reflect.hasMetadata(n,this,e)?Reflect.getMetadata(n,this,e):r()},set:function(t){Reflect.defineMetadata(n,t,this,e)}})}e.makePropertyInjectDecorator=function(t,e){return function(n){return function(i,o){r(i,o,(function(){return t.get(n)}),e)}}},e.makePropertyInjectNamedDecorator=function(t,e){return function(n,i){return function(o,s){r(o,s,(function(){return t.getNamed(n,i)}),e)}}},e.makePropertyInjectTaggedDecorator=function(t,e){return function(n,i,o){return function(s,a){r(s,a,(function(){return t.getTagged(n,i,o)}),e)}}},e.makePropertyMultiInjectDecorator=function(t,e){return function(n){return function(i,o){r(i,o,(function(){return t.getAll(n)}),e)}}}},4879:(t,e,n)=>{"use strict";var r=n(7375);e.Z=function(t,e){return void 0===e&&(e=!0),{lazyInject:r.makePropertyInjectDecorator(t,e),lazyInjectNamed:r.makePropertyInjectNamedDecorator(t,e),lazyInjectTagged:r.makePropertyInjectTaggedDecorator(t,e),lazyMultiInject:r.makePropertyMultiInjectDecorator(t,e)}}},1989:(t,e,n)=>{var r=n(1789),i=n(401),o=n(7667),s=n(1327),a=n(1866);function c(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}c.prototype.clear=r,c.prototype.delete=i,c.prototype.get=o,c.prototype.has=s,c.prototype.set=a,t.exports=c},8407:(t,e,n)=>{var r=n(7040),i=n(4125),o=n(2117),s=n(7518),a=n(4705);function c(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}c.prototype.clear=r,c.prototype.delete=i,c.prototype.get=o,c.prototype.has=s,c.prototype.set=a,t.exports=c},7071:(t,e,n)=>{var r=n(852)(n(5639),"Map");t.exports=r},3369:(t,e,n)=>{var r=n(4785),i=n(1285),o=n(6e3),s=n(9916),a=n(5265);function c(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}c.prototype.clear=r,c.prototype.delete=i,c.prototype.get=o,c.prototype.has=s,c.prototype.set=a,t.exports=c},6384:(t,e,n)=>{var r=n(8407),i=n(7465),o=n(3779),s=n(7599),a=n(4758),c=n(4309);function u(t){var e=this.__data__=new r(t);this.size=e.size}u.prototype.clear=i,u.prototype.delete=o,u.prototype.get=s,u.prototype.has=a,u.prototype.set=c,t.exports=u},2705:(t,e,n)=>{var r=n(5639).Symbol;t.exports=r},1149:(t,e,n)=>{var r=n(5639).Uint8Array;t.exports=r},6874:t=>{t.exports=function(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}},4636:(t,e,n)=>{var r=n(2545),i=n(5694),o=n(1469),s=n(4144),a=n(5776),c=n(6719),u=Object.prototype.hasOwnProperty;t.exports=function(t,e){var n=o(t),d=!n&&i(t),l=!n&&!d&&s(t),h=!n&&!d&&!l&&c(t),p=n||d||l||h,f=p?r(t.length,String):[],g=f.length;for(var v in t)!e&&!u.call(t,v)||p&&("length"==v||l&&("offset"==v||"parent"==v)||h&&("buffer"==v||"byteLength"==v||"byteOffset"==v)||a(v,g))||f.push(v);return f}},6556:(t,e,n)=>{var r=n(9465),i=n(7813);t.exports=function(t,e,n){(void 0!==n&&!i(t[e],n)||void 0===n&&!(e in t))&&r(t,e,n)}},4865:(t,e,n)=>{var r=n(9465),i=n(7813),o=Object.prototype.hasOwnProperty;t.exports=function(t,e,n){var s=t[e];o.call(t,e)&&i(s,n)&&(void 0!==n||e in t)||r(t,e,n)}},8470:(t,e,n)=>{var r=n(7813);t.exports=function(t,e){for(var n=t.length;n--;)if(r(t[n][0],e))return n;return-1}},9465:(t,e,n)=>{var r=n(8777);t.exports=function(t,e,n){"__proto__"==e&&r?r(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}},3118:(t,e,n)=>{var r=n(3218),i=Object.create,o=function(){function t(){}return function(e){if(!r(e))return{};if(i)return i(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();t.exports=o},8483:(t,e,n)=>{var r=n(5063)();t.exports=r},4239:(t,e,n)=>{var r=n(2705),i=n(9607),o=n(2333),s="[object Null]",a="[object Undefined]",c=r?r.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?a:s:c&&c in Object(t)?i(t):o(t)}},9454:(t,e,n)=>{var r=n(4239),i=n(7005),o="[object Arguments]";t.exports=function(t){return i(t)&&r(t)==o}},8458:(t,e,n)=>{var r=n(3560),i=n(5346),o=n(3218),s=n(346),a=/^\[object .+?Constructor\]$/,c=Function.prototype,u=Object.prototype,d=c.toString,l=u.hasOwnProperty,h=RegExp("^"+d.call(l).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=function(t){return!(!o(t)||i(t))&&(r(t)?h:a).test(s(t))}},8749:(t,e,n)=>{var r=n(4239),i=n(1780),o=n(7005),s={};s["[object Float32Array]"]=s["[object Float64Array]"]=s["[object Int8Array]"]=s["[object Int16Array]"]=s["[object Int32Array]"]=s["[object Uint8Array]"]=s["[object Uint8ClampedArray]"]=s["[object Uint16Array]"]=s["[object Uint32Array]"]=!0,s["[object Arguments]"]=s["[object Array]"]=s["[object ArrayBuffer]"]=s["[object Boolean]"]=s["[object DataView]"]=s["[object Date]"]=s["[object Error]"]=s["[object Function]"]=s["[object Map]"]=s["[object Number]"]=s["[object Object]"]=s["[object RegExp]"]=s["[object Set]"]=s["[object String]"]=s["[object WeakMap]"]=!1,t.exports=function(t){return o(t)&&i(t.length)&&!!s[r(t)]}},313:(t,e,n)=>{var r=n(3218),i=n(5726),o=n(3498),s=Object.prototype.hasOwnProperty;t.exports=function(t){if(!r(t))return o(t);var e=i(t),n=[];for(var a in t)("constructor"!=a||!e&&s.call(t,a))&&n.push(a);return n}},2980:(t,e,n)=>{var r=n(6384),i=n(6556),o=n(8483),s=n(9783),a=n(3218),c=n(1704),u=n(6390);t.exports=function t(e,n,d,l,h){e!==n&&o(n,(function(o,c){if(h||(h=new r),a(o))s(e,n,c,d,t,l,h);else{var p=l?l(u(e,c),o,c+"",e,n,h):void 0;void 0===p&&(p=o),i(e,c,p)}}),c)}},9783:(t,e,n)=>{var r=n(6556),i=n(4626),o=n(7133),s=n(278),a=n(8517),c=n(5694),u=n(1469),d=n(9246),l=n(4144),h=n(3560),p=n(3218),f=n(8630),g=n(6719),v=n(6390),m=n(9881);t.exports=function(t,e,n,y,_,b,E){var S=v(t,n),C=v(e,n),w=E.get(C);if(w)r(t,n,w);else{var T=b?b(S,C,n+"",t,e,E):void 0,I=void 0===T;if(I){var R=u(C),A=!R&&l(C),k=!R&&!A&&g(C);T=C,R||A||k?u(S)?T=S:d(S)?T=s(S):A?(I=!1,T=i(C,!0)):k?(I=!1,T=o(C,!0)):T=[]:f(C)||c(C)?(T=S,c(S)?T=m(S):p(S)&&!h(S)||(T=a(C))):I=!1}I&&(E.set(C,T),_(T,C,y,b,E),E.delete(C)),r(t,n,T)}}},5976:(t,e,n)=>{var r=n(6557),i=n(5357),o=n(61);t.exports=function(t,e){return o(i(t,e,r),t+"")}},6560:(t,e,n)=>{var r=n(5703),i=n(8777),o=n(6557),s=i?function(t,e){return i(t,"toString",{configurable:!0,enumerable:!1,value:r(e),writable:!0})}:o;t.exports=s},2545:t=>{t.exports=function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}},1717:t=>{t.exports=function(t){return function(e){return t(e)}}},4318:(t,e,n)=>{var r=n(1149);t.exports=function(t){var e=new t.constructor(t.byteLength);return new r(e).set(new r(t)),e}},4626:(t,e,n)=>{t=n.nmd(t);var r=n(5639),i=e&&!e.nodeType&&e,o=i&&t&&!t.nodeType&&t,s=o&&o.exports===i?r.Buffer:void 0,a=s?s.allocUnsafe:void 0;t.exports=function(t,e){if(e)return t.slice();var n=t.length,r=a?a(n):new t.constructor(n);return t.copy(r),r}},7133:(t,e,n)=>{var r=n(4318);t.exports=function(t,e){var n=e?r(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}},278:t=>{t.exports=function(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}},8363:(t,e,n)=>{var r=n(4865),i=n(9465);t.exports=function(t,e,n,o){var s=!n;n||(n={});for(var a=-1,c=e.length;++a<c;){var u=e[a],d=o?o(n[u],t[u],u,n,t):void 0;void 0===d&&(d=t[u]),s?i(n,u,d):r(n,u,d)}return n}},4429:(t,e,n)=>{var r=n(5639)["__core-js_shared__"];t.exports=r},1463:(t,e,n)=>{var r=n(5976),i=n(6612);t.exports=function(t){return r((function(e,n){var r=-1,o=n.length,s=o>1?n[o-1]:void 0,a=o>2?n[2]:void 0;for(s=t.length>3&&"function"==typeof s?(o--,s):void 0,a&&i(n[0],n[1],a)&&(s=o<3?void 0:s,o=1),e=Object(e);++r<o;){var c=n[r];c&&t(e,c,r,s)}return e}))}},5063:t=>{t.exports=function(t){return function(e,n,r){for(var i=-1,o=Object(e),s=r(e),a=s.length;a--;){var c=s[t?a:++i];if(!1===n(o[c],c,o))break}return e}}},8777:(t,e,n)=>{var r=n(852),i=function(){try{var t=r(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();t.exports=i},1957:(t,e,n)=>{var r="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g;t.exports=r},5050:(t,e,n)=>{var r=n(7019);t.exports=function(t,e){var n=t.__data__;return r(e)?n["string"==typeof e?"string":"hash"]:n.map}},852:(t,e,n)=>{var r=n(8458),i=n(7801);t.exports=function(t,e){var n=i(t,e);return r(n)?n:void 0}},5924:(t,e,n)=>{var r=n(5569)(Object.getPrototypeOf,Object);t.exports=r},9607:(t,e,n)=>{var r=n(2705),i=Object.prototype,o=i.hasOwnProperty,s=i.toString,a=r?r.toStringTag:void 0;t.exports=function(t){var e=o.call(t,a),n=t[a];try{t[a]=void 0;var r=!0}catch(t){}var i=s.call(t);return r&&(e?t[a]=n:delete t[a]),i}},7801:t=>{t.exports=function(t,e){return null==t?void 0:t[e]}},1789:(t,e,n)=>{var r=n(4536);t.exports=function(){this.__data__=r?r(null):{},this.size=0}},401:t=>{t.exports=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}},7667:(t,e,n)=>{var r=n(4536),i="__lodash_hash_undefined__",o=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;if(r){var n=e[t];return n===i?void 0:n}return o.call(e,t)?e[t]:void 0}},1327:(t,e,n)=>{var r=n(4536),i=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;return r?void 0!==e[t]:i.call(e,t)}},1866:(t,e,n)=>{var r=n(4536),i="__lodash_hash_undefined__";t.exports=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=r&&void 0===e?i:e,this}},8517:(t,e,n)=>{var r=n(3118),i=n(5924),o=n(5726);t.exports=function(t){return"function"!=typeof t.constructor||o(t)?{}:r(i(t))}},5776:t=>{var e=9007199254740991,n=/^(?:0|[1-9]\d*)$/;t.exports=function(t,r){var i=typeof t;return!!(r=null==r?e:r)&&("number"==i||"symbol"!=i&&n.test(t))&&t>-1&&t%1==0&&t<r}},6612:(t,e,n)=>{var r=n(7813),i=n(8612),o=n(5776),s=n(3218);t.exports=function(t,e,n){if(!s(n))return!1;var a=typeof e;return!!("number"==a?i(n)&&o(e,n.length):"string"==a&&e in n)&&r(n[e],t)}},7019:t=>{t.exports=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}},5346:(t,e,n)=>{var r,i=n(4429),o=(r=/[^.]+$/.exec(i&&i.keys&&i.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"";t.exports=function(t){return!!o&&o in t}},5726:t=>{var e=Object.prototype;t.exports=function(t){var n=t&&t.constructor;return t===("function"==typeof n&&n.prototype||e)}},7040:t=>{t.exports=function(){this.__data__=[],this.size=0}},4125:(t,e,n)=>{var r=n(8470),i=Array.prototype.splice;t.exports=function(t){var e=this.__data__,n=r(e,t);return!(n<0)&&(n==e.length-1?e.pop():i.call(e,n,1),--this.size,!0)}},2117:(t,e,n)=>{var r=n(8470);t.exports=function(t){var e=this.__data__,n=r(e,t);return n<0?void 0:e[n][1]}},7518:(t,e,n)=>{var r=n(8470);t.exports=function(t){return r(this.__data__,t)>-1}},4705:(t,e,n)=>{var r=n(8470);t.exports=function(t,e){var n=this.__data__,i=r(n,t);return i<0?(++this.size,n.push([t,e])):n[i][1]=e,this}},4785:(t,e,n)=>{var r=n(1989),i=n(8407),o=n(7071);t.exports=function(){this.size=0,this.__data__={hash:new r,map:new(o||i),string:new r}}},1285:(t,e,n)=>{var r=n(5050);t.exports=function(t){var e=r(this,t).delete(t);return this.size-=e?1:0,e}},6e3:(t,e,n)=>{var r=n(5050);t.exports=function(t){return r(this,t).get(t)}},9916:(t,e,n)=>{var r=n(5050);t.exports=function(t){return r(this,t).has(t)}},5265:(t,e,n)=>{var r=n(5050);t.exports=function(t,e){var n=r(this,t),i=n.size;return n.set(t,e),this.size+=n.size==i?0:1,this}},4536:(t,e,n)=>{var r=n(852)(Object,"create");t.exports=r},3498:t=>{t.exports=function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}},1167:(t,e,n)=>{t=n.nmd(t);var r=n(1957),i=e&&!e.nodeType&&e,o=i&&t&&!t.nodeType&&t,s=o&&o.exports===i&&r.process,a=function(){try{var t=o&&o.require&&o.require("util").types;return t||s&&s.binding&&s.binding("util")}catch(t){}}();t.exports=a},2333:t=>{var e=Object.prototype.toString;t.exports=function(t){return e.call(t)}},5569:t=>{t.exports=function(t,e){return function(n){return t(e(n))}}},5357:(t,e,n)=>{var r=n(6874),i=Math.max;t.exports=function(t,e,n){return e=i(void 0===e?t.length-1:e,0),function(){for(var o=arguments,s=-1,a=i(o.length-e,0),c=Array(a);++s<a;)c[s]=o[e+s];s=-1;for(var u=Array(e+1);++s<e;)u[s]=o[s];return u[e]=n(c),r(t,this,u)}}},5639:(t,e,n)=>{var r=n(1957),i="object"==typeof self&&self&&self.Object===Object&&self,o=r||i||Function("return this")();t.exports=o},6390:t=>{t.exports=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}},61:(t,e,n)=>{var r=n(6560),i=n(1275)(r);t.exports=i},1275:t=>{var e=800,n=16,r=Date.now;t.exports=function(t){var i=0,o=0;return function(){var s=r(),a=n-(s-o);if(o=s,a>0){if(++i>=e)return arguments[0]}else i=0;return t.apply(void 0,arguments)}}},7465:(t,e,n)=>{var r=n(8407);t.exports=function(){this.__data__=new r,this.size=0}},3779:t=>{t.exports=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}},7599:t=>{t.exports=function(t){return this.__data__.get(t)}},4758:t=>{t.exports=function(t){return this.__data__.has(t)}},4309:(t,e,n)=>{var r=n(8407),i=n(7071),o=n(3369),s=200;t.exports=function(t,e){var n=this.__data__;if(n instanceof r){var a=n.__data__;if(!i||a.length<s-1)return a.push([t,e]),this.size=++n.size,this;n=this.__data__=new o(a)}return n.set(t,e),this.size=n.size,this}},346:t=>{var e=Function.prototype.toString;t.exports=function(t){if(null!=t){try{return e.call(t)}catch(t){}try{return t+""}catch(t){}}return""}},5703:t=>{t.exports=function(t){return function(){return t}}},7813:t=>{t.exports=function(t,e){return t===e||t!=t&&e!=e}},6557:t=>{t.exports=function(t){return t}},5694:(t,e,n)=>{var r=n(9454),i=n(7005),o=Object.prototype,s=o.hasOwnProperty,a=o.propertyIsEnumerable,c=r(function(){return arguments}())?r:function(t){return i(t)&&s.call(t,"callee")&&!a.call(t,"callee")};t.exports=c},1469:t=>{var e=Array.isArray;t.exports=e},8612:(t,e,n)=>{var r=n(3560),i=n(1780);t.exports=function(t){return null!=t&&i(t.length)&&!r(t)}},9246:(t,e,n)=>{var r=n(8612),i=n(7005);t.exports=function(t){return i(t)&&r(t)}},4144:(t,e,n)=>{t=n.nmd(t);var r=n(5639),i=n(5062),o=e&&!e.nodeType&&e,s=o&&t&&!t.nodeType&&t,a=s&&s.exports===o?r.Buffer:void 0,c=(a?a.isBuffer:void 0)||i;t.exports=c},3560:(t,e,n)=>{var r=n(4239),i=n(3218),o="[object AsyncFunction]",s="[object Function]",a="[object GeneratorFunction]",c="[object Proxy]";t.exports=function(t){if(!i(t))return!1;var e=r(t);return e==s||e==a||e==o||e==c}},1780:t=>{var e=9007199254740991;t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=e}},3218:t=>{t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},7005:t=>{t.exports=function(t){return null!=t&&"object"==typeof t}},8630:(t,e,n)=>{var r=n(4239),i=n(5924),o=n(7005),s="[object Object]",a=Function.prototype,c=Object.prototype,u=a.toString,d=c.hasOwnProperty,l=u.call(Object);t.exports=function(t){if(!o(t)||r(t)!=s)return!1;var e=i(t);if(null===e)return!0;var n=d.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&u.call(n)==l}},6719:(t,e,n)=>{var r=n(8749),i=n(1717),o=n(1167),s=o&&o.isTypedArray,a=s?i(s):r;t.exports=a},1704:(t,e,n)=>{var r=n(4636),i=n(313),o=n(8612);t.exports=function(t){return o(t)?r(t,!0):i(t)}},6486:function(t,e,n){var r;t=n.nmd(t),function(){var i,o="Expected a function",s="__lodash_hash_undefined__",a="__lodash_placeholder__",c=16,u=32,d=64,l=128,h=256,p=1/0,f=9007199254740991,g=NaN,v=4294967295,m=[["ary",l],["bind",1],["bindKey",2],["curry",8],["curryRight",c],["flip",512],["partial",u],["partialRight",d],["rearg",h]],y="[object Arguments]",_="[object Array]",b="[object Boolean]",E="[object Date]",S="[object Error]",C="[object Function]",w="[object GeneratorFunction]",T="[object Map]",I="[object Number]",R="[object Object]",A="[object Promise]",k="[object RegExp]",O="[object Set]",P="[object String]",N="[object Symbol]",x="[object WeakMap]",D="[object ArrayBuffer]",M="[object DataView]",j="[object Float32Array]",L="[object Float64Array]",U="[object Int8Array]",B="[object Int16Array]",F="[object Int32Array]",G="[object Uint8Array]",V="[object Uint8ClampedArray]",W="[object Uint16Array]",q="[object Uint32Array]",z=/\b__p \+= '';/g,$=/\b(__p \+=) '' \+/g,H=/(__e\(.*?\)|\b__t\)) \+\n'';/g,K=/&(?:amp|lt|gt|quot|#39);/g,J=/[&<>"']/g,X=RegExp(K.source),Y=RegExp(J.source),Z=/<%-([\s\S]+?)%>/g,Q=/<%([\s\S]+?)%>/g,tt=/<%=([\s\S]+?)%>/g,et=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,nt=/^\w*$/,rt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,it=/[\\^$.*+?()[\]{}|]/g,ot=RegExp(it.source),st=/^\s+/,at=/\s/,ct=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ut=/\{\n\/\* \[wrapped with (.+)\] \*/,dt=/,? & /,lt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ht=/[()=,{}\[\]\/\s]/,pt=/\\(\\)?/g,ft=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,gt=/\w*$/,vt=/^[-+]0x[0-9a-f]+$/i,mt=/^0b[01]+$/i,yt=/^\[object .+?Constructor\]$/,_t=/^0o[0-7]+$/i,bt=/^(?:0|[1-9]\d*)$/,Et=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,St=/($^)/,Ct=/['\n\r\u2028\u2029\\]/g,wt="\\ud800-\\udfff",Tt="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",It="\\u2700-\\u27bf",Rt="a-z\\xdf-\\xf6\\xf8-\\xff",At="A-Z\\xc0-\\xd6\\xd8-\\xde",kt="\\ufe0e\\ufe0f",Ot="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Pt="['’]",Nt="["+wt+"]",xt="["+Ot+"]",Dt="["+Tt+"]",Mt="\\d+",jt="["+It+"]",Lt="["+Rt+"]",Ut="[^"+wt+Ot+Mt+It+Rt+At+"]",Bt="\\ud83c[\\udffb-\\udfff]",Ft="[^"+wt+"]",Gt="(?:\\ud83c[\\udde6-\\uddff]){2}",Vt="[\\ud800-\\udbff][\\udc00-\\udfff]",Wt="["+At+"]",qt="\\u200d",zt="(?:"+Lt+"|"+Ut+")",$t="(?:"+Wt+"|"+Ut+")",Ht="(?:['’](?:d|ll|m|re|s|t|ve))?",Kt="(?:['’](?:D|LL|M|RE|S|T|VE))?",Jt="(?:"+Dt+"|"+Bt+")"+"?",Xt="["+kt+"]?",Yt=Xt+Jt+("(?:"+qt+"(?:"+[Ft,Gt,Vt].join("|")+")"+Xt+Jt+")*"),Zt="(?:"+[jt,Gt,Vt].join("|")+")"+Yt,Qt="(?:"+[Ft+Dt+"?",Dt,Gt,Vt,Nt].join("|")+")",te=RegExp(Pt,"g"),ee=RegExp(Dt,"g"),ne=RegExp(Bt+"(?="+Bt+")|"+Qt+Yt,"g"),re=RegExp([Wt+"?"+Lt+"+"+Ht+"(?="+[xt,Wt,"$"].join("|")+")",$t+"+"+Kt+"(?="+[xt,Wt+zt,"$"].join("|")+")",Wt+"?"+zt+"+"+Ht,Wt+"+"+Kt,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Mt,Zt].join("|"),"g"),ie=RegExp("["+qt+wt+Tt+kt+"]"),oe=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,se=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],ae=-1,ce={};ce[j]=ce[L]=ce[U]=ce[B]=ce[F]=ce[G]=ce[V]=ce[W]=ce[q]=!0,ce[y]=ce[_]=ce[D]=ce[b]=ce[M]=ce[E]=ce[S]=ce[C]=ce[T]=ce[I]=ce[R]=ce[k]=ce[O]=ce[P]=ce[x]=!1;var ue={};ue[y]=ue[_]=ue[D]=ue[M]=ue[b]=ue[E]=ue[j]=ue[L]=ue[U]=ue[B]=ue[F]=ue[T]=ue[I]=ue[R]=ue[k]=ue[O]=ue[P]=ue[N]=ue[G]=ue[V]=ue[W]=ue[q]=!0,ue[S]=ue[C]=ue[x]=!1;var de={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},le=parseFloat,he=parseInt,pe="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,fe="object"==typeof self&&self&&self.Object===Object&&self,ge=pe||fe||Function("return this")(),ve=e&&!e.nodeType&&e,me=ve&&t&&!t.nodeType&&t,ye=me&&me.exports===ve,_e=ye&&pe.process,be=function(){try{var t=me&&me.require&&me.require("util").types;return t||_e&&_e.binding&&_e.binding("util")}catch(t){}}(),Ee=be&&be.isArrayBuffer,Se=be&&be.isDate,Ce=be&&be.isMap,we=be&&be.isRegExp,Te=be&&be.isSet,Ie=be&&be.isTypedArray;function Re(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function Ae(t,e,n,r){for(var i=-1,o=null==t?0:t.length;++i<o;){var s=t[i];e(r,s,n(s),t)}return r}function ke(t,e){for(var n=-1,r=null==t?0:t.length;++n<r&&!1!==e(t[n],n,t););return t}function Oe(t,e){for(var n=null==t?0:t.length;n--&&!1!==e(t[n],n,t););return t}function Pe(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(!e(t[n],n,t))return!1;return!0}function Ne(t,e){for(var n=-1,r=null==t?0:t.length,i=0,o=[];++n<r;){var s=t[n];e(s,n,t)&&(o[i++]=s)}return o}function xe(t,e){return!!(null==t?0:t.length)&&We(t,e,0)>-1}function De(t,e,n){for(var r=-1,i=null==t?0:t.length;++r<i;)if(n(e,t[r]))return!0;return!1}function Me(t,e){for(var n=-1,r=null==t?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}function je(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}function Le(t,e,n,r){var i=-1,o=null==t?0:t.length;for(r&&o&&(n=t[++i]);++i<o;)n=e(n,t[i],i,t);return n}function Ue(t,e,n,r){var i=null==t?0:t.length;for(r&&i&&(n=t[--i]);i--;)n=e(n,t[i],i,t);return n}function Be(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}var Fe=He("length");function Ge(t,e,n){var r;return n(t,(function(t,n,i){if(e(t,n,i))return r=n,!1})),r}function Ve(t,e,n,r){for(var i=t.length,o=n+(r?1:-1);r?o--:++o<i;)if(e(t[o],o,t))return o;return-1}function We(t,e,n){return e==e?function(t,e,n){var r=n-1,i=t.length;for(;++r<i;)if(t[r]===e)return r;return-1}(t,e,n):Ve(t,ze,n)}function qe(t,e,n,r){for(var i=n-1,o=t.length;++i<o;)if(r(t[i],e))return i;return-1}function ze(t){return t!=t}function $e(t,e){var n=null==t?0:t.length;return n?Xe(t,e)/n:g}function He(t){return function(e){return null==e?i:e[t]}}function Ke(t){return function(e){return null==t?i:t[e]}}function Je(t,e,n,r,i){return i(t,(function(t,i,o){n=r?(r=!1,t):e(n,t,i,o)})),n}function Xe(t,e){for(var n,r=-1,o=t.length;++r<o;){var s=e(t[r]);s!==i&&(n=n===i?s:n+s)}return n}function Ye(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}function Ze(t){return t?t.slice(0,vn(t)+1).replace(st,""):t}function Qe(t){return function(e){return t(e)}}function tn(t,e){return Me(e,(function(e){return t[e]}))}function en(t,e){return t.has(e)}function nn(t,e){for(var n=-1,r=t.length;++n<r&&We(e,t[n],0)>-1;);return n}function rn(t,e){for(var n=t.length;n--&&We(e,t[n],0)>-1;);return n}var on=Ke({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),sn=Ke({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function an(t){return"\\"+de[t]}function cn(t){return ie.test(t)}function un(t){var e=-1,n=Array(t.size);return t.forEach((function(t,r){n[++e]=[r,t]})),n}function dn(t,e){return function(n){return t(e(n))}}function ln(t,e){for(var n=-1,r=t.length,i=0,o=[];++n<r;){var s=t[n];s!==e&&s!==a||(t[n]=a,o[i++]=n)}return o}function hn(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n}function pn(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=[t,t]})),n}function fn(t){return cn(t)?function(t){var e=ne.lastIndex=0;for(;ne.test(t);)++e;return e}(t):Fe(t)}function gn(t){return cn(t)?function(t){return t.match(ne)||[]}(t):function(t){return t.split("")}(t)}function vn(t){for(var e=t.length;e--&&at.test(t.charAt(e)););return e}var mn=Ke({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"});var yn=function t(e){var n,r=(e=null==e?ge:yn.defaults(ge.Object(),e,yn.pick(ge,se))).Array,at=e.Date,wt=e.Error,Tt=e.Function,It=e.Math,Rt=e.Object,At=e.RegExp,kt=e.String,Ot=e.TypeError,Pt=r.prototype,Nt=Tt.prototype,xt=Rt.prototype,Dt=e["__core-js_shared__"],Mt=Nt.toString,jt=xt.hasOwnProperty,Lt=0,Ut=(n=/[^.]+$/.exec(Dt&&Dt.keys&&Dt.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Bt=xt.toString,Ft=Mt.call(Rt),Gt=ge._,Vt=At("^"+Mt.call(jt).replace(it,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Wt=ye?e.Buffer:i,qt=e.Symbol,zt=e.Uint8Array,$t=Wt?Wt.allocUnsafe:i,Ht=dn(Rt.getPrototypeOf,Rt),Kt=Rt.create,Jt=xt.propertyIsEnumerable,Xt=Pt.splice,Yt=qt?qt.isConcatSpreadable:i,Zt=qt?qt.iterator:i,Qt=qt?qt.toStringTag:i,ne=function(){try{var t=po(Rt,"defineProperty");return t({},"",{}),t}catch(t){}}(),ie=e.clearTimeout!==ge.clearTimeout&&e.clearTimeout,de=at&&at.now!==ge.Date.now&&at.now,pe=e.setTimeout!==ge.setTimeout&&e.setTimeout,fe=It.ceil,ve=It.floor,me=Rt.getOwnPropertySymbols,_e=Wt?Wt.isBuffer:i,be=e.isFinite,Fe=Pt.join,Ke=dn(Rt.keys,Rt),_n=It.max,bn=It.min,En=at.now,Sn=e.parseInt,Cn=It.random,wn=Pt.reverse,Tn=po(e,"DataView"),In=po(e,"Map"),Rn=po(e,"Promise"),An=po(e,"Set"),kn=po(e,"WeakMap"),On=po(Rt,"create"),Pn=kn&&new kn,Nn={},xn=Bo(Tn),Dn=Bo(In),Mn=Bo(Rn),jn=Bo(An),Ln=Bo(kn),Un=qt?qt.prototype:i,Bn=Un?Un.valueOf:i,Fn=Un?Un.toString:i;function Gn(t){if(na(t)&&!zs(t)&&!(t instanceof zn)){if(t instanceof qn)return t;if(jt.call(t,"__wrapped__"))return Fo(t)}return new qn(t)}var Vn=function(){function t(){}return function(e){if(!ea(e))return{};if(Kt)return Kt(e);t.prototype=e;var n=new t;return t.prototype=i,n}}();function Wn(){}function qn(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=i}function zn(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=v,this.__views__=[]}function $n(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Hn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Kn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Jn(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new Kn;++e<n;)this.add(t[e])}function Xn(t){var e=this.__data__=new Hn(t);this.size=e.size}function Yn(t,e){var n=zs(t),r=!n&&qs(t),i=!n&&!r&&Js(t),o=!n&&!r&&!i&&da(t),s=n||r||i||o,a=s?Ye(t.length,kt):[],c=a.length;for(var u in t)!e&&!jt.call(t,u)||s&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||bo(u,c))||a.push(u);return a}function Zn(t){var e=t.length;return e?t[Jr(0,e-1)]:i}function Qn(t,e){return jo(Oi(t),cr(e,0,t.length))}function tr(t){return jo(Oi(t))}function er(t,e,n){(n!==i&&!Gs(t[e],n)||n===i&&!(e in t))&&sr(t,e,n)}function nr(t,e,n){var r=t[e];jt.call(t,e)&&Gs(r,n)&&(n!==i||e in t)||sr(t,e,n)}function rr(t,e){for(var n=t.length;n--;)if(Gs(t[n][0],e))return n;return-1}function ir(t,e,n,r){return pr(t,(function(t,i,o){e(r,t,n(t),o)})),r}function or(t,e){return t&&Pi(e,Na(e),t)}function sr(t,e,n){"__proto__"==e&&ne?ne(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function ar(t,e){for(var n=-1,o=e.length,s=r(o),a=null==t;++n<o;)s[n]=a?i:Ra(t,e[n]);return s}function cr(t,e,n){return t==t&&(n!==i&&(t=t<=n?t:n),e!==i&&(t=t>=e?t:e)),t}function ur(t,e,n,r,o,s){var a,c=1&e,u=2&e,d=4&e;if(n&&(a=o?n(t,r,o,s):n(t)),a!==i)return a;if(!ea(t))return t;var l=zs(t);if(l){if(a=function(t){var e=t.length,n=new t.constructor(e);e&&"string"==typeof t[0]&&jt.call(t,"index")&&(n.index=t.index,n.input=t.input);return n}(t),!c)return Oi(t,a)}else{var h=vo(t),p=h==C||h==w;if(Js(t))return wi(t,c);if(h==R||h==y||p&&!o){if(a=u||p?{}:yo(t),!c)return u?function(t,e){return Pi(t,go(t),e)}(t,function(t,e){return t&&Pi(e,xa(e),t)}(a,t)):function(t,e){return Pi(t,fo(t),e)}(t,or(a,t))}else{if(!ue[h])return o?t:{};a=function(t,e,n){var r=t.constructor;switch(e){case D:return Ti(t);case b:case E:return new r(+t);case M:return function(t,e){var n=e?Ti(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,n);case j:case L:case U:case B:case F:case G:case V:case W:case q:return Ii(t,n);case T:return new r;case I:case P:return new r(t);case k:return function(t){var e=new t.constructor(t.source,gt.exec(t));return e.lastIndex=t.lastIndex,e}(t);case O:return new r;case N:return i=t,Bn?Rt(Bn.call(i)):{}}var i}(t,h,c)}}s||(s=new Xn);var f=s.get(t);if(f)return f;s.set(t,a),aa(t)?t.forEach((function(r){a.add(ur(r,e,n,r,t,s))})):ra(t)&&t.forEach((function(r,i){a.set(i,ur(r,e,n,i,t,s))}));var g=l?i:(d?u?oo:io:u?xa:Na)(t);return ke(g||t,(function(r,i){g&&(r=t[i=r]),nr(a,i,ur(r,e,n,i,t,s))})),a}function dr(t,e,n){var r=n.length;if(null==t)return!r;for(t=Rt(t);r--;){var o=n[r],s=e[o],a=t[o];if(a===i&&!(o in t)||!s(a))return!1}return!0}function lr(t,e,n){if("function"!=typeof t)throw new Ot(o);return No((function(){t.apply(i,n)}),e)}function hr(t,e,n,r){var i=-1,o=xe,s=!0,a=t.length,c=[],u=e.length;if(!a)return c;n&&(e=Me(e,Qe(n))),r?(o=De,s=!1):e.length>=200&&(o=en,s=!1,e=new Jn(e));t:for(;++i<a;){var d=t[i],l=null==n?d:n(d);if(d=r||0!==d?d:0,s&&l==l){for(var h=u;h--;)if(e[h]===l)continue t;c.push(d)}else o(e,l,r)||c.push(d)}return c}Gn.templateSettings={escape:Z,evaluate:Q,interpolate:tt,variable:"",imports:{_:Gn}},Gn.prototype=Wn.prototype,Gn.prototype.constructor=Gn,qn.prototype=Vn(Wn.prototype),qn.prototype.constructor=qn,zn.prototype=Vn(Wn.prototype),zn.prototype.constructor=zn,$n.prototype.clear=function(){this.__data__=On?On(null):{},this.size=0},$n.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},$n.prototype.get=function(t){var e=this.__data__;if(On){var n=e[t];return n===s?i:n}return jt.call(e,t)?e[t]:i},$n.prototype.has=function(t){var e=this.__data__;return On?e[t]!==i:jt.call(e,t)},$n.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=On&&e===i?s:e,this},Hn.prototype.clear=function(){this.__data__=[],this.size=0},Hn.prototype.delete=function(t){var e=this.__data__,n=rr(e,t);return!(n<0)&&(n==e.length-1?e.pop():Xt.call(e,n,1),--this.size,!0)},Hn.prototype.get=function(t){var e=this.__data__,n=rr(e,t);return n<0?i:e[n][1]},Hn.prototype.has=function(t){return rr(this.__data__,t)>-1},Hn.prototype.set=function(t,e){var n=this.__data__,r=rr(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this},Kn.prototype.clear=function(){this.size=0,this.__data__={hash:new $n,map:new(In||Hn),string:new $n}},Kn.prototype.delete=function(t){var e=lo(this,t).delete(t);return this.size-=e?1:0,e},Kn.prototype.get=function(t){return lo(this,t).get(t)},Kn.prototype.has=function(t){return lo(this,t).has(t)},Kn.prototype.set=function(t,e){var n=lo(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},Jn.prototype.add=Jn.prototype.push=function(t){return this.__data__.set(t,s),this},Jn.prototype.has=function(t){return this.__data__.has(t)},Xn.prototype.clear=function(){this.__data__=new Hn,this.size=0},Xn.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},Xn.prototype.get=function(t){return this.__data__.get(t)},Xn.prototype.has=function(t){return this.__data__.has(t)},Xn.prototype.set=function(t,e){var n=this.__data__;if(n instanceof Hn){var r=n.__data__;if(!In||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new Kn(r)}return n.set(t,e),this.size=n.size,this};var pr=Di(Er),fr=Di(Sr,!0);function gr(t,e){var n=!0;return pr(t,(function(t,r,i){return n=!!e(t,r,i)})),n}function vr(t,e,n){for(var r=-1,o=t.length;++r<o;){var s=t[r],a=e(s);if(null!=a&&(c===i?a==a&&!ua(a):n(a,c)))var c=a,u=s}return u}function mr(t,e){var n=[];return pr(t,(function(t,r,i){e(t,r,i)&&n.push(t)})),n}function yr(t,e,n,r,i){var o=-1,s=t.length;for(n||(n=_o),i||(i=[]);++o<s;){var a=t[o];e>0&&n(a)?e>1?yr(a,e-1,n,r,i):je(i,a):r||(i[i.length]=a)}return i}var _r=Mi(),br=Mi(!0);function Er(t,e){return t&&_r(t,e,Na)}function Sr(t,e){return t&&br(t,e,Na)}function Cr(t,e){return Ne(e,(function(e){return Zs(t[e])}))}function wr(t,e){for(var n=0,r=(e=bi(e,t)).length;null!=t&&n<r;)t=t[Uo(e[n++])];return n&&n==r?t:i}function Tr(t,e,n){var r=e(t);return zs(t)?r:je(r,n(t))}function Ir(t){return null==t?t===i?"[object Undefined]":"[object Null]":Qt&&Qt in Rt(t)?function(t){var e=jt.call(t,Qt),n=t[Qt];try{t[Qt]=i;var r=!0}catch(t){}var o=Bt.call(t);r&&(e?t[Qt]=n:delete t[Qt]);return o}(t):function(t){return Bt.call(t)}(t)}function Rr(t,e){return t>e}function Ar(t,e){return null!=t&&jt.call(t,e)}function kr(t,e){return null!=t&&e in Rt(t)}function Or(t,e,n){for(var o=n?De:xe,s=t[0].length,a=t.length,c=a,u=r(a),d=1/0,l=[];c--;){var h=t[c];c&&e&&(h=Me(h,Qe(e))),d=bn(h.length,d),u[c]=!n&&(e||s>=120&&h.length>=120)?new Jn(c&&h):i}h=t[0];var p=-1,f=u[0];t:for(;++p<s&&l.length<d;){var g=h[p],v=e?e(g):g;if(g=n||0!==g?g:0,!(f?en(f,v):o(l,v,n))){for(c=a;--c;){var m=u[c];if(!(m?en(m,v):o(t[c],v,n)))continue t}f&&f.push(v),l.push(g)}}return l}function Pr(t,e,n){var r=null==(t=ko(t,e=bi(e,t)))?t:t[Uo(Yo(e))];return null==r?i:Re(r,t,n)}function Nr(t){return na(t)&&Ir(t)==y}function xr(t,e,n,r,o){return t===e||(null==t||null==e||!na(t)&&!na(e)?t!=t&&e!=e:function(t,e,n,r,o,s){var a=zs(t),c=zs(e),u=a?_:vo(t),d=c?_:vo(e),l=(u=u==y?R:u)==R,h=(d=d==y?R:d)==R,p=u==d;if(p&&Js(t)){if(!Js(e))return!1;a=!0,l=!1}if(p&&!l)return s||(s=new Xn),a||da(t)?no(t,e,n,r,o,s):function(t,e,n,r,i,o,s){switch(n){case M:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case D:return!(t.byteLength!=e.byteLength||!o(new zt(t),new zt(e)));case b:case E:case I:return Gs(+t,+e);case S:return t.name==e.name&&t.message==e.message;case k:case P:return t==e+"";case T:var a=un;case O:var c=1&r;if(a||(a=hn),t.size!=e.size&&!c)return!1;var u=s.get(t);if(u)return u==e;r|=2,s.set(t,e);var d=no(a(t),a(e),r,i,o,s);return s.delete(t),d;case N:if(Bn)return Bn.call(t)==Bn.call(e)}return!1}(t,e,u,n,r,o,s);if(!(1&n)){var f=l&&jt.call(t,"__wrapped__"),g=h&&jt.call(e,"__wrapped__");if(f||g){var v=f?t.value():t,m=g?e.value():e;return s||(s=new Xn),o(v,m,n,r,s)}}if(!p)return!1;return s||(s=new Xn),function(t,e,n,r,o,s){var a=1&n,c=io(t),u=c.length,d=io(e),l=d.length;if(u!=l&&!a)return!1;var h=u;for(;h--;){var p=c[h];if(!(a?p in e:jt.call(e,p)))return!1}var f=s.get(t),g=s.get(e);if(f&&g)return f==e&&g==t;var v=!0;s.set(t,e),s.set(e,t);var m=a;for(;++h<u;){var y=t[p=c[h]],_=e[p];if(r)var b=a?r(_,y,p,e,t,s):r(y,_,p,t,e,s);if(!(b===i?y===_||o(y,_,n,r,s):b)){v=!1;break}m||(m="constructor"==p)}if(v&&!m){var E=t.constructor,S=e.constructor;E==S||!("constructor"in t)||!("constructor"in e)||"function"==typeof E&&E instanceof E&&"function"==typeof S&&S instanceof S||(v=!1)}return s.delete(t),s.delete(e),v}(t,e,n,r,o,s)}(t,e,n,r,xr,o))}function Dr(t,e,n,r){var o=n.length,s=o,a=!r;if(null==t)return!s;for(t=Rt(t);o--;){var c=n[o];if(a&&c[2]?c[1]!==t[c[0]]:!(c[0]in t))return!1}for(;++o<s;){var u=(c=n[o])[0],d=t[u],l=c[1];if(a&&c[2]){if(d===i&&!(u in t))return!1}else{var h=new Xn;if(r)var p=r(d,l,u,t,e,h);if(!(p===i?xr(l,d,3,r,h):p))return!1}}return!0}function Mr(t){return!(!ea(t)||(e=t,Ut&&Ut in e))&&(Zs(t)?Vt:yt).test(Bo(t));var e}function jr(t){return"function"==typeof t?t:null==t?ic:"object"==typeof t?zs(t)?Vr(t[0],t[1]):Gr(t):pc(t)}function Lr(t){if(!To(t))return Ke(t);var e=[];for(var n in Rt(t))jt.call(t,n)&&"constructor"!=n&&e.push(n);return e}function Ur(t){if(!ea(t))return function(t){var e=[];if(null!=t)for(var n in Rt(t))e.push(n);return e}(t);var e=To(t),n=[];for(var r in t)("constructor"!=r||!e&&jt.call(t,r))&&n.push(r);return n}function Br(t,e){return t<e}function Fr(t,e){var n=-1,i=Hs(t)?r(t.length):[];return pr(t,(function(t,r,o){i[++n]=e(t,r,o)})),i}function Gr(t){var e=ho(t);return 1==e.length&&e[0][2]?Ro(e[0][0],e[0][1]):function(n){return n===t||Dr(n,t,e)}}function Vr(t,e){return So(t)&&Io(e)?Ro(Uo(t),e):function(n){var r=Ra(n,t);return r===i&&r===e?Aa(n,t):xr(e,r,3)}}function Wr(t,e,n,r,o){t!==e&&_r(e,(function(s,a){if(o||(o=new Xn),ea(s))!function(t,e,n,r,o,s,a){var c=Oo(t,n),u=Oo(e,n),d=a.get(u);if(d)return void er(t,n,d);var l=s?s(c,u,n+"",t,e,a):i,h=l===i;if(h){var p=zs(u),f=!p&&Js(u),g=!p&&!f&&da(u);l=u,p||f||g?zs(c)?l=c:Ks(c)?l=Oi(c):f?(h=!1,l=wi(u,!0)):g?(h=!1,l=Ii(u,!0)):l=[]:oa(u)||qs(u)?(l=c,qs(c)?l=ya(c):ea(c)&&!Zs(c)||(l=yo(u))):h=!1}h&&(a.set(u,l),o(l,u,r,s,a),a.delete(u));er(t,n,l)}(t,e,a,n,Wr,r,o);else{var c=r?r(Oo(t,a),s,a+"",t,e,o):i;c===i&&(c=s),er(t,a,c)}}),xa)}function qr(t,e){var n=t.length;if(n)return bo(e+=e<0?n:0,n)?t[e]:i}function zr(t,e,n){e=e.length?Me(e,(function(t){return zs(t)?function(e){return wr(e,1===t.length?t[0]:t)}:t})):[ic];var r=-1;e=Me(e,Qe(uo()));var i=Fr(t,(function(t,n,i){var o=Me(e,(function(e){return e(t)}));return{criteria:o,index:++r,value:t}}));return function(t,e){var n=t.length;for(t.sort(e);n--;)t[n]=t[n].value;return t}(i,(function(t,e){return function(t,e,n){var r=-1,i=t.criteria,o=e.criteria,s=i.length,a=n.length;for(;++r<s;){var c=Ri(i[r],o[r]);if(c)return r>=a?c:c*("desc"==n[r]?-1:1)}return t.index-e.index}(t,e,n)}))}function $r(t,e,n){for(var r=-1,i=e.length,o={};++r<i;){var s=e[r],a=wr(t,s);n(a,s)&&ti(o,bi(s,t),a)}return o}function Hr(t,e,n,r){var i=r?qe:We,o=-1,s=e.length,a=t;for(t===e&&(e=Oi(e)),n&&(a=Me(t,Qe(n)));++o<s;)for(var c=0,u=e[o],d=n?n(u):u;(c=i(a,d,c,r))>-1;)a!==t&&Xt.call(a,c,1),Xt.call(t,c,1);return t}function Kr(t,e){for(var n=t?e.length:0,r=n-1;n--;){var i=e[n];if(n==r||i!==o){var o=i;bo(i)?Xt.call(t,i,1):hi(t,i)}}return t}function Jr(t,e){return t+ve(Cn()*(e-t+1))}function Xr(t,e){var n="";if(!t||e<1||e>f)return n;do{e%2&&(n+=t),(e=ve(e/2))&&(t+=t)}while(e);return n}function Yr(t,e){return xo(Ao(t,e,ic),t+"")}function Zr(t){return Zn(Ga(t))}function Qr(t,e){var n=Ga(t);return jo(n,cr(e,0,n.length))}function ti(t,e,n,r){if(!ea(t))return t;for(var o=-1,s=(e=bi(e,t)).length,a=s-1,c=t;null!=c&&++o<s;){var u=Uo(e[o]),d=n;if("__proto__"===u||"constructor"===u||"prototype"===u)return t;if(o!=a){var l=c[u];(d=r?r(l,u,c):i)===i&&(d=ea(l)?l:bo(e[o+1])?[]:{})}nr(c,u,d),c=c[u]}return t}var ei=Pn?function(t,e){return Pn.set(t,e),t}:ic,ni=ne?function(t,e){return ne(t,"toString",{configurable:!0,enumerable:!1,value:ec(e),writable:!0})}:ic;function ri(t){return jo(Ga(t))}function ii(t,e,n){var i=-1,o=t.length;e<0&&(e=-e>o?0:o+e),(n=n>o?o:n)<0&&(n+=o),o=e>n?0:n-e>>>0,e>>>=0;for(var s=r(o);++i<o;)s[i]=t[i+e];return s}function oi(t,e){var n;return pr(t,(function(t,r,i){return!(n=e(t,r,i))})),!!n}function si(t,e,n){var r=0,i=null==t?r:t.length;if("number"==typeof e&&e==e&&i<=2147483647){for(;r<i;){var o=r+i>>>1,s=t[o];null!==s&&!ua(s)&&(n?s<=e:s<e)?r=o+1:i=o}return i}return ai(t,e,ic,n)}function ai(t,e,n,r){var o=0,s=null==t?0:t.length;if(0===s)return 0;for(var a=(e=n(e))!=e,c=null===e,u=ua(e),d=e===i;o<s;){var l=ve((o+s)/2),h=n(t[l]),p=h!==i,f=null===h,g=h==h,v=ua(h);if(a)var m=r||g;else m=d?g&&(r||p):c?g&&p&&(r||!f):u?g&&p&&!f&&(r||!v):!f&&!v&&(r?h<=e:h<e);m?o=l+1:s=l}return bn(s,4294967294)}function ci(t,e){for(var n=-1,r=t.length,i=0,o=[];++n<r;){var s=t[n],a=e?e(s):s;if(!n||!Gs(a,c)){var c=a;o[i++]=0===s?0:s}}return o}function ui(t){return"number"==typeof t?t:ua(t)?g:+t}function di(t){if("string"==typeof t)return t;if(zs(t))return Me(t,di)+"";if(ua(t))return Fn?Fn.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function li(t,e,n){var r=-1,i=xe,o=t.length,s=!0,a=[],c=a;if(n)s=!1,i=De;else if(o>=200){var u=e?null:Xi(t);if(u)return hn(u);s=!1,i=en,c=new Jn}else c=e?[]:a;t:for(;++r<o;){var d=t[r],l=e?e(d):d;if(d=n||0!==d?d:0,s&&l==l){for(var h=c.length;h--;)if(c[h]===l)continue t;e&&c.push(l),a.push(d)}else i(c,l,n)||(c!==a&&c.push(l),a.push(d))}return a}function hi(t,e){return null==(t=ko(t,e=bi(e,t)))||delete t[Uo(Yo(e))]}function pi(t,e,n,r){return ti(t,e,n(wr(t,e)),r)}function fi(t,e,n,r){for(var i=t.length,o=r?i:-1;(r?o--:++o<i)&&e(t[o],o,t););return n?ii(t,r?0:o,r?o+1:i):ii(t,r?o+1:0,r?i:o)}function gi(t,e){var n=t;return n instanceof zn&&(n=n.value()),Le(e,(function(t,e){return e.func.apply(e.thisArg,je([t],e.args))}),n)}function vi(t,e,n){var i=t.length;if(i<2)return i?li(t[0]):[];for(var o=-1,s=r(i);++o<i;)for(var a=t[o],c=-1;++c<i;)c!=o&&(s[o]=hr(s[o]||a,t[c],e,n));return li(yr(s,1),e,n)}function mi(t,e,n){for(var r=-1,o=t.length,s=e.length,a={};++r<o;){var c=r<s?e[r]:i;n(a,t[r],c)}return a}function yi(t){return Ks(t)?t:[]}function _i(t){return"function"==typeof t?t:ic}function bi(t,e){return zs(t)?t:So(t,e)?[t]:Lo(_a(t))}var Ei=Yr;function Si(t,e,n){var r=t.length;return n=n===i?r:n,!e&&n>=r?t:ii(t,e,n)}var Ci=ie||function(t){return ge.clearTimeout(t)};function wi(t,e){if(e)return t.slice();var n=t.length,r=$t?$t(n):new t.constructor(n);return t.copy(r),r}function Ti(t){var e=new t.constructor(t.byteLength);return new zt(e).set(new zt(t)),e}function Ii(t,e){var n=e?Ti(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function Ri(t,e){if(t!==e){var n=t!==i,r=null===t,o=t==t,s=ua(t),a=e!==i,c=null===e,u=e==e,d=ua(e);if(!c&&!d&&!s&&t>e||s&&a&&u&&!c&&!d||r&&a&&u||!n&&u||!o)return 1;if(!r&&!s&&!d&&t<e||d&&n&&o&&!r&&!s||c&&n&&o||!a&&o||!u)return-1}return 0}function Ai(t,e,n,i){for(var o=-1,s=t.length,a=n.length,c=-1,u=e.length,d=_n(s-a,0),l=r(u+d),h=!i;++c<u;)l[c]=e[c];for(;++o<a;)(h||o<s)&&(l[n[o]]=t[o]);for(;d--;)l[c++]=t[o++];return l}function ki(t,e,n,i){for(var o=-1,s=t.length,a=-1,c=n.length,u=-1,d=e.length,l=_n(s-c,0),h=r(l+d),p=!i;++o<l;)h[o]=t[o];for(var f=o;++u<d;)h[f+u]=e[u];for(;++a<c;)(p||o<s)&&(h[f+n[a]]=t[o++]);return h}function Oi(t,e){var n=-1,i=t.length;for(e||(e=r(i));++n<i;)e[n]=t[n];return e}function Pi(t,e,n,r){var o=!n;n||(n={});for(var s=-1,a=e.length;++s<a;){var c=e[s],u=r?r(n[c],t[c],c,n,t):i;u===i&&(u=t[c]),o?sr(n,c,u):nr(n,c,u)}return n}function Ni(t,e){return function(n,r){var i=zs(n)?Ae:ir,o=e?e():{};return i(n,t,uo(r,2),o)}}function xi(t){return Yr((function(e,n){var r=-1,o=n.length,s=o>1?n[o-1]:i,a=o>2?n[2]:i;for(s=t.length>3&&"function"==typeof s?(o--,s):i,a&&Eo(n[0],n[1],a)&&(s=o<3?i:s,o=1),e=Rt(e);++r<o;){var c=n[r];c&&t(e,c,r,s)}return e}))}function Di(t,e){return function(n,r){if(null==n)return n;if(!Hs(n))return t(n,r);for(var i=n.length,o=e?i:-1,s=Rt(n);(e?o--:++o<i)&&!1!==r(s[o],o,s););return n}}function Mi(t){return function(e,n,r){for(var i=-1,o=Rt(e),s=r(e),a=s.length;a--;){var c=s[t?a:++i];if(!1===n(o[c],c,o))break}return e}}function ji(t){return function(e){var n=cn(e=_a(e))?gn(e):i,r=n?n[0]:e.charAt(0),o=n?Si(n,1).join(""):e.slice(1);return r[t]()+o}}function Li(t){return function(e){return Le(Za(qa(e).replace(te,"")),t,"")}}function Ui(t){return function(){var e=arguments;switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var n=Vn(t.prototype),r=t.apply(n,e);return ea(r)?r:n}}function Bi(t){return function(e,n,r){var o=Rt(e);if(!Hs(e)){var s=uo(n,3);e=Na(e),n=function(t){return s(o[t],t,o)}}var a=t(e,n,r);return a>-1?o[s?e[a]:a]:i}}function Fi(t){return ro((function(e){var n=e.length,r=n,s=qn.prototype.thru;for(t&&e.reverse();r--;){var a=e[r];if("function"!=typeof a)throw new Ot(o);if(s&&!c&&"wrapper"==ao(a))var c=new qn([],!0)}for(r=c?r:n;++r<n;){var u=ao(a=e[r]),d="wrapper"==u?so(a):i;c=d&&Co(d[0])&&424==d[1]&&!d[4].length&&1==d[9]?c[ao(d[0])].apply(c,d[3]):1==a.length&&Co(a)?c[u]():c.thru(a)}return function(){var t=arguments,r=t[0];if(c&&1==t.length&&zs(r))return c.plant(r).value();for(var i=0,o=n?e[i].apply(this,t):r;++i<n;)o=e[i].call(this,o);return o}}))}function Gi(t,e,n,o,s,a,c,u,d,h){var p=e&l,f=1&e,g=2&e,v=24&e,m=512&e,y=g?i:Ui(t);return function l(){for(var _=arguments.length,b=r(_),E=_;E--;)b[E]=arguments[E];if(v)var S=co(l),C=function(t,e){for(var n=t.length,r=0;n--;)t[n]===e&&++r;return r}(b,S);if(o&&(b=Ai(b,o,s,v)),a&&(b=ki(b,a,c,v)),_-=C,v&&_<h){var w=ln(b,S);return Ki(t,e,Gi,l.placeholder,n,b,w,u,d,h-_)}var T=f?n:this,I=g?T[t]:t;return _=b.length,u?b=function(t,e){var n=t.length,r=bn(e.length,n),o=Oi(t);for(;r--;){var s=e[r];t[r]=bo(s,n)?o[s]:i}return t}(b,u):m&&_>1&&b.reverse(),p&&d<_&&(b.length=d),this&&this!==ge&&this instanceof l&&(I=y||Ui(I)),I.apply(T,b)}}function Vi(t,e){return function(n,r){return function(t,e,n,r){return Er(t,(function(t,i,o){e(r,n(t),i,o)})),r}(n,t,e(r),{})}}function Wi(t,e){return function(n,r){var o;if(n===i&&r===i)return e;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=di(n),r=di(r)):(n=ui(n),r=ui(r)),o=t(n,r)}return o}}function qi(t){return ro((function(e){return e=Me(e,Qe(uo())),Yr((function(n){var r=this;return t(e,(function(t){return Re(t,r,n)}))}))}))}function zi(t,e){var n=(e=e===i?" ":di(e)).length;if(n<2)return n?Xr(e,t):e;var r=Xr(e,fe(t/fn(e)));return cn(e)?Si(gn(r),0,t).join(""):r.slice(0,t)}function $i(t){return function(e,n,o){return o&&"number"!=typeof o&&Eo(e,n,o)&&(n=o=i),e=fa(e),n===i?(n=e,e=0):n=fa(n),function(t,e,n,i){for(var o=-1,s=_n(fe((e-t)/(n||1)),0),a=r(s);s--;)a[i?s:++o]=t,t+=n;return a}(e,n,o=o===i?e<n?1:-1:fa(o),t)}}function Hi(t){return function(e,n){return"string"==typeof e&&"string"==typeof n||(e=ma(e),n=ma(n)),t(e,n)}}function Ki(t,e,n,r,o,s,a,c,l,h){var p=8&e;e|=p?u:d,4&(e&=~(p?d:u))||(e&=-4);var f=[t,e,o,p?s:i,p?a:i,p?i:s,p?i:a,c,l,h],g=n.apply(i,f);return Co(t)&&Po(g,f),g.placeholder=r,Do(g,t,e)}function Ji(t){var e=It[t];return function(t,n){if(t=ma(t),(n=null==n?0:bn(ga(n),292))&&be(t)){var r=(_a(t)+"e").split("e");return+((r=(_a(e(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return e(t)}}var Xi=An&&1/hn(new An([,-0]))[1]==p?function(t){return new An(t)}:uc;function Yi(t){return function(e){var n=vo(e);return n==T?un(e):n==O?pn(e):function(t,e){return Me(e,(function(e){return[e,t[e]]}))}(e,t(e))}}function Zi(t,e,n,s,p,f,g,v){var m=2&e;if(!m&&"function"!=typeof t)throw new Ot(o);var y=s?s.length:0;if(y||(e&=-97,s=p=i),g=g===i?g:_n(ga(g),0),v=v===i?v:ga(v),y-=p?p.length:0,e&d){var _=s,b=p;s=p=i}var E=m?i:so(t),S=[t,e,n,s,p,_,b,f,g,v];if(E&&function(t,e){var n=t[1],r=e[1],i=n|r,o=i<131,s=r==l&&8==n||r==l&&n==h&&t[7].length<=e[8]||384==r&&e[7].length<=e[8]&&8==n;if(!o&&!s)return t;1&r&&(t[2]=e[2],i|=1&n?0:4);var c=e[3];if(c){var u=t[3];t[3]=u?Ai(u,c,e[4]):c,t[4]=u?ln(t[3],a):e[4]}(c=e[5])&&(u=t[5],t[5]=u?ki(u,c,e[6]):c,t[6]=u?ln(t[5],a):e[6]);(c=e[7])&&(t[7]=c);r&l&&(t[8]=null==t[8]?e[8]:bn(t[8],e[8]));null==t[9]&&(t[9]=e[9]);t[0]=e[0],t[1]=i}(S,E),t=S[0],e=S[1],n=S[2],s=S[3],p=S[4],!(v=S[9]=S[9]===i?m?0:t.length:_n(S[9]-y,0))&&24&e&&(e&=-25),e&&1!=e)C=8==e||e==c?function(t,e,n){var o=Ui(t);return function s(){for(var a=arguments.length,c=r(a),u=a,d=co(s);u--;)c[u]=arguments[u];var l=a<3&&c[0]!==d&&c[a-1]!==d?[]:ln(c,d);return(a-=l.length)<n?Ki(t,e,Gi,s.placeholder,i,c,l,i,i,n-a):Re(this&&this!==ge&&this instanceof s?o:t,this,c)}}(t,e,v):e!=u&&33!=e||p.length?Gi.apply(i,S):function(t,e,n,i){var o=1&e,s=Ui(t);return function e(){for(var a=-1,c=arguments.length,u=-1,d=i.length,l=r(d+c),h=this&&this!==ge&&this instanceof e?s:t;++u<d;)l[u]=i[u];for(;c--;)l[u++]=arguments[++a];return Re(h,o?n:this,l)}}(t,e,n,s);else var C=function(t,e,n){var r=1&e,i=Ui(t);return function e(){return(this&&this!==ge&&this instanceof e?i:t).apply(r?n:this,arguments)}}(t,e,n);return Do((E?ei:Po)(C,S),t,e)}function Qi(t,e,n,r){return t===i||Gs(t,xt[n])&&!jt.call(r,n)?e:t}function to(t,e,n,r,o,s){return ea(t)&&ea(e)&&(s.set(e,t),Wr(t,e,i,to,s),s.delete(e)),t}function eo(t){return oa(t)?i:t}function no(t,e,n,r,o,s){var a=1&n,c=t.length,u=e.length;if(c!=u&&!(a&&u>c))return!1;var d=s.get(t),l=s.get(e);if(d&&l)return d==e&&l==t;var h=-1,p=!0,f=2&n?new Jn:i;for(s.set(t,e),s.set(e,t);++h<c;){var g=t[h],v=e[h];if(r)var m=a?r(v,g,h,e,t,s):r(g,v,h,t,e,s);if(m!==i){if(m)continue;p=!1;break}if(f){if(!Be(e,(function(t,e){if(!en(f,e)&&(g===t||o(g,t,n,r,s)))return f.push(e)}))){p=!1;break}}else if(g!==v&&!o(g,v,n,r,s)){p=!1;break}}return s.delete(t),s.delete(e),p}function ro(t){return xo(Ao(t,i,$o),t+"")}function io(t){return Tr(t,Na,fo)}function oo(t){return Tr(t,xa,go)}var so=Pn?function(t){return Pn.get(t)}:uc;function ao(t){for(var e=t.name+"",n=Nn[e],r=jt.call(Nn,e)?n.length:0;r--;){var i=n[r],o=i.func;if(null==o||o==t)return i.name}return e}function co(t){return(jt.call(Gn,"placeholder")?Gn:t).placeholder}function uo(){var t=Gn.iteratee||oc;return t=t===oc?jr:t,arguments.length?t(arguments[0],arguments[1]):t}function lo(t,e){var n,r,i=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof e?"string":"hash"]:i.map}function ho(t){for(var e=Na(t),n=e.length;n--;){var r=e[n],i=t[r];e[n]=[r,i,Io(i)]}return e}function po(t,e){var n=function(t,e){return null==t?i:t[e]}(t,e);return Mr(n)?n:i}var fo=me?function(t){return null==t?[]:(t=Rt(t),Ne(me(t),(function(e){return Jt.call(t,e)})))}:vc,go=me?function(t){for(var e=[];t;)je(e,fo(t)),t=Ht(t);return e}:vc,vo=Ir;function mo(t,e,n){for(var r=-1,i=(e=bi(e,t)).length,o=!1;++r<i;){var s=Uo(e[r]);if(!(o=null!=t&&n(t,s)))break;t=t[s]}return o||++r!=i?o:!!(i=null==t?0:t.length)&&ta(i)&&bo(s,i)&&(zs(t)||qs(t))}function yo(t){return"function"!=typeof t.constructor||To(t)?{}:Vn(Ht(t))}function _o(t){return zs(t)||qs(t)||!!(Yt&&t&&t[Yt])}function bo(t,e){var n=typeof t;return!!(e=null==e?f:e)&&("number"==n||"symbol"!=n&&bt.test(t))&&t>-1&&t%1==0&&t<e}function Eo(t,e,n){if(!ea(n))return!1;var r=typeof e;return!!("number"==r?Hs(n)&&bo(e,n.length):"string"==r&&e in n)&&Gs(n[e],t)}function So(t,e){if(zs(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!ua(t))||(nt.test(t)||!et.test(t)||null!=e&&t in Rt(e))}function Co(t){var e=ao(t),n=Gn[e];if("function"!=typeof n||!(e in zn.prototype))return!1;if(t===n)return!0;var r=so(n);return!!r&&t===r[0]}(Tn&&vo(new Tn(new ArrayBuffer(1)))!=M||In&&vo(new In)!=T||Rn&&vo(Rn.resolve())!=A||An&&vo(new An)!=O||kn&&vo(new kn)!=x)&&(vo=function(t){var e=Ir(t),n=e==R?t.constructor:i,r=n?Bo(n):"";if(r)switch(r){case xn:return M;case Dn:return T;case Mn:return A;case jn:return O;case Ln:return x}return e});var wo=Dt?Zs:mc;function To(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||xt)}function Io(t){return t==t&&!ea(t)}function Ro(t,e){return function(n){return null!=n&&(n[t]===e&&(e!==i||t in Rt(n)))}}function Ao(t,e,n){return e=_n(e===i?t.length-1:e,0),function(){for(var i=arguments,o=-1,s=_n(i.length-e,0),a=r(s);++o<s;)a[o]=i[e+o];o=-1;for(var c=r(e+1);++o<e;)c[o]=i[o];return c[e]=n(a),Re(t,this,c)}}function ko(t,e){return e.length<2?t:wr(t,ii(e,0,-1))}function Oo(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var Po=Mo(ei),No=pe||function(t,e){return ge.setTimeout(t,e)},xo=Mo(ni);function Do(t,e,n){var r=e+"";return xo(t,function(t,e){var n=e.length;if(!n)return t;var r=n-1;return e[r]=(n>1?"& ":"")+e[r],e=e.join(n>2?", ":" "),t.replace(ct,"{\n/* [wrapped with "+e+"] */\n")}(r,function(t,e){return ke(m,(function(n){var r="_."+n[0];e&n[1]&&!xe(t,r)&&t.push(r)})),t.sort()}(function(t){var e=t.match(ut);return e?e[1].split(dt):[]}(r),n)))}function Mo(t){var e=0,n=0;return function(){var r=En(),o=16-(r-n);if(n=r,o>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(i,arguments)}}function jo(t,e){var n=-1,r=t.length,o=r-1;for(e=e===i?r:e;++n<e;){var s=Jr(n,o),a=t[s];t[s]=t[n],t[n]=a}return t.length=e,t}var Lo=function(t){var e=Ms(t,(function(t){return 500===n.size&&n.clear(),t})),n=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(rt,(function(t,n,r,i){e.push(r?i.replace(pt,"$1"):n||t)})),e}));function Uo(t){if("string"==typeof t||ua(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function Bo(t){if(null!=t){try{return Mt.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Fo(t){if(t instanceof zn)return t.clone();var e=new qn(t.__wrapped__,t.__chain__);return e.__actions__=Oi(t.__actions__),e.__index__=t.__index__,e.__values__=t.__values__,e}var Go=Yr((function(t,e){return Ks(t)?hr(t,yr(e,1,Ks,!0)):[]})),Vo=Yr((function(t,e){var n=Yo(e);return Ks(n)&&(n=i),Ks(t)?hr(t,yr(e,1,Ks,!0),uo(n,2)):[]})),Wo=Yr((function(t,e){var n=Yo(e);return Ks(n)&&(n=i),Ks(t)?hr(t,yr(e,1,Ks,!0),i,n):[]}));function qo(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:ga(n);return i<0&&(i=_n(r+i,0)),Ve(t,uo(e,3),i)}function zo(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var o=r-1;return n!==i&&(o=ga(n),o=n<0?_n(r+o,0):bn(o,r-1)),Ve(t,uo(e,3),o,!0)}function $o(t){return(null==t?0:t.length)?yr(t,1):[]}function Ho(t){return t&&t.length?t[0]:i}var Ko=Yr((function(t){var e=Me(t,yi);return e.length&&e[0]===t[0]?Or(e):[]})),Jo=Yr((function(t){var e=Yo(t),n=Me(t,yi);return e===Yo(n)?e=i:n.pop(),n.length&&n[0]===t[0]?Or(n,uo(e,2)):[]})),Xo=Yr((function(t){var e=Yo(t),n=Me(t,yi);return(e="function"==typeof e?e:i)&&n.pop(),n.length&&n[0]===t[0]?Or(n,i,e):[]}));function Yo(t){var e=null==t?0:t.length;return e?t[e-1]:i}var Zo=Yr(Qo);function Qo(t,e){return t&&t.length&&e&&e.length?Hr(t,e):t}var ts=ro((function(t,e){var n=null==t?0:t.length,r=ar(t,e);return Kr(t,Me(e,(function(t){return bo(t,n)?+t:t})).sort(Ri)),r}));function es(t){return null==t?t:wn.call(t)}var ns=Yr((function(t){return li(yr(t,1,Ks,!0))})),rs=Yr((function(t){var e=Yo(t);return Ks(e)&&(e=i),li(yr(t,1,Ks,!0),uo(e,2))})),is=Yr((function(t){var e=Yo(t);return e="function"==typeof e?e:i,li(yr(t,1,Ks,!0),i,e)}));function os(t){if(!t||!t.length)return[];var e=0;return t=Ne(t,(function(t){if(Ks(t))return e=_n(t.length,e),!0})),Ye(e,(function(e){return Me(t,He(e))}))}function ss(t,e){if(!t||!t.length)return[];var n=os(t);return null==e?n:Me(n,(function(t){return Re(e,i,t)}))}var as=Yr((function(t,e){return Ks(t)?hr(t,e):[]})),cs=Yr((function(t){return vi(Ne(t,Ks))})),us=Yr((function(t){var e=Yo(t);return Ks(e)&&(e=i),vi(Ne(t,Ks),uo(e,2))})),ds=Yr((function(t){var e=Yo(t);return e="function"==typeof e?e:i,vi(Ne(t,Ks),i,e)})),ls=Yr(os);var hs=Yr((function(t){var e=t.length,n=e>1?t[e-1]:i;return n="function"==typeof n?(t.pop(),n):i,ss(t,n)}));function ps(t){var e=Gn(t);return e.__chain__=!0,e}function fs(t,e){return e(t)}var gs=ro((function(t){var e=t.length,n=e?t[0]:0,r=this.__wrapped__,o=function(e){return ar(e,t)};return!(e>1||this.__actions__.length)&&r instanceof zn&&bo(n)?((r=r.slice(n,+n+(e?1:0))).__actions__.push({func:fs,args:[o],thisArg:i}),new qn(r,this.__chain__).thru((function(t){return e&&!t.length&&t.push(i),t}))):this.thru(o)}));var vs=Ni((function(t,e,n){jt.call(t,n)?++t[n]:sr(t,n,1)}));var ms=Bi(qo),ys=Bi(zo);function _s(t,e){return(zs(t)?ke:pr)(t,uo(e,3))}function bs(t,e){return(zs(t)?Oe:fr)(t,uo(e,3))}var Es=Ni((function(t,e,n){jt.call(t,n)?t[n].push(e):sr(t,n,[e])}));var Ss=Yr((function(t,e,n){var i=-1,o="function"==typeof e,s=Hs(t)?r(t.length):[];return pr(t,(function(t){s[++i]=o?Re(e,t,n):Pr(t,e,n)})),s})),Cs=Ni((function(t,e,n){sr(t,n,e)}));function ws(t,e){return(zs(t)?Me:Fr)(t,uo(e,3))}var Ts=Ni((function(t,e,n){t[n?0:1].push(e)}),(function(){return[[],[]]}));var Is=Yr((function(t,e){if(null==t)return[];var n=e.length;return n>1&&Eo(t,e[0],e[1])?e=[]:n>2&&Eo(e[0],e[1],e[2])&&(e=[e[0]]),zr(t,yr(e,1),[])})),Rs=de||function(){return ge.Date.now()};function As(t,e,n){return e=n?i:e,e=t&&null==e?t.length:e,Zi(t,l,i,i,i,i,e)}function ks(t,e){var n;if("function"!=typeof e)throw new Ot(o);return t=ga(t),function(){return--t>0&&(n=e.apply(this,arguments)),t<=1&&(e=i),n}}var Os=Yr((function(t,e,n){var r=1;if(n.length){var i=ln(n,co(Os));r|=u}return Zi(t,r,e,n,i)})),Ps=Yr((function(t,e,n){var r=3;if(n.length){var i=ln(n,co(Ps));r|=u}return Zi(e,r,t,n,i)}));function Ns(t,e,n){var r,s,a,c,u,d,l=0,h=!1,p=!1,f=!0;if("function"!=typeof t)throw new Ot(o);function g(e){var n=r,o=s;return r=s=i,l=e,c=t.apply(o,n)}function v(t){var n=t-d;return d===i||n>=e||n<0||p&&t-l>=a}function m(){var t=Rs();if(v(t))return y(t);u=No(m,function(t){var n=e-(t-d);return p?bn(n,a-(t-l)):n}(t))}function y(t){return u=i,f&&r?g(t):(r=s=i,c)}function _(){var t=Rs(),n=v(t);if(r=arguments,s=this,d=t,n){if(u===i)return function(t){return l=t,u=No(m,e),h?g(t):c}(d);if(p)return Ci(u),u=No(m,e),g(d)}return u===i&&(u=No(m,e)),c}return e=ma(e)||0,ea(n)&&(h=!!n.leading,a=(p="maxWait"in n)?_n(ma(n.maxWait)||0,e):a,f="trailing"in n?!!n.trailing:f),_.cancel=function(){u!==i&&Ci(u),l=0,r=d=s=u=i},_.flush=function(){return u===i?c:y(Rs())},_}var xs=Yr((function(t,e){return lr(t,1,e)})),Ds=Yr((function(t,e,n){return lr(t,ma(e)||0,n)}));function Ms(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new Ot(o);var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=t.apply(this,r);return n.cache=o.set(i,s)||o,s};return n.cache=new(Ms.Cache||Kn),n}function js(t){if("function"!=typeof t)throw new Ot(o);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}Ms.Cache=Kn;var Ls=Ei((function(t,e){var n=(e=1==e.length&&zs(e[0])?Me(e[0],Qe(uo())):Me(yr(e,1),Qe(uo()))).length;return Yr((function(r){for(var i=-1,o=bn(r.length,n);++i<o;)r[i]=e[i].call(this,r[i]);return Re(t,this,r)}))})),Us=Yr((function(t,e){var n=ln(e,co(Us));return Zi(t,u,i,e,n)})),Bs=Yr((function(t,e){var n=ln(e,co(Bs));return Zi(t,d,i,e,n)})),Fs=ro((function(t,e){return Zi(t,h,i,i,i,e)}));function Gs(t,e){return t===e||t!=t&&e!=e}var Vs=Hi(Rr),Ws=Hi((function(t,e){return t>=e})),qs=Nr(function(){return arguments}())?Nr:function(t){return na(t)&&jt.call(t,"callee")&&!Jt.call(t,"callee")},zs=r.isArray,$s=Ee?Qe(Ee):function(t){return na(t)&&Ir(t)==D};function Hs(t){return null!=t&&ta(t.length)&&!Zs(t)}function Ks(t){return na(t)&&Hs(t)}var Js=_e||mc,Xs=Se?Qe(Se):function(t){return na(t)&&Ir(t)==E};function Ys(t){if(!na(t))return!1;var e=Ir(t);return e==S||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!oa(t)}function Zs(t){if(!ea(t))return!1;var e=Ir(t);return e==C||e==w||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Qs(t){return"number"==typeof t&&t==ga(t)}function ta(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=f}function ea(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function na(t){return null!=t&&"object"==typeof t}var ra=Ce?Qe(Ce):function(t){return na(t)&&vo(t)==T};function ia(t){return"number"==typeof t||na(t)&&Ir(t)==I}function oa(t){if(!na(t)||Ir(t)!=R)return!1;var e=Ht(t);if(null===e)return!0;var n=jt.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Mt.call(n)==Ft}var sa=we?Qe(we):function(t){return na(t)&&Ir(t)==k};var aa=Te?Qe(Te):function(t){return na(t)&&vo(t)==O};function ca(t){return"string"==typeof t||!zs(t)&&na(t)&&Ir(t)==P}function ua(t){return"symbol"==typeof t||na(t)&&Ir(t)==N}var da=Ie?Qe(Ie):function(t){return na(t)&&ta(t.length)&&!!ce[Ir(t)]};var la=Hi(Br),ha=Hi((function(t,e){return t<=e}));function pa(t){if(!t)return[];if(Hs(t))return ca(t)?gn(t):Oi(t);if(Zt&&t[Zt])return function(t){for(var e,n=[];!(e=t.next()).done;)n.push(e.value);return n}(t[Zt]());var e=vo(t);return(e==T?un:e==O?hn:Ga)(t)}function fa(t){return t?(t=ma(t))===p||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function ga(t){var e=fa(t),n=e%1;return e==e?n?e-n:e:0}function va(t){return t?cr(ga(t),0,v):0}function ma(t){if("number"==typeof t)return t;if(ua(t))return g;if(ea(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=ea(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=Ze(t);var n=mt.test(t);return n||_t.test(t)?he(t.slice(2),n?2:8):vt.test(t)?g:+t}function ya(t){return Pi(t,xa(t))}function _a(t){return null==t?"":di(t)}var ba=xi((function(t,e){if(To(e)||Hs(e))Pi(e,Na(e),t);else for(var n in e)jt.call(e,n)&&nr(t,n,e[n])})),Ea=xi((function(t,e){Pi(e,xa(e),t)})),Sa=xi((function(t,e,n,r){Pi(e,xa(e),t,r)})),Ca=xi((function(t,e,n,r){Pi(e,Na(e),t,r)})),wa=ro(ar);var Ta=Yr((function(t,e){t=Rt(t);var n=-1,r=e.length,o=r>2?e[2]:i;for(o&&Eo(e[0],e[1],o)&&(r=1);++n<r;)for(var s=e[n],a=xa(s),c=-1,u=a.length;++c<u;){var d=a[c],l=t[d];(l===i||Gs(l,xt[d])&&!jt.call(t,d))&&(t[d]=s[d])}return t})),Ia=Yr((function(t){return t.push(i,to),Re(Ma,i,t)}));function Ra(t,e,n){var r=null==t?i:wr(t,e);return r===i?n:r}function Aa(t,e){return null!=t&&mo(t,e,kr)}var ka=Vi((function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=Bt.call(e)),t[e]=n}),ec(ic)),Oa=Vi((function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=Bt.call(e)),jt.call(t,e)?t[e].push(n):t[e]=[n]}),uo),Pa=Yr(Pr);function Na(t){return Hs(t)?Yn(t):Lr(t)}function xa(t){return Hs(t)?Yn(t,!0):Ur(t)}var Da=xi((function(t,e,n){Wr(t,e,n)})),Ma=xi((function(t,e,n,r){Wr(t,e,n,r)})),ja=ro((function(t,e){var n={};if(null==t)return n;var r=!1;e=Me(e,(function(e){return e=bi(e,t),r||(r=e.length>1),e})),Pi(t,oo(t),n),r&&(n=ur(n,7,eo));for(var i=e.length;i--;)hi(n,e[i]);return n}));var La=ro((function(t,e){return null==t?{}:function(t,e){return $r(t,e,(function(e,n){return Aa(t,n)}))}(t,e)}));function Ua(t,e){if(null==t)return{};var n=Me(oo(t),(function(t){return[t]}));return e=uo(e),$r(t,n,(function(t,n){return e(t,n[0])}))}var Ba=Yi(Na),Fa=Yi(xa);function Ga(t){return null==t?[]:tn(t,Na(t))}var Va=Li((function(t,e,n){return e=e.toLowerCase(),t+(n?Wa(e):e)}));function Wa(t){return Ya(_a(t).toLowerCase())}function qa(t){return(t=_a(t))&&t.replace(Et,on).replace(ee,"")}var za=Li((function(t,e,n){return t+(n?"-":"")+e.toLowerCase()})),$a=Li((function(t,e,n){return t+(n?" ":"")+e.toLowerCase()})),Ha=ji("toLowerCase");var Ka=Li((function(t,e,n){return t+(n?"_":"")+e.toLowerCase()}));var Ja=Li((function(t,e,n){return t+(n?" ":"")+Ya(e)}));var Xa=Li((function(t,e,n){return t+(n?" ":"")+e.toUpperCase()})),Ya=ji("toUpperCase");function Za(t,e,n){return t=_a(t),(e=n?i:e)===i?function(t){return oe.test(t)}(t)?function(t){return t.match(re)||[]}(t):function(t){return t.match(lt)||[]}(t):t.match(e)||[]}var Qa=Yr((function(t,e){try{return Re(t,i,e)}catch(t){return Ys(t)?t:new wt(t)}})),tc=ro((function(t,e){return ke(e,(function(e){e=Uo(e),sr(t,e,Os(t[e],t))})),t}));function ec(t){return function(){return t}}var nc=Fi(),rc=Fi(!0);function ic(t){return t}function oc(t){return jr("function"==typeof t?t:ur(t,1))}var sc=Yr((function(t,e){return function(n){return Pr(n,t,e)}})),ac=Yr((function(t,e){return function(n){return Pr(t,n,e)}}));function cc(t,e,n){var r=Na(e),i=Cr(e,r);null!=n||ea(e)&&(i.length||!r.length)||(n=e,e=t,t=this,i=Cr(e,Na(e)));var o=!(ea(n)&&"chain"in n&&!n.chain),s=Zs(t);return ke(i,(function(n){var r=e[n];t[n]=r,s&&(t.prototype[n]=function(){var e=this.__chain__;if(o||e){var n=t(this.__wrapped__);return(n.__actions__=Oi(this.__actions__)).push({func:r,args:arguments,thisArg:t}),n.__chain__=e,n}return r.apply(t,je([this.value()],arguments))})})),t}function uc(){}var dc=qi(Me),lc=qi(Pe),hc=qi(Be);function pc(t){return So(t)?He(Uo(t)):function(t){return function(e){return wr(e,t)}}(t)}var fc=$i(),gc=$i(!0);function vc(){return[]}function mc(){return!1}var yc=Wi((function(t,e){return t+e}),0),_c=Ji("ceil"),bc=Wi((function(t,e){return t/e}),1),Ec=Ji("floor");var Sc,Cc=Wi((function(t,e){return t*e}),1),wc=Ji("round"),Tc=Wi((function(t,e){return t-e}),0);return Gn.after=function(t,e){if("function"!=typeof e)throw new Ot(o);return t=ga(t),function(){if(--t<1)return e.apply(this,arguments)}},Gn.ary=As,Gn.assign=ba,Gn.assignIn=Ea,Gn.assignInWith=Sa,Gn.assignWith=Ca,Gn.at=wa,Gn.before=ks,Gn.bind=Os,Gn.bindAll=tc,Gn.bindKey=Ps,Gn.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return zs(t)?t:[t]},Gn.chain=ps,Gn.chunk=function(t,e,n){e=(n?Eo(t,e,n):e===i)?1:_n(ga(e),0);var o=null==t?0:t.length;if(!o||e<1)return[];for(var s=0,a=0,c=r(fe(o/e));s<o;)c[a++]=ii(t,s,s+=e);return c},Gn.compact=function(t){for(var e=-1,n=null==t?0:t.length,r=0,i=[];++e<n;){var o=t[e];o&&(i[r++]=o)}return i},Gn.concat=function(){var t=arguments.length;if(!t)return[];for(var e=r(t-1),n=arguments[0],i=t;i--;)e[i-1]=arguments[i];return je(zs(n)?Oi(n):[n],yr(e,1))},Gn.cond=function(t){var e=null==t?0:t.length,n=uo();return t=e?Me(t,(function(t){if("function"!=typeof t[1])throw new Ot(o);return[n(t[0]),t[1]]})):[],Yr((function(n){for(var r=-1;++r<e;){var i=t[r];if(Re(i[0],this,n))return Re(i[1],this,n)}}))},Gn.conforms=function(t){return function(t){var e=Na(t);return function(n){return dr(n,t,e)}}(ur(t,1))},Gn.constant=ec,Gn.countBy=vs,Gn.create=function(t,e){var n=Vn(t);return null==e?n:or(n,e)},Gn.curry=function t(e,n,r){var o=Zi(e,8,i,i,i,i,i,n=r?i:n);return o.placeholder=t.placeholder,o},Gn.curryRight=function t(e,n,r){var o=Zi(e,c,i,i,i,i,i,n=r?i:n);return o.placeholder=t.placeholder,o},Gn.debounce=Ns,Gn.defaults=Ta,Gn.defaultsDeep=Ia,Gn.defer=xs,Gn.delay=Ds,Gn.difference=Go,Gn.differenceBy=Vo,Gn.differenceWith=Wo,Gn.drop=function(t,e,n){var r=null==t?0:t.length;return r?ii(t,(e=n||e===i?1:ga(e))<0?0:e,r):[]},Gn.dropRight=function(t,e,n){var r=null==t?0:t.length;return r?ii(t,0,(e=r-(e=n||e===i?1:ga(e)))<0?0:e):[]},Gn.dropRightWhile=function(t,e){return t&&t.length?fi(t,uo(e,3),!0,!0):[]},Gn.dropWhile=function(t,e){return t&&t.length?fi(t,uo(e,3),!0):[]},Gn.fill=function(t,e,n,r){var o=null==t?0:t.length;return o?(n&&"number"!=typeof n&&Eo(t,e,n)&&(n=0,r=o),function(t,e,n,r){var o=t.length;for((n=ga(n))<0&&(n=-n>o?0:o+n),(r=r===i||r>o?o:ga(r))<0&&(r+=o),r=n>r?0:va(r);n<r;)t[n++]=e;return t}(t,e,n,r)):[]},Gn.filter=function(t,e){return(zs(t)?Ne:mr)(t,uo(e,3))},Gn.flatMap=function(t,e){return yr(ws(t,e),1)},Gn.flatMapDeep=function(t,e){return yr(ws(t,e),p)},Gn.flatMapDepth=function(t,e,n){return n=n===i?1:ga(n),yr(ws(t,e),n)},Gn.flatten=$o,Gn.flattenDeep=function(t){return(null==t?0:t.length)?yr(t,p):[]},Gn.flattenDepth=function(t,e){return(null==t?0:t.length)?yr(t,e=e===i?1:ga(e)):[]},Gn.flip=function(t){return Zi(t,512)},Gn.flow=nc,Gn.flowRight=rc,Gn.fromPairs=function(t){for(var e=-1,n=null==t?0:t.length,r={};++e<n;){var i=t[e];r[i[0]]=i[1]}return r},Gn.functions=function(t){return null==t?[]:Cr(t,Na(t))},Gn.functionsIn=function(t){return null==t?[]:Cr(t,xa(t))},Gn.groupBy=Es,Gn.initial=function(t){return(null==t?0:t.length)?ii(t,0,-1):[]},Gn.intersection=Ko,Gn.intersectionBy=Jo,Gn.intersectionWith=Xo,Gn.invert=ka,Gn.invertBy=Oa,Gn.invokeMap=Ss,Gn.iteratee=oc,Gn.keyBy=Cs,Gn.keys=Na,Gn.keysIn=xa,Gn.map=ws,Gn.mapKeys=function(t,e){var n={};return e=uo(e,3),Er(t,(function(t,r,i){sr(n,e(t,r,i),t)})),n},Gn.mapValues=function(t,e){var n={};return e=uo(e,3),Er(t,(function(t,r,i){sr(n,r,e(t,r,i))})),n},Gn.matches=function(t){return Gr(ur(t,1))},Gn.matchesProperty=function(t,e){return Vr(t,ur(e,1))},Gn.memoize=Ms,Gn.merge=Da,Gn.mergeWith=Ma,Gn.method=sc,Gn.methodOf=ac,Gn.mixin=cc,Gn.negate=js,Gn.nthArg=function(t){return t=ga(t),Yr((function(e){return qr(e,t)}))},Gn.omit=ja,Gn.omitBy=function(t,e){return Ua(t,js(uo(e)))},Gn.once=function(t){return ks(2,t)},Gn.orderBy=function(t,e,n,r){return null==t?[]:(zs(e)||(e=null==e?[]:[e]),zs(n=r?i:n)||(n=null==n?[]:[n]),zr(t,e,n))},Gn.over=dc,Gn.overArgs=Ls,Gn.overEvery=lc,Gn.overSome=hc,Gn.partial=Us,Gn.partialRight=Bs,Gn.partition=Ts,Gn.pick=La,Gn.pickBy=Ua,Gn.property=pc,Gn.propertyOf=function(t){return function(e){return null==t?i:wr(t,e)}},Gn.pull=Zo,Gn.pullAll=Qo,Gn.pullAllBy=function(t,e,n){return t&&t.length&&e&&e.length?Hr(t,e,uo(n,2)):t},Gn.pullAllWith=function(t,e,n){return t&&t.length&&e&&e.length?Hr(t,e,i,n):t},Gn.pullAt=ts,Gn.range=fc,Gn.rangeRight=gc,Gn.rearg=Fs,Gn.reject=function(t,e){return(zs(t)?Ne:mr)(t,js(uo(e,3)))},Gn.remove=function(t,e){var n=[];if(!t||!t.length)return n;var r=-1,i=[],o=t.length;for(e=uo(e,3);++r<o;){var s=t[r];e(s,r,t)&&(n.push(s),i.push(r))}return Kr(t,i),n},Gn.rest=function(t,e){if("function"!=typeof t)throw new Ot(o);return Yr(t,e=e===i?e:ga(e))},Gn.reverse=es,Gn.sampleSize=function(t,e,n){return e=(n?Eo(t,e,n):e===i)?1:ga(e),(zs(t)?Qn:Qr)(t,e)},Gn.set=function(t,e,n){return null==t?t:ti(t,e,n)},Gn.setWith=function(t,e,n,r){return r="function"==typeof r?r:i,null==t?t:ti(t,e,n,r)},Gn.shuffle=function(t){return(zs(t)?tr:ri)(t)},Gn.slice=function(t,e,n){var r=null==t?0:t.length;return r?(n&&"number"!=typeof n&&Eo(t,e,n)?(e=0,n=r):(e=null==e?0:ga(e),n=n===i?r:ga(n)),ii(t,e,n)):[]},Gn.sortBy=Is,Gn.sortedUniq=function(t){return t&&t.length?ci(t):[]},Gn.sortedUniqBy=function(t,e){return t&&t.length?ci(t,uo(e,2)):[]},Gn.split=function(t,e,n){return n&&"number"!=typeof n&&Eo(t,e,n)&&(e=n=i),(n=n===i?v:n>>>0)?(t=_a(t))&&("string"==typeof e||null!=e&&!sa(e))&&!(e=di(e))&&cn(t)?Si(gn(t),0,n):t.split(e,n):[]},Gn.spread=function(t,e){if("function"!=typeof t)throw new Ot(o);return e=null==e?0:_n(ga(e),0),Yr((function(n){var r=n[e],i=Si(n,0,e);return r&&je(i,r),Re(t,this,i)}))},Gn.tail=function(t){var e=null==t?0:t.length;return e?ii(t,1,e):[]},Gn.take=function(t,e,n){return t&&t.length?ii(t,0,(e=n||e===i?1:ga(e))<0?0:e):[]},Gn.takeRight=function(t,e,n){var r=null==t?0:t.length;return r?ii(t,(e=r-(e=n||e===i?1:ga(e)))<0?0:e,r):[]},Gn.takeRightWhile=function(t,e){return t&&t.length?fi(t,uo(e,3),!1,!0):[]},Gn.takeWhile=function(t,e){return t&&t.length?fi(t,uo(e,3)):[]},Gn.tap=function(t,e){return e(t),t},Gn.throttle=function(t,e,n){var r=!0,i=!0;if("function"!=typeof t)throw new Ot(o);return ea(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ns(t,e,{leading:r,maxWait:e,trailing:i})},Gn.thru=fs,Gn.toArray=pa,Gn.toPairs=Ba,Gn.toPairsIn=Fa,Gn.toPath=function(t){return zs(t)?Me(t,Uo):ua(t)?[t]:Oi(Lo(_a(t)))},Gn.toPlainObject=ya,Gn.transform=function(t,e,n){var r=zs(t),i=r||Js(t)||da(t);if(e=uo(e,4),null==n){var o=t&&t.constructor;n=i?r?new o:[]:ea(t)&&Zs(o)?Vn(Ht(t)):{}}return(i?ke:Er)(t,(function(t,r,i){return e(n,t,r,i)})),n},Gn.unary=function(t){return As(t,1)},Gn.union=ns,Gn.unionBy=rs,Gn.unionWith=is,Gn.uniq=function(t){return t&&t.length?li(t):[]},Gn.uniqBy=function(t,e){return t&&t.length?li(t,uo(e,2)):[]},Gn.uniqWith=function(t,e){return e="function"==typeof e?e:i,t&&t.length?li(t,i,e):[]},Gn.unset=function(t,e){return null==t||hi(t,e)},Gn.unzip=os,Gn.unzipWith=ss,Gn.update=function(t,e,n){return null==t?t:pi(t,e,_i(n))},Gn.updateWith=function(t,e,n,r){return r="function"==typeof r?r:i,null==t?t:pi(t,e,_i(n),r)},Gn.values=Ga,Gn.valuesIn=function(t){return null==t?[]:tn(t,xa(t))},Gn.without=as,Gn.words=Za,Gn.wrap=function(t,e){return Us(_i(e),t)},Gn.xor=cs,Gn.xorBy=us,Gn.xorWith=ds,Gn.zip=ls,Gn.zipObject=function(t,e){return mi(t||[],e||[],nr)},Gn.zipObjectDeep=function(t,e){return mi(t||[],e||[],ti)},Gn.zipWith=hs,Gn.entries=Ba,Gn.entriesIn=Fa,Gn.extend=Ea,Gn.extendWith=Sa,cc(Gn,Gn),Gn.add=yc,Gn.attempt=Qa,Gn.camelCase=Va,Gn.capitalize=Wa,Gn.ceil=_c,Gn.clamp=function(t,e,n){return n===i&&(n=e,e=i),n!==i&&(n=(n=ma(n))==n?n:0),e!==i&&(e=(e=ma(e))==e?e:0),cr(ma(t),e,n)},Gn.clone=function(t){return ur(t,4)},Gn.cloneDeep=function(t){return ur(t,5)},Gn.cloneDeepWith=function(t,e){return ur(t,5,e="function"==typeof e?e:i)},Gn.cloneWith=function(t,e){return ur(t,4,e="function"==typeof e?e:i)},Gn.conformsTo=function(t,e){return null==e||dr(t,e,Na(e))},Gn.deburr=qa,Gn.defaultTo=function(t,e){return null==t||t!=t?e:t},Gn.divide=bc,Gn.endsWith=function(t,e,n){t=_a(t),e=di(e);var r=t.length,o=n=n===i?r:cr(ga(n),0,r);return(n-=e.length)>=0&&t.slice(n,o)==e},Gn.eq=Gs,Gn.escape=function(t){return(t=_a(t))&&Y.test(t)?t.replace(J,sn):t},Gn.escapeRegExp=function(t){return(t=_a(t))&&ot.test(t)?t.replace(it,"\\$&"):t},Gn.every=function(t,e,n){var r=zs(t)?Pe:gr;return n&&Eo(t,e,n)&&(e=i),r(t,uo(e,3))},Gn.find=ms,Gn.findIndex=qo,Gn.findKey=function(t,e){return Ge(t,uo(e,3),Er)},Gn.findLast=ys,Gn.findLastIndex=zo,Gn.findLastKey=function(t,e){return Ge(t,uo(e,3),Sr)},Gn.floor=Ec,Gn.forEach=_s,Gn.forEachRight=bs,Gn.forIn=function(t,e){return null==t?t:_r(t,uo(e,3),xa)},Gn.forInRight=function(t,e){return null==t?t:br(t,uo(e,3),xa)},Gn.forOwn=function(t,e){return t&&Er(t,uo(e,3))},Gn.forOwnRight=function(t,e){return t&&Sr(t,uo(e,3))},Gn.get=Ra,Gn.gt=Vs,Gn.gte=Ws,Gn.has=function(t,e){return null!=t&&mo(t,e,Ar)},Gn.hasIn=Aa,Gn.head=Ho,Gn.identity=ic,Gn.includes=function(t,e,n,r){t=Hs(t)?t:Ga(t),n=n&&!r?ga(n):0;var i=t.length;return n<0&&(n=_n(i+n,0)),ca(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&We(t,e,n)>-1},Gn.indexOf=function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:ga(n);return i<0&&(i=_n(r+i,0)),We(t,e,i)},Gn.inRange=function(t,e,n){return e=fa(e),n===i?(n=e,e=0):n=fa(n),function(t,e,n){return t>=bn(e,n)&&t<_n(e,n)}(t=ma(t),e,n)},Gn.invoke=Pa,Gn.isArguments=qs,Gn.isArray=zs,Gn.isArrayBuffer=$s,Gn.isArrayLike=Hs,Gn.isArrayLikeObject=Ks,Gn.isBoolean=function(t){return!0===t||!1===t||na(t)&&Ir(t)==b},Gn.isBuffer=Js,Gn.isDate=Xs,Gn.isElement=function(t){return na(t)&&1===t.nodeType&&!oa(t)},Gn.isEmpty=function(t){if(null==t)return!0;if(Hs(t)&&(zs(t)||"string"==typeof t||"function"==typeof t.splice||Js(t)||da(t)||qs(t)))return!t.length;var e=vo(t);if(e==T||e==O)return!t.size;if(To(t))return!Lr(t).length;for(var n in t)if(jt.call(t,n))return!1;return!0},Gn.isEqual=function(t,e){return xr(t,e)},Gn.isEqualWith=function(t,e,n){var r=(n="function"==typeof n?n:i)?n(t,e):i;return r===i?xr(t,e,i,n):!!r},Gn.isError=Ys,Gn.isFinite=function(t){return"number"==typeof t&&be(t)},Gn.isFunction=Zs,Gn.isInteger=Qs,Gn.isLength=ta,Gn.isMap=ra,Gn.isMatch=function(t,e){return t===e||Dr(t,e,ho(e))},Gn.isMatchWith=function(t,e,n){return n="function"==typeof n?n:i,Dr(t,e,ho(e),n)},Gn.isNaN=function(t){return ia(t)&&t!=+t},Gn.isNative=function(t){if(wo(t))throw new wt("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Mr(t)},Gn.isNil=function(t){return null==t},Gn.isNull=function(t){return null===t},Gn.isNumber=ia,Gn.isObject=ea,Gn.isObjectLike=na,Gn.isPlainObject=oa,Gn.isRegExp=sa,Gn.isSafeInteger=function(t){return Qs(t)&&t>=-9007199254740991&&t<=f},Gn.isSet=aa,Gn.isString=ca,Gn.isSymbol=ua,Gn.isTypedArray=da,Gn.isUndefined=function(t){return t===i},Gn.isWeakMap=function(t){return na(t)&&vo(t)==x},Gn.isWeakSet=function(t){return na(t)&&"[object WeakSet]"==Ir(t)},Gn.join=function(t,e){return null==t?"":Fe.call(t,e)},Gn.kebabCase=za,Gn.last=Yo,Gn.lastIndexOf=function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=ga(n))<0?_n(r+o,0):bn(o,r-1)),e==e?function(t,e,n){for(var r=n+1;r--;)if(t[r]===e)return r;return r}(t,e,o):Ve(t,ze,o,!0)},Gn.lowerCase=$a,Gn.lowerFirst=Ha,Gn.lt=la,Gn.lte=ha,Gn.max=function(t){return t&&t.length?vr(t,ic,Rr):i},Gn.maxBy=function(t,e){return t&&t.length?vr(t,uo(e,2),Rr):i},Gn.mean=function(t){return $e(t,ic)},Gn.meanBy=function(t,e){return $e(t,uo(e,2))},Gn.min=function(t){return t&&t.length?vr(t,ic,Br):i},Gn.minBy=function(t,e){return t&&t.length?vr(t,uo(e,2),Br):i},Gn.stubArray=vc,Gn.stubFalse=mc,Gn.stubObject=function(){return{}},Gn.stubString=function(){return""},Gn.stubTrue=function(){return!0},Gn.multiply=Cc,Gn.nth=function(t,e){return t&&t.length?qr(t,ga(e)):i},Gn.noConflict=function(){return ge._===this&&(ge._=Gt),this},Gn.noop=uc,Gn.now=Rs,Gn.pad=function(t,e,n){t=_a(t);var r=(e=ga(e))?fn(t):0;if(!e||r>=e)return t;var i=(e-r)/2;return zi(ve(i),n)+t+zi(fe(i),n)},Gn.padEnd=function(t,e,n){t=_a(t);var r=(e=ga(e))?fn(t):0;return e&&r<e?t+zi(e-r,n):t},Gn.padStart=function(t,e,n){t=_a(t);var r=(e=ga(e))?fn(t):0;return e&&r<e?zi(e-r,n)+t:t},Gn.parseInt=function(t,e,n){return n||null==e?e=0:e&&(e=+e),Sn(_a(t).replace(st,""),e||0)},Gn.random=function(t,e,n){if(n&&"boolean"!=typeof n&&Eo(t,e,n)&&(e=n=i),n===i&&("boolean"==typeof e?(n=e,e=i):"boolean"==typeof t&&(n=t,t=i)),t===i&&e===i?(t=0,e=1):(t=fa(t),e===i?(e=t,t=0):e=fa(e)),t>e){var r=t;t=e,e=r}if(n||t%1||e%1){var o=Cn();return bn(t+o*(e-t+le("1e-"+((o+"").length-1))),e)}return Jr(t,e)},Gn.reduce=function(t,e,n){var r=zs(t)?Le:Je,i=arguments.length<3;return r(t,uo(e,4),n,i,pr)},Gn.reduceRight=function(t,e,n){var r=zs(t)?Ue:Je,i=arguments.length<3;return r(t,uo(e,4),n,i,fr)},Gn.repeat=function(t,e,n){return e=(n?Eo(t,e,n):e===i)?1:ga(e),Xr(_a(t),e)},Gn.replace=function(){var t=arguments,e=_a(t[0]);return t.length<3?e:e.replace(t[1],t[2])},Gn.result=function(t,e,n){var r=-1,o=(e=bi(e,t)).length;for(o||(o=1,t=i);++r<o;){var s=null==t?i:t[Uo(e[r])];s===i&&(r=o,s=n),t=Zs(s)?s.call(t):s}return t},Gn.round=wc,Gn.runInContext=t,Gn.sample=function(t){return(zs(t)?Zn:Zr)(t)},Gn.size=function(t){if(null==t)return 0;if(Hs(t))return ca(t)?fn(t):t.length;var e=vo(t);return e==T||e==O?t.size:Lr(t).length},Gn.snakeCase=Ka,Gn.some=function(t,e,n){var r=zs(t)?Be:oi;return n&&Eo(t,e,n)&&(e=i),r(t,uo(e,3))},Gn.sortedIndex=function(t,e){return si(t,e)},Gn.sortedIndexBy=function(t,e,n){return ai(t,e,uo(n,2))},Gn.sortedIndexOf=function(t,e){var n=null==t?0:t.length;if(n){var r=si(t,e);if(r<n&&Gs(t[r],e))return r}return-1},Gn.sortedLastIndex=function(t,e){return si(t,e,!0)},Gn.sortedLastIndexBy=function(t,e,n){return ai(t,e,uo(n,2),!0)},Gn.sortedLastIndexOf=function(t,e){if(null==t?0:t.length){var n=si(t,e,!0)-1;if(Gs(t[n],e))return n}return-1},Gn.startCase=Ja,Gn.startsWith=function(t,e,n){return t=_a(t),n=null==n?0:cr(ga(n),0,t.length),e=di(e),t.slice(n,n+e.length)==e},Gn.subtract=Tc,Gn.sum=function(t){return t&&t.length?Xe(t,ic):0},Gn.sumBy=function(t,e){return t&&t.length?Xe(t,uo(e,2)):0},Gn.template=function(t,e,n){var r=Gn.templateSettings;n&&Eo(t,e,n)&&(e=i),t=_a(t),e=Sa({},e,r,Qi);var o,s,a=Sa({},e.imports,r.imports,Qi),c=Na(a),u=tn(a,c),d=0,l=e.interpolate||St,h="__p += '",p=At((e.escape||St).source+"|"+l.source+"|"+(l===tt?ft:St).source+"|"+(e.evaluate||St).source+"|$","g"),f="//# sourceURL="+(jt.call(e,"sourceURL")?(e.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++ae+"]")+"\n";t.replace(p,(function(e,n,r,i,a,c){return r||(r=i),h+=t.slice(d,c).replace(Ct,an),n&&(o=!0,h+="' +\n__e("+n+") +\n'"),a&&(s=!0,h+="';\n"+a+";\n__p += '"),r&&(h+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),d=c+e.length,e})),h+="';\n";var g=jt.call(e,"variable")&&e.variable;if(g){if(ht.test(g))throw new wt("Invalid `variable` option passed into `_.template`")}else h="with (obj) {\n"+h+"\n}\n";h=(s?h.replace(z,""):h).replace($,"$1").replace(H,"$1;"),h="function("+(g||"obj")+") {\n"+(g?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(s?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+h+"return __p\n}";var v=Qa((function(){return Tt(c,f+"return "+h).apply(i,u)}));if(v.source=h,Ys(v))throw v;return v},Gn.times=function(t,e){if((t=ga(t))<1||t>f)return[];var n=v,r=bn(t,v);e=uo(e),t-=v;for(var i=Ye(r,e);++n<t;)e(n);return i},Gn.toFinite=fa,Gn.toInteger=ga,Gn.toLength=va,Gn.toLower=function(t){return _a(t).toLowerCase()},Gn.toNumber=ma,Gn.toSafeInteger=function(t){return t?cr(ga(t),-9007199254740991,f):0===t?t:0},Gn.toString=_a,Gn.toUpper=function(t){return _a(t).toUpperCase()},Gn.trim=function(t,e,n){if((t=_a(t))&&(n||e===i))return Ze(t);if(!t||!(e=di(e)))return t;var r=gn(t),o=gn(e);return Si(r,nn(r,o),rn(r,o)+1).join("")},Gn.trimEnd=function(t,e,n){if((t=_a(t))&&(n||e===i))return t.slice(0,vn(t)+1);if(!t||!(e=di(e)))return t;var r=gn(t);return Si(r,0,rn(r,gn(e))+1).join("")},Gn.trimStart=function(t,e,n){if((t=_a(t))&&(n||e===i))return t.replace(st,"");if(!t||!(e=di(e)))return t;var r=gn(t);return Si(r,nn(r,gn(e))).join("")},Gn.truncate=function(t,e){var n=30,r="...";if(ea(e)){var o="separator"in e?e.separator:o;n="length"in e?ga(e.length):n,r="omission"in e?di(e.omission):r}var s=(t=_a(t)).length;if(cn(t)){var a=gn(t);s=a.length}if(n>=s)return t;var c=n-fn(r);if(c<1)return r;var u=a?Si(a,0,c).join(""):t.slice(0,c);if(o===i)return u+r;if(a&&(c+=u.length-c),sa(o)){if(t.slice(c).search(o)){var d,l=u;for(o.global||(o=At(o.source,_a(gt.exec(o))+"g")),o.lastIndex=0;d=o.exec(l);)var h=d.index;u=u.slice(0,h===i?c:h)}}else if(t.indexOf(di(o),c)!=c){var p=u.lastIndexOf(o);p>-1&&(u=u.slice(0,p))}return u+r},Gn.unescape=function(t){return(t=_a(t))&&X.test(t)?t.replace(K,mn):t},Gn.uniqueId=function(t){var e=++Lt;return _a(t)+e},Gn.upperCase=Xa,Gn.upperFirst=Ya,Gn.each=_s,Gn.eachRight=bs,Gn.first=Ho,cc(Gn,(Sc={},Er(Gn,(function(t,e){jt.call(Gn.prototype,e)||(Sc[e]=t)})),Sc),{chain:!1}),Gn.VERSION="4.17.21",ke(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){Gn[t].placeholder=Gn})),ke(["drop","take"],(function(t,e){zn.prototype[t]=function(n){n=n===i?1:_n(ga(n),0);var r=this.__filtered__&&!e?new zn(this):this.clone();return r.__filtered__?r.__takeCount__=bn(n,r.__takeCount__):r.__views__.push({size:bn(n,v),type:t+(r.__dir__<0?"Right":"")}),r},zn.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}})),ke(["filter","map","takeWhile"],(function(t,e){var n=e+1,r=1==n||3==n;zn.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:uo(t,3),type:n}),e.__filtered__=e.__filtered__||r,e}})),ke(["head","last"],(function(t,e){var n="take"+(e?"Right":"");zn.prototype[t]=function(){return this[n](1).value()[0]}})),ke(["initial","tail"],(function(t,e){var n="drop"+(e?"":"Right");zn.prototype[t]=function(){return this.__filtered__?new zn(this):this[n](1)}})),zn.prototype.compact=function(){return this.filter(ic)},zn.prototype.find=function(t){return this.filter(t).head()},zn.prototype.findLast=function(t){return this.reverse().find(t)},zn.prototype.invokeMap=Yr((function(t,e){return"function"==typeof t?new zn(this):this.map((function(n){return Pr(n,t,e)}))})),zn.prototype.reject=function(t){return this.filter(js(uo(t)))},zn.prototype.slice=function(t,e){t=ga(t);var n=this;return n.__filtered__&&(t>0||e<0)?new zn(n):(t<0?n=n.takeRight(-t):t&&(n=n.drop(t)),e!==i&&(n=(e=ga(e))<0?n.dropRight(-e):n.take(e-t)),n)},zn.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},zn.prototype.toArray=function(){return this.take(v)},Er(zn.prototype,(function(t,e){var n=/^(?:filter|find|map|reject)|While$/.test(e),r=/^(?:head|last)$/.test(e),o=Gn[r?"take"+("last"==e?"Right":""):e],s=r||/^find/.test(e);o&&(Gn.prototype[e]=function(){var e=this.__wrapped__,a=r?[1]:arguments,c=e instanceof zn,u=a[0],d=c||zs(e),l=function(t){var e=o.apply(Gn,je([t],a));return r&&h?e[0]:e};d&&n&&"function"==typeof u&&1!=u.length&&(c=d=!1);var h=this.__chain__,p=!!this.__actions__.length,f=s&&!h,g=c&&!p;if(!s&&d){e=g?e:new zn(this);var v=t.apply(e,a);return v.__actions__.push({func:fs,args:[l],thisArg:i}),new qn(v,h)}return f&&g?t.apply(this,a):(v=this.thru(l),f?r?v.value()[0]:v.value():v)})})),ke(["pop","push","shift","sort","splice","unshift"],(function(t){var e=Pt[t],n=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",r=/^(?:pop|shift)$/.test(t);Gn.prototype[t]=function(){var t=arguments;if(r&&!this.__chain__){var i=this.value();return e.apply(zs(i)?i:[],t)}return this[n]((function(n){return e.apply(zs(n)?n:[],t)}))}})),Er(zn.prototype,(function(t,e){var n=Gn[e];if(n){var r=n.name+"";jt.call(Nn,r)||(Nn[r]=[]),Nn[r].push({name:e,func:n})}})),Nn[Gi(i,2).name]=[{name:"wrapper",func:i}],zn.prototype.clone=function(){var t=new zn(this.__wrapped__);return t.__actions__=Oi(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=Oi(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=Oi(this.__views__),t},zn.prototype.reverse=function(){if(this.__filtered__){var t=new zn(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},zn.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,n=zs(t),r=e<0,i=n?t.length:0,o=function(t,e,n){var r=-1,i=n.length;for(;++r<i;){var o=n[r],s=o.size;switch(o.type){case"drop":t+=s;break;case"dropRight":e-=s;break;case"take":e=bn(e,t+s);break;case"takeRight":t=_n(t,e-s)}}return{start:t,end:e}}(0,i,this.__views__),s=o.start,a=o.end,c=a-s,u=r?a:s-1,d=this.__iteratees__,l=d.length,h=0,p=bn(c,this.__takeCount__);if(!n||!r&&i==c&&p==c)return gi(t,this.__actions__);var f=[];t:for(;c--&&h<p;){for(var g=-1,v=t[u+=e];++g<l;){var m=d[g],y=m.iteratee,_=m.type,b=y(v);if(2==_)v=b;else if(!b){if(1==_)continue t;break t}}f[h++]=v}return f},Gn.prototype.at=gs,Gn.prototype.chain=function(){return ps(this)},Gn.prototype.commit=function(){return new qn(this.value(),this.__chain__)},Gn.prototype.next=function(){this.__values__===i&&(this.__values__=pa(this.value()));var t=this.__index__>=this.__values__.length;return{done:t,value:t?i:this.__values__[this.__index__++]}},Gn.prototype.plant=function(t){for(var e,n=this;n instanceof Wn;){var r=Fo(n);r.__index__=0,r.__values__=i,e?o.__wrapped__=r:e=r;var o=r;n=n.__wrapped__}return o.__wrapped__=t,e},Gn.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof zn){var e=t;return this.__actions__.length&&(e=new zn(this)),(e=e.reverse()).__actions__.push({func:fs,args:[es],thisArg:i}),new qn(e,this.__chain__)}return this.thru(es)},Gn.prototype.toJSON=Gn.prototype.valueOf=Gn.prototype.value=function(){return gi(this.__wrapped__,this.__actions__)},Gn.prototype.first=Gn.prototype.head,Zt&&(Gn.prototype[Zt]=function(){return this}),Gn}();ge._=yn,(r=function(){return yn}.call(e,n,e,t))===i||(t.exports=r)}.call(this)},2492:(t,e,n)=>{var r=n(2980),i=n(1463)((function(t,e,n){r(t,e,n)}));t.exports=i},5062:t=>{t.exports=function(){return!1}},9881:(t,e,n)=>{var r=n(8363),i=n(1704);t.exports=function(t){return r(t,i(t))}},8660:(t,e,n)=>{var r;!function(t){!function(e){var r="object"==typeof n.g?n.g:"object"==typeof self?self:"object"==typeof this?this:Function("return this;")(),i=o(t);function o(t,e){return function(n,r){"function"!=typeof t[n]&&Object.defineProperty(t,n,{configurable:!0,writable:!0,value:r}),e&&e(n,r)}}void 0===r.Reflect?r.Reflect=t:i=o(r.Reflect,i),function(t){var e=Object.prototype.hasOwnProperty,n="function"==typeof Symbol,r=n&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",i=n&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",o="function"==typeof Object.create,s={__proto__:[]}instanceof Array,a=!o&&!s,c={create:o?function(){return rt(Object.create(null))}:s?function(){return rt({__proto__:null})}:function(){return rt({})},has:a?function(t,n){return e.call(t,n)}:function(t,e){return e in t},get:a?function(t,n){return e.call(t,n)?t[n]:void 0}:function(t,e){return t[e]}},u=Object.getPrototypeOf(Function),d="object"==typeof process&&process.env&&"true"===process.env.REFLECT_METADATA_USE_MAP_POLYFILL,l=d||"function"!=typeof Map||"function"!=typeof Map.prototype.entries?tt():Map,h=d||"function"!=typeof Set||"function"!=typeof Set.prototype.entries?et():Set,p=new(d||"function"!=typeof WeakMap?nt():WeakMap);function f(t,e,n,r){if(M(n)){if(!q(t))throw new TypeError;if(!$(e))throw new TypeError;return w(t,e)}if(!q(t))throw new TypeError;if(!U(e))throw new TypeError;if(!U(r)&&!M(r)&&!j(r))throw new TypeError;return j(r)&&(r=void 0),T(t,e,n=W(n),r)}function g(t,e){function n(n,r){if(!U(n))throw new TypeError;if(!M(r)&&!H(r))throw new TypeError;P(t,e,n,r)}return n}function v(t,e,n,r){if(!U(n))throw new TypeError;return M(r)||(r=W(r)),P(t,e,n,r)}function m(t,e,n){if(!U(e))throw new TypeError;return M(n)||(n=W(n)),R(t,e,n)}function y(t,e,n){if(!U(e))throw new TypeError;return M(n)||(n=W(n)),A(t,e,n)}function _(t,e,n){if(!U(e))throw new TypeError;return M(n)||(n=W(n)),k(t,e,n)}function b(t,e,n){if(!U(e))throw new TypeError;return M(n)||(n=W(n)),O(t,e,n)}function E(t,e){if(!U(t))throw new TypeError;return M(e)||(e=W(e)),N(t,e)}function S(t,e){if(!U(t))throw new TypeError;return M(e)||(e=W(e)),x(t,e)}function C(t,e,n){if(!U(e))throw new TypeError;M(n)||(n=W(n));var r=I(e,n,!1);if(M(r))return!1;if(!r.delete(t))return!1;if(r.size>0)return!0;var i=p.get(e);return i.delete(n),i.size>0||p.delete(e),!0}function w(t,e){for(var n=t.length-1;n>=0;--n){var r=(0,t[n])(e);if(!M(r)&&!j(r)){if(!$(r))throw new TypeError;e=r}}return e}function T(t,e,n,r){for(var i=t.length-1;i>=0;--i){var o=(0,t[i])(e,n,r);if(!M(o)&&!j(o)){if(!U(o))throw new TypeError;r=o}}return r}function I(t,e,n){var r=p.get(t);if(M(r)){if(!n)return;r=new l,p.set(t,r)}var i=r.get(e);if(M(i)){if(!n)return;i=new l,r.set(e,i)}return i}function R(t,e,n){if(A(t,e,n))return!0;var r=Q(e);return!j(r)&&R(t,r,n)}function A(t,e,n){var r=I(e,n,!1);return!M(r)&&G(r.has(t))}function k(t,e,n){if(A(t,e,n))return O(t,e,n);var r=Q(e);return j(r)?void 0:k(t,r,n)}function O(t,e,n){var r=I(e,n,!1);if(!M(r))return r.get(t)}function P(t,e,n,r){I(n,r,!0).set(t,e)}function N(t,e){var n=x(t,e),r=Q(t);if(null===r)return n;var i=N(r,e);if(i.length<=0)return n;if(n.length<=0)return i;for(var o=new h,s=[],a=0,c=n;a<c.length;a++){var u=c[a];o.has(u)||(o.add(u),s.push(u))}for(var d=0,l=i;d<l.length;d++){u=l[d];o.has(u)||(o.add(u),s.push(u))}return s}function x(t,e){var n=[],r=I(t,e,!1);if(M(r))return n;for(var i=J(r.keys()),o=0;;){var s=Y(i);if(!s)return n.length=o,n;var a=X(s);try{n[o]=a}catch(t){try{Z(i)}finally{throw t}}o++}}function D(t){if(null===t)return 1;switch(typeof t){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===t?1:6;default:return 6}}function M(t){return void 0===t}function j(t){return null===t}function L(t){return"symbol"==typeof t}function U(t){return"object"==typeof t?null!==t:"function"==typeof t}function B(t,e){switch(D(t)){case 0:case 1:case 2:case 3:case 4:case 5:return t}var n=3===e?"string":5===e?"number":"default",i=K(t,r);if(void 0!==i){var o=i.call(t,n);if(U(o))throw new TypeError;return o}return F(t,"default"===n?"number":n)}function F(t,e){if("string"===e){var n=t.toString;if(z(n))if(!U(i=n.call(t)))return i;if(z(r=t.valueOf))if(!U(i=r.call(t)))return i}else{var r;if(z(r=t.valueOf))if(!U(i=r.call(t)))return i;var i,o=t.toString;if(z(o))if(!U(i=o.call(t)))return i}throw new TypeError}function G(t){return!!t}function V(t){return""+t}function W(t){var e=B(t,3);return L(e)?e:V(e)}function q(t){return Array.isArray?Array.isArray(t):t instanceof Object?t instanceof Array:"[object Array]"===Object.prototype.toString.call(t)}function z(t){return"function"==typeof t}function $(t){return"function"==typeof t}function H(t){switch(D(t)){case 3:case 4:return!0;default:return!1}}function K(t,e){var n=t[e];if(null!=n){if(!z(n))throw new TypeError;return n}}function J(t){var e=K(t,i);if(!z(e))throw new TypeError;var n=e.call(t);if(!U(n))throw new TypeError;return n}function X(t){return t.value}function Y(t){var e=t.next();return!e.done&&e}function Z(t){var e=t.return;e&&e.call(t)}function Q(t){var e=Object.getPrototypeOf(t);if("function"!=typeof t||t===u)return e;if(e!==u)return e;var n=t.prototype,r=n&&Object.getPrototypeOf(n);if(null==r||r===Object.prototype)return e;var i=r.constructor;return"function"!=typeof i||i===t?e:i}function tt(){var t={},e=[],n=function(){function t(t,e,n){this._index=0,this._keys=t,this._values=e,this._selector=n}return t.prototype["@@iterator"]=function(){return this},t.prototype[i]=function(){return this},t.prototype.next=function(){var t=this._index;if(t>=0&&t<this._keys.length){var n=this._selector(this._keys[t],this._values[t]);return t+1>=this._keys.length?(this._index=-1,this._keys=e,this._values=e):this._index++,{value:n,done:!1}}return{value:void 0,done:!0}},t.prototype.throw=function(t){throw this._index>=0&&(this._index=-1,this._keys=e,this._values=e),t},t.prototype.return=function(t){return this._index>=0&&(this._index=-1,this._keys=e,this._values=e),{value:t,done:!0}},t}();return function(){function e(){this._keys=[],this._values=[],this._cacheKey=t,this._cacheIndex=-2}return Object.defineProperty(e.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),e.prototype.has=function(t){return this._find(t,!1)>=0},e.prototype.get=function(t){var e=this._find(t,!1);return e>=0?this._values[e]:void 0},e.prototype.set=function(t,e){var n=this._find(t,!0);return this._values[n]=e,this},e.prototype.delete=function(e){var n=this._find(e,!1);if(n>=0){for(var r=this._keys.length,i=n+1;i<r;i++)this._keys[i-1]=this._keys[i],this._values[i-1]=this._values[i];return this._keys.length--,this._values.length--,e===this._cacheKey&&(this._cacheKey=t,this._cacheIndex=-2),!0}return!1},e.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=t,this._cacheIndex=-2},e.prototype.keys=function(){return new n(this._keys,this._values,r)},e.prototype.values=function(){return new n(this._keys,this._values,o)},e.prototype.entries=function(){return new n(this._keys,this._values,s)},e.prototype["@@iterator"]=function(){return this.entries()},e.prototype[i]=function(){return this.entries()},e.prototype._find=function(t,e){return this._cacheKey!==t&&(this._cacheIndex=this._keys.indexOf(this._cacheKey=t)),this._cacheIndex<0&&e&&(this._cacheIndex=this._keys.length,this._keys.push(t),this._values.push(void 0)),this._cacheIndex},e}();function r(t,e){return t}function o(t,e){return e}function s(t,e){return[t,e]}}function et(){return function(){function t(){this._map=new l}return Object.defineProperty(t.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),t.prototype.has=function(t){return this._map.has(t)},t.prototype.add=function(t){return this._map.set(t,t),this},t.prototype.delete=function(t){return this._map.delete(t)},t.prototype.clear=function(){this._map.clear()},t.prototype.keys=function(){return this._map.keys()},t.prototype.values=function(){return this._map.values()},t.prototype.entries=function(){return this._map.entries()},t.prototype["@@iterator"]=function(){return this.keys()},t.prototype[i]=function(){return this.keys()},t}()}function nt(){var t=16,n=c.create(),r=i();return function(){function t(){this._key=i()}return t.prototype.has=function(t){var e=o(t,!1);return void 0!==e&&c.has(e,this._key)},t.prototype.get=function(t){var e=o(t,!1);return void 0!==e?c.get(e,this._key):void 0},t.prototype.set=function(t,e){return o(t,!0)[this._key]=e,this},t.prototype.delete=function(t){var e=o(t,!1);return void 0!==e&&delete e[this._key]},t.prototype.clear=function(){this._key=i()},t}();function i(){var t;do{t="@@WeakMap@@"+u()}while(c.has(n,t));return n[t]=!0,t}function o(t,n){if(!e.call(t,r)){if(!n)return;Object.defineProperty(t,r,{value:c.create()})}return t[r]}function s(t,e){for(var n=0;n<e;++n)t[n]=255*Math.random()|0;return t}function a(t){return"function"==typeof Uint8Array?"undefined"!=typeof crypto?crypto.getRandomValues(new Uint8Array(t)):"undefined"!=typeof msCrypto?msCrypto.getRandomValues(new Uint8Array(t)):s(new Uint8Array(t),t):s(new Array(t),t)}function u(){var e=a(t);e[6]=79&e[6]|64,e[8]=191&e[8]|128;for(var n="",r=0;r<t;++r){var i=e[r];4!==r&&6!==r&&8!==r||(n+="-"),i<16&&(n+="0"),n+=i.toString(16).toLowerCase()}return n}}function rt(t){return t.__=void 0,delete t.__,t}t("decorate",f),t("metadata",g),t("defineMetadata",v),t("hasMetadata",m),t("hasOwnMetadata",y),t("getMetadata",_),t("getOwnMetadata",b),t("getMetadataKeys",E),t("getOwnMetadataKeys",S),t("deleteMetadata",C)}(i)}()}(r||(r={}))},7539:t=>{"use strict";const e={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};e.localCName=e.generateIdentifier(),e.splitLines=function(t){return t.trim().split("\n").map((t=>t.trim()))},e.splitSections=function(t){return t.split("\nm=").map(((t,e)=>(e>0?"m="+t:t).trim()+"\r\n"))},e.getDescription=function(t){const n=e.splitSections(t);return n&&n[0]},e.getMediaSections=function(t){const n=e.splitSections(t);return n.shift(),n},e.matchPrefix=function(t,n){return e.splitLines(t).filter((t=>0===t.indexOf(n)))},e.parseCandidate=function(t){let e;e=0===t.indexOf("a=candidate:")?t.substring(12).split(" "):t.substring(10).split(" ");const n={foundation:e[0],component:{1:"rtp",2:"rtcp"}[e[1]]||e[1],protocol:e[2].toLowerCase(),priority:parseInt(e[3],10),ip:e[4],address:e[4],port:parseInt(e[5],10),type:e[7]};for(let t=8;t<e.length;t+=2)switch(e[t]){case"raddr":n.relatedAddress=e[t+1];break;case"rport":n.relatedPort=parseInt(e[t+1],10);break;case"tcptype":n.tcpType=e[t+1];break;case"ufrag":n.ufrag=e[t+1],n.usernameFragment=e[t+1];break;default:void 0===n[e[t]]&&(n[e[t]]=e[t+1])}return n},e.writeCandidate=function(t){const e=[];e.push(t.foundation);const n=t.component;"rtp"===n?e.push(1):"rtcp"===n?e.push(2):e.push(n),e.push(t.protocol.toUpperCase()),e.push(t.priority),e.push(t.address||t.ip),e.push(t.port);const r=t.type;return e.push("typ"),e.push(r),"host"!==r&&t.relatedAddress&&t.relatedPort&&(e.push("raddr"),e.push(t.relatedAddress),e.push("rport"),e.push(t.relatedPort)),t.tcpType&&"tcp"===t.protocol.toLowerCase()&&(e.push("tcptype"),e.push(t.tcpType)),(t.usernameFragment||t.ufrag)&&(e.push("ufrag"),e.push(t.usernameFragment||t.ufrag)),"candidate:"+e.join(" ")},e.parseIceOptions=function(t){return t.substr(14).split(" ")},e.parseRtpMap=function(t){let e=t.substr(9).split(" ");const n={payloadType:parseInt(e.shift(),10)};return e=e[0].split("/"),n.name=e[0],n.clockRate=parseInt(e[1],10),n.channels=3===e.length?parseInt(e[2],10):1,n.numChannels=n.channels,n},e.writeRtpMap=function(t){let e=t.payloadType;void 0!==t.preferredPayloadType&&(e=t.preferredPayloadType);const n=t.channels||t.numChannels||1;return"a=rtpmap:"+e+" "+t.name+"/"+t.clockRate+(1!==n?"/"+n:"")+"\r\n"},e.parseExtmap=function(t){const e=t.substr(9).split(" ");return{id:parseInt(e[0],10),direction:e[0].indexOf("/")>0?e[0].split("/")[1]:"sendrecv",uri:e[1]}},e.writeExtmap=function(t){return"a=extmap:"+(t.id||t.preferredId)+(t.direction&&"sendrecv"!==t.direction?"/"+t.direction:"")+" "+t.uri+"\r\n"},e.parseFmtp=function(t){const e={};let n;const r=t.substr(t.indexOf(" ")+1).split(";");for(let t=0;t<r.length;t++)n=r[t].trim().split("="),e[n[0].trim()]=n[1];return e},e.writeFmtp=function(t){let e="",n=t.payloadType;if(void 0!==t.preferredPayloadType&&(n=t.preferredPayloadType),t.parameters&&Object.keys(t.parameters).length){const r=[];Object.keys(t.parameters).forEach((e=>{void 0!==t.parameters[e]?r.push(e+"="+t.parameters[e]):r.push(e)})),e+="a=fmtp:"+n+" "+r.join(";")+"\r\n"}return e},e.parseRtcpFb=function(t){const e=t.substr(t.indexOf(" ")+1).split(" ");return{type:e.shift(),parameter:e.join(" ")}},e.writeRtcpFb=function(t){let e="",n=t.payloadType;return void 0!==t.preferredPayloadType&&(n=t.preferredPayloadType),t.rtcpFeedback&&t.rtcpFeedback.length&&t.rtcpFeedback.forEach((t=>{e+="a=rtcp-fb:"+n+" "+t.type+(t.parameter&&t.parameter.length?" "+t.parameter:"")+"\r\n"})),e},e.parseSsrcMedia=function(t){const e=t.indexOf(" "),n={ssrc:parseInt(t.substr(7,e-7),10)},r=t.indexOf(":",e);return r>-1?(n.attribute=t.substr(e+1,r-e-1),n.value=t.substr(r+1)):n.attribute=t.substr(e+1),n},e.parseSsrcGroup=function(t){const e=t.substr(13).split(" ");return{semantics:e.shift(),ssrcs:e.map((t=>parseInt(t,10)))}},e.getMid=function(t){const n=e.matchPrefix(t,"a=mid:")[0];if(n)return n.substr(6)},e.parseFingerprint=function(t){const e=t.substr(14).split(" ");return{algorithm:e[0].toLowerCase(),value:e[1].toUpperCase()}},e.getDtlsParameters=function(t,n){return{role:"auto",fingerprints:e.matchPrefix(t+n,"a=fingerprint:").map(e.parseFingerprint)}},e.writeDtlsParameters=function(t,e){let n="a=setup:"+e+"\r\n";return t.fingerprints.forEach((t=>{n+="a=fingerprint:"+t.algorithm+" "+t.value+"\r\n"})),n},e.parseCryptoLine=function(t){const e=t.substr(9).split(" ");return{tag:parseInt(e[0],10),cryptoSuite:e[1],keyParams:e[2],sessionParams:e.slice(3)}},e.writeCryptoLine=function(t){return"a=crypto:"+t.tag+" "+t.cryptoSuite+" "+("object"==typeof t.keyParams?e.writeCryptoKeyParams(t.keyParams):t.keyParams)+(t.sessionParams?" "+t.sessionParams.join(" "):"")+"\r\n"},e.parseCryptoKeyParams=function(t){if(0!==t.indexOf("inline:"))return null;const e=t.substr(7).split("|");return{keyMethod:"inline",keySalt:e[0],lifeTime:e[1],mkiValue:e[2]?e[2].split(":")[0]:void 0,mkiLength:e[2]?e[2].split(":")[1]:void 0}},e.writeCryptoKeyParams=function(t){return t.keyMethod+":"+t.keySalt+(t.lifeTime?"|"+t.lifeTime:"")+(t.mkiValue&&t.mkiLength?"|"+t.mkiValue+":"+t.mkiLength:"")},e.getCryptoParameters=function(t,n){return e.matchPrefix(t+n,"a=crypto:").map(e.parseCryptoLine)},e.getIceParameters=function(t,n){const r=e.matchPrefix(t+n,"a=ice-ufrag:")[0],i=e.matchPrefix(t+n,"a=ice-pwd:")[0];return r&&i?{usernameFragment:r.substr(12),password:i.substr(10)}:null},e.writeIceParameters=function(t){let e="a=ice-ufrag:"+t.usernameFragment+"\r\na=ice-pwd:"+t.password+"\r\n";return t.iceLite&&(e+="a=ice-lite\r\n"),e},e.parseRtpParameters=function(t){const n={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},r=e.splitLines(t)[0].split(" ");for(let i=3;i<r.length;i++){const o=r[i],s=e.matchPrefix(t,"a=rtpmap:"+o+" ")[0];if(s){const r=e.parseRtpMap(s),i=e.matchPrefix(t,"a=fmtp:"+o+" ");switch(r.parameters=i.length?e.parseFmtp(i[0]):{},r.rtcpFeedback=e.matchPrefix(t,"a=rtcp-fb:"+o+" ").map(e.parseRtcpFb),n.codecs.push(r),r.name.toUpperCase()){case"RED":case"ULPFEC":n.fecMechanisms.push(r.name.toUpperCase())}}}return e.matchPrefix(t,"a=extmap:").forEach((t=>{n.headerExtensions.push(e.parseExtmap(t))})),n},e.writeRtpDescription=function(t,n){let r="";r+="m="+t+" ",r+=n.codecs.length>0?"9":"0",r+=" UDP/TLS/RTP/SAVPF ",r+=n.codecs.map((t=>void 0!==t.preferredPayloadType?t.preferredPayloadType:t.payloadType)).join(" ")+"\r\n",r+="c=IN IP4 0.0.0.0\r\n",r+="a=rtcp:9 IN IP4 0.0.0.0\r\n",n.codecs.forEach((t=>{r+=e.writeRtpMap(t),r+=e.writeFmtp(t),r+=e.writeRtcpFb(t)}));let i=0;return n.codecs.forEach((t=>{t.maxptime>i&&(i=t.maxptime)})),i>0&&(r+="a=maxptime:"+i+"\r\n"),n.headerExtensions&&n.headerExtensions.forEach((t=>{r+=e.writeExtmap(t)})),r},e.parseRtpEncodingParameters=function(t){const n=[],r=e.parseRtpParameters(t),i=-1!==r.fecMechanisms.indexOf("RED"),o=-1!==r.fecMechanisms.indexOf("ULPFEC"),s=e.matchPrefix(t,"a=ssrc:").map((t=>e.parseSsrcMedia(t))).filter((t=>"cname"===t.attribute)),a=s.length>0&&s[0].ssrc;let c;const u=e.matchPrefix(t,"a=ssrc-group:FID").map((t=>t.substr(17).split(" ").map((t=>parseInt(t,10)))));u.length>0&&u[0].length>1&&u[0][0]===a&&(c=u[0][1]),r.codecs.forEach((t=>{if("RTX"===t.name.toUpperCase()&&t.parameters.apt){let e={ssrc:a,codecPayloadType:parseInt(t.parameters.apt,10)};a&&c&&(e.rtx={ssrc:c}),n.push(e),i&&(e=JSON.parse(JSON.stringify(e)),e.fec={ssrc:a,mechanism:o?"red+ulpfec":"red"},n.push(e))}})),0===n.length&&a&&n.push({ssrc:a});let d=e.matchPrefix(t,"b=");return d.length&&(d=0===d[0].indexOf("b=TIAS:")?parseInt(d[0].substr(7),10):0===d[0].indexOf("b=AS:")?1e3*parseInt(d[0].substr(5),10)*.95-16e3:void 0,n.forEach((t=>{t.maxBitrate=d}))),n},e.parseRtcpParameters=function(t){const n={},r=e.matchPrefix(t,"a=ssrc:").map((t=>e.parseSsrcMedia(t))).filter((t=>"cname"===t.attribute))[0];r&&(n.cname=r.value,n.ssrc=r.ssrc);const i=e.matchPrefix(t,"a=rtcp-rsize");n.reducedSize=i.length>0,n.compound=0===i.length;const o=e.matchPrefix(t,"a=rtcp-mux");return n.mux=o.length>0,n},e.writeRtcpParameters=function(t){let e="";return t.reducedSize&&(e+="a=rtcp-rsize\r\n"),t.mux&&(e+="a=rtcp-mux\r\n"),void 0!==t.ssrc&&t.cname&&(e+="a=ssrc:"+t.ssrc+" cname:"+t.cname+"\r\n"),e},e.parseMsid=function(t){let n;const r=e.matchPrefix(t,"a=msid:");if(1===r.length)return n=r[0].substr(7).split(" "),{stream:n[0],track:n[1]};const i=e.matchPrefix(t,"a=ssrc:").map((t=>e.parseSsrcMedia(t))).filter((t=>"msid"===t.attribute));return i.length>0?(n=i[0].value.split(" "),{stream:n[0],track:n[1]}):void 0},e.parseSctpDescription=function(t){const n=e.parseMLine(t),r=e.matchPrefix(t,"a=max-message-size:");let i;r.length>0&&(i=parseInt(r[0].substr(19),10)),isNaN(i)&&(i=65536);const o=e.matchPrefix(t,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substr(12),10),protocol:n.fmt,maxMessageSize:i};const s=e.matchPrefix(t,"a=sctpmap:");if(s.length>0){const t=s[0].substr(10).split(" ");return{port:parseInt(t[0],10),protocol:t[1],maxMessageSize:i}}},e.writeSctpDescription=function(t,e){let n=[];return n="DTLS/SCTP"!==t.protocol?["m="+t.kind+" 9 "+t.protocol+" "+e.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+e.port+"\r\n"]:["m="+t.kind+" 9 "+t.protocol+" "+e.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+e.port+" "+e.protocol+" 65535\r\n"],void 0!==e.maxMessageSize&&n.push("a=max-message-size:"+e.maxMessageSize+"\r\n"),n.join("")},e.generateSessionId=function(){return Math.random().toString().substr(2,21)},e.writeSessionBoilerplate=function(t,n,r){let i;const o=void 0!==n?n:2;i=t||e.generateSessionId();return"v=0\r\no="+(r||"thisisadapterortc")+" "+i+" "+o+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},e.getDirection=function(t,n){const r=e.splitLines(t);for(let t=0;t<r.length;t++)switch(r[t]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return r[t].substr(2)}return n?e.getDirection(n):"sendrecv"},e.getKind=function(t){return e.splitLines(t)[0].split(" ")[0].substr(2)},e.isRejected=function(t){return"0"===t.split(" ",2)[1]},e.parseMLine=function(t){const n=e.splitLines(t)[0].substr(2).split(" ");return{kind:n[0],port:parseInt(n[1],10),protocol:n[2],fmt:n.slice(3).join(" ")}},e.parseOLine=function(t){const n=e.matchPrefix(t,"o=")[0].substr(2).split(" ");return{username:n[0],sessionId:n[1],sessionVersion:parseInt(n[2],10),netType:n[3],addressType:n[4],address:n[5]}},e.isValidSDP=function(t){if("string"!=typeof t||0===t.length)return!1;const n=e.splitLines(t);for(let t=0;t<n.length;t++)if(n[t].length<2||"="!==n[t].charAt(1))return!1;return!0},t.exports=e},477:t=>{"use strict";t.exports=function(t,e,n,r){var i=self||window;try{try{var o;try{o=new i.Blob([t])}catch(e){(o=new(i.BlobBuilder||i.WebKitBlobBuilder||i.MozBlobBuilder||i.MSBlobBuilder)).append(t),o=o.getBlob()}var s=i.URL||i.webkitURL,a=s.createObjectURL(o),c=new i[e](a,n);return s.revokeObjectURL(a),c}catch(r){return new i[e]("data:application/javascript,".concat(encodeURIComponent(t)),n)}}catch(t){if(!r)throw Error("Inline worker is not supported");return new i[e](r,n)}}}},e={};function n(r){var i=e[r];if(void 0!==i)return i.exports;var o=e[r]={id:r,loaded:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.nmd=t=>(t.paths=[],t.children||(t.children=[]),t);var r={};return(()=>{"use strict";n.r(r),n.d(r,{BASIC_FULL_HD_LANDSCAPE:()=>ie,BASIC_FULL_HD_PORTRAIT:()=>oe,BASIC_LANDSCAPE:()=>ne,BASIC_PORTRAIT:()=>re,BroadcastClientError:()=>BroadcastClientError,BroadcastClientEvents:()=>In,BroadcastStageConnectionEvents:()=>pn,ConnectionState:()=>kn,DEFAULT_STAGE_LANDSCAPE:()=>Ue,DEFAULT_STAGE_PORTRAIT:()=>Be,Errors:()=>t,LOG_LEVEL:()=>ct,LogLevels:()=>ct,STANDARD_LANDSCAPE:()=>se,STANDARD_PORTRAIT:()=>ae,__version:()=>vs,create:()=>gs,createStageClient:()=>ms,default:()=>bs,isSupported:()=>fs,stagesSendJoinEvent:()=>ys,stagesSendLeaveEvent:()=>_s});var t={};n.r(t),n.d(t,{ADD_DEVICE_COMPOSITION_INDEX_MISSING_ERROR:()=>vt,ADD_DEVICE_COMPOSITION_MISSING_ERROR:()=>gt,ADD_DEVICE_DEVICE_ERROR:()=>pt,ADD_DEVICE_NAME_EXISTS_ERROR:()=>ft,ADD_DEVICE_NAME_MISSING_ERROR:()=>mt,ADD_DEVICE_UNSUPPORTED:()=>yt,BROADCAST_CONFIGURATION_ERROR:()=>kt,BROADCAST_ERROR:()=>dt,CAMERA_ERROR:()=>lt,CLIENT_INVALID_ERROR:()=>Mt,EXCHANGE_POSITION_DEVICE_NOT_FOUND_ERROR:()=>wt,FAILED_TO_ADD_IMAGE_ERROR:()=>Tt,INGEST_ENDPOINT_TYPE_ERROR:()=>Pt,INGEST_ENDPOINT_URL_ERROR:()=>Nt,INPUT_ERROR:()=>ht,INVALID_STREAM_KEY:()=>At,LOGGER_TYPE_ERROR:()=>Dt,LOG_LEVEL_TYPE_ERROR:()=>xt,NETWORK_RECONNECT_CONFIGURATION_ERROR:()=>jt,NETWORK_RECONNECT_CONFIGURATION_INVALID_TIMEOUT_ERROR:()=>Lt,PEER_CONNECTION_ERROR:()=>Rt,PEER_SETUP_ERROR:()=>It,REMOVE_DEVICE_NOT_FOUND_ERROR:()=>_t,REMOVE_IMAGE_NOT_FOUND_ERROR:()=>bt,STAGE_TOKEN_TYPE_ERROR:()=>Bt,STAGE_WHIP_OVERRIDE_ERROR:()=>Ft,STREAM_CONFIGURATION_ERROR:()=>Ot,STREAM_KEY_INVALID_CHAR_ERROR:()=>Ut,UPDATE_VIDEO_DEVICE_COMPOSITION_INDEX_MISSING_ERROR:()=>St,UPDATE_VIDEO_DEVICE_COMPOSITION_MISSING_ERROR:()=>Et,UPDATE_VIDEO_DEVICE_COMPOSITION_NAME_NOT_FOUND_ERROR:()=>Ct});var e={};n.r(e),n.d(e,{fixNegotiationNeeded:()=>Fr,shimAddTrackRemoveTrack:()=>Ur,shimAddTrackRemoveTrackWithNative:()=>Lr,shimGetDisplayMedia:()=>Pr,shimGetSendersWithDtmf:()=>Dr,shimGetStats:()=>Mr,shimGetUserMedia:()=>Or,shimMediaStream:()=>Nr,shimOnTrack:()=>xr,shimPeerConnection:()=>Br,shimSenderReceiverGetStats:()=>jr});var i={};n.r(i),n.d(i,{shimAddTransceiver:()=>Jr,shimCreateAnswer:()=>Zr,shimCreateOffer:()=>Yr,shimGetDisplayMedia:()=>Vr,shimGetParameters:()=>Xr,shimGetUserMedia:()=>Gr,shimOnTrack:()=>Wr,shimPeerConnection:()=>qr,shimRTCDataChannel:()=>Kr,shimReceiverGetStats:()=>$r,shimRemoveStream:()=>Hr,shimSenderGetStats:()=>zr});var o={};n.r(o),n.d(o,{shimAudioContext:()=>ai,shimCallbacksAPI:()=>ei,shimConstraints:()=>ri,shimCreateOfferLegacy:()=>si,shimGetUserMedia:()=>ni,shimLocalStreamsAPI:()=>Qr,shimRTCIceServerUrls:()=>ii,shimRemoteStreamsAPI:()=>ti,shimTrackEventTransceiver:()=>oi});var s={};n.r(s),n.d(s,{removeExtmapAllowMixed:()=>gi,shimAddIceCandidateNullOrEmpty:()=>vi,shimConnectionState:()=>fi,shimMaxMessageSize:()=>hi,shimParameterlessSetLocalDescription:()=>mi,shimRTCIceCandidate:()=>di,shimRTCIceCandidateRelayProtocol:()=>li,shimSendThrowTypeError:()=>pi});var a={};n.r(a),n.d(a,{BASIC_FULL_HD_LANDSCAPE:()=>ie,BASIC_FULL_HD_PORTRAIT:()=>oe,BASIC_LANDSCAPE:()=>ne,BASIC_PORTRAIT:()=>re,BroadcastClientError:()=>BroadcastClientError,BroadcastClientEvents:()=>In,ConnectionState:()=>kn,Errors:()=>t,LOG_LEVEL:()=>ct,LogLevels:()=>ct,STANDARD_LANDSCAPE:()=>se,STANDARD_PORTRAIT:()=>ae,__version:()=>vs,create:()=>gs,isSupported:()=>fs});n(8660);var c,u=n(6729),d=n.n(u),l=n(1206);function h(t){const e="0123456789abcdef";let n="";for(let r=0;r<t;r+=1)n+=e.charAt(Math.floor(Math.random()*e.length));return n}class RequestUUID{constructor(){const t=h;this.value=`${t(8)}-${t(4)}-${t(4)}-${t(4)}-${t(12)}`}}function p(){return new RequestUUID}class TraceId{constructor(){const t=(Date.now()/1e3|0).toString(16);this.value=`1-${t}-${h(24)}`}}function f(){return new TraceId}let g,v;function m(t){return g!==t.stageARN&&(g=t.stageARN,v=void 0),v||(v=h(32)),v}!function(t){t.PUBLISHED_VIDEO_STATS="ivs_broadcast_webrtc_published_video_stats",t.PUBLISHED_AUDIO_STATS="ivs_broadcast_webrtc_published_audio_stats",t.SUBSCRIBED_VIDEO_STATS="ivs_broadcast_webrtc_subscribed_video_stats",t.SUBSCRIBED_AUDIO_STATS="ivs_broadcast_webrtc_subscribed_audio_stats",t.PUBLISH="ivs_broadcast_multihost_publish",t.UNPUBLISH="ivs_broadcast_multihost_unpublish",t.SUBSCRIBE="ivs_broadcast_multihost_subscribe",t.UNSUBSCRIBE="ivs_broadcast_multihost_unsubscribe",t.PUBLISH_STARTED="ivs_broadcast_multihost_publish_started",t.PUBLISH_ENDED="ivs_broadcast_multihost_publish_ended",t.STATE_UPDATED="ivs_broadcast_multihost_event_state_updated",t.SUBSCRIBE_STARTED="ivs_broadcast_multihost_subscribe_started",t.SUBSCRIBE_ENDED="ivs_broadcast_multihost_subscribe_ended",t.JOIN="ivs_broadcast_multihost_join",t.LEAVE="ivs_broadcast_multihost_leave",t.SERVER_REQUEST="ivs_broadcast_multihost_server_request",t.TRACE="ivs_broadcast_stage_trace",t.ERROR="ivs_broadcast_error",t.MINUTE="ivs_broadcast_multihost_minute",t.CONNECTION_STATE="ivs_broadcast_webrtc_connection_state",t.ICE_GATHERING_STATE="ivs_broadcast_webrtc_gathering_state",t.EDP_CONNECTED="ivs_broadcast_multihost_event_connected",t.EDP_DISCONNECTED="ivs_broadcast_multihost_event_disconnected"}(c||(c={}));class StageAnalyticsEvent{constructor(t,e,n,r){let i="unknown";if(e.stageARN&&e.stageARN.startsWith("arn:aws:ivs:")){const t=e.stageARN.split(":");6===t.length&&(i=t[4])}this.event=t,this.properties={client_time:(new Date).toISOString(),customer_id:i,device_software:window.navigator.userAgent,multihost_id:e.stageARN,participant_id:e.participantID,participant_user_id:e.userID,platform:"web",sdk_version:"1.3.0",session_id:m(e),stage_arn:e.stageARN,trace_id:n.value},e.attrGsRole&&(this.properties.token_attribute_0=e.attrGsRole),e.attrGsSessionId&&(this.properties.token_attribute_1=e.attrGsSessionId),this.critical=r}}class StageErrorEvent extends StageAnalyticsEvent{constructor(t){super(c.ERROR,t.token,t.traceId,!0),Object.assign(this.properties,{code:t.code,tag:t.tag,description:t.message,remote_participant_id:t.remoteParticipantId,request_uuid:t.requestUUID})}}var y=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))};const _=4;class SpadeClient{constructor(t="https://broadcast.stats.live-video.net/"){this.spadeUrl=t}send(t,e=!1){return y(this,void 0,void 0,(function*(){const n=Date.now();for(const e of t)e.properties.batch_time_millis=n;const r={"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},i=`data=${this.b64EncodeUnicode(JSON.stringify(t))}`;e?navigator.sendBeacon(this.spadeUrl,i):function(t,e,n={},r=""){y(this,void 0,void 0,(function*(){const i=new XMLHttpRequest;return i.open(t,e,!0),n&&Object.keys(n).forEach((t=>{n.hasOwnProperty(t)&&i.setRequestHeader(t,n[t])})),new Promise(((n,o)=>{i.onreadystatechange=()=>{i.readyState===_&&(i.status>=200&&i.status<300?n(i.responseText):o(new Error(`Spade ${t} ${e} responded ${i.status}\n${i.responseText}`)))},i.send(r)}))}))}("POST",this.spadeUrl,r,i)}))}b64EncodeUnicode(t){return btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,e)=>String.fromCharCode(Number(`0x${e}`)))))}}function b(t){if(!t)throw new Error("SpadeClient is not defined")}class AnalyticsTracker{constructor(t){this.sharedProperties={},this.spadeClient={},this.queuedEvents=[],this.init({spadeUrl:t})}static getInstance(t){return AnalyticsTracker.instance||(AnalyticsTracker.instance=new AnalyticsTracker(null!=t?t:"https://broadcast.stats.live-video.net/")),AnalyticsTracker.instance}start(){this.sessionId=this.newGuid(),this.sharedProperties.session_id=this.sessionId,this.flushInterval||(this.flushInterval=window.setInterval((()=>{this.flushEvents()}),1e3))}stop(){clearInterval(this.flushInterval),this.flushInterval=void 0,this.queuedEvents=this.queuedEvents.filter((t=>t.critical)),this.flushEvents(!0)}trackEvent(t){t.data.properties=Object.assign({},this.sharedProperties,t.data.properties),this.queuedEvents.push(t.data)}trackEventNoSharedProps(t){this.queuedEvents.push(t)}trackErrorAndThrow(t){throw this.trackError(t),t}trackError(t){AnalyticsTracker.getInstance().trackEventNoSharedProps(new StageErrorEvent(t))}batchEvents(t){b(this.spadeClient);const e=t.map((t=>(t.data.properties=Object.assign({},this.sharedProperties,t.data.properties),t.data)));this.spadeClient.send(e)}init({spadeUrl:t}){this.spadeClient=new SpadeClient(t);const e=l.getParser(navigator.userAgent),n=this.parseSemver(String(e.getBrowserVersion()));this.sharedProperties={browser:navigator.appVersion,browser_family:e.getBrowserName().toLowerCase(),browser_version:`${n.major}.${n.minor}`,customer_id:"ivs",os_name:e.getOSName(),os_version:String(e.getOSVersion()),platform:"web",session_id:this.sessionId,sdk_version:"1.3.0",user_agent:navigator.userAgent}}newGuid(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(t=>{const e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)}))}flushEvents(t=!1){b(this.spadeClient),this.queuedEvents.length>0&&this.spadeClient.send(this.queuedEvents,t),this.queuedEvents=[]}parseSemver(t){const e=/^(\d+)\.(\d+)\.(\d+)[+|-]?(.*)?$/.exec(t)||/^(\d+)\.(\d+)[+|-]?(.*)?$/.exec(t)||/^(\d+)$/.exec(t)||[];return{major:parseInt(e[1],10)||0,minor:parseInt(e[2],10)||0,patch:parseInt(e[3],10)||0}}}var E="Cannot apply @injectable decorator multiple times.",S="Metadata key was used more than once in a parameter:",C="NULL argument",w="Key Not Found",T="Ambiguous match found for serviceIdentifier:",I="No matching bindings found for serviceIdentifier:",R="Missing required @injectable annotation in:",A="Missing required @inject or @multiInject annotation in:",k=function(t){return"@inject called with undefined this could mean that the class "+t+" has a circular dependency problem. You can use a LazyServiceIdentifer to overcome this limitation."},O="Circular dependency found:",P="The @inject @multiInject @tagged and @named decorators must be applied to the parameters of a class constructor or a class property.",N=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return"The number of constructor arguments in the derived class "+t[0]+" must be >= than the number of constructor arguments of its base class."},x=function(t,e){return"@postConstruct error in class "+t+": "+e},D=function(t,e){return"@preDestroy error in class "+t+": "+e},M=function(t,e){return"onDeactivation() error in class "+t+": "+e},j="Maximum call stack size exceeded",L="named",U="name",B="unmanaged",F="optional",G="inject",V="multi_inject",W="inversify:tagged",q="inversify:tagged_props",z="inversify:paramtypes",$="design:paramtypes",H="post_construct",K="pre_destroy";var J=[G,V,U,B,L,F];function X(){return function(t){if(Reflect.hasOwnMetadata(z,t))throw new Error(E);var e=Reflect.getMetadata($,t)||[];return Reflect.defineMetadata(z,e,t),t}}var Y=function(){function t(t,e){this.key=t,this.value=e}return t.prototype.toString=function(){return this.key===L?"named: "+String(this.value).toString()+" ":"tagged: { key:"+this.key.toString()+", value: "+String(this.value)+" }"},t}();function Z(t,e,n,r){!function(t){if(void 0!==t)throw new Error(P)}(e),tt(W,t,n.toString(),r)}function Q(t){var e=[];if(Array.isArray(t)){var n=function(t){for(var e=new Set,n=0,r=t;n<r.length;n++){var i=r[n];if(e.has(i))return i;e.add(i)}}((e=t).map((function(t){return t.key})));if(void 0!==n)throw new Error(S+" "+n.toString())}else e=[t];return e}function tt(t,e,n,r){var i=Q(r),o={};Reflect.hasOwnMetadata(t,e)&&(o=Reflect.getMetadata(t,e));var s=o[n];if(void 0===s)s=[];else for(var a=function(t){if(i.some((function(e){return e.key===t.key})))throw new Error(S+" "+t.key.toString())},c=0,u=s;c<u.length;c++){a(u[c])}s.push.apply(s,i),o[n]=s,Reflect.defineMetadata(t,o,e)}function et(t){return function(e,n,r){"number"==typeof r?Z(e,n,r,t):function(t,e,n){if(void 0!==t.prototype)throw new Error(P);tt(q,t.constructor,e,n)}(e,n,t)}}var nt,rt=(nt=G,function(t){return function(e,n,r){if(void 0===t){var i="function"==typeof e?e.name:e.constructor.name;throw new Error(k(i))}return et(new Y(nt,t))(e,n,r)}});const it={SPADE_URL:Symbol.for("spade_url"),EMITTER:Symbol.for("emitter"),WORKER:Symbol.for("worker"),I_MEDIA_STREAM_MANAGER:Symbol.for("media_stream_manager_interface"),CONFIG:Symbol.for("config"),PEER_CLIENT:Symbol.for("peer_client"),ANALYTICS_TRACKER:Symbol.for("analytics_tracker"),PEER_STATS_TRACKER:Symbol.for("peer_stats_tracker"),LOGGER:Symbol.for("logger")},ot=1007,st=12e4,at=3e5;class BroadcastClientError extends Error{constructor({name:t,message:e,code:n,details:r,cause:i,params:o}){super(e),Error.captureStackTrace&&Error.captureStackTrace(this,BroadcastClientError),this.name=t||"BroadcastClientError",this.message=e,this.code=n,this.details=r,this.cause=i,this.params=o}}var ct,ut;!function(t){t[t.TRACE=0]="TRACE",t[t.DEBUG=1]="DEBUG",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"}(ct||(ct={})),function(t){t.SPADE="SPADE",t.TIME="Time",t.WEBRTC="WebRTC",t.EMITTER="Emitter",t.MEDIA="Media",t.SUBSCRIPTION="StageSubscription",t.PUBLICATION="StagePublication",t.CONNECTION="StageConnection",t.SOCKET="StageSocket",t.BROADCAST_STAGE_CLIENT="BroadcastStageClient",t.STAGE="Stage",t.REMOTE_PARTICIPANT="RemoteParticipant",t.LOCAL_PARTICIPANT="LocalParticipant"}(ut||(ut={}));const dt={name:"BroadcastError",code:1e3,message:"Unable to broadcast"},lt={name:"CameraError",code:2e3,message:"Camera could not be captured"},ht={name:"InputError",code:3e3,message:"Input could not be attached"},pt={name:"AddDeviceError",code:4e3,message:"Device is missing"},ft={name:"AddDeviceNameExistsError",code:4001,message:"Name is already registered"},gt={name:"AddDeviceCompositionMissingError",code:4002,message:"VideoComposition is missing"},vt={name:"AddDeviceCompositionIndexMissingError",code:4003,message:'VideoComposition\'s "index" property is missing'},mt={name:"AddDeviceNameMissingError",code:4004,message:"Name property is missing"},yt={name:"AddDeviceUnsupported",code:4005,message:"Unsupported device"},_t={name:"RemoveDeviceNotFoundError",code:5e3,message:"Device not found"},bt={name:"RemoveImageNotFoundError",code:6e3,message:"Image not found"},Et={name:"UpdateVideoDeviceCompositionMissingError",code:7e3,message:"VideoComposition is missing"},St={name:"UpdateVideoDeviceCompositionIndexMissingError",code:7001,message:'VideoComposition\'s "index" property is missing'},Ct={name:"UpdateVideoDeviceCompositionNameMissingError",code:7002,message:"Video device with that name is not found"},wt={name:"ExchangePositionDeviceNotFoundError",code:8e3,message:"Device with that name is not found"},Tt={name:"FailedToAddImageError",code:9e3,message:"Failed to add image"},It={name:"PeerSetupError",code:1e4,message:"Unexpected return value from setup request"},Rt={name:"PeerConnectionError",code:10001,message:"Peer connection has failed."},At={name:"InvalidStreamKey",code:10003,message:"Invalid Stream Key."},kt={name:"BroadcastConfigurationError",code:11e3,message:"Error when configuring broadcast client"},Ot={name:"StreamConfigurationError",code:12e3,message:"Error when configuring stream"},Pt={name:"IngestEndpointTypeError",code:13e3,message:"Ingest endpoint must be a string"},Nt={name:"IngestEndpointUrlError",code:13001,message:"Ingest endpoint must be a valid https or rtmps URL"},xt={name:"LogLevelTypeError",code:14e3,message:"Log Level must be a valid integer between [0..5]"},Dt={name:"LoggerTypeError",code:15e3,message:"Logger must be an object"},Mt={name:"ClientInvalidError",code:16e3,message:"Client is no longer valid, possibly due to delete() invocation."},jt={name:"NetworkReconnectConfigurationError",code:17e3,message:"Error when configuring network reconnect"},Lt={name:"NetworkReconnectConfigurationInvalidTimeoutError",code:17001,message:"Network reconnect timeout value must be a number between [10000, 300000]"},Ut={name:"StreamKeyInvalidCharError",code:18e3,message:"Streamkey must contain only [A-Za-z0-9_-] characters"},Bt={name:"StageTokenTypeError",code:19e3,message:"Stage token must be a string"},Ft={name:"StageWhipUrlOverrideError",code:19001,message:"Stage WHIP override URL must be a string starting with http"};var Gt,Vt,Wt,qt,zt,$t,Ht,Kt,Jt,Xt=function(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)},Yt=function(t,e,n,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(t,n):i?i.value=n:e.set(t,n),n};const Zt=1920,Qt=1080,te="missing stream configuration",ee=ct.ERROR,ne={maxResolution:{width:852,height:480},maxFramerate:30,maxBitrate:1500},re={maxResolution:{width:480,height:852},maxFramerate:30,maxBitrate:1500},ie={maxResolution:{width:1920,height:1080},maxFramerate:30,maxBitrate:3500},oe={maxResolution:{width:1080,height:1920},maxFramerate:30,maxBitrate:3500},se={maxResolution:{width:1920,height:1080},maxFramerate:30,maxBitrate:8500},ae={maxResolution:{width:1080,height:1920},maxFramerate:30,maxBitrate:8500},ce={reconnect:!1,timeout:st};function ue(t){var e,n;if("string"!=typeof t&&void 0!==t)throw new BroadcastClientError(Pt);if(t){if(t.startsWith("https"))return t;{const r=/(?<protocol>(rtmps|https):\/\/)?(?<id>.+)\.(?<environment>(?=\S*['-])([a-zA-Z'-]+))\.live-video\.net.*/.exec(t);if("rtmps"===(null===(e=null==r?void 0:r.groups)||void 0===e?void 0:e.protocol)&&console.warn("rtmps server url detected; please pass in the ingest endpoint (no rtmps:// protocol) instead"),null===(n=null==r?void 0:r.groups)||void 0===n?void 0:n.id)return`https://${r.groups.id}.webrtc.live-video.net:4443`;throw new BroadcastClientError(Nt)}}return""}class Config{constructor(t,e,n=ne,r,i=ce){this.LOG_LEVEL=ct,this.BASIC_LANDSCAPE=ne,this.BASIC_PORTRAIT=re,this.BASIC_FULL_HD_LANDSCAPE=ie,this.BASIC_FULL_HD_PORTRAIT=oe,this.STANDARD_LANDSCAPE=se,this.STANDARD_PORTRAIT=ae,Gt.set(this,void 0),Vt.set(this,void 0),Wt.set(this,ne),qt.set(this,void 0),zt.set(this,ce),$t.set(this,(t=>{if(!t)throw new BroadcastClientError(Object.assign(Object.assign({},Ot),{details:te}));if(!(t.maxBitrate<=8500&&t.maxBitrate>=200))throw new BroadcastClientError(Object.assign(Object.assign({},Ot),{details:"maxBitrate must be between 200 and 8500"}));if(!(t.maxFramerate<=60&&t.maxFramerate>=10))throw new BroadcastClientError(Object.assign(Object.assign({},Ot),{details:"maxFramerate must be between 10 and 60"}));const e=t.maxResolution.width,n=t.maxResolution.height;if(e>Zt||n>Zt||e<160||n<160||(e===Zt&&n>Qt||n===Zt&&e>Qt))throw new BroadcastClientError(Object.assign(Object.assign({},Ot),{details:"maxResolution values must be between 1080x1920 or 1920x1080"}))})),Ht.set(this,(t=>{if(!t)return;const e=Number(t),n=Number.isInteger(e),r=e>=ct.TRACE,i=e<=ct.SILENT;if(!n||!r||!i)throw new BroadcastClientError(xt)})),Kt.set(this,(t=>{if(t&&"object"!=typeof t)throw new BroadcastClientError(Dt)})),Jt.set(this,(t=>{if(!t)return;if("object"!=typeof t||"boolean"!=typeof t.reconnect)throw new BroadcastClientError(jt);const{timeout:e}=t;if(void 0!==e&&(Number.isNaN(e)||"number"!=typeof e||e<1e4||e>at))throw new BroadcastClientError(Lt)})),Xt(this,Kt,"f").call(this,r),Xt(this,Ht,"f").call(this,e),Xt(this,$t,"f").call(this,n),Yt(this,Gt,t,"f"),Yt(this,Vt,e,"f"),Yt(this,Wt,n,"f"),Yt(this,qt,r,"f"),Yt(this,zt,i,"f")}get ingestEndpoint(){return Xt(this,Gt,"f")}set ingestEndpoint(t){Yt(this,Gt,ue(t),"f")}get streamConfig(){return Xt(this,Wt,"f")}set streamConfig(t){Xt(this,$t,"f").call(this,t),Yt(this,Wt,t,"f")}get logLevel(){return Xt(this,Vt,"f")}set logLevel(t){Xt(this,Ht,"f").call(this,t),Yt(this,Vt,t,"f")}get logger(){return Xt(this,qt,"f")}set logger(t){Xt(this,Kt,"f").call(this,t),Yt(this,qt,t,"f")}get networkReconnectConfig(){return Xt(this,zt,"f")}set networkReconnectConfig(t){Xt(this,Jt,"f").call(this,t),Yt(this,zt,t,"f")}}Gt=new WeakMap,Vt=new WeakMap,Wt=new WeakMap,qt=new WeakMap,zt=new WeakMap,$t=new WeakMap,Ht=new WeakMap,Kt=new WeakMap,Jt=new WeakMap;const de={[ct.INFO]:"#528bff",[ct.WARN]:"#ffb31a",[ct.DEBUG]:"#00f593",[ct.ERROR]:"#ff4f4d",[ct.TRACE]:"",[ct.SILENT]:"",[ut.SPADE]:"#a970ff",[ut.TIME]:"#53535f",[ut.WEBRTC]:"#0e9bd8",[ut.SUBSCRIPTION]:"#ffc400",[ut.CONNECTION]:"#ff5edb",[ut.SOCKET]:"#8585ff",[ut.EMITTER]:"#adadb8",[ut.LOCAL_PARTICIPANT]:"#1DD21D",[ut.STAGE]:"#EC9806",[ut.REMOTE_PARTICIPANT]:"#0680EC",details:"#808080"},le=({label:t})=>`background: ${de[t]||"#333333"}; color: white; padding: 3px; margin-left: 3px;`,he=Object.entries(ct),pe=(t,e,n)=>{const r=le({label:t}),[i]=he.find((([,e])=>e===Number(t)))||[],o=`%c${i}`,s=le({label:e}),a=`%c${e}`,c=le({label:ut.TIME}),u=`%c[${(new Date).toISOString()}]`,d=le({label:"details"}),l=`%c[${n}]`,h=[u,o,a],p=[c,r,s];return n&&(h.push(l),p.push(d)),[h.join(""),...p]},fe={debug(t){console.groupCollapsed(...pe(ct.DEBUG,t.scope,t.label)),console.debug(t.msg,Object.assign(Object.assign({},t),{level:"debug"})),console.groupEnd()},info(t){console.groupCollapsed(...pe(ct.INFO,t.scope,t.label)),console.info(t.msg,Object.assign(Object.assign({},t),{level:"info"})),console.groupEnd()},warn(t){console.groupCollapsed(...pe(ct.WARN,t.scope,t.label)),console.warn(t.msg,Object.assign(Object.assign({},t),{level:"warn"})),console.groupEnd()},error(t){console.error(t)}};var ge,ve=function(t,e,n,r){var i,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(s=(o<3?i(s):o>3?i(e,n,s):i(e,n))||s);return o>3&&s&&Object.defineProperty(e,n,s),s},me=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ye=function(t,e){return function(n,r){e(n,r,t)}},_e=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n};Object.entries(ct);let be=class Logger{constructor(t){var e;this.config=t,this.logLevel=null!==(e=this.config.logLevel)&&void 0!==e?e:ee;const n=t.logger;this.loggerInstance=n||fe}debug(t){var e,n;this.logLevel>ct.DEBUG||null===(n=(e=this.loggerInstance).debug)||void 0===n||n.call(e,JSON.parse(JSON.stringify(Object.assign(Object.assign({},t),{level:"debug"}))))}info(t){var e,n;this.logLevel>ct.INFO||null===(n=(e=this.loggerInstance).info)||void 0===n||n.call(e,JSON.parse(JSON.stringify(Object.assign(Object.assign({},t),{level:"info"}))))}warn(t){var e,n;this.logLevel>ct.WARN||null===(n=(e=this.loggerInstance).warn)||void 0===n||n.call(e,JSON.parse(JSON.stringify(Object.assign(Object.assign({},t),{level:"warn"}))))}error(t){var e,n,{err:r}=t,i=_e(t,["err"]);this.logLevel>ct.ERROR||null===(n=(e=this.loggerInstance).error)||void 0===n||n.call(e,Object.assign({err:r},i))}};be=ve([X(),ye(0,rt(it.CONFIG)),me("design:paramtypes",["function"==typeof(ge=void 0!==Config&&Config)?ge:Object])],be);class ScopedLogger{constructor(t,e){this.logger=t,this.scope=e}debug(t){var e,n;null===(n=(e=this.logger).debug)||void 0===n||n.call(e,JSON.parse(JSON.stringify(Object.assign(Object.assign({},t),{scope:this.scope}))))}info(t){var e,n;null===(n=(e=this.logger).info)||void 0===n||n.call(e,JSON.parse(JSON.stringify(Object.assign(Object.assign({},t),{scope:this.scope}))))}warn(t){var e,n;null===(n=(e=this.logger).warn)||void 0===n||n.call(e,JSON.parse(JSON.stringify(Object.assign(Object.assign({},t),{scope:this.scope}))))}error(t){var e,n,{err:r}=t,i=_e(t,["err"]);null===(n=(e=this.logger).error)||void 0===n||n.call(e,Object.assign(Object.assign({err:r},i),{scope:this.scope}))}unwrap(){return this.logger}}var Ee;!function(t){t.PUBLISH="publish",t.SUBSCRIBE="subscribe",t.JOIN="join",t.LEAVE="leave",t.APP_TRACE="app_trace"}(Ee||(Ee={}));const Se=1,Ce=2;class JoinEvent extends StageAnalyticsEvent{constructor(t){super(c.JOIN,t.token,t.traceId,!1),Object.assign(this.properties,{action:Ee.JOIN,event_endpoint:t.eventEndpoint,whip_endpoint:t.whipEndpoint})}}class LeaveEvent extends StageAnalyticsEvent{constructor(t){super(c.LEAVE,t.token,t.traceId,!1),Object.assign(this.properties,{action:Ee.LEAVE,event_endpoint:t.eventEndpoint,whip_endpoint:t.whipEndpoint,reason:t.reason})}}var we,Te,Ie,Re,Ae,ke,Oe,Pe,Ne,xe=function(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)},De=function(t,e,n,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(t,n):i?i.value=n:e.set(t,n),n};const Me=2500,je=1280,Le=720,Ue={maxResolution:{width:je,height:Le},maxFramerate:30,maxBitrate:Me},Be={maxResolution:{width:Le,height:je},maxFramerate:30,maxBitrate:Me};class StageConfig{constructor(t=Ue,e,n){this.LOG_LEVEL=ct,this.DEFAULT_STAGE_LANDSCAPE=Ue,this.DEFAULT_STAGE_PORTRAIT=Be,we.set(this,void 0),Te.set(this,void 0),Ie.set(this,void 0),Re.set(this,void 0),Ae.set(this,void 0),ke.set(this,(t=>{if(!t)throw new BroadcastClientError(Object.assign(Object.assign({},Ot),{details:te}));if(!(t.maxBitrate<=Me&&t.maxBitrate>=200))throw new BroadcastClientError(Object.assign(Object.assign({},Ot),{details:"maxBitrate must be between 200 and 2500"}));if(!(t.maxFramerate<=30&&t.maxFramerate>=10))throw new BroadcastClientError(Object.assign(Object.assign({},Ot),{details:"maxFramerate must be between 10 and 30"}));const e=t.maxResolution.width,n=t.maxResolution.height;if(e>je||n>je||e<160||n<160||(e===je&&n>Le||n===je&&e>Le))throw new BroadcastClientError(Object.assign(Object.assign({},Ot),{details:"maxResolution values must be between 720x1280 or 1280x720"}))})),Oe.set(this,(t=>{if(!t)return;const e=Number(t),n=Number.isInteger(e),r=e>=ct.TRACE,i=e<=ct.SILENT;if(!n||!r||!i)throw new BroadcastClientError(xt)})),Pe.set(this,(t=>{if(t&&"object"!=typeof t)throw new BroadcastClientError(Dt)})),Ne.set(this,(t=>{if(t&&("string"!=typeof t||!t.startsWith("http")))throw new BroadcastClientError(Ft)})),xe(this,Pe,"f").call(this,n),xe(this,Oe,"f").call(this,e),xe(this,ke,"f").call(this,t),De(this,Te,n,"f"),De(this,we,e,"f"),De(this,Re,t,"f")}get streamConfig(){return xe(this,Re,"f")}set streamConfig(t){xe(this,ke,"f").call(this,t),De(this,Re,t,"f")}get logLevel(){return xe(this,we,"f")}set logLevel(t){xe(this,Oe,"f").call(this,t),De(this,we,t,"f")}get logger(){return xe(this,Te,"f")}set logger(t){xe(this,Pe,"f").call(this,t),De(this,Te,t,"f")}get whipUrlOverride(){return xe(this,Ae,"f")}set whipUrlOverride(t){xe(this,Ne,"f").call(this,t),De(this,Ae,t,"f")}}we=new WeakMap,Te=new WeakMap,Ie=new WeakMap,Re=new WeakMap,Ae=new WeakMap,ke=new WeakMap,Oe=new WeakMap,Pe=new WeakMap,Ne=new WeakMap;class StageClientError extends BroadcastClientError{constructor({token:t,traceId:e,code:n,tag:r,location:i,message:o,details:s,remoteParticipantId:a,requestUUID:c}){super({name:"StageClientError",message:o,code:n}),Error.captureStackTrace&&Error.captureStackTrace(this,StageClientError),this.token=t,this.traceId=e,this.code=n,this.tag=r,this.location=i,this.message=o,this.details=s,this.remoteParticipantId=a,this.requestUUID=c}}const Fe={JOIN_RELATED:"signalling_session",PUBLISH_RELATED:"webrtc_sink",UNPUBLISH_RELATED:"webrtc_unsink"};function Ge(t,e){switch(t){case Ee.PUBLISH:return Fe.PUBLISH_RELATED;case Ee.SUBSCRIBE:return`webrtc_source:${e}`;default:return"unknown"}}function Ve(t,e){return{code:t.code,message:`${t.message}: ${e.name} ${e.message}`}}var We;!function(t){t[t.Unspecified=2001]="Unspecified",t[t.TokenExpired=2002]="TokenExpired",t[t.NoPermissions=2003]="NoPermissions",t[t.StageAtCapacity=2005]="StageAtCapacity"}(We||(We={}));const qe={EXPIRED_TOKEN:{code:1001,message:"Token expired and is no longer valid"},UNPUBLISH_FAILURE:{code:1013,message:"Failed to unpublish"},UNSUBSCRIBE_FAILURE:{code:1014,message:"Failed to unsubscribe"},PUBLISH_FAILURE:{code:1015,message:"Failed to publish"},SUBSCRIBE_FAILURE:{code:1016,message:"Failed to subscribe"},JOIN_FAILURE:{code:1017,message:"Failed to join"},PUBLISH_TIMED_OUT:{code:1020,message:"Publish timed out"},SUBSCRIBE_TIMED_OUT:{code:1021,message:"Subscribe timed out"},NO_CANDIDATES:{code:1022,message:"No ICE candidates"},OPERATION_ABORTED:{code:1023,message:"Request aborted"},STAGE_AT_CAPACITY:{code:1024,message:"Stage at capacity"},INTERNAL_SERVER_ERROR:{code:1025,message:"Internal server error"},TOKEN_PERMISSIONS_DENIED:{code:1026,message:"Token permissions are not valid for the operation"},UNKNOWN_PERMISSIONS_ERROR:{code:1099,message:"Service error code unknown or not found"},WEBSOCKET_MESSAGE_PARSE_FAILURE:{code:1204,message:"Failed to parse websocket message"},WHIP_SESSION_RESOURCE_DELETED:{code:1206,message:"WHIP signaling session resource not found"},WHIP_TOO_MANY_REQUESTS:{code:1207,message:"WHIP endpoint received too many requests"},WHIP_OPTIONS_FAILURE:{code:1501,message:"Failed to get ICE Servers from OPTIONS"},WHIP_POST_FAILURE:{code:1502,message:"WHIP post failure"},WHIP_DELETE_FAILURE:{code:1503,message:"WHIP delete failure"},WHIP_URL_MISSING:{code:1504,message:"WHIP delete failure"},EVENT_PLANE_CONNECTION_FAILURE:{code:1300,message:"Error connecting to event plane"},PEER_CONNECTION_NETWORK_FAILURE:{code:1400,message:"PeerConnection is lost due to unknown network error"},CREATE_OFFER_FAILURE:{code:1402,message:"Failed to set local description"},CREATE_PEER_CONNECTION_FAILURE:{code:1403,message:"Failed to create a peer connection"},ICE_CANDIDATE_ERROR:{code:1404,message:"ICE candidate error"}};var ze;function $e(t){const e=atob(t);return JSON.parse(e)}!function(t){t.UNPUBLISH="unpublish",t.UNSUBSCRIBE="unsubscribe",t.UNLOAD="unload",t.CONNECTION_FAIL="connection fail"}(ze||(ze={}));class StageToken{constructor(t){this.rawToken=t;const e=t.split(".");if(3!==e.length)throw Error(`Token format incorrect. length: ${e.length}`);try{this.header=$e(e[0])}catch(t){const e=t instanceof Error?`: ${t.message}`:"";throw Error(`Error parsing Stage Token header${e}`)}try{this.claims=$e(e[1])}catch(t){const e=t instanceof Error?`: ${t.message}`:"";throw Error(`Error parsing Stage Token claims${e}`)}this.signature=e[2];const{claims:n}=this;this.stageARN=n.resource,this.participantID=n.jti,this.eventsURL=n.events_url,this.whipURL=n.whip_url,this.userID=n.user_id,this.expirationTime=n.exp,this.topic=n.topic,this.parseVersionFlags(n.version);const{attributes:r}=n;r&&(this.attrGsRole=r.gs_role,this.attrGsSessionId=r.gs_session_id),this.analyticsTracker=AnalyticsTracker.getInstance()}getPublishEndpoint(){let t="";return this.whipURL&&this.participantID&&(t=`${this.whipURL}/publish/${this.participantID}`),t}getSubscribeEndpoint(t){let e="";return this.whipURL&&(e=`${this.whipURL}/subscribe/${t}`),e}assertTokenIsUnexpired(t,e,n,r){(!this.expirationTime||Date.now()/1e3>=this.expirationTime)&&this.analyticsTracker.trackErrorAndThrow(new StageClientError(Object.assign(Object.assign({},qe.EXPIRED_TOKEN),{location:n,tag:e,token:this,traceId:t,remoteParticipantId:r,message:qe.EXPIRED_TOKEN.message,details:`Token expired at ${this.expirationTime} and is no longer valid`})))}parseVersionFlags(t){if(!t)return;const e=t.split(".");2===e.length&&(this.versionFlags=parseInt(e[1],10))}shouldUseTURN(){return void 0===this.versionFlags||0!=(this.versionFlags&Se)}shouldSendSilentAudio(){return void 0===this.versionFlags||0!=(this.versionFlags&Ce)}}function He(t){return new StageToken(t)}function Ke({action:t,identifier:e,token:n,whipURLOverride:r}){let i="";const o=He(n);switch(r&&(o.whipURL=r),t){case Ee.PUBLISH:i=o.getPublishEndpoint();break;case Ee.SUBSCRIBE:e&&(i=o.getSubscribeEndpoint(e))}return i}var Je,Xe,Ye,Ze=n(9669),Qe=n.n(Ze),tn=n(2492);class CongestionTimeEvent{constructor(t,e){this.transformProperties=(t,e)=>({sum:t.sum,median:t.median(),min:t.min,max:t.max,p90:t.percentile(.9),event_count:t.data.length,period:e});const n=this.transformProperties(t,e);this.data={event:Je.CONGESTION_TIME,properties:n}}}class ConnectionEstablishedEvent{constructor(t,e,n){this.transformProperties=(t,e,n)=>({duration:(t.getTime()-((null==e?void 0:e.getTime())||0))/1e3,ecn_negotiated:!1,ingest_session_id:n});const r=this.transformProperties(t,e,n);this.data={event:Je.CONNECTION_ESTABLISHED,properties:r}}}class ConnectionRTTEvent{constructor(t,e){this.transformProperties=(t,e)=>({sum:t.sum,median:t.median(),min:t.min,max:t.max,p90:t.percentile(.9),event_count:t.data.length,period:e});const n=this.transformProperties(t,e);this.data={event:Je.CONNECTION_RTT,properties:n}}}class ErrorEvent{constructor(t){this.transformProperties=t=>{var e;return{is_fatal:null!==(e=t.isFatal)&&void 0!==e&&e,value:t.value,code:t.code,description:t.description}};const e=this.transformProperties(t);this.data={event:Je.ERROR,properties:e}}}class InputDeviceAttachedEvent{constructor(t,e){this.transformProperties=(t,e)=>({type:t,input_device_id:e.deviceId,position:e.facingMode||"unknown"});const n=this.transformProperties(t,e);this.data={event:Je.INPUT_DEVICE_ATTACHED,properties:n}}}class InputDeviceDetachedEvent{constructor(t,e){this.transformProperties=(t,e)=>({type:t,input_device_id:e.deviceId,position:e.facingMode||"unknown"});const n=this.transformProperties(t,e);this.data={event:Je.INPUT_DEVICE_DETACHED,properties:n}}}class MeasuredBitrateEvent{constructor(t,e){this.transformProperties=(t,e)=>({sum:t.sum,median:t.median(),min:t.min,max:t.max,p90:t.percentile(.9),event_count:t.data.length,period:e});const n=this.transformProperties(t,e);this.data={event:Je.MEASURED_BITRATE,properties:n}}}class MinuteBroadcastEvent{constructor(t,e){this.transformProperties=(t,e)=>({minutes_logged:Math.round((t.timestamp-e)/6e4)});const n=this.transformProperties(t,e);this.data={event:Je.MINUTE_BROADCAST,properties:n}}}class RecommendedBitrateEvent{constructor(t,e){this.transformProperties=(t,e)=>({sum:t.sum,median:t.median(),min:t.min,max:t.max,p90:t.percentile(.9),event_count:t.data.length,period:e});const n=this.transformProperties(t,e);this.data={event:Je.RECOMMENDED_BITRATE,properties:n}}}class SessionAudioEncoderConfiguredEvent{constructor(t){this.transformProperties=t=>({codec:t.mimeType,bitrate:0,sample_rate:t.clockRate,channel_count:t.channels});const e=this.transformProperties(t);this.data={event:Je.SESSION_AUDIO_ENCODER_CONFIGURED,properties:e}}}class SessionAudioPropertiesEvent{constructor(t){this.transformProperties=t=>({codec:"audio",bitrate:32e3,sample_rate:t.sampleRate,channel_count:t.channelCount});const e=this.transformProperties(t);this.data={event:Je.SESSION_AUDIO_PROPERTIES,properties:e}}}class SessionVideoEncoderConfiguredEvent{constructor(t,e,n){this.transformProperties=(t,e,n)=>({codec:n.mimeType,codec_profile:e.profile,codec_level:e.level,rate_mode:"vbr",initial_bitrate:0,keyframe_interval:2,width:t.width,height:t.height,bframe_count:0,target_fps:t.frameRate});const r=this.transformProperties(t,e,n);this.data={event:Je.SESSION_VIDEO_ENCODER_CONFIGURED,properties:r}}}class SessionVideoPropertiesEvent{constructor(t){this.transformProperties=t=>({codec:"video",initial_bitrate:32e3,min_bitrate:0,max_bitrate:0,keyframe_interval:2,width:t.width,height:t.height,auto_bitrate_enabled:!0,bframes_enabled:!1,target_fps:t.frameRate});const e=this.transformProperties(t);this.data={event:Je.SESSION_VIDEO_PROPERTIES,properties:e}}}class SourceAudioLatencyEvent{constructor(t,e){this.transformProperties=(t,e)=>({sum:t.sum,median:t.median(),min:t.min,max:t.max,p90:t.percentile(.9),event_count:t.data.length,period:e});const n=this.transformProperties(t,e);this.data={event:Je.SOURCE_AUDIO_LATENCY,properties:n}}}class SourceVideoLatencyEvent{constructor(t,e){this.transformProperties=(t,e)=>({sum:t.sum,median:t.median(),min:t.min,max:t.max,p90:t.percentile(.9),event_count:t.data.length,period:e});const n=this.transformProperties(t,e);this.data={event:Je.SOURCE_VIDEO_LATENCY,properties:n}}}class StartBroadcastEvent{constructor(t,e){this.transformProperties=({protocol:t,hostname:e,port:n},r)=>({protocol:t,endpoint_host:e,endpoint_port:n,reason:r});const n=this.transformProperties(t,e);this.data={event:Je.START_BROADCAST,properties:n}}}class StopBroadcastEvent{constructor(t){this.transformProperties=({protocol:t,hostname:e,port:n})=>({protocol:t,endpoint_host:e,endpoint_port:n});const e=this.transformProperties(t);this.data={event:Je.STOP_BROADCAST,properties:e}}}class WebRTCAudioStatsEvent{constructor(t){this.transformProperties=t=>({bytes_sent:t.bytesSent,header_bytes_sent:t.headerBytesSent,nack_count:t.nackCount,packets_sent:t.packetsSent,retransmitted_bytes_sent:t.retransmittedBytesSent,retransmitted_packets_sent:t.retransmittedPacketsSent});const e=this.transformProperties(t);this.data={event:Je.WEBRTC_AUDIO_STATS,properties:e}}}class WebRTCVideoStatsEvent{constructor(t){this.transformProperties=t=>({bytes_sent:t.bytesSent,fir_count:t.firCount,frames_encoded:t.framesEncoded,frames_sent:t.framesSent,header_bytes_sent:t.headerBytesSent,huge_frames_sent:t.hugeFramesSent,key_frames_encoded:t.keyFramesEncoded,nack_count:t.nackCount,packets_sent:t.packetsSent,pli_count:t.pliCount,quality_limitation_reason:t.qualityLimitationReason,quality_limitation_resolution_changes:t.qualityLimitationResolutionChanges,retransmitted_bytes_sent:t.retransmittedBytesSent,retransmitted_packets_sent:t.retransmittedPacketsSent,total_encode_time:t.totalEncodeTime,total_encoded_bytes_target:t.totalEncodedBytesTarget,total_packet_send_delay:t.totalPacketsSendDelay});const e=this.transformProperties(t);this.data={event:Je.WEBRTC_VIDEO_STATS,properties:e}}}!function(t){t.START_BROADCAST="ivs_broadcast_start_broadcast",t.STOP_BROADCAST="ivs_broadcast_stop_broadcast",t.MINUTE_BROADCAST="ivs_broadcast_minute_broadcast",t.WEBRTC_AUDIO_STATS="ivs_broadcast_webrtc_audio_stats",t.WEBRTC_VIDEO_STATS="ivs_broadcast_webrtc_video_stats",t.CONNECTION_ESTABLISHED="ivs_broadcast_connection_established",t.SESSION_VIDEO_PROPERTIES="ivs_broadcast_session_video_properties",t.SESSION_AUDIO_PROPERTIES="ivs_broadcast_session_audio_properties",t.SESSION_VIDEO_ENCODER_CONFIGURED="ivs_broadcast_session_video_encoder_configured",t.SESSION_AUDIO_ENCODER_CONFIGURED="ivs_broadcast_session_audio_encoder_configured",t.SOURCE_AUDIO_LATENCY="ivs_broadcast_source_audio_latency",t.SOURCE_VIDEO_LATENCY="ivs_broadcast_source_video_latency",t.INPUT_DEVICE_ATTACHED="ivs_broadcast_input_device_attached",t.INPUT_DEVICE_DETACHED="ivs_broadcast_input_device_detached",t.CONGESTION_TIME="ivs_broadcast_congestion_time",t.BUFFER_DURATION="ivs_broadcast_buffer_duration",t.MEASURED_BITRATE="ivs_broadcast_measured_bitrate",t.RECOMMENDED_BITRATE="ivs_broadcast_recommended_bitrate",t.CONNECTION_RTT="ivs_broadcast_connection_rtt",t.ERROR="ivs_broadcast_error"}(Je||(Je={})),function(t){t.USER_INITIATED="user-initiated",t.NETWORK_DISCONNECT="network-disconnect"}(Xe||(Xe={})),function(t){t.CONFIG="config",t.UPDATE="update",t.START="start",t.STOP="stop"}(Ye||(Ye={}));const en=t=>{const e=t=>{var e;return(null===(e=t.deviceId)||void 0===e?void 0:e.startsWith("web-contents-media-stream"))?"tab":void 0},n=t=>{var e;return(null===(e=t.deviceId)||void 0===e?void 0:e.startsWith("window"))&&"window"===t.displaySurface?"window":void 0},r=t=>{var e;return(null===(e=t.deviceId)||void 0===e?void 0:e.startsWith("screen"))&&"monitor"===t.displaySurface?"screen":void 0};return(e(i=t)||n(i)||r(i)?void 0:"camera")||r(t)||n(t)||e(t)||"unknown";var i};var nn,rn=function(t,e,n,r){var i,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(s=(o<3?i(s):o>3?i(e,n,s):i(e,n))||s);return o>3&&s&&Object.defineProperty(e,n,s),s},on=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sn=function(t,e){return function(n,r){e(n,r,t)}},an=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))};!function(t){t.video="video",t.audio="audio"}(nn||(nn={}));const cn=new Map([["video",void 0],["audio",void 0]]);let un=class MediaStreamManager{constructor(t,e){this.config=t,this.schedulerWorker=e,this.handleWorkerEvent=t=>{var e;if((null===(e=t.data)||void 0===e?void 0:e.type)===Ye.UPDATE)this.drawComposite()},this.mixer={video:[],audio:[]},this.analyticsTracker=AnalyticsTracker.getInstance(),this.running=!1,this.compositeEl=document.createElement("canvas"),this.compositeEl.height=this.config.streamConfig.maxResolution.height,this.compositeEl.width=this.config.streamConfig.maxResolution.width;const n=this.compositeEl.getContext("2d");if(null===n)throw new BroadcastClientError(Object.assign({},dt));this.compositeContext=n,this.compositeStream=this.compositeEl.captureStream(void 0!==typeof CanvasCaptureMediaStreamTrack?0:30);const r=dn(this.compositeStream.getTracks(),nn.video);this.audioContext=new AudioContext,this.unlockAudioContext(),this.audioDestination=this.audioContext.createMediaStreamDestination(),this.setupSilence();const i=dn(this.audioDestination.stream.getTracks(),nn.audio);cn.set("video",r),cn.set("audio",i),this.schedulerWorker.addEventListener("message",this.handleWorkerEvent),this.schedulerWorker.postMessage({type:Ye.CONFIG,payload:{frameRate:this.config.streamConfig.maxFramerate}}),this.previewElement=null,this.previewCtx=null,this.nextMix=(new Date).getTime()}attachPreview(t){this.previewElement=t;const{width:e,height:n}=this.config.streamConfig.maxResolution;this.previewElement.width=e,this.previewElement.height=n,this.previewCtx=this.previewElement.getContext("2d")}detachPreview(){this.previewElement=null,this.previewCtx=null}setupSilence(){const t=this.audioContext.createConstantSource(),e=this.audioContext.createGain();e.gain.value=.001,t.connect(e),e.connect(this.audioDestination),t.start()}unlockAudioContext(){if("suspended"!==this.audioContext.state)return;const t=document.body,e=["touchstart","touchend","mousedown","keydown"],n=()=>{e.forEach((e=>{t.removeEventListener(e,r)}))},r=()=>{this.audioContext.resume().then(n)};e.forEach((e=>{t.addEventListener(e,r,!1)}))}getTracks(){return[cn.get("video"),cn.get("audio")]}getCanvasVideoTrack(){return cn.get("video")}getAudioInputDevice(t){if("string"!=typeof t)return;const e=this.mixer.audio.find((e=>{if(e.name===t)return e.source}));return null==e?void 0:e.source}getVideoInputDevice(t){if("string"==typeof t)return this.mixer.video.find((e=>e.name===t))}getCanvasDimensions(){return{height:this.compositeEl.height,width:this.compositeEl.width}}addVideoInputDevice(t,e,n){var r;return an(this,void 0,void 0,(function*(){if("object"!=typeof t)throw new BroadcastClientError(Object.assign({},pt));if(!e||"string"!=typeof e)throw new BroadcastClientError(Object.assign({},mt));if(this.mixer.video.some((t=>t.name===e)))throw new BroadcastClientError(Object.assign({},ft));if(!n)throw new BroadcastClientError(Object.assign({},gt));if("number"!=typeof n.index)throw new BroadcastClientError(Object.assign({},vt));const i=function(){const t=document.createElement("video");return t.autoplay=!0,t.muted=!0,t.setAttribute("playsinline",""),t.setAttribute("webkit-playsinline",""),t}(),o=t.getVideoTracks(),[s]=o;if(!o.length)throw new BroadcastClientError(Object.assign({},lt));const a=s.getConstraints(),c=tn({},a,{frameRate:this.config.streamConfig.maxFramerate});yield s.applyConstraints(c);const u=new MediaStream([s]);i.srcObject=u;try{yield i.play();const t={name:e,element:i,position:n,source:u,render:!0},o=(null===(r=s.getSettings)||void 0===r?void 0:r.call(s))||{};this.analyticsTracker.trackEvent(new InputDeviceAttachedEvent(en(o),o)),this.mixer.video.push(t)}catch(t){throw new BroadcastClientError(Object.assign(Object.assign({},lt),{cause:t}))}}))}addImageSource(t,e,n){var r;return an(this,void 0,void 0,(function*(){if(!t)throw new BroadcastClientError(Object.assign({},pt));if(!e||"string"!=typeof e)throw new BroadcastClientError(Object.assign({},mt));if("image"===t.tagName)throw new BroadcastClientError(Object.assign({},yt));if(this.mixer.video.some((t=>t.name===e)))throw new BroadcastClientError(Object.assign({},ft));if(!n)throw new BroadcastClientError(Object.assign({},gt));if("number"!=typeof n.index)throw new BroadcastClientError(Object.assign({},vt));if(t instanceof Image){const e=null===(r=t.src)||void 0===r?void 0:r.slice();try{const e=t.src?new URL(t.src):{};if(e.host&&e.hostname){const e=yield fetch(t.src).then((t=>an(this,void 0,void 0,(function*(){return t.blob()})))),n=yield new Promise((t=>{const n=new FileReader;n.onload=()=>{t(n.result)},n.readAsDataURL(e)}));t.src=n}}catch(t){throw new BroadcastClientError(Object.assign(Object.assign({},Tt),{params:{details:`Image URL: ${e}`}}))}}const i={name:e,element:t,position:n,render:!0};this.mixer.video.push(i)}))}addAudioInputDevice(t,e){return an(this,void 0,void 0,(function*(){if("object"!=typeof t)throw new BroadcastClientError(Object.assign({},pt));if(!e||"string"!=typeof e)throw new BroadcastClientError(Object.assign({},mt));if(this.mixer.audio.some((t=>t.name===e)))throw new BroadcastClientError(Object.assign({},ft));const n=t.getAudioTracks();if(!n.length)throw new BroadcastClientError(Object.assign({},ht));const r=this.audioContext.createMediaStreamSource(new MediaStream(n)),i=this.audioContext.createGain();i.gain.value=1,r.connect(i),i.connect(this.audioDestination);const o={name:e,source:t,audioTrackSource:r,gainNode:i};this.analyticsTracker.trackEvent(new InputDeviceAttachedEvent("audio",{deviceId:t.id})),this.mixer.audio.push(o)}))}removeImage(t){const e=this.mixer.video.findIndex((e=>e.name===t));if(e<0)throw new BroadcastClientError(Object.assign({},bt));this.mixer.video.splice(e,1)}removeVideoInputDevice(t){var e;const n=this.removeDevice(t,this.mixer.video);if(!n)throw new BroadcastClientError(Object.assign({},_t));{const t=dn(n.source.getTracks(),nn.video);if(!t)throw new BroadcastClientError(Object.assign({},_t));n.element.srcObject=null,t.stop();const r=(null===(e=null==t?void 0:t.getSettings)||void 0===e?void 0:e.call(t))||{};this.analyticsTracker.trackEvent(new InputDeviceDetachedEvent(en(r),r))}}removeAudioInputDevice(t){const e=this.removeDevice(t,this.mixer.audio);if(null==e?void 0:e.audioTrackSource){for(const t of e.source.getTracks())t.stop(),this.analyticsTracker.trackEvent(new InputDeviceDetachedEvent("audio",{deviceId:t.id}));e.gainNode.disconnect(this.audioDestination)}else if(!e)throw new BroadcastClientError(Object.assign({},_t))}updateVideoDeviceComposition(t,e){if(!t||"string"!=typeof t)throw new BroadcastClientError(Object.assign({},Ct));if(!e)throw new BroadcastClientError(Object.assign({},Et));if("number"!=typeof e.index)throw new BroadcastClientError(Object.assign({},St));this.mixer.video.forEach(((n,r)=>{n.name===t&&(n.position=e)}))}exchangeVideoDevicePositions(t,e){const n=this.getVideoInputDevice(t),r=this.getVideoInputDevice(e);if(!n)throw new BroadcastClientError(Object.assign(Object.assign({},wt),{params:{details:`device with name: "${t}" not found`}}));if(!r)throw new BroadcastClientError(Object.assign(Object.assign({},wt),{params:{details:`device with name: "${e}" not found`}}));const i=Object.assign({},n.position),o=Object.assign({},r.position);for(const n of this.mixer.video)n.name===t&&(ln(o.x)?n.position=Object.assign(Object.assign({},n.position),o):n.position={index:o.index}),n.name===e&&(ln(i.x)?n.position=Object.assign(Object.assign({},n.position),i):n.position={index:i.index})}start(){this.running||(this.running=!0,this.schedulerWorker.postMessage({type:Ye.CONFIG,payload:{frameRate:this.config.streamConfig.maxFramerate}}),this.schedulerWorker.postMessage({type:Ye.START}))}stop(){this.running&&(this.running=!1,this.schedulerWorker.removeEventListener("message",this.handleWorkerEvent))}isCapturing(){return this.running}getAudioLatency(){return this.audioContext.baseLatency}getVideoLatency(){var t;return(null===(t=cn.get("video"))||void 0===t?void 0:t.getConstraints().latency)||0}disableVideo(){this.mixer.video.forEach((t=>{t.render=!1}))}enableVideo(){this.mixer.video.forEach((t=>{t.render=!0}))}disableAudio(){this.mixer.audio.forEach((t=>{t.audioTrackSource&&(t.gainNode.gain.value=0)}))}enableAudio(){this.mixer.audio.forEach((t=>{t.audioTrackSource&&(t.gainNode.gain.value=1)}))}getDrawRegion(t,e,n){var r,i,o,s;let a=null!==(r=t.position.x)&&void 0!==r?r:0,c=null!==(i=t.position.y)&&void 0!==i?i:0;const u=null!==(o=t.position.width)&&void 0!==o?o:e-a,d=null!==(s=t.position.height)&&void 0!==s?s:n-c,l=u/d;let h=t.element.width,p=t.element.height;t.element instanceof HTMLVideoElement&&(h=t.element.videoWidth,p=t.element.videoHeight);const f=h/p;let g=u,v=d;return f>l?(g=u,v=2*Math.round(u/f/2),c+=(d-v)/2):f<l&&(v=d,g=2*Math.round(d*f/2),a+=(u-g)/2),{x:a,y:c,width:g,height:v}}drawComposite(){if(!this.shouldMix(new Date))return;this.compositeContext.clearRect(0,0,this.compositeEl.width,this.compositeEl.height),this.drawBlackScreen();const t=this.mixer.video.filter((t=>t.render));t.sort(((t,e)=>t.position.index-e.position.index));for(const e of t){const{x:t,y:n,width:r,height:i}=this.getDrawRegion(e,this.compositeEl.width,this.compositeEl.height);this.compositeContext.drawImage(e.element,t,n,r,i)}this.previewElement&&this.previewCtx&&this.previewCtx.drawImage(this.compositeEl,0,0,this.previewElement.width,this.previewElement.height),this.requestCanvasCapture()}requestCanvasCapture(){if(void 0!==typeof CanvasCaptureMediaStreamTrack)if("function"==typeof this.compositeStream.requestFrame){this.compositeStream.requestFrame()}else{cn.get("video").requestFrame()}}drawBlackScreen(){this.compositeContext.fillStyle="#000000",this.compositeContext.fillRect(0,0,this.compositeEl.width,this.compositeEl.height)}removeDevice(t,e){const n=e.findIndex((e=>(e=>e.name===t)(e)));if(!(n<0))return e.splice(n,1)[0]}shouldMix(t){if(t.getTime()<this.nextMix)return!1;for(;this.nextMix<=t.getTime();)this.nextMix+=1e3/this.config.streamConfig.maxFramerate;return!0}};function dn(t,e){return t.find((t=>t.kind===e))}function ln(t){return Number.isSafeInteger(t)}un=rn([X(),sn(0,rt(it.CONFIG)),sn(1,rt(it.WORKER)),on("design:paramtypes",[Object,Object])],un);class AbortControllersTracker{constructor(){this.abortControllers={},this._isUnloading=!1}static getInstance(){return AbortControllersTracker.instance||(AbortControllersTracker.instance=new AbortControllersTracker),AbortControllersTracker.instance}abortPendingOperations(){Object.entries(this.abortControllers).forEach((([t,e])=>e.abort()))}trackNewAbortController(t){return this.abortControllers[t]=new AbortController,this.abortControllers[t]}removeAbortController(t){delete this.abortControllers[t]}get isUnloading(){return this._isUnloading}set isUnloading(t){this._isUnloading=t}}class TraceEvent extends StageAnalyticsEvent{constructor(t,e,n,r,i){super(c.TRACE,t,e,!1),Object.assign(this.properties,{action:r,message:n,remote_participant_id:i})}}function hn(t,e,n,r,i){AnalyticsTracker.getInstance().trackEventNoSharedProps(new TraceEvent(t,e,n,r,i))}const pn={STAGE_JOINED:"stageJoined",STAGE_PARTICIPANT_JOINED:"stageParticipantJoined",STAGE_PARTICIPANT_LEFT:"stageParticipantLeft",STAGE_PARTICIPANT_KICKED:"stageParticipantKicked",STAGE_PARTICIPANT_UPDATED:"stageParticipantUpdated",STAGE_REFRESH:"stageRefresh",STATE_CHANGE:"stateChange"},fn="connectionStateChange",gn="stageStreamUpdate",vn="open",mn="close",yn="messageParseError",_n="refresh",bn="connectionFailure",En="stageStateMessage";class EDPConnectedEvent extends StageAnalyticsEvent{constructor(t){super(c.EDP_CONNECTED,t.token,t.traceId,!1),Object.assign(this.properties,{event_endpoint:t.eventEndpoint,protocol:t.protocol,retry_times:t.numRetries})}}class EDPDisconnectedEvent extends StageAnalyticsEvent{constructor(t){super(c.EDP_DISCONNECTED,t.token,t.traceId,!1),Object.assign(this.properties,{event_endpoint:t.eventEndpoint,protocol:t.protocol})}}class PublishEvent extends StageAnalyticsEvent{constructor(t){super(c.PUBLISH,t.token,t.traceId,!1),Object.assign(this.properties,{action:Ee.PUBLISH,remote_participant_id:t.token.participantID})}}class UnpublishEvent extends StageAnalyticsEvent{constructor(t){super(c.UNPUBLISH,t.token,t.traceId,!0),Object.assign(this.properties,{action:Ee.PUBLISH,remote_participant_id:t.token.participantID})}}class SubscribeEvent extends StageAnalyticsEvent{constructor(t){super(c.SUBSCRIBE,t.token,t.traceId,!1),Object.assign(this.properties,{action:Ee.SUBSCRIBE,remote_participant_id:t.subscribedId,subscribed_id:t.subscribedId})}}class UnsubscribeEvent extends StageAnalyticsEvent{constructor(t){super(c.UNSUBSCRIBE,t.token,t.traceId,!0),Object.assign(this.properties,{action:Ee.SUBSCRIBE,remote_participant_id:t.unsubscribedId,unsubscribed_id:t.unsubscribedId})}}class PublishStartedEvent extends StageAnalyticsEvent{constructor(t){super(c.PUBLISH_STARTED,t.token,t.traceId,!1),Object.assign(this.properties,{action:Ee.PUBLISH,options_duration:t.optionsDuration,post_duration:t.postDuration,remote_participant_id:t.token.participantID,time_to_candidate:t.timeToCandidate,total_duration:t.totalDuration})}}class PublishEndedEvent extends StageAnalyticsEvent{constructor(t){super(c.PUBLISH_ENDED,t.token,t.traceId,!0),Object.assign(this.properties,{action:Ee.PUBLISH,remote_participant_id:t.token.participantID,unpublish_successful:t.isUnpublishSuccessful,reason:t.reason})}}class SubscribeStartedEvent extends StageAnalyticsEvent{constructor(t){super(c.SUBSCRIBE_STARTED,t.token,t.traceId,!1),Object.assign(this.properties,{action:Ee.SUBSCRIBE,options_duration:t.optionsDuration,post_duration:t.postDuration,remote_participant_id:t.remoteParticipantId,time_to_candidate:t.timeToCandidate,total_duration:t.totalDuration})}}class SubscribeEndedEvent extends StageAnalyticsEvent{constructor(t){super(c.SUBSCRIBE_ENDED,t.token,t.traceId,!0),Object.assign(this.properties,{action:Ee.SUBSCRIBE,remote_participant_id:t.remoteParticipantId,unsubscribe_successful:t.isUnsubscribeSuccessful,reason:t.reason}),this.critical=!0}}class StateUpdatedEvent extends StageAnalyticsEvent{constructor(t){super(c.STATE_UPDATED,t.token,t.traceId,!1),Object.assign(this.properties,{audio_muted:t.isAudioMuted,is_disconnected:t.isDisconnected,is_publishing:t.isPublishing,other_participant_id:t.otherParticipantId,other_participant_user_id:t.otherParticipantUserId,video_stopped:t.isVideoStopped})}}var Sn=n(6486);var Cn;!function(t){t.MESSAGE="message",t.RESPONSE="response"}(Cn||(Cn={}));class StageSocket{constructor(t){this.protocol="",this.connecting=!1,this.closing=!1,this.closingForError=!1,this.nextConnectionAttempt=0,this.windowUnloading=!1,this.pingInterval=0,this.pongTimeout=0,this.latestSequenceNumber=0,this.beforeUnload=()=>{this.windowUnloading=!0},this.logger=new ScopedLogger(t,ut.SOCKET),this.emitter=new u.EventEmitter,this.connectionAttempts=0,this.sentPing=!1,this.receivedPong=!1,this.id=`[${p().value}] `,window.addEventListener("beforeunload",this.beforeUnload)}connect(t,e){this.logger.debug({msg:`${this.id}connecting to ${t}`}),this.addr=t||this.addr,this.token=e||this.token;const{topic:n,rawToken:r}=this.token;this.connecting=!0;try{this.socket=this.createWebSocket(`${this.addr}?topic=${n}/publishers`,r),this.socket.onmessage=this.onMessage.bind(this),this.socket.onerror=this.onError.bind(this),this.socket.onclose=this.onClose.bind(this),this.socket.onopen=this.onOpen.bind(this),this.protocol=this.socket.protocol}catch(t){this.emitter.emit(bn,new Error("UnableToConnect"))}}send(t){var e;this.logger.debug({msg:`${this.id}sending ${JSON.stringify(t)}`}),this.isReady()?null===(e=this.socket)||void 0===e||e.send(JSON.stringify(t)):this.logger.warn({msg:"Trying to send data over stage socket that is not ready"})}close(){this.closing=!0,this.connecting=!1,this.closeSocket(),this.removeAllListeners()}removeAllListeners(){window.removeEventListener("beforeunload",this.beforeUnload),this.emitter.removeAllListeners(),this.socket&&(this.socket.onmessage=null,this.socket.onerror=null,this.socket.onclose=null,this.socket.onopen=null)}createWebSocket(t,e){return new WebSocket(t,e)}closeForError(){this.closingForError=!0,this.closeSocket()}closeSocket(){var t;this.logger.debug({msg:`${this.id}closing`}),this.clearTimeouts(),null===(t=this.socket)||void 0===t||t.close()}on(t,e){this.emitter.on(t,e)}off(t,e){this.emitter.off(t,e)}isReady(){return this.logger.debug({msg:`${this.id}isReady called`}),!!this.socket&&this.socket.readyState===this.socket.OPEN}onMessage(t){this.logger.debug({msg:`${this.id}received message: ${t.data}`});try{const e=JSON.parse(t.data);switch(e.type){case"STAGE_STATE":case"aws:ivs:STAGE_STATE":{const t=e.payload.sequenceNumber;t>this.latestSequenceNumber&&(this.emitter.emit(En,e),this.latestSequenceNumber=t);break}case"PONG":this.receivedPong=!0;break;case"REFRESH":this.emitter.emit(_n);break;default:(0,Sn.noop)()}}catch(t){this.logger.debug({msg:`onMessage JSON Parse error: ${t}`}),this.emitter.emit(yn,t)}}onError(t){this.logger.debug({msg:`${this.id}error: ${JSON.stringify(t)}`})}onClose(t){if(this.logger.debug({msg:`${this.id}onClose triggered with code (closing = ${this.closing}, closingForError = ${this.closeForError}, connecting = ${this.connecting})`}),this.clearTimeouts(),this.connecting){let t=Math.pow(2,this.connectionAttempts);t>1e3&&(t=1e3),this.logger.debug({msg:`${this.id}reconnecting in ${t} seconds`}),this.connectionAttempts+=1,this.nextConnectionAttempt=window.setTimeout(this.connect.bind(this),1e3*t)}else if(this.closing)this.emitter.emit(mn),this.closing=!1;else if(this.closingForError)this.emitter.emit(bn,new Error("ClosedForError")),this.closingForError=!1;else{if(this.windowUnloading)return;this.logger.debug({msg:`${this.id}unexpected close`}),this.emitter.emit(bn,new Error("UnintentionalError"))}}onOpen(){this.logger.debug({msg:`${this.id} socket opened`});const t=this.connectionAttempts;this.connectionAttempts=0,this.connecting=!1,this.ping(),this.pingInterval=window.setInterval(this.ping.bind(this),3e4),this.emitter.emit(vn,{attempts:t})}ping(){var t;this.logger.debug({msg:`${this.id}sending PING`});try{null===(t=this.socket)||void 0===t||t.send(JSON.stringify({type:"PING"})),this.sentPing=!0,this.receivedPong=!1,this.pongTimeout&&clearTimeout(this.pongTimeout),this.pongTimeout=window.setTimeout(this.pongTimedOut.bind(this),5e3)}catch(t){this.closeForError()}}pongTimedOut(){this.sentPing&&!this.receivedPong&&(this.logger.debug({msg:`${this.id}Pong timed out!`}),this.closeForError())}clearTimeouts(){this.sentPing=this.receivedPong=!1,clearTimeout(this.pongTimeout),clearInterval(this.pingInterval),clearTimeout(this.nextConnectionAttempt)}}class TypedEmitter{constructor(){this.emitter=new u}on(t,e){e.call=function(t,e){return function(n,...r){try{e.apply(n,r)}catch(n){let r=`Error in callback for ${t}`;const i=e.name;return i&&(r+=` for function ${i}`),void console.error(`${r}\n`,n)}}}(t,e),this.emitter.on(t,e)}off(t,e){this.emitter.off(t,e)}emit(t,...e){this.emitter.emit(t,...e)}removeAllListeners(){this.emitter.removeAllListeners()}}var wn=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))};var Tn;!function(t){t.DISCONNECTED="disconnected",t.CONNECTING="connecting",t.CONNECTED="connected",t.ERRORED="errored"}(Tn||(Tn={}));class StageConnection extends TypedEmitter{constructor(t){super(),this.nonScopedLogger=t,this.participants=new Map,this.disconnected=[],this.state={value:Tn.DISCONNECTED,context:{hasConnected:!1}},this.onConnecting=(t,e)=>{if(this.logger.debug({msg:"onConnecting",context:t,event:e}),"CONNECT"===e.type&&(t.token=e.payload.token,t.traceId=e.payload.traceId),!t.token||!t.traceId)return void this.logger.warn({msg:"Attempting a connect but no token OR traceId provided"});const{eventsURL:n}=t.token;this.stageSocket.connect(n,t.token),this.emit(pn.STATE_CHANGE,Tn.CONNECTING),this.state.value=Tn.CONNECTING},this.onConnected=(t,e)=>{this.logger.debug({msg:"onConnected",context:t,event:e}),t.hasConnected=!0,this.emit(pn.STAGE_JOINED),this.emit(pn.STATE_CHANGE,Tn.CONNECTED),this.state.value=Tn.CONNECTED},this.onDisconnected=t=>{this.logger.debug({msg:"onDisconnected",context:t}),this.stageSocket.close(),t.hasConnected=!1,delete t.traceId,delete t.token,this.emit(pn.STATE_CHANGE,Tn.DISCONNECTED),this.state.value=Tn.DISCONNECTED},this.onErrored=(t,e)=>{this.logger.error({msg:"Connection failure occurred",err:e.payload.error}),this.emit(pn.STATE_CHANGE,Tn.ERRORED),this.state.value=Tn.ERRORED,t.hasConnected&&t.token&&t.traceId?this.processStateUpdate({type:"RECONNECT"}):this.stageSocket.close()},this.processStateUpdate=t=>{const e=this.state.value,n=this.state.context;switch(e){case Tn.DISCONNECTED:"CONNECT"===t.type&&this.onConnecting(n,t);break;case Tn.CONNECTING:"RECONNECT"===t.type?this.onConnecting(n,t):"DISCONNECT"===t.type?this.onDisconnected(n):"CONNECT_SUCCESS"===t.type?this.onConnected(n,t):"ERROR"===t.type&&this.onErrored(n,t);break;case Tn.CONNECTED:"RECONNECT"===t.type?this.onConnecting(n,t):"DISCONNECT"===t.type?this.onDisconnected(n):"ERROR"===t.type&&this.onErrored(n,t);break;case Tn.ERRORED:"RECONNECT"===t.type?this.onConnecting(n,t):"DISCONNECT"===t.type&&this.onDisconnected(n)}},this.trackConnectedEvent=(t,e,n)=>{this.analyticsTracker.trackEventNoSharedProps(new EDPConnectedEvent({token:t,eventEndpoint:t.eventsURL,numRetries:n,protocol:this.stageSocket.protocol,traceId:e}))},this.trackDisconnectedEvent=(t,e)=>{this.analyticsTracker.trackEventNoSharedProps(new EDPDisconnectedEvent({token:t,eventEndpoint:t.eventsURL,protocol:this.stageSocket.protocol,traceId:e}))},this.trackMessageParseError=(t,e)=>n=>{this.logger.error({msg:"Message Parse Error occurred",err:n});const r=new StageClientError({token:t,traceId:e,code:qe.WEBSOCKET_MESSAGE_PARSE_FAILURE.code,tag:Fe.JOIN_RELATED,location:"onMessage",message:qe.WEBSOCKET_MESSAGE_PARSE_FAILURE.message,details:n.message});this.analyticsTracker.trackEventNoSharedProps(new StageErrorEvent(r))},this.onStageStateMessage=(t,e)=>n=>{var r,i;this.logger.debug({msg:"State Stage Message occurred",state:n});const o=n.payload,s=null!==(r=o.participants)&&void 0!==r?r:[],a=null!==(i=o.disconnected)&&void 0!==i?i:[],c=[],u=[],d=(n,r)=>{this.analyticsTracker.trackEventNoSharedProps(new StateUpdatedEvent({token:t,otherParticipantId:n.id,otherParticipantUserId:n.userId,isAudioMuted:n.audioMuted,isVideoStopped:n.videoStopped,isPublishing:n.isPublishing,isDisconnected:r,traceId:e}))};this.participants.forEach((t=>{const e=s.find((e=>e.id===t.id));if(e){let n=!0,r=!1;["isPublishing","id","audioMuted","joinedAt","userId","videoStopped"].forEach((i=>{n=n&&e[i.toString()]===t[i.toString()],n||(t[i.toString()]=e[i.toString()],r=!0)})),Object.keys(t.attributes).forEach((i=>{n=n&&e.attributes[i]===t.attributes[i],n||(t.attributes=e.attributes,r=!0)})),r&&(d(t,!1),this.emit(pn.STAGE_PARTICIPANT_UPDATED,e))}else u.push(t)})),s.forEach((t=>{this.participants.get(t.id)||c.push(t)})),u.forEach((t=>{this.participants.delete(t.id),d(t,!0),this.emit(pn.STAGE_PARTICIPANT_LEFT,t)})),c.forEach((t=>{this.participants.set(t.id,t),d(t,!1),this.emit(pn.STAGE_PARTICIPANT_JOINED,t)})),a.forEach((t=>{this.disconnected.find((e=>e.id===t.id))||(this.disconnected.push(t),"KICKED"===t.status&&this.emit(pn.STAGE_PARTICIPANT_KICKED,t))})),this.disconnected=a},this.analyticsTracker=AnalyticsTracker.getInstance(),this.nonScopedLogger=t,this.logger=new ScopedLogger(t,ut.CONNECTION),this.stageSocket=new StageSocket(this.nonScopedLogger)}connect(t,e){return wn(this,void 0,void 0,(function*(){return this.logger.debug({msg:"connect invoked",token:t,traceId:e}),this.state.value!==Tn.DISCONNECTED&&(this.logger.debug({msg:"Disconnecting previous connection"}),this.processStateUpdate({type:"DISCONNECT"}),window.clearTimeout(this.connectTimeout)),new Promise(((n,r)=>{this.connectTimeout=window.setTimeout((()=>{this.logger.debug({msg:"Attempt to connect timed out"});const t=new Error("InitialConnectTimedOut");this.processStateUpdate({type:"ERROR",payload:{error:t}}),r(t)}),1e4),this.stageSocket.on(vn,(r=>{const{attempts:i}=r;window.clearTimeout(this.connectTimeout),this.trackConnectedEvent(t,e,i),this.processStateUpdate({type:"CONNECT_SUCCESS"}),n()})),this.stageSocket.on(bn,(t=>{this.processStateUpdate({type:"ERROR",payload:{error:t}})})),this.stageSocket.on(_n,(()=>{this.logger.debug({msg:"Refresh event occurred"}),this.emit(pn.STAGE_REFRESH),this.processStateUpdate({type:"RECONNECT"})})),this.stageSocket.on(mn,(()=>{this.logger.debug({msg:"Close event occurred"}),this.trackDisconnectedEvent(t,e)})),this.stageSocket.on(En,this.onStageStateMessage(t,e)),this.stageSocket.on(yn,this.trackMessageParseError(t,e)),this.processStateUpdate({type:"CONNECT",payload:{token:t,traceId:e}})}))}))}disconnect(){this.logger.debug({msg:"disconnect invoked"});const t=this.state.context.traceId;return this.processStateUpdate({type:"DISCONNECT"}),this.participants=new Map,this.disconnected=[],this.stageSocket.removeAllListeners(),t}getParticipant(t){return this.participants.get(t)}listConnectedParticipants(){const t=[];return this.participants.forEach((e=>{e.subscribed&&t.push(e)})),t}listAvailableParticipants(){return Array.from(this.participants.values())}emitStageState(t,e){this.stageSocket.send({audioMuted:t,type:"SET_STATE",version:"0",videoStopped:e})}}const In={CONNECTION_STATE_CHANGE:"connectionStateChange",ERROR:"clientError",ACTIVE_STATE_CHANGE:"activeStateChange"},Rn="connectionStateChange",An="clientError";var kn;!function(t){t.CLOSED="closed",t.COMPLETED="completed",t.CONNECTED="connected",t.CONNECTING="connecting",t.DISCONNECTED="disconnected",t.FAILED="failed",t.IDLE="idle",t.NEW="new",t.NONE="none"}(kn||(kn={}));class ThrottleTimer{constructor(t,e){this.throttleDuration=0,this.throttled=!1,this.timeout=0,this.unthrottle=()=>{this.trailing&&this.trailingFn&&this.trailingFn(...this.trailingFnArgs),this.clear()},this.throttleDuration=t,this.trailing=!(e&&e.skipTrailing)}invoke(t,...e){return this.throttled?(this.trailingFn=t,this.trailingFnArgs=e,!1):(this.throttled=!0,this.timeout=window.setTimeout(this.unthrottle,this.throttleDuration),t(...e),!0)}clear(){clearTimeout(this.timeout),this.timeout=0,this.throttled=!1,delete this.trailingFn,delete this.trailingFnArgs}}class SDPFmtpLine{constructor(){this.levelAsymmetryAllowed=!1,this.packetisationMode=!1,this.profile="",this.level=0}extractVideoSdpFmtpLine(t){if(!t)return{levelAsymmetryAllowed:this.levelAsymmetryAllowed,packetisationMode:this.packetisationMode,profile:this.profile,level:this.level};return t.split("\r").join(";").split("\n").join(";").split(" ").join(";").split(";").map((t=>t.trim())).filter(Boolean).forEach((t=>{const e=t.split("=");if(2===e.length)switch(e[0]){case"level-asymmetry-allowed":"1"===e[1]?this.levelAsymmetryAllowed=!0:this.levelAsymmetryAllowed=!1;break;case"packetization-mode":"1"===e[1]?this.packetisationMode=!0:this.packetisationMode=!1;break;case"profile-level-id":this.profile=this.getProfileFromId(e[1]),this.level=this.getLevelFromId(e[1])}})),{levelAsymmetryAllowed:this.levelAsymmetryAllowed,packetisationMode:this.packetisationMode,profile:this.profile,level:this.level}}getProfileFromId(t){const e=t.substr(0,2),n=t.substr(2,2);switch(e.substr(0,2)){case"42":return"baseline";case"4d":return"main";case"58":return"extended";case"64":return"high";case"6e":return"00"===n?"high 10":"high 10 intra";case"7a":return"00"===n?"high 42":"high 42 intra";case"f4":return"00"===n?"high 44":"high 44 intra";default:return"unknown"}}getLevelFromId(t){return parseInt(t.substr(4,2),16)}}function On(t){return btoa(JSON.stringify(t))}var Pn,Nn=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))};!function(t){t.IDLE="idle",t.EXECUTING="executing",t.RECONNECTING="reconnecting"}(Pn||(Pn={}));class BaseReconnectStrategy{constructor(t,e=12e4,n,r){this.state=Pn.IDLE,this.failureCallback=()=>{},this.peerClient=t,this.timeout=e,this.logger=n,this.emitter=r}onFailure(t){this.failureCallback=t}setStartConfig(t,e){this.ingestEndpoint=t,this.streamKey=e}execute(){const{id:t}=this;this.state===Pn.IDLE&&(this.state=Pn.EXECUTING,this.emitter.emit(In.CONNECTION_STATE_CHANGE,kn.CONNECTING),this.logger.info({msg:"Starting execution of reconnect strategy.",id:t}),this.startTimeoutTimer(this.timeout),this.executeStrategy())}startTimeoutTimer(t){this.timeoutTimerId=window.setTimeout((()=>{this.state!==Pn.IDLE&&(this.logger.info({msg:"Reconnect strategy timed out."}),this.stop(),this.emitter.emit(In.CONNECTION_STATE_CHANGE,kn.FAILED),this.failureCallback())}),t)}stop(){this.state=Pn.IDLE,clearTimeout(this.timeoutTimerId),this.stopStrategy()}reconnect(){return Nn(this,void 0,void 0,(function*(){if(this.ingestEndpoint&&this.streamKey){const t=this.peerClient.getConnectionState();try{this.logger.info({msg:"Attempting reconnect."}),t===kn.CONNECTED?this.logger.info({msg:"Already connected! Stopping reconnect strategy."}):(yield this.peerClient.start(this.ingestEndpoint,this.streamKey),this.logger.info({msg:"Reconnect succeeded!"})),this.stop()}catch(t){throw this.logger.error({err:t}),t}}}))}isActive(){return this.state!==Pn.IDLE}}class ExponentialBackoffStrategy extends BaseReconnectStrategy{constructor(){super(...arguments),this.id="ExponentialBackoffStrategy"}executeStrategy(){let t=5e3;const e=()=>Nn(this,void 0,void 0,(function*(){if(this.state===Pn.EXECUTING)try{this.state=Pn.RECONNECTING,yield this.reconnect()}catch(n){this.logger.warn({msg:"Attempted reconnect failed. Trying again in: ",nextRetry:t}),this.state=Pn.EXECUTING,this.currentTimeoutId=window.setTimeout(e,t),t*=2}}));this.currentTimeoutId=window.setTimeout(e,0)}stopStrategy(){clearTimeout(this.currentTimeoutId)}}class NetworkApiStrategy extends BaseReconnectStrategy{constructor(){super(...arguments),this.id="NetworkApiStrategy",this.onConnectionChange=()=>Nn(this,void 0,void 0,(function*(){if(navigator.onLine&&this.state===Pn.EXECUTING){this.state=Pn.RECONNECTING;try{yield this.reconnect()}catch(t){this.logger.warn({msg:"Attempted reconnect failed."}),this.state=Pn.EXECUTING}}}))}executeStrategy(){navigator.connection.addEventListener("change",this.onConnectionChange),this.onConnectionChange()}stopStrategy(){navigator.connection.removeEventListener("change",this.onConnectionChange)}}class PeerClientReconnectStrategyFactory{static create(t,e=ce,n,r){const{reconnect:i,timeout:o}=e;if(i){const e=l.getParser(navigator.userAgent).getBrowserName().toLowerCase();return["edge","chrome"].includes(e)&&navigator.connection?new NetworkApiStrategy(t,o,n,r):new ExponentialBackoffStrategy(t,o,n,r)}}}var xn,Dn,Mn=function(t,e,n,r){var i,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(s=(o<3?i(s):o>3?i(e,n,s):i(e,n))||s);return o>3&&s&&Object.defineProperty(e,n,s),s},jn=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ln=function(t,e){return function(n,r){e(n,r,t)}},Un=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))},Bn=function(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)};const Fn=t=>!!t;function Gn(t){if(!t)throw new Error("PeerConnection is not defined")}const Vn={bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",enableDtlsSrtp:{exact:!0},enableRtpDataChannels:{exact:!1},optional:[{googHighStartBitrate:{exact:0}},{googPayloadPadding:{exact:!0}},{googScreencastMinBitrate:{exact:100}},{googCpuOveruseDetection:{exact:!0}},{googCpuOveruseEncodeUsage:{exact:!0}},{googCpuUnderuseThreshold:{exact:55}},{googCpuOveruseThreshold:{exact:85}},{enableDscp:{exact:!0}}]};let Wn=class PeerClient{constructor(t,e,n){this.config=t,this.emitter=e,this.establishConnection=(t,e)=>Un(this,void 0,void 0,(function*(){var n,r,i;Gn(this.peerConnection);try{const n=yield this.peerConnection.createOffer({offerToReceiveAudio:!1,offerToReceiveVideo:!1});yield this.handleLocalDescription(n),yield this.sendSetupRequest(t,e,n)}catch(t){if(t instanceof Error){null!==(n=(i=t).code)&&void 0!==n||(i.code=It.code);const e=new BroadcastClientError(Object.assign(Object.assign({},It),{name:t.name,message:t.message,code:null==t?void 0:t.code,cause:t}));throw(null===(r=this.reconnectStrategy)||void 0===r?void 0:r.isActive())||this.handleError(t.code,t.message),this.stop(),e}}})),this.getSessionId=()=>this.ingestSessionId,this.getConnectionState=()=>{var t;if(!this.peerConnection)return kn.NONE;const e=null===(t=this.reconnectStrategy)||void 0===t?void 0:t.isActive(),n=this.peerConnection.connectionState||this.peerConnection.iceConnectionState;switch(n){case"new":return kn.NEW;case"closed":return kn.CLOSED;case"disconnected":return e?kn.CONNECTING:kn.DISCONNECTED;case"failed":return e?kn.CONNECTING:kn.FAILED;case"idle":return kn.IDLE;case"checking":case"connecting":return kn.CONNECTING;case"completed":case"connected":return kn.CONNECTED;default:return this.logger.warn({msg:"Unhandled connection state:",rawState:n}),kn.IDLE}},this.onConnectionStateChange=()=>{var t;const e=this.getConnectionState();switch(e){case kn.CONNECTED:{this.emitter.emit(In.CONNECTION_STATE_CHANGE,e);const n=new Date;this.analyticsTracker.trackEvent(new ConnectionEstablishedEvent(n,this.connectionStartDate,this.ingestSessionId));const r=cn.get("audio"),i=cn.get("video");if(i){const t=i.getSettings();this.analyticsTracker.trackEvent(new SessionVideoPropertiesEvent(t))}if(r){const t=r.getSettings();this.analyticsTracker.trackEvent(new SessionAudioPropertiesEvent(t))}((null===(t=this.peerConnection)||void 0===t?void 0:t.getSenders())||[]).forEach((t=>{var e;((null===(e=t.getParameters())||void 0===e?void 0:e.codecs)||[]).forEach((e=>{var n;switch(null===(n=t.track)||void 0===n?void 0:n.kind){case"video":{if(!i)break;const t=(new SDPFmtpLine).extractVideoSdpFmtpLine(e.sdpFmtpLine),n=i.getSettings();this.analyticsTracker.trackEvent(new SessionVideoEncoderConfiguredEvent(n,t,e));break}case"audio":if(!r)break;this.analyticsTracker.trackEvent(new SessionAudioEncoderConfiguredEvent(e))}}))}));break}case kn.CONNECTING:this.emitter.emit(In.CONNECTION_STATE_CHANGE,e),this.connectionStartDate=new Date,this.disconnectionStartDate=void 0;break;case kn.FAILED:this.reconnectStrategy?this.reconnectStrategy.execute():(this.emitter.emit(In.CONNECTION_STATE_CHANGE,e),this.handleTerminalConnectionFailure());break;case kn.DISCONNECTED:this.emitter.emit(In.CONNECTION_STATE_CHANGE,e),this.disconnectionStartDate=new Date;break;default:this.emitter.emit(In.CONNECTION_STATE_CHANGE,e)}},this.handleLocalDescription=t=>Un(this,void 0,void 0,(function*(){var e;return null===(e=this.peerConnection)||void 0===e?void 0:e.setLocalDescription(t)})),xn.set(this,(t=>{if("string"!=typeof t)throw new BroadcastClientError(Pt);try{new URL(t)}catch(t){throw new BroadcastClientError(Nt)}})),this.logger=new ScopedLogger(n,ut.WEBRTC),this.analyticsTracker=AnalyticsTracker.getInstance(),this.createReconnectStrategy(t)}start(t,e){var n;return Un(this,void 0,void 0,(function*(){Bn(this,xn,"f").call(this,t);const r=[cn.get("video"),cn.get("audio")].filter(Fn);this.createPeerConnection(),this.addTracks({tracks:r}),this.reconnectStrategy&&this.reconnectStrategy.setStartConfig(t,e),yield this.establishConnection(t,e);if(null===(n=this.reconnectStrategy)||void 0===n?void 0:n.isActive()){const e=new URL(t);this.analyticsTracker.trackEvent(new StartBroadcastEvent({protocol:"webrtc",hostname:e.hostname,port:e.port},Xe.NETWORK_DISCONNECT))}}))}stop(){var t,e,n,r;this.stateCheckInterval&&(clearInterval(this.stateCheckInterval),this.stateCheckInterval=void 0),this.stopStreamDataChannel&&"open"===this.stopStreamDataChannel.readyState&&this.stopStreamDataChannel.send(" "),[kn.NEW,kn.CONNECTING,kn.CONNECTED].includes(this.getConnectionState())&&this.emitter.emit(In.CONNECTION_STATE_CHANGE,kn.CLOSED),null===(t=this.peerConnection)||void 0===t||t.close(),null===(e=this.peerConnection)||void 0===e||e.removeEventListener("connectionstatechange",this.onConnectionStateChange),null===(n=this.peerConnection)||void 0===n||n.removeEventListener("iceconnectionstatechange",this.onConnectionStateChange),this.ingestSessionId=void 0,null===(r=this.reconnectStrategy)||void 0===r||r.stop()}addTracks(t){var e;if(Gn(this.peerConnection),!t)return;const n=this.peerConnection.getSenders().map((t=>{var e;return null===(e=t.track)||void 0===e?void 0:e.id})),r=t.tracks.filter((t=>!n.includes(t.id)));for(const t of r)null===(e=this.peerConnection)||void 0===e||e.addTrack(t)}getReports(){var t;return Un(this,void 0,void 0,(function*(){try{const e=(yield null===(t=this.peerConnection)||void 0===t?void 0:t.getStats())||[],n=[];return e.forEach((t=>{n.push(t)})),n}catch(t){return[]}}))}sendSetupRequest(t,e,n){var r;return Un(this,void 0,void 0,(function*(){const i=yield fetch(`${t}/v1/offer`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Object.assign({offer:On(n),streamKey:e},this.config.streamConfig))});if(!i.ok)throw function(t){let e=new BroadcastClientError(Object.assign({},It));(null==t?void 0:t.code)===ot&&(e=new BroadcastClientError(Object.assign({},At)));(null==t?void 0:t.message)&&(e.message=t.message);return e}(yield i.json());const o=yield i.json();(null==o?void 0:o.answer)&&(yield null===(r=this.peerConnection)||void 0===r?void 0:r.setRemoteDescription(function(t){return JSON.parse(atob(t))}(o.answer)),this.ingestSessionId=o.ingestSessionId)}))}handleTerminalConnectionFailure(){const t=new BroadcastClientError(Rt);this.handleError(t.code,t.message)}handleError(t,e){this.analyticsTracker.trackEvent(new ErrorEvent({code:t,description:e,isFatal:!0})),this.emitter.emit(In.ERROR,{code:t,message:e})}createPeerConnection(){var t;const e=this.getConnectionState(),n=e!==kn.NONE,r=e!==kn.CLOSED,i=null===(t=this.reconnectStrategy)||void 0===t?void 0:t.isActive();n&&r&&!i||(this.stateCheckInterval&&(clearInterval(this.stateCheckInterval),this.stateCheckInterval=void 0),this.stateCheckInterval=window.setInterval((()=>{const t=this.getConnectionState();if(this.reconnectStrategy&&t===kn.DISCONNECTED&&this.disconnectionStartDate){const t=Date.now()-this.disconnectionStartDate.getTime();this.logger.info({msg:"Time since disconnected:",timeSinceDisconnect:t}),t>1e4&&(this.disconnectionStartDate=void 0,this.reconnectStrategy.execute())}else t===kn.CLOSED&&(this.handleTerminalConnectionFailure(),clearInterval(this.stateCheckInterval),this.stateCheckInterval=void 0)}),1e3),this.peerConnection=new RTCPeerConnection(Vn),this.stopStreamDataChannel=this.peerConnection.createDataChannel("stopStream"),this.peerConnection.addEventListener("connectionstatechange",this.onConnectionStateChange),this.peerConnection.addEventListener("iceconnectionstatechange",this.onConnectionStateChange))}createReconnectStrategy(t){if(this.reconnectStrategy=PeerClientReconnectStrategyFactory.create(this,t.networkReconnectConfig,this.logger,this.emitter),this.reconnectStrategy){this.reconnectStrategy.onFailure(this.handleTerminalConnectionFailure.bind(this));const t=this.reconnectStrategy.id;this.logger.info({msg:"Using reconnect strategy:",strategyId:t})}}};xn=new WeakMap,Wn=Mn([X(),Ln(0,rt(it.CONFIG)),Ln(1,rt(it.EMITTER)),Ln(2,rt(it.LOGGER)),jn("design:paramtypes",[Object,Object,"function"==typeof(Dn=void 0!==be&&be)?Dn:Object])],Wn);class ServerRequestEvent extends StageAnalyticsEvent{constructor(t,e,n,r,i,o,s){super(c.SERVER_REQUEST,e,s,!0),Object.assign(this.properties,{action:t,http_method:r,remote_participant_id:o,request_uuid:i,url:n})}}const qn="draft-ietf-wish-whip-04";var zn=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))};function $n(t,e){return zn(this,void 0,void 0,(function*(){t.validateStatus=t=>t>=200&&t<300||403===t;const n=yield Qe()(t);return 403===n.status?t.url===n.request.responseURL?(t.validateStatus=t=>t>=200&&t<300,Qe()(t)):(t.url=n.request.responseURL,e<5?$n(t,e+1):(t.validateStatus=t=>t>=200&&t<300,Qe()(t))):n}))}function Hn(t){return zn(this,void 0,void 0,(function*(){return $n(t,0)}))}var Kn=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))};function Jn({action:t,identifier:e,token:n,traceId:r,tag:i}){return Kn(this,void 0,void 0,(function*(){const o=He(n),s=p(),a=AnalyticsTracker.getInstance();try{const i=Ke({action:t,identifier:e,token:n});if(!i)throw Error("Could not find URL in token");const c="OPTIONS";a.trackEventNoSharedProps(new ServerRequestEvent(t,o,i,c,s.value,e,r));const u=AbortControllersTracker.getInstance().trackNewAbortController(e),{headers:d,request:l}=yield Hn({headers:{Authorization:`Bearer ${n}`,"X-Stages-Platform":"web","X-Stages-Request-ID":s.value,"X-Stages-SDK":"1.3.0","X-Stages-Session-ID":m(o),"X-Stages-Trace-ID":r.value,"X-Stages-WHIP-Version":qn},method:c,url:i,signal:u.signal});if(!d.link)throw Error("Headers returned from OPTIONS request missing link entry");const h=[];if(d.link.split(",").forEach((t=>{const e={credential:"",urls:"",username:""};t.split(";").forEach((t=>{const n=t.split(/=(.*)/s);if(t.startsWith("turn:")||t.startsWith("<turn:")){let n=t.trim();n.startsWith("<turn:")&&n.endsWith(">")&&(n=n.slice(1,-1)),e.urls=n}else if(3===n.length){const t=n[1].trim().slice(1,-1);switch(n[0].trim()){case"credential":e.credential=t;break;case"username":e.username=t}}})),""!==e.credential&&""!==e.urls&&""!==e.username&&h.push(e)})),0===h.length)throw Error("OPTIONS response contained link header, but no valid ICE Servers");return{iceCredentials:h,responseURL:l.responseURL}}catch(t){Qe().isCancel(t)&&a.trackErrorAndThrow(new StageClientError(Object.assign(Object.assign({},Ve(qe.OPERATION_ABORTED,t)),{token:o,tag:i,traceId:r,location:"getTurnCredentials",remoteParticipantId:e,requestUUID:s})));const n=function(t){var e,n,r,i,o;if(!(null===(e=t.response)||void 0===e?void 0:e.status))return;const s=Number(null===(n=t.response)||void 0===n?void 0:n.status);if(!(s<400)){if(s>=400&&s<=403&&(null===(r=t.response)||void 0===r?void 0:r.data)&&(null===(i=t.response)||void 0===i?void 0:i.data).code)switch((null===(o=t.response)||void 0===o?void 0:o.data).code){case We.TokenExpired:return qe.EXPIRED_TOKEN;case We.NoPermissions:return qe.TOKEN_PERMISSIONS_DENIED;case We.StageAtCapacity:return qe.STAGE_AT_CAPACITY;default:return qe.UNKNOWN_PERMISSIONS_ERROR}switch(s){case 404:return qe.WHIP_SESSION_RESOURCE_DELETED;case 429:return qe.WHIP_TOO_MANY_REQUESTS;case 500:return qe.INTERNAL_SERVER_ERROR;default:return qe.UNKNOWN_PERMISSIONS_ERROR}}}(t);n&&a.trackErrorAndThrow(new StageClientError(Object.assign(Object.assign({},Ve(n,t)),{token:o,tag:i,traceId:r,location:"getTurnCredentials",remoteParticipantId:e,requestUUID:s}))),a.trackErrorAndThrow(new StageClientError(Object.assign(Object.assign({},Ve(qe.WHIP_OPTIONS_FAILURE,t)),{token:o,tag:i,traceId:r,location:"getTurnCredentials",remoteParticipantId:e,requestUUID:s})))}}))}class PublishedVideoStatsEvent extends StageAnalyticsEvent{constructor(t,e,n){var r;super(c.PUBLISHED_VIDEO_STATS,t,e,!1),Object.assign(this.properties,Object.assign({action:Ee.PUBLISH},{bytes_sent:(r=n).bytesSent,fir_count:r.firCount,frames_encoded:r.framesEncoded,frames_sent:r.framesSent,header_bytes_sent:r.headerBytesSent,huge_frames_sent:r.hugeFramesSent,key_frames_encoded:r.keyFramesEncoded,nack_count:r.nackCount,packets_sent:r.packetsSent,pli_count:r.pliCount,quality_limitation_reason:r.qualityLimitationReason,quality_limitation_resolution_changes:r.qualityLimitationResolutionChanges,retransmitted_bytes_sent:r.retransmittedBytesSent,retransmitted_packets_sent:r.retransmittedPacketsSent,total_encode_time:r.totalEncodeTime,total_encoded_bytes_target:r.totalEncodedBytesTarget,total_packet_send_delay:r.totalPacketsSendDelay}))}}class PublishedAudioStatsEvent extends StageAnalyticsEvent{constructor(t,e,n){var r;super(c.PUBLISHED_AUDIO_STATS,t,e,!1),Object.assign(this.properties,Object.assign({action:Ee.PUBLISH},{bytes_sent:(r=n).bytesSent,header_bytes_sent:r.headerBytesSent,nack_count:r.nackCount,packets_sent:r.packetsSent,retransmitted_bytes_sent:r.retransmittedBytesSent,retransmitted_packets_sent:r.retransmittedPacketsSent}))}}class SubscribedVideoStatsEvent extends StageAnalyticsEvent{constructor(t,e,n,r){var i;super(c.SUBSCRIBED_VIDEO_STATS,t,e,!1),Object.assign(this.properties,Object.assign({action:Ee.SUBSCRIBE,remote_participant_id:n},{bytes_received:(i=r).bytesReceived,fir_count:i.firCount,frames_decoded:i.framesDecoded,frames_dropped:i.framesDropped,frames_received:i.framesReceived,header_bytes_received:i.headerBytesReceived,jitter_buffer_delay:i.jitterBufferDelay,key_frames_decoded:i.keyFramesDecoded,nack_count:i.nackCount,packets_discarded:i.packetsDiscarded,packets_lost:i.packetsLost,packets_received:i.packetsReceived,pli_count:i.pliCount,total_freezes_duration:i.totalFreezesDuration,total_pauses_duration:i.totalPausesDuration,freeze_count:i.freezeCount,pause_count:i.pauseCount}))}}class SubscribedAudioStatsEvent extends StageAnalyticsEvent{constructor(t,e,n,r){var i;super(c.SUBSCRIBED_AUDIO_STATS,t,e,!1),Object.assign(this.properties,Object.assign({action:Ee.SUBSCRIBE,remote_participant_id:n},{bytes_received:(i=r).bytesReceived,concealed_samples:i.concealedSamples,header_bytes_received:i.headerBytesReceived,inserted_samples_for_deceleration:i.insertedSamplesForDeceleration,jitter_buffer_delay:i.jitterBufferDelay,packets_discarded:i.packetsDiscarded,packets_lost:i.packetsLost,packets_received:i.packetsReceived,removed_samples_for_acceleration:i.removedSamplesForAcceleration,total_samples_received:i.totalSamplesReceived}))}}class MinuteEvent extends StageAnalyticsEvent{constructor(t,e,n,r,i){super(c.MINUTE,t,e,!1),Object.assign(this.properties,{action:r?Ee.PUBLISH:Ee.SUBSCRIBE,is_publishing:r,minutes_logged:n,subscribed_number:i})}}class ConnectionStateEvent extends StageAnalyticsEvent{constructor(t,e,n,r,i){super(c.CONNECTION_STATE,e,n,!1),Object.assign(this.properties,{action:t,remote_participant_id:i,state:r})}}class IceGatheringStateEvent extends StageAnalyticsEvent{constructor(t,e,n,r,i){super(c.ICE_GATHERING_STATE,e,n,!1),Object.assign(this.properties,{action:t,remote_participant_id:i,state:r})}}var Xn;!function(t){t.OPTIONS="options",t.POST="post",t.CONNECTED="connected",t.ICE_GATHERING="icegathering"}(Xn||(Xn={}));const Yn="start",Zn="stop";class PeerClientPerformanceTracker{constructor(t,e){this.marks={},this.optionsDuration=0,this.postDuration=0,this.timeToCandidate=0,this.timeToConnected=0,this.action=t,this.traceId=e}markActionStart(){this.markStart(Xn.OPTIONS),this.markStart(Xn.CONNECTED)}markOptionsStop(){this.markStop(Xn.OPTIONS),this.optionsDuration=this.measure(Xn.OPTIONS)}markPostStart(){this.markStart(Xn.POST)}markPostStop(){this.markStop(Xn.POST),this.postDuration=this.measure(Xn.POST)}markIceGatheringStart(){this.markStart(Xn.ICE_GATHERING)}markIceGatheringStop(){this.markStop(Xn.ICE_GATHERING),this.timeToCandidate=this.measure(Xn.ICE_GATHERING)}markActionStop(){this.markStop(Xn.CONNECTED),this.timeToConnected=this.measure(Xn.CONNECTED)}markStart(t){this.marks[`${this.namespace}.${t}.${Yn}`]=performance.now()}markStop(t){this.marks[`${this.namespace}.${t}.${Zn}`]=performance.now()}measure(t){const e=`${this.namespace}.${t}.${Yn}`,n=`${this.namespace}.${t}.${Zn}`,r=this.marks[e],i=this.marks[n];return void 0===r||void 0===i?0:i-r}get namespace(){return`ivswb.peerclient.${this.action}.${this.traceId.value}`}getMeasurements(){const{optionsDuration:t,postDuration:e,timeToCandidate:n,timeToConnected:r}=this;return{optionsDuration:t,postDuration:e,timeToCandidate:n,timeToConnected:r}}}var Qn=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))};let tr=null;class StagePeerClient{constructor(t,e,n,r,i,o,s){if(this.tracks=[],this.sentOffer=!1,this.v2=!1,this.minutesLogged=0,this.connect=(t=!1,e)=>Qn(this,void 0,void 0,(function*(){const{token:n,tag:r,identifier:i,action:o}=this;let s,a;this.traceId=e;const c=new Promise(((t,e)=>{const c=setTimeout((()=>{this.stop();const t=o===Ee.SUBSCRIBE?qe.SUBSCRIBE_TIMED_OUT:qe.PUBLISH_TIMED_OUT,s=new StageClientError(Object.assign(Object.assign({},t),{token:n,traceId:this.traceId,tag:r,location:"connect",remoteParticipantId:i}));this.analyticsTracker.trackError(s),e(s)}),1e4);s=t=>{clearTimeout(c),this.stop(),e(t)},a=e=>{e===kn.CONNECTED&&(clearTimeout(c),t())},this.emitter.on(An,s),this.emitter.on(Rn,a)}));let u=null;yield this.start(),o===Ee.SUBSCRIBE?u=yield this.addTransceivers(t):o===Ee.PUBLISH&&(u=yield this.addTransceivers());try{yield c}finally{this.emitter.off(An,s),this.emitter.off(Rn,a)}return AbortControllersTracker.getInstance().removeAbortController(i),{mediaStream:u}})),this.disconnect=()=>Qn(this,void 0,void 0,(function*(){const{token:t,action:e}=this;this.stop(),AbortControllersTracker.getInstance().isUnloading?this.cleanup(e,t.participantID,t):yield this.cleanup(e,t.participantID,t)})),this.onTrack=t=>{const{token:e,action:n,traceId:r,identifier:i}=this;hn(e,r,`onTrack: ${t.track.kind}`,n,i)},this.onIceGatheringStateChange=()=>{var t,e;const{token:n,action:r,traceId:i,identifier:o}=this;if("gathering"===(null===(t=this.peerConnection)||void 0===t?void 0:t.iceGatheringState)&&this.perfTracker.markIceGatheringStart(),this.peerConnection){const t=this.peerConnection.iceGatheringState,e=new IceGatheringStateEvent(r,n,i,t,o);this.analyticsTracker.trackEventNoSharedProps(e)}hn(n,i,`ICE gathering state change: ${null===(e=this.peerConnection)||void 0===e?void 0:e.iceGatheringState}`,r,o)},this.onIceCandidate=t=>Qn(this,void 0,void 0,(function*(){var e,n,r,i;const{token:o,identifier:s,action:a,sentOffer:c,responseURL:u,traceId:d}=this,l=null===(e=t.target.localDescription)||void 0===e?void 0:e.sdp.includes("relay");if(this.analyticsTracker.trackEventNoSharedProps(new TraceEvent(this.token,d,`ice candidate: hasRelay = ${l}, candidate = ${null===(n=t.candidate)||void 0===n?void 0:n.candidate}`,a,s)),!l&&o.shouldUseTURN()||c||void 0===(null===(r=t.candidate)||void 0===r?void 0:r.candidate)||(this.perfTracker.markIceGatheringStop(),this.sentOffer=!0,this.perfTracker.markPostStart(),yield this.fetchAndSetRemoteDescription(a,s,o,this.responseURL),this.perfTracker.markPostStop()),!c&&void 0===(null===(i=t.candidate)||void 0===i?void 0:i.candidate)){const t=new StageClientError(Object.assign(Object.assign({},qe.NO_CANDIDATES),{token:o,traceId:d,tag:Ge(a,s),location:"StagePeerClient.start",remoteParticipantId:s}));return this.analyticsTracker.trackError(t),void this.emitter.emit(An,t)}})),this.onMute=()=>Qn(this,void 0,void 0,(function*(){const{token:t,action:e,traceId:n,identifier:r}=this;hn(t,n,"Track has muted",e,r)})),this.onUnMute=()=>Qn(this,void 0,void 0,(function*(){const{token:t,action:e,traceId:n,identifier:r}=this;hn(t,n,"Track has unmuted",e,r)})),this.stopRemoteVideo=()=>{if(!this.videoTransceiver){const t=new Error("no video transciever to stop");throw this.logger.error({err:t,msg:"error stopping video"}),t}const{mid:t}=this.videoTransceiver;if(!t){const t=new Error("no mid for transceiver");throw this.logger.error({err:t,msg:"error stopping video"}),t}this.sendMediaControlsRequest({pause:[t]})},this.startRemoteVideo=()=>{if(!this.videoTransceiver){const t=new Error("no video transciever to start");throw this.logger.error({err:t,msg:"error starting video"}),t}const{mid:t}=this.videoTransceiver;if(!t){const t=new Error("no mid for transceiver");throw this.logger.error({err:t,msg:"error starting video"}),t}this.sendMediaControlsRequest({play:[t]})},this.sendMediaControlsRequest=t=>{var e;if(this.action!==Ee.SUBSCRIBE){const t=new Error("media controls not supported for publisher peer connections");throw this.logger.error({err:t,msg:"tried to send media controls request for PUBLISHER peer connection"}),t}if(!(null===(e=this.whipResource)||void 0===e?void 0:e.mediaControls)){const t=new Error("media controls url undefined");throw this.logger.error({err:t,msg:"error sending media controls request"}),t}const{mediaControls:n}=this.whipResource,r=p();Qe().post(n,JSON.stringify(t),{headers:{Authorization:`Bearer ${this.token.rawToken}`,"Content-Type":"application/json","X-Stages-Platform":"web","X-Stages-Request-ID":r.value,"X-Stages-SDK":"1.3.0","X-Stages-Session-ID":m(this.token),"X-Stages-Trace-ID":this.traceId.value,"X-Stages-WHIP-Version":qn}}).then((t=>{if(t.status>=300){const e=new Error(`got bad status ${t.status} from media controls request`);throw this.logger.error({err:e,msg:"error sending media controls request"}),e}}),(t=>{throw t}))},this.fetchAndSetRemoteDescription=(t,e,n,r)=>Qn(this,void 0,void 0,(function*(){var i,o,s,a;const c=p();try{const u="POST";this.analyticsTracker.trackEventNoSharedProps(new ServerRequestEvent(t,n,r,u,c.value,e,this.traceId));const d=AbortControllersTracker.getInstance().trackNewAbortController(e),{data:l,headers:h,request:p}=yield Hn({data:null===(o=null===(i=this.peerConnection)||void 0===i?void 0:i.localDescription)||void 0===o?void 0:o.sdp,headers:{Authorization:`Bearer ${n.rawToken}`,"Content-Type":"application/sdp","X-Stages-Platform":"web","X-Stages-Request-ID":c.value,"X-Stages-SDK":"1.3.0","X-Stages-Session-ID":m(n),"X-Stages-Trace-ID":this.traceId.value,"X-Stages-WHIP-Version":qn},method:u,responseType:"text",url:r,signal:d.signal});if(h.location){const t=new URL(p.responseURL),e=t.port?`:${t.port}`:"";this.whipResource={path:`${t.protocol}//${t.hostname}${e}${h.location}`}}null===(s=h.link)||void 0===s||s.split(",").forEach((t=>{const e=this.parseWhipLinkExtension(t);if(3===(null==e?void 0:e.length))switch(e[2]){case"urn:ietf:params:whip:ivs-stages:session-delete":{const t=new URL(p.responseURL),n=t.port?`:${t.port}`:"";this.whipResource&&(this.whipResource.sessionDelete=`${t.protocol}//${t.hostname}${n}${e[1]}`);break}case"urn:ietf:params:whep:core:playback-controls":{const t=new URL(p.responseURL),n=t.port?`:${t.port}`:"";this.whipResource&&(this.whipResource.mediaControls=`${t.protocol}//${t.hostname}${n}${e[1]}`);break}}})),yield null===(a=this.peerConnection)||void 0===a?void 0:a.setRemoteDescription({sdp:l,type:"answer"})}catch(r){if(Qe().isCancel(r)){const i=new StageClientError(Object.assign(Object.assign({},Ve(qe.OPERATION_ABORTED,r)),{token:n,traceId:this.traceId,tag:Ge(t,e),location:"StagePeerClient.start",requestUUID:c,remoteParticipantId:e}));return this.analyticsTracker.trackError(i),void this.emitter.emit(An,i)}const i=new StageClientError(Object.assign(Object.assign({},Ve(qe.WHIP_POST_FAILURE,r)),{token:n,traceId:this.traceId,tag:Ge(t,e),location:"StagePeerClient.start",requestUUID:c,remoteParticipantId:e}));this.analyticsTracker.trackError(i),this.emitter.emit(An,i)}})),this.cleanup=(t,e,n)=>Qn(this,void 0,void 0,(function*(){var r,i,o,s;let a=Ke({action:t,identifier:e,token:n.rawToken,whipURLOverride:this.whipUrlOverride});const c=p();if(hn(n,this.traceId,`token dataplane url: ${a}`,t,e),(null===(r=this.whipResource)||void 0===r?void 0:r.path)&&(a=null===(i=this.whipResource)||void 0===i?void 0:i.path,hn(n,this.traceId,`use hostnamecachedurl: ${a}`,t,e)),a||this.analyticsTracker.trackErrorAndThrow(new StageClientError(Object.assign(Object.assign({},qe.WHIP_URL_MISSING),{token:n,traceId:this.traceId,tag:Ge(t,e),location:t===Ee.SUBSCRIBE?"unsubscribe":"unpublish",requestUUID:c,remoteParticipantId:e}))),AbortControllersTracker.getInstance().isUnloading){if(null===(s=this.whipResource)||void 0===s?void 0:s.sessionDelete){a=this.whipResource.sessionDelete,hn(n,this.traceId,`DELETE via session-delete beacon path: ${a}`,t,e);try{navigator.sendBeacon(a,JSON.stringify({authorization:n.rawToken}))}catch(r){this.analyticsTracker.trackErrorAndThrow(new StageClientError(Object.assign(Object.assign({},Ve(qe.WHIP_DELETE_FAILURE,r)),{token:n,traceId:this.traceId,tag:Ge(t,e),location:Ee.SUBSCRIBE?"unsubscribe":"unpublish",requestUUID:c,remoteParticipantId:e})))}}}else try{yield Qe().delete(a,{headers:{Authorization:`Bearer ${n.rawToken}`,"X-Stages-Platform":"web","X-Stages-Request-ID":c.value,"X-Stages-SDK":"1.3.0","X-Stages-Session-ID":m(n),"X-Stages-Trace-ID":this.traceId.value,"X-Stages-WHIP-Version":qn}})}catch(r){404===(null===(o=r.response)||void 0===o?void 0:o.status)?hn(n,this.traceId,`DELETE returned 404, ignoring, action = ${t}, uuid = ${c.value}`,t,e):this.analyticsTracker.trackErrorAndThrow(new StageClientError(Object.assign(Object.assign({},Ve(qe.WHIP_DELETE_FAILURE,r)),{token:n,traceId:this.traceId,tag:Ge(t,e),location:Ee.SUBSCRIBE?"unsubscribe":"unpublish",requestUUID:c,remoteParticipantId:e})))}})),this.getConnectionState=()=>{if(!this.peerConnection)return kn.NONE;const t=this.peerConnection.connectionState||this.peerConnection.iceConnectionState;switch(t){case"new":return kn.NEW;case"closed":return kn.CLOSED;case"disconnected":return kn.DISCONNECTED;case"failed":return kn.FAILED;case"idle":return kn.IDLE;case"checking":case"connecting":return kn.CONNECTING;case"completed":case"connected":return kn.CONNECTED;default:return this.logger.warn({msg:"Unhandled connection state:",rawState:t}),kn.IDLE}},this.getValidPeerConnectionCanThrow=()=>{if(!this.peerConnection)throw new Error("missing peer connection");return this.peerConnection},this.onIceCandidateError=t=>{const{token:e,traceId:n,tag:r}=this;if(701!==t.errorCode){const t=new StageClientError(Object.assign(Object.assign({},qe.ICE_CANDIDATE_ERROR),{token:e,traceId:n,tag:r,location:"onIceCandidateError",remoteParticipantId:this.identifier}));this.analyticsTracker.trackError(t),this.emitter.emit(An,t)}},this.onIceConnectionStateChange=()=>{var t;const{token:e,traceId:n,action:r,identifier:i}=this;hn(e,n,`ICE connection state change: ${null===(t=this.peerConnection)||void 0===t?void 0:t.iceConnectionState}`,r,i),this.onConnectionStateChange()},this.onConnectionStateChange=()=>{var t;if(this.peerConnection){const t=this.peerConnection.connectionState||this.peerConnection.iceConnectionState,{token:e,traceId:n,identifier:r,action:i}=this,o=new ConnectionStateEvent(i,e,n,t,r);this.analyticsTracker.trackEventNoSharedProps(o),hn(e,n,`connection state change: ${t}`,i,r)}const e=this.getConnectionState();switch(e){case kn.CONNECTED:{this.perfTracker.markActionStop(),this.emitter.emit(Rn,e),this.uploadStats(),this.uploadStatsInterval=setInterval((()=>{this.uploadStats()}),1e4),this.action===Ee.PUBLISH&&(this.uploadMinutesPublished(),this.minutesUploadedInterval=setInterval((()=>{this.uploadMinutesPublished()}),6e4));const n=cn.get("audio"),r=cn.get("video");if(r){const t=r.getSettings();this.analyticsTracker.trackEvent(new SessionVideoPropertiesEvent(t))}if(n){const t=n.getSettings();this.analyticsTracker.trackEvent(new SessionAudioPropertiesEvent(t))}((null===(t=this.peerConnection)||void 0===t?void 0:t.getSenders())||[]).forEach((t=>{var e;((null===(e=t.getParameters())||void 0===e?void 0:e.codecs)||[]).forEach((e=>{var i;switch(null===(i=t.track)||void 0===i?void 0:i.kind){case"video":{if(!r)break;const t=(new SDPFmtpLine).extractVideoSdpFmtpLine(e.sdpFmtpLine),n=r.getSettings();this.analyticsTracker.trackEvent(new SessionVideoEncoderConfiguredEvent(n,t,e));break}case"audio":if(!n)break;this.analyticsTracker.trackEvent(new SessionAudioEncoderConfiguredEvent(e))}}))}));break}case kn.FAILED:this.emitter.emit(Rn,e),this.handleConnectionFailure();break;default:this.emitter.emit(Rn,e)}},this.token=t,this.logger=new ScopedLogger(e,ut.WEBRTC),this.action=n,this.tag=r,this.traceId=i,this.analyticsTracker=AnalyticsTracker.getInstance(),this.emitter=new u,n===Ee.SUBSCRIBE&&!o)throw new Error("Subscribe action provided without subscriber Id");this.subscriberId=o,this.perfTracker=new PeerClientPerformanceTracker(this.action,this.traceId),this.whipUrlOverride=s}setV2(){this.v2=!0}start(){return Qn(this,void 0,void 0,(function*(){const{token:t,action:e,traceId:n,identifier:r}=this;let i=Ke({action:e,identifier:r,token:t.rawToken,whipURLOverride:this.whipUrlOverride}),o=[];try{t.shouldUseTURN()&&(this.perfTracker.markActionStart(),({iceCredentials:o,responseURL:i}=yield Jn({action:e,identifier:r,token:t.rawToken,traceId:n,tag:this.tag})),this.perfTracker.markOptionsStop(),this.analyticsTracker.trackEventNoSharedProps(new TraceEvent(this.token,n,`ice url list = ${o.map((t=>t.urls))}`,e,r))),this.sentOffer=!1,this.responseURL=i,this.peerConnection=new RTCPeerConnection({iceServers:o,iceTransportPolicy:t.shouldUseTURN()?"relay":"all"}),this.peerConnection.addEventListener("connectionstatechange",this.onConnectionStateChange),this.peerConnection.addEventListener("iceconnectionstatechange",this.onIceConnectionStateChange),this.peerConnection.addEventListener("icecandidateerror",this.onIceCandidateError),this.peerConnection.addEventListener("icegatheringstatechange",this.onIceGatheringStateChange),this.peerConnection.addEventListener("icecandidate",this.onIceCandidate),this.peerConnection.addEventListener("track",this.onTrack),this.peerConnection.addEventListener("mute",this.onMute),this.peerConnection.addEventListener("unmute",this.onUnMute),hn(t,n,"peer connection created",e,r)}catch(i){const o=new StageClientError(Object.assign(Object.assign({},Ve(qe.CREATE_PEER_CONNECTION_FAILURE,i)),{token:t,traceId:n,tag:Ge(e,r),location:"StagePeerClient.start",remoteParticipantId:r}));e===Ee.PUBLISH&&this.emitter.emit(Rn,kn.FAILED),this.emitter.emit(An,o),this.analyticsTracker.trackErrorAndThrow(o)}}))}stop(){var t,e,n,r,i,o,s,a,c;clearInterval(this.minutesUploadedInterval),clearInterval(this.uploadStatsInterval),null===(t=this.peerConnection)||void 0===t||t.removeEventListener("connectionstatechange",this.onConnectionStateChange),null===(e=this.peerConnection)||void 0===e||e.removeEventListener("iceconnectionstatechange",this.onIceConnectionStateChange),null===(n=this.peerConnection)||void 0===n||n.removeEventListener("icecandidateerror",this.onIceCandidateError),null===(r=this.peerConnection)||void 0===r||r.removeEventListener("icegatheringstatechange",this.onIceGatheringStateChange),null===(i=this.peerConnection)||void 0===i||i.removeEventListener("track",this.onTrack),null===(o=this.peerConnection)||void 0===o||o.removeEventListener("mute",this.onMute),null===(s=this.peerConnection)||void 0===s||s.removeEventListener("unmute",this.onUnMute),null===(a=this.peerConnection)||void 0===a||a.removeEventListener("icecandidate",this.onIceCandidate),null===(c=this.peerConnection)||void 0===c||c.close()}getTransceiverForKind(t){if(!this.peerConnection)return;const e=this.peerConnection.getTransceivers();return"audio"===t?e.find((t=>"0"===t.mid)):"video"===t?e.find((t=>"1"===t.mid)):void 0}removeTrack(t){return Qn(this,void 0,void 0,(function*(){const e="audio"===t||"video"===t;if(this.peerConnection&&e)try{const e=this.getTransceiverForKind(t);if(!e)return void this.logger.warn({msg:`tried removing track type ${t} but couldn't find transceiver`});yield e.sender.replaceTrack(null)}catch(t){this.logger.warn({msg:"error replacing track",err:t})}}))}replaceTrack(t){return Qn(this,void 0,void 0,(function*(){if(this.peerConnection&&t)try{const e=this.getTransceiverForKind(t.kind);if(!e)return void this.logger.warn({msg:`tried replacing track type ${t.kind} but couldn't find transceiver`,track:t});yield e.sender.replaceTrack(t)}catch(t){this.logger.warn({msg:"error replacing track",err:t})}}))}addTransceivers(t){return Qn(this,void 0,void 0,(function*(){const{tracks:e,traceId:n,token:r,action:i,identifier:o}=this;Gn(this.peerConnection);let s=null;const a=e.find((t=>"video"===(null==t?void 0:t.kind)));let c,u=e.find((t=>"audio"===(null==t?void 0:t.kind)));if(u||(u=this.getSilentAudio()),i===Ee.PUBLISH){if(!a&&!this.v2)throw new Error("We cannot configure transceivers without a video track");const t=this.peerConnection.getTransceivers(),e=[];t.forEach((t=>{var n;e.concat(null===(n=t.sender.track)||void 0===n?void 0:n.id)}));const s=new MediaStream([u,a].filter((t=>!!t&&!e.includes(t.id)))),c=s.getAudioTracks()[0]||"audio",d=s.getVideoTracks()[0]||"video",l={direction:"sendonly",streams:[s]},h=Object.assign(Object.assign({},l),{sendEncodings:[{maxFramerate:30}]});this.peerConnection.addTransceiver(c,l),hn(r,n,`track added, type: ${c.kind||c}`,i,o),this.peerConnection.addTransceiver(d,h),hn(r,n,`track added, type: ${d.kind||d}`,i,o)}else i===Ee.SUBSCRIBE&&(r.shouldSendSilentAudio()?this.peerConnection.addTransceiver(u,{direction:"sendrecv"}):this.peerConnection.addTransceiver("audio",{direction:"recvonly"}),hn(r,n,"track added, type: audio",i,o),t||(this.videoTransceiver=this.peerConnection.addTransceiver("video",{direction:"recvonly"}),hn(r,n,"track added, type: video",i,o)),s=new MediaStream,this.peerConnection.getTransceivers().forEach((t=>{t.receiver?(this.logger.info({msg:"dbg: Subscribe succeeded, adding media track to participant mediaStream"}),null==s||s.addTrack(t.receiver.track)):this.logger.info({msg:"dbg: Subscribe succeeded, but Transceiver were negotiated without Receiver"})})));try{hn(this.token,n,"Creating offer",this.action,o),c=yield this.peerConnection.createOffer(),hn(this.token,n,"Setting local description",this.action,o)}catch(t){const e=new StageClientError(Object.assign(Object.assign({},Ve(qe.CREATE_OFFER_FAILURE,t)),{token:this.token,traceId:n,tag:this.tag,location:"addTransceivers",remoteParticipantId:o}));this.emitter.emit(An,e),this.analyticsTracker.trackErrorAndThrow(e)}return yield this.peerConnection.setLocalDescription(c),hn(this.token,n,"local description set",this.action,o),s}))}getReports(){var t;return Qn(this,void 0,void 0,(function*(){try{const e=(yield null===(t=this.peerConnection)||void 0===t?void 0:t.getStats())||[],n=[];return e.forEach((t=>{n.push(t)})),n}catch(t){return[]}}))}requestRTCStats(t){return Qn(this,void 0,void 0,(function*(){if(this.peerConnection)return this.peerConnection.getStats(t)}))}get identifier(){return this.subscriberId||this.token.participantID}handleConnectionFailure(){return Qn(this,void 0,void 0,(function*(){const{token:t,traceId:e,tag:n}=this;this.analyticsTracker.trackError(new StageClientError(Object.assign(Object.assign({},qe.PEER_CONNECTION_NETWORK_FAILURE),{token:t,traceId:e,tag:n,location:"onIceCandidateError",remoteParticipantId:this.identifier})));try{yield this.uploadStatsOnce()}catch(t){}}))}uploadStats(){var t,e,n;return Qn(this,void 0,void 0,(function*(){"failed"!==(null===(t=this.peerConnection)||void 0===t?void 0:t.iceConnectionState)&&"closed"!==(null===(e=this.peerConnection)||void 0===e?void 0:e.iceConnectionState)&&"new"!==(null===(n=this.peerConnection)||void 0===n?void 0:n.iceConnectionState)&&(yield this.uploadStatsOnce())}))}uploadStatsOnce(){var t;return Qn(this,void 0,void 0,(function*(){const e=yield null===(t=this.peerConnection)||void 0===t?void 0:t.getStats();null==e||e.forEach((t=>{if(this.action===Ee.PUBLISH&&"outbound-rtp"===t.type)switch(t.kind){case"audio":this.analyticsTracker.trackEventNoSharedProps(new PublishedAudioStatsEvent(this.token,this.traceId,t));break;case"video":this.analyticsTracker.trackEventNoSharedProps(new PublishedVideoStatsEvent(this.token,this.traceId,t))}else if(this.action===Ee.SUBSCRIBE&&"inbound-rtp"===t.type)switch(t.kind){case"audio":this.analyticsTracker.trackEventNoSharedProps(new SubscribedAudioStatsEvent(this.token,this.traceId,this.identifier,t));break;case"video":this.analyticsTracker.trackEventNoSharedProps(new SubscribedVideoStatsEvent(this.token,this.traceId,this.identifier,t))}}))}))}on(t,e,n){this.emitter.on(t,e,n)}off(t,e,n){this.emitter.off(t,e,n)}getSilentAudio(){tr||(tr=new AudioContext);const t=tr.createOscillator(),e=tr.createGain();t.connect(e);const n=tr.createMediaStreamDestination();return e.connect(n),e.gain.value=0,t.start(),n.stream.getAudioTracks()[0]}uploadMinutesPublished(){var t,e,n;"failed"!==(null===(t=this.peerConnection)||void 0===t?void 0:t.iceConnectionState)&&"closed"!==(null===(e=this.peerConnection)||void 0===e?void 0:e.iceConnectionState)&&("new"!==(null===(n=this.peerConnection)||void 0===n?void 0:n.iceConnectionState)&&this.analyticsTracker.trackEventNoSharedProps(new MinuteEvent(this.token,this.traceId,this.minutesLogged,!0,0)),this.minutesLogged++)}getActionMeasurements(){return this.perfTracker.getMeasurements()}getAudioSender(){var t;return null===(t=this.peerConnection)||void 0===t?void 0:t.getSenders().find((t=>{var e;return"audio"===(null===(e=t.track)||void 0===e?void 0:e.kind)}))}getVideoSender(){var t;return null===(t=this.peerConnection)||void 0===t?void 0:t.getSenders().find((t=>{var e;return"video"===(null===(e=t.track)||void 0===e?void 0:e.kind)}))}parseWhipLinkExtension(t){return/<([0-9a-zA-Z/_-]+)>; rel="([a-z:-]+)"/.exec(t)}setTracks(t){this.tracks=t}}var er,nr,rr,ir,or=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))},sr=function(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)};!function(t){t.INIT="init",t.CONNECTING="connecting",t.CONNECTED="connected",t.UNSTABLE="unstable",t.PAUSED="paused",t.FAILED="failed",t.STOPPED="stopped"}(rr||(rr={})),function(t){t.NONE="none",t.AUDIO_ONLY="audio_only",t.AUDIO_VIDEO="audio_video"}(ir||(ir={}));class StageSubscription{constructor(t,e,n,r,i){this.id=t,this.token=e,this.stageConnection=n,this.nonScopedLogger=r,this.traceId=i,er.add(this),this.emitter=new u.EventEmitter,this.isSubscriptionActive=!1,this.subscriptionState={connectionState:rr.INIT,subscribeInProgress:!1},this.previousSignalState={isTargetPublishing:!1},this.failedRetries=0,this.throttler=new ThrottleTimer(1e3),this.updateSubscribeType=t=>{t===ir.AUDIO_ONLY?this.peerClient.stopRemoteVideo():t===ir.AUDIO_VIDEO&&this.peerClient.startRemoteVideo()},this.onParticipantUpdated=t=>{sr(this,er,"m",nr).call(this,t)&&(this.logger.debug({msg:"onParticipantUpdated",participant:t}),this.onSignalStateChange({isTargetPublishing:t.isPublishing}))},this.onParticipantJoined=t=>{sr(this,er,"m",nr).call(this,t)&&(this.logger.debug({msg:"onParticipantJoined",participant:t}),this.onSignalStateChange({isTargetPublishing:t.isPublishing}))},this.onParticipantLeft=t=>{sr(this,er,"m",nr).call(this,t)&&(this.logger.debug({msg:"onParticipantLeft",participant:t}),this.onSignalStateChange({isTargetPublishing:!1}))},this.requestRTCStats=t=>or(this,void 0,void 0,(function*(){return this.peerClient.requestRTCStats(t)})),this.attemptSubscribe=t=>or(this,void 0,void 0,(function*(){if(this.logger.debug({msg:`Subscribe attempt started: ${t}`}),!this.isSubscriptionActive)return this.logger.warn({msg:"Subscribe attempt invalid: Subscription is inactive"}),!1;this.logger.debug({msg:"Subscribe attempt is valid."}),this.subscriptionState.connectionState!==rr.FAILED&&(this.logger.debug({msg:"Updating state to CONNECTING"}),this.changeState({connectionState:rr.CONNECTING}));try{const{mediaStream:t}=yield this.subscribe();return this.throttler.clear(),this.failedRetries=0,this.emitter.emit(gn,t),this.logger.debug({msg:"Subscribe attempt succeeded"}),!0}catch(e){this.logger.error({log:"Subscribe attempt failed",err:e}),this.onAttemptSubscribeFailure(t)}return!1})),this.id=t,this.token=e,this.stageConnection=n,this.peerClient=new StagePeerClient(e,this.nonScopedLogger,Ee.SUBSCRIBE,Ge(Ee.SUBSCRIBE,t),this.traceId,t),this.logger=new ScopedLogger(r,ut.SUBSCRIPTION),this.analyticsTracker=AnalyticsTracker.getInstance(),this.traceId=i}onPeerClientConnectionStateChange(t){const e=this.stageConnection.getParticipant(this.id);this.logger.debug({msg:`onPeerClientConnectionStateChange: ${t}`,state:t,targetParticipant:e}),this.onSignalStateChange({peerClientState:t})}onSignalStateChange(t){const e=this.previousSignalState,n=Object.assign({},e,t);this.isSubscriptionActive?(n.isTargetPublishing?t.peerClientState===kn.DISCONNECTED?this.changeState({connectionState:rr.UNSTABLE}):t.peerClientState===kn.CONNECTED?this.changeState({connectionState:rr.CONNECTED,subscribeInProgress:!0}):t.peerClientState===kn.FAILED&&this.subscriptionState.subscribeInProgress&&(this.trackSubscribeEnded(!1,ze.CONNECTION_FAIL),this.changeState({subscribeInProgress:!1})):(e.isTargetPublishing&&this.subscriptionState.subscribeInProgress&&(this.logger.debug({msg:"Scheduling an unsubscribe on the event loop"}),this.unsubscribe()),this.throttler.clear(),this.changeState({connectionState:rr.PAUSED})),(!e.isTargetPublishing&&t.isTargetPublishing||t.peerClientState===kn.FAILED)&&this.throttledAttemptSubscribe("onSignalState change: isTargetPublishing is now true"),Object.assign(this.previousSignalState,t)):this.logger.warn({msg:"Unexpected onSignalStateChange when subscription is inactive"})}onAttemptSubscribeFailure(t){if(this.logger.debug({msg:"Changing/keeping state FAILED"}),this.changeState({connectionState:rr.FAILED}),this.failedRetries<=4){const e=1e3*Math.pow(2,this.failedRetries);this.logger.debug({msg:`Retrying in ${e}ms`}),this.failedRetries++,setTimeout((()=>or(this,void 0,void 0,(function*(){this.throttledAttemptSubscribe(t)}))),e)}else this.previousSignalState.isTargetPublishing=!1}setCustomSilentAudioTrack(t){this.silentAudioTrack=t}start(){this.isSubscriptionActive=!0,this.peerClient.on(Rn,this.onPeerClientConnectionStateChange,this),this.stageConnection.on(pn.STAGE_PARTICIPANT_UPDATED,this.onParticipantUpdated),this.stageConnection.on(pn.STAGE_PARTICIPANT_JOINED,this.onParticipantJoined),this.stageConnection.on(pn.STAGE_PARTICIPANT_LEFT,this.onParticipantLeft),this.stageConnection.on(pn.STAGE_PARTICIPANT_KICKED,this.onParticipantLeft);const t=this.stageConnection.getParticipant(this.id);this.onSignalStateChange({isTargetPublishing:null==t?void 0:t.isPublishing})}throttledAttemptSubscribe(t){return this.throttler.invoke(this.attemptSubscribe,t)}changeState(t){void 0!==t.subscribeInProgress&&(this.subscriptionState.subscribeInProgress=t.subscribeInProgress),t.connectionState&&this.subscriptionState.connectionState!==t.connectionState&&(this.subscriptionState.connectionState=t.connectionState,this.emitter.emit(fn,this.subscriptionState.connectionState))}on(t,e){this.emitter.on(t,e)}off(t,e){this.emitter.off(t,e)}stop(){this.cleanUp(),this.changeState({connectionState:rr.STOPPED})}cleanUp(){this.peerClient&&(this.peerClient.off(Rn,this.onPeerClientConnectionStateChange,this),this.unsubscribe()),this.throttler.clear(),this.stageConnection.off(pn.STAGE_PARTICIPANT_UPDATED,this.onParticipantUpdated),this.stageConnection.off(pn.STAGE_PARTICIPANT_JOINED,this.onParticipantJoined),this.stageConnection.off(pn.STAGE_PARTICIPANT_LEFT,this.onParticipantLeft),this.stageConnection.off(pn.STAGE_PARTICIPANT_KICKED,this.onParticipantLeft),this.isSubscriptionActive=!1,AbortControllersTracker.getInstance().abortPendingOperations()}isActive(){return this.isSubscriptionActive}getSubscriptionConnectionState(){return this.subscriptionState.connectionState}subscribe(t){return or(this,void 0,void 0,(function*(){const{token:e,id:n,silentAudioTrack:r}=this;this.traceId=f();try{e.assertTokenIsUnexpired(this.traceId,Ge(Ee.SUBSCRIBE,n),"subscribe",n),this.trackSubscribeRequested();const i=[];r&&e.shouldSendSilentAudio()&&i.push(r),this.peerClient.setTracks(i);const{mediaStream:o}=yield this.peerClient.connect(t,this.traceId);return this.trackSubscribeStarted(),{peerClient:this.peerClient,mediaStream:o}}catch(t){const r=new StageClientError(Object.assign(Object.assign({},qe.SUBSCRIBE_FAILURE),{token:e,traceId:this.traceId,tag:Ge(Ee.SUBSCRIBE,n),location:"subscribe",remoteParticipantId:n}));throw this.analyticsTracker.trackEventNoSharedProps(new StageErrorEvent(r)),t instanceof StageClientError&&(t.location=`subscribe > ${t.location}`),t}}))}unsubscribe(){return or(this,void 0,void 0,(function*(){const{id:t,token:e}=this;this.analyticsTracker.trackEventNoSharedProps(new UnsubscribeEvent({token:e,unsubscribedId:t,traceId:this.traceId})),e.assertTokenIsUnexpired(this.traceId,Ge(Ee.SUBSCRIBE,t),"unsubscribe",t);const n=AbortControllersTracker.getInstance().isUnloading,r=n?ze.UNLOAD:ze.UNSUBSCRIBE;try{if(!this.peerClient)throw new Error("Invalid unpublish - no peerClient");n?this.peerClient.disconnect():yield this.peerClient.disconnect(),this.trackSubscribeEnded(!0,r),this.changeState({subscribeInProgress:!1})}catch(t){this.trackAndThrowUnsubscribeError(r)}}))}trackAndThrowUnsubscribeError(t){const e=new StageClientError(Object.assign(Object.assign({},qe.UNSUBSCRIBE_FAILURE),{token:this.token,traceId:this.traceId,tag:Ge(Ee.SUBSCRIBE,this.id),location:"unsubscribe",remoteParticipantId:this.id}));throw this.analyticsTracker.trackError(e),this.trackSubscribeEnded(!1,t),e}trackSubscribeRequested(){this.analyticsTracker.trackEventNoSharedProps(new SubscribeEvent({token:this.token,subscribedId:this.id,traceId:this.traceId}))}trackSubscribeStarted(){const{optionsDuration:t,postDuration:e,timeToCandidate:n,timeToConnected:r}=this.peerClient.getActionMeasurements();this.analyticsTracker.trackEventNoSharedProps(new SubscribeStartedEvent({token:this.token,traceId:this.traceId,remoteParticipantId:this.id,optionsDuration:t,postDuration:e,timeToCandidate:n,totalDuration:r}))}trackSubscribeEnded(t,e){this.analyticsTracker.trackEventNoSharedProps(new SubscribeEndedEvent({token:this.token,traceId:this.traceId,remoteParticipantId:this.id,isUnsubscribeSuccessful:t,reason:e}))}}er=new WeakSet,nr=function(t){return t.id===this.id};var ar,cr,ur=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))};!function(t){t.DISCONNECTED="disconnected",t.CONNECTING="connecting",t.CONNECTED="connected",t.ERRORED="errored"}(ar||(ar={})),function(t){t.STATE_CHANGE="stateChange"}(cr||(cr={}));class StagePublication extends TypedEmitter{constructor(t,e,n,r=!1){super(),this.token=t,this.nonScopedLogger=e,this.traceId=n,this.tracksToPublish=[void 0,void 0],this.publicationState=ar.DISCONNECTED,this.latestPubAttemptNum=0,this.isPublishing=!1,this.isStarted=!1,this.start=t=>{this.publicationState===ar.DISCONNECTED||this.publicationState===ar.ERRORED?(this.isStarted=!0,this.tracksToPublish=t,this.latestPubAttemptNum=0,this.processStateUpdate()):this.logger.warn({msg:"publication cannot be started if not in disconnected or error state"})},this.requestRTCStats=t=>ur(this,void 0,void 0,(function*(){return this.peerClient.requestRTCStats(t)})),this.stop=()=>ur(this,void 0,void 0,(function*(){this.peerClient.off(Rn,this.onPeerClientConnectionStateChange,this),yield this.unpublish(),this.updateState(ar.DISCONNECTED)})),this.processStateUpdate=t=>{const{publicationState:e}=this;e===ar.DISCONNECTED||e===ar.ERRORED?0===this.latestPubAttemptNum&&(this.updateState(ar.CONNECTING),this.tryPublish()):e===ar.CONNECTING?t===kn.CONNECTED?this.updateState(ar.CONNECTED):t===kn.FAILED&&this.latestPubAttemptNum>=4&&this.updateState(ar.ERRORED):e===ar.CONNECTED&&t===kn.FAILED&&0===this.latestPubAttemptNum&&(this.updateState(ar.CONNECTING),this.tryPublish())},this.updateState=t=>{this.publicationState=t,this.emit(cr.STATE_CHANGE,t)},this.tryPublish=()=>ur(this,void 0,void 0,(function*(){if(this.latestPubAttemptNum++,this.latestPubAttemptNum<=4)try{yield this.publish(this.tracksToPublish),this.latestPubAttemptNum=0}catch(t){const e=1e3*Math.pow(2,this.latestPubAttemptNum);setTimeout((()=>{this.tryPublish()}),e)}})),this.publish=t=>ur(this,void 0,void 0,(function*(){this.traceId=f();try{return this.trackPublishRequested(),this.peerClient.setTracks(t.filter((t=>!!t))),yield this.peerClient.connect(!1,this.traceId),this.trackPublishStarted(),this.isPublishing=!0,this.peerClient}catch(t){const e=new StageClientError(Object.assign(Object.assign({},qe.PUBLISH_FAILURE),{token:this.token,traceId:this.traceId,tag:Fe.PUBLISH_RELATED,location:"publish"}));throw this.analyticsTracker.trackError(e),t instanceof StageClientError&&(t.location=`publish > ${t.location}`),t}})),this.unpublish=()=>ur(this,void 0,void 0,(function*(){this.analyticsTracker.trackEventNoSharedProps(new UnpublishEvent({token:this.token,traceId:this.traceId})),this.token.assertTokenIsUnexpired(this.traceId,Ge(Ee.PUBLISH),"unpublish",this.token.participantID);try{this.peerClient.stop();const t=AbortControllersTracker.getInstance().isUnloading,e=t?ze.UNLOAD:ze.UNPUBLISH;t?this.peerClient.cleanup(Ee.PUBLISH,this.token.participantID,this.token):yield this.peerClient.cleanup(Ee.PUBLISH,this.token.participantID,this.token),this.trackPublishEnded(!0,e)}catch(t){const e=new StageClientError(Object.assign(Object.assign({},qe.UNPUBLISH_FAILURE),{token:this.token,traceId:this.traceId,tag:Fe.UNPUBLISH_RELATED,location:"unpublish"}));throw this.analyticsTracker.trackError(e),this.trackPublishEnded(!1,ze.UNPUBLISH),e}})),this.replaceTrack=t=>ur(this,void 0,void 0,(function*(){yield this.peerClient.replaceTrack(t)})),this.getAudioSender=()=>this.peerClient.getAudioSender(),this.getVideoSender=()=>this.peerClient.getVideoSender(),this.onPeerClientConnectionStateChange=t=>{var e;(null===(e=this.peerClient)||void 0===e?void 0:e.traceId)&&this.token&&(this.logger.debug({msg:`onPeerClientConnectionStateChange: ${t}`,state:t}),t===kn.FAILED&&this.isPublishing&&(this.trackPublishEnded(!0,ze.CONNECTION_FAIL),this.isPublishing=!1),this.isStarted&&this.processStateUpdate(t))},this.trackPublishRequested=()=>{this.analyticsTracker.trackEventNoSharedProps(new PublishEvent({token:this.token,traceId:this.traceId}))},this.trackPublishStarted=()=>{if(!this.peerClient)return;const t=this.peerClient.getActionMeasurements();this.analyticsTracker.trackEventNoSharedProps(new PublishStartedEvent({token:this.token,traceId:this.traceId,optionsDuration:t.optionsDuration,postDuration:t.postDuration,timeToCandidate:t.timeToCandidate,totalDuration:t.timeToConnected}))},this.trackPublishEnded=(t,e)=>{this.analyticsTracker.trackEventNoSharedProps(new PublishEndedEvent({token:this.token,isUnpublishSuccessful:t,traceId:this.traceId,reason:e}))},this.peerClient=new StagePeerClient(t,this.nonScopedLogger,Ee.PUBLISH,Ge(Ee.PUBLISH),this.traceId),r&&this.peerClient.setV2(),this.logger=new ScopedLogger(e,ut.PUBLICATION),this.analyticsTracker=AnalyticsTracker.getInstance(),this.peerClient.on(Rn,this.onPeerClientConnectionStateChange,this)}removeTrack(t){return ur(this,void 0,void 0,(function*(){yield this.peerClient.removeTrack(t)}))}}var dr,lr,hr,pr,fr=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))},gr=function(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)},vr=function(t,e,n,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(t,n):i?i.value=n:e.set(t,n),n};class AmazonIVSBroadcastStageClient{constructor(t,e,n){this.emitter=t,this.config=e,this.nonScopedLogger=n,dr.add(this),this.stageToken=null,this.appTraceId=new TraceId,lr.set(this,!1),this.useEdp=!0,this.isValid=!0,this.subscriptions=new Map,this.analyticsTracker=AnalyticsTracker.getInstance(),this.stageConnection=new StageConnection(this.nonScopedLogger),this.propagateStageConnectionEvents(this.stageConnection,t),this.analyticsTracker.start();Object.getOwnPropertyNames(AmazonIVSBroadcastStageClient.prototype).forEach((t=>{"stageToken"!==t&&(this[t]=new Proxy(this[t],{apply:(t,e,n)=>{if(!e.isValid)throw new BroadcastClientError(Object.assign({},Mt));return Reflect.apply(t,e,n)}}))})),window.addEventListener("beforeunload",(()=>{var t;const e=AbortControllersTracker.getInstance();e.isUnloading=!0,this.unpublish(null===(t=this.stageToken)||void 0===t?void 0:t.rawToken),this.subscriptions.forEach((t=>{t.stop()})),e.abortPendingOperations(),this.analyticsTracker.stop()})),Qe().interceptors.response.use(void 0,(t=>fr(this,void 0,void 0,(function*(){var e;return 429===(null===(e=null==t?void 0:t.response)||void 0===e?void 0:e.status)&&(yield new Promise((t=>{setTimeout(t,1e3)}))),Promise.reject(t)}))))}propagateStageConnectionEvents(t,e){t.on(pn.STAGE_JOINED,(()=>{e.emit(pn.STAGE_JOINED)})),t.on(pn.STAGE_PARTICIPANT_JOINED,(t=>{e.emit(pn.STAGE_PARTICIPANT_JOINED,t)})),t.on(pn.STAGE_PARTICIPANT_KICKED,(t=>{e.emit(pn.STAGE_PARTICIPANT_KICKED,t)})),t.on(pn.STAGE_PARTICIPANT_LEFT,(t=>{e.emit(pn.STAGE_PARTICIPANT_LEFT,t)})),t.on(pn.STAGE_PARTICIPANT_UPDATED,(t=>{e.emit(pn.STAGE_PARTICIPANT_UPDATED,t)})),t.on(pn.STAGE_REFRESH,(()=>{e.emit(pn.STAGE_REFRESH)}))}delete(){this.isValid=!1}join(t){return fr(this,void 0,void 0,(function*(){const e=f();gr(this,dr,"m",pr).call(this,t),this.stageToken=He(t),this.stageToken.assertTokenIsUnexpired(e,Fe.JOIN_RELATED,"join"),this.analyticsTracker.trackEventNoSharedProps(new JoinEvent({token:this.stageToken,eventEndpoint:this.stageToken.eventsURL,whipEndpoint:this.stageToken.whipURL,traceId:e}));try{yield this.stageConnection.connect(this.stageToken,e),vr(this,lr,!0,"f")}catch(t){const n=new StageClientError(Object.assign(Object.assign({},qe.EVENT_PLANE_CONNECTION_FAILURE),{token:this.stageToken,traceId:e,tag:Fe.JOIN_RELATED,location:"join"}));throw this.analyticsTracker.trackEventNoSharedProps(new StageErrorEvent(n)),n}}))}leave(){if(gr(this,lr,"f")){const t=this.stageConnection.disconnect(),e=this.stageToken;this.analyticsTracker.trackEventNoSharedProps(new LeaveEvent({token:e,eventEndpoint:e.eventsURL,whipEndpoint:e.whipURL,traceId:t}))}}publish(t){return fr(this,void 0,void 0,(function*(){const e=f();let n=this.stageToken;if(t&&(n=He(t)),gr(this,lr,"f")||this.stageToken||(this.stageToken=n),!n)throw new Error("A token must be provided either via a preceding join call or as an argument to publish");n.assertTokenIsUnexpired(e,Fe.PUBLISH_RELATED,"publish",n.participantID),this.publication=new StagePublication(n,this.nonScopedLogger,f());return{peerConnection:(yield this.publication.publish([cn.get("video"),cn.get("audio")])).getValidPeerConnectionCanThrow()}}))}unpublish(t){return fr(this,void 0,void 0,(function*(){let e=this.stageToken;if(t&&(e=He(t)),!e||!this.publication)throw new Error("A token must be provided either via a preceding join call or as an argument to unpublish");yield this.publication.unpublish()}))}createSubscription(t,e,n){const r=He(e);if(!this.stageConnection)throw new Error("Must invoke join() before creating a subscription");const i=new StageSubscription(t,r,this.stageConnection,this.nonScopedLogger,f());return n&&i.setCustomSilentAudioTrack(n),this.subscriptions.set(t,i),i}createOrGetPublication(t){const e=He(t);if(!this.stageConnection)throw new Error("Must invoke join() before creating a publication");return this.publication||(this.publication=new StagePublication(e,this.nonScopedLogger,f())),this.publication}subscribe(t,e,n,r){var i;return fr(this,void 0,void 0,(function*(){let o=this.stageToken;e&&(o=He(e));const s=f();if(!o)throw new Error("A token must be provided either via a preceding join call or as an argument to subscribe");const a=null===(i=this.stageConnection)||void 0===i?void 0:i.getParticipant(t);if(gr(this,lr,"f")&&!a)throw new Error("error TBD: participant not found");const c=new StageSubscription(t,o,this.stageConnection,this.nonScopedLogger,s);return n&&c.setCustomSilentAudioTrack(n),c.subscribe(r).then((e=>(a&&(a.subscribed=!0,a.joinedAt=Date.now(),a.peerClient=e.peerClient,e.mediaStream&&(a.mediaSrcObject=e.mediaStream)),this.subscriptions.set(t,c),{peerConnection:e.peerClient.getValidPeerConnectionCanThrow()})))}))}unsubscribe(t,e){return fr(this,void 0,void 0,(function*(){let n=this.stageToken;if(e&&(n=He(e)),!n)throw new Error("A token must be provided either via a preceding join call or as an argument to unsubscribe");const r=this.subscriptions.get(t);return r||this.analyticsTracker.trackErrorAndThrow(new StageClientError(Object.assign(Object.assign({},qe.UNSUBSCRIBE_FAILURE),{token:n,traceId:f(),tag:Ge(Ee.SUBSCRIBE,t),location:"unsubscribe",remoteParticipantId:t}))),r.unsubscribe().then((()=>{var e;const n=null===(e=this.stageConnection)||void 0===e?void 0:e.getParticipant(t);n&&(n.subscribed=!1)}))}))}listConnectedParticipants(){var t;return(null===(t=this.stageConnection)||void 0===t?void 0:t.listConnectedParticipants())||[]}listAvailableParticipants(){var t;return(null===(t=this.stageConnection)||void 0===t?void 0:t.listAvailableParticipants())||[]}_trace(t){hn(He(t.token),this.appTraceId,`app: ${t.message}`,Ee.APP_TRACE,t.remoteParticipantID)}addVideoInputDevice(t,e,n){var r;return fr(this,void 0,void 0,(function*(){cn.set("video",t.getTracks()[0]),yield null===(r=this.publication)||void 0===r?void 0:r.replaceTrack(t.getTracks()[0])}))}addAudioInputDevice(t,e){var n;return fr(this,void 0,void 0,(function*(){cn.set("audio",t.getTracks()[0]),yield null===(n=this.publication)||void 0===n?void 0:n.replaceTrack(t.getTracks()[0])}))}getConnectionState(){return this.outboundPeerClient.getConnectionState()}on(t,e){this.emitter.on(t,e)}off(t,e){this.emitter.off(t,e)}disableVideo(){gr(this,dr,"m",hr).call(this,void 0,!1)}enableVideo(){gr(this,dr,"m",hr).call(this,void 0,!0)}disableAudio(){gr(this,dr,"m",hr).call(this,!1,void 0)}enableAudio(){gr(this,dr,"m",hr).call(this,!0,void 0)}}lr=new WeakMap,dr=new WeakSet,hr=function(t,e){var n,r;if(this.stageConnection&&this.publication){const i=this.publication.getAudioSender(),o=this.publication.getVideoSender();(null==i?void 0:i.track)&&void 0!==t&&(i.track.enabled=t),(null==o?void 0:o.track)&&void 0!==e&&(o.track.enabled=e),this.stageConnection.emitStageState(!1===(null===(n=null==i?void 0:i.track)||void 0===n?void 0:n.enabled)||!1,!1===(null===(r=null==o?void 0:o.track)||void 0===r?void 0:r.enabled)||!1)}},pr=function(t){if("string"!=typeof t)throw new BroadcastClientError(Bt)};let mr=!0,yr=!0;function _r(t,e,n){const r=t.match(e);return r&&r.length>=n&&parseInt(r[n],10)}function br(t,e,n){if(!t.RTCPeerConnection)return;const r=t.RTCPeerConnection.prototype,i=r.addEventListener;r.addEventListener=function(t,r){if(t!==e)return i.apply(this,arguments);const o=t=>{const e=n(t);e&&(r.handleEvent?r.handleEvent(e):r(e))};return this._eventMap=this._eventMap||{},this._eventMap[e]||(this._eventMap[e]=new Map),this._eventMap[e].set(r,o),i.apply(this,[t,o])};const o=r.removeEventListener;r.removeEventListener=function(t,n){if(t!==e||!this._eventMap||!this._eventMap[e])return o.apply(this,arguments);if(!this._eventMap[e].has(n))return o.apply(this,arguments);const r=this._eventMap[e].get(n);return this._eventMap[e].delete(n),0===this._eventMap[e].size&&delete this._eventMap[e],0===Object.keys(this._eventMap).length&&delete this._eventMap,o.apply(this,[t,r])},Object.defineProperty(r,"on"+e,{get(){return this["_on"+e]},set(t){this["_on"+e]&&(this.removeEventListener(e,this["_on"+e]),delete this["_on"+e]),t&&this.addEventListener(e,this["_on"+e]=t)},enumerable:!0,configurable:!0})}function Er(t){return"boolean"!=typeof t?new Error("Argument type: "+typeof t+". Please use a boolean."):(mr=t,t?"adapter.js logging disabled":"adapter.js logging enabled")}function Sr(t){return"boolean"!=typeof t?new Error("Argument type: "+typeof t+". Please use a boolean."):(yr=!t,"adapter.js deprecation warnings "+(t?"disabled":"enabled"))}function Cr(){if("object"==typeof window){if(mr)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function wr(t,e){yr&&console.warn(t+" is deprecated, please use "+e+" instead.")}function Tr(t){return"[object Object]"===Object.prototype.toString.call(t)}function Ir(t){return Tr(t)?Object.keys(t).reduce((function(e,n){const r=Tr(t[n]),i=r?Ir(t[n]):t[n],o=r&&!Object.keys(i).length;return void 0===i||o?e:Object.assign(e,{[n]:i})}),{}):t}function Rr(t,e,n){e&&!n.has(e.id)&&(n.set(e.id,e),Object.keys(e).forEach((r=>{r.endsWith("Id")?Rr(t,t.get(e[r]),n):r.endsWith("Ids")&&e[r].forEach((e=>{Rr(t,t.get(e),n)}))})))}function Ar(t,e,n){const r=n?"outbound-rtp":"inbound-rtp",i=new Map;if(null===e)return i;const o=[];return t.forEach((t=>{"track"===t.type&&t.trackIdentifier===e.id&&o.push(t)})),o.forEach((e=>{t.forEach((n=>{n.type===r&&n.trackId===e.id&&Rr(t,n,i)}))})),i}const kr=Cr;function Or(t,e){const n=t&&t.navigator;if(!n.mediaDevices)return;const r=function(t){if("object"!=typeof t||t.mandatory||t.optional)return t;const e={};return Object.keys(t).forEach((n=>{if("require"===n||"advanced"===n||"mediaSource"===n)return;const r="object"==typeof t[n]?t[n]:{ideal:t[n]};void 0!==r.exact&&"number"==typeof r.exact&&(r.min=r.max=r.exact);const i=function(t,e){return t?t+e.charAt(0).toUpperCase()+e.slice(1):"deviceId"===e?"sourceId":e};if(void 0!==r.ideal){e.optional=e.optional||[];let t={};"number"==typeof r.ideal?(t[i("min",n)]=r.ideal,e.optional.push(t),t={},t[i("max",n)]=r.ideal,e.optional.push(t)):(t[i("",n)]=r.ideal,e.optional.push(t))}void 0!==r.exact&&"number"!=typeof r.exact?(e.mandatory=e.mandatory||{},e.mandatory[i("",n)]=r.exact):["min","max"].forEach((t=>{void 0!==r[t]&&(e.mandatory=e.mandatory||{},e.mandatory[i(t,n)]=r[t])}))})),t.advanced&&(e.optional=(e.optional||[]).concat(t.advanced)),e},i=function(t,i){if(e.version>=61)return i(t);if((t=JSON.parse(JSON.stringify(t)))&&"object"==typeof t.audio){const e=function(t,e,n){e in t&&!(n in t)&&(t[n]=t[e],delete t[e])};e((t=JSON.parse(JSON.stringify(t))).audio,"autoGainControl","googAutoGainControl"),e(t.audio,"noiseSuppression","googNoiseSuppression"),t.audio=r(t.audio)}if(t&&"object"==typeof t.video){let o=t.video.facingMode;o=o&&("object"==typeof o?o:{ideal:o});const s=e.version<66;if(o&&("user"===o.exact||"environment"===o.exact||"user"===o.ideal||"environment"===o.ideal)&&(!n.mediaDevices.getSupportedConstraints||!n.mediaDevices.getSupportedConstraints().facingMode||s)){let e;if(delete t.video.facingMode,"environment"===o.exact||"environment"===o.ideal?e=["back","rear"]:"user"!==o.exact&&"user"!==o.ideal||(e=["front"]),e)return n.mediaDevices.enumerateDevices().then((n=>{let s=(n=n.filter((t=>"videoinput"===t.kind))).find((t=>e.some((e=>t.label.toLowerCase().includes(e)))));return!s&&n.length&&e.includes("back")&&(s=n[n.length-1]),s&&(t.video.deviceId=o.exact?{exact:s.deviceId}:{ideal:s.deviceId}),t.video=r(t.video),kr("chrome: "+JSON.stringify(t)),i(t)}))}t.video=r(t.video)}return kr("chrome: "+JSON.stringify(t)),i(t)},o=function(t){return e.version>=64?t:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[t.name]||t.name,message:t.message,constraint:t.constraint||t.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(n.getUserMedia=function(t,e,r){i(t,(t=>{n.webkitGetUserMedia(t,e,(t=>{r&&r(o(t))}))}))}.bind(n),n.mediaDevices.getUserMedia){const t=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(e){return i(e,(e=>t(e).then((t=>{if(e.audio&&!t.getAudioTracks().length||e.video&&!t.getVideoTracks().length)throw t.getTracks().forEach((t=>{t.stop()})),new DOMException("","NotFoundError");return t}),(t=>Promise.reject(o(t))))))}}}function Pr(t,e){t.navigator.mediaDevices&&"getDisplayMedia"in t.navigator.mediaDevices||t.navigator.mediaDevices&&("function"==typeof e?t.navigator.mediaDevices.getDisplayMedia=function(n){return e(n).then((e=>{const r=n.video&&n.video.width,i=n.video&&n.video.height,o=n.video&&n.video.frameRate;return n.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:e,maxFrameRate:o||3}},r&&(n.video.mandatory.maxWidth=r),i&&(n.video.mandatory.maxHeight=i),t.navigator.mediaDevices.getUserMedia(n)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}function Nr(t){t.MediaStream=t.MediaStream||t.webkitMediaStream}function xr(t){if("object"==typeof t&&t.RTCPeerConnection&&!("ontrack"in t.RTCPeerConnection.prototype)){Object.defineProperty(t.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(t){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=t)},enumerable:!0,configurable:!0});const e=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=e=>{e.stream.addEventListener("addtrack",(n=>{let r;r=t.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((t=>t.track&&t.track.id===n.track.id)):{track:n.track};const i=new Event("track");i.track=n.track,i.receiver=r,i.transceiver={receiver:r},i.streams=[e.stream],this.dispatchEvent(i)})),e.stream.getTracks().forEach((n=>{let r;r=t.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((t=>t.track&&t.track.id===n.id)):{track:n};const i=new Event("track");i.track=n,i.receiver=r,i.transceiver={receiver:r},i.streams=[e.stream],this.dispatchEvent(i)}))},this.addEventListener("addstream",this._ontrackpoly)),e.apply(this,arguments)}}else br(t,"track",(t=>(t.transceiver||Object.defineProperty(t,"transceiver",{value:{receiver:t.receiver}}),t)))}function Dr(t){if("object"==typeof t&&t.RTCPeerConnection&&!("getSenders"in t.RTCPeerConnection.prototype)&&"createDTMFSender"in t.RTCPeerConnection.prototype){const e=function(t,e){return{track:e,get dtmf(){return void 0===this._dtmf&&("audio"===e.kind?this._dtmf=t.createDTMFSender(e):this._dtmf=null),this._dtmf},_pc:t}};if(!t.RTCPeerConnection.prototype.getSenders){t.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const n=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function(t,r){let i=n.apply(this,arguments);return i||(i=e(this,t),this._senders.push(i)),i};const r=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function(t){r.apply(this,arguments);const e=this._senders.indexOf(t);-1!==e&&this._senders.splice(e,1)}}const n=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(t){this._senders=this._senders||[],n.apply(this,[t]),t.getTracks().forEach((t=>{this._senders.push(e(this,t))}))};const r=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(t){this._senders=this._senders||[],r.apply(this,[t]),t.getTracks().forEach((t=>{const e=this._senders.find((e=>e.track===t));e&&this._senders.splice(this._senders.indexOf(e),1)}))}}else if("object"==typeof t&&t.RTCPeerConnection&&"getSenders"in t.RTCPeerConnection.prototype&&"createDTMFSender"in t.RTCPeerConnection.prototype&&t.RTCRtpSender&&!("dtmf"in t.RTCRtpSender.prototype)){const e=t.RTCPeerConnection.prototype.getSenders;t.RTCPeerConnection.prototype.getSenders=function(){const t=e.apply(this,[]);return t.forEach((t=>t._pc=this)),t},Object.defineProperty(t.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function Mr(t){if(!t.RTCPeerConnection)return;const e=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){const[t,n,r]=arguments;if(arguments.length>0&&"function"==typeof t)return e.apply(this,arguments);if(0===e.length&&(0===arguments.length||"function"!=typeof t))return e.apply(this,[]);const i=function(t){const e={};return t.result().forEach((t=>{const n={id:t.id,timestamp:t.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[t.type]||t.type};t.names().forEach((e=>{n[e]=t.stat(e)})),e[n.id]=n})),e},o=function(t){return new Map(Object.keys(t).map((e=>[e,t[e]])))};if(arguments.length>=2){const r=function(t){n(o(i(t)))};return e.apply(this,[r,t])}return new Promise(((t,n)=>{e.apply(this,[function(e){t(o(i(e)))},n])})).then(n,r)}}function jr(t){if(!("object"==typeof t&&t.RTCPeerConnection&&t.RTCRtpSender&&t.RTCRtpReceiver))return;if(!("getStats"in t.RTCRtpSender.prototype)){const e=t.RTCPeerConnection.prototype.getSenders;e&&(t.RTCPeerConnection.prototype.getSenders=function(){const t=e.apply(this,[]);return t.forEach((t=>t._pc=this)),t});const n=t.RTCPeerConnection.prototype.addTrack;n&&(t.RTCPeerConnection.prototype.addTrack=function(){const t=n.apply(this,arguments);return t._pc=this,t}),t.RTCRtpSender.prototype.getStats=function(){const t=this;return this._pc.getStats().then((e=>Ar(e,t.track,!0)))}}if(!("getStats"in t.RTCRtpReceiver.prototype)){const e=t.RTCPeerConnection.prototype.getReceivers;e&&(t.RTCPeerConnection.prototype.getReceivers=function(){const t=e.apply(this,[]);return t.forEach((t=>t._pc=this)),t}),br(t,"track",(t=>(t.receiver._pc=t.srcElement,t))),t.RTCRtpReceiver.prototype.getStats=function(){const t=this;return this._pc.getStats().then((e=>Ar(e,t.track,!1)))}}if(!("getStats"in t.RTCRtpSender.prototype)||!("getStats"in t.RTCRtpReceiver.prototype))return;const e=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof t.MediaStreamTrack){const t=arguments[0];let e,n,r;return this.getSenders().forEach((n=>{n.track===t&&(e?r=!0:e=n)})),this.getReceivers().forEach((e=>(e.track===t&&(n?r=!0:n=e),e.track===t))),r||e&&n?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):e?e.getStats():n?n.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return e.apply(this,arguments)}}function Lr(t){t.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((t=>this._shimmedLocalStreams[t][0]))};const e=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function(t,n){if(!n)return e.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const r=e.apply(this,arguments);return this._shimmedLocalStreams[n.id]?-1===this._shimmedLocalStreams[n.id].indexOf(r)&&this._shimmedLocalStreams[n.id].push(r):this._shimmedLocalStreams[n.id]=[n,r],r};const n=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(t){this._shimmedLocalStreams=this._shimmedLocalStreams||{},t.getTracks().forEach((t=>{if(this.getSenders().find((e=>e.track===t)))throw new DOMException("Track already exists.","InvalidAccessError")}));const e=this.getSenders();n.apply(this,arguments);const r=this.getSenders().filter((t=>-1===e.indexOf(t)));this._shimmedLocalStreams[t.id]=[t].concat(r)};const r=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(t){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[t.id],r.apply(this,arguments)};const i=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function(t){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},t&&Object.keys(this._shimmedLocalStreams).forEach((e=>{const n=this._shimmedLocalStreams[e].indexOf(t);-1!==n&&this._shimmedLocalStreams[e].splice(n,1),1===this._shimmedLocalStreams[e].length&&delete this._shimmedLocalStreams[e]})),i.apply(this,arguments)}}function Ur(t,e){if(!t.RTCPeerConnection)return;if(t.RTCPeerConnection.prototype.addTrack&&e.version>=65)return Lr(t);const n=t.RTCPeerConnection.prototype.getLocalStreams;t.RTCPeerConnection.prototype.getLocalStreams=function(){const t=n.apply(this);return this._reverseStreams=this._reverseStreams||{},t.map((t=>this._reverseStreams[t.id]))};const r=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(e){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},e.getTracks().forEach((t=>{if(this.getSenders().find((e=>e.track===t)))throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[e.id]){const n=new t.MediaStream(e.getTracks());this._streams[e.id]=n,this._reverseStreams[n.id]=e,e=n}r.apply(this,[e])};const i=t.RTCPeerConnection.prototype.removeStream;function o(t,e){let n=e.sdp;return Object.keys(t._reverseStreams||[]).forEach((e=>{const r=t._reverseStreams[e],i=t._streams[r.id];n=n.replace(new RegExp(i.id,"g"),r.id)})),new RTCSessionDescription({type:e.type,sdp:n})}t.RTCPeerConnection.prototype.removeStream=function(t){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[t.id]||t]),delete this._reverseStreams[this._streams[t.id]?this._streams[t.id].id:t.id],delete this._streams[t.id]},t.RTCPeerConnection.prototype.addTrack=function(e,n){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const r=[].slice.call(arguments,1);if(1!==r.length||!r[0].getTracks().find((t=>t===e)))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find((t=>t.track===e)))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const i=this._streams[n.id];if(i)i.addTrack(e),Promise.resolve().then((()=>{this.dispatchEvent(new Event("negotiationneeded"))}));else{const r=new t.MediaStream([e]);this._streams[n.id]=r,this._reverseStreams[r.id]=n,this.addStream(r)}return this.getSenders().find((t=>t.track===e))},["createOffer","createAnswer"].forEach((function(e){const n=t.RTCPeerConnection.prototype[e],r={[e](){const t=arguments;return arguments.length&&"function"==typeof arguments[0]?n.apply(this,[e=>{const n=o(this,e);t[0].apply(null,[n])},e=>{t[1]&&t[1].apply(null,e)},arguments[2]]):n.apply(this,arguments).then((t=>o(this,t)))}};t.RTCPeerConnection.prototype[e]=r[e]}));const s=t.RTCPeerConnection.prototype.setLocalDescription;t.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=function(t,e){let n=e.sdp;return Object.keys(t._reverseStreams||[]).forEach((e=>{const r=t._reverseStreams[e],i=t._streams[r.id];n=n.replace(new RegExp(r.id,"g"),i.id)})),new RTCSessionDescription({type:e.type,sdp:n})}(this,arguments[0]),s.apply(this,arguments)):s.apply(this,arguments)};const a=Object.getOwnPropertyDescriptor(t.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(t.RTCPeerConnection.prototype,"localDescription",{get(){const t=a.get.apply(this);return""===t.type?t:o(this,t)}}),t.RTCPeerConnection.prototype.removeTrack=function(t){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!t._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(t._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");let e;this._streams=this._streams||{},Object.keys(this._streams).forEach((n=>{this._streams[n].getTracks().find((e=>t.track===e))&&(e=this._streams[n])})),e&&(1===e.getTracks().length?this.removeStream(this._reverseStreams[e.id]):e.removeTrack(t.track),this.dispatchEvent(new Event("negotiationneeded")))}}function Br(t,e){!t.RTCPeerConnection&&t.webkitRTCPeerConnection&&(t.RTCPeerConnection=t.webkitRTCPeerConnection),t.RTCPeerConnection&&e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(e){const n=t.RTCPeerConnection.prototype[e],r={[e](){return arguments[0]=new("addIceCandidate"===e?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};t.RTCPeerConnection.prototype[e]=r[e]}))}function Fr(t,e){br(t,"negotiationneeded",(t=>{const n=t.target;if(!(e.version<72||n.getConfiguration&&"plan-b"===n.getConfiguration().sdpSemantics)||"stable"===n.signalingState)return t}))}function Gr(t,e){const n=t&&t.navigator,r=t&&t.MediaStreamTrack;if(n.getUserMedia=function(t,e,r){wr("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),n.mediaDevices.getUserMedia(t).then(e,r)},!(e.version>55&&"autoGainControl"in n.mediaDevices.getSupportedConstraints())){const t=function(t,e,n){e in t&&!(n in t)&&(t[n]=t[e],delete t[e])},e=n.mediaDevices.getUserMedia.bind(n.mediaDevices);if(n.mediaDevices.getUserMedia=function(n){return"object"==typeof n&&"object"==typeof n.audio&&(n=JSON.parse(JSON.stringify(n)),t(n.audio,"autoGainControl","mozAutoGainControl"),t(n.audio,"noiseSuppression","mozNoiseSuppression")),e(n)},r&&r.prototype.getSettings){const e=r.prototype.getSettings;r.prototype.getSettings=function(){const n=e.apply(this,arguments);return t(n,"mozAutoGainControl","autoGainControl"),t(n,"mozNoiseSuppression","noiseSuppression"),n}}if(r&&r.prototype.applyConstraints){const e=r.prototype.applyConstraints;r.prototype.applyConstraints=function(n){return"audio"===this.kind&&"object"==typeof n&&(n=JSON.parse(JSON.stringify(n)),t(n,"autoGainControl","mozAutoGainControl"),t(n,"noiseSuppression","mozNoiseSuppression")),e.apply(this,[n])}}}}function Vr(t,e){t.navigator.mediaDevices&&"getDisplayMedia"in t.navigator.mediaDevices||t.navigator.mediaDevices&&(t.navigator.mediaDevices.getDisplayMedia=function(n){if(!n||!n.video){const t=new DOMException("getDisplayMedia without video constraints is undefined");return t.name="NotFoundError",t.code=8,Promise.reject(t)}return!0===n.video?n.video={mediaSource:e}:n.video.mediaSource=e,t.navigator.mediaDevices.getUserMedia(n)})}function Wr(t){"object"==typeof t&&t.RTCTrackEvent&&"receiver"in t.RTCTrackEvent.prototype&&!("transceiver"in t.RTCTrackEvent.prototype)&&Object.defineProperty(t.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function qr(t,e){if("object"!=typeof t||!t.RTCPeerConnection&&!t.mozRTCPeerConnection)return;!t.RTCPeerConnection&&t.mozRTCPeerConnection&&(t.RTCPeerConnection=t.mozRTCPeerConnection),e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(e){const n=t.RTCPeerConnection.prototype[e],r={[e](){return arguments[0]=new("addIceCandidate"===e?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};t.RTCPeerConnection.prototype[e]=r[e]}));const n={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},r=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){const[t,i,o]=arguments;return r.apply(this,[t||null]).then((t=>{if(e.version<53&&!i)try{t.forEach((t=>{t.type=n[t.type]||t.type}))}catch(e){if("TypeError"!==e.name)throw e;t.forEach(((e,r)=>{t.set(r,Object.assign({},e,{type:n[e.type]||e.type}))}))}return t})).then(i,o)}}function zr(t){if("object"!=typeof t||!t.RTCPeerConnection||!t.RTCRtpSender)return;if(t.RTCRtpSender&&"getStats"in t.RTCRtpSender.prototype)return;const e=t.RTCPeerConnection.prototype.getSenders;e&&(t.RTCPeerConnection.prototype.getSenders=function(){const t=e.apply(this,[]);return t.forEach((t=>t._pc=this)),t});const n=t.RTCPeerConnection.prototype.addTrack;n&&(t.RTCPeerConnection.prototype.addTrack=function(){const t=n.apply(this,arguments);return t._pc=this,t}),t.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function $r(t){if("object"!=typeof t||!t.RTCPeerConnection||!t.RTCRtpSender)return;if(t.RTCRtpSender&&"getStats"in t.RTCRtpReceiver.prototype)return;const e=t.RTCPeerConnection.prototype.getReceivers;e&&(t.RTCPeerConnection.prototype.getReceivers=function(){const t=e.apply(this,[]);return t.forEach((t=>t._pc=this)),t}),br(t,"track",(t=>(t.receiver._pc=t.srcElement,t))),t.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function Hr(t){t.RTCPeerConnection&&!("removeStream"in t.RTCPeerConnection.prototype)&&(t.RTCPeerConnection.prototype.removeStream=function(t){wr("removeStream","removeTrack"),this.getSenders().forEach((e=>{e.track&&t.getTracks().includes(e.track)&&this.removeTrack(e)}))})}function Kr(t){t.DataChannel&&!t.RTCDataChannel&&(t.RTCDataChannel=t.DataChannel)}function Jr(t){if("object"!=typeof t||!t.RTCPeerConnection)return;const e=t.RTCPeerConnection.prototype.addTransceiver;e&&(t.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let t=arguments[1]&&arguments[1].sendEncodings;void 0===t&&(t=[]),t=[...t];const n=t.length>0;n&&t.forEach((t=>{if("rid"in t){if(!/^[a-z0-9]{0,16}$/i.test(t.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in t&&!(parseFloat(t.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in t&&!(parseFloat(t.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")}));const r=e.apply(this,arguments);if(n){const{sender:e}=r,n=e.getParameters();(!("encodings"in n)||1===n.encodings.length&&0===Object.keys(n.encodings[0]).length)&&(n.encodings=t,e.sendEncodings=t,this.setParametersPromises.push(e.setParameters(n).then((()=>{delete e.sendEncodings})).catch((()=>{delete e.sendEncodings}))))}return r})}function Xr(t){if("object"!=typeof t||!t.RTCRtpSender)return;const e=t.RTCRtpSender.prototype.getParameters;e&&(t.RTCRtpSender.prototype.getParameters=function(){const t=e.apply(this,arguments);return"encodings"in t||(t.encodings=[].concat(this.sendEncodings||[{}])),t})}function Yr(t){if("object"!=typeof t||!t.RTCPeerConnection)return;const e=t.RTCPeerConnection.prototype.createOffer;t.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>e.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):e.apply(this,arguments)}}function Zr(t){if("object"!=typeof t||!t.RTCPeerConnection)return;const e=t.RTCPeerConnection.prototype.createAnswer;t.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>e.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):e.apply(this,arguments)}}function Qr(t){if("object"==typeof t&&t.RTCPeerConnection){if("getLocalStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in t.RTCPeerConnection.prototype)){const e=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addStream=function(t){this._localStreams||(this._localStreams=[]),this._localStreams.includes(t)||this._localStreams.push(t),t.getAudioTracks().forEach((n=>e.call(this,n,t))),t.getVideoTracks().forEach((n=>e.call(this,n,t)))},t.RTCPeerConnection.prototype.addTrack=function(t,...n){return n&&n.forEach((t=>{this._localStreams?this._localStreams.includes(t)||this._localStreams.push(t):this._localStreams=[t]})),e.apply(this,arguments)}}"removeStream"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.removeStream=function(t){this._localStreams||(this._localStreams=[]);const e=this._localStreams.indexOf(t);if(-1===e)return;this._localStreams.splice(e,1);const n=t.getTracks();this.getSenders().forEach((t=>{n.includes(t.track)&&this.removeTrack(t)}))})}}function ti(t){if("object"==typeof t&&t.RTCPeerConnection&&("getRemoteStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in t.RTCPeerConnection.prototype))){Object.defineProperty(t.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(t){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=t),this.addEventListener("track",this._onaddstreampoly=t=>{t.streams.forEach((t=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(t))return;this._remoteStreams.push(t);const e=new Event("addstream");e.stream=t,this.dispatchEvent(e)}))})}});const e=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){const t=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(e){e.streams.forEach((e=>{if(t._remoteStreams||(t._remoteStreams=[]),t._remoteStreams.indexOf(e)>=0)return;t._remoteStreams.push(e);const n=new Event("addstream");n.stream=e,t.dispatchEvent(n)}))}),e.apply(t,arguments)}}}function ei(t){if("object"!=typeof t||!t.RTCPeerConnection)return;const e=t.RTCPeerConnection.prototype,n=e.createOffer,r=e.createAnswer,i=e.setLocalDescription,o=e.setRemoteDescription,s=e.addIceCandidate;e.createOffer=function(t,e){const r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return e?(i.then(t,e),Promise.resolve()):i},e.createAnswer=function(t,e){const n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return e?(i.then(t,e),Promise.resolve()):i};let a=function(t,e,n){const r=i.apply(this,[t]);return n?(r.then(e,n),Promise.resolve()):r};e.setLocalDescription=a,a=function(t,e,n){const r=o.apply(this,[t]);return n?(r.then(e,n),Promise.resolve()):r},e.setRemoteDescription=a,a=function(t,e,n){const r=s.apply(this,[t]);return n?(r.then(e,n),Promise.resolve()):r},e.addIceCandidate=a}function ni(t){const e=t&&t.navigator;if(e.mediaDevices&&e.mediaDevices.getUserMedia){const t=e.mediaDevices,n=t.getUserMedia.bind(t);e.mediaDevices.getUserMedia=t=>n(ri(t))}!e.getUserMedia&&e.mediaDevices&&e.mediaDevices.getUserMedia&&(e.getUserMedia=function(t,n,r){e.mediaDevices.getUserMedia(t).then(n,r)}.bind(e))}function ri(t){return t&&void 0!==t.video?Object.assign({},t,{video:Ir(t.video)}):t}function ii(t){if(!t.RTCPeerConnection)return;const e=t.RTCPeerConnection;t.RTCPeerConnection=function(t,n){if(t&&t.iceServers){const e=[];for(let n=0;n<t.iceServers.length;n++){let r=t.iceServers[n];!r.hasOwnProperty("urls")&&r.hasOwnProperty("url")?(wr("RTCIceServer.url","RTCIceServer.urls"),r=JSON.parse(JSON.stringify(r)),r.urls=r.url,delete r.url,e.push(r)):e.push(t.iceServers[n])}t.iceServers=e}return new e(t,n)},t.RTCPeerConnection.prototype=e.prototype,"generateCertificate"in e&&Object.defineProperty(t.RTCPeerConnection,"generateCertificate",{get:()=>e.generateCertificate})}function oi(t){"object"==typeof t&&t.RTCTrackEvent&&"receiver"in t.RTCTrackEvent.prototype&&!("transceiver"in t.RTCTrackEvent.prototype)&&Object.defineProperty(t.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function si(t){const e=t.RTCPeerConnection.prototype.createOffer;t.RTCPeerConnection.prototype.createOffer=function(t){if(t){void 0!==t.offerToReceiveAudio&&(t.offerToReceiveAudio=!!t.offerToReceiveAudio);const e=this.getTransceivers().find((t=>"audio"===t.receiver.track.kind));!1===t.offerToReceiveAudio&&e?"sendrecv"===e.direction?e.setDirection?e.setDirection("sendonly"):e.direction="sendonly":"recvonly"===e.direction&&(e.setDirection?e.setDirection("inactive"):e.direction="inactive"):!0!==t.offerToReceiveAudio||e||this.addTransceiver("audio",{direction:"recvonly"}),void 0!==t.offerToReceiveVideo&&(t.offerToReceiveVideo=!!t.offerToReceiveVideo);const n=this.getTransceivers().find((t=>"video"===t.receiver.track.kind));!1===t.offerToReceiveVideo&&n?"sendrecv"===n.direction?n.setDirection?n.setDirection("sendonly"):n.direction="sendonly":"recvonly"===n.direction&&(n.setDirection?n.setDirection("inactive"):n.direction="inactive"):!0!==t.offerToReceiveVideo||n||this.addTransceiver("video",{direction:"recvonly"})}return e.apply(this,arguments)}}function ai(t){"object"!=typeof t||t.AudioContext||(t.AudioContext=t.webkitAudioContext)}var ci=n(7539),ui=n.n(ci);function di(t){if(!t.RTCIceCandidate||t.RTCIceCandidate&&"foundation"in t.RTCIceCandidate.prototype)return;const e=t.RTCIceCandidate;t.RTCIceCandidate=function(t){if("object"==typeof t&&t.candidate&&0===t.candidate.indexOf("a=")&&((t=JSON.parse(JSON.stringify(t))).candidate=t.candidate.substr(2)),t.candidate&&t.candidate.length){const n=new e(t),r=ui().parseCandidate(t.candidate),i=Object.assign(n,r);return i.toJSON=function(){return{candidate:i.candidate,sdpMid:i.sdpMid,sdpMLineIndex:i.sdpMLineIndex,usernameFragment:i.usernameFragment}},i}return new e(t)},t.RTCIceCandidate.prototype=e.prototype,br(t,"icecandidate",(e=>(e.candidate&&Object.defineProperty(e,"candidate",{value:new t.RTCIceCandidate(e.candidate),writable:"false"}),e)))}function li(t){!t.RTCIceCandidate||t.RTCIceCandidate&&"relayProtocol"in t.RTCIceCandidate.prototype||br(t,"icecandidate",(t=>{if(t.candidate){const e=ui().parseCandidate(t.candidate.candidate);"relay"===e.type&&(t.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[e.priority>>24])}return t}))}function hi(t,e){if(!t.RTCPeerConnection)return;"sctp"in t.RTCPeerConnection.prototype||Object.defineProperty(t.RTCPeerConnection.prototype,"sctp",{get(){return void 0===this._sctp?null:this._sctp}});const n=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===e.browser&&e.version>=76){const{sdpSemantics:t}=this.getConfiguration();"plan-b"===t&&Object.defineProperty(this,"sctp",{get(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(function(t){if(!t||!t.sdp)return!1;const e=ui().splitSections(t.sdp);return e.shift(),e.some((t=>{const e=ui().parseMLine(t);return e&&"application"===e.kind&&-1!==e.protocol.indexOf("SCTP")}))}(arguments[0])){const t=function(t){const e=t.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===e||e.length<2)return-1;const n=parseInt(e[1],10);return n!=n?-1:n}(arguments[0]),n=function(t){let n=65536;return"firefox"===e.browser&&(n=e.version<57?-1===t?16384:2147483637:e.version<60?57===e.version?65535:65536:2147483637),n}(t),r=function(t,n){let r=65536;"firefox"===e.browser&&57===e.version&&(r=65535);const i=ui().matchPrefix(t.sdp,"a=max-message-size:");return i.length>0?r=parseInt(i[0].substr(19),10):"firefox"===e.browser&&-1!==n&&(r=2147483637),r}(arguments[0],t);let i;i=0===n&&0===r?Number.POSITIVE_INFINITY:0===n||0===r?Math.max(n,r):Math.min(n,r);const o={};Object.defineProperty(o,"maxMessageSize",{get:()=>i}),this._sctp=o}return n.apply(this,arguments)}}function pi(t){if(!t.RTCPeerConnection||!("createDataChannel"in t.RTCPeerConnection.prototype))return;function e(t,e){const n=t.send;t.send=function(){const r=arguments[0],i=r.length||r.size||r.byteLength;if("open"===t.readyState&&e.sctp&&i>e.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+e.sctp.maxMessageSize+" bytes)");return n.apply(t,arguments)}}const n=t.RTCPeerConnection.prototype.createDataChannel;t.RTCPeerConnection.prototype.createDataChannel=function(){const t=n.apply(this,arguments);return e(t,this),t},br(t,"datachannel",(t=>(e(t.channel,t.target),t)))}function fi(t){if(!t.RTCPeerConnection||"connectionState"in t.RTCPeerConnection.prototype)return;const e=t.RTCPeerConnection.prototype;Object.defineProperty(e,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(e,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(t){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),t&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=t)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach((t=>{const n=e[t];e[t]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=t=>{const e=t.target;if(e._lastConnectionState!==e.connectionState){e._lastConnectionState=e.connectionState;const n=new Event("connectionstatechange",t);e.dispatchEvent(n)}return t},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),n.apply(this,arguments)}}))}function gi(t,e){if(!t.RTCPeerConnection)return;if("chrome"===e.browser&&e.version>=71)return;if("safari"===e.browser&&e.version>=605)return;const n=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(e){if(e&&e.sdp&&-1!==e.sdp.indexOf("\na=extmap-allow-mixed")){const n=e.sdp.split("\n").filter((t=>"a=extmap-allow-mixed"!==t.trim())).join("\n");t.RTCSessionDescription&&e instanceof t.RTCSessionDescription?arguments[0]=new t.RTCSessionDescription({type:e.type,sdp:n}):e.sdp=n}return n.apply(this,arguments)}}function vi(t,e){if(!t.RTCPeerConnection||!t.RTCPeerConnection.prototype)return;const n=t.RTCPeerConnection.prototype.addIceCandidate;n&&0!==n.length&&(t.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===e.browser&&e.version<78||"firefox"===e.browser&&e.version<68||"safari"===e.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():n.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function mi(t,e){if(!t.RTCPeerConnection||!t.RTCPeerConnection.prototype)return;const n=t.RTCPeerConnection.prototype.setLocalDescription;n&&0!==n.length&&(t.RTCPeerConnection.prototype.setLocalDescription=function(){let t=arguments[0]||{};if("object"!=typeof t||t.type&&t.sdp)return n.apply(this,arguments);if(t={type:t.type,sdp:t.sdp},!t.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":t.type="offer";break;default:t.type="answer"}if(t.sdp||"offer"!==t.type&&"answer"!==t.type)return n.apply(this,[t]);return("offer"===t.type?this.createOffer:this.createAnswer).apply(this).then((t=>n.apply(this,[t])))})}!function({window:t}={},n={shimChrome:!0,shimFirefox:!0,shimSafari:!0}){const r=Cr,a=function(t){const e={browser:null,version:null};if(void 0===t||!t.navigator)return e.browser="Not a browser.",e;const{navigator:n}=t;if(n.mozGetUserMedia)e.browser="firefox",e.version=_r(n.userAgent,/Firefox\/(\d+)\./,1);else if(n.webkitGetUserMedia||!1===t.isSecureContext&&t.webkitRTCPeerConnection)e.browser="chrome",e.version=_r(n.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!t.RTCPeerConnection||!n.userAgent.match(/AppleWebKit\/(\d+)\./))return e.browser="Not a supported browser.",e;e.browser="safari",e.version=_r(n.userAgent,/AppleWebKit\/(\d+)\./,1),e.supportsUnifiedPlan=t.RTCRtpTransceiver&&"currentDirection"in t.RTCRtpTransceiver.prototype}return e}(t),c={browserDetails:a,commonShim:s,extractVersion:_r,disableLog:Er,disableWarnings:Sr,sdp:ci};switch(a.browser){case"chrome":if(!e||!Br||!n.shimChrome)return r("Chrome shim is not included in this adapter release."),c;if(null===a.version)return r("Chrome shim can not determine version, not shimming."),c;r("adapter.js shimming chrome."),c.browserShim=e,vi(t,a),mi(t),Or(t,a),Nr(t),Br(t,a),xr(t),Ur(t,a),Dr(t),Mr(t),jr(t),Fr(t,a),di(t),li(t),fi(t),hi(t,a),pi(t),gi(t,a);break;case"firefox":if(!i||!qr||!n.shimFirefox)return r("Firefox shim is not included in this adapter release."),c;r("adapter.js shimming firefox."),c.browserShim=i,vi(t,a),mi(t),Gr(t,a),qr(t,a),Wr(t),Hr(t),zr(t),$r(t),Kr(t),Jr(t),Xr(t),Yr(t),Zr(t),di(t),fi(t),hi(t,a),pi(t);break;case"safari":if(!o||!n.shimSafari)return r("Safari shim is not included in this adapter release."),c;r("adapter.js shimming safari."),c.browserShim=o,vi(t,a),mi(t),ii(t),si(t),ei(t),Qr(t),ti(t),oi(t),ni(t),ai(t),di(t),li(t),hi(t,a),pi(t),gi(t,a);break;default:r("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window});var yi={Request:"Request",Singleton:"Singleton",Transient:"Transient"},_i={ConstantValue:"ConstantValue",Constructor:"Constructor",DynamicValue:"DynamicValue",Factory:"Factory",Function:"Function",Instance:"Instance",Invalid:"Invalid",Provider:"Provider"},bi={ClassProperty:"ClassProperty",ConstructorArgument:"ConstructorArgument",Variable:"Variable"},Ei=0;function Si(){return Ei++}var Ci=function(){function t(t,e){this.id=Si(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=_i.Invalid,this.constraint=function(t){return!0},this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.onActivation=null,this.onDeactivation=null,this.dynamicValue=null}return t.prototype.clone=function(){var e=new t(this.serviceIdentifier,this.scope);return e.activated=e.scope===yi.Singleton&&this.activated,e.implementationType=this.implementationType,e.dynamicValue=this.dynamicValue,e.scope=this.scope,e.type=this.type,e.factory=this.factory,e.provider=this.provider,e.constraint=this.constraint,e.onActivation=this.onActivation,e.onDeactivation=this.onDeactivation,e.cache=this.cache,e},t}(),wi=function(){function t(){}return t.prototype.getConstructorMetadata=function(t){return{compilerGeneratedMetadata:Reflect.getMetadata(z,t),userGeneratedMetadata:Reflect.getMetadata(W,t)||{}}},t.prototype.getPropertiesMetadata=function(t){return Reflect.getMetadata(q,t)||[]},t}(),Ti={MultipleBindingsAvailable:2,NoBindingsAvailable:0,OnlyOneBindingAvailable:1};function Ii(t){return t instanceof RangeError||t.message===j}function Ri(t){return"function"==typeof t?t.name:"symbol"==typeof t?t.toString():t}function Ai(t,e,n){var r="",i=n(t,e);return 0!==i.length&&(r="\nRegistered bindings:",i.forEach((function(t){var e="Object";null!==t.implementationType&&(e=Pi(t.implementationType)),r=r+"\n "+e,t.constraint.metaData&&(r=r+" - "+t.constraint.metaData)}))),r}function ki(t,e){return null!==t.parentRequest&&(t.parentRequest.serviceIdentifier===e||ki(t.parentRequest,e))}function Oi(t){t.childRequests.forEach((function(t){if(ki(t,t.serviceIdentifier)){var e=function(t){var e=function t(e,n){void 0===n&&(n=[]);var r=Ri(e.serviceIdentifier);return n.push(r),null!==e.parentRequest?t(e.parentRequest,n):n}(t);return e.reverse().join(" --\x3e ")}(t);throw new Error(O+" "+e)}Oi(t)}))}function Pi(t){if(t.name)return t.name;var e=t.toString(),n=e.match(/^function\s*([^\s(]+)/);return n?n[1]:"Anonymous function: "+e}var Ni=function(){function t(t){this.id=Si(),this.container=t}return t.prototype.addPlan=function(t){this.plan=t},t.prototype.setCurrentRequest=function(t){this.currentRequest=t},t}(),xi=function(t,e){this.parentContext=t,this.rootRequest=e},Di=function(){function t(t){this._cb=t}return t.prototype.unwrap=function(){return this._cb()},t}(),Mi=function(){function t(t){this.str=t}return t.prototype.startsWith=function(t){return 0===this.str.indexOf(t)},t.prototype.endsWith=function(t){var e,n=t.split("").reverse().join("");return e=this.str.split("").reverse().join(""),this.startsWith.call({str:e},n)},t.prototype.contains=function(t){return-1!==this.str.indexOf(t)},t.prototype.equals=function(t){return this.str===t},t.prototype.value=function(){return this.str},t}(),ji=function(){function t(t,e,n,r){this.id=Si(),this.type=t,this.serviceIdentifier=n;var i="symbol"==typeof e?e.toString().slice(7,-1):e;this.name=new Mi(i||""),this.identifier=e,this.metadata=new Array;var o=null;"string"==typeof r?o=new Y(L,r):r instanceof Y&&(o=r),null!==o&&this.metadata.push(o)}return t.prototype.hasTag=function(t){for(var e=0,n=this.metadata;e<n.length;e++){if(n[e].key===t)return!0}return!1},t.prototype.isArray=function(){return this.hasTag(V)},t.prototype.matchesArray=function(t){return this.matchesTag(V)(t)},t.prototype.isNamed=function(){return this.hasTag(L)},t.prototype.isTagged=function(){return this.metadata.some((function(t){return J.every((function(e){return t.key!==e}))}))},t.prototype.isOptional=function(){return this.matchesTag(F)(!0)},t.prototype.getNamedTag=function(){return this.isNamed()?this.metadata.filter((function(t){return t.key===L}))[0]:null},t.prototype.getCustomTags=function(){return this.isTagged()?this.metadata.filter((function(t){return J.every((function(e){return t.key!==e}))})):null},t.prototype.matchesNamedTag=function(t){return this.matchesTag(L)(t)},t.prototype.matchesTag=function(t){var e=this;return function(n){for(var r=0,i=e.metadata;r<i.length;r++){var o=i[r];if(o.key===t&&o.value===n)return!0}return!1}},t}(),Li=function(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))};function Ui(t,e,n,r){var i=t.getConstructorMetadata(n),o=i.compilerGeneratedMetadata;if(void 0===o)throw new Error(R+" "+e+".");var s=i.userGeneratedMetadata,a=Object.keys(s),c=0===n.length&&a.length>0,u=a.length>n.length,d=function(t,e,n,r,i){for(var o=[],s=0;s<i;s++){var a=Bi(s,t,e,n,r);null!==a&&o.push(a)}return o}(r,e,o,s,c||u?a.length:n.length),l=Gi(t,n,e);return Li(Li([],d,!0),l,!0)}function Bi(t,e,n,r,i){var o=i[t.toString()]||[],s=Wi(o),a=!0!==s.unmanaged,c=r[t],u=s.inject||s.multiInject;if((c=u||c)instanceof Di&&(c=c.unwrap()),a){if(!e&&(c===Object||c===Function||void 0===c))throw new Error(A+" argument "+t+" in class "+n+".");var d=new ji(bi.ConstructorArgument,s.targetName,c);return d.metadata=o,d}return null}function Fi(t,e,n,r){var i=t||e;if(void 0===i){var o=R+" for property "+String(n)+" in class "+r+".";throw new Error(o)}return i}function Gi(t,e,n){for(var r=t.getPropertiesMetadata(e),i=[],o=Object.getOwnPropertySymbols(r),s=0,a=Object.keys(r).concat(o);s<a.length;s++){var c=a[s],u=r[c],d=Wi(u),l=d.targetName||c,h=Fi(d.inject,d.multiInject,c,n),p=new ji(bi.ClassProperty,l,h);p.metadata=u,i.push(p)}var f=Object.getPrototypeOf(e.prototype).constructor;if(f!==Object){var g=Gi(t,f,n);i=Li(Li([],i,!0),g,!0)}return i}function Vi(t,e){var n=Object.getPrototypeOf(e.prototype).constructor;if(n!==Object){var r=Ui(t,Pi(n),n,!0),i=r.map((function(t){return t.metadata.filter((function(t){return t.key===B}))})),o=[].concat.apply([],i).length,s=r.length-o;return s>0?s:Vi(t,n)}return 0}function Wi(t){var e={};return t.forEach((function(t){e[t.key.toString()]=t.value})),{inject:e[G],multiInject:e[V],targetName:e[U],unmanaged:e[B]}}var qi=function(){function t(t,e,n,r,i){this.id=Si(),this.serviceIdentifier=t,this.parentContext=e,this.parentRequest=n,this.target=i,this.childRequests=[],this.bindings=Array.isArray(r)?r:[r],this.requestScope=null===n?new Map:null}return t.prototype.addChildRequest=function(e,n,r){var i=new t(e,this.parentContext,this,n,r);return this.childRequests.push(i),i},t}();function zi(t){return t._bindingDictionary}function $i(t,e,n,r,i){var o=Ki(n.container,i.serviceIdentifier),s=[];return o.length===Ti.NoBindingsAvailable&&n.container.options.autoBindInjectable&&"function"==typeof i.serviceIdentifier&&t.getConstructorMetadata(i.serviceIdentifier).compilerGeneratedMetadata&&(n.container.bind(i.serviceIdentifier).toSelf(),o=Ki(n.container,i.serviceIdentifier)),s=e?o:o.filter((function(t){var e=new qi(t.serviceIdentifier,n,r,t,i);return t.constraint(e)})),function(t,e,n,r){switch(e.length){case Ti.NoBindingsAvailable:if(n.isOptional())return e;var i=Ri(t),o=I;throw o+=function(t,e){if(e.isTagged()||e.isNamed()){var n="",r=e.getNamedTag(),i=e.getCustomTags();return null!==r&&(n+=r.toString()+"\n"),null!==i&&i.forEach((function(t){n+=t.toString()+"\n"}))," "+t+"\n "+t+" - "+n}return" "+t}(i,n),o+=Ai(r,i,Ki),new Error(o);case Ti.OnlyOneBindingAvailable:return e;case Ti.MultipleBindingsAvailable:default:if(n.isArray())return e;i=Ri(t),o=T+" "+i;throw o+=Ai(r,i,Ki),new Error(o)}}(i.serviceIdentifier,s,i,n.container),s}function Hi(t,e,n,r,i,o){var s,a;if(null===i){s=$i(t,e,r,null,o),a=new qi(n,r,null,s,o);var c=new xi(r,a);r.addPlan(c)}else s=$i(t,e,r,i,o),a=i.addChildRequest(o.serviceIdentifier,s,o);s.forEach((function(e){var n=null;if(o.isArray())n=a.addChildRequest(e.serviceIdentifier,e,o);else{if(e.cache)return;n=a}if(e.type===_i.Instance&&null!==e.implementationType){var i=function(t,e){return Ui(t,Pi(e),e,!1)}(t,e.implementationType);if(!r.container.options.skipBaseClassChecks){var s=Vi(t,e.implementationType);if(i.length<s){var c=N(Pi(e.implementationType));throw new Error(c)}}i.forEach((function(e){Hi(t,!1,e.serviceIdentifier,r,n,e)}))}}))}function Ki(t,e){var n=[],r=zi(t);return r.hasKey(e)?n=r.get(e):null!==t.parent&&(n=Ki(t.parent,e)),n}function Ji(t,e,n,r,i,o,s,a){void 0===a&&(a=!1);var c=new Ni(e),u=function(t,e,n,r,i,o){var s=new Y(t?V:G,n),a=new ji(e,r,n,s);if(void 0!==i){var c=new Y(i,o);a.metadata.push(c)}return a}(n,r,i,"",o,s);try{return Hi(t,a,i,c,null,u),c}catch(t){throw Ii(t)&&Oi(c.plan.rootRequest),t}}function Xi(t){return("object"==typeof t&&null!==t||"function"==typeof t)&&"function"==typeof t.then}function Yi(t){return!!Xi(t)||Array.isArray(t)&&t.some(Xi)}var Zi,Qi=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))},to=function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},eo=function(t,e,n){t.has(e.id)||t.set(e.id,n)},no=function(t,e){t.cache=e,t.activated=!0,Xi(e)&&ro(t,e)},ro=function(t,e){return Qi(void 0,void 0,void 0,(function(){var n,r;return to(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,e];case 1:return n=i.sent(),t.cache=n,[3,3];case 2:throw r=i.sent(),t.cache=null,t.activated=!1,r;case 3:return[2]}}))}))};!function(t){t.DynamicValue="toDynamicValue",t.Factory="toFactory",t.Provider="toProvider"}(Zi||(Zi={}));var io=function(){return io=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},io.apply(this,arguments)},oo=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))},so=function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},ao=function(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))};function co(t,e,n){var r;if(e.length>0){var i=function(t,e){return t.reduce((function(t,n){var r=e(n);return n.target.type===bi.ConstructorArgument?t.constructorInjections.push(r):(t.propertyRequests.push(n),t.propertyInjections.push(r)),t.isAsync||(t.isAsync=Yi(r)),t}),{constructorInjections:[],propertyInjections:[],propertyRequests:[],isAsync:!1})}(e,n),o=io(io({},i),{constr:t});r=i.isAsync?function(t){return oo(this,void 0,void 0,(function(){var e,n;return so(this,(function(r){switch(r.label){case 0:return[4,lo(t.constructorInjections)];case 1:return e=r.sent(),[4,lo(t.propertyInjections)];case 2:return n=r.sent(),[2,uo(io(io({},t),{constructorInjections:e,propertyInjections:n}))]}}))}))}(o):uo(o)}else r=new t;return r}function uo(t){var e,n=new((e=t.constr).bind.apply(e,ao([void 0],t.constructorInjections,!1)));return t.propertyRequests.forEach((function(e,r){var i=e.target.identifier,o=t.propertyInjections[r];n[i]=o})),n}function lo(t){return oo(this,void 0,void 0,(function(){var e,n,r,i;return so(this,(function(o){for(e=[],n=0,r=t;n<r.length;n++)i=r[n],Array.isArray(i)?e.push(Promise.all(i)):e.push(i);return[2,Promise.all(e)]}))}))}function ho(t,e){var n=function(t,e){var n,r;if(Reflect.hasMetadata(H,t)){var i=Reflect.getMetadata(H,t);try{return null===(r=(n=e)[i.value])||void 0===r?void 0:r.call(n)}catch(e){throw new Error(x(t.name,e.message))}}}(t,e);return Xi(n)?n.then((function(){return e})):e}function po(t,e){t.scope!==yi.Singleton&&function(t,e){var n="Class cannot be instantiated in "+(t.scope===yi.Request?"request":"transient")+" scope.";if("function"==typeof t.onDeactivation)throw new Error(M(e.name,n));if(Reflect.hasMetadata(K,e))throw new Error(D(e.name,n))}(t,e)}var fo=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))},go=function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},vo=function(t){return function(e){e.parentContext.setCurrentRequest(e);var n=e.bindings,r=e.childRequests,i=e.target&&e.target.isArray(),o=!(e.parentRequest&&e.parentRequest.target&&e.target&&e.parentRequest.target.matchesArray(e.target.serviceIdentifier));if(i&&o)return r.map((function(e){return vo(t)(e)}));if(!e.target.isOptional()||0!==n.length){var s=n[0];return bo(t,e,s)}}},mo=function(t,e){var n=function(t){switch(t.type){case _i.Factory:return{factory:t.factory,factoryType:Zi.Factory};case _i.Provider:return{factory:t.provider,factoryType:Zi.Provider};case _i.DynamicValue:return{factory:t.dynamicValue,factoryType:Zi.DynamicValue};default:throw new Error("Unexpected factory type "+t.type)}}(t);return function(t,e){try{return t()}catch(t){throw Ii(t)&&(t=e()),t}}((function(){return n.factory.bind(t)(e)}),(function(){return new Error((t=n.factoryType,r=e.currentRequest.serviceIdentifier.toString(),"It looks like there is a circular dependency in one of the '"+t+"' bindings. Please investigate bindings withservice identifier '"+r+"'."));var t,r}))},yo=function(t,e,n){var r,i=e.childRequests;switch(function(t){var e=null;switch(t.type){case _i.ConstantValue:case _i.Function:e=t.cache;break;case _i.Constructor:case _i.Instance:e=t.implementationType;break;case _i.DynamicValue:e=t.dynamicValue;break;case _i.Provider:e=t.provider;break;case _i.Factory:e=t.factory}if(null===e){var n=Ri(t.serviceIdentifier);throw new Error("Invalid binding type: "+n)}}(n),n.type){case _i.ConstantValue:case _i.Function:r=n.cache;break;case _i.Constructor:r=n.implementationType;break;case _i.Instance:r=function(t,e,n,r){po(t,e);var i=co(e,n,r);return Xi(i)?i.then((function(t){return ho(e,t)})):ho(e,i)}(n,n.implementationType,i,vo(t));break;default:r=mo(n,e.parentContext)}return r},_o=function(t,e,n){var r=function(t,e){return e.scope===yi.Singleton&&e.activated?e.cache:e.scope===yi.Request&&t.has(e.id)?t.get(e.id):null}(t,e);return null!==r||function(t,e,n){e.scope===yi.Singleton&&no(e,n),e.scope===yi.Request&&eo(t,e,n)}(t,e,r=n()),r},bo=function(t,e,n){return _o(t,n,(function(){var r=yo(t,e,n);return r=Xi(r)?r.then((function(t){return Eo(e,n,t)})):Eo(e,n,r)}))};function Eo(t,e,n){var r,i=So(t.parentContext,e,n),o=Io(t.parentContext.container),s=o.next();do{r=s.value;var a=t.parentContext,c=t.serviceIdentifier,u=To(r,c);i=Xi(i)?wo(u,a,i):Co(u,a,i),s=o.next()}while(!0!==s.done&&!zi(r).hasKey(t.serviceIdentifier));return i}var So=function(t,e,n){return"function"==typeof e.onActivation?e.onActivation(t,n):n},Co=function(t,e,n){for(var r=t.next();!r.done;){if(Xi(n=r.value(e,n)))return wo(t,e,n);r=t.next()}return n},wo=function(t,e,n){return fo(void 0,void 0,void 0,(function(){var r,i;return go(this,(function(o){switch(o.label){case 0:return[4,n];case 1:r=o.sent(),i=t.next(),o.label=2;case 2:return i.done?[3,4]:[4,i.value(e,r)];case 3:return r=o.sent(),i=t.next(),[3,2];case 4:return[2,r]}}))}))},To=function(t,e){var n=t._activations;return n.hasKey(e)?n.get(e).values():[].values()},Io=function(t){for(var e=[t],n=t.parent;null!==n;)e.push(n),n=n.parent;return{next:function(){var t=e.pop();return void 0!==t?{done:!1,value:t}:{done:!0,value:void 0}}}};var Ro=function(t,e){var n=t.parentRequest;return null!==n&&(!!e(n)||Ro(n,e))},Ao=function(t){return function(e){var n=function(n){return null!==n&&null!==n.target&&n.target.matchesTag(t)(e)};return n.metaData=new Y(t,e),n}},ko=Ao(L),Oo=function(t){return function(e){var n=null;if(null!==e){if(n=e.bindings[0],"string"==typeof t)return n.serviceIdentifier===t;var r=e.bindings[0].implementationType;return t===r}return!1}},Po=function(){function t(t){this._binding=t}return t.prototype.when=function(t){return this._binding.constraint=t,new No(this._binding)},t.prototype.whenTargetNamed=function(t){return this._binding.constraint=ko(t),new No(this._binding)},t.prototype.whenTargetIsDefault=function(){return this._binding.constraint=function(t){return null!==t&&(null!==t.target&&!t.target.isNamed()&&!t.target.isTagged())},new No(this._binding)},t.prototype.whenTargetTagged=function(t,e){return this._binding.constraint=Ao(t)(e),new No(this._binding)},t.prototype.whenInjectedInto=function(t){return this._binding.constraint=function(e){return null!==e&&Oo(t)(e.parentRequest)},new No(this._binding)},t.prototype.whenParentNamed=function(t){return this._binding.constraint=function(e){return null!==e&&ko(t)(e.parentRequest)},new No(this._binding)},t.prototype.whenParentTagged=function(t,e){return this._binding.constraint=function(n){return null!==n&&Ao(t)(e)(n.parentRequest)},new No(this._binding)},t.prototype.whenAnyAncestorIs=function(t){return this._binding.constraint=function(e){return null!==e&&Ro(e,Oo(t))},new No(this._binding)},t.prototype.whenNoAncestorIs=function(t){return this._binding.constraint=function(e){return null!==e&&!Ro(e,Oo(t))},new No(this._binding)},t.prototype.whenAnyAncestorNamed=function(t){return this._binding.constraint=function(e){return null!==e&&Ro(e,ko(t))},new No(this._binding)},t.prototype.whenNoAncestorNamed=function(t){return this._binding.constraint=function(e){return null!==e&&!Ro(e,ko(t))},new No(this._binding)},t.prototype.whenAnyAncestorTagged=function(t,e){return this._binding.constraint=function(n){return null!==n&&Ro(n,Ao(t)(e))},new No(this._binding)},t.prototype.whenNoAncestorTagged=function(t,e){return this._binding.constraint=function(n){return null!==n&&!Ro(n,Ao(t)(e))},new No(this._binding)},t.prototype.whenAnyAncestorMatches=function(t){return this._binding.constraint=function(e){return null!==e&&Ro(e,t)},new No(this._binding)},t.prototype.whenNoAncestorMatches=function(t){return this._binding.constraint=function(e){return null!==e&&!Ro(e,t)},new No(this._binding)},t}(),No=function(){function t(t){this._binding=t}return t.prototype.onActivation=function(t){return this._binding.onActivation=t,new Po(this._binding)},t.prototype.onDeactivation=function(t){return this._binding.onDeactivation=t,new Po(this._binding)},t}(),xo=function(){function t(t){this._binding=t,this._bindingWhenSyntax=new Po(this._binding),this._bindingOnSyntax=new No(this._binding)}return t.prototype.when=function(t){return this._bindingWhenSyntax.when(t)},t.prototype.whenTargetNamed=function(t){return this._bindingWhenSyntax.whenTargetNamed(t)},t.prototype.whenTargetIsDefault=function(){return this._bindingWhenSyntax.whenTargetIsDefault()},t.prototype.whenTargetTagged=function(t,e){return this._bindingWhenSyntax.whenTargetTagged(t,e)},t.prototype.whenInjectedInto=function(t){return this._bindingWhenSyntax.whenInjectedInto(t)},t.prototype.whenParentNamed=function(t){return this._bindingWhenSyntax.whenParentNamed(t)},t.prototype.whenParentTagged=function(t,e){return this._bindingWhenSyntax.whenParentTagged(t,e)},t.prototype.whenAnyAncestorIs=function(t){return this._bindingWhenSyntax.whenAnyAncestorIs(t)},t.prototype.whenNoAncestorIs=function(t){return this._bindingWhenSyntax.whenNoAncestorIs(t)},t.prototype.whenAnyAncestorNamed=function(t){return this._bindingWhenSyntax.whenAnyAncestorNamed(t)},t.prototype.whenAnyAncestorTagged=function(t,e){return this._bindingWhenSyntax.whenAnyAncestorTagged(t,e)},t.prototype.whenNoAncestorNamed=function(t){return this._bindingWhenSyntax.whenNoAncestorNamed(t)},t.prototype.whenNoAncestorTagged=function(t,e){return this._bindingWhenSyntax.whenNoAncestorTagged(t,e)},t.prototype.whenAnyAncestorMatches=function(t){return this._bindingWhenSyntax.whenAnyAncestorMatches(t)},t.prototype.whenNoAncestorMatches=function(t){return this._bindingWhenSyntax.whenNoAncestorMatches(t)},t.prototype.onActivation=function(t){return this._bindingOnSyntax.onActivation(t)},t.prototype.onDeactivation=function(t){return this._bindingOnSyntax.onDeactivation(t)},t}(),Do=function(){function t(t){this._binding=t}return t.prototype.inRequestScope=function(){return this._binding.scope=yi.Request,new xo(this._binding)},t.prototype.inSingletonScope=function(){return this._binding.scope=yi.Singleton,new xo(this._binding)},t.prototype.inTransientScope=function(){return this._binding.scope=yi.Transient,new xo(this._binding)},t}(),Mo=function(){function t(t){this._binding=t,this._bindingWhenSyntax=new Po(this._binding),this._bindingOnSyntax=new No(this._binding),this._bindingInSyntax=new Do(t)}return t.prototype.inRequestScope=function(){return this._bindingInSyntax.inRequestScope()},t.prototype.inSingletonScope=function(){return this._bindingInSyntax.inSingletonScope()},t.prototype.inTransientScope=function(){return this._bindingInSyntax.inTransientScope()},t.prototype.when=function(t){return this._bindingWhenSyntax.when(t)},t.prototype.whenTargetNamed=function(t){return this._bindingWhenSyntax.whenTargetNamed(t)},t.prototype.whenTargetIsDefault=function(){return this._bindingWhenSyntax.whenTargetIsDefault()},t.prototype.whenTargetTagged=function(t,e){return this._bindingWhenSyntax.whenTargetTagged(t,e)},t.prototype.whenInjectedInto=function(t){return this._bindingWhenSyntax.whenInjectedInto(t)},t.prototype.whenParentNamed=function(t){return this._bindingWhenSyntax.whenParentNamed(t)},t.prototype.whenParentTagged=function(t,e){return this._bindingWhenSyntax.whenParentTagged(t,e)},t.prototype.whenAnyAncestorIs=function(t){return this._bindingWhenSyntax.whenAnyAncestorIs(t)},t.prototype.whenNoAncestorIs=function(t){return this._bindingWhenSyntax.whenNoAncestorIs(t)},t.prototype.whenAnyAncestorNamed=function(t){return this._bindingWhenSyntax.whenAnyAncestorNamed(t)},t.prototype.whenAnyAncestorTagged=function(t,e){return this._bindingWhenSyntax.whenAnyAncestorTagged(t,e)},t.prototype.whenNoAncestorNamed=function(t){return this._bindingWhenSyntax.whenNoAncestorNamed(t)},t.prototype.whenNoAncestorTagged=function(t,e){return this._bindingWhenSyntax.whenNoAncestorTagged(t,e)},t.prototype.whenAnyAncestorMatches=function(t){return this._bindingWhenSyntax.whenAnyAncestorMatches(t)},t.prototype.whenNoAncestorMatches=function(t){return this._bindingWhenSyntax.whenNoAncestorMatches(t)},t.prototype.onActivation=function(t){return this._bindingOnSyntax.onActivation(t)},t.prototype.onDeactivation=function(t){return this._bindingOnSyntax.onDeactivation(t)},t}(),jo=function(){function t(t){this._binding=t}return t.prototype.to=function(t){return this._binding.type=_i.Instance,this._binding.implementationType=t,new Mo(this._binding)},t.prototype.toSelf=function(){if("function"!=typeof this._binding.serviceIdentifier)throw new Error("The toSelf function can only be applied when a constructor is used as service identifier");var t=this._binding.serviceIdentifier;return this.to(t)},t.prototype.toConstantValue=function(t){return this._binding.type=_i.ConstantValue,this._binding.cache=t,this._binding.dynamicValue=null,this._binding.implementationType=null,this._binding.scope=yi.Singleton,new xo(this._binding)},t.prototype.toDynamicValue=function(t){return this._binding.type=_i.DynamicValue,this._binding.cache=null,this._binding.dynamicValue=t,this._binding.implementationType=null,new Mo(this._binding)},t.prototype.toConstructor=function(t){return this._binding.type=_i.Constructor,this._binding.implementationType=t,this._binding.scope=yi.Singleton,new xo(this._binding)},t.prototype.toFactory=function(t){return this._binding.type=_i.Factory,this._binding.factory=t,this._binding.scope=yi.Singleton,new xo(this._binding)},t.prototype.toFunction=function(t){if("function"!=typeof t)throw new Error("Value provided to function binding must be a function!");var e=this.toConstantValue(t);return this._binding.type=_i.Function,this._binding.scope=yi.Singleton,e},t.prototype.toAutoFactory=function(t){return this._binding.type=_i.Factory,this._binding.factory=function(e){return function(){return e.container.get(t)}},this._binding.scope=yi.Singleton,new xo(this._binding)},t.prototype.toAutoNamedFactory=function(t){return this._binding.type=_i.Factory,this._binding.factory=function(e){return function(n){return e.container.getNamed(t,n)}},new xo(this._binding)},t.prototype.toProvider=function(t){return this._binding.type=_i.Provider,this._binding.provider=t,this._binding.scope=yi.Singleton,new xo(this._binding)},t.prototype.toService=function(t){this.toDynamicValue((function(e){return e.container.get(t)}))},t}(),Lo=function(){function t(){}return t.of=function(e,n,r,i,o){var s=new t;return s.bindings=e,s.middleware=n,s.deactivations=i,s.activations=r,s.moduleActivationStore=o,s},t}();var Uo=function(){function t(){this._map=new Map}return t.prototype.getMap=function(){return this._map},t.prototype.add=function(t,e){if(null==t)throw new Error(C);if(null==e)throw new Error(C);var n=this._map.get(t);void 0!==n?n.push(e):this._map.set(t,[e])},t.prototype.get=function(t){if(null==t)throw new Error(C);var e=this._map.get(t);if(void 0!==e)return e;throw new Error(w)},t.prototype.remove=function(t){if(null==t)throw new Error(C);if(!this._map.delete(t))throw new Error(w)},t.prototype.removeIntersection=function(t){var e=this;this.traverse((function(n,r){var i=t.hasKey(n)?t.get(n):void 0;if(void 0!==i){var o=r.filter((function(t){return!i.some((function(e){return t===e}))}));e._setValue(n,o)}}))},t.prototype.removeByCondition=function(t){var e=this,n=[];return this._map.forEach((function(r,i){for(var o=[],s=0,a=r;s<a.length;s++){var c=a[s];t(c)?n.push(c):o.push(c)}e._setValue(i,o)})),n},t.prototype.hasKey=function(t){if(null==t)throw new Error(C);return this._map.has(t)},t.prototype.clone=function(){var e=new t;return this._map.forEach((function(t,n){t.forEach((function(t){return e.add(n,"object"==typeof(r=t)&&null!==r&&"clone"in r&&"function"==typeof r.clone?t.clone():t);var r}))})),e},t.prototype.traverse=function(t){this._map.forEach((function(e,n){t(n,e)}))},t.prototype._setValue=function(t,e){e.length>0?this._map.set(t,e):this._map.delete(t)},t}(),Bo=function(){function t(){this._map=new Map}return t.prototype.remove=function(t){if(this._map.has(t)){var e=this._map.get(t);return this._map.delete(t),e}return this._getEmptyHandlersStore()},t.prototype.addDeactivation=function(t,e,n){this._getModuleActivationHandlers(t).onDeactivations.add(e,n)},t.prototype.addActivation=function(t,e,n){this._getModuleActivationHandlers(t).onActivations.add(e,n)},t.prototype.clone=function(){var e=new t;return this._map.forEach((function(t,n){e._map.set(n,{onActivations:t.onActivations.clone(),onDeactivations:t.onDeactivations.clone()})})),e},t.prototype._getModuleActivationHandlers=function(t){var e=this._map.get(t);return void 0===e&&(e=this._getEmptyHandlersStore(),this._map.set(t,e)),e},t.prototype._getEmptyHandlersStore=function(){return{onActivations:new Uo,onDeactivations:new Uo}},t}(),Fo=function(){return Fo=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Fo.apply(this,arguments)},Go=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))},Vo=function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},Wo=function(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))},qo=function(){function t(t){var e=t||{};if("object"!=typeof e)throw new Error("Invalid Container constructor argument. Container options must be an object.");if(void 0===e.defaultScope)e.defaultScope=yi.Transient;else if(e.defaultScope!==yi.Singleton&&e.defaultScope!==yi.Transient&&e.defaultScope!==yi.Request)throw new Error("Invalid Container option. Default scope must be a string ('singleton' or 'transient').");if(void 0===e.autoBindInjectable)e.autoBindInjectable=!1;else if("boolean"!=typeof e.autoBindInjectable)throw new Error("Invalid Container option. Auto bind injectable must be a boolean");if(void 0===e.skipBaseClassChecks)e.skipBaseClassChecks=!1;else if("boolean"!=typeof e.skipBaseClassChecks)throw new Error("Invalid Container option. Skip base check must be a boolean");this.options={autoBindInjectable:e.autoBindInjectable,defaultScope:e.defaultScope,skipBaseClassChecks:e.skipBaseClassChecks},this.id=Si(),this._bindingDictionary=new Uo,this._snapshots=[],this._middleware=null,this._activations=new Uo,this._deactivations=new Uo,this.parent=null,this._metadataReader=new wi,this._moduleActivationStore=new Bo}return t.merge=function(e,n){for(var r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];var o=new t,s=Wo([e,n],r,!0).map((function(t){return zi(t)})),a=zi(o);return s.forEach((function(t){var e;e=a,t.traverse((function(t,n){n.forEach((function(t){e.add(t.serviceIdentifier,t.clone())}))}))})),o},t.prototype.load=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n=this._getContainerModuleHelpersFactory(),r=0,i=t;r<i.length;r++){var o=i[r],s=n(o.id);o.registry(s.bindFunction,s.unbindFunction,s.isboundFunction,s.rebindFunction,s.unbindAsyncFunction,s.onActivationFunction,s.onDeactivationFunction)}},t.prototype.loadAsync=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Go(this,void 0,void 0,(function(){var e,n,r,i,o;return Vo(this,(function(s){switch(s.label){case 0:e=this._getContainerModuleHelpersFactory(),n=0,r=t,s.label=1;case 1:return n<r.length?(i=r[n],o=e(i.id),[4,i.registry(o.bindFunction,o.unbindFunction,o.isboundFunction,o.rebindFunction,o.unbindAsyncFunction,o.onActivationFunction,o.onDeactivationFunction)]):[3,4];case 2:s.sent(),s.label=3;case 3:return n++,[3,1];case 4:return[2]}}))}))},t.prototype.unload=function(){for(var t=this,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];e.forEach((function(e){var n=t._removeModuleBindings(e.id);t._deactivateSingletons(n),t._removeModuleHandlers(e.id)}))},t.prototype.unloadAsync=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Go(this,void 0,void 0,(function(){var e,n,r,i;return Vo(this,(function(o){switch(o.label){case 0:e=0,n=t,o.label=1;case 1:return e<n.length?(r=n[e],i=this._removeModuleBindings(r.id),[4,this._deactivateSingletonsAsync(i)]):[3,4];case 2:o.sent(),this._removeModuleHandlers(r.id),o.label=3;case 3:return e++,[3,1];case 4:return[2]}}))}))},t.prototype.bind=function(t){var e=this.options.defaultScope||yi.Transient,n=new Ci(t,e);return this._bindingDictionary.add(t,n),new jo(n)},t.prototype.rebind=function(t){return this.unbind(t),this.bind(t)},t.prototype.rebindAsync=function(t){return Go(this,void 0,void 0,(function(){return Vo(this,(function(e){switch(e.label){case 0:return[4,this.unbindAsync(t)];case 1:return e.sent(),[2,this.bind(t)]}}))}))},t.prototype.unbind=function(t){if(this._bindingDictionary.hasKey(t)){var e=this._bindingDictionary.get(t);this._deactivateSingletons(e)}this._removeServiceFromDictionary(t)},t.prototype.unbindAsync=function(t){return Go(this,void 0,void 0,(function(){var e;return Vo(this,(function(n){switch(n.label){case 0:return this._bindingDictionary.hasKey(t)?(e=this._bindingDictionary.get(t),[4,this._deactivateSingletonsAsync(e)]):[3,2];case 1:n.sent(),n.label=2;case 2:return this._removeServiceFromDictionary(t),[2]}}))}))},t.prototype.unbindAll=function(){var t=this;this._bindingDictionary.traverse((function(e,n){t._deactivateSingletons(n)})),this._bindingDictionary=new Uo},t.prototype.unbindAllAsync=function(){return Go(this,void 0,void 0,(function(){var t,e=this;return Vo(this,(function(n){switch(n.label){case 0:return t=[],this._bindingDictionary.traverse((function(n,r){t.push(e._deactivateSingletonsAsync(r))})),[4,Promise.all(t)];case 1:return n.sent(),this._bindingDictionary=new Uo,[2]}}))}))},t.prototype.onActivation=function(t,e){this._activations.add(t,e)},t.prototype.onDeactivation=function(t,e){this._deactivations.add(t,e)},t.prototype.isBound=function(t){var e=this._bindingDictionary.hasKey(t);return!e&&this.parent&&(e=this.parent.isBound(t)),e},t.prototype.isCurrentBound=function(t){return this._bindingDictionary.hasKey(t)},t.prototype.isBoundNamed=function(t,e){return this.isBoundTagged(t,L,e)},t.prototype.isBoundTagged=function(t,e,n){var r=!1;if(this._bindingDictionary.hasKey(t)){var i=this._bindingDictionary.get(t),o=function(t,e,n,r){var i=new ji(bi.Variable,"",e,new Y(n,r)),o=new Ni(t);return new qi(e,o,null,[],i)}(this,t,e,n);r=i.some((function(t){return t.constraint(o)}))}return!r&&this.parent&&(r=this.parent.isBoundTagged(t,e,n)),r},t.prototype.snapshot=function(){this._snapshots.push(Lo.of(this._bindingDictionary.clone(),this._middleware,this._activations.clone(),this._deactivations.clone(),this._moduleActivationStore.clone()))},t.prototype.restore=function(){var t=this._snapshots.pop();if(void 0===t)throw new Error("No snapshot available to restore.");this._bindingDictionary=t.bindings,this._activations=t.activations,this._deactivations=t.deactivations,this._middleware=t.middleware,this._moduleActivationStore=t.moduleActivationStore},t.prototype.createChild=function(e){var n=new t(e||this.options);return n.parent=this,n},t.prototype.applyMiddleware=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=this._middleware?this._middleware:this._planAndResolve();this._middleware=t.reduce((function(t,e){return e(t)}),n)},t.prototype.applyCustomMetadataReader=function(t){this._metadataReader=t},t.prototype.get=function(t){var e=this._getNotAllArgs(t,!1);return this._getButThrowIfAsync(e)},t.prototype.getAsync=function(t){return Go(this,void 0,void 0,(function(){var e;return Vo(this,(function(n){return e=this._getNotAllArgs(t,!1),[2,this._get(e)]}))}))},t.prototype.getTagged=function(t,e,n){var r=this._getNotAllArgs(t,!1,e,n);return this._getButThrowIfAsync(r)},t.prototype.getTaggedAsync=function(t,e,n){return Go(this,void 0,void 0,(function(){var r;return Vo(this,(function(i){return r=this._getNotAllArgs(t,!1,e,n),[2,this._get(r)]}))}))},t.prototype.getNamed=function(t,e){return this.getTagged(t,L,e)},t.prototype.getNamedAsync=function(t,e){return this.getTaggedAsync(t,L,e)},t.prototype.getAll=function(t){var e=this._getAllArgs(t);return this._getButThrowIfAsync(e)},t.prototype.getAllAsync=function(t){var e=this._getAllArgs(t);return this._getAll(e)},t.prototype.getAllTagged=function(t,e,n){var r=this._getNotAllArgs(t,!0,e,n);return this._getButThrowIfAsync(r)},t.prototype.getAllTaggedAsync=function(t,e,n){var r=this._getNotAllArgs(t,!0,e,n);return this._getAll(r)},t.prototype.getAllNamed=function(t,e){return this.getAllTagged(t,L,e)},t.prototype.getAllNamedAsync=function(t,e){return this.getAllTaggedAsync(t,L,e)},t.prototype.resolve=function(t){var e=this.isBound(t);e||this.bind(t).toSelf();var n=this.get(t);return e||this.unbind(t),n},t.prototype._preDestroy=function(t,e){if(Reflect.hasMetadata(K,t))return e[Reflect.getMetadata(K,t).value]()},t.prototype._removeModuleHandlers=function(t){var e=this._moduleActivationStore.remove(t);this._activations.removeIntersection(e.onActivations),this._deactivations.removeIntersection(e.onDeactivations)},t.prototype._removeModuleBindings=function(t){return this._bindingDictionary.removeByCondition((function(e){return e.moduleId===t}))},t.prototype._deactivate=function(t,e){var n=this,r=Object.getPrototypeOf(e).constructor;try{if(this._deactivations.hasKey(t.serviceIdentifier)){var i=this._deactivateContainer(e,this._deactivations.get(t.serviceIdentifier).values());if(Xi(i))return this._handleDeactivationError(i.then((function(){return n._propagateContainerDeactivationThenBindingAndPreDestroyAsync(t,e,r)})),r)}var o=this._propagateContainerDeactivationThenBindingAndPreDestroy(t,e,r);if(Xi(o))return this._handleDeactivationError(o,r)}catch(t){throw new Error(M(r.name,t.message))}},t.prototype._handleDeactivationError=function(t,e){return Go(this,void 0,void 0,(function(){var n;return Vo(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,t];case 1:return r.sent(),[3,3];case 2:throw n=r.sent(),new Error(M(e.name,n.message));case 3:return[2]}}))}))},t.prototype._deactivateContainer=function(t,e){for(var n=this,r=e.next();r.value;){var i=r.value(t);if(Xi(i))return i.then((function(){return n._deactivateContainerAsync(t,e)}));r=e.next()}},t.prototype._deactivateContainerAsync=function(t,e){return Go(this,void 0,void 0,(function(){var n;return Vo(this,(function(r){switch(r.label){case 0:n=e.next(),r.label=1;case 1:return n.value?[4,n.value(t)]:[3,3];case 2:return r.sent(),n=e.next(),[3,1];case 3:return[2]}}))}))},t.prototype._getContainerModuleHelpersFactory=function(){var t=this,e=function(t,e){t._binding.moduleId=e},n=function(n){return function(r){var i=t.rebind(r);return e(i,n),i}},r=function(e){return function(n,r){t._moduleActivationStore.addActivation(e,n,r),t.onActivation(n,r)}},i=function(e){return function(n,r){t._moduleActivationStore.addDeactivation(e,n,r),t.onDeactivation(n,r)}};return function(o){return{bindFunction:(s=o,function(n){var r=t.bind(n);return e(r,s),r}),isboundFunction:function(e){return t.isBound(e)},onActivationFunction:r(o),onDeactivationFunction:i(o),rebindFunction:n(o),unbindFunction:function(e){return t.unbind(e)},unbindAsyncFunction:function(e){return t.unbindAsync(e)}};var s}},t.prototype._getAll=function(t){return Promise.all(this._get(t))},t.prototype._get=function(t){var e=Fo(Fo({},t),{contextInterceptor:function(t){return t},targetType:bi.Variable});if(this._middleware){var n=this._middleware(e);if(null==n)throw new Error("Invalid return type in middleware. Middleware must return!");return n}return this._planAndResolve()(e)},t.prototype._getButThrowIfAsync=function(t){var e=this._get(t);if(Yi(e))throw new Error("You are attempting to construct '"+t.serviceIdentifier+"' in a synchronous way\n but it has asynchronous dependencies.");return e},t.prototype._getAllArgs=function(t){return{avoidConstraints:!0,isMultiInject:!0,serviceIdentifier:t}},t.prototype._getNotAllArgs=function(t,e,n,r){return{avoidConstraints:!1,isMultiInject:e,serviceIdentifier:t,key:n,value:r}},t.prototype._planAndResolve=function(){var t=this;return function(e){var n=Ji(t._metadataReader,t,e.isMultiInject,e.targetType,e.serviceIdentifier,e.key,e.value,e.avoidConstraints);return function(t){return vo(t.plan.rootRequest.requestScope)(t.plan.rootRequest)}(n=e.contextInterceptor(n))}},t.prototype._deactivateIfSingleton=function(t){var e=this;if(t.activated)return Xi(t.cache)?t.cache.then((function(n){return e._deactivate(t,n)})):this._deactivate(t,t.cache)},t.prototype._deactivateSingletons=function(t){for(var e=0,n=t;e<n.length;e++){var r=n[e];if(Xi(this._deactivateIfSingleton(r)))throw new Error("Attempting to unbind dependency with asynchronous destruction (@preDestroy or onDeactivation)")}},t.prototype._deactivateSingletonsAsync=function(t){return Go(this,void 0,void 0,(function(){var e=this;return Vo(this,(function(n){switch(n.label){case 0:return[4,Promise.all(t.map((function(t){return e._deactivateIfSingleton(t)})))];case 1:return n.sent(),[2]}}))}))},t.prototype._propagateContainerDeactivationThenBindingAndPreDestroy=function(t,e,n){return this.parent?this._deactivate.bind(this.parent)(t,e):this._bindingDeactivationAndPreDestroy(t,e,n)},t.prototype._propagateContainerDeactivationThenBindingAndPreDestroyAsync=function(t,e,n){return Go(this,void 0,void 0,(function(){return Vo(this,(function(r){switch(r.label){case 0:return this.parent?[4,this._deactivate.bind(this.parent)(t,e)]:[3,2];case 1:return r.sent(),[3,4];case 2:return[4,this._bindingDeactivationAndPreDestroyAsync(t,e,n)];case 3:r.sent(),r.label=4;case 4:return[2]}}))}))},t.prototype._removeServiceFromDictionary=function(t){try{this._bindingDictionary.remove(t)}catch(e){throw new Error("Could not unbind serviceIdentifier: "+Ri(t))}},t.prototype._bindingDeactivationAndPreDestroy=function(t,e,n){var r=this;if("function"==typeof t.onDeactivation){var i=t.onDeactivation(e);if(Xi(i))return i.then((function(){return r._preDestroy(n,e)}))}return this._preDestroy(n,e)},t.prototype._bindingDeactivationAndPreDestroyAsync=function(t,e,n){return Go(this,void 0,void 0,(function(){return Vo(this,(function(r){switch(r.label){case 0:return"function"!=typeof t.onDeactivation?[3,2]:[4,t.onDeactivation(e)];case 1:r.sent(),r.label=2;case 2:return[4,this._preDestroy(n,e)];case 3:return r.sent(),[2]}}))}))},t}(),zo=n(4879);class Samples{constructor(){this.min=0,this.max=0,this.sum=0,this.data=[]}push(t){(0===this.min||t<this.min)&&(this.min=t),t>=this.max&&(this.max=t),this.data.push(t),this.sum+=t}median(){this.data.sort();const t=this.data.length>>1;return this.data.length%2==0?this.data[t-1]+this.data[t]>>1:this.data[t]}percentile(t){if(0===this.data.length)return 0;if(t<=0)return this.data[0];if(t>=1)return this.data[this.data.length-1];const e=(this.data.length-1)*t,n=Math.floor(e),r=n+1,i=e%1;return r>=this.data.length?this.data[n]:this.data[n]*(1-i)+this.data[r]*i}}var $o,Ho=function(t,e,n,r){var i,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(s=(o<3?i(s):o>3?i(e,n,s):i(e,n))||s);return o>3&&s&&Object.defineProperty(e,n,s),s},Ko=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Jo=function(t,e){return function(n,r){e(n,r,t)}},Xo=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))};let Yo=class PeerStatsTracker{constructor(t,e,n){this.peerClient=t,this.mediaStreamManager=e,this.logger=new ScopedLogger(n,ut.EMITTER),this.previousBytesSent=0,this.startTimestamp=0,this.analyticsTracker=AnalyticsTracker.getInstance(),this.initializeSamples()}start(){this.logger.info({msg:"start emitter"}),this.collectSamplesTimerId=window.setInterval((()=>{this.collectSamples()}),1e3),this.trackSamplesTimerId=window.setInterval((()=>{this.trackSamples()}),3e4),this.trackPeerConnectionStatsTimerId=window.setInterval((()=>{this.trackPeerConnectionStats()}),6e4),this.trackSamples()}stop(){clearInterval(this.collectSamplesTimerId),clearInterval(this.trackSamplesTimerId),clearInterval(this.trackPeerConnectionStatsTimerId),this.collectSamplesTimerId=void 0,this.trackSamplesTimerId=void 0,this.trackPeerConnectionStatsTimerId=void 0}trackPeerConnectionStats(){return Xo(this,void 0,void 0,(function*(){(yield this.peerClient.getReports()).forEach((t=>{if("outbound-rtp"===t.type)switch(t.kind){case"audio":this.analyticsTracker.trackEvent(new WebRTCAudioStatsEvent(t));break;case"video":{const e=new WebRTCVideoStatsEvent(t),n=new MinuteBroadcastEvent(t,this.startTimestamp);this.analyticsTracker.batchEvents([e,n]);break}default:this.logger.warn({msg:"unknown report kind: ",reportKind:t.kind})}}))}))}collectSamples(){return Xo(this,void 0,void 0,(function*(){let t=0;this.audioLatencySamples.push(this.mediaStreamManager.getAudioLatency()),this.videoLatencySamples.push(this.mediaStreamManager.getVideoLatency());(yield this.peerClient.getReports()).forEach((e=>{switch(e.type){case"candidate-pair":e.nominated&&(this.rttSamples.push(e.currentRoundTripTime),this.recommendedBitrateSamples.push(e.availableOutgoingBitrate));break;case"outbound-rtp":t+=e.bytesSent||0,0===this.startTimestamp&&"video"===e.kind&&(this.startTimestamp=e.timestamp)}}));const e=8*Math.round(t-this.previousBytesSent);this.previousBytesSent=t,this.measuredBitrateSamples.push(e)}))}trackSamples(){const t=30,e=new SourceAudioLatencyEvent(this.audioLatencySamples,t),n=new SourceVideoLatencyEvent(this.videoLatencySamples,t),r=new CongestionTimeEvent(this.congestionTimeSamples,t),i=new MeasuredBitrateEvent(this.measuredBitrateSamples,t),o=new RecommendedBitrateEvent(this.recommendedBitrateSamples,t),s=new ConnectionRTTEvent(this.rttSamples,t);this.analyticsTracker.batchEvents([e,n,r,i,o,s]),this.initializeSamples()}initializeSamples(){this.audioLatencySamples=new Samples,this.videoLatencySamples=new Samples,this.congestionTimeSamples=new Samples,this.measuredBitrateSamples=new Samples,this.recommendedBitrateSamples=new Samples,this.rttSamples=new Samples}};Yo=Ho([X(),Jo(0,rt(it.PEER_CLIENT)),Jo(1,rt(it.I_MEDIA_STREAM_MANAGER)),Jo(2,rt(it.LOGGER)),Ko("design:paramtypes",[Object,Object,"function"==typeof($o=void 0!==be&&be)?$o:Object])],Yo);var Zo,Qo,ts,es,ns=function(t,e,n,r){var i,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(s=(o<3?i(s):o>3?i(e,n,s):i(e,n))||s);return o>3&&s&&Object.defineProperty(e,n,s),s},rs=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},is=function(t,e){return function(n,r){e(n,r,t)}},os=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))},ss=function(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)};let as=ts=class AmazonIVSBroadcastClient{constructor(t,e,n,r,i){this.emitter=t,this.config=e,this.mediaStreamManager=n,this.peerClient=r,this.peerStatsTracker=i,Zo.add(this),this.isValid=!0,this.emitter.on(In.ERROR,this.stopBroadcast),this.config.ingestEndpoint&&(this.url=new URL(this.config.ingestEndpoint)),this.analyticsTracker=AnalyticsTracker.getInstance(),this.mediaStreamManager.start();Object.getOwnPropertyNames(ts.prototype).forEach((t=>{this[t]=new Proxy(this[t],{apply:(t,e,n)=>{if(!e.isValid)throw new BroadcastClientError(Object.assign({},Mt));return Reflect.apply(t,e,n)}})})),window.addEventListener("beforeunload",(()=>{this.analyticsTracker.stop()}))}delete(){this.isValid=!1,this.peerClient.stop(),this.mediaStreamManager.stop(),this.emitter.removeAllListeners()}startBroadcast(t,e){return os(this,void 0,void 0,(function*(){ss(this,Zo,"m",Qo).call(this,t);const n=ue(e||this.config.ingestEndpoint);this.analyticsTracker.start(),this.peerStatsTracker.start(),yield this.peerClient.start(n,t),this.emitter.emit(In.ACTIVE_STATE_CHANGE,!0),this.url=new URL(n),this.url&&this.analyticsTracker.trackEvent(new StartBroadcastEvent({protocol:"webrtc",hostname:this.url.hostname,port:this.url.port},Xe.USER_INITIATED))}))}stopBroadcast(){var t,e,n;this.url&&this.analyticsTracker.trackEvent(new StopBroadcastEvent({protocol:"webrtc",hostname:this.url.hostname,port:this.url.port})),null===(t=this.peerStatsTracker)||void 0===t||t.stop(),null===(e=this.peerClient)||void 0===e||e.stop(),null===(n=this.emitter)||void 0===n||n.emit(In.ACTIVE_STATE_CHANGE,!1)}getCanvasDimensions(){return this.mediaStreamManager.getCanvasDimensions()}addVideoInputDevice(t,e,n){return os(this,void 0,void 0,(function*(){return this.mediaStreamManager.addVideoInputDevice(t,e,n)}))}addImageSource(t,e,n){return os(this,void 0,void 0,(function*(){return this.mediaStreamManager.addImageSource(t,e,n)}))}addAudioInputDevice(t,e){return os(this,void 0,void 0,(function*(){return this.mediaStreamManager.addAudioInputDevice(t,e)}))}removeVideoInputDevice(t){this.mediaStreamManager.removeVideoInputDevice(t)}removeAudioInputDevice(t){this.mediaStreamManager.removeAudioInputDevice(t)}removeImage(t){this.mediaStreamManager.removeImage(t)}updateVideoDeviceComposition(t,e){this.mediaStreamManager.updateVideoDeviceComposition(t,e)}exchangeVideoDevicePositions(t,e){this.mediaStreamManager.exchangeVideoDevicePositions(t,e)}getAudioInputDevice(t){return this.mediaStreamManager.getAudioInputDevice(t)}getVideoInputDevice(t){return this.mediaStreamManager.getVideoInputDevice(t)}getConnectionState(){return this.peerClient.getConnectionState()}getSessionId(){return this.peerClient.getSessionId()}on(t,e){this.emitter.on(t,e)}off(t,e){this.emitter.off(t,e)}getAudioContext(){return this.mediaStreamManager.audioContext}attachPreview(t){this.mediaStreamManager.attachPreview(t)}detachPreview(){this.mediaStreamManager.detachPreview()}disableVideo(){this.mediaStreamManager.disableVideo()}enableVideo(){this.mediaStreamManager.enableVideo()}disableAudio(){this.mediaStreamManager.disableAudio()}enableAudio(){this.mediaStreamManager.enableAudio()}};Zo=new WeakSet,Qo=function(t){if("string"!=typeof t||!/^[a-zA-Z0-9_-]+$/.test(t))throw new BroadcastClientError(Ut)},as=ts=ns([X(),is(0,rt(it.EMITTER)),is(1,rt(it.CONFIG)),is(2,rt(it.I_MEDIA_STREAM_MANAGER)),is(3,rt(it.PEER_CLIENT)),is(4,rt(it.PEER_STATS_TRACKER)),rs("design:paramtypes",[Object,"function"==typeof(es=void 0!==Config&&Config)?es:Object,Object,Object,Object])],as);var cs=n(477),us=n.n(cs);function ds(){return us()('/*! For license information please see scheduler.worker.worker.js.LICENSE.txt */\n(()=>{"use strict";var t;!function(t){t.CONFIG="config",t.UPDATE="update",t.START="start",t.STOP="stop"}(t||(t={}));const i=self;const s=new class Scheduler{constructor(){this.config={frameRate:60,isRunning:!1}}setConfig(t){this.config=Object.assign(Object.assign({},this.config),t),this.config.isRunning&&(this.stop(),this.start())}start(){this.config.isRunning||(this.intervalId=setInterval((()=>{i.postMessage({type:t.UPDATE})}),1e3/this.config.frameRate),this.config.isRunning=!0)}stop(){this.config.isRunning&&(clearInterval(this.intervalId),this.intervalId=void 0,this.config.isRunning=!1)}};i.addEventListener("message",(function(i){var n;if(null===(n=null==i?void 0:i.data)||void 0===n?void 0:n.type)switch(i.data.type){case t.CONFIG:s.setConfig(i.data.payload||{});break;case t.START:s.start();break;case t.STOP:s.stop()}}))})();',"Worker",void 0,void 0)}const ls=new qo({defaultScope:"Request"}),{lazyInject:hs}=(0,zo.Z)(ls),ps=t=>{const e=ls.createChild(),n=new Config;return n.streamConfig=t.streamConfig,n.ingestEndpoint=t.ingestEndpoint,n.logger=t.logger,n.logLevel=t.logLevel,n.networkReconnectConfig=t.networkReconnectConfig,e.bind(it.CONFIG).toConstantValue(n),e.bind(it.EMITTER).toConstantValue(new u),e},fs=()=>"function"==typeof RTCPeerConnection;function gs(t){return ps(t).get(as)}ls.bind(as).toSelf(),ls.bind(it.SPADE_URL).toConstantValue("https://broadcast.stats.live-video.net/"),ls.bind(it.WORKER).toConstantValue(new ds),ls.bind(it.I_MEDIA_STREAM_MANAGER).to(un).whenTargetIsDefault(),ls.bind(it.PEER_STATS_TRACKER).to(Yo),ls.bind(it.PEER_CLIENT).to(Wn),ls.bind(it.LOGGER).to(be).inSingletonScope();const vs="1.3.0";function ms(t){const e=new StageConfig;e.logger=t.logger,e.logLevel=t.logLevel,e.streamConfig=t.streamConfig,e.whipUrlOverride=t.whipUrlOverride;const n=new Config(void 0,t.logLevel,t.streamConfig,t.logger);return new AmazonIVSBroadcastStageClient(new(d()),e,new be(n))}function ys(t){const e=AnalyticsTracker.getInstance(),n=He(t),r=f(),i=new JoinEvent({traceId:r,token:n,eventEndpoint:n.eventsURL,whipEndpoint:n.whipURL});e.trackEventNoSharedProps(i)}function _s(t,e){const n=AnalyticsTracker.getInstance(),r=He(t),i=f(),o=new LeaveEvent({traceId:i,token:r,eventEndpoint:r.eventsURL,whipEndpoint:r.whipURL,reason:e});n.trackEventNoSharedProps(o)}const bs=a})(),r})()));
2
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.IVSBroadcastClient=e():t.IVSBroadcastClient=e()}(self,(()=>(()=>{var t={9669:(t,e,n)=>{t.exports=n(1609)},5448:(t,e,n)=>{"use strict";var r=n(4867),i=n(6026),o=n(4372),s=n(5327),a=n(4097),c=n(4109),u=n(7985),l=n(7874),d=n(2648),h=n(644),p=n(205);t.exports=function(t){return new Promise((function(e,n){var f,g=t.data,v=t.headers,m=t.responseType;function y(){t.cancelToken&&t.cancelToken.unsubscribe(f),t.signal&&t.signal.removeEventListener("abort",f)}r.isFormData(g)&&r.isStandardBrowserEnv()&&delete v["Content-Type"];var _=new XMLHttpRequest;if(t.auth){var b=t.auth.username||"",E=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";v.Authorization="Basic "+btoa(b+":"+E)}var S=a(t.baseURL,t.url);function C(){if(_){var r="getAllResponseHeaders"in _?c(_.getAllResponseHeaders()):null,o={data:m&&"text"!==m&&"json"!==m?_.response:_.responseText,status:_.status,statusText:_.statusText,headers:r,config:t,request:_};i((function(t){e(t),y()}),(function(t){n(t),y()}),o),_=null}}if(_.open(t.method.toUpperCase(),s(S,t.params,t.paramsSerializer),!0),_.timeout=t.timeout,"onloadend"in _?_.onloadend=C:_.onreadystatechange=function(){_&&4===_.readyState&&(0!==_.status||_.responseURL&&0===_.responseURL.indexOf("file:"))&&setTimeout(C)},_.onabort=function(){_&&(n(new d("Request aborted",d.ECONNABORTED,t,_)),_=null)},_.onerror=function(){n(new d("Network Error",d.ERR_NETWORK,t,_,_)),_=null},_.ontimeout=function(){var e=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",r=t.transitional||l;t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),n(new d(e,r.clarifyTimeoutError?d.ETIMEDOUT:d.ECONNABORTED,t,_)),_=null},r.isStandardBrowserEnv()){var w=(t.withCredentials||u(S))&&t.xsrfCookieName?o.read(t.xsrfCookieName):void 0;w&&(v[t.xsrfHeaderName]=w)}"setRequestHeader"in _&&r.forEach(v,(function(t,e){void 0===g&&"content-type"===e.toLowerCase()?delete v[e]:_.setRequestHeader(e,t)})),r.isUndefined(t.withCredentials)||(_.withCredentials=!!t.withCredentials),m&&"json"!==m&&(_.responseType=t.responseType),"function"==typeof t.onDownloadProgress&&_.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&_.upload&&_.upload.addEventListener("progress",t.onUploadProgress),(t.cancelToken||t.signal)&&(f=function(t){_&&(n(!t||t&&t.type?new h:t),_.abort(),_=null)},t.cancelToken&&t.cancelToken.subscribe(f),t.signal&&(t.signal.aborted?f():t.signal.addEventListener("abort",f))),g||(g=null);var T=p(S);T&&-1===["http","https","file"].indexOf(T)?n(new d("Unsupported protocol "+T+":",d.ERR_BAD_REQUEST,t)):_.send(g)}))}},1609:(t,e,n)=>{"use strict";var r=n(4867),i=n(1849),o=n(321),s=n(7185);var a=function t(e){var n=new o(e),a=i(o.prototype.request,n);return r.extend(a,o.prototype,n),r.extend(a,n),a.create=function(n){return t(s(e,n))},a}(n(5546));a.Axios=o,a.CanceledError=n(644),a.CancelToken=n(4972),a.isCancel=n(6502),a.VERSION=n(7288).version,a.toFormData=n(7675),a.AxiosError=n(2648),a.Cancel=a.CanceledError,a.all=function(t){return Promise.all(t)},a.spread=n(8713),a.isAxiosError=n(6268),t.exports=a,t.exports.default=a},4972:(t,e,n)=>{"use strict";var r=n(644);function i(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");var e;this.promise=new Promise((function(t){e=t}));var n=this;this.promise.then((function(t){if(n._listeners){var e,r=n._listeners.length;for(e=0;e<r;e++)n._listeners[e](t);n._listeners=null}})),this.promise.then=function(t){var e,r=new Promise((function(t){n.subscribe(t),e=t})).then(t);return r.cancel=function(){n.unsubscribe(e)},r},t((function(t){n.reason||(n.reason=new r(t),e(n.reason))}))}i.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},i.prototype.subscribe=function(t){this.reason?t(this.reason):this._listeners?this._listeners.push(t):this._listeners=[t]},i.prototype.unsubscribe=function(t){if(this._listeners){var e=this._listeners.indexOf(t);-1!==e&&this._listeners.splice(e,1)}},i.source=function(){var t;return{token:new i((function(e){t=e})),cancel:t}},t.exports=i},644:(t,e,n)=>{"use strict";var r=n(2648);function i(t){r.call(this,null==t?"canceled":t,r.ERR_CANCELED),this.name="CanceledError"}n(4867).inherits(i,r,{__CANCEL__:!0}),t.exports=i},6502:t=>{"use strict";t.exports=function(t){return!(!t||!t.__CANCEL__)}},321:(t,e,n)=>{"use strict";var r=n(4867),i=n(5327),o=n(782),s=n(3572),a=n(7185),c=n(4097),u=n(4875),l=u.validators;function d(t){this.defaults=t,this.interceptors={request:new o,response:new o}}d.prototype.request=function(t,e){"string"==typeof t?(e=e||{}).url=t:e=t||{},(e=a(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var n=e.transitional;void 0!==n&&u.assertOptions(n,{silentJSONParsing:l.transitional(l.boolean),forcedJSONParsing:l.transitional(l.boolean),clarifyTimeoutError:l.transitional(l.boolean)},!1);var r=[],i=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(i=i&&t.synchronous,r.unshift(t.fulfilled,t.rejected))}));var o,c=[];if(this.interceptors.response.forEach((function(t){c.push(t.fulfilled,t.rejected)})),!i){var d=[s,void 0];for(Array.prototype.unshift.apply(d,r),d=d.concat(c),o=Promise.resolve(e);d.length;)o=o.then(d.shift(),d.shift());return o}for(var h=e;r.length;){var p=r.shift(),f=r.shift();try{h=p(h)}catch(t){f(t);break}}try{o=s(h)}catch(t){return Promise.reject(t)}for(;c.length;)o=o.then(c.shift(),c.shift());return o},d.prototype.getUri=function(t){t=a(this.defaults,t);var e=c(t.baseURL,t.url);return i(e,t.params,t.paramsSerializer)},r.forEach(["delete","get","head","options"],(function(t){d.prototype[t]=function(e,n){return this.request(a(n||{},{method:t,url:e,data:(n||{}).data}))}})),r.forEach(["post","put","patch"],(function(t){function e(e){return function(n,r,i){return this.request(a(i||{},{method:t,headers:e?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}d.prototype[t]=e(),d.prototype[t+"Form"]=e(!0)})),t.exports=d},2648:(t,e,n)=>{"use strict";var r=n(4867);function i(t,e,n,r,i){Error.call(this),this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i)}r.inherits(i,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var o=i.prototype,s={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED"].forEach((function(t){s[t]={value:t}})),Object.defineProperties(i,s),Object.defineProperty(o,"isAxiosError",{value:!0}),i.from=function(t,e,n,s,a,c){var u=Object.create(o);return r.toFlatObject(t,u,(function(t){return t!==Error.prototype})),i.call(u,t.message,e,n,s,a),u.name=t.name,c&&Object.assign(u,c),u},t.exports=i},782:(t,e,n)=>{"use strict";var r=n(4867);function i(){this.handlers=[]}i.prototype.use=function(t,e,n){return this.handlers.push({fulfilled:t,rejected:e,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1},i.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},i.prototype.forEach=function(t){r.forEach(this.handlers,(function(e){null!==e&&t(e)}))},t.exports=i},4097:(t,e,n)=>{"use strict";var r=n(1793),i=n(7303);t.exports=function(t,e){return t&&!r(e)?i(t,e):e}},3572:(t,e,n)=>{"use strict";var r=n(4867),i=n(8527),o=n(6502),s=n(5546),a=n(644);function c(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new a}t.exports=function(t){return c(t),t.headers=t.headers||{},t.data=i.call(t,t.data,t.headers,t.transformRequest),t.headers=r.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),r.forEach(["delete","get","head","post","put","patch","common"],(function(e){delete t.headers[e]})),(t.adapter||s.adapter)(t).then((function(e){return c(t),e.data=i.call(t,e.data,e.headers,t.transformResponse),e}),(function(e){return o(e)||(c(t),e&&e.response&&(e.response.data=i.call(t,e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)}))}},7185:(t,e,n)=>{"use strict";var r=n(4867);t.exports=function(t,e){e=e||{};var n={};function i(t,e){return r.isPlainObject(t)&&r.isPlainObject(e)?r.merge(t,e):r.isPlainObject(e)?r.merge({},e):r.isArray(e)?e.slice():e}function o(n){return r.isUndefined(e[n])?r.isUndefined(t[n])?void 0:i(void 0,t[n]):i(t[n],e[n])}function s(t){if(!r.isUndefined(e[t]))return i(void 0,e[t])}function a(n){return r.isUndefined(e[n])?r.isUndefined(t[n])?void 0:i(void 0,t[n]):i(void 0,e[n])}function c(n){return n in e?i(t[n],e[n]):n in t?i(void 0,t[n]):void 0}var u={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:c};return r.forEach(Object.keys(t).concat(Object.keys(e)),(function(t){var e=u[t]||o,i=e(t);r.isUndefined(i)&&e!==c||(n[t]=i)})),n}},6026:(t,e,n)=>{"use strict";var r=n(2648);t.exports=function(t,e,n){var i=n.config.validateStatus;n.status&&i&&!i(n.status)?e(new r("Request failed with status code "+n.status,[r.ERR_BAD_REQUEST,r.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):t(n)}},8527:(t,e,n)=>{"use strict";var r=n(4867),i=n(5546);t.exports=function(t,e,n){var o=this||i;return r.forEach(n,(function(n){t=n.call(o,t,e)})),t}},5546:(t,e,n)=>{"use strict";var r=n(4867),i=n(6016),o=n(2648),s=n(7874),a=n(7675),c={"Content-Type":"application/x-www-form-urlencoded"};function u(t,e){!r.isUndefined(t)&&r.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var l,d={transitional:s,adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(l=n(5448)),l),transformRequest:[function(t,e){if(i(e,"Accept"),i(e,"Content-Type"),r.isFormData(t)||r.isArrayBuffer(t)||r.isBuffer(t)||r.isStream(t)||r.isFile(t)||r.isBlob(t))return t;if(r.isArrayBufferView(t))return t.buffer;if(r.isURLSearchParams(t))return u(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString();var n,o=r.isObject(t),s=e&&e["Content-Type"];if((n=r.isFileList(t))||o&&"multipart/form-data"===s){var c=this.env&&this.env.FormData;return a(n?{"files[]":t}:t,c&&new c)}return o||"application/json"===s?(u(e,"application/json"),function(t,e,n){if(r.isString(t))try{return(e||JSON.parse)(t),r.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(n||JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){var e=this.transitional||d.transitional,n=e&&e.silentJSONParsing,i=e&&e.forcedJSONParsing,s=!n&&"json"===this.responseType;if(s||i&&r.isString(t)&&t.length)try{return JSON.parse(t)}catch(t){if(s){if("SyntaxError"===t.name)throw o.from(t,o.ERR_BAD_RESPONSE,this,null,this.response);throw t}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:n(1623)},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};r.forEach(["delete","get","head"],(function(t){d.headers[t]={}})),r.forEach(["post","put","patch"],(function(t){d.headers[t]=r.merge(c)})),t.exports=d},7874:t=>{"use strict";t.exports={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1}},7288:t=>{t.exports={version:"0.27.2"}},1849:t=>{"use strict";t.exports=function(t,e){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return t.apply(e,n)}}},5327:(t,e,n)=>{"use strict";var r=n(4867);function i(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}t.exports=function(t,e,n){if(!e)return t;var o;if(n)o=n(e);else if(r.isURLSearchParams(e))o=e.toString();else{var s=[];r.forEach(e,(function(t,e){null!=t&&(r.isArray(t)?e+="[]":t=[t],r.forEach(t,(function(t){r.isDate(t)?t=t.toISOString():r.isObject(t)&&(t=JSON.stringify(t)),s.push(i(e)+"="+i(t))})))})),o=s.join("&")}if(o){var a=t.indexOf("#");-1!==a&&(t=t.slice(0,a)),t+=(-1===t.indexOf("?")?"?":"&")+o}return t}},7303:t=>{"use strict";t.exports=function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}},4372:(t,e,n)=>{"use strict";var r=n(4867);t.exports=r.isStandardBrowserEnv()?{write:function(t,e,n,i,o,s){var a=[];a.push(t+"="+encodeURIComponent(e)),r.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),r.isString(i)&&a.push("path="+i),r.isString(o)&&a.push("domain="+o),!0===s&&a.push("secure"),document.cookie=a.join("; ")},read:function(t){var e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},1793:t=>{"use strict";t.exports=function(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}},6268:(t,e,n)=>{"use strict";var r=n(4867);t.exports=function(t){return r.isObject(t)&&!0===t.isAxiosError}},7985:(t,e,n)=>{"use strict";var r=n(4867);t.exports=r.isStandardBrowserEnv()?function(){var t,e=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function i(t){var r=t;return e&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return t=i(window.location.href),function(e){var n=r.isString(e)?i(e):e;return n.protocol===t.protocol&&n.host===t.host}}():function(){return!0}},6016:(t,e,n)=>{"use strict";var r=n(4867);t.exports=function(t,e){r.forEach(t,(function(n,r){r!==e&&r.toUpperCase()===e.toUpperCase()&&(t[e]=n,delete t[r])}))}},1623:t=>{t.exports=null},4109:(t,e,n)=>{"use strict";var r=n(4867),i=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];t.exports=function(t){var e,n,o,s={};return t?(r.forEach(t.split("\n"),(function(t){if(o=t.indexOf(":"),e=r.trim(t.substr(0,o)).toLowerCase(),n=r.trim(t.substr(o+1)),e){if(s[e]&&i.indexOf(e)>=0)return;s[e]="set-cookie"===e?(s[e]?s[e]:[]).concat([n]):s[e]?s[e]+", "+n:n}})),s):s}},205:t=>{"use strict";t.exports=function(t){var e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}},8713:t=>{"use strict";t.exports=function(t){return function(e){return t.apply(null,e)}}},7675:(t,e,n)=>{"use strict";var r=n(4867);t.exports=function(t,e){e=e||new FormData;var n=[];function i(t){return null===t?"":r.isDate(t)?t.toISOString():r.isArrayBuffer(t)||r.isTypedArray(t)?"function"==typeof Blob?new Blob([t]):Buffer.from(t):t}return function t(o,s){if(r.isPlainObject(o)||r.isArray(o)){if(-1!==n.indexOf(o))throw Error("Circular reference detected in "+s);n.push(o),r.forEach(o,(function(n,o){if(!r.isUndefined(n)){var a,c=s?s+"."+o:o;if(n&&!s&&"object"==typeof n)if(r.endsWith(o,"{}"))n=JSON.stringify(n);else if(r.endsWith(o,"[]")&&(a=r.toArray(n)))return void a.forEach((function(t){!r.isUndefined(t)&&e.append(c,i(t))}));t(n,c)}})),n.pop()}else e.append(s,i(o))}(t),e}},4875:(t,e,n)=>{"use strict";var r=n(7288).version,i=n(2648),o={};["object","boolean","number","function","string","symbol"].forEach((function(t,e){o[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}}));var s={};o.transitional=function(t,e,n){function o(t,e){return"[Axios v"+r+"] Transitional option '"+t+"'"+e+(n?". "+n:"")}return function(n,r,a){if(!1===t)throw new i(o(r," has been removed"+(e?" in "+e:"")),i.ERR_DEPRECATED);return e&&!s[r]&&(s[r]=!0,console.warn(o(r," has been deprecated since v"+e+" and will be removed in the near future"))),!t||t(n,r,a)}},t.exports={assertOptions:function(t,e,n){if("object"!=typeof t)throw new i("options must be an object",i.ERR_BAD_OPTION_VALUE);for(var r=Object.keys(t),o=r.length;o-- >0;){var s=r[o],a=e[s];if(a){var c=t[s],u=void 0===c||a(c,s,t);if(!0!==u)throw new i("option "+s+" must be "+u,i.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new i("Unknown option "+s,i.ERR_BAD_OPTION)}},validators:o}},4867:(t,e,n)=>{"use strict";var r,i=n(1849),o=Object.prototype.toString,s=(r=Object.create(null),function(t){var e=o.call(t);return r[e]||(r[e]=e.slice(8,-1).toLowerCase())});function a(t){return t=t.toLowerCase(),function(e){return s(e)===t}}function c(t){return Array.isArray(t)}function u(t){return void 0===t}var l=a("ArrayBuffer");function d(t){return null!==t&&"object"==typeof t}function h(t){if("object"!==s(t))return!1;var e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}var p=a("Date"),f=a("File"),g=a("Blob"),v=a("FileList");function m(t){return"[object Function]"===o.call(t)}var y=a("URLSearchParams");function _(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),c(t))for(var n=0,r=t.length;n<r;n++)e.call(null,t[n],n,t);else for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.call(null,t[i],i,t)}var b,E=(b="undefined"!=typeof Uint8Array&&Object.getPrototypeOf(Uint8Array),function(t){return b&&t instanceof b});t.exports={isArray:c,isArrayBuffer:l,isBuffer:function(t){return null!==t&&!u(t)&&null!==t.constructor&&!u(t.constructor)&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)},isFormData:function(t){var e="[object FormData]";return t&&("function"==typeof FormData&&t instanceof FormData||o.call(t)===e||m(t.toString)&&t.toString()===e)},isArrayBufferView:function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&l(t.buffer)},isString:function(t){return"string"==typeof t},isNumber:function(t){return"number"==typeof t},isObject:d,isPlainObject:h,isUndefined:u,isDate:p,isFile:f,isBlob:g,isFunction:m,isStream:function(t){return d(t)&&m(t.pipe)},isURLSearchParams:y,isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:_,merge:function t(){var e={};function n(n,r){h(e[r])&&h(n)?e[r]=t(e[r],n):h(n)?e[r]=t({},n):c(n)?e[r]=n.slice():e[r]=n}for(var r=0,i=arguments.length;r<i;r++)_(arguments[r],n);return e},extend:function(t,e,n){return _(e,(function(e,r){t[r]=n&&"function"==typeof e?i(e,n):e})),t},trim:function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")},stripBOM:function(t){return 65279===t.charCodeAt(0)&&(t=t.slice(1)),t},inherits:function(t,e,n,r){t.prototype=Object.create(e.prototype,r),t.prototype.constructor=t,n&&Object.assign(t.prototype,n)},toFlatObject:function(t,e,n){var r,i,o,s={};e=e||{};do{for(i=(r=Object.getOwnPropertyNames(t)).length;i-- >0;)s[o=r[i]]||(e[o]=t[o],s[o]=!0);t=Object.getPrototypeOf(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},kindOf:s,kindOfTest:a,endsWith:function(t,e,n){t=String(t),(void 0===n||n>t.length)&&(n=t.length),n-=e.length;var r=t.indexOf(e,n);return-1!==r&&r===n},toArray:function(t){if(!t)return null;var e=t.length;if(u(e))return null;for(var n=new Array(e);e-- >0;)n[e]=t[e];return n},isTypedArray:E,isFileList:v}},1206:function(t){t.exports=function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=90)}({17:function(t,e,n){"use strict";e.__esModule=!0,e.default=void 0;var r=n(18),i=function(){function t(){}return t.getFirstMatch=function(t,e){var n=e.match(t);return n&&n.length>0&&n[1]||""},t.getSecondMatch=function(t,e){var n=e.match(t);return n&&n.length>1&&n[2]||""},t.matchAndReturnConst=function(t,e,n){if(t.test(e))return n},t.getWindowsVersionName=function(t){switch(t){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},t.getMacOSVersionName=function(t){var e=t.split(".").splice(0,2).map((function(t){return parseInt(t,10)||0}));if(e.push(0),10===e[0])switch(e[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},t.getAndroidVersionName=function(t){var e=t.split(".").splice(0,2).map((function(t){return parseInt(t,10)||0}));if(e.push(0),!(1===e[0]&&e[1]<5))return 1===e[0]&&e[1]<6?"Cupcake":1===e[0]&&e[1]>=6?"Donut":2===e[0]&&e[1]<2?"Eclair":2===e[0]&&2===e[1]?"Froyo":2===e[0]&&e[1]>2?"Gingerbread":3===e[0]?"Honeycomb":4===e[0]&&e[1]<1?"Ice Cream Sandwich":4===e[0]&&e[1]<4?"Jelly Bean":4===e[0]&&e[1]>=4?"KitKat":5===e[0]?"Lollipop":6===e[0]?"Marshmallow":7===e[0]?"Nougat":8===e[0]?"Oreo":9===e[0]?"Pie":void 0},t.getVersionPrecision=function(t){return t.split(".").length},t.compareVersions=function(e,n,r){void 0===r&&(r=!1);var i=t.getVersionPrecision(e),o=t.getVersionPrecision(n),s=Math.max(i,o),a=0,c=t.map([e,n],(function(e){var n=s-t.getVersionPrecision(e),r=e+new Array(n+1).join(".0");return t.map(r.split("."),(function(t){return new Array(20-t.length).join("0")+t})).reverse()}));for(r&&(a=s-Math.min(i,o)),s-=1;s>=a;){if(c[0][s]>c[1][s])return 1;if(c[0][s]===c[1][s]){if(s===a)return 0;s-=1}else if(c[0][s]<c[1][s])return-1}},t.map=function(t,e){var n,r=[];if(Array.prototype.map)return Array.prototype.map.call(t,e);for(n=0;n<t.length;n+=1)r.push(e(t[n]));return r},t.find=function(t,e){var n,r;if(Array.prototype.find)return Array.prototype.find.call(t,e);for(n=0,r=t.length;n<r;n+=1){var i=t[n];if(e(i,n))return i}},t.assign=function(t){for(var e,n,r=t,i=arguments.length,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];if(Object.assign)return Object.assign.apply(Object,[t].concat(o));var a=function(){var t=o[e];"object"==typeof t&&null!==t&&Object.keys(t).forEach((function(e){r[e]=t[e]}))};for(e=0,n=o.length;e<n;e+=1)a();return t},t.getBrowserAlias=function(t){return r.BROWSER_ALIASES_MAP[t]},t.getBrowserTypeByAlias=function(t){return r.BROWSER_MAP[t]||""},t}();e.default=i,t.exports=e.default},18:function(t,e,n){"use strict";e.__esModule=!0,e.ENGINE_MAP=e.OS_MAP=e.PLATFORMS_MAP=e.BROWSER_MAP=e.BROWSER_ALIASES_MAP=void 0,e.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},e.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},e.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},e.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},e.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(t,e,n){"use strict";e.__esModule=!0,e.default=void 0;var r,i=(r=n(91))&&r.__esModule?r:{default:r},o=n(18);function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var a=function(){function t(){}var e,n,r;return t.getParser=function(t,e){if(void 0===e&&(e=!1),"string"!=typeof t)throw new Error("UserAgent should be a string");return new i.default(t,e)},t.parse=function(t){return new i.default(t).getResult()},e=t,r=[{key:"BROWSER_MAP",get:function(){return o.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return o.ENGINE_MAP}},{key:"OS_MAP",get:function(){return o.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return o.PLATFORMS_MAP}}],(n=null)&&s(e.prototype,n),r&&s(e,r),t}();e.default=a,t.exports=e.default},91:function(t,e,n){"use strict";e.__esModule=!0,e.default=void 0;var r=c(n(92)),i=c(n(93)),o=c(n(94)),s=c(n(95)),a=c(n(17));function c(t){return t&&t.__esModule?t:{default:t}}var u=function(){function t(t,e){if(void 0===e&&(e=!1),null==t||""===t)throw new Error("UserAgent parameter can't be empty");this._ua=t,this.parsedResult={},!0!==e&&this.parse()}var e=t.prototype;return e.getUA=function(){return this._ua},e.test=function(t){return t.test(this._ua)},e.parseBrowser=function(){var t=this;this.parsedResult.browser={};var e=a.default.find(r.default,(function(e){if("function"==typeof e.test)return e.test(t);if(e.test instanceof Array)return e.test.some((function(e){return t.test(e)}));throw new Error("Browser's test function is not valid")}));return e&&(this.parsedResult.browser=e.describe(this.getUA())),this.parsedResult.browser},e.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},e.getBrowserName=function(t){return t?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},e.getBrowserVersion=function(){return this.getBrowser().version},e.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},e.parseOS=function(){var t=this;this.parsedResult.os={};var e=a.default.find(i.default,(function(e){if("function"==typeof e.test)return e.test(t);if(e.test instanceof Array)return e.test.some((function(e){return t.test(e)}));throw new Error("Browser's test function is not valid")}));return e&&(this.parsedResult.os=e.describe(this.getUA())),this.parsedResult.os},e.getOSName=function(t){var e=this.getOS().name;return t?String(e).toLowerCase()||"":e||""},e.getOSVersion=function(){return this.getOS().version},e.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},e.getPlatformType=function(t){void 0===t&&(t=!1);var e=this.getPlatform().type;return t?String(e).toLowerCase()||"":e||""},e.parsePlatform=function(){var t=this;this.parsedResult.platform={};var e=a.default.find(o.default,(function(e){if("function"==typeof e.test)return e.test(t);if(e.test instanceof Array)return e.test.some((function(e){return t.test(e)}));throw new Error("Browser's test function is not valid")}));return e&&(this.parsedResult.platform=e.describe(this.getUA())),this.parsedResult.platform},e.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},e.getEngineName=function(t){return t?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},e.parseEngine=function(){var t=this;this.parsedResult.engine={};var e=a.default.find(s.default,(function(e){if("function"==typeof e.test)return e.test(t);if(e.test instanceof Array)return e.test.some((function(e){return t.test(e)}));throw new Error("Browser's test function is not valid")}));return e&&(this.parsedResult.engine=e.describe(this.getUA())),this.parsedResult.engine},e.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},e.getResult=function(){return a.default.assign({},this.parsedResult)},e.satisfies=function(t){var e=this,n={},r=0,i={},o=0;if(Object.keys(t).forEach((function(e){var s=t[e];"string"==typeof s?(i[e]=s,o+=1):"object"==typeof s&&(n[e]=s,r+=1)})),r>0){var s=Object.keys(n),c=a.default.find(s,(function(t){return e.isOS(t)}));if(c){var u=this.satisfies(n[c]);if(void 0!==u)return u}var l=a.default.find(s,(function(t){return e.isPlatform(t)}));if(l){var d=this.satisfies(n[l]);if(void 0!==d)return d}}if(o>0){var h=Object.keys(i),p=a.default.find(h,(function(t){return e.isBrowser(t,!0)}));if(void 0!==p)return this.compareVersion(i[p])}},e.isBrowser=function(t,e){void 0===e&&(e=!1);var n=this.getBrowserName().toLowerCase(),r=t.toLowerCase(),i=a.default.getBrowserTypeByAlias(r);return e&&i&&(r=i.toLowerCase()),r===n},e.compareVersion=function(t){var e=[0],n=t,r=!1,i=this.getBrowserVersion();if("string"==typeof i)return">"===t[0]||"<"===t[0]?(n=t.substr(1),"="===t[1]?(r=!0,n=t.substr(2)):e=[],">"===t[0]?e.push(1):e.push(-1)):"="===t[0]?n=t.substr(1):"~"===t[0]&&(r=!0,n=t.substr(1)),e.indexOf(a.default.compareVersions(i,n,r))>-1},e.isOS=function(t){return this.getOSName(!0)===String(t).toLowerCase()},e.isPlatform=function(t){return this.getPlatformType(!0)===String(t).toLowerCase()},e.isEngine=function(t){return this.getEngineName(!0)===String(t).toLowerCase()},e.is=function(t,e){return void 0===e&&(e=!1),this.isBrowser(t,e)||this.isOS(t)||this.isPlatform(t)},e.some=function(t){var e=this;return void 0===t&&(t=[]),t.some((function(t){return e.is(t)}))},t}();e.default=u,t.exports=e.default},92:function(t,e,n){"use strict";e.__esModule=!0,e.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=/version\/(\d+(\.?_?\d+)+)/i,s=[{test:[/googlebot/i],describe:function(t){var e={name:"Googlebot"},n=i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,t)||i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/opera/i],describe:function(t){var e={name:"Opera"},n=i.default.getFirstMatch(o,t)||i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/opr\/|opios/i],describe:function(t){var e={name:"Opera"},n=i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,t)||i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/SamsungBrowser/i],describe:function(t){var e={name:"Samsung Internet for Android"},n=i.default.getFirstMatch(o,t)||i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/Whale/i],describe:function(t){var e={name:"NAVER Whale Browser"},n=i.default.getFirstMatch(o,t)||i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/MZBrowser/i],describe:function(t){var e={name:"MZ Browser"},n=i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,t)||i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/focus/i],describe:function(t){var e={name:"Focus"},n=i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,t)||i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/swing/i],describe:function(t){var e={name:"Swing"},n=i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,t)||i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/coast/i],describe:function(t){var e={name:"Opera Coast"},n=i.default.getFirstMatch(o,t)||i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(t){var e={name:"Opera Touch"},n=i.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,t)||i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/yabrowser/i],describe:function(t){var e={name:"Yandex Browser"},n=i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,t)||i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/ucbrowser/i],describe:function(t){var e={name:"UC Browser"},n=i.default.getFirstMatch(o,t)||i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/Maxthon|mxios/i],describe:function(t){var e={name:"Maxthon"},n=i.default.getFirstMatch(o,t)||i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/epiphany/i],describe:function(t){var e={name:"Epiphany"},n=i.default.getFirstMatch(o,t)||i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/puffin/i],describe:function(t){var e={name:"Puffin"},n=i.default.getFirstMatch(o,t)||i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/sleipnir/i],describe:function(t){var e={name:"Sleipnir"},n=i.default.getFirstMatch(o,t)||i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/k-meleon/i],describe:function(t){var e={name:"K-Meleon"},n=i.default.getFirstMatch(o,t)||i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/micromessenger/i],describe:function(t){var e={name:"WeChat"},n=i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,t)||i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/qqbrowser/i],describe:function(t){var e={name:/qqbrowserlite/i.test(t)?"QQ Browser Lite":"QQ Browser"},n=i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,t)||i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/msie|trident/i],describe:function(t){var e={name:"Internet Explorer"},n=i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/\sedg\//i],describe:function(t){var e={name:"Microsoft Edge"},n=i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/edg([ea]|ios)/i],describe:function(t){var e={name:"Microsoft Edge"},n=i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/vivaldi/i],describe:function(t){var e={name:"Vivaldi"},n=i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/seamonkey/i],describe:function(t){var e={name:"SeaMonkey"},n=i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/sailfish/i],describe:function(t){var e={name:"Sailfish"},n=i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,t);return n&&(e.version=n),e}},{test:[/silk/i],describe:function(t){var e={name:"Amazon Silk"},n=i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/phantom/i],describe:function(t){var e={name:"PhantomJS"},n=i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/slimerjs/i],describe:function(t){var e={name:"SlimerJS"},n=i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(t){var e={name:"BlackBerry"},n=i.default.getFirstMatch(o,t)||i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/(web|hpw)[o0]s/i],describe:function(t){var e={name:"WebOS Browser"},n=i.default.getFirstMatch(o,t)||i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/bada/i],describe:function(t){var e={name:"Bada"},n=i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/tizen/i],describe:function(t){var e={name:"Tizen"},n=i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,t)||i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/qupzilla/i],describe:function(t){var e={name:"QupZilla"},n=i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,t)||i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/firefox|iceweasel|fxios/i],describe:function(t){var e={name:"Firefox"},n=i.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/electron/i],describe:function(t){var e={name:"Electron"},n=i.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/MiuiBrowser/i],describe:function(t){var e={name:"Miui"},n=i.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/chromium/i],describe:function(t){var e={name:"Chromium"},n=i.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,t)||i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/chrome|crios|crmo/i],describe:function(t){var e={name:"Chrome"},n=i.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/GSA/i],describe:function(t){var e={name:"Google Search"},n=i.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:function(t){var e=!t.test(/like android/i),n=t.test(/android/i);return e&&n},describe:function(t){var e={name:"Android Browser"},n=i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/playstation 4/i],describe:function(t){var e={name:"PlayStation 4"},n=i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/safari|applewebkit/i],describe:function(t){var e={name:"Safari"},n=i.default.getFirstMatch(o,t);return n&&(e.version=n),e}},{test:[/.*/i],describe:function(t){var e=-1!==t.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:i.default.getFirstMatch(e,t),version:i.default.getSecondMatch(e,t)}}}];e.default=s,t.exports=e.default},93:function(t,e,n){"use strict";e.__esModule=!0,e.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:[/Roku\/DVP/],describe:function(t){var e=i.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,t);return{name:o.OS_MAP.Roku,version:e}}},{test:[/windows phone/i],describe:function(t){var e=i.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,t);return{name:o.OS_MAP.WindowsPhone,version:e}}},{test:[/windows /i],describe:function(t){var e=i.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,t),n=i.default.getWindowsVersionName(e);return{name:o.OS_MAP.Windows,version:e,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(t){var e={name:o.OS_MAP.iOS},n=i.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,t);return n&&(e.version=n),e}},{test:[/macintosh/i],describe:function(t){var e=i.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,t).replace(/[_\s]/g,"."),n=i.default.getMacOSVersionName(e),r={name:o.OS_MAP.MacOS,version:e};return n&&(r.versionName=n),r}},{test:[/(ipod|iphone|ipad)/i],describe:function(t){var e=i.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,t).replace(/[_\s]/g,".");return{name:o.OS_MAP.iOS,version:e}}},{test:function(t){var e=!t.test(/like android/i),n=t.test(/android/i);return e&&n},describe:function(t){var e=i.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,t),n=i.default.getAndroidVersionName(e),r={name:o.OS_MAP.Android,version:e};return n&&(r.versionName=n),r}},{test:[/(web|hpw)[o0]s/i],describe:function(t){var e=i.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,t),n={name:o.OS_MAP.WebOS};return e&&e.length&&(n.version=e),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(t){var e=i.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,t)||i.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,t)||i.default.getFirstMatch(/\bbb(\d+)/i,t);return{name:o.OS_MAP.BlackBerry,version:e}}},{test:[/bada/i],describe:function(t){var e=i.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,t);return{name:o.OS_MAP.Bada,version:e}}},{test:[/tizen/i],describe:function(t){var e=i.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,t);return{name:o.OS_MAP.Tizen,version:e}}},{test:[/linux/i],describe:function(){return{name:o.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:o.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(t){var e=i.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,t);return{name:o.OS_MAP.PlayStation4,version:e}}}];e.default=s,t.exports=e.default},94:function(t,e,n){"use strict";e.__esModule=!0,e.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(t){var e=i.default.getFirstMatch(/(can-l01)/i,t)&&"Nova",n={type:o.PLATFORMS_MAP.mobile,vendor:"Huawei"};return e&&(n.model=e),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(t){var e=t.test(/ipod|iphone/i),n=t.test(/like (ipod|iphone)/i);return e&&!n},describe:function(t){var e=i.default.getFirstMatch(/(ipod|iphone)/i,t);return{type:o.PLATFORMS_MAP.mobile,vendor:"Apple",model:e}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(t){return"blackberry"===t.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(t){return"bada"===t.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(t){return"windows phone"===t.getBrowserName()},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(t){var e=Number(String(t.getOSVersion()).split(".")[0]);return"android"===t.getOSName(!0)&&e>=3},describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(t){return"android"===t.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(t){return"macos"===t.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(t){return"windows"===t.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(t){return"linux"===t.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(t){return"playstation 4"===t.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}},{test:function(t){return"roku"===t.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}}];e.default=s,t.exports=e.default},95:function(t,e,n){"use strict";e.__esModule=!0,e.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:function(t){return"microsoft edge"===t.getBrowserName(!0)},describe:function(t){if(/\sedg\//i.test(t))return{name:o.ENGINE_MAP.Blink};var e=i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,t);return{name:o.ENGINE_MAP.EdgeHTML,version:e}}},{test:[/trident/i],describe:function(t){var e={name:o.ENGINE_MAP.Trident},n=i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:function(t){return t.test(/presto/i)},describe:function(t){var e={name:o.ENGINE_MAP.Presto},n=i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:function(t){var e=t.test(/gecko/i),n=t.test(/like gecko/i);return e&&!n},describe:function(t){var e={name:o.ENGINE_MAP.Gecko},n=i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:o.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(t){var e={name:o.ENGINE_MAP.WebKit},n=i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}}];e.default=s,t.exports=e.default}})},6729:t=>{"use strict";var e=Object.prototype.hasOwnProperty,n="~";function r(){}function i(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function o(t,e,r,o,s){if("function"!=typeof r)throw new TypeError("The listener must be a function");var a=new i(r,o||t,s),c=n?n+e:e;return t._events[c]?t._events[c].fn?t._events[c]=[t._events[c],a]:t._events[c].push(a):(t._events[c]=a,t._eventsCount++),t}function s(t,e){0==--t._eventsCount?t._events=new r:delete t._events[e]}function a(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),a.prototype.eventNames=function(){var t,r,i=[];if(0===this._eventsCount)return i;for(r in t=this._events)e.call(t,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(t)):i},a.prototype.listeners=function(t){var e=n?n+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,o=r.length,s=new Array(o);i<o;i++)s[i]=r[i].fn;return s},a.prototype.listenerCount=function(t){var e=n?n+t:t,r=this._events[e];return r?r.fn?1:r.length:0},a.prototype.emit=function(t,e,r,i,o,s){var a=n?n+t:t;if(!this._events[a])return!1;var c,u,l=this._events[a],d=arguments.length;if(l.fn){switch(l.once&&this.removeListener(t,l.fn,void 0,!0),d){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,e),!0;case 3:return l.fn.call(l.context,e,r),!0;case 4:return l.fn.call(l.context,e,r,i),!0;case 5:return l.fn.call(l.context,e,r,i,o),!0;case 6:return l.fn.call(l.context,e,r,i,o,s),!0}for(u=1,c=new Array(d-1);u<d;u++)c[u-1]=arguments[u];l.fn.apply(l.context,c)}else{var h,p=l.length;for(u=0;u<p;u++)switch(l[u].once&&this.removeListener(t,l[u].fn,void 0,!0),d){case 1:l[u].fn.call(l[u].context);break;case 2:l[u].fn.call(l[u].context,e);break;case 3:l[u].fn.call(l[u].context,e,r);break;case 4:l[u].fn.call(l[u].context,e,r,i);break;default:if(!c)for(h=1,c=new Array(d-1);h<d;h++)c[h-1]=arguments[h];l[u].fn.apply(l[u].context,c)}}return!0},a.prototype.on=function(t,e,n){return o(this,t,e,n,!1)},a.prototype.once=function(t,e,n){return o(this,t,e,n,!0)},a.prototype.removeListener=function(t,e,r,i){var o=n?n+t:t;if(!this._events[o])return this;if(!e)return s(this,o),this;var a=this._events[o];if(a.fn)a.fn!==e||i&&!a.once||r&&a.context!==r||s(this,o);else{for(var c=0,u=[],l=a.length;c<l;c++)(a[c].fn!==e||i&&!a[c].once||r&&a[c].context!==r)&&u.push(a[c]);u.length?this._events[o]=1===u.length?u[0]:u:s(this,o)}return this},a.prototype.removeAllListeners=function(t){var e;return t?(e=n?n+t:t,this._events[e]&&s(this,e)):(this._events=new r,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=n,a.EventEmitter=a,t.exports=a},7375:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=Symbol.for("INJECTION");function r(t,e,r,i){Object.defineProperty(t,e,{configurable:!0,enumerable:!0,get:function(){return i&&!Reflect.hasMetadata(n,this,e)&&Reflect.defineMetadata(n,r(),this,e),Reflect.hasMetadata(n,this,e)?Reflect.getMetadata(n,this,e):r()},set:function(t){Reflect.defineMetadata(n,t,this,e)}})}e.makePropertyInjectDecorator=function(t,e){return function(n){return function(i,o){r(i,o,(function(){return t.get(n)}),e)}}},e.makePropertyInjectNamedDecorator=function(t,e){return function(n,i){return function(o,s){r(o,s,(function(){return t.getNamed(n,i)}),e)}}},e.makePropertyInjectTaggedDecorator=function(t,e){return function(n,i,o){return function(s,a){r(s,a,(function(){return t.getTagged(n,i,o)}),e)}}},e.makePropertyMultiInjectDecorator=function(t,e){return function(n){return function(i,o){r(i,o,(function(){return t.getAll(n)}),e)}}}},4879:(t,e,n)=>{"use strict";var r=n(7375);e.Z=function(t,e){return void 0===e&&(e=!0),{lazyInject:r.makePropertyInjectDecorator(t,e),lazyInjectNamed:r.makePropertyInjectNamedDecorator(t,e),lazyInjectTagged:r.makePropertyInjectTaggedDecorator(t,e),lazyMultiInject:r.makePropertyMultiInjectDecorator(t,e)}}},1989:(t,e,n)=>{var r=n(1789),i=n(401),o=n(7667),s=n(1327),a=n(1866);function c(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}c.prototype.clear=r,c.prototype.delete=i,c.prototype.get=o,c.prototype.has=s,c.prototype.set=a,t.exports=c},8407:(t,e,n)=>{var r=n(7040),i=n(4125),o=n(2117),s=n(7518),a=n(4705);function c(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}c.prototype.clear=r,c.prototype.delete=i,c.prototype.get=o,c.prototype.has=s,c.prototype.set=a,t.exports=c},7071:(t,e,n)=>{var r=n(852)(n(5639),"Map");t.exports=r},3369:(t,e,n)=>{var r=n(4785),i=n(1285),o=n(6e3),s=n(9916),a=n(5265);function c(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}c.prototype.clear=r,c.prototype.delete=i,c.prototype.get=o,c.prototype.has=s,c.prototype.set=a,t.exports=c},6384:(t,e,n)=>{var r=n(8407),i=n(7465),o=n(3779),s=n(7599),a=n(4758),c=n(4309);function u(t){var e=this.__data__=new r(t);this.size=e.size}u.prototype.clear=i,u.prototype.delete=o,u.prototype.get=s,u.prototype.has=a,u.prototype.set=c,t.exports=u},2705:(t,e,n)=>{var r=n(5639).Symbol;t.exports=r},1149:(t,e,n)=>{var r=n(5639).Uint8Array;t.exports=r},6874:t=>{t.exports=function(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}},4636:(t,e,n)=>{var r=n(2545),i=n(5694),o=n(1469),s=n(4144),a=n(5776),c=n(6719),u=Object.prototype.hasOwnProperty;t.exports=function(t,e){var n=o(t),l=!n&&i(t),d=!n&&!l&&s(t),h=!n&&!l&&!d&&c(t),p=n||l||d||h,f=p?r(t.length,String):[],g=f.length;for(var v in t)!e&&!u.call(t,v)||p&&("length"==v||d&&("offset"==v||"parent"==v)||h&&("buffer"==v||"byteLength"==v||"byteOffset"==v)||a(v,g))||f.push(v);return f}},6556:(t,e,n)=>{var r=n(9465),i=n(7813);t.exports=function(t,e,n){(void 0!==n&&!i(t[e],n)||void 0===n&&!(e in t))&&r(t,e,n)}},4865:(t,e,n)=>{var r=n(9465),i=n(7813),o=Object.prototype.hasOwnProperty;t.exports=function(t,e,n){var s=t[e];o.call(t,e)&&i(s,n)&&(void 0!==n||e in t)||r(t,e,n)}},8470:(t,e,n)=>{var r=n(7813);t.exports=function(t,e){for(var n=t.length;n--;)if(r(t[n][0],e))return n;return-1}},9465:(t,e,n)=>{var r=n(8777);t.exports=function(t,e,n){"__proto__"==e&&r?r(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}},3118:(t,e,n)=>{var r=n(3218),i=Object.create,o=function(){function t(){}return function(e){if(!r(e))return{};if(i)return i(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();t.exports=o},8483:(t,e,n)=>{var r=n(5063)();t.exports=r},4239:(t,e,n)=>{var r=n(2705),i=n(9607),o=n(2333),s="[object Null]",a="[object Undefined]",c=r?r.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?a:s:c&&c in Object(t)?i(t):o(t)}},9454:(t,e,n)=>{var r=n(4239),i=n(7005),o="[object Arguments]";t.exports=function(t){return i(t)&&r(t)==o}},8458:(t,e,n)=>{var r=n(3560),i=n(5346),o=n(3218),s=n(346),a=/^\[object .+?Constructor\]$/,c=Function.prototype,u=Object.prototype,l=c.toString,d=u.hasOwnProperty,h=RegExp("^"+l.call(d).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=function(t){return!(!o(t)||i(t))&&(r(t)?h:a).test(s(t))}},8749:(t,e,n)=>{var r=n(4239),i=n(1780),o=n(7005),s={};s["[object Float32Array]"]=s["[object Float64Array]"]=s["[object Int8Array]"]=s["[object Int16Array]"]=s["[object Int32Array]"]=s["[object Uint8Array]"]=s["[object Uint8ClampedArray]"]=s["[object Uint16Array]"]=s["[object Uint32Array]"]=!0,s["[object Arguments]"]=s["[object Array]"]=s["[object ArrayBuffer]"]=s["[object Boolean]"]=s["[object DataView]"]=s["[object Date]"]=s["[object Error]"]=s["[object Function]"]=s["[object Map]"]=s["[object Number]"]=s["[object Object]"]=s["[object RegExp]"]=s["[object Set]"]=s["[object String]"]=s["[object WeakMap]"]=!1,t.exports=function(t){return o(t)&&i(t.length)&&!!s[r(t)]}},313:(t,e,n)=>{var r=n(3218),i=n(5726),o=n(3498),s=Object.prototype.hasOwnProperty;t.exports=function(t){if(!r(t))return o(t);var e=i(t),n=[];for(var a in t)("constructor"!=a||!e&&s.call(t,a))&&n.push(a);return n}},2980:(t,e,n)=>{var r=n(6384),i=n(6556),o=n(8483),s=n(9783),a=n(3218),c=n(1704),u=n(6390);t.exports=function t(e,n,l,d,h){e!==n&&o(n,(function(o,c){if(h||(h=new r),a(o))s(e,n,c,l,t,d,h);else{var p=d?d(u(e,c),o,c+"",e,n,h):void 0;void 0===p&&(p=o),i(e,c,p)}}),c)}},9783:(t,e,n)=>{var r=n(6556),i=n(4626),o=n(7133),s=n(278),a=n(8517),c=n(5694),u=n(1469),l=n(9246),d=n(4144),h=n(3560),p=n(3218),f=n(8630),g=n(6719),v=n(6390),m=n(9881);t.exports=function(t,e,n,y,_,b,E){var S=v(t,n),C=v(e,n),w=E.get(C);if(w)r(t,n,w);else{var T=b?b(S,C,n+"",t,e,E):void 0,I=void 0===T;if(I){var R=u(C),A=!R&&d(C),k=!R&&!A&&g(C);T=C,R||A||k?u(S)?T=S:l(S)?T=s(S):A?(I=!1,T=i(C,!0)):k?(I=!1,T=o(C,!0)):T=[]:f(C)||c(C)?(T=S,c(S)?T=m(S):p(S)&&!h(S)||(T=a(C))):I=!1}I&&(E.set(C,T),_(T,C,y,b,E),E.delete(C)),r(t,n,T)}}},5976:(t,e,n)=>{var r=n(6557),i=n(5357),o=n(61);t.exports=function(t,e){return o(i(t,e,r),t+"")}},6560:(t,e,n)=>{var r=n(5703),i=n(8777),o=n(6557),s=i?function(t,e){return i(t,"toString",{configurable:!0,enumerable:!1,value:r(e),writable:!0})}:o;t.exports=s},2545:t=>{t.exports=function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}},1717:t=>{t.exports=function(t){return function(e){return t(e)}}},4318:(t,e,n)=>{var r=n(1149);t.exports=function(t){var e=new t.constructor(t.byteLength);return new r(e).set(new r(t)),e}},4626:(t,e,n)=>{t=n.nmd(t);var r=n(5639),i=e&&!e.nodeType&&e,o=i&&t&&!t.nodeType&&t,s=o&&o.exports===i?r.Buffer:void 0,a=s?s.allocUnsafe:void 0;t.exports=function(t,e){if(e)return t.slice();var n=t.length,r=a?a(n):new t.constructor(n);return t.copy(r),r}},7133:(t,e,n)=>{var r=n(4318);t.exports=function(t,e){var n=e?r(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}},278:t=>{t.exports=function(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}},8363:(t,e,n)=>{var r=n(4865),i=n(9465);t.exports=function(t,e,n,o){var s=!n;n||(n={});for(var a=-1,c=e.length;++a<c;){var u=e[a],l=o?o(n[u],t[u],u,n,t):void 0;void 0===l&&(l=t[u]),s?i(n,u,l):r(n,u,l)}return n}},4429:(t,e,n)=>{var r=n(5639)["__core-js_shared__"];t.exports=r},1463:(t,e,n)=>{var r=n(5976),i=n(6612);t.exports=function(t){return r((function(e,n){var r=-1,o=n.length,s=o>1?n[o-1]:void 0,a=o>2?n[2]:void 0;for(s=t.length>3&&"function"==typeof s?(o--,s):void 0,a&&i(n[0],n[1],a)&&(s=o<3?void 0:s,o=1),e=Object(e);++r<o;){var c=n[r];c&&t(e,c,r,s)}return e}))}},5063:t=>{t.exports=function(t){return function(e,n,r){for(var i=-1,o=Object(e),s=r(e),a=s.length;a--;){var c=s[t?a:++i];if(!1===n(o[c],c,o))break}return e}}},8777:(t,e,n)=>{var r=n(852),i=function(){try{var t=r(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();t.exports=i},1957:(t,e,n)=>{var r="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g;t.exports=r},5050:(t,e,n)=>{var r=n(7019);t.exports=function(t,e){var n=t.__data__;return r(e)?n["string"==typeof e?"string":"hash"]:n.map}},852:(t,e,n)=>{var r=n(8458),i=n(7801);t.exports=function(t,e){var n=i(t,e);return r(n)?n:void 0}},5924:(t,e,n)=>{var r=n(5569)(Object.getPrototypeOf,Object);t.exports=r},9607:(t,e,n)=>{var r=n(2705),i=Object.prototype,o=i.hasOwnProperty,s=i.toString,a=r?r.toStringTag:void 0;t.exports=function(t){var e=o.call(t,a),n=t[a];try{t[a]=void 0;var r=!0}catch(t){}var i=s.call(t);return r&&(e?t[a]=n:delete t[a]),i}},7801:t=>{t.exports=function(t,e){return null==t?void 0:t[e]}},1789:(t,e,n)=>{var r=n(4536);t.exports=function(){this.__data__=r?r(null):{},this.size=0}},401:t=>{t.exports=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}},7667:(t,e,n)=>{var r=n(4536),i="__lodash_hash_undefined__",o=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;if(r){var n=e[t];return n===i?void 0:n}return o.call(e,t)?e[t]:void 0}},1327:(t,e,n)=>{var r=n(4536),i=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;return r?void 0!==e[t]:i.call(e,t)}},1866:(t,e,n)=>{var r=n(4536),i="__lodash_hash_undefined__";t.exports=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=r&&void 0===e?i:e,this}},8517:(t,e,n)=>{var r=n(3118),i=n(5924),o=n(5726);t.exports=function(t){return"function"!=typeof t.constructor||o(t)?{}:r(i(t))}},5776:t=>{var e=9007199254740991,n=/^(?:0|[1-9]\d*)$/;t.exports=function(t,r){var i=typeof t;return!!(r=null==r?e:r)&&("number"==i||"symbol"!=i&&n.test(t))&&t>-1&&t%1==0&&t<r}},6612:(t,e,n)=>{var r=n(7813),i=n(8612),o=n(5776),s=n(3218);t.exports=function(t,e,n){if(!s(n))return!1;var a=typeof e;return!!("number"==a?i(n)&&o(e,n.length):"string"==a&&e in n)&&r(n[e],t)}},7019:t=>{t.exports=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}},5346:(t,e,n)=>{var r,i=n(4429),o=(r=/[^.]+$/.exec(i&&i.keys&&i.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"";t.exports=function(t){return!!o&&o in t}},5726:t=>{var e=Object.prototype;t.exports=function(t){var n=t&&t.constructor;return t===("function"==typeof n&&n.prototype||e)}},7040:t=>{t.exports=function(){this.__data__=[],this.size=0}},4125:(t,e,n)=>{var r=n(8470),i=Array.prototype.splice;t.exports=function(t){var e=this.__data__,n=r(e,t);return!(n<0)&&(n==e.length-1?e.pop():i.call(e,n,1),--this.size,!0)}},2117:(t,e,n)=>{var r=n(8470);t.exports=function(t){var e=this.__data__,n=r(e,t);return n<0?void 0:e[n][1]}},7518:(t,e,n)=>{var r=n(8470);t.exports=function(t){return r(this.__data__,t)>-1}},4705:(t,e,n)=>{var r=n(8470);t.exports=function(t,e){var n=this.__data__,i=r(n,t);return i<0?(++this.size,n.push([t,e])):n[i][1]=e,this}},4785:(t,e,n)=>{var r=n(1989),i=n(8407),o=n(7071);t.exports=function(){this.size=0,this.__data__={hash:new r,map:new(o||i),string:new r}}},1285:(t,e,n)=>{var r=n(5050);t.exports=function(t){var e=r(this,t).delete(t);return this.size-=e?1:0,e}},6e3:(t,e,n)=>{var r=n(5050);t.exports=function(t){return r(this,t).get(t)}},9916:(t,e,n)=>{var r=n(5050);t.exports=function(t){return r(this,t).has(t)}},5265:(t,e,n)=>{var r=n(5050);t.exports=function(t,e){var n=r(this,t),i=n.size;return n.set(t,e),this.size+=n.size==i?0:1,this}},4536:(t,e,n)=>{var r=n(852)(Object,"create");t.exports=r},3498:t=>{t.exports=function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}},1167:(t,e,n)=>{t=n.nmd(t);var r=n(1957),i=e&&!e.nodeType&&e,o=i&&t&&!t.nodeType&&t,s=o&&o.exports===i&&r.process,a=function(){try{var t=o&&o.require&&o.require("util").types;return t||s&&s.binding&&s.binding("util")}catch(t){}}();t.exports=a},2333:t=>{var e=Object.prototype.toString;t.exports=function(t){return e.call(t)}},5569:t=>{t.exports=function(t,e){return function(n){return t(e(n))}}},5357:(t,e,n)=>{var r=n(6874),i=Math.max;t.exports=function(t,e,n){return e=i(void 0===e?t.length-1:e,0),function(){for(var o=arguments,s=-1,a=i(o.length-e,0),c=Array(a);++s<a;)c[s]=o[e+s];s=-1;for(var u=Array(e+1);++s<e;)u[s]=o[s];return u[e]=n(c),r(t,this,u)}}},5639:(t,e,n)=>{var r=n(1957),i="object"==typeof self&&self&&self.Object===Object&&self,o=r||i||Function("return this")();t.exports=o},6390:t=>{t.exports=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}},61:(t,e,n)=>{var r=n(6560),i=n(1275)(r);t.exports=i},1275:t=>{var e=800,n=16,r=Date.now;t.exports=function(t){var i=0,o=0;return function(){var s=r(),a=n-(s-o);if(o=s,a>0){if(++i>=e)return arguments[0]}else i=0;return t.apply(void 0,arguments)}}},7465:(t,e,n)=>{var r=n(8407);t.exports=function(){this.__data__=new r,this.size=0}},3779:t=>{t.exports=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}},7599:t=>{t.exports=function(t){return this.__data__.get(t)}},4758:t=>{t.exports=function(t){return this.__data__.has(t)}},4309:(t,e,n)=>{var r=n(8407),i=n(7071),o=n(3369),s=200;t.exports=function(t,e){var n=this.__data__;if(n instanceof r){var a=n.__data__;if(!i||a.length<s-1)return a.push([t,e]),this.size=++n.size,this;n=this.__data__=new o(a)}return n.set(t,e),this.size=n.size,this}},346:t=>{var e=Function.prototype.toString;t.exports=function(t){if(null!=t){try{return e.call(t)}catch(t){}try{return t+""}catch(t){}}return""}},5703:t=>{t.exports=function(t){return function(){return t}}},7813:t=>{t.exports=function(t,e){return t===e||t!=t&&e!=e}},6557:t=>{t.exports=function(t){return t}},5694:(t,e,n)=>{var r=n(9454),i=n(7005),o=Object.prototype,s=o.hasOwnProperty,a=o.propertyIsEnumerable,c=r(function(){return arguments}())?r:function(t){return i(t)&&s.call(t,"callee")&&!a.call(t,"callee")};t.exports=c},1469:t=>{var e=Array.isArray;t.exports=e},8612:(t,e,n)=>{var r=n(3560),i=n(1780);t.exports=function(t){return null!=t&&i(t.length)&&!r(t)}},9246:(t,e,n)=>{var r=n(8612),i=n(7005);t.exports=function(t){return i(t)&&r(t)}},4144:(t,e,n)=>{t=n.nmd(t);var r=n(5639),i=n(5062),o=e&&!e.nodeType&&e,s=o&&t&&!t.nodeType&&t,a=s&&s.exports===o?r.Buffer:void 0,c=(a?a.isBuffer:void 0)||i;t.exports=c},3560:(t,e,n)=>{var r=n(4239),i=n(3218),o="[object AsyncFunction]",s="[object Function]",a="[object GeneratorFunction]",c="[object Proxy]";t.exports=function(t){if(!i(t))return!1;var e=r(t);return e==s||e==a||e==o||e==c}},1780:t=>{var e=9007199254740991;t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=e}},3218:t=>{t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},7005:t=>{t.exports=function(t){return null!=t&&"object"==typeof t}},8630:(t,e,n)=>{var r=n(4239),i=n(5924),o=n(7005),s="[object Object]",a=Function.prototype,c=Object.prototype,u=a.toString,l=c.hasOwnProperty,d=u.call(Object);t.exports=function(t){if(!o(t)||r(t)!=s)return!1;var e=i(t);if(null===e)return!0;var n=l.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&u.call(n)==d}},6719:(t,e,n)=>{var r=n(8749),i=n(1717),o=n(1167),s=o&&o.isTypedArray,a=s?i(s):r;t.exports=a},1704:(t,e,n)=>{var r=n(4636),i=n(313),o=n(8612);t.exports=function(t){return o(t)?r(t,!0):i(t)}},6486:function(t,e,n){var r;t=n.nmd(t),function(){var i,o="Expected a function",s="__lodash_hash_undefined__",a="__lodash_placeholder__",c=16,u=32,l=64,d=128,h=256,p=1/0,f=9007199254740991,g=NaN,v=4294967295,m=[["ary",d],["bind",1],["bindKey",2],["curry",8],["curryRight",c],["flip",512],["partial",u],["partialRight",l],["rearg",h]],y="[object Arguments]",_="[object Array]",b="[object Boolean]",E="[object Date]",S="[object Error]",C="[object Function]",w="[object GeneratorFunction]",T="[object Map]",I="[object Number]",R="[object Object]",A="[object Promise]",k="[object RegExp]",O="[object Set]",P="[object String]",N="[object Symbol]",D="[object WeakMap]",x="[object ArrayBuffer]",M="[object DataView]",j="[object Float32Array]",L="[object Float64Array]",U="[object Int8Array]",B="[object Int16Array]",F="[object Int32Array]",V="[object Uint8Array]",G="[object Uint8ClampedArray]",W="[object Uint16Array]",q="[object Uint32Array]",z=/\b__p \+= '';/g,$=/\b(__p \+=) '' \+/g,H=/(__e\(.*?\)|\b__t\)) \+\n'';/g,K=/&(?:amp|lt|gt|quot|#39);/g,J=/[&<>"']/g,X=RegExp(K.source),Y=RegExp(J.source),Z=/<%-([\s\S]+?)%>/g,Q=/<%([\s\S]+?)%>/g,tt=/<%=([\s\S]+?)%>/g,et=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,nt=/^\w*$/,rt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,it=/[\\^$.*+?()[\]{}|]/g,ot=RegExp(it.source),st=/^\s+/,at=/\s/,ct=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ut=/\{\n\/\* \[wrapped with (.+)\] \*/,lt=/,? & /,dt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ht=/[()=,{}\[\]\/\s]/,pt=/\\(\\)?/g,ft=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,gt=/\w*$/,vt=/^[-+]0x[0-9a-f]+$/i,mt=/^0b[01]+$/i,yt=/^\[object .+?Constructor\]$/,_t=/^0o[0-7]+$/i,bt=/^(?:0|[1-9]\d*)$/,Et=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,St=/($^)/,Ct=/['\n\r\u2028\u2029\\]/g,wt="\\ud800-\\udfff",Tt="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",It="\\u2700-\\u27bf",Rt="a-z\\xdf-\\xf6\\xf8-\\xff",At="A-Z\\xc0-\\xd6\\xd8-\\xde",kt="\\ufe0e\\ufe0f",Ot="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Pt="['’]",Nt="["+wt+"]",Dt="["+Ot+"]",xt="["+Tt+"]",Mt="\\d+",jt="["+It+"]",Lt="["+Rt+"]",Ut="[^"+wt+Ot+Mt+It+Rt+At+"]",Bt="\\ud83c[\\udffb-\\udfff]",Ft="[^"+wt+"]",Vt="(?:\\ud83c[\\udde6-\\uddff]){2}",Gt="[\\ud800-\\udbff][\\udc00-\\udfff]",Wt="["+At+"]",qt="\\u200d",zt="(?:"+Lt+"|"+Ut+")",$t="(?:"+Wt+"|"+Ut+")",Ht="(?:['’](?:d|ll|m|re|s|t|ve))?",Kt="(?:['’](?:D|LL|M|RE|S|T|VE))?",Jt="(?:"+xt+"|"+Bt+")"+"?",Xt="["+kt+"]?",Yt=Xt+Jt+("(?:"+qt+"(?:"+[Ft,Vt,Gt].join("|")+")"+Xt+Jt+")*"),Zt="(?:"+[jt,Vt,Gt].join("|")+")"+Yt,Qt="(?:"+[Ft+xt+"?",xt,Vt,Gt,Nt].join("|")+")",te=RegExp(Pt,"g"),ee=RegExp(xt,"g"),ne=RegExp(Bt+"(?="+Bt+")|"+Qt+Yt,"g"),re=RegExp([Wt+"?"+Lt+"+"+Ht+"(?="+[Dt,Wt,"$"].join("|")+")",$t+"+"+Kt+"(?="+[Dt,Wt+zt,"$"].join("|")+")",Wt+"?"+zt+"+"+Ht,Wt+"+"+Kt,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Mt,Zt].join("|"),"g"),ie=RegExp("["+qt+wt+Tt+kt+"]"),oe=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,se=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],ae=-1,ce={};ce[j]=ce[L]=ce[U]=ce[B]=ce[F]=ce[V]=ce[G]=ce[W]=ce[q]=!0,ce[y]=ce[_]=ce[x]=ce[b]=ce[M]=ce[E]=ce[S]=ce[C]=ce[T]=ce[I]=ce[R]=ce[k]=ce[O]=ce[P]=ce[D]=!1;var ue={};ue[y]=ue[_]=ue[x]=ue[M]=ue[b]=ue[E]=ue[j]=ue[L]=ue[U]=ue[B]=ue[F]=ue[T]=ue[I]=ue[R]=ue[k]=ue[O]=ue[P]=ue[N]=ue[V]=ue[G]=ue[W]=ue[q]=!0,ue[S]=ue[C]=ue[D]=!1;var le={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},de=parseFloat,he=parseInt,pe="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,fe="object"==typeof self&&self&&self.Object===Object&&self,ge=pe||fe||Function("return this")(),ve=e&&!e.nodeType&&e,me=ve&&t&&!t.nodeType&&t,ye=me&&me.exports===ve,_e=ye&&pe.process,be=function(){try{var t=me&&me.require&&me.require("util").types;return t||_e&&_e.binding&&_e.binding("util")}catch(t){}}(),Ee=be&&be.isArrayBuffer,Se=be&&be.isDate,Ce=be&&be.isMap,we=be&&be.isRegExp,Te=be&&be.isSet,Ie=be&&be.isTypedArray;function Re(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function Ae(t,e,n,r){for(var i=-1,o=null==t?0:t.length;++i<o;){var s=t[i];e(r,s,n(s),t)}return r}function ke(t,e){for(var n=-1,r=null==t?0:t.length;++n<r&&!1!==e(t[n],n,t););return t}function Oe(t,e){for(var n=null==t?0:t.length;n--&&!1!==e(t[n],n,t););return t}function Pe(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(!e(t[n],n,t))return!1;return!0}function Ne(t,e){for(var n=-1,r=null==t?0:t.length,i=0,o=[];++n<r;){var s=t[n];e(s,n,t)&&(o[i++]=s)}return o}function De(t,e){return!!(null==t?0:t.length)&&We(t,e,0)>-1}function xe(t,e,n){for(var r=-1,i=null==t?0:t.length;++r<i;)if(n(e,t[r]))return!0;return!1}function Me(t,e){for(var n=-1,r=null==t?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}function je(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}function Le(t,e,n,r){var i=-1,o=null==t?0:t.length;for(r&&o&&(n=t[++i]);++i<o;)n=e(n,t[i],i,t);return n}function Ue(t,e,n,r){var i=null==t?0:t.length;for(r&&i&&(n=t[--i]);i--;)n=e(n,t[i],i,t);return n}function Be(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}var Fe=He("length");function Ve(t,e,n){var r;return n(t,(function(t,n,i){if(e(t,n,i))return r=n,!1})),r}function Ge(t,e,n,r){for(var i=t.length,o=n+(r?1:-1);r?o--:++o<i;)if(e(t[o],o,t))return o;return-1}function We(t,e,n){return e==e?function(t,e,n){var r=n-1,i=t.length;for(;++r<i;)if(t[r]===e)return r;return-1}(t,e,n):Ge(t,ze,n)}function qe(t,e,n,r){for(var i=n-1,o=t.length;++i<o;)if(r(t[i],e))return i;return-1}function ze(t){return t!=t}function $e(t,e){var n=null==t?0:t.length;return n?Xe(t,e)/n:g}function He(t){return function(e){return null==e?i:e[t]}}function Ke(t){return function(e){return null==t?i:t[e]}}function Je(t,e,n,r,i){return i(t,(function(t,i,o){n=r?(r=!1,t):e(n,t,i,o)})),n}function Xe(t,e){for(var n,r=-1,o=t.length;++r<o;){var s=e(t[r]);s!==i&&(n=n===i?s:n+s)}return n}function Ye(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}function Ze(t){return t?t.slice(0,vn(t)+1).replace(st,""):t}function Qe(t){return function(e){return t(e)}}function tn(t,e){return Me(e,(function(e){return t[e]}))}function en(t,e){return t.has(e)}function nn(t,e){for(var n=-1,r=t.length;++n<r&&We(e,t[n],0)>-1;);return n}function rn(t,e){for(var n=t.length;n--&&We(e,t[n],0)>-1;);return n}var on=Ke({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),sn=Ke({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function an(t){return"\\"+le[t]}function cn(t){return ie.test(t)}function un(t){var e=-1,n=Array(t.size);return t.forEach((function(t,r){n[++e]=[r,t]})),n}function ln(t,e){return function(n){return t(e(n))}}function dn(t,e){for(var n=-1,r=t.length,i=0,o=[];++n<r;){var s=t[n];s!==e&&s!==a||(t[n]=a,o[i++]=n)}return o}function hn(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n}function pn(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=[t,t]})),n}function fn(t){return cn(t)?function(t){var e=ne.lastIndex=0;for(;ne.test(t);)++e;return e}(t):Fe(t)}function gn(t){return cn(t)?function(t){return t.match(ne)||[]}(t):function(t){return t.split("")}(t)}function vn(t){for(var e=t.length;e--&&at.test(t.charAt(e)););return e}var mn=Ke({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"});var yn=function t(e){var n,r=(e=null==e?ge:yn.defaults(ge.Object(),e,yn.pick(ge,se))).Array,at=e.Date,wt=e.Error,Tt=e.Function,It=e.Math,Rt=e.Object,At=e.RegExp,kt=e.String,Ot=e.TypeError,Pt=r.prototype,Nt=Tt.prototype,Dt=Rt.prototype,xt=e["__core-js_shared__"],Mt=Nt.toString,jt=Dt.hasOwnProperty,Lt=0,Ut=(n=/[^.]+$/.exec(xt&&xt.keys&&xt.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Bt=Dt.toString,Ft=Mt.call(Rt),Vt=ge._,Gt=At("^"+Mt.call(jt).replace(it,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Wt=ye?e.Buffer:i,qt=e.Symbol,zt=e.Uint8Array,$t=Wt?Wt.allocUnsafe:i,Ht=ln(Rt.getPrototypeOf,Rt),Kt=Rt.create,Jt=Dt.propertyIsEnumerable,Xt=Pt.splice,Yt=qt?qt.isConcatSpreadable:i,Zt=qt?qt.iterator:i,Qt=qt?qt.toStringTag:i,ne=function(){try{var t=po(Rt,"defineProperty");return t({},"",{}),t}catch(t){}}(),ie=e.clearTimeout!==ge.clearTimeout&&e.clearTimeout,le=at&&at.now!==ge.Date.now&&at.now,pe=e.setTimeout!==ge.setTimeout&&e.setTimeout,fe=It.ceil,ve=It.floor,me=Rt.getOwnPropertySymbols,_e=Wt?Wt.isBuffer:i,be=e.isFinite,Fe=Pt.join,Ke=ln(Rt.keys,Rt),_n=It.max,bn=It.min,En=at.now,Sn=e.parseInt,Cn=It.random,wn=Pt.reverse,Tn=po(e,"DataView"),In=po(e,"Map"),Rn=po(e,"Promise"),An=po(e,"Set"),kn=po(e,"WeakMap"),On=po(Rt,"create"),Pn=kn&&new kn,Nn={},Dn=Bo(Tn),xn=Bo(In),Mn=Bo(Rn),jn=Bo(An),Ln=Bo(kn),Un=qt?qt.prototype:i,Bn=Un?Un.valueOf:i,Fn=Un?Un.toString:i;function Vn(t){if(na(t)&&!zs(t)&&!(t instanceof zn)){if(t instanceof qn)return t;if(jt.call(t,"__wrapped__"))return Fo(t)}return new qn(t)}var Gn=function(){function t(){}return function(e){if(!ea(e))return{};if(Kt)return Kt(e);t.prototype=e;var n=new t;return t.prototype=i,n}}();function Wn(){}function qn(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=i}function zn(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=v,this.__views__=[]}function $n(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Hn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Kn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Jn(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new Kn;++e<n;)this.add(t[e])}function Xn(t){var e=this.__data__=new Hn(t);this.size=e.size}function Yn(t,e){var n=zs(t),r=!n&&qs(t),i=!n&&!r&&Js(t),o=!n&&!r&&!i&&la(t),s=n||r||i||o,a=s?Ye(t.length,kt):[],c=a.length;for(var u in t)!e&&!jt.call(t,u)||s&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||bo(u,c))||a.push(u);return a}function Zn(t){var e=t.length;return e?t[Jr(0,e-1)]:i}function Qn(t,e){return jo(Oi(t),cr(e,0,t.length))}function tr(t){return jo(Oi(t))}function er(t,e,n){(n!==i&&!Vs(t[e],n)||n===i&&!(e in t))&&sr(t,e,n)}function nr(t,e,n){var r=t[e];jt.call(t,e)&&Vs(r,n)&&(n!==i||e in t)||sr(t,e,n)}function rr(t,e){for(var n=t.length;n--;)if(Vs(t[n][0],e))return n;return-1}function ir(t,e,n,r){return pr(t,(function(t,i,o){e(r,t,n(t),o)})),r}function or(t,e){return t&&Pi(e,Na(e),t)}function sr(t,e,n){"__proto__"==e&&ne?ne(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function ar(t,e){for(var n=-1,o=e.length,s=r(o),a=null==t;++n<o;)s[n]=a?i:Ra(t,e[n]);return s}function cr(t,e,n){return t==t&&(n!==i&&(t=t<=n?t:n),e!==i&&(t=t>=e?t:e)),t}function ur(t,e,n,r,o,s){var a,c=1&e,u=2&e,l=4&e;if(n&&(a=o?n(t,r,o,s):n(t)),a!==i)return a;if(!ea(t))return t;var d=zs(t);if(d){if(a=function(t){var e=t.length,n=new t.constructor(e);e&&"string"==typeof t[0]&&jt.call(t,"index")&&(n.index=t.index,n.input=t.input);return n}(t),!c)return Oi(t,a)}else{var h=vo(t),p=h==C||h==w;if(Js(t))return wi(t,c);if(h==R||h==y||p&&!o){if(a=u||p?{}:yo(t),!c)return u?function(t,e){return Pi(t,go(t),e)}(t,function(t,e){return t&&Pi(e,Da(e),t)}(a,t)):function(t,e){return Pi(t,fo(t),e)}(t,or(a,t))}else{if(!ue[h])return o?t:{};a=function(t,e,n){var r=t.constructor;switch(e){case x:return Ti(t);case b:case E:return new r(+t);case M:return function(t,e){var n=e?Ti(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,n);case j:case L:case U:case B:case F:case V:case G:case W:case q:return Ii(t,n);case T:return new r;case I:case P:return new r(t);case k:return function(t){var e=new t.constructor(t.source,gt.exec(t));return e.lastIndex=t.lastIndex,e}(t);case O:return new r;case N:return i=t,Bn?Rt(Bn.call(i)):{}}var i}(t,h,c)}}s||(s=new Xn);var f=s.get(t);if(f)return f;s.set(t,a),aa(t)?t.forEach((function(r){a.add(ur(r,e,n,r,t,s))})):ra(t)&&t.forEach((function(r,i){a.set(i,ur(r,e,n,i,t,s))}));var g=d?i:(l?u?oo:io:u?Da:Na)(t);return ke(g||t,(function(r,i){g&&(r=t[i=r]),nr(a,i,ur(r,e,n,i,t,s))})),a}function lr(t,e,n){var r=n.length;if(null==t)return!r;for(t=Rt(t);r--;){var o=n[r],s=e[o],a=t[o];if(a===i&&!(o in t)||!s(a))return!1}return!0}function dr(t,e,n){if("function"!=typeof t)throw new Ot(o);return No((function(){t.apply(i,n)}),e)}function hr(t,e,n,r){var i=-1,o=De,s=!0,a=t.length,c=[],u=e.length;if(!a)return c;n&&(e=Me(e,Qe(n))),r?(o=xe,s=!1):e.length>=200&&(o=en,s=!1,e=new Jn(e));t:for(;++i<a;){var l=t[i],d=null==n?l:n(l);if(l=r||0!==l?l:0,s&&d==d){for(var h=u;h--;)if(e[h]===d)continue t;c.push(l)}else o(e,d,r)||c.push(l)}return c}Vn.templateSettings={escape:Z,evaluate:Q,interpolate:tt,variable:"",imports:{_:Vn}},Vn.prototype=Wn.prototype,Vn.prototype.constructor=Vn,qn.prototype=Gn(Wn.prototype),qn.prototype.constructor=qn,zn.prototype=Gn(Wn.prototype),zn.prototype.constructor=zn,$n.prototype.clear=function(){this.__data__=On?On(null):{},this.size=0},$n.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},$n.prototype.get=function(t){var e=this.__data__;if(On){var n=e[t];return n===s?i:n}return jt.call(e,t)?e[t]:i},$n.prototype.has=function(t){var e=this.__data__;return On?e[t]!==i:jt.call(e,t)},$n.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=On&&e===i?s:e,this},Hn.prototype.clear=function(){this.__data__=[],this.size=0},Hn.prototype.delete=function(t){var e=this.__data__,n=rr(e,t);return!(n<0)&&(n==e.length-1?e.pop():Xt.call(e,n,1),--this.size,!0)},Hn.prototype.get=function(t){var e=this.__data__,n=rr(e,t);return n<0?i:e[n][1]},Hn.prototype.has=function(t){return rr(this.__data__,t)>-1},Hn.prototype.set=function(t,e){var n=this.__data__,r=rr(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this},Kn.prototype.clear=function(){this.size=0,this.__data__={hash:new $n,map:new(In||Hn),string:new $n}},Kn.prototype.delete=function(t){var e=lo(this,t).delete(t);return this.size-=e?1:0,e},Kn.prototype.get=function(t){return lo(this,t).get(t)},Kn.prototype.has=function(t){return lo(this,t).has(t)},Kn.prototype.set=function(t,e){var n=lo(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},Jn.prototype.add=Jn.prototype.push=function(t){return this.__data__.set(t,s),this},Jn.prototype.has=function(t){return this.__data__.has(t)},Xn.prototype.clear=function(){this.__data__=new Hn,this.size=0},Xn.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},Xn.prototype.get=function(t){return this.__data__.get(t)},Xn.prototype.has=function(t){return this.__data__.has(t)},Xn.prototype.set=function(t,e){var n=this.__data__;if(n instanceof Hn){var r=n.__data__;if(!In||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new Kn(r)}return n.set(t,e),this.size=n.size,this};var pr=xi(Er),fr=xi(Sr,!0);function gr(t,e){var n=!0;return pr(t,(function(t,r,i){return n=!!e(t,r,i)})),n}function vr(t,e,n){for(var r=-1,o=t.length;++r<o;){var s=t[r],a=e(s);if(null!=a&&(c===i?a==a&&!ua(a):n(a,c)))var c=a,u=s}return u}function mr(t,e){var n=[];return pr(t,(function(t,r,i){e(t,r,i)&&n.push(t)})),n}function yr(t,e,n,r,i){var o=-1,s=t.length;for(n||(n=_o),i||(i=[]);++o<s;){var a=t[o];e>0&&n(a)?e>1?yr(a,e-1,n,r,i):je(i,a):r||(i[i.length]=a)}return i}var _r=Mi(),br=Mi(!0);function Er(t,e){return t&&_r(t,e,Na)}function Sr(t,e){return t&&br(t,e,Na)}function Cr(t,e){return Ne(e,(function(e){return Zs(t[e])}))}function wr(t,e){for(var n=0,r=(e=bi(e,t)).length;null!=t&&n<r;)t=t[Uo(e[n++])];return n&&n==r?t:i}function Tr(t,e,n){var r=e(t);return zs(t)?r:je(r,n(t))}function Ir(t){return null==t?t===i?"[object Undefined]":"[object Null]":Qt&&Qt in Rt(t)?function(t){var e=jt.call(t,Qt),n=t[Qt];try{t[Qt]=i;var r=!0}catch(t){}var o=Bt.call(t);r&&(e?t[Qt]=n:delete t[Qt]);return o}(t):function(t){return Bt.call(t)}(t)}function Rr(t,e){return t>e}function Ar(t,e){return null!=t&&jt.call(t,e)}function kr(t,e){return null!=t&&e in Rt(t)}function Or(t,e,n){for(var o=n?xe:De,s=t[0].length,a=t.length,c=a,u=r(a),l=1/0,d=[];c--;){var h=t[c];c&&e&&(h=Me(h,Qe(e))),l=bn(h.length,l),u[c]=!n&&(e||s>=120&&h.length>=120)?new Jn(c&&h):i}h=t[0];var p=-1,f=u[0];t:for(;++p<s&&d.length<l;){var g=h[p],v=e?e(g):g;if(g=n||0!==g?g:0,!(f?en(f,v):o(d,v,n))){for(c=a;--c;){var m=u[c];if(!(m?en(m,v):o(t[c],v,n)))continue t}f&&f.push(v),d.push(g)}}return d}function Pr(t,e,n){var r=null==(t=ko(t,e=bi(e,t)))?t:t[Uo(Yo(e))];return null==r?i:Re(r,t,n)}function Nr(t){return na(t)&&Ir(t)==y}function Dr(t,e,n,r,o){return t===e||(null==t||null==e||!na(t)&&!na(e)?t!=t&&e!=e:function(t,e,n,r,o,s){var a=zs(t),c=zs(e),u=a?_:vo(t),l=c?_:vo(e),d=(u=u==y?R:u)==R,h=(l=l==y?R:l)==R,p=u==l;if(p&&Js(t)){if(!Js(e))return!1;a=!0,d=!1}if(p&&!d)return s||(s=new Xn),a||la(t)?no(t,e,n,r,o,s):function(t,e,n,r,i,o,s){switch(n){case M:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case x:return!(t.byteLength!=e.byteLength||!o(new zt(t),new zt(e)));case b:case E:case I:return Vs(+t,+e);case S:return t.name==e.name&&t.message==e.message;case k:case P:return t==e+"";case T:var a=un;case O:var c=1&r;if(a||(a=hn),t.size!=e.size&&!c)return!1;var u=s.get(t);if(u)return u==e;r|=2,s.set(t,e);var l=no(a(t),a(e),r,i,o,s);return s.delete(t),l;case N:if(Bn)return Bn.call(t)==Bn.call(e)}return!1}(t,e,u,n,r,o,s);if(!(1&n)){var f=d&&jt.call(t,"__wrapped__"),g=h&&jt.call(e,"__wrapped__");if(f||g){var v=f?t.value():t,m=g?e.value():e;return s||(s=new Xn),o(v,m,n,r,s)}}if(!p)return!1;return s||(s=new Xn),function(t,e,n,r,o,s){var a=1&n,c=io(t),u=c.length,l=io(e),d=l.length;if(u!=d&&!a)return!1;var h=u;for(;h--;){var p=c[h];if(!(a?p in e:jt.call(e,p)))return!1}var f=s.get(t),g=s.get(e);if(f&&g)return f==e&&g==t;var v=!0;s.set(t,e),s.set(e,t);var m=a;for(;++h<u;){var y=t[p=c[h]],_=e[p];if(r)var b=a?r(_,y,p,e,t,s):r(y,_,p,t,e,s);if(!(b===i?y===_||o(y,_,n,r,s):b)){v=!1;break}m||(m="constructor"==p)}if(v&&!m){var E=t.constructor,S=e.constructor;E==S||!("constructor"in t)||!("constructor"in e)||"function"==typeof E&&E instanceof E&&"function"==typeof S&&S instanceof S||(v=!1)}return s.delete(t),s.delete(e),v}(t,e,n,r,o,s)}(t,e,n,r,Dr,o))}function xr(t,e,n,r){var o=n.length,s=o,a=!r;if(null==t)return!s;for(t=Rt(t);o--;){var c=n[o];if(a&&c[2]?c[1]!==t[c[0]]:!(c[0]in t))return!1}for(;++o<s;){var u=(c=n[o])[0],l=t[u],d=c[1];if(a&&c[2]){if(l===i&&!(u in t))return!1}else{var h=new Xn;if(r)var p=r(l,d,u,t,e,h);if(!(p===i?Dr(d,l,3,r,h):p))return!1}}return!0}function Mr(t){return!(!ea(t)||(e=t,Ut&&Ut in e))&&(Zs(t)?Gt:yt).test(Bo(t));var e}function jr(t){return"function"==typeof t?t:null==t?ic:"object"==typeof t?zs(t)?Gr(t[0],t[1]):Vr(t):pc(t)}function Lr(t){if(!To(t))return Ke(t);var e=[];for(var n in Rt(t))jt.call(t,n)&&"constructor"!=n&&e.push(n);return e}function Ur(t){if(!ea(t))return function(t){var e=[];if(null!=t)for(var n in Rt(t))e.push(n);return e}(t);var e=To(t),n=[];for(var r in t)("constructor"!=r||!e&&jt.call(t,r))&&n.push(r);return n}function Br(t,e){return t<e}function Fr(t,e){var n=-1,i=Hs(t)?r(t.length):[];return pr(t,(function(t,r,o){i[++n]=e(t,r,o)})),i}function Vr(t){var e=ho(t);return 1==e.length&&e[0][2]?Ro(e[0][0],e[0][1]):function(n){return n===t||xr(n,t,e)}}function Gr(t,e){return So(t)&&Io(e)?Ro(Uo(t),e):function(n){var r=Ra(n,t);return r===i&&r===e?Aa(n,t):Dr(e,r,3)}}function Wr(t,e,n,r,o){t!==e&&_r(e,(function(s,a){if(o||(o=new Xn),ea(s))!function(t,e,n,r,o,s,a){var c=Oo(t,n),u=Oo(e,n),l=a.get(u);if(l)return void er(t,n,l);var d=s?s(c,u,n+"",t,e,a):i,h=d===i;if(h){var p=zs(u),f=!p&&Js(u),g=!p&&!f&&la(u);d=u,p||f||g?zs(c)?d=c:Ks(c)?d=Oi(c):f?(h=!1,d=wi(u,!0)):g?(h=!1,d=Ii(u,!0)):d=[]:oa(u)||qs(u)?(d=c,qs(c)?d=ya(c):ea(c)&&!Zs(c)||(d=yo(u))):h=!1}h&&(a.set(u,d),o(d,u,r,s,a),a.delete(u));er(t,n,d)}(t,e,a,n,Wr,r,o);else{var c=r?r(Oo(t,a),s,a+"",t,e,o):i;c===i&&(c=s),er(t,a,c)}}),Da)}function qr(t,e){var n=t.length;if(n)return bo(e+=e<0?n:0,n)?t[e]:i}function zr(t,e,n){e=e.length?Me(e,(function(t){return zs(t)?function(e){return wr(e,1===t.length?t[0]:t)}:t})):[ic];var r=-1;e=Me(e,Qe(uo()));var i=Fr(t,(function(t,n,i){var o=Me(e,(function(e){return e(t)}));return{criteria:o,index:++r,value:t}}));return function(t,e){var n=t.length;for(t.sort(e);n--;)t[n]=t[n].value;return t}(i,(function(t,e){return function(t,e,n){var r=-1,i=t.criteria,o=e.criteria,s=i.length,a=n.length;for(;++r<s;){var c=Ri(i[r],o[r]);if(c)return r>=a?c:c*("desc"==n[r]?-1:1)}return t.index-e.index}(t,e,n)}))}function $r(t,e,n){for(var r=-1,i=e.length,o={};++r<i;){var s=e[r],a=wr(t,s);n(a,s)&&ti(o,bi(s,t),a)}return o}function Hr(t,e,n,r){var i=r?qe:We,o=-1,s=e.length,a=t;for(t===e&&(e=Oi(e)),n&&(a=Me(t,Qe(n)));++o<s;)for(var c=0,u=e[o],l=n?n(u):u;(c=i(a,l,c,r))>-1;)a!==t&&Xt.call(a,c,1),Xt.call(t,c,1);return t}function Kr(t,e){for(var n=t?e.length:0,r=n-1;n--;){var i=e[n];if(n==r||i!==o){var o=i;bo(i)?Xt.call(t,i,1):hi(t,i)}}return t}function Jr(t,e){return t+ve(Cn()*(e-t+1))}function Xr(t,e){var n="";if(!t||e<1||e>f)return n;do{e%2&&(n+=t),(e=ve(e/2))&&(t+=t)}while(e);return n}function Yr(t,e){return Do(Ao(t,e,ic),t+"")}function Zr(t){return Zn(Va(t))}function Qr(t,e){var n=Va(t);return jo(n,cr(e,0,n.length))}function ti(t,e,n,r){if(!ea(t))return t;for(var o=-1,s=(e=bi(e,t)).length,a=s-1,c=t;null!=c&&++o<s;){var u=Uo(e[o]),l=n;if("__proto__"===u||"constructor"===u||"prototype"===u)return t;if(o!=a){var d=c[u];(l=r?r(d,u,c):i)===i&&(l=ea(d)?d:bo(e[o+1])?[]:{})}nr(c,u,l),c=c[u]}return t}var ei=Pn?function(t,e){return Pn.set(t,e),t}:ic,ni=ne?function(t,e){return ne(t,"toString",{configurable:!0,enumerable:!1,value:ec(e),writable:!0})}:ic;function ri(t){return jo(Va(t))}function ii(t,e,n){var i=-1,o=t.length;e<0&&(e=-e>o?0:o+e),(n=n>o?o:n)<0&&(n+=o),o=e>n?0:n-e>>>0,e>>>=0;for(var s=r(o);++i<o;)s[i]=t[i+e];return s}function oi(t,e){var n;return pr(t,(function(t,r,i){return!(n=e(t,r,i))})),!!n}function si(t,e,n){var r=0,i=null==t?r:t.length;if("number"==typeof e&&e==e&&i<=2147483647){for(;r<i;){var o=r+i>>>1,s=t[o];null!==s&&!ua(s)&&(n?s<=e:s<e)?r=o+1:i=o}return i}return ai(t,e,ic,n)}function ai(t,e,n,r){var o=0,s=null==t?0:t.length;if(0===s)return 0;for(var a=(e=n(e))!=e,c=null===e,u=ua(e),l=e===i;o<s;){var d=ve((o+s)/2),h=n(t[d]),p=h!==i,f=null===h,g=h==h,v=ua(h);if(a)var m=r||g;else m=l?g&&(r||p):c?g&&p&&(r||!f):u?g&&p&&!f&&(r||!v):!f&&!v&&(r?h<=e:h<e);m?o=d+1:s=d}return bn(s,4294967294)}function ci(t,e){for(var n=-1,r=t.length,i=0,o=[];++n<r;){var s=t[n],a=e?e(s):s;if(!n||!Vs(a,c)){var c=a;o[i++]=0===s?0:s}}return o}function ui(t){return"number"==typeof t?t:ua(t)?g:+t}function li(t){if("string"==typeof t)return t;if(zs(t))return Me(t,li)+"";if(ua(t))return Fn?Fn.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function di(t,e,n){var r=-1,i=De,o=t.length,s=!0,a=[],c=a;if(n)s=!1,i=xe;else if(o>=200){var u=e?null:Xi(t);if(u)return hn(u);s=!1,i=en,c=new Jn}else c=e?[]:a;t:for(;++r<o;){var l=t[r],d=e?e(l):l;if(l=n||0!==l?l:0,s&&d==d){for(var h=c.length;h--;)if(c[h]===d)continue t;e&&c.push(d),a.push(l)}else i(c,d,n)||(c!==a&&c.push(d),a.push(l))}return a}function hi(t,e){return null==(t=ko(t,e=bi(e,t)))||delete t[Uo(Yo(e))]}function pi(t,e,n,r){return ti(t,e,n(wr(t,e)),r)}function fi(t,e,n,r){for(var i=t.length,o=r?i:-1;(r?o--:++o<i)&&e(t[o],o,t););return n?ii(t,r?0:o,r?o+1:i):ii(t,r?o+1:0,r?i:o)}function gi(t,e){var n=t;return n instanceof zn&&(n=n.value()),Le(e,(function(t,e){return e.func.apply(e.thisArg,je([t],e.args))}),n)}function vi(t,e,n){var i=t.length;if(i<2)return i?di(t[0]):[];for(var o=-1,s=r(i);++o<i;)for(var a=t[o],c=-1;++c<i;)c!=o&&(s[o]=hr(s[o]||a,t[c],e,n));return di(yr(s,1),e,n)}function mi(t,e,n){for(var r=-1,o=t.length,s=e.length,a={};++r<o;){var c=r<s?e[r]:i;n(a,t[r],c)}return a}function yi(t){return Ks(t)?t:[]}function _i(t){return"function"==typeof t?t:ic}function bi(t,e){return zs(t)?t:So(t,e)?[t]:Lo(_a(t))}var Ei=Yr;function Si(t,e,n){var r=t.length;return n=n===i?r:n,!e&&n>=r?t:ii(t,e,n)}var Ci=ie||function(t){return ge.clearTimeout(t)};function wi(t,e){if(e)return t.slice();var n=t.length,r=$t?$t(n):new t.constructor(n);return t.copy(r),r}function Ti(t){var e=new t.constructor(t.byteLength);return new zt(e).set(new zt(t)),e}function Ii(t,e){var n=e?Ti(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function Ri(t,e){if(t!==e){var n=t!==i,r=null===t,o=t==t,s=ua(t),a=e!==i,c=null===e,u=e==e,l=ua(e);if(!c&&!l&&!s&&t>e||s&&a&&u&&!c&&!l||r&&a&&u||!n&&u||!o)return 1;if(!r&&!s&&!l&&t<e||l&&n&&o&&!r&&!s||c&&n&&o||!a&&o||!u)return-1}return 0}function Ai(t,e,n,i){for(var o=-1,s=t.length,a=n.length,c=-1,u=e.length,l=_n(s-a,0),d=r(u+l),h=!i;++c<u;)d[c]=e[c];for(;++o<a;)(h||o<s)&&(d[n[o]]=t[o]);for(;l--;)d[c++]=t[o++];return d}function ki(t,e,n,i){for(var o=-1,s=t.length,a=-1,c=n.length,u=-1,l=e.length,d=_n(s-c,0),h=r(d+l),p=!i;++o<d;)h[o]=t[o];for(var f=o;++u<l;)h[f+u]=e[u];for(;++a<c;)(p||o<s)&&(h[f+n[a]]=t[o++]);return h}function Oi(t,e){var n=-1,i=t.length;for(e||(e=r(i));++n<i;)e[n]=t[n];return e}function Pi(t,e,n,r){var o=!n;n||(n={});for(var s=-1,a=e.length;++s<a;){var c=e[s],u=r?r(n[c],t[c],c,n,t):i;u===i&&(u=t[c]),o?sr(n,c,u):nr(n,c,u)}return n}function Ni(t,e){return function(n,r){var i=zs(n)?Ae:ir,o=e?e():{};return i(n,t,uo(r,2),o)}}function Di(t){return Yr((function(e,n){var r=-1,o=n.length,s=o>1?n[o-1]:i,a=o>2?n[2]:i;for(s=t.length>3&&"function"==typeof s?(o--,s):i,a&&Eo(n[0],n[1],a)&&(s=o<3?i:s,o=1),e=Rt(e);++r<o;){var c=n[r];c&&t(e,c,r,s)}return e}))}function xi(t,e){return function(n,r){if(null==n)return n;if(!Hs(n))return t(n,r);for(var i=n.length,o=e?i:-1,s=Rt(n);(e?o--:++o<i)&&!1!==r(s[o],o,s););return n}}function Mi(t){return function(e,n,r){for(var i=-1,o=Rt(e),s=r(e),a=s.length;a--;){var c=s[t?a:++i];if(!1===n(o[c],c,o))break}return e}}function ji(t){return function(e){var n=cn(e=_a(e))?gn(e):i,r=n?n[0]:e.charAt(0),o=n?Si(n,1).join(""):e.slice(1);return r[t]()+o}}function Li(t){return function(e){return Le(Za(qa(e).replace(te,"")),t,"")}}function Ui(t){return function(){var e=arguments;switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var n=Gn(t.prototype),r=t.apply(n,e);return ea(r)?r:n}}function Bi(t){return function(e,n,r){var o=Rt(e);if(!Hs(e)){var s=uo(n,3);e=Na(e),n=function(t){return s(o[t],t,o)}}var a=t(e,n,r);return a>-1?o[s?e[a]:a]:i}}function Fi(t){return ro((function(e){var n=e.length,r=n,s=qn.prototype.thru;for(t&&e.reverse();r--;){var a=e[r];if("function"!=typeof a)throw new Ot(o);if(s&&!c&&"wrapper"==ao(a))var c=new qn([],!0)}for(r=c?r:n;++r<n;){var u=ao(a=e[r]),l="wrapper"==u?so(a):i;c=l&&Co(l[0])&&424==l[1]&&!l[4].length&&1==l[9]?c[ao(l[0])].apply(c,l[3]):1==a.length&&Co(a)?c[u]():c.thru(a)}return function(){var t=arguments,r=t[0];if(c&&1==t.length&&zs(r))return c.plant(r).value();for(var i=0,o=n?e[i].apply(this,t):r;++i<n;)o=e[i].call(this,o);return o}}))}function Vi(t,e,n,o,s,a,c,u,l,h){var p=e&d,f=1&e,g=2&e,v=24&e,m=512&e,y=g?i:Ui(t);return function d(){for(var _=arguments.length,b=r(_),E=_;E--;)b[E]=arguments[E];if(v)var S=co(d),C=function(t,e){for(var n=t.length,r=0;n--;)t[n]===e&&++r;return r}(b,S);if(o&&(b=Ai(b,o,s,v)),a&&(b=ki(b,a,c,v)),_-=C,v&&_<h){var w=dn(b,S);return Ki(t,e,Vi,d.placeholder,n,b,w,u,l,h-_)}var T=f?n:this,I=g?T[t]:t;return _=b.length,u?b=function(t,e){var n=t.length,r=bn(e.length,n),o=Oi(t);for(;r--;){var s=e[r];t[r]=bo(s,n)?o[s]:i}return t}(b,u):m&&_>1&&b.reverse(),p&&l<_&&(b.length=l),this&&this!==ge&&this instanceof d&&(I=y||Ui(I)),I.apply(T,b)}}function Gi(t,e){return function(n,r){return function(t,e,n,r){return Er(t,(function(t,i,o){e(r,n(t),i,o)})),r}(n,t,e(r),{})}}function Wi(t,e){return function(n,r){var o;if(n===i&&r===i)return e;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=li(n),r=li(r)):(n=ui(n),r=ui(r)),o=t(n,r)}return o}}function qi(t){return ro((function(e){return e=Me(e,Qe(uo())),Yr((function(n){var r=this;return t(e,(function(t){return Re(t,r,n)}))}))}))}function zi(t,e){var n=(e=e===i?" ":li(e)).length;if(n<2)return n?Xr(e,t):e;var r=Xr(e,fe(t/fn(e)));return cn(e)?Si(gn(r),0,t).join(""):r.slice(0,t)}function $i(t){return function(e,n,o){return o&&"number"!=typeof o&&Eo(e,n,o)&&(n=o=i),e=fa(e),n===i?(n=e,e=0):n=fa(n),function(t,e,n,i){for(var o=-1,s=_n(fe((e-t)/(n||1)),0),a=r(s);s--;)a[i?s:++o]=t,t+=n;return a}(e,n,o=o===i?e<n?1:-1:fa(o),t)}}function Hi(t){return function(e,n){return"string"==typeof e&&"string"==typeof n||(e=ma(e),n=ma(n)),t(e,n)}}function Ki(t,e,n,r,o,s,a,c,d,h){var p=8&e;e|=p?u:l,4&(e&=~(p?l:u))||(e&=-4);var f=[t,e,o,p?s:i,p?a:i,p?i:s,p?i:a,c,d,h],g=n.apply(i,f);return Co(t)&&Po(g,f),g.placeholder=r,xo(g,t,e)}function Ji(t){var e=It[t];return function(t,n){if(t=ma(t),(n=null==n?0:bn(ga(n),292))&&be(t)){var r=(_a(t)+"e").split("e");return+((r=(_a(e(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return e(t)}}var Xi=An&&1/hn(new An([,-0]))[1]==p?function(t){return new An(t)}:uc;function Yi(t){return function(e){var n=vo(e);return n==T?un(e):n==O?pn(e):function(t,e){return Me(e,(function(e){return[e,t[e]]}))}(e,t(e))}}function Zi(t,e,n,s,p,f,g,v){var m=2&e;if(!m&&"function"!=typeof t)throw new Ot(o);var y=s?s.length:0;if(y||(e&=-97,s=p=i),g=g===i?g:_n(ga(g),0),v=v===i?v:ga(v),y-=p?p.length:0,e&l){var _=s,b=p;s=p=i}var E=m?i:so(t),S=[t,e,n,s,p,_,b,f,g,v];if(E&&function(t,e){var n=t[1],r=e[1],i=n|r,o=i<131,s=r==d&&8==n||r==d&&n==h&&t[7].length<=e[8]||384==r&&e[7].length<=e[8]&&8==n;if(!o&&!s)return t;1&r&&(t[2]=e[2],i|=1&n?0:4);var c=e[3];if(c){var u=t[3];t[3]=u?Ai(u,c,e[4]):c,t[4]=u?dn(t[3],a):e[4]}(c=e[5])&&(u=t[5],t[5]=u?ki(u,c,e[6]):c,t[6]=u?dn(t[5],a):e[6]);(c=e[7])&&(t[7]=c);r&d&&(t[8]=null==t[8]?e[8]:bn(t[8],e[8]));null==t[9]&&(t[9]=e[9]);t[0]=e[0],t[1]=i}(S,E),t=S[0],e=S[1],n=S[2],s=S[3],p=S[4],!(v=S[9]=S[9]===i?m?0:t.length:_n(S[9]-y,0))&&24&e&&(e&=-25),e&&1!=e)C=8==e||e==c?function(t,e,n){var o=Ui(t);return function s(){for(var a=arguments.length,c=r(a),u=a,l=co(s);u--;)c[u]=arguments[u];var d=a<3&&c[0]!==l&&c[a-1]!==l?[]:dn(c,l);return(a-=d.length)<n?Ki(t,e,Vi,s.placeholder,i,c,d,i,i,n-a):Re(this&&this!==ge&&this instanceof s?o:t,this,c)}}(t,e,v):e!=u&&33!=e||p.length?Vi.apply(i,S):function(t,e,n,i){var o=1&e,s=Ui(t);return function e(){for(var a=-1,c=arguments.length,u=-1,l=i.length,d=r(l+c),h=this&&this!==ge&&this instanceof e?s:t;++u<l;)d[u]=i[u];for(;c--;)d[u++]=arguments[++a];return Re(h,o?n:this,d)}}(t,e,n,s);else var C=function(t,e,n){var r=1&e,i=Ui(t);return function e(){return(this&&this!==ge&&this instanceof e?i:t).apply(r?n:this,arguments)}}(t,e,n);return xo((E?ei:Po)(C,S),t,e)}function Qi(t,e,n,r){return t===i||Vs(t,Dt[n])&&!jt.call(r,n)?e:t}function to(t,e,n,r,o,s){return ea(t)&&ea(e)&&(s.set(e,t),Wr(t,e,i,to,s),s.delete(e)),t}function eo(t){return oa(t)?i:t}function no(t,e,n,r,o,s){var a=1&n,c=t.length,u=e.length;if(c!=u&&!(a&&u>c))return!1;var l=s.get(t),d=s.get(e);if(l&&d)return l==e&&d==t;var h=-1,p=!0,f=2&n?new Jn:i;for(s.set(t,e),s.set(e,t);++h<c;){var g=t[h],v=e[h];if(r)var m=a?r(v,g,h,e,t,s):r(g,v,h,t,e,s);if(m!==i){if(m)continue;p=!1;break}if(f){if(!Be(e,(function(t,e){if(!en(f,e)&&(g===t||o(g,t,n,r,s)))return f.push(e)}))){p=!1;break}}else if(g!==v&&!o(g,v,n,r,s)){p=!1;break}}return s.delete(t),s.delete(e),p}function ro(t){return Do(Ao(t,i,$o),t+"")}function io(t){return Tr(t,Na,fo)}function oo(t){return Tr(t,Da,go)}var so=Pn?function(t){return Pn.get(t)}:uc;function ao(t){for(var e=t.name+"",n=Nn[e],r=jt.call(Nn,e)?n.length:0;r--;){var i=n[r],o=i.func;if(null==o||o==t)return i.name}return e}function co(t){return(jt.call(Vn,"placeholder")?Vn:t).placeholder}function uo(){var t=Vn.iteratee||oc;return t=t===oc?jr:t,arguments.length?t(arguments[0],arguments[1]):t}function lo(t,e){var n,r,i=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof e?"string":"hash"]:i.map}function ho(t){for(var e=Na(t),n=e.length;n--;){var r=e[n],i=t[r];e[n]=[r,i,Io(i)]}return e}function po(t,e){var n=function(t,e){return null==t?i:t[e]}(t,e);return Mr(n)?n:i}var fo=me?function(t){return null==t?[]:(t=Rt(t),Ne(me(t),(function(e){return Jt.call(t,e)})))}:vc,go=me?function(t){for(var e=[];t;)je(e,fo(t)),t=Ht(t);return e}:vc,vo=Ir;function mo(t,e,n){for(var r=-1,i=(e=bi(e,t)).length,o=!1;++r<i;){var s=Uo(e[r]);if(!(o=null!=t&&n(t,s)))break;t=t[s]}return o||++r!=i?o:!!(i=null==t?0:t.length)&&ta(i)&&bo(s,i)&&(zs(t)||qs(t))}function yo(t){return"function"!=typeof t.constructor||To(t)?{}:Gn(Ht(t))}function _o(t){return zs(t)||qs(t)||!!(Yt&&t&&t[Yt])}function bo(t,e){var n=typeof t;return!!(e=null==e?f:e)&&("number"==n||"symbol"!=n&&bt.test(t))&&t>-1&&t%1==0&&t<e}function Eo(t,e,n){if(!ea(n))return!1;var r=typeof e;return!!("number"==r?Hs(n)&&bo(e,n.length):"string"==r&&e in n)&&Vs(n[e],t)}function So(t,e){if(zs(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!ua(t))||(nt.test(t)||!et.test(t)||null!=e&&t in Rt(e))}function Co(t){var e=ao(t),n=Vn[e];if("function"!=typeof n||!(e in zn.prototype))return!1;if(t===n)return!0;var r=so(n);return!!r&&t===r[0]}(Tn&&vo(new Tn(new ArrayBuffer(1)))!=M||In&&vo(new In)!=T||Rn&&vo(Rn.resolve())!=A||An&&vo(new An)!=O||kn&&vo(new kn)!=D)&&(vo=function(t){var e=Ir(t),n=e==R?t.constructor:i,r=n?Bo(n):"";if(r)switch(r){case Dn:return M;case xn:return T;case Mn:return A;case jn:return O;case Ln:return D}return e});var wo=xt?Zs:mc;function To(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Dt)}function Io(t){return t==t&&!ea(t)}function Ro(t,e){return function(n){return null!=n&&(n[t]===e&&(e!==i||t in Rt(n)))}}function Ao(t,e,n){return e=_n(e===i?t.length-1:e,0),function(){for(var i=arguments,o=-1,s=_n(i.length-e,0),a=r(s);++o<s;)a[o]=i[e+o];o=-1;for(var c=r(e+1);++o<e;)c[o]=i[o];return c[e]=n(a),Re(t,this,c)}}function ko(t,e){return e.length<2?t:wr(t,ii(e,0,-1))}function Oo(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var Po=Mo(ei),No=pe||function(t,e){return ge.setTimeout(t,e)},Do=Mo(ni);function xo(t,e,n){var r=e+"";return Do(t,function(t,e){var n=e.length;if(!n)return t;var r=n-1;return e[r]=(n>1?"& ":"")+e[r],e=e.join(n>2?", ":" "),t.replace(ct,"{\n/* [wrapped with "+e+"] */\n")}(r,function(t,e){return ke(m,(function(n){var r="_."+n[0];e&n[1]&&!De(t,r)&&t.push(r)})),t.sort()}(function(t){var e=t.match(ut);return e?e[1].split(lt):[]}(r),n)))}function Mo(t){var e=0,n=0;return function(){var r=En(),o=16-(r-n);if(n=r,o>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(i,arguments)}}function jo(t,e){var n=-1,r=t.length,o=r-1;for(e=e===i?r:e;++n<e;){var s=Jr(n,o),a=t[s];t[s]=t[n],t[n]=a}return t.length=e,t}var Lo=function(t){var e=Ms(t,(function(t){return 500===n.size&&n.clear(),t})),n=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(rt,(function(t,n,r,i){e.push(r?i.replace(pt,"$1"):n||t)})),e}));function Uo(t){if("string"==typeof t||ua(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function Bo(t){if(null!=t){try{return Mt.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Fo(t){if(t instanceof zn)return t.clone();var e=new qn(t.__wrapped__,t.__chain__);return e.__actions__=Oi(t.__actions__),e.__index__=t.__index__,e.__values__=t.__values__,e}var Vo=Yr((function(t,e){return Ks(t)?hr(t,yr(e,1,Ks,!0)):[]})),Go=Yr((function(t,e){var n=Yo(e);return Ks(n)&&(n=i),Ks(t)?hr(t,yr(e,1,Ks,!0),uo(n,2)):[]})),Wo=Yr((function(t,e){var n=Yo(e);return Ks(n)&&(n=i),Ks(t)?hr(t,yr(e,1,Ks,!0),i,n):[]}));function qo(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:ga(n);return i<0&&(i=_n(r+i,0)),Ge(t,uo(e,3),i)}function zo(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var o=r-1;return n!==i&&(o=ga(n),o=n<0?_n(r+o,0):bn(o,r-1)),Ge(t,uo(e,3),o,!0)}function $o(t){return(null==t?0:t.length)?yr(t,1):[]}function Ho(t){return t&&t.length?t[0]:i}var Ko=Yr((function(t){var e=Me(t,yi);return e.length&&e[0]===t[0]?Or(e):[]})),Jo=Yr((function(t){var e=Yo(t),n=Me(t,yi);return e===Yo(n)?e=i:n.pop(),n.length&&n[0]===t[0]?Or(n,uo(e,2)):[]})),Xo=Yr((function(t){var e=Yo(t),n=Me(t,yi);return(e="function"==typeof e?e:i)&&n.pop(),n.length&&n[0]===t[0]?Or(n,i,e):[]}));function Yo(t){var e=null==t?0:t.length;return e?t[e-1]:i}var Zo=Yr(Qo);function Qo(t,e){return t&&t.length&&e&&e.length?Hr(t,e):t}var ts=ro((function(t,e){var n=null==t?0:t.length,r=ar(t,e);return Kr(t,Me(e,(function(t){return bo(t,n)?+t:t})).sort(Ri)),r}));function es(t){return null==t?t:wn.call(t)}var ns=Yr((function(t){return di(yr(t,1,Ks,!0))})),rs=Yr((function(t){var e=Yo(t);return Ks(e)&&(e=i),di(yr(t,1,Ks,!0),uo(e,2))})),is=Yr((function(t){var e=Yo(t);return e="function"==typeof e?e:i,di(yr(t,1,Ks,!0),i,e)}));function os(t){if(!t||!t.length)return[];var e=0;return t=Ne(t,(function(t){if(Ks(t))return e=_n(t.length,e),!0})),Ye(e,(function(e){return Me(t,He(e))}))}function ss(t,e){if(!t||!t.length)return[];var n=os(t);return null==e?n:Me(n,(function(t){return Re(e,i,t)}))}var as=Yr((function(t,e){return Ks(t)?hr(t,e):[]})),cs=Yr((function(t){return vi(Ne(t,Ks))})),us=Yr((function(t){var e=Yo(t);return Ks(e)&&(e=i),vi(Ne(t,Ks),uo(e,2))})),ls=Yr((function(t){var e=Yo(t);return e="function"==typeof e?e:i,vi(Ne(t,Ks),i,e)})),ds=Yr(os);var hs=Yr((function(t){var e=t.length,n=e>1?t[e-1]:i;return n="function"==typeof n?(t.pop(),n):i,ss(t,n)}));function ps(t){var e=Vn(t);return e.__chain__=!0,e}function fs(t,e){return e(t)}var gs=ro((function(t){var e=t.length,n=e?t[0]:0,r=this.__wrapped__,o=function(e){return ar(e,t)};return!(e>1||this.__actions__.length)&&r instanceof zn&&bo(n)?((r=r.slice(n,+n+(e?1:0))).__actions__.push({func:fs,args:[o],thisArg:i}),new qn(r,this.__chain__).thru((function(t){return e&&!t.length&&t.push(i),t}))):this.thru(o)}));var vs=Ni((function(t,e,n){jt.call(t,n)?++t[n]:sr(t,n,1)}));var ms=Bi(qo),ys=Bi(zo);function _s(t,e){return(zs(t)?ke:pr)(t,uo(e,3))}function bs(t,e){return(zs(t)?Oe:fr)(t,uo(e,3))}var Es=Ni((function(t,e,n){jt.call(t,n)?t[n].push(e):sr(t,n,[e])}));var Ss=Yr((function(t,e,n){var i=-1,o="function"==typeof e,s=Hs(t)?r(t.length):[];return pr(t,(function(t){s[++i]=o?Re(e,t,n):Pr(t,e,n)})),s})),Cs=Ni((function(t,e,n){sr(t,n,e)}));function ws(t,e){return(zs(t)?Me:Fr)(t,uo(e,3))}var Ts=Ni((function(t,e,n){t[n?0:1].push(e)}),(function(){return[[],[]]}));var Is=Yr((function(t,e){if(null==t)return[];var n=e.length;return n>1&&Eo(t,e[0],e[1])?e=[]:n>2&&Eo(e[0],e[1],e[2])&&(e=[e[0]]),zr(t,yr(e,1),[])})),Rs=le||function(){return ge.Date.now()};function As(t,e,n){return e=n?i:e,e=t&&null==e?t.length:e,Zi(t,d,i,i,i,i,e)}function ks(t,e){var n;if("function"!=typeof e)throw new Ot(o);return t=ga(t),function(){return--t>0&&(n=e.apply(this,arguments)),t<=1&&(e=i),n}}var Os=Yr((function(t,e,n){var r=1;if(n.length){var i=dn(n,co(Os));r|=u}return Zi(t,r,e,n,i)})),Ps=Yr((function(t,e,n){var r=3;if(n.length){var i=dn(n,co(Ps));r|=u}return Zi(e,r,t,n,i)}));function Ns(t,e,n){var r,s,a,c,u,l,d=0,h=!1,p=!1,f=!0;if("function"!=typeof t)throw new Ot(o);function g(e){var n=r,o=s;return r=s=i,d=e,c=t.apply(o,n)}function v(t){var n=t-l;return l===i||n>=e||n<0||p&&t-d>=a}function m(){var t=Rs();if(v(t))return y(t);u=No(m,function(t){var n=e-(t-l);return p?bn(n,a-(t-d)):n}(t))}function y(t){return u=i,f&&r?g(t):(r=s=i,c)}function _(){var t=Rs(),n=v(t);if(r=arguments,s=this,l=t,n){if(u===i)return function(t){return d=t,u=No(m,e),h?g(t):c}(l);if(p)return Ci(u),u=No(m,e),g(l)}return u===i&&(u=No(m,e)),c}return e=ma(e)||0,ea(n)&&(h=!!n.leading,a=(p="maxWait"in n)?_n(ma(n.maxWait)||0,e):a,f="trailing"in n?!!n.trailing:f),_.cancel=function(){u!==i&&Ci(u),d=0,r=l=s=u=i},_.flush=function(){return u===i?c:y(Rs())},_}var Ds=Yr((function(t,e){return dr(t,1,e)})),xs=Yr((function(t,e,n){return dr(t,ma(e)||0,n)}));function Ms(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new Ot(o);var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=t.apply(this,r);return n.cache=o.set(i,s)||o,s};return n.cache=new(Ms.Cache||Kn),n}function js(t){if("function"!=typeof t)throw new Ot(o);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}Ms.Cache=Kn;var Ls=Ei((function(t,e){var n=(e=1==e.length&&zs(e[0])?Me(e[0],Qe(uo())):Me(yr(e,1),Qe(uo()))).length;return Yr((function(r){for(var i=-1,o=bn(r.length,n);++i<o;)r[i]=e[i].call(this,r[i]);return Re(t,this,r)}))})),Us=Yr((function(t,e){var n=dn(e,co(Us));return Zi(t,u,i,e,n)})),Bs=Yr((function(t,e){var n=dn(e,co(Bs));return Zi(t,l,i,e,n)})),Fs=ro((function(t,e){return Zi(t,h,i,i,i,e)}));function Vs(t,e){return t===e||t!=t&&e!=e}var Gs=Hi(Rr),Ws=Hi((function(t,e){return t>=e})),qs=Nr(function(){return arguments}())?Nr:function(t){return na(t)&&jt.call(t,"callee")&&!Jt.call(t,"callee")},zs=r.isArray,$s=Ee?Qe(Ee):function(t){return na(t)&&Ir(t)==x};function Hs(t){return null!=t&&ta(t.length)&&!Zs(t)}function Ks(t){return na(t)&&Hs(t)}var Js=_e||mc,Xs=Se?Qe(Se):function(t){return na(t)&&Ir(t)==E};function Ys(t){if(!na(t))return!1;var e=Ir(t);return e==S||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!oa(t)}function Zs(t){if(!ea(t))return!1;var e=Ir(t);return e==C||e==w||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Qs(t){return"number"==typeof t&&t==ga(t)}function ta(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=f}function ea(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function na(t){return null!=t&&"object"==typeof t}var ra=Ce?Qe(Ce):function(t){return na(t)&&vo(t)==T};function ia(t){return"number"==typeof t||na(t)&&Ir(t)==I}function oa(t){if(!na(t)||Ir(t)!=R)return!1;var e=Ht(t);if(null===e)return!0;var n=jt.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Mt.call(n)==Ft}var sa=we?Qe(we):function(t){return na(t)&&Ir(t)==k};var aa=Te?Qe(Te):function(t){return na(t)&&vo(t)==O};function ca(t){return"string"==typeof t||!zs(t)&&na(t)&&Ir(t)==P}function ua(t){return"symbol"==typeof t||na(t)&&Ir(t)==N}var la=Ie?Qe(Ie):function(t){return na(t)&&ta(t.length)&&!!ce[Ir(t)]};var da=Hi(Br),ha=Hi((function(t,e){return t<=e}));function pa(t){if(!t)return[];if(Hs(t))return ca(t)?gn(t):Oi(t);if(Zt&&t[Zt])return function(t){for(var e,n=[];!(e=t.next()).done;)n.push(e.value);return n}(t[Zt]());var e=vo(t);return(e==T?un:e==O?hn:Va)(t)}function fa(t){return t?(t=ma(t))===p||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function ga(t){var e=fa(t),n=e%1;return e==e?n?e-n:e:0}function va(t){return t?cr(ga(t),0,v):0}function ma(t){if("number"==typeof t)return t;if(ua(t))return g;if(ea(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=ea(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=Ze(t);var n=mt.test(t);return n||_t.test(t)?he(t.slice(2),n?2:8):vt.test(t)?g:+t}function ya(t){return Pi(t,Da(t))}function _a(t){return null==t?"":li(t)}var ba=Di((function(t,e){if(To(e)||Hs(e))Pi(e,Na(e),t);else for(var n in e)jt.call(e,n)&&nr(t,n,e[n])})),Ea=Di((function(t,e){Pi(e,Da(e),t)})),Sa=Di((function(t,e,n,r){Pi(e,Da(e),t,r)})),Ca=Di((function(t,e,n,r){Pi(e,Na(e),t,r)})),wa=ro(ar);var Ta=Yr((function(t,e){t=Rt(t);var n=-1,r=e.length,o=r>2?e[2]:i;for(o&&Eo(e[0],e[1],o)&&(r=1);++n<r;)for(var s=e[n],a=Da(s),c=-1,u=a.length;++c<u;){var l=a[c],d=t[l];(d===i||Vs(d,Dt[l])&&!jt.call(t,l))&&(t[l]=s[l])}return t})),Ia=Yr((function(t){return t.push(i,to),Re(Ma,i,t)}));function Ra(t,e,n){var r=null==t?i:wr(t,e);return r===i?n:r}function Aa(t,e){return null!=t&&mo(t,e,kr)}var ka=Gi((function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=Bt.call(e)),t[e]=n}),ec(ic)),Oa=Gi((function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=Bt.call(e)),jt.call(t,e)?t[e].push(n):t[e]=[n]}),uo),Pa=Yr(Pr);function Na(t){return Hs(t)?Yn(t):Lr(t)}function Da(t){return Hs(t)?Yn(t,!0):Ur(t)}var xa=Di((function(t,e,n){Wr(t,e,n)})),Ma=Di((function(t,e,n,r){Wr(t,e,n,r)})),ja=ro((function(t,e){var n={};if(null==t)return n;var r=!1;e=Me(e,(function(e){return e=bi(e,t),r||(r=e.length>1),e})),Pi(t,oo(t),n),r&&(n=ur(n,7,eo));for(var i=e.length;i--;)hi(n,e[i]);return n}));var La=ro((function(t,e){return null==t?{}:function(t,e){return $r(t,e,(function(e,n){return Aa(t,n)}))}(t,e)}));function Ua(t,e){if(null==t)return{};var n=Me(oo(t),(function(t){return[t]}));return e=uo(e),$r(t,n,(function(t,n){return e(t,n[0])}))}var Ba=Yi(Na),Fa=Yi(Da);function Va(t){return null==t?[]:tn(t,Na(t))}var Ga=Li((function(t,e,n){return e=e.toLowerCase(),t+(n?Wa(e):e)}));function Wa(t){return Ya(_a(t).toLowerCase())}function qa(t){return(t=_a(t))&&t.replace(Et,on).replace(ee,"")}var za=Li((function(t,e,n){return t+(n?"-":"")+e.toLowerCase()})),$a=Li((function(t,e,n){return t+(n?" ":"")+e.toLowerCase()})),Ha=ji("toLowerCase");var Ka=Li((function(t,e,n){return t+(n?"_":"")+e.toLowerCase()}));var Ja=Li((function(t,e,n){return t+(n?" ":"")+Ya(e)}));var Xa=Li((function(t,e,n){return t+(n?" ":"")+e.toUpperCase()})),Ya=ji("toUpperCase");function Za(t,e,n){return t=_a(t),(e=n?i:e)===i?function(t){return oe.test(t)}(t)?function(t){return t.match(re)||[]}(t):function(t){return t.match(dt)||[]}(t):t.match(e)||[]}var Qa=Yr((function(t,e){try{return Re(t,i,e)}catch(t){return Ys(t)?t:new wt(t)}})),tc=ro((function(t,e){return ke(e,(function(e){e=Uo(e),sr(t,e,Os(t[e],t))})),t}));function ec(t){return function(){return t}}var nc=Fi(),rc=Fi(!0);function ic(t){return t}function oc(t){return jr("function"==typeof t?t:ur(t,1))}var sc=Yr((function(t,e){return function(n){return Pr(n,t,e)}})),ac=Yr((function(t,e){return function(n){return Pr(t,n,e)}}));function cc(t,e,n){var r=Na(e),i=Cr(e,r);null!=n||ea(e)&&(i.length||!r.length)||(n=e,e=t,t=this,i=Cr(e,Na(e)));var o=!(ea(n)&&"chain"in n&&!n.chain),s=Zs(t);return ke(i,(function(n){var r=e[n];t[n]=r,s&&(t.prototype[n]=function(){var e=this.__chain__;if(o||e){var n=t(this.__wrapped__);return(n.__actions__=Oi(this.__actions__)).push({func:r,args:arguments,thisArg:t}),n.__chain__=e,n}return r.apply(t,je([this.value()],arguments))})})),t}function uc(){}var lc=qi(Me),dc=qi(Pe),hc=qi(Be);function pc(t){return So(t)?He(Uo(t)):function(t){return function(e){return wr(e,t)}}(t)}var fc=$i(),gc=$i(!0);function vc(){return[]}function mc(){return!1}var yc=Wi((function(t,e){return t+e}),0),_c=Ji("ceil"),bc=Wi((function(t,e){return t/e}),1),Ec=Ji("floor");var Sc,Cc=Wi((function(t,e){return t*e}),1),wc=Ji("round"),Tc=Wi((function(t,e){return t-e}),0);return Vn.after=function(t,e){if("function"!=typeof e)throw new Ot(o);return t=ga(t),function(){if(--t<1)return e.apply(this,arguments)}},Vn.ary=As,Vn.assign=ba,Vn.assignIn=Ea,Vn.assignInWith=Sa,Vn.assignWith=Ca,Vn.at=wa,Vn.before=ks,Vn.bind=Os,Vn.bindAll=tc,Vn.bindKey=Ps,Vn.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return zs(t)?t:[t]},Vn.chain=ps,Vn.chunk=function(t,e,n){e=(n?Eo(t,e,n):e===i)?1:_n(ga(e),0);var o=null==t?0:t.length;if(!o||e<1)return[];for(var s=0,a=0,c=r(fe(o/e));s<o;)c[a++]=ii(t,s,s+=e);return c},Vn.compact=function(t){for(var e=-1,n=null==t?0:t.length,r=0,i=[];++e<n;){var o=t[e];o&&(i[r++]=o)}return i},Vn.concat=function(){var t=arguments.length;if(!t)return[];for(var e=r(t-1),n=arguments[0],i=t;i--;)e[i-1]=arguments[i];return je(zs(n)?Oi(n):[n],yr(e,1))},Vn.cond=function(t){var e=null==t?0:t.length,n=uo();return t=e?Me(t,(function(t){if("function"!=typeof t[1])throw new Ot(o);return[n(t[0]),t[1]]})):[],Yr((function(n){for(var r=-1;++r<e;){var i=t[r];if(Re(i[0],this,n))return Re(i[1],this,n)}}))},Vn.conforms=function(t){return function(t){var e=Na(t);return function(n){return lr(n,t,e)}}(ur(t,1))},Vn.constant=ec,Vn.countBy=vs,Vn.create=function(t,e){var n=Gn(t);return null==e?n:or(n,e)},Vn.curry=function t(e,n,r){var o=Zi(e,8,i,i,i,i,i,n=r?i:n);return o.placeholder=t.placeholder,o},Vn.curryRight=function t(e,n,r){var o=Zi(e,c,i,i,i,i,i,n=r?i:n);return o.placeholder=t.placeholder,o},Vn.debounce=Ns,Vn.defaults=Ta,Vn.defaultsDeep=Ia,Vn.defer=Ds,Vn.delay=xs,Vn.difference=Vo,Vn.differenceBy=Go,Vn.differenceWith=Wo,Vn.drop=function(t,e,n){var r=null==t?0:t.length;return r?ii(t,(e=n||e===i?1:ga(e))<0?0:e,r):[]},Vn.dropRight=function(t,e,n){var r=null==t?0:t.length;return r?ii(t,0,(e=r-(e=n||e===i?1:ga(e)))<0?0:e):[]},Vn.dropRightWhile=function(t,e){return t&&t.length?fi(t,uo(e,3),!0,!0):[]},Vn.dropWhile=function(t,e){return t&&t.length?fi(t,uo(e,3),!0):[]},Vn.fill=function(t,e,n,r){var o=null==t?0:t.length;return o?(n&&"number"!=typeof n&&Eo(t,e,n)&&(n=0,r=o),function(t,e,n,r){var o=t.length;for((n=ga(n))<0&&(n=-n>o?0:o+n),(r=r===i||r>o?o:ga(r))<0&&(r+=o),r=n>r?0:va(r);n<r;)t[n++]=e;return t}(t,e,n,r)):[]},Vn.filter=function(t,e){return(zs(t)?Ne:mr)(t,uo(e,3))},Vn.flatMap=function(t,e){return yr(ws(t,e),1)},Vn.flatMapDeep=function(t,e){return yr(ws(t,e),p)},Vn.flatMapDepth=function(t,e,n){return n=n===i?1:ga(n),yr(ws(t,e),n)},Vn.flatten=$o,Vn.flattenDeep=function(t){return(null==t?0:t.length)?yr(t,p):[]},Vn.flattenDepth=function(t,e){return(null==t?0:t.length)?yr(t,e=e===i?1:ga(e)):[]},Vn.flip=function(t){return Zi(t,512)},Vn.flow=nc,Vn.flowRight=rc,Vn.fromPairs=function(t){for(var e=-1,n=null==t?0:t.length,r={};++e<n;){var i=t[e];r[i[0]]=i[1]}return r},Vn.functions=function(t){return null==t?[]:Cr(t,Na(t))},Vn.functionsIn=function(t){return null==t?[]:Cr(t,Da(t))},Vn.groupBy=Es,Vn.initial=function(t){return(null==t?0:t.length)?ii(t,0,-1):[]},Vn.intersection=Ko,Vn.intersectionBy=Jo,Vn.intersectionWith=Xo,Vn.invert=ka,Vn.invertBy=Oa,Vn.invokeMap=Ss,Vn.iteratee=oc,Vn.keyBy=Cs,Vn.keys=Na,Vn.keysIn=Da,Vn.map=ws,Vn.mapKeys=function(t,e){var n={};return e=uo(e,3),Er(t,(function(t,r,i){sr(n,e(t,r,i),t)})),n},Vn.mapValues=function(t,e){var n={};return e=uo(e,3),Er(t,(function(t,r,i){sr(n,r,e(t,r,i))})),n},Vn.matches=function(t){return Vr(ur(t,1))},Vn.matchesProperty=function(t,e){return Gr(t,ur(e,1))},Vn.memoize=Ms,Vn.merge=xa,Vn.mergeWith=Ma,Vn.method=sc,Vn.methodOf=ac,Vn.mixin=cc,Vn.negate=js,Vn.nthArg=function(t){return t=ga(t),Yr((function(e){return qr(e,t)}))},Vn.omit=ja,Vn.omitBy=function(t,e){return Ua(t,js(uo(e)))},Vn.once=function(t){return ks(2,t)},Vn.orderBy=function(t,e,n,r){return null==t?[]:(zs(e)||(e=null==e?[]:[e]),zs(n=r?i:n)||(n=null==n?[]:[n]),zr(t,e,n))},Vn.over=lc,Vn.overArgs=Ls,Vn.overEvery=dc,Vn.overSome=hc,Vn.partial=Us,Vn.partialRight=Bs,Vn.partition=Ts,Vn.pick=La,Vn.pickBy=Ua,Vn.property=pc,Vn.propertyOf=function(t){return function(e){return null==t?i:wr(t,e)}},Vn.pull=Zo,Vn.pullAll=Qo,Vn.pullAllBy=function(t,e,n){return t&&t.length&&e&&e.length?Hr(t,e,uo(n,2)):t},Vn.pullAllWith=function(t,e,n){return t&&t.length&&e&&e.length?Hr(t,e,i,n):t},Vn.pullAt=ts,Vn.range=fc,Vn.rangeRight=gc,Vn.rearg=Fs,Vn.reject=function(t,e){return(zs(t)?Ne:mr)(t,js(uo(e,3)))},Vn.remove=function(t,e){var n=[];if(!t||!t.length)return n;var r=-1,i=[],o=t.length;for(e=uo(e,3);++r<o;){var s=t[r];e(s,r,t)&&(n.push(s),i.push(r))}return Kr(t,i),n},Vn.rest=function(t,e){if("function"!=typeof t)throw new Ot(o);return Yr(t,e=e===i?e:ga(e))},Vn.reverse=es,Vn.sampleSize=function(t,e,n){return e=(n?Eo(t,e,n):e===i)?1:ga(e),(zs(t)?Qn:Qr)(t,e)},Vn.set=function(t,e,n){return null==t?t:ti(t,e,n)},Vn.setWith=function(t,e,n,r){return r="function"==typeof r?r:i,null==t?t:ti(t,e,n,r)},Vn.shuffle=function(t){return(zs(t)?tr:ri)(t)},Vn.slice=function(t,e,n){var r=null==t?0:t.length;return r?(n&&"number"!=typeof n&&Eo(t,e,n)?(e=0,n=r):(e=null==e?0:ga(e),n=n===i?r:ga(n)),ii(t,e,n)):[]},Vn.sortBy=Is,Vn.sortedUniq=function(t){return t&&t.length?ci(t):[]},Vn.sortedUniqBy=function(t,e){return t&&t.length?ci(t,uo(e,2)):[]},Vn.split=function(t,e,n){return n&&"number"!=typeof n&&Eo(t,e,n)&&(e=n=i),(n=n===i?v:n>>>0)?(t=_a(t))&&("string"==typeof e||null!=e&&!sa(e))&&!(e=li(e))&&cn(t)?Si(gn(t),0,n):t.split(e,n):[]},Vn.spread=function(t,e){if("function"!=typeof t)throw new Ot(o);return e=null==e?0:_n(ga(e),0),Yr((function(n){var r=n[e],i=Si(n,0,e);return r&&je(i,r),Re(t,this,i)}))},Vn.tail=function(t){var e=null==t?0:t.length;return e?ii(t,1,e):[]},Vn.take=function(t,e,n){return t&&t.length?ii(t,0,(e=n||e===i?1:ga(e))<0?0:e):[]},Vn.takeRight=function(t,e,n){var r=null==t?0:t.length;return r?ii(t,(e=r-(e=n||e===i?1:ga(e)))<0?0:e,r):[]},Vn.takeRightWhile=function(t,e){return t&&t.length?fi(t,uo(e,3),!1,!0):[]},Vn.takeWhile=function(t,e){return t&&t.length?fi(t,uo(e,3)):[]},Vn.tap=function(t,e){return e(t),t},Vn.throttle=function(t,e,n){var r=!0,i=!0;if("function"!=typeof t)throw new Ot(o);return ea(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ns(t,e,{leading:r,maxWait:e,trailing:i})},Vn.thru=fs,Vn.toArray=pa,Vn.toPairs=Ba,Vn.toPairsIn=Fa,Vn.toPath=function(t){return zs(t)?Me(t,Uo):ua(t)?[t]:Oi(Lo(_a(t)))},Vn.toPlainObject=ya,Vn.transform=function(t,e,n){var r=zs(t),i=r||Js(t)||la(t);if(e=uo(e,4),null==n){var o=t&&t.constructor;n=i?r?new o:[]:ea(t)&&Zs(o)?Gn(Ht(t)):{}}return(i?ke:Er)(t,(function(t,r,i){return e(n,t,r,i)})),n},Vn.unary=function(t){return As(t,1)},Vn.union=ns,Vn.unionBy=rs,Vn.unionWith=is,Vn.uniq=function(t){return t&&t.length?di(t):[]},Vn.uniqBy=function(t,e){return t&&t.length?di(t,uo(e,2)):[]},Vn.uniqWith=function(t,e){return e="function"==typeof e?e:i,t&&t.length?di(t,i,e):[]},Vn.unset=function(t,e){return null==t||hi(t,e)},Vn.unzip=os,Vn.unzipWith=ss,Vn.update=function(t,e,n){return null==t?t:pi(t,e,_i(n))},Vn.updateWith=function(t,e,n,r){return r="function"==typeof r?r:i,null==t?t:pi(t,e,_i(n),r)},Vn.values=Va,Vn.valuesIn=function(t){return null==t?[]:tn(t,Da(t))},Vn.without=as,Vn.words=Za,Vn.wrap=function(t,e){return Us(_i(e),t)},Vn.xor=cs,Vn.xorBy=us,Vn.xorWith=ls,Vn.zip=ds,Vn.zipObject=function(t,e){return mi(t||[],e||[],nr)},Vn.zipObjectDeep=function(t,e){return mi(t||[],e||[],ti)},Vn.zipWith=hs,Vn.entries=Ba,Vn.entriesIn=Fa,Vn.extend=Ea,Vn.extendWith=Sa,cc(Vn,Vn),Vn.add=yc,Vn.attempt=Qa,Vn.camelCase=Ga,Vn.capitalize=Wa,Vn.ceil=_c,Vn.clamp=function(t,e,n){return n===i&&(n=e,e=i),n!==i&&(n=(n=ma(n))==n?n:0),e!==i&&(e=(e=ma(e))==e?e:0),cr(ma(t),e,n)},Vn.clone=function(t){return ur(t,4)},Vn.cloneDeep=function(t){return ur(t,5)},Vn.cloneDeepWith=function(t,e){return ur(t,5,e="function"==typeof e?e:i)},Vn.cloneWith=function(t,e){return ur(t,4,e="function"==typeof e?e:i)},Vn.conformsTo=function(t,e){return null==e||lr(t,e,Na(e))},Vn.deburr=qa,Vn.defaultTo=function(t,e){return null==t||t!=t?e:t},Vn.divide=bc,Vn.endsWith=function(t,e,n){t=_a(t),e=li(e);var r=t.length,o=n=n===i?r:cr(ga(n),0,r);return(n-=e.length)>=0&&t.slice(n,o)==e},Vn.eq=Vs,Vn.escape=function(t){return(t=_a(t))&&Y.test(t)?t.replace(J,sn):t},Vn.escapeRegExp=function(t){return(t=_a(t))&&ot.test(t)?t.replace(it,"\\$&"):t},Vn.every=function(t,e,n){var r=zs(t)?Pe:gr;return n&&Eo(t,e,n)&&(e=i),r(t,uo(e,3))},Vn.find=ms,Vn.findIndex=qo,Vn.findKey=function(t,e){return Ve(t,uo(e,3),Er)},Vn.findLast=ys,Vn.findLastIndex=zo,Vn.findLastKey=function(t,e){return Ve(t,uo(e,3),Sr)},Vn.floor=Ec,Vn.forEach=_s,Vn.forEachRight=bs,Vn.forIn=function(t,e){return null==t?t:_r(t,uo(e,3),Da)},Vn.forInRight=function(t,e){return null==t?t:br(t,uo(e,3),Da)},Vn.forOwn=function(t,e){return t&&Er(t,uo(e,3))},Vn.forOwnRight=function(t,e){return t&&Sr(t,uo(e,3))},Vn.get=Ra,Vn.gt=Gs,Vn.gte=Ws,Vn.has=function(t,e){return null!=t&&mo(t,e,Ar)},Vn.hasIn=Aa,Vn.head=Ho,Vn.identity=ic,Vn.includes=function(t,e,n,r){t=Hs(t)?t:Va(t),n=n&&!r?ga(n):0;var i=t.length;return n<0&&(n=_n(i+n,0)),ca(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&We(t,e,n)>-1},Vn.indexOf=function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:ga(n);return i<0&&(i=_n(r+i,0)),We(t,e,i)},Vn.inRange=function(t,e,n){return e=fa(e),n===i?(n=e,e=0):n=fa(n),function(t,e,n){return t>=bn(e,n)&&t<_n(e,n)}(t=ma(t),e,n)},Vn.invoke=Pa,Vn.isArguments=qs,Vn.isArray=zs,Vn.isArrayBuffer=$s,Vn.isArrayLike=Hs,Vn.isArrayLikeObject=Ks,Vn.isBoolean=function(t){return!0===t||!1===t||na(t)&&Ir(t)==b},Vn.isBuffer=Js,Vn.isDate=Xs,Vn.isElement=function(t){return na(t)&&1===t.nodeType&&!oa(t)},Vn.isEmpty=function(t){if(null==t)return!0;if(Hs(t)&&(zs(t)||"string"==typeof t||"function"==typeof t.splice||Js(t)||la(t)||qs(t)))return!t.length;var e=vo(t);if(e==T||e==O)return!t.size;if(To(t))return!Lr(t).length;for(var n in t)if(jt.call(t,n))return!1;return!0},Vn.isEqual=function(t,e){return Dr(t,e)},Vn.isEqualWith=function(t,e,n){var r=(n="function"==typeof n?n:i)?n(t,e):i;return r===i?Dr(t,e,i,n):!!r},Vn.isError=Ys,Vn.isFinite=function(t){return"number"==typeof t&&be(t)},Vn.isFunction=Zs,Vn.isInteger=Qs,Vn.isLength=ta,Vn.isMap=ra,Vn.isMatch=function(t,e){return t===e||xr(t,e,ho(e))},Vn.isMatchWith=function(t,e,n){return n="function"==typeof n?n:i,xr(t,e,ho(e),n)},Vn.isNaN=function(t){return ia(t)&&t!=+t},Vn.isNative=function(t){if(wo(t))throw new wt("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Mr(t)},Vn.isNil=function(t){return null==t},Vn.isNull=function(t){return null===t},Vn.isNumber=ia,Vn.isObject=ea,Vn.isObjectLike=na,Vn.isPlainObject=oa,Vn.isRegExp=sa,Vn.isSafeInteger=function(t){return Qs(t)&&t>=-9007199254740991&&t<=f},Vn.isSet=aa,Vn.isString=ca,Vn.isSymbol=ua,Vn.isTypedArray=la,Vn.isUndefined=function(t){return t===i},Vn.isWeakMap=function(t){return na(t)&&vo(t)==D},Vn.isWeakSet=function(t){return na(t)&&"[object WeakSet]"==Ir(t)},Vn.join=function(t,e){return null==t?"":Fe.call(t,e)},Vn.kebabCase=za,Vn.last=Yo,Vn.lastIndexOf=function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=ga(n))<0?_n(r+o,0):bn(o,r-1)),e==e?function(t,e,n){for(var r=n+1;r--;)if(t[r]===e)return r;return r}(t,e,o):Ge(t,ze,o,!0)},Vn.lowerCase=$a,Vn.lowerFirst=Ha,Vn.lt=da,Vn.lte=ha,Vn.max=function(t){return t&&t.length?vr(t,ic,Rr):i},Vn.maxBy=function(t,e){return t&&t.length?vr(t,uo(e,2),Rr):i},Vn.mean=function(t){return $e(t,ic)},Vn.meanBy=function(t,e){return $e(t,uo(e,2))},Vn.min=function(t){return t&&t.length?vr(t,ic,Br):i},Vn.minBy=function(t,e){return t&&t.length?vr(t,uo(e,2),Br):i},Vn.stubArray=vc,Vn.stubFalse=mc,Vn.stubObject=function(){return{}},Vn.stubString=function(){return""},Vn.stubTrue=function(){return!0},Vn.multiply=Cc,Vn.nth=function(t,e){return t&&t.length?qr(t,ga(e)):i},Vn.noConflict=function(){return ge._===this&&(ge._=Vt),this},Vn.noop=uc,Vn.now=Rs,Vn.pad=function(t,e,n){t=_a(t);var r=(e=ga(e))?fn(t):0;if(!e||r>=e)return t;var i=(e-r)/2;return zi(ve(i),n)+t+zi(fe(i),n)},Vn.padEnd=function(t,e,n){t=_a(t);var r=(e=ga(e))?fn(t):0;return e&&r<e?t+zi(e-r,n):t},Vn.padStart=function(t,e,n){t=_a(t);var r=(e=ga(e))?fn(t):0;return e&&r<e?zi(e-r,n)+t:t},Vn.parseInt=function(t,e,n){return n||null==e?e=0:e&&(e=+e),Sn(_a(t).replace(st,""),e||0)},Vn.random=function(t,e,n){if(n&&"boolean"!=typeof n&&Eo(t,e,n)&&(e=n=i),n===i&&("boolean"==typeof e?(n=e,e=i):"boolean"==typeof t&&(n=t,t=i)),t===i&&e===i?(t=0,e=1):(t=fa(t),e===i?(e=t,t=0):e=fa(e)),t>e){var r=t;t=e,e=r}if(n||t%1||e%1){var o=Cn();return bn(t+o*(e-t+de("1e-"+((o+"").length-1))),e)}return Jr(t,e)},Vn.reduce=function(t,e,n){var r=zs(t)?Le:Je,i=arguments.length<3;return r(t,uo(e,4),n,i,pr)},Vn.reduceRight=function(t,e,n){var r=zs(t)?Ue:Je,i=arguments.length<3;return r(t,uo(e,4),n,i,fr)},Vn.repeat=function(t,e,n){return e=(n?Eo(t,e,n):e===i)?1:ga(e),Xr(_a(t),e)},Vn.replace=function(){var t=arguments,e=_a(t[0]);return t.length<3?e:e.replace(t[1],t[2])},Vn.result=function(t,e,n){var r=-1,o=(e=bi(e,t)).length;for(o||(o=1,t=i);++r<o;){var s=null==t?i:t[Uo(e[r])];s===i&&(r=o,s=n),t=Zs(s)?s.call(t):s}return t},Vn.round=wc,Vn.runInContext=t,Vn.sample=function(t){return(zs(t)?Zn:Zr)(t)},Vn.size=function(t){if(null==t)return 0;if(Hs(t))return ca(t)?fn(t):t.length;var e=vo(t);return e==T||e==O?t.size:Lr(t).length},Vn.snakeCase=Ka,Vn.some=function(t,e,n){var r=zs(t)?Be:oi;return n&&Eo(t,e,n)&&(e=i),r(t,uo(e,3))},Vn.sortedIndex=function(t,e){return si(t,e)},Vn.sortedIndexBy=function(t,e,n){return ai(t,e,uo(n,2))},Vn.sortedIndexOf=function(t,e){var n=null==t?0:t.length;if(n){var r=si(t,e);if(r<n&&Vs(t[r],e))return r}return-1},Vn.sortedLastIndex=function(t,e){return si(t,e,!0)},Vn.sortedLastIndexBy=function(t,e,n){return ai(t,e,uo(n,2),!0)},Vn.sortedLastIndexOf=function(t,e){if(null==t?0:t.length){var n=si(t,e,!0)-1;if(Vs(t[n],e))return n}return-1},Vn.startCase=Ja,Vn.startsWith=function(t,e,n){return t=_a(t),n=null==n?0:cr(ga(n),0,t.length),e=li(e),t.slice(n,n+e.length)==e},Vn.subtract=Tc,Vn.sum=function(t){return t&&t.length?Xe(t,ic):0},Vn.sumBy=function(t,e){return t&&t.length?Xe(t,uo(e,2)):0},Vn.template=function(t,e,n){var r=Vn.templateSettings;n&&Eo(t,e,n)&&(e=i),t=_a(t),e=Sa({},e,r,Qi);var o,s,a=Sa({},e.imports,r.imports,Qi),c=Na(a),u=tn(a,c),l=0,d=e.interpolate||St,h="__p += '",p=At((e.escape||St).source+"|"+d.source+"|"+(d===tt?ft:St).source+"|"+(e.evaluate||St).source+"|$","g"),f="//# sourceURL="+(jt.call(e,"sourceURL")?(e.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++ae+"]")+"\n";t.replace(p,(function(e,n,r,i,a,c){return r||(r=i),h+=t.slice(l,c).replace(Ct,an),n&&(o=!0,h+="' +\n__e("+n+") +\n'"),a&&(s=!0,h+="';\n"+a+";\n__p += '"),r&&(h+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),l=c+e.length,e})),h+="';\n";var g=jt.call(e,"variable")&&e.variable;if(g){if(ht.test(g))throw new wt("Invalid `variable` option passed into `_.template`")}else h="with (obj) {\n"+h+"\n}\n";h=(s?h.replace(z,""):h).replace($,"$1").replace(H,"$1;"),h="function("+(g||"obj")+") {\n"+(g?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(s?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+h+"return __p\n}";var v=Qa((function(){return Tt(c,f+"return "+h).apply(i,u)}));if(v.source=h,Ys(v))throw v;return v},Vn.times=function(t,e){if((t=ga(t))<1||t>f)return[];var n=v,r=bn(t,v);e=uo(e),t-=v;for(var i=Ye(r,e);++n<t;)e(n);return i},Vn.toFinite=fa,Vn.toInteger=ga,Vn.toLength=va,Vn.toLower=function(t){return _a(t).toLowerCase()},Vn.toNumber=ma,Vn.toSafeInteger=function(t){return t?cr(ga(t),-9007199254740991,f):0===t?t:0},Vn.toString=_a,Vn.toUpper=function(t){return _a(t).toUpperCase()},Vn.trim=function(t,e,n){if((t=_a(t))&&(n||e===i))return Ze(t);if(!t||!(e=li(e)))return t;var r=gn(t),o=gn(e);return Si(r,nn(r,o),rn(r,o)+1).join("")},Vn.trimEnd=function(t,e,n){if((t=_a(t))&&(n||e===i))return t.slice(0,vn(t)+1);if(!t||!(e=li(e)))return t;var r=gn(t);return Si(r,0,rn(r,gn(e))+1).join("")},Vn.trimStart=function(t,e,n){if((t=_a(t))&&(n||e===i))return t.replace(st,"");if(!t||!(e=li(e)))return t;var r=gn(t);return Si(r,nn(r,gn(e))).join("")},Vn.truncate=function(t,e){var n=30,r="...";if(ea(e)){var o="separator"in e?e.separator:o;n="length"in e?ga(e.length):n,r="omission"in e?li(e.omission):r}var s=(t=_a(t)).length;if(cn(t)){var a=gn(t);s=a.length}if(n>=s)return t;var c=n-fn(r);if(c<1)return r;var u=a?Si(a,0,c).join(""):t.slice(0,c);if(o===i)return u+r;if(a&&(c+=u.length-c),sa(o)){if(t.slice(c).search(o)){var l,d=u;for(o.global||(o=At(o.source,_a(gt.exec(o))+"g")),o.lastIndex=0;l=o.exec(d);)var h=l.index;u=u.slice(0,h===i?c:h)}}else if(t.indexOf(li(o),c)!=c){var p=u.lastIndexOf(o);p>-1&&(u=u.slice(0,p))}return u+r},Vn.unescape=function(t){return(t=_a(t))&&X.test(t)?t.replace(K,mn):t},Vn.uniqueId=function(t){var e=++Lt;return _a(t)+e},Vn.upperCase=Xa,Vn.upperFirst=Ya,Vn.each=_s,Vn.eachRight=bs,Vn.first=Ho,cc(Vn,(Sc={},Er(Vn,(function(t,e){jt.call(Vn.prototype,e)||(Sc[e]=t)})),Sc),{chain:!1}),Vn.VERSION="4.17.21",ke(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){Vn[t].placeholder=Vn})),ke(["drop","take"],(function(t,e){zn.prototype[t]=function(n){n=n===i?1:_n(ga(n),0);var r=this.__filtered__&&!e?new zn(this):this.clone();return r.__filtered__?r.__takeCount__=bn(n,r.__takeCount__):r.__views__.push({size:bn(n,v),type:t+(r.__dir__<0?"Right":"")}),r},zn.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}})),ke(["filter","map","takeWhile"],(function(t,e){var n=e+1,r=1==n||3==n;zn.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:uo(t,3),type:n}),e.__filtered__=e.__filtered__||r,e}})),ke(["head","last"],(function(t,e){var n="take"+(e?"Right":"");zn.prototype[t]=function(){return this[n](1).value()[0]}})),ke(["initial","tail"],(function(t,e){var n="drop"+(e?"":"Right");zn.prototype[t]=function(){return this.__filtered__?new zn(this):this[n](1)}})),zn.prototype.compact=function(){return this.filter(ic)},zn.prototype.find=function(t){return this.filter(t).head()},zn.prototype.findLast=function(t){return this.reverse().find(t)},zn.prototype.invokeMap=Yr((function(t,e){return"function"==typeof t?new zn(this):this.map((function(n){return Pr(n,t,e)}))})),zn.prototype.reject=function(t){return this.filter(js(uo(t)))},zn.prototype.slice=function(t,e){t=ga(t);var n=this;return n.__filtered__&&(t>0||e<0)?new zn(n):(t<0?n=n.takeRight(-t):t&&(n=n.drop(t)),e!==i&&(n=(e=ga(e))<0?n.dropRight(-e):n.take(e-t)),n)},zn.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},zn.prototype.toArray=function(){return this.take(v)},Er(zn.prototype,(function(t,e){var n=/^(?:filter|find|map|reject)|While$/.test(e),r=/^(?:head|last)$/.test(e),o=Vn[r?"take"+("last"==e?"Right":""):e],s=r||/^find/.test(e);o&&(Vn.prototype[e]=function(){var e=this.__wrapped__,a=r?[1]:arguments,c=e instanceof zn,u=a[0],l=c||zs(e),d=function(t){var e=o.apply(Vn,je([t],a));return r&&h?e[0]:e};l&&n&&"function"==typeof u&&1!=u.length&&(c=l=!1);var h=this.__chain__,p=!!this.__actions__.length,f=s&&!h,g=c&&!p;if(!s&&l){e=g?e:new zn(this);var v=t.apply(e,a);return v.__actions__.push({func:fs,args:[d],thisArg:i}),new qn(v,h)}return f&&g?t.apply(this,a):(v=this.thru(d),f?r?v.value()[0]:v.value():v)})})),ke(["pop","push","shift","sort","splice","unshift"],(function(t){var e=Pt[t],n=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",r=/^(?:pop|shift)$/.test(t);Vn.prototype[t]=function(){var t=arguments;if(r&&!this.__chain__){var i=this.value();return e.apply(zs(i)?i:[],t)}return this[n]((function(n){return e.apply(zs(n)?n:[],t)}))}})),Er(zn.prototype,(function(t,e){var n=Vn[e];if(n){var r=n.name+"";jt.call(Nn,r)||(Nn[r]=[]),Nn[r].push({name:e,func:n})}})),Nn[Vi(i,2).name]=[{name:"wrapper",func:i}],zn.prototype.clone=function(){var t=new zn(this.__wrapped__);return t.__actions__=Oi(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=Oi(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=Oi(this.__views__),t},zn.prototype.reverse=function(){if(this.__filtered__){var t=new zn(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},zn.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,n=zs(t),r=e<0,i=n?t.length:0,o=function(t,e,n){var r=-1,i=n.length;for(;++r<i;){var o=n[r],s=o.size;switch(o.type){case"drop":t+=s;break;case"dropRight":e-=s;break;case"take":e=bn(e,t+s);break;case"takeRight":t=_n(t,e-s)}}return{start:t,end:e}}(0,i,this.__views__),s=o.start,a=o.end,c=a-s,u=r?a:s-1,l=this.__iteratees__,d=l.length,h=0,p=bn(c,this.__takeCount__);if(!n||!r&&i==c&&p==c)return gi(t,this.__actions__);var f=[];t:for(;c--&&h<p;){for(var g=-1,v=t[u+=e];++g<d;){var m=l[g],y=m.iteratee,_=m.type,b=y(v);if(2==_)v=b;else if(!b){if(1==_)continue t;break t}}f[h++]=v}return f},Vn.prototype.at=gs,Vn.prototype.chain=function(){return ps(this)},Vn.prototype.commit=function(){return new qn(this.value(),this.__chain__)},Vn.prototype.next=function(){this.__values__===i&&(this.__values__=pa(this.value()));var t=this.__index__>=this.__values__.length;return{done:t,value:t?i:this.__values__[this.__index__++]}},Vn.prototype.plant=function(t){for(var e,n=this;n instanceof Wn;){var r=Fo(n);r.__index__=0,r.__values__=i,e?o.__wrapped__=r:e=r;var o=r;n=n.__wrapped__}return o.__wrapped__=t,e},Vn.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof zn){var e=t;return this.__actions__.length&&(e=new zn(this)),(e=e.reverse()).__actions__.push({func:fs,args:[es],thisArg:i}),new qn(e,this.__chain__)}return this.thru(es)},Vn.prototype.toJSON=Vn.prototype.valueOf=Vn.prototype.value=function(){return gi(this.__wrapped__,this.__actions__)},Vn.prototype.first=Vn.prototype.head,Zt&&(Vn.prototype[Zt]=function(){return this}),Vn}();ge._=yn,(r=function(){return yn}.call(e,n,e,t))===i||(t.exports=r)}.call(this)},2492:(t,e,n)=>{var r=n(2980),i=n(1463)((function(t,e,n){r(t,e,n)}));t.exports=i},5062:t=>{t.exports=function(){return!1}},9881:(t,e,n)=>{var r=n(8363),i=n(1704);t.exports=function(t){return r(t,i(t))}},8660:(t,e,n)=>{var r;!function(t){!function(e){var r="object"==typeof n.g?n.g:"object"==typeof self?self:"object"==typeof this?this:Function("return this;")(),i=o(t);function o(t,e){return function(n,r){"function"!=typeof t[n]&&Object.defineProperty(t,n,{configurable:!0,writable:!0,value:r}),e&&e(n,r)}}void 0===r.Reflect?r.Reflect=t:i=o(r.Reflect,i),function(t){var e=Object.prototype.hasOwnProperty,n="function"==typeof Symbol,r=n&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",i=n&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",o="function"==typeof Object.create,s={__proto__:[]}instanceof Array,a=!o&&!s,c={create:o?function(){return rt(Object.create(null))}:s?function(){return rt({__proto__:null})}:function(){return rt({})},has:a?function(t,n){return e.call(t,n)}:function(t,e){return e in t},get:a?function(t,n){return e.call(t,n)?t[n]:void 0}:function(t,e){return t[e]}},u=Object.getPrototypeOf(Function),l="object"==typeof process&&process.env&&"true"===process.env.REFLECT_METADATA_USE_MAP_POLYFILL,d=l||"function"!=typeof Map||"function"!=typeof Map.prototype.entries?tt():Map,h=l||"function"!=typeof Set||"function"!=typeof Set.prototype.entries?et():Set,p=new(l||"function"!=typeof WeakMap?nt():WeakMap);function f(t,e,n,r){if(M(n)){if(!q(t))throw new TypeError;if(!$(e))throw new TypeError;return w(t,e)}if(!q(t))throw new TypeError;if(!U(e))throw new TypeError;if(!U(r)&&!M(r)&&!j(r))throw new TypeError;return j(r)&&(r=void 0),T(t,e,n=W(n),r)}function g(t,e){function n(n,r){if(!U(n))throw new TypeError;if(!M(r)&&!H(r))throw new TypeError;P(t,e,n,r)}return n}function v(t,e,n,r){if(!U(n))throw new TypeError;return M(r)||(r=W(r)),P(t,e,n,r)}function m(t,e,n){if(!U(e))throw new TypeError;return M(n)||(n=W(n)),R(t,e,n)}function y(t,e,n){if(!U(e))throw new TypeError;return M(n)||(n=W(n)),A(t,e,n)}function _(t,e,n){if(!U(e))throw new TypeError;return M(n)||(n=W(n)),k(t,e,n)}function b(t,e,n){if(!U(e))throw new TypeError;return M(n)||(n=W(n)),O(t,e,n)}function E(t,e){if(!U(t))throw new TypeError;return M(e)||(e=W(e)),N(t,e)}function S(t,e){if(!U(t))throw new TypeError;return M(e)||(e=W(e)),D(t,e)}function C(t,e,n){if(!U(e))throw new TypeError;M(n)||(n=W(n));var r=I(e,n,!1);if(M(r))return!1;if(!r.delete(t))return!1;if(r.size>0)return!0;var i=p.get(e);return i.delete(n),i.size>0||p.delete(e),!0}function w(t,e){for(var n=t.length-1;n>=0;--n){var r=(0,t[n])(e);if(!M(r)&&!j(r)){if(!$(r))throw new TypeError;e=r}}return e}function T(t,e,n,r){for(var i=t.length-1;i>=0;--i){var o=(0,t[i])(e,n,r);if(!M(o)&&!j(o)){if(!U(o))throw new TypeError;r=o}}return r}function I(t,e,n){var r=p.get(t);if(M(r)){if(!n)return;r=new d,p.set(t,r)}var i=r.get(e);if(M(i)){if(!n)return;i=new d,r.set(e,i)}return i}function R(t,e,n){if(A(t,e,n))return!0;var r=Q(e);return!j(r)&&R(t,r,n)}function A(t,e,n){var r=I(e,n,!1);return!M(r)&&V(r.has(t))}function k(t,e,n){if(A(t,e,n))return O(t,e,n);var r=Q(e);return j(r)?void 0:k(t,r,n)}function O(t,e,n){var r=I(e,n,!1);if(!M(r))return r.get(t)}function P(t,e,n,r){I(n,r,!0).set(t,e)}function N(t,e){var n=D(t,e),r=Q(t);if(null===r)return n;var i=N(r,e);if(i.length<=0)return n;if(n.length<=0)return i;for(var o=new h,s=[],a=0,c=n;a<c.length;a++){var u=c[a];o.has(u)||(o.add(u),s.push(u))}for(var l=0,d=i;l<d.length;l++){u=d[l];o.has(u)||(o.add(u),s.push(u))}return s}function D(t,e){var n=[],r=I(t,e,!1);if(M(r))return n;for(var i=J(r.keys()),o=0;;){var s=Y(i);if(!s)return n.length=o,n;var a=X(s);try{n[o]=a}catch(t){try{Z(i)}finally{throw t}}o++}}function x(t){if(null===t)return 1;switch(typeof t){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===t?1:6;default:return 6}}function M(t){return void 0===t}function j(t){return null===t}function L(t){return"symbol"==typeof t}function U(t){return"object"==typeof t?null!==t:"function"==typeof t}function B(t,e){switch(x(t)){case 0:case 1:case 2:case 3:case 4:case 5:return t}var n=3===e?"string":5===e?"number":"default",i=K(t,r);if(void 0!==i){var o=i.call(t,n);if(U(o))throw new TypeError;return o}return F(t,"default"===n?"number":n)}function F(t,e){if("string"===e){var n=t.toString;if(z(n))if(!U(i=n.call(t)))return i;if(z(r=t.valueOf))if(!U(i=r.call(t)))return i}else{var r;if(z(r=t.valueOf))if(!U(i=r.call(t)))return i;var i,o=t.toString;if(z(o))if(!U(i=o.call(t)))return i}throw new TypeError}function V(t){return!!t}function G(t){return""+t}function W(t){var e=B(t,3);return L(e)?e:G(e)}function q(t){return Array.isArray?Array.isArray(t):t instanceof Object?t instanceof Array:"[object Array]"===Object.prototype.toString.call(t)}function z(t){return"function"==typeof t}function $(t){return"function"==typeof t}function H(t){switch(x(t)){case 3:case 4:return!0;default:return!1}}function K(t,e){var n=t[e];if(null!=n){if(!z(n))throw new TypeError;return n}}function J(t){var e=K(t,i);if(!z(e))throw new TypeError;var n=e.call(t);if(!U(n))throw new TypeError;return n}function X(t){return t.value}function Y(t){var e=t.next();return!e.done&&e}function Z(t){var e=t.return;e&&e.call(t)}function Q(t){var e=Object.getPrototypeOf(t);if("function"!=typeof t||t===u)return e;if(e!==u)return e;var n=t.prototype,r=n&&Object.getPrototypeOf(n);if(null==r||r===Object.prototype)return e;var i=r.constructor;return"function"!=typeof i||i===t?e:i}function tt(){var t={},e=[],n=function(){function t(t,e,n){this._index=0,this._keys=t,this._values=e,this._selector=n}return t.prototype["@@iterator"]=function(){return this},t.prototype[i]=function(){return this},t.prototype.next=function(){var t=this._index;if(t>=0&&t<this._keys.length){var n=this._selector(this._keys[t],this._values[t]);return t+1>=this._keys.length?(this._index=-1,this._keys=e,this._values=e):this._index++,{value:n,done:!1}}return{value:void 0,done:!0}},t.prototype.throw=function(t){throw this._index>=0&&(this._index=-1,this._keys=e,this._values=e),t},t.prototype.return=function(t){return this._index>=0&&(this._index=-1,this._keys=e,this._values=e),{value:t,done:!0}},t}();return function(){function e(){this._keys=[],this._values=[],this._cacheKey=t,this._cacheIndex=-2}return Object.defineProperty(e.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),e.prototype.has=function(t){return this._find(t,!1)>=0},e.prototype.get=function(t){var e=this._find(t,!1);return e>=0?this._values[e]:void 0},e.prototype.set=function(t,e){var n=this._find(t,!0);return this._values[n]=e,this},e.prototype.delete=function(e){var n=this._find(e,!1);if(n>=0){for(var r=this._keys.length,i=n+1;i<r;i++)this._keys[i-1]=this._keys[i],this._values[i-1]=this._values[i];return this._keys.length--,this._values.length--,e===this._cacheKey&&(this._cacheKey=t,this._cacheIndex=-2),!0}return!1},e.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=t,this._cacheIndex=-2},e.prototype.keys=function(){return new n(this._keys,this._values,r)},e.prototype.values=function(){return new n(this._keys,this._values,o)},e.prototype.entries=function(){return new n(this._keys,this._values,s)},e.prototype["@@iterator"]=function(){return this.entries()},e.prototype[i]=function(){return this.entries()},e.prototype._find=function(t,e){return this._cacheKey!==t&&(this._cacheIndex=this._keys.indexOf(this._cacheKey=t)),this._cacheIndex<0&&e&&(this._cacheIndex=this._keys.length,this._keys.push(t),this._values.push(void 0)),this._cacheIndex},e}();function r(t,e){return t}function o(t,e){return e}function s(t,e){return[t,e]}}function et(){return function(){function t(){this._map=new d}return Object.defineProperty(t.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),t.prototype.has=function(t){return this._map.has(t)},t.prototype.add=function(t){return this._map.set(t,t),this},t.prototype.delete=function(t){return this._map.delete(t)},t.prototype.clear=function(){this._map.clear()},t.prototype.keys=function(){return this._map.keys()},t.prototype.values=function(){return this._map.values()},t.prototype.entries=function(){return this._map.entries()},t.prototype["@@iterator"]=function(){return this.keys()},t.prototype[i]=function(){return this.keys()},t}()}function nt(){var t=16,n=c.create(),r=i();return function(){function t(){this._key=i()}return t.prototype.has=function(t){var e=o(t,!1);return void 0!==e&&c.has(e,this._key)},t.prototype.get=function(t){var e=o(t,!1);return void 0!==e?c.get(e,this._key):void 0},t.prototype.set=function(t,e){return o(t,!0)[this._key]=e,this},t.prototype.delete=function(t){var e=o(t,!1);return void 0!==e&&delete e[this._key]},t.prototype.clear=function(){this._key=i()},t}();function i(){var t;do{t="@@WeakMap@@"+u()}while(c.has(n,t));return n[t]=!0,t}function o(t,n){if(!e.call(t,r)){if(!n)return;Object.defineProperty(t,r,{value:c.create()})}return t[r]}function s(t,e){for(var n=0;n<e;++n)t[n]=255*Math.random()|0;return t}function a(t){return"function"==typeof Uint8Array?"undefined"!=typeof crypto?crypto.getRandomValues(new Uint8Array(t)):"undefined"!=typeof msCrypto?msCrypto.getRandomValues(new Uint8Array(t)):s(new Uint8Array(t),t):s(new Array(t),t)}function u(){var e=a(t);e[6]=79&e[6]|64,e[8]=191&e[8]|128;for(var n="",r=0;r<t;++r){var i=e[r];4!==r&&6!==r&&8!==r||(n+="-"),i<16&&(n+="0"),n+=i.toString(16).toLowerCase()}return n}}function rt(t){return t.__=void 0,delete t.__,t}t("decorate",f),t("metadata",g),t("defineMetadata",v),t("hasMetadata",m),t("hasOwnMetadata",y),t("getMetadata",_),t("getOwnMetadata",b),t("getMetadataKeys",E),t("getOwnMetadataKeys",S),t("deleteMetadata",C)}(i)}()}(r||(r={}))},7539:t=>{"use strict";const e={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};e.localCName=e.generateIdentifier(),e.splitLines=function(t){return t.trim().split("\n").map((t=>t.trim()))},e.splitSections=function(t){return t.split("\nm=").map(((t,e)=>(e>0?"m="+t:t).trim()+"\r\n"))},e.getDescription=function(t){const n=e.splitSections(t);return n&&n[0]},e.getMediaSections=function(t){const n=e.splitSections(t);return n.shift(),n},e.matchPrefix=function(t,n){return e.splitLines(t).filter((t=>0===t.indexOf(n)))},e.parseCandidate=function(t){let e;e=0===t.indexOf("a=candidate:")?t.substring(12).split(" "):t.substring(10).split(" ");const n={foundation:e[0],component:{1:"rtp",2:"rtcp"}[e[1]]||e[1],protocol:e[2].toLowerCase(),priority:parseInt(e[3],10),ip:e[4],address:e[4],port:parseInt(e[5],10),type:e[7]};for(let t=8;t<e.length;t+=2)switch(e[t]){case"raddr":n.relatedAddress=e[t+1];break;case"rport":n.relatedPort=parseInt(e[t+1],10);break;case"tcptype":n.tcpType=e[t+1];break;case"ufrag":n.ufrag=e[t+1],n.usernameFragment=e[t+1];break;default:void 0===n[e[t]]&&(n[e[t]]=e[t+1])}return n},e.writeCandidate=function(t){const e=[];e.push(t.foundation);const n=t.component;"rtp"===n?e.push(1):"rtcp"===n?e.push(2):e.push(n),e.push(t.protocol.toUpperCase()),e.push(t.priority),e.push(t.address||t.ip),e.push(t.port);const r=t.type;return e.push("typ"),e.push(r),"host"!==r&&t.relatedAddress&&t.relatedPort&&(e.push("raddr"),e.push(t.relatedAddress),e.push("rport"),e.push(t.relatedPort)),t.tcpType&&"tcp"===t.protocol.toLowerCase()&&(e.push("tcptype"),e.push(t.tcpType)),(t.usernameFragment||t.ufrag)&&(e.push("ufrag"),e.push(t.usernameFragment||t.ufrag)),"candidate:"+e.join(" ")},e.parseIceOptions=function(t){return t.substr(14).split(" ")},e.parseRtpMap=function(t){let e=t.substr(9).split(" ");const n={payloadType:parseInt(e.shift(),10)};return e=e[0].split("/"),n.name=e[0],n.clockRate=parseInt(e[1],10),n.channels=3===e.length?parseInt(e[2],10):1,n.numChannels=n.channels,n},e.writeRtpMap=function(t){let e=t.payloadType;void 0!==t.preferredPayloadType&&(e=t.preferredPayloadType);const n=t.channels||t.numChannels||1;return"a=rtpmap:"+e+" "+t.name+"/"+t.clockRate+(1!==n?"/"+n:"")+"\r\n"},e.parseExtmap=function(t){const e=t.substr(9).split(" ");return{id:parseInt(e[0],10),direction:e[0].indexOf("/")>0?e[0].split("/")[1]:"sendrecv",uri:e[1]}},e.writeExtmap=function(t){return"a=extmap:"+(t.id||t.preferredId)+(t.direction&&"sendrecv"!==t.direction?"/"+t.direction:"")+" "+t.uri+"\r\n"},e.parseFmtp=function(t){const e={};let n;const r=t.substr(t.indexOf(" ")+1).split(";");for(let t=0;t<r.length;t++)n=r[t].trim().split("="),e[n[0].trim()]=n[1];return e},e.writeFmtp=function(t){let e="",n=t.payloadType;if(void 0!==t.preferredPayloadType&&(n=t.preferredPayloadType),t.parameters&&Object.keys(t.parameters).length){const r=[];Object.keys(t.parameters).forEach((e=>{void 0!==t.parameters[e]?r.push(e+"="+t.parameters[e]):r.push(e)})),e+="a=fmtp:"+n+" "+r.join(";")+"\r\n"}return e},e.parseRtcpFb=function(t){const e=t.substr(t.indexOf(" ")+1).split(" ");return{type:e.shift(),parameter:e.join(" ")}},e.writeRtcpFb=function(t){let e="",n=t.payloadType;return void 0!==t.preferredPayloadType&&(n=t.preferredPayloadType),t.rtcpFeedback&&t.rtcpFeedback.length&&t.rtcpFeedback.forEach((t=>{e+="a=rtcp-fb:"+n+" "+t.type+(t.parameter&&t.parameter.length?" "+t.parameter:"")+"\r\n"})),e},e.parseSsrcMedia=function(t){const e=t.indexOf(" "),n={ssrc:parseInt(t.substr(7,e-7),10)},r=t.indexOf(":",e);return r>-1?(n.attribute=t.substr(e+1,r-e-1),n.value=t.substr(r+1)):n.attribute=t.substr(e+1),n},e.parseSsrcGroup=function(t){const e=t.substr(13).split(" ");return{semantics:e.shift(),ssrcs:e.map((t=>parseInt(t,10)))}},e.getMid=function(t){const n=e.matchPrefix(t,"a=mid:")[0];if(n)return n.substr(6)},e.parseFingerprint=function(t){const e=t.substr(14).split(" ");return{algorithm:e[0].toLowerCase(),value:e[1].toUpperCase()}},e.getDtlsParameters=function(t,n){return{role:"auto",fingerprints:e.matchPrefix(t+n,"a=fingerprint:").map(e.parseFingerprint)}},e.writeDtlsParameters=function(t,e){let n="a=setup:"+e+"\r\n";return t.fingerprints.forEach((t=>{n+="a=fingerprint:"+t.algorithm+" "+t.value+"\r\n"})),n},e.parseCryptoLine=function(t){const e=t.substr(9).split(" ");return{tag:parseInt(e[0],10),cryptoSuite:e[1],keyParams:e[2],sessionParams:e.slice(3)}},e.writeCryptoLine=function(t){return"a=crypto:"+t.tag+" "+t.cryptoSuite+" "+("object"==typeof t.keyParams?e.writeCryptoKeyParams(t.keyParams):t.keyParams)+(t.sessionParams?" "+t.sessionParams.join(" "):"")+"\r\n"},e.parseCryptoKeyParams=function(t){if(0!==t.indexOf("inline:"))return null;const e=t.substr(7).split("|");return{keyMethod:"inline",keySalt:e[0],lifeTime:e[1],mkiValue:e[2]?e[2].split(":")[0]:void 0,mkiLength:e[2]?e[2].split(":")[1]:void 0}},e.writeCryptoKeyParams=function(t){return t.keyMethod+":"+t.keySalt+(t.lifeTime?"|"+t.lifeTime:"")+(t.mkiValue&&t.mkiLength?"|"+t.mkiValue+":"+t.mkiLength:"")},e.getCryptoParameters=function(t,n){return e.matchPrefix(t+n,"a=crypto:").map(e.parseCryptoLine)},e.getIceParameters=function(t,n){const r=e.matchPrefix(t+n,"a=ice-ufrag:")[0],i=e.matchPrefix(t+n,"a=ice-pwd:")[0];return r&&i?{usernameFragment:r.substr(12),password:i.substr(10)}:null},e.writeIceParameters=function(t){let e="a=ice-ufrag:"+t.usernameFragment+"\r\na=ice-pwd:"+t.password+"\r\n";return t.iceLite&&(e+="a=ice-lite\r\n"),e},e.parseRtpParameters=function(t){const n={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},r=e.splitLines(t)[0].split(" ");for(let i=3;i<r.length;i++){const o=r[i],s=e.matchPrefix(t,"a=rtpmap:"+o+" ")[0];if(s){const r=e.parseRtpMap(s),i=e.matchPrefix(t,"a=fmtp:"+o+" ");switch(r.parameters=i.length?e.parseFmtp(i[0]):{},r.rtcpFeedback=e.matchPrefix(t,"a=rtcp-fb:"+o+" ").map(e.parseRtcpFb),n.codecs.push(r),r.name.toUpperCase()){case"RED":case"ULPFEC":n.fecMechanisms.push(r.name.toUpperCase())}}}return e.matchPrefix(t,"a=extmap:").forEach((t=>{n.headerExtensions.push(e.parseExtmap(t))})),n},e.writeRtpDescription=function(t,n){let r="";r+="m="+t+" ",r+=n.codecs.length>0?"9":"0",r+=" UDP/TLS/RTP/SAVPF ",r+=n.codecs.map((t=>void 0!==t.preferredPayloadType?t.preferredPayloadType:t.payloadType)).join(" ")+"\r\n",r+="c=IN IP4 0.0.0.0\r\n",r+="a=rtcp:9 IN IP4 0.0.0.0\r\n",n.codecs.forEach((t=>{r+=e.writeRtpMap(t),r+=e.writeFmtp(t),r+=e.writeRtcpFb(t)}));let i=0;return n.codecs.forEach((t=>{t.maxptime>i&&(i=t.maxptime)})),i>0&&(r+="a=maxptime:"+i+"\r\n"),n.headerExtensions&&n.headerExtensions.forEach((t=>{r+=e.writeExtmap(t)})),r},e.parseRtpEncodingParameters=function(t){const n=[],r=e.parseRtpParameters(t),i=-1!==r.fecMechanisms.indexOf("RED"),o=-1!==r.fecMechanisms.indexOf("ULPFEC"),s=e.matchPrefix(t,"a=ssrc:").map((t=>e.parseSsrcMedia(t))).filter((t=>"cname"===t.attribute)),a=s.length>0&&s[0].ssrc;let c;const u=e.matchPrefix(t,"a=ssrc-group:FID").map((t=>t.substr(17).split(" ").map((t=>parseInt(t,10)))));u.length>0&&u[0].length>1&&u[0][0]===a&&(c=u[0][1]),r.codecs.forEach((t=>{if("RTX"===t.name.toUpperCase()&&t.parameters.apt){let e={ssrc:a,codecPayloadType:parseInt(t.parameters.apt,10)};a&&c&&(e.rtx={ssrc:c}),n.push(e),i&&(e=JSON.parse(JSON.stringify(e)),e.fec={ssrc:a,mechanism:o?"red+ulpfec":"red"},n.push(e))}})),0===n.length&&a&&n.push({ssrc:a});let l=e.matchPrefix(t,"b=");return l.length&&(l=0===l[0].indexOf("b=TIAS:")?parseInt(l[0].substr(7),10):0===l[0].indexOf("b=AS:")?1e3*parseInt(l[0].substr(5),10)*.95-16e3:void 0,n.forEach((t=>{t.maxBitrate=l}))),n},e.parseRtcpParameters=function(t){const n={},r=e.matchPrefix(t,"a=ssrc:").map((t=>e.parseSsrcMedia(t))).filter((t=>"cname"===t.attribute))[0];r&&(n.cname=r.value,n.ssrc=r.ssrc);const i=e.matchPrefix(t,"a=rtcp-rsize");n.reducedSize=i.length>0,n.compound=0===i.length;const o=e.matchPrefix(t,"a=rtcp-mux");return n.mux=o.length>0,n},e.writeRtcpParameters=function(t){let e="";return t.reducedSize&&(e+="a=rtcp-rsize\r\n"),t.mux&&(e+="a=rtcp-mux\r\n"),void 0!==t.ssrc&&t.cname&&(e+="a=ssrc:"+t.ssrc+" cname:"+t.cname+"\r\n"),e},e.parseMsid=function(t){let n;const r=e.matchPrefix(t,"a=msid:");if(1===r.length)return n=r[0].substr(7).split(" "),{stream:n[0],track:n[1]};const i=e.matchPrefix(t,"a=ssrc:").map((t=>e.parseSsrcMedia(t))).filter((t=>"msid"===t.attribute));return i.length>0?(n=i[0].value.split(" "),{stream:n[0],track:n[1]}):void 0},e.parseSctpDescription=function(t){const n=e.parseMLine(t),r=e.matchPrefix(t,"a=max-message-size:");let i;r.length>0&&(i=parseInt(r[0].substr(19),10)),isNaN(i)&&(i=65536);const o=e.matchPrefix(t,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substr(12),10),protocol:n.fmt,maxMessageSize:i};const s=e.matchPrefix(t,"a=sctpmap:");if(s.length>0){const t=s[0].substr(10).split(" ");return{port:parseInt(t[0],10),protocol:t[1],maxMessageSize:i}}},e.writeSctpDescription=function(t,e){let n=[];return n="DTLS/SCTP"!==t.protocol?["m="+t.kind+" 9 "+t.protocol+" "+e.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+e.port+"\r\n"]:["m="+t.kind+" 9 "+t.protocol+" "+e.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+e.port+" "+e.protocol+" 65535\r\n"],void 0!==e.maxMessageSize&&n.push("a=max-message-size:"+e.maxMessageSize+"\r\n"),n.join("")},e.generateSessionId=function(){return Math.random().toString().substr(2,21)},e.writeSessionBoilerplate=function(t,n,r){let i;const o=void 0!==n?n:2;i=t||e.generateSessionId();return"v=0\r\no="+(r||"thisisadapterortc")+" "+i+" "+o+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},e.getDirection=function(t,n){const r=e.splitLines(t);for(let t=0;t<r.length;t++)switch(r[t]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return r[t].substr(2)}return n?e.getDirection(n):"sendrecv"},e.getKind=function(t){return e.splitLines(t)[0].split(" ")[0].substr(2)},e.isRejected=function(t){return"0"===t.split(" ",2)[1]},e.parseMLine=function(t){const n=e.splitLines(t)[0].substr(2).split(" ");return{kind:n[0],port:parseInt(n[1],10),protocol:n[2],fmt:n.slice(3).join(" ")}},e.parseOLine=function(t){const n=e.matchPrefix(t,"o=")[0].substr(2).split(" ");return{username:n[0],sessionId:n[1],sessionVersion:parseInt(n[2],10),netType:n[3],addressType:n[4],address:n[5]}},e.isValidSDP=function(t){if("string"!=typeof t||0===t.length)return!1;const n=e.splitLines(t);for(let t=0;t<n.length;t++)if(n[t].length<2||"="!==n[t].charAt(1))return!1;return!0},t.exports=e},477:t=>{"use strict";t.exports=function(t,e,n,r){var i=self||window;try{try{var o;try{o=new i.Blob([t])}catch(e){(o=new(i.BlobBuilder||i.WebKitBlobBuilder||i.MozBlobBuilder||i.MSBlobBuilder)).append(t),o=o.getBlob()}var s=i.URL||i.webkitURL,a=s.createObjectURL(o),c=new i[e](a,n);return s.revokeObjectURL(a),c}catch(r){return new i[e]("data:application/javascript,".concat(encodeURIComponent(t)),n)}}catch(t){if(!r)throw Error("Inline worker is not supported");return new i[e](r,n)}}}},e={};function n(r){var i=e[r];if(void 0!==i)return i.exports;var o=e[r]={id:r,loaded:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.nmd=t=>(t.paths=[],t.children||(t.children=[]),t);var r={};return(()=>{"use strict";n.r(r),n.d(r,{BASIC_FULL_HD_LANDSCAPE:()=>oe,BASIC_FULL_HD_PORTRAIT:()=>se,BASIC_LANDSCAPE:()=>re,BASIC_PORTRAIT:()=>ie,BroadcastClientError:()=>BroadcastClientError,BroadcastClientEvents:()=>gn,BroadcastStageConnectionEvents:()=>nn,BroadcastStageSubscriptionEvents:()=>rn,ConnectionState:()=>yn,DEFAULT_STAGE_LANDSCAPE:()=>Be,DEFAULT_STAGE_PORTRAIT:()=>Fe,Errors:()=>t,LOG_LEVEL:()=>ct,LogLevels:()=>ct,STANDARD_LANDSCAPE:()=>ae,STANDARD_PORTRAIT:()=>ce,__version:()=>es,create:()=>ts,createStageClient:()=>ns,default:()=>os,isSupported:()=>Qo,stagesSendJoinEvent:()=>rs,stagesSendLeaveEvent:()=>is});var t={};n.r(t),n.d(t,{ADD_DEVICE_COMPOSITION_INDEX_MISSING_ERROR:()=>vt,ADD_DEVICE_COMPOSITION_MISSING_ERROR:()=>gt,ADD_DEVICE_CONSTRAINTS_ERROR:()=>_t,ADD_DEVICE_DEVICE_ERROR:()=>pt,ADD_DEVICE_NAME_EXISTS_ERROR:()=>ft,ADD_DEVICE_NAME_MISSING_ERROR:()=>mt,ADD_DEVICE_UNSUPPORTED:()=>yt,BROADCAST_CONFIGURATION_ERROR:()=>Ot,BROADCAST_ERROR:()=>lt,CAMERA_ERROR:()=>dt,CLIENT_INVALID_ERROR:()=>jt,EXCHANGE_POSITION_DEVICE_NOT_FOUND_ERROR:()=>Tt,FAILED_TO_ADD_IMAGE_ERROR:()=>It,INGEST_ENDPOINT_TYPE_ERROR:()=>Nt,INGEST_ENDPOINT_URL_ERROR:()=>Dt,INPUT_ERROR:()=>ht,INVALID_STREAM_KEY:()=>kt,LOGGER_TYPE_ERROR:()=>Mt,LOG_LEVEL_TYPE_ERROR:()=>xt,NETWORK_RECONNECT_CONFIGURATION_ERROR:()=>Lt,NETWORK_RECONNECT_CONFIGURATION_INVALID_TIMEOUT_ERROR:()=>Ut,PEER_CONNECTION_ERROR:()=>At,PEER_SETUP_ERROR:()=>Rt,REMOVE_DEVICE_NOT_FOUND_ERROR:()=>bt,REMOVE_IMAGE_NOT_FOUND_ERROR:()=>Et,STAGE_TOKEN_TYPE_ERROR:()=>Ft,STAGE_WHIP_OVERRIDE_ERROR:()=>Vt,STREAM_CONFIGURATION_ERROR:()=>Pt,STREAM_KEY_INVALID_CHAR_ERROR:()=>Bt,UPDATE_VIDEO_DEVICE_COMPOSITION_INDEX_MISSING_ERROR:()=>Ct,UPDATE_VIDEO_DEVICE_COMPOSITION_MISSING_ERROR:()=>St,UPDATE_VIDEO_DEVICE_COMPOSITION_NAME_NOT_FOUND_ERROR:()=>wt});var e={};n.r(e),n.d(e,{fixNegotiationNeeded:()=>Ir,shimAddTrackRemoveTrack:()=>wr,shimAddTrackRemoveTrackWithNative:()=>Cr,shimGetDisplayMedia:()=>mr,shimGetSendersWithDtmf:()=>br,shimGetStats:()=>Er,shimGetUserMedia:()=>vr,shimMediaStream:()=>yr,shimOnTrack:()=>_r,shimPeerConnection:()=>Tr,shimSenderReceiverGetStats:()=>Sr});var i={};n.r(i),n.d(i,{shimAddTransceiver:()=>Mr,shimCreateAnswer:()=>Ur,shimCreateOffer:()=>Lr,shimGetDisplayMedia:()=>Ar,shimGetParameters:()=>jr,shimGetUserMedia:()=>Rr,shimOnTrack:()=>kr,shimPeerConnection:()=>Or,shimRTCDataChannel:()=>xr,shimReceiverGetStats:()=>Nr,shimRemoveStream:()=>Dr,shimSenderGetStats:()=>Pr});var o={};n.r(o),n.d(o,{shimAudioContext:()=>Hr,shimCallbacksAPI:()=>Vr,shimConstraints:()=>Wr,shimCreateOfferLegacy:()=>$r,shimGetUserMedia:()=>Gr,shimLocalStreamsAPI:()=>Br,shimRTCIceServerUrls:()=>qr,shimRemoteStreamsAPI:()=>Fr,shimTrackEventTransceiver:()=>zr});var s={};n.r(s),n.d(s,{removeExtmapAllowMixed:()=>ei,shimAddIceCandidateNullOrEmpty:()=>ni,shimConnectionState:()=>ti,shimMaxMessageSize:()=>Zr,shimParameterlessSetLocalDescription:()=>ri,shimRTCIceCandidate:()=>Xr,shimRTCIceCandidateRelayProtocol:()=>Yr,shimSendThrowTypeError:()=>Qr});var a={};n.r(a),n.d(a,{BASIC_FULL_HD_LANDSCAPE:()=>oe,BASIC_FULL_HD_PORTRAIT:()=>se,BASIC_LANDSCAPE:()=>re,BASIC_PORTRAIT:()=>ie,BroadcastClientError:()=>BroadcastClientError,BroadcastClientEvents:()=>gn,ConnectionState:()=>yn,Errors:()=>t,LOG_LEVEL:()=>ct,LogLevels:()=>ct,STANDARD_LANDSCAPE:()=>ae,STANDARD_PORTRAIT:()=>ce,__version:()=>es,create:()=>ts,isSupported:()=>Qo});n(8660);var c,u=n(6729),l=n.n(u),d=n(1206);function h(t){const e="0123456789abcdef";let n="";for(let r=0;r<t;r+=1)n+=e.charAt(Math.floor(Math.random()*e.length));return n}class RequestUUID{constructor(){const t=h;this.value=`${t(8)}-${t(4)}-${t(4)}-${t(4)}-${t(12)}`}}function p(){return new RequestUUID}class TraceId{constructor(){const t=(Date.now()/1e3|0).toString(16);this.value=`1-${t}-${h(24)}`}}function f(){return new TraceId}let g,v;function m(t){return g!==t.stageARN&&(g=t.stageARN,v=void 0),v||(v=h(32)),v}!function(t){t.PUBLISHED_VIDEO_STATS="ivs_broadcast_webrtc_published_video_stats",t.PUBLISHED_AUDIO_STATS="ivs_broadcast_webrtc_published_audio_stats",t.SUBSCRIBED_VIDEO_STATS="ivs_broadcast_webrtc_subscribed_video_stats",t.SUBSCRIBED_AUDIO_STATS="ivs_broadcast_webrtc_subscribed_audio_stats",t.PUBLISH="ivs_broadcast_multihost_publish",t.UNPUBLISH="ivs_broadcast_multihost_unpublish",t.SUBSCRIBE="ivs_broadcast_multihost_subscribe",t.UNSUBSCRIBE="ivs_broadcast_multihost_unsubscribe",t.PUBLISH_STARTED="ivs_broadcast_multihost_publish_started",t.PUBLISH_ENDED="ivs_broadcast_multihost_publish_ended",t.STATE_UPDATED="ivs_broadcast_multihost_event_state_updated",t.SUBSCRIBE_STARTED="ivs_broadcast_multihost_subscribe_started",t.SUBSCRIBE_ENDED="ivs_broadcast_multihost_subscribe_ended",t.JOIN="ivs_broadcast_multihost_join",t.LEAVE="ivs_broadcast_multihost_leave",t.SERVER_REQUEST="ivs_broadcast_multihost_server_request",t.TRACE="ivs_broadcast_stage_trace",t.ERROR="ivs_broadcast_error",t.MINUTE="ivs_broadcast_multihost_minute",t.CONNECTION_STATE="ivs_broadcast_webrtc_connection_state",t.ICE_GATHERING_STATE="ivs_broadcast_webrtc_gathering_state",t.EDP_CONNECTED="ivs_broadcast_multihost_event_connected",t.EDP_DISCONNECTED="ivs_broadcast_multihost_event_disconnected",t.EDP_PONG="ivs_broadcast_multihost_event_pong"}(c||(c={}));class StageAnalyticsEvent{constructor(t,e,n,r){let i="unknown";if(e.stageARN&&e.stageARN.startsWith("arn:aws:ivs:")){const t=e.stageARN.split(":");6===t.length&&(i=t[4])}this.event=t,this.properties={client_time:(new Date).toISOString(),customer_id:i,device_software:window.navigator.userAgent,multihost_id:e.stageARN,participant_id:e.participantID,participant_user_id:e.userID,platform:"web",sdk_version:"1.3.2",session_id:m(e),stage_arn:e.stageARN,trace_id:n.value},e.attrGsRole&&(this.properties.token_attribute_0=e.attrGsRole),e.attrGsSessionId&&(this.properties.token_attribute_1=e.attrGsSessionId),this.critical=r}}class StageErrorEvent extends StageAnalyticsEvent{constructor(t){super(c.ERROR,t.token,t.traceId,!0),Object.assign(this.properties,{code:t.code,tag:t.tag,description:t.message,remote_participant_id:t.remoteParticipantId,request_uuid:t.requestUUID,is_nominal:t.nominal,is_fatal:t.fatal})}}var y=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))};const _=4;class SpadeClient{constructor(t="https://broadcast.stats.live-video.net/"){this.spadeUrl=t}send(t,e=!1){return y(this,void 0,void 0,(function*(){const n=Date.now();for(const e of t)e.properties.batch_time_millis=n;const r={"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},i=`data=${this.b64EncodeUnicode(JSON.stringify(t))}`;e?navigator.sendBeacon(this.spadeUrl,i):function(t,e,n={},r=""){y(this,void 0,void 0,(function*(){const i=new XMLHttpRequest;return i.open(t,e,!0),n&&Object.keys(n).forEach((t=>{n.hasOwnProperty(t)&&i.setRequestHeader(t,n[t])})),new Promise(((n,o)=>{i.onreadystatechange=()=>{i.readyState===_&&(i.status>=200&&i.status<300?n(i.responseText):o(new Error(`Spade ${t} ${e} responded ${i.status}\n${i.responseText}`)))},i.send(r)}))}))}("POST",this.spadeUrl,r,i)}))}b64EncodeUnicode(t){return btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,e)=>String.fromCharCode(Number(`0x${e}`)))))}}function b(t){if(!t)throw new Error("SpadeClient is not defined")}class AnalyticsTracker{constructor(t){this.sharedProperties={},this.spadeClient={},this.queuedEvents=[],this.init({spadeUrl:t})}static getInstance(t){return AnalyticsTracker.instance||(AnalyticsTracker.instance=new AnalyticsTracker(null!=t?t:"https://broadcast.stats.live-video.net/")),AnalyticsTracker.instance}start(){this.sessionId=this.newGuid(),this.sharedProperties.session_id=this.sessionId,this.flushInterval||(this.flushInterval=window.setInterval((()=>{this.flushEvents()}),1e3))}stop(){clearInterval(this.flushInterval),this.flushInterval=void 0,this.queuedEvents=this.queuedEvents.filter((t=>t.critical)),this.flushEvents(!0)}trackEvent(t){t.data.properties=Object.assign({},this.sharedProperties,t.data.properties),this.queuedEvents.push(t.data)}trackEventNoSharedProps(t){this.queuedEvents.push(t)}trackErrorAndThrow(t){throw this.trackError(t),t}trackError(t){AnalyticsTracker.getInstance().trackEventNoSharedProps(new StageErrorEvent(t))}batchEvents(t){b(this.spadeClient);const e=t.map((t=>(t.data.properties=Object.assign({},this.sharedProperties,t.data.properties),t.data)));this.spadeClient.send(e)}init({spadeUrl:t}){this.spadeClient=new SpadeClient(t);const e=d.getParser(navigator.userAgent),n=this.parseSemver(String(e.getBrowserVersion()));this.sharedProperties={browser:navigator.appVersion,browser_family:e.getBrowserName().toLowerCase(),browser_version:`${n.major}.${n.minor}`,customer_id:"ivs",os_name:e.getOSName(),os_version:String(e.getOSVersion()),platform:"web",session_id:this.sessionId,sdk_version:"1.3.2",user_agent:navigator.userAgent}}newGuid(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(t=>{const e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)}))}flushEvents(t=!1){b(this.spadeClient),this.queuedEvents.length>0&&this.spadeClient.send(this.queuedEvents,t),this.queuedEvents=[]}parseSemver(t){const e=/^(\d+)\.(\d+)\.(\d+)[+|-]?(.*)?$/.exec(t)||/^(\d+)\.(\d+)[+|-]?(.*)?$/.exec(t)||/^(\d+)$/.exec(t)||[];return{major:parseInt(e[1],10)||0,minor:parseInt(e[2],10)||0,patch:parseInt(e[3],10)||0}}}var E="Cannot apply @injectable decorator multiple times.",S="Metadata key was used more than once in a parameter:",C="NULL argument",w="Key Not Found",T="Ambiguous match found for serviceIdentifier:",I="No matching bindings found for serviceIdentifier:",R="Missing required @injectable annotation in:",A="Missing required @inject or @multiInject annotation in:",k=function(t){return"@inject called with undefined this could mean that the class "+t+" has a circular dependency problem. You can use a LazyServiceIdentifer to overcome this limitation."},O="Circular dependency found:",P="The @inject @multiInject @tagged and @named decorators must be applied to the parameters of a class constructor or a class property.",N=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return"The number of constructor arguments in the derived class "+t[0]+" must be >= than the number of constructor arguments of its base class."},D=function(t,e){return"@postConstruct error in class "+t+": "+e},x=function(t,e){return"@preDestroy error in class "+t+": "+e},M=function(t,e){return"onDeactivation() error in class "+t+": "+e},j="Maximum call stack size exceeded",L="named",U="name",B="unmanaged",F="optional",V="inject",G="multi_inject",W="inversify:tagged",q="inversify:tagged_props",z="inversify:paramtypes",$="design:paramtypes",H="post_construct",K="pre_destroy";var J=[V,G,U,B,L,F];function X(){return function(t){if(Reflect.hasOwnMetadata(z,t))throw new Error(E);var e=Reflect.getMetadata($,t)||[];return Reflect.defineMetadata(z,e,t),t}}var Y=function(){function t(t,e){this.key=t,this.value=e}return t.prototype.toString=function(){return this.key===L?"named: "+String(this.value).toString()+" ":"tagged: { key:"+this.key.toString()+", value: "+String(this.value)+" }"},t}();function Z(t,e,n,r){!function(t){if(void 0!==t)throw new Error(P)}(e),tt(W,t,n.toString(),r)}function Q(t){var e=[];if(Array.isArray(t)){var n=function(t){for(var e=new Set,n=0,r=t;n<r.length;n++){var i=r[n];if(e.has(i))return i;e.add(i)}}((e=t).map((function(t){return t.key})));if(void 0!==n)throw new Error(S+" "+n.toString())}else e=[t];return e}function tt(t,e,n,r){var i=Q(r),o={};Reflect.hasOwnMetadata(t,e)&&(o=Reflect.getMetadata(t,e));var s=o[n];if(void 0===s)s=[];else for(var a=function(t){if(i.some((function(e){return e.key===t.key})))throw new Error(S+" "+t.key.toString())},c=0,u=s;c<u.length;c++){a(u[c])}s.push.apply(s,i),o[n]=s,Reflect.defineMetadata(t,o,e)}function et(t){return function(e,n,r){"number"==typeof r?Z(e,n,r,t):function(t,e,n){if(void 0!==t.prototype)throw new Error(P);tt(q,t.constructor,e,n)}(e,n,t)}}var nt,rt=(nt=V,function(t){return function(e,n,r){if(void 0===t){var i="function"==typeof e?e.name:e.constructor.name;throw new Error(k(i))}return et(new Y(nt,t))(e,n,r)}});const it={CONFIG:Symbol.for("config")},ot=1007,st=12e4,at=3e5;class BroadcastClientError extends Error{constructor({name:t,message:e,code:n,details:r,cause:i,params:o}){super(e),Error.captureStackTrace&&Error.captureStackTrace(this,BroadcastClientError),this.name=t||"BroadcastClientError",this.message=e,this.code=n,this.details=r,this.cause=i,this.params=o}}var ct,ut;!function(t){t[t.TRACE=0]="TRACE",t[t.DEBUG=1]="DEBUG",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"}(ct||(ct={})),function(t){t.SPADE="SPADE",t.TIME="Time",t.WEBRTC="WebRTC",t.EMITTER="Emitter",t.MEDIA="Media",t.SUBSCRIPTION="StageSubscription",t.PUBLICATION="StagePublication",t.CONNECTION="StageConnection",t.SOCKET="StageSocket",t.BROADCAST_STAGE_CLIENT="BroadcastStageClient",t.STAGE="Stage",t.REMOTE_PARTICIPANT="RemoteParticipant",t.LOCAL_PARTICIPANT="LocalParticipant"}(ut||(ut={}));const lt={name:"BroadcastError",code:1e3,message:"Unable to broadcast"},dt={name:"CameraError",code:2e3,message:"Camera could not be captured"},ht={name:"InputError",code:3e3,message:"Input could not be attached"},pt={name:"AddDeviceError",code:4e3,message:"Device is missing"},ft={name:"AddDeviceNameExistsError",code:4001,message:"Name is already registered"},gt={name:"AddDeviceCompositionMissingError",code:4002,message:"VideoComposition is missing"},vt={name:"AddDeviceCompositionIndexMissingError",code:4003,message:'VideoComposition\'s "index" property is missing'},mt={name:"AddDeviceNameMissingError",code:4004,message:"Name property is missing"},yt={name:"AddDeviceUnsupported",code:4005,message:"Unsupported device"},_t={name:"AddDeviceConstraintsError",code:4006,message:"Constraints error"},bt={name:"RemoveDeviceNotFoundError",code:5e3,message:"Device not found"},Et={name:"RemoveImageNotFoundError",code:6e3,message:"Image not found"},St={name:"UpdateVideoDeviceCompositionMissingError",code:7e3,message:"VideoComposition is missing"},Ct={name:"UpdateVideoDeviceCompositionIndexMissingError",code:7001,message:'VideoComposition\'s "index" property is missing'},wt={name:"UpdateVideoDeviceCompositionNameMissingError",code:7002,message:"Video device with that name is not found"},Tt={name:"ExchangePositionDeviceNotFoundError",code:8e3,message:"Device with that name is not found"},It={name:"FailedToAddImageError",code:9e3,message:"Failed to add image"},Rt={name:"PeerSetupError",code:1e4,message:"Unexpected return value from setup request"},At={name:"PeerConnectionError",code:10001,message:"Peer connection has failed."},kt={name:"InvalidStreamKey",code:10003,message:"Invalid Stream Key."},Ot={name:"BroadcastConfigurationError",code:11e3,message:"Error when configuring broadcast client"},Pt={name:"StreamConfigurationError",code:12e3,message:"Error when configuring stream"},Nt={name:"IngestEndpointTypeError",code:13e3,message:"Ingest endpoint must be a string"},Dt={name:"IngestEndpointUrlError",code:13001,message:"Ingest endpoint must be a valid https or rtmps URL"},xt={name:"LogLevelTypeError",code:14e3,message:"Log Level must be a valid integer between [0..5]"},Mt={name:"LoggerTypeError",code:15e3,message:"Logger must be an object"},jt={name:"ClientInvalidError",code:16e3,message:"Client is no longer valid, possibly due to delete() invocation."},Lt={name:"NetworkReconnectConfigurationError",code:17e3,message:"Error when configuring network reconnect"},Ut={name:"NetworkReconnectConfigurationInvalidTimeoutError",code:17001,message:"Network reconnect timeout value must be a number between [10000, 300000]"},Bt={name:"StreamKeyInvalidCharError",code:18e3,message:"Streamkey must contain only [A-Za-z0-9_-] characters"},Ft={name:"StageTokenTypeError",code:19e3,message:"Stage token must be a string"},Vt={name:"StageWhipUrlOverrideError",code:19001,message:"Stage WHIP override URL must be a string starting with http"};var Gt,Wt,qt,zt,$t,Ht,Kt,Jt,Xt,Yt=function(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)},Zt=function(t,e,n,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(t,n):i?i.value=n:e.set(t,n),n};const Qt=1920,te=1080,ee="missing stream configuration",ne=ct.ERROR,re={maxResolution:{width:852,height:480},maxFramerate:30,maxBitrate:1500},ie={maxResolution:{width:480,height:852},maxFramerate:30,maxBitrate:1500},oe={maxResolution:{width:1920,height:1080},maxFramerate:30,maxBitrate:3500},se={maxResolution:{width:1080,height:1920},maxFramerate:30,maxBitrate:3500},ae={maxResolution:{width:1920,height:1080},maxFramerate:30,maxBitrate:8500},ce={maxResolution:{width:1080,height:1920},maxFramerate:30,maxBitrate:8500},ue={reconnect:!1,timeout:st};function le(t){var e,n;if("string"!=typeof t&&void 0!==t)throw new BroadcastClientError(Nt);if(t){if(t.startsWith("https"))return t;{const r=/(?<protocol>(rtmps|https):\/\/)?(?<id>.+)\.(?<environment>(?=\S*['-])([a-zA-Z'-]+))\.live-video\.net.*/.exec(t);if("rtmps"===(null===(e=null==r?void 0:r.groups)||void 0===e?void 0:e.protocol)&&console.warn("rtmps server url detected; please pass in the ingest endpoint (no rtmps:// protocol) instead"),null===(n=null==r?void 0:r.groups)||void 0===n?void 0:n.id)return`https://${r.groups.id}.webrtc.live-video.net:4443`;throw new BroadcastClientError(Dt)}}return""}class Config{constructor(t,e,n=re,r,i=ue){this.LOG_LEVEL=ct,this.BASIC_LANDSCAPE=re,this.BASIC_PORTRAIT=ie,this.BASIC_FULL_HD_LANDSCAPE=oe,this.BASIC_FULL_HD_PORTRAIT=se,this.STANDARD_LANDSCAPE=ae,this.STANDARD_PORTRAIT=ce,Gt.set(this,void 0),Wt.set(this,void 0),qt.set(this,re),zt.set(this,void 0),$t.set(this,ue),Ht.set(this,(t=>{if(!t)throw new BroadcastClientError(Object.assign(Object.assign({},Pt),{details:ee}));if(!(t.maxBitrate<=8500&&t.maxBitrate>=200))throw new BroadcastClientError(Object.assign(Object.assign({},Pt),{details:"maxBitrate must be between 200 and 8500"}));if(!(t.maxFramerate<=60&&t.maxFramerate>=10))throw new BroadcastClientError(Object.assign(Object.assign({},Pt),{details:"maxFramerate must be between 10 and 60"}));const e=t.maxResolution.width,n=t.maxResolution.height;if(e>Qt||n>Qt||e<160||n<160||(e===Qt&&n>te||n===Qt&&e>te))throw new BroadcastClientError(Object.assign(Object.assign({},Pt),{details:"maxResolution values must be between 1080x1920 or 1920x1080"}))})),Kt.set(this,(t=>{if(!t)return;const e=Number(t),n=Number.isInteger(e),r=e>=ct.TRACE,i=e<=ct.SILENT;if(!n||!r||!i)throw new BroadcastClientError(xt)})),Jt.set(this,(t=>{if(t&&"object"!=typeof t)throw new BroadcastClientError(Mt)})),Xt.set(this,(t=>{if(!t)return;if("object"!=typeof t||"boolean"!=typeof t.reconnect)throw new BroadcastClientError(Lt);const{timeout:e}=t;if(void 0!==e&&(Number.isNaN(e)||"number"!=typeof e||e<1e4||e>at))throw new BroadcastClientError(Ut)})),Yt(this,Jt,"f").call(this,r),Yt(this,Kt,"f").call(this,e),Yt(this,Ht,"f").call(this,n),Zt(this,Gt,t,"f"),Zt(this,Wt,e,"f"),Zt(this,qt,n,"f"),Zt(this,zt,r,"f"),Zt(this,$t,i,"f")}get ingestEndpoint(){return Yt(this,Gt,"f")}set ingestEndpoint(t){Zt(this,Gt,le(t),"f")}get streamConfig(){return Yt(this,qt,"f")}set streamConfig(t){Yt(this,Ht,"f").call(this,t),Zt(this,qt,t,"f")}get logLevel(){return Yt(this,Wt,"f")}set logLevel(t){Yt(this,Kt,"f").call(this,t),Zt(this,Wt,t,"f")}get logger(){return Yt(this,zt,"f")}set logger(t){Yt(this,Jt,"f").call(this,t),Zt(this,zt,t,"f")}get networkReconnectConfig(){return Yt(this,$t,"f")}set networkReconnectConfig(t){Yt(this,Xt,"f").call(this,t),Zt(this,$t,t,"f")}}Gt=new WeakMap,Wt=new WeakMap,qt=new WeakMap,zt=new WeakMap,$t=new WeakMap,Ht=new WeakMap,Kt=new WeakMap,Jt=new WeakMap,Xt=new WeakMap;const de={[ct.INFO]:"#528bff",[ct.WARN]:"#ffb31a",[ct.DEBUG]:"#00f593",[ct.ERROR]:"#ff4f4d",[ct.TRACE]:"",[ct.SILENT]:"",[ut.SPADE]:"#a970ff",[ut.TIME]:"#53535f",[ut.WEBRTC]:"#0e9bd8",[ut.SUBSCRIPTION]:"#ffc400",[ut.CONNECTION]:"#ff5edb",[ut.SOCKET]:"#8585ff",[ut.EMITTER]:"#adadb8",[ut.LOCAL_PARTICIPANT]:"#1DD21D",[ut.STAGE]:"#EC9806",[ut.REMOTE_PARTICIPANT]:"#0680EC",details:"#808080"},he=({label:t})=>`background: ${de[t]||"#333333"}; color: white; padding: 3px; margin-left: 3px;`,pe=Object.entries(ct),fe=(t,e,n)=>{const r=he({label:t}),[i]=pe.find((([,e])=>e===Number(t)))||[],o=`%c${i}`,s=he({label:e}),a=`%c${e}`,c=he({label:ut.TIME}),u=`%c[${(new Date).toISOString()}]`,l=he({label:"details"}),d=`%c[${n}]`,h=[u,o,a],p=[c,r,s];return n&&(h.push(d),p.push(l)),[h.join(""),...p]},ge={debug(t){console.groupCollapsed(...fe(ct.DEBUG,t.scope,t.label)),console.debug(t.msg,Object.assign(Object.assign({},t),{level:"debug"})),console.groupEnd()},info(t){console.groupCollapsed(...fe(ct.INFO,t.scope,t.label)),console.info(t.msg,Object.assign(Object.assign({},t),{level:"info"})),console.groupEnd()},warn(t){console.groupCollapsed(...fe(ct.WARN,t.scope,t.label)),console.warn(t.msg,Object.assign(Object.assign({},t),{level:"warn"})),console.groupEnd()},error(t){console.error(t)}};var ve,me=function(t,e,n,r){var i,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(s=(o<3?i(s):o>3?i(e,n,s):i(e,n))||s);return o>3&&s&&Object.defineProperty(e,n,s),s},ye=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_e=function(t,e){return function(n,r){e(n,r,t)}},be=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n};Object.entries(ct);let Ee=class Logger{constructor(t){var e;this.config=t,this.logLevel=null!==(e=this.config.logLevel)&&void 0!==e?e:ne;const n=t.logger;this.loggerInstance=n||ge}debug(t){var e,n;this.logLevel>ct.DEBUG||null===(n=(e=this.loggerInstance).debug)||void 0===n||n.call(e,JSON.parse(JSON.stringify(Object.assign(Object.assign({},t),{level:"debug"}))))}info(t){var e,n;this.logLevel>ct.INFO||null===(n=(e=this.loggerInstance).info)||void 0===n||n.call(e,JSON.parse(JSON.stringify(Object.assign(Object.assign({},t),{level:"info"}))))}warn(t){var e,n;this.logLevel>ct.WARN||null===(n=(e=this.loggerInstance).warn)||void 0===n||n.call(e,JSON.parse(JSON.stringify(Object.assign(Object.assign({},t),{level:"warn"}))))}error(t){var e,n,{err:r}=t,i=be(t,["err"]);this.logLevel>ct.ERROR||null===(n=(e=this.loggerInstance).error)||void 0===n||n.call(e,Object.assign({err:r},i))}};Ee=me([X(),_e(0,rt(it.CONFIG)),ye("design:paramtypes",["function"==typeof(ve=void 0!==Config&&Config)?ve:Object])],Ee);class ScopedLogger{constructor(t,e){this.logger=t,this.scope=e}debug(t){var e,n;null===(n=(e=this.logger).debug)||void 0===n||n.call(e,JSON.parse(JSON.stringify(Object.assign(Object.assign({},t),{scope:this.scope}))))}info(t){var e,n;null===(n=(e=this.logger).info)||void 0===n||n.call(e,JSON.parse(JSON.stringify(Object.assign(Object.assign({},t),{scope:this.scope}))))}warn(t){var e,n;null===(n=(e=this.logger).warn)||void 0===n||n.call(e,JSON.parse(JSON.stringify(Object.assign(Object.assign({},t),{scope:this.scope}))))}error(t){var e,n,{err:r}=t,i=be(t,["err"]);null===(n=(e=this.logger).error)||void 0===n||n.call(e,Object.assign(Object.assign({err:r},i),{scope:this.scope}))}unwrap(){return this.logger}}var Se;!function(t){t.PUBLISH="publish",t.SUBSCRIBE="subscribe",t.JOIN="join",t.LEAVE="leave",t.APP_TRACE="app_trace"}(Se||(Se={}));const Ce=1,we=2;class JoinEvent extends StageAnalyticsEvent{constructor(t){super(c.JOIN,t.token,t.traceId,!1),Object.assign(this.properties,{action:Se.JOIN,event_endpoint:t.eventEndpoint,whip_endpoint:t.whipEndpoint})}}class LeaveEvent extends StageAnalyticsEvent{constructor(t){super(c.LEAVE,t.token,t.traceId,!1),Object.assign(this.properties,{action:Se.LEAVE,event_endpoint:t.eventEndpoint,whip_endpoint:t.whipEndpoint,reason:t.reason})}}var Te,Ie,Re,Ae,ke,Oe,Pe,Ne,De,xe=function(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)},Me=function(t,e,n,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(t,n):i?i.value=n:e.set(t,n),n};const je=2500,Le=1280,Ue=720,Be={maxResolution:{width:Le,height:Ue},maxFramerate:30,maxBitrate:je},Fe={maxResolution:{width:Ue,height:Le},maxFramerate:30,maxBitrate:je};class StageConfig{constructor(t=Be,e,n){this.LOG_LEVEL=ct,this.DEFAULT_STAGE_LANDSCAPE=Be,this.DEFAULT_STAGE_PORTRAIT=Fe,Te.set(this,void 0),Ie.set(this,void 0),Re.set(this,void 0),Ae.set(this,void 0),ke.set(this,void 0),Oe.set(this,(t=>{if(!t)throw new BroadcastClientError(Object.assign(Object.assign({},Pt),{details:ee}));if(!(t.maxBitrate<=je&&t.maxBitrate>=200))throw new BroadcastClientError(Object.assign(Object.assign({},Pt),{details:"maxBitrate must be between 200 and 2500"}));if(!(t.maxFramerate<=30&&t.maxFramerate>=10))throw new BroadcastClientError(Object.assign(Object.assign({},Pt),{details:"maxFramerate must be between 10 and 30"}));const e=t.maxResolution.width,n=t.maxResolution.height;if(e>Le||n>Le||e<160||n<160||(e===Le&&n>Ue||n===Le&&e>Ue))throw new BroadcastClientError(Object.assign(Object.assign({},Pt),{details:"maxResolution values must be between 720x1280 or 1280x720"}))})),Pe.set(this,(t=>{if(!t)return;const e=Number(t),n=Number.isInteger(e),r=e>=ct.TRACE,i=e<=ct.SILENT;if(!n||!r||!i)throw new BroadcastClientError(xt)})),Ne.set(this,(t=>{if(t&&"object"!=typeof t)throw new BroadcastClientError(Mt)})),De.set(this,(t=>{if(t&&("string"!=typeof t||!t.startsWith("http")))throw new BroadcastClientError(Vt)})),xe(this,Ne,"f").call(this,n),xe(this,Pe,"f").call(this,e),xe(this,Oe,"f").call(this,t),Me(this,Ie,n,"f"),Me(this,Te,e,"f"),Me(this,Ae,t,"f")}get streamConfig(){return xe(this,Ae,"f")}set streamConfig(t){xe(this,Oe,"f").call(this,t),Me(this,Ae,t,"f")}get logLevel(){return xe(this,Te,"f")}set logLevel(t){xe(this,Pe,"f").call(this,t),Me(this,Te,t,"f")}get logger(){return xe(this,Ie,"f")}set logger(t){xe(this,Ne,"f").call(this,t),Me(this,Ie,t,"f")}get whipUrlOverride(){return xe(this,ke,"f")}set whipUrlOverride(t){xe(this,De,"f").call(this,t),Me(this,ke,t,"f")}}Te=new WeakMap,Ie=new WeakMap,Re=new WeakMap,Ae=new WeakMap,ke=new WeakMap,Oe=new WeakMap,Pe=new WeakMap,Ne=new WeakMap,De=new WeakMap;class StageClientError extends BroadcastClientError{constructor({token:t,traceId:e,code:n,tag:r,location:i,message:o,details:s,remoteParticipantId:a,requestUUID:c,fatal:u,nominal:l}){super({name:"StageClientError",message:o,code:n}),Error.captureStackTrace&&Error.captureStackTrace(this,StageClientError),this.token=t,this.traceId=e,this.code=n,this.tag=r,this.location=i,this.message=o,this.details=s,this.remoteParticipantId=a,this.requestUUID=c,this.fatal=u,this.nominal=l}}const Ve={JOIN_RELATED:"signalling_session",PUBLISH_RELATED:"webrtc_sink",UNPUBLISH_RELATED:"webrtc_unsink"};function Ge(t,e){switch(t){case Se.PUBLISH:return Ve.PUBLISH_RELATED;case Se.SUBSCRIBE:return`webrtc_source:${e}`;default:return"unknown"}}function We(t,e){var n,r,i,o;const s={code:t.code,message:`${t.message}: ${e.name} ${e.message}`,fatal:null!==(n=t.fatal)&&void 0!==n&&n,nominal:null!==(r=t.nominal)&&void 0!==r&&r};return e instanceof StageClientError&&(s.fatal=null!==(i=e.fatal)&&void 0!==i&&i,s.nominal=null!==(o=e.nominal)&&void 0!==o&&o),s}var qe;!function(t){t[t.Unspecified=2001]="Unspecified",t[t.TokenExpired=2002]="TokenExpired",t[t.NoPermissions=2003]="NoPermissions",t[t.StageAtCapacity=2005]="StageAtCapacity"}(qe||(qe={}));const ze={EXPIRED_TOKEN:{code:1001,message:"Token expired and is no longer valid",fatal:!0,nominal:!0},UNPUBLISH_FAILURE:{code:1013,message:"Failed to unpublish",fatal:!1,nominal:!1},UNSUBSCRIBE_FAILURE:{code:1014,message:"Failed to unsubscribe",fatal:!1,nominal:!1},PUBLISH_FAILURE:{code:1015,message:"Failed to publish",fatal:!1,nominal:!1},SUBSCRIBE_FAILURE:{code:1016,message:"Failed to subscribe",fatal:!1,nominal:!1},JOIN_FAILURE:{code:1017,message:"Failed to join",fatal:!0,nominal:!1},PUBLISH_TIMED_OUT:{code:1020,message:"Publish timed out",fatal:!1,nominal:!1},SUBSCRIBE_TIMED_OUT:{code:1021,message:"Subscribe timed out",fatal:!1,nominal:!1},NO_CANDIDATES:{code:1022,message:"No ICE candidates",fatal:!1,nominal:!1},OPERATION_ABORTED:{code:1023,message:"Request aborted",nominal:!0,fatal:!1},STAGE_AT_CAPACITY:{code:1024,message:"Stage at capacity",fatal:!0,nominal:!1},INTERNAL_SERVER_ERROR:{code:1025,message:"Internal server error",fatal:!0,nominal:!1},TOKEN_PERMISSIONS_DENIED:{code:1026,message:"Token permissions are not valid for the operation",fatal:!0,nominal:!1},UNKNOWN_PERMISSIONS_ERROR:{code:1099,message:"Service error code unknown or not found",fatal:!0,nominal:!1},WEBSOCKET_MESSAGE_PARSE_FAILURE:{code:1204,message:"Failed to parse websocket message",fatal:!1,nominal:!1},WHIP_SESSION_RESOURCE_DELETED:{code:1206,message:"WHIP signaling session resource not found",fatal:!0,nominal:!0},WHIP_TOO_MANY_REQUESTS:{code:1207,message:"WHIP endpoint received too many requests",fatal:!0,nominal:!1},WHIP_OPTIONS_FAILURE:{code:1501,message:"Failed to get ICE Servers from OPTIONS",fatal:!1,nominal:!1},WHIP_POST_FAILURE:{code:1502,message:"WHIP post failure",fatal:!1,nominal:!1},WHIP_DELETE_FAILURE:{code:1503,message:"WHIP delete failure",fatal:!1,nominal:!1},WHIP_URL_MISSING:{code:1504,message:"WHIP delete failure",fatal:!1,nominal:!1},EVENT_PLANE_CONNECTION_FAILURE:{code:1300,message:"Error connecting to event plane",fatal:!0,nominal:!1},PEER_CONNECTION_NETWORK_FAILURE:{code:1400,message:"PeerConnection is lost due to unknown network error",fatal:!1,nominal:!1},CREATE_OFFER_FAILURE:{code:1402,message:"Failed to set local description",fatal:!1,nominal:!1},CREATE_PEER_CONNECTION_FAILURE:{code:1403,message:"Failed to create a peer connection",fatal:!1,nominal:!1},ICE_CANDIDATE_ERROR:{code:1404,message:"ICE candidate error",fatal:!1,nominal:!1}};var $e;function He(t){const e=atob(t);return JSON.parse(e)}!function(t){t.UNPUBLISH="unpublish",t.UNSUBSCRIBE="unsubscribe",t.UNLOAD="unload",t.CONNECTION_FAIL="connection fail"}($e||($e={}));class StageToken{constructor(t){this.rawToken=t;const e=t.split(".");if(3!==e.length)throw Error(`Token format incorrect. length: ${e.length}`);try{this.header=He(e[0])}catch(t){const e=t instanceof Error?`: ${t.message}`:"";throw Error(`Error parsing Stage Token header${e}`)}try{this.claims=He(e[1])}catch(t){const e=t instanceof Error?`: ${t.message}`:"";throw Error(`Error parsing Stage Token claims${e}`)}this.signature=e[2];const{claims:n}=this;this.stageARN=n.resource,this.participantID=n.jti,this.eventsURL=n.events_url,this.whipURL=n.whip_url,this.userID=n.user_id,this.expirationTime=n.exp,this.topic=n.topic,this.parseVersionFlags(n.version);const{attributes:r}=n;r&&(this.attrGsRole=r.gs_role,this.attrGsSessionId=r.gs_session_id),this.analyticsTracker=AnalyticsTracker.getInstance()}getPublishEndpoint(){let t="";return this.whipURL&&this.participantID&&(t=`${this.whipURL}/publish/${this.participantID}`),t}getSubscribeEndpoint(t){let e="";return this.whipURL&&(e=`${this.whipURL}/subscribe/${t}`),e}assertTokenIsUnexpired(t,e,n,r){(!this.expirationTime||Date.now()/1e3>=this.expirationTime)&&this.analyticsTracker.trackErrorAndThrow(new StageClientError(Object.assign(Object.assign({},ze.EXPIRED_TOKEN),{location:n,tag:e,token:this,traceId:t,remoteParticipantId:r,message:ze.EXPIRED_TOKEN.message,details:`Token expired at ${this.expirationTime} and is no longer valid`})))}parseVersionFlags(t){if(!t)return;const e=t.split(".");2===e.length&&(this.versionFlags=parseInt(e[1],10))}shouldUseTURN(){return void 0===this.versionFlags||0!=(this.versionFlags&Ce)}shouldSendSilentAudio(){return void 0===this.versionFlags||0!=(this.versionFlags&we)}}function Ke(t){return new StageToken(t)}function Je({action:t,identifier:e,token:n,whipURLOverride:r}){let i="";const o=Ke(n);switch(r&&(o.whipURL=r),t){case Se.PUBLISH:i=o.getPublishEndpoint();break;case Se.SUBSCRIBE:e&&(i=o.getSubscribeEndpoint(e))}return i}var Xe=n(9669),Ye=n.n(Xe);class AbortControllersTracker{constructor(){this.abortControllers={},this._isUnloading=!1}static getInstance(){return AbortControllersTracker.instance||(AbortControllersTracker.instance=new AbortControllersTracker),AbortControllersTracker.instance}abortPendingOperations(){Object.entries(this.abortControllers).forEach((([t,e])=>e.abort()))}trackNewAbortController(t){return this.abortControllers[t]=new AbortController,this.abortControllers[t]}removeAbortController(t){delete this.abortControllers[t]}get isUnloading(){return this._isUnloading}set isUnloading(t){this._isUnloading=t}}const Ze=t=>{const e=t=>{var e;return(null===(e=t.deviceId)||void 0===e?void 0:e.startsWith("web-contents-media-stream"))?"tab":void 0},n=t=>{var e;return(null===(e=t.deviceId)||void 0===e?void 0:e.startsWith("window"))&&"window"===t.displaySurface?"window":void 0},r=t=>{var e;return(null===(e=t.deviceId)||void 0===e?void 0:e.startsWith("screen"))&&"monitor"===t.displaySurface?"screen":void 0};return(e(i=t)||n(i)||r(i)?void 0:"camera")||r(t)||n(t)||e(t)||"unknown";var i};function Qe(t,e){return t.find((t=>t.kind===e))}var tn;!function(t){t.VIDEO="video",t.AUDIO="audio"}(tn||(tn={}));class MediaStreamManager{constructor(){this.mediaTracks=new Map([[tn.VIDEO,void 0],[tn.AUDIO,void 0]])}static getOrRegisterInstance(t){let e=this.msmMap.get(t);return e||(e=new MediaStreamManager,this.msmMap.set(t,e)),e}setTrack(t,e){this.mediaTracks.set(t,e)}getTrack(t){return this.mediaTracks.get(t)}}MediaStreamManager.msmMap=new Map;class TraceEvent extends StageAnalyticsEvent{constructor(t,e,n,r,i){super(c.TRACE,t,e,!1),Object.assign(this.properties,{action:r,message:n,remote_participant_id:i})}}function en(t,e,n,r,i){AnalyticsTracker.getInstance().trackEventNoSharedProps(new TraceEvent(t,e,n,r,i))}const nn={STAGE_JOINED:"stageJoined",STAGE_PARTICIPANT_JOINED:"stageParticipantJoined",STAGE_PARTICIPANT_LEFT:"stageParticipantLeft",STAGE_PARTICIPANT_KICKED:"stageParticipantKicked",STAGE_PARTICIPANT_UPDATED:"stageParticipantUpdated",STAGE_REFRESH:"stageRefresh",STATE_CHANGE:"stateChange"},rn={CONNECTION_STATE_CHANGE:"connectionStateChange",STAGE_STREAM_UPDATE:"stageStreamUpdate"},on="open",sn="close",an="messageParseError",cn="refresh",un="connectionFailure",ln="stageStateMessage";class EDPConnectedEvent extends StageAnalyticsEvent{constructor(t){super(c.EDP_CONNECTED,t.token,t.traceId,!1),Object.assign(this.properties,{event_endpoint:t.eventEndpoint,protocol:t.protocol,retry_times:t.numRetries})}}class EDPDisconnectedEvent extends StageAnalyticsEvent{constructor(t){super(c.EDP_DISCONNECTED,t.token,t.traceId,!1),Object.assign(this.properties,{event_endpoint:t.eventEndpoint,protocol:t.protocol})}}class PublishEvent extends StageAnalyticsEvent{constructor(t){super(c.PUBLISH,t.token,t.traceId,!1),Object.assign(this.properties,{action:Se.PUBLISH,remote_participant_id:t.token.participantID})}}class UnpublishEvent extends StageAnalyticsEvent{constructor(t){super(c.UNPUBLISH,t.token,t.traceId,!0),Object.assign(this.properties,{action:Se.PUBLISH,remote_participant_id:t.token.participantID})}}class SubscribeEvent extends StageAnalyticsEvent{constructor(t){super(c.SUBSCRIBE,t.token,t.traceId,!1),Object.assign(this.properties,{action:Se.SUBSCRIBE,remote_participant_id:t.subscribedId,subscribed_id:t.subscribedId})}}class UnsubscribeEvent extends StageAnalyticsEvent{constructor(t){super(c.UNSUBSCRIBE,t.token,t.traceId,!0),Object.assign(this.properties,{action:Se.SUBSCRIBE,remote_participant_id:t.unsubscribedId,unsubscribed_id:t.unsubscribedId})}}class PublishStartedEvent extends StageAnalyticsEvent{constructor(t){super(c.PUBLISH_STARTED,t.token,t.traceId,!1),Object.assign(this.properties,{action:Se.PUBLISH,options_duration:t.optionsDuration,post_duration:t.postDuration,remote_participant_id:t.token.participantID,time_to_candidate:t.timeToCandidate,total_duration:t.totalDuration})}}class PublishEndedEvent extends StageAnalyticsEvent{constructor(t){super(c.PUBLISH_ENDED,t.token,t.traceId,!0),Object.assign(this.properties,{action:Se.PUBLISH,remote_participant_id:t.token.participantID,unpublish_successful:t.isUnpublishSuccessful,reason:t.reason})}}class SubscribeStartedEvent extends StageAnalyticsEvent{constructor(t){super(c.SUBSCRIBE_STARTED,t.token,t.traceId,!1),Object.assign(this.properties,{action:Se.SUBSCRIBE,options_duration:t.optionsDuration,post_duration:t.postDuration,remote_participant_id:t.remoteParticipantId,time_to_candidate:t.timeToCandidate,total_duration:t.totalDuration})}}class SubscribeEndedEvent extends StageAnalyticsEvent{constructor(t){super(c.SUBSCRIBE_ENDED,t.token,t.traceId,!0),Object.assign(this.properties,{action:Se.SUBSCRIBE,remote_participant_id:t.remoteParticipantId,unsubscribe_successful:t.isUnsubscribeSuccessful,reason:t.reason}),this.critical=!0}}class StateUpdatedEvent extends StageAnalyticsEvent{constructor(t){super(c.STATE_UPDATED,t.token,t.traceId,!1),Object.assign(this.properties,{audio_muted:t.isAudioMuted,is_disconnected:t.isDisconnected,is_publishing:t.isPublishing,other_participant_id:t.otherParticipantId,other_participant_user_id:t.otherParticipantUserId,video_stopped:t.isVideoStopped})}}var dn=n(6486);class EDPPongEvent extends StageAnalyticsEvent{constructor(t){super(c.EDP_PONG,t.token,t.traceId,!1),Object.assign(this.properties,{event_endpoint:t.eventEndpoint,protocol:t.protocol,edp_rtt:t.edpRttMs})}}var hn;!function(t){t.MESSAGE="message",t.RESPONSE="response"}(hn||(hn={}));class StageSocket{constructor(t){this.protocol="",this.connecting=!1,this.closing=!1,this.closingForError=!1,this.nextConnectionAttempt=0,this.windowUnloading=!1,this.pingInterval=0,this.pongTimeout=0,this.latestPingTimestamp=0,this.pongCount=0,this.latestSequenceNumber=0,this.beforeUnload=()=>{this.windowUnloading=!0},this.logger=new ScopedLogger(t,ut.SOCKET),this.emitter=new u.EventEmitter,this.analyticsTracker=AnalyticsTracker.getInstance(),this.connectionAttempts=0,this.sentPing=!1,this.receivedPong=!1,this.id=`[${p().value}] `,window.addEventListener("beforeunload",this.beforeUnload)}connect(t,e,n){this.logger.debug({msg:`${this.id}connecting to ${t}`}),this.addr=t||this.addr,this.token=e||this.token,this.traceId=n||this.traceId;const{topic:r,rawToken:i}=this.token;this.connecting=!0,this.closing=!1;try{this.socket=this.createWebSocket(`${this.addr}?topic=${r}/publishers`,i),this.socket.onmessage=this.onMessage.bind(this),this.socket.onerror=this.onError.bind(this),this.socket.onclose=this.onClose.bind(this),this.socket.onopen=this.onOpen.bind(this),this.protocol=this.socket.protocol}catch(t){this.emitter.emit(un,new Error("UnableToConnect"))}}send(t){var e;this.logger.debug({msg:`${this.id}sending ${JSON.stringify(t)}`}),this.isReady()?null===(e=this.socket)||void 0===e||e.send(JSON.stringify(t)):this.logger.warn({msg:"Trying to send data over stage socket that is not ready"})}close(){this.closing=!0,this.connecting=!1,this.emitter.emit(sn),this.closeSocket()}removeAllListeners(){window.removeEventListener("beforeunload",this.beforeUnload),this.emitter.removeAllListeners()}createWebSocket(t,e){return new WebSocket(t,e)}closeForError(){this.closingForError=!0,this.closeSocket()}closeSocket(){var t;this.logger.debug({msg:`${this.id}closing`}),this.clearTimeouts(),null===(t=this.socket)||void 0===t||t.close(),this.socket&&(this.socket.onmessage=null,this.socket.onerror=null,this.socket.onclose=null,this.socket.onopen=null)}on(t,e){this.emitter.on(t,e)}off(t,e){this.emitter.off(t,e)}isReady(){return this.logger.debug({msg:`${this.id}isReady called`}),!!this.socket&&this.socket.readyState===this.socket.OPEN}onMessage(t){this.logger.debug({msg:`${this.id}received message: ${t.data}`});try{const e=JSON.parse(t.data);switch(e.type){case"STAGE_STATE":case"aws:ivs:STAGE_STATE":{const t=e.payload.sequenceNumber;t>this.latestSequenceNumber&&(this.emitter.emit(ln,e),this.latestSequenceNumber=t);break}case"PONG":this.receivedPong=!0,this.pongCount%2==0&&this.analyticsTracker.trackEventNoSharedProps(new EDPPongEvent({token:this.token,eventEndpoint:this.token.eventsURL,protocol:this.protocol,traceId:this.traceId,edpRttMs:performance.now()-this.latestPingTimestamp})),this.pongCount++;break;case"REFRESH":this.emitter.emit(cn);break;default:(0,dn.noop)()}}catch(t){this.logger.debug({msg:`onMessage JSON Parse error: ${t}`}),this.emitter.emit(an,t)}}onError(t){this.logger.debug({msg:`${this.id}error: ${JSON.stringify(t)}`})}onClose(t){if(this.logger.debug({msg:`${this.id}onClose triggered with code (closing = ${this.closing}, closingForError = ${this.closingForError}, connecting = ${this.connecting})`}),this.clearTimeouts(),this.connecting){let t=Math.pow(2,this.connectionAttempts);t>1e3&&(t=1e3),this.logger.debug({msg:`${this.id}reconnecting in ${t} seconds`}),this.connectionAttempts+=1,this.nextConnectionAttempt=window.setTimeout(this.connect.bind(this),1e3*t)}else if(this.closing)this.closing=!1;else if(this.closingForError)this.emitter.emit(un,new Error("ClosedForError")),this.closingForError=!1;else{if(this.windowUnloading)return;this.logger.debug({msg:`${this.id}unexpected close`}),this.emitter.emit(un,new Error("UnintentionalError"))}}onOpen(){this.logger.debug({msg:`${this.id} socket opened`});const t=this.connectionAttempts;this.connectionAttempts=0,this.connecting=!1,this.ping(),this.pingInterval=window.setInterval(this.ping.bind(this),3e4),this.emitter.emit(on,{attempts:t})}ping(){var t;this.logger.debug({msg:`${this.id}sending PING`});try{this.latestPingTimestamp=performance.now(),null===(t=this.socket)||void 0===t||t.send(JSON.stringify({type:"PING"})),this.sentPing=!0,this.receivedPong=!1,this.pongTimeout&&clearTimeout(this.pongTimeout),this.pongTimeout=window.setTimeout(this.pongTimedOut.bind(this),5e3)}catch(t){this.closeForError()}}pongTimedOut(){this.sentPing&&!this.receivedPong&&(this.logger.debug({msg:`${this.id}Pong timed out!`}),this.closeForError())}clearTimeouts(){this.sentPing=this.receivedPong=!1,clearTimeout(this.pongTimeout),clearInterval(this.pingInterval),clearTimeout(this.nextConnectionAttempt)}}class TypedEmitter{constructor(){this.emitter=new u}on(t,e){e.call=function(t,e){return function(n,...r){try{e.apply(n,r)}catch(n){let r=`Error in callback for ${t}`;const i=e.name;return i&&(r+=` for function ${i}`),void console.error(`${r}\n`,n)}}}(t,e),this.emitter.on(t,e)}off(t,e){this.emitter.off(t,e)}emit(t,...e){this.emitter.emit(t,...e)}removeAllListeners(){this.emitter.removeAllListeners()}}var pn=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))};var fn;!function(t){t.DISCONNECTED="disconnected",t.CONNECTING="connecting",t.CONNECTED="connected",t.ERRORED="errored"}(fn||(fn={}));class StageConnection extends TypedEmitter{constructor(t){super(),this.nonScopedLogger=t,this.participants=new Map,this.disconnected=[],this.state={value:fn.DISCONNECTED,context:{hasConnected:!1}},this.onConnecting=(t,e)=>{if(this.logger.debug({msg:"onConnecting",context:t,event:e}),"RECONNECT"===e.type&&this.stageSocket.close(),"CONNECT"===e.type&&(t.token=e.payload.token,t.traceId=e.payload.traceId),!t.token||!t.traceId)return void this.logger.warn({msg:"Attempting a connect but no token OR traceId provided"});const{eventsURL:n}=t.token;this.stageSocket.connect(n,t.token,t.traceId),this.emit(nn.STATE_CHANGE,fn.CONNECTING),this.state.value=fn.CONNECTING},this.onConnected=(t,e)=>{this.logger.debug({msg:"onConnected",context:t,event:e}),t.hasConnected=!0,this.emit(nn.STAGE_JOINED),this.emit(nn.STATE_CHANGE,fn.CONNECTED),this.state.value=fn.CONNECTED},this.onDisconnected=t=>{this.logger.debug({msg:"onDisconnected",context:t}),this.stageSocket.close(),t.hasConnected=!1,delete t.traceId,delete t.token,this.emit(nn.STATE_CHANGE,fn.DISCONNECTED),this.state.value=fn.DISCONNECTED},this.onErrored=(t,e)=>{this.logger.error({msg:"Connection failure occurred",err:e.payload.error}),this.emit(nn.STATE_CHANGE,fn.ERRORED),this.state.value=fn.ERRORED,t.hasConnected&&t.token&&t.traceId?this.processStateUpdate({type:"RECONNECT"}):this.stageSocket.close()},this.processStateUpdate=t=>{const e=this.state.value,n=this.state.context;switch(e){case fn.DISCONNECTED:"CONNECT"===t.type&&this.onConnecting(n,t);break;case fn.CONNECTING:"RECONNECT"===t.type?this.onConnecting(n,t):"DISCONNECT"===t.type?this.onDisconnected(n):"CONNECT_SUCCESS"===t.type?this.onConnected(n,t):"ERROR"===t.type&&this.onErrored(n,t);break;case fn.CONNECTED:"RECONNECT"===t.type?this.onConnecting(n,t):"DISCONNECT"===t.type?this.onDisconnected(n):"ERROR"===t.type&&this.onErrored(n,t);break;case fn.ERRORED:"RECONNECT"===t.type?this.onConnecting(n,t):"DISCONNECT"===t.type&&this.onDisconnected(n)}},this.trackConnectedEvent=(t,e,n)=>{this.analyticsTracker.trackEventNoSharedProps(new EDPConnectedEvent({token:t,eventEndpoint:t.eventsURL,numRetries:n,protocol:this.stageSocket.protocol,traceId:e}))},this.trackDisconnectedEvent=(t,e)=>{this.analyticsTracker.trackEventNoSharedProps(new EDPDisconnectedEvent({token:t,eventEndpoint:t.eventsURL,protocol:this.stageSocket.protocol,traceId:e}))},this.trackMessageParseError=(t,e)=>n=>{this.logger.error({msg:"Message Parse Error occurred",err:n});const r=new StageClientError({token:t,traceId:e,code:ze.WEBSOCKET_MESSAGE_PARSE_FAILURE.code,tag:Ve.JOIN_RELATED,location:"onMessage",message:ze.WEBSOCKET_MESSAGE_PARSE_FAILURE.message,details:n.message});this.analyticsTracker.trackEventNoSharedProps(new StageErrorEvent(r))},this.onStageStateMessage=(t,e)=>n=>{var r,i;this.logger.debug({msg:"State Stage Message occurred",state:n});const o=n.payload,s=null!==(r=o.participants)&&void 0!==r?r:[],a=null!==(i=o.disconnected)&&void 0!==i?i:[],c=[],u=[],l=(n,r)=>{this.analyticsTracker.trackEventNoSharedProps(new StateUpdatedEvent({token:t,otherParticipantId:n.id,otherParticipantUserId:n.userId,isAudioMuted:n.audioMuted,isVideoStopped:n.videoStopped,isPublishing:n.isPublishing,isDisconnected:r,traceId:e}))};this.participants.forEach((t=>{const e=s.find((e=>e.id===t.id));if(e){let n=!0,r=!1;["isPublishing","id","audioMuted","joinedAt","userId","videoStopped"].forEach((i=>{n=n&&e[i.toString()]===t[i.toString()],n||(t[i.toString()]=e[i.toString()],r=!0)})),Object.keys(t.attributes).forEach((i=>{n=n&&e.attributes[i]===t.attributes[i],n||(t.attributes=e.attributes,r=!0)})),r&&(l(t,!1),this.emit(nn.STAGE_PARTICIPANT_UPDATED,e))}else u.push(t)})),s.forEach((t=>{this.participants.get(t.id)||c.push(t)})),u.forEach((t=>{this.participants.delete(t.id),l(t,!0),this.emit(nn.STAGE_PARTICIPANT_LEFT,t)})),c.forEach((t=>{this.participants.set(t.id,t),l(t,!1),this.emit(nn.STAGE_PARTICIPANT_JOINED,t)})),a.forEach((t=>{this.disconnected.find((e=>e.id===t.id))||(this.disconnected.push(t),"KICKED"===t.status&&this.emit(nn.STAGE_PARTICIPANT_KICKED,t))})),this.disconnected=a},this.analyticsTracker=AnalyticsTracker.getInstance(),this.nonScopedLogger=t,this.logger=new ScopedLogger(t,ut.CONNECTION),this.stageSocket=new StageSocket(this.nonScopedLogger)}connect(t,e){return pn(this,void 0,void 0,(function*(){return this.logger.debug({msg:"connect invoked",token:t,traceId:e}),this.state.value!==fn.DISCONNECTED&&(this.logger.debug({msg:"Disconnecting previous connection"}),this.processStateUpdate({type:"DISCONNECT"}),window.clearTimeout(this.connectTimeout)),new Promise(((n,r)=>{this.connectTimeout=window.setTimeout((()=>{this.logger.debug({msg:"Attempt to connect timed out"});const t=new Error("InitialConnectTimedOut");this.processStateUpdate({type:"ERROR",payload:{error:t}}),r(t)}),1e4),this.stageSocket.on(on,(r=>{const{attempts:i}=r;window.clearTimeout(this.connectTimeout),this.trackConnectedEvent(t,e,i),this.processStateUpdate({type:"CONNECT_SUCCESS"}),n()})),this.stageSocket.on(un,(t=>{this.processStateUpdate({type:"ERROR",payload:{error:t}})})),this.stageSocket.on(cn,(()=>{this.logger.debug({msg:"Refresh event occurred"}),this.emit(nn.STAGE_REFRESH),this.processStateUpdate({type:"RECONNECT"})})),this.stageSocket.on(sn,(()=>{this.logger.debug({msg:"Close event occurred"}),this.trackDisconnectedEvent(t,e)})),this.stageSocket.on(ln,this.onStageStateMessage(t,e)),this.stageSocket.on(an,this.trackMessageParseError(t,e)),this.processStateUpdate({type:"CONNECT",payload:{token:t,traceId:e}})}))}))}disconnect(){this.logger.debug({msg:"disconnect invoked"});const t=this.state.context.traceId;return this.processStateUpdate({type:"DISCONNECT"}),this.participants=new Map,this.disconnected=[],this.stageSocket.removeAllListeners(),t}getParticipant(t){return this.participants.get(t)}listConnectedParticipants(){const t=[];return this.participants.forEach((e=>{e.subscribed&&t.push(e)})),t}listAvailableParticipants(){return Array.from(this.participants.values())}emitStageState(t,e){this.stageSocket.send({audioMuted:t,type:"SET_STATE",version:"0",videoStopped:e})}}const gn={CONNECTION_STATE_CHANGE:"connectionStateChange",ERROR:"clientError",ACTIVE_STATE_CHANGE:"activeStateChange"},vn="connectionStateChange",mn="clientError";var yn,_n,bn;!function(t){t.CLOSED="closed",t.COMPLETED="completed",t.CONNECTED="connected",t.CONNECTING="connecting",t.DISCONNECTED="disconnected",t.FAILED="failed",t.IDLE="idle",t.NEW="new",t.NONE="none"}(yn||(yn={}));class ThrottleTimer{constructor(t,e){this.throttleDuration=0,this.throttled=!1,this.timeout=0,this.unthrottle=()=>{this.trailing&&this.trailingFn&&this.trailingFn(...this.trailingFnArgs),this.clear()},this.throttleDuration=t,this.trailing=!(e&&e.skipTrailing)}invoke(t,...e){return this.throttled?(this.trailingFn=t,this.trailingFnArgs=e,!1):(this.throttled=!0,this.timeout=window.setTimeout(this.unthrottle,this.throttleDuration),t(...e),!0)}clear(){clearTimeout(this.timeout),this.timeout=0,this.throttled=!1,delete this.trailingFn,delete this.trailingFnArgs}}class SDPFmtpLine{constructor(){this.levelAsymmetryAllowed=!1,this.packetisationMode=!1,this.profile="",this.level=0}extractVideoSdpFmtpLine(t){if(!t)return{levelAsymmetryAllowed:this.levelAsymmetryAllowed,packetisationMode:this.packetisationMode,profile:this.profile,level:this.level};return t.split("\r").join(";").split("\n").join(";").split(" ").join(";").split(";").map((t=>t.trim())).filter(Boolean).forEach((t=>{const e=t.split("=");if(2===e.length)switch(e[0]){case"level-asymmetry-allowed":"1"===e[1]?this.levelAsymmetryAllowed=!0:this.levelAsymmetryAllowed=!1;break;case"packetization-mode":"1"===e[1]?this.packetisationMode=!0:this.packetisationMode=!1;break;case"profile-level-id":this.profile=this.getProfileFromId(e[1]),this.level=this.getLevelFromId(e[1])}})),{levelAsymmetryAllowed:this.levelAsymmetryAllowed,packetisationMode:this.packetisationMode,profile:this.profile,level:this.level}}getProfileFromId(t){const e=t.substr(0,2),n=t.substr(2,2);switch(e.substr(0,2)){case"42":return"baseline";case"4d":return"main";case"58":return"extended";case"64":return"high";case"6e":return"00"===n?"high 10":"high 10 intra";case"7a":return"00"===n?"high 42":"high 42 intra";case"f4":return"00"===n?"high 44":"high 44 intra";default:return"unknown"}}getLevelFromId(t){return parseInt(t.substr(4,2),16)}}class CongestionTimeEvent{constructor(t,e){this.transformProperties=(t,e)=>({sum:t.sum,median:t.median(),min:t.min,max:t.max,p90:t.percentile(.9),event_count:t.data.length,period:e});const n=this.transformProperties(t,e);this.data={event:_n.CONGESTION_TIME,properties:n}}}class ConnectionEstablishedEvent{constructor(t,e,n){this.transformProperties=(t,e,n)=>({duration:(t.getTime()-((null==e?void 0:e.getTime())||0))/1e3,ecn_negotiated:!1,ingest_session_id:n});const r=this.transformProperties(t,e,n);this.data={event:_n.CONNECTION_ESTABLISHED,properties:r}}}class ConnectionRTTEvent{constructor(t,e){this.transformProperties=(t,e)=>({sum:t.sum,median:t.median(),min:t.min,max:t.max,p90:t.percentile(.9),event_count:t.data.length,period:e});const n=this.transformProperties(t,e);this.data={event:_n.CONNECTION_RTT,properties:n}}}class ErrorEvent{constructor(t){this.transformProperties=t=>{var e;return{is_fatal:null!==(e=t.isFatal)&&void 0!==e&&e,value:t.value,code:t.code,description:t.description}};const e=this.transformProperties(t);this.data={event:_n.ERROR,properties:e}}}class InputDeviceAttachedEvent{constructor(t,e){this.transformProperties=(t,e)=>({type:t,input_device_id:e.deviceId,position:e.facingMode||"unknown"});const n=this.transformProperties(t,e);this.data={event:_n.INPUT_DEVICE_ATTACHED,properties:n}}}class InputDeviceDetachedEvent{constructor(t,e){this.transformProperties=(t,e)=>({type:t,input_device_id:e.deviceId,position:e.facingMode||"unknown"});const n=this.transformProperties(t,e);this.data={event:_n.INPUT_DEVICE_DETACHED,properties:n}}}class MeasuredBitrateEvent{constructor(t,e){this.transformProperties=(t,e)=>({sum:t.sum,median:t.median(),min:t.min,max:t.max,p90:t.percentile(.9),event_count:t.data.length,period:e});const n=this.transformProperties(t,e);this.data={event:_n.MEASURED_BITRATE,properties:n}}}class MinuteBroadcastEvent{constructor(t,e){this.transformProperties=(t,e)=>({minutes_logged:Math.round((t.timestamp-e)/6e4)});const n=this.transformProperties(t,e);this.data={event:_n.MINUTE_BROADCAST,properties:n}}}class RecommendedBitrateEvent{constructor(t,e){this.transformProperties=(t,e)=>({sum:t.sum,median:t.median(),min:t.min,max:t.max,p90:t.percentile(.9),event_count:t.data.length,period:e});const n=this.transformProperties(t,e);this.data={event:_n.RECOMMENDED_BITRATE,properties:n}}}class SessionAudioEncoderConfiguredEvent{constructor(t){this.transformProperties=t=>({codec:t.mimeType,bitrate:0,sample_rate:t.clockRate,channel_count:t.channels});const e=this.transformProperties(t);this.data={event:_n.SESSION_AUDIO_ENCODER_CONFIGURED,properties:e}}}class SessionAudioPropertiesEvent{constructor(t){this.transformProperties=t=>({codec:"audio",bitrate:32e3,sample_rate:t.sampleRate,channel_count:t.channelCount});const e=this.transformProperties(t);this.data={event:_n.SESSION_AUDIO_PROPERTIES,properties:e}}}class SessionVideoEncoderConfiguredEvent{constructor(t,e,n){this.transformProperties=(t,e,n)=>({codec:n.mimeType,codec_profile:e.profile,codec_level:e.level,rate_mode:"vbr",initial_bitrate:0,keyframe_interval:2,width:t.width,height:t.height,bframe_count:0,target_fps:t.frameRate});const r=this.transformProperties(t,e,n);this.data={event:_n.SESSION_VIDEO_ENCODER_CONFIGURED,properties:r}}}class SessionVideoPropertiesEvent{constructor(t){this.transformProperties=t=>({codec:"video",initial_bitrate:32e3,min_bitrate:0,max_bitrate:0,keyframe_interval:2,width:t.width,height:t.height,auto_bitrate_enabled:!0,bframes_enabled:!1,target_fps:t.frameRate});const e=this.transformProperties(t);this.data={event:_n.SESSION_VIDEO_PROPERTIES,properties:e}}}class SourceAudioLatencyEvent{constructor(t,e){this.transformProperties=(t,e)=>({sum:t.sum,median:t.median(),min:t.min,max:t.max,p90:t.percentile(.9),event_count:t.data.length,period:e});const n=this.transformProperties(t,e);this.data={event:_n.SOURCE_AUDIO_LATENCY,properties:n}}}class SourceVideoLatencyEvent{constructor(t,e){this.transformProperties=(t,e)=>({sum:t.sum,median:t.median(),min:t.min,max:t.max,p90:t.percentile(.9),event_count:t.data.length,period:e});const n=this.transformProperties(t,e);this.data={event:_n.SOURCE_VIDEO_LATENCY,properties:n}}}class StartBroadcastEvent{constructor(t,e){this.transformProperties=({protocol:t,hostname:e,port:n},r)=>({protocol:t,endpoint_host:e,endpoint_port:n,reason:r});const n=this.transformProperties(t,e);this.data={event:_n.START_BROADCAST,properties:n}}}class StopBroadcastEvent{constructor(t){this.transformProperties=({protocol:t,hostname:e,port:n})=>({protocol:t,endpoint_host:e,endpoint_port:n});const e=this.transformProperties(t);this.data={event:_n.STOP_BROADCAST,properties:e}}}class WebRTCAudioStatsEvent{constructor(t){this.transformProperties=t=>({bytes_sent:t.bytesSent,header_bytes_sent:t.headerBytesSent,nack_count:t.nackCount,packets_sent:t.packetsSent,retransmitted_bytes_sent:t.retransmittedBytesSent,retransmitted_packets_sent:t.retransmittedPacketsSent});const e=this.transformProperties(t);this.data={event:_n.WEBRTC_AUDIO_STATS,properties:e}}}class WebRTCVideoStatsEvent{constructor(t){this.transformProperties=t=>({bytes_sent:t.bytesSent,fir_count:t.firCount,frames_encoded:t.framesEncoded,frames_sent:t.framesSent,header_bytes_sent:t.headerBytesSent,huge_frames_sent:t.hugeFramesSent,key_frames_encoded:t.keyFramesEncoded,nack_count:t.nackCount,packets_sent:t.packetsSent,pli_count:t.pliCount,quality_limitation_reason:t.qualityLimitationReason,quality_limitation_resolution_changes:t.qualityLimitationResolutionChanges,retransmitted_bytes_sent:t.retransmittedBytesSent,retransmitted_packets_sent:t.retransmittedPacketsSent,total_encode_time:t.totalEncodeTime,total_encoded_bytes_target:t.totalEncodedBytesTarget,total_packet_send_delay:t.totalPacketsSendDelay});const e=this.transformProperties(t);this.data={event:_n.WEBRTC_VIDEO_STATS,properties:e}}}function En(t){return btoa(JSON.stringify(t))}!function(t){t.START_BROADCAST="ivs_broadcast_start_broadcast",t.STOP_BROADCAST="ivs_broadcast_stop_broadcast",t.MINUTE_BROADCAST="ivs_broadcast_minute_broadcast",t.WEBRTC_AUDIO_STATS="ivs_broadcast_webrtc_audio_stats",t.WEBRTC_VIDEO_STATS="ivs_broadcast_webrtc_video_stats",t.CONNECTION_ESTABLISHED="ivs_broadcast_connection_established",t.SESSION_VIDEO_PROPERTIES="ivs_broadcast_session_video_properties",t.SESSION_AUDIO_PROPERTIES="ivs_broadcast_session_audio_properties",t.SESSION_VIDEO_ENCODER_CONFIGURED="ivs_broadcast_session_video_encoder_configured",t.SESSION_AUDIO_ENCODER_CONFIGURED="ivs_broadcast_session_audio_encoder_configured",t.SOURCE_AUDIO_LATENCY="ivs_broadcast_source_audio_latency",t.SOURCE_VIDEO_LATENCY="ivs_broadcast_source_video_latency",t.INPUT_DEVICE_ATTACHED="ivs_broadcast_input_device_attached",t.INPUT_DEVICE_DETACHED="ivs_broadcast_input_device_detached",t.CONGESTION_TIME="ivs_broadcast_congestion_time",t.BUFFER_DURATION="ivs_broadcast_buffer_duration",t.MEASURED_BITRATE="ivs_broadcast_measured_bitrate",t.RECOMMENDED_BITRATE="ivs_broadcast_recommended_bitrate",t.CONNECTION_RTT="ivs_broadcast_connection_rtt",t.ERROR="ivs_broadcast_error"}(_n||(_n={})),function(t){t.USER_INITIATED="user-initiated",t.NETWORK_DISCONNECT="network-disconnect"}(bn||(bn={}));var Sn,Cn=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))};!function(t){t.IDLE="idle",t.EXECUTING="executing",t.RECONNECTING="reconnecting"}(Sn||(Sn={}));class BaseReconnectStrategy{constructor(t,e=12e4,n,r){this.state=Sn.IDLE,this.failureCallback=()=>{},this.peerClient=t,this.timeout=e,this.logger=n,this.emitter=r}onFailure(t){this.failureCallback=t}setStartConfig(t,e){this.ingestEndpoint=t,this.streamKey=e}execute(){const{id:t}=this;this.state===Sn.IDLE&&(this.state=Sn.EXECUTING,this.emitter.emit(gn.CONNECTION_STATE_CHANGE,yn.CONNECTING),this.logger.info({msg:"Starting execution of reconnect strategy.",id:t}),this.startTimeoutTimer(this.timeout),this.executeStrategy())}startTimeoutTimer(t){this.timeoutTimerId=window.setTimeout((()=>{this.state!==Sn.IDLE&&(this.logger.info({msg:"Reconnect strategy timed out."}),this.stop(),this.emitter.emit(gn.CONNECTION_STATE_CHANGE,yn.FAILED),this.failureCallback())}),t)}stop(){this.state=Sn.IDLE,clearTimeout(this.timeoutTimerId),this.stopStrategy()}reconnect(){return Cn(this,void 0,void 0,(function*(){if(this.ingestEndpoint&&this.streamKey){const t=this.peerClient.getConnectionState();try{this.logger.info({msg:"Attempting reconnect."}),t===yn.CONNECTED?this.logger.info({msg:"Already connected! Stopping reconnect strategy."}):(yield this.peerClient.start(this.ingestEndpoint,this.streamKey),this.logger.info({msg:"Reconnect succeeded!"})),this.stop()}catch(t){throw this.logger.error({err:t}),t}}}))}isActive(){return this.state!==Sn.IDLE}}class ExponentialBackoffStrategy extends BaseReconnectStrategy{constructor(){super(...arguments),this.id="ExponentialBackoffStrategy"}executeStrategy(){let t=5e3;const e=()=>Cn(this,void 0,void 0,(function*(){if(this.state===Sn.EXECUTING)try{this.state=Sn.RECONNECTING,yield this.reconnect()}catch(n){this.logger.warn({msg:"Attempted reconnect failed. Trying again in: ",nextRetry:t}),this.state=Sn.EXECUTING,this.currentTimeoutId=window.setTimeout(e,t),t*=2}}));this.currentTimeoutId=window.setTimeout(e,0)}stopStrategy(){clearTimeout(this.currentTimeoutId)}}class NetworkApiStrategy extends BaseReconnectStrategy{constructor(){super(...arguments),this.id="NetworkApiStrategy",this.onConnectionChange=()=>Cn(this,void 0,void 0,(function*(){if(navigator.onLine&&this.state===Sn.EXECUTING){this.state=Sn.RECONNECTING;try{yield this.reconnect()}catch(t){this.logger.warn({msg:"Attempted reconnect failed."}),this.state=Sn.EXECUTING}}}))}executeStrategy(){navigator.connection.addEventListener("change",this.onConnectionChange),this.onConnectionChange()}stopStrategy(){navigator.connection.removeEventListener("change",this.onConnectionChange)}}class PeerClientReconnectStrategyFactory{static create(t,e=ue,n,r){const{reconnect:i,timeout:o}=e;if(i){const e=d.getParser(navigator.userAgent).getBrowserName().toLowerCase();return["edge","chrome"].includes(e)&&navigator.connection?new NetworkApiStrategy(t,o,n,r):new ExponentialBackoffStrategy(t,o,n,r)}}}var wn,Tn=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))},In=function(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)};const Rn=t=>!!t;function An(t){if(!t)throw new Error("PeerConnection is not defined")}const kn={bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",enableDtlsSrtp:{exact:!0},enableRtpDataChannels:{exact:!1},optional:[{googHighStartBitrate:{exact:0}},{googPayloadPadding:{exact:!0}},{googScreencastMinBitrate:{exact:100}},{googCpuOveruseDetection:{exact:!0}},{googCpuOveruseEncodeUsage:{exact:!0}},{googCpuUnderuseThreshold:{exact:55}},{googCpuOveruseThreshold:{exact:85}},{enableDscp:{exact:!0}}]};class PeerClient{constructor(t,e,n,r){this.config=t,this.emitter=e,this.mediaStreamManager=n,this.establishConnection=(t,e)=>Tn(this,void 0,void 0,(function*(){var n,r,i;An(this.peerConnection);try{const n=yield this.peerConnection.createOffer({offerToReceiveAudio:!1,offerToReceiveVideo:!1});yield this.handleLocalDescription(n),yield this.sendSetupRequest(t,e,n)}catch(t){if(t instanceof Error){null!==(n=(i=t).code)&&void 0!==n||(i.code=Rt.code);const e=new BroadcastClientError(Object.assign(Object.assign({},Rt),{name:t.name,message:t.message,code:null==t?void 0:t.code,cause:t}));throw(null===(r=this.reconnectStrategy)||void 0===r?void 0:r.isActive())||this.handleError(t.code,t.message),this.stop(),e}}})),this.getSessionId=()=>this.ingestSessionId,this.getConnectionState=()=>{var t;if(!this.peerConnection)return yn.NONE;const e=null===(t=this.reconnectStrategy)||void 0===t?void 0:t.isActive(),n=this.peerConnection.connectionState||this.peerConnection.iceConnectionState;switch(n){case"new":return yn.NEW;case"closed":return yn.CLOSED;case"disconnected":return e?yn.CONNECTING:yn.DISCONNECTED;case"failed":return e?yn.CONNECTING:yn.FAILED;case"idle":return yn.IDLE;case"checking":case"connecting":return yn.CONNECTING;case"completed":case"connected":return yn.CONNECTED;default:return this.logger.warn({msg:"Unhandled connection state:",rawState:n}),yn.IDLE}},this.onConnectionStateChange=()=>{var t;const e=this.getConnectionState();switch(e){case yn.CONNECTED:{this.emitter.emit(gn.CONNECTION_STATE_CHANGE,e);const n=new Date;this.analyticsTracker.trackEvent(new ConnectionEstablishedEvent(n,this.connectionStartDate,this.ingestSessionId));const r=this.mediaStreamManager.getTrack(tn.AUDIO),i=this.mediaStreamManager.getTrack(tn.VIDEO);if(i){const t=i.getSettings();this.analyticsTracker.trackEvent(new SessionVideoPropertiesEvent(t))}if(r){const t=r.getSettings();this.analyticsTracker.trackEvent(new SessionAudioPropertiesEvent(t))}((null===(t=this.peerConnection)||void 0===t?void 0:t.getSenders())||[]).forEach((t=>{var e;((null===(e=t.getParameters())||void 0===e?void 0:e.codecs)||[]).forEach((e=>{var n;switch(null===(n=t.track)||void 0===n?void 0:n.kind){case"video":{if(!i)break;const t=(new SDPFmtpLine).extractVideoSdpFmtpLine(e.sdpFmtpLine),n=i.getSettings();this.analyticsTracker.trackEvent(new SessionVideoEncoderConfiguredEvent(n,t,e));break}case"audio":if(!r)break;this.analyticsTracker.trackEvent(new SessionAudioEncoderConfiguredEvent(e))}}))}));break}case yn.CONNECTING:this.emitter.emit(gn.CONNECTION_STATE_CHANGE,e),this.connectionStartDate=new Date,this.disconnectionStartDate=void 0;break;case yn.FAILED:this.reconnectStrategy?this.reconnectStrategy.execute():(this.emitter.emit(gn.CONNECTION_STATE_CHANGE,e),this.handleTerminalConnectionFailure());break;case yn.DISCONNECTED:this.emitter.emit(gn.CONNECTION_STATE_CHANGE,e),this.disconnectionStartDate=new Date;break;default:this.emitter.emit(gn.CONNECTION_STATE_CHANGE,e)}},this.handleLocalDescription=t=>Tn(this,void 0,void 0,(function*(){var e;return null===(e=this.peerConnection)||void 0===e?void 0:e.setLocalDescription(t)})),wn.set(this,(t=>{if("string"!=typeof t)throw new BroadcastClientError(Nt);try{new URL(t)}catch(t){throw new BroadcastClientError(Dt)}})),this.logger=new ScopedLogger(r,ut.WEBRTC),this.analyticsTracker=AnalyticsTracker.getInstance(),this.createReconnectStrategy(t)}start(t,e){var n;return Tn(this,void 0,void 0,(function*(){In(this,wn,"f").call(this,t);const r=[this.mediaStreamManager.getTrack(tn.VIDEO),this.mediaStreamManager.getTrack(tn.AUDIO)].filter(Rn);this.createPeerConnection(),this.addTracks({tracks:r}),this.reconnectStrategy&&this.reconnectStrategy.setStartConfig(t,e),yield this.establishConnection(t,e);if(null===(n=this.reconnectStrategy)||void 0===n?void 0:n.isActive()){const e=new URL(t);this.analyticsTracker.trackEvent(new StartBroadcastEvent({protocol:"webrtc",hostname:e.hostname,port:e.port},bn.NETWORK_DISCONNECT))}}))}stop(){var t,e,n,r;this.stateCheckInterval&&(clearInterval(this.stateCheckInterval),this.stateCheckInterval=void 0),this.stopStreamDataChannel&&"open"===this.stopStreamDataChannel.readyState&&this.stopStreamDataChannel.send(" "),[yn.NEW,yn.CONNECTING,yn.CONNECTED].includes(this.getConnectionState())&&this.emitter.emit(gn.CONNECTION_STATE_CHANGE,yn.CLOSED),null===(t=this.peerConnection)||void 0===t||t.close(),null===(e=this.peerConnection)||void 0===e||e.removeEventListener("connectionstatechange",this.onConnectionStateChange),null===(n=this.peerConnection)||void 0===n||n.removeEventListener("iceconnectionstatechange",this.onConnectionStateChange),this.ingestSessionId=void 0,null===(r=this.reconnectStrategy)||void 0===r||r.stop()}addTracks(t){var e;if(An(this.peerConnection),!t)return;const n=this.peerConnection.getSenders().map((t=>{var e;return null===(e=t.track)||void 0===e?void 0:e.id})),r=t.tracks.filter((t=>!n.includes(t.id)));for(const t of r)null===(e=this.peerConnection)||void 0===e||e.addTrack(t)}getReports(){var t;return Tn(this,void 0,void 0,(function*(){try{const e=(yield null===(t=this.peerConnection)||void 0===t?void 0:t.getStats())||[],n=[];return e.forEach((t=>{n.push(t)})),n}catch(t){return[]}}))}sendSetupRequest(t,e,n){var r;return Tn(this,void 0,void 0,(function*(){const i=yield fetch(`${t}/v1/offer`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Object.assign({offer:En(n),streamKey:e},this.config.streamConfig))});if(!i.ok)throw function(t){let e=new BroadcastClientError(Object.assign({},Rt));(null==t?void 0:t.code)===ot&&(e=new BroadcastClientError(Object.assign({},kt)));(null==t?void 0:t.message)&&(e.message=t.message);return e}(yield i.json());const o=yield i.json();(null==o?void 0:o.answer)&&(yield null===(r=this.peerConnection)||void 0===r?void 0:r.setRemoteDescription(function(t){return JSON.parse(atob(t))}(o.answer)),this.ingestSessionId=o.ingestSessionId)}))}handleTerminalConnectionFailure(){const t=new BroadcastClientError(At);this.handleError(t.code,t.message)}handleError(t,e){this.analyticsTracker.trackEvent(new ErrorEvent({code:t,description:e,isFatal:!0})),this.emitter.emit(gn.ERROR,{code:t,message:e})}createPeerConnection(){var t;const e=this.getConnectionState(),n=e!==yn.NONE,r=e!==yn.CLOSED,i=null===(t=this.reconnectStrategy)||void 0===t?void 0:t.isActive();n&&r&&!i||(this.stateCheckInterval&&(clearInterval(this.stateCheckInterval),this.stateCheckInterval=void 0),this.stateCheckInterval=window.setInterval((()=>{const t=this.getConnectionState();if(this.reconnectStrategy&&t===yn.DISCONNECTED&&this.disconnectionStartDate){const t=Date.now()-this.disconnectionStartDate.getTime();this.logger.info({msg:"Time since disconnected:",timeSinceDisconnect:t}),t>1e4&&(this.disconnectionStartDate=void 0,this.reconnectStrategy.execute())}else t===yn.CLOSED&&(this.handleTerminalConnectionFailure(),clearInterval(this.stateCheckInterval),this.stateCheckInterval=void 0)}),1e3),this.peerConnection=new RTCPeerConnection(kn),this.stopStreamDataChannel=this.peerConnection.createDataChannel("stopStream"),this.peerConnection.addEventListener("connectionstatechange",this.onConnectionStateChange),this.peerConnection.addEventListener("iceconnectionstatechange",this.onConnectionStateChange))}createReconnectStrategy(t){if(this.reconnectStrategy=PeerClientReconnectStrategyFactory.create(this,t.networkReconnectConfig,this.logger,this.emitter),this.reconnectStrategy){this.reconnectStrategy.onFailure(this.handleTerminalConnectionFailure.bind(this));const t=this.reconnectStrategy.id;this.logger.info({msg:"Using reconnect strategy:",strategyId:t})}}}wn=new WeakMap;class ServerRequestEvent extends StageAnalyticsEvent{constructor(t,e,n,r,i,o,s){super(c.SERVER_REQUEST,e,s,!0),Object.assign(this.properties,{action:t,http_method:r,remote_participant_id:o,request_uuid:i,url:n})}}const On="draft-ietf-wish-whip-04";var Pn=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))};function Nn(t,e){return Pn(this,void 0,void 0,(function*(){t.validateStatus=t=>t>=200&&t<300||403===t;const n=yield Ye()(t);if(403===n.status){if(2003===n.data.code)throw new Xe.AxiosError("Request failed with status code 403","ERR_BAD_REQUEST",t,n.request,n);return t.url===n.request.responseURL?(t.validateStatus=t=>t>=200&&t<300,Ye()(t)):(t.url=n.request.responseURL,e<5?Nn(t,e+1):(t.validateStatus=t=>t>=200&&t<300,Ye()(t)))}return n}))}function Dn(t){return Pn(this,void 0,void 0,(function*(){return Nn(t,0)}))}var xn=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))};function Mn({action:t,identifier:e,token:n,traceId:r,tag:i}){return xn(this,void 0,void 0,(function*(){const o=Ke(n),s=p(),a=AnalyticsTracker.getInstance();try{const i=Je({action:t,identifier:e,token:n});if(!i)throw Error("Could not find URL in token");const c="OPTIONS";a.trackEventNoSharedProps(new ServerRequestEvent(t,o,i,c,s.value,e,r));const u=AbortControllersTracker.getInstance().trackNewAbortController(e),{headers:l,request:d}=yield Dn({headers:{Authorization:`Bearer ${n}`,"X-Stages-Platform":"web","X-Stages-Request-ID":s.value,"X-Stages-SDK":"1.3.2","X-Stages-Session-ID":m(o),"X-Stages-Trace-ID":r.value,"X-Stages-WHIP-Version":On},method:c,url:i,signal:u.signal});if(!l.link)throw Error("Headers returned from OPTIONS request missing link entry");const h=[];if(l.link.split(",").forEach((t=>{const e={credential:"",urls:"",username:""};t.split(";").forEach((t=>{const n=t.split(/=(.*)/s);if(t.startsWith("turn:")||t.startsWith("<turn:")){let n=t.trim();n.startsWith("<turn:")&&n.endsWith(">")&&(n=n.slice(1,-1)),e.urls=n}else if(3===n.length){const t=n[1].trim().slice(1,-1);switch(n[0].trim()){case"credential":e.credential=t;break;case"username":e.username=t}}})),""!==e.credential&&""!==e.urls&&""!==e.username&&h.push(e)})),0===h.length)throw Error("OPTIONS response contained link header, but no valid ICE Servers");return{iceCredentials:h,responseURL:d.responseURL}}catch(t){Ye().isCancel(t)&&a.trackErrorAndThrow(new StageClientError(Object.assign(Object.assign({},We(ze.OPERATION_ABORTED,t)),{token:o,tag:i,traceId:r,location:"getTurnCredentials",remoteParticipantId:e,requestUUID:s})));const n=function(t){var e,n,r,i,o;if(!(null===(e=t.response)||void 0===e?void 0:e.status))return;const s=Number(null===(n=t.response)||void 0===n?void 0:n.status);if(!(s<400)){if(s>=400&&s<=403&&(null===(r=t.response)||void 0===r?void 0:r.data)&&(null===(i=t.response)||void 0===i?void 0:i.data).code)switch((null===(o=t.response)||void 0===o?void 0:o.data).code){case qe.TokenExpired:return ze.EXPIRED_TOKEN;case qe.NoPermissions:return ze.TOKEN_PERMISSIONS_DENIED;case qe.StageAtCapacity:return ze.STAGE_AT_CAPACITY;default:return ze.UNKNOWN_PERMISSIONS_ERROR}switch(s){case 404:return ze.WHIP_SESSION_RESOURCE_DELETED;case 429:return ze.WHIP_TOO_MANY_REQUESTS;case 500:return ze.INTERNAL_SERVER_ERROR;default:return ze.UNKNOWN_PERMISSIONS_ERROR}}}(t);n&&a.trackErrorAndThrow(new StageClientError(Object.assign(Object.assign({},We(n,t)),{token:o,tag:i,traceId:r,location:"getTurnCredentials",remoteParticipantId:e,requestUUID:s}))),a.trackErrorAndThrow(new StageClientError(Object.assign(Object.assign({},We(ze.WHIP_OPTIONS_FAILURE,t)),{token:o,tag:i,traceId:r,location:"getTurnCredentials",remoteParticipantId:e,requestUUID:s})))}}))}class PublishedVideoStatsEvent extends StageAnalyticsEvent{constructor(t,e,n){var r;super(c.PUBLISHED_VIDEO_STATS,t,e,!1),Object.assign(this.properties,Object.assign({action:Se.PUBLISH},{bytes_sent:(r=n).bytesSent,fir_count:r.firCount,frames_encoded:r.framesEncoded,frames_sent:r.framesSent,header_bytes_sent:r.headerBytesSent,huge_frames_sent:r.hugeFramesSent,key_frames_encoded:r.keyFramesEncoded,nack_count:r.nackCount,packets_sent:r.packetsSent,pli_count:r.pliCount,quality_limitation_reason:r.qualityLimitationReason,quality_limitation_resolution_changes:r.qualityLimitationResolutionChanges,retransmitted_bytes_sent:r.retransmittedBytesSent,retransmitted_packets_sent:r.retransmittedPacketsSent,total_encode_time:r.totalEncodeTime,total_encoded_bytes_target:r.totalEncodedBytesTarget,total_packet_send_delay:r.totalPacketsSendDelay}))}}class PublishedAudioStatsEvent extends StageAnalyticsEvent{constructor(t,e,n){var r;super(c.PUBLISHED_AUDIO_STATS,t,e,!1),Object.assign(this.properties,Object.assign({action:Se.PUBLISH},{bytes_sent:(r=n).bytesSent,header_bytes_sent:r.headerBytesSent,nack_count:r.nackCount,packets_sent:r.packetsSent,retransmitted_bytes_sent:r.retransmittedBytesSent,retransmitted_packets_sent:r.retransmittedPacketsSent}))}}class SubscribedVideoStatsEvent extends StageAnalyticsEvent{constructor(t,e,n,r){var i;super(c.SUBSCRIBED_VIDEO_STATS,t,e,!1),Object.assign(this.properties,Object.assign({action:Se.SUBSCRIBE,remote_participant_id:n},{bytes_received:(i=r).bytesReceived,fir_count:i.firCount,frames_decoded:i.framesDecoded,frames_dropped:i.framesDropped,frames_received:i.framesReceived,header_bytes_received:i.headerBytesReceived,jitter_buffer_delay:i.jitterBufferDelay,key_frames_decoded:i.keyFramesDecoded,nack_count:i.nackCount,packets_discarded:i.packetsDiscarded,packets_lost:i.packetsLost,packets_received:i.packetsReceived,pli_count:i.pliCount,total_freezes_duration:i.totalFreezesDuration,total_pauses_duration:i.totalPausesDuration,freeze_count:i.freezeCount,pause_count:i.pauseCount}))}}class SubscribedAudioStatsEvent extends StageAnalyticsEvent{constructor(t,e,n,r){var i;super(c.SUBSCRIBED_AUDIO_STATS,t,e,!1),Object.assign(this.properties,Object.assign({action:Se.SUBSCRIBE,remote_participant_id:n},{bytes_received:(i=r).bytesReceived,concealed_samples:i.concealedSamples,header_bytes_received:i.headerBytesReceived,inserted_samples_for_deceleration:i.insertedSamplesForDeceleration,jitter_buffer_delay:i.jitterBufferDelay,packets_discarded:i.packetsDiscarded,packets_lost:i.packetsLost,packets_received:i.packetsReceived,removed_samples_for_acceleration:i.removedSamplesForAcceleration,total_samples_received:i.totalSamplesReceived}))}}class MinuteEvent extends StageAnalyticsEvent{constructor(t,e,n,r,i){super(c.MINUTE,t,e,!1),Object.assign(this.properties,{action:r?Se.PUBLISH:Se.SUBSCRIBE,is_publishing:r,minutes_logged:n,subscribed_number:i})}}class ConnectionStateEvent extends StageAnalyticsEvent{constructor(t,e,n,r,i){super(c.CONNECTION_STATE,e,n,!1),Object.assign(this.properties,{action:t,remote_participant_id:i,state:r})}}class IceGatheringStateEvent extends StageAnalyticsEvent{constructor(t,e,n,r,i){super(c.ICE_GATHERING_STATE,e,n,!1),Object.assign(this.properties,{action:t,remote_participant_id:i,state:r})}}var jn;!function(t){t.OPTIONS="options",t.POST="post",t.CONNECTED="connected",t.ICE_GATHERING="icegathering"}(jn||(jn={}));const Ln="start",Un="stop";class PeerClientPerformanceTracker{constructor(t,e){this.marks={},this.optionsDuration=0,this.postDuration=0,this.timeToCandidate=0,this.timeToConnected=0,this.action=t,this.traceId=e}markActionStart(){this.markStart(jn.OPTIONS),this.markStart(jn.CONNECTED)}markOptionsStop(){this.markStop(jn.OPTIONS),this.optionsDuration=this.measure(jn.OPTIONS)}markPostStart(){this.markStart(jn.POST)}markPostStop(){this.markStop(jn.POST),this.postDuration=this.measure(jn.POST)}markIceGatheringStart(){this.markStart(jn.ICE_GATHERING)}markIceGatheringStop(){this.markStop(jn.ICE_GATHERING),this.timeToCandidate=this.measure(jn.ICE_GATHERING)}markActionStop(){this.markStop(jn.CONNECTED),this.timeToConnected=this.measure(jn.CONNECTED)}markStart(t){this.marks[`${this.namespace}.${t}.${Ln}`]=performance.now()}markStop(t){this.marks[`${this.namespace}.${t}.${Un}`]=performance.now()}measure(t){const e=`${this.namespace}.${t}.${Ln}`,n=`${this.namespace}.${t}.${Un}`,r=this.marks[e],i=this.marks[n];return void 0===r||void 0===i?0:i-r}get namespace(){return`ivswb.peerclient.${this.action}.${this.traceId.value}`}getMeasurements(){const{optionsDuration:t,postDuration:e,timeToCandidate:n,timeToConnected:r}=this;return{optionsDuration:t,postDuration:e,timeToCandidate:n,timeToConnected:r}}}var Bn=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))};let Fn=null;class StagePeerClient{constructor(t,e,n,r,i,o,s,a){if(this.sentOffer=!1,this.v2=!1,this.subscribeToAudioOnly=!1,this.tracks=[],this.minutesLogged=0,this.connect=(t=!1,e)=>Bn(this,void 0,void 0,(function*(){const{token:n,tag:r,identifier:i,action:o}=this;let s,a,c;const u=()=>{this.emitter.off(mn,s),this.emitter.off(vn,a)};this.traceId=e,this.subscribeToAudioOnly=t;const l=new Promise(((t,e)=>{const u=setTimeout((()=>{this.stop();const t=o===Se.SUBSCRIBE?ze.SUBSCRIBE_TIMED_OUT:ze.PUBLISH_TIMED_OUT,s=new StageClientError(Object.assign(Object.assign({},t),{token:n,traceId:this.traceId,tag:r,location:"connect",remoteParticipantId:i}));this.analyticsTracker.trackError(s),e(s)}),1e4);s=t=>{clearTimeout(u),this.stop(),e(t)},a=e=>{e===yn.CONNECTED&&(clearTimeout(u),t())},this.emitter.on(mn,s),this.emitter.on(vn,a),c=()=>{clearTimeout(u)}}));try{yield this.start();const t=yield this.addTransceivers();return yield l,AbortControllersTracker.getInstance().removeAbortController(i),{mediaStream:t}}catch(t){throw c&&c(),t}finally{u()}})),this.disconnect=()=>Bn(this,void 0,void 0,(function*(){const{token:t,action:e}=this;this.stop(),AbortControllersTracker.getInstance().isUnloading?this.cleanup(e,t.participantID,t):yield this.cleanup(e,t.participantID,t)})),this.onTrack=t=>{const{token:e,action:n,traceId:r,identifier:i}=this;en(e,r,`onTrack: ${t.track.kind}`,n,i)},this.onIceGatheringStateChange=()=>{var t,e;const{token:n,action:r,traceId:i,identifier:o}=this;if("gathering"===(null===(t=this.peerConnection)||void 0===t?void 0:t.iceGatheringState)&&this.perfTracker.markIceGatheringStart(),this.peerConnection){const t=this.peerConnection.iceGatheringState,e=new IceGatheringStateEvent(r,n,i,t,o);this.analyticsTracker.trackEventNoSharedProps(e)}en(n,i,`ICE gathering state change: ${null===(e=this.peerConnection)||void 0===e?void 0:e.iceGatheringState}`,r,o)},this.onIceCandidate=t=>Bn(this,void 0,void 0,(function*(){var e,n,r,i;const{token:o,identifier:s,action:a,sentOffer:c,responseURL:u,traceId:l}=this,d=null===(e=t.target.localDescription)||void 0===e?void 0:e.sdp.includes("relay");if(this.analyticsTracker.trackEventNoSharedProps(new TraceEvent(this.token,l,`ice candidate: hasRelay = ${d}, candidate = ${null===(n=t.candidate)||void 0===n?void 0:n.candidate}`,a,s)),!d&&o.shouldUseTURN()||c||void 0===(null===(r=t.candidate)||void 0===r?void 0:r.candidate)||(this.perfTracker.markIceGatheringStop(),this.sentOffer=!0,this.perfTracker.markPostStart(),yield this.fetchAndSetRemoteDescription(a,s,o,this.responseURL),this.perfTracker.markPostStop()),!c&&void 0===(null===(i=t.candidate)||void 0===i?void 0:i.candidate)){const t=new StageClientError(Object.assign(Object.assign({},ze.NO_CANDIDATES),{token:o,traceId:l,tag:Ge(a,s),location:"StagePeerClient.start",remoteParticipantId:s}));return this.analyticsTracker.trackError(t),void this.emitter.emit(mn,t)}})),this.onMute=()=>Bn(this,void 0,void 0,(function*(){const{token:t,action:e,traceId:n,identifier:r}=this;en(t,n,"Track has muted",e,r)})),this.onUnMute=()=>Bn(this,void 0,void 0,(function*(){const{token:t,action:e,traceId:n,identifier:r}=this;en(t,n,"Track has unmuted",e,r)})),this.stopRemoteVideo=()=>{if(!this.videoTransceiver){const t=new Error("no video transciever to stop");throw this.logger.error({err:t,msg:"error stopping video"}),t}const{mid:t}=this.videoTransceiver;if(!t){const t=new Error("no mid for transceiver");throw this.logger.error({err:t,msg:"error stopping video"}),t}this.sendMediaControlsRequest({pause:[t]})},this.startRemoteVideo=()=>{if(!this.videoTransceiver){const t=new Error("no video transciever to start");throw this.logger.error({err:t,msg:"error starting video"}),t}const{mid:t}=this.videoTransceiver;if(!t){const t=new Error("no mid for transceiver");throw this.logger.error({err:t,msg:"error starting video"}),t}this.sendMediaControlsRequest({play:[t]})},this.sendMediaControlsRequest=t=>{var e;if(this.action!==Se.SUBSCRIBE){const t=new Error("media controls not supported for publisher peer connections");throw this.logger.error({err:t,msg:"tried to send media controls request for PUBLISHER peer connection"}),t}if(!(null===(e=this.whipResource)||void 0===e?void 0:e.mediaControls)){const t=new Error("media controls url undefined");throw this.logger.error({err:t,msg:"error sending media controls request"}),t}const{mediaControls:n}=this.whipResource,r=p();Ye().post(n,JSON.stringify(t),{headers:{Authorization:`Bearer ${this.token.rawToken}`,"Content-Type":"application/json","X-Stages-Platform":"web","X-Stages-Request-ID":r.value,"X-Stages-SDK":"1.3.2","X-Stages-Session-ID":m(this.token),"X-Stages-Trace-ID":this.traceId.value,"X-Stages-WHIP-Version":On}}).then((t=>{if(t.status>=300){const e=new Error(`got bad status ${t.status} from media controls request`);throw this.logger.error({err:e,msg:"error sending media controls request"}),e}}),(t=>{throw t}))},this.fetchAndSetRemoteDescription=(t,e,n,r)=>Bn(this,void 0,void 0,(function*(){var i,o,s,a;const c=p();try{const u="POST";this.analyticsTracker.trackEventNoSharedProps(new ServerRequestEvent(t,n,r,u,c.value,e,this.traceId));const l=AbortControllersTracker.getInstance().trackNewAbortController(e),{data:d,headers:h,request:p}=yield Dn({data:null===(o=null===(i=this.peerConnection)||void 0===i?void 0:i.localDescription)||void 0===o?void 0:o.sdp,headers:{Authorization:`Bearer ${n.rawToken}`,"Content-Type":"application/sdp","X-Stages-Platform":"web","X-Stages-Request-ID":c.value,"X-Stages-SDK":"1.3.2","X-Stages-Session-ID":m(n),"X-Stages-Trace-ID":this.traceId.value,"X-Stages-WHIP-Version":On},method:u,responseType:"text",url:r,signal:l.signal});if(h.location){const t=new URL(p.responseURL),e=t.port?`:${t.port}`:"";this.whipResource={path:`${t.protocol}//${t.hostname}${e}${h.location}`}}null===(s=h.link)||void 0===s||s.split(",").forEach((t=>{const e=this.parseWhipLinkExtension(t);if(3===(null==e?void 0:e.length))switch(e[2]){case"urn:ietf:params:whip:ivs-stages:session-delete":{const t=new URL(p.responseURL),n=t.port?`:${t.port}`:"";this.whipResource&&(this.whipResource.sessionDelete=`${t.protocol}//${t.hostname}${n}${e[1]}`);break}case"urn:ietf:params:whep:core:playback-controls":{const t=new URL(p.responseURL),n=t.port?`:${t.port}`:"";this.whipResource&&(this.whipResource.mediaControls=`${t.protocol}//${t.hostname}${n}${e[1]}`);break}}})),yield null===(a=this.peerConnection)||void 0===a?void 0:a.setRemoteDescription({sdp:d,type:"answer"})}catch(r){if(Ye().isCancel(r)){const i=new StageClientError(Object.assign(Object.assign({},We(ze.OPERATION_ABORTED,r)),{token:n,traceId:this.traceId,tag:Ge(t,e),location:"StagePeerClient.start",requestUUID:c,remoteParticipantId:e}));return this.analyticsTracker.trackError(i),void this.emitter.emit(mn,i)}const i=new StageClientError(Object.assign(Object.assign({},We(ze.WHIP_POST_FAILURE,r)),{token:n,traceId:this.traceId,tag:Ge(t,e),location:"StagePeerClient.start",requestUUID:c,remoteParticipantId:e}));this.analyticsTracker.trackError(i),this.emitter.emit(mn,i)}})),this.cleanup=(t,e,n)=>Bn(this,void 0,void 0,(function*(){var r,i,o,s;let a=Je({action:t,identifier:e,token:n.rawToken,whipURLOverride:this.whipUrlOverride});const c=p();if(en(n,this.traceId,`token dataplane url: ${a}`,t,e),(null===(r=this.whipResource)||void 0===r?void 0:r.path)&&(a=null===(i=this.whipResource)||void 0===i?void 0:i.path,en(n,this.traceId,`use hostnamecachedurl: ${a}`,t,e)),a||this.analyticsTracker.trackErrorAndThrow(new StageClientError(Object.assign(Object.assign({},ze.WHIP_URL_MISSING),{token:n,traceId:this.traceId,tag:Ge(t,e),location:t===Se.SUBSCRIBE?"unsubscribe":"unpublish",requestUUID:c,remoteParticipantId:e}))),AbortControllersTracker.getInstance().isUnloading){if(null===(s=this.whipResource)||void 0===s?void 0:s.sessionDelete){a=this.whipResource.sessionDelete,en(n,this.traceId,`DELETE via session-delete beacon path: ${a}`,t,e);try{navigator.sendBeacon(a,JSON.stringify({authorization:n.rawToken}))}catch(r){this.analyticsTracker.trackErrorAndThrow(new StageClientError(Object.assign(Object.assign({},We(ze.WHIP_DELETE_FAILURE,r)),{token:n,traceId:this.traceId,tag:Ge(t,e),location:Se.SUBSCRIBE?"unsubscribe":"unpublish",requestUUID:c,remoteParticipantId:e})))}}}else try{yield Ye().delete(a,{headers:{Authorization:`Bearer ${n.rawToken}`,"X-Stages-Platform":"web","X-Stages-Request-ID":c.value,"X-Stages-SDK":"1.3.2","X-Stages-Session-ID":m(n),"X-Stages-Trace-ID":this.traceId.value,"X-Stages-WHIP-Version":On}})}catch(r){404===(null===(o=r.response)||void 0===o?void 0:o.status)?en(n,this.traceId,`DELETE returned 404, ignoring, action = ${t}, uuid = ${c.value}`,t,e):this.analyticsTracker.trackErrorAndThrow(new StageClientError(Object.assign(Object.assign({},We(ze.WHIP_DELETE_FAILURE,r)),{token:n,traceId:this.traceId,tag:Ge(t,e),location:Se.SUBSCRIBE?"unsubscribe":"unpublish",requestUUID:c,remoteParticipantId:e})))}})),this.getConnectionState=()=>{if(!this.peerConnection)return yn.NONE;const t=this.peerConnection.connectionState||this.peerConnection.iceConnectionState;switch(t){case"new":return yn.NEW;case"closed":return yn.CLOSED;case"disconnected":return yn.DISCONNECTED;case"failed":return yn.FAILED;case"idle":return yn.IDLE;case"checking":case"connecting":return yn.CONNECTING;case"completed":case"connected":return yn.CONNECTED;default:return this.logger.warn({msg:"Unhandled connection state:",rawState:t}),yn.IDLE}},this.getValidPeerConnectionCanThrow=()=>{if(!this.peerConnection)throw new Error("missing peer connection");return this.peerConnection},this.onIceCandidateError=t=>{const{token:e,traceId:n,tag:r}=this;if(701!==t.errorCode){const t=new StageClientError(Object.assign(Object.assign({},ze.ICE_CANDIDATE_ERROR),{token:e,traceId:n,tag:r,location:"onIceCandidateError",remoteParticipantId:this.identifier}));this.analyticsTracker.trackError(t),this.emitter.emit(mn,t)}},this.onIceConnectionStateChange=()=>{var t;const{token:e,traceId:n,action:r,identifier:i}=this;en(e,n,`ICE connection state change: ${null===(t=this.peerConnection)||void 0===t?void 0:t.iceConnectionState}`,r,i),this.onConnectionStateChange()},this.onConnectionStateChange=()=>{var t;if(this.peerConnection){const t=this.peerConnection.connectionState||this.peerConnection.iceConnectionState,{token:e,traceId:n,identifier:r,action:i}=this,o=new ConnectionStateEvent(i,e,n,t,r);this.analyticsTracker.trackEventNoSharedProps(o),en(e,n,`connection state change: ${t}`,i,r)}const e=this.getConnectionState();switch(e){case yn.CONNECTED:{this.perfTracker.markActionStop(),this.emitter.emit(vn,e),this.uploadStatsInterval||(this.uploadStats(),this.uploadStatsInterval=setInterval((()=>{this.uploadStats()}),1e4)),this.action===Se.PUBLISH&&(0===this.minutesLogged&&this.uploadMinutesPublished(),this.minutesUploadedInterval||(this.minutesUploadedInterval=setInterval((()=>{this.uploadMinutesPublished()}),5e3)));const n=this.mediaStreamManager.getTrack(tn.AUDIO),r=this.mediaStreamManager.getTrack(tn.VIDEO);if(r){const t=r.getSettings();this.analyticsTracker.trackEvent(new SessionVideoPropertiesEvent(t))}if(n){const t=n.getSettings();this.analyticsTracker.trackEvent(new SessionAudioPropertiesEvent(t))}((null===(t=this.peerConnection)||void 0===t?void 0:t.getSenders())||[]).forEach((t=>{var e;((null===(e=t.getParameters())||void 0===e?void 0:e.codecs)||[]).forEach((e=>{var i;switch(null===(i=t.track)||void 0===i?void 0:i.kind){case"video":{if(!r)break;const t=(new SDPFmtpLine).extractVideoSdpFmtpLine(e.sdpFmtpLine),n=r.getSettings();this.analyticsTracker.trackEvent(new SessionVideoEncoderConfiguredEvent(n,t,e));break}case"audio":if(!n)break;this.analyticsTracker.trackEvent(new SessionAudioEncoderConfiguredEvent(e))}}))}));break}case yn.DISCONNECTED:this.action===Se.PUBLISH&&this.clearMinuteUploadedInterval(),this.emitter.emit(vn,e);break;case yn.FAILED:this.action===Se.PUBLISH&&this.clearMinuteUploadedInterval(),this.emitter.emit(vn,e),this.handleConnectionFailure();break;default:this.emitter.emit(vn,e)}},this.token=t,this.logger=new ScopedLogger(e,ut.WEBRTC),this.action=r,this.tag=i,this.traceId=o,this.analyticsTracker=AnalyticsTracker.getInstance(),this.mediaStreamManager=n,this.emitter=new u,r===Se.SUBSCRIBE&&!s)throw new Error("Subscribe action provided without subscriber Id");this.subscriberId=s,this.perfTracker=new PeerClientPerformanceTracker(this.action,this.traceId),this.whipUrlOverride=a}setV2(){this.v2=!0}start(){return Bn(this,void 0,void 0,(function*(){const{token:t,action:e,traceId:n,identifier:r}=this;e!==Se.PUBLISH||t.claims.capabilities.allow_publish||this.analyticsTracker.trackErrorAndThrow(new StageClientError(Object.assign(Object.assign({},We(ze.TOKEN_PERMISSIONS_DENIED,new Error("Cannot publish with subscribe only token"))),{token:t,traceId:n,tag:Ge(e,r),location:"StagePeerClient.start",remoteParticipantId:r})));let i=Je({action:e,identifier:r,token:t.rawToken,whipURLOverride:this.whipUrlOverride}),o=[];try{t.shouldUseTURN()&&(this.perfTracker.markActionStart(),({iceCredentials:o,responseURL:i}=yield Mn({action:e,identifier:r,token:t.rawToken,traceId:n,tag:this.tag})),this.perfTracker.markOptionsStop(),this.analyticsTracker.trackEventNoSharedProps(new TraceEvent(this.token,n,`ice url list = ${o.map((t=>t.urls))}`,e,r))),this.sentOffer=!1,this.responseURL=i,this.peerConnection=new RTCPeerConnection({iceServers:o,iceTransportPolicy:t.shouldUseTURN()?"relay":"all"}),this.peerConnection.addEventListener("connectionstatechange",this.onConnectionStateChange),this.peerConnection.addEventListener("iceconnectionstatechange",this.onIceConnectionStateChange),this.peerConnection.addEventListener("icecandidateerror",this.onIceCandidateError),this.peerConnection.addEventListener("icegatheringstatechange",this.onIceGatheringStateChange),this.peerConnection.addEventListener("icecandidate",this.onIceCandidate),this.peerConnection.addEventListener("track",this.onTrack),this.peerConnection.addEventListener("mute",this.onMute),this.peerConnection.addEventListener("unmute",this.onUnMute),en(t,n,"peer connection created",e,r)}catch(i){const o=new StageClientError(Object.assign(Object.assign({},We(ze.CREATE_PEER_CONNECTION_FAILURE,i)),{token:t,traceId:n,tag:Ge(e,r),location:"StagePeerClient.start",remoteParticipantId:r}));e===Se.PUBLISH&&this.emitter.emit(vn,yn.FAILED),this.emitter.emit(mn,o),this.analyticsTracker.trackErrorAndThrow(o)}}))}stop(){var t,e,n,r,i,o,s,a,c;this.clearMinuteUploadedInterval(),this.clearUploadStatsInterval(),null===(t=this.peerConnection)||void 0===t||t.removeEventListener("connectionstatechange",this.onConnectionStateChange),null===(e=this.peerConnection)||void 0===e||e.removeEventListener("iceconnectionstatechange",this.onIceConnectionStateChange),null===(n=this.peerConnection)||void 0===n||n.removeEventListener("icecandidateerror",this.onIceCandidateError),null===(r=this.peerConnection)||void 0===r||r.removeEventListener("icegatheringstatechange",this.onIceGatheringStateChange),null===(i=this.peerConnection)||void 0===i||i.removeEventListener("track",this.onTrack),null===(o=this.peerConnection)||void 0===o||o.removeEventListener("mute",this.onMute),null===(s=this.peerConnection)||void 0===s||s.removeEventListener("unmute",this.onUnMute),null===(a=this.peerConnection)||void 0===a||a.removeEventListener("icecandidate",this.onIceCandidate),null===(c=this.peerConnection)||void 0===c||c.close()}getTransceiverForKind(t){if(!this.peerConnection)return;const e=this.peerConnection.getTransceivers();return"audio"===t?e.find((t=>"0"===t.mid)):"video"===t?e.find((t=>"1"===t.mid)):void 0}removeTrack(t){return Bn(this,void 0,void 0,(function*(){const e="audio"===t||"video"===t;if(this.peerConnection&&e)try{const e=this.getTransceiverForKind(t);if(!e)return void this.logger.warn({msg:`tried removing track type ${t} but couldn't find transceiver`});yield e.sender.replaceTrack(null)}catch(t){this.logger.warn({msg:"error replacing track",err:t})}}))}replaceTrack(t){return Bn(this,void 0,void 0,(function*(){if(this.peerConnection&&t)try{const e=this.getTransceiverForKind(t.kind);if(!e)return void this.logger.warn({msg:`tried replacing track type ${t.kind} but couldn't find transceiver`,track:t});yield e.sender.replaceTrack(t)}catch(t){this.logger.warn({msg:"error replacing track",err:t})}}))}addTransceivers(){var t;return Bn(this,void 0,void 0,(function*(){const{tracks:e,traceId:n,token:r,action:i,identifier:o}=this;An(this.peerConnection);let s,a=null;if(i===Se.PUBLISH){const t=e.find((t=>"video"===(null==t?void 0:t.kind)));let s=e.find((t=>"audio"===(null==t?void 0:t.kind)));if(s||(s=this.getSilentAudio()),!t&&!this.v2)throw new Error("We cannot configure transceivers without a video track");const a=this.peerConnection.getTransceivers(),c=[];a.forEach((t=>{var e;c.concat(null===(e=t.sender.track)||void 0===e?void 0:e.id)}));const u=new MediaStream([s,t].filter((t=>!!t&&!c.includes(t.id)))),l=u.getAudioTracks()[0]||"audio",d=u.getVideoTracks()[0]||"video",h={direction:"sendonly",streams:[u]},p=Object.assign(Object.assign({},h),{sendEncodings:[{maxFramerate:30}]});this.peerConnection.addTransceiver(l,h),en(r,n,`track added, type: ${l.kind||l}`,i,o),this.peerConnection.addTransceiver(d,p),en(r,n,`track added, type: ${d.kind||d}`,i,o)}else if(i===Se.SUBSCRIBE){if(r.shouldSendSilentAudio()){const e="audio"===(null===(t=this.customSilentAudioTrackForSub)||void 0===t?void 0:t.kind)?this.customSilentAudioTrackForSub:this.getSilentAudio();this.peerConnection.addTransceiver(e,{direction:"sendrecv"})}else this.peerConnection.addTransceiver("audio",{direction:"recvonly"});en(r,n,"track added, type: audio",i,o),this.subscribeToAudioOnly||(this.videoTransceiver=this.peerConnection.addTransceiver("video",{direction:"recvonly"}),en(r,n,"track added, type: video",i,o)),a=new MediaStream,this.peerConnection.getTransceivers().forEach((t=>{t.receiver?(this.logger.info({msg:"dbg: Subscribe succeeded, adding media track to participant mediaStream"}),null==a||a.addTrack(t.receiver.track)):this.logger.info({msg:"dbg: Subscribe succeeded, but Transceiver were negotiated without Receiver"})}))}try{en(this.token,n,"Creating offer",this.action,o),s=yield this.peerConnection.createOffer(),en(this.token,n,"Setting local description",this.action,o)}catch(t){const e=new StageClientError(Object.assign(Object.assign({},We(ze.CREATE_OFFER_FAILURE,t)),{token:this.token,traceId:n,tag:this.tag,location:"addTransceivers",remoteParticipantId:o}));this.emitter.emit(mn,e),this.analyticsTracker.trackErrorAndThrow(e)}return yield this.peerConnection.setLocalDescription(s),en(this.token,n,"local description set",this.action,o),a}))}getReports(){var t;return Bn(this,void 0,void 0,(function*(){try{const e=(yield null===(t=this.peerConnection)||void 0===t?void 0:t.getStats())||[],n=[];return e.forEach((t=>{n.push(t)})),n}catch(t){return[]}}))}requestRTCStats(t){return Bn(this,void 0,void 0,(function*(){if(this.peerConnection)return this.peerConnection.getStats(t)}))}get identifier(){return this.subscriberId||this.token.participantID}clearMinuteUploadedInterval(){clearInterval(this.minutesUploadedInterval),this.minutesUploadedInterval=void 0}clearUploadStatsInterval(){clearInterval(this.uploadStatsInterval),this.uploadStatsInterval=void 0}handleConnectionFailure(){return Bn(this,void 0,void 0,(function*(){const{token:t,traceId:e,tag:n}=this;this.analyticsTracker.trackError(new StageClientError(Object.assign(Object.assign({},ze.PEER_CONNECTION_NETWORK_FAILURE),{token:t,traceId:e,tag:n,location:"onIceCandidateError",remoteParticipantId:this.identifier})));try{yield this.uploadStatsOnce()}catch(t){}}))}uploadStats(){var t,e,n;return Bn(this,void 0,void 0,(function*(){"failed"!==(null===(t=this.peerConnection)||void 0===t?void 0:t.iceConnectionState)&&"closed"!==(null===(e=this.peerConnection)||void 0===e?void 0:e.iceConnectionState)&&"new"!==(null===(n=this.peerConnection)||void 0===n?void 0:n.iceConnectionState)&&(yield this.uploadStatsOnce())}))}uploadStatsOnce(){var t;return Bn(this,void 0,void 0,(function*(){const e=yield null===(t=this.peerConnection)||void 0===t?void 0:t.getStats();null==e||e.forEach((t=>{if(this.action===Se.PUBLISH&&"outbound-rtp"===t.type)switch(t.kind){case"audio":this.analyticsTracker.trackEventNoSharedProps(new PublishedAudioStatsEvent(this.token,this.traceId,t));break;case"video":this.analyticsTracker.trackEventNoSharedProps(new PublishedVideoStatsEvent(this.token,this.traceId,t))}else if(this.action===Se.SUBSCRIBE&&"inbound-rtp"===t.type)switch(t.kind){case"audio":this.analyticsTracker.trackEventNoSharedProps(new SubscribedAudioStatsEvent(this.token,this.traceId,this.identifier,t));break;case"video":this.analyticsTracker.trackEventNoSharedProps(new SubscribedVideoStatsEvent(this.token,this.traceId,this.identifier,t))}}))}))}on(t,e,n){this.emitter.on(t,e,n)}off(t,e,n){this.emitter.off(t,e,n)}getSilentAudio(){Fn||(Fn=new AudioContext);const t=Fn.createOscillator(),e=Fn.createGain();t.connect(e);const n=Fn.createMediaStreamDestination();return e.connect(n),e.gain.value=0,t.start(),n.stream.getAudioTracks()[0]}uploadMinutesPublished(){var t,e,n;"failed"!==(null===(t=this.peerConnection)||void 0===t?void 0:t.iceConnectionState)&&"closed"!==(null===(e=this.peerConnection)||void 0===e?void 0:e.iceConnectionState)&&("new"!==(null===(n=this.peerConnection)||void 0===n?void 0:n.iceConnectionState)&&this.analyticsTracker.trackEventNoSharedProps(new MinuteEvent(this.token,this.traceId,this.minutesLogged,!0,0)),this.minutesLogged++)}getActionMeasurements(){return this.perfTracker.getMeasurements()}getAudioSender(){var t;return null===(t=this.peerConnection)||void 0===t?void 0:t.getSenders().find((t=>{var e;return"audio"===(null===(e=t.track)||void 0===e?void 0:e.kind)}))}getVideoSender(){var t;return null===(t=this.peerConnection)||void 0===t?void 0:t.getSenders().find((t=>{var e;return"video"===(null===(e=t.track)||void 0===e?void 0:e.kind)}))}parseWhipLinkExtension(t){return/<([0-9a-zA-Z/_-]+)>; rel="([a-z:-]+)"/.exec(t)}setTracksToPublish(t){this.tracks=t}setCustomSilentAudioTrackForSub(t){this.customSilentAudioTrackForSub=t}}var Vn,Gn,Wn,qn,zn=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))},$n=function(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)};!function(t){t.INIT="init",t.CONNECTING="connecting",t.CONNECTED="connected",t.UNSTABLE="unstable",t.PAUSED="paused",t.FAILED="failed",t.STOPPED="stopped"}(Wn||(Wn={})),function(t){t.NONE="none",t.AUDIO_ONLY="audio_only",t.AUDIO_VIDEO="audio_video"}(qn||(qn={}));class StageSubscription{constructor(t,e,n,r,i,o,s){this.id=t,this.token=e,this.stageConnection=n,this.nonScopedLogger=r,this.mediaStreamManager=i,this.traceId=o,this.customSilentAudioTrack=s,Vn.add(this),this.emitter=new u.EventEmitter,this.isSubscriptionActive=!1,this.subscriptionState={connectionState:Wn.INIT,subscribeInProgress:!1},this.previousSignalState={isTargetPublishing:!1},this.failedRetries=0,this.throttler=new ThrottleTimer(1e3),this.isStarted=!1,this.updateSubscribeType=t=>{t===qn.AUDIO_ONLY?this.peerClient.stopRemoteVideo():t===qn.AUDIO_VIDEO&&this.peerClient.startRemoteVideo()},this.onParticipantUpdated=t=>{$n(this,Vn,"m",Gn).call(this,t)&&(this.logger.debug({msg:"onParticipantUpdated",participant:t}),this.onSignalStateChange({isTargetPublishing:t.isPublishing}))},this.onParticipantJoined=t=>{$n(this,Vn,"m",Gn).call(this,t)&&(this.logger.debug({msg:"onParticipantJoined",participant:t}),this.onSignalStateChange({isTargetPublishing:t.isPublishing}))},this.onParticipantLeft=t=>{$n(this,Vn,"m",Gn).call(this,t)&&(this.logger.debug({msg:"onParticipantLeft",participant:t}),this.onSignalStateChange({isTargetPublishing:!1}))},this.requestRTCStats=t=>zn(this,void 0,void 0,(function*(){return this.peerClient.requestRTCStats(t)})),this.attemptSubscribe=t=>zn(this,void 0,void 0,(function*(){if(this.logger.debug({msg:`Subscribe attempt started: ${t}`}),!this.isSubscriptionActive)return this.logger.warn({msg:"Subscribe attempt invalid: Subscription is inactive"}),!1;this.logger.debug({msg:"Subscribe attempt is valid."}),this.subscriptionState.connectionState!==Wn.FAILED&&(this.logger.debug({msg:"Updating state to CONNECTING"}),this.changeState({connectionState:Wn.CONNECTING}));try{const{mediaStream:t}=yield this.subscribe();return this.throttler.clear(),this.failedRetries=0,this.emitter.emit(rn.STAGE_STREAM_UPDATE,t),this.logger.debug({msg:"Subscribe attempt succeeded"}),!0}catch(e){this.logger.error({log:"Subscribe attempt failed",err:e}),this.onAttemptSubscribeFailure(t)}return!1})),this.id=t,this.token=e,this.stageConnection=n,this.peerClient=new StagePeerClient(e,this.nonScopedLogger,this.mediaStreamManager,Se.SUBSCRIBE,Ge(Se.SUBSCRIBE,t),this.traceId,t),this.logger=new ScopedLogger(r,ut.SUBSCRIPTION),this.analyticsTracker=AnalyticsTracker.getInstance(),this.traceId=o}onPeerClientConnectionStateChange(t){const e=this.stageConnection.getParticipant(this.id);this.logger.debug({msg:`onPeerClientConnectionStateChange: ${t}`,state:t,targetParticipant:e}),this.onSignalStateChange({peerClientState:t})}onSignalStateChange(t){const e=this.previousSignalState,n=Object.assign({},e,t);this.isSubscriptionActive?(n.isTargetPublishing?t.peerClientState===yn.DISCONNECTED?this.changeState({connectionState:Wn.UNSTABLE}):t.peerClientState===yn.CONNECTED?this.changeState({connectionState:Wn.CONNECTED,subscribeInProgress:!0}):t.peerClientState===yn.FAILED&&this.subscriptionState.subscribeInProgress&&(this.trackSubscribeEnded(!1,$e.CONNECTION_FAIL),this.changeState({subscribeInProgress:!1})):(e.isTargetPublishing&&this.subscriptionState.subscribeInProgress&&(this.logger.debug({msg:"Scheduling an unsubscribe on the event loop"}),this.unsubscribe()),this.throttler.clear(),this.changeState({connectionState:Wn.PAUSED})),(!e.isTargetPublishing&&t.isTargetPublishing||t.peerClientState===yn.FAILED)&&this.throttledAttemptSubscribe("onSignalState change: isTargetPublishing is now true"),Object.assign(this.previousSignalState,t)):this.logger.warn({msg:"Unexpected onSignalStateChange when subscription is inactive"})}onAttemptSubscribeFailure(t){if(this.logger.debug({msg:"Changing/keeping state FAILED"}),this.changeState({connectionState:Wn.FAILED}),this.failedRetries<=4){const e=1e3*Math.pow(2,this.failedRetries);this.logger.debug({msg:`Retrying in ${e}ms`}),this.failedRetries++,setTimeout((()=>zn(this,void 0,void 0,(function*(){this.throttledAttemptSubscribe(t)}))),e)}else this.previousSignalState.isTargetPublishing=!1}start(){this.isSubscriptionActive=!0,this.isStarted=!0,this.peerClient.on(vn,this.onPeerClientConnectionStateChange,this),this.stageConnection.on(nn.STAGE_PARTICIPANT_UPDATED,this.onParticipantUpdated),this.stageConnection.on(nn.STAGE_PARTICIPANT_JOINED,this.onParticipantJoined),this.stageConnection.on(nn.STAGE_PARTICIPANT_LEFT,this.onParticipantLeft),this.stageConnection.on(nn.STAGE_PARTICIPANT_KICKED,this.onParticipantLeft);const t=this.stageConnection.getParticipant(this.id);this.onSignalStateChange({isTargetPublishing:null==t?void 0:t.isPublishing})}throttledAttemptSubscribe(t){return this.throttler.invoke(this.attemptSubscribe,t)}changeState(t){void 0!==t.subscribeInProgress&&(this.subscriptionState.subscribeInProgress=t.subscribeInProgress),t.connectionState&&this.subscriptionState.connectionState!==t.connectionState&&(this.subscriptionState.connectionState=t.connectionState,this.emitter.emit(rn.CONNECTION_STATE_CHANGE,this.subscriptionState.connectionState))}on(t,e){this.emitter.on(t,e)}off(t,e){this.emitter.off(t,e)}stop(){this.cleanUp(),this.changeState({connectionState:Wn.STOPPED})}cleanUp(){this.peerClient&&(this.peerClient.off(vn,this.onPeerClientConnectionStateChange,this),this.unsubscribe()),this.throttler.clear(),this.stageConnection.off(nn.STAGE_PARTICIPANT_UPDATED,this.onParticipantUpdated),this.stageConnection.off(nn.STAGE_PARTICIPANT_JOINED,this.onParticipantJoined),this.stageConnection.off(nn.STAGE_PARTICIPANT_LEFT,this.onParticipantLeft),this.stageConnection.off(nn.STAGE_PARTICIPANT_KICKED,this.onParticipantLeft),this.isSubscriptionActive=!1,AbortControllersTracker.getInstance().abortPendingOperations()}isActive(){return this.isSubscriptionActive}getSubscriptionConnectionState(){return this.subscriptionState.connectionState}subscribe(t){return zn(this,void 0,void 0,(function*(){const{token:e,id:n,customSilentAudioTrack:r}=this;this.traceId=f();try{e.assertTokenIsUnexpired(this.traceId,Ge(Se.SUBSCRIBE,n),"subscribe",n),this.trackSubscribeRequested(),r&&e.shouldSendSilentAudio()&&this.peerClient.setCustomSilentAudioTrackForSub(r);const{mediaStream:i}=yield this.peerClient.connect(t,this.traceId);return this.trackSubscribeStarted(),this.isStarted||(this.subscriptionState={connectionState:Wn.CONNECTED,subscribeInProgress:!0}),{peerClient:this.peerClient,mediaStream:i}}catch(t){const r=new StageClientError(Object.assign(Object.assign({},ze.SUBSCRIBE_FAILURE),{token:e,traceId:this.traceId,tag:Ge(Se.SUBSCRIBE,n),location:"subscribe",remoteParticipantId:n}));throw this.analyticsTracker.trackEventNoSharedProps(new StageErrorEvent(r)),t instanceof StageClientError&&(t.location=`subscribe > ${t.location}`),t}}))}unsubscribe(){return zn(this,void 0,void 0,(function*(){if(this.subscriptionState.connectionState===Wn.STOPPED||this.subscriptionState.connectionState===Wn.INIT)return;const{id:t,token:e}=this;this.analyticsTracker.trackEventNoSharedProps(new UnsubscribeEvent({token:e,unsubscribedId:t,traceId:this.traceId})),e.assertTokenIsUnexpired(this.traceId,Ge(Se.SUBSCRIBE,t),"unsubscribe",t);const n=AbortControllersTracker.getInstance().isUnloading,r=n?$e.UNLOAD:$e.UNSUBSCRIBE;try{if(!this.peerClient)throw new Error("Invalid unpublish - no peerClient");n?this.peerClient.disconnect():yield this.peerClient.disconnect(),this.trackSubscribeEnded(!0,r),this.isStarted||(this.subscriptionState={connectionState:Wn.STOPPED,subscribeInProgress:!0}),this.changeState({subscribeInProgress:!1})}catch(t){this.trackAndThrowUnsubscribeError(r)}}))}trackAndThrowUnsubscribeError(t){const e=new StageClientError(Object.assign(Object.assign({},ze.UNSUBSCRIBE_FAILURE),{token:this.token,traceId:this.traceId,tag:Ge(Se.SUBSCRIBE,this.id),location:"unsubscribe",remoteParticipantId:this.id}));throw this.analyticsTracker.trackError(e),this.trackSubscribeEnded(!1,t),e}trackSubscribeRequested(){this.analyticsTracker.trackEventNoSharedProps(new SubscribeEvent({token:this.token,subscribedId:this.id,traceId:this.traceId}))}trackSubscribeStarted(){const{optionsDuration:t,postDuration:e,timeToCandidate:n,timeToConnected:r}=this.peerClient.getActionMeasurements();this.analyticsTracker.trackEventNoSharedProps(new SubscribeStartedEvent({token:this.token,traceId:this.traceId,remoteParticipantId:this.id,optionsDuration:t,postDuration:e,timeToCandidate:n,totalDuration:r}))}trackSubscribeEnded(t,e){this.analyticsTracker.trackEventNoSharedProps(new SubscribeEndedEvent({token:this.token,traceId:this.traceId,remoteParticipantId:this.id,isUnsubscribeSuccessful:t,reason:e}))}}Vn=new WeakSet,Gn=function(t){return t.id===this.id};var Hn,Kn,Jn=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))};!function(t){t.DISCONNECTED="disconnected",t.CONNECTING="connecting",t.CONNECTED="connected",t.ERRORED="errored"}(Hn||(Hn={})),function(t){t.STATE_CHANGE="stateChange"}(Kn||(Kn={}));class StagePublication extends TypedEmitter{constructor(t,e,n,r,i=!1){super(),this.token=t,this.nonScopedLogger=e,this.mediaStreamManager=n,this.traceId=r,this.tracksToPublish=[void 0,void 0],this.publicationState=Hn.DISCONNECTED,this.latestPubAttemptNum=0,this.isPublishing=!1,this.isStarted=!1,this.start=t=>{this.publicationState===Hn.DISCONNECTED||this.publicationState===Hn.ERRORED?(this.isStarted=!0,this.tracksToPublish=t,this.latestPubAttemptNum=0,this.processStateUpdate()):this.logger.warn({msg:"publication cannot be started if not in disconnected or error state"})},this.requestRTCStats=t=>Jn(this,void 0,void 0,(function*(){return this.peerClient.requestRTCStats(t)})),this.stop=()=>Jn(this,void 0,void 0,(function*(){this.peerClient.off(vn,this.onPeerClientConnectionStateChange,this),yield this.unpublish(),this.updateState(Hn.DISCONNECTED)})),this.processStateUpdate=t=>{const{publicationState:e}=this;e===Hn.DISCONNECTED||e===Hn.ERRORED?0===this.latestPubAttemptNum&&(this.updateState(Hn.CONNECTING),this.tryPublish()):e===Hn.CONNECTING?t===yn.CONNECTED?this.updateState(Hn.CONNECTED):t===yn.FAILED&&this.latestPubAttemptNum>=4&&this.updateState(Hn.ERRORED):e===Hn.CONNECTED&&t===yn.FAILED&&0===this.latestPubAttemptNum&&(this.updateState(Hn.CONNECTING),this.tryPublish())},this.updateState=t=>{this.publicationState=t,this.emit(Kn.STATE_CHANGE,t)},this.tryPublish=()=>Jn(this,void 0,void 0,(function*(){if(this.latestPubAttemptNum++,this.latestPubAttemptNum<=4)try{yield this.publish(this.tracksToPublish),this.latestPubAttemptNum=0}catch(t){if(t instanceof StageClientError&&t.fatal)return this.logger.error({msg:"fatal error publishing",err:t}),void this.updateState(Hn.ERRORED);const e=1e3*Math.pow(2,this.latestPubAttemptNum);setTimeout((()=>{this.tryPublish()}),e)}})),this.publish=t=>Jn(this,void 0,void 0,(function*(){this.traceId=f();try{return this.trackPublishRequested(),this.peerClient.setTracksToPublish(t.filter((t=>!!t))),yield this.peerClient.connect(!1,this.traceId),this.trackPublishStarted(),this.isPublishing=!0,this.peerClient}catch(t){const e=new StageClientError(Object.assign(Object.assign({},ze.PUBLISH_FAILURE),{token:this.token,traceId:this.traceId,tag:Ve.PUBLISH_RELATED,location:"publish"}));throw t instanceof StageClientError&&(e.fatal=t.fatal,e.nominal=t.nominal),this.analyticsTracker.trackError(e),t instanceof StageClientError&&(t.location=`publish > ${t.location}`),t}})),this.unpublish=()=>Jn(this,void 0,void 0,(function*(){if(this.publicationState!==Hn.DISCONNECTED&&this.publicationState!==Hn.ERRORED){this.analyticsTracker.trackEventNoSharedProps(new UnpublishEvent({token:this.token,traceId:this.traceId})),this.token.assertTokenIsUnexpired(this.traceId,Ge(Se.PUBLISH),"unpublish",this.token.participantID);try{this.peerClient.stop();const t=AbortControllersTracker.getInstance().isUnloading,e=t?$e.UNLOAD:$e.UNPUBLISH;t?this.peerClient.cleanup(Se.PUBLISH,this.token.participantID,this.token):yield this.peerClient.cleanup(Se.PUBLISH,this.token.participantID,this.token),this.trackPublishEnded(!0,e)}catch(t){const e=new StageClientError(Object.assign(Object.assign({},ze.UNPUBLISH_FAILURE),{token:this.token,traceId:this.traceId,tag:Ve.UNPUBLISH_RELATED,location:"unpublish"}));throw this.analyticsTracker.trackError(e),this.trackPublishEnded(!1,$e.UNPUBLISH),e}}})),this.replaceTrack=t=>Jn(this,void 0,void 0,(function*(){yield this.peerClient.replaceTrack(t)})),this.getAudioSender=()=>this.peerClient.getAudioSender(),this.getVideoSender=()=>this.peerClient.getVideoSender(),this.onPeerClientConnectionStateChange=t=>{var e;if((null===(e=this.peerClient)||void 0===e?void 0:e.traceId)&&this.token)if(this.logger.debug({msg:`onPeerClientConnectionStateChange: ${t}`,state:t}),t===yn.FAILED&&this.isPublishing&&(this.trackPublishEnded(!0,$e.CONNECTION_FAIL),this.isPublishing=!1),this.isStarted)this.processStateUpdate(t);else switch(t){case yn.CONNECTING:this.publicationState=Hn.CONNECTING;break;case yn.CONNECTED:this.publicationState=Hn.CONNECTED;break;case yn.DISCONNECTED:this.publicationState=Hn.DISCONNECTED;break;case yn.FAILED:this.publicationState=Hn.ERRORED;break;default:this.publicationState=Hn.CONNECTING}},this.trackPublishRequested=()=>{this.analyticsTracker.trackEventNoSharedProps(new PublishEvent({token:this.token,traceId:this.traceId}))},this.trackPublishStarted=()=>{if(!this.peerClient)return;const t=this.peerClient.getActionMeasurements();this.analyticsTracker.trackEventNoSharedProps(new PublishStartedEvent({token:this.token,traceId:this.traceId,optionsDuration:t.optionsDuration,postDuration:t.postDuration,timeToCandidate:t.timeToCandidate,totalDuration:t.timeToConnected}))},this.trackPublishEnded=(t,e)=>{this.analyticsTracker.trackEventNoSharedProps(new PublishEndedEvent({token:this.token,isUnpublishSuccessful:t,traceId:this.traceId,reason:e}))},this.peerClient=new StagePeerClient(t,this.nonScopedLogger,this.mediaStreamManager,Se.PUBLISH,Ge(Se.PUBLISH),this.traceId),i&&this.peerClient.setV2(),this.logger=new ScopedLogger(e,ut.PUBLICATION),this.analyticsTracker=AnalyticsTracker.getInstance(),this.peerClient.on(vn,this.onPeerClientConnectionStateChange,this)}removeTrack(t){return Jn(this,void 0,void 0,(function*(){yield this.peerClient.removeTrack(t)}))}}var Xn,Yn,Zn,Qn,tr=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))},er=function(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)},nr=function(t,e,n,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(t,n):i?i.value=n:e.set(t,n),n};class AmazonIVSBroadcastStageClient{constructor(t,e,n){this.emitter=t,this.config=e,this.nonScopedLogger=n,Xn.add(this),this.stageToken=null,this.appTraceId=new TraceId,Yn.set(this,!1),this.useEdp=!0,this.isValid=!0,this.subscriptions=new Map,this.analyticsTracker=AnalyticsTracker.getInstance(),this.mediaStreamManager=MediaStreamManager.getOrRegisterInstance(this),this.stageConnection=new StageConnection(this.nonScopedLogger),this.propagateStageConnectionEvents(this.stageConnection,t),this.analyticsTracker.start();Object.getOwnPropertyNames(AmazonIVSBroadcastStageClient.prototype).forEach((t=>{"stageToken"!==t&&(this[t]=new Proxy(this[t],{apply:(t,e,n)=>{if(!e.isValid)throw new BroadcastClientError(Object.assign({},jt));return Reflect.apply(t,e,n)}}))})),window.addEventListener("beforeunload",(()=>{var t;const e=AbortControllersTracker.getInstance();e.isUnloading=!0,this.unpublish(null===(t=this.stageToken)||void 0===t?void 0:t.rawToken),this.subscriptions.forEach((t=>{t.stop()})),e.abortPendingOperations(),this.analyticsTracker.stop()})),Ye().interceptors.response.use(void 0,(t=>tr(this,void 0,void 0,(function*(){var e;return 429===(null===(e=null==t?void 0:t.response)||void 0===e?void 0:e.status)&&(yield new Promise((t=>{setTimeout(t,1e3)}))),Promise.reject(t)}))))}propagateStageConnectionEvents(t,e){t.on(nn.STAGE_JOINED,(()=>{e.emit(nn.STAGE_JOINED)})),t.on(nn.STAGE_PARTICIPANT_JOINED,(t=>{e.emit(nn.STAGE_PARTICIPANT_JOINED,t)})),t.on(nn.STAGE_PARTICIPANT_KICKED,(t=>{e.emit(nn.STAGE_PARTICIPANT_KICKED,t)})),t.on(nn.STAGE_PARTICIPANT_LEFT,(t=>{e.emit(nn.STAGE_PARTICIPANT_LEFT,t)})),t.on(nn.STAGE_PARTICIPANT_UPDATED,(t=>{e.emit(nn.STAGE_PARTICIPANT_UPDATED,t)})),t.on(nn.STAGE_REFRESH,(()=>{e.emit(nn.STAGE_REFRESH)}))}delete(){this.isValid=!1}join(t){return tr(this,void 0,void 0,(function*(){const e=f();er(this,Xn,"m",Qn).call(this,t),this.stageToken=Ke(t),this.stageToken.assertTokenIsUnexpired(e,Ve.JOIN_RELATED,"join"),this.analyticsTracker.trackEventNoSharedProps(new JoinEvent({token:this.stageToken,eventEndpoint:this.stageToken.eventsURL,whipEndpoint:this.stageToken.whipURL,traceId:e}));try{yield this.stageConnection.connect(this.stageToken,e),nr(this,Yn,!0,"f")}catch(t){const n=new StageClientError(Object.assign(Object.assign({},ze.EVENT_PLANE_CONNECTION_FAILURE),{token:this.stageToken,traceId:e,tag:Ve.JOIN_RELATED,location:"join"}));throw this.analyticsTracker.trackEventNoSharedProps(new StageErrorEvent(n)),n}}))}leave(){if(er(this,Yn,"f")){const t=this.stageConnection.disconnect(),e=this.stageToken;this.analyticsTracker.trackEventNoSharedProps(new LeaveEvent({token:e,eventEndpoint:e.eventsURL,whipEndpoint:e.whipURL,traceId:t}))}}publish(t){return tr(this,void 0,void 0,(function*(){const e=f();let n=this.stageToken;if(t&&(n=Ke(t)),er(this,Yn,"f")||this.stageToken||(this.stageToken=n),!n)throw new Error("A token must be provided either via a preceding join call or as an argument to publish");n.assertTokenIsUnexpired(e,Ve.PUBLISH_RELATED,"publish",n.participantID),this.publication=new StagePublication(n,this.nonScopedLogger,this.mediaStreamManager,f());return{peerConnection:(yield this.publication.publish([this.mediaStreamManager.getTrack(tn.VIDEO),this.mediaStreamManager.getTrack(tn.AUDIO)])).getValidPeerConnectionCanThrow()}}))}unpublish(t){return tr(this,void 0,void 0,(function*(){let e=this.stageToken;if(t&&(e=Ke(t)),!e||!this.publication)throw new Error("A token must be provided either via a preceding join call or as an argument to unpublish");yield this.publication.unpublish()}))}createSubscription(t,e,n){const r=Ke(e);if(!this.stageConnection)throw new Error("Must invoke join() before creating a subscription");const i=new StageSubscription(t,r,this.stageConnection,this.nonScopedLogger,this.mediaStreamManager,f(),n);return this.subscriptions.set(t,i),i}createOrGetPublication(t){const e=Ke(t);if(!this.stageConnection)throw new Error("Must invoke join() before creating a publication");return this.publication||(this.publication=new StagePublication(e,this.nonScopedLogger,this.mediaStreamManager,f())),this.publication}subscribe(t,e,n,r){var i;return tr(this,void 0,void 0,(function*(){let o=this.stageToken;e&&(o=Ke(e));const s=f();if(!o)throw new Error("A token must be provided either via a preceding join call or as an argument to subscribe");const a=null===(i=this.stageConnection)||void 0===i?void 0:i.getParticipant(t);if(er(this,Yn,"f")&&!a)throw new Error("error TBD: participant not found");const c=new StageSubscription(t,o,this.stageConnection,this.nonScopedLogger,this.mediaStreamManager,s,n);return c.subscribe(r).then((e=>(a&&(a.subscribed=!0,a.joinedAt=Date.now(),a.peerClient=e.peerClient,e.mediaStream&&(a.mediaSrcObject=e.mediaStream)),this.subscriptions.set(t,c),{peerConnection:e.peerClient.getValidPeerConnectionCanThrow()})))}))}unsubscribe(t,e){return tr(this,void 0,void 0,(function*(){let n=this.stageToken;if(e&&(n=Ke(e)),!n)throw new Error("A token must be provided either via a preceding join call or as an argument to unsubscribe");const r=this.subscriptions.get(t);return r||this.analyticsTracker.trackErrorAndThrow(new StageClientError(Object.assign(Object.assign({},ze.UNSUBSCRIBE_FAILURE),{token:n,traceId:f(),tag:Ge(Se.SUBSCRIBE,t),location:"unsubscribe",remoteParticipantId:t}))),r.unsubscribe().then((()=>{var e;const n=null===(e=this.stageConnection)||void 0===e?void 0:e.getParticipant(t);n&&(n.subscribed=!1)}))}))}listConnectedParticipants(){var t;return(null===(t=this.stageConnection)||void 0===t?void 0:t.listConnectedParticipants())||[]}listAvailableParticipants(){var t;return(null===(t=this.stageConnection)||void 0===t?void 0:t.listAvailableParticipants())||[]}_trace(t){en(Ke(t.token),this.appTraceId,`app: ${t.message}`,Se.APP_TRACE,t.remoteParticipantID)}addVideoInputDevice(t,e,n){var r;return tr(this,void 0,void 0,(function*(){this.mediaStreamManager.setTrack(tn.VIDEO,t.getTracks()[0]),yield null===(r=this.publication)||void 0===r?void 0:r.replaceTrack(t.getTracks()[0])}))}addAudioInputDevice(t,e){var n;return tr(this,void 0,void 0,(function*(){this.mediaStreamManager.setTrack(tn.AUDIO,t.getTracks()[0]),yield null===(n=this.publication)||void 0===n?void 0:n.replaceTrack(t.getTracks()[0])}))}getConnectionState(){return this.outboundPeerClient.getConnectionState()}on(t,e){this.emitter.on(t,e)}off(t,e){this.emitter.off(t,e)}disableVideo(){er(this,Xn,"m",Zn).call(this,void 0,!1)}enableVideo(){er(this,Xn,"m",Zn).call(this,void 0,!0)}disableAudio(){er(this,Xn,"m",Zn).call(this,!1,void 0)}enableAudio(){er(this,Xn,"m",Zn).call(this,!0,void 0)}}Yn=new WeakMap,Xn=new WeakSet,Zn=function(t,e){var n,r;if(this.stageConnection&&this.publication){const i=this.publication.getAudioSender(),o=this.publication.getVideoSender();(null==i?void 0:i.track)&&void 0!==t&&(i.track.enabled=t),(null==o?void 0:o.track)&&void 0!==e&&(o.track.enabled=e),this.stageConnection.emitStageState(!1===(null===(n=null==i?void 0:i.track)||void 0===n?void 0:n.enabled)||!1,!1===(null===(r=null==o?void 0:o.track)||void 0===r?void 0:r.enabled)||!1)}},Qn=function(t){if("string"!=typeof t)throw new BroadcastClientError(Ft)};let rr=!0,ir=!0;function or(t,e,n){const r=t.match(e);return r&&r.length>=n&&parseInt(r[n],10)}function sr(t,e,n){if(!t.RTCPeerConnection)return;const r=t.RTCPeerConnection.prototype,i=r.addEventListener;r.addEventListener=function(t,r){if(t!==e)return i.apply(this,arguments);const o=t=>{const e=n(t);e&&(r.handleEvent?r.handleEvent(e):r(e))};return this._eventMap=this._eventMap||{},this._eventMap[e]||(this._eventMap[e]=new Map),this._eventMap[e].set(r,o),i.apply(this,[t,o])};const o=r.removeEventListener;r.removeEventListener=function(t,n){if(t!==e||!this._eventMap||!this._eventMap[e])return o.apply(this,arguments);if(!this._eventMap[e].has(n))return o.apply(this,arguments);const r=this._eventMap[e].get(n);return this._eventMap[e].delete(n),0===this._eventMap[e].size&&delete this._eventMap[e],0===Object.keys(this._eventMap).length&&delete this._eventMap,o.apply(this,[t,r])},Object.defineProperty(r,"on"+e,{get(){return this["_on"+e]},set(t){this["_on"+e]&&(this.removeEventListener(e,this["_on"+e]),delete this["_on"+e]),t&&this.addEventListener(e,this["_on"+e]=t)},enumerable:!0,configurable:!0})}function ar(t){return"boolean"!=typeof t?new Error("Argument type: "+typeof t+". Please use a boolean."):(rr=t,t?"adapter.js logging disabled":"adapter.js logging enabled")}function cr(t){return"boolean"!=typeof t?new Error("Argument type: "+typeof t+". Please use a boolean."):(ir=!t,"adapter.js deprecation warnings "+(t?"disabled":"enabled"))}function ur(){if("object"==typeof window){if(rr)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function lr(t,e){ir&&console.warn(t+" is deprecated, please use "+e+" instead.")}function dr(t){return"[object Object]"===Object.prototype.toString.call(t)}function hr(t){return dr(t)?Object.keys(t).reduce((function(e,n){const r=dr(t[n]),i=r?hr(t[n]):t[n],o=r&&!Object.keys(i).length;return void 0===i||o?e:Object.assign(e,{[n]:i})}),{}):t}function pr(t,e,n){e&&!n.has(e.id)&&(n.set(e.id,e),Object.keys(e).forEach((r=>{r.endsWith("Id")?pr(t,t.get(e[r]),n):r.endsWith("Ids")&&e[r].forEach((e=>{pr(t,t.get(e),n)}))})))}function fr(t,e,n){const r=n?"outbound-rtp":"inbound-rtp",i=new Map;if(null===e)return i;const o=[];return t.forEach((t=>{"track"===t.type&&t.trackIdentifier===e.id&&o.push(t)})),o.forEach((e=>{t.forEach((n=>{n.type===r&&n.trackId===e.id&&pr(t,n,i)}))})),i}const gr=ur;function vr(t,e){const n=t&&t.navigator;if(!n.mediaDevices)return;const r=function(t){if("object"!=typeof t||t.mandatory||t.optional)return t;const e={};return Object.keys(t).forEach((n=>{if("require"===n||"advanced"===n||"mediaSource"===n)return;const r="object"==typeof t[n]?t[n]:{ideal:t[n]};void 0!==r.exact&&"number"==typeof r.exact&&(r.min=r.max=r.exact);const i=function(t,e){return t?t+e.charAt(0).toUpperCase()+e.slice(1):"deviceId"===e?"sourceId":e};if(void 0!==r.ideal){e.optional=e.optional||[];let t={};"number"==typeof r.ideal?(t[i("min",n)]=r.ideal,e.optional.push(t),t={},t[i("max",n)]=r.ideal,e.optional.push(t)):(t[i("",n)]=r.ideal,e.optional.push(t))}void 0!==r.exact&&"number"!=typeof r.exact?(e.mandatory=e.mandatory||{},e.mandatory[i("",n)]=r.exact):["min","max"].forEach((t=>{void 0!==r[t]&&(e.mandatory=e.mandatory||{},e.mandatory[i(t,n)]=r[t])}))})),t.advanced&&(e.optional=(e.optional||[]).concat(t.advanced)),e},i=function(t,i){if(e.version>=61)return i(t);if((t=JSON.parse(JSON.stringify(t)))&&"object"==typeof t.audio){const e=function(t,e,n){e in t&&!(n in t)&&(t[n]=t[e],delete t[e])};e((t=JSON.parse(JSON.stringify(t))).audio,"autoGainControl","googAutoGainControl"),e(t.audio,"noiseSuppression","googNoiseSuppression"),t.audio=r(t.audio)}if(t&&"object"==typeof t.video){let o=t.video.facingMode;o=o&&("object"==typeof o?o:{ideal:o});const s=e.version<66;if(o&&("user"===o.exact||"environment"===o.exact||"user"===o.ideal||"environment"===o.ideal)&&(!n.mediaDevices.getSupportedConstraints||!n.mediaDevices.getSupportedConstraints().facingMode||s)){let e;if(delete t.video.facingMode,"environment"===o.exact||"environment"===o.ideal?e=["back","rear"]:"user"!==o.exact&&"user"!==o.ideal||(e=["front"]),e)return n.mediaDevices.enumerateDevices().then((n=>{let s=(n=n.filter((t=>"videoinput"===t.kind))).find((t=>e.some((e=>t.label.toLowerCase().includes(e)))));return!s&&n.length&&e.includes("back")&&(s=n[n.length-1]),s&&(t.video.deviceId=o.exact?{exact:s.deviceId}:{ideal:s.deviceId}),t.video=r(t.video),gr("chrome: "+JSON.stringify(t)),i(t)}))}t.video=r(t.video)}return gr("chrome: "+JSON.stringify(t)),i(t)},o=function(t){return e.version>=64?t:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[t.name]||t.name,message:t.message,constraint:t.constraint||t.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(n.getUserMedia=function(t,e,r){i(t,(t=>{n.webkitGetUserMedia(t,e,(t=>{r&&r(o(t))}))}))}.bind(n),n.mediaDevices.getUserMedia){const t=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(e){return i(e,(e=>t(e).then((t=>{if(e.audio&&!t.getAudioTracks().length||e.video&&!t.getVideoTracks().length)throw t.getTracks().forEach((t=>{t.stop()})),new DOMException("","NotFoundError");return t}),(t=>Promise.reject(o(t))))))}}}function mr(t,e){t.navigator.mediaDevices&&"getDisplayMedia"in t.navigator.mediaDevices||t.navigator.mediaDevices&&("function"==typeof e?t.navigator.mediaDevices.getDisplayMedia=function(n){return e(n).then((e=>{const r=n.video&&n.video.width,i=n.video&&n.video.height,o=n.video&&n.video.frameRate;return n.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:e,maxFrameRate:o||3}},r&&(n.video.mandatory.maxWidth=r),i&&(n.video.mandatory.maxHeight=i),t.navigator.mediaDevices.getUserMedia(n)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}function yr(t){t.MediaStream=t.MediaStream||t.webkitMediaStream}function _r(t){if("object"==typeof t&&t.RTCPeerConnection&&!("ontrack"in t.RTCPeerConnection.prototype)){Object.defineProperty(t.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(t){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=t)},enumerable:!0,configurable:!0});const e=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=e=>{e.stream.addEventListener("addtrack",(n=>{let r;r=t.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((t=>t.track&&t.track.id===n.track.id)):{track:n.track};const i=new Event("track");i.track=n.track,i.receiver=r,i.transceiver={receiver:r},i.streams=[e.stream],this.dispatchEvent(i)})),e.stream.getTracks().forEach((n=>{let r;r=t.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((t=>t.track&&t.track.id===n.id)):{track:n};const i=new Event("track");i.track=n,i.receiver=r,i.transceiver={receiver:r},i.streams=[e.stream],this.dispatchEvent(i)}))},this.addEventListener("addstream",this._ontrackpoly)),e.apply(this,arguments)}}else sr(t,"track",(t=>(t.transceiver||Object.defineProperty(t,"transceiver",{value:{receiver:t.receiver}}),t)))}function br(t){if("object"==typeof t&&t.RTCPeerConnection&&!("getSenders"in t.RTCPeerConnection.prototype)&&"createDTMFSender"in t.RTCPeerConnection.prototype){const e=function(t,e){return{track:e,get dtmf(){return void 0===this._dtmf&&("audio"===e.kind?this._dtmf=t.createDTMFSender(e):this._dtmf=null),this._dtmf},_pc:t}};if(!t.RTCPeerConnection.prototype.getSenders){t.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const n=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function(t,r){let i=n.apply(this,arguments);return i||(i=e(this,t),this._senders.push(i)),i};const r=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function(t){r.apply(this,arguments);const e=this._senders.indexOf(t);-1!==e&&this._senders.splice(e,1)}}const n=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(t){this._senders=this._senders||[],n.apply(this,[t]),t.getTracks().forEach((t=>{this._senders.push(e(this,t))}))};const r=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(t){this._senders=this._senders||[],r.apply(this,[t]),t.getTracks().forEach((t=>{const e=this._senders.find((e=>e.track===t));e&&this._senders.splice(this._senders.indexOf(e),1)}))}}else if("object"==typeof t&&t.RTCPeerConnection&&"getSenders"in t.RTCPeerConnection.prototype&&"createDTMFSender"in t.RTCPeerConnection.prototype&&t.RTCRtpSender&&!("dtmf"in t.RTCRtpSender.prototype)){const e=t.RTCPeerConnection.prototype.getSenders;t.RTCPeerConnection.prototype.getSenders=function(){const t=e.apply(this,[]);return t.forEach((t=>t._pc=this)),t},Object.defineProperty(t.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function Er(t){if(!t.RTCPeerConnection)return;const e=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){const[t,n,r]=arguments;if(arguments.length>0&&"function"==typeof t)return e.apply(this,arguments);if(0===e.length&&(0===arguments.length||"function"!=typeof t))return e.apply(this,[]);const i=function(t){const e={};return t.result().forEach((t=>{const n={id:t.id,timestamp:t.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[t.type]||t.type};t.names().forEach((e=>{n[e]=t.stat(e)})),e[n.id]=n})),e},o=function(t){return new Map(Object.keys(t).map((e=>[e,t[e]])))};if(arguments.length>=2){const r=function(t){n(o(i(t)))};return e.apply(this,[r,t])}return new Promise(((t,n)=>{e.apply(this,[function(e){t(o(i(e)))},n])})).then(n,r)}}function Sr(t){if(!("object"==typeof t&&t.RTCPeerConnection&&t.RTCRtpSender&&t.RTCRtpReceiver))return;if(!("getStats"in t.RTCRtpSender.prototype)){const e=t.RTCPeerConnection.prototype.getSenders;e&&(t.RTCPeerConnection.prototype.getSenders=function(){const t=e.apply(this,[]);return t.forEach((t=>t._pc=this)),t});const n=t.RTCPeerConnection.prototype.addTrack;n&&(t.RTCPeerConnection.prototype.addTrack=function(){const t=n.apply(this,arguments);return t._pc=this,t}),t.RTCRtpSender.prototype.getStats=function(){const t=this;return this._pc.getStats().then((e=>fr(e,t.track,!0)))}}if(!("getStats"in t.RTCRtpReceiver.prototype)){const e=t.RTCPeerConnection.prototype.getReceivers;e&&(t.RTCPeerConnection.prototype.getReceivers=function(){const t=e.apply(this,[]);return t.forEach((t=>t._pc=this)),t}),sr(t,"track",(t=>(t.receiver._pc=t.srcElement,t))),t.RTCRtpReceiver.prototype.getStats=function(){const t=this;return this._pc.getStats().then((e=>fr(e,t.track,!1)))}}if(!("getStats"in t.RTCRtpSender.prototype)||!("getStats"in t.RTCRtpReceiver.prototype))return;const e=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof t.MediaStreamTrack){const t=arguments[0];let e,n,r;return this.getSenders().forEach((n=>{n.track===t&&(e?r=!0:e=n)})),this.getReceivers().forEach((e=>(e.track===t&&(n?r=!0:n=e),e.track===t))),r||e&&n?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):e?e.getStats():n?n.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return e.apply(this,arguments)}}function Cr(t){t.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((t=>this._shimmedLocalStreams[t][0]))};const e=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function(t,n){if(!n)return e.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const r=e.apply(this,arguments);return this._shimmedLocalStreams[n.id]?-1===this._shimmedLocalStreams[n.id].indexOf(r)&&this._shimmedLocalStreams[n.id].push(r):this._shimmedLocalStreams[n.id]=[n,r],r};const n=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(t){this._shimmedLocalStreams=this._shimmedLocalStreams||{},t.getTracks().forEach((t=>{if(this.getSenders().find((e=>e.track===t)))throw new DOMException("Track already exists.","InvalidAccessError")}));const e=this.getSenders();n.apply(this,arguments);const r=this.getSenders().filter((t=>-1===e.indexOf(t)));this._shimmedLocalStreams[t.id]=[t].concat(r)};const r=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(t){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[t.id],r.apply(this,arguments)};const i=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function(t){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},t&&Object.keys(this._shimmedLocalStreams).forEach((e=>{const n=this._shimmedLocalStreams[e].indexOf(t);-1!==n&&this._shimmedLocalStreams[e].splice(n,1),1===this._shimmedLocalStreams[e].length&&delete this._shimmedLocalStreams[e]})),i.apply(this,arguments)}}function wr(t,e){if(!t.RTCPeerConnection)return;if(t.RTCPeerConnection.prototype.addTrack&&e.version>=65)return Cr(t);const n=t.RTCPeerConnection.prototype.getLocalStreams;t.RTCPeerConnection.prototype.getLocalStreams=function(){const t=n.apply(this);return this._reverseStreams=this._reverseStreams||{},t.map((t=>this._reverseStreams[t.id]))};const r=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(e){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},e.getTracks().forEach((t=>{if(this.getSenders().find((e=>e.track===t)))throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[e.id]){const n=new t.MediaStream(e.getTracks());this._streams[e.id]=n,this._reverseStreams[n.id]=e,e=n}r.apply(this,[e])};const i=t.RTCPeerConnection.prototype.removeStream;function o(t,e){let n=e.sdp;return Object.keys(t._reverseStreams||[]).forEach((e=>{const r=t._reverseStreams[e],i=t._streams[r.id];n=n.replace(new RegExp(i.id,"g"),r.id)})),new RTCSessionDescription({type:e.type,sdp:n})}t.RTCPeerConnection.prototype.removeStream=function(t){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[t.id]||t]),delete this._reverseStreams[this._streams[t.id]?this._streams[t.id].id:t.id],delete this._streams[t.id]},t.RTCPeerConnection.prototype.addTrack=function(e,n){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const r=[].slice.call(arguments,1);if(1!==r.length||!r[0].getTracks().find((t=>t===e)))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find((t=>t.track===e)))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const i=this._streams[n.id];if(i)i.addTrack(e),Promise.resolve().then((()=>{this.dispatchEvent(new Event("negotiationneeded"))}));else{const r=new t.MediaStream([e]);this._streams[n.id]=r,this._reverseStreams[r.id]=n,this.addStream(r)}return this.getSenders().find((t=>t.track===e))},["createOffer","createAnswer"].forEach((function(e){const n=t.RTCPeerConnection.prototype[e],r={[e](){const t=arguments;return arguments.length&&"function"==typeof arguments[0]?n.apply(this,[e=>{const n=o(this,e);t[0].apply(null,[n])},e=>{t[1]&&t[1].apply(null,e)},arguments[2]]):n.apply(this,arguments).then((t=>o(this,t)))}};t.RTCPeerConnection.prototype[e]=r[e]}));const s=t.RTCPeerConnection.prototype.setLocalDescription;t.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=function(t,e){let n=e.sdp;return Object.keys(t._reverseStreams||[]).forEach((e=>{const r=t._reverseStreams[e],i=t._streams[r.id];n=n.replace(new RegExp(r.id,"g"),i.id)})),new RTCSessionDescription({type:e.type,sdp:n})}(this,arguments[0]),s.apply(this,arguments)):s.apply(this,arguments)};const a=Object.getOwnPropertyDescriptor(t.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(t.RTCPeerConnection.prototype,"localDescription",{get(){const t=a.get.apply(this);return""===t.type?t:o(this,t)}}),t.RTCPeerConnection.prototype.removeTrack=function(t){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!t._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(t._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");let e;this._streams=this._streams||{},Object.keys(this._streams).forEach((n=>{this._streams[n].getTracks().find((e=>t.track===e))&&(e=this._streams[n])})),e&&(1===e.getTracks().length?this.removeStream(this._reverseStreams[e.id]):e.removeTrack(t.track),this.dispatchEvent(new Event("negotiationneeded")))}}function Tr(t,e){!t.RTCPeerConnection&&t.webkitRTCPeerConnection&&(t.RTCPeerConnection=t.webkitRTCPeerConnection),t.RTCPeerConnection&&e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(e){const n=t.RTCPeerConnection.prototype[e],r={[e](){return arguments[0]=new("addIceCandidate"===e?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};t.RTCPeerConnection.prototype[e]=r[e]}))}function Ir(t,e){sr(t,"negotiationneeded",(t=>{const n=t.target;if(!(e.version<72||n.getConfiguration&&"plan-b"===n.getConfiguration().sdpSemantics)||"stable"===n.signalingState)return t}))}function Rr(t,e){const n=t&&t.navigator,r=t&&t.MediaStreamTrack;if(n.getUserMedia=function(t,e,r){lr("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),n.mediaDevices.getUserMedia(t).then(e,r)},!(e.version>55&&"autoGainControl"in n.mediaDevices.getSupportedConstraints())){const t=function(t,e,n){e in t&&!(n in t)&&(t[n]=t[e],delete t[e])},e=n.mediaDevices.getUserMedia.bind(n.mediaDevices);if(n.mediaDevices.getUserMedia=function(n){return"object"==typeof n&&"object"==typeof n.audio&&(n=JSON.parse(JSON.stringify(n)),t(n.audio,"autoGainControl","mozAutoGainControl"),t(n.audio,"noiseSuppression","mozNoiseSuppression")),e(n)},r&&r.prototype.getSettings){const e=r.prototype.getSettings;r.prototype.getSettings=function(){const n=e.apply(this,arguments);return t(n,"mozAutoGainControl","autoGainControl"),t(n,"mozNoiseSuppression","noiseSuppression"),n}}if(r&&r.prototype.applyConstraints){const e=r.prototype.applyConstraints;r.prototype.applyConstraints=function(n){return"audio"===this.kind&&"object"==typeof n&&(n=JSON.parse(JSON.stringify(n)),t(n,"autoGainControl","mozAutoGainControl"),t(n,"noiseSuppression","mozNoiseSuppression")),e.apply(this,[n])}}}}function Ar(t,e){t.navigator.mediaDevices&&"getDisplayMedia"in t.navigator.mediaDevices||t.navigator.mediaDevices&&(t.navigator.mediaDevices.getDisplayMedia=function(n){if(!n||!n.video){const t=new DOMException("getDisplayMedia without video constraints is undefined");return t.name="NotFoundError",t.code=8,Promise.reject(t)}return!0===n.video?n.video={mediaSource:e}:n.video.mediaSource=e,t.navigator.mediaDevices.getUserMedia(n)})}function kr(t){"object"==typeof t&&t.RTCTrackEvent&&"receiver"in t.RTCTrackEvent.prototype&&!("transceiver"in t.RTCTrackEvent.prototype)&&Object.defineProperty(t.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function Or(t,e){if("object"!=typeof t||!t.RTCPeerConnection&&!t.mozRTCPeerConnection)return;!t.RTCPeerConnection&&t.mozRTCPeerConnection&&(t.RTCPeerConnection=t.mozRTCPeerConnection),e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(e){const n=t.RTCPeerConnection.prototype[e],r={[e](){return arguments[0]=new("addIceCandidate"===e?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};t.RTCPeerConnection.prototype[e]=r[e]}));const n={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},r=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){const[t,i,o]=arguments;return r.apply(this,[t||null]).then((t=>{if(e.version<53&&!i)try{t.forEach((t=>{t.type=n[t.type]||t.type}))}catch(e){if("TypeError"!==e.name)throw e;t.forEach(((e,r)=>{t.set(r,Object.assign({},e,{type:n[e.type]||e.type}))}))}return t})).then(i,o)}}function Pr(t){if("object"!=typeof t||!t.RTCPeerConnection||!t.RTCRtpSender)return;if(t.RTCRtpSender&&"getStats"in t.RTCRtpSender.prototype)return;const e=t.RTCPeerConnection.prototype.getSenders;e&&(t.RTCPeerConnection.prototype.getSenders=function(){const t=e.apply(this,[]);return t.forEach((t=>t._pc=this)),t});const n=t.RTCPeerConnection.prototype.addTrack;n&&(t.RTCPeerConnection.prototype.addTrack=function(){const t=n.apply(this,arguments);return t._pc=this,t}),t.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function Nr(t){if("object"!=typeof t||!t.RTCPeerConnection||!t.RTCRtpSender)return;if(t.RTCRtpSender&&"getStats"in t.RTCRtpReceiver.prototype)return;const e=t.RTCPeerConnection.prototype.getReceivers;e&&(t.RTCPeerConnection.prototype.getReceivers=function(){const t=e.apply(this,[]);return t.forEach((t=>t._pc=this)),t}),sr(t,"track",(t=>(t.receiver._pc=t.srcElement,t))),t.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function Dr(t){t.RTCPeerConnection&&!("removeStream"in t.RTCPeerConnection.prototype)&&(t.RTCPeerConnection.prototype.removeStream=function(t){lr("removeStream","removeTrack"),this.getSenders().forEach((e=>{e.track&&t.getTracks().includes(e.track)&&this.removeTrack(e)}))})}function xr(t){t.DataChannel&&!t.RTCDataChannel&&(t.RTCDataChannel=t.DataChannel)}function Mr(t){if("object"!=typeof t||!t.RTCPeerConnection)return;const e=t.RTCPeerConnection.prototype.addTransceiver;e&&(t.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let t=arguments[1]&&arguments[1].sendEncodings;void 0===t&&(t=[]),t=[...t];const n=t.length>0;n&&t.forEach((t=>{if("rid"in t){if(!/^[a-z0-9]{0,16}$/i.test(t.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in t&&!(parseFloat(t.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in t&&!(parseFloat(t.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")}));const r=e.apply(this,arguments);if(n){const{sender:e}=r,n=e.getParameters();(!("encodings"in n)||1===n.encodings.length&&0===Object.keys(n.encodings[0]).length)&&(n.encodings=t,e.sendEncodings=t,this.setParametersPromises.push(e.setParameters(n).then((()=>{delete e.sendEncodings})).catch((()=>{delete e.sendEncodings}))))}return r})}function jr(t){if("object"!=typeof t||!t.RTCRtpSender)return;const e=t.RTCRtpSender.prototype.getParameters;e&&(t.RTCRtpSender.prototype.getParameters=function(){const t=e.apply(this,arguments);return"encodings"in t||(t.encodings=[].concat(this.sendEncodings||[{}])),t})}function Lr(t){if("object"!=typeof t||!t.RTCPeerConnection)return;const e=t.RTCPeerConnection.prototype.createOffer;t.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>e.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):e.apply(this,arguments)}}function Ur(t){if("object"!=typeof t||!t.RTCPeerConnection)return;const e=t.RTCPeerConnection.prototype.createAnswer;t.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>e.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):e.apply(this,arguments)}}function Br(t){if("object"==typeof t&&t.RTCPeerConnection){if("getLocalStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in t.RTCPeerConnection.prototype)){const e=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addStream=function(t){this._localStreams||(this._localStreams=[]),this._localStreams.includes(t)||this._localStreams.push(t),t.getAudioTracks().forEach((n=>e.call(this,n,t))),t.getVideoTracks().forEach((n=>e.call(this,n,t)))},t.RTCPeerConnection.prototype.addTrack=function(t,...n){return n&&n.forEach((t=>{this._localStreams?this._localStreams.includes(t)||this._localStreams.push(t):this._localStreams=[t]})),e.apply(this,arguments)}}"removeStream"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.removeStream=function(t){this._localStreams||(this._localStreams=[]);const e=this._localStreams.indexOf(t);if(-1===e)return;this._localStreams.splice(e,1);const n=t.getTracks();this.getSenders().forEach((t=>{n.includes(t.track)&&this.removeTrack(t)}))})}}function Fr(t){if("object"==typeof t&&t.RTCPeerConnection&&("getRemoteStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in t.RTCPeerConnection.prototype))){Object.defineProperty(t.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(t){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=t),this.addEventListener("track",this._onaddstreampoly=t=>{t.streams.forEach((t=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(t))return;this._remoteStreams.push(t);const e=new Event("addstream");e.stream=t,this.dispatchEvent(e)}))})}});const e=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){const t=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(e){e.streams.forEach((e=>{if(t._remoteStreams||(t._remoteStreams=[]),t._remoteStreams.indexOf(e)>=0)return;t._remoteStreams.push(e);const n=new Event("addstream");n.stream=e,t.dispatchEvent(n)}))}),e.apply(t,arguments)}}}function Vr(t){if("object"!=typeof t||!t.RTCPeerConnection)return;const e=t.RTCPeerConnection.prototype,n=e.createOffer,r=e.createAnswer,i=e.setLocalDescription,o=e.setRemoteDescription,s=e.addIceCandidate;e.createOffer=function(t,e){const r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return e?(i.then(t,e),Promise.resolve()):i},e.createAnswer=function(t,e){const n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return e?(i.then(t,e),Promise.resolve()):i};let a=function(t,e,n){const r=i.apply(this,[t]);return n?(r.then(e,n),Promise.resolve()):r};e.setLocalDescription=a,a=function(t,e,n){const r=o.apply(this,[t]);return n?(r.then(e,n),Promise.resolve()):r},e.setRemoteDescription=a,a=function(t,e,n){const r=s.apply(this,[t]);return n?(r.then(e,n),Promise.resolve()):r},e.addIceCandidate=a}function Gr(t){const e=t&&t.navigator;if(e.mediaDevices&&e.mediaDevices.getUserMedia){const t=e.mediaDevices,n=t.getUserMedia.bind(t);e.mediaDevices.getUserMedia=t=>n(Wr(t))}!e.getUserMedia&&e.mediaDevices&&e.mediaDevices.getUserMedia&&(e.getUserMedia=function(t,n,r){e.mediaDevices.getUserMedia(t).then(n,r)}.bind(e))}function Wr(t){return t&&void 0!==t.video?Object.assign({},t,{video:hr(t.video)}):t}function qr(t){if(!t.RTCPeerConnection)return;const e=t.RTCPeerConnection;t.RTCPeerConnection=function(t,n){if(t&&t.iceServers){const e=[];for(let n=0;n<t.iceServers.length;n++){let r=t.iceServers[n];!r.hasOwnProperty("urls")&&r.hasOwnProperty("url")?(lr("RTCIceServer.url","RTCIceServer.urls"),r=JSON.parse(JSON.stringify(r)),r.urls=r.url,delete r.url,e.push(r)):e.push(t.iceServers[n])}t.iceServers=e}return new e(t,n)},t.RTCPeerConnection.prototype=e.prototype,"generateCertificate"in e&&Object.defineProperty(t.RTCPeerConnection,"generateCertificate",{get:()=>e.generateCertificate})}function zr(t){"object"==typeof t&&t.RTCTrackEvent&&"receiver"in t.RTCTrackEvent.prototype&&!("transceiver"in t.RTCTrackEvent.prototype)&&Object.defineProperty(t.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function $r(t){const e=t.RTCPeerConnection.prototype.createOffer;t.RTCPeerConnection.prototype.createOffer=function(t){if(t){void 0!==t.offerToReceiveAudio&&(t.offerToReceiveAudio=!!t.offerToReceiveAudio);const e=this.getTransceivers().find((t=>"audio"===t.receiver.track.kind));!1===t.offerToReceiveAudio&&e?"sendrecv"===e.direction?e.setDirection?e.setDirection("sendonly"):e.direction="sendonly":"recvonly"===e.direction&&(e.setDirection?e.setDirection("inactive"):e.direction="inactive"):!0!==t.offerToReceiveAudio||e||this.addTransceiver("audio",{direction:"recvonly"}),void 0!==t.offerToReceiveVideo&&(t.offerToReceiveVideo=!!t.offerToReceiveVideo);const n=this.getTransceivers().find((t=>"video"===t.receiver.track.kind));!1===t.offerToReceiveVideo&&n?"sendrecv"===n.direction?n.setDirection?n.setDirection("sendonly"):n.direction="sendonly":"recvonly"===n.direction&&(n.setDirection?n.setDirection("inactive"):n.direction="inactive"):!0!==t.offerToReceiveVideo||n||this.addTransceiver("video",{direction:"recvonly"})}return e.apply(this,arguments)}}function Hr(t){"object"!=typeof t||t.AudioContext||(t.AudioContext=t.webkitAudioContext)}var Kr=n(7539),Jr=n.n(Kr);function Xr(t){if(!t.RTCIceCandidate||t.RTCIceCandidate&&"foundation"in t.RTCIceCandidate.prototype)return;const e=t.RTCIceCandidate;t.RTCIceCandidate=function(t){if("object"==typeof t&&t.candidate&&0===t.candidate.indexOf("a=")&&((t=JSON.parse(JSON.stringify(t))).candidate=t.candidate.substr(2)),t.candidate&&t.candidate.length){const n=new e(t),r=Jr().parseCandidate(t.candidate),i=Object.assign(n,r);return i.toJSON=function(){return{candidate:i.candidate,sdpMid:i.sdpMid,sdpMLineIndex:i.sdpMLineIndex,usernameFragment:i.usernameFragment}},i}return new e(t)},t.RTCIceCandidate.prototype=e.prototype,sr(t,"icecandidate",(e=>(e.candidate&&Object.defineProperty(e,"candidate",{value:new t.RTCIceCandidate(e.candidate),writable:"false"}),e)))}function Yr(t){!t.RTCIceCandidate||t.RTCIceCandidate&&"relayProtocol"in t.RTCIceCandidate.prototype||sr(t,"icecandidate",(t=>{if(t.candidate){const e=Jr().parseCandidate(t.candidate.candidate);"relay"===e.type&&(t.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[e.priority>>24])}return t}))}function Zr(t,e){if(!t.RTCPeerConnection)return;"sctp"in t.RTCPeerConnection.prototype||Object.defineProperty(t.RTCPeerConnection.prototype,"sctp",{get(){return void 0===this._sctp?null:this._sctp}});const n=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===e.browser&&e.version>=76){const{sdpSemantics:t}=this.getConfiguration();"plan-b"===t&&Object.defineProperty(this,"sctp",{get(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(function(t){if(!t||!t.sdp)return!1;const e=Jr().splitSections(t.sdp);return e.shift(),e.some((t=>{const e=Jr().parseMLine(t);return e&&"application"===e.kind&&-1!==e.protocol.indexOf("SCTP")}))}(arguments[0])){const t=function(t){const e=t.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===e||e.length<2)return-1;const n=parseInt(e[1],10);return n!=n?-1:n}(arguments[0]),n=function(t){let n=65536;return"firefox"===e.browser&&(n=e.version<57?-1===t?16384:2147483637:e.version<60?57===e.version?65535:65536:2147483637),n}(t),r=function(t,n){let r=65536;"firefox"===e.browser&&57===e.version&&(r=65535);const i=Jr().matchPrefix(t.sdp,"a=max-message-size:");return i.length>0?r=parseInt(i[0].substr(19),10):"firefox"===e.browser&&-1!==n&&(r=2147483637),r}(arguments[0],t);let i;i=0===n&&0===r?Number.POSITIVE_INFINITY:0===n||0===r?Math.max(n,r):Math.min(n,r);const o={};Object.defineProperty(o,"maxMessageSize",{get:()=>i}),this._sctp=o}return n.apply(this,arguments)}}function Qr(t){if(!t.RTCPeerConnection||!("createDataChannel"in t.RTCPeerConnection.prototype))return;function e(t,e){const n=t.send;t.send=function(){const r=arguments[0],i=r.length||r.size||r.byteLength;if("open"===t.readyState&&e.sctp&&i>e.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+e.sctp.maxMessageSize+" bytes)");return n.apply(t,arguments)}}const n=t.RTCPeerConnection.prototype.createDataChannel;t.RTCPeerConnection.prototype.createDataChannel=function(){const t=n.apply(this,arguments);return e(t,this),t},sr(t,"datachannel",(t=>(e(t.channel,t.target),t)))}function ti(t){if(!t.RTCPeerConnection||"connectionState"in t.RTCPeerConnection.prototype)return;const e=t.RTCPeerConnection.prototype;Object.defineProperty(e,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(e,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(t){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),t&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=t)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach((t=>{const n=e[t];e[t]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=t=>{const e=t.target;if(e._lastConnectionState!==e.connectionState){e._lastConnectionState=e.connectionState;const n=new Event("connectionstatechange",t);e.dispatchEvent(n)}return t},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),n.apply(this,arguments)}}))}function ei(t,e){if(!t.RTCPeerConnection)return;if("chrome"===e.browser&&e.version>=71)return;if("safari"===e.browser&&e.version>=605)return;const n=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(e){if(e&&e.sdp&&-1!==e.sdp.indexOf("\na=extmap-allow-mixed")){const n=e.sdp.split("\n").filter((t=>"a=extmap-allow-mixed"!==t.trim())).join("\n");t.RTCSessionDescription&&e instanceof t.RTCSessionDescription?arguments[0]=new t.RTCSessionDescription({type:e.type,sdp:n}):e.sdp=n}return n.apply(this,arguments)}}function ni(t,e){if(!t.RTCPeerConnection||!t.RTCPeerConnection.prototype)return;const n=t.RTCPeerConnection.prototype.addIceCandidate;n&&0!==n.length&&(t.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===e.browser&&e.version<78||"firefox"===e.browser&&e.version<68||"safari"===e.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():n.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function ri(t,e){if(!t.RTCPeerConnection||!t.RTCPeerConnection.prototype)return;const n=t.RTCPeerConnection.prototype.setLocalDescription;n&&0!==n.length&&(t.RTCPeerConnection.prototype.setLocalDescription=function(){let t=arguments[0]||{};if("object"!=typeof t||t.type&&t.sdp)return n.apply(this,arguments);if(t={type:t.type,sdp:t.sdp},!t.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":t.type="offer";break;default:t.type="answer"}if(t.sdp||"offer"!==t.type&&"answer"!==t.type)return n.apply(this,[t]);return("offer"===t.type?this.createOffer:this.createAnswer).apply(this).then((t=>n.apply(this,[t])))})}!function({window:t}={},n={shimChrome:!0,shimFirefox:!0,shimSafari:!0}){const r=ur,a=function(t){const e={browser:null,version:null};if(void 0===t||!t.navigator)return e.browser="Not a browser.",e;const{navigator:n}=t;if(n.mozGetUserMedia)e.browser="firefox",e.version=or(n.userAgent,/Firefox\/(\d+)\./,1);else if(n.webkitGetUserMedia||!1===t.isSecureContext&&t.webkitRTCPeerConnection)e.browser="chrome",e.version=or(n.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!t.RTCPeerConnection||!n.userAgent.match(/AppleWebKit\/(\d+)\./))return e.browser="Not a supported browser.",e;e.browser="safari",e.version=or(n.userAgent,/AppleWebKit\/(\d+)\./,1),e.supportsUnifiedPlan=t.RTCRtpTransceiver&&"currentDirection"in t.RTCRtpTransceiver.prototype}return e}(t),c={browserDetails:a,commonShim:s,extractVersion:or,disableLog:ar,disableWarnings:cr,sdp:Kr};switch(a.browser){case"chrome":if(!e||!Tr||!n.shimChrome)return r("Chrome shim is not included in this adapter release."),c;if(null===a.version)return r("Chrome shim can not determine version, not shimming."),c;r("adapter.js shimming chrome."),c.browserShim=e,ni(t,a),ri(t),vr(t,a),yr(t),Tr(t,a),_r(t),wr(t,a),br(t),Er(t),Sr(t),Ir(t,a),Xr(t),Yr(t),ti(t),Zr(t,a),Qr(t),ei(t,a);break;case"firefox":if(!i||!Or||!n.shimFirefox)return r("Firefox shim is not included in this adapter release."),c;r("adapter.js shimming firefox."),c.browserShim=i,ni(t,a),ri(t),Rr(t,a),Or(t,a),kr(t),Dr(t),Pr(t),Nr(t),xr(t),Mr(t),jr(t),Lr(t),Ur(t),Xr(t),ti(t),Zr(t,a),Qr(t);break;case"safari":if(!o||!n.shimSafari)return r("Safari shim is not included in this adapter release."),c;r("adapter.js shimming safari."),c.browserShim=o,ni(t,a),ri(t),qr(t),$r(t),Vr(t),Br(t),Fr(t),zr(t),Gr(t),Hr(t),Xr(t),Yr(t),Zr(t,a),Qr(t),ei(t,a);break;default:r("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window});var ii={Request:"Request",Singleton:"Singleton",Transient:"Transient"},oi={ConstantValue:"ConstantValue",Constructor:"Constructor",DynamicValue:"DynamicValue",Factory:"Factory",Function:"Function",Instance:"Instance",Invalid:"Invalid",Provider:"Provider"},si={ClassProperty:"ClassProperty",ConstructorArgument:"ConstructorArgument",Variable:"Variable"},ai=0;function ci(){return ai++}var ui=function(){function t(t,e){this.id=ci(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=oi.Invalid,this.constraint=function(t){return!0},this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.onActivation=null,this.onDeactivation=null,this.dynamicValue=null}return t.prototype.clone=function(){var e=new t(this.serviceIdentifier,this.scope);return e.activated=e.scope===ii.Singleton&&this.activated,e.implementationType=this.implementationType,e.dynamicValue=this.dynamicValue,e.scope=this.scope,e.type=this.type,e.factory=this.factory,e.provider=this.provider,e.constraint=this.constraint,e.onActivation=this.onActivation,e.onDeactivation=this.onDeactivation,e.cache=this.cache,e},t}(),li=function(){function t(){}return t.prototype.getConstructorMetadata=function(t){return{compilerGeneratedMetadata:Reflect.getMetadata(z,t),userGeneratedMetadata:Reflect.getMetadata(W,t)||{}}},t.prototype.getPropertiesMetadata=function(t){return Reflect.getMetadata(q,t)||[]},t}(),di={MultipleBindingsAvailable:2,NoBindingsAvailable:0,OnlyOneBindingAvailable:1};function hi(t){return t instanceof RangeError||t.message===j}function pi(t){return"function"==typeof t?t.name:"symbol"==typeof t?t.toString():t}function fi(t,e,n){var r="",i=n(t,e);return 0!==i.length&&(r="\nRegistered bindings:",i.forEach((function(t){var e="Object";null!==t.implementationType&&(e=mi(t.implementationType)),r=r+"\n "+e,t.constraint.metaData&&(r=r+" - "+t.constraint.metaData)}))),r}function gi(t,e){return null!==t.parentRequest&&(t.parentRequest.serviceIdentifier===e||gi(t.parentRequest,e))}function vi(t){t.childRequests.forEach((function(t){if(gi(t,t.serviceIdentifier)){var e=function(t){var e=function t(e,n){void 0===n&&(n=[]);var r=pi(e.serviceIdentifier);return n.push(r),null!==e.parentRequest?t(e.parentRequest,n):n}(t);return e.reverse().join(" --\x3e ")}(t);throw new Error(O+" "+e)}vi(t)}))}function mi(t){if(t.name)return t.name;var e=t.toString(),n=e.match(/^function\s*([^\s(]+)/);return n?n[1]:"Anonymous function: "+e}var yi=function(){function t(t){this.id=ci(),this.container=t}return t.prototype.addPlan=function(t){this.plan=t},t.prototype.setCurrentRequest=function(t){this.currentRequest=t},t}(),_i=function(t,e){this.parentContext=t,this.rootRequest=e},bi=function(){function t(t){this._cb=t}return t.prototype.unwrap=function(){return this._cb()},t}(),Ei=function(){function t(t){this.str=t}return t.prototype.startsWith=function(t){return 0===this.str.indexOf(t)},t.prototype.endsWith=function(t){var e,n=t.split("").reverse().join("");return e=this.str.split("").reverse().join(""),this.startsWith.call({str:e},n)},t.prototype.contains=function(t){return-1!==this.str.indexOf(t)},t.prototype.equals=function(t){return this.str===t},t.prototype.value=function(){return this.str},t}(),Si=function(){function t(t,e,n,r){this.id=ci(),this.type=t,this.serviceIdentifier=n;var i="symbol"==typeof e?e.toString().slice(7,-1):e;this.name=new Ei(i||""),this.identifier=e,this.metadata=new Array;var o=null;"string"==typeof r?o=new Y(L,r):r instanceof Y&&(o=r),null!==o&&this.metadata.push(o)}return t.prototype.hasTag=function(t){for(var e=0,n=this.metadata;e<n.length;e++){if(n[e].key===t)return!0}return!1},t.prototype.isArray=function(){return this.hasTag(G)},t.prototype.matchesArray=function(t){return this.matchesTag(G)(t)},t.prototype.isNamed=function(){return this.hasTag(L)},t.prototype.isTagged=function(){return this.metadata.some((function(t){return J.every((function(e){return t.key!==e}))}))},t.prototype.isOptional=function(){return this.matchesTag(F)(!0)},t.prototype.getNamedTag=function(){return this.isNamed()?this.metadata.filter((function(t){return t.key===L}))[0]:null},t.prototype.getCustomTags=function(){return this.isTagged()?this.metadata.filter((function(t){return J.every((function(e){return t.key!==e}))})):null},t.prototype.matchesNamedTag=function(t){return this.matchesTag(L)(t)},t.prototype.matchesTag=function(t){var e=this;return function(n){for(var r=0,i=e.metadata;r<i.length;r++){var o=i[r];if(o.key===t&&o.value===n)return!0}return!1}},t}(),Ci=function(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))};function wi(t,e,n,r){var i=t.getConstructorMetadata(n),o=i.compilerGeneratedMetadata;if(void 0===o)throw new Error(R+" "+e+".");var s=i.userGeneratedMetadata,a=Object.keys(s),c=0===n.length&&a.length>0,u=a.length>n.length,l=function(t,e,n,r,i){for(var o=[],s=0;s<i;s++){var a=Ti(s,t,e,n,r);null!==a&&o.push(a)}return o}(r,e,o,s,c||u?a.length:n.length),d=Ri(t,n,e);return Ci(Ci([],l,!0),d,!0)}function Ti(t,e,n,r,i){var o=i[t.toString()]||[],s=ki(o),a=!0!==s.unmanaged,c=r[t],u=s.inject||s.multiInject;if((c=u||c)instanceof bi&&(c=c.unwrap()),a){if(!e&&(c===Object||c===Function||void 0===c))throw new Error(A+" argument "+t+" in class "+n+".");var l=new Si(si.ConstructorArgument,s.targetName,c);return l.metadata=o,l}return null}function Ii(t,e,n,r){var i=t||e;if(void 0===i){var o=R+" for property "+String(n)+" in class "+r+".";throw new Error(o)}return i}function Ri(t,e,n){for(var r=t.getPropertiesMetadata(e),i=[],o=Object.getOwnPropertySymbols(r),s=0,a=Object.keys(r).concat(o);s<a.length;s++){var c=a[s],u=r[c],l=ki(u),d=l.targetName||c,h=Ii(l.inject,l.multiInject,c,n),p=new Si(si.ClassProperty,d,h);p.metadata=u,i.push(p)}var f=Object.getPrototypeOf(e.prototype).constructor;if(f!==Object){var g=Ri(t,f,n);i=Ci(Ci([],i,!0),g,!0)}return i}function Ai(t,e){var n=Object.getPrototypeOf(e.prototype).constructor;if(n!==Object){var r=wi(t,mi(n),n,!0),i=r.map((function(t){return t.metadata.filter((function(t){return t.key===B}))})),o=[].concat.apply([],i).length,s=r.length-o;return s>0?s:Ai(t,n)}return 0}function ki(t){var e={};return t.forEach((function(t){e[t.key.toString()]=t.value})),{inject:e[V],multiInject:e[G],targetName:e[U],unmanaged:e[B]}}var Oi=function(){function t(t,e,n,r,i){this.id=ci(),this.serviceIdentifier=t,this.parentContext=e,this.parentRequest=n,this.target=i,this.childRequests=[],this.bindings=Array.isArray(r)?r:[r],this.requestScope=null===n?new Map:null}return t.prototype.addChildRequest=function(e,n,r){var i=new t(e,this.parentContext,this,n,r);return this.childRequests.push(i),i},t}();function Pi(t){return t._bindingDictionary}function Ni(t,e,n,r,i){var o=xi(n.container,i.serviceIdentifier),s=[];return o.length===di.NoBindingsAvailable&&n.container.options.autoBindInjectable&&"function"==typeof i.serviceIdentifier&&t.getConstructorMetadata(i.serviceIdentifier).compilerGeneratedMetadata&&(n.container.bind(i.serviceIdentifier).toSelf(),o=xi(n.container,i.serviceIdentifier)),s=e?o:o.filter((function(t){var e=new Oi(t.serviceIdentifier,n,r,t,i);return t.constraint(e)})),function(t,e,n,r){switch(e.length){case di.NoBindingsAvailable:if(n.isOptional())return e;var i=pi(t),o=I;throw o+=function(t,e){if(e.isTagged()||e.isNamed()){var n="",r=e.getNamedTag(),i=e.getCustomTags();return null!==r&&(n+=r.toString()+"\n"),null!==i&&i.forEach((function(t){n+=t.toString()+"\n"}))," "+t+"\n "+t+" - "+n}return" "+t}(i,n),o+=fi(r,i,xi),new Error(o);case di.OnlyOneBindingAvailable:return e;case di.MultipleBindingsAvailable:default:if(n.isArray())return e;i=pi(t),o=T+" "+i;throw o+=fi(r,i,xi),new Error(o)}}(i.serviceIdentifier,s,i,n.container),s}function Di(t,e,n,r,i,o){var s,a;if(null===i){s=Ni(t,e,r,null,o),a=new Oi(n,r,null,s,o);var c=new _i(r,a);r.addPlan(c)}else s=Ni(t,e,r,i,o),a=i.addChildRequest(o.serviceIdentifier,s,o);s.forEach((function(e){var n=null;if(o.isArray())n=a.addChildRequest(e.serviceIdentifier,e,o);else{if(e.cache)return;n=a}if(e.type===oi.Instance&&null!==e.implementationType){var i=function(t,e){return wi(t,mi(e),e,!1)}(t,e.implementationType);if(!r.container.options.skipBaseClassChecks){var s=Ai(t,e.implementationType);if(i.length<s){var c=N(mi(e.implementationType));throw new Error(c)}}i.forEach((function(e){Di(t,!1,e.serviceIdentifier,r,n,e)}))}}))}function xi(t,e){var n=[],r=Pi(t);return r.hasKey(e)?n=r.get(e):null!==t.parent&&(n=xi(t.parent,e)),n}function Mi(t,e,n,r,i,o,s,a){void 0===a&&(a=!1);var c=new yi(e),u=function(t,e,n,r,i,o){var s=new Y(t?G:V,n),a=new Si(e,r,n,s);if(void 0!==i){var c=new Y(i,o);a.metadata.push(c)}return a}(n,r,i,"",o,s);try{return Di(t,a,i,c,null,u),c}catch(t){throw hi(t)&&vi(c.plan.rootRequest),t}}function ji(t){return("object"==typeof t&&null!==t||"function"==typeof t)&&"function"==typeof t.then}function Li(t){return!!ji(t)||Array.isArray(t)&&t.some(ji)}var Ui,Bi=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))},Fi=function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},Vi=function(t,e,n){t.has(e.id)||t.set(e.id,n)},Gi=function(t,e){t.cache=e,t.activated=!0,ji(e)&&Wi(t,e)},Wi=function(t,e){return Bi(void 0,void 0,void 0,(function(){var n,r;return Fi(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,e];case 1:return n=i.sent(),t.cache=n,[3,3];case 2:throw r=i.sent(),t.cache=null,t.activated=!1,r;case 3:return[2]}}))}))};!function(t){t.DynamicValue="toDynamicValue",t.Factory="toFactory",t.Provider="toProvider"}(Ui||(Ui={}));var qi=function(){return qi=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},qi.apply(this,arguments)},zi=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))},$i=function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},Hi=function(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))};function Ki(t,e,n){var r;if(e.length>0){var i=function(t,e){return t.reduce((function(t,n){var r=e(n);return n.target.type===si.ConstructorArgument?t.constructorInjections.push(r):(t.propertyRequests.push(n),t.propertyInjections.push(r)),t.isAsync||(t.isAsync=Li(r)),t}),{constructorInjections:[],propertyInjections:[],propertyRequests:[],isAsync:!1})}(e,n),o=qi(qi({},i),{constr:t});r=i.isAsync?function(t){return zi(this,void 0,void 0,(function(){var e,n;return $i(this,(function(r){switch(r.label){case 0:return[4,Xi(t.constructorInjections)];case 1:return e=r.sent(),[4,Xi(t.propertyInjections)];case 2:return n=r.sent(),[2,Ji(qi(qi({},t),{constructorInjections:e,propertyInjections:n}))]}}))}))}(o):Ji(o)}else r=new t;return r}function Ji(t){var e,n=new((e=t.constr).bind.apply(e,Hi([void 0],t.constructorInjections,!1)));return t.propertyRequests.forEach((function(e,r){var i=e.target.identifier,o=t.propertyInjections[r];n[i]=o})),n}function Xi(t){return zi(this,void 0,void 0,(function(){var e,n,r,i;return $i(this,(function(o){for(e=[],n=0,r=t;n<r.length;n++)i=r[n],Array.isArray(i)?e.push(Promise.all(i)):e.push(i);return[2,Promise.all(e)]}))}))}function Yi(t,e){var n=function(t,e){var n,r;if(Reflect.hasMetadata(H,t)){var i=Reflect.getMetadata(H,t);try{return null===(r=(n=e)[i.value])||void 0===r?void 0:r.call(n)}catch(e){throw new Error(D(t.name,e.message))}}}(t,e);return ji(n)?n.then((function(){return e})):e}function Zi(t,e){t.scope!==ii.Singleton&&function(t,e){var n="Class cannot be instantiated in "+(t.scope===ii.Request?"request":"transient")+" scope.";if("function"==typeof t.onDeactivation)throw new Error(M(e.name,n));if(Reflect.hasMetadata(K,e))throw new Error(x(e.name,n))}(t,e)}var Qi=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))},to=function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},eo=function(t){return function(e){e.parentContext.setCurrentRequest(e);var n=e.bindings,r=e.childRequests,i=e.target&&e.target.isArray(),o=!(e.parentRequest&&e.parentRequest.target&&e.target&&e.parentRequest.target.matchesArray(e.target.serviceIdentifier));if(i&&o)return r.map((function(e){return eo(t)(e)}));if(!e.target.isOptional()||0!==n.length){var s=n[0];return oo(t,e,s)}}},no=function(t,e){var n=function(t){switch(t.type){case oi.Factory:return{factory:t.factory,factoryType:Ui.Factory};case oi.Provider:return{factory:t.provider,factoryType:Ui.Provider};case oi.DynamicValue:return{factory:t.dynamicValue,factoryType:Ui.DynamicValue};default:throw new Error("Unexpected factory type "+t.type)}}(t);return function(t,e){try{return t()}catch(t){throw hi(t)&&(t=e()),t}}((function(){return n.factory.bind(t)(e)}),(function(){return new Error((t=n.factoryType,r=e.currentRequest.serviceIdentifier.toString(),"It looks like there is a circular dependency in one of the '"+t+"' bindings. Please investigate bindings withservice identifier '"+r+"'."));var t,r}))},ro=function(t,e,n){var r,i=e.childRequests;switch(function(t){var e=null;switch(t.type){case oi.ConstantValue:case oi.Function:e=t.cache;break;case oi.Constructor:case oi.Instance:e=t.implementationType;break;case oi.DynamicValue:e=t.dynamicValue;break;case oi.Provider:e=t.provider;break;case oi.Factory:e=t.factory}if(null===e){var n=pi(t.serviceIdentifier);throw new Error("Invalid binding type: "+n)}}(n),n.type){case oi.ConstantValue:case oi.Function:r=n.cache;break;case oi.Constructor:r=n.implementationType;break;case oi.Instance:r=function(t,e,n,r){Zi(t,e);var i=Ki(e,n,r);return ji(i)?i.then((function(t){return Yi(e,t)})):Yi(e,i)}(n,n.implementationType,i,eo(t));break;default:r=no(n,e.parentContext)}return r},io=function(t,e,n){var r=function(t,e){return e.scope===ii.Singleton&&e.activated?e.cache:e.scope===ii.Request&&t.has(e.id)?t.get(e.id):null}(t,e);return null!==r||function(t,e,n){e.scope===ii.Singleton&&Gi(e,n),e.scope===ii.Request&&Vi(t,e,n)}(t,e,r=n()),r},oo=function(t,e,n){return io(t,n,(function(){var r=ro(t,e,n);return r=ji(r)?r.then((function(t){return so(e,n,t)})):so(e,n,r)}))};function so(t,e,n){var r,i=ao(t.parentContext,e,n),o=ho(t.parentContext.container),s=o.next();do{r=s.value;var a=t.parentContext,c=t.serviceIdentifier,u=lo(r,c);i=ji(i)?uo(u,a,i):co(u,a,i),s=o.next()}while(!0!==s.done&&!Pi(r).hasKey(t.serviceIdentifier));return i}var ao=function(t,e,n){return"function"==typeof e.onActivation?e.onActivation(t,n):n},co=function(t,e,n){for(var r=t.next();!r.done;){if(ji(n=r.value(e,n)))return uo(t,e,n);r=t.next()}return n},uo=function(t,e,n){return Qi(void 0,void 0,void 0,(function(){var r,i;return to(this,(function(o){switch(o.label){case 0:return[4,n];case 1:r=o.sent(),i=t.next(),o.label=2;case 2:return i.done?[3,4]:[4,i.value(e,r)];case 3:return r=o.sent(),i=t.next(),[3,2];case 4:return[2,r]}}))}))},lo=function(t,e){var n=t._activations;return n.hasKey(e)?n.get(e).values():[].values()},ho=function(t){for(var e=[t],n=t.parent;null!==n;)e.push(n),n=n.parent;return{next:function(){var t=e.pop();return void 0!==t?{done:!1,value:t}:{done:!0,value:void 0}}}};var po=function(t,e){var n=t.parentRequest;return null!==n&&(!!e(n)||po(n,e))},fo=function(t){return function(e){var n=function(n){return null!==n&&null!==n.target&&n.target.matchesTag(t)(e)};return n.metaData=new Y(t,e),n}},go=fo(L),vo=function(t){return function(e){var n=null;if(null!==e){if(n=e.bindings[0],"string"==typeof t)return n.serviceIdentifier===t;var r=e.bindings[0].implementationType;return t===r}return!1}},mo=function(){function t(t){this._binding=t}return t.prototype.when=function(t){return this._binding.constraint=t,new yo(this._binding)},t.prototype.whenTargetNamed=function(t){return this._binding.constraint=go(t),new yo(this._binding)},t.prototype.whenTargetIsDefault=function(){return this._binding.constraint=function(t){return null!==t&&(null!==t.target&&!t.target.isNamed()&&!t.target.isTagged())},new yo(this._binding)},t.prototype.whenTargetTagged=function(t,e){return this._binding.constraint=fo(t)(e),new yo(this._binding)},t.prototype.whenInjectedInto=function(t){return this._binding.constraint=function(e){return null!==e&&vo(t)(e.parentRequest)},new yo(this._binding)},t.prototype.whenParentNamed=function(t){return this._binding.constraint=function(e){return null!==e&&go(t)(e.parentRequest)},new yo(this._binding)},t.prototype.whenParentTagged=function(t,e){return this._binding.constraint=function(n){return null!==n&&fo(t)(e)(n.parentRequest)},new yo(this._binding)},t.prototype.whenAnyAncestorIs=function(t){return this._binding.constraint=function(e){return null!==e&&po(e,vo(t))},new yo(this._binding)},t.prototype.whenNoAncestorIs=function(t){return this._binding.constraint=function(e){return null!==e&&!po(e,vo(t))},new yo(this._binding)},t.prototype.whenAnyAncestorNamed=function(t){return this._binding.constraint=function(e){return null!==e&&po(e,go(t))},new yo(this._binding)},t.prototype.whenNoAncestorNamed=function(t){return this._binding.constraint=function(e){return null!==e&&!po(e,go(t))},new yo(this._binding)},t.prototype.whenAnyAncestorTagged=function(t,e){return this._binding.constraint=function(n){return null!==n&&po(n,fo(t)(e))},new yo(this._binding)},t.prototype.whenNoAncestorTagged=function(t,e){return this._binding.constraint=function(n){return null!==n&&!po(n,fo(t)(e))},new yo(this._binding)},t.prototype.whenAnyAncestorMatches=function(t){return this._binding.constraint=function(e){return null!==e&&po(e,t)},new yo(this._binding)},t.prototype.whenNoAncestorMatches=function(t){return this._binding.constraint=function(e){return null!==e&&!po(e,t)},new yo(this._binding)},t}(),yo=function(){function t(t){this._binding=t}return t.prototype.onActivation=function(t){return this._binding.onActivation=t,new mo(this._binding)},t.prototype.onDeactivation=function(t){return this._binding.onDeactivation=t,new mo(this._binding)},t}(),_o=function(){function t(t){this._binding=t,this._bindingWhenSyntax=new mo(this._binding),this._bindingOnSyntax=new yo(this._binding)}return t.prototype.when=function(t){return this._bindingWhenSyntax.when(t)},t.prototype.whenTargetNamed=function(t){return this._bindingWhenSyntax.whenTargetNamed(t)},t.prototype.whenTargetIsDefault=function(){return this._bindingWhenSyntax.whenTargetIsDefault()},t.prototype.whenTargetTagged=function(t,e){return this._bindingWhenSyntax.whenTargetTagged(t,e)},t.prototype.whenInjectedInto=function(t){return this._bindingWhenSyntax.whenInjectedInto(t)},t.prototype.whenParentNamed=function(t){return this._bindingWhenSyntax.whenParentNamed(t)},t.prototype.whenParentTagged=function(t,e){return this._bindingWhenSyntax.whenParentTagged(t,e)},t.prototype.whenAnyAncestorIs=function(t){return this._bindingWhenSyntax.whenAnyAncestorIs(t)},t.prototype.whenNoAncestorIs=function(t){return this._bindingWhenSyntax.whenNoAncestorIs(t)},t.prototype.whenAnyAncestorNamed=function(t){return this._bindingWhenSyntax.whenAnyAncestorNamed(t)},t.prototype.whenAnyAncestorTagged=function(t,e){return this._bindingWhenSyntax.whenAnyAncestorTagged(t,e)},t.prototype.whenNoAncestorNamed=function(t){return this._bindingWhenSyntax.whenNoAncestorNamed(t)},t.prototype.whenNoAncestorTagged=function(t,e){return this._bindingWhenSyntax.whenNoAncestorTagged(t,e)},t.prototype.whenAnyAncestorMatches=function(t){return this._bindingWhenSyntax.whenAnyAncestorMatches(t)},t.prototype.whenNoAncestorMatches=function(t){return this._bindingWhenSyntax.whenNoAncestorMatches(t)},t.prototype.onActivation=function(t){return this._bindingOnSyntax.onActivation(t)},t.prototype.onDeactivation=function(t){return this._bindingOnSyntax.onDeactivation(t)},t}(),bo=function(){function t(t){this._binding=t}return t.prototype.inRequestScope=function(){return this._binding.scope=ii.Request,new _o(this._binding)},t.prototype.inSingletonScope=function(){return this._binding.scope=ii.Singleton,new _o(this._binding)},t.prototype.inTransientScope=function(){return this._binding.scope=ii.Transient,new _o(this._binding)},t}(),Eo=function(){function t(t){this._binding=t,this._bindingWhenSyntax=new mo(this._binding),this._bindingOnSyntax=new yo(this._binding),this._bindingInSyntax=new bo(t)}return t.prototype.inRequestScope=function(){return this._bindingInSyntax.inRequestScope()},t.prototype.inSingletonScope=function(){return this._bindingInSyntax.inSingletonScope()},t.prototype.inTransientScope=function(){return this._bindingInSyntax.inTransientScope()},t.prototype.when=function(t){return this._bindingWhenSyntax.when(t)},t.prototype.whenTargetNamed=function(t){return this._bindingWhenSyntax.whenTargetNamed(t)},t.prototype.whenTargetIsDefault=function(){return this._bindingWhenSyntax.whenTargetIsDefault()},t.prototype.whenTargetTagged=function(t,e){return this._bindingWhenSyntax.whenTargetTagged(t,e)},t.prototype.whenInjectedInto=function(t){return this._bindingWhenSyntax.whenInjectedInto(t)},t.prototype.whenParentNamed=function(t){return this._bindingWhenSyntax.whenParentNamed(t)},t.prototype.whenParentTagged=function(t,e){return this._bindingWhenSyntax.whenParentTagged(t,e)},t.prototype.whenAnyAncestorIs=function(t){return this._bindingWhenSyntax.whenAnyAncestorIs(t)},t.prototype.whenNoAncestorIs=function(t){return this._bindingWhenSyntax.whenNoAncestorIs(t)},t.prototype.whenAnyAncestorNamed=function(t){return this._bindingWhenSyntax.whenAnyAncestorNamed(t)},t.prototype.whenAnyAncestorTagged=function(t,e){return this._bindingWhenSyntax.whenAnyAncestorTagged(t,e)},t.prototype.whenNoAncestorNamed=function(t){return this._bindingWhenSyntax.whenNoAncestorNamed(t)},t.prototype.whenNoAncestorTagged=function(t,e){return this._bindingWhenSyntax.whenNoAncestorTagged(t,e)},t.prototype.whenAnyAncestorMatches=function(t){return this._bindingWhenSyntax.whenAnyAncestorMatches(t)},t.prototype.whenNoAncestorMatches=function(t){return this._bindingWhenSyntax.whenNoAncestorMatches(t)},t.prototype.onActivation=function(t){return this._bindingOnSyntax.onActivation(t)},t.prototype.onDeactivation=function(t){return this._bindingOnSyntax.onDeactivation(t)},t}(),So=function(){function t(t){this._binding=t}return t.prototype.to=function(t){return this._binding.type=oi.Instance,this._binding.implementationType=t,new Eo(this._binding)},t.prototype.toSelf=function(){if("function"!=typeof this._binding.serviceIdentifier)throw new Error("The toSelf function can only be applied when a constructor is used as service identifier");var t=this._binding.serviceIdentifier;return this.to(t)},t.prototype.toConstantValue=function(t){return this._binding.type=oi.ConstantValue,this._binding.cache=t,this._binding.dynamicValue=null,this._binding.implementationType=null,this._binding.scope=ii.Singleton,new _o(this._binding)},t.prototype.toDynamicValue=function(t){return this._binding.type=oi.DynamicValue,this._binding.cache=null,this._binding.dynamicValue=t,this._binding.implementationType=null,new Eo(this._binding)},t.prototype.toConstructor=function(t){return this._binding.type=oi.Constructor,this._binding.implementationType=t,this._binding.scope=ii.Singleton,new _o(this._binding)},t.prototype.toFactory=function(t){return this._binding.type=oi.Factory,this._binding.factory=t,this._binding.scope=ii.Singleton,new _o(this._binding)},t.prototype.toFunction=function(t){if("function"!=typeof t)throw new Error("Value provided to function binding must be a function!");var e=this.toConstantValue(t);return this._binding.type=oi.Function,this._binding.scope=ii.Singleton,e},t.prototype.toAutoFactory=function(t){return this._binding.type=oi.Factory,this._binding.factory=function(e){return function(){return e.container.get(t)}},this._binding.scope=ii.Singleton,new _o(this._binding)},t.prototype.toAutoNamedFactory=function(t){return this._binding.type=oi.Factory,this._binding.factory=function(e){return function(n){return e.container.getNamed(t,n)}},new _o(this._binding)},t.prototype.toProvider=function(t){return this._binding.type=oi.Provider,this._binding.provider=t,this._binding.scope=ii.Singleton,new _o(this._binding)},t.prototype.toService=function(t){this.toDynamicValue((function(e){return e.container.get(t)}))},t}(),Co=function(){function t(){}return t.of=function(e,n,r,i,o){var s=new t;return s.bindings=e,s.middleware=n,s.deactivations=i,s.activations=r,s.moduleActivationStore=o,s},t}();var wo=function(){function t(){this._map=new Map}return t.prototype.getMap=function(){return this._map},t.prototype.add=function(t,e){if(null==t)throw new Error(C);if(null==e)throw new Error(C);var n=this._map.get(t);void 0!==n?n.push(e):this._map.set(t,[e])},t.prototype.get=function(t){if(null==t)throw new Error(C);var e=this._map.get(t);if(void 0!==e)return e;throw new Error(w)},t.prototype.remove=function(t){if(null==t)throw new Error(C);if(!this._map.delete(t))throw new Error(w)},t.prototype.removeIntersection=function(t){var e=this;this.traverse((function(n,r){var i=t.hasKey(n)?t.get(n):void 0;if(void 0!==i){var o=r.filter((function(t){return!i.some((function(e){return t===e}))}));e._setValue(n,o)}}))},t.prototype.removeByCondition=function(t){var e=this,n=[];return this._map.forEach((function(r,i){for(var o=[],s=0,a=r;s<a.length;s++){var c=a[s];t(c)?n.push(c):o.push(c)}e._setValue(i,o)})),n},t.prototype.hasKey=function(t){if(null==t)throw new Error(C);return this._map.has(t)},t.prototype.clone=function(){var e=new t;return this._map.forEach((function(t,n){t.forEach((function(t){return e.add(n,"object"==typeof(r=t)&&null!==r&&"clone"in r&&"function"==typeof r.clone?t.clone():t);var r}))})),e},t.prototype.traverse=function(t){this._map.forEach((function(e,n){t(n,e)}))},t.prototype._setValue=function(t,e){e.length>0?this._map.set(t,e):this._map.delete(t)},t}(),To=function(){function t(){this._map=new Map}return t.prototype.remove=function(t){if(this._map.has(t)){var e=this._map.get(t);return this._map.delete(t),e}return this._getEmptyHandlersStore()},t.prototype.addDeactivation=function(t,e,n){this._getModuleActivationHandlers(t).onDeactivations.add(e,n)},t.prototype.addActivation=function(t,e,n){this._getModuleActivationHandlers(t).onActivations.add(e,n)},t.prototype.clone=function(){var e=new t;return this._map.forEach((function(t,n){e._map.set(n,{onActivations:t.onActivations.clone(),onDeactivations:t.onDeactivations.clone()})})),e},t.prototype._getModuleActivationHandlers=function(t){var e=this._map.get(t);return void 0===e&&(e=this._getEmptyHandlersStore(),this._map.set(t,e)),e},t.prototype._getEmptyHandlersStore=function(){return{onActivations:new wo,onDeactivations:new wo}},t}(),Io=function(){return Io=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Io.apply(this,arguments)},Ro=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))},Ao=function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},ko=function(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))},Oo=function(){function t(t){var e=t||{};if("object"!=typeof e)throw new Error("Invalid Container constructor argument. Container options must be an object.");if(void 0===e.defaultScope)e.defaultScope=ii.Transient;else if(e.defaultScope!==ii.Singleton&&e.defaultScope!==ii.Transient&&e.defaultScope!==ii.Request)throw new Error("Invalid Container option. Default scope must be a string ('singleton' or 'transient').");if(void 0===e.autoBindInjectable)e.autoBindInjectable=!1;else if("boolean"!=typeof e.autoBindInjectable)throw new Error("Invalid Container option. Auto bind injectable must be a boolean");if(void 0===e.skipBaseClassChecks)e.skipBaseClassChecks=!1;else if("boolean"!=typeof e.skipBaseClassChecks)throw new Error("Invalid Container option. Skip base check must be a boolean");this.options={autoBindInjectable:e.autoBindInjectable,defaultScope:e.defaultScope,skipBaseClassChecks:e.skipBaseClassChecks},this.id=ci(),this._bindingDictionary=new wo,this._snapshots=[],this._middleware=null,this._activations=new wo,this._deactivations=new wo,this.parent=null,this._metadataReader=new li,this._moduleActivationStore=new To}return t.merge=function(e,n){for(var r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];var o=new t,s=ko([e,n],r,!0).map((function(t){return Pi(t)})),a=Pi(o);return s.forEach((function(t){var e;e=a,t.traverse((function(t,n){n.forEach((function(t){e.add(t.serviceIdentifier,t.clone())}))}))})),o},t.prototype.load=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n=this._getContainerModuleHelpersFactory(),r=0,i=t;r<i.length;r++){var o=i[r],s=n(o.id);o.registry(s.bindFunction,s.unbindFunction,s.isboundFunction,s.rebindFunction,s.unbindAsyncFunction,s.onActivationFunction,s.onDeactivationFunction)}},t.prototype.loadAsync=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Ro(this,void 0,void 0,(function(){var e,n,r,i,o;return Ao(this,(function(s){switch(s.label){case 0:e=this._getContainerModuleHelpersFactory(),n=0,r=t,s.label=1;case 1:return n<r.length?(i=r[n],o=e(i.id),[4,i.registry(o.bindFunction,o.unbindFunction,o.isboundFunction,o.rebindFunction,o.unbindAsyncFunction,o.onActivationFunction,o.onDeactivationFunction)]):[3,4];case 2:s.sent(),s.label=3;case 3:return n++,[3,1];case 4:return[2]}}))}))},t.prototype.unload=function(){for(var t=this,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];e.forEach((function(e){var n=t._removeModuleBindings(e.id);t._deactivateSingletons(n),t._removeModuleHandlers(e.id)}))},t.prototype.unloadAsync=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Ro(this,void 0,void 0,(function(){var e,n,r,i;return Ao(this,(function(o){switch(o.label){case 0:e=0,n=t,o.label=1;case 1:return e<n.length?(r=n[e],i=this._removeModuleBindings(r.id),[4,this._deactivateSingletonsAsync(i)]):[3,4];case 2:o.sent(),this._removeModuleHandlers(r.id),o.label=3;case 3:return e++,[3,1];case 4:return[2]}}))}))},t.prototype.bind=function(t){var e=this.options.defaultScope||ii.Transient,n=new ui(t,e);return this._bindingDictionary.add(t,n),new So(n)},t.prototype.rebind=function(t){return this.unbind(t),this.bind(t)},t.prototype.rebindAsync=function(t){return Ro(this,void 0,void 0,(function(){return Ao(this,(function(e){switch(e.label){case 0:return[4,this.unbindAsync(t)];case 1:return e.sent(),[2,this.bind(t)]}}))}))},t.prototype.unbind=function(t){if(this._bindingDictionary.hasKey(t)){var e=this._bindingDictionary.get(t);this._deactivateSingletons(e)}this._removeServiceFromDictionary(t)},t.prototype.unbindAsync=function(t){return Ro(this,void 0,void 0,(function(){var e;return Ao(this,(function(n){switch(n.label){case 0:return this._bindingDictionary.hasKey(t)?(e=this._bindingDictionary.get(t),[4,this._deactivateSingletonsAsync(e)]):[3,2];case 1:n.sent(),n.label=2;case 2:return this._removeServiceFromDictionary(t),[2]}}))}))},t.prototype.unbindAll=function(){var t=this;this._bindingDictionary.traverse((function(e,n){t._deactivateSingletons(n)})),this._bindingDictionary=new wo},t.prototype.unbindAllAsync=function(){return Ro(this,void 0,void 0,(function(){var t,e=this;return Ao(this,(function(n){switch(n.label){case 0:return t=[],this._bindingDictionary.traverse((function(n,r){t.push(e._deactivateSingletonsAsync(r))})),[4,Promise.all(t)];case 1:return n.sent(),this._bindingDictionary=new wo,[2]}}))}))},t.prototype.onActivation=function(t,e){this._activations.add(t,e)},t.prototype.onDeactivation=function(t,e){this._deactivations.add(t,e)},t.prototype.isBound=function(t){var e=this._bindingDictionary.hasKey(t);return!e&&this.parent&&(e=this.parent.isBound(t)),e},t.prototype.isCurrentBound=function(t){return this._bindingDictionary.hasKey(t)},t.prototype.isBoundNamed=function(t,e){return this.isBoundTagged(t,L,e)},t.prototype.isBoundTagged=function(t,e,n){var r=!1;if(this._bindingDictionary.hasKey(t)){var i=this._bindingDictionary.get(t),o=function(t,e,n,r){var i=new Si(si.Variable,"",e,new Y(n,r)),o=new yi(t);return new Oi(e,o,null,[],i)}(this,t,e,n);r=i.some((function(t){return t.constraint(o)}))}return!r&&this.parent&&(r=this.parent.isBoundTagged(t,e,n)),r},t.prototype.snapshot=function(){this._snapshots.push(Co.of(this._bindingDictionary.clone(),this._middleware,this._activations.clone(),this._deactivations.clone(),this._moduleActivationStore.clone()))},t.prototype.restore=function(){var t=this._snapshots.pop();if(void 0===t)throw new Error("No snapshot available to restore.");this._bindingDictionary=t.bindings,this._activations=t.activations,this._deactivations=t.deactivations,this._middleware=t.middleware,this._moduleActivationStore=t.moduleActivationStore},t.prototype.createChild=function(e){var n=new t(e||this.options);return n.parent=this,n},t.prototype.applyMiddleware=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=this._middleware?this._middleware:this._planAndResolve();this._middleware=t.reduce((function(t,e){return e(t)}),n)},t.prototype.applyCustomMetadataReader=function(t){this._metadataReader=t},t.prototype.get=function(t){var e=this._getNotAllArgs(t,!1);return this._getButThrowIfAsync(e)},t.prototype.getAsync=function(t){return Ro(this,void 0,void 0,(function(){var e;return Ao(this,(function(n){return e=this._getNotAllArgs(t,!1),[2,this._get(e)]}))}))},t.prototype.getTagged=function(t,e,n){var r=this._getNotAllArgs(t,!1,e,n);return this._getButThrowIfAsync(r)},t.prototype.getTaggedAsync=function(t,e,n){return Ro(this,void 0,void 0,(function(){var r;return Ao(this,(function(i){return r=this._getNotAllArgs(t,!1,e,n),[2,this._get(r)]}))}))},t.prototype.getNamed=function(t,e){return this.getTagged(t,L,e)},t.prototype.getNamedAsync=function(t,e){return this.getTaggedAsync(t,L,e)},t.prototype.getAll=function(t){var e=this._getAllArgs(t);return this._getButThrowIfAsync(e)},t.prototype.getAllAsync=function(t){var e=this._getAllArgs(t);return this._getAll(e)},t.prototype.getAllTagged=function(t,e,n){var r=this._getNotAllArgs(t,!0,e,n);return this._getButThrowIfAsync(r)},t.prototype.getAllTaggedAsync=function(t,e,n){var r=this._getNotAllArgs(t,!0,e,n);return this._getAll(r)},t.prototype.getAllNamed=function(t,e){return this.getAllTagged(t,L,e)},t.prototype.getAllNamedAsync=function(t,e){return this.getAllTaggedAsync(t,L,e)},t.prototype.resolve=function(t){var e=this.isBound(t);e||this.bind(t).toSelf();var n=this.get(t);return e||this.unbind(t),n},t.prototype._preDestroy=function(t,e){if(Reflect.hasMetadata(K,t))return e[Reflect.getMetadata(K,t).value]()},t.prototype._removeModuleHandlers=function(t){var e=this._moduleActivationStore.remove(t);this._activations.removeIntersection(e.onActivations),this._deactivations.removeIntersection(e.onDeactivations)},t.prototype._removeModuleBindings=function(t){return this._bindingDictionary.removeByCondition((function(e){return e.moduleId===t}))},t.prototype._deactivate=function(t,e){var n=this,r=Object.getPrototypeOf(e).constructor;try{if(this._deactivations.hasKey(t.serviceIdentifier)){var i=this._deactivateContainer(e,this._deactivations.get(t.serviceIdentifier).values());if(ji(i))return this._handleDeactivationError(i.then((function(){return n._propagateContainerDeactivationThenBindingAndPreDestroyAsync(t,e,r)})),r)}var o=this._propagateContainerDeactivationThenBindingAndPreDestroy(t,e,r);if(ji(o))return this._handleDeactivationError(o,r)}catch(t){throw new Error(M(r.name,t.message))}},t.prototype._handleDeactivationError=function(t,e){return Ro(this,void 0,void 0,(function(){var n;return Ao(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,t];case 1:return r.sent(),[3,3];case 2:throw n=r.sent(),new Error(M(e.name,n.message));case 3:return[2]}}))}))},t.prototype._deactivateContainer=function(t,e){for(var n=this,r=e.next();r.value;){var i=r.value(t);if(ji(i))return i.then((function(){return n._deactivateContainerAsync(t,e)}));r=e.next()}},t.prototype._deactivateContainerAsync=function(t,e){return Ro(this,void 0,void 0,(function(){var n;return Ao(this,(function(r){switch(r.label){case 0:n=e.next(),r.label=1;case 1:return n.value?[4,n.value(t)]:[3,3];case 2:return r.sent(),n=e.next(),[3,1];case 3:return[2]}}))}))},t.prototype._getContainerModuleHelpersFactory=function(){var t=this,e=function(t,e){t._binding.moduleId=e},n=function(n){return function(r){var i=t.rebind(r);return e(i,n),i}},r=function(e){return function(n,r){t._moduleActivationStore.addActivation(e,n,r),t.onActivation(n,r)}},i=function(e){return function(n,r){t._moduleActivationStore.addDeactivation(e,n,r),t.onDeactivation(n,r)}};return function(o){return{bindFunction:(s=o,function(n){var r=t.bind(n);return e(r,s),r}),isboundFunction:function(e){return t.isBound(e)},onActivationFunction:r(o),onDeactivationFunction:i(o),rebindFunction:n(o),unbindFunction:function(e){return t.unbind(e)},unbindAsyncFunction:function(e){return t.unbindAsync(e)}};var s}},t.prototype._getAll=function(t){return Promise.all(this._get(t))},t.prototype._get=function(t){var e=Io(Io({},t),{contextInterceptor:function(t){return t},targetType:si.Variable});if(this._middleware){var n=this._middleware(e);if(null==n)throw new Error("Invalid return type in middleware. Middleware must return!");return n}return this._planAndResolve()(e)},t.prototype._getButThrowIfAsync=function(t){var e=this._get(t);if(Li(e))throw new Error("You are attempting to construct '"+t.serviceIdentifier+"' in a synchronous way\n but it has asynchronous dependencies.");return e},t.prototype._getAllArgs=function(t){return{avoidConstraints:!0,isMultiInject:!0,serviceIdentifier:t}},t.prototype._getNotAllArgs=function(t,e,n,r){return{avoidConstraints:!1,isMultiInject:e,serviceIdentifier:t,key:n,value:r}},t.prototype._planAndResolve=function(){var t=this;return function(e){var n=Mi(t._metadataReader,t,e.isMultiInject,e.targetType,e.serviceIdentifier,e.key,e.value,e.avoidConstraints);return function(t){return eo(t.plan.rootRequest.requestScope)(t.plan.rootRequest)}(n=e.contextInterceptor(n))}},t.prototype._deactivateIfSingleton=function(t){var e=this;if(t.activated)return ji(t.cache)?t.cache.then((function(n){return e._deactivate(t,n)})):this._deactivate(t,t.cache)},t.prototype._deactivateSingletons=function(t){for(var e=0,n=t;e<n.length;e++){var r=n[e];if(ji(this._deactivateIfSingleton(r)))throw new Error("Attempting to unbind dependency with asynchronous destruction (@preDestroy or onDeactivation)")}},t.prototype._deactivateSingletonsAsync=function(t){return Ro(this,void 0,void 0,(function(){var e=this;return Ao(this,(function(n){switch(n.label){case 0:return[4,Promise.all(t.map((function(t){return e._deactivateIfSingleton(t)})))];case 1:return n.sent(),[2]}}))}))},t.prototype._propagateContainerDeactivationThenBindingAndPreDestroy=function(t,e,n){return this.parent?this._deactivate.bind(this.parent)(t,e):this._bindingDeactivationAndPreDestroy(t,e,n)},t.prototype._propagateContainerDeactivationThenBindingAndPreDestroyAsync=function(t,e,n){return Ro(this,void 0,void 0,(function(){return Ao(this,(function(r){switch(r.label){case 0:return this.parent?[4,this._deactivate.bind(this.parent)(t,e)]:[3,2];case 1:return r.sent(),[3,4];case 2:return[4,this._bindingDeactivationAndPreDestroyAsync(t,e,n)];case 3:r.sent(),r.label=4;case 4:return[2]}}))}))},t.prototype._removeServiceFromDictionary=function(t){try{this._bindingDictionary.remove(t)}catch(e){throw new Error("Could not unbind serviceIdentifier: "+pi(t))}},t.prototype._bindingDeactivationAndPreDestroy=function(t,e,n){var r=this;if("function"==typeof t.onDeactivation){var i=t.onDeactivation(e);if(ji(i))return i.then((function(){return r._preDestroy(n,e)}))}return this._preDestroy(n,e)},t.prototype._bindingDeactivationAndPreDestroyAsync=function(t,e,n){return Ro(this,void 0,void 0,(function(){return Ao(this,(function(r){switch(r.label){case 0:return"function"!=typeof t.onDeactivation?[3,2]:[4,t.onDeactivation(e)];case 1:r.sent(),r.label=2;case 2:return[4,this._preDestroy(n,e)];case 3:return r.sent(),[2]}}))}))},t}(),Po=n(4879);class Samples{constructor(){this.min=0,this.max=0,this.sum=0,this.data=[]}push(t){(0===this.min||t<this.min)&&(this.min=t),t>=this.max&&(this.max=t),this.data.push(t),this.sum+=t}median(){this.data.sort();const t=this.data.length>>1;return this.data.length%2==0?this.data[t-1]+this.data[t]>>1:this.data[t]}percentile(t){if(0===this.data.length)return 0;if(t<=0)return this.data[0];if(t>=1)return this.data[this.data.length-1];const e=(this.data.length-1)*t,n=Math.floor(e),r=n+1,i=e%1;return r>=this.data.length?this.data[n]:this.data[n]*(1-i)+this.data[r]*i}}var No=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))};class PeerStatsTracker{constructor(t,e,n){this.peerClient=t,this.broadcastCanvasManager=e,this.logger=new ScopedLogger(n,ut.EMITTER),this.previousBytesSent=0,this.startTimestamp=0,this.analyticsTracker=AnalyticsTracker.getInstance(),this.initializeSamples()}start(){this.logger.info({msg:"start emitter"}),this.collectSamplesTimerId=window.setInterval((()=>{this.collectSamples()}),1e3),this.trackSamplesTimerId=window.setInterval((()=>{this.trackSamples()}),3e4),this.trackPeerConnectionStatsTimerId=window.setInterval((()=>{this.trackPeerConnectionStats()}),6e4),this.trackSamples()}stop(){clearInterval(this.collectSamplesTimerId),clearInterval(this.trackSamplesTimerId),clearInterval(this.trackPeerConnectionStatsTimerId),this.collectSamplesTimerId=void 0,this.trackSamplesTimerId=void 0,this.trackPeerConnectionStatsTimerId=void 0}trackPeerConnectionStats(){return No(this,void 0,void 0,(function*(){(yield this.peerClient.getReports()).forEach((t=>{if("outbound-rtp"===t.type)switch(t.kind){case"audio":this.analyticsTracker.trackEvent(new WebRTCAudioStatsEvent(t));break;case"video":{const e=new WebRTCVideoStatsEvent(t),n=new MinuteBroadcastEvent(t,this.startTimestamp);this.analyticsTracker.batchEvents([e,n]);break}default:this.logger.warn({msg:"unknown report kind: ",reportKind:t.kind})}}))}))}collectSamples(){return No(this,void 0,void 0,(function*(){let t=0;this.audioLatencySamples.push(this.broadcastCanvasManager.getAudioLatency()),this.videoLatencySamples.push(this.broadcastCanvasManager.getVideoLatency());(yield this.peerClient.getReports()).forEach((e=>{switch(e.type){case"candidate-pair":e.nominated&&(this.rttSamples.push(e.currentRoundTripTime),this.recommendedBitrateSamples.push(e.availableOutgoingBitrate));break;case"outbound-rtp":t+=e.bytesSent||0,0===this.startTimestamp&&"video"===e.kind&&(this.startTimestamp=e.timestamp)}}));const e=8*Math.round(t-this.previousBytesSent);this.previousBytesSent=t,this.measuredBitrateSamples.push(e)}))}trackSamples(){const t=30,e=new SourceAudioLatencyEvent(this.audioLatencySamples,t),n=new SourceVideoLatencyEvent(this.videoLatencySamples,t),r=new CongestionTimeEvent(this.congestionTimeSamples,t),i=new MeasuredBitrateEvent(this.measuredBitrateSamples,t),o=new RecommendedBitrateEvent(this.recommendedBitrateSamples,t),s=new ConnectionRTTEvent(this.rttSamples,t);this.analyticsTracker.batchEvents([e,n,r,i,o,s]),this.initializeSamples()}initializeSamples(){this.audioLatencySamples=new Samples,this.videoLatencySamples=new Samples,this.congestionTimeSamples=new Samples,this.measuredBitrateSamples=new Samples,this.recommendedBitrateSamples=new Samples,this.rttSamples=new Samples}}var Do,xo=n(2492);!function(t){t.CONFIG="config",t.UPDATE="update",t.START="start",t.STOP="stop"}(Do||(Do={}));var Mo=n(477),jo=n.n(Mo);function Lo(){return jo()('/*! For license information please see scheduler.worker.worker.js.LICENSE.txt */\n(()=>{"use strict";var t;!function(t){t.CONFIG="config",t.UPDATE="update",t.START="start",t.STOP="stop"}(t||(t={}));const i=self;const s=new class Scheduler{constructor(){this.config={frameRate:60,isRunning:!1}}setConfig(t){this.config=Object.assign(Object.assign({},this.config),t),this.config.isRunning&&(this.stop(),this.start())}start(){this.config.isRunning||(this.intervalId=setInterval((()=>{i.postMessage({type:t.UPDATE})}),1e3/this.config.frameRate),this.config.isRunning=!0)}stop(){this.config.isRunning&&(clearInterval(this.intervalId),this.intervalId=void 0,this.config.isRunning=!1)}};i.addEventListener("message",(function(i){var n;if(null===(n=null==i?void 0:i.data)||void 0===n?void 0:n.type)switch(i.data.type){case t.CONFIG:s.setConfig(i.data.payload||{});break;case t.START:s.start();break;case t.STOP:s.stop()}}))})();',"Worker",void 0,void 0)}var Uo=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))};class BroadcastCanvasManager{constructor(t,e){this.config=t,this.mediaStreamManager=e,this.handleWorkerEvent=t=>{var e;if((null===(e=t.data)||void 0===e?void 0:e.type)===Do.UPDATE)this.drawComposite()},this.mixer={video:[],audio:[]},this.analyticsTracker=AnalyticsTracker.getInstance(),this.schedulerWorker=new Lo,this.running=!1,this.compositeEl=document.createElement("canvas"),this.compositeEl.height=this.config.streamConfig.maxResolution.height,this.compositeEl.width=this.config.streamConfig.maxResolution.width;const n=this.compositeEl.getContext("2d");if(null===n)throw new BroadcastClientError(Object.assign({},lt));this.compositeContext=n,this.compositeStream=this.compositeEl.captureStream(void 0!==typeof CanvasCaptureMediaStreamTrack?0:30);const r=Qe(this.compositeStream.getTracks(),tn.VIDEO);this.audioContext=new AudioContext,this.unlockAudioContext(),this.audioDestination=this.audioContext.createMediaStreamDestination(),this.setupSilence();const i=Qe(this.audioDestination.stream.getTracks(),tn.AUDIO);r&&this.mediaStreamManager.setTrack(tn.VIDEO,r),i&&this.mediaStreamManager.setTrack(tn.AUDIO,i),this.schedulerWorker.addEventListener("message",this.handleWorkerEvent),this.schedulerWorker.postMessage({type:Do.CONFIG,payload:{frameRate:this.config.streamConfig.maxFramerate}}),this.previewElement=null,this.previewCtx=null,this.nextMix=(new Date).getTime()}attachPreview(t){this.previewElement=t;const{width:e,height:n}=this.config.streamConfig.maxResolution;this.previewElement.width=e,this.previewElement.height=n,this.previewCtx=this.previewElement.getContext("2d")}detachPreview(){this.previewElement=null,this.previewCtx=null}setupSilence(){const t=this.audioContext.createConstantSource(),e=this.audioContext.createGain();e.gain.value=.001,t.connect(e),e.connect(this.audioDestination),t.start()}unlockAudioContext(){if("suspended"!==this.audioContext.state)return;const t=document.body,e=["touchstart","touchend","mousedown","keydown"],n=()=>{e.forEach((e=>{t.removeEventListener(e,r)}))},r=()=>{this.audioContext.resume().then(n)};e.forEach((e=>{t.addEventListener(e,r,!1)}))}getTracks(){return[this.mediaStreamManager.getTrack(tn.VIDEO),this.mediaStreamManager.getTrack(tn.AUDIO)]}getCanvasVideoTrack(){return this.mediaStreamManager.getTrack(tn.VIDEO)}getAudioInputDevice(t){if("string"!=typeof t)return;const e=this.mixer.audio.find((e=>{if(e.name===t)return e.source}));return null==e?void 0:e.source}getVideoInputDevice(t){if("string"==typeof t)return this.mixer.video.find((e=>e.name===t))}getCanvasDimensions(){return{height:this.compositeEl.height,width:this.compositeEl.width}}addVideoInputDevice(t,e,n){var r;return Uo(this,void 0,void 0,(function*(){if("object"!=typeof t)throw new BroadcastClientError(Object.assign({},pt));if(!e||"string"!=typeof e)throw new BroadcastClientError(Object.assign({},mt));if(this.mixer.video.some((t=>t.name===e)))throw new BroadcastClientError(Object.assign({},ft));if(!n)throw new BroadcastClientError(Object.assign({},gt));if("number"!=typeof n.index)throw new BroadcastClientError(Object.assign({},vt));const i=function(){const t=document.createElement("video");return t.autoplay=!0,t.muted=!0,t.setAttribute("playsinline",""),t.setAttribute("webkit-playsinline",""),t}(),o=t.getVideoTracks(),[s]=o;if(!o.length)throw new BroadcastClientError(Object.assign({},dt));const a=s.getConstraints(),c=xo({},a,{frameRate:this.config.streamConfig.maxFramerate});try{yield s.applyConstraints(c)}catch(t){let e="Unknown constraints error";t instanceof Error&&(e=t.message),this.analyticsTracker.trackEvent(new ErrorEvent({description:`${_t.message}: ${e}`,isFatal:!1,code:_t.code}))}const u=()=>Uo(this,void 0,void 0,(function*(){let t=0;for(;t<5;)try{return yield i.play()}catch(e){if(!(e instanceof Error&&e.message.includes("AbortError")))throw e;t++,yield new Promise((t=>setTimeout(t,150)))}throw new Error("Error playing video, tries exceeded")})),l=new MediaStream([s]);i.srcObject=l;try{yield u();const t={name:e,element:i,position:n,source:l,render:!0},o=(null===(r=s.getSettings)||void 0===r?void 0:r.call(s))||{};this.analyticsTracker.trackEvent(new InputDeviceAttachedEvent(Ze(o),o)),this.mixer.video.push(t)}catch(t){throw new BroadcastClientError(Object.assign(Object.assign({},dt),{cause:t}))}}))}addImageSource(t,e,n){var r;return Uo(this,void 0,void 0,(function*(){if(!t)throw new BroadcastClientError(Object.assign({},pt));if(!e||"string"!=typeof e)throw new BroadcastClientError(Object.assign({},mt));if("image"===t.tagName)throw new BroadcastClientError(Object.assign({},yt));if(this.mixer.video.some((t=>t.name===e)))throw new BroadcastClientError(Object.assign({},ft));if(!n)throw new BroadcastClientError(Object.assign({},gt));if("number"!=typeof n.index)throw new BroadcastClientError(Object.assign({},vt));if(t instanceof Image){const e=null===(r=t.src)||void 0===r?void 0:r.slice();try{const e=t.src?new URL(t.src):{};if(e.host&&e.hostname){const e=yield fetch(t.src).then((t=>Uo(this,void 0,void 0,(function*(){return t.blob()})))),n=yield new Promise((t=>{const n=new FileReader;n.onload=()=>{t(n.result)},n.readAsDataURL(e)}));t.src=n}}catch(t){throw new BroadcastClientError(Object.assign(Object.assign({},It),{params:{details:`Image URL: ${e}`}}))}}const i={name:e,element:t,position:n,render:!0};this.mixer.video.push(i)}))}addAudioInputDevice(t,e){return Uo(this,void 0,void 0,(function*(){if("object"!=typeof t)throw new BroadcastClientError(Object.assign({},pt));if(!e||"string"!=typeof e)throw new BroadcastClientError(Object.assign({},mt));if(this.mixer.audio.some((t=>t.name===e)))throw new BroadcastClientError(Object.assign({},ft));const n=t.getAudioTracks();if(!n.length)throw new BroadcastClientError(Object.assign({},ht));const r=this.audioContext.createMediaStreamSource(new MediaStream(n)),i=this.audioContext.createGain();i.gain.value=1,r.connect(i),i.connect(this.audioDestination);const o={name:e,source:t,audioTrackSource:r,gainNode:i};this.analyticsTracker.trackEvent(new InputDeviceAttachedEvent("audio",{deviceId:t.id})),this.mixer.audio.push(o)}))}removeImage(t){const e=this.mixer.video.findIndex((e=>e.name===t));if(e<0)throw new BroadcastClientError(Object.assign({},Et));this.mixer.video.splice(e,1)}removeVideoInputDevice(t){var e;const n=this.removeDevice(t,this.mixer.video);if(!n)throw new BroadcastClientError(Object.assign({},bt));{const t=Qe(n.source.getTracks(),tn.VIDEO);if(!t)throw new BroadcastClientError(Object.assign({},bt));n.element.srcObject=null,t.stop();const r=(null===(e=null==t?void 0:t.getSettings)||void 0===e?void 0:e.call(t))||{};this.analyticsTracker.trackEvent(new InputDeviceDetachedEvent(Ze(r),r))}}removeAudioInputDevice(t){const e=this.removeDevice(t,this.mixer.audio);if(null==e?void 0:e.audioTrackSource){for(const t of e.source.getTracks())t.stop(),this.analyticsTracker.trackEvent(new InputDeviceDetachedEvent("audio",{deviceId:t.id}));e.gainNode.disconnect(this.audioDestination)}else if(!e)throw new BroadcastClientError(Object.assign({},bt))}updateVideoDeviceComposition(t,e){if(!t||"string"!=typeof t)throw new BroadcastClientError(Object.assign({},wt));if(!e)throw new BroadcastClientError(Object.assign({},St));if("number"!=typeof e.index)throw new BroadcastClientError(Object.assign({},Ct));this.mixer.video.forEach(((n,r)=>{n.name===t&&(n.position=e)}))}exchangeVideoDevicePositions(t,e){const n=this.getVideoInputDevice(t),r=this.getVideoInputDevice(e);if(!n)throw new BroadcastClientError(Object.assign(Object.assign({},Tt),{params:{details:`device with name: "${t}" not found`}}));if(!r)throw new BroadcastClientError(Object.assign(Object.assign({},Tt),{params:{details:`device with name: "${e}" not found`}}));const i=Object.assign({},n.position),o=Object.assign({},r.position);for(const n of this.mixer.video)n.name===t&&(Bo(o.x)?n.position=Object.assign(Object.assign({},n.position),o):n.position={index:o.index}),n.name===e&&(Bo(i.x)?n.position=Object.assign(Object.assign({},n.position),i):n.position={index:i.index})}start(){this.running||(this.running=!0,this.schedulerWorker.postMessage({type:Do.CONFIG,payload:{frameRate:this.config.streamConfig.maxFramerate}}),this.schedulerWorker.postMessage({type:Do.START}))}stop(){this.running&&(this.running=!1,this.schedulerWorker.removeEventListener("message",this.handleWorkerEvent))}isCapturing(){return this.running}getAudioLatency(){return this.audioContext.baseLatency}getVideoLatency(){var t;return(null===(t=this.mediaStreamManager.getTrack(tn.VIDEO))||void 0===t?void 0:t.getConstraints().latency)||0}disableVideo(){this.mixer.video.forEach((t=>{t.render=!1}))}enableVideo(){this.mixer.video.forEach((t=>{t.render=!0}))}disableAudio(){this.mixer.audio.forEach((t=>{t.audioTrackSource&&(t.gainNode.gain.value=0)}))}enableAudio(){this.mixer.audio.forEach((t=>{t.audioTrackSource&&(t.gainNode.gain.value=1)}))}getDrawRegion(t,e,n){var r,i,o,s;let a=null!==(r=t.position.x)&&void 0!==r?r:0,c=null!==(i=t.position.y)&&void 0!==i?i:0;const u=null!==(o=t.position.width)&&void 0!==o?o:e-a,l=null!==(s=t.position.height)&&void 0!==s?s:n-c,d=u/l;let h=t.element.width,p=t.element.height;t.element instanceof HTMLVideoElement&&(h=t.element.videoWidth,p=t.element.videoHeight);const f=h/p;let g=u,v=l;return f>d?(g=u,v=2*Math.round(u/f/2),c+=(l-v)/2):f<d&&(v=l,g=2*Math.round(l*f/2),a+=(u-g)/2),{x:a,y:c,width:g,height:v}}drawComposite(){if(!this.shouldMix(new Date))return;this.compositeContext.clearRect(0,0,this.compositeEl.width,this.compositeEl.height),this.drawBlackScreen();const t=this.mixer.video.filter((t=>t.render));t.sort(((t,e)=>t.position.index-e.position.index));for(const e of t){const{x:t,y:n,width:r,height:i}=this.getDrawRegion(e,this.compositeEl.width,this.compositeEl.height);this.compositeContext.drawImage(e.element,t,n,r,i)}this.previewElement&&this.previewCtx&&this.previewCtx.drawImage(this.compositeEl,0,0,this.previewElement.width,this.previewElement.height),this.requestCanvasCapture()}requestCanvasCapture(){if(void 0!==typeof CanvasCaptureMediaStreamTrack)if("function"==typeof this.compositeStream.requestFrame){this.compositeStream.requestFrame()}else{this.mediaStreamManager.getTrack(tn.VIDEO).requestFrame()}}drawBlackScreen(){this.compositeContext.fillStyle="#000000",this.compositeContext.fillRect(0,0,this.compositeEl.width,this.compositeEl.height)}removeDevice(t,e){const n=e.findIndex((e=>(e=>e.name===t)(e)));if(!(n<0))return e.splice(n,1)[0]}shouldMix(t){if(t.getTime()<this.nextMix)return!1;for(;this.nextMix<=t.getTime();)this.nextMix+=1e3/this.config.streamConfig.maxFramerate;return!0}}function Bo(t){return Number.isSafeInteger(t)}var Fo,Vo,Go,Wo,qo=function(t,e,n,r){var i,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(s=(o<3?i(s):o>3?i(e,n,s):i(e,n))||s);return o>3&&s&&Object.defineProperty(e,n,s),s},zo=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$o=function(t,e){return function(n,r){e(n,r,t)}},Ho=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))},Ko=function(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)};let Jo=Go=class AmazonIVSBroadcastClient{constructor(t){this.config=t,Fo.add(this),this.emitter=new u,this.isValid=!0,this.emitter.on(gn.ERROR,this.stopBroadcast),this.config.ingestEndpoint&&(this.url=new URL(this.config.ingestEndpoint)),this.analyticsTracker=AnalyticsTracker.getInstance(),this.mediaStreamManager=MediaStreamManager.getOrRegisterInstance(this);const e=new Ee(t);this.peerClient=new PeerClient(this.config,this.emitter,this.mediaStreamManager,e),this.broadcastCanvasManager=new BroadcastCanvasManager(t,this.mediaStreamManager),this.peerStatsTracker=new PeerStatsTracker(this.peerClient,this.broadcastCanvasManager,e),this.broadcastCanvasManager.start();Object.getOwnPropertyNames(Go.prototype).forEach((t=>{this[t]=new Proxy(this[t],{apply:(t,e,n)=>{if(!e.isValid)throw new BroadcastClientError(Object.assign({},jt));return Reflect.apply(t,e,n)}})})),window.addEventListener("beforeunload",(()=>{this.analyticsTracker.stop()}))}delete(){this.isValid=!1,this.peerClient.stop(),this.broadcastCanvasManager.stop(),this.emitter.removeAllListeners()}startBroadcast(t,e){return Ho(this,void 0,void 0,(function*(){Ko(this,Fo,"m",Vo).call(this,t);const n=le(e||this.config.ingestEndpoint);this.analyticsTracker.start(),this.peerStatsTracker.start(),yield this.peerClient.start(n,t),this.emitter.emit(gn.ACTIVE_STATE_CHANGE,!0),this.url=new URL(n),this.url&&this.analyticsTracker.trackEvent(new StartBroadcastEvent({protocol:"webrtc",hostname:this.url.hostname,port:this.url.port},bn.USER_INITIATED))}))}stopBroadcast(){var t,e,n;this.url&&this.analyticsTracker.trackEvent(new StopBroadcastEvent({protocol:"webrtc",hostname:this.url.hostname,port:this.url.port})),null===(t=this.peerStatsTracker)||void 0===t||t.stop(),null===(e=this.peerClient)||void 0===e||e.stop(),null===(n=this.emitter)||void 0===n||n.emit(gn.ACTIVE_STATE_CHANGE,!1)}getCanvasDimensions(){return this.broadcastCanvasManager.getCanvasDimensions()}addVideoInputDevice(t,e,n){return Ho(this,void 0,void 0,(function*(){return this.broadcastCanvasManager.addVideoInputDevice(t,e,n)}))}addImageSource(t,e,n){return Ho(this,void 0,void 0,(function*(){return this.broadcastCanvasManager.addImageSource(t,e,n)}))}addAudioInputDevice(t,e){return Ho(this,void 0,void 0,(function*(){return this.broadcastCanvasManager.addAudioInputDevice(t,e)}))}removeVideoInputDevice(t){this.broadcastCanvasManager.removeVideoInputDevice(t)}removeAudioInputDevice(t){this.broadcastCanvasManager.removeAudioInputDevice(t)}removeImage(t){this.broadcastCanvasManager.removeImage(t)}updateVideoDeviceComposition(t,e){this.broadcastCanvasManager.updateVideoDeviceComposition(t,e)}exchangeVideoDevicePositions(t,e){this.broadcastCanvasManager.exchangeVideoDevicePositions(t,e)}getAudioInputDevice(t){return this.broadcastCanvasManager.getAudioInputDevice(t)}getVideoInputDevice(t){return this.broadcastCanvasManager.getVideoInputDevice(t)}getConnectionState(){return this.peerClient.getConnectionState()}getSessionId(){return this.peerClient.getSessionId()}on(t,e){this.emitter.on(t,e)}off(t,e){this.emitter.off(t,e)}getAudioContext(){return this.broadcastCanvasManager.audioContext}attachPreview(t){this.broadcastCanvasManager.attachPreview(t)}detachPreview(){this.broadcastCanvasManager.detachPreview()}disableVideo(){this.broadcastCanvasManager.disableVideo()}enableVideo(){this.broadcastCanvasManager.enableVideo()}disableAudio(){this.broadcastCanvasManager.disableAudio()}enableAudio(){this.broadcastCanvasManager.enableAudio()}};Fo=new WeakSet,Vo=function(t){if("string"!=typeof t||!/^[a-zA-Z0-9_-]+$/.test(t))throw new BroadcastClientError(Bt)},Jo=Go=qo([X(),$o(0,rt(it.CONFIG)),zo("design:paramtypes",["function"==typeof(Wo=void 0!==Config&&Config)?Wo:Object])],Jo);const Xo=new Oo({defaultScope:"Request"}),{lazyInject:Yo}=(0,Po.Z)(Xo),Zo=t=>{const e=Xo.createChild(),n=new Config;return n.streamConfig=t.streamConfig,n.ingestEndpoint=t.ingestEndpoint,n.logger=t.logger,n.logLevel=t.logLevel,n.networkReconnectConfig=t.networkReconnectConfig,e.bind(it.CONFIG).toConstantValue(n),e},Qo=()=>"function"==typeof RTCPeerConnection;function ts(t){return Zo(t).get(Jo)}Xo.bind(Jo).toSelf();const es="1.3.2";function ns(t){const e=new StageConfig;e.logger=t.logger,e.logLevel=t.logLevel,e.streamConfig=t.streamConfig,e.whipUrlOverride=t.whipUrlOverride;const n=new Config(void 0,t.logLevel,t.streamConfig,t.logger);return new AmazonIVSBroadcastStageClient(new(l()),e,new Ee(n))}function rs(t){const e=AnalyticsTracker.getInstance(),n=Ke(t),r=f(),i=new JoinEvent({traceId:r,token:n,eventEndpoint:n.eventsURL,whipEndpoint:n.whipURL});e.trackEventNoSharedProps(i)}function is(t,e){const n=AnalyticsTracker.getInstance(),r=Ke(t),i=f(),o=new LeaveEvent({traceId:i,token:r,eventEndpoint:r.eventsURL,whipEndpoint:r.whipURL,reason:e});n.trackEventNoSharedProps(o)}const os=a})(),r})()));