@phenixrts/sdk 2022.0.2 → 2022.0.5

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 (50) hide show
  1. package/dist/debug/channels.js +277 -135
  2. package/dist/debug/full.js +277 -135
  3. package/dist/debug/groups.js +1 -1
  4. package/dist/debug/messaging.js +1 -1
  5. package/dist/debug/publish.js +1 -1
  6. package/dist/debug.private/channels.js +277 -135
  7. package/dist/debug.private/full.js +277 -135
  8. package/dist/debug.private/groups.js +1 -1
  9. package/dist/debug.private/messaging.js +1 -1
  10. package/dist/debug.private/publish.js +1 -1
  11. package/dist/es5.debug.private/channels.js +276 -135
  12. package/dist/es5.debug.private/full.js +276 -135
  13. package/dist/es5.debug.private/groups.js +1 -1
  14. package/dist/es5.debug.private/messaging.js +1 -1
  15. package/dist/es5.debug.private/publish.js +1 -1
  16. package/dist/legacy.debug/channels.js +277 -135
  17. package/dist/legacy.debug/full.js +277 -135
  18. package/dist/legacy.debug/groups.js +1 -1
  19. package/dist/legacy.debug/messaging.js +1 -1
  20. package/dist/legacy.debug/publish.js +1 -1
  21. package/dist/legacy.debug.private/channels.js +276 -135
  22. package/dist/legacy.debug.private/full.js +276 -135
  23. package/dist/legacy.debug.private/groups.js +1 -1
  24. package/dist/legacy.debug.private/messaging.js +1 -1
  25. package/dist/legacy.debug.private/publish.js +1 -1
  26. package/dist/legacy.min/channels.js +1 -1
  27. package/dist/legacy.min/channels.js.map +1 -1
  28. package/dist/legacy.min/full.js +1 -1
  29. package/dist/legacy.min/full.js.map +1 -1
  30. package/dist/legacy.min/groups.js +1 -1
  31. package/dist/legacy.min/messaging.js +1 -1
  32. package/dist/legacy.min/publish.js +1 -1
  33. package/dist/min/channels.js +1 -1
  34. package/dist/min/channels.js.map +1 -1
  35. package/dist/min/full.js +1 -1
  36. package/dist/min/full.js.map +1 -1
  37. package/dist/min/groups.js +1 -1
  38. package/dist/min/messaging.js +1 -1
  39. package/dist/min/publish.js +1 -1
  40. package/dist/min.private/channels.js +1 -1
  41. package/dist/min.private/channels.js.map +1 -1
  42. package/dist/min.private/full.js +1 -1
  43. package/dist/min.private/full.js.map +1 -1
  44. package/dist/min.private/groups.js +1 -1
  45. package/dist/min.private/messaging.js +1 -1
  46. package/dist/min.private/publish.js +1 -1
  47. package/dist/types/rtc/RtcConnectionMonitor.d.ts +1 -0
  48. package/dist/types/sdk/channels/Channel.d.ts +4 -2
  49. package/dist/types/sdk/channels/ChannelContext.d.ts +1 -0
  50. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.phenix=t():e.phenix=t()}(self,(function(){return(()=>{var e={506:e=>{e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},926:(e,t,n)=>{var r=n(202).default;function i(e,t,n,i,o,a,s){try{var u=e[a](s),c=u.value}catch(e){return void n(e)}u.done?t(c):r.resolve(c).then(i,o)}e.exports=function(e){return function(){var t=this,n=arguments;return new r((function(r,o){var a=e.apply(t,n);function s(e){i(a,r,o,s,u,"next",e)}function u(e){i(a,r,o,s,u,"throw",e)}s(void 0)}))}}},575:e=>{e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},913:e=>{function t(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}e.exports=function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}},713:e=>{e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},754:e=>{function t(n){return e.exports=t=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},t(n)}e.exports=t},205:(e,t,n)=>{var r=n(489);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t)}},585:(e,t,n)=>{var r=n(8),i=n(506);e.exports=function(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?i(e):t}},489:e=>{function t(n,r){return e.exports=t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},t(n,r)}e.exports=t},8:e=>{function t(n){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=t=function(e){return typeof e}:e.exports=t=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(n)}e.exports=t},757:(e,t,n)=>{e.exports=n(666)},202:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>d});var r=n(8),i=n.n(r),o=n(575),a=n.n(o),s=n(913),u=n.n(s),c=n(713),l=n.n(c),f=function e(t,n,r){a()(this,e),l()(this,"onFulfilled",void 0),l()(this,"onRejected",void 0),l()(this,"promise",void 0),this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof n?n:null,this.promise=r},h=function(){function e(t){if(a()(this,e),l()(this,"_state",void 0),l()(this,"_handled",void 0),l()(this,"_value",void 0),l()(this,"_deferreds",void 0),!(this instanceof e))throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],this.doResolve(t)}return u()(e,[{key:"doResolve",value:function(e){var t=this,n=!1;try{e((function(e){n||(n=!0,t.promiseResolve(e))}),(function(e){n||(n=!0,t.promiseReject(e))}))}catch(e){if(n)return;n=!0,this.promiseReject(e)}}},{key:"promiseResolve",value:function(t){var n=this;try{if(t===n)throw new TypeError("A Promise cannot be resolved with it self.");if(t&&("object"===i()(t)||"function"==typeof t)){var r=t.then;if(t instanceof e)return n._state=3,n._value=t,void n.finale();if("function"==typeof r)return void n.doResolve((function(){r.apply(t,arguments)}))}n._state=1,n._value=t,n.finale()}catch(e){n.promiseReject(e)}}},{key:"promiseReject",value:function(e){this._state=2,this._value=e,this.finale()}},{key:"finale",value:function(){var t=this;2===this._state&&0===this._deferreds.length&&e._immediate((function(){t._handled||e._unhandledRejection(t._value)}));for(var n=0,r=this._deferreds.length;n<r;n++)this.handle(this._deferreds[n]);this._deferreds=null}},{key:"handle",value:function(t){for(var n=this;3===n._state;)n=n._value;0!==n._state?(n._handled=!0,e._immediate((function(){var e=1===n._state?t.onFulfilled:t.onRejected;if(null!==e){var r;try{r=e(n._value)}catch(e){return void t.promise.promiseReject(e)}t.promise.promiseResolve(r)}else 1===n._state?t.promise.promiseResolve(n._value):t.promise.promiseReject(n._value)}))):n._deferreds.push(t)}}],[{key:"all",value:function(t){return new e((function(e,n){if(!Array.isArray(t))return n(new TypeError("Promise.all accepts an array"));var r=Array.prototype.slice.call(t);if(0===r.length)return e([]);for(var o=r.length,a=function t(a,s){try{if(s&&("object"===i()(s)||"function"==typeof s)){var u=s.then;if("function"==typeof u)return void u.call(s,(function(e){return t(a,e)}),n)}r[a]=s,0==--o&&e(r)}catch(e){n(e)}},s=0;s<r.length;s++)a(s,r[s])}))}},{key:"resolve",value:function(t){return t&&"object"===i()(t)&&t.constructor===e?t:new e((function(e){return e(t)}))}},{key:"reject",value:function(t){return new e((function(e,n){return n(t)}))}},{key:"race",value:function(t){return new e((function(n,r){if(!Array.isArray(t))return r(new TypeError("Promise.race accepts an array"));for(var i=0,o=t.length;i<o;i++)e.resolve(t[i]).then(n,r)}))}},{key:"_immediate",value:function(e){setTimeout(e,0)}},{key:"_unhandledRejection",value:function(e){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",e)}}]),e}();h.prototype.catch=function(e){return this.then(null,e)},h.prototype.then=function(e,t){var n=new this.constructor((function(){return null}));return this.handle(new f(e,t,n)),n},h.prototype.finally=function(e){var t=this.constructor;return this.then((function(n){return t.resolve(e()).then((function(){return n}))}),(function(n){return t.resolve(e()).then((function(){return t.reject(n)}))}))};var d=h},867:(e,t,n)=>{"use strict";n.r(t),n.d(t,{SDK:()=>ce,default:()=>le});var r,i=n(575),o=n.n(i),a=n(913),s=n.n(a),u=n(713),c=n.n(u);!function(e){e[e.All=-1]="All",e[e.Trace=10]="Trace",e[e.Debug=20]="Debug",e[e.Info=30]="Info",e[e.Warn=40]="Warn",e[e.Error=50]="Error",e[e.Fatal=60]="Fatal",e[e.Off=100]="Off"}(r||(r={}));var l=function(){function e(t,n,r){o()(this,e),c()(this,"_category",void 0),c()(this,"_appenders",void 0),c()(this,"_threshold",void 0),this._category=t,this._appenders=n,this._threshold=r}return s()(e,[{key:"trace",value:function(){if(this._threshold.value&&!(this._threshold.value>r.Trace)){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.log(r.Trace,t)}}},{key:"debug",value:function(){if(this._threshold.value&&!(this._threshold.value>r.Debug)){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.log(r.Debug,t)}}},{key:"info",value:function(){if(this._threshold.value&&!(this._threshold.value>r.Info)){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.log(r.Info,t)}}},{key:"warn",value:function(){if(this._threshold.value&&!(this._threshold.value>r.Warn)){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.log(r.Warn,t)}}},{key:"error",value:function(){if(this._threshold.value&&!(this._threshold.value>r.Error)){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.log(r.Error,t)}}},{key:"fatal",value:function(){if(this._threshold.value&&!(this._threshold.value>r.Fatal)){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.log(r.Fatal,t)}}},{key:"log",value:function(e,t){var n=this,r=new Date,i=this.replacePlaceholders(t);this._appenders.value.forEach((function(t){t.log(e,i,n.category,r)}))}},{key:"replacePlaceholders",value:function(e){for(var t=this,n=e[0],r=0;n.indexOf&&e.length>1&&r>=0;)if((r=n.indexOf("%",r))>0)switch(n.substring(r+1,r+2)){case"%":n=n.substring(0,r)+n.substring(r+1),r++;break;case"s":case"d":e[0]=n=this.replaceArgument(this.toString(e[1]),n,r),e.splice(1,1);break;case"j":e[0]=n=this.replaceArgument(this.stringify(e[1]),n,r),e.splice(1,1);break;default:return e.toString()}return e.length>1&&(e=e.reduce((function(e,n,r,i){return r+1===i.length&&n instanceof Error?e+"\n"+t.toString(n.stack):e+"[".concat(t.toString(n),"]")}))),e.toString()}},{key:"stringify",value:function(e){var t=[];try{return JSON.stringify(e instanceof Error?this.toString(e):e,(function(e,n){if(n&&n instanceof Object){if(t.includes(n))return"<recursive>";t.push(n)}return n}),2)}catch(e){return"[object invalid JSON.stringify]"}}},{key:"replaceArgument",value:function(e,t,n){return t.substring(0,n)+this.toString(e)+t.substring(n+2)}},{key:"toString",value:function(e){if("string"==typeof e)return e;if("boolean"==typeof e)return e?"true":"false";if("number"==typeof e)return e.toString();var t="";if(e)if("function"==typeof e)t=e.toString();else if(e instanceof Object)try{t=e.toString()}catch(e){t="[object invalid toString()]"}return t}},{key:"category",get:function(){return this._category}},{key:"appenders",get:function(){return this._appenders}},{key:"threshold",get:function(){return this._threshold}}]),e}(),f=function(){function e(){o()(this,e),c()(this,"_appenders",[])}return s()(e,[{key:"add",value:function(e){this._appenders.push(e)}},{key:"remove",value:function(e){this._appenders=this._appenders.reduce((function(t,n){return n!==e&&t.push(n),t}),[])}},{key:"value",get:function(){return this._appenders}}]),e}(),h=function(){function e(){o()(this,e)}return s()(e,null,[{key:"applyIsPrivate",value:function(){try{this._isPrivate=!0}catch(e){this._isPrivate=!1}}},{key:"isPrivate",get:function(){return this._isPrivate}}]),e}();c()(h,"_isPrivate",void 0),h.applyIsPrivate();var d=function(){function e(){o()(this,e)}return s()(e,null,[{key:"defaultLoggingLevel",get:function(){return h.isPrivate?r.Off:r.All}},{key:"defaultConsoleLoggingLevel",get:function(){return h.isPrivate?r.Off:r.All}},{key:"defaultTelemetryLoggingLevel",get:function(){return r.Info}}]),e}(),g=function(){function e(){o()(this,e),c()(this,"_threshold",d.defaultLoggingLevel)}return s()(e,[{key:"setThreshold",value:function(e){this._threshold=e}},{key:"value",get:function(){return this._threshold}}]),e}(),y=function(){function e(t){o()(this,e),c()(this,"_threshold",void 0),this._threshold=t}return s()(e,[{key:"log",value:function(e,t,n,i){if(!(e<this._threshold)){var o="".concat(i.toISOString()," [").concat(n,"] [").concat(r[e],"] ").concat(t);e<r.Warn?console.log(o):console.error(o)}}}]),e}(),v=n(757),p=n.n(v),m=n(926),_=n.n(m),w=function(){function e(){o()(this,e)}return s()(e,null,[{key:"sdkVersion",get:function(){try{return"2022-01-10T19:09:12.604Z (2022.0.2)"}catch(e){return this._defaultVersion}}}]),e}();c()(w,"_defaultVersion",(new Date).toISOString());var b,k=function(){function e(t){o()(this,e),c()(this,"_telemetryConfiguration",void 0),c()(this,"_logs",[]),c()(this,"_isSending",void 0),c()(this,"_domain",location.hostname),this._telemetryConfiguration=t}var t,n;return s()(e,[{key:"push",value:function(e,t,n,i){var o={timestamp:i.toISOString(),tenancy:this._telemetryConfiguration.tenancy,level:r[e],category:n,message:t,sessionId:this._telemetryConfiguration.sessionId,version:w.sdkVersion,environment:this._telemetryConfiguration.environment,fullQualifiedName:this._domain};e<r.Error?this._logs.push(o):this._logs.unshift(o),this.sendLogsIfAble()}},{key:"sendLogs",value:(n=_()(p().mark((function e(t){var n;return p().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=new FormData).append("jsonBody",JSON.stringify({records:t})),e.next=4,fetch(this._telemetryConfiguration.url,{method:"POST",body:n});case 4:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"sendLogsIfAble",value:(t=_()(p().mark((function e(){var t,n,r,i,o=this;return p().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(this._logs.length<=0||this._isSending)){e.next=2;break}return e.abrupt("return");case 2:for(t=0,n=0,this._isSending=!0,r=function(e){return Object.values(e).reduce((function(e,t){return e+(t?t.length:0)}),0)};this._logs.length>t&&r(this._logs[t])+n<8192;)n+=r(this._logs[t]),t++;return t||(this._logs[t].message=this._logs[t].message.substring(0,r(this._logs[t])+(8192-r(this._logs[t]))),t=1),i=this._logs.slice(0,t),this._logs=this._logs.slice(t),e.abrupt("return",this.sendLogs(i).then((function(e){return o._isSending=!1,o.sendLogsIfAble(),e})).catch((function(){o._isSending=!1,o.sendLogsIfAble()})));case 11:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),e}(),L=function(){function e(t){o()(this,e),c()(this,"_telemetryService",void 0),c()(this,"_tenancy",void 0),c()(this,"_sessionId",void 0),c()(this,"_threshold",void 0),this._tenancy=t.tenancy,this._sessionId=t.sessionId,this._threshold=t.threshold,this._telemetryService=new k(t)}return s()(e,[{key:"log",value:function(e,t,n,r){e<this._threshold||this._telemetryService.push(e,t,n,r)}}]),e}(),C=function(){function e(){o()(this,e),c()(this,"_url","https://telemetry.phenixrts.com/telemetry/logs"),c()(this,"_tenancy",void 0),c()(this,"_sessionId",void 0),c()(this,"_environment",void 0),c()(this,"_threshold",d.defaultTelemetryLoggingLevel)}return s()(e,[{key:"url",get:function(){return this._url},set:function(e){var t=new URL(e);t.pathname=t.pathname+"/logs",this._url=t.toString()}},{key:"environment",get:function(){return this._environment},set:function(e){this._environment=e}},{key:"tenancy",get:function(){return this._tenancy},set:function(e){this._tenancy=e}},{key:"sessionId",get:function(){return this._sessionId},set:function(e){this._sessionId=e}},{key:"threshold",get:function(){return this._threshold},set:function(e){this._threshold=e}}]),e}(),T=function(){function e(){o()(this,e)}return s()(e,null,[{key:"defaultTelemetryLevel",get:function(){return h.isPrivate?b.Essential:b.All}}]),e}();!function(e){e[e.Off=100]="Off",e[e.Essential=10]="Essential",e[e.All=-1]="All"}(b||(b={}));var S=function(){function e(){o()(this,e),c()(this,"_url","https://telemetry.phenixrts.com/telemetry/metrics"),c()(this,"_tenancy",void 0),c()(this,"_sessionId",void 0),c()(this,"_environment",void 0),c()(this,"_threshold",T.defaultTelemetryLevel)}return s()(e,[{key:"url",get:function(){return this._url},set:function(e){var t=new URL(e);t.pathname=t.pathname+"/metrics",this._url=t.toString()}},{key:"environment",get:function(){return this._environment},set:function(e){this._environment=e}},{key:"tenancy",get:function(){return this._tenancy},set:function(e){this._tenancy=e}},{key:"sessionId",get:function(){return this._sessionId},set:function(e){this._sessionId=e}},{key:"threshold",get:function(){return this._threshold},set:function(e){this._threshold=e}}]),e}(),x=function(e){throw new Error("Unexpected value [".concat(e,"]. This should never be reached"))},P=function(){function e(){o()(this,e)}return s()(e,null,[{key:"convertTelemetryLevelToTelemetryLevelType",value:function(e){switch(e){case b.Off:return"Off";case b.Essential:return"Essential";case b.All:return"All";default:x(e)}}},{key:"convertTelemetryLevelTypeToTelemetryLevel",value:function(e){switch(e){case"Off":return b.Off;case"Essential":return b.Essential;case"All":return b.All;default:x(e)}}}]),e}(),F=function(){function e(){o()(this,e)}return s()(e,null,[{key:"convertLoggingLevelToLoggingLevelType",value:function(e){switch(e){case r.Off:return"Off";case r.Trace:return"Trace";case r.Debug:return"Debug";case r.Info:return"Trace";case r.Warn:return"Warn";case r.Error:return"Error";case r.Fatal:return"Fatal";case r.All:return"All";default:x(e)}}},{key:"convertLoggingLevelTypeToLoggingLevel",value:function(e){switch(e){case"Off":return r.Off;case"Trace":return r.Trace;case"Debug":return r.Debug;case"Info":return r.Info;case"Warn":return r.Warn;case"Error":return r.Error;case"Fatal":return r.Fatal;case"All":return r.All;default:x(e)}}}]),e}(),A=function(){function e(){o()(this,e)}return s()(e,[{key:"getStringValue",value:function(e){return this.defaultStringValue[e]}},{key:"getBooleanValue",value:function(e){return this.defaultBooleanValue[e]}},{key:"defaultStringValue",get:function(){return{"phenix-metrics-level":P.convertTelemetryLevelToTelemetryLevelType(T.defaultTelemetryLevel),"phenix-logging-level":F.convertLoggingLevelToLoggingLevelType(d.defaultLoggingLevel),"phenix-console-logging-level":F.convertLoggingLevelToLoggingLevelType(d.defaultConsoleLoggingLevel),"phenix-telemetry-logging-level":F.convertLoggingLevelToLoggingLevelType(d.defaultTelemetryLoggingLevel),"phenix-channel-token":"","phenix-uri":"","phenix-base-uri":""}}},{key:"defaultBooleanValue",get:function(){return{"phenix-automatically-retry-on-failure":!0,"phenix-automatically-reconnect-peer-connection":!0}}}]),e}(),O=function(){function e(){throw o()(this,e),new Error("LoggerFactory is a static class that may not be instantiated")}return s()(e,null,[{key:"getLogger",value:function(t){return"string"!=typeof t&&(t="SDK"),e._loggers[t]||(e._loggers[t]=new l(t,this._appenders,this._threshold))}},{key:"applyLoggerConfigFromParameterConfiguration",value:function(){e.applyLoggingLevel(),e.applyAppenderLoggingLevel("console",e.applyConsoleLogger.bind(this)),e.applyAppenderLoggingLevel("telemetry",e.applyTelemetryLogger.bind(this))}},{key:"applyLoggingLevel",value:function(){var e=this._configurationParameterReader.getStringValue("phenix-logging-level");r[e]&&this._threshold.setThreshold(r[e])}},{key:"applyAppenderLoggingLevel",value:function(e,t){var n=this._configurationParameterReader.getStringValue("phenix-".concat(e,"-logging-level"));"Off"!==n&&t(r[n])}},{key:"applyConsoleLogger",value:function(e){this._appenders.add(new y(e||d.defaultConsoleLoggingLevel))}},{key:"applyTelemetryLogger",value:function(e){this._telemetryConfiguration.threshold=e||d.defaultTelemetryLoggingLevel,this._appenders.add(new L(this._telemetryConfiguration))}},{key:"telemetryConfiguration",get:function(){return e._telemetryConfiguration}}]),e}();c()(O,"_configurationParameterReader",new A),c()(O,"_loggers",{}),c()(O,"_appenders",new f),c()(O,"_threshold",new g),c()(O,"_telemetryConfiguration",new C),O.applyLoggerConfigFromParameterConfiguration();var E=function(){function e(){throw o()(this,e),new Error("Strings is a static class that may not be instantiated")}return s()(e,null,[{key:"random",value:function(e){var t=Math.ceil(e/13);return new Array(t).fill((function(){return Math.random().toString(16).substring(2,15)})).reduce((function(e,t){return e+t()}),"").substring(0,e)}}]),e}(),R=n(205),I=n.n(R),j=n(585),N=n.n(j),D=n(754),V=n.n(D),M=function(){function e(t){o()(this,e),c()(this,"_disposed",void 0),c()(this,"_disposable",void 0),this._disposed=!1,this._disposable=t}return s()(e,[{key:"dispose",value:function(){if(!this._disposed)return this._disposed=!0,this._disposable.call(this)}}]),e}();var U=function(e){I()(i,e);var t,n,r=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=V()(t);if(n){var i=V()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return N()(this,e)});function i(e,t){return o()(this,i),r.call(this,(function(){var n=e.indexOf(t);n>=0&&e.splice(n,1)}))}return i}(M),B=function(){function e(t){o()(this,e),c()(this,"_listeners",void 0),c()(this,"_value",void 0),this._listeners=[],this._value=t}return s()(e,[{key:"subscribe",value:function(e){return this._listeners.push(e),e(this._value),new U(this._listeners,e)}},{key:"value",set:function(e){var t=this._value!==e;if(t&&e){var n=e;"function"==typeof n.equals&&(t=!n.equals(this._value))}t&&(this._value=e,this._listeners.forEach((function(t){t(e)})))},get:function(){return this._value}}]),e}(),W=function(){function e(t){o()(this,e),c()(this,"_subject",void 0),this._subject=t}return s()(e,[{key:"subscribe",value:function(e){return this._subject.subscribe(e)}},{key:"value",get:function(){return this._subject.value}}]),e}(),G=function(){function e(){o()(this,e)}return s()(e,null,[{key:"parseBrowserNameAndVersion",value:function(){if(!navigator||!navigator.userAgent)return"";var t=navigator.userAgent.match(e._browserNameAndVersionRegex);return t&&t[0]?t[0]:e.parseBrowserNameAndVersionForIE()}},{key:"parseBrowserName",value:function(){if(!e._browserNameAndVersion)return"";var t=e._browserNameAndVersion.split("/");return t&&t[0]?t[0]:""}},{key:"parseBrowserMajorVersion",value:function(){if(!e._browserNameAndVersion)return 0;var t=e._browserNameAndVersion.split("/");if(!t||!t[1])return 0;var n=t[1];return n&&Number(n.split(".")[0])||0}},{key:"parseBrowserNameAndVersionForIE",value:function(){if(!navigator||!navigator.userAgent)return"";var e=navigator.userAgent,t=e.indexOf("MSIE ");if(t>0)return"IE/".concat(parseInt(e.substring(t+5,e.indexOf(".",t)),10));if(e.indexOf("Trident/")>0){var n=e.indexOf("rv:");return"IE/".concat(parseInt(e.substring(n+3,e.indexOf(".",n)),10))}return""}},{key:"browserNameAndVersion",get:function(){return e._browserNameAndVersion}},{key:"browserName",get:function(){return this._browserName}},{key:"browserMajorVersion",get:function(){return this._browserMajorVersion}},{key:"isChrome69",get:function(){return e._isChrome69}},{key:"isChrome70",get:function(){return e._isChrome70}},{key:"isChrome71",get:function(){return e._isChrome71}},{key:"isChrome72",get:function(){return e._isChrome72}},{key:"isChrome74",get:function(){return e._isChrome74}},{key:"isChrome75",get:function(){return e._isChrome75}},{key:"isChrome76",get:function(){return e._isChrome76}},{key:"isChrome77",get:function(){return e._isChrome77}}]),e}();c()(G,"_browserNameAndVersionRegex",/(MSIE|(?!Gecko.+)Firefox|(?!AppleWebKit.+Chrome.+)Safari|(?!AppleWebKit.+)Chrome|AppleWebKit(?!.+Chrome|.+Safari)|Gecko(?!.+Firefox))(?: |\/)([\d.apre]+)/g),c()(G,"_browserNameAndVersion",G.parseBrowserNameAndVersion()),c()(G,"_browserName",G.parseBrowserName()),c()(G,"_browserMajorVersion",G.parseBrowserMajorVersion()),c()(G,"_isChrome69",G._browserNameAndVersion.includes("Chrome/69.")),c()(G,"_isChrome70",G._browserNameAndVersion.includes("Chrome/70.")),c()(G,"_isChrome71",G._browserNameAndVersion.includes("Chrome/71.")),c()(G,"_isChrome72",G._browserNameAndVersion.includes("Chrome/72.")),c()(G,"_isChrome74",G._browserNameAndVersion.includes("Chrome/74.")),c()(G,"_isChrome75",G._browserNameAndVersion.includes("Chrome/75.")),c()(G,"_isChrome76",G._browserNameAndVersion.includes("Chrome/76.")),c()(G,"_isChrome77",G._browserNameAndVersion.includes("Chrome/77."));var J=function(){function e(){o()(this,e)}return s()(e,null,[{key:"clientOfferDisabled",get:function(){return G.isChrome74||G.isChrome75||G.isChrome76||G.isChrome77}},{key:"addTranceiverDisabled",get:function(){return G.isChrome69||G.isChrome70||G.isChrome71||G.isChrome72}},{key:"getStatsPromiseBasedDisabled",get:function(){return"Chrome"===G.browserName&&G.browserMajorVersion<=66}},{key:"getCurrentOfferDisabled",get:function(){return"Chrome"===G.browserName&&G.browserMajorVersion<=69||"Firefox"===G.browserName&&G.browserMajorVersion<=56}},{key:"onTrackDisabled",get:function(){return"Chrome"===G.browserName&&G.browserMajorVersion<=63||"Firefox"===G.browserName&&G.browserMajorVersion<=52}},{key:"webkitRTCPeerConnectionEnabled",get:function(){return"Chrome"===G.browserName&&G.browserMajorVersion<=55}},{key:"promiseBasedPCMethodsDisabled",get:function(){return"Firefox"===G.browserName&&G.browserMajorVersion<=52}},{key:"shouldUseNativeHls",get:function(){return"Safari"===G.browserName||"SamsungBrowser"===G.browserName}},{key:"isRTMPEnabled",get:function(){return"Firefox"===G.browserName&&G.browserMajorVersion<84||"Chrome"===G.browserName&&G.browserMajorVersion<70||"Edge"===G.browserName||"IE"===G.browserName}},{key:"isPrecachingEnabled",get:function(){return"IE"!==G.browserName}}]),e}(),z=n(202).default,K=function(){function e(t){o()(this,e),c()(this,"_logger",O.getLogger("VanillaPeerConnection")),c()(this,"_peerConnection",void 0),J.webkitRTCPeerConnectionEnabled?this._peerConnection=new webkitRTCPeerConnection(t):this._peerConnection=new RTCPeerConnection(t)}var t,n,r,i;return s()(e,[{key:"createOffer",value:(i=_()(p().mark((function e(t){var n=this;return p().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!J.promiseBasedPCMethodsDisabled){e.next=2;break}return e.abrupt("return",new z((function(e,r){return n._peerConnection.createOffer(e,r,t)})));case 2:return e.abrupt("return",this._peerConnection.createOffer(t));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"createAnswer",value:(r=_()(p().mark((function e(t){var n=this;return p().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!J.promiseBasedPCMethodsDisabled){e.next=2;break}return e.abrupt("return",new z((function(e,r){return n._peerConnection.createAnswer(e,r,t)})));case 2:return e.abrupt("return",this._peerConnection.createAnswer(t));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"setLocalDescription",value:(n=_()(p().mark((function e(t){return p().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._peerConnection.setLocalDescription(J.promiseBasedPCMethodsDisabled?new RTCSessionDescription(t):t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"setRemoteDescription",value:(t=_()(p().mark((function e(t){return p().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.sdp.match(/a=crypto:/i)&&this._logger.warn("SDP a=crypto is not supported"),e.abrupt("return",this._peerConnection.setRemoteDescription(J.promiseBasedPCMethodsDisabled?new RTCSessionDescription(t):t));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"getStats",value:function(e){return this._peerConnection.getStats(e)}},{key:"getStatsLegacy",value:function(){var e=this;return new z((function(t){e._peerConnection.getStats(t)}))}},{key:"addEventListener",value:function(e,t,n){this._peerConnection.addEventListener(e,t,n)}},{key:"removeEventListener",value:function(e,t,n){this._peerConnection.removeEventListener(e,t,n)}},{key:"addTransceiver",value:function(e,t){return this._peerConnection.addTransceiver(e,t)}},{key:"getConfiguration",value:function(){return this._peerConnection.getConfiguration()}},{key:"setConfiguration",value:function(e){this._peerConnection.setConfiguration(e)}},{key:"close",value:function(){this._peerConnection.close()}},{key:"native",get:function(){return this._peerConnection}},{key:"currentLocalDescription",get:function(){return this._peerConnection.currentLocalDescription}},{key:"currentRemoteDescription",get:function(){return this._peerConnection.currentRemoteDescription}},{key:"iceConnectionState",get:function(){return this._peerConnection.iceConnectionState}},{key:"supportsGetConfiguration",get:function(){return"function"==typeof this._peerConnection.getConfiguration}},{key:"supportsSetConfiguration",get:function(){return"function"==typeof this._peerConnection.setConfiguration}},{key:"supportsAddTransceiver",get:function(){return!J.addTranceiverDisabled&&"function"==typeof this._peerConnection.addTransceiver}},{key:"ontrack",set:function(e){this._peerConnection.ontrack=e},get:function(){return this._peerConnection.ontrack}},{key:"onicecandidate",set:function(e){this._peerConnection.onicecandidate=e},get:function(){return this._peerConnection.onicecandidate}},{key:"oniceconnectionstatechange",set:function(e){this._peerConnection.oniceconnectionstatechange=e},get:function(){return this._peerConnection.oniceconnectionstatechange}}]),e}(),H=function(){function e(){o()(this,e)}var t;return s()(e,[{key:"createPeerConnection",value:(t=_()(p().mark((function e(t){return p().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new K(t));case 1:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})}]),e}(),q="DIGEST:",Q=function(){function e(){o()(this,e)}return s()(e,null,[{key:"parseToken",value:function(t){if(this.isValidToken(t))try{var n=atob(t.substr(q.length)),r=JSON.parse(n);return r.token=JSON.parse(r.token),r}catch(t){return void e._logger.error("Cannot parse token value",t)}else e._logger.error("Token is not valid [%s]",t)}},{key:"getUri",value:function(e){return e&&e.token&&e.token.uri?new URL(e.token.uri):null}},{key:"getTenancy",value:function(e){return e&&e.applicationId?e.applicationId:""}},{key:"isValidToken",value:function(e){return!!e&&e.startsWith(q)}}]),e}();c()(Q,"_logger",O.getLogger("EdgeAuth"));var Y,Z=n(8),X=n.n(Z),$=function(){function e(){o()(this,e),c()(this,"_list",[])}return s()(e,[{key:"add",value:function(e){this._list.push(e)}},{key:"dispose",value:function(){this._list.forEach((function(e){return e.dispose()})),this._list.length=0}},{key:"toString",value:function(){return"DisposableList[disposables=".concat(this._list.length,"]")}}]),e}(),ee=function(){function e(){o()(this,e),c()(this,"_disposables",new $),c()(this,"_readOnlyIsForeground",void 0),c()(this,"_isForeground",void 0),c()(this,"_timeOfLastTabFocusChange",Date.now()),c()(this,"_documentFocusInterval",void 0),this._isForeground=new B(!0),this._readOnlyIsForeground=new W(this._isForeground),this.detectTabFocusChange()}return s()(e,[{key:"getTimeSinceLastChange",value:function(){return Date.now()-this._timeOfLastTabFocusChange}},{key:"dispose",value:function(){this._disposables.dispose()}},{key:"detectTabFocusChange",value:function(){var e,t,n=this;if("object"===("undefined"==typeof document?"undefined":X()(document))){void 0!==document.msHidden?(e="msHidden",t="msvisibilitychange"):void 0!==document.webkitHidden?(e="webkitHidden",t="webkitvisibilitychange"):void 0!==document.hidden&&(e="hidden",t="visibilitychange");var r=function(){var t=!document[e];n.setFocusState(t)};void 0!==document.addEventListener&&void 0!==document[e]?(document.addEventListener(t,r,!1),this._disposables.add(new M((function(){document.removeEventListener(t,r,!1)})))):this.listenForDocumentFocus.call(this)}}},{key:"listenForDocumentFocus",value:function(){var e=this;this._documentFocusInterval=window.setInterval((function(){var t=document.hasFocus();e.setFocusState(t)}),3e3),this._disposables.add(new M((function(){e._documentFocusInterval&&clearInterval(e._documentFocusInterval),e._documentFocusInterval=null})))}},{key:"setFocusState",value:function(e){this._isForeground!==e&&(this._isForeground.value=e)}},{key:"isForeground",get:function(){return this._readOnlyIsForeground}}]),e}(),te=function(){function e(){o()(this,e)}return s()(e,null,[{key:"getTelemetryUrl",value:function(e){try{var t=new URL(e),n=t.hostname.split(".");switch(t.protocol){case"ws:":t.protocol="http:";break;case"wss:":t.protocol="https:"}return 2===n.length||3===n.length&&n[n.length-2].length<=2&&n[n.length-1].length<=3?n.unshift("telemetry"):n[0].startsWith("stg-")||n[0].endsWith("-stg")||n[0].includes("-stg-")||"stg"===n[0]?n[0]="telemetry-stg":n[0].startsWith("local")||n[0].endsWith("-local")||(n[0]="telemetry"),t.hostname=n.join("."),"".concat(t.origin,"/telemetry")}catch(t){return e}}}]),e}(),ne=function(){function e(){o()(this,e)}return s()(e,null,[{key:"getEnvironmentFromUrl",value:function(e){try{return new URL(e).origin}catch(e){return""}}}]),e}(),re=function(){function e(){throw o()(this,e),new Error("DiscoveryUri is a static class that may not be instantiated")}return s()(e,null,[{key:"buildDiscoveryUrl",value:function(e){var t=new URL(e.toString()),n=w.sdkVersion;return t.search="?".concat(new URLSearchParams([["version",n],["_","".concat(Date.now())]]).toString()),"/"===t.pathname&&(t.pathname="/pcast/endPoints"),t.toString()}},{key:"uri",get:function(){return e._discoveryUri}}]),e}();c()(re,"_discoveryUri",new B("https://pcast.phenixrts.com/pcast/endPoints")),function(e){e[e.TimeToFirstFrame=0]="TimeToFirstFrame",e[e.ChannelCreationTimeToFirstFrame=1]="ChannelCreationTimeToFirstFrame",e[e.Stalled=2]="Stalled",e[e.Buffering=3]="Buffering",e[e.SetupCompleted=4]="SetupCompleted",e[e.SetupFailed=5]="SetupFailed",e[e.RoundTripTime=6]="RoundTripTime",e[e.DownlinkThroughputCapacity=7]="DownlinkThroughputCapacity",e[e.NetworkType=8]="NetworkType",e[e.ResolutionChanged=9]="ResolutionChanged",e[e.ApplicationForeground=10]="ApplicationForeground",e[e.ApplicationBackground=11]="ApplicationBackground"}(Y||(Y={}));var ie=Y,oe=function(){function e(t){o()(this,e),c()(this,"_metrics",void 0),this._metrics=t}return s()(e,[{key:"getName",value:function(){return ie[this._metrics]}},{key:"getTelemetryLevel",value:function(){switch(this._metrics){case ie.TimeToFirstFrame:case ie.ChannelCreationTimeToFirstFrame:return b.Essential;case ie.Stalled:case ie.Buffering:case ie.SetupCompleted:case ie.SetupFailed:case ie.RoundTripTime:case ie.DownlinkThroughputCapacity:case ie.NetworkType:case ie.ResolutionChanged:case ie.ApplicationForeground:case ie.ApplicationBackground:return b.All;default:x(this._metrics)}}}]),e}(),ae=function(){function e(t){o()(this,e),c()(this,"_metricsConfiguration",void 0),c()(this,"_metrics",[]),c()(this,"_isSending",void 0),c()(this,"_domain",location.hostname),this._metricsConfiguration=t}var t,n;return s()(e,[{key:"push",value:function(e){var t=e.streamId,n=e.value,r=e.previousValue,i=e.runtime,o=e.resource,a=e.kind,s=new oe(e.metricType);if(!(this._metricsConfiguration.threshold>s.getTelemetryLevel())){var u={timestamp:(new Date).toISOString(),tenancy:this._metricsConfiguration.tenancy,sessionId:this._metricsConfiguration.sessionId,streamId:t,metric:s.getName(),value:n,previousValue:r,fullQualifiedName:this._domain,environment:this._metricsConfiguration.environment,version:w.sdkVersion,runtime:i,resource:o,kind:a};this._metrics.push(u),this.sendMetricsIfAble()}}},{key:"sendMetrics",value:(n=_()(p().mark((function e(t){var n;return p().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=new FormData).append("jsonBody",JSON.stringify({records:t})),e.next=4,fetch(this._metricsConfiguration.url,{method:"POST",body:n});case 4:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"sendMetricsIfAble",value:(t=_()(p().mark((function e(){var t,n=this;return p().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(this._metrics.length<=0||this._isSending)){e.next=2;break}return e.abrupt("return");case 2:return this._isSending=!0,t=this._metrics.slice(0,1024),this._metrics=this._metrics.slice(1024),e.abrupt("return",this.sendMetrics(t).then((function(e){return n._isSending=!1,n.sendMetricsIfAble(),e})).catch((function(){n._isSending=!1,n.sendMetricsIfAble()})));case 6:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"metricsConfiguration",get:function(){return this._metricsConfiguration}}]),e}(),se=function(){function e(){throw o()(this,e),new Error("LoggerFactory is a static class that may not be instantiated")}return s()(e,null,[{key:"getMetricsService",value:function(t){if("string"!=typeof t)throw new Error("ur");var n=e._metricsServices[t];if(n)return n;var r=new S;return r.sessionId=ce.clientSessionId,r.tenancy=ce.tenancy.value,r.url=te.getTelemetryUrl(t),r.environment=ne.getEnvironmentFromUrl(t),r.threshold=P.convertTelemetryLevelTypeToTelemetryLevel(ce.telemetryLevel),e._metricsServices[t]=new ae(r)}},{key:"setTelemetryLevel",value:function(t){var n=Object.values(e._metricsServices);n&&n.length&&n.forEach((function(e){e.metricsConfiguration.threshold=t}))}}]),e}();c()(se,"_metricsServices",{});var ue=window.__phenixPageLoadTime||window.__pageLoadTime||Date.now(),ce=function(){function e(){throw o()(this,e),new Error("SDK is a static class that may not be instantiated")}return s()(e,null,[{key:"applyTelemetryConfiguration",value:function(){var t=this,n=O.telemetryConfiguration;n.sessionId=e.clientSessionId,e._environment.subscribe((function(e){n.environment=e})),e.telemetryUrl.subscribe((function(e){var r=t._logger.appenders.value.find((function(e){return e instanceof L}));r&&(n.url=e,t._logger.appenders.remove(r),t._logger.appenders.add(new L(n)),t._logger.info("Telemetry URL was set to [%s]",n.url))})),e._tenancy.subscribe((function(e){var r=t._logger.appenders.value.find((function(e){return e instanceof L}));r&&e&&(n.tenancy=e,t._logger.appenders.remove(r),t._logger.appenders.add(new L(n)),t._logger.info("Telemetry tenancy was set to [%s]",n.tenancy))}))}},{key:"applyMetricsConfiguration",value:function(){e._metricsService=se.getMetricsService(re.uri.value),e._metricsConfiguration=e._metricsService.metricsConfiguration,e._metricsConfiguration.sessionId=e.clientSessionId,e._environment.subscribe((function(t){e._metricsConfiguration.environment=t})),e.telemetryUrl.subscribe((function(t){e._metricsConfiguration.url=t})),e._tenancy.subscribe((function(t){e._metricsConfiguration.tenancy=t}));var t=this._configurationParameterReader.getStringValue("phenix-metrics-level");t&&se.setTelemetryLevel(b[t]),e._telemetryLevel.subscribe((function(e){se.setTelemetryLevel(e)}))}},{key:"applyAutomaticallyRetryOnFailureFromParameterConfiguration",value:function(){this._automaticallyRetryOnFailure=this._configurationParameterReader.getBooleanValue("phenix-automatically-retry-on-failure"),this._logger.info("Automatically retry on failure is set to: [%s]",this._automaticallyRetryOnFailure)}},{key:"applyAutomaticallyReconnectPeerConnectionFromParameterConfiguration",value:function(){this._automaticallyReconnectPeerConnection=this._configurationParameterReader.getBooleanValue("phenix-automatically-reconnect-peer-connection"),this._logger.info("Automatically reconnect peer connection is set to: [%s]",this._automaticallyReconnectPeerConnection)}},{key:"applyDiscoveryUriDefaultFromParameterConfiguration",value:function(){e.discoveryUri.subscribe((function(t){e.telemetryUrl.value=e.getTelemetryUrl(t),e._environment.value=ne.getEnvironmentFromUrl(t)}));var t=this._configurationParameterReader.getStringValue("phenix-channel-token");if(t){var n=Q.parseToken(t);return e._tenancy.value=Q.getTenancy(n),re.uri.value=(Q.getUri(n)||e.discoveryUri.value).toString(),void this._logger.info("Discovery URI set from configuration parameter to [%s]",e.discoveryUri.value)}var r=this._configurationParameterReader.getStringValue("phenix-uri");if(r)return re.uri.value=r,void this._logger.info('Discovery URI set from "phenix-uri" configuration parameter tag to [%s]',e.discoveryUri.value);var i=this._configurationParameterReader.getStringValue("phenix-base-uri");return i?(re.uri.value="".concat(i,"/pcast/endPoints"),void this._logger.info('Discovery URI set from "phenix-base-uri" configuration parameter tag to [%s]',e.discoveryUri.value)):void 0}},{key:"init",value:function(t){if(this._initialized.value||(this._applicationActivityMonitor=new ee),t){if(t.discoveryUri&&(re.uri.value=t.discoveryUri),t.peerConnectionFactory&&(e._peerConnectionFactory.value=t.peerConnectionFactory),t.telemetryLevel&&b[t.telemetryLevel]&&(e._telemetryLevel.value=P.convertTelemetryLevelTypeToTelemetryLevel(t.telemetryLevel)),t.loggingLevel&&r[t.loggingLevel]&&this._logger.threshold.setThreshold(F.convertLoggingLevelTypeToLoggingLevel(t.loggingLevel)),t.consoleLoggingLevel&&r[t.consoleLoggingLevel]){var n=this._logger.appenders.value.find((function(e){return e instanceof y}));n&&this._logger.appenders.remove(n),"Off"!==t.consoleLoggingLevel&&this._logger.appenders.add(new y(F.convertLoggingLevelTypeToLoggingLevel(t.consoleLoggingLevel)))}"boolean"==typeof t.automaticallyPlayMediaStream&&(this._automaticallyPlayMediaStream=t.automaticallyPlayMediaStream),"boolean"==typeof t.automaticallyMuteVideoOnPlayFailure&&(this._automaticallyMuteVideoOnPlayFailure=t.automaticallyMuteVideoOnPlayFailure),t.webPlayerLoader&&(this._webPlayerLoader=t.webPlayerLoader),t.shakaPlayerLoader&&(this._shakaPlayerLoader=t.shakaPlayerLoader),t.hlsJsLoader&&(this._hlsJsLoader=t.hlsJsLoader)}e._initialized.value=!0}},{key:"dispose",value:function(){e._initialized.value=!1,this._applicationActivityMonitor.dispose(),this._applicationActivityMonitor=null}},{key:"getTelemetryUrl",value:function(e){return te.getTelemetryUrl(e)}},{key:"pageLoadTime",get:function(){return ue}},{key:"sendLocalCandidates",get:function(){return this._sendLocalCandidates}},{key:"tenancy",get:function(){return this._tenancy}},{key:"clientSessionId",get:function(){return e._clientSessionId}},{key:"loadedTimestamp",get:function(){return e._loadedTimestamp}},{key:"initialized",get:function(){return e._readOnlyInitialized}},{key:"discoveryUri",get:function(){return e._readOnlyDiscoveryUri}},{key:"peerConnectionFactory",get:function(){return e._readOnlyPeerConnectionFactory}},{key:"automaticRetryOnFailure",get:function(){return e._automaticallyRetryOnFailure}},{key:"automaticallyReconnectPeerConnection",get:function(){return e._automaticallyReconnectPeerConnection}},{key:"automaticallyPlayMediaStream",get:function(){return e._automaticallyPlayMediaStream}},{key:"automaticallyMuteVideoOnPlayFailure",get:function(){return e._automaticallyMuteVideoOnPlayFailure}},{key:"webPlayerLoader",get:function(){return this._webPlayerLoader}},{key:"shakaPlayerLoader",get:function(){return this._shakaPlayerLoader}},{key:"hlsJsLoader",get:function(){return this._hlsJsLoader}},{key:"metricsService",get:function(){return e._metricsService}},{key:"applicationActivityMonitor",get:function(){return this._applicationActivityMonitor}},{key:"telemetryUrl",get:function(){return this._telemetryUrl}},{key:"maximalNumberOfPeerConnectionReconnectAttempts",get:function(){return this._maximalNumberOfPeerConnectionReconnectAttempts},set:function(e){this._maximalNumberOfPeerConnectionReconnectAttempts=e}},{key:"loggingLevel",get:function(){return F.convertLoggingLevelToLoggingLevelType(this._logger.threshold.value)}},{key:"telemetryLevel",get:function(){return P.convertTelemetryLevelToTelemetryLevelType(e._telemetryLevel.value)}},{key:"browserDetector",get:function(){return G}}]),e}();c()(ce,"_automaticallyRetryOnFailure",!0),c()(ce,"_automaticallyReconnectPeerConnection",!0),c()(ce,"_automaticallyPlayMediaStream",!0),c()(ce,"_automaticallyMuteVideoOnPlayFailure",!0),c()(ce,"_webPlayerLoader",null),c()(ce,"_shakaPlayerLoader",null),c()(ce,"_hlsJsLoader",null),c()(ce,"_configurationParameterReader",new A),c()(ce,"_applicationActivityMonitor",void 0),c()(ce,"_environment",new B("")),c()(ce,"_telemetryUrl",new B("https://telemetry.phenixrts.com/telemetry")),c()(ce,"_maximalNumberOfPeerConnectionReconnectAttempts",8),c()(ce,"_telemetryLevel",new B(T.defaultTelemetryLevel)),c()(ce,"_metricsService",void 0),c()(ce,"_metricsConfiguration",void 0),c()(ce,"_sendLocalCandidates",new B(!h.isPrivate)),c()(ce,"_tenancy",new B("")),c()(ce,"_clientSessionId",E.random(32)),c()(ce,"_loadedTimestamp",new Date),c()(ce,"_logger",O.getLogger("SDK")),c()(ce,"_initialized",new B(!1)),c()(ce,"_peerConnectionFactory",new B(new H)),c()(ce,"_readOnlyInitialized",new W(ce._initialized)),c()(ce,"_readOnlyDiscoveryUri",new W(re.uri)),c()(ce,"_readOnlyPeerConnectionFactory",new W(ce._peerConnectionFactory)),window.addEventListener("unload",(function(){ce.dispose()})),ce.applyDiscoveryUriDefaultFromParameterConfiguration(),ce.applyMetricsConfiguration(),ce.applyTelemetryConfiguration(),ce.applyAutomaticallyRetryOnFailureFromParameterConfiguration(),ce.applyAutomaticallyReconnectPeerConnectionFromParameterConfiguration(),ce.init();var le={SDK:ce}},666:(e,t,n)=>{var r=n(202).default,i=function(e){"use strict";var t,n=Object.prototype,i=n.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(e,t,n,r){var i=t&&t.prototype instanceof v?t:v,o=Object.create(i.prototype),a=new P(r||[]);return o._invoke=function(e,t,n){var r=f;return function(i,o){if(r===d)throw new Error("Generator is already running");if(r===g){if("throw"===i)throw o;return A()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var s=T(a,n);if(s){if(s===y)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===f)throw r=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=d;var u=l(e,t,n);if("normal"===u.type){if(r=n.done?g:h,u.arg===y)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r=g,n.method="throw",n.arg=u.arg)}}}(e,n,a),o}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var f="suspendedStart",h="suspendedYield",d="executing",g="completed",y={};function v(){}function p(){}function m(){}var _={};_[a]=function(){return this};var w=Object.getPrototypeOf,b=w&&w(w(F([])));b&&b!==n&&i.call(b,a)&&(_=b);var k=m.prototype=v.prototype=Object.create(_);function L(e){["next","throw","return"].forEach((function(t){e[t]=function(e){return this._invoke(t,e)}}))}function C(e,t){function n(r,o,a,s){var u=l(e[r],e,o);if("throw"!==u.type){var c=u.arg,f=c.value;return f&&"object"==typeof f&&i.call(f,"__await")?t.resolve(f.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(f).then((function(e){c.value=e,a(c)}),(function(e){return n("throw",e,a,s)}))}s(u.arg)}var r;this._invoke=function(e,i){function o(){return new t((function(t,r){n(e,i,t,r)}))}return r=r?r.then(o,o):o()}}function T(e,n){var r=e.iterator[n.method];if(r===t){if(n.delegate=null,"throw"===n.method){if(e.iterator.return&&(n.method="return",n.arg=t,T(e,n),"throw"===n.method))return y;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var i=l(r,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,y;var o=i.arg;return o?o.done?(n[e.resultName]=o.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,y):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function x(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function F(e){if(e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,o=function n(){for(;++r<e.length;)if(i.call(e,r))return n.value=e[r],n.done=!1,n;return n.value=t,n.done=!0,n};return o.next=o}}return{next:A}}function A(){return{value:t,done:!0}}return p.prototype=k.constructor=m,m.constructor=p,m[u]=p.displayName="GeneratorFunction",e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,u in e||(e[u]="GeneratorFunction")),e.prototype=Object.create(k),e},e.awrap=function(e){return{__await:e}},L(C.prototype),C.prototype[s]=function(){return this},e.AsyncIterator=C,e.async=function(t,n,i,o,a){void 0===a&&(a=r);var s=new C(c(t,n,i,o),a);return e.isGeneratorFunction(n)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},L(k),k[u]="Generator",k[a]=function(){return this},k.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=F,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(x),!e)for(var n in this)"t"===n.charAt(0)&&i.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function r(r,i){return s.type="throw",s.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var u=i.call(a,"catchLoc"),c=i.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&i.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),x(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;x(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:F(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),y}},e}(e.exports);try{regeneratorRuntime=i}catch(e){Function("r","regeneratorRuntime = r")(i)}}},t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}return n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n(867)})()}));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.phenix=t():e.phenix=t()}(self,(function(){return(()=>{var e={506:e=>{e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},926:(e,t,n)=>{var r=n(202).default;function i(e,t,n,i,o,a,s){try{var u=e[a](s),c=u.value}catch(e){return void n(e)}u.done?t(c):r.resolve(c).then(i,o)}e.exports=function(e){return function(){var t=this,n=arguments;return new r((function(r,o){var a=e.apply(t,n);function s(e){i(a,r,o,s,u,"next",e)}function u(e){i(a,r,o,s,u,"throw",e)}s(void 0)}))}}},575:e=>{e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},913:e=>{function t(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}e.exports=function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}},713:e=>{e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},754:e=>{function t(n){return e.exports=t=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},t(n)}e.exports=t},205:(e,t,n)=>{var r=n(489);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t)}},585:(e,t,n)=>{var r=n(8),i=n(506);e.exports=function(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?i(e):t}},489:e=>{function t(n,r){return e.exports=t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},t(n,r)}e.exports=t},8:e=>{function t(n){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=t=function(e){return typeof e}:e.exports=t=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(n)}e.exports=t},757:(e,t,n)=>{e.exports=n(666)},202:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>d});var r=n(8),i=n.n(r),o=n(575),a=n.n(o),s=n(913),u=n.n(s),c=n(713),l=n.n(c),f=function e(t,n,r){a()(this,e),l()(this,"onFulfilled",void 0),l()(this,"onRejected",void 0),l()(this,"promise",void 0),this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof n?n:null,this.promise=r},h=function(){function e(t){if(a()(this,e),l()(this,"_state",void 0),l()(this,"_handled",void 0),l()(this,"_value",void 0),l()(this,"_deferreds",void 0),!(this instanceof e))throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],this.doResolve(t)}return u()(e,[{key:"doResolve",value:function(e){var t=this,n=!1;try{e((function(e){n||(n=!0,t.promiseResolve(e))}),(function(e){n||(n=!0,t.promiseReject(e))}))}catch(e){if(n)return;n=!0,this.promiseReject(e)}}},{key:"promiseResolve",value:function(t){var n=this;try{if(t===n)throw new TypeError("A Promise cannot be resolved with it self.");if(t&&("object"===i()(t)||"function"==typeof t)){var r=t.then;if(t instanceof e)return n._state=3,n._value=t,void n.finale();if("function"==typeof r)return void n.doResolve((function(){r.apply(t,arguments)}))}n._state=1,n._value=t,n.finale()}catch(e){n.promiseReject(e)}}},{key:"promiseReject",value:function(e){this._state=2,this._value=e,this.finale()}},{key:"finale",value:function(){var t=this;2===this._state&&0===this._deferreds.length&&e._immediate((function(){t._handled||e._unhandledRejection(t._value)}));for(var n=0,r=this._deferreds.length;n<r;n++)this.handle(this._deferreds[n]);this._deferreds=null}},{key:"handle",value:function(t){for(var n=this;3===n._state;)n=n._value;0!==n._state?(n._handled=!0,e._immediate((function(){var e=1===n._state?t.onFulfilled:t.onRejected;if(null!==e){var r;try{r=e(n._value)}catch(e){return void t.promise.promiseReject(e)}t.promise.promiseResolve(r)}else 1===n._state?t.promise.promiseResolve(n._value):t.promise.promiseReject(n._value)}))):n._deferreds.push(t)}}],[{key:"all",value:function(t){return new e((function(e,n){if(!Array.isArray(t))return n(new TypeError("Promise.all accepts an array"));var r=Array.prototype.slice.call(t);if(0===r.length)return e([]);for(var o=r.length,a=function t(a,s){try{if(s&&("object"===i()(s)||"function"==typeof s)){var u=s.then;if("function"==typeof u)return void u.call(s,(function(e){return t(a,e)}),n)}r[a]=s,0==--o&&e(r)}catch(e){n(e)}},s=0;s<r.length;s++)a(s,r[s])}))}},{key:"resolve",value:function(t){return t&&"object"===i()(t)&&t.constructor===e?t:new e((function(e){return e(t)}))}},{key:"reject",value:function(t){return new e((function(e,n){return n(t)}))}},{key:"race",value:function(t){return new e((function(n,r){if(!Array.isArray(t))return r(new TypeError("Promise.race accepts an array"));for(var i=0,o=t.length;i<o;i++)e.resolve(t[i]).then(n,r)}))}},{key:"_immediate",value:function(e){setTimeout(e,0)}},{key:"_unhandledRejection",value:function(e){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",e)}}]),e}();h.prototype.catch=function(e){return this.then(null,e)},h.prototype.then=function(e,t){var n=new this.constructor((function(){return null}));return this.handle(new f(e,t,n)),n},h.prototype.finally=function(e){var t=this.constructor;return this.then((function(n){return t.resolve(e()).then((function(){return n}))}),(function(n){return t.resolve(e()).then((function(){return t.reject(n)}))}))};var d=h},867:(e,t,n)=>{"use strict";n.r(t),n.d(t,{SDK:()=>ce,default:()=>le});var r,i=n(575),o=n.n(i),a=n(913),s=n.n(a),u=n(713),c=n.n(u);!function(e){e[e.All=-1]="All",e[e.Trace=10]="Trace",e[e.Debug=20]="Debug",e[e.Info=30]="Info",e[e.Warn=40]="Warn",e[e.Error=50]="Error",e[e.Fatal=60]="Fatal",e[e.Off=100]="Off"}(r||(r={}));var l=function(){function e(t,n,r){o()(this,e),c()(this,"_category",void 0),c()(this,"_appenders",void 0),c()(this,"_threshold",void 0),this._category=t,this._appenders=n,this._threshold=r}return s()(e,[{key:"trace",value:function(){if(this._threshold.value&&!(this._threshold.value>r.Trace)){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.log(r.Trace,t)}}},{key:"debug",value:function(){if(this._threshold.value&&!(this._threshold.value>r.Debug)){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.log(r.Debug,t)}}},{key:"info",value:function(){if(this._threshold.value&&!(this._threshold.value>r.Info)){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.log(r.Info,t)}}},{key:"warn",value:function(){if(this._threshold.value&&!(this._threshold.value>r.Warn)){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.log(r.Warn,t)}}},{key:"error",value:function(){if(this._threshold.value&&!(this._threshold.value>r.Error)){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.log(r.Error,t)}}},{key:"fatal",value:function(){if(this._threshold.value&&!(this._threshold.value>r.Fatal)){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.log(r.Fatal,t)}}},{key:"log",value:function(e,t){var n=this,r=new Date,i=this.replacePlaceholders(t);this._appenders.value.forEach((function(t){t.log(e,i,n.category,r)}))}},{key:"replacePlaceholders",value:function(e){for(var t=this,n=e[0],r=0;n.indexOf&&e.length>1&&r>=0;)if((r=n.indexOf("%",r))>0)switch(n.substring(r+1,r+2)){case"%":n=n.substring(0,r)+n.substring(r+1),r++;break;case"s":case"d":e[0]=n=this.replaceArgument(this.toString(e[1]),n,r),e.splice(1,1);break;case"j":e[0]=n=this.replaceArgument(this.stringify(e[1]),n,r),e.splice(1,1);break;default:return e.toString()}return e.length>1&&(e=e.reduce((function(e,n,r,i){return r+1===i.length&&n instanceof Error?e+"\n"+t.toString(n.stack):e+"[".concat(t.toString(n),"]")}))),e.toString()}},{key:"stringify",value:function(e){var t=[];try{return JSON.stringify(e instanceof Error?this.toString(e):e,(function(e,n){if(n&&n instanceof Object){if(t.includes(n))return"<recursive>";t.push(n)}return n}),2)}catch(e){return"[object invalid JSON.stringify]"}}},{key:"replaceArgument",value:function(e,t,n){return t.substring(0,n)+this.toString(e)+t.substring(n+2)}},{key:"toString",value:function(e){if("string"==typeof e)return e;if("boolean"==typeof e)return e?"true":"false";if("number"==typeof e)return e.toString();var t="";if(e)if("function"==typeof e)t=e.toString();else if(e instanceof Object)try{t=e.toString()}catch(e){t="[object invalid toString()]"}return t}},{key:"category",get:function(){return this._category}},{key:"appenders",get:function(){return this._appenders}},{key:"threshold",get:function(){return this._threshold}}]),e}(),f=function(){function e(){o()(this,e),c()(this,"_appenders",[])}return s()(e,[{key:"add",value:function(e){this._appenders.push(e)}},{key:"remove",value:function(e){this._appenders=this._appenders.reduce((function(t,n){return n!==e&&t.push(n),t}),[])}},{key:"value",get:function(){return this._appenders}}]),e}(),h=function(){function e(){o()(this,e)}return s()(e,null,[{key:"applyIsPrivate",value:function(){try{this._isPrivate=!0}catch(e){this._isPrivate=!1}}},{key:"isPrivate",get:function(){return this._isPrivate}}]),e}();c()(h,"_isPrivate",void 0),h.applyIsPrivate();var d=function(){function e(){o()(this,e)}return s()(e,null,[{key:"defaultLoggingLevel",get:function(){return h.isPrivate?r.Off:r.All}},{key:"defaultConsoleLoggingLevel",get:function(){return h.isPrivate?r.Off:r.All}},{key:"defaultTelemetryLoggingLevel",get:function(){return r.Info}}]),e}(),g=function(){function e(){o()(this,e),c()(this,"_threshold",d.defaultLoggingLevel)}return s()(e,[{key:"setThreshold",value:function(e){this._threshold=e}},{key:"value",get:function(){return this._threshold}}]),e}(),y=function(){function e(t){o()(this,e),c()(this,"_threshold",void 0),this._threshold=t}return s()(e,[{key:"log",value:function(e,t,n,i){if(!(e<this._threshold)){var o="".concat(i.toISOString()," [").concat(n,"] [").concat(r[e],"] ").concat(t);e<r.Warn?console.log(o):console.error(o)}}}]),e}(),v=n(757),p=n.n(v),m=n(926),_=n.n(m),w=function(){function e(){o()(this,e)}return s()(e,null,[{key:"sdkVersion",get:function(){try{return"2022-05-05T18:02:55.793Z (2022.0.5)"}catch(e){return this._defaultVersion}}}]),e}();c()(w,"_defaultVersion",(new Date).toISOString());var b,k=function(){function e(t){o()(this,e),c()(this,"_telemetryConfiguration",void 0),c()(this,"_logs",[]),c()(this,"_isSending",void 0),c()(this,"_domain",location.hostname),this._telemetryConfiguration=t}var t,n;return s()(e,[{key:"push",value:function(e,t,n,i){var o={timestamp:i.toISOString(),tenancy:this._telemetryConfiguration.tenancy,level:r[e],category:n,message:t,sessionId:this._telemetryConfiguration.sessionId,version:w.sdkVersion,environment:this._telemetryConfiguration.environment,fullQualifiedName:this._domain};e<r.Error?this._logs.push(o):this._logs.unshift(o),this.sendLogsIfAble()}},{key:"sendLogs",value:(n=_()(p().mark((function e(t){var n;return p().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=new FormData).append("jsonBody",JSON.stringify({records:t})),e.next=4,fetch(this._telemetryConfiguration.url,{method:"POST",body:n});case 4:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"sendLogsIfAble",value:(t=_()(p().mark((function e(){var t,n,r,i,o=this;return p().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(this._logs.length<=0||this._isSending)){e.next=2;break}return e.abrupt("return");case 2:for(t=0,n=0,this._isSending=!0,r=function(e){return Object.values(e).reduce((function(e,t){return e+(t?t.length:0)}),0)};this._logs.length>t&&r(this._logs[t])+n<8192;)n+=r(this._logs[t]),t++;return t||(this._logs[t].message=this._logs[t].message.substring(0,r(this._logs[t])+(8192-r(this._logs[t]))),t=1),i=this._logs.slice(0,t),this._logs=this._logs.slice(t),e.abrupt("return",this.sendLogs(i).then((function(e){return o._isSending=!1,o.sendLogsIfAble(),e})).catch((function(){o._isSending=!1,o.sendLogsIfAble()})));case 11:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),e}(),L=function(){function e(t){o()(this,e),c()(this,"_telemetryService",void 0),c()(this,"_tenancy",void 0),c()(this,"_sessionId",void 0),c()(this,"_threshold",void 0),this._tenancy=t.tenancy,this._sessionId=t.sessionId,this._threshold=t.threshold,this._telemetryService=new k(t)}return s()(e,[{key:"log",value:function(e,t,n,r){e<this._threshold||this._telemetryService.push(e,t,n,r)}}]),e}(),C=function(){function e(){o()(this,e),c()(this,"_url","https://telemetry.phenixrts.com/telemetry/logs"),c()(this,"_tenancy",void 0),c()(this,"_sessionId",void 0),c()(this,"_environment",void 0),c()(this,"_threshold",d.defaultTelemetryLoggingLevel)}return s()(e,[{key:"url",get:function(){return this._url},set:function(e){var t=new URL(e);t.pathname=t.pathname+"/logs",this._url=t.toString()}},{key:"environment",get:function(){return this._environment},set:function(e){this._environment=e}},{key:"tenancy",get:function(){return this._tenancy},set:function(e){this._tenancy=e}},{key:"sessionId",get:function(){return this._sessionId},set:function(e){this._sessionId=e}},{key:"threshold",get:function(){return this._threshold},set:function(e){this._threshold=e}}]),e}(),T=function(){function e(){o()(this,e)}return s()(e,null,[{key:"defaultTelemetryLevel",get:function(){return h.isPrivate?b.Essential:b.All}}]),e}();!function(e){e[e.Off=100]="Off",e[e.Essential=10]="Essential",e[e.All=-1]="All"}(b||(b={}));var S=function(){function e(){o()(this,e),c()(this,"_url","https://telemetry.phenixrts.com/telemetry/metrics"),c()(this,"_tenancy",void 0),c()(this,"_sessionId",void 0),c()(this,"_environment",void 0),c()(this,"_threshold",T.defaultTelemetryLevel)}return s()(e,[{key:"url",get:function(){return this._url},set:function(e){var t=new URL(e);t.pathname=t.pathname+"/metrics",this._url=t.toString()}},{key:"environment",get:function(){return this._environment},set:function(e){this._environment=e}},{key:"tenancy",get:function(){return this._tenancy},set:function(e){this._tenancy=e}},{key:"sessionId",get:function(){return this._sessionId},set:function(e){this._sessionId=e}},{key:"threshold",get:function(){return this._threshold},set:function(e){this._threshold=e}}]),e}(),x=function(e){throw new Error("Unexpected value [".concat(e,"]. This should never be reached"))},P=function(){function e(){o()(this,e)}return s()(e,null,[{key:"convertTelemetryLevelToTelemetryLevelType",value:function(e){switch(e){case b.Off:return"Off";case b.Essential:return"Essential";case b.All:return"All";default:x(e)}}},{key:"convertTelemetryLevelTypeToTelemetryLevel",value:function(e){switch(e){case"Off":return b.Off;case"Essential":return b.Essential;case"All":return b.All;default:x(e)}}}]),e}(),F=function(){function e(){o()(this,e)}return s()(e,null,[{key:"convertLoggingLevelToLoggingLevelType",value:function(e){switch(e){case r.Off:return"Off";case r.Trace:return"Trace";case r.Debug:return"Debug";case r.Info:return"Trace";case r.Warn:return"Warn";case r.Error:return"Error";case r.Fatal:return"Fatal";case r.All:return"All";default:x(e)}}},{key:"convertLoggingLevelTypeToLoggingLevel",value:function(e){switch(e){case"Off":return r.Off;case"Trace":return r.Trace;case"Debug":return r.Debug;case"Info":return r.Info;case"Warn":return r.Warn;case"Error":return r.Error;case"Fatal":return r.Fatal;case"All":return r.All;default:x(e)}}}]),e}(),A=function(){function e(){o()(this,e)}return s()(e,[{key:"getStringValue",value:function(e){return this.defaultStringValue[e]}},{key:"getBooleanValue",value:function(e){return this.defaultBooleanValue[e]}},{key:"defaultStringValue",get:function(){return{"phenix-metrics-level":P.convertTelemetryLevelToTelemetryLevelType(T.defaultTelemetryLevel),"phenix-logging-level":F.convertLoggingLevelToLoggingLevelType(d.defaultLoggingLevel),"phenix-console-logging-level":F.convertLoggingLevelToLoggingLevelType(d.defaultConsoleLoggingLevel),"phenix-telemetry-logging-level":F.convertLoggingLevelToLoggingLevelType(d.defaultTelemetryLoggingLevel),"phenix-channel-token":"","phenix-uri":"","phenix-base-uri":""}}},{key:"defaultBooleanValue",get:function(){return{"phenix-automatically-retry-on-failure":!0,"phenix-automatically-reconnect-peer-connection":!0}}}]),e}(),O=function(){function e(){throw o()(this,e),new Error("LoggerFactory is a static class that may not be instantiated")}return s()(e,null,[{key:"getLogger",value:function(t){return"string"!=typeof t&&(t="SDK"),e._loggers[t]||(e._loggers[t]=new l(t,this._appenders,this._threshold))}},{key:"applyLoggerConfigFromParameterConfiguration",value:function(){e.applyLoggingLevel(),e.applyAppenderLoggingLevel("console",e.applyConsoleLogger.bind(this)),e.applyAppenderLoggingLevel("telemetry",e.applyTelemetryLogger.bind(this))}},{key:"applyLoggingLevel",value:function(){var e=this._configurationParameterReader.getStringValue("phenix-logging-level");r[e]&&this._threshold.setThreshold(r[e])}},{key:"applyAppenderLoggingLevel",value:function(e,t){var n=this._configurationParameterReader.getStringValue("phenix-".concat(e,"-logging-level"));"Off"!==n&&t(r[n])}},{key:"applyConsoleLogger",value:function(e){this._appenders.add(new y(e||d.defaultConsoleLoggingLevel))}},{key:"applyTelemetryLogger",value:function(e){this._telemetryConfiguration.threshold=e||d.defaultTelemetryLoggingLevel,this._appenders.add(new L(this._telemetryConfiguration))}},{key:"telemetryConfiguration",get:function(){return e._telemetryConfiguration}}]),e}();c()(O,"_configurationParameterReader",new A),c()(O,"_loggers",{}),c()(O,"_appenders",new f),c()(O,"_threshold",new g),c()(O,"_telemetryConfiguration",new C),O.applyLoggerConfigFromParameterConfiguration();var E=function(){function e(){throw o()(this,e),new Error("Strings is a static class that may not be instantiated")}return s()(e,null,[{key:"random",value:function(e){var t=Math.ceil(e/13);return new Array(t).fill((function(){return Math.random().toString(16).substring(2,15)})).reduce((function(e,t){return e+t()}),"").substring(0,e)}}]),e}(),R=n(205),I=n.n(R),j=n(585),N=n.n(j),D=n(754),V=n.n(D),M=function(){function e(t){o()(this,e),c()(this,"_disposed",void 0),c()(this,"_disposable",void 0),this._disposed=!1,this._disposable=t}return s()(e,[{key:"dispose",value:function(){if(!this._disposed)return this._disposed=!0,this._disposable.call(this)}}]),e}();var U=function(e){I()(i,e);var t,n,r=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=V()(t);if(n){var i=V()(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return N()(this,e)});function i(e,t){return o()(this,i),r.call(this,(function(){var n=e.indexOf(t);n>=0&&e.splice(n,1)}))}return i}(M),B=function(){function e(t){o()(this,e),c()(this,"_listeners",void 0),c()(this,"_value",void 0),this._listeners=[],this._value=t}return s()(e,[{key:"subscribe",value:function(e){return this._listeners.push(e),e(this._value),new U(this._listeners,e)}},{key:"value",set:function(e){var t=this._value!==e;if(t&&e){var n=e;"function"==typeof n.equals&&(t=!n.equals(this._value))}t&&(this._value=e,this._listeners.forEach((function(t){t(e)})))},get:function(){return this._value}}]),e}(),W=function(){function e(t){o()(this,e),c()(this,"_subject",void 0),this._subject=t}return s()(e,[{key:"subscribe",value:function(e){return this._subject.subscribe(e)}},{key:"value",get:function(){return this._subject.value}}]),e}(),G=function(){function e(){o()(this,e)}return s()(e,null,[{key:"parseBrowserNameAndVersion",value:function(){if(!navigator||!navigator.userAgent)return"";var t=navigator.userAgent.match(e._browserNameAndVersionRegex);return t&&t[0]?t[0]:e.parseBrowserNameAndVersionForIE()}},{key:"parseBrowserName",value:function(){if(!e._browserNameAndVersion)return"";var t=e._browserNameAndVersion.split("/");return t&&t[0]?t[0]:""}},{key:"parseBrowserMajorVersion",value:function(){if(!e._browserNameAndVersion)return 0;var t=e._browserNameAndVersion.split("/");if(!t||!t[1])return 0;var n=t[1];return n&&Number(n.split(".")[0])||0}},{key:"parseBrowserNameAndVersionForIE",value:function(){if(!navigator||!navigator.userAgent)return"";var e=navigator.userAgent,t=e.indexOf("MSIE ");if(t>0)return"IE/".concat(parseInt(e.substring(t+5,e.indexOf(".",t)),10));if(e.indexOf("Trident/")>0){var n=e.indexOf("rv:");return"IE/".concat(parseInt(e.substring(n+3,e.indexOf(".",n)),10))}return""}},{key:"browserNameAndVersion",get:function(){return e._browserNameAndVersion}},{key:"browserName",get:function(){return this._browserName}},{key:"browserMajorVersion",get:function(){return this._browserMajorVersion}},{key:"isChrome69",get:function(){return e._isChrome69}},{key:"isChrome70",get:function(){return e._isChrome70}},{key:"isChrome71",get:function(){return e._isChrome71}},{key:"isChrome72",get:function(){return e._isChrome72}},{key:"isChrome74",get:function(){return e._isChrome74}},{key:"isChrome75",get:function(){return e._isChrome75}},{key:"isChrome76",get:function(){return e._isChrome76}},{key:"isChrome77",get:function(){return e._isChrome77}}]),e}();c()(G,"_browserNameAndVersionRegex",/(MSIE|(?!Gecko.+)Firefox|(?!AppleWebKit.+Chrome.+)Safari|(?!AppleWebKit.+)Chrome|AppleWebKit(?!.+Chrome|.+Safari)|Gecko(?!.+Firefox))(?: |\/)([\d.apre]+)/g),c()(G,"_browserNameAndVersion",G.parseBrowserNameAndVersion()),c()(G,"_browserName",G.parseBrowserName()),c()(G,"_browserMajorVersion",G.parseBrowserMajorVersion()),c()(G,"_isChrome69",G._browserNameAndVersion.includes("Chrome/69.")),c()(G,"_isChrome70",G._browserNameAndVersion.includes("Chrome/70.")),c()(G,"_isChrome71",G._browserNameAndVersion.includes("Chrome/71.")),c()(G,"_isChrome72",G._browserNameAndVersion.includes("Chrome/72.")),c()(G,"_isChrome74",G._browserNameAndVersion.includes("Chrome/74.")),c()(G,"_isChrome75",G._browserNameAndVersion.includes("Chrome/75.")),c()(G,"_isChrome76",G._browserNameAndVersion.includes("Chrome/76.")),c()(G,"_isChrome77",G._browserNameAndVersion.includes("Chrome/77."));var J=function(){function e(){o()(this,e)}return s()(e,null,[{key:"clientOfferDisabled",get:function(){return G.isChrome74||G.isChrome75||G.isChrome76||G.isChrome77}},{key:"addTranceiverDisabled",get:function(){return G.isChrome69||G.isChrome70||G.isChrome71||G.isChrome72}},{key:"getStatsPromiseBasedDisabled",get:function(){return"Chrome"===G.browserName&&G.browserMajorVersion<=66}},{key:"getCurrentOfferDisabled",get:function(){return"Chrome"===G.browserName&&G.browserMajorVersion<=69||"Firefox"===G.browserName&&G.browserMajorVersion<=56}},{key:"onTrackDisabled",get:function(){return"Chrome"===G.browserName&&G.browserMajorVersion<=63||"Firefox"===G.browserName&&G.browserMajorVersion<=52}},{key:"webkitRTCPeerConnectionEnabled",get:function(){return"Chrome"===G.browserName&&G.browserMajorVersion<=55}},{key:"promiseBasedPCMethodsDisabled",get:function(){return"Firefox"===G.browserName&&G.browserMajorVersion<=52}},{key:"shouldUseNativeHls",get:function(){return"Safari"===G.browserName||"SamsungBrowser"===G.browserName}},{key:"isRTMPEnabled",get:function(){return"Firefox"===G.browserName&&G.browserMajorVersion<84||"Chrome"===G.browserName&&G.browserMajorVersion<70||"Edge"===G.browserName||"IE"===G.browserName}},{key:"isPrecachingEnabled",get:function(){return"IE"!==G.browserName}}]),e}(),z=n(202).default,K=function(){function e(t){o()(this,e),c()(this,"_logger",O.getLogger("VanillaPeerConnection")),c()(this,"_peerConnection",void 0),J.webkitRTCPeerConnectionEnabled?this._peerConnection=new webkitRTCPeerConnection(t):this._peerConnection=new RTCPeerConnection(t)}var t,n,r,i;return s()(e,[{key:"createOffer",value:(i=_()(p().mark((function e(t){var n=this;return p().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!J.promiseBasedPCMethodsDisabled){e.next=2;break}return e.abrupt("return",new z((function(e,r){return n._peerConnection.createOffer(e,r,t)})));case 2:return e.abrupt("return",this._peerConnection.createOffer(t));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"createAnswer",value:(r=_()(p().mark((function e(t){var n=this;return p().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!J.promiseBasedPCMethodsDisabled){e.next=2;break}return e.abrupt("return",new z((function(e,r){return n._peerConnection.createAnswer(e,r,t)})));case 2:return e.abrupt("return",this._peerConnection.createAnswer(t));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"setLocalDescription",value:(n=_()(p().mark((function e(t){return p().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._peerConnection.setLocalDescription(J.promiseBasedPCMethodsDisabled?new RTCSessionDescription(t):t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"setRemoteDescription",value:(t=_()(p().mark((function e(t){return p().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.sdp.match(/a=crypto:/i)&&this._logger.warn("SDP a=crypto is not supported"),e.abrupt("return",this._peerConnection.setRemoteDescription(J.promiseBasedPCMethodsDisabled?new RTCSessionDescription(t):t));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"getStats",value:function(e){return this._peerConnection.getStats(e)}},{key:"getStatsLegacy",value:function(){var e=this;return new z((function(t){e._peerConnection.getStats(t)}))}},{key:"addEventListener",value:function(e,t,n){this._peerConnection.addEventListener(e,t,n)}},{key:"removeEventListener",value:function(e,t,n){this._peerConnection.removeEventListener(e,t,n)}},{key:"addTransceiver",value:function(e,t){return this._peerConnection.addTransceiver(e,t)}},{key:"getConfiguration",value:function(){return this._peerConnection.getConfiguration()}},{key:"setConfiguration",value:function(e){this._peerConnection.setConfiguration(e)}},{key:"close",value:function(){this._peerConnection.close()}},{key:"native",get:function(){return this._peerConnection}},{key:"currentLocalDescription",get:function(){return this._peerConnection.currentLocalDescription}},{key:"currentRemoteDescription",get:function(){return this._peerConnection.currentRemoteDescription}},{key:"iceConnectionState",get:function(){return this._peerConnection.iceConnectionState}},{key:"supportsGetConfiguration",get:function(){return"function"==typeof this._peerConnection.getConfiguration}},{key:"supportsSetConfiguration",get:function(){return"function"==typeof this._peerConnection.setConfiguration}},{key:"supportsAddTransceiver",get:function(){return!J.addTranceiverDisabled&&"function"==typeof this._peerConnection.addTransceiver}},{key:"ontrack",set:function(e){this._peerConnection.ontrack=e},get:function(){return this._peerConnection.ontrack}},{key:"onicecandidate",set:function(e){this._peerConnection.onicecandidate=e},get:function(){return this._peerConnection.onicecandidate}},{key:"oniceconnectionstatechange",set:function(e){this._peerConnection.oniceconnectionstatechange=e},get:function(){return this._peerConnection.oniceconnectionstatechange}}]),e}(),H=function(){function e(){o()(this,e)}var t;return s()(e,[{key:"createPeerConnection",value:(t=_()(p().mark((function e(t){return p().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new K(t));case 1:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})}]),e}(),q="DIGEST:",Q=function(){function e(){o()(this,e)}return s()(e,null,[{key:"parseToken",value:function(t){if(this.isValidToken(t))try{var n=atob(t.substr(q.length)),r=JSON.parse(n);return r.token=JSON.parse(r.token),r}catch(t){return void e._logger.error("Cannot parse token value",t)}else e._logger.error("Token is not valid [%s]",t)}},{key:"getUri",value:function(e){return e&&e.token&&e.token.uri?new URL(e.token.uri):null}},{key:"getTenancy",value:function(e){return e&&e.applicationId?e.applicationId:""}},{key:"isValidToken",value:function(e){return!!e&&e.startsWith(q)}}]),e}();c()(Q,"_logger",O.getLogger("EdgeAuth"));var Y,Z=n(8),X=n.n(Z),$=function(){function e(){o()(this,e),c()(this,"_list",[])}return s()(e,[{key:"add",value:function(e){this._list.push(e)}},{key:"dispose",value:function(){this._list.forEach((function(e){return e.dispose()})),this._list.length=0}},{key:"toString",value:function(){return"DisposableList[disposables=".concat(this._list.length,"]")}}]),e}(),ee=function(){function e(){o()(this,e),c()(this,"_disposables",new $),c()(this,"_readOnlyIsForeground",void 0),c()(this,"_isForeground",void 0),c()(this,"_timeOfLastTabFocusChange",Date.now()),c()(this,"_documentFocusInterval",void 0),this._isForeground=new B(!0),this._readOnlyIsForeground=new W(this._isForeground),this.detectTabFocusChange()}return s()(e,[{key:"getTimeSinceLastChange",value:function(){return Date.now()-this._timeOfLastTabFocusChange}},{key:"dispose",value:function(){this._disposables.dispose()}},{key:"detectTabFocusChange",value:function(){var e,t,n=this;if("object"===("undefined"==typeof document?"undefined":X()(document))){void 0!==document.msHidden?(e="msHidden",t="msvisibilitychange"):void 0!==document.webkitHidden?(e="webkitHidden",t="webkitvisibilitychange"):void 0!==document.hidden&&(e="hidden",t="visibilitychange");var r=function(){var t=!document[e];n.setFocusState(t)};void 0!==document.addEventListener&&void 0!==document[e]?(document.addEventListener(t,r,!1),this._disposables.add(new M((function(){document.removeEventListener(t,r,!1)})))):this.listenForDocumentFocus.call(this)}}},{key:"listenForDocumentFocus",value:function(){var e=this;this._documentFocusInterval=window.setInterval((function(){var t=document.hasFocus();e.setFocusState(t)}),3e3),this._disposables.add(new M((function(){e._documentFocusInterval&&clearInterval(e._documentFocusInterval),e._documentFocusInterval=null})))}},{key:"setFocusState",value:function(e){this._isForeground!==e&&(this._isForeground.value=e)}},{key:"isForeground",get:function(){return this._readOnlyIsForeground}}]),e}(),te=function(){function e(){o()(this,e)}return s()(e,null,[{key:"getTelemetryUrl",value:function(e){try{var t=new URL(e),n=t.hostname.split(".");switch(t.protocol){case"ws:":t.protocol="http:";break;case"wss:":t.protocol="https:"}return 2===n.length||3===n.length&&n[n.length-2].length<=2&&n[n.length-1].length<=3?n.unshift("telemetry"):n[0].startsWith("stg-")||n[0].endsWith("-stg")||n[0].includes("-stg-")||"stg"===n[0]?n[0]="telemetry-stg":n[0].startsWith("local")||n[0].endsWith("-local")||(n[0]="telemetry"),t.hostname=n.join("."),"".concat(t.origin,"/telemetry")}catch(t){return e}}}]),e}(),ne=function(){function e(){o()(this,e)}return s()(e,null,[{key:"getEnvironmentFromUrl",value:function(e){try{return new URL(e).origin}catch(e){return""}}}]),e}(),re=function(){function e(){throw o()(this,e),new Error("DiscoveryUri is a static class that may not be instantiated")}return s()(e,null,[{key:"buildDiscoveryUrl",value:function(e){var t=new URL(e.toString()),n=w.sdkVersion;return t.search="?".concat(new URLSearchParams([["version",n],["_","".concat(Date.now())]]).toString()),"/"===t.pathname&&(t.pathname="/pcast/endPoints"),t.toString()}},{key:"uri",get:function(){return e._discoveryUri}}]),e}();c()(re,"_discoveryUri",new B("https://pcast.phenixrts.com/pcast/endPoints")),function(e){e[e.TimeToFirstFrame=0]="TimeToFirstFrame",e[e.ChannelCreationTimeToFirstFrame=1]="ChannelCreationTimeToFirstFrame",e[e.Stalled=2]="Stalled",e[e.Buffering=3]="Buffering",e[e.SetupCompleted=4]="SetupCompleted",e[e.SetupFailed=5]="SetupFailed",e[e.RoundTripTime=6]="RoundTripTime",e[e.DownlinkThroughputCapacity=7]="DownlinkThroughputCapacity",e[e.NetworkType=8]="NetworkType",e[e.ResolutionChanged=9]="ResolutionChanged",e[e.ApplicationForeground=10]="ApplicationForeground",e[e.ApplicationBackground=11]="ApplicationBackground"}(Y||(Y={}));var ie=Y,oe=function(){function e(t){o()(this,e),c()(this,"_metrics",void 0),this._metrics=t}return s()(e,[{key:"getName",value:function(){return ie[this._metrics]}},{key:"getTelemetryLevel",value:function(){switch(this._metrics){case ie.TimeToFirstFrame:case ie.ChannelCreationTimeToFirstFrame:return b.Essential;case ie.Stalled:case ie.Buffering:case ie.SetupCompleted:case ie.SetupFailed:case ie.RoundTripTime:case ie.DownlinkThroughputCapacity:case ie.NetworkType:case ie.ResolutionChanged:case ie.ApplicationForeground:case ie.ApplicationBackground:return b.All;default:x(this._metrics)}}}]),e}(),ae=function(){function e(t){o()(this,e),c()(this,"_metricsConfiguration",void 0),c()(this,"_metrics",[]),c()(this,"_isSending",void 0),c()(this,"_domain",location.hostname),this._metricsConfiguration=t}var t,n;return s()(e,[{key:"push",value:function(e){var t=e.streamId,n=e.value,r=e.previousValue,i=e.runtime,o=e.resource,a=e.kind,s=new oe(e.metricType);if(!(this._metricsConfiguration.threshold>s.getTelemetryLevel())){var u={timestamp:(new Date).toISOString(),tenancy:this._metricsConfiguration.tenancy,sessionId:this._metricsConfiguration.sessionId,streamId:t,metric:s.getName(),value:n,previousValue:r,fullQualifiedName:this._domain,environment:this._metricsConfiguration.environment,version:w.sdkVersion,runtime:i,resource:o,kind:a};this._metrics.push(u),this.sendMetricsIfAble()}}},{key:"sendMetrics",value:(n=_()(p().mark((function e(t){var n;return p().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=new FormData).append("jsonBody",JSON.stringify({records:t})),e.next=4,fetch(this._metricsConfiguration.url,{method:"POST",body:n});case 4:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"sendMetricsIfAble",value:(t=_()(p().mark((function e(){var t,n=this;return p().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(this._metrics.length<=0||this._isSending)){e.next=2;break}return e.abrupt("return");case 2:return this._isSending=!0,t=this._metrics.slice(0,1024),this._metrics=this._metrics.slice(1024),e.abrupt("return",this.sendMetrics(t).then((function(e){return n._isSending=!1,n.sendMetricsIfAble(),e})).catch((function(){n._isSending=!1,n.sendMetricsIfAble()})));case 6:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"metricsConfiguration",get:function(){return this._metricsConfiguration}}]),e}(),se=function(){function e(){throw o()(this,e),new Error("LoggerFactory is a static class that may not be instantiated")}return s()(e,null,[{key:"getMetricsService",value:function(t){if("string"!=typeof t)throw new Error("ur");var n=e._metricsServices[t];if(n)return n;var r=new S;return r.sessionId=ce.clientSessionId,r.tenancy=ce.tenancy.value,r.url=te.getTelemetryUrl(t),r.environment=ne.getEnvironmentFromUrl(t),r.threshold=P.convertTelemetryLevelTypeToTelemetryLevel(ce.telemetryLevel),e._metricsServices[t]=new ae(r)}},{key:"setTelemetryLevel",value:function(t){var n=Object.values(e._metricsServices);n&&n.length&&n.forEach((function(e){e.metricsConfiguration.threshold=t}))}}]),e}();c()(se,"_metricsServices",{});var ue=window.__phenixPageLoadTime||window.__pageLoadTime||Date.now(),ce=function(){function e(){throw o()(this,e),new Error("SDK is a static class that may not be instantiated")}return s()(e,null,[{key:"applyTelemetryConfiguration",value:function(){var t=this,n=O.telemetryConfiguration;n.sessionId=e.clientSessionId,e._environment.subscribe((function(e){n.environment=e})),e.telemetryUrl.subscribe((function(e){var r=t._logger.appenders.value.find((function(e){return e instanceof L}));r&&(n.url=e,t._logger.appenders.remove(r),t._logger.appenders.add(new L(n)),t._logger.info("Telemetry URL was set to [%s]",n.url))})),e._tenancy.subscribe((function(e){var r=t._logger.appenders.value.find((function(e){return e instanceof L}));r&&e&&(n.tenancy=e,t._logger.appenders.remove(r),t._logger.appenders.add(new L(n)),t._logger.info("Telemetry tenancy was set to [%s]",n.tenancy))}))}},{key:"applyMetricsConfiguration",value:function(){e._metricsService=se.getMetricsService(re.uri.value),e._metricsConfiguration=e._metricsService.metricsConfiguration,e._metricsConfiguration.sessionId=e.clientSessionId,e._environment.subscribe((function(t){e._metricsConfiguration.environment=t})),e.telemetryUrl.subscribe((function(t){e._metricsConfiguration.url=t})),e._tenancy.subscribe((function(t){e._metricsConfiguration.tenancy=t}));var t=this._configurationParameterReader.getStringValue("phenix-metrics-level");t&&se.setTelemetryLevel(b[t]),e._telemetryLevel.subscribe((function(e){se.setTelemetryLevel(e)}))}},{key:"applyAutomaticallyRetryOnFailureFromParameterConfiguration",value:function(){this._automaticallyRetryOnFailure=this._configurationParameterReader.getBooleanValue("phenix-automatically-retry-on-failure"),this._logger.info("Automatically retry on failure is set to: [%s]",this._automaticallyRetryOnFailure)}},{key:"applyAutomaticallyReconnectPeerConnectionFromParameterConfiguration",value:function(){this._automaticallyReconnectPeerConnection=this._configurationParameterReader.getBooleanValue("phenix-automatically-reconnect-peer-connection"),this._logger.info("Automatically reconnect peer connection is set to: [%s]",this._automaticallyReconnectPeerConnection)}},{key:"applyDiscoveryUriDefaultFromParameterConfiguration",value:function(){e.discoveryUri.subscribe((function(t){e.telemetryUrl.value=e.getTelemetryUrl(t),e._environment.value=ne.getEnvironmentFromUrl(t)}));var t=this._configurationParameterReader.getStringValue("phenix-channel-token");if(t){var n=Q.parseToken(t);return e._tenancy.value=Q.getTenancy(n),re.uri.value=(Q.getUri(n)||e.discoveryUri.value).toString(),void this._logger.info("Discovery URI set from configuration parameter to [%s]",e.discoveryUri.value)}var r=this._configurationParameterReader.getStringValue("phenix-uri");if(r)return re.uri.value=r,void this._logger.info('Discovery URI set from "phenix-uri" configuration parameter tag to [%s]',e.discoveryUri.value);var i=this._configurationParameterReader.getStringValue("phenix-base-uri");return i?(re.uri.value="".concat(i,"/pcast/endPoints"),void this._logger.info('Discovery URI set from "phenix-base-uri" configuration parameter tag to [%s]',e.discoveryUri.value)):void 0}},{key:"init",value:function(t){if(this._initialized.value||(this._applicationActivityMonitor=new ee),t){if(t.discoveryUri&&(re.uri.value=t.discoveryUri),t.peerConnectionFactory&&(e._peerConnectionFactory.value=t.peerConnectionFactory),t.telemetryLevel&&b[t.telemetryLevel]&&(e._telemetryLevel.value=P.convertTelemetryLevelTypeToTelemetryLevel(t.telemetryLevel)),t.loggingLevel&&r[t.loggingLevel]&&this._logger.threshold.setThreshold(F.convertLoggingLevelTypeToLoggingLevel(t.loggingLevel)),t.consoleLoggingLevel&&r[t.consoleLoggingLevel]){var n=this._logger.appenders.value.find((function(e){return e instanceof y}));n&&this._logger.appenders.remove(n),"Off"!==t.consoleLoggingLevel&&this._logger.appenders.add(new y(F.convertLoggingLevelTypeToLoggingLevel(t.consoleLoggingLevel)))}"boolean"==typeof t.automaticallyPlayMediaStream&&(this._automaticallyPlayMediaStream=t.automaticallyPlayMediaStream),"boolean"==typeof t.automaticallyMuteVideoOnPlayFailure&&(this._automaticallyMuteVideoOnPlayFailure=t.automaticallyMuteVideoOnPlayFailure),t.webPlayerLoader&&(this._webPlayerLoader=t.webPlayerLoader),t.shakaPlayerLoader&&(this._shakaPlayerLoader=t.shakaPlayerLoader),t.hlsJsLoader&&(this._hlsJsLoader=t.hlsJsLoader)}e._initialized.value=!0}},{key:"dispose",value:function(){e._initialized.value=!1,this._applicationActivityMonitor.dispose(),this._applicationActivityMonitor=null}},{key:"getTelemetryUrl",value:function(e){return te.getTelemetryUrl(e)}},{key:"pageLoadTime",get:function(){return ue}},{key:"sendLocalCandidates",get:function(){return this._sendLocalCandidates}},{key:"tenancy",get:function(){return this._tenancy}},{key:"clientSessionId",get:function(){return e._clientSessionId}},{key:"loadedTimestamp",get:function(){return e._loadedTimestamp}},{key:"initialized",get:function(){return e._readOnlyInitialized}},{key:"discoveryUri",get:function(){return e._readOnlyDiscoveryUri}},{key:"peerConnectionFactory",get:function(){return e._readOnlyPeerConnectionFactory}},{key:"automaticRetryOnFailure",get:function(){return e._automaticallyRetryOnFailure}},{key:"automaticallyReconnectPeerConnection",get:function(){return e._automaticallyReconnectPeerConnection}},{key:"automaticallyPlayMediaStream",get:function(){return e._automaticallyPlayMediaStream}},{key:"automaticallyMuteVideoOnPlayFailure",get:function(){return e._automaticallyMuteVideoOnPlayFailure}},{key:"webPlayerLoader",get:function(){return this._webPlayerLoader}},{key:"shakaPlayerLoader",get:function(){return this._shakaPlayerLoader}},{key:"hlsJsLoader",get:function(){return this._hlsJsLoader}},{key:"metricsService",get:function(){return e._metricsService}},{key:"applicationActivityMonitor",get:function(){return this._applicationActivityMonitor}},{key:"telemetryUrl",get:function(){return this._telemetryUrl}},{key:"maximalNumberOfPeerConnectionReconnectAttempts",get:function(){return this._maximalNumberOfPeerConnectionReconnectAttempts},set:function(e){this._maximalNumberOfPeerConnectionReconnectAttempts=e}},{key:"loggingLevel",get:function(){return F.convertLoggingLevelToLoggingLevelType(this._logger.threshold.value)}},{key:"telemetryLevel",get:function(){return P.convertTelemetryLevelToTelemetryLevelType(e._telemetryLevel.value)}},{key:"browserDetector",get:function(){return G}}]),e}();c()(ce,"_automaticallyRetryOnFailure",!0),c()(ce,"_automaticallyReconnectPeerConnection",!0),c()(ce,"_automaticallyPlayMediaStream",!0),c()(ce,"_automaticallyMuteVideoOnPlayFailure",!0),c()(ce,"_webPlayerLoader",null),c()(ce,"_shakaPlayerLoader",null),c()(ce,"_hlsJsLoader",null),c()(ce,"_configurationParameterReader",new A),c()(ce,"_applicationActivityMonitor",void 0),c()(ce,"_environment",new B("")),c()(ce,"_telemetryUrl",new B("https://telemetry.phenixrts.com/telemetry")),c()(ce,"_maximalNumberOfPeerConnectionReconnectAttempts",8),c()(ce,"_telemetryLevel",new B(T.defaultTelemetryLevel)),c()(ce,"_metricsService",void 0),c()(ce,"_metricsConfiguration",void 0),c()(ce,"_sendLocalCandidates",new B(!h.isPrivate)),c()(ce,"_tenancy",new B("")),c()(ce,"_clientSessionId",E.random(32)),c()(ce,"_loadedTimestamp",new Date),c()(ce,"_logger",O.getLogger("SDK")),c()(ce,"_initialized",new B(!1)),c()(ce,"_peerConnectionFactory",new B(new H)),c()(ce,"_readOnlyInitialized",new W(ce._initialized)),c()(ce,"_readOnlyDiscoveryUri",new W(re.uri)),c()(ce,"_readOnlyPeerConnectionFactory",new W(ce._peerConnectionFactory)),window.addEventListener("unload",(function(){ce.dispose()})),ce.applyDiscoveryUriDefaultFromParameterConfiguration(),ce.applyMetricsConfiguration(),ce.applyTelemetryConfiguration(),ce.applyAutomaticallyRetryOnFailureFromParameterConfiguration(),ce.applyAutomaticallyReconnectPeerConnectionFromParameterConfiguration(),ce.init();var le={SDK:ce}},666:(e,t,n)=>{var r=n(202).default,i=function(e){"use strict";var t,n=Object.prototype,i=n.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(e,t,n,r){var i=t&&t.prototype instanceof v?t:v,o=Object.create(i.prototype),a=new P(r||[]);return o._invoke=function(e,t,n){var r=f;return function(i,o){if(r===d)throw new Error("Generator is already running");if(r===g){if("throw"===i)throw o;return A()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var s=T(a,n);if(s){if(s===y)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===f)throw r=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=d;var u=l(e,t,n);if("normal"===u.type){if(r=n.done?g:h,u.arg===y)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r=g,n.method="throw",n.arg=u.arg)}}}(e,n,a),o}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var f="suspendedStart",h="suspendedYield",d="executing",g="completed",y={};function v(){}function p(){}function m(){}var _={};_[a]=function(){return this};var w=Object.getPrototypeOf,b=w&&w(w(F([])));b&&b!==n&&i.call(b,a)&&(_=b);var k=m.prototype=v.prototype=Object.create(_);function L(e){["next","throw","return"].forEach((function(t){e[t]=function(e){return this._invoke(t,e)}}))}function C(e,t){function n(r,o,a,s){var u=l(e[r],e,o);if("throw"!==u.type){var c=u.arg,f=c.value;return f&&"object"==typeof f&&i.call(f,"__await")?t.resolve(f.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(f).then((function(e){c.value=e,a(c)}),(function(e){return n("throw",e,a,s)}))}s(u.arg)}var r;this._invoke=function(e,i){function o(){return new t((function(t,r){n(e,i,t,r)}))}return r=r?r.then(o,o):o()}}function T(e,n){var r=e.iterator[n.method];if(r===t){if(n.delegate=null,"throw"===n.method){if(e.iterator.return&&(n.method="return",n.arg=t,T(e,n),"throw"===n.method))return y;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var i=l(r,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,y;var o=i.arg;return o?o.done?(n[e.resultName]=o.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,y):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function x(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function F(e){if(e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,o=function n(){for(;++r<e.length;)if(i.call(e,r))return n.value=e[r],n.done=!1,n;return n.value=t,n.done=!0,n};return o.next=o}}return{next:A}}function A(){return{value:t,done:!0}}return p.prototype=k.constructor=m,m.constructor=p,m[u]=p.displayName="GeneratorFunction",e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,u in e||(e[u]="GeneratorFunction")),e.prototype=Object.create(k),e},e.awrap=function(e){return{__await:e}},L(C.prototype),C.prototype[s]=function(){return this},e.AsyncIterator=C,e.async=function(t,n,i,o,a){void 0===a&&(a=r);var s=new C(c(t,n,i,o),a);return e.isGeneratorFunction(n)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},L(k),k[u]="Generator",k[a]=function(){return this},k.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=F,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(x),!e)for(var n in this)"t"===n.charAt(0)&&i.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function r(r,i){return s.type="throw",s.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var u=i.call(a,"catchLoc"),c=i.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&i.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),x(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;x(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:F(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),y}},e}(e.exports);try{regeneratorRuntime=i}catch(e){Function("r","regeneratorRuntime = r")(i)}}},t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}return n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n(867)})()}));
2
2
  //# sourceMappingURL=publish.js.map
@@ -23,6 +23,7 @@ export interface IRtcStatistic {
23
23
  codec?: string;
24
24
  fps?: number;
25
25
  roundTripTime?: number;
26
+ lastPacketReceivedTimestamp?: number;
26
27
  }
27
28
  export default class RtcConnectionMonitor implements IDisposable {
28
29
  private readonly _estimatedRoundTripTime;
@@ -65,13 +65,15 @@ export default class Channel implements IDisposable {
65
65
  setBitrateLimit(bitrateLimit: BitsPerSecond): void;
66
66
  clearBitrateLimit(): void;
67
67
  updateTargetLag(lag: Millisecond): void;
68
- stop(reason: string): void;
68
+ stop(reason: string): Promise<void>;
69
+ private processStop;
69
70
  resume(): Promise<void>;
70
71
  mute(): void;
71
72
  unmute(): void;
72
- dispose(): void;
73
+ dispose(): Promise<void>;
73
74
  getUri(token: any): URL;
74
75
  start(): Promise<void>;
76
+ private processStart;
75
77
  private restartAfterStop;
76
78
  play(): Promise<void>;
77
79
  private getRetryInterval;
@@ -38,6 +38,7 @@ export default class ChannelContext {
38
38
  rtcStatistics: Subject<IRtcMonitorStatistic>;
39
39
  peerConnectionReconnectAttempts: number;
40
40
  isDisposed: boolean;
41
+ isStarting: Subject<boolean>;
41
42
  videoTelemetry: VideoTelemetry;
42
43
  sessionTelemetry: SessionTelemetry;
43
44
  rtcAudioStatistic: IRtcStatistic;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phenixrts/sdk",
3
- "version": "2022.0.2",
3
+ "version": "2022.0.5",
4
4
  "description": "JavaScript SDK",
5
5
  "main": "dist/min/channels",
6
6
  "types": "dist/types/sdk/channels/index.d.ts",